/*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; 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: TABLET Aplica configurações especiais para uso em tablets. Altera o posicionamento da barra de botões e comportamento das guias. Veja o exemplo interface/openlayers_t.htm. Type: {boolean} Default: {false} */ TABLET: false, /* Propriedade: ALTTABLET Nome do arquivo HTML com a interface alternativa utilizada quando o i3Geo detecta o uso de um dispositivo móvel A detecção é aplicada automaticamente quando essa variável for definida Para não aplicar a detecção, use i3GEO.Interface.ALTTABLET = "" Type: {string} Default: {openlayers_t.htm} */ ALTTABLET: "openlayers_t.htm", /* 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 relação ao topo do mapa. Tipo: {number} Default: {12} */ BARRABOTOESTOP: 12, /* Propriedade: BARRABOTOESLEFT Distância da barra de botões em relação ao lado esquerdo do mapa. Tipo: {number} Default: {3} */ BARRABOTOESLEFT: 3, /* Propriedade: BARRADEZOOMTOP Distância da barra de zoom em relação ao topo do mapa. Tipo: {number} Default: {12} */ BARRADEZOOMTOP: 20, /* Propriedade: BARRADEZOOMLEFT Distância da barra de zoom em relação ao lado esquerdo do mapa. Tipo: {number} Default: {3} */ BARRADEZOOMLEFT: 10, /* Propriedade: ATUAL Interface utilizada na criação e controle do mapa. Veja como usar nos arquivos de apresentação do mapa existentes no diretório i3geo/interface O i3Geo, além da interface própria, permite o uso de outras APIs para a construção do mapa, como Google Maps ou Openlayers. Essa propriedade define qual interface será usada. Não confundir com o nome do HTML que é utilizado para mostrar o mapa. Para definir a interface, utilize i3GEO.Interface.ATUAL = "" Tipo: {string} Valores: {geral|openlayers|flamingo|googlemaps|googleearth} 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 trocando: false //indica se o mapa está na fase de troca de interface } */ STATUS: { atualizando: [], trocando: false }, /* Function: atual2gm Troca o renderizador do mapa passando a usar a API do Google Maps */ atual2gm: { inicia: function(){ i3GEO.Interface.STATUS.trocando = true; i3GEO.janela.ESTILOAGUARDE = "normal"; i3GEO.janela.abreAguarde("googleMapsAguarde","Carregando GoogleMaps..."); try{ if(google) {i3GEO.Interface.atual2gm.initemp();} } catch(e){ i3GEO.util.scriptTag("http://www.google.com/jsapi?callback=i3GEO.Interface.atual2gm.loadMaps","","",false); } }, loadMaps: function(){ //AJAX API is loaded successfully. Now lets load the maps api google.load("maps", "3", {callback:"i3GEO.Interface.atual2gm.initemp",other_params: "sensor=false"}); }, initemp: function(){ var temp = function(){ $i(i3GEO.Interface.IDCORPO).innerHTML = ""; i3GEO.Interface.ATUAL = "googlemaps"; i3GEO.Interface.cria(i3GEO.parametros.w,i3GEO.parametros.h); //i3GEO.Interface.googlemaps.cria(); i3GEO.Interface.googlemaps.inicia(); i3GEO.janela.fechaAguarde("googleMapsAguarde"); i3GEO.arvoreDeCamadas.CAMADAS = []; i3GEO.atualiza(); i3GEO.mapa.insereDobraPagina("openlayers",i3GEO.configura.locaplic+"/imagens/dobraopenlayers.png"); i3GEO.Interface.googlemaps.recalcPar(); }; i3GEO.php.converte2googlemaps(temp); } }, /* Function: atual2ol Troca o renderizador do mapa passando a usar a API do Open Layers */ atual2ol: { inicia: function(){ i3GEO.Interface.STATUS.trocando = true; i3GEO.janela.ESTILOAGUARDE = "normal"; i3GEO.janela.abreAguarde("OpenLayersAguarde","Carregando OpenLayers..."); try{ if(OpenLayers) {i3GEO.Interface.atual2ol.initemp();} } catch(e){ i3GEO.util.scriptTag(i3GEO.configura.locaplic+"/pacotes/openlayers/OpenLayers211.js.php","i3GEO.Interface.atual2ol.initemp()","",false); } }, initemp: function(){ var temp = function(){ OpenLayers.ImgPath = "../pacotes/openlayers/img/"; $i(i3GEO.Interface.IDCORPO).innerHTML = ""; i3GEO.Interface.ATUAL = "openlayers"; i3GEO.Interface.cria(i3GEO.parametros.w,i3GEO.parametros.h); //i3GEO.Interface.openlayers.cria(); i3GEO.Interface.openlayers.inicia(); i3GEO.janela.fechaAguarde("OpenLayersAguarde"); i3GEO.arvoreDeCamadas.CAMADAS = []; i3GEO.atualiza(); i3GEO.mapa.insereDobraPagina("googlemaps",i3GEO.configura.locaplic+"/imagens/dobragooglemaps.png"); i3GEO.Interface.openlayers.zoom2ext(i3GEO.parametros.mapexten); }; i3GEO.php.converte2openlayers(temp); } }, /* 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()");} i3GEO.Interface[i3GEO.Interface.ATUAL].redesenha(); }, /* Function: aplicaOpacidade Aplica um fator de opacidade a todos os layers do mapa Parametro: opacidade {numerico} - 0 a 1 */ aplicaOpacidade: function(opacidade){ if(typeof(console) !== 'undefined'){console.info("i3GEO.Interface.atualizaMapa()");} switch(i3GEO.Interface.ATUAL){ case "padrao": alert("Opção não disponível"); break; default: i3GEO.Interface[i3GEO.Interface.ATUAL].aplicaOpacidade(opacidade); } }, /* 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()");} switch(i3GEO.Interface.ATUAL){ case "padrao": i3GEO.atualiza(); break; case "openlayers": i3GEO.Interface.openlayers.atualizaMapa(); break; default: i3GEO.Interface[i3GEO.Interface.ATUAL].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. Quando igual a "", é feita apenas a atualização da camada, sem que a árvore de camadas seja atualizada. tema {string} - código do tema */ atualizaTema: function(retorno,tema){ if(typeof(console) !== 'undefined'){console.info("i3GEO.Interface.atualizaTema()");} switch(i3GEO.Interface.ATUAL) { case "padrao": break; default: i3GEO.Interface[i3GEO.Interface.ATUAL].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");} if(i3GEO.Interface.ATUAL === "openlayers") {i3GEO.Interface.openlayers.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()");} i3GEO.Interface[i3GEO.Interface.ATUAL].cria(w,h); }, /* Function: inicia Inicia a interface */ inicia: function(w,h){ if(typeof(console) !== 'undefined'){console.warn("i3GEO.Interface.inicia()");} // //inicialização que afeta todas as interfaces // var temp = window.location.href.split("?")[0], gadgets = i3GEO.gadgets; if($i("i3GEOcompartilhar")) {i3GEO.social.compartilhar("i3GEOcompartilhar",temp,temp,"semtotal");} gadgets.quadros.inicia(10); gadgets.quadros.grava("extensao",i3GEO.parametros.extentTotal); gadgets.mostraBuscaRapida(); gadgets.mostraVersao(); gadgets.mostraEmail(); i3GEO.guias.cria(); // //esse id é utilizado apenas para manter o mapa não visível até que tudo seja montado // if($i("mst")) {$i("mst").style.display="block";} if (i3GEO.configura.entorno.toLowerCase() === "sim"){ i3GEO.configura.entorno = "nao"; i3GEO.navega.entorno.ativaDesativa(); } i3GEO.navega.autoRedesenho.ativa(); i3GEO.util.defineValor("i3geo_escalanum","value",i3GEO.parametros.mapscale); if ((i3GEO.parametros.geoip === "nao") && ($i("ondeestou"))) {$i("ondeestou").style.display="none";} // //inicialização específica de cada interface // i3GEO.Interface[i3GEO.Interface.ATUAL].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()");} switch(i3GEO.Interface.ATUAL){ case "padrao": i3GEO.atualiza(); break; case "flamingo": i3GEO.atualiza(); break; default: i3GEO.Interface[i3GEO.Interface.ATUAL].alteraParametroLayers(parametro,valor); } }, /* Function: ativaBotoes Ativa os botões de ferramentas */ ativaBotoes: function(){ if(typeof(console) !== 'undefined'){console.info("i3GEO.Interface.ativaBotoes()");} if(i3GEO.Interface.STATUS.trocando === false){ if(i3GEO.barraDeBotoes.TIPO === "olhodepeixe"){ i3GEO.barraDeBotoes.inicializaBarra(); } else {i3GEO.Interface[i3GEO.Interface.ATUAL].ativaBotoes();} } //else //{i3GEO.barraDeBotoes.recria("i3geo_barra2");} }, /* 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) + "px"; $i("imgtemp").style.top = parseInt($i("img").style.top,10) + "px"; $i("imgtemp").style.width = i3GEO.parametros.w + "px"; $i("imgtemp").style.height = i3GEO.parametros.h + "px"; } $i("imgtemp").style.backgroundImage = 'url("'+$i("img").src+'")'; $i("imgtemp").style.display="block"; i = $i("img"); i.style.display="none"; i.style.left = 0 + "px"; i.style.top = 0 + "px"; i.src=i3GEO.parametros.mapimagem; }, cria:function(){ var ins = ""; $i(i3GEO.Interface.IDCORPO).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 i,estilo, elemento = ($i("contemImg")) ? "contemImg" : "img", iu = i3GEO.util, configura = i3GEO.configura, gadgets = i3GEO.gadgets, parametros = i3GEO.parametros; i3GEO.mapa.ajustaPosicao(elemento); i = $i("img"); if(!i){return;} i.style.width=parametros.w +"px"; i.style.height=parametros.h +"px"; estilo = $i(i3GEO.Interface.IDCORPO).style; estilo.width=parametros.w +"px"; estilo.height=parametros.h +"px"; estilo.clip = 'rect('+0+" "+(parametros.w)+" "+(parametros.h)+" "+0+')'; objmapaparado = "nao"; //utilizado para verificar se o mouse esta parado gadgets.mostraMenuSuspenso(); gadgets.mostraMenuLista(); i3GEO.eventos.ativa(i); i3GEO.coordenadas.mostraCoordenadas(); gadgets.mostraEscalaNumerica(); gadgets.mostraEscalaGrafica(); gadgets.visual.inicia(); iu.arvore(""+$trad("p13")+"","listaPropriedades",configura.listaDePropriedadesDoMapa); // //i3GEO.arvoreDeCamadas.CAMADAS é definido na inicialização (classe_i3geo) // i3GEO.arvoreDeCamadas.cria("",i3GEO.arvoreDeCamadas.CAMADAS,configura.sid,configura.locaplic); i3GEO.ajuda.ativaLetreiro(parametros.mensagens); if(i3GEO.Interface.STATUS.trocando === false) {i3GEO.Interface.ativaBotoes();} i3GEO.idioma.mostraSeletor(); if (configura.mapaRefDisplay !== "none"){ if (iu.pegaCookie("i3GEO.configura.mapaRefDisplay")) {configura.mapaRefDisplay = iu.pegaCookie("i3GEO.configura.mapaRefDisplay");} if (configura.mapaRefDisplay === "block") {i3GEO.maparef.inicia();} } }, ativaBotoes: function(){ if(typeof(console) !== 'undefined'){console.info("i3GEO.Interface.padrao.ativaBotoes()");} var x1,y1,x2,y2, imagemxy = i3GEO.util.pegaPosicaoObjeto($i(i3GEO.Interface.IDCORPO)), barraDeBotoes = i3GEO.barraDeBotoes; if ($i("barraDeBotoes1") || barraDeBotoes.AUTO === true){ x1 = imagemxy[0]+i3GEO.Interface.BARRABOTOESLEFT; y1 = imagemxy[1]+i3GEO.Interface.BARRABOTOESTOP; } if ($i("barraDeBotoes2") || barraDeBotoes.AUTO === true){ x2 = imagemxy[0]+i3GEO.Interface.BARRABOTOESLEFT; y2 = imagemxy[1]+i3GEO.Interface.BARRABOTOESTOP; } if (($i("barraDeBotoes1") && $i("barraDeBotoes2")) || barraDeBotoes.AUTO === true){ x1 = imagemxy[0]+i3GEO.Interface.BARRABOTOESLEFT+40; } if ($i("barraDeBotoes1") || barraDeBotoes.AUTO === true) {barraDeBotoes.inicializaBarra("barraDeBotoes1","i3geo_barra1",true,x1,y1);} if ($i("barraDeBotoes2") || barraDeBotoes.AUTO === true) {barraDeBotoes.inicializaBarra("barraDeBotoes2","i3geo_barra2",false,x2,y2);} //ativa as funções dos botões barraDeBotoes.ativaBotoes(); 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 + "px"; f.style.height = h + "px"; 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.arvoreDeCamadas.CAMADAS é definido na inicialização (classe_i3geo) // i3GEO.arvoreDeCamadas.cria("",i3GEO.arvoreDeCamadas.CAMADAS,i3GEO.configura.sid,i3GEO.configura.locaplic); i3GEO.util.arvore(""+$trad("p13")+"","listaPropriedades",i3GEO.configura.listaDePropriedadesDoMapa); }, 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: FUNDOTEMA Estilo "background" do nome do tema na árvore de camadas enquanto o mesmo está sendo carregado. Permite destacar o nome do tema que está em processo de carregamento Tipo: {background style} Default: {yellow} */ FUNDOTEMA: "yellow", /* 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.0005, -0.0005, 0.0005, 0.0005], /* 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 // var openlayers = i3GEO.Interface.openlayers; openlayers.criaLayers(); openlayers.ordenaLayers(); openlayers.recalcPar(); i3GEO.janela.fechaAguarde(); openlayers.sobeLayersGraficos(); }, cria: function(w,h){ var f,ins, mi = i3GEO.Interface.openlayers.MINEXTENT, ma = i3GEO.Interface.openlayers.MAXEXTENT, i = $i(i3GEO.Interface.IDCORPO), bb = i3GEO.barraDeBotoes; OpenLayers.DOTS_PER_INCH = i3GEO.util.calculaDPI(); //corrige a localização do script OpenLayers._getScriptLocation = function(){ return i3GEO.configura.locaplic + "/pacotes/openlayers/"; }; if(i){ f = $i("openlayers"); if(!f){ ins = '
'; i.innerHTML = ins; } f = $i("openlayers"); f.style.width = w+"px"; f.style.height = h+"px"; } i3GEO.Interface.IDMAPA = "openlayers"; if(i3GEO.Interface.TABLET === true){ i3geoOL = new OpenLayers.Map({ div: "openlayers", theme: null, controls: [ new OpenLayers.Control.Attribution(), new OpenLayers.Control.TouchNavigation({ dragPanOptions: { interval: 100, enableKinetic: true } }), new OpenLayers.Control.ZoomPanel() ] }); } else{ bb.INCLUIBOTAO.zoomli = true; bb.INCLUIBOTAO.pan = true; bb.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]), allOverlays: false }); } }, 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,layersn, openlayers = i3GEO.Interface.openlayers; i3GEO.util.multiStep([ openlayers.registraEventos, openlayers.zoom2ext ],[ null, [i3GEO.parametros.mapexten] ], function(){} ); if(openlayers.GADGETS.PanZoom === true){ pz = new OpenLayers.Control.PanZoom(); i3geoOL.addControl(pz); pz.div.style.zIndex = 5000; } openlayers.criaLayers(); // //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(openlayers.GADGETS.LayerSwitcher === true) {i3geoOL.addControl(new OpenLayers.Control.LayerSwitcher());} } if(openlayers.GADGETS.ScaleLine === true){ pz = new OpenLayers.Control.ScaleLine(); i3geoOL.addControl(pz); pz.div.style.left = i3GEO.Interface.BARRADEZOOMLEFT+5+"px"; } if(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 // if(i3GEO.Interface.TABLET === false){ i3GEO.Interface.openlayers.OLpan = new OpenLayers.Control.Navigation(); i3GEO.Interface.openlayers.OLzoom = new OpenLayers.Control.ZoomBox(); i3GEO.Interface.openlayers.OLpanel = new OpenLayers.Control.Panel(); i3GEO.Interface.openlayers.OLpanel.addControls([i3GEO.Interface.openlayers.OLpan,i3GEO.Interface.openlayers.OLzoom]); i3geoOL.addControl(i3GEO.Interface.openlayers.OLpanel); } 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();} } //é necessário ativar nesse momento pois a barra de botoes já foi criada if(i3GEO.Interface.TABLET === false) {i3GEO.Interface.openlayers.OLpanel.activateControl(i3GEO.Interface.openlayers.OLpan);} i3GEO.Interface.ativaBotoes(); if(openlayers.GADGETS.PanZoomBar === true){ i3GEO.Interface.openlayers.OLpanzoombar = new OpenLayers.Control.PanZoomBar(); i3geoOL.addControl(i3GEO.Interface.openlayers.OLpanzoombar); i3GEO.Interface.openlayers.OLpanzoombar.div.style.zIndex = 5000; i3GEO.Interface.openlayers.OLpanzoombar.div.style.top = i3GEO.Interface.BARRADEZOOMTOP+"px"; i3GEO.Interface.openlayers.OLpanzoombar.div.style.left = i3GEO.Interface.BARRADEZOOMLEFT+"px"; } }; i3GEO.arvoreDeCamadas.ATIVATEMA = "i3GEO.Interface.openlayers.ligaDesliga(this);i3GEO.eventos.executaEventos(i3GEO.eventos.ATUALIZAARVORECAMADAS);"; i3GEO.util.multiStep([ i3GEO.coordenadas.mostraCoordenadas, montaMapa, i3GEO.gadgets.mostraMenuSuspenso, i3GEO.ajuda.ativaLetreiro, i3GEO.idioma.mostraSeletor, i3GEO.gadgets.mostraEscalaNumerica, i3GEO.util.arvore, i3GEO.gadgets.mostraMenuLista ],[ null, null, null, [i3GEO.parametros.mensagens], null, null, [""+$trad("p13")+"","listaPropriedades",i3GEO.configura.listaDePropriedadesDoMapa], null ], function(){} ); i3GEO.arvoreDeCamadas.cria("",i3GEO.arvoreDeCamadas.CAMADAS,i3GEO.configura.sid,i3GEO.configura.locaplic); if(i3GEO.arvoreDeCamadas.MOSTRALISTAKML === true) {i3GEO.Interface.openlayers.adicionaListaKml();} if(i3GEO.parametros.kmlurl !== "") {i3GEO.Interface.openlayers.adicionaKml(true,i3GEO.parametros.kmlurl);} //executa função de finalização, se houver if(YAHOO.lang.isFunction(i3GEO.finalizaAPI)) {i3GEO.finalizaAPI.call();} else{ if(i3GEO.finalizaAPI != "") {eval(i3GEO.finalizaAPI);} } }, aplicaOpacidade: function(opacidade){ var nlayers = i3GEO.arvoreDeCamadas.CAMADAS.length, layer, i, camada; for(i=nlayers-1;i>=0;i--){ camada = i3GEO.arvoreDeCamadas.CAMADAS[i]; layer = i3geoOL.getLayersByName(camada.name)[0]; if(layer && layer.isBaseLayer === false) {layer.setOpacity(opacidade);} } }, adicionaListaKml: function(){ var monta = function(retorno){ var raiz,nraiz,i; raiz = retorno.data.canais; nraiz = raiz.length; for (i=0;iEditar cadastro", idmenu:"",enableHighlight:false,expanded:false }, node ); } }, adicionaNoArvoreKml: function(url,nomeOverlay,ativo,id){ var root,node,d,nodekml; if(!$i("arvoreCamadasKml")) {i3GEO.Interface.openlayers.criaArvoreKML();} if(arguments.length === 2){ ativo = true; id = nomeOverlay; } if(arguments.length === 2) {id = nomeOverlay;} root = i3GEO.Interface.openlayers.ARVORE.getRoot(); node = i3GEO.Interface.openlayers.ARVORE.getNodeByProperty("idkml","raiz"); html = ""+nomeOverlay+""; d = {html:html}; nodekml = new YAHOO.widget.HTMLNode(d, node, true,true); nodekml.enableHighlight = false; nodekml.isleaf = true; i3GEO.Interface.openlayers.ARVORE.draw(); i3GEO.Interface.openlayers.ARVORE.collapseAll(); node.expand(); if(ativo === true){ i3GEO.Interface.openlayers.insereLayerKml(id,url); } }, insereLayerKml: function(id,url){ var temp; eval(id+" = new OpenLayers.Layer.Vector('"+id+"', {displayOutsideMaxExtent:true,displayInLayerSwitcher:false,visibility:true, strategies: [new OpenLayers.Strategy.Fixed()],protocol: new OpenLayers.Protocol.HTTP({url: '"+url+"',format: new OpenLayers.Format.KML({extractStyles: true,extractAttributes: true,maxDepth: 5})})})"); eval("i3geoOL.addLayer("+id+");"); eval("temp = "+id+".div;"); temp.onclick = function(e){ var targ,id,temp,features,n,i,j,html=""; if (!e){e = window.event;} if (e.target) {targ = e.target;} else if (e.srcElement) {targ = e.srcElement;} temp = targ.id.split("_"); if(temp[0] === "OpenLayers.Geometry.Point"){ id = targ.id; temp = i3geoOL.getLayer(this.id); features = temp.features; n = features.length; for(i=0;i=0;i--){ layer = ""; camada = i3GEO.arvoreDeCamadas.CAMADAS[i]; opcoes.singleTile = !(i3GEO.Interface.openlayers.TILES); //o copyright é colocado no mapa como um elemento html. O LAYER com "name = copyright " só é usado //para persistir no mapfile em funçãod as operações de impressão if(i3geoOL.getLayersByName(camada.name).length === 0 && camada.name.toLowerCase() != "copyright"){ urllayer = url+"&layer="+camada.name+"&r="+Math.random(); try{ temp = camada.type === 0 ? opcoes.gutter = 20 : opcoes.gutter = 0; temp = camada.transitioneffect === "nao" ? opcoes.transitionEffect = "null" : opcoes.transitionEffect = "resize"; if(camada.connectiontype === 7 && camada.wmsurl !== "" && camada.usasld.toLowerCase() != "sim"){ urllayer = camada.wmsurl+"&r="+Math.random(); layer = new OpenLayers.Layer.WMS(camada.name, urllayer,{LAYERS:camada.name,format:camada.wmsformat,transparent:true},opcoes); if(camada.wmssrs != "" && layer.url) {layer.url = layer.url+"&SRS="+camada.wmssrs+"&CRS="+camada.wmssrs;} } else{ if(camada.tiles === "nao" || camada.escondido.toLowerCase() === "sim" || camada.connectiontype === 10 || camada.type === 0 || camada.type === 4 || camada.type === 8 ) {opcoes.singleTile = true;} else{ temp = camada.type === 3 ? opcoes.singleTile = false : opcoes.singleTile = !(i3GEO.Interface.openlayers.TILES); } layer = new OpenLayers.Layer.WMS(camada.name, urllayer,{LAYERS:camada.name,map_imagetype:i3GEO.Interface.OUTPUTFORMAT},opcoes); } } catch(e){} if(camada.escondido.toLowerCase() === "sim") {layer.transitionEffect = "null";} i3geoOL.addLayer(layer); } else {layer = i3geoOL.getLayersByName(camada.name)[0];} //não use === if(layer && layer != "") {temp = camada.status == 0 ? layer.setVisibility(false) : layer.setVisibility(true);} } try {i3geoOL.addLayers(i3GEO.Interface.openlayers.LAYERSADICIONAIS);} catch(e){} //inclui copyright if(i3GEO.parametros.copyright != "" && !$i("i3GEOcopyright")){ temp = document.createElement("div"); temp.id = "i3GEOcopyright"; temp.style.display = "block"; temp.style.top = "0px"; temp.style.left = "0px"; temp.style.zIndex = 5000; temp.style.position = "absolute"; temp.innerHTML = "

"+i3GEO.parametros.copyright+"

"; $i(i3GEO.Interface.IDMAPA).appendChild(temp); } }, sobeLayersGraficos: function(){ var nlayers = i3geoOL.getNumLayers(), layers = i3geoOL.layers, i; for(i=0;i=0;i--){ camada = i3GEO.arvoreDeCamadas.CAMADAS[i]; layer = i3geoOL.getLayersByName(camada.name)[0]; if(layer) {i3geoOL.removeLayer(layer,false);} } }, alteraParametroLayers: function(parametro,valor){ var layers = i3geoOL.layers, nlayers = layers.length, i, url, reg; for(i=0;i 0) {i3GEO.arvoreDeCamadas.progressBar.set('value',i3GEO.arvoreDeCamadas.progressBar.get('value') + 1);} else{ i3GEO.arvoreDeCamadas.progressBar.set('value',0); p.style.display = "none"; } } } }, ordenaLayers:function(){ var ordem = i3GEO.arvoreDeCamadas.CAMADAS, nordem = ordem.length, layer, layers, i, maiorindice; //maior indice layers = i3geoOL.layers; maiorindice = i3geoOL.getLayerIndex(layers[(layers.length)-1]); for(i=nordem-1;i>=0;i--){ layers = i3geoOL.getLayersByName(ordem[i].name); layer = layers[0]; if(layer) {i3geoOL.setLayerIndex(layer,maiorindice+i);} } }, sobeDesceLayer:function(tema,tipo){ var layer = i3geoOL.getLayersByName(tema)[0], indice; if(layer){ 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 = "", b; 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); //beacons pattern b = new Image(); b.src = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?funcao=ligatemasbeacon&desligar="+desligar+"&ligar="+ligar+"&adicionar=nao&g_sid="+i3GEO.configura.sid; b.onerror = function(){i3GEO.mapa.legendaHTML.atualiza();}; } }, ativaFundo: function(id){ i3geoOL.setBaseLayer(i3geoOL.getLayer(id)); i3GEO.Interface.openlayers.OLpanzoombar.div.style.top = i3GEO.Interface.BARRADEZOOMTOP+"px"; i3GEO.Interface.openlayers.OLpanzoombar.div.style.left = i3GEO.Interface.BARRADEZOOMLEFT+"px"; }, atualizaMapa:function(){ var layers = i3geoOL.layers, nlayers = layers.length, i; for(i=0;i'; i.innerHTML = ins; } f = $i("googlemapsdiv"); if(w){ f.style.width = w + "px"; f.style.height = h + "px"; } } i3GeoMap = ""; i3GEO.Interface.IDMAPA = "googlemapsdiv"; if(i3GEO.Interface.TABLET === false){ 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,montaMapa; pol = i3GEO.parametros.mapexten; ret = pol.split(" "); montaMapa = function(retorno){ var pos, sw,ne,z,myMapType, dobra = $i("i3GEOdobraPagina"); try{ i3GeoMap = new google.maps.Map($i(i3GEO.Interface.IDMAPA),i3GEO.Interface.googlemaps.MAPOPTIONS); } catch(e){alert(e);return;} if(dobra) {$i(i3GEO.Interface.IDMAPA).appendChild(dobra);} // //carrega o javascript que permite fazer o zoom por box // if(!$i("keydragzoom_script")){ i3GEO.util.scriptTag( i3GEO.configura.locaplic+"/pacotes/google/keydragzoom.js.php", "i3GEO.Interface.googlemaps.ativaZoomBox()", "keydragzoom_script", false ); } 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)); i3GeoMapOverlay = new google.maps.OverlayView(); i3GeoMapOverlay.draw = function() {}; i3GEO.Interface.googlemaps.criaLayers(); i3GeoMapOverlay.setMap(i3GeoMap); i3GEO.Interface.googlemaps.registraEventos(); //se o mapa está no modo de troca de interface, alguns elementos não precisam ser inseridos novamente if(i3GEO.Interface.STATUS.trocando === false){ i3GEO.gadgets.mostraInserirKml(); } i3GEO.Interface.ativaBotoes(); i3GEO.eventos.ativa($i(i3GEO.Interface.IDMAPA)); if(i3GEO.Interface.STATUS.trocando === false){ i3GEO.coordenadas.mostraCoordenadas(); i3GEO.gadgets.mostraEscalaNumerica(); i3GEO.gadgets.mostraMenuLista(); i3GEO.idioma.mostraSeletor(); } i3GEO.gadgets.mostraMenuSuspenso(); g_operacao = ""; g_tipoacao = ""; if(i3GEO.Interface.STATUS.trocando === true){ $i(i3GEO.arvoreDeCamadas.IDHTML).innerHTML = ""; } if(i3GEO.Interface.STATUS.trocando === false){ i3GEO.util.arvore(""+$trad("p13")+"","listaPropriedades",i3GEO.configura.listaDePropriedadesDoMapa); } i3GEO.arvoreDeCamadas.ATIVATEMA = "i3GEO.Interface.googlemaps.ligaDesliga(this)"; i3GEO.arvoreDeCamadas.cria("",i3GEO.arvoreDeCamadas.CAMADAS,i3GEO.configura.sid,i3GEO.configura.locaplic); if(i3GEO.arvoreDeCamadas.MOSTRALISTAKML === true) {i3GEO.Interface.googlemaps.adicionaListaKml();} if(i3GEO.parametros.kmlurl !== "") {i3GEO.Interface.googlemaps.adicionaKml(true,i3GEO.parametros.kmlurl);} //executa função de finalização, se houver if(YAHOO.lang.isFunction(i3GEO.finalizaAPI)) {i3GEO.finalizaAPI.call();} else{ if(i3GEO.finalizaAPI != "") {eval(i3GEO.finalizaAPI);} } }; i3GEO.php.googlemaps(montaMapa); }, criaLayers: function(){ var nlayers = i3GEO.arvoreDeCamadas.CAMADAS.length, i, camada, indice; for (i=0;i 0){ for(i=0;i 0) {return divimg[i].parentNode.parentNode.parentNode;} } } return false; }, ligaDesliga:function(obj){ var indice = i3GEO.Interface.googlemaps.retornaIndiceLayer(obj.value), temp = function(){i3GEO.mapa.legendaHTML.atualiza();}, desligar = "", ligar = "", n, i, lista = [], listatemp; if(obj.checked && !indice){ ligar = obj.value; //verifica qual o indice correto da camada listatemp = i3GEO.arvoreDeCamadas.listaLigadosDesligados()[0]; //reordena a lista. Necessário nas interfaces que utilizam grupos na árvore de camadas n = i3GEO.arvoreDeCamadas.CAMADAS.length; for(i=0;i"+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{return;} } i3GEO.Interface.googlemaps.ARVORE = new YAHOO.widget.TreeView("arvoreCamadasKml"); root = i3GEO.Interface.googlemaps.ARVORE.getRoot(); titulo = "
Kml
"; d = {html:titulo,idkml:"raiz"}; node = new YAHOO.widget.HTMLNode(d, root, true,true); node.enableHighlight = false; if(i3GEO.parametros.editor === "sim"){ d = new YAHOO.widget.HTMLNode( { html:"Editar cadastro", idmenu:"",enableHighlight:false,expanded:false }, node ); } }, /* 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:{ /* Variable: PARAMETROSLAYER Parâmetros adicionais que são inseridos na URL que define cada layer Tipo: {string} */ PARAMETROSLAYER: "&TIPOIMAGEM="+i3GEO.configura.tipoimagem, /* Variable: posfixo String acrescentada à url de cada tile para garantir a remoção do cache local Type: {string} */ posfixo: "", /* 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: "", ligaDesliga:function(obj){ var layer = i3GEO.Interface.googleearth.retornaObjetoLayer(obj.value), temp = function(){i3GEO.mapa.legendaHTML.atualiza();}, desligar = "", ligar = ""; if(obj.checked){ i3GEO.arvoreDeCamadas.alteraPropCamadas("status","2",obj.value); ligar = obj.value; } else{ i3GEO.arvoreDeCamadas.alteraPropCamadas("status","0",obj.value); desligar = obj.value; } layer.setVisibility(obj.checked); if(desligar !== "" || ligar !== "") {i3GEO.php.ligatemas(temp,desligar,ligar);} }, atualizaTema:function(retorno,tema){ var layer = i3GEO.Interface.googleearth.retornaObjetoLayer(tema), hr = layer.getLink().getHref(); hr = hr.replace("&&&&&",""); layer.getLink().setHref(hr+"&"); if(retorno === "") {return;} i3GEO.Interface.googleearth.recalcPar(); try {i3GEO.arvoreDeCamadas.atualiza(retorno.data.temas);} catch(e) {i3GEO.arvoreDeCamadas.atualiza();} i3GEO.janela.fechaAguarde(); }, redesenha: function(){ i3GEO.Interface.googleearth.posfixo += "&"; var nlayers = i3GEO.arvoreDeCamadas.CAMADAS.length, i, camada, indice; for (i=0;i"+$trad("p13")+"","listaPropriedades",i3GEO.configura.listaDePropriedadesDoMapa); i3GEO.barraDeBotoes.INCLUIBOTAO.zoomli = false; i3GEO.barraDeBotoes.INCLUIBOTAO.pan = false; i3GEO.barraDeBotoes.INCLUIBOTAO.zoomtot = false; i3GEO.Interface.IDMAPA = "i3GeoMap3d"; i3GEO.arvoreDeCamadas.ATIVATEMA = "i3GEO.Interface.googleearth.ligaDesliga(this)"; i = $i(i3GEO.Interface.IDCORPO); if(i){ i3GeoMap3d = document.createElement("div"); i3GeoMap3d.style.width = w + "px"; i3GeoMap3d.style.height = h + "px";// + 45; i.style.height = h ;//+ 45; i3GeoMap3d.id = "i3GeoMap3d"; i3GeoMap3d.style.zIndex = 0; i.appendChild(i3GeoMap3d); } i3GeoMap = null; google.load("earth", "1"); }, inicia: function(){ google.earth.createInstance("i3GeoMap3d", i3GEO.Interface.googleearth.iniciaGE, i3GEO.Interface.googleearth.falha); }, iniciaGE: function(object){ var montaMapa = function(retorno){ i3GeoMap = object; i3GeoMap.getWindow().setVisibility(true); i3GEO.Interface.googleearth.zoom2extent(i3GEO.parametros.mapexten); i3GEO.Interface.googleearth.criaLayers(); 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); i3GEO.Interface.googleearth.POSICAOTELA = YAHOO.util.Dom.getXY($i(i3GEO.Interface.IDCORPO)); // //i3GEO.arvoreDeCamadas.CAMADAS é definido na inicialização (classe_i3geo) // i3GEO.arvoreDeCamadas.cria("",i3GEO.arvoreDeCamadas.CAMADAS,i3GEO.configura.sid,i3GEO.configura.locaplic); i3GEO.gadgets.mostraMenuSuspenso(); i3GEO.gadgets.mostraMenuLista(); i3GEO.Interface.googleearth.ativaBotoes(); i3GEO.gadgets.mostraInserirKml("inserirKml"); if(i3GEO.arvoreDeCamadas.MOSTRALISTAKML === true) {i3GEO.Interface.googleearth.adicionaListaKml();} i3GEO.Interface.googleearth.registraEventos(); if(i3GEO.parametros.kmlurl !== "") {i3GEO.Interface.googleearth.adicionaKml(true,i3GEO.parametros.kmlurl,i3GEO.parametros.kmlurl,false);} //executa função de finalização, se houver if(YAHOO.lang.isFunction(i3GEO.finalizaAPI)) {i3GEO.finalizaAPI.call();} else{ if(i3GEO.finalizaAPI != "") {eval(i3GEO.finalizaAPI);} } }; i3GEO.php.googleearth(montaMapa); }, criaLayers: function(){ var nlayers = i3GEO.arvoreDeCamadas.CAMADAS.length, i, camada, indice, layer; for (i=0;i '; i3GEO.barraDeBotoes.inicializaBarra("barraDeBotoes2","",false,"200","200",janela[2].id); i3GEO.barraDeBotoes.ativaBotoes(); i3GEO.Interface.googleearth.aguarde = $i("i3GEOF.ferramentasGE_imagemCabecalho").style; $i("i3GEOF.ferramentasGE_minimizaCabecalho").style.right = "0px"; $i("i3GEOF.ferramentasGE").lastChild.style.display = "none"; i3GEO.ajuda.abreJanela(); }, balao: function(texto,ddx,ddy){ var placemark = i3GeoMap.createPlacemark(''), point = i3GeoMap.createPoint(''), b; point.setLatitude(ddy); point.setLongitude(ddx); placemark.setGeometry(point); b = i3GeoMap.createHtmlStringBalloon(''); b.setContentString("
"+texto+"
"); b.setFeature(placemark); i3GeoMap.setBalloon(b); }, insereMarca: function(description,ddx,ddy,name,snippet){ if(typeof(console) !== 'undefined'){console.info("i3GEO.Interface.googleearth.insereMarca()");} var placemark = i3GeoMap.createPlacemark(''), point = i3GeoMap.createPoint(''); placemark.setName(name); point.setLatitude(ddy); point.setLongitude(ddx); placemark.setGeometry(point); if(description !== "") {placemark.setDescription(description);} placemark.setSnippet(snippet); 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,snippet){ function makeCircle(centerLat, centerLng, radius) { var ring = i3GeoMap.createLinearRing(''), steps = 25, i, pi2 = Math.PI * 2, lat, lng; for (i = 0; i < steps; i++) { lat = centerLat + radius * Math.cos(i / steps * pi2); lng = centerLng + radius * Math.sin(i / steps * pi2); ring.getCoordinates().pushLatLngAlt(lat, lng, 0); } return ring; } var polygonPlacemark = i3GeoMap.createPlacemark(''), poly = i3GeoMap.createPolygon(''), outer, polyStyle; poly.setAltitudeMode(i3GeoMap.ALTITUDE_RELATIVE_TO_GROUND); polygonPlacemark.setGeometry(poly); outer = i3GeoMap.createLinearRing(''); polygonPlacemark.getGeometry().setOuterBoundary(makeCircle(centerLat, centerLng, radius)); polygonPlacemark.setName(name); polygonPlacemark.setSnippet(snippet); polygonPlacemark.setStyleSelector(i3GeoMap.createStyle('')); polyStyle = polygonPlacemark.getStyleSelector().getPolyStyle(); polyStyle.setFill(0); i3GeoMap.getFeatures().appendChild(polygonPlacemark); }, insereLinha: function(xi,yi,xf,yf,name,snippet){ var lineStringPlacemark = i3GeoMap.createPlacemark(''), lineString, lineStyle; lineStringPlacemark.setName(name); 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('')); lineStringPlacemark.setSnippet(snippet); lineStyle = lineStringPlacemark.getStyleSelector().getLineStyle(); lineStyle.setWidth(3); i3GeoMap.getFeatures().appendChild(lineStringPlacemark); }, removePlacemark: function(nome){ var features = i3GeoMap.getFeatures(), n = features.getChildNodes().getLength(), i, nfeatures = []; for(i=0;i"; 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{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; if(i3GEO.parametros.editor === "sim"){ d = new YAHOO.widget.HTMLNode( { html:"Editar cadastro", idmenu:"",enableHighlight:false,expanded:false }, node ); } }, existeLink: function(url){ var existe = false, features = i3GeoMap.getFeatures(), n = features.getChildNodes().getLength(), i; for(i=0;i