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 | 63 | |
64 | 64 | */ |
65 | 65 | |
66 | + | |
67 | + | |
66 | 68 | //clearstatcache(); |
67 | 69 | error_reporting(0); |
68 | 70 | //set_time_limit(300); |
... | ... | @@ -124,12 +126,17 @@ if($tipo == "mini" || $tipo == "todos" || $tipo == "grande" || $tipo == "") |
124 | 126 | } |
125 | 127 | error_reporting(0); |
126 | 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 | 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 | 140 | //if(file_exists($locaplic.'/temas/miniaturas/'.$arq.'.mini.png') == false) |
134 | 141 | //echo $locaplic.'/temas/miniaturas/'.$arq.'.mini.png<br>'; |
135 | 142 | if($tipo == "mini" || $tipo == "todos") |
... | ... | @@ -137,10 +144,9 @@ if($tipo == "mini" || $tipo == "todos" || $tipo == "grande" || $tipo == "") |
137 | 144 | if($tipo == "grande" || $tipo == "todos") |
138 | 145 | {if(!file_exists($locaplic.'/temas/miniaturas/'.$arq.'.grande.png')){echo "<br>".$arq."<br>";verificaMiniatura($arq,"grande");}} |
139 | 146 | } |
140 | - ob_end_flush(); | |
141 | 147 | ob_flush(); |
142 | 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 | 154 | // |
149 | 155 | function verificaMiniatura($map,$tipo,$admin=false) |
150 | 156 | { |
151 | - global $locaplic,$versao,$base; | |
157 | + global $locaplic,$versao,$base,$postgis_mapa; | |
152 | 158 | if($versao == ""){ |
153 | 159 | $versao = versao(); |
154 | 160 | $versao = $versao["principal"]; |
... | ... | @@ -224,19 +230,28 @@ function verificaMiniatura($map,$tipo,$admin=false) |
224 | 230 | } |
225 | 231 | $pegarext = $teman->name; |
226 | 232 | } |
233 | + | |
227 | 234 | if (isset($postgis_mapa)){ |
228 | 235 | if ($postgis_mapa != ""){ |
229 | 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 | 255 | zoomTemaMiniatura($pegarext,$mapa); |
241 | 256 | } |
242 | 257 | if($extensao == ".gvp"){ |
... | ... | @@ -272,6 +287,16 @@ function verificaMiniatura($map,$tipo,$admin=false) |
272 | 287 | $urlG = $weboG->imageurl."/".$map; |
273 | 288 | } |
274 | 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 | 300 | if($objImagemM->imagepath == ""){ |
276 | 301 | echo "Erro IMAGEPATH vazio";return; |
277 | 302 | } |
... | ... | @@ -279,6 +304,16 @@ function verificaMiniatura($map,$tipo,$admin=false) |
279 | 304 | $objImagemM->saveImage($nomecM); |
280 | 305 | } |
281 | 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 | 317 | if($objImagemG->imagepath == ""){ |
283 | 318 | echo "Erro IMAGEPATH vazio";return; |
284 | 319 | } |
... | ... | @@ -312,33 +347,29 @@ function zoomTemaMiniatura($nomelayer,&$mapa) |
312 | 347 | $layer = $mapa->getlayerbyname($nomelayer); |
313 | 348 | if($layer->data == "" && $layer->connection == "") |
314 | 349 | {return;} |
315 | - if($layer->type > 2) | |
316 | - {return;} | |
317 | 350 | $prjMapa = $mapa->getProjection(); |
318 | 351 | $prjTema = $layer->getProjection(); |
319 | 352 | $extatual = $mapa->extent; |
320 | 353 | $ret = $layer->getmetadata("extensao"); |
354 | + if($layer->type > 2 && $ret == "") | |
355 | + {return;} | |
321 | 356 | $ct = $layer->connectiontype; |
322 | 357 | if(($ret == "") && ($ct != 1)) |
323 | 358 | {return;} |
324 | - if ($ret == "") | |
325 | - { | |
359 | + if ($ret == ""){ | |
326 | 360 | $ret = $layer->getextent(); |
327 | - if(!$ret){return;} | |
328 | 361 | //reprojeta o retangulo |
329 | - if (($prjTema != "") && ($prjMapa != $prjTema)) | |
330 | - { | |
362 | + if (($prjTema != "") && ($prjMapa != $prjTema)){ | |
331 | 363 | $projInObj = ms_newprojectionobj($prjTema); |
332 | 364 | $projOutObj = ms_newprojectionobj($prjMapa); |
333 | 365 | $ret->project($projInObj, $projOutObj); |
334 | 366 | } |
335 | 367 | $extatual->setextent($ret->minx,$ret->miny,$ret->maxx,$ret->maxy); |
336 | 368 | } |
337 | - else | |
338 | - { | |
369 | + else{ | |
339 | 370 | $ret = explode(" ",$ret); |
340 | 371 | $extatual->setextent($ret[0],$ret[1],$ret[2],$ret[3]); |
341 | 372 | } |
342 | 373 | } |
343 | 374 | ?> |
344 | -</div></body></html> | |
345 | 375 | \ No newline at end of file |
376 | +</div></body></html> | ... | ... |