Commit 68336200876c8adca56ded9774073fff2af54d73
1 parent
6764e205
Exists in
master
and in
7 other branches
Novas funcionalidades no menu de análise do METAESTAT
Showing
7 changed files
with
265 additions
and
18 deletions
Show diff stats
classesphp/mapa_googlemaps.php
... | ... | @@ -299,6 +299,7 @@ if(trim($_GET["TIPOIMAGEM"]) != "" && trim($_GET["TIPOIMAGEM"]) != "nenhum") |
299 | 299 | imagepng($img); |
300 | 300 | } |
301 | 301 | else{ |
302 | + /* | |
302 | 303 | if($cache == true) |
303 | 304 | {$nomer = salvaCacheImagem($cachedir,$_GET["BBOX"],$nomecache,$map_fileX,$_GET["WIDTH"],$_GET["HEIGHT"]);} |
304 | 305 | else{ |
... | ... | @@ -311,6 +312,32 @@ else{ |
311 | 312 | header('Content-Type: image/png'); |
312 | 313 | fpassthru(fopen($nomer, 'rb')); |
313 | 314 | exit; |
315 | + */ | |
316 | + if($cache == true){ | |
317 | + $nomer = salvaCacheImagem($cachedir,$_GET["BBOX"],$nomecache,$map_fileX,$_GET["WIDTH"],$_GET["HEIGHT"]); | |
318 | + header('Content-Length: '.filesize($nomer)); | |
319 | + header('Content-Type: image/png'); | |
320 | + header('Cache-Control: max-age=3600, must-revalidate'); | |
321 | + header('Expires: ' . gmdate('D, d M Y H:i:s', time()+24*60*60) . ' GMT'); | |
322 | + header('Last-Modified: '.gmdate('D, d M Y H:i:s', filemtime($nomer)).' GMT', true, 200); | |
323 | + //$etag = md5_file($nomer); | |
324 | + //header('Etag: '.$etag); | |
325 | + fpassthru(fopen($nomer, 'rb')); | |
326 | + } | |
327 | + else{ | |
328 | + if($img->imagepath == "") | |
329 | + {echo "Erro IMAGEPATH vazio";exit;} | |
330 | + /* | |
331 | + $nomer = ($img->imagepath)."imgtemp".nomeRand().".png"; | |
332 | + $img->saveImage($nomer); | |
333 | + header('Content-Length: '.filesize($nomer)); | |
334 | + header('Content-Type: image/png'); | |
335 | + fpassthru(fopen($nomer, 'rb')); | |
336 | + */ | |
337 | + header('Content-Type: image/png'); | |
338 | + $img->saveImage(); | |
339 | + } | |
340 | + exit; | |
314 | 341 | } |
315 | 342 | function salvaCacheImagem($cachedir,$bbox,$layer,$map,$w,$h){ |
316 | 343 | global $img,$map_size; | ... | ... |
classesphp/mapa_openlayers.php
... | ... | @@ -265,24 +265,30 @@ if(trim($_GET["TIPOIMAGEM"]) != "" && trim($_GET["TIPOIMAGEM"]) != "nenhum") |
265 | 265 | imagedestroy($img); |
266 | 266 | } |
267 | 267 | else{ |
268 | - if($cache == true) | |
269 | - {$nomer = salvaCacheImagem($cachedir,$_GET["BBOX"],$nomecache,$map_fileX,$_GET["WIDTH"],$_GET["HEIGHT"]);} | |
270 | - else{ | |
271 | - if($img->imagepath == "") | |
272 | - {echo "Erro IMAGEPATH vazio";exit;} | |
273 | - $nomer = ($img->imagepath)."imgtemp".nomeRand().".png"; | |
274 | - $img->saveImage($nomer); | |
275 | - } | |
276 | - header('Content-Length: '.filesize($nomer)); | |
277 | - header('Content-Type: image/png'); | |
278 | 268 | if($cache == true){ |
269 | + $nomer = salvaCacheImagem($cachedir,$_GET["BBOX"],$nomecache,$map_fileX,$_GET["WIDTH"],$_GET["HEIGHT"]); | |
270 | + header('Content-Length: '.filesize($nomer)); | |
271 | + header('Content-Type: image/png'); | |
279 | 272 | header('Cache-Control: max-age=3600, must-revalidate'); |
280 | 273 | header('Expires: ' . gmdate('D, d M Y H:i:s', time()+24*60*60) . ' GMT'); |
281 | 274 | header('Last-Modified: '.gmdate('D, d M Y H:i:s', filemtime($nomer)).' GMT', true, 200); |
282 | - $etag = md5_file($nomer); | |
283 | - header('Etag: '.$etag); | |
275 | + //$etag = md5_file($nomer); | |
276 | + //header('Etag: '.$etag); | |
277 | + fpassthru(fopen($nomer, 'rb')); | |
278 | + } | |
279 | + else{ | |
280 | + if($img->imagepath == "") | |
281 | + {echo "Erro IMAGEPATH vazio";exit;} | |
282 | + /* | |
283 | + $nomer = ($img->imagepath)."imgtemp".nomeRand().".png"; | |
284 | + $img->saveImage($nomer); | |
285 | + header('Content-Length: '.filesize($nomer)); | |
286 | + header('Content-Type: image/png'); | |
287 | + fpassthru(fopen($nomer, 'rb')); | |
288 | + */ | |
289 | + header('Content-Type: image/png'); | |
290 | + $img->saveImage(); | |
284 | 291 | } |
285 | - fpassthru(fopen($nomer, 'rb')); | |
286 | 292 | exit; |
287 | 293 | } |
288 | 294 | function salvaCacheImagem($cachedir,$bbox,$layer,$map,$w,$h){ | ... | ... |
... | ... | @@ -0,0 +1,156 @@ |
1 | +/* | |
2 | + Title: Ferramenta que mostra opcoes adicionais de analise do módulo METAESTAT | |
3 | + | |
4 | + Arquivo: | |
5 | + | |
6 | + i3geo/ferramentas/metaestat/alterarep.js | |
7 | + | |
8 | +Licenca: | |
9 | + | |
10 | +GPL2 | |
11 | + | |
12 | + i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | |
13 | + | |
14 | + Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil | |
15 | + Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | |
16 | + | |
17 | +Esse programa utiliza parcialmente os codigos da aplicacao calculadora de carbono desenvolvido pelo | |
18 | +IPAM - Instituto de Pesquisa Ambiental da Amazonia | |
19 | + | |
20 | +Este programa e software livre; voce pode redistribui-lo | |
21 | +e/ou modifica-lo sob os termos da Licenca Publica Geral | |
22 | +GNU conforme publicada pela Free Software Foundation; | |
23 | + | |
24 | +Este programa e distribuido na expectativa de que seja util, | |
25 | +porem, SEM NENHUMA GARANTIA; nem mesmo a garantia implicita | |
26 | +de COMERCIABILIDADE OU ADEQUACAO A UMA FINALIDADE ESPECIFICA. | |
27 | +Consulte a Licenca Publica Geral do GNU para mais detalhes. | |
28 | +Voce deve ter recebido uma copia da Licenca Publica Geral do | |
29 | +GNU junto com este programa; se nao, escreva para a | |
30 | +Free Software Foundation, Inc., no endereco | |
31 | +59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
32 | +*/ | |
33 | +if(typeof(i3GEOF) === 'undefined'){ | |
34 | + var i3GEOF = {}; | |
35 | +} | |
36 | +/* | |
37 | + Classe: i3GEOF.alterarep | |
38 | + */ | |
39 | +i3GEOF.alterarep = { | |
40 | + aguarde: function(obj){ | |
41 | + if(!obj){ | |
42 | + return "<img style='display:block;z-index:2' src=\'"+i3GEO.configura.locaplic+"/imagens/aguarde.gif\' />"; | |
43 | + } | |
44 | + var i = $i(obj.id+"_imagem"); | |
45 | + if(!i){ | |
46 | + obj.innerHTML = "<img id='"+obj.id+"_imagem' style='display:block;z-index:2' src=\'"+i3GEO.configura.locaplic+"/imagens/aguarde.gif\' />"; | |
47 | + } | |
48 | + else{ | |
49 | + if(i.style.display == "block"){ | |
50 | + i.style.display = "none"; | |
51 | + } | |
52 | + else{ | |
53 | + i.style.display = "block"; | |
54 | + } | |
55 | + } | |
56 | + }, | |
57 | + //para efeitos de compatibilidade | |
58 | + criaJanelaFlutuante: function(){ | |
59 | + i3GEOF.alterarep.iniciaDicionario(); | |
60 | + }, | |
61 | + inicia: function(divid){ | |
62 | + $i(divid).innerHTML = i3GEOF.alterarep.html(); | |
63 | + new YAHOO.widget.Button( | |
64 | + "i3geoalterarepCirculos", | |
65 | + {onclick:{fn: function(){i3GEOF.alterarep.circulos("variatamanho");}}} | |
66 | + ); | |
67 | + $i("i3geoalterarepCirculos-button").style.width = 230 + "px"; | |
68 | + new YAHOO.widget.Button( | |
69 | + "i3geoalterarepCirculos1", | |
70 | + {onclick:{fn: function(){i3GEOF.alterarep.circulos("variacor");}}} | |
71 | + ); | |
72 | + $i("i3geoalterarepCirculos1-button").style.width = 230 + "px"; | |
73 | + }, | |
74 | + //utiliza o dicionario compartilhado | |
75 | + iniciaDicionario: function(){ | |
76 | + if(typeof(i3GEOF.metaestat.dicionario) === 'undefined'){ | |
77 | + i3GEO.util.scriptTag( | |
78 | + i3GEO.configura.locaplic+"/ferramentas/metaestat/dicionario.js", | |
79 | + "i3GEOF.alterarep.iniciaJanelaFlutuante()", | |
80 | + "i3GEOF.metaestat.dicionario_script" | |
81 | + ); | |
82 | + } | |
83 | + else{ | |
84 | + i3GEOF.alterarep.iniciaJanelaFlutuante(); | |
85 | + } | |
86 | + }, | |
87 | + iniciaJanelaFlutuante: function(){ | |
88 | + if($i("i3GEOF.alterarep_corpo")){ | |
89 | + return; | |
90 | + } | |
91 | + var minimiza,cabecalho,janela,divid,titulo; | |
92 | + cabecalho = function(){ | |
93 | + }; | |
94 | + minimiza = function(){ | |
95 | + i3GEO.janela.minimiza("i3GEOF.alterarep"); | |
96 | + }; | |
97 | + //cria a janela flutuante | |
98 | + titulo = "Representação "; | |
99 | + janela = i3GEO.janela.cria( | |
100 | + "250px", | |
101 | + "", | |
102 | + "", | |
103 | + "", | |
104 | + "", | |
105 | + titulo, | |
106 | + "i3GEOF.alterarep", | |
107 | + false, | |
108 | + "hd", | |
109 | + cabecalho, | |
110 | + minimiza | |
111 | + ); | |
112 | + divid = janela[2].id; | |
113 | + $i("i3GEOF.alterarep_corpo").style.backgroundColor = "white"; | |
114 | + i3GEOF.alterarep.inicia(divid); | |
115 | + i3GEO.janela.tempoMsg("Utilize a guia lateral para ligar/desligar camadas que já estejam no mapa"); | |
116 | + }, | |
117 | + html: function(){ | |
118 | + var ins = "" + | |
119 | + ' <fieldset style="padding:5px;margin:2px;">'+ | |
120 | + ' <legend>Círculos representando os valores</legend>'+ | |
121 | + ' <input id=i3geoalterarepCirculos type="button" value="Mantêm as cores e varia o tamanho" /><br><br>'+ | |
122 | + ' <input id=i3geoalterarepCirculos1 type="button" value="Mantêm as cores" />'+ | |
123 | + ' </fieldset><br>'; | |
124 | + return ins; | |
125 | + }, | |
126 | + circulos: function(tipo){ | |
127 | + if($i("i3geoCartoAnaliseCamadasCombo").value == ""){ | |
128 | + i3GEO.janela.tempoMsg("Ative uma camada primeiro"); | |
129 | + return; | |
130 | + } | |
131 | + i3GEO.mapa.ativaTema($i("i3geoCartoAnaliseCamadasCombo").value); | |
132 | + var p = i3GEO.configura.locaplic+"/ferramentas/metaestat/analise.php?g_sid="+i3GEO.configura.sid + | |
133 | + "&tema="+$i("i3geoCartoAnaliseCamadasCombo").value, | |
134 | + temp = function(retorno){ | |
135 | + i3GEO.janela.fechaAguarde("alterarep1"); | |
136 | + var atualiza = function(){ | |
137 | + i3GEO.atualiza(); | |
138 | + i3GEOF.metaestat.CAMADAS.push(retorno.layer); | |
139 | + i3GEO.mapa.ativaTema(retorno.layer); | |
140 | + i3GEOF.metaestat.analise.comboCamadas(); | |
141 | + }; | |
142 | + i3GEO.php.adtema(atualiza,retorno.mapfile); | |
143 | + }; | |
144 | + i3GEO.janela.abreAguarde("alterarep1","Aguarde..."); | |
145 | + if(tipo == "variatamanho"){ | |
146 | + p += "&funcao=classes2circulos"; | |
147 | + } | |
148 | + if(tipo == "variacor"){ | |
149 | + p += "&funcao=classes2circulos1"; | |
150 | + } | |
151 | + i3GEO.util.ajaxGet(p,temp); | |
152 | + }, | |
153 | + corj: function(obj){ | |
154 | + i3GEO.util.abreCor("",obj); | |
155 | + } | |
156 | +}; | |
0 | 157 | \ No newline at end of file | ... | ... |
ferramentas/metaestat/analise.php
... | ... | @@ -80,6 +80,12 @@ switch (strtoupper($funcao)){ |
80 | 80 | break; |
81 | 81 | case "ALTERACONTORNO": |
82 | 82 | $retorno = alteraContorno($map_file,$tema); |
83 | + break; | |
84 | + case "CLASSES2CIRCULOS": | |
85 | + $retorno = classes2circulos($map_file,$tema,"variatamanho"); | |
86 | + break; | |
87 | + case "CLASSES2CIRCULOS1": | |
88 | + $retorno = classes2circulos($map_file,$tema,"variacor"); | |
83 | 89 | break; |
84 | 90 | } |
85 | 91 | if (!connection_aborted()){ |
... | ... | @@ -87,6 +93,50 @@ if (!connection_aborted()){ |
87 | 93 | } |
88 | 94 | else |
89 | 95 | {exit();} |
96 | +function classes2circulos($map_file,$tema,$tipo){ | |
97 | + $mapa = ms_newMapObj($map_file); | |
98 | + $l = $mapa->getlayerbyname($tema); | |
99 | + $layer = ms_newLayerObj($mapa,$l); | |
100 | + $l->set("status",MS_OFF); | |
101 | + $layer->set("status",MS_DEFAULT); | |
102 | + $layer->set("opacity",50); | |
103 | + $nome = $layer->name.nomeRandomico(4); | |
104 | + $layer->set("name",$nome); | |
105 | + if($layer->type != MS_LAYER_POINT){ | |
106 | + $layer->set("type",0); | |
107 | + $m = new Metaestat(); | |
108 | + $regiao = $m->listaTipoRegiao($layer->getmetadata("METAESTAT_CODIGO_TIPO_REGIAO")); | |
109 | + //repare que existe uma virgula apos o nome da coluna com a geometria, isso e necessario para substituir a string correta | |
110 | + if($regiao["colunacentroide"] != ""){ | |
111 | + $stringgeo = "g.".$regiao["colunageo"].","; | |
112 | + $data = str_replace($stringgeo,"g.".$regiao["colunacentroide"].",",$layer->data); | |
113 | + } | |
114 | + else{ | |
115 | + $stringgeo = 'st_setsrid(g.".'.$regiao["colunageo"].'.",".'.$regiao["srid"].'.")'; | |
116 | + $data = str_replace($stringgeo,"st_centroid($stringgeo)",$layer->data); | |
117 | + } | |
118 | + $layer->set("data",$data); | |
119 | + } | |
120 | + $layer->setmetadata("tema",$layer->getmetadata("tema")." - circ"); | |
121 | + $numclasses = $layer->numclasses; | |
122 | + if($tipo == "variatamanho" || $tipo == "variacor"){ | |
123 | + if ($numclasses > 0){ | |
124 | + for ($i=0; $i < $numclasses; ++$i) { | |
125 | + $classe = $layer->getClass($i); | |
126 | + $estilo = $classe->getstyle(0); | |
127 | + $estilo->set("symbolname","ponto"); | |
128 | + if($tipo == "variatamanho"){ | |
129 | + $estilo->set("size",$i * 6); | |
130 | + } | |
131 | + if($tipo == "variacor"){ | |
132 | + $estilo->set("size",12); | |
133 | + } | |
134 | + } | |
135 | + } | |
136 | + } | |
137 | + $mapa->save($map_file); | |
138 | + return $nome; | |
139 | +} | |
90 | 140 | function alteraContorno($map_file,$tema){ |
91 | 141 | $mapa = ms_newMapObj($map_file); |
92 | 142 | $layer = $mapa->getlayerbyname($tema); | ... | ... |
ferramentas/metaestat/index.js
... | ... | @@ -146,7 +146,7 @@ i3GEOF.metaestat = { |
146 | 146 | var temas = retorno.data, |
147 | 147 | n = temas.length, |
148 | 148 | i,t,ins; |
149 | - ins = "<p class=paragrafo >Ativar a camada:</p><select id='i3geoCartoAnaliseCamadasCombo' onchange='i3GEOF.metaestat.comum.ativaCamada(this.value)' style='width:250px;' ><option value=''>---</option>"; | |
149 | + ins = "<p class=paragrafo style='position:relative;top:5px;'>Ativar a camada:</p><select id='i3geoCartoAnaliseCamadasCombo' onchange='i3GEOF.metaestat.comum.ativaCamada(this.value)' style='width:250px;' ><option value=''>---</option>"; | |
150 | 150 | for(i=0;i<n;i++){ |
151 | 151 | t = i3GEO.arvoreDeCamadas.pegaTema(temas[i]); |
152 | 152 | if(t != ""){ |
... | ... | @@ -163,7 +163,16 @@ i3GEOF.metaestat = { |
163 | 163 | i3GEO.php.listaCamadasMetaestat(temp); |
164 | 164 | }, |
165 | 165 | alteraRep: function(){ |
166 | - | |
166 | + if(typeof(i3GEOF.alterarep) === 'undefined'){ | |
167 | + i3GEO.util.scriptTag( | |
168 | + i3GEO.configura.locaplic+"/ferramentas/metaestat/alterarep.js", | |
169 | + "i3GEOF.alterarep.iniciaJanelaFlutuante()", | |
170 | + "i3GEOF.alterarep_script" | |
171 | + ); | |
172 | + } | |
173 | + else{ | |
174 | + i3GEOF.alterarep.iniciaJanelaFlutuante(); | |
175 | + } | |
167 | 176 | }, |
168 | 177 | mostraRegiao: function(){ |
169 | 178 | if(typeof(i3GEOF.mostraregiao) === 'undefined'){ | ... | ... |
ferramentas/metaestat/mostraregiao.js
... | ... | @@ -111,7 +111,6 @@ i3GEOF.mostraregiao = { |
111 | 111 | i3GEOF.mostraregiao.inicia(divid); |
112 | 112 | i3GEO.janela.tempoMsg("Utilize a guia lateral para ligar/desligar camadas que já estejam no mapa"); |
113 | 113 | }, |
114 | - //TODO incluir toponimia | |
115 | 114 | html: function(){ |
116 | 115 | var ins = "" + |
117 | 116 | '<input id=i3geomostraregiaoAplica type="button" value="'+$trad("p14")+'" /> ' + |
... | ... | @@ -173,5 +172,5 @@ i3GEOF.mostraregiao = { |
173 | 172 | }, |
174 | 173 | corj: function(obj){ |
175 | 174 | i3GEO.util.abreCor("",obj); |
176 | - }, | |
175 | + } | |
177 | 176 | }; |
178 | 177 | \ No newline at end of file | ... | ... |
interface/carto_ol.htm
... | ... | @@ -98,7 +98,7 @@ |
98 | 98 | /* |
99 | 99 | Title: Interface para geração de cartogramas com Openlayers |
100 | 100 | |
101 | -Utiliza o módulo de metadados estatísticos para geração de cartogramas | |
101 | +Utiliza o modulo de metadados estatisticos para geracao de cartogramas | |
102 | 102 | |
103 | 103 | File: i3geo/interface/carto_ol.htm |
104 | 104 | */ | ... | ... |