From a4ad749ae47403a37dc512a41d174c21b965eb91 Mon Sep 17 00:00:00 2001 From: Edmar Moretti Date: Thu, 2 Jun 2011 02:43:28 +0000 Subject: [PATCH] --- admin/admin.db | Bin 71680 -> 0 bytes classesjs/classe_barradebotoes.js | 3 ++- classesphp/classe_mapa.php | 7 ++++--- mashups/openlayers.css | 12 ++++++++++++ mashups/openlayers.js.php | 190 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------- mashups/openlayers.php | 8 ++++++-- mashups/openlayers.png | Bin 21026 -> 0 bytes versao.php | 2 +- 8 files changed, 176 insertions(+), 46 deletions(-) diff --git a/admin/admin.db b/admin/admin.db index 2e825db..d46b5db 100644 Binary files a/admin/admin.db and b/admin/admin.db differ diff --git a/classesjs/classe_barradebotoes.js b/classesjs/classe_barradebotoes.js index fa0444c..fc36cfb 100644 --- a/classesjs/classe_barradebotoes.js +++ b/classesjs/classe_barradebotoes.js @@ -1088,7 +1088,8 @@ i3GEO.barraDeBotoes = { 'salva':true, 'ajuda':true, 'fecha':true, - 'uniao':true + 'tools':true, + 'undo':true }; i3GEO.editorOL.layergrafico = new OpenLayers.Layer.Vector("Edição",{displayInLayerSwitcher:false,visibility:true}); i3GEO.editorOL.mapa.addLayers([i3GEO.editorOL.layergrafico]); diff --git a/classesphp/classe_mapa.php b/classesphp/classe_mapa.php index 769b92b..c9147a6 100644 --- a/classesphp/classe_mapa.php +++ b/classesphp/classe_mapa.php @@ -1205,7 +1205,8 @@ Include: $epsg = "EPSG:4291"; $e4291 = "nao"; $ecrs = "nao"; - $pos = explode(",",$proj); + $pos = str_replace(" ",",",$proj); + $pos = explode(",",$pos); if (count($pos) > 1) { foreach ($pos as $p) @@ -1216,12 +1217,12 @@ Include: if ($p[1] == "4291") {$epsg = "EPSG:4291";$e4291="sim";} if ($p[1] == "84") - {$ecrs = "CRS:84";} + {$ecrs = "CRS:84";$ecrs = "sim";} } } else {$epsg = $proj;} if ($e4291 == "sim"){$epsg = "EPSG:4291";} - if ($ecrs !== "sim"){$epsg = $ecrs;} + if ($ecrs == "sim"){$epsg = $ecrs;} $epsg = trim($epsg); $layer->setmetadata("wms_srs",$epsg); $layer->setmetadata("wms_crs",$epsg); diff --git a/mashups/openlayers.css b/mashups/openlayers.css index 0106be6..29d36cf 100644 --- a/mashups/openlayers.css +++ b/mashups/openlayers.css @@ -118,6 +118,18 @@ background-position:-522px -28px; .olControlEditingToolbar1 .editorOLuniaoItemActive { background-position:-551px -28px; } +.olControlEditingToolbar1 .editorOLtoolsItemInactive { + background-position:-580px 0; +} +.olControlEditingToolbar1 .editorOLtoolsItemActive { + background-position:-580px -28px; +} +.olControlEditingToolbar1 .editorOLundoItemInactive { + background-position:-609px 0; +} +.olControlEditingToolbar1 .editorOLundoItemActive { + background-position:-609px -28px; +} .olControlEditingToolbar1 { width:600px; float:right; diff --git a/mashups/openlayers.js.php b/mashups/openlayers.js.php index 59d18bd..abb4c1e 100644 --- a/mashups/openlayers.js.php +++ b/mashups/openlayers.js.php @@ -10,6 +10,7 @@ if (app==='N'){navn=true;}else{navm=true;} OpenLayers.ImgPath = "../pacotes/openlayers/img/"; OpenLayers.Lang.setCode("pt-BR"); i3GEO.editorOL = { + backup: new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false}), nomeFuncaoSalvar: "i3GEO.editorOL.testeSalvar()", ol_mma: new OpenLayers.Layer.WMS( "Base cartográfica", @@ -59,7 +60,9 @@ i3GEO.editorOL = { 'salva':true, 'ajuda':true, 'propriedades':true, - 'fecha':false + 'fecha':false, + 'tools':false, + 'undo':false }, pontos: [], marca: "../pacotes/openlayers/img/marker-gold.png", @@ -465,19 +468,32 @@ i3GEO.editorOL = { new OpenLayers.Rule({symbolizer: sketchSymbolizers}) ]); i3GEOpanelEditor = new OpenLayers.Control.Panel({ - displayClass: "olControlEditingToolbar1 noprint" + displayClass: "olControlEditingToolbar1 noprint", + saveState: true, + activateControl: function(c){ + this.deactivate(); + this.activate(); + try{ + i3GEO.editorOL.ModifyFeature.deactivate(); + } + catch(e){} + if(!c.type) + {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: "Procurar" + title: "procura" }); controles.push(button); adiciona = true; } if(botoes.pan===true){ - controles.push(new OpenLayers.Control.Navigation({title: "Deslocar",displayClass:"editorOLpan"})); + controles.push(new OpenLayers.Control.Navigation({title: "deslocar",displayClass:"editorOLpan"})); adiciona = true; } if(botoes.zoombox===true){ @@ -488,7 +504,7 @@ i3GEO.editorOL = { button = new OpenLayers.Control.Button({ displayClass: "editorOLzoomtot", trigger: function(){i3GEO.editorOL.mapa.zoomToMaxExtent();}, - title: "Ajusta extensão" + title: "ajusta extensão" }); controles.push(button); adiciona = true; @@ -497,7 +513,7 @@ i3GEO.editorOL = { button = new OpenLayers.Control.Button({ displayClass: "editorOLlegenda", trigger: function(){i3GEO.editorOL.mostraLegenda();}, - title: "Legenda" + title: "legenda" }); controles.push(button); adiciona = true; @@ -509,7 +525,7 @@ i3GEO.editorOL = { handlerOptions: {layerOptions: {styleMap: styleMap}}, persist: true, displayClass: "editorOLdistancia", - title: "Distância" + title: "distância" } ); button.events.on({ @@ -529,7 +545,7 @@ i3GEO.editorOL = { handlerOptions: {layerOptions: {styleMap: styleMap}}, persist: true, displayClass: "editorOLarea", - title: "Área" + title: "área" } ); button.events.on({ @@ -548,7 +564,7 @@ i3GEO.editorOL = { infoFormat:'text/plain', //'application/vnd.ogc.gml', layers: [i3GEO.editorOL.layerAtivo()], queryVisible: true, - title: "Identificar", + title: "identifica", displayClass: "editorOLidentifica", eventListeners: { getfeatureinfo: function(event) { @@ -609,25 +625,28 @@ i3GEO.editorOL = { adiciona = true; } if(botoes.edita===true){ - button = new OpenLayers.Control.ModifyFeature( + i3GEO.editorOL.ModifyFeature = new OpenLayers.Control.ModifyFeature( i3GEO.editorOL.layergrafico, { displayClass: "editorOLedita", - title: "edita elemento" + title: "modifica figura", + //onModification: function(evt){alert("oi");i3GEO.editorOL.guardaBackup();}, + clickout: true, + toggle: true, + mode: OpenLayers.Control.ModifyFeature.RESHAPE } ); - controles.push(button); + controles.push(i3GEO.editorOL.ModifyFeature); adiciona = true; } //só funciona dentro do i3geo - if(botoes.uniao===true && i3GEO.php){ + if(botoes.tools===true && i3GEO.php){ button = new OpenLayers.Control.Button({ - displayClass: "editorOLuniao", + displayClass: "editorOLtools", trigger: function(){ - //i3GEO.editorOL.carregajts("i3GEO.editorOL.uniao()"); - i3GEO.editorOL.uniao(); + i3GEO.editorOL.ferramentas(); }, - title: "Une geometrias" + title: "ferramentas" }); controles.push(button); adiciona = true; @@ -657,13 +676,24 @@ i3GEO.editorOL = { trigger: function(){ if(i3GEO.editorOL.layergrafico.selectedFeatures.length > 0){ var x = window.confirm("Exclui os elementos selecionados?"); - if(x) - {i3GEO.editorOL.layergrafico.removeFeatures(i3GEO.editorOL.layergrafico.selectedFeatures);} + if(x){ + i3GEO.editorOL.guardaBackup(); + i3GEO.editorOL.layergrafico.removeFeatures(i3GEO.editorOL.layergrafico.selectedFeatures); + } } else {alert("Selecione pelo menos um elemento");} }, - title: "Apaga selecionados" + title: "apaga selecionados" + }); + controles.push(button); + adiciona = true; + } + if(botoes.undo===true){ + button = new OpenLayers.Control.Button({ + displayClass: "editorOLundo", + trigger: function(){i3GEO.editorOL.restauraBackup();}, + title: "recupera" }); controles.push(button); adiciona = true; @@ -672,7 +702,7 @@ i3GEO.editorOL = { button = new OpenLayers.Control.Button({ displayClass: "editorOLpropriedades", trigger: function(){i3GEO.editorOL.propriedades();}, - title: "Propriedades" + title: "propriedades" }); controles.push(button); adiciona = true; @@ -681,7 +711,7 @@ i3GEO.editorOL = { button = new OpenLayers.Control.Button({ displayClass: "editorOLsalva", trigger: function(){i3GEO.editorOL.salvaGeometrias();}, - title: "Salvar" + title: "salva" }); controles.push(button); adiciona = true; @@ -695,7 +725,7 @@ i3GEO.editorOL = { catch(e) {window.open("openlayers_ajuda.php");} }, - title: "Ajuda" + title: "ajuda" }); controles.push(button); adiciona = true; @@ -710,7 +740,7 @@ i3GEO.editorOL = { i3GEO.editorOL.mapa.removeLayer(i3GEO.editorOL.layergrafico); } }, - title: "Fechar editor" + title: "fecha editor" }); controles.push(button); adiciona = true; @@ -718,12 +748,15 @@ i3GEO.editorOL = { // //controle que permite o snap // - i3GEOOLsnap = new OpenLayers.Control.Snapping({layer: i3GEO.editorOL.layergrafico}); + 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); } @@ -787,7 +820,7 @@ i3GEO.editorOL = { YAHOO.namespace("editorOL.container"); YAHOO.editorOL.container.panel = new YAHOO.widget.Panel("panelpropriedadesEditor", {zIndex:20000, iframe:true, width:"350px", visible:false, draggable:true, close:true } ); var ins = "" + - '

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

' + + '

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

' + '' + ' ' + ' ' + @@ -799,12 +832,25 @@ i3GEO.editorOL = { ' ' + '
vérticeborda
' + '
' + - '

Divide intersecção ao digitalizar

' + + '

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
");} @@ -829,6 +875,46 @@ i3GEO.editorOL = { } YAHOO.editorOL.container.panel.show(); }, + 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'; + '

Seleciona 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"], @@ -854,7 +940,8 @@ i3GEO.editorOL = { if(temp.checked === true) {i3GEOOLsplit.activate();} }, - uniao: function(){ + processageo: function(operacao){ + if(operacao === ""){return;} var geosel = i3GEO.editorOL.layergrafico.selectedFeatures, fwkt = new OpenLayers.Format.WKT(), polis,linhas,pontos,uniaopolis,uniaolinhas,uniaopontos,n,i,temp; @@ -866,20 +953,20 @@ i3GEO.editorOL = { i3GEO.janela.fechaAguarde("i3GEO.editorPoli"); i3GEO.janela.fechaAguarde("i3GEO.editorLinhas"); i3GEO.janela.fechaAguarde("i3GEO.editorPontos"); - if(retorno.data) + if(retorno != "" && retorno.data && retorno.data != "") {i3GEO.editorOL.substituiFeaturesSel(retorno.data);} } - if(polis){ + if(polis.length > 0){ i3GEO.janela.abreAguarde("i3GEO.editorPoli","Poligonos"); - i3GEO.php.funcoesGeometriasWkt(temp,polis.join("|"),"union"); + i3GEO.php.funcoesGeometriasWkt(temp,polis.join("|"),operacao); } - if(linhas){ + if(linhas.length > 0){ i3GEO.janela.abreAguarde("i3GEO.editorLinhas","Linhas"); - i3GEO.php.funcoesGeometriasWkt(temp,linhas.join("|"),"union"); + i3GEO.php.funcoesGeometriasWkt(temp,linhas.join("|"),operacao); } - if(pontos){ + if(pontos.length > 0){ i3GEO.janela.abreAguarde("i3GEO.editorPontos","Pontos"); - i3GEO.php.funcoesGeometriasWkt(temp,pontos.join("|"),"union"); + i3GEO.php.funcoesGeometriasWkt(temp,pontos.join("|"),operacao); } return; /* @@ -932,10 +1019,35 @@ i3GEO.editorOL = { } return lista; }, + guardaBackup: function(){ + i3GEO.editorOL.backup = new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false}) + //i3GEO.editorOL.backup.removeFeatures(i3GEO.editorOL.backup.features); + i3GEO.editorOL.backup.addFeatures(i3GEO.editorOL.layergrafico.features); + i3GEO.editorOL.unselTodos(); + }, + unselTodos:function(){ + var n,i,temp; + n = i3GEO.editorOL.backup.features.length; + for(i=0;i 0){ + i3GEO.editorOL.layergrafico.removeFeatures(i3GEO.editorOL.layergrafico.features); + i3GEO.editorOL.layergrafico.addFeatures(i3GEO.editorOL.backup.features); + } + //i3GEO.editorOL.backup.removeFeatures(i3GEO.editorOL.backup.features); + }, substituiFeaturesSel: function(wkt){ - var fwkt = new OpenLayers.Format.WKT(); - i3GEO.editorOL.layergrafico.removeFeatures(i3GEO.editorOL.layergrafico.selectedFeatures); - i3GEO.editorOL.layergrafico.addFeatures([fwkt.read(wkt)]); + i3GEO.editorOL.guardaBackup(); + try{ + var fwkt = new OpenLayers.Format.WKT(); + i3GEO.editorOL.layergrafico.removeFeatures(i3GEO.editorOL.layergrafico.selectedFeatures); + i3GEO.editorOL.layergrafico.addFeatures([fwkt.read(wkt)]); + } + catch(e) + {i3GEO.editorOL.restauraBackup();} }, flashFeatures: function(features, index) { if(!index) { diff --git a/mashups/openlayers.php b/mashups/openlayers.php index f9731bc..36a2a64 100644 --- a/mashups/openlayers.php +++ b/mashups/openlayers.php @@ -65,8 +65,6 @@ if(isset($botoes)){ {$objBotoes[] = "'poligono':true";} if(in_array("edita",$botoes)) {$objBotoes[] = "'edita':true";} - if(in_array("uniao",$botoes)) - {$objBotoes[] = "'uniao':true";} if(in_array("apaga",$botoes)) {$objBotoes[] = "'apaga':true";} if(in_array("procura",$botoes)) @@ -77,6 +75,10 @@ if(isset($botoes)){ {$objBotoes[] = "'ajuda':true";} if(in_array("fecha",$botoes)) {$objBotoes[] = "'fecha':true";} + if(in_array("tools",$botoes)) + {$objBotoes[] = "'tools':true";} + if(in_array("undo",$botoes)) + {$objBotoes[] = "'undo':true";} if(in_array("propriedades",$botoes)) {$objBotoes[] = "'propriedades':true";} $botoes = "{".implode(",",$objBotoes)."}"; @@ -179,6 +181,8 @@ Parâmetros: captura procura propriedades + tools + undo salva ajuda fecha diff --git a/mashups/openlayers.png b/mashups/openlayers.png index 98a4763..2974d56 100644 Binary files a/mashups/openlayers.png and b/mashups/openlayers.png differ diff --git a/versao.php b/versao.php index 5aa564c..a3c14f3 100644 --- a/versao.php +++ b/versao.php @@ -2,5 +2,5 @@ /* Utilizado como um include em ms_configura.php */ -$mensagemInicia = 'Versão 4.5 - Revisão SVN 2014'; +$mensagemInicia = 'Versão 4.5 - SP3 - Revisão SVN '; ?> \ No newline at end of file -- libgit2 0.21.2