Commit 521b40f313770f181415baae9f89b73609fd93fc

Authored by Edmar Moretti
1 parent b6480661

Opção de cluster na ferramenta Legenda

admin/admin.db
No preview for this file type
classesphp/classe_alteraclasse.php
... ... @@ -148,8 +148,7 @@ class Alteraclasse
148 148 return "erro";
149 149 }
150 150 $numclasses = $this->layer->numclasses;
151   - if ($numclasses > 0)
152   - {
  151 + if ($numclasses > 0){
153 152 //elimina a expressão da primeira classe
154 153 $classe0 = $this->layer->getClass(0);
155 154 //echo "<pre>";var_dump($classe0);exit;
... ... @@ -162,6 +161,16 @@ class Alteraclasse
162 161 $classe->set("status",MS_DELETE);
163 162 }
164 163 }
  164 + else{
  165 + $classe = ms_newClassObj($this->layer);
  166 + $novoestilo = ms_newStyleObj($classe);
  167 + if ($this->layer->type == 0){
  168 + $novoestilo->set("symbolname","ponto");
  169 + $novoestilo->set("size","6");
  170 + }
  171 + $cor = $novoestilo->color;
  172 + $cor->setRGB(255,100,100);
  173 + }
165 174 $this->layer->setMetaData("cache","");
166 175 return("ok");
167 176 }
... ... @@ -195,6 +204,7 @@ class Alteraclasse
195 204 $ids = explode(";",$ids);
196 205 $minScales = explode(";",$minScales);
197 206 $maxScales = explode(";",$maxScales);
  207 +
