From 9bcadca290f508690cd0599194a5d66713d982a8 Mon Sep 17 00:00:00 2001 From: Edmar Moretti Date: Wed, 27 Mar 2013 19:41:17 +0000 Subject: [PATCH] Correção na opção de seleção por tema --- classesphp/classe_selecao.php | 49 ++++++++++++++++++++----------------------------- classesphp/funcoes_gerais.php | 9 +++++---- ferramentas/selecao/exec.php | 6 ++---- 3 files changed, 27 insertions(+), 37 deletions(-) diff --git a/classesphp/classe_selecao.php b/classesphp/classe_selecao.php index 33f2c4e..be027dd 100644 --- a/classesphp/classe_selecao.php +++ b/classesphp/classe_selecao.php @@ -228,53 +228,44 @@ $temao - Tema que será processado. $tipo - Tipo de operação adiciona|retira|inverte|limpa|novo */ - function selecaoTema($temao,$tipo) - { + function selecaoTema($temao,$tipo){ if(!$this->layer){return "erro";} $this->layer->set("tolerance",0); - if ($tipo == "novo") - { + if ($tipo == "novo"){ $this->selecaoLimpa(); $tipo = "adiciona"; } - if ($tipo == "limpa") - {return($this->selecaoLimpa());} - if ($tipo == "inverte") - {return($this->selecaoInverte());} + if ($tipo == "limpa"){ + return($this->selecaoLimpa()); + } + if ($tipo == "inverte"){ + return($this->selecaoInverte()); + } $layero = $this->mapa->getlayerbyname($temao); - if ($layero->type == MS_LAYER_LINE || $layero->type == 1) - {return("erro. O tema de sobreposicao nao pode ser do tipo linear.");} + if ($layero->type == MS_LAYER_LINE || $layero->type == 1){ + return("erro. O tema de sobreposicao nao pode ser do tipo linear."); + } $tipoLayer = $this->layer->type; $tipoLayero = $layero->type; $this->layer->set("template","none.htm"); $layero->set("template","none.htm"); - /* - if (file_exists($this->qyfile)) - {$this->mapa->loadquery($this->qyfile);} - */ + //if (file_exists($this->qyfile)) + //{$this->mapa->loadquery($this->qyfile);} $indxlayer = $this->layer->index; + carregaquery2($this->arquivo,$layero,$this->mapa); $res_count = $this->layer->getNumresults(); $res_counto = $layero->getNumresults(); - if ($res_counto == 0) - {return false;} - /* - $shp_atual = array(); - for ($i = 0; $i < $res_count;++$i) - { - $rc = $this->layer->getResult($i); - $shp_atual[] = $rc->shapeindex; + if ($res_counto == 0){ + return false; } - $this->mapa->freequery($indxlayer); - */ $shp_atual = array(); - if($this->qyfileTema != "" && file_exists($this->qyfileTema)) - {$shp_atual = $this->unserializeQ($this->qyfileTema);} - + if($this->qyfileTema != "" && file_exists($this->qyfileTema)){ + $shp_atual = $this->unserializeQ($this->qyfileTema); + } $shpi = array(); $i = $layero->index; $selecao = ""; - if (($selecao != "ok") && ($layero->data != "")) - { + if ($layero->data != ""){ $sopen = $layero->open(); if($sopen == MS_FAILURE){return "erro";} $res_count = $layero->getNumresults(); diff --git a/classesphp/funcoes_gerais.php b/classesphp/funcoes_gerais.php index 7660ca7..26730b1 100644 --- a/classesphp/funcoes_gerais.php +++ b/classesphp/funcoes_gerais.php @@ -2313,15 +2313,16 @@ $objmapa function carregaquery2($mapfile,&$objlayer,&$objmapa) { $qyfile = dirname($mapfile)."/".$objlayer->name.".php"; - if(file_exists($qyfile)) - { + if(file_exists($qyfile)){ $indxlayer = $objlayer->index; $handle = fopen ($qyfile, "r"); $conteudo = fread ($handle, filesize ($qyfile)); fclose ($handle); $shp = unserialize($conteudo); - foreach ($shp as $indx) - {$objmapa->querybyindex($indxlayer,-1,$indx,MS_TRUE);} + foreach ($shp as $indx){ + + $objmapa->querybyindex($indxlayer,-1,$indx,MS_TRUE); + } return "sim"; } return "nao"; diff --git a/ferramentas/selecao/exec.php b/ferramentas/selecao/exec.php index b3ffe19..451484b 100644 --- a/ferramentas/selecao/exec.php +++ b/ferramentas/selecao/exec.php @@ -47,14 +47,12 @@ Sleciona elementos de um tema com base em outro tema. */ case "SELECAOTEMA": include_once(dirname(__FILE__)."/../../classesphp/classe_selecao.php"); - copiaSeguranca($map_file); + //copiaSeguranca($map_file); $temas = explode(",",$tema); - foreach($temas as $tema) - { + foreach($temas as $tema){ $m = new Selecao($map_file,$tema); $ok[] = $m->selecaoTema($temao,$tipo); } - $retorno = implode(",",$ok); $_SESSION["contadorsalva"]++; redesenhaMapa(); break; -- libgit2 0.21.2