[Schmitzm-commits] r145 - in trunk: dist src/schmitzm/geotools/gui src/schmitzm/geotools/styling src/schmitzm/jfree src/skrueger/geotools src/skrueger/geotools/labelsearch

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Jun 18 02:28:31 CEST 2009


Author: alfonx
Date: 2009-06-18 02:28:28 +0200 (Thu, 18 Jun 2009)
New Revision: 145

Modified:
   trunk/dist/schmitzm.jar
   trunk/src/schmitzm/geotools/gui/JMapPane.java
   trunk/src/schmitzm/geotools/styling/StylingUtil.java
   trunk/src/schmitzm/jfree/JFreeChartUtil.java
   trunk/src/skrueger/geotools/StyledFeatureCollectionTableModel.java
   trunk/src/skrueger/geotools/labelsearch/SearchResult.java
Log:
* Tuned the versioning system in build.xml
* Renamed JavaDoc @returns to @return to reduce warnings (by prox 0.1% ;-) )


Modified: trunk/dist/schmitzm.jar
===================================================================
(Binary files differ)

Modified: trunk/src/schmitzm/geotools/gui/JMapPane.java
===================================================================
--- trunk/src/schmitzm/geotools/gui/JMapPane.java	2009-06-15 18:29:49 UTC (rev 144)
+++ trunk/src/schmitzm/geotools/gui/JMapPane.java	2009-06-18 00:28:28 UTC (rev 145)
@@ -467,7 +467,7 @@
 
 	/**
 	 * Get the BufferedImage to use as a flaoting icon in the lower right corner.
-	 * @returns <code>null</code> if the feature is deactivated.
+	 * @return <code>null</code> if the feature is deactivated.
 	 */
 	public BufferedImage getMapImage() {
 		return mapImage;

Modified: trunk/src/schmitzm/geotools/styling/StylingUtil.java
===================================================================
--- trunk/src/schmitzm/geotools/styling/StylingUtil.java	2009-06-15 18:29:49 UTC (rev 144)
+++ trunk/src/schmitzm/geotools/styling/StylingUtil.java	2009-06-18 00:28:28 UTC (rev 145)
@@ -146,10 +146,9 @@
 	public static final StyleFactory styleFactory = STYLE_FACTORY;
 
 	/**
-	 * TODO SK
-	 * The following constants are used to speed up
-	 * {@link #createSelectionStyle(Object)}. I will "redo" them soon and also document them. This is still under construction.
-	 * TODO SK   
+	 * TODO SK The following constants are used to speed up
+	 * {@link #createSelectionStyle(Object)}. I will "redo" them soon and also
+	 * document them. This is still under construction. TODO SK
 	 */
 
 	static final Literal size0 = FeatureUtil.FILTER_FACTORY2.literal(13);
@@ -209,21 +208,14 @@
 					zeroLit) }, new org.geotools.styling.Symbol[0],
 			FeatureUtil.FILTER_FACTORY2.literal(1), size3, zeroLit);
 	static final Fill SELECTION_FILL1 = STYLE_FACTORY.createFill(STYLE_BUILDER
-			.colorExpression(Color.RED), null,
-			FeatureUtil.FILTER_FACTORY2.literal(1),
-			STYLE_FACTORY.createGraphic(new ExternalGraphic[0],
-					new Mark[] { STYLE_FACTORY.createMark(
-							FeatureUtil.FILTER_FACTORY2
-									.literal("circle"), null,
-							STYLE_FACTORY.createFill(STYLE_BUILDER
-									.colorExpression(Color.RED)), size3,
-							zeroLit) },
-					new org.geotools.styling.Symbol[0],
-					FeatureUtil.FILTER_FACTORY2.literal(1), size3,
-					zeroLit));
+			.colorExpression(Color.RED), null, FeatureUtil.FILTER_FACTORY2
+			.literal(1), STYLE_FACTORY.createGraphic(new ExternalGraphic[0],
+			new Mark[] { STYLE_FACTORY.createMark(FeatureUtil.FILTER_FACTORY2
+					.literal("circle"), null, STYLE_FACTORY
+					.createFill(STYLE_BUILDER.colorExpression(Color.RED)),
+					size3, zeroLit) }, new org.geotools.styling.Symbol[0],
+			FeatureUtil.FILTER_FACTORY2.literal(1), size3, zeroLit));
 
