From 9138c4bb7d07ce798c4bd02330d5f1a38ab05bba Mon Sep 17 00:00:00 2001 From: Edmar Moretti Date: Thu, 3 Sep 2015 04:43:19 +0000 Subject: [PATCH] --- ferramentas/googlemaps1/index.js | 5 ----- ferramentas/graficointerativo1/index.js | 5 ++++- ferramentas/wkt2layer/index.js | 9 +++------ js/analise.js | 22 ++-------------------- js/barradebotoes.js | 1 + js/desenho.js | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------- js/interface.js | 4 ++++ js/navega.js | 13 +++++++++---- 8 files changed, 76 insertions(+), 79 deletions(-) diff --git a/ferramentas/googlemaps1/index.js b/ferramentas/googlemaps1/index.js index 81ea808..55f663a 100644 --- a/ferramentas/googlemaps1/index.js +++ b/ferramentas/googlemaps1/index.js @@ -129,11 +129,6 @@ function inicializa(){ } }); if(i3GEO){ - /* - if(i3GEO.parametros.mapfile){ - botaoI3geo(); - } - */ ondegoogle(map); } botaoRota(); diff --git a/ferramentas/graficointerativo1/index.js b/ferramentas/graficointerativo1/index.js index ab9b7ec..67b18c5 100755 --- a/ferramentas/graficointerativo1/index.js +++ b/ferramentas/graficointerativo1/index.js @@ -969,7 +969,10 @@ i3GEOF.graficointerativo1 = } if (tema === "") { - i3GEO.janela.tempoMsg($trad('selecionaTema', i3GEOF.graficointerativo1.dicionario)); + //pode ser que os dados tenham vindo de outra fonte + if($i(idjanela + "i3GEOgraficointerativo1Dados").innerHTML === ""){ + i3GEO.janela.tempoMsg($trad('selecionaTema', i3GEOF.graficointerativo1.dicionario)); + } return; } if (x === "") { diff --git a/ferramentas/wkt2layer/index.js b/ferramentas/wkt2layer/index.js index 693667f..553dbd3 100755 --- a/ferramentas/wkt2layer/index.js +++ b/ferramentas/wkt2layer/index.js @@ -89,16 +89,13 @@ i3GEOF.wkt2layer = * Cria a janela flutuante para controle da ferramenta. */ iniciaJanelaFlutuante : function(wkt,texto) { - var minimiza, cabecalho, janela, divid, temp, titulo; + var cabecalho, janela, divid, titulo; if ($i("i3GEOF.wkt2layer")) { return; } cabecalho = function() { }; - minimiza = function() { - //i3GEO.janela.minimiza("i3GEOF.wkt2layer"); - }; // cria a janela flutuante titulo = "
" + $trad("wkt2layer",i3GEOF.wkt2layer.dicionario) + "
"; janela = @@ -160,7 +157,7 @@ i3GEOF.wkt2layer = if(i3GEOF.wkt2layer.aguarde.visibility === "visible") {return;} i3GEOF.wkt2layer.aguarde.visibility = "visible"; - var wkt,monta,par,p,nometema,temp,cp; + var wkt,monta,par,p,cp; monta = function(){ i3GEOF.wkt2layer.aguarde.visibility = "hidden"; i3GEO.atualiza(); @@ -185,7 +182,7 @@ i3GEOF.wkt2layer = if(i3GEOF.wkt2layer.aguarde.visibility === "visible") {return;} i3GEOF.wkt2layer.aguarde.visibility = "visible"; - var wkt,monta,par,p,nometema,temp,cp; + var wkt,monta,par,p,cp; monta = function(){ i3GEOF.wkt2layer.aguarde.visibility = "hidden"; i3GEO.atualiza(); diff --git a/js/analise.js b/js/analise.js index ac85eb5..c684533 100644 --- a/js/analise.js +++ b/js/analise.js @@ -601,7 +601,7 @@ i3GEO.analise = } }, point : function(point) { - var n, x1, y1, x2, y2, trecho, temp, circ, label, raio, pontoRaio, + var n, x1, y1, x2, y2, trecho, temp, circ, label, raio, estilo = i3GEO.desenho.estilos[i3GEO.desenho.estiloPadrao]; coord = point.getCoordinates(); total = 0; @@ -629,6 +629,7 @@ i3GEO.analise = i3GEO.analise.medeDistancia.pontos.dist.push(trecho); total = i3GEO.analise.medeDistancia.openlayers.somaDist(); i3GEO.analise.medeDistancia.openlayers.mostraTotal(trecho, total); + i3GEO.analise.medeDistancia.ultimoWkt = i3GEO.analise.medeDistancia.pontos2wkt(); // raio if ($i("pararraios") && $i("pararraios").checked === true) { circ = new ol.Feature({ @@ -682,25 +683,6 @@ i3GEO.analise = }) ); i3GEO.desenho.layergrafico.getSource().addFeature(label); - - /* - label = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(point.x, point.y), { - origem : "medeDistanciaExcluir" - }, { - graphicName : "square", - pointRadius : 3, - strokeColor : "black", - graphicOpacity : 1, - strokeWidth : 1, - fillColor : "white", - label : trecho.toFixed(3), - labelAlign : "rb", - fontColor : estilo.textcolor, - fontSize : 12, - fontWeight : "bold" - }); - */ - } } }, diff --git a/js/barradebotoes.js b/js/barradebotoes.js index 5025e3d..acb81bb 100755 --- a/js/barradebotoes.js +++ b/js/barradebotoes.js @@ -1010,6 +1010,7 @@ i3GEO.barraDeBotoes = // a barra já foi expandida if (nb !== i3GEO.barraDeBotoes.MAXBOTOES) { i3GEO.barraDeBotoes.recria(); + return; } if (i3GEO.barraDeBotoes.MAXBOTOES > 0 && n > nb) { for (i = nb; i < n; i += 1) { diff --git a/js/desenho.js b/js/desenho.js index 854b016..4d2a5d3 100755 --- a/js/desenho.js +++ b/js/desenho.js @@ -294,7 +294,7 @@ i3GEO.desenho = } }, addBox : function(xmin, ymin, xmax, ymax, namespace, strokeColor, strokeWidth) { - var bounds, f; + var pol, f; if (!namespace) { namespace = "box"; } @@ -305,31 +305,34 @@ i3GEO.desenho = strokeWidth = 2; } i3GEO.desenho.openlayers.inicia(); - bounds = OpenLayers.Bounds.fromArray([ - xmin, ymin, xmax, ymax - ]); - bounds = bounds.toGeometry(); - bounds = i3GEO.util.extGeo2OSM(bounds); - f = new OpenLayers.Feature.Vector(bounds, { + xmin = xmin * 1; + ymin = ymin * 1; + xmax = xmax * 1; + ymax = ymax * 1; + pol = new ol.geom.Polygon([[[xmin,ymin],[xmin,ymax],[xmax,ymax],[xmax,ymin],[xmin,ymin]]]); + pol = i3GEO.util.extGeo2OSM(pol); + f = new ol.Feature({ + geometry: pol + }); + f.setStyle( + new ol.style.Style({ + stroke: new ol.style.Stroke({ + color: strokeColor, + width: strokeWidth + }) + }) + ); + f.setProperties({ origem : namespace - }, { - fill : false, - strokeColor : strokeColor, - strokeWidth : strokeWidth }); - i3GEO.desenho.layergrafico.addFeatures([ - f - ]); + i3GEO.desenho.layergrafico.getSource().addFeature(f); return f; }, moveBox : function(box, xmin, ymin, xmax, ymax) { - i3GEO.desenho.layergrafico.removeFeatures(box); - var namespace = box["attributes"].origem, strokeWidth = box["style"].strokeWidth, strokeColor = box["style"].strokeColor; - box = i3GEO.desenho.addBox(xmin, ymin, xmax, ymax, namespace, strokeColor, strokeWidth); + box.getGeometry().setCoordinates([[[xmin,ymin],[xmin,ymax],[xmax,ymax],[xmax,ymin],[xmin,ymin]]]); return box; }, addPin : function(x, y, w, h, imagem, namespace, centro, funcaoclick) { - return; if (!imagem || imagem === "") { imagem = i3GEO.configura.locaplic + "/imagens/google/confluence.png"; } @@ -353,46 +356,53 @@ i3GEO.desenho = i3GEO.desenho.openlayers.inicia(); var point, f, ox, oy; if (centro === true) { - ox = parseInt(w / 2, 10) * -1; - oy = parseInt(h / 2, 10) * -1; + ox = 0.5; + oy = 0.5; } else { - ox = parseInt(w / 2, 10) * -1; - oy = h * -1; + ox = 0.5; + oy = 1; } - point = new OpenLayers.Geometry.Point(x, y); + point = new ol.geom.Point([x, y]); point = i3GEO.util.extGeo2OSM(point); - f = new OpenLayers.Feature.Vector(point, { - origem : namespace, - click : funcaoclick - }, { - graphicWidth : w, - graphicHeight : h, - graphicXOffset : ox, - graphicYOffset : oy, - externalGraphic : imagem + + f = new ol.Feature({ + geometry: point + }); + f.setProperties({ + origem : namespace }); - i3GEO.desenho.layergrafico.addFeatures([ - f - ]); + f.setStyle( + new ol.style.Style({ + image: new ol.style.Icon({ + src : imagem, + size: [w,h], + anchor: [ox,oy] + }) + }) + ); + //FIXME como incluir o evento click? + //f.on('click',funcaoclick); + i3GEO.desenho.layergrafico.getSource().addFeature(f); return f; }, removePins : function(namespace) { - return; if (!namespace) { namespace = "pin"; } if (i3GEO.desenho.layergrafico) { - var f = i3GEO.desenho.layergrafico.getFeaturesByAttribute("origem", namespace); - if (f && f.length > 0) { - i3GEO.desenho.layergrafico.destroyFeatures(f); + var features, n, f, i; + features = i3GEO.desenho.layergrafico.getSource().getFeatures(); + n = features.length; + for (i = 0; i < n; i++) { + f = features[i]; + if (f && f.getProperties().origem === namespace) { + i3GEO.desenho.layergrafico.getSource().removeFeature(f); + } } } }, movePin : function(pin, x, y) { - return; - var point = new OpenLayers.LonLat(x, y); - point = i3GEO.util.extGeo2OSM(point); - pin.move(point); + pin.getGeometry().setCoordinates([x,y]); }, criaLayerGrafico : function() { if (!i3GEO.desenho.layergrafico) { diff --git a/js/interface.js b/js/interface.js index 9acf707..90e7764 100755 --- a/js/interface.js +++ b/js/interface.js @@ -924,6 +924,10 @@ i3GEO.Interface = "lat" : c[1] }; }; + i3geoOL.getZoom = function() { + var c = this.getView().getZoom(); + return c; + }; i3geoOL.getExtent = function() { var e = this.getView().calculateExtent(this.getSize()); return { diff --git a/js/navega.js b/js/navega.js index fd131d1..6a85e7b 100644 --- a/js/navega.js +++ b/js/navega.js @@ -1002,12 +1002,17 @@ i3GEO.navega = if (typeof (console) !== 'undefined') console.info("i3GEO.navega.dialogo.google()"); - //i3GEO.eventos.removeEventos("NAVEGAMAPA",["i3GEO.navega.atualizaGoogle()"]); - var idgoogle = "googlemaps" + Math.random(); - i3GEO.janela.cria((i3GEO.parametros.w / 2.5) + 25 + "px", (i3GEO.parametros.h / 2.5) + 18 + "px", i3GEO.configura.locaplic + var temp, janela, idgoogle = "googlemaps" + Math.random(); + janela = i3GEO.janela.cria((i3GEO.parametros.w / 2.5) + 25 + "px", (i3GEO.parametros.h / 2.5) + 18 + "px", i3GEO.configura.locaplic + "/ferramentas/googlemaps1/index.php", "", "", "
Google maps
", idgoogle); - i3GEO.eventos.adicionaEventos("NAVEGAMAPA",["i3GEO.navega.atualizaGoogle('"+idgoogle+"')"]); + + temp = function() { + i3GEO.desenho.removePins("boxOndeGoogle"); + i3GEO.desenho.removePins("googlemaps"); + }; + YAHOO.util.Event.addListener(janela[0].close, "click", temp); + //i3GEO.eventos.adicionaEventos("NAVEGAMAPA",["i3GEO.navega.atualizaGoogle('"+idgoogle+"')"]); }, /** * Function: confluence -- libgit2 0.21.2