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 | 20 | "; |
| 21 | 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 | 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 | 25 | include("../../ms_configura.php"); |
| 25 | 26 | include("../../classesphp/funcoes_gerais.php"); |
| 26 | 27 | include("../../classesphp/pega_variaveis.php"); |
| 27 | 28 | include("../../classesphp/carrega_ext.php"); |
| 29 | +$v = versao(); | |
| 30 | +$vi = $v["inteiro"]; | |
| 31 | +$v = $v["principal"]; | |
| 32 | + | |
| 28 | 33 | if($cache == "nao"){ |
| 29 | 34 | $nometemp = nomeRandomico(); |
| 30 | 35 | } else { |
| ... | ... | @@ -101,6 +106,7 @@ else{ |
| 101 | 106 | $base = $locaplic."/aplicmap/".$base; |
| 102 | 107 | } |
| 103 | 108 | } |
| 109 | +//desenv /var/www/html/i3geo/i3geo/sage/camadas/base_linux.map | |
| 104 | 110 | $mapa = ms_newMapObj($base); |
| 105 | 111 | |
| 106 | 112 | //remove as camadas do mapa base |
| ... | ... | @@ -115,16 +121,23 @@ for ($i=0;$i < $numlayers;$i++){ |
| 115 | 121 | } |
| 116 | 122 | } |
| 117 | 123 | //ajusta o label |
| 124 | + | |
| 118 | 125 | $copyright = $mapa->getlayerbyname("copyright"); |
| 119 | 126 | if($copyright != ""){ |
| 120 | 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 | 134 | $label->updatefromstring("LABEL TYPE TRUETYPE END"); |
| 123 | 135 | $label->set("font","arial"); |
| 124 | 136 | $label->set("size",15); |
| 125 | 137 | $label->updatefromstring("LABEL POSITION lr END"); |
| 126 | 138 | $label->updatefromstring('LABEL STYLE GEOMTRANSFORM "labelpoly" COLOR 255 255 255 END END'); |
| 127 | 139 | } |
| 140 | + | |
| 128 | 141 | // |
| 129 | 142 | $mapa->save($arqtemp.".map"); |
| 130 | 143 | //adiciona ao mapa base as camadas do mapfile indicado em $tema |
| ... | ... | @@ -152,6 +165,7 @@ for ($i=0;$i < $numlayers;$i++){ |
| 152 | 165 | cloneInlineSymbol($layern,$nmapa,$mapa); |
| 153 | 166 | ms_newLayerObj($mapa, $layern); |
| 154 | 167 | } |
| 168 | + | |
| 155 | 169 | $mapa->save($arqtemp.".map"); |
| 156 | 170 | |
| 157 | 171 | //aplica a extensao geografica |
| ... | ... | @@ -172,15 +186,16 @@ if ($ret != ""){ |
| 172 | 186 | $mapa->setsize($w,$h); |
| 173 | 187 | $sca = $mapa->scalebar; |
| 174 | 188 | $sca->set("status",MS_OFF); |
| 189 | + | |
| 175 | 190 | if($legenda == "sim"){ |
| 176 | 191 | $leg = $mapa->legend; |
| 177 | 192 | $leg->set("status",MS_EMBED); |
| 178 | 193 | $cor = $leg->imagecolor; |
| 179 | 194 | $cor->setrgb(250,250,250); |
| 180 | 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 | 199 | //$leg->set("keyspacingy",10); |
| 185 | 200 | $layer = $mapa->getlayerbyname($tema); |
| 186 | 201 | $nclass = $layer->numclasses; |
| ... | ... | @@ -191,6 +206,7 @@ if($legenda == "sim"){ |
| 191 | 206 | } |
| 192 | 207 | } |
| 193 | 208 | } |
| 209 | + | |
| 194 | 210 | $c = $mapa->imagecolor; |
| 195 | 211 | $c->setrgb(-1,-1,-1); |
| 196 | 212 | $o = $mapa->outputformat; |
| ... | ... | @@ -199,14 +215,18 @@ $o->set("imagemode",MS_IMAGEMODE_RGBA); |
| 199 | 215 | if($transparente == "sim"){ |
| 200 | 216 | $o->set("transparent",MS_TRUE); |
| 201 | 217 | } |
| 218 | + | |
| 202 | 219 | $mapa->save($arqtemp.".map"); |
| 203 | 220 | $mapa = ms_newMapObj($arqtemp.".map"); |
| 221 | +/* | |
| 204 | 222 | if(validaAcessoTemas($arqtemp.".map",false) == true){ |
| 205 | 223 | echo "Existem temas restritos";exit; |
| 206 | 224 | } |
| 225 | +*/ | |
| 207 | 226 | //pega a lista de valores unicos da $colunat |
| 208 | 227 | include_once("../../classesphp/classe_atributos.php"); |
| 209 | 228 | $m = new Atributos($arqtemp.".map",$tema); |
| 229 | + | |
| 210 | 230 | $lista = $m->listaUnicoRapida($colunat); |
| 211 | 231 | $listaunica = array(); |
| 212 | 232 | foreach($lista as $l){ |
| ... | ... | @@ -215,18 +235,34 @@ foreach($lista as $l){ |
| 215 | 235 | $listaunica[] = $l; |
| 216 | 236 | } |
| 217 | 237 | } |
| 238 | +//$listaunica = array ("201501","201502","201503","201504","201505"); | |
| 218 | 239 | //cria as imagens para cada periodo |
| 219 | 240 | $layer = $mapa->getlayerbyname($tema); |
| 220 | 241 | |
| 221 | 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 | 250 | if($copyright != ""){ |
| 223 | 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 | 262 | $imagens = array(); |
| 227 | 263 | $duracao = array(); |
| 228 | 264 | $objImagem = ""; |
| 229 | -//$listaunica = array($listaunica[1]); | |
| 265 | + | |
| 230 | 266 | foreach($listaunica as $d){ |
| 231 | 267 | if(strtoupper($colunat) == $colunat){ |
| 232 | 268 | $filtro = "(('[$colunat]' $operador '$d'))"; |
| ... | ... | @@ -241,27 +277,33 @@ foreach($listaunica as $d){ |
| 241 | 277 | } |
| 242 | 278 | } |
| 243 | 279 | $layer->setfilter($filtro); |
| 244 | - //$mapa->save($arqtemp.".map");echo $arqtemp;exit; | |
| 245 | 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 | 284 | $label->updateFromString($s); |
| 250 | 285 | } |
| 251 | - if($objImagem == ""){ | |
| 252 | - $objImagem = $mapa->draw(); | |
| 253 | - $objImagem->saveImage($nomec); | |
| 254 | - } | |
| 255 | 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 | 300 | $imagens[] = $nomec; |
| 261 | 301 | $duracao[] = $tempo; |
| 262 | 302 | } |
| 263 | 303 | //junta as imagens no gif |
| 304 | + | |
| 264 | 305 | include("../../pacotes/gifcreator/GifCreator.php"); |
| 306 | + | |
| 265 | 307 | $gc = new GifCreator(); |
| 266 | 308 | $gc->create($imagens, $duracao, 0); |
| 267 | 309 | $gifBinary = $gc->getGif(); | ... | ... |