Commit 96f17bdbb9e6c355af2a9373c36b12c4cb641faf

Authored by Edmar Moretti
1 parent 93cc47be

Correções no posicionamento de geometrias na interface OSM

admin/admin.db
No preview for this file type
classesphp/mapa_googlemaps.php
... ... @@ -140,9 +140,10 @@ elseif ($_GET["X"] != ""){
140 140 $_GET["WIDTH"] = 256;
141 141 $_GET["HEIGHT"] = 256;
142 142 }
143   -else{
  143 +elseif(isset($_GET["BBOX"])){
144 144 $_GET["mapext"] = str_replace(","," ",$_GET["BBOX"]);
145 145 }
  146 +
146 147 $mapa = ms_newMapObj($map_fileX);
147 148 $ret = $mapa->extent;
148 149  
... ...
ferramentas/cores.htm
... ... @@ -44,11 +44,11 @@ navn = false; // netscape
44 44 var app = navigator.appName.substring(0,1);
45 45 if (app=='N') navn=true; else navm=true;
46 46  
47   -numl = 20
48   -numc = 20
49   -nco = 255
  47 +numl = 20;
  48 +numc = 20;
  49 +nco = 255;
50 50  
51   -inicia("vermelho")
  51 +inicia("vermelho");
52 52 function inicia(esquema)
53 53 {
54 54 intnl = Math.ceil(nco / numl);
... ... @@ -56,7 +56,7 @@ function inicia(esquema)
56 56 r = 0;
57 57 g = 0;
58 58 b = 0;
59   - ins = ""
  59 + ins = "";
60 60 for (linhas = 1; linhas < numl; linhas++)
61 61 {
62 62 ins += "<tbody><tr>\n";
... ... @@ -79,29 +79,29 @@ function inicia(esquema)
79 79 if (esquema == "ciano"){b = 255; g = linhas; r = 0;}
80 80 if (esquema == "amarelo"){b = 0; g = linhas; r = 255;}
81 81 }
82   - document.getElementById("cores").innerHTML = "\<table cellpadding='0' cellspacing='0' border='0'\>"+ins+"\<\/table\>"
  82 + document.getElementById("cores").innerHTML = "\<table cellpadding='0' cellspacing='0' border='0'\>"+ins+"\<\/table\>";
83 83 }
84 84 function muda (e)
85 85 {
86   - inicia(e.value)
  86 + inicia(e.value);
87 87 }
88 88 function mais()
89 89 {
90   - nco = nco + 20
91   - inicia(document.getElementById("esq").value)
  90 + nco = nco + 20;
  91 + inicia(document.getElementById("esq").value);
92 92 }
93 93 function menos()
94 94 {
95   - nco = nco - 20
96   - inicia(document.getElementById("esq").value)
  95 + nco = nco - 20;
  96 + inicia(document.getElementById("esq").value);
97 97 }
98 98 function aplicacor(c)
99 99 {
100   - var doc = unescape(((((window.location.href).split("doc="))[1]).split("&"))[0] )
101   - var doc = (navm) ? window.parent.frames(doc).document : window.parent.document.getElementById(doc).contentDocument
  100 + var doc = unescape(((((window.location.href).split("doc="))[1]).split("&"))[0] );
  101 + var doc = (navm) ? window.parent.frames(doc).document : window.parent.document.getElementById(doc).contentDocument;
102 102 var elemento = unescape(((((window.location.href).split("elemento="))[1]).split("&"))[0] );
103   - doc.getElementById(elemento).value = c
104   - window.parent.wdocafechaf('wdocac')
  103 + doc.getElementById(elemento).value = c;
  104 + window.parent.wdocafechaf('wdocac');
105 105 }
106 106 </script>
107 107 </body>
... ...
js/analise.js
... ... @@ -528,7 +528,7 @@ i3GEO.analise =
528 528 * layer para receber os graficos
529 529 */
530 530 inicia : function() {
531   - i3GEO.analise.medeDistancia.openlayers.estilo =
  531 + i3GEO.analise.medeDistancia.openlayers.estilo =
532 532 new ol.style.Style({
533 533 stroke: new ol.style.Stroke({
534 534 color: '#ffcc33',
... ... @@ -641,8 +641,10 @@ i3GEO.analise =
641 641 i3GEO.analise.medeDistancia.ultimoWkt = i3GEO.analise.medeDistancia.pontos2wkt();
642 642 // raio
643 643 if ($i("pararraios") && $i("pararraios").checked === true) {
  644 +
  645 + temp = i3GEO.util.projGeo2OSM(new ol.geom.Point([x1*1, y1*1]));
644 646 circ = new ol.Feature({
645   - geometry: new ol.geom.Circle([x1, y1],raio)
  647 + geometry: new ol.geom.Circle(temp.getCoordinates(),raio)
646 648 });
647 649 circ.setProperties({
648 650 origem : "medeDistanciaExcluir"
... ... @@ -661,7 +663,7 @@ i3GEO.analise =
661 663 // desenha ponto
662 664 if ($i("parartextos") && $i("parartextos").checked === true) {
663 665 label = new ol.Feature({
664   - geometry: new ol.geom.Point([x2, y2])
  666 + geometry: i3GEO.util.projGeo2OSM(new ol.geom.Point([x2*1, y2*1]))
665 667 });
666 668 label.setProperties({
667 669 origem : "medeDistanciaExcluir"
... ... @@ -1236,8 +1238,8 @@ i3GEO.analise =
1236 1238 x1 = temp[0];
1237 1239 y1 = temp[1];
1238 1240 }
1239   - per += i3GEO.calculo.distancia(x1, y1, x2, y2);
1240   - //getGeodesicArea
  1241 + per += i3GEO.calculo.distancia(x1, y1, x2, y2);
  1242 + //getGeodesicArea
1241 1243 sourceProj = i3geoOL.getView().getProjection();
1242 1244 geom = (geom.clone().transform(sourceProj, 'EPSG:4326'));
1243 1245 coordinates = geom.getLinearRing(0).getCoordinates();
... ...
js/desenho.js
... ... @@ -346,9 +346,7 @@ i3GEO.desenho =
346 346 ox = 0.5;
347 347 oy = 1;
348 348 }
349   - point = new ol.geom.Point([x, y]);
350   - point = i3GEO.util.extGeo2OSM(point);
351   -
  349 + point = i3GEO.util.extGeo2OSM(new ol.geom.Point([x, y]));
352 350 f = new ol.Feature({
353 351 geometry: point
354 352 });
... ... @@ -386,7 +384,8 @@ i3GEO.desenho =
386 384 }
387 385 },
388 386 movePin : function(pin, x, y) {
389   - pin.getGeometry().setCoordinates([x,y]);
  387 + var point = i3GEO.util.extGeo2OSM(new ol.geom.Point([x, y]));
  388 + pin.getGeometry().setCoordinates(point.getCoordinates());
390 389 },
391 390 criaLayerGrafico : function() {
392 391 if (!i3GEO.desenho.layergrafico) {
... ...
js/interface.js
... ... @@ -825,9 +825,7 @@ i3GEO.Interface =
825 825 });
826 826 p.baloes.push(b);
827 827 i3geoOL.addOverlay(b);
828   - b.setPosition([
829   - x, y
830   - ]);
  828 + b.setPosition(i3GEO.util.projGeo2OSM(new ol.geom.Point([x, y])).getCoordinates());
831 829 },
832 830 /**
833 831 * Redesenha o mapa atual
... ... @@ -1557,7 +1555,6 @@ i3GEO.Interface =
1557 1555 opcoes.isBaseLayer = false;
1558 1556 opcoes.visible = true;
1559 1557 } else {
1560   -
1561 1558 // verifica se havera apenas um tile
1562 1559 // 10 e do tipo grid de coordenadas
1563 1560 if (camada.tiles === "nao" || camada.escondido.toLowerCase() === "sim"
... ... @@ -1598,19 +1595,30 @@ i3GEO.Interface =
1598 1595 });
1599 1596 source.set("tipoServico", "ImageWMS");
1600 1597 } else {
1601   - source = new ol.source.WMTS({
1602   - url : urllayer,
1603   - matrixSet : opcoes.projection,
1604   - format : 'image/png',
1605   - projection : opcoes.projection,
1606   - tileGrid : new ol.tilegrid.WMTS({
1607   - origin : ol.extent.getTopLeft(projectionExtent),
1608   - resolutions : resolutions,
1609   - matrixIds : matrixIds
1610   - }),
1611   - wrapX : true
1612   - });
1613   - source.set("tipoServico", "WMTS");
  1598 + if(i3GEO.Interface.openlayers.googleLike === false){
  1599 + source = new ol.source.WMTS({
  1600 + url : urllayer,
  1601 + matrixSet : opcoes.projection,
  1602 + format : 'image/png',
  1603 + projection : opcoes.projection,
  1604 + tileGrid : new ol.tilegrid.WMTS({
  1605 + origin : ol.extent.getTopLeft(projectionExtent),
  1606 + resolutions : resolutions,
  1607 + matrixIds : matrixIds
  1608 + }),
  1609 + wrapX : true
  1610 + });
  1611 + source.set("tipoServico", "WMTS");
  1612 + }else{
  1613 + source = new ol.source.XYZ({
  1614 + url : urllayer+"&X={x}&Y={y}&Z={z}",
  1615 + matrixSet : opcoes.projection,
  1616 + format : 'image/png',
  1617 + projection : opcoes.projection,
  1618 + wrapX : true
  1619 + });
  1620 + source.set("tipoServico", "WMTS");
  1621 + }
1614 1622 }
1615 1623 opcoes.title = camada.tema;
1616 1624 opcoes.name = camada.name;
... ...
js/util.js
... ... @@ -2946,11 +2946,11 @@ i3GEO.util =
2946 2946 }
2947 2947 if (temp[0] * 1 <= 180 && temp[0] * 1 >= -180) {
2948 2948 point = new ol.geom.Point([temp[0]*1, temp[1]*1]);
2949   - metrica = point.transform("EPSG:4326","EPSG:900913");
  2949 + metrica = point.transform("EPSG:4326","EPSG:3857");
2950 2950 ext = metrica.getCoordinates()[0] + sep + metrica.getCoordinates()[1];
2951 2951 if (temp.length > 2) {
2952 2952 point = new ol.geom.Point([temp[2]*1, temp[3]*1]);
2953   - metrica = point.transform("EPSG:4326","EPSG:900913");
  2953 + metrica = point.transform("EPSG:4326","EPSG:3857");
2954 2954 ext += sep + metrica.getCoordinates()[0] + sep + metrica.getCoordinates()[1];
2955 2955 }
2956 2956 }
... ... @@ -2967,7 +2967,7 @@ i3GEO.util =
2967 2967 * Converte string 'xmin ymin xmax ymax' ou 'xmin ymin' de geo para a projecao OSM
2968 2968 */
2969 2969 extOSM2Geo : function(ext, retornaArray) {
2970   - var metrica, point, temp, sep;
  2970 + var point, temp, sep;
2971 2971 sep = " ";
2972 2972 if (typeof ext == "object") {
2973 2973 return i3GEO.util.projOSM2Geo(ext);
... ... @@ -2980,12 +2980,12 @@ i3GEO.util =
2980 2980 }
2981 2981 if (temp[0] * 1 >= 180 || temp[0] * 1 <= -180) {
2982 2982 point = new ol.geom.Point([temp[0], temp[1]]);
2983   - metrica = point.transform("EPSG:900913","EPSG:4326");
2984   - ext = metrica.getCoordinates()[0] + sep + metrica.getCoordinates()[1];
  2983 + point.transform("EPSG:3857","EPSG:4326");
  2984 + ext = point.getCoordinates()[0] + sep + point.getCoordinates()[1];
2985 2985 if (temp.length > 2) {
2986 2986 point = new ol.geom.Point([temp[2], temp[3]]);
2987   - metrica = point.transform("EPSG:900913","EPSG:4326");
2988   - ext += sep + metrica.getCoordinates()[0] + sep + metrica.getCoordinates()[1];
  2987 + point.transform("EPSG:3857","EPSG:4326");
  2988 + ext += sep + point.getCoordinates()[0] + sep + point.getCoordinates()[1];
2989 2989 }
2990 2990 }
2991 2991 }
... ... @@ -3002,9 +3002,12 @@ i3GEO.util =
3002 3002 */
3003 3003 projOSM2Geo : function(obj) {
3004 3004 if (i3GEO.Interface.openlayers.googleLike === true) {
3005   - obj = obj.transform("EPSG:900913","EPSG:4326");
  3005 + var clone = obj.clone();
  3006 + clone.transform("EPSG:3857","EPSG:4326");
  3007 + return clone;
  3008 + }else{
  3009 + return obj;
3006 3010 }
3007   - return obj;
3008 3011 },
3009 3012 /**
3010 3013 * Function: projGeo2OSM
... ... @@ -3013,9 +3016,12 @@ i3GEO.util =
3013 3016 */
3014 3017 projGeo2OSM : function(obj) {
3015 3018 if (i3GEO.Interface.openlayers.googleLike === true) {
3016   - obj = obj.transform("EPSG:4326","EPSG:900913");
  3019 + var clone = obj.clone();
  3020 + clone.transform("EPSG:4326","EPSG:3857");
  3021 + return clone;
  3022 + }else{
  3023 + return obj;
3017 3024 }
3018   - return obj;
3019 3025 },
3020 3026 /**
3021 3027 * Function: navegadorDir
... ...