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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Aug 15 23:09:07 CEST 2011


Author: alfonx
Date: 2011-08-15 23:09:06 +0200 (Mon, 15 Aug 2011)
New Revision: 1674

Modified:
   trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StyledGridCoverage.java
   trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StyledGridCoverageReader.java
   trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StyledGridCoverageReaderInterface.java
   trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StyledRasterInterface.java
Log:
StyledRasterInterface hat eine neu abstrakte Methode um die nzhal der B?\195?\164nder zu erfahren. 

Modified: trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StyledGridCoverage.java
===================================================================
--- trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StyledGridCoverage.java	2011-08-15 14:18:39 UTC (rev 1673)
+++ trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StyledGridCoverage.java	2011-08-15 21:09:06 UTC (rev 1674)
@@ -43,17 +43,13 @@
 import de.schmitzm.i18n.Translation;
 
 /**
- * This class provides a simple implementation of {@link StyledLayerInterface}
- * for {@link GridCoverage2D}. The uncache functionality is not supported,
- * because this class bases on an existing {@link GridCoverage2D} object in
- * memory.
+ * This class provides a simple implementation of {@link StyledLayerInterface} for {@link GridCoverage2D}. The uncache
+ * functionality is not supported, because this class bases on an existing {@link GridCoverage2D} object in memory.
  * 
- * @author <a href="mailto:martin.schmitz at koeln.de">Martin Schmitz</a>
- *         (University of Bonn/Germany)
+ * @author <a href="mailto:martin.schmitz at koeln.de">Martin Schmitz</a> (University of Bonn/Germany)
  * @version 1.0
  */
