/*jslint plusplus:false,white:false,undef: false, rhino: true, onevar: true, evil: false */
/*
Title: Interface
Arquivo:
i3geo/classesjs/classe_interface.js
Licenca:
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@mma.gov.br
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;
tanto a versão 2 da Licença.
Este programa é distribuído na expectativa de que seja útil,
porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita
de COMERCIABILIDADE OU ADEQUAÇÃ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(typeof(i3GEO) === 'undefined'){
i3GEO = [];
}
/*
Classe: i3GEO.Interface
Funcoes que controlam o comportamento específico de determinadas interfaces
As interfaces são definidas na inicialização do i3Geo, por exemplo, openlayers, flamingo,etc
A classe "interface" contém os métdos específicos utilizados nessas interfaces
Exemplo:
Para iniciar o i3geo com uma interface específica, utilize http://localhost/i3geo/ms_criamapa.php?interface=flamingo.htm
O HTML deve conter as definições da interface criada e deve estar armazenado em i3geo/aplicmap
*/
i3GEO.Interface = {
/*
Propriedade: OUTPUTFORMAT
Formato de geração da imagem.
Os formatos devem estar definidos no mapfile geral1windows.map e geral1.map. A definição dessa variável não afeta a interface padrão, que utiliza a definição que estiver ativa nos mapfiles de inicialização.
Tipo:
{MAPSERVER OUTPUTFORMAT}
Default:
{"AGG_Q"}
*/
OUTPUTFORMAT: "AGG_Q",
/*
Propriedade: BARRABOTOESTOP
Distância da barra de botões em ralação ao topo do mapa.
Tipo:
{number}
Default:
{12}
*/
BARRABOTOESTOP: 12,
/*
Propriedade: BARRABOTOESLEFT
Distância da barra de botões em ralação ao lado esquerdo do mapa.
Tipo:
{number}
Default:
{3}
*/
BARRABOTOESLEFT: 3,
/*
Propriedade: ATUAL
Interface atual em uso.
Tipo:
{string}
Default:
{"padrao"}
*/
ATUAL: "padrao",
/*
Propriedade: IDCORPO
ID do elemento HTML que receberá o corpo do mapa
Tipo:
{string}
Default:
{"corpoMapa"}
*/
IDCORPO: "corpoMapa",
/*
Propriedade: ATIVAMENUCONTEXTO
Indica se o menu de contexto deve ser ativado
Tipo:
{Boolean}
Default:
{true}
*/
ATIVAMENUCONTEXTO: false,
/*
Variavel: IDMAPA
ID do elemento HTML criado para conter o mapa
Esse elemento normalmente é criado dentro de IDCORPO dependendo da interface
*/
IDMAPA: "",
/*
Variavel: STATUS
Indica o status atual do mapa.
É utilizado para verificar o status do mapa e bloquear ou não determinadas funções.
Por exemplo, na interface OpenLayers, identifica se as camadas estão sendo atualizadas
STATUS = {
atualizando: new Array() //guarda os códigos dos layers que estão sendo redesenhados
}
*/
STATUS: {
atualizando: []
},
/*
Function: redesenha
Aplica o método redesenha da interface atual. Em alguns casos, a função de redesenho aplica os mesmos
processos da função de atualizar o mapa. Isso ocorre pq em alguns casos as funções são otimizadas para cada
situação
*/
redesenha: function(){
if(typeof(console) !== 'undefined'){console.info("i3GEO.Interface.redesenha()");}
if(i3GEO.Interface.ATUAL === "padrao")
{i3GEO.Interface.padrao.redesenha();}
if(i3GEO.Interface.ATUAL === "openlayers")
{i3GEO.Interface.openlayers.redesenha();}
if(i3GEO.Interface.ATUAL === "googlemaps")
{i3GEO.Interface.googlemaps.redesenha();}
if(i3GEO.Interface.ATUAL === "googleearth")
{i3GEO.Interface.googleearth.redesenha();}
if(i3GEO.Interface.ATUAL === "flamingo")
{i3GEO.Interface.flamingo.redesenha();}
},
/*
Function: atualizaMapa
Aplica o método atualizaMapa da interface atual. Em alguns casos, a função de redesenho aplica os mesmos
processos da função de atualizar o mapa. Isso ocorre pq em alguns casos as funções são otimizadas para cada
situação
*/
atualizaMapa: function(){
if(typeof(console) !== 'undefined'){console.info("i3GEO.Interface.atualizaMapa()");}
if(i3GEO.Interface.ATUAL === "padrao")
{i3GEO.atualiza();}
if(i3GEO.Interface.ATUAL === "openlayers")
{i3GEO.Interface.openlayers.atualizaMapa();}
if(i3GEO.Interface.ATUAL === "googlemaps")
{i3GEO.Interface.googlemaps.redesenha();}
if(i3GEO.Interface.ATUAL === "googleearth")
{i3GEO.Interface.googleearth.redesenha();}
if(i3GEO.Interface.ATUAL === "flamingo")
{i3GEO.Interface.flamingo.redesenha();}
},
/*
Function: atualizaTema
Aplica o método atualizaTema da interface atual
Parametros:
retorno {JSON} - objeto JSON com os parâmetros obtidos da função PHP de redesenho do mapa
tema {string} - código do tema
*/
atualizaTema: function(retorno,tema){
if(typeof(console) !== 'undefined'){console.info("i3GEO.Interface.atualizaTema()");}
if(i3GEO.Interface.ATUAL === "padrao")
{return;}
if(i3GEO.Interface.ATUAL === "openlayers")
{i3GEO.Interface.openlayers.atualizaTema(retorno,tema);}
if(i3GEO.Interface.ATUAL === "googlemaps")
{i3GEO.Interface.googlemaps.atualizaTema(retorno,tema);}
if(i3GEO.Interface.ATUAL === "googleearth")
{i3GEO.Interface.googleearth.atualizaTema(retorno,tema);}
if(i3GEO.Interface.ATUAL === "flamingo")
{i3GEO.Interface.flamingo.atualizaTema(retorno,tema);}
},
/*
Function: adicionaKml
Aplica o método de adição de kml ao mapa conforme a interface atual
*/
adicionaKml: function(){
if(typeof(console) !== 'undefined'){console.info("i3GEO.Interface.adicionaKml()");}
if(i3GEO.Interface.ATUAL === "googlemaps")
{i3GEO.Interface.googlemaps.adicionaKml("foo");}
if(i3GEO.Interface.ATUAL === "googleearth")
{i3GEO.Interface.googleearth.adicionaKml("foo");}
},
/*
Function: cria
Cria ou altera os elementos HTML necessários para a interface
Essa função é executada na inicialização do i3geo
Parametros:
w {Integer} - largura do corpo do mapa em pixels
h {Integer} - altura do corpo do mapa em pixels
*/
cria: function(w,h){
if(typeof(console) !== 'undefined'){console.info("i3GEO.Interface.cria()");}
if(i3GEO.Interface.ATUAL === "padrao")
{i3GEO.Interface.padrao.cria(w,h);}
if(i3GEO.Interface.ATUAL === "openlayers")
{i3GEO.Interface.openlayers.cria(w,h);}
if(i3GEO.Interface.ATUAL === "googlemaps")
{i3GEO.Interface.googlemaps.cria(w,h);}
if(i3GEO.Interface.ATUAL === "googleearth")
{i3GEO.Interface.googleearth.cria(w,h);}
if(i3GEO.Interface.ATUAL === "flamingo")
{i3GEO.Interface.flamingo.cria(w,h);}
},
/*
Function: inicia
Inicia a interface
*/
inicia: function(w,h){
if(typeof(console) !== 'undefined'){console.info("i3GEO.Interface.inicia()");}
if(i3GEO.Interface.ATUAL === "padrao")
{i3GEO.Interface.padrao.inicia();}
if(i3GEO.Interface.ATUAL === "openlayers")
{i3GEO.Interface.openlayers.inicia();}
if(i3GEO.Interface.ATUAL === "googlemaps")
{i3GEO.Interface.googlemaps.inicia();}
if(i3GEO.Interface.ATUAL === "googleearth")
{i3GEO.Interface.googleearth.inicia();}
if(i3GEO.Interface.ATUAL === "flamingo")
{i3GEO.Interface.flamingo.inicia();}
},
/*
Function: alteraLayers
Altera todos os layers do mapa modificando um determinado parâmetro
*/
alteraParametroLayers: function(parametro,valor){
if(typeof(console) !== 'undefined'){console.info("i3GEO.Interface.inicia()");}
if(i3GEO.Interface.ATUAL === "padrao")
{i3GEO.atualiza();}
if(i3GEO.Interface.ATUAL === "openlayers")
{i3GEO.Interface.openlayers.alteraParametroLayers(parametro,valor);}
if(i3GEO.Interface.ATUAL === "googlemaps")
{i3GEO.Interface.googlemaps.alteraParametroLayers(parametro,valor);}
if(i3GEO.Interface.ATUAL === "googleearth")
{i3GEO.atualiza();}
if(i3GEO.Interface.ATUAL === "flamingo")
{i3GEO.atualiza();}
},
/*
Function: ativaBotoes
Ativa os botões de ferramentas
*/
ativaBotoes: function(){
if(typeof(console) !== 'undefined'){console.info("i3GEO.Interface.ativaBotoes()");}
if(i3GEO.Interface.ATUAL === "padrao")
{i3GEO.Interface.padrao.ativaBotoes();}
if(i3GEO.Interface.ATUAL === "openlayers")
{i3GEO.Interface.openlayers.ativaBotoes();}
if(i3GEO.Interface.ATUAL === "googlemaps")
{i3GEO.Interface.googlemaps.ativaBotoes();}
if(i3GEO.Interface.ATUAL === "googleearth")
{i3GEO.Interface.googleearth.ativaBotoes();}
if(i3GEO.Interface.ATUAL === "flamingo")
{i3GEO.Interface.flamingo.ativaBotoes();}
},
/*
Classe: i3GEO.Interface.padrao
Interface padrão com motor de navegação do próprio i3Geo
Utilizado quando
i3GEO.Interface.ATUAL = "padrao"
*/
padrao:{
/*
Propriedade: TRANSICAO
Ativa ou não o modo de transição suave das imagens quando o mapa é redesenhado.
Default:
true
Tipo:
{Boolean}
*/
TRANSICAO: false,
redesenha:function(){
var ndiv,i;
if(!$i("img")){
i3GEO.janela.fechaAguarde();
return;
}
$i("img").onload = function()
{
var imagem,temp;
imagem = $i("img");
imagem.onload = "";
//atualiza quadro
i3GEO.gadgets.quadros.grava("imagem",i3GEO.parametros.mapimagem);
i3GEO.gadgets.quadros.grava("extensao",i3GEO.parametros.mapexten);
temp = function(retorno){
eval(retorno.data);
i3GEO.gadgets.quadros.grava("legenda",legimagem);
};
if(i3GEO.gadgets.quadros.geraLegenda === true)
{i3GEO.mapa.legendaIMAGEM.obtem(temp);}
if(i3GEO.Interface.padrao.TRANSICAO === true){
if ($i("imgtemp"))
{i3GEO.util.desaparece("imgtemp",50,5,true);}
i3GEO.util.aparece("img",50,5);
}
else{
if ($i("imgtemp"))
{i3GEO.util.desaparece("imgtemp",15,5,true);}
i3GEO.util.aparece("img",5,5);
}
i3GEO.janela.fechaAguarde("ajaxCorpoMapa");
};
if (!$i("imgtemp")){
ndiv = document.createElement("div");
ndiv.id = "imgtemp";
ndiv.style.position = "absolute";
ndiv.style.border = "1px solid blue";
document.getElementById("corpoMapa").appendChild(ndiv);
}
if(g_tipoacao === "pan" && i3GEO.barraDeBotoes.BOTAOCLICADO === "pan"){
$i("imgtemp").style.left = parseInt($i("img").style.left,10);
$i("imgtemp").style.top = parseInt($i("img").style.top,10);
$i("imgtemp").style.width = i3GEO.parametros.w;
$i("imgtemp").style.height = i3GEO.parametros.h;
}
$i("imgtemp").style.backgroundImage = 'url("'+$i("img").src+'")';
$i("imgtemp").style.display="block";
i = $i("img");
i.style.display="none";
i.style.left = 0;
i.style.top = 0;
i.src=i3GEO.parametros.mapimagem;
},
cria:function(){
var ins = "",
temp = $i(i3GEO.Interface.IDCORPO);
if(temp)
{temp.innerHTML = ins;}
i3GEO.Interface.IDMAPA = "img";
},
/*
Function: ativaMenuContexto
Ativa o menu de contexto acionado com o botão direito do mouse
*/
ativaMenuContexto: function(){
//remove o menu de contexto se existir
var temp,oFieldContextMenuItemData,oFieldContextMenu,onFieldMenuRender;
temp = $i("contexto_"+i3GEO.Interface.IDMAPA);
if(temp){
temp.parentNode.removeChild(temp);
}
oFieldContextMenuItemData = [
{ text: " "},
{ text: " Aproxima", onclick: { fn: i3GEO.navega.zoomin } },
{ text: " Afasta", onclick: { fn: i3GEO.navega.zoomout } },
{ text: " Norte", onclick: { fn: i3GEO.navega.panFixoNorte } },
{ text: " Sul", onclick: { fn: i3GEO.navega.panFixoSul } },
{ text: " Leste", onclick: { fn: i3GEO.navega.panFixoLeste } },
{ text: " Oeste", onclick: { fn: i3GEO.navega.panFixoOeste } },
{ text: "Captura", onclick: { fn:i3GEO.gadgets.quadros.listaImagens} }
];
oFieldContextMenu = new YAHOO.widget.ContextMenu(
"contexto_"+i3GEO.Interface.IDMAPA,{
trigger: i3GEO.Interface.IDMAPA,
itemdata: oFieldContextMenuItemData,
lazyload: true
}
);
onFieldMenuRender = function(){
var id = "contexto_"+i3GEO.Interface.IDMAPA;
if(id)
{$i(id).style.zIndex = 50000;}
};
oFieldContextMenu.subscribe("render", onFieldMenuRender);
},
inicia:function(){
var elemento,i,estilo;
if ($i("contemImg"))
{elemento = "contemImg";}
else
{elemento = "img";}
i3GEO.mapa.ajustaPosicao(elemento);
i = $i("img");
if(!i){return;}
i.style.width=i3GEO.parametros.w +"px";
i.style.height=i3GEO.parametros.h +"px";
estilo = $i(i3GEO.Interface.IDCORPO).style;
estilo.width=i3GEO.parametros.w +"px";
estilo.height=i3GEO.parametros.h +"px";
estilo.clip = 'rect('+0+" "+(i3GEO.parametros.w)+" "+(i3GEO.parametros.h)+" "+0+')';
objmapaparado = "nao"; //utilizado para verificar se o mouse esta parado
i3GEO.gadgets.mostraMenuSuspenso();
i3GEO.eventos.ativa(i);
i3GEO.gadgets.mostraCoordenadasGEO();
i3GEO.gadgets.mostraCoordenadasUTM();
i3GEO.gadgets.mostraEscalaNumerica();
i3GEO.gadgets.mostraEscalaGrafica();
i3GEO.gadgets.visual.inicia();
//
//i3GEO.arvoreDeCamadas.CAMADAS é definido na inicialização (classe_i3geo)
//
i3GEO.arvoreDeCamadas.cria("",i3GEO.arvoreDeCamadas.CAMADAS,i3GEO.configura.sid,i3GEO.configura.locaplic);
i3GEO.ajuda.ativaLetreiro(i3GEO.parametros.mensagens);
i3GEO.Interface.padrao.ativaBotoes();
i3GEO.idioma.mostraSeletor();
if (i3GEO.configura.mapaRefDisplay !== "none"){
if (i3GEO.util.pegaCookie("i3GEO.configura.mapaRefDisplay"))
{i3GEO.configura.mapaRefDisplay = i3GEO.util.pegaCookie("i3GEO.configura.mapaRefDisplay");}
if (i3GEO.configura.mapaRefDisplay === "block")
{i3GEO.maparef.inicia();}
}
},
ativaBotoes: function(){
if(typeof(console) !== 'undefined'){console.info("i3GEO.Interface.padrao.ativaBotoes()");}
var imagemxy,x1,y1,x2,y2;
imagemxy = i3GEO.util.pegaPosicaoObjeto($i(i3GEO.Interface.IDCORPO));
if ($i("barraDeBotoes1") || i3GEO.barraDeBotoes.AUTO === true){
x1 = imagemxy[0]+i3GEO.Interface.BARRABOTOESLEFT;
y1 = imagemxy[1]+i3GEO.Interface.BARRABOTOESTOP;
}
if ($i("barraDeBotoes2") || i3GEO.barraDeBotoes.AUTO === true){
x2 = imagemxy[0]+i3GEO.Interface.BARRABOTOESLEFT;
y2 = imagemxy[1]+i3GEO.Interface.BARRABOTOESTOP;
}
if (($i("barraDeBotoes1") && $i("barraDeBotoes2")) || i3GEO.barraDeBotoes.AUTO === true){
x1 = imagemxy[0]+i3GEO.Interface.BARRABOTOESLEFT+40;
}
if ($i("barraDeBotoes1") || i3GEO.barraDeBotoes.AUTO === true)
{i3GEO.barraDeBotoes.inicializaBarra("barraDeBotoes1","i3geo_barra1",true,x1,y1);}
if ($i("barraDeBotoes2") || i3GEO.barraDeBotoes.AUTO === true)
{i3GEO.barraDeBotoes.inicializaBarra("barraDeBotoes2","i3geo_barra2",false,x2,y2);}
//ativa as funções dos botões
i3GEO.barraDeBotoes.ativaBotoes();
if (document.getElementById("botao3d")){
if (i3GEO.configura.map3d === "")
{document.getElementById("botao3d").style.display="none";}
}
if(i3GEO.Interface.ATIVAMENUCONTEXTO)
{i3GEO.Interface.padrao.ativaMenuContexto();}
if(i3GEO.configura.visual !== "default")
{i3GEO.gadgets.visual.troca(i3GEO.configura.visual);}
}
},
/*
Classe: i3GEO.Interface.flamingo
Interface com motor de navegação baseado no software Flamingo Map Components (flash)
Utilizado quando
i3GEO.Interface.ATUAL = "flamingo"
*/
flamingo:{
atualizaTema:function(retorno,tema){
//
//não se atualiza um tema único, mas o mapa todo
//
i3GEO.atualiza(retorno);
},
redesenha: function(){
var w = parseInt($i("flamingo").style.width,10);
if (w === i3GEO.parametros.w)
{$i("flamingo").style.height = parseInt($i("flamingo").style.height,10)+1;}
else
{$i("flamingo").style.height = parseInt($i("flamingo").style.height,10)-1;}
i3GEO.janela.fechaAguarde();
},
cria: function(w,h){
var i,f,ins;
i = $i(i3GEO.Interface.IDCORPO);
if(i){
f = $i("flamingo");
if(!f){
ins = '
';
i.innerHTML = ins;
}
f = $i("flamingo");
f.style.width = w;
f.style.height = h;
i3GEO.Interface.IDMAPA = "flamingo";
}
},
inicia: function(){
var monta = function(retorno){
$i("flamingo").style.height = i3GEO.parametros.h + 45;
childPopups = [];
childPopupNr = 0;
var so = new SWFObject(i3GEO.configura.locaplic+"/pacotes/flamingo/flamingo/flamingo.swf?config="+retorno.data, "flamingoi", "100%", "100%", "8", "#eaeaea");
so.addParam("wmode","transparent");
so.write("flamingo");
};
i3GEO.php.flamingo(monta);
i3GEO.eventos.ativa($i("flamingo"));
i3GEO.maparef.atualiza();
if (i3GEO.configura.mapaRefDisplay !== "none")
{
if (i3GEO.util.pegaCookie("i3GEO.configura.mapaRefDisplay"))
{i3GEO.configura.mapaRefDisplay = i3GEO.util.pegaCookie("i3GEO.configura.mapaRefDisplay");}
if (i3GEO.configura.mapaRefDisplay === "block"){i3GEO.maparef.inicia();}
}
//
//i3GEO.arvoreDeCamadas.CAMADAS é definido na inicialização (classe_i3geo)
//
i3GEO.arvoreDeCamadas.cria("",i3GEO.arvoreDeCamadas.CAMADAS,i3GEO.configura.sid,i3GEO.configura.locaplic);
},
ativaBotoes: function(){
}
},
/*
Classe: i3GEO.Interface.openlayers
Interface com motor de navegação baseado na API OpenLayers
Utilizado quando
i3GEO.Interface.ATUAL = "openlayers"
Cria o objeto i3geoOL que pode receber os métodos da API do OpenLayers
Para detalhes sobre a configuração da interface, veja i3geo/aplicmap/openlayers.htm
*/
openlayers:{
/*
Propriedade: TILES
Indica se será utilizado o modo de navegação em tiles
Tipo:
{boolean}
Default:
{false}
*/
TILES: false,
/*
Propriedade: BUFFER
Número de TILES na área não visível do mapa
Tipo:
{integer}
Default:
{0}
*/
BUFFER: 0,
/*
Propriedade: GADGETS
Lista dos controles específicos da API do OpenLayers que serão inseridos ou não no mapa
Tipo:
{object}
Default:
{PanZoomBar:true,LayerSwitcher:true,ScaleLine:true,OverviewMap:true}
*/
GADGETS: {
PanZoomBar:true,
PanZoom:false,
LayerSwitcher:true,
ScaleLine:true,
OverviewMap:false
},
/*
Propriedade: MINEXTENT
Menor extensão geográfica que pode ser mostrada no mapa
Tipo:
{array}
Default:
{-0.001, -0.001, 0.001, 0.001]}
*/
MINEXTENT: [-0.001, -0.001, 0.001, 0.001],
/*
Propriedade: MAXEXTENT
Maior extensão geográfica que pode ser mostrada no mapa
Tipo:
{array}
Default:
{[-180, -90, 180, 90]}
*/
MAXEXTENT: [-180, -90, 180, 90],
/*
Propriedades: LAYERSADICIONAIS
Array com objetos do tipo LAYER que serão adicionados após a crioação de todos os layers default.
Tipo:
{array}
*/
LAYERSADICIONAIS: [],
redesenha: function(){
//
//são criados apenas os layers que ainda não existirem no mapa
//mas que existem na arvore de camadas
//
i3GEO.Interface.openlayers.criaLayers();
i3GEO.Interface.openlayers.ordenaLayers();
i3GEO.Interface.openlayers.recalcPar();
i3GEO.janela.fechaAguarde();
},
cria: function(w,h){
var i,f,ins,
mi = i3GEO.Interface.openlayers.MINEXTENT,
ma = i3GEO.Interface.openlayers.MAXEXTENT
;
i = $i(i3GEO.Interface.IDCORPO);
if(i){
f = $i("openlayers");
if(!f){
ins = '';
i.innerHTML = ins;
}
f = $i("openlayers");
f.style.width = w;
f.style.height = h;
}
i3GEO.Interface.IDMAPA = "openlayers";
i3GEO.barraDeBotoes.INCLUIBOTAO.zoomli = true;
i3GEO.barraDeBotoes.INCLUIBOTAO.pan = true;
i3GEO.barraDeBotoes.INCLUIBOTAO.zoomtot = true;
i3geoOL = new OpenLayers.Map('openlayers', {
controls: [],
fractionalZoom: true,
minResolution: "auto",
minExtent: new OpenLayers.Bounds(mi[0],mi[1],mi[2],mi[3]),
maxResolution: "auto",
maxExtent: new OpenLayers.Bounds(ma[0],ma[1],ma[2],ma[3])
});
},
inicia: function(){
//
//monta o mapa após receber o resultado da criação do mapfile temporário
//
var montaMapa = function(){
var pz,pos,temp,propriedades,layers,nlayers,i,texto,estilo;
i3GEO.Interface.openlayers.criaLayers();
i3GEO.Interface.openlayers.registraEventos();
i3GEO.Interface.openlayers.zoom2ext(i3GEO.parametros.mapexten);
if(i3GEO.Interface.openlayers.GADGETS.PanZoomBar == true){
pz = new OpenLayers.Control.PanZoomBar();
i3geoOL.addControl(pz);
pz.div.style.zIndex = 5000;
}
if(i3GEO.Interface.openlayers.GADGETS.PanZoom == true){
pz = new OpenLayers.Control.PanZoom();
i3geoOL.addControl(pz);
pz.div.style.zIndex = 5000;
}
//
//insere a lista de layers de fundo
//
temp = $i("listaLayersBase");
if(temp){
estilo = "cursor:pointer;vertical-align:top;padding-top:5px;";
if(navm)
{estilo = "border:0px solid white;cursor:pointer;vertical-align:middle;padding-top:0px;";}
temp = {"propriedades": []};
layers = i3geoOL.getLayersBy("isBaseLayer",true);
layersn = layers.length;
for(i=0;i"+layers[i].name;
temp.propriedades.push({ text: texto, url: ""});
}
i3GEO.util.arvore(""+$trad("p16")+"","listaLayersBase",temp);
}
else{
if(i3GEO.Interface.openlayers.GADGETS.LayerSwitcher == true)
{i3geoOL.addControl(new OpenLayers.Control.LayerSwitcher());}
}
if(i3GEO.Interface.openlayers.GADGETS.ScaleLine == true)
{i3geoOL.addControl(new OpenLayers.Control.ScaleLine());}
if(i3GEO.Interface.openlayers.GADGETS.OverviewMap == true)
{i3geoOL.addControl(new OpenLayers.Control.OverviewMap());}
//i3geoOL.addControl(new OpenLayers.Control.KeyboardDefaults());
//
//estes controles ficam invisíveis e são usados quando os ícones default do i3geo são ativados
//
OLpan = new OpenLayers.Control.Navigation();
OLzoom = new OpenLayers.Control.ZoomBox();
OLpanel = new OpenLayers.Control.Panel();
OLpanel.addControls([OLpan,OLzoom]);
i3geoOL.addControl(OLpanel);
i3GEO.Interface.openlayers.ativaBotoes();
if (i3GEO.configura.mapaRefDisplay !== "none"){
if (i3GEO.util.pegaCookie("i3GEO.configura.mapaRefDisplay"))
{i3GEO.configura.mapaRefDisplay = i3GEO.util.pegaCookie("i3GEO.configura.mapaRefDisplay");}
if (i3GEO.configura.mapaRefDisplay === "block")
{i3GEO.maparef.inicia();}
}
};
i3GEO.gadgets.mostraCoordenadasGEO();
i3GEO.gadgets.mostraCoordenadasUTM();
montaMapa();
//i3GEO.php.openlayers(montaMapa);
i3GEO.gadgets.mostraMenuSuspenso();
i3GEO.ajuda.ativaLetreiro(i3GEO.parametros.mensagens);
i3GEO.idioma.mostraSeletor();
i3GEO.gadgets.mostraEscalaNumerica();
i3GEO.arvoreDeCamadas.ATIVATEMA = "i3GEO.Interface.openlayers.ligaDesliga(this)";
//
//i3GEO.arvoreDeCamadas.CAMADAS é definido na inicialização (classe_i3geo)
//
i3GEO.arvoreDeCamadas.cria("",i3GEO.arvoreDeCamadas.CAMADAS,i3GEO.configura.sid,i3GEO.configura.locaplic);
},
criaLayers: function(){
var url = i3GEO.configura.locaplic+"/classesphp/mapa_openlayers.php?map="+i3GEO.parametros.mapfile+"&TIPOIMAGEM="+i3GEO.configura.tipoimagem,
urlfundo = i3GEO.configura.locaplic+"/classesphp/mapa_openlayers.php?layer=&tipolayer=fundo&map="+i3GEO.parametros.mapfile.replace(".map","fundo.map")+"&TIPOIMAGEM="+i3GEO.configura.tipoimagem,
nlayers = i3GEO.arvoreDeCamadas.CAMADAS.length,
layer,
camada,
urllayer,
opcoes,
i,
temp,
fundoIsBase = true;
//
//verifica se algum layer adicional é do tipo baselayer. Se for, adiciona o layer fundo, mas não como base
//
try{
temp = i3GEO.Interface.openlayers.LAYERSADICIONAIS.length;
for(i=0;i=0;i--){
camada = i3GEO.arvoreDeCamadas.CAMADAS[i];
if(i3geoOL.getLayersByName(camada.name).length == 0){
urllayer = url+"&layer="+camada.name;
try{
if(camada.escondido === "sim" || camada.connectiontype === 10 || camada.type === 4 || camada.type === 8 )
{opcoes.singleTile = true;}
else{
if(camada.type === 3) //raster
{opcoes.singleTile = false;}
else
{opcoes.singleTile = !(i3GEO.Interface.openlayers.TILES);}
}
if(camada.type === 0)
{opcoes.gutter = 20;}
else
{opcoes.gutter = 0;}
}
catch(e){}
layer = new OpenLayers.Layer.WMS(camada.name, urllayer,{map_imagetype:i3GEO.Interface.OUTPUTFORMAT},opcoes);
if(camada.escondido !== "sim")
{layer.transitionEffect ="resize";}
i3geoOL.addLayer(layer);
}
else
{layer = i3geoOL.getLayersByName(camada.name)[0];}
if(camada.status == 0)
{layer.setVisibility(false);}
else
{layer.setVisibility(true);}
}
try
{i3geoOL.addLayers(i3GEO.Interface.openlayers.LAYERSADICIONAIS);}
catch(e){}
},
inverteModoTile: function(){
var nlayers = i3GEO.arvoreDeCamadas.CAMADAS.length,
layer,
i,
camada;
if(i3GEO.Interface.openlayers.TILES === true)
{i3GEO.Interface.openlayers.TILES = false;}
else
{i3GEO.Interface.openlayers.TILES = true;}
for(i=nlayers-1;i>=0;i--){
camada = i3GEO.arvoreDeCamadas.CAMADAS[i];
try{
layer = i3geoOL.getLayersByName(camada.name)[0];
if(camada.escondido !== "sim"){
layer.singleTile = !i3GEO.Interface.openlayers.TILES;
}
}catch(e){}
}
i3GEO.Interface.openlayers.atualizaMapa();
},
alteraParametroLayers: function(parametro,valor){
var layers = i3geoOL.layers,
nlayers = layers.length,
i,
url,
reg;
for(i=0;i=0;i--){
layers = i3geoOL.getLayersByName(ordem[i].name);
layer = layers[0];
i3geoOL.setLayerIndex(layer,maiorindice+i);
}
},
sobeDesceLayer:function(tema,tipo){
var layer = i3geoOL.getLayersByName(tema)[0],
indice = i3geoOL.getLayerIndex(layer);
if(tipo === "sobe")
{i3geoOL.setLayerIndex(layer,indice + 1);}
else
{i3geoOL.setLayerIndex(layer,indice - 1);}
},
ligaDesliga:function(obj){
var layers = i3geoOL.getLayersByName(obj.value),
temp = function(){i3GEO.mapa.legendaHTML.atualiza();},
desligar = "",
ligar = "";
if(layers.length > 0){
layers[0].setVisibility(obj.checked);
if(obj.checked)
{
ligar = obj.value;
i3GEO.arvoreDeCamadas.alteraPropCamadas("status","2",obj.value);
}
else
{
desligar = obj.value;
i3GEO.arvoreDeCamadas.alteraPropCamadas("status","0",obj.value);
}
i3GEO.php.ligatemas(temp,desligar,ligar);
}
},
ativaFundo: function(id){
var layer = i3geoOL.getLayer(id);
i3geoOL.setBaseLayer(layer);
},
atualizaMapa:function(){
var layers = i3geoOL.layers,
nlayers = layers.length,
i;
for(i=0;i';
i.innerHTML = ins;
}
f = $i("googlemapsdiv");
f.style.width = w;
f.style.height = h;
}
i3GeoMap = "";
i3GEO.Interface.IDMAPA = "googlemapsdiv";
i3GEO.barraDeBotoes.INCLUIBOTAO.zoomli = true;
i3GEO.barraDeBotoes.INCLUIBOTAO.pan = true;
i3GEO.barraDeBotoes.INCLUIBOTAO.zoomtot = true;
},
ativaZoomBox: function(){
i3GeoMap.enableKeyDragZoom({
key: 'ctrl'
});
},
inicia: function(){
var pol,ret,pt1,pt2,bottomLeft,bottomRight,i3GEOTile;
pol = i3GEO.parametros.mapexten;
ret = pol.split(" ");
function montaMapa(retorno){
var pos, sw,ne,z,myMapType;
try{
i3GeoMap = new google.maps.Map($i(i3GEO.Interface.IDMAPA),{scaleControl:true});
}
catch(e){alert(e);return;}
//
//carrega o javascript que permite fazer o zoom por box
//
js = i3GEO.configura.locaplic+"/pacotes/google/keydragzoom.js.php";
i3GEO.util.scriptTag(js,"i3GEO.Interface.googlemaps.ativaZoomBox()","keydragzoom_script");
i3GeoMap.setMapTypeId(i3GEO.Interface.googlemaps.TIPOMAPA);
sw = new google.maps.LatLng(ret[1],ret[0]);
ne = new google.maps.LatLng(ret[3],ret[2]);
i3GeoMap.fitBounds(new google.maps.LatLngBounds(sw,ne));
i3GEO.Interface.googlemaps.criaLayers();
i3GeoMapOverlay = new google.maps.OverlayView();
i3GeoMapOverlay.draw = function() {};
i3GeoMapOverlay.setMap(i3GeoMap);
i3GEO.Interface.googlemaps.registraEventos();
i3GEO.gadgets.mostraInserirKml();
i3GEO.Interface.googlemaps.ativaBotoes();
i3GEO.eventos.ativa($i(i3GEO.Interface.IDMAPA));
i3GEO.gadgets.mostraCoordenadasGEO();
i3GEO.gadgets.mostraCoordenadasUTM();
i3GEO.gadgets.mostraEscalaNumerica();
i3GEO.gadgets.mostraMenuSuspenso();
i3GEO.idioma.mostraSeletor();
g_operacao = "";
g_tipoacao = "";
//i3GEO.parametros.mapscale = i3GEO.Interface.googlemaps.calcescala();
//atualizaEscalaNumerica(parseInt(i3GEO.parametros.mapscale,10));
//
//i3GEO.arvoreDeCamadas.CAMADAS é definido na inicialização (classe_i3geo)
//
i3GEO.arvoreDeCamadas.ATIVATEMA = "i3GEO.Interface.googlemaps.ligaDesliga(this)";
i3GEO.arvoreDeCamadas.cria("",i3GEO.arvoreDeCamadas.CAMADAS,i3GEO.configura.sid,i3GEO.configura.locaplic);
i3GEO.Interface.googlemaps.adicionaListaKml();
if(i3GEO.parametros.kmlurl !== "")
{i3GEO.Interface.googlemaps.adicionaKml(true,i3GEO.parametros.kmlurl);}
};
i3GEO.php.googlemaps(montaMapa);
},
criaLayers: function(){
var nlayers = i3GEO.arvoreDeCamadas.CAMADAS.length,
i,
camada,
indice;
for (i=0;i";
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;
nodekml.isleaf = true;
i3GEO.Interface.googlemaps.ARVORE.draw();
i3GEO.Interface.googlemaps.ARVORE.collapseAll();
node.expand();
if(ativo == true)
{eval(id+" = new google.maps.KmlLayer('"+url+"',{map:i3GeoMap,preserveViewport:true});");}
},
criaArvoreKML: function(){
var arvore,a,root,titulo,d,node;
arvore = $i("arvoreCamadasKml");
if(!arvore){
d = document.createElement("div");
d.id = "arvoreCamadasKml";
d.style.top = "40px";
a = $i(i3GEO.arvoreDeCamadas.IDHTML);
if(a){
a.parentNode.appendChild(d);
}
else{alert("Arvore de camadas nao encontrada. Nao e possivel adicionar a arvore de KML");return;}
}
i3GEO.Interface.googlemaps.ARVORE = new YAHOO.widget.TreeView("arvoreCamadasKml");
root = i3GEO.Interface.googlemaps.ARVORE.getRoot();
titulo = "
Google Maps
";
d = {html:titulo,idkml:"raiz"};
node = new YAHOO.widget.HTMLNode(d, root, true,true);
node.enableHighlight = false;
},
/*
Function: ativaDesativaCamadaKml
Ativa ou desativa uma camada do nó de layers KML
Parametro:
obj {object} - objeto do tipo checkbox que foi ativado/desativado
url {string} - url do KML
*/
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});");
}
},
alteraParametroLayers: function(parametro,valor){
parametro = parametro.toUpperCase();
var reg = new RegExp(parametro+"([=])+([a-zA-Z0-9_]*)");
i3GEO.Interface.googlemaps.PARAMETROSLAYER = i3GEO.Interface.googlemaps.PARAMETROSLAYER.replace(reg,"");
i3GEO.Interface.googlemaps.PARAMETROSLAYER += "&"+parametro+"="+valor;
i3GEO.Interface.googlemaps.redesenha();
}
},
/*
Classe: i3GEO.Interface.googleearth
Interface com motor de navegação baseado na API Google Earth
Utilizado quando
i3GEO.Interface.ATUAL = "googleearth"
Cria o objeto i3GeoMap que pode receber os métodos da API do google Earth
*/
googleearth:{
/*
Propriedade: GADGETS
Lista dos controles específicos da API do Google Earth que serão inseridos ou não no mapa
Tipo:
{object}
Default:
{}
*/
GADGETS: {
setMouseNavigationEnabled:true,
setStatusBarVisibility:true,
setOverviewMapVisibility:true,
setScaleLegendVisibility:true,
setAtmosphereVisibility:true,
setGridVisibility:false,
getSun:false,
LAYER_BORDERS: true,
LAYER_BUILDINGS: false,
LAYER_ROADS: false,
LAYER_TERRAIN: true
},
POSICAOTELA: [0,0],
aguarde: "",
atualizaTema:function(retorno,tema){
//
//não se atualiza um tema único, mas o mapa todo
//
i3GEO.atualiza(retorno);
},
redesenha: function(){
try{
if(linki3geo !== undefined)
{linki3geo.setHref(linki3geo.getHref()+"&");}
}
catch(e){
if(typeof(console) !== 'undefined'){console.error(e);}
}
},
cria: function(w,h){
var i,i3GeoMap3d,i3GeoMap,texto;
i3GEO.configura.listaDePropriedadesDoMapa = {
"propriedades": []
};
texto = " "+$trad("ge1");
i3GEO.configura.listaDePropriedadesDoMapa.propriedades.push({text: texto,url:""});
texto = " "+$trad("ge2");
i3GEO.configura.listaDePropriedadesDoMapa.propriedades.push({text: texto,url:""});
texto = " "+$trad("ge3");
i3GEO.configura.listaDePropriedadesDoMapa.propriedades.push({text: texto,url:""});
texto = " "+$trad("ge4");
i3GEO.configura.listaDePropriedadesDoMapa.propriedades.push({text: texto,url:""});
texto = " "+$trad("ge5");
i3GEO.configura.listaDePropriedadesDoMapa.propriedades.push({text: texto,url:""});
texto = " "+$trad("ge6");
i3GEO.configura.listaDePropriedadesDoMapa.propriedades.push({text: texto,url:""});
texto = " "+$trad("ge7");
i3GEO.configura.listaDePropriedadesDoMapa.propriedades.push({text: texto,url:""});
texto = " "+$trad("ge8");
i3GEO.configura.listaDePropriedadesDoMapa.propriedades.push({text: texto,url:""});
texto = " "+$trad("ge9");
i3GEO.configura.listaDePropriedadesDoMapa.propriedades.push({text: texto,url:""});
texto = " "+$trad("ge10");
i3GEO.configura.listaDePropriedadesDoMapa.propriedades.push({text: texto,url:""});
texto = " "+$trad("ge11");
i3GEO.configura.listaDePropriedadesDoMapa.propriedades.push({text: texto,url:""});
i = $i(i3GEO.Interface.IDCORPO);
if(i){
i3GeoMap3d = document.createElement("div");
i3GeoMap3d.style.width = w;
i3GeoMap3d.style.height = h + 45;
i.style.height = h + 45;
i3GeoMap3d.id = "i3GeoMap3d";
i.appendChild(i3GeoMap3d);
}
i3GEO.Interface.IDMAPA = "i3GeoMap3d";
google.load("earth", "1");
i3GeoMap = null;
},
inicia: function(){
google.earth.createInstance("i3GeoMap3d", i3GEO.Interface.googleearth.iniciaGE, i3GEO.Interface.googleearth.falha);
},
iniciaGE: function(object){
i3GeoMap = object;
i3GeoMap.getWindow().setVisibility(true);
kmlUrl = i3GEO.configura.locaplic+"/pacotes/kmlmapserver/kmlservice.php?map="+i3GEO.parametros.mapfile+"&typename=estadosl&request=kml&mode=map&";
linki3geo = i3GeoMap.createLink('');
linki3geo.setHref(kmlUrl);
nl = i3GeoMap.createNetworkLink('');
nl.setLink(linki3geo);
nl.setFlyToView(true);
i3GeoMap.getFeatures().appendChild(nl);
var options = i3GeoMap.getOptions(),
layerRoot = i3GeoMap.getLayerRoot(),
evento = function(e){
i3GEO.Interface.googleearth.recalcPar();
g_operacao = "";
g_tipoacao = "";
};
options.setMouseNavigationEnabled(i3GEO.Interface.googleearth.GADGETS.setMouseNavigationEnabled);
options.setStatusBarVisibility(i3GEO.Interface.googleearth.GADGETS.setStatusBarVisibility);
options.setOverviewMapVisibility(i3GEO.Interface.googleearth.GADGETS.setOverviewMapVisibility);
options.setScaleLegendVisibility(i3GEO.Interface.googleearth.GADGETS.setScaleLegendVisibility);
options.setAtmosphereVisibility(i3GEO.Interface.googleearth.GADGETS.setAtmosphereVisibility);
options.setGridVisibility(i3GEO.Interface.googleearth.GADGETS.setGridVisibility);
layerRoot.enableLayerById(i3GeoMap.LAYER_BORDERS, i3GEO.Interface.googleearth.GADGETS.LAYER_BORDERS);
layerRoot.enableLayerById(i3GeoMap.LAYER_BUILDINGS, i3GEO.Interface.googleearth.GADGETS.LAYER_BUILDINGS);
layerRoot.enableLayerById(i3GeoMap.LAYER_ROADS, i3GEO.Interface.googleearth.GADGETS.LAYER_ROADS);
layerRoot.enableLayerById(i3GeoMap.LAYER_TERRAIN, i3GEO.Interface.googleearth.GADGETS.LAYER_TERRAIN);
i3GeoMap.getSun().setVisibility(i3GEO.Interface.googleearth.GADGETS.getSun);
i3GeoMap.getNavigationControl().setVisibility(i3GeoMap.VISIBILITY_SHOW);
google.earth.addEventListener(
i3GeoMap.getView(),
"viewchangeend",
function(e){
i3GEO.Interface.googleearth.recalcPar();
g_operacao = "";
g_tipoacao = "";
}
);
i3GEO.Interface.googleearth.POSICAOTELA = YAHOO.util.Dom.getXY($i(i3GEO.Interface.IDCORPO));
google.earth.addEventListener(
i3GeoMap.getGlobe(),
'mousemove',
function(event){
objposicaocursor = {
ddx: event.getLongitude(),
ddy: event.getLatitude(),
dmsx: 0,
dmsy: 0,
imgx: event.getClientX(),
imgy: event.getClientY(),
telax: event.getClientX() + i3GEO.Interface.googleearth.POSICAOTELA[0],
telay: event.getClientY() + i3GEO.Interface.googleearth.POSICAOTELA[1]
};
i3GEO.eventos.mousemoveMapa();
}
);
google.earth.addEventListener(
i3GeoMap.getGlobe(),
'click',
function(event){
if(i3GEO.Interface.googleearth.aguarde.visibility === "hidden"){
i3GEO.eventos.mousecliqueMapa();
}
else
{i3GEO.Interface.googleearth.aguarde.visibility = "hidden";}
}
);
//
//i3GEO.arvoreDeCamadas.CAMADAS é definido na inicialização (classe_i3geo)
//
i3GEO.arvoreDeCamadas.cria("",i3GEO.arvoreDeCamadas.CAMADAS,i3GEO.configura.sid,i3GEO.configura.locaplic);
i3GEO.Interface.googleearth.ativaBotoes();
i3GEO.gadgets.mostraInserirKml("inserirKml");
i3GEO.Interface.googleearth.adicionaListaKml();
},
recalcPar: function(){
var bounds;
g_operacao = "";
g_tipoacao = "";
bounds = i3GeoMap.getView().getViewportGlobeBounds();
i3GEO.parametros.mapexten = bounds.getWest()+" "+bounds.getSouth()+" "+bounds.getEast()+" "+bounds.getNorth();
//i3GEO.parametros.mapscale = i3GEO.Interface.googlemaps.calcescala();
},
falha: function()
{alert("Falhou. Vc precisa do plugin instalado");},
ativaBotoes: function(){
var cabecalho = function(){};
var minimiza = function(){
i3GEO.janela.minimiza("i3GEOF.ferramentasGE");
};
var janela = i3GEO.janela.cria(
"200px",
"70px",
"",
"",
"",
"Ferramentas",
"i3GEOF.ferramentasGE",
false,
"hd",
cabecalho,
minimiza
);
i3GEO.barraDeBotoes.TEMPLATEBOTAO = '
';
i3GEO.barraDeBotoes.inicializaBarra("barraDeBotoes2","",false,"200","200",janela[2].id);
i3GEO.barraDeBotoes.ativaBotoes();
i3GEO.Interface.googleearth.aguarde = $i("i3GEOF.ferramentasGE_imagemCabecalho").style;
},
balao: function(texto,ddx,ddy){
var placemark = i3GeoMap.createPlacemark('');
var point = i3GeoMap.createPoint('');
point.setLatitude(ddy);
point.setLongitude(ddx);
placemark.setGeometry(point);
var b = i3GeoMap.createHtmlStringBalloon('');
b.setContentString("
"+texto+"
");
b.setFeature(placemark);
i3GeoMap.setBalloon(b);
i3GEO.Interface.googleearth.aguarde.visibility = "hidden";
},
insereMarca: function(texto,ddx,ddy,name){
if(typeof(console) !== 'undefined'){console.info("i3GEO.Interface.googleearth.insereMarca()");}
var placemark = i3GeoMap.createPlacemark('');
placemark.setName(name);
var point = i3GeoMap.createPoint('');
point.setLatitude(ddy);
point.setLongitude(ddx);
placemark.setGeometry(point);
if(texto != "")
{placemark.setDescription(texto);}
i3GeoMap.getFeatures().appendChild(placemark);
},
//
//código obtido em http://code.google.com/intl/pt-BR/apis/earth/documentation/geometries.html
//
insereCirculo: function(centerLng,centerLat,radius,name){
function makeCircle(centerLat, centerLng, radius) {
var ring = i3GeoMap.createLinearRing('');
var steps = 25;
var pi2 = Math.PI * 2;
for (var i = 0; i < steps; i++) {
var lat = centerLat + radius * Math.cos(i / steps * pi2);
var lng = centerLng + radius * Math.sin(i / steps * pi2);
ring.getCoordinates().pushLatLngAlt(lat, lng, 0);
}
return ring;
}
var polygonPlacemark = i3GeoMap.createPlacemark('');
var poly = i3GeoMap.createPolygon('');
poly.setAltitudeMode(i3GeoMap.ALTITUDE_RELATIVE_TO_GROUND);
polygonPlacemark.setGeometry(poly);
var outer = i3GeoMap.createLinearRing('');
polygonPlacemark.getGeometry().setOuterBoundary(makeCircle(centerLat, centerLng, radius));
polygonPlacemark.setName(name);
polygonPlacemark.setStyleSelector(i3GeoMap.createStyle(''));
var polyStyle = polygonPlacemark.getStyleSelector().getPolyStyle();
polyStyle.setFill(0);
i3GeoMap.getFeatures().appendChild(polygonPlacemark);
},
insereLinha: function(xi,yi,xf,yf,name){
var lineStringPlacemark = i3GeoMap.createPlacemark('');
lineStringPlacemark.setName(name);
var lineString = i3GeoMap.createLineString('');
lineString.setAltitudeMode(i3GeoMap.ALTITUDE_RELATIVE_TO_GROUND);
lineStringPlacemark.setGeometry(lineString);
lineString.getCoordinates().pushLatLngAlt(yi, xi, 0);
lineString.getCoordinates().pushLatLngAlt(yf, xf, 0);
lineStringPlacemark.setStyleSelector(i3GeoMap.createStyle(''));
var lineStyle = lineStringPlacemark.getStyleSelector().getLineStyle();
lineStyle.setWidth(3);
i3GeoMap.getFeatures().appendChild(lineStringPlacemark);
},
removePlacemark: function(nome){
var features = i3GeoMap.getFeatures(),
n = features.getChildNodes().getLength(),
i;
for(i=0;i";
html += " "+nomeOverlay+"";
d = {html:html};
nodekml = new YAHOO.widget.HTMLNode(d, node, true,true);
nodekml.enableHighlight = false;
nodekml.isleaf = true;
i3GEO.Interface.googleearth.ARVORE.draw();
i3GEO.Interface.googleearth.ARVORE.collapseAll();
node.expand();
},
criaArvoreKML: function(){
var arvore,a,root,titulo,d,node;
arvore = $i("arvoreCamadasKml");
if(!arvore){
d = document.createElement("div");
d.id = "arvoreCamadasKml";
d.style.top = "40px";
a = $i(i3GEO.arvoreDeCamadas.IDHTML);
if(a){
a.parentNode.appendChild(d);
}
else{alert("Arvore de camadas nao encontrada. Nao e possivel adicionar a arvore de KML");return;}
}
i3GEO.Interface.googleearth.ARVORE = new YAHOO.widget.TreeView("arvoreCamadasKml");
root = i3GEO.Interface.googleearth.ARVORE.getRoot();
titulo = "
Google Earth Kml
";
d = {html:titulo,idkml:"raiz"};
node = new YAHOO.widget.HTMLNode(d, root, true,true);
node.enableHighlight = false;
},
existeLink: function(url){
var existe = false,
features = i3GeoMap.getFeatures(),
n = features.getChildNodes().getLength(),
i;
for(i=0;i