Commit 601df6156a5185772aeee31e0c7eb4b78de9c35e
1 parent
2d018160
Exists in
master
and in
7 other branches
$1
Showing
1 changed file
with
52 additions
and
21 deletions
Show diff stats
geraminiatura.php
@@ -63,6 +63,8 @@ tipo - tipo de imagem que será gerada mini|grande|todos | @@ -63,6 +63,8 @@ tipo - tipo de imagem que será gerada mini|grande|todos | ||
63 | 63 | ||
64 | */ | 64 | */ |
65 | 65 | ||
66 | + | ||
67 | + | ||
66 | //clearstatcache(); | 68 | //clearstatcache(); |
67 | error_reporting(0); | 69 | error_reporting(0); |
68 | //set_time_limit(300); | 70 | //set_time_limit(300); |
@@ -124,12 +126,17 @@ if($tipo == "mini" || $tipo == "todos" || $tipo == "grande" || $tipo == "") | @@ -124,12 +126,17 @@ if($tipo == "mini" || $tipo == "todos" || $tipo == "grande" || $tipo == "") | ||
124 | } | 126 | } |
125 | error_reporting(0); | 127 | error_reporting(0); |
126 | $arqs = listaArquivos("temas"); | 128 | $arqs = listaArquivos("temas"); |
127 | - ob_start(); | ||
128 | - foreach ($arqs["arquivos"] as $arq) | 129 | + $arqs = $arqs["arquivos"]; |
130 | + sort($arqs); | ||
131 | + //echo implode(" ,",$arqs["arquivos"]); | ||
132 | + foreach ($arqs as $arq) | ||
129 | { | 133 | { |
134 | + $arq = str_replace(" ","xxxx",$arq); | ||
130 | $temp = explode(".",$arq); | 135 | $temp = explode(".",$arq); |
131 | - if($temp[(count($temp) - 1)] == "map") | 136 | + |
137 | + if(file_exists($locaplic.'/temas/'.$arq) && $temp[(count($temp) - 1)] == "map" && !(strpos($temp[0],"_") === 0) ) | ||
132 | { | 138 | { |
139 | + echo "<b>$arq</b><br>"; | ||
133 | //if(file_exists($locaplic.'/temas/miniaturas/'.$arq.'.mini.png') == false) | 140 | //if(file_exists($locaplic.'/temas/miniaturas/'.$arq.'.mini.png') == false) |
134 | //echo $locaplic.'/temas/miniaturas/'.$arq.'.mini.png<br>'; | 141 | //echo $locaplic.'/temas/miniaturas/'.$arq.'.mini.png<br>'; |
135 | if($tipo == "mini" || $tipo == "todos") | 142 | if($tipo == "mini" || $tipo == "todos") |
@@ -137,10 +144,9 @@ if($tipo == "mini" || $tipo == "todos" || $tipo == "grande" || $tipo == "") | @@ -137,10 +144,9 @@ if($tipo == "mini" || $tipo == "todos" || $tipo == "grande" || $tipo == "") | ||
137 | if($tipo == "grande" || $tipo == "todos") | 144 | if($tipo == "grande" || $tipo == "todos") |
138 | {if(!file_exists($locaplic.'/temas/miniaturas/'.$arq.'.grande.png')){echo "<br>".$arq."<br>";verificaMiniatura($arq,"grande");}} | 145 | {if(!file_exists($locaplic.'/temas/miniaturas/'.$arq.'.grande.png')){echo "<br>".$arq."<br>";verificaMiniatura($arq,"grande");}} |
139 | } | 146 | } |
140 | - ob_end_flush(); | ||
141 | ob_flush(); | 147 | ob_flush(); |
142 | flush(); | 148 | flush(); |
143 | - ob_start(); | 149 | + //sleep(1); |
144 | } | 150 | } |
145 | } | 151 | } |
146 | // | 152 | // |
@@ -148,7 +154,7 @@ if($tipo == "mini" || $tipo == "todos" || $tipo == "grande" || $tipo == "") | @@ -148,7 +154,7 @@ if($tipo == "mini" || $tipo == "todos" || $tipo == "grande" || $tipo == "") | ||
148 | // | 154 | // |
149 | function verificaMiniatura($map,$tipo,$admin=false) | 155 | function verificaMiniatura($map,$tipo,$admin=false) |
150 | { | 156 | { |
151 | - global $locaplic,$versao,$base; | 157 | + global $locaplic,$versao,$base,$postgis_mapa; |
152 | if($versao == ""){ | 158 | if($versao == ""){ |
153 | $versao = versao(); | 159 | $versao = versao(); |
154 | $versao = $versao["principal"]; | 160 | $versao = $versao["principal"]; |
@@ -224,19 +230,28 @@ function verificaMiniatura($map,$tipo,$admin=false) | @@ -224,19 +230,28 @@ function verificaMiniatura($map,$tipo,$admin=false) | ||
224 | } | 230 | } |
225 | $pegarext = $teman->name; | 231 | $pegarext = $teman->name; |
226 | } | 232 | } |
233 | + | ||
227 | if (isset($postgis_mapa)){ | 234 | if (isset($postgis_mapa)){ |
228 | if ($postgis_mapa != ""){ | 235 | if ($postgis_mapa != ""){ |
229 | $numlayers = $mapa->numlayers; | 236 | $numlayers = $mapa->numlayers; |
230 | - for ($i=0;$i < $numlayers;++$i){ | ||
231 | - $layer = $mapa->getlayer($i); | ||
232 | - if ($layer->connectiontype == MS_POSTGIS){ | ||
233 | - if ($layer->connection == " "){ | ||
234 | - $layer->set("connection",$postgis_mapa); | 237 | + for ($i=0;$i < $numlayers;$i++){ |
238 | + $layern = $mapa->getlayer($i); | ||
239 | + if (!empty($postgis_mapa)){ | ||
240 | + if ($layern->connectiontype == MS_POSTGIS){ | ||
241 | + $lcon = $layern->connection; | ||
242 | + if (($lcon == " ") || ($lcon == "") || (in_array($lcon,array_keys($postgis_mapa)))){ | ||
243 | + if(($lcon == " ") || ($lcon == "")) //para efeitos de compatibilidade | ||
244 | + {$layern->set("connection",$postgis_mapa);} | ||
245 | + else{ | ||
246 | + $layern->set("connection",$postgis_mapa[$lcon]); | ||
247 | + } | ||
248 | + } | ||
235 | } | 249 | } |
236 | } | 250 | } |
237 | } | 251 | } |
238 | } | 252 | } |
239 | } | 253 | } |
254 | + | ||
240 | zoomTemaMiniatura($pegarext,$mapa); | 255 | zoomTemaMiniatura($pegarext,$mapa); |
241 | } | 256 | } |
242 | if($extensao == ".gvp"){ | 257 | if($extensao == ".gvp"){ |
@@ -272,6 +287,16 @@ function verificaMiniatura($map,$tipo,$admin=false) | @@ -272,6 +287,16 @@ function verificaMiniatura($map,$tipo,$admin=false) | ||
272 | $urlG = $weboG->imageurl."/".$map; | 287 | $urlG = $weboG->imageurl."/".$map; |
273 | } | 288 | } |
274 | if($tipo=="mini" || $tipo == "todos"){ | 289 | if($tipo=="mini" || $tipo == "todos"){ |
290 | + if (!$objImagemM){ | ||
291 | + echo "Problemas ao gerar o mapa<br>"; | ||
292 | + $error = ""; | ||
293 | + $error = ms_GetErrorObj(); | ||
294 | + while($error && $error->code != MS_NOERR){ | ||
295 | + echo "<br>Error in %s: %s<br>", $error->routine, $error->message; | ||
296 | + $error = $error->next(); | ||
297 | + } | ||
298 | + return; | ||
299 | + } | ||
275 | if($objImagemM->imagepath == ""){ | 300 | if($objImagemM->imagepath == ""){ |
276 | echo "Erro IMAGEPATH vazio";return; | 301 | echo "Erro IMAGEPATH vazio";return; |
277 | } | 302 | } |
@@ -279,6 +304,16 @@ function verificaMiniatura($map,$tipo,$admin=false) | @@ -279,6 +304,16 @@ function verificaMiniatura($map,$tipo,$admin=false) | ||
279 | $objImagemM->saveImage($nomecM); | 304 | $objImagemM->saveImage($nomecM); |
280 | } | 305 | } |
281 | if($tipo=="grande" || $tipo == "todos"){ | 306 | if($tipo=="grande" || $tipo == "todos"){ |
307 | + if (!$objImagemG){ | ||
308 | + echo "Problemas ao gerar o mapa<br>"; | ||
309 | + $error = ""; | ||
310 | + $error = ms_GetErrorObj(); | ||
311 | + while($error && $error->code != MS_NOERR){ | ||
312 | + echo "<br>Error in %s: %s<br>", $error->routine, $error->message; | ||
313 | + $error = $error->next(); | ||
314 | + } | ||
315 | + return; | ||
316 | + } | ||
282 | if($objImagemG->imagepath == ""){ | 317 | if($objImagemG->imagepath == ""){ |
283 | echo "Erro IMAGEPATH vazio";return; | 318 | echo "Erro IMAGEPATH vazio";return; |
284 | } | 319 | } |
@@ -312,33 +347,29 @@ function zoomTemaMiniatura($nomelayer,&$mapa) | @@ -312,33 +347,29 @@ function zoomTemaMiniatura($nomelayer,&$mapa) | ||
312 | $layer = $mapa->getlayerbyname($nomelayer); | 347 | $layer = $mapa->getlayerbyname($nomelayer); |
313 | if($layer->data == "" && $layer->connection == "") | 348 | if($layer->data == "" && $layer->connection == "") |
314 | {return;} | 349 | {return;} |
315 | - if($layer->type > 2) | ||
316 | - {return;} | ||
317 | $prjMapa = $mapa->getProjection(); | 350 | $prjMapa = $mapa->getProjection(); |
318 | $prjTema = $layer->getProjection(); | 351 | $prjTema = $layer->getProjection(); |
319 | $extatual = $mapa->extent; | 352 | $extatual = $mapa->extent; |
320 | $ret = $layer->getmetadata("extensao"); | 353 | $ret = $layer->getmetadata("extensao"); |
354 | + if($layer->type > 2 && $ret == "") | ||
355 | + {return;} | ||
321 | $ct = $layer->connectiontype; | 356 | $ct = $layer->connectiontype; |
322 | if(($ret == "") && ($ct != 1)) | 357 | if(($ret == "") && ($ct != 1)) |
323 | {return;} | 358 | {return;} |
324 | - if ($ret == "") | ||
325 | - { | 359 | + if ($ret == ""){ |
326 | $ret = $layer->getextent(); | 360 | $ret = $layer->getextent(); |
327 | - if(!$ret){return;} | ||
328 | //reprojeta o retangulo | 361 | //reprojeta o retangulo |
329 | - if (($prjTema != "") && ($prjMapa != $prjTema)) | ||
330 | - { | 362 | + if (($prjTema != "") && ($prjMapa != $prjTema)){ |
331 | $projInObj = ms_newprojectionobj($prjTema); | 363 | $projInObj = ms_newprojectionobj($prjTema); |
332 | $projOutObj = ms_newprojectionobj($prjMapa); | 364 | $projOutObj = ms_newprojectionobj($prjMapa); |
333 | $ret->project($projInObj, $projOutObj); | 365 | $ret->project($projInObj, $projOutObj); |
334 | } | 366 | } |
335 | $extatual->setextent($ret->minx,$ret->miny,$ret->maxx,$ret->maxy); | 367 | $extatual->setextent($ret->minx,$ret->miny,$ret->maxx,$ret->maxy); |
336 | } | 368 | } |
337 | - else | ||
338 | - { | 369 | + else{ |
339 | $ret = explode(" ",$ret); | 370 | $ret = explode(" ",$ret); |
340 | $extatual->setextent($ret[0],$ret[1],$ret[2],$ret[3]); | 371 | $extatual->setextent($ret[0],$ret[1],$ret[2],$ret[3]); |
341 | } | 372 | } |
342 | } | 373 | } |
343 | ?> | 374 | ?> |
344 | -</div></body></html> | ||
345 | \ No newline at end of file | 375 | \ No newline at end of file |
376 | +</div></body></html> |