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 {