From d12d595be532b0430fa6cbc2a6ac22870c5c4302 Mon Sep 17 00:00:00 2001 From: Edmar Moretti Date: Thu, 12 Dec 2013 16:23:09 +0000 Subject: [PATCH] ALterações nas opções de edição vetorial --- admin/js/editormapfile.js | 2 +- admin/php/classe_metaestat.php | 2 +- classesphp/classe_mapa.php | 5 ++++- classesphp/mapa_openlayers.php | 40 +++++++++++++++++++++++++++------------- ferramentas/editortema/exec.php | 37 +++++++++++++++++++++++++++++++++++++ mashups/openlayers.js | 151 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------- mashups/openlayers.php | 1 - mashups/openlayers_compacto.js | 142 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------- mashups/openlayers_compacto.js.php | 142 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------- temas/_llocali.map | 167 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------- 10 files changed, 492 insertions(+), 197 deletions(-) diff --git a/admin/js/editormapfile.js b/admin/js/editormapfile.js index 82e1a6f..00c9480 100644 --- a/admin/js/editormapfile.js +++ b/admin/js/editormapfile.js @@ -1327,7 +1327,7 @@ function montaEditorComport(dados) { var param = { "linhas":[ - {ajuda:"Sets the current status of the layer. Often modified by MapServer itself. Default turns the layer on permanently", + {ajuda:"Define o estado atual da camada. Geralmente modificado pelo próprio MapServer. Default ativa a camada permanentemente.", titulo:"Status",id:"",value:dados.status,tipo:"text",div:"
"}, {ajuda:"Indica se o tema irá ser mostrado na ferramenta de identificação", titulo:"Identifica (IDENTIFICA)",id:"",value:dados.identifica,tipo:"text",div:"
"}, diff --git a/admin/php/classe_metaestat.php b/admin/php/classe_metaestat.php index 29ec78c..4f49c74 100755 --- a/admin/php/classe_metaestat.php +++ b/admin/php/classe_metaestat.php @@ -94,7 +94,7 @@ class Metaestat{ * @return string */ function nomeCache(){ - return md5(implode("x",$_REQUEST)); + return "AAAA".md5(implode("x",$_REQUEST)); } /** * Cria um nome aleatorio diff --git a/classesphp/classe_mapa.php b/classesphp/classe_mapa.php index c9afcb3..06fdbdd 100644 --- a/classesphp/classe_mapa.php +++ b/classesphp/classe_mapa.php @@ -397,7 +397,10 @@ class Mapa "permiteogc"=>($oLayer->getmetadata("permiteogc")), "itembuscarapida"=>($oLayer->getmetadata("itembuscarapida")), "usasld"=>$usasld, - "cache"=>$cache + "cache"=>$cache, + "editavel"=>($oLayer->getmetadata("EDITAVEL")), + "editavel"=>($oLayer->getmetadata("EDITAVEL")), + "colunaidunico"=>($oLayer->getmetadata("COLUNAIDUNICO")) ); } } diff --git a/classesphp/mapa_openlayers.php b/classesphp/mapa_openlayers.php index 079ea62..b5d56c3 100644 --- a/classesphp/mapa_openlayers.php +++ b/classesphp/mapa_openlayers.php @@ -87,12 +87,19 @@ if(isset($_GET["tms"])){ $_GET["BBOX"] = $lon1." ".$lat1." ".$lon2." ".$lat2; } $map_fileX = $_SESSION["map_file"]; +// +//verifica se o request e OGC +if(!empty($_GET["request"])){ + $_GET["REQUEST"] = $_GET["request"]; +} // //resolve o problema da seleção na versão nova do mapserver // $qyfile = dirname($map_fileX)."/".$_GET["layer"].".php"; $qy = file_exists($qyfile); - +if($_GET["REQUEST"] == "GetFeatureInfo" || strtolower($_GET["REQUEST"]) == "getfeature"){ + $_GET["DESLIGACACHE"] = "sim"; +} if($qy == false && $_GET["cache"] == "sim" && $_GET["DESLIGACACHE"] != "sim"){ carregaCacheImagem($_SESSION["cachedir"],$_SESSION["map_file"],$_GET["tms"],$_SESSION["i3georendermode"]); } @@ -151,17 +158,22 @@ if(!isset($_GET["telaR"])){//no caso de projecoes remotas, o mapfile nao e alter $nomecache = $layerName; } } - } - if($_GET["REQUEST"] == "GetFeatureInfo" || $_GET["REQUEST"] == "getfeature"){ - $l->setmetadata("gml_include_items","all"); - $l->setmetadata("WMS_INCLUDE_ITEMS","all"); - $l->setmetadata("WFS_INCLUDE_ITEMS","all"); - $l->setmetadata("ows_enable_request","*"); - $l->set("dump",MS_TRUE); - $l->setmetadata("ows_srs","AUTO"); + if($_GET["REQUEST"] == "GetFeatureInfo" || strtolower($_GET["REQUEST"]) == "getfeature" ){ + $l->setmetadata("gml_include_items","all"); + $l->set("template","none.htm"); + $l->setmetadata("WMS_INCLUDE_ITEMS","all"); + $l->setmetadata("WFS_INCLUDE_ITEMS","all"); + $l->setmetadata("ows_enable_request","*"); + $l->set("dump",MS_TRUE); + $l->setmetadata("ows_srs","AUTO"); + if(strtolower($_GET["REQUEST"]) == "getfeature"){ + $_GET["TYPENAME"] = $l->name; + } + } } } } + if (!function_exists('imagepng')) {$_GET["TIPOIMAGEM"] = "";} @@ -175,19 +187,21 @@ elseif($_GET["TIPOIMAGEM"] != "" && $_GET["TIPOIMAGEM"] != "nenhum") {$cache = false;} if($cache == true && $_GET["cache"] != "nao"){ - //carregaCacheImagem($cachedir,$_GET["BBOX"],$nomecache,$map_fileX,$_GET["WIDTH"],$_GET["HEIGHT"]); carregaCacheImagem($cachedir,$map,$_GET["tms"]); } -$map_size = explode(" ",$_GET["map_size"]); -$mapa->setsize($map_size[0],$map_size[1]); +if(isset($_GET["map_size"])){ + $map_size = explode(" ",$_GET["map_size"]); + $mapa->setsize($map_size[0],$map_size[1]); +} if(isset($_GET["mapext"])){ $mapext = explode(" ",$_GET["mapext"]); $mapa->setExtent($mapext[0],$mapext[1],$mapext[2],$mapext[3]); } + // //qd a cahamda e para um WMS, redireciona para ogc.php // -if($_GET["REQUEST"] == "GetFeatureInfo" || $_GET["request"] == "getfeature"){ +if($_GET["REQUEST"] == "GetFeatureInfo" || $_GET["REQUEST"] == "getfeature"){ $req = ms_newowsrequestobj(); $_GET = array_merge($_GET,$_POST); foreach ($_GET as $k=>$v){ diff --git a/ferramentas/editortema/exec.php b/ferramentas/editortema/exec.php index 5c0f6dc..009978b 100755 --- a/ferramentas/editortema/exec.php +++ b/ferramentas/editortema/exec.php @@ -29,6 +29,7 @@ include_once(dirname(__FILE__)."/../inicia.php"); include_once(dirname(__FILE__)."/../../admin/php/login.php"); $funcoesEdicao = array( "ADICIONAGEOMETRIA", + "ATUALIZAGEOMETRIA", "EXCLUIREGISTRO", "SALVAREGISTRO" ); @@ -80,6 +81,42 @@ switch (strtoupper($funcao)) } } break; + case "ATUALIZAGEOMETRIA": + $mapa = ms_newMapObj($map_file); + $layer = $mapa->getlayerbyname($tema); + if(strtolower($layer->getmetadata("EDITAVEL")) != "sim"){ + $retorno = "erro"; + } + else{ + $tabela = $layer->getmetadata("TABELAEDITAVEL"); + $esquema = $layer->getmetadata("ESQUEMATABELAEDITAVEL"); + $colunaidunico = $layer->getmetadata("COLUNAIDUNICO"); + $colunageometria = $layer->getmetadata("COLUNAGEOMETRIA"); + if($colunageometria == ""){ + $retorno = "erro"; + } + $c = stringCon2Array($layer->connection); + try { + $dbh = new PDO('pgsql:dbname='.$c["dbname"].';user='.$c["user"].';password='.$c["password"].';host='.$c["host"].';port='.$c["port"]); + //pega o SRID + $sql = "select ST_SRID($colunageometria) as srid from $esquema"."."."$tabela LIMIT 1"; + //echo $sql;exit; + $q = $dbh->query($sql,PDO::FETCH_ASSOC); + $r = $q->fetchAll(); + $srid = $r[0]["srid"]; + + $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + $dbh->beginTransaction(); + $sql = "UPDATE ".$esquema.".".$tabela." SET ".$colunageometria." = (ST_GeomFromText('SRID=$srid;".$wkt."')) WHERE $colunaidunico = ".$idunico; + $sth = $dbh->exec($sql); + $dbh->commit(); + $retorno = "ok"; + } catch (Exception $e) { + $dbh->rollBack(); + $retorno = array("Falhou: " . $e->getMessage()); + } + } + break; case "EXCLUIREGISTRO": $mapa = ms_newMapObj($map_file); $layer = $mapa->getlayerbyname($tema); diff --git a/mashups/openlayers.js b/mashups/openlayers.js index 28dc42a..1b02b1c 100755 --- a/mashups/openlayers.js +++ b/mashups/openlayers.js @@ -289,16 +289,46 @@ i3GEO.editorOL = { } return ins; }, + //layers clonados sao copias WMS de layers TMS necessarios para realizar o getfeature + //sao criados quando o layer e adicionado layersClonados: function(paramsLayers){ var layers = i3GEO.editorOL.mapa.layers, nlayers = layers.length,i; 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 @@ -366,11 +396,19 @@ i3GEO.editorOL = { criaComboTemas: function(){ var layers = i3GEO.editorOL.layersLigados(), nlayers = layers.length, - i, - combo = ""; //i3GEO.editorOL.layergrafico.setLayerIndex(i3GEO.editorOL.getNumLayers() + 1); for(i=0;i"+layers[i].name+""; + //pega o nome do tema + nometema = ""; + if(i3GEO.arvoreDeCamadas && i3GEO.arvoreDeCamadas.CAMADAS){ + temp = i3GEO.arvoreDeCamadas.pegaTema(layers[i].name,"","name"); + if(temp != ""){ + nometema = temp.tema+" - "; + } + } + combo += ""; } combo += ""; return combo; @@ -416,6 +454,7 @@ i3GEO.editorOL = { } else{ YAHOO.temaativo.container.panel.show(); + i3GEO.editorOL.atualizaJanelaAtivaTema(); } }, ativaTema: function(id){ @@ -585,7 +624,8 @@ i3GEO.editorOL = { strokeWidth: i3GEO.editorOL.simbologia.strokeWidth, strokeColor: i3GEO.editorOL.simbologia.strokeColor, pointRadius: i3GEO.editorOL.simbologia.pointRadius, - graphicName: i3GEO.editorOL.simbologia.graphicName + graphicName: i3GEO.editorOL.simbologia.graphicName, + registros: f["attributes"] }; } i3GEO.editorOL.layergrafico.addFeatures(gml); @@ -601,7 +641,6 @@ i3GEO.editorOL = { salvaGeometrias: function(){ var geos = i3GEO.editorOL.layergrafico.selectedFeatures, n = geos.length, - janela, ins = ""; if(n > 0){ if($i("panelsalvageometrias")){ @@ -638,20 +677,30 @@ i3GEO.editorOL = { i3GEO.editorOL.processageo("converteSHP"); }, listaGeometriasSel: function(){ - var geos = i3GEO.editorOL.layergrafico.selectedFeatures; - var n = geos.length; - var ins = "",i; + var geos = i3GEO.editorOL.layergrafico.selectedFeatures, + n = geos.length, + ins = "",i,a,w; for(i=0;i
"+geos[i].geometry+"

"; ins += "Atributos: "+i+"
"; - var a = geos[i].attributes; + a = geos[i].attributes; for(key in a){ + if(a[key]){ + ins += key+" = "+a[key]+"
"; + } + } + //lista os registros se for fruto de uma captura + if(geos[i].attributes.registros){ + ins += "Registros: "+i+"
"; + a = geos[i].attributes.registros; + for(key in a){ if(a[key]){ ins += key+" = "+a[key]+"
"; } + } } } - var w = window.open(); + w = window.open(); w.document.write(ins); w.document.close(); }, @@ -659,20 +708,62 @@ i3GEO.editorOL = { alert("Funcao nao disponivel. Defina o nome da funcao em i3GEO.editorOL.nomeFuncaoSalvar "); }, salvaGeo: function(){ - i3GEO.editorOL.testeSalvar(); - return; - //verifica se apenas uma geometria esta selecionada - //verifica se a geometria contem o atributo que indica a coluna ou codigo unico - var funcaoOK = function(){ - - alert("oi"); + //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; + 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="+geos[0].geometry); + } + 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="+geos[0].geometry); + } + } }, funcaoCombo = function(obj){ $i("editorOLondeComboTemaEditavel").innerHTML = obj.dados; }, texto = "Salvar no tema:


"; - i3GEO.janela.confirma(texto,300,"Salva","Cancela",funcaoOK); - i3GEO.util.comboTemas("editorOLcomboTemaEditavel",funcaoCombo,"editorOLondeComboTemaEditavel","",false,"editavel"); + 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 = { @@ -845,19 +936,12 @@ i3GEO.editorOL = { displayClass: "editorOLidentifica", eventListeners: { getfeatureinfo: function(event) { - var ativo = [i3GEO.editorOL.layerAtivo()]; - //se for TMS tem de pegar o clone wms - if(ativo[0].CLASS_NAME == "OpenLayers.Layer.TMS"){ - temp = i3GEO.editorOL.layersClonados(ativo[0].layername); - if(temp != ""){ - temp.setVisibility(false); - } - } var lonlat = i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy), lonlattexto = "
", formata; + if( botoes.linha === true || botoes.ponto === true || botoes.poligono === true || botoes.edita === true){ - lonlattexto += "
captura
"; + lonlattexto += "
edita geometria

"; } formata = function(texto){ var temp, @@ -891,20 +975,17 @@ i3GEO.editorOL = { "chicken", i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy), null, - lonlattexto+"
"+formata(event.text)+"
", + "
"+lonlattexto+"
"+formata(event.text)+"
", null, true )); + i3GEO.editorOL.removeClone(); }, beforegetfeatureinfo: function(event){ var temp,ativo = [i3GEO.editorOL.layerAtivo()]; //se for TMS tem de pegar o clone wms if(ativo[0].CLASS_NAME == "OpenLayers.Layer.TMS"){ - temp = i3GEO.editorOL.layersClonados(ativo[0].layername); - if(temp != ""){ - temp.setVisibility(true); - ativo = [temp]; - } + ativo = [i3GEO.editorOL.layertms2wms(ativo[0])]; } event.object.layers = ativo; botaoIdentifica.layers = ativo; diff --git a/mashups/openlayers.php b/mashups/openlayers.php index 58519b2..a008c28 100644 --- a/mashups/openlayers.php +++ b/mashups/openlayers.php @@ -333,7 +333,6 @@ Parâmetros: - diff --git a/mashups/openlayers_compacto.js b/mashups/openlayers_compacto.js index 5ad1e2b..1658df9 100644 --- a/mashups/openlayers_compacto.js +++ b/mashups/openlayers_compacto.js @@ -3302,16 +3302,46 @@ ins.push(layers[i]); } return ins; }, +//layers clonados sao copias WMS de layers TMS necessarios para realizar o getfeature +//sao criados quando o layer e adicionado layersClonados: function(paramsLayers){ var layers = i3GEO.editorOL.mapa.layers, nlayers = layers.length,i; 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 @@ -3378,11 +3408,19 @@ catch(e){} criaComboTemas: function(){ var layers = i3GEO.editorOL.layersLigados(), nlayers = layers.length, -i, -combo = ""; //i3GEO.editorOL.layergrafico.setLayerIndex(i3GEO.editorOL.getNumLayers() + 1); for(i=0;i"+layers[i].name+""; +//pega o nome do tema +nometema = ""; +if(i3GEO.arvoreDeCamadas && i3GEO.arvoreDeCamadas.CAMADAS){ +temp = i3GEO.arvoreDeCamadas.pegaTema(layers[i].name,"","name"); +if(temp != ""){ +nometema = temp.tema+" - "; +} +} +combo += ""; } combo += ""; return combo; @@ -3428,6 +3466,7 @@ temp.onclick = function(){i3GEO.janela.minimiza("paneltemaativo");}; } else{ YAHOO.temaativo.container.panel.show(); +i3GEO.editorOL.atualizaJanelaAtivaTema(); } }, ativaTema: function(id){ @@ -3593,7 +3632,8 @@ 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 +graphicName: i3GEO.editorOL.simbologia.graphicName, +registros: f["attributes"] }; } i3GEO.editorOL.layergrafico.addFeatures(gml); @@ -3609,7 +3649,6 @@ alert("Erro"); salvaGeometrias: function(){ var geos = i3GEO.editorOL.layergrafico.selectedFeatures, n = geos.length, -janela, ins = ""; if(n > 0){ if($i("panelsalvageometrias")){ @@ -3646,20 +3685,30 @@ exportarSHP: function(){ i3GEO.editorOL.processageo("converteSHP"); }, listaGeometriasSel: function(){ -var geos = i3GEO.editorOL.layergrafico.selectedFeatures; -var n = geos.length; -var ins = "",i; +var geos = i3GEO.editorOL.layergrafico.selectedFeatures, +n = geos.length, +ins = "",i,a,w; for(i=0;i
"+geos[i].geometry+"

"; ins += "Atributos: "+i+"
"; -var a = geos[i].attributes; +a = geos[i].attributes; for(key in a){ if(a[key]){ ins += key+" = "+a[key]+"
"; } } +//lista os registros se for fruto de uma captura +if(geos[i].attributes.registros){ +ins += "Registros: "+i+"
"; +a = geos[i].attributes.registros; +for(key in a){ +if(a[key]){ +ins += key+" = "+a[key]+"
"; +} +} +} } -var w = window.open(); +w = window.open(); w.document.write(ins); w.document.close(); }, @@ -3667,19 +3716,61 @@ testeSalvar: function(){ alert("Funcao nao disponivel. Defina o nome da funcao em i3GEO.editorOL.nomeFuncaoSalvar "); }, salvaGeo: function(){ -i3GEO.editorOL.testeSalvar(); -return; -//verifica se apenas uma geometria esta selecionada +//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 -var funcaoOK = function(){ -alert("oi"); +if(geos[0].geometry){ +var registros = "", +valorunico = "", +nometema = $i("editorOLcomboTemaEditavel").value, +key,tema,redesenha,p; +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="+geos[0].geometry); +} +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="+geos[0].geometry); +} +} }, 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 = { @@ -3852,19 +3943,11 @@ type: OpenLayers.Control.TYPE_TOOL, displayClass: "editorOLidentifica", eventListeners: { getfeatureinfo: function(event) { -var ativo = [i3GEO.editorOL.layerAtivo()]; -//se for TMS tem de pegar o clone wms -if(ativo[0].CLASS_NAME == "OpenLayers.Layer.TMS"){ -temp = i3GEO.editorOL.layersClonados(ativo[0].layername); -if(temp != ""){ -temp.setVisibility(false); -} -} var lonlat = i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy), lonlattexto = "
", formata; if( botoes.linha === true || botoes.ponto === true || botoes.poligono === true || botoes.edita === true){ -lonlattexto += "
captura
"; +lonlattexto += "
edita geometria

"; } formata = function(texto){ var temp, @@ -3898,20 +3981,17 @@ i3GEO.editorOL.mapa.addPopup(new OpenLayers.Popup.FramedCloud( "chicken", i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy), null, -lonlattexto+"
"+formata(event.text)+"
", +"
"+lonlattexto+"
"+formata(event.text)+"
", null, true )); +i3GEO.editorOL.removeClone(); }, beforegetfeatureinfo: function(event){ var temp,ativo = [i3GEO.editorOL.layerAtivo()]; //se for TMS tem de pegar o clone wms if(ativo[0].CLASS_NAME == "OpenLayers.Layer.TMS"){ -temp = i3GEO.editorOL.layersClonados(ativo[0].layername); -if(temp != ""){ -temp.setVisibility(true); -ativo = [temp]; -} +ativo = [i3GEO.editorOL.layertms2wms(ativo[0])]; } event.object.layers = ativo; botaoIdentifica.layers = ativo; diff --git a/mashups/openlayers_compacto.js.php b/mashups/openlayers_compacto.js.php index 250142e..984d626 100644 --- a/mashups/openlayers_compacto.js.php +++ b/mashups/openlayers_compacto.js.php @@ -3302,16 +3302,46 @@ ins.push(layers[i]); } return ins; }, +//layers clonados sao copias WMS de layers TMS necessarios para realizar o getfeature +//sao criados quando o layer e adicionado layersClonados: function(paramsLayers){ var layers = i3GEO.editorOL.mapa.layers, nlayers = layers.length,i; 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 @@ -3378,11 +3408,19 @@ catch(e){} criaComboTemas: function(){ var layers = i3GEO.editorOL.layersLigados(), nlayers = layers.length, -i, -combo = ""; //i3GEO.editorOL.layergrafico.setLayerIndex(i3GEO.editorOL.getNumLayers() + 1); for(i=0;i"+layers[i].name+""; +//pega o nome do tema +nometema = ""; +if(i3GEO.arvoreDeCamadas && i3GEO.arvoreDeCamadas.CAMADAS){ +temp = i3GEO.arvoreDeCamadas.pegaTema(layers[i].name,"","name"); +if(temp != ""){ +nometema = temp.tema+" - "; +} +} +combo += ""; } combo += ""; return combo; @@ -3428,6 +3466,7 @@ temp.onclick = function(){i3GEO.janela.minimiza("paneltemaativo");}; } else{ YAHOO.temaativo.container.panel.show(); +i3GEO.editorOL.atualizaJanelaAtivaTema(); } }, ativaTema: function(id){ @@ -3593,7 +3632,8 @@ 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 +graphicName: i3GEO.editorOL.simbologia.graphicName, +registros: f["attributes"] }; } i3GEO.editorOL.layergrafico.addFeatures(gml); @@ -3609,7 +3649,6 @@ alert("Erro"); salvaGeometrias: function(){ var geos = i3GEO.editorOL.layergrafico.selectedFeatures, n = geos.length, -janela, ins = ""; if(n > 0){ if($i("panelsalvageometrias")){ @@ -3646,20 +3685,30 @@ exportarSHP: function(){ i3GEO.editorOL.processageo("converteSHP"); }, listaGeometriasSel: function(){ -var geos = i3GEO.editorOL.layergrafico.selectedFeatures; -var n = geos.length; -var ins = "",i; +var geos = i3GEO.editorOL.layergrafico.selectedFeatures, +n = geos.length, +ins = "",i,a,w; for(i=0;i
"+geos[i].geometry+"

"; ins += "Atributos: "+i+"
"; -var a = geos[i].attributes; +a = geos[i].attributes; for(key in a){ if(a[key]){ ins += key+" = "+a[key]+"
"; } } +//lista os registros se for fruto de uma captura +if(geos[i].attributes.registros){ +ins += "Registros: "+i+"
"; +a = geos[i].attributes.registros; +for(key in a){ +if(a[key]){ +ins += key+" = "+a[key]+"
"; +} +} +} } -var w = window.open(); +w = window.open(); w.document.write(ins); w.document.close(); }, @@ -3667,19 +3716,61 @@ testeSalvar: function(){ alert("Funcao nao disponivel. Defina o nome da funcao em i3GEO.editorOL.nomeFuncaoSalvar "); }, salvaGeo: function(){ -i3GEO.editorOL.testeSalvar(); -return; -//verifica se apenas uma geometria esta selecionada +//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 -var funcaoOK = function(){ -alert("oi"); +if(geos[0].geometry){ +var registros = "", +valorunico = "", +nometema = $i("editorOLcomboTemaEditavel").value, +key,tema,redesenha,p; +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="+geos[0].geometry); +} +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="+geos[0].geometry); +} +} }, 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 = { @@ -3852,19 +3943,11 @@ type: OpenLayers.Control.TYPE_TOOL, displayClass: "editorOLidentifica", eventListeners: { getfeatureinfo: function(event) { -var ativo = [i3GEO.editorOL.layerAtivo()]; -//se for TMS tem de pegar o clone wms -if(ativo[0].CLASS_NAME == "OpenLayers.Layer.TMS"){ -temp = i3GEO.editorOL.layersClonados(ativo[0].layername); -if(temp != ""){ -temp.setVisibility(false); -} -} var lonlat = i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy), lonlattexto = "
", formata; if( botoes.linha === true || botoes.ponto === true || botoes.poligono === true || botoes.edita === true){ -lonlattexto += "
captura
"; +lonlattexto += "
edita geometria

