Commit def0fc5fc75d4f4bb8bf0ba9850ee25c0c8b20f0

Authored by Edmar Moretti
1 parent 454d3d3b

--no commit message

pacotes/tme/TME_Engine.php
... ... @@ -90,7 +90,7 @@ class ThematicMap
90 90 $this->mapType = $paramArray['mapType']; // Mapping technique
91 91 $this->indicatorID = $paramArray['indicator']; // Main indicator
92 92 $this->year = $paramArray['year']; // Year
93   -
  93 + $this->dirtmp = $paramArray['dirtmp'];
94 94 // Extract indicator metadata and values from dataStore
95 95 $this->indicator = $this->dataStore['indicators'][$this->indicatorID];
96 96 $this->minValue = $this->indicator['min'];
... ... @@ -157,11 +157,11 @@ class ThematicMap
157 157 // Function
158 158 // @access protected
159 159 //
160   - public function getKML()
  160 + public function getKML($url)
161 161 {
162 162  
163 163 // Create KMZ archieve
164   - $file = "tmp/tme". time(). ".kmz";
  164 + $file = $this->dirtmp."/tme". time(). ".kmz";
165 165 $zip = new ZipArchive();
166 166 if ($zip->open($file, ZIPARCHIVE::CREATE)!==TRUE) {
167 167 exit("cannot open <$file>\n");
... ... @@ -651,7 +651,7 @@ class ThematicMap
651 651  
652 652 $zip->close();
653 653  
654   - return $file;
  654 + return $url.basename($file);
655 655 }
656 656  
657 657  
... ... @@ -888,7 +888,7 @@ class ThematicMap
888 888 imagestringup($legend, 3, 0, ($height/2)+(strlen($this->mapTitle)/2)*7, $this->mapTitle, $white);
889 889  
890 890 // Save legend
891   - $file = 'tmp/files/legend'. time() .'.png';
  891 + $file = $this->dirtmp.'/legend'. time() .'.png';
892 892 imagepng($legend, $file);
893 893  
894 894 return $file;
... ... @@ -992,13 +992,11 @@ class ThematicMap
992 992 }
993 993  
994 994 // Save legend
995   - $file = 'tmp/files/logo'. time() .'.png';
  995 + $file = $this->dirtmp.'/logo'. time() .'.png';
996 996 imagepng($legend, $file);
997 997  
998 998 return $file;
999 999 }
1000   -
1001   -
1002 1000 } // class ThematicMap
1003 1001  
1004 1002  
... ...
pacotes/tme/TME_i3geo.php
... ... @@ -41,19 +41,24 @@ if(count($colunas) == 1){
41 41 $ano = $colunas[0];
42 42 $tipo = "year";
43 43 }
44   -
  44 +if(!isset($dir_tmp)){
  45 + include("../../ms_configura.php");
  46 +}
45 47 $parameters = array( 'mapType' => 'bar',
46 48 'indicator' => 'valores',
47 49 'year' => $ano,
48 50 'classification' => 'equal',
49 51 'mapTitle' => 'Título do Mapa',
50   - 'timeType' => $tipo //para mais de um ano, escolha slider ou series
  52 + 'timeType' => $tipo, //para mais de um ano, escolha slider ou series
  53 + 'dirtmp' => $dir_tmp
51 54 );
52 55  
53 56 // Create thematic map object
54 57 $map = new ThematicMap($dataStore, $parameters);
55   -$file = $map->getKML();
56   -
57   -echo "<p><a href='$file'>$file</a>";
  58 +$file = $map->getKML($dataConnector->url);
  59 +if(!function_exists("cpjson"))
  60 +{require("../../classesphp/funcoes_gerais.php");}
  61 +cpjson(array('url' => $file));
  62 +//echo "<p><a href='$file'>$file</a>";
58 63  
59 64 ?>
60 65 \ No newline at end of file
... ...
pacotes/tme/TME_i3geo_DataConnector.php
... ... @@ -35,6 +35,7 @@ class DataConnector
35 35 public $valuesTable = 'indicator_values';
36 36 public $map_file;
37 37 public $postgis_mapa;
  38 + public $url;
38 39 private $dbc;
39 40  
40 41 // Constructor
... ... @@ -68,6 +69,7 @@ class DataConnector
68 69 {exit;}
69 70 $this->map_file = $_SESSION["map_file"];
70 71 $this->postgis_mapa = $_SESSION["postgis_mapa"];
  72 + $this->url = $_SESSION["tmpurl"];
71 73 }
72 74 // Fetch all indicators
73 75 function getIndicators(){
... ... @@ -175,8 +177,8 @@ class DataConnector
175 177 $dataStore['indicators']['valores']['years'] = $indicatorYears;
176 178 $dataStore['indicators']['valores']['max'] = max($todosV);
177 179 $dataStore['indicators']['valores']['min'] = min($todosV);
178   - echo "<pre>";
179   - var_dump($dataStore);
  180 + //echo "<pre>";
  181 + //var_dump($dataStore);
180 182 return $dataStore;
181 183 /*
182 184 $sqlregion = '';
... ...