Commit 4ea8405390c9cccffe9a4faac7fcb1c751baf421
1 parent
cd128f5e
Exists in
master
and in
7 other branches
Adaptações dos códigos para a versão 6 do Mapserver
Showing
11 changed files
with
338 additions
and
142 deletions
Show diff stats
classesphp/classe_analise.php
| @@ -74,6 +74,12 @@ class Analise | @@ -74,6 +74,12 @@ class Analise | ||
| 74 | */ | 74 | */ |
| 75 | public $qyfile; | 75 | public $qyfile; |
| 76 | /* | 76 | /* |
| 77 | + Variavel: $v | ||
| 78 | + | ||
| 79 | + Versão atual do Mapserver (primeiro dígito) | ||
| 80 | + */ | ||
| 81 | + public $v; | ||
| 82 | + /* | ||
| 77 | Variavel: $dbaseExiste | 83 | Variavel: $dbaseExiste |
| 78 | 84 | ||
| 79 | Indica se a biblioteca dbase está carregada | 85 | Indica se a biblioteca dbase está carregada |
| @@ -100,6 +106,8 @@ $ext - Extensão geográfica do mapa | @@ -100,6 +106,8 @@ $ext - Extensão geográfica do mapa | ||
| 100 | include_once($locaplic."/funcoes_gerais.php"); | 106 | include_once($locaplic."/funcoes_gerais.php"); |
| 101 | else | 107 | else |
| 102 | include_once("funcoes_gerais.php"); | 108 | include_once("funcoes_gerais.php"); |
| 109 | + $this->v = versao(); | ||
| 110 | + $this->v = $this->v["principal"]; | ||
| 103 | $this->dbaseExiste = false; | 111 | $this->dbaseExiste = false; |
| 104 | if(function_exists("dbase_create")) | 112 | if(function_exists("dbase_create")) |
| 105 | {$this->dbaseExiste = true;} | 113 | {$this->dbaseExiste = true;} |
| @@ -1026,9 +1034,13 @@ $locaplic - Localização do I3geo. | @@ -1026,9 +1034,13 @@ $locaplic - Localização do I3geo. | ||
| 1026 | $spts = array(); | 1034 | $spts = array(); |
| 1027 | for ($i = 0; $i < $res_count; ++$i) | 1035 | for ($i = 0; $i < $res_count; ++$i) |
| 1028 | { | 1036 | { |
| 1029 | - $result = $layerPt->getResult($i); | ||
| 1030 | - $shp_index = $result->shapeindex; | ||
| 1031 | - $shape = $layerPt->getfeature($shp_index,-1); | 1037 | + if($this->v == 6) |
| 1038 | + {$shape = $layerPt->getShape($layerPt->getResult($i));} | ||
| 1039 | + else{ | ||
| 1040 | + $result = $layerPt->getResult($i); | ||
| 1041 | + $shp_index = $result->shapeindex; | ||
| 1042 | + $shape = $layerPt->getfeature($shp_index,-1); | ||
| 1043 | + } | ||
| 1032 | $spts[] = $shape; | 1044 | $spts[] = $shape; |
| 1033 | } | 1045 | } |
| 1034 | $layerPt->close(); | 1046 | $layerPt->close(); |
| @@ -1098,10 +1110,13 @@ $locaplic - Localização do I3geo. | @@ -1098,10 +1110,13 @@ $locaplic - Localização do I3geo. | ||
| 1098 | if($sopen == MS_FAILURE){return "erro";} | 1110 | if($sopen == MS_FAILURE){return "erro";} |
| 1099 | if ($res_count > 0 && $layer->getResult(0) !== FALSE) | 1111 | if ($res_count > 0 && $layer->getResult(0) !== FALSE) |
| 1100 | { | 1112 | { |
| 1101 | - $result = $layer->getResult(0); | ||
| 1102 | - $shp_index = $result->shapeindex; | ||
| 1103 | - | ||
| 1104 | - $shape = $layer->getfeature($shp_index,-1); | 1113 | + if($this->v == 6) |
| 1114 | + {$shape = $layer->getShape($layer->getResult(0));} | ||
| 1115 | + else{ | ||
| 1116 | + $result = $layer->getResult(0); | ||
| 1117 | + $shp_index = $result->shapeindex; | ||
| 1118 | + $shape = $layer->getfeature($shp_index,-1); | ||
| 1119 | + } | ||
| 1105 | foreach ($itens as $item) | 1120 | foreach ($itens as $item) |
| 1106 | {$reg[] = $this->truncaS($shape->values[$item]);} | 1121 | {$reg[] = $this->truncaS($shape->values[$item]);} |
| 1107 | } | 1122 | } |
| @@ -1190,9 +1205,13 @@ function distanciaptpt($temaorigem,$temadestino,$temaoverlay,$locaplic,$itemorig | @@ -1190,9 +1205,13 @@ function distanciaptpt($temaorigem,$temadestino,$temaoverlay,$locaplic,$itemorig | ||
| 1190 | $res_count = $layerorigem->getNumresults(); | 1205 | $res_count = $layerorigem->getNumresults(); |
| 1191 | for ($i = 0; $i < $res_count; ++$i) | 1206 | for ($i = 0; $i < $res_count; ++$i) |
| 1192 | { | 1207 | { |
| 1193 | - $result = $layerorigem->getResult($i); | ||
| 1194 | - $shp_index = $result->shapeindex; | ||
| 1195 | - $shapesorigem[] = $layerorigem->getshape(-1, $shp_index); | 1208 | + if($this->v == 6) |
| 1209 | + {$shapesorigem[] = $layerorigem->getShape($layerorigem->getResult($i));} | ||
| 1210 | + else{ | ||
| 1211 | + $result = $layerorigem->getResult($i); | ||
| 1212 | + $shp_index = $result->shapeindex; | ||
| 1213 | + $shapesorigem[] = $layerorigem->getshape(-1, $shp_index); | ||
| 1214 | + } | ||
| 1196 | } | 1215 | } |
| 1197 | $layerorigem->close(); | 1216 | $layerorigem->close(); |
| 1198 | $layeroverlay->set("tolerance",0); | 1217 | $layeroverlay->set("tolerance",0); |
| @@ -1212,9 +1231,13 @@ function distanciaptpt($temaorigem,$temadestino,$temaoverlay,$locaplic,$itemorig | @@ -1212,9 +1231,13 @@ function distanciaptpt($temaorigem,$temadestino,$temaoverlay,$locaplic,$itemorig | ||
| 1212 | 1231 | ||
| 1213 | for ($i = 0; $i < $res_count; ++$i) | 1232 | for ($i = 0; $i < $res_count; ++$i) |
| 1214 | { | 1233 | { |
| 1215 | - $result = $layerdestino->getResult($i); | ||
| 1216 | - $shp_index = $result->shapeindex; | ||
| 1217 | - $shapesdestino[] = $layerdestino->getshape(-1, $shp_index); | 1234 | + if($this->v == 6) |
| 1235 | + {$shapesdestino[] = $layerdestino->getShape($layerdestino->getResult($i));} | ||
| 1236 | + else{ | ||
| 1237 | + $result = $layerdestino->getResult($i); | ||
| 1238 | + $shp_index = $result->shapeindex; | ||
| 1239 | + $shapesdestino[] = $layerdestino->getshape(-1, $shp_index); | ||
| 1240 | + } | ||
| 1218 | } | 1241 | } |
| 1219 | $layerdestino->close(); | 1242 | $layerdestino->close(); |
| 1220 | $rect = $this->mapa->extent; | 1243 | $rect = $this->mapa->extent; |
| @@ -1332,9 +1355,13 @@ nome do layer criado com o buffer. | @@ -1332,9 +1355,13 @@ nome do layer criado com o buffer. | ||
| 1332 | //pega um shape especifico | 1355 | //pega um shape especifico |
| 1333 | for ($i = 0; $i < $res_count; ++$i) | 1356 | for ($i = 0; $i < $res_count; ++$i) |
| 1334 | { | 1357 | { |
| 1335 | - $result = $this->layer->getResult($i); | ||
| 1336 | - $shp_index = $result->shapeindex; | ||
| 1337 | - $listaShapes[] = $this->layer->getfeature($shp_index,-1); | 1358 | + if($this->v == 6) |
| 1359 | + {$listaShapes[] = $this->layer->getShape($this->layer->getResult($i));} | ||
| 1360 | + else{ | ||
| 1361 | + $result = $this->layer->getResult($i); | ||
| 1362 | + $shp_index = $result->shapeindex; | ||
| 1363 | + $listaShapes[] = $this->layer->getfeature($shp_index,-1); | ||
| 1364 | + } | ||
| 1338 | } | 1365 | } |
| 1339 | $fechou = $this->layer->close(); | 1366 | $fechou = $this->layer->close(); |
| 1340 | } | 1367 | } |
| @@ -1369,7 +1396,7 @@ nome do layer criado com o buffer. | @@ -1369,7 +1396,7 @@ nome do layer criado com o buffer. | ||
| 1369 | { | 1396 | { |
| 1370 | $ns = $buffers[0]; | 1397 | $ns = $buffers[0]; |
| 1371 | for($s=1;$s < count($buffers);$s++) | 1398 | for($s=1;$s < count($buffers);$s++) |
| 1372 | - {$ns = $ns->union_geos($buffers[$s]);} | 1399 | + {$ns = $ns->union($buffers[$s]);} |
| 1373 | $buffers = array($ns); | 1400 | $buffers = array($ns); |
| 1374 | $shapes = array($shapes[0]); | 1401 | $shapes = array($shapes[0]); |
| 1375 | } | 1402 | } |
| @@ -1460,9 +1487,13 @@ $item {string} - (opcional) Item q será utilizado para ponderar os valores. | @@ -1460,9 +1487,13 @@ $item {string} - (opcional) Item q será utilizado para ponderar os valores. | ||
| 1460 | $ys = 0; | 1487 | $ys = 0; |
| 1461 | for ($i = 0; $i < $res_count; ++$i) | 1488 | for ($i = 0; $i < $res_count; ++$i) |
| 1462 | { | 1489 | { |
| 1463 | - $result = $this->layer->getResult($i); | ||
| 1464 | - $shp_index = $result->shapeindex; | ||
| 1465 | - $shape = $this->layer->getfeature($shp_index,-1); | 1490 | + if($this->v == 6) |
| 1491 | + {$shape = $this->layer->getShape($this->layer->getResult($i));} | ||
| 1492 | + else{ | ||
| 1493 | + $result = $this->layer->getResult($i); | ||
| 1494 | + $shp_index = $result->shapeindex; | ||
| 1495 | + $shape = $this->layer->getfeature($shp_index,-1); | ||
| 1496 | + } | ||
| 1466 | if($item != "") | 1497 | if($item != "") |
| 1467 | {$pondera = $shape->values[$item];} | 1498 | {$pondera = $shape->values[$item];} |
| 1468 | $pt = $shape->line(0)->point(0); | 1499 | $pt = $shape->line(0)->point(0); |
| @@ -1551,9 +1582,13 @@ $locaplic - Localização do I3geo. | @@ -1551,9 +1582,13 @@ $locaplic - Localização do I3geo. | ||
| 1551 | //pega um shape especifico | 1582 | //pega um shape especifico |
| 1552 | for ($i = 0; $i < $res_count; ++$i) | 1583 | for ($i = 0; $i < $res_count; ++$i) |
| 1553 | { | 1584 | { |
| 1554 | - $result = $this->layer->getResult($i); | ||
| 1555 | - $shp_index = $result->shapeindex; | ||
| 1556 | - $shape = $this->layer->getfeature($shp_index,-1); | 1585 | + if($this->v == 6) |
| 1586 | + {$shape = $this->layer->getShape($this->layer->getResult($i));} | ||
| 1587 | + else{ | ||
| 1588 | + $result = $this->layer->getResult($i); | ||
| 1589 | + $shp_index = $result->shapeindex; | ||
| 1590 | + $shape = $this->layer->getfeature($shp_index,-1); | ||
| 1591 | + } | ||
| 1557 | $LineObj = ms_newLineObj(); | 1592 | $LineObj = ms_newLineObj(); |
| 1558 | $LineObj->add($shape->getCentroid()); | 1593 | $LineObj->add($shape->getCentroid()); |
| 1559 | $ShapeObj = ms_newShapeObj(MS_SHAPE_POINT); | 1594 | $ShapeObj = ms_newShapeObj(MS_SHAPE_POINT); |
| @@ -2121,9 +2156,13 @@ $locaplic - Localização do I3geo | @@ -2121,9 +2156,13 @@ $locaplic - Localização do I3geo | ||
| 2121 | $res_count = $layerPo->getNumresults(); | 2156 | $res_count = $layerPo->getNumresults(); |
| 2122 | for ($i = 0; $i < $res_count; ++$i) | 2157 | for ($i = 0; $i < $res_count; ++$i) |
| 2123 | { | 2158 | { |
| 2124 | - $result = $layerPo->getResult($i); | ||
| 2125 | - $shp_index = $result->shapeindex; | ||
| 2126 | - $shape = $layerPo->getfeature($shp_index,-1); | 2159 | + if($this->v == 6) |
| 2160 | + {$shape = $layerPo->getShape($layerPo->getResult($i));} | ||
| 2161 | + else{ | ||
| 2162 | + $result = $layerPo->getResult($i); | ||
| 2163 | + $shp_index = $result->shapeindex; | ||
| 2164 | + $shape = $layerPo->getfeature($shp_index,-1); | ||
| 2165 | + } | ||
| 2127 | $novoreg = array(); | 2166 | $novoreg = array(); |
| 2128 | foreach($itenspo as $ipo) | 2167 | foreach($itenspo as $ipo) |
| 2129 | {$novoreg[] = $shape->values[$ipo];} | 2168 | {$novoreg[] = $shape->values[$ipo];} |
| @@ -2182,9 +2221,15 @@ Salva o mapa acrescentando um novo layer com o resultado. | @@ -2182,9 +2221,15 @@ Salva o mapa acrescentando um novo layer com o resultado. | ||
| 2182 | $indices = array(); | 2221 | $indices = array(); |
| 2183 | for ($i = 0; $i < $res_count; ++$i) | 2222 | for ($i = 0; $i < $res_count; ++$i) |
| 2184 | { | 2223 | { |
| 2185 | - $result = $this->layer->getResult($i); | ||
| 2186 | - $shp_index = $result->shapeindex; | ||
| 2187 | - $shape = $this->layer->getfeature($shp_index,-1); | 2224 | + if($this->v == 6){ |
| 2225 | + $shape = $this->layer->getShape($this->layer->getResult($i)); | ||
| 2226 | + $shp_index = $shape->index; | ||
| 2227 | + } | ||
| 2228 | + else{ | ||
| 2229 | + $result = $this->layer->getResult($i); | ||
| 2230 | + $shp_index = $result->shapeindex; | ||
| 2231 | + $shape = $this->layer->getfeature($shp_index,-1); | ||
| 2232 | + } | ||
| 2188 | if($item != "") | 2233 | if($item != "") |
| 2189 | $valor = $shape->values[$item]; | 2234 | $valor = $shape->values[$item]; |
| 2190 | else | 2235 | else |
| @@ -2202,7 +2247,10 @@ Salva o mapa acrescentando um novo layer com o resultado. | @@ -2202,7 +2247,10 @@ Salva o mapa acrescentando um novo layer com o resultado. | ||
| 2202 | { | 2247 | { |
| 2203 | foreach ($i as $indice) | 2248 | foreach ($i as $indice) |
| 2204 | { | 2249 | { |
| 2205 | - $shape = $this->layer->getfeature($indice,-1); | 2250 | + if($this->v == 6) |
| 2251 | + {$shape = $this->layer->getShape($this->layer->getResult($indice));} | ||
| 2252 | + else | ||
| 2253 | + {$shape = $this->layer->getfeature($indice,-1);} | ||
| 2206 | if($item != "") | 2254 | if($item != "") |
| 2207 | $valor = $shape->values[$item]; | 2255 | $valor = $shape->values[$item]; |
| 2208 | else | 2256 | else |
| @@ -2224,7 +2272,7 @@ Salva o mapa acrescentando um novo layer com o resultado. | @@ -2224,7 +2272,7 @@ Salva o mapa acrescentando um novo layer com o resultado. | ||
| 2224 | } | 2272 | } |
| 2225 | else | 2273 | else |
| 2226 | { | 2274 | { |
| 2227 | - $dissolve[$valor] = $shape->union_geos($dissolve[$valor]); | 2275 | + $dissolve[$valor] = $shape->union($dissolve[$valor]); |
| 2228 | } | 2276 | } |
| 2229 | } | 2277 | } |
| 2230 | } | 2278 | } |
| @@ -2312,19 +2360,23 @@ $locaplic - Localização do I3geo | @@ -2312,19 +2360,23 @@ $locaplic - Localização do I3geo | ||
| 2312 | $indices = array(); | 2360 | $indices = array(); |
| 2313 | for ($i = 0; $i < $res_count; ++$i) | 2361 | for ($i = 0; $i < $res_count; ++$i) |
| 2314 | { | 2362 | { |
| 2315 | - $result = $this->layer->getResult($i); | ||
| 2316 | - $shp_index = $result->shapeindex; | ||
| 2317 | - $shape = $this->layer->getfeature($shp_index,-1); | 2363 | + if($this->v == 6) |
| 2364 | + {$shape = $this->layer->getShape($this->layer->getResult($i));} | ||
| 2365 | + else{ | ||
| 2366 | + $result = $this->layer->getResult($i); | ||
| 2367 | + $shp_index = $result->shapeindex; | ||
| 2368 | + $shape = $this->layer->getfeature($shp_index,-1); | ||
| 2369 | + } | ||
| 2318 | if($item != "") | 2370 | if($item != "") |
| 2319 | $valor = $shape->values[$item]; | 2371 | $valor = $shape->values[$item]; |
| 2320 | else | 2372 | else |
| 2321 | $valor = "nenhum"; | 2373 | $valor = "nenhum"; |
| 2322 | if(!isset($indices[$valor])) | 2374 | if(!isset($indices[$valor])) |
| 2323 | { | 2375 | { |
| 2324 | - $indices[$valor] = array($shp_index); | 2376 | + $indices[$valor] = array($i); |
| 2325 | } | 2377 | } |
| 2326 | else | 2378 | else |
| 2327 | - $indices[$valor] = array_merge($indices[$valor],array($shp_index)); | 2379 | + $indices[$valor] = array_merge($indices[$valor],array($i)); |
| 2328 | } | 2380 | } |
| 2329 | //var_dump($indices); | 2381 | //var_dump($indices); |
| 2330 | // | 2382 | // |
| @@ -2335,7 +2387,10 @@ $locaplic - Localização do I3geo | @@ -2335,7 +2387,10 @@ $locaplic - Localização do I3geo | ||
| 2335 | { | 2387 | { |
| 2336 | foreach ($i as $indice) | 2388 | foreach ($i as $indice) |
| 2337 | { | 2389 | { |
| 2338 | - $shape = $this->layer->getfeature($indice,-1); | 2390 | + if($this->v == 6) |
| 2391 | + {$shape = $this->layer->getShape($this->layer->getResult($indice));} | ||
| 2392 | + else | ||
| 2393 | + {$shape = $this->layer->getfeature($indice,-1);} | ||
| 2339 | if($item != "") | 2394 | if($item != "") |
| 2340 | $valor = $shape->values[$item]; | 2395 | $valor = $shape->values[$item]; |
| 2341 | else | 2396 | else |
| @@ -2344,7 +2399,7 @@ $locaplic - Localização do I3geo | @@ -2344,7 +2399,7 @@ $locaplic - Localização do I3geo | ||
| 2344 | {$dissolve[$valor] = $shape;} | 2399 | {$dissolve[$valor] = $shape;} |
| 2345 | else | 2400 | else |
| 2346 | { | 2401 | { |
| 2347 | - $dissolve[$valor] = $shape->union_geos($dissolve[$valor]); | 2402 | + $dissolve[$valor] = $shape->union($dissolve[$valor]); |
| 2348 | } | 2403 | } |
| 2349 | } | 2404 | } |
| 2350 | } | 2405 | } |
| @@ -2739,9 +2794,13 @@ function gravaCoordenadasPt($tema,$limitepontos="TRUE",$extendelimite) | @@ -2739,9 +2794,13 @@ function gravaCoordenadasPt($tema,$limitepontos="TRUE",$extendelimite) | ||
| 2739 | } | 2794 | } |
| 2740 | for ($i = 0; $i < $res_count; ++$i) | 2795 | for ($i = 0; $i < $res_count; ++$i) |
| 2741 | { | 2796 | { |
| 2742 | - $result = $layerPt->getResult($i); | ||
| 2743 | - $shp_index = $result->shapeindex; | ||
| 2744 | - $shape = $layerPt->getfeature($shp_index,-1); | 2797 | + if($this->v == 6) |
| 2798 | + {$shape = $layerPt->getShape($layerPt->getResult($i));} | ||
| 2799 | + else{ | ||
| 2800 | + $result = $layerPt->getResult($i); | ||
| 2801 | + $shp_index = $result->shapeindex; | ||
| 2802 | + $shape = $layerPt->getfeature($shp_index,-1); | ||
| 2803 | + } | ||
| 2745 | $lineo = $shape->line(0); | 2804 | $lineo = $shape->line(0); |
| 2746 | $pt = $lineo->point(0); | 2805 | $pt = $lineo->point(0); |
| 2747 | if (($prjTema != "") && ($prjMapa != $prjTema)) | 2806 | if (($prjTema != "") && ($prjMapa != $prjTema)) |
classesphp/classe_atributos.php
| @@ -74,7 +74,13 @@ class Atributos | @@ -74,7 +74,13 @@ class Atributos | ||
| 74 | 74 | ||
| 75 | Objeto projection original do mapa. Obtido apenas na interface Googlemaps | 75 | Objeto projection original do mapa. Obtido apenas na interface Googlemaps |
| 76 | */ | 76 | */ |
| 77 | - public $projO; | 77 | + public $projO; |
| 78 | + /* | ||
| 79 | + Variavel: $v | ||
| 80 | + | ||
| 81 | + Versão atual do Mapserver (primeiro dígito) | ||
| 82 | + */ | ||
| 83 | + public $v; | ||
| 78 | /* | 84 | /* |
| 79 | Function: __construct | 85 | Function: __construct |
| 80 | 86 | ||
| @@ -100,6 +106,8 @@ $ext - (opcional) extensão geográfica que será aplicada ao mapa | @@ -100,6 +106,8 @@ $ext - (opcional) extensão geográfica que será aplicada ao mapa | ||
| 100 | include_once($locaplic."/funcoes_gerais.php"); | 106 | include_once($locaplic."/funcoes_gerais.php"); |
| 101 | else | 107 | else |
| 102 | include_once("funcoes_gerais.php"); | 108 | include_once("funcoes_gerais.php"); |
| 109 | + $this->v = versao(); | ||
| 110 | + $this->v = $this->v["principal"]; | ||
| 103 | if($map_file != ""){ | 111 | if($map_file != ""){ |
| 104 | $this->qyfile = str_replace(".map",".qy",$map_file); | 112 | $this->qyfile = str_replace(".map",".qy",$map_file); |
| 105 | $this->locaplic = $locaplic; | 113 | $this->locaplic = $locaplic; |
| @@ -195,17 +203,20 @@ $registro - Índice do registro que será consultado. | @@ -195,17 +203,20 @@ $registro - Índice do registro que será consultado. | ||
| 195 | $this->layer->setfilter(""); | 203 | $this->layer->setfilter(""); |
| 196 | $ext = ""; | 204 | $ext = ""; |
| 197 | //procura o registro e pega a extensão geográfica | 205 | //procura o registro e pega a extensão geográfica |
| 198 | - if (@$this->layer->open() == MS_SUCCESS) | ||
| 199 | - { | ||
| 200 | - $items = pegaItens($this->layer); | ||
| 201 | - if (@$this->layer->queryByrect($this->mapa->extent) == MS_SUCCESS) | 206 | + if($this->v == 6) |
| 207 | + {$shape = $this->layer->getShape(new resultObj($registro));} | ||
| 208 | + else{ | ||
| 209 | + if (@$this->layer->open() == MS_SUCCESS) | ||
| 202 | { | 210 | { |
| 203 | - $this->layer->open(); | ||
| 204 | - $shape = $this->layer->getfeature($registro,-1); | ||
| 205 | - $fechou = $this->layer->close(); | ||
| 206 | - $ext = $this->extensaoShape($shape); | ||
| 207 | - } | 211 | + if (@$this->layer->queryByrect($this->mapa->extent) == MS_SUCCESS) |
| 212 | + { | ||
| 213 | + $this->layer->open(); | ||
| 214 | + $shape = $this->layer->getfeature($registro,-1); | ||
| 215 | + $fechou = $this->layer->close(); | ||
| 216 | + } | ||
| 217 | + } | ||
| 208 | } | 218 | } |
| 219 | + $ext = $this->extensaoShape($shape); | ||
| 209 | return($ext); | 220 | return($ext); |
| 210 | } | 221 | } |
| 211 | /* | 222 | /* |
| @@ -268,11 +279,15 @@ $tipo - Tipo de busca brasil|null | @@ -268,11 +279,15 @@ $tipo - Tipo de busca brasil|null | ||
| 268 | for ($i = 0; $i < $res_count; ++$i) | 279 | for ($i = 0; $i < $res_count; ++$i) |
| 269 | { | 280 | { |
| 270 | $valitem = array(); | 281 | $valitem = array(); |
| 271 | - foreach ($items as $item) | ||
| 272 | - { | 282 | + if($this->v == 6) |
| 283 | + {$shape = $this->layer->getShape($this->layer->getResult($i));} | ||
| 284 | + else{ | ||
| 273 | $result = $this->layer->getResult($i); | 285 | $result = $this->layer->getResult($i); |
| 274 | $shp_index = $result->shapeindex; | 286 | $shp_index = $result->shapeindex; |
| 275 | - $shape = $this->layer->getfeature($shp_index,-1); | 287 | + $shape = $this->layer->getfeature($shp_index,-1); |
| 288 | + } | ||
| 289 | + foreach ($items as $item) | ||
| 290 | + { | ||
| 276 | $v = trim($shape->values[$item]); | 291 | $v = trim($shape->values[$item]); |
| 277 | $v = $this->converte($v); | 292 | $v = $this->converte($v); |
| 278 | $valitem[] = $v; | 293 | $valitem[] = $v; |
| @@ -341,16 +356,22 @@ $tipolista - Indica se serão mostrados todos os registros ou apenas os seleciona | @@ -341,16 +356,22 @@ $tipolista - Indica se serão mostrados todos os registros ou apenas os seleciona | ||
| 341 | for ($i = $inicio; $i < $res_count; ++$i) | 356 | for ($i = $inicio; $i < $res_count; ++$i) |
| 342 | { | 357 | { |
| 343 | $valitem = array(); | 358 | $valitem = array(); |
| 359 | + if($this->v == 6){ | ||
| 360 | + $shape = $this->layer->getShape($this->layer->getResult($i)); | ||
| 361 | + $indx = $shape->index; | ||
| 362 | + } | ||
| 363 | + else{ | ||
| 364 | + $result = $this->layer->getResult($i); | ||
| 365 | + $indx = $result->shapeindex; | ||
| 366 | + $shape = $this->layer->getfeature($indx,-1); | ||
| 367 | + } | ||
| 344 | foreach ($items as $item) | 368 | foreach ($items as $item) |
| 345 | { | 369 | { |
| 346 | - $result = $this->layer->getResult($i); | ||
| 347 | - $shp_index = $result->shapeindex; | ||
| 348 | - $shape = $this->layer->getfeature($shp_index,-1); | ||
| 349 | $valori = trim($shape->values[$item]); | 370 | $valori = trim($shape->values[$item]); |
| 350 | $valori = $this->converte($valori); | 371 | $valori = $this->converte($valori); |
| 351 | $valitem[] = array("item"=>$item,"valor"=>$valori); | 372 | $valitem[] = array("item"=>$item,"valor"=>$valori); |
| 352 | } | 373 | } |
| 353 | - $registros[] = array("indice"=>$shp_index,"valores"=>$valitem,"status"=>$chk); | 374 | + $registros[] = array("indice"=>$indx,"valores"=>$valitem,"status"=>$chk); |
| 354 | } | 375 | } |
| 355 | $resultadoFinal[] = array("registros"=>$registros); | 376 | $resultadoFinal[] = array("registros"=>$registros); |
| 356 | } | 377 | } |
| @@ -378,11 +399,17 @@ $tipolista - Indica se serão mostrados todos os registros ou apenas os seleciona | @@ -378,11 +399,17 @@ $tipolista - Indica se serão mostrados todos os registros ou apenas os seleciona | ||
| 378 | for ($i = $inicio; $i < $res_count; ++$i) | 399 | for ($i = $inicio; $i < $res_count; ++$i) |
| 379 | { | 400 | { |
| 380 | $valitem = array(); | 401 | $valitem = array(); |
| 381 | - foreach ($items as $item) | ||
| 382 | - { | 402 | + if($this->v == 6){ |
| 403 | + $shape = $this->layer->getShape($this->layer->getResult($i)); | ||
| 404 | + $indx = $shape->index; | ||
| 405 | + } | ||
| 406 | + else{ | ||
| 383 | $result = $this->layer->getResult($i); | 407 | $result = $this->layer->getResult($i); |
| 384 | - $shp_index = $result->shapeindex; | ||
| 385 | - $shape = $this->layer->getfeature($shp_index,-1); | 408 | + $indx = $result->shapeindex; |
| 409 | + $shape = $this->layer->getfeature($indx,-1); | ||
| 410 | + } | ||
| 411 | + foreach ($items as $item) | ||
| 412 | + { | ||
| 386 | $valori = ""; | 413 | $valori = ""; |
| 387 | if(@$shape->values[$item]) | 414 | if(@$shape->values[$item]) |
| 388 | { | 415 | { |
| @@ -392,9 +419,9 @@ $tipolista - Indica se serão mostrados todos os registros ou apenas os seleciona | @@ -392,9 +419,9 @@ $tipolista - Indica se serão mostrados todos os registros ou apenas os seleciona | ||
| 392 | $valitem[] = array("item"=>$item,"valor"=>$valori); | 419 | $valitem[] = array("item"=>$item,"valor"=>$valori); |
| 393 | } | 420 | } |
| 394 | //if (in_array($shp_index,$shp_atual)) | 421 | //if (in_array($shp_index,$shp_atual)) |
| 395 | - if(isset($shp_atual[$shp_index])) | 422 | + if(isset($shp_atual[$indx])) |
| 396 | {$chk = "CHECKED";} | 423 | {$chk = "CHECKED";} |
| 397 | - $registros[] = array("indice"=>$shp_index,"valores"=>$valitem,"status"=>$chk); | 424 | + $registros[] = array("indice"=>$indx,"valores"=>$valitem,"status"=>$chk); |
| 398 | $chk = ""; | 425 | $chk = ""; |
| 399 | } | 426 | } |
| 400 | $this->layer->close(); | 427 | $this->layer->close(); |
| @@ -533,9 +560,13 @@ Include: | @@ -533,9 +560,13 @@ Include: | ||
| 533 | //pega os valores | 560 | //pega os valores |
| 534 | for ($i = 0; $i < $res_count; ++$i) | 561 | for ($i = 0; $i < $res_count; ++$i) |
| 535 | { | 562 | { |
| 536 | - $result = $this->layer->getResult($i); | ||
| 537 | - $shp_index = $result->shapeindex; | ||
| 538 | - $shape = $this->layer->getfeature($shp_index,-1); | 563 | + if($this->v == 6) |
| 564 | + {$shape = $this->layer->getShape($this->layer->getResult($i));} | ||
| 565 | + else{ | ||
| 566 | + $result = $this->layer->getResult($i); | ||
| 567 | + $shp_index = $result->shapeindex; | ||
| 568 | + $shape = $this->layer->getfeature($shp_index,-1); | ||
| 569 | + } | ||
| 539 | $v = $shape->values[$item]; | 570 | $v = $shape->values[$item]; |
| 540 | $valores[] = $v; | 571 | $valores[] = $v; |
| 541 | } | 572 | } |
| @@ -1063,9 +1094,8 @@ $listaDeTemas - (opcional) Lista com os códigos dos temas que serão identificado | @@ -1063,9 +1094,8 @@ $listaDeTemas - (opcional) Lista com os códigos dos temas que serão identificado | ||
| 1063 | for ($i = 0; $i < $res_count; ++$i) | 1094 | for ($i = 0; $i < $res_count; ++$i) |
| 1064 | { | 1095 | { |
| 1065 | $valori = array(); | 1096 | $valori = array(); |
| 1066 | - $result = $layer->getResult($i); | ||
| 1067 | - $shp_index = $result->shapeindex; | ||
| 1068 | - $shape = $layer->getfeature($shp_index,-1); | 1097 | + $shape = $layer->getShape($layer->getResult($i)); |
| 1098 | + | ||
| 1069 | if ($tiporetorno == "shape") | 1099 | if ($tiporetorno == "shape") |
| 1070 | { | 1100 | { |
| 1071 | $layer->close(); | 1101 | $layer->close(); |
| @@ -1322,9 +1352,13 @@ $listaDeTemas - (opcional) Lista com os códigos dos temas que serão identificado | @@ -1322,9 +1352,13 @@ $listaDeTemas - (opcional) Lista com os códigos dos temas que serão identificado | ||
| 1322 | for ($i = 0; $i < $res_count; ++$i) | 1352 | for ($i = 0; $i < $res_count; ++$i) |
| 1323 | { | 1353 | { |
| 1324 | $valori = array(); | 1354 | $valori = array(); |
| 1325 | - $result = $layer->getResult($i); | ||
| 1326 | - $shp_index = $result->shapeindex; | ||
| 1327 | - $shape = $layer->getfeature($shp_index,-1); | 1355 | + if($this->v == 6) |
| 1356 | + {$shape = $layer->getShape($layer->getResult($i));} | ||
| 1357 | + else{ | ||
| 1358 | + $result = $layer->getResult($i); | ||
| 1359 | + $shp_index = $result->shapeindex; | ||
| 1360 | + $shape = $layer->getfeature($shp_index,-1); | ||
| 1361 | + } | ||
| 1328 | $conta = 0; | 1362 | $conta = 0; |
| 1329 | //var_dump($itens);exit; | 1363 | //var_dump($itens);exit; |
| 1330 | if($tiporetorno == "shape" || $tiporetorno == "googlerelevo"){ | 1364 | if($tiporetorno == "shape" || $tiporetorno == "googlerelevo"){ |
classesphp/classe_legenda.php
| @@ -513,20 +513,21 @@ String no formato HTML com as imagens dos símbolos | @@ -513,20 +513,21 @@ String no formato HTML com as imagens dos símbolos | ||
| 513 | */ | 513 | */ |
| 514 | function listaSimbolos($tipo,$dir_tmp,$imgdir,$onclick,$tamanho=8,$width=1) | 514 | function listaSimbolos($tipo,$dir_tmp,$imgdir,$onclick,$tamanho=8,$width=1) |
| 515 | { | 515 | { |
| 516 | + $versao = versao(); | ||
| 517 | + $versao = $versao["principal"]; | ||
| 516 | //error_reporting(E_ALL); | 518 | //error_reporting(E_ALL); |
| 517 | if ($tipo == 3){$tipo = 2;} //tipo raster | 519 | if ($tipo == 3){$tipo = 2;} //tipo raster |
| 518 | if($imgdir == "") | 520 | if($imgdir == "") |
| 519 | {$dir = $dir_tmp;} | 521 | {$dir = $dir_tmp;} |
| 520 | else | 522 | else |
| 521 | {$dir = $dir_tmp."/".$imgdir;} | 523 | {$dir = $dir_tmp."/".$imgdir;} |
| 522 | - | ||
| 523 | if (!file_exists($dir."/simbolos".$tipo.".inc")) | 524 | if (!file_exists($dir."/simbolos".$tipo.".inc")) |
| 524 | { | 525 | { |
| 525 | $f = fopen($dir."/simbolos".$tipo.".inc","w"); | 526 | $f = fopen($dir."/simbolos".$tipo.".inc","w"); |
| 526 | - if ($tipo == 2){$t="simpol.map";} | ||
| 527 | - if ($tipo == 0){$t="simpt.map";} | 527 | + if ($tipo == 2){$t="simpolv".$versao.".map";} |
| 528 | + if ($tipo == 0){$t="simptv".$versao.".map";} | ||
| 528 | if ($tipo == 1){ | 529 | if ($tipo == 1){ |
| 529 | - $t="simlin.map"; | 530 | + $t="simlinv".$versao.".map"; |
| 530 | $tamanho = $tamanho / 4; | 531 | $tamanho = $tamanho / 4; |
| 531 | } | 532 | } |
| 532 | if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) | 533 | if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) |
| @@ -534,19 +535,22 @@ String no formato HTML com as imagens dos símbolos | @@ -534,19 +535,22 @@ String no formato HTML com as imagens dos símbolos | ||
| 534 | else | 535 | else |
| 535 | {$mapatemp = ms_newMapObj($this->localaplicacao."/aplicmap/".$t);} | 536 | {$mapatemp = ms_newMapObj($this->localaplicacao."/aplicmap/".$t);} |
| 536 | $ins = ""; | 537 | $ins = ""; |
| 537 | - $ns = $mapatemp->getnumsymbols(); | 538 | + |
| 538 | $l = $mapatemp->getlayer(0); | 539 | $l = $mapatemp->getlayer(0); |
| 539 | - $novoss = dirname($this->mapa->symbolsetfilename)."/".basename($mapatemp->symbolsetfilename); | 540 | + $novoss = dirname($this->mapa->symbolsetfilename)."\\".basename($mapatemp->symbolsetfilename); |
| 540 | $this->mapa->setsymbolset($novoss); | 541 | $this->mapa->setsymbolset($novoss); |
| 542 | + $ns = $this->mapa->getnumsymbols(); | ||
| 541 | for ($i=0;$i < $ns;++$i) | 543 | for ($i=0;$i < $ns;++$i) |
| 542 | { | 544 | { |
| 543 | $oSymbol = $this->mapa->getSymbolObjectById($i); | 545 | $oSymbol = $this->mapa->getSymbolObjectById($i); |
| 544 | $nomes = $oSymbol->name; | 546 | $nomes = $oSymbol->name; |
| 547 | + if($nomes == "") | ||
| 548 | + {$nomes = $i;} | ||
| 545 | $adiciona = ms_newLayerObj($this->mapa, $l); | 549 | $adiciona = ms_newLayerObj($this->mapa, $l); |
| 546 | $nomel = $l->name; | 550 | $nomel = $l->name; |
| 547 | $tematemp= $this->mapa->getlayerbyname($nomel); | 551 | $tematemp= $this->mapa->getlayerbyname($nomel); |
| 548 | $c = $tematemp->getClass(0); | 552 | $c = $tematemp->getClass(0); |
| 549 | - $e = $c->getstyle(0); | 553 | + $e = $c->getstyle(0); |
| 550 | $e->set("symbolname",$nomes); | 554 | $e->set("symbolname",$nomes); |
| 551 | $e->set("size",$tamanho); | 555 | $e->set("size",$tamanho); |
| 552 | $e->set("width",$width); | 556 | $e->set("width",$width); |
classesphp/classe_mapa.php
| @@ -59,7 +59,12 @@ class Mapa | @@ -59,7 +59,12 @@ class Mapa | ||
| 59 | Nome do arquivo de seleção (.qy) | 59 | Nome do arquivo de seleção (.qy) |
| 60 | */ | 60 | */ |
| 61 | public $qyfile; | 61 | public $qyfile; |
| 62 | + /* | ||
| 63 | + Variavel: $v | ||
| 62 | 64 | ||
| 65 | + Versão atual do Mapserver (primeiro dígito) | ||
| 66 | + */ | ||
| 67 | + public $v; | ||
| 63 | /* | 68 | /* |
| 64 | Function: __construct | 69 | Function: __construct |
| 65 | 70 | ||
| @@ -77,6 +82,8 @@ $map_file - Endereço do mapfile no servidor. | @@ -77,6 +82,8 @@ $map_file - Endereço do mapfile no servidor. | ||
| 77 | include_once($locaplic."/funcoes_gerais.php"); | 82 | include_once($locaplic."/funcoes_gerais.php"); |
| 78 | else | 83 | else |
| 79 | include_once("funcoes_gerais.php"); | 84 | include_once("funcoes_gerais.php"); |
| 85 | + $this->v = versao(); | ||
| 86 | + $this->v = $this->v["principal"]; | ||
| 80 | $this->qyfile = str_replace(".map",".qy",$map_file); | 87 | $this->qyfile = str_replace(".map",".qy",$map_file); |
| 81 | $this->locaplic = $locaplic; | 88 | $this->locaplic = $locaplic; |
| 82 | if(!file_exists($map_file)) | 89 | if(!file_exists($map_file)) |
| @@ -1677,7 +1684,10 @@ $arq - Nome do shape file. | @@ -1677,7 +1684,10 @@ $arq - Nome do shape file. | ||
| 1677 | if (file_exists($arq)) | 1684 | if (file_exists($arq)) |
| 1678 | { | 1685 | { |
| 1679 | $s = ms_newShapefileObj($arq,-1); | 1686 | $s = ms_newShapefileObj($arq,-1); |
| 1680 | - $shape = $s->getShape(0); | 1687 | + if($this->v == 6) |
| 1688 | + {$shape = $s->getshape(new resultObj(0));} | ||
| 1689 | + else | ||
| 1690 | + {$shape = $s->getshape(0);} | ||
| 1681 | $t = $shape->type; | 1691 | $t = $shape->type; |
| 1682 | $tipo = MS_LAYER_POLYGON; | 1692 | $tipo = MS_LAYER_POLYGON; |
| 1683 | if ($t == 0) | 1693 | if ($t == 0) |
classesphp/classe_selecao.php
| @@ -73,7 +73,13 @@ class Selecao | @@ -73,7 +73,13 @@ class Selecao | ||
| 73 | 73 | ||
| 74 | Objeto projection original do mapa. Obtido apenas na interface Googlemaps | 74 | Objeto projection original do mapa. Obtido apenas na interface Googlemaps |
| 75 | */ | 75 | */ |
| 76 | - public $projO; | 76 | + public $projO; |
| 77 | + /* | ||
| 78 | + Variavel: $v | ||
| 79 | + | ||
| 80 | + Versão atual do Mapserver (primeiro dígito) | ||
| 81 | + */ | ||
| 82 | + public $v; | ||
| 77 | /* | 83 | /* |
| 78 | Function: __construct | 84 | Function: __construct |
| 79 | 85 | ||
| @@ -92,6 +98,12 @@ $ext - extensão geográfica do mapa | @@ -92,6 +98,12 @@ $ext - extensão geográfica do mapa | ||
| 92 | 98 | ||
| 93 | function __construct($map_file,$tema="",$ext="") | 99 | function __construct($map_file,$tema="",$ext="") |
| 94 | { | 100 | { |
| 101 | + if(file_exists($locaplic."/funcoes_gerais.php")) | ||
| 102 | + include_once($locaplic."/funcoes_gerais.php"); | ||
| 103 | + else | ||
| 104 | + include_once("funcoes_gerais.php"); | ||
| 105 | + $this->v = versao(); | ||
| 106 | + $this->v = $this->v["principal"]; | ||
| 95 | $this->qyfile = str_replace(".map",".qy",$map_file); | 107 | $this->qyfile = str_replace(".map",".qy",$map_file); |
| 96 | if($tema != "") | 108 | if($tema != "") |
| 97 | {$this->qyfileTema = dirname($map_file)."/".$tema.".php";} | 109 | {$this->qyfileTema = dirname($map_file)."/".$tema.".php";} |
| @@ -271,9 +283,13 @@ $tipo - Tipo de operação adiciona|retira|inverte|limpa|novo | @@ -271,9 +283,13 @@ $tipo - Tipo de operação adiciona|retira|inverte|limpa|novo | ||
| 271 | $res_count = $layero->getNumresults(); | 283 | $res_count = $layero->getNumresults(); |
| 272 | for ($i = 0; $i < $res_count; ++$i) | 284 | for ($i = 0; $i < $res_count; ++$i) |
| 273 | { | 285 | { |
| 274 | - $result = $layero->getResult($i); | ||
| 275 | - $s = $result->shapeindex; | ||
| 276 | - $sh = $layero->getfeature($s,-1); | 286 | + if($this->v == 6) |
| 287 | + {$sh = $layero->getShape($layero->getResult($i));} | ||
| 288 | + else{ | ||
| 289 | + $result = $layero->getResult($i); | ||
| 290 | + $s = $result->shapeindex; | ||
| 291 | + $sh = $layero->getfeature($s,-1); | ||
| 292 | + } | ||
| 277 | $tiposh = $sh->type; | 293 | $tiposh = $sh->type; |
| 278 | if ($tiposh == 2) | 294 | if ($tiposh == 2) |
| 279 | {$ident = @$this->layer->querybyshape($sh);} | 295 | {$ident = @$this->layer->querybyshape($sh);} |
| @@ -326,9 +342,11 @@ $tipo - Tipo de operação adiciona|retira|inverte|limpa|novo | @@ -326,9 +342,11 @@ $tipo - Tipo de operação adiciona|retira|inverte|limpa|novo | ||
| 326 | $conta = $layero->getNumresults(); | 342 | $conta = $layero->getNumresults(); |
| 327 | for ($k = 0; $k < $conta; $k++) | 343 | for ($k = 0; $k < $conta; $k++) |
| 328 | { | 344 | { |
| 329 | - if (@$layero->getfeature($k,-1)) | ||
| 330 | - { | ||
| 331 | - $s = $layero->getfeature($k,-1); | 345 | + if($this->v == 6) |
| 346 | + {$s = @$layero->getShape($layero->getResult($k));} | ||
| 347 | + else | ||
| 348 | + {$s = @$layero->getfeature($k,-1);} | ||
| 349 | + if($s){ | ||
| 332 | if ($s->type == 2) | 350 | if ($s->type == 2) |
| 333 | { | 351 | { |
| 334 | $this->layer->querybyshape($s); | 352 | $this->layer->querybyshape($s); |
classesphp/classe_shp.php
| @@ -66,6 +66,12 @@ class SHP | @@ -66,6 +66,12 @@ class SHP | ||
| 66 | Indica se a biblioteca dbase está carregada | 66 | Indica se a biblioteca dbase está carregada |
| 67 | */ | 67 | */ |
| 68 | protected $dbaseExiste; | 68 | protected $dbaseExiste; |
| 69 | + /* | ||
| 70 | + Variavel: $v | ||
| 71 | + | ||
| 72 | + Versão atual do Mapserver (primeiro dígito) | ||
| 73 | + */ | ||
| 74 | + public $v; | ||
| 69 | 75 | ||
| 70 | /* | 76 | /* |
| 71 | function: __construct | 77 | function: __construct |
| @@ -82,7 +88,13 @@ $ext - extensao geográfica que será aplicada ao mapa | @@ -82,7 +88,13 @@ $ext - extensao geográfica que será aplicada ao mapa | ||
| 82 | */ | 88 | */ |
| 83 | function __construct($map_file,$tema="",$locaplic="",$ext="") | 89 | function __construct($map_file,$tema="",$locaplic="",$ext="") |
| 84 | { | 90 | { |
| 85 | - //error_reporting(E_ALL); | 91 | + if (!function_exists('ms_newMapObj')) {return false;} |
| 92 | + if(file_exists($locaplic."/funcoes_gerais.php")) | ||
| 93 | + include_once($locaplic."/funcoes_gerais.php"); | ||
| 94 | + else | ||
| 95 | + include_once("funcoes_gerais.php"); | ||
| 96 | + $this->v = versao(); | ||
| 97 | + $this->v = $this->v["principal"]; | ||
| 86 | $this->dbaseExiste = false; | 98 | $this->dbaseExiste = false; |
| 87 | if(function_exists("dbase_create")) | 99 | if(function_exists("dbase_create")) |
| 88 | {$this->dbaseExiste = true;} | 100 | {$this->dbaseExiste = true;} |
| @@ -383,9 +395,13 @@ array - xy | @@ -383,9 +395,13 @@ array - xy | ||
| 383 | $xy = array(); | 395 | $xy = array(); |
| 384 | for ($i = 0; $i < $res_count; ++$i) | 396 | for ($i = 0; $i < $res_count; ++$i) |
| 385 | { | 397 | { |
| 386 | - $result = $this->layer->getResult($i); | ||
| 387 | - $shp_index = $result->shapeindex; | ||
| 388 | - $shape = $this->layer->getfeature($shp_index,-1); | 398 | + if($this->v == 6) |
| 399 | + {$shape = $this->layer->getShape($this->layer->getResult($i));} | ||
| 400 | + else{ | ||
| 401 | + $result = $this->layer->getResult($i); | ||
| 402 | + $shp_index = $result->shapeindex; | ||
| 403 | + $shape = $this->layer->getfeature($shp_index,-1); | ||
| 404 | + } | ||
| 389 | $nlinhas = $shape->numlines; | 405 | $nlinhas = $shape->numlines; |
| 390 | for($j = 0;$j < $nlinhas; ++$j){ | 406 | for($j = 0;$j < $nlinhas; ++$j){ |
| 391 | $lin = $shape->line($j); | 407 | $lin = $shape->line($j); |
| @@ -415,10 +431,13 @@ array("layerprj"=>$xylayer,"mapprj"=>$xymapa) | @@ -415,10 +431,13 @@ array("layerprj"=>$xylayer,"mapprj"=>$xymapa) | ||
| 415 | $sopen = $this->layer->open(); | 431 | $sopen = $this->layer->open(); |
| 416 | if($sopen == MS_FAILURE){return "erro";} | 432 | if($sopen == MS_FAILURE){return "erro";} |
| 417 | $xy = array(); | 433 | $xy = array(); |
| 418 | - | ||
| 419 | - $result = $this->layer->getResult($res_count - 1); | ||
| 420 | - $shp_index = $result->shapeindex; | ||
| 421 | - $shape = $this->layer->getfeature($shp_index,-1); | 434 | + if($this->v == 6) |
| 435 | + {$shape = $this->layer->getShape($this->layer->getshape(new resultObj($res_count - 1)));} | ||
| 436 | + else{ | ||
| 437 | + $result = $this->layer->getResult($res_count - 1); | ||
| 438 | + $shp_index = $result->shapeindex; | ||
| 439 | + $shape = $this->layer->getfeature($shp_index,-1); | ||
| 440 | + } | ||
| 422 | $lin = $shape->line(0); | 441 | $lin = $shape->line(0); |
| 423 | $pt = $lin->point(0); | 442 | $pt = $lin->point(0); |
| 424 | $this->layer->close(); | 443 | $this->layer->close(); |
classesphp/classe_temas.php
| @@ -86,6 +86,12 @@ class Temas | @@ -86,6 +86,12 @@ class Temas | ||
| 86 | Nome do arquivo de seleção (.qy) | 86 | Nome do arquivo de seleção (.qy) |
| 87 | */ | 87 | */ |
| 88 | public $qyfile; | 88 | public $qyfile; |
| 89 | + /* | ||
| 90 | + Variavel: $v | ||
| 91 | + | ||
| 92 | + Versão atual do Mapserver (primeiro dígito) | ||
| 93 | + */ | ||
| 94 | + public $v; | ||
| 89 | /* | 95 | /* |
| 90 | function __construct | 96 | function __construct |
| 91 | 97 | ||
| @@ -109,6 +115,8 @@ $ext - (opcional) extensão geográfica que será aplicada ao mapa | @@ -109,6 +115,8 @@ $ext - (opcional) extensão geográfica que será aplicada ao mapa | ||
| 109 | include_once($locaplic."/funcoes_gerais.php"); | 115 | include_once($locaplic."/funcoes_gerais.php"); |
| 110 | else | 116 | else |
| 111 | include_once("funcoes_gerais.php"); | 117 | include_once("funcoes_gerais.php"); |
| 118 | + $this->v = versao(); | ||
| 119 | + $this->v = $this->v["principal"]; | ||
| 112 | $this->locaplic = $locaplic; | 120 | $this->locaplic = $locaplic; |
| 113 | if($map_file != "") | 121 | if($map_file != "") |
| 114 | { | 122 | { |
| @@ -783,9 +791,13 @@ $nome - nome que será dado a geometria | @@ -783,9 +791,13 @@ $nome - nome que será dado a geometria | ||
| 783 | for ($i = 0; $i < $res_count; ++$i) | 791 | for ($i = 0; $i < $res_count; ++$i) |
| 784 | { | 792 | { |
| 785 | $valitem = array(); | 793 | $valitem = array(); |
| 786 | - $result = $this->layer->getResult($i); | ||
| 787 | - $shp_index = $result->shapeindex; | ||
| 788 | - $shape = $this->layer->getfeature($shp_index,-1); | 794 | + if($this->v == 6) |
| 795 | + {$shape = $this->layer->getShape($this->layer->getResult($i));} | ||
| 796 | + else{ | ||
| 797 | + $result = $this->layer->getResult($i); | ||
| 798 | + $shp_index = $result->shapeindex; | ||
| 799 | + $shape = $this->layer->getfeature($shp_index,-1); | ||
| 800 | + } | ||
| 789 | foreach ($items as $item) | 801 | foreach ($items as $item) |
| 790 | { | 802 | { |
| 791 | $v = trim($shape->values[$item]); | 803 | $v = trim($shape->values[$item]); |
| @@ -1006,28 +1018,38 @@ Calcula a extensão geográfica dos elementos selecionados de um tema e ajusta o m | @@ -1006,28 +1018,38 @@ Calcula a extensão geográfica dos elementos selecionados de um tema e ajusta o m | ||
| 1006 | $res_count = $this->layer->getNumresults(); | 1018 | $res_count = $this->layer->getNumresults(); |
| 1007 | if($res_count > 0) | 1019 | if($res_count > 0) |
| 1008 | { | 1020 | { |
| 1009 | - $xmin = array(); | ||
| 1010 | - $xmax = array(); | ||
| 1011 | - $ymin = array(); | ||
| 1012 | - $ymax = array(); | ||
| 1013 | - for ($i = 0; $i < $res_count; ++$i) | ||
| 1014 | - { | ||
| 1015 | - $valitem = array(); | ||
| 1016 | - $result = $this->layer->getResult($i); | ||
| 1017 | - $shp_index = $result->shapeindex; | ||
| 1018 | - $shape = $this->layer->getfeature($shp_index,-1); | ||
| 1019 | - $bound = $shape->bounds; | ||
| 1020 | - $xmin[] = $bound->minx; | ||
| 1021 | - $xmax[] = $bound->maxx; | ||
| 1022 | - $ymin[] = $bound->miny; | ||
| 1023 | - $ymax[] = $bound->maxy; | 1021 | + $versao = versao(); |
| 1022 | + if($versao["principal"] == 6){ | ||
| 1023 | + $ret = $this->layer->getResultsBounds(); | ||
| 1024 | + } | ||
| 1025 | + else{ | ||
| 1026 | + $xmin = array(); | ||
| 1027 | + $xmax = array(); | ||
| 1028 | + $ymin = array(); | ||
| 1029 | + $ymax = array(); | ||
| 1030 | + for ($i = 0; $i < $res_count; ++$i) | ||
| 1031 | + { | ||
| 1032 | + $valitem = array(); | ||
| 1033 | + if($this->v == 6) | ||
| 1034 | + {$shape = $this->layer->getShape($this->layer->getResult($i));} | ||
| 1035 | + else{ | ||
| 1036 | + $result = $this->layer->getResult($i); | ||
| 1037 | + $shp_index = $result->shapeindex; | ||
| 1038 | + $shape = $this->layer->getfeature($shp_index,-1); | ||
| 1039 | + } | ||
| 1040 | + $bound = $shape->bounds; | ||
| 1041 | + $xmin[] = $bound->minx; | ||
| 1042 | + $xmax[] = $bound->maxx; | ||
| 1043 | + $ymin[] = $bound->miny; | ||
| 1044 | + $ymax[] = $bound->maxy; | ||
| 1045 | + } | ||
| 1046 | + $ret = ms_newRectObj(); | ||
| 1047 | + $ret->set("minx",min($xmin)); | ||
| 1048 | + $ret->set("miny",min($ymin)); | ||
| 1049 | + $ret->set("maxx",max($xmax)); | ||
| 1050 | + $ret->set("maxy",max($ymax)); | ||
| 1024 | } | 1051 | } |
| 1025 | $this->layer->close(); | 1052 | $this->layer->close(); |
| 1026 | - $ret = ms_newRectObj(); | ||
| 1027 | - $ret->set("minx",min($xmin)); | ||
| 1028 | - $ret->set("miny",min($ymin)); | ||
| 1029 | - $ret->set("maxx",max($xmax)); | ||
| 1030 | - $ret->set("maxy",max($ymax)); | ||
| 1031 | if (($prjTema != "") && ($prjMapa != $prjTema)) | 1053 | if (($prjTema != "") && ($prjMapa != $prjTema)) |
| 1032 | { | 1054 | { |
| 1033 | $projInObj = ms_newprojectionobj($prjTema); | 1055 | $projInObj = ms_newprojectionobj($prjTema); |
classesphp/funcoes_gerais.php
| @@ -1105,6 +1105,8 @@ function pegaValores($mapa,$layer,$item,$numerico=false,$ignorar="") | @@ -1105,6 +1105,8 @@ function pegaValores($mapa,$layer,$item,$numerico=false,$ignorar="") | ||
| 1105 | { | 1105 | { |
| 1106 | $layer->set("template","none.htm"); | 1106 | $layer->set("template","none.htm"); |
| 1107 | $layer->setfilter(""); | 1107 | $layer->setfilter(""); |
| 1108 | + $versao = versao(); | ||
| 1109 | + $versao = $versao["principal"]; | ||
| 1108 | if (@$layer->queryByrect($mapa->extent) == MS_SUCCESS) | 1110 | if (@$layer->queryByrect($mapa->extent) == MS_SUCCESS) |
| 1109 | { | 1111 | { |
| 1110 | $sopen = $layer->open(); | 1112 | $sopen = $layer->open(); |
| @@ -1113,9 +1115,13 @@ function pegaValores($mapa,$layer,$item,$numerico=false,$ignorar="") | @@ -1113,9 +1115,13 @@ function pegaValores($mapa,$layer,$item,$numerico=false,$ignorar="") | ||
| 1113 | $valitem = array(); | 1115 | $valitem = array(); |
| 1114 | for ($i=0;$i<$res_count;++$i) | 1116 | for ($i=0;$i<$res_count;++$i) |
| 1115 | { | 1117 | { |
| 1116 | - $result = $layer->getResult($i); | ||
| 1117 | - $shp_index = $result->shapeindex; | ||
| 1118 | - $shape = $layer->getfeature($shp_index,-1); | 1118 | + if($versao == 6) |
| 1119 | + {$shape = $layer->getShape($layer->getResult($i));} | ||
| 1120 | + else{ | ||
| 1121 | + $result = $layer->getResult($i); | ||
| 1122 | + $shp_index = $result->shapeindex; | ||
| 1123 | + $shape = $layer->getfeature($shp_index,-1); | ||
| 1124 | + } | ||
| 1119 | $v = trim($shape->values[$item]); | 1125 | $v = trim($shape->values[$item]); |
| 1120 | if ($numerico) | 1126 | if ($numerico) |
| 1121 | { | 1127 | { |
| @@ -1173,7 +1179,8 @@ Retorno: | @@ -1173,7 +1179,8 @@ Retorno: | ||
| 1173 | */ | 1179 | */ |
| 1174 | function pegaValoresM($mapa,$layer,$itens,$exclui="nulo",$selecionados="nao",$chaves=false,$centroide=false) | 1180 | function pegaValoresM($mapa,$layer,$itens,$exclui="nulo",$selecionados="nao",$chaves=false,$centroide=false) |
| 1175 | { | 1181 | { |
| 1176 | - //error_reporting(E_ALL); | 1182 | + $versao = versao(); |
| 1183 | + $versao = $versao["principal"]; | ||
| 1177 | $prjMapa = $mapa->getProjection(); | 1184 | $prjMapa = $mapa->getProjection(); |
| 1178 | $prjTema = $layer->getProjection(); | 1185 | $prjTema = $layer->getProjection(); |
| 1179 | $layer->set("template","none.htm"); | 1186 | $layer->set("template","none.htm"); |
| @@ -1204,12 +1211,18 @@ function pegaValoresM($mapa,$layer,$itens,$exclui="nulo",$selecionados="nao",$ch | @@ -1204,12 +1211,18 @@ function pegaValoresM($mapa,$layer,$itens,$exclui="nulo",$selecionados="nao",$ch | ||
| 1204 | 1211 | ||
| 1205 | for ($i=0;$i<$res_count;++$i) | 1212 | for ($i=0;$i<$res_count;++$i) |
| 1206 | { | 1213 | { |
| 1207 | - $result = $layer->getResult($i); | ||
| 1208 | - $shp_index = $result->shapeindex; | 1214 | + if($versao == 6){ |
| 1215 | + $shape = $layer->getShape($layer->getResult($i)); | ||
| 1216 | + $shp_index = $shape->index; | ||
| 1217 | + } | ||
| 1218 | + else{ | ||
| 1219 | + $result = $layer->getResult($i); | ||
| 1220 | + $shp_index = $result->shapeindex; | ||
| 1221 | + $shape = $layer->getfeature($shp_index,-1); | ||
| 1222 | + } | ||
| 1209 | if (($selecionados == "sim") && (array_search($shp_index,$indicesel) === FALSE)) | 1223 | if (($selecionados == "sim") && (array_search($shp_index,$indicesel) === FALSE)) |
| 1210 | {continue;} | 1224 | {continue;} |
| 1211 | $considera = "sim"; | 1225 | $considera = "sim"; |
| 1212 | - $shape = $layer->getfeature($shp_index,-1); | ||
| 1213 | //verifica se no registro deve ser considerado | 1226 | //verifica se no registro deve ser considerado |
| 1214 | if ($exclui != "nulo") | 1227 | if ($exclui != "nulo") |
| 1215 | { | 1228 | { |
| @@ -1804,6 +1817,8 @@ Retorno: | @@ -1804,6 +1817,8 @@ Retorno: | ||
| 1804 | */ | 1817 | */ |
| 1805 | function criaSHP($tema,$map_file,$locaplic,$dir_tmp,$nomeRand=TRUE) | 1818 | function criaSHP($tema,$map_file,$locaplic,$dir_tmp,$nomeRand=TRUE) |
| 1806 | { | 1819 | { |
| 1820 | + $versao = versao(); | ||
| 1821 | + $versao = $versao["principal"]; | ||
| 1807 | //para manipular dbf | 1822 | //para manipular dbf |
| 1808 | if(file_exists($locaplic."/pacotes/phpxbase/api_conversion.php")) | 1823 | if(file_exists($locaplic."/pacotes/phpxbase/api_conversion.php")) |
| 1809 | include_once($locaplic."/pacotes/phpxbase/api_conversion.php"); | 1824 | include_once($locaplic."/pacotes/phpxbase/api_conversion.php"); |
| @@ -1842,10 +1857,14 @@ function criaSHP($tema,$map_file,$locaplic,$dir_tmp,$nomeRand=TRUE) | @@ -1842,10 +1857,14 @@ function criaSHP($tema,$map_file,$locaplic,$dir_tmp,$nomeRand=TRUE) | ||
| 1842 | dbase_add_record($db,$reg); | 1857 | dbase_add_record($db,$reg); |
| 1843 | dbase_close($db); | 1858 | dbase_close($db); |
| 1844 | } | 1859 | } |
| 1845 | - $s = $layer->getfeature(0,-1); | ||
| 1846 | - $result = $layer->getResult(0); | ||
| 1847 | - $shpi = $result->shapeindex; | ||
| 1848 | - $shape = $layer->getfeature($shpi,-1); | 1860 | + if($versao == 6) |
| 1861 | + {$shape = $layer->getshape(new resultObj(0));} | ||
| 1862 | + else{ | ||
| 1863 | + $s = $layer->getfeature(0,-1); | ||
| 1864 | + $result = $layer->getResult(0); | ||
| 1865 | + $shpi = $result->shapeindex; | ||
| 1866 | + $shape = $layer->getfeature($shpi,-1); | ||
| 1867 | + } | ||
| 1849 | $novoshpf = ms_newShapefileObj($nomeshp.".shp", -2); | 1868 | $novoshpf = ms_newShapefileObj($nomeshp.".shp", -2); |
| 1850 | $novoshpf->addShape($shape); | 1869 | $novoshpf->addShape($shape); |
| 1851 | $novoshpf->free(); | 1870 | $novoshpf->free(); |
| @@ -1886,9 +1905,13 @@ function criaSHP($tema,$map_file,$locaplic,$dir_tmp,$nomeRand=TRUE) | @@ -1886,9 +1905,13 @@ function criaSHP($tema,$map_file,$locaplic,$dir_tmp,$nomeRand=TRUE) | ||
| 1886 | if($sopen == MS_FAILURE){return "erro";} | 1905 | if($sopen == MS_FAILURE){return "erro";} |
| 1887 | for ($i = 0; $i < $res_count; ++$i) | 1906 | for ($i = 0; $i < $res_count; ++$i) |
| 1888 | { | 1907 | { |
| 1889 | - $result = $layer->getResult($i); | ||
| 1890 | - $shp_index = $result->shapeindex; | ||
| 1891 | - $shape = $layer->getfeature($shp_index,-1); | 1908 | + if($versao == 6) |
| 1909 | + {$shape = $layer->getShape($layer->getResult($i));} | ||
| 1910 | + else{ | ||
| 1911 | + $result = $layer->getResult($i); | ||
| 1912 | + $shp_index = $result->shapeindex; | ||
| 1913 | + $shape = $layer->getfeature($shp_index,-1); | ||
| 1914 | + } | ||
| 1892 | foreach ($items as $ni) | 1915 | foreach ($items as $ni) |
| 1893 | { | 1916 | { |
| 1894 | $vreg = $shape->values[$ni]; | 1917 | $vreg = $shape->values[$ni]; |
classesphp/mapa_googlemaps.php
| @@ -263,10 +263,12 @@ if(trim($_GET["TIPOIMAGEM"]) != "" && trim($_GET["TIPOIMAGEM"]) != "nenhum") | @@ -263,10 +263,12 @@ if(trim($_GET["TIPOIMAGEM"]) != "" && trim($_GET["TIPOIMAGEM"]) != "nenhum") | ||
| 263 | } | 263 | } |
| 264 | else{ | 264 | else{ |
| 265 | if($cache == true) | 265 | if($cache == true) |
| 266 | - {salvaCacheImagem($_GET["BBOX"],$nomecache,$map_fileX,$_GET["WIDTH"],$_GET["HEIGHT"]);} | 266 | + {$nomer = salvaCacheImagem($_GET["BBOX"],$nomecache,$map_fileX,$_GET["WIDTH"],$_GET["HEIGHT"]);} |
| 267 | + else{ | ||
| 268 | + $nomer = ($img->imagepath)."imgtemp".nomeRandomico().".png"; | ||
| 269 | + $img->saveImage($nomer); | ||
| 270 | + } | ||
| 267 | ob_clean(); | 271 | ob_clean(); |
| 268 | - $nomer = ($img->imagepath)."imgtemp".nomeRandomico().".png"; | ||
| 269 | - $img->saveImage($nomer); | ||
| 270 | $img = imagecreatefrompng($nomer); | 272 | $img = imagecreatefrompng($nomer); |
| 271 | imagealphablending($img, false); | 273 | imagealphablending($img, false); |
| 272 | imagesavealpha($img, true); | 274 | imagesavealpha($img, true); |
| @@ -286,6 +288,7 @@ function salvaCacheImagem($bbox,$layer,$map,$w,$h){ | @@ -286,6 +288,7 @@ function salvaCacheImagem($bbox,$layer,$map,$w,$h){ | ||
| 286 | $nome = $nomedir."/".$w.$h.$bbox.".png"; | 288 | $nome = $nomedir."/".$w.$h.$bbox.".png"; |
| 287 | if(!file_exists($nome)) | 289 | if(!file_exists($nome)) |
| 288 | {$img->saveImage($nome);} | 290 | {$img->saveImage($nome);} |
| 291 | + return $nome; | ||
| 289 | } | 292 | } |
| 290 | function carregaCacheImagem($bbox,$layer,$map,$w,$h){ | 293 | function carregaCacheImagem($bbox,$layer,$map,$w,$h){ |
| 291 | if($layer == "copyright" || $layer == "") | 294 | if($layer == "copyright" || $layer == "") |
classesphp/mapa_inicia.php
| @@ -223,16 +223,18 @@ function iniciaMapa() | @@ -223,16 +223,18 @@ function iniciaMapa() | ||
| 223 | $l->set("status",MS_DELETE); | 223 | $l->set("status",MS_DELETE); |
| 224 | } | 224 | } |
| 225 | $of = $mf->outputformat; | 225 | $of = $mf->outputformat; |
| 226 | + $of->set("driver","GD/PNG"); | ||
| 227 | + /* | ||
| 226 | $versao = versao(); | 228 | $versao = versao(); |
| 227 | if($versao["principal"] == 6) | 229 | if($versao["principal"] == 6) |
| 228 | {$of->set("driver","GD/PNG");} | 230 | {$of->set("driver","GD/PNG");} |
| 229 | else | 231 | else |
| 230 | {$of->set("driver","AGG/PNG");} | 232 | {$of->set("driver","AGG/PNG");} |
| 231 | - | ||
| 232 | - | 233 | + */ |
| 233 | $temp = $mf->scalebar; | 234 | $temp = $mf->scalebar; |
| 234 | $temp->set("status",MS_OFF); | 235 | $temp->set("status",MS_OFF); |
| 235 | $mf->save($nomefundo); | 236 | $mf->save($nomefundo); |
| 237 | + // | ||
| 236 | $temp = $m->mapa->scalebar; | 238 | $temp = $m->mapa->scalebar; |
| 237 | $temp->set("status",MS_OFF); | 239 | $temp->set("status",MS_OFF); |
| 238 | $of = $m->mapa->outputformat; | 240 | $of = $m->mapa->outputformat; |
classesphp/mapa_openlayers.php
| @@ -255,15 +255,16 @@ if(trim($_GET["TIPOIMAGEM"]) != "" && trim($_GET["TIPOIMAGEM"]) != "nenhum") | @@ -255,15 +255,16 @@ if(trim($_GET["TIPOIMAGEM"]) != "" && trim($_GET["TIPOIMAGEM"]) != "nenhum") | ||
| 255 | } | 255 | } |
| 256 | else{ | 256 | else{ |
| 257 | if($cache == true) | 257 | if($cache == true) |
| 258 | - {salvaCacheImagem($_GET["BBOX"],$nomecache,$map_fileX,$_GET["WIDTH"],$_GET["HEIGHT"]);} | 258 | + {$nomer = salvaCacheImagem($_GET["BBOX"],$nomecache,$map_fileX,$_GET["WIDTH"],$_GET["HEIGHT"]);} |
| 259 | + else{ | ||
| 260 | + $nomer = ($img->imagepath)."imgtemp".nomeRandomico().".png"; | ||
| 261 | + $img->saveImage($nomer); | ||
| 262 | + } | ||
| 259 | ob_clean(); | 263 | ob_clean(); |
| 260 | - $nomer = ($img->imagepath)."imgtemp".nomeRandomico().".png"; | ||
| 261 | - $img->saveImage($nomer); | ||
| 262 | $img = imagecreatefrompng($nomer); | 264 | $img = imagecreatefrompng($nomer); |
| 263 | imagealphablending($img, false); | 265 | imagealphablending($img, false); |
| 264 | imagesavealpha($img, true); | 266 | imagesavealpha($img, true); |
| 265 | ob_clean(); | 267 | ob_clean(); |
| 266 | - | ||
| 267 | echo header("Content-type: image/png \n\n"); | 268 | echo header("Content-type: image/png \n\n"); |
| 268 | imagepng($img); | 269 | imagepng($img); |
| 269 | imagedestroy($img); | 270 | imagedestroy($img); |
| @@ -284,6 +285,7 @@ function salvaCacheImagem($bbox,$layer,$map,$w,$h){ | @@ -284,6 +285,7 @@ function salvaCacheImagem($bbox,$layer,$map,$w,$h){ | ||
| 284 | $img->saveImage($nome); | 285 | $img->saveImage($nome); |
| 285 | chmod($nome,0777); | 286 | chmod($nome,0777); |
| 286 | } | 287 | } |
| 288 | + return $nome; | ||
| 287 | } | 289 | } |
| 288 | function carregaCacheImagem($bbox,$layer,$map,$w,$h){ | 290 | function carregaCacheImagem($bbox,$layer,$map,$w,$h){ |
| 289 | if($layer == "copyright" || $layer == "") | 291 | if($layer == "copyright" || $layer == "") |