"; } formata = function(texto){ var temp, @@ -3898,20 +3981,17 @@ i3GEO.editorOL.mapa.addPopup(new OpenLayers.Popup.FramedCloud( "chicken", i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy), null, -lonlattexto+"
"+formata(event.text)+"
", +"
"+lonlattexto+"
"+formata(event.text)+"
", null, true )); +i3GEO.editorOL.removeClone(); }, beforegetfeatureinfo: function(event){ var temp,ativo = [i3GEO.editorOL.layerAtivo()]; //se for TMS tem de pegar o clone wms if(ativo[0].CLASS_NAME == "OpenLayers.Layer.TMS"){ -temp = i3GEO.editorOL.layersClonados(ativo[0].layername); -if(temp != ""){ -temp.setVisibility(true); -ativo = [temp]; -} +ativo = [i3GEO.editorOL.layertms2wms(ativo[0])]; } event.object.layers = ativo; botaoIdentifica.layers = ativo; diff --git a/temas/_llocali.map b/temas/_llocali.map index c9753fa..6262a86 100644 --- a/temas/_llocali.map +++ b/temas/_llocali.map @@ -1,87 +1,88 @@ MAP - FONTSET "../symbols/fontes.txt" - SYMBOLSET "../symbols/simbolosv6.sym" - LAYER - CONNECTION "" - DATA "/var/www/i3geo/aplicmap/dados/locali.shp" - #FILTER (('[ESTADO]' = 'GO')) - METADATA - "METAESTAT_ID_MEDIDA_VARIAVEL" "" - "cache" "nao" - "LTEMPOITEMIMAGEM" "" - "TIP" "TIPO,ANOCRIA,NOMELOC" - "LTEMPOITEMDESCRICAO" "TIPO" - "CLASSE" "SIM" - "palletestep" "" - "LTEMPOITEMINICIO" "ANOCRIA" - "temporizador" "" - "LTEMPOITEMTIP" "ANOCRIA" - "permitekmz" "sim" - "description_template" "" - "LTEMPOITEMTITULO" "NOMELOC" - "iconetema" "" - "LTEMPOITEMLINK" "" - "METAESTAT_CODIGO_TIPO_REGIAO" "" - "palletefile" "" - "LTEMPOFORMATODATA" "iso8601" - "permitedownload" "sim" - "LTEMPOITEMICONE" "" - "permitecomentario" "" - "metaestat" "" - "download" "SIM" - "itembuscarapida" "NOMELOC" - "arquivokmz" "" - "arquivodownload" "" - "transitioneffect" "NAO" - "permiteogc" "sim" - "permitekml" "sim" - "convcaracter" "" - "TEMA" "Localidades (usar com timeline)" - "LTEMPOCONVENCODE" "SIM" - "editorsql" "" - "legendaimg" "" - "LTEMPOITEMFIM" "" - END # METADATA - NAME "_llocali" - STATUS DEFAULT - TEMPLATE "none.htm" - TILEITEM "location" - TYPE POINT - UNITS METERS - CLASS - NAME "Vila" - EXPRESSION ('[TIPO]'eq'Vila') - STYLE - ANGLE 0 - COLOR 250 193 4 - OFFSET 0 0 - SIZE 20 - SYMBOL "/var/www/i3geo/imagens/google/condominium.png" - END # STYLE - END # CLASS - CLASS - NAME "Cidade" - EXPRESSION ('[TIPO]'eq'Cidade') - STYLE - ANGLE 0 - COLOR 62 9 41 - OFFSET 0 0 - SIZE 20 - SYMBOL "/var/www/i3geo/imagens/google/condominium1.png" - END # STYLE - END # CLASS - CLASS - NAME "Capital" - EXPRESSION ('[TIPO]'eq'Capital') - STYLE - ANGLE 0 - COLOR 112 203 244 - OFFSET 0 0 - SIZE 6 - SYMBOL "vila" - END # STYLE - END # CLASS - END # LAYER + FONTSET "../symbols/fontes.txt" + SYMBOLSET "../symbols/simbolosv6.sym" + LAYER + CONNECTION "" + DATA "/var/www/i3geo/aplicmap/dados/locali.shp" + #FILTER (('[ESTADO]' = 'GO')) + METADATA + "METAESTAT_ID_MEDIDA_VARIAVEL" "" + "cache" "nao" + "LTEMPOITEMIMAGEM" "" + "TIP" "TIPO,ANOCRIA,NOMELOC" + "LTEMPOITEMDESCRICAO" "TIPO" + "CLASSE" "SIM" + "palletestep" "" + "LTEMPOITEMINICIO" "ANOCRIA" + "temporizador" "" + "LTEMPOITEMTIP" "ANOCRIA" + "permitekmz" "sim" + "description_template" "" + "LTEMPOITEMTITULO" "NOMELOC" + "iconetema" "" + "LTEMPOITEMLINK" "" + "METAESTAT_CODIGO_TIPO_REGIAO" "" + "palletefile" "" + "LTEMPOFORMATODATA" "iso8601" + "permitedownload" "sim" + "LTEMPOITEMICONE" "" + "permitecomentario" "" + "metaestat" "" + "download" "SIM" + "itembuscarapida" "NOMELOC" + "arquivokmz" "" + "arquivodownload" "" + "transitioneffect" "NAO" + "permiteogc" "sim" + "permitekml" "sim" + "convcaracter" "" + "TEMA" "Localidades (usar com timeline)" + "LTEMPOCONVENCODE" "SIM" + "editorsql" "" + "legendaimg" "" + "LTEMPOITEMFIM" "" + END # METADATA + + NAME "_llocali" + STATUS DEFAULT + TEMPLATE "none.htm" + TILEITEM "location" + TYPE POINT + UNITS METERS + CLASS + NAME "Vila" + EXPRESSION ('[TIPO]'eq'Vila') + STYLE + ANGLE 0 + COLOR 250 193 4 + OFFSET 0 0 + SIZE 20 + SYMBOL "/var/www/i3geo/imagens/google/condominium.png" + END # STYLE + END # CLASS + CLASS + NAME "Cidade" + EXPRESSION ('[TIPO]'eq'Cidade') + STYLE + ANGLE 0 + COLOR 62 9 41 + OFFSET 0 0 + SIZE 20 + SYMBOL "/var/www/i3geo/imagens/google/condominium1.png" + END # STYLE + END # CLASS + CLASS + NAME "Capital" + EXPRESSION ('[TIPO]'eq'Capital') + STYLE + ANGLE 0 + COLOR 112 203 244 + OFFSET 0 0 + SIZE 6 + SYMBOL "vila" + END # STYLE + END # CLASS + END # LAYER END # MAP -- libgit2 0.21.2