From e73432a535a6489b83221505cdd74dba27fe0a5f Mon Sep 17 00:00:00 2001 From: Edmar Moretti Date: Tue, 18 Mar 2014 01:35:26 +0000 Subject: [PATCH] --- classesphp/classe_legenda.php | 65 ++++++++++++++++++++++++++++++++--------------------------------- ferramentas/legenda/exec.php | 1 + 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/classesphp/classe_legenda.php b/classesphp/classe_legenda.php index f318920..3822096 100644 --- a/classesphp/classe_legenda.php +++ b/classesphp/classe_legenda.php @@ -24,7 +24,7 @@ Este programa é distribuído na expectativa de que seja útil porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral do GNU para mais detalhes. -Você deve ter recebido uma cópia da Licença Pública Geral do +Você deve ter recebido uma c�pia da Licença Pública Geral do GNU junto com este programa; se não, escreva para a Free Software Foundation, Inc., no endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. @@ -167,14 +167,14 @@ Salva o mapfile atual */ function salva() { - if (connection_aborted()){exit();} - $this->recalculaSLD(); + if (connection_aborted()){exit();} + $this->recalculaSLD(); $this->mapa->save($this->arquivo); } /* function: recalculaSLD -Constrói o SLD que é aplicado ao metadata wms_sld_body. O SLD resultante é baseado nas definições das classes existentes no layer +Constr�i o SLD que é aplicado ao metadata wms_sld_body. O SLD resultante é baseado nas definições das classes existentes no layer */ function recalculaSLD(){ if($this->layer->classitem != "" && $this->layer->connectiontype == 7 && $this->layer->numclasses > 0){ @@ -300,8 +300,7 @@ array function tabelaLegenda($totaliza="nao") { $linhas = array(); - foreach ($this->visiveis as $l) - { + foreach ($this->visiveis as $l){ $layer = $this->mapa->getlayerbyname($l); //verifica se é wms ou wfs $c = $layer->connectiontype; @@ -344,8 +343,7 @@ array } else { - for ($c = 0;$c < $nc;$c++) - { + for ($c = 0;$c < $nc;$c++){ $classe = $layer->getclass($c); $imgi = $classe->createlegendicon(30,15); $classe->drawlegendicon(30,15,$imgi,5,5); @@ -361,21 +359,18 @@ array {$nomeexp = mb_convert_encoding($nomeexp,"UTF-8","ISO-8859-1");} $linhas[] = array("tema"=>$l,"idclasse"=>$c,"nomeclasse"=>$nomeclasse,"expressao"=>$nomeexp,"imagem"=>$i,"proc"=>""); } - if (($totaliza=="sim") && ($nc > 1)) - { + if (($totaliza=="sim") && ($nc > 1)){ $layer->set("template","none.htm"); $sopen = $layer->open(); if($sopen == MS_FAILURE){return "erro";} $itens = $layer->getitems(); $total = 0; $nreg = array(); - for ($c = 0;$c < $nc;$c++) - { - $exp = $linhas[$c]["expressao"]; - if($exp !== "") - { - if($this->layer->connectiontype == MS_POSTGIS) - { + for ($c = 0;$c < $nc;$c++){ + $exp = $linhas[$c]; + $exp = $exp["expressao"]; + if($exp !== ""){ + if($this->layer->connectiontype == MS_POSTGIS){ $exp = str_replace("eq"," = ",$exp); $exp = str_replace("ne"," != ",$exp); $exp = str_replace("lt"," < ",$exp); @@ -393,31 +388,35 @@ array } $teste = $layer->queryByAttributes($itens[0], $exp, 1); } - else - {$teste = 0;} - if ($teste == 0) - { + else{ + $teste = 0; + } + if ($teste == 0){ $n = $layer->getNumResults(); $nreg[] = $n; } - else {$nreg[] = "erro";} + else { + $nreg[] = "erro"; + } $total = $total + $n; } $layer->close(); - for ($c = 0;$c < $nc;$c++) - { - $linhas[$c]["nomeclasse"] = $linhas[$c]["nomeclasse"]." - n=".$nreg[$c]."(".(round(($nreg[$c] * 100 / $total)))."%)"; + for ($c = 0;$c < $nc;$c++){ + $classe = $layer->getclass($c); + $nome = $linhas[$c]["nomeclasse"]." - n=".$nreg[$c]."(".(round(($nreg[$c] * 100 / $total)))."%)"; + $classe->set("name",$nome); + $linhas[$c]["nomeclasse"] = $nome; $linhas[$c]["nreg"] = $nreg[$c]; $linhas[$c]["totalreg"] = $total; } } - if ($layer->type == MS_LAYER_RASTER && $nc == 1) - { + if ($layer->type == MS_LAYER_RASTER && $nc == 1){ $proc = ""; $linhas = array(); - if($layer->num_processing > 0){$proc = $layer->getProcessing();} - if($layer->type == MS_LAYER_RASTER && $proc == "") - { + if($layer->num_processing > 0){ + $proc = $layer->getProcessing(); + } + if($layer->type == MS_LAYER_RASTER && $proc == ""){ $proc = array("RESAMPLE=NEAREST"); } $linhas[] = array("tema"=>$l,"idclasse"=>"","nomeclasse"=>"","expressao"=>"","imagem"=>"","proc"=>$proc); @@ -503,9 +502,9 @@ parameters: $tipo - Tipo de representação do símbolo, 0 pontos, 1 linhas e 2 polígonos. -$dir_tmp - Diretório temporário do mapserver. +$dir_tmp - Diret�rio temporário do mapserver. -$imgdir - Diretório temporário das imagens. +$imgdir - Diret�rio temporário das imagens. $onclick - Função que será incluída no HTML no evento onclick sobre o símbolo @@ -832,7 +831,7 @@ $width $map_file {string} - arquivo map_file - $tema {string} - código do tema + $tema {string} - c�digo do tema $sld {string} - arquivo onde o sld será gravado */ diff --git a/ferramentas/legenda/exec.php b/ferramentas/legenda/exec.php index ac9c8c2..d1a0068 100644 --- a/ferramentas/legenda/exec.php +++ b/ferramentas/legenda/exec.php @@ -80,6 +80,7 @@ Acrescenta a contagem de elementos em cada classe. include_once(dirname(__FILE__)."/../../classesphp/classe_legenda.php"); $m = new Legenda($map_file,$locaplic,$tema); $r = $m->tabelaLegenda("sim"); + $m->salva(); if (!$r){$r = "erro.Erro legenda nao disponivel";} $retorno = $r; break; -- libgit2 0.21.2