Commit 42a4bd2253bef374cee66b5756ec0e162ea4b809
1 parent
87f064f8
Exists in
master
and in
7 other branches
--no commit message
Showing
1 changed file
with
0 additions
and
1984 deletions
Show diff stats
ferramentas/metaestat/index.js.r3543
... | ... | @@ -1,1984 +0,0 @@ |
1 | -/* | |
2 | - Title: Cartogramas estatísticos | |
3 | - | |
4 | - Arquivo: | |
5 | - | |
6 | - i3geo/ferramentas/metaestat/index.js | |
7 | - | |
8 | - Licenca: | |
9 | - | |
10 | - GPL2 | |
11 | - | |
12 | - i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | |
13 | - | |
14 | - Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil | |
15 | - Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | |
16 | - | |
17 | - Este programa é software livre; você pode redistribuí-lo | |
18 | - e/ou modificá-lo sob os termos da Licença Pública Geral | |
19 | - GNU conforme publicada pela Free Software Foundation; | |
20 | - | |
21 | - Este programa é distribuído na expectativa de que seja útil, | |
22 | - porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | |
23 | - de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | |
24 | - Consulte a Licença Pública Geral do GNU para mais detalhes. | |
25 | - Você deve ter recebido uma cópia da Licença Pública Geral do | |
26 | - GNU junto com este programa; se não, escreva para a | |
27 | - Free Software Foundation, Inc., no endereço | |
28 | - 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
29 | - */ | |
30 | -if(typeof(i3GEOF) === 'undefined'){ | |
31 | - var i3GEOF = {}; | |
32 | -} | |
33 | -/* | |
34 | - Classe: i3GEOF.metaestat | |
35 | - | |
36 | - Gerencia os componentes do módulo de geração de cartogramas estatísticos | |
37 | - */ | |
38 | -i3GEOF.metaestat = { | |
39 | - /** | |
40 | - * Tipo de interface utilizada para construcao dos parametros | |
41 | - */ | |
42 | - INTERFACE: "flutuante", | |
43 | - //codigo da variavel definido na inicializacao (opcional) | |
44 | - CODIGO_VARIAVEL: "", | |
45 | - //id da medida da variavel definido na inicializacao (opcional) | |
46 | - ID_MEDIDA_VARIAVEL: "", | |
47 | - CONEXAODEFAULT: 0, | |
48 | - TOP: 50, | |
49 | - LEFT: 100, | |
50 | - LARGURA: 270, | |
51 | - ALTURA: 250, | |
52 | - //lista das camadas que foram adicionadas ao mapa | |
53 | - CAMADAS: [], | |
54 | - //dados das medidas obtidos para a ultima variavel escolhida | |
55 | - DADOSMEDIDASVARIAVEL: [], | |
56 | - //para efeitos de compatibilidade com i3GEO.mapa.dialogo | |
57 | - criaJanelaFlutuante: function(){ | |
58 | - i3GEOF.metaestat.inicia(); | |
59 | - }, | |
60 | - inicia: function(Interface,codigo_variavel,id_medida_variavel){ | |
61 | - if(Interface && Interface != ""){ | |
62 | - i3GEOF.metaestat.INTERFACE = Interface; | |
63 | - } | |
64 | - if(codigo_variavel && codigo_variavel != ""){ | |
65 | - i3GEOF.metaestat.CODIGO_VARIAVEL = codigo_variavel; | |
66 | - } | |
67 | - if(id_medida_variavel && id_medida_variavel != ""){ | |
68 | - i3GEOF.metaestat.ID_MEDIDA_VARIAVEL = id_medida_variavel; | |
69 | - } | |
70 | - i3GEOF.metaestat.comum.iniciaDicionario(); | |
71 | - }, | |
72 | - analise: { | |
73 | - botoes: [{ | |
74 | - titulo:"Focar o mapa em um determinado limite geográfico", | |
75 | - onclick:"i3GEO.mapa.dialogo.locregiao()", | |
76 | - icone: "imagens/gisicons/open-street-maps.png" | |
77 | - },{ | |
78 | - titulo: "Mostrar no mapa os limites geográficos cadastrados", | |
79 | - onclick: "i3GEOF.metaestat.analise.mostraRegiao()", | |
80 | - icone: "imagens/gisicons/open-street-maps-show.png" | |
81 | - },{ | |
82 | - titulo: "Mostrar apenas os dados de determinado limite geográfico", | |
83 | - onclick: "i3GEO.mapa.dialogo.filtraregiao()", | |
84 | - icone: "imagens/gisicons/open-street-maps-filtro.png" | |
85 | - },{ | |
86 | - titulo: "Mostrar apenas os dados de um período de tempo", | |
87 | - onclick: "i3GEOF.metaestat.analise.filtraPeriodo.inicia()", | |
88 | - icone: "imagens/gisicons/open-street-maps-filtrotime.png" | |
89 | - },{ | |
90 | - titulo: "Tabela de atributos", | |
91 | - onclick: "i3GEO.tema.dialogo.tabela()", | |
92 | - icone: "imagens/gisicons/table.png" | |
93 | - },{ | |
94 | - titulo: "Gráfico interativo", | |
95 | - onclick: "i3GEO.analise.dialogo.graficoInterativo()", | |
96 | - icone: "imagens/oxygen/22x22/view_statistics.png" | |
97 | - },{ | |
98 | - titulo: "Opacidade", | |
99 | - onclick: "i3GEO.mapa.dialogo.opacidade()", | |
100 | - icone: "imagens/gisicons/layer-opacity.png" | |
101 | - },{ | |
102 | - titulo: "Animação", | |
103 | - onclick: "i3GEOF.metaestat.analise.ativaAnimacao()", | |
104 | - icone: "imagens/gisicons/player-forward.png" | |
105 | - },{ | |
106 | - titulo: "Alterar classificação", | |
107 | - onclick: "i3GEOF.metaestat.analise.alteraClasses()", | |
108 | - icone: "imagens/gisicons/calculator.png" | |
109 | - },{ | |
110 | - titulo: "Alterar cores", | |
111 | - onclick: "i3GEOF.metaestat.analise.alteraCores()", | |
112 | - icone: "imagens/gisicons/24-to-8-bits.png" | |
113 | - },{ | |
114 | - titulo: $trad("t42"), | |
115 | - onclick: "i3GEO.tema.dialogo.cortina()", | |
116 | - icone: "imagens/gisicons/mapset.png" | |
117 | - },{ | |
118 | - titulo: $trad("t49"), | |
119 | - onclick: "i3GEOF.metaestat.analise.ativaTme()", | |
120 | - icone: "imagens/gisicons/3d-light.png" | |
121 | - },{ | |
122 | - titulo: "Estatísticas gerais", | |
123 | - onclick: "i3GEOF.metaestat.analise.estatistica()", | |
124 | - icone: "imagens/gisicons/stats.png" | |
125 | - },{ | |
126 | - titulo: "Ativa/Desativa contorno dos limites geográficos", | |
127 | - onclick: "i3GEOF.metaestat.analise.contorno()", | |
128 | - icone: "imagens/gisicons/boundary-remove-add.png" | |
129 | - },{ | |
130 | - titulo: "Altera a forma de representação gráfica", | |
131 | - onclick: "i3GEOF.metaestat.analise.alteraRep()", | |
132 | - icone: "imagens/gisicons/shape.png" | |
133 | - },{ | |
134 | - titulo: "Mapa de calor", | |
135 | - onclick: "i3GEOF.metaestat.analise.calor()", | |
136 | - icone: "imagens/gisicons/dem.png" | |
137 | - },{ | |
138 | - titulo: "Congela visão", | |
139 | - onclick: "i3GEO.mapa.dialogo.congelaMapa()", | |
140 | - icone: "imagens/gisicons/mapset-add.png" | |
141 | - },{ | |
142 | - titulo: "Mostra os valores como textos no mapa", | |
143 | - onclick: "i3GEOF.metaestat.analise.toponimia()", | |
144 | - icone: "imagens/gisicons/label.png" | |
145 | - } | |
146 | - ], | |
147 | - inicia: function(iddiv){ | |
148 | - var ics,n,i; | |
149 | - if(!iddiv || !$i(iddiv)){ | |
150 | - iddiv = "i3geoCartoAnalise_corpo"; | |
151 | - } | |
152 | - if(i3GEOF.metaestat.INTERFACE == "flutuante"){ | |
153 | - i3GEOF.metaestat.analise.abreJanela(); | |
154 | - } | |
155 | - $i(iddiv).innerHTML = i3GEOF.metaestat.analise.html(); | |
156 | - ics = $i(iddiv).getElementsByTagName("button"); | |
157 | - n = ics.length; | |
158 | - for(i=0;i<n;i++){ | |
159 | - ics[i].style.backgroundColor = "white"; | |
160 | - ics[i].className = "iconeGuiaMovel"; | |
161 | - ics[i].onmouseout = function(){this.className = "iconeGuiaMovel iconeGuiaMovelMouseOut";}; | |
162 | - ics[i].onmouseover = function(){this.className = "iconeGuiaMovel iconeGuiaMovelMouseOver";}; | |
163 | - ics[i].style.backgroundImage = "none"; | |
164 | - ics[i].style.height = "32px"; | |
165 | - ics[i].style.width = "32px"; | |
166 | - ics[i].style.border = "1px solid gray"; | |
167 | - ics[i].style.margin = "0px"; | |
168 | - ics[i].style.position = "relative"; | |
169 | - } | |
170 | - i3GEOF.metaestat.analise.comboCamadas(); | |
171 | - }, | |
172 | - abreJanela: function(){ | |
173 | - var cabecalho,minimiza,imagemxy,janela; | |
174 | - if (!$i("i3geoCartoAnalise")){ | |
175 | - cabecalho = function(){ | |
176 | - }; | |
177 | - minimiza = function(){ | |
178 | - i3GEO.janela.minimiza("i3geoCartoAnalise"); | |
179 | - }; | |
180 | - janela = i3GEO.janela.cria( | |
181 | - "270px", | |
182 | - "170px", | |
183 | - "", | |
184 | - "", | |
185 | - "", | |
186 | - $trad(11,i3GEOF.metaestat.dicionario), | |
187 | - "i3geoCartoAnalise", | |
188 | - false, | |
189 | - "hd", | |
190 | - cabecalho, | |
191 | - minimiza | |
192 | - ); | |
193 | - janela = janela[0]; | |
194 | - YAHOO.i3GEO.janela.manager.register(janela); | |
195 | - janela.render(); | |
196 | - } | |
197 | - else{ | |
198 | - janela = YAHOO.i3GEO.janela.manager.find("i3geoCartoAnalise"); | |
199 | - } | |
200 | - janela.show(); | |
201 | - imagemxy = i3GEO.util.pegaPosicaoObjeto($i(i3GEO.Interface.IDCORPO)); | |
202 | - janela.moveTo(imagemxy[0]+(i3GEOF.metaestat.LEFT*2)+i3GEOF.metaestat.LARGURA+10,i3GEOF.metaestat.TOP); | |
203 | - }, | |
204 | - html: function(){ | |
205 | - var ins = '<div id="i3geoCartoAnaliseContainer" style="margin-left:5px;line-height:25px">', | |
206 | - b = i3GEOF.metaestat.analise.botoes, | |
207 | - n = b.length, | |
208 | - i; | |
209 | - ins += '<div id="i3geoCartoAnaliseCamadas" style="top:-5px;height:50px;display:none"></div>'; | |
210 | - for(i=0;i<n;i++){ | |
211 | - ins += '<button title="'+b[i].titulo+'" onclick="'+b[i].onclick+'"><img src="'+i3GEO.configura.locaplic+"/"+b[i].icone+'" /></button>'; | |
212 | - } | |
213 | - ins += '</div><input type=hidden value="" id="listaColourRampAnaliseMetaestat" onchange="i3GEOF.metaestat.analise.aplicaColourRamp()" />'; //utilizado pelo seletor de colourramp | |
214 | - return ins; | |
215 | - }, | |
216 | - comboCamadas: function(){ | |
217 | - if(!$i("i3geoCartoAnaliseCamadas")){ | |
218 | - return; | |
219 | - } | |
220 | - var temp = function(retorno){ | |
221 | - var temas = retorno.data, | |
222 | - n = temas.length, | |
223 | - i,t,ins; | |
224 | - ins = "<p class=paragrafo style='position:relative;top:5px;'>Ativar a camada:</p><select id='i3geoCartoAnaliseCamadasCombo' onchange='i3GEOF.metaestat.comum.ativaCamada(this.value)' style='width:250px;' ><option value=''>---</option>"; | |
225 | - for(i=0;i<n;i++){ | |
226 | - t = i3GEO.arvoreDeCamadas.pegaTema(temas[i]); | |
227 | - if(t != ""){ | |
228 | - ins += "<option value='"+temas[i]+"'>"+t.tema+"</option>"; | |
229 | - } | |
230 | - } | |
231 | - $i("i3geoCartoAnaliseCamadas").innerHTML = ins+"</select>"; | |
232 | - if(i3GEO.temaAtivo != ""){ | |
233 | - $i("i3geoCartoAnaliseCamadasCombo").value = i3GEO.temaAtivo; | |
234 | - } | |
235 | - $i("i3geoCartoAnaliseCamadas").style.display = "block"; | |
236 | - //if(i3GEO.eventos.ATUALIZAARVORECAMADAS.toString().search('i3GEOF.metaestat.analise.comboCamadas()') < 0) | |
237 | - //{i3GEO.eventos.ATUALIZAARVORECAMADAS.push('i3GEOF.metaestat.analise.comboCamadas()');} | |
238 | - }; | |
239 | - i3GEO.php.listaCamadasMetaestat(temp); | |
240 | - }, | |
241 | - toponimia: function(){ | |
242 | - if($i("i3geoCartoAnaliseCamadasCombo").value == ""){ | |
243 | - i3GEO.janela.tempoMsg("Ative uma camada primeiro"); | |
244 | - return; | |
245 | - } | |
246 | - i3GEO.mapa.ativaTema($i("i3geoCartoAnaliseCamadasCombo").value); | |
247 | - i3GEO.util.dialogoFerramenta("i3GEO.tema.dialogo.toponimia()","toponimia","toponimia","index.js","i3GEOF.metaestat.analise.abreToponimia()"); | |
248 | - }, | |
249 | - abreToponimia: function(){ | |
250 | - var p = i3GEO.configura.locaplic+"/ferramentas/metaestat/analise.php?g_sid="+i3GEO.configura.sid + | |
251 | - "&funcao=pegaDadosTME&tema="+i3GEO.temaAtivo, | |
252 | - temp = function(retorno){ | |
253 | - i3GEO.janela.fechaAguarde("aguardeBuscaDados"); | |
254 | - i3GEOF.toponimia.ATIVAITEM = retorno.data.itemDados; | |
255 | - i3GEOF.toponimia.iniciaJanelaFlutuante(); | |
256 | - }; | |
257 | - i3GEO.janela.abreAguarde("aguardeBuscaDados","Aguarde..."); | |
258 | - i3GEO.util.ajaxGet(p,temp); | |
259 | - }, | |
260 | - alteraRep: function(){ | |
261 | - if(typeof(i3GEOF.alterarep) === 'undefined'){ | |
262 | - i3GEO.util.scriptTag( | |
263 | - i3GEO.configura.locaplic+"/ferramentas/metaestat/alterarep.js", | |
264 | - "i3GEOF.alterarep.iniciaJanelaFlutuante()", | |
265 | - "i3GEOF.alterarep_script" | |
266 | - ); | |
267 | - } | |
268 | - else{ | |
269 | - i3GEOF.alterarep.iniciaJanelaFlutuante(); | |
270 | - } | |
271 | - }, | |
272 | - calor: function(){ | |
273 | - if($i("i3geoCartoAnaliseCamadasCombo").value == ""){ | |
274 | - i3GEO.janela.tempoMsg("Ative uma camada primeiro"); | |
275 | - return; | |
276 | - } | |
277 | - if(!window.confirm("Gera o mapa de calor? Isso pode demorar...")){ | |
278 | - return; | |
279 | - } | |
280 | - i3GEO.janela.tempoMsg("Será considerada apenas a região mostrada no mapa"); | |
281 | - i3GEO.mapa.ativaTema($i("i3geoCartoAnaliseCamadasCombo").value); | |
282 | - var p = i3GEO.configura.locaplic+"/ferramentas/metaestat/analise.php?g_sid="+i3GEO.configura.sid + | |
283 | - "&funcao=calor&tema="+$i("i3geoCartoAnaliseCamadasCombo").value+"&ext="+i3GEO.parametros.mapexten, | |
284 | - temp = function(retorno){ | |
285 | - i3GEO.janela.fechaAguarde("aguardecalor"); | |
286 | - i3GEO.atualiza(); | |
287 | - }; | |
288 | - i3GEO.janela.abreAguarde("aguardecalor","Aguarde..."); | |
289 | - i3GEO.util.ajaxGet(p,temp); | |
290 | - }, | |
291 | - mostraRegiao: function(){ | |
292 | - if(typeof(i3GEOF.mostraregiao) === 'undefined'){ | |
293 | - i3GEO.util.scriptTag( | |
294 | - i3GEO.configura.locaplic+"/ferramentas/metaestat/mostraregiao.js", | |
295 | - "i3GEOF.mostraregiao.iniciaJanelaFlutuante()", | |
296 | - "i3GEOF.mostraregiao_script" | |
297 | - ); | |
298 | - } | |
299 | - else{ | |
300 | - i3GEOF.mostraregiao.iniciaJanelaFlutuante(); | |
301 | - } | |
302 | - }, | |
303 | - contorno: function(){ | |
304 | - if($i("i3geoCartoAnaliseCamadasCombo").value == ""){ | |
305 | - i3GEO.janela.tempoMsg("Ative uma camada primeiro"); | |
306 | - return; | |
307 | - } | |
308 | - i3GEO.mapa.ativaTema($i("i3geoCartoAnaliseCamadasCombo").value); | |
309 | - var p = i3GEO.configura.locaplic+"/ferramentas/metaestat/analise.php?g_sid="+i3GEO.configura.sid + | |
310 | - "&funcao=alteraContorno&tema="+$i("i3geoCartoAnaliseCamadasCombo").value, | |
311 | - temp = function(retorno){ | |
312 | - i3GEO.janela.fechaAguarde("aguardecontorno"); | |
313 | - i3GEO.atualiza(); | |
314 | - i3GEO.Interface.atualizaTema("",i3GEO.temaAtivo); | |
315 | - i3GEO.arvoreDeCamadas.atualizaLegenda(i3GEO.temaAtivo); | |
316 | - }; | |
317 | - i3GEO.janela.abreAguarde("aguardecontorno","Aguarde..."); | |
318 | - i3GEO.util.ajaxGet(p,temp); | |
319 | - }, | |
320 | - ativaTme: function(){ | |
321 | - if($i("i3geoCartoAnaliseCamadasCombo").value == ""){ | |
322 | - i3GEO.janela.tempoMsg("Ative uma camada primeiro"); | |
323 | - return; | |
324 | - } | |
325 | - i3GEO.mapa.ativaTema($i("i3geoCartoAnaliseCamadasCombo").value); | |
326 | - i3GEO.util.dialogoFerramenta("i3GEO.tema.dialogo.tme()","tme","tme","index.js","i3GEOF.metaestat.analise.abreTme()"); | |
327 | - }, | |
328 | - abreTme: function(){ | |
329 | - //i3GEOF.tme.ITEMNOMEREGIOES | |
330 | - var p = i3GEO.configura.locaplic+"/ferramentas/metaestat/analise.php?g_sid="+i3GEO.configura.sid + | |
331 | - "&funcao=pegaDadosTME&tema="+i3GEO.temaAtivo, | |
332 | - temp = function(retorno){ | |
333 | - i3GEO.janela.fechaAguarde("aguardeBuscaDados"); | |
334 | - i3GEOF.tme.ITEMNOMEREGIOES = retorno.data.itemNomeRegioes; | |
335 | - i3GEOF.tme.ITEMDADOS = retorno.data.itemDados; | |
336 | - i3GEOF.tme.iniciaJanelaFlutuante(); | |
337 | - }; | |
338 | - i3GEO.janela.abreAguarde("aguardeBuscaDados","Aguarde..."); | |
339 | - i3GEO.util.ajaxGet(p,temp); | |
340 | - }, | |
341 | - estatistica: function(){ | |
342 | - if($i("i3geoCartoAnaliseCamadasCombo").value == ""){ | |
343 | - i3GEO.janela.tempoMsg("Ative uma camada primeiro"); | |
344 | - return; | |
345 | - } | |
346 | - i3GEO.mapa.ativaTema($i("i3geoCartoAnaliseCamadasCombo").value); | |
347 | - //primeiro pega o nome da coluna que contem os dados | |
348 | - //depois busca as estatisticas | |
349 | - var p = i3GEO.configura.locaplic+"/ferramentas/metaestat/analise.php?g_sid="+i3GEO.configura.sid + | |
350 | - "&funcao=pegaDadosTME&tema="+i3GEO.temaAtivo, | |
351 | - temp = function(retorno){ | |
352 | - if(retorno && retorno.data && retorno.data.itemDados != ""){ | |
353 | - var item = retorno.data.itemDados, | |
354 | - p = i3GEO.configura.locaplic+"/ferramentas/tabela/exec.php?g_sid=" + | |
355 | - i3GEO.configura.sid+"&funcao=estatistica&item="+item+ | |
356 | - "&tema="+i3GEO.temaAtivo+"&exclui=&ext="+i3GEO.parametros.extentTotal, | |
357 | - monta = function(retorno){ | |
358 | - i3GEO.janela.fechaAguarde("aguardeBuscaDados"); | |
359 | - var ins = "", | |
360 | - nometema, | |
361 | - nome, | |
362 | - valor, | |
363 | - i, | |
364 | - n; | |
365 | - nometema = i3GEO.arvoreDeCamadas.pegaTema(i3GEO.temaAtivo); | |
366 | - if(nometema && nometema.tema){ | |
367 | - ins = "<p style='text-align:left'> <span style='color:gray'><b>Camada: </b></span>"+nometema.tema+"</p>" + | |
368 | - "<p style='text-align:left'> <span style='color:gray'><b>Coluna: </b></span>"+item+"</p>"; | |
369 | - } | |
370 | - if(retorno.data.indices !== undefined){ | |
371 | - if (retorno.data.indices){ | |
372 | - n = retorno.data.indices.length; | |
373 | - for (i=0;i<n;i++){ | |
374 | - nome = eval("retorno.data.variaveis."+retorno.data.indices[i]); | |
375 | - valor = eval("retorno.data.valores."+retorno.data.indices[i]); | |
376 | - ins += "<p style='text-align:left'> <span style='color:gray'>"+nome+": </span>"+valor+"</p>"; | |
377 | - } | |
378 | - } | |
379 | - } | |
380 | - else{ | |
381 | - ins = retorno.data; | |
382 | - } | |
383 | - i3GEO.janela.mensagemSimples(ins,"Estatísticas"); | |
384 | - }; | |
385 | - i3GEO.util.ajaxGet(p,monta); | |
386 | - } | |
387 | - else{ | |
388 | - i3GEO.janela.fechaAguarde("aguardeBuscaDados"); | |
389 | - i3GEO.janela.tempoMsg("Ocorreu algum erro"); | |
390 | - } | |
391 | - }; | |
392 | - i3GEO.janela.abreAguarde("aguardeBuscaDados","Aguarde..."); | |
393 | - i3GEO.util.ajaxGet(p,temp); | |
394 | - }, | |
395 | - ativaAnimacao: function(){ | |
396 | - i3GEO.util.dialogoFerramenta("i3GEO.mapa.dialogo.animacao()","animacao","animacao","index.js","i3GEOF.metaestat.analise.listaCamadasAnimacao()"); | |
397 | - }, | |
398 | - listaCamadasAnimacao: function(){ | |
399 | - var temp = function(retorno){ | |
400 | - var temas = retorno.data, | |
401 | - n = temas.length, | |
402 | - camadas = [], | |
403 | - i,t; | |
404 | - i3GEOF.animacao.iniciaJanelaFlutuante(); | |
405 | - for(i=0;i<n;i++){ | |
406 | - t = i3GEO.arvoreDeCamadas.pegaTema(temas[i]); | |
407 | - if(t != ""){ | |
408 | - camadas.push(t); | |
409 | - } | |
410 | - } | |
411 | - i3GEOF.animacao.listaDeCamadas(camadas); | |
412 | - }; | |
413 | - i3GEO.php.listaCamadasMetaestat(temp); | |
414 | - }, | |
415 | - ativaEditorLegenda: function(){ | |
416 | - if($i("i3geoCartoAnaliseCamadasCombo").value == ""){ | |
417 | - i3GEO.janela.tempoMsg("Ative uma camada primeiro"); | |
418 | - return; | |
419 | - } | |
420 | - i3GEO.mapa.ativaTema($i("i3geoCartoAnaliseCamadasCombo").value); | |
421 | - i3GEOF.legenda.iniciaJanelaFlutuante(); | |
422 | - i3GEO.guias.mostraGuiaFerramenta('i3GEOlegendaguia2','i3GEOlegendaguia'); | |
423 | - //desmarca a opcao que considera apenas os elementos visiveis | |
424 | - if($i("i3GEOFlegendaaplicaextent")){ | |
425 | - $i("i3GEOFlegendaaplicaextent").checked = false; | |
426 | - } | |
427 | - if($i("i3GEOFlegendaClassesOpcionais")){ | |
428 | - $i("i3GEOFlegendaClassesOpcionais").style.display = "none"; | |
429 | - } | |
430 | - var temp = $i("i3GEOF.legenda_corpo"); | |
431 | - temp.getElementsByTagName("div")[0].style.display = "none"; | |
432 | - }, | |
433 | - alteraClasses: function(){ | |
434 | - i3GEO.util.dialogoFerramenta("i3GEO.tema.dialogo.editaLegenda()","legenda","legenda","index.js","i3GEOF.metaestat.analise.ativaEditorLegenda()"); | |
435 | - }, | |
436 | - alteraCores: function(){ | |
437 | - //listaColourRampAnaliseMetaestat e o id do elemento input que recebera a lista de cores | |
438 | - i3GEO.util.abreColourRamp("","listaColourRampAnaliseMetaestat",10); | |
439 | - }, | |
440 | - //disparado no evento onchange do input que guarda o numero de cores | |
441 | - aplicaColourRamp: function(){ | |
442 | - var i = $i("listaColourRampAnaliseMetaestat"); | |
443 | - if(i.value != ""){ | |
444 | - var p,temp,cores = i.value; | |
445 | - temp = function(){ | |
446 | - i3GEO.janela.fechaAguarde("aguardeAplicaCores"); | |
447 | - i3GEO.atualiza(); | |
448 | - i3GEO.Interface.atualizaTema("",i3GEO.temaAtivo); | |
449 | - i3GEO.arvoreDeCamadas.atualizaLegenda(i3GEO.temaAtivo); | |
450 | - }; | |
451 | - p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid + | |
452 | - "&funcao=alteraclasse&opcao=aplicacoresrgb&ext=" + | |
453 | - i3GEO.parametros.mapexten + | |
454 | - "&tema="+i3GEO.temaAtivo + | |
455 | - "&cores=" + cores; | |
456 | - i3GEO.janela.AGUARDEMODAL = true; | |
457 | - i3GEO.janela.abreAguarde("aguardeAplicaCores","Aplicando..."); | |
458 | - i3GEO.janela.AGUARDEMODAL = false; | |
459 | - i3GEO.util.ajaxGet(p,temp); | |
460 | - } | |
461 | - }, | |
462 | - filtraPeriodo: { | |
463 | - //CAMADAS: "", | |
464 | - inicia: function(){ | |
465 | - i3GEO.janela.tempoMsg("Ao agregar dados por período a forma de cálculo (soma ou média) é mantida conforme o orginal da camada já existente"); | |
466 | - if($i("i3GEOF.filtraperiodo_corpo")){ | |
467 | - return; | |
468 | - } | |
469 | - var minimiza,cabecalho,titulo,ins; | |
470 | - cabecalho = function(){ | |
471 | - }; | |
472 | - minimiza = function(){ | |
473 | - i3GEO.janela.minimiza("i3GEOF.filtraperiodo"); | |
474 | - }; | |
475 | - //cria a janela flutuante | |
476 | - titulo = "Filtro temporal </a>"; | |
477 | - i3GEO.janela.cria( | |
478 | - "260px", | |
479 | - "340px", | |
480 | - "", | |
481 | - "", | |
482 | - "", | |
483 | - titulo, | |
484 | - "i3GEOF.filtraperiodo", | |
485 | - false, | |
486 | - "hd", | |
487 | - cabecalho, | |
488 | - minimiza | |
489 | - ); | |
490 | - $i("i3GEOF.filtraperiodo_corpo").style.backgroundColor = "white"; | |
491 | - ins = "" + | |
492 | - '<p class=paragrafo ><b>Camada que receberá o filtro:</b></p>' + | |
493 | - '<div id="i3GEOF.filtraperiodo.camadas" ></div>' + | |
494 | - '<p class=paragrafo ><b>Início do período:</b></p>' + | |
495 | - '<div id="i3GEOF.filtraperiodo.Pi_0" ></div>' + | |
496 | - '<p class=paragrafo ><b>Fim do período:</b></p>' + | |
497 | - '<div id="i3GEOF.filtraperiodo.Pf_0" ></div>' + | |
498 | - '<br><br><input id=i3geofiltraperiodoAplica type="button" value="Aplicar" />' + | |
499 | - '<input id=i3geofiltraperiodoRemove type="button" value="Remover" />'; | |
500 | - $i("i3GEOF.filtraperiodo_corpo").innerHTML = ins; | |
501 | - new YAHOO.widget.Button( | |
502 | - "i3geofiltraperiodoAplica", | |
503 | - {onclick:{fn: i3GEOF.metaestat.analise.filtraPeriodo.adicionaFiltro}} | |
504 | - ); | |
505 | - new YAHOO.widget.Button( | |
506 | - "i3geofiltraperiodoRemove", | |
507 | - {onclick:{fn: function(){}}} | |
508 | - ); | |
509 | - i3GEOF.metaestat.analise.filtraPeriodo.comboCamadas(); | |
510 | - }, | |
511 | - comboCamadas: function(retorno){ | |
512 | - var temp = function(retorno){ | |
513 | - //i3GEOF.metaestat.analise.filtraPeriodo.CAMADAS = retorno.data; | |
514 | - var i, | |
515 | - n = retorno.data.length, | |
516 | - ins = '<select id="i3GEOF.filtraperiodo.comboCamada" onchange="javascript:i3GEOF.metaestat.analise.filtraPeriodo.comboParametrosReinicia();i3GEOF.metaestat.analise.filtraPeriodo.comboParametros()" style="width:220px;" id="i3GEOF.filtraperiodo.temas" ><option value="">---</option>'; | |
517 | - for(i=0;i<n;i++){ | |
518 | - ins += '<option value="'+retorno.data[i].layer+'" >'+retorno.data[i].nome+'</option>'; | |
519 | - } | |
520 | - ins += "</select><br><br>"; | |
521 | - $i("i3GEOF.filtraperiodo.camadas").innerHTML = ins; | |
522 | - }; | |
523 | - i3GEO.util.ajaxGet( | |
524 | - i3GEO.configura.locaplic+"/ferramentas/metaestat/analise.php?funcao=listaCamadasFiltroTempo&g_sid="+i3GEO.configura.sid, | |
525 | - temp | |
526 | - ); | |
527 | - }, | |
528 | - comboParametrosReinicia: function(operacao){ | |
529 | - $i("i3GEOF.filtraperiodo.Pi_0").innerHTML = ""; | |
530 | - $i("i3GEOF.filtraperiodo.Pf_0").innerHTML = ""; | |
531 | - }, | |
532 | - comboParametros: function(){ | |
533 | - if($i("i3GEOF.filtraperiodo.comboCamada").value == ""){ | |
534 | - return; | |
535 | - } | |
536 | - if($i("i3GEOF.filtraperiodo.Pi_0").innerHTML == ""){ | |
537 | - i3GEOF.metaestat.analise.filtraPeriodo.parametro(0); | |
538 | - return; | |
539 | - } | |
540 | - }, | |
541 | - parametro: function(nivel){ | |
542 | - var layer = $i("i3GEOF.filtraperiodo.comboCamada").value, | |
543 | - temp = function(retorno){ | |
544 | - var n = retorno.data.length, | |
545 | - i, | |
546 | - ins = ""; | |
547 | - if(retorno.data[0] && retorno.data[0].id_pai){ | |
548 | - for(i=0;i<n;i++){ | |
549 | - ins += "<option value='"+retorno.data[i].id_parametro_medida+"'>"+retorno.data[i].nome+"</option>"; | |
550 | - } | |
551 | - $i("i3GEOF.filtraperiodo.Pi_"+nivel).innerHTML = "<p class=paragrafo>Nome do parâmetro:<br>" + | |
552 | - "<select name='' onchange='i3GEOF.metaestat.analise.filtraPeriodo.valoresParametro(this.value,"+nivel+",\"Pi_"+nivel+"\")' style='wisth:150px;'>" + | |
553 | - "<option value='' >---</option>"+ins+"</select></p><div class=paragrafo id='Pi_"+nivel+"'></div>"; | |
554 | - $i("i3GEOF.filtraperiodo.Pf_"+nivel).innerHTML = "<p class=paragrafo>Nome do parâmetro:<br>" + | |
555 | - "<select name='' onchange='i3GEOF.metaestat.analise.filtraPeriodo.valoresParametro(this.value,"+nivel+",\"Pf_"+nivel+"\")' style='wisth:150px;'>" + | |
556 | - "<option value='' >---</option>"+ins+"</select></p><div class=paragrafo id='Pf_"+nivel+"'></div>"; | |
557 | - } | |
558 | - }; | |
559 | - i3GEO.util.ajaxGet( | |
560 | - i3GEO.configura.locaplic+"/ferramentas/metaestat/analise.php?funcao=listaFiltroTempo&g_sid="+i3GEO.configura.sid+"&layer="+layer+"&nivel="+nivel, | |
561 | - temp | |
562 | - ); | |
563 | - }, | |
564 | - valoresParametro: function(id_parametro_medida,nivel,onde){ | |
565 | - if(id_parametro_medida === ""){ | |
566 | - $i(onde).innerHTML = ""; | |
567 | - return; | |
568 | - } | |
569 | - var temp = function(retorno){ | |
570 | - var ins="",i=0,n = retorno.length; | |
571 | - ins += "<p class=paragrafo>Valor:<br>" + | |
572 | - "<select name='"+id_parametro_medida+"' onchange='i3GEOF.metaestat.analise.filtraPeriodo.parametro("+(nivel*1 + 1)+")' style='wisth:150px;background-color:yellow;'><option value=''>---</option>"; | |
573 | - for(i=0;i<n;i++){ | |
574 | - ins += "<option value='"+retorno[i]+"'>"+retorno[i]+"</option>"; | |
575 | - } | |
576 | - $i(onde).innerHTML = ins+"</select>"; | |
577 | - }; | |
578 | - i3GEO.php.listaValoresParametroMedidaVariavel(id_parametro_medida,temp); | |
579 | - }, | |
580 | - adicionaFiltro: function(){ | |
581 | - i3GEO.janela.tempoMsg("O filtro de tempo não modifica as camadas que foram criadas considerando-se uma data específica"); | |
582 | - var p,pini,pfim, | |
583 | - temp = function(retorno){ | |
584 | - i3GEO.janela.fechaAguarde("aguardeAplicaFiltro"); | |
585 | - i3GEO.Interface.atualizaMapa(); | |
586 | - }; | |
587 | - i3GEO.janela.AGUARDEMODAL = true; | |
588 | - i3GEO.janela.abreAguarde("aguardeAplicaFiltro","Aplicando..."); | |
589 | - i3GEO.janela.AGUARDEMODAL = false; | |
590 | - //pega o filtro | |
591 | - pini = i3GEOF.metaestat.analise.filtraPeriodo.pegaParametros("i3GEOF.filtraperiodo.Pi_0"); | |
592 | - pfim = i3GEOF.metaestat.analise.filtraPeriodo.pegaParametros("i3GEOF.filtraperiodo.Pf_0"); | |
593 | - // | |
594 | - p = i3GEO.configura.locaplic+"/ferramentas/metaestat/analise.php?funcao=aplicaFiltroTempo" + | |
595 | - "&pari="+pini[0] + | |
596 | - "&vali="+pini[1] + | |
597 | - "&parf="+pfim[0] + | |
598 | - "&valf="+pfim[1] + | |
599 | - "&tema="+$i("i3GEOF.filtraperiodo.comboCamada").value + | |
600 | - "&g_sid="+i3GEO.configura.sid; | |
601 | - if(pini[0].length == 0 || pini[1].length == 0){ | |
602 | - i3GEO.janela.fechaAguarde("aguardeAplicaFiltro"); | |
603 | - return; | |
604 | - } | |
605 | - i3GEO.util.ajaxGet(p,temp); | |
606 | - }, | |
607 | - removeFiltro: function(){ | |
608 | - var p, | |
609 | - temp = function(retorno){ | |
610 | - i3GEO.janela.fechaAguarde("aguardeAplicaFiltro"); | |
611 | - i3GEO.Interface.atualizaMapa(); | |
612 | - }; | |
613 | - i3GEO.janela.AGUARDEMODAL = true; | |
614 | - i3GEO.janela.abreAguarde("aguardeAplicaFiltro","Aplicando..."); | |
615 | - i3GEO.janela.AGUARDEMODAL = false; | |
616 | - p = i3GEO.configura.locaplic+"/ferramentas/metaestat/analise.php?funcao=removeFiltroTempo" + | |
617 | - "&tema="+$i("i3GEOF.filtraperiodo.comboCamada").value + | |
618 | - "&g_sid="+i3GEO.configura.sid; | |
619 | - i3GEO.util.ajaxGet(p,temp); | |
620 | - }, | |
621 | - pegaParametros:function(id){ | |
622 | - var c = $i(id).getElementsByTagName("select"), | |
623 | - n = c.length, | |
624 | - par = [], | |
625 | - val = [], | |
626 | - i; | |
627 | - if(!c){ | |
628 | - return [par,val]; | |
629 | - } | |
630 | - for(i=0;i<n;i++){ | |
631 | - if(c[i].name != "" && c[i].value != ""){ | |
632 | - par.push(c[i].name); | |
633 | - val.push(c[i].value); | |
634 | - } | |
635 | - } | |
636 | - return [par,val]; | |
637 | - } | |
638 | - } | |
639 | - }, | |
640 | - classes:{ | |
641 | - inicia: function(iddiv){ | |
642 | - if(!$i("i3geoCartoComboMedidasVariavel")){ | |
643 | - i3GEO.janela.tempoMsg("erro: i3geoCartoComboMedidasVariavel???"); | |
644 | - return; | |
645 | - } | |
646 | - if($i("i3geoCartoComboMedidasVariavel").value === ""){ | |
647 | - i3GEO.janela.tempoMsg("erro: i3geoCartoComboMedidasVariavel???"); | |
648 | - return; | |
649 | - } | |
650 | - if(!iddiv || !$i(iddiv)){ | |
651 | - iddiv = "i3geoCartoClasses_corpo"; | |
652 | - } | |
653 | - if(i3GEOF.metaestat.INTERFACE == "flutuante"){ | |
654 | - i3GEOF.metaestat.classes.abreJanela(); | |
655 | - $i(iddiv).innerHTML = i3GEOF.metaestat.classes.html(); | |
656 | - i3GEOF.metaestat.classes.comboTipoRep(); | |
657 | - i3GEOF.metaestat.classes.comboTipoClassificacao(); | |
658 | - i3GEOF.metaestat.classes.comboRegiao(); | |
659 | - } | |
660 | - if(i3GEOF.metaestat.INTERFACE == "flutuanteSimples"){ | |
661 | - i3GEOF.metaestat.classes.abreJanela(); | |
662 | - $i(iddiv).innerHTML = i3GEOF.metaestat.classes.html(); | |
663 | - i3GEOF.metaestat.classes.comboTipoClassificacao(); | |
664 | - } | |
665 | - }, | |
666 | - abreJanela: function(){ | |
667 | - var cabecalho,minimiza,janela; | |
668 | - if (!$i("i3geoCartoClasses")){ | |
669 | - cabecalho = function(){ | |
670 | - }; | |
671 | - minimiza = function(){ | |
672 | - }; | |
673 | - janela = i3GEO.janela.cria( | |
674 | - i3GEOF.metaestat.LARGURA+10+"px", | |
675 | - i3GEOF.metaestat.ALTURA - 50 +"px", | |
676 | - "", | |
677 | - "", | |
678 | - "", | |
679 | - $trad(6,i3GEOF.metaestat.dicionario), | |
680 | - "i3geoCartoClasses", | |
681 | - true, | |
682 | - "hd", | |
683 | - cabecalho, | |
684 | - minimiza | |
685 | - ); | |
686 | - janela = janela[0]; | |
687 | - YAHOO.i3GEO.janela.manager.register(janela); | |
688 | - janela.render(); | |
689 | - } | |
690 | - else{ | |
691 | - janela = YAHOO.i3GEO.janela.manager.find("i3geoCartoClasses"); | |
692 | - } | |
693 | - janela.show(); | |
694 | - i3GEOF.metaestat.classes.botaoAplicar(); | |
695 | - //imagemxy = i3GEO.util.pegaPosicaoObjeto($i(i3GEO.Interface.IDCORPO)); | |
696 | - //janela.moveTo(imagemxy[0]+i3GEOF.metaestat.LEFT+i3GEOF.metaestat.LARGURA+20,i3GEOF.metaestat.TOP); | |
697 | - }, | |
698 | - botaoAplicar: function(){ | |
699 | - YAHOO.i3GEO.janela.manager.find("i3geoCartoClasses").setFooter('<input type="button" id="i3GEOcartoClassesBotaoAaplicar" value="Aplicar" class="paragrafo" style="width:200px;cursor:pointer;color:blue" />'); | |
700 | - new YAHOO.widget.Button( | |
701 | - "i3GEOcartoClassesBotaoAaplicar", | |
702 | - {onclick:{fn: i3GEOF.metaestat.classes.aplicar}} | |
703 | - ); | |
704 | - $i("i3GEOcartoClassesBotaoAaplicar-button").style.width = i3GEOF.metaestat.LARGURA - 15 + "px"; | |
705 | - }, | |
706 | - aplicar: function(){ | |
707 | - if($i("i3geoCartoComboTipoRep") && $i("i3geoCartoComboTipoRep").options){ | |
708 | - i3GEOF.metaestat.comum.tipoRep = [$i("i3geoCartoComboTipoRep").value,$i("i3geoCartoComboTipoRep").options[$i("i3geoCartoComboTipoRep").selectedIndex].label]; | |
709 | - } | |
710 | - else{ | |
711 | - i3GEOF.metaestat.comum.tipoRep = [$i("i3geoCartoComboTipoRep").value,""]; | |
712 | - } | |
713 | - i3GEOF.metaestat.comum.tipoClassificacao = [$i("i3geoCartoComboTipoClassificacao").value,$i("i3geoCartoComboTipoClassificacao").options[$i("i3geoCartoComboTipoClassificacao").selectedIndex].label]; | |
714 | - i3GEOF.metaestat.comum.tipoRegiao = [$i("i3geoCartoComboRegioesMedidasVariavel").value,$i("i3geoCartoComboRegioesMedidasVariavel").options[$i("i3geoCartoComboRegioesMedidasVariavel").selectedIndex].label]; | |
715 | - | |
716 | - i3GEOF.metaestat.classes.destroiJanela(); | |
717 | - }, | |
718 | - zeraParametros: function(){ | |
719 | - i3GEOF.metaestat.comum.tipoRep = ["",""]; | |
720 | - i3GEOF.metaestat.comum.tipoClassificacao = ["",""]; | |
721 | - i3GEOF.metaestat.comum.tipoRegiao = ["",""]; | |
722 | - }, | |
723 | - destroiJanela: function(){ | |
724 | - var janela = YAHOO.i3GEO.janela.manager.find("i3geoCartoClasses"); | |
725 | - if(janela){ | |
726 | - janela.destroy(); | |
727 | - } | |
728 | - }, | |
729 | - html: function(){ | |
730 | - var ins = '<div id="i3geoCartoClassesContainer" style="margin-left:5px;">' + | |
731 | - '<div class="paragrafo" id="i3geoCartoTipoRep" >' + | |
732 | - '</div>' + | |
733 | - '<div class="paragrafo" id="i3geoCartoTipoClassificacao" >' + | |
734 | - '</div>' + | |
735 | - '<div class="paragrafo" id="i3geoCartoRegioesMedidasVariavel" >' + | |
736 | - '</div>' + | |
737 | - '</div>'; | |
738 | - return ins; | |
739 | - }, | |
740 | - comboTipoRep: function(){ | |
741 | - var onde = $i("i3geoCartoTipoRep"), | |
742 | - ins,i, | |
743 | - dados = [ | |
744 | - {"codigo":"polygon","nome":"polígonos"}, | |
745 | - {"codigo":"point","nome":"pontos"} | |
746 | - ], | |
747 | - n = dados.length; | |
748 | - ins = '' + | |
749 | - '<br><p class="paragrafo" >'+$trad(8,i3GEOF.metaestat.dicionario)+'</p>' + | |
750 | - "<select id='i3geoCartoComboTipoRep' style='box-shadow:0 1px 5px gray;width:"+(i3GEOF.metaestat.LARGURA - 20)+"px' onchange=''>"; | |
751 | - for(i=0;i<n;i++){ | |
752 | - ins += "<option value='"+dados[i].codigo+"'>"+dados[i].nome+"</option>"; | |
753 | - } | |
754 | - ins += "</select>"; | |
755 | - if(onde){ | |
756 | - onde.innerHTML = ins; | |
757 | - //i3GEOF.metaestat.classes.botaoAdicionarCamada(); | |
758 | - } | |
759 | - return ins; | |
760 | - }, | |
761 | - comboTipoClassificacao: function(){ | |
762 | - var onde = $i("i3geoCartoTipoClassificacao"), | |
763 | - combo = $i("i3geoCartoComboMedidasVariavel"), | |
764 | - temp = function(dados){ | |
765 | - var n = dados.length, | |
766 | - ins = '<p class="paragrafo" >'+$trad(9,i3GEOF.metaestat.dicionario)+'</p>', | |
767 | - i; | |
768 | - ins += "<select id='i3geoCartoComboTipoClassificacao' style='width:"+(i3GEOF.metaestat.LARGURA - 20)+"px' onchange='i3GEOF.metaestat.classes.comboTipoClassificacaoOnchange(this)'><option value=''>---</option>"; | |
769 | - for(i=0;i<n;i++){ | |
770 | - ins += "<option title='"+dados[i].observacao+"' value='"+dados[i].id_classificacao+"'>"+dados[i].nome+"</option>"; | |
771 | - } | |
772 | - ins += "</select>"; | |
773 | - //{"id_classificacao":"1","nome":"Pela media","id_medida_variavel":"1","observacao":""} | |
774 | - if(onde){ | |
775 | - onde.innerHTML = ins; | |
776 | - } | |
777 | - return ins; | |
778 | - }; | |
779 | - if(combo.value != ""){ | |
780 | - i3GEOF.metaestat.comum.aguarde(onde); | |
781 | - i3GEO.php.listaClassificacaoMedida(combo.value,temp); | |
782 | - } | |
783 | - else{ | |
784 | - onde.innerHTML = ""; | |
785 | - } | |
786 | - }, | |
787 | - comboTipoClassificacaoOnchange: function(){ | |
788 | - | |
789 | - }, | |
790 | - comboRegiao: function(id_medida_variavel){ | |
791 | - i3GEOF.metaestat.comum.aguarde($i("i3geoCartoRegioesMedidasVariavel")); | |
792 | - var onde = $i("i3geoCartoRegioesMedidasVariavel"), | |
793 | - combo = $i("i3geoCartoComboMedidasVariavel"), | |
794 | - temp = function(dados){ | |
795 | - var n = dados.length, | |
796 | - ins = '<p class="paragrafo" >'+$trad(13,i3GEOF.metaestat.dicionario)+'</p>', | |
797 | - i; | |
798 | - ins += "<select id='i3geoCartoComboRegioesMedidasVariavel' style='width:"+(i3GEOF.metaestat.LARGURA - 20)+"px' ><option value=''>---</option>"; | |
799 | - for(i=0;i<n;i++){ | |
800 | - ins += "<option title='"+dados[i].observacao+"' value='"+dados[i].codigo_tipo_regiao+"'>"+dados[i].nome_tipo_regiao+"</option>"; | |
801 | - } | |
802 | - ins += "</select>"; | |
803 | - if(onde){ | |
804 | - onde.innerHTML = ins; | |
805 | - } | |
806 | - return ins; | |
807 | - }; | |
808 | - if(combo.value != ""){ | |
809 | - i3GEOF.metaestat.comum.aguarde(onde); | |
810 | - i3GEO.php.listaRegioesMedidaVariavel(combo.value,temp); | |
811 | - } | |
812 | - } | |
813 | - }, | |
814 | - comum:{ | |
815 | - iniciaDicionario: function(){ | |
816 | - if(typeof(i3GEOF.metaestat.dicionario) === 'undefined'){ | |
817 | - i3GEO.util.scriptTag( | |
818 | - i3GEO.configura.locaplic+"/ferramentas/metaestat/dicionario.js", | |
819 | - "i3GEOF.metaestat.principal.inicia()", | |
820 | - "i3GEOF.metaestat.dicionario_script" | |
821 | - ); | |
822 | - } | |
823 | - else{ | |
824 | - i3GEOF.metaestat.principal.inicia(); | |
825 | - } | |
826 | - }, | |
827 | - desligaCamadas: function(){ | |
828 | - if(i3GEOF.metaestat.CAMADAS.length > 0){ | |
829 | - i3GEO.arvoreDeCamadas.ligaDesligaTemas(i3GEOF.metaestat.CAMADAS.join(","),false); | |
830 | - } | |
831 | - }, | |
832 | - //parametros para adicionar a camada | |
833 | - tipoRep: [], | |
834 | - tipoRegiao: [], | |
835 | - tipoClassificacao: [], | |
836 | - adicionaCamada: function(){ | |
837 | - //function mapfileMedidaVariavel($id_medida_variavel,$filtro="",$todasascolunas = 0,$tipolayer="polygon",$titulolayer="",$id_classificacao="",$agruparpor=""){ | |
838 | - var v = i3GEOF.metaestat.comum.verificaParametros(), | |
839 | - temp = function(retorno){ | |
840 | - var atualiza = function(){ | |
841 | - i3GEO.atualiza(); | |
842 | - i3GEOF.metaestat.CAMADAS.push(retorno.layer); | |
843 | - i3GEO.mapa.ativaTema(retorno.layer); | |
844 | - i3GEOF.metaestat.analise.comboCamadas(); | |
845 | - }, | |
846 | - c = i3GEO.arvoreDeCamadas.capturaCheckBox(retorno.layer); | |
847 | - if(i3GEO.arvoreDeCamadas.pegaTema(retorno.layer) == ""){ | |
848 | - i3GEOF.metaestat.comum.desligaCamadas(); | |
849 | - i3GEO.php.adtema(atualiza,retorno.mapfile); | |
850 | - } | |
851 | - else{ | |
852 | - if(c){ | |
853 | - i3GEOF.metaestat.comum.desligaCamadas(); | |
854 | - i3GEO.mapa.ativaTema(retorno.layer); | |
855 | - c.checked = true; | |
856 | - i3GEO.Interface.ligaDesliga(c); | |
857 | - } | |
858 | - } | |
859 | - }; | |
860 | - if(v != true){ | |
861 | - i3GEO.janela.tempoMsg("erro: "+v); | |
862 | - return; | |
863 | - } | |
864 | - //e necessario obter os parametros nessa interface | |
865 | - if(i3GEOF.metaestat.INTERFACE == "flutuanteSimples"){ | |
866 | - i3GEOF.metaestat.classes.aplicar(); | |
867 | - } | |
868 | - i3GEO.php.mapfileMedidaVariavel( | |
869 | - temp, | |
870 | - $i("i3geoCartoComboMedidasVariavel").value, | |
871 | - i3GEOF.metaestat.comum.defineFiltro(), | |
872 | - 0, | |
873 | - i3GEOF.metaestat.comum.tipoRep[0], | |
874 | - i3GEOF.metaestat.comum.defineTitulo(), | |
875 | - i3GEOF.metaestat.comum.tipoClassificacao[0], | |
876 | - i3GEOF.metaestat.comum.defineAgruparPor(), | |
877 | - i3GEOF.metaestat.comum.tipoRegiao[0] | |
878 | - ); | |
879 | - }, | |
880 | - ativaCamada: function(camada){ | |
881 | - if(i3GEOF.metaestat.CAMADAS.length > 0){ | |
882 | - i3GEO.arvoreDeCamadas.ligaDesligaTemas(i3GEOF.metaestat.CAMADAS.join(","),false); | |
883 | - i3GEO.arvoreDeCamadas.ligaDesligaTemas(camada,true); | |
884 | - i3GEO.mapa.ativaTema(camada); | |
885 | - } | |
886 | - }, | |
887 | - defineTitulo: function(){ | |
888 | - //se nao tiver parametros, filtro e vazio | |
889 | - if(i3GEOF.metaestat.parametros.dados.length == 0 || i3GEOF.metaestat.INTERFACE === "flutuanteSimples"){ | |
890 | - return ""; | |
891 | - } | |
892 | - //deixa vazio para que o titulo seja definido pelo PHP que monta o mapfile | |
893 | - if(i3GEOF.metaestat.comum.tipoRep[1] == ""){ | |
894 | - return ""; | |
895 | - } | |
896 | - var i,n,c,titulo="", | |
897 | - t=[], | |
898 | - dados = i3GEOF.metaestat.parametros.dados; | |
899 | - if($i("i3geoCartoComboVariavel") && $i("i3geoCartoComboVariavel").options){ | |
900 | - titulo = $i("i3geoCartoComboVariavel").options[$i("i3geoCartoComboVariavel").selectedIndex].label +" - "; | |
901 | - } | |
902 | - titulo += $i("i3geoCartoComboMedidasVariavel").options[$i("i3geoCartoComboMedidasVariavel").selectedIndex].label +" - "+ | |
903 | - i3GEOF.metaestat.comum.tipoRep[1] +" - "+ | |
904 | - i3GEOF.metaestat.comum.tipoClassificacao[1] + " - " + | |
905 | - i3GEOF.metaestat.comum.tipoRegiao[1]; | |
906 | - n = dados.length; | |
907 | - for(i=0;i<n;i++){ | |
908 | - c = $i("comboparametro_"+dados[i].id_parametro_medida+"_"+dados[i].id_pai); | |
909 | - if(c && c.value != ""){ | |
910 | - t.push(dados[i].nome+" = "+c.value); | |
911 | - } | |
912 | - } | |
913 | - if(t.length > 0){ | |
914 | - return titulo+" - "+t.join(", "); | |
915 | - } | |
916 | - else{ | |
917 | - return titulo; | |
918 | - } | |
919 | - }, | |
920 | - defineFiltro: function(){ | |
921 | - //se nao tiver parametros, filtro e vazio | |
922 | - if(i3GEOF.metaestat.parametros.dados.length == 0){ | |
923 | - return ""; | |
924 | - } | |
925 | - //se tiver parametro e todos estiverem vazios, aborta | |
926 | - var i,n,c, | |
927 | - t=[], | |
928 | - dados = i3GEOF.metaestat.parametros.dados; | |
929 | - n = dados.length; | |
930 | - for(i=0;i<n;i++){ | |
931 | - c = $i("comboparametro_"+dados[i].id_parametro_medida+"_"+dados[i].id_pai); | |
932 | - if(c && c.value != ""){ | |
933 | - t.push(dados[i].coluna+"="+c.value); | |
934 | - } | |
935 | - } | |
936 | - if(t.length > 0){ | |
937 | - return t.join(" and "); | |
938 | - } | |
939 | - else{ | |
940 | - return ""; | |
941 | - } | |
942 | - }, | |
943 | - defineAgruparPor: function(){ | |
944 | - //se nao tiver parametros, filtro e vazio | |
945 | - if(i3GEOF.metaestat.parametros.dados.length == 0){ | |
946 | - return ""; | |
947 | - } | |
948 | - //se tiver parametro e todos estiverem vazios, aborta | |
949 | - var i,n,c, | |
950 | - t=[], | |
951 | - dados = i3GEOF.metaestat.parametros.dados; | |
952 | - n = dados.length; | |
953 | - for(i=0;i<n;i++){ | |
954 | - c = $i("comboparametro_"+dados[i].id_parametro_medida+"_"+dados[i].id_pai); | |
955 | - if(c && c.value != ""){ | |
956 | - t.push(dados[i].coluna); | |
957 | - } | |
958 | - } | |
959 | - if(t.length > 0){ | |
960 | - return t.join(","); | |
961 | - } | |
962 | - else{ | |
963 | - return ""; | |
964 | - } | |
965 | - }, | |
966 | - verificaParametros: function(){ | |
967 | - var ok = true, | |
968 | - combos = ["i3geoCartoComboMedidasVariavel"], | |
969 | - n = combos.length, | |
970 | - i,temp; | |
971 | - for(i=0;i<n;i++){ | |
972 | - temp = $i(combos[i]); | |
973 | - if(!temp){ | |
974 | - return combos[i]; | |
975 | - } | |
976 | - if(temp.value == ""){ | |
977 | - return combos[i]; | |
978 | - } | |
979 | - } | |
980 | - return ok; | |
981 | - }, | |
982 | - aguarde: function(obj){ | |
983 | - if(!obj){ | |
984 | - return "<img style='display:block;z-index:2' src=\'"+i3GEO.configura.locaplic+"/imagens/aguarde.gif\' />"; | |
985 | - } | |
986 | - var i = $i(obj.id+"_imagem"); | |
987 | - if(!i){ | |
988 | - obj.innerHTML = "<img id='"+obj.id+"_imagem' style='display:block;z-index:2' src=\'"+i3GEO.configura.locaplic+"/imagens/aguarde.gif\' />"; | |
989 | - } | |
990 | - else{ | |
991 | - if(i.style.display == "block"){ | |
992 | - i.style.display = "none"; | |
993 | - } | |
994 | - else{ | |
995 | - i.style.display = "block"; | |
996 | - } | |
997 | - } | |
998 | - } | |
999 | - }, | |
1000 | - editor: { | |
1001 | - inicia: function(){ | |
1002 | - YAHOO.namespace("admin.container"); | |
1003 | - if(typeof(i3GEOF.metaestat.dicionario1) === 'undefined'){ | |
1004 | - i3GEO.util.scriptTag( | |
1005 | - i3GEO.configura.locaplic+"/ferramentas/metaestat/dicionario1.js", | |
1006 | - "i3GEOF.metaestat.editor.dependenciasjs0()", | |
1007 | - "i3GEOF.metaestat.dicionario1_script" | |
1008 | - ); | |
1009 | - } | |
1010 | - else{ | |
1011 | - i3GEOF.metaestat.editor.dependenciasjs0(); | |
1012 | - } | |
1013 | - }, | |
1014 | - //carrega os javascripts do sistema de administracao e que tbm sao usados aqui | |
1015 | - dependenciasjs0: function(){ | |
1016 | - i3GEO.util.scriptTag( | |
1017 | - i3GEO.configura.locaplic+"/admin/js/core.js", | |
1018 | - "i3GEOF.metaestat.editor.dependenciasjs1()", | |
1019 | - "i3GEOF.metaestat.dependenciasjs0_script" | |
1020 | - ); | |
1021 | - }, | |
1022 | - dependenciasjs1: function(){ | |
1023 | - i3GEO.util.scriptTag( | |
1024 | - i3GEO.configura.locaplic+"/admin/js/estat_variavel.js", | |
1025 | - "i3GEOF.metaestat.editor.ativa()", | |
1026 | - "i3GEOF.metaestat.dependenciasjs1_script" | |
1027 | - ); | |
1028 | - }, | |
1029 | - ativa: function(iddiv){ | |
1030 | - var loginok = function(){ | |
1031 | - i3GEOadmin.variaveis.inicia(); | |
1032 | - if(!iddiv){ | |
1033 | - iddiv = "i3geoCartoEditor_corpo"; | |
1034 | - } | |
1035 | - if(i3GEOF.metaestat.INTERFACE == "flutuante"){ | |
1036 | - i3GEOF.metaestat.editor.abreJanela(); | |
1037 | - } | |
1038 | - $i(iddiv).innerHTML = i3GEOF.metaestat.editor.html(); | |
1039 | - i3GEOF.metaestat.editor.t0(); | |
1040 | - }, | |
1041 | - loginNok = function(){ | |
1042 | - i3GEO.janela.tempoMsg("Você precisa fazer login para usar essa opção"); | |
1043 | - i3GEO.login.dialogo.abreLogin(); | |
1044 | - }; | |
1045 | - //verifica login | |
1046 | - i3GEO.login.verificaOperacao("admin/metaestat/geral",i3GEO.configura.locaplic, loginok, "sessao",loginNok); | |
1047 | - }, | |
1048 | - abreJanela: function(){ | |
1049 | - var cabecalho,minimiza,imagemxy,janela; | |
1050 | - if (!$i("i3geoCartoEditor")){ | |
1051 | - cabecalho = function(){}; | |
1052 | - minimiza = function(){ | |
1053 | - i3GEO.janela.minimiza("i3geoCartoEditor"); | |
1054 | - }; | |
1055 | - janela = i3GEO.janela.cria( | |
1056 | - "400px", | |
1057 | - "320px", | |
1058 | - "", | |
1059 | - "", | |
1060 | - "", | |
1061 | - $trad(1,i3GEOF.metaestat.dicionario1), | |
1062 | - "i3geoCartoEditor", | |
1063 | - false, | |
1064 | - "hd", | |
1065 | - cabecalho, | |
1066 | - minimiza | |
1067 | - ); | |
1068 | - janela = janela[0]; | |
1069 | - YAHOO.i3GEO.janela.manager.register(janela); | |
1070 | - janela.render(); | |
1071 | - } | |
1072 | - else{ | |
1073 | - janela = YAHOO.i3GEO.janela.manager.find("i3geoCartoEditor"); | |
1074 | - } | |
1075 | - janela.show(); | |
1076 | - imagemxy = i3GEO.util.pegaPosicaoObjeto($i(i3GEO.Interface.IDCORPO)); | |
1077 | - janela.moveTo(imagemxy[0]+i3GEOF.metaestat.LEFT+i3GEOF.metaestat.LARGURA+20,i3GEOF.metaestat.TOP+20); | |
1078 | - }, | |
1079 | - html: function(){ | |
1080 | - var ins = ''; | |
1081 | - ins += '<div style="background-color:#F2F2F2;top:0px;left:0px;display:block;width:98%;margin-left:5px;" id="i3GEOFmetaestatEditor" >'; | |
1082 | - ins += '</div>'; | |
1083 | - return ins; | |
1084 | - }, | |
1085 | - criaVariavel: function(){ | |
1086 | - i3GEOadmin.variaveis.aposGravar = function(){ | |
1087 | - core_carregando("desativa"); | |
1088 | - //refaz o conteudo para mostrar a nova adicao | |
1089 | - i3GEOF.metaestat.editor.removeEl("i3GEOF.metaestat.editor.t1"); | |
1090 | - // Enome e o id do input onde o usuario escolheu o nome da nova variavel | |
1091 | - i3GEOF.metaestat.editor.t1(true,$i("Enome").value); | |
1092 | - i3GEOF.metaestat.principal.inicia(); | |
1093 | - }; | |
1094 | - i3GEOadmin.variaveis.editar("variavel",""); | |
1095 | - }, | |
1096 | - editaVariavel: function(){ | |
1097 | - i3GEOadmin.variaveis.aposGravar = function(){ | |
1098 | - core_carregando("desativa"); | |
1099 | - //refaz o conteudo para mostrar a nova adicao | |
1100 | - i3GEOF.metaestat.editor.removeEl("i3GEOF.metaestat.editor.t1"); | |
1101 | - // Enome e o id do input onde o usuario escolheu o nome da nova variavel | |
1102 | - i3GEOF.metaestat.editor.t1(true,$i("Enome").value); | |
1103 | - i3GEOF.metaestat.principal.inicia(); | |
1104 | - }; | |
1105 | - var codigo_variavel = $i("i3geoCartoComboVariavelEditor").value; | |
1106 | - if(codigo_variavel !== ""){ | |
1107 | - i3GEOadmin.variaveis.editar("variavel",codigo_variavel); | |
1108 | - } | |
1109 | - }, | |
1110 | - criaMedidaVariavel: function(){ | |
1111 | - i3GEOadmin.variaveis.aposGravar = function(){ | |
1112 | - core_carregando("desativa"); | |
1113 | - //refaz o conteudo para mostrar a nova adicao | |
1114 | - i3GEOF.metaestat.editor.removeEl("i3GEOF.metaestat.editor.t2"); | |
1115 | - // Enome e o id do input onde o usuario escolheu o nome da nova variavel | |
1116 | - i3GEOF.metaestat.editor.t2(true,$i("Enomemedida").value); | |
1117 | - i3GEOF.metaestat.principal.inicia(); | |
1118 | - }; | |
1119 | - i3GEOadmin.variaveis.editar("medidaVariavel",""); | |
1120 | - //passa o codigo da variavel | |
1121 | - $i("Ecodigo_variavel").value = $i("i3geoCartoComboVariavelEditor").value; | |
1122 | - //define os valores que sao padrao | |
1123 | - //a conexao e com o default | |
1124 | - $i("Ecodigo_estat_conexao").value = i3GEOF.metaestat.CONEXAODEFAULT; | |
1125 | - //o esquema e o public | |
1126 | - $i("Eesquemadb").value = "i3geo_metaestat"; | |
1127 | - //a tabela onde ficarao os dados | |
1128 | - $i("Etabela").value = "indicadores_bairro"; | |
1129 | - //coluna com os valores | |
1130 | - $i("Ecolunavalor").value = "valor_num"; | |
1131 | - //id que liga com o geo | |
1132 | - $i("Ecolunaidgeo").value = "codigoregiao"; | |
1133 | - //id unico | |
1134 | - $i("Ecolunaidunico").value = "gid"; | |
1135 | - //unidade de medida | |
1136 | - $i("Ecodigo_unidade_medida").value = 1; | |
1137 | - //periodo | |
1138 | - $i("Ecodigo_tipo_periodo").value = 0; | |
1139 | - //impede a alteracao do filtro | |
1140 | - $i("Efiltro").disabled = "disabled"; | |
1141 | - //altera a tabela quando escolher | |
1142 | - $i("Ecodigo_tipo_regiao").onchange = function(){ | |
1143 | - alert("Escolha uma tabela compatível com essa região"); | |
1144 | - $i("Etabela").value = ""; | |
1145 | - }; | |
1146 | - }, | |
1147 | - editaMedidaVariavel: function(){ | |
1148 | - i3GEOadmin.variaveis.aposGravar = function(){ | |
1149 | - core_carregando("desativa"); | |
1150 | - //refaz o conteudo para mostrar a nova adicao | |
1151 | - i3GEOF.metaestat.editor.removeEl("i3GEOF.metaestat.editor.t2"); | |
1152 | - // Enome e o id do input onde o usuario escolheu o nome da nova variavel | |
1153 | - i3GEOF.metaestat.editor.t2(true,$i("Enomemedida").value); | |
1154 | - i3GEOF.metaestat.principal.inicia(); | |
1155 | - }; | |
1156 | - var id_medida_variavel = $i("i3geoCartoComboMedidaVariavelEditor").value; | |
1157 | - if(id_medida_variavel !== ""){ | |
1158 | - i3GEOadmin.variaveis.editar("medidaVariavel",id_medida_variavel); | |
1159 | - } | |
1160 | - }, | |
1161 | - criaClassificacao: function(){ | |
1162 | - i3GEOadmin.variaveis.aposGravar = function(){ | |
1163 | - core_carregando("desativa"); | |
1164 | - //refaz o conteudo para mostrar a nova adicao | |
1165 | - i3GEOF.metaestat.editor.removeEl("i3GEOF.metaestat.editor.t3"); | |
1166 | - // Enome e o id do input onde o usuario escolheu o nome da nova variavel | |
1167 | - i3GEOF.metaestat.editor.t3(true,$i("Enome").value); | |
1168 | - }; | |
1169 | - i3GEOadmin.variaveis.editar("classificacaoMedida",""); | |
1170 | - $i("Eid_medida_variavel").value = $i("i3geoCartoComboMedidaVariavelEditor").value; | |
1171 | - }, | |
1172 | - editaClassificacao: function(){ | |
1173 | - i3GEOadmin.variaveis.aposGravar = function(){ | |
1174 | - core_carregando("desativa"); | |
1175 | - //refaz o conteudo para mostrar a nova adicao | |
1176 | - i3GEOF.metaestat.editor.removeEl("i3GEOF.metaestat.editor.t3"); | |
1177 | - // Enome e o id do input onde o usuario escolheu o nome da nova variavel | |
1178 | - i3GEOF.metaestat.editor.t3(true,$i("Enome").value); | |
1179 | - }; | |
1180 | - var id_classificacao = $i("i3geoCartoComboClassificacoesEditor").value; | |
1181 | - if(id_classificacao !== ""){ | |
1182 | - i3GEOadmin.variaveis.editar("classificacaoMedida",id_classificacao); | |
1183 | - } | |
1184 | - }, | |
1185 | - removeEl:function(id){ | |
1186 | - var no = $i(id); | |
1187 | - if(no){ | |
1188 | - no.parentNode.removeChild(no); | |
1189 | - } | |
1190 | - }, | |
1191 | - selComboPorTexto: function(idcombo,texto){ | |
1192 | - var c = $i(idcombo),n,i; | |
1193 | - if(c){ | |
1194 | - n = c.options.length; | |
1195 | - for(i=0;i<n;i++){ | |
1196 | - if(c.options[i].label === texto){ | |
1197 | - c.options[i].selected = true; | |
1198 | - return; | |
1199 | - } | |
1200 | - } | |
1201 | - } | |
1202 | - }, | |
1203 | - /** | |
1204 | - * Obtem um parametro da medida variavel escolhida. Os parametros sao obtidos da chamada em ajax que pega a lista de medidas de uma variavel | |
1205 | - */ | |
1206 | - dadoMedidaSelecionada: function(parametro){ | |
1207 | - var c = $i("i3geoCartoComboMedidaVariavelEditor"),n,i; | |
1208 | - if(c){ | |
1209 | - n = c.options.length; | |
1210 | - for(i=0;i<n;i++){ | |
1211 | - if(c.options[i].selected === true){ | |
1212 | - if(i3GEOF.metaestat.DADOSMEDIDASVARIAVEL[i-1]){ | |
1213 | - return i3GEOF.metaestat.DADOSMEDIDASVARIAVEL[i-1][parametro]; | |
1214 | - } | |
1215 | - else{ | |
1216 | - return ""; | |
1217 | - } | |
1218 | - } | |
1219 | - } | |
1220 | - } | |
1221 | - else{ | |
1222 | - return ""; | |
1223 | - } | |
1224 | - }, | |
1225 | - comboVariaveisOnchange: function(){ | |
1226 | - i3GEOF.metaestat.editor.removeEl("i3GEOF.metaestat.editor.t2"); | |
1227 | - }, | |
1228 | - comboMedidaVariavelOnchange: function(combo){ | |
1229 | - i3GEOF.metaestat.editor.removeEl("i3GEOF.metaestat.editor.t3"); | |
1230 | - }, | |
1231 | - quartis: function(){ | |
1232 | - var id_medida_variavel = $i("i3geoCartoComboMedidaVariavelEditor").value, | |
1233 | - id_classificacao = $i("i3geoCartoComboClassificacoesEditor").value, | |
1234 | - cores = $i("listaColourRampEditor").value, | |
1235 | - p = i3GEO.configura.locaplic+"/admin/php/metaestat.php?funcao=calculaClassificacao&tipo=quartil&cores="+cores+"&id_classificacao="+id_classificacao+"&id_medida_variavel="+id_medida_variavel+"&g_sid="+i3GEO.configura.sid, | |
1236 | - temp = function(retorno){ | |
1237 | - core_carregando("desativa"); | |
1238 | - //fecha o editor | |
1239 | - if(retorno == "erro"){ | |
1240 | - alert("Não foi possível gerar as classes. Verifique se já existem dados para essa medida"); | |
1241 | - } | |
1242 | - else{ | |
1243 | - YAHOO.i3GEO.janela.manager.find("i3geoCartoEditor").destroy(); | |
1244 | - } | |
1245 | - }; | |
1246 | - if(cores == ""){ | |
1247 | - i3GEO.janela.tempoMsg("Escolha as cores primeiro. Depois acione a opção de classificação novamente"); | |
1248 | - $i("listaColourRampEditor").onchange = function(){i3GEOF.metaestat.editor.quartis();}; | |
1249 | - i3GEO.util.abreColourRamp("","listaColourRampEditor",5); | |
1250 | - return; | |
1251 | - } | |
1252 | - core_carregando("ativa"); | |
1253 | - i3GEO.util.ajaxGet(p,temp); | |
1254 | - }, | |
1255 | - intervalosIguaisMM: function(){ | |
1256 | - var id_medida_variavel = $i("i3geoCartoComboMedidaVariavelEditor").value, | |
1257 | - id_classificacao = $i("i3geoCartoComboClassificacoesEditor").value, | |
1258 | - cores = $i("listaColourRampEditor").value, | |
1259 | - p = i3GEO.configura.locaplic+"/admin/php/metaestat.php?funcao=calculaClassificacao&tipo=intiguais5mm" + | |
1260 | - "&cores="+cores+"&id_classificacao="+id_classificacao+"&id_medida_variavel="+id_medida_variavel+ | |
1261 | - "&min="+$i("i3GEOFmetaestatEditorVmin").value + | |
1262 | - "&max="+$i("i3GEOFmetaestatEditorVmax").value + | |
1263 | - "&g_sid="+i3GEO.configura.sid, | |
1264 | - temp = function(retorno){ | |
1265 | - core_carregando("desativa"); | |
1266 | - YAHOO.i3GEO.janela.manager.find("i3geoCartoEditor").destroy(); | |
1267 | - }; | |
1268 | - if(cores == ""){ | |
1269 | - alert("Escolha as cores primeiro"); | |
1270 | - $i("listaColourRampEditor").onchange = function(){i3GEOF.metaestat.editor.intervalosIguaisMM();}; | |
1271 | - i3GEO.util.abreColourRamp("","listaColourRampEditor",5); | |
1272 | - return; | |
1273 | - } | |
1274 | - core_carregando("ativa"); | |
1275 | - i3GEO.util.ajaxGet(p,temp); | |
1276 | - }, | |
1277 | - intervalosIguais: function(){ | |
1278 | - var id_medida_variavel = $i("i3geoCartoComboMedidaVariavelEditor").value, | |
1279 | - id_classificacao = $i("i3geoCartoComboClassificacoesEditor").value, | |
1280 | - cores = $i("listaColourRampEditor").value, | |
1281 | - p = i3GEO.configura.locaplic+"/admin/php/metaestat.php?funcao=calculaClassificacao&tipo=intiguais5&cores="+cores+"&id_classificacao="+id_classificacao+"&id_medida_variavel="+id_medida_variavel+"&g_sid="+i3GEO.configura.sid, | |
1282 | - temp = function(retorno){ | |
1283 | - core_carregando("desativa"); | |
1284 | - if(retorno == "erro"){ | |
1285 | - alert("Não foi possível gerar as classes. Verifique se já existem dados para essa medida"); | |
1286 | - } | |
1287 | - else{ | |
1288 | - YAHOO.i3GEO.janela.manager.find("i3geoCartoEditor").destroy(); | |
1289 | - } | |
1290 | - }; | |
1291 | - if(cores == ""){ | |
1292 | - alert("Escolha as cores primeiro"); | |
1293 | - $i("listaColourRampEditor").onchange = function(){i3GEOF.metaestat.editor.intervalosIguais();}; | |
1294 | - i3GEO.util.abreColourRamp("","listaColourRampEditor",5); | |
1295 | - return; | |
1296 | - } | |
1297 | - core_carregando("ativa"); | |
1298 | - i3GEO.util.ajaxGet(p,temp); | |
1299 | - }, | |
1300 | - /** | |
1301 | - * Abertura do ajudante | |
1302 | - * | |
1303 | - **/ | |
1304 | - t0: function(){ | |
1305 | - var ins = "<p class='paragrafo' >" + $trad(2,i3GEOF.metaestat.dicionario1) + | |
1306 | - "<br><br><p><input id=i3GEOFmetaestatEditorBotaot01 type='button' value='"+$trad(3,i3GEOF.metaestat.dicionario1)+"' />" + | |
1307 | - " <input id=i3GEOFmetaestatEditorBotaot02 type='button' value='"+$trad(4,i3GEOF.metaestat.dicionario1)+"' />" + | |
1308 | - " <input id=i3GEOFmetaestatEditorBotaot03 type='button' value='Upload CSV' />"; | |
1309 | - i3GEO.util.proximoAnterior("","i3GEOF.metaestat.editor.t1()",ins,"i3GEOF.metaestat.editor.t0","i3GEOFmetaestatEditor"); | |
1310 | - new YAHOO.widget.Button( | |
1311 | - "i3GEOFmetaestatEditorBotaot01", | |
1312 | - {onclick:{fn: function(){window.open(i3GEO.configura.locaplic+"/admin/html/estat_variavel.html");}}} | |
1313 | - ); | |
1314 | - new YAHOO.widget.Button( | |
1315 | - "i3GEOFmetaestatEditorBotaot02", | |
1316 | - {onclick:{fn: function(){ | |
1317 | - i3GEO.janela.tempoMsg($trad(15,i3GEOF.metaestat.dicionario1)); | |
1318 | - window.open(i3GEO.configura.locaplic+"/ferramentas/metaestat/editorlimites.php"); | |
1319 | - }}} | |
1320 | - ); | |
1321 | - new YAHOO.widget.Button( | |
1322 | - "i3GEOFmetaestatEditorBotaot03", | |
1323 | - {onclick:{fn: function(){ | |
1324 | - var cabecalho,minimiza,janela; | |
1325 | - if (!$i("i3geoCartoUpload")){ | |
1326 | - cabecalho = function(){ | |
1327 | - }; | |
1328 | - minimiza = function(){ | |
1329 | - i3GEO.janela.minimiza("i3geoCartoUpload"); | |
1330 | - }; | |
1331 | - janela = i3GEO.janela.cria( | |
1332 | - "500px", | |
1333 | - "450px", | |
1334 | - i3GEO.configura.locaplic+"/ferramentas/metaestat/upload.html", | |
1335 | - "", | |
1336 | - "", | |
1337 | - "Upload", | |
1338 | - "i3geoCartoUpload", | |
1339 | - false, | |
1340 | - "hd", | |
1341 | - cabecalho, | |
1342 | - minimiza | |
1343 | - ); | |
1344 | - janela = janela[0]; | |
1345 | - YAHOO.i3GEO.janela.manager.register(janela); | |
1346 | - janela.render(); | |
1347 | - } | |
1348 | - else{ | |
1349 | - janela = YAHOO.i3GEO.janela.manager.find("i3geoCartoUpload"); | |
1350 | - } | |
1351 | - janela.show(); | |
1352 | - }}} | |
1353 | - ); | |
1354 | - }, | |
1355 | - /** | |
1356 | - * Edicao da variavel | |
1357 | - */ | |
1358 | - t1: function(remove,textoSelecionado){ | |
1359 | - if(remove == true){ | |
1360 | - //remove o conteudo anteriormente construido | |
1361 | - i3GEOF.metaestat.editor.removeEl("i3GEOF.metaestat.editor.t1"); | |
1362 | - } | |
1363 | - var temp = function(dados){ | |
1364 | - var ins = "<p class='paragrafo' >" + $trad(1,i3GEOF.metaestat.dicionario) + "<br><br>" + | |
1365 | - "<span>" + i3GEOF.metaestat.principal.comboVariaveis(dados,"i3geoCartoComboVariavelEditor","i3GEOF.metaestat.editor.comboVariaveisOnchange(this)","","nao") + "</span>" + | |
1366 | - "<br><br><p><input id=i3GEOFmetaestatEditorBotao3 type='button' value='"+$trad(8,i3GEOF.metaestat.dicionario1)+"' />" + | |
1367 | - " <input id=i3GEOFmetaestatEditorBotao3a type='button' value='"+$trad(5,i3GEOF.metaestat.dicionario1)+"' /><br>"; | |
1368 | - i3GEO.util.proximoAnterior("i3GEOF.metaestat.editor.t0()","i3GEOF.metaestat.editor.t2()",ins,"i3GEOF.metaestat.editor.t1","i3GEOFmetaestatEditor",true); | |
1369 | - new YAHOO.widget.Button( | |
1370 | - "i3GEOFmetaestatEditorBotao3", | |
1371 | - {onclick:{fn: i3GEOF.metaestat.editor.editaVariavel}} | |
1372 | - ); | |
1373 | - $i("i3GEOFmetaestatEditorBotao3-button").style.width = (i3GEOF.metaestat.LARGURA / 2) + "px"; | |
1374 | - new YAHOO.widget.Button( | |
1375 | - "i3GEOFmetaestatEditorBotao3a", | |
1376 | - {onclick:{fn: i3GEOF.metaestat.editor.criaVariavel}} | |
1377 | - ); | |
1378 | - $i("i3GEOFmetaestatEditorBotao3a-button").style.width = (i3GEOF.metaestat.LARGURA / 2) + "px"; | |
1379 | - if(textoSelecionado){ | |
1380 | - i3GEOF.metaestat.editor.selComboPorTexto("i3geoCartoComboVariavelEditor",textoSelecionado); | |
1381 | - } | |
1382 | - }; | |
1383 | - i3GEO.php.listaVariavel(temp); | |
1384 | - }, | |
1385 | - /** | |
1386 | - * Edicao da medida da variavel | |
1387 | - * | |
1388 | - */ | |
1389 | - t2: function(remove,textoSelecionado){ | |
1390 | - if(remove == true){ | |
1391 | - //remove o conteudo anteriormente construido | |
1392 | - i3GEOF.metaestat.editor.removeEl("i3GEOF.metaestat.editor.t2"); | |
1393 | - } | |
1394 | - if($i("i3geoCartoComboVariavelEditor").value === ""){ | |
1395 | - i3GEO.janela.tempoMsg($trad(4,i3GEOF.metaestat.dicionario)); | |
1396 | - i3GEOF.metaestat.editor.t1(false); | |
1397 | - } | |
1398 | - else{ | |
1399 | - var temp = function(dados){ | |
1400 | - //guarda os dados | |
1401 | - var ins = "<p class='paragrafo' >" + $trad(2,i3GEOF.metaestat.dicionario) + "<br><br>" + | |
1402 | - "<span>" + i3GEOF.metaestat.principal.comboMedidasVariavel(dados,"i3geoCartoComboMedidaVariavelEditor","i3GEOF.metaestat.editor.comboMedidaVariavelOnchange(this)","","nao") + "</span>" + | |
1403 | - "<br><br><p><input id=i3GEOFmetaestatEditorBotao4 type='button' value='"+$trad(8,i3GEOF.metaestat.dicionario1)+"' />" + | |
1404 | - " <input id=i3GEOFmetaestatEditorBotao4a type='button' value='"+$trad(5,i3GEOF.metaestat.dicionario1)+"' /><br>"; | |
1405 | - i3GEO.util.proximoAnterior("i3GEOF.metaestat.editor.t1()","i3GEOF.metaestat.editor.t3()",ins,"i3GEOF.metaestat.editor.t2","i3GEOFmetaestatEditor",true); | |
1406 | - new YAHOO.widget.Button( | |
1407 | - "i3GEOFmetaestatEditorBotao4", | |
1408 | - {onclick:{fn: i3GEOF.metaestat.editor.editaMedidaVariavel}} | |
1409 | - ); | |
1410 | - $i("i3GEOFmetaestatEditorBotao4-button").style.width = (i3GEOF.metaestat.LARGURA / 2) + "px"; | |
1411 | - new YAHOO.widget.Button( | |
1412 | - "i3GEOFmetaestatEditorBotao4a", | |
1413 | - {onclick:{fn: i3GEOF.metaestat.editor.criaMedidaVariavel}} | |
1414 | - ); | |
1415 | - $i("i3GEOFmetaestatEditorBotao4a-button").style.width = (i3GEOF.metaestat.LARGURA / 2) + "px"; | |
1416 | - if(textoSelecionado){ | |
1417 | - i3GEOF.metaestat.editor.selComboPorTexto("i3geoCartoComboMedidaVariavelEditor",textoSelecionado); | |
1418 | - } | |
1419 | - }, | |
1420 | - codigo_variavel = $i("i3geoCartoComboVariavelEditor").value; | |
1421 | - if(codigo_variavel == ""){ | |
1422 | - i3GEO.janela.tempoMsg($trad(4,i3GEOF.metaestat.dicionario)); | |
1423 | - i3GEOF.metaestat.editor.t1(false); | |
1424 | - return; | |
1425 | - } | |
1426 | - i3GEO.php.listaMedidaVariavel(codigo_variavel,temp); | |
1427 | - } | |
1428 | - }, | |
1429 | - /** | |
1430 | - * Edicao da classificacao | |
1431 | - */ | |
1432 | - t3: function(remove,textoSelecionado){ | |
1433 | - if(remove == true){ | |
1434 | - //remove o conteudo anteriormente construido | |
1435 | - i3GEOF.metaestat.editor.removeEl("i3GEOF.metaestat.editor.t3"); | |
1436 | - } | |
1437 | - if($i("i3geoCartoComboMedidaVariavelEditor").value === ""){ | |
1438 | - i3GEO.janela.tempoMsg($trad(2,i3GEOF.metaestat.dicionario)); | |
1439 | - i3GEOF.metaestat.editor.t2(false); | |
1440 | - } | |
1441 | - else{ | |
1442 | - var temp = function(dados){ | |
1443 | - var ins = "<p class='paragrafo' >" + $trad(7,i3GEOF.metaestat.dicionario1) + "<br><br>" + | |
1444 | - "<span>" + i3GEOF.metaestat.principal.comboClassificacoesMedidaVariavel(dados,"i3geoCartoComboClassificacoesEditor","") + "</span>" + | |
1445 | - "<br><br>"+$trad(14,i3GEOF.metaestat.dicionario1)+": " + i3GEOF.metaestat.editor.dadoMedidaSelecionada("unidade_medida") + | |
1446 | - "<br><br><p><input id=i3GEOFmetaestatEditorBotao5 type='button' value='"+$trad(8,i3GEOF.metaestat.dicionario1)+"' />" + | |
1447 | - " <input id=i3GEOFmetaestatEditorBotao5a type='button' value='"+$trad(5,i3GEOF.metaestat.dicionario1)+"' /><br>"; | |
1448 | - i3GEO.util.proximoAnterior("i3GEOF.metaestat.editor.t2()","i3GEOF.metaestat.editor.t4()",ins,"i3GEOF.metaestat.editor.t3","i3GEOFmetaestatEditor",true); | |
1449 | - | |
1450 | - new YAHOO.widget.Button( | |
1451 | - "i3GEOFmetaestatEditorBotao5", | |
1452 | - {onclick:{fn: i3GEOF.metaestat.editor.editaClassificacao}} | |
1453 | - ); | |
1454 | - $i("i3GEOFmetaestatEditorBotao5-button").style.width = (i3GEOF.metaestat.LARGURA / 2) + "px"; | |
1455 | - new YAHOO.widget.Button( | |
1456 | - "i3GEOFmetaestatEditorBotao5a", | |
1457 | - {onclick:{fn: i3GEOF.metaestat.editor.criaClassificacao}} | |
1458 | - ); | |
1459 | - $i("i3GEOFmetaestatEditorBotao5a-button").style.width = (i3GEOF.metaestat.LARGURA / 2) + "px"; | |
1460 | - if(textoSelecionado){ | |
1461 | - i3GEOF.metaestat.editor.selComboPorTexto("i3geoCartoComboClassificacoesEditor",textoSelecionado); | |
1462 | - } | |
1463 | - | |
1464 | - }; | |
1465 | - i3GEO.php.listaClassificacaoMedida($i("i3geoCartoComboMedidaVariavelEditor").value,temp); | |
1466 | - } | |
1467 | - }, | |
1468 | - /** | |
1469 | - * Edicao das classes | |
1470 | - */ | |
1471 | - t4: function(){ | |
1472 | - //remove o conteudo anteriormente construido | |
1473 | - i3GEOF.metaestat.editor.removeEl("i3GEOF.metaestat.editor.t4"); | |
1474 | - if($i("i3geoCartoComboMedidaVariavelEditor").value === ""){ | |
1475 | - i3GEO.janela.tempoMsg($trad(9,i3GEOF.metaestat.dicionario)); | |
1476 | - i3GEOF.metaestat.editor.t3(false); | |
1477 | - } | |
1478 | - else{ | |
1479 | - //formulario semelhante existe em i3geo/admin/js/estat_variavel.js (classesAuto) | |
1480 | - var temp = function(dados){ | |
1481 | - var soma = i3GEOF.metaestat.editor.dadoMedidaSelecionada("permitesoma"), | |
1482 | - media = i3GEOF.metaestat.editor.dadoMedidaSelecionada("permitemedia"), | |
1483 | - ins = "<p class='paragrafo' >" + $trad(16,i3GEOF.metaestat.dicionario1) + "</p>"+ | |
1484 | - " <input id=i3GEOFmetaestatEditorBotao8 type='button' value='"+$trad(13,i3GEOF.metaestat.dicionario1)+"' />" + | |
1485 | - "<br><p class='paragrafo' >" + $trad(10,i3GEOF.metaestat.dicionario1) + "</p>"; | |
1486 | - if(soma == 1 || media == 1){ | |
1487 | - ins += " <input id=i3GEOFmetaestatEditorBotao6 type='button' value='"+$trad(11,i3GEOF.metaestat.dicionario1)+"' />" + | |
1488 | - " <input id=i3GEOFmetaestatEditorBotao7 type='button' value='"+$trad(12,i3GEOF.metaestat.dicionario1)+"' />"; | |
1489 | - } | |
1490 | - ins += '<input type=hidden value="" id="listaColourRampEditor" />' + //utilizado pelo seletor de colourramp; | |
1491 | - "<br><p class='paragrafo' >" + $trad(17,i3GEOF.metaestat.dicionario1) + "</p>" + | |
1492 | - "<p class='paragrafo' >" + $trad(18,i3GEOF.metaestat.dicionario1) + | |
1493 | - " <input type=text class=digitar size=5 value=0 id=i3GEOFmetaestatEditorVmin /> " + | |
1494 | - $trad(19,i3GEOF.metaestat.dicionario1) + | |
1495 | - " <input type=text class=digitar size=5 value=100 id=i3GEOFmetaestatEditorVmax /></p>" + | |
1496 | - "<input id='i3GEOFmetaestatEditorBotao9' type='button' value='"+$trad(12,i3GEOF.metaestat.dicionario1)+"' />"; | |
1497 | - | |
1498 | - i3GEO.util.proximoAnterior("i3GEOF.metaestat.editor.t3()","",ins,"i3GEOF.metaestat.editor.t4","i3GEOFmetaestatEditor",true); | |
1499 | - new YAHOO.widget.Button( | |
1500 | - "i3GEOFmetaestatEditorBotao8", | |
1501 | - {onclick:{fn: function(){ | |
1502 | - i3GEO.util.abreColourRamp("","listaColourRampEditor",5); | |
1503 | - }}} | |
1504 | - ); | |
1505 | - $i("i3GEOFmetaestatEditorBotao8-button").style.width = (i3GEOF.metaestat.LARGURA / 2) + "px"; | |
1506 | - if($i("i3GEOFmetaestatEditorBotao6")){ | |
1507 | - new YAHOO.widget.Button( | |
1508 | - "i3GEOFmetaestatEditorBotao6", | |
1509 | - {onclick:{fn: i3GEOF.metaestat.editor.quartis}} | |
1510 | - ); | |
1511 | - $i("i3GEOFmetaestatEditorBotao6-button").style.width = (i3GEOF.metaestat.LARGURA / 2) + "px"; | |
1512 | - | |
1513 | - new YAHOO.widget.Button( | |
1514 | - "i3GEOFmetaestatEditorBotao7", | |
1515 | - {onclick:{fn: i3GEOF.metaestat.editor.intervalosIguais}} | |
1516 | - ); | |
1517 | - $i("i3GEOFmetaestatEditorBotao7-button").style.width = (i3GEOF.metaestat.LARGURA / 2) + "px"; | |
1518 | - | |
1519 | - new YAHOO.widget.Button( | |
1520 | - "i3GEOFmetaestatEditorBotao9", | |
1521 | - {onclick:{fn: i3GEOF.metaestat.editor.intervalosIguaisMM}} | |
1522 | - ); | |
1523 | - $i("i3GEOFmetaestatEditorBotao9-button").style.width = (i3GEOF.metaestat.LARGURA / 2) + "px"; | |
1524 | - } | |
1525 | - }; | |
1526 | - i3GEO.php.listaClasseClassificacao($i("i3geoCartoComboClassificacoesEditor").value,temp); | |
1527 | - } | |
1528 | - } | |
1529 | - }, | |
1530 | - parametros: { | |
1531 | - //guarda a lista de parametros | |
1532 | - dados: [], | |
1533 | - //obtem a lista com os parametros da medida | |
1534 | - //cria os combos para os parametros que sao pai de todos | |
1535 | - lista: function(id_medida_variavel){ | |
1536 | - i3GEOF.metaestat.comum.aguarde($i("i3geoCartoParametrosMedidasVariavel")); | |
1537 | - var temp = function(dados){ | |
1538 | - i3GEOF.metaestat.parametros.dados = dados; | |
1539 | - i3GEOF.metaestat.parametros.combos("0"); | |
1540 | - i3GEOF.metaestat.comum.aguarde($i("i3geoCartoParametrosMedidasVariavel")); | |
1541 | - }; | |
1542 | - i3GEO.php.listaParametrosMedidaVariavel(id_medida_variavel,temp); | |
1543 | - }, | |
1544 | - //cria um combo para escolher os valores de um parametro | |
1545 | - combos: function(nivel){ | |
1546 | - var dados = i3GEOF.metaestat.parametros.dados, | |
1547 | - n = dados.length, | |
1548 | - onde = $i("i3geoCartoParametrosMedidasVariavel"), | |
1549 | - idpar,idcombo,i,novoel,teste; | |
1550 | - //cria o combo para o parametro cujo id_pai for do nivel escolhido | |
1551 | - for(i=0;i<n;i++){ | |
1552 | - if(dados[i].id_pai == nivel){ | |
1553 | - idpar = "parametro_"+dados[i].id_parametro_medida; | |
1554 | - idcombo = "parametro_"+dados[i].id_parametro_medida+"_"+nivel; | |
1555 | - teste = i3GEOF.metaestat.parametros.retornaIdPai(dados[i].id_parametro_medida); | |
1556 | - if(teste != false){ | |
1557 | - idpar = "parametro_"+teste; | |
1558 | - } | |
1559 | - if(!$i(idpar)){ | |
1560 | - novoel = document.createElement("div"); | |
1561 | - novoel.id = idpar; | |
1562 | - novoel.className = "paragrafo"; | |
1563 | - onde.appendChild(novoel); | |
1564 | - onde = novoel; | |
1565 | - } | |
1566 | - onde = $i(idpar); | |
1567 | - if(!$i(idcombo)){ | |
1568 | - i3GEOF.metaestat.comum.aguarde(onde); | |
1569 | - novoel = document.createElement("div"); | |
1570 | - novoel.id = idcombo; | |
1571 | - novoel.className = "paragrafo"; | |
1572 | - onde.appendChild(novoel); | |
1573 | - i3GEOF.metaestat.parametros.valoresCombo(dados[i].id_parametro_medida,dados[i].nome,nivel,onde,idcombo); | |
1574 | - } | |
1575 | - } | |
1576 | - } | |
1577 | - }, | |
1578 | - valoresCombo: function(id_parametro_medida,titulo,nivel,onde,idcombo){ | |
1579 | - var temp = function(dados){ | |
1580 | - var n = dados.length, | |
1581 | - ins = "", | |
1582 | - oc = "'i3GEOF.metaestat.parametros.antesCombo();i3GEOF.metaestat.parametros.combos(\""+id_parametro_medida+"\")'", | |
1583 | - filho = i3GEOF.metaestat.parametros.retornaIdFilho(id_parametro_medida), | |
1584 | - i,novoel; | |
1585 | - if(filho == false){ | |
1586 | - oc = ""; | |
1587 | - } | |
1588 | - ins = "<p class=paragrafo >"+titulo+"</p>"; | |
1589 | - ins += "<select id='combo"+idcombo+"' style='background:beige;width:"+(i3GEOF.metaestat.LARGURA - 20)+"px' onchange="+oc+" ><option value=''>---</option>"; | |
1590 | - for(i=0;i<n;i++){ | |
1591 | - ins += "<option value='"+dados[i]+"'>"+dados[i]+"</option>"; | |
1592 | - } | |
1593 | - ins += "</select>"; | |
1594 | - novoel = document.createElement("div"); | |
1595 | - novoel.className = "paragrafo"; | |
1596 | - novoel.innerHTML = ins; | |
1597 | - i3GEOF.metaestat.comum.aguarde(onde); | |
1598 | - onde.appendChild(novoel); | |
1599 | - }; | |
1600 | - i3GEO.php.listaValoresParametroMedidaVariavel(id_parametro_medida,temp); | |
1601 | - }, | |
1602 | - antesCombo: function(){ | |
1603 | - if(!$i("i3geoCartoClasses_corpo")){ | |
1604 | - i3GEOF.metaestat.classes.inicia(); | |
1605 | - } | |
1606 | - }, | |
1607 | - //retorna o id do parametro que e filho de um outro parametro | |
1608 | - retornaIdFilho:function(pai){ | |
1609 | - var dados = i3GEOF.metaestat.parametros.dados, | |
1610 | - n = dados.length, | |
1611 | - i; | |
1612 | - for(i=0;i<n;i++){ | |
1613 | - if(dados[i].id_pai == pai){ | |
1614 | - return dados[i].id_parametro_medida; | |
1615 | - } | |
1616 | - } | |
1617 | - return false; | |
1618 | - }, | |
1619 | - //retorna o id do parametro que e pai de um outro parametro | |
1620 | - retornaIdPai:function(filho){ | |
1621 | - var dados = i3GEOF.metaestat.parametros.dados, | |
1622 | - n = dados.length, | |
1623 | - i; | |
1624 | - for(i=0;i<n;i++){ | |
1625 | - if(dados[i].id_parametro_medida == filho){ | |
1626 | - return dados[i].id_pai; | |
1627 | - } | |
1628 | - } | |
1629 | - return false; | |
1630 | - } | |
1631 | - }, | |
1632 | - principal: { | |
1633 | - inicia: function(iddiv){ | |
1634 | - if(!iddiv || !$i(iddiv)){ | |
1635 | - iddiv = "i3geoCartoParametros_corpo"; | |
1636 | - } | |
1637 | - //interface default | |
1638 | - if(i3GEOF.metaestat.INTERFACE == "flutuante"){ | |
1639 | - i3GEOF.metaestat.principal.abreJanela(); | |
1640 | - $i(iddiv).innerHTML = i3GEOF.metaestat.principal.html(); | |
1641 | - i3GEOF.metaestat.principal.opcoesVariaveis(); | |
1642 | - } | |
1643 | - //interface qd a medida da variavel ja tiver sido definida. Utilizada ao adicionar uma camada via catalogo de temas | |
1644 | - if(i3GEOF.metaestat.INTERFACE == "flutuanteSimples"){ | |
1645 | - i3GEOF.metaestat.principal.abreJanela(); | |
1646 | - $i(iddiv).innerHTML = i3GEOF.metaestat.principal.html(); | |
1647 | - //i3GEOF.metaestat.principal.opcoesVariaveis(); | |
1648 | - $i("i3geoCartoVariaveis").innerHTML = "Aguarde..."; | |
1649 | - $i("i3geoCartoVariaveis").innerHTML = '' + | |
1650 | - "<input type=hidden value='"+i3GEOF.metaestat.ID_MEDIDA_VARIAVEL+"' id='i3geoCartoComboMedidasVariavel' />" + | |
1651 | - "<input type=hidden value='0' id='i3geoCartoComboVariavel' />" + | |
1652 | - "<input type=hidden value='0' id='i3geoCartoComboTipoRep' />" + | |
1653 | - "<div id='i3geoCartoRegioesMedidasVariavel'></div>" + | |
1654 | - "<br><div id='i3geoCartoTipoClassificacao'></div>" + | |
1655 | - "<br><div id='i3geoCartoParametrosMedidasVariavel'></div>" + | |
1656 | - "<p class=paragrafo >"+$trad(17,i3GEOF.metaestat.dicionario) + "</p>"; | |
1657 | - | |
1658 | - i3GEOF.metaestat.principal.botaoAdicionaCamada(); | |
1659 | - i3GEOF.metaestat.classes.comboRegiao(i3GEOF.metaestat.ID_MEDIDA_VARIAVEL); | |
1660 | - i3GEOF.metaestat.classes.comboTipoClassificacao(); | |
1661 | - i3GEOF.metaestat.parametros.lista(i3GEOF.metaestat.ID_MEDIDA_VARIAVEL); | |
1662 | - } | |
1663 | - }, | |
1664 | - atualiza:function(){ | |
1665 | - $i("i3geoCartoVariaveis").innerHTML = ""; | |
1666 | - $i("i3geoCartoMedidasVariavel").innerHTML = ""; | |
1667 | - $i("i3geoCartoParametrosMedidasVariavel").innerHTML = ""; | |
1668 | - YAHOO.i3GEO.janela.manager.find("i3geoCartoParametros").setFooter(""); | |
1669 | - i3GEOF.metaestat.principal.opcoesVariaveis(); | |
1670 | - }, | |
1671 | - abreJanela: function(){ | |
1672 | - var cabecalho,minimiza,imagemxy,janela,modal = false; | |
1673 | - if (!$i("i3geoCartoParametros")){ | |
1674 | - cabecalho = function(){ | |
1675 | - }; | |
1676 | - minimiza = function(){ | |
1677 | - i3GEO.janela.minimiza("i3geoCartoParametros"); | |
1678 | - }; | |
1679 | - if(i3GEOF.metaestat.INTERFACE == "flutuanteSimples"){ | |
1680 | - modal = true; | |
1681 | - } | |
1682 | - janela = i3GEO.janela.cria( | |
1683 | - i3GEOF.metaestat.LARGURA+10+"px", | |
1684 | - i3GEOF.metaestat.ALTURA+"px", | |
1685 | - "", | |
1686 | - "", | |
1687 | - "", | |
1688 | - $trad("x57"), | |
1689 | - "i3geoCartoParametros", | |
1690 | - modal, | |
1691 | - "hd", | |
1692 | - cabecalho, | |
1693 | - minimiza | |
1694 | - ); | |
1695 | - janela = janela[0]; | |
1696 | - if(!YAHOO.i3GEO.janela.manager.find("i3geoCartoParametros")){ | |
1697 | - YAHOO.i3GEO.janela.manager.register(janela); | |
1698 | - } | |
1699 | - janela.render(); | |
1700 | - } | |
1701 | - else{ | |
1702 | - janela = YAHOO.i3GEO.janela.manager.find("i3geoCartoParametros"); | |
1703 | - } | |
1704 | - janela.show(); | |
1705 | - imagemxy = i3GEO.util.pegaPosicaoObjeto($i(i3GEO.Interface.IDCORPO)); | |
1706 | - janela.moveTo(imagemxy[0]+i3GEOF.metaestat.LEFT,i3GEOF.metaestat.TOP); | |
1707 | - return janela; | |
1708 | - }, | |
1709 | - html: function(){ | |
1710 | - var ins = '<div id="i3geoCartoVariaveisContainer" style="margin-left:5px;">' + | |
1711 | - '<div class="paragrafo" id="i3geoCartoVariaveis" >' + | |
1712 | - '</div>' + | |
1713 | - '<div class="paragrafo" id="i3geoCartoMedidasVariavel" >' + | |
1714 | - '</div>' + | |
1715 | - '<div class="paragrafo" id="i3geoCartoParametrosMedidasVariavel" >' + | |
1716 | - '</div>' + | |
1717 | - '</div>'; | |
1718 | - return ins; | |
1719 | - }, | |
1720 | - maisInfo: function(){ | |
1721 | - var temp = "", | |
1722 | - v = $i("i3geoCartoComboVariavel"); | |
1723 | - if(!v || v.value === ""){ | |
1724 | - i3GEO.janela.tempoMsg($trad(4,i3GEOF.metaestat.dicionario)); | |
1725 | - } | |
1726 | - else{ | |
1727 | - var cabecalho,minimiza,janela; | |
1728 | - if (!$i("i3geoCartoMaisInfo")){ | |
1729 | - cabecalho = function(){ | |
1730 | - }; | |
1731 | - minimiza = function(){ | |
1732 | - i3GEO.janela.minimiza("i3geoCartoMaisInfo"); | |
1733 | - }; | |
1734 | - janela = i3GEO.janela.cria( | |
1735 | - "400px", | |
1736 | - "300px", | |
1737 | - "", | |
1738 | - "", | |
1739 | - "", | |
1740 | - $trad(5,i3GEOF.metaestat.dicionario), | |
1741 | - "i3geoCartoMaisInfo", | |
1742 | - false, | |
1743 | - "hd", | |
1744 | - cabecalho, | |
1745 | - minimiza | |
1746 | - ); | |
1747 | - janela = janela[0]; | |
1748 | - YAHOO.i3GEO.janela.manager.register(janela); | |
1749 | - janela.render(); | |
1750 | - //YAHOO.util.Event.addListener(janela.close, "click", i3GEOF.metaestat.fechaJanelaParametros); | |
1751 | - } | |
1752 | - else{ | |
1753 | - janela = YAHOO.i3GEO.janela.manager.find("i3geoCartoMaisInfo"); | |
1754 | - } | |
1755 | - janela.setBody(i3GEOF.metaestat.comum.aguarde()); | |
1756 | - temp = function(retorno){ | |
1757 | - janela.setBody(retorno); | |
1758 | - janela.show(); | |
1759 | - //imagemxy = i3GEO.util.pegaPosicaoObjeto($i(i3GEO.Interface.IDCORPO)); | |
1760 | - //janela.moveTo(imagemxy[0]+i3GEOF.metaestat.LEFT,imagemxy[1]+i3GEOF.metaestat.TOP); | |
1761 | - }; | |
1762 | - i3GEO.php.relatorioVariavel(v.value,temp); | |
1763 | - } | |
1764 | - }, | |
1765 | - comboVariaveis: function(dados,idcombo,stronchange,largura,mostraIconeinfo){ | |
1766 | - var ins,i,n = dados.length; | |
1767 | - if(!largura || largura === ""){ | |
1768 | - largura = i3GEOF.metaestat.LARGURA - 40; | |
1769 | - } | |
1770 | - if(!mostraIconeinfo || mostraIconeinfo === ""){ | |
1771 | - mostraIconeinfo = "sim"; | |
1772 | - } | |
1773 | - ins = "<select id='"+idcombo+"' style='box-shadow:0 1px 5px gray;width:"+largura+"px' onchange='"+stronchange+"'><option value=''>---</option>"; | |
1774 | - for(i=0;i<n;i++){ | |
1775 | - ins += "<option title='"+dados[i].descricao+"' value='"+dados[i].codigo_variavel+"'>"+dados[i].nome+"</option>"; | |
1776 | - } | |
1777 | - ins += "</select>"; | |
1778 | - if(mostraIconeinfo == "sim"){ | |
1779 | - ins += "<img src='"+i3GEO.configura.locaplic+"/imagens/ic_identifica.png' style='position:relative;cursor:pointer;left:5px;top:4px;' onclick='i3GEOF.metaestat.principal.maisInfo()' title='"+$trad(3,i3GEOF.metaestat.dicionario)+"'/>"; | |
1780 | - } | |
1781 | - return ins; | |
1782 | - }, | |
1783 | - botaoInfo: function(){ | |
1784 | - new YAHOO.widget.Button( | |
1785 | - "i3GEOcartoBotaoInfo", | |
1786 | - {onclick:{fn: i3GEOF.metaestat.principal.maisInfo}} | |
1787 | - ); | |
1788 | - $i("i3GEOcartoBotaoInfo-button").style.width = (i3GEOF.metaestat.LARGURA / 2) - 15 + "px"; | |
1789 | - }, | |
1790 | - botaoJanelaEditor: function(){ | |
1791 | - new YAHOO.widget.Button( | |
1792 | - "i3GEOcartoBotaoEditor", | |
1793 | - {onclick:{fn: i3GEOF.metaestat.editor.inicia}} | |
1794 | - ); | |
1795 | - $i("i3GEOcartoBotaoEditor-button").style.width = (i3GEOF.metaestat.LARGURA / 2) - 15 + "px"; | |
1796 | - }, | |
1797 | - botaoAdicionaCamada: function(largura){ | |
1798 | - if(!largura){ | |
1799 | - largura = i3GEOF.metaestat.LARGURA - 15; | |
1800 | - } | |
1801 | - var b = $i("i3GEOcartoBotaoAdicionaCamada"); | |
1802 | - if(!b){ | |
1803 | - YAHOO.i3GEO.janela.manager.find("i3geoCartoParametros").setFooter('<input type="button" id="i3GEOcartoBotaoAdicionaCamada" value="'+$trad(7,i3GEOF.metaestat.dicionario)+'" class="paragrafo" style="width:200px;cursor:pointer;color:blue" />'); | |
1804 | - } | |
1805 | - if(!$i("i3GEOcartoBotaoAdicionaCamada-button")){ | |
1806 | - new YAHOO.widget.Button( | |
1807 | - "i3GEOcartoBotaoAdicionaCamada", | |
1808 | - {onclick:{fn: i3GEOF.metaestat.comum.adicionaCamada}} | |
1809 | - ); | |
1810 | - $i("i3GEOcartoBotaoAdicionaCamada-button").style.width = largura + "px"; | |
1811 | - } | |
1812 | - }, | |
1813 | - botaoJanelaAnalise: function(){ | |
1814 | - new YAHOO.widget.Button( | |
1815 | - "i3GEOcartoBotaoAnalise", | |
1816 | - {onclick:{fn: i3GEOF.metaestat.analise.inicia}} | |
1817 | - ); | |
1818 | - $i("i3GEOcartoBotaoAnalise-button").style.width = (i3GEOF.metaestat.LARGURA / 2) - 15 + "px"; | |
1819 | - }, | |
1820 | - opcoesVariaveis: function(){ | |
1821 | - var onde = $i("i3geoCartoVariaveis"), | |
1822 | - temp = function(dados){ | |
1823 | - var ins = ''; | |
1824 | - //botao para obter mais info | |
1825 | - ins = '<p style="text-align:left;">' + | |
1826 | - '<input type="button" id="i3GEOcartoBotaoEditor" value="'+$trad(12,i3GEOF.metaestat.dicionario)+'"class="paragrafo" style="width:200px;cursor:pointer;color:blue" /> ' + | |
1827 | - '<input type="button" id="i3GEOcartoBotaoAnalise" value="'+$trad(11,i3GEOF.metaestat.dicionario)+'"class="paragrafo" style="width:200px;cursor:pointer;color:blue" /></p>' + | |
1828 | - '<br><p class="paragrafo" >'+$trad(1,i3GEOF.metaestat.dicionario) + | |
1829 | - '<img title="Atualiza listas" onclick="i3GEOF.metaestat.principal.atualiza()" style="left:5px;top:3px;position:relative;cursor:pointer;text-align:left" src="'+i3GEO.configura.locaplic+'/imagens/oxygen/16x16/folder-sync.png" /></p>'; | |
1830 | - ins += i3GEOF.metaestat.principal.comboVariaveis(dados,"i3geoCartoComboVariavel","i3GEOF.metaestat.principal.comboVariaveisOnchange(this)"); | |
1831 | - if(onde){ | |
1832 | - onde.innerHTML = ins; | |
1833 | - //i3GEOF.metaestat.principal.botaoInfo(); | |
1834 | - i3GEOF.metaestat.principal.botaoJanelaEditor(); | |
1835 | - //i3GEOF.metaestat.principal.botaoJanelaClasses(); | |
1836 | - i3GEOF.metaestat.principal.botaoJanelaAnalise(); | |
1837 | - } | |
1838 | - return ins; | |
1839 | - }; | |
1840 | - i3GEOF.metaestat.comum.aguarde(onde); | |
1841 | - i3GEO.php.listaVariavel(temp); | |
1842 | - }, | |
1843 | - comboVariaveisOnchange: function(combo){ | |
1844 | - if($i("i3geoCartoParametrosMedidasVariavel")){ | |
1845 | - $i("i3geoCartoParametrosMedidasVariavel").innerHTML = ""; | |
1846 | - } | |
1847 | - if(combo.value != ""){ | |
1848 | - i3GEOF.metaestat.principal.opcoesMedidasVariavel(combo.value); | |
1849 | - } | |
1850 | - else{ | |
1851 | - $i("i3geoCartoMedidasVariavel").innerHTML = ""; | |
1852 | - } | |
1853 | - i3GEOF.metaestat.classes.zeraParametros(); | |
1854 | - }, | |
1855 | - comboMedidasVariavel: function(dados,idcombo,stronchange,filtroesquema,largura,mostraIconeprop,mostraIconedown){ | |
1856 | - i3GEOF.metaestat.DADOSMEDIDASVARIAVEL = dados; | |
1857 | - var n = dados.length, | |
1858 | - ins = '', | |
1859 | - i; | |
1860 | - if(!largura || largura === ""){ | |
1861 | - largura = i3GEOF.metaestat.LARGURA - 20; | |
1862 | - } | |
1863 | - if(!mostraIconeprop || mostraIconeprop === ""){ | |
1864 | - mostraIconeprop = "sim"; | |
1865 | - } | |
1866 | - if(!mostraIconedown || mostraIconedown === ""){ | |
1867 | - mostraIconedown = "sim"; | |
1868 | - } | |
1869 | - if(mostraIconeprop == "sim"){ | |
1870 | - largura = largura - 19; | |
1871 | - } | |
1872 | - if(mostraIconedown == "sim"){ | |
1873 | - largura = largura - 19; | |
1874 | - } | |
1875 | - ins += "<select id='"+idcombo+"' style='box-shadow:0 1px 5px gray;width:"+largura+"px' onchange='"+stronchange+"'><option value=''>---</option>"; | |
1876 | - for(i=0;i<n;i++){ | |
1877 | - if(!filtroesquema || (filtroesquema != "" && dados[i].esquemadb != filtroesquema)){ | |
1878 | - ins += "<option value='"+dados[i].id_medida_variavel+"'>"+dados[i].nomemedida+"</option>"; | |
1879 | - } | |
1880 | - } | |
1881 | - ins += "</select>"; | |
1882 | - if(mostraIconeprop == "sim"){ | |
1883 | - ins += "<img class='ticPropriedades2' src='"+i3GEO.configura.locaplic+"/imagens/visual/default/branco.gif' style='height:14px;position:relative;cursor:pointer;left:5px;top:4px;' onclick='i3GEOF.metaestat.classes.inicia()' title='"+$trad(18,i3GEOF.metaestat.dicionario)+"'/>"; | |
1884 | - } | |
1885 | - if(mostraIconedown == "sim"){ | |
1886 | - ins += "<img class='ticDownload' src='"+i3GEO.configura.locaplic+"/imagens/visual/default/branco.gif' style='position:relative;cursor:pointer;left:8px;top:5px;' onclick='i3GEOF.metaestat.principal.downloadMedida()' title='"+$trad("a3")+"'/>"; | |
1887 | - } | |
1888 | - return ins; | |
1889 | - }, | |
1890 | - opcoesMedidasVariavel: function(codigo_variavel){ | |
1891 | - var onde = $i("i3geoCartoMedidasVariavel"), | |
1892 | - temp = function(dados){ | |
1893 | - var ins = '<p class="paragrafo" >'+$trad(2,i3GEOF.metaestat.dicionario)+'</p>'; | |
1894 | - ins += i3GEOF.metaestat.principal.comboMedidasVariavel(dados,"i3geoCartoComboMedidasVariavel","i3GEOF.metaestat.principal.comboMedidaVariavelOnchange(this)"); | |
1895 | - if(onde){ | |
1896 | - onde.innerHTML = ins; | |
1897 | - } | |
1898 | - return ins; | |
1899 | - }; | |
1900 | - i3GEOF.metaestat.comum.aguarde(onde); | |
1901 | - i3GEO.php.listaMedidaVariavel(codigo_variavel,temp); | |
1902 | - }, | |
1903 | - comboMedidaVariavelOnchange: function(combo){ | |
1904 | - if($i("i3geoCartoParametrosMedidasVariavel")){ | |
1905 | - $i("i3geoCartoParametrosMedidasVariavel").innerHTML = ""; | |
1906 | - } | |
1907 | - if(combo.value != ""){ | |
1908 | - //i3GEOF.metaestat.classes.inicia(); | |
1909 | - i3GEOF.metaestat.parametros.lista(combo.value); | |
1910 | - i3GEOF.metaestat.principal.botaoAdicionaCamada(); | |
1911 | - } | |
1912 | - i3GEOF.metaestat.classes.zeraParametros(); | |
1913 | - }, | |
1914 | - comboClassificacoesMedidaVariavel: function(dados,idcombo){ | |
1915 | - var ins,i,n = dados.length; | |
1916 | - ins = "<select id='"+idcombo+"' style='box-shadow:0 1px 5px gray;width:"+(i3GEOF.metaestat.LARGURA - 20)+"px' onchange='i3GEOF.metaestat.principal.comboClassificacoesMedidaVariavelOnchange(this)'><option value=''>---</option>"; | |
1917 | - for(i=0;i<n;i++){ | |
1918 | - ins += "<option title='"+dados[i].observacao+"' value='"+dados[i].id_classificacao+"'>"+dados[i].nome+"</option>"; | |
1919 | - } | |
1920 | - ins += "</select>"; | |
1921 | - return ins; | |
1922 | - }, | |
1923 | - comboClassificacoesMedidaVariavelOnchange: function(combo){ | |
1924 | - | |
1925 | - }, | |
1926 | - downloadMedida: function(){ | |
1927 | - if(!$i("i3geoCartoComboMedidasVariavel")){ | |
1928 | - i3GEO.janela.tempoMsg("erro: i3geoCartoComboMedidasVariavel???"); | |
1929 | - return; | |
1930 | - } | |
1931 | - if(window.confirm("Confirma o download dos dados")){ | |
1932 | - var p = i3GEO.configura.locaplic+"/admin/php/metaestat.php?funcao=dadosMedidaVariavel" + | |
1933 | - "&todasascolunas=1&formato=csv&id_medida_variavel="+$i("i3geoCartoComboMedidasVariavel").value; | |
1934 | - window.open(p); | |
1935 | - } | |
1936 | - } | |
1937 | - }, | |
1938 | - //funcoes utilizadas quando o mapa esta cadastrado e e utilizado um template para publicar o mapa | |
1939 | - publicador: { | |
1940 | - IDMAPA: "", | |
1941 | - montaGrupos: function(onde){ | |
1942 | - var grupos = function(dados){ | |
1943 | - var n = dados.length, | |
1944 | - ins = '<input type=hidden id=i3geoCartoComboMedidasVariavel value=""/>', | |
1945 | - i; | |
1946 | - for(i=0;i<n;i++){ | |
1947 | - ins += '<p class="paragrafo" >'+dados[i].titulo+'</p>'; | |
1948 | - ins += '<div id="comboTemasMapa_'+dados[i].id_mapa_grupo+'"></div>'; | |
1949 | - } | |
1950 | - $i(onde).innerHTML = ins; | |
1951 | - for(i=0;i<n;i++){ | |
1952 | - i3GEOF.metaestat.publicador.comboTemas(dados[i].id_mapa_grupo,"comboTemasMapa_"+dados[i].id_mapa_grupo); | |
1953 | - } | |
1954 | - }; | |
1955 | - i3GEO.php.listaGruposMapaMetaestat(grupos,i3GEOF.metaestat.publicador.IDMAPA); | |
1956 | - }, | |
1957 | - comboTemas: function(id_mapa_grupo,onde){ | |
1958 | - temas = function(dados){ | |
1959 | - var n = dados.length, | |
1960 | - ins = '', | |
1961 | - i; | |
1962 | - | |
1963 | - ins = "<select style='width:"+(i3GEOF.metaestat.LARGURA - 60)+"px' onchange='i3GEOF.metaestat.publicador.comboMedidaVariavelOnchange(this)'><option value=''>---</option>"; | |
1964 | - for(i=0;i<n;i++){ | |
1965 | - ins += "<option value='"+dados[i].id_mapa_tema+"'>"+dados[i].titulo+"</option>"; | |
1966 | - } | |
1967 | - ins += "</select>"; | |
1968 | - ins += "<img class='ticPropriedades2' src='"+i3GEO.configura.locaplic+"/imagens/visual/default/branco.gif' style='height:14px;position:relative;cursor:pointer;left:5px;top:4px;' onclick='i3GEOF.metaestat.classes.inicia()' title='"+$trad(18,i3GEOF.metaestat.dicionario)+"'/>"; | |
1969 | - ins += "<img class='ticDownload' src='"+i3GEO.configura.locaplic+"/imagens/visual/default/branco.gif' style='position:relative;cursor:pointer;left:8px;top:5px;' onclick='i3GEOF.metaestat.principal.downloadMedida()' title='"+$trad("a3")+"'/>"; | |
1970 | - | |
1971 | - $i(onde).innerHTML = ins; | |
1972 | - }; | |
1973 | - i3GEO.php.listaTemasMapaMetaestat(temas,id_mapa_grupo); | |
1974 | - }, | |
1975 | - comboMedidaVariavelOnchange: function(obj){ | |
1976 | - //contorna o problema da funcao de definicao do titulo da camada tentar obter um objeto select | |
1977 | - $i("i3geoCartoComboMedidasVariavel").value = obj.value; | |
1978 | - $i("i3geoCartoComboMedidasVariavel").options = [{"label":""}]; | |
1979 | - $i("i3geoCartoComboMedidasVariavel").selectedIndex = 0; | |
1980 | - i3GEOF.metaestat.classes.zeraParametros(); | |
1981 | - i3GEOF.metaestat.principal.comboMedidaVariavelOnchange(obj); | |
1982 | - } | |
1983 | - } | |
1984 | -}; | |
1985 | 0 | \ No newline at end of file |