[Schmitzm-commits] r1677 - in trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools: data/rld styling

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Aug 16 14:39:52 CEST 2011


Author: alfonx
Date: 2011-08-16 14:39:51 +0200 (Tue, 16 Aug 2011)
New Revision: 1677

Modified:
   trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/data/rld/RasterLegendData.java
   trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StyledLayerUtil.java
   trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StylingUtil.java
Log:
Some steps further styling a single band out of a multi-band layer...

Modified: trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/data/rld/RasterLegendData.java
===================================================================
--- trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/data/rld/RasterLegendData.java	2011-08-16 11:45:48 UTC (rev 1676)
+++ trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/data/rld/RasterLegendData.java	2011-08-16 12:39:51 UTC (rev 1677)
@@ -96,7 +96,7 @@
 
 	/**
 	 * Creates a sample {@link GridCoverage2D} (size 1x1, WGS84) for each legend
-	 * value. These rasters can be used to do visualize the legend item in the
+	 * value. These rasters can be used to visualize the legend item in the
 	 * corresponding color via {@link GridCoverageRenderer}.
 	 */
 	public Map<Double, GridCoverage2D> createSampleRasters() {

Modified: trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StyledLayerUtil.java
===================================================================
--- trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StyledLayerUtil.java	2011-08-16 11:45:48 UTC (rev 1676)
+++ trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StyledLayerUtil.java	2011-08-16 12:39:51 UTC (rev 1677)
@@ -72,9 +72,11 @@
 import org.geotools.renderer.lite.gridcoverage2d.GridCoverageRenderer;
 import org.geotools.styling.ColorMap;
 import org.geotools.styling.ColorMapEntry;
+import org.geotools.styling.ContrastEnhancement;
 import org.geotools.styling.FeatureTypeStyle;
 import org.geotools.styling.RasterSymbolizer;
 import org.geotools.styling.Rule;
+import org.geotools.styling.SelectedChannelType;
 import org.geotools.styling.Style;
 import org.jdom.Document;
 import org.jdom.Element;
@@ -1223,6 +1225,18 @@
 
 				for (final RasterSymbolizer symbolizer : rSymbols) {
 					try {
+
+						// Wenn ein RasterSymbolizer so konfiguriert ist, dass
+						// er nur ein spezielles Band von mehreren darstellt,
+						// dann muss diese ChannelSelectino hier aufgehoiben
+						// werden, da die samleConverages nur ein Band haben.
+						symbolizer
+								.setChannelSelection(StylingUtil.STYLE_FACTORY
+										.createChannelSelection(new SelectedChannelType[] { StylingUtil.STYLE_FACTORY
+												.createSelectedChannelType(
+														"1",
+														(ContrastEnhancement) null) }));
+
 						renderer.paint(graphics, sampleCov, symbolizer);
 					} catch (final Exception ee) {
 						LOGGER.error("Unable to paint " + symbolizer

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-08-16 11:45:48 UTC (rev 1676)
+++ trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StylingUtil.java	2011-08-16 12:39:51 UTC (rev 1677)
@@ -2016,7 +2016,6 @@
 	public static List<RasterSymbolizer> getRasterSymbolizers(Style style) {
 		final List<RasterSymbolizer> rsList = new ArrayList<RasterSymbolizer>();
 		for (FeatureTypeStyle fts : style.featureTypeStyles()) {
-
 			getRasterSymbolizers(rsList, fts);
 		}
 
@@ -2032,7 +2031,7 @@
 			return;
 
 		for (Rule r : fts.rules()) {
-			for (Symbolizer symb : r.getSymbolizers()) {
+			for (Symbolizer symb : r.symbolizers()) {
 				if (symb instanceof RasterSymbolizer) {
 					rsList.add((RasterSymbolizer) symb);
 				}



More information about the Schmitzm-commits mailing list