Commit d19fda6f3edbae12a001dff6c9a19d687a0b3215
1 parent
e8f17d64
Exists in
master
Correção na lista de links da ferramenta de download de arquivos. Remoção do lin…
…k para mapfile e correção no link para geração de sld
Showing
1 changed file
with
19 additions
and
7 deletions
Show diff stats
classesphp/classe_temas.php
@@ -45,6 +45,12 @@ class Temas | @@ -45,6 +45,12 @@ class Temas | ||
45 | */ | 45 | */ |
46 | public $mapa; | 46 | public $mapa; |
47 | /* | 47 | /* |
48 | + Variavel: $tema | ||
49 | + | ||
50 | + String | ||
51 | + */ | ||
52 | + public $tema; | ||
53 | + /* | ||
48 | Variavel: $arquivo | 54 | Variavel: $arquivo |
49 | 55 | ||
50 | Arquivo map file | 56 | Arquivo map file |
@@ -120,21 +126,24 @@ $ext - (opcional) extensão geográfica que será aplicada ao | @@ -120,21 +126,24 @@ $ext - (opcional) extensão geográfica que será aplicada ao | ||
120 | //error_reporting(0); | 126 | //error_reporting(0); |
121 | include(dirname(__FILE__)."/../ms_configura.php"); | 127 | include(dirname(__FILE__)."/../ms_configura.php"); |
122 | $this->postgis_mapa = $postgis_mapa; | 128 | $this->postgis_mapa = $postgis_mapa; |
129 | + if($map_file != ""){ | ||
130 | + $map_file = str_replace(".map","",$map_file).".map"; | ||
131 | + $this->qyfile = str_replace(".map",".qy",$map_file); | ||
132 | + $this->arquivo = $map_file; | ||
133 | + } | ||
123 | 134 | ||
124 | - $map_file = str_replace(".map","",$map_file).".map"; | ||
125 | - $this->qyfile = str_replace(".map",".qy",$map_file); | ||
126 | - $this->arquivo = $map_file; | ||
127 | if(file_exists($locaplic."/funcoes_gerais.php")) | 135 | if(file_exists($locaplic."/funcoes_gerais.php")) |
128 | include_once($locaplic."/funcoes_gerais.php"); | 136 | include_once($locaplic."/funcoes_gerais.php"); |
129 | else | 137 | else |
130 | include_once("funcoes_gerais.php"); | 138 | include_once("funcoes_gerais.php"); |
131 | 139 | ||
140 | + $this->tema = $tema; | ||
132 | $this->v = versao(); | 141 | $this->v = versao(); |
133 | $this->vi = $this->v["inteiro"]; | 142 | $this->vi = $this->v["inteiro"]; |
134 | $this->v = $this->v["principal"]; | 143 | $this->v = $this->v["principal"]; |
135 | 144 | ||
136 | $this->locaplic = $locaplic; | 145 | $this->locaplic = $locaplic; |
137 | - if($map_file != "") | 146 | + if($map_file != "" && file_exists($map_file)) |
138 | { | 147 | { |
139 | $this->mapa = ms_newMapObj($map_file); | 148 | $this->mapa = ms_newMapObj($map_file); |
140 | substituiConObj($this->mapa,$postgis_mapa); | 149 | substituiConObj($this->mapa,$postgis_mapa); |
@@ -1126,9 +1135,12 @@ function: sld | @@ -1126,9 +1135,12 @@ function: sld | ||
1126 | 1135 | ||
1127 | Retorna o SLD correspondente a legenda do tema. | 1136 | Retorna o SLD correspondente a legenda do tema. |
1128 | */ | 1137 | */ |
1129 | - function sld() | ||
1130 | - { | ||
1131 | - if(!$this->layer){return "erro";} | 1138 | + function sld(){ |
1139 | + if(!$this->layer){ | ||
1140 | + //pega o arquivo na pasta temas pois pode ser que esteja tentando gerar o sld diretamente desse arquivo ja que layer nao foi definido | ||
1141 | + $mapa = ms_newMapObj($this->locaplic."/temas/".$this->tema.".map"); | ||
1142 | + $this->layer = $mapa->getlayerbyname($this->tema); | ||
1143 | + } | ||
1132 | $this->layer->set("status",MS_DEFAULT); | 1144 | $this->layer->set("status",MS_DEFAULT); |
1133 | return $this->layer->generateSLD(); | 1145 | return $this->layer->generateSLD(); |
1134 | } | 1146 | } |