Commit 16d2cc9fbc642a9019586614f567d2ab6a02d9fe
1 parent
01fe6b02
Exists in
master
and in
7 other branches
Incluida opção de teste sequencial de 10 em 10 mapas
Showing
1 changed file
with
64 additions
and
17 deletions
Show diff stats
testamapfile.php
... | ... | @@ -35,9 +35,11 @@ testamapfile.php?map=bioma |
35 | 35 | Parameters: |
36 | 36 | |
37 | 37 | map - nome do mapfile que será aberto. O arquivo é procurado no caminho indicado e no diretório i3geo/temas |
38 | - | |
38 | + se map=todos, todos os mapas são desenhados de 10 em 10. | |
39 | 39 | tipo - (opcional) tipo de retorno mini|grande . A opção mini retorna uma miniatura do mapa |
40 | 40 | */ |
41 | +set_time_limit(300); | |
42 | +ini_set('max_execution_time', 300); | |
41 | 43 | include("ms_configura.php"); |
42 | 44 | include("classesphp/funcoes_gerais.php"); |
43 | 45 | require_once("classesphp/pega_variaveis.php"); |
... | ... | @@ -60,10 +62,39 @@ if(!isset($tipo)) |
60 | 62 | {$tipo = "";} |
61 | 63 | if ($tipo == "") |
62 | 64 | { |
63 | - echo '<html><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"></head><script>function roda(){window.location.href = "?map="+document.getElementById("nomemap").value;}</script><body ><form action="testamapfile.php" method="post" id=f >Nome do arquivo map (deve estar no diretório temas):<br><br><input id=nomemap class=digitar type="file" size=20 ><input id=map type="hidden" value="" name="map"><input type="button" onclick="roda()" class=executar value="Testar" size=10 name="submit"></form></body></html>'; | |
65 | + echo '<html><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"></head><script>function roda(){window.location.href = "?map="+document.getElementById("nomemap").value;}</script><body ><form action="testamapfile.php" method="post" id=f >Nome do arquivo map (deve estar no diretório temas, digite "todos" para testar todos de uma só vez):<br><br><input id=nomemap class=digitar type="file" size=20 ><input id=map type="hidden" value="" name="map"><input type="button" onclick="roda()" class=executar value="Testar" size=10 name="submit"></form></body></html>'; | |
64 | 66 | } |
65 | 67 | if (isset($map) && $map != "") |
66 | 68 | { |
69 | + if ($map == "todos") | |
70 | + { | |
71 | + $tipo = "todos"; | |
72 | + $arqs = listaArquivos("temas"); | |
73 | + $conta = 0; | |
74 | + echo "<br>Número de mapas = ".(count($arqs["arquivos"]))." Faltam= ".(count($arqs["arquivos"])-$iniciar-10)."<br>"; | |
75 | + if (!isset($iniciar)){$iniciar = 0;} | |
76 | + sort($arqs["arquivos"]); | |
77 | + foreach ($arqs["arquivos"] as $arq) | |
78 | + { | |
79 | + if (($conta >= $iniciar) && ($conta < $iniciar+10)) | |
80 | + { | |
81 | + $temp = explode(".",$arq); | |
82 | + if($temp[1] == "map") | |
83 | + verifica($arq); | |
84 | + else | |
85 | + {echo "<br>Arquivo <i>$map</i> não é válido. <br>";} | |
86 | + } | |
87 | + $conta++; | |
88 | + } | |
89 | + echo "<hr><br><br><a href='testamapfile.php?map=todos&iniciar=".($iniciar+10)."' >Próximos mapas</a>"; | |
90 | + } | |
91 | + else | |
92 | + {verifica($map);} | |
93 | +} | |
94 | +function verifica($map) | |
95 | +{ | |
96 | + global $tipo; | |
97 | + ms_ResetErrorList(); | |
67 | 98 | $tema = ""; |
68 | 99 | $map = str_replace("\\","/",$map); |
69 | 100 | $map = basename($map); |
... | ... | @@ -71,15 +102,21 @@ if (isset($map) && $map != "") |
71 | 102 | {$tema = 'temas/'.$map;} |
72 | 103 | if (file_exists('temas/'.$map.'.map')) |
73 | 104 | {$tema = 'temas/'.$map.".map";} |
74 | - if($tipo == "") | |
75 | - echo "<br>Testando: $tema<pre>"; | |
105 | + if(($tipo == "") || ($tipo == "todos")) | |
106 | + echo "<hr><br><br><span style='color:red' ><b>Testando: $tema </span><pre></b>"; | |
76 | 107 | if ($tema != "") |
77 | 108 | { |
78 | 109 | if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) |
79 | 110 | {$mapa = ms_newMapObj("aplicmap/geral1windows.map");} |
80 | 111 | else |
81 | 112 | {$mapa = ms_newMapObj("aplicmap/geral1.map");} |
82 | - $nmapa = ms_newMapObj($tema); | |
113 | + if(@ms_newMapObj($tema)) | |
114 | + {$nmapa = ms_newMapObj($tema);} | |
115 | + else | |
116 | + { | |
117 | + echo "erro no arquivo $map <br>"; | |
118 | + return; | |
119 | + } | |
83 | 120 | $temasn = $nmapa->getAllLayerNames(); |
84 | 121 | foreach ($temasn as $teman) |
85 | 122 | { |
... | ... | @@ -117,29 +154,39 @@ if (isset($map) && $map != "") |
117 | 154 | $sca = $mapa->scalebar; |
118 | 155 | $sca->set("status",MS_OFF); |
119 | 156 | } |
120 | - | |
121 | - $objImagem = $mapa->draw(); | |
157 | + if($tipo == "todos") | |
158 | + { | |
159 | + $mapa->setsize(150,150); | |
160 | + $sca = $mapa->scalebar; | |
161 | + $sca->set("status",MS_OFF); | |
162 | + } | |
163 | + $objImagem = @$mapa->draw(); | |
164 | + if (!$objImagem) | |
165 | + {echo "Problemas ao gerar o mapa<br>";return;} | |
122 | 166 | $nomec = ($objImagem->imagepath).nomeRandomico()."teste.png"; |
123 | 167 | $objImagem->saveImage($nomec); |
124 | 168 | $nomer = ($objImagem->imageurl).basename($nomec); |
125 | - if($tipo == "") | |
169 | + if(($tipo == "") || ($tipo == "todos")) | |
126 | 170 | { |
127 | 171 | echo "<img src=".$nomer." />"; |
128 | - echo "<br>Erros:<br>"; | |
129 | - $error = ms_GetErrorObj(); | |
130 | - while($error && $error->code != MS_NOERR) | |
172 | + if($map != "todos") | |
131 | 173 | { |
132 | - echo "<br>Error in %s: %s<br>", $error->routine, $error->message; | |
133 | - $error = $error->next(); | |
174 | + echo "<br>Erros:<br>"; | |
175 | + $error = ""; | |
176 | + $error = ms_GetErrorObj(); | |
177 | + while($error && $error->code != MS_NOERR) | |
178 | + { | |
179 | + echo "<br>Error in %s: %s<br>", $error->routine, $error->message; | |
180 | + $error = $error->next(); | |
181 | + } | |
134 | 182 | } |
135 | 183 | } |
136 | 184 | else |
137 | 185 | { |
138 | - Header("Content-type: image/png"); | |
139 | - ImagePng(ImageCreateFromPNG($nomec)); | |
186 | + Header("Content-type: image/png"); | |
187 | + ImagePng(ImageCreateFromPNG($nomec)); | |
140 | 188 | } |
189 | + $objImagem->free(); | |
141 | 190 | } |
142 | - else | |
143 | - {echo "<br>Arquivo não existe";} | |
144 | 191 | } |
145 | 192 | ?> |
146 | 193 | \ No newline at end of file | ... | ... |