//seta as variáveis navn e navm 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.Untiled( "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'} ), 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, maxext: "", mapext: new OpenLayers.Bounds(-76.5125927,-39.3925675209,-29.5851853,9.49014852081), mapa: "", inicia: function(){ //ativabotoes e boolean 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.editorOL.layergrafico || i3GEO.editorOL.layergrafico != undefined){ i3GEO.editorOL.criaLayerGrafico(); } } else{ i3GEO.editorOL.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=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 0){ i3GEO.editorOL.mapa.removeLayer(i3GEO.editorOL.mapa.getLayersByName(camada.name)[0],false); } }, coordenadas: function(){ // //substitui o controle que mostra as coordenadas // 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;} //altera o indicador de localizacao lonlat = i3GEO.editorOL.mapa.getLonLatFromPixel(p); d = i3GEO.calculo.dd2dms(lonlat.lon,lonlat.lat); try{ $i(idcoord[0].id).innerHTML = "Long: "+d[0]+"
Lat: "+d[1]; } catch(e){ if(typeof(console) !== 'undefined'){console.error(e);} } }); } }, criaJanelaBusca: function(){ var layers = i3GEO.editorOL.layersLigados(), nlayers = layers.length, i, ins, combo = ""; ins = "
Tema:
"+combo; ins += "
Item:
"; ins += "
Procurar por:
"; ins += "

"; ins += "
Resultado:
"; 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 = ""; 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(typeof i3GEO != undefined && i3GEO != "") {YAHOO.temaativo.container.panel.setHeader("Tema ativo
");} 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(typeof i3GEO != undefined && i3GEO != ""){ if(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 = ""; 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="+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 = ""; 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

"; //necessario pq nao e sincrono 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+"

"; } } } catch(e){} } //var w = window.open(); //w.document.write(ins); //w.document.close(); 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(){ //i3GEOpanelEditor.deactivate(); //i3GEOpanelEditor.activate(); }); } else{ YAHOO.legendaeditorOL.container.panel.setBody(ins); YAHOO.legendaeditorOL.container.panel.show(); } }, captura: function(lonlat){ //if(i3GEO.editorOL.layergrafico !== ""){return;} 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; //remove parametros nao desejados u = u.replace("&cache=sim","&DESLIGACACHE=sim"); u = u.replace("&Z=${z}&X=${x}&Y=${y}",""); //u += "&filter=Geometry"+lonlat+""; 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=Geometry"+poligono+""; 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 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 += "

Foram encontrada(s) "+n+" geometria(s) selecionada(s)

"; ins += "

Listar  "; ins += "Salvar  "; ins += "Exportar (shapefile)

"; YAHOO.salvaGeometrias.container.panel.setBody(ins); } else {alert("Selecione pelo menos um elemento");} }, exportarSHP: function(){ i3GEO.editorOL.processageo("converteSHP"); }, listaGeometriasSel: function(){ var geos = i3GEO.editorOL.layergrafico.selectedFeatures, n = geos.length, ins = "",i,a,w,g; for(i=0;i
"+i3GEO.editorOL.google2wgs(g.geometry)+"

"; ins += "Atributos: "+i+"
"; a = g.attributes; for(key in a){ if(a[key]){ ins += key+" = "+a[key]+"
"; } } //lista os registros se for fruto de uma captura if(g.attributes.registros){ ins += "Registros: "+i+"
"; a = g.attributes.registros; for(key in a){ if(a[key]){ ins += key+" = "+a[key]+"
"; } } } } 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(){ //i3GEO.editorOL.testeSalvar(); //return; var geos = i3GEO.editorOL.layergrafico.selectedFeatures, n = geos.length, funcaoOK = function(){ //verifica se a geometria contem o atributo que indica a coluna ou codigo unico 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"); //o tema contem o indicador de qual e a coluna que contem o identificador unico 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.editorOL.layergrafico.removeFeatures(i3GEO.editorOL.layergrafico.selectedFeatures); i3GEO.Interface.atualizaTema("",nometema); }; i3GEO.janela.AGUARDEMODAL = true; i3GEO.janela.abreAguarde("aguardeSalvaPonto","Adicionando..."); i3GEO.janela.AGUARDEMODAL = false; //cria um novo registro 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{ //atualiza a geometria 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:


