Commit 1d90cf7a18876d0942816f1cdd0f7844a223b028
1 parent
4b2ffa69
Exists in
master
and in
7 other branches
Inclusão do mashup com Open Street Map
Showing
7 changed files
with
625 additions
and
25 deletions
Show diff stats
classesjs/classe_editorol.js
1 | 1 | if(!i3GEO || typeof(i3GEO) === 'undefined'){ |
2 | - var i3GEO = {}; | |
2 | + var i3GEO = { | |
3 | + }; | |
4 | + i3GEO.Interface = {}; | |
3 | 5 | navn = false; |
4 | 6 | navm = false; |
5 | 7 | $i = function(id){ |
... | ... | @@ -249,7 +251,7 @@ i3GEO.editorOL = { |
249 | 251 | else{ |
250 | 252 | i3GEO.editorOL.mapa.zoomToMaxExtent(); |
251 | 253 | } |
252 | - if(i3GEO.Interface){ | |
254 | + if(i3GEO.Interface && i3GEO.Interface.openlayers && i3GEO.Interface.openlayers.sobeLayersGraficos){ | |
253 | 255 | i3GEO.Interface.openlayers.sobeLayersGraficos(); |
254 | 256 | } |
255 | 257 | }, |
... | ... | @@ -283,6 +285,7 @@ i3GEO.editorOL = { |
283 | 285 | var layer,url; |
284 | 286 | url = tms.url.replace("&cache=sim","&DESLIGACACHE=sim"); |
285 | 287 | url = url.replace("&Z=${z}&X=${x}&Y=${y}",""); |
288 | + url = url.replace("Z=${z}&X=${x}&Y=${y}",""); | |
286 | 289 | layer = new OpenLayers.Layer.WMS( |
287 | 290 | tms.layername+"_clone", |
288 | 291 | url, |
... | ... | @@ -492,9 +495,10 @@ i3GEO.editorOL = { |
492 | 495 | document.body.style.cursor="wait"; |
493 | 496 | document.getElementById("i3geoMapa").style.cursor = "wait"; |
494 | 497 | var u = layer.url+"&request=getfeature&service=wfs&version=1.0.0"; |
498 | + u = u.replace("Z=${z}&X=${x}&Y=${y}",""); | |
495 | 499 | u += "&OUTPUTFORMAT=gml2&typename="+layer.params.LAYERS; |
496 | 500 | u += "&filter=<Filter><PropertyIsLike wildcard=* singleChar=. escape=! ><PropertyName>"+item+"</PropertyName><Literal>*"+palavra+"*</Literal></PropertyIsLike></Filter>"; |
497 | - document.body.style.cursor="wait"; | |
501 | + document.body.style.cursor="wait"; | |
498 | 502 | document.getElementById("i3geoMapa").style.cursor = "wait"; |
499 | 503 | document.getElementById(onde).innerHTML = "..."; |
500 | 504 | OpenLayers.Request.issue({ |
... | ... | @@ -553,7 +557,9 @@ i3GEO.editorOL = { |
553 | 557 | } |
554 | 558 | else{ |
555 | 559 | url = url.replace("LAYERS","LAYER"); |
556 | - ins += layers[i].name+"<br><img src='"+url+"' /><br>"; | |
560 | + url = url.replace("&Z=${z}&X=${x}&Y=${y}",""); | |
561 | + url = url.replace("Z=${z}&X=${x}&Y=${y}",""); | |
562 | + ins += layers[i].name+"<br><img src='"+url+"&SERVICE=wms' /><br>"; | |
557 | 563 | } |
558 | 564 | } |
559 | 565 | } |
... | ... | @@ -584,18 +590,20 @@ i3GEO.editorOL = { |
584 | 590 | }, |
585 | 591 | captura: function(lonlat){ |
586 | 592 | //if(i3GEO.desenho.layergrafico !== ""){return;} |
587 | - var layers = [i3GEO.editorOL.layerAtivo()], | |
593 | + var d = 0.1, | |
594 | + layers = [i3GEO.editorOL.layerAtivo()], | |
588 | 595 | xy = lonlat.split(","), |
589 | 596 | u = layers[0].url+"&REQUEST=getfeature&service=wfs&version=1.0.0"; |
590 | 597 | u += "&OUTPUTFORMAT=gml2&typename="+layers[0].params.LAYERS; |
591 | 598 | //remove parametros nao desejados |
592 | 599 | u = u.replace("&cache=sim","&DESLIGACACHE=sim"); |
593 | 600 | u = u.replace("&Z=${z}&X=${x}&Y=${y}",""); |
601 | + u = u.replace("Z=${z}&X=${x}&Y=${y}",""); | |
594 | 602 | //u += "&filter=<Filter><Intersects><PropertyName>Geometry</PropertyName><gml:Point><gml:coordinates>"+lonlat+"</gml:coordinates></gml:Point></Intersects></Filter>"; |
595 | 603 | |
596 | 604 | xy[0] = xy[0] * 1; |
597 | 605 | xy[1] = xy[1] * 1; |
598 | - var poligono = (xy[0]-0.1)+","+(xy[1]+0.1) + " "+(xy[0]+0.1)+","+(xy[1]+0.1)+" " + (xy[0]+0.1)+","+(xy[1]-0.1)+" " + (xy[0]-0.1)+","+(xy[1]-0.1)+" "+(xy[0]-0.1)+","+(xy[1]+0.1); | |
606 | + var poligono = (xy[0] - d)+","+(xy[1] + d) + " "+(xy[0] + d)+","+(xy[1] + d)+" " + (xy[0] + d)+","+(xy[1] - d)+" " + (xy[0] - d)+","+(xy[1] - d)+" "+(xy[0] - d)+","+(xy[1] + d); | |
599 | 607 | u += "&filter=<Filter><Intersects><PropertyName>Geometry</PropertyName><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:posList>"+poligono+"</gml:posList></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></Intersects></Filter>"; |
600 | 608 | |
601 | 609 | document.body.style.cursor="wait"; |
... | ... | @@ -644,7 +652,9 @@ i3GEO.editorOL = { |
644 | 652 | ins = ""; |
645 | 653 | if(n > 0){ |
646 | 654 | if($i("panelsalvageometrias")){ |
647 | - YAHOO.salvaGeometrias.container.panel = YAHOO.i3GEO.janela.manager.find("panelsalvageometrias"); | |
655 | + if(YAHOO.i3GEO){ | |
656 | + YAHOO.salvaGeometrias.container.panel = YAHOO.i3GEO.janela.manager.find("panelsalvageometrias"); | |
657 | + } | |
648 | 658 | YAHOO.salvaGeometrias.container.panel.show(); |
649 | 659 | YAHOO.salvaGeometrias.container.panel.bringToTop(); |
650 | 660 | } |
... | ... | @@ -657,7 +667,7 @@ i3GEO.editorOL = { |
657 | 667 | YAHOO.salvaGeometrias.container.panel.setFooter(""); |
658 | 668 | YAHOO.salvaGeometrias.container.panel.render(document.body); |
659 | 669 | YAHOO.salvaGeometrias.container.panel.center(); |
660 | - if(YAHOO.i3GEO.janela){ | |
670 | + if(YAHOO.i3GEO && YAHOO.i3GEO.janela){ | |
661 | 671 | YAHOO.i3GEO.janela.manager.register(YAHOO.salvaGeometrias.container.panel); |
662 | 672 | } |
663 | 673 | YAHOO.salvaGeometrias.container.panel.show(); |
... | ... | @@ -666,7 +676,9 @@ i3GEO.editorOL = { |
666 | 676 | } |
667 | 677 | ins += "<p class=paragrafo >Foram encontrada(s) "+n+" geometria(s) selecionada(s) </p>"; |
668 | 678 | ins += "<p class=paragrafo ><a href='#' onclick='i3GEO.editorOL.listaGeometriasSel()' >Listar</a> "; |
669 | - ins += "<a href='#' onclick='"+i3GEO.editorOL.nomeFuncaoSalvar+"' >Salvar</a> "; | |
679 | + if(i3GEO.arvoreDeCamadas){ | |
680 | + ins += "<a href='#' onclick='"+i3GEO.editorOL.nomeFuncaoSalvar+"' >Salvar</a> "; | |
681 | + } | |
670 | 682 | ins += "<a href='#' onclick='i3GEO.editorOL.exportarSHP()' >Exportar (shapefile)</a></p>"; |
671 | 683 | YAHOO.salvaGeometrias.container.panel.setBody(ins); |
672 | 684 | } |
... | ... | @@ -921,7 +933,7 @@ i3GEO.editorOL = { |
921 | 933 | "measure": function(event){ |
922 | 934 | var units = event.units, |
923 | 935 | measure = event.measure; |
924 | - alert("Distância: " + measure.toFixed(3) + " " + units); | |
936 | + alert("Distancia: " + measure.toFixed(3) + " " + units); | |
925 | 937 | } |
926 | 938 | }); |
927 | 939 | controles.push(button); |
... | ... | @@ -1006,7 +1018,7 @@ i3GEO.editorOL = { |
1006 | 1018 | beforegetfeatureinfo: function(event){ |
1007 | 1019 | var ativo = [i3GEO.editorOL.layerAtivo()]; |
1008 | 1020 | //se for TMS tem de pegar o clone wms |
1009 | - if(ativo[0].CLASS_NAME == "OpenLayers.Layer.TMS" || ativo[0].CLASS_NAME == "OpenLayers.Layer.OSM"){ | |
1021 | + if(ativo[0].serviceVersion === "&tms=" || ativo[0].CLASS_NAME == "OpenLayers.Layer.TMS" || ativo[0].CLASS_NAME == "OpenLayers.Layer.OSM"){ | |
1010 | 1022 | ativo = [i3GEO.editorOL.layertms2wms(ativo[0])]; |
1011 | 1023 | } |
1012 | 1024 | ativo[0].projection = new OpenLayers.Projection("EPSG:4326"); |
... | ... | @@ -1046,7 +1058,7 @@ i3GEO.editorOL = { |
1046 | 1058 | i3GEO.desenho.layergrafico.addFeatures([f]); |
1047 | 1059 | if(document.getElementById("panellistagEditor")) |
1048 | 1060 | {i3GEO.editorOL.listaGeometrias();} |
1049 | - if(i3GEO.Interface){ | |
1061 | + if(i3GEO.Interface && i3GEO.Interface.openlayers && i3GEO.Interface.openlayers.sobeLayersGraficos){ | |
1050 | 1062 | i3GEO.Interface.openlayers.sobeLayersGraficos(); |
1051 | 1063 | } |
1052 | 1064 | } |
... | ... | @@ -1093,7 +1105,7 @@ i3GEO.editorOL = { |
1093 | 1105 | i3GEO.desenho.layergrafico.addFeatures([f]); |
1094 | 1106 | if(document.getElementById("panellistagEditor")) |
1095 | 1107 | {i3GEO.editorOL.listaGeometrias();} |
1096 | - if(i3GEO.Interface){ | |
1108 | + if(i3GEO.Interface && i3GEO.Interface.openlayers && i3GEO.Interface.openlayers.sobeLayersGraficos){ | |
1097 | 1109 | i3GEO.Interface.openlayers.sobeLayersGraficos(); |
1098 | 1110 | } |
1099 | 1111 | } |
... | ... | @@ -1127,7 +1139,7 @@ i3GEO.editorOL = { |
1127 | 1139 | i3GEO.desenho.layergrafico.addFeatures([f]); |
1128 | 1140 | if(document.getElementById("panellistagEditor")) |
1129 | 1141 | {i3GEO.editorOL.listaGeometrias();} |
1130 | - if(i3GEO.Interface){ | |
1142 | + if(i3GEO.Interface && i3GEO.Interface.openlayers && i3GEO.Interface.openlayers.sobeLayersGraficos){ | |
1131 | 1143 | i3GEO.Interface.openlayers.sobeLayersGraficos(); |
1132 | 1144 | } |
1133 | 1145 | } |
... | ... | @@ -1166,7 +1178,7 @@ i3GEO.editorOL = { |
1166 | 1178 | }; |
1167 | 1179 | if(texto && texto !== "") |
1168 | 1180 | {i3GEO.desenho.layergrafico.addFeatures([label]);} |
1169 | - if(i3GEO.Interface){ | |
1181 | + if(i3GEO.Interface && i3GEO.Interface.openlayers && i3GEO.Interface.openlayers.sobeLayersGraficos){ | |
1170 | 1182 | i3GEO.Interface.openlayers.sobeLayersGraficos(); |
1171 | 1183 | } |
1172 | 1184 | } | ... | ... |
classesjs/compactados/classe_editorol_compacto.js
1 | -if(!i3GEO||typeof(i3GEO)==='undefined'){var i3GEO={};navn=false;navm=false;$i=function(id){return document.getElementById(id)};app=navigator.appName.substring(0,1);if(app==='N'){navn=true}else{navm=true}OpenLayers.ImgPath="../pacotes/openlayers/img/";OpenLayers.Lang.setCode("pt-BR")}i3GEO.editorOL={simbologia:{opacidade:0.8,texto:"",fillColor:"250,180,15",strokeWidth:2,strokeColor:"250,150,0",pointRadius:4,graphicName:"square",fontSize:"12px",fontColor:"0,0,0",externalGraphic:"",graphicHeight:25,graphicWidth:25},backup:new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false}),nomeFuncaoSalvar:"i3GEO.editorOL.salvaGeo()",e_oce:new OpenLayers.Layer.ArcGIS93Rest("ESRI Ocean Basemap","http://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer/export",{format:"jpeg"},{isBaseLayer:true,visibility:false}),e_ims:new OpenLayers.Layer.ArcGIS93Rest("ESRI Imagery World 2D","http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer/export",{format:"jpeg"},{isBaseLayer:true,visibility:false}),e_wsm:new OpenLayers.Layer.ArcGIS93Rest("ESRI World Street Map","http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer/export",{format:"jpeg"},{isBaseLayer:true,visibility:false}),ol_mma:new OpenLayers.Layer.WMS("Base cartográfica","http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseraster.map&",{layers:'baseraster',SRS:'EPSG:4618',FORMAT:'image/png'},{singleTile:false}),ol_wms:new OpenLayers.Layer.WMS("OpenLayers WMS","http://labs.metacarta.com/wms/vmap0",{layers:'basic'}),top_wms:new OpenLayers.Layer.WMS("Toponímia MMA","http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseref.map&",{layers:"base",FORMAT:'image/png'}),est_wms:new OpenLayers.Layer.WMS("Estados do Brasil","http://mapas.mma.gov.br/i3geo/ogc.php?tema=estadosl&",{layers:"estadosl",FORMAT:'image/png'}),osm:new OpenLayers.Layer.OSM("OSM","http://tile.openstreetmap.org/${z}/${x}/${y}.png",{isBaseLayer:true,visibility:false}),fundo:"e_ims,e_wsm,ol_mma,ol_wms,top_wms,est_wms,e_oce",kml:[],layersIniciais:[],botoes:{'pan':true,'zoombox':true,'zoomtot':true,'zoomin':true,'zoomout':true,'legenda':true,'distancia':true,'area':true,'identifica':true,'linha':true,'ponto':true,'poligono':true,'texto':true,'edita':true,'listag':true,'corta':true,'apaga':true,'procura':true,'selecao':true,'salva':true,'ajuda':true,'propriedades':true,'fecha':false,'tools':true,'undo':false,'frente':false,'legenda':true,'rodadomouse':true},pontos:[],marca:"../pacotes/openlayers/img/marker-gold.png",controles:[new OpenLayers.Control.Navigation(),new OpenLayers.Control.PanZoomBar(),new OpenLayers.Control.LayerSwitcher({'ascending':false}),new OpenLayers.Control.ScaleLine(),new OpenLayers.Control.MousePosition({'separator':' '}),new OpenLayers.Control.OverviewMap(),new OpenLayers.Control.KeyboardDefaults()],tiles:true,incluilayergrafico:true,ativalayerswitcher:false,ativarodadomouse:true,legendahtml:false,numzoom:12,minresolution:0.703125,maxext:"",mapext:new OpenLayers.Bounds(-76.5125927,-39.3925675209,-29.5851853,9.49014852081),mapa:"",inicia:function(){var single=false,alayers=[],fundo=(i3GEO.editorOL.fundo).split(","),nfundo=fundo.length,ncontroles=i3GEO.editorOL.controles.length,i,n;if(i3GEO.editorOL.tiles===false||i3GEO.editorOL.tiles==="false"){single=true}if(i3GEO.editorOL.ativalayerswitcher==="false"){i3GEO.editorOL.ativalayerswitcher=false}if(i3GEO.editorOL.ativalayerswitcher==="true"){i3GEO.editorOL.ativalayerswitcher=true}if(i3GEO.editorOL.ativarodadomouse==="false"){i3GEO.editorOL.ativarodadomouse=false}if(i3GEO.editorOL.ativarodadomouse==="true"){i3GEO.editorOL.ativarodadomouse=true}if(i3GEO.editorOL.legendahtml==="false"){i3GEO.editorOL.legendahtml=false}if(i3GEO.editorOL.legendahtml==="true"){i3GEO.editorOL.legendahtml=true}if(i3GEO.editorOL.incluilayergrafico==="false"){i3GEO.editorOL.incluilayergrafico=false}if(i3GEO.editorOL.incluilayergrafico==="true"){i3GEO.editorOL.incluilayergrafico=true}if(i3GEO.editorOL.incluilayergrafico===true){if(!i3GEO.desenho.layergrafico){i3GEO.editorOL.criaLayerGrafico()}}else{i3GEO.desenho.layergrafico="";i3GEO.editorOL.botoes.linha=false;i3GEO.editorOL.botoes.ponto=false;i3GEO.editorOL.botoes.poligono=false;i3GEO.editorOL.botoes.texto=false;i3GEO.editorOL.botoes.edita=false;i3GEO.editorOL.botoes.listag=false;i3GEO.editorOL.botoes.corta=false;i3GEO.editorOL.botoes.apaga=false;i3GEO.editorOL.botoes.selecao=false;i3GEO.editorOL.botoes.salva=false;i3GEO.editorOL.botoes.propriedades=false;i3GEO.editorOL.botoes.fecha=false;i3GEO.editorOL.botoes.tools=false;i3GEO.editorOL.botoes.undo=false;i3GEO.editorOL.botoes.frente=false}if(i3GEO.editorOL.mapa===""){alert("O objeto i3GEO.editorOL.mapa precisa ser criado com new OpenLayers.Map()");return}for(i=0;i<ncontroles;i++){i3GEO.editorOL.mapa.addControl(i3GEO.editorOL.controles[i])}if(i3GEO.editorOL.fundo!=""){for(i=nfundo-1;i>=0;i--){if(fundo[i]!=""){try{eval("i3GEO.editorOL."+fundo[i]+".transitionEffect = 'resize';");eval("i3GEO.editorOL."+fundo[i]+".setVisibility(false);");eval("i3GEO.editorOL."+fundo[i]+".singleTile = false;");eval("alayers.push(i3GEO.editorOL."+fundo[i]+");")}catch(e){if(alayers[0]){alayers[0].setVisibility(true)}}}}}i3GEO.editorOL.mapa.addLayers(alayers);if(i3GEO.editorOL.layersIniciais!==""){n=i3GEO.editorOL.layersIniciais.length;for(i=0;i<n;i++){i3GEO.editorOL.layersIniciais[i].singleTile=single;i3GEO.editorOL.mapa.addLayer(i3GEO.editorOL.layersIniciais[i])}}if(!i3GEO.desenho.layergrafico){i3GEO.editorOL.mapa.addLayers([i3GEO.desenho.layergrafico])}i3GEO.editorOL.adicionaKml();i3GEO.editorOL.adicionaMarcas();i3GEO.editorOL.coordenadas();i3GEO.editorOL.criaJanelaBusca();i3GEO.editorOL.criaBotoes(i3GEO.editorOL.botoes);if(i3GEO.editorOL.ativalayerswitcher===true){i3GEO.editorOL.ativaLayerSwitcher()}if(i3GEO.editorOL.ativarodadomouse===false){i3GEO.editorOL.desativaRodaDoMouse()}if(i3GEO.editorOL.numzoom!==""){i3GEO.editorOL.mapa.setOptions({numZoomLevels:i3GEO.editorOL.numzoom})}if(i3GEO.editorOL.maxext!==""){i3GEO.editorOL.mapa.setOptions({maxExtent:i3GEO.editorOL.maxext})}if(i3GEO.editorOL.mapext!=""){i3GEO.editorOL.mapa.zoomToExtent(i3GEO.editorOL.mapext)}else{i3GEO.editorOL.mapa.zoomToMaxExtent()}if(i3GEO.Interface){i3GEO.Interface.openlayers.sobeLayersGraficos()}},criaLayerGrafico:function(){i3GEO.desenho.openlayers.criaLayerGrafico()},layersLigados:function(){var layers=i3GEO.editorOL.mapa.layers,nlayers=layers.length,ins=[],i;for(i=0;i<nlayers;i++){if(layers[i].visibility===true){ins.push(layers[i])}}return ins},layersClonados:function(paramsLayers){var layers=i3GEO.editorOL.mapa.layers,nlayers=layers.length,i;for(i=0;i<nlayers;i++){if(layers[i].params&&layers[i].params.CLONETMS===paramsLayers){return(layers[i])}}return false},layertms2wms:function(tms){var layer,url;url=tms.url.replace("&cache=sim","&DESLIGACACHE=sim");url=url.replace("&Z=${z}&X=${x}&Y=${y}","");layer=new OpenLayers.Layer.WMS(tms.layername+"_clone",url,{layers:tms.name,transparent:true},{gutter:0,isBaseLayer:false,displayInLayerSwitcher:false,opacity:1,visibility:true,singleTile:true});return layer},removeClone:function(){var nome=i3GEO.editorOL.layerAtivo().layername+"_clone",busca=i3GEO.editorOL.mapa.getLayersByName(nome);if(busca.length>0){i3GEO.editorOL.mapa.removeLayer(i3GEO.editorOL.mapa.getLayersByName(camada.name)[0],false)}},coordenadas:function(){var idcoord=i3GEO.editorOL.mapa.getControlsBy("separator"," ");if(idcoord[0]){i3GEO.editorOL.mapa.events.register("mousemove",i3GEO.editorOL.mapa,function(e){var p,lonlat,d;if(navm){p=new OpenLayers.Pixel(e.x,e.y)}else{p=e.xy}lonlat=i3GEO.editorOL.mapa.getLonLatFromPixel(p);d=i3GEO.calculo.dd2dms(lonlat.lon,lonlat.lat);try{$i(idcoord[0].id).innerHTML="Long: "+d[0]+"<br>Lat: "+d[1]}catch(e){}})}},criaJanelaBusca:function(){var layers=i3GEO.editorOL.layersLigados(),nlayers=layers.length,i,ins,combo="<select id=i3GEOOLlistaTemasBusca ><option value=''>----</option>";for(i=0;i<nlayers;i++){combo+="<option value='"+i+"' >"+layers[i].name+"</option>"}combo+="</select>";ins="<div class=paragrafo >Tema:<br>"+combo;ins+="<br>Item:<br><span id=i3GEOOLcomboitens ></span>";ins+="<br>Procurar por:<br><input type=text size=20 id=i3GEOOLpalavraBusca >";ins+="<br><br><input type=button value='Procurar' id='i3GEOOLbotaoBusca' ></div>";ins+="<br>Resultado:<br><span id=i3GEOOLcomboresultado ></span>";try{YAHOO.namespace("procura.container");YAHOO.procura.container.panel=new YAHOO.widget.Panel("panelprocura",{zIndex:2000,iframe:false,width:"250px",visible:false,draggable:true,close:true});YAHOO.procura.container.panel.setHeader("Encontre no mapa");YAHOO.procura.container.panel.setBody(ins);YAHOO.procura.container.panel.setFooter("");YAHOO.procura.container.panel.render(document.body);YAHOO.procura.container.panel.center();document.getElementById("i3GEOOLbotaoBusca").onclick=function(){var layer=i3GEO.editorOL.layerAtivo(),item=document.getElementById("i3GEOOLbuscaItem").value,palavra=document.getElementById("i3GEOOLpalavraBusca").value;if(item===""||palavra===""){alert("Escolha o item e o texto de busca");return}i3GEO.editorOL.busca(layer,item,palavra,"i3GEOOLcomboresultado")};document.getElementById("i3GEOOLlistaTemasBusca").onchange=function(){i3GEO.editorOL.ativaTema(this.value);document.getElementById("i3GEOOLcomboitens").innerHTML="...";i3GEO.editorOL.listaItens(i3GEO.editorOL.layerAtivo(),"i3GEOOLcomboitens","i3GEOOLbuscaItem")}}catch(e){}},criaComboTemas:function(){var layers=i3GEO.editorOL.layersLigados(),nlayers=layers.length,i,nometema="",temp,combo="<select id=i3GEOOLlistaTemasAtivos style=width:235px; >";for(i=0;i<nlayers;i++){nometema="";if(i3GEO.arvoreDeCamadas&&i3GEO.arvoreDeCamadas.CAMADAS){temp=i3GEO.arvoreDeCamadas.pegaTema(layers[i].name,"","name");if(temp!=""){nometema=temp.tema+" - "}}combo+="<option value='"+i+"' >"+nometema+layers[i].name+"</option>"}combo+="</select>";return combo},atualizaJanelaAtivaTema:function(){var combo=i3GEO.editorOL.criaComboTemas();YAHOO.temaativo.container.panel.setBody(combo);document.getElementById("i3GEOOLlistaTemasAtivos").onchange=function(){if(botaoIdentifica){botaoIdentifica.layers=[i3GEO.editorOL.layersLigados()[this.value]]}}},criaJanelaAtivaTema:function(){var temp;if(!document.getElementById("paneltemaativo")){YAHOO.namespace("temaativo.container");YAHOO.temaativo.container.panel=new YAHOO.widget.Panel("paneltemaativo",{zIndex:20000,iframe:true,width:"250px",visible:false,draggable:true,close:true});YAHOO.temaativo.container.panel.setBody("");if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){YAHOO.temaativo.container.panel.setHeader("Tema ativo<div id='paneltemaativo_minimizaCabecalho' class='container-minimiza'></div>")}else{YAHOO.temaativo.container.panel.setHeader("Tema ativo")}YAHOO.temaativo.container.panel.setFooter("");YAHOO.temaativo.container.panel.render(document.body);YAHOO.temaativo.container.panel.show();YAHOO.temaativo.container.panel.center();i3GEO.editorOL.atualizaJanelaAtivaTema();YAHOO.util.Event.addListener(YAHOO.temaativo.container.panel.close,"click",function(){i3GEOpanelEditor.deactivate();i3GEOpanelEditor.activate();if(i3GEO.eventos&&i3GEO.eventos.ATUALIZAARVORECAMADAS.toString().search("i3GEO.editorOL.atualizaJanelaAtivaTema()")>0){i3GEO.eventos.ATUALIZAARVORECAMADAS.remove("i3GEO.editorOL.atualizaJanelaAtivaTema()")}});if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){if(i3GEO.eventos&&i3GEO.eventos.ATUALIZAARVORECAMADAS.toString().search("i3GEO.editorOL.atualizaJanelaAtivaTema()")<0){i3GEO.eventos.ATUALIZAARVORECAMADAS.push("i3GEO.editorOL.atualizaJanelaAtivaTema()")}}temp=$i("paneltemaativo_minimizaCabecalho");if(temp){temp.onclick=function(){i3GEO.janela.minimiza("paneltemaativo")}}}else{YAHOO.temaativo.container.panel.show();i3GEO.editorOL.atualizaJanelaAtivaTema()}},ativaTema:function(id){document.getElementById("i3GEOOLlistaTemasAtivos").value=id},layerAtivo:function(){var id=document.getElementById("i3GEOOLlistaTemasAtivos");if(id){id=id.value}else{id=i3GEO.temaAtivo}if(id==""){return[]}else{return i3GEO.editorOL.layersLigados()[id]}},listaItens:function(layer,idonde,idobj){if(!layer){return}if(!layer.params){return}var u=layer.url+"&request=describefeaturetype&service=wfs&version=1.0.0";u+="&typename="+layer.params.LAYERS;document.body.style.cursor="wait";document.getElementById("i3geoMapa").style.cursor="wait";OpenLayers.Request.issue({method:"GET",url:u,callback:function(retorno){document.body.style.cursor="default";document.getElementById("i3geoMapa").style.cursor="default";var fromgml=new OpenLayers.Format.WFSDescribeFeatureType({geometryName:"msGeometry"}),gml=fromgml.read(retorno.responseText),prop=gml.featureTypes[0].properties,nprop=prop.length,i,combo="<select id="+idobj+" ><option value=''>----</option>";for(i=0;i<nprop;i++){combo+="<option value="+prop[i].name+" >"+prop[i].name+"</option>"}combo+="</select>";document.getElementById(idonde).innerHTML=combo},failure:function(){document.body.style.cursor="default";document.getElementById("i3geoMapa").style.cursor="default";alert("Erro")}})},busca:function(layer,item,palavra,onde){document.body.style.cursor="wait";document.getElementById("i3geoMapa").style.cursor="wait";var u=layer.url+"&request=getfeature&service=wfs&version=1.0.0";u+="&OUTPUTFORMAT=gml2&typename="+layer.params.LAYERS;u+="&filter=<Filter><PropertyIsLike wildcard=* singleChar=. escape=! ><PropertyName>"+item+"</PropertyName><Literal>*"+palavra+"*</Literal></PropertyIsLike></Filter>";document.body.style.cursor="wait";document.getElementById("i3geoMapa").style.cursor="wait";document.getElementById(onde).innerHTML="...";OpenLayers.Request.issue({method:"GET",url:u,callback:function(retorno){document.body.style.cursor="default";document.getElementById("i3geoMapa").style.cursor="default";var fromgml=new OpenLayers.Format.GML({geometryName:"msGeometry"}),gml=fromgml.read(retorno.responseText),ngml=gml.length,i,ins="<select onchange='i3GEO.editorOL.zoomPara(this.value)'>";ins+="<option value=''>---</option>";for(i=0;i<ngml;i++){eval("var valor = gml[i].data."+item);var bounds=gml[i].geometry.getBounds();bounds=bounds.toBBOX();ins+="<option value='"+bounds+"'>"+valor+"</option>"}ins+="</select>";document.getElementById(onde).innerHTML=ins},failure:function(){document.body.style.cursor="default";document.getElementById("i3geoMapa").style.cursor="default";alert("Erro")}})},zoomPara:function(bbox){var b=new OpenLayers.Bounds.fromString(bbox);i3GEO.editorOL.mapa.zoomToExtent(b)},mostraLegenda:function(){var layers=i3GEO.editorOL.layersLigados(),nlayers=layers.length,ins="",i;for(i=0;i<nlayers;i++){try{if(layers[i].isBaseLayer===false){var url=layers[i].getFullRequestString({"request":"getlegendgraphic"});if(i3GEO.editorOL.legendahtml===true){url=url.replace("image%2Fpng","text/html");ins+=layers[i].name+"<br><div id=legendaL_"+i+" ></div><br>";eval("var f = function(retorno){document.getElementById('legendaL_"+i+"').innerHTML = retorno.responseText;};");var config={method:"GET",url:url,callback:f};OpenLayers.Request.issue(config)}else{url=url.replace("LAYERS","LAYER");ins+=layers[i].name+"<br><img src='"+url+"' /><br>"}}}catch(e){}}if(!document.getElementById("panellegendaeditorOL")){YAHOO.namespace("legendaeditorOL.container");YAHOO.legendaeditorOL.container.panel=new YAHOO.widget.Panel("panellegendaeditorOL",{zIndex:20000,iframe:true,width:"auto",visible:false,draggable:true,close:true});YAHOO.legendaeditorOL.container.panel.setBody(ins);YAHOO.legendaeditorOL.container.panel.setHeader("Legenda");YAHOO.legendaeditorOL.container.panel.setFooter("");YAHOO.legendaeditorOL.container.panel.render(document.body);YAHOO.legendaeditorOL.container.panel.show();YAHOO.legendaeditorOL.container.panel.center();YAHOO.util.Event.addListener(YAHOO.legendaeditorOL.container.panel.close,"click",function(){})}else{YAHOO.legendaeditorOL.container.panel.setBody(ins);YAHOO.legendaeditorOL.container.panel.show()}},captura:function(lonlat){var layers=[i3GEO.editorOL.layerAtivo()],xy=lonlat.split(","),u=layers[0].url+"&REQUEST=getfeature&service=wfs&version=1.0.0";u+="&OUTPUTFORMAT=gml2&typename="+layers[0].params.LAYERS;u=u.replace("&cache=sim","&DESLIGACACHE=sim");u=u.replace("&Z=${z}&X=${x}&Y=${y}","");xy[0]=xy[0]*1;xy[1]=xy[1]*1;var poligono=(xy[0]-0.1)+","+(xy[1]+0.1)+" "+(xy[0]+0.1)+","+(xy[1]+0.1)+" "+(xy[0]+0.1)+","+(xy[1]-0.1)+" "+(xy[0]-0.1)+","+(xy[1]-0.1)+" "+(xy[0]-0.1)+","+(xy[1]+0.1);u+="&filter=<Filter><Intersects><PropertyName>Geometry</PropertyName><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:posList>"+poligono+"</gml:posList></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></Intersects></Filter>";document.body.style.cursor="wait";if(document.getElementById("i3geoMapa")){document.getElementById("i3geoMapa").style.cursor="wait"}OpenLayers.Request.issue({method:"GET",url:u,callback:function(retorno){document.body.style.cursor="default";if(document.getElementById("i3geoMapa")){document.getElementById("i3geoMapa").style.cursor="default"}var i,n,f,fromgml=new OpenLayers.Format.GML({geometryName:"msGeometry"}),gml=fromgml.read(retorno.responseText);n=gml.length;for(i=0;i<n;i++){f=gml[i];f["attributes"]={opacidade:i3GEO.editorOL.simbologia.opacidade,texto:i3GEO.editorOL.simbologia.texto,fillColor:i3GEO.editorOL.simbologia.fillColor,strokeWidth:i3GEO.editorOL.simbologia.strokeWidth,strokeColor:i3GEO.editorOL.simbologia.strokeColor,pointRadius:i3GEO.editorOL.simbologia.pointRadius,graphicName:i3GEO.editorOL.simbologia.graphicName,registros:f["attributes"]}}i3GEO.desenho.layergrafico.addFeatures(gml)},failure:function(){document.body.style.cursor="default";if(document.getElementById("i3geoMapa")){document.getElementById("i3geoMapa").style.cursor="default"}alert("Erro")}})},salvaGeometrias:function(){var geos=i3GEO.desenho.layergrafico.selectedFeatures,n=geos.length,ins="";if(n>0){if($i("panelsalvageometrias")){YAHOO.salvaGeometrias.container.panel=YAHOO.i3GEO.janela.manager.find("panelsalvageometrias");YAHOO.salvaGeometrias.container.panel.show();YAHOO.salvaGeometrias.container.panel.bringToTop()}else{try{YAHOO.namespace("salvaGeometrias.container");YAHOO.salvaGeometrias.container.panel=new YAHOO.widget.Panel("panelsalvageometrias",{zIndex:2000,iframe:false,width:"250px",visible:false,draggable:true,close:true});YAHOO.salvaGeometrias.container.panel.setHeader("Geometrias");YAHOO.salvaGeometrias.container.panel.setBody("");YAHOO.salvaGeometrias.container.panel.setFooter("");YAHOO.salvaGeometrias.container.panel.render(document.body);YAHOO.salvaGeometrias.container.panel.center();if(YAHOO.i3GEO.janela){YAHOO.i3GEO.janela.manager.register(YAHOO.salvaGeometrias.container.panel)}YAHOO.salvaGeometrias.container.panel.show()}catch(e){}}ins+="<p class=paragrafo >Foram encontrada(s) "+n+" geometria(s) selecionada(s) </p>";ins+="<p class=paragrafo ><a href='#' onclick='i3GEO.editorOL.listaGeometriasSel()' >Listar</a> ";ins+="<a href='#' onclick='"+i3GEO.editorOL.nomeFuncaoSalvar+"' >Salvar</a> ";ins+="<a href='#' onclick='i3GEO.editorOL.exportarSHP()' >Exportar (shapefile)</a></p>";YAHOO.salvaGeometrias.container.panel.setBody(ins)}else{alert("Selecione pelo menos um elemento")}},exportarSHP:function(){i3GEO.editorOL.processageo("converteSHP")},listaGeometriasSel:function(){var geos=i3GEO.desenho.layergrafico.selectedFeatures,n=geos.length,ins="",i,a,w,g;for(i=0;i<n;i++){g=geos[i];ins+="<b>Geometria: "+i+"</b><br>"+i3GEO.editorOL.google2wgs(g.geometry)+"<br><br>";ins+="<b>Atributos: "+i+"</b><br>";a=g.attributes;for(key in a){if(a[key]){ins+=key+" = "+a[key]+"<br>"}}if(g.attributes.registros){ins+="<b>Registros: "+i+"</b><br>";a=g.attributes.registros;for(key in a){if(a[key]){ins+=key+" = "+a[key]+"<br>"}}}}w=window.open();w.document.write(ins);w.document.close()},testeSalvar:function(){alert("Funcao nao disponivel. Defina o nome da funcao em i3GEO.editorOL.nomeFuncaoSalvar ")},salvaGeo:function(){var geos=i3GEO.desenho.layergrafico.selectedFeatures,n=geos.length,funcaoOK=function(){if(geos[0].geometry){var registros="",valorunico="",nometema=$i("editorOLcomboTemaEditavel").value,key="",tema,redesenha,p,g=i3GEO.editorOL.google2wgs(geos[0].geometry);if(nometema==""){return}tema=i3GEO.arvoreDeCamadas.pegaTema(nometema,"","name");if(geos[0].attributes.registros){registros=geos[0].attributes.registros;for(key in registros){if(registros[key]&&key==tema.colunaidunico){valorunico=registros[key]}}}redesenha=function(retorno){i3GEO.janela.fechaAguarde("aguardeSalvaPonto");i3GEO.desenho.layergrafico.removeFeatures(i3GEO.desenho.layergrafico.selectedFeatures);i3GEO.Interface.atualizaTema("",nometema)};i3GEO.janela.AGUARDEMODAL=true;i3GEO.janela.abreAguarde("aguardeSalvaPonto","Adicionando...");i3GEO.janela.AGUARDEMODAL=false;if(valorunico==""){p=i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=adicionaGeometria&g_sid="+i3GEO.configura.sid;cpJSON.call(p,"foo",redesenha,"&tema="+nometema+"&wkt="+g)}else{p=i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=atualizaGeometria&g_sid="+i3GEO.configura.sid;cpJSON.call(p,"foo",redesenha,"&idunico="+valorunico+"&tema="+nometema+"&wkt="+g)}}},funcaoCombo=function(obj){$i("editorOLondeComboTemaEditavel").innerHTML=obj.dados},texto="Salvar no tema:<br><div id=editorOLondeComboTemaEditavel ></div><br><br>";if(n!=1){i3GEO.janela.tempoMsg("Selecione apenas uma figura")}else{i3GEO.janela.confirma(texto,300,"Salva","Cancela",funcaoOK);i3GEO.util.comboTemas("editorOLcomboTemaEditavel",funcaoCombo,"editorOLondeComboTemaEditavel","",false,"editavel")}},criaBotoes:function(botoes){var sketchSymbolizers={"Point":{pointRadius:4,graphicName:"square",fillColor:"white",fillOpacity:1,strokeWidth:1,strokeOpacity:1,strokeColor:"#333333"},"Line":{strokeWidth:3,strokeOpacity:1,strokeColor:"#666666",strokeDashstyle:"dash"},"Polygon":{strokeWidth:2,strokeOpacity:1,strokeColor:"#666666",fillColor:"white",fillOpacity:0.3}},style=new OpenLayers.Style(),styleMap=new OpenLayers.StyleMap({"default":style,"vertex":{strokeOpacity:1,strokeWidth:1,fillColor:"white",fillOpacity:0.45,pointRadius:3}},{extendDefault:false}),adiciona=false,button,controles=[];style.addRules([new OpenLayers.Rule({symbolizer:sketchSymbolizers})]);i3GEOpanelEditor=new OpenLayers.Control.Panel({displayClass:"olControlEditingToolbar1 noprint",saveState:false,activateControl:function(c){this.deactivate();this.activate();try{i3GEO.editorOL.ModifyFeature.deactivate();if(i3GEO&&i3GEO.barraDeBotoes){i3GEO.barraDeBotoes.ativaPadrao()}}catch(e){}if(!c.trigger){c.activate()}else{c.trigger.call()}}});if(botoes.procura===true){button=new OpenLayers.Control.Button({displayClass:"editorOLprocura",trigger:function(){YAHOO.procura.container.panel.show()},title:"procura",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.pan===true){controles.push(new OpenLayers.Control.Navigation({title:"deslocar",displayClass:"editorOLpan",type:OpenLayers.Control.TYPE_TOOL}));adiciona=true}if(botoes.zoombox===true){controles.push(new OpenLayers.Control.ZoomBox({title:"zoombox",displayClass:"editorOLzoombox",type:OpenLayers.Control.TYPE_TOOL}));adiciona=true}if(botoes.zoomtot===true){button=new OpenLayers.Control.Button({displayClass:"editorOLzoomtot",trigger:function(){if(i3GEO.editorOL.mapext&&i3GEO.editorOL.mapext!=""){i3GEO.editorOL.mapa.zoomToExtent(i3GEO.editorOL.mapext)}else{i3GEO.editorOL.mapa.zoomToMaxExtent()}},title:"ajusta extensao",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.zoomin===true){button=new OpenLayers.Control.Button({displayClass:"editorOLzoomin",trigger:function(){i3GEO.editorOL.mapa.zoomIn()},title:"aproxima",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.zoomout===true){button=new OpenLayers.Control.Button({displayClass:"editorOLzoomout",trigger:function(){i3GEO.editorOL.mapa.zoomOut()},title:"afasta",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.legenda===true){button=new OpenLayers.Control.Button({displayClass:"editorOLlegenda",trigger:function(){i3GEO.editorOL.mostraLegenda()},title:"legenda",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.distancia===true){button=new OpenLayers.Control.Measure(OpenLayers.Handler.Path,{handlerOptions:{layerOptions:{styleMap:styleMap}},persist:true,displayClass:"editorOLdistancia",title:"distancia",type:OpenLayers.Control.TYPE_TOOL});button.events.on({"measure":function(event){var units=event.units,measure=event.measure;alert("Distância: "+measure.toFixed(3)+" "+units)}});controles.push(button);adiciona=true}if(botoes.area===true){button=new OpenLayers.Control.Measure(OpenLayers.Handler.Polygon,{handlerOptions:{layerOptions:{styleMap:styleMap}},persist:true,displayClass:"editorOLarea",title:"area",type:OpenLayers.Control.TYPE_TOOL});button.events.on({"measure":function(event){var units=event.units;var measure=event.measure;alert("Área: "+measure.toFixed(3)+" "+units+" quadrados")}});controles.push(button);adiciona=true}if(botoes.identifica===true){botaoIdentifica=new OpenLayers.Control.WMSGetFeatureInfo({maxFeatures:1,infoFormat:'text/plain',layers:[i3GEO.editorOL.layerAtivo()],queryVisible:true,title:"identifica",type:OpenLayers.Control.TYPE_TOOL,displayClass:"editorOLidentifica",eventListeners:{getfeatureinfo:function(event){var lonlat=i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy),lonlattexto="<hr>",formata;if(botoes.linha===true||botoes.ponto===true||botoes.poligono===true||botoes.edita===true){lonlattexto+="<pre><span style=font-size:12px;color:blue;cursor:pointer onclick='i3GEO.editorOL.captura(\""+lonlat.lon+","+lonlat.lat+"\")'>edita geometria</span></pre><br>"}formata=function(texto){var temp,temp1,n,i,f=[],textoN=texto.split(":");try{if(textoN.length>1){temp=textoN[2].replace(/\n\r/g,"");temp=temp.replace(/'/g,"");temp=temp.replace(/\n/g,"|");temp=temp.replace(/_/g," ");temp=temp.replace(/=/g,":");temp=temp.split("|");n=temp.length;for(i=0;i<n;i++){temp1=temp[i].replace(/^\s+/,"");temp1=temp1.replace(/\s+$/,"");if(temp1!="")f.push(temp1)}texto=f.join("<br><br>")}}catch(e){}return texto};i3GEO.editorOL.mapa.addPopup(new OpenLayers.Popup.FramedCloud("chicken",i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy),null,"<div style=text-align:left >"+lonlattexto+"<pre>"+formata(event.text)+"</pre></div>",null,true));i3GEO.editorOL.removeClone()},beforegetfeatureinfo:function(event){var ativo=[i3GEO.editorOL.layerAtivo()];if(ativo[0].CLASS_NAME=="OpenLayers.Layer.TMS"||ativo[0].CLASS_NAME=="OpenLayers.Layer.OSM"){ativo=[i3GEO.editorOL.layertms2wms(ativo[0])]}ativo[0].projection=new OpenLayers.Projection("EPSG:4326");event.object.layers=ativo;botaoIdentifica.layers=ativo;botaoIdentifica.url=ativo[0].url},activate:function(){i3GEO.editorOL.criaJanelaAtivaTema()}}});controles.push(botaoIdentifica);adiciona=true}if(botoes.linha===true){button=new OpenLayers.Control.DrawFeature(i3GEO.desenho.layergrafico,OpenLayers.Handler.Path,{displayClass:"editorOLlinha",title:"digitalizar linha",type:OpenLayers.Control.TYPE_TOOL,callbacks:{done:function(feature){var f=new OpenLayers.Feature.Vector(feature);f["attributes"]={opacidade:i3GEO.editorOL.simbologia.opacidade,texto:i3GEO.editorOL.simbologia.texto,fillColor:i3GEO.editorOL.simbologia.fillColor,strokeWidth:i3GEO.editorOL.simbologia.strokeWidth,strokeColor:i3GEO.editorOL.simbologia.strokeColor,pointRadius:i3GEO.editorOL.simbologia.pointRadius,graphicName:i3GEO.editorOL.simbologia.graphicName};i3GEO.desenho.layergrafico.addFeatures([f]);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}if(i3GEO.Interface){i3GEO.Interface.openlayers.sobeLayersGraficos()}}}});controles.push(button);adiciona=true}if(botoes.ponto===true){button=new OpenLayers.Control.DrawFeature(i3GEO.desenho.layergrafico,OpenLayers.Handler.Point,{displayClass:"editorOLponto",title:"digitalizar ponto",type:OpenLayers.Control.TYPE_TOOL,callbacks:{done:function(feature){var f,style_mark;if(i3GEO.editorOL.simbologia.externalGraphic!=""){style_mark=OpenLayers.Util.extend({},OpenLayers.Feature.Vector.style['default']);style_mark.externalGraphic=i3GEO.editorOL.simbologia.externalGraphic;style_mark.graphicWidth=i3GEO.editorOL.simbologia.graphicWidth;style_mark.graphicHeight=i3GEO.editorOL.simbologia.graphicHeight;style_mark.fillOpacity=i3GEO.editorOL.simbologia.opacidade;f=new OpenLayers.Feature.Vector(feature,null,style_mark)}else{f=new OpenLayers.Feature.Vector(feature)}f["attributes"]={opacidade:i3GEO.editorOL.simbologia.opacidade,texto:i3GEO.editorOL.simbologia.texto,fillColor:i3GEO.editorOL.simbologia.fillColor,strokeWidth:i3GEO.editorOL.simbologia.strokeWidth,strokeColor:i3GEO.editorOL.simbologia.strokeColor,pointRadius:i3GEO.editorOL.simbologia.pointRadius,graphicName:i3GEO.editorOL.simbologia.graphicName,externalGraphic:i3GEO.editorOL.simbologia.externalGraphic,graphicHeight:i3GEO.editorOL.simbologia.graphicHeight,graphicWidth:i3GEO.editorOL.simbologia.graphicWidth};i3GEO.desenho.layergrafico.addFeatures([f]);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}if(i3GEO.Interface){i3GEO.Interface.openlayers.sobeLayersGraficos()}}}});controles.push(button);adiciona=true}if(botoes.poligono===true){button=new OpenLayers.Control.DrawFeature(i3GEO.desenho.layergrafico,OpenLayers.Handler.Polygon,{displayClass:"editorOLpoligono",title:"digitalizar poligono",type:OpenLayers.Control.TYPE_TOOL,callbacks:{done:function(feature){var f=new OpenLayers.Feature.Vector(feature);f["attributes"]={opacidade:i3GEO.editorOL.simbologia.opacidade,texto:i3GEO.editorOL.simbologia.texto,fillColor:i3GEO.editorOL.simbologia.fillColor,strokeWidth:i3GEO.editorOL.simbologia.strokeWidth,strokeColor:i3GEO.editorOL.simbologia.strokeColor,pointRadius:i3GEO.editorOL.simbologia.pointRadius,graphicName:i3GEO.editorOL.simbologia.graphicName};i3GEO.desenho.layergrafico.addFeatures([f]);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}if(i3GEO.Interface){i3GEO.Interface.openlayers.sobeLayersGraficos()}}}});controles.push(button);adiciona=true}if(botoes.texto===true){button=new OpenLayers.Control.DrawFeature(i3GEO.desenho.layergrafico,OpenLayers.Handler.Point,{displayClass:"editorOLtexto",title:"incluir texto",type:OpenLayers.Control.TYPE_TOOL,persist:true,callbacks:{done:function(feature){var texto=window.prompt("Texto",""),label=new OpenLayers.Feature.Vector(feature);label["attributes"]={opacidade:0.1,fillColor:"white",strokeWidth:i3GEO.editorOL.simbologia.strokeWidth,texto:texto,pointRadius:2,graphicName:"square",strokeColor:"black",fontColor:i3GEO.editorOL.simbologia.fontColor,fontSize:i3GEO.editorOL.simbologia.fontSize,fontFamily:"Arial",fontWeight:"bold",labelAlign:"rt"};if(texto&&texto!==""){i3GEO.desenho.layergrafico.addFeatures([label])}if(i3GEO.Interface){i3GEO.Interface.openlayers.sobeLayersGraficos()}}}});controles.push(button);adiciona=true}if(botoes.edita===true&&botoes.corta===true&&i3GEO.php){i3GEO.editorOL.CortaFeature=new OpenLayers.Control.DrawFeature(i3GEO.desenho.layergrafico,OpenLayers.Handler.Polygon,{displayClass:"editorOLcorta",title:"corta figura",type:OpenLayers.Control.TYPE_TOOL,clickout:true,toggle:true,trigger:function(){if(i3GEO.desenho.layergrafico.selectedFeatures.length!=1){alert("Selecione primeiro um elemento para ser cortado");i3GEO.editorOL.CortaFeature.deactivate()}else{i3GEO.editorOL.CortaFeature.activate()}},callbacks:{done:function(feature){var temp,sel=i3GEO.desenho.layergrafico.selectedFeatures[0].geometry,corta=feature;temp=function(retorno){i3GEO.janela.fechaAguarde("i3GEO.cortador");if(retorno!=""&&retorno.data&&retorno.data!=""){i3GEO.editorOL.substituiFeaturesSel(retorno.data)}};i3GEO.janela.abreAguarde("i3GEO.cortador","Cortando");i3GEO.php.funcoesGeometriasWkt(temp,sel+"|"+corta,"difference")}}});controles.push(i3GEO.editorOL.CortaFeature);adiciona=true}if(botoes.edita===true){i3GEO.editorOL.ModifyFeature=new OpenLayers.Control.ModifyFeature(i3GEO.desenho.layergrafico,{displayClass:"editorOLedita",title:"modifica figura",type:OpenLayers.Control.TYPE_TOOL,clickout:true,toggle:true,mode:OpenLayers.Control.ModifyFeature.RESHAPE,standalone:false,createVertices:true,styleMap:"default",vertexRenderIntent:"vertex"});controles.push(i3GEO.editorOL.ModifyFeature);adiciona=true}if(botoes.edita===true&&botoes.listag===true){button=new OpenLayers.Control.Button({displayClass:"editorOLlistag",trigger:function(){i3GEO.editorOL.listaGeometrias()},title:"lista geometrias",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.frente===true){button=new OpenLayers.Control.Button({displayClass:"editorOLfrente",trigger:function(){i3GEO.editorOL.trazParaFrente();if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}},title:"traz para frente",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.tools===true&&i3GEO.php){button=new OpenLayers.Control.Button({displayClass:"editorOLtools",trigger:function(){if(i3GEO.php){i3GEO.editorOL.ferramentas()}else{i3GEO.editorOL.carregajts("i3GEO.editorOL.ferramentas()")}},title:"ferramentas",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.selecao===true){i3GEO.editorOL.selbutton=new OpenLayers.Control.SelectFeature(i3GEO.desenho.layergrafico,{displayClass:"editorOLselecao",title:"seleciona elemento",type:OpenLayers.Control.TYPE_TOOL,clickout:true,toggle:true,multiple:false,hover:false,toggleKey:"ctrlKey",multipleKey:"shiftKey",box:false});controles.push(i3GEO.editorOL.selbutton);adiciona=true}if(botoes.apaga===true){button=new OpenLayers.Control.Button({displayClass:"editorOLapaga",trigger:function(){if(i3GEO.desenho.layergrafico.selectedFeatures.length>0){var x=window.confirm("Exclui os elementos selecionados?");if(x){i3GEO.editorOL.guardaBackup();i3GEO.desenho.layergrafico.removeFeatures(i3GEO.desenho.layergrafico.selectedFeatures);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}}}else{alert("Selecione pelo menos um elemento")}},title:"apaga selecionados",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.propriedades===true){button=new OpenLayers.Control.Button({displayClass:"editorOLpropriedades",trigger:function(){i3GEO.editorOL.propriedades()},title:"propriedades",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.salva===true){button=new OpenLayers.Control.Button({displayClass:"editorOLsalva",trigger:function(){i3GEO.editorOL.salvaGeometrias()},title:"salva",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.ajuda===true){button=new OpenLayers.Control.Button({displayClass:"editorOLajuda",trigger:function(){try{window.open(i3GEO.configura.locaplic+"/mashups/openlayers_ajuda.php")}catch(e){window.open("openlayers_ajuda.php")}},title:"ajuda",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.fecha===true){button=new OpenLayers.Control.Button({displayClass:"editorOLfecha",trigger:function(){var temp=window.confirm("Remove a edicao?");if(i3GEO.eventos){i3GEO.eventos.cliquePerm.ativa()}i3GEOpanelEditor.destroy();try{YAHOO.temaativo.container.panel.destroy()}catch(e){}try{YAHOO.procura.container.panel.destroy()}catch(e){}try{YAHOO.editorOL.container.panel.destroy()}catch(e){}try{YAHOO.editorOL.listaGeometrias.panel.destroy()}catch(e){}try{YAHOO.editorOL.ferramentas.panel.destroy()}catch(e){}try{YAHOO.legendaeditorOL.container.panel.destroy()}catch(e){}try{YAHOO.salvaGeometrias.container.panel.destroy()}catch(e){}if(temp===true){try{if(i3GEO.desenho.layergrafico){i3GEO.editorOL.mapa.removeLayer(i3GEO.desenho.layergrafico);delete(i3GEO.desenho.layergrafico)}if(i3GEO.editorOL.backup){i3GEO.editorOL.mapa.removeLayer(i3GEO.editorOL.backup);delete(i3GEO.editorOL.backup)}}catch(e){}}},title:"fecha editor",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}i3GEOOLsnap=new OpenLayers.Control.Snapping({layer:i3GEO.desenho.layergrafico});i3GEOOLsplit=new OpenLayers.Control.Split({layer:i3GEO.desenho.layergrafico,source:i3GEO.desenho.layergrafico,tolerance:0.0001,eventListeners:{beforesplit:function(event){i3GEO.editorOL.guardaBackup()},aftersplit:function(event){i3GEO.editorOL.flashFeatures(event.features);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}}}});if(adiciona===true){i3GEOpanelEditor.addControls(controles);i3GEO.editorOL.mapa.addControl(i3GEOpanelEditor)}},mudaSimbolo:function(estilo,id){var valor=$i(id).value,geos=i3GEO.desenho.layergrafico.selectedFeatures,n=geos.length,i;i3GEO.editorOL.simbologia[estilo]=valor;for(i=0;i<n;i++){geos[i].attributes[estilo]=valor;geos[i].style[estilo]=valor}},adicionaMarcas:function(){if(i3GEO.editorOL.pontos.length===0){return}var SHADOW_Z_INDEX=10,MARKER_Z_INDEX=11,layer=new OpenLayers.Layer.Vector("pontos",{styleMap:new OpenLayers.StyleMap({externalGraphic:i3GEO.editorOL.marca,backgroundGraphic:"../pacotes/openlayers/img/marker_shadow.png",backgroundXOffset:0,backgroundYOffset:-7,graphicZIndex:MARKER_Z_INDEX,backgroundGraphicZIndex:SHADOW_Z_INDEX,pointRadius:10}),isBaseLayer:false,rendererOptions:{yOrdering:true},displayInLayerSwitcher:true,visibility:true}),index,x=[],y=[],features=[];for(index=0;index<i3GEO.editorOL.pontos.length;index=index+2){x.push(i3GEO.editorOL.pontos[index]);y.push(i3GEO.editorOL.pontos[index+1])}for(index=0;index<x.length;index++){features.push(new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(x[index],y[index])))}layer.addFeatures(features);i3GEO.editorOL.mapa.addLayer(layer)},adicionaKml:function(){var temp,n,i,id,url;n=i3GEO.editorOL.kml.length;for(i=0;i<n;i++){id="kml"+i;url=i3GEO.editorOL.kml[i];eval(id+" = new OpenLayers.Layer.Vector('"+id+"', {displayOutsideMaxExtent:true,displayInLayerSwitcher:false,visibility:true, strategies: [new OpenLayers.Strategy.Fixed()],protocol: new OpenLayers.Protocol.HTTP({url: '"+url+"',format: new OpenLayers.Format.KML({extractStyles: true,extractAttributes: true,maxDepth: 5})})})");eval("i3GEO.editorOL.mapa.addLayer("+id+");");eval("temp = "+id+".div;");temp.onclick=function(e){var targ="",id,temp,features,n,i,g,html="";if(!e){e=window.event}if(e.target){targ=e.target}else{if(e.srcElement){targ=e.srcElement}}if(targ.id){temp=targ.id.split("_");if(temp[0]==="OpenLayers.Geometry.Point"){id=targ.id;temp=i3GEO.editorOL.mapa.getLayer(this.id);features=temp.features;n=features.length;for(i=0;i<n;i++){if(features[i].geometry.id===id){for(var j in features[i].attributes){html+=j+": "+features[i].attributes[j]}g=features[i].geometry;i3GEO.editorOL.mapa.addPopup(new OpenLayers.Popup.FramedCloud("kml",new OpenLayers.LonLat(g.x,g.y),null,html,null,true))}}}}}}},propriedades:function(){if(!document.getElementById("panelpropriedadesEditor")){YAHOO.namespace("editorOL.container");YAHOO.editorOL.container.panel=new YAHOO.widget.Panel("panelpropriedadesEditor",{zIndex:20000,iframe:true,width:"350px",height:"250px",visible:false,draggable:true,close:true});var ins=""+'<p class=paragrafo ><b>Estilos (utilize a cor no formato r,g,b):</b></p>'+'<table class=lista7 >'+' <tr>'+' <td>Cor do contorno</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'strokeColor\',\'i3GEOEditorOLcorContorno\')" type="text" style="cursor:text" id="i3GEOEditorOLcorContorno" size="12" value="'+i3GEO.editorOL.simbologia.strokeColor+'" /></td><td>';if(i3GEO.configura){ins+='<img alt="aquarela.gif" style=cursor:pointer src="'+i3GEO.configura.locaplic+'/imagens/aquarela.gif" onclick="i3GEO.util.abreCor(\'\',\'i3GEOEditorOLcorContorno\');" />'}ins+=""+' </td>'+' </tr>'+' <tr>'+' <td>Cor do preenchimento</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'fillColor\',\'i3GEOEditorOLcorPre\')" type="text" style="cursor:text" id="i3GEOEditorOLcorPre" size="12" value="'+i3GEO.editorOL.simbologia.fillColor+'" /></td><td>';if(i3GEO.configura){ins+='<img alt="aquarela.gif" style=cursor:pointer src="'+i3GEO.configura.locaplic+'/imagens/aquarela.gif" onclick="i3GEO.util.abreCor(\'\',\'i3GEOEditorOLcorPre\');" />'}ins+=""+' </td>'+' </tr>'+' <tr>'+' <td>Cor da fonte</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'fontColor\',\'i3GEOEditorOLcorFonte\')" type="text" style="cursor:text" id="i3GEOEditorOLcorFonte" size="12" value="'+i3GEO.editorOL.simbologia.fontColor+'" /></td><td>';if(i3GEO.configura){ins+='<img alt="aquarela.gif" style=cursor:pointer src="'+i3GEO.configura.locaplic+'/imagens/aquarela.gif" onclick="i3GEO.util.abreCor(\'\',\'i3GEOEditorOLcorFonte\');" />'}ins+=""+' </td>'+' </tr>'+' <tr>'+' <td>Tamanho da fonte</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'fontSize\',\'i3GEOEditorOLfontsize\')" type="text" style="cursor:text" id="i3GEOEditorOLfontsize" size="3" value="'+i3GEO.editorOL.simbologia.fontSize+'" /></td><td></td>'+' </tr>'+' <tr>'+' <td>Opacidade (de 0 a 1)</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'opacidade\',\'i3GEOEditorOLopacidade\')" type="text" style="cursor:text" id="i3GEOEditorOLopacidade" size="3" value="'+i3GEO.editorOL.simbologia.opacidade+'" /></td><td></td>'+' </tr>'+' <tr>'+' <td>Largura da linha/contorno</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'strokeWidth\',\'i3GEOEditorOLlarguraLinha\')" type="text" style="cursor:text" id="i3GEOEditorOLlarguraLinha" size="2" value="'+i3GEO.editorOL.simbologia.strokeWidth+'" /></td><td></td>'+' </tr>'+' <tr>'+' <td>Url de uma figura</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'externalGraphic\',\'i3GEOEditorOLexternalGraphic\')" type="text" style="cursor:text" id="i3GEOEditorOLexternalGraphic" size="22" value="'+i3GEO.editorOL.simbologia.externalGraphic+'" /></td><td></td>'+' </tr>'+' <tr>'+' <td>Largura e altura</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'graphicWidth\',\'i3GEOEditorOLgraphicWidth\')" type="text" style="cursor:text" id="i3GEOEditorOLgraphicWidth" size="4" value="'+i3GEO.editorOL.simbologia.graphicWidth+'" /> <input onchange="i3GEO.editorOL.mudaSimbolo(\'graphicHeight\',\'i3GEOEditorOLgraphicHeight\')" type="text" style="cursor:text" id="i3GEOEditorOLgraphicHeight" size="4" value="'+i3GEO.editorOL.simbologia.graphicHeight+'" /></td><td></td>'+' </tr>'+'</table>'+'<br />'+'<p class=paragrafo ><b>Ajusta nó em edição para o(a):</b></p>'+'<table class=lista7 >'+' <tr>'+' <td></td><td>nó</td><td></td><td>vértice</td><td></td><td>borda</td>'+' </tr>'+' <tr>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.snap()" type="checkbox" id="target_node" /></td><td><input onchange="i3GEO.editorOL.snap()" id="target_nodeTolerance" type="text" size="3" value=15 /></td>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.snap()" type="checkbox" id="target_vertex" /></td><td><input onchange="i3GEO.editorOL.snap()" id="target_vertexTolerance" type="text" size="3" value=15 /></td>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.snap()" type="checkbox" id="target_edge" /></td><td><input onchange="i3GEO.editorOL.snap()" id="target_edgeTolerance" type="text" size="3" value=15 /></td>'+' </tr>'+'</table>'+'<br />'+'<p class=paragrafo ><b>Divide intersecção ao digitalizar</b></p>'+'<table class=lista7 >'+' <tr>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.split()" type="checkbox" id="edge_split_toggle" /></td><td>borda</td>'+' </tr>'+'</table>'+'<br />'+'<p class=paragrafo ><b>Operação ativada pelo botão de modificação da figura</b></p>'+'<table class=lista7 >'+' <tr>'+' <td><input checked style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.RESHAPE;" type="radio" name=i3geoOLtipoEdita /></td><td>altera figura</td>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.RESIZE;" type="radio" name=i3geoOLtipoEdita /></td><td>altera tamanho</td>'+' </tr>'+' <tr>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.ROTATE;" type="radio" name=i3geoOLtipoEdita /></td><td>rotaciona</td>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.DRAG;" type="radio" name=i3geoOLtipoEdita /></td><td>desloca</td>'+' </tr>'+'</table>';YAHOO.editorOL.container.panel.setBody(ins);if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){YAHOO.editorOL.container.panel.setHeader("Propriedades<div id='panelpropriedadesEditor_minimizaCabecalho' class='container-minimiza'></div>")}else{YAHOO.editorOL.container.panel.setHeader("Propriedades")}YAHOO.editorOL.container.panel.setFooter("");YAHOO.editorOL.container.panel.render(document.body);YAHOO.editorOL.container.panel.center();YAHOO.util.Event.addListener(YAHOO.editorOL.container.panel.close,"click",function(){});temp=$i("panelpropriedadesEditor_minimizaCabecalho");if(temp){temp.onclick=function(){i3GEO.janela.minimiza("panelpropriedadesEditor")}}}YAHOO.editorOL.container.panel.show();temp=$i("panelpropriedadesEditor").getElementsByTagName("div");if(temp&&temp[2]){temp[2].style.overflow="auto"}},listaGeometrias:function(){if(!document.getElementById("panellistagEditor")){YAHOO.namespace("editorOL.listaGeometrias");YAHOO.editorOL.listaGeometrias.panel=new YAHOO.widget.Panel("panellistagEditor",{zIndex:20000,iframe:true,width:"320px",visible:false,draggable:true,close:true});if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){YAHOO.editorOL.listaGeometrias.panel.setHeader("Geometrias <div id='panellistagEditor_minimizaCabecalho' class='container-minimiza'></div>")}else{YAHOO.editorOL.listaGeometrias.panel.setHeader("Geometrias")}YAHOO.editorOL.listaGeometrias.panel.setFooter("");YAHOO.editorOL.listaGeometrias.panel.render(document.body);YAHOO.editorOL.listaGeometrias.panel.center();YAHOO.util.Event.addListener(YAHOO.editorOL.listaGeometrias.panel.close,"click",function(){YAHOO.editorOL.listaGeometrias.panel.destroy()});temp=$i("panellistagEditor_minimizaCabecalho");if(temp){temp.onclick=function(){i3GEO.janela.minimiza("panellistagEditor")}}}else{YAHOO.editorOL.listaGeometrias.panel.render(document.body)}var g,temp,geos=i3GEO.desenho.layergrafico.features,n=geos.length,ins="<table class=lista4 >";ins+="<tr><td><i>Geometrias</i></td><td><i>Opções</i></td><td></td><td></td></tr>";while(n>0){n-=1;g=geos[n].geometry;ins+="<tr><td>"+g.CLASS_NAME+"</td><td style='cursor:pointer;color:blue' onclick='javascript:i3GEO.editorOL.selFeature("+n+")'>seleciona</td><td style='cursor:pointer;color:blue' onclick='javascript:i3GEO.editorOL.unselFeature("+n+")'>limpa</td><td style='cursor:pointer;color:blue' onclick='javascript:i3GEO.editorOL.flashFeaturesI("+n+")'>brilha</td></tr>"}ins+="</table>";if(geos.length===0){ins="Nenhum elemento gráfico encontrado. Utilize as opções de criação de geometrias."}YAHOO.editorOL.listaGeometrias.panel.show();if(i3GEO.configura){temp=$i("panellistagEditor").getElementsByTagName("div")[2]}else{temp=$i("panellistagEditor").getElementsByTagName("div")[1]}temp.style.overflow="auto";temp.style.height="100px";temp.innerHTML=ins},ferramentas:function(){if(!document.getElementById("panelferramentasEditor")){YAHOO.namespace("editorOL.ferramentas");YAHOO.editorOL.ferramentas.panel=new YAHOO.widget.Panel("panelferramentasEditor",{zIndex:20000,iframe:true,width:"300px",visible:false,draggable:true,close:true});var ins=""+'<p class=paragrafo >Operações sobre as figuras selecionadas:</p>'+'<select onchange="i3GEO.editorOL.processageo(this.value);this.value = \'\'" >'+' <option value="">---</option>'+' <option value=union >União</option>';if(i3GEO.php){ins+=' <option value=intersection >Intersecção</option>'+' <option value=convexhull >Convex hull</option>'+' <option value=boundary >Bordas</option>'+' <option value=difference >Diferença</option>'+' <option value=symdifference >Diferença simétrica</option>'}ins+='</select>'+'<br><br><a class=paragrafo href=# onclick="i3GEO.desenho.layergrafico.destroyFeatures()" >Apaga tudo</a>';YAHOO.editorOL.ferramentas.panel.setBody(ins);if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){YAHOO.editorOL.ferramentas.panel.setHeader("Ferramentas <div id='panelferramentasEditor_minimizaCabecalho' class='container-minimiza'></div>")}else{YAHOO.editorOL.ferramentas.panel.setHeader("Ferramentas")}YAHOO.editorOL.ferramentas.panel.setFooter("");YAHOO.editorOL.ferramentas.panel.render(document.body);YAHOO.editorOL.ferramentas.panel.center();YAHOO.util.Event.addListener(YAHOO.editorOL.ferramentas.panel.close,"click",function(){});temp=$i("panelferramentasEditor_minimizaCabecalho");if(temp){temp.onclick=function(){i3GEO.janela.minimiza("panelferramentasEditor")}}}else{YAHOO.editorOL.ferramentas.panel.render(document.body)}YAHOO.editorOL.ferramentas.panel.show()},snap:function(){var target=i3GEOOLsnap.targets[0],tipos=["node","vertex","edge"],ntipos=tipos.length,i,temp,ativa=false;i3GEOOLsnap.deactivate();for(i=0;i<ntipos;i++){temp=$i("target_"+tipos[i]);target[tipos[i]]=temp.checked;if(temp.checked===true){ativa=true}temp=$i("target_"+tipos[i]+"Tolerance");target[tipos[i]+"Tolerance"]=temp.value}if(ativa===true){i3GEOOLsnap.activate()}},split:function(){i3GEOOLsplit.deactivate();var temp=$i("edge_split_toggle");if(temp.checked===true){i3GEOOLsplit.activate()}},processageo:function(operacao){if(operacao===""){return}var geosel=i3GEO.desenho.layergrafico.selectedFeatures,polis,linhas,pontos,temp;if(geosel.length>0){polis=i3GEO.editorOL.retornaGeometriasTipo(geosel,"OpenLayers.Geometry.Polygon");linhas=i3GEO.editorOL.retornaGeometriasTipo(geosel,"OpenLayers.Geometry.LineString");pontos=i3GEO.editorOL.retornaGeometriasTipo(geosel,"OpenLayers.Geometry.Point");temp=function(retorno){if(i3GEO.janela){i3GEO.janela.fechaAguarde("i3GEO.editorPoli");i3GEO.janela.fechaAguarde("i3GEO.editorLinhas");i3GEO.janela.fechaAguarde("i3GEO.editorPontos")}if(retorno!=""&&retorno.data&&retorno.data!=""&&operacao!="converteSHP"){i3GEO.editorOL.substituiFeaturesSel(retorno.data)}if(operacao==="converteSHP"){i3GEO.atualiza();i3GEO.janela.minimiza("paneltemaativo")}};if(operacao==="union"&&!i3GEO.php){if(polis.length>0){temp=i3GEO.editorOL.uniaojts(polis);i3GEO.editorOL.substituiFeaturesSel(temp)}if(linhas.length>0){temp=i3GEO.editorOL.uniaojts(linhas);i3GEO.editorOL.substituiFeaturesSel(temp)}if(pontos.length>0){temp=i3GEO.editorOL.uniaojts(p);i3GEO.editorOL.substituiFeaturesSel(temp)}}else{if(polis.length>0){i3GEO.janela.abreAguarde("i3GEO.editorPoli","Poligonos");i3GEO.php.funcoesGeometriasWkt(temp,polis.join("|"),operacao)}if(linhas.length>0){i3GEO.janela.abreAguarde("i3GEO.editorLinhas","Linhas");i3GEO.php.funcoesGeometriasWkt(temp,linhas.join("|"),operacao)}if(pontos.length>0){i3GEO.janela.abreAguarde("i3GEO.editorPontos","Pontos");i3GEO.php.funcoesGeometriasWkt(temp,pontos.join("|"),operacao)}}return}else{alert("Selecione pelo menos dois elementos")}},uniaojts:function(geoms){var n=geoms.length,rwkt=new jsts.io.WKTReader(),wwkt=new jsts.io.WKTWriter(),fwkt=new OpenLayers.Format.WKT(),g,i,uniao;if(n>1){uniao=(fwkt.read(geoms[0]).geometry).toString();uniao=rwkt.read(uniao);for(i=1;i<=n;i++){g=(fwkt.read(geoms[i]).geometry).toString();uniao=uniao.union(rwkt.read(g))}uniao=wwkt.write(uniao);return[fwkt.read(uniao)]}else{return false}},retornaGeometriasTipo:function(features,tipo){var n=features.length,lista=[],i,temp;for(i=0;i<n;i++){temp=features[i].geometry;if(temp.CLASS_NAME==tipo){lista.push(temp)}}return lista},guardaBackup:function(){return;if(!i3GEO.editorOL.backup){i3GEO.editorOL.backup=new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false})}else{i3GEO.editorOL.backup.removeFeatures(i3GEO.editorOL.backup.features)}i3GEO.editorOL.backup.addFeatures(i3GEO.desenho.layergrafico.features)},unselTodos:function(){var n,i;n=i3GEO.desenho.layergrafico.features.length;for(i=0;i<n;i++){i3GEO.desenho.layergrafico.features[i].renderIntent="default";i3GEO.editorOL.selbutton.unselect(i3GEO.desenho.layergrafico.features[i])}},unselTodosBackup:function(){var n,i;n=i3GEO.editorOL.backup.features.length;for(i=0;i<n;i++){i3GEO.editorOL.backup.features[i].renderIntent="default";i3GEO.editorOL.selbutton.unselect(i3GEO.editorOL.backup.features[i])}},restauraBackup:function(){if(i3GEO.editorOL.backup.features.length>0){i3GEO.desenho.layergrafico.removeFeatures(i3GEO.desenho.layergrafico.features);i3GEO.desenho.layergrafico.addFeatures(i3GEO.editorOL.backup.features)}if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}},substituiFeaturesSel:function(wkt){i3GEO.editorOL.guardaBackup();try{var f,fwkt=new OpenLayers.Format.WKT();i3GEO.desenho.layergrafico.removeFeatures(i3GEO.desenho.layergrafico.selectedFeatures);f=fwkt.read(wkt);f["attributes"]={opacidade:i3GEO.editorOL.simbologia.opacidade,texto:i3GEO.editorOL.simbologia.texto,fillColor:i3GEO.editorOL.simbologia.fillColor,strokeWidth:i3GEO.editorOL.simbologia.strokeWidth,strokeColor:i3GEO.editorOL.simbologia.strokeColor,pointRadius:i3GEO.editorOL.simbologia.pointRadius,graphicName:i3GEO.editorOL.simbologia.graphicName};i3GEO.desenho.layergrafico.addFeatures([f]);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}}catch(e){i3GEO.editorOL.restauraBackup()}},adicionaFeatureWkt:function(wkt,atributos){var f,fwkt=new OpenLayers.Format.WKT();if(atributos.externalGraphic&&atributos.externalGraphic!=""){var style_mark=OpenLayers.Util.extend({},OpenLayers.Feature.Vector.style['default']);style_mark.externalGraphic=atributos.externalGraphic;style_mark.graphicWidth=atributos.graphicWidth;style_mark.graphicHeight=atributos.graphicHeight;style_mark.fillOpacity=atributos.opacidade;f=fwkt.read(wkt);f["attributes"]=atributos;f["style"]=style_mark}else{f=fwkt.read(wkt);f["attributes"]=atributos}i3GEO.desenho.layergrafico.addFeatures([f]);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}},flashFeaturesI:function(index){i3GEO.editorOL.flashFeatures([i3GEO.desenho.layergrafico.features[index]],0)},flashFeatures:function(features,index){if(!index){index=0}var current=features[index];if(current&¤t.layer===i3GEO.desenho.layergrafico){i3GEO.desenho.layergrafico.drawFeature(features[index],"select")}var prev=features[index-1];if(prev&&prev.layer===i3GEO.desenho.layergrafico){i3GEO.desenho.layergrafico.drawFeature(prev,"default")}++index;if(index<=features.length){window.setTimeout(function(){i3GEO.editorOL.flashFeatures(features,index)},75)}},selFeature:function(index){i3GEO.editorOL.selbutton.select(i3GEO.desenho.layergrafico.features[index])},unselFeature:function(index){i3GEO.editorOL.selbutton.unselect(i3GEO.desenho.layergrafico.features[index])},carregajts:function(funcao){if(i3GEO.configura){i3GEO.util.scriptTag(i3GEO.configura.locaplic+"/pacotes/jsts/lib/jsts.js",funcao,"i3GEOjts",true)}else{i3GEO.util.scriptTag("../pacotes/jsts/lib/jsts.js",funcao,"i3GEOjts",true)}},trazParaFrente:function(){var features=i3GEO.desenho.layergrafico.selectedFeatures;if(features.length>0){i3GEO.editorOL.backup=new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false});i3GEO.editorOL.backup.addFeatures(features);i3GEO.editorOL.unselTodosBackup();i3GEO.desenho.layergrafico.removeFeatures(features);i3GEO.desenho.layergrafico.addFeatures(i3GEO.editorOL.backup.features);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}}else{alert("Selecione pelo menos um elemento")}},pegaControle:function(classe){var n=i3GEO.editorOL.controles.length,i;for(i=0;i<n;i++){if(i3GEO.editorOL.controles[i].CLASS_NAME===classe){return i3GEO.editorOL.controles[i]}}return false},ativaLayerSwitcher:function(){var ls=i3GEO.editorOL.pegaControle("OpenLayers.Control.LayerSwitcher");if(ls){ls.maximizeDiv.click()}},desativaRodaDoMouse:function(){var controls=i3GEO.editorOL.mapa.getControlsByClass('OpenLayers.Control.Navigation');for(var i=0;i<controls.length;++i){controls[i].disableZoomWheel()}},google2wgs:function(obj){if(i3GEO.Interface.openlayers.googleLike===true){var projWGS84=new OpenLayers.Projection("EPSG:4326"),proj900913=new OpenLayers.Projection("EPSG:900913");return obj.transform(proj900913,projWGS84)}else{return obj}}}; | |
2 | 1 | \ No newline at end of file |
2 | +if(!i3GEO||typeof(i3GEO)==='undefined'){var i3GEO={};i3GEO.Interface={};navn=false;navm=false;$i=function(id){return document.getElementById(id)};app=navigator.appName.substring(0,1);if(app==='N'){navn=true}else{navm=true}OpenLayers.ImgPath="../pacotes/openlayers/img/";OpenLayers.Lang.setCode("pt-BR")}i3GEO.editorOL={simbologia:{opacidade:0.8,texto:"",fillColor:"250,180,15",strokeWidth:2,strokeColor:"250,150,0",pointRadius:4,graphicName:"square",fontSize:"12px",fontColor:"0,0,0",externalGraphic:"",graphicHeight:25,graphicWidth:25},backup:new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false}),nomeFuncaoSalvar:"i3GEO.editorOL.salvaGeo()",e_oce:new OpenLayers.Layer.ArcGIS93Rest("ESRI Ocean Basemap","http://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer/export",{format:"jpeg"},{isBaseLayer:true,visibility:false}),e_ims:new OpenLayers.Layer.ArcGIS93Rest("ESRI Imagery World 2D","http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer/export",{format:"jpeg"},{isBaseLayer:true,visibility:false}),e_wsm:new OpenLayers.Layer.ArcGIS93Rest("ESRI World Street Map","http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer/export",{format:"jpeg"},{isBaseLayer:true,visibility:false}),ol_mma:new OpenLayers.Layer.WMS("Base cartográfica","http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseraster.map&",{layers:'baseraster',SRS:'EPSG:4618',FORMAT:'image/png'},{singleTile:false}),ol_wms:new OpenLayers.Layer.WMS("OpenLayers WMS","http://labs.metacarta.com/wms/vmap0",{layers:'basic'}),top_wms:new OpenLayers.Layer.WMS("Toponímia MMA","http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseref.map&",{layers:"base",FORMAT:'image/png'}),est_wms:new OpenLayers.Layer.WMS("Estados do Brasil","http://mapas.mma.gov.br/i3geo/ogc.php?tema=estadosl&",{layers:"estadosl",FORMAT:'image/png'}),osm:new OpenLayers.Layer.OSM("OSM","http://tile.openstreetmap.org/${z}/${x}/${y}.png",{isBaseLayer:true,visibility:false}),fundo:"e_ims,e_wsm,ol_mma,ol_wms,top_wms,est_wms,e_oce",kml:[],layersIniciais:[],botoes:{'pan':true,'zoombox':true,'zoomtot':true,'zoomin':true,'zoomout':true,'legenda':true,'distancia':true,'area':true,'identifica':true,'linha':true,'ponto':true,'poligono':true,'texto':true,'edita':true,'listag':true,'corta':true,'apaga':true,'procura':true,'selecao':true,'salva':true,'ajuda':true,'propriedades':true,'fecha':false,'tools':true,'undo':false,'frente':false,'legenda':true,'rodadomouse':true},pontos:[],marca:"../pacotes/openlayers/img/marker-gold.png",controles:[new OpenLayers.Control.Navigation(),new OpenLayers.Control.PanZoomBar(),new OpenLayers.Control.LayerSwitcher({'ascending':false}),new OpenLayers.Control.ScaleLine(),new OpenLayers.Control.MousePosition({'separator':' '}),new OpenLayers.Control.OverviewMap(),new OpenLayers.Control.KeyboardDefaults()],tiles:true,incluilayergrafico:true,ativalayerswitcher:false,ativarodadomouse:true,legendahtml:false,numzoom:12,minresolution:0.703125,maxext:"",mapext:new OpenLayers.Bounds(-76.5125927,-39.3925675209,-29.5851853,9.49014852081),mapa:"",inicia:function(){var single=false,alayers=[],fundo=(i3GEO.editorOL.fundo).split(","),nfundo=fundo.length,ncontroles=i3GEO.editorOL.controles.length,i,n;if(i3GEO.editorOL.tiles===false||i3GEO.editorOL.tiles==="false"){single=true}if(i3GEO.editorOL.ativalayerswitcher==="false"){i3GEO.editorOL.ativalayerswitcher=false}if(i3GEO.editorOL.ativalayerswitcher==="true"){i3GEO.editorOL.ativalayerswitcher=true}if(i3GEO.editorOL.ativarodadomouse==="false"){i3GEO.editorOL.ativarodadomouse=false}if(i3GEO.editorOL.ativarodadomouse==="true"){i3GEO.editorOL.ativarodadomouse=true}if(i3GEO.editorOL.legendahtml==="false"){i3GEO.editorOL.legendahtml=false}if(i3GEO.editorOL.legendahtml==="true"){i3GEO.editorOL.legendahtml=true}if(i3GEO.editorOL.incluilayergrafico==="false"){i3GEO.editorOL.incluilayergrafico=false}if(i3GEO.editorOL.incluilayergrafico==="true"){i3GEO.editorOL.incluilayergrafico=true}if(i3GEO.editorOL.incluilayergrafico===true){if(!i3GEO.desenho.layergrafico){i3GEO.editorOL.criaLayerGrafico()}}else{i3GEO.desenho.layergrafico="";i3GEO.editorOL.botoes.linha=false;i3GEO.editorOL.botoes.ponto=false;i3GEO.editorOL.botoes.poligono=false;i3GEO.editorOL.botoes.texto=false;i3GEO.editorOL.botoes.edita=false;i3GEO.editorOL.botoes.listag=false;i3GEO.editorOL.botoes.corta=false;i3GEO.editorOL.botoes.apaga=false;i3GEO.editorOL.botoes.selecao=false;i3GEO.editorOL.botoes.salva=false;i3GEO.editorOL.botoes.propriedades=false;i3GEO.editorOL.botoes.fecha=false;i3GEO.editorOL.botoes.tools=false;i3GEO.editorOL.botoes.undo=false;i3GEO.editorOL.botoes.frente=false}if(i3GEO.editorOL.mapa===""){alert("O objeto i3GEO.editorOL.mapa precisa ser criado com new OpenLayers.Map()");return}for(i=0;i<ncontroles;i++){i3GEO.editorOL.mapa.addControl(i3GEO.editorOL.controles[i])}if(i3GEO.editorOL.fundo!=""){for(i=nfundo-1;i>=0;i--){if(fundo[i]!=""){try{eval("i3GEO.editorOL."+fundo[i]+".transitionEffect = 'resize';");eval("i3GEO.editorOL."+fundo[i]+".setVisibility(false);");eval("i3GEO.editorOL."+fundo[i]+".singleTile = false;");eval("alayers.push(i3GEO.editorOL."+fundo[i]+");")}catch(e){if(alayers[0]){alayers[0].setVisibility(true)}}}}}i3GEO.editorOL.mapa.addLayers(alayers);if(i3GEO.editorOL.layersIniciais!==""){n=i3GEO.editorOL.layersIniciais.length;for(i=0;i<n;i++){i3GEO.editorOL.layersIniciais[i].singleTile=single;i3GEO.editorOL.mapa.addLayer(i3GEO.editorOL.layersIniciais[i])}}if(!i3GEO.desenho.layergrafico){i3GEO.editorOL.mapa.addLayers([i3GEO.desenho.layergrafico])}i3GEO.editorOL.adicionaKml();i3GEO.editorOL.adicionaMarcas();i3GEO.editorOL.coordenadas();i3GEO.editorOL.criaJanelaBusca();i3GEO.editorOL.criaBotoes(i3GEO.editorOL.botoes);if(i3GEO.editorOL.ativalayerswitcher===true){i3GEO.editorOL.ativaLayerSwitcher()}if(i3GEO.editorOL.ativarodadomouse===false){i3GEO.editorOL.desativaRodaDoMouse()}if(i3GEO.editorOL.numzoom!==""){i3GEO.editorOL.mapa.setOptions({numZoomLevels:i3GEO.editorOL.numzoom})}if(i3GEO.editorOL.maxext!==""){i3GEO.editorOL.mapa.setOptions({maxExtent:i3GEO.editorOL.maxext})}if(i3GEO.editorOL.mapext!=""){i3GEO.editorOL.mapa.zoomToExtent(i3GEO.editorOL.mapext)}else{i3GEO.editorOL.mapa.zoomToMaxExtent()}if(i3GEO.Interface&&i3GEO.Interface.openlayers&&i3GEO.Interface.openlayers.sobeLayersGraficos){i3GEO.Interface.openlayers.sobeLayersGraficos()}},criaLayerGrafico:function(){i3GEO.desenho.openlayers.criaLayerGrafico()},layersLigados:function(){var layers=i3GEO.editorOL.mapa.layers,nlayers=layers.length,ins=[],i;for(i=0;i<nlayers;i++){if(layers[i].visibility===true){ins.push(layers[i])}}return ins},layersClonados:function(paramsLayers){var layers=i3GEO.editorOL.mapa.layers,nlayers=layers.length,i;for(i=0;i<nlayers;i++){if(layers[i].params&&layers[i].params.CLONETMS===paramsLayers){return(layers[i])}}return false},layertms2wms:function(tms){var layer,url;url=tms.url.replace("&cache=sim","&DESLIGACACHE=sim");url=url.replace("&Z=${z}&X=${x}&Y=${y}","");url=url.replace("Z=${z}&X=${x}&Y=${y}","");layer=new OpenLayers.Layer.WMS(tms.layername+"_clone",url,{layers:tms.name,transparent:true},{gutter:0,isBaseLayer:false,displayInLayerSwitcher:false,opacity:1,visibility:true,singleTile:true});return layer},removeClone:function(){var nome=i3GEO.editorOL.layerAtivo().layername+"_clone",busca=i3GEO.editorOL.mapa.getLayersByName(nome);if(busca.length>0){i3GEO.editorOL.mapa.removeLayer(i3GEO.editorOL.mapa.getLayersByName(camada.name)[0],false)}},coordenadas:function(){var idcoord=i3GEO.editorOL.mapa.getControlsBy("separator"," ");if(idcoord[0]){i3GEO.editorOL.mapa.events.register("mousemove",i3GEO.editorOL.mapa,function(e){var p,lonlat,d;if(navm){p=new OpenLayers.Pixel(e.x,e.y)}else{p=e.xy}lonlat=i3GEO.editorOL.mapa.getLonLatFromPixel(p);d=i3GEO.calculo.dd2dms(lonlat.lon,lonlat.lat);try{$i(idcoord[0].id).innerHTML="Long: "+d[0]+"<br>Lat: "+d[1]}catch(e){}})}},criaJanelaBusca:function(){var layers=i3GEO.editorOL.layersLigados(),nlayers=layers.length,i,ins,combo="<select id=i3GEOOLlistaTemasBusca ><option value=''>----</option>";for(i=0;i<nlayers;i++){combo+="<option value='"+i+"' >"+layers[i].name+"</option>"}combo+="</select>";ins="<div class=paragrafo >Tema:<br>"+combo;ins+="<br>Item:<br><span id=i3GEOOLcomboitens ></span>";ins+="<br>Procurar por:<br><input type=text size=20 id=i3GEOOLpalavraBusca >";ins+="<br><br><input type=button value='Procurar' id='i3GEOOLbotaoBusca' ></div>";ins+="<br>Resultado:<br><span id=i3GEOOLcomboresultado ></span>";try{YAHOO.namespace("procura.container");YAHOO.procura.container.panel=new YAHOO.widget.Panel("panelprocura",{zIndex:2000,iframe:false,width:"250px",visible:false,draggable:true,close:true});YAHOO.procura.container.panel.setHeader("Encontre no mapa");YAHOO.procura.container.panel.setBody(ins);YAHOO.procura.container.panel.setFooter("");YAHOO.procura.container.panel.render(document.body);YAHOO.procura.container.panel.center();document.getElementById("i3GEOOLbotaoBusca").onclick=function(){var layer=i3GEO.editorOL.layerAtivo(),item=document.getElementById("i3GEOOLbuscaItem").value,palavra=document.getElementById("i3GEOOLpalavraBusca").value;if(item===""||palavra===""){alert("Escolha o item e o texto de busca");return}i3GEO.editorOL.busca(layer,item,palavra,"i3GEOOLcomboresultado")};document.getElementById("i3GEOOLlistaTemasBusca").onchange=function(){i3GEO.editorOL.ativaTema(this.value);document.getElementById("i3GEOOLcomboitens").innerHTML="...";i3GEO.editorOL.listaItens(i3GEO.editorOL.layerAtivo(),"i3GEOOLcomboitens","i3GEOOLbuscaItem")}}catch(e){}},criaComboTemas:function(){var layers=i3GEO.editorOL.layersLigados(),nlayers=layers.length,i,nometema="",temp,combo="<select id=i3GEOOLlistaTemasAtivos style=width:235px; >";for(i=0;i<nlayers;i++){nometema="";if(i3GEO.arvoreDeCamadas&&i3GEO.arvoreDeCamadas.CAMADAS){temp=i3GEO.arvoreDeCamadas.pegaTema(layers[i].name,"","name");if(temp!=""){nometema=temp.tema+" - "}}combo+="<option value='"+i+"' >"+nometema+layers[i].name+"</option>"}combo+="</select>";return combo},atualizaJanelaAtivaTema:function(){var combo=i3GEO.editorOL.criaComboTemas();YAHOO.temaativo.container.panel.setBody(combo);document.getElementById("i3GEOOLlistaTemasAtivos").onchange=function(){if(botaoIdentifica){botaoIdentifica.layers=[i3GEO.editorOL.layersLigados()[this.value]]}}},criaJanelaAtivaTema:function(){var temp;if(!document.getElementById("paneltemaativo")){YAHOO.namespace("temaativo.container");YAHOO.temaativo.container.panel=new YAHOO.widget.Panel("paneltemaativo",{zIndex:20000,iframe:true,width:"250px",visible:false,draggable:true,close:true});YAHOO.temaativo.container.panel.setBody("");if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){YAHOO.temaativo.container.panel.setHeader("Tema ativo<div id='paneltemaativo_minimizaCabecalho' class='container-minimiza'></div>")}else{YAHOO.temaativo.container.panel.setHeader("Tema ativo")}YAHOO.temaativo.container.panel.setFooter("");YAHOO.temaativo.container.panel.render(document.body);YAHOO.temaativo.container.panel.show();YAHOO.temaativo.container.panel.center();i3GEO.editorOL.atualizaJanelaAtivaTema();YAHOO.util.Event.addListener(YAHOO.temaativo.container.panel.close,"click",function(){i3GEOpanelEditor.deactivate();i3GEOpanelEditor.activate();if(i3GEO.eventos&&i3GEO.eventos.ATUALIZAARVORECAMADAS.toString().search("i3GEO.editorOL.atualizaJanelaAtivaTema()")>0){i3GEO.eventos.ATUALIZAARVORECAMADAS.remove("i3GEO.editorOL.atualizaJanelaAtivaTema()")}});if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){if(i3GEO.eventos&&i3GEO.eventos.ATUALIZAARVORECAMADAS.toString().search("i3GEO.editorOL.atualizaJanelaAtivaTema()")<0){i3GEO.eventos.ATUALIZAARVORECAMADAS.push("i3GEO.editorOL.atualizaJanelaAtivaTema()")}}temp=$i("paneltemaativo_minimizaCabecalho");if(temp){temp.onclick=function(){i3GEO.janela.minimiza("paneltemaativo")}}}else{YAHOO.temaativo.container.panel.show();i3GEO.editorOL.atualizaJanelaAtivaTema()}},ativaTema:function(id){document.getElementById("i3GEOOLlistaTemasAtivos").value=id},layerAtivo:function(){var id=document.getElementById("i3GEOOLlistaTemasAtivos");if(id){id=id.value}else{id=i3GEO.temaAtivo}if(id==""){return[]}else{return i3GEO.editorOL.layersLigados()[id]}},listaItens:function(layer,idonde,idobj){if(!layer){return}if(!layer.params){return}var u=layer.url+"&request=describefeaturetype&service=wfs&version=1.0.0";u+="&typename="+layer.params.LAYERS;document.body.style.cursor="wait";document.getElementById("i3geoMapa").style.cursor="wait";OpenLayers.Request.issue({method:"GET",url:u,callback:function(retorno){document.body.style.cursor="default";document.getElementById("i3geoMapa").style.cursor="default";var fromgml=new OpenLayers.Format.WFSDescribeFeatureType({geometryName:"msGeometry"}),gml=fromgml.read(retorno.responseText),prop=gml.featureTypes[0].properties,nprop=prop.length,i,combo="<select id="+idobj+" ><option value=''>----</option>";for(i=0;i<nprop;i++){combo+="<option value="+prop[i].name+" >"+prop[i].name+"</option>"}combo+="</select>";document.getElementById(idonde).innerHTML=combo},failure:function(){document.body.style.cursor="default";document.getElementById("i3geoMapa").style.cursor="default";alert("Erro")}})},busca:function(layer,item,palavra,onde){document.body.style.cursor="wait";document.getElementById("i3geoMapa").style.cursor="wait";var u=layer.url+"&request=getfeature&service=wfs&version=1.0.0";u=u.replace("Z=${z}&X=${x}&Y=${y}","");u+="&OUTPUTFORMAT=gml2&typename="+layer.params.LAYERS;u+="&filter=<Filter><PropertyIsLike wildcard=* singleChar=. escape=! ><PropertyName>"+item+"</PropertyName><Literal>*"+palavra+"*</Literal></PropertyIsLike></Filter>";document.body.style.cursor="wait";document.getElementById("i3geoMapa").style.cursor="wait";document.getElementById(onde).innerHTML="...";OpenLayers.Request.issue({method:"GET",url:u,callback:function(retorno){document.body.style.cursor="default";document.getElementById("i3geoMapa").style.cursor="default";var fromgml=new OpenLayers.Format.GML({geometryName:"msGeometry"}),gml=fromgml.read(retorno.responseText),ngml=gml.length,i,ins="<select onchange='i3GEO.editorOL.zoomPara(this.value)'>";ins+="<option value=''>---</option>";for(i=0;i<ngml;i++){eval("var valor = gml[i].data."+item);var bounds=gml[i].geometry.getBounds();bounds=bounds.toBBOX();ins+="<option value='"+bounds+"'>"+valor+"</option>"}ins+="</select>";document.getElementById(onde).innerHTML=ins},failure:function(){document.body.style.cursor="default";document.getElementById("i3geoMapa").style.cursor="default";alert("Erro")}})},zoomPara:function(bbox){var b=new OpenLayers.Bounds.fromString(bbox);i3GEO.editorOL.mapa.zoomToExtent(b)},mostraLegenda:function(){var layers=i3GEO.editorOL.layersLigados(),nlayers=layers.length,ins="",i;for(i=0;i<nlayers;i++){try{if(layers[i].isBaseLayer===false){var url=layers[i].getFullRequestString({"request":"getlegendgraphic"});if(i3GEO.editorOL.legendahtml===true){url=url.replace("image%2Fpng","text/html");ins+=layers[i].name+"<br><div id=legendaL_"+i+" ></div><br>";eval("var f = function(retorno){document.getElementById('legendaL_"+i+"').innerHTML = retorno.responseText;};");var config={method:"GET",url:url,callback:f};OpenLayers.Request.issue(config)}else{url=url.replace("LAYERS","LAYER");url=url.replace("&Z=${z}&X=${x}&Y=${y}","");url=url.replace("Z=${z}&X=${x}&Y=${y}","");ins+=layers[i].name+"<br><img src='"+url+"&SERVICE=wms' /><br>"}}}catch(e){}}if(!document.getElementById("panellegendaeditorOL")){YAHOO.namespace("legendaeditorOL.container");YAHOO.legendaeditorOL.container.panel=new YAHOO.widget.Panel("panellegendaeditorOL",{zIndex:20000,iframe:true,width:"auto",visible:false,draggable:true,close:true});YAHOO.legendaeditorOL.container.panel.setBody(ins);YAHOO.legendaeditorOL.container.panel.setHeader("Legenda");YAHOO.legendaeditorOL.container.panel.setFooter("");YAHOO.legendaeditorOL.container.panel.render(document.body);YAHOO.legendaeditorOL.container.panel.show();YAHOO.legendaeditorOL.container.panel.center();YAHOO.util.Event.addListener(YAHOO.legendaeditorOL.container.panel.close,"click",function(){})}else{YAHOO.legendaeditorOL.container.panel.setBody(ins);YAHOO.legendaeditorOL.container.panel.show()}},captura:function(lonlat){var d=0.1,layers=[i3GEO.editorOL.layerAtivo()],xy=lonlat.split(","),u=layers[0].url+"&REQUEST=getfeature&service=wfs&version=1.0.0";u+="&OUTPUTFORMAT=gml2&typename="+layers[0].params.LAYERS;u=u.replace("&cache=sim","&DESLIGACACHE=sim");u=u.replace("&Z=${z}&X=${x}&Y=${y}","");u=u.replace("Z=${z}&X=${x}&Y=${y}","");xy[0]=xy[0]*1;xy[1]=xy[1]*1;var poligono=(xy[0]-d)+","+(xy[1]+d)+" "+(xy[0]+d)+","+(xy[1]+d)+" "+(xy[0]+d)+","+(xy[1]-d)+" "+(xy[0]-d)+","+(xy[1]-d)+" "+(xy[0]-d)+","+(xy[1]+d);u+="&filter=<Filter><Intersects><PropertyName>Geometry</PropertyName><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:posList>"+poligono+"</gml:posList></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></Intersects></Filter>";document.body.style.cursor="wait";if(document.getElementById("i3geoMapa")){document.getElementById("i3geoMapa").style.cursor="wait"}OpenLayers.Request.issue({method:"GET",url:u,callback:function(retorno){document.body.style.cursor="default";if(document.getElementById("i3geoMapa")){document.getElementById("i3geoMapa").style.cursor="default"}var i,n,f,fromgml=new OpenLayers.Format.GML({geometryName:"msGeometry"}),gml=fromgml.read(retorno.responseText);n=gml.length;for(i=0;i<n;i++){f=gml[i];f["attributes"]={opacidade:i3GEO.editorOL.simbologia.opacidade,texto:i3GEO.editorOL.simbologia.texto,fillColor:i3GEO.editorOL.simbologia.fillColor,strokeWidth:i3GEO.editorOL.simbologia.strokeWidth,strokeColor:i3GEO.editorOL.simbologia.strokeColor,pointRadius:i3GEO.editorOL.simbologia.pointRadius,graphicName:i3GEO.editorOL.simbologia.graphicName,registros:f["attributes"]}}i3GEO.desenho.layergrafico.addFeatures(gml)},failure:function(){document.body.style.cursor="default";if(document.getElementById("i3geoMapa")){document.getElementById("i3geoMapa").style.cursor="default"}alert("Erro")}})},salvaGeometrias:function(){var geos=i3GEO.desenho.layergrafico.selectedFeatures,n=geos.length,ins="";if(n>0){if($i("panelsalvageometrias")){if(YAHOO.i3GEO){YAHOO.salvaGeometrias.container.panel=YAHOO.i3GEO.janela.manager.find("panelsalvageometrias")}YAHOO.salvaGeometrias.container.panel.show();YAHOO.salvaGeometrias.container.panel.bringToTop()}else{try{YAHOO.namespace("salvaGeometrias.container");YAHOO.salvaGeometrias.container.panel=new YAHOO.widget.Panel("panelsalvageometrias",{zIndex:2000,iframe:false,width:"250px",visible:false,draggable:true,close:true});YAHOO.salvaGeometrias.container.panel.setHeader("Geometrias");YAHOO.salvaGeometrias.container.panel.setBody("");YAHOO.salvaGeometrias.container.panel.setFooter("");YAHOO.salvaGeometrias.container.panel.render(document.body);YAHOO.salvaGeometrias.container.panel.center();if(YAHOO.i3GEO&&YAHOO.i3GEO.janela){YAHOO.i3GEO.janela.manager.register(YAHOO.salvaGeometrias.container.panel)}YAHOO.salvaGeometrias.container.panel.show()}catch(e){}}ins+="<p class=paragrafo >Foram encontrada(s) "+n+" geometria(s) selecionada(s) </p>";ins+="<p class=paragrafo ><a href='#' onclick='i3GEO.editorOL.listaGeometriasSel()' >Listar</a> ";if(i3GEO.arvoreDeCamadas){ins+="<a href='#' onclick='"+i3GEO.editorOL.nomeFuncaoSalvar+"' >Salvar</a> "}ins+="<a href='#' onclick='i3GEO.editorOL.exportarSHP()' >Exportar (shapefile)</a></p>";YAHOO.salvaGeometrias.container.panel.setBody(ins)}else{alert("Selecione pelo menos um elemento")}},exportarSHP:function(){i3GEO.editorOL.processageo("converteSHP")},listaGeometriasSel:function(){var geos=i3GEO.desenho.layergrafico.selectedFeatures,n=geos.length,ins="",i,a,w,g;for(i=0;i<n;i++){g=geos[i];ins+="<b>Geometria: "+i+"</b><br>"+i3GEO.editorOL.google2wgs(g.geometry)+"<br><br>";ins+="<b>Atributos: "+i+"</b><br>";a=g.attributes;for(key in a){if(a[key]){ins+=key+" = "+a[key]+"<br>"}}if(g.attributes.registros){ins+="<b>Registros: "+i+"</b><br>";a=g.attributes.registros;for(key in a){if(a[key]){ins+=key+" = "+a[key]+"<br>"}}}}w=window.open();w.document.write(ins);w.document.close()},testeSalvar:function(){alert("Funcao nao disponivel. Defina o nome da funcao em i3GEO.editorOL.nomeFuncaoSalvar ")},salvaGeo:function(){var geos=i3GEO.desenho.layergrafico.selectedFeatures,n=geos.length,funcaoOK=function(){if(geos[0].geometry){var registros="",valorunico="",nometema=$i("editorOLcomboTemaEditavel").value,key="",tema,redesenha,p,g=i3GEO.editorOL.google2wgs(geos[0].geometry);if(nometema==""){return}tema=i3GEO.arvoreDeCamadas.pegaTema(nometema,"","name");if(geos[0].attributes.registros){registros=geos[0].attributes.registros;for(key in registros){if(registros[key]&&key==tema.colunaidunico){valorunico=registros[key]}}}redesenha=function(retorno){i3GEO.janela.fechaAguarde("aguardeSalvaPonto");i3GEO.desenho.layergrafico.removeFeatures(i3GEO.desenho.layergrafico.selectedFeatures);i3GEO.Interface.atualizaTema("",nometema)};i3GEO.janela.AGUARDEMODAL=true;i3GEO.janela.abreAguarde("aguardeSalvaPonto","Adicionando...");i3GEO.janela.AGUARDEMODAL=false;if(valorunico==""){p=i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=adicionaGeometria&g_sid="+i3GEO.configura.sid;cpJSON.call(p,"foo",redesenha,"&tema="+nometema+"&wkt="+g)}else{p=i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=atualizaGeometria&g_sid="+i3GEO.configura.sid;cpJSON.call(p,"foo",redesenha,"&idunico="+valorunico+"&tema="+nometema+"&wkt="+g)}}},funcaoCombo=function(obj){$i("editorOLondeComboTemaEditavel").innerHTML=obj.dados},texto="Salvar no tema:<br><div id=editorOLondeComboTemaEditavel ></div><br><br>";if(n!=1){i3GEO.janela.tempoMsg("Selecione apenas uma figura")}else{i3GEO.janela.confirma(texto,300,"Salva","Cancela",funcaoOK);i3GEO.util.comboTemas("editorOLcomboTemaEditavel",funcaoCombo,"editorOLondeComboTemaEditavel","",false,"editavel")}},criaBotoes:function(botoes){var sketchSymbolizers={"Point":{pointRadius:4,graphicName:"square",fillColor:"white",fillOpacity:1,strokeWidth:1,strokeOpacity:1,strokeColor:"#333333"},"Line":{strokeWidth:3,strokeOpacity:1,strokeColor:"#666666",strokeDashstyle:"dash"},"Polygon":{strokeWidth:2,strokeOpacity:1,strokeColor:"#666666",fillColor:"white",fillOpacity:0.3}},style=new OpenLayers.Style(),styleMap=new OpenLayers.StyleMap({"default":style,"vertex":{strokeOpacity:1,strokeWidth:1,fillColor:"white",fillOpacity:0.45,pointRadius:3}},{extendDefault:false}),adiciona=false,button,controles=[];style.addRules([new OpenLayers.Rule({symbolizer:sketchSymbolizers})]);i3GEOpanelEditor=new OpenLayers.Control.Panel({displayClass:"olControlEditingToolbar1 noprint",saveState:false,activateControl:function(c){this.deactivate();this.activate();try{i3GEO.editorOL.ModifyFeature.deactivate();if(i3GEO&&i3GEO.barraDeBotoes){i3GEO.barraDeBotoes.ativaPadrao()}}catch(e){}if(!c.trigger){c.activate()}else{c.trigger.call()}}});if(botoes.procura===true){button=new OpenLayers.Control.Button({displayClass:"editorOLprocura",trigger:function(){YAHOO.procura.container.panel.show()},title:"procura",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.pan===true){controles.push(new OpenLayers.Control.Navigation({title:"deslocar",displayClass:"editorOLpan",type:OpenLayers.Control.TYPE_TOOL}));adiciona=true}if(botoes.zoombox===true){controles.push(new OpenLayers.Control.ZoomBox({title:"zoombox",displayClass:"editorOLzoombox",type:OpenLayers.Control.TYPE_TOOL}));adiciona=true}if(botoes.zoomtot===true){button=new OpenLayers.Control.Button({displayClass:"editorOLzoomtot",trigger:function(){if(i3GEO.editorOL.mapext&&i3GEO.editorOL.mapext!=""){i3GEO.editorOL.mapa.zoomToExtent(i3GEO.editorOL.mapext)}else{i3GEO.editorOL.mapa.zoomToMaxExtent()}},title:"ajusta extensao",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.zoomin===true){button=new OpenLayers.Control.Button({displayClass:"editorOLzoomin",trigger:function(){i3GEO.editorOL.mapa.zoomIn()},title:"aproxima",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.zoomout===true){button=new OpenLayers.Control.Button({displayClass:"editorOLzoomout",trigger:function(){i3GEO.editorOL.mapa.zoomOut()},title:"afasta",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.legenda===true){button=new OpenLayers.Control.Button({displayClass:"editorOLlegenda",trigger:function(){i3GEO.editorOL.mostraLegenda()},title:"legenda",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.distancia===true){button=new OpenLayers.Control.Measure(OpenLayers.Handler.Path,{handlerOptions:{layerOptions:{styleMap:styleMap}},persist:true,displayClass:"editorOLdistancia",title:"distancia",type:OpenLayers.Control.TYPE_TOOL});button.events.on({"measure":function(event){var units=event.units,measure=event.measure;alert("Distancia: "+measure.toFixed(3)+" "+units)}});controles.push(button);adiciona=true}if(botoes.area===true){button=new OpenLayers.Control.Measure(OpenLayers.Handler.Polygon,{handlerOptions:{layerOptions:{styleMap:styleMap}},persist:true,displayClass:"editorOLarea",title:"area",type:OpenLayers.Control.TYPE_TOOL});button.events.on({"measure":function(event){var units=event.units;var measure=event.measure;alert("Área: "+measure.toFixed(3)+" "+units+" quadrados")}});controles.push(button);adiciona=true}if(botoes.identifica===true){botaoIdentifica=new OpenLayers.Control.WMSGetFeatureInfo({maxFeatures:1,infoFormat:'text/plain',layers:[i3GEO.editorOL.layerAtivo()],queryVisible:true,title:"identifica",type:OpenLayers.Control.TYPE_TOOL,displayClass:"editorOLidentifica",eventListeners:{getfeatureinfo:function(event){var lonlat=i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy),lonlattexto="<hr>",formata;if(botoes.linha===true||botoes.ponto===true||botoes.poligono===true||botoes.edita===true){lonlattexto+="<pre><span style=font-size:12px;color:blue;cursor:pointer onclick='i3GEO.editorOL.captura(\""+lonlat.lon+","+lonlat.lat+"\")'>edita geometria</span></pre><br>"}formata=function(texto){var temp,temp1,n,i,f=[],textoN=texto.split(":");try{if(textoN.length>1){temp=textoN[2].replace(/\n\r/g,"");temp=temp.replace(/'/g,"");temp=temp.replace(/\n/g,"|");temp=temp.replace(/_/g," ");temp=temp.replace(/=/g,":");temp=temp.split("|");n=temp.length;for(i=0;i<n;i++){temp1=temp[i].replace(/^\s+/,"");temp1=temp1.replace(/\s+$/,"");if(temp1!="")f.push(temp1)}texto=f.join("<br><br>")}}catch(e){}return texto};i3GEO.editorOL.mapa.addPopup(new OpenLayers.Popup.FramedCloud("chicken",i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy),null,"<div style=text-align:left >"+lonlattexto+"<pre>"+formata(event.text)+"</pre></div>",null,true));i3GEO.editorOL.removeClone()},beforegetfeatureinfo:function(event){var ativo=[i3GEO.editorOL.layerAtivo()];if(ativo[0].serviceVersion==="&tms="||ativo[0].CLASS_NAME=="OpenLayers.Layer.TMS"||ativo[0].CLASS_NAME=="OpenLayers.Layer.OSM"){ativo=[i3GEO.editorOL.layertms2wms(ativo[0])]}ativo[0].projection=new OpenLayers.Projection("EPSG:4326");event.object.layers=ativo;botaoIdentifica.layers=ativo;botaoIdentifica.url=ativo[0].url},activate:function(){i3GEO.editorOL.criaJanelaAtivaTema()}}});controles.push(botaoIdentifica);adiciona=true}if(botoes.linha===true){button=new OpenLayers.Control.DrawFeature(i3GEO.desenho.layergrafico,OpenLayers.Handler.Path,{displayClass:"editorOLlinha",title:"digitalizar linha",type:OpenLayers.Control.TYPE_TOOL,callbacks:{done:function(feature){var f=new OpenLayers.Feature.Vector(feature);f["attributes"]={opacidade:i3GEO.editorOL.simbologia.opacidade,texto:i3GEO.editorOL.simbologia.texto,fillColor:i3GEO.editorOL.simbologia.fillColor,strokeWidth:i3GEO.editorOL.simbologia.strokeWidth,strokeColor:i3GEO.editorOL.simbologia.strokeColor,pointRadius:i3GEO.editorOL.simbologia.pointRadius,graphicName:i3GEO.editorOL.simbologia.graphicName};i3GEO.desenho.layergrafico.addFeatures([f]);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}if(i3GEO.Interface&&i3GEO.Interface.openlayers&&i3GEO.Interface.openlayers.sobeLayersGraficos){i3GEO.Interface.openlayers.sobeLayersGraficos()}}}});controles.push(button);adiciona=true}if(botoes.ponto===true){button=new OpenLayers.Control.DrawFeature(i3GEO.desenho.layergrafico,OpenLayers.Handler.Point,{displayClass:"editorOLponto",title:"digitalizar ponto",type:OpenLayers.Control.TYPE_TOOL,callbacks:{done:function(feature){var f,style_mark;if(i3GEO.editorOL.simbologia.externalGraphic!=""){style_mark=OpenLayers.Util.extend({},OpenLayers.Feature.Vector.style['default']);style_mark.externalGraphic=i3GEO.editorOL.simbologia.externalGraphic;style_mark.graphicWidth=i3GEO.editorOL.simbologia.graphicWidth;style_mark.graphicHeight=i3GEO.editorOL.simbologia.graphicHeight;style_mark.fillOpacity=i3GEO.editorOL.simbologia.opacidade;f=new OpenLayers.Feature.Vector(feature,null,style_mark)}else{f=new OpenLayers.Feature.Vector(feature)}f["attributes"]={opacidade:i3GEO.editorOL.simbologia.opacidade,texto:i3GEO.editorOL.simbologia.texto,fillColor:i3GEO.editorOL.simbologia.fillColor,strokeWidth:i3GEO.editorOL.simbologia.strokeWidth,strokeColor:i3GEO.editorOL.simbologia.strokeColor,pointRadius:i3GEO.editorOL.simbologia.pointRadius,graphicName:i3GEO.editorOL.simbologia.graphicName,externalGraphic:i3GEO.editorOL.simbologia.externalGraphic,graphicHeight:i3GEO.editorOL.simbologia.graphicHeight,graphicWidth:i3GEO.editorOL.simbologia.graphicWidth};i3GEO.desenho.layergrafico.addFeatures([f]);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}if(i3GEO.Interface&&i3GEO.Interface.openlayers&&i3GEO.Interface.openlayers.sobeLayersGraficos){i3GEO.Interface.openlayers.sobeLayersGraficos()}}}});controles.push(button);adiciona=true}if(botoes.poligono===true){button=new OpenLayers.Control.DrawFeature(i3GEO.desenho.layergrafico,OpenLayers.Handler.Polygon,{displayClass:"editorOLpoligono",title:"digitalizar poligono",type:OpenLayers.Control.TYPE_TOOL,callbacks:{done:function(feature){var f=new OpenLayers.Feature.Vector(feature);f["attributes"]={opacidade:i3GEO.editorOL.simbologia.opacidade,texto:i3GEO.editorOL.simbologia.texto,fillColor:i3GEO.editorOL.simbologia.fillColor,strokeWidth:i3GEO.editorOL.simbologia.strokeWidth,strokeColor:i3GEO.editorOL.simbologia.strokeColor,pointRadius:i3GEO.editorOL.simbologia.pointRadius,graphicName:i3GEO.editorOL.simbologia.graphicName};i3GEO.desenho.layergrafico.addFeatures([f]);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}if(i3GEO.Interface&&i3GEO.Interface.openlayers&&i3GEO.Interface.openlayers.sobeLayersGraficos){i3GEO.Interface.openlayers.sobeLayersGraficos()}}}});controles.push(button);adiciona=true}if(botoes.texto===true){button=new OpenLayers.Control.DrawFeature(i3GEO.desenho.layergrafico,OpenLayers.Handler.Point,{displayClass:"editorOLtexto",title:"incluir texto",type:OpenLayers.Control.TYPE_TOOL,persist:true,callbacks:{done:function(feature){var texto=window.prompt("Texto",""),label=new OpenLayers.Feature.Vector(feature);label["attributes"]={opacidade:0.1,fillColor:"white",strokeWidth:i3GEO.editorOL.simbologia.strokeWidth,texto:texto,pointRadius:2,graphicName:"square",strokeColor:"black",fontColor:i3GEO.editorOL.simbologia.fontColor,fontSize:i3GEO.editorOL.simbologia.fontSize,fontFamily:"Arial",fontWeight:"bold",labelAlign:"rt"};if(texto&&texto!==""){i3GEO.desenho.layergrafico.addFeatures([label])}if(i3GEO.Interface&&i3GEO.Interface.openlayers&&i3GEO.Interface.openlayers.sobeLayersGraficos){i3GEO.Interface.openlayers.sobeLayersGraficos()}}}});controles.push(button);adiciona=true}if(botoes.edita===true&&botoes.corta===true&&i3GEO.php){i3GEO.editorOL.CortaFeature=new OpenLayers.Control.DrawFeature(i3GEO.desenho.layergrafico,OpenLayers.Handler.Polygon,{displayClass:"editorOLcorta",title:"corta figura",type:OpenLayers.Control.TYPE_TOOL,clickout:true,toggle:true,trigger:function(){if(i3GEO.desenho.layergrafico.selectedFeatures.length!=1){alert("Selecione primeiro um elemento para ser cortado");i3GEO.editorOL.CortaFeature.deactivate()}else{i3GEO.editorOL.CortaFeature.activate()}},callbacks:{done:function(feature){var temp,sel=i3GEO.desenho.layergrafico.selectedFeatures[0].geometry,corta=feature;temp=function(retorno){i3GEO.janela.fechaAguarde("i3GEO.cortador");if(retorno!=""&&retorno.data&&retorno.data!=""){i3GEO.editorOL.substituiFeaturesSel(retorno.data)}};i3GEO.janela.abreAguarde("i3GEO.cortador","Cortando");i3GEO.php.funcoesGeometriasWkt(temp,sel+"|"+corta,"difference")}}});controles.push(i3GEO.editorOL.CortaFeature);adiciona=true}if(botoes.edita===true){i3GEO.editorOL.ModifyFeature=new OpenLayers.Control.ModifyFeature(i3GEO.desenho.layergrafico,{displayClass:"editorOLedita",title:"modifica figura",type:OpenLayers.Control.TYPE_TOOL,clickout:true,toggle:true,mode:OpenLayers.Control.ModifyFeature.RESHAPE,standalone:false,createVertices:true,styleMap:"default",vertexRenderIntent:"vertex"});controles.push(i3GEO.editorOL.ModifyFeature);adiciona=true}if(botoes.edita===true&&botoes.listag===true){button=new OpenLayers.Control.Button({displayClass:"editorOLlistag",trigger:function(){i3GEO.editorOL.listaGeometrias()},title:"lista geometrias",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.frente===true){button=new OpenLayers.Control.Button({displayClass:"editorOLfrente",trigger:function(){i3GEO.editorOL.trazParaFrente();if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}},title:"traz para frente",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.tools===true&&i3GEO.php){button=new OpenLayers.Control.Button({displayClass:"editorOLtools",trigger:function(){if(i3GEO.php){i3GEO.editorOL.ferramentas()}else{i3GEO.editorOL.carregajts("i3GEO.editorOL.ferramentas()")}},title:"ferramentas",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.selecao===true){i3GEO.editorOL.selbutton=new OpenLayers.Control.SelectFeature(i3GEO.desenho.layergrafico,{displayClass:"editorOLselecao",title:"seleciona elemento",type:OpenLayers.Control.TYPE_TOOL,clickout:true,toggle:true,multiple:false,hover:false,toggleKey:"ctrlKey",multipleKey:"shiftKey",box:false});controles.push(i3GEO.editorOL.selbutton);adiciona=true}if(botoes.apaga===true){button=new OpenLayers.Control.Button({displayClass:"editorOLapaga",trigger:function(){if(i3GEO.desenho.layergrafico.selectedFeatures.length>0){var x=window.confirm("Exclui os elementos selecionados?");if(x){i3GEO.editorOL.guardaBackup();i3GEO.desenho.layergrafico.removeFeatures(i3GEO.desenho.layergrafico.selectedFeatures);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}}}else{alert("Selecione pelo menos um elemento")}},title:"apaga selecionados",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.propriedades===true){button=new OpenLayers.Control.Button({displayClass:"editorOLpropriedades",trigger:function(){i3GEO.editorOL.propriedades()},title:"propriedades",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.salva===true){button=new OpenLayers.Control.Button({displayClass:"editorOLsalva",trigger:function(){i3GEO.editorOL.salvaGeometrias()},title:"salva",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.ajuda===true){button=new OpenLayers.Control.Button({displayClass:"editorOLajuda",trigger:function(){try{window.open(i3GEO.configura.locaplic+"/mashups/openlayers_ajuda.php")}catch(e){window.open("openlayers_ajuda.php")}},title:"ajuda",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.fecha===true){button=new OpenLayers.Control.Button({displayClass:"editorOLfecha",trigger:function(){var temp=window.confirm("Remove a edicao?");if(i3GEO.eventos){i3GEO.eventos.cliquePerm.ativa()}i3GEOpanelEditor.destroy();try{YAHOO.temaativo.container.panel.destroy()}catch(e){}try{YAHOO.procura.container.panel.destroy()}catch(e){}try{YAHOO.editorOL.container.panel.destroy()}catch(e){}try{YAHOO.editorOL.listaGeometrias.panel.destroy()}catch(e){}try{YAHOO.editorOL.ferramentas.panel.destroy()}catch(e){}try{YAHOO.legendaeditorOL.container.panel.destroy()}catch(e){}try{YAHOO.salvaGeometrias.container.panel.destroy()}catch(e){}if(temp===true){try{if(i3GEO.desenho.layergrafico){i3GEO.editorOL.mapa.removeLayer(i3GEO.desenho.layergrafico);delete(i3GEO.desenho.layergrafico)}if(i3GEO.editorOL.backup){i3GEO.editorOL.mapa.removeLayer(i3GEO.editorOL.backup);delete(i3GEO.editorOL.backup)}}catch(e){}}},title:"fecha editor",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}i3GEOOLsnap=new OpenLayers.Control.Snapping({layer:i3GEO.desenho.layergrafico});i3GEOOLsplit=new OpenLayers.Control.Split({layer:i3GEO.desenho.layergrafico,source:i3GEO.desenho.layergrafico,tolerance:0.0001,eventListeners:{beforesplit:function(event){i3GEO.editorOL.guardaBackup()},aftersplit:function(event){i3GEO.editorOL.flashFeatures(event.features);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}}}});if(adiciona===true){i3GEOpanelEditor.addControls(controles);i3GEO.editorOL.mapa.addControl(i3GEOpanelEditor)}},mudaSimbolo:function(estilo,id){var valor=$i(id).value,geos=i3GEO.desenho.layergrafico.selectedFeatures,n=geos.length,i;i3GEO.editorOL.simbologia[estilo]=valor;for(i=0;i<n;i++){geos[i].attributes[estilo]=valor;geos[i].style[estilo]=valor}},adicionaMarcas:function(){if(i3GEO.editorOL.pontos.length===0){return}var SHADOW_Z_INDEX=10,MARKER_Z_INDEX=11,layer=new OpenLayers.Layer.Vector("pontos",{styleMap:new OpenLayers.StyleMap({externalGraphic:i3GEO.editorOL.marca,backgroundGraphic:"../pacotes/openlayers/img/marker_shadow.png",backgroundXOffset:0,backgroundYOffset:-7,graphicZIndex:MARKER_Z_INDEX,backgroundGraphicZIndex:SHADOW_Z_INDEX,pointRadius:10}),isBaseLayer:false,rendererOptions:{yOrdering:true},displayInLayerSwitcher:true,visibility:true}),index,x=[],y=[],features=[];for(index=0;index<i3GEO.editorOL.pontos.length;index=index+2){x.push(i3GEO.editorOL.pontos[index]);y.push(i3GEO.editorOL.pontos[index+1])}for(index=0;index<x.length;index++){features.push(new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(x[index],y[index])))}layer.addFeatures(features);i3GEO.editorOL.mapa.addLayer(layer)},adicionaKml:function(){var temp,n,i,id,url;n=i3GEO.editorOL.kml.length;for(i=0;i<n;i++){id="kml"+i;url=i3GEO.editorOL.kml[i];eval(id+" = new OpenLayers.Layer.Vector('"+id+"', {displayOutsideMaxExtent:true,displayInLayerSwitcher:false,visibility:true, strategies: [new OpenLayers.Strategy.Fixed()],protocol: new OpenLayers.Protocol.HTTP({url: '"+url+"',format: new OpenLayers.Format.KML({extractStyles: true,extractAttributes: true,maxDepth: 5})})})");eval("i3GEO.editorOL.mapa.addLayer("+id+");");eval("temp = "+id+".div;");temp.onclick=function(e){var targ="",id,temp,features,n,i,g,html="";if(!e){e=window.event}if(e.target){targ=e.target}else{if(e.srcElement){targ=e.srcElement}}if(targ.id){temp=targ.id.split("_");if(temp[0]==="OpenLayers.Geometry.Point"){id=targ.id;temp=i3GEO.editorOL.mapa.getLayer(this.id);features=temp.features;n=features.length;for(i=0;i<n;i++){if(features[i].geometry.id===id){for(var j in features[i].attributes){html+=j+": "+features[i].attributes[j]}g=features[i].geometry;i3GEO.editorOL.mapa.addPopup(new OpenLayers.Popup.FramedCloud("kml",new OpenLayers.LonLat(g.x,g.y),null,html,null,true))}}}}}}},propriedades:function(){if(!document.getElementById("panelpropriedadesEditor")){YAHOO.namespace("editorOL.container");YAHOO.editorOL.container.panel=new YAHOO.widget.Panel("panelpropriedadesEditor",{zIndex:20000,iframe:true,width:"350px",height:"250px",visible:false,draggable:true,close:true});var ins=""+'<p class=paragrafo ><b>Estilos (utilize a cor no formato r,g,b):</b></p>'+'<table class=lista7 >'+' <tr>'+' <td>Cor do contorno</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'strokeColor\',\'i3GEOEditorOLcorContorno\')" type="text" style="cursor:text" id="i3GEOEditorOLcorContorno" size="12" value="'+i3GEO.editorOL.simbologia.strokeColor+'" /></td><td>';if(i3GEO.configura){ins+='<img alt="aquarela.gif" style=cursor:pointer src="'+i3GEO.configura.locaplic+'/imagens/aquarela.gif" onclick="i3GEO.util.abreCor(\'\',\'i3GEOEditorOLcorContorno\');" />'}ins+=""+' </td>'+' </tr>'+' <tr>'+' <td>Cor do preenchimento</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'fillColor\',\'i3GEOEditorOLcorPre\')" type="text" style="cursor:text" id="i3GEOEditorOLcorPre" size="12" value="'+i3GEO.editorOL.simbologia.fillColor+'" /></td><td>';if(i3GEO.configura){ins+='<img alt="aquarela.gif" style=cursor:pointer src="'+i3GEO.configura.locaplic+'/imagens/aquarela.gif" onclick="i3GEO.util.abreCor(\'\',\'i3GEOEditorOLcorPre\');" />'}ins+=""+' </td>'+' </tr>'+' <tr>'+' <td>Cor da fonte</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'fontColor\',\'i3GEOEditorOLcorFonte\')" type="text" style="cursor:text" id="i3GEOEditorOLcorFonte" size="12" value="'+i3GEO.editorOL.simbologia.fontColor+'" /></td><td>';if(i3GEO.configura){ins+='<img alt="aquarela.gif" style=cursor:pointer src="'+i3GEO.configura.locaplic+'/imagens/aquarela.gif" onclick="i3GEO.util.abreCor(\'\',\'i3GEOEditorOLcorFonte\');" />'}ins+=""+' </td>'+' </tr>'+' <tr>'+' <td>Tamanho da fonte</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'fontSize\',\'i3GEOEditorOLfontsize\')" type="text" style="cursor:text" id="i3GEOEditorOLfontsize" size="3" value="'+i3GEO.editorOL.simbologia.fontSize+'" /></td><td></td>'+' </tr>'+' <tr>'+' <td>Opacidade (de 0 a 1)</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'opacidade\',\'i3GEOEditorOLopacidade\')" type="text" style="cursor:text" id="i3GEOEditorOLopacidade" size="3" value="'+i3GEO.editorOL.simbologia.opacidade+'" /></td><td></td>'+' </tr>'+' <tr>'+' <td>Largura da linha/contorno</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'strokeWidth\',\'i3GEOEditorOLlarguraLinha\')" type="text" style="cursor:text" id="i3GEOEditorOLlarguraLinha" size="2" value="'+i3GEO.editorOL.simbologia.strokeWidth+'" /></td><td></td>'+' </tr>'+' <tr>'+' <td>Url de uma figura</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'externalGraphic\',\'i3GEOEditorOLexternalGraphic\')" type="text" style="cursor:text" id="i3GEOEditorOLexternalGraphic" size="22" value="'+i3GEO.editorOL.simbologia.externalGraphic+'" /></td><td></td>'+' </tr>'+' <tr>'+' <td>Largura e altura</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'graphicWidth\',\'i3GEOEditorOLgraphicWidth\')" type="text" style="cursor:text" id="i3GEOEditorOLgraphicWidth" size="4" value="'+i3GEO.editorOL.simbologia.graphicWidth+'" /> <input onchange="i3GEO.editorOL.mudaSimbolo(\'graphicHeight\',\'i3GEOEditorOLgraphicHeight\')" type="text" style="cursor:text" id="i3GEOEditorOLgraphicHeight" size="4" value="'+i3GEO.editorOL.simbologia.graphicHeight+'" /></td><td></td>'+' </tr>'+'</table>'+'<br />'+'<p class=paragrafo ><b>Ajusta nó em edição para o(a):</b></p>'+'<table class=lista7 >'+' <tr>'+' <td></td><td>nó</td><td></td><td>vértice</td><td></td><td>borda</td>'+' </tr>'+' <tr>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.snap()" type="checkbox" id="target_node" /></td><td><input onchange="i3GEO.editorOL.snap()" id="target_nodeTolerance" type="text" size="3" value=15 /></td>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.snap()" type="checkbox" id="target_vertex" /></td><td><input onchange="i3GEO.editorOL.snap()" id="target_vertexTolerance" type="text" size="3" value=15 /></td>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.snap()" type="checkbox" id="target_edge" /></td><td><input onchange="i3GEO.editorOL.snap()" id="target_edgeTolerance" type="text" size="3" value=15 /></td>'+' </tr>'+'</table>'+'<br />'+'<p class=paragrafo ><b>Divide intersecção ao digitalizar</b></p>'+'<table class=lista7 >'+' <tr>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.split()" type="checkbox" id="edge_split_toggle" /></td><td>borda</td>'+' </tr>'+'</table>'+'<br />'+'<p class=paragrafo ><b>Operação ativada pelo botão de modificação da figura</b></p>'+'<table class=lista7 >'+' <tr>'+' <td><input checked style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.RESHAPE;" type="radio" name=i3geoOLtipoEdita /></td><td>altera figura</td>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.RESIZE;" type="radio" name=i3geoOLtipoEdita /></td><td>altera tamanho</td>'+' </tr>'+' <tr>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.ROTATE;" type="radio" name=i3geoOLtipoEdita /></td><td>rotaciona</td>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.DRAG;" type="radio" name=i3geoOLtipoEdita /></td><td>desloca</td>'+' </tr>'+'</table>';YAHOO.editorOL.container.panel.setBody(ins);if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){YAHOO.editorOL.container.panel.setHeader("Propriedades<div id='panelpropriedadesEditor_minimizaCabecalho' class='container-minimiza'></div>")}else{YAHOO.editorOL.container.panel.setHeader("Propriedades")}YAHOO.editorOL.container.panel.setFooter("");YAHOO.editorOL.container.panel.render(document.body);YAHOO.editorOL.container.panel.center();YAHOO.util.Event.addListener(YAHOO.editorOL.container.panel.close,"click",function(){});temp=$i("panelpropriedadesEditor_minimizaCabecalho");if(temp){temp.onclick=function(){i3GEO.janela.minimiza("panelpropriedadesEditor")}}}YAHOO.editorOL.container.panel.show();temp=$i("panelpropriedadesEditor").getElementsByTagName("div");if(temp&&temp[2]){temp[2].style.overflow="auto"}},listaGeometrias:function(){if(!document.getElementById("panellistagEditor")){YAHOO.namespace("editorOL.listaGeometrias");YAHOO.editorOL.listaGeometrias.panel=new YAHOO.widget.Panel("panellistagEditor",{zIndex:20000,iframe:true,width:"320px",visible:false,draggable:true,close:true});if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){YAHOO.editorOL.listaGeometrias.panel.setHeader("Geometrias <div id='panellistagEditor_minimizaCabecalho' class='container-minimiza'></div>")}else{YAHOO.editorOL.listaGeometrias.panel.setHeader("Geometrias")}YAHOO.editorOL.listaGeometrias.panel.setFooter("");YAHOO.editorOL.listaGeometrias.panel.render(document.body);YAHOO.editorOL.listaGeometrias.panel.center();YAHOO.util.Event.addListener(YAHOO.editorOL.listaGeometrias.panel.close,"click",function(){YAHOO.editorOL.listaGeometrias.panel.destroy()});temp=$i("panellistagEditor_minimizaCabecalho");if(temp){temp.onclick=function(){i3GEO.janela.minimiza("panellistagEditor")}}}else{YAHOO.editorOL.listaGeometrias.panel.render(document.body)}var g,temp,geos=i3GEO.desenho.layergrafico.features,n=geos.length,ins="<table class=lista4 >";ins+="<tr><td><i>Geometrias</i></td><td><i>Opções</i></td><td></td><td></td></tr>";while(n>0){n-=1;g=geos[n].geometry;ins+="<tr><td>"+g.CLASS_NAME+"</td><td style='cursor:pointer;color:blue' onclick='javascript:i3GEO.editorOL.selFeature("+n+")'>seleciona</td><td style='cursor:pointer;color:blue' onclick='javascript:i3GEO.editorOL.unselFeature("+n+")'>limpa</td><td style='cursor:pointer;color:blue' onclick='javascript:i3GEO.editorOL.flashFeaturesI("+n+")'>brilha</td></tr>"}ins+="</table>";if(geos.length===0){ins="Nenhum elemento gráfico encontrado. Utilize as opções de criação de geometrias."}YAHOO.editorOL.listaGeometrias.panel.show();if(i3GEO.configura){temp=$i("panellistagEditor").getElementsByTagName("div")[2]}else{temp=$i("panellistagEditor").getElementsByTagName("div")[1]}temp.style.overflow="auto";temp.style.height="100px";temp.innerHTML=ins},ferramentas:function(){if(!document.getElementById("panelferramentasEditor")){YAHOO.namespace("editorOL.ferramentas");YAHOO.editorOL.ferramentas.panel=new YAHOO.widget.Panel("panelferramentasEditor",{zIndex:20000,iframe:true,width:"300px",visible:false,draggable:true,close:true});var ins=""+'<p class=paragrafo >Operações sobre as figuras selecionadas:</p>'+'<select onchange="i3GEO.editorOL.processageo(this.value);this.value = \'\'" >'+' <option value="">---</option>'+' <option value=union >União</option>';if(i3GEO.php){ins+=' <option value=intersection >Intersecção</option>'+' <option value=convexhull >Convex hull</option>'+' <option value=boundary >Bordas</option>'+' <option value=difference >Diferença</option>'+' <option value=symdifference >Diferença simétrica</option>'}ins+='</select>'+'<br><br><a class=paragrafo href=# onclick="i3GEO.desenho.layergrafico.destroyFeatures()" >Apaga tudo</a>';YAHOO.editorOL.ferramentas.panel.setBody(ins);if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){YAHOO.editorOL.ferramentas.panel.setHeader("Ferramentas <div id='panelferramentasEditor_minimizaCabecalho' class='container-minimiza'></div>")}else{YAHOO.editorOL.ferramentas.panel.setHeader("Ferramentas")}YAHOO.editorOL.ferramentas.panel.setFooter("");YAHOO.editorOL.ferramentas.panel.render(document.body);YAHOO.editorOL.ferramentas.panel.center();YAHOO.util.Event.addListener(YAHOO.editorOL.ferramentas.panel.close,"click",function(){});temp=$i("panelferramentasEditor_minimizaCabecalho");if(temp){temp.onclick=function(){i3GEO.janela.minimiza("panelferramentasEditor")}}}else{YAHOO.editorOL.ferramentas.panel.render(document.body)}YAHOO.editorOL.ferramentas.panel.show()},snap:function(){var target=i3GEOOLsnap.targets[0],tipos=["node","vertex","edge"],ntipos=tipos.length,i,temp,ativa=false;i3GEOOLsnap.deactivate();for(i=0;i<ntipos;i++){temp=$i("target_"+tipos[i]);target[tipos[i]]=temp.checked;if(temp.checked===true){ativa=true}temp=$i("target_"+tipos[i]+"Tolerance");target[tipos[i]+"Tolerance"]=temp.value}if(ativa===true){i3GEOOLsnap.activate()}},split:function(){i3GEOOLsplit.deactivate();var temp=$i("edge_split_toggle");if(temp.checked===true){i3GEOOLsplit.activate()}},processageo:function(operacao){if(operacao===""){return}var geosel=i3GEO.desenho.layergrafico.selectedFeatures,polis,linhas,pontos,temp;if(geosel.length>0){polis=i3GEO.editorOL.retornaGeometriasTipo(geosel,"OpenLayers.Geometry.Polygon");linhas=i3GEO.editorOL.retornaGeometriasTipo(geosel,"OpenLayers.Geometry.LineString");pontos=i3GEO.editorOL.retornaGeometriasTipo(geosel,"OpenLayers.Geometry.Point");temp=function(retorno){if(i3GEO.janela){i3GEO.janela.fechaAguarde("i3GEO.editorPoli");i3GEO.janela.fechaAguarde("i3GEO.editorLinhas");i3GEO.janela.fechaAguarde("i3GEO.editorPontos")}if(retorno!=""&&retorno.data&&retorno.data!=""&&operacao!="converteSHP"){i3GEO.editorOL.substituiFeaturesSel(retorno.data)}if(operacao==="converteSHP"){i3GEO.atualiza();i3GEO.janela.minimiza("paneltemaativo")}};if(operacao==="union"&&!i3GEO.php){if(polis.length>0){temp=i3GEO.editorOL.uniaojts(polis);i3GEO.editorOL.substituiFeaturesSel(temp)}if(linhas.length>0){temp=i3GEO.editorOL.uniaojts(linhas);i3GEO.editorOL.substituiFeaturesSel(temp)}if(pontos.length>0){temp=i3GEO.editorOL.uniaojts(p);i3GEO.editorOL.substituiFeaturesSel(temp)}}else{if(polis.length>0){i3GEO.janela.abreAguarde("i3GEO.editorPoli","Poligonos");i3GEO.php.funcoesGeometriasWkt(temp,polis.join("|"),operacao)}if(linhas.length>0){i3GEO.janela.abreAguarde("i3GEO.editorLinhas","Linhas");i3GEO.php.funcoesGeometriasWkt(temp,linhas.join("|"),operacao)}if(pontos.length>0){i3GEO.janela.abreAguarde("i3GEO.editorPontos","Pontos");i3GEO.php.funcoesGeometriasWkt(temp,pontos.join("|"),operacao)}}return}else{alert("Selecione pelo menos dois elementos")}},uniaojts:function(geoms){var n=geoms.length,rwkt=new jsts.io.WKTReader(),wwkt=new jsts.io.WKTWriter(),fwkt=new OpenLayers.Format.WKT(),g,i,uniao;if(n>1){uniao=(fwkt.read(geoms[0]).geometry).toString();uniao=rwkt.read(uniao);for(i=1;i<=n;i++){g=(fwkt.read(geoms[i]).geometry).toString();uniao=uniao.union(rwkt.read(g))}uniao=wwkt.write(uniao);return[fwkt.read(uniao)]}else{return false}},retornaGeometriasTipo:function(features,tipo){var n=features.length,lista=[],i,temp;for(i=0;i<n;i++){temp=features[i].geometry;if(temp.CLASS_NAME==tipo){lista.push(temp)}}return lista},guardaBackup:function(){return;if(!i3GEO.editorOL.backup){i3GEO.editorOL.backup=new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false})}else{i3GEO.editorOL.backup.removeFeatures(i3GEO.editorOL.backup.features)}i3GEO.editorOL.backup.addFeatures(i3GEO.desenho.layergrafico.features)},unselTodos:function(){var n,i;n=i3GEO.desenho.layergrafico.features.length;for(i=0;i<n;i++){i3GEO.desenho.layergrafico.features[i].renderIntent="default";i3GEO.editorOL.selbutton.unselect(i3GEO.desenho.layergrafico.features[i])}},unselTodosBackup:function(){var n,i;n=i3GEO.editorOL.backup.features.length;for(i=0;i<n;i++){i3GEO.editorOL.backup.features[i].renderIntent="default";i3GEO.editorOL.selbutton.unselect(i3GEO.editorOL.backup.features[i])}},restauraBackup:function(){if(i3GEO.editorOL.backup.features.length>0){i3GEO.desenho.layergrafico.removeFeatures(i3GEO.desenho.layergrafico.features);i3GEO.desenho.layergrafico.addFeatures(i3GEO.editorOL.backup.features)}if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}},substituiFeaturesSel:function(wkt){i3GEO.editorOL.guardaBackup();try{var f,fwkt=new OpenLayers.Format.WKT();i3GEO.desenho.layergrafico.removeFeatures(i3GEO.desenho.layergrafico.selectedFeatures);f=fwkt.read(wkt);f["attributes"]={opacidade:i3GEO.editorOL.simbologia.opacidade,texto:i3GEO.editorOL.simbologia.texto,fillColor:i3GEO.editorOL.simbologia.fillColor,strokeWidth:i3GEO.editorOL.simbologia.strokeWidth,strokeColor:i3GEO.editorOL.simbologia.strokeColor,pointRadius:i3GEO.editorOL.simbologia.pointRadius,graphicName:i3GEO.editorOL.simbologia.graphicName};i3GEO.desenho.layergrafico.addFeatures([f]);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}}catch(e){i3GEO.editorOL.restauraBackup()}},adicionaFeatureWkt:function(wkt,atributos){var f,fwkt=new OpenLayers.Format.WKT();if(atributos.externalGraphic&&atributos.externalGraphic!=""){var style_mark=OpenLayers.Util.extend({},OpenLayers.Feature.Vector.style['default']);style_mark.externalGraphic=atributos.externalGraphic;style_mark.graphicWidth=atributos.graphicWidth;style_mark.graphicHeight=atributos.graphicHeight;style_mark.fillOpacity=atributos.opacidade;f=fwkt.read(wkt);f["attributes"]=atributos;f["style"]=style_mark}else{f=fwkt.read(wkt);f["attributes"]=atributos}i3GEO.desenho.layergrafico.addFeatures([f]);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}},flashFeaturesI:function(index){i3GEO.editorOL.flashFeatures([i3GEO.desenho.layergrafico.features[index]],0)},flashFeatures:function(features,index){if(!index){index=0}var current=features[index];if(current&¤t.layer===i3GEO.desenho.layergrafico){i3GEO.desenho.layergrafico.drawFeature(features[index],"select")}var prev=features[index-1];if(prev&&prev.layer===i3GEO.desenho.layergrafico){i3GEO.desenho.layergrafico.drawFeature(prev,"default")}++index;if(index<=features.length){window.setTimeout(function(){i3GEO.editorOL.flashFeatures(features,index)},75)}},selFeature:function(index){i3GEO.editorOL.selbutton.select(i3GEO.desenho.layergrafico.features[index])},unselFeature:function(index){i3GEO.editorOL.selbutton.unselect(i3GEO.desenho.layergrafico.features[index])},carregajts:function(funcao){if(i3GEO.configura){i3GEO.util.scriptTag(i3GEO.configura.locaplic+"/pacotes/jsts/lib/jsts.js",funcao,"i3GEOjts",true)}else{i3GEO.util.scriptTag("../pacotes/jsts/lib/jsts.js",funcao,"i3GEOjts",true)}},trazParaFrente:function(){var features=i3GEO.desenho.layergrafico.selectedFeatures;if(features.length>0){i3GEO.editorOL.backup=new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false});i3GEO.editorOL.backup.addFeatures(features);i3GEO.editorOL.unselTodosBackup();i3GEO.desenho.layergrafico.removeFeatures(features);i3GEO.desenho.layergrafico.addFeatures(i3GEO.editorOL.backup.features);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}}else{alert("Selecione pelo menos um elemento")}},pegaControle:function(classe){var n=i3GEO.editorOL.controles.length,i;for(i=0;i<n;i++){if(i3GEO.editorOL.controles[i].CLASS_NAME===classe){return i3GEO.editorOL.controles[i]}}return false},ativaLayerSwitcher:function(){var ls=i3GEO.editorOL.pegaControle("OpenLayers.Control.LayerSwitcher");if(ls){ls.maximizeDiv.click()}},desativaRodaDoMouse:function(){var controls=i3GEO.editorOL.mapa.getControlsByClass('OpenLayers.Control.Navigation');for(var i=0;i<controls.length;++i){controls[i].disableZoomWheel()}},google2wgs:function(obj){if(i3GEO.Interface.openlayers.googleLike===true){var projWGS84=new OpenLayers.Projection("EPSG:4326"),proj900913=new OpenLayers.Projection("EPSG:900913");return obj.transform(proj900913,projWGS84)}else{return obj}}}; | |
3 | 3 | \ No newline at end of file | ... | ... |
classesjs/compactajs.php
... | ... | @@ -252,6 +252,7 @@ $jsfiles = array( |
252 | 252 | "../classesjs/compactados/classe_util_compacto.js", |
253 | 253 | "../pacotes/openlayers/OpenLayers2131.js", |
254 | 254 | "../classesjs/compactados/classe_desenho_compacto.js", |
255 | +"../classesjs/compactados/classe_janela_compacto.js", | |
255 | 256 | "../classesjs/compactados/classe_editorol_compacto.js" |
256 | 257 | ); |
257 | 258 | $buffer = ""; | ... | ... |
mashups/openlayers_compacto.js
... | ... | @@ -1479,4 +1479,5 @@ c);b.matrixIds.push(c)},ScaleDenominator:function(a,b){b.scaleDenominator=parseF |
1479 | 1479 | MatrixWidth:function(a,b){b.matrixWidth=parseInt(this.getChildValue(a))},MatrixHeight:function(a,b){b.matrixHeight=parseInt(this.getChildValue(a))},ResourceURL:function(a,b){b.resourceUrl=b.resourceUrl||{};var c=a.getAttribute("resourceType");b.resourceUrls||(b.resourceUrls=[]);c=b.resourceUrl[c]={format:a.getAttribute("format"),template:a.getAttribute("template"),resourceType:c};b.resourceUrls.push(c)},WSDL:function(a,b){b.wsdl={};b.wsdl.href=a.getAttribute("xlink:href")},ServiceMetadataURL:function(a, |
1480 | 1480 | b){b.serviceMetadataUrl={};b.serviceMetadataUrl.href=a.getAttribute("xlink:href")},LegendURL:function(a,b){b.legend={};b.legend.href=a.getAttribute("xlink:href");b.legend.format=a.getAttribute("format")},Dimension:function(a,b){var c={values:[]};this.readChildNodes(a,c);b.dimensions.push(c)},Default:function(a,b){b["default"]=this.getChildValue(a)},Value:function(a,b){b.values.push(this.getChildValue(a))}},ows:OpenLayers.Format.OWSCommon.v1_1_0.prototype.readers.ows},CLASS_NAME:"OpenLayers.Format.WMTSCapabilities.v1_0_0"}); |
1481 | 1481 | if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.desenho={layergrafico:null,estilos:{"normal":{fillcolor:'#ffffff',linecolor:'#000000',linewidth:'2',circcolor:'#ffffff',textcolor:'#787A78'},"palido":{fillcolor:'#B5A8A8',linecolor:'#BAA4AE',linewidth:'1',circcolor:'#E0D7DC',textcolor:'#787A78'},"vermelho":{fillcolor:'#E8ACAC',linecolor:'#F50707',linewidth:'1',circcolor:'#F09EA6',textcolor:'#787A78'},"verde":{fillcolor:'#3CCC2F',linecolor:'#0C6642',linewidth:'1',circcolor:'#C7D9D2',textcolor:'#787A78'}},estilosOld:{"normal":{fillcolor:'red',linecolor:'black',linewidth:'1',circcolor:'white',textcolor:'gray'},"palido":{fillcolor:'gray',linecolor:'gray',linewidth:'1',circcolor:'gray',textcolor:'gray'},"vermelho":{fillcolor:'gray',linecolor:'red',linewidth:'1',circcolor:'pink',textcolor:'brown'},"verde":{fillcolor:'gray',linecolor:'green',linewidth:'1',circcolor:'DarkGreen',textcolor:'GreenYellow'}},estiloPadrao:"normal",openlayers:{inicia:function(){if(!i3GEO.desenho.layergrafico){i3GEO.desenho.openlayers.criaLayerGrafico()}},criaLayerGrafico:function(){if(!i3GEO.desenho.layergrafico){var sketchSymbolizers={"Point":{fillColor:"rgb(${fillColor})",fillOpacity:"${opacidade}",strokeWidth:"${strokeWidth}",strokeOpacity:"${opacidade}",strokeColor:"rgb(${strokeColor})",label:"${texto}",pointRadius:"${pointRadius}",graphicName:"${graphicName}",fontSize:"${fontSize}",fontColor:"rgb(${fontColor})",fontFamily:"Arial",fontWeight:"normal",labelAlign:"lb",labelXOffset:"3",labelYOffset:"3",externalGraphic:"${externalGraphic}"},"Line":{strokeWidth:"${strokeWidth}",strokeOpacity:"${opacidade}",strokeColor:"rgb(${strokeColor})"},"Polygon":{strokeWidth:"${strokeWidth}",strokeOpacity:"${opacidade}",strokeColor:"rgb(${strokeColor})",fillColor:"rgb(${fillColor})",fillOpacity:"${opacidade}",zIndex:5000}},style=new OpenLayers.Style(),styleMap1=new OpenLayers.StyleMap({"default":style,"vertex":{strokeOpacity:1,strokeWidth:1,fillColor:"white",fillOpacity:0.45,pointRadius:4}},{extendDefault:false});style.addRules([new OpenLayers.Rule({symbolizer:sketchSymbolizers})]);i3GEO.desenho.layergrafico=new OpenLayers.Layer.Vector("Graf",{styleMap:styleMap1,displayInLayerSwitcher:true,visibility:true,vertexRenderIntent:"vertex"});if(i3GEO.editorOL&&i3GEO.editorOL.mapa){i3GEO.editorOL.mapa.addLayers([i3GEO.desenho.layergrafico])}else{i3geoOL.addLayers([i3GEO.desenho.layergrafico])}}}},googlemaps:{shapes:[],inicia:function(){},getFeaturesByAttribute:function(atributo,valor){var i,s=[],n=i3GEO.desenho.googlemaps.shapes.length;for(i=0;i<n;i++){if(i3GEO.desenho.googlemaps.shapes[i]&&i3GEO.desenho.googlemaps.shapes[i]!=""){if(i3GEO.desenho.googlemaps.shapes[i][atributo]==valor){s.push(i3GEO.desenho.googlemaps.shapes[i])}}}return s},destroyFeatures:function(f){if(f){var i,n=f.length;for(i=0;i<n;i++){f[i].setMap(null);f[i]=""}}}},googleearth:{insereMarca:function(description,ddx,ddy,name,snippet){var placemark=i3GeoMap.createPlacemark(''),point=i3GeoMap.createPoint('');placemark.setName(name);point.setLatitude(ddy);point.setLongitude(ddx);placemark.setGeometry(point);if(description!==""){placemark.setDescription(description)}placemark.setSnippet(snippet);i3GeoMap.getFeatures().appendChild(placemark)},insereCirculo:function(centerLng,centerLat,radius,name,snippet){function makeCircle(centerLat,centerLng,radius){var ring=i3GeoMap.createLinearRing(''),steps=25,i,pi2=Math.PI*2,lat,lng;for(i=0;i<steps;i++){lat=centerLat+radius*Math.cos(i/steps*pi2);lng=centerLng+radius*Math.sin(i/steps*pi2);ring.getCoordinates().pushLatLngAlt(lat,lng,0)}return ring}var polygonPlacemark=i3GeoMap.createPlacemark(''),poly=i3GeoMap.createPolygon(''),polyStyle;poly.setAltitudeMode(i3GeoMap.ALTITUDE_RELATIVE_TO_GROUND);polygonPlacemark.setGeometry(poly);polygonPlacemark.getGeometry().setOuterBoundary(makeCircle(centerLat,centerLng,radius));polygonPlacemark.setName(name);polygonPlacemark.setSnippet(snippet);polygonPlacemark.setStyleSelector(i3GeoMap.createStyle(''));polyStyle=polygonPlacemark.getStyleSelector().getPolyStyle();polyStyle.setFill(0);i3GeoMap.getFeatures().appendChild(polygonPlacemark)},insereLinha:function(xi,yi,xf,yf,name,snippet){var lineStringPlacemark=i3GeoMap.createPlacemark(''),lineString,lineStyle;lineStringPlacemark.setName(name);lineString=i3GeoMap.createLineString('');lineString.setAltitudeMode(i3GeoMap.ALTITUDE_RELATIVE_TO_GROUND);lineStringPlacemark.setGeometry(lineString);lineString.getCoordinates().pushLatLngAlt(yi,xi,0);lineString.getCoordinates().pushLatLngAlt(yf,xf,0);lineStringPlacemark.setStyleSelector(i3GeoMap.createStyle(''));lineStringPlacemark.setSnippet(snippet);lineStyle=lineStringPlacemark.getStyleSelector().getLineStyle();lineStyle.setWidth(3);i3GeoMap.getFeatures().appendChild(lineStringPlacemark)},removePlacemark:function(nome){var features=i3GeoMap.getFeatures(),n=features.getChildNodes().getLength(),i,nfeatures=[];for(i=0;i<n;i++){try{if(features.getChildNodes().item(i).getName()===nome||features.getChildNodes().item(i).getDescription()===nome||features.getChildNodes().item(i).getSnippet()===nome){nfeatures.push(features.getChildNodes().item(i))}}catch(e){}}n=nfeatures.length;for(i=0;i<n;i++){features.removeChild(nfeatures[i])}}},caixaEstilos:function(){var lista=i3GEO.util.listaChaves(i3GEO.desenho.estilos),n=lista.length,i,caixa,sel;caixa="<select onchange='i3GEO.desenho.definePadrao(this.value)'>";for(i=0;i<n;i+=1){sel="";if(lista[i]===i3GEO.desenho.estiloPadrao){sel="select"}caixa+="<option value='"+lista[i]+"'"+sel+">"+lista[i]+"</option>"}caixa+="</select>";return caixa}}; |
1482 | -if(!i3GEO||typeof(i3GEO)==='undefined'){var i3GEO={};navn=false;navm=false;$i=function(id){return document.getElementById(id)};app=navigator.appName.substring(0,1);if(app==='N'){navn=true}else{navm=true}OpenLayers.ImgPath="../pacotes/openlayers/img/";OpenLayers.Lang.setCode("pt-BR")}i3GEO.editorOL={simbologia:{opacidade:0.8,texto:"",fillColor:"250,180,15",strokeWidth:2,strokeColor:"250,150,0",pointRadius:4,graphicName:"square",fontSize:"12px",fontColor:"0,0,0",externalGraphic:"",graphicHeight:25,graphicWidth:25},backup:new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false}),nomeFuncaoSalvar:"i3GEO.editorOL.salvaGeo()",e_oce:new OpenLayers.Layer.ArcGIS93Rest("ESRI Ocean Basemap","http://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer/export",{format:"jpeg"},{isBaseLayer:true,visibility:false}),e_ims:new OpenLayers.Layer.ArcGIS93Rest("ESRI Imagery World 2D","http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer/export",{format:"jpeg"},{isBaseLayer:true,visibility:false}),e_wsm:new OpenLayers.Layer.ArcGIS93Rest("ESRI World Street Map","http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer/export",{format:"jpeg"},{isBaseLayer:true,visibility:false}),ol_mma:new OpenLayers.Layer.WMS("Base cartográfica","http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseraster.map&",{layers:'baseraster',SRS:'EPSG:4618',FORMAT:'image/png'},{singleTile:false}),ol_wms:new OpenLayers.Layer.WMS("OpenLayers WMS","http://labs.metacarta.com/wms/vmap0",{layers:'basic'}),top_wms:new OpenLayers.Layer.WMS("Toponímia MMA","http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseref.map&",{layers:"base",FORMAT:'image/png'}),est_wms:new OpenLayers.Layer.WMS("Estados do Brasil","http://mapas.mma.gov.br/i3geo/ogc.php?tema=estadosl&",{layers:"estadosl",FORMAT:'image/png'}),osm:new OpenLayers.Layer.OSM("OSM","http://tile.openstreetmap.org/${z}/${x}/${y}.png",{isBaseLayer:true,visibility:false}),fundo:"e_ims,e_wsm,ol_mma,ol_wms,top_wms,est_wms,e_oce",kml:[],layersIniciais:[],botoes:{'pan':true,'zoombox':true,'zoomtot':true,'zoomin':true,'zoomout':true,'legenda':true,'distancia':true,'area':true,'identifica':true,'linha':true,'ponto':true,'poligono':true,'texto':true,'edita':true,'listag':true,'corta':true,'apaga':true,'procura':true,'selecao':true,'salva':true,'ajuda':true,'propriedades':true,'fecha':false,'tools':true,'undo':false,'frente':false,'legenda':true,'rodadomouse':true},pontos:[],marca:"../pacotes/openlayers/img/marker-gold.png",controles:[new OpenLayers.Control.Navigation(),new OpenLayers.Control.PanZoomBar(),new OpenLayers.Control.LayerSwitcher({'ascending':false}),new OpenLayers.Control.ScaleLine(),new OpenLayers.Control.MousePosition({'separator':' '}),new OpenLayers.Control.OverviewMap(),new OpenLayers.Control.KeyboardDefaults()],tiles:true,incluilayergrafico:true,ativalayerswitcher:false,ativarodadomouse:true,legendahtml:false,numzoom:12,minresolution:0.703125,maxext:"",mapext:new OpenLayers.Bounds(-76.5125927,-39.3925675209,-29.5851853,9.49014852081),mapa:"",inicia:function(){var single=false,alayers=[],fundo=(i3GEO.editorOL.fundo).split(","),nfundo=fundo.length,ncontroles=i3GEO.editorOL.controles.length,i,n;if(i3GEO.editorOL.tiles===false||i3GEO.editorOL.tiles==="false"){single=true}if(i3GEO.editorOL.ativalayerswitcher==="false"){i3GEO.editorOL.ativalayerswitcher=false}if(i3GEO.editorOL.ativalayerswitcher==="true"){i3GEO.editorOL.ativalayerswitcher=true}if(i3GEO.editorOL.ativarodadomouse==="false"){i3GEO.editorOL.ativarodadomouse=false}if(i3GEO.editorOL.ativarodadomouse==="true"){i3GEO.editorOL.ativarodadomouse=true}if(i3GEO.editorOL.legendahtml==="false"){i3GEO.editorOL.legendahtml=false}if(i3GEO.editorOL.legendahtml==="true"){i3GEO.editorOL.legendahtml=true}if(i3GEO.editorOL.incluilayergrafico==="false"){i3GEO.editorOL.incluilayergrafico=false}if(i3GEO.editorOL.incluilayergrafico==="true"){i3GEO.editorOL.incluilayergrafico=true}if(i3GEO.editorOL.incluilayergrafico===true){if(!i3GEO.desenho.layergrafico){i3GEO.editorOL.criaLayerGrafico()}}else{i3GEO.desenho.layergrafico="";i3GEO.editorOL.botoes.linha=false;i3GEO.editorOL.botoes.ponto=false;i3GEO.editorOL.botoes.poligono=false;i3GEO.editorOL.botoes.texto=false;i3GEO.editorOL.botoes.edita=false;i3GEO.editorOL.botoes.listag=false;i3GEO.editorOL.botoes.corta=false;i3GEO.editorOL.botoes.apaga=false;i3GEO.editorOL.botoes.selecao=false;i3GEO.editorOL.botoes.salva=false;i3GEO.editorOL.botoes.propriedades=false;i3GEO.editorOL.botoes.fecha=false;i3GEO.editorOL.botoes.tools=false;i3GEO.editorOL.botoes.undo=false;i3GEO.editorOL.botoes.frente=false}if(i3GEO.editorOL.mapa===""){alert("O objeto i3GEO.editorOL.mapa precisa ser criado com new OpenLayers.Map()");return}for(i=0;i<ncontroles;i++){i3GEO.editorOL.mapa.addControl(i3GEO.editorOL.controles[i])}if(i3GEO.editorOL.fundo!=""){for(i=nfundo-1;i>=0;i--){if(fundo[i]!=""){try{eval("i3GEO.editorOL."+fundo[i]+".transitionEffect = 'resize';");eval("i3GEO.editorOL."+fundo[i]+".setVisibility(false);");eval("i3GEO.editorOL."+fundo[i]+".singleTile = false;");eval("alayers.push(i3GEO.editorOL."+fundo[i]+");")}catch(e){if(alayers[0]){alayers[0].setVisibility(true)}}}}}i3GEO.editorOL.mapa.addLayers(alayers);if(i3GEO.editorOL.layersIniciais!==""){n=i3GEO.editorOL.layersIniciais.length;for(i=0;i<n;i++){i3GEO.editorOL.layersIniciais[i].singleTile=single;i3GEO.editorOL.mapa.addLayer(i3GEO.editorOL.layersIniciais[i])}}if(!i3GEO.desenho.layergrafico){i3GEO.editorOL.mapa.addLayers([i3GEO.desenho.layergrafico])}i3GEO.editorOL.adicionaKml();i3GEO.editorOL.adicionaMarcas();i3GEO.editorOL.coordenadas();i3GEO.editorOL.criaJanelaBusca();i3GEO.editorOL.criaBotoes(i3GEO.editorOL.botoes);if(i3GEO.editorOL.ativalayerswitcher===true){i3GEO.editorOL.ativaLayerSwitcher()}if(i3GEO.editorOL.ativarodadomouse===false){i3GEO.editorOL.desativaRodaDoMouse()}if(i3GEO.editorOL.numzoom!==""){i3GEO.editorOL.mapa.setOptions({numZoomLevels:i3GEO.editorOL.numzoom})}if(i3GEO.editorOL.maxext!==""){i3GEO.editorOL.mapa.setOptions({maxExtent:i3GEO.editorOL.maxext})}if(i3GEO.editorOL.mapext!=""){i3GEO.editorOL.mapa.zoomToExtent(i3GEO.editorOL.mapext)}else{i3GEO.editorOL.mapa.zoomToMaxExtent()}if(i3GEO.Interface){i3GEO.Interface.openlayers.sobeLayersGraficos()}},criaLayerGrafico:function(){i3GEO.desenho.openlayers.criaLayerGrafico()},layersLigados:function(){var layers=i3GEO.editorOL.mapa.layers,nlayers=layers.length,ins=[],i;for(i=0;i<nlayers;i++){if(layers[i].visibility===true){ins.push(layers[i])}}return ins},layersClonados:function(paramsLayers){var layers=i3GEO.editorOL.mapa.layers,nlayers=layers.length,i;for(i=0;i<nlayers;i++){if(layers[i].params&&layers[i].params.CLONETMS===paramsLayers){return(layers[i])}}return false},layertms2wms:function(tms){var layer,url;url=tms.url.replace("&cache=sim","&DESLIGACACHE=sim");url=url.replace("&Z=${z}&X=${x}&Y=${y}","");layer=new OpenLayers.Layer.WMS(tms.layername+"_clone",url,{layers:tms.name,transparent:true},{gutter:0,isBaseLayer:false,displayInLayerSwitcher:false,opacity:1,visibility:true,singleTile:true});return layer},removeClone:function(){var nome=i3GEO.editorOL.layerAtivo().layername+"_clone",busca=i3GEO.editorOL.mapa.getLayersByName(nome);if(busca.length>0){i3GEO.editorOL.mapa.removeLayer(i3GEO.editorOL.mapa.getLayersByName(camada.name)[0],false)}},coordenadas:function(){var idcoord=i3GEO.editorOL.mapa.getControlsBy("separator"," ");if(idcoord[0]){i3GEO.editorOL.mapa.events.register("mousemove",i3GEO.editorOL.mapa,function(e){var p,lonlat,d;if(navm){p=new OpenLayers.Pixel(e.x,e.y)}else{p=e.xy}lonlat=i3GEO.editorOL.mapa.getLonLatFromPixel(p);d=i3GEO.calculo.dd2dms(lonlat.lon,lonlat.lat);try{$i(idcoord[0].id).innerHTML="Long: "+d[0]+"<br>Lat: "+d[1]}catch(e){}})}},criaJanelaBusca:function(){var layers=i3GEO.editorOL.layersLigados(),nlayers=layers.length,i,ins,combo="<select id=i3GEOOLlistaTemasBusca ><option value=''>----</option>";for(i=0;i<nlayers;i++){combo+="<option value='"+i+"' >"+layers[i].name+"</option>"}combo+="</select>";ins="<div class=paragrafo >Tema:<br>"+combo;ins+="<br>Item:<br><span id=i3GEOOLcomboitens ></span>";ins+="<br>Procurar por:<br><input type=text size=20 id=i3GEOOLpalavraBusca >";ins+="<br><br><input type=button value='Procurar' id='i3GEOOLbotaoBusca' ></div>";ins+="<br>Resultado:<br><span id=i3GEOOLcomboresultado ></span>";try{YAHOO.namespace("procura.container");YAHOO.procura.container.panel=new YAHOO.widget.Panel("panelprocura",{zIndex:2000,iframe:false,width:"250px",visible:false,draggable:true,close:true});YAHOO.procura.container.panel.setHeader("Encontre no mapa");YAHOO.procura.container.panel.setBody(ins);YAHOO.procura.container.panel.setFooter("");YAHOO.procura.container.panel.render(document.body);YAHOO.procura.container.panel.center();document.getElementById("i3GEOOLbotaoBusca").onclick=function(){var layer=i3GEO.editorOL.layerAtivo(),item=document.getElementById("i3GEOOLbuscaItem").value,palavra=document.getElementById("i3GEOOLpalavraBusca").value;if(item===""||palavra===""){alert("Escolha o item e o texto de busca");return}i3GEO.editorOL.busca(layer,item,palavra,"i3GEOOLcomboresultado")};document.getElementById("i3GEOOLlistaTemasBusca").onchange=function(){i3GEO.editorOL.ativaTema(this.value);document.getElementById("i3GEOOLcomboitens").innerHTML="...";i3GEO.editorOL.listaItens(i3GEO.editorOL.layerAtivo(),"i3GEOOLcomboitens","i3GEOOLbuscaItem")}}catch(e){}},criaComboTemas:function(){var layers=i3GEO.editorOL.layersLigados(),nlayers=layers.length,i,nometema="",temp,combo="<select id=i3GEOOLlistaTemasAtivos style=width:235px; >";for(i=0;i<nlayers;i++){nometema="";if(i3GEO.arvoreDeCamadas&&i3GEO.arvoreDeCamadas.CAMADAS){temp=i3GEO.arvoreDeCamadas.pegaTema(layers[i].name,"","name");if(temp!=""){nometema=temp.tema+" - "}}combo+="<option value='"+i+"' >"+nometema+layers[i].name+"</option>"}combo+="</select>";return combo},atualizaJanelaAtivaTema:function(){var combo=i3GEO.editorOL.criaComboTemas();YAHOO.temaativo.container.panel.setBody(combo);document.getElementById("i3GEOOLlistaTemasAtivos").onchange=function(){if(botaoIdentifica){botaoIdentifica.layers=[i3GEO.editorOL.layersLigados()[this.value]]}}},criaJanelaAtivaTema:function(){var temp;if(!document.getElementById("paneltemaativo")){YAHOO.namespace("temaativo.container");YAHOO.temaativo.container.panel=new YAHOO.widget.Panel("paneltemaativo",{zIndex:20000,iframe:true,width:"250px",visible:false,draggable:true,close:true});YAHOO.temaativo.container.panel.setBody("");if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){YAHOO.temaativo.container.panel.setHeader("Tema ativo<div id='paneltemaativo_minimizaCabecalho' class='container-minimiza'></div>")}else{YAHOO.temaativo.container.panel.setHeader("Tema ativo")}YAHOO.temaativo.container.panel.setFooter("");YAHOO.temaativo.container.panel.render(document.body);YAHOO.temaativo.container.panel.show();YAHOO.temaativo.container.panel.center();i3GEO.editorOL.atualizaJanelaAtivaTema();YAHOO.util.Event.addListener(YAHOO.temaativo.container.panel.close,"click",function(){i3GEOpanelEditor.deactivate();i3GEOpanelEditor.activate();if(i3GEO.eventos&&i3GEO.eventos.ATUALIZAARVORECAMADAS.toString().search("i3GEO.editorOL.atualizaJanelaAtivaTema()")>0){i3GEO.eventos.ATUALIZAARVORECAMADAS.remove("i3GEO.editorOL.atualizaJanelaAtivaTema()")}});if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){if(i3GEO.eventos&&i3GEO.eventos.ATUALIZAARVORECAMADAS.toString().search("i3GEO.editorOL.atualizaJanelaAtivaTema()")<0){i3GEO.eventos.ATUALIZAARVORECAMADAS.push("i3GEO.editorOL.atualizaJanelaAtivaTema()")}}temp=$i("paneltemaativo_minimizaCabecalho");if(temp){temp.onclick=function(){i3GEO.janela.minimiza("paneltemaativo")}}}else{YAHOO.temaativo.container.panel.show();i3GEO.editorOL.atualizaJanelaAtivaTema()}},ativaTema:function(id){document.getElementById("i3GEOOLlistaTemasAtivos").value=id},layerAtivo:function(){var id=document.getElementById("i3GEOOLlistaTemasAtivos");if(id){id=id.value}else{id=i3GEO.temaAtivo}if(id==""){return[]}else{return i3GEO.editorOL.layersLigados()[id]}},listaItens:function(layer,idonde,idobj){if(!layer){return}if(!layer.params){return}var u=layer.url+"&request=describefeaturetype&service=wfs&version=1.0.0";u+="&typename="+layer.params.LAYERS;document.body.style.cursor="wait";document.getElementById("i3geoMapa").style.cursor="wait";OpenLayers.Request.issue({method:"GET",url:u,callback:function(retorno){document.body.style.cursor="default";document.getElementById("i3geoMapa").style.cursor="default";var fromgml=new OpenLayers.Format.WFSDescribeFeatureType({geometryName:"msGeometry"}),gml=fromgml.read(retorno.responseText),prop=gml.featureTypes[0].properties,nprop=prop.length,i,combo="<select id="+idobj+" ><option value=''>----</option>";for(i=0;i<nprop;i++){combo+="<option value="+prop[i].name+" >"+prop[i].name+"</option>"}combo+="</select>";document.getElementById(idonde).innerHTML=combo},failure:function(){document.body.style.cursor="default";document.getElementById("i3geoMapa").style.cursor="default";alert("Erro")}})},busca:function(layer,item,palavra,onde){document.body.style.cursor="wait";document.getElementById("i3geoMapa").style.cursor="wait";var u=layer.url+"&request=getfeature&service=wfs&version=1.0.0";u+="&OUTPUTFORMAT=gml2&typename="+layer.params.LAYERS;u+="&filter=<Filter><PropertyIsLike wildcard=* singleChar=. escape=! ><PropertyName>"+item+"</PropertyName><Literal>*"+palavra+"*</Literal></PropertyIsLike></Filter>";document.body.style.cursor="wait";document.getElementById("i3geoMapa").style.cursor="wait";document.getElementById(onde).innerHTML="...";OpenLayers.Request.issue({method:"GET",url:u,callback:function(retorno){document.body.style.cursor="default";document.getElementById("i3geoMapa").style.cursor="default";var fromgml=new OpenLayers.Format.GML({geometryName:"msGeometry"}),gml=fromgml.read(retorno.responseText),ngml=gml.length,i,ins="<select onchange='i3GEO.editorOL.zoomPara(this.value)'>";ins+="<option value=''>---</option>";for(i=0;i<ngml;i++){eval("var valor = gml[i].data."+item);var bounds=gml[i].geometry.getBounds();bounds=bounds.toBBOX();ins+="<option value='"+bounds+"'>"+valor+"</option>"}ins+="</select>";document.getElementById(onde).innerHTML=ins},failure:function(){document.body.style.cursor="default";document.getElementById("i3geoMapa").style.cursor="default";alert("Erro")}})},zoomPara:function(bbox){var b=new OpenLayers.Bounds.fromString(bbox);i3GEO.editorOL.mapa.zoomToExtent(b)},mostraLegenda:function(){var layers=i3GEO.editorOL.layersLigados(),nlayers=layers.length,ins="",i;for(i=0;i<nlayers;i++){try{if(layers[i].isBaseLayer===false){var url=layers[i].getFullRequestString({"request":"getlegendgraphic"});if(i3GEO.editorOL.legendahtml===true){url=url.replace("image%2Fpng","text/html");ins+=layers[i].name+"<br><div id=legendaL_"+i+" ></div><br>";eval("var f = function(retorno){document.getElementById('legendaL_"+i+"').innerHTML = retorno.responseText;};");var config={method:"GET",url:url,callback:f};OpenLayers.Request.issue(config)}else{url=url.replace("LAYERS","LAYER");ins+=layers[i].name+"<br><img src='"+url+"' /><br>"}}}catch(e){}}if(!document.getElementById("panellegendaeditorOL")){YAHOO.namespace("legendaeditorOL.container");YAHOO.legendaeditorOL.container.panel=new YAHOO.widget.Panel("panellegendaeditorOL",{zIndex:20000,iframe:true,width:"auto",visible:false,draggable:true,close:true});YAHOO.legendaeditorOL.container.panel.setBody(ins);YAHOO.legendaeditorOL.container.panel.setHeader("Legenda");YAHOO.legendaeditorOL.container.panel.setFooter("");YAHOO.legendaeditorOL.container.panel.render(document.body);YAHOO.legendaeditorOL.container.panel.show();YAHOO.legendaeditorOL.container.panel.center();YAHOO.util.Event.addListener(YAHOO.legendaeditorOL.container.panel.close,"click",function(){})}else{YAHOO.legendaeditorOL.container.panel.setBody(ins);YAHOO.legendaeditorOL.container.panel.show()}},captura:function(lonlat){var layers=[i3GEO.editorOL.layerAtivo()],xy=lonlat.split(","),u=layers[0].url+"&REQUEST=getfeature&service=wfs&version=1.0.0";u+="&OUTPUTFORMAT=gml2&typename="+layers[0].params.LAYERS;u=u.replace("&cache=sim","&DESLIGACACHE=sim");u=u.replace("&Z=${z}&X=${x}&Y=${y}","");xy[0]=xy[0]*1;xy[1]=xy[1]*1;var poligono=(xy[0]-0.1)+","+(xy[1]+0.1)+" "+(xy[0]+0.1)+","+(xy[1]+0.1)+" "+(xy[0]+0.1)+","+(xy[1]-0.1)+" "+(xy[0]-0.1)+","+(xy[1]-0.1)+" "+(xy[0]-0.1)+","+(xy[1]+0.1);u+="&filter=<Filter><Intersects><PropertyName>Geometry</PropertyName><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:posList>"+poligono+"</gml:posList></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></Intersects></Filter>";document.body.style.cursor="wait";if(document.getElementById("i3geoMapa")){document.getElementById("i3geoMapa").style.cursor="wait"}OpenLayers.Request.issue({method:"GET",url:u,callback:function(retorno){document.body.style.cursor="default";if(document.getElementById("i3geoMapa")){document.getElementById("i3geoMapa").style.cursor="default"}var i,n,f,fromgml=new OpenLayers.Format.GML({geometryName:"msGeometry"}),gml=fromgml.read(retorno.responseText);n=gml.length;for(i=0;i<n;i++){f=gml[i];f["attributes"]={opacidade:i3GEO.editorOL.simbologia.opacidade,texto:i3GEO.editorOL.simbologia.texto,fillColor:i3GEO.editorOL.simbologia.fillColor,strokeWidth:i3GEO.editorOL.simbologia.strokeWidth,strokeColor:i3GEO.editorOL.simbologia.strokeColor,pointRadius:i3GEO.editorOL.simbologia.pointRadius,graphicName:i3GEO.editorOL.simbologia.graphicName,registros:f["attributes"]}}i3GEO.desenho.layergrafico.addFeatures(gml)},failure:function(){document.body.style.cursor="default";if(document.getElementById("i3geoMapa")){document.getElementById("i3geoMapa").style.cursor="default"}alert("Erro")}})},salvaGeometrias:function(){var geos=i3GEO.desenho.layergrafico.selectedFeatures,n=geos.length,ins="";if(n>0){if($i("panelsalvageometrias")){YAHOO.salvaGeometrias.container.panel=YAHOO.i3GEO.janela.manager.find("panelsalvageometrias");YAHOO.salvaGeometrias.container.panel.show();YAHOO.salvaGeometrias.container.panel.bringToTop()}else{try{YAHOO.namespace("salvaGeometrias.container");YAHOO.salvaGeometrias.container.panel=new YAHOO.widget.Panel("panelsalvageometrias",{zIndex:2000,iframe:false,width:"250px",visible:false,draggable:true,close:true});YAHOO.salvaGeometrias.container.panel.setHeader("Geometrias");YAHOO.salvaGeometrias.container.panel.setBody("");YAHOO.salvaGeometrias.container.panel.setFooter("");YAHOO.salvaGeometrias.container.panel.render(document.body);YAHOO.salvaGeometrias.container.panel.center();if(YAHOO.i3GEO.janela){YAHOO.i3GEO.janela.manager.register(YAHOO.salvaGeometrias.container.panel)}YAHOO.salvaGeometrias.container.panel.show()}catch(e){}}ins+="<p class=paragrafo >Foram encontrada(s) "+n+" geometria(s) selecionada(s) </p>";ins+="<p class=paragrafo ><a href='#' onclick='i3GEO.editorOL.listaGeometriasSel()' >Listar</a> ";ins+="<a href='#' onclick='"+i3GEO.editorOL.nomeFuncaoSalvar+"' >Salvar</a> ";ins+="<a href='#' onclick='i3GEO.editorOL.exportarSHP()' >Exportar (shapefile)</a></p>";YAHOO.salvaGeometrias.container.panel.setBody(ins)}else{alert("Selecione pelo menos um elemento")}},exportarSHP:function(){i3GEO.editorOL.processageo("converteSHP")},listaGeometriasSel:function(){var geos=i3GEO.desenho.layergrafico.selectedFeatures,n=geos.length,ins="",i,a,w,g;for(i=0;i<n;i++){g=geos[i];ins+="<b>Geometria: "+i+"</b><br>"+i3GEO.editorOL.google2wgs(g.geometry)+"<br><br>";ins+="<b>Atributos: "+i+"</b><br>";a=g.attributes;for(key in a){if(a[key]){ins+=key+" = "+a[key]+"<br>"}}if(g.attributes.registros){ins+="<b>Registros: "+i+"</b><br>";a=g.attributes.registros;for(key in a){if(a[key]){ins+=key+" = "+a[key]+"<br>"}}}}w=window.open();w.document.write(ins);w.document.close()},testeSalvar:function(){alert("Funcao nao disponivel. Defina o nome da funcao em i3GEO.editorOL.nomeFuncaoSalvar ")},salvaGeo:function(){var geos=i3GEO.desenho.layergrafico.selectedFeatures,n=geos.length,funcaoOK=function(){if(geos[0].geometry){var registros="",valorunico="",nometema=$i("editorOLcomboTemaEditavel").value,key="",tema,redesenha,p,g=i3GEO.editorOL.google2wgs(geos[0].geometry);if(nometema==""){return}tema=i3GEO.arvoreDeCamadas.pegaTema(nometema,"","name");if(geos[0].attributes.registros){registros=geos[0].attributes.registros;for(key in registros){if(registros[key]&&key==tema.colunaidunico){valorunico=registros[key]}}}redesenha=function(retorno){i3GEO.janela.fechaAguarde("aguardeSalvaPonto");i3GEO.desenho.layergrafico.removeFeatures(i3GEO.desenho.layergrafico.selectedFeatures);i3GEO.Interface.atualizaTema("",nometema)};i3GEO.janela.AGUARDEMODAL=true;i3GEO.janela.abreAguarde("aguardeSalvaPonto","Adicionando...");i3GEO.janela.AGUARDEMODAL=false;if(valorunico==""){p=i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=adicionaGeometria&g_sid="+i3GEO.configura.sid;cpJSON.call(p,"foo",redesenha,"&tema="+nometema+"&wkt="+g)}else{p=i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=atualizaGeometria&g_sid="+i3GEO.configura.sid;cpJSON.call(p,"foo",redesenha,"&idunico="+valorunico+"&tema="+nometema+"&wkt="+g)}}},funcaoCombo=function(obj){$i("editorOLondeComboTemaEditavel").innerHTML=obj.dados},texto="Salvar no tema:<br><div id=editorOLondeComboTemaEditavel ></div><br><br>";if(n!=1){i3GEO.janela.tempoMsg("Selecione apenas uma figura")}else{i3GEO.janela.confirma(texto,300,"Salva","Cancela",funcaoOK);i3GEO.util.comboTemas("editorOLcomboTemaEditavel",funcaoCombo,"editorOLondeComboTemaEditavel","",false,"editavel")}},criaBotoes:function(botoes){var sketchSymbolizers={"Point":{pointRadius:4,graphicName:"square",fillColor:"white",fillOpacity:1,strokeWidth:1,strokeOpacity:1,strokeColor:"#333333"},"Line":{strokeWidth:3,strokeOpacity:1,strokeColor:"#666666",strokeDashstyle:"dash"},"Polygon":{strokeWidth:2,strokeOpacity:1,strokeColor:"#666666",fillColor:"white",fillOpacity:0.3}},style=new OpenLayers.Style(),styleMap=new OpenLayers.StyleMap({"default":style,"vertex":{strokeOpacity:1,strokeWidth:1,fillColor:"white",fillOpacity:0.45,pointRadius:3}},{extendDefault:false}),adiciona=false,button,controles=[];style.addRules([new OpenLayers.Rule({symbolizer:sketchSymbolizers})]);i3GEOpanelEditor=new OpenLayers.Control.Panel({displayClass:"olControlEditingToolbar1 noprint",saveState:false,activateControl:function(c){this.deactivate();this.activate();try{i3GEO.editorOL.ModifyFeature.deactivate();if(i3GEO&&i3GEO.barraDeBotoes){i3GEO.barraDeBotoes.ativaPadrao()}}catch(e){}if(!c.trigger){c.activate()}else{c.trigger.call()}}});if(botoes.procura===true){button=new OpenLayers.Control.Button({displayClass:"editorOLprocura",trigger:function(){YAHOO.procura.container.panel.show()},title:"procura",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.pan===true){controles.push(new OpenLayers.Control.Navigation({title:"deslocar",displayClass:"editorOLpan",type:OpenLayers.Control.TYPE_TOOL}));adiciona=true}if(botoes.zoombox===true){controles.push(new OpenLayers.Control.ZoomBox({title:"zoombox",displayClass:"editorOLzoombox",type:OpenLayers.Control.TYPE_TOOL}));adiciona=true}if(botoes.zoomtot===true){button=new OpenLayers.Control.Button({displayClass:"editorOLzoomtot",trigger:function(){if(i3GEO.editorOL.mapext&&i3GEO.editorOL.mapext!=""){i3GEO.editorOL.mapa.zoomToExtent(i3GEO.editorOL.mapext)}else{i3GEO.editorOL.mapa.zoomToMaxExtent()}},title:"ajusta extensao",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.zoomin===true){button=new OpenLayers.Control.Button({displayClass:"editorOLzoomin",trigger:function(){i3GEO.editorOL.mapa.zoomIn()},title:"aproxima",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.zoomout===true){button=new OpenLayers.Control.Button({displayClass:"editorOLzoomout",trigger:function(){i3GEO.editorOL.mapa.zoomOut()},title:"afasta",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.legenda===true){button=new OpenLayers.Control.Button({displayClass:"editorOLlegenda",trigger:function(){i3GEO.editorOL.mostraLegenda()},title:"legenda",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.distancia===true){button=new OpenLayers.Control.Measure(OpenLayers.Handler.Path,{handlerOptions:{layerOptions:{styleMap:styleMap}},persist:true,displayClass:"editorOLdistancia",title:"distancia",type:OpenLayers.Control.TYPE_TOOL});button.events.on({"measure":function(event){var units=event.units,measure=event.measure;alert("Distância: "+measure.toFixed(3)+" "+units)}});controles.push(button);adiciona=true}if(botoes.area===true){button=new OpenLayers.Control.Measure(OpenLayers.Handler.Polygon,{handlerOptions:{layerOptions:{styleMap:styleMap}},persist:true,displayClass:"editorOLarea",title:"area",type:OpenLayers.Control.TYPE_TOOL});button.events.on({"measure":function(event){var units=event.units;var measure=event.measure;alert("Área: "+measure.toFixed(3)+" "+units+" quadrados")}});controles.push(button);adiciona=true}if(botoes.identifica===true){botaoIdentifica=new OpenLayers.Control.WMSGetFeatureInfo({maxFeatures:1,infoFormat:'text/plain',layers:[i3GEO.editorOL.layerAtivo()],queryVisible:true,title:"identifica",type:OpenLayers.Control.TYPE_TOOL,displayClass:"editorOLidentifica",eventListeners:{getfeatureinfo:function(event){var lonlat=i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy),lonlattexto="<hr>",formata;if(botoes.linha===true||botoes.ponto===true||botoes.poligono===true||botoes.edita===true){lonlattexto+="<pre><span style=font-size:12px;color:blue;cursor:pointer onclick='i3GEO.editorOL.captura(\""+lonlat.lon+","+lonlat.lat+"\")'>edita geometria</span></pre><br>"}formata=function(texto){var temp,temp1,n,i,f=[],textoN=texto.split(":");try{if(textoN.length>1){temp=textoN[2].replace(/\n\r/g,"");temp=temp.replace(/'/g,"");temp=temp.replace(/\n/g,"|");temp=temp.replace(/_/g," ");temp=temp.replace(/=/g,":");temp=temp.split("|");n=temp.length;for(i=0;i<n;i++){temp1=temp[i].replace(/^\s+/,"");temp1=temp1.replace(/\s+$/,"");if(temp1!="")f.push(temp1)}texto=f.join("<br><br>")}}catch(e){}return texto};i3GEO.editorOL.mapa.addPopup(new OpenLayers.Popup.FramedCloud("chicken",i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy),null,"<div style=text-align:left >"+lonlattexto+"<pre>"+formata(event.text)+"</pre></div>",null,true));i3GEO.editorOL.removeClone()},beforegetfeatureinfo:function(event){var ativo=[i3GEO.editorOL.layerAtivo()];if(ativo[0].CLASS_NAME=="OpenLayers.Layer.TMS"||ativo[0].CLASS_NAME=="OpenLayers.Layer.OSM"){ativo=[i3GEO.editorOL.layertms2wms(ativo[0])]}ativo[0].projection=new OpenLayers.Projection("EPSG:4326");event.object.layers=ativo;botaoIdentifica.layers=ativo;botaoIdentifica.url=ativo[0].url},activate:function(){i3GEO.editorOL.criaJanelaAtivaTema()}}});controles.push(botaoIdentifica);adiciona=true}if(botoes.linha===true){button=new OpenLayers.Control.DrawFeature(i3GEO.desenho.layergrafico,OpenLayers.Handler.Path,{displayClass:"editorOLlinha",title:"digitalizar linha",type:OpenLayers.Control.TYPE_TOOL,callbacks:{done:function(feature){var f=new OpenLayers.Feature.Vector(feature);f["attributes"]={opacidade:i3GEO.editorOL.simbologia.opacidade,texto:i3GEO.editorOL.simbologia.texto,fillColor:i3GEO.editorOL.simbologia.fillColor,strokeWidth:i3GEO.editorOL.simbologia.strokeWidth,strokeColor:i3GEO.editorOL.simbologia.strokeColor,pointRadius:i3GEO.editorOL.simbologia.pointRadius,graphicName:i3GEO.editorOL.simbologia.graphicName};i3GEO.desenho.layergrafico.addFeatures([f]);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}if(i3GEO.Interface){i3GEO.Interface.openlayers.sobeLayersGraficos()}}}});controles.push(button);adiciona=true}if(botoes.ponto===true){button=new OpenLayers.Control.DrawFeature(i3GEO.desenho.layergrafico,OpenLayers.Handler.Point,{displayClass:"editorOLponto",title:"digitalizar ponto",type:OpenLayers.Control.TYPE_TOOL,callbacks:{done:function(feature){var f,style_mark;if(i3GEO.editorOL.simbologia.externalGraphic!=""){style_mark=OpenLayers.Util.extend({},OpenLayers.Feature.Vector.style['default']);style_mark.externalGraphic=i3GEO.editorOL.simbologia.externalGraphic;style_mark.graphicWidth=i3GEO.editorOL.simbologia.graphicWidth;style_mark.graphicHeight=i3GEO.editorOL.simbologia.graphicHeight;style_mark.fillOpacity=i3GEO.editorOL.simbologia.opacidade;f=new OpenLayers.Feature.Vector(feature,null,style_mark)}else{f=new OpenLayers.Feature.Vector(feature)}f["attributes"]={opacidade:i3GEO.editorOL.simbologia.opacidade,texto:i3GEO.editorOL.simbologia.texto,fillColor:i3GEO.editorOL.simbologia.fillColor,strokeWidth:i3GEO.editorOL.simbologia.strokeWidth,strokeColor:i3GEO.editorOL.simbologia.strokeColor,pointRadius:i3GEO.editorOL.simbologia.pointRadius,graphicName:i3GEO.editorOL.simbologia.graphicName,externalGraphic:i3GEO.editorOL.simbologia.externalGraphic,graphicHeight:i3GEO.editorOL.simbologia.graphicHeight,graphicWidth:i3GEO.editorOL.simbologia.graphicWidth};i3GEO.desenho.layergrafico.addFeatures([f]);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}if(i3GEO.Interface){i3GEO.Interface.openlayers.sobeLayersGraficos()}}}});controles.push(button);adiciona=true}if(botoes.poligono===true){button=new OpenLayers.Control.DrawFeature(i3GEO.desenho.layergrafico,OpenLayers.Handler.Polygon,{displayClass:"editorOLpoligono",title:"digitalizar poligono",type:OpenLayers.Control.TYPE_TOOL,callbacks:{done:function(feature){var f=new OpenLayers.Feature.Vector(feature);f["attributes"]={opacidade:i3GEO.editorOL.simbologia.opacidade,texto:i3GEO.editorOL.simbologia.texto,fillColor:i3GEO.editorOL.simbologia.fillColor,strokeWidth:i3GEO.editorOL.simbologia.strokeWidth,strokeColor:i3GEO.editorOL.simbologia.strokeColor,pointRadius:i3GEO.editorOL.simbologia.pointRadius,graphicName:i3GEO.editorOL.simbologia.graphicName};i3GEO.desenho.layergrafico.addFeatures([f]);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}if(i3GEO.Interface){i3GEO.Interface.openlayers.sobeLayersGraficos()}}}});controles.push(button);adiciona=true}if(botoes.texto===true){button=new OpenLayers.Control.DrawFeature(i3GEO.desenho.layergrafico,OpenLayers.Handler.Point,{displayClass:"editorOLtexto",title:"incluir texto",type:OpenLayers.Control.TYPE_TOOL,persist:true,callbacks:{done:function(feature){var texto=window.prompt("Texto",""),label=new OpenLayers.Feature.Vector(feature);label["attributes"]={opacidade:0.1,fillColor:"white",strokeWidth:i3GEO.editorOL.simbologia.strokeWidth,texto:texto,pointRadius:2,graphicName:"square",strokeColor:"black",fontColor:i3GEO.editorOL.simbologia.fontColor,fontSize:i3GEO.editorOL.simbologia.fontSize,fontFamily:"Arial",fontWeight:"bold",labelAlign:"rt"};if(texto&&texto!==""){i3GEO.desenho.layergrafico.addFeatures([label])}if(i3GEO.Interface){i3GEO.Interface.openlayers.sobeLayersGraficos()}}}});controles.push(button);adiciona=true}if(botoes.edita===true&&botoes.corta===true&&i3GEO.php){i3GEO.editorOL.CortaFeature=new OpenLayers.Control.DrawFeature(i3GEO.desenho.layergrafico,OpenLayers.Handler.Polygon,{displayClass:"editorOLcorta",title:"corta figura",type:OpenLayers.Control.TYPE_TOOL,clickout:true,toggle:true,trigger:function(){if(i3GEO.desenho.layergrafico.selectedFeatures.length!=1){alert("Selecione primeiro um elemento para ser cortado");i3GEO.editorOL.CortaFeature.deactivate()}else{i3GEO.editorOL.CortaFeature.activate()}},callbacks:{done:function(feature){var temp,sel=i3GEO.desenho.layergrafico.selectedFeatures[0].geometry,corta=feature;temp=function(retorno){i3GEO.janela.fechaAguarde("i3GEO.cortador");if(retorno!=""&&retorno.data&&retorno.data!=""){i3GEO.editorOL.substituiFeaturesSel(retorno.data)}};i3GEO.janela.abreAguarde("i3GEO.cortador","Cortando");i3GEO.php.funcoesGeometriasWkt(temp,sel+"|"+corta,"difference")}}});controles.push(i3GEO.editorOL.CortaFeature);adiciona=true}if(botoes.edita===true){i3GEO.editorOL.ModifyFeature=new OpenLayers.Control.ModifyFeature(i3GEO.desenho.layergrafico,{displayClass:"editorOLedita",title:"modifica figura",type:OpenLayers.Control.TYPE_TOOL,clickout:true,toggle:true,mode:OpenLayers.Control.ModifyFeature.RESHAPE,standalone:false,createVertices:true,styleMap:"default",vertexRenderIntent:"vertex"});controles.push(i3GEO.editorOL.ModifyFeature);adiciona=true}if(botoes.edita===true&&botoes.listag===true){button=new OpenLayers.Control.Button({displayClass:"editorOLlistag",trigger:function(){i3GEO.editorOL.listaGeometrias()},title:"lista geometrias",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.frente===true){button=new OpenLayers.Control.Button({displayClass:"editorOLfrente",trigger:function(){i3GEO.editorOL.trazParaFrente();if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}},title:"traz para frente",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.tools===true&&i3GEO.php){button=new OpenLayers.Control.Button({displayClass:"editorOLtools",trigger:function(){if(i3GEO.php){i3GEO.editorOL.ferramentas()}else{i3GEO.editorOL.carregajts("i3GEO.editorOL.ferramentas()")}},title:"ferramentas",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.selecao===true){i3GEO.editorOL.selbutton=new OpenLayers.Control.SelectFeature(i3GEO.desenho.layergrafico,{displayClass:"editorOLselecao",title:"seleciona elemento",type:OpenLayers.Control.TYPE_TOOL,clickout:true,toggle:true,multiple:false,hover:false,toggleKey:"ctrlKey",multipleKey:"shiftKey",box:false});controles.push(i3GEO.editorOL.selbutton);adiciona=true}if(botoes.apaga===true){button=new OpenLayers.Control.Button({displayClass:"editorOLapaga",trigger:function(){if(i3GEO.desenho.layergrafico.selectedFeatures.length>0){var x=window.confirm("Exclui os elementos selecionados?");if(x){i3GEO.editorOL.guardaBackup();i3GEO.desenho.layergrafico.removeFeatures(i3GEO.desenho.layergrafico.selectedFeatures);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}}}else{alert("Selecione pelo menos um elemento")}},title:"apaga selecionados",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.propriedades===true){button=new OpenLayers.Control.Button({displayClass:"editorOLpropriedades",trigger:function(){i3GEO.editorOL.propriedades()},title:"propriedades",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.salva===true){button=new OpenLayers.Control.Button({displayClass:"editorOLsalva",trigger:function(){i3GEO.editorOL.salvaGeometrias()},title:"salva",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.ajuda===true){button=new OpenLayers.Control.Button({displayClass:"editorOLajuda",trigger:function(){try{window.open(i3GEO.configura.locaplic+"/mashups/openlayers_ajuda.php")}catch(e){window.open("openlayers_ajuda.php")}},title:"ajuda",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.fecha===true){button=new OpenLayers.Control.Button({displayClass:"editorOLfecha",trigger:function(){var temp=window.confirm("Remove a edicao?");if(i3GEO.eventos){i3GEO.eventos.cliquePerm.ativa()}i3GEOpanelEditor.destroy();try{YAHOO.temaativo.container.panel.destroy()}catch(e){}try{YAHOO.procura.container.panel.destroy()}catch(e){}try{YAHOO.editorOL.container.panel.destroy()}catch(e){}try{YAHOO.editorOL.listaGeometrias.panel.destroy()}catch(e){}try{YAHOO.editorOL.ferramentas.panel.destroy()}catch(e){}try{YAHOO.legendaeditorOL.container.panel.destroy()}catch(e){}try{YAHOO.salvaGeometrias.container.panel.destroy()}catch(e){}if(temp===true){try{if(i3GEO.desenho.layergrafico){i3GEO.editorOL.mapa.removeLayer(i3GEO.desenho.layergrafico);delete(i3GEO.desenho.layergrafico)}if(i3GEO.editorOL.backup){i3GEO.editorOL.mapa.removeLayer(i3GEO.editorOL.backup);delete(i3GEO.editorOL.backup)}}catch(e){}}},title:"fecha editor",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}i3GEOOLsnap=new OpenLayers.Control.Snapping({layer:i3GEO.desenho.layergrafico});i3GEOOLsplit=new OpenLayers.Control.Split({layer:i3GEO.desenho.layergrafico,source:i3GEO.desenho.layergrafico,tolerance:0.0001,eventListeners:{beforesplit:function(event){i3GEO.editorOL.guardaBackup()},aftersplit:function(event){i3GEO.editorOL.flashFeatures(event.features);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}}}});if(adiciona===true){i3GEOpanelEditor.addControls(controles);i3GEO.editorOL.mapa.addControl(i3GEOpanelEditor)}},mudaSimbolo:function(estilo,id){var valor=$i(id).value,geos=i3GEO.desenho.layergrafico.selectedFeatures,n=geos.length,i;i3GEO.editorOL.simbologia[estilo]=valor;for(i=0;i<n;i++){geos[i].attributes[estilo]=valor;geos[i].style[estilo]=valor}},adicionaMarcas:function(){if(i3GEO.editorOL.pontos.length===0){return}var SHADOW_Z_INDEX=10,MARKER_Z_INDEX=11,layer=new OpenLayers.Layer.Vector("pontos",{styleMap:new OpenLayers.StyleMap({externalGraphic:i3GEO.editorOL.marca,backgroundGraphic:"../pacotes/openlayers/img/marker_shadow.png",backgroundXOffset:0,backgroundYOffset:-7,graphicZIndex:MARKER_Z_INDEX,backgroundGraphicZIndex:SHADOW_Z_INDEX,pointRadius:10}),isBaseLayer:false,rendererOptions:{yOrdering:true},displayInLayerSwitcher:true,visibility:true}),index,x=[],y=[],features=[];for(index=0;index<i3GEO.editorOL.pontos.length;index=index+2){x.push(i3GEO.editorOL.pontos[index]);y.push(i3GEO.editorOL.pontos[index+1])}for(index=0;index<x.length;index++){features.push(new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(x[index],y[index])))}layer.addFeatures(features);i3GEO.editorOL.mapa.addLayer(layer)},adicionaKml:function(){var temp,n,i,id,url;n=i3GEO.editorOL.kml.length;for(i=0;i<n;i++){id="kml"+i;url=i3GEO.editorOL.kml[i];eval(id+" = new OpenLayers.Layer.Vector('"+id+"', {displayOutsideMaxExtent:true,displayInLayerSwitcher:false,visibility:true, strategies: [new OpenLayers.Strategy.Fixed()],protocol: new OpenLayers.Protocol.HTTP({url: '"+url+"',format: new OpenLayers.Format.KML({extractStyles: true,extractAttributes: true,maxDepth: 5})})})");eval("i3GEO.editorOL.mapa.addLayer("+id+");");eval("temp = "+id+".div;");temp.onclick=function(e){var targ="",id,temp,features,n,i,g,html="";if(!e){e=window.event}if(e.target){targ=e.target}else{if(e.srcElement){targ=e.srcElement}}if(targ.id){temp=targ.id.split("_");if(temp[0]==="OpenLayers.Geometry.Point"){id=targ.id;temp=i3GEO.editorOL.mapa.getLayer(this.id);features=temp.features;n=features.length;for(i=0;i<n;i++){if(features[i].geometry.id===id){for(var j in features[i].attributes){html+=j+": "+features[i].attributes[j]}g=features[i].geometry;i3GEO.editorOL.mapa.addPopup(new OpenLayers.Popup.FramedCloud("kml",new OpenLayers.LonLat(g.x,g.y),null,html,null,true))}}}}}}},propriedades:function(){if(!document.getElementById("panelpropriedadesEditor")){YAHOO.namespace("editorOL.container");YAHOO.editorOL.container.panel=new YAHOO.widget.Panel("panelpropriedadesEditor",{zIndex:20000,iframe:true,width:"350px",height:"250px",visible:false,draggable:true,close:true});var ins=""+'<p class=paragrafo ><b>Estilos (utilize a cor no formato r,g,b):</b></p>'+'<table class=lista7 >'+' <tr>'+' <td>Cor do contorno</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'strokeColor\',\'i3GEOEditorOLcorContorno\')" type="text" style="cursor:text" id="i3GEOEditorOLcorContorno" size="12" value="'+i3GEO.editorOL.simbologia.strokeColor+'" /></td><td>';if(i3GEO.configura){ins+='<img alt="aquarela.gif" style=cursor:pointer src="'+i3GEO.configura.locaplic+'/imagens/aquarela.gif" onclick="i3GEO.util.abreCor(\'\',\'i3GEOEditorOLcorContorno\');" />'}ins+=""+' </td>'+' </tr>'+' <tr>'+' <td>Cor do preenchimento</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'fillColor\',\'i3GEOEditorOLcorPre\')" type="text" style="cursor:text" id="i3GEOEditorOLcorPre" size="12" value="'+i3GEO.editorOL.simbologia.fillColor+'" /></td><td>';if(i3GEO.configura){ins+='<img alt="aquarela.gif" style=cursor:pointer src="'+i3GEO.configura.locaplic+'/imagens/aquarela.gif" onclick="i3GEO.util.abreCor(\'\',\'i3GEOEditorOLcorPre\');" />'}ins+=""+' </td>'+' </tr>'+' <tr>'+' <td>Cor da fonte</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'fontColor\',\'i3GEOEditorOLcorFonte\')" type="text" style="cursor:text" id="i3GEOEditorOLcorFonte" size="12" value="'+i3GEO.editorOL.simbologia.fontColor+'" /></td><td>';if(i3GEO.configura){ins+='<img alt="aquarela.gif" style=cursor:pointer src="'+i3GEO.configura.locaplic+'/imagens/aquarela.gif" onclick="i3GEO.util.abreCor(\'\',\'i3GEOEditorOLcorFonte\');" />'}ins+=""+' </td>'+' </tr>'+' <tr>'+' <td>Tamanho da fonte</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'fontSize\',\'i3GEOEditorOLfontsize\')" type="text" style="cursor:text" id="i3GEOEditorOLfontsize" size="3" value="'+i3GEO.editorOL.simbologia.fontSize+'" /></td><td></td>'+' </tr>'+' <tr>'+' <td>Opacidade (de 0 a 1)</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'opacidade\',\'i3GEOEditorOLopacidade\')" type="text" style="cursor:text" id="i3GEOEditorOLopacidade" size="3" value="'+i3GEO.editorOL.simbologia.opacidade+'" /></td><td></td>'+' </tr>'+' <tr>'+' <td>Largura da linha/contorno</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'strokeWidth\',\'i3GEOEditorOLlarguraLinha\')" type="text" style="cursor:text" id="i3GEOEditorOLlarguraLinha" size="2" value="'+i3GEO.editorOL.simbologia.strokeWidth+'" /></td><td></td>'+' </tr>'+' <tr>'+' <td>Url de uma figura</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'externalGraphic\',\'i3GEOEditorOLexternalGraphic\')" type="text" style="cursor:text" id="i3GEOEditorOLexternalGraphic" size="22" value="'+i3GEO.editorOL.simbologia.externalGraphic+'" /></td><td></td>'+' </tr>'+' <tr>'+' <td>Largura e altura</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'graphicWidth\',\'i3GEOEditorOLgraphicWidth\')" type="text" style="cursor:text" id="i3GEOEditorOLgraphicWidth" size="4" value="'+i3GEO.editorOL.simbologia.graphicWidth+'" /> <input onchange="i3GEO.editorOL.mudaSimbolo(\'graphicHeight\',\'i3GEOEditorOLgraphicHeight\')" type="text" style="cursor:text" id="i3GEOEditorOLgraphicHeight" size="4" value="'+i3GEO.editorOL.simbologia.graphicHeight+'" /></td><td></td>'+' </tr>'+'</table>'+'<br />'+'<p class=paragrafo ><b>Ajusta nó em edição para o(a):</b></p>'+'<table class=lista7 >'+' <tr>'+' <td></td><td>nó</td><td></td><td>vértice</td><td></td><td>borda</td>'+' </tr>'+' <tr>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.snap()" type="checkbox" id="target_node" /></td><td><input onchange="i3GEO.editorOL.snap()" id="target_nodeTolerance" type="text" size="3" value=15 /></td>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.snap()" type="checkbox" id="target_vertex" /></td><td><input onchange="i3GEO.editorOL.snap()" id="target_vertexTolerance" type="text" size="3" value=15 /></td>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.snap()" type="checkbox" id="target_edge" /></td><td><input onchange="i3GEO.editorOL.snap()" id="target_edgeTolerance" type="text" size="3" value=15 /></td>'+' </tr>'+'</table>'+'<br />'+'<p class=paragrafo ><b>Divide intersecção ao digitalizar</b></p>'+'<table class=lista7 >'+' <tr>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.split()" type="checkbox" id="edge_split_toggle" /></td><td>borda</td>'+' </tr>'+'</table>'+'<br />'+'<p class=paragrafo ><b>Operação ativada pelo botão de modificação da figura</b></p>'+'<table class=lista7 >'+' <tr>'+' <td><input checked style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.RESHAPE;" type="radio" name=i3geoOLtipoEdita /></td><td>altera figura</td>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.RESIZE;" type="radio" name=i3geoOLtipoEdita /></td><td>altera tamanho</td>'+' </tr>'+' <tr>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.ROTATE;" type="radio" name=i3geoOLtipoEdita /></td><td>rotaciona</td>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.DRAG;" type="radio" name=i3geoOLtipoEdita /></td><td>desloca</td>'+' </tr>'+'</table>';YAHOO.editorOL.container.panel.setBody(ins);if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){YAHOO.editorOL.container.panel.setHeader("Propriedades<div id='panelpropriedadesEditor_minimizaCabecalho' class='container-minimiza'></div>")}else{YAHOO.editorOL.container.panel.setHeader("Propriedades")}YAHOO.editorOL.container.panel.setFooter("");YAHOO.editorOL.container.panel.render(document.body);YAHOO.editorOL.container.panel.center();YAHOO.util.Event.addListener(YAHOO.editorOL.container.panel.close,"click",function(){});temp=$i("panelpropriedadesEditor_minimizaCabecalho");if(temp){temp.onclick=function(){i3GEO.janela.minimiza("panelpropriedadesEditor")}}}YAHOO.editorOL.container.panel.show();temp=$i("panelpropriedadesEditor").getElementsByTagName("div");if(temp&&temp[2]){temp[2].style.overflow="auto"}},listaGeometrias:function(){if(!document.getElementById("panellistagEditor")){YAHOO.namespace("editorOL.listaGeometrias");YAHOO.editorOL.listaGeometrias.panel=new YAHOO.widget.Panel("panellistagEditor",{zIndex:20000,iframe:true,width:"320px",visible:false,draggable:true,close:true});if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){YAHOO.editorOL.listaGeometrias.panel.setHeader("Geometrias <div id='panellistagEditor_minimizaCabecalho' class='container-minimiza'></div>")}else{YAHOO.editorOL.listaGeometrias.panel.setHeader("Geometrias")}YAHOO.editorOL.listaGeometrias.panel.setFooter("");YAHOO.editorOL.listaGeometrias.panel.render(document.body);YAHOO.editorOL.listaGeometrias.panel.center();YAHOO.util.Event.addListener(YAHOO.editorOL.listaGeometrias.panel.close,"click",function(){YAHOO.editorOL.listaGeometrias.panel.destroy()});temp=$i("panellistagEditor_minimizaCabecalho");if(temp){temp.onclick=function(){i3GEO.janela.minimiza("panellistagEditor")}}}else{YAHOO.editorOL.listaGeometrias.panel.render(document.body)}var g,temp,geos=i3GEO.desenho.layergrafico.features,n=geos.length,ins="<table class=lista4 >";ins+="<tr><td><i>Geometrias</i></td><td><i>Opções</i></td><td></td><td></td></tr>";while(n>0){n-=1;g=geos[n].geometry;ins+="<tr><td>"+g.CLASS_NAME+"</td><td style='cursor:pointer;color:blue' onclick='javascript:i3GEO.editorOL.selFeature("+n+")'>seleciona</td><td style='cursor:pointer;color:blue' onclick='javascript:i3GEO.editorOL.unselFeature("+n+")'>limpa</td><td style='cursor:pointer;color:blue' onclick='javascript:i3GEO.editorOL.flashFeaturesI("+n+")'>brilha</td></tr>"}ins+="</table>";if(geos.length===0){ins="Nenhum elemento gráfico encontrado. Utilize as opções de criação de geometrias."}YAHOO.editorOL.listaGeometrias.panel.show();if(i3GEO.configura){temp=$i("panellistagEditor").getElementsByTagName("div")[2]}else{temp=$i("panellistagEditor").getElementsByTagName("div")[1]}temp.style.overflow="auto";temp.style.height="100px";temp.innerHTML=ins},ferramentas:function(){if(!document.getElementById("panelferramentasEditor")){YAHOO.namespace("editorOL.ferramentas");YAHOO.editorOL.ferramentas.panel=new YAHOO.widget.Panel("panelferramentasEditor",{zIndex:20000,iframe:true,width:"300px",visible:false,draggable:true,close:true});var ins=""+'<p class=paragrafo >Operações sobre as figuras selecionadas:</p>'+'<select onchange="i3GEO.editorOL.processageo(this.value);this.value = \'\'" >'+' <option value="">---</option>'+' <option value=union >União</option>';if(i3GEO.php){ins+=' <option value=intersection >Intersecção</option>'+' <option value=convexhull >Convex hull</option>'+' <option value=boundary >Bordas</option>'+' <option value=difference >Diferença</option>'+' <option value=symdifference >Diferença simétrica</option>'}ins+='</select>'+'<br><br><a class=paragrafo href=# onclick="i3GEO.desenho.layergrafico.destroyFeatures()" >Apaga tudo</a>';YAHOO.editorOL.ferramentas.panel.setBody(ins);if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){YAHOO.editorOL.ferramentas.panel.setHeader("Ferramentas <div id='panelferramentasEditor_minimizaCabecalho' class='container-minimiza'></div>")}else{YAHOO.editorOL.ferramentas.panel.setHeader("Ferramentas")}YAHOO.editorOL.ferramentas.panel.setFooter("");YAHOO.editorOL.ferramentas.panel.render(document.body);YAHOO.editorOL.ferramentas.panel.center();YAHOO.util.Event.addListener(YAHOO.editorOL.ferramentas.panel.close,"click",function(){});temp=$i("panelferramentasEditor_minimizaCabecalho");if(temp){temp.onclick=function(){i3GEO.janela.minimiza("panelferramentasEditor")}}}else{YAHOO.editorOL.ferramentas.panel.render(document.body)}YAHOO.editorOL.ferramentas.panel.show()},snap:function(){var target=i3GEOOLsnap.targets[0],tipos=["node","vertex","edge"],ntipos=tipos.length,i,temp,ativa=false;i3GEOOLsnap.deactivate();for(i=0;i<ntipos;i++){temp=$i("target_"+tipos[i]);target[tipos[i]]=temp.checked;if(temp.checked===true){ativa=true}temp=$i("target_"+tipos[i]+"Tolerance");target[tipos[i]+"Tolerance"]=temp.value}if(ativa===true){i3GEOOLsnap.activate()}},split:function(){i3GEOOLsplit.deactivate();var temp=$i("edge_split_toggle");if(temp.checked===true){i3GEOOLsplit.activate()}},processageo:function(operacao){if(operacao===""){return}var geosel=i3GEO.desenho.layergrafico.selectedFeatures,polis,linhas,pontos,temp;if(geosel.length>0){polis=i3GEO.editorOL.retornaGeometriasTipo(geosel,"OpenLayers.Geometry.Polygon");linhas=i3GEO.editorOL.retornaGeometriasTipo(geosel,"OpenLayers.Geometry.LineString");pontos=i3GEO.editorOL.retornaGeometriasTipo(geosel,"OpenLayers.Geometry.Point");temp=function(retorno){if(i3GEO.janela){i3GEO.janela.fechaAguarde("i3GEO.editorPoli");i3GEO.janela.fechaAguarde("i3GEO.editorLinhas");i3GEO.janela.fechaAguarde("i3GEO.editorPontos")}if(retorno!=""&&retorno.data&&retorno.data!=""&&operacao!="converteSHP"){i3GEO.editorOL.substituiFeaturesSel(retorno.data)}if(operacao==="converteSHP"){i3GEO.atualiza();i3GEO.janela.minimiza("paneltemaativo")}};if(operacao==="union"&&!i3GEO.php){if(polis.length>0){temp=i3GEO.editorOL.uniaojts(polis);i3GEO.editorOL.substituiFeaturesSel(temp)}if(linhas.length>0){temp=i3GEO.editorOL.uniaojts(linhas);i3GEO.editorOL.substituiFeaturesSel(temp)}if(pontos.length>0){temp=i3GEO.editorOL.uniaojts(p);i3GEO.editorOL.substituiFeaturesSel(temp)}}else{if(polis.length>0){i3GEO.janela.abreAguarde("i3GEO.editorPoli","Poligonos");i3GEO.php.funcoesGeometriasWkt(temp,polis.join("|"),operacao)}if(linhas.length>0){i3GEO.janela.abreAguarde("i3GEO.editorLinhas","Linhas");i3GEO.php.funcoesGeometriasWkt(temp,linhas.join("|"),operacao)}if(pontos.length>0){i3GEO.janela.abreAguarde("i3GEO.editorPontos","Pontos");i3GEO.php.funcoesGeometriasWkt(temp,pontos.join("|"),operacao)}}return}else{alert("Selecione pelo menos dois elementos")}},uniaojts:function(geoms){var n=geoms.length,rwkt=new jsts.io.WKTReader(),wwkt=new jsts.io.WKTWriter(),fwkt=new OpenLayers.Format.WKT(),g,i,uniao;if(n>1){uniao=(fwkt.read(geoms[0]).geometry).toString();uniao=rwkt.read(uniao);for(i=1;i<=n;i++){g=(fwkt.read(geoms[i]).geometry).toString();uniao=uniao.union(rwkt.read(g))}uniao=wwkt.write(uniao);return[fwkt.read(uniao)]}else{return false}},retornaGeometriasTipo:function(features,tipo){var n=features.length,lista=[],i,temp;for(i=0;i<n;i++){temp=features[i].geometry;if(temp.CLASS_NAME==tipo){lista.push(temp)}}return lista},guardaBackup:function(){return;if(!i3GEO.editorOL.backup){i3GEO.editorOL.backup=new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false})}else{i3GEO.editorOL.backup.removeFeatures(i3GEO.editorOL.backup.features)}i3GEO.editorOL.backup.addFeatures(i3GEO.desenho.layergrafico.features)},unselTodos:function(){var n,i;n=i3GEO.desenho.layergrafico.features.length;for(i=0;i<n;i++){i3GEO.desenho.layergrafico.features[i].renderIntent="default";i3GEO.editorOL.selbutton.unselect(i3GEO.desenho.layergrafico.features[i])}},unselTodosBackup:function(){var n,i;n=i3GEO.editorOL.backup.features.length;for(i=0;i<n;i++){i3GEO.editorOL.backup.features[i].renderIntent="default";i3GEO.editorOL.selbutton.unselect(i3GEO.editorOL.backup.features[i])}},restauraBackup:function(){if(i3GEO.editorOL.backup.features.length>0){i3GEO.desenho.layergrafico.removeFeatures(i3GEO.desenho.layergrafico.features);i3GEO.desenho.layergrafico.addFeatures(i3GEO.editorOL.backup.features)}if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}},substituiFeaturesSel:function(wkt){i3GEO.editorOL.guardaBackup();try{var f,fwkt=new OpenLayers.Format.WKT();i3GEO.desenho.layergrafico.removeFeatures(i3GEO.desenho.layergrafico.selectedFeatures);f=fwkt.read(wkt);f["attributes"]={opacidade:i3GEO.editorOL.simbologia.opacidade,texto:i3GEO.editorOL.simbologia.texto,fillColor:i3GEO.editorOL.simbologia.fillColor,strokeWidth:i3GEO.editorOL.simbologia.strokeWidth,strokeColor:i3GEO.editorOL.simbologia.strokeColor,pointRadius:i3GEO.editorOL.simbologia.pointRadius,graphicName:i3GEO.editorOL.simbologia.graphicName};i3GEO.desenho.layergrafico.addFeatures([f]);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}}catch(e){i3GEO.editorOL.restauraBackup()}},adicionaFeatureWkt:function(wkt,atributos){var f,fwkt=new OpenLayers.Format.WKT();if(atributos.externalGraphic&&atributos.externalGraphic!=""){var style_mark=OpenLayers.Util.extend({},OpenLayers.Feature.Vector.style['default']);style_mark.externalGraphic=atributos.externalGraphic;style_mark.graphicWidth=atributos.graphicWidth;style_mark.graphicHeight=atributos.graphicHeight;style_mark.fillOpacity=atributos.opacidade;f=fwkt.read(wkt);f["attributes"]=atributos;f["style"]=style_mark}else{f=fwkt.read(wkt);f["attributes"]=atributos}i3GEO.desenho.layergrafico.addFeatures([f]);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}},flashFeaturesI:function(index){i3GEO.editorOL.flashFeatures([i3GEO.desenho.layergrafico.features[index]],0)},flashFeatures:function(features,index){if(!index){index=0}var current=features[index];if(current&¤t.layer===i3GEO.desenho.layergrafico){i3GEO.desenho.layergrafico.drawFeature(features[index],"select")}var prev=features[index-1];if(prev&&prev.layer===i3GEO.desenho.layergrafico){i3GEO.desenho.layergrafico.drawFeature(prev,"default")}++index;if(index<=features.length){window.setTimeout(function(){i3GEO.editorOL.flashFeatures(features,index)},75)}},selFeature:function(index){i3GEO.editorOL.selbutton.select(i3GEO.desenho.layergrafico.features[index])},unselFeature:function(index){i3GEO.editorOL.selbutton.unselect(i3GEO.desenho.layergrafico.features[index])},carregajts:function(funcao){if(i3GEO.configura){i3GEO.util.scriptTag(i3GEO.configura.locaplic+"/pacotes/jsts/lib/jsts.js",funcao,"i3GEOjts",true)}else{i3GEO.util.scriptTag("../pacotes/jsts/lib/jsts.js",funcao,"i3GEOjts",true)}},trazParaFrente:function(){var features=i3GEO.desenho.layergrafico.selectedFeatures;if(features.length>0){i3GEO.editorOL.backup=new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false});i3GEO.editorOL.backup.addFeatures(features);i3GEO.editorOL.unselTodosBackup();i3GEO.desenho.layergrafico.removeFeatures(features);i3GEO.desenho.layergrafico.addFeatures(i3GEO.editorOL.backup.features);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}}else{alert("Selecione pelo menos um elemento")}},pegaControle:function(classe){var n=i3GEO.editorOL.controles.length,i;for(i=0;i<n;i++){if(i3GEO.editorOL.controles[i].CLASS_NAME===classe){return i3GEO.editorOL.controles[i]}}return false},ativaLayerSwitcher:function(){var ls=i3GEO.editorOL.pegaControle("OpenLayers.Control.LayerSwitcher");if(ls){ls.maximizeDiv.click()}},desativaRodaDoMouse:function(){var controls=i3GEO.editorOL.mapa.getControlsByClass('OpenLayers.Control.Navigation');for(var i=0;i<controls.length;++i){controls[i].disableZoomWheel()}},google2wgs:function(obj){if(i3GEO.Interface.openlayers.googleLike===true){var projWGS84=new OpenLayers.Projection("EPSG:4326"),proj900913=new OpenLayers.Projection("EPSG:900913");return obj.transform(proj900913,projWGS84)}else{return obj}}}; | |
1482 | +if(typeof(i3GEO)==='undefined'){var i3GEO={}}YAHOO.namespace("i3GEO.janela");YAHOO.i3GEO.janela.manager=new YAHOO.widget.OverlayManager();YAHOO.namespace("janelaDoca.xp");YAHOO.janelaDoca.xp.manager=new YAHOO.widget.OverlayManager();YAHOO.i3GEO.janela.managerAguarde=new YAHOO.widget.OverlayManager();i3GEO.janela={ESTILOBD:"display:block;padding:5px 1px 5px 1px;",ESTILOAGUARDE:"normal",AGUARDEMODAL:false,ANTESCRIA:["i3GEO.janela.prepara()"],ANTESFECHA:[],TRANSICAOSUAVE:true,OPACIDADE:65,OPACIDADEAGUARDE:50,TIPS:[],ULTIMOZINDEX:5,prepara:function(){var iu=i3GEO.util;iu.escondeBox()},cria:function(wlargura,waltura,wsrc,nx,ny,texto,id,modal,classe,funcaoCabecalho,funcaoMinimiza,funcaoAposRedim,dimensionavel,icone,funcaoDuplica){if(!dimensionavel){dimensionavel=true}if(!icone){icone=""}if($i(id)){janela=YAHOO.i3GEO.janela.manager.find(id);janela.show();janela.bringToTop();return}var i,wlargurA,ins,novoel,wdocaiframe,temp,fix,underlay,ifr,janela;if(navm&&!chro){this.TRANSICAOSUAVE=false}if(this.ANTESCRIA){for(i=0;i<this.ANTESCRIA.length;i++){eval(this.ANTESCRIA[i])}}if(!classe||classe==""){classe="hd"}if(!id||id===""){id="wdoca"}if(!modal||modal===""){modal=false}ifr=false;if(i3GEO.Interface&&i3GEO.Interface!=undefined&&i3GEO.Interface.ATUAL==="googleearth"){i3GEO.janela.TRANSICAOSUAVE=false;ifr=true}fix="contained";if(nx===""||nx==="center"){fix=true}if(modal===true){underlay="none"}else{underlay="shadow"}temp=navm?0:2;wlargurA=parseInt(wlargura,10)+temp+"px";ins='<div id="'+id+'_cabecalho" class="'+classe+'" >';if(i3GEO.configura!==undefined){ins+="<img id='"+id+"_imagemCabecalho' class='i3GeoAguardeJanela' style='visibility:hidden;' src=\'"+i3GEO.configura.locaplic+"/imagens/aguarde2.gif\' />"}if(icone!=""){ins+="<img class='i3GeoIconeJanela' src='"+icone+"' >"}ins+="<span style='font-size:10px;'>"+texto+"</span>";if(funcaoDuplica){ins+="<div id='"+id+"_duplicaJanela' class='container-duplica'></div>"}if(funcaoMinimiza){ins+="<div id='"+id+"_minimizaCabecalho' class='container-minimiza'></div>"}ins+='</div><div id="'+id+'_corpo" class="bd" style="'+this.ESTILOBD+'">';if(wsrc!==""){ins+='<iframe name="'+id+'i" id="'+id+'i" valign="top" style="border:0px white solid;width:100%"></iframe>'}ins+='</div>';ins+='<div class="ft"></div>';novoel=document.createElement("div");novoel.id=id;novoel.style.display="block";novoel.innerHTML=ins;if(this.TRANSICAOSUAVE){novoel.onmouseover=function(){YAHOO.util.Dom.setStyle(novoel,"opacity",1)};novoel.onmouseout=function(){YAHOO.util.Dom.setStyle(novoel,"opacity",i3GEO.janela.OPACIDADE/100)};YAHOO.util.Dom.setStyle(novoel,"opacity",1)}document.body.appendChild(novoel);wdocaiframe=$i(id+"i");if(wdocaiframe){temp=wdocaiframe.style;temp.height=waltura;temp.display="block";wdocaiframe.src=wsrc}else{if(waltura!=="auto"){$i(id+'_corpo').style.height=parseInt(waltura,10)+"px"}$i(id+'_corpo').style.width='100%';$i(id+'_corpo').style.overflow="auto"}if(waltura==="auto"||dimensionavel==false){janela=new YAHOO.widget.Panel(id,{iframe:ifr,modal:modal,width:wlargurA,underlay:underlay,fixedcenter:fix,constraintoviewport:true,visible:true,monitorresize:false,dragOnly:true,keylisteners:null})}else{janela=new YAHOO.widget.Panel(id,{hideMode:'offsets',iframe:ifr,underlay:underlay,modal:modal,width:wlargurA,fixedcenter:fix,constraintoviewport:true,visible:true,monitorresize:false,dragOnly:true,keylisteners:null});var resize=new YAHOO.util.Resize(id,{handles:['br'],autoRatio:false,minWidth:10,minHeight:10,status:false,proxy:true,ghost:false,animate:false,useShim:true});resize.on('resize',function(args){this.cfg.setProperty("height",args.height+"px");if($i(id+"i")){$i(id+"i").style.height=args.height+"px"}},janela,true);if(funcaoAposRedim&&funcaoAposRedim!=""){resize.on('endResize',function(args){funcaoAposRedim.call();i3GEO.janela.minimiza()},janela,true)}resize.getProxyEl().style.height="0px"}if(nx!==""&&nx!=="center"){janela.moveTo(nx,ny+50)}YAHOO.i3GEO.janela.manager.register(janela);if(this.TRANSICAOSUAVE){janela.cfg.setProperty("effect",[{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.5}])}janela.cfg.setProperty("zIndex",[4]);janela.render();janela.bringToTop();if(navm&&id!=="i3geo_janelaMensagens"&&i3GEO.Interface&&i3GEO.Interface!=undefined&&i3GEO.Interface.ATUAL==="googleearth"){janela.moveTo(0,0)}if(ifr===true){janela.iframe.style.zIndex=4}YAHOO.util.Event.addListener($i(id+'_corpo'),"click",YAHOO.util.Event.stopPropagation);if(funcaoDuplica){$i(id+'_duplicaJanela').onclick=funcaoDuplica}if(funcaoCabecalho){$i(id+'_cabecalho').onclick=funcaoCabecalho}if(funcaoMinimiza){$i(id+"_minimizaCabecalho").onclick=funcaoMinimiza}YAHOO.util.Event.addListener(janela.close,"click",i3GEO.janela.fecha,janela,{id:id},true);temp=$i(id+"_corpo");return([janela,$i(id+"_cabecalho"),temp])},minimiza:function(id){var temp=$i(id+"_corpo"),n,i,m=YAHOO.i3GEO.janela.manager.find(id);if(temp){if(temp.style.display==="block"){temp.style.display="none";if(m){m.hideIframe}}else{temp.style.display="block";if(m){m.showIframe}}}temp=$i(id+"_resizehandle");if(temp){if(temp.style.display==="none"){temp.style.display="block"}else{temp.style.display="none"}}temp=$i(id+"_c");if(temp){temp=temp.getElementsByTagName("div");n=temp.length;for(i=0;i<n;i++){if(temp[i].className==="underlay"||temp[i].className==="bd"){if(temp[i].style.display==="none"){temp[i].style.display="block"}else{temp[i].style.display="none"}}}}temp=$i(id+"_corpo");if(temp){if(temp.style.display==="none"){temp.style.display="block"}else{temp.style.display="none"}}temp=$i(id);if(temp){if(temp.style.display==="none"){temp.style.height="100%"}else{temp.style.height="10%"}}},fecha:function(event,args){var i,id;i3GEO.util.escondeBox();if(i3GEO.janela.ANTESFECHA){for(i=0;i<i3GEO.janela.ANTESFECHA.length;i++){eval(i3GEO.janela.ANTESFECHA[i])}}if(i3GEO.janela.id){id=i3GEO.janela.id}else{id=event.id}if(id==undefined){id=args.id}i3GEO.janela.destroi(id)},destroi:function(id){var janela=YAHOO.i3GEO.janela.manager.find(id);i3GEO.util.removeScriptTag(id+"_script");i3GEO.util.removeScriptTag(id+".dicionario_script");if(janela){YAHOO.i3GEO.janela.manager.remove(janela);janela=$i(id+"_c");janela.parentNode.removeChild(janela)}},alteraTamanho:function(w,h,id){var i;if(arguments.length===3){i=$i(id)}else{i=$i("wdoca")}if(i){i.style.width=w+"px";i.style.height=h+"px"}},abreAguarde:function(id,texto){var pos,temp,janela;if(!id||id==undefined){return}janela=YAHOO.i3GEO.janela.managerAguarde.find(id);pos=[0,0];if(i3GEO.Interface&&$i(i3GEO.Interface.IDCORPO)){pos=YAHOO.util.Dom.getXY($i(i3GEO.Interface.IDCORPO))}else if($i("contemImg")){pos=YAHOO.util.Dom.getXY($i("contemImg"))}if(i3GEO.janela.AGUARDEMODAL==true){texto+="<br><span style='color:navy;cursor:pointer;font-size:9px;' onclick='javascript:if(i3GEO.janela.AGUARDEMODAL == true){i3GEO.janela.AGUARDEMODAL = false;}else{i3GEO.janela.AGUARDEMODAL = true;}'>bloquear/desbloquear</span>"}if(!janela){janela=new YAHOO.widget.Panel(id,{width:"240px",fixedcenter:false,underlay:"none",close:true,draggable:false,modal:i3GEO.janela.AGUARDEMODAL,monitorresize:false});janela.render(document.body);YAHOO.i3GEO.janela.managerAguarde.register(janela)}if(i3GEO.janela.ESTILOAGUARDE==="normal"||i3GEO.janela.ESTILOAGUARDE==="reduzida"){janela.setBody(texto);janela.body.style.padding="5px"}if(i3GEO.janela.ESTILOAGUARDE==="normal"||i3GEO.janela.ESTILOAGUARDE==="minima"){janela.setHeader("<span><img id=aguardeGifAberto src='"+i3GEO.configura.locaplic+"/imagens/aguarde.gif' /></span> <span style=font-size:8px >"+YAHOO.i3GEO.janela.managerAguarde.overlays.length+"</span>")}if(i3GEO.parametros&&i3GEO.parametros.w>0){janela.moveTo(pos[0]+(i3GEO.parametros.w/2)-120,pos[1])}else{janela.moveTo(pos[0],pos[1])}janela.show();if(janela.header){janela.header.style.height="20px"}temp=$i(id+"_c");if(temp){temp.style.backgroundColor=""}YAHOO.util.Dom.setStyle(temp,"opacity",i3GEO.janela.OPACIDADEAGUARDE/100)},fechaAguarde:function(id){if(id!=undefined){var janela=YAHOO.i3GEO.janela.managerAguarde.find(id);if(janela){YAHOO.i3GEO.janela.managerAguarde.remove(janela);janela.destroy()}}},tempoMsg:function(texto,tempo){var pos,janela,attributes,anim,altura=40;janela=YAHOO.i3GEO.janela.managerAguarde.find("i3geoTempoMsg");pos=[0,0];if(i3GEO.Interface&&$i(i3GEO.Interface.IDCORPO)){pos=YAHOO.util.Dom.getXY($i(i3GEO.Interface.IDCORPO))}else if($i("contemImg")){pos=YAHOO.util.Dom.getXY($i("contemImg"))}if(!janela){janela=new YAHOO.widget.Panel("i3geoTempoMsg",{width:"220px",fixedcenter:false,underlay:"none",close:false,draggable:false,modal:false,monitorresize:false,iframe:true});janela.render(document.body);YAHOO.i3GEO.janela.managerAguarde.register(janela)}janela.setBody(texto);altura=70;janela.body.style.padding="5px";janela.body.style.backgroundColor="yellow";if(i3GEO.Interface&&i3GEO.Interface.ATUAL!="googleearth"){janela.body.style.height="0px"}else{janela.body.style.height=altura+"px"}janela.body.style.overflow="hidden";janela.body.onclick=function(){var janela=YAHOO.i3GEO.janela.managerAguarde.find("i3geoTempoMsg");if(janela){janela.destroy()}};if(i3GEO.parametros&&i3GEO.parametros.w>0){janela.moveTo(pos[0]+(i3GEO.parametros.w/2)-120,pos[1])}else{janela.moveTo(pos[0],pos[1])}janela.show();if(i3GEO.Interface&&i3GEO.Interface.ATUAL!="googleearth"){attributes={height:{to:altura}};anim=new YAHOO.util.Anim(janela.body,attributes,.5,YAHOO.util.Easing.easeNone);anim.onComplete.subscribe(function(){janela.body.style.overflow="auto";janela.body.style.display="block";$i("i3geoTempoMsg_c").style.zIndex=100000});anim.animate()}if(!tempo){tempo=4000}setTimeout(function(){var attributes,anim,janela=YAHOO.i3GEO.janela.managerAguarde.find("i3geoTempoMsg");if(i3GEO.Interface&&i3GEO.Interface.ATUAL!="googleearth"){if(janela){janela.body.style.overflow="hidden";attributes={height:{to:0}};anim=new YAHOO.util.Anim(janela.body,attributes,.5,YAHOO.util.Easing.easeNone);anim.onComplete.subscribe(function(){janela.destroy()});anim.animate()}}else{janela.destroy()}},tempo)},ativaAlerta:function(){window.alert=function(texto){var textoI,janela=YAHOO.i3GEO.janela.managerAguarde.find("alerta");if(!janela){janela=new YAHOO.widget.SimpleDialog("alerta",{width:"300px",fixedcenter:true,visible:false,draggable:false,zIndex:100000,textAlign:"left",close:true,modal:false,effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25},constraintoviewport:true,buttons:[{text:$trad("x74"),handler:function(){this.destroy()},isDefault:true}],icon:YAHOO.widget.SimpleDialog.ICON_WARN,text:""});YAHOO.i3GEO.janela.managerAguarde.register(janela);janela.setHeader(" ");janela.render(document.body)}textoI=janela.cfg.getProperty("text");if(textoI!=""){textoI+="<br>"}texto=textoI+texto;janela.cfg.setProperty("text",texto);janela.show()}},confirma:function(pergunta,w,resposta1,resposta2,funcao1,funcao2){var f1,f2,janela=YAHOO.i3GEO.janela.managerAguarde.find("confirma");if(!w||w==""){w=300}if(!funcao1||funcao1==""){f1=function(){YAHOO.i3GEO.janela.managerAguarde.find("confirma").destroy();return true}}else{f1=function(){funcao1.call();YAHOO.i3GEO.janela.managerAguarde.find("confirma").destroy()}}if(!funcao2||funcao2==""){f2=function(){YAHOO.i3GEO.janela.managerAguarde.find("confirma").destroy();return false}}else{f2=function(){YAHOO.i3GEO.janela.managerAguarde.find("confirma").destroy();funcao2.call()}}if(!resposta1||resposta1==""){resposta1=$trad("x58")}if(!resposta2||resposta2==""){resposta2=$trad("x75")}if(janela){janela.destroy()}janela=new YAHOO.widget.SimpleDialog("confirma",{width:w+"px",fixedcenter:true,visible:false,draggable:false,zIndex:100000,textAlign:"left",close:false,modal:false,effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25},constraintoviewport:true,buttons:[{text:resposta1,handler:f1},{text:resposta2,handler:f2}],icon:YAHOO.widget.SimpleDialog.ICON_HELP,text:pergunta});YAHOO.i3GEO.janela.managerAguarde.register(janela);janela.setHeader(" ");janela.render(document.body);janela.show()},prompt:function(pergunta,funcaoOk,valorDefault){if($i("i3GEOjanelaprompt")){return}if(!valorDefault){valorDefault=""}var i="<br><input id='i3GEOjanelaprompt' type=text value='"+valorDefault+"' style='position:relative;top:5px;width:98%;cursor:text;' />";i3GEO.janela.confirma(pergunta+i,"","","",funcaoOk)},mensagemSimples:function(texto,cabecalho){var janela;if($i("mensagemSimples1")){janela=YAHOO.i3GEO.janela.manager.find("mensagemSimples1")}else{janela=new YAHOO.widget.SimpleDialog("mensagemSimples1",{width:"300px",fixedcenter:true,visible:true,draggable:true,zIndex:100000,textAlign:"left",close:true,modal:false,effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25},constraintoviewport:true,text:""});YAHOO.i3GEO.janela.manager.register(janela);janela.setHeader(cabecalho);janela.render(document.body)}janela.setHeader(cabecalho);janela.cfg.setProperty("text",texto);janela.show()},tip:function(cabecalho){var Nid,i,novoel,res;if(arguments.length===0){cabecalho="fixar"}Nid=YAHOO.util.Dom.generateId();i=$i("i3geo_rosa");if(i){i.style.display="none"}if(i3GEO.Interface&&$i(i3GEO.Interface.IDCORPO)){$i("img").title=""}novoel=document.createElement("div");novoel.id=Nid;novoel.style.position="absolute";novoel.style.zIndex=5000;novoel.style.textAlign="left";novoel.style.background="white";if(navm){novoel.style.filter="alpha(opacity=90)"}else{novoel.style.opacity=".9"}document.body.appendChild(novoel);i3GEO.janela.TIPS.push($i(Nid));res="<div id='"+Nid+"cabecatip' style='text-align:left;background-color:rgb(240,240,240)'>";res+="<span style='color:navy;cursor:pointer;text-align:left' onclick='javascript:$i(\""+Nid+"cabecatip\").innerHTML =\"\";' >"+cabecalho+"</span></div>";novoel.innerHTML="<table style='text-align:left'><tr><td style='text-align:left'>"+res+"</td></tr></table>";ist=novoel.style;ist.top=objposicaocursor.telay-9+"px";ist.left=objposicaocursor.telax-5+"px";ist.display="block";if(i3GEO.eventos.NAVEGAMAPA.toString().search("i3GEO.janela.excluiTips('todos')")<0){i3GEO.eventos.NAVEGAMAPA.push("i3GEO.janela.excluiTips('todos')")}if(i3GEO.eventos.MOUSEMOVE.toString().search("i3GEO.janela.excluiTips('naofixos')")<0){i3GEO.eventos.MOUSEMOVE.push("i3GEO.janela.excluiTips('naofixos')")}return(Nid)},excluiTips:function(tipo){var ot,i;if(arguments.length===0){tipo="todos"}if(i3GEO.janela.TIPS.length>0){ot=i3GEO.janela.TIPS.length-1;if(ot>=0){do{if(tipo==='todos'){if(i3GEO.janela.TIPS[ot]){i=$i(i3GEO.janela.TIPS[ot].id);document.body.removeChild(i)}}if(tipo==='naofixos'){if($i(i3GEO.janela.TIPS[ot])){if($i(i3GEO.janela.TIPS[ot].id+"cabecatip").innerHTML!==""){document.body.removeChild($i(i3GEO.janela.TIPS[ot].id))}}}}while(ot--);if(tipo==="todos"){i3GEO.janela.TIPS=[]}}}},slider:function(funcao,inicial){var scaleFactor,bottomConstraint,topConstraint,janela,novoel,Event,slider="",bg,thumb;janela=i3GEO.janela.cria(230,200,"","","",$trad("t20"),"opacidadeG");novoel=document.createElement("div");novoel.id="slider-bg";novoel.tabindex="-1";novoel.innerHTML='<div style="cursor:default;position:absolute;top:4px" id="slider-thumb"><img src="'+i3GEO.configura.locaplic+'/imagens/thumb-n.gif"></div>';janela[2].appendChild(novoel);Event=YAHOO.util.Event;bg="slider-bg";thumb="slider-thumb";novoel.style.position="relative";novoel.style.background='url('+i3GEO.configura.locaplic+'/imagens/bg-fader.gif) 5px 0 no-repeat';novoel.style.height="28px";novoel.style.width="228px";topConstraint=0;bottomConstraint=200;scaleFactor=1;Event.onDOMReady(function(){slider=YAHOO.widget.Slider.getHorizSlider(bg,thumb,topConstraint,bottomConstraint,20);slider.setValue(parseInt(inicial,10));slider.getRealValue=function(){return Math.round(this.getValue()*scaleFactor)};slider.subscribe("slideEnd",function(offsetFromStart){var actualValue=slider.getRealValue();eval(funcao+"("+actualValue+")")})});Event.on("putval","click",function(e){slider.setValue(100,false)})},comboCabecalhoTemas:function(idDiv,idCombo,ferramenta,tipo,onButtonClick){var temp=$i(idDiv);if(temp&&!($i(idCombo))){i3GEO.util.comboTemas(temp.id+"Sel",function(retorno){var tema,container=$i(idDiv),botao;container.innerHTML=retorno.dados;botao=new YAHOO.widget.Button(idCombo,{type:"menu",menu:idCombo+"select"});if(i3GEO.temaAtivo!=""){tema=i3GEO.arvoreDeCamadas.pegaTema(i3GEO.temaAtivo);botao.set("label","<span class='cabecalhoTemas' >"+tema.tema+"</span> ")}else{botao.set("label","<span class='cabecalhoTemas' >"+$trad("x92")+"</span> ")}if(!onButtonClick){onButtonClick=function(p_sType,p_aArgs){var oMenuItem=p_aArgs[1];if(oMenuItem){if(oMenuItem.value!=""){i3GEO.mapa.ativaTema(oMenuItem.value);botao.set("label","<span class='cabecalhoTemas' >"+oMenuItem.cfg.getProperty("text")+"</span> ");if(i3GEOF[ferramenta]){i3GEOF[ferramenta].tema=oMenuItem.value;$i("i3GEOF."+ferramenta+"_corpo").innerHTML="";eval("i3GEOF."+ferramenta+".inicia('i3GEOF."+ferramenta+"_corpo');")}}}}}botao.getMenu().subscribe("click",onButtonClick,botao)},temp.id,"",false,tipo,"",true)}if(i3GEO.eventos.ATUALIZAARVORECAMADAS.length>20){i3GEO.eventos.ATUALIZAARVORECAMADAS=[]}temp="i3GEO.janela.comboCabecalhoTemas('"+idDiv+"','"+idCombo+"','"+ferramenta+"','"+tipo+"')";if(i3GEO.eventos.ATUALIZAARVORECAMADAS.toString().search(temp)<0){i3GEO.eventos.ATUALIZAARVORECAMADAS.push(temp)}}}; | |
1483 | +if(!i3GEO||typeof(i3GEO)==='undefined'){var i3GEO={};i3GEO.Interface={};navn=false;navm=false;$i=function(id){return document.getElementById(id)};app=navigator.appName.substring(0,1);if(app==='N'){navn=true}else{navm=true}OpenLayers.ImgPath="../pacotes/openlayers/img/";OpenLayers.Lang.setCode("pt-BR")}i3GEO.editorOL={simbologia:{opacidade:0.8,texto:"",fillColor:"250,180,15",strokeWidth:2,strokeColor:"250,150,0",pointRadius:4,graphicName:"square",fontSize:"12px",fontColor:"0,0,0",externalGraphic:"",graphicHeight:25,graphicWidth:25},backup:new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false}),nomeFuncaoSalvar:"i3GEO.editorOL.salvaGeo()",e_oce:new OpenLayers.Layer.ArcGIS93Rest("ESRI Ocean Basemap","http://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer/export",{format:"jpeg"},{isBaseLayer:true,visibility:false}),e_ims:new OpenLayers.Layer.ArcGIS93Rest("ESRI Imagery World 2D","http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer/export",{format:"jpeg"},{isBaseLayer:true,visibility:false}),e_wsm:new OpenLayers.Layer.ArcGIS93Rest("ESRI World Street Map","http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer/export",{format:"jpeg"},{isBaseLayer:true,visibility:false}),ol_mma:new OpenLayers.Layer.WMS("Base cartográfica","http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseraster.map&",{layers:'baseraster',SRS:'EPSG:4618',FORMAT:'image/png'},{singleTile:false}),ol_wms:new OpenLayers.Layer.WMS("OpenLayers WMS","http://labs.metacarta.com/wms/vmap0",{layers:'basic'}),top_wms:new OpenLayers.Layer.WMS("Toponímia MMA","http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseref.map&",{layers:"base",FORMAT:'image/png'}),est_wms:new OpenLayers.Layer.WMS("Estados do Brasil","http://mapas.mma.gov.br/i3geo/ogc.php?tema=estadosl&",{layers:"estadosl",FORMAT:'image/png'}),osm:new OpenLayers.Layer.OSM("OSM","http://tile.openstreetmap.org/${z}/${x}/${y}.png",{isBaseLayer:true,visibility:false}),fundo:"e_ims,e_wsm,ol_mma,ol_wms,top_wms,est_wms,e_oce",kml:[],layersIniciais:[],botoes:{'pan':true,'zoombox':true,'zoomtot':true,'zoomin':true,'zoomout':true,'legenda':true,'distancia':true,'area':true,'identifica':true,'linha':true,'ponto':true,'poligono':true,'texto':true,'edita':true,'listag':true,'corta':true,'apaga':true,'procura':true,'selecao':true,'salva':true,'ajuda':true,'propriedades':true,'fecha':false,'tools':true,'undo':false,'frente':false,'legenda':true,'rodadomouse':true},pontos:[],marca:"../pacotes/openlayers/img/marker-gold.png",controles:[new OpenLayers.Control.Navigation(),new OpenLayers.Control.PanZoomBar(),new OpenLayers.Control.LayerSwitcher({'ascending':false}),new OpenLayers.Control.ScaleLine(),new OpenLayers.Control.MousePosition({'separator':' '}),new OpenLayers.Control.OverviewMap(),new OpenLayers.Control.KeyboardDefaults()],tiles:true,incluilayergrafico:true,ativalayerswitcher:false,ativarodadomouse:true,legendahtml:false,numzoom:12,minresolution:0.703125,maxext:"",mapext:new OpenLayers.Bounds(-76.5125927,-39.3925675209,-29.5851853,9.49014852081),mapa:"",inicia:function(){var single=false,alayers=[],fundo=(i3GEO.editorOL.fundo).split(","),nfundo=fundo.length,ncontroles=i3GEO.editorOL.controles.length,i,n;if(i3GEO.editorOL.tiles===false||i3GEO.editorOL.tiles==="false"){single=true}if(i3GEO.editorOL.ativalayerswitcher==="false"){i3GEO.editorOL.ativalayerswitcher=false}if(i3GEO.editorOL.ativalayerswitcher==="true"){i3GEO.editorOL.ativalayerswitcher=true}if(i3GEO.editorOL.ativarodadomouse==="false"){i3GEO.editorOL.ativarodadomouse=false}if(i3GEO.editorOL.ativarodadomouse==="true"){i3GEO.editorOL.ativarodadomouse=true}if(i3GEO.editorOL.legendahtml==="false"){i3GEO.editorOL.legendahtml=false}if(i3GEO.editorOL.legendahtml==="true"){i3GEO.editorOL.legendahtml=true}if(i3GEO.editorOL.incluilayergrafico==="false"){i3GEO.editorOL.incluilayergrafico=false}if(i3GEO.editorOL.incluilayergrafico==="true"){i3GEO.editorOL.incluilayergrafico=true}if(i3GEO.editorOL.incluilayergrafico===true){if(!i3GEO.desenho.layergrafico){i3GEO.editorOL.criaLayerGrafico()}}else{i3GEO.desenho.layergrafico="";i3GEO.editorOL.botoes.linha=false;i3GEO.editorOL.botoes.ponto=false;i3GEO.editorOL.botoes.poligono=false;i3GEO.editorOL.botoes.texto=false;i3GEO.editorOL.botoes.edita=false;i3GEO.editorOL.botoes.listag=false;i3GEO.editorOL.botoes.corta=false;i3GEO.editorOL.botoes.apaga=false;i3GEO.editorOL.botoes.selecao=false;i3GEO.editorOL.botoes.salva=false;i3GEO.editorOL.botoes.propriedades=false;i3GEO.editorOL.botoes.fecha=false;i3GEO.editorOL.botoes.tools=false;i3GEO.editorOL.botoes.undo=false;i3GEO.editorOL.botoes.frente=false}if(i3GEO.editorOL.mapa===""){alert("O objeto i3GEO.editorOL.mapa precisa ser criado com new OpenLayers.Map()");return}for(i=0;i<ncontroles;i++){i3GEO.editorOL.mapa.addControl(i3GEO.editorOL.controles[i])}if(i3GEO.editorOL.fundo!=""){for(i=nfundo-1;i>=0;i--){if(fundo[i]!=""){try{eval("i3GEO.editorOL."+fundo[i]+".transitionEffect = 'resize';");eval("i3GEO.editorOL."+fundo[i]+".setVisibility(false);");eval("i3GEO.editorOL."+fundo[i]+".singleTile = false;");eval("alayers.push(i3GEO.editorOL."+fundo[i]+");")}catch(e){if(alayers[0]){alayers[0].setVisibility(true)}}}}}i3GEO.editorOL.mapa.addLayers(alayers);if(i3GEO.editorOL.layersIniciais!==""){n=i3GEO.editorOL.layersIniciais.length;for(i=0;i<n;i++){i3GEO.editorOL.layersIniciais[i].singleTile=single;i3GEO.editorOL.mapa.addLayer(i3GEO.editorOL.layersIniciais[i])}}if(!i3GEO.desenho.layergrafico){i3GEO.editorOL.mapa.addLayers([i3GEO.desenho.layergrafico])}i3GEO.editorOL.adicionaKml();i3GEO.editorOL.adicionaMarcas();i3GEO.editorOL.coordenadas();i3GEO.editorOL.criaJanelaBusca();i3GEO.editorOL.criaBotoes(i3GEO.editorOL.botoes);if(i3GEO.editorOL.ativalayerswitcher===true){i3GEO.editorOL.ativaLayerSwitcher()}if(i3GEO.editorOL.ativarodadomouse===false){i3GEO.editorOL.desativaRodaDoMouse()}if(i3GEO.editorOL.numzoom!==""){i3GEO.editorOL.mapa.setOptions({numZoomLevels:i3GEO.editorOL.numzoom})}if(i3GEO.editorOL.maxext!==""){i3GEO.editorOL.mapa.setOptions({maxExtent:i3GEO.editorOL.maxext})}if(i3GEO.editorOL.mapext!=""){i3GEO.editorOL.mapa.zoomToExtent(i3GEO.editorOL.mapext)}else{i3GEO.editorOL.mapa.zoomToMaxExtent()}if(i3GEO.Interface&&i3GEO.Interface.openlayers&&i3GEO.Interface.openlayers.sobeLayersGraficos){i3GEO.Interface.openlayers.sobeLayersGraficos()}},criaLayerGrafico:function(){i3GEO.desenho.openlayers.criaLayerGrafico()},layersLigados:function(){var layers=i3GEO.editorOL.mapa.layers,nlayers=layers.length,ins=[],i;for(i=0;i<nlayers;i++){if(layers[i].visibility===true){ins.push(layers[i])}}return ins},layersClonados:function(paramsLayers){var layers=i3GEO.editorOL.mapa.layers,nlayers=layers.length,i;for(i=0;i<nlayers;i++){if(layers[i].params&&layers[i].params.CLONETMS===paramsLayers){return(layers[i])}}return false},layertms2wms:function(tms){var layer,url;url=tms.url.replace("&cache=sim","&DESLIGACACHE=sim");url=url.replace("&Z=${z}&X=${x}&Y=${y}","");url=url.replace("Z=${z}&X=${x}&Y=${y}","");layer=new OpenLayers.Layer.WMS(tms.layername+"_clone",url,{layers:tms.name,transparent:true},{gutter:0,isBaseLayer:false,displayInLayerSwitcher:false,opacity:1,visibility:true,singleTile:true});return layer},removeClone:function(){var nome=i3GEO.editorOL.layerAtivo().layername+"_clone",busca=i3GEO.editorOL.mapa.getLayersByName(nome);if(busca.length>0){i3GEO.editorOL.mapa.removeLayer(i3GEO.editorOL.mapa.getLayersByName(camada.name)[0],false)}},coordenadas:function(){var idcoord=i3GEO.editorOL.mapa.getControlsBy("separator"," ");if(idcoord[0]){i3GEO.editorOL.mapa.events.register("mousemove",i3GEO.editorOL.mapa,function(e){var p,lonlat,d;if(navm){p=new OpenLayers.Pixel(e.x,e.y)}else{p=e.xy}lonlat=i3GEO.editorOL.mapa.getLonLatFromPixel(p);d=i3GEO.calculo.dd2dms(lonlat.lon,lonlat.lat);try{$i(idcoord[0].id).innerHTML="Long: "+d[0]+"<br>Lat: "+d[1]}catch(e){}})}},criaJanelaBusca:function(){var layers=i3GEO.editorOL.layersLigados(),nlayers=layers.length,i,ins,combo="<select id=i3GEOOLlistaTemasBusca ><option value=''>----</option>";for(i=0;i<nlayers;i++){combo+="<option value='"+i+"' >"+layers[i].name+"</option>"}combo+="</select>";ins="<div class=paragrafo >Tema:<br>"+combo;ins+="<br>Item:<br><span id=i3GEOOLcomboitens ></span>";ins+="<br>Procurar por:<br><input type=text size=20 id=i3GEOOLpalavraBusca >";ins+="<br><br><input type=button value='Procurar' id='i3GEOOLbotaoBusca' ></div>";ins+="<br>Resultado:<br><span id=i3GEOOLcomboresultado ></span>";try{YAHOO.namespace("procura.container");YAHOO.procura.container.panel=new YAHOO.widget.Panel("panelprocura",{zIndex:2000,iframe:false,width:"250px",visible:false,draggable:true,close:true});YAHOO.procura.container.panel.setHeader("Encontre no mapa");YAHOO.procura.container.panel.setBody(ins);YAHOO.procura.container.panel.setFooter("");YAHOO.procura.container.panel.render(document.body);YAHOO.procura.container.panel.center();document.getElementById("i3GEOOLbotaoBusca").onclick=function(){var layer=i3GEO.editorOL.layerAtivo(),item=document.getElementById("i3GEOOLbuscaItem").value,palavra=document.getElementById("i3GEOOLpalavraBusca").value;if(item===""||palavra===""){alert("Escolha o item e o texto de busca");return}i3GEO.editorOL.busca(layer,item,palavra,"i3GEOOLcomboresultado")};document.getElementById("i3GEOOLlistaTemasBusca").onchange=function(){i3GEO.editorOL.ativaTema(this.value);document.getElementById("i3GEOOLcomboitens").innerHTML="...";i3GEO.editorOL.listaItens(i3GEO.editorOL.layerAtivo(),"i3GEOOLcomboitens","i3GEOOLbuscaItem")}}catch(e){}},criaComboTemas:function(){var layers=i3GEO.editorOL.layersLigados(),nlayers=layers.length,i,nometema="",temp,combo="<select id=i3GEOOLlistaTemasAtivos style=width:235px; >";for(i=0;i<nlayers;i++){nometema="";if(i3GEO.arvoreDeCamadas&&i3GEO.arvoreDeCamadas.CAMADAS){temp=i3GEO.arvoreDeCamadas.pegaTema(layers[i].name,"","name");if(temp!=""){nometema=temp.tema+" - "}}combo+="<option value='"+i+"' >"+nometema+layers[i].name+"</option>"}combo+="</select>";return combo},atualizaJanelaAtivaTema:function(){var combo=i3GEO.editorOL.criaComboTemas();YAHOO.temaativo.container.panel.setBody(combo);document.getElementById("i3GEOOLlistaTemasAtivos").onchange=function(){if(botaoIdentifica){botaoIdentifica.layers=[i3GEO.editorOL.layersLigados()[this.value]]}}},criaJanelaAtivaTema:function(){var temp;if(!document.getElementById("paneltemaativo")){YAHOO.namespace("temaativo.container");YAHOO.temaativo.container.panel=new YAHOO.widget.Panel("paneltemaativo",{zIndex:20000,iframe:true,width:"250px",visible:false,draggable:true,close:true});YAHOO.temaativo.container.panel.setBody("");if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){YAHOO.temaativo.container.panel.setHeader("Tema ativo<div id='paneltemaativo_minimizaCabecalho' class='container-minimiza'></div>")}else{YAHOO.temaativo.container.panel.setHeader("Tema ativo")}YAHOO.temaativo.container.panel.setFooter("");YAHOO.temaativo.container.panel.render(document.body);YAHOO.temaativo.container.panel.show();YAHOO.temaativo.container.panel.center();i3GEO.editorOL.atualizaJanelaAtivaTema();YAHOO.util.Event.addListener(YAHOO.temaativo.container.panel.close,"click",function(){i3GEOpanelEditor.deactivate();i3GEOpanelEditor.activate();if(i3GEO.eventos&&i3GEO.eventos.ATUALIZAARVORECAMADAS.toString().search("i3GEO.editorOL.atualizaJanelaAtivaTema()")>0){i3GEO.eventos.ATUALIZAARVORECAMADAS.remove("i3GEO.editorOL.atualizaJanelaAtivaTema()")}});if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){if(i3GEO.eventos&&i3GEO.eventos.ATUALIZAARVORECAMADAS.toString().search("i3GEO.editorOL.atualizaJanelaAtivaTema()")<0){i3GEO.eventos.ATUALIZAARVORECAMADAS.push("i3GEO.editorOL.atualizaJanelaAtivaTema()")}}temp=$i("paneltemaativo_minimizaCabecalho");if(temp){temp.onclick=function(){i3GEO.janela.minimiza("paneltemaativo")}}}else{YAHOO.temaativo.container.panel.show();i3GEO.editorOL.atualizaJanelaAtivaTema()}},ativaTema:function(id){document.getElementById("i3GEOOLlistaTemasAtivos").value=id},layerAtivo:function(){var id=document.getElementById("i3GEOOLlistaTemasAtivos");if(id){id=id.value}else{id=i3GEO.temaAtivo}if(id==""){return[]}else{return i3GEO.editorOL.layersLigados()[id]}},listaItens:function(layer,idonde,idobj){if(!layer){return}if(!layer.params){return}var u=layer.url+"&request=describefeaturetype&service=wfs&version=1.0.0";u+="&typename="+layer.params.LAYERS;document.body.style.cursor="wait";document.getElementById("i3geoMapa").style.cursor="wait";OpenLayers.Request.issue({method:"GET",url:u,callback:function(retorno){document.body.style.cursor="default";document.getElementById("i3geoMapa").style.cursor="default";var fromgml=new OpenLayers.Format.WFSDescribeFeatureType({geometryName:"msGeometry"}),gml=fromgml.read(retorno.responseText),prop=gml.featureTypes[0].properties,nprop=prop.length,i,combo="<select id="+idobj+" ><option value=''>----</option>";for(i=0;i<nprop;i++){combo+="<option value="+prop[i].name+" >"+prop[i].name+"</option>"}combo+="</select>";document.getElementById(idonde).innerHTML=combo},failure:function(){document.body.style.cursor="default";document.getElementById("i3geoMapa").style.cursor="default";alert("Erro")}})},busca:function(layer,item,palavra,onde){document.body.style.cursor="wait";document.getElementById("i3geoMapa").style.cursor="wait";var u=layer.url+"&request=getfeature&service=wfs&version=1.0.0";u=u.replace("Z=${z}&X=${x}&Y=${y}","");u+="&OUTPUTFORMAT=gml2&typename="+layer.params.LAYERS;u+="&filter=<Filter><PropertyIsLike wildcard=* singleChar=. escape=! ><PropertyName>"+item+"</PropertyName><Literal>*"+palavra+"*</Literal></PropertyIsLike></Filter>";document.body.style.cursor="wait";document.getElementById("i3geoMapa").style.cursor="wait";document.getElementById(onde).innerHTML="...";OpenLayers.Request.issue({method:"GET",url:u,callback:function(retorno){document.body.style.cursor="default";document.getElementById("i3geoMapa").style.cursor="default";var fromgml=new OpenLayers.Format.GML({geometryName:"msGeometry"}),gml=fromgml.read(retorno.responseText),ngml=gml.length,i,ins="<select onchange='i3GEO.editorOL.zoomPara(this.value)'>";ins+="<option value=''>---</option>";for(i=0;i<ngml;i++){eval("var valor = gml[i].data."+item);var bounds=gml[i].geometry.getBounds();bounds=bounds.toBBOX();ins+="<option value='"+bounds+"'>"+valor+"</option>"}ins+="</select>";document.getElementById(onde).innerHTML=ins},failure:function(){document.body.style.cursor="default";document.getElementById("i3geoMapa").style.cursor="default";alert("Erro")}})},zoomPara:function(bbox){var b=new OpenLayers.Bounds.fromString(bbox);i3GEO.editorOL.mapa.zoomToExtent(b)},mostraLegenda:function(){var layers=i3GEO.editorOL.layersLigados(),nlayers=layers.length,ins="",i;for(i=0;i<nlayers;i++){try{if(layers[i].isBaseLayer===false){var url=layers[i].getFullRequestString({"request":"getlegendgraphic"});if(i3GEO.editorOL.legendahtml===true){url=url.replace("image%2Fpng","text/html");ins+=layers[i].name+"<br><div id=legendaL_"+i+" ></div><br>";eval("var f = function(retorno){document.getElementById('legendaL_"+i+"').innerHTML = retorno.responseText;};");var config={method:"GET",url:url,callback:f};OpenLayers.Request.issue(config)}else{url=url.replace("LAYERS","LAYER");url=url.replace("&Z=${z}&X=${x}&Y=${y}","");url=url.replace("Z=${z}&X=${x}&Y=${y}","");ins+=layers[i].name+"<br><img src='"+url+"&SERVICE=wms' /><br>"}}}catch(e){}}if(!document.getElementById("panellegendaeditorOL")){YAHOO.namespace("legendaeditorOL.container");YAHOO.legendaeditorOL.container.panel=new YAHOO.widget.Panel("panellegendaeditorOL",{zIndex:20000,iframe:true,width:"auto",visible:false,draggable:true,close:true});YAHOO.legendaeditorOL.container.panel.setBody(ins);YAHOO.legendaeditorOL.container.panel.setHeader("Legenda");YAHOO.legendaeditorOL.container.panel.setFooter("");YAHOO.legendaeditorOL.container.panel.render(document.body);YAHOO.legendaeditorOL.container.panel.show();YAHOO.legendaeditorOL.container.panel.center();YAHOO.util.Event.addListener(YAHOO.legendaeditorOL.container.panel.close,"click",function(){})}else{YAHOO.legendaeditorOL.container.panel.setBody(ins);YAHOO.legendaeditorOL.container.panel.show()}},captura:function(lonlat){var d=0.1,layers=[i3GEO.editorOL.layerAtivo()],xy=lonlat.split(","),u=layers[0].url+"&REQUEST=getfeature&service=wfs&version=1.0.0";u+="&OUTPUTFORMAT=gml2&typename="+layers[0].params.LAYERS;u=u.replace("&cache=sim","&DESLIGACACHE=sim");u=u.replace("&Z=${z}&X=${x}&Y=${y}","");u=u.replace("Z=${z}&X=${x}&Y=${y}","");xy[0]=xy[0]*1;xy[1]=xy[1]*1;var poligono=(xy[0]-d)+","+(xy[1]+d)+" "+(xy[0]+d)+","+(xy[1]+d)+" "+(xy[0]+d)+","+(xy[1]-d)+" "+(xy[0]-d)+","+(xy[1]-d)+" "+(xy[0]-d)+","+(xy[1]+d);u+="&filter=<Filter><Intersects><PropertyName>Geometry</PropertyName><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:posList>"+poligono+"</gml:posList></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></Intersects></Filter>";document.body.style.cursor="wait";if(document.getElementById("i3geoMapa")){document.getElementById("i3geoMapa").style.cursor="wait"}OpenLayers.Request.issue({method:"GET",url:u,callback:function(retorno){document.body.style.cursor="default";if(document.getElementById("i3geoMapa")){document.getElementById("i3geoMapa").style.cursor="default"}var i,n,f,fromgml=new OpenLayers.Format.GML({geometryName:"msGeometry"}),gml=fromgml.read(retorno.responseText);n=gml.length;for(i=0;i<n;i++){f=gml[i];f["attributes"]={opacidade:i3GEO.editorOL.simbologia.opacidade,texto:i3GEO.editorOL.simbologia.texto,fillColor:i3GEO.editorOL.simbologia.fillColor,strokeWidth:i3GEO.editorOL.simbologia.strokeWidth,strokeColor:i3GEO.editorOL.simbologia.strokeColor,pointRadius:i3GEO.editorOL.simbologia.pointRadius,graphicName:i3GEO.editorOL.simbologia.graphicName,registros:f["attributes"]}}i3GEO.desenho.layergrafico.addFeatures(gml)},failure:function(){document.body.style.cursor="default";if(document.getElementById("i3geoMapa")){document.getElementById("i3geoMapa").style.cursor="default"}alert("Erro")}})},salvaGeometrias:function(){var geos=i3GEO.desenho.layergrafico.selectedFeatures,n=geos.length,ins="";if(n>0){if($i("panelsalvageometrias")){if(YAHOO.i3GEO){YAHOO.salvaGeometrias.container.panel=YAHOO.i3GEO.janela.manager.find("panelsalvageometrias")}YAHOO.salvaGeometrias.container.panel.show();YAHOO.salvaGeometrias.container.panel.bringToTop()}else{try{YAHOO.namespace("salvaGeometrias.container");YAHOO.salvaGeometrias.container.panel=new YAHOO.widget.Panel("panelsalvageometrias",{zIndex:2000,iframe:false,width:"250px",visible:false,draggable:true,close:true});YAHOO.salvaGeometrias.container.panel.setHeader("Geometrias");YAHOO.salvaGeometrias.container.panel.setBody("");YAHOO.salvaGeometrias.container.panel.setFooter("");YAHOO.salvaGeometrias.container.panel.render(document.body);YAHOO.salvaGeometrias.container.panel.center();if(YAHOO.i3GEO&&YAHOO.i3GEO.janela){YAHOO.i3GEO.janela.manager.register(YAHOO.salvaGeometrias.container.panel)}YAHOO.salvaGeometrias.container.panel.show()}catch(e){}}ins+="<p class=paragrafo >Foram encontrada(s) "+n+" geometria(s) selecionada(s) </p>";ins+="<p class=paragrafo ><a href='#' onclick='i3GEO.editorOL.listaGeometriasSel()' >Listar</a> ";if(i3GEO.arvoreDeCamadas){ins+="<a href='#' onclick='"+i3GEO.editorOL.nomeFuncaoSalvar+"' >Salvar</a> "}ins+="<a href='#' onclick='i3GEO.editorOL.exportarSHP()' >Exportar (shapefile)</a></p>";YAHOO.salvaGeometrias.container.panel.setBody(ins)}else{alert("Selecione pelo menos um elemento")}},exportarSHP:function(){i3GEO.editorOL.processageo("converteSHP")},listaGeometriasSel:function(){var geos=i3GEO.desenho.layergrafico.selectedFeatures,n=geos.length,ins="",i,a,w,g;for(i=0;i<n;i++){g=geos[i];ins+="<b>Geometria: "+i+"</b><br>"+i3GEO.editorOL.google2wgs(g.geometry)+"<br><br>";ins+="<b>Atributos: "+i+"</b><br>";a=g.attributes;for(key in a){if(a[key]){ins+=key+" = "+a[key]+"<br>"}}if(g.attributes.registros){ins+="<b>Registros: "+i+"</b><br>";a=g.attributes.registros;for(key in a){if(a[key]){ins+=key+" = "+a[key]+"<br>"}}}}w=window.open();w.document.write(ins);w.document.close()},testeSalvar:function(){alert("Funcao nao disponivel. Defina o nome da funcao em i3GEO.editorOL.nomeFuncaoSalvar ")},salvaGeo:function(){var geos=i3GEO.desenho.layergrafico.selectedFeatures,n=geos.length,funcaoOK=function(){if(geos[0].geometry){var registros="",valorunico="",nometema=$i("editorOLcomboTemaEditavel").value,key="",tema,redesenha,p,g=i3GEO.editorOL.google2wgs(geos[0].geometry);if(nometema==""){return}tema=i3GEO.arvoreDeCamadas.pegaTema(nometema,"","name");if(geos[0].attributes.registros){registros=geos[0].attributes.registros;for(key in registros){if(registros[key]&&key==tema.colunaidunico){valorunico=registros[key]}}}redesenha=function(retorno){i3GEO.janela.fechaAguarde("aguardeSalvaPonto");i3GEO.desenho.layergrafico.removeFeatures(i3GEO.desenho.layergrafico.selectedFeatures);i3GEO.Interface.atualizaTema("",nometema)};i3GEO.janela.AGUARDEMODAL=true;i3GEO.janela.abreAguarde("aguardeSalvaPonto","Adicionando...");i3GEO.janela.AGUARDEMODAL=false;if(valorunico==""){p=i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=adicionaGeometria&g_sid="+i3GEO.configura.sid;cpJSON.call(p,"foo",redesenha,"&tema="+nometema+"&wkt="+g)}else{p=i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=atualizaGeometria&g_sid="+i3GEO.configura.sid;cpJSON.call(p,"foo",redesenha,"&idunico="+valorunico+"&tema="+nometema+"&wkt="+g)}}},funcaoCombo=function(obj){$i("editorOLondeComboTemaEditavel").innerHTML=obj.dados},texto="Salvar no tema:<br><div id=editorOLondeComboTemaEditavel ></div><br><br>";if(n!=1){i3GEO.janela.tempoMsg("Selecione apenas uma figura")}else{i3GEO.janela.confirma(texto,300,"Salva","Cancela",funcaoOK);i3GEO.util.comboTemas("editorOLcomboTemaEditavel",funcaoCombo,"editorOLondeComboTemaEditavel","",false,"editavel")}},criaBotoes:function(botoes){var sketchSymbolizers={"Point":{pointRadius:4,graphicName:"square",fillColor:"white",fillOpacity:1,strokeWidth:1,strokeOpacity:1,strokeColor:"#333333"},"Line":{strokeWidth:3,strokeOpacity:1,strokeColor:"#666666",strokeDashstyle:"dash"},"Polygon":{strokeWidth:2,strokeOpacity:1,strokeColor:"#666666",fillColor:"white",fillOpacity:0.3}},style=new OpenLayers.Style(),styleMap=new OpenLayers.StyleMap({"default":style,"vertex":{strokeOpacity:1,strokeWidth:1,fillColor:"white",fillOpacity:0.45,pointRadius:3}},{extendDefault:false}),adiciona=false,button,controles=[];style.addRules([new OpenLayers.Rule({symbolizer:sketchSymbolizers})]);i3GEOpanelEditor=new OpenLayers.Control.Panel({displayClass:"olControlEditingToolbar1 noprint",saveState:false,activateControl:function(c){this.deactivate();this.activate();try{i3GEO.editorOL.ModifyFeature.deactivate();if(i3GEO&&i3GEO.barraDeBotoes){i3GEO.barraDeBotoes.ativaPadrao()}}catch(e){}if(!c.trigger){c.activate()}else{c.trigger.call()}}});if(botoes.procura===true){button=new OpenLayers.Control.Button({displayClass:"editorOLprocura",trigger:function(){YAHOO.procura.container.panel.show()},title:"procura",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.pan===true){controles.push(new OpenLayers.Control.Navigation({title:"deslocar",displayClass:"editorOLpan",type:OpenLayers.Control.TYPE_TOOL}));adiciona=true}if(botoes.zoombox===true){controles.push(new OpenLayers.Control.ZoomBox({title:"zoombox",displayClass:"editorOLzoombox",type:OpenLayers.Control.TYPE_TOOL}));adiciona=true}if(botoes.zoomtot===true){button=new OpenLayers.Control.Button({displayClass:"editorOLzoomtot",trigger:function(){if(i3GEO.editorOL.mapext&&i3GEO.editorOL.mapext!=""){i3GEO.editorOL.mapa.zoomToExtent(i3GEO.editorOL.mapext)}else{i3GEO.editorOL.mapa.zoomToMaxExtent()}},title:"ajusta extensao",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.zoomin===true){button=new OpenLayers.Control.Button({displayClass:"editorOLzoomin",trigger:function(){i3GEO.editorOL.mapa.zoomIn()},title:"aproxima",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.zoomout===true){button=new OpenLayers.Control.Button({displayClass:"editorOLzoomout",trigger:function(){i3GEO.editorOL.mapa.zoomOut()},title:"afasta",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.legenda===true){button=new OpenLayers.Control.Button({displayClass:"editorOLlegenda",trigger:function(){i3GEO.editorOL.mostraLegenda()},title:"legenda",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.distancia===true){button=new OpenLayers.Control.Measure(OpenLayers.Handler.Path,{handlerOptions:{layerOptions:{styleMap:styleMap}},persist:true,displayClass:"editorOLdistancia",title:"distancia",type:OpenLayers.Control.TYPE_TOOL});button.events.on({"measure":function(event){var units=event.units,measure=event.measure;alert("Distancia: "+measure.toFixed(3)+" "+units)}});controles.push(button);adiciona=true}if(botoes.area===true){button=new OpenLayers.Control.Measure(OpenLayers.Handler.Polygon,{handlerOptions:{layerOptions:{styleMap:styleMap}},persist:true,displayClass:"editorOLarea",title:"area",type:OpenLayers.Control.TYPE_TOOL});button.events.on({"measure":function(event){var units=event.units;var measure=event.measure;alert("Área: "+measure.toFixed(3)+" "+units+" quadrados")}});controles.push(button);adiciona=true}if(botoes.identifica===true){botaoIdentifica=new OpenLayers.Control.WMSGetFeatureInfo({maxFeatures:1,infoFormat:'text/plain',layers:[i3GEO.editorOL.layerAtivo()],queryVisible:true,title:"identifica",type:OpenLayers.Control.TYPE_TOOL,displayClass:"editorOLidentifica",eventListeners:{getfeatureinfo:function(event){var lonlat=i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy),lonlattexto="<hr>",formata;if(botoes.linha===true||botoes.ponto===true||botoes.poligono===true||botoes.edita===true){lonlattexto+="<pre><span style=font-size:12px;color:blue;cursor:pointer onclick='i3GEO.editorOL.captura(\""+lonlat.lon+","+lonlat.lat+"\")'>edita geometria</span></pre><br>"}formata=function(texto){var temp,temp1,n,i,f=[],textoN=texto.split(":");try{if(textoN.length>1){temp=textoN[2].replace(/\n\r/g,"");temp=temp.replace(/'/g,"");temp=temp.replace(/\n/g,"|");temp=temp.replace(/_/g," ");temp=temp.replace(/=/g,":");temp=temp.split("|");n=temp.length;for(i=0;i<n;i++){temp1=temp[i].replace(/^\s+/,"");temp1=temp1.replace(/\s+$/,"");if(temp1!="")f.push(temp1)}texto=f.join("<br><br>")}}catch(e){}return texto};i3GEO.editorOL.mapa.addPopup(new OpenLayers.Popup.FramedCloud("chicken",i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy),null,"<div style=text-align:left >"+lonlattexto+"<pre>"+formata(event.text)+"</pre></div>",null,true));i3GEO.editorOL.removeClone()},beforegetfeatureinfo:function(event){var ativo=[i3GEO.editorOL.layerAtivo()];if(ativo[0].serviceVersion==="&tms="||ativo[0].CLASS_NAME=="OpenLayers.Layer.TMS"||ativo[0].CLASS_NAME=="OpenLayers.Layer.OSM"){ativo=[i3GEO.editorOL.layertms2wms(ativo[0])]}ativo[0].projection=new OpenLayers.Projection("EPSG:4326");event.object.layers=ativo;botaoIdentifica.layers=ativo;botaoIdentifica.url=ativo[0].url},activate:function(){i3GEO.editorOL.criaJanelaAtivaTema()}}});controles.push(botaoIdentifica);adiciona=true}if(botoes.linha===true){button=new OpenLayers.Control.DrawFeature(i3GEO.desenho.layergrafico,OpenLayers.Handler.Path,{displayClass:"editorOLlinha",title:"digitalizar linha",type:OpenLayers.Control.TYPE_TOOL,callbacks:{done:function(feature){var f=new OpenLayers.Feature.Vector(feature);f["attributes"]={opacidade:i3GEO.editorOL.simbologia.opacidade,texto:i3GEO.editorOL.simbologia.texto,fillColor:i3GEO.editorOL.simbologia.fillColor,strokeWidth:i3GEO.editorOL.simbologia.strokeWidth,strokeColor:i3GEO.editorOL.simbologia.strokeColor,pointRadius:i3GEO.editorOL.simbologia.pointRadius,graphicName:i3GEO.editorOL.simbologia.graphicName};i3GEO.desenho.layergrafico.addFeatures([f]);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}if(i3GEO.Interface&&i3GEO.Interface.openlayers&&i3GEO.Interface.openlayers.sobeLayersGraficos){i3GEO.Interface.openlayers.sobeLayersGraficos()}}}});controles.push(button);adiciona=true}if(botoes.ponto===true){button=new OpenLayers.Control.DrawFeature(i3GEO.desenho.layergrafico,OpenLayers.Handler.Point,{displayClass:"editorOLponto",title:"digitalizar ponto",type:OpenLayers.Control.TYPE_TOOL,callbacks:{done:function(feature){var f,style_mark;if(i3GEO.editorOL.simbologia.externalGraphic!=""){style_mark=OpenLayers.Util.extend({},OpenLayers.Feature.Vector.style['default']);style_mark.externalGraphic=i3GEO.editorOL.simbologia.externalGraphic;style_mark.graphicWidth=i3GEO.editorOL.simbologia.graphicWidth;style_mark.graphicHeight=i3GEO.editorOL.simbologia.graphicHeight;style_mark.fillOpacity=i3GEO.editorOL.simbologia.opacidade;f=new OpenLayers.Feature.Vector(feature,null,style_mark)}else{f=new OpenLayers.Feature.Vector(feature)}f["attributes"]={opacidade:i3GEO.editorOL.simbologia.opacidade,texto:i3GEO.editorOL.simbologia.texto,fillColor:i3GEO.editorOL.simbologia.fillColor,strokeWidth:i3GEO.editorOL.simbologia.strokeWidth,strokeColor:i3GEO.editorOL.simbologia.strokeColor,pointRadius:i3GEO.editorOL.simbologia.pointRadius,graphicName:i3GEO.editorOL.simbologia.graphicName,externalGraphic:i3GEO.editorOL.simbologia.externalGraphic,graphicHeight:i3GEO.editorOL.simbologia.graphicHeight,graphicWidth:i3GEO.editorOL.simbologia.graphicWidth};i3GEO.desenho.layergrafico.addFeatures([f]);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}if(i3GEO.Interface&&i3GEO.Interface.openlayers&&i3GEO.Interface.openlayers.sobeLayersGraficos){i3GEO.Interface.openlayers.sobeLayersGraficos()}}}});controles.push(button);adiciona=true}if(botoes.poligono===true){button=new OpenLayers.Control.DrawFeature(i3GEO.desenho.layergrafico,OpenLayers.Handler.Polygon,{displayClass:"editorOLpoligono",title:"digitalizar poligono",type:OpenLayers.Control.TYPE_TOOL,callbacks:{done:function(feature){var f=new OpenLayers.Feature.Vector(feature);f["attributes"]={opacidade:i3GEO.editorOL.simbologia.opacidade,texto:i3GEO.editorOL.simbologia.texto,fillColor:i3GEO.editorOL.simbologia.fillColor,strokeWidth:i3GEO.editorOL.simbologia.strokeWidth,strokeColor:i3GEO.editorOL.simbologia.strokeColor,pointRadius:i3GEO.editorOL.simbologia.pointRadius,graphicName:i3GEO.editorOL.simbologia.graphicName};i3GEO.desenho.layergrafico.addFeatures([f]);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}if(i3GEO.Interface&&i3GEO.Interface.openlayers&&i3GEO.Interface.openlayers.sobeLayersGraficos){i3GEO.Interface.openlayers.sobeLayersGraficos()}}}});controles.push(button);adiciona=true}if(botoes.texto===true){button=new OpenLayers.Control.DrawFeature(i3GEO.desenho.layergrafico,OpenLayers.Handler.Point,{displayClass:"editorOLtexto",title:"incluir texto",type:OpenLayers.Control.TYPE_TOOL,persist:true,callbacks:{done:function(feature){var texto=window.prompt("Texto",""),label=new OpenLayers.Feature.Vector(feature);label["attributes"]={opacidade:0.1,fillColor:"white",strokeWidth:i3GEO.editorOL.simbologia.strokeWidth,texto:texto,pointRadius:2,graphicName:"square",strokeColor:"black",fontColor:i3GEO.editorOL.simbologia.fontColor,fontSize:i3GEO.editorOL.simbologia.fontSize,fontFamily:"Arial",fontWeight:"bold",labelAlign:"rt"};if(texto&&texto!==""){i3GEO.desenho.layergrafico.addFeatures([label])}if(i3GEO.Interface&&i3GEO.Interface.openlayers&&i3GEO.Interface.openlayers.sobeLayersGraficos){i3GEO.Interface.openlayers.sobeLayersGraficos()}}}});controles.push(button);adiciona=true}if(botoes.edita===true&&botoes.corta===true&&i3GEO.php){i3GEO.editorOL.CortaFeature=new OpenLayers.Control.DrawFeature(i3GEO.desenho.layergrafico,OpenLayers.Handler.Polygon,{displayClass:"editorOLcorta",title:"corta figura",type:OpenLayers.Control.TYPE_TOOL,clickout:true,toggle:true,trigger:function(){if(i3GEO.desenho.layergrafico.selectedFeatures.length!=1){alert("Selecione primeiro um elemento para ser cortado");i3GEO.editorOL.CortaFeature.deactivate()}else{i3GEO.editorOL.CortaFeature.activate()}},callbacks:{done:function(feature){var temp,sel=i3GEO.desenho.layergrafico.selectedFeatures[0].geometry,corta=feature;temp=function(retorno){i3GEO.janela.fechaAguarde("i3GEO.cortador");if(retorno!=""&&retorno.data&&retorno.data!=""){i3GEO.editorOL.substituiFeaturesSel(retorno.data)}};i3GEO.janela.abreAguarde("i3GEO.cortador","Cortando");i3GEO.php.funcoesGeometriasWkt(temp,sel+"|"+corta,"difference")}}});controles.push(i3GEO.editorOL.CortaFeature);adiciona=true}if(botoes.edita===true){i3GEO.editorOL.ModifyFeature=new OpenLayers.Control.ModifyFeature(i3GEO.desenho.layergrafico,{displayClass:"editorOLedita",title:"modifica figura",type:OpenLayers.Control.TYPE_TOOL,clickout:true,toggle:true,mode:OpenLayers.Control.ModifyFeature.RESHAPE,standalone:false,createVertices:true,styleMap:"default",vertexRenderIntent:"vertex"});controles.push(i3GEO.editorOL.ModifyFeature);adiciona=true}if(botoes.edita===true&&botoes.listag===true){button=new OpenLayers.Control.Button({displayClass:"editorOLlistag",trigger:function(){i3GEO.editorOL.listaGeometrias()},title:"lista geometrias",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.frente===true){button=new OpenLayers.Control.Button({displayClass:"editorOLfrente",trigger:function(){i3GEO.editorOL.trazParaFrente();if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}},title:"traz para frente",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.tools===true&&i3GEO.php){button=new OpenLayers.Control.Button({displayClass:"editorOLtools",trigger:function(){if(i3GEO.php){i3GEO.editorOL.ferramentas()}else{i3GEO.editorOL.carregajts("i3GEO.editorOL.ferramentas()")}},title:"ferramentas",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.selecao===true){i3GEO.editorOL.selbutton=new OpenLayers.Control.SelectFeature(i3GEO.desenho.layergrafico,{displayClass:"editorOLselecao",title:"seleciona elemento",type:OpenLayers.Control.TYPE_TOOL,clickout:true,toggle:true,multiple:false,hover:false,toggleKey:"ctrlKey",multipleKey:"shiftKey",box:false});controles.push(i3GEO.editorOL.selbutton);adiciona=true}if(botoes.apaga===true){button=new OpenLayers.Control.Button({displayClass:"editorOLapaga",trigger:function(){if(i3GEO.desenho.layergrafico.selectedFeatures.length>0){var x=window.confirm("Exclui os elementos selecionados?");if(x){i3GEO.editorOL.guardaBackup();i3GEO.desenho.layergrafico.removeFeatures(i3GEO.desenho.layergrafico.selectedFeatures);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}}}else{alert("Selecione pelo menos um elemento")}},title:"apaga selecionados",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.propriedades===true){button=new OpenLayers.Control.Button({displayClass:"editorOLpropriedades",trigger:function(){i3GEO.editorOL.propriedades()},title:"propriedades",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.salva===true){button=new OpenLayers.Control.Button({displayClass:"editorOLsalva",trigger:function(){i3GEO.editorOL.salvaGeometrias()},title:"salva",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.ajuda===true){button=new OpenLayers.Control.Button({displayClass:"editorOLajuda",trigger:function(){try{window.open(i3GEO.configura.locaplic+"/mashups/openlayers_ajuda.php")}catch(e){window.open("openlayers_ajuda.php")}},title:"ajuda",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.fecha===true){button=new OpenLayers.Control.Button({displayClass:"editorOLfecha",trigger:function(){var temp=window.confirm("Remove a edicao?");if(i3GEO.eventos){i3GEO.eventos.cliquePerm.ativa()}i3GEOpanelEditor.destroy();try{YAHOO.temaativo.container.panel.destroy()}catch(e){}try{YAHOO.procura.container.panel.destroy()}catch(e){}try{YAHOO.editorOL.container.panel.destroy()}catch(e){}try{YAHOO.editorOL.listaGeometrias.panel.destroy()}catch(e){}try{YAHOO.editorOL.ferramentas.panel.destroy()}catch(e){}try{YAHOO.legendaeditorOL.container.panel.destroy()}catch(e){}try{YAHOO.salvaGeometrias.container.panel.destroy()}catch(e){}if(temp===true){try{if(i3GEO.desenho.layergrafico){i3GEO.editorOL.mapa.removeLayer(i3GEO.desenho.layergrafico);delete(i3GEO.desenho.layergrafico)}if(i3GEO.editorOL.backup){i3GEO.editorOL.mapa.removeLayer(i3GEO.editorOL.backup);delete(i3GEO.editorOL.backup)}}catch(e){}}},title:"fecha editor",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}i3GEOOLsnap=new OpenLayers.Control.Snapping({layer:i3GEO.desenho.layergrafico});i3GEOOLsplit=new OpenLayers.Control.Split({layer:i3GEO.desenho.layergrafico,source:i3GEO.desenho.layergrafico,tolerance:0.0001,eventListeners:{beforesplit:function(event){i3GEO.editorOL.guardaBackup()},aftersplit:function(event){i3GEO.editorOL.flashFeatures(event.features);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}}}});if(adiciona===true){i3GEOpanelEditor.addControls(controles);i3GEO.editorOL.mapa.addControl(i3GEOpanelEditor)}},mudaSimbolo:function(estilo,id){var valor=$i(id).value,geos=i3GEO.desenho.layergrafico.selectedFeatures,n=geos.length,i;i3GEO.editorOL.simbologia[estilo]=valor;for(i=0;i<n;i++){geos[i].attributes[estilo]=valor;geos[i].style[estilo]=valor}},adicionaMarcas:function(){if(i3GEO.editorOL.pontos.length===0){return}var SHADOW_Z_INDEX=10,MARKER_Z_INDEX=11,layer=new OpenLayers.Layer.Vector("pontos",{styleMap:new OpenLayers.StyleMap({externalGraphic:i3GEO.editorOL.marca,backgroundGraphic:"../pacotes/openlayers/img/marker_shadow.png",backgroundXOffset:0,backgroundYOffset:-7,graphicZIndex:MARKER_Z_INDEX,backgroundGraphicZIndex:SHADOW_Z_INDEX,pointRadius:10}),isBaseLayer:false,rendererOptions:{yOrdering:true},displayInLayerSwitcher:true,visibility:true}),index,x=[],y=[],features=[];for(index=0;index<i3GEO.editorOL.pontos.length;index=index+2){x.push(i3GEO.editorOL.pontos[index]);y.push(i3GEO.editorOL.pontos[index+1])}for(index=0;index<x.length;index++){features.push(new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(x[index],y[index])))}layer.addFeatures(features);i3GEO.editorOL.mapa.addLayer(layer)},adicionaKml:function(){var temp,n,i,id,url;n=i3GEO.editorOL.kml.length;for(i=0;i<n;i++){id="kml"+i;url=i3GEO.editorOL.kml[i];eval(id+" = new OpenLayers.Layer.Vector('"+id+"', {displayOutsideMaxExtent:true,displayInLayerSwitcher:false,visibility:true, strategies: [new OpenLayers.Strategy.Fixed()],protocol: new OpenLayers.Protocol.HTTP({url: '"+url+"',format: new OpenLayers.Format.KML({extractStyles: true,extractAttributes: true,maxDepth: 5})})})");eval("i3GEO.editorOL.mapa.addLayer("+id+");");eval("temp = "+id+".div;");temp.onclick=function(e){var targ="",id,temp,features,n,i,g,html="";if(!e){e=window.event}if(e.target){targ=e.target}else{if(e.srcElement){targ=e.srcElement}}if(targ.id){temp=targ.id.split("_");if(temp[0]==="OpenLayers.Geometry.Point"){id=targ.id;temp=i3GEO.editorOL.mapa.getLayer(this.id);features=temp.features;n=features.length;for(i=0;i<n;i++){if(features[i].geometry.id===id){for(var j in features[i].attributes){html+=j+": "+features[i].attributes[j]}g=features[i].geometry;i3GEO.editorOL.mapa.addPopup(new OpenLayers.Popup.FramedCloud("kml",new OpenLayers.LonLat(g.x,g.y),null,html,null,true))}}}}}}},propriedades:function(){if(!document.getElementById("panelpropriedadesEditor")){YAHOO.namespace("editorOL.container");YAHOO.editorOL.container.panel=new YAHOO.widget.Panel("panelpropriedadesEditor",{zIndex:20000,iframe:true,width:"350px",height:"250px",visible:false,draggable:true,close:true});var ins=""+'<p class=paragrafo ><b>Estilos (utilize a cor no formato r,g,b):</b></p>'+'<table class=lista7 >'+' <tr>'+' <td>Cor do contorno</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'strokeColor\',\'i3GEOEditorOLcorContorno\')" type="text" style="cursor:text" id="i3GEOEditorOLcorContorno" size="12" value="'+i3GEO.editorOL.simbologia.strokeColor+'" /></td><td>';if(i3GEO.configura){ins+='<img alt="aquarela.gif" style=cursor:pointer src="'+i3GEO.configura.locaplic+'/imagens/aquarela.gif" onclick="i3GEO.util.abreCor(\'\',\'i3GEOEditorOLcorContorno\');" />'}ins+=""+' </td>'+' </tr>'+' <tr>'+' <td>Cor do preenchimento</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'fillColor\',\'i3GEOEditorOLcorPre\')" type="text" style="cursor:text" id="i3GEOEditorOLcorPre" size="12" value="'+i3GEO.editorOL.simbologia.fillColor+'" /></td><td>';if(i3GEO.configura){ins+='<img alt="aquarela.gif" style=cursor:pointer src="'+i3GEO.configura.locaplic+'/imagens/aquarela.gif" onclick="i3GEO.util.abreCor(\'\',\'i3GEOEditorOLcorPre\');" />'}ins+=""+' </td>'+' </tr>'+' <tr>'+' <td>Cor da fonte</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'fontColor\',\'i3GEOEditorOLcorFonte\')" type="text" style="cursor:text" id="i3GEOEditorOLcorFonte" size="12" value="'+i3GEO.editorOL.simbologia.fontColor+'" /></td><td>';if(i3GEO.configura){ins+='<img alt="aquarela.gif" style=cursor:pointer src="'+i3GEO.configura.locaplic+'/imagens/aquarela.gif" onclick="i3GEO.util.abreCor(\'\',\'i3GEOEditorOLcorFonte\');" />'}ins+=""+' </td>'+' </tr>'+' <tr>'+' <td>Tamanho da fonte</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'fontSize\',\'i3GEOEditorOLfontsize\')" type="text" style="cursor:text" id="i3GEOEditorOLfontsize" size="3" value="'+i3GEO.editorOL.simbologia.fontSize+'" /></td><td></td>'+' </tr>'+' <tr>'+' <td>Opacidade (de 0 a 1)</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'opacidade\',\'i3GEOEditorOLopacidade\')" type="text" style="cursor:text" id="i3GEOEditorOLopacidade" size="3" value="'+i3GEO.editorOL.simbologia.opacidade+'" /></td><td></td>'+' </tr>'+' <tr>'+' <td>Largura da linha/contorno</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'strokeWidth\',\'i3GEOEditorOLlarguraLinha\')" type="text" style="cursor:text" id="i3GEOEditorOLlarguraLinha" size="2" value="'+i3GEO.editorOL.simbologia.strokeWidth+'" /></td><td></td>'+' </tr>'+' <tr>'+' <td>Url de uma figura</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'externalGraphic\',\'i3GEOEditorOLexternalGraphic\')" type="text" style="cursor:text" id="i3GEOEditorOLexternalGraphic" size="22" value="'+i3GEO.editorOL.simbologia.externalGraphic+'" /></td><td></td>'+' </tr>'+' <tr>'+' <td>Largura e altura</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'graphicWidth\',\'i3GEOEditorOLgraphicWidth\')" type="text" style="cursor:text" id="i3GEOEditorOLgraphicWidth" size="4" value="'+i3GEO.editorOL.simbologia.graphicWidth+'" /> <input onchange="i3GEO.editorOL.mudaSimbolo(\'graphicHeight\',\'i3GEOEditorOLgraphicHeight\')" type="text" style="cursor:text" id="i3GEOEditorOLgraphicHeight" size="4" value="'+i3GEO.editorOL.simbologia.graphicHeight+'" /></td><td></td>'+' </tr>'+'</table>'+'<br />'+'<p class=paragrafo ><b>Ajusta nó em edição para o(a):</b></p>'+'<table class=lista7 >'+' <tr>'+' <td></td><td>nó</td><td></td><td>vértice</td><td></td><td>borda</td>'+' </tr>'+' <tr>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.snap()" type="checkbox" id="target_node" /></td><td><input onchange="i3GEO.editorOL.snap()" id="target_nodeTolerance" type="text" size="3" value=15 /></td>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.snap()" type="checkbox" id="target_vertex" /></td><td><input onchange="i3GEO.editorOL.snap()" id="target_vertexTolerance" type="text" size="3" value=15 /></td>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.snap()" type="checkbox" id="target_edge" /></td><td><input onchange="i3GEO.editorOL.snap()" id="target_edgeTolerance" type="text" size="3" value=15 /></td>'+' </tr>'+'</table>'+'<br />'+'<p class=paragrafo ><b>Divide intersecção ao digitalizar</b></p>'+'<table class=lista7 >'+' <tr>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.split()" type="checkbox" id="edge_split_toggle" /></td><td>borda</td>'+' </tr>'+'</table>'+'<br />'+'<p class=paragrafo ><b>Operação ativada pelo botão de modificação da figura</b></p>'+'<table class=lista7 >'+' <tr>'+' <td><input checked style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.RESHAPE;" type="radio" name=i3geoOLtipoEdita /></td><td>altera figura</td>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.RESIZE;" type="radio" name=i3geoOLtipoEdita /></td><td>altera tamanho</td>'+' </tr>'+' <tr>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.ROTATE;" type="radio" name=i3geoOLtipoEdita /></td><td>rotaciona</td>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.DRAG;" type="radio" name=i3geoOLtipoEdita /></td><td>desloca</td>'+' </tr>'+'</table>';YAHOO.editorOL.container.panel.setBody(ins);if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){YAHOO.editorOL.container.panel.setHeader("Propriedades<div id='panelpropriedadesEditor_minimizaCabecalho' class='container-minimiza'></div>")}else{YAHOO.editorOL.container.panel.setHeader("Propriedades")}YAHOO.editorOL.container.panel.setFooter("");YAHOO.editorOL.container.panel.render(document.body);YAHOO.editorOL.container.panel.center();YAHOO.util.Event.addListener(YAHOO.editorOL.container.panel.close,"click",function(){});temp=$i("panelpropriedadesEditor_minimizaCabecalho");if(temp){temp.onclick=function(){i3GEO.janela.minimiza("panelpropriedadesEditor")}}}YAHOO.editorOL.container.panel.show();temp=$i("panelpropriedadesEditor").getElementsByTagName("div");if(temp&&temp[2]){temp[2].style.overflow="auto"}},listaGeometrias:function(){if(!document.getElementById("panellistagEditor")){YAHOO.namespace("editorOL.listaGeometrias");YAHOO.editorOL.listaGeometrias.panel=new YAHOO.widget.Panel("panellistagEditor",{zIndex:20000,iframe:true,width:"320px",visible:false,draggable:true,close:true});if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){YAHOO.editorOL.listaGeometrias.panel.setHeader("Geometrias <div id='panellistagEditor_minimizaCabecalho' class='container-minimiza'></div>")}else{YAHOO.editorOL.listaGeometrias.panel.setHeader("Geometrias")}YAHOO.editorOL.listaGeometrias.panel.setFooter("");YAHOO.editorOL.listaGeometrias.panel.render(document.body);YAHOO.editorOL.listaGeometrias.panel.center();YAHOO.util.Event.addListener(YAHOO.editorOL.listaGeometrias.panel.close,"click",function(){YAHOO.editorOL.listaGeometrias.panel.destroy()});temp=$i("panellistagEditor_minimizaCabecalho");if(temp){temp.onclick=function(){i3GEO.janela.minimiza("panellistagEditor")}}}else{YAHOO.editorOL.listaGeometrias.panel.render(document.body)}var g,temp,geos=i3GEO.desenho.layergrafico.features,n=geos.length,ins="<table class=lista4 >";ins+="<tr><td><i>Geometrias</i></td><td><i>Opções</i></td><td></td><td></td></tr>";while(n>0){n-=1;g=geos[n].geometry;ins+="<tr><td>"+g.CLASS_NAME+"</td><td style='cursor:pointer;color:blue' onclick='javascript:i3GEO.editorOL.selFeature("+n+")'>seleciona</td><td style='cursor:pointer;color:blue' onclick='javascript:i3GEO.editorOL.unselFeature("+n+")'>limpa</td><td style='cursor:pointer;color:blue' onclick='javascript:i3GEO.editorOL.flashFeaturesI("+n+")'>brilha</td></tr>"}ins+="</table>";if(geos.length===0){ins="Nenhum elemento gráfico encontrado. Utilize as opções de criação de geometrias."}YAHOO.editorOL.listaGeometrias.panel.show();if(i3GEO.configura){temp=$i("panellistagEditor").getElementsByTagName("div")[2]}else{temp=$i("panellistagEditor").getElementsByTagName("div")[1]}temp.style.overflow="auto";temp.style.height="100px";temp.innerHTML=ins},ferramentas:function(){if(!document.getElementById("panelferramentasEditor")){YAHOO.namespace("editorOL.ferramentas");YAHOO.editorOL.ferramentas.panel=new YAHOO.widget.Panel("panelferramentasEditor",{zIndex:20000,iframe:true,width:"300px",visible:false,draggable:true,close:true});var ins=""+'<p class=paragrafo >Operações sobre as figuras selecionadas:</p>'+'<select onchange="i3GEO.editorOL.processageo(this.value);this.value = \'\'" >'+' <option value="">---</option>'+' <option value=union >União</option>';if(i3GEO.php){ins+=' <option value=intersection >Intersecção</option>'+' <option value=convexhull >Convex hull</option>'+' <option value=boundary >Bordas</option>'+' <option value=difference >Diferença</option>'+' <option value=symdifference >Diferença simétrica</option>'}ins+='</select>'+'<br><br><a class=paragrafo href=# onclick="i3GEO.desenho.layergrafico.destroyFeatures()" >Apaga tudo</a>';YAHOO.editorOL.ferramentas.panel.setBody(ins);if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){YAHOO.editorOL.ferramentas.panel.setHeader("Ferramentas <div id='panelferramentasEditor_minimizaCabecalho' class='container-minimiza'></div>")}else{YAHOO.editorOL.ferramentas.panel.setHeader("Ferramentas")}YAHOO.editorOL.ferramentas.panel.setFooter("");YAHOO.editorOL.ferramentas.panel.render(document.body);YAHOO.editorOL.ferramentas.panel.center();YAHOO.util.Event.addListener(YAHOO.editorOL.ferramentas.panel.close,"click",function(){});temp=$i("panelferramentasEditor_minimizaCabecalho");if(temp){temp.onclick=function(){i3GEO.janela.minimiza("panelferramentasEditor")}}}else{YAHOO.editorOL.ferramentas.panel.render(document.body)}YAHOO.editorOL.ferramentas.panel.show()},snap:function(){var target=i3GEOOLsnap.targets[0],tipos=["node","vertex","edge"],ntipos=tipos.length,i,temp,ativa=false;i3GEOOLsnap.deactivate();for(i=0;i<ntipos;i++){temp=$i("target_"+tipos[i]);target[tipos[i]]=temp.checked;if(temp.checked===true){ativa=true}temp=$i("target_"+tipos[i]+"Tolerance");target[tipos[i]+"Tolerance"]=temp.value}if(ativa===true){i3GEOOLsnap.activate()}},split:function(){i3GEOOLsplit.deactivate();var temp=$i("edge_split_toggle");if(temp.checked===true){i3GEOOLsplit.activate()}},processageo:function(operacao){if(operacao===""){return}var geosel=i3GEO.desenho.layergrafico.selectedFeatures,polis,linhas,pontos,temp;if(geosel.length>0){polis=i3GEO.editorOL.retornaGeometriasTipo(geosel,"OpenLayers.Geometry.Polygon");linhas=i3GEO.editorOL.retornaGeometriasTipo(geosel,"OpenLayers.Geometry.LineString");pontos=i3GEO.editorOL.retornaGeometriasTipo(geosel,"OpenLayers.Geometry.Point");temp=function(retorno){if(i3GEO.janela){i3GEO.janela.fechaAguarde("i3GEO.editorPoli");i3GEO.janela.fechaAguarde("i3GEO.editorLinhas");i3GEO.janela.fechaAguarde("i3GEO.editorPontos")}if(retorno!=""&&retorno.data&&retorno.data!=""&&operacao!="converteSHP"){i3GEO.editorOL.substituiFeaturesSel(retorno.data)}if(operacao==="converteSHP"){i3GEO.atualiza();i3GEO.janela.minimiza("paneltemaativo")}};if(operacao==="union"&&!i3GEO.php){if(polis.length>0){temp=i3GEO.editorOL.uniaojts(polis);i3GEO.editorOL.substituiFeaturesSel(temp)}if(linhas.length>0){temp=i3GEO.editorOL.uniaojts(linhas);i3GEO.editorOL.substituiFeaturesSel(temp)}if(pontos.length>0){temp=i3GEO.editorOL.uniaojts(p);i3GEO.editorOL.substituiFeaturesSel(temp)}}else{if(polis.length>0){i3GEO.janela.abreAguarde("i3GEO.editorPoli","Poligonos");i3GEO.php.funcoesGeometriasWkt(temp,polis.join("|"),operacao)}if(linhas.length>0){i3GEO.janela.abreAguarde("i3GEO.editorLinhas","Linhas");i3GEO.php.funcoesGeometriasWkt(temp,linhas.join("|"),operacao)}if(pontos.length>0){i3GEO.janela.abreAguarde("i3GEO.editorPontos","Pontos");i3GEO.php.funcoesGeometriasWkt(temp,pontos.join("|"),operacao)}}return}else{alert("Selecione pelo menos dois elementos")}},uniaojts:function(geoms){var n=geoms.length,rwkt=new jsts.io.WKTReader(),wwkt=new jsts.io.WKTWriter(),fwkt=new OpenLayers.Format.WKT(),g,i,uniao;if(n>1){uniao=(fwkt.read(geoms[0]).geometry).toString();uniao=rwkt.read(uniao);for(i=1;i<=n;i++){g=(fwkt.read(geoms[i]).geometry).toString();uniao=uniao.union(rwkt.read(g))}uniao=wwkt.write(uniao);return[fwkt.read(uniao)]}else{return false}},retornaGeometriasTipo:function(features,tipo){var n=features.length,lista=[],i,temp;for(i=0;i<n;i++){temp=features[i].geometry;if(temp.CLASS_NAME==tipo){lista.push(temp)}}return lista},guardaBackup:function(){return;if(!i3GEO.editorOL.backup){i3GEO.editorOL.backup=new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false})}else{i3GEO.editorOL.backup.removeFeatures(i3GEO.editorOL.backup.features)}i3GEO.editorOL.backup.addFeatures(i3GEO.desenho.layergrafico.features)},unselTodos:function(){var n,i;n=i3GEO.desenho.layergrafico.features.length;for(i=0;i<n;i++){i3GEO.desenho.layergrafico.features[i].renderIntent="default";i3GEO.editorOL.selbutton.unselect(i3GEO.desenho.layergrafico.features[i])}},unselTodosBackup:function(){var n,i;n=i3GEO.editorOL.backup.features.length;for(i=0;i<n;i++){i3GEO.editorOL.backup.features[i].renderIntent="default";i3GEO.editorOL.selbutton.unselect(i3GEO.editorOL.backup.features[i])}},restauraBackup:function(){if(i3GEO.editorOL.backup.features.length>0){i3GEO.desenho.layergrafico.removeFeatures(i3GEO.desenho.layergrafico.features);i3GEO.desenho.layergrafico.addFeatures(i3GEO.editorOL.backup.features)}if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}},substituiFeaturesSel:function(wkt){i3GEO.editorOL.guardaBackup();try{var f,fwkt=new OpenLayers.Format.WKT();i3GEO.desenho.layergrafico.removeFeatures(i3GEO.desenho.layergrafico.selectedFeatures);f=fwkt.read(wkt);f["attributes"]={opacidade:i3GEO.editorOL.simbologia.opacidade,texto:i3GEO.editorOL.simbologia.texto,fillColor:i3GEO.editorOL.simbologia.fillColor,strokeWidth:i3GEO.editorOL.simbologia.strokeWidth,strokeColor:i3GEO.editorOL.simbologia.strokeColor,pointRadius:i3GEO.editorOL.simbologia.pointRadius,graphicName:i3GEO.editorOL.simbologia.graphicName};i3GEO.desenho.layergrafico.addFeatures([f]);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}}catch(e){i3GEO.editorOL.restauraBackup()}},adicionaFeatureWkt:function(wkt,atributos){var f,fwkt=new OpenLayers.Format.WKT();if(atributos.externalGraphic&&atributos.externalGraphic!=""){var style_mark=OpenLayers.Util.extend({},OpenLayers.Feature.Vector.style['default']);style_mark.externalGraphic=atributos.externalGraphic;style_mark.graphicWidth=atributos.graphicWidth;style_mark.graphicHeight=atributos.graphicHeight;style_mark.fillOpacity=atributos.opacidade;f=fwkt.read(wkt);f["attributes"]=atributos;f["style"]=style_mark}else{f=fwkt.read(wkt);f["attributes"]=atributos}i3GEO.desenho.layergrafico.addFeatures([f]);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}},flashFeaturesI:function(index){i3GEO.editorOL.flashFeatures([i3GEO.desenho.layergrafico.features[index]],0)},flashFeatures:function(features,index){if(!index){index=0}var current=features[index];if(current&¤t.layer===i3GEO.desenho.layergrafico){i3GEO.desenho.layergrafico.drawFeature(features[index],"select")}var prev=features[index-1];if(prev&&prev.layer===i3GEO.desenho.layergrafico){i3GEO.desenho.layergrafico.drawFeature(prev,"default")}++index;if(index<=features.length){window.setTimeout(function(){i3GEO.editorOL.flashFeatures(features,index)},75)}},selFeature:function(index){i3GEO.editorOL.selbutton.select(i3GEO.desenho.layergrafico.features[index])},unselFeature:function(index){i3GEO.editorOL.selbutton.unselect(i3GEO.desenho.layergrafico.features[index])},carregajts:function(funcao){if(i3GEO.configura){i3GEO.util.scriptTag(i3GEO.configura.locaplic+"/pacotes/jsts/lib/jsts.js",funcao,"i3GEOjts",true)}else{i3GEO.util.scriptTag("../pacotes/jsts/lib/jsts.js",funcao,"i3GEOjts",true)}},trazParaFrente:function(){var features=i3GEO.desenho.layergrafico.selectedFeatures;if(features.length>0){i3GEO.editorOL.backup=new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false});i3GEO.editorOL.backup.addFeatures(features);i3GEO.editorOL.unselTodosBackup();i3GEO.desenho.layergrafico.removeFeatures(features);i3GEO.desenho.layergrafico.addFeatures(i3GEO.editorOL.backup.features);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}}else{alert("Selecione pelo menos um elemento")}},pegaControle:function(classe){var n=i3GEO.editorOL.controles.length,i;for(i=0;i<n;i++){if(i3GEO.editorOL.controles[i].CLASS_NAME===classe){return i3GEO.editorOL.controles[i]}}return false},ativaLayerSwitcher:function(){var ls=i3GEO.editorOL.pegaControle("OpenLayers.Control.LayerSwitcher");if(ls){ls.maximizeDiv.click()}},desativaRodaDoMouse:function(){var controls=i3GEO.editorOL.mapa.getControlsByClass('OpenLayers.Control.Navigation');for(var i=0;i<controls.length;++i){controls[i].disableZoomWheel()}},google2wgs:function(obj){if(i3GEO.Interface.openlayers.googleLike===true){var projWGS84=new OpenLayers.Projection("EPSG:4326"),proj900913=new OpenLayers.Projection("EPSG:900913");return obj.transform(proj900913,projWGS84)}else{return obj}}}; | ... | ... |
mashups/openlayers_compacto.js.php
... | ... | @@ -1479,6 +1479,7 @@ c);b.matrixIds.push(c)},ScaleDenominator:function(a,b){b.scaleDenominator=parseF |
1479 | 1479 | MatrixWidth:function(a,b){b.matrixWidth=parseInt(this.getChildValue(a))},MatrixHeight:function(a,b){b.matrixHeight=parseInt(this.getChildValue(a))},ResourceURL:function(a,b){b.resourceUrl=b.resourceUrl||{};var c=a.getAttribute("resourceType");b.resourceUrls||(b.resourceUrls=[]);c=b.resourceUrl[c]={format:a.getAttribute("format"),template:a.getAttribute("template"),resourceType:c};b.resourceUrls.push(c)},WSDL:function(a,b){b.wsdl={};b.wsdl.href=a.getAttribute("xlink:href")},ServiceMetadataURL:function(a, |
1480 | 1480 | b){b.serviceMetadataUrl={};b.serviceMetadataUrl.href=a.getAttribute("xlink:href")},LegendURL:function(a,b){b.legend={};b.legend.href=a.getAttribute("xlink:href");b.legend.format=a.getAttribute("format")},Dimension:function(a,b){var c={values:[]};this.readChildNodes(a,c);b.dimensions.push(c)},Default:function(a,b){b["default"]=this.getChildValue(a)},Value:function(a,b){b.values.push(this.getChildValue(a))}},ows:OpenLayers.Format.OWSCommon.v1_1_0.prototype.readers.ows},CLASS_NAME:"OpenLayers.Format.WMTSCapabilities.v1_0_0"}); |
1481 | 1481 | if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.desenho={layergrafico:null,estilos:{"normal":{fillcolor:'#ffffff',linecolor:'#000000',linewidth:'2',circcolor:'#ffffff',textcolor:'#787A78'},"palido":{fillcolor:'#B5A8A8',linecolor:'#BAA4AE',linewidth:'1',circcolor:'#E0D7DC',textcolor:'#787A78'},"vermelho":{fillcolor:'#E8ACAC',linecolor:'#F50707',linewidth:'1',circcolor:'#F09EA6',textcolor:'#787A78'},"verde":{fillcolor:'#3CCC2F',linecolor:'#0C6642',linewidth:'1',circcolor:'#C7D9D2',textcolor:'#787A78'}},estilosOld:{"normal":{fillcolor:'red',linecolor:'black',linewidth:'1',circcolor:'white',textcolor:'gray'},"palido":{fillcolor:'gray',linecolor:'gray',linewidth:'1',circcolor:'gray',textcolor:'gray'},"vermelho":{fillcolor:'gray',linecolor:'red',linewidth:'1',circcolor:'pink',textcolor:'brown'},"verde":{fillcolor:'gray',linecolor:'green',linewidth:'1',circcolor:'DarkGreen',textcolor:'GreenYellow'}},estiloPadrao:"normal",openlayers:{inicia:function(){if(!i3GEO.desenho.layergrafico){i3GEO.desenho.openlayers.criaLayerGrafico()}},criaLayerGrafico:function(){if(!i3GEO.desenho.layergrafico){var sketchSymbolizers={"Point":{fillColor:"rgb(${fillColor})",fillOpacity:"${opacidade}",strokeWidth:"${strokeWidth}",strokeOpacity:"${opacidade}",strokeColor:"rgb(${strokeColor})",label:"${texto}",pointRadius:"${pointRadius}",graphicName:"${graphicName}",fontSize:"${fontSize}",fontColor:"rgb(${fontColor})",fontFamily:"Arial",fontWeight:"normal",labelAlign:"lb",labelXOffset:"3",labelYOffset:"3",externalGraphic:"${externalGraphic}"},"Line":{strokeWidth:"${strokeWidth}",strokeOpacity:"${opacidade}",strokeColor:"rgb(${strokeColor})"},"Polygon":{strokeWidth:"${strokeWidth}",strokeOpacity:"${opacidade}",strokeColor:"rgb(${strokeColor})",fillColor:"rgb(${fillColor})",fillOpacity:"${opacidade}",zIndex:5000}},style=new OpenLayers.Style(),styleMap1=new OpenLayers.StyleMap({"default":style,"vertex":{strokeOpacity:1,strokeWidth:1,fillColor:"white",fillOpacity:0.45,pointRadius:4}},{extendDefault:false});style.addRules([new OpenLayers.Rule({symbolizer:sketchSymbolizers})]);i3GEO.desenho.layergrafico=new OpenLayers.Layer.Vector("Graf",{styleMap:styleMap1,displayInLayerSwitcher:true,visibility:true,vertexRenderIntent:"vertex"});if(i3GEO.editorOL&&i3GEO.editorOL.mapa){i3GEO.editorOL.mapa.addLayers([i3GEO.desenho.layergrafico])}else{i3geoOL.addLayers([i3GEO.desenho.layergrafico])}}}},googlemaps:{shapes:[],inicia:function(){},getFeaturesByAttribute:function(atributo,valor){var i,s=[],n=i3GEO.desenho.googlemaps.shapes.length;for(i=0;i<n;i++){if(i3GEO.desenho.googlemaps.shapes[i]&&i3GEO.desenho.googlemaps.shapes[i]!=""){if(i3GEO.desenho.googlemaps.shapes[i][atributo]==valor){s.push(i3GEO.desenho.googlemaps.shapes[i])}}}return s},destroyFeatures:function(f){if(f){var i,n=f.length;for(i=0;i<n;i++){f[i].setMap(null);f[i]=""}}}},googleearth:{insereMarca:function(description,ddx,ddy,name,snippet){var placemark=i3GeoMap.createPlacemark(''),point=i3GeoMap.createPoint('');placemark.setName(name);point.setLatitude(ddy);point.setLongitude(ddx);placemark.setGeometry(point);if(description!==""){placemark.setDescription(description)}placemark.setSnippet(snippet);i3GeoMap.getFeatures().appendChild(placemark)},insereCirculo:function(centerLng,centerLat,radius,name,snippet){function makeCircle(centerLat,centerLng,radius){var ring=i3GeoMap.createLinearRing(''),steps=25,i,pi2=Math.PI*2,lat,lng;for(i=0;i<steps;i++){lat=centerLat+radius*Math.cos(i/steps*pi2);lng=centerLng+radius*Math.sin(i/steps*pi2);ring.getCoordinates().pushLatLngAlt(lat,lng,0)}return ring}var polygonPlacemark=i3GeoMap.createPlacemark(''),poly=i3GeoMap.createPolygon(''),polyStyle;poly.setAltitudeMode(i3GeoMap.ALTITUDE_RELATIVE_TO_GROUND);polygonPlacemark.setGeometry(poly);polygonPlacemark.getGeometry().setOuterBoundary(makeCircle(centerLat,centerLng,radius));polygonPlacemark.setName(name);polygonPlacemark.setSnippet(snippet);polygonPlacemark.setStyleSelector(i3GeoMap.createStyle(''));polyStyle=polygonPlacemark.getStyleSelector().getPolyStyle();polyStyle.setFill(0);i3GeoMap.getFeatures().appendChild(polygonPlacemark)},insereLinha:function(xi,yi,xf,yf,name,snippet){var lineStringPlacemark=i3GeoMap.createPlacemark(''),lineString,lineStyle;lineStringPlacemark.setName(name);lineString=i3GeoMap.createLineString('');lineString.setAltitudeMode(i3GeoMap.ALTITUDE_RELATIVE_TO_GROUND);lineStringPlacemark.setGeometry(lineString);lineString.getCoordinates().pushLatLngAlt(yi,xi,0);lineString.getCoordinates().pushLatLngAlt(yf,xf,0);lineStringPlacemark.setStyleSelector(i3GeoMap.createStyle(''));lineStringPlacemark.setSnippet(snippet);lineStyle=lineStringPlacemark.getStyleSelector().getLineStyle();lineStyle.setWidth(3);i3GeoMap.getFeatures().appendChild(lineStringPlacemark)},removePlacemark:function(nome){var features=i3GeoMap.getFeatures(),n=features.getChildNodes().getLength(),i,nfeatures=[];for(i=0;i<n;i++){try{if(features.getChildNodes().item(i).getName()===nome||features.getChildNodes().item(i).getDescription()===nome||features.getChildNodes().item(i).getSnippet()===nome){nfeatures.push(features.getChildNodes().item(i))}}catch(e){}}n=nfeatures.length;for(i=0;i<n;i++){features.removeChild(nfeatures[i])}}},caixaEstilos:function(){var lista=i3GEO.util.listaChaves(i3GEO.desenho.estilos),n=lista.length,i,caixa,sel;caixa="<select onchange='i3GEO.desenho.definePadrao(this.value)'>";for(i=0;i<n;i+=1){sel="";if(lista[i]===i3GEO.desenho.estiloPadrao){sel="select"}caixa+="<option value='"+lista[i]+"'"+sel+">"+lista[i]+"</option>"}caixa+="</select>";return caixa}}; |
1482 | -if(!i3GEO||typeof(i3GEO)==='undefined'){var i3GEO={};navn=false;navm=false;$i=function(id){return document.getElementById(id)};app=navigator.appName.substring(0,1);if(app==='N'){navn=true}else{navm=true}OpenLayers.ImgPath="../pacotes/openlayers/img/";OpenLayers.Lang.setCode("pt-BR")}i3GEO.editorOL={simbologia:{opacidade:0.8,texto:"",fillColor:"250,180,15",strokeWidth:2,strokeColor:"250,150,0",pointRadius:4,graphicName:"square",fontSize:"12px",fontColor:"0,0,0",externalGraphic:"",graphicHeight:25,graphicWidth:25},backup:new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false}),nomeFuncaoSalvar:"i3GEO.editorOL.salvaGeo()",e_oce:new OpenLayers.Layer.ArcGIS93Rest("ESRI Ocean Basemap","http://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer/export",{format:"jpeg"},{isBaseLayer:true,visibility:false}),e_ims:new OpenLayers.Layer.ArcGIS93Rest("ESRI Imagery World 2D","http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer/export",{format:"jpeg"},{isBaseLayer:true,visibility:false}),e_wsm:new OpenLayers.Layer.ArcGIS93Rest("ESRI World Street Map","http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer/export",{format:"jpeg"},{isBaseLayer:true,visibility:false}),ol_mma:new OpenLayers.Layer.WMS("Base cartográfica","http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseraster.map&",{layers:'baseraster',SRS:'EPSG:4618',FORMAT:'image/png'},{singleTile:false}),ol_wms:new OpenLayers.Layer.WMS("OpenLayers WMS","http://labs.metacarta.com/wms/vmap0",{layers:'basic'}),top_wms:new OpenLayers.Layer.WMS("Toponímia MMA","http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseref.map&",{layers:"base",FORMAT:'image/png'}),est_wms:new OpenLayers.Layer.WMS("Estados do Brasil","http://mapas.mma.gov.br/i3geo/ogc.php?tema=estadosl&",{layers:"estadosl",FORMAT:'image/png'}),osm:new OpenLayers.Layer.OSM("OSM","http://tile.openstreetmap.org/${z}/${x}/${y}.png",{isBaseLayer:true,visibility:false}),fundo:"e_ims,e_wsm,ol_mma,ol_wms,top_wms,est_wms,e_oce",kml:[],layersIniciais:[],botoes:{'pan':true,'zoombox':true,'zoomtot':true,'zoomin':true,'zoomout':true,'legenda':true,'distancia':true,'area':true,'identifica':true,'linha':true,'ponto':true,'poligono':true,'texto':true,'edita':true,'listag':true,'corta':true,'apaga':true,'procura':true,'selecao':true,'salva':true,'ajuda':true,'propriedades':true,'fecha':false,'tools':true,'undo':false,'frente':false,'legenda':true,'rodadomouse':true},pontos:[],marca:"../pacotes/openlayers/img/marker-gold.png",controles:[new OpenLayers.Control.Navigation(),new OpenLayers.Control.PanZoomBar(),new OpenLayers.Control.LayerSwitcher({'ascending':false}),new OpenLayers.Control.ScaleLine(),new OpenLayers.Control.MousePosition({'separator':' '}),new OpenLayers.Control.OverviewMap(),new OpenLayers.Control.KeyboardDefaults()],tiles:true,incluilayergrafico:true,ativalayerswitcher:false,ativarodadomouse:true,legendahtml:false,numzoom:12,minresolution:0.703125,maxext:"",mapext:new OpenLayers.Bounds(-76.5125927,-39.3925675209,-29.5851853,9.49014852081),mapa:"",inicia:function(){var single=false,alayers=[],fundo=(i3GEO.editorOL.fundo).split(","),nfundo=fundo.length,ncontroles=i3GEO.editorOL.controles.length,i,n;if(i3GEO.editorOL.tiles===false||i3GEO.editorOL.tiles==="false"){single=true}if(i3GEO.editorOL.ativalayerswitcher==="false"){i3GEO.editorOL.ativalayerswitcher=false}if(i3GEO.editorOL.ativalayerswitcher==="true"){i3GEO.editorOL.ativalayerswitcher=true}if(i3GEO.editorOL.ativarodadomouse==="false"){i3GEO.editorOL.ativarodadomouse=false}if(i3GEO.editorOL.ativarodadomouse==="true"){i3GEO.editorOL.ativarodadomouse=true}if(i3GEO.editorOL.legendahtml==="false"){i3GEO.editorOL.legendahtml=false}if(i3GEO.editorOL.legendahtml==="true"){i3GEO.editorOL.legendahtml=true}if(i3GEO.editorOL.incluilayergrafico==="false"){i3GEO.editorOL.incluilayergrafico=false}if(i3GEO.editorOL.incluilayergrafico==="true"){i3GEO.editorOL.incluilayergrafico=true}if(i3GEO.editorOL.incluilayergrafico===true){if(!i3GEO.desenho.layergrafico){i3GEO.editorOL.criaLayerGrafico()}}else{i3GEO.desenho.layergrafico="";i3GEO.editorOL.botoes.linha=false;i3GEO.editorOL.botoes.ponto=false;i3GEO.editorOL.botoes.poligono=false;i3GEO.editorOL.botoes.texto=false;i3GEO.editorOL.botoes.edita=false;i3GEO.editorOL.botoes.listag=false;i3GEO.editorOL.botoes.corta=false;i3GEO.editorOL.botoes.apaga=false;i3GEO.editorOL.botoes.selecao=false;i3GEO.editorOL.botoes.salva=false;i3GEO.editorOL.botoes.propriedades=false;i3GEO.editorOL.botoes.fecha=false;i3GEO.editorOL.botoes.tools=false;i3GEO.editorOL.botoes.undo=false;i3GEO.editorOL.botoes.frente=false}if(i3GEO.editorOL.mapa===""){alert("O objeto i3GEO.editorOL.mapa precisa ser criado com new OpenLayers.Map()");return}for(i=0;i<ncontroles;i++){i3GEO.editorOL.mapa.addControl(i3GEO.editorOL.controles[i])}if(i3GEO.editorOL.fundo!=""){for(i=nfundo-1;i>=0;i--){if(fundo[i]!=""){try{eval("i3GEO.editorOL."+fundo[i]+".transitionEffect = 'resize';");eval("i3GEO.editorOL."+fundo[i]+".setVisibility(false);");eval("i3GEO.editorOL."+fundo[i]+".singleTile = false;");eval("alayers.push(i3GEO.editorOL."+fundo[i]+");")}catch(e){if(alayers[0]){alayers[0].setVisibility(true)}}}}}i3GEO.editorOL.mapa.addLayers(alayers);if(i3GEO.editorOL.layersIniciais!==""){n=i3GEO.editorOL.layersIniciais.length;for(i=0;i<n;i++){i3GEO.editorOL.layersIniciais[i].singleTile=single;i3GEO.editorOL.mapa.addLayer(i3GEO.editorOL.layersIniciais[i])}}if(!i3GEO.desenho.layergrafico){i3GEO.editorOL.mapa.addLayers([i3GEO.desenho.layergrafico])}i3GEO.editorOL.adicionaKml();i3GEO.editorOL.adicionaMarcas();i3GEO.editorOL.coordenadas();i3GEO.editorOL.criaJanelaBusca();i3GEO.editorOL.criaBotoes(i3GEO.editorOL.botoes);if(i3GEO.editorOL.ativalayerswitcher===true){i3GEO.editorOL.ativaLayerSwitcher()}if(i3GEO.editorOL.ativarodadomouse===false){i3GEO.editorOL.desativaRodaDoMouse()}if(i3GEO.editorOL.numzoom!==""){i3GEO.editorOL.mapa.setOptions({numZoomLevels:i3GEO.editorOL.numzoom})}if(i3GEO.editorOL.maxext!==""){i3GEO.editorOL.mapa.setOptions({maxExtent:i3GEO.editorOL.maxext})}if(i3GEO.editorOL.mapext!=""){i3GEO.editorOL.mapa.zoomToExtent(i3GEO.editorOL.mapext)}else{i3GEO.editorOL.mapa.zoomToMaxExtent()}if(i3GEO.Interface){i3GEO.Interface.openlayers.sobeLayersGraficos()}},criaLayerGrafico:function(){i3GEO.desenho.openlayers.criaLayerGrafico()},layersLigados:function(){var layers=i3GEO.editorOL.mapa.layers,nlayers=layers.length,ins=[],i;for(i=0;i<nlayers;i++){if(layers[i].visibility===true){ins.push(layers[i])}}return ins},layersClonados:function(paramsLayers){var layers=i3GEO.editorOL.mapa.layers,nlayers=layers.length,i;for(i=0;i<nlayers;i++){if(layers[i].params&&layers[i].params.CLONETMS===paramsLayers){return(layers[i])}}return false},layertms2wms:function(tms){var layer,url;url=tms.url.replace("&cache=sim","&DESLIGACACHE=sim");url=url.replace("&Z=${z}&X=${x}&Y=${y}","");layer=new OpenLayers.Layer.WMS(tms.layername+"_clone",url,{layers:tms.name,transparent:true},{gutter:0,isBaseLayer:false,displayInLayerSwitcher:false,opacity:1,visibility:true,singleTile:true});return layer},removeClone:function(){var nome=i3GEO.editorOL.layerAtivo().layername+"_clone",busca=i3GEO.editorOL.mapa.getLayersByName(nome);if(busca.length>0){i3GEO.editorOL.mapa.removeLayer(i3GEO.editorOL.mapa.getLayersByName(camada.name)[0],false)}},coordenadas:function(){var idcoord=i3GEO.editorOL.mapa.getControlsBy("separator"," ");if(idcoord[0]){i3GEO.editorOL.mapa.events.register("mousemove",i3GEO.editorOL.mapa,function(e){var p,lonlat,d;if(navm){p=new OpenLayers.Pixel(e.x,e.y)}else{p=e.xy}lonlat=i3GEO.editorOL.mapa.getLonLatFromPixel(p);d=i3GEO.calculo.dd2dms(lonlat.lon,lonlat.lat);try{$i(idcoord[0].id).innerHTML="Long: "+d[0]+"<br>Lat: "+d[1]}catch(e){}})}},criaJanelaBusca:function(){var layers=i3GEO.editorOL.layersLigados(),nlayers=layers.length,i,ins,combo="<select id=i3GEOOLlistaTemasBusca ><option value=''>----</option>";for(i=0;i<nlayers;i++){combo+="<option value='"+i+"' >"+layers[i].name+"</option>"}combo+="</select>";ins="<div class=paragrafo >Tema:<br>"+combo;ins+="<br>Item:<br><span id=i3GEOOLcomboitens ></span>";ins+="<br>Procurar por:<br><input type=text size=20 id=i3GEOOLpalavraBusca >";ins+="<br><br><input type=button value='Procurar' id='i3GEOOLbotaoBusca' ></div>";ins+="<br>Resultado:<br><span id=i3GEOOLcomboresultado ></span>";try{YAHOO.namespace("procura.container");YAHOO.procura.container.panel=new YAHOO.widget.Panel("panelprocura",{zIndex:2000,iframe:false,width:"250px",visible:false,draggable:true,close:true});YAHOO.procura.container.panel.setHeader("Encontre no mapa");YAHOO.procura.container.panel.setBody(ins);YAHOO.procura.container.panel.setFooter("");YAHOO.procura.container.panel.render(document.body);YAHOO.procura.container.panel.center();document.getElementById("i3GEOOLbotaoBusca").onclick=function(){var layer=i3GEO.editorOL.layerAtivo(),item=document.getElementById("i3GEOOLbuscaItem").value,palavra=document.getElementById("i3GEOOLpalavraBusca").value;if(item===""||palavra===""){alert("Escolha o item e o texto de busca");return}i3GEO.editorOL.busca(layer,item,palavra,"i3GEOOLcomboresultado")};document.getElementById("i3GEOOLlistaTemasBusca").onchange=function(){i3GEO.editorOL.ativaTema(this.value);document.getElementById("i3GEOOLcomboitens").innerHTML="...";i3GEO.editorOL.listaItens(i3GEO.editorOL.layerAtivo(),"i3GEOOLcomboitens","i3GEOOLbuscaItem")}}catch(e){}},criaComboTemas:function(){var layers=i3GEO.editorOL.layersLigados(),nlayers=layers.length,i,nometema="",temp,combo="<select id=i3GEOOLlistaTemasAtivos style=width:235px; >";for(i=0;i<nlayers;i++){nometema="";if(i3GEO.arvoreDeCamadas&&i3GEO.arvoreDeCamadas.CAMADAS){temp=i3GEO.arvoreDeCamadas.pegaTema(layers[i].name,"","name");if(temp!=""){nometema=temp.tema+" - "}}combo+="<option value='"+i+"' >"+nometema+layers[i].name+"</option>"}combo+="</select>";return combo},atualizaJanelaAtivaTema:function(){var combo=i3GEO.editorOL.criaComboTemas();YAHOO.temaativo.container.panel.setBody(combo);document.getElementById("i3GEOOLlistaTemasAtivos").onchange=function(){if(botaoIdentifica){botaoIdentifica.layers=[i3GEO.editorOL.layersLigados()[this.value]]}}},criaJanelaAtivaTema:function(){var temp;if(!document.getElementById("paneltemaativo")){YAHOO.namespace("temaativo.container");YAHOO.temaativo.container.panel=new YAHOO.widget.Panel("paneltemaativo",{zIndex:20000,iframe:true,width:"250px",visible:false,draggable:true,close:true});YAHOO.temaativo.container.panel.setBody("");if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){YAHOO.temaativo.container.panel.setHeader("Tema ativo<div id='paneltemaativo_minimizaCabecalho' class='container-minimiza'></div>")}else{YAHOO.temaativo.container.panel.setHeader("Tema ativo")}YAHOO.temaativo.container.panel.setFooter("");YAHOO.temaativo.container.panel.render(document.body);YAHOO.temaativo.container.panel.show();YAHOO.temaativo.container.panel.center();i3GEO.editorOL.atualizaJanelaAtivaTema();YAHOO.util.Event.addListener(YAHOO.temaativo.container.panel.close,"click",function(){i3GEOpanelEditor.deactivate();i3GEOpanelEditor.activate();if(i3GEO.eventos&&i3GEO.eventos.ATUALIZAARVORECAMADAS.toString().search("i3GEO.editorOL.atualizaJanelaAtivaTema()")>0){i3GEO.eventos.ATUALIZAARVORECAMADAS.remove("i3GEO.editorOL.atualizaJanelaAtivaTema()")}});if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){if(i3GEO.eventos&&i3GEO.eventos.ATUALIZAARVORECAMADAS.toString().search("i3GEO.editorOL.atualizaJanelaAtivaTema()")<0){i3GEO.eventos.ATUALIZAARVORECAMADAS.push("i3GEO.editorOL.atualizaJanelaAtivaTema()")}}temp=$i("paneltemaativo_minimizaCabecalho");if(temp){temp.onclick=function(){i3GEO.janela.minimiza("paneltemaativo")}}}else{YAHOO.temaativo.container.panel.show();i3GEO.editorOL.atualizaJanelaAtivaTema()}},ativaTema:function(id){document.getElementById("i3GEOOLlistaTemasAtivos").value=id},layerAtivo:function(){var id=document.getElementById("i3GEOOLlistaTemasAtivos");if(id){id=id.value}else{id=i3GEO.temaAtivo}if(id==""){return[]}else{return i3GEO.editorOL.layersLigados()[id]}},listaItens:function(layer,idonde,idobj){if(!layer){return}if(!layer.params){return}var u=layer.url+"&request=describefeaturetype&service=wfs&version=1.0.0";u+="&typename="+layer.params.LAYERS;document.body.style.cursor="wait";document.getElementById("i3geoMapa").style.cursor="wait";OpenLayers.Request.issue({method:"GET",url:u,callback:function(retorno){document.body.style.cursor="default";document.getElementById("i3geoMapa").style.cursor="default";var fromgml=new OpenLayers.Format.WFSDescribeFeatureType({geometryName:"msGeometry"}),gml=fromgml.read(retorno.responseText),prop=gml.featureTypes[0].properties,nprop=prop.length,i,combo="<select id="+idobj+" ><option value=''>----</option>";for(i=0;i<nprop;i++){combo+="<option value="+prop[i].name+" >"+prop[i].name+"</option>"}combo+="</select>";document.getElementById(idonde).innerHTML=combo},failure:function(){document.body.style.cursor="default";document.getElementById("i3geoMapa").style.cursor="default";alert("Erro")}})},busca:function(layer,item,palavra,onde){document.body.style.cursor="wait";document.getElementById("i3geoMapa").style.cursor="wait";var u=layer.url+"&request=getfeature&service=wfs&version=1.0.0";u+="&OUTPUTFORMAT=gml2&typename="+layer.params.LAYERS;u+="&filter=<Filter><PropertyIsLike wildcard=* singleChar=. escape=! ><PropertyName>"+item+"</PropertyName><Literal>*"+palavra+"*</Literal></PropertyIsLike></Filter>";document.body.style.cursor="wait";document.getElementById("i3geoMapa").style.cursor="wait";document.getElementById(onde).innerHTML="...";OpenLayers.Request.issue({method:"GET",url:u,callback:function(retorno){document.body.style.cursor="default";document.getElementById("i3geoMapa").style.cursor="default";var fromgml=new OpenLayers.Format.GML({geometryName:"msGeometry"}),gml=fromgml.read(retorno.responseText),ngml=gml.length,i,ins="<select onchange='i3GEO.editorOL.zoomPara(this.value)'>";ins+="<option value=''>---</option>";for(i=0;i<ngml;i++){eval("var valor = gml[i].data."+item);var bounds=gml[i].geometry.getBounds();bounds=bounds.toBBOX();ins+="<option value='"+bounds+"'>"+valor+"</option>"}ins+="</select>";document.getElementById(onde).innerHTML=ins},failure:function(){document.body.style.cursor="default";document.getElementById("i3geoMapa").style.cursor="default";alert("Erro")}})},zoomPara:function(bbox){var b=new OpenLayers.Bounds.fromString(bbox);i3GEO.editorOL.mapa.zoomToExtent(b)},mostraLegenda:function(){var layers=i3GEO.editorOL.layersLigados(),nlayers=layers.length,ins="",i;for(i=0;i<nlayers;i++){try{if(layers[i].isBaseLayer===false){var url=layers[i].getFullRequestString({"request":"getlegendgraphic"});if(i3GEO.editorOL.legendahtml===true){url=url.replace("image%2Fpng","text/html");ins+=layers[i].name+"<br><div id=legendaL_"+i+" ></div><br>";eval("var f = function(retorno){document.getElementById('legendaL_"+i+"').innerHTML = retorno.responseText;};");var config={method:"GET",url:url,callback:f};OpenLayers.Request.issue(config)}else{url=url.replace("LAYERS","LAYER");ins+=layers[i].name+"<br><img src='"+url+"' /><br>"}}}catch(e){}}if(!document.getElementById("panellegendaeditorOL")){YAHOO.namespace("legendaeditorOL.container");YAHOO.legendaeditorOL.container.panel=new YAHOO.widget.Panel("panellegendaeditorOL",{zIndex:20000,iframe:true,width:"auto",visible:false,draggable:true,close:true});YAHOO.legendaeditorOL.container.panel.setBody(ins);YAHOO.legendaeditorOL.container.panel.setHeader("Legenda");YAHOO.legendaeditorOL.container.panel.setFooter("");YAHOO.legendaeditorOL.container.panel.render(document.body);YAHOO.legendaeditorOL.container.panel.show();YAHOO.legendaeditorOL.container.panel.center();YAHOO.util.Event.addListener(YAHOO.legendaeditorOL.container.panel.close,"click",function(){})}else{YAHOO.legendaeditorOL.container.panel.setBody(ins);YAHOO.legendaeditorOL.container.panel.show()}},captura:function(lonlat){var layers=[i3GEO.editorOL.layerAtivo()],xy=lonlat.split(","),u=layers[0].url+"&REQUEST=getfeature&service=wfs&version=1.0.0";u+="&OUTPUTFORMAT=gml2&typename="+layers[0].params.LAYERS;u=u.replace("&cache=sim","&DESLIGACACHE=sim");u=u.replace("&Z=${z}&X=${x}&Y=${y}","");xy[0]=xy[0]*1;xy[1]=xy[1]*1;var poligono=(xy[0]-0.1)+","+(xy[1]+0.1)+" "+(xy[0]+0.1)+","+(xy[1]+0.1)+" "+(xy[0]+0.1)+","+(xy[1]-0.1)+" "+(xy[0]-0.1)+","+(xy[1]-0.1)+" "+(xy[0]-0.1)+","+(xy[1]+0.1);u+="&filter=<Filter><Intersects><PropertyName>Geometry</PropertyName><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:posList>"+poligono+"</gml:posList></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></Intersects></Filter>";document.body.style.cursor="wait";if(document.getElementById("i3geoMapa")){document.getElementById("i3geoMapa").style.cursor="wait"}OpenLayers.Request.issue({method:"GET",url:u,callback:function(retorno){document.body.style.cursor="default";if(document.getElementById("i3geoMapa")){document.getElementById("i3geoMapa").style.cursor="default"}var i,n,f,fromgml=new OpenLayers.Format.GML({geometryName:"msGeometry"}),gml=fromgml.read(retorno.responseText);n=gml.length;for(i=0;i<n;i++){f=gml[i];f["attributes"]={opacidade:i3GEO.editorOL.simbologia.opacidade,texto:i3GEO.editorOL.simbologia.texto,fillColor:i3GEO.editorOL.simbologia.fillColor,strokeWidth:i3GEO.editorOL.simbologia.strokeWidth,strokeColor:i3GEO.editorOL.simbologia.strokeColor,pointRadius:i3GEO.editorOL.simbologia.pointRadius,graphicName:i3GEO.editorOL.simbologia.graphicName,registros:f["attributes"]}}i3GEO.desenho.layergrafico.addFeatures(gml)},failure:function(){document.body.style.cursor="default";if(document.getElementById("i3geoMapa")){document.getElementById("i3geoMapa").style.cursor="default"}alert("Erro")}})},salvaGeometrias:function(){var geos=i3GEO.desenho.layergrafico.selectedFeatures,n=geos.length,ins="";if(n>0){if($i("panelsalvageometrias")){YAHOO.salvaGeometrias.container.panel=YAHOO.i3GEO.janela.manager.find("panelsalvageometrias");YAHOO.salvaGeometrias.container.panel.show();YAHOO.salvaGeometrias.container.panel.bringToTop()}else{try{YAHOO.namespace("salvaGeometrias.container");YAHOO.salvaGeometrias.container.panel=new YAHOO.widget.Panel("panelsalvageometrias",{zIndex:2000,iframe:false,width:"250px",visible:false,draggable:true,close:true});YAHOO.salvaGeometrias.container.panel.setHeader("Geometrias");YAHOO.salvaGeometrias.container.panel.setBody("");YAHOO.salvaGeometrias.container.panel.setFooter("");YAHOO.salvaGeometrias.container.panel.render(document.body);YAHOO.salvaGeometrias.container.panel.center();if(YAHOO.i3GEO.janela){YAHOO.i3GEO.janela.manager.register(YAHOO.salvaGeometrias.container.panel)}YAHOO.salvaGeometrias.container.panel.show()}catch(e){}}ins+="<p class=paragrafo >Foram encontrada(s) "+n+" geometria(s) selecionada(s) </p>";ins+="<p class=paragrafo ><a href='#' onclick='i3GEO.editorOL.listaGeometriasSel()' >Listar</a> ";ins+="<a href='#' onclick='"+i3GEO.editorOL.nomeFuncaoSalvar+"' >Salvar</a> ";ins+="<a href='#' onclick='i3GEO.editorOL.exportarSHP()' >Exportar (shapefile)</a></p>";YAHOO.salvaGeometrias.container.panel.setBody(ins)}else{alert("Selecione pelo menos um elemento")}},exportarSHP:function(){i3GEO.editorOL.processageo("converteSHP")},listaGeometriasSel:function(){var geos=i3GEO.desenho.layergrafico.selectedFeatures,n=geos.length,ins="",i,a,w,g;for(i=0;i<n;i++){g=geos[i];ins+="<b>Geometria: "+i+"</b><br>"+i3GEO.editorOL.google2wgs(g.geometry)+"<br><br>";ins+="<b>Atributos: "+i+"</b><br>";a=g.attributes;for(key in a){if(a[key]){ins+=key+" = "+a[key]+"<br>"}}if(g.attributes.registros){ins+="<b>Registros: "+i+"</b><br>";a=g.attributes.registros;for(key in a){if(a[key]){ins+=key+" = "+a[key]+"<br>"}}}}w=window.open();w.document.write(ins);w.document.close()},testeSalvar:function(){alert("Funcao nao disponivel. Defina o nome da funcao em i3GEO.editorOL.nomeFuncaoSalvar ")},salvaGeo:function(){var geos=i3GEO.desenho.layergrafico.selectedFeatures,n=geos.length,funcaoOK=function(){if(geos[0].geometry){var registros="",valorunico="",nometema=$i("editorOLcomboTemaEditavel").value,key="",tema,redesenha,p,g=i3GEO.editorOL.google2wgs(geos[0].geometry);if(nometema==""){return}tema=i3GEO.arvoreDeCamadas.pegaTema(nometema,"","name");if(geos[0].attributes.registros){registros=geos[0].attributes.registros;for(key in registros){if(registros[key]&&key==tema.colunaidunico){valorunico=registros[key]}}}redesenha=function(retorno){i3GEO.janela.fechaAguarde("aguardeSalvaPonto");i3GEO.desenho.layergrafico.removeFeatures(i3GEO.desenho.layergrafico.selectedFeatures);i3GEO.Interface.atualizaTema("",nometema)};i3GEO.janela.AGUARDEMODAL=true;i3GEO.janela.abreAguarde("aguardeSalvaPonto","Adicionando...");i3GEO.janela.AGUARDEMODAL=false;if(valorunico==""){p=i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=adicionaGeometria&g_sid="+i3GEO.configura.sid;cpJSON.call(p,"foo",redesenha,"&tema="+nometema+"&wkt="+g)}else{p=i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=atualizaGeometria&g_sid="+i3GEO.configura.sid;cpJSON.call(p,"foo",redesenha,"&idunico="+valorunico+"&tema="+nometema+"&wkt="+g)}}},funcaoCombo=function(obj){$i("editorOLondeComboTemaEditavel").innerHTML=obj.dados},texto="Salvar no tema:<br><div id=editorOLondeComboTemaEditavel ></div><br><br>";if(n!=1){i3GEO.janela.tempoMsg("Selecione apenas uma figura")}else{i3GEO.janela.confirma(texto,300,"Salva","Cancela",funcaoOK);i3GEO.util.comboTemas("editorOLcomboTemaEditavel",funcaoCombo,"editorOLondeComboTemaEditavel","",false,"editavel")}},criaBotoes:function(botoes){var sketchSymbolizers={"Point":{pointRadius:4,graphicName:"square",fillColor:"white",fillOpacity:1,strokeWidth:1,strokeOpacity:1,strokeColor:"#333333"},"Line":{strokeWidth:3,strokeOpacity:1,strokeColor:"#666666",strokeDashstyle:"dash"},"Polygon":{strokeWidth:2,strokeOpacity:1,strokeColor:"#666666",fillColor:"white",fillOpacity:0.3}},style=new OpenLayers.Style(),styleMap=new OpenLayers.StyleMap({"default":style,"vertex":{strokeOpacity:1,strokeWidth:1,fillColor:"white",fillOpacity:0.45,pointRadius:3}},{extendDefault:false}),adiciona=false,button,controles=[];style.addRules([new OpenLayers.Rule({symbolizer:sketchSymbolizers})]);i3GEOpanelEditor=new OpenLayers.Control.Panel({displayClass:"olControlEditingToolbar1 noprint",saveState:false,activateControl:function(c){this.deactivate();this.activate();try{i3GEO.editorOL.ModifyFeature.deactivate();if(i3GEO&&i3GEO.barraDeBotoes){i3GEO.barraDeBotoes.ativaPadrao()}}catch(e){}if(!c.trigger){c.activate()}else{c.trigger.call()}}});if(botoes.procura===true){button=new OpenLayers.Control.Button({displayClass:"editorOLprocura",trigger:function(){YAHOO.procura.container.panel.show()},title:"procura",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.pan===true){controles.push(new OpenLayers.Control.Navigation({title:"deslocar",displayClass:"editorOLpan",type:OpenLayers.Control.TYPE_TOOL}));adiciona=true}if(botoes.zoombox===true){controles.push(new OpenLayers.Control.ZoomBox({title:"zoombox",displayClass:"editorOLzoombox",type:OpenLayers.Control.TYPE_TOOL}));adiciona=true}if(botoes.zoomtot===true){button=new OpenLayers.Control.Button({displayClass:"editorOLzoomtot",trigger:function(){if(i3GEO.editorOL.mapext&&i3GEO.editorOL.mapext!=""){i3GEO.editorOL.mapa.zoomToExtent(i3GEO.editorOL.mapext)}else{i3GEO.editorOL.mapa.zoomToMaxExtent()}},title:"ajusta extensao",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.zoomin===true){button=new OpenLayers.Control.Button({displayClass:"editorOLzoomin",trigger:function(){i3GEO.editorOL.mapa.zoomIn()},title:"aproxima",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.zoomout===true){button=new OpenLayers.Control.Button({displayClass:"editorOLzoomout",trigger:function(){i3GEO.editorOL.mapa.zoomOut()},title:"afasta",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.legenda===true){button=new OpenLayers.Control.Button({displayClass:"editorOLlegenda",trigger:function(){i3GEO.editorOL.mostraLegenda()},title:"legenda",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.distancia===true){button=new OpenLayers.Control.Measure(OpenLayers.Handler.Path,{handlerOptions:{layerOptions:{styleMap:styleMap}},persist:true,displayClass:"editorOLdistancia",title:"distancia",type:OpenLayers.Control.TYPE_TOOL});button.events.on({"measure":function(event){var units=event.units,measure=event.measure;alert("Distância: "+measure.toFixed(3)+" "+units)}});controles.push(button);adiciona=true}if(botoes.area===true){button=new OpenLayers.Control.Measure(OpenLayers.Handler.Polygon,{handlerOptions:{layerOptions:{styleMap:styleMap}},persist:true,displayClass:"editorOLarea",title:"area",type:OpenLayers.Control.TYPE_TOOL});button.events.on({"measure":function(event){var units=event.units;var measure=event.measure;alert("Área: "+measure.toFixed(3)+" "+units+" quadrados")}});controles.push(button);adiciona=true}if(botoes.identifica===true){botaoIdentifica=new OpenLayers.Control.WMSGetFeatureInfo({maxFeatures:1,infoFormat:'text/plain',layers:[i3GEO.editorOL.layerAtivo()],queryVisible:true,title:"identifica",type:OpenLayers.Control.TYPE_TOOL,displayClass:"editorOLidentifica",eventListeners:{getfeatureinfo:function(event){var lonlat=i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy),lonlattexto="<hr>",formata;if(botoes.linha===true||botoes.ponto===true||botoes.poligono===true||botoes.edita===true){lonlattexto+="<pre><span style=font-size:12px;color:blue;cursor:pointer onclick='i3GEO.editorOL.captura(\""+lonlat.lon+","+lonlat.lat+"\")'>edita geometria</span></pre><br>"}formata=function(texto){var temp,temp1,n,i,f=[],textoN=texto.split(":");try{if(textoN.length>1){temp=textoN[2].replace(/\n\r/g,"");temp=temp.replace(/'/g,"");temp=temp.replace(/\n/g,"|");temp=temp.replace(/_/g," ");temp=temp.replace(/=/g,":");temp=temp.split("|");n=temp.length;for(i=0;i<n;i++){temp1=temp[i].replace(/^\s+/,"");temp1=temp1.replace(/\s+$/,"");if(temp1!="")f.push(temp1)}texto=f.join("<br><br>")}}catch(e){}return texto};i3GEO.editorOL.mapa.addPopup(new OpenLayers.Popup.FramedCloud("chicken",i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy),null,"<div style=text-align:left >"+lonlattexto+"<pre>"+formata(event.text)+"</pre></div>",null,true));i3GEO.editorOL.removeClone()},beforegetfeatureinfo:function(event){var ativo=[i3GEO.editorOL.layerAtivo()];if(ativo[0].CLASS_NAME=="OpenLayers.Layer.TMS"||ativo[0].CLASS_NAME=="OpenLayers.Layer.OSM"){ativo=[i3GEO.editorOL.layertms2wms(ativo[0])]}ativo[0].projection=new OpenLayers.Projection("EPSG:4326");event.object.layers=ativo;botaoIdentifica.layers=ativo;botaoIdentifica.url=ativo[0].url},activate:function(){i3GEO.editorOL.criaJanelaAtivaTema()}}});controles.push(botaoIdentifica);adiciona=true}if(botoes.linha===true){button=new OpenLayers.Control.DrawFeature(i3GEO.desenho.layergrafico,OpenLayers.Handler.Path,{displayClass:"editorOLlinha",title:"digitalizar linha",type:OpenLayers.Control.TYPE_TOOL,callbacks:{done:function(feature){var f=new OpenLayers.Feature.Vector(feature);f["attributes"]={opacidade:i3GEO.editorOL.simbologia.opacidade,texto:i3GEO.editorOL.simbologia.texto,fillColor:i3GEO.editorOL.simbologia.fillColor,strokeWidth:i3GEO.editorOL.simbologia.strokeWidth,strokeColor:i3GEO.editorOL.simbologia.strokeColor,pointRadius:i3GEO.editorOL.simbologia.pointRadius,graphicName:i3GEO.editorOL.simbologia.graphicName};i3GEO.desenho.layergrafico.addFeatures([f]);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}if(i3GEO.Interface){i3GEO.Interface.openlayers.sobeLayersGraficos()}}}});controles.push(button);adiciona=true}if(botoes.ponto===true){button=new OpenLayers.Control.DrawFeature(i3GEO.desenho.layergrafico,OpenLayers.Handler.Point,{displayClass:"editorOLponto",title:"digitalizar ponto",type:OpenLayers.Control.TYPE_TOOL,callbacks:{done:function(feature){var f,style_mark;if(i3GEO.editorOL.simbologia.externalGraphic!=""){style_mark=OpenLayers.Util.extend({},OpenLayers.Feature.Vector.style['default']);style_mark.externalGraphic=i3GEO.editorOL.simbologia.externalGraphic;style_mark.graphicWidth=i3GEO.editorOL.simbologia.graphicWidth;style_mark.graphicHeight=i3GEO.editorOL.simbologia.graphicHeight;style_mark.fillOpacity=i3GEO.editorOL.simbologia.opacidade;f=new OpenLayers.Feature.Vector(feature,null,style_mark)}else{f=new OpenLayers.Feature.Vector(feature)}f["attributes"]={opacidade:i3GEO.editorOL.simbologia.opacidade,texto:i3GEO.editorOL.simbologia.texto,fillColor:i3GEO.editorOL.simbologia.fillColor,strokeWidth:i3GEO.editorOL.simbologia.strokeWidth,strokeColor:i3GEO.editorOL.simbologia.strokeColor,pointRadius:i3GEO.editorOL.simbologia.pointRadius,graphicName:i3GEO.editorOL.simbologia.graphicName,externalGraphic:i3GEO.editorOL.simbologia.externalGraphic,graphicHeight:i3GEO.editorOL.simbologia.graphicHeight,graphicWidth:i3GEO.editorOL.simbologia.graphicWidth};i3GEO.desenho.layergrafico.addFeatures([f]);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}if(i3GEO.Interface){i3GEO.Interface.openlayers.sobeLayersGraficos()}}}});controles.push(button);adiciona=true}if(botoes.poligono===true){button=new OpenLayers.Control.DrawFeature(i3GEO.desenho.layergrafico,OpenLayers.Handler.Polygon,{displayClass:"editorOLpoligono",title:"digitalizar poligono",type:OpenLayers.Control.TYPE_TOOL,callbacks:{done:function(feature){var f=new OpenLayers.Feature.Vector(feature);f["attributes"]={opacidade:i3GEO.editorOL.simbologia.opacidade,texto:i3GEO.editorOL.simbologia.texto,fillColor:i3GEO.editorOL.simbologia.fillColor,strokeWidth:i3GEO.editorOL.simbologia.strokeWidth,strokeColor:i3GEO.editorOL.simbologia.strokeColor,pointRadius:i3GEO.editorOL.simbologia.pointRadius,graphicName:i3GEO.editorOL.simbologia.graphicName};i3GEO.desenho.layergrafico.addFeatures([f]);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}if(i3GEO.Interface){i3GEO.Interface.openlayers.sobeLayersGraficos()}}}});controles.push(button);adiciona=true}if(botoes.texto===true){button=new OpenLayers.Control.DrawFeature(i3GEO.desenho.layergrafico,OpenLayers.Handler.Point,{displayClass:"editorOLtexto",title:"incluir texto",type:OpenLayers.Control.TYPE_TOOL,persist:true,callbacks:{done:function(feature){var texto=window.prompt("Texto",""),label=new OpenLayers.Feature.Vector(feature);label["attributes"]={opacidade:0.1,fillColor:"white",strokeWidth:i3GEO.editorOL.simbologia.strokeWidth,texto:texto,pointRadius:2,graphicName:"square",strokeColor:"black",fontColor:i3GEO.editorOL.simbologia.fontColor,fontSize:i3GEO.editorOL.simbologia.fontSize,fontFamily:"Arial",fontWeight:"bold",labelAlign:"rt"};if(texto&&texto!==""){i3GEO.desenho.layergrafico.addFeatures([label])}if(i3GEO.Interface){i3GEO.Interface.openlayers.sobeLayersGraficos()}}}});controles.push(button);adiciona=true}if(botoes.edita===true&&botoes.corta===true&&i3GEO.php){i3GEO.editorOL.CortaFeature=new OpenLayers.Control.DrawFeature(i3GEO.desenho.layergrafico,OpenLayers.Handler.Polygon,{displayClass:"editorOLcorta",title:"corta figura",type:OpenLayers.Control.TYPE_TOOL,clickout:true,toggle:true,trigger:function(){if(i3GEO.desenho.layergrafico.selectedFeatures.length!=1){alert("Selecione primeiro um elemento para ser cortado");i3GEO.editorOL.CortaFeature.deactivate()}else{i3GEO.editorOL.CortaFeature.activate()}},callbacks:{done:function(feature){var temp,sel=i3GEO.desenho.layergrafico.selectedFeatures[0].geometry,corta=feature;temp=function(retorno){i3GEO.janela.fechaAguarde("i3GEO.cortador");if(retorno!=""&&retorno.data&&retorno.data!=""){i3GEO.editorOL.substituiFeaturesSel(retorno.data)}};i3GEO.janela.abreAguarde("i3GEO.cortador","Cortando");i3GEO.php.funcoesGeometriasWkt(temp,sel+"|"+corta,"difference")}}});controles.push(i3GEO.editorOL.CortaFeature);adiciona=true}if(botoes.edita===true){i3GEO.editorOL.ModifyFeature=new OpenLayers.Control.ModifyFeature(i3GEO.desenho.layergrafico,{displayClass:"editorOLedita",title:"modifica figura",type:OpenLayers.Control.TYPE_TOOL,clickout:true,toggle:true,mode:OpenLayers.Control.ModifyFeature.RESHAPE,standalone:false,createVertices:true,styleMap:"default",vertexRenderIntent:"vertex"});controles.push(i3GEO.editorOL.ModifyFeature);adiciona=true}if(botoes.edita===true&&botoes.listag===true){button=new OpenLayers.Control.Button({displayClass:"editorOLlistag",trigger:function(){i3GEO.editorOL.listaGeometrias()},title:"lista geometrias",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.frente===true){button=new OpenLayers.Control.Button({displayClass:"editorOLfrente",trigger:function(){i3GEO.editorOL.trazParaFrente();if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}},title:"traz para frente",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.tools===true&&i3GEO.php){button=new OpenLayers.Control.Button({displayClass:"editorOLtools",trigger:function(){if(i3GEO.php){i3GEO.editorOL.ferramentas()}else{i3GEO.editorOL.carregajts("i3GEO.editorOL.ferramentas()")}},title:"ferramentas",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.selecao===true){i3GEO.editorOL.selbutton=new OpenLayers.Control.SelectFeature(i3GEO.desenho.layergrafico,{displayClass:"editorOLselecao",title:"seleciona elemento",type:OpenLayers.Control.TYPE_TOOL,clickout:true,toggle:true,multiple:false,hover:false,toggleKey:"ctrlKey",multipleKey:"shiftKey",box:false});controles.push(i3GEO.editorOL.selbutton);adiciona=true}if(botoes.apaga===true){button=new OpenLayers.Control.Button({displayClass:"editorOLapaga",trigger:function(){if(i3GEO.desenho.layergrafico.selectedFeatures.length>0){var x=window.confirm("Exclui os elementos selecionados?");if(x){i3GEO.editorOL.guardaBackup();i3GEO.desenho.layergrafico.removeFeatures(i3GEO.desenho.layergrafico.selectedFeatures);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}}}else{alert("Selecione pelo menos um elemento")}},title:"apaga selecionados",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.propriedades===true){button=new OpenLayers.Control.Button({displayClass:"editorOLpropriedades",trigger:function(){i3GEO.editorOL.propriedades()},title:"propriedades",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.salva===true){button=new OpenLayers.Control.Button({displayClass:"editorOLsalva",trigger:function(){i3GEO.editorOL.salvaGeometrias()},title:"salva",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.ajuda===true){button=new OpenLayers.Control.Button({displayClass:"editorOLajuda",trigger:function(){try{window.open(i3GEO.configura.locaplic+"/mashups/openlayers_ajuda.php")}catch(e){window.open("openlayers_ajuda.php")}},title:"ajuda",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.fecha===true){button=new OpenLayers.Control.Button({displayClass:"editorOLfecha",trigger:function(){var temp=window.confirm("Remove a edicao?");if(i3GEO.eventos){i3GEO.eventos.cliquePerm.ativa()}i3GEOpanelEditor.destroy();try{YAHOO.temaativo.container.panel.destroy()}catch(e){}try{YAHOO.procura.container.panel.destroy()}catch(e){}try{YAHOO.editorOL.container.panel.destroy()}catch(e){}try{YAHOO.editorOL.listaGeometrias.panel.destroy()}catch(e){}try{YAHOO.editorOL.ferramentas.panel.destroy()}catch(e){}try{YAHOO.legendaeditorOL.container.panel.destroy()}catch(e){}try{YAHOO.salvaGeometrias.container.panel.destroy()}catch(e){}if(temp===true){try{if(i3GEO.desenho.layergrafico){i3GEO.editorOL.mapa.removeLayer(i3GEO.desenho.layergrafico);delete(i3GEO.desenho.layergrafico)}if(i3GEO.editorOL.backup){i3GEO.editorOL.mapa.removeLayer(i3GEO.editorOL.backup);delete(i3GEO.editorOL.backup)}}catch(e){}}},title:"fecha editor",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}i3GEOOLsnap=new OpenLayers.Control.Snapping({layer:i3GEO.desenho.layergrafico});i3GEOOLsplit=new OpenLayers.Control.Split({layer:i3GEO.desenho.layergrafico,source:i3GEO.desenho.layergrafico,tolerance:0.0001,eventListeners:{beforesplit:function(event){i3GEO.editorOL.guardaBackup()},aftersplit:function(event){i3GEO.editorOL.flashFeatures(event.features);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}}}});if(adiciona===true){i3GEOpanelEditor.addControls(controles);i3GEO.editorOL.mapa.addControl(i3GEOpanelEditor)}},mudaSimbolo:function(estilo,id){var valor=$i(id).value,geos=i3GEO.desenho.layergrafico.selectedFeatures,n=geos.length,i;i3GEO.editorOL.simbologia[estilo]=valor;for(i=0;i<n;i++){geos[i].attributes[estilo]=valor;geos[i].style[estilo]=valor}},adicionaMarcas:function(){if(i3GEO.editorOL.pontos.length===0){return}var SHADOW_Z_INDEX=10,MARKER_Z_INDEX=11,layer=new OpenLayers.Layer.Vector("pontos",{styleMap:new OpenLayers.StyleMap({externalGraphic:i3GEO.editorOL.marca,backgroundGraphic:"../pacotes/openlayers/img/marker_shadow.png",backgroundXOffset:0,backgroundYOffset:-7,graphicZIndex:MARKER_Z_INDEX,backgroundGraphicZIndex:SHADOW_Z_INDEX,pointRadius:10}),isBaseLayer:false,rendererOptions:{yOrdering:true},displayInLayerSwitcher:true,visibility:true}),index,x=[],y=[],features=[];for(index=0;index<i3GEO.editorOL.pontos.length;index=index+2){x.push(i3GEO.editorOL.pontos[index]);y.push(i3GEO.editorOL.pontos[index+1])}for(index=0;index<x.length;index++){features.push(new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(x[index],y[index])))}layer.addFeatures(features);i3GEO.editorOL.mapa.addLayer(layer)},adicionaKml:function(){var temp,n,i,id,url;n=i3GEO.editorOL.kml.length;for(i=0;i<n;i++){id="kml"+i;url=i3GEO.editorOL.kml[i];eval(id+" = new OpenLayers.Layer.Vector('"+id+"', {displayOutsideMaxExtent:true,displayInLayerSwitcher:false,visibility:true, strategies: [new OpenLayers.Strategy.Fixed()],protocol: new OpenLayers.Protocol.HTTP({url: '"+url+"',format: new OpenLayers.Format.KML({extractStyles: true,extractAttributes: true,maxDepth: 5})})})");eval("i3GEO.editorOL.mapa.addLayer("+id+");");eval("temp = "+id+".div;");temp.onclick=function(e){var targ="",id,temp,features,n,i,g,html="";if(!e){e=window.event}if(e.target){targ=e.target}else{if(e.srcElement){targ=e.srcElement}}if(targ.id){temp=targ.id.split("_");if(temp[0]==="OpenLayers.Geometry.Point"){id=targ.id;temp=i3GEO.editorOL.mapa.getLayer(this.id);features=temp.features;n=features.length;for(i=0;i<n;i++){if(features[i].geometry.id===id){for(var j in features[i].attributes){html+=j+": "+features[i].attributes[j]}g=features[i].geometry;i3GEO.editorOL.mapa.addPopup(new OpenLayers.Popup.FramedCloud("kml",new OpenLayers.LonLat(g.x,g.y),null,html,null,true))}}}}}}},propriedades:function(){if(!document.getElementById("panelpropriedadesEditor")){YAHOO.namespace("editorOL.container");YAHOO.editorOL.container.panel=new YAHOO.widget.Panel("panelpropriedadesEditor",{zIndex:20000,iframe:true,width:"350px",height:"250px",visible:false,draggable:true,close:true});var ins=""+'<p class=paragrafo ><b>Estilos (utilize a cor no formato r,g,b):</b></p>'+'<table class=lista7 >'+' <tr>'+' <td>Cor do contorno</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'strokeColor\',\'i3GEOEditorOLcorContorno\')" type="text" style="cursor:text" id="i3GEOEditorOLcorContorno" size="12" value="'+i3GEO.editorOL.simbologia.strokeColor+'" /></td><td>';if(i3GEO.configura){ins+='<img alt="aquarela.gif" style=cursor:pointer src="'+i3GEO.configura.locaplic+'/imagens/aquarela.gif" onclick="i3GEO.util.abreCor(\'\',\'i3GEOEditorOLcorContorno\');" />'}ins+=""+' </td>'+' </tr>'+' <tr>'+' <td>Cor do preenchimento</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'fillColor\',\'i3GEOEditorOLcorPre\')" type="text" style="cursor:text" id="i3GEOEditorOLcorPre" size="12" value="'+i3GEO.editorOL.simbologia.fillColor+'" /></td><td>';if(i3GEO.configura){ins+='<img alt="aquarela.gif" style=cursor:pointer src="'+i3GEO.configura.locaplic+'/imagens/aquarela.gif" onclick="i3GEO.util.abreCor(\'\',\'i3GEOEditorOLcorPre\');" />'}ins+=""+' </td>'+' </tr>'+' <tr>'+' <td>Cor da fonte</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'fontColor\',\'i3GEOEditorOLcorFonte\')" type="text" style="cursor:text" id="i3GEOEditorOLcorFonte" size="12" value="'+i3GEO.editorOL.simbologia.fontColor+'" /></td><td>';if(i3GEO.configura){ins+='<img alt="aquarela.gif" style=cursor:pointer src="'+i3GEO.configura.locaplic+'/imagens/aquarela.gif" onclick="i3GEO.util.abreCor(\'\',\'i3GEOEditorOLcorFonte\');" />'}ins+=""+' </td>'+' </tr>'+' <tr>'+' <td>Tamanho da fonte</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'fontSize\',\'i3GEOEditorOLfontsize\')" type="text" style="cursor:text" id="i3GEOEditorOLfontsize" size="3" value="'+i3GEO.editorOL.simbologia.fontSize+'" /></td><td></td>'+' </tr>'+' <tr>'+' <td>Opacidade (de 0 a 1)</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'opacidade\',\'i3GEOEditorOLopacidade\')" type="text" style="cursor:text" id="i3GEOEditorOLopacidade" size="3" value="'+i3GEO.editorOL.simbologia.opacidade+'" /></td><td></td>'+' </tr>'+' <tr>'+' <td>Largura da linha/contorno</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'strokeWidth\',\'i3GEOEditorOLlarguraLinha\')" type="text" style="cursor:text" id="i3GEOEditorOLlarguraLinha" size="2" value="'+i3GEO.editorOL.simbologia.strokeWidth+'" /></td><td></td>'+' </tr>'+' <tr>'+' <td>Url de uma figura</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'externalGraphic\',\'i3GEOEditorOLexternalGraphic\')" type="text" style="cursor:text" id="i3GEOEditorOLexternalGraphic" size="22" value="'+i3GEO.editorOL.simbologia.externalGraphic+'" /></td><td></td>'+' </tr>'+' <tr>'+' <td>Largura e altura</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'graphicWidth\',\'i3GEOEditorOLgraphicWidth\')" type="text" style="cursor:text" id="i3GEOEditorOLgraphicWidth" size="4" value="'+i3GEO.editorOL.simbologia.graphicWidth+'" /> <input onchange="i3GEO.editorOL.mudaSimbolo(\'graphicHeight\',\'i3GEOEditorOLgraphicHeight\')" type="text" style="cursor:text" id="i3GEOEditorOLgraphicHeight" size="4" value="'+i3GEO.editorOL.simbologia.graphicHeight+'" /></td><td></td>'+' </tr>'+'</table>'+'<br />'+'<p class=paragrafo ><b>Ajusta nó em edição para o(a):</b></p>'+'<table class=lista7 >'+' <tr>'+' <td></td><td>nó</td><td></td><td>vértice</td><td></td><td>borda</td>'+' </tr>'+' <tr>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.snap()" type="checkbox" id="target_node" /></td><td><input onchange="i3GEO.editorOL.snap()" id="target_nodeTolerance" type="text" size="3" value=15 /></td>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.snap()" type="checkbox" id="target_vertex" /></td><td><input onchange="i3GEO.editorOL.snap()" id="target_vertexTolerance" type="text" size="3" value=15 /></td>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.snap()" type="checkbox" id="target_edge" /></td><td><input onchange="i3GEO.editorOL.snap()" id="target_edgeTolerance" type="text" size="3" value=15 /></td>'+' </tr>'+'</table>'+'<br />'+'<p class=paragrafo ><b>Divide intersecção ao digitalizar</b></p>'+'<table class=lista7 >'+' <tr>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.split()" type="checkbox" id="edge_split_toggle" /></td><td>borda</td>'+' </tr>'+'</table>'+'<br />'+'<p class=paragrafo ><b>Operação ativada pelo botão de modificação da figura</b></p>'+'<table class=lista7 >'+' <tr>'+' <td><input checked style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.RESHAPE;" type="radio" name=i3geoOLtipoEdita /></td><td>altera figura</td>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.RESIZE;" type="radio" name=i3geoOLtipoEdita /></td><td>altera tamanho</td>'+' </tr>'+' <tr>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.ROTATE;" type="radio" name=i3geoOLtipoEdita /></td><td>rotaciona</td>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.DRAG;" type="radio" name=i3geoOLtipoEdita /></td><td>desloca</td>'+' </tr>'+'</table>';YAHOO.editorOL.container.panel.setBody(ins);if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){YAHOO.editorOL.container.panel.setHeader("Propriedades<div id='panelpropriedadesEditor_minimizaCabecalho' class='container-minimiza'></div>")}else{YAHOO.editorOL.container.panel.setHeader("Propriedades")}YAHOO.editorOL.container.panel.setFooter("");YAHOO.editorOL.container.panel.render(document.body);YAHOO.editorOL.container.panel.center();YAHOO.util.Event.addListener(YAHOO.editorOL.container.panel.close,"click",function(){});temp=$i("panelpropriedadesEditor_minimizaCabecalho");if(temp){temp.onclick=function(){i3GEO.janela.minimiza("panelpropriedadesEditor")}}}YAHOO.editorOL.container.panel.show();temp=$i("panelpropriedadesEditor").getElementsByTagName("div");if(temp&&temp[2]){temp[2].style.overflow="auto"}},listaGeometrias:function(){if(!document.getElementById("panellistagEditor")){YAHOO.namespace("editorOL.listaGeometrias");YAHOO.editorOL.listaGeometrias.panel=new YAHOO.widget.Panel("panellistagEditor",{zIndex:20000,iframe:true,width:"320px",visible:false,draggable:true,close:true});if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){YAHOO.editorOL.listaGeometrias.panel.setHeader("Geometrias <div id='panellistagEditor_minimizaCabecalho' class='container-minimiza'></div>")}else{YAHOO.editorOL.listaGeometrias.panel.setHeader("Geometrias")}YAHOO.editorOL.listaGeometrias.panel.setFooter("");YAHOO.editorOL.listaGeometrias.panel.render(document.body);YAHOO.editorOL.listaGeometrias.panel.center();YAHOO.util.Event.addListener(YAHOO.editorOL.listaGeometrias.panel.close,"click",function(){YAHOO.editorOL.listaGeometrias.panel.destroy()});temp=$i("panellistagEditor_minimizaCabecalho");if(temp){temp.onclick=function(){i3GEO.janela.minimiza("panellistagEditor")}}}else{YAHOO.editorOL.listaGeometrias.panel.render(document.body)}var g,temp,geos=i3GEO.desenho.layergrafico.features,n=geos.length,ins="<table class=lista4 >";ins+="<tr><td><i>Geometrias</i></td><td><i>Opções</i></td><td></td><td></td></tr>";while(n>0){n-=1;g=geos[n].geometry;ins+="<tr><td>"+g.CLASS_NAME+"</td><td style='cursor:pointer;color:blue' onclick='javascript:i3GEO.editorOL.selFeature("+n+")'>seleciona</td><td style='cursor:pointer;color:blue' onclick='javascript:i3GEO.editorOL.unselFeature("+n+")'>limpa</td><td style='cursor:pointer;color:blue' onclick='javascript:i3GEO.editorOL.flashFeaturesI("+n+")'>brilha</td></tr>"}ins+="</table>";if(geos.length===0){ins="Nenhum elemento gráfico encontrado. Utilize as opções de criação de geometrias."}YAHOO.editorOL.listaGeometrias.panel.show();if(i3GEO.configura){temp=$i("panellistagEditor").getElementsByTagName("div")[2]}else{temp=$i("panellistagEditor").getElementsByTagName("div")[1]}temp.style.overflow="auto";temp.style.height="100px";temp.innerHTML=ins},ferramentas:function(){if(!document.getElementById("panelferramentasEditor")){YAHOO.namespace("editorOL.ferramentas");YAHOO.editorOL.ferramentas.panel=new YAHOO.widget.Panel("panelferramentasEditor",{zIndex:20000,iframe:true,width:"300px",visible:false,draggable:true,close:true});var ins=""+'<p class=paragrafo >Operações sobre as figuras selecionadas:</p>'+'<select onchange="i3GEO.editorOL.processageo(this.value);this.value = \'\'" >'+' <option value="">---</option>'+' <option value=union >União</option>';if(i3GEO.php){ins+=' <option value=intersection >Intersecção</option>'+' <option value=convexhull >Convex hull</option>'+' <option value=boundary >Bordas</option>'+' <option value=difference >Diferença</option>'+' <option value=symdifference >Diferença simétrica</option>'}ins+='</select>'+'<br><br><a class=paragrafo href=# onclick="i3GEO.desenho.layergrafico.destroyFeatures()" >Apaga tudo</a>';YAHOO.editorOL.ferramentas.panel.setBody(ins);if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){YAHOO.editorOL.ferramentas.panel.setHeader("Ferramentas <div id='panelferramentasEditor_minimizaCabecalho' class='container-minimiza'></div>")}else{YAHOO.editorOL.ferramentas.panel.setHeader("Ferramentas")}YAHOO.editorOL.ferramentas.panel.setFooter("");YAHOO.editorOL.ferramentas.panel.render(document.body);YAHOO.editorOL.ferramentas.panel.center();YAHOO.util.Event.addListener(YAHOO.editorOL.ferramentas.panel.close,"click",function(){});temp=$i("panelferramentasEditor_minimizaCabecalho");if(temp){temp.onclick=function(){i3GEO.janela.minimiza("panelferramentasEditor")}}}else{YAHOO.editorOL.ferramentas.panel.render(document.body)}YAHOO.editorOL.ferramentas.panel.show()},snap:function(){var target=i3GEOOLsnap.targets[0],tipos=["node","vertex","edge"],ntipos=tipos.length,i,temp,ativa=false;i3GEOOLsnap.deactivate();for(i=0;i<ntipos;i++){temp=$i("target_"+tipos[i]);target[tipos[i]]=temp.checked;if(temp.checked===true){ativa=true}temp=$i("target_"+tipos[i]+"Tolerance");target[tipos[i]+"Tolerance"]=temp.value}if(ativa===true){i3GEOOLsnap.activate()}},split:function(){i3GEOOLsplit.deactivate();var temp=$i("edge_split_toggle");if(temp.checked===true){i3GEOOLsplit.activate()}},processageo:function(operacao){if(operacao===""){return}var geosel=i3GEO.desenho.layergrafico.selectedFeatures,polis,linhas,pontos,temp;if(geosel.length>0){polis=i3GEO.editorOL.retornaGeometriasTipo(geosel,"OpenLayers.Geometry.Polygon");linhas=i3GEO.editorOL.retornaGeometriasTipo(geosel,"OpenLayers.Geometry.LineString");pontos=i3GEO.editorOL.retornaGeometriasTipo(geosel,"OpenLayers.Geometry.Point");temp=function(retorno){if(i3GEO.janela){i3GEO.janela.fechaAguarde("i3GEO.editorPoli");i3GEO.janela.fechaAguarde("i3GEO.editorLinhas");i3GEO.janela.fechaAguarde("i3GEO.editorPontos")}if(retorno!=""&&retorno.data&&retorno.data!=""&&operacao!="converteSHP"){i3GEO.editorOL.substituiFeaturesSel(retorno.data)}if(operacao==="converteSHP"){i3GEO.atualiza();i3GEO.janela.minimiza("paneltemaativo")}};if(operacao==="union"&&!i3GEO.php){if(polis.length>0){temp=i3GEO.editorOL.uniaojts(polis);i3GEO.editorOL.substituiFeaturesSel(temp)}if(linhas.length>0){temp=i3GEO.editorOL.uniaojts(linhas);i3GEO.editorOL.substituiFeaturesSel(temp)}if(pontos.length>0){temp=i3GEO.editorOL.uniaojts(p);i3GEO.editorOL.substituiFeaturesSel(temp)}}else{if(polis.length>0){i3GEO.janela.abreAguarde("i3GEO.editorPoli","Poligonos");i3GEO.php.funcoesGeometriasWkt(temp,polis.join("|"),operacao)}if(linhas.length>0){i3GEO.janela.abreAguarde("i3GEO.editorLinhas","Linhas");i3GEO.php.funcoesGeometriasWkt(temp,linhas.join("|"),operacao)}if(pontos.length>0){i3GEO.janela.abreAguarde("i3GEO.editorPontos","Pontos");i3GEO.php.funcoesGeometriasWkt(temp,pontos.join("|"),operacao)}}return}else{alert("Selecione pelo menos dois elementos")}},uniaojts:function(geoms){var n=geoms.length,rwkt=new jsts.io.WKTReader(),wwkt=new jsts.io.WKTWriter(),fwkt=new OpenLayers.Format.WKT(),g,i,uniao;if(n>1){uniao=(fwkt.read(geoms[0]).geometry).toString();uniao=rwkt.read(uniao);for(i=1;i<=n;i++){g=(fwkt.read(geoms[i]).geometry).toString();uniao=uniao.union(rwkt.read(g))}uniao=wwkt.write(uniao);return[fwkt.read(uniao)]}else{return false}},retornaGeometriasTipo:function(features,tipo){var n=features.length,lista=[],i,temp;for(i=0;i<n;i++){temp=features[i].geometry;if(temp.CLASS_NAME==tipo){lista.push(temp)}}return lista},guardaBackup:function(){return;if(!i3GEO.editorOL.backup){i3GEO.editorOL.backup=new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false})}else{i3GEO.editorOL.backup.removeFeatures(i3GEO.editorOL.backup.features)}i3GEO.editorOL.backup.addFeatures(i3GEO.desenho.layergrafico.features)},unselTodos:function(){var n,i;n=i3GEO.desenho.layergrafico.features.length;for(i=0;i<n;i++){i3GEO.desenho.layergrafico.features[i].renderIntent="default";i3GEO.editorOL.selbutton.unselect(i3GEO.desenho.layergrafico.features[i])}},unselTodosBackup:function(){var n,i;n=i3GEO.editorOL.backup.features.length;for(i=0;i<n;i++){i3GEO.editorOL.backup.features[i].renderIntent="default";i3GEO.editorOL.selbutton.unselect(i3GEO.editorOL.backup.features[i])}},restauraBackup:function(){if(i3GEO.editorOL.backup.features.length>0){i3GEO.desenho.layergrafico.removeFeatures(i3GEO.desenho.layergrafico.features);i3GEO.desenho.layergrafico.addFeatures(i3GEO.editorOL.backup.features)}if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}},substituiFeaturesSel:function(wkt){i3GEO.editorOL.guardaBackup();try{var f,fwkt=new OpenLayers.Format.WKT();i3GEO.desenho.layergrafico.removeFeatures(i3GEO.desenho.layergrafico.selectedFeatures);f=fwkt.read(wkt);f["attributes"]={opacidade:i3GEO.editorOL.simbologia.opacidade,texto:i3GEO.editorOL.simbologia.texto,fillColor:i3GEO.editorOL.simbologia.fillColor,strokeWidth:i3GEO.editorOL.simbologia.strokeWidth,strokeColor:i3GEO.editorOL.simbologia.strokeColor,pointRadius:i3GEO.editorOL.simbologia.pointRadius,graphicName:i3GEO.editorOL.simbologia.graphicName};i3GEO.desenho.layergrafico.addFeatures([f]);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}}catch(e){i3GEO.editorOL.restauraBackup()}},adicionaFeatureWkt:function(wkt,atributos){var f,fwkt=new OpenLayers.Format.WKT();if(atributos.externalGraphic&&atributos.externalGraphic!=""){var style_mark=OpenLayers.Util.extend({},OpenLayers.Feature.Vector.style['default']);style_mark.externalGraphic=atributos.externalGraphic;style_mark.graphicWidth=atributos.graphicWidth;style_mark.graphicHeight=atributos.graphicHeight;style_mark.fillOpacity=atributos.opacidade;f=fwkt.read(wkt);f["attributes"]=atributos;f["style"]=style_mark}else{f=fwkt.read(wkt);f["attributes"]=atributos}i3GEO.desenho.layergrafico.addFeatures([f]);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}},flashFeaturesI:function(index){i3GEO.editorOL.flashFeatures([i3GEO.desenho.layergrafico.features[index]],0)},flashFeatures:function(features,index){if(!index){index=0}var current=features[index];if(current&¤t.layer===i3GEO.desenho.layergrafico){i3GEO.desenho.layergrafico.drawFeature(features[index],"select")}var prev=features[index-1];if(prev&&prev.layer===i3GEO.desenho.layergrafico){i3GEO.desenho.layergrafico.drawFeature(prev,"default")}++index;if(index<=features.length){window.setTimeout(function(){i3GEO.editorOL.flashFeatures(features,index)},75)}},selFeature:function(index){i3GEO.editorOL.selbutton.select(i3GEO.desenho.layergrafico.features[index])},unselFeature:function(index){i3GEO.editorOL.selbutton.unselect(i3GEO.desenho.layergrafico.features[index])},carregajts:function(funcao){if(i3GEO.configura){i3GEO.util.scriptTag(i3GEO.configura.locaplic+"/pacotes/jsts/lib/jsts.js",funcao,"i3GEOjts",true)}else{i3GEO.util.scriptTag("../pacotes/jsts/lib/jsts.js",funcao,"i3GEOjts",true)}},trazParaFrente:function(){var features=i3GEO.desenho.layergrafico.selectedFeatures;if(features.length>0){i3GEO.editorOL.backup=new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false});i3GEO.editorOL.backup.addFeatures(features);i3GEO.editorOL.unselTodosBackup();i3GEO.desenho.layergrafico.removeFeatures(features);i3GEO.desenho.layergrafico.addFeatures(i3GEO.editorOL.backup.features);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}}else{alert("Selecione pelo menos um elemento")}},pegaControle:function(classe){var n=i3GEO.editorOL.controles.length,i;for(i=0;i<n;i++){if(i3GEO.editorOL.controles[i].CLASS_NAME===classe){return i3GEO.editorOL.controles[i]}}return false},ativaLayerSwitcher:function(){var ls=i3GEO.editorOL.pegaControle("OpenLayers.Control.LayerSwitcher");if(ls){ls.maximizeDiv.click()}},desativaRodaDoMouse:function(){var controls=i3GEO.editorOL.mapa.getControlsByClass('OpenLayers.Control.Navigation');for(var i=0;i<controls.length;++i){controls[i].disableZoomWheel()}},google2wgs:function(obj){if(i3GEO.Interface.openlayers.googleLike===true){var projWGS84=new OpenLayers.Projection("EPSG:4326"),proj900913=new OpenLayers.Projection("EPSG:900913");return obj.transform(proj900913,projWGS84)}else{return obj}}}; | |
1482 | +if(typeof(i3GEO)==='undefined'){var i3GEO={}}YAHOO.namespace("i3GEO.janela");YAHOO.i3GEO.janela.manager=new YAHOO.widget.OverlayManager();YAHOO.namespace("janelaDoca.xp");YAHOO.janelaDoca.xp.manager=new YAHOO.widget.OverlayManager();YAHOO.i3GEO.janela.managerAguarde=new YAHOO.widget.OverlayManager();i3GEO.janela={ESTILOBD:"display:block;padding:5px 1px 5px 1px;",ESTILOAGUARDE:"normal",AGUARDEMODAL:false,ANTESCRIA:["i3GEO.janela.prepara()"],ANTESFECHA:[],TRANSICAOSUAVE:true,OPACIDADE:65,OPACIDADEAGUARDE:50,TIPS:[],ULTIMOZINDEX:5,prepara:function(){var iu=i3GEO.util;iu.escondeBox()},cria:function(wlargura,waltura,wsrc,nx,ny,texto,id,modal,classe,funcaoCabecalho,funcaoMinimiza,funcaoAposRedim,dimensionavel,icone,funcaoDuplica){if(!dimensionavel){dimensionavel=true}if(!icone){icone=""}if($i(id)){janela=YAHOO.i3GEO.janela.manager.find(id);janela.show();janela.bringToTop();return}var i,wlargurA,ins,novoel,wdocaiframe,temp,fix,underlay,ifr,janela;if(navm&&!chro){this.TRANSICAOSUAVE=false}if(this.ANTESCRIA){for(i=0;i<this.ANTESCRIA.length;i++){eval(this.ANTESCRIA[i])}}if(!classe||classe==""){classe="hd"}if(!id||id===""){id="wdoca"}if(!modal||modal===""){modal=false}ifr=false;if(i3GEO.Interface&&i3GEO.Interface!=undefined&&i3GEO.Interface.ATUAL==="googleearth"){i3GEO.janela.TRANSICAOSUAVE=false;ifr=true}fix="contained";if(nx===""||nx==="center"){fix=true}if(modal===true){underlay="none"}else{underlay="shadow"}temp=navm?0:2;wlargurA=parseInt(wlargura,10)+temp+"px";ins='<div id="'+id+'_cabecalho" class="'+classe+'" >';if(i3GEO.configura!==undefined){ins+="<img id='"+id+"_imagemCabecalho' class='i3GeoAguardeJanela' style='visibility:hidden;' src=\'"+i3GEO.configura.locaplic+"/imagens/aguarde2.gif\' />"}if(icone!=""){ins+="<img class='i3GeoIconeJanela' src='"+icone+"' >"}ins+="<span style='font-size:10px;'>"+texto+"</span>";if(funcaoDuplica){ins+="<div id='"+id+"_duplicaJanela' class='container-duplica'></div>"}if(funcaoMinimiza){ins+="<div id='"+id+"_minimizaCabecalho' class='container-minimiza'></div>"}ins+='</div><div id="'+id+'_corpo" class="bd" style="'+this.ESTILOBD+'">';if(wsrc!==""){ins+='<iframe name="'+id+'i" id="'+id+'i" valign="top" style="border:0px white solid;width:100%"></iframe>'}ins+='</div>';ins+='<div class="ft"></div>';novoel=document.createElement("div");novoel.id=id;novoel.style.display="block";novoel.innerHTML=ins;if(this.TRANSICAOSUAVE){novoel.onmouseover=function(){YAHOO.util.Dom.setStyle(novoel,"opacity",1)};novoel.onmouseout=function(){YAHOO.util.Dom.setStyle(novoel,"opacity",i3GEO.janela.OPACIDADE/100)};YAHOO.util.Dom.setStyle(novoel,"opacity",1)}document.body.appendChild(novoel);wdocaiframe=$i(id+"i");if(wdocaiframe){temp=wdocaiframe.style;temp.height=waltura;temp.display="block";wdocaiframe.src=wsrc}else{if(waltura!=="auto"){$i(id+'_corpo').style.height=parseInt(waltura,10)+"px"}$i(id+'_corpo').style.width='100%';$i(id+'_corpo').style.overflow="auto"}if(waltura==="auto"||dimensionavel==false){janela=new YAHOO.widget.Panel(id,{iframe:ifr,modal:modal,width:wlargurA,underlay:underlay,fixedcenter:fix,constraintoviewport:true,visible:true,monitorresize:false,dragOnly:true,keylisteners:null})}else{janela=new YAHOO.widget.Panel(id,{hideMode:'offsets',iframe:ifr,underlay:underlay,modal:modal,width:wlargurA,fixedcenter:fix,constraintoviewport:true,visible:true,monitorresize:false,dragOnly:true,keylisteners:null});var resize=new YAHOO.util.Resize(id,{handles:['br'],autoRatio:false,minWidth:10,minHeight:10,status:false,proxy:true,ghost:false,animate:false,useShim:true});resize.on('resize',function(args){this.cfg.setProperty("height",args.height+"px");if($i(id+"i")){$i(id+"i").style.height=args.height+"px"}},janela,true);if(funcaoAposRedim&&funcaoAposRedim!=""){resize.on('endResize',function(args){funcaoAposRedim.call();i3GEO.janela.minimiza()},janela,true)}resize.getProxyEl().style.height="0px"}if(nx!==""&&nx!=="center"){janela.moveTo(nx,ny+50)}YAHOO.i3GEO.janela.manager.register(janela);if(this.TRANSICAOSUAVE){janela.cfg.setProperty("effect",[{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.5}])}janela.cfg.setProperty("zIndex",[4]);janela.render();janela.bringToTop();if(navm&&id!=="i3geo_janelaMensagens"&&i3GEO.Interface&&i3GEO.Interface!=undefined&&i3GEO.Interface.ATUAL==="googleearth"){janela.moveTo(0,0)}if(ifr===true){janela.iframe.style.zIndex=4}YAHOO.util.Event.addListener($i(id+'_corpo'),"click",YAHOO.util.Event.stopPropagation);if(funcaoDuplica){$i(id+'_duplicaJanela').onclick=funcaoDuplica}if(funcaoCabecalho){$i(id+'_cabecalho').onclick=funcaoCabecalho}if(funcaoMinimiza){$i(id+"_minimizaCabecalho").onclick=funcaoMinimiza}YAHOO.util.Event.addListener(janela.close,"click",i3GEO.janela.fecha,janela,{id:id},true);temp=$i(id+"_corpo");return([janela,$i(id+"_cabecalho"),temp])},minimiza:function(id){var temp=$i(id+"_corpo"),n,i,m=YAHOO.i3GEO.janela.manager.find(id);if(temp){if(temp.style.display==="block"){temp.style.display="none";if(m){m.hideIframe}}else{temp.style.display="block";if(m){m.showIframe}}}temp=$i(id+"_resizehandle");if(temp){if(temp.style.display==="none"){temp.style.display="block"}else{temp.style.display="none"}}temp=$i(id+"_c");if(temp){temp=temp.getElementsByTagName("div");n=temp.length;for(i=0;i<n;i++){if(temp[i].className==="underlay"||temp[i].className==="bd"){if(temp[i].style.display==="none"){temp[i].style.display="block"}else{temp[i].style.display="none"}}}}temp=$i(id+"_corpo");if(temp){if(temp.style.display==="none"){temp.style.display="block"}else{temp.style.display="none"}}temp=$i(id);if(temp){if(temp.style.display==="none"){temp.style.height="100%"}else{temp.style.height="10%"}}},fecha:function(event,args){var i,id;i3GEO.util.escondeBox();if(i3GEO.janela.ANTESFECHA){for(i=0;i<i3GEO.janela.ANTESFECHA.length;i++){eval(i3GEO.janela.ANTESFECHA[i])}}if(i3GEO.janela.id){id=i3GEO.janela.id}else{id=event.id}if(id==undefined){id=args.id}i3GEO.janela.destroi(id)},destroi:function(id){var janela=YAHOO.i3GEO.janela.manager.find(id);i3GEO.util.removeScriptTag(id+"_script");i3GEO.util.removeScriptTag(id+".dicionario_script");if(janela){YAHOO.i3GEO.janela.manager.remove(janela);janela=$i(id+"_c");janela.parentNode.removeChild(janela)}},alteraTamanho:function(w,h,id){var i;if(arguments.length===3){i=$i(id)}else{i=$i("wdoca")}if(i){i.style.width=w+"px";i.style.height=h+"px"}},abreAguarde:function(id,texto){var pos,temp,janela;if(!id||id==undefined){return}janela=YAHOO.i3GEO.janela.managerAguarde.find(id);pos=[0,0];if(i3GEO.Interface&&$i(i3GEO.Interface.IDCORPO)){pos=YAHOO.util.Dom.getXY($i(i3GEO.Interface.IDCORPO))}else if($i("contemImg")){pos=YAHOO.util.Dom.getXY($i("contemImg"))}if(i3GEO.janela.AGUARDEMODAL==true){texto+="<br><span style='color:navy;cursor:pointer;font-size:9px;' onclick='javascript:if(i3GEO.janela.AGUARDEMODAL == true){i3GEO.janela.AGUARDEMODAL = false;}else{i3GEO.janela.AGUARDEMODAL = true;}'>bloquear/desbloquear</span>"}if(!janela){janela=new YAHOO.widget.Panel(id,{width:"240px",fixedcenter:false,underlay:"none",close:true,draggable:false,modal:i3GEO.janela.AGUARDEMODAL,monitorresize:false});janela.render(document.body);YAHOO.i3GEO.janela.managerAguarde.register(janela)}if(i3GEO.janela.ESTILOAGUARDE==="normal"||i3GEO.janela.ESTILOAGUARDE==="reduzida"){janela.setBody(texto);janela.body.style.padding="5px"}if(i3GEO.janela.ESTILOAGUARDE==="normal"||i3GEO.janela.ESTILOAGUARDE==="minima"){janela.setHeader("<span><img id=aguardeGifAberto src='"+i3GEO.configura.locaplic+"/imagens/aguarde.gif' /></span> <span style=font-size:8px >"+YAHOO.i3GEO.janela.managerAguarde.overlays.length+"</span>")}if(i3GEO.parametros&&i3GEO.parametros.w>0){janela.moveTo(pos[0]+(i3GEO.parametros.w/2)-120,pos[1])}else{janela.moveTo(pos[0],pos[1])}janela.show();if(janela.header){janela.header.style.height="20px"}temp=$i(id+"_c");if(temp){temp.style.backgroundColor=""}YAHOO.util.Dom.setStyle(temp,"opacity",i3GEO.janela.OPACIDADEAGUARDE/100)},fechaAguarde:function(id){if(id!=undefined){var janela=YAHOO.i3GEO.janela.managerAguarde.find(id);if(janela){YAHOO.i3GEO.janela.managerAguarde.remove(janela);janela.destroy()}}},tempoMsg:function(texto,tempo){var pos,janela,attributes,anim,altura=40;janela=YAHOO.i3GEO.janela.managerAguarde.find("i3geoTempoMsg");pos=[0,0];if(i3GEO.Interface&&$i(i3GEO.Interface.IDCORPO)){pos=YAHOO.util.Dom.getXY($i(i3GEO.Interface.IDCORPO))}else if($i("contemImg")){pos=YAHOO.util.Dom.getXY($i("contemImg"))}if(!janela){janela=new YAHOO.widget.Panel("i3geoTempoMsg",{width:"220px",fixedcenter:false,underlay:"none",close:false,draggable:false,modal:false,monitorresize:false,iframe:true});janela.render(document.body);YAHOO.i3GEO.janela.managerAguarde.register(janela)}janela.setBody(texto);altura=70;janela.body.style.padding="5px";janela.body.style.backgroundColor="yellow";if(i3GEO.Interface&&i3GEO.Interface.ATUAL!="googleearth"){janela.body.style.height="0px"}else{janela.body.style.height=altura+"px"}janela.body.style.overflow="hidden";janela.body.onclick=function(){var janela=YAHOO.i3GEO.janela.managerAguarde.find("i3geoTempoMsg");if(janela){janela.destroy()}};if(i3GEO.parametros&&i3GEO.parametros.w>0){janela.moveTo(pos[0]+(i3GEO.parametros.w/2)-120,pos[1])}else{janela.moveTo(pos[0],pos[1])}janela.show();if(i3GEO.Interface&&i3GEO.Interface.ATUAL!="googleearth"){attributes={height:{to:altura}};anim=new YAHOO.util.Anim(janela.body,attributes,.5,YAHOO.util.Easing.easeNone);anim.onComplete.subscribe(function(){janela.body.style.overflow="auto";janela.body.style.display="block";$i("i3geoTempoMsg_c").style.zIndex=100000});anim.animate()}if(!tempo){tempo=4000}setTimeout(function(){var attributes,anim,janela=YAHOO.i3GEO.janela.managerAguarde.find("i3geoTempoMsg");if(i3GEO.Interface&&i3GEO.Interface.ATUAL!="googleearth"){if(janela){janela.body.style.overflow="hidden";attributes={height:{to:0}};anim=new YAHOO.util.Anim(janela.body,attributes,.5,YAHOO.util.Easing.easeNone);anim.onComplete.subscribe(function(){janela.destroy()});anim.animate()}}else{janela.destroy()}},tempo)},ativaAlerta:function(){window.alert=function(texto){var textoI,janela=YAHOO.i3GEO.janela.managerAguarde.find("alerta");if(!janela){janela=new YAHOO.widget.SimpleDialog("alerta",{width:"300px",fixedcenter:true,visible:false,draggable:false,zIndex:100000,textAlign:"left",close:true,modal:false,effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25},constraintoviewport:true,buttons:[{text:$trad("x74"),handler:function(){this.destroy()},isDefault:true}],icon:YAHOO.widget.SimpleDialog.ICON_WARN,text:""});YAHOO.i3GEO.janela.managerAguarde.register(janela);janela.setHeader(" ");janela.render(document.body)}textoI=janela.cfg.getProperty("text");if(textoI!=""){textoI+="<br>"}texto=textoI+texto;janela.cfg.setProperty("text",texto);janela.show()}},confirma:function(pergunta,w,resposta1,resposta2,funcao1,funcao2){var f1,f2,janela=YAHOO.i3GEO.janela.managerAguarde.find("confirma");if(!w||w==""){w=300}if(!funcao1||funcao1==""){f1=function(){YAHOO.i3GEO.janela.managerAguarde.find("confirma").destroy();return true}}else{f1=function(){funcao1.call();YAHOO.i3GEO.janela.managerAguarde.find("confirma").destroy()}}if(!funcao2||funcao2==""){f2=function(){YAHOO.i3GEO.janela.managerAguarde.find("confirma").destroy();return false}}else{f2=function(){YAHOO.i3GEO.janela.managerAguarde.find("confirma").destroy();funcao2.call()}}if(!resposta1||resposta1==""){resposta1=$trad("x58")}if(!resposta2||resposta2==""){resposta2=$trad("x75")}if(janela){janela.destroy()}janela=new YAHOO.widget.SimpleDialog("confirma",{width:w+"px",fixedcenter:true,visible:false,draggable:false,zIndex:100000,textAlign:"left",close:false,modal:false,effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25},constraintoviewport:true,buttons:[{text:resposta1,handler:f1},{text:resposta2,handler:f2}],icon:YAHOO.widget.SimpleDialog.ICON_HELP,text:pergunta});YAHOO.i3GEO.janela.managerAguarde.register(janela);janela.setHeader(" ");janela.render(document.body);janela.show()},prompt:function(pergunta,funcaoOk,valorDefault){if($i("i3GEOjanelaprompt")){return}if(!valorDefault){valorDefault=""}var i="<br><input id='i3GEOjanelaprompt' type=text value='"+valorDefault+"' style='position:relative;top:5px;width:98%;cursor:text;' />";i3GEO.janela.confirma(pergunta+i,"","","",funcaoOk)},mensagemSimples:function(texto,cabecalho){var janela;if($i("mensagemSimples1")){janela=YAHOO.i3GEO.janela.manager.find("mensagemSimples1")}else{janela=new YAHOO.widget.SimpleDialog("mensagemSimples1",{width:"300px",fixedcenter:true,visible:true,draggable:true,zIndex:100000,textAlign:"left",close:true,modal:false,effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25},constraintoviewport:true,text:""});YAHOO.i3GEO.janela.manager.register(janela);janela.setHeader(cabecalho);janela.render(document.body)}janela.setHeader(cabecalho);janela.cfg.setProperty("text",texto);janela.show()},tip:function(cabecalho){var Nid,i,novoel,res;if(arguments.length===0){cabecalho="fixar"}Nid=YAHOO.util.Dom.generateId();i=$i("i3geo_rosa");if(i){i.style.display="none"}if(i3GEO.Interface&&$i(i3GEO.Interface.IDCORPO)){$i("img").title=""}novoel=document.createElement("div");novoel.id=Nid;novoel.style.position="absolute";novoel.style.zIndex=5000;novoel.style.textAlign="left";novoel.style.background="white";if(navm){novoel.style.filter="alpha(opacity=90)"}else{novoel.style.opacity=".9"}document.body.appendChild(novoel);i3GEO.janela.TIPS.push($i(Nid));res="<div id='"+Nid+"cabecatip' style='text-align:left;background-color:rgb(240,240,240)'>";res+="<span style='color:navy;cursor:pointer;text-align:left' onclick='javascript:$i(\""+Nid+"cabecatip\").innerHTML =\"\";' >"+cabecalho+"</span></div>";novoel.innerHTML="<table style='text-align:left'><tr><td style='text-align:left'>"+res+"</td></tr></table>";ist=novoel.style;ist.top=objposicaocursor.telay-9+"px";ist.left=objposicaocursor.telax-5+"px";ist.display="block";if(i3GEO.eventos.NAVEGAMAPA.toString().search("i3GEO.janela.excluiTips('todos')")<0){i3GEO.eventos.NAVEGAMAPA.push("i3GEO.janela.excluiTips('todos')")}if(i3GEO.eventos.MOUSEMOVE.toString().search("i3GEO.janela.excluiTips('naofixos')")<0){i3GEO.eventos.MOUSEMOVE.push("i3GEO.janela.excluiTips('naofixos')")}return(Nid)},excluiTips:function(tipo){var ot,i;if(arguments.length===0){tipo="todos"}if(i3GEO.janela.TIPS.length>0){ot=i3GEO.janela.TIPS.length-1;if(ot>=0){do{if(tipo==='todos'){if(i3GEO.janela.TIPS[ot]){i=$i(i3GEO.janela.TIPS[ot].id);document.body.removeChild(i)}}if(tipo==='naofixos'){if($i(i3GEO.janela.TIPS[ot])){if($i(i3GEO.janela.TIPS[ot].id+"cabecatip").innerHTML!==""){document.body.removeChild($i(i3GEO.janela.TIPS[ot].id))}}}}while(ot--);if(tipo==="todos"){i3GEO.janela.TIPS=[]}}}},slider:function(funcao,inicial){var scaleFactor,bottomConstraint,topConstraint,janela,novoel,Event,slider="",bg,thumb;janela=i3GEO.janela.cria(230,200,"","","",$trad("t20"),"opacidadeG");novoel=document.createElement("div");novoel.id="slider-bg";novoel.tabindex="-1";novoel.innerHTML='<div style="cursor:default;position:absolute;top:4px" id="slider-thumb"><img src="'+i3GEO.configura.locaplic+'/imagens/thumb-n.gif"></div>';janela[2].appendChild(novoel);Event=YAHOO.util.Event;bg="slider-bg";thumb="slider-thumb";novoel.style.position="relative";novoel.style.background='url('+i3GEO.configura.locaplic+'/imagens/bg-fader.gif) 5px 0 no-repeat';novoel.style.height="28px";novoel.style.width="228px";topConstraint=0;bottomConstraint=200;scaleFactor=1;Event.onDOMReady(function(){slider=YAHOO.widget.Slider.getHorizSlider(bg,thumb,topConstraint,bottomConstraint,20);slider.setValue(parseInt(inicial,10));slider.getRealValue=function(){return Math.round(this.getValue()*scaleFactor)};slider.subscribe("slideEnd",function(offsetFromStart){var actualValue=slider.getRealValue();eval(funcao+"("+actualValue+")")})});Event.on("putval","click",function(e){slider.setValue(100,false)})},comboCabecalhoTemas:function(idDiv,idCombo,ferramenta,tipo,onButtonClick){var temp=$i(idDiv);if(temp&&!($i(idCombo))){i3GEO.util.comboTemas(temp.id+"Sel",function(retorno){var tema,container=$i(idDiv),botao;container.innerHTML=retorno.dados;botao=new YAHOO.widget.Button(idCombo,{type:"menu",menu:idCombo+"select"});if(i3GEO.temaAtivo!=""){tema=i3GEO.arvoreDeCamadas.pegaTema(i3GEO.temaAtivo);botao.set("label","<span class='cabecalhoTemas' >"+tema.tema+"</span> ")}else{botao.set("label","<span class='cabecalhoTemas' >"+$trad("x92")+"</span> ")}if(!onButtonClick){onButtonClick=function(p_sType,p_aArgs){var oMenuItem=p_aArgs[1];if(oMenuItem){if(oMenuItem.value!=""){i3GEO.mapa.ativaTema(oMenuItem.value);botao.set("label","<span class='cabecalhoTemas' >"+oMenuItem.cfg.getProperty("text")+"</span> ");if(i3GEOF[ferramenta]){i3GEOF[ferramenta].tema=oMenuItem.value;$i("i3GEOF."+ferramenta+"_corpo").innerHTML="";eval("i3GEOF."+ferramenta+".inicia('i3GEOF."+ferramenta+"_corpo');")}}}}}botao.getMenu().subscribe("click",onButtonClick,botao)},temp.id,"",false,tipo,"",true)}if(i3GEO.eventos.ATUALIZAARVORECAMADAS.length>20){i3GEO.eventos.ATUALIZAARVORECAMADAS=[]}temp="i3GEO.janela.comboCabecalhoTemas('"+idDiv+"','"+idCombo+"','"+ferramenta+"','"+tipo+"')";if(i3GEO.eventos.ATUALIZAARVORECAMADAS.toString().search(temp)<0){i3GEO.eventos.ATUALIZAARVORECAMADAS.push(temp)}}}; | |
1483 | +if(!i3GEO||typeof(i3GEO)==='undefined'){var i3GEO={};i3GEO.Interface={};navn=false;navm=false;$i=function(id){return document.getElementById(id)};app=navigator.appName.substring(0,1);if(app==='N'){navn=true}else{navm=true}OpenLayers.ImgPath="../pacotes/openlayers/img/";OpenLayers.Lang.setCode("pt-BR")}i3GEO.editorOL={simbologia:{opacidade:0.8,texto:"",fillColor:"250,180,15",strokeWidth:2,strokeColor:"250,150,0",pointRadius:4,graphicName:"square",fontSize:"12px",fontColor:"0,0,0",externalGraphic:"",graphicHeight:25,graphicWidth:25},backup:new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false}),nomeFuncaoSalvar:"i3GEO.editorOL.salvaGeo()",e_oce:new OpenLayers.Layer.ArcGIS93Rest("ESRI Ocean Basemap","http://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer/export",{format:"jpeg"},{isBaseLayer:true,visibility:false}),e_ims:new OpenLayers.Layer.ArcGIS93Rest("ESRI Imagery World 2D","http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer/export",{format:"jpeg"},{isBaseLayer:true,visibility:false}),e_wsm:new OpenLayers.Layer.ArcGIS93Rest("ESRI World Street Map","http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer/export",{format:"jpeg"},{isBaseLayer:true,visibility:false}),ol_mma:new OpenLayers.Layer.WMS("Base cartográfica","http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseraster.map&",{layers:'baseraster',SRS:'EPSG:4618',FORMAT:'image/png'},{singleTile:false}),ol_wms:new OpenLayers.Layer.WMS("OpenLayers WMS","http://labs.metacarta.com/wms/vmap0",{layers:'basic'}),top_wms:new OpenLayers.Layer.WMS("Toponímia MMA","http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseref.map&",{layers:"base",FORMAT:'image/png'}),est_wms:new OpenLayers.Layer.WMS("Estados do Brasil","http://mapas.mma.gov.br/i3geo/ogc.php?tema=estadosl&",{layers:"estadosl",FORMAT:'image/png'}),osm:new OpenLayers.Layer.OSM("OSM","http://tile.openstreetmap.org/${z}/${x}/${y}.png",{isBaseLayer:true,visibility:false}),fundo:"e_ims,e_wsm,ol_mma,ol_wms,top_wms,est_wms,e_oce",kml:[],layersIniciais:[],botoes:{'pan':true,'zoombox':true,'zoomtot':true,'zoomin':true,'zoomout':true,'legenda':true,'distancia':true,'area':true,'identifica':true,'linha':true,'ponto':true,'poligono':true,'texto':true,'edita':true,'listag':true,'corta':true,'apaga':true,'procura':true,'selecao':true,'salva':true,'ajuda':true,'propriedades':true,'fecha':false,'tools':true,'undo':false,'frente':false,'legenda':true,'rodadomouse':true},pontos:[],marca:"../pacotes/openlayers/img/marker-gold.png",controles:[new OpenLayers.Control.Navigation(),new OpenLayers.Control.PanZoomBar(),new OpenLayers.Control.LayerSwitcher({'ascending':false}),new OpenLayers.Control.ScaleLine(),new OpenLayers.Control.MousePosition({'separator':' '}),new OpenLayers.Control.OverviewMap(),new OpenLayers.Control.KeyboardDefaults()],tiles:true,incluilayergrafico:true,ativalayerswitcher:false,ativarodadomouse:true,legendahtml:false,numzoom:12,minresolution:0.703125,maxext:"",mapext:new OpenLayers.Bounds(-76.5125927,-39.3925675209,-29.5851853,9.49014852081),mapa:"",inicia:function(){var single=false,alayers=[],fundo=(i3GEO.editorOL.fundo).split(","),nfundo=fundo.length,ncontroles=i3GEO.editorOL.controles.length,i,n;if(i3GEO.editorOL.tiles===false||i3GEO.editorOL.tiles==="false"){single=true}if(i3GEO.editorOL.ativalayerswitcher==="false"){i3GEO.editorOL.ativalayerswitcher=false}if(i3GEO.editorOL.ativalayerswitcher==="true"){i3GEO.editorOL.ativalayerswitcher=true}if(i3GEO.editorOL.ativarodadomouse==="false"){i3GEO.editorOL.ativarodadomouse=false}if(i3GEO.editorOL.ativarodadomouse==="true"){i3GEO.editorOL.ativarodadomouse=true}if(i3GEO.editorOL.legendahtml==="false"){i3GEO.editorOL.legendahtml=false}if(i3GEO.editorOL.legendahtml==="true"){i3GEO.editorOL.legendahtml=true}if(i3GEO.editorOL.incluilayergrafico==="false"){i3GEO.editorOL.incluilayergrafico=false}if(i3GEO.editorOL.incluilayergrafico==="true"){i3GEO.editorOL.incluilayergrafico=true}if(i3GEO.editorOL.incluilayergrafico===true){if(!i3GEO.desenho.layergrafico){i3GEO.editorOL.criaLayerGrafico()}}else{i3GEO.desenho.layergrafico="";i3GEO.editorOL.botoes.linha=false;i3GEO.editorOL.botoes.ponto=false;i3GEO.editorOL.botoes.poligono=false;i3GEO.editorOL.botoes.texto=false;i3GEO.editorOL.botoes.edita=false;i3GEO.editorOL.botoes.listag=false;i3GEO.editorOL.botoes.corta=false;i3GEO.editorOL.botoes.apaga=false;i3GEO.editorOL.botoes.selecao=false;i3GEO.editorOL.botoes.salva=false;i3GEO.editorOL.botoes.propriedades=false;i3GEO.editorOL.botoes.fecha=false;i3GEO.editorOL.botoes.tools=false;i3GEO.editorOL.botoes.undo=false;i3GEO.editorOL.botoes.frente=false}if(i3GEO.editorOL.mapa===""){alert("O objeto i3GEO.editorOL.mapa precisa ser criado com new OpenLayers.Map()");return}for(i=0;i<ncontroles;i++){i3GEO.editorOL.mapa.addControl(i3GEO.editorOL.controles[i])}if(i3GEO.editorOL.fundo!=""){for(i=nfundo-1;i>=0;i--){if(fundo[i]!=""){try{eval("i3GEO.editorOL."+fundo[i]+".transitionEffect = 'resize';");eval("i3GEO.editorOL."+fundo[i]+".setVisibility(false);");eval("i3GEO.editorOL."+fundo[i]+".singleTile = false;");eval("alayers.push(i3GEO.editorOL."+fundo[i]+");")}catch(e){if(alayers[0]){alayers[0].setVisibility(true)}}}}}i3GEO.editorOL.mapa.addLayers(alayers);if(i3GEO.editorOL.layersIniciais!==""){n=i3GEO.editorOL.layersIniciais.length;for(i=0;i<n;i++){i3GEO.editorOL.layersIniciais[i].singleTile=single;i3GEO.editorOL.mapa.addLayer(i3GEO.editorOL.layersIniciais[i])}}if(!i3GEO.desenho.layergrafico){i3GEO.editorOL.mapa.addLayers([i3GEO.desenho.layergrafico])}i3GEO.editorOL.adicionaKml();i3GEO.editorOL.adicionaMarcas();i3GEO.editorOL.coordenadas();i3GEO.editorOL.criaJanelaBusca();i3GEO.editorOL.criaBotoes(i3GEO.editorOL.botoes);if(i3GEO.editorOL.ativalayerswitcher===true){i3GEO.editorOL.ativaLayerSwitcher()}if(i3GEO.editorOL.ativarodadomouse===false){i3GEO.editorOL.desativaRodaDoMouse()}if(i3GEO.editorOL.numzoom!==""){i3GEO.editorOL.mapa.setOptions({numZoomLevels:i3GEO.editorOL.numzoom})}if(i3GEO.editorOL.maxext!==""){i3GEO.editorOL.mapa.setOptions({maxExtent:i3GEO.editorOL.maxext})}if(i3GEO.editorOL.mapext!=""){i3GEO.editorOL.mapa.zoomToExtent(i3GEO.editorOL.mapext)}else{i3GEO.editorOL.mapa.zoomToMaxExtent()}if(i3GEO.Interface&&i3GEO.Interface.openlayers&&i3GEO.Interface.openlayers.sobeLayersGraficos){i3GEO.Interface.openlayers.sobeLayersGraficos()}},criaLayerGrafico:function(){i3GEO.desenho.openlayers.criaLayerGrafico()},layersLigados:function(){var layers=i3GEO.editorOL.mapa.layers,nlayers=layers.length,ins=[],i;for(i=0;i<nlayers;i++){if(layers[i].visibility===true){ins.push(layers[i])}}return ins},layersClonados:function(paramsLayers){var layers=i3GEO.editorOL.mapa.layers,nlayers=layers.length,i;for(i=0;i<nlayers;i++){if(layers[i].params&&layers[i].params.CLONETMS===paramsLayers){return(layers[i])}}return false},layertms2wms:function(tms){var layer,url;url=tms.url.replace("&cache=sim","&DESLIGACACHE=sim");url=url.replace("&Z=${z}&X=${x}&Y=${y}","");url=url.replace("Z=${z}&X=${x}&Y=${y}","");layer=new OpenLayers.Layer.WMS(tms.layername+"_clone",url,{layers:tms.name,transparent:true},{gutter:0,isBaseLayer:false,displayInLayerSwitcher:false,opacity:1,visibility:true,singleTile:true});return layer},removeClone:function(){var nome=i3GEO.editorOL.layerAtivo().layername+"_clone",busca=i3GEO.editorOL.mapa.getLayersByName(nome);if(busca.length>0){i3GEO.editorOL.mapa.removeLayer(i3GEO.editorOL.mapa.getLayersByName(camada.name)[0],false)}},coordenadas:function(){var idcoord=i3GEO.editorOL.mapa.getControlsBy("separator"," ");if(idcoord[0]){i3GEO.editorOL.mapa.events.register("mousemove",i3GEO.editorOL.mapa,function(e){var p,lonlat,d;if(navm){p=new OpenLayers.Pixel(e.x,e.y)}else{p=e.xy}lonlat=i3GEO.editorOL.mapa.getLonLatFromPixel(p);d=i3GEO.calculo.dd2dms(lonlat.lon,lonlat.lat);try{$i(idcoord[0].id).innerHTML="Long: "+d[0]+"<br>Lat: "+d[1]}catch(e){}})}},criaJanelaBusca:function(){var layers=i3GEO.editorOL.layersLigados(),nlayers=layers.length,i,ins,combo="<select id=i3GEOOLlistaTemasBusca ><option value=''>----</option>";for(i=0;i<nlayers;i++){combo+="<option value='"+i+"' >"+layers[i].name+"</option>"}combo+="</select>";ins="<div class=paragrafo >Tema:<br>"+combo;ins+="<br>Item:<br><span id=i3GEOOLcomboitens ></span>";ins+="<br>Procurar por:<br><input type=text size=20 id=i3GEOOLpalavraBusca >";ins+="<br><br><input type=button value='Procurar' id='i3GEOOLbotaoBusca' ></div>";ins+="<br>Resultado:<br><span id=i3GEOOLcomboresultado ></span>";try{YAHOO.namespace("procura.container");YAHOO.procura.container.panel=new YAHOO.widget.Panel("panelprocura",{zIndex:2000,iframe:false,width:"250px",visible:false,draggable:true,close:true});YAHOO.procura.container.panel.setHeader("Encontre no mapa");YAHOO.procura.container.panel.setBody(ins);YAHOO.procura.container.panel.setFooter("");YAHOO.procura.container.panel.render(document.body);YAHOO.procura.container.panel.center();document.getElementById("i3GEOOLbotaoBusca").onclick=function(){var layer=i3GEO.editorOL.layerAtivo(),item=document.getElementById("i3GEOOLbuscaItem").value,palavra=document.getElementById("i3GEOOLpalavraBusca").value;if(item===""||palavra===""){alert("Escolha o item e o texto de busca");return}i3GEO.editorOL.busca(layer,item,palavra,"i3GEOOLcomboresultado")};document.getElementById("i3GEOOLlistaTemasBusca").onchange=function(){i3GEO.editorOL.ativaTema(this.value);document.getElementById("i3GEOOLcomboitens").innerHTML="...";i3GEO.editorOL.listaItens(i3GEO.editorOL.layerAtivo(),"i3GEOOLcomboitens","i3GEOOLbuscaItem")}}catch(e){}},criaComboTemas:function(){var layers=i3GEO.editorOL.layersLigados(),nlayers=layers.length,i,nometema="",temp,combo="<select id=i3GEOOLlistaTemasAtivos style=width:235px; >";for(i=0;i<nlayers;i++){nometema="";if(i3GEO.arvoreDeCamadas&&i3GEO.arvoreDeCamadas.CAMADAS){temp=i3GEO.arvoreDeCamadas.pegaTema(layers[i].name,"","name");if(temp!=""){nometema=temp.tema+" - "}}combo+="<option value='"+i+"' >"+nometema+layers[i].name+"</option>"}combo+="</select>";return combo},atualizaJanelaAtivaTema:function(){var combo=i3GEO.editorOL.criaComboTemas();YAHOO.temaativo.container.panel.setBody(combo);document.getElementById("i3GEOOLlistaTemasAtivos").onchange=function(){if(botaoIdentifica){botaoIdentifica.layers=[i3GEO.editorOL.layersLigados()[this.value]]}}},criaJanelaAtivaTema:function(){var temp;if(!document.getElementById("paneltemaativo")){YAHOO.namespace("temaativo.container");YAHOO.temaativo.container.panel=new YAHOO.widget.Panel("paneltemaativo",{zIndex:20000,iframe:true,width:"250px",visible:false,draggable:true,close:true});YAHOO.temaativo.container.panel.setBody("");if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){YAHOO.temaativo.container.panel.setHeader("Tema ativo<div id='paneltemaativo_minimizaCabecalho' class='container-minimiza'></div>")}else{YAHOO.temaativo.container.panel.setHeader("Tema ativo")}YAHOO.temaativo.container.panel.setFooter("");YAHOO.temaativo.container.panel.render(document.body);YAHOO.temaativo.container.panel.show();YAHOO.temaativo.container.panel.center();i3GEO.editorOL.atualizaJanelaAtivaTema();YAHOO.util.Event.addListener(YAHOO.temaativo.container.panel.close,"click",function(){i3GEOpanelEditor.deactivate();i3GEOpanelEditor.activate();if(i3GEO.eventos&&i3GEO.eventos.ATUALIZAARVORECAMADAS.toString().search("i3GEO.editorOL.atualizaJanelaAtivaTema()")>0){i3GEO.eventos.ATUALIZAARVORECAMADAS.remove("i3GEO.editorOL.atualizaJanelaAtivaTema()")}});if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){if(i3GEO.eventos&&i3GEO.eventos.ATUALIZAARVORECAMADAS.toString().search("i3GEO.editorOL.atualizaJanelaAtivaTema()")<0){i3GEO.eventos.ATUALIZAARVORECAMADAS.push("i3GEO.editorOL.atualizaJanelaAtivaTema()")}}temp=$i("paneltemaativo_minimizaCabecalho");if(temp){temp.onclick=function(){i3GEO.janela.minimiza("paneltemaativo")}}}else{YAHOO.temaativo.container.panel.show();i3GEO.editorOL.atualizaJanelaAtivaTema()}},ativaTema:function(id){document.getElementById("i3GEOOLlistaTemasAtivos").value=id},layerAtivo:function(){var id=document.getElementById("i3GEOOLlistaTemasAtivos");if(id){id=id.value}else{id=i3GEO.temaAtivo}if(id==""){return[]}else{return i3GEO.editorOL.layersLigados()[id]}},listaItens:function(layer,idonde,idobj){if(!layer){return}if(!layer.params){return}var u=layer.url+"&request=describefeaturetype&service=wfs&version=1.0.0";u+="&typename="+layer.params.LAYERS;document.body.style.cursor="wait";document.getElementById("i3geoMapa").style.cursor="wait";OpenLayers.Request.issue({method:"GET",url:u,callback:function(retorno){document.body.style.cursor="default";document.getElementById("i3geoMapa").style.cursor="default";var fromgml=new OpenLayers.Format.WFSDescribeFeatureType({geometryName:"msGeometry"}),gml=fromgml.read(retorno.responseText),prop=gml.featureTypes[0].properties,nprop=prop.length,i,combo="<select id="+idobj+" ><option value=''>----</option>";for(i=0;i<nprop;i++){combo+="<option value="+prop[i].name+" >"+prop[i].name+"</option>"}combo+="</select>";document.getElementById(idonde).innerHTML=combo},failure:function(){document.body.style.cursor="default";document.getElementById("i3geoMapa").style.cursor="default";alert("Erro")}})},busca:function(layer,item,palavra,onde){document.body.style.cursor="wait";document.getElementById("i3geoMapa").style.cursor="wait";var u=layer.url+"&request=getfeature&service=wfs&version=1.0.0";u=u.replace("Z=${z}&X=${x}&Y=${y}","");u+="&OUTPUTFORMAT=gml2&typename="+layer.params.LAYERS;u+="&filter=<Filter><PropertyIsLike wildcard=* singleChar=. escape=! ><PropertyName>"+item+"</PropertyName><Literal>*"+palavra+"*</Literal></PropertyIsLike></Filter>";document.body.style.cursor="wait";document.getElementById("i3geoMapa").style.cursor="wait";document.getElementById(onde).innerHTML="...";OpenLayers.Request.issue({method:"GET",url:u,callback:function(retorno){document.body.style.cursor="default";document.getElementById("i3geoMapa").style.cursor="default";var fromgml=new OpenLayers.Format.GML({geometryName:"msGeometry"}),gml=fromgml.read(retorno.responseText),ngml=gml.length,i,ins="<select onchange='i3GEO.editorOL.zoomPara(this.value)'>";ins+="<option value=''>---</option>";for(i=0;i<ngml;i++){eval("var valor = gml[i].data."+item);var bounds=gml[i].geometry.getBounds();bounds=bounds.toBBOX();ins+="<option value='"+bounds+"'>"+valor+"</option>"}ins+="</select>";document.getElementById(onde).innerHTML=ins},failure:function(){document.body.style.cursor="default";document.getElementById("i3geoMapa").style.cursor="default";alert("Erro")}})},zoomPara:function(bbox){var b=new OpenLayers.Bounds.fromString(bbox);i3GEO.editorOL.mapa.zoomToExtent(b)},mostraLegenda:function(){var layers=i3GEO.editorOL.layersLigados(),nlayers=layers.length,ins="",i;for(i=0;i<nlayers;i++){try{if(layers[i].isBaseLayer===false){var url=layers[i].getFullRequestString({"request":"getlegendgraphic"});if(i3GEO.editorOL.legendahtml===true){url=url.replace("image%2Fpng","text/html");ins+=layers[i].name+"<br><div id=legendaL_"+i+" ></div><br>";eval("var f = function(retorno){document.getElementById('legendaL_"+i+"').innerHTML = retorno.responseText;};");var config={method:"GET",url:url,callback:f};OpenLayers.Request.issue(config)}else{url=url.replace("LAYERS","LAYER");url=url.replace("&Z=${z}&X=${x}&Y=${y}","");url=url.replace("Z=${z}&X=${x}&Y=${y}","");ins+=layers[i].name+"<br><img src='"+url+"&SERVICE=wms' /><br>"}}}catch(e){}}if(!document.getElementById("panellegendaeditorOL")){YAHOO.namespace("legendaeditorOL.container");YAHOO.legendaeditorOL.container.panel=new YAHOO.widget.Panel("panellegendaeditorOL",{zIndex:20000,iframe:true,width:"auto",visible:false,draggable:true,close:true});YAHOO.legendaeditorOL.container.panel.setBody(ins);YAHOO.legendaeditorOL.container.panel.setHeader("Legenda");YAHOO.legendaeditorOL.container.panel.setFooter("");YAHOO.legendaeditorOL.container.panel.render(document.body);YAHOO.legendaeditorOL.container.panel.show();YAHOO.legendaeditorOL.container.panel.center();YAHOO.util.Event.addListener(YAHOO.legendaeditorOL.container.panel.close,"click",function(){})}else{YAHOO.legendaeditorOL.container.panel.setBody(ins);YAHOO.legendaeditorOL.container.panel.show()}},captura:function(lonlat){var d=0.1,layers=[i3GEO.editorOL.layerAtivo()],xy=lonlat.split(","),u=layers[0].url+"&REQUEST=getfeature&service=wfs&version=1.0.0";u+="&OUTPUTFORMAT=gml2&typename="+layers[0].params.LAYERS;u=u.replace("&cache=sim","&DESLIGACACHE=sim");u=u.replace("&Z=${z}&X=${x}&Y=${y}","");u=u.replace("Z=${z}&X=${x}&Y=${y}","");xy[0]=xy[0]*1;xy[1]=xy[1]*1;var poligono=(xy[0]-d)+","+(xy[1]+d)+" "+(xy[0]+d)+","+(xy[1]+d)+" "+(xy[0]+d)+","+(xy[1]-d)+" "+(xy[0]-d)+","+(xy[1]-d)+" "+(xy[0]-d)+","+(xy[1]+d);u+="&filter=<Filter><Intersects><PropertyName>Geometry</PropertyName><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:posList>"+poligono+"</gml:posList></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></Intersects></Filter>";document.body.style.cursor="wait";if(document.getElementById("i3geoMapa")){document.getElementById("i3geoMapa").style.cursor="wait"}OpenLayers.Request.issue({method:"GET",url:u,callback:function(retorno){document.body.style.cursor="default";if(document.getElementById("i3geoMapa")){document.getElementById("i3geoMapa").style.cursor="default"}var i,n,f,fromgml=new OpenLayers.Format.GML({geometryName:"msGeometry"}),gml=fromgml.read(retorno.responseText);n=gml.length;for(i=0;i<n;i++){f=gml[i];f["attributes"]={opacidade:i3GEO.editorOL.simbologia.opacidade,texto:i3GEO.editorOL.simbologia.texto,fillColor:i3GEO.editorOL.simbologia.fillColor,strokeWidth:i3GEO.editorOL.simbologia.strokeWidth,strokeColor:i3GEO.editorOL.simbologia.strokeColor,pointRadius:i3GEO.editorOL.simbologia.pointRadius,graphicName:i3GEO.editorOL.simbologia.graphicName,registros:f["attributes"]}}i3GEO.desenho.layergrafico.addFeatures(gml)},failure:function(){document.body.style.cursor="default";if(document.getElementById("i3geoMapa")){document.getElementById("i3geoMapa").style.cursor="default"}alert("Erro")}})},salvaGeometrias:function(){var geos=i3GEO.desenho.layergrafico.selectedFeatures,n=geos.length,ins="";if(n>0){if($i("panelsalvageometrias")){if(YAHOO.i3GEO){YAHOO.salvaGeometrias.container.panel=YAHOO.i3GEO.janela.manager.find("panelsalvageometrias")}YAHOO.salvaGeometrias.container.panel.show();YAHOO.salvaGeometrias.container.panel.bringToTop()}else{try{YAHOO.namespace("salvaGeometrias.container");YAHOO.salvaGeometrias.container.panel=new YAHOO.widget.Panel("panelsalvageometrias",{zIndex:2000,iframe:false,width:"250px",visible:false,draggable:true,close:true});YAHOO.salvaGeometrias.container.panel.setHeader("Geometrias");YAHOO.salvaGeometrias.container.panel.setBody("");YAHOO.salvaGeometrias.container.panel.setFooter("");YAHOO.salvaGeometrias.container.panel.render(document.body);YAHOO.salvaGeometrias.container.panel.center();if(YAHOO.i3GEO&&YAHOO.i3GEO.janela){YAHOO.i3GEO.janela.manager.register(YAHOO.salvaGeometrias.container.panel)}YAHOO.salvaGeometrias.container.panel.show()}catch(e){}}ins+="<p class=paragrafo >Foram encontrada(s) "+n+" geometria(s) selecionada(s) </p>";ins+="<p class=paragrafo ><a href='#' onclick='i3GEO.editorOL.listaGeometriasSel()' >Listar</a> ";if(i3GEO.arvoreDeCamadas){ins+="<a href='#' onclick='"+i3GEO.editorOL.nomeFuncaoSalvar+"' >Salvar</a> "}ins+="<a href='#' onclick='i3GEO.editorOL.exportarSHP()' >Exportar (shapefile)</a></p>";YAHOO.salvaGeometrias.container.panel.setBody(ins)}else{alert("Selecione pelo menos um elemento")}},exportarSHP:function(){i3GEO.editorOL.processageo("converteSHP")},listaGeometriasSel:function(){var geos=i3GEO.desenho.layergrafico.selectedFeatures,n=geos.length,ins="",i,a,w,g;for(i=0;i<n;i++){g=geos[i];ins+="<b>Geometria: "+i+"</b><br>"+i3GEO.editorOL.google2wgs(g.geometry)+"<br><br>";ins+="<b>Atributos: "+i+"</b><br>";a=g.attributes;for(key in a){if(a[key]){ins+=key+" = "+a[key]+"<br>"}}if(g.attributes.registros){ins+="<b>Registros: "+i+"</b><br>";a=g.attributes.registros;for(key in a){if(a[key]){ins+=key+" = "+a[key]+"<br>"}}}}w=window.open();w.document.write(ins);w.document.close()},testeSalvar:function(){alert("Funcao nao disponivel. Defina o nome da funcao em i3GEO.editorOL.nomeFuncaoSalvar ")},salvaGeo:function(){var geos=i3GEO.desenho.layergrafico.selectedFeatures,n=geos.length,funcaoOK=function(){if(geos[0].geometry){var registros="",valorunico="",nometema=$i("editorOLcomboTemaEditavel").value,key="",tema,redesenha,p,g=i3GEO.editorOL.google2wgs(geos[0].geometry);if(nometema==""){return}tema=i3GEO.arvoreDeCamadas.pegaTema(nometema,"","name");if(geos[0].attributes.registros){registros=geos[0].attributes.registros;for(key in registros){if(registros[key]&&key==tema.colunaidunico){valorunico=registros[key]}}}redesenha=function(retorno){i3GEO.janela.fechaAguarde("aguardeSalvaPonto");i3GEO.desenho.layergrafico.removeFeatures(i3GEO.desenho.layergrafico.selectedFeatures);i3GEO.Interface.atualizaTema("",nometema)};i3GEO.janela.AGUARDEMODAL=true;i3GEO.janela.abreAguarde("aguardeSalvaPonto","Adicionando...");i3GEO.janela.AGUARDEMODAL=false;if(valorunico==""){p=i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=adicionaGeometria&g_sid="+i3GEO.configura.sid;cpJSON.call(p,"foo",redesenha,"&tema="+nometema+"&wkt="+g)}else{p=i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=atualizaGeometria&g_sid="+i3GEO.configura.sid;cpJSON.call(p,"foo",redesenha,"&idunico="+valorunico+"&tema="+nometema+"&wkt="+g)}}},funcaoCombo=function(obj){$i("editorOLondeComboTemaEditavel").innerHTML=obj.dados},texto="Salvar no tema:<br><div id=editorOLondeComboTemaEditavel ></div><br><br>";if(n!=1){i3GEO.janela.tempoMsg("Selecione apenas uma figura")}else{i3GEO.janela.confirma(texto,300,"Salva","Cancela",funcaoOK);i3GEO.util.comboTemas("editorOLcomboTemaEditavel",funcaoCombo,"editorOLondeComboTemaEditavel","",false,"editavel")}},criaBotoes:function(botoes){var sketchSymbolizers={"Point":{pointRadius:4,graphicName:"square",fillColor:"white",fillOpacity:1,strokeWidth:1,strokeOpacity:1,strokeColor:"#333333"},"Line":{strokeWidth:3,strokeOpacity:1,strokeColor:"#666666",strokeDashstyle:"dash"},"Polygon":{strokeWidth:2,strokeOpacity:1,strokeColor:"#666666",fillColor:"white",fillOpacity:0.3}},style=new OpenLayers.Style(),styleMap=new OpenLayers.StyleMap({"default":style,"vertex":{strokeOpacity:1,strokeWidth:1,fillColor:"white",fillOpacity:0.45,pointRadius:3}},{extendDefault:false}),adiciona=false,button,controles=[];style.addRules([new OpenLayers.Rule({symbolizer:sketchSymbolizers})]);i3GEOpanelEditor=new OpenLayers.Control.Panel({displayClass:"olControlEditingToolbar1 noprint",saveState:false,activateControl:function(c){this.deactivate();this.activate();try{i3GEO.editorOL.ModifyFeature.deactivate();if(i3GEO&&i3GEO.barraDeBotoes){i3GEO.barraDeBotoes.ativaPadrao()}}catch(e){}if(!c.trigger){c.activate()}else{c.trigger.call()}}});if(botoes.procura===true){button=new OpenLayers.Control.Button({displayClass:"editorOLprocura",trigger:function(){YAHOO.procura.container.panel.show()},title:"procura",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.pan===true){controles.push(new OpenLayers.Control.Navigation({title:"deslocar",displayClass:"editorOLpan",type:OpenLayers.Control.TYPE_TOOL}));adiciona=true}if(botoes.zoombox===true){controles.push(new OpenLayers.Control.ZoomBox({title:"zoombox",displayClass:"editorOLzoombox",type:OpenLayers.Control.TYPE_TOOL}));adiciona=true}if(botoes.zoomtot===true){button=new OpenLayers.Control.Button({displayClass:"editorOLzoomtot",trigger:function(){if(i3GEO.editorOL.mapext&&i3GEO.editorOL.mapext!=""){i3GEO.editorOL.mapa.zoomToExtent(i3GEO.editorOL.mapext)}else{i3GEO.editorOL.mapa.zoomToMaxExtent()}},title:"ajusta extensao",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.zoomin===true){button=new OpenLayers.Control.Button({displayClass:"editorOLzoomin",trigger:function(){i3GEO.editorOL.mapa.zoomIn()},title:"aproxima",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.zoomout===true){button=new OpenLayers.Control.Button({displayClass:"editorOLzoomout",trigger:function(){i3GEO.editorOL.mapa.zoomOut()},title:"afasta",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.legenda===true){button=new OpenLayers.Control.Button({displayClass:"editorOLlegenda",trigger:function(){i3GEO.editorOL.mostraLegenda()},title:"legenda",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.distancia===true){button=new OpenLayers.Control.Measure(OpenLayers.Handler.Path,{handlerOptions:{layerOptions:{styleMap:styleMap}},persist:true,displayClass:"editorOLdistancia",title:"distancia",type:OpenLayers.Control.TYPE_TOOL});button.events.on({"measure":function(event){var units=event.units,measure=event.measure;alert("Distancia: "+measure.toFixed(3)+" "+units)}});controles.push(button);adiciona=true}if(botoes.area===true){button=new OpenLayers.Control.Measure(OpenLayers.Handler.Polygon,{handlerOptions:{layerOptions:{styleMap:styleMap}},persist:true,displayClass:"editorOLarea",title:"area",type:OpenLayers.Control.TYPE_TOOL});button.events.on({"measure":function(event){var units=event.units;var measure=event.measure;alert("Área: "+measure.toFixed(3)+" "+units+" quadrados")}});controles.push(button);adiciona=true}if(botoes.identifica===true){botaoIdentifica=new OpenLayers.Control.WMSGetFeatureInfo({maxFeatures:1,infoFormat:'text/plain',layers:[i3GEO.editorOL.layerAtivo()],queryVisible:true,title:"identifica",type:OpenLayers.Control.TYPE_TOOL,displayClass:"editorOLidentifica",eventListeners:{getfeatureinfo:function(event){var lonlat=i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy),lonlattexto="<hr>",formata;if(botoes.linha===true||botoes.ponto===true||botoes.poligono===true||botoes.edita===true){lonlattexto+="<pre><span style=font-size:12px;color:blue;cursor:pointer onclick='i3GEO.editorOL.captura(\""+lonlat.lon+","+lonlat.lat+"\")'>edita geometria</span></pre><br>"}formata=function(texto){var temp,temp1,n,i,f=[],textoN=texto.split(":");try{if(textoN.length>1){temp=textoN[2].replace(/\n\r/g,"");temp=temp.replace(/'/g,"");temp=temp.replace(/\n/g,"|");temp=temp.replace(/_/g," ");temp=temp.replace(/=/g,":");temp=temp.split("|");n=temp.length;for(i=0;i<n;i++){temp1=temp[i].replace(/^\s+/,"");temp1=temp1.replace(/\s+$/,"");if(temp1!="")f.push(temp1)}texto=f.join("<br><br>")}}catch(e){}return texto};i3GEO.editorOL.mapa.addPopup(new OpenLayers.Popup.FramedCloud("chicken",i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy),null,"<div style=text-align:left >"+lonlattexto+"<pre>"+formata(event.text)+"</pre></div>",null,true));i3GEO.editorOL.removeClone()},beforegetfeatureinfo:function(event){var ativo=[i3GEO.editorOL.layerAtivo()];if(ativo[0].serviceVersion==="&tms="||ativo[0].CLASS_NAME=="OpenLayers.Layer.TMS"||ativo[0].CLASS_NAME=="OpenLayers.Layer.OSM"){ativo=[i3GEO.editorOL.layertms2wms(ativo[0])]}ativo[0].projection=new OpenLayers.Projection("EPSG:4326");event.object.layers=ativo;botaoIdentifica.layers=ativo;botaoIdentifica.url=ativo[0].url},activate:function(){i3GEO.editorOL.criaJanelaAtivaTema()}}});controles.push(botaoIdentifica);adiciona=true}if(botoes.linha===true){button=new OpenLayers.Control.DrawFeature(i3GEO.desenho.layergrafico,OpenLayers.Handler.Path,{displayClass:"editorOLlinha",title:"digitalizar linha",type:OpenLayers.Control.TYPE_TOOL,callbacks:{done:function(feature){var f=new OpenLayers.Feature.Vector(feature);f["attributes"]={opacidade:i3GEO.editorOL.simbologia.opacidade,texto:i3GEO.editorOL.simbologia.texto,fillColor:i3GEO.editorOL.simbologia.fillColor,strokeWidth:i3GEO.editorOL.simbologia.strokeWidth,strokeColor:i3GEO.editorOL.simbologia.strokeColor,pointRadius:i3GEO.editorOL.simbologia.pointRadius,graphicName:i3GEO.editorOL.simbologia.graphicName};i3GEO.desenho.layergrafico.addFeatures([f]);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}if(i3GEO.Interface&&i3GEO.Interface.openlayers&&i3GEO.Interface.openlayers.sobeLayersGraficos){i3GEO.Interface.openlayers.sobeLayersGraficos()}}}});controles.push(button);adiciona=true}if(botoes.ponto===true){button=new OpenLayers.Control.DrawFeature(i3GEO.desenho.layergrafico,OpenLayers.Handler.Point,{displayClass:"editorOLponto",title:"digitalizar ponto",type:OpenLayers.Control.TYPE_TOOL,callbacks:{done:function(feature){var f,style_mark;if(i3GEO.editorOL.simbologia.externalGraphic!=""){style_mark=OpenLayers.Util.extend({},OpenLayers.Feature.Vector.style['default']);style_mark.externalGraphic=i3GEO.editorOL.simbologia.externalGraphic;style_mark.graphicWidth=i3GEO.editorOL.simbologia.graphicWidth;style_mark.graphicHeight=i3GEO.editorOL.simbologia.graphicHeight;style_mark.fillOpacity=i3GEO.editorOL.simbologia.opacidade;f=new OpenLayers.Feature.Vector(feature,null,style_mark)}else{f=new OpenLayers.Feature.Vector(feature)}f["attributes"]={opacidade:i3GEO.editorOL.simbologia.opacidade,texto:i3GEO.editorOL.simbologia.texto,fillColor:i3GEO.editorOL.simbologia.fillColor,strokeWidth:i3GEO.editorOL.simbologia.strokeWidth,strokeColor:i3GEO.editorOL.simbologia.strokeColor,pointRadius:i3GEO.editorOL.simbologia.pointRadius,graphicName:i3GEO.editorOL.simbologia.graphicName,externalGraphic:i3GEO.editorOL.simbologia.externalGraphic,graphicHeight:i3GEO.editorOL.simbologia.graphicHeight,graphicWidth:i3GEO.editorOL.simbologia.graphicWidth};i3GEO.desenho.layergrafico.addFeatures([f]);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}if(i3GEO.Interface&&i3GEO.Interface.openlayers&&i3GEO.Interface.openlayers.sobeLayersGraficos){i3GEO.Interface.openlayers.sobeLayersGraficos()}}}});controles.push(button);adiciona=true}if(botoes.poligono===true){button=new OpenLayers.Control.DrawFeature(i3GEO.desenho.layergrafico,OpenLayers.Handler.Polygon,{displayClass:"editorOLpoligono",title:"digitalizar poligono",type:OpenLayers.Control.TYPE_TOOL,callbacks:{done:function(feature){var f=new OpenLayers.Feature.Vector(feature);f["attributes"]={opacidade:i3GEO.editorOL.simbologia.opacidade,texto:i3GEO.editorOL.simbologia.texto,fillColor:i3GEO.editorOL.simbologia.fillColor,strokeWidth:i3GEO.editorOL.simbologia.strokeWidth,strokeColor:i3GEO.editorOL.simbologia.strokeColor,pointRadius:i3GEO.editorOL.simbologia.pointRadius,graphicName:i3GEO.editorOL.simbologia.graphicName};i3GEO.desenho.layergrafico.addFeatures([f]);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}if(i3GEO.Interface&&i3GEO.Interface.openlayers&&i3GEO.Interface.openlayers.sobeLayersGraficos){i3GEO.Interface.openlayers.sobeLayersGraficos()}}}});controles.push(button);adiciona=true}if(botoes.texto===true){button=new OpenLayers.Control.DrawFeature(i3GEO.desenho.layergrafico,OpenLayers.Handler.Point,{displayClass:"editorOLtexto",title:"incluir texto",type:OpenLayers.Control.TYPE_TOOL,persist:true,callbacks:{done:function(feature){var texto=window.prompt("Texto",""),label=new OpenLayers.Feature.Vector(feature);label["attributes"]={opacidade:0.1,fillColor:"white",strokeWidth:i3GEO.editorOL.simbologia.strokeWidth,texto:texto,pointRadius:2,graphicName:"square",strokeColor:"black",fontColor:i3GEO.editorOL.simbologia.fontColor,fontSize:i3GEO.editorOL.simbologia.fontSize,fontFamily:"Arial",fontWeight:"bold",labelAlign:"rt"};if(texto&&texto!==""){i3GEO.desenho.layergrafico.addFeatures([label])}if(i3GEO.Interface&&i3GEO.Interface.openlayers&&i3GEO.Interface.openlayers.sobeLayersGraficos){i3GEO.Interface.openlayers.sobeLayersGraficos()}}}});controles.push(button);adiciona=true}if(botoes.edita===true&&botoes.corta===true&&i3GEO.php){i3GEO.editorOL.CortaFeature=new OpenLayers.Control.DrawFeature(i3GEO.desenho.layergrafico,OpenLayers.Handler.Polygon,{displayClass:"editorOLcorta",title:"corta figura",type:OpenLayers.Control.TYPE_TOOL,clickout:true,toggle:true,trigger:function(){if(i3GEO.desenho.layergrafico.selectedFeatures.length!=1){alert("Selecione primeiro um elemento para ser cortado");i3GEO.editorOL.CortaFeature.deactivate()}else{i3GEO.editorOL.CortaFeature.activate()}},callbacks:{done:function(feature){var temp,sel=i3GEO.desenho.layergrafico.selectedFeatures[0].geometry,corta=feature;temp=function(retorno){i3GEO.janela.fechaAguarde("i3GEO.cortador");if(retorno!=""&&retorno.data&&retorno.data!=""){i3GEO.editorOL.substituiFeaturesSel(retorno.data)}};i3GEO.janela.abreAguarde("i3GEO.cortador","Cortando");i3GEO.php.funcoesGeometriasWkt(temp,sel+"|"+corta,"difference")}}});controles.push(i3GEO.editorOL.CortaFeature);adiciona=true}if(botoes.edita===true){i3GEO.editorOL.ModifyFeature=new OpenLayers.Control.ModifyFeature(i3GEO.desenho.layergrafico,{displayClass:"editorOLedita",title:"modifica figura",type:OpenLayers.Control.TYPE_TOOL,clickout:true,toggle:true,mode:OpenLayers.Control.ModifyFeature.RESHAPE,standalone:false,createVertices:true,styleMap:"default",vertexRenderIntent:"vertex"});controles.push(i3GEO.editorOL.ModifyFeature);adiciona=true}if(botoes.edita===true&&botoes.listag===true){button=new OpenLayers.Control.Button({displayClass:"editorOLlistag",trigger:function(){i3GEO.editorOL.listaGeometrias()},title:"lista geometrias",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.frente===true){button=new OpenLayers.Control.Button({displayClass:"editorOLfrente",trigger:function(){i3GEO.editorOL.trazParaFrente();if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}},title:"traz para frente",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.tools===true&&i3GEO.php){button=new OpenLayers.Control.Button({displayClass:"editorOLtools",trigger:function(){if(i3GEO.php){i3GEO.editorOL.ferramentas()}else{i3GEO.editorOL.carregajts("i3GEO.editorOL.ferramentas()")}},title:"ferramentas",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.selecao===true){i3GEO.editorOL.selbutton=new OpenLayers.Control.SelectFeature(i3GEO.desenho.layergrafico,{displayClass:"editorOLselecao",title:"seleciona elemento",type:OpenLayers.Control.TYPE_TOOL,clickout:true,toggle:true,multiple:false,hover:false,toggleKey:"ctrlKey",multipleKey:"shiftKey",box:false});controles.push(i3GEO.editorOL.selbutton);adiciona=true}if(botoes.apaga===true){button=new OpenLayers.Control.Button({displayClass:"editorOLapaga",trigger:function(){if(i3GEO.desenho.layergrafico.selectedFeatures.length>0){var x=window.confirm("Exclui os elementos selecionados?");if(x){i3GEO.editorOL.guardaBackup();i3GEO.desenho.layergrafico.removeFeatures(i3GEO.desenho.layergrafico.selectedFeatures);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}}}else{alert("Selecione pelo menos um elemento")}},title:"apaga selecionados",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.propriedades===true){button=new OpenLayers.Control.Button({displayClass:"editorOLpropriedades",trigger:function(){i3GEO.editorOL.propriedades()},title:"propriedades",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.salva===true){button=new OpenLayers.Control.Button({displayClass:"editorOLsalva",trigger:function(){i3GEO.editorOL.salvaGeometrias()},title:"salva",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.ajuda===true){button=new OpenLayers.Control.Button({displayClass:"editorOLajuda",trigger:function(){try{window.open(i3GEO.configura.locaplic+"/mashups/openlayers_ajuda.php")}catch(e){window.open("openlayers_ajuda.php")}},title:"ajuda",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}if(botoes.fecha===true){button=new OpenLayers.Control.Button({displayClass:"editorOLfecha",trigger:function(){var temp=window.confirm("Remove a edicao?");if(i3GEO.eventos){i3GEO.eventos.cliquePerm.ativa()}i3GEOpanelEditor.destroy();try{YAHOO.temaativo.container.panel.destroy()}catch(e){}try{YAHOO.procura.container.panel.destroy()}catch(e){}try{YAHOO.editorOL.container.panel.destroy()}catch(e){}try{YAHOO.editorOL.listaGeometrias.panel.destroy()}catch(e){}try{YAHOO.editorOL.ferramentas.panel.destroy()}catch(e){}try{YAHOO.legendaeditorOL.container.panel.destroy()}catch(e){}try{YAHOO.salvaGeometrias.container.panel.destroy()}catch(e){}if(temp===true){try{if(i3GEO.desenho.layergrafico){i3GEO.editorOL.mapa.removeLayer(i3GEO.desenho.layergrafico);delete(i3GEO.desenho.layergrafico)}if(i3GEO.editorOL.backup){i3GEO.editorOL.mapa.removeLayer(i3GEO.editorOL.backup);delete(i3GEO.editorOL.backup)}}catch(e){}}},title:"fecha editor",type:OpenLayers.Control.TYPE_BUTTON});controles.push(button);adiciona=true}i3GEOOLsnap=new OpenLayers.Control.Snapping({layer:i3GEO.desenho.layergrafico});i3GEOOLsplit=new OpenLayers.Control.Split({layer:i3GEO.desenho.layergrafico,source:i3GEO.desenho.layergrafico,tolerance:0.0001,eventListeners:{beforesplit:function(event){i3GEO.editorOL.guardaBackup()},aftersplit:function(event){i3GEO.editorOL.flashFeatures(event.features);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}}}});if(adiciona===true){i3GEOpanelEditor.addControls(controles);i3GEO.editorOL.mapa.addControl(i3GEOpanelEditor)}},mudaSimbolo:function(estilo,id){var valor=$i(id).value,geos=i3GEO.desenho.layergrafico.selectedFeatures,n=geos.length,i;i3GEO.editorOL.simbologia[estilo]=valor;for(i=0;i<n;i++){geos[i].attributes[estilo]=valor;geos[i].style[estilo]=valor}},adicionaMarcas:function(){if(i3GEO.editorOL.pontos.length===0){return}var SHADOW_Z_INDEX=10,MARKER_Z_INDEX=11,layer=new OpenLayers.Layer.Vector("pontos",{styleMap:new OpenLayers.StyleMap({externalGraphic:i3GEO.editorOL.marca,backgroundGraphic:"../pacotes/openlayers/img/marker_shadow.png",backgroundXOffset:0,backgroundYOffset:-7,graphicZIndex:MARKER_Z_INDEX,backgroundGraphicZIndex:SHADOW_Z_INDEX,pointRadius:10}),isBaseLayer:false,rendererOptions:{yOrdering:true},displayInLayerSwitcher:true,visibility:true}),index,x=[],y=[],features=[];for(index=0;index<i3GEO.editorOL.pontos.length;index=index+2){x.push(i3GEO.editorOL.pontos[index]);y.push(i3GEO.editorOL.pontos[index+1])}for(index=0;index<x.length;index++){features.push(new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(x[index],y[index])))}layer.addFeatures(features);i3GEO.editorOL.mapa.addLayer(layer)},adicionaKml:function(){var temp,n,i,id,url;n=i3GEO.editorOL.kml.length;for(i=0;i<n;i++){id="kml"+i;url=i3GEO.editorOL.kml[i];eval(id+" = new OpenLayers.Layer.Vector('"+id+"', {displayOutsideMaxExtent:true,displayInLayerSwitcher:false,visibility:true, strategies: [new OpenLayers.Strategy.Fixed()],protocol: new OpenLayers.Protocol.HTTP({url: '"+url+"',format: new OpenLayers.Format.KML({extractStyles: true,extractAttributes: true,maxDepth: 5})})})");eval("i3GEO.editorOL.mapa.addLayer("+id+");");eval("temp = "+id+".div;");temp.onclick=function(e){var targ="",id,temp,features,n,i,g,html="";if(!e){e=window.event}if(e.target){targ=e.target}else{if(e.srcElement){targ=e.srcElement}}if(targ.id){temp=targ.id.split("_");if(temp[0]==="OpenLayers.Geometry.Point"){id=targ.id;temp=i3GEO.editorOL.mapa.getLayer(this.id);features=temp.features;n=features.length;for(i=0;i<n;i++){if(features[i].geometry.id===id){for(var j in features[i].attributes){html+=j+": "+features[i].attributes[j]}g=features[i].geometry;i3GEO.editorOL.mapa.addPopup(new OpenLayers.Popup.FramedCloud("kml",new OpenLayers.LonLat(g.x,g.y),null,html,null,true))}}}}}}},propriedades:function(){if(!document.getElementById("panelpropriedadesEditor")){YAHOO.namespace("editorOL.container");YAHOO.editorOL.container.panel=new YAHOO.widget.Panel("panelpropriedadesEditor",{zIndex:20000,iframe:true,width:"350px",height:"250px",visible:false,draggable:true,close:true});var ins=""+'<p class=paragrafo ><b>Estilos (utilize a cor no formato r,g,b):</b></p>'+'<table class=lista7 >'+' <tr>'+' <td>Cor do contorno</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'strokeColor\',\'i3GEOEditorOLcorContorno\')" type="text" style="cursor:text" id="i3GEOEditorOLcorContorno" size="12" value="'+i3GEO.editorOL.simbologia.strokeColor+'" /></td><td>';if(i3GEO.configura){ins+='<img alt="aquarela.gif" style=cursor:pointer src="'+i3GEO.configura.locaplic+'/imagens/aquarela.gif" onclick="i3GEO.util.abreCor(\'\',\'i3GEOEditorOLcorContorno\');" />'}ins+=""+' </td>'+' </tr>'+' <tr>'+' <td>Cor do preenchimento</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'fillColor\',\'i3GEOEditorOLcorPre\')" type="text" style="cursor:text" id="i3GEOEditorOLcorPre" size="12" value="'+i3GEO.editorOL.simbologia.fillColor+'" /></td><td>';if(i3GEO.configura){ins+='<img alt="aquarela.gif" style=cursor:pointer src="'+i3GEO.configura.locaplic+'/imagens/aquarela.gif" onclick="i3GEO.util.abreCor(\'\',\'i3GEOEditorOLcorPre\');" />'}ins+=""+' </td>'+' </tr>'+' <tr>'+' <td>Cor da fonte</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'fontColor\',\'i3GEOEditorOLcorFonte\')" type="text" style="cursor:text" id="i3GEOEditorOLcorFonte" size="12" value="'+i3GEO.editorOL.simbologia.fontColor+'" /></td><td>';if(i3GEO.configura){ins+='<img alt="aquarela.gif" style=cursor:pointer src="'+i3GEO.configura.locaplic+'/imagens/aquarela.gif" onclick="i3GEO.util.abreCor(\'\',\'i3GEOEditorOLcorFonte\');" />'}ins+=""+' </td>'+' </tr>'+' <tr>'+' <td>Tamanho da fonte</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'fontSize\',\'i3GEOEditorOLfontsize\')" type="text" style="cursor:text" id="i3GEOEditorOLfontsize" size="3" value="'+i3GEO.editorOL.simbologia.fontSize+'" /></td><td></td>'+' </tr>'+' <tr>'+' <td>Opacidade (de 0 a 1)</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'opacidade\',\'i3GEOEditorOLopacidade\')" type="text" style="cursor:text" id="i3GEOEditorOLopacidade" size="3" value="'+i3GEO.editorOL.simbologia.opacidade+'" /></td><td></td>'+' </tr>'+' <tr>'+' <td>Largura da linha/contorno</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'strokeWidth\',\'i3GEOEditorOLlarguraLinha\')" type="text" style="cursor:text" id="i3GEOEditorOLlarguraLinha" size="2" value="'+i3GEO.editorOL.simbologia.strokeWidth+'" /></td><td></td>'+' </tr>'+' <tr>'+' <td>Url de uma figura</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'externalGraphic\',\'i3GEOEditorOLexternalGraphic\')" type="text" style="cursor:text" id="i3GEOEditorOLexternalGraphic" size="22" value="'+i3GEO.editorOL.simbologia.externalGraphic+'" /></td><td></td>'+' </tr>'+' <tr>'+' <td>Largura e altura</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'graphicWidth\',\'i3GEOEditorOLgraphicWidth\')" type="text" style="cursor:text" id="i3GEOEditorOLgraphicWidth" size="4" value="'+i3GEO.editorOL.simbologia.graphicWidth+'" /> <input onchange="i3GEO.editorOL.mudaSimbolo(\'graphicHeight\',\'i3GEOEditorOLgraphicHeight\')" type="text" style="cursor:text" id="i3GEOEditorOLgraphicHeight" size="4" value="'+i3GEO.editorOL.simbologia.graphicHeight+'" /></td><td></td>'+' </tr>'+'</table>'+'<br />'+'<p class=paragrafo ><b>Ajusta nó em edição para o(a):</b></p>'+'<table class=lista7 >'+' <tr>'+' <td></td><td>nó</td><td></td><td>vértice</td><td></td><td>borda</td>'+' </tr>'+' <tr>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.snap()" type="checkbox" id="target_node" /></td><td><input onchange="i3GEO.editorOL.snap()" id="target_nodeTolerance" type="text" size="3" value=15 /></td>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.snap()" type="checkbox" id="target_vertex" /></td><td><input onchange="i3GEO.editorOL.snap()" id="target_vertexTolerance" type="text" size="3" value=15 /></td>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.snap()" type="checkbox" id="target_edge" /></td><td><input onchange="i3GEO.editorOL.snap()" id="target_edgeTolerance" type="text" size="3" value=15 /></td>'+' </tr>'+'</table>'+'<br />'+'<p class=paragrafo ><b>Divide intersecção ao digitalizar</b></p>'+'<table class=lista7 >'+' <tr>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.split()" type="checkbox" id="edge_split_toggle" /></td><td>borda</td>'+' </tr>'+'</table>'+'<br />'+'<p class=paragrafo ><b>Operação ativada pelo botão de modificação da figura</b></p>'+'<table class=lista7 >'+' <tr>'+' <td><input checked style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.RESHAPE;" type="radio" name=i3geoOLtipoEdita /></td><td>altera figura</td>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.RESIZE;" type="radio" name=i3geoOLtipoEdita /></td><td>altera tamanho</td>'+' </tr>'+' <tr>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.ROTATE;" type="radio" name=i3geoOLtipoEdita /></td><td>rotaciona</td>'+' <td><input style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.DRAG;" type="radio" name=i3geoOLtipoEdita /></td><td>desloca</td>'+' </tr>'+'</table>';YAHOO.editorOL.container.panel.setBody(ins);if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){YAHOO.editorOL.container.panel.setHeader("Propriedades<div id='panelpropriedadesEditor_minimizaCabecalho' class='container-minimiza'></div>")}else{YAHOO.editorOL.container.panel.setHeader("Propriedades")}YAHOO.editorOL.container.panel.setFooter("");YAHOO.editorOL.container.panel.render(document.body);YAHOO.editorOL.container.panel.center();YAHOO.util.Event.addListener(YAHOO.editorOL.container.panel.close,"click",function(){});temp=$i("panelpropriedadesEditor_minimizaCabecalho");if(temp){temp.onclick=function(){i3GEO.janela.minimiza("panelpropriedadesEditor")}}}YAHOO.editorOL.container.panel.show();temp=$i("panelpropriedadesEditor").getElementsByTagName("div");if(temp&&temp[2]){temp[2].style.overflow="auto"}},listaGeometrias:function(){if(!document.getElementById("panellistagEditor")){YAHOO.namespace("editorOL.listaGeometrias");YAHOO.editorOL.listaGeometrias.panel=new YAHOO.widget.Panel("panellistagEditor",{zIndex:20000,iframe:true,width:"320px",visible:false,draggable:true,close:true});if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){YAHOO.editorOL.listaGeometrias.panel.setHeader("Geometrias <div id='panellistagEditor_minimizaCabecalho' class='container-minimiza'></div>")}else{YAHOO.editorOL.listaGeometrias.panel.setHeader("Geometrias")}YAHOO.editorOL.listaGeometrias.panel.setFooter("");YAHOO.editorOL.listaGeometrias.panel.render(document.body);YAHOO.editorOL.listaGeometrias.panel.center();YAHOO.util.Event.addListener(YAHOO.editorOL.listaGeometrias.panel.close,"click",function(){YAHOO.editorOL.listaGeometrias.panel.destroy()});temp=$i("panellistagEditor_minimizaCabecalho");if(temp){temp.onclick=function(){i3GEO.janela.minimiza("panellistagEditor")}}}else{YAHOO.editorOL.listaGeometrias.panel.render(document.body)}var g,temp,geos=i3GEO.desenho.layergrafico.features,n=geos.length,ins="<table class=lista4 >";ins+="<tr><td><i>Geometrias</i></td><td><i>Opções</i></td><td></td><td></td></tr>";while(n>0){n-=1;g=geos[n].geometry;ins+="<tr><td>"+g.CLASS_NAME+"</td><td style='cursor:pointer;color:blue' onclick='javascript:i3GEO.editorOL.selFeature("+n+")'>seleciona</td><td style='cursor:pointer;color:blue' onclick='javascript:i3GEO.editorOL.unselFeature("+n+")'>limpa</td><td style='cursor:pointer;color:blue' onclick='javascript:i3GEO.editorOL.flashFeaturesI("+n+")'>brilha</td></tr>"}ins+="</table>";if(geos.length===0){ins="Nenhum elemento gráfico encontrado. Utilize as opções de criação de geometrias."}YAHOO.editorOL.listaGeometrias.panel.show();if(i3GEO.configura){temp=$i("panellistagEditor").getElementsByTagName("div")[2]}else{temp=$i("panellistagEditor").getElementsByTagName("div")[1]}temp.style.overflow="auto";temp.style.height="100px";temp.innerHTML=ins},ferramentas:function(){if(!document.getElementById("panelferramentasEditor")){YAHOO.namespace("editorOL.ferramentas");YAHOO.editorOL.ferramentas.panel=new YAHOO.widget.Panel("panelferramentasEditor",{zIndex:20000,iframe:true,width:"300px",visible:false,draggable:true,close:true});var ins=""+'<p class=paragrafo >Operações sobre as figuras selecionadas:</p>'+'<select onchange="i3GEO.editorOL.processageo(this.value);this.value = \'\'" >'+' <option value="">---</option>'+' <option value=union >União</option>';if(i3GEO.php){ins+=' <option value=intersection >Intersecção</option>'+' <option value=convexhull >Convex hull</option>'+' <option value=boundary >Bordas</option>'+' <option value=difference >Diferença</option>'+' <option value=symdifference >Diferença simétrica</option>'}ins+='</select>'+'<br><br><a class=paragrafo href=# onclick="i3GEO.desenho.layergrafico.destroyFeatures()" >Apaga tudo</a>';YAHOO.editorOL.ferramentas.panel.setBody(ins);if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){YAHOO.editorOL.ferramentas.panel.setHeader("Ferramentas <div id='panelferramentasEditor_minimizaCabecalho' class='container-minimiza'></div>")}else{YAHOO.editorOL.ferramentas.panel.setHeader("Ferramentas")}YAHOO.editorOL.ferramentas.panel.setFooter("");YAHOO.editorOL.ferramentas.panel.render(document.body);YAHOO.editorOL.ferramentas.panel.center();YAHOO.util.Event.addListener(YAHOO.editorOL.ferramentas.panel.close,"click",function(){});temp=$i("panelferramentasEditor_minimizaCabecalho");if(temp){temp.onclick=function(){i3GEO.janela.minimiza("panelferramentasEditor")}}}else{YAHOO.editorOL.ferramentas.panel.render(document.body)}YAHOO.editorOL.ferramentas.panel.show()},snap:function(){var target=i3GEOOLsnap.targets[0],tipos=["node","vertex","edge"],ntipos=tipos.length,i,temp,ativa=false;i3GEOOLsnap.deactivate();for(i=0;i<ntipos;i++){temp=$i("target_"+tipos[i]);target[tipos[i]]=temp.checked;if(temp.checked===true){ativa=true}temp=$i("target_"+tipos[i]+"Tolerance");target[tipos[i]+"Tolerance"]=temp.value}if(ativa===true){i3GEOOLsnap.activate()}},split:function(){i3GEOOLsplit.deactivate();var temp=$i("edge_split_toggle");if(temp.checked===true){i3GEOOLsplit.activate()}},processageo:function(operacao){if(operacao===""){return}var geosel=i3GEO.desenho.layergrafico.selectedFeatures,polis,linhas,pontos,temp;if(geosel.length>0){polis=i3GEO.editorOL.retornaGeometriasTipo(geosel,"OpenLayers.Geometry.Polygon");linhas=i3GEO.editorOL.retornaGeometriasTipo(geosel,"OpenLayers.Geometry.LineString");pontos=i3GEO.editorOL.retornaGeometriasTipo(geosel,"OpenLayers.Geometry.Point");temp=function(retorno){if(i3GEO.janela){i3GEO.janela.fechaAguarde("i3GEO.editorPoli");i3GEO.janela.fechaAguarde("i3GEO.editorLinhas");i3GEO.janela.fechaAguarde("i3GEO.editorPontos")}if(retorno!=""&&retorno.data&&retorno.data!=""&&operacao!="converteSHP"){i3GEO.editorOL.substituiFeaturesSel(retorno.data)}if(operacao==="converteSHP"){i3GEO.atualiza();i3GEO.janela.minimiza("paneltemaativo")}};if(operacao==="union"&&!i3GEO.php){if(polis.length>0){temp=i3GEO.editorOL.uniaojts(polis);i3GEO.editorOL.substituiFeaturesSel(temp)}if(linhas.length>0){temp=i3GEO.editorOL.uniaojts(linhas);i3GEO.editorOL.substituiFeaturesSel(temp)}if(pontos.length>0){temp=i3GEO.editorOL.uniaojts(p);i3GEO.editorOL.substituiFeaturesSel(temp)}}else{if(polis.length>0){i3GEO.janela.abreAguarde("i3GEO.editorPoli","Poligonos");i3GEO.php.funcoesGeometriasWkt(temp,polis.join("|"),operacao)}if(linhas.length>0){i3GEO.janela.abreAguarde("i3GEO.editorLinhas","Linhas");i3GEO.php.funcoesGeometriasWkt(temp,linhas.join("|"),operacao)}if(pontos.length>0){i3GEO.janela.abreAguarde("i3GEO.editorPontos","Pontos");i3GEO.php.funcoesGeometriasWkt(temp,pontos.join("|"),operacao)}}return}else{alert("Selecione pelo menos dois elementos")}},uniaojts:function(geoms){var n=geoms.length,rwkt=new jsts.io.WKTReader(),wwkt=new jsts.io.WKTWriter(),fwkt=new OpenLayers.Format.WKT(),g,i,uniao;if(n>1){uniao=(fwkt.read(geoms[0]).geometry).toString();uniao=rwkt.read(uniao);for(i=1;i<=n;i++){g=(fwkt.read(geoms[i]).geometry).toString();uniao=uniao.union(rwkt.read(g))}uniao=wwkt.write(uniao);return[fwkt.read(uniao)]}else{return false}},retornaGeometriasTipo:function(features,tipo){var n=features.length,lista=[],i,temp;for(i=0;i<n;i++){temp=features[i].geometry;if(temp.CLASS_NAME==tipo){lista.push(temp)}}return lista},guardaBackup:function(){return;if(!i3GEO.editorOL.backup){i3GEO.editorOL.backup=new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false})}else{i3GEO.editorOL.backup.removeFeatures(i3GEO.editorOL.backup.features)}i3GEO.editorOL.backup.addFeatures(i3GEO.desenho.layergrafico.features)},unselTodos:function(){var n,i;n=i3GEO.desenho.layergrafico.features.length;for(i=0;i<n;i++){i3GEO.desenho.layergrafico.features[i].renderIntent="default";i3GEO.editorOL.selbutton.unselect(i3GEO.desenho.layergrafico.features[i])}},unselTodosBackup:function(){var n,i;n=i3GEO.editorOL.backup.features.length;for(i=0;i<n;i++){i3GEO.editorOL.backup.features[i].renderIntent="default";i3GEO.editorOL.selbutton.unselect(i3GEO.editorOL.backup.features[i])}},restauraBackup:function(){if(i3GEO.editorOL.backup.features.length>0){i3GEO.desenho.layergrafico.removeFeatures(i3GEO.desenho.layergrafico.features);i3GEO.desenho.layergrafico.addFeatures(i3GEO.editorOL.backup.features)}if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}},substituiFeaturesSel:function(wkt){i3GEO.editorOL.guardaBackup();try{var f,fwkt=new OpenLayers.Format.WKT();i3GEO.desenho.layergrafico.removeFeatures(i3GEO.desenho.layergrafico.selectedFeatures);f=fwkt.read(wkt);f["attributes"]={opacidade:i3GEO.editorOL.simbologia.opacidade,texto:i3GEO.editorOL.simbologia.texto,fillColor:i3GEO.editorOL.simbologia.fillColor,strokeWidth:i3GEO.editorOL.simbologia.strokeWidth,strokeColor:i3GEO.editorOL.simbologia.strokeColor,pointRadius:i3GEO.editorOL.simbologia.pointRadius,graphicName:i3GEO.editorOL.simbologia.graphicName};i3GEO.desenho.layergrafico.addFeatures([f]);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}}catch(e){i3GEO.editorOL.restauraBackup()}},adicionaFeatureWkt:function(wkt,atributos){var f,fwkt=new OpenLayers.Format.WKT();if(atributos.externalGraphic&&atributos.externalGraphic!=""){var style_mark=OpenLayers.Util.extend({},OpenLayers.Feature.Vector.style['default']);style_mark.externalGraphic=atributos.externalGraphic;style_mark.graphicWidth=atributos.graphicWidth;style_mark.graphicHeight=atributos.graphicHeight;style_mark.fillOpacity=atributos.opacidade;f=fwkt.read(wkt);f["attributes"]=atributos;f["style"]=style_mark}else{f=fwkt.read(wkt);f["attributes"]=atributos}i3GEO.desenho.layergrafico.addFeatures([f]);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}},flashFeaturesI:function(index){i3GEO.editorOL.flashFeatures([i3GEO.desenho.layergrafico.features[index]],0)},flashFeatures:function(features,index){if(!index){index=0}var current=features[index];if(current&¤t.layer===i3GEO.desenho.layergrafico){i3GEO.desenho.layergrafico.drawFeature(features[index],"select")}var prev=features[index-1];if(prev&&prev.layer===i3GEO.desenho.layergrafico){i3GEO.desenho.layergrafico.drawFeature(prev,"default")}++index;if(index<=features.length){window.setTimeout(function(){i3GEO.editorOL.flashFeatures(features,index)},75)}},selFeature:function(index){i3GEO.editorOL.selbutton.select(i3GEO.desenho.layergrafico.features[index])},unselFeature:function(index){i3GEO.editorOL.selbutton.unselect(i3GEO.desenho.layergrafico.features[index])},carregajts:function(funcao){if(i3GEO.configura){i3GEO.util.scriptTag(i3GEO.configura.locaplic+"/pacotes/jsts/lib/jsts.js",funcao,"i3GEOjts",true)}else{i3GEO.util.scriptTag("../pacotes/jsts/lib/jsts.js",funcao,"i3GEOjts",true)}},trazParaFrente:function(){var features=i3GEO.desenho.layergrafico.selectedFeatures;if(features.length>0){i3GEO.editorOL.backup=new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false});i3GEO.editorOL.backup.addFeatures(features);i3GEO.editorOL.unselTodosBackup();i3GEO.desenho.layergrafico.removeFeatures(features);i3GEO.desenho.layergrafico.addFeatures(i3GEO.editorOL.backup.features);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}}else{alert("Selecione pelo menos um elemento")}},pegaControle:function(classe){var n=i3GEO.editorOL.controles.length,i;for(i=0;i<n;i++){if(i3GEO.editorOL.controles[i].CLASS_NAME===classe){return i3GEO.editorOL.controles[i]}}return false},ativaLayerSwitcher:function(){var ls=i3GEO.editorOL.pegaControle("OpenLayers.Control.LayerSwitcher");if(ls){ls.maximizeDiv.click()}},desativaRodaDoMouse:function(){var controls=i3GEO.editorOL.mapa.getControlsByClass('OpenLayers.Control.Navigation');for(var i=0;i<controls.length;++i){controls[i].disableZoomWheel()}},google2wgs:function(obj){if(i3GEO.Interface.openlayers.googleLike===true){var projWGS84=new OpenLayers.Projection("EPSG:4326"),proj900913=new OpenLayers.Projection("EPSG:900913");return obj.transform(proj900913,projWGS84)}else{return obj}}}; | |
1483 | 1484 | |
1484 | 1485 | <?php if(extension_loaded('zlib')){ob_end_flush();}?> |
1485 | 1486 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,576 @@ |
1 | +<?php | |
2 | +/** | |
3 | + * DESLIGACACHE (opcional) {sim|nao} - forca a nao usar o cache de imagens qd | |
4 | + * definido como "sim", do contrário, o uso ou não do cache | |
5 | + * será definido automaticamente | |
6 | + */ | |
7 | +include_once(dirname(__FILE__)."/../ms_configura.php"); | |
8 | +include_once(dirname(__FILE__)."/../classesphp/pega_variaveis.php"); | |
9 | +include_once(dirname(__FILE__)."/../classesphp/carrega_ext.php"); | |
10 | +error_reporting(0); | |
11 | +if(!empty($desligacache)){ | |
12 | + $DESLIGACACHE = $desligacache; | |
13 | +} | |
14 | +// | |
15 | +//verifica se em cada camada deve ser inserido um parametro aleatorio para evitar cache de imagem do lado do cliente | |
16 | +// | |
17 | +if($nocache == "sim"){ | |
18 | + $nocache = "a".mt_rand(0, 1000)."&"; | |
19 | +} | |
20 | +else{ | |
21 | + $nocache = ""; | |
22 | +} | |
23 | +// | |
24 | +// recupera um mapa salvo no banco de administracao | |
25 | +// | |
26 | +$temasPluginI3Geo = array(); | |
27 | +if(!empty($restauramapa)){ | |
28 | + include_once(dirname(__FILE__)."/../classesphp/funcoes_gerais.php"); | |
29 | + $xbase = restauraMapaAdmin($restauramapa,$dir_tmp); | |
30 | + $m = ms_newMapObj($xbase); | |
31 | + $w = $m->web; | |
32 | + $w->set("imagepath",dirname($w->imagepath)."/"); | |
33 | + $w->set("imageurl",dirname($w->imageurl)."/"); | |
34 | + // apaga algumas camadas | |
35 | + $l = $m->getlayerbyname("rosadosventos"); | |
36 | + if($l != ""){ | |
37 | + $l->set("status",MS_DELETE); | |
38 | + } | |
39 | + $l = $m->getlayerbyname("copyright"); | |
40 | + if($l != ""){ | |
41 | + $l->set("status",MS_DELETE); | |
42 | + } | |
43 | + $m->save($xbase); | |
44 | + $temas = $xbase; | |
45 | + if (!isset($mapext)){ | |
46 | + $mapext = $m->extent->minx." ".$m->extent->miny." ".$m->extent->maxx." ".$m->extent->maxy; | |
47 | + } | |
48 | +} | |
49 | +// | |
50 | +// imprime na tela a ajuda ao usuário | |
51 | +// | |
52 | +if(!isset($temas)){ | |
53 | + ajuda(); | |
54 | +} | |
55 | +// problema na versão 211 do OpenLayers. Tamanho em % não é | |
56 | +// aceito | |
57 | +// if(!isset($largura)) | |
58 | + // {$largura = 500;} | |
59 | +if(isset($largura) && !isset($altura)){ | |
60 | + $altura = $largura; | |
61 | +} | |
62 | +if(isset($altura) && !isset($largura)){ | |
63 | + $largura = $altura; | |
64 | +} | |
65 | +// | |
66 | +// define quais controles serão mostrados no mapa | |
67 | +// | |
68 | +$objControles = array(); | |
69 | +if(isset($controles)){ | |
70 | + $controles = str_replace(" ",",",$controles); | |
71 | + $controles = strtolower($controles); | |
72 | + $controles = explode(",",$controles); | |
73 | + if(in_array("navigation",$controles)){ | |
74 | + $objControles[] = "new OpenLayers.Control.Navigation()"; | |
75 | + } | |
76 | + if(in_array("panzoombar",$controles)){ | |
77 | + $objControles[] = "new OpenLayers.Control.PanZoomBar()"; | |
78 | + } | |
79 | + if(in_array("layerswitcher",$controles)){ | |
80 | + $objControles[] = "new OpenLayers.Control.LayerSwitcher({'ascending':false})"; | |
81 | + } | |
82 | + if(in_array("scaleline",$controles)){ | |
83 | + $objControles[] = "new OpenLayers.Control.ScaleLine()"; | |
84 | + } | |
85 | + if(in_array("mouseposition",$controles)) | |
86 | + { | |
87 | + $objControles[] = "new OpenLayers.Control.MousePosition({'separator':' '})"; | |
88 | + } | |
89 | + if(in_array("overviewmap",$controles)){ | |
90 | + $objControles[] = "new OpenLayers.Control.OverviewMap()"; | |
91 | + } | |
92 | + if(in_array("keyboarddefaults",$controles)){ | |
93 | + $objControles[] = "new OpenLayers.Control.KeyboardDefaults()"; | |
94 | + } | |
95 | +} | |
96 | +// | |
97 | +// define quais botoes serão mostrados no mapa | |
98 | +// | |
99 | +$objBotoes = array(); | |
100 | +if(isset($botoes)){ | |
101 | + $botoes = str_replace(" ",",",$botoes); | |
102 | + $botoes = strtolower($botoes); | |
103 | + $botoes = explode(",",$botoes); | |
104 | + if(in_array("pan",$botoes)){ | |
105 | + $objBotoes[] = "'pan':true"; | |
106 | + } | |
107 | + if(in_array("zoombox",$botoes)){ | |
108 | + $objBotoes[] = "'zoombox':true"; | |
109 | + } | |
110 | + if(in_array("zoomtot",$botoes)){ | |
111 | + $objBotoes[] = "'zoomtot':true"; | |
112 | + } | |
113 | + if(in_array("zoomout",$botoes)){ | |
114 | + $objBotoes[] = "'zoomout':true"; | |
115 | + } | |
116 | + if(in_array("zoomin",$botoes)) | |
117 | + { | |
118 | + $objBotoes[] = "'zoomin':true"; | |
119 | + } | |
120 | + if(in_array("legenda",$botoes)){ | |
121 | + $objBotoes[] = "'legenda':true"; | |
122 | + } | |
123 | + if(in_array("distancia",$botoes)){ | |
124 | + $objBotoes[] = "'distancia':true"; | |
125 | + } | |
126 | + if(in_array("area",$botoes)){ | |
127 | + $objBotoes[] = "'area':true"; | |
128 | + } | |
129 | + if(in_array("identifica",$botoes)){ | |
130 | + $objBotoes[] = "'identifica':true"; | |
131 | + } | |
132 | + if(in_array("linha",$botoes)){ | |
133 | + $objBotoes[] = "'linha':true"; | |
134 | + } | |
135 | + if(in_array("ponto",$botoes)){ | |
136 | + $objBotoes[] = "'ponto':true"; | |
137 | + } | |
138 | + if(in_array("poligono",$botoes)){ | |
139 | + $objBotoes[] = "'poligono':true"; | |
140 | + } | |
141 | + if(in_array("edita",$botoes)){ | |
142 | + $objBotoes[] = "'edita':true"; | |
143 | + } | |
144 | + if(in_array("listag",$botoes)){ | |
145 | + $objBotoes[] = "'listag':true"; | |
146 | + } | |
147 | + if(in_array("corta",$botoes)){ | |
148 | + $objBotoes[] = "'corta':true"; | |
149 | + } | |
150 | + if(in_array("apaga",$botoes)){ | |
151 | + $objBotoes[] = "'apaga':true"; | |
152 | + } | |
153 | + if(in_array("procura",$botoes)){ | |
154 | + $objBotoes[] = "'procura':true"; | |
155 | + } | |
156 | + if(in_array("salva",$botoes)){ | |
157 | + $objBotoes[] = "'salva':true"; | |
158 | + } | |
159 | + if(in_array("ajuda",$botoes)){ | |
160 | + $objBotoes[] = "'ajuda':true"; | |
161 | + } | |
162 | + if(in_array("fecha",$botoes)){ | |
163 | + $objBotoes[] = "'fecha':true"; | |
164 | + } | |
165 | + if(in_array("tools",$botoes)){ | |
166 | + $objBotoes[] = "'tools':true"; | |
167 | + } | |
168 | + if(in_array("undo",$botoes)){ | |
169 | + $objBotoes[] = "'undo':true"; | |
170 | + } | |
171 | + if(in_array("propriedades",$botoes)){ | |
172 | + $objBotoes[] = "'propriedades':true"; | |
173 | + } | |
174 | + if(in_array("frente",$botoes)){ | |
175 | + $objBotoes[] = "'frente':true"; | |
176 | + } | |
177 | + if(in_array("texto",$botoes)){ | |
178 | + $objBotoes[] = "'texto':true"; | |
179 | + } | |
180 | + $botoes = "{".implode(",",$objBotoes)."}"; | |
181 | +} | |
182 | + | |
183 | +// | |
184 | +// define a lista de layers do tipo baselayers | |
185 | +// $fundo é um array com a lista dos nomes possíveis ou passados | |
186 | +// pela url | |
187 | +// cada um deve ser definido em openlayers.js.php | |
188 | +// | |
189 | +if(isset($fundo) && $fundo != ""){ | |
190 | + $fundo = str_replace(","," ",$fundo); | |
191 | + $fundo = explode(" ",$fundo); | |
192 | +} | |
193 | +// | |
194 | +// define quais os layers que comporão o mapa | |
195 | +// | |
196 | +if(isset($temas)){ | |
197 | + $objOpenLayers = array(); | |
198 | +} | |
199 | +if($temas != ""){ | |
200 | + $temas = str_replace(" ",",",$temas); | |
201 | + // $temas = strtolower($temas); | |
202 | + $temas = explode(",",$temas); | |
203 | + if(!isset($visiveis)){ | |
204 | + $visiveis = $temas; | |
205 | + } | |
206 | + else{ | |
207 | + $visiveis = str_replace(" ",",",$visiveis); | |
208 | + $visiveis = explode(",",$visiveis); | |
209 | + } | |
210 | + $objOpenLayers = array(); | |
211 | + if(isset($servidor) && $servidor != "../ogc.php"){ | |
212 | + $layers = $temas; | |
213 | + foreach($temas as $tema){ | |
214 | + $nomeLayer = str_replace(".map","",basename($tema)); | |
215 | + $nomeLayer = str_replace(".php","",$nomeLayer); | |
216 | + $objOpenLayers[] = 'new OpenLayers.Layer.WMS( "'.$tema.'", "'.$servidor.'?'.$nocache.'tema='.$tema.'&DESLIGACACHE='.$DESLIGACACHE.'&",{layers:"'.$nomeLayer.'",transparent: "true", format: "image/png"},{isBaseLayer:false})'; | |
217 | + } | |
218 | + } | |
219 | + else{ | |
220 | + foreach($temas as $tema){ | |
221 | + if(file_exists($locaplic."/temas/".$tema.".gvp")){ | |
222 | + include_once($locaplic."/pacotes/gvsig/gvsig2mapfile/class.gvsig2mapfile.php"); | |
223 | + $gm = new gvsig2mapfile($locaplic."/temas/".$tema.".gvp"); | |
224 | + $gvsigview = $gm->getViewsNames(); | |
225 | + $objOpenLayers[] = 'new OpenLayers.Layer.WMS( "'.$gvsigview[0].'", "../ogc.php?'.$nocache.'tema='.$tema.'&DESLIGACACHE='.$DESLIGACACHE.'&",{layers:"'.$tema.'",transparent: "true", format: "image/png"},{singleTile:false,visibility:true,isBaseLayer:false})'; | |
226 | + } | |
227 | + else{ | |
228 | + $nomeMap = ""; | |
229 | + if(file_exists($locaplic."/temas/".$tema.".map")){ | |
230 | + $nomeMap = $locaplic."/temas/".$tema.".map"; | |
231 | + } | |
232 | + else{ | |
233 | + if(file_exists($tema)){ | |
234 | + $nomeMap = $tema; | |
235 | + } | |
236 | + else{ | |
237 | + // acontece caso o mapfile tenha sido gerado na pasta | |
238 | + // temporaria por algum sistema | |
239 | + if(file_exists($dir_tmp."/".$tema.".map")){ | |
240 | + $nomeMap = $dir_tmp."/".$tema.".map"; | |
241 | + } | |
242 | + } | |
243 | + } | |
244 | + if($nomeMap != ""){ | |
245 | + $layersNomes = array(); | |
246 | + $layers = array(); | |
247 | + $maptemp = @ms_newMapObj($nomeMap); | |
248 | + if($maptemp){ | |
249 | + $nlayers = $maptemp->numlayers; | |
250 | + for($i=0;$i<($nlayers);++$i) { | |
251 | + $layern = $maptemp->getLayer($i); | |
252 | + if($layern->getmetadata("PLUGINI3GEO") != ""){ | |
253 | + //obtem os dados necessarios para iniciar o plugin | |
254 | + $temasPluginI3Geo[] = array( | |
255 | + "name"=>$layern->name, | |
256 | + "tema"=>$layern->getmetadata("tema"), | |
257 | + "plugin"=>$layern->getmetadata("PLUGINI3GEO") | |
258 | + ); | |
259 | + } | |
260 | + else{ | |
261 | + $layersNomes[] = $layern->name; | |
262 | + $layers[] = $layern; | |
263 | + } | |
264 | + } | |
265 | + $nomeLayer = implode(",",$layersNomes); | |
266 | + $tituloLayer = $layern->getmetadata("tema"); | |
267 | + $ebase = "false"; | |
268 | + if(isset($fundo) && $fundo != ""){ | |
269 | + if(in_array($tema,$fundo)){ | |
270 | + $ebase = "true"; | |
271 | + } | |
272 | + } | |
273 | + $visivel = "false"; | |
274 | + if(in_array($tema,$visiveis)){ | |
275 | + $visivel = "true"; | |
276 | + } | |
277 | + // echo $visivel;exit; | |
278 | + // var_dump($visiveis);exit; | |
279 | + if($nlayers == 1 && strtoupper($layern->getmetadata("cache")) == "SIM"){ | |
280 | + // nesse caso o layer e adicionado como TMS | |
281 | + // tms leva os parametros do TMS | |
282 | + $objOpenLayers[] = 'new OpenLayers.Layer.XYZ("'.$tituloLayer.'", "../ogc.php?Z=${z}&X=${x}&Y=${y}&'.$nocache.'tema='.$tema.'&DESLIGACACHE='.$DESLIGACACHE.'&SRS=EPSG:3857", | |
283 | + {serviceVersion:"&tms=",visibility:'.$visivel.',isBaseLayer:'.$ebase.',layername:"'.$nomeLayer.'",type:"png"})'; | |
284 | + // cria um clone WMS para efeitos de getfeatureinfo | |
285 | + $objOpenLayers[] = 'new OpenLayers.Layer.WMS( "'.$tituloLayer.'", "../ogc.php?'.$nocache.'tema='.$tema.'&DESLIGACACHE='.$DESLIGACACHE.'&",{layers:"'.$nomeLayer.'",transparent: "true", format: "image/png"},{displayInLayerSwitcher:false,singleTile:true,visibility:false,isBaseLayer:false})'; | |
286 | + } | |
287 | + else{ | |
288 | + foreach($layers as $l){ | |
289 | + $tituloLayer = $l->getmetadata("tema"); | |
290 | + $nomeLayer = $l->name; | |
291 | + $visivel = "false"; | |
292 | + if($l->status == MS_DEFAULT || $nlayers == 1){ | |
293 | + $visivel = "true"; | |
294 | + } | |
295 | + if($tituloLayer != ""){ | |
296 | + $objOpenLayers[] = 'new OpenLayers.Layer.WMS( "'.$tituloLayer.'", "../ogc.php?'.$nocache.'tema='.$tema.'&DESLIGACACHE='.$DESLIGACACHE.'&",{layers:"'.$nomeLayer.'",transparent: "true", format: "image/png"},{singleTile:true,visibility:'.$visivel.',isBaseLayer:'.$ebase.'})'; | |
297 | + } | |
298 | + else{ | |
299 | + $objOpenLayers[] = 'new OpenLayers.Layer.WMS( "'.$tituloLayer.'", "../ogc.php?'.$nocache.'tema='.$tema.'&DESLIGACACHE='.$DESLIGACACHE.'&",{layers:"'.$nomeLayer.'",transparent: "true", format: "image/png"},{displayInLayerSwitcher:false,singleTile:true,visibility:'.$visivel.',isBaseLayer:'.$ebase.'})'; | |
300 | + } | |
301 | + } | |
302 | + } | |
303 | + } | |
304 | + } | |
305 | + else{ | |
306 | + echo $tema." não foi encontrado.<br>"; | |
307 | + } | |
308 | + } | |
309 | + } | |
310 | + } | |
311 | +} | |
312 | +function nomeRandomicoM($n=10){ | |
313 | + $nomes = ""; | |
314 | + $a = 'azertyuiopqsdfghjklmwxcvbnABCDEFGHIJKLMNOPQRSTUVWXYZ'; | |
315 | + $max = 51; | |
316 | + for($i=0; $i < $n; ++$i) | |
317 | + { | |
318 | + $nomes .= $a{mt_rand(0, $max)}; | |
319 | + } | |
320 | + return $nomes; | |
321 | +} | |
322 | +function ajuda(){ | |
323 | + echo " | |
324 | + <pre><b> | |
325 | + Mashup OpenLayers | |
326 | + Parâmetros: | |
327 | + restauramapa - id do mapa armazenado no sistema de administracao e que será restaurado para ser aberto novamente (veja em i3geo/admin/html/mapas.html) | |
328 | + kml - lista de endereços (url) de um arquivos kml que serão adicionados ao mapa. Separado por ',' | |
329 | + servidor - por default é ../ogc.php o que força o uso do i3geo local. Esse é o programa que será utilizado em conjunto com a lista definida no parâmetro 'temas' | |
330 | + temas - lista com os temas (mapfiles) do i3Geo que serão incluídos no mapa. Pode ser incluído um arquivo mapfile que esteja fora da pasta i3geo/temas. Nesse caso, deve-se definir o caminho completo do arquivo e também o parâmetro &layers | |
331 | + visiveis - lista de temas (mesmos nomes do parâmetro temas) que iniciarão como visíveis no mapa. Se não for definido, todos os temas serão visíveis. | |
332 | + numzoomlevels - número de níveis de zoom, default=12 | |
333 | + minresolution - resolução mínima. Utilizada para definir o primeiro nível de zoom. Default=0.703125 | |
334 | + maxextent - extensão geográfica máxima do mapa (xmin,ymin,xmax,ymax) | |
335 | + mapext - extensão geográfica inicial do mapa (xmin,ymin,xmax,ymax) | |
336 | + largura - lagura do mapa em pixels | |
337 | + altura - altura do mapa em pixels | |
338 | + pontos - lista de coordenadas x e y que serão incluídas como marcas no mapa | |
339 | + marca - nome do arquivo que contém a imagem que será utilizada para mostrar as coordenadas | |
340 | + tiles (true|false) - indica se o modo tile será usado ou não (true por default). O modo tile pode tornar o mashup mais lento em algumas situações. | |
341 | + incluilayergrafico (true|false) - indica se o layer que recebe elementos gráficos será adicionado ou não ao mapa | |
342 | + ativalayerswicther (true|false) - inicia o mapa com a caixa de escolha das camadas (layerSwitcher) aberta ou não. Por default, inicia fechada | |
343 | + ativarodadomouse (true|false) - ativa ou não o zoom com base na roda do mouse (default é true) | |
344 | + legendahtml (true|false) - ativa ou não (default é false) a geração de legenda do tipo HTML no lugar de imagem png. Legendas HTML podem ser modificadas com base em CSS. A legenda é construída com o template i3geo/aplicmap/legendaOgc.html. | |
345 | + desligacache (sim|nao) - desativa o uso do cache de imagens em disco do lado do servidor, forçando a renderização dos tiles de cada camada em cada requisição | |
346 | + nocache (sim) - evita o uso de imagens em cache existentes no navegador do usuário | |
347 | + | |
348 | + controles - lista com os nomes dos controles que serão adicionados ao mapa. Se não for definido, todos os controles serão adicionados | |
349 | + navigation | |
350 | + panzoombar | |
351 | + layerswitcher | |
352 | + scaleline | |
353 | + mouseposition | |
354 | + overviewmap | |
355 | + keyboarddefaults | |
356 | + 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 | |
357 | + pan | |
358 | + zoombox | |
359 | + zoomtot | |
360 | + zoomin | |
361 | + zoomout | |
362 | + distancia | |
363 | + area | |
364 | + identifica | |
365 | + ponto | |
366 | + linha | |
367 | + poligono | |
368 | + texto | |
369 | + edita | |
370 | + listag (lista geometrias) | |
371 | + apaga | |
372 | + captura | |
373 | + procura | |
374 | + frente | |
375 | + propriedades | |
376 | + tools | |
377 | + undo | |
378 | + salva | |
379 | + ajuda | |
380 | + fecha | |
381 | + corta | |
382 | + legenda | |
383 | + | |
384 | + Para ver a lista de códigos de temas, que podem ser utilizados no parâmetro 'temas', acesse: | |
385 | + <a href='../ogc.php?lista=temas' >lista de temas</a>. Os códigos são mostrados em vermelho. | |
386 | + | |
387 | + Exemplo: | |
388 | + | |
389 | + <iframe height='400px' src='http://mapas.mma.gov.br/i3geo/mashups/osm.php?temas=bioma&altura=350&largura=350' style='border: 0px solid white;' width='400px'></iframe> | |
390 | + | |
391 | + "; | |
392 | + exit; | |
393 | +} | |
394 | +?> | |
395 | +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | |
396 | +<html> | |
397 | +<head> | |
398 | +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> | |
399 | + | |
400 | +<!-- <script type="text/javascript" src="openlayers_compacto.js.php"></script>--> | |
401 | +<script type="text/javascript" src="../pacotes/yui290/build/yahoo-dom-event/yahoo-dom-event.js"></script> | |
402 | +<script type="text/javascript" src="../pacotes/yui290/build/dragdrop/dragdrop-min.js"></script> | |
403 | +<script type="text/javascript" src="../pacotes/yui290/build/container/container-min.js"></script> | |
404 | +<script type="text/javascript" src="../classesjs/compactados/classe_calculo_compacto.js"></script> | |
405 | +<script type="text/javascript" src="../classesjs/compactados/classe_util_compacto.js"></script> | |
406 | +<script type="text/javascript" src="../classesjs/compactados/classe_janela_compacto.js"></script> | |
407 | +<script type="text/javascript" src="../pacotes/openlayers/OpenLayers2131.js"></script> | |
408 | +<script type="text/javascript" src="../classesjs/compactados/classe_desenho_compacto.js"></script> | |
409 | +<script type="text/javascript" src="../classesjs/classe_editorol.js"></script> | |
410 | +<?php | |
411 | +//carrega o script para layers do tipo plugin | |
412 | +if(count($temasPluginI3Geo) > 0){ | |
413 | + echo '<script type="text/javascript" src="../classesjs/classe_plugini3geo.js"></script>'."\n"; | |
414 | +} | |
415 | +?> | |
416 | +<link rel="stylesheet" href="openlayers_compacto.css" type="text/css" /> | |
417 | + | |
418 | +<style> | |
419 | +.yui-skin-sam .container-minimiza { | |
420 | + background: transparent | |
421 | + url(../pacotes/yui290/build/assets/skins/sam/sprite.png) no-repeat | |
422 | + scroll 0 -450px; | |
423 | + cursor: pointer; | |
424 | + height: 15px; | |
425 | + position: absolute; | |
426 | + right: 30px; | |
427 | + top: 1px; | |
428 | + width: 25px; | |
429 | + z-index: 2001; | |
430 | + opacity: .8; | |
431 | + filter: alpha(opacity = 80); | |
432 | +} | |
433 | +</style> | |
434 | +</head> | |
435 | +<body class=" yui-skin-sam"> | |
436 | + <?php | |
437 | + if(isset($largura) && $largura != ""){ | |
438 | + echo '<div id=i3geoMapa style="width:'.$largura.'px;height:'.$altura.'px;"></div>'; | |
439 | + } | |
440 | + else{ | |
441 | + echo '<div id=i3geoMapa style="width:0;height:0"></div>'; | |
442 | + } | |
443 | + | |
444 | + ?> | |
445 | + <div id=i3geoSelTemaAtivo style="height: 15em; z-index: 3000; display: none" class=" yui-skin-sam"></div> | |
446 | + <script> | |
447 | +OpenLayers.ImgPath = "../pacotes/openlayers/img/"; | |
448 | +OpenLayers.Lang.setCode("pt-BR"); | |
449 | +var m = document.getElementById("i3geoMapa"); | |
450 | +if(parseInt(m.style.width,10) === 0){ | |
451 | + var t = i3GEO.util.tamanhoBrowser(); | |
452 | + m.style.width = (t[0]-10)+"px"; | |
453 | + m.style.height = (t[1]-20)+"px"; | |
454 | +} | |
455 | +i3GEO.editorOL.layersIniciais = [<?php | |
456 | + if(isset($objOpenLayers) && $objOpenLayers != "") | |
457 | + {echo implode(",",$objOpenLayers);} | |
458 | + else | |
459 | + {echo "''";} | |
460 | +?>]; | |
461 | +<?php if(isset($botoes)){ | |
462 | + echo "i3GEO.editorOL.botoes = $botoes ;"; | |
463 | +} | |
464 | +?> | |
465 | +i3GEO.editorOL.pontos = [<?php | |
466 | + if(isset($pontos)){ | |
467 | + $pontos = str_replace(" ",",",$pontos); | |
468 | + echo $pontos; | |
469 | + } | |
470 | +?>]; | |
471 | +i3GEO.editorOL.kml = [<?php | |
472 | + if(isset($kml)){ | |
473 | + $kml = str_replace(" ",",",$kml); | |
474 | + $kml = explode(",",$kml); | |
475 | + echo "'".implode("','",$kml)."'"; | |
476 | + } | |
477 | +?>]; | |
478 | +i3GEO.editorOL.marca = "<?php | |
479 | + if(isset($marca)){echo $marca;} | |
480 | + else | |
481 | + {echo "../pacotes/openlayers/img/marker-gold.png";} | |
482 | +?>"; | |
483 | +i3GEO.editorOL.tiles = "<?php | |
484 | + if(isset($tiles)){echo $tiles;} | |
485 | + else | |
486 | + {echo "true";} | |
487 | +?>"; | |
488 | +i3GEO.editorOL.incluilayergrafico = "<?php | |
489 | + if(isset($incluilayergrafico)){echo $incluilayergrafico;} | |
490 | + else | |
491 | + {echo "true";} | |
492 | +?>"; | |
493 | +i3GEO.editorOL.ativalayerswitcher = "<?php | |
494 | + if(isset($ativalayerswitcher)){echo $ativalayerswitcher;} | |
495 | + else | |
496 | + {echo "false";} | |
497 | +?>"; | |
498 | +i3GEO.editorOL.ativarodadomouse = "<?php | |
499 | + if(isset($ativarodadomouse)){echo $ativarodadomouse;} | |
500 | + else | |
501 | + {echo "true";} | |
502 | +?>"; | |
503 | + | |
504 | +i3GEO.editorOL.legendahtml = "<?php | |
505 | + if(isset($legendahtml)){echo $legendahtml;} | |
506 | + else | |
507 | + {echo "false";} | |
508 | +?>"; | |
509 | + | |
510 | +<?php | |
511 | +if(isset($controles)){ | |
512 | + echo "i3GEO.editorOL.controles = [".implode(",",$objControles)."];"; | |
513 | +} | |
514 | +if(isset($numzoomlevels)){ | |
515 | + echo "i3GEO.editorOL.numzoom = ".$numzoomlevels.";"; | |
516 | +} | |
517 | +if(isset($minresolution)){ | |
518 | + echo "i3GEO.editorOL.minresolution = ".$minresolution.";"; | |
519 | +} | |
520 | +if(isset($maxextent)){ | |
521 | + $maxextent = str_replace(" ",",",$maxextent); | |
522 | + echo "i3GEO.editorOL.maxext = new OpenLayers.Bounds(".$maxextent.");\n"; | |
523 | +} | |
524 | +else{ | |
525 | + echo "i3GEO.editorOL.maxext = new OpenLayers.Bounds('-15125970.651191 -5205055.877383 15125970.651191 5205055.877383');\n"; | |
526 | +} | |
527 | +if(isset($mapext)){ | |
528 | + $mapext = str_replace(" ",",",$mapext); | |
529 | + echo "i3GEO.editorOL.mapext = new OpenLayers.Bounds(".$mapext.");\n"; | |
530 | +} | |
531 | +else{ | |
532 | + echo "i3GEO.editorOL.mapext = new OpenLayers.Bounds('-15125970.651191 -5205055.877383 15125970.651191 5205055.877383');\n"; | |
533 | +} | |
534 | +if(empty($fundo)){ | |
535 | + // echo "i3GEO.editorOL.mapa.allOverlays = true;"; | |
536 | +} | |
537 | +?> | |
538 | +i3GEO.editorOL.fundo = "osm"; | |
539 | + | |
540 | +var temp = i3GEO.editorOL.minresolution, | |
541 | +r = [ i3GEO.editorOL.minresolution ]; | |
542 | +for (j = 0; j < (i3GEO.editorOL.numzoom - 1); j++) { | |
543 | + temp = temp / 2; | |
544 | + r.push(temp); | |
545 | +} | |
546 | +i3GEO.editorOL.mapa = new OpenLayers.Map( | |
547 | + 'i3geoMapa', | |
548 | + { | |
549 | + autoUpdateSize: false, | |
550 | + controls:[], | |
551 | + units : 'm', | |
552 | + projection : new OpenLayers.Projection("EPSG:3857"), | |
553 | + displayProjection : new OpenLayers.Projection("EPSG:4326"), | |
554 | + fractionalZoom : false, | |
555 | + resolutions: r, | |
556 | + minResolution: i3GEO.editorOL.minresolution | |
557 | + } | |
558 | +); | |
559 | +i3GEO.editorOL.inicia(); | |
560 | +if(!i3GEO.configura){ | |
561 | + i3GEO.configura = {"locaplic": "../"}; | |
562 | +} | |
563 | +i3GEO.Interface = {openlayers:{googleLike:true}}; | |
564 | +<?php | |
565 | +//camadas plugin | |
566 | + | |
567 | +foreach ($temasPluginI3Geo as $t){ | |
568 | + //cria um objeto javascript para iniciar o plugin | |
569 | + $camada = '{"tema": "'.$t["tema"].'","name":"'.$t["name"].'","plugini3geo":'.$t["plugin"].'}'; | |
570 | + echo "var camada = $camada;\n"; | |
571 | + echo "i3GEO.pluginI3geo[camada.plugini3geo.plugin].openlayers.inicia(camada,i3GEO.editorOL.mapa);\n"; | |
572 | +} | |
573 | +?> | |
574 | +</script> | |
575 | +</body> | |
576 | +</html> | ... | ... |
ogc.php
... | ... | @@ -163,7 +163,10 @@ if(isset($lista) && $lista == "temaswfs"){ |
163 | 163 | // |
164 | 164 | error_reporting(0); |
165 | 165 | $versao = versao(); |
166 | -$versao = $versao["principal"]; | |
166 | +$versao = $versao["principal"]; | |
167 | +if($_GET["SRS"] == "EPSG:900913"){ | |
168 | + $_GET["SRS"] = "EPSG:3857"; | |
169 | +} | |
167 | 170 | $req = ms_newowsrequestobj(); |
168 | 171 | $tipo = ""; |
169 | 172 | $_GET = array_merge($_GET,$_POST); |
... | ... | @@ -691,15 +694,14 @@ if(strtolower($req->getValueByName("REQUEST")) == "getlegendgraphic"){ |
691 | 694 | if($req->getValueByName("FORMAT") == ""){ |
692 | 695 | $req->setParameter("FORMAT","image/png"); |
693 | 696 | } |
694 | - | |
697 | + $legenda = $oMap->legend; | |
698 | + $legenda->set("status",MS_DEFAULT); | |
699 | + $l->set("minscaledenom",0); | |
700 | + $l->set("maxscaledenom",0); | |
695 | 701 | if($req->getValueByName("FORMAT") == "text/html"){ |
696 | 702 | $req->setParameter("FORMAT","image/png"); |
697 | 703 | $l = $oMap->getlayerbyname($req->getValueByName("LAYER")); |
698 | 704 | $l->set("status",MS_DEFAULT); |
699 | - $l->set("minscaledenom",0); | |
700 | - $l->set("maxscaledenom",0); | |
701 | - $legenda = $oMap->legend; | |
702 | - $legenda->set("status",MS_DEFAULT); | |
703 | 705 | $legenda->set("template",$locaplic."/aplicmap/legendaOgc.html"); |
704 | 706 | |
705 | 707 | $tmparray["my_tag"] = "value_of_my_tag"; |
... | ... | @@ -716,13 +718,20 @@ if(strtolower($req->getValueByName("REQUEST")) == "getfeature"){ |
716 | 718 | $l = $oMap->getlayer(0); |
717 | 719 | if($req->getValueByName("TYPENAME") == "" || $req->getValueByName("TYPENAME") == "undefined"){ |
718 | 720 | $req->setParameter("TYPENAME",$l->name); |
721 | + } | |
722 | + | |
723 | + if(strtolower($req->getValueByName("SRS")) == "epsg:900913"){ | |
724 | + $req->setParameter("SRS","EPSG:3857"); | |
719 | 725 | } |
720 | 726 | } |
721 | 727 | if(strtolower($req->getValueByName("REQUEST")) == "getfeatureinfo"){ |
722 | 728 | $l = $oMap->getlayer(0); |
723 | 729 | $req->setParameter("LAYERS",$l->name); |
724 | 730 | $req->setParameter("QUERY_LAYERS",$l->name); |
725 | - //echo "oi";exit; | |
731 | + if(strtolower($req->getValueByName("SRS")) == "epsg:900913"){ | |
732 | + $req->setParameter("SRS","EPSG:3857"); | |
733 | + $_GET["SRS"] = "EPSG:3857"; | |
734 | + } | |
726 | 735 | } |
727 | 736 | // |
728 | 737 | //altera os caminhos das imagens | ... | ... |