Commit 77dd532009adac00d424cff1525220274ec1e699
1 parent
e9b7b814
Exists in
master
and in
7 other branches
Otimização das operações de seleção com a remoção de código antigo
Showing
2 changed files
with
25 additions
and
15 deletions
Show diff stats
admin/admin.db
No preview for this file type
classesphp/classe_selecao.php
@@ -171,12 +171,10 @@ $wkt - string wkt opcional ao uso de xs e ys | @@ -171,12 +171,10 @@ $wkt - string wkt opcional ao uso de xs e ys | ||
171 | 171 | ||
172 | $buffer - buffer que ser� aplicado | 172 | $buffer - buffer que ser� aplicado |
173 | */ | 173 | */ |
174 | - function selecaoPorPoligono($tipo,$xs="",$ys="",$wkt="",$buffer=0) | ||
175 | - { | 174 | + function selecaoPorPoligono($tipo,$xs="",$ys="",$wkt="",$buffer=0){ |
176 | if(!$this->layer){return "erro";} | 175 | if(!$this->layer){return "erro";} |
177 | $this->layer->set("tolerance",0); | 176 | $this->layer->set("tolerance",0); |
178 | - if ($tipo == "novo") | ||
179 | - { | 177 | + if ($tipo == "novo"){ |
180 | $this->selecaoLimpa(); | 178 | $this->selecaoLimpa(); |
181 | $tipo = "adiciona"; | 179 | $tipo = "adiciona"; |
182 | } | 180 | } |
@@ -499,8 +497,7 @@ $valor - Valor. | @@ -499,8 +497,7 @@ $valor - Valor. | ||
499 | 497 | ||
500 | $tipo - Tipo de operação adiciona|retira|inverte|limpa|novo | 498 | $tipo - Tipo de operação adiciona|retira|inverte|limpa|novo |
501 | */ | 499 | */ |
502 | - function selecaoAtributos2($filtro,$tipo) | ||
503 | - { | 500 | + function selecaoAtributos2($filtro,$tipo){ |
504 | $items = pegaItens($this->layer); | 501 | $items = pegaItens($this->layer); |
505 | if ($tipo == "novo") | 502 | if ($tipo == "novo") |
506 | { | 503 | { |
@@ -531,23 +528,25 @@ $valor - Valor. | @@ -531,23 +528,25 @@ $valor - Valor. | ||
531 | $filtro = str_replace(")"," ",$filtro); | 528 | $filtro = str_replace(")"," ",$filtro); |
532 | } | 529 | } |
533 | $teste = $this->layer->querybyattributes($items[0],$filtro,1); | 530 | $teste = $this->layer->querybyattributes($items[0],$filtro,1); |
531 | + | ||
534 | if($teste != MS_SUCCESS){ | 532 | if($teste != MS_SUCCESS){ |
535 | - $teste = $this->layer->queryByAttributes($itens[0], mb_convert_encoding($filtro,"ISO-8859-1","UTF-8"), 1); | ||
536 | - } | 533 | + $teste = $this->layer->queryByAttributes($items[0], mb_convert_encoding($filtro,"ISO-8859-1","UTF-8"), 1); |
534 | + } | ||
537 | if($teste != MS_SUCCESS){ | 535 | if($teste != MS_SUCCESS){ |
538 | - $teste = $this->layer->queryByAttributes($itens[0], mb_convert_encoding($filtro,"UTF-8","ISO-8859-1"), 1); | 536 | + $teste = $this->layer->queryByAttributes($items[0], mb_convert_encoding($filtro,"UTF-8","ISO-8859-1"), 1); |
539 | } | 537 | } |
540 | $res_count = $this->layer->getNumresults(); | 538 | $res_count = $this->layer->getNumresults(); |
541 | $shpi = array(); | 539 | $shpi = array(); |
542 | - for ($i = 0; $i < $res_count; ++$i) | ||
543 | - { | 540 | + for ($i = 0; $i < $res_count; ++$i){ |
544 | $result = $this->layer->getResult($i); | 541 | $result = $this->layer->getResult($i); |
545 | $shpi[] = $result->shapeindex; | 542 | $shpi[] = $result->shapeindex; |
546 | } | 543 | } |
547 | - if ($tipo == "adiciona") | ||
548 | - {return($this->selecaoAdiciona($shpi,$shp_atual));} | ||
549 | - if ($tipo == "retira") | ||
550 | - {return($this->selecaoRetira($shpi,$shp_atual));} | 544 | + if ($tipo == "adiciona"){ |
545 | + return($this->selecaoAdiciona($shpi,$shp_atual)); | ||
546 | + } | ||
547 | + if ($tipo == "retira"){ | ||
548 | + return($this->selecaoRetira($shpi,$shp_atual)); | ||
549 | + } | ||
551 | return("ok"); | 550 | return("ok"); |
552 | } | 551 | } |
553 | /* | 552 | /* |
@@ -686,6 +685,17 @@ Inverte sele&ccedil;&atilde;o do tema. | @@ -686,6 +685,17 @@ Inverte sele&ccedil;&atilde;o do tema. | ||
686 | if($this->qyfileTema != "" && file_exists($this->qyfileTema)){ | 685 | if($this->qyfileTema != "" && file_exists($this->qyfileTema)){ |
687 | $shp_atual = $this->unserializeQ($this->qyfileTema); | 686 | $shp_atual = $this->unserializeQ($this->qyfileTema); |
688 | } | 687 | } |
688 | + //TODO utilizar atributos qd for postgis para melhorar a performance | ||
689 | + /* | ||
690 | + if($this->layer->connectiontype == MS_POSTGIS){ | ||
691 | + $items = pegaItens($this->layer); | ||
692 | + $this->layer->querybyattributes($items[0],$items[0].' > 0 ',1); | ||
693 | + echo $this->layer->getNumresults();exit; | ||
694 | + } | ||
695 | + else { | ||
696 | + $this->layer->queryByrect($this->mapa->extent); | ||
697 | + } | ||
698 | + */ | ||
689 | $this->layer->queryByrect($this->mapa->extent); | 699 | $this->layer->queryByrect($this->mapa->extent); |
690 | $res_count = $this->layer->getNumresults(); | 700 | $res_count = $this->layer->getNumresults(); |
691 | $shp_todos = array(); | 701 | $shp_todos = array(); |