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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Nov 24 10:17:23 CET 2009


Author: alfonx
Date: 2009-11-24 10:17:22 +0100 (Tue, 24 Nov 2009)
New Revision: 555

Modified:
   branches/1.0-gt2-2.6/src/skrueger/geotools/RenderingExecutor.java
   branches/1.0-gt2-2.6/src/skrueger/geotools/SelectXMapPaneMouseListener.java
   branches/1.0-gt2-2.6/src/skrueger/geotools/XMapPane.java
Log:
* Tuned the resize/repaint behaviour of the XMapPane a bit more... Seems like a reported "not all layers are alyways rendered when a map is opened the first time in AtlasViewer"-bug is not fixed.

Modified: branches/1.0-gt2-2.6/src/skrueger/geotools/RenderingExecutor.java
===================================================================
--- branches/1.0-gt2-2.6/src/skrueger/geotools/RenderingExecutor.java	2009-11-23 21:40:44 UTC (rev 554)
+++ branches/1.0-gt2-2.6/src/skrueger/geotools/RenderingExecutor.java	2009-11-24 09:17:22 UTC (rev 555)
@@ -4,6 +4,7 @@
 import java.awt.Rectangle;
 import java.awt.geom.AffineTransform;
 
+import org.apache.log4j.Logger;
 import org.geotools.geometry.jts.ReferencedEnvelope;
 import org.geotools.renderer.GTRenderer;
 import org.geotools.renderer.RenderListener;
