Commit 2aff3400eb69a0cf2cebc212a61e21ae79c8a70a

Authored by Edmar Moretti
1 parent 180b25e2

$1

admin/admin.db
No preview for this file type
admin/php/editormapfile.php
@@ -1620,7 +1620,8 @@ function alterarEditavel() @@ -1620,7 +1620,8 @@ function alterarEditavel()
1620 $layer->setmetadata("COLUNAIDUNICO",$colunaidunico); 1620 $layer->setmetadata("COLUNAIDUNICO",$colunaidunico);
1621 $layer->setmetadata("TABELAEDITAVEL",$tabelaeditavel); 1621 $layer->setmetadata("TABELAEDITAVEL",$tabelaeditavel);
1622 $layer->setmetadata("ESQUEMATABELAEDITAVEL",$esquematabelaeditavel); 1622 $layer->setmetadata("ESQUEMATABELAEDITAVEL",$esquematabelaeditavel);
1623 - $layer->setmetadata("COLUNAGEOMETRIA",$colunageometria); 1623 + $layer->setmetadata("COLUNAGEOMETRIA",$colunageometria);
  1624 + $layer->setmetadata("cache","");
1624 $mapa->save($mapfile); 1625 $mapa->save($mapfile);
1625 removeCabecalho($mapfile); 1626 removeCabecalho($mapfile);
1626 return "ok"; 1627 return "ok";
classesphp/mapa_googlemaps.php
@@ -88,48 +88,56 @@ else{ @@ -88,48 +88,56 @@ else{
88 if(!isset($_SESSION["map_file"])){ 88 if(!isset($_SESSION["map_file"])){
89 exit; 89 exit;
90 } 90 }
91 -// 91 +
92 $map_fileX = $_SESSION["map_file"]; 92 $map_fileX = $_SESSION["map_file"];
93 $postgis_mapa = $_SESSION["postgis_mapa"]; 93 $postgis_mapa = $_SESSION["postgis_mapa"];
94 $cachedir = $_SESSION["cachedir"]; 94 $cachedir = $_SESSION["cachedir"];
95 $i3georendermode = $_SESSION["i3georendermode"]; 95 $i3georendermode = $_SESSION["i3georendermode"];
96 -//  
97 -//converte a requisição do tile em coordenadas geo  
98 -//http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#tile_numbers_to_lon.2Flat_2  
99 -//  
100 -$x = $_GET["X"];  
101 -$y = $_GET["Y"];  
102 -$z = $_GET["Z"];  
103 -  
104 -$qyfile = dirname($map_fileX)."/".$_GET["layer"].".php";  
105 -$qy = file_exists($qyfile);  
106 96
107 -if($qy == false && $_GET["cache"] == "sim" && $_GET["DESLIGACACHE"] != "sim"){  
108 - carregaCacheImagem(); 97 +if(!empty($_GET["request"])){
  98 + $_GET["REQUEST"] = $_GET["request"];
109 } 99 }
  100 +if($_GET["REQUEST"] == "GetFeatureInfo" || strtolower($_GET["REQUEST"]) == "getfeature"){
  101 + $_GET["DESLIGACACHE"] = "sim";
  102 + $_GET["SRS"] = "EPSG:3857";
  103 +}
  104 +else{
  105 + //
  106 + //converte a requisição do tile em coordenadas geo
  107 + //http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#tile_numbers_to_lon.2Flat_2
  108 + //
  109 + $x = $_GET["X"];
  110 + $y = $_GET["Y"];
  111 + $z = $_GET["Z"];
  112 +
  113 + $qyfile = dirname($map_fileX)."/".$_GET["layer"].".php";
  114 + $qy = file_exists($qyfile);
  115 + if($qy == false && $_GET["cache"] == "sim" && $_GET["DESLIGACACHE"] != "sim"){
  116 + carregaCacheImagem();
  117 + }
110 118
111 -$n = pow(2,$z);  
112 -$lon1 = $x / $n * 360.0 - 180.0;  
113 -$lat2 = rad2deg(atan(sinh(pi() * (1 - 2 * $y / $n))));  
114 -$x++;  
115 -$y++;  
116 -$lon2 = $x / $n * 360.0 - 180.0;  
117 -$lat1 = rad2deg(atan(sinh(pi() * (1 - 2 * $y / $n))));  
118 -$x--;  
119 -$y--;  
120 -  
121 -$projInObj = ms_newprojectionobj("proj=latlong,a=6378137,b=6378137");  
122 -$projOutObj = ms_newprojectionobj("proj=merc,a=6378137,b=6378137,lat_ts=0.0,lon_0=0.0,x_0=0.0,y_0=0,k=1.0,units=m");  
123 -  
124 -$poPoint1 = ms_newpointobj();  
125 -$poPoint1->setXY($lon1, $lat1);  
126 -$poPoint1->project($projInObj, $projOutObj);  
127 -$poPoint2 = ms_newpointobj();  
128 -$poPoint2->setXY($lon2, $lat2);  
129 -$poPoint2->project($projInObj, $projOutObj);  
130 -$_GET["BBOX"] = $poPoint1->x." ".$poPoint1->y." ".$poPoint2->x." ".$poPoint2->y;  
131 -$_GET["mapext"] = str_replace(","," ",$_GET["BBOX"]);  
132 - 119 + $n = pow(2,$z);
  120 + $lon1 = $x / $n * 360.0 - 180.0;
  121 + $lat2 = rad2deg(atan(sinh(pi() * (1 - 2 * $y / $n))));
  122 + $x++;
  123 + $y++;
  124 + $lon2 = $x / $n * 360.0 - 180.0;
  125 + $lat1 = rad2deg(atan(sinh(pi() * (1 - 2 * $y / $n))));
  126 + $x--;
  127 + $y--;
  128 +
  129 + $projInObj = ms_newprojectionobj("proj=latlong,a=6378137,b=6378137");
  130 + $projOutObj = ms_newprojectionobj("proj=merc,a=6378137,b=6378137,lat_ts=0.0,lon_0=0.0,x_0=0.0,y_0=0,k=1.0,units=m");
  131 +
  132 + $poPoint1 = ms_newpointobj();
  133 + $poPoint1->setXY($lon1, $lat1);
  134 + $poPoint1->project($projInObj, $projOutObj);
  135 + $poPoint2 = ms_newpointobj();
  136 + $poPoint2->setXY($lon2, $lat2);
  137 + $poPoint2->project($projInObj, $projOutObj);
  138 + $_GET["BBOX"] = $poPoint1->x." ".$poPoint1->y." ".$poPoint2->x." ".$poPoint2->y;
  139 + $_GET["mapext"] = str_replace(","," ",$_GET["BBOX"]);
  140 +}
133 $mapa = ms_newMapObj($map_fileX); 141 $mapa = ms_newMapObj($map_fileX);
134 $ret = $mapa->extent; 142 $ret = $mapa->extent;
135 143
@@ -175,6 +183,18 @@ if(!isset($_GET["telaR"])){ @@ -175,6 +183,18 @@ if(!isset($_GET["telaR"])){
175 if(strtolower($l->getmetadata("cache")) == "sim"){ 183 if(strtolower($l->getmetadata("cache")) == "sim"){
176 $cache = true; 184 $cache = true;
177 } 185 }
  186 + if($_GET["REQUEST"] == "GetFeatureInfo" || strtolower($_GET["REQUEST"]) == "getfeature" ){
  187 + $l->setmetadata("gml_include_items","all");
  188 + $l->set("template","none.htm");
  189 + $l->setmetadata("WMS_INCLUDE_ITEMS","all");
  190 + $l->setmetadata("WFS_INCLUDE_ITEMS","all");
  191 + $l->setmetadata("ows_enable_request","*");
  192 + $l->set("dump",MS_TRUE);
  193 + $l->setmetadata("ows_srs","AUTO");
  194 + if(strtolower($_GET["REQUEST"]) == "getfeature"){
  195 + $_GET["TYPENAME"] = $l->name;
  196 + }
  197 + }
178 } 198 }
179 } 199 }
180 } 200 }
@@ -187,6 +207,39 @@ else{ @@ -187,6 +207,39 @@ else{
187 {$l->setProjection("proj=latlong,a=6378137,b=6378137");} 207 {$l->setProjection("proj=latlong,a=6378137,b=6378137");}
188 } 208 }
189 } 209 }
  210 +
  211 +//
  212 +//qd a cahamda e para um WMS, redireciona para ogc.php
  213 +//
  214 +if($_GET["REQUEST"] == "GetFeatureInfo" || $_GET["REQUEST"] == "getfeature"){
  215 + //echo $_GET["mapext"];exit;
  216 + if($_GET["REQUEST"] == "GetFeatureInfo"){
  217 + $mapa->setsize(256,256);
  218 + $mapext = explode(",",$_GET["BBOX"]);
  219 + $mapa->setExtent($mapext[0],$mapext[1],$mapext[2],$mapext[3]);
  220 + }
  221 + else{
  222 + $mapa->setExtent(-21309420.490489,-8061966.246171,21505099.28287,16906647.661876);
  223 + }
  224 + $req = ms_newowsrequestobj();
  225 + $_GET = array_merge($_GET,$_POST);
  226 + foreach ($_GET as $k=>$v){
  227 + $req->setParameter($k, $v);
  228 + }
  229 + $proto = "http" . ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "s" : "") . "://";
  230 + $server = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'];
  231 + $or = $proto.$server.$_SERVER['PHP_SELF'];
  232 + $mapa->setmetadata("wfs_onlineresource",$or."?".$_SERVER["QUERY_STRING"]);
  233 +
  234 + ms_ioinstallstdouttobuffer();
  235 + $mapa->owsdispatch($req);
  236 + $contenttype = ms_iostripstdoutbuffercontenttype();
  237 + header("Content-type: $contenttype");
  238 + ms_iogetStdoutBufferBytes();
  239 + ms_ioresethandlers();
  240 + exit;
  241 +}
  242 +
