From 521b40f313770f181415baae9f89b73609fd93fc Mon Sep 17 00:00:00 2001 From: Edmar Moretti Date: Mon, 15 Feb 2016 16:08:04 -0200 Subject: [PATCH] Opção de cluster na ferramenta Legenda --- admin/admin.db | Bin 332800 -> 0 bytes classesphp/classe_alteraclasse.php | 25 ++++++++++++++++++------- classesphp/classe_legenda.php | 31 ++++++++++++++++++++++++------- classesphp/classe_temas.php | 31 ++++++++++++++++++++++++++++++- ferramentas/legenda/index.js | 8 ++++++++ 5 files changed, 80 insertions(+), 15 deletions(-) diff --git a/admin/admin.db b/admin/admin.db index f690484..5489a27 100755 Binary files a/admin/admin.db and b/admin/admin.db differ diff --git a/classesphp/classe_alteraclasse.php b/classesphp/classe_alteraclasse.php index 3551ee6..5adbf85 100755 --- a/classesphp/classe_alteraclasse.php +++ b/classesphp/classe_alteraclasse.php @@ -148,8 +148,7 @@ class Alteraclasse return "erro"; } $numclasses = $this->layer->numclasses; - if ($numclasses > 0) - { + if ($numclasses > 0){ //elimina a expressão da primeira classe $classe0 = $this->layer->getClass(0); //echo "
";var_dump($classe0);exit;
@@ -162,6 +161,16 @@ class Alteraclasse
 				$classe->set("status",MS_DELETE);
 			}
 		}
+		else{
+			$classe = ms_newClassObj($this->layer);
+			$novoestilo = ms_newStyleObj($classe);
+			if ($this->layer->type == 0){
+				$novoestilo->set("symbolname","ponto");
+				$novoestilo->set("size","6");
+			}
+			$cor = $novoestilo->color;
+			$cor->setRGB(255,100,100);
+		}
 		$this->layer->setMetaData("cache","");
 		return("ok");
 	}
@@ -195,6 +204,7 @@ class Alteraclasse
 		$ids = explode(";",$ids);
 		$minScales = explode(";",$minScales);
 		$maxScales = explode(";",$maxScales);
+
 		$nomes = $this->converteTexto($nomes);
 		$nomes = explode(";",$nomes);
 		//$exps = mb_convert_encoding($exps,"ISO-8859-1","UTF-8");
