Commit db0bbf15ab1386241a7db51be2a800e339289e32

Authored by Edmar Moretti
1 parent b0644b48

Inclusão de opção para alteração da cor de uma classe de um tema, diretamente na…

… opção "legenda", existente nas propriedades de um tema, na árvore de camadas
admin/admin.db
No preview for this file type
aplicmap/legenda2.htm
1   -[leg_layer_html opt_flag=1][if name=TEMA oper=neq value=NAO][/if][/leg_layer_html][leg_class_html][if name=CLASSE oper=neq value=NAO]<table><tr><td style=text-align:left colspan=2 width=42><input type=checkbox checked title=liga/desliga class=inputsb style='border: 0px solid red;cursor:pointer' value=[leg_class_index] name=[leg_layer_name] onclick='i3GEO.arvoreDeCamadas.inverteStatusClasse(this)' />&nbsp;<img src='[leg_icon width=16 height=16 ]' title='[leg_class_title]'/></td><td style=text-align:left; ><span style=font-size:9px >[leg_class_name]</span></td></tr></table>[/if][/leg_class_html]
2 1 \ No newline at end of file
  2 +[leg_layer_html opt_flag=1][if name=TEMA oper=neq value=NAO][/if][/leg_layer_html][leg_class_html][if name=CLASSE oper=neq value=NAO]<table><tr><td style=text-align:left colspan=2 width=42><input type=checkbox checked title=liga/desliga class=inputsb style='border: 0px solid red;cursor:pointer' value=[leg_class_index] name=[leg_layer_name] onclick='i3GEO.arvoreDeCamadas.inverteStatusClasse(this)' />&nbsp;<img onclick='i3GEO.arvoreDeCamadas.escolheCorClasse(this)' src='[leg_icon width=16 height=16 ]' title='Clique para alterar a cor. [leg_class_title]'/></td><td style=text-align:left; ><span style=font-size:9px >[leg_class_name]</span></td></tr></table>[/if][/leg_class_html]
