From 03629e2ecea4cd2cca9d9e1609c3e78b4e75170f Mon Sep 17 00:00:00 2001 From: Edmar Moretti Date: Sat, 15 Dec 2012 17:59:01 +0000 Subject: [PATCH] Correção nas funções de selecionar e limpar seleção na ferramenta tabela --- admin/admin.db | Bin 163840 -> 0 bytes classesphp/classe_selecao.php | 83 ++++++++++++++++++++++++++++++++++++++++------------------------------------------- ferramentas/inicia.php | 41 +++++++++++++++++++++++++++++++++++++++++ ferramentas/inserexy2/exec.php | 42 +----------------------------------------- ferramentas/opcoes_fundo/exec.php | 42 +----------------------------------------- ferramentas/selecao/exec.php | 42 ------------------------------------------ ferramentas/tabela/index.js | 8 ++++---- 7 files changed, 87 insertions(+), 171 deletions(-) diff --git a/admin/admin.db b/admin/admin.db index 1e00ba6..36477ca 100644 Binary files a/admin/admin.db and b/admin/admin.db differ diff --git a/classesphp/classe_selecao.php b/classesphp/classe_selecao.php index 50142f8..63807a0 100644 --- a/classesphp/classe_selecao.php +++ b/classesphp/classe_selecao.php @@ -40,50 +40,50 @@ class Selecao { /* Variavel: $mapa - + Objeto mapa */ public $mapa; /* Variavel: $arquivo - + Arquivo map file */ protected $arquivo; /* Variavel: $layer - + Objeto layer */ protected $layer; /* Variavel: $nome - + Nome do layer */ protected $nome; /* Variavel: $qyfile - + Nome do arquivo de seleção (.qy) */ public $qyfile; /* Variavel: $projO - + Objeto projection original do mapa. Obtido apenas na interface Googlemaps */ public $projO; /* Variavel: $v - + Versão atual do Mapserver (primeiro dígito) */ public $v; /* Function: __construct -Cria um objeto Selecao +Cria um objeto Selecao O tipo de interface usada pelo mapa é obtido do metadata "interface". Se for a interface Googlemaps, é feita a alteração temporária da projeção do mapa. @@ -98,10 +98,7 @@ $ext - extensão geográfica do mapa function __construct($map_file,$tema="",$ext="") { - if(file_exists($locaplic."/funcoes_gerais.php")) - include_once($locaplic."/funcoes_gerais.php"); - else - include_once("funcoes_gerais.php"); + include_once(__DIR__."/funcoes_gerais.php"); $this->v = versao(); $this->v = $this->v["principal"]; $this->qyfile = str_replace(".map",".qy",$map_file); @@ -128,25 +125,25 @@ $ext - extensão geográfica do mapa if($this->mapa->getmetadata("interface") == "googlemaps"){ $this->projO = $this->mapa->getProjection(); $this->mapa->setProjection("init=epsg:4618,a=6378137,b=6378137"); - } + } } /* function: salva -Salva o mapfile atual -*/ +Salva o mapfile atual +*/ function salva() { if (connection_aborted()){exit();} if($this->mapa->getmetadata("interface") == "googlemaps") - {$this->mapa->setProjection($this->projO);} + {$this->mapa->setProjection($this->projO);} $this->mapa->save($this->arquivo); } /* function: nSel -Retorna o número de elementos selecionados -*/ +Retorna o número de elementos selecionados +*/ function nSel(){ return $this->layer->getNumresults(); } @@ -171,7 +168,7 @@ $ys - lista de coordenadas y separadas por virgula { $this->selecaoLimpa(); $tipo = "adiciona"; - } + } if ($tipo == "limpa") {return($this->selecaoLimpa());} if ($tipo == "inverte") @@ -193,7 +190,7 @@ $ys - lista de coordenadas y separadas por virgula $shp_atual = array(); if($this->qyfileTema != "" && file_exists($this->qyfileTema)) {$shp_atual = $this->unserializeQ($this->qyfileTema);} - + $shpi = array(); //transforma os pontos em shape $s = ms_newShapeObj(MS_SHAPE_POLYGON); @@ -272,7 +269,7 @@ $tipo - Tipo de operação adiciona|retira|inverte|limpa|novo $shp_atual = array(); if($this->qyfileTema != "" && file_exists($this->qyfileTema)) {$shp_atual = $this->unserializeQ($this->qyfileTema);} - + $shpi = array(); $i = $layero->index; $selecao = ""; @@ -288,7 +285,7 @@ $tipo - Tipo de operação adiciona|retira|inverte|limpa|novo else{ $result = $layero->getResult($i); $s = $result->shapeindex; - $sh = $layero->getfeature($s,-1); + $sh = $layero->getfeature($s,-1); } $tiposh = $sh->type; if ($tiposh == 2) @@ -445,7 +442,7 @@ $valor - Valor. $shp_atual = array(); if($this->qyfileTema != "" && file_exists($this->qyfileTema)) {$shp_atual = $this->unserializeQ($this->qyfileTema);} - + $shpi = array(); if($this->layer->connectiontype == MS_POSTGIS) { @@ -455,7 +452,7 @@ $valor - Valor. {$this->layer->querybyattributes($item,$operador,1);} } else - { + { if($valor != "") { if(!is_numeric($valor)) @@ -466,7 +463,7 @@ $valor - Valor. else { $this->layer->querybyattributes($item,$operador,1); - } + } } $res_count = $this->layer->getNumresults(); $shpi = array(); @@ -483,15 +480,15 @@ $valor - Valor. } /* function: selecaoAtributos2 - + Seleção por atributo. Permite composição de atributos. - + parameters: - + $filtro - Expressão de seleção - + $tipo - Tipo de operação adiciona|retira|inverte|limpa|novo - */ + */ function selecaoAtributos2($filtro,$tipo) { $items = pegaItens($this->layer); @@ -499,7 +496,7 @@ $valor - Valor. { $this->selecaoLimpa(); $tipo = "adiciona"; - } + } if ($tipo == "limpa") {return($this->selecaoLimpa());} if ($tipo == "inverte") @@ -519,13 +516,13 @@ $valor - Valor. } $this->mapa->freequery($indxlayer); */ - + $shp_atual = array(); if($this->qyfileTema != "" && file_exists($this->qyfileTema)) {$shp_atual = $this->unserializeQ($this->qyfileTema);} - + $shpi = array(); - + $filtro = str_replace("|","'",$filtro); if ($this->layer->connectiontype == MS_POSTGIS) { @@ -567,7 +564,7 @@ $tipo - Tipo de operação adiciona|retira|inverte|limpa|novo { $this->selecaoLimpa(); $tipo = "adiciona"; - } + } if ($tipo == "limpa") {return ($this->selecaoLimpa());} if ($tipo == "inverte") @@ -675,7 +672,7 @@ Inverte seleção do tema. if (file_exists($this->qyfile)) {$this->mapa->loadquery($this->qyfile);} $indxlayer = $this->layer->index; - + /* $res_count = $this->layer->getNumresults(); $shp_atual = array(); @@ -689,7 +686,7 @@ Inverte seleção do tema. $shp_atual = array(); if($this->qyfileTema != "" && file_exists($this->qyfileTema)) {$shp_atual = $this->unserializeQ($this->qyfileTema);} - + $this->layer->queryByrect($this->mapa->extent); $res_count = $this->layer->getNumresults(); $shp_todos = array(); @@ -826,7 +823,7 @@ $tipo - Tipo de operação adiciona|retira|inverte|limpa|novo { $this->selecaoLimpa(); $tipo = "adiciona"; - } + } if(!$this->layer){return "erro";} $this->layer->set("tolerance",0); if ($tipo == "limpa") @@ -849,7 +846,7 @@ $tipo - Tipo de operação adiciona|retira|inverte|limpa|novo $shp_atual = array(); if($this->qyfileTema != "" && file_exists($this->qyfileTema)) {$shp_atual = $this->unserializeQ($this->qyfileTema);} - + $shpi = array(); $rect = $this->mapa->extent; $ident = @$this->layer->queryByRect($rect); @@ -908,7 +905,7 @@ $ext - coordenadas separadas por espaços no estilo xmin ymin xmax ymax $shp_atual = array(); if($this->qyfileTema != "" && file_exists($this->qyfileTema)) {$shp_atual = $this->unserializeQ($this->qyfileTema);} - + $shpi = array(); $temp = explode(" ",$ext); $rect = ms_newRectObj(); @@ -939,7 +936,7 @@ Deserializa um arquivo. Parametros: $arquivo - arquivo que será processado -*/ +*/ function unserializeQ($arq) { $handle = fopen ($arq, "r"); @@ -956,7 +953,7 @@ Parametros: $arquivo - arquivo que será processado $geos - array com os dados -*/ +*/ function serializeQ($arq,$geos) { if (file_exists($arq)) @@ -965,6 +962,6 @@ $geos - array com os dados $r = serialize($geos); fwrite($fp,$r); fclose($fp); - } + } } ?> \ No newline at end of file diff --git a/ferramentas/inicia.php b/ferramentas/inicia.php index 2340207..d6a7aea 100644 --- a/ferramentas/inicia.php +++ b/ferramentas/inicia.php @@ -53,4 +53,45 @@ if(!substituiCon($map_file,$postgis_mapa)){ cpjson("erro",$cp); return; } +function redesenhaMapa() +{ + global $map_file,$tipoimagem,$cp,$postgis_mapa,$utilizacgi,$locmapserv,$interface,$mapexten; + if($tipoimagem != "nenhum" && $tipoimagem != "") + {$utilizacgi = "nao";} + if (connection_aborted()){exit();} + if($interface == "googleearth" && $mapexten != ""){ + include_once(__DIR__."/../classesphp/classe_navegacao.php"); + $m = new Navegacao($map_file); + $m->mudaExtensao($mapexten); + $m->salva(); + } + include_once(__DIR__."/../classesphp/classe_mapa.php"); + $m = New Mapa($map_file); + $par = $m->parametrosTemas(); + // + //na interface googlemaps não é necessário gerar a imagem + // + $e = $m->mapa->extent; + $ext = $e->minx." ".$e->miny." ".$e->maxx." ".$e->maxy; + $res["mapimagem"] = ""; + $res["mapexten"] = $ext; + $res["mapres"] = ""; + $res["erro"] = ""; + $res["mapscale"] = ""; + $res["pixelsize"] = ""; + $res["mapimagem"] = ""; + $res["w"] = $m->mapa->width; + $res["h"] = $m->mapa->height; + $res["mappath"] = ""; + $res["mapurl"] = ""; + $res["mensagens"] = $m->pegaMensagens(); + $res["tempo"] = microtime(1) - $tempo; + restauraCon($map_file,$postgis_mapa); + ob_clean(); + if ($par == "") + {$retorno = "erro";} + else + {$retorno = array("variaveis"=>$res,"temas"=>$par);} + cpjson($retorno); +} ?> \ No newline at end of file diff --git a/ferramentas/inserexy2/exec.php b/ferramentas/inserexy2/exec.php index 4da1e57..c1ebcd0 100644 --- a/ferramentas/inserexy2/exec.php +++ b/ferramentas/inserexy2/exec.php @@ -30,45 +30,5 @@ if (!connection_aborted()){ } else {exit();} -function redesenhaMapa() -{ - global $tempo,$map_file,$tipoimagem,$cp,$postgis_mapa,$utilizacgi,$locmapserv,$interface,$mapexten; - if($tipoimagem != "nenhum" && $tipoimagem != "") - {$utilizacgi = "nao";} - if (connection_aborted()){exit();} - if($interface == "googleearth" && $mapexten != ""){ - include_once(__DIR__."/../../classesphp/classe_navegacao.php"); - $m = new Navegacao($map_file); - $m->mudaExtensao($mapexten); - $m->salva(); - } - include_once(__DIR__."/../../classesphp/classe_mapa.php"); - $m = New Mapa($map_file); - $par = $m->parametrosTemas(); - // - //na interface googlemaps não é necessário gerar a imagem - // - $e = $m->mapa->extent; - $ext = $e->minx." ".$e->miny." ".$e->maxx." ".$e->maxy; - $res["mapimagem"] = ""; - $res["mapexten"] = $ext; - $res["mapres"] = ""; - $res["erro"] = ""; - $res["mapscale"] = ""; - $res["pixelsize"] = ""; - $res["mapimagem"] = ""; - $res["w"] = $m->mapa->width; - $res["h"] = $m->mapa->height; - $res["mappath"] = ""; - $res["mapurl"] = ""; - $res["mensagens"] = $m->pegaMensagens(); - $res["tempo"] = microtime(1) - $tempo; - restauraCon($map_file,$postgis_mapa); - ob_clean(); - if ($par == "") - {$retorno = "erro";} - else - {$retorno = array("variaveis"=>$res,"temas"=>$par);} - cpjson($retorno); -} + ?> \ No newline at end of file diff --git a/ferramentas/opcoes_fundo/exec.php b/ferramentas/opcoes_fundo/exec.php index 5258b4c..c5b6ba7 100644 --- a/ferramentas/opcoes_fundo/exec.php +++ b/ferramentas/opcoes_fundo/exec.php @@ -60,45 +60,5 @@ if (!connection_aborted()){ } else {exit();} -function redesenhaMapa() -{ - global $tempo,$map_file,$tipoimagem,$cp,$postgis_mapa,$utilizacgi,$locmapserv,$interface,$mapexten; - if($tipoimagem != "nenhum" && $tipoimagem != "") - {$utilizacgi = "nao";} - if (connection_aborted()){exit();} - if($interface == "googleearth" && $mapexten != ""){ - include_once(__DIR__."/../../classesphp/classe_navegacao.php"); - $m = new Navegacao($map_file); - $m->mudaExtensao($mapexten); - $m->salva(); - } - include_once(__DIR__."/../../classesphp/classe_mapa.php"); - $m = New Mapa($map_file); - $par = $m->parametrosTemas(); - // - //na interface googlemaps não é necessário gerar a imagem - // - $e = $m->mapa->extent; - $ext = $e->minx." ".$e->miny." ".$e->maxx." ".$e->maxy; - $res["mapimagem"] = ""; - $res["mapexten"] = $ext; - $res["mapres"] = ""; - $res["erro"] = ""; - $res["mapscale"] = ""; - $res["pixelsize"] = ""; - $res["mapimagem"] = ""; - $res["w"] = $m->mapa->width; - $res["h"] = $m->mapa->height; - $res["mappath"] = ""; - $res["mapurl"] = ""; - $res["mensagens"] = $m->pegaMensagens(); - $res["tempo"] = microtime(1) - $tempo; - restauraCon($map_file,$postgis_mapa); - ob_clean(); - if ($par == "") - {$retorno = "erro";} - else - {$retorno = array("variaveis"=>$res,"temas"=>$par);} - cpjson($retorno); -} + ?> \ No newline at end of file diff --git a/ferramentas/selecao/exec.php b/ferramentas/selecao/exec.php index 2085132..98f483c 100644 --- a/ferramentas/selecao/exec.php +++ b/ferramentas/selecao/exec.php @@ -38,7 +38,6 @@ Limpa a seleção existente em um tema. $_SESSION["contadorsalva"]++; redesenhaMapa(); break; - /* Valor: SELECAOTEMA @@ -195,45 +194,4 @@ function selecaoPoli($xs,$ys,$tema,$tipo) } return implode(",",$ok); } -function redesenhaMapa() -{ - global $tempo,$map_file,$tipoimagem,$cp,$postgis_mapa,$utilizacgi,$locmapserv,$interface,$mapexten; - if($tipoimagem != "nenhum" && $tipoimagem != "") - {$utilizacgi = "nao";} - if (connection_aborted()){exit();} - if($interface == "googleearth" && $mapexten != ""){ - include_once(__DIR__."/../../classesphp/classe_navegacao.php"); - $m = new Navegacao($map_file); - $m->mudaExtensao($mapexten); - $m->salva(); - } - include_once(__DIR__."/../../classesphp/classe_mapa.php"); - $m = New Mapa($map_file); - $par = $m->parametrosTemas(); - // - //na interface googlemaps não é necessário gerar a imagem - // - $e = $m->mapa->extent; - $ext = $e->minx." ".$e->miny." ".$e->maxx." ".$e->maxy; - $res["mapimagem"] = ""; - $res["mapexten"] = $ext; - $res["mapres"] = ""; - $res["erro"] = ""; - $res["mapscale"] = ""; - $res["pixelsize"] = ""; - $res["mapimagem"] = ""; - $res["w"] = $m->mapa->width; - $res["h"] = $m->mapa->height; - $res["mappath"] = ""; - $res["mapurl"] = ""; - $res["mensagens"] = $m->pegaMensagens(); - $res["tempo"] = microtime(1) - $tempo; - restauraCon($map_file,$postgis_mapa); - ob_clean(); - if ($par == "") - {$retorno = "erro";} - else - {$retorno = array("variaveis"=>$res,"temas"=>$par);} - cpjson($retorno); -} ?> \ No newline at end of file diff --git a/ferramentas/tabela/index.js b/ferramentas/tabela/index.js index ce9c978..f24cc9b 100644 --- a/ferramentas/tabela/index.js +++ b/ferramentas/tabela/index.js @@ -894,10 +894,10 @@ i3GEOF.tabela = { p, cp, temp = function(retorno){ - if(i3GEO.Interface.ATUAL === "padrao") - {i3GEO.atualiza(retorno);} - i3GEO.Interface.atualizaTema(retorno,i3GEOF.tabela.tema); - i3GEOF.tabela.aguarde.visibility = "hidden"; + if(retorno){ + i3GEO.Interface.atualizaTema(retorno,i3GEOF.tabela.tema); + i3GEOF.tabela.aguarde.visibility = "hidden"; + } }; p = i3GEO.configura.locaplic+"/ferramentas/tabela/exec.php?g_sid="+i3GEO.configura.sid+"&funcao=incluisel&tema="+i3GEOF.tabela.tema+"&ids="+lista.toString(); cp = new cpaint(); -- libgit2 0.21.2