Commit 11f04aae6f809a924452e57db73caa1313396365

Authored by Edmar Moretti
1 parent cef907d5

--no commit message

admin/php/editormapfile.php
1 1 <?php
2 2 /*
3   - Title: editormapfile.php
  3 +Title: editormapfile.php
4 4  
5 5 Fun&ccedil;&otilde;es utilizadas pelo editor de arquivos mapfile.
6 6  
... ... @@ -85,12 +85,12 @@ error_reporting(0);
85 85 switch (strtoupper($funcao))
86 86 {
87 87 /*
88   - Note:
  88 + Note:
89 89  
90 90 Valores que o par&acirc;metro &funcao pode receber. Os par&acirc;metros devem ser enviados na requisi&ccedil;&atilde;o em AJAX.
91 91 */
92 92 /*
93   - Valor: CRIARNOVOMAP
  93 + Valor: CRIARNOVOMAP
94 94  
95 95 Cria um novo mapfile
96 96  
... ... @@ -128,7 +128,7 @@ switch (strtoupper($funcao))
128 128 exit;
129 129 break;
130 130 /*
131   - Valor: EDITASIMBOLO
  131 + Valor: EDITASIMBOLO
132 132  
133 133 Lista os s&iacute;mbolos de um determinado tipo
134 134  
... ... @@ -180,7 +180,7 @@ switch (strtoupper($funcao))
180 180 exit;
181 181 break;
182 182 /*
183   - Valor: PEGALAYERS
  183 + Valor: PEGALAYERS
184 184  
185 185 Lista os layers existentes em um mapfile
186 186  
... ... @@ -197,7 +197,7 @@ switch (strtoupper($funcao))
197 197 exit;
198 198 break;
199 199 /*
200   - Valor: PEGAITENSLAYER
  200 + Valor: PEGAITENSLAYER
201 201  
202 202 Lista os itens da tabela de atributos de um layer
203 203  
... ... @@ -216,7 +216,7 @@ switch (strtoupper($funcao))
216 216 exit;
217 217 break;
218 218 /*
219   - Valor: LIMPARCACHEMAPFILE
  219 + Valor: LIMPARCACHEMAPFILE
220 220  
221 221 Apaga o diretório contendo o cache de um tema (mapfile)
222 222  
... ... @@ -251,7 +251,7 @@ switch (strtoupper($funcao))
251 251 exit;
252 252 break;
253 253 /*
254   - Valor: EXCLUIRMAPFILE
  254 + Valor: EXCLUIRMAPFILE
255 255  
256 256 Exclui um mapfile.
257 257  
... ... @@ -299,7 +299,7 @@ switch (strtoupper($funcao))
299 299 }
300 300 break;
301 301 /*
302   - Valor: REFAZERLAYER
  302 + Valor: REFAZERLAYER
303 303  
304 304 Altera um layer existente em um mapfile com base em um layer existente em outro mapfile
305 305  
... ... @@ -320,7 +320,7 @@ switch (strtoupper($funcao))
320 320 exit;
321 321 break;
322 322 /*
323   - Valor: CLONARMAPFILE
  323 + Valor: CLONARMAPFILE
324 324  
325 325 Copia um mapfile existente
326 326  
... ... @@ -339,7 +339,7 @@ switch (strtoupper($funcao))
339 339 exit;
340 340 break;
341 341 /*
342   - Valor: CRIARNOVOLAYER
  342 + Valor: CRIARNOVOLAYER
343 343  
344 344 Cria um novo layer em um mapfile
345 345  
... ... @@ -358,7 +358,7 @@ switch (strtoupper($funcao))
358 358 exit;
359 359 break;
360 360 /*
361   - Valor: EXCLUIRLAYER
  361 + Valor: EXCLUIRLAYER
362 362  
363 363 Exclui um layer de um mapfile
364 364  
... ... @@ -378,7 +378,7 @@ switch (strtoupper($funcao))
378 378 break;
379 379  
380 380 /*
381   - Valor: LISTACLASSES
  381 + Valor: LISTACLASSES
382 382  
383 383 Lista as classes da legenda de um layer em um mapfile
384 384  
... ... @@ -397,7 +397,7 @@ switch (strtoupper($funcao))
397 397 exit;
398 398 break;
399 399 /*
400   - Valor: AUTOCLASSESLAYER
  400 + Valor: AUTOCLASSESLAYER
401 401  
402 402 Cria classes em um layer com base na tabela de atributos
403 403  
... ... @@ -421,7 +421,7 @@ switch (strtoupper($funcao))
421 421 exit;
422 422 break;
423 423 /*
424   - Valor: CRIARNOVACLASSE
  424 + Valor: CRIARNOVACLASSE
425 425  
426 426 Cria uma nova classe em um layer
427 427  
... ... @@ -440,7 +440,7 @@ switch (strtoupper($funcao))
440 440 exit;
441 441 break;
442 442 /*
443   - Valor: EXCLUIRCLASSE
  443 + Valor: EXCLUIRCLASSE
444 444  
445 445 Cria uma nova classe em um layer
446 446  
... ... @@ -462,7 +462,7 @@ switch (strtoupper($funcao))
462 462 exit;
463 463 break;
464 464 /*
465   - Valor: LISTAESTILOS
  465 + Valor: LISTAESTILOS
466 466  
467 467 Lista de estilos existentes em uma classe de um layer
468 468  
... ... @@ -483,7 +483,7 @@ switch (strtoupper($funcao))
483 483 exit;
484 484 break;
485 485 /*
486   - Valor: CRIARNOVOESTILO
  486 + Valor: CRIARNOVOESTILO
487 487  
488 488 Adiciona um novo estilo em uma classe
489 489  
... ... @@ -504,7 +504,7 @@ switch (strtoupper($funcao))
504 504 exit;
505 505 break;
506 506 /*
507   - Valor: EXCLUIRESTILO
  507 + Valor: EXCLUIRESTILO
508 508  
509 509 Exclui um estilo de uma classe
510 510  
... ... @@ -528,7 +528,7 @@ switch (strtoupper($funcao))
528 528 exit;
529 529 break;
530 530 /*
531   - Valor: PEGAESTILO
  531 + Valor: PEGAESTILO
532 532  
533 533 Obt&eacute;m os dados de um estilo de uma classe
534 534  
... ... @@ -551,7 +551,7 @@ switch (strtoupper($funcao))
551 551 exit;
552 552 break;
553 553 /*
554   - Valor: ALTERARESTILO
  554 + Valor: ALTERARESTILO
555 555  
556 556 Altera um estilo de uma classe
557 557  
... ... @@ -603,7 +603,7 @@ switch (strtoupper($funcao))
603 603 exit;
604 604 break;
605 605 /*
606   - Valor: PEGACONEXAO
  606 + Valor: PEGACONEXAO
607 607  
608 608 Obt&eacute;m os valores dos elementos de conex&atilde;o com uma base de dados de um layer
609 609  
... ... @@ -622,7 +622,7 @@ switch (strtoupper($funcao))
622 622 exit;
623 623 break;
624 624 /*
625   - Valor: ALTERARCONEXAO
  625 + Valor: ALTERARCONEXAO
626 626  
627 627 Altera os valores dos elementos de conex&atilde;o com uma base de dados de um layer
628 628  
... ... @@ -657,7 +657,7 @@ switch (strtoupper($funcao))
657 657 exit;
658 658 break;
659 659 /*
660   - Valor: PEGAMETADADOS
  660 + Valor: PEGAMETADADOS
661 661  
662 662 Obt&eacute;m os valores dos elementos de metadados de um layer
663 663  
... ... @@ -676,7 +676,7 @@ switch (strtoupper($funcao))
676 676 exit;
677 677 break;
678 678 /*
679   - Valor: PEGATITULO
  679 + Valor: PEGATITULO
680 680  
681 681 Obt&eacute;m os valores de titulo, descricao, etc
682 682  
... ... @@ -719,7 +719,7 @@ switch (strtoupper($funcao))
719 719 break;
720 720  
721 721 /*
722   - Valor: ALTERARMETADADOS
  722 + Valor: ALTERARMETADADOS
723 723  
724 724 Altera os valores dos elementos de metadados de um layer
725 725  
... ... @@ -813,7 +813,7 @@ switch (strtoupper($funcao))
813 813 exit;
814 814 break;
815 815 /*
816   - Valor: PEGAGERAL
  816 + Valor: PEGAGERAL
817 817  
818 818 Obt&eacute;m os valores dos elementos de configura&ccedil;&atilde;o geral de um layer
819 819  
... ... @@ -832,7 +832,7 @@ switch (strtoupper($funcao))
832 832 exit;
833 833 break;
834 834 /*
835   - Valor: ALTERARGERAL
  835 + Valor: ALTERARGERAL
836 836  
837 837 Modifica os valores dos elementos de configura&ccedil;&atilde;o geral de um layer
838 838  
... ... @@ -898,7 +898,7 @@ switch (strtoupper($funcao))
898 898 exit;
899 899 break;
900 900 /*
901   - Valor: PEGACLASSEGERAL
  901 + Valor: PEGACLASSEGERAL
902 902  
903 903 Obt&eacute;m os valores dos elementos de configura&ccedil;&atilde;o geral de uma classe
904 904  
... ... @@ -919,7 +919,7 @@ switch (strtoupper($funcao))
919 919 exit;
920 920 break;
921 921 /*
922   - Valor: ALTERARCLASSEGERAL
  922 + Valor: ALTERARCLASSEGERAL
923 923  
924 924 Altera os valores dos elementos de configura&ccedil;&atilde;o geral de uma classe
925 925  
... ... @@ -955,7 +955,7 @@ switch (strtoupper($funcao))
955 955 exit;
956 956 break;
957 957 /*
958   - Valor: PEGACLASSELABEL
  958 + Valor: PEGACLASSELABEL
959 959  
960 960 Obt&eacute;m os valores dos elementos de configura&ccedil;&atilde;o da topon&iacute;mia de uma classe
961 961  
... ... @@ -976,7 +976,7 @@ switch (strtoupper($funcao))
976 976 exit;
977 977 break;
978 978 /*
979   - Valor: ALTERARCLASSELABEL
  979 + Valor: ALTERARCLASSELABEL
980 980  
981 981 Altera os valores dos elementos de configura&ccedil;&atilde;o da topon&iacute;mia de uma classe
982 982  
... ... @@ -1891,7 +1891,14 @@ function pegaClasseLabel()
1891 1891 $mapa = ms_newMapObj($mapfile);
1892 1892 $layer = $mapa->getlayerbyname($codigoLayer);
1893 1893 $classe = $layer->getclass($indiceClasse);
1894   - $label = $classe->label;
  1894 + $v = versao();
  1895 + $vi = $v["inteiro"];
  1896 + if($vi >= 60200){
  1897 + $label = $classe->getLabel(0);
  1898 + }
  1899 + else{
  1900 + $label = $classe->label;
  1901 + }
1895 1902 if ($label != "")
1896 1903 {
1897 1904 $dados["font"] = $label->font;
... ...
classesphp/classe_mapa.php
... ... @@ -65,6 +65,14 @@ class Mapa
65 65 Vers&atilde;o atual do Mapserver (primeiro d&iacute;gito)
66 66 */
67 67 public $v;
  68 + /*
  69 + Variavel: $vi
  70 +
  71 + Vers&atilde;o atual do Mapserver (valor inteiro)
  72 +
  73 + 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
  74 + */
  75 + public $vi;