3 3 \ No newline at end of file
... ...
classesjs/classe_arvoredecamadas.js
... ... @@ -1007,6 +1007,39 @@ i3GEO.arvoreDeCamadas = {
1007 1007 }
1008 1008 },
1009 1009 /*
  1010 + Function: escolheCorClasse
  1011 +
  1012 + Abre uma janela para escolher uma nova cor para o símbolo da classe.
  1013 +
  1014 + A chamada dessa função é definida em aplicmap/legenda2.htm
  1015 +
  1016 + Parametro:
  1017 +
  1018 + leg {Object input} - objeto do tipo INPUT com o id da classe e o id do tema
  1019 + */
  1020 + escolheCorClasse: function (leg){
  1021 + //cria um elemento que receberá a escolha da cor e que irá disparar a função de mudança de cor da classe
  1022 + var obj,novoel;
  1023 + leg = leg.parentNode.getElementsByTagName("input")[0];
  1024 + if(!$i("tempinputcorclasse")){
  1025 + novoel = document.createElement("input");
  1026 + novoel.id = "tempinputcorclasse";
  1027 + novoel.style.display="none";
  1028 + novoel.alt = "objeto criado para guardar dados da funcao escolohercorclasse";
  1029 + novoel.onchange = "";
  1030 + document.body.appendChild(novoel);
  1031 + }
  1032 + obj = $i("tempinputcorclasse");
  1033 + obj.value = "";
  1034 + obj.tema = leg.name;
  1035 + obj.idclasse = leg.value;
  1036 + obj.onchange = function(){
  1037 + var obj = $i("tempinputcorclasse");
  1038 + i3GEO.tema.alteracorclasse(obj.tema,obj.idclasse,obj.value);
  1039 + };
  1040 + i3GEO.util.abreCor("","tempinputcorclasse");
  1041 + },
  1042 + /*
1010 1043 Function: inverteStatusClasse
1011 1044  
1012 1045 Liga ou desliga uma classe da legenda.
... ...
classesjs/classe_php.js
... ... @@ -746,6 +746,16 @@ i3GEO.php = {
746 746 cpJSON.call(p,"invertestatuslegenda",funcao);
747 747 },
748 748 /*
  749 + Function: aplicaCorClasseTema
  750 +
  751 + <APLICACORCLASSETEMA>
  752 + */
  753 + aplicaCorClasseTema: function(funcao,idtema,idclasse,rgb){
  754 + i3GEO.php.verifica();
  755 + var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?funcao=alteraclasse&opcao=alteracor&tema="+idtema+"&idclasse="+idclasse+"&cor="+rgb+"&g_sid="+i3GEO.configura.sid;
  756 + cpJSON.call(p,"aplicaCorClasseTema",funcao);
  757 + },
  758 + /*
749 759 Function: mudatransp
750 760  
751 761 <MUDATRANSP>
... ...
classesjs/classe_tema.js
... ... @@ -260,6 +260,30 @@ i3GEO.tema = {
260 260 i3GEO.janela.abreAguarde("i3GEO.atualiza",$trad("o1"));
261 261 //i3GEO.contadorAtualiza++;
262 262 i3GEO.php.invertestatuslegenda(temp,idtema);
  263 + },
  264 + /*
  265 + Function: alteracorclasse
  266 +
  267 + Altera a cor de uma classe de um tema
  268 +
  269 + Parametros:
  270 +
  271 + idtema - código do tema
  272 +
  273 + idclasse - id da classe
  274 +
  275 + rgb - nova cor (r,g,b)
  276 + */
  277 + alteracorclasse: function(idtema,idclasse,rgb){
  278 + if(typeof(console) !== 'undefined'){console.info("i3GEO.tema.alteracorclasse()");}
  279 + i3GEO.mapa.ativaTema(idtema);
  280 + var temp = function(){
  281 + i3GEO.atualiza();
  282 + i3GEO.Interface.atualizaTema("",idtema);
  283 + i3GEO.arvoreDeCamadas.atualizaLegenda(idtema);
  284 + };
  285 + i3GEO.janela.abreAguarde("i3GEO.atualiza",$trad("o1"));
  286 + i3GEO.php.aplicaCorClasseTema(temp,idtema,idclasse,rgb);
263 287 },
264 288 /*
265 289 Function: mudanome
... ...
classesphp/classe_selecao.php
... ... @@ -84,7 +84,6 @@ $ext - extensão geográfica do mapa
84 84  
85 85 function __construct($map_file,$tema="",$ext="")
86 86 {
87   - //error_reporting(E_ALL);
88 87 $this->qyfile = str_replace(".map",".qy",$map_file);
89 88 if($tema != "")
90 89 {$this->qyfileTema = dirname($map_file)."/".$tema.".php";}
... ... @@ -137,7 +136,7 @@ $ys - lista de coordenadas y separadas por virgula
137 136 if ($tipo == "novo")
138 137 {
139 138 $this->selecaoLimpa();
140   - $tipo = "adiciona"
  139 + $tipo = "adiciona";
141 140 }
142 141 if ($tipo == "limpa")
143 142 {return($this->selecaoLimpa());}
... ... @@ -204,7 +203,7 @@ $tipo - Tipo de operação adiciona|retira|inverte|limpa|novo
204 203 if ($tipo == "novo")
205 204 {
206 205 $this->selecaoLimpa();
207   - $tipo = "adiciona"
  206 + $tipo = "adiciona";
208 207 }
209 208 if ($tipo == "limpa")
210 209 {return($this->selecaoLimpa());}
... ... @@ -376,7 +375,7 @@ $valor - Valor.
376 375 if ($tipo == "novo")
377 376 {
378 377 $this->selecaoLimpa();
379   - $tipo = "adiciona"
  378 + $tipo = "adiciona";
380 379 }
381 380 if ($tipo == "limpa")
382 381 {return($this->selecaoLimpa());}
... ... @@ -457,7 +456,7 @@ $valor - Valor.
457 456 if ($tipo == "novo")
458 457 {
459 458 $this->selecaoLimpa();
460   - $tipo = "adiciona"
  459 + $tipo = "adiciona";
461 460 }
462 461 if ($tipo == "limpa")
463 462 {return($this->selecaoLimpa());}
... ... @@ -524,27 +523,13 @@ $tipo - Tipo de operação adiciona|retira|inverte|limpa|novo
524 523 if ($tipo == "novo")
525 524 {
526 525 $this->selecaoLimpa();
527   - $tipo = "adiciona"
  526 + $tipo = "adiciona";
528 527 }
529 528 if ($tipo == "limpa")
530 529 {return ($this->selecaoLimpa());}
531 530 if ($tipo == "inverte")
532 531 {return ($this->selecaoInverte());}
533 532 if(!$this->layer){return "erro";}
534   - /*
535   - $shp_atual = array();
536   - if (file_exists($this->qyfile))
537   - {$this->mapa->loadquery($this->qyfile);}
538   - $indxlayer = $this->layer->index;
539   - $res_count = $this->layer->getNumresults();
540   - $shp_atual = array();
541   - for ($i = 0; $i < $res_count;++$i)
542   - {
543   - $rc = $this->layer->getResult($i);
544   - $shp_atual[] = $rc->shapeindex;
545   - }
546   - $this->mapa->freequery($indxlayer);
547   - */
548 533 $shp_atual = array();
549 534 if($this->qyfileTema != "" && file_exists($this->qyfileTema))
550 535 {$shp_atual = $this->unserializeQ($this->qyfileTema);}
... ... @@ -794,7 +779,7 @@ $tipo - Tipo de operação adiciona|retira|inverte|limpa|novo
794 779 if ($tipo == "novo")
795 780 {
796 781 $this->selecaoLimpa();
797   - $tipo = "adiciona"
  782 + $tipo = "adiciona";
798 783 }
799 784 if(!$this->layer){return "erro";}
800 785 $this->layer->set("tolerance",0);
... ... @@ -853,7 +838,7 @@ $ext - coordenadas separadas por espaços no estilo xmin ymin xmax ymax
853 838 if ($tipo == "novo")
854 839 {
855 840 $this->selecaoLimpa();
856   - $tipo = "adiciona"
  841 + $tipo = "adiciona";
857 842 }
858 843 if(!$this->layer){return "erro";}
859 844 $this->layer->set("tolerance",0);
... ...
classesphp/mapa_controle.php
... ... @@ -2617,7 +2617,7 @@ Seleciona elementos utilizando um retângulo.
2617 2617 $temas = explode(",",$tema);
2618 2618 foreach($temas as $tema)
2619 2619 {
2620   - $m = new Selecao($map_file,$tema);
  2620 + $m = new Selecao($map_file,$tema,$ext);
2621 2621 if($interface == "googlemaps")
2622 2622 {
2623 2623 $projMapa = $m->mapa->getProjection();
... ... @@ -2625,7 +2625,6 @@ Seleciona elementos utilizando um retângulo.
2625 2625 }
2626 2626 $ok[] = $m->selecaoBOX($tipo,$ext);
2627 2627 }
2628   -
2629 2628 redesenhaMapa();
2630 2629 break;
2631 2630  
... ...
ferramentas/legenda/index.js.php
... ... @@ -494,10 +494,7 @@ i3GEOF.legenda = {
494 494 i3GEOF.legenda.aguarde.visibility = "hidden";
495 495 i3GEOF.legenda.mostralegenda();
496 496 };
497   - 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,
498   - cp = new cpaint();
499   - cp.set_response_type("JSON");
500   - cp.call(p,"",retorna);
  497 + i3GEO.php.aplicaCorClasseTema(retorna,i3GEOF.legenda.tema,id,$i("tempCor").value);
