Commit 4f6049e612be03f8b0a30e36ed6d31ab55f62569
1 parent
eae3ead1
Exists in
master
and in
7 other branches
Alterações para permitir o uso de simbolos inline nos mapfiles
Showing
10 changed files
with
465 additions
and
440 deletions
Show diff stats
admin/admin.db
No preview for this file type
classesphp/classe_mapa.php
@@ -1100,6 +1100,7 @@ $random - indica se os nomes dos novos layers serão modificados ou nao | @@ -1100,6 +1100,7 @@ $random - indica se os nomes dos novos layers serão modificados ou nao | ||
1100 | $nlayer->setmetadata("wms_sld_body",str_replace('"',"'",$sld)); | 1100 | $nlayer->setmetadata("wms_sld_body",str_replace('"',"'",$sld)); |
1101 | $nlayer->set("type",$tipotemp); | 1101 | $nlayer->set("type",$tipotemp); |
1102 | } | 1102 | } |
1103 | + cloneInlineSymbol($nlayer,$nmap,$this->mapa); | ||
1103 | ms_newLayerObj($this->mapa, $nlayer); | 1104 | ms_newLayerObj($this->mapa, $nlayer); |
1104 | $l = $this->mapa->getlayerbyname($nlayer->name); | 1105 | $l = $this->mapa->getlayerbyname($nlayer->name); |
1105 | //reposiciona o layer se for o caso | 1106 | //reposiciona o layer se for o caso |
classesphp/funcoes_gerais.php
@@ -2635,4 +2635,43 @@ function listaGruposUsrLogin(){ | @@ -2635,4 +2635,43 @@ function listaGruposUsrLogin(){ | ||
2635 | session_start(); | 2635 | session_start(); |
2636 | return $res; | 2636 | return $res; |
2637 | } | 2637 | } |
2638 | +/* | ||
2639 | +Function: cloneInlineSymbol | ||
2640 | + | ||
2641 | +Importa os simbolos inline de um layer de um mapfile para outro mapfile | ||
2642 | + | ||
2643 | +@fixme | ||
2644 | +No caso de imagens, o nome do simbolo deve ser o mesmo do caminho da imagem (bug do mapserver) | ||
2645 | + | ||
2646 | +Parameters: | ||
2647 | + | ||
2648 | +layern - objeto layer que contem o simbolo original | ||
2649 | + | ||
2650 | +nmapa - objeto map que contem o layer layern | ||
2651 | + | ||
2652 | +mapa - objeto mapa destino do simbolo clonado | ||
2653 | +*/ | ||
2654 | +function cloneInlineSymbol($layern,$nmapa,$mapa){ | ||
2655 | + $versao = versao(); | ||
2656 | + if($versao["principal"] > 5){ | ||
2657 | + $numclasses = $layern->numclasses; | ||
2658 | + for($ci=0;$ci < $numclasses;$ci++){ | ||
2659 | + $classe = $layern->getclass($ci); | ||
2660 | + $numestilos = $classe->numstyles; | ||
2661 | + for($ei=0;$ei < $numestilos;$ei++){ | ||
2662 | + $estilo = $classe->getstyle($ei); | ||
2663 | + if($estilo->symbolname != ""){ | ||
2664 | + $nomesimbolo = $estilo->symbolname; | ||
2665 | + $simbolo = new symbolObj($nmapa, $nomesimbolo); | ||
2666 | + $ipath = $simbolo->imagepath; | ||
2667 | + if($simbolo->inmapfile == MS_TRUE){ | ||
2668 | + $simbolon = new symbolObj($mapa, $nomesimbolo); | ||
2669 | + $simbolon->set("inmapfile",MS_TRUE); | ||
2670 | + $simbolon->setImagePath($ipath); | ||
2671 | + } | ||
2672 | + } | ||
2673 | + } | ||
2674 | + } | ||
2675 | + } | ||
2676 | +} | ||
2638 | ?> | 2677 | ?> |
geraminiatura.php
@@ -213,6 +213,7 @@ function verificaMiniatura($map,$tipo,$admin=false) | @@ -213,6 +213,7 @@ function verificaMiniatura($map,$tipo,$admin=false) | ||
213 | for ($i=0;$i < $numlayers;$i++){ | 213 | for ($i=0;$i < $numlayers;$i++){ |
214 | $layern = $nmapa->getlayer($i); | 214 | $layern = $nmapa->getlayer($i); |
215 | $layern->set("status",MS_DEFAULT); | 215 | $layern->set("status",MS_DEFAULT); |
216 | + cloneInlineSymbol($layern,$nmapa,$mapa); | ||
216 | ms_newLayerObj($mapa, $layern); | 217 | ms_newLayerObj($mapa, $layern); |
217 | autoClasses($layern,$mapa,$locaplic); | 218 | autoClasses($layern,$mapa,$locaplic); |
218 | if ($layern->data == ""){ | 219 | if ($layern->data == ""){ |
@@ -261,7 +262,7 @@ function verificaMiniatura($map,$tipo,$admin=false) | @@ -261,7 +262,7 @@ function verificaMiniatura($map,$tipo,$admin=false) | ||
261 | $urlM = $weboM->imageurl."/".$map; | 262 | $urlM = $weboM->imageurl."/".$map; |
262 | } | 263 | } |
263 | if ($tipo == "grande" || $tipo == "todos"){ | 264 | if ($tipo == "grande" || $tipo == "todos"){ |
264 | - $mapa->setsize(300,300); | 265 | + $mapa->setsize(300,300); |
265 | $sca = $mapa->scalebar; | 266 | $sca = $mapa->scalebar; |
266 | $sca->set("status",MS_OFF); | 267 | $sca->set("status",MS_OFF); |
267 | $objImagemG = @$mapa->draw(); | 268 | $objImagemG = @$mapa->draw(); |
677 Bytes
835 Bytes
ms_criamapa.php
@@ -722,6 +722,7 @@ function incluiTemasIniciais(){ | @@ -722,6 +722,7 @@ function incluiTemasIniciais(){ | ||
722 | $layern->set("type",$tipotemp); | 722 | $layern->set("type",$tipotemp); |
723 | $layern->set("status",$statustemp); | 723 | $layern->set("status",$statustemp); |
724 | } | 724 | } |
725 | + cloneInlineSymbol($layern,$maptemp,$mapn); | ||
725 | ms_newLayerObj($mapn, $layern); | 726 | ms_newLayerObj($mapn, $layern); |
726 | } | 727 | } |
727 | } | 728 | } |
ogc.php
1 | <?php | 1 | <?php |
2 | /* | 2 | /* |
3 | - Title: Gerador de serviços OGC | 3 | +Title: Gerador de serviços OGC |
4 | 4 | ||
5 | Gera web services nos padrões OGC para os temas existentes na pasta i3geo/temas | 5 | Gera web services nos padrões OGC para os temas existentes na pasta i3geo/temas |
6 | 6 | ||
@@ -429,7 +429,8 @@ else{ | @@ -429,7 +429,8 @@ else{ | ||
429 | $l->setmetadata("wms_attribution_logourl_height","50"); | 429 | $l->setmetadata("wms_attribution_logourl_height","50"); |
430 | $l->setmetadata("wms_attribution_logourl_width","50"); | 430 | $l->setmetadata("wms_attribution_logourl_width","50"); |
431 | $l->setmetadata("wms_attribution_logourl_href",$mini); | 431 | $l->setmetadata("wms_attribution_logourl_href",$mini); |
432 | - } | 432 | + } |
433 | + cloneInlineSymbol($l,$nmap,$oMap); | ||
433 | ms_newLayerObj($oMap, $l); | 434 | ms_newLayerObj($oMap, $l); |
434 | } | 435 | } |
435 | } | 436 | } |
temas/_llocali.map
@@ -3,9 +3,14 @@ MAP | @@ -3,9 +3,14 @@ MAP | ||
3 | #SYMBOLSET "../symbols/vazio.sym" | 3 | #SYMBOLSET "../symbols/vazio.sym" |
4 | SYMBOLSET "../symbols/simbolosv6.sym" | 4 | SYMBOLSET "../symbols/simbolosv6.sym" |
5 | SYMBOL | 5 | SYMBOL |
6 | - NAME "teste" | 6 | + NAME "/var/www/i3geo/imagens/google/condominium.png" |
7 | TYPE pixmap | 7 | TYPE pixmap |
8 | - IMAGE "/var/www/i3geo/imagens/google/foto.png" | 8 | + IMAGE "/var/www/i3geo/imagens/google/condominium.png" |
9 | +END | ||
10 | +SYMBOL | ||
11 | + NAME "/var/www/i3geo/imagens/google/condominium1.png" | ||
12 | + TYPE pixmap | ||
13 | + IMAGE "/var/www/i3geo/imagens/google/condominium1.png" | ||
9 | END | 14 | END |
10 | LAYER | 15 | LAYER |
11 | CONNECTION "" | 16 | CONNECTION "" |
@@ -58,8 +63,8 @@ END | @@ -58,8 +63,8 @@ END | ||
58 | ANGLE 0 | 63 | ANGLE 0 |
59 | COLOR 250 193 4 | 64 | COLOR 250 193 4 |
60 | OFFSET 0 0 | 65 | OFFSET 0 0 |
61 | - SIZE 4 | ||
62 | - SYMBOL "ponto" | 66 | + SIZE 20 |
67 | + SYMBOL "/var/www/i3geo/imagens/google/condominium.png" | ||
63 | END # STYLE | 68 | END # STYLE |
64 | END # CLASS | 69 | END # CLASS |
65 | CLASS | 70 | CLASS |
@@ -69,8 +74,8 @@ END | @@ -69,8 +74,8 @@ END | ||
69 | ANGLE 0 | 74 | ANGLE 0 |
70 | COLOR 62 9 41 | 75 | COLOR 62 9 41 |
71 | OFFSET 0 0 | 76 | OFFSET 0 0 |
72 | - SIZE 6 | ||
73 | - SYMBOL "teste" | 77 | + SIZE 20 |
78 | + SYMBOL "/var/www/i3geo/imagens/google/condominium1.png" | ||
74 | END # STYLE | 79 | END # STYLE |
75 | END # CLASS | 80 | END # CLASS |
76 | CLASS | 81 | CLASS |
@@ -81,7 +86,7 @@ END | @@ -81,7 +86,7 @@ END | ||
81 | COLOR 112 203 244 | 86 | COLOR 112 203 244 |
82 | OFFSET 0 0 | 87 | OFFSET 0 0 |
83 | SIZE 6 | 88 | SIZE 6 |
84 | - SYMBOL "capital" | 89 | + SYMBOL "vila" |
85 | END # STYLE | 90 | END # STYLE |
86 | END # CLASS | 91 | END # CLASS |
87 | END # LAYER | 92 | END # LAYER |
testamapfile.php
1 | -<?php | ||
2 | -/* | ||
3 | -Testa um mapfile | ||
4 | - | ||
5 | -Permite testar um mapfile específico existente no diretório "temas" ou gerar uma imagem miniatura. | ||
6 | - | ||
7 | -As miniaturas são utilizadas na árvore de temas mostrada na opção "adiciona", existente na interface padrão. | ||
8 | -Quando o usuário passa o mouse sobre a palavra "miniatura" é executado o programa de geração de miniaturas. Caso o | ||
9 | -a miniatura tiver sido gerada previamente, a preferência é por esse arquivo em cahce. Isso permite uma performance melhor, | ||
10 | -uma vez que a geração on-line pode ser muito demorada. Para gerar as miniaturas o administrador deve executar o | ||
11 | -programa geraminiatura.php. | ||
12 | - | ||
13 | -Licenca: | ||
14 | - | ||
15 | -GPL2 | ||
16 | - | ||
17 | -i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | ||
18 | - | ||
19 | -Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil | ||
20 | -Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | ||
21 | -Colaboração: Luis Henrique Weirich de Matos | ||
22 | -Este programa é software livre; você pode redistribuí-lo | ||
23 | -e/ou modificá-lo sob os termos da Licença Pública Geral | ||
24 | -GNU conforme publicada pela Free Software Foundation; | ||
25 | - | ||
26 | -Este programa é distribuído na expectativa de que seja útil, | ||
27 | -porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | ||
28 | -de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | ||
29 | -Consulte a Licença Pública Geral do GNU para mais detalhes. | ||
30 | -Você deve ter recebido uma cópia da Licença Pública Geral do | ||
31 | -GNU junto com este programa; se não, escreva para a | ||
32 | -Free Software Foundation, Inc., no endereço | ||
33 | -59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | ||
34 | - | ||
35 | -Arquivo: | ||
36 | - | ||
37 | -i3geo/testamapfile.php | ||
38 | - | ||
39 | -Exemplos: | ||
40 | - | ||
41 | -testamapfile.php?map=bioma | ||
42 | - | ||
43 | -testamapfile.php?map=bioma&tipo=mini | ||
44 | - | ||
45 | -Parametros: | ||
46 | - | ||
47 | -map {string} - Nome do mapfile que será testado ou usado na geração da miniatura. O arquivo é procurado no caminho indicado e no diretório i3geo/temas. Se map=todos, todos os mapas são testados em grupos de 10 em 10 e a miniatura não é gerada. | ||
48 | - | ||
49 | -tipo {string} - (opcional) mini|grande Define o tamanho da imagem que será gerada. Se não for definido, será feito o teste do mapfile. Controla o tamanho da miniatura que deverá ser mostrada. | ||
50 | -*/ | ||
51 | -set_time_limit(300); | ||
52 | -ini_set('max_execution_time', 300); | ||
53 | -include("ms_configura.php"); | ||
54 | -include("classesphp/funcoes_gerais.php"); | ||
55 | -require_once("classesphp/pega_variaveis.php"); | ||
56 | -include_once ("classesphp/carrega_ext.php"); | ||
57 | - | ||
58 | -// | ||
59 | -//carrega o phpmapscript | ||
60 | -// | ||
61 | -if (!function_exists('ms_GetVersion')) | ||
62 | -{ | ||
63 | - if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) | ||
64 | - { | ||
65 | - if(!@dl('php_mapscript_48.dll')) | ||
66 | - dl('php_mapscript.dll'); | ||
67 | - } | ||
68 | - else | ||
69 | - {dl('php_mapscript.so');} | ||
70 | -} | ||
71 | -$versao = versao(); | ||
72 | -$versao = $versao["principal"]; | ||
73 | -ms_ResetErrorList(); | ||
74 | -if(!isset($tipo)) | ||
75 | -{$tipo = "";} | ||
76 | -$arqs = listaArquivos("temas"); | ||
77 | -sort($arqs["arquivos"]); | ||
78 | - | ||
79 | -if ($tipo == "") | ||
80 | -{ | ||
81 | - echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">'; | ||
82 | - echo '<html><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">'; | ||
83 | - echo '<link rel="stylesheet" type="text/css" href="admin/html/admin.css">'; | ||
84 | - echo '<style>body {COLOR: #2F4632;text-align: justify;font-size: 12px;font-family: Verdana, Arial, Helvetica, sans-serif;}</style>'; | ||
85 | - | ||
86 | - echo '</head><script>function roda(){window.location.href = "?map="+document.getElementById("nomemap").value;}</script>'; | ||
87 | - echo '<body class="fundoPonto"><center><div class="bordaSuperior" > </div><div class="mascaraPrincipal" id="divGeral">'; | ||
88 | - echo '<form action="testamapfile.php" method="post" id=f >'; | ||
89 | - echo 'Nome do arquivo map existente no diretório i3geo/temas. Exemplo para uso manual da URL: testamapfile.php?map=biomashp (utilize "testamapfile.php?map=todos" na URL para testar todos de uma só vez)<br><br>'; | ||
90 | - echo '<br>Mostra apenas a legenda? <input type=radio name=solegenda value=sim />sim <input type=radio name=solegenda value=nao CHECKED /> não<br>'; | ||
91 | - $combo = "<br><select onchange='roda()' id=nomemap ><option value=''>Escolha o arquivo para testar</option>"; | ||
92 | - foreach ($arqs["arquivos"] as $arq){ | ||
93 | - $temp = explode(".",$arq); | ||
94 | - if($temp[1] == "map" || $temp[1] == "gvp"){ | ||
95 | - $combo .= "<option value='".$temp[0]."'>".$temp[0]."</option>"; | ||
96 | - } | ||
97 | - } | ||
98 | - echo $combo."</select></form><br>"; | ||
99 | -} | ||
100 | -if (isset($map) && $map != "") | ||
101 | -{ | ||
102 | - if(!isset($solegenda)){$solegenda = "nao";} | ||
103 | - if ($map == "todos") | ||
104 | - { | ||
105 | - $tipo = "todos"; | ||
106 | - $conta = 0; | ||
107 | - echo "<br>Número de mapas = ".(count($arqs["arquivos"]))." Faltam= ".(count($arqs["arquivos"])-$iniciar-10)."<br>"; | ||
108 | - if (!isset($iniciar)){$iniciar = 0;} | ||
109 | - foreach ($arqs["arquivos"] as $arq) | ||
110 | - { | ||
111 | - if (($conta >= $iniciar) && ($conta < $iniciar+10)){ | ||
112 | - //arquivos php so sao validos se estiverem em i3geo/temas | ||
113 | - verifica($arq,$solegenda); | ||
114 | - } | ||
115 | - $conta++; | ||
116 | - } | ||
117 | - echo "<hr><br><br><a href='testamapfile.php?map=todos&iniciar=".($iniciar+10)."' >Próximos mapas</a>"; | ||
118 | - } | ||
119 | - else | ||
120 | - {verifica($map,$solegenda);} | ||
121 | -} | ||
122 | -echo '</div>'; | ||
123 | -echo '<script>if(screen.availWidth > 700){document.getElementById("divGeral").style.width = "700px";}</script>'; | ||
124 | -echo '</body></html>'; | ||
125 | -function verifica($map,$solegenda){ | ||
126 | - global $tipo,$locaplic,$postgis_mapa,$versao,$base,$dir_tmp; | ||
127 | - $mapUrl = $map; | ||
128 | - if ($tipo == "mini" && file_exists('temas/miniaturas/'.$map.".mini.png")){ | ||
129 | - Header("Content-type: image/png"); | ||
130 | - ImagePng(ImageCreateFromPNG('temas/miniaturas/'.$map.".mini.png")); | ||
131 | - exit; | ||
132 | - } | ||
133 | - if ($tipo == "grande" && file_exists('temas/miniaturas/'.$map.".grande.png")){ | ||
134 | - Header("Content-type: image/png"); | ||
135 | - ImagePng(ImageCreateFromPNG('temas/miniaturas/'.$map.".grande.png")); | ||
136 | - exit; | ||
137 | - } | ||
138 | - ms_ResetErrorList(); | ||
139 | - $tema = ""; | ||
140 | - if(file_exists($map)){ | ||
141 | - $tema = $map; | ||
142 | - } | ||
143 | - else{ | ||
144 | - $map = str_replace("\\","/",$map); | ||
145 | - $map = basename($map); | ||
146 | - if (file_exists('temas/'.$map)) | ||
147 | - {$tema = 'temas/'.$map;} | ||
148 | - if (file_exists('temas/'.$map.'.map')) | ||
149 | - {$tema = 'temas/'.$map.".map";} | ||
150 | - if (file_exists('temas/'.$map.'.php')) | ||
151 | - {$tema = 'temas/'.$map.".php";} | 1 | +<?php |
2 | +/* | ||
3 | +Testa um mapfile | ||
4 | + | ||
5 | +Permite testar um mapfile específico existente no diretório "temas" ou gerar uma imagem miniatura. | ||
6 | + | ||
7 | +As miniaturas são utilizadas na árvore de temas mostrada na opção "adiciona", existente na interface padrão. | ||
8 | +Quando o usuário passa o mouse sobre a palavra "miniatura" é executado o programa de geração de miniaturas. Caso o | ||
9 | +a miniatura tiver sido gerada previamente, a preferência é por esse arquivo em cahce. Isso permite uma performance melhor, | ||
10 | +uma vez que a geração on-line pode ser muito demorada. Para gerar as miniaturas o administrador deve executar o | ||
11 | +programa geraminiatura.php. | ||
12 | + | ||
13 | +Licenca: | ||
14 | + | ||
15 | +GPL2 | ||
16 | + | ||
17 | +i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | ||
18 | + | ||
19 | +Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil | ||
20 | +Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | ||
21 | +Colaboração: Luis Henrique Weirich de Matos | ||
22 | +Este programa é software livre; você pode redistribuí-lo | ||
23 | +e/ou modificá-lo sob os termos da Licença Pública Geral | ||
24 | +GNU conforme publicada pela Free Software Foundation; | ||
25 | + | ||
26 | +Este programa é distribuído na expectativa de que seja útil, | ||
27 | +porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | ||
28 | +de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | ||
29 | +Consulte a Licença Pública Geral do GNU para mais detalhes. | ||
30 | +Você deve ter recebido uma cópia da Licença Pública Geral do | ||
31 | +GNU junto com este programa; se não, escreva para a | ||
32 | +Free Software Foundation, Inc., no endereço | ||
33 | +59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | ||
34 | + | ||
35 | +Arquivo: | ||
36 | + | ||
37 | +i3geo/testamapfile.php | ||
38 | + | ||
39 | +Exemplos: | ||
40 | + | ||
41 | +testamapfile.php?map=bioma | ||
42 | + | ||
43 | +testamapfile.php?map=bioma&tipo=mini | ||
44 | + | ||
45 | +Parametros: | ||
46 | + | ||
47 | +map {string} - Nome do mapfile que será testado ou usado na geração da miniatura. O arquivo é procurado no caminho indicado e no diretório i3geo/temas. Se map=todos, todos os mapas são testados em grupos de 10 em 10 e a miniatura não é gerada. | ||
48 | + | ||
49 | +tipo {string} - (opcional) mini|grande Define o tamanho da imagem que será gerada. Se não for definido, será feito o teste do mapfile. Controla o tamanho da miniatura que deverá ser mostrada. | ||
50 | +*/ | ||
51 | +set_time_limit(300); | ||
52 | +ini_set('max_execution_time', 300); | ||
53 | +include("ms_configura.php"); | ||
54 | +include("classesphp/funcoes_gerais.php"); | ||
55 | +require_once("classesphp/pega_variaveis.php"); | ||
56 | +include_once ("classesphp/carrega_ext.php"); | ||
57 | + | ||
58 | +// | ||
59 | +//carrega o phpmapscript | ||
60 | +// | ||
61 | +if (!function_exists('ms_GetVersion')) | ||
62 | +{ | ||
63 | + if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) | ||
64 | + { | ||
65 | + if(!@dl('php_mapscript_48.dll')) | ||
66 | + dl('php_mapscript.dll'); | ||
67 | + } | ||
68 | + else | ||
69 | + {dl('php_mapscript.so');} | ||
70 | +} | ||
71 | +$versao = versao(); | ||
72 | +$versao = $versao["principal"]; | ||
73 | +ms_ResetErrorList(); | ||
74 | +if(!isset($tipo)) | ||
75 | +{$tipo = "";} | ||
76 | +$arqs = listaArquivos("temas"); | ||
77 | +sort($arqs["arquivos"]); | ||
78 | + | ||
79 | +if ($tipo == "") | ||
80 | +{ | ||
81 | + echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">'; | ||
82 | + echo '<html><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">'; | ||
83 | + echo '<link rel="stylesheet" type="text/css" href="admin/html/admin.css">'; | ||
84 | + echo '<style>body {COLOR: #2F4632;text-align: justify;font-size: 12px;font-family: Verdana, Arial, Helvetica, sans-serif;}</style>'; | ||
85 | + | ||
86 | + echo '</head><script>function roda(){window.location.href = "?map="+document.getElementById("nomemap").value;}</script>'; | ||
87 | + echo '<body class="fundoPonto"><center><div class="bordaSuperior" > </div><div class="mascaraPrincipal" id="divGeral">'; | ||
88 | + echo '<form action="testamapfile.php" method="post" id=f >'; | ||
89 | + echo 'Nome do arquivo map existente no diretório i3geo/temas. Exemplo para uso manual da URL: testamapfile.php?map=biomashp (utilize "testamapfile.php?map=todos" na URL para testar todos de uma só vez)<br><br>'; | ||
90 | + echo '<br>Mostra apenas a legenda? <input type=radio name=solegenda value=sim />sim <input type=radio name=solegenda value=nao CHECKED /> não<br>'; | ||
91 | + $combo = "<br><select onchange='roda()' id=nomemap ><option value=''>Escolha o arquivo para testar</option>"; | ||
92 | + foreach ($arqs["arquivos"] as $arq){ | ||
93 | + $temp = explode(".",$arq); | ||
94 | + if($temp[1] == "map" || $temp[1] == "gvp"){ | ||
95 | + $combo .= "<option value='".$temp[0]."'>".$temp[0]."</option>"; | ||
96 | + } | ||
97 | + } | ||
98 | + echo $combo."</select></form><br>"; | ||
99 | +} | ||
100 | +if (isset($map) && $map != "") | ||
101 | +{ | ||
102 | + if(!isset($solegenda)){$solegenda = "nao";} | ||
103 | + if ($map == "todos") | ||
104 | + { | ||
105 | + $tipo = "todos"; | ||
106 | + $conta = 0; | ||
107 | + echo "<br>Número de mapas = ".(count($arqs["arquivos"]))." Faltam= ".(count($arqs["arquivos"])-$iniciar-10)."<br>"; | ||
108 | + if (!isset($iniciar)){$iniciar = 0;} | ||
109 | + foreach ($arqs["arquivos"] as $arq) | ||
110 | + { | ||
111 | + if (($conta >= $iniciar) && ($conta < $iniciar+10)){ | ||
112 | + //arquivos php so sao validos se estiverem em i3geo/temas | ||
113 | + verifica($arq,$solegenda); | ||
114 | + } | ||
115 | + $conta++; | ||
116 | + } | ||
117 | + echo "<hr><br><br><a href='testamapfile.php?map=todos&iniciar=".($iniciar+10)."' >Próximos mapas</a>"; | ||
118 | + } | ||
119 | + else | ||
120 | + {verifica($map,$solegenda);} | ||
121 | +} | ||
122 | +echo '</div>'; | ||
123 | +echo '<script>if(screen.availWidth > 700){document.getElementById("divGeral").style.width = "700px";}</script>'; | ||
124 | +echo '</body></html>'; | ||
125 | +function verifica($map,$solegenda){ | ||
126 | + global $tipo,$locaplic,$postgis_mapa,$versao,$base,$dir_tmp; | ||
127 | + $mapUrl = $map; | ||
128 | + if ($tipo == "mini" && file_exists('temas/miniaturas/'.$map.".mini.png")){ | ||
129 | + Header("Content-type: image/png"); | ||
130 | + ImagePng(ImageCreateFromPNG('temas/miniaturas/'.$map.".mini.png")); | ||
131 | + exit; | ||
132 | + } | ||
133 | + if ($tipo == "grande" && file_exists('temas/miniaturas/'.$map.".grande.png")){ | ||
134 | + Header("Content-type: image/png"); | ||
135 | + ImagePng(ImageCreateFromPNG('temas/miniaturas/'.$map.".grande.png")); | ||
136 | + exit; | ||
137 | + } | ||
138 | + ms_ResetErrorList(); | ||
139 | + $tema = ""; | ||
140 | + if(file_exists($map)){ | ||
141 | + $tema = $map; | ||
142 | + } | ||
143 | + else{ | ||
144 | + $map = str_replace("\\","/",$map); | ||
145 | + $map = basename($map); | ||
146 | + if (file_exists('temas/'.$map)) | ||
147 | + {$tema = 'temas/'.$map;} | ||
148 | + if (file_exists('temas/'.$map.'.map')) | ||
149 | + {$tema = 'temas/'.$map.".map";} | ||
150 | + if (file_exists('temas/'.$map.'.php')) | ||
151 | + {$tema = 'temas/'.$map.".php";} | ||
152 | if (file_exists('temas/'.$map.'.gvp')) | 152 | if (file_exists('temas/'.$map.'.gvp')) |
153 | - {$tema = 'temas/'.$map.".gvp";} | ||
154 | - } | ||
155 | - if(!file_exists($tema)){ | ||
156 | - $tema = $locaplic."/".$tema; | ||
157 | - } | ||
158 | - if(($tipo == "") || ($tipo == "todos")){ | ||
159 | - echo "<hr><br><br><span style='color:red' ><b>Testando: $tema </span><pre></b>"; | ||
160 | - } | ||
161 | - if(!file_exists($tema)){ | ||
162 | - echo "Arquivo ".$map." não encontrado."; | ||
163 | - exit; | ||
164 | - } | ||
165 | - if ($tema != ""){ | ||
166 | - if($base == "" or !isset($base)){ | ||
167 | - $base = ""; | ||
168 | - if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')){ | ||
169 | - $base = $locaplic."/aplicmap/geral1windowsv".$versao.".map"; | ||
170 | - } | ||
171 | - else{ | ||
172 | - if($base == "" && file_exists('/var/www/i3geo/aplicmap/geral1debianv'.$versao.'.map')){ | ||
173 | - $base = "/var/www/i3geo/aplicmap/geral1debianv".$versao.".map"; | ||
174 | - } | ||
175 | - if($base == "" && file_exists('/var/www/html/i3geo/aplicmap/geral1fedorav'.$versao.'.map')){ | ||
176 | - $base = "/var/www/html/i3geo/aplicmap/geral1fedorav".$versao.".map"; | ||
177 | - } | ||
178 | - if($base == "" && file_exists('/opt/www/html/i3geo/aplicmap/geral1fedorav'.$versao.'.map')){ | ||
179 | - $base = "/opt/www/html/i3geo/aplicmap/geral1v".$versao.".map"; | ||
180 | - } | ||
181 | - if($base == ""){ | ||
182 | - $base = $locaplic."/aplicmap/geral1v".$versao.".map"; | ||
183 | - } | ||
184 | - } | ||
185 | - } | ||
186 | - else{ | ||
187 | - if(!file_exists($base)){ | ||
188 | - $base = $locaplic."/aplicmap/".$base; | ||
189 | - } | ||
190 | - } | ||
191 | - //echo $base;exit; | ||
192 | - $mapa = ms_newMapObj($base); | ||
193 | - error_reporting(0); | ||
194 | - $numlayers = $mapa->numlayers; | ||
195 | - for ($i=0;$i < $numlayers;$i++){ | ||
196 | - $layern = $mapa->getlayer($i); | ||
197 | - if (!empty($postgis_mapa)){ | ||
198 | - if ($layern->connectiontype == MS_POSTGIS){ | ||
199 | - $lcon = $layern->connection; | ||
200 | - if (($lcon == " ") || ($lcon == "") || (in_array($lcon,array_keys($postgis_mapa)))){ | ||
201 | - if(($lcon == " ") || ($lcon == "")) //para efeitos de compatibilidade | ||
202 | - {$layern->set("connection",$postgis_mapa);} | ||
203 | - else{ | ||
204 | - $layern->set("connection",$postgis_mapa[$lcon]); | ||
205 | - } | ||
206 | - } | ||
207 | - } | ||
208 | - } | ||
209 | - } | ||
210 | - if(!stristr($tema, '.php') === FALSE){ | ||
211 | - echo "<br>Arquivo <i>$tema</i> é um programa PHP. O teste pode não funcionar.<br>"; | ||
212 | - include_once($locaplic."/".$tema); | ||
213 | - // | ||
214 | - //$pegarext deve guardar o nome da camada para ser usado mais abaixo | ||
215 | - // | ||
216 | - $pegarext = str_replace(".php","",$tema); | ||
217 | - $pegarext = str_replace("temas/","",$pegarext); | ||
218 | - eval($pegarext."(\$mapa);"); | ||
219 | - } | ||
220 | - if(!stristr($tema, '.map') === FALSE){ | ||
221 | - if(file_exists($mapUrl)){ | ||
222 | - if(@ms_newMapObj($mapUrl)){ | ||
223 | - $nmapa = ms_newMapObj($mapUrl); | ||
224 | - } | ||
225 | - else{ | ||
226 | - echo "Erro no arquivo $mapUrl <br>"; | ||
227 | - $error = ms_GetErrorObj(); | ||
228 | - while($error && $error->code != MS_NOERR){ | ||
229 | - printf("<br>Error in %s: %s<br>\n", $error->routine, $error->message); | ||
230 | - $error = $error->next(); | ||
231 | - } | ||
232 | - return; | ||
233 | - } | ||
234 | - } | ||
235 | - else{ | ||
236 | - if(@ms_newMapObj($locaplic."/".$tema)){ | ||
237 | - if(!function_exists("validaAcessoTemas")){ | ||
238 | - include($locaplic."/classesphp/funcoes_gerais.php"); | ||
239 | - } | ||
240 | - if(validaAcessoTemas($locaplic."/".$tema,false) == false){ | ||
241 | - $nmapa = ms_newMapObj($locaplic."/".$tema); | ||
242 | - } | ||
243 | - else{ | ||
244 | - echo "tema restrito <br>"; | ||
245 | - exit; | ||
246 | - } | ||
247 | - } | ||
248 | - else{ | ||
249 | - echo "erro no arquivo $map <br>"; | ||
250 | - echo "Obs.: em alguns testes o mapfile pode falhar se o endereço dos arquivos de símbolos estiverem <br>definidos de forma relativa ao invés de absoluta. Nesses casos, ao abrir o i3Geo, <br>o mapfile poderá funcionar. <br>"; | ||
251 | - $error = ms_GetErrorObj(); | ||
252 | - while($error && $error->code != MS_NOERR){ | ||
253 | - printf("<br>Error in %s: %s<br>\n", $error->routine, $error->message); | ||
254 | - $error = $error->next(); | ||
255 | - } | ||
256 | - return; | ||
257 | - } | ||
258 | - } | ||
259 | - $numlayers = $nmapa->numlayers; | ||
260 | - $dados = ""; | ||
261 | - $simbolos = array(); | ||
262 | - for ($i=0;$i < $numlayers;$i++){ | ||
263 | - $layern = $nmapa->getlayer($i); | ||
264 | - $layern->set("status",MS_DEFAULT); | ||
265 | - if (!empty($postgis_mapa)){ | ||
266 | - if ($layern->connectiontype == MS_POSTGIS){ | ||
267 | - $lcon = $layern->connection; | ||
268 | - error_reporting(0); | ||
269 | - if (($lcon == " ") || ($lcon == "") || (in_array($lcon,array_keys($postgis_mapa)))){ | ||
270 | - if(($lcon == " ") || ($lcon == "")) //para efeitos de compatibilidade | ||
271 | - {$layern->set("connection",$postgis_mapa);} | ||
272 | - else | ||
273 | - {$layern->set("connection",$postgis_mapa[$lcon]);} | ||
274 | - } | ||
275 | - } | ||
276 | - } | ||
277 | - autoClasses($layern,$nmapa); | ||
278 | - error_reporting(0); | ||
279 | - if($layern->classitem != "" && $layern->connectiontype == 7 && $layern->numclasses > 0 && $layern->getmetadata("wms_sld_body") == ""){ | ||
280 | - $tipotemp = $layern->type; | ||
281 | - $tiporep = $layern->getmetadata("tipooriginal"); | ||
282 | - $layern->set("type",MS_LAYER_POLYGON); | ||
283 | - if ($tiporep == "linear"){ | ||
284 | - $layern->set("type",MS_LAYER_LINE); | ||
285 | - } | ||
286 | - if ($tiporep == "pontual"){ | ||
287 | - $layern->set("type",MS_LAYER_POINT); | ||
288 | - } | ||
289 | - $sld = $layern->generateSLD(); | ||
290 | - if($sld != ""){ | ||
291 | - $layern->setmetadata("wms_sld_body",str_replace('"',"'",$sld)); | ||
292 | - } | ||
293 | - $layern->set("type",$tipotemp); | ||
294 | - } | ||
295 | - ms_newLayerObj($mapa, $layern); | ||
296 | - | ||
297 | - //pega simbolos locais e aplica no novo mapa | ||
298 | - $numclasses = $layern->numclasses; | ||
299 | - for($ci=0;$ci < $numclasses;$ci++){ | ||
300 | - $classe = $layern->getclass($ci); | ||
301 | - $numestilos = $classe->numstyles; | ||
302 | - for($ei=0;$ei < $numestilos;$ei++){ | ||
303 | - $estilo = $classe->getstyle($ei); | ||
304 | - if($estilo->symbolname != ""){ | ||
305 | - $nomesimbolo = $estilo->symbolname; | ||
306 | - $simbolo = new symbolObj($nmapa, $nomesimbolo); | ||
307 | - $ipath = $simbolo->imagepath; | ||
308 | - if(ms_newSymbolObj($nmapa, $nomesimbolo) != ms_newSymbolObj($mapa, $nomesimbolo)+1){ | ||
309 | - $simbolon = new symbolObj($mapa, $nomesimbolo); | ||
310 | - $simbolon->set("inmapfile",MS_TRUE); | ||
311 | - $simbolon->setImagePath($ipath); | ||
312 | - } | ||
313 | - //algumas versoes do mapserver nao funciona | ||
314 | - if($simbolon->imagePath != $ipath){ | ||
315 | - $layern->set("status",MS_DELETE); | ||
316 | - } | 153 | + {$tema = 'temas/'.$map.".gvp";} |
154 | + } | ||
155 | + if(!file_exists($tema)){ | ||
156 | + $tema = $locaplic."/".$tema; | ||
157 | + } | ||
158 | + if(($tipo == "") || ($tipo == "todos")){ | ||
159 | + echo "<hr><br><br><span style='color:red' ><b>Testando: $tema </span><pre></b>"; | ||
160 | + } | ||
161 | + if(!file_exists($tema)){ | ||
162 | + echo "Arquivo ".$map." não encontrado."; | ||
163 | + exit; | ||
164 | + } | ||
165 | + if ($tema != ""){ | ||
166 | + if($base == "" or !isset($base)){ | ||
167 | + $base = ""; | ||
168 | + if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')){ | ||
169 | + $base = $locaplic."/aplicmap/geral1windowsv".$versao.".map"; | ||
170 | + } | ||
171 | + else{ | ||
172 | + if($base == "" && file_exists('/var/www/i3geo/aplicmap/geral1debianv'.$versao.'.map')){ | ||
173 | + $base = "/var/www/i3geo/aplicmap/geral1debianv".$versao.".map"; | ||
174 | + } | ||
175 | + if($base == "" && file_exists('/var/www/html/i3geo/aplicmap/geral1fedorav'.$versao.'.map')){ | ||
176 | + $base = "/var/www/html/i3geo/aplicmap/geral1fedorav".$versao.".map"; | ||
177 | + } | ||
178 | + if($base == "" && file_exists('/opt/www/html/i3geo/aplicmap/geral1fedorav'.$versao.'.map')){ | ||
179 | + $base = "/opt/www/html/i3geo/aplicmap/geral1v".$versao.".map"; | ||
180 | + } | ||
181 | + if($base == ""){ | ||
182 | + $base = $locaplic."/aplicmap/geral1v".$versao.".map"; | ||
183 | + } | ||
184 | + } | ||
185 | + } | ||
186 | + else{ | ||
187 | + if(!file_exists($base)){ | ||
188 | + $base = $locaplic."/aplicmap/".$base; | ||
189 | + } | ||
190 | + } | ||
191 | + //echo $base;exit; | ||
192 | + $mapa = ms_newMapObj($base); | ||
193 | + error_reporting(0); | ||
194 | + $numlayers = $mapa->numlayers; | ||
195 | + for ($i=0;$i < $numlayers;$i++){ | ||
196 | + $layern = $mapa->getlayer($i); | ||
197 | + if (!empty($postgis_mapa)){ | ||
198 | + if ($layern->connectiontype == MS_POSTGIS){ | ||
199 | + $lcon = $layern->connection; | ||
200 | + if (($lcon == " ") || ($lcon == "") || (in_array($lcon,array_keys($postgis_mapa)))){ | ||
201 | + if(($lcon == " ") || ($lcon == "")) //para efeitos de compatibilidade | ||
202 | + {$layern->set("connection",$postgis_mapa);} | ||
203 | + else{ | ||
204 | + $layern->set("connection",$postgis_mapa[$lcon]); | ||
205 | + } | ||
206 | + } | ||
207 | + } | ||
208 | + } | ||
209 | + } | ||
210 | + if(!stristr($tema, '.php') === FALSE){ | ||
211 | + echo "<br>Arquivo <i>$tema</i> é um programa PHP. O teste pode não funcionar.<br>"; | ||
212 | + include_once($locaplic."/".$tema); | ||
213 | + // | ||
214 | + //$pegarext deve guardar o nome da camada para ser usado mais abaixo | ||
215 | + // | ||
216 | + $pegarext = str_replace(".php","",$tema); | ||
217 | + $pegarext = str_replace("temas/","",$pegarext); | ||
218 | + eval($pegarext."(\$mapa);"); | ||
219 | + } | ||
220 | + if(!stristr($tema, '.map') === FALSE){ | ||
221 | + if(file_exists($mapUrl)){ | ||
222 | + if(@ms_newMapObj($mapUrl)){ | ||
223 | + $nmapa = ms_newMapObj($mapUrl); | ||
224 | + } | ||
225 | + else{ | ||
226 | + echo "Erro no arquivo $mapUrl <br>"; | ||
227 | + $error = ms_GetErrorObj(); | ||
228 | + while($error && $error->code != MS_NOERR){ | ||
229 | + printf("<br>Error in %s: %s<br>\n", $error->routine, $error->message); | ||
230 | + $error = $error->next(); | ||
231 | + } | ||
232 | + return; | ||
233 | + } | ||
234 | + } | ||
235 | + else{ | ||
236 | + if(@ms_newMapObj($locaplic."/".$tema)){ | ||
237 | + if(!function_exists("validaAcessoTemas")){ | ||
238 | + include($locaplic."/classesphp/funcoes_gerais.php"); | ||
239 | + } | ||
240 | + if(validaAcessoTemas($locaplic."/".$tema,false) == false){ | ||
241 | + $nmapa = ms_newMapObj($locaplic."/".$tema); | ||
242 | + } | ||
243 | + else{ | ||
244 | + echo "tema restrito <br>"; | ||
245 | + exit; | ||
246 | + } | ||
247 | + } | ||
248 | + else{ | ||
249 | + echo "erro no arquivo $map <br>"; | ||
250 | + echo "Obs.: em alguns testes o mapfile pode falhar se o endereço dos arquivos de símbolos estiverem <br>definidos de forma relativa ao invés de absoluta. Nesses casos, ao abrir o i3Geo, <br>o mapfile poderá funcionar. <br>"; | ||
251 | + $error = ms_GetErrorObj(); | ||
252 | + while($error && $error->code != MS_NOERR){ | ||
253 | + printf("<br>Error in %s: %s<br>\n", $error->routine, $error->message); | ||
254 | + $error = $error->next(); | ||
255 | + } | ||
256 | + return; | ||
257 | + } | ||
258 | + } | ||
259 | + $numlayers = $nmapa->numlayers; | ||
260 | + $dados = ""; | ||
261 | + $simbolos = array(); | ||
262 | + for ($i=0;$i < $numlayers;$i++){ | ||
263 | + $layern = $nmapa->getlayer($i); | ||
264 | + $layern->set("status",MS_DEFAULT); | ||
265 | + if (!empty($postgis_mapa)){ | ||
266 | + if ($layern->connectiontype == MS_POSTGIS){ | ||
267 | + $lcon = $layern->connection; | ||
268 | + error_reporting(0); | ||
269 | + if (($lcon == " ") || ($lcon == "") || (in_array($lcon,array_keys($postgis_mapa)))){ | ||
270 | + if(($lcon == " ") || ($lcon == "")) //para efeitos de compatibilidade | ||
271 | + {$layern->set("connection",$postgis_mapa);} | ||
272 | + else | ||
273 | + {$layern->set("connection",$postgis_mapa[$lcon]);} | ||
317 | } | 274 | } |
318 | } | 275 | } |
319 | - } | ||
320 | - | ||
321 | - if ($layern->data == ""){ | ||
322 | - $dados = $layern->connection; | ||
323 | - } | ||
324 | - else{ | ||
325 | - $dados = $layern->data; | ||
326 | - } | ||
327 | - $pegarext = $layern->name; | ||
328 | - } | ||
329 | - zoomTema($pegarext,$mapa); | ||
330 | - } | ||
331 | - if(!stristr($tema, '.gvp') === FALSE){ | 276 | + } |
277 | + autoClasses($layern,$nmapa); | ||
278 | + error_reporting(0); | ||
279 | + if($layern->classitem != "" && $layern->connectiontype == 7 && $layern->numclasses > 0 && $layern->getmetadata("wms_sld_body") == ""){ | ||
280 | + $tipotemp = $layern->type; | ||
281 | + $tiporep = $layern->getmetadata("tipooriginal"); | ||
282 | + $layern->set("type",MS_LAYER_POLYGON); | ||
283 | + if ($tiporep == "linear"){ | ||
284 | + $layern->set("type",MS_LAYER_LINE); | ||
285 | + } | ||
286 | + if ($tiporep == "pontual"){ | ||
287 | + $layern->set("type",MS_LAYER_POINT); | ||
288 | + } | ||
289 | + $sld = $layern->generateSLD(); | ||
290 | + if($sld != ""){ | ||
291 | + $layern->setmetadata("wms_sld_body",str_replace('"',"'",$sld)); | ||
292 | + } | ||
293 | + $layern->set("type",$tipotemp); | ||
294 | + } | ||
295 | + //pega simbolos locais e aplica no novo mapa | ||
296 | + cloneInlineSymbol($layern,$nmapa,$mapa); | ||
297 | + ms_newLayerObj($mapa, $layern); | ||
298 | + if ($layern->data == ""){ | ||
299 | + $dados = $layern->connection; | ||
300 | + } | ||
301 | + else{ | ||
302 | + $dados = $layern->data; | ||
303 | + } | ||
304 | + $pegarext = $layern->name; | ||
305 | + } | ||
306 | + zoomTema($pegarext,$mapa); | ||
307 | + } | ||
308 | + if(!stristr($tema, '.gvp') === FALSE){ | ||
332 | if(file_exists($mapUrl)){ | 309 | if(file_exists($mapUrl)){ |
333 | $gvsiggvp = $mapUrl; | 310 | $gvsiggvp = $mapUrl; |
334 | } | 311 | } |
335 | else{ | 312 | else{ |
336 | $gvsiggvp = $locaplic."/".$tema; | 313 | $gvsiggvp = $locaplic."/".$tema; |
337 | - } | 314 | + } |
338 | include_once($locaplic."/pacotes/gvsig/gvsig2mapfile/class.gvsig2mapfile.php"); | 315 | include_once($locaplic."/pacotes/gvsig/gvsig2mapfile/class.gvsig2mapfile.php"); |
339 | - $gm = new gvsig2mapfile($gvsiggvp); | 316 | + $gm = new gvsig2mapfile($gvsiggvp); |
340 | $gvsigview = $gm->getViewsNames(); | 317 | $gvsigview = $gm->getViewsNames(); |
341 | - foreach($gvsigview as $v){ | 318 | + foreach($gvsigview as $v){ |
342 | $dataView = $gm->getViewData($v); | 319 | $dataView = $gm->getViewData($v); |
343 | - $mapa = $gm->addLayers($mapa,$v,$dataView["layerNames"]); | ||
344 | - } | 320 | + $mapa = $gm->addLayers($mapa,$v,$dataView["layerNames"]); |
321 | + } | ||
345 | $next = $dataView["extent"]; | 322 | $next = $dataView["extent"]; |
346 | $ext = $mapa->extent; | 323 | $ext = $mapa->extent; |
347 | $ext->setextent($next[0],$next[1],$next[2],$next[3]); | 324 | $ext->setextent($next[0],$next[1],$next[2],$next[3]); |
348 | - | ||
349 | - } | ||
350 | - if ($tipo == "mini"){ | ||
351 | - $mapa->setsize(50,50); | ||
352 | - $sca = $mapa->scalebar; | ||
353 | - $sca->set("status",MS_OFF); | ||
354 | - } | ||
355 | - if ($tipo == "grande"){ | ||
356 | - $mapa->setsize(300,300); | ||
357 | - $sca = $mapa->scalebar; | ||
358 | - $sca->set("status",MS_OFF); | ||
359 | - } | ||
360 | - if($tipo == "todos"){ | ||
361 | - $mapa->setsize(150,150); | ||
362 | - $sca = $mapa->scalebar; | ||
363 | - $sca->set("status",MS_OFF); | ||
364 | - } | ||
365 | - $destino = $dir_tmp."/".nomeRandomico().".map"; | ||
366 | - echo $destino;exit; | ||
367 | - $mapa->save($destino); | ||
368 | - | ||
369 | - $mapa = ms_newMapObj($destino); | ||
370 | - $objImagem = @$mapa->draw(); | ||
371 | - $objImagemLegenda = @$mapa->drawLegend(); | ||
372 | - if (!$objImagem){ | ||
373 | - echo "Problemas ao gerar o mapa<br>"; | ||
374 | - $error = ""; | ||
375 | - $error = ms_GetErrorObj(); | ||
376 | - while($error && $error->code != MS_NOERR){ | ||
377 | - echo "<br>Error in %s: %s<br>", $error->routine, $error->message; | ||
378 | - $error = $error->next(); | ||
379 | - } | ||
380 | - return; | ||
381 | - } | ||
382 | - if($objImagem->imagepath == "") | ||
383 | - {echo "Erro IMAGEPATH vazio";} | ||
384 | - $nomec = ($objImagem->imagepath).nomeRandomico()."teste.png"; | ||
385 | - $objImagem->saveImage($nomec); | ||
386 | - $nomer = ($objImagem->imageurl).basename($nomec); | ||
387 | - | ||
388 | - $nomel = ($objImagemLegenda->imagepath).nomeRandomico()."testel.png"; | ||
389 | - $objImagemLegenda->saveImage($nomel); | ||
390 | - $nomerl = ($objImagemLegenda->imageurl).basename($nomel); | ||
391 | - if(($tipo == "") || ($tipo == "todos")){ | ||
392 | - if($solegenda == "nao") | ||
393 | - {echo "<img src=".$nomer." /><br>";} | ||
394 | - echo "<img src=".$nomerl." />"; | ||
395 | - if($tipo == "todos"){ | ||
396 | - echo "<br>".$dados."<br>"; | ||
397 | - } | ||
398 | - if($map != "todos"){ | ||
399 | - echo "<br>Erros:<br>"; | ||
400 | - $error = ""; | ||
401 | - $error = ms_GetErrorObj(); | ||
402 | - while($error && $error->code != MS_NOERR){ | ||
403 | - echo "<br>Error in %s: %s<br>", $error->routine, $error->message; | ||
404 | - $error = $error->next(); | ||
405 | - } | ||
406 | - } | ||
407 | - | ||
408 | - } | ||
409 | - else{ | ||
410 | - Header("Content-type: image/png"); | ||
411 | - ImagePng(ImageCreateFromPNG($nomec)); | ||
412 | - } | ||
413 | - //$objImagem->free(); | ||
414 | - } | ||
415 | -} | ||
416 | -function zoomTema($nomelayer,&$mapa){ | ||
417 | - $layer = $mapa->getlayerbyname($nomelayer); | ||
418 | - if($layer->data == "" && $layer->connection == "") | ||
419 | - {return;} | ||
420 | - $prjMapa = $mapa->getProjection(); | ||
421 | - $prjTema = $layer->getProjection(); | ||
422 | - $extatual = $mapa->extent; | ||
423 | - $ret = $layer->getmetadata("extensao"); | ||
424 | - if($layer->type > 2 && $ret == "") | ||
425 | - {return;} | ||
426 | - $ct = $layer->connectiontype; | ||
427 | - if(($ret == "") && ($ct != 1)) | ||
428 | - {return;} | ||
429 | - if ($ret == ""){ | ||
430 | - $ret = $layer->getextent(); | ||
431 | - //reprojeta o retangulo | ||
432 | - if (($prjTema != "") && ($prjMapa != $prjTema)){ | ||
433 | - $projInObj = ms_newprojectionobj($prjTema); | ||
434 | - $projOutObj = ms_newprojectionobj($prjMapa); | ||
435 | - $ret->project($projInObj, $projOutObj); | ||
436 | - } | ||
437 | - $extatual->setextent($ret->minx,$ret->miny,$ret->maxx,$ret->maxy); | ||
438 | - } | ||
439 | - else{ | ||
440 | - $ret = explode(" ",$ret); | ||
441 | - $extatual->setextent($ret[0],$ret[1],$ret[2],$ret[3]); | ||
442 | - } | ||
443 | -} | ||
444 | -?> | 325 | + |
326 | + } | ||
327 | + if ($tipo == "mini"){ | ||
328 | + $mapa->setsize(50,50); | ||
329 | + $sca = $mapa->scalebar; | ||
330 | + $sca->set("status",MS_OFF); | ||
331 | + } | ||
332 | + if ($tipo == "grande"){ | ||
333 | + $mapa->setsize(300,300); | ||
334 | + $sca = $mapa->scalebar; | ||
335 | + $sca->set("status",MS_OFF); | ||
336 | + } | ||
337 | + if($tipo == "todos"){ | ||
338 | + $mapa->setsize(150,150); | ||
339 | + $sca = $mapa->scalebar; | ||
340 | + $sca->set("status",MS_OFF); | ||
341 | + } | ||
342 | + $destino = $dir_tmp."/".nomeRandomico().".map"; | ||
343 | + | ||
344 | + $mapa->save($destino); | ||
345 | + //echo $destino;exit; | ||
346 | + $mapa = ms_newMapObj($destino); | ||
347 | + $objImagem = @$mapa->draw(); | ||
348 | + $objImagemLegenda = @$mapa->drawLegend(); | ||
349 | + if (!$objImagem){ | ||
350 | + echo "Problemas ao gerar o mapa<br>"; | ||
351 | + $error = ""; | ||
352 | + $error = ms_GetErrorObj(); | ||
353 | + while($error && $error->code != MS_NOERR){ | ||
354 | + echo "<br>Error in %s: %s<br>", $error->routine, $error->message; | ||
355 | + $error = $error->next(); | ||
356 | + } | ||
357 | + return; | ||
358 | + } | ||
359 | + if($objImagem->imagepath == "") | ||
360 | + {echo "Erro IMAGEPATH vazio";} | ||
361 | + $nomec = ($objImagem->imagepath).nomeRandomico()."teste.png"; | ||
362 | + $objImagem->saveImage($nomec); | ||
363 | + $nomer = ($objImagem->imageurl).basename($nomec); | ||
364 | + | ||
365 | + $nomel = ($objImagemLegenda->imagepath).nomeRandomico()."testel.png"; | ||
366 | + $objImagemLegenda->saveImage($nomel); | ||
367 | + $nomerl = ($objImagemLegenda->imageurl).basename($nomel); | ||
368 | + if(($tipo == "") || ($tipo == "todos")){ | ||
369 | + if($solegenda == "nao") | ||
370 | + {echo "<img src=".$nomer." /><br>";} | ||
371 | + echo "<img src=".$nomerl." />"; | ||
372 | + if($tipo == "todos"){ | ||
373 | + echo "<br>".$dados."<br>"; | ||
374 | + } | ||
375 | + if($map != "todos"){ | ||
376 | + echo "<br>Erros:<br>"; | ||
377 | + $error = ""; | ||
378 | + $error = ms_GetErrorObj(); | ||
379 | + while($error && $error->code != MS_NOERR){ | ||
380 | + echo "<br>Error in %s: %s<br>", $error->routine, $error->message; | ||
381 | + $error = $error->next(); | ||
382 | + } | ||
383 | + } | ||
384 | + | ||
385 | + } | ||
386 | + else{ | ||
387 | + Header("Content-type: image/png"); | ||
388 | + ImagePng(ImageCreateFromPNG($nomec)); | ||
389 | + } | ||
390 | + //$objImagem->free(); | ||
391 | + } | ||
392 | +} | ||
393 | +function zoomTema($nomelayer,&$mapa){ | ||
394 | + $layer = $mapa->getlayerbyname($nomelayer); | ||
395 | + if($layer->data == "" && $layer->connection == "") | ||
396 | + {return;} | ||
397 | + $prjMapa = $mapa->getProjection(); | ||
398 | + $prjTema = $layer->getProjection(); | ||
399 | + $extatual = $mapa->extent; | ||
400 | + $ret = $layer->getmetadata("extensao"); | ||
401 | + if($layer->type > 2 && $ret == "") | ||
402 | + {return;} | ||
403 | + $ct = $layer->connectiontype; | ||
404 | + if(($ret == "") && ($ct != 1)) | ||
405 | + {return;} | ||
406 | + if ($ret == ""){ | ||
407 | + $ret = $layer->getextent(); | ||
408 | + //reprojeta o retangulo | ||
409 | + if (($prjTema != "") && ($prjMapa != $prjTema)){ | ||
410 | + $projInObj = ms_newprojectionobj($prjTema); | ||
411 | + $projOutObj = ms_newprojectionobj($prjMapa); | ||
412 | + $ret->project($projInObj, $projOutObj); | ||
413 | + } | ||
414 | + $extatual->setextent($ret->minx,$ret->miny,$ret->maxx,$ret->maxy); | ||
415 | + } | ||
416 | + else{ | ||
417 | + $ret = explode(" ",$ret); | ||
418 | + $extatual->setextent($ret[0],$ret[1],$ret[2],$ret[3]); | ||
419 | + } | ||
420 | +} | ||
421 | +?> | ||
445 | \ No newline at end of file | 422 | \ No newline at end of file |