Commit 2370becf57d26b69e685547dd0e511b187554182
1 parent
a183f4f9
Exists in
master
and in
7 other branches
Incluida opção de download das imagens geradas nas funções de análise de distribuição de pontos
Showing
3 changed files
with
45 additions
and
25 deletions
Show diff stats
classesphp/classe_analise.php
@@ -194,6 +194,7 @@ Include: | @@ -194,6 +194,7 @@ Include: | ||
194 | $novolayer = criaLayer($this->mapa,MS_LAYER_RASTER,MS_DEFAULT,($tipo." (".$this->nome.")"),$metaClasse="SIM"); | 194 | $novolayer = criaLayer($this->mapa,MS_LAYER_RASTER,MS_DEFAULT,($tipo." (".$this->nome.")"),$metaClasse="SIM"); |
195 | $novolayer->set("data",$nomearq.".png"); | 195 | $novolayer->set("data",$nomearq.".png"); |
196 | $novolayer->set("template","none.htm"); | 196 | $novolayer->set("template","none.htm"); |
197 | + $novolayer->setmetadata("download","sim"); | ||
197 | //classes | 198 | //classes |
198 | $numclassesatual = $novolayer->numclasses; | 199 | $numclassesatual = $novolayer->numclasses; |
199 | for ($i=0; $i < $numclassesatual; $i++) | 200 | for ($i=0; $i < $numclassesatual; $i++) |
classesphp/funcoes_gerais.php
@@ -1434,31 +1434,43 @@ function downloadTema($map_file,$tema,$locaplic,$dir_tmp) | @@ -1434,31 +1434,43 @@ function downloadTema($map_file,$tema,$locaplic,$dir_tmp) | ||
1434 | { | 1434 | { |
1435 | $l = $map->getlayerbyname($tema); | 1435 | $l = $map->getlayerbyname($tema); |
1436 | $dados = $l->data; | 1436 | $dados = $l->data; |
1437 | - $sp = $map->shapepath; | ||
1438 | - $arq = ""; | ||
1439 | - if (file_exists($dados)) | ||
1440 | - {$arq = $dados;} | ||
1441 | - if (file_exists($dados.".shp")) | ||
1442 | - {$arq = $dados.".shp";} | ||
1443 | - if (file_exists($sp.$dados.".shp")) | ||
1444 | - {$arq = $sp.$dados.".shp";} | ||
1445 | - if (file_exists($sp.$dados)) | ||
1446 | - {$arq = $sp.$dados;} | ||
1447 | - if ($arq != "") | 1437 | + if($l->type == MS_LAYER_RASTER) |
1448 | { | 1438 | { |
1449 | - //$diretorio = dirname($map_file); | ||
1450 | - $novonomelayer = nomeRandomico(20); | ||
1451 | - $nomeshp = $dir_tmp."/".$novonomelayer; | ||
1452 | - $arq = explode(".shp",$arq); | ||
1453 | - copy($arq[0].".shp",$nomeshp.".shp"); | ||
1454 | - copy($arq[0].".shx",$nomeshp.".shx"); | ||
1455 | - copy($arq[0].".dbf",$nomeshp.".dbf"); | ||
1456 | - $resultado[] = str_replace($radtmp,"",$nomeshp); | 1439 | + if (file_exists($dados)) |
1440 | + { | ||
1441 | + $arq = basename($dados); | ||
1442 | + $resultado[] = str_replace("/img","/",$map->web->imageurl).$arq; | ||
1443 | + $arq = explode(".",$arq); | ||
1444 | + $resultado[] = str_replace("/img","/",$map->web->imageurl).$arq[0].".wld"; | ||
1445 | + } | ||
1457 | } | 1446 | } |
1458 | else | 1447 | else |
1459 | { | 1448 | { |
1460 | - $restemp = criaSHP($tema,$map_file,$locaplic,$dir_tmp); | ||
1461 | - $resultado[] = str_replace($radtmp,"",$restemp); | 1449 | + $sp = $map->shapepath; |
1450 | + $arq = ""; | ||
1451 | + if (file_exists($dados)) | ||
1452 | + {$arq = $dados;} | ||
1453 | + if (file_exists($dados.".shp")) | ||
1454 | + {$arq = $dados.".shp";} | ||
1455 | + if (file_exists($sp.$dados.".shp")) | ||
1456 | + {$arq = $sp.$dados.".shp";} | ||
1457 | + if (file_exists($sp.$dados)) | ||
1458 | + {$arq = $sp.$dados;} | ||
1459 | + if ($arq != "") | ||
1460 | + { | ||
1461 | + $novonomelayer = nomeRandomico(20); | ||
1462 | + $nomeshp = $dir_tmp."/".$novonomelayer; | ||
1463 | + $arq = explode(".shp",$arq); | ||
1464 | + copy($arq[0].".shp",$nomeshp.".shp"); | ||
1465 | + copy($arq[0].".shx",$nomeshp.".shx"); | ||
1466 | + copy($arq[0].".dbf",$nomeshp.".dbf"); | ||
1467 | + $resultado[] = str_replace($radtmp,"",$nomeshp); | ||
1468 | + } | ||
1469 | + else | ||
1470 | + { | ||
1471 | + $restemp = criaSHP($tema,$map_file,$locaplic,$dir_tmp); | ||
1472 | + $resultado[] = str_replace($radtmp,"",$restemp); | ||
1473 | + } | ||
1462 | } | 1474 | } |
1463 | } | 1475 | } |
1464 | return(implode(",",$resultado)); | 1476 | return(implode(",",$resultado)); |
ferramentas/download/index.js
@@ -42,10 +42,17 @@ function mostraDownload(retorno) | @@ -42,10 +42,17 @@ function mostraDownload(retorno) | ||
42 | for (arq=0;arq<arqs.length;arq++) | 42 | for (arq=0;arq<arqs.length;arq++) |
43 | { | 43 | { |
44 | var temp = arqs[arq].split("."); | 44 | var temp = arqs[arq].split("."); |
45 | - arqs[arq] = temp[0]; | ||
46 | - ins += "<a href='"+window.location.protocol+"//"+window.location.host+arqs[arq]+".shp'>"+arqs[arq]+".shp<br>" | ||
47 | - ins += "<a href='"+window.location.protocol+"//"+window.location.host+arqs[arq]+".dbf'>"+arqs[arq]+".dbf<br>" | ||
48 | - ins += "<a href='"+window.location.protocol+"//"+window.location.host+arqs[arq]+".shx'>"+arqs[arq]+".shx<br><br>" | 45 | + if ((temp[1] == "png") || (temp[1] == "tif") || (temp[1] == "wld")) |
46 | + { | ||
47 | + ins += "<a href='"+window.location.protocol+"//"+window.location.host+arqs[arq]+"'>"+arqs[arq]+"<br>" | ||
48 | + } | ||
49 | + else | ||
50 | + { | ||
51 | + arqs[arq] = temp[0]; | ||
52 | + ins += "<a href='"+window.location.protocol+"//"+window.location.host+arqs[arq]+".shp'>"+arqs[arq]+".shp<br>" | ||
53 | + ins += "<a href='"+window.location.protocol+"//"+window.location.host+arqs[arq]+".dbf'>"+arqs[arq]+".dbf<br>" | ||
54 | + ins += "<a href='"+window.location.protocol+"//"+window.location.host+arqs[arq]+".shx'>"+arqs[arq]+".shx<br><br>" | ||
55 | + } | ||
49 | } | 56 | } |
50 | $i("resultado").innerHTML = ins | 57 | $i("resultado").innerHTML = ins |
51 | } | 58 | } |