"; 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}), 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', //'application/vnd.ogc.gml', 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 = "
", formata; if( botoes.linha === true || botoes.ponto === true || botoes.poligono === true || botoes.edita === true){ lonlattexto += "
edita geometria

"; } 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
"); } } catch(e){} return texto; }; i3GEO.editorOL.mapa.addPopup(new OpenLayers.Popup.FramedCloud( "chicken", i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy), null, "
"+lonlattexto+"
"+formata(event.text)+"
", null, true )); i3GEO.editorOL.removeClone(); }, beforegetfeatureinfo: function(event){ var ativo = [i3GEO.editorOL.layerAtivo()]; //se for TMS tem de pegar o clone wms if(ativo[0].CLASS_NAME == "OpenLayers.Layer.TMS" || ativo[0].CLASS_NAME == "OpenLayers.Layer.OSM"){ ativo = [i3GEO.editorOL.layertms2wms(ativo[0])]; } event.object.layers = ativo; botaoIdentifica.layers = ativo; botaoIdentifica.url = ativo[0].url; }, activate: function(){ i3GEO.editorOL.criaJanelaAtivaTema(); } } }); //button.events.register("getfeatureinfo", this, showInfo); controles.push(botaoIdentifica); adiciona = true; } if(botoes.linha===true){ button = new OpenLayers.Control.DrawFeature( i3GEO.editorOL.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.editorOL.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.editorOL.layergrafico, OpenLayers.Handler.Point, { displayClass: "editorOLponto", title: "digitalizar ponto", type: OpenLayers.Control.TYPE_TOOL, callbacks:{ done: function(feature){ var f = []; if(i3GEO.editorOL.simbologia.externalGraphic != ""){ var 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.editorOL.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.editorOL.layergrafico, OpenLayers.Handler.Polygon, { displayClass: "editorOLpoligono", title: "digitalizar poligono", type: OpenLayers.Control.TYPE_TOOL, //handlerOptions: {holeModifier: "altKey"}, 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.editorOL.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.editorOL.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.editorOL.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.editorOL.layergrafico, OpenLayers.Handler.Polygon, { displayClass: "editorOLcorta", title: "corta figura", type: OpenLayers.Control.TYPE_TOOL, clickout: true, toggle: true, trigger: function(){ if(i3GEO.editorOL.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.editorOL.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.editorOL.layergrafico, { displayClass: "editorOLedita", title: "modifica figura", type: OpenLayers.Control.TYPE_TOOL, clickout: true, toggle: true, mode: OpenLayers.Control.ModifyFeature.RESHAPE } ); 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(){ //fora do i3geo, usa o jsts 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; } //botao de seleção if(botoes.selecao===true){ i3GEO.editorOL.selbutton = new OpenLayers.Control.SelectFeature( i3GEO.editorOL.layergrafico, { displayClass: "editorOLselecao", title: "seleciona elemento", type: OpenLayers.Control.TYPE_TOOL, clickout: true, toggle: true, multiple: false, hover: false, toggleKey: "ctrlKey", // ctrl key removes from selection multipleKey: "shiftKey", // shift key adds to selection box: false } ); controles.push(i3GEO.editorOL.selbutton); adiciona = true; } if(botoes.apaga===true){ button = new OpenLayers.Control.Button({ displayClass: "editorOLapaga", trigger: function(){ if(i3GEO.editorOL.layergrafico.selectedFeatures.length > 0){ var x = window.confirm("Exclui os elementos selecionados?"); if(x){ i3GEO.editorOL.guardaBackup(); i3GEO.editorOL.layergrafico.removeFeatures(i3GEO.editorOL.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; } //não disponível ainda /* if(botoes.undo===true){ button = new OpenLayers.Control.Button({ displayClass: "editorOLundo", trigger: function(){i3GEO.editorOL.restauraBackup();}, title: "recupera" }); 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.panelpropriedadesEditor.panel.destroy();}catch(e){} //try{YAHOO.editorOL.panellistagEditor.panel.destroy();}catch(e){} try{YAHOO.editorOL.ferramentas.panel.destroy();}catch(e){} //try{YAHOO.panelprocura.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.editorOL.layergrafico){ i3GEO.editorOL.mapa.removeLayer(i3GEO.editorOL.layergrafico); delete(i3GEO.editorOL.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; } // //controle que permite o snap // i3GEOOLsnap = new OpenLayers.Control.Snapping({ layer: i3GEO.editorOL.layergrafico }); i3GEOOLsplit = new OpenLayers.Control.Split({ layer: i3GEO.editorOL.layergrafico, source: i3GEO.editorOL.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();} } } }); // //adiciona o painel ao mapa se alguma opcao foi inserida // if(adiciona === true){ i3GEOpanelEditor.addControls(controles); i3GEO.editorOL.mapa.addControl(i3GEOpanelEditor); } }, mudaSimbolo: function(estilo,id){ var valor = $i(id).value, geos = i3GEO.editorOL.layergrafico.selectedFeatures, n = geos.length, i; i3GEO.editorOL.simbologia[estilo] = valor; for(i=0;iEstilos (utilize a cor no formato r,g,b):

