Commit 98bdcb429b62451a8f87fe1d1cb417845747a393

Authored by Edmar Moretti
1 parent 45496973

--no commit message

Showing 2 changed files with 31 additions and 11 deletions   Show diff stats
geraminiatura.php
@@ -41,9 +41,10 @@ Parametro: @@ -41,9 +41,10 @@ Parametro:
41 41
42 tipo - tipo de retorno mini|grande|todos 42 tipo - tipo de retorno mini|grande|todos
43 */ 43 */
  44 +//clearstatcache();
44 error_reporting(E_ALL); 45 error_reporting(E_ALL);
45 -set_time_limit(300);  
46 -ini_set('max_execution_time', 300); 46 +//set_time_limit(300);
  47 +//ini_set('max_execution_time', 300);
47 // 48 //
48 //carrega o phpmapscript 49 //carrega o phpmapscript
49 // 50 //
@@ -85,16 +86,23 @@ if($tipo == "mini" || $tipo == "todos" || $tipo == "grande" || $tipo == "") @@ -85,16 +86,23 @@ if($tipo == "mini" || $tipo == "todos" || $tipo == "grande" || $tipo == "")
85 86
86 error_reporting(E_ALL); 87 error_reporting(E_ALL);
87 $arqs = listaArquivos("temas"); 88 $arqs = listaArquivos("temas");
  89 + ob_start();
88 foreach ($arqs["arquivos"] as $arq) 90 foreach ($arqs["arquivos"] as $arq)
89 { 91 {
90 $temp = explode(".",$arq); 92 $temp = explode(".",$arq);
91 if($temp[(count($temp) - 1)] == "map") 93 if($temp[(count($temp) - 1)] == "map")
92 { 94 {
  95 + //if(file_exists($locaplic.'/temas/miniaturas/'.$arq.'.mini.png') == false)
  96 + //echo $locaplic.'/temas/miniaturas/'.$arq.'.mini.png<br>';
93 if($tipo == "mini" || $tipo == "todos") 97 if($tipo == "mini" || $tipo == "todos")
94 - {if(!file_exists('temas/miniaturas/'.$arq.'.mini.png')){echo "<br>".$arq."<br>";verificaMiniatura($arq,"mini");}} 98 + {if(!file_exists($locaplic.'/temas/miniaturas/'.$arq.'.mini.png')){echo "<br>".$arq."<br>";verificaMiniatura($arq,"mini");}}
95 if($tipo == "grande" || $tipo == "todos") 99 if($tipo == "grande" || $tipo == "todos")
96 - {if(!file_exists('temas/miniaturas/'.$arq.'.grande.png')){echo "<br>".$arq."<br>";verificaMiniatura($arq,"grande");}} 100 + {if(!file_exists($locaplic.'/temas/miniaturas/'.$arq.'.grande.png')){echo "<br>".$arq."<br>";verificaMiniatura($arq,"grande");}}
97 } 101 }
  102 + ob_end_flush();
  103 + ob_flush();
  104 + flush();
  105 + ob_start();
98 } 106 }
99 } 107 }
100 // 108 //
@@ -103,8 +111,8 @@ if($tipo == &quot;mini&quot; || $tipo == &quot;todos&quot; || $tipo == &quot;grande&quot; || $tipo == &quot;&quot;) @@ -103,8 +111,8 @@ if($tipo == &quot;mini&quot; || $tipo == &quot;todos&quot; || $tipo == &quot;grande&quot; || $tipo == &quot;&quot;)
103 function verificaMiniatura($map,$tipo,$admin=false) 111 function verificaMiniatura($map,$tipo,$admin=false)
104 { 112 {
105 global $locaplic,$versao; 113 global $locaplic,$versao;
  114 + //echo $map."<br>";return;
106 ms_ResetErrorList(); 115 ms_ResetErrorList();
107 - error_reporting(E_ALL);  
108 $tema = ""; 116 $tema = "";
109 $map = str_replace("\\","/",$map); 117 $map = str_replace("\\","/",$map);
110 $map = basename($map); 118 $map = basename($map);
@@ -157,15 +165,19 @@ function verificaMiniatura($map,$tipo,$admin=false) @@ -157,15 +165,19 @@ function verificaMiniatura($map,$tipo,$admin=false)
157 } 165 }
158 } 166 }
159 } 167 }
  168 +
