Statistics
| Revision:

root / i3geo60 / ferramentas / legenda / index.js @ 5976

History | View | Annotate | Download (70.9 KB)

1
/*
2
 Title: Editor de legenda
3

4
 Define a forma de representação de um tema, modificando o tipo de classificação e os símbolos utilizados em cada classe
5

6
 Veja:
7

8
 <i3GEO.tema.dialogo.editaLegenda>
9

10
 Arquivo:
11

12
 i3geo/ferramentas/legenda/index.js.php
13

14
 Licenca:
15

16
 GPL2
17

18
 i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet
19

20
 Direitos Autorais Reservados (c) 2006 Minist&eacute;rio do Meio Ambiente Brasil
21
 Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com
22

23
 Este programa &eacute; software livre; voc&ecirc; pode redistribu&iacute;-lo
24
 e/ou modific&aacute;-lo sob os termos da Licen&ccedil;a P&uacute;blica Geral
25
 GNU conforme publicada pela Free Software Foundation;
26

27
 Este programa &eacute; distribu&iacute;do na expectativa de que seja &uacute;til,
28
 por&eacute;m, SEM NENHUMA GARANTIA; nem mesmo a garantia impl&iacute;cita
29
 de COMERCIABILIDADE OU ADEQUA&Ccedil;&Atilde;O A UMA FINALIDADE ESPEC&Iacute;FICA.
30
 Consulte a Licen&ccedil;a P&uacute;blica Geral do GNU para mais detalhes.
31
 Voc&ecirc; deve ter recebido uma c&oacute;pia da Licen&ccedil;a P&uacute;blica Geral do
32
 GNU junto com este programa; se n&atilde;o, escreva para a
33
 Free Software Foundation, Inc., no endere&ccedil;o
34
 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
35
 */
36

    
37
if (typeof (i3GEOF) === 'undefined') {
38
        var i3GEOF = {};
39
}
40
/*
41
 * Classe: i3GEOF.legenda
42
 */
