diff --git a/admin/admin.db b/admin/admin.db
index eb70ff7..9885b01 100755
Binary files a/admin/admin.db and b/admin/admin.db differ
diff --git a/ferramentas/carregamapa/upload.php b/ferramentas/carregamapa/upload.php
index ed7d722..3562714 100755
--- a/ferramentas/carregamapa/upload.php
+++ b/ferramentas/carregamapa/upload.php
@@ -5,7 +5,7 @@ verificaBlFerramentas(basename(dirname(__FILE__)),$i3geoBlFerramentas,false);
//o usuario deve ter entrado pelo i3Geo
//
if(empty($fingerprint)){
- echo "
Erro ao enviar o arquivo.";
+ echo "
Erro ao enviar o arquivo. (1)";
return;
}
include(dirname(__FILE__)."/../../classesphp/carrega_ext.php");
@@ -144,11 +144,11 @@ if (isset($_FILES['i3GEOcarregamapafilemap']['name']) && strlen(basename($_FILES
//echo "";
}
else{
- echo "
Erro ao enviar o arquivo.";
+ echo "
Erro ao enviar o arquivo. (2)";
}
}
else{
- echo "
Erro ao enviar o arquivo.";
+ echo "
Erro ao enviar o arquivo. (3)";
}
paraAguarde();
function paraAguarde(){
diff --git a/ferramentas/editorol/editorol.js b/ferramentas/editorol/editorol.js
index 5172b47..123397e 100755
--- a/ferramentas/editorol/editorol.js
+++ b/ferramentas/editorol/editorol.js
@@ -2066,8 +2066,8 @@ i3GEO.editorOL =
n -= 1;
id = geos[n].getId();
if(id){
- ins += ''
- + id + " ";
+ ins += '
";
}
}
ins += "";
diff --git a/ferramentas/editorol/editorol_compacto.js b/ferramentas/editorol/editorol_compacto.js
index 0f3c775..82f3ce4 100644
--- a/ferramentas/editorol/editorol_compacto.js
+++ b/ferramentas/editorol/editorol_compacto.js
@@ -1 +1 @@
-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}}i3GEO.editorOL={MUSTACHESALVAGEOMETRIAS:"",MUSTACHEFERRAMENTAS:"",MUSTACHEPROPRIEDADES:"",layerDefault:"",simbologia:{opacidade:0.8,texto:"",fillColor:"250,180,15",strokeWidth:5,strokeColor:"250,150,0",pointRadius:4,graphicName:"square",fontSize:"12px",fontColor:"0,0,0",externalGraphic:"",graphicHeight:25,graphicWidth:25},backup:new ol.layer.Vector({source:new ol.source.Vector({features:new ol.Collection(),useSpatialIndex:false,name:"Backup"}),visible:false}),e_oce:new ol.layer.Tile({title:"ESRI Ocean Basemap",visible:false,isBaseLayer:true,name:"oce",source:new ol.source.TileArcGISRest({url:"http://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer",attributions:[new ol.Attribution({html:'Tiles © ArcGIS '})]})}),e_ims:new ol.layer.Tile({title:"ESRI Imagery World 2D",visible:false,isBaseLayer:true,name:"ims",source:new ol.source.TileArcGISRest({url:"http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer",attributions:[new ol.Attribution({html:'Tiles © ArcGIS '})]})}),e_wsm:new ol.layer.Tile({title:"ESRI World Street Map",visible:false,isBaseLayer:true,name:"wsm",source:new ol.source.TileArcGISRest({url:"http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer",attributions:[new ol.Attribution({html:'Tiles © ArcGIS '})]})}),ol_mma:new ol.layer.Tile({title:"Base carto MMA",visible:false,isBaseLayer:true,name:"bra",source:new ol.source.TileWMS({url:"http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseraster.map&",params:{'layers':"baseraster",'srs':"EPSG:4326",'format':"image/png"}})}),e_tms:new ol.layer.Tile({title:"OSGEO",visible:false,isBaseLayer:true,name:"tms",source:new ol.source.TileWMS({url:"http://tilecache.osgeo.org/wms-c/Basic.py/",params:{'layers':"basic",'type':"png",'srs':"EPSG:4326",'format':"image/png",'VERSION':'1.1.1'},attributions:[new ol.Attribution({html:'© 2006-2010, TileCache Contributors '})]})}),top_wms:new ol.layer.Tile({title:"Toponímia MMA",visible:false,isBaseLayer:true,name:"bra",source:new ol.source.TileWMS({url:"http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseref.map&",params:{'layers':"base",'srs':"EPSG:4326",'format':"image/png"}})}),est_wms:new ol.layer.Tile({title:"Estados do Brasil",visible:false,isBaseLayer:true,name:"bra",source:new ol.source.TileWMS({url:"http://mapas.mma.gov.br/i3geo/ogc.php?tema=estadosl&",params:{'layers':"estadosl",'srs':"EPSG:4326",'format':"image/png"}})}),fundo:"e_ims,e_wsm,ol_mma,ol_wms,top_wms,est_wms,e_oce",nomeFuncaoSalvar:"i3GEO.editorOL.salvaGeo()",kml:[],layersIniciais:[],botoes:{'imprimir':true,'grid':true,'pan':true,'zoombox':true,'zoomtot':true,'zoomin':true,'zoomout':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,'selecaotudo':true,'salva':true,'ajuda':true,'propriedades':true,'fecha':false,'tools':true,'undo':false,'frente':false,'legenda':true,'rodadomouse':true,'novaaba':false},pontos:[],marca:"../pacotes/openlayers/img/marker-gold.png",controles:[],tiles:true,incluilayergrafico:true,ativalayerswitcher:false,ativarodadomouse:true,legendahtml:false,numzoom:12,minresolution:0.703125,maxext:"",mapext:[-76.5125927,-39.3925675209,-29.5851853,9.49014852081],mapa:"",idsSelecionados:[],featuresBackup:[],resolutions:[],matrixIds:[],inicia:function(){var projectionExtent,size,resolutions,matrixIds,z;if(i3GEO.Interface.openlayers.googleLike===true){projectionExtent=ol.proj.get('EPSG:3857').getExtent()}else{projectionExtent=ol.proj.get('EPSG:4326').getExtent()}size=ol.extent.getWidth(projectionExtent)/256;resolutions=new Array(40);matrixIds=new Array(40);for(z=0;z<40;++z){resolutions[z]=size/Math.pow(2,z);matrixIds[z]=z}i3GEO.editorOL.resolutions=resolutions;i3GEO.editorOL.matrixIds=matrixIds;i3GEO.editorOL.incluilayergrafico=true;i3GEO.Interface.openlayers.parametrosView={projection:"EPSG:4326",resolutions:resolutions,minResolution:i3GEO.editorOL.minresolution,maxResolution:resolutions[i3GEO.editorOL.numzoom]};i3GEO.Interface.openlayers.parametrosMap={target:"i3geoMapa",layers:[],controls:[]};i3GEO.Interface.openlayers.cria();i3GEO.editorOL.mapa=i3geoOL;if(i3GEO.editorOL.controles.length===0){i3GEO.editorOL.controles=[new ol.interaction.DoubleClickZoom(),new ol.interaction.KeyboardPan(),new ol.interaction.KeyboardZoom(),new ol.interaction.MouseWheelZoom(),new ol.interaction.PinchRotate(),new ol.interaction.PinchZoom(),new ol.interaction.DragZoom(),new ol.interaction.DragPan(),new ol.control.Zoom(),new ol.control.ZoomSlider(),new ol.control.ScaleLine()]}var alayers=[],fundo=(i3GEO.editorOL.fundo).split(","),nfundo=fundo.length,ncontroles=i3GEO.editorOL.controles.length,i,n,temp;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.selecaotudo=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;i3GEO.editorOL.botoes.novaaba=false}for(i=0;i=0;i--){if(fundo[i]!=""&&i3GEO.editorOL[fundo[i]]){alayers.push(i3GEO.editorOL[fundo[i]]);i3GEO.editorOL[fundo[i]].setVisibility(true)}}}i3GEO.editorOL.mapa.addLayers(alayers);if(i3GEO.editorOL.layersIniciais!==""){n=i3GEO.editorOL.layersIniciais.length;for(i=0;i0){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);lonlat=i3GEO.util.projOSM2Geo(lonlat);d=i3GEO.calculo.dd2dms(lonlat.lon,lonlat.lat);try{$i(idcoord[0].id).innerHTML="Long: "+d[0]+" Lat: "+d[1]}catch(e){}}})}},criaJanelaBusca:function(){var layers=i3GEO.editorOL.layersLigados(),nlayers=layers.length,i,ins,combo="---- ";for(i=0;i"+layers[i].getProperties().name+""}combo+=" ";ins=""+$trad("a7")+": "+combo;ins+=" "+$trad("x64")+": ";ins+=" "+$trad("t23")+": ";ins+="
";ins+=" '"+$trad("result")+"': ";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")}},criaComboTemas:function(){var layers=i3GEO.editorOL.layersLigados(),nlayers=layers.length,i,nometema="",combo="";for(i=0;i"+nometema+""}combo+=" ";return combo},atualizaJanelaAtivaTema:function(){var combo=i3GEO.editorOL.criaComboTemas();YAHOO.temaativo.container.panel.setBody(combo)},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
")}else{YAHOO.temaativo.container.panel.setHeader($trad("tativo"))}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(){i3GEO.editorOL.marcaBotao();if(i3GEO.eventos){i3GEO.eventos.adicionaEventos("ATUALIZAARVORECAMADAS",["i3GEO.editorOL.atualizaJanelaAtivaTema()"])}});if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){if(i3GEO.eventos){i3GEO.eventos.adicionaEventos("ATUALIZAARVORECAMADAS",["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(){if(i3GEO.editorOL.layerDefault&&i3GEO.editorOL.layerDefault!=""){return i3GEO.editorOL.layerPorParametro("LAYERS",i3GEO.editorOL.layerDefault)}else{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="---- ";for(i=0;i"+prop[i].name+""}combo+=" ";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="+item+" *"+palavra+"* ";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="";ins+="--- ";for(i=0;i"+valor+""}ins+=" ";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 prop,layer,layers=i3GEO.editorOL.mapa.getLayers(),nlayers=layers.getLength(),ins="",i,icone="",url,f="",fonte="";for(i=0;ilink"}ins+=icone+prop.name+fonte+"
";eval("var f = function(retorno){document.getElementById('legendaL_"+i+"').innerHTML = retorno.responseText;};");url=url.replace("LAYERS","LAYER");var config={method:"GET",url:url,callback:f}}else if(prop.isBaseLayer===false&&prop.visible===true){url=url.replace("LAYERS","LAYER");url+="&FORMAT=image/png";ins+=prop.title+" "}}}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($trad("p3"));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(){YAHOO.legendaeditorOL.container.panel.destroy()})}else{YAHOO.legendaeditorOL.container.panel.setBody(ins);YAHOO.legendaeditorOL.container.panel.show()}},captura:function(x,y,tema,idunico){var d=0.001,layer=i3geoOL.getLayersByName(tema)[0],xy=[x,y],u=layer.getSource().getUrls()[0],poligono,retorno;u+="&REQUEST=getfeature&service=wfs&version=1.0.0";u+="&OUTPUTFORMAT=gml2&typename=undefined";if(i3GEO.Interface.openlayers.googleLike===true){u+="&SRS=EPSG:3857"}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;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=Geometry "+poligono+" ";retorno=function(r){var fs,c,format,f,n,i,idunico;format=new ol.format.WKT();fs=format.readFeatures(r[0]);n=fs.length;c=i3GEO.desenho.layergrafico.getSource();for(i=0;i0){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:"350px",visible:false,draggable:true,close:true});YAHOO.salvaGeometrias.container.panel.setHeader(""+$trad("u6")+" ");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){}}var hash={"n":n,"geosel":$trad("geosel"),"listar":$trad("listar"),"nomeFuncaoSalvarHidden":"hidden","incorpoHidden":"hidden"};if(i3GEO.editorOL.nomeFuncaoSalvar&&i3GEO.editorOL.nomeFuncaoSalvar!=""){hash.nomeFuncaoSalvar=i3GEO.editorOL.nomeFuncaoSalvar;hash.sdados=$trad("sdados");hash.nomeFuncaoSalvarHidden=""}if(typeof i3geoOL!=="undefined"){hash.incorpo=$trad("incorpo");hash.ajudaEditorOlSalva=$trad("ajudaEditorOlSalva");hash.incorpoHidden=""}ins=Mustache.render(i3GEO.editorOL.MUSTACHESALVAGEOMETRIAS,hash);YAHOO.salvaGeometrias.container.panel.setBody(ins)}else{i3GEO.janela.tempoMsg($trad("selum"))}},exportarSHP:function(){i3GEO.editorOL.processageo("converteSHP")},incorporar:function(){i3GEO.editorOL.processageo("incorporar")},listaGeometriasSel:function(){var n=i3GEO.editorOL.idsSelecionados.length,ins="",s=i3GEO.desenho.layergrafico.getSource(),i,w,g;for(i=0;i"+$trad("u6")+": #"+i+" "+i3GEO.editorOL.google2wgs(g.getGeometry().getCoordinates())+" "}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 s=i3GEO.desenho.layergrafico.getSource(),n=i3GEO.editorOL.idsSelecionados.length,funcaoOK=function(){var f=s.getFeatureById(i3GEO.editorOL.idsSelecionados[0]),g=f.getGeometry(),tema=$i("editorOLcomboTemaEditavel").value,redesenha,p,format;g=i3GEO.editorOL.google2wgs(g);format=new ol.format.WKT();f.setGeometry(g);if(tema==""){return}redesenha=function(retorno){i3GEO.janela.fechaAguarde("aguardeSalvaPonto");i3GEO.editorOL.removeFeaturesSel();i3GEO.Interface.atualizaTema("",tema)};i3GEO.janela.AGUARDEMODAL=true;i3GEO.janela.abreAguarde("aguardeSalvaPonto",$trad("adic")+"...");i3GEO.janela.AGUARDEMODAL=false;if(!f.getProperties().idUnico||f.getProperties().idUnico==""){p=i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=adicionaGeometria&g_sid="+i3GEO.configura.sid;cpJSON.call(p,"foo",redesenha,"&tema="+tema+"&wkt="+format.writeFeatures([f]))}else{p=i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=atualizaGeometria&g_sid="+i3GEO.configura.sid;cpJSON.call(p,"foo",redesenha,"&idunico="+f.getProperties().idUnico+"&tema="+tema+"&wkt="+format.writeFeatures([f]))}},funcaoCombo=function(obj){$i("editorOLondeComboTemaEditavel").innerHTML=obj.dados},texto=$trad("stema")+":
"+$trad("salvaDadosEditor")+"
";if(n!=1){i3GEO.janela.tempoMsg($trad("seluma"))}else{i3GEO.janela.confirma(texto,300,$trad("salva"),$trad("canc"),funcaoOK);i3GEO.util.comboTemas("editorOLcomboTemaEditavel",funcaoCombo,"editorOLondeComboTemaEditavel","",false,"editavel")}},marcaBotao:function(classeBotao){var i,n,botoes=$i("i3GEObarraEdicao").getElementsByTagName("div");n=botoes.length;for(i=0;i0){x=window.confirm($trad("excsel")+"?");if(x){i3GEO.editorOL.removeFeaturesSel();i3GEO.desenho.layergrafico.getSource().changed()}}else{i3GEO.janela.tempoMsg($trad("selum"))}};return temp},botaoFrente:function(){var temp=document.createElement("div");temp.className="editorOLfrenteItemInactive olButton";temp.title=$trad("frente");temp.onclick=function(){var nsel=i3GEO.editorOL.idsSelecionados.length;if(nsel>0){i3GEO.editorOL.marcaBotao();i3GEO.editorOL.trazParaFrente()}else{i3GEO.janela.tempoMsg($trad("selum"))}};return temp},botaoEdita:function(){i3GEO.eventos.cliquePerm.desativa();var temp=document.createElement("div");temp.className="editorOLeditaItemInactive olButton";temp.title=$trad("dpol");temp.onclick=function(){i3GEO.editorOL.featuresBackup=[];var draw,nsel,f,c;nsel=i3GEO.editorOL.idsSelecionados.length;if(nsel>0){i3GEO.editorOL.marcaBotao("editorOLedita");f=i3GEO.desenho.layergrafico.getSource().getFeatureById(i3GEO.editorOL.idsSelecionados[nsel-1]);i3GEO.editorOL.featuresBackup.push(f.clone());c=new ol.Collection();c.push(f);draw=new ol.interaction.Modify({features:c});i3GEO.editorOL.interacoes.push(draw);i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false);i3geoOL.addInteraction(draw)}else{i3GEO.janela.tempoMsg($trad("selum"))}};return temp},botaoCorta:function(){i3GEO.eventos.cliquePerm.desativa();var temp=document.createElement("div");temp.className="editorOLcortaItemInactive olButton";temp.title=$trad("cortaf");temp.onclick=function(){var nsel=i3GEO.editorOL.idsSelecionados.length;if(nsel!=1){alert("Selecione primeiro um elemento para ser cortado")}else{i3GEO.janela.tempoMsg("Desenhe um polígono");i3GEO.editorOL.marcaBotao("editorOLcorta");var draw=new ol.interaction.Draw({type:"Polygon"});i3GEO.editorOL.interacoes.push(draw);i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false);draw.on("drawend",function(evt){var temp,f,c,format,fwkt,cwkt;f=evt.feature;c=i3GEO.desenho.layergrafico.getSource().getFeatureById(i3GEO.editorOL.idsSelecionados[nsel-1]);i3GEO.editorOL.featuresBackup.push(c.clone());i3GEO.editorOL.marcaBotao();format=new ol.format.WKT();if(f&&c){fwkt=format.writeFeatures([f]);cwkt=format.writeFeatures([c]);if(fwkt&&cwkt){temp=function(retorno){i3GEO.janela.fechaAguarde("i3GEO.cortador");if(retorno!=""&&retorno.data&&retorno.data!=""){i3GEO.janela.fechaAguarde("i3GEO.cortador");c.setGeometry(format.readGeometry(retorno.data));if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}}};i3GEO.janela.abreAguarde("i3GEO.cortador","Cortando");i3GEO.php.funcoesGeometriasWkt(temp,cwkt+"|"+fwkt,"difference")}}});i3geoOL.addInteraction(draw)}};return temp},botaoListaGeometrias:function(){var temp=document.createElement("div");temp.className="editorOLlistagItemInactive olButton";temp.title=$trad("listag");temp.onclick=function(){i3GEO.editorOL.listaGeometrias()};return temp},botaoNovaaba:function(){var temp=document.createElement("div");temp.className="editorOLnovaabaItemInactive olButton";temp.title=$trad("novaaba");temp.onclick=function(){window.open(window.location,'_blank')};return temp},botaoAjuda:function(){var temp=document.createElement("div");temp.className="editorOLajudaItemInactive olButton";temp.title=$trad("s1");temp.onclick=function(){if(i3GEO.configura&&i3GEO.configura.locaplic){i3GEO.janela.cria("400px","200px",i3GEO.configura.locaplic+"/mashups/openlayers_ajuda.php?completo=none","","",$trad("s1"),"editorOlAjuda")}else{window.open("openlayers_ajuda.php")}};return temp},botaoFecha:function(){var temp=document.createElement("div");temp.className="editorOLfechaItemInactive olButton";temp.title=$trad("x74");temp.onclick=function(){i3GEO.editorOL.unselTodos();i3GEO.editorOL.featuresBackup=[];i3GEO.editorOL.marcaBotao();i3GEO.eventos.cliquePerm.ativa();$i("i3GEObarraEdicao").style.display="none"};return temp},botaoTools:function(){var temp=document.createElement("div");temp.className="editorOLtoolsItemInactive olButton";temp.title=$trad("u15a");temp.onclick=function(){if(i3GEO.php){i3GEO.editorOL.ferramentas()}else{i3GEO.editorOL.carregajts("i3GEO.editorOL.ferramentas()")}};return temp},botaoPropriedades:function(){var temp=document.createElement("div");temp.className="editorOLpropriedadesItemInactive olButton";temp.title=$trad("p13");temp.onclick=function(){i3GEO.editorOL.propriedades()};return temp},botaoImprimir:function(){var temp=document.createElement("div");temp.className="editorOLimprimirItemInactive olButton";temp.onclick=function(){window.print()};return temp},botaoGrid:function(){var temp=document.createElement("div");temp.className="editorOLgridItemInactive olButton";temp.onclick=function(){var p={"map":i3GEO.editorOL.mapa,"targetSize":200};if(!i3GEO.editorOL.grid){i3GEO.editorOL.grid=new ol.Graticule(p)}else{if(i3GEO.editorOL.grid.getMap()==null){i3GEO.editorOL.grid.setMap(i3GEO.editorOL.mapa)}else{i3GEO.editorOL.grid.setMap(null)}}};return temp},botaoIdentifica:function(){i3GEO.eventos.cliquePerm.desativa();var temp=document.createElement("div");temp.className="editorOLidentificaItemInactive olButton";temp.title=$trad("d7t");temp.onclick=function(){if(i3GEO.editorOL.layerDefault==""){i3GEO.editorOL.criaJanelaAtivaTema()}i3GEO.eventos.cliquePerm.desativa();i3GEO.editorOL.marcaBotao("editorOLidentifica");var draw=new ol.interaction.Draw({type:"Point"});i3GEO.editorOL.interacoes.push(draw);i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false);draw.on("drawend",function(evt){var xy,p,retorno,url,layer,tema=$i("i3GEOOLlistaTemasAtivos");if(tema){layer=i3geoOL.getLayersByName(tema.value)[0];if(layer.getSource().getUrls){url=layer.getSource().getUrls()[0]}else{url=layer.getSource().getUrl()}xy=evt.feature.getGeometry().getFirstCoordinate();retorno=function(r){var valorunico="",camada=null,texto="",lonlattexto,xy,temp,temp1,n,i,f=[],textoN=r.split(":");if(i3GEO.arvoreDeCamadas){camada=i3GEO.arvoreDeCamadas.pegaTema(tema.value,"","name")}xy=evt.feature.getGeometry().getFirstCoordinate();i3GEO.eventos.cliquePerm.ativo=true;try{if(textoN.length>1){textoN.shift();textoN.shift();temp=textoN.join(":");temp=temp.replace(/'/g,"");temp=temp.replace(/\n/g,"|");temp=temp.replace(/_/g," ");temp=temp.split("|");n=temp.length;for(i=0;i"+f.join(" ")+""}}catch(e){}lonlattexto="edita geometria ";i3GEO.Interface.openlayers.balao(""+lonlattexto+texto+"
","",xy[0],xy[1],false,false);i3GEO.eventos.cliquePerm.ativo=false};p=i3GEO.configura.locaplic+"/classesphp/proxy.php?"+url+"&tipoRetornoProxy=string&REQUEST=GetFeatureInfo&TIPOIMAGEM=nenhum&DESLIGACACHE=sim&STYLES=&SERVICE=WMS&VERSION=1.1.1&FEATURE_COUNT=1"+"&FORMAT=image/png&INFO_FORMAT=text/plain&SRS=EPSG:4326"+"&LAYERS="+tema.value+"&layer="+tema.value+"&QUERY_LAYERS="+tema.value+"&HEIGHT="+i3geoOL.getSize()[1]+"&WIDTH="+i3geoOL.getSize()[0]+"&BBOX="+i3geoOL.getExtent().toBBOX().split(",").join(" ")+"&X="+xy[0]+"&Y="+xy[1];cpJSON.call(p,"foo",retorno,"")}});i3geoOL.addInteraction(draw)};return temp},botaoSalva:function(){var temp=document.createElement("div");temp.className="editorOLsalvaItemInactive olButton";temp.title=$trad("salva");temp.onclick=function(){i3GEO.editorOL.salvaGeometrias()};return temp},criaBotoes:function(botoes){if($i("i3GEObarraEdicao")){$i("i3GEObarraEdicao").style.display="block";return}i3GEOpanelEditor=document.createElement("div");i3GEOpanelEditor.id="i3GEObarraEdicao";i3GEOpanelEditor.className="olControlEditingToolbar1 noprint";if(botoes.imprimir===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoImprimir())}if(botoes.grid===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoGrid())}if(botoes.novaaba===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoNovaaba())}if(botoes.procura===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoProcura())}if(botoes.pan===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoPan())}if(botoes.zoombox===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoZoomBox())}if(botoes.zoomtot===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoZoomTot())}if(botoes.zoomin===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoZoomIn())}if(botoes.zoomout===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoZoomOut())}if(botoes.legenda===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoLegenda())}if(botoes.distancia===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoDistancia())}if(botoes.area===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoArea())}if(botoes.identifica===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoIdentifica())}if(botoes.linha===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoLinha())}if(botoes.ponto===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoPonto())}if(botoes.poligono===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoPoligono())}if(botoes.texto===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoTexto())}if(botoes.edita===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoEdita())}if(botoes.selecao===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoSelecao())}if(botoes.selecaotudo===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoSelecaoTudo())}if(botoes.apaga===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoApaga())}if(botoes.frente===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoFrente())}if(botoes.edita===true&&botoes.corta===true&&i3GEO.php){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoCorta())}if(botoes.edita===true&&botoes.listag===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoListaGeometrias())}if(botoes.tools===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoTools())}if(botoes.propriedades===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoPropriedades())}if(botoes.salva===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoSalva())}if(botoes.ajuda===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoAjuda())}if(botoes.fecha===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoFecha())}i3GEOpanelEditor.style.width=i3GEOpanelEditor.getElementsByTagName("div").length*33+"px";i3GEO.editorOL.mapa.getViewport().getElementsByClassName("ol-overlaycontainer-stopevent")[0].appendChild(i3GEOpanelEditor)},removeFeaturesSel:function(){var s,i,nsel,f;nsel=i3GEO.editorOL.idsSelecionados.length;s=i3GEO.desenho.layergrafico.getSource();for(i=0;iPropriedades")}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(){});i3GEO.util.aplicaAquarela("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",{iframe:true,width:"380px",height:"300px",visible:false,draggable:true,close:true});if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){YAHOO.editorOL.listaGeometrias.panel.setHeader(""+$trad("u6")+" ")}else{YAHOO.editorOL.listaGeometrias.panel.setHeader($trad("u6"))}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()})}else{YAHOO.editorOL.listaGeometrias.panel.render(document.body)}var id,temp,geos=i3GEO.desenho.layergrafico.getSource().getFeatures(),n=geos.length,ins="";ins+='';while(n>0){n-=1;id=geos[n].getId();if(id){ins+='
'+id+" "}}ins+="
";if(geos.length===0){ins=''+$trad("meneditor2")+"
"}YAHOO.editorOL.listaGeometrias.panel.setBody(ins);YAHOO.editorOL.listaGeometrias.panel.show()},ferramentas:function(){if(i3GEO.editorOL.MUSTACHEFERRAMENTAS==""){$.get(i3GEO.configura.locaplic+"/ferramentas/editorol/templateFerramentas_mst.html",function(template){i3GEO.editorOL.MUSTACHEFERRAMENTAS=template;i3GEO.editorOL.ferramentas()});return}var b,ins;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 hash={"opsel":$trad("opsel"),"p14":$trad("p14"),"hidden":"hidden"};if(i3GEO.php){hash.hidden=""}ins=Mustache.render(i3GEO.editorOL.MUSTACHEFERRAMENTAS,hash);YAHOO.editorOL.ferramentas.panel.setBody(ins);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(){})}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;i0){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==="incorporar"){polis=i3GEO.editorOL.retornaFeaturesTipo("Polygon");linhas=i3GEO.editorOL.retornaFeaturesTipo("LineString");pontos=i3GEO.editorOL.retornaFeaturesTipo("Point");if(polis.length>0){temp=i3GEO.editorOL.merge(polis)}if(linhas.length>0){temp=i3GEO.editorOL.merge(linhas)}if(pontos.length>0){temp=i3GEO.editorOL.desagrupa(pontos)}if(i3GEO.mapa){i3GEO.mapa.dialogo.wkt2layer(temp)}return}if(operacao==="union"&&!i3GEO.php){polis=i3GEO.editorOL.retornaFeaturesTipo("Polygon");linhas=i3GEO.editorOL.retornaFeaturesTipo("LineString");pontos=i3GEO.editorOL.retornaFeaturesTipo("Point");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(pontos);i3GEO.editorOL.substituiFeaturesSel(temp)}}else{polis=i3GEO.editorOL.retornaGeometriasTipo("Polygon");linhas=i3GEO.editorOL.retornaGeometriasTipo("LineString");pontos=i3GEO.editorOL.retornaGeometriasTipo("Point");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)}}i3GEO.desenho.layergrafico.getSource().changed();return}else{i3GEO.janela.tempoMsg("Selecione pelo menos dois elementos")}},desagrupa:function(geoms){var n=geoms.length,w=[],g,m,i,format=new ol.format.WKT();for(i=0;i1){for(i=1;i1){uniao=fwkt.writeFeatures([geoms[0]]);uniao=rwkt.read(uniao);for(i=1;i<=n;i++){g=fwkt.writeFeatures([geoms[i]]);uniao=uniao.union(rwkt.read(g))}uniao=wwkt.write(uniao);return[fwkt.readFeatures(uniao)]}else{return false}},retornaGeometriasTipo:function(tipo){var n=i3GEO.editorOL.idsSelecionados.length,lista=[],i,s=i3GEO.desenho.layergrafico.getSource(),fwkt=new ol.format.WKT();for(i=0;i0){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(f){i3GEO.editorOL.removeFeaturesSel();var fwkt=new ol.format.WKT();f=fwkt.readFeatures(f)[0];f.setStyle(new ol.style.Style({stroke:new ol.style.Stroke({color:'rgba('+i3GEO.editorOL.simbologia.strokeColor+','+i3GEO.editorOL.simbologia.opacidade+')',width:i3GEO.editorOL.simbologia.strokeWidth}),fill:new ol.style.Fill({color:'rgba('+i3GEO.editorOL.simbologia.fillColor+','+i3GEO.editorOL.simbologia.opacidade+')'})}));f.setId(i3GEO.util.uid());i3GEO.desenho.layergrafico.getSource().addFeature(f)},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(id){var s,f;s=i3GEO.desenho.layergrafico.getSource();f=s.getFeatureById(id);if(!i3GEO.util.in_array(id,i3GEO.editorOL.idsSelecionados)){i3GEO.editorOL.idsSelecionados.push(id);f.setProperties({fillColor:f.getStyle().getFill().getColor(),strokeColor:f.getStyle().getStroke().getColor(),externalGraphic:""});f.getStyle().getFill().setColor('rgba(255, 255, 255, 0.5)');f.getStyle().getStroke().setColor('blue');s.changed()}},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 s,i,nsel,id,clone;s=i3GEO.desenho.layergrafico.getSource();nsel=i3GEO.editorOL.idsSelecionados.length;for(i=0;iArcGIS'})]})}),e_ims:new ol.layer.Tile({title:"ESRI Imagery World 2D",visible:false,isBaseLayer:true,name:"ims",source:new ol.source.TileArcGISRest({url:"http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer",attributions:[new ol.Attribution({html:'Tiles © ArcGIS '})]})}),e_wsm:new ol.layer.Tile({title:"ESRI World Street Map",visible:false,isBaseLayer:true,name:"wsm",source:new ol.source.TileArcGISRest({url:"http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer",attributions:[new ol.Attribution({html:'Tiles © ArcGIS '})]})}),ol_mma:new ol.layer.Tile({title:"Base carto MMA",visible:false,isBaseLayer:true,name:"bra",source:new ol.source.TileWMS({url:"http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseraster.map&",params:{'layers':"baseraster",'srs':"EPSG:4326",'format':"image/png"}})}),e_tms:new ol.layer.Tile({title:"OSGEO",visible:false,isBaseLayer:true,name:"tms",source:new ol.source.TileWMS({url:"http://tilecache.osgeo.org/wms-c/Basic.py/",params:{'layers':"basic",'type':"png",'srs':"EPSG:4326",'format':"image/png",'VERSION':'1.1.1'},attributions:[new ol.Attribution({html:'© 2006-2010, TileCache Contributors '})]})}),top_wms:new ol.layer.Tile({title:"Toponímia MMA",visible:false,isBaseLayer:true,name:"bra",source:new ol.source.TileWMS({url:"http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseref.map&",params:{'layers':"base",'srs':"EPSG:4326",'format':"image/png"}})}),est_wms:new ol.layer.Tile({title:"Estados do Brasil",visible:false,isBaseLayer:true,name:"bra",source:new ol.source.TileWMS({url:"http://mapas.mma.gov.br/i3geo/ogc.php?tema=estadosl&",params:{'layers':"estadosl",'srs':"EPSG:4326",'format':"image/png"}})}),fundo:"e_ims,e_wsm,ol_mma,ol_wms,top_wms,est_wms,e_oce",nomeFuncaoSalvar:"i3GEO.editorOL.salvaGeo()",kml:[],layersIniciais:[],botoes:{'imprimir':true,'grid':true,'pan':true,'zoombox':true,'zoomtot':true,'zoomin':true,'zoomout':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,'selecaotudo':true,'salva':true,'ajuda':true,'propriedades':true,'fecha':false,'tools':true,'undo':false,'frente':false,'legenda':true,'rodadomouse':true,'novaaba':false},pontos:[],marca:"../pacotes/openlayers/img/marker-gold.png",controles:[],tiles:true,incluilayergrafico:true,ativalayerswitcher:false,ativarodadomouse:true,legendahtml:false,numzoom:12,minresolution:0.703125,maxext:"",mapext:[-76.5125927,-39.3925675209,-29.5851853,9.49014852081],mapa:"",idsSelecionados:[],featuresBackup:[],resolutions:[],matrixIds:[],inicia:function(){var projectionExtent,size,resolutions,matrixIds,z;if(i3GEO.Interface.openlayers.googleLike===true){projectionExtent=ol.proj.get('EPSG:3857').getExtent()}else{projectionExtent=ol.proj.get('EPSG:4326').getExtent()}size=ol.extent.getWidth(projectionExtent)/256;resolutions=new Array(40);matrixIds=new Array(40);for(z=0;z<40;++z){resolutions[z]=size/Math.pow(2,z);matrixIds[z]=z}i3GEO.editorOL.resolutions=resolutions;i3GEO.editorOL.matrixIds=matrixIds;i3GEO.editorOL.incluilayergrafico=true;i3GEO.Interface.openlayers.parametrosView={projection:"EPSG:4326",resolutions:resolutions,minResolution:i3GEO.editorOL.minresolution,maxResolution:resolutions[i3GEO.editorOL.numzoom]};i3GEO.Interface.openlayers.parametrosMap={target:"i3geoMapa",layers:[],controls:[]};i3GEO.Interface.openlayers.cria();i3GEO.editorOL.mapa=i3geoOL;if(i3GEO.editorOL.controles.length===0){i3GEO.editorOL.controles=[new ol.interaction.DoubleClickZoom(),new ol.interaction.KeyboardPan(),new ol.interaction.KeyboardZoom(),new ol.interaction.MouseWheelZoom(),new ol.interaction.PinchRotate(),new ol.interaction.PinchZoom(),new ol.interaction.DragZoom(),new ol.interaction.DragPan(),new ol.control.Zoom(),new ol.control.ZoomSlider(),new ol.control.ScaleLine()]}var alayers=[],fundo=(i3GEO.editorOL.fundo).split(","),nfundo=fundo.length,ncontroles=i3GEO.editorOL.controles.length,i,n,temp;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.selecaotudo=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;i3GEO.editorOL.botoes.novaaba=false}for(i=0;i=0;i--){if(fundo[i]!=""&&i3GEO.editorOL[fundo[i]]){alayers.push(i3GEO.editorOL[fundo[i]]);i3GEO.editorOL[fundo[i]].setVisibility(true)}}}i3GEO.editorOL.mapa.addLayers(alayers);if(i3GEO.editorOL.layersIniciais!==""){n=i3GEO.editorOL.layersIniciais.length;for(i=0;i0){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);lonlat=i3GEO.util.projOSM2Geo(lonlat);d=i3GEO.calculo.dd2dms(lonlat.lon,lonlat.lat);try{$i(idcoord[0].id).innerHTML="Long: "+d[0]+" Lat: "+d[1]}catch(e){}}})}},criaJanelaBusca:function(){var layers=i3GEO.editorOL.layersLigados(),nlayers=layers.length,i,ins,combo="---- ";for(i=0;i"+layers[i].getProperties().name+""}combo+=" ";ins=""+$trad("a7")+": "+combo;ins+=" "+$trad("x64")+": ";ins+=" "+$trad("t23")+": ";ins+="
";ins+=" '"+$trad("result")+"': ";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")}},criaComboTemas:function(){var layers=i3GEO.editorOL.layersLigados(),nlayers=layers.length,i,nometema="",combo="";for(i=0;i"+nometema+""}combo+=" ";return combo},atualizaJanelaAtivaTema:function(){var combo=i3GEO.editorOL.criaComboTemas();YAHOO.temaativo.container.panel.setBody(combo)},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
")}else{YAHOO.temaativo.container.panel.setHeader($trad("tativo"))}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(){i3GEO.editorOL.marcaBotao();if(i3GEO.eventos){i3GEO.eventos.adicionaEventos("ATUALIZAARVORECAMADAS",["i3GEO.editorOL.atualizaJanelaAtivaTema()"])}});if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){if(i3GEO.eventos){i3GEO.eventos.adicionaEventos("ATUALIZAARVORECAMADAS",["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(){if(i3GEO.editorOL.layerDefault&&i3GEO.editorOL.layerDefault!=""){return i3GEO.editorOL.layerPorParametro("LAYERS",i3GEO.editorOL.layerDefault)}else{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="---- ";for(i=0;i"+prop[i].name+""}combo+=" ";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="+item+" *"+palavra+"* ";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="";ins+="--- ";for(i=0;i"+valor+""}ins+=" ";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 prop,layer,layers=i3GEO.editorOL.mapa.getLayers(),nlayers=layers.getLength(),ins="",i,icone="",url,f="",fonte="";for(i=0;ilink"}ins+=icone+prop.name+fonte+"
";eval("var f = function(retorno){document.getElementById('legendaL_"+i+"').innerHTML = retorno.responseText;};");url=url.replace("LAYERS","LAYER");var config={method:"GET",url:url,callback:f}}else if(prop.isBaseLayer===false&&prop.visible===true){url=url.replace("LAYERS","LAYER");url+="&FORMAT=image/png";ins+=prop.title+" "}}}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($trad("p3"));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(){YAHOO.legendaeditorOL.container.panel.destroy()})}else{YAHOO.legendaeditorOL.container.panel.setBody(ins);YAHOO.legendaeditorOL.container.panel.show()}},captura:function(x,y,tema,idunico){var d=0.001,layer=i3geoOL.getLayersByName(tema)[0],xy=[x,y],u=layer.getSource().getUrls()[0],poligono,retorno;u+="&REQUEST=getfeature&service=wfs&version=1.0.0";u+="&OUTPUTFORMAT=gml2&typename=undefined";if(i3GEO.Interface.openlayers.googleLike===true){u+="&SRS=EPSG:3857"}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;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=Geometry "+poligono+" ";retorno=function(r){var fs,c,format,f,n,i,idunico;format=new ol.format.WKT();fs=format.readFeatures(r[0]);n=fs.length;c=i3GEO.desenho.layergrafico.getSource();for(i=0;i0){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:"350px",visible:false,draggable:true,close:true});YAHOO.salvaGeometrias.container.panel.setHeader(""+$trad("u6")+" ");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){}}var hash={"n":n,"geosel":$trad("geosel"),"listar":$trad("listar"),"nomeFuncaoSalvarHidden":"hidden","incorpoHidden":"hidden"};if(i3GEO.editorOL.nomeFuncaoSalvar&&i3GEO.editorOL.nomeFuncaoSalvar!=""){hash.nomeFuncaoSalvar=i3GEO.editorOL.nomeFuncaoSalvar;hash.sdados=$trad("sdados");hash.nomeFuncaoSalvarHidden=""}if(typeof i3geoOL!=="undefined"){hash.incorpo=$trad("incorpo");hash.ajudaEditorOlSalva=$trad("ajudaEditorOlSalva");hash.incorpoHidden=""}ins=Mustache.render(i3GEO.editorOL.MUSTACHESALVAGEOMETRIAS,hash);YAHOO.salvaGeometrias.container.panel.setBody(ins)}else{i3GEO.janela.tempoMsg($trad("selum"))}},exportarSHP:function(){i3GEO.editorOL.processageo("converteSHP")},incorporar:function(){i3GEO.editorOL.processageo("incorporar")},listaGeometriasSel:function(){var n=i3GEO.editorOL.idsSelecionados.length,ins="",s=i3GEO.desenho.layergrafico.getSource(),i,w,g;for(i=0;i"+$trad("u6")+": #"+i+" "+i3GEO.editorOL.google2wgs(g.getGeometry().getCoordinates())+" "}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 s=i3GEO.desenho.layergrafico.getSource(),n=i3GEO.editorOL.idsSelecionados.length,funcaoOK=function(){var f=s.getFeatureById(i3GEO.editorOL.idsSelecionados[0]),g=f.getGeometry(),tema=$i("editorOLcomboTemaEditavel").value,redesenha,p,format;g=i3GEO.editorOL.google2wgs(g);format=new ol.format.WKT();f.setGeometry(g);if(tema==""){return}redesenha=function(retorno){i3GEO.janela.fechaAguarde("aguardeSalvaPonto");i3GEO.editorOL.removeFeaturesSel();i3GEO.Interface.atualizaTema("",tema)};i3GEO.janela.AGUARDEMODAL=true;i3GEO.janela.abreAguarde("aguardeSalvaPonto",$trad("adic")+"...");i3GEO.janela.AGUARDEMODAL=false;if(!f.getProperties().idUnico||f.getProperties().idUnico==""){p=i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=adicionaGeometria&g_sid="+i3GEO.configura.sid;cpJSON.call(p,"foo",redesenha,"&tema="+tema+"&wkt="+format.writeFeatures([f]))}else{p=i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=atualizaGeometria&g_sid="+i3GEO.configura.sid;cpJSON.call(p,"foo",redesenha,"&idunico="+f.getProperties().idUnico+"&tema="+tema+"&wkt="+format.writeFeatures([f]))}},funcaoCombo=function(obj){$i("editorOLondeComboTemaEditavel").innerHTML=obj.dados},texto=$trad("stema")+":
"+$trad("salvaDadosEditor")+"
";if(n!=1){i3GEO.janela.tempoMsg($trad("seluma"))}else{i3GEO.janela.confirma(texto,300,$trad("salva"),$trad("canc"),funcaoOK);i3GEO.util.comboTemas("editorOLcomboTemaEditavel",funcaoCombo,"editorOLondeComboTemaEditavel","",false,"editavel")}},marcaBotao:function(classeBotao){var i,n,botoes=$i("i3GEObarraEdicao").getElementsByTagName("div");n=botoes.length;for(i=0;i0){x=window.confirm($trad("excsel")+"?");if(x){i3GEO.editorOL.removeFeaturesSel();i3GEO.desenho.layergrafico.getSource().changed()}}else{i3GEO.janela.tempoMsg($trad("selum"))}};return temp},botaoFrente:function(){var temp=document.createElement("div");temp.className="editorOLfrenteItemInactive olButton";temp.title=$trad("frente");temp.onclick=function(){var nsel=i3GEO.editorOL.idsSelecionados.length;if(nsel>0){i3GEO.editorOL.marcaBotao();i3GEO.editorOL.trazParaFrente()}else{i3GEO.janela.tempoMsg($trad("selum"))}};return temp},botaoEdita:function(){i3GEO.eventos.cliquePerm.desativa();var temp=document.createElement("div");temp.className="editorOLeditaItemInactive olButton";temp.title=$trad("dpol");temp.onclick=function(){i3GEO.editorOL.featuresBackup=[];var draw,nsel,f,c;nsel=i3GEO.editorOL.idsSelecionados.length;if(nsel>0){i3GEO.editorOL.marcaBotao("editorOLedita");f=i3GEO.desenho.layergrafico.getSource().getFeatureById(i3GEO.editorOL.idsSelecionados[nsel-1]);i3GEO.editorOL.featuresBackup.push(f.clone());c=new ol.Collection();c.push(f);draw=new ol.interaction.Modify({features:c});i3GEO.editorOL.interacoes.push(draw);i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false);i3geoOL.addInteraction(draw)}else{i3GEO.janela.tempoMsg($trad("selum"))}};return temp},botaoCorta:function(){i3GEO.eventos.cliquePerm.desativa();var temp=document.createElement("div");temp.className="editorOLcortaItemInactive olButton";temp.title=$trad("cortaf");temp.onclick=function(){var nsel=i3GEO.editorOL.idsSelecionados.length;if(nsel!=1){alert("Selecione primeiro um elemento para ser cortado")}else{i3GEO.janela.tempoMsg("Desenhe um polígono");i3GEO.editorOL.marcaBotao("editorOLcorta");var draw=new ol.interaction.Draw({type:"Polygon"});i3GEO.editorOL.interacoes.push(draw);i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false);draw.on("drawend",function(evt){var temp,f,c,format,fwkt,cwkt;f=evt.feature;c=i3GEO.desenho.layergrafico.getSource().getFeatureById(i3GEO.editorOL.idsSelecionados[nsel-1]);i3GEO.editorOL.featuresBackup.push(c.clone());i3GEO.editorOL.marcaBotao();format=new ol.format.WKT();if(f&&c){fwkt=format.writeFeatures([f]);cwkt=format.writeFeatures([c]);if(fwkt&&cwkt){temp=function(retorno){i3GEO.janela.fechaAguarde("i3GEO.cortador");if(retorno!=""&&retorno.data&&retorno.data!=""){i3GEO.janela.fechaAguarde("i3GEO.cortador");c.setGeometry(format.readGeometry(retorno.data));if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}}};i3GEO.janela.abreAguarde("i3GEO.cortador","Cortando");i3GEO.php.funcoesGeometriasWkt(temp,cwkt+"|"+fwkt,"difference")}}});i3geoOL.addInteraction(draw)}};return temp},botaoListaGeometrias:function(){var temp=document.createElement("div");temp.className="editorOLlistagItemInactive olButton";temp.title=$trad("listag");temp.onclick=function(){i3GEO.editorOL.listaGeometrias()};return temp},botaoNovaaba:function(){var temp=document.createElement("div");temp.className="editorOLnovaabaItemInactive olButton";temp.title=$trad("novaaba");temp.onclick=function(){window.open(window.location,'_blank')};return temp},botaoAjuda:function(){var temp=document.createElement("div");temp.className="editorOLajudaItemInactive olButton";temp.title=$trad("s1");temp.onclick=function(){if(i3GEO.configura&&i3GEO.configura.locaplic){i3GEO.janela.cria("400px","200px",i3GEO.configura.locaplic+"/mashups/openlayers_ajuda.php?completo=none","","",$trad("s1"),"editorOlAjuda")}else{window.open("openlayers_ajuda.php")}};return temp},botaoFecha:function(){var temp=document.createElement("div");temp.className="editorOLfechaItemInactive olButton";temp.title=$trad("x74");temp.onclick=function(){i3GEO.editorOL.unselTodos();i3GEO.editorOL.featuresBackup=[];i3GEO.editorOL.marcaBotao();i3GEO.eventos.cliquePerm.ativa();$i("i3GEObarraEdicao").style.display="none"};return temp},botaoTools:function(){var temp=document.createElement("div");temp.className="editorOLtoolsItemInactive olButton";temp.title=$trad("u15a");temp.onclick=function(){if(i3GEO.php){i3GEO.editorOL.ferramentas()}else{i3GEO.editorOL.carregajts("i3GEO.editorOL.ferramentas()")}};return temp},botaoPropriedades:function(){var temp=document.createElement("div");temp.className="editorOLpropriedadesItemInactive olButton";temp.title=$trad("p13");temp.onclick=function(){i3GEO.editorOL.propriedades()};return temp},botaoImprimir:function(){var temp=document.createElement("div");temp.className="editorOLimprimirItemInactive olButton";temp.onclick=function(){window.print()};return temp},botaoGrid:function(){var temp=document.createElement("div");temp.className="editorOLgridItemInactive olButton";temp.onclick=function(){var p={"map":i3GEO.editorOL.mapa,"targetSize":200};if(!i3GEO.editorOL.grid){i3GEO.editorOL.grid=new ol.Graticule(p)}else{if(i3GEO.editorOL.grid.getMap()==null){i3GEO.editorOL.grid.setMap(i3GEO.editorOL.mapa)}else{i3GEO.editorOL.grid.setMap(null)}}};return temp},botaoIdentifica:function(){i3GEO.eventos.cliquePerm.desativa();var temp=document.createElement("div");temp.className="editorOLidentificaItemInactive olButton";temp.title=$trad("d7t");temp.onclick=function(){if(i3GEO.editorOL.layerDefault==""){i3GEO.editorOL.criaJanelaAtivaTema()}i3GEO.eventos.cliquePerm.desativa();i3GEO.editorOL.marcaBotao("editorOLidentifica");var draw=new ol.interaction.Draw({type:"Point"});i3GEO.editorOL.interacoes.push(draw);i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false);draw.on("drawend",function(evt){var xy,p,retorno,url,layer,tema=$i("i3GEOOLlistaTemasAtivos");if(tema){layer=i3geoOL.getLayersByName(tema.value)[0];if(layer.getSource().getUrls){url=layer.getSource().getUrls()[0]}else{url=layer.getSource().getUrl()}xy=evt.feature.getGeometry().getFirstCoordinate();retorno=function(r){var valorunico="",camada=null,texto="",lonlattexto,xy,temp,temp1,n,i,f=[],textoN=r.split(":");if(i3GEO.arvoreDeCamadas){camada=i3GEO.arvoreDeCamadas.pegaTema(tema.value,"","name")}xy=evt.feature.getGeometry().getFirstCoordinate();i3GEO.eventos.cliquePerm.ativo=true;try{if(textoN.length>1){textoN.shift();textoN.shift();temp=textoN.join(":");temp=temp.replace(/'/g,"");temp=temp.replace(/\n/g,"|");temp=temp.replace(/_/g," ");temp=temp.split("|");n=temp.length;for(i=0;i"+f.join(" ")+""}}catch(e){}lonlattexto="edita geometria ";i3GEO.Interface.openlayers.balao(""+lonlattexto+texto+"
","",xy[0],xy[1],false,false);i3GEO.eventos.cliquePerm.ativo=false};p=i3GEO.configura.locaplic+"/classesphp/proxy.php?"+url+"&tipoRetornoProxy=string&REQUEST=GetFeatureInfo&TIPOIMAGEM=nenhum&DESLIGACACHE=sim&STYLES=&SERVICE=WMS&VERSION=1.1.1&FEATURE_COUNT=1"+"&FORMAT=image/png&INFO_FORMAT=text/plain&SRS=EPSG:4326"+"&LAYERS="+tema.value+"&layer="+tema.value+"&QUERY_LAYERS="+tema.value+"&HEIGHT="+i3geoOL.getSize()[1]+"&WIDTH="+i3geoOL.getSize()[0]+"&BBOX="+i3geoOL.getExtent().toBBOX().split(",").join(" ")+"&X="+xy[0]+"&Y="+xy[1];cpJSON.call(p,"foo",retorno,"")}});i3geoOL.addInteraction(draw)};return temp},botaoSalva:function(){var temp=document.createElement("div");temp.className="editorOLsalvaItemInactive olButton";temp.title=$trad("salva");temp.onclick=function(){i3GEO.editorOL.salvaGeometrias()};return temp},criaBotoes:function(botoes){if($i("i3GEObarraEdicao")){$i("i3GEObarraEdicao").style.display="block";return}i3GEOpanelEditor=document.createElement("div");i3GEOpanelEditor.id="i3GEObarraEdicao";i3GEOpanelEditor.className="olControlEditingToolbar1 noprint";if(botoes.imprimir===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoImprimir())}if(botoes.grid===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoGrid())}if(botoes.novaaba===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoNovaaba())}if(botoes.procura===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoProcura())}if(botoes.pan===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoPan())}if(botoes.zoombox===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoZoomBox())}if(botoes.zoomtot===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoZoomTot())}if(botoes.zoomin===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoZoomIn())}if(botoes.zoomout===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoZoomOut())}if(botoes.legenda===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoLegenda())}if(botoes.distancia===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoDistancia())}if(botoes.area===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoArea())}if(botoes.identifica===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoIdentifica())}if(botoes.linha===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoLinha())}if(botoes.ponto===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoPonto())}if(botoes.poligono===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoPoligono())}if(botoes.texto===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoTexto())}if(botoes.edita===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoEdita())}if(botoes.selecao===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoSelecao())}if(botoes.selecaotudo===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoSelecaoTudo())}if(botoes.apaga===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoApaga())}if(botoes.frente===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoFrente())}if(botoes.edita===true&&botoes.corta===true&&i3GEO.php){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoCorta())}if(botoes.edita===true&&botoes.listag===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoListaGeometrias())}if(botoes.tools===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoTools())}if(botoes.propriedades===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoPropriedades())}if(botoes.salva===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoSalva())}if(botoes.ajuda===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoAjuda())}if(botoes.fecha===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoFecha())}i3GEOpanelEditor.style.width=i3GEOpanelEditor.getElementsByTagName("div").length*33+"px";i3GEO.editorOL.mapa.getViewport().getElementsByClassName("ol-overlaycontainer-stopevent")[0].appendChild(i3GEOpanelEditor)},removeFeaturesSel:function(){var s,i,nsel,f;nsel=i3GEO.editorOL.idsSelecionados.length;s=i3GEO.desenho.layergrafico.getSource();for(i=0;iPropriedades")}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(){});i3GEO.util.aplicaAquarela("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",{iframe:true,width:"380px",height:"300px",visible:false,draggable:true,close:true});if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){YAHOO.editorOL.listaGeometrias.panel.setHeader(""+$trad("u6")+" ")}else{YAHOO.editorOL.listaGeometrias.panel.setHeader($trad("u6"))}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()})}else{YAHOO.editorOL.listaGeometrias.panel.render(document.body)}var id,temp,geos=i3GEO.desenho.layergrafico.getSource().getFeatures(),n=geos.length,ins="";ins+='';while(n>0){n-=1;id=geos[n].getId();if(id){ins+='
"}}ins+="
";if(geos.length===0){ins=''+$trad("meneditor2")+"
"}YAHOO.editorOL.listaGeometrias.panel.setBody(ins);YAHOO.editorOL.listaGeometrias.panel.show()},ferramentas:function(){if(i3GEO.editorOL.MUSTACHEFERRAMENTAS==""){$.get(i3GEO.configura.locaplic+"/ferramentas/editorol/templateFerramentas_mst.html",function(template){i3GEO.editorOL.MUSTACHEFERRAMENTAS=template;i3GEO.editorOL.ferramentas()});return}var b,ins;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 hash={"opsel":$trad("opsel"),"p14":$trad("p14"),"hidden":"hidden"};if(i3GEO.php){hash.hidden=""}ins=Mustache.render(i3GEO.editorOL.MUSTACHEFERRAMENTAS,hash);YAHOO.editorOL.ferramentas.panel.setBody(ins);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(){})}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;i0){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==="incorporar"){polis=i3GEO.editorOL.retornaFeaturesTipo("Polygon");linhas=i3GEO.editorOL.retornaFeaturesTipo("LineString");pontos=i3GEO.editorOL.retornaFeaturesTipo("Point");if(polis.length>0){temp=i3GEO.editorOL.merge(polis)}if(linhas.length>0){temp=i3GEO.editorOL.merge(linhas)}if(pontos.length>0){temp=i3GEO.editorOL.desagrupa(pontos)}if(i3GEO.mapa){i3GEO.mapa.dialogo.wkt2layer(temp)}return}if(operacao==="union"&&!i3GEO.php){polis=i3GEO.editorOL.retornaFeaturesTipo("Polygon");linhas=i3GEO.editorOL.retornaFeaturesTipo("LineString");pontos=i3GEO.editorOL.retornaFeaturesTipo("Point");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(pontos);i3GEO.editorOL.substituiFeaturesSel(temp)}}else{polis=i3GEO.editorOL.retornaGeometriasTipo("Polygon");linhas=i3GEO.editorOL.retornaGeometriasTipo("LineString");pontos=i3GEO.editorOL.retornaGeometriasTipo("Point");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)}}i3GEO.desenho.layergrafico.getSource().changed();return}else{i3GEO.janela.tempoMsg("Selecione pelo menos dois elementos")}},desagrupa:function(geoms){var n=geoms.length,w=[],g,m,i,format=new ol.format.WKT();for(i=0;i1){for(i=1;i1){uniao=fwkt.writeFeatures([geoms[0]]);uniao=rwkt.read(uniao);for(i=1;i<=n;i++){g=fwkt.writeFeatures([geoms[i]]);uniao=uniao.union(rwkt.read(g))}uniao=wwkt.write(uniao);return[fwkt.readFeatures(uniao)]}else{return false}},retornaGeometriasTipo:function(tipo){var n=i3GEO.editorOL.idsSelecionados.length,lista=[],i,s=i3GEO.desenho.layergrafico.getSource(),fwkt=new ol.format.WKT();for(i=0;i0){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(f){i3GEO.editorOL.removeFeaturesSel();var fwkt=new ol.format.WKT();f=fwkt.readFeatures(f)[0];f.setStyle(new ol.style.Style({stroke:new ol.style.Stroke({color:'rgba('+i3GEO.editorOL.simbologia.strokeColor+','+i3GEO.editorOL.simbologia.opacidade+')',width:i3GEO.editorOL.simbologia.strokeWidth}),fill:new ol.style.Fill({color:'rgba('+i3GEO.editorOL.simbologia.fillColor+','+i3GEO.editorOL.simbologia.opacidade+')'})}));f.setId(i3GEO.util.uid());i3GEO.desenho.layergrafico.getSource().addFeature(f)},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(id){var s,f;s=i3GEO.desenho.layergrafico.getSource();f=s.getFeatureById(id);if(!i3GEO.util.in_array(id,i3GEO.editorOL.idsSelecionados)){i3GEO.editorOL.idsSelecionados.push(id);f.setProperties({fillColor:f.getStyle().getFill().getColor(),strokeColor:f.getStyle().getStroke().getColor(),externalGraphic:""});f.getStyle().getFill().setColor('rgba(255, 255, 255, 0.5)');f.getStyle().getStroke().setColor('blue');s.changed()}},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 s,i,nsel,id,clone;s=i3GEO.desenho.layergrafico.getSource();nsel=i3GEO.editorOL.idsSelecionados.length;for(i=0;i