From 11f04aae6f809a924452e57db73caa1313396365 Mon Sep 17 00:00:00 2001 From: Edmar Moretti Date: Mon, 10 Jun 2013 15:14:36 +0000 Subject: [PATCH] --- admin/php/editormapfile.php | 73 ++++++++++++++++++++++++++++++++++++++++--------------------------------- classesphp/classe_mapa.php | 76 +++++++++++++++++++++++++++++++++++++++++++++------------------------------- classesphp/classe_toponimia.php | 63 +++++++++++++++++++++++++++++++++++++++++++++------------------ 3 files changed, 130 insertions(+), 82 deletions(-) diff --git a/admin/php/editormapfile.php b/admin/php/editormapfile.php index 3d8f993..5302992 100644 --- a/admin/php/editormapfile.php +++ b/admin/php/editormapfile.php @@ -1,6 +1,6 @@ getlayerbyname($codigoLayer); $classe = $layer->getclass($indiceClasse); - $label = $classe->label; + $v = versao(); + $vi = $v["inteiro"]; + if($vi >= 60200){ + $label = $classe->getLabel(0); + } + else{ + $label = $classe->label; + } if ($label != "") { $dados["font"] = $label->font; diff --git a/classesphp/classe_mapa.php b/classesphp/classe_mapa.php index 71e2115..ad6b2f2 100644 --- a/classesphp/classe_mapa.php +++ b/classesphp/classe_mapa.php @@ -65,6 +65,14 @@ class Mapa Versão atual do Mapserver (primeiro dígito) */ public $v; + /* + Variavel: $vi + + Versão atual do Mapserver (valor inteiro) + + Returns the MapServer version number (x.y.z) as an integer (x*10000 + y*100 + z). (New in v5.0) e.g. V5.4.3 would return 50403 + */ + public $vi; /* Function: __construct @@ -76,20 +84,21 @@ $map_file - Endereço do mapfile no servidor. */ function __construct($map_file,$locaplic="") { - error_reporting(0); - if (!function_exists('ms_newMapObj')) {return false;} - if(file_exists($locaplic."/funcoes_gerais.php")) - include_once($locaplic."/funcoes_gerais.php"); - else - include_once("funcoes_gerais.php"); + error_reporting(0); + if (!function_exists('ms_newMapObj')) {return false;} + if(file_exists($locaplic."/funcoes_gerais.php")) + include_once($locaplic."/funcoes_gerais.php"); + else + include_once("funcoes_gerais.php"); $this->v = versao(); + $this->vi = $this->v["inteiro"]; $this->v = $this->v["principal"]; $this->qyfile = str_replace(".map",".qy",$map_file); - $this->locaplic = $locaplic; - if(!file_exists($map_file)) - {return $this->arquivo = false;} - if(!@ms_newMapObj($map_file)) - {return $this->mapa = false;} + $this->locaplic = $locaplic; + if(!file_exists($map_file)) + {return $this->arquivo = false;} + if(!@ms_newMapObj($map_file)) + {return $this->mapa = false;} $this->mapa = @ms_newMapObj($map_file); $this->arquivo = $map_file; $c = $this->mapa->numlayers; @@ -104,10 +113,10 @@ Method: salva Salva o mapfile atual */ - function salva() - { - if(connection_aborted()){exit();} - $this->mapa->save($this->arquivo); + function salva() + { + if(connection_aborted()){exit();} + $this->mapa->save($this->arquivo); } /* Method: listaTemasBuscaRapida @@ -141,8 +150,8 @@ Parametro: tipo {string} - OUTPUTFORMAT que será aplicado. deve existir no mapfile básico que iniciou o i3Geo */ - function mudaoutputformat($tipo) - { + function mudaoutputformat($tipo) + { foreach($this->layers as $l) {$l->setMetaData("cache","");} return $this->mapa->selectOutputFormat($tipo); @@ -176,7 +185,7 @@ Grava a imagem do mapa atual */ function gravaImagemCorpo() { - $imgo = $this->mapa->draw(); + $imgo = $this->mapa->draw(); $nome = ($imgo->imagepath).nomeRandomico().".png"; $imgo->saveImage($nome); $nome = ($imgo->imageurl).basename($nome); @@ -374,9 +383,9 @@ Include: { ms_ResetErrorList(); if(file_exists($this->locaplic."/classe_imagem.php")) - include_once($this->locaplic."/classe_imagem.php"); - else - include_once("classe_imagem.php"); + include_once($this->locaplic."/classe_imagem.php"); + else + include_once("classe_imagem.php"); $nomer = ""; $qy = file_exists($this->qyfile); if($qy) @@ -632,7 +641,7 @@ nome { foreach ($this->layers as $layer) { - if ($layer->getmetadata("ESCONDIDO") == "") + if ($layer->getmetadata("ESCONDIDO") == "") {$final[] = array("tema"=>$layer->name,"nome"=>(pegaNome($layer,"UTF-8")));} } } @@ -735,7 +744,7 @@ nome $res_count = $layer->getNumresults(); if ($res_count > 0) { - $nometmp = pegaNome($layer,"UTF-8"); + $nometmp = pegaNome($layer,"UTF-8"); $final[] = array("tema"=>$layer->name,"nome"=>$nometmp); } } @@ -887,7 +896,12 @@ $incluitexto - sim|nao $cor->setrgb($corlinha[0],$corlinha[1],$corlinha[2]); if($incluitexto == "sim") { - $label = $classe->label; + if($this->vi >= 60200){ + $label = $classe->getLabel(0); + } + else{ + $label = $classe->label; + } $label->set("size",$tamanhotexto); $label->set("type",MS_BITMAP); if ($fonte != "bitmap") @@ -1786,14 +1800,14 @@ $arq - Nome do arquivo. } function adicionaAcesso($codigo_tema,$locaplic) { - $resultado = array(); - include("$locaplic/admin/php/conexao.php"); - if(!empty($esquemaadmin)){ - $esquemaadmin = $esquemaadmin."."; - } - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geoadmin_acessostema (codigo_tema,nacessos,dia,mes,ano) VALUES ('$codigo_tema',1,".abs(date("d")).",".abs(date("m")).",".abs(date("Y")).")"); + $resultado = array(); + include("$locaplic/admin/php/conexao.php"); + if(!empty($esquemaadmin)){ + $esquemaadmin = $esquemaadmin."."; + } + $dbhw->query("INSERT INTO ".$esquemaadmin."i3geoadmin_acessostema (codigo_tema,nacessos,dia,mes,ano) VALUES ('$codigo_tema',1,".abs(date("d")).",".abs(date("m")).",".abs(date("Y")).")"); $dbh = null; - $dbhw = null; + $dbhw = null; } // //esta função não está concluida diff --git a/classesphp/classe_toponimia.php b/classesphp/classe_toponimia.php index c9e69e3..6d0c2d6 100644 --- a/classesphp/classe_toponimia.php +++ b/classesphp/classe_toponimia.php @@ -65,6 +65,20 @@ class Toponimia Nome do layer */ protected $nome; + /* + Variavel: $v + + Versão atual do Mapserver (primeiro dígito) + */ + public $v; + /* + Variavel: $vi + + Versão atual do Mapserver (valor inteiro) + + Returns the MapServer version number (x.y.z) as an integer (x*10000 + y*100 + z). (New in v5.0) e.g. V5.4.3 would return 50403 + */ + public $vi; /* function __construct @@ -77,28 +91,29 @@ $tema - nome do tema que será processado */ function __construct($map_file,$tema="",$locaplic="") { - //error_reporting(0); - if(file_exists($locaplic."/funcoes_gerais.php")) - include_once($locaplic."/funcoes_gerais.php"); - else - include_once("funcoes_gerais.php"); + //error_reporting(0); + if(file_exists($locaplic."/funcoes_gerais.php")) + include_once($locaplic."/funcoes_gerais.php"); + else + include_once("funcoes_gerais.php"); $this->v = versao(); + $this->vi = $this->v["inteiro"]; $this->v = $this->v["principal"]; - $this->mapa = ms_newMapObj($map_file); - $this->arquivo = $map_file; - if($tema != "" && @$this->mapa->getlayerbyname($tema)) - $this->layer = $this->mapa->getlayerbyname($tema); - $this->nome = $tema; + $this->mapa = ms_newMapObj($map_file); + $this->arquivo = $map_file; + if($tema != "" && @$this->mapa->getlayerbyname($tema)) + $this->layer = $this->mapa->getlayerbyname($tema); + $this->nome = $tema; } /* function: salva Salva o mapfile atual */ - function salva() - { - if (connection_aborted()){exit();} - $this->mapa->save($this->arquivo); + function salva() + { + if (connection_aborted()){exit();} + $this->mapa->save($this->arquivo); } /* function: criaToponimia @@ -198,8 +213,14 @@ Retorno: } $nclasses = $this->layer->numclasses; for ($i=0; $i < $nclasses; ++$i){ - $novac = $this->layer->getclass($i); - $label = $novac->getlabel(0); + $novac = $this->layer->getclass($i); + if($this->vi >= 60200){ + $indiceLabel = $novac->addLabel(new labelObj()); + $label = $novac->getLabel($indiceLabel); + } + else{ + $label = $novac->label; + } if($wrap != "") { $label->set("maxlength",1); @@ -207,7 +228,13 @@ Retorno: $s = "CLASS LABEL WRAP '$wrap' END END"; $novac->updateFromString($s); } - $label = $novac->label; + if($this->vi >= 60200){ + $indiceLabel = $novac->addLabel(new labelObj()); + $label = $novac->getLabel($indiceLabel); + } + else{ + $label = $novac->label; + } if ($fonte != "bitmap") { $label->set("type",MS_TRUETYPE); @@ -254,7 +281,7 @@ Retorno: $label->set("position",$p[$position]); } if ($tipo == "teste"){ - $i = gravaImagemMapa($this->mapa); + $i = gravaImagemMapa($this->mapa); return ($i["url"]); } else -- libgit2 0.21.2