Commit 68f06a619ee32abd07e1067f063fb0559eba2ced
1 parent
b1587e7c
Exists in
master
and in
7 other branches
Inclusão de link para abrir a legenda e o mapfile no datadownload.htm
Showing
4 changed files
with
26 additions
and
25 deletions
Show diff stats
classesjs/datadownload.js
... | ... | @@ -327,6 +327,9 @@ function mostraDownload(retorno) |
327 | 327 | else |
328 | 328 | { |
329 | 329 | var ins = "<b>Clique nos links para pegar os arquivos.</b><br><br>" |
330 | + ins += "<a href='"+window.location.protocol+"//"+window.location.host+"/"+retorno.mapfileurl+"' target=blank >Arquivo de configuração Mapfile</a><br>"; | |
331 | + ins += "<a href='"+g_locaplic+"/classesphp/mapa_controle.php?funcao=TEMA2SLD&tema="+retorno.tema+"&map_file="+retorno.mapfile+"' target=blank >Arquivo de legenda SLD</a><br><br>"; | |
332 | + | |
330 | 333 | for (var arq=0;arq<n;arq++) |
331 | 334 | { |
332 | 335 | ins += "<a href='"+window.location.protocol+"//"+window.location.host+"/"+arqs[arq]+"'>"+arqs[arq]+"</a><br>" |
... | ... | @@ -334,7 +337,6 @@ function mostraDownload(retorno) |
334 | 337 | ins += "<br><a href='"+g_locaplic+"/fontetema.php?tema="+temaEscolhidoDownload+"' target=blank >Fonte</a>"; |
335 | 338 | if(retorno.nreg) |
336 | 339 | {ins += "<br><br>Número de registros ="+retorno.nreg;} |
337 | - | |
338 | 340 | } |
339 | 341 | } |
340 | 342 | else | ... | ... |
classesphp/classe_temas.php
classesphp/funcoes_gerais.php
... | ... | @@ -2026,7 +2026,6 @@ function downloadTema2($map_file,$tema,$locaplic,$dir_tmp,$postgis_mapa) |
2026 | 2026 | $base = ""; |
2027 | 2027 | if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) |
2028 | 2028 | {$base = $locaplic."/aplicmap/geral1windowsv".$versao.".map";} |
2029 | - | |
2030 | 2029 | else |
2031 | 2030 | { |
2032 | 2031 | if($base == "" && file_exists('/var/www/i3geo/aplicmap/geral1debianv'.$versao.'.map')){ |
... | ... | @@ -2059,6 +2058,7 @@ function downloadTema2($map_file,$tema,$locaplic,$dir_tmp,$postgis_mapa) |
2059 | 2058 | // |
2060 | 2059 | $temasdir = $locaplic."/temas"; |
2061 | 2060 | $map = ms_newMapObj($map_file); |
2061 | + $rectextent = $map->extent; | |
2062 | 2062 | // |
2063 | 2063 | //problema aqui |
2064 | 2064 | //$tema pode ser diferente do nome do mapfile |
... | ... | @@ -2201,24 +2201,7 @@ function downloadTema2($map_file,$tema,$locaplic,$dir_tmp,$postgis_mapa) |
2201 | 2201 | {$arq = $sp.$dados.".shp";} |
2202 | 2202 | if (file_exists($sp.$dados)) |
2203 | 2203 | {$arq = $sp.$dados;} |
2204 | - // | |
2205 | - //se o tema usa um arquivo shapefile, apenas faz a cópia | |
2206 | - // | |
2207 | - /* | |
2208 | - if ($arq != "") | |
2209 | - { | |
2210 | - $arq = explode(".shp",$arq); | |
2211 | - if(!file_exists($nomeshp.".shp")) | |
2212 | - { | |
2213 | - copy($arq[0].".shp",$nomeshp.".shp"); | |
2214 | - copy($arq[0].".shx",$nomeshp.".shx"); | |
2215 | - copy($arq[0].".dbf",$nomeshp.".dbf"); | |
2216 | - } | |
2217 | - $resultado[] = basename($dir_tmp)."/".$novonomelayer.".shp"; | |
2218 | - $resultado[] = basename($dir_tmp)."/".$novonomelayer.".dbf"; | |
2219 | - $resultado[] = basename($dir_tmp)."/".$novonomelayer.".shx"; | |
2220 | - } | |
2221 | - */ | |
2204 | + | |
2222 | 2205 | $nomeshp = criaSHP($tema,$map_file,$locaplic,$dir_tmp,$nomeRand); |
2223 | 2206 | if($nomeshp == false) |
2224 | 2207 | {return array("arquivos"=>"<span style=color:red >Ocorreu um erro, tente novamente","nreg"=>0);} |
... | ... | @@ -2240,8 +2223,23 @@ function downloadTema2($map_file,$tema,$locaplic,$dir_tmp,$postgis_mapa) |
2240 | 2223 | if($db){$nreg = xbase_numrecords($db);} |
2241 | 2224 | } |
2242 | 2225 | } |
2243 | - return array("arquivos"=>implode(",",$resultado),"nreg"=>$nreg); | |
2244 | - | |
2226 | + // | |
2227 | + //gera um mapfile para download | |
2228 | + // | |
2229 | + $maptemp = ms_newMapObj($temasdir."/".$tema.".map"); | |
2230 | + $temas = $maptemp->getAllLayerNames(); | |
2231 | + foreach ($temas as $l) | |
2232 | + { | |
2233 | + $gl = $maptemp->getlayerbyname($l); | |
2234 | + $gl->set("data",""); | |
2235 | + $gl->set("connection",""); | |
2236 | + } | |
2237 | + $nomemapfile = $dir_tmp."/".nomerandomico(20)."download.map"; | |
2238 | + $ext = $maptemp->extent; | |
2239 | + $ext->setextent($rectextent->minx,$rectextent->miny,$rectextent->maxx,$rectextent->maxy); | |
2240 | + $maptemp->save($nomemapfile); | |
2241 | + $nomemapfileurl = str_replace($radtmp."/","",$nomemapfile); | |
2242 | + return array("tema"=>$tema,"mapfile"=>$nomemapfile,"mapfileurl"=>$nomemapfileurl,"arquivos"=>implode(",",$resultado),"nreg"=>$nreg); | |
2245 | 2243 | } |
2246 | 2244 | |
2247 | 2245 | /* | ... | ... |
classesphp/mapa_controle.php
... | ... | @@ -111,8 +111,9 @@ include_once("pega_variaveis.php"); |
111 | 111 | $interfaceTemp = $interface; |
112 | 112 | // |
113 | 113 | //inicializa a sessão |
114 | +//TEMA2SLD é usado por datadownload.htm | |
114 | 115 | // |
115 | -if ($funcao != "criaMapa") | |
116 | +if ($funcao != "criaMapa" && $funcao != "TEMA2SLD") | |
116 | 117 | { |
117 | 118 | session_name("i3GeoPHP"); |
118 | 119 | if (isset($g_sid) && $g_sid != "") |
... | ... | @@ -215,7 +216,7 @@ if(!isset($locaplic)){ |
215 | 216 | // |
216 | 217 | //substitui a string de conexão |
217 | 218 | // |
218 | -if($funcao != "recuperamapa") | |
219 | +if($funcao != "recuperamapa" && $funcao != "TEMA2SLD") | |
219 | 220 | { |
220 | 221 | if(!substituiCon($map_file,$postgis_mapa)) |
221 | 222 | { |
... | ... | @@ -229,7 +230,6 @@ if($funcao != "recuperamapa") |
229 | 230 | //faz a busca da função que deve ser executada |
230 | 231 | // |
231 | 232 | $retorno = ""; //string que será retornada ao browser via JSON |
232 | - | |
233 | 233 | switch (strtoupper($funcao)) |
234 | 234 | { |
235 | 235 | /* | ... | ... |