Commit 03629e2ecea4cd2cca9d9e1609c3e78b4e75170f

Authored by Edmar Moretti
1 parent d3b2d977

Correção nas funções de selecionar e limpar seleção na ferramenta tabela

admin/admin.db
No preview for this file type
classesphp/classe_selecao.php
... ... @@ -40,50 +40,50 @@ class Selecao
40 40 {
41 41 /*
42 42 Variavel: $mapa
43   -
  43 +
44 44 Objeto mapa
45 45 */
46 46 public $mapa;
47 47 /*
48 48 Variavel: $arquivo
49   -
  49 +
50 50 Arquivo map file
51 51 */
52 52 protected $arquivo;
53 53 /*
54 54 Variavel: $layer
55   -
  55 +
56 56 Objeto layer
57 57 */
58 58 protected $layer;
59 59 /*
60 60 Variavel: $nome
61   -
  61 +
62 62 Nome do layer
63 63 */
64 64 protected $nome;
65 65 /*
66 66 Variavel: $qyfile
67   -
  67 +
68 68 Nome do arquivo de seleção (.qy)
69 69 */
70 70 public $qyfile;
71 71 /*
72 72 Variavel: $projO
73   -
  73 +
74 74 Objeto projection original do mapa. Obtido apenas na interface Googlemaps
75 75 */
76 76 public $projO;
77 77 /*
78 78 Variavel: $v
79   -
  79 +
80 80 Versão atual do Mapserver (primeiro dígito)
81 81 */
82 82 public $v;
83 83 /*
84 84 Function: __construct
85 85  
86   -Cria um objeto Selecao
  86 +Cria um objeto Selecao
87 87  
88 88 O tipo de interface usada pelo mapa é obtido do metadata "interface". Se for a interface Googlemaps, é feita a alteração temporária da projeção do mapa.
89 89  
... ... @@ -98,10 +98,7 @@ $ext - extensão geográfica do mapa
98 98  
99 99 function __construct($map_file,$tema="",$ext="")
100 100 {
101   - if(file_exists($locaplic."/funcoes_gerais.php"))
102   - include_once($locaplic."/funcoes_gerais.php");
103   - else
104   - include_once("funcoes_gerais.php");
  101 + include_once(__DIR__."/funcoes_gerais.php");
105 102 $this->v = versao();
106 103 $this->v = $this->v["principal"];
107 104 $this->qyfile = str_replace(".map",".qy",$map_file);
... ... @@ -128,25 +125,25 @@ $ext - extensão geográfica do mapa
128 125 if($this->mapa->getmetadata("interface") == "googlemaps"){
129 126 $this->projO = $this->mapa->getProjection();
130 127 $this->mapa->setProjection("init=epsg:4618,a=6378137,b=6378137");
131   - }
  128 + }
132 129 }
133 130 /*
134 131 function: salva
135 132  
136   -Salva o mapfile atual
137   -*/
  133 +Salva o mapfile atual
  134 +*/
138 135 function salva()
139 136 {
140 137 if (connection_aborted()){exit();}
141 138 if($this->mapa->getmetadata("interface") == "googlemaps")
142   - {$this->mapa->setProjection($this->projO);}
  139 + {$this->mapa->setProjection($this->projO);}
143 140 $this->mapa->save($this->arquivo);
144 141 }
145 142 /*
146 143 function: nSel
147 144  
148   -Retorna o número de elementos selecionados
149   -*/
  145 +Retorna o número de elementos selecionados
  146 +*/
150 147 function nSel(){
151 148 return $this->layer->getNumresults();
152 149 }
... ... @@ -171,7 +168,7 @@ $ys - lista de coordenadas y separadas por virgula
171 168 {
172 169 $this->selecaoLimpa();
173 170 $tipo = "adiciona";
174   - }
  171 + }
175 172 if ($tipo == "limpa")
176 173 {return($this->selecaoLimpa());}
177 174 if ($tipo == "inverte")
... ... @@ -193,7 +190,7 @@ $ys - lista de coordenadas y separadas por virgula
193 190 $shp_atual = array();
194 191 if($this->qyfileTema != "" && file_exists($this->qyfileTema))
195 192 {$shp_atual = $this->unserializeQ($this->qyfileTema);}
196   -
  193 +
