From 0781c09426d7f0eb7b3b62972c74f7209b2a9afc Mon Sep 17 00:00:00 2001
From: Edmar Moretti
Date: Sun, 4 Jul 2010 09:43:44 +0000
Subject: [PATCH] Atualização da API do Google Maps para 3.0
---
aplicmap/geral.htm | 2 +-
aplicmap/googlemaps.phtml | 159 ++++++++++++++++++++++++++++++---------------------------------------------------------------------------------------------------------------------------------
aplicmap/openlayers.htm | 6 ++----
classesjs/classe_analise.js | 8 ++++----
classesjs/classe_arvoredecamadas.js | 15 +++++++++++----
classesjs/classe_configura.js | 4 ++++
classesjs/classe_guias.js | 4 ++++
classesjs/classe_interface.js | 300 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------------------------------------------
classesjs/classe_mapa.js | 2 +-
classesjs/classe_navega.js | 5 +++++
classesjs/classe_php.js | 15 +++++++++++++++
classesphp/mapa_controle.php | 10 ++++++++++
classesphp/mapa_googlemaps.php | 15 ++++++---------
classesphp/mapa_inicia.php | 3 ++-
menutemas/admin.db | Bin 65536 -> 0 bytes
15 files changed, 255 insertions(+), 293 deletions(-)
diff --git a/aplicmap/geral.htm b/aplicmap/geral.htm
index a8a8b6a..2d3e78c 100644
--- a/aplicmap/geral.htm
+++ b/aplicmap/geral.htm
@@ -215,7 +215,7 @@ i3GEO.barraDeBotoes.AUTO = true //as barras de botões serão construídas automati
i3GEO.idioma.IDSELETOR = "seletorIdiomas"
i3GEO.interface.ATIVAMENUCONTEXTO = true;
-
+i3GEO.guias.CONFIGURA.temas.titulo = "teste"
i3GEO.inicia();
//
//inclui um tema via javascript
diff --git a/aplicmap/googlemaps.phtml b/aplicmap/googlemaps.phtml
index bdbace4..887ec4c 100644
--- a/aplicmap/googlemaps.phtml
+++ b/aplicmap/googlemaps.phtml
@@ -15,7 +15,10 @@ include_once("../ms_configura.php");
}
MMA - Mapa interativo
+
+
@@ -74,13 +77,15 @@ include_once("../ms_configura.php");
|
- Aguarde...
|
|
- |
+
+
+
+ |
| | |
@@ -89,148 +94,44 @@ include_once("../ms_configura.php");
|
|
geoprocessamento@mma.gov.br |
-
-
-
-  |
-
-
-
-

-
-
-
-

-
-
-
-

-
-
-
-

-
-
-
-

-
-
-
-

-
-
-
-

-
-
-
-
-

-
-
-
-

-
-
-
-

-
-
-
-

-
-
-
-

