Commit 54c560d6a4ba18ede2193fe51d62ff76616804e4

Authored by Edmar Moretti
1 parent 473cd8de

reformulação dos códigos para uso da extensão .qy nos arquivos de seleção ao inv…

…és de .mapqy. Isso foi necessário por questões de compatibilidade entre versões do Mapserver.
classesphp/classe_analise.php
... ... @@ -67,6 +67,12 @@ class Analise
67 67 Diretório do arquivo map_file
68 68 */
69 69 protected $diretorio;
  70 + /*
  71 + Variavel: $qyfile
  72 +
  73 + Nome do arquivo de seleção (.qy)
  74 + */
  75 + public $qyfile;
70 76 /*
71 77 Function: __construct
72 78  
... ... @@ -81,6 +87,7 @@ $tema - Nome do tema que será processado
81 87 function __construct($map_file,$tema="",$locaplic="")
82 88 {
83 89 //error_reporting(E_ALL);
  90 + $this->qyfile = str_replace(".map",".qy",$map_file);
84 91 if(file_exists($locaplic."/funcoes_gerais.php"))
85 92 include_once($locaplic."/funcoes_gerais.php");
86 93 else
... ... @@ -165,8 +172,8 @@ Include:
165 172 $this->mapaDeldir($nomearq,$dir_tmp,$R_path,$locaplic);
166 173 $this->deldirDir2shp($nomearq."dirsgs",$dir_tmp,$locaplic);
167 174 $this->deldirDel2shp($nomearq."delsgs",$dir_tmp,$locaplic);
168   - if(file_exists(($this->arquivo)."qy"))
169   - {unlink(($this->arquivo)."qy");}
  175 + if(file_exists($this->qyfile))
  176 + {unlink($this->qyfile);}
170 177 return "ok";
171 178 break;
172 179 case "kernel":
... ... @@ -240,8 +247,8 @@ Include:
240 247 }
241 248 else
242 249 {return("erro");}
243   - if(file_exists(($this->arquivo)."qy"))
244   - {unlink(($this->arquivo)."qy");}
  250 + if(file_exists($this->qyfile))
  251 + {unlink($this->qyfile);}
245 252 return("ok");
246 253 }
247 254 /*
... ... @@ -947,8 +954,8 @@ $locaplic - Localização do I3geo.
947 954 //pega os shapes selecionados
948 955 $itemspt = pegaItens($layerPt);
949 956 $existesel = "nao";
950   - if (file_exists(($this->arquivo)."qy"))
951   - {$this->mapa->loadquery(($this->arquivo)."qy");}
  957 + if (file_exists($this->qyfile))
  958 + {$this->mapa->loadquery($this->qyfile);}
952 959 if ($layerPt->getNumresults() > 0){$existesel = "sim";}
953 960 if ($existesel == "nao")
954 961 {
... ... @@ -1057,8 +1064,8 @@ $locaplic - Localização do I3geo.
1057 1064 $novolayer->setmetadata("ITENS"," ");
1058 1065 $novolayer->setmetadata("ITENSDESC"," ");
1059 1066 $novolayer->set("connectiontype",MS_SHAPEFILE);
1060   - if (file_exists(($this->arquivo)."qy"))
1061   - {unlink (($this->arquivo)."qy");}
  1067 + if (file_exists($this->qyfile))
  1068 + {unlink ($this->qyfile);}
1062 1069 return(implode(" ",$nomesitens));
1063 1070 }
1064 1071 /*
... ... @@ -1094,8 +1101,8 @@ function distanciaptpt($temaorigem,$temadestino,$temaoverlay,$locaplic,$itemorig
1094 1101 //define o nome do novo shapefile que será criado
1095 1102 $nomefinal = nomeRandomico();
1096 1103 $nomeshp = $this->diretorio."/".$nomefinal;
1097   - if (file_exists(($this->arquivo)."qy"))
1098   - {$this->mapa->loadquery(($this->arquivo)."qy");}
  1104 + if (file_exists($this->qyfile))
  1105 + {$this->mapa->loadquery($this->qyfile);}
1099 1106 else
1100 1107 {return "errox";}
1101 1108 $layerorigem = $this->mapa->getlayerbyname($temaorigem);
... ... @@ -1183,8 +1190,8 @@ function distanciaptpt($temaorigem,$temadestino,$temaoverlay,$locaplic,$itemorig
1183 1190 $cor = $estilo->color;
1184 1191 $cor->setrgb(255,210,0);
1185 1192 //limpa selecao
1186   - if (file_exists(($this->arquivo)."qy"))
1187   - {unlink (($this->arquivo)."qy");}
  1193 + if (file_exists($this->qyfile))
  1194 + {unlink ($this->qyfile);}
1188 1195 return($nomeshp.".shp");
1189 1196 }
1190 1197 /*
... ... @@ -1218,8 +1225,8 @@ nome do layer criado com o buffer.
1218 1225 $nomebuffer = nomeRandomico();
1219 1226 $nomeshp = $this->diretorio."/".$nomebuffer;
1220 1227 //pega os shapes selecionados
1221   - if (file_exists(($this->arquivo)."qy"))
1222   - {$this->mapa->loadquery(($this->arquivo)."qy");}
  1228 + if (file_exists($this->qyfile))
  1229 + {$this->mapa->loadquery($this->qyfile);}
1223 1230 $sopen = $this->layer->open();
1224 1231 if($sopen == MS_FAILURE){return "erro";}
1225 1232 $items = pegaItens($this->layer);
... ... @@ -1330,8 +1337,8 @@ $locaplic - Localização do I3geo.
1330 1337 $nomeCentroides = nomeRandomico();
1331 1338 $nomeshp = $this->diretorio."/".$nomeCentroides;
1332 1339 //pega os shapes selecionados
1333   - if (file_exists(($this->arquivo)."qy"))
1334   - {$this->mapa->loadquery(($this->arquivo)."qy");}
  1340 + if (file_exists($this->qyfile))
  1341 + {$this->mapa->loadquery($this->qyfile);}
1335 1342 $sopen = $this->layer->open();
1336 1343 if($sopen == MS_FAILURE){return "erro";}
1337 1344 $items = pegaItens($this->layer);
... ... @@ -1389,8 +1396,8 @@ $locaplic - Localização do I3geo.
1389 1396 $novolayer->set("template","none.htm");
1390 1397 $novolayer->setmetadata("TEMALOCAL","SIM");
1391 1398 //limpa selecao
1392   - if (file_exists(($this->arquivo)."qy"))
1393   - {unlink (($this->arquivo)."qy");}
  1399 + if (file_exists($this->qyfile))
  1400 + {unlink ($this->qyfile);}
1394 1401 return("ok");
1395 1402 }
1396 1403 /*
... ... @@ -1503,8 +1510,8 @@ $npty - Número de pontos em Y (opcional)
1503 1510 $novolayer->set("data",$nomeshp.".shp");
1504 1511 $novolayer->setmetadata("DOWNLOAD","SIM");
1505 1512 $novolayer->setmetadata("TEMALOCAL","SIM");
1506   - if (file_exists(($this->arquivo)."qy"))
1507   - {unlink (($this->arquivo)."qy");}
  1513 + if (file_exists($this->qyfile))
  1514 + {unlink ($this->qyfile);}
1508 1515 return("ok");
1509 1516 }
1510 1517 /*
... ... @@ -1646,8 +1653,8 @@ $npty - Número de pontos em Y (opcional)
1646 1653 $novolayer->setmetadata("DOWNLOAD","SIM");
1647 1654 $novolayer->setmetadata("TEMALOCAL","SIM");
1648 1655 $novolayer->set("opacity","50");
1649   - if (file_exists(($this->arquivo)."qy"))
1650   - {unlink (($this->arquivo)."qy");}
  1656 + if (file_exists($this->qyfile))
  1657 + {unlink ($this->qyfile);}
1651 1658 return("ok");
1652 1659 }
1653 1660 /*
... ... @@ -1799,8 +1806,8 @@ $npty - Número de pontos em Y (opcional)
1799 1806 $novolayer->setmetadata("DOWNLOAD","SIM");
1800 1807 $novolayer->setmetadata("TEMALOCAL","SIM");
1801 1808 $novolayer->set("opacity","50");
1802   - if (file_exists(($this->arquivo)."qy"))
1803   - {unlink (($this->arquivo)."qy");}
  1809 + if (file_exists($this->qyfile))
  1810 + {unlink ($this->qyfile);}
1804 1811 return("ok");
1805 1812 }
1806 1813 /*
... ... @@ -1868,8 +1875,8 @@ $locaplic - Localização do I3geo
1868 1875 $novolayer->setmetadata("DOWNLOAD","SIM");
1869 1876 $novolayer->setmetadata("TEMALOCAL","SIM");
1870 1877 $novolayer->set("opacity","80");
1871   - if (file_exists(($this->arquivo)."qy"))
1872   - {unlink (($this->arquivo)."qy");}
  1878 + if (file_exists($this->qyfile))
  1879 + {unlink ($this->qyfile);}
1873 1880 return("ok");
1874 1881 }
1875 1882 /*
... ... @@ -1890,8 +1897,8 @@ Salva o mapa acrescentando um novo layer com o resultado.
1890 1897 else
1891 1898 include_once "../pacotes/phpxbase/api_conversion.php";
1892 1899 //define o nome do novo shapefile que será criado
1893   - if (file_exists(($this->arquivo)."qy"))
1894   - {$this->mapa->loadquery(($this->arquivo)."qy");}
  1900 + if (file_exists($this->qyfile))
  1901 + {$this->mapa->loadquery($this->qyfile);}
1895 1902 $sopen = $this->layer->open();
1896 1903 if($sopen == MS_FAILURE){return "erro";}
1897 1904 $res_count = $this->layer->getNumresults();
... ... @@ -1982,8 +1989,8 @@ Salva o mapa acrescentando um novo layer com o resultado.
1982 1989 $novolayer->set("data",$nomeshp.".shp");
1983 1990 $novolayer->setmetadata("DOWNLOAD","SIM");
1984 1991 $novolayer->setmetadata("TEMALOCAL","SIM");
1985   - if (file_exists(($this->arquivo)."qy"))
1986   - {unlink (($this->arquivo)."qy");}
  1992 + if (file_exists($this->qyfile))
  1993 + {unlink ($this->qyfile);}
1987 1994  
1988 1995 return("ok");
1989 1996 }
... ... @@ -2010,8 +2017,8 @@ $locaplic - Localização do I3geo
2010 2017 else
2011 2018 include_once "../pacotes/phpxbase/api_conversion.php";
2012 2019 //define o nome do novo shapefile que será criado
2013   - if (file_exists(($this->arquivo)."qy"))
2014   - {$this->mapa->loadquery(($this->arquivo)."qy");}
  2020 + if (file_exists($this->qyfile))
  2021 + {$this->mapa->loadquery($this->qyfile);}
2015 2022 $sopen = $this->layer->open();
2016 2023 if($sopen == MS_FAILURE){return "erro";}
2017 2024 $res_count = $this->layer->getNumresults();
... ... @@ -2091,8 +2098,8 @@ $locaplic - Localização do I3geo
2091 2098 $novolayer->set("data",$nomeshp.".shp");
2092 2099 $novolayer->setmetadata("DOWNLOAD","SIM");
2093 2100 $novolayer->setmetadata("TEMALOCAL","SIM");
2094   - if (file_exists(($this->arquivo)."qy"))
2095   - {unlink (($this->arquivo)."qy");}
  2101 + if (file_exists($this->qyfile))
  2102 + {unlink ($this->qyfile);}
2096 2103  
2097 2104 return("ok");
2098 2105 }
... ... @@ -2405,8 +2412,8 @@ function gravaCoordenadasPt($tema,$limitepontos="TRUE",$extendelimite)
2405 2412 $nomearq = $this->diretorio."/".$nomefinal;
2406 2413 $itemspt = pegaItens($layerPt);
2407 2414 $existesel = "nao";
2408   - if (file_exists(($this->arquivo)."qy"))
2409   - {$this->mapa->loadquery(($this->arquivo)."qy");}
  2415 + if (file_exists($this->qyfile))
  2416 + {$this->mapa->loadquery($this->qyfile);}
2410 2417 if ($layerPt->getNumresults() > 0){$existesel = "sim";}
2411 2418 if ($existesel == "nao")
2412 2419 {$layerPt->queryByrect($this->mapa->extent);}
... ...
classesphp/classe_atributos.php
... ... @@ -63,6 +63,12 @@ class Atributos
63 63 Nome do layer
64 64 */
65 65 protected $nome;
  66 + /*
  67 + Variavel: $qyfile
  68 +
  69 + Nome do arquivo de seleção (.qy)
  70 + */
  71 + public $qyfile;
