Commit da1bdde50d006d7ed3832a801a10f06fc11f0394

Authored by Edmar Moretti
1 parent a2a1fa6e

Corrige o uso de label em versões do Mapserver >= 6.2

Showing 1 changed file with 34 additions and 19 deletions   Show diff stats
classesphp/classe_temas.php
... ... @@ -92,6 +92,15 @@ class Temas
92 92 Versão atual do Mapserver (primeiro dígito)
93 93 */
94 94 public $v;
  95 + /*
  96 + Variavel: $vi
  97 +
  98 + Versão atual do Mapserver (valor inteiro)
  99 +
  100 + 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
  101 + */
  102 + public $vi;
  103 +
95 104 /*
96 105 function __construct
97 106  
... ... @@ -108,17 +117,18 @@ $ext - (opcional) extensão geográfica que será aplicada ao
108 117 */
109 118 function __construct($map_file,$tema=null,$locaplic="",$ext="")
110 119 {
111   - //error_reporting(0);
  120 + //error_reporting(0);
112 121 $this->qyfile = str_replace(".map",".qy",$map_file);
113 122 $this->arquivo = $map_file;
114   - if(file_exists($locaplic."/funcoes_gerais.php"))
115   - include_once($locaplic."/funcoes_gerais.php");
116   - else
117   - include_once("funcoes_gerais.php");
  123 + if(file_exists($locaplic."/funcoes_gerais.php"))
  124 + include_once($locaplic."/funcoes_gerais.php");
  125 + else
  126 + include_once("funcoes_gerais.php");
118 127 $this->v = versao();
119 128 $this->v = $this->v["principal"];
120   - $this->locaplic = $locaplic;
121   - if($map_file != "")
  129 + $this->vi = $this->vi["inteiro"];
  130 + $this->locaplic = $locaplic;
  131 + if($map_file != "")
122 132 {
123 133 $this->mapa = ms_newMapObj($map_file);
124 134 $this->arquivo = $map_file;
... ... @@ -156,13 +166,13 @@ function: salva
156 166  
157 167 Salva o mapfile atual
158 168 */
159   - function salva()
160   - {
161   - if (connection_aborted()){exit();}
162   - $this->mapa->save($this->arquivo);
  169 + function salva()
  170 + {
  171 + if (connection_aborted()){exit();}
  172 + $this->mapa->save($this->arquivo);
163 173 }
164 174 /*
165   - function: pegaMetadata
  175 +function: pegaMetadata
166 176  
167 177 Pega os metadata do tema
168 178  
... ... @@ -213,7 +223,7 @@ Nome da imagem gravada
213 223 */
214 224 function gravaImagemCorpo()
215 225 {
216   - $imgo = $this->mapa->draw();
  226 + $imgo = $this->mapa->draw();
217 227 $nome = ($imgo->imagepath).nomeRandomico().".png";
218 228 $imgo->saveImage($nome);
219 229 return ($imgo->imageurl).basename($nome);
... ... @@ -449,7 +459,7 @@ Calcula a extensão geográfica de um tema e ajusta o mapa para essa
449 459 $extatual->setextent($ret[0],$ret[1],$ret[2],$ret[3]);
450 460 //echo "oi";exit;
451 461 }
452   - if($this->mapa->getmetadata("interface") == "googlemaps")
  462 + if($this->mapa->getmetadata("interface") == "googlemaps")
453 463 {$this->mapa->setProjection($projO);}
454 464 return("ok");
455 465 }
... ... @@ -547,7 +557,7 @@ $valor - Novo valor da transparência
547 557 */
548 558 function mudaTransparencia($valor)
549 559 {
550   - //error_reporting(0);
  560 + //error_reporting(0);
551 561 $v = versao();
552 562 foreach ($this->grupo as $lg)
553 563 {
... ... @@ -565,7 +575,7 @@ Muda o metadata CLASSE, invertendo seu valor
565 575 */
566 576 function inverteStatusLegenda()
567 577 {
568   - //error_reporting(0);
  578 + //error_reporting(0);
569 579 $valor = $this->layer->getmetadata("classe");
570 580 if($valor == "" || strtolower($valor) == "sim")
571 581 {$valor = "NAO";}
... ... @@ -935,7 +945,7 @@ tema - código do tema
935 945 {
936 946 include_once($this->locaplic."/admin/php/xml.php");
937 947 require($this->locaplic."/classesphp/classe_menutemas.php");
938   - $menutemas = new Menutemas("","","",$this->locaplic);
  948 + $menutemas = new Menutemas("","","",$this->locaplic);
939 949 $linkfonte = "erro";
940 950 $tipo = "";
941 951 $this->xml = "";
... ... @@ -1021,7 +1031,7 @@ Calcula a extensão geográfica dos elementos selecionados de um tem
1021 1031 $ret->project($projInObj, $projOutObj);
1022 1032 }
1023 1033 $extatual->setextent($ret->minx,$ret->miny,$ret->maxx,$ret->maxy);
1024   - if($this->mapa->getmetadata("interface") == "googlemaps")
  1034 + if($this->mapa->getmetadata("interface") == "googlemaps")
1025 1035 {$this->mapa->setProjection($projO);}
1026 1036 return("ok");
1027 1037 }
... ... @@ -1093,7 +1103,12 @@ function: adicionaLabel
1093 1103 Adiciona LABEL em uma classe de um tema
1094 1104 */
1095 1105 function adicionaLabel($novac,$wrap,$fonte,$tamanho,$angulo,$fundo,$sombra,$cor,$outlinecolor,$shadowcolor,$shadowsizex,$shadowsizey,$force,$mindistance,$minfeaturesize,$offsetx,$offsety,$partials,$position){
1096   - $label = $novac->label;
  1106 + if($this->vi >= 60200){
  1107 + $label = $novac->getLabel(0);
  1108 + }
  1109 + else{
  1110 + $label = $novac->label;
  1111 + }
1097 1112 if($wrap != "")
1098 1113 {
1099 1114 $label->set("maxlength",1);
... ...