-
-
-
@@ -163,7 +163,6 @@ Para definir quais botões das barras de ferramentas serão incluídos no mapa, vej
É utilizada para identificar o local correto onde estão os programas em php que são utilizados.
*/
i3GEO.configura.locaplic = i3GEO.util.protocolo()+"://"+window.location.host+"/i3geo";
-var g_localimg = i3GEO.util.protocolo()+"://"+window.location.host+"/i3geo/imagens";
i3GEO.Interface.ATUAL = "openlayers";
i3GEO.Interface.IDCORPO = "contemImg";
@@ -176,7 +175,7 @@ i3GEO.Interface.openlayers.GADGETS = {
ScaleLine:true,
OverviewMap:false
};
-i3GEO.Interface.openlayers.TILES = false;
+i3GEO.Interface.openlayers.TILES = true;
/*
Após a criação, é criado o objeto i3geoOL que corresponde ao objeto map da API do OpenLayers.
Vc pode usar i3geoOL para aplicar os métodos e verificar as propriedades da API do OpenLayers
@@ -184,7 +183,6 @@ Vc pode usar i3geoOL para aplicar os métodos e verificar as propriedades da API
i3GEO.cria();
/*
Inicializa o mapa
-
*/
i3GEO.barraDeBotoes.AUTOALTURA = false;
i3GEO.barraDeBotoes.ATIVAMENUCONTEXTO = false;
diff --git a/classesjs/classe_analise.js b/classesjs/classe_analise.js
index 5d1e4e4..caf5721 100644
--- a/classesjs/classe_analise.js
+++ b/classesjs/classe_analise.js
@@ -333,7 +333,7 @@ i3GEO.analise = {
pontosdistobj.yimg[n] = objposicaocursor.imgy;
pontosdistobj.dist[n] = 0;
//cria a linha que será utilizada para seguir a posição do mouse e o último ponto
- if(i3GEO.Interface.ATUAL === "padrao" || i3GEO.Interface.ATUAL === "openlayers"){
+ if(i3GEO.Interface.ATUAL === "padrao" || i3GEO.Interface.ATUAL === "openlayers" || i3GEO.Interface.ATUAL === "googlemaps"){
try{
if (navn)
{pontosdistobj.linhas[n] = i3GEO.desenho.richdraw.renderer.create(i3GEO.desenho.richdraw.mode, i3GEO.desenho.richdraw.fillColor, i3GEO.desenho.richdraw.lineColor, i3GEO.desenho.richdraw.lineWidth, (pontosdistobj.ximg[n]-1),(pontosdistobj.yimg[n]-1),(pontosdistobj.ximg[n]-1),(pontosdistobj.yimg[n]-1));}
@@ -355,7 +355,7 @@ i3GEO.analise = {
pontosdistobj.dist[n] = d + pontosdistobj.dist[n-1];
if($i("pararraios") && $i("pararraios").checked === true ){
- if(i3GEO.Interface.ATUAL === "padrao" || i3GEO.Interface.ATUAL === "openlayers"){
+ if(i3GEO.Interface.ATUAL === "padrao" || i3GEO.Interface.ATUAL === "openlayers" || i3GEO.Interface.ATUAL === "googlemaps"){
i3GEO.desenho.aplica("insereCirculo","",n);
if(navm)
{pontosdistobj.linhas[n] = i3GEO.desenho.richdraw.renderer.create(i3GEO.desenho.richdraw.mode, i3GEO.desenho.richdraw.fillColor, i3GEO.desenho.richdraw.lineColor, i3GEO.desenho.richdraw.lineWidth, (pontosdistobj.ximg[n-1])-(i3GEO.parametros.w/2),pontosdistobj.yimg[n-1],(pontosdistobj.ximg[n])-(i3GEO.parametros.w/2),pontosdistobj.yimg[n]);}
@@ -366,7 +366,7 @@ i3GEO.analise = {
}
}
if($i("parartextos") && $i("parartextos").checked === true ){
- if(i3GEO.Interface.ATUAL === "padrao" || i3GEO.Interface.ATUAL === "openlayers"){
+ if(i3GEO.Interface.ATUAL === "padrao" || i3GEO.Interface.ATUAL === "openlayers" || i3GEO.Interface.ATUAL === "googlemaps"){
i3GEO.desenho.aplica("insereTexto","",n,d+" km");
}
}
@@ -375,7 +375,7 @@ i3GEO.analise = {
i3GEO.Interface.googleearth.insereLinha(pontosdistobj.xpt[n-1],pontosdistobj.ypt[n-1],pontosdistobj.xpt[n],pontosdistobj.ypt[n],"divGeometriasTemp");
}
}
- if(i3GEO.Interface.ATUAL === "padrao" || i3GEO.Interface.ATUAL === "openlayers")
+ if(i3GEO.Interface.ATUAL === "padrao" || i3GEO.Interface.ATUAL === "openlayers" || i3GEO.Interface.ATUAL === "googlemaps")
{i3GEO.util.insereMarca.cria(objposicaocursor.imgx,objposicaocursor.imgy,i3GEO.analise.medeDistancia.fechaJanela,"divGeometriasTemp");}
if(i3GEO.Interface.ATUAL === "googleearth")
{i3GEO.util.insereMarca.cria(objposicaocursor.ddx,objposicaocursor.ddy,i3GEO.analise.medeDistancia.fechaJanela,"divGeometriasTemp","");}
diff --git a/classesjs/classe_arvoredecamadas.js b/classesjs/classe_arvoredecamadas.js
index 4f3a2a1..af68546 100644
--- a/classesjs/classe_arvoredecamadas.js
+++ b/classesjs/classe_arvoredecamadas.js
@@ -1046,11 +1046,13 @@ i3GEO.arvoreDeCamadas = {
{t = i3GEO.arvoreDeCamadas.listaLigadosDesligados("mantem");}
if(tipo === "ligartodos"){
t = i3GEO.arvoreDeCamadas.listaLigadosDesligados("marca");
- if(i3GEO.Interface.ATUAL === "openlayers"){return;}
+ if(i3GEO.Interface.ATUAL === "openlayers" || i3GEO.Interface.ATUAL === "googlemaps")
+ {return;}
}
if(tipo === "desligartodos"){
t = i3GEO.arvoreDeCamadas.listaLigadosDesligados("desmarca");
- if(i3GEO.Interface.ATUAL === "openlayers"){return;}
+ if(i3GEO.Interface.ATUAL === "openlayers" || i3GEO.Interface.ATUAL === "googlemaps")
+ {return;}
}
//
//zera o contador de tempo
@@ -1123,13 +1125,18 @@ i3GEO.arvoreDeCamadas = {
if(tipo === "marca"){
c.checked = true;
if(i3GEO.Interface.ATUAL === "openlayers"){
- i3geoOL.getLayersByName(c.value)[0].setVisibility(true);
+ i3GEO.Interface.openlayers.ligaDesliga(c);
+ }
+ if(i3GEO.Interface.ATUAL === "googlemaps"){
+ i3GEO.Interface.googlemaps.ligaDesliga(c);
}
}
if(tipo === "desmarca"){
c.checked = false;
if(i3GEO.Interface.ATUAL === "openlayers")
- {i3geoOL.getLayersByName(c.value)[0].setVisibility(false);}
+ {i3GEO.Interface.openlayers.ligaDesliga(c);}
+ if(i3GEO.Interface.ATUAL === "googlemaps")
+ {i3GEO.Interface.googlemaps.ligaDesliga(c);}
}
}
}
diff --git a/classesjs/classe_configura.js b/classesjs/classe_configura.js
index e1521d7..e0cded1 100644
--- a/classesjs/classe_configura.js
+++ b/classesjs/classe_configura.js
@@ -572,6 +572,10 @@ i3GEO.configura = {
i3GEO.Interface.openlayers.zoom2ext(i3GEO.parametros.extentTotal);
return;
}
+ if(i3GEO.Interface.ATUAL === "googlemaps"){
+ i3GEO.Interface.googlemaps.zoom2extent(i3GEO.parametros.extentTotal);
+ return;
+ }
i3GEO.navega.zoomExt(i3GEO.configura.locaplic,i3GEO.configura.sid,i3GEO.configura.tipoimagem,i3GEO.parametros.extentTotal);
marcadorZoom = "";
}
diff --git a/classesjs/classe_guias.js b/classesjs/classe_guias.js
index a0696ff..8d0f7fa 100644
--- a/classesjs/classe_guias.js
+++ b/classesjs/classe_guias.js
@@ -61,6 +61,10 @@ i3GEO.guias = {
Define os parâmetros de cada guia que será mostrada no mapa, como título, conteúdo, etc.
+ Você pode modificar o nome de uma guia como no exemplo
+
+ i3GEO.guias.CONFIGURA.legenda.titulo = "nome diferente";
+
Exemplo
i3GEO.guias.CONFIGURA.legenda = {
diff --git a/classesjs/classe_interface.js b/classesjs/classe_interface.js
index 298a549..67483aa 100644
--- a/classesjs/classe_interface.js
+++ b/classesjs/classe_interface.js
@@ -982,8 +982,6 @@ i3GEO.Interface = {
}
if ($i("barraDeBotoes2") || i3GEO.barraDeBotoes.AUTO === true)
{i3GEO.barraDeBotoes.inicializaBarra("barraDeBotoes2","i3geo_barra2",false,x2,y2);}
- //if(i3GEO.Interface.ATIVAMENUCONTEXTO)
- //{i3GEO.Interface.padrao.ativaMenuContexto();}
if(i3GEO.configura.visual !== "default")
{i3GEO.gadgets.visual.troca(i3GEO.configura.visual);}
i3GEO.barraDeBotoes.ativaBotoes();
@@ -1042,12 +1040,12 @@ i3GEO.Interface = {
Tipo de mapa que será usado como default, conforme constantes definidas na API do Google Maps.
Default:
- "G_PHYSICAL_MAP"
+ "roadmap"
Tipo:
- {string - Google API constante GMapType "G_SATELLITE_MAP"|"G_PHYSICAL_MAP"|"G_HYBRID_MAP"}
+ {string - Google API constante "satellite"|"roadmap"|"hybrid"|"terrain"}
*/
- TIPOMAPA: "G_PHYSICAL_MAP",
+ TIPOMAPA: "terrain",
/*
Variable
@@ -1066,20 +1064,19 @@ i3GEO.Interface = {
i3GEO.atualiza(retorno);
},
redesenha: function(){
- try{
- if(i3GeoMap !== ""){
- posfixo = posfixo + "&";
- i3GeoMap.removeOverlay(i3GEOTileO);
- var i3GEOTile = new GTileLayer(null,0,18,{
- tileUrlTemplate:i3GEO.Interface.googlemaps.criaTile()+posfixo,
- isPng:true,
- opacity:i3GEO.Interface.googlemaps.OPACIDADE });
- i3GEOTileO = new GTileLayerOverlay(i3GEOTile);
- i3GeoMap.addOverlay(i3GEOTileO);
+ //
+ //remove todos os layers
+ //
+ var nlayers = i3GEO.arvoreDeCamadas.CAMADAS.length,
+ i,
+ camada;
+ for (i=0;i";
- html += " "+nomeOverlay+"";
+ if(navm)
+ {estilo = "cursor:default;vertical-align:35%;padding-top:0px;";}
+ else
+ {estilo = "cursor:default;vertical-align:top;";}
+
+ html += " "+nomeOverlay+"";
d = {html:html};
nodekml = new YAHOO.widget.HTMLNode(d, node, true,true);
nodekml.enableHighlight = false;
@@ -1402,13 +1420,15 @@ i3GEO.Interface = {
Parametro:
obj {object} - objeto do tipo checkbox que foi ativado/desativado
+
+ url {string} - url do KML
*/
- ativaDesativaCamadaKml: function(obj){
- if(!obj.checked){
- eval("i3GeoMap.removeOverlay("+obj.value+")");
+ ativaDesativaCamadaKml: function(obj,url){
+ if(!obj.checked)
+ {eval(obj.value+".setMap(null);");}
+ else{
+ eval(obj.value+" = new google.maps.KmlLayer(url,{map:i3GeoMap,preserveViewport:true});");
}
- else
- {eval("i3GeoMap.addOverlay("+obj.value+")");}
}
},
/*
diff --git a/classesjs/classe_mapa.js b/classesjs/classe_mapa.js
index d2d0bc2..b380de2 100644
--- a/classesjs/classe_mapa.js
+++ b/classesjs/classe_mapa.js
@@ -142,7 +142,7 @@ i3GEO.mapa = {
i3GEO.mapa.recupera.TENTATIVA = 0;
}
catch(e){
- if(i3GEO.Interface.ATUAL === "openlayers"){
+ if(i3GEO.Interface.ATUAL === "openlayers" || i3GEO.Interface.ATUAL === "googlemaps"){
i3GEO.janela.fechaAguarde();
return;
}
diff --git a/classesjs/classe_navega.js b/classesjs/classe_navega.js
index 4dd047a..7414488 100644
--- a/classesjs/classe_navega.js
+++ b/classesjs/classe_navega.js
@@ -599,6 +599,9 @@ i3GEO.navega = {
clearTimeout(i3GEO.navega.contaTempoRedesenho);
if(i3GEO.Interface.ATUAL === "openlayers")
{i3GEO.Interface.openlayers.atualizaMapa();}
+ if(i3GEO.Interface.ATUAL === "googlemaps")
+ {i3GEO.Interface.googlemaps.redesenha();}
+
else{
i3GEO.contadorAtualiza++;
i3GEO.atualiza("");
@@ -798,6 +801,8 @@ i3GEO.navega = {
Ao ser chamada, essa função muda o modo atual, ativando ou desativando o entorno
*/
ativaDesativa: function(){
+ if(i3GEO.Interface.ATUAL === "googlemaps")
+ {alert("Essa operação não funciona nessa interface");return;}
if(i3GEO.Interface.ATUAL === "openlayers")
{i3GEO.Interface.openlayers.inverteModoTile();return;}
var letras,l;
diff --git a/classesjs/classe_php.js b/classesjs/classe_php.js
index c175462..123c30c 100644
--- a/classesjs/classe_php.js
+++ b/classesjs/classe_php.js
@@ -481,6 +481,10 @@ i3GEO.php = {
i3GEO.Interface.openlayers.pan2ponto(x,y);
i3GEO.janela.fechaAguarde();
}
+ if(i3GEO.Interface.ATUAL === "googlemaps"){
+ i3GEO.Interface.googlemaps.pan2ponto(x,y);
+ i3GEO.janela.fechaAguarde();
+ }
funcao.call(retorno);
};
var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?funcao=zoomponto&pin=pin&xy="+x+" "+y+"&g_sid="+i3GEO.configura.sid;
@@ -848,6 +852,17 @@ i3GEO.php = {
cpJSON.call(p,"montaFlamingo",funcao);
},
/*
+ Function: googlemaps
+
+
+ */
+ googlemaps: function(funcao){
+ i3GEO.php.verifica();
+ var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?funcao=googlemaps&g_sid="+i3GEO.configura.sid;
+ cpJSON.call(p,"googlemaps",funcao);
+ },
+
+ /*
Function: openlayers
diff --git a/classesphp/mapa_controle.php b/classesphp/mapa_controle.php
index a534a5a..ff9b790 100644
--- a/classesphp/mapa_controle.php
+++ b/classesphp/mapa_controle.php
@@ -253,6 +253,16 @@ Prepara o mapa atual para funcionar na interface openlayers.
include_once("mapa_inicia.php");
iniciaMapa();
break;
+/*
+Valor: GOOGLEMAPS
+
+Prepara o mapa atual para funcionar na interface googlemaps.
+*/
+ case "GOOGLEMAPS":
+ $interface = "googlemaps";
+ include_once("mapa_inicia.php");
+ iniciaMapa();
+ break;
/*
Section: Análise
diff --git a/classesphp/mapa_googlemaps.php b/classesphp/mapa_googlemaps.php
index 7969bfb..c4f2d1d 100644
--- a/classesphp/mapa_googlemaps.php
+++ b/classesphp/mapa_googlemaps.php
@@ -67,10 +67,6 @@ $poPoint2->project($projInObj, $projOutObj);
$_GET["BBOX"] = $poPoint1->x." ".$poPoint1->y." ".$poPoint2->x." ".$poPoint2->y;
-
-
-
-
//echo $_GET["BBOX"];
$_GET["mapext"] = str_replace(","," ",$_GET["BBOX"]);
$_GET["map_size"] = "256 256";
@@ -93,8 +89,8 @@ foreach ($layersNames as $layerName)
include_once("funcoes_gerais.php");
autoClasses(&$l,$mapa);
}
- //if($layerName != $_GET["layer"])
- //{$l->set("status",MS_OFF);}
+ if($layerName != $_GET["layer"])
+ {$l->set("status",MS_OFF);}
if($layerName == $_GET["layer"] || $l->group == $_GET["layer"] && $l->group != "")
{
$l->set("status",MS_DEFAULT);
@@ -111,8 +107,9 @@ foreach ($layersNames as $layerName)
{$l->set("connection",$postgis_mapa[$lcon]);}
}
}
-
}
+ if($l->getProjection() == MS_FALSE)
+ {$l->setProjection("init=epsg:4291");}
}
if($layerName == $_GET["layer"])
{
@@ -126,8 +123,8 @@ foreach ($layersNames as $layerName)
}
$l->set("template","none.htm");
}
-//if($_GET["layer"] == "")
-//{$cache = true;}
+if($_GET["layer"] == "")
+{$cache = true;}
if($_GET == false)
{$cache = false;}
if($_GET["DESLIGACACHE"] == "sim")
diff --git a/classesphp/mapa_inicia.php b/classesphp/mapa_inicia.php
index 818ac6d..9410d14 100644
--- a/classesphp/mapa_inicia.php
+++ b/classesphp/mapa_inicia.php
@@ -137,7 +137,8 @@ function iniciaMapa()
}
}
}
- $layer->setProjection("init=epsg:4291");
+ if($layer->getProjection() == MS_FALSE)
+ {$layer->setProjection("init=epsg:4291");}
}
$temp = $m->scalebar;
$temp->set("status",MS_OFF);
diff --git a/menutemas/admin.db b/menutemas/admin.db
index cd3aff2..cc051a4 100644
Binary files a/menutemas/admin.db and b/menutemas/admin.db differ
--
libgit2 0.21.2