@@ -210,12 +220,13 @@ class Alteraclasse
 		//elimina as classes existentes atualmente em cada layer
 		foreach ($t as $tema){
 			$layer = $this->mapa->getlayerbyname($tema);
-			$layer->setMetaData("cache","");
+			$layer->setmetadata("cache","");
 			$nc = $layer->numclasses;
-			for($i=0;$i < $nc;++$i)
-			{
-				$class = $layer->getclass($i);
-				$class->set("status",MS_DELETE);
+			if($nc > 0){
+				for($i=0;$i < $nc;++$i){
+					$class = $layer->getclass($i);
+					$class->set("status",MS_DELETE);
+				}
 			}
 		}
 		//acrescenta as classes definidas
diff --git a/classesphp/classe_legenda.php b/classesphp/classe_legenda.php
index 6a31f83..93a868c 100755
--- a/classesphp/classe_legenda.php
+++ b/classesphp/classe_legenda.php
@@ -749,7 +749,12 @@ class Legenda
 			$linha[] = corRGB($estilo->backgroundcolor);
 			$linha[] = corRGB($estilo->color);
 			$linha[] = $estilo->symbolname;
-			$linha[] = $estilo->size;
+			if($estilo->getbinding(MS_STYLE_BINDING_SIZE)){
+				$linha[] = $estilo->getbinding(MS_STYLE_BINDING_SIZE);
+			}
+			else{
+				$linha[] = $estilo->size;
+			}
 			$linha[] = $estilo->opacity;
 			if($this->v >= 6){
 				$linha[] = $estilo->width;
@@ -842,7 +847,13 @@ class Legenda
 		}
 		if ((isset ($size)) && ($size != "-1"))
 		{
-			$estilo->set("size",$size);
+			if(is_numeric($size)){
+				$estilo->removebinding(MS_STYLE_BINDING_SIZE);
+				$estilo->set("size",$size);
+			}
+			else{
+				$estilo->setbinding(MS_STYLE_BINDING_SIZE, $size);
+			}
 		}
 		if ((isset ($width)) && ($width != "-1") && ($this->v >= 6))
 		{
@@ -1096,13 +1107,19 @@ class Legenda
 					$cor->setRGB($nc[0],$nc[1],$nc[2]);
 					continue;
 				case "color":
-					$cor = $estilo->color;
-					$nc = explode(",",$valor);
-					$cor->setRGB($nc[0],$nc[1],$nc[2]);
+					$cor = $estilo->color;
+					$nc = explode(",",$valor);
+					$cor->setRGB($nc[0],$nc[1],$nc[2]);
 					continue;
 				case "size":
-					$estilo->set("size",$valor);
-					break;
+					if(is_numeric($valor)){
+						$estilo->removebinding(MS_STYLE_BINDING_SIZE);
+						$estilo->set("size",$valor);
+					}
+					else{
+						$estilo->setbinding(MS_STYLE_BINDING_SIZE, $valor);
+					}
+					continue;
 				case "width":
 					$estilo->set("width",$valor);
 					continue;
diff --git a/classesphp/classe_temas.php b/classesphp/classe_temas.php
index a0bb2a9..be1dff6 100755
--- a/classesphp/classe_temas.php
+++ b/classesphp/classe_temas.php
@@ -1312,7 +1312,24 @@ Adiciona LABEL em uma classe de um tema
 		$cluster->updateFromString("CLUSTER $par END");
 		$this->layer->setMetaData("cache","");
 		$this->layer->setMetadata("tiles","NAO");
-		$this->layer->setMetadata("cortepixels",0);
+		$this->layer->setMetadata("cortepixels",0);
+		//apaga as classes pois nao fazem mais sentido
+		if($group == ""){
+			$numclasses = $this->layer->numclasses;
+			if ($numclasses > 0){
+				for ($i=0; $i < $numclasses; ++$i)
+				{
+					$classe = $this->layer->getClass($i);
+					$classe->set("status",MS_DELETE);
+				}
+			}
+			$classe = ms_newClassObj($this->layer);
+			$novoestilo = ms_newStyleObj($classe);
+			$novoestilo->set("size",6);
+			$novoestilo->set("symbolname","ponto");
+			$cor = $novoestilo->color;
+			$cor->setRGB(255,100,100);
+		}
 	}
 	function removeCluster(){
 		$cluster = $this->layer->cluster;
@@ -1320,6 +1337,18 @@ Adiciona LABEL em uma classe de um tema
 		$this->layer->setMetaData("cache","");
 		$this->layer->setMetadata("tiles","NAO");
 		$this->layer->setMetadata("cortepixels",0);
+		$numclasses = $this->layer->numclasses;
+		if ($numclasses > 0){
+			for ($i=0; $i < $numclasses; ++$i)
+			{
+				$classe = $this->layer->getClass($i);
+				$numestilos = $classe->numstyles;
+				for($j=0;$j<$numestilos;++$j){
+					$estilo = $classe->getstyle($j);
+					$estilo->removebinding(MS_STYLE_BINDING_SIZE);
+				}
+			}
+		}
 	}
 }
 ?>
diff --git a/ferramentas/legenda/index.js b/ferramentas/legenda/index.js
index d04866d..a91be55 100755
--- a/ferramentas/legenda/index.js
+++ b/ferramentas/legenda/index.js
@@ -1826,6 +1826,7 @@ i3GEOF.legenda =
 						+ linha[6]
 						+ "' id='i3GEOlegendasizes' />"
 						+ ""
+						+ "
" + "
"; $i("i3GEOlegendaParametrosEstilos").innerHTML = d; + //preenche as listas de itens + i3GEO.util.comboItens("", i3GEOF.legenda.tema, function(retorno) { + if ($i("i3GEOlegendaComboSize")) { + $i("i3GEOlegendaComboSize").innerHTML = retorno.dados.replace("id=''"," onchange='$i(\"i3GEOlegendasizes\").value = this.value'"); + } + }); + i3GEO.util.aplicaAquarela("i3GEOlegendaParametrosEstilos"); p = i3GEO.configura.locaplic + "/classesphp/mapa_controle.php?g_sid=" -- libgit2 0.21.2