66 72 /*
67 73 Function: __construct
68 74  
... ... @@ -77,6 +83,7 @@ $tema - nome do tema
77 83 function __construct($map_file,$tema="",$locaplic="")
78 84 {
79 85 //error_reporting(E_ALL);
  86 + $this->qyfile = str_replace(".map",".qy",$map_file);
80 87 $this->locaplic = $locaplic;
81 88 $this->mapa = ms_newMapObj($map_file);
82 89 $this->arquivo = $map_file;
... ... @@ -214,8 +221,8 @@ $tipo - Tipo de busca brasil|null
214 221 //le o arquivo de query se existir e checa se existe seleção para o tema
215 222 $items = pegaItens($this->layer);
216 223 $existesel = "nao";
217   - if (file_exists($this->arquivo."qy"))
218   - {$this->mapa->loadquery(($this->arquivo)."qy");}
  224 + if (file_exists($this->qyfile))
  225 + {$this->mapa->loadquery($this->qyfile);}
219 226 if ($this->layer->getNumresults() > 0){$existesel = "sim";}
220 227 if ($existesel == "nao")
221 228 {$this->layer->querybyrect($this->mapa->extent);}
... ... @@ -281,8 +288,8 @@ $tipolista - Indica se serão mostrados todos os registros ou apenas os seleciona
281 288 else
282 289 {$items[] = $itemtema;}
283 290 $resultadoFinal[] = array("itens"=>$items);
284   - if (file_exists($this->arquivo."qy"))
285   - {$this->mapa->loadquery(($this->arquivo)."qy");}
  291 + if (file_exists($this->qyfile))
  292 + {$this->mapa->loadquery($this->qyfile);}
286 293 $indxlayer = $this->layer->index;
287 294 $sopen = $this->layer->open();
288 295 if($sopen == MS_FAILURE){return "erro";}
... ... @@ -485,8 +492,8 @@ Include:
485 492 if ($filtro != ""){$this->layer->setfilter("");}
486 493 //le o arquivo de query se existir e checa se existe seleção para o tema
487 494 $existesel = "nao";
488   - if (file_exists(($this->arquivo)."qy"))
489   - {$this->mapa->loadquery(($this->arquivo)."qy");}
  495 + if (file_exists($this->qyfile))
  496 + {$this->mapa->loadquery($this->qyfile);}
490 497 if ($this->layer->getNumresults() > 0){$existesel = "sim";}
491 498 if ($existesel == "nao")
492 499 {$this->layer->queryByrect($this->mapa->extent);}
... ...
classesphp/classe_mapa.php
... ... @@ -53,6 +53,12 @@ class Mapa
53 53 Objetos layers
54 54 */
55 55 public $layers;
  56 + /*
  57 + Variavel: $qyfile
  58 +
  59 + Nome do arquivo de seleção (.qy)
  60 + */
  61 + public $qyfile;
