/*
Title: Barra de botões
i3GEO.barraDeBotoes
Constrói a barra de botões flutuante
Veja também classe_interface.js (i3GEO.Interface) que possuí parâmetros que permitem ajustar a posição das barras no mapa
Exemplo:
Para alterar as opções modifique as propriedades colocando um código como o seguinte no javascript utilizado na interface de mapa que estiver sendo utilizada
i3GEO.barraDeBotoes.tipo = "olhodepeixe";
Arquivo:
i3geo/classesjs/classe_barradebotoes.js
Licença:
GPL2
i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet
Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil
Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com
Este programa é software livre; você pode redistribuí-lo
e/ou modificá-lo sob os termos da Licença Pública Geral
GNU conforme publicada pela Free Software Foundation;
Este programa é distribuído na expectativa de que seja útil,
porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita
de COMERCIABILIDADE OU 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'){
var i3GEO = {};
}
i3GEO.barraDeBotoes = {
/*
Propriedade: ATIVA
Indica se a barra de botões será ou não cosntruída automaticamente no processo de inicialização do mapa.
Tipo:
{boolean}
Default:
{true}
*/
ATIVA: true,
/*
Propriedade: TIPO
Tipo de barra.
Por padrão, utiliza a biblioteca YUI para construir a barra, opcionalmente pode-se utilizar o tipo "olho de peixe".
Tipo:
{string}
Default:
{yui}
Valores:
{"yui","olhodepeixe"}
*/
TIPO: "yui",
/*
Propriedade: OFFSET
Ajuste do deslocamento vertical da barra (válido apenas para o tipo "olhodepeixe")
Desloca a barra em uma determinada quantidade de pixels. Valores negativos fazem a barra subir.
Tipo:
{numeric}
Default:
{-205}
*/
OFFSET: -205,
/*
Propriedade: POSICAO
Define o posicionamento da barra de botões do tipo olho de peixe
Valores:
{"top","bottom"}
Tipo:
{string}
Default:
{"bottom"}
*/
POSICAO: "bottom",
/*
Propriedade: MAXBOTOES
Número de botões iniciais (válido apenas para o tipo "olhodepeixe")
Se for 0, todos os botões serão mostrados
Tipo:
{numeric}
Default:
{10}
*/
MAXBOTOES: 12,
/*
Propriedade: AJUDA
Mostra um texto de ajuda colado ao ícone da ferramenta
Tipo:
{boolean}
Default:
{true}
*/
AJUDA: true,
/*
Propriedade: ORIENTACAO
Orientação vertical ou horizontal da barra (não se aplica ao tipo "olhodepeixe"
Tipo:
{string}
Valores:
{"horizontal","vertical"}
Default:
{"vertical"}
*/
ORIENTACAO: "vertical",
/*
Propriedade: HORIZONTALW
Largura da barra quando ORIENTACAO = "horizontal"
Tipo:
{numeric}
Default:
{350}
*/
HORIZONTALW: 350,
/*
Propriedade: TIPOAJUDA
Tipo do balão de ajuda que é mostrado colado ao ícone da ferramenta
Tipo:
{string}
Valores:
{"horizontal","vertical","balao"}
Default:
{"horizontal"}
*/
TIPOAJUDA: "balao",
/*
Propriedade: SOICONES
Esconde as bordas das barras e o fundo, mostrando apenas os ícones
Default:
{false}
Tipo:
{boolean}
*/
SOICONES: false,
/*
Propriedade: AUTOALTURA
Ajusta automaticamente a altura das barras conforme a altura do mapa.
Esta opção não tem efeito se a barra contiver a barra de zoom (isso ocorre em função de um bug do YIU, que causa erro na barra nessas condições)
Tipo:
{boolean}
*/
AUTOALTURA: false,
/*
Propriedade: TRANSICAOSUAVE
Altera a transparência das barras quando o mouse sobrepõe a barra e quando sai da barra
Tipo:
{boolean}
Default:
{true}
*/
TRANSICAOSUAVE: true,
/*
Propriedade: OPACIDADE
Valor da opacidade miníma utilizada quando TRANSICAOSUAVE for igual a true.
Varia de 0 a 100
Tipo:
{numeric}
Default:
{65}
*/
OPACIDADE: 65,
/*
Propriedade: PERMITEFECHAR
Mostra o botão para fechar as barras ou não.
Tipo:
{boolean}
*/
PERMITEFECHAR: true,
/*
Propriedade: PERMITEDESLOCAR
Permite deslocar as barras ou não.
Tipo:
{boolean}
*/
PERMITEDESLOCAR: true,
/*
Propriedade: ATIVAMENUCONTEXTO
Indica se o menu de contexto deve ser ativado
Tipo:
{Boolean}
Default:
{true}
*/
ATIVAMENUCONTEXTO: false,
/*
Propriedade: AUTO
Cria as barras de botões automaticamente, utilizando os botões padrão sem considerar a lista de botões definidas no HTML da interface.
A lista de botões é definida em i3GEO.configura
Tipo:
{Boolean}
Default:
{false}
*/
AUTO: false,
/*
Propriedade: LISTABOTOES
Objeto com a lista de botões e suas propriedades, como por exemplo, a função a ser executada ao se clicar no botão.
Essa lista não indica quais os botões que serão inseridos. Para definir os botões que serão inseridos, inclua no HTML da interface
os botões desejados (veja em i3geo/exemplos). Se vc utilizar a opção i3GEO.barraDeBotoes.AUTO = true , os botões serão inseridos
automaticamente. Nesse caso, utilize a opção i3GEO.barraDeBotoes.INCLUIRBOTOES para indicar os botões desejados.
Por default utiliza os botoes definidos em i3GEO.configura.funcoesBotoes.botoes
Tipo:
{JSON}
*/
LISTABOTOES: i3GEO.configura.funcoesBotoes.botoes,
/*
Propriedade: INCLUIBOTAO
Objeto que indica quais os botões que serão inseridos na barra de botões 2.
Essa opção só funciona se i3GEO.barraDeBotoes.AUTO = true
Vc pode também alterar a ordem dos botoes ou adicionar novos
Na barra de botões do tipo "yui", as chaves serão adicionadas como o atributo "id" em cada botão. Nesse caso,
é possível definir o estilo CSS para cada botão (veja em i3geo/css/botoes2.css).
A ativação de cada botão, ou seja, a função que é executada ao ser feito o clique, é definida em i3GEO.configura.funcoesBotoes
Default:
INCLUIBOTAO: {
abreJanelaLegenda: false,
zoomli: false,
zoomiauto: false,
zoomoauto: false
pan: false,
zoomtot:false,
identifica: true,
identificaBalao: true,
mede: true,
area: true,
imprimir: true,
reinicia: true,
exten: true,
referencia: true,
inserexy: true,
textofid: true,
selecao: true,
barraedicao: false,
google: true,
buscafotos: true,
wiki: true,
metar: true,
lentei: true,
confluence: true,
inseregrafico: true,
v3d: true,
localizar: true,
zoomproximo: true,
zoomanterior: true
}
Tipo:
{obj}
*/
INCLUIBOTAO: {
abreJanelaLegenda: true,
localizar: true,
zoomanterior: true,
zoomli: true,
zoomproximo: true,
zoomiauto: false,
zoomoauto: false,
pan: true,
zoomtot:true,
identifica: true,
identificaBalao: true,
mede: true,
area: true,
selecao: true,
imprimir: true,
google: true,
barraedicao: true,
referencia: true,
exten: true,
inserexy: true,
textofid: true,
reinicia: true,
buscafotos: true,
wiki: true,
metar: true,
lentei: true,
confluence: true,
inseregrafico: true,
v3d: false
},
/*
Propriedade: ICONEBOTAO
Ícones utilizados em cada um dos botões da barra.
Esses ícones são utilizados apenas se i3GEO.barraDeBotoes.TIPO = "olhodepeixe". Para cada elemento existente em
i3GEO.barraDeBotoes.INCLUIBOTAO deve existir um elemento nesse objeto. A chave de cada elemento é a mesma do objeto INCLUIBOTAO.
O endereço da imagem será complementado pelo i3geo, adicionando no início da string o valor da variável i3GEO.configura.locaplic
Default:
ICONEBOTAO: {
zoomli: "/imagens/gisicons/eudock/zoom-region.png",
zoomproximo: "/imagens/gisicons/eudock/zoom-next.png",
zoomanterior: "/imagens/gisicons/eudock/zoom-last.png",
pan: "/imagens/gisicons/eudock/pan.png",
zoomtot: "/imagens/gisicons/eudock/zoom-extent.png",
identifica: "/imagens/gisicons/eudock/identify.png",
identificaBalao: "/imagens/gisicons/eudock/tips.png",
mede: "/imagens/gisicons/eudock/length-measure.png",
area: "/imagens/gisicons/eudock/area-measure.png",
imprimir: "/imagens/gisicons/eudock/print.png",
reinicia: "/imagens/gisicons/eudock/redraw.png",
exten: "/imagens/gisicons/eudock/map-extent-info.png",
referencia: "/imagens/gisicons/eudock/map-reference.png",
inserexy: "/imagens/gisicons/eudock/point-create.png",
textofid: "/imagens/gisicons/eudock/text-add.png",
selecao: "/imagens/gisicons/eudock/select.png",
google: "/imagens/gisicons/eudock/google-map.png",
buscafotos: "/imagens/gisicons/eudock/fotos.png",
wiki: "/imagens/gisicons/eudock/wiki.png",
metar: "/imagens/gisicons/eudock/metar.png",
lentei: "/imagens/gisicons/eudock/lente.png",
confluence: "/imagens/gisicons/eudock/confluence.png",
inseregrafico: "/imagens/gisicons/eudock/grafico.png",
v3d: "/imagens/gisicons/eudock/v3d.png",
barraedicao: "/imagens/gisicons/eudock/editopen.png",
localizar: "/imagens/gisicons/eudock/search.png",
abreJanelaLegenda: "/imagens/gisicons/eudock/legenda.png"
}
Type:
{obj}
*/
ICONEBOTAO: {
zoomli: "/imagens/gisicons/eudock/zoom-region.png",
zoomproximo: "/imagens/gisicons/eudock/zoom-next.png",
zoomanterior: "/imagens/gisicons/eudock/zoom-last.png",
zoomiauto: "/imagens/gisicons/eudock/zoom-in.png",
zoomoauto: "/imagens/gisicons/eudock/zoom-out.png",
pan: "/imagens/gisicons/eudock/pan.png",
zoomtot: "/imagens/gisicons/eudock/zoom-extent.png",
identifica: "/imagens/gisicons/eudock/identify.png",
identificaBalao: "/imagens/gisicons/eudock/tips.png",
mede: "/imagens/gisicons/eudock/length-measure.png",
area: "/imagens/gisicons/eudock/area-measure.png",
imprimir: "/imagens/gisicons/eudock/print.png",
reinicia: "/imagens/gisicons/eudock/redraw.png",
exten: "/imagens/gisicons/eudock/map-extent-info.png",
referencia: "/imagens/gisicons/eudock/map-reference.png",
inserexy: "/imagens/gisicons/eudock/point-create.png",
textofid: "/imagens/gisicons/eudock/text-add.png",
selecao: "/imagens/gisicons/eudock/select.png",
google: "/imagens/gisicons/eudock/google-map.png",
buscafotos: "/imagens/gisicons/eudock/fotos.png",
wiki: "/imagens/gisicons/eudock/wiki.png",
metar: "/imagens/gisicons/eudock/metar.png",
lentei: "/imagens/gisicons/eudock/lente.png",
confluence: "/imagens/gisicons/eudock/confluence.png",
inseregrafico: "/imagens/gisicons/eudock/grafico.png",
v3d: "/imagens/gisicons/eudock/v3d.png",
barraedicao: "/imagens/gisicons/eudock/editopen.png",
localizar: "/imagens/gisicons/eudock/search.png",
abreJanelaLegenda: "/imagens/gisicons/eudock/show-legend.png"
},
/*
Propriedade: TEMPLATEBOTAO
Template HTML que será utilizado na construção automática dos botões da barra 2.
Utilize a string $$ para indicar onde será incluído o código do botão.
Default:
"
"
Tipo:
{string}
*/
TEMPLATEBOTAO: "",
/*
Propriedade: BOTAOPADRAO
Botão que será ativado ao inicializar os botões com ativaBotoes.
Correpsonde ao item iddiv de LISTABOTOES
Tipo:
{String}
*/
BOTAOPADRAO: "pan",
/*
Propriedade: COMPORTAMENTO
Define o comportamento dos botões quando é pressionado
Tipo:
{String}
Valores:
"padrao" - comportamento padrão, com bordas da esquerda e inferiores ativadas
"destacado" - destaca apenas o botão atualmente pressionado
"vermelho" - destaca com fundo vermelho
"laranja" - destaca com fundo laranja
"cinza" - destaca com fundo cinza
*/
COMPORTAMENTO: "padrao",
/*
Variavel: BARRAS
Array com os objetos YAHOO.i3GEO.janela.botoes criados
*/
BARRAS: [],
/*
Variavel: BOTAOCLICADO
Último icone que foi clicado
Tipo:
{String}
*/
BOTAOCLICADO: "",
/*
Function: ativaPadrao
Ativa o botão definido como padrão, executando a função definida em onclick
Utilizado para restaurar o status padrão da barra, principalmente por ferramentas que alteram ícones e outras propriedades do mapa
*/
ativaPadrao: function(){
if(i3GEO.barraDeBotoes.ATIVA === true){
try{
var botao = i3GEO.barraDeBotoes.defBotao(i3GEO.barraDeBotoes.BOTAOPADRAO);
if(botao.funcaoonclick){
botao.funcaoonclick.call();
}
}
catch(e){}
}
},
/*
Function: ativaIcone
Altera as bordas de um ícone aplicando um efeito de ícone realçado.
Todos os demais ícones definidos em LISTABOTOES e que tiverem o tipo = "dinamico"
serão processados para alterar as bordas dando o efeito de não ativo.
Parametro:
icone {String} - id do icone que será ativado. Esse id é o mesmo definido em LISTABOTOES
*/
ativaIcone: function(icone){
if(typeof(console) !== 'undefined'){console.info("i3GEO.barraDeBotoes.ativaIcone()");}
if(i3GEO.barraDeBotoes.ATIVA === false){
return;
}
var estilo,temp,ist,cor,ko,estiloatual = "white";
if($i(icone)){
estiloatual = $i(icone).style.backgroundColor;
}
i3GEO.barraDeBotoes.BOTAOCLICADO = icone;
ko = i3GEO.barraDeBotoes.LISTABOTOES.length-1;
if(i3GEO.barraDeBotoes.COMPORTAMENTO === "padrao"){
if(ko >= 0){
do{
temp = $i(i3GEO.barraDeBotoes.LISTABOTOES[ko].iddiv);
if (i3GEO.barraDeBotoes.LISTABOTOES[ko].tipo==="dinamico" && temp){
ist = temp.style;
ist.borderWidth="1px";
ist.borderColor='white';
if(i3GEO.barraDeBotoes.SOICONES === true){
ist.borderLeftColor='rgb(50,50,50)';
ist.borderBottomColor='rgb(50,50,50)';
}
}
}
while(ko--);
}
//ativa o icone
if($i(icone)){
estilo = $i(icone).style;
if(i3GEO.barraDeBotoes.SOICONES === false){
estilo.borderColor='white';
estilo.borderWidth="1px";
}
}
}
if(i3GEO.barraDeBotoes.COMPORTAMENTO === "destacado"){
if(ko >= 0){
do{
temp = $i(i3GEO.barraDeBotoes.LISTABOTOES[ko].iddiv);
if (temp){
ist = temp.style;
ist.borderWidth="1px";
ist.borderColor='white';
}
}
while(ko--);
}
//ativa o icone
if($i(icone)){
estilo = $i(icone).style;
if(i3GEO.barraDeBotoes.SOICONES === false){
estilo.borderColor='black';
estilo.borderWidth="1px";
}
}
}
if(i3GEO.util.in_array(i3GEO.barraDeBotoes.COMPORTAMENTO,["laranja","vermelho","cinza"])){
if(ko >= 0){
do{
temp = $i(i3GEO.barraDeBotoes.LISTABOTOES[ko].iddiv);
if (temp){
ist = temp.style;
if(i3GEO.barraDeBotoes.SOICONES === false){
ist.borderWidth="1px";
ist.borderColor='white';
ist.backgroundColor='white';
}
else
{ist.backgroundColor='';}
}
}
while(ko--);
}
switch(i3GEO.barraDeBotoes.COMPORTAMENTO){
case "laranja":
cor = "orange";
break;
case "vermelho":
cor = "red";
break;
case "cinza":
cor = "gray";
break;
default:
cor = "yellow";
};
//ativa o icone
if($i(icone)){
estilo = $i(icone).style;
if(i3GEO.barraDeBotoes.SOICONES === false){
estilo.borderColor='black';
estilo.borderWidth="1px";
}
//else
//{estilo.border = "0px solid white";}
if(estiloatual == cor){
estilo.backgroundColor = 'white';
}
else{
estilo.backgroundColor = cor;
}
}
}
},
/*
Function: ativaBotoes
Ativa os botoes definidos em LISTABOTOES
Os botoes são construídos e as funções definidas são embutidas no evento onclick
Parametro:
padrao (String} - botao que será mostrado como ativo (opcional).
Se não for definido, será utilizado o botão especificado em BOTAOPADRAO.
O nome do botao deve estar em LISTABOTOES na propriedade iddiv
*/
ativaBotoes:function(padrao){
if(typeof(console) !== 'undefined'){console.info("i3GEO.barraDeBotoes.ativaBotoes()");}
var l,b,temp;
if(arguments.length === 0)
{padrao = this.BOTAOPADRAO;}
this.BOTAOCLICADO = padrao;
l = this.LISTABOTOES;
b = l.length-1;
if (b >= 0){
do{
temp = $i(l[b].iddiv);
if (temp){
if(l[b].conteudo)
{temp.innerHTML = l[b].conteudo;}
if(l[b].dica){
eval('$i("'+l[b].iddiv+'").onmouseover = function(e){i3GEO.barraDeBotoes.mostraJanela(this,"'+l[b].dica+'",e);}');
eval('$i("'+l[b].iddiv+'").onmouseout = function(e){i3GEO.barraDeBotoes.mostraJanela(this,"",e);};');
}
if(l[b].funcaoonclick){
temp.onclick = l[b].funcaoonclick;
if(l[b].iddiv == padrao)
{l[b].funcaoonclick();}
}
if(l[b].constroiconteudo)
{eval(l[b].constroiconteudo);}
}
YAHOO.util.Event.addListener($i(l[b].iddiv), "click", YAHOO.util.Event.preventDefault);
YAHOO.util.Event.addListener($i(l[b].iddiv), "click", YAHOO.util.Event.stopPropagation);
YAHOO.util.Event.addFocusListener($i(l[b].iddiv), YAHOO.util.Event.preventDefault);
}
while (b--);
}
if(padrao === "")
{this.ativaIcone("");}
},
/*
Function: execBotao
Com base no código de um botão (iddiv), obtém a função armazenada em i3GEO.barraDeBotoes.LISTABOTOES e executa.
Parametros:
id {string} - identificador do botão, conforme definido no elemento iddiv de i3GEO.barraDeBotoes.LISTABOTOES
x {numeric} - (opcional) posição em pixels da tela onde foi feito o clique do mouse
y {numeric} - (opcional) posição em pixels da tela onde foi feito o clique do mouse
*/
execBotao: function(id,x,y,posX,posY){
if(i3GEO.barraDeBotoes.ATIVA === false){
return;
}
var temp,
botao = i3GEO.barraDeBotoes.defBotao(id);
i3GEO.barraDeBotoes.BOTAOCLICADO = id;
if(botao === false)
{return;}
try{
if(botao.tipo === "dinamico" && x){
i3GEO.util.criaPin("i3geoMarcaIcone",i3GEO.configura.locaplic+"/imagens/gisicons/eudock/sobe1.png","10px","10px");
temp = $i("i3geoMarcaIcone");
if(temp){
temp.style.display = "block";
temp.style.top = posY + 43 + "px";
temp.style.left = posX + 18 + "px";
}
}
if(botao.funcaoonclick){
botao.funcaoonclick.call();
}
}
catch(e){
if(typeof(console) !== 'undefined'){console.error("Erro no botao "+id+" "+e);}
}
},
/*
Function: defBotao
Obtém as definições de um botão conforme o seu código (iddiv)
Retorno:
{objeto} - ver i3GEO.barraDeBotoes.LISTABOTOES
*/
defBotao: function(iddiv){
var l = i3GEO.barraDeBotoes.LISTABOTOES,
b = l.length-1;
if (b >= 0){
do{
//temp = l[b].iddiv;
if (l[b].iddiv === iddiv){
return l[b];
}
}
while (b--);
}
return false;
},
/*
Function: inicializaBarraOP
Inicializa a barra de botões quando for do tipo "olhodepeixe"
O objeto euEnv armazena todas as características da barra
*/
inicializaBarraOP: function(){
if(i3GEO.barraDeBotoes.ATIVA === false || !$i(i3GEO.Interface.IDCORPO)){
return;
}
//isso veio do js do eudock
if (document.onmousemove)
euEnv.onmousemoveBK = document.onmousemove;
document.onmousemove = on_MouseMove;
if (document.onmousedown)
euEnv.onmousedownBK = document.onmousedown;
document.onmousedown = on_MouseDown;
if (document.onmouseup)
euEnv.onmouseupBK = document.onmouseup;
document.onmouseup = on_MouseUp;
if (document.onclick)
euEnv.onclickBK = document.onclick;
document.onclick = on_MouseClick;
euDimensioni();
offsEut();
euThread();
//
euEnv.imageBasePath=i3GEO.configura.locaplic+"/pacotes/eudock/";
var botao,
dica,
titulo,
i,
dock = new euDock(),
temp = "dockBg-r.png",
tempAjuda = "dockBg-l.png",
chaves = i3GEO.util.listaChaves(i3GEO.barraDeBotoes.INCLUIBOTAO),
n = chaves.length,
preload;
preload = new Image();
preload.src = i3GEO.configura.locaplic+"/imagens/gisicons/eudock/sobe1.png";
if(i3GEO.barraDeBotoes.POSICAO === "top"){
dock.setObjectAlign(i3GEO.Interface.IDCORPO,euUP, (i3GEO.parametros.h)*1 + i3GEO.barraDeBotoes.OFFSET,euDOWN);
}
else{
dock.setObjectAlign(i3GEO.Interface.IDCORPO,euDOWN,(parseInt(document.body.style.height,10))*-1 + i3GEO.barraDeBotoes.OFFSET,euUP);
}
if(i3GEO.barraDeBotoes.MAXBOTOES >= chaves.length){
temp = "vazio.png";
}
if(i3GEO.barraDeBotoes.AJUDA === false){
tempAjuda = "vazio.png";
}
dock.setBar({
left:{euImage:{image:i3GEO.configura.locaplic+"/pacotes/eudock/barImages/"+tempAjuda}},
horizontal:{euImage:{image:i3GEO.configura.locaplic+"/pacotes/eudock/barImages/dockBg-c-o.png"}},
right:{euImage:{image:i3GEO.configura.locaplic+"/pacotes/eudock/barImages/"+temp}}
});
i3GEO.barraDeBotoes.AJUDA = false;
dock.setIconsOffset(7);
if(i3GEO.barraDeBotoes.MAXBOTOES > 0)
{n = i3GEO.barraDeBotoes.MAXBOTOES;}
for(i=0;i 0 && n > nb){
for(i=nb;i";}
if(this.TEMPLATEBOTAO === "" && i3GEO.Interface.TABLET === true)
{this.TEMPLATEBOTAO = "";}
var ticone,tipo,mostra,i,temp,e,wj,recuo,novoel,alturadisponivel,n,chaves,
elementos = "",
numerobotoes = 0,
nelementos = 0,
Dom = YAHOO.util.Dom,
branco = i3GEO.configura.locaplic+'/imagens/branco.gif';
if(navm)
{i3GEO.barraDeBotoes.TRANSICAOSUAVE = false;}
if(this.AUTO === true){
if(idconteudo === "barraDeBotoes1"){
novoel = document.createElement("div");
novoel.id = "barraDeBotoes1";
temp = '' +
"" +
'
' +
"
" +
"" +
'
' +
"
" +
"" +
'
' +
"
";
novoel.innerHTML = temp;
document.body.appendChild(novoel);
}
if(idconteudo === "barraDeBotoes2"){
temp = "";
chaves = i3GEO.util.listaChaves(i3GEO.barraDeBotoes.INCLUIBOTAO);
n = chaves.length;
for(i=0;i | "+
"" +temp+
" |
";
document.body.appendChild(novoel);
}
else{
$i(onde).innerHTML = temp;
return;
}
}
}
else{
if(idconteudo === "barraDeBotoes2" && onde !== undefined){
$i(onde).innerHTML = $i(idconteudo);
}
}
wj = "36px";
recuo = "0px";
novoel = document.createElement("div");
novoel.id = idconteudonovo;
novoel.style.display="block";
if(this.SOICONES === false){
novoel.style.border="1px solid gray";
novoel.style.background="white";
}
else
{novoel.style.border="0px solid white";}
if(i3GEO.barraDeBotoes.TRANSICAOSUAVE)
{Dom.setStyle(novoel,"opacity",this.OPACIDADE / 100);}
temp = "";
if (barraZoom === true)
{temp += i3GEO.navega.barraDeZoom.cria();}
temp += '';
novoel.innerHTML = temp;
novoel.onmouseover = function(){
YAHOO.util.Dom.setStyle("i3geo_rosa","display","none");
if(i3GEO.barraDeBotoes.TRANSICAOSUAVE){
YAHOO.util.Dom.setStyle(novoel,"opacity",1);
}
if(i3GEO.Interface.TABLET === true){
//i3GEO.barraDeBotoes.BARRAS[0].cfg.setProperty("height", "");
//$i(i3GEO.barraDeBotoes.BARRAS[0].id+"_").style.top = "0px";
}
};
novoel.onmouseout = function(){
if(i3GEO.barraDeBotoes.TRANSICAOSUAVE){
YAHOO.util.Dom.setStyle(novoel,"opacity",i3GEO.barraDeBotoes.OPACIDADE / 100);
}
if(i3GEO.Interface.TABLET === true){
//i3GEO.barraDeBotoes.BARRAS[0].cfg.setProperty("height", "10px");
//$i(i3GEO.barraDeBotoes.BARRAS[0].id+"_").style.top = "-200px";
}
};
document.body.appendChild(novoel);
if(this.ATIVAMENUCONTEXTO)
{i3GEO.util.mudaCursor(i3GEO.configura.cursores,"contexto",idconteudonovo,i3GEO.configura.locaplic);}
//copia os botoes do HTML para a janela
ticone = 28;
alturadisponivel = i3GEO.parametros.h - i3GEO.Interface.BARRABOTOESTOP - ticone - 38 - 38;
if(this.AUTOALTURA === true)
{alturadisponivel += 28;}
numerobotoes = parseInt(alturadisponivel / ticone,10);
if($i(idconteudo))
{
$i(idconteudonovo+"_").innerHTML = $i(idconteudo).innerHTML;
$i(idconteudo).innerHTML = "";
elementos = $i(idconteudonovo+"_").getElementsByTagName("img");
nelementos = elementos.length;
if(i3GEO.barraDeBotoes.ORIENTACAO === "horizontal")
{numerobotoes = 100;}
//faz o cálculo do número de botões que devem ficar visíveis em função do tamanho da barra
if(this.AUTOALTURA === true ||(numerobotoes < nelementos)){
if(elementos[0].id === "sobeferramentas"){
try{
elementos = $i(idconteudonovo+"_").getElementsByTagName("div");
nelementos = elementos.length;
i = 0;
do{
elementos[i].style.display = "none";
i = i + 1;
}
while(i < nelementos);
i = 0;
do{
if(elementos[i] != undefined)
{elementos[i].style.display = "inline";}
i = i + 1;
}
while(i < numerobotoes-1);
}catch(men){
if(typeof(console) !== 'undefined'){console.error(men);}
}
}
}
if(elementos.length <= numerobotoes){
Dom.setStyle(["sobeferramentas","desceferramentas"],"display","none");
}
}
YAHOO.namespace("i3GEO.janela.botoes");
if(i3GEO.barraDeBotoes.ORIENTACAO === "horizontal"){
YAHOO.i3GEO.janela.botoes = new YAHOO.widget.Panel(idconteudonovo, {zIndex:20000,height:40,width:i3GEO.barraDeBotoes.HORIZONTALW, fixedcenter: false, constraintoviewport: false, underlay:"none", close:i3GEO.barraDeBotoes.PERMITEFECHAR, visible:true, draggable:i3GEO.barraDeBotoes.PERMITEDESLOCAR, modal:false,iframe:false } );
}
else{
if(this.AUTOALTURA === false || barraZoom === true || (elementos.length > numerobotoes))
{YAHOO.i3GEO.janela.botoes = new YAHOO.widget.Panel(idconteudonovo, {zIndex:20000,width:wj, fixedcenter: false, constraintoviewport: false, underlay:"none", close:i3GEO.barraDeBotoes.PERMITEFECHAR, visible:true, draggable:i3GEO.barraDeBotoes.PERMITEDESLOCAR, modal:false,iframe:false } );}
else
{YAHOO.i3GEO.janela.botoes = new YAHOO.widget.Panel(idconteudonovo, {zIndex:20000,height:i3GEO.parametros.h - 4,width:wj, fixedcenter: false, constraintoviewport: false, underlay:"none", close:i3GEO.barraDeBotoes.PERMITEFECHAR, visible:true, draggable:i3GEO.barraDeBotoes.PERMITEDESLOCAR, modal:false,iframe:false } );}
}
if(this.SOICONES === true){
Dom.setStyle(["i3geo_barra2","i3geo_barra1"],"borderWidth","0 0 0 0");
}
YAHOO.i3GEO.janela.botoes.render();
YAHOO.i3GEO.janela.botoes.moveTo(x,y);
if($i("sobeferramentas")){
$i("sobeferramentas").onclick = function(){
elementos = $i(idconteudonovo+"_").getElementsByTagName("div");
nelementos = elementos.length;
if(elementos[0].style.display === "inline" && elementos[0].id === "")
{return;}
if(nelementos > 0){
mostra = elementos[0];
i = 0;
do{
if(elementos[i].style){
if(elementos[i].style.display === "inline" && elementos[i].id === "")
{break;}
if(elementos[i].style.display === "none" && elementos[i].id === "")
{mostra = elementos[i];}
}
i = i + 1;
}
while(i < nelementos);
mostra.style.display="inline";
//esconde o último botao
i = nelementos + 1;
mostra = elementos[i];
do{
if(elementos[i]){
if(elementos[i].style){
if(elementos[i].style.display === "inline")
{mostra = elementos[i];break;}
}
}
i = i - 1;
}
while(i >= 0);
mostra.style.display="none";
}
};
}
if($i("desceferramentas")){
$i("desceferramentas").onclick = function(){
tipo = "inline";
if($i(idconteudonovo+"_")){
elementos = $i(idconteudonovo+"_").getElementsByTagName("div");
if(elementos[elementos.length - 1].style.display === tipo)
{return;}
nelementos = elementos.length;
if(nelementos > 0){
//esconde o primeiro botao
i = 0;
do{
e = elementos[i];
if(e.style){
if((e.style.display === "block") || (e.style.display === "inline") || (e.style.display === "")){
if(e.id === "")
{e.style.display="none";break;}
}
}
i = i + 1;
}
while(i < nelementos);
//mostra o último botao
i = nelementos-1;
var mostra = elementos[i];
do{
e = elementos[i];
if(e.style){
if(e.style.display === tipo)
{break;}
if(e.style.display === "none")
{mostra = e;}
}
i = i - 1;
}
while(i >= 0);
mostra.style.display=tipo;
}
}
};
}
this.BARRAS.push(YAHOO.i3GEO.janela.botoes);
YAHOO.i3GEO.janela.botoes.show();
if(i3GEO.Interface.TABLET === true){
YAHOO.i3GEO.janela.botoes.moveTo((i3GEO.parametros.w / 2) - (i3GEO.barraDeBotoes.HORIZONTALW / 2),"");
}
//
//menu de contexto
//
if(this.ATIVAMENUCONTEXTO){
this.ativaMenuContexto(idconteudonovo);
}
Dom.replaceClass(idconteudonovo+"_h","hd2");
}
},
/*
Function: ativaMenuContexto (depreciado na versão 4.5)
Ativa o menu de contexto acionado com o botão direito do mouse
Parametro:
idbarra - {string} id da barra de botões onde o evento será ativado
*/
ativaMenuContexto: function(idbarra){
if(i3GEO.barraDeBotoes.ATIVA === false){
return;
}
if(typeof(console) !== 'undefined'){console.info("i3GEO.barraDeBotoes.ativaMenuContexto()");}
var oFieldContextMenuItemData,oFieldContextMenu,onFieldMenuRender;
function executar(a,b,c)
{eval(c);}
oFieldContextMenuItemData = [
{ text: " "},
{ text: "Fechar barra", onclick: { fn: executar, obj: "i3GEO.barraDeBotoes.fecha('"+idbarra+"')" } },
{ text: "Barra normal", onclick: { fn: executar, obj:"i3GEO.barraDeBotoes.AUTOALTURA=false;i3GEO.barraDeBotoes.PERMITEFECHAR=true;i3GEO.barraDeBotoes.PERMITEDESLOCAR=true;i3GEO.barraDeBotoes.recria('"+idbarra+"')" } },
{ text: "Barra fixa", onclick: { fn: executar, obj:"i3GEO.barraDeBotoes.AUTOALTURA=true;i3GEO.barraDeBotoes.PERMITEFECHAR=false;i3GEO.barraDeBotoes.PERMITEDESLOCAR=false;i3GEO.barraDeBotoes.recria('"+idbarra+"')" } },
{ text: "Remove transição", onclick: { fn: executar, obj:"i3GEO.barraDeBotoes.TRANSICAOSUAVE=false;" } },
{ text: "Ativa transição", onclick: { fn: executar, obj:"i3GEO.barraDeBotoes.TRANSICAOSUAVE=true;" } }
];
oFieldContextMenu = new YAHOO.widget.ContextMenu(
"contexto_"+idbarra,{
trigger: idbarra,
itemdata: oFieldContextMenuItemData,
lazyload: true
}
);
onFieldMenuRender = function(){
var id = "contexto_"+idbarra;
$i(id).style.zIndex = 50000;
};
oFieldContextMenu.subscribe("render", onFieldMenuRender);
},
/*
Function: reativa
Reativa as barras de ferramentas já criadas
Essa opção apenas aplica o método "show" aos objetos armazenados em i3GEO.barraDeBotoes.BARRAS
Se a barra não existir previamente, nada irá contecer
Parametro:
indice {Integer} - índice do array BARRAS que guarda os objetos YAHOO com
as barras Se não for definido, todas as barras serão reativadas
*/
reativa: function(indice){
if(i3GEO.barraDeBotoes.ATIVA === false){
return;
}
if(typeof(console) !== 'undefined'){console.info("i3GEO.barraDeBotoes.reativa()");}
var abre = function(){
var i,
n = i3GEO.barraDeBotoes.BARRAS.length;
for(i=0;i | fecha
|
";}
if(this.TIPOAJUDA === "vertical")
{divmensagem.innerHTML = " | fecha
|
";}
}
if(mensagem !== ""){
if(this.TIPOAJUDA !== "balao"){
YAHOO.util.Dom.setStyle("divMensagemBarraDeBotoes","display","none");
if(this.TIPOAJUDA === "horizontal"){
divmensagem.style.left = parseInt(YAHOO.util.Dom.getStyle(objeto,"width"),10)+pos[0]+10+"px";
divmensagem.style.top = pos[1]-2+(parseInt(YAHOO.util.Dom.getStyle(objeto,"height"),10) / 2)+"px";
}
if(this.TIPOAJUDA === "vertical"){
divmensagem.style.left = (parseInt(YAHOO.util.Dom.getStyle(objeto,"width"),10)/2)+pos[0]-5+"px";
divmensagem.style.top = pos[1]+5+parseInt(YAHOO.util.Dom.getStyle(objeto,"height"),10)+"px";
}
try{clearTimeout(i3GEO.barraDeBotoes.timeAjudaBotoes);}catch(e){}
i3GEO.barraDeBotoes.timeMostraAjudaBotoes = setTimeout("i3GEO.barraDeBotoes.mostraJanelaAjuda('"+mensagem+"');",5000);
}
else{
hideAllTooltips();
balloonAjuda = new Balloon();
BalloonConfig(balloonAjuda,'GBubble');
balloonAjuda.delayTime = 0;
balloonAjuda.stem = false;
balloonAjuda.stemHeight = 0;
balloonAjuda.vOffset = -24;
balloonAjuda.images = i3GEO.configura.locaplic+'/pacotes/balloon-tooltips/htdocs/images/GBubblec';
mensagem = "";
try{clearTimeout(i3GEO.barraDeBotoes.timeAjudaBotoes);}catch(e){}
i3GEO.barraDeBotoes.timeMostraAjudaBotoes = setTimeout(function(){
balloonAjuda.cleanup();
balloonIsVisible = false;
//alert(mensagem);
if(i3GEO.barraDeBotoes.TIPO === "olhodepeixe")
{balloonAjuda.showTooltip(objeto,mensagem,null,null,null,pos[0],pos[1]-40);}
else
{balloonAjuda.showTooltip(objeto,mensagem,null,null,null,pos[0]+12,pos[1]);}
try{clearTimeout(timeMostraAjudaBotoes);}catch(e){}
i3GEO.barraDeBotoes.timeAjudaBotoes = setTimeout(function(){balloonAjuda.cleanup();},4000);
},4000);
}
}
},
mostraJanelaAjuda:function(mensagem){
$i("divMensagemBarraDeBotoesCorpo").innerHTML = mensagem;
YAHOO.util.Dom.setStyle("divMensagemBarraDeBotoes","display","block");
try{clearTimeout(i3GEO.barraDeBotoes.timeMostraAjudaBotoes);}catch(e){}
i3GEO.barraDeBotoes.timeAjudaBotoes = setTimeout(function(){i3GEO.barraDeBotoes.escondeJanelaAjuda();},3000);
},
escondeJanelaAjuda:function(){
try{
if(i3GEO.barraDeBotoes.timeAjudaBotoes)
{clearTimeout(i3GEO.barraDeBotoes.timeAjudaBotoes);}
}
catch(e){}
if($i("divMensagemBarraDeBotoes"))
{YAHOO.util.Dom.setStyle("divMensagemBarraDeBotoes","display","none");}
},
editor:{
inicia: function(){
//if(navm)
//{alert("O editor não funciona corretamente nesse navegador.");}
i3GEO.eventos.cliquePerm.desativa();
if(i3GEO.Interface.ATUAL === "openlayers"){
i3GEO.barraDeBotoes.editor.carregaJs("janelaEditorVetorial");
}
if(i3GEO.Interface.ATUAL === "googlemaps"){
i3GEO.barraDeBotoes.editor.carregaJsGm();
}
},
//carrega as opcoes de edicao se a interface for do googlemaps
carregaJsGm: function(){
var temp = function(){
var cabecalho, minimiza;
cabecalho = function() {
};
minimiza = function() {
i3GEO.janela.minimiza("janelaEditorLimites");
};
i3GEO.janela.cria("300px", "100px", "", "", "",
"Editor", "janelaEditorLimites", false, "hd",
cabecalho, minimiza);
$i("janelaEditorLimites_corpo").style.backgroundColor = "white";
i3GEOF.editorlimites.inicia("janelaEditorLimites_corpo");
i3GEOF.locregiao.iniciaJanelaFlutuante();
YAHOO.i3GEO.janela.manager.find("i3GEOF.locregiao").moveTo(100,40);
};
i3GEO.util.scriptTag(
i3GEO.configura.locaplic+"/ferramentas/metaestat/editorlimites_dependencias.php",
temp,
"editorlimites_dependencias.php",
true
);
},
carregaJs: function(idjanela){
if(!i3GEO.editorOL){
i3GEO.util.scriptTag(
i3GEO.configura.locaplic+"/mashups/openlayers.js",
"i3GEO.barraDeBotoes.editor.ativaPainel('"+idjanela+"')",
"openlayers.js",
true
);
}
else{
if(!i3GEO.editorOL.layergrafico){
i3GEO.editorOL.criaLayerGrafico();
i3GEO.editorOL.mapa.addLayers([i3GEO.editorOL.layergrafico]);
}
if(!i3GEO.editorOL.backup){
i3GEO.editorOL.backup = new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false});
}
i3GEO.editorOL.criaBotoes(i3GEO.editorOL.botoes);
}
},
criaJanela: function(){
if($i("i3GEOjanelaEditor"))
{return "i3GEOjanelaEditor";}
var janela,divid,titulo,cabecalho,minimiza;
cabecalho = function(){};
minimiza = function(){
i3GEO.janela.minimiza("i3GEOjanelaEditor");
};
//cria a janela flutuante
titulo = $trad("u29");
janela = i3GEO.janela.cria(
"300px",
"200px",
"",
"",
"",
titulo,
"i3GEOjanelaEditor",
false,
"hd",
cabecalho,
minimiza
);
divid = janela[2].id;
$i("i3GEOjanelaEditor_corpo").style.backgroundColor = "white";
$i("i3GEOjanelaEditor_corpo").style.textAlign = "left";
return divid;
},
ativaPainel: function(idjanela){
OpenLayers.ImgPath = i3GEO.configura.locaplic+"/pacotes/openlayers/img/";
i3GEO.editorOL.fundo = "";//i3GEO.editorOL é criado pelo script carregado
i3GEO.editorOL.mapa = i3geoOL;
i3GEO.editorOL.maxext = "";
i3GEO.editorOL.controles = [];
i3GEO.editorOL.botoes = {
'pan':false,
'zoombox':false,
'zoomtot':false,
'legenda':false,
'distancia':false,
'area':false,
'identifica':true,
'linha':true,
'ponto':true,
'poligono':true,
'texto':true,
'corta':true,
'edita':true,
'listag':true,
'selecao':true,
'apaga':true,
'procura':false,
'propriedades':true,
'salva':true,
'ajuda':true,
'fecha':true,
'tools':true,
'undo':true,
'frente':true
};
var sketchSymbolizers = {
"Point": {
fillColor: "rgb(${fillColor})",
fillOpacity: "${opacidade}",
strokeWidth: "${strokeWidth}",
strokeOpacity: "${opacidade}",
strokeColor: "rgb(${strokeColor})",
label: "${texto}",
pointRadius: "${pointRadius}",
graphicName: "${graphicName}",
fontSize: "${fontSize}",
fontColor: "rgb(${fontColor})",
fontFamily: "Arial",
fontWeight: "normal",
labelAlign: "lb",
labelXOffset: "3",
labelYOffset: "3"
},
"Line": {
strokeWidth: "${strokeWidth}",
strokeOpacity: "${opacidade}",
strokeColor: "rgb(${strokeColor})"
},
"Polygon": {
strokeWidth: "${strokeWidth}",
strokeOpacity: "${opacidade}",
strokeColor: "rgb(${strokeColor})",
fillColor: "rgb(${fillColor})",
fillOpacity: "${opacidade}"
}
},
style = new OpenLayers.Style(),
styleMap1 = new OpenLayers.StyleMap({"default": style});
style.addRules([
new OpenLayers.Rule({symbolizer: sketchSymbolizers})
]);
i3GEO.editorOL.layergrafico = new OpenLayers.Layer.Vector("Edição",{styleMap:styleMap1,displayInLayerSwitcher:false,visibility:true});
i3GEO.editorOL.mapa.addLayers([i3GEO.editorOL.layergrafico]);
if(idjanela){
i3GEO.editorOL.criaBotoes(i3GEO.editorOL.botoes);
}
}
}
};
//YAHOO.log("carregou classe barradebotoes", "Classes i3geo");