Commit abd918391fa82b5e2f5b632e1ce50187a9dea1d5
1 parent
784e76e5
Exists in
master
and in
7 other branches
--no commit message
Showing
2 changed files
with
162 additions
and
78 deletions
Show diff stats
ferramentas/metaestat/editorlimites.js
... | ... | @@ -29,7 +29,7 @@ Free Software Foundation, Inc., no endereco |
29 | 29 | //TODO traduzir |
30 | 30 | var editorlimites = { |
31 | 31 | /** |
32 | - * Estilo do objeto DOM com a imagem de aguarde existente no cabeçalho da janela | |
32 | + * Estilo do objeto DOM com a imagem de aguarde existente no cabecalho da janela | |
33 | 33 | * |
34 | 34 | */ |
35 | 35 | aguarde: "", |
... | ... | @@ -43,7 +43,7 @@ var editorlimites = { |
43 | 43 | /** |
44 | 44 | * Inicia o editor |
45 | 45 | * |
46 | - * @param {String} Id do DIV que receberá o conteúdo HTML do editor | |
46 | + * @param {String} Id do DIV que recebera o conteudo HTML do editor. Ja deve estar criado no HTML | |
47 | 47 | * @return |
48 | 48 | */ |
49 | 49 | inicia: function(iddiv){ |
... | ... | @@ -132,19 +132,11 @@ var editorlimites = { |
132 | 132 | html:function(){ |
133 | 133 | var ins = '' + |
134 | 134 | ' <button title="Desenhar um polígono" onclick="editorlimites.digitalizaPol(this)"><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/polygon-create.png" /></button>' + |
135 | - ' <button title="Capturar polígono de um tema" onclick="editorlimites.ativaCaptura()"><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/layer-import.png" /></button>' + | |
135 | + ' <button title="Capturar polígono de um tema" onclick="editorlimites.capturaPoligonoTema.ativa(this)"><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/layer-import.png" /></button>' + | |
136 | 136 | ' <button title="Selecionar" onclick="editorlimites.seleciona(this)"><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/select.png" /></button>' + |
137 | 137 | ' <button title="Remove selecionado (não apaga)" onclick="editorlimites.deleteSelectedShape()"><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/selected-delete.png" /></button>' + |
138 | 138 | ' <button title="Salvar limite" onclick="editorlimites.salvaLimite.inicia()"><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/vector-save.png" /></button>' + |
139 | - //' <button title="Upload de shapefile" onclick="editorlimites.upload.criaJanelaFlutuante()"><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/open.png" /></button>' + | |
140 | - //' <button title="Relatório CMAS" onmousedown="editorlimites.mudaicone()" onclick="editorlimites.relatorioCmas()" ><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/table.png" /></button>' + | |
141 | - //' <button onmousedown="editorlimites.mudaicone()" id="pan" ><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/pan.png" /></button>' + | |
142 | - //' <button onmousedown="editorlimites.mudaicone()" id="zoomli" ><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/zoom-region.png" /></button>' + | |
143 | - //' <button onmousedown="editorlimites.mudaicone()" id="zoomtot" ><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/zoom-extent.png" /></button>' + | |
144 | - //' <button onmousedown="editorlimites.mudaicone()" id="identifica" ><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/identify.png" /></button>' + | |
145 | - //' <button onmousedown="editorlimites.mudaicone()" id="mede" ><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/length-measure.png" /></button>' + | |
146 | - //' <button onmousedown="editorlimites.mudaicone()" id="area" ><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/area-measure.png" /></button>' + | |
147 | - //' <button title="Imprimir" onmousedown="editorlimites.mudaicone()" onclick="editorlimites.imprimir()" ><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/print.png" /></button>' + | |
139 | + ' <button title="Editar atributos" onclick="editorlimites.editarAtributos.ativa(this)"><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/annotation-form.png" /></button>' + | |
148 | 140 | ' <button title="Ajuda" onmousedown="editorlimites.mudaicone()" onclick="editorlimites.Ajuda()" ><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/help-contents.png" /></button>' + |
149 | 141 | ' <br><div id="i3geoCartoRegioesEditaveisDiv" ><img style="display:block;z-index:2" src="'+i3GEO.configura.locaplic+'/imagens/aguarde.gif" /></div>'; //combo para escolher a regiao |
150 | 142 | return ins; |
... | ... | @@ -264,67 +256,73 @@ var editorlimites = { |
264 | 256 | } |
265 | 257 | return wkt; |
266 | 258 | }, |
267 | - ativaCaptura: function(){ | |
268 | - editorlimites.mudaicone(); | |
269 | - if(i3GEO.eventos.MOUSECLIQUE.toString().search("editorlimites.capturaPoligonoTema()") < 0) | |
270 | - {i3GEO.eventos.MOUSECLIQUE.push("editorlimites.capturaPoligonoTema()");} | |
271 | - }, | |
272 | - capturaPoligonoTema: function(){ | |
273 | - var temp,tema="",regiao="",p,par, | |
274 | - aguarde = $i("janelaEditorLimites_imagemCabecalho"); | |
275 | - if(!$i("i3geoCartoRegioesEditaveis")){ | |
276 | - i3GEO.eventos.MOUSECLIQUE.remove("editorlimites.capturaPoligonoTema()"); | |
277 | - } | |
278 | - else{ | |
279 | - temp = function(retorno){ | |
280 | - var temp,re,n,i,j, | |
281 | - wkt = "", | |
282 | - colunaid = editorlimites.descregioes["a_"+regiao]["identificador"], | |
283 | - valorid = "", | |
284 | - colunanome = editorlimites.descregioes["a_"+regiao]["colunanomeregiao"], | |
285 | - valornome = "", | |
286 | - pontos = [], | |
287 | - aguarde = $i("janelaEditorLimites_imagemCabecalho"); | |
288 | - //obtem os dados buscando nos itens que vem da requisicao ao wms | |
289 | - temp = retorno.data[0].resultado[0]; | |
290 | - n = temp.length; | |
291 | - for(i=0;i<n;i++){ | |
292 | - if(temp[i].alias == "wkt"){ | |
293 | - wkt = temp[i].valor; | |
259 | + capturaPoligonoTema:{ | |
260 | + ativa: function(botao){ | |
261 | + editorlimites.mudaicone(botao); | |
262 | + i3GEO.util.mudaCursor(i3GEO.configura.cursores,"pointer",i3GEO.Interface.IDMAPA,i3GEO.configura.locaplic); | |
263 | + if(i3GEO.eventos.MOUSECLIQUE.toString().search("editorlimites.capturaPoligonoTema.captura()") < 0) | |
264 | + {i3GEO.eventos.MOUSECLIQUE.push("editorlimites.capturaPoligonoTema.captura()");} | |
265 | + }, | |
266 | + desativa: function(){ | |
267 | + }, | |
268 | + captura: function(){ | |
269 | + var temp,tema="",regiao="",p,par, | |
270 | + aguarde = $i("janelaEditorLimites_imagemCabecalho"); | |
271 | + editorlimites.mudaicone(); | |
272 | + if(!$i("i3geoCartoRegioesEditaveis")){ | |
273 | + i3GEO.eventos.MOUSECLIQUE.remove("editorlimites.capturaPoligonoTema.captura()"); | |
274 | + } | |
275 | + else{ | |
276 | + temp = function(retorno){ | |
277 | + var temp,re,n,i,j, | |
278 | + wkt = "", | |
279 | + colunaid = editorlimites.descregioes["a_"+regiao]["identificador"], | |
280 | + valorid = "", | |
281 | + colunanome = editorlimites.descregioes["a_"+regiao]["colunanomeregiao"], | |
282 | + valornome = "", | |
283 | + pontos = [], | |
284 | + aguarde = $i("janelaEditorLimites_imagemCabecalho"); | |
285 | + //obtem os dados buscando nos itens que vem da requisicao ao wms | |
286 | + temp = retorno.data[0].resultado[0]; | |
287 | + n = temp.length; | |
288 | + for(i=0;i<n;i++){ | |
289 | + if(temp[i].alias == "wkt"){ | |
290 | + wkt = temp[i].valor; | |
291 | + } | |
292 | + if(temp[i].alias == colunaid){ | |
293 | + valorid = temp[i].valor; | |
294 | + } | |
295 | + if(temp[i].alias == colunanome){ | |
296 | + valornome = temp[i].valor; | |
297 | + } | |
294 | 298 | } |
295 | - if(temp[i].alias == colunaid){ | |
296 | - valorid = temp[i].valor; | |
299 | + if(aguarde){ | |
300 | + aguarde.style.visibility = "hidden"; | |
297 | 301 | } |
298 | - if(temp[i].alias == colunanome){ | |
299 | - valornome = temp[i].valor; | |
302 | + re = new RegExp("POLYGON \\(\\(", "g"); | |
303 | + wkt = wkt.replace(re,''); | |
304 | + re = new RegExp("\\)\\)", "g"); | |
305 | + wkt = wkt.replace(re,''); | |
306 | + re = new RegExp(", ", "g"); | |
307 | + wkt = wkt.replace(re,','); | |
308 | + wkt = wkt.split(","); | |
309 | + n = wkt.length; | |
310 | + for(i=0;i<n;i++){ | |
311 | + j = wkt[i].split(" "); | |
312 | + pontos.push([j[0],j[1]]); | |
300 | 313 | } |
314 | + editorlimites.adicionaPoligonos([pontos],tema,colunaid,valorid,colunanome,valornome); | |
315 | + i3GEO.eventos.MOUSECLIQUE = []; | |
316 | + }; | |
317 | + regiao = $i("i3geoCartoRegioesEditaveis").value; | |
318 | + if(regiao != ""){ | |
319 | + tema = editorlimites.regioestemas["a"+regiao]; | |
320 | + if(aguarde && aguarde.style.visibility == "hidden"){ | |
321 | + aguarde.style.visibility = "visible"; | |
322 | + p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php"; | |
323 | + par = "funcao=identifica3&opcao=tema&xy="+objposicaocursor.ddx+","+objposicaocursor.ddy+"&resolucao=1&g_sid="+i3GEO.configura.sid+"&ext="+i3GEO.parametros.mapexten+"&listaDeTemas=&wkt=sim&tema="+tema; | |
324 | + cpJSON.call(p,"identifica",temp,par); | |
301 | 325 | } |
302 | - if(aguarde){ | |
303 | - aguarde.style.visibility = "hidden"; | |
304 | - } | |
305 | - re = new RegExp("POLYGON \\(\\(", "g"); | |
306 | - wkt = wkt.replace(re,''); | |
307 | - re = new RegExp("\\)\\)", "g"); | |
308 | - wkt = wkt.replace(re,''); | |
309 | - re = new RegExp(", ", "g"); | |
310 | - wkt = wkt.replace(re,','); | |
311 | - wkt = wkt.split(","); | |
312 | - n = wkt.length; | |
313 | - for(i=0;i<n;i++){ | |
314 | - j = wkt[i].split(" "); | |
315 | - pontos.push([j[0],j[1]]); | |
316 | - } | |
317 | - editorlimites.adicionaPoligonos([pontos],tema,colunaid,valorid,colunanome,valornome); | |
318 | - i3GEO.eventos.MOUSECLIQUE = []; | |
319 | - }; | |
320 | - regiao = $i("i3geoCartoRegioesEditaveis").value; | |
321 | - if(regiao != ""){ | |
322 | - tema = editorlimites.regioestemas["a"+regiao]; | |
323 | - if(aguarde && aguarde.style.visibility == "hidden"){ | |
324 | - aguarde.style.visibility = "visible"; | |
325 | - p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php"; | |
326 | - par = "funcao=identifica3&opcao=tema&xy="+objposicaocursor.ddx+","+objposicaocursor.ddy+"&resolucao=1&g_sid="+i3GEO.configura.sid+"&ext="+i3GEO.parametros.mapexten+"&listaDeTemas=&wkt=sim&tema="+tema; | |
327 | - cpJSON.call(p,"identifica",temp,par); | |
328 | 326 | } |
329 | 327 | } |
330 | 328 | } |
... | ... | @@ -332,9 +330,9 @@ var editorlimites = { |
332 | 330 | /* |
333 | 331 | Function: mudaicone |
334 | 332 | |
335 | - Altera as bordas dos ícones | |
333 | + Altera as bordas dos ícones e desativa eventos anteriores | |
336 | 334 | */ |
337 | - mudaicone: function(){ | |
335 | + mudaicone: function(botao){ | |
338 | 336 | var c = $i(editorlimites.iddiv), |
339 | 337 | ci = c.getElementsByTagName("img"), |
340 | 338 | n = ci.length, |
... | ... | @@ -343,19 +341,22 @@ var editorlimites = { |
343 | 341 | ci[i].parentNode.style.backgroundColor = "#F5F5F5"; |
344 | 342 | } |
345 | 343 | i3GEO.eventos.MOUSECLIQUE = []; |
344 | + editorlimites.capturaPoligonoTema.desativa(); | |
345 | + editorlimites.editarAtributos.desativa(); | |
346 | + if(botao && botao.style){ | |
347 | + botao.style.backgroundColor = "#cedff2"; | |
348 | + } | |
346 | 349 | }, |
347 | 350 | digitalizaPol: function(botao){ |
348 | - editorlimites.mudaicone(); | |
349 | - botao.style.backgroundColor = "#cedff2"; | |
351 | + editorlimites.mudaicone(botao); | |
350 | 352 | i3GEO.util.mudaCursor(i3GEO.configura.cursores,"pointer",i3GEO.Interface.IDMAPA,i3GEO.configura.locaplic); |
351 | 353 | editorlimites.drawingManager.setOptions({ |
352 | 354 | drawingMode: google.maps.drawing.OverlayType.POLYGON |
353 | 355 | }); |
354 | 356 | }, |
355 | 357 | seleciona: function(botao){ |
356 | - editorlimites.mudaicone(); | |
358 | + editorlimites.mudaicone(botao); | |
357 | 359 | i3GEO.util.mudaCursor(i3GEO.configura.cursores,"pointer",i3GEO.Interface.IDMAPA,i3GEO.configura.locaplic); |
358 | - botao.style.backgroundColor = "#cedff2"; | |
359 | 360 | editorlimites.drawingManager.setOptions({ |
360 | 361 | drawingMode: null |
361 | 362 | }); |
... | ... | @@ -510,13 +511,13 @@ var editorlimites = { |
510 | 511 | return ins; |
511 | 512 | }, |
512 | 513 | criaJanelaFlutuante: function(html){ |
513 | - var titulo,cabecalho,minimiza; | |
514 | + var titulo,cabecalho,minimiza,janela; | |
514 | 515 | cabecalho = function(){}; |
515 | 516 | minimiza = function(){ |
516 | 517 | i3GEO.janela.minimiza("salvaLimite"); |
517 | 518 | }; |
518 | 519 | titulo = "Salva limite </a>"; |
519 | - i3GEO.janela.cria( | |
520 | + janela = i3GEO.janela.cria( | |
520 | 521 | "350px", |
521 | 522 | "265px", |
522 | 523 | "", |
... | ... | @@ -531,6 +532,7 @@ var editorlimites = { |
531 | 532 | ); |
532 | 533 | $i("salvaLimite_corpo").style.backgroundColor = "white"; |
533 | 534 | $i("salvaLimite_corpo").innerHTML = html; |
535 | + YAHOO.util.Event.addListener(janela[0].close, "click", editorlimites.mudaicone); | |
534 | 536 | }, |
535 | 537 | gravaDados: function(comwkt){ |
536 | 538 | //TODO verificar login ao salvar |
... | ... | @@ -580,6 +582,88 @@ var editorlimites = { |
580 | 582 | p = i3GEO.configura.locaplic+"/admin/php/metaestat.php?funcao=mantemDadosRegiao&tipo=excluir"; |
581 | 583 | cpJSON.call(p,"foo",temp,"&codigo_tipo_regiao="+codigo_tipo_regiao+"&identificador="+identificador); |
582 | 584 | } |
585 | + }, | |
586 | + editarAtributos: { | |
587 | + ativa: function(botao){ | |
588 | + editorlimites.mudaicone(botao); | |
589 | + if(i3GEO.eventos.MOUSECLIQUE.toString().search("editorlimites.editarAtributos.captura()") < 0) | |
590 | + {i3GEO.eventos.MOUSECLIQUE.push("editorlimites.editarAtributos.captura()");} | |
591 | + var janela = YAHOO.i3GEO.janela.manager.find("editaAtributos"); | |
592 | + if(janela){ | |
593 | + $i("editarAtributosForm").innerHTML = ""; | |
594 | + } | |
595 | + else{ | |
596 | + editorlimites.editarAtributos.criaJanelaFlutuante(editorlimites.editarAtributos.html()); | |
597 | + editorlimites.editarAtributos.comboVariaveis(); | |
598 | + } | |
599 | + }, | |
600 | + desativa: function(){ | |
601 | + var janela = YAHOO.i3GEO.janela.manager.find("editaAtributos"); | |
602 | + if(janela){ | |
603 | + janela.destroy(); | |
604 | + } | |
605 | + }, | |
606 | + captura: function(){ | |
607 | + if(!YAHOO.i3GEO.janela.manager.find("editaAtributos")){ | |
608 | + editorlimites.mudaicone(botao); | |
609 | + return; | |
610 | + } | |
611 | + editorlimites.editarAtributos.pegaDados(); | |
612 | + }, | |
613 | + comboMedidas: function(){ | |
614 | + | |
615 | + }, | |
616 | + pegaDados: function(){ | |
617 | + | |
618 | + }, | |
619 | + salva: function(){ | |
620 | + | |
621 | + }, | |
622 | + criaJanelaFlutuante: function(html){ | |
623 | + var janela,titulo,cabecalho,minimiza; | |
624 | + cabecalho = function(){}; | |
625 | + minimiza = function(){ | |
626 | + i3GEO.janela.minimiza("editaAtributos"); | |
627 | + }; | |
628 | + titulo = "Atributos </a>"; | |
629 | + janela = i3GEO.janela.cria( | |
630 | + "350px", | |
631 | + "265px", | |
632 | + "", | |
633 | + "", | |
634 | + "", | |
635 | + titulo, | |
636 | + "editaAtributos", | |
637 | + false, | |
638 | + "hd", | |
639 | + cabecalho, | |
640 | + minimiza | |
641 | + ); | |
642 | + $i("editaAtributos_corpo").style.backgroundColor = "white"; | |
643 | + $i("editaAtributos_corpo").innerHTML = html; | |
644 | + YAHOO.util.Event.addListener(janela[0].close, "click", editorlimites.mudaicone); | |
645 | + }, | |
646 | + html: function(){ | |
647 | + var ins = '' + | |
648 | + '<p class="paragrafo" >Clique no mapa para obter os atributos</p>' + | |
649 | + '<p class="paragrafo" ><div id="editarAtributosVariaveis" ></div></p>' + | |
650 | + '<p class="paragrafo" ><div id="editarAtributosForm" ></div></p>' + | |
651 | + ''; | |
652 | + return ins; | |
653 | + }, | |
654 | + comboVariaveis: function(){ | |
655 | + var temp = function(dados){ | |
656 | + var i,n = dados.length, ins = ''; | |
657 | + ins += '<p class="paragrafo" >Escolha uma variável para editar</p>'; | |
658 | + ins += "<select style='box-shadow:0 1px 5px gray;width:200px' onchange=''><option value=''>---</option>"; | |
659 | + for(i=0;i<n;i++){ | |
660 | + ins += "<option title='"+dados[i].descricao+"' value='"+dados[i].codigo_variavel+"'>"+dados[i].nome+"</option>"; | |
661 | + } | |
662 | + ins += "</select>"; | |
663 | + $i("editarAtributosVariaveis").innerHTML = ins; | |
664 | + }; | |
665 | + i3GEO.php.listaVariavel(temp,"i3geo_metaestat"); | |
666 | + } | |
583 | 667 | } |
584 | 668 | //TODO incluir opcao para clicar e editar atributos de medida da variavel |
585 | 669 | }; |
586 | 670 | \ No newline at end of file | ... | ... |
ferramentas/metaestat/editorlimites.php
... | ... | @@ -176,7 +176,7 @@ i3GEO.finalizaAPI = function(){ |
176 | 176 | minimiza = function() { |
177 | 177 | i3GEO.janela.minimiza("janelaEditorLimites"); |
178 | 178 | }; |
179 | - janela = i3GEO.janela.cria("230px", "100px", "", "", "", | |
179 | + janela = i3GEO.janela.cria("255px", "100px", "", "", "", | |
180 | 180 | "Editor", "janelaEditorLimites", false, "hd", |
181 | 181 | cabecalho, minimiza); |
182 | 182 | $i("janelaEditorLimites_corpo").style.backgroundColor = "white"; | ... | ... |