Commit 2f2e76cbe6dd9ef764556add34f3707b5512e85e
1 parent
0200677e
Exists in
master
and in
7 other branches
--no commit message
Showing
2 changed files
with
644 additions
and
458 deletions
Show diff stats
classesphp/classe_mapa.php
1 | <?php | 1 | <?php |
2 | /* | 2 | /* |
3 | -Title: classe_mapa.php | 3 | + Title: classe_mapa.php |
4 | 4 | ||
5 | Manipulação do mapa. Altera tamanho, lista temas, etc. | 5 | Manipulação do mapa. Altera tamanho, lista temas, etc. |
6 | 6 | ||
@@ -22,7 +22,7 @@ por&eacute;m, SEM NENHUMA GARANTIA; nem mesmo a garantia impl&iacute;cita | @@ -22,7 +22,7 @@ por&eacute;m, SEM NENHUMA GARANTIA; nem mesmo a garantia impl&iacute;cita | ||
22 | de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | 22 | de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. |
23 | Consulte a Licença Pública Geral do GNU para mais detalhes. | 23 | Consulte a Licença Pública Geral do GNU para mais detalhes. |
24 | Você deve ter recebido uma cópia da Licença Pública Geral do | 24 | Você deve ter recebido uma cópia da Licença Pública Geral do |
25 | -GNU junto com este programa; se não, escreva para a | 25 | + GNU junto com este programa; se não, escreva para a |
26 | Free Software Foundation, Inc., no endereço | 26 | Free Software Foundation, Inc., no endereço |
27 | 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | 27 | 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. |
28 | 28 | ||
@@ -31,74 +31,80 @@ Arquivo: | @@ -31,74 +31,80 @@ Arquivo: | ||
31 | i3geo/classesphp/classe_mapa.php | 31 | i3geo/classesphp/classe_mapa.php |
32 | */ | 32 | */ |
33 | /* | 33 | /* |
34 | -Classe: Mapa | 34 | + Classe: Mapa |
35 | */ | 35 | */ |
36 | class Mapa | 36 | class Mapa |
37 | { | 37 | { |
38 | /* | 38 | /* |
39 | - Variavel: $mapa | 39 | + Variavel: $mapa |
40 | 40 | ||
41 | Objeto mapa | 41 | Objeto mapa |
42 | */ | 42 | */ |
43 | public $mapa; | 43 | public $mapa; |
44 | /* | 44 | /* |
45 | - Variavel: $arquivo | 45 | + Variavel: $arquivo |
46 | 46 | ||
47 | Arquivo map file | 47 | Arquivo map file |
48 | */ | 48 | */ |
49 | public $arquivo; | 49 | public $arquivo; |
50 | /* | 50 | /* |
51 | - Variavel: $layers | 51 | + Variavel: $layers |
52 | 52 | ||
53 | Objetos layers | 53 | Objetos layers |
54 | */ | 54 | */ |
55 | public $layers; | 55 | public $layers; |
56 | /* | 56 | /* |
57 | - Variavel: $qyfile | 57 | + Variavel: $qyfile |
58 | 58 | ||
59 | Nome do arquivo de seleção (.qy) | 59 | Nome do arquivo de seleção (.qy) |
60 | */ | 60 | */ |
61 | public $qyfile; | 61 | public $qyfile; |
62 | /* | 62 | /* |
63 | - Variavel: $v | 63 | + Variavel: $v |
64 | 64 | ||
65 | Versão atual do Mapserver (primeiro dígito) | 65 | Versão atual do Mapserver (primeiro dígito) |
66 | */ | 66 | */ |
67 | public $v; | 67 | public $v; |
68 | /* | 68 | /* |
69 | - Variavel: $vi | 69 | + Variavel: $vi |
70 | 70 | ||
71 | Versão atual do Mapserver (valor inteiro) | 71 | Versão atual do Mapserver (valor inteiro) |
72 | 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 | 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 | */ | 74 | */ |
75 | public $vi; | 75 | public $vi; |
76 | -/* | ||
77 | -Function: __construct | 76 | + /* |
77 | + Function: __construct | ||
78 | 78 | ||
79 | -Cria um objeto mapa | 79 | + Cria um objeto mapa |
80 | 80 | ||
81 | -parameters: | 81 | + parameters: |
82 | 82 | ||
83 | -$map_file - Endereço do mapfile no servidor. | ||
84 | -*/ | 83 | + $map_file - Endereço do mapfile no servidor. |
84 | + */ | ||
85 | function __construct($map_file,$locaplic="") | 85 | function __construct($map_file,$locaplic="") |
86 | { | 86 | { |
87 | - error_reporting(0); | ||
88 | - if (!function_exists('ms_newMapObj')) {return false;} | ||
89 | - if(file_exists($locaplic."/funcoes_gerais.php")) | 87 | + error_reporting(0); |
88 | + if (!function_exists('ms_newMapObj')) { | ||
89 | + return false; | ||
90 | + } | ||
91 | + if(file_exists($locaplic."/funcoes_gerais.php")) | ||
90 | include_once($locaplic."/funcoes_gerais.php"); | 92 | include_once($locaplic."/funcoes_gerais.php"); |
91 | - else | 93 | + else |
92 | include_once("funcoes_gerais.php"); | 94 | include_once("funcoes_gerais.php"); |
93 | $this->v = versao(); | 95 | $this->v = versao(); |
94 | $this->vi = $this->v["inteiro"]; | 96 | $this->vi = $this->v["inteiro"]; |
95 | $this->v = $this->v["principal"]; | 97 | $this->v = $this->v["principal"]; |
96 | $this->qyfile = str_replace(".map",".qy",$map_file); | 98 | $this->qyfile = str_replace(".map",".qy",$map_file); |
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;} | 99 | + $this->locaplic = $locaplic; |
100 | + if(!file_exists($map_file)) | ||
101 | + { | ||
102 | + return $this->arquivo = false; | ||
103 | + } | ||
104 | + if(!@ms_newMapObj($map_file)) | ||
105 | + { | ||
106 | + return $this->mapa = false; | ||
107 | + } | ||
102 | $this->mapa = @ms_newMapObj($map_file); | 108 | $this->mapa = @ms_newMapObj($map_file); |
103 | $this->arquivo = $map_file; | 109 | $this->arquivo = $map_file; |
104 | $c = $this->mapa->numlayers; | 110 | $c = $this->mapa->numlayers; |
@@ -108,81 +114,91 @@ $map_file - Endere&ccedil;o do mapfile no servidor. | @@ -108,81 +114,91 @@ $map_file - Endere&ccedil;o do mapfile no servidor. | ||
108 | $this->nomes[] = $l->name; | 114 | $this->nomes[] = $l->name; |
109 | } | 115 | } |
110 | } | 116 | } |
111 | -/* | ||
112 | -Method: salva | 117 | + /* |
118 | + Method: salva | ||
113 | 119 | ||
114 | -Salva o mapfile atual | ||
115 | -*/ | 120 | + Salva o mapfile atual |
121 | + */ | ||
116 | function salva() | 122 | function salva() |
117 | { | 123 | { |
118 | - if(connection_aborted()){exit();} | ||
119 | - $this->mapa->save($this->arquivo); | 124 | + if(connection_aborted()){ |
125 | + exit(); | ||
126 | + } | ||
127 | + $this->mapa->save($this->arquivo); | ||
120 | } | 128 | } |
121 | -/* | ||
122 | -Method: listaTemasBuscaRapida | 129 | + /* |
130 | + Method: listaTemasBuscaRapida | ||
123 | 131 | ||
124 | -Elabora uma lista de temas e seus respectivos itens para uso no método buscaRegistros da classe classe_atributos | 132 | + Elabora uma lista de temas e seus respectivos itens para uso no método buscaRegistros da classe classe_atributos |
125 | 133 | ||
126 | -<Atributos->buscaRegistros> | 134 | + <Atributos->buscaRegistros> |
127 | 135 | ||
128 | -A lista contém apenas os temas que estão visíveis e que possuem o metadata "itembuscarapida" | 136 | + A lista contém apenas os temas que estão visíveis e que possuem o metadata "itembuscarapida" |
129 | 137 | ||
130 | -Retorno: | 138 | + Retorno: |
131 | 139 | ||
132 | -{string} - Lista de busca no formato item;tema,item;tema | ||
133 | -*/ | 140 | + {string} - Lista de busca no formato item;tema,item;tema |
141 | + */ | ||
134 | function listaTemasBuscaRapida(){ | 142 | function listaTemasBuscaRapida(){ |
135 | $lista = array(); | 143 | $lista = array(); |
136 | foreach($this->layers as $l) | 144 | foreach($this->layers as $l) |
137 | { | 145 | { |
138 | $metadata = $l->getmetadata("itembuscarapida"); | 146 | $metadata = $l->getmetadata("itembuscarapida"); |
139 | if($metadata != "") | 147 | if($metadata != "") |
140 | - {$lista[] = $metadata.";".$l->name;} | 148 | + { |
149 | + $lista[] = $metadata.";".$l->name; | ||
150 | + } | ||
141 | } | 151 | } |
142 | return implode(",",$lista); | 152 | return implode(",",$lista); |
143 | } | 153 | } |
144 | -/* | ||
145 | -Method: mudaoutputformat | 154 | + /* |
155 | + Method: mudaoutputformat | ||
146 | 156 | ||
147 | -Muda o OUTPUTFORMAT | 157 | + Muda o OUTPUTFORMAT |
148 | 158 | ||
149 | -Parametro: | 159 | + Parametro: |
150 | 160 | ||
151 | -tipo {string} - OUTPUTFORMAT que será aplicado. deve existir no mapfile básico que iniciou o i3Geo | ||
152 | -*/ | 161 | + tipo {string} - OUTPUTFORMAT que será aplicado. deve existir no mapfile básico que iniciou o i3Geo |
162 | + */ | ||
153 | function mudaoutputformat($tipo) | 163 | function mudaoutputformat($tipo) |
154 | { | 164 | { |
155 | foreach($this->layers as $l) | 165 | foreach($this->layers as $l) |
156 | - {$l->setMetaData("cache","");} | 166 | + { |
167 | + $l->setMetaData("cache",""); | ||
168 | + } | ||
157 | return $this->mapa->selectOutputFormat($tipo); | 169 | return $this->mapa->selectOutputFormat($tipo); |
158 | } | 170 | } |
159 | -/* | ||
160 | -Method: pegaMensagens | 171 | + /* |
172 | + Method: pegaMensagens | ||
161 | 173 | ||
162 | -Pega as mensagens do metadata "mensagem" existentes nos layers do mapa atual | 174 | + Pega as mensagens do metadata "mensagem" existentes nos layers do mapa atual |
163 | 175 | ||
164 | -Return: | 176 | + Return: |
165 | 177 | ||
166 | -{String} | ||
167 | -*/ | 178 | + {String} |
179 | + */ | ||
168 | function pegaMensagens() | 180 | function pegaMensagens() |
169 | { | 181 | { |
170 | $mensagem = ""; | 182 | $mensagem = ""; |
171 | foreach($this->layers as $l) | 183 | foreach($this->layers as $l) |
172 | { | 184 | { |
173 | if($l->status == MS_DEFAULT) | 185 | if($l->status == MS_DEFAULT) |
174 | - {$mensagem .= $l->getmetadata("mensagem");} | 186 | + { |
187 | + $mensagem .= $l->getmetadata("mensagem"); | ||
188 | + } | ||
175 | } | 189 | } |
176 | if (function_exists("mb_convert_encoding")) | 190 | if (function_exists("mb_convert_encoding")) |
177 | - {$mensagem = mb_convert_encoding($mensagem,"UTF-8","ISO-8859-1");} | 191 | + { |
192 | + $mensagem = mb_convert_encoding($mensagem,"UTF-8","ISO-8859-1"); | ||
193 | + } | ||
178 | return ($mensagem); | 194 | return ($mensagem); |
179 | } | 195 | } |
180 | 196 | ||
181 | -/* | ||
182 | -Method: gravaImagemCorpo (depreciado) | 197 | + /* |
198 | + Method: gravaImagemCorpo (depreciado) | ||
183 | 199 | ||
184 | -Grava a imagem do mapa atual | ||
185 | -*/ | 200 | + Grava a imagem do mapa atual |
201 | + */ | ||
186 | function gravaImagemCorpo() | 202 | function gravaImagemCorpo() |
187 | { | 203 | { |
188 | $imgo = $this->mapa->draw(); | 204 | $imgo = $this->mapa->draw(); |
@@ -192,15 +208,15 @@ Grava a imagem do mapa atual | @@ -192,15 +208,15 @@ Grava a imagem do mapa atual | ||
192 | //$imgo->free(); | 208 | //$imgo->free(); |
193 | return ($nome); | 209 | return ($nome); |
194 | } | 210 | } |
195 | -/* | ||
196 | -Method: parametrosTemas | 211 | + /* |
212 | + Method: parametrosTemas | ||
197 | 213 | ||
198 | -Pega os parametros dos layers do mapa. | 214 | + Pega os parametros dos layers do mapa. |
199 | 215 | ||
200 | -return: | 216 | + return: |
201 | 217 | ||
202 | -string - javascript com os parametros | ||
203 | -*/ | 218 | + string - javascript com os parametros |
219 | + */ | ||
204 | function parametrosTemas() | 220 | function parametrosTemas() |
205 | { | 221 | { |
206 | $temas = array(); | 222 | $temas = array(); |
@@ -208,7 +224,9 @@ string - javascript com os parametros | @@ -208,7 +224,9 @@ string - javascript com os parametros | ||
208 | $dir = dirname($this->arquivo); | 224 | $dir = dirname($this->arquivo); |
209 | //$qy = file_exists($this->qyfile); | 225 | //$qy = file_exists($this->qyfile); |
210 | foreach($this->layers as $l) | 226 | foreach($this->layers as $l) |
211 | - {$l->set("template","none.htm");} | 227 | + { |
228 | + $l->set("template","none.htm"); | ||
229 | + } | ||
212 | foreach ($this->layers as $oLayer) | 230 | foreach ($this->layers as $oLayer) |
213 | { | 231 | { |
214 | $sel = "nao"; | 232 | $sel = "nao"; |
@@ -224,18 +242,24 @@ string - javascript com os parametros | @@ -224,18 +242,24 @@ string - javascript com os parametros | ||
224 | } | 242 | } |
225 | $escondido = $oLayer->getmetadata("escondido"); | 243 | $escondido = $oLayer->getmetadata("escondido"); |
226 | if($escondido == "") | 244 | if($escondido == "") |
227 | - {$escondido = "nao";} | 245 | + { |
246 | + $escondido = "nao"; | ||
247 | + } | ||
228 | if ( (strtoupper($oLayer->getmetadata("tema")) != "NAO") ) | 248 | if ( (strtoupper($oLayer->getmetadata("tema")) != "NAO") ) |
229 | { | 249 | { |
230 | $escala = $oLayer->getmetadata("escala"); | 250 | $escala = $oLayer->getmetadata("escala"); |
231 | - if ($escala == ""){$escala = 0;} | 251 | + if ($escala == ""){ |
252 | + $escala = 0; | ||
253 | + } | ||
232 | $down = $oLayer->getmetadata("download"); | 254 | $down = $oLayer->getmetadata("download"); |
233 | // | 255 | // |
234 | //verifica se o layer é do tipo features | 256 | //verifica se o layer é do tipo features |
235 | // | 257 | // |
236 | $f = "nao"; | 258 | $f = "nao"; |
237 | if (($oLayer->data == "") && ($oLayer->connection == "")) | 259 | if (($oLayer->data == "") && ($oLayer->connection == "")) |
238 | - {$f = "sim";} | 260 | + { |
261 | + $f = "sim"; | ||
262 | + } | ||
239 | $ct = $oLayer->connectiontype; | 263 | $ct = $oLayer->connectiontype; |
240 | // | 264 | // |
241 | //verifica se o tema tem wfs | 265 | //verifica se o tema tem wfs |
@@ -246,7 +270,9 @@ string - javascript com os parametros | @@ -246,7 +270,9 @@ string - javascript com os parametros | ||
246 | // | 270 | // |
247 | $usasld = "nao"; | 271 | $usasld = "nao"; |
248 | if($oLayer->getmetadata("wms_sld_body") !== "" || $oLayer->getmetadata("wms_sld_url") !== "") | 272 | if($oLayer->getmetadata("wms_sld_body") !== "" || $oLayer->getmetadata("wms_sld_url") !== "") |
249 | - {$usasld = "sim";} | 273 | + { |
274 | + $usasld = "sim"; | ||
275 | + } | ||
250 | // | 276 | // |
251 | //verifica se o tema pode receber a operação de zoom para o tema | 277 | //verifica se o tema pode receber a operação de zoom para o tema |
252 | // | 278 | // |
@@ -265,7 +291,9 @@ string - javascript com os parametros | @@ -265,7 +291,9 @@ string - javascript com os parametros | ||
265 | // | 291 | // |
266 | $contextoescala = "nao"; | 292 | $contextoescala = "nao"; |
267 | if(($oLayer->minscaledenom > 0) || ($oLayer->maxscaledenom > 0)) | 293 | if(($oLayer->minscaledenom > 0) || ($oLayer->maxscaledenom > 0)) |
268 | - {$contextoescala = "sim";} | 294 | + { |
295 | + $contextoescala = "sim"; | ||
296 | + } | ||
269 | // | 297 | // |
270 | //verifica se o usuário pode editar o SQL em DATA | 298 | //verifica se o usuário pode editar o SQL em DATA |
271 | // | 299 | // |
@@ -273,33 +301,45 @@ string - javascript com os parametros | @@ -273,33 +301,45 @@ string - javascript com os parametros | ||
273 | if($ct == 3 || $ct == 4 || $ct == 6 || $ct == 8) | 301 | if($ct == 3 || $ct == 4 || $ct == 6 || $ct == 8) |
274 | { | 302 | { |
275 | if (strtoupper($oLayer->getmetadata("editorsql")) != "NAO") | 303 | if (strtoupper($oLayer->getmetadata("editorsql")) != "NAO") |
276 | - {$editorsql = "sim";} | 304 | + { |
305 | + $editorsql = "sim"; | ||
306 | + } | ||
277 | } | 307 | } |
278 | // | 308 | // |
279 | //verifica se o tema pode ser utilizado para gerar gráficos de linha do tempo | 309 | //verifica se o tema pode ser utilizado para gerar gráficos de linha do tempo |
280 | // | 310 | // |
281 | $ltempo = "nao"; | 311 | $ltempo = "nao"; |
282 | if($oLayer->getmetadata("ltempoformatodata") !== "") | 312 | if($oLayer->getmetadata("ltempoformatodata") !== "") |
283 | - {$ltempo = "sim";} | 313 | + { |
314 | + $ltempo = "sim"; | ||
315 | + } | ||
284 | // | 316 | // |
285 | //verifica se o tema faz cache automatico | 317 | //verifica se o tema faz cache automatico |
286 | // | 318 | // |
287 | $cache = "nao"; | 319 | $cache = "nao"; |
288 | if(strtoupper($oLayer->getmetadata("cache")) == "SIM") | 320 | if(strtoupper($oLayer->getmetadata("cache")) == "SIM") |
289 | - {$cache = "sim";} | 321 | + { |
322 | + $cache = "sim"; | ||
323 | + } | ||
290 | // | 324 | // |
291 | //verifica se o tema receberá efeito de transição de zoom | 325 | //verifica se o tema receberá efeito de transição de zoom |
292 | // | 326 | // |
293 | $transitioneffect = "sim"; | 327 | $transitioneffect = "sim"; |
294 | if($oLayer->getmetadata("transitioneffect") == "NAO") | 328 | if($oLayer->getmetadata("transitioneffect") == "NAO") |
295 | - {$transitioneffect = "nao";} | 329 | + { |
330 | + $transitioneffect = "nao"; | ||
331 | + } | ||
296 | // | 332 | // |
297 | $permitecomentario = "nao"; | 333 | $permitecomentario = "nao"; |
298 | if($oLayer->getmetadata("nomeoriginal") != "" && strtoupper($oLayer->getmetadata("permitecomentario")) != "NAO") | 334 | if($oLayer->getmetadata("nomeoriginal") != "" && strtoupper($oLayer->getmetadata("permitecomentario")) != "NAO") |
299 | - {$permitecomentario = "sim";} | 335 | + { |
336 | + $permitecomentario = "sim"; | ||
337 | + } | ||
300 | $aplicaextensao = "nao"; | 338 | $aplicaextensao = "nao"; |
301 | if(strtoupper($oLayer->getmetadata("aplicaextensao")) == "SIM") | 339 | if(strtoupper($oLayer->getmetadata("aplicaextensao")) == "SIM") |
302 | - {$aplicaextensao = "sim";} | 340 | + { |
341 | + $aplicaextensao = "sim"; | ||
342 | + } | ||
303 | $wmsurl = ""; | 343 | $wmsurl = ""; |
304 | $wmsformat = ""; | 344 | $wmsformat = ""; |
305 | $wmssrs = ""; | 345 | $wmssrs = ""; |
@@ -322,42 +362,42 @@ string - javascript com os parametros | @@ -322,42 +362,42 @@ string - javascript com os parametros | ||
322 | //if($oLayer->labelitem != "") | 362 | //if($oLayer->labelitem != "") |
323 | //{$tiles = "nao";} | 363 | //{$tiles = "nao";} |
324 | $temas[] = array( | 364 | $temas[] = array( |
325 | - "name"=>($oLayer->name), | ||
326 | - "nomeoriginal"=>($oLayer->getmetadata("nomeoriginal")), | ||
327 | - "status"=>($oLayer->status), | ||
328 | - "tema"=>(mb_convert_encoding(($oLayer->getmetadata("tema")),"UTF-8","ISO-8859-1")), | ||
329 | - "transparency"=>($oLayer->opacity), | ||
330 | - "type"=>($oLayer->type), | ||
331 | - "sel"=>$sel, | ||
332 | - "nsel"=>$nSel, | ||
333 | - "escala"=>$escala, | ||
334 | - "download"=>$down, | ||
335 | - "features"=>$f, | ||
336 | - "connectiontype"=>$ct, | ||
337 | - "zoomtema"=>$zoomtema, | ||
338 | - "contextoescala"=>$contextoescala, | ||
339 | - "etiquetas"=>($oLayer->getmetadata("TIP")), | ||
340 | - "identifica"=>($oLayer->getmetadata("IDENTIFICA")), | ||
341 | - "editorsql"=>$editorsql, | ||
342 | - "linhadotempo"=>$ltempo, | ||
343 | - "escondido"=>strtolower($escondido), | ||
344 | - "iconetema"=>($oLayer->getmetadata("iconetema")), | ||
345 | - "classe"=>($oLayer->getmetadata("classe")), | ||
346 | - "permitecomentario"=>$permitecomentario, | ||
347 | - "exttema"=>$exttema, | ||
348 | - "aplicaextensao"=>$aplicaextensao, | ||
349 | - "transitioneffect"=>$transitioneffect, | ||
350 | - "wmsurl"=>$wmsurl, | ||
351 | - "wmsname"=>$wmsname, | ||
352 | - "wmsformat"=>$wmsformat, | ||
353 | - "wmssrs"=>$wmssrs, | ||
354 | - "wmstile"=>$wmstile, | ||
355 | - "tiles"=>$tiles, | ||
356 | - "temporizador"=>($oLayer->getmetadata("temporizador")), | ||
357 | - "permiteogc"=>($oLayer->getmetadata("permiteogc")), | ||
358 | - "itembuscarapida"=>($oLayer->getmetadata("itembuscarapida")), | ||
359 | - "usasld"=>$usasld, | ||
360 | - "cache"=>$cache | 365 | + "name"=>($oLayer->name), |
366 | + "nomeoriginal"=>($oLayer->getmetadata("nomeoriginal")), | ||
367 | + "status"=>($oLayer->status), | ||
368 | + "tema"=>(mb_convert_encoding(($oLayer->getmetadata("tema")),"UTF-8","ISO-8859-1")), | ||
369 | + "transparency"=>($oLayer->opacity), | ||
370 | + "type"=>($oLayer->type), | ||
371 | + "sel"=>$sel, | ||
372 | + "nsel"=>$nSel, | ||
373 | + "escala"=>$escala, | ||
374 | + "download"=>$down, | ||
375 | + "features"=>$f, | ||
376 | + "connectiontype"=>$ct, | ||
377 | + "zoomtema"=>$zoomtema, | ||
378 | + "contextoescala"=>$contextoescala, | ||
379 | + "etiquetas"=>($oLayer->getmetadata("TIP")), | ||
380 | + "identifica"=>($oLayer->getmetadata("IDENTIFICA")), | ||
381 | + "editorsql"=>$editorsql, | ||
382 | + "linhadotempo"=>$ltempo, | ||
383 | + "escondido"=>strtolower($escondido), | ||
384 | + "iconetema"=>($oLayer->getmetadata("iconetema")), | ||
385 | + "classe"=>($oLayer->getmetadata("classe")), | ||
386 | + "permitecomentario"=>$permitecomentario, | ||
387 | + "exttema"=>$exttema, | ||
388 | + "aplicaextensao"=>$aplicaextensao, | ||
389 | + "transitioneffect"=>$transitioneffect, | ||
390 | + "wmsurl"=>$wmsurl, | ||
391 | + "wmsname"=>$wmsname, | ||
392 | + "wmsformat"=>$wmsformat, | ||
393 | + "wmssrs"=>$wmssrs, | ||
394 | + "wmstile"=>$wmstile, | ||
395 | + "tiles"=>$tiles, | ||
396 | + "temporizador"=>($oLayer->getmetadata("temporizador")), | ||
397 | + "permiteogc"=>($oLayer->getmetadata("permiteogc")), | ||
398 | + "itembuscarapida"=>($oLayer->getmetadata("itembuscarapida")), | ||
399 | + "usasld"=>$usasld, | ||
400 | + "cache"=>$cache | ||
361 | ); | 401 | ); |
362 | } | 402 | } |
363 | } | 403 | } |
@@ -367,28 +407,28 @@ string - javascript com os parametros | @@ -367,28 +407,28 @@ string - javascript com os parametros | ||
367 | $temas = array_reverse($temas); | 407 | $temas = array_reverse($temas); |
368 | return $temas; | 408 | return $temas; |
369 | } | 409 | } |
370 | -/* | ||
371 | -Method: redesenhaCorpo | 410 | + /* |
411 | + Method: redesenhaCorpo | ||
372 | 412 | ||
373 | -Redesenha o mapa e retorna as variáveis necessárias para montar o mapa. | 413 | + Redesenha o mapa e retorna as variáveis necessárias para montar o mapa. |
374 | 414 | ||
375 | -Parametros: | 415 | + Parametros: |
376 | 416 | ||
377 | -$tipoimagem - filtro que será aplicado na imagem (opcional). | 417 | + $tipoimagem - filtro que será aplicado na imagem (opcional). |
378 | 418 | ||
379 | -Return: | 419 | + Return: |
380 | 420 | ||
381 | -string - parametros do corpo do mapa | 421 | + string - parametros do corpo do mapa |
382 | 422 | ||
383 | -Include: | ||
384 | -<classe_imagem.php> | ||
385 | -*/ | 423 | + Include: |
424 | + <classe_imagem.php> | ||
425 | + */ | ||
386 | function redesenhaCorpo($tipoimagem,$utilizacgi,$locmapserv) | 426 | function redesenhaCorpo($tipoimagem,$utilizacgi,$locmapserv) |
387 | { | 427 | { |
388 | ms_ResetErrorList(); | 428 | ms_ResetErrorList(); |
389 | if(file_exists($this->locaplic."/classe_imagem.php")) | 429 | if(file_exists($this->locaplic."/classe_imagem.php")) |
390 | include_once($this->locaplic."/classe_imagem.php"); | 430 | include_once($this->locaplic."/classe_imagem.php"); |
391 | - else | 431 | + else |
392 | include_once("classe_imagem.php"); | 432 | include_once("classe_imagem.php"); |
393 | $nomer = ""; | 433 | $nomer = ""; |
394 | $qy = file_exists($this->qyfile); | 434 | $qy = file_exists($this->qyfile); |
@@ -415,7 +455,9 @@ Include: | @@ -415,7 +455,9 @@ Include: | ||
415 | { | 455 | { |
416 | $classe = $layer->getclass(0); | 456 | $classe = $layer->getclass(0); |
417 | if (($classe->name == "") || ($classe->name == " ")) | 457 | if (($classe->name == "") || ($classe->name == " ")) |
418 | - {$classe->set("name",$layer->getmetadata("tema"));} | 458 | + { |
459 | + $classe->set("name",$layer->getmetadata("tema")); | ||
460 | + } | ||
419 | } | 461 | } |
420 | } | 462 | } |
421 | } | 463 | } |
@@ -429,20 +471,25 @@ Include: | @@ -429,20 +471,25 @@ Include: | ||
429 | if (isset($utilizacgi) && strtolower($utilizacgi) == "sim" && $tipoimagem=="nenhum" && !$qy) | 471 | if (isset($utilizacgi) && strtolower($utilizacgi) == "sim" && $tipoimagem=="nenhum" && !$qy) |
430 | { | 472 | { |
431 | foreach($this->layers as $l) | 473 | foreach($this->layers as $l) |
432 | - {$l->set("status",MS_OFF);} | 474 | + { |
475 | + $l->set("status",MS_OFF); | ||
476 | + } | ||
433 | $imgo = @$this->mapa->draw(); | 477 | $imgo = @$this->mapa->draw(); |
434 | } | 478 | } |
435 | else | 479 | else |
436 | { | 480 | { |
437 | //if($tipoimagem != "nenhum") | 481 | //if($tipoimagem != "nenhum") |
438 | //{ | 482 | //{ |
439 | - $of = $this->mapa->outputformat; | ||
440 | - $of->set("imagemode",MS_IMAGEMODE_RGB); | 483 | + $of = $this->mapa->outputformat; |
484 | + $of->set("imagemode",MS_IMAGEMODE_RGB); | ||
441 | //} | 485 | //} |
442 | if (!$qy) | 486 | if (!$qy) |
443 | - {$imgo = @$this->mapa->draw();} | 487 | + { |
488 | + $imgo = @$this->mapa->draw(); | ||
489 | + } | ||
444 | else | 490 | else |
445 | - {$imgo = @$this->mapa->drawQuery();} | 491 | + {$imgo = @$this->mapa->drawQuery(); |
492 | + } | ||
446 | $mensagemErro = ""; | 493 | $mensagemErro = ""; |
447 | $error = ms_GetErrorObj(); | 494 | $error = ms_GetErrorObj(); |
448 | while($error && $error->code != MS_NOERR) | 495 | while($error && $error->code != MS_NOERR) |
@@ -466,30 +513,52 @@ Include: | @@ -466,30 +513,52 @@ Include: | ||
466 | foreach ($tiposImagem as $tipoimagem){ | 513 | foreach ($tiposImagem as $tipoimagem){ |
467 | $m = new Imagem($nomer); | 514 | $m = new Imagem($nomer); |
468 | if ($tipoimagem == "cinza") | 515 | if ($tipoimagem == "cinza") |
469 | - {imagepng($m->cinzaNormal(),str_replace("\\","/",$nomer));} | 516 | + { |
517 | + imagepng($m->cinzaNormal(),str_replace("\\","/",$nomer)); | ||
518 | + } | ||
470 | if ($tipoimagem == "sepiaclara") | 519 | if ($tipoimagem == "sepiaclara") |
471 | - {imagepng($m->sepiaClara(),str_replace("\\","/",$nomer));} | 520 | + { |
521 | + imagepng($m->sepiaClara(),str_replace("\\","/",$nomer)); | ||
522 | + } | ||
472 | if ($tipoimagem == "sepianormal") | 523 | if ($tipoimagem == "sepianormal") |
473 | - {imagepng($m->sepiaNormal(),str_replace("\\","/",$nomer));} | 524 | + { |
525 | + imagepng($m->sepiaNormal(),str_replace("\\","/",$nomer)); | ||
526 | + } | ||
474 | if ($tipoimagem == "negativo") | 527 | if ($tipoimagem == "negativo") |
475 | - {imagepng($m->negativo(),str_replace("\\","/",$nomer));} | 528 | + { |
529 | + imagepng($m->negativo(),str_replace("\\","/",$nomer)); | ||
530 | + } | ||
476 | if ($tipoimagem == "detectaBordas") | 531 | if ($tipoimagem == "detectaBordas") |
477 | - {imagepng($m->detectaBordas(),str_replace("\\","/",$nomer));} | 532 | + { |
533 | + imagepng($m->detectaBordas(),str_replace("\\","/",$nomer)); | ||
534 | + } | ||
478 | if ($tipoimagem == "embassa") | 535 | if ($tipoimagem == "embassa") |
479 | - {imagepng($m->embassa(),str_replace("\\","/",$nomer));} | 536 | + { |
537 | + imagepng($m->embassa(),str_replace("\\","/",$nomer)); | ||
538 | + } | ||
480 | if ($tipoimagem == "gaussian_blur") | 539 | if ($tipoimagem == "gaussian_blur") |
481 | - {imagepng($m->gaussian_blur(),str_replace("\\","/",$nomer));} | 540 | + { |
541 | + imagepng($m->gaussian_blur(),str_replace("\\","/",$nomer)); | ||
542 | + } | ||
482 | if ($tipoimagem == "selective_blur") | 543 | if ($tipoimagem == "selective_blur") |
483 | - {imagepng($m->selective_blur(),str_replace("\\","/",$nomer));} | 544 | + { |
545 | + imagepng($m->selective_blur(),str_replace("\\","/",$nomer)); | ||
546 | + } | ||
484 | if ($tipoimagem == "mean_removal") | 547 | if ($tipoimagem == "mean_removal") |
485 | - {imagepng($m->mean_removal(),str_replace("\\","/",$nomer));} | 548 | + { |
549 | + imagepng($m->mean_removal(),str_replace("\\","/",$nomer)); | ||
550 | + } | ||
486 | if ($tipoimagem == "pixelate") | 551 | if ($tipoimagem == "pixelate") |
487 | - {imagepng($m->pixelate(),str_replace("\\","/",$nomer));} | 552 | + { |
553 | + imagepng($m->pixelate(),str_replace("\\","/",$nomer)); | ||
554 | + } | ||
488 | } | 555 | } |
489 | } | 556 | } |
490 | $nomer = ($imgo->imageurl).basename($nomer); | 557 | $nomer = ($imgo->imageurl).basename($nomer); |
491 | } | 558 | } |
492 | - if ($imgo == ""){return "erro";} | 559 | + if ($imgo == ""){ |
560 | + return "erro"; | ||
561 | + } | ||
493 | $e = $this->mapa->extent; | 562 | $e = $this->mapa->extent; |
494 | $ext = $e->minx." ".$e->miny." ".$e->maxx." ".$e->maxy; | 563 | $ext = $e->minx." ".$e->miny." ".$e->maxx." ".$e->maxy; |
495 | if (isset($utilizacgi) && strtolower($utilizacgi) == "sim" && !$qy) | 564 | if (isset($utilizacgi) && strtolower($utilizacgi) == "sim" && !$qy) |
@@ -508,17 +577,17 @@ Include: | @@ -508,17 +577,17 @@ Include: | ||
508 | $res["erro"] = $mensagemErro; | 577 | $res["erro"] = $mensagemErro; |
509 | return $res; | 578 | return $res; |
510 | } | 579 | } |
511 | -/* | ||
512 | -Method: redesenhaEntorno (depreciado) | 580 | + /* |
581 | + Method: redesenhaEntorno (depreciado) | ||
513 | 582 | ||
514 | -Redesenha o entorno do mapa (depreciado). | 583 | + Redesenha o entorno do mapa (depreciado). |
515 | 584 | ||
516 | -Redesenha as partes norte, sul, leste e oeste do mapa e retorna as variáveis necessárias para montar o mapa. | 585 | + Redesenha as partes norte, sul, leste e oeste do mapa e retorna as variáveis necessárias para montar o mapa. |
517 | 586 | ||
518 | -Return: | 587 | + Return: |
519 | 588 | ||
520 | -string - javascript com as variáveis para redesenho do mapa | ||
521 | -*/ | 589 | + string - javascript com as variáveis para redesenho do mapa |
590 | + */ | ||
522 | function redesenhaEntorno() | 591 | function redesenhaEntorno() |
523 | { | 592 | { |
524 | $nomes = nomeRandomico(); | 593 | $nomes = nomeRandomico(); |
@@ -547,27 +616,27 @@ string - javascript com as vari&aacute;veis para redesenho do mapa | @@ -547,27 +616,27 @@ string - javascript com as vari&aacute;veis para redesenho do mapa | ||
547 | $nomeS = gravaImagemMapa(); | 616 | $nomeS = gravaImagemMapa(); |
548 | return "var imagens=['".$nomeL["url"]."','".$nomeO["url"]."','".$nomeN["url"]."','".$nomeS["url"]."'];"; | 617 | return "var imagens=['".$nomeL["url"]."','".$nomeO["url"]."','".$nomeN["url"]."','".$nomeS["url"]."'];"; |
549 | } | 618 | } |
550 | -/* | ||
551 | -Method: ativalegenda | 619 | + /* |
620 | + Method: ativalegenda | ||
552 | 621 | ||
553 | -Ativa/desativa legenda, incluindo ou não no corpo do mapa. | ||
554 | -*/ | 622 | + Ativa/desativa legenda, incluindo ou não no corpo do mapa. |
623 | + */ | ||
555 | function ativalegenda() | 624 | function ativalegenda() |
556 | { | 625 | { |
557 | $legenda = $this->mapa->legend; | 626 | $legenda = $this->mapa->legend; |
558 | $legenda->status == MS_EMBED ? $legenda->set("status",MS_OFF) : $legenda->set("status",MS_EMBED) ; | 627 | $legenda->status == MS_EMBED ? $legenda->set("status",MS_OFF) : $legenda->set("status",MS_EMBED) ; |
559 | return "ok"; | 628 | return "ok"; |
560 | } | 629 | } |
561 | -/* | ||
562 | -Method: ativalogo | 630 | + /* |
631 | + Method: ativalogo | ||
563 | 632 | ||
564 | -Ativa/desativa logomarca. | 633 | + Ativa/desativa logomarca. |
565 | 634 | ||
566 | -A logomarca é mostrada no canto superior direito da imagem do mapa. | ||
567 | -No mapfile padrão (geral1.map), o layer "copyright" é utilizado para incluir a logomarca. | ||
568 | -Essa função liga ou desliga esse layer, manipulando a propriedade "status". | 635 | + A logomarca é mostrada no canto superior direito da imagem do mapa. |
636 | + No mapfile padrão (geral1.map), o layer "copyright" é utilizado para incluir a logomarca. | ||
637 | + Essa função liga ou desliga esse layer, manipulando a propriedade "status". | ||
569 | 638 | ||
570 | -*/ | 639 | + */ |
571 | function ativalogo() | 640 | function ativalogo() |
572 | { | 641 | { |
573 | $layer = $this->mapa->getlayerbyname("copyright"); | 642 | $layer = $this->mapa->getlayerbyname("copyright"); |
@@ -577,19 +646,19 @@ Essa fun&ccedil;&atilde;o liga ou desliga esse layer, manipulando a propriedade | @@ -577,19 +646,19 @@ Essa fun&ccedil;&atilde;o liga ou desliga esse layer, manipulando a propriedade | ||
577 | } | 646 | } |
578 | return "ok"; | 647 | return "ok"; |
579 | } | 648 | } |
580 | -/* | ||
581 | -Method: listaTemasLocais | 649 | + /* |
650 | + Method: listaTemasLocais | ||
582 | 651 | ||
583 | -Lista os temas locais de um mapa. | 652 | + Lista os temas locais de um mapa. |
584 | 653 | ||
585 | -Lista os temas existentes no mapfile atual, que utilizam como fonte de dados shape file, e que estão armazenados no diretório temporário do mapa. | ||
586 | -Os arquivos shape file existentes no diretório temporário do mapa são passíveis de edição. | ||
587 | -Obs.: Toda vez que um tema local é criado pelo I3Geo, o METADATA "TEMALOCAL" é marcado como "sim". | 654 | + Lista os temas existentes no mapfile atual, que utilizam como fonte de dados shape file, e que estão armazenados no diretório temporário do mapa. |
655 | + Os arquivos shape file existentes no diretório temporário do mapa são passíveis de edição. | ||
656 | + Obs.: Toda vez que um tema local é criado pelo I3Geo, o METADATA "TEMALOCAL" é marcado como "sim". | ||
588 | 657 | ||
589 | -Parameter: | 658 | + Parameter: |
590 | 659 | ||
591 | -$tipo - tipo de layer que será considerado. Default é 0. | ||
592 | -*/ | 660 | + $tipo - tipo de layer que será considerado. Default é 0. |
661 | + */ | ||
593 | function listaTemasLocais($tipo=0) | 662 | function listaTemasLocais($tipo=0) |
594 | { | 663 | { |
595 | $final = array(); //resultado final | 664 | $final = array(); //resultado final |
@@ -604,29 +673,29 @@ $tipo - tipo de layer que ser&aacute; considerado. Default &eacute; 0. | @@ -604,29 +673,29 @@ $tipo - tipo de layer que ser&aacute; considerado. Default &eacute; 0. | ||
604 | } | 673 | } |
605 | return $final; | 674 | return $final; |
606 | } | 675 | } |
607 | -/* | ||
608 | -Method: listaTemas | 676 | + /* |
677 | + Method: listaTemas | ||
609 | 678 | ||
610 | -Lista os temas de um mapa. | 679 | + Lista os temas de um mapa. |
611 | 680 | ||
612 | -Obs.: o "METADATA" "ESCONDIDO", quando presente no tema e diferente de vazio, indica que o tema é do | ||
613 | -tipo escondido, ou seja, não deve ser listado pelo I3Geo em combos ou listagens. Por isso, | ||
614 | -layers desse tipo são ignorados por essa função. | 681 | + Obs.: o "METADATA" "ESCONDIDO", quando presente no tema e diferente de vazio, indica que o tema é do |
682 | + tipo escondido, ou seja, não deve ser listado pelo I3Geo em combos ou listagens. Por isso, | ||
683 | + layers desse tipo são ignorados por essa função. | ||
615 | 684 | ||
616 | -Parameter: | 685 | + Parameter: |
617 | 686 | ||
618 | -$opcao Situação desejada do tema (ligados ou todos). | 687 | + $opcao Situação desejada do tema (ligados ou todos). |
619 | 688 | ||
620 | -Return: | 689 | + Return: |
621 | 690 | ||
622 | -Array com os temas e seus nomes | 691 | + Array com os temas e seus nomes |
623 | 692 | ||
624 | -Properties: | 693 | + Properties: |
625 | 694 | ||
626 | -tema | 695 | + tema |
627 | 696 | ||
628 | -nome | ||
629 | -*/ | 697 | + nome |
698 | + */ | ||
630 | function listaTemas($opcao) | 699 | function listaTemas($opcao) |
631 | { | 700 | { |
632 | $final = array(); | 701 | $final = array(); |
@@ -646,44 +715,50 @@ nome | @@ -646,44 +715,50 @@ nome | ||
646 | foreach ($this->layers as $layer) | 715 | foreach ($this->layers as $layer) |
647 | { | 716 | { |
648 | if ($layer->getmetadata("ESCONDIDO") == "") | 717 | if ($layer->getmetadata("ESCONDIDO") == "") |
649 | - {$final[] = array("tema"=>$layer->name,"nome"=>(pegaNome($layer,"UTF-8")));} | 718 | + { |
719 | + $final[] = array("tema"=>$layer->name,"nome"=>(pegaNome($layer,"UTF-8"))); | ||
720 | + } | ||
650 | } | 721 | } |
651 | } | 722 | } |
652 | return $final; | 723 | return $final; |
653 | } | 724 | } |
654 | -/* | ||
655 | -Method: listaTemasTipo | 725 | + /* |
726 | + Method: listaTemasTipo | ||
656 | 727 | ||
657 | -Lista os temas, visíveis, de um determinado tipo de feição de um mapa. | 728 | + Lista os temas, visíveis, de um determinado tipo de feição de um mapa. |
658 | 729 | ||
659 | -Obs.: o "METADATA" "ESCONDIDO", quando presente no tema e diferente de vazio, indica que o tema é do | ||
660 | -tipo escondido, ou seja, não deve ser listado pelo I3Geo em combos ou listagens. Por isso, | ||
661 | -layers desse tipo são ignorados por essa função. | 730 | + Obs.: o "METADATA" "ESCONDIDO", quando presente no tema e diferente de vazio, indica que o tema é do |
731 | + tipo escondido, ou seja, não deve ser listado pelo I3Geo em combos ou listagens. Por isso, | ||
732 | + layers desse tipo são ignorados por essa função. | ||
662 | 733 | ||
663 | -Parametros: | 734 | + Parametros: |
664 | 735 | ||
665 | -$tipo Tipo de tema (pode ser mais de um) ponto,poligono,linha,raster | 736 | + $tipo Tipo de tema (pode ser mais de um) ponto,poligono,linha,raster |
666 | 737 | ||
667 | -Return: | 738 | + Return: |
668 | 739 | ||
669 | -Array com os temas e seus nomes | 740 | + Array com os temas e seus nomes |
670 | 741 | ||
671 | -Properties: | 742 | + Properties: |
672 | 743 | ||
673 | -tema | 744 | + tema |
674 | 745 | ||
675 | -nome | 746 | + nome |
676 | 747 | ||
677 | -*/ | 748 | + */ |
678 | function listaTemasTipo($tipo,$selecao="nao") | 749 | function listaTemasTipo($tipo,$selecao="nao") |
679 | { | 750 | { |
680 | if (($selecao=="sim") && (file_exists($this->qyfile))) | 751 | if (($selecao=="sim") && (file_exists($this->qyfile))) |
681 | - {$this->mapa->loadquery($this->qyfile);} | 752 | + { |
753 | + $this->mapa->loadquery($this->qyfile); | ||
754 | + } | ||
682 | $layers = array(); | 755 | $layers = array(); |
683 | foreach($this->layers as $layer) | 756 | foreach($this->layers as $layer) |
684 | { | 757 | { |
685 | if (($layer->isvisible()) && ($layer->getmetadata("ESCONDIDO") == "")) | 758 | if (($layer->isvisible()) && ($layer->getmetadata("ESCONDIDO") == "")) |
686 | - {$layers[] = $layer;} | 759 | + { |
760 | + $layers[] = $layer; | ||
761 | + } | ||
687 | } | 762 | } |
688 | $final = array(); | 763 | $final = array(); |
689 | //substitui os tipos pelo código usado no mapserver | 764 | //substitui os tipos pelo código usado no mapserver |
@@ -701,34 +776,37 @@ nome | @@ -701,34 +776,37 @@ nome | ||
701 | { | 776 | { |
702 | $res_count = $layer->getNumresults(); | 777 | $res_count = $layer->getNumresults(); |
703 | if ($res_count > 0) | 778 | if ($res_count > 0) |
704 | - {$final[] = array("tema"=>$layer->name,"nome"=>(pegaNome($layer,"UTF-8")));} | 779 | + { |
780 | + $final[] = array("tema"=>$layer->name,"nome"=>(pegaNome($layer,"UTF-8"))); | ||
781 | + } | ||
705 | } | 782 | } |
706 | else | 783 | else |
707 | - {$final[] = array("tema"=>$layer->name,"nome"=>(pegaNome($layer,"UTF-8")));} | 784 | + {$final[] = array("tema"=>$layer->name,"nome"=>(pegaNome($layer,"UTF-8"))); |
785 | + } | ||
708 | } | 786 | } |
709 | } | 787 | } |
710 | return $final; | 788 | return $final; |
711 | } | 789 | } |
712 | -/* | ||
713 | -Method: listaTemasComSel | 790 | + /* |
791 | + Method: listaTemasComSel | ||
714 | 792 | ||
715 | -Lista os temas de um mapa que possuem elementos selecionados. | 793 | + Lista os temas de um mapa que possuem elementos selecionados. |
716 | 794 | ||
717 | -Obs.: o "METADATA" "ESCONDIDO", quando presente no tema e diferente de vazio, indica que o tema é do | ||
718 | -tipo escondido, ou seja, não deve ser listado pelo I3Geo em combos ou listagens. Por isso, | ||
719 | -layers desse tipo são ignorados por essa função. | 795 | + Obs.: o "METADATA" "ESCONDIDO", quando presente no tema e diferente de vazio, indica que o tema é do |
796 | + tipo escondido, ou seja, não deve ser listado pelo I3Geo em combos ou listagens. Por isso, | ||
797 | + layers desse tipo são ignorados por essa função. | ||
720 | 798 | ||
721 | -Return: | 799 | + Return: |
722 | 800 | ||
723 | -Array com os temas e seus nomes | 801 | + Array com os temas e seus nomes |
724 | 802 | ||
725 | -Properties: | 803 | + Properties: |
726 | 804 | ||
727 | -tema | 805 | + tema |
728 | 806 | ||
729 | -nome | 807 | + nome |
730 | 808 | ||
731 | -*/ | 809 | + */ |
732 | function listaTemasComSel() | 810 | function listaTemasComSel() |
733 | { | 811 | { |
734 | $layers = array(); | 812 | $layers = array(); |
@@ -738,7 +816,9 @@ nome | @@ -738,7 +816,9 @@ nome | ||
738 | foreach($this->layers as $layer) | 816 | foreach($this->layers as $layer) |
739 | { | 817 | { |
740 | if ($layer->getmetadata("ESCONDIDO") == "") | 818 | if ($layer->getmetadata("ESCONDIDO") == "") |
741 | - {$layers[] = $layer;} | 819 | + { |
820 | + $layers[] = $layer; | ||
821 | + } | ||
742 | } | 822 | } |
743 | $this->mapa->loadquery($this->qyfile); | 823 | $this->mapa->loadquery($this->qyfile); |
744 | foreach ($layers as $layer) | 824 | foreach ($layers as $layer) |
@@ -755,20 +835,20 @@ nome | @@ -755,20 +835,20 @@ nome | ||
755 | } | 835 | } |
756 | return $final; | 836 | return $final; |
757 | } | 837 | } |
758 | -/* | ||
759 | -Method: mudaQS | 838 | + /* |
839 | + Method: mudaQS | ||
760 | 840 | ||
761 | -Muda o tamanho do query map. | 841 | + Muda o tamanho do query map. |
762 | 842 | ||
763 | -Essa função é executada na inicialização do mapa ou quando o mapa tem suas dimensões alteradas. | ||
764 | -A função de alteração dos parâmetros do query map original do PHPMapscript, não funciona corretamente. | 843 | + Essa função é executada na inicialização do mapa ou quando o mapa tem suas dimensões alteradas. |
844 | + A função de alteração dos parâmetros do query map original do PHPMapscript, não funciona corretamente. | ||
765 | 845 | ||
766 | -Parametros: | 846 | + Parametros: |
767 | 847 | ||
768 | -$w - Largura. | 848 | + $w - Largura. |
769 | 849 | ||
770 | -$h - Altura. | ||
771 | -*/ | 850 | + $h - Altura. |
851 | + */ | ||
772 | function mudaQS($w,$h) | 852 | function mudaQS($w,$h) |
773 | { | 853 | { |
774 | //le o map file | 854 | //le o map file |
@@ -787,9 +867,12 @@ $h - Altura. | @@ -787,9 +867,12 @@ $h - Altura. | ||
787 | { | 867 | { |
788 | $testa = explode("QUERYMAP",$e); | 868 | $testa = explode("QUERYMAP",$e); |
789 | if (count($testa) > 1) | 869 | if (count($testa) > 1) |
790 | - {$pega = "sim";} | 870 | + { |
871 | + $pega = "sim"; | ||
872 | + } | ||
791 | else | 873 | else |
792 | - {$pega = "nao";} | 874 | + {$pega = "nao"; |
875 | + } | ||
793 | $testa = explode("SIZE",$e); | 876 | $testa = explode("SIZE",$e); |
794 | if ((count($testa) > 1) && ($pega == "sim")) | 877 | if ((count($testa) > 1) && ($pega == "sim")) |
795 | { | 878 | { |
@@ -801,21 +884,23 @@ $h - Altura. | @@ -801,21 +884,23 @@ $h - Altura. | ||
801 | //salva o mapfile | 884 | //salva o mapfile |
802 | $abre = fopen($this->arquivo, "wt"); | 885 | $abre = fopen($this->arquivo, "wt"); |
803 | foreach($novoarray as $linha) | 886 | foreach($novoarray as $linha) |
804 | - {$escreve = fwrite ($abre,$linha);} | 887 | + { |
888 | + $escreve = fwrite ($abre,$linha); | ||
889 | + } | ||
805 | $fecha = fclose ($abre); | 890 | $fecha = fclose ($abre); |
806 | } | 891 | } |
807 | -/* | ||
808 | -Method: corQM | 892 | + /* |
893 | + Method: corQM | ||
809 | 894 | ||
810 | -Muda a cor do query map. | 895 | + Muda a cor do query map. |
811 | 896 | ||
812 | -Muda a cor utilizada para mostrar os elementos selecionados de um tema ou retorna a cor atual | 897 | + Muda a cor utilizada para mostrar os elementos selecionados de um tema ou retorna a cor atual |
813 | 898 | ||
814 | -Parameter: | 899 | + Parameter: |
815 | 900 | ||
816 | -$cor - RGB separado por vírgula. Se a cor for vazia, retorna a cor atual. | 901 | + $cor - RGB separado por vírgula. Se a cor for vazia, retorna a cor atual. |
817 | 902 | ||
818 | -*/ | 903 | + */ |
819 | function corQM($cor) | 904 | function corQM($cor) |
820 | { | 905 | { |
821 | $c = $this->mapa->querymap->color; | 906 | $c = $this->mapa->querymap->color; |
@@ -831,16 +916,16 @@ $cor - RGB separado por v&iacute;rgula. Se a cor for vazia, retorna a cor atual. | @@ -831,16 +916,16 @@ $cor - RGB separado por v&iacute;rgula. Se a cor for vazia, retorna a cor atual. | ||
831 | } | 916 | } |
832 | return ($retorno); | 917 | return ($retorno); |
833 | } | 918 | } |
834 | -/* | ||
835 | -Method: corfundo | 919 | + /* |
920 | + Method: corfundo | ||
836 | 921 | ||
837 | -Muda a cor do fundo do mapa. | 922 | + Muda a cor do fundo do mapa. |
838 | 923 | ||
839 | -Parameter: | 924 | + Parameter: |
840 | 925 | ||
841 | -$cor - RGB separado por vírgula. Se a cor for vazia, retorna a cor atual. | 926 | + $cor - RGB separado por vírgula. Se a cor for vazia, retorna a cor atual. |
842 | 927 | ||
843 | -*/ | 928 | + */ |
844 | function corfundo($cor) | 929 | function corfundo($cor) |
845 | { | 930 | { |
846 | $c = $this->mapa->imagecolor; | 931 | $c = $this->mapa->imagecolor; |
@@ -852,32 +937,33 @@ $cor - RGB separado por v&iacute;rgula. Se a cor for vazia, retorna a cor atual. | @@ -852,32 +937,33 @@ $cor - RGB separado por v&iacute;rgula. Se a cor for vazia, retorna a cor atual. | ||
852 | $this->mapa->setmetadata("cache",""); | 937 | $this->mapa->setmetadata("cache",""); |
853 | } | 938 | } |
854 | else | 939 | else |
855 | - {$retorno = $c->red.",".$c->green.",".$c->blue;} | 940 | + {$retorno = $c->red.",".$c->green.",".$c->blue; |
941 | + } | ||
856 | return ($retorno); | 942 | return ($retorno); |
857 | } | 943 | } |
858 | -/* | ||
859 | -Method: gradeCoord | 944 | + /* |
945 | + Method: gradeCoord | ||
860 | 946 | ||
861 | -Gera uma grade de coordenadas | 947 | + Gera uma grade de coordenadas |
862 | 948 | ||
863 | -A grade é incluida no mapa como um novo layer. | 949 | + A grade é incluida no mapa como um novo layer. |
864 | 950 | ||
865 | -Parameter: | 951 | + Parameter: |
866 | 952 | ||
867 | -$intervalo - intervalo entre as linhas da grade. | 953 | + $intervalo - intervalo entre as linhas da grade. |
868 | 954 | ||
869 | -$corlinha - cor em RGB das linhas da grade | 955 | + $corlinha - cor em RGB das linhas da grade |
870 | 956 | ||
871 | -$larguralinha - largura das linhas da grade em pixel | 957 | + $larguralinha - largura das linhas da grade em pixel |
872 | 958 | ||
873 | -$tipolinha - símbolo das linhas | 959 | + $tipolinha - símbolo das linhas |
874 | 960 | ||
875 | -$tamanhotexto - tamanho do texto | 961 | + $tamanhotexto - tamanho do texto |
876 | 962 | ||
877 | -$cortexto - cor do texto | 963 | + $cortexto - cor do texto |
878 | 964 | ||
879 | -$incluitexto - sim|nao | ||
880 | -*/ | 965 | + $incluitexto - sim|nao |
966 | + */ | ||
881 | function gradeCoord($intervalo,$corlinha="200,200,200",$larguralinha=1,$tipolinha="linha",$tamanhotexto=MS_TINY,$fonte="bitmap",$cortexto="0,0,0",$incluitexto="sim",$mascara="-1,-1,-1",$shadowcolor="-1,-1,-1",$shadowsizex=0,$shadowsizey=0) | 967 | function gradeCoord($intervalo,$corlinha="200,200,200",$larguralinha=1,$tipolinha="linha",$tamanhotexto=MS_TINY,$fonte="bitmap",$cortexto="0,0,0",$incluitexto="sim",$mascara="-1,-1,-1",$shadowcolor="-1,-1,-1",$shadowsizex=0,$shadowsizey=0) |
882 | { | 968 | { |
883 | //echo $corlinha; | 969 | //echo $corlinha; |
@@ -918,11 +1004,21 @@ $incluitexto - sim|nao | @@ -918,11 +1004,21 @@ $incluitexto - sim|nao | ||
918 | { | 1004 | { |
919 | $label->set("type",MS_BITMAP); | 1005 | $label->set("type",MS_BITMAP); |
920 | $t = MS_TINY; | 1006 | $t = MS_TINY; |
921 | - if ($tamanhotexto > 5 ){$t = MS_TINY;} | ||
922 | - if ($tamanhotexto >= 7 ){$t = MS_SMALL;} | ||
923 | - if ($tamanhotexto >= 10 ){$t = MS_MEDIUM;} | ||
924 | - if ($tamanhotexto >= 12 ){$t = MS_LARGE;} | ||
925 | - if ($tamanhotexto >= 14 ){$t = MS_GIANT;} | 1007 | + if ($tamanhotexto > 5 ){ |
1008 | + $t = MS_TINY; | ||
1009 | + } | ||
1010 | + if ($tamanhotexto >= 7 ){ | ||
1011 | + $t = MS_SMALL; | ||
1012 | + } | ||
1013 | + if ($tamanhotexto >= 10 ){ | ||
1014 | + $t = MS_MEDIUM; | ||
1015 | + } | ||
1016 | + if ($tamanhotexto >= 12 ){ | ||
1017 | + $t = MS_LARGE; | ||
1018 | + } | ||
1019 | + if ($tamanhotexto >= 14 ){ | ||
1020 | + $t = MS_GIANT; | ||
1021 | + } | ||
926 | $label->set("size",$t); | 1022 | $label->set("size",$t); |
927 | } | 1023 | } |
928 | $label->set("buffer",0); | 1024 | $label->set("buffer",0); |
@@ -935,7 +1031,7 @@ $incluitexto - sim|nao | @@ -935,7 +1031,7 @@ $incluitexto - sim|nao | ||
935 | $label->set("offsetx",0); | 1031 | $label->set("offsetx",0); |
936 | $label->set("offsety",0); | 1032 | $label->set("offsety",0); |
937 | if($mascara != "") | 1033 | if($mascara != "") |
938 | - corE($label,$mascara,"outlinecolor"); | 1034 | + corE($label,$mascara,"outlinecolor"); |
939 | if($shadowcolor != "") | 1035 | if($shadowcolor != "") |
940 | { | 1036 | { |
941 | corE($label,$shadowcolor,"shadowcolor"); | 1037 | corE($label,$shadowcolor,"shadowcolor"); |
@@ -945,27 +1041,27 @@ $incluitexto - sim|nao | @@ -945,27 +1041,27 @@ $incluitexto - sim|nao | ||
945 | } | 1041 | } |
946 | return ("ok"); | 1042 | return ("ok"); |
947 | } | 1043 | } |
948 | -/* | ||
949 | -Method: adicionaTema | 1044 | + /* |
1045 | + Method: adicionaTema | ||
950 | 1046 | ||
951 | -Acrescenta um novo tema em um arquivo map file. | 1047 | + Acrescenta um novo tema em um arquivo map file. |
952 | 1048 | ||
953 | -O tema deve estar incluído em um arquivo .map localizado no diretório "temas". | ||
954 | -Ao ser adicionado, todos os layers do arquivo indicado serão acrescentados. | ||
955 | -Os layers que formam grupos também são processados, tendo seus nomes alterados de acordo. | ||
956 | -Cada novo layer receberá um novo nome, definido de forma aleatória. | ||
957 | -Os nomes dos temas podem conter o caminho completo do mapfile. | ||
958 | -O nome original do LAYER (NAME) sera armazenado no metadata nomeoriginal | ||
959 | -O nome do tema (mapfile) original sera armazenado no metadata arquivotemaoriginal | 1049 | + O tema deve estar incluído em um arquivo .map localizado no diretório "temas". |
1050 | + Ao ser adicionado, todos os layers do arquivo indicado serão acrescentados. | ||
1051 | + Os layers que formam grupos também são processados, tendo seus nomes alterados de acordo. | ||
1052 | + Cada novo layer receberá um novo nome, definido de forma aleatória. | ||
1053 | + Os nomes dos temas podem conter o caminho completo do mapfile. | ||
1054 | + O nome original do LAYER (NAME) sera armazenado no metadata nomeoriginal | ||
1055 | + O nome do tema (mapfile) original sera armazenado no metadata arquivotemaoriginal | ||
960 | 1056 | ||
961 | -Parametros: | 1057 | + Parametros: |
962 | 1058 | ||
963 | -$temas - string Lista separada por vírgulas, dos arquivos que serão abertos para pegar os novos layers. Não inclua a extensão ".map". | 1059 | + $temas - string Lista separada por vírgulas, dos arquivos que serão abertos para pegar os novos layers. Não inclua a extensão ".map". |
964 | 1060 | ||
965 | -$locaplic - string Diretório onde fica a aplicação. | 1061 | + $locaplic - string Diretório onde fica a aplicação. |
966 | 1062 | ||
967 | -$random - indica se os nomes dos novos layers serão modificados ou nao | ||
968 | -*/ | 1063 | + $random - indica se os nomes dos novos layers serão modificados ou nao |
1064 | + */ | ||
969 | function adicionaTema($temas,$locaplic,$random="sim") | 1065 | function adicionaTema($temas,$locaplic,$random="sim") |
970 | { | 1066 | { |
971 | //limpa selecao | 1067 | //limpa selecao |
@@ -1082,7 +1178,7 @@ $random - indica se os nomes dos novos layers ser&atilde;o modificados ou nao | @@ -1082,7 +1178,7 @@ $random - indica se os nomes dos novos layers ser&atilde;o modificados ou nao | ||
1082 | if ($nlayer->group != " " && $nlayer->group != "" ){ | 1178 | if ($nlayer->group != " " && $nlayer->group != "" ){ |
1083 | $lr = $nlayer->group; | 1179 | $lr = $nlayer->group; |
1084 | if($nomeunico[$lr]) | 1180 | if($nomeunico[$lr]) |
1085 | - $nlayer->set("group",$nomeunico[$lr]); | 1181 | + $nlayer->set("group",$nomeunico[$lr]); |
1086 | } | 1182 | } |
1087 | // | 1183 | // |
1088 | //verifica se é um WMS e se existem classes definidas | 1184 | //verifica se é um WMS e se existem classes definidas |
@@ -1101,7 +1197,7 @@ $random - indica se os nomes dos novos layers ser&atilde;o modificados ou nao | @@ -1101,7 +1197,7 @@ $random - indica se os nomes dos novos layers ser&atilde;o modificados ou nao | ||
1101 | } | 1197 | } |
1102 | $sld = $nlayer->generateSLD(); | 1198 | $sld = $nlayer->generateSLD(); |
1103 | if($sld != "") | 1199 | if($sld != "") |
1104 | - $nlayer->setmetadata("wms_sld_body",str_replace('"',"'",$sld)); | 1200 | + $nlayer->setmetadata("wms_sld_body",str_replace('"',"'",$sld)); |
1105 | $nlayer->set("type",$tipotemp); | 1201 | $nlayer->set("type",$tipotemp); |
1106 | } | 1202 | } |
1107 | cloneInlineSymbol($nlayer,$nmap,$this->mapa); | 1203 | cloneInlineSymbol($nlayer,$nmap,$this->mapa); |
@@ -1136,21 +1232,23 @@ $random - indica se os nomes dos novos layers ser&atilde;o modificados ou nao | @@ -1136,21 +1232,23 @@ $random - indica se os nomes dos novos layers ser&atilde;o modificados ou nao | ||
1136 | } | 1232 | } |
1137 | return(true); | 1233 | return(true); |
1138 | } | 1234 | } |
1139 | -/* | ||
1140 | -Method: excluiTemas | 1235 | + /* |
1236 | + Method: excluiTemas | ||
1141 | 1237 | ||
1142 | -Exclui temas de um mapa. | 1238 | + Exclui temas de um mapa. |
1143 | 1239 | ||
1144 | -O arquivo de seleção (.qy) é apagado do diretório temporário. | 1240 | + O arquivo de seleção (.qy) é apagado do diretório temporário. |
1145 | 1241 | ||
1146 | -Parameter: | 1242 | + Parameter: |
1147 | 1243 | ||
1148 | -$temas - lista separada por vírgula dos temas que serão excluídos. | ||
1149 | -*/ | 1244 | + $temas - lista separada por vírgula dos temas que serão excluídos. |
1245 | + */ | ||
1150 | function excluiTemas($temas) | 1246 | function excluiTemas($temas) |
1151 | { | 1247 | { |
1152 | if (file_exists($this->qyfile)) | 1248 | if (file_exists($this->qyfile)) |
1153 | - {unlink($this->qyfile);} | 1249 | + { |
1250 | + unlink($this->qyfile); | ||
1251 | + } | ||
1154 | $temas = explode(",",$temas); | 1252 | $temas = explode(",",$temas); |
1155 | foreach ($temas as $nome) | 1253 | foreach ($temas as $nome) |
1156 | { | 1254 | { |
@@ -1180,21 +1278,21 @@ $temas - lista separada por v&iacute;rgula dos temas que ser&atilde;o exclu&iacu | @@ -1180,21 +1278,21 @@ $temas - lista separada por v&iacute;rgula dos temas que ser&atilde;o exclu&iacu | ||
1180 | } | 1278 | } |
1181 | return("ok"); | 1279 | return("ok"); |
1182 | } | 1280 | } |
1183 | -/* | ||
1184 | -Method: ligaDesligaTemas | 1281 | + /* |
1282 | + Method: ligaDesligaTemas | ||
1185 | 1283 | ||
1186 | -Liga desliga temas. | 1284 | + Liga desliga temas. |
1187 | 1285 | ||
1188 | -Torna temas visíveis ou não no mapa alterando seu status. | 1286 | + Torna temas visíveis ou não no mapa alterando seu status. |
1189 | 1287 | ||
1190 | -Parametros: | 1288 | + Parametros: |
1191 | 1289 | ||
1192 | -$ligar - lista separada por vírgula dos temas que serão ligados. | 1290 | + $ligar - lista separada por vírgula dos temas que serão ligados. |
1193 | 1291 | ||
1194 | -$desligar - lista separada por vírgula dos temas que serão desligados. Se for igual a todos, todos os layers serão desligados. | 1292 | + $desligar - lista separada por vírgula dos temas que serão desligados. Se for igual a todos, todos os layers serão desligados. |
1195 | 1293 | ||
1196 | -$adicionar - sim|nao força a adição de um tema se ele não existir no mapfile atual | ||
1197 | -*/ | 1294 | + $adicionar - sim|nao força a adição de um tema se ele não existir no mapfile atual |
1295 | + */ | ||
1198 | function ligaDesligaTemas($ligar,$desligar,$adicionar="nao") | 1296 | function ligaDesligaTemas($ligar,$desligar,$adicionar="nao") |
1199 | { | 1297 | { |
1200 | if(strTolower($adicionar) == "sim") | 1298 | if(strTolower($adicionar) == "sim") |
@@ -1209,7 +1307,9 @@ $adicionar - sim|nao for&ccedil;a a adi&ccedil;&atilde;o de um tema se ele n&ati | @@ -1209,7 +1307,9 @@ $adicionar - sim|nao for&ccedil;a a adi&ccedil;&atilde;o de um tema se ele n&ati | ||
1209 | } | 1307 | } |
1210 | foreach($teste as $t) | 1308 | foreach($teste as $t) |
1211 | { | 1309 | { |
1212 | - if(!in_array($t,$verificar)){$adicionar[] = $t;} | 1310 | + if(!in_array($t,$verificar)){ |
1311 | + $adicionar[] = $t; | ||
1312 | + } | ||
1213 | } | 1313 | } |
1214 | if(count($adicionar > 0)) | 1314 | if(count($adicionar > 0)) |
1215 | { | 1315 | { |
@@ -1218,7 +1318,9 @@ $adicionar - sim|nao for&ccedil;a a adi&ccedil;&atilde;o de um tema se ele n&ati | @@ -1218,7 +1318,9 @@ $adicionar - sim|nao for&ccedil;a a adi&ccedil;&atilde;o de um tema se ele n&ati | ||
1218 | $this->mapa = ms_newMapObj($this->arquivo); | 1318 | $this->mapa = ms_newMapObj($this->arquivo); |
1219 | $c = $this->mapa->numlayers; | 1319 | $c = $this->mapa->numlayers; |
1220 | for ($i=0;$i < $c;++$i) | 1320 | for ($i=0;$i < $c;++$i) |
1221 | - {$this->layers[] = $this->mapa->getlayer($i);} | 1321 | + { |
1322 | + $this->layers[] = $this->mapa->getlayer($i); | ||
1323 | + } | ||
1222 | } | 1324 | } |
1223 | } | 1325 | } |
1224 | if($desligar == "todos") | 1326 | if($desligar == "todos") |
@@ -1235,13 +1337,14 @@ $adicionar - sim|nao for&ccedil;a a adi&ccedil;&atilde;o de um tema se ele n&ati | @@ -1235,13 +1337,14 @@ $adicionar - sim|nao for&ccedil;a a adi&ccedil;&atilde;o de um tema se ele n&ati | ||
1235 | $vermultilayer = new vermultilayer(); | 1337 | $vermultilayer = new vermultilayer(); |
1236 | $vermultilayer->verifica($this->arquivo,$layer); | 1338 | $vermultilayer->verifica($this->arquivo,$layer); |
1237 | if ($vermultilayer->resultado == 1) // o tema e multi layer | 1339 | if ($vermultilayer->resultado == 1) // o tema e multi layer |
1238 | - {$ls = $vermultilayer->temas;} | 1340 | + {$ls = $vermultilayer->temas; |
1341 | + } | ||
1239 | $ls[] = $layer; | 1342 | $ls[] = $layer; |
1240 | foreach ($ls as $l) | 1343 | foreach ($ls as $l) |
1241 | { | 1344 | { |
1242 | $l = $this->mapa->getlayerbyname($l); | 1345 | $l = $this->mapa->getlayerbyname($l); |
1243 | if($l) | 1346 | if($l) |
1244 | - $l->set("status",2); | 1347 | + $l->set("status",2); |
1245 | } | 1348 | } |
1246 | } | 1349 | } |
1247 | } | 1350 | } |
@@ -1254,60 +1357,64 @@ $adicionar - sim|nao for&ccedil;a a adi&ccedil;&atilde;o de um tema se ele n&ati | @@ -1254,60 +1357,64 @@ $adicionar - sim|nao for&ccedil;a a adi&ccedil;&atilde;o de um tema se ele n&ati | ||
1254 | $vermultilayer = new vermultilayer(); | 1357 | $vermultilayer = new vermultilayer(); |
1255 | $vermultilayer->verifica($this->arquivo,$layer); | 1358 | $vermultilayer->verifica($this->arquivo,$layer); |
1256 | if ($vermultilayer->resultado == 1) // o tema e multi layer | 1359 | if ($vermultilayer->resultado == 1) // o tema e multi layer |
1257 | - {$ls = $vermultilayer->temas;} | 1360 | + {$ls = $vermultilayer->temas; |
1361 | + } | ||
1258 | else | 1362 | else |
1259 | - {$ls[] = $layer;} | 1363 | + {$ls[] = $layer; |
1364 | + } | ||
1260 | foreach ($ls as $l) | 1365 | foreach ($ls as $l) |
1261 | { | 1366 | { |
1262 | $l = $this->mapa->getlayerbyname($l); | 1367 | $l = $this->mapa->getlayerbyname($l); |
1263 | if($l) | 1368 | if($l) |
1264 | - $l->set("status",0); | 1369 | + $l->set("status",0); |
1265 | } | 1370 | } |
1266 | } | 1371 | } |
1267 | } | 1372 | } |
1268 | return("ok"); | 1373 | return("ok"); |
1269 | } | 1374 | } |
1270 | -/* | ||
1271 | -Method: adicionatemawms | ||
1272 | - | ||
1273 | -Acrescenta um novo tema em um arquivo map file tendo como fonte um WMS. | ||
1274 | - | ||
1275 | -Parametros: | ||
1276 | - | ||
1277 | -$tema - Tema que será adicionado. | ||
1278 | -$servico - Endereço do web service. | ||
1279 | -$nome - Nome do tema para a legenda. | ||
1280 | -$proj - Lista das projeções suportadas separadas por vírgula. | ||
1281 | -$formato - Lista dos formatos de imagem separadas por vírgula. | ||
1282 | -$locaplic - Diretório onde fica a aplicação. | ||
1283 | -$tipo - Tipo de representação poligonal|linear|pontual. | ||
1284 | -$versao - Versão do getcapabilities | ||
1285 | -$nomecamada - nome da camada do WMS | ||
1286 | -$dir_tmp - diretório temporário do I3Geo | ||
1287 | -$imgdir - diretório temporário das imagens | ||
1288 | -$imgurl - url do imgdir | ||
1289 | -$tiporep - tipo de representação das feições do mapa. Quando definido, é criado um sld para ser aplicado ao layer. poligonal|linear|pontual | ||
1290 | -$suportasld - Suporta SLD sim|nao. | ||
1291 | -$formatosinfo - lista de formatos da requisição de atributos para a função getfeatureinfo (default text/plain) | ||
1292 | -$time - específico para WMS-T (parâmentro wms_time) | ||
1293 | -$tile - indica se o WMS e do tipo TILE ou nao (0 ou 1) | ||
1294 | -Include: | ||
1295 | -<wmswfs.php> | ||
1296 | -*/ | 1375 | + /* |
1376 | + Method: adicionatemawms | ||
1377 | + | ||
1378 | + Acrescenta um novo tema em um arquivo map file tendo como fonte um WMS. | ||
1379 | + | ||
1380 | + Parametros: | ||
1381 | + | ||
1382 | + $tema - Tema que será adicionado. | ||
1383 | + $servico - Endereço do web service. | ||
1384 | + $nome - Nome do tema para a legenda. | ||
1385 | + $proj - Lista das projeções suportadas separadas por vírgula. | ||
1386 | + $formato - Lista dos formatos de imagem separadas por vírgula. | ||
1387 | + $locaplic - Diretório onde fica a aplicação. | ||
1388 | + $tipo - Tipo de representação poligonal|linear|pontual. | ||
1389 | + $versao - Versão do getcapabilities | ||
1390 | + $nomecamada - nome da camada do WMS | ||
1391 | + $dir_tmp - diretório temporário do I3Geo | ||
1392 | + $imgdir - diretório temporário das imagens | ||
1393 | + $imgurl - url do imgdir | ||
1394 | + $tiporep - tipo de representação das feições do mapa. Quando definido, é criado um sld para ser aplicado ao layer. poligonal|linear|pontual | ||
1395 | + $suportasld - Suporta SLD sim|nao. | ||
1396 | + $formatosinfo - lista de formatos da requisição de atributos para a função getfeatureinfo (default text/plain) | ||
1397 | + $time - específico para WMS-T (parâmentro wms_time) | ||
1398 | + $tile - indica se o WMS e do tipo TILE ou nao (0 ou 1) | ||
1399 | + Include: | ||
1400 | + <wmswfs.php> | ||
1401 | + */ | ||
1297 | function adicionatemawms($tema,$servico,$nome,$proj,$formato,$locaplic,$tipo="",$versao,$nomecamada,$dir_tmp,$imgdir,$imgurl,$tiporep,$suportasld,$formatosinfo="text/plain",$time="",$tile=0) | 1402 | function adicionatemawms($tema,$servico,$nome,$proj,$formato,$locaplic,$tipo="",$versao,$nomecamada,$dir_tmp,$imgdir,$imgurl,$tiporep,$suportasld,$formatosinfo="text/plain",$time="",$tile=0) |
1298 | { | 1403 | { |
1299 | //echo $tile;exit; | 1404 | //echo $tile;exit; |
1300 | if(file_exists($this->locaplic."/classesphp/wmswfs.php")) | 1405 | if(file_exists($this->locaplic."/classesphp/wmswfs.php")) |
1301 | - include_once($this->locaplic."/classesphp/wmswfs.php"); | 1406 | + include_once($this->locaplic."/classesphp/wmswfs.php"); |
1302 | else | 1407 | else |
1303 | - include_once("wmswfs.php"); | 1408 | + include_once("wmswfs.php"); |
1304 | //limpa selecao | 1409 | //limpa selecao |
1305 | if (file_exists($this->qyfile)) | 1410 | if (file_exists($this->qyfile)) |
1306 | - {unlink ($this->qyfile);} | 1411 | + { |
1412 | + unlink ($this->qyfile); | ||
1413 | + } | ||
1307 | $layer = ms_newLayerObj($this->mapa); | 1414 | $layer = ms_newLayerObj($this->mapa); |
1308 | $layer->set("status",MS_DEFAULT); | 1415 | $layer->set("status",MS_DEFAULT); |
1309 | if($nomecamada == "default") | 1416 | if($nomecamada == "default") |
1310 | - $nomecamada = $tema; | 1417 | + $nomecamada = $tema; |
1311 | $layer->setmetadata("CLASSE","SIM"); | 1418 | $layer->setmetadata("CLASSE","SIM"); |
1312 | $layer->setmetadata("TEXTO","NAO"); | 1419 | $layer->setmetadata("TEXTO","NAO"); |
1313 | $layer->setmetadata("tema",$nomecamada); | 1420 | $layer->setmetadata("tema",$nomecamada); |
@@ -1325,7 +1432,9 @@ Include: | @@ -1325,7 +1432,9 @@ Include: | ||
1325 | $cor->setRGB(-1,-1,-1); | 1432 | $cor->setRGB(-1,-1,-1); |
1326 | } | 1433 | } |
1327 | if ($tiporep == "pontual") | 1434 | if ($tiporep == "pontual") |
1328 | - {$layer->set("type",MS_LAYER_POINT);} | 1435 | + { |
1436 | + $layer->set("type",MS_LAYER_POINT); | ||
1437 | + } | ||
1329 | $sld = $layer->generateSLD(); | 1438 | $sld = $layer->generateSLD(); |
1330 | $fp = fopen($dir_tmp."/".$imgdir."/".$layer->name."sld.xml", "a"); | 1439 | $fp = fopen($dir_tmp."/".$imgdir."/".$layer->name."sld.xml", "a"); |
1331 | fputs( $fp, $sld ); | 1440 | fputs( $fp, $sld ); |
@@ -1336,9 +1445,12 @@ Include: | @@ -1336,9 +1445,12 @@ Include: | ||
1336 | $layer->set("connection",$servico); | 1445 | $layer->set("connection",$servico); |
1337 | 1446 | ||
1338 | if(ms_GetVersionInt() > 50201) | 1447 | if(ms_GetVersionInt() > 50201) |
1339 | - {$layer->setconnectiontype(MS_WMS);} | 1448 | + { |
1449 | + $layer->setconnectiontype(MS_WMS); | ||
1450 | + } | ||
1340 | else | 1451 | else |
1341 | - {$layer->set("connectiontype",MS_WMS);} | 1452 | + {$layer->set("connectiontype",MS_WMS); |
1453 | + } | ||
1342 | 1454 | ||
1343 | $epsg = "EPSG:4618"; | 1455 | $epsg = "EPSG:4618"; |
1344 | $e4291 = "nao"; | 1456 | $e4291 = "nao"; |
@@ -1351,16 +1463,27 @@ Include: | @@ -1351,16 +1463,27 @@ Include: | ||
1351 | { | 1463 | { |
1352 | $p = explode(":",$p); | 1464 | $p = explode(":",$p); |
1353 | if ($p[1] == "4326") | 1465 | if ($p[1] == "4326") |
1354 | - {$epsg = "EPSG:4326";} | 1466 | + { |
1467 | + $epsg = "EPSG:4326"; | ||
1468 | + } | ||
1355 | if ($p[1] == "4618") | 1469 | if ($p[1] == "4618") |
1356 | - {$epsg = "EPSG:4618";$e4291="sim";} | 1470 | + { |
1471 | + $epsg = "EPSG:4618";$e4291="sim"; | ||
1472 | + } | ||
1357 | if ($p[1] == "84") | 1473 | if ($p[1] == "84") |
1358 | - {$ecrs = "CRS:84";$ecrs = "sim";} | 1474 | + { |
1475 | + $ecrs = "CRS:84";$ecrs = "sim"; | ||
1476 | + } | ||
1359 | } | 1477 | } |
1360 | } | 1478 | } |
1361 | - else {$epsg = $proj;} | ||
1362 | - if ($e4291 == "sim"){$epsg = "EPSG:4618";} | ||
1363 | - if ($ecrs == "sim"){$epsg = $ecrs;} | 1479 | + else {$epsg = $proj; |
1480 | + } | ||
1481 | + if ($e4291 == "sim"){ | ||
1482 | + $epsg = "EPSG:4618"; | ||
1483 | + } | ||
1484 | + if ($ecrs == "sim"){ | ||
1485 | + $epsg = $ecrs; | ||
1486 | + } | ||
1364 | $epsg = trim($epsg); | 1487 | $epsg = trim($epsg); |
1365 | $layer->setmetadata("wms_srs",$epsg); | 1488 | $layer->setmetadata("wms_srs",$epsg); |
1366 | $layer->setmetadata("wms_crs",$epsg); | 1489 | $layer->setmetadata("wms_crs",$epsg); |
@@ -1375,12 +1498,14 @@ Include: | @@ -1375,12 +1498,14 @@ Include: | ||
1375 | //esse parametro e especifico do i3geo. Se for 1 indica um servico do tipo tile | 1498 | //esse parametro e especifico do i3geo. Se for 1 indica um servico do tipo tile |
1376 | $layer->setmetadata("wms_tile",$tile); | 1499 | $layer->setmetadata("wms_tile",$tile); |
1377 | if($time != "") | 1500 | if($time != "") |
1378 | - $layer->setmetadata("wms_time",$time); | 1501 | + $layer->setmetadata("wms_time",$time); |
1379 | //pega o tipo de formato de imagem que deve ser requisitado | 1502 | //pega o tipo de formato de imagem que deve ser requisitado |
1380 | //a preferência é png, mas se não for possível, pega o primeiro da lista de formatos | 1503 | //a preferência é png, mas se não for possível, pega o primeiro da lista de formatos |
1381 | //disponíveis no formato | 1504 | //disponíveis no formato |
1382 | if (stristr($formato,"png")) | 1505 | if (stristr($formato,"png")) |
1383 | - {$im = "image/png";} | 1506 | + { |
1507 | + $im = "image/png"; | ||
1508 | + } | ||
1384 | else | 1509 | else |
1385 | { | 1510 | { |
1386 | $im = explode(",",$formato); | 1511 | $im = explode(",",$formato); |
@@ -1405,29 +1530,29 @@ Include: | @@ -1405,29 +1530,29 @@ Include: | ||
1405 | //$of->set("imagemode",MS_IMAGEMODE_RGB); | 1530 | //$of->set("imagemode",MS_IMAGEMODE_RGB); |
1406 | $this->salva(); | 1531 | $this->salva(); |
1407 | } | 1532 | } |
1408 | -/* | ||
1409 | -Method: converteWS | 1533 | + /* |
1534 | + Method: converteWS | ||
1410 | 1535 | ||
1411 | -Transforma o mapa atual em um web service. | 1536 | + Transforma o mapa atual em um web service. |
1412 | 1537 | ||
1413 | -O novo map file é armazenado no mesmo diretório do map file original. | 1538 | + O novo map file é armazenado no mesmo diretório do map file original. |
1414 | 1539 | ||
1415 | -Parametros: | 1540 | + Parametros: |
1416 | 1541 | ||
1417 | -$locaplic - localização do i3Geo | 1542 | + $locaplic - localização do i3Geo |
1418 | 1543 | ||
1419 | -$h - host name | 1544 | + $h - host name |
1420 | 1545 | ||
1421 | -Return: | 1546 | + Return: |
1422 | 1547 | ||
1423 | -Endereço do WMS | ||
1424 | -*/ | 1548 | + Endereço do WMS |
1549 | + */ | ||
1425 | function converteWS($locaplic,$h) | 1550 | function converteWS($locaplic,$h) |
1426 | { | 1551 | { |
1427 | //$nomews = str_replace(".map","ws.map",$this->arquivo); | 1552 | //$nomews = str_replace(".map","ws.map",$this->arquivo); |
1428 | $nomeurl = "/ogc.php?tema=".$this->arquivo; | 1553 | $nomeurl = "/ogc.php?tema=".$this->arquivo; |
1429 | /* | 1554 | /* |
1430 | - $w = $this->mapa->web; | 1555 | + $w = $this->mapa->web; |
1431 | $w->set("template",""); | 1556 | $w->set("template",""); |
1432 | //adiciona os parametros no nivel do mapa | 1557 | //adiciona os parametros no nivel do mapa |
1433 | $this->mapa->setmetadata("wms_title","I3Geo"); | 1558 | $this->mapa->setmetadata("wms_title","I3Geo"); |
@@ -1437,20 +1562,20 @@ Endere&ccedil;o do WMS | @@ -1437,20 +1562,20 @@ Endere&ccedil;o do WMS | ||
1437 | //$this->mapa->setmetadata("wms_getcontext_enabled","1"); | 1562 | //$this->mapa->setmetadata("wms_getcontext_enabled","1"); |
1438 | foreach ($this->layers as $layer) | 1563 | foreach ($this->layers as $layer) |
1439 | { | 1564 | { |
1440 | - $n = pegaNome($layer); | ||
1441 | - $layer->setmetadata("wms_title",$n); | ||
1442 | - $layer->setmetadata("wms_name",$n); | ||
1443 | - $layer->setmetadata("wms_srs","EPSG:4291 EPSG:4326"); | ||
1444 | - //$layer->setmetadata("wms_getcontext_enabled","1"); | ||
1445 | - $layer->setmetadata("WMS_INCLUDE_ITEMS","all"); | ||
1446 | - //$layer->setmetadata("wms_onlineresource","http://".$h.$nomeurl); | ||
1447 | - $layer->set("status","ON"); | ||
1448 | - $layer->set("template","none.htm"); | ||
1449 | - $layer->setmetadata("gml_include_items","all"); | ||
1450 | - $layer->set("dump",MS_TRUE); | ||
1451 | - $c = $layer->getclass(0); | ||
1452 | - if ($c->name == "") | ||
1453 | - {$c->name = " ";} | 1565 | + $n = pegaNome($layer); |
1566 | + $layer->setmetadata("wms_title",$n); | ||
1567 | + $layer->setmetadata("wms_name",$n); | ||
1568 | + $layer->setmetadata("wms_srs","EPSG:4291 EPSG:4326"); | ||
1569 | + //$layer->setmetadata("wms_getcontext_enabled","1"); | ||
1570 | + $layer->setmetadata("WMS_INCLUDE_ITEMS","all"); | ||
1571 | + //$layer->setmetadata("wms_onlineresource","http://".$h.$nomeurl); | ||
1572 | + $layer->set("status","ON"); | ||
1573 | + $layer->set("template","none.htm"); | ||
1574 | + $layer->setmetadata("gml_include_items","all"); | ||
1575 | + $layer->set("dump",MS_TRUE); | ||
1576 | + $c = $layer->getclass(0); | ||
1577 | + if ($c->name == "") | ||
1578 | + {$c->name = " ";} | ||
1454 | } | 1579 | } |
1455 | $eb = $this->mapa->scalebar; | 1580 | $eb = $this->mapa->scalebar; |
1456 | $eb->set("status",MS_OFF); | 1581 | $eb->set("status",MS_OFF); |
@@ -1458,23 +1583,23 @@ Endere&ccedil;o do WMS | @@ -1458,23 +1583,23 @@ Endere&ccedil;o do WMS | ||
1458 | */ | 1583 | */ |
1459 | return($nomeurl); | 1584 | return($nomeurl); |
1460 | } | 1585 | } |
1461 | -/* | ||
1462 | -Method: converteWMC | 1586 | + /* |
1587 | + Method: converteWMC | ||
1463 | 1588 | ||
1464 | -Transforma o mapa atual em um Web Map Context. | 1589 | + Transforma o mapa atual em um Web Map Context. |
1465 | 1590 | ||
1466 | -O novo map file é armazenado no mesmo diretório do map file original. | 1591 | + O novo map file é armazenado no mesmo diretório do map file original. |
1467 | 1592 | ||
1468 | -Parametros: | 1593 | + Parametros: |
1469 | 1594 | ||
1470 | -$locmapserv - localização do CGI do mapserver | 1595 | + $locmapserv - localização do CGI do mapserver |
1471 | 1596 | ||
1472 | -$h - host name | 1597 | + $h - host name |
1473 | 1598 | ||
1474 | -Return: | 1599 | + Return: |
1475 | 1600 | ||
1476 | -Endereço do WMC | ||
1477 | -*/ | 1601 | + Endereço do WMC |
1602 | + */ | ||
1478 | function converteWMC($locmapserv,$h) | 1603 | function converteWMC($locmapserv,$h) |
1479 | { | 1604 | { |
1480 | $protocolo = explode("/",$_SERVER['SERVER_PROTOCOL']); | 1605 | $protocolo = explode("/",$_SERVER['SERVER_PROTOCOL']); |
@@ -1500,7 +1625,9 @@ Endere&ccedil;o do WMC | @@ -1500,7 +1625,9 @@ Endere&ccedil;o do WMC | ||
1500 | $layer->setmetadata("wms_title",$n); | 1625 | $layer->setmetadata("wms_title",$n); |
1501 | $codigo = $layer->getmetadata("nomeoriginal"); | 1626 | $codigo = $layer->getmetadata("nomeoriginal"); |
1502 | if($codigo == "") | 1627 | if($codigo == "") |
1503 | - {$codigo = $layer->name;} | 1628 | + { |
1629 | + $codigo = $layer->name; | ||
1630 | + } | ||
1504 | $layer->setmetadata("wms_server_version","1.0.0"); | 1631 | $layer->setmetadata("wms_server_version","1.0.0"); |
1505 | $layer->setmetadata("wms_name",$codigo); | 1632 | $layer->setmetadata("wms_name",$codigo); |
1506 | //$layer->setmetadata("wms_srs","EPSG:4291 EPSG:4326"); | 1633 | //$layer->setmetadata("wms_srs","EPSG:4291 EPSG:4326"); |
@@ -1514,17 +1641,24 @@ Endere&ccedil;o do WMC | @@ -1514,17 +1641,24 @@ Endere&ccedil;o do WMC | ||
1514 | $layer->set("template","none.htm"); | 1641 | $layer->set("template","none.htm"); |
1515 | $c = $layer->getclass(0); | 1642 | $c = $layer->getclass(0); |
1516 | if ($c->name == "") | 1643 | if ($c->name == "") |
1517 | - {$c->name = " ";} | 1644 | + { |
1645 | + $c->name = " "; | ||
1646 | + } | ||
1518 | if($layer->connectiontype != "WS_WMS" && $layer->getmetadata("permiteogc") == "" && $layer->getmetadata("TEMALOCAL") == ""){ | 1647 | if($layer->connectiontype != "WS_WMS" && $layer->getmetadata("permiteogc") == "" && $layer->getmetadata("TEMALOCAL") == ""){ |
1519 | if(ms_GetVersionInt() > 50201) | 1648 | if(ms_GetVersionInt() > 50201) |
1520 | - {$layer->setconnectiontype(MS_WMS);} | 1649 | + { |
1650 | + $layer->setconnectiontype(MS_WMS); | ||
1651 | + } | ||
1521 | else | 1652 | else |
1522 | - {$layer->set("connectiontype",MS_WMS);} | 1653 | + {$layer->set("connectiontype",MS_WMS); |
1654 | + } | ||
1523 | $data = $urli3geo."/ogc.php?tema=".$codigo; | 1655 | $data = $urli3geo."/ogc.php?tema=".$codigo; |
1524 | $layer->set("connection",$data); | 1656 | $layer->set("connection",$data); |
1525 | $layer->set("data",""); | 1657 | $layer->set("data",""); |
1526 | if(file_exists("../temas/".$codigo.".map")) | 1658 | if(file_exists("../temas/".$codigo.".map")) |
1527 | - {$layer->setmetadata("wms_onlineresource",$data);} | 1659 | + { |
1660 | + $layer->setmetadata("wms_onlineresource",$data); | ||
1661 | + } | ||
1528 | } | 1662 | } |
1529 | } | 1663 | } |
1530 | else{ | 1664 | else{ |
@@ -1536,18 +1670,18 @@ Endere&ccedil;o do WMC | @@ -1536,18 +1670,18 @@ Endere&ccedil;o do WMC | ||
1536 | $this->mapa->save($nomews); | 1670 | $this->mapa->save($nomews); |
1537 | return($nomeurl."&service=WMS&request=GetContext&version=1.1.0"); | 1671 | return($nomeurl."&service=WMS&request=GetContext&version=1.1.0"); |
1538 | } | 1672 | } |
1539 | -/* | ||
1540 | -Method: adicionaTemaGeoJson | 1673 | + /* |
1674 | + Method: adicionaTemaGeoJson | ||
1541 | 1675 | ||
1542 | -Adiciona um canal GeoRSS como um tema no mapa. | 1676 | + Adiciona um canal GeoRSS como um tema no mapa. |
1543 | 1677 | ||
1544 | -Parametros: | 1678 | + Parametros: |
1545 | 1679 | ||
1546 | -$servico - Endereço (url) do GeoJson. | ||
1547 | -$dir_tmp - Diretório onde o arquivo será criado. | ||
1548 | -$locaplic - Localização do I3geo | 1680 | + $servico - Endereço (url) do GeoJson. |
1681 | + $dir_tmp - Diretório onde o arquivo será criado. | ||
1682 | + $locaplic - Localização do I3geo | ||
1549 | 1683 | ||
1550 | -*/ | 1684 | + */ |
1551 | function adicionaTemaGeoJson($servico,$dir_tmp,$locaplic){ | 1685 | function adicionaTemaGeoJson($servico,$dir_tmp,$locaplic){ |
1552 | $servico = str_replace("|","?",$servico); | 1686 | $servico = str_replace("|","?",$servico); |
1553 | $servico = str_replace("#","&",$servico); | 1687 | $servico = str_replace("#","&",$servico); |
@@ -1556,20 +1690,29 @@ $locaplic - Localiza&ccedil;&atilde;o do I3geo | @@ -1556,20 +1690,29 @@ $locaplic - Localiza&ccedil;&atilde;o do I3geo | ||
1556 | $novolayer = ms_newLayerObj($this->mapa); | 1690 | $novolayer = ms_newLayerObj($this->mapa); |
1557 | $novolayer->set("connection",$servico); | 1691 | $novolayer->set("connection",$servico); |
1558 | if(ms_GetVersionInt() > 50201) | 1692 | if(ms_GetVersionInt() > 50201) |
1559 | - {$novolayer->setconnectiontype(MS_OGR);} | 1693 | + { |
1694 | + $novolayer->setconnectiontype(MS_OGR); | ||
1695 | + } | ||
1560 | else | 1696 | else |
1561 | - {$novolayer->set("connectiontype",MS_OGR);} | 1697 | + {$novolayer->set("connectiontype",MS_OGR); |
1698 | + } | ||
1562 | $nome = nomeRandomico(10)."geoJson"; | 1699 | $nome = nomeRandomico(10)."geoJson"; |
1563 | $novolayer->set("name",$nome.$tipo); | 1700 | $novolayer->set("name",$nome.$tipo); |
1564 | $novolayer->setmetadata("TEMA","GeoJson ".$nome." ".$tipo); | 1701 | $novolayer->setmetadata("TEMA","GeoJson ".$nome." ".$tipo); |
1565 | $novolayer->setmetadata("DOWNLOAD","SIM"); | 1702 | $novolayer->setmetadata("DOWNLOAD","SIM"); |
1566 | $novolayer->setmetadata("CLASSE","SIM"); | 1703 | $novolayer->setmetadata("CLASSE","SIM"); |
1567 | if($tipo == "pontos") | 1704 | if($tipo == "pontos") |
1568 | - {$novolayer->set("type",MS_LAYER_POINT);} | 1705 | + { |
1706 | + $novolayer->set("type",MS_LAYER_POINT); | ||
1707 | + } | ||
1569 | if($tipo == "linhas") | 1708 | if($tipo == "linhas") |
1570 | - {$novolayer->set("type",MS_LAYER_LINE);} | 1709 | + { |
1710 | + $novolayer->set("type",MS_LAYER_LINE); | ||
1711 | + } | ||
1571 | if($tipo == "poligonos") | 1712 | if($tipo == "poligonos") |
1572 | - {$novolayer->set("type",MS_LAYER_POLYGON);} | 1713 | + { |
1714 | + $novolayer->set("type",MS_LAYER_POLYGON); | ||
1715 | + } | ||
1573 | $novolayer->set("type",$tipo); | 1716 | $novolayer->set("type",$tipo); |
1574 | $novolayer->set("data","OGRGeoJSON"); | 1717 | $novolayer->set("data","OGRGeoJSON"); |
1575 | $novolayer->setfilter(""); | 1718 | $novolayer->setfilter(""); |
@@ -1589,25 +1732,27 @@ $locaplic - Localiza&ccedil;&atilde;o do I3geo | @@ -1589,25 +1732,27 @@ $locaplic - Localiza&ccedil;&atilde;o do I3geo | ||
1589 | } | 1732 | } |
1590 | return "ok"; | 1733 | return "ok"; |
1591 | } | 1734 | } |
1592 | -/* | ||
1593 | -Method: adicionaTemaGeoRSS | 1735 | + /* |
1736 | + Method: adicionaTemaGeoRSS | ||
1594 | 1737 | ||
1595 | -Adiciona um canal GeoRSS como um tema no mapa. | 1738 | + Adiciona um canal GeoRSS como um tema no mapa. |
1596 | 1739 | ||
1597 | -Parametros: | 1740 | + Parametros: |
1598 | 1741 | ||
1599 | -$servico - Endereço (url) do RSS. | ||
1600 | -$dir_tmp - Diretório onde o arquivo será criado. | ||
1601 | -$locaplic - Localização do I3geo | ||
1602 | -$canal - Identificador do canal (ordem em que está no RSS) | ||
1603 | -*/ | 1742 | + $servico - Endereço (url) do RSS. |
1743 | + $dir_tmp - Diretório onde o arquivo será criado. | ||
1744 | + $locaplic - Localização do I3geo | ||
1745 | + $canal - Identificador do canal (ordem em que está no RSS) | ||
1746 | + */ | ||
1604 | function adicionaTemaGeoRSS($servico,$dir_tmp,$locaplic,$canal) | 1747 | function adicionaTemaGeoRSS($servico,$dir_tmp,$locaplic,$canal) |
1605 | { | 1748 | { |
1606 | $xml = simplexml_load_file($servico); | 1749 | $xml = simplexml_load_file($servico); |
1607 | $conta = 0; | 1750 | $conta = 0; |
1608 | foreach($xml->channel as $c){ | 1751 | foreach($xml->channel as $c){ |
1609 | if ($conta == $canal) | 1752 | if ($conta == $canal) |
1610 | - {$canal = $c;} | 1753 | + { |
1754 | + $canal = $c; | ||
1755 | + } | ||
1611 | } | 1756 | } |
1612 | $resultado = array(); | 1757 | $resultado = array(); |
1613 | $tipog = ""; | 1758 | $tipog = ""; |
@@ -1615,11 +1760,17 @@ $canal - Identificador do canal (ordem em que est&aacute; no RSS) | @@ -1615,11 +1760,17 @@ $canal - Identificador do canal (ordem em que est&aacute; no RSS) | ||
1615 | $env = array(); | 1760 | $env = array(); |
1616 | //define o tipo | 1761 | //define o tipo |
1617 | if ($item->xpath('geo:lat')) | 1762 | if ($item->xpath('geo:lat')) |
1618 | - {$tipog = "geo";} | 1763 | + { |
1764 | + $tipog = "geo"; | ||
1765 | + } | ||
1619 | if ($item->xpath('georss:point')) | 1766 | if ($item->xpath('georss:point')) |
1620 | - {$tipog = "georsspoint";} | 1767 | + { |
1768 | + $tipog = "georsspoint"; | ||
1769 | + } | ||
1621 | if ($item->xpath('georss:where')) | 1770 | if ($item->xpath('georss:where')) |
1622 | - {$tipog = "envelope";} | 1771 | + { |
1772 | + $tipog = "envelope"; | ||
1773 | + } | ||
1623 | if ($tipog == "envelope"){ | 1774 | if ($tipog == "envelope"){ |
1624 | foreach ($item->xpath('georss:where') as $w) | 1775 | foreach ($item->xpath('georss:where') as $w) |
1625 | { | 1776 | { |
@@ -1638,7 +1789,9 @@ $canal - Identificador do canal (ordem em que est&aacute; no RSS) | @@ -1638,7 +1789,9 @@ $canal - Identificador do canal (ordem em que est&aacute; no RSS) | ||
1638 | $xmin = $lc[1]; | 1789 | $xmin = $lc[1]; |
1639 | $xmax = $uc[1]; | 1790 | $xmax = $uc[1]; |
1640 | if ($ymin !="") | 1791 | if ($ymin !="") |
1641 | - {$env = array($xmin,$ymin,$xmax,$ymax);} | 1792 | + { |
1793 | + $env = array($xmin,$ymin,$xmax,$ymax); | ||
1794 | + } | ||
1642 | } | 1795 | } |
1643 | } | 1796 | } |
1644 | } | 1797 | } |
@@ -1671,8 +1824,12 @@ $canal - Identificador do canal (ordem em que est&aacute; no RSS) | @@ -1671,8 +1824,12 @@ $canal - Identificador do canal (ordem em que est&aacute; no RSS) | ||
1671 | include_once (dirname(__FILE__)."/../pacotes/phpxbase/api_conversion.php"); | 1824 | include_once (dirname(__FILE__)."/../pacotes/phpxbase/api_conversion.php"); |
1672 | $diretorio = dirname($this->arquivo); | 1825 | $diretorio = dirname($this->arquivo); |
1673 | $tipol = MS_SHP_POLYGON; | 1826 | $tipol = MS_SHP_POLYGON; |
1674 | - if ($tipog == "georsspoint"){$tipol = MS_SHP_POINT;} | ||
1675 | - if ($tipog == "geo"){$tipol = MS_SHP_POINT;} | 1827 | + if ($tipog == "georsspoint"){ |
1828 | + $tipol = MS_SHP_POINT; | ||
1829 | + } | ||
1830 | + if ($tipog == "geo"){ | ||
1831 | + $tipol = MS_SHP_POINT; | ||
1832 | + } | ||
1676 | $novonomelayer = nomeRandomico(10)."georss"; | 1833 | $novonomelayer = nomeRandomico(10)."georss"; |
1677 | $nomeshp = $diretorio."/".$novonomelayer; | 1834 | $nomeshp = $diretorio."/".$novonomelayer; |
1678 | $novoshpf = ms_newShapefileObj($nomeshp, $tipol); | 1835 | $novoshpf = ms_newShapefileObj($nomeshp, $tipol); |
@@ -1681,9 +1838,12 @@ $canal - Identificador do canal (ordem em que est&aacute; no RSS) | @@ -1681,9 +1838,12 @@ $canal - Identificador do canal (ordem em que est&aacute; no RSS) | ||
1681 | $def[] = array("DESC","C","254"); | 1838 | $def[] = array("DESC","C","254"); |
1682 | $def[] = array("CATEGORIA","C","254"); | 1839 | $def[] = array("CATEGORIA","C","254"); |
1683 | if(!function_exists(dbase_create)) | 1840 | if(!function_exists(dbase_create)) |
1684 | - {$db = xbase_create($nomeshp.".dbf", $def);xbase_close($db);} | 1841 | + { |
1842 | + $db = xbase_create($nomeshp.".dbf", $def);xbase_close($db); | ||
1843 | + } | ||
1685 | else | 1844 | else |
1686 | - {$db = dbase_create($nomeshp.".dbf", $def);dbase_close($db);} | 1845 | + {$db = dbase_create($nomeshp.".dbf", $def);dbase_close($db); |
1846 | + } | ||
1687 | //acrescenta os pontos no novo shapefile | 1847 | //acrescenta os pontos no novo shapefile |
1688 | $dbname = $nomeshp.".dbf"; | 1848 | $dbname = $nomeshp.".dbf"; |
1689 | $db=xbase_open($dbname,2); | 1849 | $db=xbase_open($dbname,2); |
@@ -1748,22 +1908,22 @@ $canal - Identificador do canal (ordem em que est&aacute; no RSS) | @@ -1748,22 +1908,22 @@ $canal - Identificador do canal (ordem em que est&aacute; no RSS) | ||
1748 | } | 1908 | } |
1749 | return("erro"); | 1909 | return("erro"); |
1750 | } | 1910 | } |
1751 | -/* | ||
1752 | -Method: adicionaTemaSHP | 1911 | + /* |
1912 | + Method: adicionaTemaSHP | ||
1753 | 1913 | ||
1754 | -Adiciona um tema a partir de um arquivo shape file armazenado no servidor de arquivos. | 1914 | + Adiciona um tema a partir de um arquivo shape file armazenado no servidor de arquivos. |
1755 | 1915 | ||
1756 | -Parametros: | ||
1757 | -$arq - Nome do shape file. | ||
1758 | -*/ | 1916 | + Parametros: |
1917 | + $arq - Nome do shape file. | ||
1918 | + */ | ||
1759 | function adicionaTemaSHP($arq) | 1919 | function adicionaTemaSHP($arq) |
1760 | { | 1920 | { |
1761 | if (file_exists($arq)) | 1921 | if (file_exists($arq)) |
1762 | { | 1922 | { |
1763 | $s = ms_newShapefileObj($arq,-1); | 1923 | $s = ms_newShapefileObj($arq,-1); |
1764 | /* | 1924 | /* |
1765 | - if($this->v == 6) | ||
1766 | - {$shape = $s->getshape(new resultObj(0));} | 1925 | + if($this->v == 6) |
1926 | + {$shape = $s->getshape(new resultObj(0));} | ||
1767 | else | 1927 | else |
1768 | {$shape = $s->getshape(0);} | 1928 | {$shape = $s->getshape(0);} |
1769 | */ | 1929 | */ |
@@ -1771,9 +1931,13 @@ $arq - Nome do shape file. | @@ -1771,9 +1931,13 @@ $arq - Nome do shape file. | ||
1771 | $t = $shape->type; | 1931 | $t = $shape->type; |
1772 | $tipo = MS_LAYER_POLYGON; | 1932 | $tipo = MS_LAYER_POLYGON; |
1773 | if ($t == 0) | 1933 | if ($t == 0) |
1774 | - {$tipo = MS_LAYER_POINT;} | 1934 | + { |
1935 | + $tipo = MS_LAYER_POINT; | ||
1936 | + } | ||
1775 | if ($t == 1) | 1937 | if ($t == 1) |
1776 | - {$tipo = MS_LAYER_LINE;} | 1938 | + { |
1939 | + $tipo = MS_LAYER_LINE; | ||
1940 | + } | ||
1777 | $layer = criaLayer($this->mapa,$tipo,MS_DEFAULT,basename($arq),"SIM"); | 1941 | $layer = criaLayer($this->mapa,$tipo,MS_DEFAULT,basename($arq),"SIM"); |
1778 | $layer->set("data",$arq); | 1942 | $layer->set("data",$arq); |
1779 | $layer->set("name",basename($arq)); | 1943 | $layer->set("name",basename($arq)); |
@@ -1783,14 +1947,14 @@ $arq - Nome do shape file. | @@ -1783,14 +1947,14 @@ $arq - Nome do shape file. | ||
1783 | } | 1947 | } |
1784 | return("ok"); | 1948 | return("ok"); |
1785 | } | 1949 | } |
1786 | -/* | ||
1787 | -Method: adicionaTemaIMG | 1950 | + /* |
1951 | + Method: adicionaTemaIMG | ||
1788 | 1952 | ||
1789 | -Adiciona um tema a partir de um arquivo imagem armazenado no servidor de arquivos. | 1953 | + Adiciona um tema a partir de um arquivo imagem armazenado no servidor de arquivos. |
1790 | 1954 | ||
1791 | -Parametros: | ||
1792 | -$arq - Nome do arquivo. | ||
1793 | -*/ | 1955 | + Parametros: |
1956 | + $arq - Nome do arquivo. | ||
1957 | + */ | ||
1794 | function adicionaTemaIMG($arq) | 1958 | function adicionaTemaIMG($arq) |
1795 | { | 1959 | { |
1796 | if (file_exists($arq)) | 1960 | if (file_exists($arq)) |
@@ -1805,14 +1969,14 @@ $arq - Nome do arquivo. | @@ -1805,14 +1969,14 @@ $arq - Nome do arquivo. | ||
1805 | } | 1969 | } |
1806 | function adicionaAcesso($codigo_tema,$locaplic) | 1970 | function adicionaAcesso($codigo_tema,$locaplic) |
1807 | { | 1971 | { |
1808 | - $resultado = array(); | ||
1809 | - include("$locaplic/admin/php/conexao.php"); | ||
1810 | - if(!empty($esquemaadmin)){ | ||
1811 | - $esquemaadmin = $esquemaadmin."."; | ||
1812 | - } | ||
1813 | - $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")).")"); | 1972 | + $resultado = array(); |
1973 | + include("$locaplic/admin/php/conexao.php"); | ||
1974 | + if(!empty($esquemaadmin)){ | ||
1975 | + $esquemaadmin = $esquemaadmin."."; | ||
1976 | + } | ||
1977 | + $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")).")"); | ||
1814 | $dbh = null; | 1978 | $dbh = null; |
1815 | - $dbhw = null; | 1979 | + $dbhw = null; |
1816 | } | 1980 | } |
1817 | // | 1981 | // |
1818 | //esta função não está concluida | 1982 | //esta função não está concluida |
@@ -1837,7 +2001,9 @@ $arq - Nome do arquivo. | @@ -1837,7 +2001,9 @@ $arq - Nome do arquivo. | ||
1837 | { | 2001 | { |
1838 | $testa = explode("NAME",$e); | 2002 | $testa = explode("NAME",$e); |
1839 | if (count($testa) > 1) | 2003 | if (count($testa) > 1) |
1840 | - {$pega = "sim";} | 2004 | + { |
2005 | + $pega = "sim"; | ||
2006 | + } | ||
1841 | $testa = explode('"'.$layername.'"',$e); | 2007 | $testa = explode('"'.$layername.'"',$e); |
1842 | if ((count($testa) > 1) && ($pega == "sim")) | 2008 | if ((count($testa) > 1) && ($pega == "sim")) |
1843 | { | 2009 | { |
@@ -1849,42 +2015,56 @@ $arq - Nome do arquivo. | @@ -1849,42 +2015,56 @@ $arq - Nome do arquivo. | ||
1849 | //salva o mapfile | 2015 | //salva o mapfile |
1850 | $abre = fopen($this->arquivo, "wt"); | 2016 | $abre = fopen($this->arquivo, "wt"); |
1851 | foreach($novoarray as $linha) | 2017 | foreach($novoarray as $linha) |
1852 | - {$escreve = fwrite ($abre,$linha);} | 2018 | + { |
2019 | + $escreve = fwrite ($abre,$linha); | ||
2020 | + } | ||
1853 | $fecha = fclose ($abre); | 2021 | $fecha = fclose ($abre); |
1854 | } | 2022 | } |
1855 | -/* | ||
1856 | -Method: converteInterfacePara | 2023 | + /* |
2024 | + Method: converteInterfacePara | ||
1857 | 2025 | ||
1858 | -Converte o mapfile atual ajustando o funcionamento para uma interface específica | 2026 | + Converte o mapfile atual ajustando o funcionamento para uma interface específica |
1859 | 2027 | ||
1860 | -Parametros: | 2028 | + Parametros: |
1861 | 2029 | ||
1862 | -$interface - googlemaps|openlayers | ||
1863 | -*/ | 2030 | + $interface - googlemaps|openlayers |
2031 | + */ | ||
1864 | function converteInterfacePara($interface){ | 2032 | function converteInterfacePara($interface){ |
1865 | if($interface == "openlayers"){ | 2033 | if($interface == "openlayers"){ |
1866 | $prefixo = "ol"; | 2034 | $prefixo = "ol"; |
1867 | $this->mapa->setProjection("+proj=longlat +ellps=GRS67 +no_defs"); | 2035 | $this->mapa->setProjection("+proj=longlat +ellps=GRS67 +no_defs"); |
1868 | } | 2036 | } |
1869 | else | 2037 | else |
1870 | - {$prefixo = "gm";} | 2038 | + {$prefixo = "gm"; |
2039 | + } | ||
1871 | foreach($this->layers as $l){ | 2040 | foreach($this->layers as $l){ |
1872 | $opacidadeM = $l->getmetadata($prefixo."opacity"); | 2041 | $opacidadeM = $l->getmetadata($prefixo."opacity"); |
1873 | $statusM = $l->getmetadata($prefixo."status"); | 2042 | $statusM = $l->getmetadata($prefixo."status"); |
1874 | if($opacidadeM == "") | 2043 | if($opacidadeM == "") |
1875 | - {$l->setmetadata($prefixo."opacity",100);} | 2044 | + { |
2045 | + $l->setmetadata($prefixo."opacity",100); | ||
2046 | + } | ||
1876 | else | 2047 | else |
1877 | - {$l->set("opacity",$prefixo."opacity");} | 2048 | + {$l->set("opacity",$prefixo."opacity"); |
2049 | + } | ||
1878 | if($statusM != ""){ | 2050 | if($statusM != ""){ |
1879 | if($statusM == "OFF") | 2051 | if($statusM == "OFF") |
1880 | - {$l->set("status",MS_OFF);} | 2052 | + { |
2053 | + $l->set("status",MS_OFF); | ||
2054 | + } | ||
1881 | if($statusM == "DEFAULT") | 2055 | if($statusM == "DEFAULT") |
1882 | - {$l->set("status",MS_DEFAULT);} | 2056 | + { |
2057 | + $l->set("status",MS_DEFAULT); | ||
2058 | + } | ||
1883 | } | 2059 | } |
1884 | if($prefixo == "gm" && ($l->name == "mundo" || $l->name == "estados")) | 2060 | if($prefixo == "gm" && ($l->name == "mundo" || $l->name == "estados")) |
1885 | - {$l->set("status",MS_OFF);} | 2061 | + { |
2062 | + $l->set("status",MS_OFF); | ||
2063 | + } | ||
1886 | if($l->opacity == 0) | 2064 | if($l->opacity == 0) |
1887 | - {$l->set("opacity",100);} | 2065 | + { |
2066 | + $l->set("opacity",100); | ||
2067 | + } | ||
1888 | } | 2068 | } |
1889 | $this->salva(); | 2069 | $this->salva(); |
1890 | return "ok"; | 2070 | return "ok"; |
pacotes/kmlmapserver/classes/layerserver.class.php
@@ -179,11 +179,11 @@ class LayerServer { | @@ -179,11 +179,11 @@ class LayerServer { | ||
179 | $this->out_proj = ms_newProjectionObj("init=epsg:4326"); | 179 | $this->out_proj = ms_newProjectionObj("init=epsg:4326"); |
180 | // Set endpoint | 180 | // Set endpoint |
181 | //die($_SERVER['REQUEST_URI']); | 181 | //die($_SERVER['REQUEST_URI']); |
182 | - | 182 | + |
183 | $protocolo = explode("/",$_SERVER['SERVER_PROTOCOL']); | 183 | $protocolo = explode("/",$_SERVER['SERVER_PROTOCOL']); |
184 | $protocolo = strtolower($protocolo[0]); | 184 | $protocolo = strtolower($protocolo[0]); |
185 | $this->endpoint = $protocolo . '://'.$_SERVER['SERVER_NAME'] . ($_SERVER['SERVER_PORT'] ? ':'.$_SERVER['SERVER_PORT'] : '') . $_SERVER['PHP_SELF']; | 185 | $this->endpoint = $protocolo . '://'.$_SERVER['SERVER_NAME'] . ($_SERVER['SERVER_PORT'] ? ':'.$_SERVER['SERVER_PORT'] : '') . $_SERVER['PHP_SELF']; |
186 | - | 186 | + |
187 | // Process request | 187 | // Process request |
188 | if(!$this->has_error()) { | 188 | if(!$this->has_error()) { |
189 | $this->process_request(); | 189 | $this->process_request(); |
@@ -193,7 +193,7 @@ class LayerServer { | @@ -193,7 +193,7 @@ class LayerServer { | ||
193 | } | 193 | } |
194 | 194 | ||
195 | return $this->send_stream($this->get_kml()); | 195 | return $this->send_stream($this->get_kml()); |
196 | - | 196 | + |
197 | } | 197 | } |
198 | 198 | ||
199 | /** | 199 | /** |
@@ -365,7 +365,7 @@ class LayerServer { | @@ -365,7 +365,7 @@ class LayerServer { | ||
365 | {$namecol = explode(",",$namecol);$namecol = $namecol[0];} | 365 | {$namecol = explode(",",$namecol);$namecol = $namecol[0];} |
366 | // Add classes | 366 | // Add classes |
367 | $folder =& $this->_xml->Document->addChild('Folder'); | 367 | $folder =& $this->_xml->Document->addChild('Folder'); |
368 | - | 368 | + |
369 | $class_list = $this->parse_classes($layer, $folder, $namecol, $title_field, $description_template); | 369 | $class_list = $this->parse_classes($layer, $folder, $namecol, $title_field, $description_template); |
370 | 370 | ||
371 | //die(print_r($class_list, true)); | 371 | //die(print_r($class_list, true)); |
@@ -375,7 +375,7 @@ class LayerServer { | @@ -375,7 +375,7 @@ class LayerServer { | ||
375 | //print("$searchfield && $searchstring"); | 375 | //print("$searchfield && $searchstring"); |
376 | if(!isset($searchfield)){$searchfield = false;} | 376 | if(!isset($searchfield)){$searchfield = false;} |
377 | if(!isset($searchstring)){$searchstring = false;} | 377 | if(!isset($searchstring)){$searchstring = false;} |
378 | - | 378 | + |
379 | if($searchfield && $searchstring){ | 379 | if($searchfield && $searchstring){ |
380 | if(@$layer->queryByAttributes($searchfield, $searchstring, MS_MULTIPLE) == MS_SUCCESS){ | 380 | if(@$layer->queryByAttributes($searchfield, $searchstring, MS_MULTIPLE) == MS_SUCCESS){ |
381 | $layer->open(); | 381 | $layer->open(); |
@@ -641,11 +641,16 @@ class LayerServer { | @@ -641,11 +641,16 @@ class LayerServer { | ||
641 | function parse_classes(&$layer, &$folder, &$namecol, &$title_field, &$description_template ){ | 641 | function parse_classes(&$layer, &$folder, &$namecol, &$title_field, &$description_template ){ |
642 | $style_ar = array(); | 642 | $style_ar = array(); |
643 | $numclasses = $layer->numclasses; | 643 | $numclasses = $layer->numclasses; |
644 | + $versao = $this->versao(); | ||
645 | + $vi = $versao["inteiro"]; | ||
644 | for($i = 0; $i < $numclasses; $i++){ | 646 | for($i = 0; $i < $numclasses; $i++){ |
645 | $class = $layer->getClass($i); | 647 | $class = $layer->getClass($i); |
646 | - | ||
647 | - $label = $class->label; | ||
648 | - | 648 | + if($vi >= 60200){ |
649 | + $label = $classe->getLabel(0); | ||
650 | + } | ||
651 | + else{ | ||
652 | + $label = $class->label; | ||
653 | + } | ||
649 | if($label){ | 654 | if($label){ |
650 | $style['label_color'] = $label->color; | 655 | $style['label_color'] = $label->color; |
651 | $style['label_size'] = $label->size; | 656 | $style['label_size'] = $label->size; |
@@ -1137,6 +1142,7 @@ function versao() | @@ -1137,6 +1142,7 @@ function versao() | ||
1137 | $versao["completa"] = $v; | 1142 | $versao["completa"] = $v; |
1138 | $v = explode(".",$v); | 1143 | $v = explode(".",$v); |
1139 | $versao["principal"] = $v[0]; | 1144 | $versao["principal"] = $v[0]; |
1145 | + $versao["inteiro"] = ms_GetVersionInt(); | ||
1140 | return $versao; | 1146 | return $versao; |
1141 | } | 1147 | } |
1142 | } | 1148 | } |