-	
-
 	// /**
 	// * Up to three {@link Style styles} suitable to present selected {@link
 	// Feature features} are cached here. (SK)
@@ -1158,8 +1150,7 @@
 			}
 
 		} catch (final Exception e) {
-			e.printStackTrace();
-			System.err.println("error");
+			LOGGER.error("error - filter API stuff?");
 			return null;
 		}
 		return null;
@@ -1183,20 +1174,46 @@
 
 				for (final FeatureTypeStyle fts : style.getFeatureTypeStyles()) {
 					for (final Rule r : fts.getRules()) {
+						results.addAll(getTextSymbolizers(r.getSymbolizers()));
+					}
+				}
 
-						for (final Symbolizer symb : r.getSymbolizers()) {
-							if (symb instanceof TextSymbolizer) {
-								results.add((TextSymbolizer) symb);
-							}
-						}
+			}
 
+		} catch (final Exception e) {
+			LOGGER.error("error - filter API stuff?");
+			return results;
+		}
+		return results;
+	}
+
+	/**
+	 * @param symbolizers
+	 *            List of Symbolizers to search for all {@link TextSymbolizer}s
+	 *            . No guarantee, that any one of them will ever be used for any
+	 *            feature (think about filters).
+	 * 
+	 * @author Stefan A. Krüger
+	 * 
+	 * @return {@link List} or all {@link TextSymbolizer}s found in the given
+	 *         symbolizers.
+	 */
+	public static List<TextSymbolizer> getTextSymbolizers(
+			Symbolizer[] symbolizers) {
+		List<TextSymbolizer> results = new ArrayList<TextSymbolizer>();
+		try {
+			if (symbolizers != null) {
+
+				for (final Symbolizer symb : symbolizers) {
+					if (symb instanceof TextSymbolizer) {
+						results.add((TextSymbolizer) symb);
 					}
 				}
 
 			}
 
 		} catch (final Exception e) {
-			System.err.println("error");
+			LOGGER.error("error - filter API stuff?");
 			return results;
 		}
 		return results;
@@ -1454,7 +1471,7 @@
 		Symbolizer[] symbolizers = new Symbolizer[0];
 
 		switch (geometryForm) {
-	
+
 		case POINT:
 			PointSymbolizer ps = STYLE_FACTORY.createPointSymbolizer();
 			ps.setGraphic(SELECTION_GRAPHIC1);
@@ -1479,120 +1496,121 @@
 			polS0.setFill(SELECTION_FILL0);
 			symbolizers = LangUtil.extendArray(symbolizers, polS0);
 
-	
-			
-//			
-//			PolygonSymbolizer polS = STYLE_FACTORY.createPolygonSymbolizer();
-//			
-//			Fill SELECTION_FILL1 = STYLE_FACTORY.createFill(STYLE_BUILDER
-//					.colorExpression(Color.RED), null,
-//					FeatureUtil.FILTER_FACTORY2.literal(1),
-//					STYLE_FACTORY.createGraphic(new ExternalGraphic[0],
-//							new Mark[] { STYLE_FACTORY.createMark(
-//									FeatureUtil.FILTER_FACTORY2
-//									.literal("hatch"), null,
-//									STYLE_FACTORY.createFill(STYLE_BUILDER
-//											.colorExpression(Color.YELLOW
-//													.brighter())), size1,
-//													zeroLit) },
-//													new org.geotools.styling.Symbol[0],
-//													FeatureUtil.FILTER_FACTORY2.literal(1), size1,
-//													zeroLit));
-//			
-//			
-//			polS.setFill(SELECTION_FILL1);
-//			symbolizers = LangUtil.extendArray(symbolizers, polS);
-			
+			//			
+			// PolygonSymbolizer polS = STYLE_FACTORY.createPolygonSymbolizer();
+			//			
+			// Fill SELECTION_FILL1 = STYLE_FACTORY.createFill(STYLE_BUILDER
+			// .colorExpression(Color.RED), null,
+			// FeatureUtil.FILTER_FACTORY2.literal(1),
+			// STYLE_FACTORY.createGraphic(new ExternalGraphic[0],
+			// new Mark[] { STYLE_FACTORY.createMark(
+			// FeatureUtil.FILTER_FACTORY2
+			// .literal("hatch"), null,
+			// STYLE_FACTORY.createFill(STYLE_BUILDER
+			// .colorExpression(Color.YELLOW
+			// .brighter())), size1,
+			// zeroLit) },
+			// new org.geotools.styling.Symbol[0],
+			// FeatureUtil.FILTER_FACTORY2.literal(1), size1,
+			// zeroLit));
+			//			
+			//			
+			// polS.setFill(SELECTION_FILL1);
+			// symbolizers = LangUtil.extendArray(symbolizers, polS);
+
 			PolygonSymbolizer polS = STYLE_FACTORY.createPolygonSymbolizer();
 			polS.setFill(SELECTION_FILL1);
 			symbolizers = LangUtil.extendArray(symbolizers, polS);
 
-	
-//			
-//			
-//			PolygonSymbolizer polS2 = STYLE_FACTORY.createPolygonSymbolizer();
-//			Mark hatchMark1 = STYLE_FACTORY.createMark(
-//					FeatureUtil.FILTER_FACTORY2.literal("hatch"), null,
-//					STYLE_FACTORY.createFill(STYLE_BUILDER
-//							.colorExpression(Color.RED)), size1,
-//					zeroLit);
-//		
-//			Fill SELECTION_FILL2 = STYLE_FACTORY.createFill(STYLE_BUILDER
-//					.colorExpression(Color.GREEN.brighter()), null,
-//					FeatureUtil.FILTER_FACTORY2.literal(1), STYLE_FACTORY
-//							.createGraphic(new ExternalGraphic[0],
-//									new Mark[] { hatchMark1 },
-//									new org.geotools.styling.Symbol[0],
-//									FeatureUtil.FILTER_FACTORY2.literal(1),
-//									size1, FeatureUtil.FILTER_FACTORY2
-//											.literal(90)));
-//			polS2.setFill(SELECTION_FILL2);
-//			symbolizers = LangUtil.extendArray(symbolizers, polS2);
+			//			
+			//			
+			// PolygonSymbolizer polS2 =
+			// STYLE_FACTORY.createPolygonSymbolizer();
+			// Mark hatchMark1 = STYLE_FACTORY.createMark(
+			// FeatureUtil.FILTER_FACTORY2.literal("hatch"), null,
+			// STYLE_FACTORY.createFill(STYLE_BUILDER
+			// .colorExpression(Color.RED)), size1,
+			// zeroLit);
+			//		
+			// Fill SELECTION_FILL2 = STYLE_FACTORY.createFill(STYLE_BUILDER
+			// .colorExpression(Color.GREEN.brighter()), null,
+			// FeatureUtil.FILTER_FACTORY2.literal(1), STYLE_FACTORY
+			// .createGraphic(new ExternalGraphic[0],
+			// new Mark[] { hatchMark1 },
+			// new org.geotools.styling.Symbol[0],
+			// FeatureUtil.FILTER_FACTORY2.literal(1),
+			// size1, FeatureUtil.FILTER_FACTORY2
+			// .literal(90)));
+			// polS2.setFill(SELECTION_FILL2);
+			// symbolizers = LangUtil.extendArray(symbolizers, polS2);
 
-//			
-//			PolygonSymbolizer polS3 = STYLE_FACTORY.createPolygonSymbolizer();
-//			Mark hatchMark2 = STYLE_FACTORY.createMark(
-//					FeatureUtil.FILTER_FACTORY2.literal("x"), null,
-//					STYLE_FACTORY.createFill(STYLE_BUILDER
-//							.colorExpression(Color.WHITE)), size0,
-//					zeroLit);
-//		
-//			Fill SELECTION_FILL3 = STYLE_FACTORY.createFill(STYLE_BUILDER
-//					.colorExpression(Color.GREEN.brighter()), null,
-//					FeatureUtil.FILTER_FACTORY2.literal(1), STYLE_FACTORY
-//							.createGraphic(new ExternalGraphic[0],
-//									new Mark[] { hatchMark2 },
-//									new org.geotools.styling.Symbol[0],
-//									FeatureUtil.FILTER_FACTORY2.literal(1),
-//									size0, FeatureUtil.FILTER_FACTORY2
-//											.literal(15)));
-//			polS3.setFill(SELECTION_FILL3);
-//			symbolizers = LangUtil.extendArray(symbolizers, polS3);
-//
-//
-//			
-//			PolygonSymbolizer polS4 = STYLE_FACTORY.createPolygonSymbolizer();
-//			Mark hatchMark3 = STYLE_FACTORY.createMark(
-//					FeatureUtil.FILTER_FACTORY2.literal("x"), null,
-//					STYLE_FACTORY.createFill(STYLE_BUILDER
-//							.colorExpression(Color.BLACK)), size1,
-//					zeroLit);
-//		
-//			Fill SELECTION_FILL4 = STYLE_FACTORY.createFill(STYLE_BUILDER
-//					.colorExpression(Color.GREEN.brighter()), null,
-//					FeatureUtil.FILTER_FACTORY2.literal(1), STYLE_FACTORY
-//							.createGraphic(new ExternalGraphic[0],
-//									new Mark[] { hatchMark3 },
-//									new org.geotools.styling.Symbol[0],
-//									FeatureUtil.FILTER_FACTORY2.literal(1),
-//									size1, FeatureUtil.FILTER_FACTORY2
-//											.literal(60)));
-//			polS4.setFill(SELECTION_FILL4);
-//			symbolizers = LangUtil.extendArray(symbolizers, polS4);
-//			
-//
-//			
-//			PolygonSymbolizer polS5 = STYLE_FACTORY.createPolygonSymbolizer();
-//			Mark hatchMark4 = STYLE_FACTORY.createMark(
-//					FeatureUtil.FILTER_FACTORY2.literal("x"), null,
-//					STYLE_FACTORY.createFill(STYLE_BUILDER
-//							.colorExpression(Color.YELLOW.brighter())), size2,
-//					zeroLit);
-//		
-//			Fill SELECTION_FILL5 = STYLE_FACTORY.createFill(STYLE_BUILDER
-//					.colorExpression(Color.GREEN.brighter()), null,
-//					FeatureUtil.FILTER_FACTORY2.literal(1), STYLE_FACTORY
-//							.createGraphic(new ExternalGraphic[0],
-//									new Mark[] { hatchMark4 },
-//									new org.geotools.styling.Symbol[0],
-//									FeatureUtil.FILTER_FACTORY2.literal(1),
-//									size2, FeatureUtil.FILTER_FACTORY2
-//											.literal(60)));
-//			polS5.setFill(SELECTION_FILL5);
-//			symbolizers = LangUtil.extendArray(symbolizers, polS5);
-//			
+			//			
+			// PolygonSymbolizer polS3 =
+			// STYLE_FACTORY.createPolygonSymbolizer();
+			// Mark hatchMark2 = STYLE_FACTORY.createMark(
+			// FeatureUtil.FILTER_FACTORY2.literal("x"), null,
+			// STYLE_FACTORY.createFill(STYLE_BUILDER
+			// .colorExpression(Color.WHITE)), size0,
+			// zeroLit);
+			//		
+			// Fill SELECTION_FILL3 = STYLE_FACTORY.createFill(STYLE_BUILDER
+			// .colorExpression(Color.GREEN.brighter()), null,
+			// FeatureUtil.FILTER_FACTORY2.literal(1), STYLE_FACTORY
+			// .createGraphic(new ExternalGraphic[0],
+			// new Mark[] { hatchMark2 },
+			// new org.geotools.styling.Symbol[0],
+			// FeatureUtil.FILTER_FACTORY2.literal(1),
+			// size0, FeatureUtil.FILTER_FACTORY2
+			// .literal(15)));
+			// polS3.setFill(SELECTION_FILL3);
+			// symbolizers = LangUtil.extendArray(symbolizers, polS3);
+			//
+			//
+			//			
+			// PolygonSymbolizer polS4 =
+			// STYLE_FACTORY.createPolygonSymbolizer();
+			// Mark hatchMark3 = STYLE_FACTORY.createMark(
+			// FeatureUtil.FILTER_FACTORY2.literal("x"), null,
+			// STYLE_FACTORY.createFill(STYLE_BUILDER
+			// .colorExpression(Color.BLACK)), size1,
+			// zeroLit);
+			//		
+			// Fill SELECTION_FILL4 = STYLE_FACTORY.createFill(STYLE_BUILDER
+			// .colorExpression(Color.GREEN.brighter()), null,
+			// FeatureUtil.FILTER_FACTORY2.literal(1), STYLE_FACTORY
+			// .createGraphic(new ExternalGraphic[0],
+			// new Mark[] { hatchMark3 },
+			// new org.geotools.styling.Symbol[0],
+			// FeatureUtil.FILTER_FACTORY2.literal(1),
+			// size1, FeatureUtil.FILTER_FACTORY2
+			// .literal(60)));
+			// polS4.setFill(SELECTION_FILL4);
+			// symbolizers = LangUtil.extendArray(symbolizers, polS4);
+			//			
+			//
+			//			
+			// PolygonSymbolizer polS5 =
+			// STYLE_FACTORY.createPolygonSymbolizer();
+			// Mark hatchMark4 = STYLE_FACTORY.createMark(
+			// FeatureUtil.FILTER_FACTORY2.literal("x"), null,
+			// STYLE_FACTORY.createFill(STYLE_BUILDER
+			// .colorExpression(Color.YELLOW.brighter())), size2,
+			// zeroLit);
+			//		
+			// Fill SELECTION_FILL5 = STYLE_FACTORY.createFill(STYLE_BUILDER
+			// .colorExpression(Color.GREEN.brighter()), null,
+			// FeatureUtil.FILTER_FACTORY2.literal(1), STYLE_FACTORY
+			// .createGraphic(new ExternalGraphic[0],
+			// new Mark[] { hatchMark4 },
+			// new org.geotools.styling.Symbol[0],
+			// FeatureUtil.FILTER_FACTORY2.literal(1),
+			// size2, FeatureUtil.FILTER_FACTORY2
+			// .literal(60)));
+			// polS5.setFill(SELECTION_FILL5);
+			// symbolizers = LangUtil.extendArray(symbolizers, polS5);
+			//			
 
-//			break;
+			// break;
 		case LINE:
 			LineSymbolizer ls = STYLE_FACTORY.createLineSymbolizer();
 			ls.setStroke(SELECTION_STROKE1);
@@ -1607,7 +1625,6 @@
 			symbolizers = LangUtil.extendArray(symbolizers, ls3);
 			break;
 
-			
 		default:
 			throw new IllegalArgumentException("Provide a suitable object.");
 		}
@@ -1622,46 +1639,49 @@
 		return style;
 
 	}