' + '' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + '
Cor do contorno'; if(i3GEO.configura) {ins += 'aquarela.gif';} ins += "" + '
Cor do preenchimento'; if(i3GEO.configura) {ins += 'aquarela.gif';} ins += "" + '
Cor da fonte'; if(i3GEO.configura) {ins += 'aquarela.gif';} ins += "" + '
Tamanho da fonte
Opacidade (de 0 a 1)
Largura da linha/contorno
Url de uma figura
Largura e altura 
' + '
' + '

Ajusta n� em edição para o(a):

' + '' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + '
n�vérticeborda
' + '
' + '

Divide intersecção ao digitalizar

' + '' + ' ' + ' ' + ' ' + '
borda
' + '
' + '

Operação ativada pelo botão de modificação da figura

' + '' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + '
altera figuraaltera tamanho
rotacionadesloca
'; YAHOO.editorOL.container.panel.setBody(ins); if(typeof i3GEO != undefined && i3GEO != "") {YAHOO.editorOL.container.panel.setHeader("Propriedades
");} 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(typeof i3GEO != undefined && i3GEO != "") {YAHOO.editorOL.listaGeometrias.panel.setHeader("Geometrias
");} 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.editorOL.layergrafico.features, n = geos.length, ins = ""; ins += ""; while(n > 0){ n -= 1; g = geos[n].geometry; ins += ""; } ins += "
GeometriasOpções
"+g.CLASS_NAME+"selecionalimpabrilha
"; 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 = "" + '

Operações sobre as figuras selecionadas:

' + ''+ '

Apaga tudo'; YAHOO.editorOL.ferramentas.panel.setBody(ins); if(typeof i3GEO != undefined && i3GEO != "") {YAHOO.editorOL.ferramentas.panel.setHeader("Ferramentas
");} 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 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 0){ i3GEO.editorOL.layergrafico.removeFeatures(i3GEO.editorOL.layergrafico.features); i3GEO.editorOL.layergrafico.addFeatures(i3GEO.editorOL.backup.features); } if(document.getElementById("panellistagEditor")) {i3GEO.editorOL.listaGeometrias();} //i3GEO.editorOL.backup.removeFeatures(i3GEO.editorOL.backup.features); }, substituiFeaturesSel: function(wkt){ i3GEO.editorOL.guardaBackup(); try{ var f,fwkt = new OpenLayers.Format.WKT(); i3GEO.editorOL.layergrafico.removeFeatures(i3GEO.editorOL.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.editorOL.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.editorOL.layergrafico.addFeatures([f]); if(document.getElementById("panellistagEditor")) {i3GEO.editorOL.listaGeometrias();} }, flashFeaturesI: function(index){ i3GEO.editorOL.flashFeatures([i3GEO.editorOL.layergrafico.features[index]],0); }, flashFeatures: function(features, index) { if(!index) { index = 0; } var current = features[index]; if(current && current.layer === i3GEO.editorOL.layergrafico) { i3GEO.editorOL.layergrafico.drawFeature(features[index], "select"); } var prev = features[index-1]; if(prev && prev.layer === i3GEO.editorOL.layergrafico) { i3GEO.editorOL.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.editorOL.layergrafico.features[index]); }, unselFeature: function(index) { i3GEO.editorOL.selbutton.unselect(i3GEO.editorOL.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.editorOL.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.editorOL.layergrafico.removeFeatures(features); i3GEO.editorOL.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