68 76 /*
69 77 Function: __construct
70 78  
... ... @@ -76,20 +84,21 @@ $map_file - Endere&amp;ccedil;o do mapfile no servidor.
76 84 */
77 85 function __construct($map_file,$locaplic="")
78 86 {
79   - error_reporting(0);
80   - if (!function_exists('ms_newMapObj')) {return false;}
81   - if(file_exists($locaplic."/funcoes_gerais.php"))
82   - include_once($locaplic."/funcoes_gerais.php");
83   - else
84   - include_once("funcoes_gerais.php");
  87 + error_reporting(0);
  88 + if (!function_exists('ms_newMapObj')) {return false;}
  89 + if(file_exists($locaplic."/funcoes_gerais.php"))
  90 + include_once($locaplic."/funcoes_gerais.php");
  91 + else
  92 + include_once("funcoes_gerais.php");
85 93 $this->v = versao();
  94 + $this->vi = $this->v["inteiro"];
86 95 $this->v = $this->v["principal"];
87 96 $this->qyfile = str_replace(".map",".qy",$map_file);
88   - $this->locaplic = $locaplic;
89   - if(!file_exists($map_file))
90   - {return $this->arquivo = false;}
91   - if(!@ms_newMapObj($map_file))
92   - {return $this->mapa = false;}
  97 + $this->locaplic = $locaplic;
  98 + if(!file_exists($map_file))
  99 + {return $this->arquivo = false;}
  100 + if(!@ms_newMapObj($map_file))
  101 + {return $this->mapa = false;}
93 102 $this->mapa = @ms_newMapObj($map_file);
94 103 $this->arquivo = $map_file;
95 104 $c = $this->mapa->numlayers;
... ... @@ -104,10 +113,10 @@ Method: salva
104 113  
105 114 Salva o mapfile atual
106 115 */
107   - function salva()
108   - {
109   - if(connection_aborted()){exit();}
110   - $this->mapa->save($this->arquivo);
  116 + function salva()
  117 + {
  118 + if(connection_aborted()){exit();}
  119 + $this->mapa->save($this->arquivo);
111 120 }
112 121 /*
113 122 Method: listaTemasBuscaRapida
... ... @@ -141,8 +150,8 @@ Parametro:
141 150  
142 151 tipo {string} - OUTPUTFORMAT que ser&aacute; aplicado. deve existir no mapfile b&aacute;sico que iniciou o i3Geo
143 152 */
144   - function mudaoutputformat($tipo)
145   - {
  153 + function mudaoutputformat($tipo)
  154 + {
146 155 foreach($this->layers as $l)
147 156 {$l->setMetaData("cache","");}
148 157 return $this->mapa->selectOutputFormat($tipo);
... ... @@ -176,7 +185,7 @@ Grava a imagem do mapa atual
176 185 */
177 186 function gravaImagemCorpo()
178 187 {
179   - $imgo = $this->mapa->draw();
  188 + $imgo = $this->mapa->draw();
180 189 $nome = ($imgo->imagepath).nomeRandomico().".png";
181 190 $imgo->saveImage($nome);
182 191 $nome = ($imgo->imageurl).basename($nome);
... ... @@ -374,9 +383,9 @@ Include:
374 383 {
375 384 ms_ResetErrorList();
376 385 if(file_exists($this->locaplic."/classe_imagem.php"))
377   - include_once($this->locaplic."/classe_imagem.php");
378   - else
379   - include_once("classe_imagem.php");
  386 + include_once($this->locaplic."/classe_imagem.php");
  387 + else
  388 + include_once("classe_imagem.php");
380 389 $nomer = "";
381 390 $qy = file_exists($this->qyfile);
382 391 if($qy)
... ... @@ -632,7 +641,7 @@ nome
632 641 {
633 642 foreach ($this->layers as $layer)
634 643 {
635   - if ($layer->getmetadata("ESCONDIDO") == "")
  644 + if ($layer->getmetadata("ESCONDIDO") == "")
636 645 {$final[] = array("tema"=>$layer->name,"nome"=>(pegaNome($layer,"UTF-8")));}
637 646 }
638 647 }
... ... @@ -735,7 +744,7 @@ nome
735 744 $res_count = $layer->getNumresults();
736 745 if ($res_count > 0)
737 746 {
738   - $nometmp = pegaNome($layer,"UTF-8");
  747 + $nometmp = pegaNome($layer,"UTF-8");
739 748 $final[] = array("tema"=>$layer->name,"nome"=>$nometmp);
740 749 }
741 750 }
... ... @@ -887,7 +896,12 @@ $incluitexto - sim|nao
887 896 $cor->setrgb($corlinha[0],$corlinha[1],$corlinha[2]);
888 897 if($incluitexto == "sim")
889 898 {
890   - $label = $classe->label;
  899 + if($this->vi >= 60200){
  900 + $label = $classe->getLabel(0);
  901 + }
  902 + else{
  903 + $label = $classe->label;
  904 + }
891 905 $label->set("size",$tamanhotexto);
892 906 $label->set("type",MS_BITMAP);
893 907 if ($fonte != "bitmap")
... ... @@ -1786,14 +1800,14 @@ $arq - Nome do arquivo.
1786 1800 }
1787 1801 function adicionaAcesso($codigo_tema,$locaplic)
1788 1802 {
1789   - $resultado = array();
1790   - include("$locaplic/admin/php/conexao.php");
1791   - if(!empty($esquemaadmin)){
1792   - $esquemaadmin = $esquemaadmin.".";
1793   - }
1794   - $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")).")");
  1803 + $resultado = array();
  1804 + include("$locaplic/admin/php/conexao.php");
  1805 + if(!empty($esquemaadmin)){
  1806 + $esquemaadmin = $esquemaadmin.".";
  1807 + }
  1808 + $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")).")");
1795 1809 $dbh = null;
1796   - $dbhw = null;
  1810 + $dbhw = null;
1797 1811 }
1798 1812 //
1799 1813 //esta fun&ccedil;&atilde;o n&atilde;o est&aacute; concluida
... ...
classesphp/classe_toponimia.php
... ... @@ -65,6 +65,20 @@ class Toponimia
65 65 Nome do layer
66 66 */
67 67 protected $nome;
  68 + /*
  69 + Variavel: $v
  70 +
  71 + Vers&atilde;o atual do Mapserver (primeiro d&iacute;gito)
  72 + */
  73 + public $v;
  74 + /*
  75 + Variavel: $vi
  76 +
  77 + Vers&atilde;o atual do Mapserver (valor inteiro)
  78 +
  79 + 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
  80 + */
  81 + public $vi;
68 82 /*
69 83 function __construct
70 84  
... ... @@ -77,28 +91,29 @@ $tema - nome do tema que ser&amp;aacute; processado
77 91 */
78 92 function __construct($map_file,$tema="",$locaplic="")
79 93 {
80   - //error_reporting(0);
81   - if(file_exists($locaplic."/funcoes_gerais.php"))
82   - include_once($locaplic."/funcoes_gerais.php");
83   - else
84   - include_once("funcoes_gerais.php");
  94 + //error_reporting(0);
  95 + if(file_exists($locaplic."/funcoes_gerais.php"))
  96 + include_once($locaplic."/funcoes_gerais.php");
  97 + else
  98 + include_once("funcoes_gerais.php");
85 99 $this->v = versao();
  100 + $this->vi = $this->v["inteiro"];
86 101 $this->v = $this->v["principal"];
87   - $this->mapa = ms_newMapObj($map_file);
88   - $this->arquivo = $map_file;
89   - if($tema != "" && @$this->mapa->getlayerbyname($tema))
90   - $this->layer = $this->mapa->getlayerbyname($tema);
91   - $this->nome = $tema;
  102 + $this->mapa = ms_newMapObj($map_file);
  103 + $this->arquivo = $map_file;
  104 + if($tema != "" && @$this->mapa->getlayerbyname($tema))
  105 + $this->layer = $this->mapa->getlayerbyname($tema);
  106 + $this->nome = $tema;
92 107 }
93 108 /*
94 109 function: salva
95 110  
96 111 Salva o mapfile atual
97 112 */
98   - function salva()
99   - {
100   - if (connection_aborted()){exit();}
101   - $this->mapa->save($this->arquivo);
  113 + function salva()
  114 + {
  115 + if (connection_aborted()){exit();}
  116 + $this->mapa->save($this->arquivo);
102 117 }
103 118 /*
104 119 function: criaToponimia
... ... @@ -198,8 +213,14 @@ Retorno:
198 213 }
199 214 $nclasses = $this->layer->numclasses;
200 215 for ($i=0; $i < $nclasses; ++$i){
201   - $novac = $this->layer->getclass($i);
202   - $label = $novac->getlabel(0);
  216 + $novac = $this->layer->getclass($i);
  217 + if($this->vi >= 60200){
  218 + $indiceLabel = $novac->addLabel(new labelObj());
  219 + $label = $novac->getLabel($indiceLabel);
  220 + }
  221 + else{
  222 + $label = $novac->label;
  223 + }
203 224 if($wrap != "")
204 225 {
205 226 $label->set("maxlength",1);
... ... @@ -207,7 +228,13 @@ Retorno:
207 228 $s = "CLASS LABEL WRAP '$wrap' END END";
208 229 $novac->updateFromString($s);
209 230 }
210   - $label = $novac->label;
  231 + if($this->vi >= 60200){
  232 + $indiceLabel = $novac->addLabel(new labelObj());
  233 + $label = $novac->getLabel($indiceLabel);
  234 + }
  235 + else{
  236 + $label = $novac->label;
  237 + }
211 238 if ($fonte != "bitmap")
212 239 {
213 240 $label->set("type",MS_TRUETYPE);
... ... @@ -254,7 +281,7 @@ Retorno:
254 281 $label->set("position",$p[$position]);
255 282 }
256 283 if ($tipo == "teste"){
257   - $i = gravaImagemMapa($this->mapa);
  284 + $i = gravaImagemMapa($this->mapa);
258 285 return ($i["url"]);
259 286 }
260 287 else
... ...