Commit 970a8c13d648bdcd229c6d94edc1395ea54b961f

Authored by Edmar Moretti
1 parent 89cd51af

Incluida opção de seleção por extensão geográfica na ferramenta de seleção

classesphp/classe_selecao.php
@@ -492,7 +492,6 @@ $dir_tmp - localização do diretório temporário @@ -492,7 +492,6 @@ $dir_tmp - localização do diretório temporário
492 $this->layer->set("template","none.htm"); 492 $this->layer->set("template","none.htm");
493 $this->layer->setfilter(""); 493 $this->layer->setfilter("");
494 $nomeshp = criaSHP($this->nome,$this->arquivo,$locaplic,$dir_tmp); 494 $nomeshp = criaSHP($this->nome,$this->arquivo,$locaplic,$dir_tmp);
495 -  
496 $novolayer = criaLayer($this->mapa,$this->layer->type,MS_DEFAULT,"Seleção de ".(pegaNome($this->layer))." (".$this->nome.")",$metaClasse="SIM"); 495 $novolayer = criaLayer($this->mapa,$this->layer->type,MS_DEFAULT,"Seleção de ".(pegaNome($this->layer))." (".$this->nome.")",$metaClasse="SIM");
497 $novolayer->set("data",$nomeshp.".shp"); 496 $novolayer->set("data",$nomeshp.".shp");
498 $novolayer->set("name",basename($nomeshp)); 497 $novolayer->set("name",basename($nomeshp));
@@ -504,5 +503,50 @@ $dir_tmp - localização do diretório temporário @@ -504,5 +503,50 @@ $dir_tmp - localização do diretório temporário
504 $novolayer->setfilter(""); 503 $novolayer->setfilter("");
505 return("ok"); 504 return("ok");
506 } 505 }
  506 +/*
  507 +function: selecaoEXT
  508 +
  509 +Seleciona por extensão geográfica.
  510 +
  511 +parameters:
  512 +
  513 +$tipo - Tipo de operação adiciona|retira|inverte|limpa
  514 +*/
  515 + function selecaoEXT($tipo)
  516 + {
  517 + if ($tipo == "limpa")
  518 + {return ($this->selecaoLimpa());}
  519 + if ($tipo == "inverte")
  520 + {return ($this->selecaoInverte());}
  521 + $this->layer->set("template","none.htm");
  522 + if (file_exists(($this->arquivo)."qy"))
  523 + {$this->mapa->loadquery(($this->arquivo)."qy");}
  524 + $indxlayer = $this->layer->index;
  525 + $res_count = $this->layer->getNumresults();
  526 + $shp_atual = array();
  527 + for ($i = 0; $i < $res_count;$i++)
  528 + {
  529 + $rc = $this->layer->getResult($i);
  530 + $shp_atual[] = $rc->shapeindex;
  531 + }
  532 + $this->mapa->freequery($indxlayer);
  533 + $shpi = array();
  534 + $rect = $this->mapa->extent;
  535 + $ident = @$this->layer->queryByRect($rect);
  536 + if ($ident != 1)
  537 + {
  538 + $res_count = $this->layer->getNumresults();
  539 + $shpi = array();
  540 + for ($i = 0; $i < $res_count; $i++)
  541 + {
  542 + $result = $this->layer->getResult($i);
  543 + $shpi[] = $result->shapeindex;
  544 + }
  545 + }
  546 + if ($tipo == "adiciona")
  547 + {return($this->selecaoAdiciona($shpi,$shp_atual));}
  548 + if ($tipo == "retira")
  549 + {return($this->selecaoRetira($shpi,$shp_atual));}
  550 + }