197 194 $shpi = array();
198 195 //transforma os pontos em shape
199 196 $s = ms_newShapeObj(MS_SHAPE_POLYGON);
... ... @@ -272,7 +269,7 @@ $tipo - Tipo de operação adiciona|retira|inverte|limpa|novo
272 269 $shp_atual = array();
273 270 if($this->qyfileTema != "" && file_exists($this->qyfileTema))
274 271 {$shp_atual = $this->unserializeQ($this->qyfileTema);}
275   -
  272 +
276 273 $shpi = array();
277 274 $i = $layero->index;
278 275 $selecao = "";
... ... @@ -288,7 +285,7 @@ $tipo - Tipo de operação adiciona|retira|inverte|limpa|novo
288 285 else{
289 286 $result = $layero->getResult($i);
290 287 $s = $result->shapeindex;
291   - $sh = $layero->getfeature($s,-1);
  288 + $sh = $layero->getfeature($s,-1);
292 289 }
293 290 $tiposh = $sh->type;
294 291 if ($tiposh == 2)
... ... @@ -445,7 +442,7 @@ $valor - Valor.
445 442 $shp_atual = array();
446 443 if($this->qyfileTema != "" && file_exists($this->qyfileTema))
447 444 {$shp_atual = $this->unserializeQ($this->qyfileTema);}
448   -
  445 +
449 446 $shpi = array();
450 447 if($this->layer->connectiontype == MS_POSTGIS)
451 448 {
... ... @@ -455,7 +452,7 @@ $valor - Valor.
455 452 {$this->layer->querybyattributes($item,$operador,1);}
456 453 }
457 454 else
458   - {
  455 + {
459 456 if($valor != "")
460 457 {
461 458 if(!is_numeric($valor))
... ... @@ -466,7 +463,7 @@ $valor - Valor.
466 463 else
467 464 {
468 465 $this->layer->querybyattributes($item,$operador,1);
469   - }
  466 + }
470 467 }
471 468 $res_count = $this->layer->getNumresults();
472 469 $shpi = array();
... ... @@ -483,15 +480,15 @@ $valor - Valor.
483 480 }
484 481 /*
485 482 function: selecaoAtributos2
486   -
  483 +
487 484 Seleção por atributo. Permite composição de atributos.
488   -
  485 +
489 486 parameters:
490   -
  487 +
491 488 $filtro - Expressão de seleção
492   -
  489 +
493 490 $tipo - Tipo de operação adiciona|retira|inverte|limpa|novo
494   - */
  491 + */
495 492 function selecaoAtributos2($filtro,$tipo)
496 493 {
497 494 $items = pegaItens($this->layer);
... ... @@ -499,7 +496,7 @@ $valor - Valor.
499 496 {
500 497 $this->selecaoLimpa();
501 498 $tipo = "adiciona";
502   - }
  499 + }
503 500 if ($tipo == "limpa")
504 501 {return($this->selecaoLimpa());}
505 502 if ($tipo == "inverte")
... ... @@ -519,13 +516,13 @@ $valor - Valor.
519 516 }
520 517 $this->mapa->freequery($indxlayer);
521 518 */
522   -
  519 +
523 520 $shp_atual = array();
524 521 if($this->qyfileTema != "" && file_exists($this->qyfileTema))
525 522 {$shp_atual = $this->unserializeQ($this->qyfileTema);}
526   -
  523 +
527 524 $shpi = array();
528   -
  525 +
529 526 $filtro = str_replace("|","'",$filtro);
530 527 if ($this->layer->connectiontype == MS_POSTGIS)
531 528 {
... ... @@ -567,7 +564,7 @@ $tipo - Tipo de operação adiciona|retira|inverte|limpa|novo
567 564 {
568 565 $this->selecaoLimpa();
569 566 $tipo = "adiciona";
570   - }
  567 + }
571 568 if ($tipo == "limpa")
572 569 {return ($this->selecaoLimpa());}
573 570 if ($tipo == "inverte")
... ... @@ -675,7 +672,7 @@ Inverte seleção do tema.
675 672 if (file_exists($this->qyfile))
676 673 {$this->mapa->loadquery($this->qyfile);}
677 674 $indxlayer = $this->layer->index;
678   -
  675 +
