diff --git a/classesjs/classe_editorol.js b/classesjs/classe_editorol.js index d32b34d..e8c260a 100644 --- a/classesjs/classe_editorol.js +++ b/classesjs/classe_editorol.js @@ -1,3 +1,36 @@ +/* +Title: Editor vetorial para OpenLayers + +i3GEO.editorOL + +Funções utilizadas pelo OpenLayers nas opções de edição de dados vetoriais. +É utilizado também pelo mashup com navegação via OpenLayers e com OSM. + +Arquivo: i3geo/classesjs/classe_editorol.js + +Licença: + +GPL2 + +i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet + +Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil +Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com + +Este programa é software livre; você pode redistribuí-lo +e/ou modificá-lo sob os termos da Licença Pública Geral +GNU conforme publicada pela Free Software Foundation; + +Este programa é distribuído na expectativa de que seja útil, +porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita +de COMERCIABILIDADE OU ADEQUACAtilde;O A UMA FINALIDADE ESPECÍFICA. +Consulte a Licença Pública Geral do GNU para mais detalhes. +Você deve ter recebido uma cópia da Licença Pública Geral do +GNU junto com este programa; se não, escreva para a +Free Software Foundation, Inc., no endereço +59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. +*/ + if(!i3GEO || typeof(i3GEO) === 'undefined'){ var i3GEO = { }; @@ -246,7 +279,8 @@ i3GEO.editorOL = { }); } if(i3GEO.editorOL.mapext != ""){ - i3GEO.editorOL.mapa.zoomToExtent(i3GEO.editorOL.mapext); + var m = i3GEO.util.extGeo2OSM(i3GEO.editorOL.mapext); + i3GEO.editorOL.mapa.zoomToExtent(m); } else{ i3GEO.editorOL.mapa.zoomToMaxExtent(); @@ -325,6 +359,7 @@ i3GEO.editorOL = { {p = e.xy;} //altera o indicador de localizacao lonlat = i3GEO.editorOL.mapa.getLonLatFromPixel(p); + lonlat = i3GEO.util.projOSM2Geo(lonlat); d = i3GEO.calculo.dd2dms(lonlat.lon,lonlat.lat); try{ $i(idcoord[0].id).innerHTML = "Long: "+d[0]+"
Lat: "+d[1]; @@ -1447,7 +1482,8 @@ i3GEO.editorOL = { adicionaMarcas: function(){ if(i3GEO.editorOL.pontos.length === 0) {return;} - var SHADOW_Z_INDEX = 10, + var f, + SHADOW_Z_INDEX = 10, MARKER_Z_INDEX = 11, layer = new OpenLayers.Layer.Vector( "pontos", @@ -1476,10 +1512,13 @@ i3GEO.editorOL = { y.push(i3GEO.editorOL.pontos[index+1]); } for (index = 0; index < x.length; index++) { + f = new OpenLayers.Geometry.Point(x[index], y[index]); + f = i3GEO.util.projGeo2OSM(f); + f = new OpenLayers.Feature.Vector( + f + ); features.push( - new OpenLayers.Feature.Vector( - new OpenLayers.Geometry.Point(x[index], y[index]) - ) + f ); } layer.addFeatures(features); diff --git a/classesjs/classe_util.js b/classesjs/classe_util.js index 6ae76c9..744eb35 100644 --- a/classesjs/classe_util.js +++ b/classesjs/classe_util.js @@ -2952,23 +2952,32 @@ i3GEO.util = { Converte string 'xmin ymin xmax ymax' ou 'xmin ymin' de geo para a projecao OSM */ extGeo2OSM: function(ext,retornaArray){ + var metrica,point,proj900913,projWGS84,temp,sep; + sep = " "; + if(typeof ext == "object"){ + return i3GEO.util.projGeo2OSM(ext); + } if(i3GEO.Interface.openlayers.googleLike === true){ - var metrica,point,proj900913,projWGS84,temp = ext.split(" "); + temp = ext.split(sep); + if(temp === 1){ + sep = ","; + temp = ext.split(sep); + } if(temp[0]*1 <= 180 && temp[0]*1 >= -180){ projWGS84 = new OpenLayers.Projection("EPSG:4326"); proj900913 = new OpenLayers.Projection("EPSG:900913"); point = new OpenLayers.LonLat(temp[0], temp[1]); metrica = point.transform(projWGS84,proj900913); - ext = metrica.lon+" "+metrica.lat; + ext = metrica.lon+sep+metrica.lat; if(temp.length > 2){ point = new OpenLayers.LonLat(temp[2], temp[3]); metrica = point.transform(projWGS84,proj900913); - ext += " "+metrica.lon+" "+metrica.lat; + ext += sep+metrica.lon+sep+metrica.lat; } } } if(retornaArray){ - return ext.split(" "); + return ext.split(sep); } else{ return ext; @@ -2980,23 +2989,32 @@ i3GEO.util = { Converte string 'xmin ymin xmax ymax' ou 'xmin ymin' de geo para a projecao OSM */ extOSM2Geo: function(ext,retornaArray){ + var metrica,point,proj900913,projWGS84,temp,sep; + sep = " "; + if(typeof ext == "object"){ + return i3GEO.util.projOSM2Geo(ext); + } if(i3GEO.Interface.openlayers.googleLike === true){ - var metrica,point,proj900913,projWGS84,temp = ext.split(" "); + temp = ext.split(sep); + if(temp === 1){ + sep = ","; + temp = ext.split(sep); + } if(temp[0]*1 >= 180 || temp[0]*1 <= -180){ projWGS84 = new OpenLayers.Projection("EPSG:4326"); proj900913 = new OpenLayers.Projection("EPSG:900913"); point = new OpenLayers.LonLat(temp[0], temp[1]); metrica = point.transform(proj900913,projWGS84); - ext = metrica.lon+" "+metrica.lat; + ext = metrica.lon+sep+metrica.lat; if(temp.length > 2){ point = new OpenLayers.LonLat(temp[2], temp[3]); metrica = point.transform(proj900913,projWGS84); - ext += " "+metrica.lon+" "+metrica.lat; + ext += sep+metrica.lon+sep+metrica.lat; } } } if(retornaArray){ - return ext.split(" "); + return ext.split(sep); } else{ return ext; @@ -3016,6 +3034,19 @@ i3GEO.util = { return obj; }, /* + Function: projGeo2OSM + + Projeta um objeto OpenLayers de GEO para OSM + */ + projGeo2OSM: function(obj){ + if(i3GEO.Interface.openlayers.googleLike === true){ + projWGS84 = new OpenLayers.Projection("EPSG:4326"); + proj900913 = new OpenLayers.Projection("EPSG:900913"); + obj = obj.transform(projWGS84,proj900913); + } + return obj; + }, + /* Function: navegadorDir Abre o navegador de arquivos localizados no servidor diff --git a/mashups/index.html b/mashups/index.html index d0857c1..a29abcd 100644 --- a/mashups/index.html +++ b/mashups/index.html @@ -70,8 +70,13 @@ body,td {

- Duas camadas mas com apenas uma visível na inicialização do mapa openlayers.php?temas=_wbiomashp,_lbiomashp,locali&largura=800&altura=500&visiveis=_wbiomashp,_lbiomashp + Duas camadas mas com apenas uma visível na inicialização do mapa +

+

+ Windows: openlayers.php?temas=_wbiomashp,_wlocali&largura=800&altura=500&visiveis=_wbiomashp +

+

+ Linux: openlayers.php?temas=_lbiomashp,_llocali&largura=800&altura=500&visiveis=_lbiomashp

diff --git a/mashups/openlayers.php b/mashups/openlayers.php index 1120e3c..0811f2f 100644 --- a/mashups/openlayers.php +++ b/mashups/openlayers.php @@ -271,8 +271,7 @@ if($temas != ""){ } } $visivel = "false"; - if(in_array($tema,$visiveis)) - { + if(in_array($tema,$visiveis)){ $visivel = "true"; } // echo $visivel;exit; @@ -285,16 +284,11 @@ if($temas != ""){ $objOpenLayers[] = 'new OpenLayers.Layer.WMS( "'.$tituloLayer.'", "../ogc.php?'.$nocache.'tema='.$tema.'&DESLIGACACHE='.$DESLIGACACHE.'&",{cloneTMS:"'.$nomeLayer.'",layers:"'.$nomeLayer.'",transparent: "true", format: "image/png"},{displayInLayerSwitcher:false,singleTile:true,visibility:false,isBaseLayer:false})'; } else{ - // $objOpenLayers[] = 'new OpenLayers.Layer.WMS( - // "'.$tituloLayer.'", - // "../ogc.php?tema='.$tema.'&DESLIGACACHE='.$DESLIGACACHE.'&",{layers:"'.$nomeLayer.'",transparent: - // "true", format: - // "image/png"},{singleTile:true,visibility:'.$visivel.',isBaseLayer:'.$ebase.'})'; foreach($layers as $l){ $tituloLayer = $l->getmetadata("tema"); $nomeLayer = $l->name; $visivel = "false"; - if($l->status == MS_DEFAULT || $nlayers == 1){ + if($l->status == MS_DEFAULT || in_array($tema,$visiveis)){ $visivel = "true"; } if($tituloLayer != ""){ diff --git a/mashups/osm.php b/mashups/osm.php index 64abf86..9845e9a 100755 --- a/mashups/osm.php +++ b/mashups/osm.php @@ -289,7 +289,7 @@ if($temas != ""){ $tituloLayer = $l->getmetadata("tema"); $nomeLayer = $l->name; $visivel = "false"; - if($l->status == MS_DEFAULT || $nlayers == 1){ + if($l->status == MS_DEFAULT || in_array($tema,$visiveis)){ $visivel = "true"; } if($tituloLayer != ""){ @@ -397,18 +397,18 @@ function ajuda(){ - - + - + ---> + 0){ @@ -532,16 +532,17 @@ if(isset($mapext)){ } else{ echo "i3GEO.editorOL.mapext = new OpenLayers.Bounds('-15125970.651191 -5205055.877383 15125970.651191 5205055.877383');\n"; -} +} if(empty($fundo)){ // echo "i3GEO.editorOL.mapa.allOverlays = true;"; } ?> +i3GEO.Interface = {openlayers:{googleLike:true}}; i3GEO.editorOL.fundo = "osm"; var temp = i3GEO.editorOL.minresolution, r = [ i3GEO.editorOL.minresolution ]; -for (j = 0; j < (i3GEO.editorOL.numzoom - 1); j++) { +for (var j = 0; j < (i3GEO.editorOL.numzoom - 1); j++) { temp = temp / 2; r.push(temp); } @@ -562,7 +563,7 @@ i3GEO.editorOL.inicia(); if(!i3GEO.configura){ i3GEO.configura = {"locaplic": "../"}; } -i3GEO.Interface = {openlayers:{googleLike:true}}; +