[Schmitzm-commits] r728 - in trunk/src: schmitzm/jfree/feature/style skrueger/geotools

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Feb 26 13:20:48 CET 2010


Author: alfonx
Date: 2010-02-26 13:20:46 +0100 (Fri, 26 Feb 2010)
New Revision: 728

Modified:
   trunk/src/schmitzm/jfree/feature/style/FeatureChartUtil.java
   trunk/src/skrueger/geotools/XMapPane.java
Log:
* Panning a blinking feature now works great.

Modified: trunk/src/schmitzm/jfree/feature/style/FeatureChartUtil.java
===================================================================
--- trunk/src/schmitzm/jfree/feature/style/FeatureChartUtil.java	2010-02-25 19:59:02 UTC (rev 727)
+++ trunk/src/schmitzm/jfree/feature/style/FeatureChartUtil.java	2010-02-26 12:20:46 UTC (rev 728)
@@ -68,6 +68,8 @@
 import schmitzm.jfree.feature.Feature2SeriesDatasetMapping;
 import schmitzm.jfree.feature.FeatureDatasetMetaData;
 import schmitzm.jfree.feature.FeatureDatasetSelectionModel;
+import skrueger.AttributeMetadata;
+import skrueger.geotools.AttributeMetadataMap;
 
 /**
  * This class contains static utility methods related to chart styles based on
@@ -661,4 +663,26 @@
 		// FeatureChartStyle}.
 		return willRemove.isEmpty();
 	}
+
+	/**
+	 * Passes the NODATA Values stored in the {@link AttributeMetadataMap} to the attributes of the {@link ChartStyle}. 
+	 */
+	public static void passNoDataValues(
+			AttributeMetadataMap attributeMetaDataMap,
+			FeatureChartStyle featureChartStyle) {
+		
+		// Pass the NODATA values for the attributes to the ChartStyle
+		for (int idx = 0; idx < featureChartStyle.getAttributeCount(); idx++) {
+
+			String attributeName = featureChartStyle.getAttributeName(idx);
+			AttributeMetadata attributeMetadata = attributeMetaDataMap
+					.get(attributeName);
+
+			if (attributeMetadata != null) {
+				featureChartStyle.setNoDataValues(idx, attributeMetadata
+						.getNodataValues());
+			}
+		}
+
+	}
 }

Modified: trunk/src/skrueger/geotools/XMapPane.java
===================================================================
--- trunk/src/skrueger/geotools/XMapPane.java	2010-02-25 19:59:02 UTC (rev 727)
+++ trunk/src/skrueger/geotools/XMapPane.java	2010-02-26 12:20:46 UTC (rev 728)
@@ -1632,8 +1632,10 @@
 	 * are rendered into the {@link Graphics2D}
 	 */
 	private void blink(Graphics2D g2d) {
-		if (blinkRenderer != null)
+		if (blinkRenderer != null) {
+			g2d.translate(getImageOrigin().x, getImageOrigin().y);
 			blinkRenderer.paint(g2d, getVisibleRect(), getMapArea());
+		}
 	}
 
 	/**
@@ -2533,7 +2535,8 @@
 	 *            position in window coordinates
 	 * @param zoomFaktor
 	 *            > 1 for zoom out, < 1 for zoom in. Default is .5
-	 * @retun <code>true</code> if {@link #mapArea} has changed and a repaint is triggered
+	 * @retun <code>true</code> if {@link #mapArea} has changed and a repaint is
+	 *        triggered
 	 */
 	public boolean zoomTo(Point center, Double zoomFaktor) {
 		if (zoomFaktor == null || zoomFaktor == 0.)
@@ -2565,42 +2568,46 @@
 
 		return setMapArea(newMapArea);
 	}
