Commit 62634f6e602b09981dcd3453b3c1baca2a4b77a9
1 parent
34f872b2
Exists in
master
and in
7 other branches
Atualização da animação gif
Showing
1 changed file
with
58 additions
and
16 deletions
Show diff stats
ferramentas/animagif/exec.php
@@ -20,11 +20,16 @@ if(empty($_GET)){ | @@ -20,11 +20,16 @@ if(empty($_GET)){ | ||
20 | "; | 20 | "; |
21 | exit; | 21 | exit; |
22 | } | 22 | } |
23 | +//http://localhost/i3geo/ferramentas/animagif/exec.php?operador=lt&nulos=-&transparente=nao&legenda=sim&tema=_llocalianimagif&colunat=ANOCRIA&w=500&h=500&mapext=-74%20-32%20-34%204 | ||
23 | //http://localhost:8014/i3geo/ferramentas/animagif/exec.php?transparente=nao&legenda=sim&tema=dengue_casos_provaveis&colunat=semana_ano_epidemiologico&w=500&h=500&mapext=-74%20-32%20-34%204 | 24 | //http://localhost:8014/i3geo/ferramentas/animagif/exec.php?transparente=nao&legenda=sim&tema=dengue_casos_provaveis&colunat=semana_ano_epidemiologico&w=500&h=500&mapext=-74%20-32%20-34%204 |
24 | include("../../ms_configura.php"); | 25 | include("../../ms_configura.php"); |
25 | include("../../classesphp/funcoes_gerais.php"); | 26 | include("../../classesphp/funcoes_gerais.php"); |
26 | include("../../classesphp/pega_variaveis.php"); | 27 | include("../../classesphp/pega_variaveis.php"); |
27 | include("../../classesphp/carrega_ext.php"); | 28 | include("../../classesphp/carrega_ext.php"); |
29 | +$v = versao(); | ||
30 | +$vi = $v["inteiro"]; | ||
31 | +$v = $v["principal"]; | ||
32 | + | ||
28 | if($cache == "nao"){ | 33 | if($cache == "nao"){ |
29 | $nometemp = nomeRandomico(); | 34 | $nometemp = nomeRandomico(); |
30 | } else { | 35 | } else { |
@@ -101,6 +106,7 @@ else{ | @@ -101,6 +106,7 @@ else{ | ||
101 | $base = $locaplic."/aplicmap/".$base; | 106 | $base = $locaplic."/aplicmap/".$base; |
102 | } | 107 | } |
103 | } | 108 | } |
109 | +//desenv /var/www/html/i3geo/i3geo/sage/camadas/base_linux.map | ||
104 | $mapa = ms_newMapObj($base); | 110 | $mapa = ms_newMapObj($base); |
105 | 111 | ||
106 | //remove as camadas do mapa base | 112 | //remove as camadas do mapa base |
@@ -115,16 +121,23 @@ for ($i=0;$i < $numlayers;$i++){ | @@ -115,16 +121,23 @@ for ($i=0;$i < $numlayers;$i++){ | ||
115 | } | 121 | } |
116 | } | 122 | } |
117 | //ajusta o label | 123 | //ajusta o label |
124 | + | ||
118 | $copyright = $mapa->getlayerbyname("copyright"); | 125 | $copyright = $mapa->getlayerbyname("copyright"); |
119 | if($copyright != ""){ | 126 | if($copyright != ""){ |
120 | $classe = $copyright->getclass(0); | 127 | $classe = $copyright->getclass(0); |
121 | - $label = $classe->getLabel(0); | 128 | + if($vi >= 60200){ |
129 | + $label = $classe->getLabel(0); | ||
130 | + } | ||
131 | + else{ | ||
132 | + $label = $classe->label; | ||
133 | + } | ||
122 | $label->updatefromstring("LABEL TYPE TRUETYPE END"); | 134 | $label->updatefromstring("LABEL TYPE TRUETYPE END"); |
123 | $label->set("font","arial"); | 135 | $label->set("font","arial"); |
124 | $label->set("size",15); | 136 | $label->set("size",15); |
125 | $label->updatefromstring("LABEL POSITION lr END"); | 137 | $label->updatefromstring("LABEL POSITION lr END"); |
126 | $label->updatefromstring('LABEL STYLE GEOMTRANSFORM "labelpoly" COLOR 255 255 255 END END'); | 138 | $label->updatefromstring('LABEL STYLE GEOMTRANSFORM "labelpoly" COLOR 255 255 255 END END'); |
127 | } | 139 | } |
140 | + | ||
128 | // | 141 | // |
129 | $mapa->save($arqtemp.".map"); | 142 | $mapa->save($arqtemp.".map"); |
130 | //adiciona ao mapa base as camadas do mapfile indicado em $tema | 143 | //adiciona ao mapa base as camadas do mapfile indicado em $tema |
@@ -152,6 +165,7 @@ for ($i=0;$i < $numlayers;$i++){ | @@ -152,6 +165,7 @@ for ($i=0;$i < $numlayers;$i++){ | ||
152 | cloneInlineSymbol($layern,$nmapa,$mapa); | 165 | cloneInlineSymbol($layern,$nmapa,$mapa); |
153 | ms_newLayerObj($mapa, $layern); | 166 | ms_newLayerObj($mapa, $layern); |
154 | } | 167 | } |
168 | + | ||
155 | $mapa->save($arqtemp.".map"); | 169 | $mapa->save($arqtemp.".map"); |
156 | 170 | ||
157 | //aplica a extensao geografica | 171 | //aplica a extensao geografica |
@@ -172,15 +186,16 @@ if ($ret != ""){ | @@ -172,15 +186,16 @@ if ($ret != ""){ | ||
172 | $mapa->setsize($w,$h); | 186 | $mapa->setsize($w,$h); |
173 | $sca = $mapa->scalebar; | 187 | $sca = $mapa->scalebar; |
174 | $sca->set("status",MS_OFF); | 188 | $sca->set("status",MS_OFF); |
189 | + | ||
175 | if($legenda == "sim"){ | 190 | if($legenda == "sim"){ |
176 | $leg = $mapa->legend; | 191 | $leg = $mapa->legend; |
177 | $leg->set("status",MS_EMBED); | 192 | $leg->set("status",MS_EMBED); |
178 | $cor = $leg->imagecolor; | 193 | $cor = $leg->imagecolor; |
179 | $cor->setrgb(250,250,250); | 194 | $cor->setrgb(250,250,250); |
180 | $labelleg = $leg->label; | 195 | $labelleg = $leg->label; |
181 | - //$labelleg->set("type",MS_TRUETYPE); | ||
182 | - //$labelleg->set("font","arial"); | ||
183 | - $labelleg->set("size",10); | 196 | + $labelleg->set("type",MS_TRUETYPE); |
197 | + $labelleg->set("font","arial"); | ||
198 | + $labelleg->set("size",12); | ||
184 | //$leg->set("keyspacingy",10); | 199 | //$leg->set("keyspacingy",10); |
185 | $layer = $mapa->getlayerbyname($tema); | 200 | $layer = $mapa->getlayerbyname($tema); |
186 | $nclass = $layer->numclasses; | 201 | $nclass = $layer->numclasses; |
@@ -191,6 +206,7 @@ if($legenda == "sim"){ | @@ -191,6 +206,7 @@ if($legenda == "sim"){ | ||
191 | } | 206 | } |
192 | } | 207 | } |
193 | } | 208 | } |
209 | + | ||
194 | $c = $mapa->imagecolor; | 210 | $c = $mapa->imagecolor; |
195 | $c->setrgb(-1,-1,-1); | 211 | $c->setrgb(-1,-1,-1); |
196 | $o = $mapa->outputformat; | 212 | $o = $mapa->outputformat; |
@@ -199,14 +215,18 @@ $o->set("imagemode",MS_IMAGEMODE_RGBA); | @@ -199,14 +215,18 @@ $o->set("imagemode",MS_IMAGEMODE_RGBA); | ||
199 | if($transparente == "sim"){ | 215 | if($transparente == "sim"){ |
200 | $o->set("transparent",MS_TRUE); | 216 | $o->set("transparent",MS_TRUE); |
201 | } | 217 | } |
218 | + | ||
202 | $mapa->save($arqtemp.".map"); | 219 | $mapa->save($arqtemp.".map"); |
203 | $mapa = ms_newMapObj($arqtemp.".map"); | 220 | $mapa = ms_newMapObj($arqtemp.".map"); |
221 | +/* | ||
204 | if(validaAcessoTemas($arqtemp.".map",false) == true){ | 222 | if(validaAcessoTemas($arqtemp.".map",false) == true){ |
205 | echo "Existem temas restritos";exit; | 223 | echo "Existem temas restritos";exit; |
206 | } | 224 | } |
225 | +*/ | ||
207 | //pega a lista de valores unicos da $colunat | 226 | //pega a lista de valores unicos da $colunat |
208 | include_once("../../classesphp/classe_atributos.php"); | 227 | include_once("../../classesphp/classe_atributos.php"); |
209 | $m = new Atributos($arqtemp.".map",$tema); | 228 | $m = new Atributos($arqtemp.".map",$tema); |
229 | + | ||
210 | $lista = $m->listaUnicoRapida($colunat); | 230 | $lista = $m->listaUnicoRapida($colunat); |
211 | $listaunica = array(); | 231 | $listaunica = array(); |
212 | foreach($lista as $l){ | 232 | foreach($lista as $l){ |
@@ -215,18 +235,34 @@ foreach($lista as $l){ | @@ -215,18 +235,34 @@ foreach($lista as $l){ | ||
215 | $listaunica[] = $l; | 235 | $listaunica[] = $l; |
216 | } | 236 | } |
217 | } | 237 | } |
238 | +//$listaunica = array ("201501","201502","201503","201504","201505"); | ||
218 | //cria as imagens para cada periodo | 239 | //cria as imagens para cada periodo |
219 | $layer = $mapa->getlayerbyname($tema); | 240 | $layer = $mapa->getlayerbyname($tema); |
220 | 241 | ||
221 | $copyright = $mapa->getlayerbyname("copyright"); | 242 | $copyright = $mapa->getlayerbyname("copyright"); |
243 | +$classe = ms_newClassObj($copyright); | ||
244 | + | ||
245 | +$classet = ms_newClassObj($copyright); | ||
246 | +$classet->title = " "; | ||
247 | + | ||
248 | +$mapa->moveLayerdown(0); | ||
249 | + | ||
222 | if($copyright != ""){ | 250 | if($copyright != ""){ |
223 | $c = $copyright->getclass(0); | 251 | $c = $copyright->getclass(0); |
224 | - $label = $c->getLabel(0); | 252 | + if($vi >= 60200){ |
253 | + $label = $c->getLabel(0); | ||
254 | + } | ||
255 | + else{ | ||
256 | + $label = $c->label; | ||
257 | + } | ||
225 | } | 258 | } |
259 | + | ||
260 | +//$classe = ms_newClassObj($copyright); | ||
261 | + | ||
226 | $imagens = array(); | 262 | $imagens = array(); |
227 | $duracao = array(); | 263 | $duracao = array(); |
228 | $objImagem = ""; | 264 | $objImagem = ""; |
229 | -//$listaunica = array($listaunica[1]); | 265 | + |
230 | foreach($listaunica as $d){ | 266 | foreach($listaunica as $d){ |
231 | if(strtoupper($colunat) == $colunat){ | 267 | if(strtoupper($colunat) == $colunat){ |
232 | $filtro = "(('[$colunat]' $operador '$d'))"; | 268 | $filtro = "(('[$colunat]' $operador '$d'))"; |
@@ -241,27 +277,33 @@ foreach($listaunica as $d){ | @@ -241,27 +277,33 @@ foreach($listaunica as $d){ | ||
241 | } | 277 | } |
242 | } | 278 | } |
243 | $layer->setfilter($filtro); | 279 | $layer->setfilter($filtro); |
244 | - //$mapa->save($arqtemp.".map");echo $arqtemp;exit; | ||
245 | $nomec = $arqtemp.$d.".png"; | 280 | $nomec = $arqtemp.$d.".png"; |
246 | 281 | ||
247 | - $s = "LABEL TEXT '".$d."' END"; | ||
248 | - if($copyright != ""){ | 282 | + if($copyright != "" && $vi >= 60300){ |
283 | + $s = "LABEL TEXT '".$d."' END"; | ||
249 | $label->updateFromString($s); | 284 | $label->updateFromString($s); |
250 | } | 285 | } |
251 | - if($objImagem == ""){ | ||
252 | - $objImagem = $mapa->draw(); | ||
253 | - $objImagem->saveImage($nomec); | ||
254 | - } | ||
255 | else{ | 286 | else{ |
256 | - $i = $mapa->draw(); | ||
257 | - $objImagem->pasteImage($i,-1); | ||
258 | - $objImagem->saveImage($nomec); | 287 | + $classe->title = $d; |
288 | + } | ||
289 | + if(!file_exists($nomec)){ | ||
290 | + if($objImagem == ""){ | ||
291 | + $objImagem = $mapa->draw(); | ||
292 | + $objImagem->saveImage($nomec); | ||
293 | + } | ||
294 | + else{ | ||
295 | + $i = $mapa->draw(); | ||
296 | + $objImagem->pasteImage($i,-1); | ||
297 | + $objImagem->saveImage($nomec); | ||
298 | + } | ||
259 | } | 299 | } |
260 | $imagens[] = $nomec; | 300 | $imagens[] = $nomec; |
261 | $duracao[] = $tempo; | 301 | $duracao[] = $tempo; |
262 | } | 302 | } |
263 | //junta as imagens no gif | 303 | //junta as imagens no gif |
304 | + | ||
264 | include("../../pacotes/gifcreator/GifCreator.php"); | 305 | include("../../pacotes/gifcreator/GifCreator.php"); |
306 | + | ||
265 | $gc = new GifCreator(); | 307 | $gc = new GifCreator(); |
266 | $gc->create($imagens, $duracao, 0); | 308 | $gc->create($imagens, $duracao, 0); |
267 | $gifBinary = $gc->getGif(); | 309 | $gifBinary = $gc->getGif(); |