Commit 54122a86e8348f2c1cd925903f4826b9c0d7697f

Authored by Edmar Moretti
1 parent e0ddb1c9

--no commit message

classesphp/classe_legenda.php
@@ -656,7 +656,7 @@ $size - Tamanho que será aplicado ao símbolo. @@ -656,7 +656,7 @@ $size - Tamanho que será aplicado ao símbolo.
656 656
657 $opacidade - Opacidade 657 $opacidade - Opacidade
658 */ 658 */
659 - function aplicaParametro($classe,$estilo,$outlinecolor,$backgroundcolor,$color,$symbolname,$size,$opacidade,$width,$pattern) 659 + function aplicaParametro($classe,$estilo,$outlinecolor,$backgroundcolor,$color,$symbolname,$size,$opacidade,$width,$pattern,$angle)
660 { 660 {
661 if(!$this->layer){return "erro";} 661 if(!$this->layer){return "erro";}
662 if(!empty($pattern)) 662 if(!empty($pattern))
@@ -703,6 +703,10 @@ $opacidade - Opacidade @@ -703,6 +703,10 @@ $opacidade - Opacidade
703 {$estilo->updatefromstring("STYLE PATTERN ".$pattern." END");} 703 {$estilo->updatefromstring("STYLE PATTERN ".$pattern." END");}
704 if(isset($opacidade)) 704 if(isset($opacidade))
705 {$estilo->set("opacity",$opacidade);} 705 {$estilo->set("opacity",$opacidade);}
  706 + if(isset($angle))
  707 + {
  708 + $estilo->set("angle",$angle);
  709 + }
706 if ($this->layer->getmetadata("sld") != "") 710 if ($this->layer->getmetadata("sld") != "")
707 { 711 {
708 $sld = $this->layer->getmetadata("sld"); 712 $sld = $this->layer->getmetadata("sld");
classesphp/mapa_controle.php
@@ -2548,7 +2548,7 @@ Define as características de simbologia de uma classe, cria, adiciona e exclui e @@ -2548,7 +2548,7 @@ Define as características de simbologia de uma classe, cria, adiciona e exclui e
2548 } 2548 }
2549 if ($opcao == "aplica") 2549 if ($opcao == "aplica")
2550 { 2550 {
2551 - $retorno = $m->aplicaParametro($classe,$estilo,$outlinecolor,$backgroundcolor,$color,$symbolname,$size,$opacidade,$width,$pattern); 2551 + $retorno = $m->aplicaParametro($classe,$estilo,$outlinecolor,$backgroundcolor,$color,$symbolname,$size,$opacidade,$width,$pattern,$angle);
2552 $m->salva(); 2552 $m->salva();
2553 } 2553 }
2554 if ($opcao == "listaSimbolos"){ 2554 if ($opcao == "listaSimbolos"){
ferramentas/legenda/index.js.php
1 -<?php error_reporting(0);if(extension_loaded('zlib')){ob_start('ob_gzhandler');} header("Content-type: text/javascript"); ?>  
2 -/*jslint plusplus:false,white:false,undef: false, rhino: true, onevar: true, evil: true */  
3 -/*  
4 -Title: Editor de legenda  
5 -  
6 -Define a forma de representação de um tema, modificando o tipo de classificação e os símbolos utilizados em cada classe  
7 -  
8 -Veja:  
9 -  
10 -<i3GEO.tema.dialogo.editaLegenda>  
11 -  
12 -Arquivo:  
13 -  
14 -i3geo/ferramentas/legenda/index.js.php  
15 -  
16 -Licenca:  
17 -  
18 -GPL2  
19 -  
20 -i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet  
21 -  
22 -Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil  
23 -Desenvolvedor: Edmar Moretti edmar.moretti@mma.gov.br  
24 -  
25 -Este programa é software livre; você pode redistribuí-lo  
26 -e/ou modificá-lo sob os termos da Licença Pública Geral  
27 -GNU conforme publicada pela Free Software Foundation;  
28 -  
29 -Este programa é distribuído na expectativa de que seja útil,  
30 -porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita  
31 -de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA.  
32 -Consulte a Licença Pública Geral do GNU para mais detalhes.  
33 -Você deve ter recebido uma cópia da Licença Pública Geral do  
34 -GNU junto com este programa; se não, escreva para a  
35 -Free Software Foundation, Inc., no endereço  
36 -59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.  
37 -*/  
38 -  
39 -if(typeof(i3GEOF) === 'undefined'){  
40 - i3GEOF = [];  
41 -}  
42 -  
43 -/*  
44 -Classe: i3GEOF.legenda  
45 -*/  
46 -i3GEOF.legenda = {  
47 - /*  
48 - Variavel: parDefault  
49 -  
50 - Parâmetros padrão utilizados para formatar os labels  
51 - */  
52 - parDefault: "&position=MS_UR&partials=1&offsetx=0&offsety=0&minfeaturesize=auto&mindistance=auto&force=0&shadowsizex=1&shadowsizey=1&cor=0 0 0&sombray=1&sombrax=1&angulo=0&tamanho=8&fonte=bitmap&fundo=off&sombra=off&outlinecolor=off&shadowcolor=off&wrap=",  
53 - /*  
54 - Variavel: aviso  
55 -  
56 - Indica que uma alteração ainda não foi salva  
57 -  
58 - Type:  
59 - {boolean}  
60 - */  
61 - aviso: false,  
62 - /*  
63 - Variavel: tema  
64 -  
65 - Tema que será utilizado  
66 -  
67 - Type:  
68 - {string}  
69 - */  
70 - tema: i3GEO.temaAtivo,  
71 - /*  
72 - Variavel: dadosGrafico  
73 -  
74 - Dados utilizados no gráfico no formato da ferramenta graficointerativo  
75 - */  
76 - dadosGrafico: "",  
77 - /*  
78 - Variavel: aguarde  
79 -  
80 - Estilo do objeto DOM com a imagem de aguarde existente no cabeçalho da janela.  
81 - */  
82 - aguarde: "",  
83 - /*  
84 - Variavel: estilos  
85 -  
86 - Estilos existentes em um símbolo de uma classe  
87 - */  
88 - estilos: "",  
89 - /*  
90 - Variavel: estilo  
91 -  
92 - Último estilo selecionado  
93 - */  
94 - estilo: "",  
95 - /*  
96 - Variavel: classe  
97 -  
98 - Última classe selecionado  
99 - */  
100 - classe: "",  
101 - /*  
102 - Function: inicia  
103 -  
104 - Inicia a ferramenta. É chamado por criaJanelaFlutuante  
105 -  
106 - Parametro:  
107 -  
108 - iddiv {String} - id do div que receberá o conteudo HTML da ferramenta  
109 - */  
110 - inicia: function(iddiv){  
111 - i3GEO.janela.comboCabecalhoTemas("i3GEOFlegendaComboCabeca","i3GEOFlegendaComboCabecaSel","legenda","ligados");  
112 - if(i3GEO.temaAtivo === ""){  
113 - $i(iddiv).innerHTML = '<img src="../imagens/opcoes.gif" ><p style="position: relative; top: -35px; width: 180px; font-size: 15px; text-align: left; left: 35px;">Escolha um tema da lista</p>';  
114 - return;  
115 - }  
116 - try{  
117 - $i(iddiv).innerHTML += i3GEOF.legenda.html();  
118 - i3GEO.guias.mostraGuiaFerramenta("i3GEOlegendaguia1","i3GEOlegendaguia");  
119 - //eventos das guias  
120 - $i("i3GEOlegendaguia6").onclick = function()  
121 - {i3GEO.guias.mostraGuiaFerramenta("i3GEOlegendaguia6","i3GEOlegendaguia");};  
122 - $i("i3GEOlegendaguia1").onclick = function(){  
123 - i3GEOF.legenda.mostralegenda();  
124 - i3GEO.guias.mostraGuiaFerramenta("i3GEOlegendaguia1","i3GEOlegendaguia");  
125 - };  
126 - $i("i3GEOlegendaguia2").onclick = function()  
127 - {i3GEO.guias.mostraGuiaFerramenta("i3GEOlegendaguia2","i3GEOlegendaguia");};  
128 - $i("i3GEOlegendaguia3").onclick = function(){  
129 - alert("Para acessar o editor, clique em um símbolo na guia 'Legenda'");  
130 - };  
131 - $i("i3GEOlegendaguia4").onclick = function(){  
132 - i3GEOF.legenda.mostraGrafico();  
133 - };  
134 - $i("i3GEOlegendaguia5").onclick = function(){  
135 - i3GEO.guias.mostraGuiaFerramenta("i3GEOlegendaguia5","i3GEOlegendaguia");  
136 - };  
137 - new YAHOO.widget.Button(  
138 - "i3GEOlegendabotao1",  
139 - {onclick:{fn: i3GEOF.legenda.mudaLegenda}}  
140 - );  
141 - if(navm)  
142 - {$i("i3GEOlegendabotao1-button").style.width = "0px";}  
143 - new YAHOO.widget.Button(  
144 - "i3GEOlegendabotao2",  
145 - {onclick:{fn: i3GEOF.legenda.adicionaClasse}}  
146 - );  
147 - //if(navm)  
148 - //{$i("i3GEOlegendabotao2-button").style.width = "0px";}  
149 -  
150 - new YAHOO.widget.Button(  
151 - "i3GEOlegendabotao3",  
152 - {onclick:{fn: i3GEOF.legenda.adicionaConta},width:"100px"}  
153 - );  
154 - $i("i3GEOlegendabotao3-button").style.width = "200px";  
155 - new YAHOO.widget.Button(  
156 - "i3GEOlegendabotao15",  
157 - {onclick:{fn: i3GEOF.legenda.adicionaOpacidade}}  
158 - );  
159 - $i("i3GEOlegendabotao15-button").style.width = "200px";  
160 - new YAHOO.widget.Button(  
161 - "i3GEOlegendabotaoRamp",  
162 - {onclick:{fn: function(){  
163 - var tabela = $i("i3GEOlegendalegenda");  
164 - var trs = tabela.getElementsByTagName("tr");  
165 - var ncores = trs.length - 1;  
166 - i3GEO.util.abreColourRamp("","listaColourRamp",ncores);  
167 - }}}  
168 - );  
169 - $i("i3GEOlegendabotaoRamp-button").style.width = "200px";  
170 - new YAHOO.widget.Button(  
171 - "i3GEOlegendabotao4",  
172 - {onclick:{fn: i3GEOF.legenda.paleta}}  
173 - );  
174 - new YAHOO.widget.Button(  
175 - "i3GEOlegendabotao5",  
176 - {onclick:{fn: i3GEOF.legenda.simbU}}  
177 - );  
178 - $i("i3GEOlegendabotao5-button").style.width = "200px";  
179 - new YAHOO.widget.Button(  
180 - "i3GEOlegendabotao6",  
181 - {onclick:{fn: i3GEOF.legenda.valorU}}  
182 - );  
183 - $i("i3GEOlegendabotao6-button").style.width = "200px";  
184 - new YAHOO.widget.Button(  
185 - "i3GEOlegendabotao7",  
186 - {onclick:{fn: i3GEOF.legenda.representacao}}  
187 - );  
188 - $i("i3GEOlegendabotao7-button").style.width = "200px";  
189 - new YAHOO.widget.Button(  
190 - "i3GEOlegendabotao8",  
191 - {onclick:{fn: i3GEOF.legenda.valorC}}  
192 - );  
193 - $i("i3GEOlegendabotao8-button").style.width = "200px";  
194 - new YAHOO.widget.Button(  
195 - "i3GEOlegendabotao9",  
196 - {onclick:{fn: i3GEOF.legenda.valorQ}}  
197 - );  
198 - $i("i3GEOlegendabotao9-button").style.width = "200px";  
199 -  
200 - new YAHOO.widget.Button(  
201 - "i3GEOlegendabotao10",  
202 - {onclick:{fn: i3GEOF.legenda.aplicaEstilo}}  
203 - );  
204 - if(navm)  
205 - {$i("i3GEOlegendabotao10-button").style.width = "0px";}  
206 - new YAHOO.widget.Button(  
207 - "i3GEOlegendabotao17",  
208 - {onclick:{fn: i3GEOF.legenda.alteraGeometriaTema}}  
209 - );  
210 - $i("i3GEOlegendabotao17-button").style.width = "200px";  
211 - new YAHOO.widget.Button(  
212 - "i3GEOlegendabotaoSLDe",  
213 - {onclick:{fn: function(){window.open(i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?funcao=tema2sld&tema="+i3GEOF.legenda.tema+"&g_sid="+i3GEO.configura.sid);}}}  
214 - );  
215 - $i("i3GEOlegendabotaoSLDe-button").style.width = "200px";  
216 - new YAHOO.widget.Button(  
217 - "i3GEOlegendabotaoSLDi",  
218 - {onclick:{fn: function(){i3GEO.tema.dialogo.aplicarsld(i3GEOF.legenda.tema);}}}  
219 - );  
220 - $i("i3GEOlegendabotaoSLDi-button").style.width = "200px";  
221 - new YAHOO.widget.Button(  
222 - "i3GEOlegendabotaoIncluirLabel",  
223 - {onclick:{fn: function(){  
224 - var par,p,temp;  
225 - try{  
226 - par = i3GEOF.proplabel.pegaPar();  
227 - i3GEOF.legenda.parDefault = par;  
228 - }  
229 - catch(e){  
230 - par = i3GEOF.legenda.parDefault;  
231 - }  
232 - i3GEOF.legenda.aguarde.visibility = "visible";  
233 - temp = function(){  
234 - i3GEOF.legenda.aguarde.visibility = "hidden";  
235 - i3GEOF.legenda.aposAlterarLegenda();  
236 - i3GEOF.legenda.aguarde.visibility = "hidden";  
237 - };  
238 - p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=adicionaLabelClasse&tema="+i3GEOF.legenda.tema+"&classe="+i3GEOF.legenda.classe+par;  
239 - p += "&item="+$i("i3GEOlegendaSelItemLabel").value;  
240 - cp = new cpaint();  
241 - cp.set_response_type("JSON");  
242 - cp.call(p,"foo",temp);  
243 - }}}  
244 - );  
245 - new YAHOO.widget.Button(  
246 - "i3GEOlegendabotaoExcluirLabel",  
247 - {onclick:{fn: function(){  
248 - var p,temp;  
249 - i3GEOF.legenda.aguarde.visibility = "visible";  
250 - temp = function(){  
251 - i3GEOF.legenda.aguarde.visibility = "hidden";  
252 - i3GEOF.legenda.aposAlterarLegenda();  
253 - i3GEOF.legenda.aguarde.visibility = "hidden";  
254 - };  
255 - p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=removeLabelClasse&tema="+i3GEOF.legenda.tema+"&classe="+i3GEOF.legenda.classe;  
256 - cp = new cpaint();  
257 - cp.set_response_type("JSON");  
258 - cp.call(p,"foo",temp);  
259 - }}}  
260 - );  
261 - new YAHOO.widget.Button(  
262 - "i3GEOlegendabotaoPropriedadeLabel",  
263 - {onclick:{fn: function(){  
264 - i3GEO.util.scriptTag(  
265 - i3GEO.configura.locaplic+"/ferramentas/opcoes_label/index.js",  
266 - "i3GEOF.proplabel.criaJanelaFlutuante(false)",  
267 - "i3GEOFproplabel",  
268 - false  
269 - );  
270 - }}}  
271 - );  
272 - i3GEOF.legenda.ativaFoco();  
273 - i3GEOF.legenda.mostralegenda();  
274 - i3GEO.util.comboItens(  
275 - "i3GEOlegendaSelItem",  
276 - i3GEOF.legenda.tema,  
277 - function(retorno){  
278 - if($i("i3GEOlegendaitens"))  
279 - {$i("i3GEOlegendaitens").innerHTML = retorno.dados;}  
280 - },  
281 - "i3GEOlegendaitens"  
282 - );  
283 - if(i3GEO.arvoreDeCamadas.pegaTema(i3GEOF.legenda.tema).classe && i3GEO.arvoreDeCamadas.pegaTema(i3GEOF.legenda.tema).classe.toLowerCase() == "nao")  
284 - {$i("i3GEOFlegendamostra").checked = false;}  
285 - $i("i3GEOFlegendamostra").onclick = function(){i3GEO.tema.invertestatuslegenda(i3GEOF.legenda.tema);};  
286 - }  
287 - catch(erro){alert(erro);}  
288 - },  
289 - /*  
290 - Function: html  
291 -  
292 - Gera o código html para apresentação das opções da ferramenta  
293 -  
294 - Retorno:  
295 -  
296 - String com o código html  
297 - */  
298 - html:function(){  
299 - var ins = '' +  
300 - '<div id=guiasYUI class="yui-navset" style="top:0px;cursor:pointer;left:0px;">'+  
301 - ' <ul class="yui-nav" style="border-width:0pt 0pt 0px;border-color:rgb(240,240,240);border-bottom-color:white;">'+  
302 - ' <li><a href="#ancora"><em><div id="i3GEOlegendaguia6" style="text-align:center;left:0px;" ><img class="ticPropriedades2" style="height:14px" title="Propriedades" src="'+i3GEO.configura.locaplic+'/imagens/visual/default/branco.gif"></div></em></a></li>'+  
303 - ' <li><a href="#ancora"><em><div id="i3GEOlegendaguia1" style="text-align:center;left:0px;" >Legenda</div></em></a></li>'+  
304 - ' <li><a href="#ancora"><em><div id="i3GEOlegendaguia2" style="text-align:center;left:0px;" >Classes</div></em></a></li>'+  
305 - ' <li><a href="#ancora"><em><div id="i3GEOlegendaguia3" style="text-align:center;left:0px;" >Editor</div></em></a></li>'+  
306 - ' <li><a href="#ancora"><em><div id="i3GEOlegendaguia4" style="text-align:center;left:0px;" >Gr&aacute;ficos</div></em></a></li>'+  
307 - ' <li><a href="#ancora"><em><div id="i3GEOlegendaguia5" style="text-align:center;left:0px;" >Importar/exportar SLD</div></em></a></li>'+  
308 - ' </ul>'+  
309 - '</div><br>'+  
310 - '<div id=i3GEOlegendaguia6obj style="width:99%;text-align:left;">'+  
311 - ' <p class=paragrafo >&nbsp;<input type=checkbox onclick="" checked id=i3GEOFlegendamostra style="cursor:pointer;border:0px solid white;" /> <span style="cursor:pointer;position:relative;top:-2px;">Mostra as classes desse tema na legenda do mapa</span></p>' +  
312 - ' <p class=paragrafo ><input id=i3GEOlegendabotao3 type="button" value="Inclui número de ocorrências" title="incluir o número de ocorrências no nome de cada classe"></p>' +  
313 - ' <p class=paragrafo ><input id=i3GEOlegendabotao15 type="button" value="Aplica opacidade variável" title="aplicar opacidade nas classes existente, variando de 10 até 100"></p>' +  
314 - ' <p class=paragrafo ><input id=i3GEOlegendabotaoRamp type="button" size=15 value="Escolher paleta de cores" title="escolher e aplicar as variações de cores, entre dois extremos, nas classes existentes"></p>' +  
315 - ' <p class=paragrafo >Gerar cores</p>' +  
316 - ' <table summary="" class=lista5 >' +  
317 - ' <tr>' +  
318 - ' <td>de:</td>' +  
319 - ' <td>' +  
320 - $inputText("","","i3GEOlegendaacori","",12,"0,0,0") +  
321 - ' </td>' +  
322 - ' <td><img alt="aquarela.gif" style=cursor:pointer src="'+i3GEO.configura.locaplic+'/imagens/aquarela.gif" onclick="i3GEOF.legenda.corj(\'i3GEOlegendaacori\')" /> ' +  
323 - ' </td>' +  
324 - ' <td>at&eacute;:</td>' +  
325 - ' <td>'+  
326 - $inputText("","","i3GEOlegendaacorf","",12,"255,255,255") +  
327 - ' </td>' +  
328 - ' <td><img alt="aquarela.gif" style=cursor:pointer src="'+i3GEO.configura.locaplic+'/imagens/aquarela.gif" onclick="i3GEOF.legenda.corj(\'i3GEOlegendaacorf\')" /> ' +  
329 - ' </td>' +  
330 - ' <td><input id=i3GEOlegendabotao4 type="button" size=15 value="Aplicar" title="aplicar variações de cores, entre dois extremos, nas classes existentes"></td>' +  
331 - ' </tr>' +  
332 - ' </table>' +  
333 - '</div>' +  
334 - '<div id=i3GEOlegendaguia1obj style="width:99%;text-align:left;">'+  
335 - ' <table summary="" class=lista5 ><tr>' +  
336 - ' <td><input id=i3GEOlegendabotao1 size="22" type="button" value="Aplicar alterações" ></td>'+  
337 - ' <td><input id=i3GEOlegendabotao2 size="22" type="button" value="Adicionar classe" title="adicionar uma nova classe na legenda" ></td>' +  
338 - ' </tr></table><br>' +  
339 - ' <p class=paragrafo >Clique no símbolo da classe para alterar</p>' +  
340 - ' <div id="i3GEOlegendaresultado" style="text-align:left;width:100%;display:block;left:0px">' +  
341 - ' </div>'+  
342 - '</div>'+  
343 - '<div id=i3GEOlegendaguia2obj style="width:99%;text-align:left;">'+  
344 - ' <p class=paragrafo >&nbsp;<input type=checkbox onclick="" checked id=i3GEOFlegendaaplicaextent style="cursor:pointer;border:0px solid white;" /> <span style="cursor:pointer;position:relative;top:-2px;">marque para considerar apenas os elementos visíveis na extensão geográfica atual, caso contrário, será considerada a extensão geográfica inicial do mapa</span></p>' +  
345 - ' <p class=paragrafo >Ao gerar as classes, ignorar os valores (separe com vírgula):<br>'+  
346 - $inputText("","","i3GEOlegendaignorar","",20,"") +  
347 - ' <hr><p class=paragrafo >Transforma a representação geométrica dos elementos do tema. Após alterar esse parâmetro, pode ser necessário modificar as características do símbolo.</p>'+  
348 - ' <p class=paragrafo >' +  
349 - ' <select id=i3GEOlegentaTipoGeo >'+  
350 - ' <option value="">nenhuma transformação</option>'+  
351 - ' <option value="centroid">centróide</option>'+  
352 - ' <option value="bbox">box</option>'+  
353 - ' <option value="vertices">vértices</option>'+  
354 - ' <option value="start">vértice inicial</option>'+  
355 - ' <option value="end">vértice final</option>'+  
356 - ' </select>'+  
357 - ' <p class=paragrafo >' +  
358 - ' <input id=i3GEOlegendabotao17 size="35" type="button" value="Altera geometria"></p>'+  
359 - ' <hr><p class=paragrafo >Altera o tipo de representação do tema. Se for poligonal, passa para linear e vice-versa.</p>'+  
360 - ' <p class=paragrafo ><input id=i3GEOlegendabotao7 size="25" type="button" value="Altera tipo"></p>'+  
361 - ' <hr><p class=paragrafo >Todos os elementos serão desenhados com um único símbolo</p>'+  
362 - ' <p class=paragrafo ><input id=i3GEOlegendabotao5 size="25" type="button" value="Símbolo único"></p>'+  
363 - ' <hr><p class=paragrafo >Cada ocorrência de um valor para o item selecionado, será desenhado com o mesmo símbolo</p>'+  
364 - ' <div id="i3GEOlegendaitens" style="text-align:left;" ></div><br>'+  
365 - ' <p class=paragrafo ><input id=i3GEOlegendabotao6 size="25" type="button" value="Valor único"></p>'+  
366 - ' <hr><p class=paragrafo >Cria classes para um item numérico utilizando um número fixo de classes (o item utilizado é o mesmo indicado acima)</p>'+  
367 - ' <p class=paragrafo >Número de classes:'+  
368 - $inputText("","","i3GEOlegendanclasses","",3,"5") +  
369 - ' <p class=paragrafo ><input id=i3GEOlegendabotao8 size="25" type="button" value="Intervalos iguais">'+  
370 - ' <hr><p class=paragrafo >Cria classes para um item numérico utilizando os quartis (o item utilizado é o mesmo indicado acima)</p>'+  
371 - ' <p class=paragrafo ><input id=i3GEOlegendabotao9 size="25" type="button" value="Quartis">'+  
372 - ' <p class=paragrafo >Estilo dos nomes das classes: ' +  
373 - ' <select id=estiloClassesQuartis >' +  
374 - ' <option value=minimo select >só os valores</option>' +  
375 - ' <option value=simples select >quartil e os valores</option>' +  
376 - ' <option value=completo select >expressão completa</option>' +  
377 - ' </select></p>' +  
378 - '</div>'+  
379 - '<div id=i3GEOlegendaguia3obj style="width:99%;text-align:left;">'+  
380 - ' <fieldset style="padding:5px;margin:2px;">'+  
381 - ' <legend>Etiquetas da classe (labels)</legend>'+  
382 - ' <p class=paragrafo >Item com o texto: <span id=i3GEOlegendaitensLabel ></span></p>' +  
383 - ' <p class=paragrafo style="font-size:10px;">'+  
384 - ' <input id=i3GEOlegendabotaoExcluirLabel size=10 type=buttom value="excluir" />' +  
385 - ' <input id=i3GEOlegendabotaoIncluirLabel size=10 type=buttom value="adicionar" />' +  
386 - ' <input id=i3GEOlegendabotaoPropriedadeLabel size=10 type=buttom value="propriedades" />' +  
387 - ' </p>' +  
388 - ' </fieldset><br>'+  
389 - ' <fieldset style="padding:5px;margin:2px;">'+  
390 - ' <legend>Estilos</legend>'+  
391 - ' <p class=paragrafo style="font-size:10px;">Cada símbolo pode ser formado por um ou mais estilos. Utilize -1,-1,-1 para anular uma cor. A cor deve ser definida no formato vermelho,verde,azul. Para criar linhas tracejadas utilize o símbolo 0 ou vazio e digite um padrão de repetição como por exemplo 2 10 2 10 <br></p>'+  
392 - ' <div id="i3GEOlegendacomboestilos" style="position:relative;top:0px;left:0px;text-align:left">'+  
393 - ' </div>'+  
394 - ' <br><p class=paragrafo style="font-size:10px" ><input id=i3GEOlegendabotao10 size="35" type="button" value="Aplicar as altera&ccedil;&otilde;es"></p>'+  
395 - ' <div style="position:relative;top:0px;left:0px;text-align:left;" id="i3GEOlegendamostraEstilo">'+  
396 - ' </div>'+  
397 - ' <div style="position:relative;top:0px;left:0px;text-align:left;" id="i3GEOlegendasimbolos">'+  
398 - ' </div>'+  
399 - ' </fieldset>'+  
400 - '</div>'+  
401 - '<div id=i3GEOlegendaguia4obj style="width:99%;text-align:left;">'+  
402 - '</div>'+  
403 - '<div id=i3GEOlegendaguia5obj style="width:99%;text-align:left;">'+  
404 - ' <p class=paragrafo >Gera um arquivo XML, no padrão SLD, contendo a legenda atual da camada. Para maiores informações, veja <a href="http://mapserver.org/ogc/sld.html#sld" target=_blank >Mapserver SLD</a> (O SLD só é gerado ou aplicado corretamente em camadas que utilizam expressões simples e o elemento CLASSITEM)'+  
405 - ' <p class=paragrafo ><input id=i3GEOlegendabotaoSLDe size="25" type="button" value="Exportar SLD"></p>'+  
406 - ' <p class=paragrafo >Aplica um arquivo SLD à camada ativa' +  
407 - ' <p class=paragrafo ><input id=i3GEOlegendabotaoSLDi size="25" type="button" value="Aplicar SLD"></p>'+  
408 - '</div>' +  
409 - '<input type=hidden value="" id="listaColourRamp" onchange="javascript:i3GEOF.legenda.aplicaColourRamp()" />'; //utilizado pelo seletor de colourramp  
410 - return ins;  
411 - },  
412 - /*  
413 - Function: criaJanelaFlutuante  
414 -  
415 - Cria a janela flutuante para controle da ferramenta.  
416 - */  
417 - criaJanelaFlutuante: function(){  
418 - var minimiza,cabecalho,janela,divid,temp,titulo,cabecalho,minimiza;  
419 - if($i("i3GEOF.legenda")){  
420 - i3GEOF.legenda.tema = i3GEO.temaAtivo;  
421 - i3GEOF.legenda.inicia("i3GEOF.legenda_corpo");  
422 - return;  
423 - }  
424 - cabecalho = function(){  
425 - i3GEOF.legenda.ativaFoco();  
426 - };  
427 - minimiza = function(){  
428 - i3GEO.janela.minimiza("i3GEOF.legenda");  
429 - };  
430 - //cria a janela flutuante  
431 - titulo = "<div style='z-index:1;position:absolute' id='i3GEOFlegendaComboCabeca' >------</div>&nbsp;&nbsp;&nbsp;Editor de legenda <a class=ajuda_usuario target=_blank href='" + i3GEO.configura.locaplic + "/ajuda_usuario.php?idcategoria=5&idajuda=41' >&nbsp;&nbsp;&nbsp;</a>";  
432 - janela = i3GEO.janela.cria(  
433 - "490px",  
434 - "340px",  
435 - "",  
436 - "",  
437 - "",  
438 - titulo,  
439 - "i3GEOF.legenda",  
440 - false,  
441 - "hd",  
442 - cabecalho,  
443 - minimiza  
444 - );  
445 - divid = janela[2].id;  
446 - i3GEOF.legenda.aguarde = $i("i3GEOF.legenda_imagemCabecalho").style;  
447 - $i("i3GEOF.legenda_corpo").style.backgroundColor = "white";  
448 - i3GEOF.legenda.inicia(divid);  
449 - temp = function(){  
450 - if(i3GEO.eventos.ATUALIZAARVORECAMADAS.toString().search('i3GEO.janela.comboCabecalhoTemas("i3GEOFlegendaComboCabeca","i3GEOFlegendaComboCabecaSel","legenda","ligados")') > 0)  
451 - {i3GEO.eventos.ATUALIZAARVORECAMADAS.remove('i3GEO.janela.comboCabecalhoTemas("i3GEOFlegendaComboCabeca","i3GEOFlegendaComboCabecaSel","legenda","ligados")');}  
452 - };  
453 - YAHOO.util.Event.addListener(janela[0].close, "click", temp);  
454 - },  
455 - /*  
456 - Function: ativaFoco  
457 -  
458 - Refaz a interface da ferramenta quando a janela flutuante tem seu foco ativado  
459 - */  
460 - ativaFoco: function(){  
461 - if(i3GEOF.legenda.tema !== "" && i3GEO.arvoreDeCamadas.pegaTema(i3GEOF.legenda.tema) === "")  
462 - {alert("O tema ja nao existe mais no mapa");}  
463 - var i = $i("i3GEOF.legenda_c").style;  
464 - i.zIndex = i3GEO.janela.ULTIMOZINDEX;  
465 - i3GEO.janela.ULTIMOZINDEX++;  
466 - },  
467 - /*  
468 - Function: aposAlterarLegenda  
469 -  
470 - Função executada após ocorrer alguma alteração efetiva da legenda do mapa  
471 - */  
472 - aposAlterarLegenda: function(){  
473 - i3GEO.atualiza();  
474 - i3GEO.Interface.atualizaTema("",i3GEOF.legenda.tema);  
475 - i3GEO.arvoreDeCamadas.atualizaLegenda(i3GEOF.legenda.tema);  
476 - i3GEO.mapa.legendaHTML.atualiza();  
477 - },  
478 - /*  
479 - Function: mostralegenda  
480 -  
481 - Pega os dados da legenda do mapa atual e mostra na tela  
482 -  
483 - Veja:  
484 -  
485 - <EDITALEGENDA>  
486 - */  
487 - mostralegenda: function(){  
488 - if(i3GEOF.legenda.aguarde.visibility === "visible")  
489 - {return;}  
490 - i3GEOF.legenda.aguarde.visibility = "visible";  
491 - var p,cp;  
492 - p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=editalegenda&opcao=edita&tema="+i3GEOF.legenda.tema;  
493 - cp = new cpaint();  
494 - cp.set_response_type("JSON");  
495 - cp.call(p,"tabelaLegenda",i3GEOF.legenda.montaLegenda);  
496 - },  
497 - /*  
498 - Function: montaLegenda  
499 -  
500 - Formata a tabela de edição da legenda  
501 -  
502 - Parametro:  
503 -  
504 - retorno - objeto contendo os dados para formatação da legenda  
505 - */  
506 - montaLegenda: function(retorno){  
507 - i3GEOF.legenda.aviso = false;  
508 - try{  
509 - if (retorno.data != undefined){  
510 - var ins = [],  
511 - i,  
512 - ajuda,  
513 - id,  
514 - re,  
515 - exp,  
516 - n;  
517 - if (retorno.data[0].proc === ""){  
518 - ins.push("<table class=lista4 id=i3GEOlegendalegenda ><tr><td><img src='"+i3GEO.configura.locaplic+"/imagens/inverter.png' title='Inverter cores' onclick='i3GEOF.legenda.inverteCores()' style=cursor:pointer /></td><td style=background-color:white ><img src='"+i3GEO.configura.locaplic+"/imagens/tamanho.png' title='Calcula tamanho' onclick='i3GEOF.legenda.calculaTamanho()' style=cursor:pointer /></td><td style=background-color:yellow ></td><td style=background-color:yellow >nome</td><td style=background-color:yellow >express&atilde;o</td></tr>");  
519 - n = retorno.data.length;  
520 - for (i=0;i<n;i++){  
521 - id = retorno.data[i].tema+"-"+retorno.data[i].idclasse; //layer+indice da classe  
522 - re = new RegExp("'", "g");  
523 - exp = (retorno.data[i].expressao).replace(re,'"');  
524 - ins.push("<tr><td><img style='cursor:pointer' title='clique para excluir' onclick='i3GEOF.legenda.excluilinhaf(this)' src='" + i3GEO.configura.locaplic + "/imagens/x.gif' title='excluir' /></td><td><img width='30px' height='15px' style='cursor:pointer' title='clique para alterar' src='"+retorno.data[i].imagem+"' onclick=i3GEOF.legenda.editaSimbolo('i3GEOlegendaid_"+id+"') /></td>");  
525 - ins.push("<td><img onclick=i3GEOF.legenda.modificaCor('"+retorno.data[i].idclasse+"') title='alterar a cor' style='cursor:pointer' src='" + i3GEO.configura.locaplic + "/imagens/aquarela.gif' /></td>");  
526 - ins.push("<td>");  
527 - ins.push($inputText("","","i3GEOlegendaid_"+id,"digite o novo nome",20,retorno.data[i].nomeclasse,"nome","javascript:i3GEOF.legenda.aviso()"));  
528 - ins.push("</td><td>");  
529 - ins.push($inputText("","","i3GEOlegendaid_"+id,"digite a nova express&atilde;o",30,exp,"expressao","javascript:i3GEOF.legenda.aviso()"));  
530 - ins.push("</td>");  
531 - if(n>1){  
532 - ins.push("<td><img src='"+i3GEO.configura.locaplic+"/imagens/sobe1.png' style=cursor:pointer title='sobe' onclick=i3GEOF.legenda.sobelinhaf('"+retorno.data[i].idclasse+"') /></td>");  
533 - ins.push("<td><img src='"+i3GEO.configura.locaplic+"/imagens/desce1.png' style=cursor:pointer title='desce' onclick=i3GEOF.legenda.descelinhaf('"+retorno.data[i].idclasse+"') /></td>");  
534 - }  
535 - ins.push("</tr>");  
536 - }  
537 - ins.push("</table><br>");  
538 - $i("i3GEOlegendaresultado").innerHTML = ins.join("");  
539 - }  
540 - else{  
541 - ajuda = "<br><p class=paragrafo >Para aplicar um ajuste entre 0 e 255 cores, utilize a opção 'Escala de Cores'." +  
542 - "<p class=paragrafo >O valor de SCALE= pode ser a palavra AUTO (SCALE=AUTO) ou um valor m&iacute;nimo e m&aacute;ximo (por exemplo SCALE=20,3000)." +  
543 - "<p class=paragrafo >Voc&ecirc; pode aplicar a escala em bandas individuais, para isso, utilize SCALE_n, por exemplo SCALE_1=AUTO SCALE_2=200,500." +  
544 - "<p class=paragrafo >Para escolher quais bandas ser&atilde;o utilizadas e qual sua ordem, utilize a op&ccedil;&atilde;o BANDAS." +  
545 - "Utilize, por exemplo, BANDS=1,2,3 BANDS=1 ." +  
546 - "<p class=paragrafo >Para alterar o modo de amostragem, utilize RESAMPLE com uma das opções: AVERAGE,NEAREST ou BILINEAR.";  
547 - ins = "<p class=paragrafo >Voc&ecirc; pode incluir processos na imagem para modificar as caracter&iacute;sticas de visualiza&ccedil;&atilde;o<br><br>Adicionar processo:" +  
548 - "<select onchange=i3GEOF.legenda.adicionaProcesso(this) >" +  
549 - "<option value='' >selecione o processo</option>" +  
550 - "<option value='SCALE=' >Escala de cores</option>" +  
551 - "<option value='RESAMPLE=' >Reamostragem</option>" +  
552 - "<option value='BANDS=' >Bandas</option>" +  
553 - "<option value='COLOR_MATCH_THRESHOLD=' >Threshold</option>" +  
554 - "<option value='NODATA=' >Nodata</option>" +  
555 - "</select><br>" +  
556 - '<p class=paragrafo ><input id=i3GEOlegendabotao16 class="executar" size="22" type="buttom" value="aplicar processos">';  
557 - if(retorno.data[0].proc == "")  
558 - {ins += "<div style=width:80% id=i3GEOlegendaprocessos ></div>";}  
559 - else{  
560 - ins += "<div style='width:80%;text-align:left;' id=i3GEOlegendaprocessos >";  
561 - for (i=0;i<retorno.data[0].proc.length;i++){  
562 - ins += "<br>"+$inputText("","","","",50,retorno.data[0].proc[i]);  
563 - }  
564 - ins += "</div>";  
565 - }  
566 - $i("i3GEOlegendaresultado").innerHTML = ins+ajuda;  
567 - new YAHOO.widget.Button(  
568 - "i3GEOlegendabotao16",  
569 - {onclick:{fn: i3GEOF.legenda.aplicaProcessos}}  
570 - );  
571 - }  
572 - }  
573 - else  
574 - {$i("i3GEOlegendaresultado").innerHTML = "<p style=color:red >Ocorreu um erro<br>";}  
575 - i3GEOF.legenda.aguarde.visibility = "hidden";  
576 - }  
577 - catch(e){alert("Não é possível editar a legenda desse tema");i3GEOF.legenda.aguarde.visibility = "hidden";}  
578 - },  
579 - /*  
580 - Function: aviso  
581 -  
582 - Mostra um alerta ao usuário quando um campo da tabela que contém os dados da legenda é alterado  
583 -  
584 - O aviso é mostrado apenas uma vez  
585 - */  
586 - aviso: function(){  
587 - if(i3GEOF.legenda.aviso == true){  
588 - alert("Clique em 'Aplicar' para que as alteraçõpes sejam salvas");  
589 - i3GEOF.legenda.aviso == false;  
590 - }  
591 - },  
592 - /*  
593 - Function: aplicaColourRamp  
594 -  
595 - Aplica às classes da legenda as cores escolhidas no seletor de cores  
596 - */  
597 - aplicaColourRamp: function(){  
598 - if($i("listaColourRamp").value != ""){  
599 - if(i3GEOF.legenda.aguarde.visibility === "visible")  
600 - {return;}  
601 - i3GEOF.legenda.aguarde.visibility = "visible";  
602 - var cores = $i("listaColourRamp").value;  
603 - temp = function(){  
604 - i3GEOF.legenda.aguarde.visibility = "hidden";  
605 - i3GEOF.legenda.mostralegenda();  
606 - i3GEOF.legenda.aposAlterarLegenda();  
607 - };  
608 - p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=alteraclasse&opcao=aplicacoresrgb&ext="+i3GEO.parametros.mapexten+"&tema="+i3GEOF.legenda.tema;  
609 - cp = new cpaint();  
610 - cp.set_transfer_mode('POST');  
611 - cp.set_response_type("JSON");  
612 - cp.call(p,"foo",temp,"cores="+cores);  
613 - }  
614 - },  
615 - /*  
616 - Function: corj  
617 -  
618 - Abre a janela para o usuário selecionar uma cor interativamente  
619 - */  
620 - corj: function(obj)  
621 - {i3GEO.util.abreCor("",obj);},  
622 - /*  
623 - Function: modificaCor  
624 -  
625 - Modifica a cor de uma classe  
626 - */  
627 - modificaCor: function(id){  
628 - var obj = $i("tempCorLegenda");  
629 - if(!obj){  
630 - var obj = document.createElement("input");  
631 - obj.id = "tempCorLegenda";  
632 - obj.style.display = "none";  
633 - obj.type = "text";  
634 - obj.value = "";  
635 - document.body.appendChild(obj);  
636 - obj.onchange = function(){  
637 - i3GEOF.legenda.aplicaNovaCor($i("tempCorLegenda").name);  
638 - };  
639 - }  
640 - obj.name = id;  
641 - i3GEO.util.abreCor("","tempCorLegenda");  
642 - },  
643 - aplicaNovaCor: function(id){  
644 - if(i3GEOF.legenda.aguarde.visibility === "visible")  
645 - {return;}  
646 - i3GEOF.legenda.aguarde.visibility = "visible";  
647 - var retorna = function(){  
648 - i3GEOF.legenda.aposAlterarLegenda();  
649 - i3GEOF.legenda.aguarde.visibility = "hidden";  
650 - i3GEOF.legenda.mostralegenda();  
651 - };  
652 - i3GEO.php.aplicaCorClasseTema(retorna,i3GEOF.legenda.tema,id,$i("tempCorLegenda").value);  
653 - },  
654 - /*  
655 - Function: mudaLegenda  
656 -  
657 - Altera a legenda conforme os valores existentes na tabela de propriedades (expressão e nome da classe)  
658 -  
659 - Veja:  
660 -  
661 - <ALTERACLASSE>  
662 - */  
663 - mudaLegenda: function(){  
664 - i3GEOF.legenda.aviso = false;  
665 - if(i3GEOF.legenda.aguarde.visibility === "visible")  
666 - {return;}  
667 - i3GEOF.legenda.aguarde.visibility = "visible";  
668 - try{  
669 - var tabela = $i("i3GEOlegendalegenda"),  
670 - trs = tabela.getElementsByTagName("tr"),  
671 - nomes = [],  
672 - exps = [],  
673 - ids = [],  
674 - t,  
675 - nn,  
676 - n,  
677 - p,  
678 - cp,  
679 - temp,  
680 - expn,  
681 - re = new RegExp('"', "g");;  
682 - for (t=0;t<trs.length;t++){  
683 - if(trs[t].childNodes){  
684 - nn = trs[t].childNodes;  
685 - for (n=0;n<nn.length;n++){  
686 - if(nn[n].childNodes){  
687 - var isn = nn[n].getElementsByTagName("input")  
688 - if (isn[0] != undefined){  
689 - if(isn[0].name == "nome"){  
690 - nomes.push(isn[0].value);  
691 - temp = (isn[0].id).split("i3GEOlegendaid_");  
692 - ids.push(temp[1]);  
693 - }  
694 - if(isn[0].name == "expressao"){  
695 - expn = (isn[0].value).replace(re,'##');  
696 - exps.push(expn);  
697 - }  
698 - }  
699 - }  
700 - }  
701 - }  
702 - }  
703 - ids = ids.join(";");  
704 - nomes = nomes.join(";");  
705 - exps = exps.join(";");  
706 - temp = function(){  
707 - i3GEOF.legenda.aguarde.visibility = "hidden";  
708 - i3GEOF.legenda.mostralegenda();  
709 - i3GEOF.legenda.aposAlterarLegenda();  
710 - i3GEOF.legenda.aguarde.visibility = "hidden";  
711 - };  
712 - p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=alteraclasse&opcao=alteraclasses&ext="+i3GEO.parametros.mapexten;  
713 - cp = new cpaint();  
714 - cp.set_transfer_mode('POST');  
715 - cp.set_response_type("JSON");  
716 - cp.call(p,"alteraclassesPost",temp,"ids="+ids+"&nomes="+nomes+"&exps="+exps);  
717 - }  
718 - catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}  
719 - },  
720 - /*  
721 - Function: alteraGeometria  
722 -  
723 - Altera o tipo de representação geométrica dos elementos de um layer  
724 -  
725 - Veja:  
726 -  
727 - <ALTERACLASSE>  
728 - */  
729 - alteraGeometriaTema: function(){  
730 - if(i3GEOF.legenda.aguarde.visibility === "visible")  
731 - {return;}  
732 - i3GEOF.legenda.aguarde.visibility = "visible";  
733 - var retorna = function(){  
734 - i3GEOF.legenda.aposAlterarLegenda();  
735 - i3GEOF.legenda.aguarde.visibility = "hidden";  
736 - i3GEOF.legenda.mostralegenda();  
737 - };  
738 - var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=alteraclasse&opcao=alterageometria&tema="+i3GEOF.legenda.tema+"&tipo="+$i("i3GEOlegentaTipoGeo").value,  
739 - cp = new cpaint();  
740 - cp.set_response_type("JSON");  
741 - cp.call(p,"",retorna);  
742 - },  
743 - /*  
744 - Function: adicionaConta  
745 -  
746 - Adiciona ao nome de cada classe o número de ocorrências em cada uma  
747 -  
748 - Veja:  
749 -  
750 - <CONTAGEMCLASSE>  
751 - */  
752 - adicionaConta: function(){  
753 - if(i3GEOF.legenda.aguarde.visibility === "visible")  
754 - {return;}  
755 - i3GEOF.legenda.aguarde.visibility = "visible";  
756 - var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=contagemclasse"+"&tema="+i3GEOF.legenda.tema,  
757 - cp = new cpaint();  
758 - cp.set_response_type("JSON");  
759 - cp.call(p,"contagemclasse",i3GEOF.legenda.montaLegenda);  
760 - alert("A contagem considera apenas os elementos visíveis na abrangência do mapa");  
761 - },  
762 - /*  
763 - Function: adicionaClasse  
764 -  
765 - Adiciona uma nova classe ao tema  
766 -  
767 - Veja:  
768 -  
769 - <ALTERACLASSE>  
770 - */  
771 - adicionaClasse: function(){  
772 - if(i3GEOF.legenda.aguarde.visibility === "visible")  
773 - {return;}  
774 - var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=alteraclasse&opcao=adicionaclasse"+"&tema="+i3GEOF.legenda.tema+"&ext="+i3GEO.parametros.mapexten,  
775 - cp = new cpaint();  
776 - cp.set_response_type("JSON");  
777 - cp.call(p,"alteraclasse",i3GEOF.legenda.mostralegenda);  
778 - },  
779 - /*  
780 - Function: adicionaOpacidade  
781 -  
782 - Adiciona opacidade variável em cada classe  
783 -  
784 - Veja:  
785 -  
786 - <ALTERACLASSE>  
787 - */  
788 - adicionaOpacidade: function(){  
789 - var retorna = function(){  
790 - i3GEOF.legenda.aposAlterarLegenda();  
791 - i3GEOF.legenda.aguarde.visibility = "hidden";  
792 - i3GEOF.legenda.mostralegenda();  
793 - };  
794 - if(i3GEOF.legenda.aguarde.visibility === "visible")  
795 - {return;}  
796 - var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=alteraclasse&opcao=adicionaopacidade"+"&tema="+i3GEOF.legenda.tema+"&ext="+i3GEO.parametros.mapexten,  
797 - cp = new cpaint();  
798 - cp.set_response_type("JSON");  
799 - cp.call(p,"alteraclasse",retorna);  
800 - },  
801 - /*  
802 - Function: paleta  
803 -  
804 - Gera as cores para as classes considerando um RGB inicial e um final  
805 -  
806 - Veja:  
807 -  
808 - <ALTERACORESCLASSES>  
809 - */  
810 - paleta: function(){  
811 - try{  
812 - if(i3GEOF.legenda.aguarde.visibility === "visible")  
813 - {return;}  
814 - i3GEOF.legenda.aguarde.visibility = "visible";  
815 - var retornapaleta = function(){  
816 - i3GEOF.legenda.aposAlterarLegenda();  
817 - i3GEOF.legenda.aguarde.visibility = "hidden";  
818 - i3GEOF.legenda.mostralegenda();  
819 - },  
820 - ci = $i("i3GEOlegendaacori").value,  
821 - cf = $i("i3GEOlegendaacorf").value,  
822 - cp = new cpaint(),  
823 - p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=alteraCoresClasses&tema="+i3GEOF.legenda.tema+"&cori="+ci+"&corf="+cf;  
824 - cp.set_response_type("JSON");  
825 - cp.call(p,"alteraCoresClasses",retornapaleta);  
826 - }  
827 - catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}  
828 - },  
829 - /*  
830 - Function: inverteCores  
831 -  
832 - Inverte as cores utilizadas nos símbolos das classes  
833 -  
834 - Veja:  
835 -  
836 - <INVERTECORESCLASSES>  
837 - */  
838 - inverteCores: function(){  
839 - try{  
840 - if(i3GEOF.legenda.aguarde.visibility === "visible")  
841 - {return;}  
842 - i3GEOF.legenda.aguarde.visibility = "visible";  
843 - var retornapaleta = function(){  
844 - i3GEOF.legenda.aposAlterarLegenda();  
845 - i3GEOF.legenda.aguarde.visibility = "hidden";  
846 - i3GEOF.legenda.mostralegenda();  
847 - },  
848 - cp = new cpaint(),  
849 - p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=inverteCoresClasses&tema="+i3GEOF.legenda.tema;  
850 - cp.set_response_type("JSON");  
851 - cp.call(p,"alteraCoresClasses",retornapaleta);  
852 - }  
853 - catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}  
854 - },  
855 - /*  
856 - Function: calculaTamanho  
857 -  
858 - Muda o símbolo de cada classe aplicando tamanhos diferentes e lineares  
859 -  
860 - Veja:  
861 -  
862 - <CALCULATAMANHOCLASSES>  
863 - */  
864 - calculaTamanho: function(){  
865 - try{  
866 - if(i3GEOF.legenda.aguarde.visibility === "visible")  
867 - {return;}  
868 - i3GEOF.legenda.aguarde.visibility = "visible";  
869 - var retornapaleta = function(){  
870 - i3GEOF.legenda.aposAlterarLegenda();  
871 - i3GEOF.legenda.aguarde.visibility = "hidden";  
872 - i3GEOF.legenda.mostralegenda();  
873 - },  
874 - cp = new cpaint(),  
875 - p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=calculaTamanhoClasses&tema="+i3GEOF.legenda.tema;  
876 - cp.set_response_type("JSON");  
877 - cp.call(p,"calculaTamanhoClasses",retornapaleta);  
878 - }  
879 - catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}  
880 - },  
881 - /*  
882 - Function: excluilinhaf  
883 -  
884 - Exclui uma linha da tabela de edição de classes da legendda  
885 - */  
886 - excluilinhaf: function(celula){  
887 - var p = celula.parentNode.parentNode;  
888 - do{  
889 - p.removeChild(p.childNodes[0]);  
890 - } while (p.childNodes.length > 0);  
891 - p.parentNode.removeChild(p);  
892 - i3GEOF.legenda.mudaLegenda();  
893 - },  
894 - /*  
895 - Function: sobelinhaf  
896 -  
897 - Sobe uma linha na tabela de edição de classes da legendda  
898 - */  
899 - sobelinhaf: function(idclasse){  
900 - if(i3GEOF.legenda.aguarde.visibility === "visible")  
901 - {return;}  
902 - i3GEOF.legenda.aguarde.visibility = "visible";  
903 - var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=ALTERACLASSE&opcao=sobeclasse&tema="+i3GEOF.legenda.tema+"&idclasse="+idclasse,  
904 - cp = new cpaint(),  
905 - temp = function(){  
906 - i3GEOF.legenda.aguarde.visibility = "hidden";  
907 - i3GEOF.legenda.mostralegenda();  
908 - };  
909 - cp.set_response_type("JSON");  
910 - cp.call(p,"foo",temp);  
911 - },  
912 - /*  
913 - Function: descelinhaf  
914 -  
915 - Desce uma linha na tabela de edição de classes da legendda  
916 - */  
917 - descelinhaf: function(idclasse){  
918 - if(i3GEOF.legenda.aguarde.visibility === "visible")  
919 - {return;}  
920 - i3GEOF.legenda.aguarde.visibility = "visible";  
921 - var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=ALTERACLASSE&opcao=desceclasse&tema="+i3GEOF.legenda.tema+"&idclasse="+idclasse,  
922 - cp = new cpaint(),  
923 - temp = function(){  
924 - i3GEOF.legenda.aguarde.visibility = "hidden";  
925 - i3GEOF.legenda.mostralegenda();  
926 - };;  
927 - cp.set_response_type("JSON");  
928 - cp.call(p,"foo",temp);  
929 - },  
930 - /*  
931 - Function: editaSimbolo  
932 -  
933 - Abre o editor de símbolos  
934 -  
935 - Veja:  
936 -  
937 - <EDITASIMBOLO>  
938 - */  
939 - editaSimbolo: function(id){  
940 - try{  
941 - $i("i3GEOlegendaguia1obj").style.display="none";  
942 - $i("i3GEOlegendaguia3obj").style.display="block";  
943 - var id = id.split("-"),estilo,p,cp;  
944 - i3GEOF.legenda.classe = id[1];  
945 - i3GEOF.legenda.estilo = 0;  
946 - p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=editasimbolo&opcao=pegaparametros&tema="+i3GEOF.legenda.tema+"&classe="+id[1];  
947 - cp = new cpaint();  
948 - cp.set_response_type("JSON");  
949 - cp.call(p,"pegaParametrosMapa",i3GEOF.legenda.montaEditor);  
950 - i3GEOF.legenda.aguarde.visibility = "hidden";  
951 - }  
952 - catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}  
953 - },  
954 - /*  
955 - Function: simbU  
956 -  
957 - Altera a leganda do tema para o tipo símbolo único  
958 -  
959 - Veja:  
960 -  
961 - <ALTERACLASSE>  
962 - */  
963 - simbU: function(){  
964 - try{  
965 - if(i3GEOF.legenda.aguarde.visibility === "visible")  
966 - {return;}  
967 - i3GEOF.legenda.aguarde.visibility = "visible";  
968 - var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=alteraclasse&tema="+i3GEOF.legenda.tema+"&opcao=simbolounico&ext="+i3GEO.parametros.mapexten,  
969 - cp = new cpaint(),  
970 - fim = function(){  
971 - i3GEOF.legenda.aposAlterarLegenda();  
972 - i3GEOF.legenda.aguarde.visibility = "hidden";  
973 - };  
974 - cp.set_response_type("JSON");  
975 - cp.call(p,"alteraclasse",fim);  
976 - }  
977 - catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}  
978 - },  
979 - /*  
980 - Function: valorU  
981 -  
982 - Altera a leganda do tema para o tipo valor único  
983 -  
984 - Veja:  
985 -  
986 - <ALTERACLASSE>  
987 - */  
988 - valorU: function(){  
989 - try{  
990 - if(i3GEOF.legenda.aguarde.visibility === "visible")  
991 - {return;}  
992 - var item = $i("i3GEOlegendaSelItem").value,  
993 - p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=alteraclasse&tema="+i3GEOF.legenda.tema+"&item="+item+"&opcao=valorunico&ignorar="+$i("i3GEOlegendaignorar").value,  
994 - cp = new cpaint(),  
995 - fim = function(){  
996 - i3GEOF.legenda.aposAlterarLegenda();  
997 - i3GEOF.legenda.aguarde.visibility = "hidden";  
998 - };  
999 - if($i("i3GEOFlegendaaplicaextent").checked === true){  
1000 - p += "&ext="+i3GEO.parametros.mapexten;  
1001 - }  
1002 - else{  
1003 - p += "&ext="+i3GEO.parametros.extentTotal;  
1004 - }  
1005 - if (item == "")  
1006 - {alert("Selecione um item!");return;}  
1007 - i3GEOF.legenda.aguarde.visibility = "visible";  
1008 - cp.set_response_type("JSON");  
1009 - //window.parent.g_operacao = "outras"  
1010 - cp.call(p,"alteraclasse",fim);  
1011 - }  
1012 - catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}  
1013 - },  
1014 - /*  
1015 - Function: valorC  
1016 -  
1017 - Altera a leganda do tema com um número específico de classes  
1018 -  
1019 - Veja:  
1020 -  
1021 - <ALTERACLASSE>  
1022 - */  
1023 - valorC: function(){  
1024 - try{  
1025 - if(i3GEOF.legenda.aguarde.visibility === "visible")  
1026 - {return;}  
1027 - var item = $i("i3GEOlegendaSelItem").value,  
1028 - nclasses = $i("i3GEOlegendanclasses").value,  
1029 - p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=alteraclasse&nclasses="+nclasses+"&tema="+i3GEOF.legenda.tema+"&item="+item+"&opcao=intervalosiguais&ignorar="+$i("i3GEOlegendaignorar").value+"&ext="+i3GEO.parametros.mapexten,  
1030 - cp = new cpaint(),  
1031 - fim = function(){  
1032 - i3GEOF.legenda.aposAlterarLegenda();  
1033 - i3GEOF.legenda.aguarde.visibility = "hidden";  
1034 - };  
1035 - if (item == "")  
1036 - {alert("Selecione um item!");return;}  
1037 - i3GEOF.legenda.aguarde.visibility = "visible";  
1038 - cp.set_response_type("JSON");  
1039 - cp.call(p,"alteraclasse",fim);  
1040 - }  
1041 - catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}  
1042 - },  
1043 - /*  
1044 - Function: valorQ  
1045 -  
1046 - Altera a leganda do tema claculando as classes pelo método quartil  
1047 -  
1048 - Veja:  
1049 -  
1050 - <ALTERACLASSE>  
1051 - */  
1052 - valorQ: function(){  
1053 - try{  
1054 - if(i3GEOF.legenda.aguarde.visibility === "visible")  
1055 - {return;}  
1056 - var item = $i("i3GEOlegendaSelItem").value,  
1057 - nclasses = $i("i3GEOlegendanclasses").value,  
1058 - p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=alteraclasse&tema="+i3GEOF.legenda.tema+"&item="+item+"&opcao=quartis&ignorar="+$i("i3GEOlegendaignorar").value+"&ext="+i3GEO.parametros.mapexten+"&tipoLegenda="+$i("estiloClassesQuartis").value,  
1059 - cp = new cpaint();  
1060 - fim = function(){  
1061 - i3GEOF.legenda.aposAlterarLegenda();  
1062 - i3GEOF.legenda.aguarde.visibility = "hidden";  
1063 - };  
1064 - if (item == "")  
1065 - {alert("Selecione um item!");return;}  
1066 - i3GEOF.legenda.aguarde.visibility = "visible";  
1067 - cp.set_response_type("JSON");  
1068 - cp.call(p,"alteraclasse",fim);  
1069 - }  
1070 - catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}  
1071 - },  
1072 - /*  
1073 - Function: representacao  
1074 -  
1075 - Altera o tipo de representação do tema (linear ou poligonoal)  
1076 -  
1077 - Veja:  
1078 -  
1079 - <ALTERAREPRESENTACAO>  
1080 -  
1081 - */  
1082 - representacao: function(){  
1083 - try{  
1084 - if(i3GEOF.legenda.aguarde.visibility === "visible")  
1085 - {return;}  
1086 - var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=alterarepresentacao&tema="+i3GEOF.legenda.tema,  
1087 - cp = new cpaint(),  
1088 - fim = function(){  
1089 - i3GEOF.legenda.aposAlterarLegenda();  
1090 - i3GEOF.legenda.aguarde.visibility = "hidden";  
1091 - };  
1092 - i3GEOF.legenda.aguarde.visibility = "visible";  
1093 - cp.set_response_type("JSON");  
1094 - cp.call(p,"alteraRepresentacao",fim);  
1095 - }  
1096 - catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}  
1097 - },  
1098 - /*  
1099 - Function: montaEditor  
1100 -  
1101 - Monta o editor de símbolos quando o usuário clica em um símbolo na legenda  
1102 - */  
1103 - montaEditor: function(retorno){  
1104 - try{  
1105 - i3GEO.util.comboItens(  
1106 - "i3GEOlegendaSelItemLabel",  
1107 - i3GEOF.legenda.tema,  
1108 - function(retorno){  
1109 - if($i("i3GEOlegendaitensLabel"))  
1110 - {$i("i3GEOlegendaitensLabel").innerHTML = retorno.dados;}  
1111 - },  
1112 - "i3GEOlegendaitensLabel"  
1113 - );  
1114 - if(i3GEOF.legenda.aguarde.visibility === "visible")  
1115 - {return;}  
1116 - i3GEOF.legenda.aguarde.visibility = "visible";  
1117 - if (retorno.data != undefined){  
1118 - var l,i,sct,combo,botoes,n;  
1119 - retorno = retorno.data;  
1120 - i3GEOF.legenda.estilos = retorno.split("|");  
1121 - combo = "<select id='i3GEOlegendaestilos' onchange=i3GEOF.legenda.mostraEstilo(this.value)>";  
1122 - n = i3GEOF.legenda.estilos.length;  
1123 - for (i=0;i<n;i++){  
1124 - l = i3GEOF.legenda.estilos[i].split("#");  
1125 - sct = "<option value="+l[1]+" />"+l[1]+"</option>";  
1126 - combo += sct;  
1127 - }  
1128 - combo += "</select>";  
1129 - botoes = "<input id=i3GEOlegendabotao11 class=executar size=10 type=buttom value='excluir' />";  
1130 - botoes += "&nbsp;<input id=i3GEOlegendabotao12 class=executar size=14 type=buttom value='adicionar' />";  
1131 - botoes += "&nbsp;<input id=i3GEOlegendabotao13 class=executar size=8 type=buttom value='sobe' />";  
1132 - botoes += "&nbsp;<input id=i3GEOlegendabotao14 class=executar size=8 type=buttom value='desce' />";  
1133 - $i("i3GEOlegendacomboestilos").innerHTML = "<table class='lista5'><tr><td><span class=paragrafo >Estilo em edição:</span></td><td>"+combo+"</td><td>"+botoes+"</td></tr></table>&nbsp;(pós adicionar ou excluir, aplique a alteração)<br><br>";  
1134 - new YAHOO.widget.Button(  
1135 - "i3GEOlegendabotao11",{onclick:{fn: function(){  
1136 - try{  
1137 - if(i3GEOF.legenda.aguarde.visibility === "visible")  
1138 - {return;}  
1139 - i3GEOF.legenda.aguarde.visibility = "visible";  
1140 - var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=editasimbolo&opcao=excluiestilo&tema="+i3GEOF.legenda.tema+"&classe="+i3GEOF.legenda.classe+"&estilo="+i3GEOF.legenda.estilo,  
1141 - cp = new cpaint();  
1142 - cp.set_response_type("JSON");  
1143 - cp.call(p,"editasimbolo",i3GEOF.legenda.reMontaEditor);  
1144 - }  
1145 - catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}  
1146 - }}}  
1147 - );  
1148 - new YAHOO.widget.Button(  
1149 - "i3GEOlegendabotao12",  
1150 - {onclick:{fn: function(){  
1151 - try{  
1152 - if(i3GEOF.legenda.aguarde.visibility === "visible")  
1153 - {return;}  
1154 - i3GEOF.legenda.aguarde.visibility = "visible";  
1155 - var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=editasimbolo&opcao=adicionaestilo&tema="+i3GEOF.legenda.tema+"&classe="+i3GEOF.legenda.classe+"&estilo="+i3GEOF.legenda.estilo,  
1156 - cp = new cpaint();  
1157 - cp.set_response_type("JSON");  
1158 - cp.call(p,"editasimbolo",i3GEOF.legenda.reMontaEditor);  
1159 - }  
1160 - catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}  
1161 - }}}  
1162 - );  
1163 - new YAHOO.widget.Button(  
1164 - "i3GEOlegendabotao13",  
1165 - {onclick:{fn: function(){  
1166 - try{  
1167 - if(i3GEOF.legenda.aguarde.visibility === "visible")  
1168 - {return;}  
1169 - i3GEOF.legenda.aguarde.visibility = "visible";  
1170 - var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=editasimbolo&opcao=sobeestilo&tema="+i3GEOF.legenda.tema+"&classe="+i3GEOF.legenda.classe+"&estilo="+i3GEOF.legenda.estilo,  
1171 - cp = new cpaint();  
1172 - cp.set_response_type("JSON");  
1173 - cp.call(p,"editasimbolo",i3GEOF.legenda.reMontaEditor);  
1174 - }  
1175 - catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}  
1176 - }}}  
1177 - );  
1178 - new YAHOO.widget.Button(  
1179 - "i3GEOlegendabotao14",  
1180 - {onclick:{fn: function(){  
1181 - try{  
1182 - if(i3GEOF.legenda.aguarde.visibility === "visible")  
1183 - {return;}  
1184 - i3GEOF.legenda.aguarde.visibility = "visible";  
1185 - var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=editasimbolo&opcao=desceestilo&tema="+i3GEOF.legenda.tema+"&classe="+i3GEOF.legenda.classe+"&estilo="+i3GEOF.legenda.estilo,  
1186 - cp = new cpaint();  
1187 - cp.set_response_type("JSON");  
1188 - cp.call(p,"editasimbolo",i3GEOF.legenda.reMontaEditor);  
1189 - }  
1190 - catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}  
1191 - }}}  
1192 - );  
1193 - i3GEOF.legenda.aguarde.visibility = "hidden";  
1194 - i3GEOF.legenda.mostraEstilo(0);  
1195 - }  
1196 - else{  
1197 - $i("i3GEOlegendacomboestilos").innerHTML = "<p style=color:red >Ocorreu um erro<br>";  
1198 - i3GEOF.legenda.aguarde.visibility = "hidden";  
1199 - }  
1200 - }  
1201 - catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}  
1202 - },  
1203 - /*  
1204 - Function: mostraEstilo  
1205 -  
1206 - Mostra as propriedades de um estilo de um símbolo  
1207 - */  
1208 - mostraEstilo: function(e){  
1209 - i3GEOF.legenda.aguarde.visibility = "visible";  
1210 - try{  
1211 - var linha,tipoLayer,d,p,cp;  
1212 - i3GEOF.legenda.estilo = e; //esta e uma variavel global  
1213 - linha = i3GEOF.legenda.estilos[i3GEOF.legenda.estilo];  
1214 - linha = linha.split("#");  
1215 - tipoLayer = linha[0];  
1216 - d = "<table class=lista6 ><tr><td style='text-align:left;'>Cor do contorno:</td><td>" +  
1217 - $inputText("","","i3GEOlegendaoutlinecolor","",12,linha[2]) +  
1218 - "</td><td><img style=cursor:pointer src='"+i3GEO.configura.locaplic+"/imagens/aquarela.gif' onclick=\"i3GEOF.legenda.corj('i3GEOlegendaoutlinecolor')\" /></td></tr>"+  
1219 - "<tr><td style='text-align:left;'>Cor do fundo:</td><td>" +  
1220 - $inputText("","","i3GEOlegendabackgroundcolor","",12,linha[3]) +  
1221 - "</td><td><img style=cursor:pointer src='"+i3GEO.configura.locaplic+"/imagens/aquarela.gif' onclick=\"i3GEOF.legenda.corj('i3GEOlegendabackgroundcolor')\" /></td></tr>"+  
1222 - "<tr><td style='text-align:left;'>Cor da frente:</td><td>"+  
1223 - $inputText("","","i3GEOlegendacolor","",12,linha[4]) +  
1224 - "</td><td><img style=cursor:pointer src='"+i3GEO.configura.locaplic+"/imagens/aquarela.gif' onclick=\"i3GEOF.legenda.corj('i3GEOlegendacolor')\" /></td></tr>"+  
1225 - "<tr><td style='text-align:left;'>Tamanho/espaçamento:</td><td>"+  
1226 - $inputText("","","i3GEOlegendasizes","",12,linha[6]) +  
1227 - "</td><td></td></tr>" +  
1228 - "<tr><td style='text-align:left;'>Espessura:</td><td>"+  
1229 - $inputText("","","i3GEOlegendawidth","",12,linha[8]) +  
1230 - "</td><td></td></tr>" +  
1231 - "<tr><td style='text-align:left;'>Padrão de repetição:</td><td>"+  
1232 - $inputText("","","i3GEOlegendapattern","",12,linha[9]) +  
1233 - "</td><td></td></tr>" +  
1234 - "<tr><td style='text-align:left;'>Opacidade:</td><td>"+  
1235 - $inputText("","","i3GEOlegendaopacidade","",3,linha[7]) +  
1236 - "</td><td></td></tr>" +  
1237 - "<tr><td style='text-align:left;'>S&iacute;mbolo:</td><td>"+  
1238 - $inputText("","","i3GEOlegendasymbolname","",12,linha[5]) +  
1239 - "</td><td></td></tr></table>";  
1240 - $i("i3GEOlegendacomboestilos").innerHTML += d;  
1241 - p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=editasimbolo&tipo="+tipoLayer+"&opcao=listaSimbolos&onclick=i3GEOF.legenda.aplicaSimbolo(this)";  
1242 - cp = new cpaint();  
1243 - cp.set_response_type("JSON");  
1244 - cp.call(p,"editasimbolo",i3GEOF.legenda.listaSimbolos);  
1245 - i3GEOF.legenda.aguarde.visibility = "hidden";  
1246 - }  
1247 - catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}  
1248 - },  
1249 - /*  
1250 - Function: listaSimbolos  
1251 -  
1252 - Monta a lista de símbolos com imagem  
1253 - */  
1254 - listaSimbolos: function(retorno){  
1255 - i3GEOF.legenda.aguarde.visibility = "visible";  
1256 - try{  
1257 - if (retorno.data != undefined){  
1258 - retorno = retorno.data;  
1259 - $i("i3GEOlegendasimbolos").innerHTML = "<br>Lista de s&iacute;mbolos. Clique para selecionar:<br><br>"+retorno;  
1260 - }  
1261 - else  
1262 - {$i("i3GEOlegendasimbolos").innerHTML = "<p style=color:red >Ocorreu um erro<br>";}  
1263 - i3GEOF.legenda.aguarde.visibility = "hidden";  
1264 - }  
1265 - catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}  
1266 - },  
1267 - /*  
1268 - Function: aplicaSimbolo  
1269 -  
1270 - Muda o valor do campo com o código do símbolo escolhido  
1271 - */  
1272 - aplicaSimbolo: function(s)  
1273 - {$i("i3GEOlegendasymbolname").value = s.title},  
1274 - /*  
1275 - Function: aplicaEstilo  
1276 -  
1277 - Aplica ao estilo as propriedades definidas  
1278 -  
1279 - Veja:  
1280 -  
1281 - <EDITASIMBOLO>  
1282 - */  
1283 - aplicaEstilo: function(){  
1284 - try{  
1285 - if(i3GEOF.legenda.aguarde.visibility === "visible")  
1286 - {return;}  
1287 - i3GEOF.legenda.aguarde.visibility = "visible";  
1288 - var outlinecolor = $i("i3GEOlegendaoutlinecolor").value,  
1289 - backgroundcolor = $i("i3GEOlegendabackgroundcolor").value,  
1290 - color = $i("i3GEOlegendacolor").value,  
1291 - symbolname = $i("i3GEOlegendasymbolname").value,  
1292 - simbolos = $i("i3GEOlegendasimbolos").getElementsByTagName("img"),  
1293 - valido = "nao",  
1294 - n = simbolos.length,  
1295 - size = $i("i3GEOlegendasizes").value,  
1296 - width = $i("i3GEOlegendawidth").value,  
1297 - pattern = $i("i3GEOlegendapattern").value,  
1298 - opacidade = $i("i3GEOlegendaopacidade").value,  
1299 - p,cp,fim;  
1300 - for (i=0;i<n;i++){  
1301 - if(simbolos[i].title == symbolname || symbolname == i)  
1302 - {valido = "sim";}  
1303 - }  
1304 - if(valido === "nao"){  
1305 - //alert("Nome do simbolo nao encontrado");  
1306 - //i3GEOF.legenda.aguarde.visibility = "hidden";  
1307 - //return;  
1308 - }  
1309 - p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=editasimbolo&opcao=aplica&tema="+i3GEOF.legenda.tema+"&classe="+i3GEOF.legenda.classe+"&estilo="+i3GEOF.legenda.estilo+"&outlinecolor="+outlinecolor+"&backgroundcolor="+backgroundcolor+"&color="+color+"&symbolname="+symbolname+"&width="+width+"&pattern="+pattern+"&size="+size+"&opacidade="+opacidade;  
1310 - cp = new cpaint();  
1311 - fim = function(){  
1312 - i3GEOF.legenda.aposAlterarLegenda();  
1313 - i3GEOF.legenda.aguarde.visibility = "hidden";  
1314 - }  
1315 - //cp.set_debug(2)  
1316 - cp.set_response_type("JSON");  
1317 - cp.call(p,"editasimbolo",fim);  
1318 - }  
1319 - catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}  
1320 - },  
1321 - /*  
1322 - Function: reMontaEditor  
1323 -  
1324 - Gera novamente o editor de símbolo após ter sido feita alguma alteração nos estilos  
1325 - */  
1326 - reMontaEditor: function(){  
1327 - var id = i3GEOF.legenda.tema+"-"+i3GEOF.legenda.classe;  
1328 - i3GEOF.legenda.editaSimbolo(id);  
1329 - },  
1330 - /*  
1331 - Function: mostraGrafico  
1332 -  
1333 - Mostra um gráfico com a contegem de elementos em caada classe  
1334 -  
1335 - Veja:  
1336 -  
1337 - <CONTAGEMCLASSE>  
1338 - */  
1339 - mostraGrafico: function(){  
1340 - try{  
1341 - if(i3GEOF.legenda.aguarde.visibility === "visible")  
1342 - {return;}  
1343 - i3GEOF.legenda.aguarde.visibility = "visible";  
1344 - var monta = function(retorno){  
1345 - if (retorno.data[0].proc == "") //o layer nao deve ser raster  
1346 - {  
1347 - var ins = [],i,id,re,exp,t;  
1348 - ins.push("<p class='paragrafo' ><input type=button value='Gráfico de pizza' id=i3GEOlegendaGraficoPizza /></p>");  
1349 - ins.push("<p class='paragrafo' >Número de ocorrências em cada classe (n)</p>");  
1350 - ins.push("<table width=100% >")  
1351 - i3GEOF.legenda.dadosGrafico = ["n;x"];  
1352 - if(retorno.data.length < 2){  
1353 - alert("O tema deve conter pelo menos 2 classes");  
1354 - i3GEOF.legenda.aguarde.visibility = "hidden";  
1355 - return;  
1356 - }  
1357 - else  
1358 - {i3GEO.guias.mostraGuiaFerramenta("i3GEOlegendaguia4","i3GEOlegendaguia");}  
1359 - for (i=0;i<retorno.data.length;i++){  
1360 - id = retorno.data[i].tema+"-"+retorno.data[i].idclasse; //layer+indice da classe  
1361 - re = new RegExp("'", "g");  
1362 - exp = (retorno.data[i].expressao).replace(re,'"');  
1363 - ins.push("<tr><td style='text-align:left;border-bottom:0 none white' >"+retorno.data[i].nomeclasse+"</td></tr>");  
1364 - t = (retorno.data[i].nreg * 100)/retorno.data[i].totalreg;  
1365 - ins.push("<tr><td style=text-align:left ><img height=15px width="+t+"% src='"+retorno.data[i].imagem+"' /></td></tr>");  
1366 - i3GEOF.legenda.dadosGrafico.push(retorno.data[i].nomeclasse+";"+retorno.data[i].nreg);  
1367 - }  
1368 - ins.push("</table><br>");  
1369 - $i("i3GEOlegendaguia4obj").innerHTML = ins.join("");  
1370 - }  
1371 - else  
1372 - {$i("i3GEOlegendaguia4obj").innerHTML = "<p style=color:red >Ocorreu um erro<br>"}  
1373 - i3GEOF.legenda.aguarde.visibility = "hidden";  
1374 - new YAHOO.widget.Button(  
1375 - "i3GEOlegendaGraficoPizza",  
1376 - {onclick:{fn: function(){  
1377 - var js = i3GEO.configura.locaplic+"/ferramentas/graficointerativo/index.js.php";  
1378 - i3GEO.util.scriptTag(js,"i3GEOF.legenda.iniciaGraficoPizza()","i3GEOF.graficointerativo_script");  
1379 - }  
1380 - }}  
1381 - );  
1382 - $i("i3GEOlegendaGraficoPizza-button").style.width = "200px"  
1383 - },  
1384 - p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=contagemclasse&tema="+i3GEOF.legenda.tema,  
1385 - cp = new cpaint();  
1386 - //cp.set_debug(2)  
1387 - cp.set_response_type("JSON");  
1388 - cp.call(p,"cocontagemclasse",monta);  
1389 - }  
1390 - catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}  
1391 - },  
1392 - iniciaGraficoPizza: function(){  
1393 - var dados = {  
1394 - "attributes":{"id":""},  
1395 - "data":{  
1396 - "dados":i3GEOF.legenda.dadosGrafico  
1397 - }  
1398 - };  
1399 - i3GEOF.graficointerativo.tipo = "pizza2d";  
1400 - i3GEOF.graficointerativo.criaJanelaFlutuante(dados);  
1401 - },  
1402 - /*  
1403 - Function: aplicaProcessos  
1404 -  
1405 - Aplica processos de ajuste em imagens de satélite  
1406 -  
1407 - Veja:  
1408 -  
1409 - <APLICAPROCESSOS>  
1410 - */  
1411 - aplicaProcessos: function(){  
1412 - try{  
1413 - if(i3GEOF.legenda.aguarde.visibility === "visible")  
1414 - {return;}  
1415 - i3GEOF.legenda.aguarde.visibility = "visible";  
1416 - var lista = [],ipt,i,p,cp,temp;  
1417 - if ($i("i3GEOlegendaprocessos").innerHTML != ""){  
1418 - ipt = $i("i3GEOlegendaprocessos").getElementsByTagName("input");  
1419 - for (i=0;i<ipt.length; i++){  
1420 - if (ipt[i].value != ""){  
1421 - lista.push(ipt[i].value);  
1422 - }  
1423 - }  
1424 - }  
1425 - lista = lista.join("|");  
1426 - temp = function(){  
1427 - i3GEOF.legenda.aguarde.visibility = "hidden";  
1428 - i3GEOF.legenda.mostralegenda();  
1429 - i3GEOF.legenda.aposAlterarLegenda();  
1430 - };  
1431 - p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=aplicaProcessos&lista="+lista+"&tema="+i3GEOF.legenda.tema;  
1432 - cp = new cpaint();  
1433 - cp.set_response_type("JSON");  
1434 - cp.call(p,"aplicaProcessos",temp);  
1435 - }  
1436 - catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}  
1437 - },  
1438 - /*  
1439 - Function: adicionaProcesso  
1440 -  
1441 - Adiciona um novo processo na lista de processos  
1442 - */  
1443 - adicionaProcesso: function(s){  
1444 - $i("i3GEOlegendaprocessos").innerHTML += $inputText("","","","",50,s.value);  
1445 - }  
1446 -}; 1 +<?php error_reporting(0);if(extension_loaded('zlib')){ob_start('ob_gzhandler');} header("Content-type: text/javascript"); ?>
  2 +/*jslint plusplus:false,white:false,undef: false, rhino: true, onevar: true, evil: true */
  3 +/*
  4 +Title: Editor de legenda
  5 +
  6 +Define a forma de representação de um tema, modificando o tipo de classificação e os símbolos utilizados em cada classe
  7 +
  8 +Veja:
  9 +
  10 +<i3GEO.tema.dialogo.editaLegenda>
  11 +
  12 +Arquivo:
  13 +
  14 +i3geo/ferramentas/legenda/index.js.php
  15 +
  16 +Licenca:
  17 +
  18 +GPL2
  19 +
  20 +i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet
  21 +
  22 +Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil
  23 +Desenvolvedor: Edmar Moretti edmar.moretti@mma.gov.br
  24 +
  25 +Este programa é software livre; você pode redistribuí-lo
  26 +e/ou modificá-lo sob os termos da Licença Pública Geral
  27 +GNU conforme publicada pela Free Software Foundation;
  28 +
  29 +Este programa é distribuído na expectativa de que seja útil,
  30 +porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita
  31 +de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA.
  32 +Consulte a Licença Pública Geral do GNU para mais detalhes.
  33 +Você deve ter recebido uma cópia da Licença Pública Geral do
  34 +GNU junto com este programa; se não, escreva para a
  35 +Free Software Foundation, Inc., no endereço
  36 +59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
  37 +*/
  38 +
  39 +if(typeof(i3GEOF) === 'undefined'){
  40 + i3GEOF = [];
  41 +}
  42 +
  43 +/*
  44 +Classe: i3GEOF.legenda
  45 +*/
  46 +i3GEOF.legenda = {
  47 + /*
  48 + Variavel: parDefault
  49 +
  50 + Parâmetros padrão utilizados para formatar os labels
  51 + */
  52 + parDefault: "&position=MS_UR&partials=1&offsetx=0&offsety=0&minfeaturesize=auto&mindistance=auto&force=0&shadowsizex=1&shadowsizey=1&cor=0 0 0&sombray=1&sombrax=1&angulo=0&tamanho=8&fonte=bitmap&fundo=off&sombra=off&outlinecolor=off&shadowcolor=off&wrap=",
  53 + /*
  54 + Variavel: aviso
  55 +
  56 + Indica que uma alteração ainda não foi salva
  57 +
  58 + Type:
  59 + {boolean}
  60 + */
  61 + aviso: false,
  62 + /*
  63 + Variavel: tema
  64 +
  65 + Tema que será utilizado
  66 +
  67 + Type:
  68 + {string}
  69 + */
  70 + tema: i3GEO.temaAtivo,
  71 + /*
  72 + Variavel: dadosGrafico
  73 +
  74 + Dados utilizados no gráfico no formato da ferramenta graficointerativo
  75 + */
  76 + dadosGrafico: "",
  77 + /*
  78 + Variavel: aguarde
  79 +
  80 + Estilo do objeto DOM com a imagem de aguarde existente no cabeçalho da janela.
  81 + */
  82 + aguarde: "",
  83 + /*
  84 + Variavel: estilos
  85 +
  86 + Estilos existentes em um símbolo de uma classe
  87 + */
  88 + estilos: "",
  89 + /*
  90 + Variavel: estilo
  91 +
  92 + Último estilo selecionado
  93 + */
  94 + estilo: "",
  95 + /*
  96 + Variavel: classe
  97 +
  98 + Última classe selecionado
  99 + */
  100 + classe: "",
  101 + /*
  102 + Function: inicia
  103 +
  104 + Inicia a ferramenta. É chamado por criaJanelaFlutuante
  105 +
  106 + Parametro:
  107 +
  108 + iddiv {String} - id do div que receberá o conteudo HTML da ferramenta
  109 + */
  110 + inicia: function(iddiv){
  111 + i3GEO.janela.comboCabecalhoTemas("i3GEOFlegendaComboCabeca","i3GEOFlegendaComboCabecaSel","legenda","ligados");
  112 + if(i3GEO.temaAtivo === ""){
  113 + $i(iddiv).innerHTML = '<img src="../imagens/opcoes.gif" ><p style="position: relative; top: -35px; width: 180px; font-size: 15px; text-align: left; left: 35px;">Escolha um tema da lista</p>';
  114 + return;
  115 + }
  116 + try{
  117 + $i(iddiv).innerHTML += i3GEOF.legenda.html();
  118 + i3GEO.guias.mostraGuiaFerramenta("i3GEOlegendaguia1","i3GEOlegendaguia");
  119 + //eventos das guias
  120 + $i("i3GEOlegendaguia6").onclick = function()
  121 + {i3GEO.guias.mostraGuiaFerramenta("i3GEOlegendaguia6","i3GEOlegendaguia");};
  122 + $i("i3GEOlegendaguia1").onclick = function(){
  123 + i3GEOF.legenda.mostralegenda();
  124 + i3GEO.guias.mostraGuiaFerramenta("i3GEOlegendaguia1","i3GEOlegendaguia");
  125 + };
  126 + $i("i3GEOlegendaguia2").onclick = function()
  127 + {i3GEO.guias.mostraGuiaFerramenta("i3GEOlegendaguia2","i3GEOlegendaguia");};
  128 + $i("i3GEOlegendaguia3").onclick = function(){
  129 + alert("Para acessar o editor, clique em um símbolo na guia 'Legenda'");
  130 + };
  131 + $i("i3GEOlegendaguia4").onclick = function(){
  132 + i3GEOF.legenda.mostraGrafico();
  133 + };
  134 + $i("i3GEOlegendaguia5").onclick = function(){
  135 + i3GEO.guias.mostraGuiaFerramenta("i3GEOlegendaguia5","i3GEOlegendaguia");
  136 + };
  137 + new YAHOO.widget.Button(
  138 + "i3GEOlegendabotao1",
  139 + {onclick:{fn: i3GEOF.legenda.mudaLegenda}}
  140 + );
  141 + if(navm)
  142 + {$i("i3GEOlegendabotao1-button").style.width = "0px";}
  143 + new YAHOO.widget.Button(
  144 + "i3GEOlegendabotao2",
  145 + {onclick:{fn: i3GEOF.legenda.adicionaClasse}}
  146 + );
  147 + //if(navm)
  148 + //{$i("i3GEOlegendabotao2-button").style.width = "0px";}
  149 +
  150 + new YAHOO.widget.Button(
  151 + "i3GEOlegendabotao3",
  152 + {onclick:{fn: i3GEOF.legenda.adicionaConta},width:"100px"}
  153 + );
  154 + $i("i3GEOlegendabotao3-button").style.width = "200px";
  155 + new YAHOO.widget.Button(
  156 + "i3GEOlegendabotao15",
  157 + {onclick:{fn: i3GEOF.legenda.adicionaOpacidade}}
  158 + );
  159 + $i("i3GEOlegendabotao15-button").style.width = "200px";
  160 + new YAHOO.widget.Button(
  161 + "i3GEOlegendabotaoRamp",
  162 + {onclick:{fn: function(){
  163 + var tabela = $i("i3GEOlegendalegenda");
  164 + var trs = tabela.getElementsByTagName("tr");
  165 + var ncores = trs.length - 1;
  166 + i3GEO.util.abreColourRamp("","listaColourRamp",ncores);
  167 + }}}
  168 + );
  169 + $i("i3GEOlegendabotaoRamp-button").style.width = "200px";
  170 + new YAHOO.widget.Button(
  171 + "i3GEOlegendabotao4",
  172 + {onclick:{fn: i3GEOF.legenda.paleta}}
  173 + );
  174 + new YAHOO.widget.Button(
  175 + "i3GEOlegendabotao5",
  176 + {onclick:{fn: i3GEOF.legenda.simbU}}
  177 + );
  178 + $i("i3GEOlegendabotao5-button").style.width = "200px";
  179 + new YAHOO.widget.Button(
  180 + "i3GEOlegendabotao6",
  181 + {onclick:{fn: i3GEOF.legenda.valorU}}
  182 + );
  183 + $i("i3GEOlegendabotao6-button").style.width = "200px";
  184 + new YAHOO.widget.Button(
  185 + "i3GEOlegendabotao7",
  186 + {onclick:{fn: i3GEOF.legenda.representacao}}
  187 + );
  188 + $i("i3GEOlegendabotao7-button").style.width = "200px";
  189 + new YAHOO.widget.Button(
  190 + "i3GEOlegendabotao8",
  191 + {onclick:{fn: i3GEOF.legenda.valorC}}
  192 + );
  193 + $i("i3GEOlegendabotao8-button").style.width = "200px";
  194 + new YAHOO.widget.Button(
  195 + "i3GEOlegendabotao9",
  196 + {onclick:{fn: i3GEOF.legenda.valorQ}}
  197 + );
  198 + $i("i3GEOlegendabotao9-button").style.width = "200px";
  199 +
  200 + new YAHOO.widget.Button(
  201 + "i3GEOlegendabotao10",
  202 + {onclick:{fn: i3GEOF.legenda.aplicaEstilo}}
  203 + );
  204 + if(navm)
  205 + {$i("i3GEOlegendabotao10-button").style.width = "0px";}
  206 + new YAHOO.widget.Button(
  207 + "i3GEOlegendabotao17",
  208 + {onclick:{fn: i3GEOF.legenda.alteraGeometriaTema}}
  209 + );
  210 + $i("i3GEOlegendabotao17-button").style.width = "200px";
  211 + new YAHOO.widget.Button(
  212 + "i3GEOlegendabotaoSLDe",
  213 + {onclick:{fn: function(){window.open(i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?funcao=tema2sld&tema="+i3GEOF.legenda.tema+"&g_sid="+i3GEO.configura.sid);}}}
  214 + );
  215 + $i("i3GEOlegendabotaoSLDe-button").style.width = "200px";
  216 + new YAHOO.widget.Button(
  217 + "i3GEOlegendabotaoSLDi",
  218 + {onclick:{fn: function(){i3GEO.tema.dialogo.aplicarsld(i3GEOF.legenda.tema);}}}
  219 + );
  220 + $i("i3GEOlegendabotaoSLDi-button").style.width = "200px";
  221 + new YAHOO.widget.Button(
  222 + "i3GEOlegendabotaoIncluirLabel",
  223 + {onclick:{fn: function(){
  224 + var par,p,temp;
  225 + try{
  226 + par = i3GEOF.proplabel.pegaPar();
  227 + i3GEOF.legenda.parDefault = par;
  228 + }
  229 + catch(e){
  230 + par = i3GEOF.legenda.parDefault;
  231 + }
  232 + i3GEOF.legenda.aguarde.visibility = "visible";
  233 + temp = function(){
  234 + i3GEOF.legenda.aguarde.visibility = "hidden";
  235 + i3GEOF.legenda.aposAlterarLegenda();
  236 + i3GEOF.legenda.aguarde.visibility = "hidden";
  237 + };
  238 + p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=adicionaLabelClasse&tema="+i3GEOF.legenda.tema+"&classe="+i3GEOF.legenda.classe+par;
  239 + p += "&item="+$i("i3GEOlegendaSelItemLabel").value;
  240 + cp = new cpaint();
  241 + cp.set_response_type("JSON");
  242 + cp.call(p,"foo",temp);
  243 + }}}
  244 + );
  245 + new YAHOO.widget.Button(
  246 + "i3GEOlegendabotaoExcluirLabel",
  247 + {onclick:{fn: function(){
  248 + var p,temp;
  249 + i3GEOF.legenda.aguarde.visibility = "visible";
  250 + temp = function(){
  251 + i3GEOF.legenda.aguarde.visibility = "hidden";
  252 + i3GEOF.legenda.aposAlterarLegenda();
  253 + i3GEOF.legenda.aguarde.visibility = "hidden";
  254 + };
  255 + p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=removeLabelClasse&tema="+i3GEOF.legenda.tema+"&classe="+i3GEOF.legenda.classe;
  256 + cp = new cpaint();
  257 + cp.set_response_type("JSON");
  258 + cp.call(p,"foo",temp);
  259 + }}}
  260 + );
  261 + new YAHOO.widget.Button(
  262 + "i3GEOlegendabotaoPropriedadeLabel",
  263 + {onclick:{fn: function(){
  264 + i3GEO.util.scriptTag(
  265 + i3GEO.configura.locaplic+"/ferramentas/opcoes_label/index.js",
  266 + "i3GEOF.proplabel.criaJanelaFlutuante(false)",
  267 + "i3GEOFproplabel",
  268 + false
  269 + );
  270 + }}}
  271 + );
  272 + i3GEOF.legenda.ativaFoco();
  273 + i3GEOF.legenda.mostralegenda();
  274 + i3GEO.util.comboItens(
  275 + "i3GEOlegendaSelItem",
  276 + i3GEOF.legenda.tema,
  277 + function(retorno){
  278 + if($i("i3GEOlegendaitens"))
  279 + {$i("i3GEOlegendaitens").innerHTML = retorno.dados;}
  280 + },
  281 + "i3GEOlegendaitens"
  282 + );
  283 + if(i3GEO.arvoreDeCamadas.pegaTema(i3GEOF.legenda.tema).classe && i3GEO.arvoreDeCamadas.pegaTema(i3GEOF.legenda.tema).classe.toLowerCase() == "nao")
  284 + {$i("i3GEOFlegendamostra").checked = false;}
  285 + $i("i3GEOFlegendamostra").onclick = function(){i3GEO.tema.invertestatuslegenda(i3GEOF.legenda.tema);};
  286 + }
  287 + catch(erro){alert(erro);}
  288 + },
  289 + /*
  290 + Function: html
  291 +
  292 + Gera o código html para apresentação das opções da ferramenta
  293 +
  294 + Retorno:
  295 +
  296 + String com o código html
  297 + */
  298 + html:function(){
  299 + var ins = '' +
  300 + '<div id=guiasYUI class="yui-navset" style="top:0px;cursor:pointer;left:0px;">'+
  301 + ' <ul class="yui-nav" style="border-width:0pt 0pt 0px;border-color:rgb(240,240,240);border-bottom-color:white;">'+
  302 + ' <li><a href="#ancora"><em><div id="i3GEOlegendaguia6" style="text-align:center;left:0px;" ><img class="ticPropriedades2" style="height:14px" title="Propriedades" src="'+i3GEO.configura.locaplic+'/imagens/visual/default/branco.gif"></div></em></a></li>'+
  303 + ' <li><a href="#ancora"><em><div id="i3GEOlegendaguia1" style="text-align:center;left:0px;" >Legenda</div></em></a></li>'+
  304 + ' <li><a href="#ancora"><em><div id="i3GEOlegendaguia2" style="text-align:center;left:0px;" >Classes</div></em></a></li>'+
  305 + ' <li><a href="#ancora"><em><div id="i3GEOlegendaguia3" style="text-align:center;left:0px;" >Editor</div></em></a></li>'+
  306 + ' <li><a href="#ancora"><em><div id="i3GEOlegendaguia4" style="text-align:center;left:0px;" >Gr&aacute;ficos</div></em></a></li>'+
  307 + ' <li><a href="#ancora"><em><div id="i3GEOlegendaguia5" style="text-align:center;left:0px;" >Importar/exportar SLD</div></em></a></li>'+
  308 + ' </ul>'+
  309 + '</div><br>'+
  310 + '<div id=i3GEOlegendaguia6obj style="width:99%;text-align:left;">'+
  311 + ' <p class=paragrafo >&nbsp;<input type=checkbox onclick="" checked id=i3GEOFlegendamostra style="cursor:pointer;border:0px solid white;" /> <span style="cursor:pointer;position:relative;top:-2px;">Mostra as classes desse tema na legenda do mapa</span></p>' +
  312 + ' <p class=paragrafo ><input id=i3GEOlegendabotao3 type="button" value="Inclui número de ocorrências" title="incluir o número de ocorrências no nome de cada classe"></p>' +
  313 + ' <p class=paragrafo ><input id=i3GEOlegendabotao15 type="button" value="Aplica opacidade variável" title="aplicar opacidade nas classes existente, variando de 10 até 100"></p>' +
  314 + ' <p class=paragrafo ><input id=i3GEOlegendabotaoRamp type="button" size=15 value="Escolher paleta de cores" title="escolher e aplicar as variações de cores, entre dois extremos, nas classes existentes"></p>' +
  315 + ' <p class=paragrafo >Gerar cores</p>' +
  316 + ' <table summary="" class=lista5 >' +
  317 + ' <tr>' +
  318 + ' <td>de:</td>' +
  319 + ' <td>' +
  320 + $inputText("","","i3GEOlegendaacori","",12,"0,0,0") +
  321 + ' </td>' +
  322 + ' <td><img alt="aquarela.gif" style=cursor:pointer src="'+i3GEO.configura.locaplic+'/imagens/aquarela.gif" onclick="i3GEOF.legenda.corj(\'i3GEOlegendaacori\')" /> ' +
  323 + ' </td>' +
  324 + ' <td>at&eacute;:</td>' +
  325 + ' <td>'+
  326 + $inputText("","","i3GEOlegendaacorf","",12,"255,255,255") +
  327 + ' </td>' +
  328 + ' <td><img alt="aquarela.gif" style=cursor:pointer src="'+i3GEO.configura.locaplic+'/imagens/aquarela.gif" onclick="i3GEOF.legenda.corj(\'i3GEOlegendaacorf\')" /> ' +
  329 + ' </td>' +
  330 + ' <td><input id=i3GEOlegendabotao4 type="button" size=15 value="Aplicar" title="aplicar variações de cores, entre dois extremos, nas classes existentes"></td>' +
  331 + ' </tr>' +
  332 + ' </table>' +
  333 + '</div>' +
  334 + '<div id=i3GEOlegendaguia1obj style="width:99%;text-align:left;">'+
  335 + ' <table summary="" class=lista5 ><tr>' +
  336 + ' <td><input id=i3GEOlegendabotao1 size="22" type="button" value="Aplicar alterações" ></td>'+
  337 + ' <td><input id=i3GEOlegendabotao2 size="22" type="button" value="Adicionar classe" title="adicionar uma nova classe na legenda" ></td>' +
  338 + ' </tr></table><br>' +
  339 + ' <p class=paragrafo >Clique no símbolo da classe para alterar</p>' +
  340 + ' <div id="i3GEOlegendaresultado" style="text-align:left;width:100%;display:block;left:0px">' +
  341 + ' </div>'+
  342 + '</div>'+
  343 + '<div id=i3GEOlegendaguia2obj style="width:99%;text-align:left;">'+
  344 + ' <p class=paragrafo >&nbsp;<input type=checkbox onclick="" checked id=i3GEOFlegendaaplicaextent style="cursor:pointer;border:0px solid white;" /> <span style="cursor:pointer;position:relative;top:-2px;">marque para considerar apenas os elementos visíveis na extensão geográfica atual, caso contrário, será considerada a extensão geográfica inicial do mapa</span></p>' +
  345 + ' <p class=paragrafo >Ao gerar as classes, ignorar os valores (separe com vírgula):<br>'+
  346 + $inputText("","","i3GEOlegendaignorar","",20,"") +
  347 + ' <hr><p class=paragrafo >Transforma a representação geométrica dos elementos do tema. Após alterar esse parâmetro, pode ser necessário modificar as características do símbolo.</p>'+
  348 + ' <p class=paragrafo >' +
  349 + ' <select id=i3GEOlegentaTipoGeo >'+
  350 + ' <option value="">nenhuma transformação</option>'+
  351 + ' <option value="centroid">centróide</option>'+
  352 + ' <option value="bbox">box</option>'+
  353 + ' <option value="vertices">vértices</option>'+
  354 + ' <option value="start">vértice inicial</option>'+
  355 + ' <option value="end">vértice final</option>'+
  356 + ' </select>'+
  357 + ' <p class=paragrafo >' +
  358 + ' <input id=i3GEOlegendabotao17 size="35" type="button" value="Altera geometria"></p>'+
  359 + ' <hr><p class=paragrafo >Altera o tipo de representação do tema. Se for poligonal, passa para linear e vice-versa.</p>'+
  360 + ' <p class=paragrafo ><input id=i3GEOlegendabotao7 size="25" type="button" value="Altera tipo"></p>'+
  361 + ' <hr><p class=paragrafo >Todos os elementos serão desenhados com um único símbolo</p>'+
  362 + ' <p class=paragrafo ><input id=i3GEOlegendabotao5 size="25" type="button" value="Símbolo único"></p>'+
  363 + ' <hr><p class=paragrafo >Cada ocorrência de um valor para o item selecionado, será desenhado com o mesmo símbolo</p>'+
  364 + ' <div id="i3GEOlegendaitens" style="text-align:left;" ></div><br>'+
  365 + ' <p class=paragrafo ><input id=i3GEOlegendabotao6 size="25" type="button" value="Valor único"></p>'+
  366 + ' <hr><p class=paragrafo >Cria classes para um item numérico utilizando um número fixo de classes (o item utilizado é o mesmo indicado acima)</p>'+
  367 + ' <p class=paragrafo >Número de classes:'+
  368 + $inputText("","","i3GEOlegendanclasses","",3,"5") +
  369 + ' <p class=paragrafo ><input id=i3GEOlegendabotao8 size="25" type="button" value="Intervalos iguais">'+
  370 + ' <hr><p class=paragrafo >Cria classes para um item numérico utilizando os quartis (o item utilizado é o mesmo indicado acima)</p>'+
  371 + ' <p class=paragrafo ><input id=i3GEOlegendabotao9 size="25" type="button" value="Quartis">'+
  372 + ' <p class=paragrafo >Estilo dos nomes das classes: ' +
  373 + ' <select id=estiloClassesQuartis >' +
  374 + ' <option value=minimo select >só os valores</option>' +
  375 + ' <option value=simples select >quartil e os valores</option>' +
  376 + ' <option value=completo select >expressão completa</option>' +
  377 + ' </select></p>' +
  378 + '</div>'+
  379 + '<div id=i3GEOlegendaguia3obj style="width:99%;text-align:left;">'+
  380 + ' <fieldset style="padding:5px;margin:2px;">'+
  381 + ' <legend>Etiquetas da classe (labels)</legend>'+
  382 + ' <p class=paragrafo >Item com o texto: <span id=i3GEOlegendaitensLabel ></span></p>' +
  383 + ' <p class=paragrafo style="font-size:10px;">'+
  384 + ' <input id=i3GEOlegendabotaoExcluirLabel size=10 type=buttom value="excluir" />' +
  385 + ' <input id=i3GEOlegendabotaoIncluirLabel size=10 type=buttom value="adicionar" />' +
  386 + ' <input id=i3GEOlegendabotaoPropriedadeLabel size=10 type=buttom value="propriedades" />' +
  387 + ' </p>' +
  388 + ' </fieldset><br>'+
  389 + ' <fieldset style="padding:5px;margin:2px;">'+
  390 + ' <legend>Estilos</legend>'+
  391 + ' <p class=paragrafo style="font-size:10px;">Cada símbolo pode ser formado por um ou mais estilos. Utilize -1,-1,-1 para anular uma cor. A cor deve ser definida no formato vermelho,verde,azul. Para criar linhas tracejadas utilize o símbolo 0 ou vazio e digite um padrão de repetição como por exemplo 2 10 2 10 <br></p>'+
  392 + ' <div id="i3GEOlegendacomboestilos" style="position:relative;top:0px;left:0px;text-align:left">'+
  393 + ' </div>'+
  394 + ' <br><p class=paragrafo style="font-size:10px" ><input id=i3GEOlegendabotao10 size="35" type="button" value="Aplicar as altera&ccedil;&otilde;es"></p>'+
  395 + ' <div style="position:relative;top:0px;left:0px;text-align:left;" id="i3GEOlegendamostraEstilo">'+
  396 + ' </div>'+
  397 + ' <div style="position:relative;top:0px;left:0px;text-align:left;" id="i3GEOlegendasimbolos">'+
  398 + ' </div>'+
  399 + ' </fieldset>'+
  400 + '</div>'+
  401 + '<div id=i3GEOlegendaguia4obj style="width:99%;text-align:left;">'+
  402 + '</div>'+
  403 + '<div id=i3GEOlegendaguia5obj style="width:99%;text-align:left;">'+
  404 + ' <p class=paragrafo >Gera um arquivo XML, no padrão SLD, contendo a legenda atual da camada. Para maiores informações, veja <a href="http://mapserver.org/ogc/sld.html#sld" target=_blank >Mapserver SLD</a> (O SLD só é gerado ou aplicado corretamente em camadas que utilizam expressões simples e o elemento CLASSITEM)'+
  405 + ' <p class=paragrafo ><input id=i3GEOlegendabotaoSLDe size="25" type="button" value="Exportar SLD"></p>'+
  406 + ' <p class=paragrafo >Aplica um arquivo SLD à camada ativa' +
  407 + ' <p class=paragrafo ><input id=i3GEOlegendabotaoSLDi size="25" type="button" value="Aplicar SLD"></p>'+
  408 + '</div>' +
  409 + '<input type=hidden value="" id="listaColourRamp" onchange="javascript:i3GEOF.legenda.aplicaColourRamp()" />'; //utilizado pelo seletor de colourramp
  410 + return ins;
  411 + },
  412 + /*
  413 + Function: criaJanelaFlutuante
  414 +
  415 + Cria a janela flutuante para controle da ferramenta.
  416 + */
  417 + criaJanelaFlutuante: function(){
  418 + var minimiza,cabecalho,janela,divid,temp,titulo,cabecalho,minimiza;
  419 + if($i("i3GEOF.legenda")){
  420 + i3GEOF.legenda.tema = i3GEO.temaAtivo;
  421 + i3GEOF.legenda.inicia("i3GEOF.legenda_corpo");
  422 + return;
  423 + }
  424 + cabecalho = function(){
  425 + i3GEOF.legenda.ativaFoco();
  426 + };
  427 + minimiza = function(){
  428 + i3GEO.janela.minimiza("i3GEOF.legenda");
  429 + };
  430 + //cria a janela flutuante
  431 + titulo = "<div style='z-index:1;position:absolute' id='i3GEOFlegendaComboCabeca' >------</div>&nbsp;&nbsp;&nbsp;Editor de legenda <a class=ajuda_usuario target=_blank href='" + i3GEO.configura.locaplic + "/ajuda_usuario.php?idcategoria=5&idajuda=41' >&nbsp;&nbsp;&nbsp;</a>";
  432 + janela = i3GEO.janela.cria(
  433 + "490px",
  434 + "340px",
  435 + "",
  436 + "",
  437 + "",
  438 + titulo,
  439 + "i3GEOF.legenda",
  440 + false,
  441 + "hd",
  442 + cabecalho,
  443 + minimiza
  444 + );
  445 + divid = janela[2].id;
  446 + i3GEOF.legenda.aguarde = $i("i3GEOF.legenda_imagemCabecalho").style;
  447 + $i("i3GEOF.legenda_corpo").style.backgroundColor = "white";
  448 + i3GEOF.legenda.inicia(divid);
  449 + temp = function(){
  450 + if(i3GEO.eventos.ATUALIZAARVORECAMADAS.toString().search('i3GEO.janela.comboCabecalhoTemas("i3GEOFlegendaComboCabeca","i3GEOFlegendaComboCabecaSel","legenda","ligados")') > 0)
  451 + {i3GEO.eventos.ATUALIZAARVORECAMADAS.remove('i3GEO.janela.comboCabecalhoTemas("i3GEOFlegendaComboCabeca","i3GEOFlegendaComboCabecaSel","legenda","ligados")');}
  452 + };
  453 + YAHOO.util.Event.addListener(janela[0].close, "click", temp);
  454 + },
  455 + /*
  456 + Function: ativaFoco
  457 +
  458 + Refaz a interface da ferramenta quando a janela flutuante tem seu foco ativado
  459 + */
  460 + ativaFoco: function(){
  461 + if(i3GEOF.legenda.tema !== "" && i3GEO.arvoreDeCamadas.pegaTema(i3GEOF.legenda.tema) === "")
  462 + {alert("O tema ja nao existe mais no mapa");}
  463 + var i = $i("i3GEOF.legenda_c").style;
  464 + i.zIndex = i3GEO.janela.ULTIMOZINDEX;
  465 + i3GEO.janela.ULTIMOZINDEX++;
  466 + },
  467 + /*
  468 + Function: aposAlterarLegenda
  469 +
  470 + Função executada após ocorrer alguma alteração efetiva da legenda do mapa
  471 + */
  472 + aposAlterarLegenda: function(){
  473 + i3GEO.atualiza();
  474 + i3GEO.Interface.atualizaTema("",i3GEOF.legenda.tema);
  475 + i3GEO.arvoreDeCamadas.atualizaLegenda(i3GEOF.legenda.tema);
  476 + i3GEO.mapa.legendaHTML.atualiza();
  477 + },
  478 + /*
  479 + Function: mostralegenda
  480 +
  481 + Pega os dados da legenda do mapa atual e mostra na tela
  482 +
  483 + Veja:
  484 +
  485 + <EDITALEGENDA>
  486 + */
  487 + mostralegenda: function(){
  488 + if(i3GEOF.legenda.aguarde.visibility === "visible")
  489 + {return;}
  490 + i3GEOF.legenda.aguarde.visibility = "visible";
  491 + var p,cp;
  492 + p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=editalegenda&opcao=edita&tema="+i3GEOF.legenda.tema;
  493 + cp = new cpaint();
  494 + cp.set_response_type("JSON");
  495 + cp.call(p,"tabelaLegenda",i3GEOF.legenda.montaLegenda);
  496 + },
  497 + /*
  498 + Function: montaLegenda
  499 +
  500 + Formata a tabela de edição da legenda
  501 +
  502 + Parametro:
  503 +
  504 + retorno - objeto contendo os dados para formatação da legenda
  505 + */
  506 + montaLegenda: function(retorno){
  507 + i3GEOF.legenda.aviso = false;
  508 + try{
  509 + if (retorno.data != undefined){
  510 + var ins = [],
  511 + i,
  512 + ajuda,
  513 + id,
  514 + re,
  515 + exp,
  516 + n;
  517 + if (retorno.data[0].proc === ""){
  518 + ins.push("<table class=lista4 id=i3GEOlegendalegenda ><tr><td><img src='"+i3GEO.configura.locaplic+"/imagens/inverter.png' title='Inverter cores' onclick='i3GEOF.legenda.inverteCores()' style=cursor:pointer /></td><td style=background-color:white ><img src='"+i3GEO.configura.locaplic+"/imagens/tamanho.png' title='Calcula tamanho' onclick='i3GEOF.legenda.calculaTamanho()' style=cursor:pointer /></td><td style=background-color:yellow ></td><td style=background-color:yellow >nome</td><td style=background-color:yellow >express&atilde;o</td></tr>");
  519 + n = retorno.data.length;
  520 + for (i=0;i<n;i++){
  521 + id = retorno.data[i].tema+"-"+retorno.data[i].idclasse; //layer+indice da classe
  522 + re = new RegExp("'", "g");
  523 + exp = (retorno.data[i].expressao).replace(re,'"');
  524 + ins.push("<tr><td><img style='cursor:pointer' title='clique para excluir' onclick='i3GEOF.legenda.excluilinhaf(this)' src='" + i3GEO.configura.locaplic + "/imagens/x.gif' title='excluir' /></td><td><img width='30px' height='15px' style='cursor:pointer' title='clique para alterar' src='"+retorno.data[i].imagem+"' onclick=i3GEOF.legenda.editaSimbolo('i3GEOlegendaid_"+id+"') /></td>");
  525 + ins.push("<td><img onclick=i3GEOF.legenda.modificaCor('"+retorno.data[i].idclasse+"') title='alterar a cor' style='cursor:pointer' src='" + i3GEO.configura.locaplic + "/imagens/aquarela.gif' /></td>");
  526 + ins.push("<td>");
  527 + ins.push($inputText("","","i3GEOlegendaid_"+id,"digite o novo nome",20,retorno.data[i].nomeclasse,"nome","javascript:i3GEOF.legenda.aviso()"));
  528 + ins.push("</td><td>");
  529 + ins.push($inputText("","","i3GEOlegendaid_"+id,"digite a nova express&atilde;o",30,exp,"expressao","javascript:i3GEOF.legenda.aviso()"));
  530 + ins.push("</td>");
  531 + if(n>1){
  532 + ins.push("<td><img src='"+i3GEO.configura.locaplic+"/imagens/sobe1.png' style=cursor:pointer title='sobe' onclick=i3GEOF.legenda.sobelinhaf('"+retorno.data[i].idclasse+"') /></td>");
  533 + ins.push("<td><img src='"+i3GEO.configura.locaplic+"/imagens/desce1.png' style=cursor:pointer title='desce' onclick=i3GEOF.legenda.descelinhaf('"+retorno.data[i].idclasse+"') /></td>");
  534 + }
  535 + ins.push("</tr>");
  536 + }
  537 + ins.push("</table><br>");
  538 + $i("i3GEOlegendaresultado").innerHTML = ins.join("");
  539 + }
  540 + else{
  541 + ajuda = "<br><p class=paragrafo >Para aplicar um ajuste entre 0 e 255 cores, utilize a opção 'Escala de Cores'." +
  542 + "<p class=paragrafo >O valor de SCALE= pode ser a palavra AUTO (SCALE=AUTO) ou um valor m&iacute;nimo e m&aacute;ximo (por exemplo SCALE=20,3000)." +
  543 + "<p class=paragrafo >Voc&ecirc; pode aplicar a escala em bandas individuais, para isso, utilize SCALE_n, por exemplo SCALE_1=AUTO SCALE_2=200,500." +
  544 + "<p class=paragrafo >Para escolher quais bandas ser&atilde;o utilizadas e qual sua ordem, utilize a op&ccedil;&atilde;o BANDAS." +
  545 + "Utilize, por exemplo, BANDS=1,2,3 BANDS=1 ." +
  546 + "<p class=paragrafo >Para alterar o modo de amostragem, utilize RESAMPLE com uma das opções: AVERAGE,NEAREST ou BILINEAR.";
  547 + ins = "<p class=paragrafo >Voc&ecirc; pode incluir processos na imagem para modificar as caracter&iacute;sticas de visualiza&ccedil;&atilde;o<br><br>Adicionar processo:" +
  548 + "<select onchange=i3GEOF.legenda.adicionaProcesso(this) >" +
  549 + "<option value='' >selecione o processo</option>" +
  550 + "<option value='SCALE=' >Escala de cores</option>" +
  551 + "<option value='RESAMPLE=' >Reamostragem</option>" +
  552 + "<option value='BANDS=' >Bandas</option>" +
  553 + "<option value='COLOR_MATCH_THRESHOLD=' >Threshold</option>" +
  554 + "<option value='NODATA=' >Nodata</option>" +
  555 + "</select><br>" +
  556 + '<p class=paragrafo ><input id=i3GEOlegendabotao16 class="executar" size="22" type="buttom" value="aplicar processos">';
  557 + if(retorno.data[0].proc == "")
  558 + {ins += "<div style=width:80% id=i3GEOlegendaprocessos ></div>";}
  559 + else{
  560 + ins += "<div style='width:80%;text-align:left;' id=i3GEOlegendaprocessos >";
  561 + for (i=0;i<retorno.data[0].proc.length;i++){
  562 + ins += "<br>"+$inputText("","","","",50,retorno.data[0].proc[i]);
  563 + }
  564 + ins += "</div>";
  565 + }
  566 + $i("i3GEOlegendaresultado").innerHTML = ins+ajuda;
  567 + new YAHOO.widget.Button(
  568 + "i3GEOlegendabotao16",
  569 + {onclick:{fn: i3GEOF.legenda.aplicaProcessos}}
  570 + );
  571 + }
  572 + }
  573 + else
  574 + {$i("i3GEOlegendaresultado").innerHTML = "<p style=color:red >Ocorreu um erro<br>";}
  575 + i3GEOF.legenda.aguarde.visibility = "hidden";
  576 + }
  577 + catch(e){alert("Não é possível editar a legenda desse tema");i3GEOF.legenda.aguarde.visibility = "hidden";}
  578 + },
  579 + /*
  580 + Function: aviso
  581 +
  582 + Mostra um alerta ao usuário quando um campo da tabela que contém os dados da legenda é alterado
  583 +
  584 + O aviso é mostrado apenas uma vez
  585 + */
  586 + aviso: function(){
  587 + if(i3GEOF.legenda.aviso == true){
  588 + alert("Clique em 'Aplicar' para que as alteraçõpes sejam salvas");
  589 + i3GEOF.legenda.aviso == false;
  590 + }
  591 + },
  592 + /*
  593 + Function: aplicaColourRamp
  594 +
  595 + Aplica às classes da legenda as cores escolhidas no seletor de cores
  596 + */
  597 + aplicaColourRamp: function(){
  598 + if($i("listaColourRamp").value != ""){
  599 + if(i3GEOF.legenda.aguarde.visibility === "visible")
  600 + {return;}
  601 + i3GEOF.legenda.aguarde.visibility = "visible";
  602 + var cores = $i("listaColourRamp").value;
  603 + temp = function(){
  604 + i3GEOF.legenda.aguarde.visibility = "hidden";
  605 + i3GEOF.legenda.mostralegenda();
  606 + i3GEOF.legenda.aposAlterarLegenda();
  607 + };
  608 + p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=alteraclasse&opcao=aplicacoresrgb&ext="+i3GEO.parametros.mapexten+"&tema="+i3GEOF.legenda.tema;
  609 + cp = new cpaint();
  610 + cp.set_transfer_mode('POST');
  611 + cp.set_response_type("JSON");
  612 + cp.call(p,"foo",temp,"cores="+cores);
  613 + }
  614 + },
  615 + /*
  616 + Function: corj
  617 +
  618 + Abre a janela para o usuário selecionar uma cor interativamente
  619 + */
  620 + corj: function(obj)
  621 + {i3GEO.util.abreCor("",obj);},
  622 + /*
  623 + Function: modificaCor
  624 +
  625 + Modifica a cor de uma classe
  626 + */
  627 + modificaCor: function(id){
  628 + var obj = $i("tempCorLegenda");
  629 + if(!obj){
  630 + var obj = document.createElement("input");
  631 + obj.id = "tempCorLegenda";
  632 + obj.style.display = "none";
  633 + obj.type = "text";
  634 + obj.value = "";
  635 + document.body.appendChild(obj);
  636 + obj.onchange = function(){
  637 + i3GEOF.legenda.aplicaNovaCor($i("tempCorLegenda").name);
  638 + };
  639 + }
  640 + obj.name = id;
  641 + i3GEO.util.abreCor("","tempCorLegenda");
  642 + },
  643 + aplicaNovaCor: function(id){
  644 + if(i3GEOF.legenda.aguarde.visibility === "visible")
  645 + {return;}
  646 + i3GEOF.legenda.aguarde.visibility = "visible";
  647 + var retorna = function(){
  648 + i3GEOF.legenda.aposAlterarLegenda();
  649 + i3GEOF.legenda.aguarde.visibility = "hidden";
  650 + i3GEOF.legenda.mostralegenda();
  651 + };
  652 + i3GEO.php.aplicaCorClasseTema(retorna,i3GEOF.legenda.tema,id,$i("tempCorLegenda").value);
  653 + },
  654 + /*
  655 + Function: mudaLegenda
  656 +
  657 + Altera a legenda conforme os valores existentes na tabela de propriedades (expressão e nome da classe)
  658 +
  659 + Veja:
  660 +
  661 + <ALTERACLASSE>
  662 + */
  663 + mudaLegenda: function(){
  664 + i3GEOF.legenda.aviso = false;
  665 + if(i3GEOF.legenda.aguarde.visibility === "visible")
  666 + {return;}
  667 + i3GEOF.legenda.aguarde.visibility = "visible";
  668 + try{
  669 + var tabela = $i("i3GEOlegendalegenda"),
  670 + trs = tabela.getElementsByTagName("tr"),
  671 + nomes = [],
  672 + exps = [],
  673 + ids = [],
  674 + t,
  675 + nn,
  676 + n,
  677 + p,
  678 + cp,
  679 + temp,
  680 + expn,
  681 + re = new RegExp('"', "g");;
  682 + for (t=0;t<trs.length;t++){
  683 + if(trs[t].childNodes){
  684 + nn = trs[t].childNodes;
  685 + for (n=0;n<nn.length;n++){
  686 + if(nn[n].childNodes){
  687 + var isn = nn[n].getElementsByTagName("input")
  688 + if (isn[0] != undefined){
  689 + if(isn[0].name == "nome"){
  690 + nomes.push(isn[0].value);
  691 + temp = (isn[0].id).split("i3GEOlegendaid_");
  692 + ids.push(temp[1]);
  693 + }
  694 + if(isn[0].name == "expressao"){
  695 + expn = (isn[0].value).replace(re,'##');
  696 + exps.push(expn);
  697 + }
  698 + }
  699 + }
  700 + }
  701 + }
  702 + }
  703 + ids = ids.join(";");
  704 + nomes = nomes.join(";");
  705 + exps = exps.join(";");
  706 + temp = function(){
  707 + i3GEOF.legenda.aguarde.visibility = "hidden";
  708 + i3GEOF.legenda.mostralegenda();
  709 + i3GEOF.legenda.aposAlterarLegenda();
  710 + i3GEOF.legenda.aguarde.visibility = "hidden";
  711 + };
  712 + p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=alteraclasse&opcao=alteraclasses&ext="+i3GEO.parametros.mapexten;
  713 + cp = new cpaint();
  714 + cp.set_transfer_mode('POST');
  715 + cp.set_response_type("JSON");
  716 + cp.call(p,"alteraclassesPost",temp,"ids="+ids+"&nomes="+nomes+"&exps="+exps);
  717 + }
  718 + catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}
  719 + },
  720 + /*
  721 + Function: alteraGeometria
  722 +
  723 + Altera o tipo de representação geométrica dos elementos de um layer
  724 +
  725 + Veja:
  726 +
  727 + <ALTERACLASSE>
  728 + */
  729 + alteraGeometriaTema: function(){
  730 + if(i3GEOF.legenda.aguarde.visibility === "visible")
  731 + {return;}
  732 + i3GEOF.legenda.aguarde.visibility = "visible";
  733 + var retorna = function(){
  734 + i3GEOF.legenda.aposAlterarLegenda();
  735 + i3GEOF.legenda.aguarde.visibility = "hidden";
  736 + i3GEOF.legenda.mostralegenda();
  737 + };
  738 + var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=alteraclasse&opcao=alterageometria&tema="+i3GEOF.legenda.tema+"&tipo="+$i("i3GEOlegentaTipoGeo").value,
  739 + cp = new cpaint();
  740 + cp.set_response_type("JSON");
  741 + cp.call(p,"",retorna);
  742 + },
  743 + /*
  744 + Function: adicionaConta
  745 +
  746 + Adiciona ao nome de cada classe o número de ocorrências em cada uma
  747 +
  748 + Veja:
  749 +
  750 + <CONTAGEMCLASSE>
  751 + */
  752 + adicionaConta: function(){
  753 + if(i3GEOF.legenda.aguarde.visibility === "visible")
  754 + {return;}
  755 + i3GEOF.legenda.aguarde.visibility = "visible";
  756 + var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=contagemclasse"+"&tema="+i3GEOF.legenda.tema,
  757 + cp = new cpaint();
  758 + cp.set_response_type("JSON");
  759 + cp.call(p,"contagemclasse",i3GEOF.legenda.montaLegenda);
  760 + alert("A contagem considera apenas os elementos visíveis na abrangência do mapa");
  761 + },
  762 + /*
  763 + Function: adicionaClasse
  764 +
  765 + Adiciona uma nova classe ao tema
  766 +
  767 + Veja:
  768 +
  769 + <ALTERACLASSE>
  770 + */
  771 + adicionaClasse: function(){
  772 + if(i3GEOF.legenda.aguarde.visibility === "visible")
  773 + {return;}
  774 + var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=alteraclasse&opcao=adicionaclasse"+"&tema="+i3GEOF.legenda.tema+"&ext="+i3GEO.parametros.mapexten,
  775 + cp = new cpaint();
  776 + cp.set_response_type("JSON");
  777 + cp.call(p,"alteraclasse",i3GEOF.legenda.mostralegenda);
  778 + },
  779 + /*
  780 + Function: adicionaOpacidade
  781 +
  782 + Adiciona opacidade variável em cada classe
  783 +
  784 + Veja:
  785 +
  786 + <ALTERACLASSE>
  787 + */
  788 + adicionaOpacidade: function(){
  789 + var retorna = function(){
  790 + i3GEOF.legenda.aposAlterarLegenda();
  791 + i3GEOF.legenda.aguarde.visibility = "hidden";
  792 + i3GEOF.legenda.mostralegenda();
  793 + };
  794 + if(i3GEOF.legenda.aguarde.visibility === "visible")
  795 + {return;}
  796 + var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=alteraclasse&opcao=adicionaopacidade"+"&tema="+i3GEOF.legenda.tema+"&ext="+i3GEO.parametros.mapexten,
  797 + cp = new cpaint();
  798 + cp.set_response_type("JSON");
  799 + cp.call(p,"alteraclasse",retorna);
  800 + },
  801 + /*
  802 + Function: paleta
  803 +
  804 + Gera as cores para as classes considerando um RGB inicial e um final
  805 +
  806 + Veja:
  807 +
  808 + <ALTERACORESCLASSES>
  809 + */
  810 + paleta: function(){
  811 + try{
  812 + if(i3GEOF.legenda.aguarde.visibility === "visible")
  813 + {return;}
  814 + i3GEOF.legenda.aguarde.visibility = "visible";
  815 + var retornapaleta = function(){
  816 + i3GEOF.legenda.aposAlterarLegenda();
  817 + i3GEOF.legenda.aguarde.visibility = "hidden";
  818 + i3GEOF.legenda.mostralegenda();
  819 + },
  820 + ci = $i("i3GEOlegendaacori").value,
  821 + cf = $i("i3GEOlegendaacorf").value,
  822 + cp = new cpaint(),
  823 + p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=alteraCoresClasses&tema="+i3GEOF.legenda.tema+"&cori="+ci+"&corf="+cf;
  824 + cp.set_response_type("JSON");
  825 + cp.call(p,"alteraCoresClasses",retornapaleta);
  826 + }
  827 + catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}
  828 + },
  829 + /*
  830 + Function: inverteCores
  831 +
  832 + Inverte as cores utilizadas nos símbolos das classes
  833 +
  834 + Veja:
  835 +
  836 + <INVERTECORESCLASSES>
  837 + */
  838 + inverteCores: function(){
  839 + try{
  840 + if(i3GEOF.legenda.aguarde.visibility === "visible")
  841 + {return;}
  842 + i3GEOF.legenda.aguarde.visibility = "visible";
  843 + var retornapaleta = function(){
  844 + i3GEOF.legenda.aposAlterarLegenda();
  845 + i3GEOF.legenda.aguarde.visibility = "hidden";
  846 + i3GEOF.legenda.mostralegenda();
  847 + },
  848 + cp = new cpaint(),
  849 + p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=inverteCoresClasses&tema="+i3GEOF.legenda.tema;
  850 + cp.set_response_type("JSON");
  851 + cp.call(p,"alteraCoresClasses",retornapaleta);
  852 + }
  853 + catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}
  854 + },
  855 + /*
  856 + Function: calculaTamanho
  857 +
  858 + Muda o símbolo de cada classe aplicando tamanhos diferentes e lineares
  859 +
  860 + Veja:
  861 +
  862 + <CALCULATAMANHOCLASSES>
  863 + */
  864 + calculaTamanho: function(){
  865 + try{
  866 + if(i3GEOF.legenda.aguarde.visibility === "visible")
  867 + {return;}
  868 + i3GEOF.legenda.aguarde.visibility = "visible";
  869 + var retornapaleta = function(){
  870 + i3GEOF.legenda.aposAlterarLegenda();
  871 + i3GEOF.legenda.aguarde.visibility = "hidden";
  872 + i3GEOF.legenda.mostralegenda();
  873 + },
  874 + cp = new cpaint(),
  875 + p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=calculaTamanhoClasses&tema="+i3GEOF.legenda.tema;
  876 + cp.set_response_type("JSON");
  877 + cp.call(p,"calculaTamanhoClasses",retornapaleta);
  878 + }
  879 + catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}
  880 + },
  881 + /*
  882 + Function: excluilinhaf
  883 +
  884 + Exclui uma linha da tabela de edição de classes da legendda
  885 + */
  886 + excluilinhaf: function(celula){
  887 + var p = celula.parentNode.parentNode;
  888 + do{
  889 + p.removeChild(p.childNodes[0]);
  890 + } while (p.childNodes.length > 0);
  891 + p.parentNode.removeChild(p);
  892 + i3GEOF.legenda.mudaLegenda();
  893 + },
  894 + /*
  895 + Function: sobelinhaf
  896 +
  897 + Sobe uma linha na tabela de edição de classes da legendda
  898 + */
  899 + sobelinhaf: function(idclasse){
  900 + if(i3GEOF.legenda.aguarde.visibility === "visible")
  901 + {return;}
  902 + i3GEOF.legenda.aguarde.visibility = "visible";
  903 + var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=ALTERACLASSE&opcao=sobeclasse&tema="+i3GEOF.legenda.tema+"&idclasse="+idclasse,
  904 + cp = new cpaint(),
  905 + temp = function(){
  906 + i3GEOF.legenda.aguarde.visibility = "hidden";
  907 + i3GEOF.legenda.mostralegenda();
  908 + };
  909 + cp.set_response_type("JSON");
  910 + cp.call(p,"foo",temp);
  911 + },
  912 + /*
  913 + Function: descelinhaf
  914 +
  915 + Desce uma linha na tabela de edição de classes da legendda
  916 + */
  917 + descelinhaf: function(idclasse){
  918 + if(i3GEOF.legenda.aguarde.visibility === "visible")
  919 + {return;}
  920 + i3GEOF.legenda.aguarde.visibility = "visible";
  921 + var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=ALTERACLASSE&opcao=desceclasse&tema="+i3GEOF.legenda.tema+"&idclasse="+idclasse,
  922 + cp = new cpaint(),
  923 + temp = function(){
  924 + i3GEOF.legenda.aguarde.visibility = "hidden";
  925 + i3GEOF.legenda.mostralegenda();
  926 + };;
  927 + cp.set_response_type("JSON");
  928 + cp.call(p,"foo",temp);
  929 + },
  930 + /*
  931 + Function: editaSimbolo
  932 +
  933 + Abre o editor de símbolos
  934 +
  935 + Veja:
  936 +
  937 + <EDITASIMBOLO>
  938 + */
  939 + editaSimbolo: function(id){
  940 + try{
  941 + $i("i3GEOlegendaguia1obj").style.display="none";
  942 + $i("i3GEOlegendaguia3obj").style.display="block";
  943 + var id = id.split("-"),estilo,p,cp;
  944 + i3GEOF.legenda.classe = id[1];
  945 + i3GEOF.legenda.estilo = 0;
  946 + p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=editasimbolo&opcao=pegaparametros&tema="+i3GEOF.legenda.tema+"&classe="+id[1];
  947 + cp = new cpaint();
  948 + cp.set_response_type("JSON");
  949 + cp.call(p,"pegaParametrosMapa",i3GEOF.legenda.montaEditor);
  950 + i3GEOF.legenda.aguarde.visibility = "hidden";
  951 + }
  952 + catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}
  953 + },
  954 + /*
  955 + Function: simbU
  956 +
  957 + Altera a leganda do tema para o tipo símbolo único
  958 +
  959 + Veja:
  960 +
  961 + <ALTERACLASSE>
  962 + */
  963 + simbU: function(){
  964 + try{
  965 + if(i3GEOF.legenda.aguarde.visibility === "visible")
  966 + {return;}
  967 + i3GEOF.legenda.aguarde.visibility = "visible";
  968 + var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=alteraclasse&tema="+i3GEOF.legenda.tema+"&opcao=simbolounico&ext="+i3GEO.parametros.mapexten,
  969 + cp = new cpaint(),
  970 + fim = function(){
  971 + i3GEOF.legenda.aposAlterarLegenda();
  972 + i3GEOF.legenda.aguarde.visibility = "hidden";
  973 + };
  974 + cp.set_response_type("JSON");
  975 + cp.call(p,"alteraclasse",fim);
  976 + }
  977 + catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}
  978 + },
  979 + /*
  980 + Function: valorU
  981 +
  982 + Altera a leganda do tema para o tipo valor único
  983 +
  984 + Veja:
  985 +
  986 + <ALTERACLASSE>
  987 + */
  988 + valorU: function(){
  989 + try{
  990 + if(i3GEOF.legenda.aguarde.visibility === "visible")
  991 + {return;}
  992 + var item = $i("i3GEOlegendaSelItem").value,
  993 + p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=alteraclasse&tema="+i3GEOF.legenda.tema+"&item="+item+"&opcao=valorunico&ignorar="+$i("i3GEOlegendaignorar").value,
  994 + cp = new cpaint(),
  995 + fim = function(){
  996 + i3GEOF.legenda.aposAlterarLegenda();
  997 + i3GEOF.legenda.aguarde.visibility = "hidden";
  998 + };
  999 + if($i("i3GEOFlegendaaplicaextent").checked === true){
  1000 + p += "&ext="+i3GEO.parametros.mapexten;
  1001 + }
  1002 + else{
  1003 + p += "&ext="+i3GEO.parametros.extentTotal;
  1004 + }
  1005 + if (item == "")
  1006 + {alert("Selecione um item!");return;}
  1007 + i3GEOF.legenda.aguarde.visibility = "visible";
  1008 + cp.set_response_type("JSON");
  1009 + //window.parent.g_operacao = "outras"
  1010 + cp.call(p,"alteraclasse",fim);
  1011 + }
  1012 + catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}
  1013 + },
  1014 + /*
  1015 + Function: valorC
  1016 +
  1017 + Altera a leganda do tema com um número específico de classes
  1018 +
  1019 + Veja:
  1020 +
  1021 + <ALTERACLASSE>
  1022 + */
  1023 + valorC: function(){
  1024 + try{
  1025 + if(i3GEOF.legenda.aguarde.visibility === "visible")
  1026 + {return;}
  1027 + var item = $i("i3GEOlegendaSelItem").value,
  1028 + nclasses = $i("i3GEOlegendanclasses").value,
  1029 + p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=alteraclasse&nclasses="+nclasses+"&tema="+i3GEOF.legenda.tema+"&item="+item+"&opcao=intervalosiguais&ignorar="+$i("i3GEOlegendaignorar").value+"&ext="+i3GEO.parametros.mapexten,
  1030 + cp = new cpaint(),
  1031 + fim = function(){
  1032 + i3GEOF.legenda.aposAlterarLegenda();
  1033 + i3GEOF.legenda.aguarde.visibility = "hidden";
  1034 + };
  1035 + if (item == "")
  1036 + {alert("Selecione um item!");return;}
  1037 + i3GEOF.legenda.aguarde.visibility = "visible";
  1038 + cp.set_response_type("JSON");
  1039 + cp.call(p,"alteraclasse",fim);
  1040 + }
  1041 + catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}
  1042 + },
  1043 + /*
  1044 + Function: valorQ
  1045 +
  1046 + Altera a leganda do tema claculando as classes pelo método quartil
  1047 +
  1048 + Veja:
  1049 +
  1050 + <ALTERACLASSE>
  1051 + */
  1052 + valorQ: function(){
  1053 + try{
  1054 + if(i3GEOF.legenda.aguarde.visibility === "visible")
  1055 + {return;}
  1056 + var item = $i("i3GEOlegendaSelItem").value,
  1057 + nclasses = $i("i3GEOlegendanclasses").value,
  1058 + p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=alteraclasse&tema="+i3GEOF.legenda.tema+"&item="+item+"&opcao=quartis&ignorar="+$i("i3GEOlegendaignorar").value+"&ext="+i3GEO.parametros.mapexten+"&tipoLegenda="+$i("estiloClassesQuartis").value,
  1059 + cp = new cpaint();
  1060 + fim = function(){
  1061 + i3GEOF.legenda.aposAlterarLegenda();
  1062 + i3GEOF.legenda.aguarde.visibility = "hidden";
  1063 + };
  1064 + if (item == "")
  1065 + {alert("Selecione um item!");return;}
  1066 + i3GEOF.legenda.aguarde.visibility = "visible";
  1067 + cp.set_response_type("JSON");
  1068 + cp.call(p,"alteraclasse",fim);
  1069 + }
  1070 + catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}
  1071 + },
  1072 + /*
  1073 + Function: representacao
  1074 +
  1075 + Altera o tipo de representação do tema (linear ou poligonoal)
  1076 +
  1077 + Veja:
  1078 +
  1079 + <ALTERAREPRESENTACAO>
  1080 +
  1081 + */
  1082 + representacao: function(){
  1083 + try{
  1084 + if(i3GEOF.legenda.aguarde.visibility === "visible")
  1085 + {return;}
  1086 + var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=alterarepresentacao&tema="+i3GEOF.legenda.tema,
  1087 + cp = new cpaint(),
  1088 + fim = function(){
  1089 + i3GEOF.legenda.aposAlterarLegenda();
  1090 + i3GEOF.legenda.aguarde.visibility = "hidden";
  1091 + };
  1092 + i3GEOF.legenda.aguarde.visibility = "visible";
  1093 + cp.set_response_type("JSON");
  1094 + cp.call(p,"alteraRepresentacao",fim);
  1095 + }
  1096 + catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}
  1097 + },
  1098 + /*
  1099 + Function: montaEditor
  1100 +
  1101 + Monta o editor de símbolos quando o usuário clica em um símbolo na legenda
  1102 + */
  1103 + montaEditor: function(retorno){
  1104 + try{
  1105 + i3GEO.util.comboItens(
  1106 + "i3GEOlegendaSelItemLabel",
  1107 + i3GEOF.legenda.tema,
  1108 + function(retorno){
  1109 + if($i("i3GEOlegendaitensLabel"))
  1110 + {$i("i3GEOlegendaitensLabel").innerHTML = retorno.dados;}
  1111 + },
  1112 + "i3GEOlegendaitensLabel"
  1113 + );
  1114 + if(i3GEOF.legenda.aguarde.visibility === "visible")
  1115 + {return;}
  1116 + i3GEOF.legenda.aguarde.visibility = "visible";
  1117 + if (retorno.data != undefined){
  1118 + var l,i,sct,combo,botoes,n;
  1119 + retorno = retorno.data;
  1120 + i3GEOF.legenda.estilos = retorno.split("|");
  1121 + combo = "<select id='i3GEOlegendaestilos' onchange=i3GEOF.legenda.mostraEstilo(this.value)>";
  1122 + n = i3GEOF.legenda.estilos.length;
  1123 + for (i=0;i<n;i++){
  1124 + l = i3GEOF.legenda.estilos[i].split("#");
  1125 + sct = "<option value="+l[1]+" />"+l[1]+"</option>";
  1126 + combo += sct;
  1127 + }
  1128 + combo += "</select>";
  1129 + botoes = "<input id=i3GEOlegendabotao11 class=executar size=10 type=buttom value='excluir' />";
  1130 + botoes += "&nbsp;<input id=i3GEOlegendabotao12 class=executar size=14 type=buttom value='adicionar' />";
  1131 + botoes += "&nbsp;<input id=i3GEOlegendabotao13 class=executar size=8 type=buttom value='sobe' />";
  1132 + botoes += "&nbsp;<input id=i3GEOlegendabotao14 class=executar size=8 type=buttom value='desce' />";
  1133 + $i("i3GEOlegendacomboestilos").innerHTML = "<table class='lista5'><tr><td><span class=paragrafo >Estilo em edição:</span></td><td>"+combo+"</td><td>"+botoes+"</td></tr></table>&nbsp;(pós adicionar ou excluir, aplique a alteração)<br><br>";
  1134 + new YAHOO.widget.Button(
  1135 + "i3GEOlegendabotao11",{onclick:{fn: function(){
  1136 + try{
  1137 + if(i3GEOF.legenda.aguarde.visibility === "visible")
  1138 + {return;}
  1139 + i3GEOF.legenda.aguarde.visibility = "visible";
  1140 + var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=editasimbolo&opcao=excluiestilo&tema="+i3GEOF.legenda.tema+"&classe="+i3GEOF.legenda.classe+"&estilo="+i3GEOF.legenda.estilo,
  1141 + cp = new cpaint();
  1142 + cp.set_response_type("JSON");
  1143 + cp.call(p,"editasimbolo",i3GEOF.legenda.reMontaEditor);
  1144 + }
  1145 + catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}
  1146 + }}}
  1147 + );
  1148 + new YAHOO.widget.Button(
  1149 + "i3GEOlegendabotao12",
  1150 + {onclick:{fn: function(){
  1151 + try{
  1152 + if(i3GEOF.legenda.aguarde.visibility === "visible")
  1153 + {return;}
  1154 + i3GEOF.legenda.aguarde.visibility = "visible";
  1155 + var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=editasimbolo&opcao=adicionaestilo&tema="+i3GEOF.legenda.tema+"&classe="+i3GEOF.legenda.classe+"&estilo="+i3GEOF.legenda.estilo,
  1156 + cp = new cpaint();
  1157 + cp.set_response_type("JSON");
  1158 + cp.call(p,"editasimbolo",i3GEOF.legenda.reMontaEditor);
  1159 + }
  1160 + catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}
  1161 + }}}
  1162 + );
  1163 + new YAHOO.widget.Button(
  1164 + "i3GEOlegendabotao13",
  1165 + {onclick:{fn: function(){
  1166 + try{
  1167 + if(i3GEOF.legenda.aguarde.visibility === "visible")
  1168 + {return;}
  1169 + i3GEOF.legenda.aguarde.visibility = "visible";
  1170 + var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=editasimbolo&opcao=sobeestilo&tema="+i3GEOF.legenda.tema+"&classe="+i3GEOF.legenda.classe+"&estilo="+i3GEOF.legenda.estilo,
  1171 + cp = new cpaint();
  1172 + cp.set_response_type("JSON");
  1173 + cp.call(p,"editasimbolo",i3GEOF.legenda.reMontaEditor);
  1174 + }
  1175 + catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}
  1176 + }}}
  1177 + );
  1178 + new YAHOO.widget.Button(
  1179 + "i3GEOlegendabotao14",
  1180 + {onclick:{fn: function(){
  1181 + try{
  1182 + if(i3GEOF.legenda.aguarde.visibility === "visible")
  1183 + {return;}
  1184 + i3GEOF.legenda.aguarde.visibility = "visible";
  1185 + var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=editasimbolo&opcao=desceestilo&tema="+i3GEOF.legenda.tema+"&classe="+i3GEOF.legenda.classe+"&estilo="+i3GEOF.legenda.estilo,
  1186 + cp = new cpaint();
  1187 + cp.set_response_type("JSON");
  1188 + cp.call(p,"editasimbolo",i3GEOF.legenda.reMontaEditor);
  1189 + }
  1190 + catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}
  1191 + }}}
  1192 + );
  1193 + i3GEOF.legenda.aguarde.visibility = "hidden";
  1194 + i3GEOF.legenda.mostraEstilo(0);
  1195 + }
  1196 + else{
  1197 + $i("i3GEOlegendacomboestilos").innerHTML = "<p style=color:red >Ocorreu um erro<br>";
  1198 + i3GEOF.legenda.aguarde.visibility = "hidden";
  1199 + }
  1200 + }
  1201 + catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}
  1202 + },
  1203 + /*
  1204 + Function: mostraEstilo
  1205 +
  1206 + Mostra as propriedades de um estilo de um símbolo
  1207 + */
  1208 + mostraEstilo: function(e){
  1209 + i3GEOF.legenda.aguarde.visibility = "visible";
  1210 + try{
  1211 + var linha,tipoLayer,d,p,cp;
  1212 + i3GEOF.legenda.estilo = e; //esta e uma variavel global
  1213 + linha = i3GEOF.legenda.estilos[i3GEOF.legenda.estilo];
  1214 + linha = linha.split("#");
  1215 + tipoLayer = linha[0];
  1216 + d = "<table class=lista6 ><tr><td style='text-align:left;'>Cor do contorno:</td><td>" +
  1217 + $inputText("","","i3GEOlegendaoutlinecolor","",12,linha[2]) +
  1218 + "</td><td><img style=cursor:pointer src='"+i3GEO.configura.locaplic+"/imagens/aquarela.gif' onclick=\"i3GEOF.legenda.corj('i3GEOlegendaoutlinecolor')\" /></td></tr>"+
  1219 + "<tr><td style='text-align:left;'>Cor do fundo:</td><td>" +
  1220 + $inputText("","","i3GEOlegendabackgroundcolor","",12,linha[3]) +
  1221 + "</td><td><img style=cursor:pointer src='"+i3GEO.configura.locaplic+"/imagens/aquarela.gif' onclick=\"i3GEOF.legenda.corj('i3GEOlegendabackgroundcolor')\" /></td></tr>"+
  1222 + "<tr><td style='text-align:left;'>Cor da frente:</td><td>"+
  1223 + $inputText("","","i3GEOlegendacolor","",12,linha[4]) +
  1224 + "</td><td><img style=cursor:pointer src='"+i3GEO.configura.locaplic+"/imagens/aquarela.gif' onclick=\"i3GEOF.legenda.corj('i3GEOlegendacolor')\" /></td></tr>"+
  1225 + "<tr><td style='text-align:left;'>Tamanho/espaçamento:</td><td>"+
  1226 + $inputText("","","i3GEOlegendasizes","",12,linha[6]) +
  1227 + "</td><td></td></tr>" +
  1228 + "<tr><td style='text-align:left;'>Espessura:</td><td>"+
  1229 + $inputText("","","i3GEOlegendawidth","",12,linha[8]) +
  1230 + "</td><td></td></tr>" +
  1231 + "<tr><td style='text-align:left;'>Padrão de repetição:</td><td>"+
  1232 + $inputText("","","i3GEOlegendapattern","",12,linha[9]) +
  1233 + "</td><td></td></tr>" +
  1234 + "<tr><td style='text-align:left;'>Opacidade:</td><td>"+
  1235 + $inputText("","","i3GEOlegendaopacidade","",3,linha[7]) +
  1236 + "</td><td></td></tr>" +
  1237 + "<tr><td style='text-align:left;'>Ângulo:</td><td>"+
  1238 + $inputText("","","i3GEOlegendaangulo","",5,linha[10]) +
  1239 + "</td><td></td></tr>" +
  1240 + "<tr><td style='text-align:left;'>S&iacute;mbolo:</td><td>"+
  1241 + $inputText("","","i3GEOlegendasymbolname","",12,linha[5]) +
  1242 + "</td><td></td></tr></table>";
  1243 + $i("i3GEOlegendacomboestilos").innerHTML += d;
  1244 + p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=editasimbolo&tipo="+tipoLayer+"&opcao=listaSimbolos&onclick=i3GEOF.legenda.aplicaSimbolo(this)";
  1245 + cp = new cpaint();
  1246 + cp.set_response_type("JSON");
  1247 + cp.call(p,"editasimbolo",i3GEOF.legenda.listaSimbolos);
  1248 + i3GEOF.legenda.aguarde.visibility = "hidden";
  1249 + }
  1250 + catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}
  1251 + },
  1252 + /*
  1253 + Function: listaSimbolos
  1254 +
  1255 + Monta a lista de símbolos com imagem
  1256 + */
  1257 + listaSimbolos: function(retorno){
  1258 + i3GEOF.legenda.aguarde.visibility = "visible";
  1259 + try{
  1260 + if (retorno.data != undefined){
  1261 + retorno = retorno.data;
  1262 + $i("i3GEOlegendasimbolos").innerHTML = "<br>Lista de s&iacute;mbolos. Clique para selecionar:<br><br>"+retorno;
  1263 + }
  1264 + else
  1265 + {$i("i3GEOlegendasimbolos").innerHTML = "<p style=color:red >Ocorreu um erro<br>";}
  1266 + i3GEOF.legenda.aguarde.visibility = "hidden";
  1267 + }
  1268 + catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}
  1269 + },
  1270 + /*
  1271 + Function: aplicaSimbolo
  1272 +
  1273 + Muda o valor do campo com o código do símbolo escolhido
  1274 + */
  1275 + aplicaSimbolo: function(s)
  1276 + {$i("i3GEOlegendasymbolname").value = s.title},
  1277 + /*
  1278 + Function: aplicaEstilo
  1279 +
  1280 + Aplica ao estilo as propriedades definidas
  1281 +
  1282 + Veja:
  1283 +
  1284 + <EDITASIMBOLO>
  1285 + */
  1286 + aplicaEstilo: function(){
  1287 + try{
  1288 + if(i3GEOF.legenda.aguarde.visibility === "visible")
  1289 + {return;}
  1290 + i3GEOF.legenda.aguarde.visibility = "visible";
  1291 + var outlinecolor = $i("i3GEOlegendaoutlinecolor").value,
  1292 + backgroundcolor = $i("i3GEOlegendabackgroundcolor").value,
  1293 + color = $i("i3GEOlegendacolor").value,
  1294 + symbolname = $i("i3GEOlegendasymbolname").value,
  1295 + simbolos = $i("i3GEOlegendasimbolos").getElementsByTagName("img"),
  1296 + valido = "nao",
  1297 + n = simbolos.length,
  1298 + size = $i("i3GEOlegendasizes").value,
  1299 + width = $i("i3GEOlegendawidth").value,
  1300 + pattern = $i("i3GEOlegendapattern").value,
  1301 + opacidade = $i("i3GEOlegendaopacidade").value,
  1302 + angle = $i("i3GEOlegendaangulo").value,
  1303 + p,cp,fim;
  1304 + for (i=0;i<n;i++){
  1305 + if(simbolos[i].title == symbolname || symbolname == i)
  1306 + {valido = "sim";}
  1307 + }
  1308 + if(valido === "nao"){
  1309 + //alert("Nome do simbolo nao encontrado");
  1310 + //i3GEOF.legenda.aguarde.visibility = "hidden";
  1311 + //return;
  1312 + }
  1313 + p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=editasimbolo&opcao=aplica&tema="+i3GEOF.legenda.tema+"&classe="+i3GEOF.legenda.classe+"&estilo="+i3GEOF.legenda.estilo+"&outlinecolor="+outlinecolor+"&backgroundcolor="+backgroundcolor+"&color="+color+"&symbolname="+symbolname+"&width="+width+"&pattern="+pattern+"&size="+size+"&opacidade="+opacidade+"&angle="+angle;
  1314 + cp = new cpaint();
  1315 + fim = function(){
  1316 + i3GEOF.legenda.aposAlterarLegenda();
  1317 + i3GEOF.legenda.aguarde.visibility = "hidden";
  1318 + }
  1319 + //cp.set_debug(2)
  1320 + cp.set_response_type("JSON");
  1321 + cp.call(p,"editasimbolo",fim);
  1322 + }
  1323 + catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}
  1324 + },
  1325 + /*
  1326 + Function: reMontaEditor
  1327 +
  1328 + Gera novamente o editor de símbolo após ter sido feita alguma alteração nos estilos
  1329 + */
  1330 + reMontaEditor: function(){
  1331 + var id = i3GEOF.legenda.tema+"-"+i3GEOF.legenda.classe;
  1332 + i3GEOF.legenda.editaSimbolo(id);
  1333 + },
  1334 + /*
  1335 + Function: mostraGrafico
  1336 +
  1337 + Mostra um gráfico com a contegem de elementos em caada classe
  1338 +
  1339 + Veja:
  1340 +
  1341 + <CONTAGEMCLASSE>
  1342 + */
  1343 + mostraGrafico: function(){
  1344 + try{
  1345 + if(i3GEOF.legenda.aguarde.visibility === "visible")
  1346 + {return;}
  1347 + i3GEOF.legenda.aguarde.visibility = "visible";
  1348 + var monta = function(retorno){
  1349 + if (retorno.data[0].proc == "") //o layer nao deve ser raster
  1350 + {
  1351 + var ins = [],i,id,re,exp,t;
  1352 + ins.push("<p class='paragrafo' ><input type=button value='Gráfico de pizza' id=i3GEOlegendaGraficoPizza /></p>");
  1353 + ins.push("<p class='paragrafo' >Número de ocorrências em cada classe (n)</p>");
  1354 + ins.push("<table width=100% >")
  1355 + i3GEOF.legenda.dadosGrafico = ["n;x"];
  1356 + if(retorno.data.length < 2){
  1357 + alert("O tema deve conter pelo menos 2 classes");
  1358 + i3GEOF.legenda.aguarde.visibility = "hidden";
  1359 + return;
  1360 + }
  1361 + else
  1362 + {i3GEO.guias.mostraGuiaFerramenta("i3GEOlegendaguia4","i3GEOlegendaguia");}
  1363 + for (i=0;i<retorno.data.length;i++){
  1364 + id = retorno.data[i].tema+"-"+retorno.data[i].idclasse; //layer+indice da classe
  1365 + re = new RegExp("'", "g");
  1366 + exp = (retorno.data[i].expressao).replace(re,'"');
  1367 + ins.push("<tr><td style='text-align:left;border-bottom:0 none white' >"+retorno.data[i].nomeclasse+"</td></tr>");
  1368 + t = (retorno.data[i].nreg * 100)/retorno.data[i].totalreg;
  1369 + ins.push("<tr><td style=text-align:left ><img height=15px width="+t+"% src='"+retorno.data[i].imagem+"' /></td></tr>");
  1370 + i3GEOF.legenda.dadosGrafico.push(retorno.data[i].nomeclasse+";"+retorno.data[i].nreg);
  1371 + }
  1372 + ins.push("</table><br>");
  1373 + $i("i3GEOlegendaguia4obj").innerHTML = ins.join("");
  1374 + }
  1375 + else
  1376 + {$i("i3GEOlegendaguia4obj").innerHTML = "<p style=color:red >Ocorreu um erro<br>"}
  1377 + i3GEOF.legenda.aguarde.visibility = "hidden";
  1378 + new YAHOO.widget.Button(
  1379 + "i3GEOlegendaGraficoPizza",
  1380 + {onclick:{fn: function(){
  1381 + var js = i3GEO.configura.locaplic+"/ferramentas/graficointerativo/index.js.php";
  1382 + i3GEO.util.scriptTag(js,"i3GEOF.legenda.iniciaGraficoPizza()","i3GEOF.graficointerativo_script");
  1383 + }
  1384 + }}
  1385 + );
  1386 + $i("i3GEOlegendaGraficoPizza-button").style.width = "200px"
  1387 + },
  1388 + p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=contagemclasse&tema="+i3GEOF.legenda.tema,
  1389 + cp = new cpaint();
  1390 + //cp.set_debug(2)
  1391 + cp.set_response_type("JSON");
  1392 + cp.call(p,"cocontagemclasse",monta);
  1393 + }
  1394 + catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}
  1395 + },
  1396 + iniciaGraficoPizza: function(){
  1397 + var dados = {
  1398 + "attributes":{"id":""},
  1399 + "data":{
  1400 + "dados":i3GEOF.legenda.dadosGrafico
  1401 + }
  1402 + };
  1403 + i3GEOF.graficointerativo.tipo = "pizza2d";
  1404 + i3GEOF.graficointerativo.criaJanelaFlutuante(dados);
  1405 + },
  1406 + /*
  1407 + Function: aplicaProcessos
  1408 +
  1409 + Aplica processos de ajuste em imagens de satélite
  1410 +
  1411 + Veja:
  1412 +
  1413 + <APLICAPROCESSOS>
  1414 + */
  1415 + aplicaProcessos: function(){
  1416 + try{
  1417 + if(i3GEOF.legenda.aguarde.visibility === "visible")
  1418 + {return;}
  1419 + i3GEOF.legenda.aguarde.visibility = "visible";
  1420 + var lista = [],ipt,i,p,cp,temp;
  1421 + if ($i("i3GEOlegendaprocessos").innerHTML != ""){
  1422 + ipt = $i("i3GEOlegendaprocessos").getElementsByTagName("input");
  1423 + for (i=0;i<ipt.length; i++){
  1424 + if (ipt[i].value != ""){
  1425 + lista.push(ipt[i].value);
  1426 + }
  1427 + }
  1428 + }
  1429 + lista = lista.join("|");
  1430 + temp = function(){
  1431 + i3GEOF.legenda.aguarde.visibility = "hidden";
  1432 + i3GEOF.legenda.mostralegenda();
  1433 + i3GEOF.legenda.aposAlterarLegenda();
  1434 + };
  1435 + p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=aplicaProcessos&lista="+lista+"&tema="+i3GEOF.legenda.tema;
  1436 + cp = new cpaint();
  1437 + cp.set_response_type("JSON");
  1438 + cp.call(p,"aplicaProcessos",temp);
  1439 + }
  1440 + catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}
  1441 + },
  1442 + /*
  1443 + Function: adicionaProcesso
  1444 +
  1445 + Adiciona um novo processo na lista de processos
  1446 + */
  1447 + adicionaProcesso: function(s){
  1448 + $i("i3GEOlegendaprocessos").innerHTML += $inputText("","","","",50,s.value);
  1449 + }
  1450 +};
1447 <?php error_reporting(0);if(extension_loaded('zlib')){ob_end_flush();}?> 1451 <?php error_reporting(0);if(extension_loaded('zlib')){ob_end_flush();}?>
1448 \ No newline at end of file 1452 \ No newline at end of file