-	
+
 	/**
-	 * Zooms in or out in a way, that the given {@link Point} on the map stays at the same positino in screen coordinates.
-	 * @param point fixed {@link Point} that will be at the same screen poistion after zoom.
+	 * Zooms in or out in a way, that the given {@link Point} on the map stays
+	 * at the same positino in screen coordinates.
+	 * 
+	 * @param point
+	 *            fixed {@link Point} that will be at the same screen poistion
+	 *            after zoom.
 	 */
 	public boolean zoomTowards(Point point, Double zFactor) {
-//        int units = wheelEvt.getUnitsToScroll();
-        // 
-        // Negativer Wert --> Zoom out --> Faktir > 1
+		// int units = wheelEvt.getUnitsToScroll();
+		// 
+		// Negativer Wert --> Zoom out --> Faktir > 1
 
-        // SK: 9.9.2007 zoom jetzt wie bei GoogleEarth
-//        double zFactor = units > 0 ? 1.3 : 1 / 1.3;
-        // vorher double zFactor = units > 0 ? 1/1.2 : 1.2;
+		// SK: 9.9.2007 zoom jetzt wie bei GoogleEarth
+		// double zFactor = units > 0 ? 1.3 : 1 / 1.3;
+		// vorher double zFactor = units > 0 ? 1/1.2 : 1.2;
 
-        // Fenster-Koordinaten zu Karten-Koordinaten transformieren
-//        Point2D mapCoord = XMapPane.getMapCoordinatesFromEvent(wheelEvt);
-        // Relative Position des Mauszeigers zum Kartenausschnitt
-        // -> Nach Zoom soll dieselbe Kartenposition unterhalb des Mauszeigers
-        // erscheinen, wie vor dem Zoom
+		// Fenster-Koordinaten zu Karten-Koordinaten transformieren
+		// Point2D mapCoord = XMapPane.getMapCoordinatesFromEvent(wheelEvt);
+		// Relative Position des Mauszeigers zum Kartenausschnitt
+		// -> Nach Zoom soll dieselbe Kartenposition unterhalb des Mauszeigers
+		// erscheinen, wie vor dem Zoom
 		final Point2D mapCoord = getScreenToWorld().transform(point, null);
-		
-        double relX = (mapCoord.getX() - getMapArea().getMinX())
-                / getMapArea().getWidth();
-        double relY = (mapCoord.getY() - getMapArea().getMinY())
-                / getMapArea().getHeight();
 
-        // Neuen Karten-Ausschnitt berechnen
-        Coordinate ll = new Coordinate(mapCoord.getX()
-                - getMapArea().getWidth() * relX * zFactor, mapCoord.getY()
-                - getMapArea().getHeight() * relY * zFactor);
-        Coordinate ur = new Coordinate(mapCoord.getX()
-                + getMapArea().getWidth() * (1 - relX) * zFactor, mapCoord
-                .getY()
-                + getMapArea().getHeight() * (1 - relY) * zFactor);
-        
-        return setMapArea(new Envelope(ll, ur));
+		double relX = (mapCoord.getX() - getMapArea().getMinX())
+				/ getMapArea().getWidth();
+		double relY = (mapCoord.getY() - getMapArea().getMinY())
+				/ getMapArea().getHeight();
+
+		// Neuen Karten-Ausschnitt berechnen
+		Coordinate ll = new Coordinate(mapCoord.getX()
+				- getMapArea().getWidth() * relX * zFactor, mapCoord.getY()
+				- getMapArea().getHeight() * relY * zFactor);
+		Coordinate ur = new Coordinate(mapCoord.getX()
+				+ getMapArea().getWidth() * (1 - relX) * zFactor, mapCoord
+				.getY()
+				+ getMapArea().getHeight() * (1 - relY) * zFactor);
+
+		return setMapArea(new Envelope(ll, ur));
 	}
 
 	/**
@@ -2848,7 +2855,8 @@
 	public void blink(
 			FeatureCollection<SimpleFeatureType, SimpleFeature> features) {
 		{
-			if (stopBlinkTimer != null)	stopBlinkTimer.stop();
+			if (stopBlinkTimer != null)
+				stopBlinkTimer.stop();
 			repaint();
 			stopBlinkTimer = initBlinkTimer();
 



More information about the Schmitzm-commits mailing list