Commit fbeb11c9747e8503f7d414db3d2341246a33c1df
1 parent
8540381a
Exists in
master
and in
7 other branches
--no commit message
Showing
4 changed files
with
101 additions
and
2 deletions
Show diff stats
admin/admin.db
No preview for this file type
admin/php/classe_metaestat.php
... | ... | @@ -289,6 +289,9 @@ class Metaestat{ |
289 | 289 | * @return array("sqlagrupamento"=>,"sql"=>,"sqlmapserver"=>,"filtro"=>,"colunas"=>,"alias"=>,"colunavalor"=>,"titulo"=>,"nomeregiao"=>) |
290 | 290 | */ |
291 | 291 | function sqlMedidaVariavel($id_medida_variavel,$todasascolunas,$agruparpor="",$tipolayer="polygon",$codigo_tipo_regiao = ""){ |
292 | + // | |
293 | + //o sql que faz acesso aos dados e marcado com /*SE*//*SE*/ na string que sera usada nos mapfiles | |
294 | + // | |
292 | 295 | $filtro = false; |
293 | 296 | $dados = $this->listaMedidaVariavel("",$id_medida_variavel); |
294 | 297 | $pp = $this->listaParametro($id_medida_variavel,"",0); |
... | ... | @@ -452,10 +455,10 @@ class Metaestat{ |
452 | 455 | $sqlgeo .= " WHERE ".$j; |
453 | 456 | |
454 | 457 | if($agregaregiao == true){ |
455 | - $sqlgeo = $colunageo." from ( ".$sqlgeo." __filtro__ ) as foo using unique ".$dadosAgregacao["colunaligacao_regiaopai"]." using srid=".$dadosgeo["srid"]; | |
458 | + $sqlgeo = $colunageo." from /*SE*/( ".$sqlgeo." __filtro__ )/*SE*/ as foo using unique ".$dadosAgregacao["colunaligacao_regiaopai"]." using srid=".$dadosgeo["srid"]; | |
456 | 459 | } |
457 | 460 | else{ |
458 | - $sqlgeo = $colunageo." from (".$sqlgeo." __filtro__ ) as foo using unique ".$dados["colunaidgeo"]." using srid=".$dadosgeo["srid"]; | |
461 | + $sqlgeo = $colunageo." from /*SE*/(".$sqlgeo." __filtro__ )/*SE*/ as foo using unique ".$dados["colunaidgeo"]." using srid=".$dadosgeo["srid"]; | |
459 | 462 | } |
460 | 463 | //remove ambiguidades |
461 | 464 | $sqlgeo = str_replace("d.".$dados["colunaidgeo"].",g.".$dados["colunaidgeo"],"d.".$dados["colunaidgeo"],$sqlgeo); | ... | ... |
ferramentas/metaestat/analise.php
... | ... | @@ -121,6 +121,9 @@ switch (strtoupper($funcao)){ |
121 | 121 | case "CALOR": |
122 | 122 | $retorno = mapaDeCalor($map_file,$tema); |
123 | 123 | break; |
124 | + case "LISTALAYERSAGRUPADOS": | |
125 | + $retorno = listaLayersAgrupados($map_file); | |
126 | + break; | |
124 | 127 | case "ADICIONALIMITEREGIAO": |
125 | 128 | if(empty($outlinecolor)){ |
126 | 129 | $outlinecolor = "255,0,0"; |
... | ... | @@ -631,4 +634,42 @@ function analise_aplicafiltroregiao($map_file,$codigo_tipo_regiao,$codigo_regiao |
631 | 634 | $mapa->save($map_file); |
632 | 635 | return "ok"; |
633 | 636 | } |
637 | +/** | |
638 | + * Cria um novo layer no mapa atual fazendo a juncao dos SQLs para obter em uma mesma tabela todas as colunas das medidas de variavies | |
639 | + * | |
640 | + * @param string com a lista de nomes de layers separados por virgula | |
641 | + * @return Nome do layer criado | |
642 | + * | |
643 | + */ | |
644 | +function juntaMedidasVariaveis($map_file,$layerNames){ | |
645 | + | |
646 | +} | |
647 | +/** | |
648 | + * Lista os nomes dos layers originados do sistema METAESTAT. | |
649 | + * Os layers sao agrupados por tipo de regiao e tipo de representacao | |
650 | + * @param unknown $map_file | |
651 | + * @return string | |
652 | + */ | |
653 | +function listaLayersAgrupados($map_file){ | |
654 | + //MS_LAYER_POINT, MS_LAYER_LINE, MS_LAYER_POLYGON | |
655 | + $tipos[0] = "ponto"; | |
656 | + $tipos[1] = "linha"; | |
657 | + $tipos[2] = "poligono"; | |
658 | + $mapa = ms_newMapObj($map_file); | |
659 | + $layers = analise_listaLayersMetaestat($mapa); | |
660 | + $m = new Metaestat(); | |
661 | + $camadas = array(); | |
662 | + foreach($layers as $l){ | |
663 | + $codigo_tipo_regiao = $l->getmetadata("METAESTAT_CODIGO_TIPO_REGIAO"); | |
664 | + $tema = (mb_convert_encoding(($l->getmetadata("tema")),"UTF-8","ISO-8859-1")); | |
665 | + $regiao = $m->listaTipoRegiao($codigo_tipo_regiao); | |
666 | + $camadas[] = array( | |
667 | + "layer"=>$l->name, | |
668 | + "tema"=>$tema, | |
669 | + "codigo_tipo_regiao"=>$codigo_tipo_regiao, | |
670 | + "tipolayer"=>$tipos[$l->type] | |
671 | + ); | |
672 | + } | |
673 | + return $camadas; | |
674 | +} | |
634 | 675 | ?> | ... | ... |
ferramentas/metaestat/index.js
... | ... | @@ -193,6 +193,10 @@ i3GEOF.metaestat = { |
193 | 193 | titulo: "Mostra os valores como textos no mapa", |
194 | 194 | onclick: "i3GEOF.metaestat.analise.toponimia()", |
195 | 195 | icone: "imagens/gisicons/label.png" |
196 | + },{ | |
197 | + titulo: "Junta dados das camadas", | |
198 | + onclick: "i3GEOF.metaestat.analise.juntaMedidasVariaveis()", | |
199 | + icone: "imagens/gisicons/layer-group-add.png" | |
196 | 200 | } |
197 | 201 | ], |
198 | 202 | /** |
... | ... | @@ -323,6 +327,57 @@ i3GEOF.metaestat = { |
323 | 327 | i3GEO.util.dialogoFerramenta("i3GEO.tema.dialogo.toponimia()","toponimia","toponimia","index.js","i3GEOF.metaestat.analise.abreToponimia()"); |
324 | 328 | }, |
325 | 329 | /** |
330 | + * Junta camadas em uma nova, contendo as colunas das medidas | |
331 | + */ | |
332 | + juntaMedidasVariaveis: function(){ | |
333 | + var p = i3GEO.configura.locaplic+"/ferramentas/metaestat/analise.php?g_sid="+i3GEO.configura.sid + | |
334 | + "&funcao=listaLayersAgrupados", | |
335 | + temp = function(retorno){ | |
336 | + i3GEO.janela.fechaAguarde("aguardeBuscaDados"); | |
337 | + if($i("i3GEOF.junta_corpo")){ | |
338 | + return; | |
339 | + } | |
340 | + var minimiza,cabecalho,titulo,ins,n,i,lista = "<table class=lista4 >"; | |
341 | + cabecalho = function(){ | |
342 | + }; | |
343 | + minimiza = function(){ | |
344 | + i3GEO.janela.minimiza("i3GEOF.junta"); | |
345 | + }; | |
346 | + //cria a janela flutuante | |
347 | + titulo = "Junção de medidas </a>"; | |
348 | + i3GEO.janela.cria( | |
349 | + "260px", | |
350 | + "340px", | |
351 | + "", | |
352 | + "", | |
353 | + "", | |
354 | + titulo, | |
355 | + "i3GEOF.junta", | |
356 | + false, | |
357 | + "hd", | |
358 | + cabecalho, | |
359 | + minimiza | |
360 | + ); | |
361 | + $i("i3GEOF.junta_corpo").style.backgroundColor = "white"; | |
362 | + n = retorno.data.length; | |
363 | + for(i=0;i<n;i++){ | |
364 | + lista += "<tr><td><input style=cursor:pointer type=checkbox id='"+retorno.data[i].layer+"' ></td><td>"+retorno.data[i].tema+"</td></tr>"; | |
365 | + } | |
366 | + lista += "</table>"; | |
367 | + ins = "" + | |
368 | + '<p class=paragrafo ><b>Escolha as camadas de mesmo tipo e região:</b></p>' + | |
369 | + lista + | |
370 | + '<br><br><input id=i3geojuntaAplica type="button" value="Aplicar" />'; | |
371 | + $i("i3GEOF.junta_corpo").innerHTML = ins; | |
372 | + new YAHOO.widget.Button( | |
373 | + "i3geojuntaAplica", | |
374 | + {onclick:{fn: i3GEOF.metaestat.analise.filtraPeriodo.adicionaFiltro}} | |
375 | + ); | |
376 | + }; | |
377 | + i3GEO.janela.abreAguarde("aguardeBuscaDados","Aguarde..."); | |
378 | + i3GEO.util.ajaxGet(p,temp); | |
379 | + }, | |
380 | + /** | |
326 | 381 | * Obtem os parametros necessarios ao funcionamento de i3GEOF.metaestat.analise.toponimia() |
327 | 382 | * Abre a janela de opcoes de i3GEOF.toponimia.iniciaJanelaFlutuante() |
328 | 383 | */ | ... | ... |