198 208 $nomes = $this->converteTexto($nomes);
199 209 $nomes = explode(";",$nomes);
200 210 //$exps = mb_convert_encoding($exps,"ISO-8859-1","UTF-8");
... ... @@ -210,12 +220,13 @@ class Alteraclasse
210 220 //elimina as classes existentes atualmente em cada layer
211 221 foreach ($t as $tema){
212 222 $layer = $this->mapa->getlayerbyname($tema);
213   - $layer->setMetaData("cache","");
  223 + $layer->setmetadata("cache","");
214 224 $nc = $layer->numclasses;
215   - for($i=0;$i < $nc;++$i)
216   - {
217   - $class = $layer->getclass($i);
218   - $class->set("status",MS_DELETE);
  225 + if($nc > 0){
  226 + for($i=0;$i < $nc;++$i){
  227 + $class = $layer->getclass($i);
  228 + $class->set("status",MS_DELETE);
  229 + }
219 230 }
220 231 }
221 232 //acrescenta as classes definidas
... ...
classesphp/classe_legenda.php
... ... @@ -749,7 +749,12 @@ class Legenda
749 749 $linha[] = corRGB($estilo->backgroundcolor);
750 750 $linha[] = corRGB($estilo->color);
751 751 $linha[] = $estilo->symbolname;
752   - $linha[] = $estilo->size;
  752 + if($estilo->getbinding(MS_STYLE_BINDING_SIZE)){
  753 + $linha[] = $estilo->getbinding(MS_STYLE_BINDING_SIZE);
  754 + }
  755 + else{
  756 + $linha[] = $estilo->size;
  757 + }
753 758 $linha[] = $estilo->opacity;
754 759 if($this->v >= 6){
755 760 $linha[] = $estilo->width;
... ... @@ -842,7 +847,13 @@ class Legenda
842 847 }
843 848 if ((isset ($size)) && ($size != "-1"))
844 849 {
845   - $estilo->set("size",$size);
  850 + if(is_numeric($size)){
  851 + $estilo->removebinding(MS_STYLE_BINDING_SIZE);
  852 + $estilo->set("size",$size);
  853 + }
  854 + else{
  855 + $estilo->setbinding(MS_STYLE_BINDING_SIZE, $size);
  856 + }
846 857 }
847 858 if ((isset ($width)) && ($width != "-1") && ($this->v >= 6))
848 859 {
... ... @@ -1096,13 +1107,19 @@ class Legenda
1096 1107 $cor->setRGB($nc[0],$nc[1],$nc[2]);
1097 1108 continue;
1098 1109 case "color":
1099   - $cor = $estilo->color;
1100   - $nc = explode(",",$valor);
1101   - $cor->setRGB($nc[0],$nc[1],$nc[2]);
  1110 + $cor = $estilo->color;
  1111 + $nc = explode(",",$valor);
  1112 + $cor->setRGB($nc[0],$nc[1],$nc[2]);
1102 1113 continue;
1103 1114 case "size":
1104   - $estilo->set("size",$valor);
1105   - break;
  1115 + if(is_numeric($valor)){
  1116 + $estilo->removebinding(MS_STYLE_BINDING_SIZE);
  1117 + $estilo->set("size",$valor);
  1118 + }
  1119 + else{
  1120 + $estilo->setbinding(MS_STYLE_BINDING_SIZE, $valor);
  1121 + }
  1122 + continue;
1106 1123 case "width":
1107 1124 $estilo->set("width",$valor);
1108 1125 continue;
... ...
classesphp/classe_temas.php
... ... @@ -1312,7 +1312,24 @@ Adiciona LABEL em uma classe de um tema
1312 1312 $cluster->updateFromString("CLUSTER $par END");
1313 1313 $this->layer->setMetaData("cache","");
1314 1314 $this->layer->setMetadata("tiles","NAO");
1315   - $this->layer->setMetadata("cortepixels",0);
  1315 + $this->layer->setMetadata("cortepixels",0);
  1316 + //apaga as classes pois nao fazem mais sentido
  1317 + if($group == ""){
  1318 + $numclasses = $this->layer->numclasses;
  1319 + if ($numclasses > 0){
  1320 + for ($i=0; $i < $numclasses; ++$i)
  1321 + {
  1322 + $classe = $this->layer->getClass($i);
  1323 + $classe->set("status",MS_DELETE);
  1324 + }
  1325 + }
  1326 + $classe = ms_newClassObj($this->layer);
  1327 + $novoestilo = ms_newStyleObj($classe);
  1328 + $novoestilo->set("size",6);
  1329 + $novoestilo->set("symbolname","ponto");
  1330 + $cor = $novoestilo->color;
  1331 + $cor->setRGB(255,100,100);
  1332 + }
1316 1333 }
1317 1334 function removeCluster(){
1318 1335 $cluster = $this->layer->cluster;
... ... @@ -1320,6 +1337,18 @@ Adiciona LABEL em uma classe de um tema
1320 1337 $this->layer->setMetaData("cache","");
1321 1338 $this->layer->setMetadata("tiles","NAO");
1322 1339 $this->layer->setMetadata("cortepixels",0);
  1340 + $numclasses = $this->layer->numclasses;
  1341 + if ($numclasses > 0){
  1342 + for ($i=0; $i < $numclasses; ++$i)
  1343 + {
  1344 + $classe = $this->layer->getClass($i);
  1345 + $numestilos = $classe->numstyles;
  1346 + for($j=0;$j<$numestilos;++$j){
  1347 + $estilo = $classe->getstyle($j);
  1348 + $estilo->removebinding(MS_STYLE_BINDING_SIZE);
  1349 + }
  1350 + }
  1351 + }
1323 1352 }
1324 1353 }
1325 1354 ?>
... ...
ferramentas/legenda/index.js
... ... @@ -1826,6 +1826,7 @@ i3GEOF.legenda =
1826 1826 + linha[6]
1827 1827 + "' id='i3GEOlegendasizes' />"
1828 1828 + "</form></div>"
  1829 + + "<div class='styled-select' id='i3GEOlegendaComboSize'></div>"
1829 1830  
1830 1831 + "<br><img style='float:left;' onclick='i3GEOF.legenda.aplicaTodasClasses(\"width\",\"i3GEOlegendawidth\")' title='"
1831 1832 + $trad('aplicatodos', i3GEOF.legenda.dicionario)
... ... @@ -1974,6 +1975,13 @@ i3GEOF.legenda =
1974 1975 + "</form></div>";
1975 1976  
1976 1977 $i("i3GEOlegendaParametrosEstilos").innerHTML = d;
  1978 + //preenche as listas de itens
  1979 + i3GEO.util.comboItens("", i3GEOF.legenda.tema, function(retorno) {
  1980 + if ($i("i3GEOlegendaComboSize")) {
  1981 + $i("i3GEOlegendaComboSize").innerHTML = retorno.dados.replace("id=''"," onchange='$i(\"i3GEOlegendasizes\").value = this.value'");
  1982 + }
  1983 + });
  1984 +
1977 1985 i3GEO.util.aplicaAquarela("i3GEOlegendaParametrosEstilos");
1978 1986 p =
1979 1987 i3GEO.configura.locaplic + "/classesphp/mapa_controle.php?g_sid="
... ...