43
// incuir opcao para inserir o nome de uma imagem da legenda
44
i3GEOF.legenda =
45
        {
46
                /*
47
                 * Variavel: parDefault
48
                 *
49
                 * Parametros padr&atilde;o utilizados para formatar os labels
50
                 */
51
                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=",
52
                /*
53
                 * Variavel: aviso
54
                 *
55
                 * Indica que uma altera&ccedil;&atilde;o ainda n&atilde;o foi salva
56
                 *
57
                 * Type: {boolean}
58
                 */
59
                aviso : false,
60
                /*
61
                 * Variavel: tema
62
                 *
63
                 * Tema que ser&aacute; utilizado
64
                 *
65
                 * Type: {string}
66
                 */
67
                tema : i3GEO.temaAtivo,
68
                /*
69
                 * Variavel: dadosGrafico
70
                 *
71
                 * Dados utilizados no gr&aacute;fico no formato da ferramenta graficointerativo
72
                 */
73
                dadosGrafico : "",
74
                /*
75
                 * Variavel: aguarde
76
                 *
77
                 * Estilo do objeto DOM com a imagem de aguarde existente no cabe&ccedil;alho da janela.
78
                 */
79
                aguarde : "",
80
                /*
81
                 * Variavel: estilos
82
                 *
83
                 * Estilos existentes em um s&iacute;mbolo de uma classe
84
                 */
85
                estilos : "",
86
                /*
87
                 * Variavel: estilo
88
                 *
89
                 * Ultimo estilo selecionado
90
                 */
91
                estilo : "",
92
                /*
93
                 * Variavel: classe
94
                 *
95
                 * Ultima classe selecionado
96
                 */
97
                classe : "",
98
                /**
99
                 * Template no formato mustache. E preenchido na carga do javascript com o programa dependencias.php
100
                 */
101
                MUSTACHE : "",
102
                /**
103
                 * Susbtitutos para o template
104
                 */
105
                mustacheHash : function() {
106
                        var dicionario = i3GEO.idioma.objetoIdioma(i3GEOF.legenda.dicionario);
107
                        dicionario["locaplic"] = i3GEO.configura.locaplic;
108
                        dicionario["asp"] = '"';
109
                        return dicionario;
110
                },
111
                /*
112
                 * Function: inicia
113
                 *
114
                 * Inicia a ferramenta. &Eacute; chamado por criaJanelaFlutuante
115
                 *
116
                 * Parametro:
117
                 *
118
                 * iddiv {String} - id do div que receber&aacute; o conteudo HTML da ferramenta
119
                 */
120
                inicia : function(iddiv) {
121
                        i3GEO.janela.comboCabecalhoTemas("i3GEOFlegendaComboCabeca", "i3GEOFlegendaComboCabecaSel", "legenda", "ligados");
122
                        if (i3GEO.temaAtivo === "") {
123
                                $i(iddiv).innerHTML = "";// '<p style="position: relative; top: 0px; font-size: 15px; text-align:
124
                                // left;">'+$trad("x33")+'</p>';
125
                                return;
126
                        }
127
                        try {
128
                                $i(iddiv).innerHTML += i3GEOF.legenda.html();
129
                                i3GEO.guias.mostraGuiaFerramenta("i3GEOlegendaguia1", "i3GEOlegendaguia");
130
                                // eventos das guias
131
                                $i("i3GEOlegendaguia6").onclick = function() {
132
                                        i3GEOF.legenda.ativaAplicar("none");
133
                                        i3GEO.guias.mostraGuiaFerramenta("i3GEOlegendaguia6", "i3GEOlegendaguia");
134
                                };
135
                                $i("i3GEOlegendaguia1").onclick = function() {
136
                                        i3GEOF.legenda.ativaAplicar("none");
137
                                        i3GEOF.legenda.mostralegenda();
138
                                        i3GEO.guias.mostraGuiaFerramenta("i3GEOlegendaguia1", "i3GEOlegendaguia");
139
                                };
140
                                $i("i3GEOlegendaguia2").onclick = function() {
141
                                        i3GEOF.legenda.ativaAplicar("none");
142
                                        i3GEO.guias.mostraGuiaFerramenta("i3GEOlegendaguia2", "i3GEOlegendaguia");
143
                                };
144
                                $i("i3GEOlegendaguia3").onclick = function() {
145
                                        i3GEO.janela.tempoMsg($trad('ajuda', i3GEOF.legenda.dicionario));
146
                                };
147
                                $i("i3GEOlegendaguia4").onclick = function() {
148
                                        i3GEOF.legenda.ativaAplicar("none");
149
                                        i3GEOF.legenda.mostraGrafico();
150
                                };
151
                                $i("i3GEOlegendaguia5").onclick = function() {
152
                                        i3GEOF.legenda.ativaAplicar("none");
153
                                        i3GEO.guias.mostraGuiaFerramenta("i3GEOlegendaguia5", "i3GEOlegendaguia");
154
                                };
155
                                var b = new YAHOO.widget.Button("i3GEOlegendabotao1", {
156
                                        onclick : {
157
                                                fn : i3GEOF.legenda.mudaLegenda
158
                                        }
159
                                });
160
                                b.addClass("rodar150");
161
                                b = new YAHOO.widget.Button("i3GEOlegendabotao2", {
162
                                        onclick : {
163
                                                fn : i3GEOF.legenda.adicionaClasse
164
                                        }
165
                                });
166
                                b.addClass("rodar150");
167
                                b = new YAHOO.widget.Button("i3GEOlegendabotao3", {
168
                                        onclick : {
169
                                                fn : i3GEOF.legenda.adicionaConta
170
                                        }
171
                                });
172
                                b.addClass("rodar");
173
                                b = new YAHOO.widget.Button("i3GEOlegendabotao15", {
174
                                        onclick : {
175
                                                fn : i3GEOF.legenda.adicionaOpacidade
176
                                        }
177
                                });
178
                                b.addClass("rodar");
179

    
180
                                b = new YAHOO.widget.Button("i3GEOlegendabotaoRamp", {
181
                                        onclick : {
182
                                                fn : function() {
183
                                                        var tabela = $i("i3GEOlegendalegenda");
184
                                                        var trs = tabela.getElementsByTagName("tr");
185
                                                        var ncores = trs.length - 1;
186
                                                        // $i("i3geo_janelaCorRampComboCabecaSel").value = i3GEOF.legenda.tema;
187
                                                        i3GEO.util.abreColourRamp("", "listaColourRamp", ncores, i3GEOF.legenda.tema);
188
                                                }
189
                                        }
190
                                });
191
                                b.addClass("rodar");
192
                                b = new YAHOO.widget.Button("i3GEOlegendabotao4", {
193
                                        onclick : {
194
                                                fn : i3GEOF.legenda.paleta
195
                                        }
196
                                });
197
                                b.addClass("rodar100");
198
                                b = new YAHOO.widget.Button("i3GEOlegendabotao5", {
199
                                        onclick : {
200
                                                fn : i3GEOF.legenda.simbU
201
                                        }
202
                                });
203
                                b.addClass("rodar");
204
                                b = new YAHOO.widget.Button("i3GEOlegendabotao6", {
205
                                        onclick : {
206
                                                fn : i3GEOF.legenda.valorU
207
                                        }
208
                                });
209
                                b.addClass("rodar");
210
                                b = new YAHOO.widget.Button("i3GEOlegendabotao7", {
211
                                        onclick : {
212
                                                fn : i3GEOF.legenda.representacao
213
                                        }
214
                                });
215
                                b.addClass("rodar");
216
                                b = new YAHOO.widget.Button("i3GEOlegendabotao8", {
217
                                        onclick : {
218
                                                fn : i3GEOF.legenda.valorC
219
                                        }
220
                                });
221
                                b.addClass("rodar");
222
                                b = new YAHOO.widget.Button("i3GEOlegendabotao9", {
223
                                        onclick : {
224
                                                fn : i3GEOF.legenda.valorQ
225
                                        }
226
                                });
227
                                b.addClass("rodar");
228
                                b = new YAHOO.widget.Button("i3GEOlegendabotaoQuantil", {
229
                                        onclick : {
230
                                                fn : i3GEOF.legenda.valorQu
231
                                        }
232
                                });
233
                                b.addClass("rodar");
234
                                b = new YAHOO.widget.Button("i3GEOlegendabotaoQN", {
235
                                        onclick : {
236
                                                fn : i3GEOF.legenda.valorQN
237
                                        }
238
                                });
239
                                b.addClass("rodar");
240

    
241
                                b = new YAHOO.widget.Button("i3GEOlegendabotao17", {
242
                                        onclick : {
243
                                                fn : i3GEOF.legenda.alteraGeometriaTema
244
                                        }
245
                                });
246
                                b.addClass("rodar");
247
                                b =
248
                                        new YAHOO.widget.Button("i3GEOlegendabotaoSLDe", {
249
                                                onclick : {
250
                                                        fn : function() {
251
                                                                window.open(i3GEO.configura.locaplic + "/ferramentas/legenda/exec.php?funcao=tema2sld&tema="
252
                                                                        + i3GEOF.legenda.tema
253
                                                                        + "&g_sid="
254
                                                                        + i3GEO.configura.sid);
255
                                                        }
256
                                                }
257
                                        });
258
                                b.addClass("rodar");
259
                                b = new YAHOO.widget.Button("i3GEOlegendabotaoSLDi", {
260
                                        onclick : {
261
                                                fn : function() {
262
                                                        i3GEO.tema.dialogo.aplicarsld(i3GEOF.legenda.tema);
263
                                                }
264
                                        }
265
                                });
266
                                b.addClass("rodar");
267

    
268
                                b =
269
                                        new YAHOO.widget.Button("i3GEOlegendabotaoIncluirLabel", {
270
                                                onclick : {
271
                                                        fn : function() {
272
                                                                var par, p, temp, cp;
273
                                                                try {
274
                                                                        par = i3GEOF.proplabel.pegaPar();
275
                                                                        i3GEOF.legenda.parDefault = par;
276
                                                                } catch (e) {
277
                                                                        par = i3GEOF.legenda.parDefault;
278
                                                                }
279
                                                                i3GEOF.legenda.aguarde.visibility = "visible";
280
                                                                temp = function() {
281
                                                                        i3GEOF.legenda.aguarde.visibility = "hidden";
282
                                                                        i3GEOF.legenda.aposAlterarLegenda();
283
                                                                        i3GEOF.legenda.aguarde.visibility = "hidden";
284
                                                                };
285
                                                                p =
286
                                                                        i3GEO.configura.locaplic + "/ferramentas/legenda/exec.php?g_sid="
287
                                                                                + i3GEO.configura.sid
288
                                                                                + "&funcao=adicionaLabelClasse&tema="
289
                                                                                + i3GEOF.legenda.tema
290
                                                                                + "&classe="
291
                                                                                + i3GEOF.legenda.classe
292
                                                                                + par;
293
                                                                p += "&item=" + $i("i3GEOlegendaSelItemLabel").value;
294
                                                                cp = new cpaint();
295
                                                                cp.set_response_type("JSON");
296
                                                                cp.call(p, "foo", temp);
297
                                                        }
298
                                                }
299
                                        });
300
                                b.addClass("rodar100");
301
                                b =
302
                                        new YAHOO.widget.Button("i3GEOlegendabotaoExcluirLabel", {
303
                                                onclick : {
304
                                                        fn : function() {
305
                                                                var p, temp, cp;
306
                                                                i3GEOF.legenda.aguarde.visibility = "visible";
307
                                                                temp = function() {
308
                                                                        i3GEOF.legenda.aguarde.visibility = "hidden";
309
                                                                        i3GEOF.legenda.aposAlterarLegenda();
310
                                                                        i3GEOF.legenda.aguarde.visibility = "hidden";
311
                                                                };
312
                                                                p =
313
                                                                        i3GEO.configura.locaplic + "/ferramentas/legenda/exec.php?g_sid="
314
                                                                                + i3GEO.configura.sid
315
                                                                                + "&funcao=removeLabelClasse&tema="
316
                                                                                + i3GEOF.legenda.tema
317
                                                                                + "&classe="
318
                                                                                + i3GEOF.legenda.classe;
319
                                                                cp = new cpaint();
320
                                                                cp.set_response_type("JSON");
321
                                                                cp.call(p, "foo", temp);
322
                                                        }
323
                                                }
324
                                        });
325
                                b.addClass("rodar100");
326
                                b =
327
                                        new YAHOO.widget.Button("i3GEOlegendabotaoPropriedadeLabel", {
328
                                                onclick : {
329
                                                        fn : function() {
330
                                                                i3GEO.util.scriptTag(
331
                                                                        i3GEO.configura.locaplic + "/ferramentas/opcoes_label/index.js",
332
                                                                        "i3GEOF.proplabel.criaJanelaFlutuante(false)",
333
                                                                        "i3GEOFproplabel",
334
                                                                        false);
335
                                                        }
336
                                                }
337
                                        });
338
                                b.addClass("abrir100");
339
                                i3GEOF.legenda.ativaFoco();
340
                                i3GEOF.legenda.mostralegenda();
341
                                i3GEO.util.comboItens("", i3GEOF.legenda.tema, function(retorno) {
342
                                        if ($i("i3GEOlegendaitensValorUnico")) {
343
                                                $i("i3GEOlegendaitensValorUnico").innerHTML = retorno.dados;
344
                                        }
345
                                        if ($i("i3GEOlegendaClassesValorUnico")) {
346
                                                $i("i3GEOlegendaClassesValorUnico").innerHTML = retorno.dados;
347
                                        }
348
                                        if ($i("i3GEOlegendaitensValorClass")) {
349
                                                $i("i3GEOlegendaitensValorClass").innerHTML = retorno.dados;
350
                                        }
351
                                        if ($i("i3GEOlegendaitensValorQuartil")) {
352
                                                $i("i3GEOlegendaitensValorQuartil").innerHTML = retorno.dados;
353
                                        }
354
                                });
355
                                if (i3GEO.arvoreDeCamadas.pegaTema(i3GEOF.legenda.tema).classe && i3GEO.arvoreDeCamadas.pegaTema(i3GEOF.legenda.tema).classe
356
                                        .toLowerCase() == "nao") {
357
                                        $i("i3GEOFlegendamostra").checked = false;
358
                                }
359
                                $i("i3GEOFlegendamostra").onclick = function() {
360
                                        i3GEO.tema.invertestatuslegenda(i3GEOF.legenda.tema);
361
                                };
362
                                i3GEO.util.aplicaAquarela("i3GEOF.legenda_corpo");
363
                        } catch (erro) {
364
                                i3GEO.janela.tempoMsg(erro);
365
                        }
366
                        i3GEO.guias.ajustaGuiaFerramenta("i3GEOF.legenda", "i3GEOlegenda");
367
                },
368
                /*
369
                 * Function: html
370
                 *
371
                 * Gera o c&oacute;digo html para apresenta&ccedil;&atilde;o das op&ccedil;&otilde;es da ferramenta
372
                 *
373
                 * Retorno:
374
                 *
375
                 * String com o c&oacute;digo html
376
                 */
377
                html : function() {
378
                        var ins = Mustache.render(i3GEOF.legenda.MUSTACHE, i3GEOF.legenda.mustacheHash());
379
                        return ins;
380
                },
381
                /*
382
                 * Function: iniciaJanelaFlutuante
383
                 *
384
                 * Cria a janela flutuante para controle da ferramenta.
385
                 */
386
                iniciaJanelaFlutuante : function() {
387
                        var minimiza, cabecalho, janela, divid, temp, titulo;
388
                        if ($i("i3GEOF.legenda")) {
389
                                i3GEOF.legenda.tema = i3GEO.temaAtivo;
390
                                i3GEOF.legenda.inicia("i3GEOF.legenda_corpo");
391
                                return;
392
                        }
393
                        cabecalho = function() {
394
                                i3GEOF.legenda.ativaFoco();
395
                        };
396
                        minimiza = function() {
397
                                var t = i3GEO.janela.minimiza("i3GEOF.legenda", "100px");
398
                                i3GEOF.legenda.ativaAplicar("none");
399
                                if (t === "min") {
400
                                        $i("i3GEOFlegendaCabecalhoI").style.display = "none";
401
                                } else {
402
                                        $i("i3GEOFlegendaCabecalhoI").style.display = "block";
403
                                }
404
                        };
405
                        // cria a janela flutuante
406
                        titulo =
407
                                "<span class='i3GEOiconeFerramenta i3GEOiconeLegenda' title='" + $trad("t33")
408
                                        + "'></span>"
409
                                        + "<div id='i3GEOFlegendaCabecalhoI' style='left:10px;'>"
410
                                        + "<div  id='i3GEOFlegendaComboCabeca' class='comboTemasCabecalho' style='left:0px;'>   ------</div>"
411
                                        + "<div class='i3GeoTituloJanela'>"
412
                                        + $trad("t33")
413
                                        + "<a class=ajuda_usuario target=_blank href='"
414
                                        + i3GEO.configura.locaplic
415
                                        + "/ajuda_usuario.php?idcategoria=5&idajuda=41' ><b> </b></a></div></div></div>";
416
                        janela =
417
                                i3GEO.janela.cria("490px", "340px", "", "", "", titulo, "i3GEOF.legenda", false, "hd", cabecalho, minimiza, function() {
418
                                        i3GEO.guias.ajustaGuiaFerramenta("i3GEOF.legenda", "i3GEOlegenda");
419
                                }, true);
420
                        divid = janela[2].id;
421
                        i3GEOF.legenda.aguarde = $i("i3GEOF.legenda_imagemCabecalho").style;
422
                        $i("i3GEOF.legenda_corpo").style.backgroundColor = "white";
423
                        i3GEOF.legenda.inicia(divid);
424
                        temp =
425
                                function() {
426
                                        if (i3GEO.eventos.ATUALIZAARVORECAMADAS.toString().search(
427
                                                'i3GEO.janela.comboCabecalhoTemas("i3GEOFlegendaComboCabeca","i3GEOFlegendaComboCabecaSel","legenda","ligados")') > 0) {
428
                                                i3GEO.eventos.ATUALIZAARVORECAMADAS
429
                                                        .remove('i3GEO.janela.comboCabecalhoTemas("i3GEOFlegendaComboCabeca","i3GEOFlegendaComboCabecaSel","legenda","ligados")');
430
                                        }
431
                                };
432
                        YAHOO.util.Event.addListener(janela[0].close, "click", temp);
433
                },
434
                /*
435
                 * Function: ativaFoco
436
                 *
437
                 * Refaz a interface da ferramenta quando a janela flutuante tem seu foco ativado
438
                 */
439
                ativaFoco : function() {
440
                        if (i3GEOF.legenda.tema !== "" && i3GEO.arvoreDeCamadas.pegaTema(i3GEOF.legenda.tema) === "") {
441
                                i3GEO.janela.tempoMsg($trad('temaInexistente', i3GEOF.legenda.dicionario));
442
                        }
443
                        var i = $i("i3GEOF.legenda_c").style;
444
                        i.zIndex = i3GEO.janela.ULTIMOZINDEX;
445
                        i3GEO.janela.ULTIMOZINDEX++;
446
                },
447
                ativaAplicar : function(tipo) {
448
                        var b = $i("i3GEOlegendabotao10");
449
                        if (b) {
450
                                b.style.display = tipo;
451
                        } else {
452
                                YAHOO.i3GEO.janela.manager.find("i3GEOF.legenda").setFooter(
453
                                        '<input id="i3GEOlegendabotao10" type="button" value="' + $trad('aplicaAlteracoes', i3GEOF.legenda.dicionario)
454
                                                + '" style="width: 450px;cursor:pointer;color:blue;display: block;"/>');
455
                                b = new YAHOO.widget.Button("i3GEOlegendabotao10", {
456
                                        onclick : {
457
                                                fn : i3GEOF.legenda.aplicaEstilo
458
                                        }
459
                                });
460
                                b.addClass("rodar");
461
                                $i("i3GEOlegendabotao10-button").style.width = "100%";
462
                                $i("i3GEOlegendabotao10").style.width = "100%";
463
                        }
464
                },
465
                /*
466
                 * Function: aposAlterarLegenda
467
                 *
468
                 * Fun&ccedil;&atilde;o executada ap&oacute;s ocorrer alguma altera&ccedil;&atilde;o efetiva da legenda do mapa
469
                 */
470
                aposAlterarLegenda : function() {
471
                        i3GEO.atualiza();
472
                        i3GEO.Interface.atualizaTema("", i3GEOF.legenda.tema);
473
                        i3GEO.arvoreDeCamadas.atualizaLegenda(i3GEOF.legenda.tema);
474
                        i3GEO.mapa.legendaHTML.atualiza();
475
                },
476
                /*
477
                 * Function: mostralegenda
478
                 *
479
                 * Pega os dados da legenda do mapa atual e mostra na tela
480
                 *
481
                 * Veja:
482
                 *
483
                 * <EDITALEGENDA>
484
                 */
485
                mostralegenda : function() {
486
                        if (i3GEOF.legenda.aguarde.visibility === "visible") {
487
                                return;
488
                        }
489
                        i3GEOF.legenda.aguarde.visibility = "visible";
490
                        var p, cp;
491
                        p =
492
                                i3GEO.configura.locaplic + "/ferramentas/legenda/exec.php?g_sid="
493
                                        + i3GEO.configura.sid
494
                                        + "&funcao=editalegenda&opcao=edita&tema="
495
                                        + i3GEOF.legenda.tema;
496
                        cp = new cpaint();
497
                        cp.set_response_type("JSON");
498
                        cp.call(p, "tabelaLegenda", i3GEOF.legenda.montaLegenda);
499
                },
500
                /*
501
                 * Function: montaLegenda
502
                 *
503
                 * Formata a tabela de edi&ccedil;&atilde;o da legenda
504
                 *
505
                 * Parametro:
506
                 *
507
                 * retorno - objeto contendo os dados para formata&ccedil;&atilde;o da legenda
508
                 */
509
                montaLegenda : function(retorno) {
510
                        i3GEOF.legenda.aviso = false;
511
                        try {
512
                                if (retorno.data != undefined) {
513
                                        var b, ins, i, ajuda, id, re, exp, n, filtro;
514
                                        // se nao for do tipo raster
515
                                        if (retorno.data[0].proc === "") {
516
                                                ins =
517
                                                        [
518
                                                                "<table class=lista4 id=i3GEOlegendalegenda ><tr>" + "<td><img src='"
519
                                                                        + i3GEO.configura.locaplic
520
                                                                        + "/imagens/inverter.png' title='Inverter cores' onclick='i3GEOF.legenda.inverteCores()' style=cursor:pointer /></td>"
521
                                                                        + "<td style=background-color:white ><img src='"
522
                                                                        + i3GEO.configura.locaplic
523
                                                                        + "/imagens/tamanho.png' title='Calcula tamanho' onclick='i3GEOF.legenda.calculaTamanho()' style=cursor:pointer /></td>"
524
                                                                        + "<td></td>"
525
                                                                        + "<td style=background-color:yellow >"
526
                                                                        + "<img src='"
527
                                                                        + i3GEO.configura.locaplic
528
                                                                        + "/imagens/oxygen/16x16/draw-triangle.png' title='Ordenar' onclick='i3GEOF.legenda.ordenaClasses()' style=cursor:pointer />"
529
                                                                        + "<span style='vertical-align:super;margin-left:3px;'>nome</span></td>"
530
                                                                        + "<td style=background-color:yellow >express&atilde;o</td>"
531
                                                                        + "<td style=background-color:yellow ></td>"
532
                                                                        + "<td style=background-color:yellow >minScale</td>"
533
                                                                        + "<td style=background-color:yellow >maxScale</td>"
534
                                                                        + "</tr>"
535
                                                        ];
536
                                                n = retorno.data.length;
537
                                                for (i = 0; i < n; i++) {
538
                                                        id = retorno.data[i].tema + "-" + retorno.data[i].idclasse; // layer+indice da classe
539
                                                        re = new RegExp("'", "g");
540
                                                        exp = (retorno.data[i].expressao).replace(re, '"');
541

    
542
                                                        ins.push("<tr>");
543
                                                        ins.push("<td><div style='cursor:pointer' title='" + $trad('cliqueExclui', i3GEOF.legenda.dicionario)
544
                                                                + "' onclick='i3GEOF.legenda.excluilinhaf(this)' src='"
545
                                                                + i3GEO.configura.locaplic
546
                                                                + "/imagens/x.gif' title='excluir' class='i3GEOiconeXis' >&nbsp;</div></td>");
547

    
548
                                                        ins.push("<td><img width='30px' height='15px' style='cursor:pointer' title='" + $trad(
549
                                                                'cliqueAltera',
550
                                                                i3GEOF.legenda.dicionario)
551
                                                                + "' src='"
552
                                                                + retorno.data[i].imagem
553
                                                                + "' onclick=i3GEOF.legenda.editaSimbolo('i3GEOlegendaid_"
554
                                                                + id
555
                                                                + "') /></td>");
556

    
557
                                                        ins.push("<td><img onclick=i3GEOF.legenda.modificaCor('" + retorno.data[i].idclasse
558
                                                                + "') title='alterar a cor' style='cursor:pointer' src='"
559
                                                                + i3GEO.configura.locaplic
560
                                                                + "/imagens/aquarela.gif' /></td>");
561

    
562
                                                        ins.push("<td>" + $inputText(
563
                                                                "",
564
                                                                "",
565
                                                                "i3GEOlegendaid_" + id,
566
                                                                $trad('digitaNovoNome', i3GEOF.legenda.dicionario),
567
                                                                20,
568
                                                                retorno.data[i].nomeclasse,
569
                                                                "nome",
570
                                                                "javascript:i3GEOF.legenda.aviso()")
571
                                                                + "</td>");
572

    
573
                                                        filtro =
574
                                                                "<img title='" + $trad("editorExp", i3GEOF.legenda.dicionario)
575
                                                                        + "' src='"
576
                                                                        + i3GEO.configura.locaplic
577
                                                                        + "/imagens/oxygen/16x16/tools-wizard.png' "
578
                                                                        + "onclick='i3GEOF.legenda.filtro(\""
579
                                                                        + "i3GEOlegendaid_exp"
580
                                                                        + id
581
                                                                        + "\")'>";
582

    
583
                                                        ins.push("<td>" + $inputText("", "", "i3GEOlegendaid_exp" + id, $trad(
584
                                                                'digitaNovaExpressao',
585
                                                                i3GEOF.legenda.dicionario), 25, exp, "expressao", "javascript:i3GEOF.legenda.aviso()")
586
                                                                + "</td>");
587

    
588
                                                        ins.push("<td>" + filtro + "</td>");
589

    
590
                                                        ins.push("<td>" + $inputText(
591
                                                                "",
592
                                                                "",
593
                                                                "i3GEOlegendaid_" + id,
594
                                                                $trad('minScale', i3GEOF.legenda.dicionario),
595
                                                                10,
596
                                                                retorno.data[i].minScale,
597
                                                                "minScale",
598
                                                                "javascript:i3GEOF.legenda.aviso()")
599
                                                                + "</td>");
600

    
601
                                                        ins.push("<td>" + $inputText(
602
                                                                "",
603
                                                                "",
604
                                                                "i3GEOlegendaid_" + id,
605
                                                                $trad('maxScale', i3GEOF.legenda.dicionario),
606
                                                                10,
607
                                                                retorno.data[i].maxScale,
608
                                                                "maxScale",
609
                                                                "javascript:i3GEOF.legenda.aviso()")
610
                                                                + "</td>");
611

    
612
                                                        if (n > 1) {
613
                                                                ins.push("<td><img src='" + i3GEO.configura.locaplic
614
                                                                        + "/imagens/sobe1.png' style=cursor:pointer title='"
615
                                                                        + $trad('sobe', i3GEOF.legenda.dicionario)
616
                                                                        + "' onclick=i3GEOF.legenda.sobelinhaf('"
617
                                                                        + retorno.data[i].idclasse
618
                                                                        + "') /></td>");
619

    
620
                                                                ins.push("<td><img src='" + i3GEO.configura.locaplic
621
                                                                        + "/imagens/desce1.png' style=cursor:pointer title='"
622
                                                                        + $trad('desce', i3GEOF.legenda.dicionario)
623
                                                                        + "' onclick=i3GEOF.legenda.descelinhaf('"
624
                                                                        + retorno.data[i].idclasse
625
                                                                        + "') /></td>");
626
                                                        }
627
                                                        ins.push("</tr>");
628
                                                }
629
                                                ins.push("</table><br>");
630
                                                $i("i3GEOlegendaresultado").innerHTML = ins.join("");
631
                                        } else {
632
                                                ajuda =
633
                                                        "<br><p class=paragrafo >" + $trad('ajudaEscalaCores', i3GEOF.legenda.dicionario)
634
                                                                + "<p class=paragrafo >"
635
                                                                + $trad('msgEscalaCoresAuto', i3GEOF.legenda.dicionario)
636
                                                                + "<p class=paragrafo >"
637
                                                                + $trad('msgEscalaCoresIndividual', i3GEOF.legenda.dicionario)
638
                                                                + "<p class=paragrafo >"
639
                                                                + $trad('msgBandas', i3GEOF.legenda.dicionario)
640
                                                                + "<p class=paragrafo >"
641
                                                                + $trad('msgReamostragem', i3GEOF.legenda.dicionario);
642
                                                ins =
643
                                                        "<p class=paragrafo >" + $trad('adicionaProcesso', i3GEOF.legenda.dicionario)
644
                                                                + ":"
645
                                                                + "<select onchange=i3GEOF.legenda.adicionaProcesso(this) >"
646
                                                                + "<option value='' >"
647
                                                                + $trad('selecionaProcesso', i3GEOF.legenda.dicionario)
648
                                                                + "</option>"
649
                                                                + "<option value='SCALE=' >"
650
                                                                + $trad('escalaCores', i3GEOF.legenda.dicionario)
651
                                                                + "</option>"
652
                                                                + "<option value='RESAMPLE=' >"
653
                                                                + $trad('reamostragem', i3GEOF.legenda.dicionario)
654
                                                                + "</option>"
655
                                                                + "<option value='BANDS=' >"
656
                                                                + $trad('bandas', i3GEOF.legenda.dicionario)
657
                                                                + "</option>"
658
                                                                + "<option value='COLOR_MATCH_THRESHOLD=' >Threshold</option>"
659
                                                                + "<option value='NODATA=' >Nodata</option>"
660
                                                                + "</select><br>"
661
                                                                + '<p class=paragrafo ><input id=i3GEOlegendabotao16 class="executar" size="22" type="buttom" value="'
662
                                                                + $trad('aplicaProcesso', i3GEOF.legenda.dicionario)
663
                                                                + '">';
664
                                                if (retorno.data[0].proc == "") {
665
                                                        ins += "<div style=width:80% id=i3GEOlegendaprocessos ></div>";
666
                                                } else {
667
                                                        ins += "<div style='width:80%;text-align:left;' id=i3GEOlegendaprocessos >";
668
                                                        for (i = 0; i < retorno.data[0].proc.length; i++) {
669
                                                                ins += "<br>" + $inputText("", "", "", "", 50, retorno.data[0].proc[i]);
670
                                                        }
671
                                                        ins += "</div>";
672
                                                }
673
                                                $i("i3GEOlegendaresultado").innerHTML = ins + ajuda;
674
                                                b = new YAHOO.widget.Button("i3GEOlegendabotao16", {
675
                                                        onclick : {
676
                                                                fn : i3GEOF.legenda.aplicaProcessos
677
                                                        }
678
                                                });
679
                                                b.addClass("rodar");
680
                                        }
681
                                } else {
682
                                        $i("i3GEOlegendaresultado").innerHTML = "<p style=color:red >Erro<br>";
683
                                }
684
                                i3GEOF.legenda.aguarde.visibility = "hidden";
685
                        } catch (e) {
686
                                i3GEO.janela.tempoMsg($trad('msgNaoEditaLegenda', i3GEOF.legenda.dicionario));
687
                                i3GEOF.legenda.aguarde.visibility = "hidden";
688
                        }
689
                },
690
                filtro : function(idRetorno) {
691
                        i3GEO.tema.dialogo.filtro(i3GEOF.legenda.tema, true, idRetorno);
692
                },
693
                /*
694
                 * Function: aviso
695
                 *
696
                 * Mostra um i3GEO.janela.tempoMsga ao usu&aacute;rio quando um campo da tabela que cont&eacute;m os dados da legenda &eacute;
697
                 * alterado
698
                 *
699
                 * O aviso &eacute; mostrado apenas uma vez
700
                 */
701
                aviso : function() {
702
                        if (i3GEOF.legenda.aviso == true) {
703
                                i3GEO.janela.tempoMsg($trad('msgAplicaAlteracao', i3GEOF.legenda.dicionario));
704
                                i3GEOF.legenda.aviso == false;
705
                        }
706
                },
707
                /*
708
                 * Function: aplicaColourRamp
709
                 *
710
                 * Aplica nas classes da legenda as cores escolhidas no seletor de cores
711
                 */
712
                aplicaColourRamp : function() {
713
                        if ($i("listaColourRamp").value != "") {
714
                                if (i3GEOF.legenda.aguarde.visibility === "visible") {
715
                                        return;
716
                                }
717
                                i3GEOF.legenda.aguarde.visibility = "visible";
718
                                var cores = $i("listaColourRamp").value, ext = i3GEO.util.extOSM2Geo(i3GEO.parametros.mapexten), temp = function() {
719
                                        i3GEOF.legenda.aguarde.visibility = "hidden";
720
                                        i3GEOF.legenda.mostralegenda();
721
                                        i3GEOF.legenda.aposAlterarLegenda();
722
                                }, p =
723
                                        i3GEO.configura.locaplic + "/classesphp/mapa_controle.php?g_sid="
724
                                                + i3GEO.configura.sid
725
                                                + "&funcao=alteraclasse&opcao=aplicacoresrgb&ext="
726
                                                + ext
727
                                                + "&tema="
728
                                                + i3GEOF.legenda.tema, cp = new cpaint();
729
                                cp.set_transfer_mode('POST');
730
                                cp.set_response_type("JSON");
731
                                cp.call(p, "foo", temp, "cores=" + cores);
732
                        }
733
                },
734
                /*
735
                 * Function: corj
736
                 *
737
                 * Abre a janela para o usu&aacute;rio selecionar uma cor interativamente
738
                 */
739
                corj : function(obj) {
740
                        i3GEO.util.abreCor("", obj);
741
                },
742
                /*
743
                 * Function: modificaCor
744
                 *
745
                 * Modifica a cor de uma classe
746
                 */
747
                modificaCor : function(id) {
748
                        var obj = $i("tempCorLegenda");
749
                        if (!obj) {
750
                                var obj = document.createElement("input");
751
                                obj.id = "tempCorLegenda";
752
                                obj.style.display = "none";
753
                                obj.type = "text";
754
                                obj.value = "";
755
                                document.body.appendChild(obj);
756
                                obj.onchange = function() {
757
                                        i3GEOF.legenda.aplicaNovaCor($i("tempCorLegenda").name);
758
                                };
759
                        }
760
                        obj.name = id;
761
                        i3GEO.util.abreCor("", "tempCorLegenda");
762
                },
763
                aplicaNovaCor : function(id) {
764
                        if (i3GEOF.legenda.aguarde.visibility === "visible") {
765
                                return;
766
                        }
767
                        i3GEOF.legenda.aguarde.visibility = "visible";
768
                        var retorna = function() {
769
                                i3GEOF.legenda.aposAlterarLegenda();
770
                                i3GEOF.legenda.aguarde.visibility = "hidden";
771
                                i3GEOF.legenda.mostralegenda();
772
                        };
773
                        i3GEO.php.aplicaCorClasseTema(retorna, i3GEOF.legenda.tema, id, $i("tempCorLegenda").value);
774
                },
775
                /*
776
                 * Function: mudaLegenda
777
                 *
778
                 * Altera a legenda conforme os valores existentes na tabela de propriedades (express&atilde;o e nome da classe)
779
                 *
780
                 * Veja:
781
                 *
782
                 * <ALTERACLASSE>
783
                 */
784
                mudaLegenda : function() {
785
                        i3GEOF.legenda.aviso = false;
786
                        if (i3GEOF.legenda.aguarde.visibility === "visible") {
787
                                return;
788
                        }
789
                        i3GEOF.legenda.aguarde.visibility = "visible";
790
                        try {
791
                                var tabela = $i("i3GEOlegendalegenda"), trs = tabela.getElementsByTagName("tr"), minScales = [], maxScales = [], nomes = [], exps =
792
                                        [], ids = [], t, nn, n, p, cp, temp;
793
                                // expn,
794
                                // re = new RegExp('"', "g");
795
                                for (t = 0; t < trs.length; t++) {
796
                                        if (trs[t].childNodes) {
797
                                                nn = trs[t].childNodes;
798
                                                for (n = 0; n < nn.length; n++) {
799
                                                        if (nn[n].childNodes) {
800
                                                                var isn = nn[n].getElementsByTagName("input");
801
                                                                if (isn[0] != undefined) {
802
                                                                        if (isn[0].name == "nome") {
803
                                                                                nomes.push(isn[0].value);
804
                                                                                temp = (isn[0].id).split("i3GEOlegendaid_");
805
                                                                                ids.push(temp[1]);
806
                                                                        }
807
                                                                        if (isn[0].name == "expressao") {
808
                                                                                exps.push(isn[0].value);
809
                                                                        }
810
                                                                        if (isn[0].name == "minScale") {
811
                                                                                minScales.push(parseInt(isn[0].value, 10));
812
                                                                        }
813
                                                                        if (isn[0].name == "maxScale") {
814
                                                                                maxScales.push(parseInt(isn[0].value, 10));
815
                                                                        }
816
                                                                }
817
                                                        }
818
                                                }
819
                                        }
820
                                }
821
                                ids = ids.join(";");
822
                                nomes = nomes.join(";");
823
                                exps = exps.join(";");
824
                                minScales = minScales.join(";");
825
                                maxScales = maxScales.join(";");
826
                                temp = function() {
827
                                        i3GEOF.legenda.aguarde.visibility = "hidden";
828
                                        i3GEOF.legenda.mostralegenda();
829
                                        i3GEOF.legenda.aposAlterarLegenda();
830
                                        i3GEOF.legenda.aguarde.visibility = "hidden";
831
                                };
832
                                var ext = i3GEO.util.extOSM2Geo(i3GEO.parametros.mapexten);
833
                                p =
834
                                        i3GEO.configura.locaplic + "/classesphp/mapa_controle.php?"
835
                                                + "base64=sim"
836
                                                + "&g_sid="
837
                                                + i3GEO.configura.sid
838
                                                + "&funcao=alteraclasse"
839
                                                + "&opcao=alteraclasses"
840
                                                + "&ext="
841
                                                + ext;
842
                                cp = new cpaint();
843
                                cp.set_transfer_mode('POST');
844
                                cp.set_response_type("JSON");
845
                                cp.call(p, "alteraclassesPost", temp, "ids=" + i3GEO.util.base64encode(ids)
846
                                        + "&nomes="
847
                                        + i3GEO.util.base64encode(nomes)
848
                                        + "&exps="
849
                                        + i3GEO.util.base64encode(exps)
850
                                        + "&minScales="
851
                                        + minScales
852
                                        + "&maxScales="
853
                                        + maxScales);
854
                        } catch (e) {
855
                                i3GEO.janela.tempoMsg("Erro: " + e);
856
                                i3GEOF.legenda.aguarde.visibility = "hidden";
857
                        }
858
                },
859
                /*
860
                 * Function: alteraGeometria
861
                 *
862
                 * Altera o tipo de representa&ccedil;&atilde;o geom&eacute;trica dos elementos de um layer
863
                 *
864
                 * Veja:
865
                 *
866
                 * <ALTERACLASSE>
867
                 */
868
                alteraGeometriaTema : function() {
869
                        if (i3GEOF.legenda.aguarde.visibility === "visible") {
870
                                return;
871
                        }
872
                        i3GEOF.legenda.aguarde.visibility = "visible";
873
                        var retorna = function() {
874
                                i3GEOF.legenda.aposAlterarLegenda();
875
                                i3GEOF.legenda.aguarde.visibility = "hidden";
876
                                i3GEOF.legenda.mostralegenda();
877
                        };
878
                        var p =
879
                                i3GEO.configura.locaplic + "/classesphp/mapa_controle.php?g_sid="
880
                                        + i3GEO.configura.sid
881
                                        + "&funcao=alteraclasse&opcao=alterageometria&tema="
882
                                        + i3GEOF.legenda.tema
883
                                        + "&tipo="
884
                                        + $i("i3GEOlegentaTipoGeo").value, cp = new cpaint();
885
                        cp.set_response_type("JSON");
886
                        cp.call(p, "", retorna);
887
                },
888
                /*
889
                 * Function: adicionaConta
890
                 *
891
                 * Adiciona ao nome de cada classe o n&uacute;mero de ocorr&ecirc;ncias em cada uma
892
                 *
893
                 * Veja:
894
                 *
895
                 * <CONTAGEMCLASSE>
896
                 */
897
                adicionaConta : function() {
898
                        if (i3GEOF.legenda.aguarde.visibility === "visible") {
899
                                return;
900
                        }
901
                        i3GEOF.legenda.aguarde.visibility = "visible";
902
                        var p =
903
                                i3GEO.configura.locaplic + "/ferramentas/legenda/exec.php?g_sid="
904
                                        + i3GEO.configura.sid
905
                                        + "&funcao=contagemclasse"
906
                                        + "&tema="
907
                                        + i3GEOF.legenda.tema, cp = new cpaint();
908
                        cp.set_response_type("JSON");
909
                        cp.call(p, "contagemclasse", i3GEOF.legenda.montaLegenda);
910
                        i3GEO.janela.tempoMsg($trad('consideraElementosVisiveis', i3GEOF.legenda.dicionario));
911
                },
912
                /*
913
                 * Function: adicionaClasse
914
                 *
915
                 * Adiciona uma nova classe ao tema
916
                 *
917
                 * Veja:
918
                 *
919
                 * <ALTERACLASSE>
920
                 */
921
                adicionaClasse : function() {
922
                        if (i3GEOF.legenda.aguarde.visibility === "visible") {
923
                                return;
924
                        }
925
                        var ext = i3GEO.util.extOSM2Geo(i3GEO.parametros.mapexten);
926
                        var p =
927
                                i3GEO.configura.locaplic + "/classesphp/mapa_controle.php?g_sid="
928
                                        + i3GEO.configura.sid
929
                                        + "&funcao=alteraclasse&opcao=adicionaclasse"
930
                                        + "&tema="
931
                                        + i3GEOF.legenda.tema
932
                                        + "&ext="
933
                                        + ext, cp = new cpaint();
934
                        cp.set_response_type("JSON");
935
                        cp.call(p, "alteraclasse", i3GEOF.legenda.mostralegenda);
936
                },
937
                /*
938
                 * Function: adicionaOpacidade
939
                 *
940
                 * Adiciona opacidade vari&aacute;vel em cada classe
941
                 *
942
                 * Veja:
943
                 *
944
                 * <ALTERACLASSE>
945
                 */
946
                adicionaOpacidade : function() {
947
                        var retorna = function() {
948
                                i3GEOF.legenda.aposAlterarLegenda();
949
                                i3GEOF.legenda.aguarde.visibility = "hidden";
950
                                i3GEOF.legenda.mostralegenda();
951
                        };
952
                        if (i3GEOF.legenda.aguarde.visibility === "visible") {
953
                                return;
954
                        }
955
                        var ext = i3GEO.util.extOSM2Geo(i3GEO.parametros.mapexten);
956
                        var p =
957
                                i3GEO.configura.locaplic + "/classesphp/mapa_controle.php?g_sid="
958
                                        + i3GEO.configura.sid
959
                                        + "&funcao=alteraclasse&opcao=adicionaopacidade"
960
                                        + "&tema="
961
                                        + i3GEOF.legenda.tema
962
                                        + "&ext="
963
                                        + ext, cp = new cpaint();
964
                        cp.set_response_type("JSON");
965
                        cp.call(p, "alteraclasse", retorna);
966
                },
967
                /*
968
                 * Function: paleta
969
                 *
970
                 * Gera as cores para as classes considerando um RGB inicial e um final
971
                 *
972
                 * Veja:
973
                 *
974
                 * <ALTERACORESCLASSES>
975
                 */
976
                paleta : function() {
977
                        try {
978
                                if (i3GEOF.legenda.aguarde.visibility === "visible") {
979
                                        return;
980
                                }
981
                                i3GEOF.legenda.aguarde.visibility = "visible";
982
                                var retornapaleta = function() {
983
                                        i3GEOF.legenda.aposAlterarLegenda();
984
                                        i3GEOF.legenda.aguarde.visibility = "hidden";
985
                                        i3GEOF.legenda.mostralegenda();
986
                                }, ci = $i("i3GEOlegendaacori").value, cf = $i("i3GEOlegendaacorf").value, cp = new cpaint(), p =
987
                                        i3GEO.configura.locaplic + "/classesphp/mapa_controle.php?g_sid="
988
                                                + i3GEO.configura.sid
989
                                                + "&funcao=alteraCoresClasses&tema="
990
                                                + i3GEOF.legenda.tema
991
                                                + "&cori="
992
                                                + ci
993
                                                + "&corf="
994
                                                + cf;
995
                                cp.set_response_type("JSON");
996
                                cp.call(p, "alteraCoresClasses", retornapaleta);
997
                        } catch (e) {
998
                                i3GEO.janela.tempoMsg("Erro: " + e);
999
                                i3GEOF.legenda.aguarde.visibility = "hidden";
1000
                        }
1001
                },
1002
                /*
1003
                 * Function: inverteCores
1004
                 *
1005
                 * Inverte as cores utilizadas nos s&iacute;mbolos das classes
1006
                 *
1007
                 * Veja:
1008
                 *
1009
                 * <INVERTECORESCLASSES>
1010
                 */
1011
                inverteCores : function() {
1012
                        try {
1013
                                if (i3GEOF.legenda.aguarde.visibility === "visible") {
1014
                                        return;
1015
                                }
1016
                                i3GEOF.legenda.aguarde.visibility = "visible";
1017
                                var retornapaleta = function() {
1018
                                        i3GEOF.legenda.aposAlterarLegenda();
1019
                                        i3GEOF.legenda.aguarde.visibility = "hidden";
1020
                                        i3GEOF.legenda.mostralegenda();
1021
                                }, cp = new cpaint(), p =
1022
                                        i3GEO.configura.locaplic + "/classesphp/mapa_controle.php?g_sid="
1023
                                                + i3GEO.configura.sid
1024
                                                + "&funcao=inverteCoresClasses&tema="
1025
                                                + i3GEOF.legenda.tema;
1026
                                cp.set_response_type("JSON");
1027
                                cp.call(p, "alteraCoresClasses", retornapaleta);
1028
                        } catch (e) {
1029
                                i3GEO.janela.tempoMsg("Erro: " + e);
1030
                                i3GEOF.legenda.aguarde.visibility = "hidden";
1031
                        }
1032
                },
1033
                /*
1034
                 * Function: calculaTamanho
1035
                 *
1036
                 * Muda o s&iacute;mbolo de cada classe aplicando tamanhos diferentes e lineares
1037
                 *
1038
                 * Veja:
1039
                 *
1040
                 * <CALCULATAMANHOCLASSES>
1041
                 */
1042
                calculaTamanho : function() {
1043
                        try {
1044
                                if (i3GEOF.legenda.aguarde.visibility === "visible") {
1045
                                        return;
1046
                                }
1047
                                i3GEOF.legenda.aguarde.visibility = "visible";
1048
                                var retornapaleta = function() {
1049
                                        i3GEOF.legenda.aposAlterarLegenda();
1050
                                        i3GEOF.legenda.aguarde.visibility = "hidden";
1051
                                        i3GEOF.legenda.mostralegenda();
1052
                                }, cp = new cpaint(), p =
1053
                                        i3GEO.configura.locaplic + "/classesphp/mapa_controle.php?g_sid="
1054
                                                + i3GEO.configura.sid
1055
                                                + "&funcao=calculaTamanhoClasses&tema="
1056
                                                + i3GEOF.legenda.tema;
1057
                                cp.set_response_type("JSON");
1058
                                cp.call(p, "calculaTamanhoClasses", retornapaleta);
1059
                        } catch (e) {
1060
                                i3GEO.janela.tempoMsg("Erro: " + e);
1061
                                i3GEOF.legenda.aguarde.visibility = "hidden";
1062
                        }
1063
                },
1064
                /*
1065
                 * Function: ordenaClasses
1066
                 *
1067
                 * Ordena as classes pelo nome
1068
                 *
1069
                 */
1070
                ordenaClasses : function() {
1071
                        try {
1072
                                if (i3GEOF.legenda.aguarde.visibility === "visible") {
1073
                                        return;
1074
                                }
1075
                                i3GEOF.legenda.aguarde.visibility = "visible";
1076
                                var retornapaleta = function() {
1077
                                        i3GEOF.legenda.aposAlterarLegenda();
1078
                                        i3GEOF.legenda.aguarde.visibility = "hidden";
1079
                                        i3GEOF.legenda.mostralegenda();
1080
                                }, cp = new cpaint(), p =
1081
                                        i3GEO.configura.locaplic + "/classesphp/mapa_controle.php?g_sid="
1082
                                                + i3GEO.configura.sid
1083
                                                + "&funcao=ordenaClasses&tema="
1084
                                                + i3GEOF.legenda.tema;
1085
                                cp.set_response_type("JSON");
1086
                                cp.call(p, "foo", retornapaleta);
1087
                        } catch (e) {
1088
                                i3GEO.janela.tempoMsg("Erro: " + e);
1089
                                i3GEOF.legenda.aguarde.visibility = "hidden";
1090
                        }
1091
                },
1092
                /*
1093
                 * Function: excluilinhaf
1094
                 *
1095
                 * Exclui uma linha da tabela de edi&ccedil;&atilde;o de classes da legendda
1096
                 */
1097
                excluilinhaf : function(celula) {
1098
                        var p = celula.parentNode.parentNode;
1099
                        do {
1100
                                p.removeChild(p.childNodes[0]);
1101
                        } while (p.childNodes.length > 0);
1102
                        p.parentNode.removeChild(p);
1103
                        i3GEOF.legenda.mudaLegenda();
1104
                },
1105
                /*
1106
                 * Function: sobelinhaf
1107
                 *
1108
                 * Sobe uma linha na tabela de edi&ccedil;&atilde;o de classes da legendda
1109
                 */
1110
                sobelinhaf : function(idclasse) {
1111
                        if (i3GEOF.legenda.aguarde.visibility === "visible") {
1112
                                return;
1113
                        }
1114
                        i3GEOF.legenda.aguarde.visibility = "visible";
1115
                        var p =
1116
                                i3GEO.configura.locaplic + "/classesphp/mapa_controle.php?g_sid="
1117
                                        + i3GEO.configura.sid
1118
                                        + "&funcao=ALTERACLASSE&opcao=sobeclasse&tema="
1119
                                        + i3GEOF.legenda.tema
1120
                                        + "&idclasse="
1121
                                        + idclasse, cp = new cpaint(), temp = function() {
1122
                                i3GEOF.legenda.aguarde.visibility = "hidden";
1123
                                i3GEOF.legenda.mostralegenda();
1124
                        };
1125
                        cp.set_response_type("JSON");
1126
                        cp.call(p, "foo", temp);
1127
                },
1128
                /*
1129
                 * Function: descelinhaf
1130
                 *
1131
                 * Desce uma linha na tabela de edi&ccedil;&atilde;o de classes da legendda
1132
                 */
1133
                descelinhaf : function(idclasse) {
1134
                        if (i3GEOF.legenda.aguarde.visibility === "visible") {
1135
                                return;
1136
                        }
1137
                        i3GEOF.legenda.aguarde.visibility = "visible";
1138
                        var p =
1139
                                i3GEO.configura.locaplic + "/classesphp/mapa_controle.php?g_sid="
1140
                                        + i3GEO.configura.sid
1141
                                        + "&funcao=ALTERACLASSE&opcao=desceclasse&tema="
1142
                                        + i3GEOF.legenda.tema
1143
                                        + "&idclasse="
1144
                                        + idclasse, cp = new cpaint(), temp = function() {
1145
                                i3GEOF.legenda.aguarde.visibility = "hidden";
1146
                                i3GEOF.legenda.mostralegenda();
1147
                        };
1148
                        ;
1149
                        cp.set_response_type("JSON");
1150
                        cp.call(p, "foo", temp);
1151
                },
1152
                /*
1153
                 * Function: editaSimbolo
1154
                 *
1155
                 * Abre o editor de s&iacute;mbolos
1156
                 *
1157
                 * Veja:
1158
                 *
1159
                 * <EDITASIMBOLO>
1160
                 */
1161
                editaSimbolo : function(id) {
1162
                        try {
1163
                                $i("i3GEOlegendaguia1obj").style.display = "none";
1164
                                $i("i3GEOlegendaguia3obj").style.display = "block";
1165
                                i3GEOF.legenda.ativaAplicar("block");
1166
                                id = id.split("-");
1167
                                i3GEOF.legenda.classe = id[1];
1168
                                i3GEOF.legenda.estilo = 0;
1169
                                i3GEOF.legenda.formEditorSimbolo();
1170
                                i3GEOF.legenda.aguarde.visibility = "hidden";
1171
                        } catch (e) {
1172
                                i3GEO.janela.tempoMsg("Erro: " + e);
1173
                                i3GEOF.legenda.aguarde.visibility = "hidden";
1174
                        }
1175
                },
1176
                formEditorSimbolo : function() {
1177
                        var p =
1178
                                i3GEO.configura.locaplic + "/classesphp/mapa_controle.php?g_sid="
1179
                                        + i3GEO.configura.sid
1180
                                        + "&funcao=editasimbolo&opcao=pegaparametros&tema="
1181
                                        + i3GEOF.legenda.tema
1182
                                        + "&classe="
1183
                                        + i3GEOF.legenda.classe, cp = new cpaint();
1184
                        cp.set_response_type("JSON");
1185
                        cp.call(p, "pegaParametrosMapa", i3GEOF.legenda.montaEditor);
1186
                },
1187
                /*
1188
                 * Function: simbU
1189
                 *
1190
                 * Altera a leganda do tema para o tipo s&iacute;mbolo &uacute;nico
1191
                 *
1192
                 * Veja:
1193
                 *
1194
                 * <ALTERACLASSE>
1195
                 */
1196
                simbU : function() {
1197
                        try {
1198
                                if (i3GEOF.legenda.aguarde.visibility === "visible") {
1199
                                        return;
1200
                                }
1201
                                i3GEOF.legenda.aguarde.visibility = "visible";
1202
                                var ext = i3GEO.util.extOSM2Geo(i3GEO.parametros.mapexten);
1203
                                var p =
1204
                                        i3GEO.configura.locaplic + "/classesphp/mapa_controle.php?g_sid="
1205
                                                + i3GEO.configura.sid
1206
                                                + "&funcao=alteraclasse&tema="
1207
                                                + i3GEOF.legenda.tema
1208
                                                + "&opcao=simbolounico&ext="
1209
                                                + ext, cp = new cpaint(), fim = function() {
1210
                                        i3GEOF.legenda.aposAlterarLegenda();
1211
                                        i3GEOF.legenda.aguarde.visibility = "hidden";
1212
                                };
1213
                                cp.set_response_type("JSON");
1214
                                cp.call(p, "alteraclasse", fim);
1215
                        } catch (e) {
1216
                                i3GEO.janela.tempoMsg("Erro: " + e);
1217
                                i3GEOF.legenda.aguarde.visibility = "hidden";
1218
                        }
1219
                },
1220
                /*
1221
                 * Function: valorU
1222
                 *
1223
                 * Altera a leganda do tema para o tipo valor &uacute;nico
1224
                 *
1225
                 * Veja:
1226
                 *
1227
                 * <ALTERACLASSE>
1228
                 */
1229
                valorU : function() {
1230
                        try {
1231
                                if (i3GEOF.legenda.aguarde.visibility === "visible") {
1232
                                        return;
1233
                                }
1234
                                var item = $i("i3GEOlegendaitensValorUnico").getElementsByTagName("select")[0].value, itemNome =
1235
                                        $i("i3GEOlegendaClassesValorUnico").getElementsByTagName("select")[0].value, p =
1236
                                        i3GEO.configura.locaplic + "/classesphp/mapa_controle.php?g_sid="
1237
                                                + i3GEO.configura.sid
1238
                                                + "&funcao=alteraclasse&tema="
1239
                                                + i3GEOF.legenda.tema
1240
                                                + "&item="
1241
                                                + item
1242
                                                + "&itemNome="
1243
                                                + itemNome
1244
                                                + "&opcao=valorunico"
1245
                                                + "&ignorar="
1246
                                                + $i("i3GEOlegendaignorar").value, cp = new cpaint(), fim = function() {
1247
                                        i3GEOF.legenda.aposAlterarLegenda();
1248
                                        i3GEOF.legenda.aguarde.visibility = "hidden";
1249
                                };
1250
                                if ($i("i3GEOFlegendaaplicaextent").checked === true) {
1251
                                        p += "&ext=" + i3GEO.util.extOSM2Geo(i3GEO.parametros.mapexten);
1252
                                } else {
1253
                                        p += "&ext=" + i3GEO.util.extOSM2Geo(i3GEO.parametros.extentTotal);
1254
                                }
1255

    
1256
                                if (item == "") {
1257
                                        i3GEO.janela.tempoMsg($trad('selecionaUmItem', i3GEOF.legenda.dicionario));
1258
                                        return;
1259
                                }
1260
                                i3GEOF.legenda.aguarde.visibility = "visible";
1261
                                cp.set_response_type("JSON");
1262
                                cp.call(p, "alteraclasse", fim);
1263
                        } catch (e) {
1264
                                i3GEO.janela.tempoMsg("Erro: " + e);
1265
                                i3GEOF.legenda.aguarde.visibility = "hidden";
1266
                        }
1267
                },
1268
                /*
1269
                 * Function: valorC
1270
                 *
1271
                 * Altera a leganda do tema com um n&uacute;mero espec&iacute;fico de classes
1272
                 *
1273
                 * Veja:
1274
                 *
1275
                 * <ALTERACLASSE>
1276
                 */
1277
                valorC : function() {
1278
                        try {
1279
                                if (i3GEOF.legenda.aguarde.visibility === "visible") {
1280
                                        return;
1281
                                }
1282
                                var item = $i("i3GEOlegendaitensValorClass").getElementsByTagName("select")[0].value, nclasses =
1283
                                        $i("i3GEOlegendanclasses").value, ext = i3GEO.util.extOSM2Geo(i3GEO.parametros.mapexten), p =
1284
                                        i3GEO.configura.locaplic + "/classesphp/mapa_controle.php?g_sid="
1285
                                                + i3GEO.configura.sid
1286
                                                + "&funcao=alteraclasse&nclasses="
1287
                                                + nclasses
1288
                                                + "&tema="
1289
                                                + i3GEOF.legenda.tema
1290
                                                + "&item="
1291
                                                + item
1292
                                                + "&opcao=intervalosiguais&ignorar="
1293
                                                + $i("i3GEOlegendaignorar").value
1294
                                                + "&ext="
1295
                                                + ext, cp = new cpaint(), fim = function() {
1296
                                        i3GEOF.legenda.aposAlterarLegenda();
1297
                                        i3GEOF.legenda.aguarde.visibility = "hidden";
1298
                                };
1299
                                if (item == "") {
1300
                                        i3GEO.janela.tempoMsg("Selecione um item!");
1301
                                        return;
1302
                                }
1303
                                i3GEOF.legenda.aguarde.visibility = "visible";
1304
                                cp.set_response_type("JSON");
1305
                                cp.call(p, "alteraclasse", fim);
1306
                        } catch (e) {
1307
                                i3GEO.janela.tempoMsg("Erro: " + e);
1308
                                i3GEOF.legenda.aguarde.visibility = "hidden";
1309
                        }
1310
                },
1311
                /*
1312
                 * Function: valorQ
1313
                 *
1314
                 * Altera a leganda do tema claculando as classes pelo m&eacute;todo quartil
1315
                 *
1316
                 * Veja:
1317
                 *
1318
                 * <ALTERACLASSE>
1319
                 */
1320
                valorQ : function() {
1321
                        try {
1322
                                if (i3GEOF.legenda.aguarde.visibility === "visible") {
1323
                                        return;
1324
                                }
1325
                                var item = $i("i3GEOlegendaitensValorQuartil").getElementsByTagName("select")[0].value, ext =
1326
                                        i3GEO.util.extOSM2Geo(i3GEO.parametros.mapexten), p =
1327
                                        i3GEO.configura.locaplic + "/classesphp/mapa_controle.php?g_sid="
1328
                                                + i3GEO.configura.sid
1329
                                                + "&funcao=alteraclasse&tema="
1330
                                                + i3GEOF.legenda.tema
1331
                                                + "&item="
1332
                                                + item
1333
                                                + "&opcao=quartis&ignorar="
1334
                                                + $i("i3GEOlegendaignorar").value
1335
                                                + "&ext="
1336
                                                + ext
1337
                                                + "&tipoLegenda="
1338
                                                + $i("estiloClassesQuartis").value, cp = new cpaint(), fim = function() {
1339
                                        i3GEOF.legenda.aposAlterarLegenda();
1340
                                        i3GEOF.legenda.aguarde.visibility = "hidden";
1341
                                };
1342
                                if (item == "") {
1343
                                        i3GEO.janela.tempoMsg($trad('selecionaUmItem', i3GEOF.legenda.dicionario));
1344
                                        return;
1345
                                }
1346
                                i3GEOF.legenda.aguarde.visibility = "visible";
1347
                                cp.set_response_type("JSON");
1348
                                cp.call(p, "alteraclasse", fim);
1349
                        } catch (e) {
1350
                                i3GEO.janela.tempoMsg("Erro: " + e);
1351
                                i3GEOF.legenda.aguarde.visibility = "hidden";
1352
                        }
1353
                },
1354
                /*
1355
                 * Function: valorQu
1356
                 *
1357
                 * Altera a leganda do tema por meio do calculo de quantis
1358
                 *
1359
                 * Veja:
1360
                 *
1361
                 * <ALTERACLASSE>
1362
                 */
1363
                valorQu : function() {
1364
                        try {
1365
                                if (i3GEOF.legenda.aguarde.visibility === "visible") {
1366
                                        return;
1367
                                }
1368
                                var item = $i("i3GEOlegendaitensValorClass").getElementsByTagName("select")[0].value, nclasses =
1369
                                        $i("i3GEOlegendanclasses").value, ext = i3GEO.util.extOSM2Geo(i3GEO.parametros.mapexten), p =
1370
                                        i3GEO.configura.locaplic + "/classesphp/mapa_controle.php?g_sid="
1371
                                                + i3GEO.configura.sid
1372
                                                + "&funcao=alteraclasse&nclasses="
1373
                                                + nclasses
1374
                                                + "&tema="
1375
                                                + i3GEOF.legenda.tema
1376
                                                + "&item="
1377
                                                + item
1378
                                                + "&opcao=quantil&ignorar="
1379
                                                + $i("i3GEOlegendaignorar").value
1380
                                                + "&ext="
1381
                                                + ext, cp = new cpaint(), fim = function() {
1382
                                        i3GEOF.legenda.aposAlterarLegenda();
1383
                                        i3GEOF.legenda.aguarde.visibility = "hidden";
1384
                                };
1385
                                if (item == "") {
1386
                                        i3GEO.janela.tempoMsg($trad('selecionaUmItem', i3GEOF.legenda.dicionario));
1387
                                        return;
1388
                                }
1389
                                i3GEOF.legenda.aguarde.visibility = "visible";
1390
                                cp.set_response_type("JSON");
1391
                                cp.call(p, "alteraclasse", fim);
1392
                        } catch (e) {
1393
                                i3GEO.janela.tempoMsg("Erro: " + e);
1394
                                i3GEOF.legenda.aguarde.visibility = "hidden";
1395
                        }
1396
                },
1397
                /*
1398
                 * Function: valorQN
1399
                 *
1400
                 * Altera a legenda do tema por meio do calculo de quebras naturais
1401
                 *
1402
                 * Veja:
1403
                 *
1404
                 * <ALTERACLASSE>
1405
                 */
1406
                valorQN : function() {
1407
                        try {
1408
                                if (i3GEOF.legenda.aguarde.visibility === "visible") {
1409
                                        return;
1410
                                }
1411
                                var item = $i("i3GEOlegendaitensValorClass").getElementsByTagName("select")[0].value, nclasses =
1412
                                        $i("i3GEOlegendanclasses").value, ext = i3GEO.util.extOSM2Geo(i3GEO.parametros.mapexten), p =
1413
                                        i3GEO.configura.locaplic + "/classesphp/mapa_controle.php?g_sid="
1414
                                                + i3GEO.configura.sid
1415
                                                + "&funcao=alteraclasse&nclasses="
1416
                                                + nclasses
1417
                                                + "&tema="
1418
                                                + i3GEOF.legenda.tema
1419
                                                + "&item="
1420
                                                + item
1421
                                                + "&opcao=quebrasnaturais&ignorar="
1422
                                                + $i("i3GEOlegendaignorar").value
1423
                                                + "&ext="
1424
                                                + ext, cp = new cpaint(), fim = function() {
1425
                                        i3GEOF.legenda.aposAlterarLegenda();
1426
                                        i3GEOF.legenda.aguarde.visibility = "hidden";
1427
                                };
1428
                                if (item == "") {
1429
                                        i3GEO.janela.tempoMsg($trad('selecionaUmItem', i3GEOF.legenda.dicionario));
1430
                                        return;
1431
                                }
1432
                                i3GEOF.legenda.aguarde.visibility = "visible";
1433
                                cp.set_response_type("JSON");
1434
                                cp.call(p, "alteraclasse", fim);
1435
                        } catch (e) {
1436
                                i3GEO.janela.tempoMsg("Erro: " + e);
1437
                                i3GEOF.legenda.aguarde.visibility = "hidden";
1438
                        }
1439
                },
1440

    
1441
                /*
1442
                 * Function: representacao
1443
                 *
1444
                 * Altera o tipo de representa&ccedil;&atilde;o do tema (linear ou poligonoal)
1445
                 *
1446
                 * Veja:
1447
                 *
1448
                 * <ALTERAREPRESENTACAO>
1449
                 *
1450
                 */
1451
                representacao : function() {
1452
                        try {
1453
                                if (i3GEOF.legenda.aguarde.visibility === "visible") {
1454
                                        return;
1455
                                }
1456
                                var p =
1457
                                        i3GEO.configura.locaplic + "/classesphp/mapa_controle.php?g_sid="
1458
                                                + i3GEO.configura.sid
1459
                                                + "&funcao=alterarepresentacao&tema="
1460
                                                + i3GEOF.legenda.tema, cp = new cpaint(), fim = function() {
1461
                                        i3GEOF.legenda.aposAlterarLegenda();
1462
                                        i3GEOF.legenda.aguarde.visibility = "hidden";
1463
                                };
1464
                                i3GEOF.legenda.aguarde.visibility = "visible";
1465
                                cp.set_response_type("JSON");
1466
                                cp.call(p, "alteraRepresentacao", fim);
1467
                        } catch (e) {
1468
                                i3GEO.janela.tempoMsg("Erro: " + e);
1469
                                i3GEOF.legenda.aguarde.visibility = "hidden";
1470
                        }
1471
                },
1472
                /*
1473
                 * Function: montaEditor
1474
                 *
1475
                 * Monta o editor de s&iacute;mbolos quando o usu&aacute;rio clica em um s&iacute;mbolo na legenda
1476
                 */
1477
                montaEditor : function(retorno) {
1478
                        try {
1479
                                i3GEO.util.comboItens("i3GEOlegendaSelItemLabel", i3GEOF.legenda.tema, function(retorno) {
1480
                                        if ($i("i3GEOlegendaitensLabel")) {
1481
                                                $i("i3GEOlegendaitensLabel").innerHTML = retorno.dados;
1482
                                        }
1483
                                }, "i3GEOlegendaitensLabel");
1484
                                if (i3GEOF.legenda.aguarde.visibility === "visible") {
1485
                                        return;
1486
                                }
1487
                                i3GEOF.legenda.aguarde.visibility = "visible";
1488
                                if (retorno.data != undefined) {
1489
                                        var b, l, i, sct, combo, n;
1490
                                        retorno = retorno.data;
1491
                                        i3GEOF.legenda.estilos = retorno.split("|");
1492
                                        combo =
1493
                                                "<div class=styled-select style=width:100px ><select id='i3GEOlegendaestilos' onchange=i3GEOF.legenda.mostraEstilo(this.value)>";
1494
                                        n = i3GEOF.legenda.estilos.length;
1495
                                        for (i = 0; i < n; i++) {
1496
                                                l = i3GEOF.legenda.estilos[i].split("#");
1497
                                                sct = "<option value=" + l[1] + "  />" + l[1] + "</option>";
1498
                                                combo += sct;
1499
                                        }
1500
                                        combo += "</select></div>";
1501
                                        $i("i3GEOlegendacomboestilos").innerHTML =
1502
                                                "<table class='lista5'><tr><td><span class=paragrafo >" + $trad('estiloEdicao', i3GEOF.legenda.dicionario)
1503
                                                        + ":</span></td><td>"
1504
                                                        + combo
1505
                                                        + "</td><td></td></tr></table>&nbsp;(ap&oacute;s adicionar ou excluir, aplique a altera&ccedil;&atilde;o)<br>";
1506
                                        b =
1507
                                                new YAHOO.widget.Button("i3GEOlegendabotao11", {
1508
                                                        onclick : {
1509
                                                                fn : function() {
1510
                                                                        try {
1511
                                                                                if (i3GEOF.legenda.aguarde.visibility === "visible") {
1512
                                                                                        return;
1513
                                                                                }
1514
                                                                                i3GEOF.legenda.aguarde.visibility = "visible";
1515
                                                                                var p =
1516
                                                                                        i3GEO.configura.locaplic + "/classesphp/mapa_controle.php?g_sid="
1517
                                                                                                + i3GEO.configura.sid
1518
                                                                                                + "&funcao=editasimbolo&opcao=excluiestilo&tema="
1519
                                                                                                + i3GEOF.legenda.tema
1520
                                                                                                + "&classe="
1521
                                                                                                + i3GEOF.legenda.classe
1522
                                                                                                + "&estilo="
1523
                                                                                                + i3GEOF.legenda.estilo, cp = new cpaint();
1524
                                                                                cp.set_response_type("JSON");
1525
                                                                                cp.call(p, "editasimbolo", i3GEOF.legenda.reMontaEditor);
1526
                                                                        } catch (e) {
1527
                                                                                i3GEO.janela.tempoMsg("Erro: " + e);
1528
                                                                                i3GEOF.legenda.aguarde.visibility = "hidden";
1529
                                                                        }
1530
                                                                }
1531
                                                        }
1532
                                                });
1533
                                        b.addClass("rodar100");
1534
                                        b =
1535
                                                new YAHOO.widget.Button("i3GEOlegendabotao12", {
1536
                                                        onclick : {
1537
                                                                fn : function() {
1538
                                                                        try {
1539
                                                                                if (i3GEOF.legenda.aguarde.visibility === "visible") {
1540
                                                                                        return;
1541
                                                                                }
1542
                                                                                i3GEOF.legenda.aguarde.visibility = "visible";
1543
                                                                                var p =
1544
                                                                                        i3GEO.configura.locaplic + "/classesphp/mapa_controle.php?g_sid="
1545
                                                                                                + i3GEO.configura.sid
1546
                                                                                                + "&funcao=editasimbolo&opcao=adicionaestilo&tema="
1547
                                                                                                + i3GEOF.legenda.tema
1548
                                                                                                + "&classe="
1549
                                                                                                + i3GEOF.legenda.classe
1550
                                                                                                + "&estilo="
1551
                                                                                                + i3GEOF.legenda.estilo, cp = new cpaint();
1552
                                                                                cp.set_response_type("JSON");
1553
                                                                                cp.call(p, "editasimbolo", i3GEOF.legenda.reMontaEditor);
1554
                                                                        } catch (e) {
1555
                                                                                i3GEO.janela.tempoMsg("Erro: " + e);
1556
                                                                                i3GEOF.legenda.aguarde.visibility = "hidden";
1557
                                                                        }
1558
                                                                }
1559
                                                        }
1560
                                                });
1561
                                        b.addClass("rodar100");
1562
                                        b =
1563
                                                new YAHOO.widget.Button("i3GEOlegendabotao13", {
1564
                                                        onclick : {
1565
                                                                fn : function() {
1566
                                                                        try {
1567
                                                                                if (i3GEOF.legenda.aguarde.visibility === "visible") {
1568
                                                                                        return;
1569
                                                                                }
1570
                                                                                i3GEOF.legenda.aguarde.visibility = "visible";
1571
                                                                                var p =
1572
                                                                                        i3GEO.configura.locaplic + "/classesphp/mapa_controle.php?g_sid="
1573
                                                                                                + i3GEO.configura.sid
1574
                                                                                                + "&funcao=editasimbolo&opcao=sobeestilo&tema="
1575
                                                                                                + i3GEOF.legenda.tema
1576
                                                                                                + "&classe="
1577
                                                                                                + i3GEOF.legenda.classe
1578
                                                                                                + "&estilo="
1579
                                                                                                + i3GEOF.legenda.estilo, cp = new cpaint();
1580
                                                                                cp.set_response_type("JSON");
1581
                                                                                cp.call(p, "editasimbolo", i3GEOF.legenda.reMontaEditor);
1582
                                                                        } catch (e) {
1583
                                                                                i3GEO.janela.tempoMsg("Erro: " + e);
1584
                                                                                i3GEOF.legenda.aguarde.visibility = "hidden";
1585
                                                                        }
1586
                                                                }
1587
                                                        }
1588
                                                });
1589
                                        b.addClass("rodar100");
1590
                                        b =
1591
                                                new YAHOO.widget.Button("i3GEOlegendabotao14", {
1592
                                                        onclick : {
1593
                                                                fn : function() {
1594
                                                                        try {
1595
                                                                                if (i3GEOF.legenda.aguarde.visibility === "visible") {
1596
                                                                                        return;
1597
                                                                                }
1598
                                                                                i3GEOF.legenda.aguarde.visibility = "visible";
1599
                                                                                var p =
1600
                                                                                        i3GEO.configura.locaplic + "/classesphp/mapa_controle.php?g_sid="
1601
                                                                                                + i3GEO.configura.sid
1602
                                                                                                + "&funcao=editasimbolo&opcao=desceestilo&tema="
1603
                                                                                                + i3GEOF.legenda.tema
1604
                                                                                                + "&classe="
1605
                                                                                                + i3GEOF.legenda.classe
1606
                                                                                                + "&estilo="
1607
                                                                                                + i3GEOF.legenda.estilo, cp = new cpaint();
1608
                                                                                cp.set_response_type("JSON");
1609
                                                                                cp.call(p, "editasimbolo", i3GEOF.legenda.reMontaEditor);
1610
                                                                        } catch (e) {
1611
                                                                                i3GEO.janela.tempoMsg("Erro: " + e);
1612
                                                                                i3GEOF.legenda.aguarde.visibility = "hidden";
1613
                                                                        }
1614
                                                                }
1615
                                                        }
1616
                                                });
1617
                                        b.addClass("rodar100");
1618
                                        i3GEOF.legenda.aguarde.visibility = "hidden";
1619
                                        i3GEOF.legenda.mostraEstilo(0);
1620
                                } else {
1621
                                        $i("i3GEOlegendacomboestilos").innerHTML = "<p style=color:red >Erro<br>";
1622
                                        i3GEOF.legenda.aguarde.visibility = "hidden";
1623
                                }
1624
                        } catch (e) {
1625
                                i3GEO.janela.tempoMsg("Erro: " + e);
1626
                                i3GEOF.legenda.aguarde.visibility = "hidden";
1627
                        }
1628
                },
1629
                /*
1630
                 * Function: mostraEstilo
1631
                 *
1632
                 * Mostra as propriedades de um estilo de um s&iacute;mbolo
1633
                 */
1634
                mostraEstilo : function(e) {
1635
                        i3GEOF.legenda.aguarde.visibility = "visible";
1636
                        try {
1637
                                var linha, tipoLayer, d, p, cp;
1638
                                i3GEOF.legenda.estilo = e; // esta e uma variavel global
1639
                                linha = i3GEOF.legenda.estilos[i3GEOF.legenda.estilo];
1640
                                linha = linha.split("#");
1641
                                tipoLayer = linha[0];
1642
                                d =
1643
                                        "<img style='float:left;' onclick='i3GEOF.legenda.aplicaTodasClasses(\"outlinecolor\",\"i3GEOlegendaoutlinecolor\")' title='" + $trad(
1644
                                                'aplicatodos',
1645
                                                i3GEOF.legenda.dicionario)
1646
                                                + "' src='"
1647
                                                + i3GEO.configura.locaplic
1648
                                                + "/imagens/oxygen/16x16/tools-wizard.png'  />"
1649
                                                + "<p class='paragrafo'>Cor do contorno:</p>"
1650
                                                + "<form onsubmit='i3GEOF.legenda.aplicaEstilo();return false;'>"
1651
                                                + "<div class='i3geoForm i3geoFormIconeAquarela' >"
1652
                                                + "<input type=text value='"
1653
                                                + linha[2]
1654
                                                + "' id='i3GEOlegendaoutlinecolor' />"
1655
                                                + "</div></form>"
1656

    
1657
                                                + "<br><img style='float:left;' onclick='i3GEOF.legenda.aplicaTodasClasses(\"color\",\"i3GEOlegendacolor\")' title='"
1658
                                                + $trad('aplicatodos', i3GEOF.legenda.dicionario)
1659
                                                + "' src='"
1660
                                                + i3GEO.configura.locaplic
1661
                                                + "/imagens/oxygen/16x16/tools-wizard.png'  />"
1662
                                                + "<p class='paragrafo'>"
1663
                                                + $trad('corFrente', i3GEOF.legenda.dicionario)
1664
                                                + ":</p>"
1665
                                                + "<form onsubmit='i3GEOF.legenda.aplicaEstilo();return false;'>"
1666
                                                + "<div class='i3geoForm i3geoFormIconeAquarela' >"
1667
                                                + "<input type=text value='"
1668
                                                + linha[4]
1669
                                                + "' id='i3GEOlegendacolor' />"
1670
                                                + "</div></form>"
1671

    
1672
                                                + "<br><img style='float:left;' onclick='i3GEOF.legenda.aplicaTodasClasses(\"backgroundcolor\",\"i3GEOlegendabackgroundcolor\")' title='"
1673
                                                + $trad('aplicatodos', i3GEOF.legenda.dicionario)
1674
                                                + "' src='"
1675
                                                + i3GEO.configura.locaplic
1676
                                                + "/imagens/oxygen/16x16/tools-wizard.png'  />"
1677
                                                + "<p class='paragrafo'>"
1678
                                                + $trad('corFundo', i3GEOF.legenda.dicionario)
1679
                                                + ":</p>"
1680
                                                + "<form onsubmit='i3GEOF.legenda.aplicaEstilo();return false;'>"
1681
                                                + "<div class='i3geoForm i3geoFormIconeAquarela' >"
1682
                                                + "<input type=text value='"
1683
                                                + linha[3]
1684
                                                + "' id='i3GEOlegendabackgroundcolor' />"
1685
                                                + "</div></form>"
1686

    
1687
                                                + "<br><img style='float:left;' onclick='i3GEOF.legenda.aplicaTodasClasses(\"size\",\"i3GEOlegendasizes\")' title='"
1688
                                                + $trad('aplicatodos', i3GEOF.legenda.dicionario)
1689
                                                + "' src='"
1690
                                                + i3GEO.configura.locaplic
1691
                                                + "/imagens/oxygen/16x16/tools-wizard.png'  />"
1692
                                                + "<p class='paragrafo'>"
1693
                                                + $trad('tamanhoEspacamento', i3GEOF.legenda.dicionario)
1694
                                                + ":</p>"
1695
                                                + "<div class='i3geoForm i3geoFormIconeEdita' >"
1696
                                                + "<form onsubmit='i3GEOF.legenda.aplicaEstilo();return false;'>"
1697
                                                + "<input type=text value='"
1698
                                                + linha[6]
1699
                                                + "' id='i3GEOlegendasizes' />"
1700
                                                + "</form></div>"
1701

    
1702
                                                + "<br><img style='float:left;' onclick='i3GEOF.legenda.aplicaTodasClasses(\"width\",\"i3GEOlegendawidth\")' title='"
1703
                                                + $trad('aplicatodos', i3GEOF.legenda.dicionario)
1704
                                                + "' src='"
1705
                                                + i3GEO.configura.locaplic
1706
                                                + "/imagens/oxygen/16x16/tools-wizard.png'  />"
1707
                                                + "<p class='paragrafo'>"
1708
                                                + $trad('espessura', i3GEOF.legenda.dicionario)
1709
                                                + ":<p>"
1710
                                                + "<div class='i3geoForm i3geoFormIconeEdita' >"
1711
                                                + "<form onsubmit='i3GEOF.legenda.aplicaEstilo();return false;'>"
1712
                                                + "<input type=text value='"
1713
                                                + linha[8]
1714
                                                + "' id='i3GEOlegendawidth' />"
1715
                                                + "</form></div>"
1716

    
1717
                                                + "<br><img style='float:left;' onclick='i3GEOF.legenda.aplicaTodasClasses(\"pattern\",\"i3GEOlegendapattern\")' title='"
1718
                                                + $trad('aplicatodos', i3GEOF.legenda.dicionario)
1719
                                                + "' src='"
1720
                                                + i3GEO.configura.locaplic
1721
                                                + "/imagens/oxygen/16x16/tools-wizard.png'  />"
1722
                                                + "<p class='paragrafo'>"
1723
                                                + $trad('padraoRepeticao', i3GEOF.legenda.dicionario)
1724
                                                + ":</p>"
1725
                                                + "<div class='i3geoForm i3geoFormIconeEdita' >"
1726
                                                + "<form onsubmit='i3GEOF.legenda.aplicaEstilo();return false;'>"
1727
                                                + "<input type=text value='"
1728
                                                + linha[9]
1729
                                                + "' id='i3GEOlegendapattern' />"
1730
                                                + "</form></div>"
1731

    
1732
                                                + "<br><img style='float:left;' onclick='i3GEOF.legenda.aplicaTodasClasses(\"opacity\",\"i3GEOlegendaopacidade\")' title='"
1733
                                                + $trad('aplicatodos', i3GEOF.legenda.dicionario)
1734
                                                + "' src='"
1735
                                                + i3GEO.configura.locaplic
1736
                                                + "/imagens/oxygen/16x16/tools-wizard.png'  />"
1737
                                                + "<p class='paragrafo'>"
1738
                                                + $trad('opacidade', i3GEOF.legenda.dicionario)
1739
                                                + ":</p>"
1740
                                                + "<div class='i3geoForm i3geoFormIconeEdita' >"
1741
                                                + "<form onsubmit='i3GEOF.legenda.aplicaEstilo();return false;'>"
1742
                                                + "<input type=text value='"
1743
                                                + linha[7]
1744
                                                + "' id='i3GEOlegendaopacidade' />"
1745
                                                + "</form></div>"
1746

    
1747
                                                + "<br><img style='float:left;' onclick='i3GEOF.legenda.aplicaTodasClasses(\"angle\",\"i3GEOlegendaangulo\")' title='"
1748
                                                + $trad('aplicatodos', i3GEOF.legenda.dicionario)
1749
                                                + "' src='"
1750
                                                + i3GEO.configura.locaplic
1751
                                                + "/imagens/oxygen/16x16/tools-wizard.png'  />"
1752
                                                + "<p class='paragrafo'>"
1753
                                                + $trad('angulo', i3GEOF.legenda.dicionario)
1754
                                                + ":</p>"
1755
                                                + "<div class='i3geoForm i3geoFormIconeEdita' >"
1756
                                                + "<form onsubmit='i3GEOF.legenda.aplicaEstilo();return false;'>"
1757
                                                + "<input type=text value='"
1758
                                                + linha[10]
1759
                                                + "' id='i3GEOlegendaangulo' />"
1760
                                                + "</form></div>"
1761

    
1762
                                                + "<br>"
1763
                                                + "<p class='paragrafo'>"
1764
                                                + $trad('symbolscale', i3GEOF.legenda.dicionario)
1765
                                                + ":</p>"
1766
                                                + "<div class='i3geoForm i3geoFormIconeEdita' >"
1767
                                                + "<form onsubmit='i3GEOF.legenda.aplicaEstilo();return false;'>"
1768
                                                + "<input type=text value='"
1769
                                                + linha[11]
1770
                                                + "' id='i3GEOlegendasymbolscale' />"
1771
                                                + "</form></div>"
1772

    
1773
                                                + "<br><img style='float:left;' onclick='i3GEOF.legenda.aplicaTodasClasses(\"minsize\",\"i3GEOlegendaminsize\")' title='"
1774
                                                + $trad('aplicatodos', i3GEOF.legenda.dicionario)
1775
                                                + "' src='"
1776
                                                + i3GEO.configura.locaplic
1777
                                                + "/imagens/oxygen/16x16/tools-wizard.png'  />"
1778
                                                + "<p class='paragrafo'>"
1779
                                                + $trad('minsize', i3GEOF.legenda.dicionario)
1780
                                                + ":</p>"
1781
                                                + "<div class='i3geoForm i3geoFormIconeEdita' >"
1782
                                                + "<form onsubmit='i3GEOF.legenda.aplicaEstilo();return false;'>"
1783
                                                + "<input type=text value='"
1784
                                                + linha[12]
1785
                                                + "' id='i3GEOlegendaminsize' />"
1786
                                                + "</form></div>"
1787

    
1788
                                                + "<br><img style='float:left;' onclick='i3GEOF.legenda.aplicaTodasClasses(\"maxsize\",\"i3GEOlegendamaxsize\")' title='"
1789
                                                + $trad('aplicatodos', i3GEOF.legenda.dicionario)
1790
                                                + "' src='"
1791
                                                + i3GEO.configura.locaplic
1792
                                                + "/imagens/oxygen/16x16/tools-wizard.png'  />"
1793
                                                + "<p class='paragrafo'>"
1794
                                                + $trad('maxsize', i3GEOF.legenda.dicionario)
1795
                                                + ":</p>"
1796
                                                + "<div class='i3geoForm i3geoFormIconeEdita' >"
1797
                                                + "<form onsubmit='i3GEOF.legenda.aplicaEstilo();return false;'>"
1798
                                                + "<input type=text value='"
1799
                                                + linha[13]
1800
                                                + "' id='i3GEOlegendamaxsize' />"
1801
                                                + "</form></div>"
1802

    
1803
                                                + "<br><img style='float:left;' onclick='i3GEOF.legenda.aplicaTodasClasses(\"offsetx\",\"i3GEOlegendasymbolname\")' title='"
1804
                                                + $trad('aplicatodos', i3GEOF.legenda.dicionario)
1805
                                                + "' src='"
1806
                                                + i3GEO.configura.locaplic
1807
                                                + "/imagens/oxygen/16x16/tools-wizard.png'  />"
1808
                                                + "<p class='paragrafo'>"
1809
                                                + $trad('offsetx', i3GEOF.legenda.dicionario)
1810
                                                + ":</p>"
1811
                                                + "<div class='i3geoForm i3geoFormIconeEdita' >"
1812
                                                + "<form onsubmit='i3GEOF.legenda.aplicaEstilo();return false;'>"
1813
                                                + "<input type=text value='"
1814
                                                + linha[14]
1815
                                                + "' id='i3GEOlegendaoffsetx' />"
1816
                                                + "</form></div>"
1817

    
1818
                                                + "<br><img style='float:left;' onclick='i3GEOF.legenda.aplicaTodasClasses(\"offsety\",\"i3GEOlegendasymbolname\")' title='"
1819
                                                + $trad('aplicatodos', i3GEOF.legenda.dicionario)
1820
                                                + "' src='"
1821
                                                + i3GEO.configura.locaplic
1822
                                                + "/imagens/oxygen/16x16/tools-wizard.png'  />"
1823
                                                + "<p class='paragrafo'>"
1824
                                                + $trad('offsety', i3GEOF.legenda.dicionario)
1825
                                                + ":</p>"
1826
                                                + "<div class='i3geoForm i3geoFormIconeEdita' >"
1827
                                                + "<form onsubmit='i3GEOF.legenda.aplicaEstilo();return false;'>"
1828
                                                + "<input type=text value='"
1829
                                                + linha[15]
1830
                                                + "' id='i3GEOlegendaoffsety' />"
1831
                                                + "</form></div>"
1832

    
1833
                                                + "<br><img style='float:left;' onclick='i3GEOF.legenda.aplicaTodasClasses(\"symbolname\",\"i3GEOlegendasymbolname\")' title='"
1834
                                                + $trad('aplicatodos', i3GEOF.legenda.dicionario)
1835
                                                + "' src='"
1836
                                                + i3GEO.configura.locaplic
1837
                                                + "/imagens/oxygen/16x16/tools-wizard.png'  />"
1838
                                                + "<p class='paragrafo'>"
1839
                                                + $trad('simbolo', i3GEOF.legenda.dicionario)
1840
                                                + ":</p>"
1841
                                                + "<div class='i3geoForm i3geoFormIconeEdita' >"
1842
                                                + "<form onsubmit='i3GEOF.legenda.aplicaEstilo();return false;'>"
1843
                                                + "<input type=text value='"
1844
                                                + linha[5]
1845
                                                + "' id='i3GEOlegendasymbolname' />"
1846
                                                + "</form></div>";
1847

    
1848
                                $i("i3GEOlegendaParametrosEstilos").innerHTML = d;
1849
                                i3GEO.util.aplicaAquarela("i3GEOlegendaParametrosEstilos");
1850
                                p =
1851
                                        i3GEO.configura.locaplic + "/classesphp/mapa_controle.php?g_sid="
1852
                                                + i3GEO.configura.sid
1853
                                                + "&funcao=editasimbolo&tipo="
1854
                                                + tipoLayer
1855
                                                + "&opcao=listaSimbolos&onclick=i3GEOF.legenda.aplicaSimbolo(this)";
1856
                                cp = new cpaint();
1857
                                cp.set_response_type("JSON");
1858
                                cp.call(p, "editasimbolo", i3GEOF.legenda.listaSimbolos);
1859
                                i3GEOF.legenda.aguarde.visibility = "hidden";
1860
                        } catch (e) {
1861
                                i3GEO.janela.tempoMsg("Erro: " + e);
1862
                                i3GEOF.legenda.aguarde.visibility = "hidden";
1863
                        }
1864
                },
1865
                /*
1866
                 * Function: listaSimbolos
1867
                 *
1868
                 * Monta a lista de s&iacute;mbolos com imagem
1869
                 */
1870
                listaSimbolos : function(retorno) {
1871
                        i3GEOF.legenda.aguarde.visibility = "visible";
1872
                        try {
1873
                                if (retorno.data != undefined) {
1874
                                        retorno = retorno.data;
1875
                                        $i("i3GEOlegendasimbolos").innerHTML =
1876
                                                "<br>" + $trad('listaSimbolo', i3GEOF.legenda.dicionario) + ":<br><br>" + retorno;
1877
                                } else {
1878
                                        $i("i3GEOlegendasimbolos").innerHTML = "<p style=color:red >Erro<br>";
1879
                                }
1880
                                i3GEOF.legenda.aguarde.visibility = "hidden";
1881
                        } catch (e) {
1882
                                i3GEO.janela.tempoMsg("Erro: " + e);
1883
                                i3GEOF.legenda.aguarde.visibility = "hidden";
1884
                        }
1885
                },
1886
                /*
1887
                 * Function: aplicaSimbolo
1888
                 *
1889
                 * Muda o valor do campo com o c&oacute;digo do s&iacute;mbolo escolhido
1890
                 */
1891
                aplicaSimbolo : function(s) {
1892
                        $i("i3GEOlegendasymbolname").value = s.title;
1893
                },
1894
                /*
1895
                 * Function: aplicaEstilo
1896
                 *
1897
                 * Aplica ao estilo as propriedades definidas
1898
                 *
1899
                 * Veja:
1900
                 *
1901
                 * <EDITASIMBOLO>
1902
                 */
1903
                aplicaEstilo : function() {
1904
                        try {
1905
                                if (i3GEOF.legenda.aguarde.visibility === "visible") {
1906
                                        return;
1907
                                }
1908
                                i3GEOF.legenda.aguarde.visibility = "visible";
1909
                                var i, p, cp, fim, outlinecolor = $i("i3GEOlegendaoutlinecolor").value, backgroundcolor =
1910
                                        $i("i3GEOlegendabackgroundcolor").value, color = $i("i3GEOlegendacolor").value, symbolname =
1911
                                        $i("i3GEOlegendasymbolname").value, simbolos = $i("i3GEOlegendasimbolos").getElementsByTagName("img"), valido = "nao", n =
1912
                                        simbolos.length, size = $i("i3GEOlegendasizes").value, width = $i("i3GEOlegendawidth").value, pattern =
1913
                                        $i("i3GEOlegendapattern").value, opacidade = $i("i3GEOlegendaopacidade").value, angle = $i("i3GEOlegendaangulo").value, symbolscale =
1914
                                        $i("i3GEOlegendasymbolscale").value, minsize = $i("i3GEOlegendaminsize").value, maxsize =
1915
                                        $i("i3GEOlegendamaxsize").value, offsetx = $i("i3GEOlegendaoffsetx").value, offsety = $i("i3GEOlegendaoffsety").value;
1916
                                if (symbolscale != "") {
1917
                                        symbolscale = parseInt(symbolscale, 10);
1918
                                } else {
1919
                                        symbolscale = -1;
1920
                                }
1921
                                for (i = 0; i < n; i++) {
1922
                                        if (simbolos[i].title == symbolname || symbolname == i) {
1923
                                                valido = "sim";
1924
                                        }
1925
                                }
1926
                                if (valido === "nao") {
1927
                                        // i3GEO.janela.tempoMsg("Nome do simbolo nao encontrado");
1928
                                        // i3GEOF.legenda.aguarde.visibility = "hidden";
1929
                                        // return;
1930
                                }
1931
                                p =
1932
                                        i3GEO.configura.locaplic + "/classesphp/mapa_controle.php?g_sid="
1933
                                                + i3GEO.configura.sid
1934
                                                + "&funcao=editasimbolo&opcao=aplica&tema="
1935
                                                + i3GEOF.legenda.tema
1936
                                                + "&classe="
1937
                                                + i3GEOF.legenda.classe
1938
                                                + "&estilo="
1939
                                                + i3GEOF.legenda.estilo
1940
                                                + "&outlinecolor="
1941
                                                + outlinecolor
1942
                                                + "&backgroundcolor="
1943
                                                + backgroundcolor
1944
                                                + "&color="
1945
                                                + color
1946
                                                + "&symbolname="
1947
                                                + symbolname
1948
                                                + "&width="
1949
                                                + width
1950
                                                + "&pattern="
1951
                                                + pattern
1952
                                                + "&size="
1953
                                                + size
1954
                                                + "&opacidade="
1955
                                                + opacidade
1956
                                                + "&angle="
1957
                                                + angle
1958
                                                + "&symbolscale="
1959
                                                + symbolscale
1960
                                                + "&minsize="
1961
                                                + minsize
1962
                                                + "&maxsize="
1963
                                                + maxsize
1964
                                                + "&offsetx="
1965
                                                + offsetx
1966
                                                + "&offsety="
1967
                                                + offsety;
1968
                                cp = new cpaint();
1969
                                fim = function() {
1970
                                        i3GEOF.legenda.aposAlterarLegenda();
1971
                                        i3GEOF.legenda.aguarde.visibility = "hidden";
1972
                                        i3GEOF.legenda.reMontaEditor();
1973
                                };
1974
                                // cp.set_debug(2)
1975
                                cp.set_response_type("JSON");
1976
                                cp.call(p, "editasimbolo", fim);
1977
                        } catch (e) {
1978
                                i3GEO.janela.tempoMsg("Erro: " + e);
1979
                                i3GEOF.legenda.aguarde.visibility = "hidden";
1980
                        }
1981
                },
1982
                /*
1983
                 * Function: reMontaEditor
1984
                 *
1985
                 * Gera novamente o editor de s&iacute;mbolo ap&oacute;s ter sido feita alguma altera&ccedil;&atilde;o nos estilos
1986
                 */
1987
                reMontaEditor : function() {
1988
                        var id = i3GEOF.legenda.tema + "-" + i3GEOF.legenda.classe;
1989
                        i3GEOF.legenda.editaSimbolo(id);
1990
                },
1991
                /*
1992
                 * Function: mostraGrafico
1993
                 *
1994
                 * Mostra um gr&aacute;fico com a contegem de elementos em caada classe
1995
                 *
1996
                 * Veja:
1997
                 *
1998
                 * <CONTAGEMCLASSE>
1999
                 */
2000
                mostraGrafico : function() {
2001
                        try {
2002
                                if (i3GEOF.legenda.aguarde.visibility === "visible") {
2003
                                        return;
2004
                                }
2005
                                i3GEOF.legenda.aguarde.visibility = "visible";
2006
                                var monta =
2007
                                        function(retorno) {
2008
                                                if (retorno.data && retorno.data[0].proc == "") {
2009
                                                        var b, ins = [], i, re, t;
2010
                                                        ins.push("<p class='paragrafo' ><input type=button value='" + $trad('graficoPizza', i3GEOF.legenda.dicionario)
2011
                                                                + "' id=i3GEOlegendaGraficoPizza /></p>");
2012
                                                        ins.push("<p class='paragrafo' >" + $trad('numeroOcorrenciasClasses', i3GEOF.legenda.dicionario) + "</p>");
2013
                                                        ins.push("<table width=100% >");
2014
                                                        i3GEOF.legenda.dadosGrafico = [
2015
                                                                "n;x"
2016
                                                        ];
2017
                                                        if (retorno.data.length < 2) {
2018
                                                                i3GEO.janela.tempoMsg($trad('msgNumeroClasses', i3GEOF.legenda.dicionario));
2019
                                                                i3GEOF.legenda.aguarde.visibility = "hidden";
2020
                                                                return;
2021
                                                        } else {
2022
                                                                i3GEO.guias.mostraGuiaFerramenta("i3GEOlegendaguia4", "i3GEOlegendaguia");
2023
                                                        }
2024
                                                        for (i = 0; i < retorno.data.length; i++) {
2025
                                                                id = retorno.data[i].tema + "-" + retorno.data[i].idclasse; // layer+indice da classe
2026
                                                                re = new RegExp("'", "g");
2027
                                                                exp = (retorno.data[i].expressao).replace(re, '"');
2028
                                                                ins.push("<tr><td style='text-align:left;border-bottom:0 none white' >" + retorno.data[i].nomeclasse
2029
                                                                        + "</td></tr>");
2030
                                                                t = (retorno.data[i].nreg * 100) / retorno.data[i].totalreg;
2031
                                                                ins.push("<tr><td style=text-align:left ><img height=15px width=" + t
2032
                                                                        + "% src='"
2033
                                                                        + retorno.data[i].imagem
2034
                                                                        + "' /></td></tr>");
2035
                                                                i3GEOF.legenda.dadosGrafico.push(retorno.data[i].nomeclasse + ";" + retorno.data[i].nreg);
2036
                                                        }
2037
                                                        ins.push("</table><br>");
2038
                                                        $i("i3GEOlegendaguia4obj").innerHTML = ins.join("");
2039
                                                } else {
2040
                                                        $i("i3GEOlegendaguia4obj").innerHTML = "<p style=color:red >Erro<br>";
2041
                                                        return;
2042
                                                }
2043
                                                i3GEOF.legenda.aguarde.visibility = "hidden";
2044

    
2045
                                                b = new YAHOO.widget.Button("i3GEOlegendaGraficoPizza", {
2046
                                                        onclick : {
2047
                                                                fn : function() {
2048
                                                                        var js = i3GEO.configura.locaplic + "/ferramentas/graficointerativo1/dependencias.php";
2049
                                                                        i3GEO.util.scriptTag(js, "i3GEOF.legenda.iniciaGraficoPizza()", "i3GEOF.graficointerativo1_script");
2050
                                                                }
2051
                                                        }
2052
                                                });
2053
                                                b.addClass("abrir");
2054
                                        }, p =
2055
                                        i3GEO.configura.locaplic + "/ferramentas/legenda/exec.php?g_sid="
2056
                                                + i3GEO.configura.sid
2057
                                                + "&funcao=contagemclasse&tema="
2058
                                                + i3GEOF.legenda.tema, cp = new cpaint();
2059
                                // cp.set_debug(2)
2060
                                cp.set_response_type("JSON");
2061
                                cp.call(p, "cocontagemclasse", monta);
2062
                        } catch (e) {
2063
                                i3GEO.janela.tempoMsg("Erro: " + e);
2064
                                i3GEOF.legenda.aguarde.visibility = "hidden";
2065
                        }
2066
                },
2067
                iniciaGraficoPizza : function() {
2068
                        var dados = {
2069
                                "attributes" : {
2070
                                        "id" : ""
2071
                                },
2072
                                "data" : {
2073
                                        "dados" : i3GEOF.legenda.dadosGrafico
2074
                                }
2075
                        };
2076
                        i3GEOF.graficointerativo1.tipo = "pizza_1";
2077
                        i3GEOF.graficointerativo1.iniciaJanelaFlutuante(dados);
2078
                },
2079
                /*
2080
                 * Function: aplicaProcessos
2081
                 *
2082
                 * Aplica processos de ajuste em imagens de sat&eacute;lite
2083
                 *
2084
                 * Veja:
2085
                 *
2086
                 * <APLICAPROCESSOS>
2087
                 */
2088
                aplicaProcessos : function() {
2089
                        try {
2090
                                if (i3GEOF.legenda.aguarde.visibility === "visible") {
2091
                                        return;
2092
                                }
2093
                                i3GEOF.legenda.aguarde.visibility = "visible";
2094
                                var lista = [], ipt, i, p, cp, temp;
2095
                                if ($i("i3GEOlegendaprocessos").innerHTML != "") {
2096
                                        ipt = $i("i3GEOlegendaprocessos").getElementsByTagName("input");
2097
                                        for (i = 0; i < ipt.length; i++) {
2098
                                                if (ipt[i].value != "") {
2099
                                                        lista.push(ipt[i].value);
2100
                                                }
2101
                                        }
2102
                                }
2103
                                lista = lista.join("|");
2104
                                temp = function() {
2105
                                        i3GEOF.legenda.aguarde.visibility = "hidden";
2106
                                        i3GEOF.legenda.mostralegenda();
2107
                                        i3GEOF.legenda.aposAlterarLegenda();
2108
                                };
2109
                                p =
2110
                                        i3GEO.configura.locaplic + "/classesphp/mapa_controle.php?g_sid="
2111
                                                + i3GEO.configura.sid
2112
                                                + "&funcao=aplicaProcessos&lista="
2113
                                                + lista
2114
                                                + "&tema="
2115
                                                + i3GEOF.legenda.tema;
2116
                                cp = new cpaint();
2117
                                cp.set_response_type("JSON");
2118
                                cp.call(p, "aplicaProcessos", temp);
2119
                        } catch (e) {
2120
                                i3GEO.janela.tempoMsg("Erro: " + e);
2121
                                i3GEOF.legenda.aguarde.visibility = "hidden";
2122
                        }
2123
                },
2124
                /*
2125
                 * Function: adicionaProcesso
2126
                 *
2127
                 * Adiciona um novo processo na lista de processos
2128
                 */
2129
                adicionaProcesso : function(s) {
2130
                        $i("i3GEOlegendaprocessos").innerHTML += $inputText("", "", "", "", 50, s.value);
2131
                },
2132
                aplicaTodasClasses : function(parametro, id) {
2133
                        var valor = $i(id).value;
2134
                        i3GEO.janela.confirma("Aplica " + parametro + " = " + valor + " ?", 300, $trad("x14"), "", function() {
2135
                                var temp = function() {
2136
                                        // i3GEOF.legenda.mostralegenda();
2137
                                        i3GEOF.legenda.aposAlterarLegenda();
2138
                                }, p, cp;
2139
                                p =
2140
                                        i3GEO.configura.locaplic + "/ferramentas/legenda/exec.php?g_sid="
2141
                                                + i3GEO.configura.sid
2142
                                                + "&funcao=aplicaTodasClasses"
2143
                                                + "&parametro="
2144
                                                + parametro
2145
                                                + "&valor="
2146
                                                + valor
2147
                                                + "&tema="
2148
                                                + i3GEOF.legenda.tema;
2149
                                cp = new cpaint();
2150
                                cp.set_response_type("JSON");
2151
                                cp.call(p, "foo", temp);
2152
                        });
2153
                }
2154
        };