190 if($_GET["layer"] == "") 243 if($_GET["layer"] == "")
191 {$cache = true;} 244 {$cache = true;}
192 245
mashups/openlayers.js
@@ -302,22 +302,25 @@ i3GEO.editorOL = { @@ -302,22 +302,25 @@ i3GEO.editorOL = {
302 return false; 302 return false;
303 }, 303 },
304 layertms2wms: function(tms){ 304 layertms2wms: function(tms){
305 - var layer = new OpenLayers.Layer.WMS( 305 + var layer,url;
  306 + url = tms.url.replace("&cache=sim","&DESLIGACACHE=sim");
  307 + url = url.replace("&Z=${z}&X=${x}&Y=${y}","");
  308 + layer = new OpenLayers.Layer.WMS(
306 tms.layername+"_clone", 309 tms.layername+"_clone",
307 - tms.url.replace("&cache=sim","&DESLIGACACHE=sim"),  
308 - {  
309 - layers:tms.name,  
310 - transparent:true  
311 - },  
312 - {  
313 - gutter:0,  
314 - isBaseLayer:false,  
315 - displayInLayerSwitcher:false,  
316 - opacity: 1,  
317 - visibility:true,  
318 - singleTile: true  
319 - }  
320 - ); 310 + url,
  311 + {
  312 + layers:tms.name,
  313 + transparent:true
  314 + },
  315 + {
  316 + gutter:0,
  317 + isBaseLayer:false,
  318 + displayInLayerSwitcher:false,
  319 + opacity: 1,
  320 + visibility:true,
  321 + singleTile: true
  322 + }
  323 + );
321 //i3GEO.editorOL.mapa.addLayer(layer); 324 //i3GEO.editorOL.mapa.addLayer(layer);
322 return layer; 325 return layer;
323 }, 326 },
@@ -589,9 +592,11 @@ i3GEO.editorOL = { @@ -589,9 +592,11 @@ i3GEO.editorOL = {
589 //if(i3GEO.editorOL.layergrafico !== ""){return;} 592 //if(i3GEO.editorOL.layergrafico !== ""){return;}
590 var layers = [i3GEO.editorOL.layerAtivo()], 593 var layers = [i3GEO.editorOL.layerAtivo()],
591 xy = lonlat.split(","), 594 xy = lonlat.split(","),
592 - u = layers[0].url+"&request=getfeature&service=wfs&version=1.0.0"; 595 + u = layers[0].url+"&REQUEST=getfeature&service=wfs&version=1.0.0";
593 u += "&OUTPUTFORMAT=gml2&typename="+layers[0].params.LAYERS; 596 u += "&OUTPUTFORMAT=gml2&typename="+layers[0].params.LAYERS;
594 - 597 + //remove parametros nao desejados
  598 + u = u.replace("&cache=sim","&DESLIGACACHE=sim");
  599 + u = u.replace("&Z=${z}&X=${x}&Y=${y}","");
595 //u += "&filter=<Filter><Intersects><PropertyName>Geometry</PropertyName><gml:Point><gml:coordinates>"+lonlat+"</gml:coordinates></gml:Point></Intersects></Filter>"; 600 //u += "&filter=<Filter><Intersects><PropertyName>Geometry</PropertyName><gml:Point><gml:coordinates>"+lonlat+"</gml:coordinates></gml:Point></Intersects></Filter>";
596 601
597 xy[0] = xy[0] * 1; 602 xy[0] = xy[0] * 1;
@@ -679,20 +684,21 @@ i3GEO.editorOL = { @@ -679,20 +684,21 @@ i3GEO.editorOL = {
679 listaGeometriasSel: function(){ 684 listaGeometriasSel: function(){
680 var geos = i3GEO.editorOL.layergrafico.selectedFeatures, 685 var geos = i3GEO.editorOL.layergrafico.selectedFeatures,
681 n = geos.length, 686 n = geos.length,
682 - ins = "",i,a,w; 687 + ins = "",i,a,w,g;
683 for(i=0;i<n;i++){ 688 for(i=0;i<n;i++){
684 - ins += "<b>Geometria: "+i+"</b><br>"+geos[i].geometry+"<br><br>"; 689 + g = geos[i];
  690 + ins += "<b>Geometria: "+i+"</b><br>"+i3GEO.editorOL.google2wgs(g.geometry)+"<br><br>";
685 ins += "<b>Atributos: "+i+"</b><br>"; 691 ins += "<b>Atributos: "+i+"</b><br>";
686 - a = geos[i].attributes; 692 + a = g.attributes;
687 for(key in a){ 693 for(key in a){
688 if(a[key]){ 694 if(a[key]){
689 ins += key+" = "+a[key]+"<br>"; 695 ins += key+" = "+a[key]+"<br>";
690 } 696 }
691 } 697 }
692 //lista os registros se for fruto de uma captura 698 //lista os registros se for fruto de uma captura
693 - if(geos[i].attributes.registros){ 699 + if(g.attributes.registros){
694 ins += "<b>Registros: "+i+"</b><br>"; 700 ins += "<b>Registros: "+i+"</b><br>";
695 - a = geos[i].attributes.registros; 701 + a = g.attributes.registros;
696 for(key in a){ 702 for(key in a){
697 if(a[key]){ 703 if(a[key]){
698 ins += key+" = "+a[key]+"<br>"; 704 ins += key+" = "+a[key]+"<br>";
@@ -718,7 +724,8 @@ i3GEO.editorOL = { @@ -718,7 +724,8 @@ i3GEO.editorOL = {
718 var registros = "", 724 var registros = "",
719 valorunico = "", 725 valorunico = "",
720 nometema = $i("editorOLcomboTemaEditavel").value, 726 nometema = $i("editorOLcomboTemaEditavel").value,
721 - key,tema,redesenha,p; 727 + key="",tema,redesenha,p,
  728 + g = i3GEO.editorOL.google2wgs(geos[0].geometry);
722 if(nometema == ""){ 729 if(nometema == ""){
723 return; 730 return;
724 } 731 }
@@ -744,12 +751,12 @@ i3GEO.editorOL = { @@ -744,12 +751,12 @@ i3GEO.editorOL = {
744 //cria um novo registro 751 //cria um novo registro
745 if(valorunico == ""){ 752 if(valorunico == ""){
746 p = i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=adicionaGeometria&g_sid="+i3GEO.configura.sid; 753 p = i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=adicionaGeometria&g_sid="+i3GEO.configura.sid;
747 - cpJSON.call(p,"foo",redesenha,"&tema="+nometema+"&wkt="+geos[0].geometry); 754 + cpJSON.call(p,"foo",redesenha,"&tema="+nometema+"&wkt="+g);
748 } 755 }
749 else{ 756 else{
750 //atualiza a geometria 757 //atualiza a geometria
751 p = i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=atualizaGeometria&g_sid="+i3GEO.configura.sid; 758 p = i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=atualizaGeometria&g_sid="+i3GEO.configura.sid;
752 - cpJSON.call(p,"foo",redesenha,"&idunico="+valorunico+"&tema="+nometema+"&wkt="+geos[0].geometry); 759 + cpJSON.call(p,"foo",redesenha,"&idunico="+valorunico+"&tema="+nometema+"&wkt="+g);
753 } 760 }
754 } 761 }
755 }, 762 },
@@ -939,7 +946,6 @@ i3GEO.editorOL = { @@ -939,7 +946,6 @@ i3GEO.editorOL = {
939 var lonlat = i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy), 946 var lonlat = i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy),
940 lonlattexto = "<hr>", 947 lonlattexto = "<hr>",
941 formata; 948 formata;
942 -  
943 if( botoes.linha === true || botoes.ponto === true || botoes.poligono === true || botoes.edita === true){ 949 if( botoes.linha === true || botoes.ponto === true || botoes.poligono === true || botoes.edita === true){
944 lonlattexto += "<pre><span style=font-size:12px;color:blue;cursor:pointer onclick='i3GEO.editorOL.captura(\""+lonlat.lon+","+lonlat.lat+"\")'>edita geometria</span></pre><br>"; 950 lonlattexto += "<pre><span style=font-size:12px;color:blue;cursor:pointer onclick='i3GEO.editorOL.captura(\""+lonlat.lon+","+lonlat.lat+"\")'>edita geometria</span></pre><br>";
945 } 951 }
@@ -982,9 +988,9 @@ i3GEO.editorOL = { @@ -982,9 +988,9 @@ i3GEO.editorOL = {
982 i3GEO.editorOL.removeClone(); 988 i3GEO.editorOL.removeClone();
983 }, 989 },
984 beforegetfeatureinfo: function(event){ 990 beforegetfeatureinfo: function(event){
985 - var temp,ativo = [i3GEO.editorOL.layerAtivo()]; 991 + var ativo = [i3GEO.editorOL.layerAtivo()];
986 //se for TMS tem de pegar o clone wms 992 //se for TMS tem de pegar o clone wms
987 - if(ativo[0].CLASS_NAME == "OpenLayers.Layer.TMS"){ 993 + if(ativo[0].CLASS_NAME == "OpenLayers.Layer.TMS" || ativo[0].CLASS_NAME == "OpenLayers.Layer.OSM"){
988 ativo = [i3GEO.editorOL.layertms2wms(ativo[0])]; 994 ativo = [i3GEO.editorOL.layertms2wms(ativo[0])];
989 } 995 }
990 event.object.layers = ativo; 996 event.object.layers = ativo;
@@ -1397,7 +1403,7 @@ i3GEO.editorOL = { @@ -1397,7 +1403,7 @@ i3GEO.editorOL = {
1397 } 1403 }
1398 }); 1404 });
1399 // 1405 //
1400 - //adiciona o painel ao mapa se alguma op��o foi inserida 1406 + //adiciona o painel ao mapa se alguma opcao foi inserida
1401 // 1407 //
1402 if(adiciona === true){ 1408 if(adiciona === true){
1403 i3GEOpanelEditor.addControls(controles); 1409 i3GEOpanelEditor.addControls(controles);
@@ -1935,5 +1941,15 @@ i3GEO.editorOL = { @@ -1935,5 +1941,15 @@ i3GEO.editorOL = {
1935 desativaRodaDoMouse: function(){ 1941 desativaRodaDoMouse: function(){
1936 var controls = i3GEO.editorOL.mapa.getControlsByClass('OpenLayers.Control.Navigation'); 1942 var controls = i3GEO.editorOL.mapa.getControlsByClass('OpenLayers.Control.Navigation');
1937 for(var i = 0; i<controls.length; ++i){controls[i].disableZoomWheel();} 1943 for(var i = 0; i<controls.length; ++i){controls[i].disableZoomWheel();}
  1944 + },
  1945 + google2wgs: function(obj){
  1946 + if(i3GEO.Interface.openlayers.googleLike === true){
  1947 + var projWGS84 = new OpenLayers.Projection("EPSG:4326"),
  1948 + proj900913 = new OpenLayers.Projection("EPSG:900913");
  1949 + return obj.transform(proj900913, projWGS84);
  1950 + }
  1951 + else{
  1952 + return obj;
  1953 + }
1938 } 1954 }
1939 }; 1955 };
mashups/openlayers_compacto.js
@@ -3315,9 +3315,12 @@ return(layers[i]); @@ -3315,9 +3315,12 @@ return(layers[i]);
3315 return false; 3315 return false;
3316 }, 3316 },
3317 layertms2wms: function(tms){ 3317 layertms2wms: function(tms){
3318 -var layer = new OpenLayers.Layer.WMS( 3318 +var layer,url;
  3319 +url = tms.url.replace("&cache=sim","&DESLIGACACHE=sim");
  3320 +url = url.replace("&Z=${z}&X=${x}&Y=${y}","");
  3321 +layer = new OpenLayers.Layer.WMS(
3319 tms.layername+"_clone", 3322 tms.layername+"_clone",
3320 -tms.url.replace("&cache=sim","&DESLIGACACHE=sim"), 3323 +url,
3321 { 3324 {
3322 layers:tms.name, 3325 layers:tms.name,
3323 transparent:true 3326 transparent:true
@@ -3600,8 +3603,11 @@ captura: function(lonlat){ @@ -3600,8 +3603,11 @@ captura: function(lonlat){
3600 //if(i3GEO.editorOL.layergrafico !== ""){return;} 3603 //if(i3GEO.editorOL.layergrafico !== ""){return;}
3601 var layers = [i3GEO.editorOL.layerAtivo()], 3604 var layers = [i3GEO.editorOL.layerAtivo()],
3602 xy = lonlat.split(","), 3605 xy = lonlat.split(","),
3603 -u = layers[0].url+"&request=getfeature&service=wfs&version=1.0.0"; 3606 +u = layers[0].url+"&REQUEST=getfeature&service=wfs&version=1.0.0";
3604 u += "&OUTPUTFORMAT=gml2&typename="+layers[0].params.LAYERS; 3607 u += "&OUTPUTFORMAT=gml2&typename="+layers[0].params.LAYERS;
  3608 +//remove parametros nao desejados
  3609 +u = u.replace("&cache=sim","&DESLIGACACHE=sim");
  3610 +u = u.replace("&Z=${z}&X=${x}&Y=${y}","");
3605 //u += "&filter=<Filter><Intersects><PropertyName>Geometry</PropertyName><gml:Point><gml:coordinates>"+lonlat+"</gml:coordinates></gml:Point></Intersects></Filter>"; 3611 //u += "&filter=<Filter><Intersects><PropertyName>Geometry</PropertyName><gml:Point><gml:coordinates>"+lonlat+"</gml:coordinates></gml:Point></Intersects></Filter>";
3606 xy[0] = xy[0] * 1; 3612 xy[0] = xy[0] * 1;
3607 xy[1] = xy[1] * 1; 3613 xy[1] = xy[1] * 1;
@@ -3687,20 +3693,21 @@ i3GEO.editorOL.processageo(&quot;converteSHP&quot;); @@ -3687,20 +3693,21 @@ i3GEO.editorOL.processageo(&quot;converteSHP&quot;);
3687 listaGeometriasSel: function(){ 3693 listaGeometriasSel: function(){
3688 var geos = i3GEO.editorOL.layergrafico.selectedFeatures, 3694 var geos = i3GEO.editorOL.layergrafico.selectedFeatures,
3689 n = geos.length, 3695 n = geos.length,
3690 -ins = "",i,a,w; 3696 +ins = "",i,a,w,g;
3691 for(i=0;i<n;i++){ 3697 for(i=0;i<n;i++){
3692 -ins += "<b>Geometria: "+i+"</b><br>"+geos[i].geometry+"<br><br>"; 3698 +g = geos[i];
  3699 +ins += "<b>Geometria: "+i+"</b><br>"+i3GEO.editorOL.google2wgs(g.geometry)+"<br><br>";
3693 ins += "<b>Atributos: "+i+"</b><br>"; 3700 ins += "<b>Atributos: "+i+"</b><br>";
3694 -a = geos[i].attributes; 3701 +a = g.attributes;
3695 for(key in a){ 3702 for(key in a){
3696 if(a[key]){ 3703 if(a[key]){
3697 ins += key+" = "+a[key]+"<br>"; 3704 ins += key+" = "+a[key]+"<br>";
3698 } 3705 }
3699 } 3706 }
3700 //lista os registros se for fruto de uma captura 3707 //lista os registros se for fruto de uma captura
3701 -if(geos[i].attributes.registros){ 3708 +if(g.attributes.registros){
3702 ins += "<b>Registros: "+i+"</b><br>"; 3709 ins += "<b>Registros: "+i+"</b><br>";
3703 -a = geos[i].attributes.registros; 3710 +a = g.attributes.registros;
3704 for(key in a){ 3711 for(key in a){
3705 if(a[key]){ 3712 if(a[key]){
3706 ins += key+" = "+a[key]+"<br>"; 3713 ins += key+" = "+a[key]+"<br>";
@@ -3726,7 +3733,8 @@ if(geos[0].geometry){ @@ -3726,7 +3733,8 @@ if(geos[0].geometry){
3726 var registros = "", 3733 var registros = "",
3727 valorunico = "", 3734 valorunico = "",
3728 nometema = $i("editorOLcomboTemaEditavel").value, 3735 nometema = $i("editorOLcomboTemaEditavel").value,
3729 -key,tema,redesenha,p; 3736 +key="",tema,redesenha,p,
  3737 +g = i3GEO.editorOL.google2wgs(geos[0].geometry);
3730 if(nometema == ""){ 3738 if(nometema == ""){
3731 return; 3739 return;
3732 } 3740 }
@@ -3751,12 +3759,12 @@ i3GEO.janela.AGUARDEMODAL = false; @@ -3751,12 +3759,12 @@ i3GEO.janela.AGUARDEMODAL = false;
3751 //cria um novo registro 3759 //cria um novo registro
3752 if(valorunico == ""){ 3760 if(valorunico == ""){
3753 p = i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=adicionaGeometria&g_sid="+i3GEO.configura.sid; 3761 p = i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=adicionaGeometria&g_sid="+i3GEO.configura.sid;
3754 -cpJSON.call(p,"foo",redesenha,"&tema="+nometema+"&wkt="+geos[0].geometry); 3762 +cpJSON.call(p,"foo",redesenha,"&tema="+nometema+"&wkt="+g);
3755 } 3763 }
3756 else{ 3764 else{
3757 //atualiza a geometria 3765 //atualiza a geometria
3758 p = i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=atualizaGeometria&g_sid="+i3GEO.configura.sid; 3766 p = i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=atualizaGeometria&g_sid="+i3GEO.configura.sid;
3759 -cpJSON.call(p,"foo",redesenha,"&idunico="+valorunico+"&tema="+nometema+"&wkt="+geos[0].geometry); 3767 +cpJSON.call(p,"foo",redesenha,"&idunico="+valorunico+"&tema="+nometema+"&wkt="+g);
3760 } 3768 }
3761 } 3769 }
3762 }, 3770 },
@@ -3988,9 +3996,9 @@ true @@ -3988,9 +3996,9 @@ true
3988 i3GEO.editorOL.removeClone(); 3996 i3GEO.editorOL.removeClone();
3989 }, 3997 },
3990 beforegetfeatureinfo: function(event){ 3998 beforegetfeatureinfo: function(event){
3991 -var temp,ativo = [i3GEO.editorOL.layerAtivo()]; 3999 +var ativo = [i3GEO.editorOL.layerAtivo()];
3992 //se for TMS tem de pegar o clone wms 4000 //se for TMS tem de pegar o clone wms
3993 -if(ativo[0].CLASS_NAME == "OpenLayers.Layer.TMS"){ 4001 +if(ativo[0].CLASS_NAME == "OpenLayers.Layer.TMS" || ativo[0].CLASS_NAME == "OpenLayers.Layer.OSM"){
3994 ativo = [i3GEO.editorOL.layertms2wms(ativo[0])]; 4002 ativo = [i3GEO.editorOL.layertms2wms(ativo[0])];
3995 } 4003 }
3996 event.object.layers = ativo; 4004 event.object.layers = ativo;
@@ -4402,7 +4410,7 @@ if(document.getElementById(&quot;panellistagEditor&quot;)) @@ -4402,7 +4410,7 @@ if(document.getElementById(&quot;panellistagEditor&quot;))
4402 } 4410 }
4403 }); 4411 });
4404 // 4412 //
4405 -//adiciona o painel ao mapa se alguma op��o foi inserida 4413 +//adiciona o painel ao mapa se alguma opcao foi inserida
4406 // 4414 //
4407 if(adiciona === true){ 4415 if(adiciona === true){
4408 i3GEOpanelEditor.addControls(controles); 4416 i3GEOpanelEditor.addControls(controles);
@@ -4934,5 +4942,15 @@ ls.maximizeDiv.click(); @@ -4934,5 +4942,15 @@ ls.maximizeDiv.click();
4934 desativaRodaDoMouse: function(){ 4942 desativaRodaDoMouse: function(){
4935 var controls = i3GEO.editorOL.mapa.getControlsByClass('OpenLayers.Control.Navigation'); 4943 var controls = i3GEO.editorOL.mapa.getControlsByClass('OpenLayers.Control.Navigation');
4936 for(var i = 0; i<controls.length; ++i){controls[i].disableZoomWheel();} 4944 for(var i = 0; i<controls.length; ++i){controls[i].disableZoomWheel();}
  4945 +},
  4946 +google2wgs: function(obj){
  4947 +if(i3GEO.Interface.openlayers.googleLike === true){
  4948 +var projWGS84 = new OpenLayers.Projection("EPSG:4326"),
  4949 +proj900913 = new OpenLayers.Projection("EPSG:900913");
  4950 +return obj.transform(proj900913, projWGS84);
  4951 +}
  4952 +else{
  4953 +return obj;
  4954 +}
4937 } 4955 }
4938 }; 4956 };
mashups/openlayers_compacto.js.php
@@ -3315,9 +3315,12 @@ return(layers[i]); @@ -3315,9 +3315,12 @@ return(layers[i]);
3315 return false; 3315 return false;
3316 }, 3316 },
3317 layertms2wms: function(tms){ 3317 layertms2wms: function(tms){
3318 -var layer = new OpenLayers.Layer.WMS( 3318 +var layer,url;
  3319 +url = tms.url.replace("&cache=sim","&DESLIGACACHE=sim");
  3320 +url = url.replace("&Z=${z}&X=${x}&Y=${y}","");
  3321 +layer = new OpenLayers.Layer.WMS(
3319 tms.layername+"_clone", 3322 tms.layername+"_clone",
3320 -tms.url.replace("&cache=sim","&DESLIGACACHE=sim"), 3323 +url,
3321 { 3324 {
3322 layers:tms.name, 3325 layers:tms.name,
3323 transparent:true 3326 transparent:true
@@ -3600,8 +3603,11 @@ captura: function(lonlat){ @@ -3600,8 +3603,11 @@ captura: function(lonlat){
3600 //if(i3GEO.editorOL.layergrafico !== ""){return;} 3603 //if(i3GEO.editorOL.layergrafico !== ""){return;}
3601 var layers = [i3GEO.editorOL.layerAtivo()], 3604 var layers = [i3GEO.editorOL.layerAtivo()],
3602 xy = lonlat.split(","), 3605 xy = lonlat.split(","),
3603 -u = layers[0].url+"&request=getfeature&service=wfs&version=1.0.0"; 3606 +u = layers[0].url+"&REQUEST=getfeature&service=wfs&version=1.0.0";
3604 u += "&OUTPUTFORMAT=gml2&typename="+layers[0].params.LAYERS; 3607 u += "&OUTPUTFORMAT=gml2&typename="+layers[0].params.LAYERS;
  3608 +//remove parametros nao desejados
  3609 +u = u.replace("&cache=sim","&DESLIGACACHE=sim");
  3610 +u = u.replace("&Z=${z}&X=${x}&Y=${y}","");
3605 //u += "&filter=<Filter><Intersects><PropertyName>Geometry</PropertyName><gml:Point><gml:coordinates>"+lonlat+"</gml:coordinates></gml:Point></Intersects></Filter>"; 3611 //u += "&filter=<Filter><Intersects><PropertyName>Geometry</PropertyName><gml:Point><gml:coordinates>"+lonlat+"</gml:coordinates></gml:Point></Intersects></Filter>";
3606 xy[0] = xy[0] * 1; 3612 xy[0] = xy[0] * 1;
3607 xy[1] = xy[1] * 1; 3613 xy[1] = xy[1] * 1;
@@ -3687,20 +3693,21 @@ i3GEO.editorOL.processageo(&quot;converteSHP&quot;); @@ -3687,20 +3693,21 @@ i3GEO.editorOL.processageo(&quot;converteSHP&quot;);
3687 listaGeometriasSel: function(){ 3693 listaGeometriasSel: function(){
3688 var geos = i3GEO.editorOL.layergrafico.selectedFeatures, 3694 var geos = i3GEO.editorOL.layergrafico.selectedFeatures,
3689 n = geos.length, 3695 n = geos.length,
3690 -ins = "",i,a,w; 3696 +ins = "",i,a,w,g;
3691 for(i=0;i<n;i++){ 3697 for(i=0;i<n;i++){
3692 -ins += "<b>Geometria: "+i+"</b><br>"+geos[i].geometry+"<br><br>"; 3698 +g = geos[i];
  3699 +ins += "<b>Geometria: "+i+"</b><br>"+i3GEO.editorOL.google2wgs(g.geometry)+"<br><br>";
3693 ins += "<b>Atributos: "+i+"</b><br>"; 3700 ins += "<b>Atributos: "+i+"</b><br>";
3694 -a = geos[i].attributes; 3701 +a = g.attributes;
3695 for(key in a){ 3702 for(key in a){
3696 if(a[key]){ 3703 if(a[key]){
3697 ins += key+" = "+a[key]+"<br>"; 3704 ins += key+" = "+a[key]+"<br>";
3698 } 3705 }
3699 } 3706 }
3700 //lista os registros se for fruto de uma captura 3707 //lista os registros se for fruto de uma captura
3701 -if(geos[i].attributes.registros){ 3708 +if(g.attributes.registros){
3702 ins += "<b>Registros: "+i+"</b><br>"; 3709 ins += "<b>Registros: "+i+"</b><br>";
3703 -a = geos[i].attributes.registros; 3710 +a = g.attributes.registros;
3704 for(key in a){ 3711 for(key in a){
3705 if(a[key]){ 3712 if(a[key]){
3706 ins += key+" = "+a[key]+"<br>"; 3713 ins += key+" = "+a[key]+"<br>";
@@ -3726,7 +3733,8 @@ if(geos[0].geometry){ @@ -3726,7 +3733,8 @@ if(geos[0].geometry){
3726 var registros = "", 3733 var registros = "",
3727 valorunico = "", 3734 valorunico = "",
3728 nometema = $i("editorOLcomboTemaEditavel").value, 3735 nometema = $i("editorOLcomboTemaEditavel").value,
3729 -key,tema,redesenha,p; 3736 +key="",tema,redesenha,p,
  3737 +g = i3GEO.editorOL.google2wgs(geos[0].geometry);
3730 if(nometema == ""){ 3738 if(nometema == ""){
3731 return; 3739 return;
3732 } 3740 }
@@ -3751,12 +3759,12 @@ i3GEO.janela.AGUARDEMODAL = false; @@ -3751,12 +3759,12 @@ i3GEO.janela.AGUARDEMODAL = false;
3751 //cria um novo registro 3759 //cria um novo registro
3752 if(valorunico == ""){ 3760 if(valorunico == ""){
3753 p = i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=adicionaGeometria&g_sid="+i3GEO.configura.sid; 3761 p = i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=adicionaGeometria&g_sid="+i3GEO.configura.sid;
3754 -cpJSON.call(p,"foo",redesenha,"&tema="+nometema+"&wkt="+geos[0].geometry); 3762 +cpJSON.call(p,"foo",redesenha,"&tema="+nometema+"&wkt="+g);
3755 } 3763 }
3756 else{ 3764 else{
3757 //atualiza a geometria 3765 //atualiza a geometria
3758 p = i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=atualizaGeometria&g_sid="+i3GEO.configura.sid; 3766 p = i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=atualizaGeometria&g_sid="+i3GEO.configura.sid;
3759 -cpJSON.call(p,"foo",redesenha,"&idunico="+valorunico+"&tema="+nometema+"&wkt="+geos[0].geometry); 3767 +cpJSON.call(p,"foo",redesenha,"&idunico="+valorunico+"&tema="+nometema+"&wkt="+g);
3760 } 3768 }
3761 } 3769 }
3762 }, 3770 },
@@ -3988,9 +3996,9 @@ true @@ -3988,9 +3996,9 @@ true
3988 i3GEO.editorOL.removeClone(); 3996 i3GEO.editorOL.removeClone();
3989 }, 3997 },
3990 beforegetfeatureinfo: function(event){ 3998 beforegetfeatureinfo: function(event){
3991 -var temp,ativo = [i3GEO.editorOL.layerAtivo()]; 3999 +var ativo = [i3GEO.editorOL.layerAtivo()];
3992 //se for TMS tem de pegar o clone wms 4000 //se for TMS tem de pegar o clone wms
3993 -if(ativo[0].CLASS_NAME == "OpenLayers.Layer.TMS"){ 4001 +if(ativo[0].CLASS_NAME == "OpenLayers.Layer.TMS" || ativo[0].CLASS_NAME == "OpenLayers.Layer.OSM"){
3994 ativo = [i3GEO.editorOL.layertms2wms(ativo[0])]; 4002 ativo = [i3GEO.editorOL.layertms2wms(ativo[0])];
3995 } 4003 }
3996 event.object.layers = ativo; 4004 event.object.layers = ativo;
@@ -4402,7 +4410,7 @@ if(document.getElementById(&quot;panellistagEditor&quot;)) @@ -4402,7 +4410,7 @@ if(document.getElementById(&quot;panellistagEditor&quot;))
4402 } 4410 }
4403 }); 4411 });
4404 // 4412 //
4405 -//adiciona o painel ao mapa se alguma op��o foi inserida 4413 +//adiciona o painel ao mapa se alguma opcao foi inserida
4406 // 4414 //
4407 if(adiciona === true){ 4415 if(adiciona === true){
4408 i3GEOpanelEditor.addControls(controles); 4416 i3GEOpanelEditor.addControls(controles);
@@ -4934,6 +4942,16 @@ ls.maximizeDiv.click(); @@ -4934,6 +4942,16 @@ ls.maximizeDiv.click();
4934 desativaRodaDoMouse: function(){ 4942 desativaRodaDoMouse: function(){
4935 var controls = i3GEO.editorOL.mapa.getControlsByClass('OpenLayers.Control.Navigation'); 4943 var controls = i3GEO.editorOL.mapa.getControlsByClass('OpenLayers.Control.Navigation');
4936 for(var i = 0; i<controls.length; ++i){controls[i].disableZoomWheel();} 4944 for(var i = 0; i<controls.length; ++i){controls[i].disableZoomWheel();}
  4945 +},
  4946 +google2wgs: function(obj){
  4947 +if(i3GEO.Interface.openlayers.googleLike === true){
  4948 +var projWGS84 = new OpenLayers.Projection("EPSG:4326"),
  4949 +proj900913 = new OpenLayers.Projection("EPSG:900913");
  4950 +return obj.transform(proj900913, projWGS84);
  4951 +}
  4952 +else{
  4953 +return obj;
  4954 +}
4937 } 4955 }
4938 }; 4956 };
4939 4957
temas/_lbairros.map
@@ -2,41 +2,47 @@ MAP @@ -2,41 +2,47 @@ MAP
2 FONTSET "../symbols/fontes.txt" 2 FONTSET "../symbols/fontes.txt"
3 SYMBOLSET "../symbols/simbolos.sym" 3 SYMBOLSET "../symbols/simbolos.sym"
4 LAYER 4 LAYER
5 - CONNECTION "user=postgres password=postgres dbname=geosaude host=localhost port=5432" 5 + CONNECTION "user=postgres password=postgres dbname=i3geosaude host=localhost port=5432"
6 CONNECTIONTYPE POSTGIS 6 CONNECTIONTYPE POSTGIS
7 DATA "the_geom from (select * from i3geo_metaestat.bairros) as foo using unique gid using srid=4326" 7 DATA "the_geom from (select * from i3geo_metaestat.bairros) as foo using unique gid using srid=4326"
8 METADATA 8 METADATA
9 "METAESTAT_ID_MEDIDA_VARIAVEL" "" 9 "METAESTAT_ID_MEDIDA_VARIAVEL" ""
10 "ID_MEDIDA_VARIAVEL" "" 10 "ID_MEDIDA_VARIAVEL" ""
  11 + "cache" ""
11 "ltempoitemimagem" "" 12 "ltempoitemimagem" ""
12 - "cache" "SIM"  
13 - "ltempoitemdescricao" ""  
14 "CLASSE" "SIM" 13 "CLASSE" "SIM"
15 - "ltempoiteminicio" "" 14 + "ltempoitemdescricao" ""
16 "palletestep" "" 15 "palletestep" ""
17 - "ltempoitemtip" "" 16 + "ltempoiteminicio" ""
18 "permitekmz" "nao" 17 "permitekmz" "nao"
19 - "ltempoitemtitulo" "" 18 + "ltempoitemtip" ""
20 "description_template" "" 19 "description_template" ""
  20 + "ltempoitemtitulo" ""
  21 + "EDITAVEL" "SIM"
21 "ltempoitemlink" "" 22 "ltempoitemlink" ""
22 "METAESTAT_CODIGO_TIPO_REGIAO" "" 23 "METAESTAT_CODIGO_TIPO_REGIAO" ""
23 "palletefile" "" 24 "palletefile" ""
24 - "ltempoformatodata" ""  
25 "permitedownload" "sim" 25 "permitedownload" "sim"
  26 + "ltempoformatodata" ""
26 "ltempoitemicone" "" 27 "ltempoitemicone" ""
27 "metaestat" "" 28 "metaestat" ""
  29 + "ESQUEMATABELAEDITAVEL" "i3geo_metaestat"
28 "itembuscarapida" "no_bairro" 30 "itembuscarapida" "no_bairro"
29 - "permitekml" "sim"  
30 "permiteogc" "sim" 31 "permiteogc" "sim"
31 - "convcaracter" "" 32 + "permitekml" "sim"
32 "TEMA" "Bairros IBGE" 33 "TEMA" "Bairros IBGE"
33 - "ltempoconvencode" "" 34 + "convcaracter" ""
  35 + "COLUNAGEOMETRIA" "the_geom"
  36 + "COLUNAIDUNICO" "teste"
34 "editorsql" "" 37 "editorsql" ""
  38 + "ltempoconvencode" ""
  39 + "TABELAEDITAVEL" "bairros"
35 "ltempoitemfim" "" 40 "ltempoitemfim" ""
36 END # METADATA 41 END # METADATA
37 NAME "_lbairros" 42 NAME "_lbairros"
38 STATUS DEFAULT 43 STATUS DEFAULT
39 TEMPLATE "none.htm" 44 TEMPLATE "none.htm"
  45 + TILEITEM "location"
40 TYPE POLYGON 46 TYPE POLYGON
41 UNITS METERS 47 UNITS METERS
42 CLASS 48 CLASS