Commit 462cbde2b8017f093c36745a940cf1fbbb4cadfc
1 parent
8001397e
Exists in
master
and in
7 other branches
Criação de mashup com openlayers
Showing
5 changed files
with
516 additions
and
0 deletions
Show diff stats
| ... | ... | @@ -0,0 +1,67 @@ |
| 1 | +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | |
| 2 | +<html> | |
| 3 | +<head> | |
| 4 | +<title>i3Geo</title> | |
| 5 | +</head> | |
| 6 | +<style> | |
| 7 | +body,td | |
| 8 | +{ | |
| 9 | + text-align:left; | |
| 10 | + border: 0px solid #FFFFFF; | |
| 11 | + font-family: Verdana, Arial, Helvetica, sans-serif; | |
| 12 | + position:relative; | |
| 13 | + font-size:10pt; | |
| 14 | + padding:10px; | |
| 15 | +} | |
| 16 | + | |
| 17 | +</style> | |
| 18 | +<body > | |
| 19 | +<img src='../imagens/i3geo1.jpg' /><br> | |
| 20 | +<h1>Mashups do i3geo</h1> | |
| 21 | + | |
| 22 | +<p>Mashups são pequenos programas que podem ser facilmente inseridos em páginas HTML e que mostram determinados conteúdos.</p> | |
| 23 | +<p>No caso do i3Geo, os mashups mostram mapas tendo como base o conjunto de temas existentes no diretório i3geo/temas.</p> | |
| 24 | +<p><b>OpenLayers</b></p> | |
| 25 | +<p>O <a href='http://openlayers.org' >OpenLayers</a> é uma biblioteca em javascript bastante popular. Possuí uma interface simples mas que pode | |
| 26 | +conter um grande número de funcionalidades.</p> | |
| 27 | +<p>Endereço: <a href='openlayers.php'>i3geo/mashups/openlayers.php</a></p> | |
| 28 | +<p>Exemplo: <a href='openlayers.php?temas=biomashp'>i3geo/mashups/openlayers.php?temas=biomashp</a></p> | |
| 29 | + | |
| 30 | +</body> | |
| 31 | +<script> | |
| 32 | +/* | |
| 33 | +Title: Mashups | |
| 34 | + | |
| 35 | +Como usar os mashups do i3geo | |
| 36 | +Link: | |
| 37 | + | |
| 38 | +http://localhost/i3geo/mashup | |
| 39 | + | |
| 40 | +Arquivo: | |
| 41 | + | |
| 42 | +mashup/index.htm | |
| 43 | + | |
| 44 | +Licenca: | |
| 45 | + | |
| 46 | + GPL2 | |
| 47 | + | |
| 48 | + I3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | |
| 49 | + | |
| 50 | + Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil | |
| 51 | + Desenvolvedor: Edmar Moretti edmar.moretti@mma.gov.br | |
| 52 | + | |
| 53 | + Este programa é software livre; você pode redistribuí-lo | |
| 54 | + e/ou modificá-lo sob os termos da Licença Pública Geral | |
| 55 | + GNU conforme publicada pela Free Software Foundation; | |
| 56 | + tanto a versão 2 da Licença. | |
| 57 | + Este programa é distribuído na expectativa de que seja útil, | |
| 58 | + porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | |
| 59 | + de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | |
| 60 | + Consulte a Licença Pública Geral do GNU para mais detalhes. | |
| 61 | + Você deve ter recebido uma cópia da Licença Pública Geral do | |
| 62 | + GNU junto com este programa; se não, escreva para a | |
| 63 | + Free Software Foundation, Inc., no endereço | |
| 64 | + 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 65 | + | |
| 66 | +*/ | |
| 67 | +</script> | |
| 0 | 68 | \ No newline at end of file | ... | ... |
| ... | ... | @@ -0,0 +1,57 @@ |
| 1 | +.olControlEditingToolbar .panItemInactive { | |
| 2 | +background-position:-0px 0; | |
| 3 | +} | |
| 4 | +.olControlEditingToolbar .panItemActive { | |
| 5 | +background-position:-0px -28px; | |
| 6 | +} | |
| 7 | +.olControlEditingToolbar .zoomboxItemInactive { | |
| 8 | +background-position:-29px 0; | |
| 9 | +} | |
| 10 | +.olControlEditingToolbar .zoomboxItemActive { | |
| 11 | +background-position:-29px -28px; | |
| 12 | +} | |
| 13 | +.olControlEditingToolbar .zoomtotItemInactive { | |
| 14 | +background-position:-58px 0; | |
| 15 | +} | |
| 16 | +.olControlEditingToolbar .zoomtotItemActive { | |
| 17 | +background-position:-58px -28px; | |
| 18 | +} | |
| 19 | +.olControlEditingToolbar .legendaItemInactive { | |
| 20 | +background-position:-87px 0; | |
| 21 | +} | |
| 22 | +.olControlEditingToolbar .legendaItemActive { | |
| 23 | +background-position:-87px -28px; | |
| 24 | +} | |
| 25 | +.olControlEditingToolbar .distanciaItemInactive { | |
| 26 | +background-position:-116px 0; | |
| 27 | +} | |
| 28 | +.olControlEditingToolbar .distanciaItemActive { | |
| 29 | +background-position:-116px -28px; | |
| 30 | +} | |
| 31 | +.olControlEditingToolbar .areaItemInactive { | |
| 32 | +background-position:-145px 0; | |
| 33 | +} | |
| 34 | +.olControlEditingToolbar .areaItemActive { | |
| 35 | +background-position:-145px -28px; | |
| 36 | +} | |
| 37 | +.olControlEditingToolbar .identificaItemInactive { | |
| 38 | +background-position:-174px 0; | |
| 39 | +} | |
| 40 | +.olControlEditingToolbar .identificaItemActive { | |
| 41 | +background-position:-174px -28px; | |
| 42 | +} | |
| 43 | +.olControlEditingToolbar { | |
| 44 | + width:300px; | |
| 45 | +} | |
| 46 | +.olControlEditingToolbar div { | |
| 47 | + background-image:url(openlayers.png); | |
| 48 | + background-repeat:no-repeat; | |
| 49 | + float:right; | |
| 50 | + height:29px; | |
| 51 | + margin:2px; | |
| 52 | + width:29px; | |
| 53 | +} | |
| 54 | +pre{ | |
| 55 | + font-family: Verdana, Arial, Helvetica, sans-serif; | |
| 56 | + font-size: 9px; | |
| 57 | +} | |
| 0 | 58 | \ No newline at end of file | ... | ... |
| ... | ... | @@ -0,0 +1,384 @@ |
| 1 | +<?php | |
| 2 | +/* | |
| 3 | +Parametros: | |
| 4 | + | |
| 5 | +temas - lista com os temas (mapfiles) do i3Geo que serão incluídos no mapa | |
| 6 | + | |
| 7 | +numzoomlevels - número de níveis de zoom, default=6 | |
| 8 | + | |
| 9 | +maxextent - extensão geográfica do mapa | |
| 10 | + | |
| 11 | +controles - lista separada por "," com os nomes dos controles que serão adicionados ao mapa. Se não for definido, todos os controles serão adicionados. | |
| 12 | + | |
| 13 | +botoes - lista com os nomes dos botoes que serão adicionados ao mapa. Se não for definido, todos os botões serão adicionados | |
| 14 | + | |
| 15 | +servidor - endereco do servidor OGC utilizado. Por default é "../ogc.php" o que força o uso do i3geo local | |
| 16 | +*/ | |
| 17 | + | |
| 18 | +include_once("../classesphp/pega_variaveis.php"); | |
| 19 | +include_once("../classesphp/carrega_ext.php"); | |
| 20 | +// | |
| 21 | +//imprime na tela a ajuda ao usuário | |
| 22 | +// | |
| 23 | +if(!isset($temas)) | |
| 24 | +{ajuda();} | |
| 25 | +// | |
| 26 | +//define o nível de zoom | |
| 27 | +// | |
| 28 | +if(!isset ($numzoomlevels)) | |
| 29 | +{$numzoomlevels = "6";} | |
| 30 | +// | |
| 31 | +//define a extensão geográfica que será aplicada | |
| 32 | +// | |
| 33 | +if(!isset($maxextent)) | |
| 34 | +{$maxextent = "-76.5125927 -39.3925675209 -29.5851853 9.49014852081";} | |
| 35 | +$maxextent = str_replace(" ",",",$maxextent); | |
| 36 | +// | |
| 37 | +//define quais controles serão mostrados no mapa | |
| 38 | +// | |
| 39 | +$objControles = array(); | |
| 40 | +if(!isset($controles)){ | |
| 41 | + $objControles[] = "new OpenLayers.Control.Navigation()"; | |
| 42 | + $objControles[] = "new OpenLayers.Control.PanZoomBar()"; | |
| 43 | + $objControles[] = "new OpenLayers.Control.LayerSwitcher({'ascending':false})"; | |
| 44 | + $objControles[] = "new OpenLayers.Control.ScaleLine()"; | |
| 45 | + $objControles[] = "new OpenLayers.Control.MousePosition({'separator':' '})"; | |
| 46 | + $objControles[] = "new OpenLayers.Control.OverviewMap()"; | |
| 47 | + $objControles[] = "new OpenLayers.Control.KeyboardDefaults()"; | |
| 48 | +} | |
| 49 | +else{ | |
| 50 | + $controles = str_replace(" ",",",$controles); | |
| 51 | + $controles = strtolower($controles); | |
| 52 | + $controles = explode(",",$controles); | |
| 53 | + if(in_array("navigation",$controles)) | |
| 54 | + {$objControles[] = "new OpenLayers.Control.Navigation()";} | |
| 55 | + if(in_array("panzoombar",$controles)) | |
| 56 | + {$objControles[] = "new OpenLayers.Control.PanZoomBar()";} | |
| 57 | + if(in_array("layerswitcher",$controles)) | |
| 58 | + {$objControles[] = "new OpenLayers.Control.LayerSwitcher({'ascending':false})";} | |
| 59 | + if(in_array("scaleline",$controles)) | |
| 60 | + {$objControles[] = "new OpenLayers.Control.ScaleLine()";} | |
| 61 | + if(in_array("mouseposition",$controles)) | |
| 62 | + {$objControles[] = "new OpenLayers.Control.MousePosition({'separator':' '})";} | |
| 63 | + if(in_array("overviewmap",$controles)) | |
| 64 | + {$objControles[] = "new OpenLayers.Control.OverviewMap()";} | |
| 65 | + if(in_array("keyboarddefaults",$controles)) | |
| 66 | + {$objControles[] = "new OpenLayers.Control.KeyboardDefaults()";} | |
| 67 | +} | |
| 68 | +// | |
| 69 | +//define quais botoes serão mostrados no mapa | |
| 70 | +// | |
| 71 | +$objBotoes = array(); | |
| 72 | +if(!isset($botoes)){ | |
| 73 | + $objBotoes[] = "'pan':true"; | |
| 74 | + $objBotoes[] = "'zoombox':true"; | |
| 75 | + $objBotoes[] = "'zoomtot':true"; | |
| 76 | + $objBotoes[] = "'legenda':true"; | |
| 77 | + $objBotoes[] = "'distancia':true"; | |
| 78 | + $objBotoes[] = "'area':true"; | |
| 79 | + $objBotoes[] = "'identifica':true"; | |
| 80 | +} | |
| 81 | +else{ | |
| 82 | + $botoes = str_replace(" ",",",$botoes); | |
| 83 | + $botoes = strtolower($botoes); | |
| 84 | + $botoes = explode(",",$botoes); | |
| 85 | + if(in_array("pan",$botoes)) | |
| 86 | + {$objBotoes[] = "'pan':true";} | |
| 87 | + if(in_array("zoombox",$botoes)) | |
| 88 | + {$objBotoes[] = "'zoombox':true";} | |
| 89 | + if(in_array("zoomtot",$botoes)) | |
| 90 | + {$objBotoes[] = "'zoomtot':true";} | |
| 91 | + if(in_array("legenda",$botoes)) | |
| 92 | + {$objBotoes[] = "'legenda':true";} | |
| 93 | + if(in_array("distancia",$botoes)) | |
| 94 | + {$objBotoes[] = "'distancia':true";} | |
| 95 | + if(in_array("area",$botoes)) | |
| 96 | + {$objBotoes[] = "'area':true";} | |
| 97 | + if(in_array("identifica",$botoes)) | |
| 98 | + {$objBotoes[] = "'identifica':true";} | |
| 99 | +} | |
| 100 | +$botoes = "{".implode(",",$objBotoes)."}"; | |
| 101 | +// | |
| 102 | +//define quais os layers que comporão o mapa | |
| 103 | +// | |
| 104 | +$temas = str_replace(" ",",",$temas); | |
| 105 | +$temas = strtolower($temas); | |
| 106 | +$temas = explode(",",$temas); | |
| 107 | +$layers = array(); | |
| 108 | +$objOpenLayers = array(); | |
| 109 | +if(isset($servidor) && $servidor != "../ogc.php"){ | |
| 110 | + $layers = $temas; | |
| 111 | + foreach($temas as $tema){ | |
| 112 | + $objOpenLayers[] = 'new OpenLayers.Layer.WMS( "'.$tema.'", "'.$servidor.'?tema='.$tema.'&",{layers:"'.$tema.'",transparent: "true", format: "image/png"},{isBaseLayer:false})'; | |
| 113 | + } | |
| 114 | +} | |
| 115 | +else{ | |
| 116 | + foreach($temas as $tema){ | |
| 117 | + if(file_exists("../temas/".$tema.".map")){ | |
| 118 | + $maptemp = @ms_newMapObj("../temas/".$tema.".map"); | |
| 119 | + for($i=0;$i<($maptemp->numlayers);++$i) | |
| 120 | + { | |
| 121 | + $layern = $maptemp->getLayer($i); | |
| 122 | + $layers[] = $layern->name; | |
| 123 | + } | |
| 124 | + $objOpenLayers[] = 'new OpenLayers.Layer.WMS( "'.($layern->getmetadata("tema")).'", "../ogc.php?tema='.$tema.'&",{layers:"'.implode(",",$layers).'",transparent: "true", format: "image/png"},{isBaseLayer:false})'; | |
| 125 | + } | |
| 126 | + else | |
| 127 | + {echo $tema." não foi encontrado.<br>";} | |
| 128 | + $layers = array(); | |
| 129 | + } | |
| 130 | +} | |
| 131 | +function ajuda(){ | |
| 132 | + echo " | |
| 133 | +<pre><b> | |
| 134 | +Mashup OpenLayers | |
| 135 | +Parâmetros: | |
| 136 | + servidor - endereco do servidor OGC utilizado. Por default é ../ogc.php o que força o uso do i3geo local | |
| 137 | + temas - lista com os temas (mapfiles) do i3Geo que serão incluídos no mapa | |
| 138 | + numzoomlevels - número de níveis de zoom, default=6 | |
| 139 | + maxextent - extensão geográfica do mapa (xmin,ymin,xmax,ymax) | |
| 140 | + controles - lista com os nomes dos controles que serão adicionados ao mapa. Se não for definido, todos os controles serão adicionados | |
| 141 | + navigation | |
| 142 | + panzoombar | |
| 143 | + layerswitcher | |
| 144 | + scaleline | |
| 145 | + mouseposition | |
| 146 | + overviewmap | |
| 147 | + keyboarddefaults | |
| 148 | + botoes - lista com os nomes dos botoes que serão adicionados ao mapa. Se não for definido, todos os botões serão adicionados | |
| 149 | + pan | |
| 150 | + zoombox | |
| 151 | + zoomtot | |
| 152 | + distancia | |
| 153 | + area | |
| 154 | + identifica | |
| 155 | + "; | |
| 156 | + exit; | |
| 157 | +} | |
| 158 | +?> | |
| 159 | +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | |
| 160 | +<html> | |
| 161 | +<head> | |
| 162 | +<script type="text/javascript" src="../classesjs/compactados/classe_calculo_compacto.js"></script> | |
| 163 | +<script type="text/javascript" src="../pacotes/openlayers/OpenLayers.js.php"></script> | |
| 164 | +<link rel="stylesheet" href="../pacotes/openlayers/theme/default/style.css" type="text/css" /> | |
| 165 | +<link rel="stylesheet" href="openlayers.css" type="text/css" /> | |
| 166 | + | |
| 167 | +</head> | |
| 168 | +<body> | |
| 169 | +<div id=i3geoMapa style="width:400px;height:400px;"></div> | |
| 170 | +<script type="text/javascript"> | |
| 171 | +navn = false; | |
| 172 | +//seta as variáveis navn e navm | |
| 173 | +var navn = false; | |
| 174 | +var navm = false; | |
| 175 | +var app = navigator.appName.substring(0,1); | |
| 176 | +if (app==='N'){navn=true;}else{navm=true;} | |
| 177 | + | |
| 178 | +OpenLayers.ImgPath = "../pacotes/openlayers/img/" | |
| 179 | +OpenLayers.Lang.setCode("pt-BR"); | |
| 180 | +function i3GeoMapaInicia(){ | |
| 181 | + i3geoOL = new OpenLayers.Map('i3geoMapa', { | |
| 182 | + controls: [ | |
| 183 | + <?php echo implode(",",$objControles); ?> | |
| 184 | + ], | |
| 185 | + numZoomLevels: <?php echo $numzoomlevels;?>, | |
| 186 | + maxExtent: new OpenLayers.Bounds(<?php echo $maxextent;?>) | |
| 187 | + }); | |
| 188 | + var ol_wms = new OpenLayers.Layer.WMS.Untiled( "OpenLayers WMS","http://labs.metacarta.com/wms/vmap0",{layers: 'basic'} ); | |
| 189 | + var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic","http://t1.hypercube.telascience.org/cgi-bin/landsat7",{layers: "landsat7"}); | |
| 190 | + //var dm_wms = new OpenLayers.Layer.WMS( "DM Solutions Demo","http://www2.dmsolutions.ca/cgi-bin/mswms_gmap",{layers: "bathymetry,land_fn,park,drain_fn,drainage," +"prov_bound,fedlimit,rail,road,popplace",transparent: "true", format: "image/png" },{isBaseLayer:true); | |
| 191 | + jpl_wms.setVisibility(false); | |
| 192 | + //dm_wms.setVisibility(false); | |
| 193 | + i3geoOL.addLayers([ol_wms, jpl_wms, <?php echo implode(",",$objOpenLayers); ?>]); | |
| 194 | + i3geoOL.zoomToMaxExtent(); | |
| 195 | + // | |
| 196 | + //substitui o controle que mostra as coordenadas | |
| 197 | + // | |
| 198 | + var idcoord = i3geoOL.getControlsBy("separator"," "); | |
| 199 | + //alert(idcoord[0].id) | |
| 200 | + if(idcoord[0]){ | |
| 201 | + i3geoOL.events.register("mousemove", i3geoOL, function(e){ | |
| 202 | + var p,lonlat,d,dc; | |
| 203 | + if (navm) | |
| 204 | + {p = new OpenLayers.Pixel(e.x,e.y);} | |
| 205 | + else | |
| 206 | + {p = e.xy;} | |
| 207 | + //altera o indicador de localizacao | |
| 208 | + lonlat = i3geoOL.getLonLatFromPixel(p); | |
| 209 | + d = i3GEO.calculo.dd2dms(lonlat.lon,lonlat.lat); | |
| 210 | + try{ | |
| 211 | + $i(idcoord[0].id).innerHTML = "Long: "+d[0]+"<br>Lat: "+d[1]; | |
| 212 | + } | |
| 213 | + catch(e){ | |
| 214 | + if(typeof(console) !== 'undefined'){console.error(e);} | |
| 215 | + } | |
| 216 | + }); | |
| 217 | + } | |
| 218 | + var botoes = <?php echo $botoes; ?>; | |
| 219 | + criaBotoes(botoes); | |
| 220 | +}; | |
| 221 | +function criaBotoes(botoes){ | |
| 222 | + var sketchSymbolizers = { | |
| 223 | + "Point": { | |
| 224 | + pointRadius: 4, | |
| 225 | + graphicName: "square", | |
| 226 | + fillColor: "white", | |
| 227 | + fillOpacity: 1, | |
| 228 | + strokeWidth: 1, | |
| 229 | + strokeOpacity: 1, | |
| 230 | + strokeColor: "#333333" | |
| 231 | + }, | |
| 232 | + "Line": { | |
| 233 | + strokeWidth: 3, | |
| 234 | + strokeOpacity: 1, | |
| 235 | + strokeColor: "#666666", | |
| 236 | + strokeDashstyle: "dash" | |
| 237 | + }, | |
| 238 | + "Polygon": { | |
| 239 | + strokeWidth: 2, | |
| 240 | + strokeOpacity: 1, | |
| 241 | + strokeColor: "#666666", | |
| 242 | + fillColor: "white", | |
| 243 | + fillOpacity: 0.3 | |
| 244 | + } | |
| 245 | + }; | |
| 246 | + var style = new OpenLayers.Style(); | |
| 247 | + style.addRules([ | |
| 248 | + new OpenLayers.Rule({symbolizer: sketchSymbolizers}) | |
| 249 | + ]); | |
| 250 | + var styleMap = new OpenLayers.StyleMap({"default": style}); | |
| 251 | + | |
| 252 | + var adiciona = false; | |
| 253 | + var controles = new Array(); | |
| 254 | + var panel = new OpenLayers.Control.Panel({ | |
| 255 | + displayClass: "olControlEditingToolbar noprint" | |
| 256 | + }); | |
| 257 | + if(botoes.pan==true){ | |
| 258 | + controles.push(new OpenLayers.Control.Navigation({title: "Deslocar",displayClass:"pan"})); | |
| 259 | + var adiciona = true; | |
| 260 | + } | |
| 261 | + if(botoes.zoombox==true){ | |
| 262 | + controles.push(new OpenLayers.Control.ZoomBox({displayClass: "zoombox",title: "Zoom"})); | |
| 263 | + var adiciona = true; | |
| 264 | + } | |
| 265 | + if(botoes.zoomtot==true){ | |
| 266 | + var button = new OpenLayers.Control.Button({ | |
| 267 | + displayClass: "zoomtot", | |
| 268 | + trigger: function(){i3geoOL.zoomToMaxExtent();}, | |
| 269 | + title: "Ajusta extensão" | |
| 270 | + }); | |
| 271 | + controles.push(button); | |
| 272 | + var adiciona = true; | |
| 273 | + } | |
| 274 | + if(botoes.legenda==true){ | |
| 275 | + var button = new OpenLayers.Control.Button({ | |
| 276 | + displayClass: "legenda", | |
| 277 | + trigger: function(){mostraLegenda();}, | |
| 278 | + title: "Legenda" | |
| 279 | + }); | |
| 280 | + controles.push(button); | |
| 281 | + var adiciona = true; | |
| 282 | + } | |
| 283 | + if(botoes.distancia==true){ | |
| 284 | + var button = new OpenLayers.Control.Measure( | |
| 285 | + OpenLayers.Handler.Path, | |
| 286 | + { | |
| 287 | + handlerOptions: {layerOptions: {styleMap: styleMap}}, | |
| 288 | + persist: true, | |
| 289 | + displayClass: "distancia", | |
| 290 | + title: "Distância" | |
| 291 | + } | |
| 292 | + ); | |
| 293 | + button.events.on({ | |
| 294 | + "measure": function(event){ | |
| 295 | + var units = event.units; | |
| 296 | + var measure = event.measure; | |
| 297 | + alert("Distância: " + measure.toFixed(3) + " " + units); | |
| 298 | + }, | |
| 299 | + }); | |
| 300 | + controles.push(button); | |
| 301 | + var adiciona = true; | |
| 302 | + } | |
| 303 | + if(botoes.area==true){ | |
| 304 | + var button = new OpenLayers.Control.Measure( | |
| 305 | + OpenLayers.Handler.Polygon, | |
| 306 | + { | |
| 307 | + handlerOptions: {layerOptions: {styleMap: styleMap}}, | |
| 308 | + persist: true, | |
| 309 | + displayClass: "area", | |
| 310 | + title: "Área" | |
| 311 | + } | |
| 312 | + ); | |
| 313 | + button.events.on({ | |
| 314 | + "measure": function(event){ | |
| 315 | + var units = event.units; | |
| 316 | + var measure = event.measure; | |
| 317 | + alert("Área: " + measure.toFixed(3) + " " + units + " quadrados"); | |
| 318 | + }, | |
| 319 | + }); | |
| 320 | + controles.push(button); | |
| 321 | + var adiciona = true; | |
| 322 | + } | |
| 323 | + if(botoes.identifica==true){ | |
| 324 | + button = new OpenLayers.Control.WMSGetFeatureInfo({ | |
| 325 | + maxFeatures:1, | |
| 326 | + infoFormat:'text/plain', //'application/vnd.ogc.gml', | |
| 327 | + layers: pegaLayers(), | |
| 328 | + queryVisible: true, | |
| 329 | + title: "Identificar", | |
| 330 | + displayClass: "identifica", | |
| 331 | + eventListeners: { | |
| 332 | + getfeatureinfo: function(event) { | |
| 333 | + i3geoOL.addPopup(new OpenLayers.Popup.FramedCloud( | |
| 334 | + "chicken", | |
| 335 | + i3geoOL.getLonLatFromPixel(event.xy), | |
| 336 | + null, | |
| 337 | + "<pre>"+event.text+"</pre>", | |
| 338 | + null, | |
| 339 | + true | |
| 340 | + )); | |
| 341 | + } | |
| 342 | + } | |
| 343 | + }); | |
| 344 | + //button.events.register("getfeatureinfo", this, showInfo); | |
| 345 | + controles.push(button); | |
| 346 | + var adiciona = true; | |
| 347 | + } | |
| 348 | + // | |
| 349 | + //adiciona o painel ao mapa se alguma op��o foi inserida | |
| 350 | + // | |
| 351 | + if(adiciona == true){ | |
| 352 | + panel.addControls(controles); | |
| 353 | + i3geoOL.addControl(panel); | |
| 354 | + } | |
| 355 | +} | |
| 356 | +function mostraLegenda(){ | |
| 357 | + var layers = pegaLayers() | |
| 358 | + var nlayers = layers.length; | |
| 359 | + var ins = ""; | |
| 360 | + for(i=0;i<nlayers;i++){ | |
| 361 | + var url = layers[i].getFullRequestString({"request":"getlegendgraphic"}); | |
| 362 | + url = url.replace("LAYERS","LAYER"); | |
| 363 | + ins += "<img src='"+url+"' /><br>"; | |
| 364 | + } | |
| 365 | + var w = window.open() | |
| 366 | + w.document.write(ins) | |
| 367 | + w.document.close(); | |
| 368 | + | |
| 369 | +} | |
| 370 | +function pegaLayers(){ | |
| 371 | + var layers = i3geoOL.layers; | |
| 372 | + var nlayers = layers.length; | |
| 373 | + var ins = new Array(); | |
| 374 | + for(i=0;i<nlayers;i++){ | |
| 375 | + if(layers[i].visibility && (layers[i].isBaseLayer == false)){ | |
| 376 | + ins.push(layers[i]); | |
| 377 | + } | |
| 378 | + } | |
| 379 | + return ins; | |
| 380 | +} | |
| 381 | +i3GeoMapaInicia(); | |
| 382 | +</script> | |
| 383 | +</body> | |
| 384 | +</html> | ... | ... |
7.52 KB
principal.htm
| ... | ... | @@ -125,6 +125,14 @@ Aplicativos disponíveis com o i3geo e documentação. |
| 125 | 125 | <tr> |
| 126 | 126 | <td></td> |
| 127 | 127 | <td> |
| 128 | + <a href="mashups/index.html" target="_blank" > | |
| 129 | + Mashups | |
| 130 | + </a> | |
| 131 | + </td> | |
| 132 | +</tr> | |
| 133 | +<tr> | |
| 134 | + <td></td> | |
| 135 | + <td> | |
| 128 | 136 | <a href="ms_criamapa.php" target="_blank" > |
| 129 | 137 | Inicialização normal do i3geo |
| 130 | 138 | </a> | ... | ... |