From def0fc5fc75d4f4bb8bf0ba9850ee25c0c8b20f0 Mon Sep 17 00:00:00 2001 From: Edmar Moretti Date: Mon, 19 Sep 2011 12:42:40 +0000 Subject: [PATCH] --- pacotes/tme/TME_Engine.php | 14 ++++++-------- pacotes/tme/TME_i3geo.php | 15 ++++++++++----- pacotes/tme/TME_i3geo_DataConnector.php | 6 ++++-- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/pacotes/tme/TME_Engine.php b/pacotes/tme/TME_Engine.php index bcb3775..86454bc 100644 --- a/pacotes/tme/TME_Engine.php +++ b/pacotes/tme/TME_Engine.php @@ -90,7 +90,7 @@ class ThematicMap $this->mapType = $paramArray['mapType']; // Mapping technique $this->indicatorID = $paramArray['indicator']; // Main indicator $this->year = $paramArray['year']; // Year - + $this->dirtmp = $paramArray['dirtmp']; // Extract indicator metadata and values from dataStore $this->indicator = $this->dataStore['indicators'][$this->indicatorID]; $this->minValue = $this->indicator['min']; @@ -157,11 +157,11 @@ class ThematicMap // Function // @access protected // - public function getKML() + public function getKML($url) { // Create KMZ archieve - $file = "tmp/tme". time(). ".kmz"; + $file = $this->dirtmp."/tme". time(). ".kmz"; $zip = new ZipArchive(); if ($zip->open($file, ZIPARCHIVE::CREATE)!==TRUE) { exit("cannot open <$file>\n"); @@ -651,7 +651,7 @@ class ThematicMap $zip->close(); - return $file; + return $url.basename($file); } @@ -888,7 +888,7 @@ class ThematicMap imagestringup($legend, 3, 0, ($height/2)+(strlen($this->mapTitle)/2)*7, $this->mapTitle, $white); // Save legend - $file = 'tmp/files/legend'. time() .'.png'; + $file = $this->dirtmp.'/legend'. time() .'.png'; imagepng($legend, $file); return $file; @@ -992,13 +992,11 @@ class ThematicMap } // Save legend - $file = 'tmp/files/logo'. time() .'.png'; + $file = $this->dirtmp.'/logo'. time() .'.png'; imagepng($legend, $file); return $file; } - - } // class ThematicMap diff --git a/pacotes/tme/TME_i3geo.php b/pacotes/tme/TME_i3geo.php index 497c539..457430d 100644 --- a/pacotes/tme/TME_i3geo.php +++ b/pacotes/tme/TME_i3geo.php @@ -41,19 +41,24 @@ if(count($colunas) == 1){ $ano = $colunas[0]; $tipo = "year"; } - +if(!isset($dir_tmp)){ + include("../../ms_configura.php"); +} $parameters = array( 'mapType' => 'bar', 'indicator' => 'valores', 'year' => $ano, 'classification' => 'equal', 'mapTitle' => 'Título do Mapa', - 'timeType' => $tipo //para mais de um ano, escolha slider ou series + 'timeType' => $tipo, //para mais de um ano, escolha slider ou series + 'dirtmp' => $dir_tmp ); // Create thematic map object $map = new ThematicMap($dataStore, $parameters); -$file = $map->getKML(); - -echo "

$file"; +$file = $map->getKML($dataConnector->url); +if(!function_exists("cpjson")) +{require("../../classesphp/funcoes_gerais.php");} +cpjson(array('url' => $file)); +//echo "

$file"; ?> \ No newline at end of file diff --git a/pacotes/tme/TME_i3geo_DataConnector.php b/pacotes/tme/TME_i3geo_DataConnector.php index e04c1ad..20e91c5 100644 --- a/pacotes/tme/TME_i3geo_DataConnector.php +++ b/pacotes/tme/TME_i3geo_DataConnector.php @@ -35,6 +35,7 @@ class DataConnector public $valuesTable = 'indicator_values'; public $map_file; public $postgis_mapa; + public $url; private $dbc; // Constructor @@ -68,6 +69,7 @@ class DataConnector {exit;} $this->map_file = $_SESSION["map_file"]; $this->postgis_mapa = $_SESSION["postgis_mapa"]; + $this->url = $_SESSION["tmpurl"]; } // Fetch all indicators function getIndicators(){ @@ -175,8 +177,8 @@ class DataConnector $dataStore['indicators']['valores']['years'] = $indicatorYears; $dataStore['indicators']['valores']['max'] = max($todosV); $dataStore['indicators']['valores']['min'] = min($todosV); - echo "

";
-		var_dump($dataStore);
+		//echo "
";
+		//var_dump($dataStore);
 		return $dataStore;
         /*
 		$sqlregion = '';
--
libgit2 0.21.2