-	
-//
-//	/**
-//	 * Doubles the number of palettes by adding the reverse palette to every
-//	 * palette. The name of the reverse palette is the name of the original
-//	 * palette plus the letter R.
-//	 * 
-//	 * @author SK
-//	 * @param palettes The original list of {@link BrewerPalette BrewerPalettes}
-//	 */
-//	public static BrewerPalette[] addReversePalettes(BrewerPalette[] palettes) {
-//		BrewerPalette[] newPalettes = new BrewerPalette[palettes.length * 2];
-//
-//		int pos = 0;
-//		for (BrewerPalette bp : palettes) {
-//			newPalettes[pos] = bp;
-//			pos++;
-//			Color[] newColors = new Color[bp.getMaxColors()];
-//
-//			List<Color> colorList = java.util.Arrays.asList(bp.getColors(bp.getMaxColors()));
-//			Collections.reverse(colorList);
-//			colorList.toArray(newColors);
-//
-//			try {
-//				newPalettes[pos] = StylingUtil.createBrewerPalette(bp.getName()
-//						+ "R", newColors);
-//				newPalettes[pos].setPaletteSuitability(bp
-//						.getPaletteSuitability());
-//				newPalettes[pos].setDescription(bp.getDescription()+" reversed");
-//				newPalettes[pos].setType(bp.getType());
-//				newPalettes[pos].setColorScheme(bp.getColorScheme());
-//			} catch (IOException e) {
-//				LOGGER.error(e);
-//				newPalettes[pos] = bp;
-//			}
-//
-//			pos++;
-//		}
-//
-//		return newPalettes;
-//	}
 
