Commit b117ff29afdf852d088fb50fcecb6f09202204e3

Authored by Edmar Moretti
1 parent 58e7affa

Inclusão de opção no editor de legenda para aplicar tipos diferentes de transfor…

…mação de geometria aos estilos existentes
classesphp/classe_alteraclasse.php
... ... @@ -454,6 +454,31 @@ Adiciona opacidade variável de 0 a 100 conforme o número de classes
454 454 }
455 455 $this->layer->setMetaData("cache","");
456 456 return("ok");
  457 + }
  458 +/*
  459 +function: alterageometria
  460 +
  461 +Altera a geometria de representação de todos os estilos de todas as classes de um layer
  462 +
  463 +*/
  464 + function alterageometria($tipo)
  465 + {
  466 + error_reporting(E_ALL);
  467 + if(!$this->layer){return "erro";}
  468 + $numclasses = $this->layer->numclasses;
  469 + for($i=0;$i<$numclasses;++$i)
  470 + {
  471 + $classe = $this->layer->getclass($i);
  472 + $numestilos = $classe->numstyles;
  473 + for($j=0;$j<$numestilos;++$j)
  474 + {
  475 + $estilo = $classe->getstyle($j);
  476 + $s = "STYLE geomtransform '$tipo' END";
  477 + $estilo->updateFromString($s);
  478 + }
  479 + }
  480 + $this->layer->setMetaData("cache","");
  481 + return("ok");
457 482 }
458 483 /*
459 484 function: alteraCoresClasses
... ...
classesphp/classe_temas.php
... ... @@ -663,7 +663,6 @@ $wrap - caractere que indica quebra de linha
663 663 if($wrap != "")
664 664 {
665 665 $label->set("maxlength",1);
666   - $s = $novac->getTextString;
667 666 $s = "CLASS LABEL WRAP '$wrap' END END";
668 667 $novac->updateFromString($s);
669 668 }
... ...
classesphp/mapa_controle.php
... ... @@ -1380,7 +1380,9 @@ Altera uma classe de um tema, aplicando uma nova classificação ou modificando pa
1380 1380 $m->mapa->setProjection("init=epsg:4291");
1381 1381 }
1382 1382 if ($opcao == "adicionaopacidade")
1383   - {$retorno = $m->adicionaopacidade();}
  1383 + {$retorno = $m->adicionaopacidade();}
  1384 + if ($opcao == "alterageometria")
  1385 + {$retorno = $m->alterageometria($tipo);}
1384 1386 if ($opcao == "adicionaclasse")
1385 1387 {$retorno = $m->adicionaclasse();}
1386 1388 if ($opcao == "valorunico")
... ...
ferramentas/legenda/index.js.php
... ... @@ -153,6 +153,10 @@ i3GEOF.legenda = {
153 153 "i3GEOlegendabotao10",
154 154 {onclick:{fn: i3GEOF.legenda.aplicaEstilo}}
155 155 );
  156 + new YAHOO.widget.Button(
  157 + "i3GEOlegendabotao17",
  158 + {onclick:{fn: i3GEOF.legenda.alteraGeometriaTema}}
  159 + );
156 160 i3GEOF.legenda.ativaFoco();
157 161 i3GEOF.legenda.mostralegenda();
158 162 i3GEO.util.comboItens(
... ... @@ -213,6 +217,18 @@ i3GEOF.legenda = {
213 217 ' <p class=paragrafo style="color:red;" >Aten&ccedil;&atilde;o: para a montagem das classes s&atilde;o considerados apenas os elementos vis&iacute;veis na extens&atilde;o atual do mapa</p>'+
214 218 ' <p class=paragrafo >Ao gerar as classes, ignorar valores iguais a:'+
215 219 $inputText("","","i3GEOlegendaignorar","",10,"") +
  220 + ' <hr><p class=paragrafo >Transforma a representação geométrica dos elementos do tema. Após alterar esse parâmetro, pode ser necessário modificar as características do símbolo.</p>'+
  221 + ' <p class=paragrafo >' +
  222 + ' <select id=i3GEOlegentaTipoGeo >'+
  223 + ' <option value="">nenhuma transformação</option>'+
  224 + ' <option value="centroid">centróide</option>'+
  225 + ' <option value="bbox">box</option>'+
  226 + ' <option value="vertices">vértices</option>'+
  227 + ' <option value="start">vértice inicial</option>'+
  228 + ' <option value="end">vértice final</option>'+
  229 + ' </select>'+
  230 + ' <p class=paragrafo >' +
  231 + ' <input id=i3GEOlegendabotao17 size="35" type="button" value="Altera geometria"></p>'+
216 232 ' <hr><p class=paragrafo >Altera o tipo de representação do tema. Se for poligonal, passa para linear e vice-versa.</p>'+
217 233 ' <p class=paragrafo ><input id=i3GEOlegendabotao7 size="25" type="button" value="Altera tipo"></p>'+
218 234 ' <hr><p class=paragrafo >Todos os elementos serão desenhados com um único símbolo</p>'+
... ... @@ -452,6 +468,31 @@ i3GEOF.legenda = {
452 468 catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}
453 469 },
454 470 /*
  471 + Function: alteraGeometria
  472 +
  473 + Altera o tipo de representação geométrica dos elementos de um layer
  474 +
  475 + Veja:
  476 +
  477 + <ALTERACLASSE>
  478 + */
  479 + alteraGeometriaTema: function(){
  480 + if(i3GEOF.legenda.aguarde.visibility === "visible")
  481 + {return;}
  482 + i3GEOF.legenda.aguarde.visibility = "visible";
  483 + var retorna = function(){
  484 + i3GEO.atualiza();
  485 + i3GEO.Interface.atualizaTema("",i3GEOF.legenda.tema);
  486 + i3GEO.arvoreDeCamadas.atualizaLegenda(i3GEOF.legenda.tema);
  487 + i3GEOF.legenda.aguarde.visibility = "hidden";
  488 + i3GEOF.legenda.mostralegenda();
  489 + };
  490 + var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=alteraclasse&opcao=alterageometria&tema="+i3GEOF.legenda.tema+"&tipo="+$i("i3GEOlegentaTipoGeo").value,
  491 + cp = new cpaint();
  492 + cp.set_response_type("JSON");
  493 + cp.call(p,"",retorna);
  494 + },
  495 + /*
455 496 Function: adicionaConta
456 497  
457 498 Adiciona ao nome de cada classe o número de ocorrências em cada uma
... ...