Commit d12d595be532b0430fa6cbc2a6ac22870c5c4302
1 parent
3a363adb
Exists in
master
and in
7 other branches
ALterações nas opções de edição vetorial
Showing
10 changed files
with
492 additions
and
197 deletions
Show diff stats
admin/js/editormapfile.js
| ... | ... | @@ -1327,7 +1327,7 @@ function montaEditorComport(dados) |
| 1327 | 1327 | { |
| 1328 | 1328 | var param = { |
| 1329 | 1329 | "linhas":[ |
| 1330 | - {ajuda:"Sets the current status of the layer. Often modified by MapServer itself. Default turns the layer on permanently", | |
| 1330 | + {ajuda:"Define o estado atual da camada. Geralmente modificado pelo próprio MapServer. Default ativa a camada permanentemente.", | |
| 1331 | 1331 | titulo:"Status",id:"",value:dados.status,tipo:"text",div:"<div id=cStatus ></div>"}, |
| 1332 | 1332 | {ajuda:"Indica se o tema irá ser mostrado na ferramenta de identificação", |
| 1333 | 1333 | titulo:"Identifica (IDENTIFICA)",id:"",value:dados.identifica,tipo:"text",div:"<div id=cIdentifica ></div>"}, | ... | ... |
admin/php/classe_metaestat.php
classesphp/classe_mapa.php
| ... | ... | @@ -397,7 +397,10 @@ class Mapa |
| 397 | 397 | "permiteogc"=>($oLayer->getmetadata("permiteogc")), |
| 398 | 398 | "itembuscarapida"=>($oLayer->getmetadata("itembuscarapida")), |
| 399 | 399 | "usasld"=>$usasld, |
| 400 | - "cache"=>$cache | |
| 400 | + "cache"=>$cache, | |
| 401 | + "editavel"=>($oLayer->getmetadata("EDITAVEL")), | |
| 402 | + "editavel"=>($oLayer->getmetadata("EDITAVEL")), | |
| 403 | + "colunaidunico"=>($oLayer->getmetadata("COLUNAIDUNICO")) | |
| 401 | 404 | ); |
| 402 | 405 | } |
| 403 | 406 | } | ... | ... |
classesphp/mapa_openlayers.php
| ... | ... | @@ -87,12 +87,19 @@ if(isset($_GET["tms"])){ |
| 87 | 87 | $_GET["BBOX"] = $lon1." ".$lat1." ".$lon2." ".$lat2; |
| 88 | 88 | } |
| 89 | 89 | $map_fileX = $_SESSION["map_file"]; |
| 90 | +// | |
| 91 | +//verifica se o request e OGC | |
| 92 | +if(!empty($_GET["request"])){ | |
| 93 | + $_GET["REQUEST"] = $_GET["request"]; | |
| 94 | +} | |
| 90 | 95 | // |
| 91 | 96 | //resolve o problema da seleção na versão nova do mapserver |
| 92 | 97 | // |
| 93 | 98 | $qyfile = dirname($map_fileX)."/".$_GET["layer"].".php"; |
| 94 | 99 | $qy = file_exists($qyfile); |
| 95 | - | |
| 100 | +if($_GET["REQUEST"] == "GetFeatureInfo" || strtolower($_GET["REQUEST"]) == "getfeature"){ | |
| 101 | + $_GET["DESLIGACACHE"] = "sim"; | |
| 102 | +} | |
| 96 | 103 | if($qy == false && $_GET["cache"] == "sim" && $_GET["DESLIGACACHE"] != "sim"){ |
| 97 | 104 | carregaCacheImagem($_SESSION["cachedir"],$_SESSION["map_file"],$_GET["tms"],$_SESSION["i3georendermode"]); |
| 98 | 105 | } |
| ... | ... | @@ -151,17 +158,22 @@ if(!isset($_GET["telaR"])){//no caso de projecoes remotas, o mapfile nao e alter |
| 151 | 158 | $nomecache = $layerName; |
| 152 | 159 | } |
| 153 | 160 | } |
| 154 | - } | |
| 155 | - if($_GET["REQUEST"] == "GetFeatureInfo" || $_GET["REQUEST"] == "getfeature"){ | |
| 156 | - $l->setmetadata("gml_include_items","all"); | |
| 157 | - $l->setmetadata("WMS_INCLUDE_ITEMS","all"); | |
| 158 | - $l->setmetadata("WFS_INCLUDE_ITEMS","all"); | |
| 159 | - $l->setmetadata("ows_enable_request","*"); | |
| 160 | - $l->set("dump",MS_TRUE); | |
| 161 | - $l->setmetadata("ows_srs","AUTO"); | |
| 161 | + if($_GET["REQUEST"] == "GetFeatureInfo" || strtolower($_GET["REQUEST"]) == "getfeature" ){ | |
| 162 | + $l->setmetadata("gml_include_items","all"); | |
| 163 | + $l->set("template","none.htm"); | |
| 164 | + $l->setmetadata("WMS_INCLUDE_ITEMS","all"); | |
| 165 | + $l->setmetadata("WFS_INCLUDE_ITEMS","all"); | |
| 166 | + $l->setmetadata("ows_enable_request","*"); | |
| 167 | + $l->set("dump",MS_TRUE); | |
| 168 | + $l->setmetadata("ows_srs","AUTO"); | |
| 169 | + if(strtolower($_GET["REQUEST"]) == "getfeature"){ | |
| 170 | + $_GET["TYPENAME"] = $l->name; | |
| 171 | + } | |
| 172 | + } | |
| 162 | 173 | } |
| 163 | 174 | } |
| 164 | 175 | } |
| 176 | + | |
| 165 | 177 | if (!function_exists('imagepng')) |
| 166 | 178 | {$_GET["TIPOIMAGEM"] = "";} |
| 167 | 179 | |
| ... | ... | @@ -175,19 +187,21 @@ elseif($_GET["TIPOIMAGEM"] != "" && $_GET["TIPOIMAGEM"] != "nenhum") |
| 175 | 187 | {$cache = false;} |
| 176 | 188 | |
| 177 | 189 | if($cache == true && $_GET["cache"] != "nao"){ |
| 178 | - //carregaCacheImagem($cachedir,$_GET["BBOX"],$nomecache,$map_fileX,$_GET["WIDTH"],$_GET["HEIGHT"]); | |
| 179 | 190 | carregaCacheImagem($cachedir,$map,$_GET["tms"]); |
| 180 | 191 | } |
| 181 | -$map_size = explode(" ",$_GET["map_size"]); | |
| 182 | -$mapa->setsize($map_size[0],$map_size[1]); | |
| 192 | +if(isset($_GET["map_size"])){ | |
| 193 | + $map_size = explode(" ",$_GET["map_size"]); | |
| 194 | + $mapa->setsize($map_size[0],$map_size[1]); | |
| 195 | +} | |
| 183 | 196 | if(isset($_GET["mapext"])){ |
| 184 | 197 | $mapext = explode(" ",$_GET["mapext"]); |
| 185 | 198 | $mapa->setExtent($mapext[0],$mapext[1],$mapext[2],$mapext[3]); |
| 186 | 199 | } |
| 200 | + | |
| 187 | 201 | // |
| 188 | 202 | //qd a cahamda e para um WMS, redireciona para ogc.php |
| 189 | 203 | // |
| 190 | -if($_GET["REQUEST"] == "GetFeatureInfo" || $_GET["request"] == "getfeature"){ | |
| 204 | +if($_GET["REQUEST"] == "GetFeatureInfo" || $_GET["REQUEST"] == "getfeature"){ | |
| 191 | 205 | $req = ms_newowsrequestobj(); |
| 192 | 206 | $_GET = array_merge($_GET,$_POST); |
| 193 | 207 | foreach ($_GET as $k=>$v){ | ... | ... |
ferramentas/editortema/exec.php
| ... | ... | @@ -29,6 +29,7 @@ include_once(dirname(__FILE__)."/../inicia.php"); |
| 29 | 29 | include_once(dirname(__FILE__)."/../../admin/php/login.php"); |
| 30 | 30 | $funcoesEdicao = array( |
| 31 | 31 | "ADICIONAGEOMETRIA", |
| 32 | + "ATUALIZAGEOMETRIA", | |
| 32 | 33 | "EXCLUIREGISTRO", |
| 33 | 34 | "SALVAREGISTRO" |
| 34 | 35 | ); |
| ... | ... | @@ -80,6 +81,42 @@ switch (strtoupper($funcao)) |
| 80 | 81 | } |
| 81 | 82 | } |
| 82 | 83 | break; |
| 84 | + case "ATUALIZAGEOMETRIA": | |
| 85 | + $mapa = ms_newMapObj($map_file); | |
| 86 | + $layer = $mapa->getlayerbyname($tema); | |
| 87 | + if(strtolower($layer->getmetadata("EDITAVEL")) != "sim"){ | |
| 88 | + $retorno = "erro"; | |
| 89 | + } | |
| 90 | + else{ | |
| 91 | + $tabela = $layer->getmetadata("TABELAEDITAVEL"); | |
| 92 | + $esquema = $layer->getmetadata("ESQUEMATABELAEDITAVEL"); | |
| 93 | + $colunaidunico = $layer->getmetadata("COLUNAIDUNICO"); | |
| 94 | + $colunageometria = $layer->getmetadata("COLUNAGEOMETRIA"); | |
| 95 | + if($colunageometria == ""){ | |
| 96 | + $retorno = "erro"; | |
| 97 | + } | |
| 98 | + $c = stringCon2Array($layer->connection); | |
| 99 | + try { | |
| 100 | + $dbh = new PDO('pgsql:dbname='.$c["dbname"].';user='.$c["user"].';password='.$c["password"].';host='.$c["host"].';port='.$c["port"]); | |
| 101 | + //pega o SRID | |
| 102 | + $sql = "select ST_SRID($colunageometria) as srid from $esquema"."."."$tabela LIMIT 1"; | |
| 103 | + //echo $sql;exit; | |
| 104 | + $q = $dbh->query($sql,PDO::FETCH_ASSOC); | |
| 105 | + $r = $q->fetchAll(); | |
| 106 | + $srid = $r[0]["srid"]; | |
| 107 | + | |
| 108 | + $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); | |
| 109 | + $dbh->beginTransaction(); | |
| 110 | + $sql = "UPDATE ".$esquema.".".$tabela." SET ".$colunageometria." = (ST_GeomFromText('SRID=$srid;".$wkt."')) WHERE $colunaidunico = ".$idunico; | |
| 111 | + $sth = $dbh->exec($sql); | |
| 112 | + $dbh->commit(); | |
| 113 | + $retorno = "ok"; | |
| 114 | + } catch (Exception $e) { | |
| 115 | + $dbh->rollBack(); | |
| 116 | + $retorno = array("Falhou: " . $e->getMessage()); | |
| 117 | + } | |
| 118 | + } | |
| 119 | + break; | |
| 83 | 120 | case "EXCLUIREGISTRO": |
| 84 | 121 | $mapa = ms_newMapObj($map_file); |
| 85 | 122 | $layer = $mapa->getlayerbyname($tema); | ... | ... |
mashups/openlayers.js
| ... | ... | @@ -289,16 +289,46 @@ i3GEO.editorOL = { |
| 289 | 289 | } |
| 290 | 290 | return ins; |
| 291 | 291 | }, |
| 292 | + //layers clonados sao copias WMS de layers TMS necessarios para realizar o getfeature | |
| 293 | + //sao criados quando o layer e adicionado | |
| 292 | 294 | layersClonados: function(paramsLayers){ |
| 293 | 295 | var layers = i3GEO.editorOL.mapa.layers, |
| 294 | 296 | nlayers = layers.length,i; |
| 295 | 297 | for(i=0;i<nlayers;i++){ |
| 296 | - if(layers[i].params.CLONETMS === paramsLayers){ | |
| 298 | + if(layers[i].params && layers[i].params.CLONETMS === paramsLayers){ | |
| 297 | 299 | return(layers[i]); |
| 298 | 300 | } |
| 299 | 301 | } |
| 300 | 302 | return false; |
| 301 | 303 | }, |
| 304 | + layertms2wms: function(tms){ | |
| 305 | + var layer = new OpenLayers.Layer.WMS( | |
| 306 | + tms.layername+"_clone", | |
| 307 | + tms.url.replace("&cache=sim","&DESLIGACACHE=sim"), | |
| 308 | + { | |
| 309 | + layers:tms.name, | |
| 310 | + transparent:true | |
| 311 | + }, | |
| 312 | + { | |
| 313 | + gutter:0, | |
| 314 | + isBaseLayer:false, | |
| 315 | + displayInLayerSwitcher:false, | |
| 316 | + opacity: 1, | |
| 317 | + visibility:true, | |
| 318 | + singleTile: true | |
| 319 | + } | |
| 320 | + ); | |
| 321 | + //i3GEO.editorOL.mapa.addLayer(layer); | |
| 322 | + return layer; | |
| 323 | + }, | |
| 324 | + //remove o layer clonado com layertms2wms | |
| 325 | + removeClone: function(){ | |
| 326 | + var nome = i3GEO.editorOL.layerAtivo().layername+"_clone", | |
| 327 | + busca = i3GEO.editorOL.mapa.getLayersByName(nome); | |
| 328 | + if(busca.length > 0){ | |
| 329 | + i3GEO.editorOL.mapa.removeLayer(i3GEO.editorOL.mapa.getLayersByName(camada.name)[0],false); | |
| 330 | + } | |
| 331 | + }, | |
| 302 | 332 | coordenadas: function(){ |
| 303 | 333 | // |
| 304 | 334 | //substitui o controle que mostra as coordenadas |
| ... | ... | @@ -366,11 +396,19 @@ i3GEO.editorOL = { |
| 366 | 396 | criaComboTemas: function(){ |
| 367 | 397 | var layers = i3GEO.editorOL.layersLigados(), |
| 368 | 398 | nlayers = layers.length, |
| 369 | - i, | |
| 370 | - combo = "<select id=i3GEOOLlistaTemasAtivos >"; | |
| 399 | + i,nometema = "",temp, | |
| 400 | + combo = "<select id=i3GEOOLlistaTemasAtivos style=width:235px; >"; | |
| 371 | 401 | //i3GEO.editorOL.layergrafico.setLayerIndex(i3GEO.editorOL.getNumLayers() + 1); |
| 372 | 402 | for(i=0;i<nlayers;i++){ |
| 373 | - combo += "<option value='"+i+"' >"+layers[i].name+"</option>"; | |
| 403 | + //pega o nome do tema | |
| 404 | + nometema = ""; | |
| 405 | + if(i3GEO.arvoreDeCamadas && i3GEO.arvoreDeCamadas.CAMADAS){ | |
| 406 | + temp = i3GEO.arvoreDeCamadas.pegaTema(layers[i].name,"","name"); | |
| 407 | + if(temp != ""){ | |
| 408 | + nometema = temp.tema+" - "; | |
| 409 | + } | |
| 410 | + } | |
| 411 | + combo += "<option value='"+i+"' >"+nometema + layers[i].name+"</option>"; | |
| 374 | 412 | } |
| 375 | 413 | combo += "</select>"; |
| 376 | 414 | return combo; |
| ... | ... | @@ -416,6 +454,7 @@ i3GEO.editorOL = { |
| 416 | 454 | } |
| 417 | 455 | else{ |
| 418 | 456 | YAHOO.temaativo.container.panel.show(); |
| 457 | + i3GEO.editorOL.atualizaJanelaAtivaTema(); | |
| 419 | 458 | } |
| 420 | 459 | }, |
| 421 | 460 | ativaTema: function(id){ |
| ... | ... | @@ -585,7 +624,8 @@ i3GEO.editorOL = { |
| 585 | 624 | strokeWidth: i3GEO.editorOL.simbologia.strokeWidth, |
| 586 | 625 | strokeColor: i3GEO.editorOL.simbologia.strokeColor, |
| 587 | 626 | pointRadius: i3GEO.editorOL.simbologia.pointRadius, |
| 588 | - graphicName: i3GEO.editorOL.simbologia.graphicName | |
| 627 | + graphicName: i3GEO.editorOL.simbologia.graphicName, | |
| 628 | + registros: f["attributes"] | |
| 589 | 629 | }; |
| 590 | 630 | } |
| 591 | 631 | i3GEO.editorOL.layergrafico.addFeatures(gml); |
| ... | ... | @@ -601,7 +641,6 @@ i3GEO.editorOL = { |
| 601 | 641 | salvaGeometrias: function(){ |
| 602 | 642 | var geos = i3GEO.editorOL.layergrafico.selectedFeatures, |
| 603 | 643 | n = geos.length, |
| 604 | - janela, | |
| 605 | 644 | ins = ""; |
| 606 | 645 | if(n > 0){ |
| 607 | 646 | if($i("panelsalvageometrias")){ |
| ... | ... | @@ -638,20 +677,30 @@ i3GEO.editorOL = { |
| 638 | 677 | i3GEO.editorOL.processageo("converteSHP"); |
| 639 | 678 | }, |
| 640 | 679 | listaGeometriasSel: function(){ |
| 641 | - var geos = i3GEO.editorOL.layergrafico.selectedFeatures; | |
| 642 | - var n = geos.length; | |
| 643 | - var ins = "",i; | |
| 680 | + var geos = i3GEO.editorOL.layergrafico.selectedFeatures, | |
| 681 | + n = geos.length, | |
| 682 | + ins = "",i,a,w; | |
| 644 | 683 | for(i=0;i<n;i++){ |
| 645 | 684 | ins += "<b>Geometria: "+i+"</b><br>"+geos[i].geometry+"<br><br>"; |
| 646 | 685 | ins += "<b>Atributos: "+i+"</b><br>"; |
| 647 | - var a = geos[i].attributes; | |
| 686 | + a = geos[i].attributes; | |
| 648 | 687 | for(key in a){ |
| 688 | + if(a[key]){ | |
| 689 | + ins += key+" = "+a[key]+"<br>"; | |
| 690 | + } | |
| 691 | + } | |
| 692 | + //lista os registros se for fruto de uma captura | |
| 693 | + if(geos[i].attributes.registros){ | |
| 694 | + ins += "<b>Registros: "+i+"</b><br>"; | |
| 695 | + a = geos[i].attributes.registros; | |
| 696 | + for(key in a){ | |
| 649 | 697 | if(a[key]){ |
| 650 | 698 | ins += key+" = "+a[key]+"<br>"; |
| 651 | 699 | } |
| 700 | + } | |
| 652 | 701 | } |
| 653 | 702 | } |
| 654 | - var w = window.open(); | |
| 703 | + w = window.open(); | |
| 655 | 704 | w.document.write(ins); |
| 656 | 705 | w.document.close(); |
| 657 | 706 | }, |
| ... | ... | @@ -659,20 +708,62 @@ i3GEO.editorOL = { |
| 659 | 708 | alert("Funcao nao disponivel. Defina o nome da funcao em i3GEO.editorOL.nomeFuncaoSalvar "); |
| 660 | 709 | }, |
| 661 | 710 | salvaGeo: function(){ |
| 662 | - i3GEO.editorOL.testeSalvar(); | |
| 663 | - return; | |
| 664 | - //verifica se apenas uma geometria esta selecionada | |
| 665 | - //verifica se a geometria contem o atributo que indica a coluna ou codigo unico | |
| 666 | - var funcaoOK = function(){ | |
| 667 | - | |
| 668 | - alert("oi"); | |
| 711 | + //i3GEO.editorOL.testeSalvar(); | |
| 712 | + //return; | |
| 713 | + var geos = i3GEO.editorOL.layergrafico.selectedFeatures, | |
| 714 | + n = geos.length, | |
| 715 | + funcaoOK = function(){ | |
| 716 | + //verifica se a geometria contem o atributo que indica a coluna ou codigo unico | |
| 717 | + if(geos[0].geometry){ | |
| 718 | + var registros = "", | |
| 719 | + valorunico = "", | |
| 720 | + nometema = $i("editorOLcomboTemaEditavel").value, | |
| 721 | + key,tema,redesenha,p; | |
| 722 | + if(nometema == ""){ | |
| 723 | + return; | |
| 724 | + } | |
| 725 | + tema = i3GEO.arvoreDeCamadas.pegaTema(nometema,"","name"); | |
| 726 | + //o tema contem o indicador de qual e a coluna que contem o identificador unico | |
| 727 | + if(geos[0].attributes.registros){ | |
| 728 | + registros = geos[0].attributes.registros; | |
| 729 | + for(key in registros){ | |
| 730 | + if(registros[key] && key == tema.colunaidunico){ | |
| 731 | + valorunico = registros[key]; | |
| 732 | + } | |
| 733 | + } | |
| 734 | + } | |
| 735 | + redesenha = function(retorno){ | |
| 736 | + i3GEO.janela.fechaAguarde("aguardeSalvaPonto"); | |
| 737 | + i3GEO.editorOL.layergrafico.removeFeatures(i3GEO.editorOL.layergrafico.selectedFeatures); | |
| 738 | + i3GEO.Interface.atualizaTema("",nometema); | |
| 739 | + }; | |
| 740 | + i3GEO.janela.AGUARDEMODAL = true; | |
| 741 | + i3GEO.janela.abreAguarde("aguardeSalvaPonto","Adicionando..."); | |
| 742 | + i3GEO.janela.AGUARDEMODAL = false; | |
| 743 | + | |
| 744 | + //cria um novo registro | |
| 745 | + if(valorunico == ""){ | |
| 746 | + p = i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=adicionaGeometria&g_sid="+i3GEO.configura.sid; | |
| 747 | + cpJSON.call(p,"foo",redesenha,"&tema="+nometema+"&wkt="+geos[0].geometry); | |
| 748 | + } | |
| 749 | + else{ | |
| 750 | + //atualiza a geometria | |
| 751 | + p = i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=atualizaGeometria&g_sid="+i3GEO.configura.sid; | |
| 752 | + cpJSON.call(p,"foo",redesenha,"&idunico="+valorunico+"&tema="+nometema+"&wkt="+geos[0].geometry); | |
| 753 | + } | |
| 754 | + } | |
| 669 | 755 | }, |
| 670 | 756 | funcaoCombo = function(obj){ |
| 671 | 757 | $i("editorOLondeComboTemaEditavel").innerHTML = obj.dados; |
| 672 | 758 | }, |
| 673 | 759 | texto = "Salvar no tema:<br><div id=editorOLondeComboTemaEditavel ></div><br><br>"; |
| 674 | - i3GEO.janela.confirma(texto,300,"Salva","Cancela",funcaoOK); | |
| 675 | - i3GEO.util.comboTemas("editorOLcomboTemaEditavel",funcaoCombo,"editorOLondeComboTemaEditavel","",false,"editavel"); | |
| 760 | + if(n != 1){ | |
| 761 | + i3GEO.janela.tempoMsg("Selecione apenas uma figura"); | |
| 762 | + } | |
| 763 | + else{ | |
| 764 | + i3GEO.janela.confirma(texto,300,"Salva","Cancela",funcaoOK); | |
| 765 | + i3GEO.util.comboTemas("editorOLcomboTemaEditavel",funcaoCombo,"editorOLondeComboTemaEditavel","",false,"editavel"); | |
| 766 | + } | |
| 676 | 767 | }, |
| 677 | 768 | criaBotoes: function(botoes){ |
| 678 | 769 | var sketchSymbolizers = { |
| ... | ... | @@ -845,19 +936,12 @@ i3GEO.editorOL = { |
| 845 | 936 | displayClass: "editorOLidentifica", |
| 846 | 937 | eventListeners: { |
| 847 | 938 | getfeatureinfo: function(event) { |
| 848 | - var ativo = [i3GEO.editorOL.layerAtivo()]; | |
| 849 | - //se for TMS tem de pegar o clone wms | |
| 850 | - if(ativo[0].CLASS_NAME == "OpenLayers.Layer.TMS"){ | |
| 851 | - temp = i3GEO.editorOL.layersClonados(ativo[0].layername); | |
| 852 | - if(temp != ""){ | |
| 853 | - temp.setVisibility(false); | |
| 854 | - } | |
| 855 | - } | |
| 856 | 939 | var lonlat = i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy), |
| 857 | 940 | lonlattexto = "<hr>", |
| 858 | 941 | formata; |
| 942 | + | |
| 859 | 943 | if( botoes.linha === true || botoes.ponto === true || botoes.poligono === true || botoes.edita === true){ |
| 860 | - lonlattexto += "<pre><span style=color:blue;cursor:pointer onclick='i3GEO.editorOL.captura(\""+lonlat.lon+","+lonlat.lat+"\")'>captura</span></pre>"; | |
| 944 | + lonlattexto += "<pre><span style=font-size:12px;color:blue;cursor:pointer onclick='i3GEO.editorOL.captura(\""+lonlat.lon+","+lonlat.lat+"\")'>edita geometria</span></pre><br>"; | |
| 861 | 945 | } |
| 862 | 946 | formata = function(texto){ |
| 863 | 947 | var temp, |
| ... | ... | @@ -891,20 +975,17 @@ i3GEO.editorOL = { |
| 891 | 975 | "chicken", |
| 892 | 976 | i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy), |
| 893 | 977 | null, |
| 894 | - lonlattexto+"<pre>"+formata(event.text)+"</pre>", | |
| 978 | + "<div style=text-align:left >"+lonlattexto+"<pre>"+formata(event.text)+"</pre></div>", | |
| 895 | 979 | null, |
| 896 | 980 | true |
| 897 | 981 | )); |
| 982 | + i3GEO.editorOL.removeClone(); | |
| 898 | 983 | }, |
| 899 | 984 | beforegetfeatureinfo: function(event){ |
| 900 | 985 | var temp,ativo = [i3GEO.editorOL.layerAtivo()]; |
| 901 | 986 | //se for TMS tem de pegar o clone wms |
| 902 | 987 | if(ativo[0].CLASS_NAME == "OpenLayers.Layer.TMS"){ |
| 903 | - temp = i3GEO.editorOL.layersClonados(ativo[0].layername); | |
| 904 | - if(temp != ""){ | |
| 905 | - temp.setVisibility(true); | |
| 906 | - ativo = [temp]; | |
| 907 | - } | |
| 988 | + ativo = [i3GEO.editorOL.layertms2wms(ativo[0])]; | |
| 908 | 989 | } |
| 909 | 990 | event.object.layers = ativo; |
| 910 | 991 | botaoIdentifica.layers = ativo; | ... | ... |
mashups/openlayers.php
| ... | ... | @@ -333,7 +333,6 @@ Par&acirc;metros: |
| 333 | 333 | |
| 334 | 334 | |
| 335 | 335 | <script type="text/javascript" src="openlayers_compacto.js.php"></script> |
| 336 | -<script type="text/javascript" src="../classesjs/compactados/classe_util_compacto.js"></script> | |
| 337 | 336 | <link rel="stylesheet" href="openlayers_compacto.css" type="text/css" /> |
| 338 | 337 | |
| 339 | 338 | ... | ... |
mashups/openlayers_compacto.js
| ... | ... | @@ -3302,16 +3302,46 @@ ins.push(layers[i]); |
| 3302 | 3302 | } |
| 3303 | 3303 | return ins; |
| 3304 | 3304 | }, |
| 3305 | +//layers clonados sao copias WMS de layers TMS necessarios para realizar o getfeature | |
| 3306 | +//sao criados quando o layer e adicionado | |
| 3305 | 3307 | layersClonados: function(paramsLayers){ |
| 3306 | 3308 | var layers = i3GEO.editorOL.mapa.layers, |
| 3307 | 3309 | nlayers = layers.length,i; |
| 3308 | 3310 | for(i=0;i<nlayers;i++){ |
| 3309 | -if(layers[i].params.CLONETMS === paramsLayers){ | |
| 3311 | +if(layers[i].params && layers[i].params.CLONETMS === paramsLayers){ | |
| 3310 | 3312 | return(layers[i]); |
| 3311 | 3313 | } |
| 3312 | 3314 | } |
| 3313 | 3315 | return false; |
| 3314 | 3316 | }, |
| 3317 | +layertms2wms: function(tms){ | |
| 3318 | +var layer = new OpenLayers.Layer.WMS( | |
| 3319 | +tms.layername+"_clone", | |
| 3320 | +tms.url.replace("&cache=sim","&DESLIGACACHE=sim"), | |
| 3321 | +{ | |
| 3322 | +layers:tms.name, | |
| 3323 | +transparent:true | |
| 3324 | +}, | |
| 3325 | +{ | |
| 3326 | +gutter:0, | |
| 3327 | +isBaseLayer:false, | |
| 3328 | +displayInLayerSwitcher:false, | |
| 3329 | +opacity: 1, | |
| 3330 | +visibility:true, | |
| 3331 | +singleTile: true | |
| 3332 | +} | |
| 3333 | +); | |
| 3334 | +//i3GEO.editorOL.mapa.addLayer(layer); | |
| 3335 | +return layer; | |
| 3336 | +}, | |
| 3337 | +//remove o layer clonado com layertms2wms | |
| 3338 | +removeClone: function(){ | |
| 3339 | +var nome = i3GEO.editorOL.layerAtivo().layername+"_clone", | |
| 3340 | +busca = i3GEO.editorOL.mapa.getLayersByName(nome); | |
| 3341 | +if(busca.length > 0){ | |
| 3342 | +i3GEO.editorOL.mapa.removeLayer(i3GEO.editorOL.mapa.getLayersByName(camada.name)[0],false); | |
| 3343 | +} | |
| 3344 | +}, | |
| 3315 | 3345 | coordenadas: function(){ |
| 3316 | 3346 | // |
| 3317 | 3347 | //substitui o controle que mostra as coordenadas |
| ... | ... | @@ -3378,11 +3408,19 @@ catch(e){} |
| 3378 | 3408 | criaComboTemas: function(){ |
| 3379 | 3409 | var layers = i3GEO.editorOL.layersLigados(), |
| 3380 | 3410 | nlayers = layers.length, |
| 3381 | -i, | |
| 3382 | -combo = "<select id=i3GEOOLlistaTemasAtivos >"; | |
| 3411 | +i,nometema = "",temp, | |
| 3412 | +combo = "<select id=i3GEOOLlistaTemasAtivos style=width:235px; >"; | |
| 3383 | 3413 | //i3GEO.editorOL.layergrafico.setLayerIndex(i3GEO.editorOL.getNumLayers() + 1); |
| 3384 | 3414 | for(i=0;i<nlayers;i++){ |
| 3385 | -combo += "<option value='"+i+"' >"+layers[i].name+"</option>"; | |
| 3415 | +//pega o nome do tema | |
| 3416 | +nometema = ""; | |
| 3417 | +if(i3GEO.arvoreDeCamadas && i3GEO.arvoreDeCamadas.CAMADAS){ | |
| 3418 | +temp = i3GEO.arvoreDeCamadas.pegaTema(layers[i].name,"","name"); | |
| 3419 | +if(temp != ""){ | |
| 3420 | +nometema = temp.tema+" - "; | |
| 3421 | +} | |
| 3422 | +} | |
| 3423 | +combo += "<option value='"+i+"' >"+nometema + layers[i].name+"</option>"; | |
| 3386 | 3424 | } |
| 3387 | 3425 | combo += "</select>"; |
| 3388 | 3426 | return combo; |
| ... | ... | @@ -3428,6 +3466,7 @@ temp.onclick = function(){i3GEO.janela.minimiza("paneltemaativo");}; |
| 3428 | 3466 | } |
| 3429 | 3467 | else{ |
| 3430 | 3468 | YAHOO.temaativo.container.panel.show(); |
| 3469 | +i3GEO.editorOL.atualizaJanelaAtivaTema(); | |
| 3431 | 3470 | } |
| 3432 | 3471 | }, |
| 3433 | 3472 | ativaTema: function(id){ |
| ... | ... | @@ -3593,7 +3632,8 @@ fillColor: i3GEO.editorOL.simbologia.fillColor, |
| 3593 | 3632 | strokeWidth: i3GEO.editorOL.simbologia.strokeWidth, |
| 3594 | 3633 | strokeColor: i3GEO.editorOL.simbologia.strokeColor, |
| 3595 | 3634 | pointRadius: i3GEO.editorOL.simbologia.pointRadius, |
| 3596 | -graphicName: i3GEO.editorOL.simbologia.graphicName | |
| 3635 | +graphicName: i3GEO.editorOL.simbologia.graphicName, | |
| 3636 | +registros: f["attributes"] | |
| 3597 | 3637 | }; |
| 3598 | 3638 | } |
| 3599 | 3639 | i3GEO.editorOL.layergrafico.addFeatures(gml); |
| ... | ... | @@ -3609,7 +3649,6 @@ alert("Erro"); |
| 3609 | 3649 | salvaGeometrias: function(){ |
| 3610 | 3650 | var geos = i3GEO.editorOL.layergrafico.selectedFeatures, |
| 3611 | 3651 | n = geos.length, |
| 3612 | -janela, | |
| 3613 | 3652 | ins = ""; |
| 3614 | 3653 | if(n > 0){ |
| 3615 | 3654 | if($i("panelsalvageometrias")){ |
| ... | ... | @@ -3646,20 +3685,30 @@ exportarSHP: function(){ |
| 3646 | 3685 | i3GEO.editorOL.processageo("converteSHP"); |
| 3647 | 3686 | }, |
| 3648 | 3687 | listaGeometriasSel: function(){ |
| 3649 | -var geos = i3GEO.editorOL.layergrafico.selectedFeatures; | |
| 3650 | -var n = geos.length; | |
| 3651 | -var ins = "",i; | |
| 3688 | +var geos = i3GEO.editorOL.layergrafico.selectedFeatures, | |
| 3689 | +n = geos.length, | |
| 3690 | +ins = "",i,a,w; | |
| 3652 | 3691 | for(i=0;i<n;i++){ |
| 3653 | 3692 | ins += "<b>Geometria: "+i+"</b><br>"+geos[i].geometry+"<br><br>"; |
| 3654 | 3693 | ins += "<b>Atributos: "+i+"</b><br>"; |
| 3655 | -var a = geos[i].attributes; | |
| 3694 | +a = geos[i].attributes; | |
| 3656 | 3695 | for(key in a){ |
| 3657 | 3696 | if(a[key]){ |
| 3658 | 3697 | ins += key+" = "+a[key]+"<br>"; |
| 3659 | 3698 | } |
| 3660 | 3699 | } |
| 3700 | +//lista os registros se for fruto de uma captura | |
| 3701 | +if(geos[i].attributes.registros){ | |
| 3702 | +ins += "<b>Registros: "+i+"</b><br>"; | |
| 3703 | +a = geos[i].attributes.registros; | |
| 3704 | +for(key in a){ | |
| 3705 | +if(a[key]){ | |
| 3706 | +ins += key+" = "+a[key]+"<br>"; | |
| 3707 | +} | |
| 3708 | +} | |
| 3709 | +} | |
| 3661 | 3710 | } |
| 3662 | -var w = window.open(); | |
| 3711 | +w = window.open(); | |
| 3663 | 3712 | w.document.write(ins); |
| 3664 | 3713 | w.document.close(); |
| 3665 | 3714 | }, |
| ... | ... | @@ -3667,19 +3716,61 @@ testeSalvar: function(){ |
| 3667 | 3716 | alert("Funcao nao disponivel. Defina o nome da funcao em i3GEO.editorOL.nomeFuncaoSalvar "); |
| 3668 | 3717 | }, |
| 3669 | 3718 | salvaGeo: function(){ |
| 3670 | -i3GEO.editorOL.testeSalvar(); | |
| 3671 | -return; | |
| 3672 | -//verifica se apenas uma geometria esta selecionada | |
| 3719 | +//i3GEO.editorOL.testeSalvar(); | |
| 3720 | +//return; | |
| 3721 | +var geos = i3GEO.editorOL.layergrafico.selectedFeatures, | |
| 3722 | +n = geos.length, | |
| 3723 | +funcaoOK = function(){ | |
| 3673 | 3724 | //verifica se a geometria contem o atributo que indica a coluna ou codigo unico |
| 3674 | -var funcaoOK = function(){ | |
| 3675 | -alert("oi"); | |
| 3725 | +if(geos[0].geometry){ | |
| 3726 | +var registros = "", | |
| 3727 | +valorunico = "", | |
| 3728 | +nometema = $i("editorOLcomboTemaEditavel").value, | |
| 3729 | +key,tema,redesenha,p; | |
| 3730 | +if(nometema == ""){ | |
| 3731 | +return; | |
| 3732 | +} | |
| 3733 | +tema = i3GEO.arvoreDeCamadas.pegaTema(nometema,"","name"); | |
| 3734 | +//o tema contem o indicador de qual e a coluna que contem o identificador unico | |
| 3735 | +if(geos[0].attributes.registros){ | |
| 3736 | +registros = geos[0].attributes.registros; | |
| 3737 | +for(key in registros){ | |
| 3738 | +if(registros[key] && key == tema.colunaidunico){ | |
| 3739 | +valorunico = registros[key]; | |
| 3740 | +} | |
| 3741 | +} | |
| 3742 | +} | |
| 3743 | +redesenha = function(retorno){ | |
| 3744 | +i3GEO.janela.fechaAguarde("aguardeSalvaPonto"); | |
| 3745 | +i3GEO.editorOL.layergrafico.removeFeatures(i3GEO.editorOL.layergrafico.selectedFeatures); | |
| 3746 | +i3GEO.Interface.atualizaTema("",nometema); | |
| 3747 | +}; | |
| 3748 | +i3GEO.janela.AGUARDEMODAL = true; | |
| 3749 | +i3GEO.janela.abreAguarde("aguardeSalvaPonto","Adicionando..."); | |
| 3750 | +i3GEO.janela.AGUARDEMODAL = false; | |
| 3751 | +//cria um novo registro | |
| 3752 | +if(valorunico == ""){ | |
| 3753 | +p = i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=adicionaGeometria&g_sid="+i3GEO.configura.sid; | |
| 3754 | +cpJSON.call(p,"foo",redesenha,"&tema="+nometema+"&wkt="+geos[0].geometry); | |
| 3755 | +} | |
| 3756 | +else{ | |
| 3757 | +//atualiza a geometria | |
| 3758 | +p = i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=atualizaGeometria&g_sid="+i3GEO.configura.sid; | |
| 3759 | +cpJSON.call(p,"foo",redesenha,"&idunico="+valorunico+"&tema="+nometema+"&wkt="+geos[0].geometry); | |
| 3760 | +} | |
| 3761 | +} | |
| 3676 | 3762 | }, |
| 3677 | 3763 | funcaoCombo = function(obj){ |
| 3678 | 3764 | $i("editorOLondeComboTemaEditavel").innerHTML = obj.dados; |
| 3679 | 3765 | }, |
| 3680 | 3766 | texto = "Salvar no tema:<br><div id=editorOLondeComboTemaEditavel ></div><br><br>"; |
| 3767 | +if(n != 1){ | |
| 3768 | +i3GEO.janela.tempoMsg("Selecione apenas uma figura"); | |
| 3769 | +} | |
| 3770 | +else{ | |
| 3681 | 3771 | i3GEO.janela.confirma(texto,300,"Salva","Cancela",funcaoOK); |
| 3682 | 3772 | i3GEO.util.comboTemas("editorOLcomboTemaEditavel",funcaoCombo,"editorOLondeComboTemaEditavel","",false,"editavel"); |
| 3773 | +} | |
| 3683 | 3774 | }, |
| 3684 | 3775 | criaBotoes: function(botoes){ |
| 3685 | 3776 | var sketchSymbolizers = { |
| ... | ... | @@ -3852,19 +3943,11 @@ type: OpenLayers.Control.TYPE_TOOL, |
| 3852 | 3943 | displayClass: "editorOLidentifica", |
| 3853 | 3944 | eventListeners: { |
| 3854 | 3945 | getfeatureinfo: function(event) { |
| 3855 | -var ativo = [i3GEO.editorOL.layerAtivo()]; | |
| 3856 | -//se for TMS tem de pegar o clone wms | |
| 3857 | -if(ativo[0].CLASS_NAME == "OpenLayers.Layer.TMS"){ | |
| 3858 | -temp = i3GEO.editorOL.layersClonados(ativo[0].layername); | |
| 3859 | -if(temp != ""){ | |
| 3860 | -temp.setVisibility(false); | |
| 3861 | -} | |
| 3862 | -} | |
| 3863 | 3946 | var lonlat = i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy), |
| 3864 | 3947 | lonlattexto = "<hr>", |
| 3865 | 3948 | formata; |
| 3866 | 3949 | if( botoes.linha === true || botoes.ponto === true || botoes.poligono === true || botoes.edita === true){ |
| 3867 | -lonlattexto += "<pre><span style=color:blue;cursor:pointer onclick='i3GEO.editorOL.captura(\""+lonlat.lon+","+lonlat.lat+"\")'>captura</span></pre>"; | |
| 3950 | +lonlattexto += "<pre><span style=font-size:12px;color:blue;cursor:pointer onclick='i3GEO.editorOL.captura(\""+lonlat.lon+","+lonlat.lat+"\")'>edita geometria</span></pre><br>"; | |
| 3868 | 3951 | } |
| 3869 | 3952 | formata = function(texto){ |
| 3870 | 3953 | var temp, |
| ... | ... | @@ -3898,20 +3981,17 @@ i3GEO.editorOL.mapa.addPopup(new OpenLayers.Popup.FramedCloud( |
| 3898 | 3981 | "chicken", |
| 3899 | 3982 | i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy), |
| 3900 | 3983 | null, |
| 3901 | -lonlattexto+"<pre>"+formata(event.text)+"</pre>", | |
| 3984 | +"<div style=text-align:left >"+lonlattexto+"<pre>"+formata(event.text)+"</pre></div>", | |
| 3902 | 3985 | null, |
| 3903 | 3986 | true |
| 3904 | 3987 | )); |
| 3988 | +i3GEO.editorOL.removeClone(); | |
| 3905 | 3989 | }, |
| 3906 | 3990 | beforegetfeatureinfo: function(event){ |
| 3907 | 3991 | var temp,ativo = [i3GEO.editorOL.layerAtivo()]; |
| 3908 | 3992 | //se for TMS tem de pegar o clone wms |
| 3909 | 3993 | if(ativo[0].CLASS_NAME == "OpenLayers.Layer.TMS"){ |
| 3910 | -temp = i3GEO.editorOL.layersClonados(ativo[0].layername); | |
| 3911 | -if(temp != ""){ | |
| 3912 | -temp.setVisibility(true); | |
| 3913 | -ativo = [temp]; | |
| 3914 | -} | |
| 3994 | +ativo = [i3GEO.editorOL.layertms2wms(ativo[0])]; | |
| 3915 | 3995 | } |
| 3916 | 3996 | event.object.layers = ativo; |
| 3917 | 3997 | botaoIdentifica.layers = ativo; | ... | ... |
mashups/openlayers_compacto.js.php
| ... | ... | @@ -3302,16 +3302,46 @@ ins.push(layers[i]); |
| 3302 | 3302 | } |
| 3303 | 3303 | return ins; |
| 3304 | 3304 | }, |
| 3305 | +//layers clonados sao copias WMS de layers TMS necessarios para realizar o getfeature | |
| 3306 | +//sao criados quando o layer e adicionado | |
| 3305 | 3307 | layersClonados: function(paramsLayers){ |
| 3306 | 3308 | var layers = i3GEO.editorOL.mapa.layers, |
| 3307 | 3309 | nlayers = layers.length,i; |
| 3308 | 3310 | for(i=0;i<nlayers;i++){ |
| 3309 | -if(layers[i].params.CLONETMS === paramsLayers){ | |
| 3311 | +if(layers[i].params && layers[i].params.CLONETMS === paramsLayers){ | |
| 3310 | 3312 | return(layers[i]); |
| 3311 | 3313 | } |
| 3312 | 3314 | } |
| 3313 | 3315 | return false; |
| 3314 | 3316 | }, |
| 3317 | +layertms2wms: function(tms){ | |
| 3318 | +var layer = new OpenLayers.Layer.WMS( | |
| 3319 | +tms.layername+"_clone", | |
| 3320 | +tms.url.replace("&cache=sim","&DESLIGACACHE=sim"), | |
| 3321 | +{ | |
| 3322 | +layers:tms.name, | |
| 3323 | +transparent:true | |
| 3324 | +}, | |
| 3325 | +{ | |
| 3326 | +gutter:0, | |
| 3327 | +isBaseLayer:false, | |
| 3328 | +displayInLayerSwitcher:false, | |
| 3329 | +opacity: 1, | |
| 3330 | +visibility:true, | |
| 3331 | +singleTile: true | |
| 3332 | +} | |
| 3333 | +); | |
| 3334 | +//i3GEO.editorOL.mapa.addLayer(layer); | |
| 3335 | +return layer; | |
| 3336 | +}, | |
| 3337 | +//remove o layer clonado com layertms2wms | |
| 3338 | +removeClone: function(){ | |
| 3339 | +var nome = i3GEO.editorOL.layerAtivo().layername+"_clone", | |
| 3340 | +busca = i3GEO.editorOL.mapa.getLayersByName(nome); | |
| 3341 | +if(busca.length > 0){ | |
| 3342 | +i3GEO.editorOL.mapa.removeLayer(i3GEO.editorOL.mapa.getLayersByName(camada.name)[0],false); | |
| 3343 | +} | |
| 3344 | +}, | |
| 3315 | 3345 | coordenadas: function(){ |
| 3316 | 3346 | // |
| 3317 | 3347 | //substitui o controle que mostra as coordenadas |
| ... | ... | @@ -3378,11 +3408,19 @@ catch(e){} |
| 3378 | 3408 | criaComboTemas: function(){ |
| 3379 | 3409 | var layers = i3GEO.editorOL.layersLigados(), |
| 3380 | 3410 | nlayers = layers.length, |
| 3381 | -i, | |
| 3382 | -combo = "<select id=i3GEOOLlistaTemasAtivos >"; | |
| 3411 | +i,nometema = "",temp, | |
| 3412 | +combo = "<select id=i3GEOOLlistaTemasAtivos style=width:235px; >"; | |
| 3383 | 3413 | //i3GEO.editorOL.layergrafico.setLayerIndex(i3GEO.editorOL.getNumLayers() + 1); |
| 3384 | 3414 | for(i=0;i<nlayers;i++){ |
| 3385 | -combo += "<option value='"+i+"' >"+layers[i].name+"</option>"; | |
| 3415 | +//pega o nome do tema | |
| 3416 | +nometema = ""; | |
| 3417 | +if(i3GEO.arvoreDeCamadas && i3GEO.arvoreDeCamadas.CAMADAS){ | |
| 3418 | +temp = i3GEO.arvoreDeCamadas.pegaTema(layers[i].name,"","name"); | |
| 3419 | +if(temp != ""){ | |
| 3420 | +nometema = temp.tema+" - "; | |
| 3421 | +} | |
| 3422 | +} | |
| 3423 | +combo += "<option value='"+i+"' >"+nometema + layers[i].name+"</option>"; | |
| 3386 | 3424 | } |
| 3387 | 3425 | combo += "</select>"; |
| 3388 | 3426 | return combo; |
| ... | ... | @@ -3428,6 +3466,7 @@ temp.onclick = function(){i3GEO.janela.minimiza("paneltemaativo");}; |
| 3428 | 3466 | } |
| 3429 | 3467 | else{ |
| 3430 | 3468 | YAHOO.temaativo.container.panel.show(); |
| 3469 | +i3GEO.editorOL.atualizaJanelaAtivaTema(); | |
| 3431 | 3470 | } |
| 3432 | 3471 | }, |
| 3433 | 3472 | ativaTema: function(id){ |
| ... | ... | @@ -3593,7 +3632,8 @@ fillColor: i3GEO.editorOL.simbologia.fillColor, |
| 3593 | 3632 | strokeWidth: i3GEO.editorOL.simbologia.strokeWidth, |
| 3594 | 3633 | strokeColor: i3GEO.editorOL.simbologia.strokeColor, |
| 3595 | 3634 | pointRadius: i3GEO.editorOL.simbologia.pointRadius, |
| 3596 | -graphicName: i3GEO.editorOL.simbologia.graphicName | |
| 3635 | +graphicName: i3GEO.editorOL.simbologia.graphicName, | |
| 3636 | +registros: f["attributes"] | |
| 3597 | 3637 | }; |
| 3598 | 3638 | } |
| 3599 | 3639 | i3GEO.editorOL.layergrafico.addFeatures(gml); |
| ... | ... | @@ -3609,7 +3649,6 @@ alert("Erro"); |
| 3609 | 3649 | salvaGeometrias: function(){ |
| 3610 | 3650 | var geos = i3GEO.editorOL.layergrafico.selectedFeatures, |
| 3611 | 3651 | n = geos.length, |
| 3612 | -janela, | |
| 3613 | 3652 | ins = ""; |
| 3614 | 3653 | if(n > 0){ |
| 3615 | 3654 | if($i("panelsalvageometrias")){ |
| ... | ... | @@ -3646,20 +3685,30 @@ exportarSHP: function(){ |
| 3646 | 3685 | i3GEO.editorOL.processageo("converteSHP"); |
| 3647 | 3686 | }, |
| 3648 | 3687 | listaGeometriasSel: function(){ |
| 3649 | -var geos = i3GEO.editorOL.layergrafico.selectedFeatures; | |
| 3650 | -var n = geos.length; | |
| 3651 | -var ins = "",i; | |
| 3688 | +var geos = i3GEO.editorOL.layergrafico.selectedFeatures, | |
| 3689 | +n = geos.length, | |
| 3690 | +ins = "",i,a,w; | |
| 3652 | 3691 | for(i=0;i<n;i++){ |
| 3653 | 3692 | ins += "<b>Geometria: "+i+"</b><br>"+geos[i].geometry+"<br><br>"; |
| 3654 | 3693 | ins += "<b>Atributos: "+i+"</b><br>"; |
| 3655 | -var a = geos[i].attributes; | |
| 3694 | +a = geos[i].attributes; | |
| 3656 | 3695 | for(key in a){ |
| 3657 | 3696 | if(a[key]){ |
| 3658 | 3697 | ins += key+" = "+a[key]+"<br>"; |
| 3659 | 3698 | } |
| 3660 | 3699 | } |
| 3700 | +//lista os registros se for fruto de uma captura | |
| 3701 | +if(geos[i].attributes.registros){ | |
| 3702 | +ins += "<b>Registros: "+i+"</b><br>"; | |
| 3703 | +a = geos[i].attributes.registros; | |
| 3704 | +for(key in a){ | |
| 3705 | +if(a[key]){ | |
| 3706 | +ins += key+" = "+a[key]+"<br>"; | |
| 3707 | +} | |
| 3708 | +} | |
| 3709 | +} | |
| 3661 | 3710 | } |
| 3662 | -var w = window.open(); | |
| 3711 | +w = window.open(); | |
| 3663 | 3712 | w.document.write(ins); |
| 3664 | 3713 | w.document.close(); |
| 3665 | 3714 | }, |
| ... | ... | @@ -3667,19 +3716,61 @@ testeSalvar: function(){ |
| 3667 | 3716 | alert("Funcao nao disponivel. Defina o nome da funcao em i3GEO.editorOL.nomeFuncaoSalvar "); |
| 3668 | 3717 | }, |
| 3669 | 3718 | salvaGeo: function(){ |
| 3670 | -i3GEO.editorOL.testeSalvar(); | |
| 3671 | -return; | |
| 3672 | -//verifica se apenas uma geometria esta selecionada | |
| 3719 | +//i3GEO.editorOL.testeSalvar(); | |
| 3720 | +//return; | |
| 3721 | +var geos = i3GEO.editorOL.layergrafico.selectedFeatures, | |
| 3722 | +n = geos.length, | |
| 3723 | +funcaoOK = function(){ | |
| 3673 | 3724 | //verifica se a geometria contem o atributo que indica a coluna ou codigo unico |
| 3674 | -var funcaoOK = function(){ | |
| 3675 | -alert("oi"); | |
| 3725 | +if(geos[0].geometry){ | |
| 3726 | +var registros = "", | |
| 3727 | +valorunico = "", | |
| 3728 | +nometema = $i("editorOLcomboTemaEditavel").value, | |
| 3729 | +key,tema,redesenha,p; | |
| 3730 | +if(nometema == ""){ | |
| 3731 | +return; | |
| 3732 | +} | |
| 3733 | +tema = i3GEO.arvoreDeCamadas.pegaTema(nometema,"","name"); | |
| 3734 | +//o tema contem o indicador de qual e a coluna que contem o identificador unico | |
| 3735 | +if(geos[0].attributes.registros){ | |
| 3736 | +registros = geos[0].attributes.registros; | |
| 3737 | +for(key in registros){ | |
| 3738 | +if(registros[key] && key == tema.colunaidunico){ | |
| 3739 | +valorunico = registros[key]; | |
| 3740 | +} | |
| 3741 | +} | |
| 3742 | +} | |
| 3743 | +redesenha = function(retorno){ | |
| 3744 | +i3GEO.janela.fechaAguarde("aguardeSalvaPonto"); | |
| 3745 | +i3GEO.editorOL.layergrafico.removeFeatures(i3GEO.editorOL.layergrafico.selectedFeatures); | |
| 3746 | +i3GEO.Interface.atualizaTema("",nometema); | |
| 3747 | +}; | |
| 3748 | +i3GEO.janela.AGUARDEMODAL = true; | |
| 3749 | +i3GEO.janela.abreAguarde("aguardeSalvaPonto","Adicionando..."); | |
| 3750 | +i3GEO.janela.AGUARDEMODAL = false; | |
| 3751 | +//cria um novo registro | |
| 3752 | +if(valorunico == ""){ | |
| 3753 | +p = i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=adicionaGeometria&g_sid="+i3GEO.configura.sid; | |
| 3754 | +cpJSON.call(p,"foo",redesenha,"&tema="+nometema+"&wkt="+geos[0].geometry); | |
| 3755 | +} | |
| 3756 | +else{ | |
| 3757 | +//atualiza a geometria | |
| 3758 | +p = i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=atualizaGeometria&g_sid="+i3GEO.configura.sid; | |
| 3759 | +cpJSON.call(p,"foo",redesenha,"&idunico="+valorunico+"&tema="+nometema+"&wkt="+geos[0].geometry); | |
| 3760 | +} | |
| 3761 | +} | |
| 3676 | 3762 | }, |
| 3677 | 3763 | funcaoCombo = function(obj){ |
| 3678 | 3764 | $i("editorOLondeComboTemaEditavel").innerHTML = obj.dados; |
| 3679 | 3765 | }, |
| 3680 | 3766 | texto = "Salvar no tema:<br><div id=editorOLondeComboTemaEditavel ></div><br><br>"; |
| 3767 | +if(n != 1){ | |
| 3768 | +i3GEO.janela.tempoMsg("Selecione apenas uma figura"); | |
| 3769 | +} | |
| 3770 | +else{ | |
| 3681 | 3771 | i3GEO.janela.confirma(texto,300,"Salva","Cancela",funcaoOK); |
| 3682 | 3772 | i3GEO.util.comboTemas("editorOLcomboTemaEditavel",funcaoCombo,"editorOLondeComboTemaEditavel","",false,"editavel"); |
| 3773 | +} | |
| 3683 | 3774 | }, |
| 3684 | 3775 | criaBotoes: function(botoes){ |
| 3685 | 3776 | var sketchSymbolizers = { |
| ... | ... | @@ -3852,19 +3943,11 @@ type: OpenLayers.Control.TYPE_TOOL, |
| 3852 | 3943 | displayClass: "editorOLidentifica", |
| 3853 | 3944 | eventListeners: { |
| 3854 | 3945 | getfeatureinfo: function(event) { |
| 3855 | -var ativo = [i3GEO.editorOL.layerAtivo()]; | |
| 3856 | -//se for TMS tem de pegar o clone wms | |
| 3857 | -if(ativo[0].CLASS_NAME == "OpenLayers.Layer.TMS"){ | |
| 3858 | -temp = i3GEO.editorOL.layersClonados(ativo[0].layername); | |
| 3859 | -if(temp != ""){ | |
| 3860 | -temp.setVisibility(false); | |
| 3861 | -} | |
| 3862 | -} | |
| 3863 | 3946 | var lonlat = i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy), |
| 3864 | 3947 | lonlattexto = "<hr>", |
| 3865 | 3948 | formata; |
| 3866 | 3949 | if( botoes.linha === true || botoes.ponto === true || botoes.poligono === true || botoes.edita === true){ |
| 3867 | -lonlattexto += "<pre><span style=color:blue;cursor:pointer onclick='i3GEO.editorOL.captura(\""+lonlat.lon+","+lonlat.lat+"\")'>captura</span></pre>"; | |
| 3950 | +lonlattexto += "<pre><span style=font-size:12px;color:blue;cursor:pointer onclick='i3GEO.editorOL.captura(\""+lonlat.lon+","+lonlat.lat+"\")'>edita geometria</span></pre><br>"; | |
| 3868 | 3951 | } |
| 3869 | 3952 | formata = function(texto){ |
| 3870 | 3953 | var temp, |
| ... | ... | @@ -3898,20 +3981,17 @@ i3GEO.editorOL.mapa.addPopup(new OpenLayers.Popup.FramedCloud( |
| 3898 | 3981 | "chicken", |
| 3899 | 3982 | i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy), |
| 3900 | 3983 | null, |
| 3901 | -lonlattexto+"<pre>"+formata(event.text)+"</pre>", | |
| 3984 | +"<div style=text-align:left >"+lonlattexto+"<pre>"+formata(event.text)+"</pre></div>", | |
| 3902 | 3985 | null, |
| 3903 | 3986 | true |
| 3904 | 3987 | )); |
| 3988 | +i3GEO.editorOL.removeClone(); | |
| 3905 | 3989 | }, |
| 3906 | 3990 | beforegetfeatureinfo: function(event){ |
| 3907 | 3991 | var temp,ativo = [i3GEO.editorOL.layerAtivo()]; |
| 3908 | 3992 | //se for TMS tem de pegar o clone wms |
| 3909 | 3993 | if(ativo[0].CLASS_NAME == "OpenLayers.Layer.TMS"){ |
| 3910 | -temp = i3GEO.editorOL.layersClonados(ativo[0].layername); | |
| 3911 | -if(temp != ""){ | |
| 3912 | -temp.setVisibility(true); | |
| 3913 | -ativo = [temp]; | |
| 3914 | -} | |
| 3994 | +ativo = [i3GEO.editorOL.layertms2wms(ativo[0])]; | |
| 3915 | 3995 | } |
| 3916 | 3996 | event.object.layers = ativo; |
| 3917 | 3997 | botaoIdentifica.layers = ativo; | ... | ... |
temas/_llocali.map
| 1 | 1 | MAP |
| 2 | - FONTSET "../symbols/fontes.txt" | |
| 3 | - SYMBOLSET "../symbols/simbolosv6.sym" | |
| 4 | - LAYER | |
| 5 | - CONNECTION "" | |
| 6 | - DATA "/var/www/i3geo/aplicmap/dados/locali.shp" | |
| 7 | - #FILTER (('[ESTADO]' = 'GO')) | |
| 8 | - METADATA | |
| 9 | - "METAESTAT_ID_MEDIDA_VARIAVEL" "" | |
| 10 | - "cache" "nao" | |
| 11 | - "LTEMPOITEMIMAGEM" "" | |
| 12 | - "TIP" "TIPO,ANOCRIA,NOMELOC" | |
| 13 | - "LTEMPOITEMDESCRICAO" "TIPO" | |
| 14 | - "CLASSE" "SIM" | |
| 15 | - "palletestep" "" | |
| 16 | - "LTEMPOITEMINICIO" "ANOCRIA" | |
| 17 | - "temporizador" "" | |
| 18 | - "LTEMPOITEMTIP" "ANOCRIA" | |
| 19 | - "permitekmz" "sim" | |
| 20 | - "description_template" "" | |
| 21 | - "LTEMPOITEMTITULO" "NOMELOC" | |
| 22 | - "iconetema" "" | |
| 23 | - "LTEMPOITEMLINK" "" | |
| 24 | - "METAESTAT_CODIGO_TIPO_REGIAO" "" | |
| 25 | - "palletefile" "" | |
| 26 | - "LTEMPOFORMATODATA" "iso8601" | |
| 27 | - "permitedownload" "sim" | |
| 28 | - "LTEMPOITEMICONE" "" | |
| 29 | - "permitecomentario" "" | |
| 30 | - "metaestat" "" | |
| 31 | - "download" "SIM" | |
| 32 | - "itembuscarapida" "NOMELOC" | |
| 33 | - "arquivokmz" "" | |
| 34 | - "arquivodownload" "" | |
| 35 | - "transitioneffect" "NAO" | |
| 36 | - "permiteogc" "sim" | |
| 37 | - "permitekml" "sim" | |
| 38 | - "convcaracter" "" | |
| 39 | - "TEMA" "Localidades (usar com timeline)" | |
| 40 | - "LTEMPOCONVENCODE" "SIM" | |
| 41 | - "editorsql" "" | |
| 42 | - "legendaimg" "" | |
| 43 | - "LTEMPOITEMFIM" "" | |
| 44 | - END # METADATA | |
| 45 | - NAME "_llocali" | |
| 46 | - STATUS DEFAULT | |
| 47 | - TEMPLATE "none.htm" | |
| 48 | - TILEITEM "location" | |
| 49 | - TYPE POINT | |
| 50 | - UNITS METERS | |
| 51 | - CLASS | |
| 52 | - NAME "Vila" | |
| 53 | - EXPRESSION ('[TIPO]'eq'Vila') | |
| 54 | - STYLE | |
| 55 | - ANGLE 0 | |
| 56 | - COLOR 250 193 4 | |
| 57 | - OFFSET 0 0 | |
| 58 | - SIZE 20 | |
| 59 | - SYMBOL "/var/www/i3geo/imagens/google/condominium.png" | |
| 60 | - END # STYLE | |
| 61 | - END # CLASS | |
| 62 | - CLASS | |
| 63 | - NAME "Cidade" | |
| 64 | - EXPRESSION ('[TIPO]'eq'Cidade') | |
| 65 | - STYLE | |
| 66 | - ANGLE 0 | |
| 67 | - COLOR 62 9 41 | |
| 68 | - OFFSET 0 0 | |
| 69 | - SIZE 20 | |
| 70 | - SYMBOL "/var/www/i3geo/imagens/google/condominium1.png" | |
| 71 | - END # STYLE | |
| 72 | - END # CLASS | |
| 73 | - CLASS | |
| 74 | - NAME "Capital" | |
| 75 | - EXPRESSION ('[TIPO]'eq'Capital') | |
| 76 | - STYLE | |
| 77 | - ANGLE 0 | |
| 78 | - COLOR 112 203 244 | |
| 79 | - OFFSET 0 0 | |
| 80 | - SIZE 6 | |
| 81 | - SYMBOL "vila" | |
| 82 | - END # STYLE | |
| 83 | - END # CLASS | |
| 84 | - END # LAYER | |
| 2 | + FONTSET "../symbols/fontes.txt" | |
| 3 | + SYMBOLSET "../symbols/simbolosv6.sym" | |
| 4 | + LAYER | |
| 5 | + CONNECTION "" | |
| 6 | + DATA "/var/www/i3geo/aplicmap/dados/locali.shp" | |
| 7 | + #FILTER (('[ESTADO]' = 'GO')) | |
| 8 | + METADATA | |
| 9 | + "METAESTAT_ID_MEDIDA_VARIAVEL" "" | |
| 10 | + "cache" "nao" | |
| 11 | + "LTEMPOITEMIMAGEM" "" | |
| 12 | + "TIP" "TIPO,ANOCRIA,NOMELOC" | |
| 13 | + "LTEMPOITEMDESCRICAO" "TIPO" | |
| 14 | + "CLASSE" "SIM" | |
| 15 | + "palletestep" "" | |
| 16 | + "LTEMPOITEMINICIO" "ANOCRIA" | |
| 17 | + "temporizador" "" | |
| 18 | + "LTEMPOITEMTIP" "ANOCRIA" | |
| 19 | + "permitekmz" "sim" | |
| 20 | + "description_template" "" | |
| 21 | + "LTEMPOITEMTITULO" "NOMELOC" | |
| 22 | + "iconetema" "" | |
| 23 | + "LTEMPOITEMLINK" "" | |
| 24 | + "METAESTAT_CODIGO_TIPO_REGIAO" "" | |
| 25 | + "palletefile" "" | |
| 26 | + "LTEMPOFORMATODATA" "iso8601" | |
| 27 | + "permitedownload" "sim" | |
| 28 | + "LTEMPOITEMICONE" "" | |
| 29 | + "permitecomentario" "" | |
| 30 | + "metaestat" "" | |
| 31 | + "download" "SIM" | |
| 32 | + "itembuscarapida" "NOMELOC" | |
| 33 | + "arquivokmz" "" | |
| 34 | + "arquivodownload" "" | |
| 35 | + "transitioneffect" "NAO" | |
| 36 | + "permiteogc" "sim" | |
| 37 | + "permitekml" "sim" | |
| 38 | + "convcaracter" "" | |
| 39 | + "TEMA" "Localidades (usar com timeline)" | |
| 40 | + "LTEMPOCONVENCODE" "SIM" | |
| 41 | + "editorsql" "" | |
| 42 | + "legendaimg" "" | |
| 43 | + "LTEMPOITEMFIM" "" | |
| 44 | + END # METADATA | |
| 45 | + | |
| 46 | + NAME "_llocali" | |
| 47 | + STATUS DEFAULT | |
| 48 | + TEMPLATE "none.htm" | |
| 49 | + TILEITEM "location" | |
| 50 | + TYPE POINT | |
| 51 | + UNITS METERS | |
| 52 | + CLASS | |
| 53 | + NAME "Vila" | |
| 54 | + EXPRESSION ('[TIPO]'eq'Vila') | |
| 55 | + STYLE | |
| 56 | + ANGLE 0 | |
| 57 | + COLOR 250 193 4 | |
| 58 | + OFFSET 0 0 | |
| 59 | + SIZE 20 | |
| 60 | + SYMBOL "/var/www/i3geo/imagens/google/condominium.png" | |
| 61 | + END # STYLE | |
| 62 | + END # CLASS | |
| 63 | + CLASS | |
| 64 | + NAME "Cidade" | |
| 65 | + EXPRESSION ('[TIPO]'eq'Cidade') | |
| 66 | + STYLE | |
| 67 | + ANGLE 0 | |
| 68 | + COLOR 62 9 41 | |
| 69 | + OFFSET 0 0 | |
| 70 | + SIZE 20 | |
| 71 | + SYMBOL "/var/www/i3geo/imagens/google/condominium1.png" | |
| 72 | + END # STYLE | |
| 73 | + END # CLASS | |
| 74 | + CLASS | |
| 75 | + NAME "Capital" | |
| 76 | + EXPRESSION ('[TIPO]'eq'Capital') | |
| 77 | + STYLE | |
| 78 | + ANGLE 0 | |
| 79 | + COLOR 112 203 244 | |
| 80 | + OFFSET 0 0 | |
| 81 | + SIZE 6 | |
| 82 | + SYMBOL "vila" | |
| 83 | + END # STYLE | |
| 84 | + END # CLASS | |
| 85 | + END # LAYER | |
| 85 | 86 | |
| 86 | 87 | END # MAP |
| 87 | 88 | ... | ... |