From 28cecf2e816fa449ac090887c621c9c9b83708dc Mon Sep 17 00:00:00 2001 From: Edmar Moretti Date: Mon, 28 Sep 2015 11:08:49 +0000 Subject: [PATCH] - --- ferramentas/editorol/editorol.js | 377 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- js/analise.js | 3 +-- js/barradebotoes.js | 15 ++++++++------- js/configura.js | 10 +--------- 4 files changed, 169 insertions(+), 236 deletions(-) diff --git a/ferramentas/editorol/editorol.js b/ferramentas/editorol/editorol.js index 5a11137..5858565 100755 --- a/ferramentas/editorol/editorol.js +++ b/ferramentas/editorol/editorol.js @@ -165,6 +165,8 @@ i3GEO.editorOL = fundo : "e_ims,e_wsm,ol_mma,ol_wms,top_wms", kml : [], layersIniciais : [], + //essa configuracao dos botoes afeta apenas o mashup + //para a configuração do editor dentro de um mapa normal, veja i3GEO.barraDebotoes.editor.ativaPainel() botoes : { 'pan' : true, 'zoombox' : true, @@ -359,10 +361,11 @@ i3GEO.editorOL = i3GEO.desenho.openlayers.criaLayerGrafico(); }, layersLigados : function() { - var layers = i3GEO.editorOL.mapa.layers, nlayers = layers.length, ins = [], i; + var l, layers = i3GEO.editorOL.mapa.getLayers(), nlayers = layers.getLength(), ins = [], i; for (i = 0; i < nlayers; i++) { - if (layers[i].visibility === true) { - ins.push(layers[i]); + l = layers.item(i); + if (l.getVisible() === true) { + ins.push(l); } } return ins; @@ -668,13 +671,15 @@ i3GEO.editorOL = i3GEO.editorOL.mapa.zoomToExtent(b); }, mostraLegenda : function() { + //TODO testar no mashup var layers = i3GEO.editorOL.layersLigados(), nlayers = layers.length, ins = "", i, icone = "", url, fers, f = "", fer = ""; for (i = 0; i < nlayers; i++) { try { - if (layers[i].isBaseLayer === false) { + if (layers[i].get("isBaseLayer") === false) { url = layers[i].getFullRequestString({ "request" : "getlegendgraphic" }); + //i3GEO.editorOL.mapa.getLayers().item(0).getSource().getUrls()[0] icone = ""; if (i3GEO.editorOL.legendahtml === true) { // os parametros FORMAT e SERVICE sao inseridos de forma redundante para grantir @@ -1015,236 +1020,90 @@ i3GEO.editorOL = i3GEOpanelEditor.appendChild(temp); largura += 30; } - i3GEOpanelEditor.style.width = largura + "px"; - //i3GEO.editorOL.mapa.getTargetElement().appendChild(i3GEOpanelEditor); - //i3GEO.editorOL.mapa.getViewport().appendChild(i3GEOpanelEditor); - i3GEO.editorOL.mapa.getViewport().getElementsByClassName("ol-overlaycontainer-stopevent")[0].appendChild(i3GEOpanelEditor); - - /* - i3GEOpanelEditor = new OpenLayers.Control.Panel({ - displayClass : "olControlEditingToolbar1 noprint", - saveState : false, - activateControl : function(c) { - this.deactivate(); - this.activate(); - try { - i3GEO.editorOL.ModifyFeature.deactivate(); - if (i3GEO && i3GEO.barraDeBotoes) { - i3GEO.barraDeBotoes.ativaPadrao(); - } - } catch (e) { - } - if (!c.trigger) { - c.activate(); - } else { - c.trigger.call(); - } - } - }); - if (botoes.procura === false) { - button = new OpenLayers.Control.Button({ - displayClass : "editorOLprocura", - trigger : function() { - YAHOO.procura.container.panel.show(); - }, - title : $trad("t23"), - type : OpenLayers.Control.TYPE_BUTTON - }); - controles.push(button); - adiciona = true; - } if (botoes.pan === true) { - controles.push(new OpenLayers.Control.Navigation({ - title : "pan", - displayClass : "editorOLpan", - type : OpenLayers.Control.TYPE_TOOL - })); - adiciona = true; + temp = document.createElement("div"); + temp.className = "editorOLpanItemInactive olButton"; + temp.title = "pan"; + temp.onclick = function(){ + }; + i3GEOpanelEditor.appendChild(temp); + largura += 30; } if (botoes.zoombox === true) { - controles.push(new OpenLayers.Control.ZoomBox({ - title : "zoombox", - displayClass : "editorOLzoombox", - type : OpenLayers.Control.TYPE_TOOL - })); - adiciona = true; + temp = document.createElement("div"); + temp.className = "editorOLzoomboxItemInactive olButton"; + temp.title = "zoombox"; + temp.onclick = i3GEO.barraDeBotoes.defBotao("zoomli").funcaoonclick; + i3GEOpanelEditor.appendChild(temp); + largura += 30; } if (botoes.zoomtot === true) { - button = new OpenLayers.Control.Button({ - displayClass : "editorOLzoomtot", - trigger : function() { - if (i3GEO.editorOL.mapext && i3GEO.editorOL.mapext != "") { - i3GEO.editorOL.mapa.zoomToExtent(i3GEO.editorOL.mapext); - } else { - i3GEO.editorOL.mapa.zoomToMaxExtent(); - } - }, - title : $trad("d2t"), - type : OpenLayers.Control.TYPE_BUTTON - }); - controles.push(button); - adiciona = true; + temp = document.createElement("div"); + temp.className = "editorOLzoomtotItemInactive olButton"; + temp.title = $trad("d2t"); + temp.onclick = function(){ + if (i3GEO.editorOL.mapext && i3GEO.editorOL.mapext != "") { + i3GEO.Interface.openlayers.zoom2ext(i3GEO.editorOL.mapext.join(" ")); + } else { + i3GEO.Interface.openlayers.zoom2ext(i3GEO.parametros.extentTotal); + } + }; + i3GEOpanelEditor.appendChild(temp); + largura += 30; } if (botoes.zoomin === true) { - button = new OpenLayers.Control.Button({ - displayClass : "editorOLzoomin", - trigger : function() { - i3GEO.editorOL.mapa.zoomIn(); - }, - title : $trad("d5t"), - type : OpenLayers.Control.TYPE_BUTTON - }); - controles.push(button); - adiciona = true; + temp = document.createElement("div"); + temp.className = "editorOLzoominItemInactive olButton"; + temp.title = $trad("d5t"); + temp.onclick = function(){ + var v = i3GEO.editorOL.mapa.getView(); + v.setZoom(v.getZoom() + 1); + }; + i3GEOpanelEditor.appendChild(temp); + largura += 30; } if (botoes.zoomout === true) { - button = new OpenLayers.Control.Button({ - displayClass : "editorOLzoomout", - trigger : function() { - i3GEO.editorOL.mapa.zoomOut(); - }, - title : $trad("d6t"), - type : OpenLayers.Control.TYPE_BUTTON - }); - controles.push(button); - adiciona = true; + temp = document.createElement("div"); + temp.className = "editorOLzoomoutItemInactive olButton"; + temp.title = $trad("d5t"); + temp.onclick = function(){ + var v = i3GEO.editorOL.mapa.getView(); + v.setZoom(v.getZoom() - 1); + }; + i3GEOpanelEditor.appendChild(temp); + largura += 30; } if (botoes.legenda === true) { - button = new OpenLayers.Control.Button({ - displayClass : "editorOLlegenda", - trigger : function() { - i3GEO.editorOL.mostraLegenda(); - }, - title : $trad("p3"), - type : OpenLayers.Control.TYPE_BUTTON - }); - controles.push(button); - adiciona = true; + temp = document.createElement("div"); + temp.className = "editorOLlegendaItemInactive olButton"; + temp.title = $trad("p3"); + temp.onclick = function(){ + i3GEO.editorOL.mostraLegenda(); + }; + i3GEOpanelEditor.appendChild(temp); + largura += 30; } if (botoes.distancia === true) { - button = new OpenLayers.Control.Measure(OpenLayers.Handler.Path, { - handlerOptions : { - layerOptions : { - styleMap : styleMap - } - }, - persist : true, - displayClass : "editorOLdistancia", - title : $trad("d21t"), - type : OpenLayers.Control.TYPE_TOOL - }); - button.events.on({ - "measure" : function(event) { - var units = event.units, measure = event.measure; - alert($trad("d21t") + ": " + measure.toFixed(3) + " " + units); - } - }); - controles.push(button); - adiciona = true; + temp = document.createElement("div"); + temp.className = "editorOLdistanciaItemInactive olButton"; + temp.title = $trad("d21t"); + temp.onclick = i3GEO.barraDeBotoes.defBotao("mede").funcaoonclick; + i3GEOpanelEditor.appendChild(temp); + largura += 30; } if (botoes.area === true) { - button = new OpenLayers.Control.Measure(OpenLayers.Handler.Polygon, { - handlerOptions : { - layerOptions : { - styleMap : styleMap - } - }, - persist : true, - displayClass : "editorOLarea", - title : $trad("d21at"), - type : OpenLayers.Control.TYPE_TOOL - }); - button.events.on({ - "measure" : function(event) { - var units = event.units; - var measure = event.measure; - alert($trad("d21at") + ": " + measure.toFixed(3) + " " + units + "2"); - } - }); - controles.push(button); - adiciona = true; - } - if (botoes.identifica === true) { - //TODO incluir codigo ol3 - - botaoIdentifica = - new OpenLayers.Control.WMSGetFeatureInfo( - { - maxFeatures : 1, - infoFormat : 'text/plain', // 'application/vnd.ogc.gml', - layers : [ - i3GEO.editorOL.layerAtivo() - ], - queryVisible : true, - title : $trad("d7t"), - type : OpenLayers.Control.TYPE_TOOL, - displayClass : "editorOLidentifica", - eventListeners : { - getfeatureinfo : function(event) { - var lonlat = i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy), lonlattexto = "
", formata; - if (botoes.linha === true || botoes.ponto === true || botoes.poligono === true || botoes.edita === true) { - lonlattexto += - "
edita geometria