501 498 },
502 499 /*
503 500 Function: mudaLegenda
... ...
ferramentas/selecao/index.js.php
... ... @@ -143,7 +143,7 @@ i3GEOF.selecao = {
143 143 ' <img onclick="i3GEOF.selecao.operacao(\'inverte\')" src="'+i3GEO.configura.locaplic+'/imagens/gisicons/undo.png" title="Inverte a selecao" style="cursor:pointer;border:1px solid RGB(230,230,230);" />' +
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   - ' &nbsp;<select title="Tipo de operacao" style=position:relative;top:-8px; id=i3GEOselecaotipoOperacao >' +
  146 + ' <br><select title="Tipo de operacao" style=position:relative;top:6px; id=i3GEOselecaotipoOperacao >' +
147 147 ' <option value="adiciona" >Adicionar à seleção</option>' +
148 148 ' <option value="novo" >Nova seleção</option>' +
149 149 ' <option value="retira" >Retirar da seleção</option>' +
... ...
temas/teste.map 0 → 100644
... ... @@ -0,0 +1,23 @@
  1 +MAP
  2 +SYMBOLSET ../symbols/simbolos.sym
  3 +FONTSET "../symbols/fontes.txt"
  4 +LAYER
  5 + NAME "teste"
  6 + TYPE RASTER
  7 + STATUS ON
  8 + CONNECTION "http://172.30.24.8:8080/geoserver/wms?"
  9 +
  10 + CONNECTIONTYPE WMS
  11 + METADATA
  12 + "TEMA" "Campo Quadra"
  13 + "extensao" "-44 -23 -39 -21"
  14 + "aplicaextensao" "SIM"
  15 + "wms_srs" "EPSG:4326"
  16 + "wms_name" "IBGE:REBIO_campo_quadra"
  17 + "wms_server_version" "1.1.1"
  18 + "wms_format" "image/png"
  19 + "legendawms" "http://172.30.24.8:8080/geoserver/wms?service=WMS&service=wms&request=getlegendgraphic&version=1.1.1&service=wms&layer=IBGE:REBIO_campo_quadra&format=image/png"
  20 + "wms_feature_info_type" "text/html"
  21 + END
  22 + END
  23 +END
0 24 \ No newline at end of file
... ...