Commit f8bab1e88c08140df7483d42b7af939ea7bd800c
1 parent
965f17fc
Exists in
master
and in
7 other branches
--no commit message
Showing
3 changed files
with
19 additions
and
3 deletions
Show diff stats
admin/admin.db
No preview for this file type
classesphp/classe_selecao.php
@@ -789,8 +789,11 @@ $dir_tmp - localização do diretório temporário | @@ -789,8 +789,11 @@ $dir_tmp - localização do diretório temporário | ||
789 | { | 789 | { |
790 | if(!$this->layer){return "erro";} | 790 | if(!$this->layer){return "erro";} |
791 | $this->layer->setfilter(""); | 791 | $this->layer->setfilter(""); |
792 | - $nomeshp = criaSHP($this->nome,$this->arquivo,$locaplic,$dir_tmp); | 792 | + $nomeshp = criaSHP($this->nome,$this->arquivo,$locaplic,$dir_tmp,true,"",false); |
793 | $novolayer = criaLayer($this->mapa,$this->layer->type,MS_DEFAULT,"Seleção de ".(pegaNome($this->layer))." (".$this->nome.")",$metaClasse="SIM"); | 793 | $novolayer = criaLayer($this->mapa,$this->layer->type,MS_DEFAULT,"Seleção de ".(pegaNome($this->layer))." (".$this->nome.")",$metaClasse="SIM"); |
794 | + if($this->layer->getprojection() != ""){ | ||
795 | + $novolayer->setprojection($this->layer->getprojection()); | ||
796 | + } | ||
794 | $novolayer->set("data",$nomeshp.".shp"); | 797 | $novolayer->set("data",$nomeshp.".shp"); |
795 | $novolayer->set("name",basename($nomeshp)); | 798 | $novolayer->set("name",basename($nomeshp)); |
796 | $down = "nao"; | 799 | $down = "nao"; |
classesphp/funcoes_gerais.php
@@ -1397,11 +1397,13 @@ $nomeRand {boleano} - Gera um nome randomico para o shapefile (TRUE) ou utiliza | @@ -1397,11 +1397,13 @@ $nomeRand {boleano} - Gera um nome randomico para o shapefile (TRUE) ou utiliza | ||
1397 | 1397 | ||
1398 | $prj {string} - String que sera gravada no arquivo prj | 1398 | $prj {string} - String que sera gravada no arquivo prj |
1399 | 1399 | ||
1400 | +$projetaToMap {boolean} - Projeta os shapes para a projecao do mapa | ||
1401 | + | ||
1400 | Retorno: | 1402 | Retorno: |
1401 | 1403 | ||
1402 | {string} - nome do arquivo criado ou false se ocorrer erro | 1404 | {string} - nome do arquivo criado ou false se ocorrer erro |
1403 | */ | 1405 | */ |
1404 | -function criaSHP($tema,$map_file,$locaplic,$dir_tmp,$nomeRand=TRUE,$prj="") | 1406 | +function criaSHP($tema,$map_file,$locaplic,$dir_tmp,$nomeRand=TRUE,$prj="",$projetaToMap=true) |
1405 | { | 1407 | { |
1406 | $versao = versao(); | 1408 | $versao = versao(); |
1407 | $versao = $versao["principal"]; | 1409 | $versao = $versao["principal"]; |
@@ -1510,7 +1512,9 @@ function criaSHP($tema,$map_file,$locaplic,$dir_tmp,$nomeRand=TRUE,$prj="") | @@ -1510,7 +1512,9 @@ function criaSHP($tema,$map_file,$locaplic,$dir_tmp,$nomeRand=TRUE,$prj="") | ||
1510 | if ($res_count > 0){ | 1512 | if ($res_count > 0){ |
1511 | for ($i = 0; $i < $res_count; ++$i){ | 1513 | for ($i = 0; $i < $res_count; ++$i){ |
1512 | $shape = $shapesSel[$i]; | 1514 | $shape = $shapesSel[$i]; |
1513 | - $shape->project($projInObj, $projOutObj); | 1515 | + if($projetaToMap == true){ |
1516 | + $shape->project($projInObj, $projOutObj); | ||
1517 | + } | ||
1514 | foreach ($items as $ni){ | 1518 | foreach ($items as $ni){ |
1515 | $vreg = $shape->values[$ni]; | 1519 | $vreg = $shape->values[$ni]; |
1516 | if(strlen($vreg) > 255){ | 1520 | if(strlen($vreg) > 255){ |
@@ -1570,6 +1574,15 @@ function criaSHP($tema,$map_file,$locaplic,$dir_tmp,$nomeRand=TRUE,$prj="") | @@ -1570,6 +1574,15 @@ function criaSHP($tema,$map_file,$locaplic,$dir_tmp,$nomeRand=TRUE,$prj="") | ||
1570 | if($prj != ""){ | 1574 | if($prj != ""){ |
1571 | gravaDados(array($prj),$nomeshp.".prj"); | 1575 | gravaDados(array($prj),$nomeshp.".prj"); |
1572 | } | 1576 | } |
1577 | + //se prj for vazio mas existir o arquivo prj original e a projecao do shape nao estiver ativa | ||
1578 | + //copia o arquivo prj original se existir | ||
1579 | + elseif ($projetaToMap == false){ | ||
1580 | + $nomePrjOriginal = str_replace(".shp",".prj",$layer->data); | ||
1581 | + $nomeDestino = $nomeshp.".prj"; | ||
1582 | + if(file_exists($nomePrjOriginal) && !file_exists($nomeDestino)){ | ||
1583 | + copy($nomePrjOriginal,$nomeDestino); | ||
1584 | + } | ||
1585 | + } | ||
1573 | return $nomeshp; | 1586 | return $nomeshp; |
1574 | } | 1587 | } |
1575 | } | 1588 | } |