507 } 551 }
508 ?> 552 ?>
509 \ No newline at end of file 553 \ No newline at end of file
classesphp/mapa_controle.php
@@ -1791,6 +1791,20 @@ Include: @@ -1791,6 +1791,20 @@ Include:
1791 $cp->set_data($m->selecaoPT($xy,$tipo)); 1791 $cp->set_data($m->selecaoPT($xy,$tipo));
1792 break; 1792 break;
1793 /* 1793 /*
  1794 +Property: selecaoext
  1795 +
  1796 +Seleciona elementos utilizando a extensăo do mapa.
  1797 +
  1798 +Include:
  1799 +<classe_selecao.php>
  1800 +*/
  1801 + case "selecaoext":
  1802 + include("classe_selecao.php");
  1803 + $m = new Selecao($map_file,$tema);
  1804 + $cp->set_data($m->selecaoEXT($tipo));
  1805 + break;
  1806 +
  1807 +/*
1794 Property: selecaoatrib 1808 Property: selecaoatrib
1795 1809
1796 Seleciona elementos com base nos atributos. 1810 Seleciona elementos com base nos atributos.
ferramentas/selecao/index.htm
@@ -13,6 +13,10 @@ @@ -13,6 +13,10 @@
13 <div class=guia id=guia3 >&nbsp;Por tema&nbsp;</div> 13 <div class=guia id=guia3 >&nbsp;Por tema&nbsp;</div>
14 </div> 14 </div>
15 <span id=geral style=left:0px; > 15 <span id=geral style=left:0px; >
  16 + <div style=top:1px;left:0px;text-align:center;width:95%; >
  17 + <img id=selecaopt onclick="tiposel(this)" src="../../imagens/selpt.png" title="Clique no mapa para selecionar" style="cursor:pointer;border:1px solid white" />
  18 + <img id=selecaoext onclick="tiposel(this)" src="../../imagens/selext.png" title="Seleciona o que estiver visível no mapa" style="cursor:pointer;border:1px solid gray" />
  19 + </div>
16 <div id=opc1 style=top:0px;left:0px;text-align:left;width:95%; > 20 <div id=opc1 style=top:0px;left:0px;text-align:left;width:95%; >
17 Tema: 21 Tema:
18 <div id="temas" > 22 <div id="temas" >
ferramentas/selecao/index.js
@@ -62,6 +62,30 @@ combot += &quot;&lt;option value=&#39;limpa&#39; &gt;Limpa&lt;/option&gt;&quot; @@ -62,6 +62,30 @@ combot += &quot;&lt;option value=&#39;limpa&#39; &gt;Limpa&lt;/option&gt;&quot;
62 combot += "</select>" 62 combot += "</select>"
63 $i("operacao").innerHTML = combot 63 $i("operacao").innerHTML = combot
64 64
  65 +//botoes de tipo
  66 +function tiposel(obj)
  67 +{
  68 + if ($i("comboTemas").value == ""){alert("Escolha um tema");return;}
  69 + var mudaicone = function()
  70 + {
  71 + $i("selecaopt").style.border = "1px solid black"
  72 + $i("selecaoext").style.border = "1px solid black"
  73 + obj.style.border = "1px solid white"
  74 + }
  75 + if (obj.id == "selecaoext")
  76 + {
  77 + if (window.parent.objmapa.scale > 500000)
  78 + {alert("A escala do mapa deve ser pelo menos 1:500.000");return;}
  79 + aguarde("block")
  80 + var p = g_locaplic+"/classesphp/mapa_controle.php?g_sid="+g_sid+"&funcao=selecaoext&tema="+$i("comboTemas").value+"&tipo="+$i("tipoOperacao").value
  81 + var cp = new cpaint();
  82 + //cp.set_debug(2)
  83 + cp.set_response_type("JSON");
  84 + cp.call(p,"selecaoEXT",window.parent.ajaxredesenha);
  85 + }
  86 +
  87 +}
  88 +
65 //cria combo com os temas 89 //cria combo com os temas
66 comboTemasLigados("comboTemas",function(retorno) 90 comboTemasLigados("comboTemas",function(retorno)
67 { 91 {
@@ -135,6 +159,7 @@ function adicionalinha() @@ -135,6 +159,7 @@ function adicionalinha()
135 //executa o tipo de operacao selecionada se for o caso 159 //executa o tipo de operacao selecionada se for o caso
136 function operacao(tipo) 160 function operacao(tipo)
137 { 161 {
  162 + if ($i("comboTemas").value == ""){alert("Escolha um tema");return;}
138 if((tipo.value == "limpa") || (tipo.value == "inverte")) 163 if((tipo.value == "limpa") || (tipo.value == "inverte"))
139 { 164 {
140 aguarde("block") 165 aguarde("block")
@@ -150,6 +175,7 @@ function operacao(tipo) @@ -150,6 +175,7 @@ function operacao(tipo)
150 //aplica a selecao por atributo 175 //aplica a selecao por atributo
151 function aplicaselecao() 176 function aplicaselecao()
152 { 177 {
  178 + if ($i("comboTemas").value == ""){alert("Escolha um tema");return;}
153 aguarde("block") 179 aguarde("block")
154 var g = $i("parametros") 180 var g = $i("parametros")
155 var ipt = g.getElementsByTagName("tr") 181 var ipt = g.getElementsByTagName("tr")