-public class StyledGridCoverage extends AbstractStyledLayer<GridCoverage2D>
-		implements StyledGridCoverageInterface {
+public class StyledGridCoverage extends AbstractStyledLayer<GridCoverage2D> implements StyledGridCoverageInterface {
 
 	private Double nodataValue;
 
@@ -87,12 +83,10 @@
 	 * @exception IllegalArgumentException
 	 *                if {@code null} is given as ID or geo object
 	 */
-	public StyledGridCoverage(GridCoverage2D gc, String id, Translation title,
-			Translation desc, Translation keywords, Style style,
-			RasterLegendData legendData, ImageIcon icon) {
-		super(gc, JTSUtil.createEnvelope(gc.getEnvelope()), gc
-				.getCoordinateReferenceSystem(), id, title, desc, keywords,
-				style, icon);
+	public StyledGridCoverage(GridCoverage2D gc, String id, Translation title, Translation desc, Translation keywords,
+			Style style, RasterLegendData legendData, ImageIcon icon) {
+		super(gc, JTSUtil.createEnvelope(gc.getEnvelope()), gc.getCoordinateReferenceSystem(), id, title, desc,
+				keywords, style, icon);
 		setLegendMetaData(legendData);
 	}
 
@@ -116,18 +110,15 @@
 	 * @exception IllegalArgumentException
 	 *                if {@code null} is given as ID or geo object
 	 */
-	public StyledGridCoverage(GridCoverage2D gc, String id, Translation title,
-			Translation desc, Translation keywords,
+	public StyledGridCoverage(GridCoverage2D gc, String id, Translation title, Translation desc, Translation keywords,
 			StyledLayerStyle<RasterLegendData> style, ImageIcon icon) {
-		super(gc, JTSUtil.createEnvelope(gc.getEnvelope()), gc
-				.getCoordinateReferenceSystem(), id, title, desc, keywords,
-				style != null ? style.getGeoObjectStyle() : null, icon);
+		super(gc, JTSUtil.createEnvelope(gc.getEnvelope()), gc.getCoordinateReferenceSystem(), id, title, desc,
+				keywords, style != null ? style.getGeoObjectStyle() : null, icon);
 		setLegendMetaData(style != null ? style.getMetaData() : null);
 	}
 
 	/**
-	 * Creates a styled grid with a language-specific title, no long
-	 * description, no keywords and no icon.
+	 * Creates a styled grid with a language-specific title, no long description, no keywords and no icon.
 	 * 
 	 * @param gc
 	 *            the grid
@@ -142,8 +133,7 @@
 	 * @exception IllegalArgumentException
 	 *                if {@code null} is given as ID or geo object
 	 */
-	public StyledGridCoverage(GridCoverage2D gc, String id, Translation title,
-			Style style, RasterLegendData legendData) {
+	public StyledGridCoverage(GridCoverage2D gc, String id, Translation title, Style style, RasterLegendData legendData) {
 		this(gc, id, title, null, null, style, legendData, null);
 	}
 
@@ -169,8 +159,7 @@
 	 * @exception IllegalArgumentException
 	 *                if {@code null} is given as ID or geo object
 	 */
-	public StyledGridCoverage(GridCoverage2D gc, String id, String title,
-			String desc, String keywords, Style style,
+	public StyledGridCoverage(GridCoverage2D gc, String id, String title, String desc, String keywords, Style style,
 			RasterLegendData legendData, ImageIcon icon) {
 		this(gc, id, (Translation) null, null, null, style, legendData, icon);
 		setTitle(title);
@@ -198,17 +187,14 @@
 	 * @exception IllegalArgumentException
 	 *                if {@code null} is given as ID or geo object
 	 */
-	public StyledGridCoverage(GridCoverage2D gc, String id, String title,
-			String desc, String keywords,
+	public StyledGridCoverage(GridCoverage2D gc, String id, String title, String desc, String keywords,
 			StyledLayerStyle<RasterLegendData> style, ImageIcon icon) {
-		this(gc, id, title, desc, keywords, style != null ? style
-				.getGeoObjectStyle() : null, style != null ? style
+		this(gc, id, title, desc, keywords, style != null ? style.getGeoObjectStyle() : null, style != null ? style
 				.getMetaData() : null, icon);
 	}
 
 	/**
-	 * Creates a styled grid with a non-translated title, no long description,
-	 * no keywords and no icon.
+	 * Creates a styled grid with a non-translated title, no long description, no keywords and no icon.
 	 * 
 	 * @param gc
 	 *            the grid
@@ -221,14 +207,12 @@
 	 * @exception IllegalArgumentException
 	 *                if {@code null} is given as ID or geo object
 	 */
-	public StyledGridCoverage(GridCoverage2D gc, String id, String title,
-			Style style, RasterLegendData legendData) {
+	public StyledGridCoverage(GridCoverage2D gc, String id, String title, Style style, RasterLegendData legendData) {
 		this(gc, id, title, null, null, style, legendData, null);
 	}
 
 	/**
-	 * Creates a styled grid with a non-translated title, no long description,
-	 * no keywords and no icon.
+	 * Creates a styled grid with a non-translated title, no long description, no keywords and no icon.
 	 * 
 	 * @param gc
 	 *            the grid
@@ -241,10 +225,8 @@
 	 * @exception IllegalArgumentException
 	 *                if {@code null} is given as ID or geo object
 	 */
-	public StyledGridCoverage(GridCoverage2D gc, String id, String title,
-			StyledLayerStyle<RasterLegendData> style) {
-		this(gc, id, title, null, null, style != null ? style
-				.getGeoObjectStyle() : null, style != null ? style
+	public StyledGridCoverage(GridCoverage2D gc, String id, String title, StyledLayerStyle<RasterLegendData> style) {
+		this(gc, id, title, null, null, style != null ? style.getGeoObjectStyle() : null, style != null ? style
 				.getMetaData() : null, null);
 	}
 
@@ -266,21 +248,18 @@
 	}
 
 	/**
-	 * Sets the meta data needed for displaying a legend. If {@code legendData}
-	 * is {@code null} an empty {@link RasterLegendData} (without gaps) is set,
-	 * so {@link #getLegendMetaData()} never returns {@code null}.
+	 * Sets the meta data needed for displaying a legend. If {@code legendData} is {@code null} an empty
+	 * {@link RasterLegendData} (without gaps) is set, so {@link #getLegendMetaData()} never returns {@code null}.
 	 * 
 	 * @param legendData
 	 *            legend meta data
 	 */
 	public void setLegendMetaData(RasterLegendData legendData) {
-		this.legendData = (legendData != null) ? legendData
-				: new RasterLegendData(false);
+		this.legendData = (legendData != null) ? legendData : new RasterLegendData(false);
 	}
 
 	/**
-	 * Simply sets the {@link #geoObject}, {@link #crs}, {@link #envelope} and
-	 * {@link #legendData} to {@code null}.
+	 * Simply sets the {@link #geoObject}, {@link #crs}, {@link #envelope} and {@link #legendData} to {@code null}.
 	 */
 	public void dispose() {
 		this.geoObject = null;
@@ -299,8 +278,8 @@
 	}
 
 	/**
-	 * Does nothing, because the {@link AbstractStyledLayer} bases on existing
-	 * objects (in memory) which can not be uncached and reloaded.
+	 * Does nothing, because the {@link AbstractStyledLayer} bases on existing objects (in memory) which can not be
+	 * uncached and reloaded.
 	 */
 	public void uncache() {
 		LOGGER.warn("Uncache functionality is not supported. Object remains in memory.");
@@ -320,12 +299,10 @@
 	 */
 	/**
 	 * 
-	 * Killed by SK: 6. April 09: Ein Layer soll nicht generell auf
-	 * verstecken/nicht verstecken gestellt werden können. Das sind
-	 * Eigenschaften der Karte/MapContext, ebenso wie die Reihenfolge der Layer.
-	 * Im Atlas verwaltet deshalb nun die Klasse skrueger.atlas.Map welche Layer
-	 * nicht in der Legende auftauchen sollen. Meines Wissens hat keiner bisher
-	 * die Funktion genutzt.
+	 * Killed by SK: 6. April 09: Ein Layer soll nicht generell auf verstecken/nicht verstecken gestellt werden können.
+	 * Das sind Eigenschaften der Karte/MapContext, ebenso wie die Reihenfolge der Layer. Im Atlas verwaltet deshalb nun
+	 * die Klasse skrueger.atlas.Map welche Layer nicht in der Legende auftauchen sollen. Meines Wissens hat keiner
+	 * bisher die Funktion genutzt.
 	 * 
 	 * public boolean isHideInLegend() { return false; }
 	 */
@@ -338,4 +315,9 @@
 	public void setNodataValue(Double nodataValue) {
 		this.nodataValue = nodataValue;
 	}
+
+	@Override
+	public int getBandCount() {
+		return getGeoObject().getNumSampleDimensions();
+	}
 }

Modified: trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StyledGridCoverageReader.java
===================================================================
--- trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StyledGridCoverageReader.java	2011-08-15 14:18:39 UTC (rev 1673)
+++ trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StyledGridCoverageReader.java	2011-08-15 21:09:06 UTC (rev 1674)
@@ -376,4 +376,8 @@
 	 * public boolean isHideInLegend() { return false; }
 	 */
 
+	@Override
+	public int getBandCount() {
+		return getGeoObject().getGridCoverageCount();
+	}
 }

Modified: trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StyledGridCoverageReaderInterface.java
===================================================================
--- trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StyledGridCoverageReaderInterface.java	2011-08-15 14:18:39 UTC (rev 1673)
+++ trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StyledGridCoverageReaderInterface.java	2011-08-15 21:09:06 UTC (rev 1674)
@@ -39,4 +39,5 @@
  */
 public interface StyledGridCoverageReaderInterface extends
 		StyledRasterInterface<AbstractGridCoverage2DReader> {
+	
 };

Modified: trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StyledRasterInterface.java
===================================================================
--- trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StyledRasterInterface.java	2011-08-15 14:18:39 UTC (rev 1673)
+++ trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StyledRasterInterface.java	2011-08-15 21:09:06 UTC (rev 1674)
@@ -45,10 +45,15 @@
 	 * @return A {@link RasterLegendData} object with pairs of value / label
 	 *         information
 	 */
-	RasterLegendData getLegendMetaData();
+	public RasterLegendData getLegendMetaData();
 
-	Double getNodataValue();
+	public Double getNodataValue();
 
 	void setNodataValue(Double nodataValue);
+	
+	/**
+	 * Liefert die Anzahl der verfügbaren Bänder
+	 */
+	public int getBandCount();
 
 }



More information about the Schmitzm-commits mailing list