@@ -14,7 +15,7 @@
  * {@link Thread} for rendering.
  */
 class RenderingExecutor {
-
+	private final static Logger LOGGER = Logger.getLogger(RenderingExecutor.class);
 	/**
 	 * Instance to a {@link RenderThread} doing any work. It's volatile so the
 	 * correct value will always be visible to any {@link Thread}
@@ -47,16 +48,15 @@
 	 * @return true if the rendering task was accepted; false if it was rejected
 	 */
 	public synchronized boolean submit(ReferencedEnvelope envelope,
-			Rectangle paintArea, Graphics2D graphics,
-			final GTRenderer renderer
-//			, AffineTransform worldToScreen
-			) {
+			Rectangle paintArea, Graphics2D graphics, final GTRenderer renderer
+	// , AffineTransform worldToScreen
+	) {
 		if (renderThread == null || !renderThread.isAlive()) {
 			// System.out.println("is vacant... starting thread!");
 			renderThread = null;
 
 			renderThread = new RenderThread(paintArea, graphics, renderer,
-//					worldToScreen,
+			// worldToScreen,
 					envelope);
 			renderThread.start();
 
@@ -79,11 +79,10 @@
 
 		public RenderThread(final Rectangle paintArea,
 				final Graphics2D graphics, GTRenderer renderer,
-//				AffineTransform worldToScreen, 
+				// AffineTransform worldToScreen,
 				ReferencedEnvelope mapEnv) {
-			super(new RenderRun(paintArea, graphics, renderer, 
-					mapEnv
-//					,					worldToScreen
+			super(new RenderRun(paintArea, graphics, renderer, mapEnv
+			// , worldToScreen
 					));
 			this.renderer = renderer;
 
@@ -104,32 +103,27 @@
 	class RenderRun implements Runnable, RenderListener {
 		private final Rectangle paintArea;
 		private final Graphics2D graphics;
-//		private final AffineTransform worldToScreen;
+		// private final AffineTransform worldToScreen;
 		private final GTRenderer renderer;
 		private final ReferencedEnvelope mapEnv;
 
 		public RenderRun(Rectangle paintArea, Graphics2D graphics,
 				GTRenderer renderer, ReferencedEnvelope mapEnv
-//				,
-//				AffineTransform worldToScreen
-				) {
+		// ,
+		// AffineTransform worldToScreen
+		) {
 			this.paintArea = paintArea;
 			this.graphics = graphics;
 			this.renderer = renderer;
 			this.mapEnv = mapEnv;
-//			this.worldToScreen = worldToScreen;
+			// this.worldToScreen = worldToScreen;
 		}
 
 		@Override
 		public void run() {
 			try {
 				renderer.addRenderListener(this);
-				System.out.println("start rendering...");
-				// try {
-				// Thread.sleep(1000);
-				// } catch (InterruptedException e) {
-				// e.printStackTrace();
-				// }
+				LOGGER.debug("start rendering...");
 
 				// Clear the graphics context
 				graphics.setBackground(mapPane.getMapBackgroundColor());
@@ -164,10 +158,13 @@
 	 * Ask to stop the rendering. May be called often.
 	 */
 	public void cancelTask() {
-		if (renderThread != null && renderThread.isAlive()) {
-			// System.out.println("request stop for thread " +task.getName());
-			renderThread.getRenderer().stopRendering();
-		}
+		if (renderThread != null)
+			synchronized (renderThread) {
+				if (renderThread.isAlive()) {
+					if (renderThread.getRenderer() != null)
+						renderThread.getRenderer().stopRendering();
+				}
+			}
 	}
 
 	/**

Modified: branches/1.0-gt2-2.6/src/skrueger/geotools/SelectXMapPaneMouseListener.java
===================================================================
--- branches/1.0-gt2-2.6/src/skrueger/geotools/SelectXMapPaneMouseListener.java	2009-11-23 21:40:44 UTC (rev 554)
+++ branches/1.0-gt2-2.6/src/skrueger/geotools/SelectXMapPaneMouseListener.java	2009-11-24 09:17:22 UTC (rev 555)
@@ -1,5 +1,6 @@
 package skrueger.geotools;
 
+import java.awt.Cursor;
 import java.awt.Point;
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
@@ -65,7 +66,8 @@
 		if (!isEnabled())
 			return;
 
-		xMapPane.setCursor(XMapPane.WAIT_CURSOR);
+		xMapPane.setCursor(Cursor
+				.getPredefinedCursor(Cursor.WAIT_CURSOR));
 		//		
 		// int clickX = e.getX();
 		// int clickY = e.getY();

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-23 21:40:44 UTC (rev 554)
+++ branches/1.0-gt2-2.6/src/skrueger/geotools/XMapPane.java	2009-11-24 09:17:22 UTC (rev 555)
@@ -98,7 +98,7 @@
 	private static final int IMAGETYPE = BufferedImage.TYPE_INT_RGB;
 	private static final int IMAGETYPE_withAlpha = BufferedImage.TYPE_INT_ARGB;
 
-	private static Logger LOGGER = Logger.getLogger(XMapPane.class);
+	private final static Logger LOGGER = Logger.getLogger(XMapPane.class);
 
 	private boolean acceptsRepaintCalls = true;
 
@@ -133,14 +133,14 @@
 	 * The initial delay in milliseconds until the {@link #finalImage} is
 	 * updated the first time.
 	 */
-	public static final int INITIAL_REPAINT_DELAY = 1000;
+	public static final int INITIAL_REPAINT_DELAY = 900;
 
 	/**
 	 * While the {@link #bgExecuter} and {@link #localExecuter} are rendering,
 	 * the {@link #repaintTimer} is regularly updating the {@link #finalImage}
 	 * with previews.
 	 */
-	public static final int REPEATING_REPAINT_DELAY = 500;
+	public static final int REPEATING_REPAINT_DELAY = 600;
 
 	/**
 	 * Default delay (milliseconds) before the map will be redrawn when resizing
@@ -150,8 +150,17 @@
 	 */
 	public static final int DEFAULT_RESIZING_PAINT_DELAY = 600;
 
+	/**
+	 * This not-repeating {@link Timer} is re-started whenever the component is
+	 * resized. That means => only if the component is not resizing for
+	 * {@link #DEFAULT_RESIZING_PAINT_DELAY} milliseconds, does the
+	 * {@link XMapPane} react.
+	 */
 	private final Timer resizeTimer;
 
+	/**
+	 * Flag for no-tool.
+	 */
 	public static final int NONE = -123;
 
 	/**
@@ -163,6 +172,21 @@
 	public static final int PAN = 1;
 
 	/**
+	 * Flag fuer Modus "Heran zoomen".
+	 * 
+	 * @see #setState(int)
+	 * @see #setState(int)
+	 */
+	public static final int ZOOM_IN = 2;
+
+	/**
+	 * Flag fuer Modus "Heraus zoomen". Nicht fuer Window-Auswahl moeglich!
+	 * 
+	 * @see #setState(int)
+	 */
+	public static final int ZOOM_OUT = 3;
+
+	/**
 	 * Flag fuer Modus "SimpleFeature-Auswahl auf allen (sichtbaren) Layern".
 	 * 
 	 * @see #setState(int)
@@ -186,9 +210,6 @@
 	 */
 	public static final int SELECT_TOP = 4;
 
-	public static final Cursor WAIT_CURSOR = Cursor
-			.getPredefinedCursor(Cursor.WAIT_CURSOR);
-
 	/**
 	 * {@link Font} used to paint the wait messages into the map
 	 * 
@@ -212,21 +233,6 @@
 	final String waitMsg = SwingUtil.R("WaitMess");
 
 	/**
-	 * Flag fuer Modus "Heran zoomen".
-	 * 
-	 * @see #setState(int)
-	 * @see #setState(int)
-	 */
-	public static final int ZOOM_IN = 2;
-
-	/**
-	 * Flag fuer Modus "Heraus zoomen". Nicht fuer Window-Auswahl moeglich!
-	 * 
-	 * @see #setState(int)
-	 */
-	public static final int ZOOM_OUT = 3;
-
-	/**
 	 * Konvertiert die Maus-Koordinaten (relativ zum <code>JMapPane</code>) in
 	 * Karten-Koordinaten.
 	 * 
@@ -423,7 +429,8 @@
 
 		@Override
 		public void layerChanged(final MapLayerEvent event) {
-			localRenderer.setContext(getMapContext()); // betters for SLD changes?!
+			localRenderer.setContext(getMapContext()); // betters for SLD
+			// changes?!
 			requestStartRendering();
 		}
 
@@ -503,11 +510,11 @@
 	 * A flag indicating, that the image size has changed and the buffered
 	 * images are not big enough any more
 	 **/
-	protected boolean paneResized = false;
+	protected boolean paneResized = true;
 
 	private BufferedImage preFinalImage;
 
-	// if null, no quick preview will be shown
+	// ** if 0, no quick preview will be shown **/
 	private int quickPreviewHint = 0;
 
 	private Map<Object, Object> rendererHints = GTUtil
@@ -554,13 +561,12 @@
 
 	/** Is set if a renderer has an error **/
 	protected ArrayList<Exception> renderingErrors = new ArrayList<Exception>();
-	
-	/** If <code>true</code>, then rendering exceptions are rendererd into the map pane **/
-	private boolean showExceptions= false;
 
-	// /** If {@link #getVisibleRect()} of this {@link JPanel} is not yet
-	// defined, but we are **/
-	// private Envelope mapAreaCondidate = null;
+	/**
+	 * If <code>true</code>, then rendering exceptions are rendererd into the
+	 * map pane
+	 **/
+	private boolean showExceptions = false;
 
 	public XMapPane() {
 		this(null, null);
@@ -610,6 +616,8 @@
 						if (!isWellDefined())
 							return;
 
+						LOGGER.info("resizeTimer performed");
+
 						final Rectangle bounds = getVisibleRect();
 						//
 						// System.out.println("\n\ntimer performs with bounds = "
@@ -619,26 +627,32 @@
 								bounds.x, bounds.y, bounds.x + bounds.width,
 								bounds.y + bounds.height);
 
-						if (setMapArea(geoMapArea))
+						if (setMapArea(geoMapArea)) {
+							LOGGER.info("  maparea changed");
 							paneResized = true;
-						// else
-						// syso
+						} else
+							LOGGER.info("  maparea NOT changed");
 					}
 				});
 		resizeTimer.setRepeats(false);
 
 		this.addComponentListener(new ComponentAdapter() {
 
+			private Rectangle oldVisibleRect;
+
 			@Override
 			public void componentResized(final ComponentEvent e) {
 
-				// Already cancel the tasks...
-				if (bgExecuter != null)
-					bgExecuter.cancelTask();
-				if (localExecuter != null)
-					localExecuter.cancelTask();
+				// Seems to be called twice with the same size.. 
+				if (oldVisibleRect != null
+						&& oldVisibleRect.equals(getVisibleRect())){
+					LOGGER.info("skipping resize.");
+					return;
+				}
 
+				LOGGER.info("resized: " + getVisibleRect());
 				resizeTimer.restart();
+				oldVisibleRect = getVisibleRect();
 			}
 
 		});
@@ -650,15 +664,17 @@
 
 			@Override
 			public void actionPerformed(final ActionEvent e) {
-				if ((localExecuter != null && !localExecuter.isRunning())
+				if ((!localExecuter.isRunning())
 						&& (bgExecuter != null && !bgExecuter.isRunning())) {
 					repaintTimer.stop();
 				} else {
 					updateFinalImage();
 					XMapPane.this.repaint(100);
+
 				}
 			}
 		});
+
 		repaintTimer.setInitialDelay(INITIAL_REPAINT_DELAY);
 		repaintTimer.setRepeats(true);
 
@@ -676,7 +692,6 @@
 						if (localExecuter.isRunning()) {
 							localExecuter.cancelTask();
 						} else {
-
 							// Stupidly, but we have to recheck the
 							setMapArea(getMapArea());
 							requestStartRendering = false;
@@ -765,7 +780,7 @@
 		}
 
 		final Envelope maxAllowedExtend = getMaxExtend();
-		
+
 		while (maxAllowedExtend != null && !maxAllowedExtend.contains(newArea)
 				&& newArea != null && !newArea.isNull()
 				&& !Double.isNaN(newArea.getMinX())
@@ -910,7 +925,7 @@
 			bgExecuter.dispose();
 		}
 
-		if (localExecuter != null) {
+		if (localExecuter.isRunning()) {
 			int i = 0;
 			localExecuter.cancelTask();
 			while (i++ < 10 && localExecuter.isRunning()) {
@@ -1161,21 +1176,22 @@
 	public Envelope getMaxExtend() {
 		if (maxExtend == null) {
 			// Commented-out because it takes soo much time!
-//
-//			long start = System.currentTimeMillis(); 
-//			final ReferencedEnvelope layerBounds = GTUtil
-//					.getVisibleLayoutBounds(localContext);
-//			
-//			LOGGER.info( (System.currentTimeMillis()-start)+"m to get maxExtend");
-//			
-//			if (layerBounds == null) {
-//				// TODO Last fallback could be the CRS valid area
-//				return null;
-//			}
-//
-//			// Kartenbereich um 10% vergroessern
-//			return JTSUtil.fixAspectRatio(getVisibleRect(), JTSUtil
-//					.expandEnvelope(layerBounds, 0.1), true);
+			//
+			// long start = System.currentTimeMillis();
+			// final ReferencedEnvelope layerBounds = GTUtil
+			// .getVisibleLayoutBounds(localContext);
+			//			
+			// LOGGER.info(
+			// (System.currentTimeMillis()-start)+"m to get maxExtend");
+			//			
+			// if (layerBounds == null) {
+			// // TODO Last fallback could be the CRS valid area
+			// return null;
+			// }
+			//
+			// // Kartenbereich um 10% vergroessern
+			// return JTSUtil.fixAspectRatio(getVisibleRect(), JTSUtil
+			// .expandEnvelope(layerBounds, 0.1), true);
 		}
 		return maxExtend;
 	}
@@ -1306,20 +1322,32 @@
 		return true;
 	}
 
+	/**
+	 * Called from the listeners while the mouse is dragging, this method either
+	 * paints a translated (moved/panned) version of the image, or a rectangle.
+	 * 
+	 * @param startPos
+	 *            in screen coordinates
+	 * @param lastPos
+	 *            in screen coordinates
+	 * @param event
+	 *            the {@link MouseEvent} to read the mouse buttons from
+	 */
 	public void mouseDragged(final Point startPos, final Point lastPos,
 			final MouseEvent event) {
 
 		if ((getState() == XMapPane.PAN)
 				|| ((event.getModifiersEx() & InputEvent.BUTTON3_DOWN_MASK) != 0)) {
 
+			// Panning needs a panning coursor
 			if (getCursor() != SwingUtil.PANNING_CURSOR) {
 				setCursor(SwingUtil.PANNING_CURSOR);
 
-				// While panning, we deactivate the rendering. So the tasts are
-				// ready to start when the panning os done.
-				if (bgExecuter != null)
+				// While panning, we deactivate the rendering. So the tasks are
+				// ready to start when the panning is finished.
+				if (bgExecuter != null && bgExecuter.isRunning())
 					bgExecuter.cancelTask();
-				if (localExecuter != null)
+				if (localExecuter.isRunning())
 					localExecuter.cancelTask();
 			}
 
@@ -1366,21 +1394,15 @@
 		} else if ((getState() == XMapPane.ZOOM_IN)
 				|| (getState() == XMapPane.ZOOM_OUT)
 				|| (getState() == XMapPane.SELECT_ALL)
-				|| (getState() == XMapPane.SELECT_TOP)
-		// || (getState() == XMapPane.SELECT_ONE_FROM_TOP)
-		) {
-			final Graphics graphics = getGraphics();
+				|| (getState() == XMapPane.SELECT_TOP)) {
 
+			// Draws a rectangle
+			final Graphics graphics = getGraphics();
 			drawRectangle(graphics, startPos, event.getPoint());
-
-			if ((lastPos.x > 0) && (lastPos.y > 0)) {
+			if ((lastPos.x > 0) && (lastPos.y > 0))
 				drawRectangle(graphics, startPos, lastPos);
-			}
-
 			graphics.dispose();
-
 		}
-
 	}
 
 	/**
@@ -1396,11 +1418,17 @@
 	 * completed.
 	 */
 	public void onRenderingCompleted() {
+		LOGGER.info("complete");
+
 		repaintTimer.stop();
-		updateFinalImage();
-		repaint();
+
+		// We "forget" about an exception every time we complete a rendering
+		// thread successfully
 		if (renderingErrors.size() > 0)
 			renderingErrors.remove(0);
+
+		updateFinalImage();
+		repaint();
 	}
 
 	/**
@@ -1416,34 +1444,32 @@
 	public void onRenderingFailed(final Exception renderingError) {
 
 		// Store the exceptions so we can show it to the user:
-		if (!(renderingError instanceof java.lang.IllegalArgumentException
-				&& renderingError.getMessage().equals(
+		if (!(renderingError instanceof java.lang.IllegalArgumentException && renderingError
+				.getMessage().equals(
 						"Argument \"sourceCRS\" should not be null.")))
 			this.renderingErrors.add(renderingError);
 		if (renderingErrors.size() > 3)
 			renderingErrors.remove(0);
-		
+
 		repaintTimer.stop();
+
 		LOGGER.warn("Rendering failed", renderingError);
 		updateFinalImage();
 		repaint();
 
 	}
 
-	public void onRenderingPending() {
-		// LOGGER.debug("Pending rendering updates the preview...");
-		updateFinalImage();
-		repaint();
-	}
-
 	@Override
 	protected void paintComponent(final Graphics g) {
 
+		// Maybe update the cursor and maybe stop the repainting timer
+		updateCursor();
+
 		if (!acceptsRepaintCalls)
 			return;
 
-		// Maybe update the cursor and maybe stop the repainting timer
-		updateCursor();
+		if (!isWellDefined())
+			return;
 
 		// super.paintComponent(g); // candidate for removal
 
@@ -1463,23 +1489,13 @@
 				mapAreaChanged = false;
 
 				if (getMapArea().covers(oldMapArea)) {
-					setQuickPreviewHint(ZOOM_OUT);
+					quickPreviewHint = ZOOM_OUT;
 					paintedSomething = drawScaledPreviewImage_Zoom((Graphics2D) g);
 				} else if (oldMapArea.covers(getMapArea())) {
-					setQuickPreviewHint(ZOOM_IN);
+					quickPreviewHint = ZOOM_IN;
 					paintedSomething = drawScaledPreviewImage_Zoom((Graphics2D) g);
 				}
-
 			}
-
-			// if (paneResized) {
-			// paneResized = false;
-			// disposeImages();
-			// }
-			//
-			// // Start the Threads and Timers to render the image
-			// requestStartRendering();
-
 		}
 
 		if (!paintedSomething) {
@@ -1567,28 +1583,6 @@
 			setCursor(SwingUtil.PAN_CURSOR);
 	}
 
-	//
-	// /**
-	// * Nuetzlich wenn die Componente gedruckt (z.B. wenn ein Screenshot
-	// gemacht
-	// * wird) wird. Dann werden wird der Hintergrund auf WEISS gesetzt.
-	// *
-	// * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons
-	// * Kr&uuml;ger</a>
-	// */
-	// @Override
-	// public void print(final Graphics g) {
-	// final Color orig = getBackground();
-	// setBackground(Color.WHITE);
-	//
-	// // wrap in try/finally so that we always restore the state
-	// try {
-	// super.print(g);
-	// } finally {
-	// setBackground(orig);
-	// }
-	// }
-
 	/**
 	 * Entfernt einen Listener von der Map.
 	 * 
@@ -1607,9 +1601,9 @@
 	private void requestStartRendering() {
 		if (bgExecuter != null)
 			bgExecuter.cancelTask();
-		if (localExecuter != null)
-			localExecuter.cancelTask();
 
+		localExecuter.cancelTask();
+
 		mapImageInvalid = true;
 		if (paneResized) {
 			paneResized = false;
@@ -1728,14 +1722,6 @@
 	 *         has been triggered.
 	 */
 	public boolean setMapArea(final ReferencedEnvelope newMapArea) {
-		//		
-		// if (getVisibleRect().getWidth() == 0 || (!isVisible()) ||
-		// getVisibleRect().getHeight() == 0) {
-		// // The window is not yet defined.. so we can not really determine the
-		// asepect ratio for the mapPane. We store this as a candidate mappane
-		// and handle it when the component resizes or becomes visible)
-		// mapAreaCondidate = newMapArea;
-		// }
 
 		if (newMapArea == null
 				|| bestAllowedMapArea(newMapArea).equals(mapArea)) {
@@ -1793,7 +1779,7 @@
 
 		mapAreaChanged = true;
 
-		repaint(100);
+		repaint(200); // Do not remove it!
 
 		requestStartRendering();
 
@@ -1882,28 +1868,16 @@
 	}
 
 	/**
-	 * 
-	 * @param b
+	 * If <code>true</code>, allow the {@link XMapPane} to process #repaint()
+	 * requests. Otherwise the map will not paint anything and not start any
+	 * rendering {@link Thread}s.
 	 */
 	public void setPainting(final boolean b) {
 		acceptsRepaintCalls = b;
+		if (acceptsRepaintCalls == true)
+			repaint();
 	}
 
-	// /**
-	// * Returns in milli seconds the time the last rending of the
-	// * {@link SelectableXMapPane} took. #Long.MAX_VALUE if the JMapPane has
-	// not
-	// * been rendered yet.
-	// */
-	// public long getLastRenderingDuration() {
-	// return lastRenderingDuration;
-	// }
-
-	public void setQuickPreviewHint(final int quickPreviewHint) {
-		this.quickPreviewHint = quickPreviewHint;
-
-	}
-
 	private void setRendererHints(final Map<Object, Object> rendererHints) {
 		if (rendererHints != null)
 			this.rendererHints = rendererHints;
@@ -1947,6 +1921,8 @@
 	private void startRendering() {
 
 		if (!isWellDefined() || !acceptsRepaintCalls) {
+			// if we are not ready to start rendering, try it again the next
+			// time the timer is chacking the flag.
 			requestStartRendering = true;
 			return;
 		}
@@ -1956,9 +1932,7 @@
 			bgExecuter.cancelTask();
 		}
 
-		if (localExecuter != null) {
-			localExecuter.cancelTask();
-		}
+		localExecuter.cancelTask();
 
 		final Rectangle curPaintArea = getVisibleRect();
 
@@ -1990,9 +1964,7 @@
 
 			final boolean submitted = localExecuter.submit(getMapArea(),
 					curPaintArea, (Graphics2D) getLocalImage().getGraphics(),
-					localRenderer
-			// , getWorldToScreenTransform()
-					);
+					localRenderer);
 			if (submitted)
 				repaintTimer.restart();
 			else
@@ -2067,8 +2039,8 @@
 		// if the renderers have stopped, also stop the timer that is updating
 		// the final image
 		if (bgExecuter != null && bgExecuter.isRunning()
-				|| localExecuter != null && localExecuter.isRunning()) {
-			setCursor(WAIT_CURSOR);
+				|| localExecuter.isRunning()) {
+			setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
 			return;
 		} else {
 			// Allow one last rendering
@@ -2181,7 +2153,7 @@
 
 		// If the rendering process is still running, indicate this is the image
 		if (forceWait || bgExecuter != null && bgExecuter.isRunning()
-				|| localExecuter != null && localExecuter.isRunning()) {
+				|| localExecuter.isRunning()) {
 
 			y += 8;
 
@@ -2200,7 +2172,7 @@
 			y += 24;
 		}
 
-		if (renderingErrors != null && isShowExceptions()) {
+		if (!renderingErrors.isEmpty() && isShowExceptions()) {
 
 			final Color c = graphics.getColor();
 			graphics.setFont(errorFont);
@@ -2247,7 +2219,8 @@
 		ReferencedEnvelope _mapArea;
 		if (mapArea == null)
 			_mapArea = features.getBounds();
-		else _mapArea = getMapArea();
+		else
+			_mapArea = getMapArea();
 		double width = _mapArea.getWidth();
 		double height = _mapArea.getHeight();
 		final double ratio = height / width;



More information about the Schmitzm-commits mailing list