679 676 /*
680 677 $res_count = $this->layer->getNumresults();
681 678 $shp_atual = array();
... ... @@ -689,7 +686,7 @@ Inverte seleção do tema.
689 686 $shp_atual = array();
690 687 if($this->qyfileTema != "" && file_exists($this->qyfileTema))
691 688 {$shp_atual = $this->unserializeQ($this->qyfileTema);}
692   -
  689 +
693 690 $this->layer->queryByrect($this->mapa->extent);
694 691 $res_count = $this->layer->getNumresults();
695 692 $shp_todos = array();
... ... @@ -826,7 +823,7 @@ $tipo - Tipo de operação adiciona|retira|inverte|limpa|novo
826 823 {
827 824 $this->selecaoLimpa();
828 825 $tipo = "adiciona";
829   - }
  826 + }
830 827 if(!$this->layer){return "erro";}
831 828 $this->layer->set("tolerance",0);
832 829 if ($tipo == "limpa")
... ... @@ -849,7 +846,7 @@ $tipo - Tipo de operação adiciona|retira|inverte|limpa|novo
849 846 $shp_atual = array();
850 847 if($this->qyfileTema != "" && file_exists($this->qyfileTema))
851 848 {$shp_atual = $this->unserializeQ($this->qyfileTema);}
852   -
  849 +
853 850 $shpi = array();
854 851 $rect = $this->mapa->extent;
855 852 $ident = @$this->layer->queryByRect($rect);
... ... @@ -908,7 +905,7 @@ $ext - coordenadas separadas por espaços no estilo xmin ymin xmax ymax
908 905 $shp_atual = array();
909 906 if($this->qyfileTema != "" && file_exists($this->qyfileTema))
910 907 {$shp_atual = $this->unserializeQ($this->qyfileTema);}
911   -
  908 +
912 909 $shpi = array();
913 910 $temp = explode(" ",$ext);
914 911 $rect = ms_newRectObj();
... ... @@ -939,7 +936,7 @@ Deserializa um arquivo.
939 936  
940 937 Parametros:
941 938 $arquivo - arquivo que será processado
942   -*/
  939 +*/
943 940 function unserializeQ($arq)
944 941 {
945 942 $handle = fopen ($arq, "r");
... ... @@ -956,7 +953,7 @@ Parametros:
956 953 $arquivo - arquivo que será processado
957 954  
958 955 $geos - array com os dados
959   -*/
  956 +*/
960 957 function serializeQ($arq,$geos)
961 958 {
962 959 if (file_exists($arq))
... ... @@ -965,6 +962,6 @@ $geos - array com os dados
965 962 $r = serialize($geos);
966 963 fwrite($fp,$r);
967 964 fclose($fp);
968   - }
  965 + }
969 966 }
970 967 ?>
971 968 \ No newline at end of file
... ...
ferramentas/inicia.php
... ... @@ -53,4 +53,45 @@ if(!substituiCon($map_file,$postgis_mapa)){
53 53 cpjson("erro",$cp);
54 54 return;
55 55 }
  56 +function redesenhaMapa()
  57 +{
  58 + global $map_file,$tipoimagem,$cp,$postgis_mapa,$utilizacgi,$locmapserv,$interface,$mapexten;
  59 + if($tipoimagem != "nenhum" && $tipoimagem != "")
  60 + {$utilizacgi = "nao";}
  61 + if (connection_aborted()){exit();}
  62 + if($interface == "googleearth" && $mapexten != ""){
  63 + include_once(__DIR__."/../classesphp/classe_navegacao.php");
  64 + $m = new Navegacao($map_file);
  65 + $m->mudaExtensao($mapexten);
  66 + $m->salva();
  67 + }
  68 + include_once(__DIR__."/../classesphp/classe_mapa.php");
  69 + $m = New Mapa($map_file);
  70 + $par = $m->parametrosTemas();
  71 + //
  72 + //na interface googlemaps não é necessário gerar a imagem
  73 + //
  74 + $e = $m->mapa->extent;
  75 + $ext = $e->minx." ".$e->miny." ".$e->maxx." ".$e->maxy;
  76 + $res["mapimagem"] = "";
  77 + $res["mapexten"] = $ext;
  78 + $res["mapres"] = "";
  79 + $res["erro"] = "";
  80 + $res["mapscale"] = "";
  81 + $res["pixelsize"] = "";
  82 + $res["mapimagem"] = "";
  83 + $res["w"] = $m->mapa->width;
  84 + $res["h"] = $m->mapa->height;
  85 + $res["mappath"] = "";
  86 + $res["mapurl"] = "";
  87 + $res["mensagens"] = $m->pegaMensagens();
  88 + $res["tempo"] = microtime(1) - $tempo;
  89 + restauraCon($map_file,$postgis_mapa);
  90 + ob_clean();
  91 + if ($par == "")
  92 + {$retorno = "erro";}
  93 + else
  94 + {$retorno = array("variaveis"=>$res,"temas"=>$par);}
  95 + cpjson($retorno);
  96 +}