+	//
+	// /**
+	// * Doubles the number of palettes by adding the reverse palette to every
+	// * palette. The name of the reverse palette is the name of the original
+	// * palette plus the letter R.
+	// *
+	// * @author SK
+	// * @param palettes The original list of {@link BrewerPalette
+	// BrewerPalettes}
+	// */
+	// public static BrewerPalette[] addReversePalettes(BrewerPalette[]
+	// palettes) {
+	// BrewerPalette[] newPalettes = new BrewerPalette[palettes.length * 2];
+	//
+	// int pos = 0;
+	// for (BrewerPalette bp : palettes) {
+	// newPalettes[pos] = bp;
+	// pos++;
+	// Color[] newColors = new Color[bp.getMaxColors()];
+	//
+	// List<Color> colorList =
+	// java.util.Arrays.asList(bp.getColors(bp.getMaxColors()));
+	// Collections.reverse(colorList);
+	// colorList.toArray(newColors);
+	//
+	// try {
+	// newPalettes[pos] = StylingUtil.createBrewerPalette(bp.getName()
+	// + "R", newColors);
+	// newPalettes[pos].setPaletteSuitability(bp
+	// .getPaletteSuitability());
+	// newPalettes[pos].setDescription(bp.getDescription()+" reversed");
+	// newPalettes[pos].setType(bp.getType());
+	// newPalettes[pos].setColorScheme(bp.getColorScheme());
+	// } catch (IOException e) {
+	// LOGGER.error(e);
+	// newPalettes[pos] = bp;
+	// }
+	//
+	// pos++;
+	// }
+	//
+	// return newPalettes;
+	// }
+
 }

