[Schmitzm-commits] r1223 - in trunk/src: schmitzm/geotools/feature skrueger/geotools

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Nov 3 16:44:55 CET 2010


Author: alfonx
Date: 2010-11-03 16:44:54 +0100 (Wed, 03 Nov 2010)
New Revision: 1223

Modified:
   trunk/src/schmitzm/geotools/feature/FeatureUtil.java
   trunk/src/skrueger/geotools/LegendIconFeatureRenderer.java
Log:
added debug statements

Modified: trunk/src/schmitzm/geotools/feature/FeatureUtil.java
===================================================================
--- trunk/src/schmitzm/geotools/feature/FeatureUtil.java	2010-11-03 14:07:08 UTC (rev 1222)
+++ trunk/src/schmitzm/geotools/feature/FeatureUtil.java	2010-11-03 15:44:54 UTC (rev 1223)
@@ -1430,6 +1430,9 @@
 				return new BigDecimal(0.0);
 			if (BigInteger.class.isAssignableFrom(attrType))
 				return new BigInteger("0");
+			
+			// TODO Gemoetry hier hinzufügen!?
+			
 			attrValue = DataUtilities.defaultValue(attrType);
 		} catch (IllegalArgumentException err) {
 			// no default value could be generated for this type

Modified: trunk/src/skrueger/geotools/LegendIconFeatureRenderer.java
===================================================================
--- trunk/src/skrueger/geotools/LegendIconFeatureRenderer.java	2010-11-03 14:07:08 UTC (rev 1222)
+++ trunk/src/skrueger/geotools/LegendIconFeatureRenderer.java	2010-11-03 15:44:54 UTC (rev 1223)
@@ -29,7 +29,7 @@
  ******************************************************************************/
 /** 
  Copyright 2008 Stefan Alfons Tzeggai and parts from some Geotools code  
- 
+
  atlas-framework - This file is part of the Atlas Framework
 
  This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
@@ -87,15 +87,15 @@
  * <ul>
  * <li>07.02.2008:<br>
  * Determining the default values of a {@link SimpleFeatureType} by
- * {@link FeatureUtil#getDefaultAttributeValues(SimpleFeatureType)} instead of using
- * {@link AttributeDescriptor#createDefaultValue()} directly, because the latter
- * returns {@code null} even though the attribut is not nillable.</li>
+ * {@link FeatureUtil#getDefaultAttributeValues(SimpleFeatureType)} instead of
+ * using {@link AttributeDescriptor#createDefaultValue()} directly, because the
+ * latter returns {@code null} even though the attribut is not nillable.</li>
  * </ul>
  * 
  * @author Stefan Alfons Tzeggai
  */
 public class LegendIconFeatureRenderer extends DefaultTreeCellRenderer {
-//	private static final Dimension SIZE = new Dimension(30,20);
+	// private static final Dimension SIZE = new Dimension(30,20);
 
 	Logger LOGGER = Logger.getLogger(LegendIconFeatureRenderer.class);
 
@@ -109,7 +109,7 @@
 
 	public static LegendIconFeatureRenderer getInstance() {
 		// In GT 2.4.5 it we have to create a new one all the time!
-		
+
 		// TODO TEST, whether we still need to recreate the renderer here....
 		// TODO TEST, whether we still need to recreate the renderer here....
 		// TODO TEST, whether we still need to recreate the renderer here....
@@ -119,7 +119,7 @@
 		// TODO TEST, whether we still need to recreate the renderer here....
 		// TODO TEST, whether we still need to recreate the renderer here....
 		return new LegendIconFeatureRenderer();
-//		 return instance;
+		// return instance;
 	}
 
 	/**
@@ -222,8 +222,8 @@
 						legendHeight / 2);
 
 				try {
-					this.samplePoint = new LiteShape2(geomFac
-							.createPoint(coord), null, null, false);
+					this.samplePoint = new LiteShape2(
+							geomFac.createPoint(coord), null, null, false);
 				} catch (Exception e) {
 					this.samplePoint = null;
 				}
@@ -236,7 +236,7 @@
 		}
 		return sampleShape;
 	}
-	
+
 	/**
 	 * Creates a little BufferedImage that presents the Style/Symbols used by
 	 * the {@link MapLegend} to show a legend for the {@link SimpleFeatureType}
@@ -244,15 +244,16 @@
 	 * @param rule
 	 *            {@link Rule} that provides the text and the style to present
 	 * @param featureType
-	 *            Schema that describes the kind of the sample {@link SimpleFeature}
-	 *            that will be rendered with the {@link Style}
+	 *            Schema that describes the kind of the sample
+	 *            {@link SimpleFeature} that will be rendered with the
+	 *            {@link Style}
 	 * @param bg
 	 *            Background {@link Color} or <code>null</code>
 	 * 
 	 * @throws IllegalAttributeException
 	 */
-	public BufferedImage createImageForRule(Rule rule, SimpleFeatureType featureType,
-			Dimension size, Color bg) {
+	public BufferedImage createImageForRule(Rule rule,
+			SimpleFeatureType featureType, Dimension size, Color bg) {
 
 		Symbolizer[] symbolizers = rule.getSymbolizers();
 
@@ -273,7 +274,8 @@
 		// Enable anti-aliasing for the legend symbols
 		graphics.setRenderingHints(getHints());
 
-		final NumberRange<Integer> scaleRange = NumberRange.create(Integer.MAX_VALUE,Integer.MAX_VALUE);
+		final NumberRange<Integer> scaleRange = NumberRange.create(
+				Integer.MAX_VALUE, Integer.MAX_VALUE);
 
 		try {
 
@@ -289,8 +291,12 @@
 				// RasterSymbolizers..");
 				// }
 				// else
-				final SimpleFeature sampleFeature = FeatureUtil.createSampleFeature(featureType);
+				final SimpleFeature sampleFeature = FeatureUtil
+						.createSampleFeature(featureType);
 
+				if (sampleFeature == null)
+					LOGGER.debug("sampleFeature " + sampleFeature);
+
 				// The SLDStyleFactory has to be recreated, as it seams to cache
 				// some stuff.
 				SLDStyleFactory sldStyleFactory = new SLDStyleFactory();
@@ -302,14 +308,12 @@
 
 				if (style2d != null) {
 					new StyledShapePainter(null).paint(graphics, shape,
-							style2d, Integer.MAX_VALUE );
+							style2d, Integer.MAX_VALUE);
 				}
 			}
 		} catch (Exception e) {
-			LOGGER
-					.error(
-							"Error during createImageForRule, returning empty Image",
-							e);
+			LOGGER.error(
+					"Error during createImageForRule, returning empty Image", e);
 		}
 		return buffImage;
 	}
@@ -318,8 +322,7 @@
 	 * Define Java2D and other Hints
 	 * 
 	 * @param hints
-	 * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons
-	 *         Tzeggai</a>
+	 * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons Tzeggai</a>
 	 */
 	public void setHints(Hints hints) {
 		getHints().add(hints);
@@ -349,8 +352,9 @@
 	 * @param rule
 	 *            {@link Rule} that provides the text and the style to present
 	 * @param featureType
-	 *            Schema that describes the kind of the sample {@link SimpleFeature}
-	 *            that will be rendered with the {@link Style}
+	 *            Schema that describes the kind of the sample
+	 *            {@link SimpleFeature} that will be rendered with the
+	 *            {@link Style}
 	 * 
 	 * @throws IllegalAttributeException
 	 */



More information about the Schmitzm-commits mailing list