Commit 74d67655f830f39516b2630e7d7ed030b899b977
1 parent
380121aa
Exists in
master
and in
7 other branches
--no commit message
Showing
4 changed files
with
79 additions
and
128 deletions
Show diff stats
ferramentas/identifica/index.js
| ... | ... | @@ -1060,9 +1060,7 @@ i3GEOF.identifica = |
| 1060 | 1060 | if (!x) { |
| 1061 | 1061 | i3GEOF.identifica.criaJanelaFlutuante(); |
| 1062 | 1062 | } else { |
| 1063 | - i3GEOF.identifica.criaJanelaFlutuante( | |
| 1064 | - x, | |
| 1065 | - y); | |
| 1063 | + i3GEOF.identifica.criaJanelaFlutuante(x,y); | |
| 1066 | 1064 | } |
| 1067 | 1065 | } |
| 1068 | 1066 | }, | ... | ... |
js/calculo.js
| ... | ... | @@ -120,12 +120,10 @@ i3GEO.calculo = |
| 120 | 120 | if (i3GEO.Interface.ATUAL === "openlayers" && docmapa.id !== "mapaReferencia") { |
| 121 | 121 | pos = i3GEO.util.pegaPosicaoObjeto($i(i3GEO.Interface.IDCORPO)); |
| 122 | 122 | xy = i3GEO.util.extGeo2OSM(vx + " " + vy, true); |
| 123 | - xy = i3geoOL.getLayerPxFromLonLat(new OpenLayers.LonLat(xy[0], xy[1])); | |
| 124 | - xy = i3geoOL.getViewPortPxFromLayerPx(xy); | |
| 125 | - // xy = i3geoOL.getPixelFromLonLat(new OpenLayers.LonLat(vx,vy)); | |
| 123 | + xy = i3geoOL.getPixelFromCoordinate([xy[0]*1, xy[1]*1]); | |
| 126 | 124 | return [ |
| 127 | - (xy.x) + pos[0], | |
| 128 | - (xy.y) + pos[1] | |
| 125 | + (xy[0]) + pos[0], | |
| 126 | + (xy[1]) + pos[1] | |
| 129 | 127 | ]; |
| 130 | 128 | } |
| 131 | 129 | if (arguments.length === 3) { | ... | ... |
js/desenho.js
| ... | ... | @@ -373,6 +373,7 @@ i3GEO.desenho = { |
| 373 | 373 | return box; |
| 374 | 374 | }, |
| 375 | 375 | addPin : function(x, y, w, h, imagem, namespace, centro, funcaoclick) { |
| 376 | + return; | |
| 376 | 377 | if (!imagem |
| 377 | 378 | || imagem === "") { |
| 378 | 379 | imagem = i3GEO.configura.locaplic |
| ... | ... | @@ -436,6 +437,7 @@ i3GEO.desenho = { |
| 436 | 437 | return f; |
| 437 | 438 | }, |
| 438 | 439 | removePins : function(namespace) { |
| 440 | + return; | |
| 439 | 441 | if (!namespace) { |
| 440 | 442 | namespace = "pin"; |
| 441 | 443 | } |
| ... | ... | @@ -450,12 +452,14 @@ i3GEO.desenho = { |
| 450 | 452 | } |
| 451 | 453 | }, |
| 452 | 454 | movePin : function(pin, x, y) { |
| 455 | + return; | |
| 453 | 456 | var point = new OpenLayers.LonLat( |
| 454 | 457 | x, y); |
| 455 | 458 | point = i3GEO.util.extGeo2OSM(point); |
| 456 | 459 | pin.move(point); |
| 457 | 460 | }, |
| 458 | 461 | criaLayerGrafico : function() { |
| 462 | + return; | |
| 459 | 463 | if (!i3GEO.desenho.layergrafico) { |
| 460 | 464 | var sketchSymbolizers = { |
| 461 | 465 | "Point" : { | ... | ... |
js/interface.js
| ... | ... | @@ -48,7 +48,7 @@ |
| 48 | 48 | if (typeof (i3GEO) === 'undefined') { |
| 49 | 49 | var i3GEO = {}; |
| 50 | 50 | } |
| 51 | -//TODO integrar Cesium http://cesiumjs.org/2013/04/12/Cesium-up-and-running/ | |
| 51 | +// TODO integrar Cesium http://cesiumjs.org/2013/04/12/Cesium-up-and-running/ | |
| 52 | 52 | i3GEO.Interface = |
| 53 | 53 | { |
| 54 | 54 | /** |
| ... | ... | @@ -508,9 +508,6 @@ i3GEO.Interface = |
| 508 | 508 | target : "openlayers", |
| 509 | 509 | layers : [], |
| 510 | 510 | controls : [ |
| 511 | - new ol.control.MousePosition({ | |
| 512 | - projection : "EPSG:4326" | |
| 513 | - }) | |
| 514 | 511 | ], |
| 515 | 512 | loadTilesWhileAnimating : true, |
| 516 | 513 | loadTilesWhileInteracting : true |
| ... | ... | @@ -791,28 +788,6 @@ i3GEO.Interface = |
| 791 | 788 | f.style.height = h + "px"; |
| 792 | 789 | } |
| 793 | 790 | i3GEO.Interface.IDMAPA = "openlayers"; |
| 794 | - | |
| 795 | - /* | |
| 796 | - * i3GEO.Interface.openlayers.parametrosMap.fractionalZoom = false; if | |
| 797 | - * (!i3GEO.Interface.openlayers.parametrosMap.minResolution) { i3GEO.Interface.openlayers.parametrosMap.minResolution = | |
| 798 | - * "auto"; } if (!i3GEO.Interface.openlayers.parametrosMap.minExtent) { i3GEO.Interface.openlayers.parametrosMap.minExtent = | |
| 799 | - * new OpenLayers.Bounds(mi[0], mi[1], mi[2], mi[3]); } if (!i3GEO.Interface.openlayers.parametrosMap.maxResolution) { | |
| 800 | - * i3GEO.Interface.openlayers.parametrosMap.maxResolution = "auto"; } | |
| 801 | - * | |
| 802 | - * if (i3GEO.Interface.openlayers.parametrosMap.numZoomLevels) { if (i3GEO.Interface.openlayers.parametrosMap.minResolution == | |
| 803 | - * undefined ) { temp = 0.703125; } else { temp = i3GEO.Interface.openlayers.parametrosMap.minResolution; } r = [ temp ]; | |
| 804 | - * for (j = 0; j < (i3GEO.Interface.openlayers.parametrosMap.numZoomLevels - 1); j++) { temp = temp / 2; r.push(temp); } | |
| 805 | - * i3GEO.Interface.openlayers.parametrosMap.resolutions = r; } if (!i3GEO.Interface.openlayers.parametrosMap.maxExtent) { | |
| 806 | - * i3GEO.Interface.openlayers.parametrosMap.maxExtent = new OpenLayers.Bounds(ma[0], ma[1], ma[2], ma[3]); } if | |
| 807 | - * (!i3GEO.Interface.openlayers.parametrosMap.allOverlays) { i3GEO.Interface.openlayers.parametrosMap.allOverlays = false; } | |
| 808 | - * | |
| 809 | - * if (i3GEO.Interface.TABLET === true) { i3GEO.Interface.openlayers.parametrosMap.theme = null; | |
| 810 | - * i3GEO.Interface.openlayers.parametrosMap.controls.push(new OpenLayers.Control.Attribution()); | |
| 811 | - * i3GEO.Interface.openlayers.parametrosMap.controls.push(new OpenLayers.Control.TouchNavigation({ dragPanOptions : { | |
| 812 | - * interval : 100, enableKinetic : true } })); i3GEO.Interface.openlayers.parametrosMap.controls.push(new | |
| 813 | - * OpenLayers.Control.ZoomPanel()); } else if (i3GEO.parametros.w > 700) { bb.INCLUIBOTAO.zoomli = true; bb.INCLUIBOTAO.pan = | |
| 814 | - * true; bb.INCLUIBOTAO.zoomtot = true; } | |
| 815 | - */ | |
| 816 | 791 | if (i3GEO.Interface.openlayers.googleLike === false) { |
| 817 | 792 | i3GEO.Interface.openlayers.parametrosView.projection = "EPSG:4326"; |
| 818 | 793 | // precisa disso? |
| ... | ... | @@ -842,7 +817,7 @@ i3GEO.Interface = |
| 842 | 817 | this.addLayer(lista[i]); |
| 843 | 818 | } |
| 844 | 819 | }; |
| 845 | - i3geoOL.getLayersBy = function (chave, valor){ | |
| 820 | + i3geoOL.getLayersBy = function(chave, valor) { | |
| 846 | 821 | var res = [], layers = this.getLayers(), n = layers.getLength(), i; |
| 847 | 822 | for (i = 0; i < n; i++) { |
| 848 | 823 | if (layers.item(i)[chave] && layers.item(i)[chave] === valor) { |
| ... | ... | @@ -851,6 +826,30 @@ i3GEO.Interface = |
| 851 | 826 | } |
| 852 | 827 | return res; |
| 853 | 828 | }; |
| 829 | + i3geoOL.getCenter = function() { | |
| 830 | + var c = this.getView().getCenter(); | |
| 831 | + return { | |
| 832 | + "lon" : c[0], | |
| 833 | + "lat" : c[1] | |
| 834 | + }; | |
| 835 | + }; | |
| 836 | + i3geoOL.getExtent = function() { | |
| 837 | + var e = this.getView().calculateExtent(this.getSize()); | |
| 838 | + return { | |
| 839 | + toBBOX : function() { | |
| 840 | + return e.join(","); | |
| 841 | + } | |
| 842 | + }; | |
| 843 | + }; | |
| 844 | + i3geoOL.getScale = function() { | |
| 845 | + var resolution, units, dpi, mpu, scale; | |
| 846 | + resolution = this.getView().getResolution(); | |
| 847 | + units = this.getView().getProjection().getUnits(); | |
| 848 | + dpi = 25.4 / 0.28; | |
| 849 | + mpu = ol.proj.METERS_PER_UNIT[units]; | |
| 850 | + scale = resolution * mpu * 39.37 * dpi; | |
| 851 | + return scale; | |
| 852 | + }; | |
| 854 | 853 | }, |
| 855 | 854 | /** |
| 856 | 855 | * Monta o corpo do mapa e os componentes marginais |
| ... | ... | @@ -864,8 +863,8 @@ i3GEO.Interface = |
| 864 | 863 | function() { |
| 865 | 864 | var pz, temp, layers, i, texto, estilo, layersn, openlayers = i3GEO.Interface.openlayers; |
| 866 | 865 | i3geoOL.updateSize(); |
| 867 | - // FIXME return | |
| 868 | - // openlayers.registraEventos(); | |
| 866 | + | |
| 867 | + openlayers.registraEventos(); | |
| 869 | 868 | openlayers.zoom2ext(i3GEO.parametros.mapexten); |
| 870 | 869 | |
| 871 | 870 | // corrige o posicionamento da barra de botoes |
| ... | ... | @@ -975,7 +974,7 @@ i3GEO.Interface = |
| 975 | 974 | // verifica se nas preferencias existem ferramentas que devem ser |
| 976 | 975 | // abertas |
| 977 | 976 | i3GEO.configura.iniciaFerramentas.executa(); |
| 978 | - | |
| 977 | + | |
| 979 | 978 | // FIXME nao esta funcionando |
| 980 | 979 | // i3GEO.Interface.openlayers.sobeLayersGraficos(); |
| 981 | 980 | }, |
| ... | ... | @@ -1214,8 +1213,8 @@ i3GEO.Interface = |
| 1214 | 1213 | * Cria os layers conforme os parametros definidos em i3GEO.arvoreDeCamadas.CAMADAS |
| 1215 | 1214 | */ |
| 1216 | 1215 | criaLayers : function() { |
| 1217 | - var matrixIds, resolutions, size, z, projectionExtent, source, configura = i3GEO.configura, url, nlayers = i3GEO.arvoreDeCamadas.CAMADAS.length, layer, camada, urllayer, opcoes, i, n, temp, fundoIsBase = | |
| 1218 | - true; | |
| 1216 | + var matrixIds, resolutions, size, z, projectionExtent, source, configura = i3GEO.configura, url, nlayers = | |
| 1217 | + i3GEO.arvoreDeCamadas.CAMADAS.length, layer, camada, urllayer, opcoes, i, n, temp, fundoIsBase = true; | |
| 1219 | 1218 | |
| 1220 | 1219 | // barra de status |
| 1221 | 1220 | temp = $i("i3GEOprogressoDiv"); |
| ... | ... | @@ -1366,31 +1365,22 @@ i3GEO.Interface = |
| 1366 | 1365 | }), |
| 1367 | 1366 | wrapX : true |
| 1368 | 1367 | }); |
| 1369 | - source.set("name",camada.name); | |
| 1368 | + source.set("name", camada.name); | |
| 1370 | 1369 | opcoes.source = source; |
| 1371 | 1370 | opcoes.title = camada.tema; |
| 1372 | 1371 | opcoes.name = camada.name; |
| 1373 | 1372 | opcoes.isBaseLayer = false; |
| 1374 | 1373 | opcoes.visible = true; |
| 1375 | - if(i3GEO.arvoreDeCamadas.BARRAPROGRESSO === true){ | |
| 1376 | - source.on( | |
| 1377 | - 'tileloadstart', | |
| 1378 | - function(event) { | |
| 1379 | - i3GEO.Interface.openlayers.loadStartLayer(source.get("name")); | |
| 1380 | - } | |
| 1381 | - ); | |
| 1382 | - source.on( | |
| 1383 | - 'tileloadend', | |
| 1384 | - function(event) { | |
| 1385 | - i3GEO.Interface.openlayers.loadStopLayer(source.get("name")); | |
| 1386 | - } | |
| 1387 | - ); | |
| 1388 | - source.on( | |
| 1389 | - 'tileloaderror', | |
| 1390 | - function(event) { | |
| 1391 | - i3GEO.Interface.openlayers.loadStopLayer(source.get("name")); | |
| 1392 | - } | |
| 1393 | - ); | |
| 1374 | + if (i3GEO.arvoreDeCamadas.BARRAPROGRESSO === true) { | |
| 1375 | + source.on('tileloadstart', function(event) { | |
| 1376 | + i3GEO.Interface.openlayers.loadStartLayer(source.get("name")); | |
| 1377 | + }); | |
| 1378 | + source.on('tileloadend', function(event) { | |
| 1379 | + i3GEO.Interface.openlayers.loadStopLayer(source.get("name")); | |
| 1380 | + }); | |
| 1381 | + source.on('tileloaderror', function(event) { | |
| 1382 | + i3GEO.Interface.openlayers.loadStopLayer(source.get("name")); | |
| 1383 | + }); | |
| 1394 | 1384 | } |
| 1395 | 1385 | layer = new ol.layer.Tile(opcoes); |
| 1396 | 1386 | } |
| ... | ... | @@ -1691,68 +1681,20 @@ i3GEO.Interface = |
| 1691 | 1681 | * Registra os eventos que capturam o posicionamento do mouse e outros |
| 1692 | 1682 | */ |
| 1693 | 1683 | registraEventos : function() { |
| 1694 | - // XXX return | |
| 1695 | - return; | |
| 1696 | 1684 | // essa variavel guarda a posicao do mapa na tela |
| 1697 | 1685 | // e usada em vercoes com dispositivo touche para melhorar a performance |
| 1698 | 1686 | i3GEOtouchesPosMapa = ""; |
| 1699 | 1687 | // variável que indica se o usuário está |
| 1700 | 1688 | // movimentando o mapa |
| 1701 | - var calcCoord, modoAtual = ""; | |
| 1702 | - calcCoord = function(e) { | |
| 1703 | - var point, p = false, lonlat = false, d, pos = "", projWGS84, proj900913; | |
| 1704 | - if (e.xy) { | |
| 1705 | - p = e.xy; | |
| 1706 | - } | |
| 1707 | - // se touch | |
| 1708 | - if (e.changedTouches) { | |
| 1709 | - if (i3GEOtouchesPosMapa === "") { | |
| 1710 | - i3GEOtouchesPosMapa = i3GEO.util.pegaPosicaoObjeto($i(i3GEO.Interface.IDCORPO)); | |
| 1711 | - } | |
| 1712 | - pos = i3GEOtouchesPosMapa; | |
| 1713 | - p = new OpenLayers.Pixel(e.changedTouches[0].clientX - pos[0], e.changedTouches[0].clientY - pos[1]); | |
| 1714 | - e = null; | |
| 1715 | - } | |
| 1716 | - if (p === false) { | |
| 1717 | - return; | |
| 1718 | - } | |
| 1719 | - lonlat = i3geoOL.getLonLatFromPixel(p); | |
| 1720 | - if (i3GEO.Interface.openlayers.googleLike === true) { | |
| 1721 | - projWGS84 = new OpenLayers.Projection("EPSG:4326"); | |
| 1722 | - proj900913 = new OpenLayers.Projection("EPSG:900913"); | |
| 1723 | - if (lonlat) { | |
| 1724 | - point = new OpenLayers.LonLat(lonlat.lon, lonlat.lat); | |
| 1725 | - lonlat = point.transform(proj900913, projWGS84); | |
| 1726 | - } | |
| 1727 | - } | |
| 1728 | - try { | |
| 1729 | - d = i3GEO.calculo.dd2dms(lonlat.lon, lonlat.lat); | |
| 1730 | - objposicaocursor.ddx = lonlat.lon; | |
| 1731 | - objposicaocursor.ddy = lonlat.lat; | |
| 1732 | - objposicaocursor.dmsx = d[0]; | |
| 1733 | - objposicaocursor.dmsy = d[1]; | |
| 1734 | - objposicaocursor.imgx = p.x; | |
| 1735 | - objposicaocursor.imgy = p.y; | |
| 1736 | - if (pos != "") { | |
| 1737 | - pos = i3GEO.util.pegaPosicaoObjeto($i(i3GEO.Interface.IDCORPO)); | |
| 1738 | - } | |
| 1739 | - objposicaocursor.telax = p.x + pos[0]; | |
| 1740 | - objposicaocursor.telay = p.y + pos[1]; | |
| 1741 | - } catch (e) { | |
| 1742 | - } | |
| 1743 | - }; | |
| 1689 | + var modoAtual = ""; | |
| 1744 | 1690 | // |
| 1745 | 1691 | // ativa os eventos específicos do i3geo |
| 1746 | 1692 | // |
| 1747 | - i3GEO.eventos.ativa($i(i3geoOL.id + "_OpenLayers_Container")); | |
| 1693 | + i3GEO.eventos.ativa(i3geoOL.getTargetElement()); | |
| 1748 | 1694 | // |
| 1749 | 1695 | // ativa os eventos controlados pela API do OL |
| 1750 | 1696 | // |
| 1751 | - i3geoOL.events.register("movestart", i3geoOL, function(e) { | |
| 1752 | - // alert("movestart") | |
| 1753 | - if (e.changedTouches) { | |
| 1754 | - return; | |
| 1755 | - } | |
| 1697 | + i3geoOL.on("pointerdrag", function(e) { | |
| 1756 | 1698 | i3GEO.Interface.STATUS.pan = true; |
| 1757 | 1699 | var xy; |
| 1758 | 1700 | modoAtual = "move"; |
| ... | ... | @@ -1760,8 +1702,11 @@ i3GEO.Interface = |
| 1760 | 1702 | xy = i3GEO.navega.centroDoMapa(); |
| 1761 | 1703 | i3GEO.navega.marcaCentroDoMapa(xy); |
| 1762 | 1704 | }); |
| 1763 | - i3geoOL.events.register("moveend", i3geoOL, function(e) { | |
| 1764 | - // alert("moveend") | |
| 1705 | + i3geoOL.on("click", function(e) { | |
| 1706 | + e.stopPropagation(); | |
| 1707 | + e.preventDefault(); | |
| 1708 | + }); | |
| 1709 | + i3geoOL.on("moveend", function(e) { | |
| 1765 | 1710 | if (e.changedTouches) { |
| 1766 | 1711 | return; |
| 1767 | 1712 | } |
| ... | ... | @@ -1784,24 +1729,30 @@ i3GEO.Interface = |
| 1784 | 1729 | i3GEO.navega.registraExt(i3GEO.parametros.mapexten); |
| 1785 | 1730 | i3GEO.Interface.STATUS.pan = false; |
| 1786 | 1731 | }); |
| 1787 | - i3geoOL.events.register("mousemove", i3geoOL, function(e) { | |
| 1788 | - // alert("mousemove") | |
| 1789 | - if (e.changedTouches) { | |
| 1790 | - return; | |
| 1791 | - } | |
| 1732 | + i3geoOL.on("pointermove", function(e) { | |
| 1792 | 1733 | if (modoAtual === "move") { |
| 1793 | 1734 | return; |
| 1794 | 1735 | } |
| 1795 | - calcCoord(e); | |
| 1796 | - }); | |
| 1797 | - i3geoOL.events.register("touchend", i3geoOL, function(e) { | |
| 1798 | - e.preventDefault(); | |
| 1799 | - calcCoord(e); | |
| 1800 | - if (i3GEO.eventos.cliquePerm.status === true) { | |
| 1801 | - i3GEO.eventos.mouseupMapa(e); | |
| 1802 | - } | |
| 1803 | - i3GEO.eventos.cliquePerm.status = true; | |
| 1736 | + var point, lonlat = false, d, pos = ""; | |
| 1737 | + lonlat = e.coordinate; | |
| 1738 | + if (i3GEO.Interface.openlayers.googleLike === true) { | |
| 1739 | + lonlat = ol.proj.transform(lonlat,'EPSG:3857', 'EPSG:4326'); | |
| 1740 | + } | |
| 1741 | + d = i3GEO.calculo.dd2dms(lonlat[0], lonlat[1]); | |
| 1742 | + objposicaocursor.ddx = lonlat[0]; | |
| 1743 | + objposicaocursor.ddy = lonlat[1]; | |
| 1744 | + objposicaocursor.dmsx = d[0]; | |
| 1745 | + objposicaocursor.dmsy = d[1]; | |
| 1746 | + objposicaocursor.imgx = e.pixel[0]; | |
| 1747 | + objposicaocursor.imgy = e.pixel[1]; | |
| 1748 | + pos = i3GEO.util.pegaPosicaoObjeto($i(i3GEO.Interface.IDCORPO)); | |
| 1749 | + objposicaocursor.telax = e.pixel[0] + pos[0]; | |
| 1750 | + objposicaocursor.telay = e.pixel[1] + pos[1]; | |
| 1804 | 1751 | }); |
| 1752 | + /* | |
| 1753 | + * i3geoOL.events.register("touchend", i3geoOL, function(e) { e.preventDefault(); calcCoord(e); if | |
| 1754 | + * (i3GEO.eventos.cliquePerm.status === true) { i3GEO.eventos.mouseupMapa(e); } i3GEO.eventos.cliquePerm.status = true; }); | |
| 1755 | + */ | |
| 1805 | 1756 | }, |
| 1806 | 1757 | /** |
| 1807 | 1758 | * Ativa os botoes da bara de botoes |
| ... | ... | @@ -1829,7 +1780,7 @@ i3GEO.Interface = |
| 1829 | 1780 | } |
| 1830 | 1781 | i3GEO.parametros.mapexten = bounds[0] + " " + bounds[1] + " " + bounds[2] + " " + bounds[3]; |
| 1831 | 1782 | i3GEO.parametros.mapscale = escalaAtual; |
| 1832 | - i3GEO.parametros.pixelsize = i3geoOL.getResolution(); | |
| 1783 | + i3GEO.parametros.pixelsize = i3geoOL.getView().getResolution(); | |
| 1833 | 1784 | i3GEO.gadgets.atualizaEscalaNumerica(parseInt(escalaAtual, 10)); |
| 1834 | 1785 | }, |
| 1835 | 1786 | zoom2ext : function(ext) { | ... | ... |