[Schmitzm-commits] r590 - branches/1.0-gt2-2.6/src/skrueger/geotools

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Nov 26 15:38:34 CET 2009


Author: alfonx
Date: 2009-11-26 15:38:34 +0100 (Thu, 26 Nov 2009)
New Revision: 590

Modified:
   branches/1.0-gt2-2.6/src/skrueger/geotools/XMapPane.java
Log:
Now panning clears around the panning image again... and some formatting... and not double listening on layerChanges anymore

Modified: branches/1.0-gt2-2.6/src/skrueger/geotools/XMapPane.java
===================================================================
--- branches/1.0-gt2-2.6/src/skrueger/geotools/XMapPane.java	2009-11-26 14:35:53 UTC (rev 589)
+++ branches/1.0-gt2-2.6/src/skrueger/geotools/XMapPane.java	2009-11-26 14:38:34 UTC (rev 590)
@@ -434,16 +434,17 @@
 
 	/**
 	 * Listens to each layer in the local {@link MapContext} for changes and
-	 * triggers repaints.
+	 * triggers repaints. We don't have to listen layerChanged, because that is
+	 * already done in {@link #localContextListener}
 	 */
 	protected MapLayerListener localMapLayerListener = new MapLayerAdapter() {
 
-		@Override
-		public void layerChanged(final MapLayerEvent event) {
-			getLocalRenderer().setContext(getMapContext()); // betters for SLD
-			// changes?!
-			requestStartRendering();
-		}
+		// @Override
+		// public void layerChanged(final MapLayerEvent event) {
+		// // getLocalRenderer().setContext(getMapContext()); // betters for SLD
+		// // // changes?!
+		// // requestStartRendering();
+		// }
 
 		@Override
 		public void layerHidden(final MapLayerEvent event) {
@@ -526,7 +527,7 @@
 	private BufferedImage preFinalImage;
 
 	// ** if 0, no quick preview will be shown **/
-//	private int quickPreviewHint = 0;
+	// private int quickPreviewHint = 0;
 
 	private Map<Object, Object> rendererHints = GTUtil
 			.getDefaultGTRendererHints(getLocalRenderer());
@@ -1007,12 +1008,12 @@
 	protected boolean drawScaledPreviewImage_Zoom(final Graphics2D graphics) {
 
 		// if (1 == 1)return false;
-//		if (quickPreviewHint == 0)
-//			return false;
+		// if (quickPreviewHint == 0)
+		// return false;
 
 		if (oldMapArea == null)
 			return false;
-		
+
 		if (getPreFinalImage() == null)
 			return false;
 
@@ -1048,7 +1049,7 @@
 
 		addGadgets(graphics, true);
 
-//		quickPreviewHint = 0;
+		// quickPreviewHint = 0;
 
 		repaintTimer.restart();
 
@@ -1088,7 +1089,7 @@
 					getVisibleRect().height, IMAGETYPE);
 			SwingUtil.clearImage(finalImage, getMapBackgroundColor());
 
-//			requestStartRendering();
+			// requestStartRendering();
 		}
 		return finalImage;
 	}
@@ -1433,7 +1434,9 @@
 	 */
 	public void onRenderingCompleted(final long l) {
 		lastRenderingDuration = (lastRenderingDuration + l) / 2;
-		LOGGER.debug("complete rendering after "+lastRenderingDuration+"ms");
+		LOGGER
+				.debug("complete rendering after " + lastRenderingDuration
+						+ "ms");
 
 		repaintTimer.stop();
 
@@ -1485,12 +1488,13 @@
 
 		if (!isWellDefined())
 			return;
-//
-//		if (paneResized) {
-////			((Graphics2D) g).setBackground(getMapBackgroundColor());
-////			g.clearRect(0, 0, getVisibleRect().width, getVisibleRect().height);
-//			return;
-//		}
+		//
+		// if (paneResized) {
+		// // ((Graphics2D) g).setBackground(getMapBackgroundColor());
+		// // g.clearRect(0, 0, getVisibleRect().width,
+		// getVisibleRect().height);
+		// return;
+		// }
 
 		// super.paintComponent(g); // candidate for removal
 
@@ -1510,13 +1514,14 @@
 
 				mapAreaChanged = false;
 
-//				if (getMapArea().covers(oldMapArea)) {
-////					quickPreviewHint = ZOOM_OUT;
-//					paintedSomething = drawScaledPreviewImage_Zoom((Graphics2D) g);
-//				} else if (oldMapArea.covers(getMapArea())) {
-//					quickPreviewHint = ZOOM_IN;
-					paintedSomething = drawScaledPreviewImage_Zoom((Graphics2D) g);
-//				}
+				// if (getMapArea().covers(oldMapArea)) {
+				// // quickPreviewHint = ZOOM_OUT;
+				// paintedSomething = drawScaledPreviewImage_Zoom((Graphics2D)
+				// g);
+				// } else if (oldMapArea.covers(getMapArea())) {
+				// quickPreviewHint = ZOOM_IN;
+				paintedSomething = drawScaledPreviewImage_Zoom((Graphics2D) g);
+				// }
 			}
 		}
 
@@ -2170,13 +2175,12 @@
 		finalG.drawImage(getPreFinalImage(), imageOrigin.x, imageOrigin.y,
 				getMapBackgroundColor(), null);
 
-		// What was it good for?
-		// final int finalImageHeight = getFinalImage().getHeight();
-		// final int finalImageWidth = getFinalImage().getWidth();
-		// final Rectangle painedArea = new Rectangle(imageOrigin.x,
-		// imageOrigin.y, finalImageWidth, finalImageHeight);
-		// SwingUtil.clearAround(finalG, painedArea, getVisibleRect(),
-		// getMapBackgroundColor());
+		// When panning, we have to clear the area around the image
+		final Rectangle painedArea = new Rectangle(imageOrigin.x,
+				imageOrigin.y, getFinalImage().getWidth(), getFinalImage()
+						.getHeight());
+		SwingUtil.clearAround(finalG, painedArea, getVisibleRect(),
+				getMapBackgroundColor());
 
 		addGadgets(finalG, false);
 



More information about the Schmitzm-commits mailing list