[Schmitzm-commits] r1522 - trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Sat Mar 19 13:56:10 CET 2011


Author: alfonx
Date: 2011-03-19 13:56:10 +0100 (Sat, 19 Mar 2011)
New Revision: 1522

Modified:
   trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StylingUtil.java
Log:
Importing RasterRulesLists that have not been created with AtlasStyler works now...

Modified: trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StylingUtil.java
===================================================================
--- trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StylingUtil.java	2011-03-19 12:15:41 UTC (rev 1521)
+++ trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StylingUtil.java	2011-03-19 12:56:10 UTC (rev 1522)
@@ -44,6 +44,7 @@
 import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 import java.util.SortedMap;
@@ -1686,7 +1687,7 @@
 	public static List<ColorMap> getColorMapsFromStyle(Style style) {
 
 		if (style == null)
-			style = GridUtil.createDefaultStyle();
+			return Collections.EMPTY_LIST;
 
 		final List<RasterSymbolizer> rasterSymbolizers = getRasterSymbolizers(style);
 
@@ -2013,22 +2014,27 @@
 		final List<RasterSymbolizer> rsList = new ArrayList<RasterSymbolizer>();
 		for (FeatureTypeStyle fts : style.featureTypeStyles()) {
 
-			// Leave out FTSs that are selection related
-			if (fts.getName() != null
-					&& fts.getName()
-							.equals(FeatureMapLayerSelectionSynchronizer.SELECTION_STYLING_FTS_NAME))
-				continue;
+			getRasterSymbolizers(rsList, fts);
+		}
 
-			for (Rule r : fts.rules()) {
-				for (Symbolizer symb : r.getSymbolizers()) {
-					if (symb instanceof RasterSymbolizer) {
-						rsList.add((RasterSymbolizer) symb);
-					}
+		return rsList;
+	}
+
+	public static void getRasterSymbolizers(final List<RasterSymbolizer> rsList,
+			FeatureTypeStyle fts) {
+		// Leave out FTSs that are selection related
+		if (fts.getName() != null
+				&& fts.getName()
+						.equals(FeatureMapLayerSelectionSynchronizer.SELECTION_STYLING_FTS_NAME))
+			return;
+
+		for (Rule r : fts.rules()) {
+			for (Symbolizer symb : r.getSymbolizers()) {
+				if (symb instanceof RasterSymbolizer) {
+					rsList.add((RasterSymbolizer) symb);
 				}
 			}
 		}
-
-		return rsList;
 	}
 
 	/**



More information about the Schmitzm-commits mailing list