From 970a8c13d648bdcd229c6d94edc1395ea54b961f Mon Sep 17 00:00:00 2001 From: Edmar Moretti Date: Fri, 14 Sep 2007 14:53:49 +0000 Subject: [PATCH] Incluida opção de seleção por extensão geográfica na ferramenta de seleção --- classesphp/classe_selecao.php | 46 +++++++++++++++++++++++++++++++++++++++++++++- classesphp/mapa_controle.php | 14 ++++++++++++++ ferramentas/selecao/index.htm | 4 ++++ ferramentas/selecao/index.js | 26 ++++++++++++++++++++++++++ 4 files changed, 89 insertions(+), 1 deletion(-) diff --git a/classesphp/classe_selecao.php b/classesphp/classe_selecao.php index 60c1682..cd0e7ee 100644 --- a/classesphp/classe_selecao.php +++ b/classesphp/classe_selecao.php @@ -492,7 +492,6 @@ $dir_tmp - localização do diretório temporário $this->layer->set("template","none.htm"); $this->layer->setfilter(""); $nomeshp = criaSHP($this->nome,$this->arquivo,$locaplic,$dir_tmp); - $novolayer = criaLayer($this->mapa,$this->layer->type,MS_DEFAULT,"Seleção de ".(pegaNome($this->layer))." (".$this->nome.")",$metaClasse="SIM"); $novolayer->set("data",$nomeshp.".shp"); $novolayer->set("name",basename($nomeshp)); @@ -504,5 +503,50 @@ $dir_tmp - localização do diretório temporário $novolayer->setfilter(""); return("ok"); } +/* +function: selecaoEXT + +Seleciona por extensão geográfica. + +parameters: + +$tipo - Tipo de operação adiciona|retira|inverte|limpa +*/ + function selecaoEXT($tipo) + { + if ($tipo == "limpa") + {return ($this->selecaoLimpa());} + if ($tipo == "inverte") + {return ($this->selecaoInverte());} + $this->layer->set("template","none.htm"); + if (file_exists(($this->arquivo)."qy")) + {$this->mapa->loadquery(($this->arquivo)."qy");} + $indxlayer = $this->layer->index; + $res_count = $this->layer->getNumresults(); + $shp_atual = array(); + for ($i = 0; $i < $res_count;$i++) + { + $rc = $this->layer->getResult($i); + $shp_atual[] = $rc->shapeindex; + } + $this->mapa->freequery($indxlayer); + $shpi = array(); + $rect = $this->mapa->extent; + $ident = @$this->layer->queryByRect($rect); + if ($ident != 1) + { + $res_count = $this->layer->getNumresults(); + $shpi = array(); + for ($i = 0; $i < $res_count; $i++) + { + $result = $this->layer->getResult($i); + $shpi[] = $result->shapeindex; + } + } + if ($tipo == "adiciona") + {return($this->selecaoAdiciona($shpi,$shp_atual));} + if ($tipo == "retira") + {return($this->selecaoRetira($shpi,$shp_atual));} + } } ?> \ No newline at end of file diff --git a/classesphp/mapa_controle.php b/classesphp/mapa_controle.php index 7e3b5f7..b301900 100644 --- a/classesphp/mapa_controle.php +++ b/classesphp/mapa_controle.php @@ -1791,6 +1791,20 @@ Include: $cp->set_data($m->selecaoPT($xy,$tipo)); break; /* +Property: selecaoext + +Seleciona elementos utilizando a extensão do mapa. + +Include: + +*/ + case "selecaoext": + include("classe_selecao.php"); + $m = new Selecao($map_file,$tema); + $cp->set_data($m->selecaoEXT($tipo)); + break; + +/* Property: selecaoatrib Seleciona elementos com base nos atributos. diff --git a/ferramentas/selecao/index.htm b/ferramentas/selecao/index.htm index 18b6592..0fc8375 100644 --- a/ferramentas/selecao/index.htm +++ b/ferramentas/selecao/index.htm @@ -13,6 +13,10 @@
 Por tema 
+
+ + +
Tema:
diff --git a/ferramentas/selecao/index.js b/ferramentas/selecao/index.js index a54076f..76d7b2a 100644 --- a/ferramentas/selecao/index.js +++ b/ferramentas/selecao/index.js @@ -62,6 +62,30 @@ combot += "" combot += "" $i("operacao").innerHTML = combot +//botoes de tipo +function tiposel(obj) +{ + if ($i("comboTemas").value == ""){alert("Escolha um tema");return;} + var mudaicone = function() + { + $i("selecaopt").style.border = "1px solid black" + $i("selecaoext").style.border = "1px solid black" + obj.style.border = "1px solid white" + } + if (obj.id == "selecaoext") + { + if (window.parent.objmapa.scale > 500000) + {alert("A escala do mapa deve ser pelo menos 1:500.000");return;} + aguarde("block") + var p = g_locaplic+"/classesphp/mapa_controle.php?g_sid="+g_sid+"&funcao=selecaoext&tema="+$i("comboTemas").value+"&tipo="+$i("tipoOperacao").value + var cp = new cpaint(); + //cp.set_debug(2) + cp.set_response_type("JSON"); + cp.call(p,"selecaoEXT",window.parent.ajaxredesenha); + } + +} + //cria combo com os temas comboTemasLigados("comboTemas",function(retorno) { @@ -135,6 +159,7 @@ function adicionalinha() //executa o tipo de operacao selecionada se for o caso function operacao(tipo) { + if ($i("comboTemas").value == ""){alert("Escolha um tema");return;} if((tipo.value == "limpa") || (tipo.value == "inverte")) { aguarde("block") @@ -150,6 +175,7 @@ function operacao(tipo) //aplica a selecao por atributo function aplicaselecao() { + if ($i("comboTemas").value == ""){alert("Escolha um tema");return;} aguarde("block") var g = $i("parametros") var ipt = g.getElementsByTagName("tr") -- libgit2 0.21.2