56 97 ?>
57 98 \ No newline at end of file
... ...
ferramentas/inserexy2/exec.php
... ... @@ -30,45 +30,5 @@ if (!connection_aborted()){
30 30 }
31 31 else
32 32 {exit();}
33   -function redesenhaMapa()
34   -{
35   - global $tempo,$map_file,$tipoimagem,$cp,$postgis_mapa,$utilizacgi,$locmapserv,$interface,$mapexten;
36   - if($tipoimagem != "nenhum" && $tipoimagem != "")
37   - {$utilizacgi = "nao";}
38   - if (connection_aborted()){exit();}
39   - if($interface == "googleearth" && $mapexten != ""){
40   - include_once(__DIR__."/../../classesphp/classe_navegacao.php");
41   - $m = new Navegacao($map_file);
42   - $m->mudaExtensao($mapexten);
43   - $m->salva();
44   - }
45   - include_once(__DIR__."/../../classesphp/classe_mapa.php");
46   - $m = New Mapa($map_file);
47   - $par = $m->parametrosTemas();
48   - //
49   - //na interface googlemaps não é necessário gerar a imagem
50   - //
51   - $e = $m->mapa->extent;
52   - $ext = $e->minx." ".$e->miny." ".$e->maxx." ".$e->maxy;
53   - $res["mapimagem"] = "";
54   - $res["mapexten"] = $ext;
55   - $res["mapres"] = "";
56   - $res["erro"] = "";
57   - $res["mapscale"] = "";
58   - $res["pixelsize"] = "";
59   - $res["mapimagem"] = "";
60   - $res["w"] = $m->mapa->width;
61   - $res["h"] = $m->mapa->height;
62   - $res["mappath"] = "";
63   - $res["mapurl"] = "";
64   - $res["mensagens"] = $m->pegaMensagens();
65   - $res["tempo"] = microtime(1) - $tempo;
66   - restauraCon($map_file,$postgis_mapa);
67   - ob_clean();
68   - if ($par == "")
69   - {$retorno = "erro";}
70   - else
71   - {$retorno = array("variaveis"=>$res,"temas"=>$par);}
72   - cpjson($retorno);
73   -}
  33 +
74 34 ?>
75 35 \ No newline at end of file
... ...
ferramentas/opcoes_fundo/exec.php
... ... @@ -60,45 +60,5 @@ if (!connection_aborted()){
60 60 }
61 61 else
62 62 {exit();}
63   -function redesenhaMapa()
64   -{
65   - global $tempo,$map_file,$tipoimagem,$cp,$postgis_mapa,$utilizacgi,$locmapserv,$interface,$mapexten;
66   - if($tipoimagem != "nenhum" && $tipoimagem != "")
67   - {$utilizacgi = "nao";}
68   - if (connection_aborted()){exit();}
69   - if($interface == "googleearth" && $mapexten != ""){
70   - include_once(__DIR__."/../../classesphp/classe_navegacao.php");
71   - $m = new Navegacao($map_file);
72   - $m->mudaExtensao($mapexten);
73   - $m->salva();
74   - }
75   - include_once(__DIR__."/../../classesphp/classe_mapa.php");
76   - $m = New Mapa($map_file);
77   - $par = $m->parametrosTemas();
78   - //
79   - //na interface googlemaps não é necessário gerar a imagem
80   - //
81   - $e = $m->mapa->extent;
82   - $ext = $e->minx." ".$e->miny." ".$e->maxx." ".$e->maxy;
83   - $res["mapimagem"] = "";
84   - $res["mapexten"] = $ext;
85   - $res["mapres"] = "";
86   - $res["erro"] = "";
87   - $res["mapscale"] = "";
88   - $res["pixelsize"] = "";
89   - $res["mapimagem"] = "";
90   - $res["w"] = $m->mapa->width;
91   - $res["h"] = $m->mapa->height;
92   - $res["mappath"] = "";
93   - $res["mapurl"] = "";
94   - $res["mensagens"] = $m->pegaMensagens();
95   - $res["tempo"] = microtime(1) - $tempo;
96   - restauraCon($map_file,$postgis_mapa);
97   - ob_clean();
98   - if ($par == "")
99   - {$retorno = "erro";}
100   - else
101   - {$retorno = array("variaveis"=>$res,"temas"=>$par);}
102   - cpjson($retorno);
103   -}
  63 +
