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 | 171 | |
| 172 | 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 | 175 | if(!$this->layer){return "erro";} |
| 177 | 176 | $this->layer->set("tolerance",0); |
| 178 | - if ($tipo == "novo") | |
| 179 | - { | |
| 177 | + if ($tipo == "novo"){ | |
| 180 | 178 | $this->selecaoLimpa(); |
| 181 | 179 | $tipo = "adiciona"; |
| 182 | 180 | } |
| ... | ... | @@ -499,8 +497,7 @@ $valor - Valor. |
| 499 | 497 | |
| 500 | 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 | 501 | $items = pegaItens($this->layer); |
| 505 | 502 | if ($tipo == "novo") |
| 506 | 503 | { |
| ... | ... | @@ -531,23 +528,25 @@ $valor - Valor. |
| 531 | 528 | $filtro = str_replace(")"," ",$filtro); |
| 532 | 529 | } |
| 533 | 530 | $teste = $this->layer->querybyattributes($items[0],$filtro,1); |
| 531 | + | |
| 534 | 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 | 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 | 538 | $res_count = $this->layer->getNumresults(); |
| 541 | 539 | $shpi = array(); |
| 542 | - for ($i = 0; $i < $res_count; ++$i) | |
| 543 | - { | |
| 540 | + for ($i = 0; $i < $res_count; ++$i){ | |
| 544 | 541 | $result = $this->layer->getResult($i); |
| 545 | 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 | 550 | return("ok"); |
| 552 | 551 | } |
| 553 | 552 | /* |
| ... | ... | @@ -686,6 +685,17 @@ Inverte sele&ccedil;&atilde;o do tema. |
| 686 | 685 | if($this->qyfileTema != "" && file_exists($this->qyfileTema)){ |
| 687 | 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 | 699 | $this->layer->queryByrect($this->mapa->extent); |
| 690 | 700 | $res_count = $this->layer->getNumresults(); |
| 691 | 701 | $shp_todos = array(); | ... | ... |