Commit adeb30ea38fc8c7c81cb06251072c8cec650f012

Authored by Edmar Moretti
1 parent cad328a4

Opção para mudar cor da legenda diretamente na lista de classes da ferramenta de edição da legenda

admin/admin.db
No preview for this file type
classesjs/classe_arvoredecamadas.js
... ... @@ -775,11 +775,13 @@ i3GEO.arvoreDeCamadas = {
775 775 i3GEO.arvoreDeCamadas.adicionaOpcaoTema($trad("t37"),$trad("t37"),'i3GEO.tema.dialogo.graficotema(\"'+ltema.name+'\")',node);
776 776 }
777 777 }
  778 + //essas opções foram migradas para o editor de legenda
  779 + /*
778 780 temp = $trad("p18");
779 781 if(ltema.classe.toLowerCase() == "nao")
780 782 {temp = $trad("p17");}
781 783 i3GEO.arvoreDeCamadas.adicionaOpcaoTema($trad("p19"),temp,'i3GEO.tema.invertestatuslegenda(\"'+ltema.name+'\")',node);
782   -
  784 + */
783 785 if (ltema.type < 4){
784 786 i3GEO.arvoreDeCamadas.adicionaOpcaoTema($trad("t32"),$trad("t33"),'i3GEO.tema.dialogo.editaLegenda(\"'+ltema.name+'\")',node);
785 787 }
... ...
classesjs/classe_barradebotoes.js
... ... @@ -510,8 +510,6 @@ i3GEO.barraDeBotoes = {
510 510 */
511 511 inicializaBarra:function(idconteudo,idconteudonovo,barraZoom,x,y,onde){
512 512 if(typeof(console) !== 'undefined'){console.info("i3GEO.barraDeBotoes.inicializaBarra()");}
513   - if(i3GEO.util.pegaCookie("botoesAjuda") == "nao")
514   - {i3GEO.barraDeBotoes.AJUDA = false;}
515 513 if(i3GEO.barraDeBotoes.TEMPLATEBOTAO === "")
516 514 {i3GEO.barraDeBotoes.TEMPLATEBOTAO = "<div style='display:inline;background-color:rgb(250,250,250);'><p style='font-size:2px;'>&nbsp;</p><img style='border:0px solid white;' src='"+i3GEO.configura.locaplic+"/imagens/branco.gif' id='$$'/></div>";}
517 515 var tipo,mostra,numerobotoes = 0,i,temp,elementos,nelementos = 0,e,wj,recuo,novoel,alturadisponivel,n,chaves,re,estilo;
... ...
classesjs/classe_guias.js
... ... @@ -90,7 +90,7 @@ i3GEO.guias = {
90 90 click:""
91 91 },
92 92 "adiciona":{
93   - titulo:"+"+$trad("g1"),
  93 + titulo:$trad("g1a"),
94 94 id:"guia2",
95 95 idconteudo:"guia2obj",
96 96 click: function(){
... ...
classesjs/classe_i3geo.js
... ... @@ -300,6 +300,8 @@ i3GEO = {
300 300 //
301 301 if(document.getElementById("ajuda")) //para efeitos de compatibilidade com as versões anteriores a 4.1
302 302 {i3GEO.ajuda.DIVAJUDA = "ajuda";}
  303 + if(i3GEO.util.pegaCookie("botoesAjuda") == "nao")
  304 + {i3GEO.barraDeBotoes.AJUDA = false;}
303 305 abreJM = "sim";
304 306 if(i3GEO.util.pegaCookie("g_janelaMen")){
305 307 abreJM = i3GEO.util.pegaCookie("g_janelaMen");
... ...
classesjs/dicionario.js
... ... @@ -889,6 +889,13 @@ en:&quot;Layer&quot;,
889 889 es:"Temas",
890 890 it:"Temi"
891 891 }],
  892 +"g1a":[
  893 +{
  894 +pt:"Catálogo",
  895 +en:"Catalog",
  896 +es:"Catalogo",
  897 +it:"Catalog"
  898 +}],
892 899 "g2":[
893 900 {
894 901 pt:"Adiciona",
... ...
classesphp/classe_alteraclasse.php
... ... @@ -9,7 +9,7 @@ Licenca:
9 9  
10 10 GPL2
11 11  
12   -I3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet
  12 +i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet
13 13  
14 14 Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil
15 15 Desenvolvedor: Edmar Moretti edmar.moretti@mma.gov.br
... ... @@ -456,6 +456,30 @@ Adiciona opacidade variável de 0 a 100 conforme o número de classes
456 456 return("ok");
457 457 }
458 458 /*
  459 +function: alteracor
  460 +
  461 +Aplica uma nova cor aos estilos de uma classe
  462 +
  463 +*/
  464 + function alteracor($idclasse,$cor)
  465 + {
  466 + error_reporting(E_ALL);
  467 + if(!$this->layer){return "erro";}
  468 + $numclasses = $this->layer->numclasses;
  469 + $cor = str_replace(" ",",",$cor);
  470 + $cor = explode(",",$cor);
  471 + $classe = $this->layer->getclass($idclasse);
  472 + $numestilos = $classe->numstyles;
  473 + for($j=0;$j<$numestilos;++$j)
  474 + {
  475 + $estilo = $classe->getstyle($j);
  476 + $ncor = $estilo->color;
  477 + $ncor->setrgb($cor[0],$cor[1],$cor[2]);
  478 + }
  479 + $this->layer->setMetaData("cache","");
  480 + return("ok");
  481 + }
  482 +/*
459 483 function: alterageometria
460 484  
461 485 Altera a geometria de representação de todos os estilos de todas as classes de um layer
... ...
classesphp/classe_selecao.php
... ... @@ -124,7 +124,7 @@ Seleciona os elementos de um tema baseado em um conjunto de pontos que formarão
124 124  
125 125 parameters:
126 126  
127   -$tipo - Tipo de operação adiciona|retira|inverte|limpa
  127 +$tipo - Tipo de operação adiciona|retira|inverte|limpa|novo
128 128  
129 129 $xs - lista de coordenadas x separadas por virgula
130 130  
... ... @@ -134,6 +134,11 @@ $ys - lista de coordenadas y separadas por virgula
134 134 {
135 135 if(!$this->layer){return "erro";}
136 136 $this->layer->set("tolerance",0);
  137 + if ($tipo == "novo")
  138 + {
  139 + $this->selecaoLimpa();
  140 + $tipo = "adiciona"
  141 + }
137 142 if ($tipo == "limpa")
138 143 {return($this->selecaoLimpa());}
139 144 if ($tipo == "inverte")
... ... @@ -190,12 +195,17 @@ parameters:
190 195  
191 196 $temao - Tema que será processado.
192 197  
193   -$tipo - Tipo de operação adiciona|retira|inverte|limpa
  198 +$tipo - Tipo de operação adiciona|retira|inverte|limpa|novo
194 199 */
195 200 function selecaoTema($temao,$tipo)
196 201 {
197 202 if(!$this->layer){return "erro";}
198 203 $this->layer->set("tolerance",0);
  204 + if ($tipo == "novo")
  205 + {
  206 + $this->selecaoLimpa();
  207 + $tipo = "adiciona"
  208 + }
199 209 if ($tipo == "limpa")
200 210 {return($this->selecaoLimpa());}
201 211 if ($tipo == "inverte")
... ... @@ -353,7 +363,7 @@ deve estar no padrão utilizado pelo mapserver.
353 363  
354 364 parameters:
355 365  
356   -$tipo - Tipo de operação adiciona|retira|inverte|limpa
  366 +$tipo - Tipo de operação adiciona|retira|inverte|limpa|novo
357 367  
358 368 $item - Item que será consultado.
359 369  
... ... @@ -363,6 +373,11 @@ $valor - Valor.
363 373 */
364 374 function selecaoAtributos($tipo,$item,$operador,$valor)
365 375 {
  376 + if ($tipo == "novo")
  377 + {
  378 + $this->selecaoLimpa();
  379 + $tipo = "adiciona"
  380 + }
366 381 if ($tipo == "limpa")
367 382 {return($this->selecaoLimpa());}
368 383 if ($tipo == "inverte")
... ... @@ -435,10 +450,15 @@ $valor - Valor.
435 450  
436 451 $filtro - Expressão de seleção
437 452  
438   - $tipo - Tipo de operação adiciona|retira|inverte|limpa
  453 + $tipo - Tipo de operação adiciona|retira|inverte|limpa|novo
439 454 */
440 455 function selecaoAtributos2($filtro,$tipo)
441 456 {
  457 + if ($tipo == "novo")
  458 + {
  459 + $this->selecaoLimpa();
  460 + $tipo = "adiciona"
  461 + }
442 462 if ($tipo == "limpa")
443 463 {return($this->selecaoLimpa());}
444 464 if ($tipo == "inverte")
... ... @@ -497,10 +517,15 @@ parameters:
497 517  
498 518 $xy - X e Y separados por vírgula.
499 519  
500   -$tipo - Tipo de operação adiciona|retira|inverte|limpa
  520 +$tipo - Tipo de operação adiciona|retira|inverte|limpa|novo
501 521 */
502 522 function selecaoPT($xy,$tipo,$tolerancia)
503 523 {
  524 + if ($tipo == "novo")
  525 + {
  526 + $this->selecaoLimpa();
  527 + $tipo = "adiciona"
  528 + }
504 529 if ($tipo == "limpa")
505 530 {return ($this->selecaoLimpa());}
506 531 if ($tipo == "inverte")
... ... @@ -762,10 +787,15 @@ Seleciona por extensão geográfica.
762 787  
763 788 parameters:
764 789  
765   -$tipo - Tipo de operação adiciona|retira|inverte|limpa
  790 +$tipo - Tipo de operação adiciona|retira|inverte|limpa|novo
766 791 */
767 792 function selecaoEXT($tipo)
768 793 {
  794 + if ($tipo == "novo")
  795 + {
  796 + $this->selecaoLimpa();
  797 + $tipo = "adiciona"
  798 + }
769 799 if(!$this->layer){return "erro";}
770 800 $this->layer->set("tolerance",0);
771 801 if ($tipo == "limpa")
... ... @@ -814,12 +844,17 @@ Seleciona por retângulo.
814 844  
815 845 parameters:
816 846  
817   -$tipo - Tipo de operação adiciona|retira|inverte|limpa
  847 +$tipo - Tipo de operação adiciona|retira|inverte|limpa|novo
818 848  
819 849 $ext - coordenadas separadas por espaços no estilo xmin ymin xmax ymax
820 850 */
821 851 function selecaoBOX($tipo,$ext)
822 852 {
  853 + if ($tipo == "novo")
  854 + {
  855 + $this->selecaoLimpa();
  856 + $tipo = "adiciona"
  857 + }
823 858 if(!$this->layer){return "erro";}
824 859 $this->layer->set("tolerance",0);
825 860 if ($tipo == "limpa")
... ...
classesphp/mapa_controle.php
... ... @@ -1414,6 +1414,8 @@ Altera uma classe de um tema, aplicando uma nova classificação ou modificando pa
1414 1414 $projMapa = $m->mapa->getProjection();
1415 1415 $m->mapa->setProjection("init=epsg:4291");
1416 1416 }
  1417 + if ($opcao == "alteracor")
  1418 + {$retorno = $m->alteracor($idclasse,$cor);}
1417 1419 if ($opcao == "adicionaopacidade")
1418 1420 {$retorno = $m->adicionaopacidade();}
1419 1421 if ($opcao == "alterageometria")
... ...
classesphp/pega_variaveis.php
... ... @@ -73,24 +73,24 @@ if (isset($_POST))
73 73 {
74 74 foreach($_POST["cpaint_argument"] as $argumento_)
75 75 {
  76 +
76 77 if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN'))
77 78 {$argumento_ = str_replace("\\\"","",$argumento_);}
78 79 else
79 80 {$argumento_ = str_replace("\"","",$argumento_);}
  81 + $argumento_ = explode('"',$argumento_);
  82 + $argumento_ = implode("&",$argumento_);
80 83 $parametros_ = explode("&",$argumento_);
81 84 foreach($parametros_ as $parametro_)
82 85 {
83   - //echo $parametro_;
84 86 $p_ = explode("=",$parametro_);
85 87 $parametro = $p_[0];
86 88 $p_ = array_slice($p_, 1, count($p_));;
87 89 $valor = implode("=",$p_);
88   - //echo $valor."<br>";
89 90 if($parametro != "")
90   - eval("\$".$parametro."='".(strip_tags($valor))."';");
  91 + eval("\$".$parametro."='".(strip_tags($valor))."';");
91 92 }
92   - }
93   -
  93 + }
94 94 }
95 95 }
96 96 }
... ...
ferramentas/colorpicker/index.htm
... ... @@ -99,6 +99,10 @@ function aplicarCor()
99 99 else
100 100 {var ncor = "#"+document.getElementById("yui-picker-hex").value;}
101 101 doc.getElementById(elemento).value = ncor;
  102 + try{
  103 + doc.getElementById(elemento).onChange.call();
  104 + }
  105 + catch(e){}
102 106 window.parent.YAHOO.janelaCor.xp.panel.destroy();
103 107 }
104 108  
... ...
ferramentas/legenda/index.js.php
... ... @@ -179,6 +179,9 @@ i3GEOF.legenda = {
179 179 },
180 180 "i3GEOlegendaitens"
181 181 );
  182 + if(i3GEO.arvoreDeCamadas.pegaTema(i3GEOF.legenda.tema).classe.toLowerCase() == "nao")
  183 + {$i("i3GEOFlegendamostra").checked = false;}
  184 + $i("i3GEOFlegendamostra").onclick = function(){i3GEO.tema.invertestatuslegenda(i3GEOF.legenda.tema);};
182 185 }
183 186 catch(erro){alert(erro);}
184 187 },
... ... @@ -199,25 +202,26 @@ i3GEOF.legenda = {
199 202 ' <li><a href="#ancora"><em><div id="i3GEOlegendaguia2" style="text-align:center;left:0px;" >Classes</div></em></a></li>'+
200 203 ' <li><a href="#ancora"><em><div id="i3GEOlegendaguia3" style="text-align:center;left:0px;" >Editor</div></em></a></li>'+
201 204 ' <li><a href="#ancora"><em><div id="i3GEOlegendaguia4" style="text-align:center;left:0px;" >Gr&aacute;ficos</div></em></a></li>'+
202   - ' <li><a href="#ancora"><em><div id="i3GEOlegendaguia5" style="text-align:center;left:0px;" >Aplicar/exportar</div></em></a></li>'+
  205 + ' <li><a href="#ancora"><em><div id="i3GEOlegendaguia5" style="text-align:center;left:0px;" >Importar/exportar SLD</div></em></a></li>'+
203 206 ' </ul>'+
204 207 '</div><br>'+
205 208 '<div id=i3GEOlegendaguia1obj style="width:99%;text-align:left;">'+
  209 + ' <p class=paragrafo ><input type=checkbox onclick="" checked id=i3GEOFlegendamostra style="cursor:pointer;" /> <span style="cursor:pointer;position:relative;top:-2px;">Mostra na legenda do mapa</span>' +
206 210 ' <p class=paragrafo ><input id=i3GEOlegendabotao1 size="22" type="button" value="Aplicar alterações">'+
207   - ' <input id=i3GEOlegendabotao2 size="22" type="button" value="+ classe">' +
208   - ' <input id=i3GEOlegendabotao3 size="25" type="button" value="+ contagem">' +
209   - ' <input id=i3GEOlegendabotao15 size="25" type="button" value="Opacidade variável"></p>' +
  211 + ' <input id=i3GEOlegendabotao2 size="22" type="button" value="+ classe" title="adicionar uma nova classe na legenda" >' +
  212 + ' <input id=i3GEOlegendabotao3 size="25" type="button" value="+ contagem" title="incluir o número de ocorrências no nome de cada classe">' +
  213 + ' <input id=i3GEOlegendabotao15 size="25" type="button" value="Opacidade variável" title="aplicar opacidade nas classes existente, variando de 10 até 100"></p>' +
210 214  
211 215 ' <table summary="" class=lista5 >' +
212 216 ' <tr>' +
213   - ' <td><input id=i3GEOlegendabotao4 type="button" size=15 value="Gerar cores"></td>' +
  217 + ' <td><input id=i3GEOlegendabotao4 type="button" size=15 value="Gerar cores" title="aplicar variações de cores, entre dois extremos, nas classes existentes"></td>' +
214 218 ' <td>de:</td>' +
215 219 ' <td>' +
216 220 $inputText("","","i3GEOlegendaacori","",12,"0,0,0") +
217 221 ' <img alt="aquarela.gif" style=cursor:pointer src="'+i3GEO.configura.locaplic+'/imagens/aquarela.gif" onclick="i3GEOF.legenda.corj(\'i3GEOlegendaacori\')" /> ' +
218 222 ' </td>' +
219 223 ' <td>at&eacute;:</td><td>'+
220   - $inputText("","","i3GEOlegendaacorf","",12,"0,0,0") +
  224 + $inputText("","","i3GEOlegendaacorf","",12,"255,255,255") +
221 225 ' <img alt="aquarela.gif" style=cursor:pointer src="'+i3GEO.configura.locaplic+'/imagens/aquarela.gif" onclick="i3GEOF.legenda.corj(\'i3GEOlegendaacorf\')" /> ' +
222 226 ' </td>' +
223 227 ' </tr>' +
... ... @@ -363,12 +367,14 @@ i3GEOF.legenda = {
363 367 re,
364 368 exp;
365 369 if (retorno.data[0].proc === ""){
366   - ins.push("<table class=lista4 id=i3GEOlegendalegenda ><tr><td><img src='"+i3GEO.configura.locaplic+"/imagens/inverter.png' title='Inverter cores' onclick='i3GEOF.legenda.inverteCores()' style=cursor:pointer /></td><td style=background-color:white ><img src='"+i3GEO.configura.locaplic+"/imagens/tamanho.png' title='Calcula tamanho' onclick='i3GEOF.legenda.calculaTamanho()' style=cursor:pointer /></td><td style=background-color:yellow >nome</td><td style=background-color:yellow >express&atilde;o</td></tr>");
  370 + ins.push("<table class=lista4 id=i3GEOlegendalegenda ><tr><td><img src='"+i3GEO.configura.locaplic+"/imagens/inverter.png' title='Inverter cores' onclick='i3GEOF.legenda.inverteCores()' style=cursor:pointer /></td><td style=background-color:white ><img src='"+i3GEO.configura.locaplic+"/imagens/tamanho.png' title='Calcula tamanho' onclick='i3GEOF.legenda.calculaTamanho()' style=cursor:pointer /></td><td style=background-color:yellow ></td><td style=background-color:yellow >nome</td><td style=background-color:yellow >express&atilde;o</td></tr>");
367 371 for (i=0;i<retorno.data.length;i++){
368 372 id = retorno.data[i].tema+"-"+retorno.data[i].idclasse; //layer+indice da classe
369 373 re = new RegExp("'", "g");
370 374 exp = (retorno.data[i].expressao).replace(re,'"');
371   - ins.push("<tr><td><img style='cursor:pointer' title='clique para excluir' onclick='i3GEOF.legenda.excluilinhaf(this)' src='"+i3GEO.configura.locaplic+"/imagens/x.gif' title='excluir' /></td><td><img style='cursor:pointer' title='clique para alterar' src='"+retorno.data[i].imagem+"' onclick=i3GEOF.legenda.editaSimbolo('i3GEOlegendaid_"+id+"') /></td><td>");
  375 + ins.push("<tr><td><img style='cursor:pointer' title='clique para excluir' onclick='i3GEOF.legenda.excluilinhaf(this)' src='" + i3GEO.configura.locaplic + "/imagens/x.gif' title='excluir' /></td><td><img style='cursor:pointer' title='clique para alterar' src='"+retorno.data[i].imagem+"' onclick=i3GEOF.legenda.editaSimbolo('i3GEOlegendaid_"+id+"') /></td>");
  376 + ins.push("<td><img onclick=i3GEOF.legenda.modificaCor('"+retorno.data[i].idclasse+"') title='alterar a cor' style='cursor:pointer' src='" + i3GEO.configura.locaplic + "/imagens/aquarela.gif' /></td>");
  377 + ins.push("<td>");
372 378 ins.push($inputText("","","i3GEOlegendaid_"+id,"digite o novo nome",30,retorno.data[i].nomeclasse,"nome"));
373 379 ins.push("</td><td>");
374 380 ins.push($inputText("","","i3GEOlegendaid_"+id,"digite a nova express&atilde;o",30,exp,"expressao"));
... ... @@ -424,6 +430,41 @@ i3GEOF.legenda = {
424 430 corj: function(obj)
425 431 {i3GEO.util.abreCor("",obj);},
426 432 /*
  433 + Function: modificaCor
  434 +
  435 + Modifica a cor de uma classe
  436 + */
  437 + modificaCor: function(id){
  438 + if(!$i("tempCor")){
  439 + var obj = document.createElement("input");
  440 + obj.id = "tempCor";
  441 + obj.style.display = "none";
  442 + obj.type = "text";
  443 + obj.value = "";
  444 + document.body.appendChild(obj);
  445 + }
  446 + $i("tempCor").onChange = function(){
  447 + eval('i3GEOF.legenda.aplicaNovaCor("'+id+'");');
  448 + }
  449 + i3GEO.util.abreCor("","tempCor");
  450 + },
  451 + aplicaNovaCor: function(id){
  452 + if(i3GEOF.legenda.aguarde.visibility === "visible")
  453 + {return;}
  454 + i3GEOF.legenda.aguarde.visibility = "visible";
  455 + var retorna = function(){
  456 + i3GEO.atualiza();
  457 + i3GEO.Interface.atualizaTema("",i3GEOF.legenda.tema);
  458 + i3GEO.arvoreDeCamadas.atualizaLegenda(i3GEOF.legenda.tema);
  459 + i3GEOF.legenda.aguarde.visibility = "hidden";
  460 + i3GEOF.legenda.mostralegenda();
  461 + };
  462 + var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=alteraclasse&opcao=alteracor&tema="+i3GEOF.legenda.tema+"&idclasse="+id+"&cor="+$i("tempCor").value,
  463 + cp = new cpaint();
  464 + cp.set_response_type("JSON");
  465 + cp.call(p,"",retorna);
  466 + },
  467 + /*
427 468 Function: mudaLegenda
428 469  
429 470 Altera a legenda conforme os valores existentes na tabela de propriedades (expressão e nome da classe)
... ... @@ -481,7 +522,7 @@ i3GEOF.legenda = {
481 522 cp = new cpaint();
482 523 cp.set_transfer_mode('POST');
483 524 cp.set_response_type("JSON");
484   - cp.call(p,"alteraclassesPost",temp,"ids="+ids,"nomes="+nomes,"exps="+exps);
  525 + cp.call(p,"alteraclassesPost",temp,"ids="+ids+"&nomes="+nomes+"&exps="+exps);
485 526 }
486 527 catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}
487 528 },
... ...
ferramentas/selecao/index.js.php
... ... @@ -144,8 +144,9 @@ i3GEOF.selecao = {
144 144 ' <img onclick="i3GEOF.selecao.operacao(\'limpa\')" src="'+i3GEO.configura.locaplic+'/imagens/gisicons/erase.png" title="Limpa a selecao" style="cursor:pointer;border:1px solid RGB(230,230,230);" />' +
145 145 ' <img onclick="i3GEOF.selecao.criatema()" src="'+i3GEO.configura.locaplic+'/imagens/gisicons/save1.png" title="Salva a selecao como um novo tema" style="cursor:pointer;border:1px solid RGB(230,230,230);" />' +
146 146 ' &nbsp;<select title="Tipo de operacao" style=position:relative;top:-8px; id=i3GEOselecaotipoOperacao >' +
147   - ' <option value="adiciona" >Adicionar</option>' +
148   - ' <option value="retira" >Retirar</option>' +
  147 + ' <option value="adiciona" >Adicionar à seleção</option>' +
  148 + ' <option value="novo" >Nova seleção</option>' +
  149 + ' <option value="retira" >Retirar da seleção</option>' +
149 150 ' </select></p>' +
150 151 ' <p class=paragrafo >Temas:<div id=i3GEOselecaoComboTemas style=text-align:left; ></div>' +
151 152 ' <p class=paragrafo >Dist&acirc;ncia utilizada ao selecionar por ponto (em metros):' +
... ...