104 64 ?>
105 65 \ No newline at end of file
... ...
ferramentas/selecao/exec.php
... ... @@ -38,7 +38,6 @@ Limpa a seleção existente em um tema.
38 38 $_SESSION["contadorsalva"]++;
39 39 redesenhaMapa();
40 40 break;
41   -
42 41 /*
43 42 Valor: SELECAOTEMA
44 43  
... ... @@ -195,45 +194,4 @@ function selecaoPoli($xs,$ys,$tema,$tipo)
195 194 }
196 195 return implode(",",$ok);
197 196 }
198   -function redesenhaMapa()
199   -{
200   - global $tempo,$map_file,$tipoimagem,$cp,$postgis_mapa,$utilizacgi,$locmapserv,$interface,$mapexten;
201   - if($tipoimagem != "nenhum" && $tipoimagem != "")
202   - {$utilizacgi = "nao";}
203   - if (connection_aborted()){exit();}
204   - if($interface == "googleearth" && $mapexten != ""){
205   - include_once(__DIR__."/../../classesphp/classe_navegacao.php");
206   - $m = new Navegacao($map_file);
207   - $m->mudaExtensao($mapexten);
208   - $m->salva();
209   - }
210   - include_once(__DIR__."/../../classesphp/classe_mapa.php");
211   - $m = New Mapa($map_file);
212   - $par = $m->parametrosTemas();
213   - //
214   - //na interface googlemaps não é necessário gerar a imagem
215   - //
216   - $e = $m->mapa->extent;
217   - $ext = $e->minx." ".$e->miny." ".$e->maxx." ".$e->maxy;
218   - $res["mapimagem"] = "";
219   - $res["mapexten"] = $ext;
220   - $res["mapres"] = "";
221   - $res["erro"] = "";
222   - $res["mapscale"] = "";
223   - $res["pixelsize"] = "";
224   - $res["mapimagem"] = "";
225   - $res["w"] = $m->mapa->width;
226   - $res["h"] = $m->mapa->height;
227   - $res["mappath"] = "";
228   - $res["mapurl"] = "";
229   - $res["mensagens"] = $m->pegaMensagens();
230   - $res["tempo"] = microtime(1) - $tempo;
231   - restauraCon($map_file,$postgis_mapa);
232   - ob_clean();
233   - if ($par == "")
234   - {$retorno = "erro";}
235   - else
236   - {$retorno = array("variaveis"=>$res,"temas"=>$par);}
237   - cpjson($retorno);
238   -}
239 197 ?>
240 198 \ No newline at end of file
... ...
ferramentas/tabela/index.js
... ... @@ -894,10 +894,10 @@ i3GEOF.tabela = {
894 894 p,
895 895 cp,
896 896 temp = function(retorno){
897   - if(i3GEO.Interface.ATUAL === "padrao")
898   - {i3GEO.atualiza(retorno);}
899   - i3GEO.Interface.atualizaTema(retorno,i3GEOF.tabela.tema);
900   - i3GEOF.tabela.aguarde.visibility = "hidden";
  897 + if(retorno){
  898 + i3GEO.Interface.atualizaTema(retorno,i3GEOF.tabela.tema);
  899 + i3GEOF.tabela.aguarde.visibility = "hidden";
  900 + }
901 901 };
902 902 p = i3GEO.configura.locaplic+"/ferramentas/tabela/exec.php?g_sid="+i3GEO.configura.sid+"&funcao=incluisel&tema="+i3GEOF.tabela.tema+"&ids="+lista.toString();
903 903 cp = new cpaint();
... ...