Commit e73432a535a6489b83221505cdd74dba27fe0a5f
1 parent
ddea3d82
Exists in
master
and in
7 other branches
--no commit message
Showing
2 changed files
with
33 additions
and
33 deletions
Show diff stats
classesphp/classe_legenda.php
@@ -24,7 +24,7 @@ Este programa é distribuído na expectativa de que seja útil | @@ -24,7 +24,7 @@ Este programa é distribuído na expectativa de que seja útil | ||
24 | porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | 24 | porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita |
25 | de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | 25 | de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. |
26 | Consulte a Licença Pública Geral do GNU para mais detalhes. | 26 | Consulte a Licença Pública Geral do GNU para mais detalhes. |
27 | -Você deve ter recebido uma cópia da Licença Pública Geral do | 27 | +Você deve ter recebido uma c�pia da Licença Pública Geral do |
28 | GNU junto com este programa; se não, escreva para a | 28 | GNU junto com este programa; se não, escreva para a |
29 | Free Software Foundation, Inc., no endereço | 29 | Free Software Foundation, Inc., no endereço |
30 | 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | 30 | 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. |
@@ -167,14 +167,14 @@ Salva o mapfile atual | @@ -167,14 +167,14 @@ Salva o mapfile atual | ||
167 | */ | 167 | */ |
168 | function salva() | 168 | function salva() |
169 | { | 169 | { |
170 | - if (connection_aborted()){exit();} | ||
171 | - $this->recalculaSLD(); | 170 | + if (connection_aborted()){exit();} |
171 | + $this->recalculaSLD(); | ||
172 | $this->mapa->save($this->arquivo); | 172 | $this->mapa->save($this->arquivo); |
173 | } | 173 | } |
174 | /* | 174 | /* |
175 | function: recalculaSLD | 175 | function: recalculaSLD |
176 | 176 | ||
177 | -Constrói o SLD que é aplicado ao metadata wms_sld_body. O SLD resultante é baseado nas definições das classes existentes no layer | 177 | +Constr�i o SLD que é aplicado ao metadata wms_sld_body. O SLD resultante é baseado nas definições das classes existentes no layer |
178 | */ | 178 | */ |
179 | function recalculaSLD(){ | 179 | function recalculaSLD(){ |
180 | if($this->layer->classitem != "" && $this->layer->connectiontype == 7 && $this->layer->numclasses > 0){ | 180 | if($this->layer->classitem != "" && $this->layer->connectiontype == 7 && $this->layer->numclasses > 0){ |
@@ -300,8 +300,7 @@ array | @@ -300,8 +300,7 @@ array | ||
300 | function tabelaLegenda($totaliza="nao") | 300 | function tabelaLegenda($totaliza="nao") |
301 | { | 301 | { |
302 | $linhas = array(); | 302 | $linhas = array(); |
303 | - foreach ($this->visiveis as $l) | ||
304 | - { | 303 | + foreach ($this->visiveis as $l){ |
305 | $layer = $this->mapa->getlayerbyname($l); | 304 | $layer = $this->mapa->getlayerbyname($l); |
306 | //verifica se é wms ou wfs | 305 | //verifica se é wms ou wfs |
307 | $c = $layer->connectiontype; | 306 | $c = $layer->connectiontype; |
@@ -344,8 +343,7 @@ array | @@ -344,8 +343,7 @@ array | ||
344 | } | 343 | } |
345 | else | 344 | else |
346 | { | 345 | { |
347 | - for ($c = 0;$c < $nc;$c++) | ||
348 | - { | 346 | + for ($c = 0;$c < $nc;$c++){ |
349 | $classe = $layer->getclass($c); | 347 | $classe = $layer->getclass($c); |
350 | $imgi = $classe->createlegendicon(30,15); | 348 | $imgi = $classe->createlegendicon(30,15); |
351 | $classe->drawlegendicon(30,15,$imgi,5,5); | 349 | $classe->drawlegendicon(30,15,$imgi,5,5); |
@@ -361,21 +359,18 @@ array | @@ -361,21 +359,18 @@ array | ||
361 | {$nomeexp = mb_convert_encoding($nomeexp,"UTF-8","ISO-8859-1");} | 359 | {$nomeexp = mb_convert_encoding($nomeexp,"UTF-8","ISO-8859-1");} |
362 | $linhas[] = array("tema"=>$l,"idclasse"=>$c,"nomeclasse"=>$nomeclasse,"expressao"=>$nomeexp,"imagem"=>$i,"proc"=>""); | 360 | $linhas[] = array("tema"=>$l,"idclasse"=>$c,"nomeclasse"=>$nomeclasse,"expressao"=>$nomeexp,"imagem"=>$i,"proc"=>""); |
363 | } | 361 | } |
364 | - if (($totaliza=="sim") && ($nc > 1)) | ||
365 | - { | 362 | + if (($totaliza=="sim") && ($nc > 1)){ |
366 | $layer->set("template","none.htm"); | 363 | $layer->set("template","none.htm"); |
367 | $sopen = $layer->open(); | 364 | $sopen = $layer->open(); |
368 | if($sopen == MS_FAILURE){return "erro";} | 365 | if($sopen == MS_FAILURE){return "erro";} |
369 | $itens = $layer->getitems(); | 366 | $itens = $layer->getitems(); |
370 | $total = 0; | 367 | $total = 0; |
371 | $nreg = array(); | 368 | $nreg = array(); |
372 | - for ($c = 0;$c < $nc;$c++) | ||
373 | - { | ||
374 | - $exp = $linhas[$c]["expressao"]; | ||
375 | - if($exp !== "") | ||
376 | - { | ||
377 | - if($this->layer->connectiontype == MS_POSTGIS) | ||
378 | - { | 369 | + for ($c = 0;$c < $nc;$c++){ |
370 | + $exp = $linhas[$c]; | ||
371 | + $exp = $exp["expressao"]; | ||
372 | + if($exp !== ""){ | ||
373 | + if($this->layer->connectiontype == MS_POSTGIS){ | ||
379 | $exp = str_replace("eq"," = ",$exp); | 374 | $exp = str_replace("eq"," = ",$exp); |
380 | $exp = str_replace("ne"," != ",$exp); | 375 | $exp = str_replace("ne"," != ",$exp); |
381 | $exp = str_replace("lt"," < ",$exp); | 376 | $exp = str_replace("lt"," < ",$exp); |
@@ -393,31 +388,35 @@ array | @@ -393,31 +388,35 @@ array | ||
393 | } | 388 | } |
394 | $teste = $layer->queryByAttributes($itens[0], $exp, 1); | 389 | $teste = $layer->queryByAttributes($itens[0], $exp, 1); |
395 | } | 390 | } |
396 | - else | ||
397 | - {$teste = 0;} | ||
398 | - if ($teste == 0) | ||
399 | - { | 391 | + else{ |
392 | + $teste = 0; | ||
393 | + } | ||
394 | + if ($teste == 0){ | ||
400 | $n = $layer->getNumResults(); | 395 | $n = $layer->getNumResults(); |
401 | $nreg[] = $n; | 396 | $nreg[] = $n; |
402 | } | 397 | } |
403 | - else {$nreg[] = "erro";} | 398 | + else { |
399 | + $nreg[] = "erro"; | ||
400 | + } | ||
404 | $total = $total + $n; | 401 | $total = $total + $n; |
405 | } | 402 | } |
406 | $layer->close(); | 403 | $layer->close(); |
407 | - for ($c = 0;$c < $nc;$c++) | ||
408 | - { | ||
409 | - $linhas[$c]["nomeclasse"] = $linhas[$c]["nomeclasse"]." - n=".$nreg[$c]."(".(round(($nreg[$c] * 100 / $total)))."%)"; | 404 | + for ($c = 0;$c < $nc;$c++){ |
405 | + $classe = $layer->getclass($c); | ||
406 | + $nome = $linhas[$c]["nomeclasse"]." - n=".$nreg[$c]."(".(round(($nreg[$c] * 100 / $total)))."%)"; | ||
407 | + $classe->set("name",$nome); | ||
408 | + $linhas[$c]["nomeclasse"] = $nome; | ||
410 | $linhas[$c]["nreg"] = $nreg[$c]; | 409 | $linhas[$c]["nreg"] = $nreg[$c]; |
411 | $linhas[$c]["totalreg"] = $total; | 410 | $linhas[$c]["totalreg"] = $total; |
412 | } | 411 | } |
413 | } | 412 | } |
414 | - if ($layer->type == MS_LAYER_RASTER && $nc == 1) | ||
415 | - { | 413 | + if ($layer->type == MS_LAYER_RASTER && $nc == 1){ |
416 | $proc = ""; | 414 | $proc = ""; |
417 | $linhas = array(); | 415 | $linhas = array(); |
418 | - if($layer->num_processing > 0){$proc = $layer->getProcessing();} | ||
419 | - if($layer->type == MS_LAYER_RASTER && $proc == "") | ||
420 | - { | 416 | + if($layer->num_processing > 0){ |
417 | + $proc = $layer->getProcessing(); | ||
418 | + } | ||
419 | + if($layer->type == MS_LAYER_RASTER && $proc == ""){ | ||
421 | $proc = array("RESAMPLE=NEAREST"); | 420 | $proc = array("RESAMPLE=NEAREST"); |
422 | } | 421 | } |
423 | $linhas[] = array("tema"=>$l,"idclasse"=>"","nomeclasse"=>"","expressao"=>"","imagem"=>"","proc"=>$proc); | 422 | $linhas[] = array("tema"=>$l,"idclasse"=>"","nomeclasse"=>"","expressao"=>"","imagem"=>"","proc"=>$proc); |
@@ -503,9 +502,9 @@ parameters: | @@ -503,9 +502,9 @@ parameters: | ||
503 | 502 | ||
504 | $tipo - Tipo de representação do símbolo, 0 pontos, 1 linhas e 2 polígonos. | 503 | $tipo - Tipo de representação do símbolo, 0 pontos, 1 linhas e 2 polígonos. |
505 | 504 | ||
506 | -$dir_tmp - Diretório temporário do mapserver. | 505 | +$dir_tmp - Diret�rio temporário do mapserver. |
507 | 506 | ||
508 | -$imgdir - Diretório temporário das imagens. | 507 | +$imgdir - Diret�rio temporário das imagens. |
509 | 508 | ||
510 | $onclick - Função que será incluída no HTML no evento onclick sobre o símbolo | 509 | $onclick - Função que será incluída no HTML no evento onclick sobre o símbolo |
511 | 510 | ||
@@ -832,7 +831,7 @@ $width | @@ -832,7 +831,7 @@ $width | ||
832 | 831 | ||
833 | $map_file {string} - arquivo map_file | 832 | $map_file {string} - arquivo map_file |
834 | 833 | ||
835 | - $tema {string} - código do tema | 834 | + $tema {string} - c�digo do tema |
836 | 835 | ||
837 | $sld {string} - arquivo onde o sld será gravado | 836 | $sld {string} - arquivo onde o sld será gravado |
838 | */ | 837 | */ |
ferramentas/legenda/exec.php
@@ -80,6 +80,7 @@ Acrescenta a contagem de elementos em cada classe. | @@ -80,6 +80,7 @@ Acrescenta a contagem de elementos em cada classe. | ||
80 | include_once(dirname(__FILE__)."/../../classesphp/classe_legenda.php"); | 80 | include_once(dirname(__FILE__)."/../../classesphp/classe_legenda.php"); |
81 | $m = new Legenda($map_file,$locaplic,$tema); | 81 | $m = new Legenda($map_file,$locaplic,$tema); |
82 | $r = $m->tabelaLegenda("sim"); | 82 | $r = $m->tabelaLegenda("sim"); |
83 | + $m->salva(); | ||
83 | if (!$r){$r = "erro.Erro legenda nao disponivel";} | 84 | if (!$r){$r = "erro.Erro legenda nao disponivel";} |
84 | $retorno = $r; | 85 | $retorno = $r; |
85 | break; | 86 | break; |