"; - } - formata = function(texto) { - var temp, temp1, n, i, f = [], textoN = texto.split(":"); - try { - if (textoN.length > 1) { - temp = textoN[2].replace(/\n\r/g, ""); - temp = temp.replace(/'/g, ""); - temp = temp.replace(/\n/g, "|"); - temp = temp.replace(/_/g, " "); - temp = temp.replace(/=/g, ":"); - temp = temp.split("|"); - n = temp.length; - for (i = 0; i < n; i++) { - temp1 = temp[i].replace(/^\s+/, ""); - temp1 = temp1.replace(/\s+$/, ""); - if (temp1 != "") - f.push(temp1); - } - texto = f.join("

"); - } - } catch (e) { - } - return texto; - }; - i3GEO.editorOL.mapa.addPopup(new OpenLayers.Popup.FramedCloud("chicken", i3GEO.editorOL.mapa - .getLonLatFromPixel(event.xy), null, "
" + lonlattexto - + "
"
-										+ formata(event.text)
-										+ "
", null, true)); - i3GEO.editorOL.removeClone(); - }, - beforegetfeatureinfo : function(event) { - var ativo = [ - i3GEO.editorOL.layerAtivo() - ]; - // se for TMS tem de pegar o clone wms - if (ativo[0].serviceVersion === "&tms=" || ativo[0].CLASS_NAME == "OpenLayers.Layer.TMS" - || ativo[0].CLASS_NAME == "OpenLayers.Layer.OSM") { - ativo = [ - i3GEO.editorOL.layertms2wms(ativo[0]) - ]; - } - ativo[0].projection = new OpenLayers.Projection("EPSG:4326"); - event.object.layers = ativo; - botaoIdentifica.layers = ativo; - botaoIdentifica.url = ativo[0].url; - }, - activate : function() { - i3GEO.editorOL.criaJanelaAtivaTema(); - } - } - }); - // button.events.register("getfeatureinfo", this, showInfo); - controles.push(botaoIdentifica); - adiciona = true; - + temp = document.createElement("div"); + temp.className = "editorOLareaItemInactive olButton"; + temp.title = $trad("d21at"); + temp.onclick = i3GEO.barraDeBotoes.defBotao("area").funcaoonclick; + i3GEOpanelEditor.appendChild(temp); + largura += 30; } + i3GEOpanelEditor.style.width = largura + "px"; + i3GEO.editorOL.mapa.getViewport().getElementsByClassName("ol-overlaycontainer-stopevent")[0].appendChild(i3GEOpanelEditor); + + /* + if (botoes.linha === true) { button = new OpenLayers.Control.DrawFeature(i3GEO.desenho.layergrafico, OpenLayers.Handler.Path, { @@ -1669,6 +1528,88 @@ i3GEO.editorOL = adiciona = true; } + if (botoes.identifica === true) { + //TODO incluir codigo ol3 + + botaoIdentifica = + new OpenLayers.Control.WMSGetFeatureInfo( + { + maxFeatures : 1, + infoFormat : 'text/plain', // 'application/vnd.ogc.gml', + layers : [ + i3GEO.editorOL.layerAtivo() + ], + queryVisible : true, + title : $trad("d7t"), + type : OpenLayers.Control.TYPE_TOOL, + displayClass : "editorOLidentifica", + eventListeners : { + getfeatureinfo : function(event) { + var lonlat = i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy), lonlattexto = "
", formata; + if (botoes.linha === true || botoes.ponto === true || botoes.poligono === true || botoes.edita === true) { + lonlattexto += + "
edita geometria