160 zoomTemaMiniatura($pegarext,$mapa); 169 zoomTemaMiniatura($pegarext,$mapa);
161 if ($tipo == "mini" || $tipo == "todos") 170 if ($tipo == "mini" || $tipo == "todos")
162 { 171 {
163 - $mapa->setsize(50,50); 172 +
  173 + $mapa->setsize(50,50);
164 $sca = $mapa->scalebar; 174 $sca = $mapa->scalebar;
165 $sca->set("status",MS_OFF); 175 $sca->set("status",MS_OFF);
166 $objImagemM = @$mapa->draw(); 176 $objImagemM = @$mapa->draw();
167 - if (!$objImagemM) 177 +
  178 + if ($objImagemM == "" || $objImagemM == MS_FAILURE)
168 {echo "Problemas ao gerar o mapa<br>";return;} 179 {echo "Problemas ao gerar o mapa<br>";return;}
  180 +
169 $weboM = $mapa->web; 181 $weboM = $mapa->web;
170 $urlM = $weboM->imageurl."/".$map; 182 $urlM = $weboM->imageurl."/".$map;
171 } 183 }
@@ -175,7 +187,7 @@ function verificaMiniatura($map,$tipo,$admin=false) @@ -175,7 +187,7 @@ function verificaMiniatura($map,$tipo,$admin=false)
175 $sca = $mapa->scalebar; 187 $sca = $mapa->scalebar;
176 $sca->set("status",MS_OFF); 188 $sca->set("status",MS_OFF);
177 $objImagemG = @$mapa->draw(); 189 $objImagemG = @$mapa->draw();
178 - if (!$objImagemG) 190 + if ($objImagemG == "" || $objImagemG == MS_FAILURE)
179 {echo "Problemas ao gerar o mapa<br>";return;} 191 {echo "Problemas ao gerar o mapa<br>";return;}
180 $weboG = $mapa->web; 192 $weboG = $mapa->web;
181 $urlG = $weboG->imageurl."/".$map; 193 $urlG = $weboG->imageurl."/".$map;
@@ -183,12 +195,14 @@ function verificaMiniatura($map,$tipo,$admin=false) @@ -183,12 +195,14 @@ function verificaMiniatura($map,$tipo,$admin=false)
183 if($tipo=="mini" || $tipo == "todos") 195 if($tipo=="mini" || $tipo == "todos")
184 { 196 {
185 if($objImagemM->imagepath == "") 197 if($objImagemM->imagepath == "")
186 - {echo "Erro IMAGEPATH vazio";exit;} 198 + {echo "Erro IMAGEPATH vazio";return;}
187 $nomecM = ($objImagemM->imagepath).$map.".mini.png"; 199 $nomecM = ($objImagemM->imagepath).$map.".mini.png";
188 $objImagemM->saveImage($nomecM); 200 $objImagemM->saveImage($nomecM);
189 } 201 }
190 if($tipo=="grande" || $tipo == "todos") 202 if($tipo=="grande" || $tipo == "todos")
191 { 203 {
  204 + if($objImagemG->imagepath == "")
  205 + {echo "Erro IMAGEPATH vazio";return;}
192 $nomecG = ($objImagemG->imagepath).$map.".grande.png"; 206 $nomecG = ($objImagemG->imagepath).$map.".grande.png";
193 $objImagemG->saveImage($nomecG); 207 $objImagemG->saveImage($nomecG);
194 } 208 }
@@ -220,6 +234,8 @@ function verificaMiniatura($map,$tipo,$admin=false) @@ -220,6 +234,8 @@ function verificaMiniatura($map,$tipo,$admin=false)
220 function zoomTemaMiniatura($nomelayer,&$mapa) 234 function zoomTemaMiniatura($nomelayer,&$mapa)
221 { 235 {
222 $layer = $mapa->getlayerbyname($nomelayer); 236 $layer = $mapa->getlayerbyname($nomelayer);
  237 + if($layer->data == "" && $layer->connection == "")
  238 + {return;}
223 if($layer->type > 2) 239 if($layer->type > 2)
224 {return;} 240 {return;}
225 $prjMapa = $mapa->getProjection(); 241 $prjMapa = $mapa->getProjection();
@@ -232,6 +248,7 @@ function zoomTemaMiniatura($nomelayer,&amp;$mapa) @@ -232,6 +248,7 @@ function zoomTemaMiniatura($nomelayer,&amp;$mapa)
232 if ($ret == "") 248 if ($ret == "")
233 { 249 {
234 $ret = $layer->getextent(); 250 $ret = $layer->getextent();
  251 + if(!$ret){return;}
235 //reprojeta o retangulo 252 //reprojeta o retangulo
236 if (($prjTema != "") && ($prjMapa != $prjTema)) 253 if (($prjTema != "") && ($prjMapa != $prjTema))
237 { 254 {
testamapfile.php
@@ -54,7 +54,7 @@ include(&quot;ms_configura.php&quot;); @@ -54,7 +54,7 @@ include(&quot;ms_configura.php&quot;);
54 include("classesphp/funcoes_gerais.php"); 54 include("classesphp/funcoes_gerais.php");
55 require_once("classesphp/pega_variaveis.php"); 55 require_once("classesphp/pega_variaveis.php");
56 include_once ("classesphp/carrega_ext.php"); 56 include_once ("classesphp/carrega_ext.php");
57 -error_reporting(0); 57 +
58 // 58 //
59 //carrega o phpmapscript 59 //carrega o phpmapscript
60 // 60 //
@@ -195,6 +195,7 @@ function verifica($map,$solegenda) @@ -195,6 +195,7 @@ function verifica($map,$solegenda)
195 if ($layern->connectiontype == MS_POSTGIS) 195 if ($layern->connectiontype == MS_POSTGIS)
196 { 196 {
197 $lcon = $layern->connection; 197 $lcon = $layern->connection;
  198 + error_reporting(0);
198 if (($lcon == " ") || ($lcon == "") || (in_array($lcon,array_keys($postgis_mapa)))) 199 if (($lcon == " ") || ($lcon == "") || (in_array($lcon,array_keys($postgis_mapa))))
199 { 200 {
200 // 201 //
@@ -212,7 +213,7 @@ function verifica($map,$solegenda) @@ -212,7 +213,7 @@ function verifica($map,$solegenda)
212 } 213 }
213 } 214 }
214 } 215 }
215 - 216 + error_reporting(E_ALL);
216 autoClasses($layern,$nmapa); 217 autoClasses($layern,$nmapa);
217 if($layern->classitem != "" && $layern->connectiontype == 7 && $layern->numclasses > 0 && $layern->getmetadata("wms_sld_body") == ""){ 218 if($layern->classitem != "" && $layern->connectiontype == 7 && $layern->numclasses > 0 && $layern->getmetadata("wms_sld_body") == ""){
218 $tipotemp = $layern->type; 219 $tipotemp = $layern->type;
@@ -310,6 +311,8 @@ function verifica($map,$solegenda) @@ -310,6 +311,8 @@ function verifica($map,$solegenda)
310 function zoomTema($nomelayer,&$mapa) 311 function zoomTema($nomelayer,&$mapa)
311 { 312 {
312 $layer = $mapa->getlayerbyname($nomelayer); 313 $layer = $mapa->getlayerbyname($nomelayer);
  314 + if($layer->data == "" && $layer->connection == "")
  315 + {return;}
313 $prjMapa = $mapa->getProjection(); 316 $prjMapa = $mapa->getProjection();
314 $prjTema = $layer->getProjection(); 317 $prjTema = $layer->getProjection();
315 $extatual = $mapa->extent; 318 $extatual = $mapa->extent;