Commit ade2ba06e62211ab44a8ed6c59fed66a73f3d859
1 parent
a750af35
Exists in
master
and in
7 other branches
Inclusão de filtro de tempo na opção de análise do sistema metaestat
Showing
11 changed files
with
360 additions
and
84 deletions
Show diff stats
admin/admin.db
No preview for this file type
admin/php/classe_metaestat.php
| @@ -275,15 +275,21 @@ class Metaestat{ | @@ -275,15 +275,21 @@ class Metaestat{ | ||
| 275 | $dadosAgregacao = $this->listaAgregaRegiaoFilho($dados["codigo_tipo_regiao"], $codigo_tipo_regiao); | 275 | $dadosAgregacao = $this->listaAgregaRegiaoFilho($dados["codigo_tipo_regiao"], $codigo_tipo_regiao); |
| 276 | $sqlgeo = "g.".$dadosAgregacao["colunaligacao_regiaopai"].",sum(d.".$dados["colunavalor"].") as ".$dados["colunavalor"]; | 276 | $sqlgeo = "g.".$dadosAgregacao["colunaligacao_regiaopai"].",sum(d.".$dados["colunavalor"].") as ".$dados["colunavalor"]; |
| 277 | } | 277 | } |
| 278 | - //TODO decidir se e soma ou media | 278 | + $tipoconta = ""; |
| 279 | + if($dados["permitesoma"] == 1){ | ||
| 280 | + $tipoconta = "sum"; | ||
| 281 | + } | ||
| 282 | + elseif($dados["permitemedia"] == 1){ | ||
| 283 | + $tipoconta = "mean"; | ||
| 284 | + } | ||
| 279 | if(empty($agruparpor)){ | 285 | if(empty($agruparpor)){ |
| 280 | $sql .= " FROM ".$dados["esquemadb"].".".$dados["tabela"]." as d "; | 286 | $sql .= " FROM ".$dados["esquemadb"].".".$dados["tabela"]." as d "; |
| 281 | $sqlgeo .= " FROM ".$dados["esquemadb"].".".$dados["tabela"]." as d,".$dadosgeo["esquemadb"].".".$dadosgeo["tabela"]." as g "; | 287 | $sqlgeo .= " FROM ".$dados["esquemadb"].".".$dados["tabela"]." as d,".$dadosgeo["esquemadb"].".".$dadosgeo["tabela"]." as g "; |
| 282 | } | 288 | } |
| 283 | else{ | 289 | else{ |
| 284 | $sqlagrupamento = " SELECT d.".$agruparpor." FROM ".$dados["esquemadb"].".".$dados["tabela"]." as d group by ".$agruparpor." order by ".$agruparpor; | 290 | $sqlagrupamento = " SELECT d.".$agruparpor." FROM ".$dados["esquemadb"].".".$dados["tabela"]." as d group by ".$agruparpor." order by ".$agruparpor; |
| 285 | - $sqlgeo .= " FROM (SELECT sum(".$dados["colunavalor"].") as ".$dados["colunavalor"].",".$dados["colunaidgeo"].",".$agruparpor." FROM ".$dados["esquemadb"].".".$dados["tabela"] ." __dadosfiltro__ group by ".$agruparpor.",".$dados["colunaidgeo"].") as d, ".$dadosgeo["esquemadb"].".".$dadosgeo["tabela"]." as g"; | ||
| 286 | - $sql .= " FROM (SELECT sum(".$dados["colunavalor"].") as ".$dados["colunavalor"].",".$dados["colunaidgeo"].",".$agruparpor." FROM ".$dados["esquemadb"].".".$dados["tabela"] ." __dadosfiltro__ group by ".$agruparpor.",".$dados["colunaidgeo"].") as d "; | 291 | + $sqlgeo .= " FROM (SELECT $tipoconta(".$dados["colunavalor"].") as ".$dados["colunavalor"].",".$dados["colunaidgeo"].",".$agruparpor." FROM ".$dados["esquemadb"].".".$dados["tabela"] ." __dadosfiltro__ group by ".$agruparpor.",".$dados["colunaidgeo"].") as d, ".$dadosgeo["esquemadb"].".".$dadosgeo["tabela"]." as g"; |
| 292 | + $sql .= " FROM (SELECT $tipoconta(".$dados["colunavalor"].") as ".$dados["colunavalor"].",".$dados["colunaidgeo"].",".$agruparpor." FROM ".$dados["esquemadb"].".".$dados["tabela"] ." __dadosfiltro__ group by ".$agruparpor.",".$dados["colunaidgeo"].") as d "; | ||
| 287 | } | 293 | } |
| 288 | $dadosfiltro = ""; | 294 | $dadosfiltro = ""; |
| 289 | if(!empty($dados["filtro"])){ | 295 | if(!empty($dados["filtro"])){ |
| @@ -324,8 +330,10 @@ class Metaestat{ | @@ -324,8 +330,10 @@ class Metaestat{ | ||
| 324 | //indicando onde deve comecar e terminar uma possivel clausula where | 330 | //indicando onde deve comecar e terminar uma possivel clausula where |
| 325 | //ou com /*FA*//*FA*/ | 331 | //ou com /*FA*//*FA*/ |
| 326 | //para marcar que deve ser utilizado AND ao adicionar o filtro | 332 | //para marcar que deve ser utilizado AND ao adicionar o filtro |
| 333 | + //utiliza-se da mesma forma /*FAT*//*FAT*/ e /*FWT*//*FWT*/ para os filtros de tempo | ||
| 327 | //Layers adicionados aqui sao marcados com o metadata METAESTAT "SIM" | 334 | //Layers adicionados aqui sao marcados com o metadata METAESTAT "SIM" |
| 328 | //O codigo_tipo_regiao e marcado com o metadata METAESTAT_CODIGO_TIPO_REGIAO | 335 | //O codigo_tipo_regiao e marcado com o metadata METAESTAT_CODIGO_TIPO_REGIAO |
| 336 | + //O id da medida da variavel e marcado com o metadata ID_MEDIDA_VARIAVEL | ||
| 329 | $arq = $this->dir_tmp."/".$this->nomecache.".map"; | 337 | $arq = $this->dir_tmp."/".$this->nomecache.".map"; |
| 330 | if(!file_exists($arq)){ | 338 | if(!file_exists($arq)){ |
| 331 | if(empty($tipolayer)){ | 339 | if(empty($tipolayer)){ |
| @@ -343,10 +351,10 @@ class Metaestat{ | @@ -343,10 +351,10 @@ class Metaestat{ | ||
| 343 | $sql = $this->sqlMedidaVariavel($id_medida_variavel,$todasascolunas,$agruparpor,$tipolayer,$codigo_tipo_regiao); | 351 | $sql = $this->sqlMedidaVariavel($id_medida_variavel,$todasascolunas,$agruparpor,$tipolayer,$codigo_tipo_regiao); |
| 344 | $sqlf = $sql["sqlmapserver"]; | 352 | $sqlf = $sql["sqlmapserver"]; |
| 345 | if(!empty($filtro)){ | 353 | if(!empty($filtro)){ |
| 346 | - $sqlf = str_replace("__filtro__"," AND ".$filtro." /*FA*//*FA*/",$sqlf); | 354 | + $sqlf = str_replace("__filtro__"," AND ".$filtro." /*FA*//*FA*/ /*FAT*//*FAT*/",$sqlf); |
| 347 | } | 355 | } |
| 348 | else{ | 356 | else{ |
| 349 | - $sqlf = str_replace("__filtro__","/*FW*//*FW*/",$sqlf); | 357 | + $sqlf = str_replace("__filtro__","/*FW*//*FW*/ /*FWT*//*FWT*/",$sqlf); |
| 350 | } | 358 | } |
| 351 | $classes = ""; | 359 | $classes = ""; |
| 352 | if(!empty($id_classificacao)){ | 360 | if(!empty($id_classificacao)){ |
| @@ -368,6 +376,7 @@ class Metaestat{ | @@ -368,6 +376,7 @@ class Metaestat{ | ||
| 368 | $dados[] = ' CLASSE "SIM"'; | 376 | $dados[] = ' CLASSE "SIM"'; |
| 369 | $dados[] = ' METAESTAT "SIM"'; | 377 | $dados[] = ' METAESTAT "SIM"'; |
| 370 | $dados[] = ' METAESTAT_CODIGO_TIPO_REGIAO "'.$codigo_tipo_regiao.'"'; | 378 | $dados[] = ' METAESTAT_CODIGO_TIPO_REGIAO "'.$codigo_tipo_regiao.'"'; |
| 379 | + $dados[] = ' ID_MEDIDA_VARIAVEL "'.$id_medida_variavel.'"'; | ||
| 371 | $dados[] = ' END'; | 380 | $dados[] = ' END'; |
| 372 | if($classes == ""){ | 381 | if($classes == ""){ |
| 373 | $dados[] = ' CLASS'; | 382 | $dados[] = ' CLASS'; |
| @@ -426,7 +435,6 @@ class Metaestat{ | @@ -426,7 +435,6 @@ class Metaestat{ | ||
| 426 | $conexao = "user=".$conexao["usuario"]." password=".$conexao["senha"]." dbname=".$conexao["bancodedados"]." host=".$conexao["host"]." port=".$conexao["porta"].""; | 435 | $conexao = "user=".$conexao["usuario"]." password=".$conexao["senha"]." dbname=".$conexao["bancodedados"]." host=".$conexao["host"]." port=".$conexao["porta"].""; |
| 427 | $sqlf = $meta["colunageo"]." from (select * from ".$meta["esquemadb"].".".$meta["tabela"]." /*FW*//*FW*/) as foo using unique gid using srid=".$meta["srid"]; | 436 | $sqlf = $meta["colunageo"]." from (select * from ".$meta["esquemadb"].".".$meta["tabela"]." /*FW*//*FW*/) as foo using unique gid using srid=".$meta["srid"]; |
| 428 | 437 | ||
| 429 | - //FIXME calcular versao do symbolset | ||
| 430 | $dados[] = "MAP"; | 438 | $dados[] = "MAP"; |
| 431 | $dados[] = 'SYMBOLSET "'.$this->locaplic.'/symbols/simbolosv6.sym"'; | 439 | $dados[] = 'SYMBOLSET "'.$this->locaplic.'/symbols/simbolosv6.sym"'; |
| 432 | $dados[] = 'FONTSET "'.$this->locaplic.'/symbols/fontes.txt"'; | 440 | $dados[] = 'FONTSET "'.$this->locaplic.'/symbols/fontes.txt"'; |
classesjs/classe_php.js
| @@ -71,7 +71,7 @@ do arquivo correspondente ao mapfile atualmente em uso | @@ -71,7 +71,7 @@ do arquivo correspondente ao mapfile atualmente em uso | ||
| 71 | Quando classe_php.js é carregado, é criado o objeto cpJSON que necessita da biblioteca CPAINT. Esse objeto | 71 | Quando classe_php.js é carregado, é criado o objeto cpJSON que necessita da biblioteca CPAINT. Esse objeto |
| 72 | é utilizado nas chamadas AJAX. | 72 | é utilizado nas chamadas AJAX. |
| 73 | 73 | ||
| 74 | -O objeto cpJSON possuí um método .call que executa a operação AJAX. Esse método utiliza basicamente dois parâmetros, | 74 | +O objeto cpJSON possuí um método .call que executa a operação AJAX. Esse método utiliza basicamente dois parametros, |
| 75 | sendo o primeiro o endereço do programa PHP que será executado no servidor e o outro é o nome da função que irá | 75 | sendo o primeiro o endereço do programa PHP que será executado no servidor e o outro é o nome da função que irá |
| 76 | receber e processar os resultados do programa. Exemplo: | 76 | receber e processar os resultados do programa. Exemplo: |
| 77 | 77 | ||
| @@ -430,7 +430,7 @@ i3GEO.php = { | @@ -430,7 +430,7 @@ i3GEO.php = { | ||
| 430 | */ | 430 | */ |
| 431 | mudatamanho: function(funcao,altura,largura){ | 431 | mudatamanho: function(funcao,altura,largura){ |
| 432 | i3GEO.php.verifica(); | 432 | i3GEO.php.verifica(); |
| 433 | - var p = i3GEO.configura.locaplic+"/ferrametas/opcoes_tamanho/exec.php", | 433 | + var p = i3GEO.configura.locaplic+"/ferramentas/opcoes_tamanho/exec.php", |
| 434 | par = "funcao=mudatamanho&altura="+altura+"&largura="+largura+"&g_sid="+i3GEO.configura.sid, | 434 | par = "funcao=mudatamanho&altura="+altura+"&largura="+largura+"&g_sid="+i3GEO.configura.sid, |
| 435 | retorno = function(retorno){ | 435 | retorno = function(retorno){ |
| 436 | i3GEO.janela.fechaAguarde("mudatamanho"); | 436 | i3GEO.janela.fechaAguarde("mudatamanho"); |
classesjs/classe_util.js
| @@ -1854,7 +1854,7 @@ i3GEO.util = { | @@ -1854,7 +1854,7 @@ i3GEO.util = { | ||
| 1854 | } | 1854 | } |
| 1855 | else | 1855 | else |
| 1856 | {temp = {dados:'<div class=erro >Ocorreu um erro</erro>',tipo:"erro"};} | 1856 | {temp = {dados:'<div class=erro >Ocorreu um erro</erro>',tipo:"erro"};} |
| 1857 | - funcao.apply(funcao,temp); | 1857 | + funcao.call(temp); |
| 1858 | }; | 1858 | }; |
| 1859 | i3GEO.php.listaValoresItensTema(monta,tema,itemTema); | 1859 | i3GEO.php.listaValoresItensTema(monta,tema,itemTema); |
| 1860 | }, | 1860 | }, |
| @@ -1960,7 +1960,7 @@ i3GEO.util = { | @@ -1960,7 +1960,7 @@ i3GEO.util = { | ||
| 1960 | } | 1960 | } |
| 1961 | else | 1961 | else |
| 1962 | {temp = {dados:'<div class=erro >Ocorreu um erro</div>',tipo:"erro"};} | 1962 | {temp = {dados:'<div class=erro >Ocorreu um erro</div>',tipo:"erro"};} |
| 1963 | - funcao.apply(funcao,temp); | 1963 | + funcao.call(this,temp); |
| 1964 | }; | 1964 | }; |
| 1965 | i3GEO.php.listaItensTema(monta,tema); | 1965 | i3GEO.php.listaItensTema(monta,tema); |
| 1966 | }, | 1966 | }, |
classesphp/classe_atributos.php
| @@ -349,8 +349,7 @@ class Atributos | @@ -349,8 +349,7 @@ class Atributos | ||
| 349 | if(!$this->layer){ | 349 | if(!$this->layer){ |
| 350 | return "erro"; | 350 | return "erro"; |
| 351 | } | 351 | } |
| 352 | - if($this->v < 6) | ||
| 353 | - { | 352 | + if($this->v < 6){ |
| 354 | $dadosDaClasse="nao"; | 353 | $dadosDaClasse="nao"; |
| 355 | } | 354 | } |
| 356 | $resultadoFinal = array(); | 355 | $resultadoFinal = array(); |
| @@ -364,23 +363,20 @@ class Atributos | @@ -364,23 +363,20 @@ class Atributos | ||
| 364 | $fim = ""; | 363 | $fim = ""; |
| 365 | } | 364 | } |
| 366 | //se tipo for igual a brasil, define a extensão geográfica total | 365 | //se tipo for igual a brasil, define a extensão geográfica total |
| 367 | - if ($tipo == "brasil") | ||
| 368 | - { | 366 | + if ($tipo == "brasil"){ |
| 369 | $this->mapa = extPadrao($this->mapa); | 367 | $this->mapa = extPadrao($this->mapa); |
| 370 | } | 368 | } |
| 371 | $this->layer->set("template","none.htm"); | 369 | $this->layer->set("template","none.htm"); |
| 372 | $this->layer->setfilter(""); | 370 | $this->layer->setfilter(""); |
| 373 | - if ($this->layer->data == "") | ||
| 374 | - { | 371 | + if ($this->layer->data == ""){ |
| 375 | return "erro. O tema não tem tabela"; | 372 | return "erro. O tema não tem tabela"; |
| 376 | } | 373 | } |
| 377 | //pega os valores | 374 | //pega os valores |
| 378 | - if ((!isset($itemtema)) || ($itemtema == "")) | ||
| 379 | - { | 375 | + if ((!isset($itemtema)) || ($itemtema == "")){ |
| 380 | $items = pegaItens($this->layer,$this->mapa); | 376 | $items = pegaItens($this->layer,$this->mapa); |
| 381 | } | 377 | } |
| 382 | - else | ||
| 383 | - {$items[] = $itemtema; | 378 | + else{ |
| 379 | + $items[] = $itemtema; | ||
| 384 | } | 380 | } |
| 385 | //pega os alias definidos no metadata itensdesc | 381 | //pega os alias definidos no metadata itensdesc |
| 386 | if($this->layer->getmetadata("itensdesc") != ""){ | 382 | if($this->layer->getmetadata("itensdesc") != ""){ |
| @@ -388,21 +384,19 @@ class Atributos | @@ -388,21 +384,19 @@ class Atributos | ||
| 388 | $aliasdesc = explode(",",$this->layer->getmetadata("itensdesc")); | 384 | $aliasdesc = explode(",",$this->layer->getmetadata("itensdesc")); |
| 389 | $aliasitens = explode(",",$this->layer->getmetadata("itens")); | 385 | $aliasitens = explode(",",$this->layer->getmetadata("itens")); |
| 390 | $aliasc = array_combine($aliasitens,$aliasdesc); | 386 | $aliasc = array_combine($aliasitens,$aliasdesc); |
| 391 | - if(strtoupper($this->layer->getmetadata("convcaracter")) == "NAO") | ||
| 392 | - { | 387 | + if(strtoupper($this->layer->getmetadata("convcaracter")) == "NAO"){ |
| 393 | $convC = false; | 388 | $convC = false; |
| 394 | } | 389 | } |
| 395 | - else | ||
| 396 | - {$convC = true; | 390 | + else{ |
| 391 | + $convC = true; | ||
| 397 | } | 392 | } |
| 398 | foreach($items as $i){ | 393 | foreach($items as $i){ |
| 399 | if($aliasc[$i]){ | 394 | if($aliasc[$i]){ |
| 400 | - if($convC) | ||
| 401 | - { | 395 | + if($convC){ |
| 402 | $alias[] = $this->converte($aliasc[$i]); | 396 | $alias[] = $this->converte($aliasc[$i]); |
| 403 | } | 397 | } |
| 404 | - else | ||
| 405 | - {$alias[] = $aliasc[$i]; | 398 | + else{ |
| 399 | + $alias[] = $aliasc[$i]; | ||
| 406 | } | 400 | } |
| 407 | } | 401 | } |
| 408 | else{ | 402 | else{ |
| @@ -418,32 +412,25 @@ class Atributos | @@ -418,32 +412,25 @@ class Atributos | ||
| 418 | $res_count = count($shapes); | 412 | $res_count = count($shapes); |
| 419 | $registros = array(); | 413 | $registros = array(); |
| 420 | //lista apenas os selecionados | 414 | //lista apenas os selecionados |
| 421 | - if(strtoupper($this->layer->getmetadata("convcaracter")) == "NAO") | ||
| 422 | - { | 415 | + if(strtoupper($this->layer->getmetadata("convcaracter")) == "NAO"){ |
| 423 | $convC = false; | 416 | $convC = false; |
| 424 | } | 417 | } |
| 425 | - else | ||
| 426 | - {$convC = true; | 418 | + else{ |
| 419 | + $convC = true; | ||
| 427 | } | 420 | } |
| 428 | - if ($tipolista == "selecionados") | ||
| 429 | - { | 421 | + if ($tipolista == "selecionados"){ |
| 430 | $chk = "CHECKED"; | 422 | $chk = "CHECKED"; |
| 431 | - if ($fim != "") | ||
| 432 | - { | ||
| 433 | - if (($res_count >= $fim) && ($fim < $res_count)) | ||
| 434 | - { | 423 | + if ($fim != ""){ |
| 424 | + if (($res_count >= $fim) && ($fim < $res_count)){ | ||
| 435 | $res_count = $fim; | 425 | $res_count = $fim; |
| 436 | } | 426 | } |
| 437 | } | 427 | } |
| 438 | - for ($i = $inicio; $i < $res_count; ++$i) | ||
| 439 | - { | 428 | + for ($i = $inicio; $i < $res_count; ++$i){ |
| 440 | $valitem = array(); | 429 | $valitem = array(); |
| 441 | $shape = $shapes[$i]; | 430 | $shape = $shapes[$i]; |
| 442 | - foreach ($items as $item) | ||
| 443 | - { | 431 | + foreach ($items as $item){ |
| 444 | $valori = trim($shape->values[$item]); | 432 | $valori = trim($shape->values[$item]); |
| 445 | - if($convC == true) | ||
| 446 | - { | 433 | + if($convC == true){ |
| 447 | $valori = $this->converte($valori); | 434 | $valori = $this->converte($valori); |
| 448 | } | 435 | } |
| 449 | $valitem[] = array("item"=>$item,"valor"=>$valori); | 436 | $valitem[] = array("item"=>$item,"valor"=>$valori); |
| @@ -457,26 +444,22 @@ class Atributos | @@ -457,26 +444,22 @@ class Atributos | ||
| 457 | "nome"=>$nome | 444 | "nome"=>$nome |
| 458 | ); | 445 | ); |
| 459 | } | 446 | } |
| 447 | + | ||
| 460 | $registros[] = array("indice"=>$indx,"valores"=>$valitem,"status"=>$chk,"classe"=>$classe); | 448 | $registros[] = array("indice"=>$indx,"valores"=>$valitem,"status"=>$chk,"classe"=>$classe); |
| 461 | } | 449 | } |
| 462 | $resultadoFinal[] = array("registros"=>$registros); | 450 | $resultadoFinal[] = array("registros"=>$registros); |
| 463 | } | 451 | } |
| 464 | - if ($tipolista == "tudo") | ||
| 465 | - { | 452 | + if ($tipolista == "tudo"){ |
| 466 | //ini_set('memory_limit', '500M'); | 453 | //ini_set('memory_limit', '500M'); |
| 467 | $shp_atual = array(); | 454 | $shp_atual = array(); |
| 468 | - for ($i = 0; $i < $res_count;++$i) | ||
| 469 | - { | 455 | + for ($i = 0; $i < $res_count;++$i){ |
| 470 | $shp_atual[$i] = $shapes[$i];; | 456 | $shp_atual[$i] = $shapes[$i];; |
| 471 | } | 457 | } |
| 472 | $chk = ""; | 458 | $chk = ""; |
| 473 | - if (@$this->layer->queryByrect($this->mapa->extent) == MS_SUCCESS) | ||
| 474 | - { | 459 | + if (@$this->layer->queryByrect($this->mapa->extent) == MS_SUCCESS){ |
| 475 | $res_count = $this->layer->getNumresults(); | 460 | $res_count = $this->layer->getNumresults(); |
| 476 | - if ($fim != "") | ||
| 477 | - { | ||
| 478 | - if (($res_count >= $fim) && ($fim < $res_count)) | ||
| 479 | - { | 461 | + if ($fim != ""){ |
| 462 | + if (($res_count >= $fim) && ($fim < $res_count)){ | ||
| 480 | $res_count = $fim; | 463 | $res_count = $fim; |
| 481 | } | 464 | } |
| 482 | } | 465 | } |
| @@ -484,8 +467,8 @@ class Atributos | @@ -484,8 +467,8 @@ class Atributos | ||
| 484 | if($sopen == MS_FAILURE){ | 467 | if($sopen == MS_FAILURE){ |
| 485 | return "erro"; | 468 | return "erro"; |
| 486 | } | 469 | } |
| 487 | - for ($i = $inicio; $i < $res_count; ++$i) | ||
| 488 | - { | 470 | + $valoresunicos = array(); |
| 471 | + for ($i = $inicio; $i < $res_count; ++$i){ | ||
| 489 | $valitem = array(); | 472 | $valitem = array(); |
| 490 | if($this->v == 6){ | 473 | if($this->v == 6){ |
| 491 | $shape = $this->layer->getShape($this->layer->getResult($i)); | 474 | $shape = $this->layer->getShape($this->layer->getResult($i)); |
| @@ -496,26 +479,31 @@ class Atributos | @@ -496,26 +479,31 @@ class Atributos | ||
| 496 | $indx = $result->shapeindex; | 479 | $indx = $result->shapeindex; |
| 497 | $shape = $this->layer->getfeature($indx,-1); | 480 | $shape = $this->layer->getfeature($indx,-1); |
| 498 | } | 481 | } |
| 499 | - foreach ($items as $item) | ||
| 500 | - { | 482 | + |
| 483 | + foreach ($items as $item){ | ||
| 501 | $valori = ""; | 484 | $valori = ""; |
| 502 | - if(@$shape->values[$item]) | ||
| 503 | - { | 485 | + if(@$shape->values[$item]){ |
| 504 | $valori = ($shape->values[$item]); | 486 | $valori = ($shape->values[$item]); |
| 505 | } | 487 | } |
| 506 | - if($convC == true) | ||
| 507 | - { | 488 | + if($convC == true){ |
| 508 | $valori = $this->converte($valori); | 489 | $valori = $this->converte($valori); |
| 509 | } | 490 | } |
| 510 | - $valitem[] = array("item"=>$item,"valor"=>$valori); | 491 | + if($unico == "sim"){ |
| 492 | + if(!in_array($valori,$valoresunicos)){ | ||
| 493 | + $valitem[] = array("item"=>$item,"valor"=>$valori); | ||
| 494 | + } | ||
| 495 | + $valoresunicos[] = $valori; | ||
| 496 | + } | ||
| 497 | + else{ | ||
| 498 | + $valitem[] = array("item"=>$item,"valor"=>$valori); | ||
| 499 | + } | ||
| 511 | } | 500 | } |
| 512 | //if (in_array($shp_index,$shp_atual)) | 501 | //if (in_array($shp_index,$shp_atual)) |
| 513 | - if(isset($shp_atual[$indx])) | ||
| 514 | - { | 502 | + if(isset($shp_atual[$indx])){ |
| 515 | $chk = "CHECKED"; | 503 | $chk = "CHECKED"; |
| 516 | } | 504 | } |
| 517 | $classe = ""; | 505 | $classe = ""; |
| 518 | - if($dadosDaClasse == "sim"){ | 506 | + if($dadosDaClasse == "sim" && $unico != "sim"){ |
| 519 | $indice = $this->layer->getClassIndex($shape); | 507 | $indice = $this->layer->getClassIndex($shape); |
| 520 | $nome = $this->layer->getclass($indice)->name; | 508 | $nome = $this->layer->getclass($indice)->name; |
| 521 | $classe = array( | 509 | $classe = array( |
| @@ -523,7 +511,9 @@ class Atributos | @@ -523,7 +511,9 @@ class Atributos | ||
| 523 | "nome"=>$nome | 511 | "nome"=>$nome |
| 524 | ); | 512 | ); |
| 525 | } | 513 | } |
| 526 | - $registros[] = array("indice"=>$indx,"valores"=>$valitem,"status"=>$chk,"classe"=>$classe); | 514 | + if(count($valitem) > 0){ |
| 515 | + $registros[] = array("indice"=>$indx,"valores"=>$valitem,"status"=>$chk,"classe"=>$classe); | ||
| 516 | + } | ||
| 527 | $chk = ""; | 517 | $chk = ""; |
| 528 | } | 518 | } |
| 529 | $this->layer->close(); | 519 | $this->layer->close(); |
classesphp/mapa_controle.php
| @@ -1674,6 +1674,7 @@ Pega todos os valores dos itens de uma tabela de um tema. | @@ -1674,6 +1674,7 @@ Pega todos os valores dos itens de uma tabela de um tema. | ||
| 1674 | if(!isset($fim)){$fim = "";} | 1674 | if(!isset($fim)){$fim = "";} |
| 1675 | if(!isset($tipolista)){$tipolista = "";} | 1675 | if(!isset($tipolista)){$tipolista = "";} |
| 1676 | if(!isset($itemtema)){$itemtema = "";} | 1676 | if(!isset($itemtema)){$itemtema = "";} |
| 1677 | + if(!isset($unico)){$unico = "";} | ||
| 1677 | $legenda = ""; | 1678 | $legenda = ""; |
| 1678 | if(!isset($dadosDaClasse)){$dadosDaClasse = "nao";} | 1679 | if(!isset($dadosDaClasse)){$dadosDaClasse = "nao";} |
| 1679 | else{ | 1680 | else{ |
| @@ -1686,7 +1687,7 @@ Pega todos os valores dos itens de uma tabela de um tema. | @@ -1686,7 +1687,7 @@ Pega todos os valores dos itens de uma tabela de um tema. | ||
| 1686 | } | 1687 | } |
| 1687 | } | 1688 | } |
| 1688 | } | 1689 | } |
| 1689 | - $retorno = $m->listaRegistros($itemtema,$tipo,"",$inicio,$fim,$tipolista,$dadosDaClasse); | 1690 | + $retorno = $m->listaRegistros($itemtema,$tipo,$unico,$inicio,$fim,$tipolista,$dadosDaClasse); |
| 1690 | $retorno["legenda"] = $legenda; | 1691 | $retorno["legenda"] = $legenda; |
| 1691 | break; | 1692 | break; |
| 1692 | /* | 1693 | /* |
ferramentas/filtro/index.js
| @@ -254,7 +254,7 @@ i3GEOF.filtro = { | @@ -254,7 +254,7 @@ i3GEOF.filtro = { | ||
| 254 | i3GEO.temaAtivo, | 254 | i3GEO.temaAtivo, |
| 255 | itemTema, | 255 | itemTema, |
| 256 | function(retorno){ | 256 | function(retorno){ |
| 257 | - $i("i3GEOfiltrovalores").innerHTML = "<br><p class=paragrafo >Escolha o valor:"+retorno.dados+"</p>"; | 257 | + $i("i3GEOfiltrovalores").innerHTML = "<br><p class=paragrafo >Escolha o valor:"+this.dados+"</p>"; |
| 258 | if ($i("i3GEOfiltrocbitens")){ | 258 | if ($i("i3GEOfiltrocbitens")){ |
| 259 | $i("i3GEOfiltrocbitens").onchange = function() | 259 | $i("i3GEOfiltrocbitens").onchange = function() |
| 260 | {obj.value = this.value;}; | 260 | {obj.value = this.value;}; |
ferramentas/metaestat/analise.php
| @@ -62,6 +62,15 @@ switch (strtoupper($funcao)){ | @@ -62,6 +62,15 @@ switch (strtoupper($funcao)){ | ||
| 62 | break; | 62 | break; |
| 63 | case "LISTACAMADASMETAESTAT": | 63 | case "LISTACAMADASMETAESTAT": |
| 64 | $retorno = analise_listaCamadasMetaestat($map_file); | 64 | $retorno = analise_listaCamadasMetaestat($map_file); |
| 65 | + break; | ||
| 66 | + case "LISTACAMADASFILTROTEMPO": | ||
| 67 | + $retorno = analise_listaCamadasFiltroTempo($map_file); | ||
| 68 | + break; | ||
| 69 | + case "APLICAFILTROTEMPO": | ||
| 70 | + $retorno = analise_aplicaFiltroTempo($map_file,$tema,$pari,$vali,$parf,$valf); | ||
| 71 | + break; | ||
| 72 | + case "LISTAFILTROTEMPO": | ||
| 73 | + $retorno = listaFiltroTempoRaiz($map_file,$nivel); | ||
| 65 | break; | 74 | break; |
| 66 | } | 75 | } |
| 67 | if (!connection_aborted()){ | 76 | if (!connection_aborted()){ |
| @@ -69,6 +78,106 @@ if (!connection_aborted()){ | @@ -69,6 +78,106 @@ if (!connection_aborted()){ | ||
| 69 | } | 78 | } |
| 70 | else | 79 | else |
| 71 | {exit();} | 80 | {exit();} |
| 81 | +function listaFiltroTempoRaiz($map_file,$nivel){ | ||
| 82 | + $mapa = ms_newMapObj($map_file); | ||
| 83 | + $layers = analise_listaLayersMetaestat($mapa); | ||
| 84 | + $m = new Metaestat(); | ||
| 85 | + //pega os parametros de tempo | ||
| 86 | + $filtros = array(); | ||
| 87 | + foreach($layers as $l){ | ||
| 88 | + $id_medida_variavel = $l->getmetadata("ID_MEDIDA_VARIAVEL"); | ||
| 89 | + if($id_medida_variavel != ""){ | ||
| 90 | + //pega os parametros que sao do tipo tempo (1, 2, e 3) | ||
| 91 | + $parametros = $m->listaParametro($id_medida_variavel); | ||
| 92 | + foreach($parametros as $parametro){ | ||
| 93 | + $id_parametro_medida_pai = ""; | ||
| 94 | + if($parametro["id_pai"] == $nivel && $parametro["tipo"] > 0 && $parametro["tipo"] < 4){ | ||
| 95 | + $filtros[] = $parametro; | ||
| 96 | + } | ||
| 97 | + } | ||
| 98 | + } | ||
| 99 | + } | ||
| 100 | + return $filtros; | ||
| 101 | +} | ||
| 102 | + | ||
| 103 | +//lista as camadas que possuem filtro temporais | ||
| 104 | +function analise_listaCamadasFiltroTempo($map_file){ | ||
| 105 | + $mapa = ms_newMapObj($map_file); | ||
| 106 | + $layers = analise_listaLayersMetaestat($mapa); | ||
| 107 | + $m = new Metaestat(); | ||
| 108 | + //pega os parametros de tempo | ||
| 109 | + $camadas = array(); | ||
| 110 | + foreach($layers as $l){ | ||
| 111 | + $id_medida_variavel = $l->getmetadata("ID_MEDIDA_VARIAVEL"); | ||
| 112 | + if($id_medida_variavel != ""){ | ||
| 113 | + //pega os parametros que sao do tipo tempo (1, 2, e 3) | ||
| 114 | + $parametros = $m->listaParametro($id_medida_variavel); | ||
| 115 | + foreach($parametros as $parametro){ | ||
| 116 | + $id_parametro_medida_pai = ""; | ||
| 117 | + if($parametro["id_pai"] == 0 && $parametro["tipo"] > 0 && $parametro["tipo"] < 4){ | ||
| 118 | + $camadas[] = array( | ||
| 119 | + "layer"=>$l->name, | ||
| 120 | + "nome"=>(mb_convert_encoding(($l->getmetadata("tema")),"UTF-8","ISO-8859-1")) | ||
| 121 | + ); | ||
| 122 | + break; | ||
| 123 | + } | ||
| 124 | + } | ||
| 125 | + } | ||
| 126 | + } | ||
| 127 | + return $camadas; | ||
| 128 | +} | ||
| 129 | + | ||
| 130 | +function analise_aplicaFiltroTempo($map_file,$tema,$pari,$vali,$parf,$valf){ | ||
| 131 | + $mapa = ms_newMapObj($map_file); | ||
| 132 | + $layer = $mapa->getlayerbyname($tema); | ||
| 133 | + $id_medida_variavel = $layer->getmetadata("ID_MEDIDA_VARIAVEL"); | ||
| 134 | + $data = $layer->data; | ||
| 135 | + $m = new Metaestat(); | ||
| 136 | + //pega os parametros de tempo inicial | ||
| 137 | + $par = explode(",",$pari); | ||
| 138 | + $val = explode(",",$vali); | ||
| 139 | + $filtro = array(); | ||
| 140 | + $n = count($par); | ||
| 141 | + for($i=0;$i<$n;$i++){ | ||
| 142 | + $parametro = $m->listaParametro($id_medida_variavel,$par[$i]); | ||
| 143 | + $filtro[] = "d.".$parametro["coluna"]." >= ".$val[$i]." "; | ||
| 144 | + } | ||
| 145 | + //pega os parametros de tempo final | ||
| 146 | + $par = explode(",",$parf); | ||
| 147 | + $val = explode(",",$valf); | ||
| 148 | + $n = count($par); | ||
| 149 | + for($i=0;$i<$n;$i++){ | ||
| 150 | + $parametro = $m->listaParametro($id_medida_variavel,$par[$i]); | ||
| 151 | + $filtro[] = "d.".$parametro["coluna"]." <= ".$val[$i]." "; | ||
| 152 | + } | ||
| 153 | + $filtro = implode(" AND ",$filtro); | ||
| 154 | + //substitui as strings de filtro no mapfile | ||
| 155 | + //verifica se o sql existente necessita de where | ||
| 156 | + $where = false; | ||
| 157 | + if (strpos($data, "/*FW*/") === true){ | ||
| 158 | + $where = true; | ||
| 159 | + } | ||
| 160 | + //se where for verdadeiro, verifica se ja existe o where no filtro normal | ||
| 161 | + if($where == true){ | ||
| 162 | + if(strpos($data, "/*FW*//*FW*/") === true){ | ||
| 163 | + //nesse caso o where deve ir no filtro de tempo | ||
| 164 | + $s = explode("/*FWT*/",$data); | ||
| 165 | + $data = $s[0]."/*FWT*/ WHERE ".$filtro." /*FWT*/".$s[2]; | ||
| 166 | + } | ||
| 167 | + else{ | ||
| 168 | + //nesse caso o where ja existe | ||
| 169 | + $s = explode("/*FWT*/",$data); | ||
| 170 | + $data = $s[0]."/*FWT*/ ".$filtro." /*FWT*/".$s[2]; | ||
| 171 | + } | ||
| 172 | + } | ||
| 173 | + else{ | ||
| 174 | + | ||
| 175 | + } | ||
| 176 | + //se where for falso, inclui o filtro de tempo normalmente | ||
| 177 | + | ||
| 178 | + echo $data;exit; | ||
| 179 | + return "ok"; | ||
| 180 | +} | ||
| 72 | function analise_listaCamadasMetaestat($map_file){ | 181 | function analise_listaCamadasMetaestat($map_file){ |
| 73 | $mapa = ms_newMapObj($map_file); | 182 | $mapa = ms_newMapObj($map_file); |
| 74 | $layers = analise_listaLayersMetaestat($mapa); | 183 | $layers = analise_listaLayersMetaestat($mapa); |
| @@ -79,14 +188,17 @@ function analise_listaCamadasMetaestat($map_file){ | @@ -79,14 +188,17 @@ function analise_listaCamadasMetaestat($map_file){ | ||
| 79 | return $camadas; | 188 | return $camadas; |
| 80 | } | 189 | } |
| 81 | //se $tipo for igual a "" remove os filtros | 190 | //se $tipo for igual a "" remove os filtros |
| 82 | -function analise_aplicafiltroregiao($map_file,$codigo_tipo_regiao,$codigo_regiao,$codigo_tipo_regiao_pai,$codigo_regiao_pai,$tipo){ | 191 | +function analise_aplicafiltroregiao($map_file,$codigo_tipo_regiao,$codigo_regiao,$codigo_tipo_regiao_pai,$codigo_regiao_pai,$tipo=""){ |
| 83 | $mapa = ms_newMapObj($map_file); | 192 | $mapa = ms_newMapObj($map_file); |
| 84 | $layers = analise_listaLayersMetaestat($mapa); | 193 | $layers = analise_listaLayersMetaestat($mapa); |
| 85 | - $layers = analise_listaLayersRegiao($layers,$codigo_tipo_regiao); | 194 | + if($codigo_tipo_regiao != ""){ |
| 195 | + $layers = analise_listaLayersRegiao($layers,$codigo_tipo_regiao); | ||
| 196 | + } | ||
| 86 | if(count($layers) > 0){ | 197 | if(count($layers) > 0){ |
| 87 | $m = new Metaestat(); | 198 | $m = new Metaestat(); |
| 88 | $regiao = $m->listaTipoRegiao($codigo_tipo_regiao); | 199 | $regiao = $m->listaTipoRegiao($codigo_tipo_regiao); |
| 89 | //aplica o filtro considerando os codigos que definem a propria regiao | 200 | //aplica o filtro considerando os codigos que definem a propria regiao |
| 201 | + $filtro = ""; | ||
| 90 | if($tipo == "regiaoatual"){ | 202 | if($tipo == "regiaoatual"){ |
| 91 | $filtro = $regiao["esquemadb"].".".$regiao["tabela"].".".$regiao["identificador"]."::text = '$codigo_regiao'"; | 203 | $filtro = $regiao["esquemadb"].".".$regiao["tabela"].".".$regiao["identificador"]."::text = '$codigo_regiao'"; |
| 92 | } | 204 | } |
| @@ -94,7 +206,7 @@ function analise_aplicafiltroregiao($map_file,$codigo_tipo_regiao,$codigo_regiao | @@ -94,7 +206,7 @@ function analise_aplicafiltroregiao($map_file,$codigo_tipo_regiao,$codigo_regiao | ||
| 94 | //$filtro = $regiao["esquemadb"].".".$regiao["tabela"].".".$regiao["identificador"]."::text = '$codigo_regiao'"; | 206 | //$filtro = $regiao["esquemadb"].".".$regiao["tabela"].".".$regiao["identificador"]."::text = '$codigo_regiao'"; |
| 95 | $pai = $m->listaAgregaRegiaoFilho($codigo_tipo_regiao,$codigo_tipo_regiao_pai); | 207 | $pai = $m->listaAgregaRegiaoFilho($codigo_tipo_regiao,$codigo_tipo_regiao_pai); |
| 96 | //var_dump($pai);exit; | 208 | //var_dump($pai);exit; |
| 97 | - $filtro = $regiao["esquemadb"].".".$regiao["tabela"].".".$pai["colunaligacao_regiaopai"]."::text = '$codigo_regiao_pai'"; | 209 | + $filtro = "g.".$pai["colunaligacao_regiaopai"]."::text = '$codigo_regiao_pai'"; |
| 98 | } | 210 | } |
| 99 | foreach($layers as $l){ | 211 | foreach($layers as $l){ |
| 100 | $data = $l->data; | 212 | $data = $l->data; |
| @@ -115,7 +227,10 @@ function analise_aplicafiltroregiao($map_file,$codigo_tipo_regiao,$codigo_regiao | @@ -115,7 +227,10 @@ function analise_aplicafiltroregiao($map_file,$codigo_tipo_regiao,$codigo_regiao | ||
| 115 | $data = $s[0]."/*FW*//*FW*/".$s[2]; | 227 | $data = $s[0]."/*FW*//*FW*/".$s[2]; |
| 116 | } | 228 | } |
| 117 | else{ | 229 | else{ |
| 118 | - $data = $s[0]."/*FW*/ WHERE ".$filtro." /*FW*/".$s[2]; | 230 | + |
| 231 | + $data = $s[0]."/*FW*/ WHERE ".$filtro." /*FW*/".$s[2]; | ||
| 232 | + //para o caso de ja existir a clausula where no filtro de tempo | ||
| 233 | + $data = str_replace("/*FWT*/ WHERE ","/*FWT*/ "); | ||
| 119 | } | 234 | } |
| 120 | } | 235 | } |
| 121 | } | 236 | } |
ferramentas/metaestat/index.js
| @@ -35,6 +35,7 @@ if(typeof(i3GEOF) === 'undefined'){ | @@ -35,6 +35,7 @@ if(typeof(i3GEOF) === 'undefined'){ | ||
| 35 | 35 | ||
| 36 | Gerencia os componentes do módulo de geração de cartogramas estatísticos | 36 | Gerencia os componentes do módulo de geração de cartogramas estatísticos |
| 37 | */ | 37 | */ |
| 38 | +//TODO traduzir | ||
| 38 | i3GEOF.metaestat = { | 39 | i3GEOF.metaestat = { |
| 39 | /** | 40 | /** |
| 40 | * Tipo de interface utilizada para construcao dos parametros | 41 | * Tipo de interface utilizada para construcao dos parametros |
| @@ -113,11 +114,11 @@ i3GEOF.metaestat = { | @@ -113,11 +114,11 @@ i3GEOF.metaestat = { | ||
| 113 | imagemxy = i3GEO.util.pegaPosicaoObjeto($i(i3GEO.Interface.IDCORPO)); | 114 | imagemxy = i3GEO.util.pegaPosicaoObjeto($i(i3GEO.Interface.IDCORPO)); |
| 114 | janela.moveTo(imagemxy[0]+(i3GEOF.metaestat.LEFT*2)+i3GEOF.metaestat.LARGURA+10,i3GEOF.metaestat.TOP); | 115 | janela.moveTo(imagemxy[0]+(i3GEOF.metaestat.LEFT*2)+i3GEOF.metaestat.LARGURA+10,i3GEOF.metaestat.TOP); |
| 115 | }, | 116 | }, |
| 116 | - //TODO traduzir | ||
| 117 | html: function(){ | 117 | html: function(){ |
| 118 | var ins = '<div id="i3geoCartoAnaliseContainer" style="margin-left:5px;line-height:25px">' + | 118 | var ins = '<div id="i3geoCartoAnaliseContainer" style="margin-left:5px;line-height:25px">' + |
| 119 | ' <button title="Localizar região" onclick="i3GEO.mapa.dialogo.locregiao()"><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/open-street-maps.png" /></button>' + | 119 | ' <button title="Localizar região" onclick="i3GEO.mapa.dialogo.locregiao()"><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/open-street-maps.png" /></button>' + |
| 120 | ' <button title="Filtrar região" onclick="i3GEO.mapa.dialogo.filtraregiao()"><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/open-street-maps-filtro.png" /></button>' + | 120 | ' <button title="Filtrar região" onclick="i3GEO.mapa.dialogo.filtraregiao()"><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/open-street-maps-filtro.png" /></button>' + |
| 121 | + ' <button title="Filtrar período" onclick="i3GEOF.metaestat.analise.filtraPeriodo.inicia()"><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/open-street-maps-filtrotime.png" /></button>' + | ||
| 121 | ' <button title="Tabela com os dados" onclick="i3GEO.tema.dialogo.tabela()"><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/table.png" /></button>' + | 122 | ' <button title="Tabela com os dados" onclick="i3GEO.tema.dialogo.tabela()"><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/table.png" /></button>' + |
| 122 | ' <button title="Gráfico interativo" onclick="i3GEO.analise.dialogo.graficoInterativo()"><img src="'+i3GEO.configura.locaplic+'/imagens/oxygen/22x22/view_statistics.png" /></button>' + | 123 | ' <button title="Gráfico interativo" onclick="i3GEO.analise.dialogo.graficoInterativo()"><img src="'+i3GEO.configura.locaplic+'/imagens/oxygen/22x22/view_statistics.png" /></button>' + |
| 123 | ' <button title="Opacidade" onclick="i3GEO.mapa.dialogo.opacidade()"><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/layer-opacity.png" /></button>' + | 124 | ' <button title="Opacidade" onclick="i3GEO.mapa.dialogo.opacidade()"><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/layer-opacity.png" /></button>' + |
| @@ -149,7 +150,7 @@ i3GEOF.metaestat = { | @@ -149,7 +150,7 @@ i3GEOF.metaestat = { | ||
| 149 | }; | 150 | }; |
| 150 | i3GEO.php.listaCamadasMetaestat(temp); | 151 | i3GEO.php.listaCamadasMetaestat(temp); |
| 151 | }, | 152 | }, |
| 152 | - ativaGuiaLegenda: function(){ | 153 | + ativaEditorLegenda: function(){ |
| 153 | if(i3GEO.temaAtivo == ""){ | 154 | if(i3GEO.temaAtivo == ""){ |
| 154 | i3GEO.janela.tempoMsg("Nenhum tema está ativo. Escolha um e depois clique na guia <b>Classes</b>"); | 155 | i3GEO.janela.tempoMsg("Nenhum tema está ativo. Escolha um e depois clique na guia <b>Classes</b>"); |
| 155 | } | 156 | } |
| @@ -157,7 +158,7 @@ i3GEOF.metaestat = { | @@ -157,7 +158,7 @@ i3GEOF.metaestat = { | ||
| 157 | i3GEO.guias.mostraGuiaFerramenta('i3GEOlegendaguia2','i3GEOlegendaguia'); | 158 | i3GEO.guias.mostraGuiaFerramenta('i3GEOlegendaguia2','i3GEOlegendaguia'); |
| 158 | }, | 159 | }, |
| 159 | alteraLegenda: function(){ | 160 | alteraLegenda: function(){ |
| 160 | - i3GEO.util.dialogoFerramenta("i3GEO.tema.dialogo.editaLegenda()","legenda","legenda","index.js","i3GEOF.metaestat.analise.ativaGuiaLegenda()"); | 161 | + i3GEO.util.dialogoFerramenta("i3GEO.tema.dialogo.editaLegenda()","legenda","legenda","index.js","i3GEOF.metaestat.analise.ativaEditorLegenda()"); |
| 161 | }, | 162 | }, |
| 162 | alteraCores: function(){ | 163 | alteraCores: function(){ |
| 163 | //listaColourRampAnaliseMetaestat e o id do elemento input que recebera a lista de cores | 164 | //listaColourRampAnaliseMetaestat e o id do elemento input que recebera a lista de cores |
| @@ -169,7 +170,6 @@ i3GEOF.metaestat = { | @@ -169,7 +170,6 @@ i3GEOF.metaestat = { | ||
| 169 | if(i.value != ""){ | 170 | if(i.value != ""){ |
| 170 | var p,temp,cores = i.value; | 171 | var p,temp,cores = i.value; |
| 171 | temp = function(){ | 172 | temp = function(){ |
| 172 | - i3GEO.janela.AGUARDEMODAL = false; | ||
| 173 | i3GEO.janela.fechaAguarde("aguardeAplicaCores"); | 173 | i3GEO.janela.fechaAguarde("aguardeAplicaCores"); |
| 174 | i3GEO.atualiza(); | 174 | i3GEO.atualiza(); |
| 175 | i3GEO.Interface.atualizaTema("",i3GEO.temaAtivo); | 175 | i3GEO.Interface.atualizaTema("",i3GEO.temaAtivo); |
| @@ -181,9 +181,172 @@ i3GEOF.metaestat = { | @@ -181,9 +181,172 @@ i3GEOF.metaestat = { | ||
| 181 | "&tema="+i3GEO.temaAtivo + | 181 | "&tema="+i3GEO.temaAtivo + |
| 182 | "&cores=" + cores; | 182 | "&cores=" + cores; |
| 183 | i3GEO.janela.AGUARDEMODAL = true; | 183 | i3GEO.janela.AGUARDEMODAL = true; |
| 184 | - i3GEO.janela.fechaAguarde("Aplicando...","aguardeAplicaCores"); | 184 | + i3GEO.janela.abreAguarde("Aplicando...","aguardeAplicaCores"); |
| 185 | + i3GEO.janela.AGUARDEMODAL = false; | ||
| 185 | i3GEO.util.ajaxGet(p,temp); | 186 | i3GEO.util.ajaxGet(p,temp); |
| 186 | } | 187 | } |
| 188 | + }, | ||
| 189 | + filtraPeriodo: { | ||
| 190 | + //CAMADAS: "", | ||
| 191 | + inicia: function(){ | ||
| 192 | + i3GEO.janela.tempoMsg("O filtro de período só pode ser aplicado nas camadas (variáveis) que possuem dados temporais"); | ||
| 193 | + if($i("i3GEOF.filtraperiodo_corpo")){ | ||
| 194 | + return; | ||
| 195 | + } | ||
| 196 | + var minimiza,cabecalho,titulo,ins; | ||
| 197 | + cabecalho = function(){ | ||
| 198 | + }; | ||
| 199 | + minimiza = function(){ | ||
| 200 | + i3GEO.janela.minimiza("i3GEOF.filtraperiodo"); | ||
| 201 | + }; | ||
| 202 | + //cria a janela flutuante | ||
| 203 | + titulo = "Filtro </a>"; | ||
| 204 | + i3GEO.janela.cria( | ||
| 205 | + "260px", | ||
| 206 | + "340px", | ||
| 207 | + "", | ||
| 208 | + "", | ||
| 209 | + "", | ||
| 210 | + titulo, | ||
| 211 | + "i3GEOF.filtraperiodo", | ||
| 212 | + false, | ||
| 213 | + "hd", | ||
| 214 | + cabecalho, | ||
| 215 | + minimiza | ||
| 216 | + ); | ||
| 217 | + $i("i3GEOF.filtraperiodo_corpo").style.backgroundColor = "white"; | ||
| 218 | + ins = "" + | ||
| 219 | + '<p class=paragrafo ><b>Camada que receberá o filtro:</b></p>' + | ||
| 220 | + '<div id="i3GEOF.filtraperiodo.camadas" ></div>' + | ||
| 221 | + '<p class=paragrafo ><b>Início do período:</b></p>' + | ||
| 222 | + '<div id="i3GEOF.filtraperiodo.Pi_0" ></div>' + | ||
| 223 | + '<p class=paragrafo ><b>Fim do período:</b></p>' + | ||
| 224 | + '<div id="i3GEOF.filtraperiodo.Pf_0" ></div>' + | ||
| 225 | + '<br><br><input id=i3geofiltraperiodoAplica type="button" value="Aplicar" />' + | ||
| 226 | + '<input id=i3geofiltraperiodoRemove type="button" value="Remover" />'; | ||
| 227 | + $i("i3GEOF.filtraperiodo_corpo").innerHTML = ins; | ||
| 228 | + new YAHOO.widget.Button( | ||
| 229 | + "i3geofiltraperiodoAplica", | ||
| 230 | + {onclick:{fn: i3GEOF.metaestat.analise.filtraPeriodo.adicionaFiltro}} | ||
| 231 | + ); | ||
| 232 | + new YAHOO.widget.Button( | ||
| 233 | + "i3geofiltraperiodoRemove", | ||
| 234 | + {onclick:{fn: function(){}}} | ||
| 235 | + ); | ||
| 236 | + i3GEOF.metaestat.analise.filtraPeriodo.comboCamadas(); | ||
| 237 | + }, | ||
| 238 | + comboCamadas: function(retorno){ | ||
| 239 | + var temp = function(retorno){ | ||
| 240 | + //i3GEOF.metaestat.analise.filtraPeriodo.CAMADAS = retorno.data; | ||
| 241 | + var i, | ||
| 242 | + n = retorno.data.length, | ||
| 243 | + ins = '<select id="i3GEOF.filtraperiodo.comboCamada" onchange="javascript:i3GEOF.metaestat.analise.filtraPeriodo.comboParametrosReinicia();i3GEOF.metaestat.analise.filtraPeriodo.comboParametros()" style="width:220px;" id="i3GEOF.filtraperiodo.temas" ><option value="">---</option>'; | ||
| 244 | + for(i=0;i<n;i++){ | ||
| 245 | + ins += '<option value="'+retorno.data[i].layer+'" >'+retorno.data[i].nome+'</option>'; | ||
| 246 | + } | ||
| 247 | + ins += "</select><br><br>"; | ||
| 248 | + $i("i3GEOF.filtraperiodo.camadas").innerHTML = ins; | ||
| 249 | + }; | ||
| 250 | + i3GEO.util.ajaxGet( | ||
| 251 | + i3GEO.configura.locaplic+"/ferramentas/metaestat/analise.php?funcao=listaCamadasFiltroTempo&g_sid="+i3GEO.configura.sid, | ||
| 252 | + temp | ||
| 253 | + ); | ||
| 254 | + }, | ||
| 255 | + comboParametrosReinicia: function(operacao){ | ||
| 256 | + $i("i3GEOF.filtraperiodo.Pi_0").innerHTML = ""; | ||
| 257 | + $i("i3GEOF.filtraperiodo.Pf_0").innerHTML = ""; | ||
| 258 | + }, | ||
| 259 | + comboParametros: function(){ | ||
| 260 | + if($i("i3GEOF.filtraperiodo.comboCamada").value == ""){ | ||
| 261 | + return; | ||
| 262 | + } | ||
| 263 | + if($i("i3GEOF.filtraperiodo.Pi_0").innerHTML == ""){ | ||
| 264 | + i3GEOF.metaestat.analise.filtraPeriodo.parametro(0); | ||
| 265 | + return; | ||
| 266 | + } | ||
| 267 | + }, | ||
| 268 | + parametro: function(nivel){ | ||
| 269 | + var layer = $i("i3GEOF.filtraperiodo.comboCamada").value, | ||
| 270 | + temp = function(retorno){ | ||
| 271 | + var n = retorno.data.length, | ||
| 272 | + i, | ||
| 273 | + ins = ""; | ||
| 274 | + if(retorno.data[0] && retorno.data[0].id_pai){ | ||
| 275 | + for(i=0;i<n;i++){ | ||
| 276 | + ins += "<option value='"+retorno.data[i].id_parametro_medida+"'>"+retorno.data[i].nome+"</option>"; | ||
| 277 | + } | ||
| 278 | + $i("i3GEOF.filtraperiodo.Pi_"+nivel).innerHTML = "<p class=paragrafo>Nome do parâmetro:<br>" + | ||
| 279 | + "<select name='' onchange='i3GEOF.metaestat.analise.filtraPeriodo.valoresParametro(this.value,"+nivel+",\"Pi_"+nivel+"\")' style='wisth:150px;'>" + | ||
| 280 | + "<option value='' >---</option>"+ins+"</select></p><div class=paragrafo id='Pi_"+nivel+"'></div>"; | ||
| 281 | + $i("i3GEOF.filtraperiodo.Pf_"+nivel).innerHTML = "<p class=paragrafo>Nome do parâmetro:<br>" + | ||
| 282 | + "<select name='' onchange='i3GEOF.metaestat.analise.filtraPeriodo.valoresParametro(this.value,"+nivel+",\"Pf_"+nivel+"\")' style='wisth:150px;'>" + | ||
| 283 | + "<option value='' >---</option>"+ins+"</select></p><div class=paragrafo id='Pf_"+nivel+"'></div>"; | ||
| 284 | + } | ||
| 285 | + }; | ||
| 286 | + i3GEO.util.ajaxGet( | ||
| 287 | + i3GEO.configura.locaplic+"/ferramentas/metaestat/analise.php?funcao=listaFiltroTempo&g_sid="+i3GEO.configura.sid+"&layer="+layer+"&nivel="+nivel, | ||
| 288 | + temp | ||
| 289 | + ); | ||
| 290 | + }, | ||
| 291 | + valoresParametro: function(id_parametro_medida,nivel,onde){ | ||
| 292 | + if(id_parametro_medida === ""){ | ||
| 293 | + $i(onde).innerHTML = ""; | ||
| 294 | + return; | ||
| 295 | + } | ||
| 296 | + var temp = function(retorno){ | ||
| 297 | + var ins="",i=0,n = retorno.length; | ||
| 298 | + ins += "<p class=paragrafo>Valor:<br>" + | ||
| 299 | + "<select name='"+id_parametro_medida+"' onchange='i3GEOF.metaestat.analise.filtraPeriodo.parametro("+(nivel*1 + 1)+")' style='wisth:150px;background-color:yellow;'><option value=''>---</option>"; | ||
| 300 | + for(i=0;i<n;i++){ | ||
| 301 | + ins += "<option value='"+retorno[i]+"'>"+retorno[i]+"</option>"; | ||
| 302 | + } | ||
| 303 | + $i(onde).innerHTML = ins+"</select>"; | ||
| 304 | + }; | ||
| 305 | + i3GEO.php.listaValoresParametroMedidaVariavel(id_parametro_medida,temp); | ||
| 306 | + }, | ||
| 307 | + adicionaFiltro: function(){ | ||
| 308 | + var p,pini,pfim, | ||
| 309 | + temp = function(retorno){ | ||
| 310 | + i3GEO.janela.fechaAguarde("aguardeAplicaFiltro"); | ||
| 311 | + i3GEO.Interface.atualizaMapa(); | ||
| 312 | + }; | ||
| 313 | + i3GEO.janela.AGUARDEMODAL = true; | ||
| 314 | + i3GEO.janela.abreAguarde("aguardeAplicaFiltro","Aplicando..."); | ||
| 315 | + i3GEO.janela.AGUARDEMODAL = false; | ||
| 316 | + //pega o filtro | ||
| 317 | + pini = i3GEOF.metaestat.analise.filtraPeriodo.pegaParametros("i3GEOF.filtraperiodo.Pi_0"); | ||
| 318 | + pfim = i3GEOF.metaestat.analise.filtraPeriodo.pegaParametros("i3GEOF.filtraperiodo.Pf_0"); | ||
| 319 | + // | ||
| 320 | + p = i3GEO.configura.locaplic+"/ferramentas/metaestat/analise.php?funcao=aplicaFiltroTempo" + | ||
| 321 | + "&pari="+pini[0] + | ||
| 322 | + "&vali="+pini[1] + | ||
| 323 | + "&parf="+pfim[0] + | ||
| 324 | + "&valf="+pfim[1] + | ||
| 325 | + "&tema="+$i("i3GEOF.filtraperiodo.comboCamada").value + | ||
| 326 | + "&g_sid="+i3GEO.configura.sid; | ||
| 327 | + if(pini[0].length == 0 || pini[1].length == 0){ | ||
| 328 | + i3GEO.janela.fechaAguarde("aguardeAplicaFiltro"); | ||
| 329 | + return; | ||
| 330 | + } | ||
| 331 | + i3GEO.util.ajaxGet(p,temp); | ||
| 332 | + }, | ||
| 333 | + pegaParametros:function(id){ | ||
| 334 | + var c = $i(id).getElementsByTagName("select"), | ||
| 335 | + n = c.length, | ||
| 336 | + par = [], | ||
| 337 | + val = [], | ||
| 338 | + i; | ||
| 339 | + if(!c){ | ||
| 340 | + return [par,val]; | ||
| 341 | + } | ||
| 342 | + for(i=0;i<n;i++){ | ||
| 343 | + if(c[i].name != "" && c[i].value != ""){ | ||
| 344 | + par.push(c[i].name); | ||
| 345 | + val.push(c[i].value); | ||
| 346 | + } | ||
| 347 | + } | ||
| 348 | + return [par,val]; | ||
| 349 | + } | ||
| 187 | } | 350 | } |
| 188 | }, | 351 | }, |
| 189 | classes:{ | 352 | classes:{ |
| @@ -486,14 +649,13 @@ i3GEOF.metaestat = { | @@ -486,14 +649,13 @@ i3GEOF.metaestat = { | ||
| 486 | } | 649 | } |
| 487 | }, | 650 | }, |
| 488 | editor: { | 651 | editor: { |
| 489 | - //TODO incluir botao para remover registros | ||
| 490 | inicia: function(){ | 652 | inicia: function(){ |
| 491 | YAHOO.namespace("admin.container"); | 653 | YAHOO.namespace("admin.container"); |
| 492 | if(typeof(i3GEOF.metaestat.dicionario1) === 'undefined'){ | 654 | if(typeof(i3GEOF.metaestat.dicionario1) === 'undefined'){ |
| 493 | i3GEO.util.scriptTag( | 655 | i3GEO.util.scriptTag( |
| 494 | - i3GEO.configura.locaplic+"/ferramentas/metaestat/dicionario1.js", | ||
| 495 | - "i3GEOF.metaestat.editor.dependenciasjs0()", | ||
| 496 | - "i3GEOF.metaestat.dicionario1_script" | 656 | + i3GEO.configura.locaplic+"/ferramentas/metaestat/dicionario1.js", |
| 657 | + "i3GEOF.metaestat.editor.dependenciasjs0()", | ||
| 658 | + "i3GEOF.metaestat.dicionario1_script" | ||
| 497 | ); | 659 | ); |
| 498 | } | 660 | } |
| 499 | else{ | 661 | else{ |
ferramentas/metaestat/locregiao.js
| @@ -230,7 +230,7 @@ i3GEOF.locregiao = { | @@ -230,7 +230,7 @@ i3GEOF.locregiao = { | ||
| 230 | temp = function(){ | 230 | temp = function(){ |
| 231 | i3GEO.janela.AGUARDEMODAL = false; | 231 | i3GEO.janela.AGUARDEMODAL = false; |
| 232 | i3GEO.janela.fechaAguarde("aguardeFiltroRegiao"); | 232 | i3GEO.janela.fechaAguarde("aguardeFiltroRegiao"); |
| 233 | - i3GEO.Interface.redesenha(); | 233 | + i3GEO.Interface.atualizaMapa(); |
| 234 | }; | 234 | }; |
| 235 | if($i("i3geoLocregiaoFiltroAplicaCk").checked === true){ | 235 | if($i("i3geoLocregiaoFiltroAplicaCk").checked === true){ |
| 236 | tipo = "regiaopai"; | 236 | tipo = "regiaopai"; |
| @@ -251,7 +251,7 @@ i3GEOF.locregiao = { | @@ -251,7 +251,7 @@ i3GEOF.locregiao = { | ||
| 251 | temp = function(){ | 251 | temp = function(){ |
| 252 | i3GEO.janela.AGUARDEMODAL = false; | 252 | i3GEO.janela.AGUARDEMODAL = false; |
| 253 | i3GEO.janela.fechaAguarde("aguardeFiltroRegiao"); | 253 | i3GEO.janela.fechaAguarde("aguardeFiltroRegiao"); |
| 254 | - i3GEO.Interface.redesenha(); | 254 | + i3GEO.Interface.atualizaMapa(); |
| 255 | }; | 255 | }; |
| 256 | i3GEO.janela.AGUARDEMODAL = true; | 256 | i3GEO.janela.AGUARDEMODAL = true; |
| 257 | i3GEO.janela.abreAguarde("aguardeFiltroRegiao","Filtrando..."); | 257 | i3GEO.janela.abreAguarde("aguardeFiltroRegiao","Filtrando..."); |
1.52 KB