Commit def0fc5fc75d4f4bb8bf0ba9850ee25c0c8b20f0

Authored by Edmar Moretti
1 parent 454d3d3b

--no commit message

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