56 62  
57 63 /*
58 64 Function: __construct
... ... @@ -71,6 +77,7 @@ $map_file - Endereço do mapfile no servidor.
71 77 include_once($locaplic."/funcoes_gerais.php");
72 78 else
73 79 include_once("funcoes_gerais.php");
  80 + $this->qyfile = str_replace(".map",".qy",$map_file);
74 81 $this->locaplic = $locaplic;
75 82 if(!file_exists($map_file))
76 83 {return $this->arquivo = false;}
... ... @@ -140,9 +147,9 @@ string - javascript com os parametros
140 147 function parametrosTemas()
141 148 {
142 149 $existesel = false;
143   - $qy = file_exists(($this->arquivo)."qy");
  150 + $qy = file_exists($this->qyfile);
144 151 if ($qy)
145   - {$this->mapa->loadquery(($this->arquivo)."qy");}
  152 + {$this->mapa->loadquery($this->qyfile);}
146 153 foreach ($this->layers as $oLayer)
147 154 {
148 155 $sel = "nao";
... ... @@ -218,7 +225,7 @@ string - javascript com os parametros
218 225 }
219 226 //apaga o arquivo qy se não for necessário
220 227 if (!$existesel && $qy)
221   - {unlink(($this->arquivo)."qy");}
  228 + {unlink($this->qyfile);}
222 229 $temas = array_reverse($temas);
223 230 return $temas;
224 231 }
... ... @@ -247,7 +254,7 @@ Include:
247 254 else
248 255 include_once("classe_imagem.php");
249 256 $nomer = "";
250   - $qy = file_exists(($this->arquivo)."qy");
  257 + $qy = file_exists($this->qyfile);
251 258 $legenda = $this->mapa->legend;
252 259 //
253 260 //prepara a legenda para incluir no mapa, preenchendo os nomes das classes que podem estar em branco
... ... @@ -529,8 +536,8 @@ nome
529 536 */
530 537 function listaTemasTipo($tipo,$selecao="nao")
531 538 {
532   - if (($selecao=="sim") && (file_exists(($this->arquivo)."qy")))
533   - {$this->mapa->loadquery(($this->arquivo)."qy");}
  539 + if (($selecao=="sim") && (file_exists($this->qyfile)))
  540 + {$this->mapa->loadquery($this->qyfile);}
534 541 $layers = array();
535 542 foreach($this->layers as $layer)
536 543 {
... ... @@ -585,14 +592,14 @@ nome
585 592 {
586 593 $layers = array();
587 594 $final = array();
588   - if (file_exists(($this->arquivo)."qy"))
  595 + if (file_exists($this->qyfile))
589 596 {
590 597 foreach($this->layers as $layer)
591 598 {
592 599 if ($layer->getmetadata("ESCONDIDO") == "")
593 600 {$layers[] = $layer;}
594 601 }
595   - $this->mapa->loadquery(($this->arquivo)."qy");
  602 + $this->mapa->loadquery($this->qyfile);
596 603 foreach ($layers as $layer)
597 604 {
598 605 //verifica se o tema tem selecao
... ... @@ -732,8 +739,8 @@ $incluitexto - sim|nao
732 739 function gradeCoord($intervalo,$corlinha="200,200,200",$larguralinha=1,$tipolinha="linha",$tamanhotexto=MS_TINY,$fonte="bitmap",$cortexto="0,0,0",$incluitexto="sim",$mascara="-1,-1,-1",$shadowcolor="-1,-1,-1",$shadowsizex=0,$shadowsizey=0)
733 740 {
734 741 //echo $corlinha;
735   - if (file_exists(($this->arquivo)."qy"))
736   - {unlink (($this->arquivo)."qy");}
  742 + if (file_exists($this->qyfile))
  743 + {unlink ($this->qyfile);}
737 744 $nlayer = criaLayer($this->mapa,MS_LAYER_LINE,MS_DEFAULT,"Grade de coordenadas","SIM");
738 745 ms_newgridobj($nlayer);
739 746 $nlayer->grid->set("labelformat", "DDMMSS");
... ... @@ -815,8 +822,8 @@ $random - indica se os nomes dos novos layers serão modificados ou nao
815 822 function adicionaTema($temas,$locaplic,$random="sim")
816 823 {
817 824 //limpa selecao
818   - if (file_exists(($this->arquivo)."qy"))
819   - {unlink (($this->arquivo)."qy");}
  825 + if (file_exists($this->qyfile))
  826 + {unlink ($this->qyfile);}
820 827 $temas = explode(",",$temas);
821 828 $zoomlayer = "";
822 829 foreach ($temas as $nome)
... ... @@ -939,8 +946,8 @@ $temas - lista separada por vírgula dos temas que serão excluídos.
939 946 */
940 947 function excluiTemas($temas)
941 948 {
942   - if (file_exists(($this->arquivo)."qy"))
943   - {unlink(($this->arquivo)."qy");}
  949 + if (file_exists($this->qyfile))
  950 + {unlink($this->qyfile);}
944 951 $temas = explode(",",$temas);
945 952 foreach ($temas as $nome)
946 953 {
... ... @@ -1091,8 +1098,8 @@ Include:
1091 1098 else
1092 1099 include_once("wmswfs.php");
1093 1100 //limpa selecao
1094   - if (file_exists(($this->arquivo)."qy"))
1095   - {unlink (($this->arquivo)."qy");}
  1101 + if (file_exists($this->qyfile))
  1102 + {unlink ($this->qyfile);}
1096 1103 $nmap = ms_newMapObj($locaplic."/aplicmap/novotema.map");
1097 1104 $layer = $nmap->getlayerbyname("novotema");
1098 1105 //$layer->set("name",nomeRandomico());
... ...
classesphp/classe_selecao.php
... ... @@ -62,6 +62,12 @@ class Selecao
62 62 Nome do layer
63 63 */
64 64 protected $nome;
  65 + /*
  66 + Variavel: $qyfile
  67 +
  68 + Nome do arquivo de seleção (.qy)
  69 + */
  70 + public $qyfile;
65 71 /*
66 72 Function: __construct
67 73  
... ... @@ -77,6 +83,7 @@ $tema - nome do tema
77 83 function __construct($map_file,$tema="")
78 84 {
79 85 //error_reporting(E_ALL);
  86 + $this->qyfile = str_replace(".map",".qy",$map_file);
80 87 $this->mapa = ms_newMapObj($map_file);
81 88 $this->arquivo = $map_file;
82 89 if($tema != "" && @$this->mapa->getlayerbyname($tema))
... ... @@ -116,8 +123,8 @@ $ys - lista de coordenadas y separadas por virgula
116 123 {return($this->selecaoInverte());}
117 124 $tipoLayer = $this->layer->type;
118 125 $this->layer->set("template","none.htm");
119   - if (file_exists(($this->arquivo)."qy"))
120   - {$this->mapa->loadquery(($this->arquivo)."qy");}
  126 + if (file_exists($this->qyfile))
  127 + {$this->mapa->loadquery($this->qyfile);}
121 128 $indxlayer = $this->layer->index;
122 129 $res_count = $this->layer->getNumresults();
123 130 $shp_atual = array();
... ... @@ -178,8 +185,8 @@ $tipo - Tipo de operação adiciona|retira|inverte|limpa
178 185 $tipoLayero = $layero->type;
179 186 $this->layer->set("template","none.htm");
180 187 $layero->set("template","none.htm");
181   - if (file_exists(($this->arquivo)."qy"))
182   - {$this->mapa->loadquery(($this->arquivo)."qy");}
  188 + if (file_exists($this->qyfile))
  189 + {$this->mapa->loadquery($this->qyfile);}
183 190 $indxlayer = $this->layer->index;
184 191 $res_count = $this->layer->getNumresults();
185 192 $res_counto = $layero->getNumresults();
... ... @@ -338,8 +345,8 @@ $valor - Valor.
338 345 }
339 346 $this->layer->set("template","none.htm");
340 347 $indxlayer = $this->layer->index;
341   - if (file_exists(($this->arquivo)."qy"))
342   - {$this->mapa->loadquery(($this->arquivo)."qy");}
  348 + if (file_exists($this->qyfile))
  349 + {$this->mapa->loadquery($this->qyfile);}
343 350 $res_count = $this->layer->getNumresults();
344 351 $shp_atual = array();
345 352 for ($i = 0; $i < $res_count;++$i)
... ... @@ -403,8 +410,8 @@ $valor - Valor.
403 410 if(!$this->layer){return "erro";}
404 411 $this->layer->set("template","none.htm");
405 412 $indxlayer = $this->layer->index;
406   - if (file_exists(($this->arquivo)."qy"))
407   - {$this->mapa->loadquery(($this->arquivo)."qy");}
  413 + if (file_exists($this->qyfile))
  414 + {$this->mapa->loadquery($this->qyfile);}
408 415 $res_count = $this->layer->getNumresults();
409 416 $shp_atual = array();
410 417 for ($i = 0; $i < $res_count;++$i)
... ... @@ -458,8 +465,8 @@ $tipo - Tipo de operação adiciona|retira|inverte|limpa
458 465 {return ($this->selecaoInverte());}
459 466 if(!$this->layer){return "erro";}
460 467 $this->layer->set("template","none.htm");
461   - if (file_exists(($this->arquivo)."qy"))
462   - {$this->mapa->loadquery(($this->arquivo)."qy");}
  468 + if (file_exists($this->qyfile))
  469 + {$this->mapa->loadquery($this->qyfile);}
463 470 $indxlayer = $this->layer->index;
464 471 $res_count = $this->layer->getNumresults();
465 472 $shp_atual = array();
... ... @@ -534,16 +541,16 @@ Limpa a seleção do tema.
534 541 if ($this->nome != "") //limpa de um tema
535 542 {
536 543 if(!$this->layer){return "erro";}
537   - if (file_exists(($this->arquivo)."qy"))
538   - {$this->mapa->loadquery(($this->arquivo)."qy");}
  544 + if (file_exists($this->qyfile))
  545 + {$this->mapa->loadquery($this->qyfile);}
539 546 $indxlayer = $this->layer->index;
540 547 $this->mapa->freequery($indxlayer);
541   - $this->mapa->savequery(($this->arquivo)."qy");
  548 + $this->mapa->savequery($this->qyfile);
542 549 }
543 550 else //limpa de todos os temas
544 551 {
545   - if (file_exists(($this->arquivo)."qy"))
546   - {unlink (($this->arquivo)."qy");}
  552 + if (file_exists($this->qyfile))
  553 + {unlink ($this->qyfile);}
547 554 }
548 555 return("ok");
549 556 }
... ... @@ -557,8 +564,8 @@ Inverte seleção do tema.
557 564 {
558 565 if(!$this->layer){return "erro";}
559 566 $this->layer->set("template","none.htm");
560   - if (file_exists(($this->arquivo)."qy"))
561   - {$this->mapa->loadquery(($this->arquivo)."qy");}
  567 + if (file_exists($this->qyfile))
  568 + {$this->mapa->loadquery($this->qyfile);}
562 569 $indxlayer = $this->layer->index;
563 570 $items = pegaItens($this->layer);
564 571 $res_count = $this->layer->getNumresults();
... ... @@ -584,7 +591,7 @@ Inverte seleção do tema.
584 591 $this->mapa->freequery($indxlayer);
585 592 foreach ($shp as $indx)
586 593 {$this->mapa->querybyindex($indxlayer,-1,$indx,MS_TRUE);}
587   - $this->mapa->savequery(($this->arquivo)."qy");
  594 + $this->mapa->savequery($this->qyfile);
588 595 return("ok");
589 596 }
590 597 /*
... ... @@ -607,7 +614,7 @@ $shp_atual - Indices dos elementos já selecionados.
607 614 $this->mapa->freequery($indxlayer);
608 615 foreach ($shp as $indx)
609 616 {@$this->mapa->querybyindex($indxlayer,-1,$indx,MS_TRUE);}
610   - $this->mapa->savequery(($this->arquivo)."qy");
  617 + $this->mapa->savequery($this->qyfile);
611 618 return("ok");
612 619 }
613 620 /*
... ... @@ -632,7 +639,7 @@ $shp_atual - Indices dos elementos já selecionados.
632 639 $this->mapa->freequery($indxlayer);
633 640 foreach ($shp as $indx)
634 641 {$this->mapa->querybyindex($indxlayer,-1,$indx,MS_TRUE);}
635   - $this->mapa->savequery(($this->arquivo)."qy");
  642 + $this->mapa->savequery($this->qyfile);
636 643 return("ok");
637 644 }
638 645 /*
... ... @@ -650,14 +657,14 @@ $ids - Ids separados por vírgula correspondendo aos registros.
650 657 {
651 658 if(!$this->layer){return "erro";}
652 659 $this->layer->set("template","none.htm");
653   - if (file_exists(($this->arquivo)."qy"))
654   - {$this->mapa->loadquery(($this->arquivo)."qy");}
  660 + if (file_exists($this->qyfile))
  661 + {$this->mapa->loadquery($this->qyfile);}
655 662 $ids = explode(",",$ids);
656 663 $indxlayer = $this->layer->index;
657 664 $ids = array_unique($ids);
658 665 foreach ($ids as $i)
659 666 {$this->mapa->queryByIndex($indxlayer, -1, $i);}
660   - $this->mapa->savequery(($this->arquivo)."qy");
  667 + $this->mapa->savequery($this->qyfile);
661 668 return("ok");
662 669 }
663 670 /*
... ... @@ -708,8 +715,8 @@ $tipo - Tipo de operação adiciona|retira|inverte|limpa
708 715 if ($tipo == "inverte")
709 716 {return ($this->selecaoInverte());}
710 717 $this->layer->set("template","none.htm");
711   - if (file_exists(($this->arquivo)."qy"))
712   - {$this->mapa->loadquery(($this->arquivo)."qy");}
  718 + if (file_exists($this->qyfile))
  719 + {$this->mapa->loadquery($this->qyfile);}
713 720 $indxlayer = $this->layer->index;
714 721 $res_count = $this->layer->getNumresults();
715 722 $shp_atual = array();
... ... @@ -757,8 +764,8 @@ $ext - coordenadas separadas por espaços no estilo xmin ymin xmax ymax
757 764 if ($tipo == "inverte")
758 765 {return ($this->selecaoInverte());}
759 766 $this->layer->set("template","none.htm");
760   - if (file_exists(($this->arquivo)."qy"))
761   - {$this->mapa->loadquery(($this->arquivo)."qy");}
  767 + if (file_exists($this->qyfile))
  768 + {$this->mapa->loadquery($this->qyfile);}
762 769 $indxlayer = $this->layer->index;
763 770 $res_count = $this->layer->getNumresults();
764 771 $shp_atual = array();
... ...
classesphp/classe_temas.php
... ... @@ -79,7 +79,13 @@ class Temas
79 79  
80 80 Indices dos layers do grupo
81 81 */
82   - protected $indices;
  82 + protected $indices;
  83 + /*
  84 + Variavel: $qyfile
  85 +
  86 + Nome do arquivo de seleção (.qy)
  87 + */
  88 + public $qyfile;
83 89 /*
84 90 function __construct
85 91  
... ... @@ -93,6 +99,7 @@ $tema - nome do tema que será processado
93 99 function __construct($map_file,$tema=null,$locaplic="")
94 100 {
95 101 //error_reporting(E_ALL);
  102 + $this->qyfile = str_replace(".map",".qy",$map_file);
96 103 if(file_exists($locaplic."/funcoes_gerais.php"))
97 104 include_once($locaplic."/funcoes_gerais.php");
98 105 else
... ... @@ -213,8 +220,8 @@ Altera a ordem de armazenamento dos layers no mapfile.
213 220 */
214 221 function desceTema()
215 222 {
216   - if (file_exists(($this->arquivo)."qy"))
217   - {unlink (($this->arquivo)."qy");}
  223 + if (file_exists($this->qyfile))
  224 + {unlink ($this->qyfile);}
218 225 $nl = $this->mapa->numlayers;
219 226 $mover = 1;
220 227 $indice = $this->indices[0];
... ... @@ -259,8 +266,8 @@ Altera a ordem de armazenamento dos layers no mapfile.
259 266 */
260 267 function sobeTema()
261 268 {
262   - if (file_exists(($this->arquivo)."qy"))
263   - {unlink (($this->arquivo)."qy");}
  269 + if (file_exists($this->qyfile))
  270 + {unlink ($this->qyfile);}
264 271 $nl = $this->mapa->numlayers;
265 272 $mover = 1;
266 273 $indices = array_reverse($this->indices);
... ... @@ -692,8 +699,8 @@ $nome - nome que será dado a geometria
692 699 $ext = $this->mapa->extent;
693 700 $sb = $this->mapa->scalebar;
694 701 $sb->set("status",MS_OFF);
695   - if (file_exists($this->arquivo."qy"))
696   - {$this->mapa->loadquery(($this->arquivo)."qy");}
  702 + if (file_exists($this->qyfile))
  703 + {$this->mapa->loadquery($this->qyfile);}
697 704 $items = pegaItens($this->layer);
698 705 $sopen = $this->layer->open();
699 706 if($sopen == MS_FAILURE){return "erro";}
... ... @@ -917,8 +924,8 @@ Calcula a extensão geográfica dos elementos selecionados de um tema e ajusta o m
917 924 $extatual = $this->mapa->extent;
918 925 $prjMapa = "";
919 926 $prjTema = "";
920   - if (file_exists($this->arquivo."qy"))
921   - {$this->mapa->loadquery(($this->arquivo)."qy");}
  927 + if (file_exists($this->qyfile))
  928 + {$this->mapa->loadquery($this->qyfile);}
922 929 $sopen = $this->layer->open();
923 930 if($sopen == MS_FAILURE){return "erro";}
924 931 $res_count = $this->layer->getNumresults();
... ...
classesphp/funcoes_gerais.php
... ... @@ -1788,8 +1788,9 @@ function criaSHP($tema,$map_file,$locaplic,$dir_tmp,$nomeRand=TRUE)
1788 1788 $novoshpf = ms_newShapefileObj($nomeshp.".shp", -2);
1789 1789 //le o arquivo de query se existir e checa se existe sele&ccedil;&atilde;o para o tema
1790 1790 $existesel = "nao";
1791   - if (file_exists($map_file."qy"))
1792   - {$map->loadquery($map_file."qy");}
  1791 + $qyfile = str_replace(".map",".qy",$map_file);
  1792 + if (file_exists($qyfile))
  1793 + {$map->loadquery($qyfile);}
1793 1794 if ($layer->getNumresults() > 0)
1794 1795 {$existesel = "sim";}
1795 1796  
... ...
classesphp/graficos.php
... ... @@ -376,8 +376,9 @@ function iniciaDadosGrafico($map_file,$tema,$exclui,$itemclasses,$itemvalores,$t
376 376 //pega os valores
377 377 $map = ms_newMapObj($map_file);
378 378 $selecionados = "sim";
379   - if (file_exists($map_file."qy"))
380   - {$map->loadquery($map_file."qy");}
  379 + $qyfile = str_replace(".map",".qy",$map_file);
  380 + if (file_exists($qyfile))
  381 + {$map->loadquery($qyfile);}
381 382 else
382 383 {$selecionados = "nao";}
383 384 $layer = $map->getLayerByName($tema);
... ...
classesphp/mapa_controle.php
... ... @@ -149,12 +149,7 @@ if (isset($debug) &amp;&amp; $debug == &quot;sim&quot;)
149 149 //
150 150 include_once ("carrega_ext.php");
151 151 include_once("funcoes_gerais.php");
152   -//include_once("../pacotes/cpaint/cpaint2.inc.php");
153   -//
154   -//cria objeto cpaint para uso com ajax
155   -//
156   -//$cp = new cpaint();
157   -//$cp->set_data("");
  152 +
158 153 if ($funcao == "criaMapa")
159 154 {
160 155 session_destroy();
... ... @@ -403,8 +398,9 @@ Salva o mapa acrescentando um novo layer com o buffer.
403 398 $retorno = $m->criaBuffer($distancia,$locaplic,$unir);
404 399 $m->salva();
405 400 //limpa selecao
406   - if (file_exists($map_file."qy"))
407   - {unlink ($map_file."qy");}
  401 + $qyfile = str_replace(".map",".qy",$map_file);
  402 + if (file_exists($qyfile))
  403 + {unlink ($qyfile);}
408 404 break;
409 405 /*
410 406 Property - DISTANCIAPTPT
... ... @@ -560,8 +556,10 @@ Valor: REINICIAMAPA
560 556 Reinicia um mapa restaurando a cópia de segurança.
561 557 */
562 558 case "REINICIAMAPA":
563   - if(file_exists($map_file."qy"))
564   - {unlink($map_file."qy");}
  559 + $qyfile = str_replace(".map",".qy",$map_file);
  560 + if (file_exists($qyfile))
  561 + {unlink ($qyfile);}
  562 +
565 563 unlink($map_file);
566 564 copy(str_replace(".map","reinc.map",$map_file),$map_file);
567 565 $retorno = "ok";
... ... @@ -572,8 +570,10 @@ Valor: RECUPERAMAPA
572 570 Recupera o mapfile de segurança.
573 571 */
574 572 case "RECUPERAMAPA":
575   - if(file_exists($map_file."qy"))
576   - {unlink($map_file."qy");}
  573 + $qyfile = str_replace(".map",".qy",$map_file);
  574 + if (file_exists($qyfile))
  575 + {unlink ($qyfile);}
  576 +
577 577 unlink($map_file);
578 578 $nmf = str_replace(".map","seguranca.map",$map_file);
579 579 if(file_exists($nmf))
... ...
classesphp/mapa_inicia.php
... ... @@ -157,6 +157,7 @@ function iniciaMapa()
157 157 include_once("classe_mapa.php");
158 158 error_reporting(E_ALL);
159 159 $m = new Mapa($map_file);
  160 +
160 161 $m->mudaQS($w,$h);
161 162 $m = new Mapa($map_file);
162 163 $m->mapa->setsize($w,$h);
... ... @@ -200,7 +201,8 @@ function iniciaMapa()
200 201 //
201 202 //pega os parametros de cada tema
202 203 //
203   - $arqsel = (file_exists($map_file."qy")) ? true : false;
  204 + $qyfile = str_replace(".map",".qy",$map_file);
  205 + $arqsel = (file_exists($qyfile)) ? true : false;
204 206 $m = New Mapa($map_file);
205 207 $temas = $m->parametrosTemas();
206 208 $nomes = nomeRandomico(12);
... ...