Commit 74d67655f830f39516b2630e7d7ed030b899b977

Authored by Edmar Moretti
1 parent 380121aa

--no commit message

ferramentas/identifica/index.js
@@ -1060,9 +1060,7 @@ i3GEOF.identifica = @@ -1060,9 +1060,7 @@ i3GEOF.identifica =
1060 if (!x) { 1060 if (!x) {
1061 i3GEOF.identifica.criaJanelaFlutuante(); 1061 i3GEOF.identifica.criaJanelaFlutuante();
1062 } else { 1062 } else {
1063 - i3GEOF.identifica.criaJanelaFlutuante(  
1064 - x,  
1065 - y); 1063 + i3GEOF.identifica.criaJanelaFlutuante(x,y);
1066 } 1064 }
1067 } 1065 }
1068 }, 1066 },
@@ -120,12 +120,10 @@ i3GEO.calculo = @@ -120,12 +120,10 @@ i3GEO.calculo =
120 if (i3GEO.Interface.ATUAL === "openlayers" && docmapa.id !== "mapaReferencia") { 120 if (i3GEO.Interface.ATUAL === "openlayers" && docmapa.id !== "mapaReferencia") {
121 pos = i3GEO.util.pegaPosicaoObjeto($i(i3GEO.Interface.IDCORPO)); 121 pos = i3GEO.util.pegaPosicaoObjeto($i(i3GEO.Interface.IDCORPO));
122 xy = i3GEO.util.extGeo2OSM(vx + " " + vy, true); 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 return [ 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 if (arguments.length === 3) { 129 if (arguments.length === 3) {
@@ -373,6 +373,7 @@ i3GEO.desenho = { @@ -373,6 +373,7 @@ i3GEO.desenho = {
373 return box; 373 return box;
374 }, 374 },
375 addPin : function(x, y, w, h, imagem, namespace, centro, funcaoclick) { 375 addPin : function(x, y, w, h, imagem, namespace, centro, funcaoclick) {
  376 + return;
376 if (!imagem 377 if (!imagem
377 || imagem === "") { 378 || imagem === "") {
378 imagem = i3GEO.configura.locaplic 379 imagem = i3GEO.configura.locaplic
@@ -436,6 +437,7 @@ i3GEO.desenho = { @@ -436,6 +437,7 @@ i3GEO.desenho = {
436 return f; 437 return f;
437 }, 438 },
438 removePins : function(namespace) { 439 removePins : function(namespace) {
  440 + return;
439 if (!namespace) { 441 if (!namespace) {
440 namespace = "pin"; 442 namespace = "pin";
441 } 443 }
@@ -450,12 +452,14 @@ i3GEO.desenho = { @@ -450,12 +452,14 @@ i3GEO.desenho = {
450 } 452 }
451 }, 453 },
452 movePin : function(pin, x, y) { 454 movePin : function(pin, x, y) {
  455 + return;
453 var point = new OpenLayers.LonLat( 456 var point = new OpenLayers.LonLat(
454 x, y); 457 x, y);
455 point = i3GEO.util.extGeo2OSM(point); 458 point = i3GEO.util.extGeo2OSM(point);
456 pin.move(point); 459 pin.move(point);
457 }, 460 },
458 criaLayerGrafico : function() { 461 criaLayerGrafico : function() {
  462 + return;
459 if (!i3GEO.desenho.layergrafico) { 463 if (!i3GEO.desenho.layergrafico) {
460 var sketchSymbolizers = { 464 var sketchSymbolizers = {
461 "Point" : { 465 "Point" : {
js/interface.js
@@ -48,7 +48,7 @@ @@ -48,7 +48,7 @@
48 if (typeof (i3GEO) === 'undefined') { 48 if (typeof (i3GEO) === 'undefined') {
49 var i3GEO = {}; 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 i3GEO.Interface = 52 i3GEO.Interface =
53 { 53 {
54 /** 54 /**
@@ -508,9 +508,6 @@ i3GEO.Interface = @@ -508,9 +508,6 @@ i3GEO.Interface =
508 target : "openlayers", 508 target : "openlayers",
509 layers : [], 509 layers : [],
510 controls : [ 510 controls : [
511 - new ol.control.MousePosition({  
512 - projection : "EPSG:4326"  
513 - })  
514 ], 511 ],
515 loadTilesWhileAnimating : true, 512 loadTilesWhileAnimating : true,
516 loadTilesWhileInteracting : true 513 loadTilesWhileInteracting : true
@@ -791,28 +788,6 @@ i3GEO.Interface = @@ -791,28 +788,6 @@ i3GEO.Interface =
791 f.style.height = h + "px"; 788 f.style.height = h + "px";
792 } 789 }
793 i3GEO.Interface.IDMAPA = "openlayers"; 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 if (i3GEO.Interface.openlayers.googleLike === false) { 791 if (i3GEO.Interface.openlayers.googleLike === false) {
817 i3GEO.Interface.openlayers.parametrosView.projection = "EPSG:4326"; 792 i3GEO.Interface.openlayers.parametrosView.projection = "EPSG:4326";
818 // precisa disso? 793 // precisa disso?
@@ -842,7 +817,7 @@ i3GEO.Interface = @@ -842,7 +817,7 @@ i3GEO.Interface =
842 this.addLayer(lista[i]); 817 this.addLayer(lista[i]);
843 } 818 }
844 }; 819 };
845 - i3geoOL.getLayersBy = function (chave, valor){ 820 + i3geoOL.getLayersBy = function(chave, valor) {
846 var res = [], layers = this.getLayers(), n = layers.getLength(), i; 821 var res = [], layers = this.getLayers(), n = layers.getLength(), i;
847 for (i = 0; i < n; i++) { 822 for (i = 0; i < n; i++) {
848 if (layers.item(i)[chave] && layers.item(i)[chave] === valor) { 823 if (layers.item(i)[chave] && layers.item(i)[chave] === valor) {
@@ -851,6 +826,30 @@ i3GEO.Interface = @@ -851,6 +826,30 @@ i3GEO.Interface =
851 } 826 }
852 return res; 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 * Monta o corpo do mapa e os componentes marginais 855 * Monta o corpo do mapa e os componentes marginais
@@ -864,8 +863,8 @@ i3GEO.Interface = @@ -864,8 +863,8 @@ i3GEO.Interface =
864 function() { 863 function() {
865 var pz, temp, layers, i, texto, estilo, layersn, openlayers = i3GEO.Interface.openlayers; 864 var pz, temp, layers, i, texto, estilo, layersn, openlayers = i3GEO.Interface.openlayers;
866 i3geoOL.updateSize(); 865 i3geoOL.updateSize();
867 - // FIXME return  
868 - // openlayers.registraEventos(); 866 +
  867 + openlayers.registraEventos();
869 openlayers.zoom2ext(i3GEO.parametros.mapexten); 868 openlayers.zoom2ext(i3GEO.parametros.mapexten);
870 869
871 // corrige o posicionamento da barra de botoes 870 // corrige o posicionamento da barra de botoes
@@ -975,7 +974,7 @@ i3GEO.Interface = @@ -975,7 +974,7 @@ i3GEO.Interface =
975 // verifica se nas preferencias existem ferramentas que devem ser 974 // verifica se nas preferencias existem ferramentas que devem ser
976 // abertas 975 // abertas
977 i3GEO.configura.iniciaFerramentas.executa(); 976 i3GEO.configura.iniciaFerramentas.executa();
978 - 977 +
979 // FIXME nao esta funcionando 978 // FIXME nao esta funcionando
980 // i3GEO.Interface.openlayers.sobeLayersGraficos(); 979 // i3GEO.Interface.openlayers.sobeLayersGraficos();
981 }, 980 },
@@ -1214,8 +1213,8 @@ i3GEO.Interface = @@ -1214,8 +1213,8 @@ i3GEO.Interface =
1214 * Cria os layers conforme os parametros definidos em i3GEO.arvoreDeCamadas.CAMADAS 1213 * Cria os layers conforme os parametros definidos em i3GEO.arvoreDeCamadas.CAMADAS
1215 */ 1214 */
1216 criaLayers : function() { 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 // barra de status 1219 // barra de status
1221 temp = $i("i3GEOprogressoDiv"); 1220 temp = $i("i3GEOprogressoDiv");
@@ -1366,31 +1365,22 @@ i3GEO.Interface = @@ -1366,31 +1365,22 @@ i3GEO.Interface =
1366 }), 1365 }),
1367 wrapX : true 1366 wrapX : true
1368 }); 1367 });
1369 - source.set("name",camada.name); 1368 + source.set("name", camada.name);
1370 opcoes.source = source; 1369 opcoes.source = source;
1371 opcoes.title = camada.tema; 1370 opcoes.title = camada.tema;
1372 opcoes.name = camada.name; 1371 opcoes.name = camada.name;
1373 opcoes.isBaseLayer = false; 1372 opcoes.isBaseLayer = false;
1374 opcoes.visible = true; 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 layer = new ol.layer.Tile(opcoes); 1385 layer = new ol.layer.Tile(opcoes);
1396 } 1386 }
@@ -1691,68 +1681,20 @@ i3GEO.Interface = @@ -1691,68 +1681,20 @@ i3GEO.Interface =
1691 * Registra os eventos que capturam o posicionamento do mouse e outros 1681 * Registra os eventos que capturam o posicionamento do mouse e outros
1692 */ 1682 */
1693 registraEventos : function() { 1683 registraEventos : function() {
1694 - // XXX return  
1695 - return;  
1696 // essa variavel guarda a posicao do mapa na tela 1684 // essa variavel guarda a posicao do mapa na tela
1697 // e usada em vercoes com dispositivo touche para melhorar a performance 1685 // e usada em vercoes com dispositivo touche para melhorar a performance
1698 i3GEOtouchesPosMapa = ""; 1686 i3GEOtouchesPosMapa = "";
1699 // vari&aacute;vel que indica se o usu&aacute;rio est&aacute; 1687 // vari&aacute;vel que indica se o usu&aacute;rio est&aacute;
1700 // movimentando o mapa 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 // ativa os eventos espec&iacute;ficos do i3geo 1691 // ativa os eventos espec&iacute;ficos do i3geo
1746 // 1692 //
1747 - i3GEO.eventos.ativa($i(i3geoOL.id + "_OpenLayers_Container")); 1693 + i3GEO.eventos.ativa(i3geoOL.getTargetElement());
1748 // 1694 //
1749 // ativa os eventos controlados pela API do OL 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 i3GEO.Interface.STATUS.pan = true; 1698 i3GEO.Interface.STATUS.pan = true;
1757 var xy; 1699 var xy;
1758 modoAtual = "move"; 1700 modoAtual = "move";
@@ -1760,8 +1702,11 @@ i3GEO.Interface = @@ -1760,8 +1702,11 @@ i3GEO.Interface =
1760 xy = i3GEO.navega.centroDoMapa(); 1702 xy = i3GEO.navega.centroDoMapa();
1761 i3GEO.navega.marcaCentroDoMapa(xy); 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 if (e.changedTouches) { 1710 if (e.changedTouches) {
1766 return; 1711 return;
1767 } 1712 }
@@ -1784,24 +1729,30 @@ i3GEO.Interface = @@ -1784,24 +1729,30 @@ i3GEO.Interface =
1784 i3GEO.navega.registraExt(i3GEO.parametros.mapexten); 1729 i3GEO.navega.registraExt(i3GEO.parametros.mapexten);
1785 i3GEO.Interface.STATUS.pan = false; 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 if (modoAtual === "move") { 1733 if (modoAtual === "move") {
1793 return; 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 * Ativa os botoes da bara de botoes 1758 * Ativa os botoes da bara de botoes
@@ -1829,7 +1780,7 @@ i3GEO.Interface = @@ -1829,7 +1780,7 @@ i3GEO.Interface =
1829 } 1780 }
1830 i3GEO.parametros.mapexten = bounds[0] + " " + bounds[1] + " " + bounds[2] + " " + bounds[3]; 1781 i3GEO.parametros.mapexten = bounds[0] + " " + bounds[1] + " " + bounds[2] + " " + bounds[3];
1831 i3GEO.parametros.mapscale = escalaAtual; 1782 i3GEO.parametros.mapscale = escalaAtual;
1832 - i3GEO.parametros.pixelsize = i3geoOL.getResolution(); 1783 + i3GEO.parametros.pixelsize = i3geoOL.getView().getResolution();
1833 i3GEO.gadgets.atualizaEscalaNumerica(parseInt(escalaAtual, 10)); 1784 i3GEO.gadgets.atualizaEscalaNumerica(parseInt(escalaAtual, 10));
1834 }, 1785 },
1835 zoom2ext : function(ext) { 1786 zoom2ext : function(ext) {