"; + } + formata = function(texto) { + var temp, temp1, n, i, f = [], textoN = texto.split(":"); + try { + if (textoN.length > 1) { + temp = textoN[2].replace(/\n\r/g, ""); + temp = temp.replace(/'/g, ""); + temp = temp.replace(/\n/g, "|"); + temp = temp.replace(/_/g, " "); + temp = temp.replace(/=/g, ":"); + temp = temp.split("|"); + n = temp.length; + for (i = 0; i < n; i++) { + temp1 = temp[i].replace(/^\s+/, ""); + temp1 = temp1.replace(/\s+$/, ""); + if (temp1 != "") + f.push(temp1); + } + texto = f.join("

"); + } + } catch (e) { + } + return texto; + }; + i3GEO.editorOL.mapa.addPopup(new OpenLayers.Popup.FramedCloud("chicken", i3GEO.editorOL.mapa + .getLonLatFromPixel(event.xy), null, "
" + lonlattexto + + "
"
+										+ formata(event.text)
+										+ "
", null, true)); + i3GEO.editorOL.removeClone(); + }, + beforegetfeatureinfo : function(event) { + var ativo = [ + i3GEO.editorOL.layerAtivo() + ]; + // se for TMS tem de pegar o clone wms + if (ativo[0].serviceVersion === "&tms=" || ativo[0].CLASS_NAME == "OpenLayers.Layer.TMS" + || ativo[0].CLASS_NAME == "OpenLayers.Layer.OSM") { + ativo = [ + i3GEO.editorOL.layertms2wms(ativo[0]) + ]; + } + ativo[0].projection = new OpenLayers.Projection("EPSG:4326"); + event.object.layers = ativo; + botaoIdentifica.layers = ativo; + botaoIdentifica.url = ativo[0].url; + }, + activate : function() { + i3GEO.editorOL.criaJanelaAtivaTema(); + } + } + }); + // button.events.register("getfeatureinfo", this, showInfo); + controles.push(botaoIdentifica); + adiciona = true; + + } + // // controle que permite o snap // diff --git a/js/analise.js b/js/analise.js index 0761ec6..828702e 100644 --- a/js/analise.js +++ b/js/analise.js @@ -1148,7 +1148,7 @@ i3GEO.analise = */ inicia : function() { var m = i3GEO.analise.medeArea.openlayers; - i3GEO.analise.openlayers.medeArea.estilo = new ol.style.Style({ + m.estilo = new ol.style.Style({ stroke: new ol.style.Stroke({ color: '#ffcc33', width: 5 @@ -1157,7 +1157,6 @@ i3GEO.analise = color: 'rgba(255, 153, 0, 0.8)' }) }); - i3GEO.desenho[i3GEO.Interface["ATUAL"]].inicia(); m.removeControle(); m.draw = new ol.interaction.Draw({ diff --git a/js/barradebotoes.js b/js/barradebotoes.js index 73834dd..5a35eda 100755 --- a/js/barradebotoes.js +++ b/js/barradebotoes.js @@ -944,7 +944,6 @@ i3GEO.barraDeBotoes = l = 0; for (i = 0; i < n; i += 1) { if (chaves[i] && i3GEO.barraDeBotoes.INCLUIBOTAO[chaves[i]] && i3GEO.barraDeBotoes.INCLUIBOTAO[chaves[i]] === true) { - botao = i3GEO.barraDeBotoes.defBotao(chaves[i]); if (botao === false || i3GEO.barraDeBotoes.AJUDA === false) { titulo = ""; @@ -1793,12 +1792,14 @@ i3GEO.barraDeBotoes = i3GEO.editorOL.maxext = ""; i3GEO.editorOL.controles = []; i3GEO.editorOL.botoes = { - 'pan' : false, - 'zoombox' : false, - 'zoomtot' : false, - 'legenda' : false, - 'distancia' : false, - 'area' : false, + 'zoomin' : true, + 'zoomout' : true, + 'pan' : true, + 'zoombox' : true, + 'zoomtot' : true, + 'legenda' : true, + 'distancia' : true, + 'area' : true, 'identifica' : true, 'linha' : true, 'ponto' : true, diff --git a/js/configura.js b/js/configura.js index 2136591..70f02ab 100755 --- a/js/configura.js +++ b/js/configura.js @@ -1240,12 +1240,6 @@ i3GEO.configura = i3GEO.Interface.googlemaps.zoom2extent(i3GEO.parametros.extentTotal); return; } - i3GEO.navega.zoomExt( - i3GEO.configura.locaplic, - i3GEO.configura.sid, - i3GEO.configura.tipoimagem, - i3GEO.parametros.extentTotal); - marcadorZoom = ""; } }, { @@ -1297,12 +1291,10 @@ i3GEO.configura = draggable : true }); i3GEO.util.mudaCursor(i3GEO.configura.cursores, "pointer", i3GEO.Interface.IDMAPA, i3GEO.configura.locaplic); - return; } if (i3GEO.Interface.ATUAL === "openlayers") { - i3GEO.util.mudaCursor(i3GEO.configura.cursores, "pointer", i3GEO.Interface.IDMAPA, i3GEO.configura.locaplic); + //i3GEO.util.mudaCursor(i3GEO.configura.cursores, "pointer", i3GEO.Interface.IDMAPA, i3GEO.configura.locaplic); // i3GEO.Interface.openlayers.OLpanel.activateControl(i3GEO.Interface.openlayers.OLzoom); - return; } } }, -- libgit2 0.21.2