Modified: trunk/src/schmitzm/jfree/JFreeChartUtil.java
===================================================================
--- trunk/src/schmitzm/jfree/JFreeChartUtil.java	2009-06-15 18:29:49 UTC (rev 144)
+++ trunk/src/schmitzm/jfree/JFreeChartUtil.java	2009-06-18 00:28:28 UTC (rev 145)
@@ -190,7 +190,7 @@
   }
 
   /**
-   * @returns all {@link DatasetSelectionModel DatasetSelectionModels} that can be reached via the renderers of this chart. 
+   * @return all {@link DatasetSelectionModel DatasetSelectionModels} that can be reached via the renderers of this chart. 
    */
 public static List<FeatureDatasetSelectionModel<?>> getFeatureDatasetSelectionModelFor(JFreeChart chart) {
 	ArrayList<FeatureDatasetSelectionModel<?>> renderers = new ArrayList<FeatureDatasetSelectionModel<?>>();

Modified: trunk/src/skrueger/geotools/StyledFeatureCollectionTableModel.java
===================================================================
--- trunk/src/skrueger/geotools/StyledFeatureCollectionTableModel.java	2009-06-15 18:29:49 UTC (rev 144)
+++ trunk/src/skrueger/geotools/StyledFeatureCollectionTableModel.java	2009-06-18 00:28:28 UTC (rev 145)
@@ -231,7 +231,7 @@
   }
 
   /**
-	 * @returns Cached bounds for the whole dataset (without applying the
+	 * @return Cached bounds for the whole dataset (without applying the
 	 *          filter) or <code>null</code>
 	 */
 	public Envelope getBounds() {

Modified: trunk/src/skrueger/geotools/labelsearch/SearchResult.java
===================================================================
--- trunk/src/skrueger/geotools/labelsearch/SearchResult.java	2009-06-15 18:29:49 UTC (rev 144)
+++ trunk/src/skrueger/geotools/labelsearch/SearchResult.java	2009-06-18 00:28:28 UTC (rev 145)
@@ -5,7 +5,7 @@
 public interface SearchResult {
 
 	/**
-	 * @returns a {@link String} that represents the Title/Name of this search
+	 * @return a {@link String} that represents the Title/Name of this search
 	 *          result.
 	 * 
 	 */
@@ -18,7 +18,7 @@
 	void open();
 
 	/**
-	 * @returns a {@link String} that represents the Title/Name of "something" that contains the search
+	 * @return a {@link String} that represents the Title/Name of "something" that contains the search
 	 *          result. This may return "" if it makes no sense.
 	 */
 	String getInTitle();



More information about the Schmitzm-commits mailing list