Commit 9bcadca290f508690cd0599194a5d66713d982a8

Authored by Edmar Moretti
1 parent 5a681e41

Correção na opção de seleção por tema

classesphp/classe_selecao.php
... ... @@ -228,53 +228,44 @@ $temao - Tema que será processado.
228 228  
229 229 $tipo - Tipo de operação adiciona|retira|inverte|limpa|novo
230 230 */
231   - function selecaoTema($temao,$tipo)
232   - {
  231 + function selecaoTema($temao,$tipo){
233 232 if(!$this->layer){return "erro";}
234 233 $this->layer->set("tolerance",0);
235   - if ($tipo == "novo")
236   - {
  234 + if ($tipo == "novo"){
237 235 $this->selecaoLimpa();
238 236 $tipo = "adiciona";
239 237 }
240   - if ($tipo == "limpa")
241   - {return($this->selecaoLimpa());}
242   - if ($tipo == "inverte")
243   - {return($this->selecaoInverte());}
  238 + if ($tipo == "limpa"){
  239 + return($this->selecaoLimpa());
  240 + }
  241 + if ($tipo == "inverte"){
  242 + return($this->selecaoInverte());
  243 + }
244 244 $layero = $this->mapa->getlayerbyname($temao);
245   - if ($layero->type == MS_LAYER_LINE || $layero->type == 1)
246   - {return("erro. O tema de sobreposicao nao pode ser do tipo linear.");}
  245 + if ($layero->type == MS_LAYER_LINE || $layero->type == 1){
  246 + return("erro. O tema de sobreposicao nao pode ser do tipo linear.");
  247 + }
247 248 $tipoLayer = $this->layer->type;
248 249 $tipoLayero = $layero->type;
249 250 $this->layer->set("template","none.htm");
250 251 $layero->set("template","none.htm");
251   - /*
252   - if (file_exists($this->qyfile))
253   - {$this->mapa->loadquery($this->qyfile);}
254   - */
  252 + //if (file_exists($this->qyfile))
  253 + //{$this->mapa->loadquery($this->qyfile);}
255 254 $indxlayer = $this->layer->index;
  255 + carregaquery2($this->arquivo,$layero,$this->mapa);
256 256 $res_count = $this->layer->getNumresults();
257 257 $res_counto = $layero->getNumresults();
258   - if ($res_counto == 0)
259   - {return false;}
260   - /*
261   - $shp_atual = array();
262   - for ($i = 0; $i < $res_count;++$i)
263   - {
264   - $rc = $this->layer->getResult($i);
265   - $shp_atual[] = $rc->shapeindex;
  258 + if ($res_counto == 0){
  259 + return false;
266 260 }
267   - $this->mapa->freequery($indxlayer);
268   - */
269 261 $shp_atual = array();
270   - if($this->qyfileTema != "" && file_exists($this->qyfileTema))
271   - {$shp_atual = $this->unserializeQ($this->qyfileTema);}
272   -
  262 + if($this->qyfileTema != "" && file_exists($this->qyfileTema)){
  263 + $shp_atual = $this->unserializeQ($this->qyfileTema);
  264 + }
273 265 $shpi = array();
274 266 $i = $layero->index;
275 267 $selecao = "";
276   - if (($selecao != "ok") && ($layero->data != ""))
277   - {
  268 + if ($layero->data != ""){
278 269 $sopen = $layero->open();
279 270 if($sopen == MS_FAILURE){return "erro";}
280 271 $res_count = $layero->getNumresults();
... ...
classesphp/funcoes_gerais.php
... ... @@ -2313,15 +2313,16 @@ $objmapa
2313 2313 function carregaquery2($mapfile,&$objlayer,&$objmapa)
2314 2314 {
2315 2315 $qyfile = dirname($mapfile)."/".$objlayer->name.".php";
2316   - if(file_exists($qyfile))
2317   - {
  2316 + if(file_exists($qyfile)){
2318 2317 $indxlayer = $objlayer->index;
2319 2318 $handle = fopen ($qyfile, "r");
2320 2319 $conteudo = fread ($handle, filesize ($qyfile));
2321 2320 fclose ($handle);
2322 2321 $shp = unserialize($conteudo);
2323   - foreach ($shp as $indx)
2324   - {$objmapa->querybyindex($indxlayer,-1,$indx,MS_TRUE);}
  2322 + foreach ($shp as $indx){
  2323 +
  2324 + $objmapa->querybyindex($indxlayer,-1,$indx,MS_TRUE);
  2325 + }
2325 2326 return "sim";
2326 2327 }
2327 2328 return "nao";
... ...
ferramentas/selecao/exec.php
... ... @@ -47,14 +47,12 @@ Sleciona elementos de um tema com base em outro tema.
47 47 */
48 48 case "SELECAOTEMA":
49 49 include_once(dirname(__FILE__)."/../../classesphp/classe_selecao.php");
50   - copiaSeguranca($map_file);
  50 + //copiaSeguranca($map_file);
51 51 $temas = explode(",",$tema);
52   - foreach($temas as $tema)
53   - {
  52 + foreach($temas as $tema){
54 53 $m = new Selecao($map_file,$tema);
55 54 $ok[] = $m->selecaoTema($temao,$tipo);
56 55 }
57   - $retorno = implode(",",$ok);
58 56 $_SESSION["contadorsalva"]++;
59 57 redesenhaMapa();
60 58 break;
... ...