[Schmitzm-commits] r384 - in branches/1.0-gt2-2.6/src: gtmig/org/geotools gtmig/org/geotools/gui/swing gtmig/org/geotools/swing org/geotools org/geotools/gui/swing org/geotools/swing schmitzm/geotools/gui schmitzm/geotools/styling schmitzm/io skrueger/geotools/io skrueger/geotools/labelsearch

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Sep 11 18:16:39 CEST 2009


Author: alfonx
Date: 2009-09-11 18:16:38 +0200 (Fri, 11 Sep 2009)
New Revision: 384

Added:
   branches/1.0-gt2-2.6/src/gtmig/org/geotools/swing/
   branches/1.0-gt2-2.6/src/gtmig/org/geotools/swing/MouseSelectionTracker.java
   branches/1.0-gt2-2.6/src/org/geotools/swing/
   branches/1.0-gt2-2.6/src/org/geotools/swing/JMapPane.GT2-2.3.1
   branches/1.0-gt2-2.6/src/org/geotools/swing/JMapPane.GT2-2.3.4
   branches/1.0-gt2-2.6/src/org/geotools/swing/JMapPane.java
   branches/1.0-gt2-2.6/src/org/geotools/swing/MouseSelectionTracker_Public.java
   branches/1.0-gt2-2.6/src/org/geotools/swing/package.html
Removed:
   branches/1.0-gt2-2.6/src/gtmig/org/geotools/gui/swing/MouseSelectionTracker.java
   branches/1.0-gt2-2.6/src/org/geotools/gui/swing/JMapPane.GT2-2.3.1
   branches/1.0-gt2-2.6/src/org/geotools/gui/swing/JMapPane.GT2-2.3.4
   branches/1.0-gt2-2.6/src/org/geotools/gui/swing/JMapPane.java
   branches/1.0-gt2-2.6/src/org/geotools/gui/swing/MouseSelectionTracker_Public.java
   branches/1.0-gt2-2.6/src/org/geotools/gui/swing/package.html
Modified:
   branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/ColorMapTable.java
   branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/GeoPositionLabel.java
   branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/JMapPane.java
   branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/MapContextControlPane.java
   branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/MouseSelectionTracker.java
   branches/1.0-gt2-2.6/src/schmitzm/geotools/styling/StylingUtil.java
   branches/1.0-gt2-2.6/src/schmitzm/io/IOUtil.java
   branches/1.0-gt2-2.6/src/skrueger/geotools/io/GeoImportUtilURL.java
   branches/1.0-gt2-2.6/src/skrueger/geotools/labelsearch/SearchMapDialog.java
Log:
Wow.. this now compiles and works with GT2.6 TRUNK! I will check-in the tunrk libs in AtlasFramework/lib/gt tonight. One big difference between M2 and trunk is that they moved the package
org.geotools.gui.swing to 
org.geotools.swing
So i did the same in schmitzm, especially with the JMapPane

Deleted: branches/1.0-gt2-2.6/src/gtmig/org/geotools/gui/swing/MouseSelectionTracker.java
===================================================================
--- branches/1.0-gt2-2.6/src/gtmig/org/geotools/gui/swing/MouseSelectionTracker.java	2009-09-11 14:17:13 UTC (rev 383)
+++ branches/1.0-gt2-2.6/src/gtmig/org/geotools/gui/swing/MouseSelectionTracker.java	2009-09-11 16:16:38 UTC (rev 384)
@@ -1,377 +0,0 @@
-// Migration process to Geotools 2.6:
-//    Because not included in gt2-2.6-M2 this class is taken 1:1
-//    from Geotools 2.4.5 and made public.
-//    TODO: It should be removed or included in SCHMITZM.
-
-/*
- *    GeoTools - OpenSource mapping toolkit
- *    http://geotools.org
- *    (C) 2003-2006, Geotools Project Managment Committee (PMC)
- *    (C) 2001, Institut de Recherche pour le D�veloppement
- *
- *    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.
- *
- *    This library is distributed in the hope that it will be useful,
- *    but WITHOUT ANY WARRANTY; without even the implied warranty of
- *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *    Lesser General Public License for more details.
- */
-package gtmig.org.geotools.gui.swing;
-
-// Geometry
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Graphics2D;
-import java.awt.Rectangle;
-import java.awt.Shape;
-import java.awt.event.MouseEvent;
-import java.awt.geom.AffineTransform;
-import java.awt.geom.Ellipse2D;
-import java.awt.geom.Line2D;
-import java.awt.geom.NoninvertibleTransformException;
-import java.awt.geom.Point2D;
-import java.awt.geom.Rectangle2D;
-import java.awt.geom.RectangularShape;
-import java.awt.geom.RoundRectangle2D;
-
-import javax.swing.event.MouseInputAdapter;
-
-
-/**
- * Controller which allows the user to select a region of a component. The user must click on a
- * point in the component, then drag the mouse pointer whilst keeping the button pressed. During
- * the dragging, the shape which is drawn will normally be a rectangle.  Other shapes could always
- * be used such as, for example, an ellipse. To use this class, it is necessary to create a derived
- * class which defines the following methods:
- *
- * <ul>
- *   <li>{@link #selectionPerformed} (obligatory)</li>
- *   <li>{@link #getModel} (optional)</li>
- * </ul>
- *
- * This controller should then be registered with one, and only one, component
- * using the following syntax:
- *
- * <blockquote><pre>
- * {@link Component} component=...
- * MouseSelectionTracker control=...
- * component.addMouseListener(control);
- * </pre></blockquote>
- *
- * @since 2.0
- * @source $URL: http://svn.geotools.org/tags/2.4.5/modules/extension/widgets-swing/src/main/java/org/geotools/gui/swing/MouseSelectionTracker.java $
- * @version $Id: MouseSelectionTracker.java 22482 2006-10-31 02:58:00Z desruisseaux $
- * @author Martin Desruisseaux
- */
-public abstract class MouseSelectionTracker extends MouseInputAdapter {
-    /**
-     * Stippled rectangle representing the region which the user is currently
-     * selecting.  This rectangle can be empty.  These coordinates are only
-     * significant in the period between the user pressing the mouse button
-     * and then releasing it to outline a region. Conventionally, the
-     * {@code null} value indicates that a line should be used instead of
-     * a rectangular shape.  The coordinates are always expressed in pixels.
-     */
-    private transient RectangularShape mouseSelectedArea;
-
-    /**
-     * Colour to replace during XOR drawings on a graphic.
-     * This colour is specified in {@link Graphics2D#setColor}.
-     */
-    private Color backXORColor = Color.white;
-
-    /**
-     * Colour to replace with during the XOR drawings on a graphic.
-     * This colour is specified in {@link Graphics2D#setXORMode}.
-     */
-    private Color lineXORColor = Color.black;
-
-    /**
-     * <var>x</var> coordinate of the mouse when the button is pressed.
-     */
-    private transient int ox;
-
-    /**
-     * <var>y</var> coordinate of the mouse when the button is pressed.
-     */
-    private transient int oy;
-
-    /**
-     * <var>x</var> coordinate of the mouse during the last drag.
-     */
-    private transient int px;
-
-    /**
-     * <var>y</var> coordinate of the mouse during the last drag.
-     */
-    private transient int py;
-
-    /**
-     * Indicates whether a selection is underway.
-     */
-    private transient boolean isDragging;
-
-    /**
-     * Constructs an object which will allow rectangular regions to be selected using the mouse.
-     */
-    public MouseSelectionTracker() {
-    }
-
-    /**
-     * Specifies the colours to be used for drawing the outline of a box when
-     * the user selects a region.  All {@code a} colours will be replaced
-     * by {@code b} colours and vice versa.
-     */
-    public void setXORColors(final Color a, final Color b) {
-        backXORColor = a;
-        lineXORColor = b;
-    }
-
-    /**
-     * Returns the geometric shape to use for marking the boundaries of a region.  This shape is
-     * normally a rectangle but could also be an ellipse, an arrow or even other shapes. The
-     * coordinates of the returned shape will not be taken into account. In fact, these coordinates
-     * will regularly be discarded. Only the class of the returned shape will count (for example,
-     * {@link java.awt.geom.Ellipse2D} vs {@link java.awt.geom.Rectangle2D}) and their parameters
-     * which are not linked to their position (for example, the rounding of a rectangle's
-     * corners).
-     * <p>
-     * The shape returned will normally be from a class derived from {@link RectangularShape},
-     * but could also be from the {@link Line2D} class. <strong>Any other class risks throwing a
-     * {@link ClassCastException} when executed</strong>.
-     *
-     * The default implementation always returns an object {@link Rectangle}.
-     *
-     * @param  event Mouse coordinate when the button is pressed.  This information can be used by
-     *         the derived classes which like to be informed of the position of the mouse before
-     *         chosing a geometric shape.
-     * @return Shape from the class {link RectangularShape} or {link Line2D}, or {@code null}
-     *         to indicate that we do not want to make a selection.
-     */
-    protected Shape getModel(final MouseEvent event) {
-        return new Rectangle();
-    }
-
-    /**
-     * Method which is automatically called after the user selects a region with the mouse.
-     * All coordinates passed in as parameters are expressed in pixels.
-     *
-     * @param ox <var>x</var> coordinate of the mouse when the user pressed the mouse button.
-     * @param oy <var>y</var> coordinate of the mouse when the user pressed the mouse button.
-     * @param px <var>x</var> coordinate of the mouse when the user released the mouse button.
-     * @param py <var>y</var> coordinate of the mouse when the user released the mouse button.
-     */
-    protected abstract void selectionPerformed(int ox, int oy, int px, int py);
-
-    /**
-     * Returns the geometric shape surrounding the last region to be selected by the user. An
-     * optional affine transform can be specified to convert the region selected by the user
-     * into logical coordinates. The class of the shape returned depends on the model returned by
-     * {@link #getModel}:
-     *
-     * <ul>
-     *   <li>If the model is null (which means that this {@code MouseSelectionTracker} object only
-     *       draws a line between points), the object returned will belong to the {@link Line2D}
-     *       class.</li>
-     *   <li>If the model is not null, the object returned can be from the same class (most often
-     *       {@link java.awt.geom.Rectangle2D}). There could always be situations where the object
-     *       returned is from another class, for example if the affine transform carries out a
-     *       rotation.</li>
-     * </ul>
-     *
-     * @param  transform Affine transform which converts logical coordinates into pixel coordinates.
-     *         It is usually an affine transform which is used in a {@code paint(...)} method to
-     *         draw shapes expressed in logical coordinates.
-     * @return A geometric shape enclosing the last region to be selected by the user, or
-     *         {@code null} if no selection has yet been made.
-     * @throws NoninvertibleTransformException If the affine transform can't be inverted.
-     */
-    public Shape getSelectedArea(final AffineTransform transform) throws NoninvertibleTransformException {
-        if (ox == px && oy == py) {
-            return null;
-        }
-        RectangularShape shape = mouseSelectedArea;
-        if (transform != null && !transform.isIdentity()) {
-            if (shape == null) {
-                final Point2D.Float po = new Point2D.Float(ox, oy);
-                final Point2D.Float pp = new Point2D.Float(px, py);
-                transform.inverseTransform(po, po);
-                transform.inverseTransform(pp, pp);
-                return new Line2D.Float(po, pp);
-            } else {
-                if (canReshape(shape, transform)) {
-                    final Point2D.Double point = new Point2D.Double();
-                    double xmin = Double.POSITIVE_INFINITY;
-                    double ymin = Double.POSITIVE_INFINITY;
-                    double xmax = Double.NEGATIVE_INFINITY;
-                    double ymax = Double.NEGATIVE_INFINITY;
-                    for (int i = 0; i < 4; i++) {
-                        point.x = (i&1) == 0 ? shape.getMinX() : shape.getMaxX();
-                        point.y = (i&2) == 0 ? shape.getMinY() : shape.getMaxY();
-                        transform.inverseTransform(point, point);
-                        if (point.x < xmin) xmin = point.x;
-                        if (point.x > xmax) xmax = point.x;
-                        if (point.y < ymin) ymin = point.y;
-                        if (point.y > ymax) ymax = point.y;
-                    }
-                    if (shape instanceof Rectangle) {
-                        return new Rectangle2D.Float((float) xmin,
-                                                     (float) ymin,
-                                                     (float) (xmax - xmin),
-                                                     (float) (ymax - ymin));
-                    } else {
-                        shape = (RectangularShape) shape.clone();
-                        shape.setFrame(xmin, ymin, xmax - xmin, ymax - ymin);
-                        return shape;
-                    }
-                }
-                else {
-                    return transform.createInverse().createTransformedShape(shape);
-                }
-            }
-        }
-        else {
-            return (shape != null) ? (Shape) shape.clone() : new Line2D.Float(ox, oy, px, py);
-        }
-    }
-
-    /**
-     * Indicates whether we can transform {@code shape} simply by calling its
-     * {@code shape.setFrame(...)} method rather than by using the heavy artillery
-     * that is the {@code transform.createTransformedShape(shape)} method.
-     */
-    private static boolean canReshape(final RectangularShape shape,
-                                      final AffineTransform transform) {
-        final int type=transform.getType();
-        if ((type & AffineTransform.TYPE_GENERAL_TRANSFORM) != 0) return false;
-        if ((type & AffineTransform.TYPE_MASK_ROTATION)     != 0) return false;
-        if ((type & AffineTransform.TYPE_FLIP)              != 0) {
-            if (shape instanceof Rectangle2D)      return true;
-            if (shape instanceof Ellipse2D)        return true;
-            if (shape instanceof RoundRectangle2D) return true;
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * Returns a {@link Graphics2D} object to be used for drawing in the specified component. We
-     * must not forget to call {@link Graphics2D#dispose} when the graphics object is no longer
-     * needed.
-     */
-    private Graphics2D getGraphics(final Component c) {
-        final Graphics2D graphics = (Graphics2D) c.getGraphics();
-        graphics.setXORMode(lineXORColor);
-        graphics.setColor  (backXORColor);
-        return graphics;
-    }
-
-    /**
-     * Informs this controller that the mouse button has been pressed.
-     * The default implementation retains the mouse coordinate (which will
-     * become one of the corners of the future rectangle to be drawn) 
-     * and prepares {@code this} to observe the mouse movements.
-     *
-     * @throws ClassCastException if {@link #getModel} doesn't return a shape
-     *         from the class {link RectangularShape} or {link Line2D}.
-     */
-    public void mousePressed(final MouseEvent event) throws ClassCastException {
-        if (!event.isConsumed() && (event.getModifiers() & MouseEvent.BUTTON1_MASK) != 0) {
-            final Component source = event.getComponent();
-            if (source != null) {
-                Shape model = getModel(event);
-                if (model != null) {
-                    isDragging = true;
-                    ox = px = event.getX();
-                    oy = py = event.getY();
-                    if (model instanceof Line2D) {
-                        model = null;
-                    }
-                    mouseSelectedArea = (RectangularShape) model;
-                    if (mouseSelectedArea != null) {
-                        mouseSelectedArea.setFrame(ox, oy, 0, 0);
-                    }
-                    source.addMouseMotionListener(this);
-                }
-                source.requestFocus();
-                event.consume();
-            }
-        }
-    }
-
-    /**
-     * Informs this controller that the mouse has been dragged.  The default
-     * implementation uses this to move a corner of the rectangle used to
-     * select the region. The other corner remains fixed at the point
-     * where the mouse was at the moment its button was pressed..
-     */
-    public void mouseDragged(final MouseEvent event) {
-        if (isDragging) {
-            final Graphics2D graphics = getGraphics(event.getComponent());
-            if (mouseSelectedArea == null) {
-                graphics.drawLine(ox, oy, px, py);
-                px = event.getX();
-                py = event.getY();
-                graphics.drawLine(ox, oy, px, py);
-            } else {
-                graphics.draw(mouseSelectedArea);
-                int xmin = this.ox;
-                int ymin = this.oy;
-                int xmax = px = event.getX();
-                int ymax = py = event.getY();
-                if (xmin > xmax) {
-                    final int xtmp = xmin;
-                    xmin = xmax; xmax = xtmp;
-                }
-                if (ymin > ymax) {
-                    final int ytmp = ymin;
-                    ymin = ymax; ymax = ytmp;
-                }
-                mouseSelectedArea.setFrame(xmin, ymin, xmax - xmin, ymax - ymin);
-                graphics.draw(mouseSelectedArea);
-            }
-            graphics.dispose();
-            event.consume();
-        }
-    }
-
-    /**
-     * Informs this controller that the mouse button has been released.
-     * The default implementation calls {@link #selectionPerformed} with
-     * the bounds of the selected region as parameters.
-     */
-    public void mouseReleased(final MouseEvent event) {
-        if (isDragging && (event.getModifiers() & MouseEvent.BUTTON1_MASK) != 0) {
-            isDragging = false;
-            final Component component = event.getComponent();
-            component.removeMouseMotionListener(this);
-
-            final Graphics2D graphics = getGraphics(event.getComponent());
-            if (mouseSelectedArea == null) {
-                graphics.drawLine(ox, oy, px, py);
-            } else {
-                graphics.draw(mouseSelectedArea);
-            }
-            graphics.dispose();
-            px = event.getX();
-            py = event.getY();
-            selectionPerformed(ox, oy, px, py);
-            event.consume();
-        }
-    }
-
-    /**
-     * Informs this controller that the mouse has been moved but not as a
-     * result of the user selecting a region.  The default implementation
-     * signals to the source component that {@code this} is no longer
-     * interested in being informed about mouse movements.
-     */
-    public void mouseMoved(final MouseEvent event) {
-        // Normally not necessary, but it seems that this "listener"
-        // sometimes stays in place when it shouldn't.
-        event.getComponent().removeMouseMotionListener(this);
-    }
-}

Copied: branches/1.0-gt2-2.6/src/gtmig/org/geotools/swing/MouseSelectionTracker.java (from rev 383, branches/1.0-gt2-2.6/src/gtmig/org/geotools/gui/swing/MouseSelectionTracker.java)
===================================================================
--- branches/1.0-gt2-2.6/src/gtmig/org/geotools/gui/swing/MouseSelectionTracker.java	2009-09-11 14:17:13 UTC (rev 383)
+++ branches/1.0-gt2-2.6/src/gtmig/org/geotools/swing/MouseSelectionTracker.java	2009-09-11 16:16:38 UTC (rev 384)
@@ -0,0 +1,377 @@
+// Migration process to Geotools 2.6:
+//    Because not included in gt2-2.6-M2 this class is taken 1:1
+//    from Geotools 2.4.5 and made public.
+//    TODO: It should be removed or included in SCHMITZM.
+
+/*
+ *    GeoTools - OpenSource mapping toolkit
+ *    http://geotools.org
+ *    (C) 2003-2006, Geotools Project Managment Committee (PMC)
+ *    (C) 2001, Institut de Recherche pour le D�veloppement
+ *
+ *    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.
+ *
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ */
+package gtmig.org.geotools.swing;
+
+// Geometry
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Graphics2D;
+import java.awt.Rectangle;
+import java.awt.Shape;
+import java.awt.event.MouseEvent;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Ellipse2D;
+import java.awt.geom.Line2D;
+import java.awt.geom.NoninvertibleTransformException;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+import java.awt.geom.RectangularShape;
+import java.awt.geom.RoundRectangle2D;
+
+import javax.swing.event.MouseInputAdapter;
+
+
+/**
+ * Controller which allows the user to select a region of a component. The user must click on a
+ * point in the component, then drag the mouse pointer whilst keeping the button pressed. During
+ * the dragging, the shape which is drawn will normally be a rectangle.  Other shapes could always
+ * be used such as, for example, an ellipse. To use this class, it is necessary to create a derived
+ * class which defines the following methods:
+ *
+ * <ul>
+ *   <li>{@link #selectionPerformed} (obligatory)</li>
+ *   <li>{@link #getModel} (optional)</li>
+ * </ul>
+ *
+ * This controller should then be registered with one, and only one, component
+ * using the following syntax:
+ *
+ * <blockquote><pre>
+ * {@link Component} component=...
+ * MouseSelectionTracker control=...
+ * component.addMouseListener(control);
+ * </pre></blockquote>
+ *
+ * @since 2.0
+ * @source $URL: http://svn.geotools.org/tags/2.4.5/modules/extension/widgets-swing/src/main/java/org/geotools/gui/swing/MouseSelectionTracker.java $
+ * @version $Id: MouseSelectionTracker.java 22482 2006-10-31 02:58:00Z desruisseaux $
+ * @author Martin Desruisseaux
+ */
+public abstract class MouseSelectionTracker extends MouseInputAdapter {
+    /**
+     * Stippled rectangle representing the region which the user is currently
+     * selecting.  This rectangle can be empty.  These coordinates are only
+     * significant in the period between the user pressing the mouse button
+     * and then releasing it to outline a region. Conventionally, the
+     * {@code null} value indicates that a line should be used instead of
+     * a rectangular shape.  The coordinates are always expressed in pixels.
+     */
+    private transient RectangularShape mouseSelectedArea;
+
+    /**
+     * Colour to replace during XOR drawings on a graphic.
+     * This colour is specified in {@link Graphics2D#setColor}.
+     */
+    private Color backXORColor = Color.white;
+
+    /**
+     * Colour to replace with during the XOR drawings on a graphic.
+     * This colour is specified in {@link Graphics2D#setXORMode}.
+     */
+    private Color lineXORColor = Color.black;
+
+    /**
+     * <var>x</var> coordinate of the mouse when the button is pressed.
+     */
+    private transient int ox;
+
+    /**
+     * <var>y</var> coordinate of the mouse when the button is pressed.
+     */
+    private transient int oy;
+
+    /**
+     * <var>x</var> coordinate of the mouse during the last drag.
+     */
+    private transient int px;
+
+    /**
+     * <var>y</var> coordinate of the mouse during the last drag.
+     */
+    private transient int py;
+
+    /**
+     * Indicates whether a selection is underway.
+     */
+    private transient boolean isDragging;
+
+    /**
+     * Constructs an object which will allow rectangular regions to be selected using the mouse.
+     */
+    public MouseSelectionTracker() {
+    }
+
+    /**
+     * Specifies the colours to be used for drawing the outline of a box when
+     * the user selects a region.  All {@code a} colours will be replaced
+     * by {@code b} colours and vice versa.
+     */
+    public void setXORColors(final Color a, final Color b) {
+        backXORColor = a;
+        lineXORColor = b;
+    }
+
+    /**
+     * Returns the geometric shape to use for marking the boundaries of a region.  This shape is
+     * normally a rectangle but could also be an ellipse, an arrow or even other shapes. The
+     * coordinates of the returned shape will not be taken into account. In fact, these coordinates
+     * will regularly be discarded. Only the class of the returned shape will count (for example,
+     * {@link java.awt.geom.Ellipse2D} vs {@link java.awt.geom.Rectangle2D}) and their parameters
+     * which are not linked to their position (for example, the rounding of a rectangle's
+     * corners).
+     * <p>
+     * The shape returned will normally be from a class derived from {@link RectangularShape},
+     * but could also be from the {@link Line2D} class. <strong>Any other class risks throwing a
+     * {@link ClassCastException} when executed</strong>.
+     *
+     * The default implementation always returns an object {@link Rectangle}.
+     *
+     * @param  event Mouse coordinate when the button is pressed.  This information can be used by
+     *         the derived classes which like to be informed of the position of the mouse before
+     *         chosing a geometric shape.
+     * @return Shape from the class {link RectangularShape} or {link Line2D}, or {@code null}
+     *         to indicate that we do not want to make a selection.
+     */
+    protected Shape getModel(final MouseEvent event) {
+        return new Rectangle();
+    }
+
+    /**
+     * Method which is automatically called after the user selects a region with the mouse.
+     * All coordinates passed in as parameters are expressed in pixels.
+     *
+     * @param ox <var>x</var> coordinate of the mouse when the user pressed the mouse button.
+     * @param oy <var>y</var> coordinate of the mouse when the user pressed the mouse button.
+     * @param px <var>x</var> coordinate of the mouse when the user released the mouse button.
+     * @param py <var>y</var> coordinate of the mouse when the user released the mouse button.
+     */
+    protected abstract void selectionPerformed(int ox, int oy, int px, int py);
+
+    /**
+     * Returns the geometric shape surrounding the last region to be selected by the user. An
+     * optional affine transform can be specified to convert the region selected by the user
+     * into logical coordinates. The class of the shape returned depends on the model returned by
+     * {@link #getModel}:
+     *
+     * <ul>
+     *   <li>If the model is null (which means that this {@code MouseSelectionTracker} object only
+     *       draws a line between points), the object returned will belong to the {@link Line2D}
+     *       class.</li>
+     *   <li>If the model is not null, the object returned can be from the same class (most often
+     *       {@link java.awt.geom.Rectangle2D}). There could always be situations where the object
+     *       returned is from another class, for example if the affine transform carries out a
+     *       rotation.</li>
+     * </ul>
+     *
+     * @param  transform Affine transform which converts logical coordinates into pixel coordinates.
+     *         It is usually an affine transform which is used in a {@code paint(...)} method to
+     *         draw shapes expressed in logical coordinates.
+     * @return A geometric shape enclosing the last region to be selected by the user, or
+     *         {@code null} if no selection has yet been made.
+     * @throws NoninvertibleTransformException If the affine transform can't be inverted.
+     */
+    public Shape getSelectedArea(final AffineTransform transform) throws NoninvertibleTransformException {
+        if (ox == px && oy == py) {
+            return null;
+        }
+        RectangularShape shape = mouseSelectedArea;
+        if (transform != null && !transform.isIdentity()) {
+            if (shape == null) {
+                final Point2D.Float po = new Point2D.Float(ox, oy);
+                final Point2D.Float pp = new Point2D.Float(px, py);
+                transform.inverseTransform(po, po);
+                transform.inverseTransform(pp, pp);
+                return new Line2D.Float(po, pp);
+            } else {
+                if (canReshape(shape, transform)) {
+                    final Point2D.Double point = new Point2D.Double();
+                    double xmin = Double.POSITIVE_INFINITY;
+                    double ymin = Double.POSITIVE_INFINITY;
+                    double xmax = Double.NEGATIVE_INFINITY;
+                    double ymax = Double.NEGATIVE_INFINITY;
+                    for (int i = 0; i < 4; i++) {
+                        point.x = (i&1) == 0 ? shape.getMinX() : shape.getMaxX();
+                        point.y = (i&2) == 0 ? shape.getMinY() : shape.getMaxY();
+                        transform.inverseTransform(point, point);
+                        if (point.x < xmin) xmin = point.x;
+                        if (point.x > xmax) xmax = point.x;
+                        if (point.y < ymin) ymin = point.y;
+                        if (point.y > ymax) ymax = point.y;
+                    }
+                    if (shape instanceof Rectangle) {
+                        return new Rectangle2D.Float((float) xmin,
+                                                     (float) ymin,
+                                                     (float) (xmax - xmin),
+                                                     (float) (ymax - ymin));
+                    } else {
+                        shape = (RectangularShape) shape.clone();
+                        shape.setFrame(xmin, ymin, xmax - xmin, ymax - ymin);
+                        return shape;
+                    }
+                }
+                else {
+                    return transform.createInverse().createTransformedShape(shape);
+                }
+            }
+        }
+        else {
+            return (shape != null) ? (Shape) shape.clone() : new Line2D.Float(ox, oy, px, py);
+        }
+    }
+
+    /**
+     * Indicates whether we can transform {@code shape} simply by calling its
+     * {@code shape.setFrame(...)} method rather than by using the heavy artillery
+     * that is the {@code transform.createTransformedShape(shape)} method.
+     */
+    private static boolean canReshape(final RectangularShape shape,
+                                      final AffineTransform transform) {
+        final int type=transform.getType();
+        if ((type & AffineTransform.TYPE_GENERAL_TRANSFORM) != 0) return false;
+        if ((type & AffineTransform.TYPE_MASK_ROTATION)     != 0) return false;
+        if ((type & AffineTransform.TYPE_FLIP)              != 0) {
+            if (shape instanceof Rectangle2D)      return true;
+            if (shape instanceof Ellipse2D)        return true;
+            if (shape instanceof RoundRectangle2D) return true;
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * Returns a {@link Graphics2D} object to be used for drawing in the specified component. We
+     * must not forget to call {@link Graphics2D#dispose} when the graphics object is no longer
+     * needed.
+     */
+    private Graphics2D getGraphics(final Component c) {
+        final Graphics2D graphics = (Graphics2D) c.getGraphics();
+        graphics.setXORMode(lineXORColor);
+        graphics.setColor  (backXORColor);
+        return graphics;
+    }
+
+    /**
+     * Informs this controller that the mouse button has been pressed.
+     * The default implementation retains the mouse coordinate (which will
+     * become one of the corners of the future rectangle to be drawn) 
+     * and prepares {@code this} to observe the mouse movements.
+     *
+     * @throws ClassCastException if {@link #getModel} doesn't return a shape
+     *         from the class {link RectangularShape} or {link Line2D}.
+     */
+    public void mousePressed(final MouseEvent event) throws ClassCastException {
+        if (!event.isConsumed() && (event.getModifiers() & MouseEvent.BUTTON1_MASK) != 0) {
+            final Component source = event.getComponent();
+            if (source != null) {
+                Shape model = getModel(event);
+                if (model != null) {
+                    isDragging = true;
+                    ox = px = event.getX();
+                    oy = py = event.getY();
+                    if (model instanceof Line2D) {
+                        model = null;
+                    }
+                    mouseSelectedArea = (RectangularShape) model;
+                    if (mouseSelectedArea != null) {
+                        mouseSelectedArea.setFrame(ox, oy, 0, 0);
+                    }
+                    source.addMouseMotionListener(this);
+                }
+                source.requestFocus();
+                event.consume();
+            }
+        }
+    }
+
+    /**
+     * Informs this controller that the mouse has been dragged.  The default
+     * implementation uses this to move a corner of the rectangle used to
+     * select the region. The other corner remains fixed at the point
+     * where the mouse was at the moment its button was pressed..
+     */
+    public void mouseDragged(final MouseEvent event) {
+        if (isDragging) {
+            final Graphics2D graphics = getGraphics(event.getComponent());
+            if (mouseSelectedArea == null) {
+                graphics.drawLine(ox, oy, px, py);
+                px = event.getX();
+                py = event.getY();
+                graphics.drawLine(ox, oy, px, py);
+            } else {
+                graphics.draw(mouseSelectedArea);
+                int xmin = this.ox;
+                int ymin = this.oy;
+                int xmax = px = event.getX();
+                int ymax = py = event.getY();
+                if (xmin > xmax) {
+                    final int xtmp = xmin;
+                    xmin = xmax; xmax = xtmp;
+                }
+                if (ymin > ymax) {
+                    final int ytmp = ymin;
+                    ymin = ymax; ymax = ytmp;
+                }
+                mouseSelectedArea.setFrame(xmin, ymin, xmax - xmin, ymax - ymin);
+                graphics.draw(mouseSelectedArea);
+            }
+            graphics.dispose();
+            event.consume();
+        }
+    }
+
+    /**
+     * Informs this controller that the mouse button has been released.
+     * The default implementation calls {@link #selectionPerformed} with
+     * the bounds of the selected region as parameters.
+     */
+    public void mouseReleased(final MouseEvent event) {
+        if (isDragging && (event.getModifiers() & MouseEvent.BUTTON1_MASK) != 0) {
+            isDragging = false;
+            final Component component = event.getComponent();
+            component.removeMouseMotionListener(this);
+
+            final Graphics2D graphics = getGraphics(event.getComponent());
+            if (mouseSelectedArea == null) {
+                graphics.drawLine(ox, oy, px, py);
+            } else {
+                graphics.draw(mouseSelectedArea);
+            }
+            graphics.dispose();
+            px = event.getX();
+            py = event.getY();
+            selectionPerformed(ox, oy, px, py);
+            event.consume();
+        }
+    }
+
+    /**
+     * Informs this controller that the mouse has been moved but not as a
+     * result of the user selecting a region.  The default implementation
+     * signals to the source component that {@code this} is no longer
+     * interested in being informed about mouse movements.
+     */
+    public void mouseMoved(final MouseEvent event) {
+        // Normally not necessary, but it seems that this "listener"
+        // sometimes stays in place when it shouldn't.
+        event.getComponent().removeMouseMotionListener(this);
+    }
+}

Deleted: branches/1.0-gt2-2.6/src/org/geotools/gui/swing/JMapPane.GT2-2.3.1
===================================================================
--- branches/1.0-gt2-2.6/src/org/geotools/gui/swing/JMapPane.GT2-2.3.1	2009-09-11 14:17:13 UTC (rev 383)
+++ branches/1.0-gt2-2.6/src/org/geotools/gui/swing/JMapPane.GT2-2.3.1	2009-09-11 16:16:38 UTC (rev 384)
@@ -1,704 +0,0 @@
-/*
- *    GeoTools - OpenSource mapping toolkit
- *    http://geotools.org
- *    (C) 2002-2006, GeoTools Project Managment Committee (PMC)
- *
- *    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;
- *    version 2.1 of the License.
- *
- *    This library is distributed in the hope that it will be useful,
- *    but WITHOUT ANY WARRANTY; without even the implied warranty of
- *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *    Lesser General Public License for more details.
- */
-package org.geotools.gui.swing;
-/**
- * @author Ian Turton
- *
- */
-import java.awt.Color;
-import java.awt.Graphics;
-import java.awt.Graphics2D;
-import java.awt.LayoutManager;
-import java.awt.Rectangle;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.awt.image.BufferedImage;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.io.IOException;
-
-import javax.swing.JPanel;
-
-import org.geotools.feature.FeatureCollection;
-import org.geotools.filter.Filter;
-import org.geotools.filter.FilterFactory;
-import org.geotools.filter.FilterFactoryFinder;
-import org.geotools.filter.GeometryFilter;
-import org.geotools.filter.IllegalFilterException;
-import org.geotools.gui.swing.event.HighlightChangeListener;
-import org.geotools.gui.swing.event.HighlightChangedEvent;
-import org.geotools.map.DefaultMapContext;
-import org.geotools.map.MapContext;
-import org.geotools.map.MapLayer;
-import org.geotools.renderer.GTRenderer;
-import org.geotools.styling.Graphic;
-import org.geotools.styling.LineSymbolizer;
-import org.geotools.styling.Mark;
-import org.geotools.styling.PointSymbolizer;
-import org.geotools.styling.PolygonSymbolizer;
-import org.geotools.styling.Style;
-import org.geotools.styling.StyleBuilder;
-import org.geotools.styling.StyleFactory;
-import org.geotools.styling.StyleFactoryFinder;
-import org.opengis.referencing.crs.CoordinateReferenceSystem;
-
-import com.vividsolutions.jts.geom.Coordinate;
-import com.vividsolutions.jts.geom.Envelope;
-import com.vividsolutions.jts.geom.Geometry;
-import com.vividsolutions.jts.geom.GeometryFactory;
-
-/**
- * <b>Xulu:<br>
- *    Code taken from gt-2.3.1 to suppress the {@code System.out}-messages
- *    in {@link #setState(int)} and {@link #paintComponent(Graphics)}.</b><br><br>
- *
- * A simple map container that is a JPanel with a map in.
- * provides simple pan,zoom, highlight and selection
- * The mappane stores an image of the map (drawn from the context) and
- * an image of the slected feature(s) to speed up
- * rendering of the highlights. Thus the whole map is only redrawn
- * when the bbox changes, selection is only redrawn when the
- * selected feature changes.
- *
- * If you intend to use this in production code you'll
- * need to make selection and highlighting work in the same way.
- * @author Ian Turton
- *
- */
-public class JMapPane extends JPanel implements MouseListener,
-        HighlightChangeListener, PropertyChangeListener {
-    /**
-     * what renders the map
-     */
-    GTRenderer renderer;
-
-    /**
-     * the map context to render
-     */
-    MapContext context;
-
-    private MapContext selectionContext;
-
-    /**
-     * the area of the map to draw
-     */
-    Envelope mapArea;
-
-    /**
-     * the size of the pane last time we drew
-     */
-    private Rectangle oldRect = null;
-
-    /**
-     * the last map area drawn.
-     */
-    private Envelope oldMapArea = null;
-
-    /**
-     * the base image of the map
-     */
-    private BufferedImage baseImage;
-    /**
-     * image of selection
-     */
-    private BufferedImage selectImage;
-    /**
-     * style for selected items
-     */
-    private Style selectionStyle;
-    /**
-     * layer that selection works on
-     */
-    private int selectionLayer = -1;
-    /**
-     * layer that highlight works on
-     */
-    private MapLayer highlightLayer;
-    /**
-     * the object which manages highlighting
-     */
-    private HighlightManager highlightManager;
-    /**
-     * is highlighting on or off
-     */
-    private boolean highlight = true;
-    /**
-     * a factory for filters
-     */
-    FilterFactory ff = FilterFactoryFinder.createFilterFactory();
-    /**
-     * a factory for geometries
-     */
-    GeometryFactory gf = new GeometryFactory();
-    /**
-     * the collections of features to be selected or highlighted
-     */
-    FeatureCollection selection, highlightFeature;
-
-    public static final int Reset = 0;
-
-    public static final int ZoomIn = 1;
-
-    public static final int ZoomOut = 2;
-
-    public static final int Pan = 3;
-
-    public static final int Select = 4;
-
-    private int state = ZoomIn;
-
-    /**
-     * how far to zoom in or out
-     */
-    private double zoomFactor = 2.0;
-
-    Style lineHighlightStyle;
-
-    Style pointHighlightStyle;
-
-    Style polygonHighlightStyle;
-
-    Style polygonSelectionStyle;
-
-    Style pointSelectionStyle;
-
-    Style lineSelectionStyle;
-
-    public JMapPane() {
-        this(null, true, null, null);
-    }
-    /**
-     * create a basic JMapPane
-     * @param render - how to draw the map
-     * @param context - the map context to display
-     */
-    public JMapPane(GTRenderer render, MapContext context) {
-        this(null, true, render, context);
-    }
-    /**
-     * full constructor extending JPanel
-     * @param layout - layout (probably shouldn't be set)
-     * @param isDoubleBuffered - a Swing thing I don't really understand
-     * @param render - what to draw the map with
-     * @param context - what to draw
-     */
-    public JMapPane(LayoutManager layout, boolean isDoubleBuffered,
-            GTRenderer render, MapContext context) {
-        super(layout, isDoubleBuffered);
-        setRenderer(render);
-
-        setContext(context);
-
-        this.addMouseListener(this);
-        setHighlightManager(new HighlightManager(highlightLayer));
-
-        lineHighlightStyle = setupStyle(LINE, Color.red);
-
-        pointHighlightStyle = setupStyle(POINT, Color.red);
-
-        polygonHighlightStyle = setupStyle(POLYGON, Color.red);
-
-        polygonSelectionStyle = setupStyle(POLYGON, Color.cyan);
-
-        pointSelectionStyle = setupStyle(POINT, Color.cyan);
-
-        lineSelectionStyle = setupStyle(LINE, Color.cyan);
-
-    }
-    /**
-     * get the renderer
-     */
-
-    public GTRenderer getRenderer() {
-        return renderer;
-    }
-
-    public void setRenderer(GTRenderer renderer) {
-        this.renderer = renderer;
-
-        if (this.context != null) {
-            this.renderer.setContext(this.context);
-
-        }
-    }
-
-    public MapContext getContext() {
-        return context;
-    }
-
-    public void setContext(MapContext context) {
-
-        this.context = context;
-
-        if (renderer != null) {
-            renderer.setContext(this.context);
-
-        }
-    }
-
-    public Envelope getMapArea() {
-        return mapArea;
-    }
-
-    public void setMapArea(Envelope mapArea) {
-        this.mapArea = mapArea;
-    }
-
-    public int getState() {
-        return state;
-    }
-
-    public void setState(int state) {
-        this.state = state;
-//        System.out.println("State: " + state);
-    }
-
-    public double getZoomFactor() {
-        return zoomFactor;
-    }
-
-    public void setZoomFactor(double zoomFactor) {
-        this.zoomFactor = zoomFactor;
-    }
-
-    public int getSelectionLayer() {
-        return selectionLayer;
-    }
-
-    public void setSelectionLayer(int selectionLayer) {
-        this.selectionLayer = selectionLayer;
-    }
-
-    public boolean isHighlight() {
-        return highlight;
-    }
-
-    public void setHighlight(boolean highlight) {
-        this.highlight = highlight;
-    }
-
-    public MapLayer getHighlightLayer() {
-        return highlightLayer;
-    }
-
-    public void setHighlightLayer(MapLayer highlightLayer) {
-        this.highlightLayer = highlightLayer;
-        if (highlightManager != null) {
-            highlightManager.setHighlightLayer(highlightLayer);
-        }
-    }
-
-    public HighlightManager getHighlightManager() {
-        return highlightManager;
-    }
-
-    public void setHighlightManager(HighlightManager highlightManager) {
-        this.highlightManager = highlightManager;
-        this.highlightManager.addHighlightChangeListener(this);
-        this.addMouseMotionListener(this.highlightManager);
-    }
-
-    public Style getLineHighlightStyle() {
-        return lineHighlightStyle;
-    }
-
-    public void setLineHighlightStyle(Style lineHighlightStyle) {
-        this.lineHighlightStyle = lineHighlightStyle;
-    }
-
-    public Style getLineSelectionStyle() {
-        return lineSelectionStyle;
-    }
-
-    public void setLineSelectionStyle(Style lineSelectionStyle) {
-        this.lineSelectionStyle = lineSelectionStyle;
-    }
-
-    public Style getPointHighlightStyle() {
-        return pointHighlightStyle;
-    }
-
-    public void setPointHighlightStyle(Style pointHighlightStyle) {
-        this.pointHighlightStyle = pointHighlightStyle;
-    }
-
-    public Style getPointSelectionStyle() {
-        return pointSelectionStyle;
-    }
-
-    public void setPointSelectionStyle(Style pointSelectionStyle) {
-        this.pointSelectionStyle = pointSelectionStyle;
-    }
-
-    public Style getPolygonHighlightStyle() {
-        return polygonHighlightStyle;
-    }
-
-    public void setPolygonHighlightStyle(Style polygonHighlightStyle) {
-        this.polygonHighlightStyle = polygonHighlightStyle;
-    }
-
-    public Style getPolygonSelectionStyle() {
-        return polygonSelectionStyle;
-    }
-
-    public void setPolygonSelectionStyle(Style polygonSelectionStyle) {
-        this.polygonSelectionStyle = polygonSelectionStyle;
-    }
-
-    private boolean reset = false;
-
-    protected void paintComponent(Graphics g) {
-        boolean changed = false;
-        super.paintComponent(g);
-        if (renderer == null || mapArea == null) {
-            return;
-        }
-        Rectangle r = getBounds();
-        Rectangle dr = new Rectangle(r.width, r.height);
-        if (!r.equals(oldRect) || reset) {
-            /*either the viewer size has changed or we've done a reset*/
-            changed = true; /* note we need to redraw */
-            reset = false; /* forget about the reset */
-            oldRect = r; /* store what the current size is */
-            double mapWidth = mapArea.getWidth(); /* get the extent of the map*/
-            double mapHeight = mapArea.getHeight();
-            double scaleX = r.getWidth() / mapArea.getWidth(); /* calculate the new scale*/
-            double scaleY = r.getHeight() / mapArea.getHeight();
-            double scale = 1.0; // stupid compiler!
-            if (scaleX < scaleY) {/*pick the smaller scale */
-                scale = scaleX;
-            } else {
-                scale = scaleY;
-            }
-            /* calculate the difference in width and height of the new extent*/
-            double deltaX = /*Math.abs*/((r.getWidth() / scale) - mapWidth);
-            double deltaY = /*Math.abs*/((r.getHeight() / scale) - mapHeight);
-
-//            System.out.println("delta x "+deltaX); System.out.println("delta y "+deltaY);
-            /* create the new extent */
-            Coordinate ll = new Coordinate(mapArea.getMinX() - (deltaX / 2.0),
-                    mapArea.getMinY() - (deltaY / 2.0));
-            Coordinate ur = new Coordinate(mapArea.getMaxX() + (deltaX / 2.0),
-                    mapArea.getMaxY() + (deltaY / 2.0));
-            mapArea = new Envelope(ll, ur);
-        }
-        if (!mapArea.equals(oldMapArea)) {/* did the map extent change?*/
-            changed = true;
-            oldMapArea = mapArea;
-        }
-        if (changed) {/* if the map changed then redraw*/
-
-            baseImage = new BufferedImage(dr.width, dr.height,
-                    BufferedImage.TYPE_INT_ARGB);
-            Graphics2D ig = baseImage.createGraphics();
-            /* System.out.println("rendering"); */
-            renderer.setContext(context);
-            renderer.paint((Graphics2D) ig, dr, mapArea);
-        }
-        ((Graphics2D) g).drawImage(baseImage, 0, 0, this);
-        if (selection != null && selection.size() > 0) {
-            // paint selection
-            /*
-             * String type = selection.getDefaultGeometry().getGeometryType();
-             * System.out.println(type); if(type==null) type="polygon";
-             */
-            String type = "polygon";
-            if (type.equalsIgnoreCase("polygon")) {
-
-                selectionStyle = polygonSelectionStyle;
-            } else if (type.equalsIgnoreCase("point")) {
-
-                selectionStyle = pointSelectionStyle;
-            } else if (type.equalsIgnoreCase("line")) {
-
-                selectionStyle = lineSelectionStyle;
-            }
-
-            selectionContext = new DefaultMapContext();
-
-            selectionContext.addLayer(selection, selectionStyle);
-            renderer.setContext(selectionContext);
-
-            selectImage = new BufferedImage(dr.width, dr.height,
-                    BufferedImage.TYPE_INT_ARGB);
-            Graphics2D ig = selectImage.createGraphics();
-            /* System.out.println("rendering selection"); */
-            renderer.paint((Graphics2D) ig, dr, mapArea);
-
-            ((Graphics2D) g).drawImage(selectImage, 0, 0, this);
-        }
-        if (highlight && highlightFeature != null
-                && highlightFeature.size() > 0) {
-            /*
-             * String type = selection.getDefaultGeometry().getGeometryType();
-             * System.out.println(type); if(type==null) type="polygon";
-             */
-            String type = "polygon";
-            Style highlightStyle = null;
-            if (type.equalsIgnoreCase("polygon")) {
-
-                highlightStyle = polygonHighlightStyle;
-            } else if (type.equalsIgnoreCase("point")) {
-
-                highlightStyle = pointHighlightStyle;
-            } else if (type.equalsIgnoreCase("line")) {
-
-                highlightStyle = lineHighlightStyle;
-            }
-
-            MapContext highlightContext = new DefaultMapContext();
-
-            highlightContext.addLayer(highlightFeature, highlightStyle);
-            renderer.setContext(highlightContext);
-
-            /* System.out.println("rendering highlight"); */
-            renderer.paint((Graphics2D) g, dr, mapArea);
-
-        }
-    }
-
-    public FeatureCollection doSelection(double x, double y, int layer) {
-        GeometryFilter f = null;
-        FeatureCollection select = null;
-        Geometry geometry = gf.createPoint(new Coordinate(x, y));
-        try {
-            f = ff.createGeometryFilter(GeometryFilter.GEOMETRY_CONTAINS);
-            f.addRightGeometry(ff.createLiteralExpression(geometry));
-        } catch (IllegalFilterException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-
-        if (layer == -1) {
-            for (int i = 0; i < context.getLayers().length; i++) {
-                FeatureCollection fx = findFeature(f, i);
-                if (select != null) {
-                    select.addAll(fx);
-                } else {
-                    select = fx;
-                }
-            }
-        } else {
-            select = findFeature(f, layer);
-        }
-        return select;
-    }
-
-    /**
-     * @param f -
-     *            a partial geometry filter. The geom name will be added
-     * @param i -
-     *            the index of the layer to search
-     * @throws IndexOutOfBoundsException
-     */
-    private FeatureCollection findFeature(GeometryFilter f, int i)
-            throws IndexOutOfBoundsException {
-        FeatureCollection fcol = null;
-        if (context != null && i > context.getLayers().length) {
-            return fcol;
-        }
-        MapLayer layer = context.getLayer(i);
-
-        try {
-            String name = layer.getFeatureSource().getSchema()
-                    .getDefaultGeometry().getName();
-            if (name == "")
-                name = "the_geom";
-            f.addLeftGeometry(ff.createAttributeExpression(name));
-            // System.out.println("looking with " + f);
-            FeatureCollection fc = layer.getFeatureSource().getFeatures(f);
-            if (fc.size() > 0) {
-                // selectionStyle.getFeatureTypeStyles()[0].getRules()[0].setFilter(f);
-                selectionLayer = i;
-            }
-            if (fcol == null) {
-                fcol = fc;
-                // here we should set the defaultgeom type
-            } else {
-                fcol.addAll(fc);
-            }
-            /*
-             * GeometryAttributeType gat =
-             * layer.getFeatureSource().getSchema().getDefaultGeometry();
-             * fcol.setDefaultGeometry((Geometry)gat.createDefaultValue());
-             */
-
-            /*
-             * Iterator fi = fc.iterator(); while (fi.hasNext()) { Feature feat =
-             * (Feature) fi.next(); System.out.println("selected " +
-             * feat.getAttribute("STATE_NAME")); }
-             */
-        } catch (IOException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        } catch (IllegalFilterException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }/*
-             * catch (IllegalAttributeException e) { // TODO Auto-generated
-             * catch block System.err.println(e.getMessage()); //
-             * e.printStackTrace(); }
-             */
-        return fcol;
-    }
-
-    public void mouseClicked(MouseEvent e) {
-        // TODO Auto-generated method stub
-        // System.out.println("before area "+mapArea+"\nw:"+mapArea.getWidth()+"
-        // h:"+mapArea.getHeight());
-        Rectangle bounds = this.getBounds();
-        double x = (double) (e.getX());
-        double y = (double) (e.getY());
-        double width = mapArea.getWidth();
-        double height = mapArea.getHeight();
-        double width2 = mapArea.getWidth() / 2.0;
-        double height2 = mapArea.getHeight() / 2.0;
-
-        double mapX = (x * width / (double) bounds.width) + mapArea.getMinX();
-        double mapY = ((bounds.getHeight() - y) * height / (double) bounds.height)
-                + mapArea.getMinY();
-        /*
-         * System.out.println(""+x+"->"+mapX);
-         * System.out.println(""+y+"->"+mapY);
-         */
-        /*
-         * Coordinate ll = new Coordinate(mapArea.getMinX(), mapArea.getMinY());
-         * Coordinate ur = new Coordinate(mapArea.getMaxX(), mapArea.getMaxY());
-         */
-        double zlevel = 1.0;
-        switch (state) {
-        case Pan:
-            zlevel = 1.0;
-            break;
-        case ZoomIn:
-            zlevel = zoomFactor;
-            break;
-        case ZoomOut:
-            zlevel = 1.0 / zoomFactor;
-            break;
-        case Select:
-            selection = doSelection(mapX, mapY, selectionLayer);
-            repaint();
-            return;
-        default:
-            return;
-        }
-        Coordinate ll = new Coordinate(mapX - (width2 / zlevel), mapY
-                - (height2 / zlevel));
-        Coordinate ur = new Coordinate(mapX + (width2 / zlevel), mapY
-                + (height2 / zlevel));
-
-        mapArea = new Envelope(ll, ur);
-        // System.out.println("after area "+mapArea+"\nw:"+mapArea.getWidth()+"
-        // h:"+mapArea.getHeight());
-        repaint();
-    }
-
-    public void mouseEntered(MouseEvent e) {
-        // TODO Auto-generated method stub
-
-    }
-
-    public void mouseExited(MouseEvent e) {
-        // TODO Auto-generated method stub
-
-    }
-
-    public void mousePressed(MouseEvent e) {
-        // TODO Auto-generated method stub
-
-    }
-
-    public void mouseReleased(MouseEvent e) {
-        // TODO Auto-generated method stub
-
-    }
-
-    private static final int POLYGON = 0;
-
-    private static final int LINE = 1;
-
-    private static final int POINT = 2;
-
-    private org.geotools.styling.Style setupStyle(int type, Color color) {
-        StyleFactory sf = StyleFactoryFinder.createStyleFactory();
-        StyleBuilder sb = new StyleBuilder(sf, ff);
-
-        org.geotools.styling.Style s = sf.createStyle();
-        s.setTitle("selection");
-
-        // TODO parameterise the color
-        PolygonSymbolizer ps = sb.createPolygonSymbolizer(color);
-        ps.setStroke(sb.createStroke(color));
-        LineSymbolizer ls = sb.createLineSymbolizer(color);
-        Graphic h = sb.createGraphic();
-        h.setMarks(new Mark[] { sb.createMark("square", color) });
-        PointSymbolizer pts = sb.createPointSymbolizer(h);
-
-        // Rule r = sb.createRule(new Symbolizer[]{ps,ls,pts});
-        switch (type) {
-        case POLYGON:
-            s = sb.createStyle(ps);
-            break;
-        case POINT:
-            s = sb.createStyle(pts);
-            break;
-        case LINE:
-            s = sb.createStyle(ls);
-        }
-
-        return s;
-
-    }
-
-    public void mouseDragged(MouseEvent e) {
-        // TODO Auto-generated method stub
-
-    }
-
-    public void highlightChanged(HighlightChangedEvent e) {
-        // TODO Auto-generated method stub
-
-        Filter f = e.getFilter();
-        try {
-            highlightFeature = highlightLayer.getFeatureSource().getFeatures(f);
-        } catch (IOException e1) {
-            // TODO Auto-generated catch block
-            e1.printStackTrace();
-        }
-        repaint();
-
-    }
-
-    public void propertyChange(PropertyChangeEvent evt) {
-        // TODO Auto-generated method stub
-        String prop = evt.getPropertyName();
-        if (prop.equalsIgnoreCase("crs")) {
-            context.setAreaOfInterest(context.getAreaOfInterest(),
-                    (CoordinateReferenceSystem) evt.getNewValue());
-        }
-    }
-
-    public boolean isReset() {
-        return reset;
-    }
-
-    public void setReset(boolean reset) {
-        this.reset = reset;
-    }
-}
-

Deleted: branches/1.0-gt2-2.6/src/org/geotools/gui/swing/JMapPane.GT2-2.3.4
===================================================================
--- branches/1.0-gt2-2.6/src/org/geotools/gui/swing/JMapPane.GT2-2.3.4	2009-09-11 14:17:13 UTC (rev 383)
+++ branches/1.0-gt2-2.6/src/org/geotools/gui/swing/JMapPane.GT2-2.3.4	2009-09-11 16:16:38 UTC (rev 384)
@@ -1,821 +0,0 @@
-/*
- *    GeoTools - OpenSource mapping toolkit
- *    http://geotools.org
- *    (C) 2002-2006, GeoTools Project Managment Committee (PMC)
- *
- *    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;
- *    version 2.1 of the License.
- *
- *    This library is distributed in the hope that it will be useful,
- *    but WITHOUT ANY WARRANTY; without even the implied warranty of
- *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *    Lesser General Public License for more details.
- */
-package org.geotools.gui.swing;
-/**
- * @author Ian Turton
- *
- */
-import java.awt.Color;
-import java.awt.Graphics;
-import java.awt.Graphics2D;
-import java.awt.LayoutManager;
-import java.awt.Rectangle;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.awt.image.BufferedImage;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.io.IOException;
-
-import javax.swing.JPanel;
-
-import org.geotools.feature.FeatureCollection;
-import org.geotools.filter.Filter;
-import org.geotools.filter.FilterFactory;
-import org.geotools.filter.FilterFactoryFinder;
-import org.geotools.filter.GeometryFilter;
-import org.geotools.filter.IllegalFilterException;
-import org.geotools.gui.swing.event.HighlightChangeListener;
-import org.geotools.gui.swing.event.HighlightChangedEvent;
-import org.geotools.map.DefaultMapContext;
-import org.geotools.map.MapContext;
-import org.geotools.map.MapLayer;
-import org.geotools.renderer.GTRenderer;
-import org.geotools.styling.Graphic;
-import org.geotools.styling.LineSymbolizer;
-import org.geotools.styling.Mark;
-import org.geotools.styling.PointSymbolizer;
-import org.geotools.styling.PolygonSymbolizer;
-import org.geotools.styling.Style;
-import org.geotools.styling.StyleBuilder;
-import org.geotools.styling.StyleFactory;
-import org.geotools.styling.StyleFactoryFinder;
-import org.opengis.referencing.crs.CoordinateReferenceSystem;
-
-import com.vividsolutions.jts.geom.Coordinate;
-import com.vividsolutions.jts.geom.Envelope;
-import com.vividsolutions.jts.geom.Geometry;
-import com.vividsolutions.jts.geom.GeometryFactory;
-
-/**
- * <b>Xulu:<br>
- *    Code taken from gt-2.3.4 to suppress the {@code System.out}-messages
- *    in {@link #setState(int)} and {@link #paintComponent(Graphics)}.</b><br><br>
- * A simple map container that is a JPanel with a map in.
- * provides simple pan,zoom, highlight and selection
- * The mappane stores an image of the map (drawn from the context) and
- * an image of the slected feature(s) to speed up
- * rendering of the highlights. Thus the whole map is only redrawn
- * when the bbox changes, selection is only redrawn when the
- * selected feature changes.
- *
- * If you intend to use this in production code you'll
- * need to make selection and highlighting work in the same way.
- * @author Ian Turton
- *
- */
-/**
- * @author ijt1
- *
- */
-/**
- * @author ijt1
- *
- */
-public class JMapPane extends JPanel implements MouseListener,
-        HighlightChangeListener, PropertyChangeListener {
-    /**
-     * what renders the map
-     */
-    GTRenderer renderer;
-
-    /**
-     * the map context to render
-     */
-    MapContext context;
-
-    private MapContext selectionContext;
-
-    /**
-     * the area of the map to draw
-     */
-    protected Envelope mapArea;
-
-    /**
-     * the size of the pane last time we drew
-     */
-    protected Rectangle oldRect = null;
-
-    /**
-     * the last map area drawn.
-     */
-    protected Envelope oldMapArea = null;
-
-    /**
-     * the base image of the map
-     */
-    private BufferedImage baseImage;
-    /**
-     * image of selection
-     */
-    private BufferedImage selectImage;
-    /**
-     * style for selected items
-     */
-    private Style selectionStyle;
-    /**
-     * layer that selection works on
-     */
-    private int selectionLayer = -1;
-    /**
-     * layer that highlight works on
-     */
-    private MapLayer highlightLayer;
-    /**
-     * the object which manages highlighting
-     */
-    private HighlightManager highlightManager;
-    /**
-     * is highlighting on or off
-     */
-    private boolean highlight = true;
-    /**
-     * a factory for filters
-     */
-    FilterFactory ff = FilterFactoryFinder.createFilterFactory();
-    /**
-     * a factory for geometries
-     */
-    GeometryFactory gf = new GeometryFactory();
-    /**
-     * the collections of features to be selected or highlighted
-     */
-    FeatureCollection selection, highlightFeature;
-
-    public static final int Reset = 0;
-
-    public static final int ZoomIn = 1;
-
-    public static final int ZoomOut = 2;
-
-    public static final int Pan = 3;
-
-    public static final int Select = 4;
-
-    private int state = ZoomIn;
-
-    /**
-     * how far to zoom in or out
-     */
-    private double zoomFactor = 2.0;
-
-    Style lineHighlightStyle;
-
-    Style pointHighlightStyle;
-
-    Style polygonHighlightStyle;
-
-    Style polygonSelectionStyle;
-
-    Style pointSelectionStyle;
-
-    Style lineSelectionStyle;
-
-    public JMapPane() {
-        this(null, true, null, null);
-    }
-    /**
-     * create a basic JMapPane
-     * @param render - how to draw the map
-     * @param context - the map context to display
-     */
-    public JMapPane(GTRenderer render, MapContext context) {
-        this(null, true, render, context);
-    }
-    /**
-     * full constructor extending JPanel
-     * @param layout - layout (probably shouldn't be set)
-     * @param isDoubleBuffered - a Swing thing I don't really understand
-     * @param render - what to draw the map with
-     * @param context - what to draw
-     */
-    public JMapPane(LayoutManager layout, boolean isDoubleBuffered,
-            GTRenderer render, MapContext context) {
-        super(layout, isDoubleBuffered);
-        setRenderer(render);
-
-        setContext(context);
-
-        this.addMouseListener(this);
-        setHighlightManager(new HighlightManager(highlightLayer));
-
-        lineHighlightStyle = setupStyle(LINE, Color.red);
-
-        pointHighlightStyle = setupStyle(POINT, Color.red);
-
-        polygonHighlightStyle = setupStyle(POLYGON, Color.red);
-
-        polygonSelectionStyle = setupStyle(POLYGON, Color.cyan);
-
-        pointSelectionStyle = setupStyle(POINT, Color.cyan);
-
-        lineSelectionStyle = setupStyle(LINE, Color.cyan);
-
-    }
-    /**
-     * get the renderer
-     */
-
-    public GTRenderer getRenderer() {
-        return renderer;
-    }
-
-    public void setRenderer(GTRenderer renderer) {
-        this.renderer = renderer;
-
-        if (this.context != null) {
-            this.renderer.setContext(this.context);
-
-        }
-    }
-
-    public MapContext getContext() {
-        return context;
-    }
-
-    public void setContext(MapContext context) {
-
-        this.context = context;
-
-        if (renderer != null) {
-            renderer.setContext(this.context);
-
-        }
-    }
-
-    public final Envelope getMapArea() {
-        return mapArea;
-    }
-
-    public void setMapArea(Envelope mapArea) {
-        this.mapArea = mapArea;
-    }
-
-    public int getState() {
-        return state;
-    }
-
-    public void setState(int state) {
-        this.state = state;
-//-- LINED OUT FOR XULU --
-//        System.out.println("State: " + state);
-    }
-
-    public double getZoomFactor() {
-        return zoomFactor;
-    }
-
-    public void setZoomFactor(double zoomFactor) {
-        this.zoomFactor = zoomFactor;
-    }
-
-    public int getSelectionLayer() {
-        return selectionLayer;
-    }
-
-    public void setSelectionLayer(int selectionLayer) {
-        this.selectionLayer = selectionLayer;
-    }
-
-    public boolean isHighlight() {
-        return highlight;
-    }
-
-    public void setHighlight(boolean highlight) {
-        this.highlight = highlight;
-    }
-
-    public MapLayer getHighlightLayer() {
-        return highlightLayer;
-    }
-
-    public void setHighlightLayer(MapLayer highlightLayer) {
-        this.highlightLayer = highlightLayer;
-        if (highlightManager != null) {
-            highlightManager.setHighlightLayer(highlightLayer);
-        }
-    }
-
-    public HighlightManager getHighlightManager() {
-        return highlightManager;
-    }
-
-    public void setHighlightManager(HighlightManager highlightManager) {
-        this.highlightManager = highlightManager;
-        this.highlightManager.addHighlightChangeListener(this);
-        this.addMouseMotionListener(this.highlightManager);
-    }
-
-    public Style getLineHighlightStyle() {
-        return lineHighlightStyle;
-    }
-
-    public void setLineHighlightStyle(Style lineHighlightStyle) {
-        this.lineHighlightStyle = lineHighlightStyle;
-    }
-
-    public Style getLineSelectionStyle() {
-        return lineSelectionStyle;
-    }
-
-    public void setLineSelectionStyle(Style lineSelectionStyle) {
-        this.lineSelectionStyle = lineSelectionStyle;
-    }
-
-    public Style getPointHighlightStyle() {
-        return pointHighlightStyle;
-    }
-
-    public void setPointHighlightStyle(Style pointHighlightStyle) {
-        this.pointHighlightStyle = pointHighlightStyle;
-    }
-
-    public Style getPointSelectionStyle() {
-        return pointSelectionStyle;
-    }
-
-    public void setPointSelectionStyle(Style pointSelectionStyle) {
-        this.pointSelectionStyle = pointSelectionStyle;
-    }
-
-    public Style getPolygonHighlightStyle() {
-        return polygonHighlightStyle;
-    }
-
-    public void setPolygonHighlightStyle(Style polygonHighlightStyle) {
-        this.polygonHighlightStyle = polygonHighlightStyle;
-    }
-
-    public Style getPolygonSelectionStyle() {
-        return polygonSelectionStyle;
-    }
-
-    public void setPolygonSelectionStyle(Style polygonSelectionStyle) {
-        this.polygonSelectionStyle = polygonSelectionStyle;
-    }
-
-    protected boolean reset = false;
-
-	private Double maxZoomScale = Double.MIN_VALUE;
-	private Double minZoomScale = Double.MAX_VALUE;
-
-	/**
-	 * SK 27.9.2007: Auch hier final bei den Variablen einfegfuegt, da die Routine so oft aufgerufen wird.
-	 */
-    protected void paintComponent(final Graphics g) {
-        boolean changed = false;
-        super.paintComponent(g);
-        if (renderer == null || mapArea == null) {
-            return;
-        }
-        final Rectangle r = getBounds();
-        final Rectangle dr = new Rectangle(r.width, r.height);
-        if (!r.equals(oldRect) || reset) {
-            /*either the viewer size has changed or we've done a reset*/
-            changed = true; /* note we need to redraw */
-            reset = false; /* forget about the reset */
-            oldRect = r; /* store what the current size is */
-            final double mapWidth = mapArea.getWidth(); /* get the extent of the map*/
-            final double mapHeight = mapArea.getHeight();
-            final double scaleX = r.getWidth() / mapArea.getWidth(); /* calculate the new scale*/
-            final double scaleY = r.getHeight() / mapArea.getHeight();
-            double scale = 1.0; // stupid compiler!
-            if (scaleX < scaleY) {/*pick the smaller scale */
-                scale = scaleX;
-            } else {
-                scale = scaleY;
-            }
-            /* calculate the difference in width and height of the new extent*/
-            final double deltaX = /*Math.abs*/((r.getWidth() / scale) - mapWidth);
-            final double deltaY = /*Math.abs*/((r.getHeight() / scale) - mapHeight);
-// -- LINED OUT FOR XULU --
-//            System.out.println("delta x "+deltaX); System.out.println("delta y "+deltaY);
-            /* create the new extent */
-            final Coordinate ll = new Coordinate(mapArea.getMinX() - (deltaX / 2.0),
-                    mapArea.getMinY() - (deltaY / 2.0));
-            final Coordinate ur = new Coordinate(mapArea.getMaxX() + (deltaX / 2.0),
-                    mapArea.getMaxY() + (deltaY / 2.0));
-            mapArea = new Envelope(ll, ur);
-        }
-        if (!mapArea.equals(oldMapArea)) {/* did the map extent change?*/
-            changed = true;
-            oldMapArea = mapArea;
-        }
-        if (changed) {/* if the map changed then redraw*/
-
-            baseImage = new BufferedImage(dr.width, dr.height,
-                    BufferedImage.TYPE_INT_ARGB);
-            final Graphics2D ig = baseImage.createGraphics();
-            /* System.out.println("rendering"); */
-            renderer.setContext(context);
-            renderer.paint((Graphics2D) ig, dr, mapArea);
-        }
-        ((Graphics2D) g).drawImage(baseImage, 0, 0, this);
-        if (selection != null && selection.size() > 0) {
-            // paint selection
-            /*
-             * String type = selection.getDefaultGeometry().getGeometryType();
-             * System.out.println(type); if(type==null) type="polygon";
-             */
-            final String type = "polygon";
-            if (type.equalsIgnoreCase("polygon")) {
-
-                selectionStyle = polygonSelectionStyle;
-            } else if (type.equalsIgnoreCase("point")) {
-
-                selectionStyle = pointSelectionStyle;
-            } else if (type.equalsIgnoreCase("line")) {
-
-                selectionStyle = lineSelectionStyle;
-            }
-
-            selectionContext = new DefaultMapContext();
-
-            selectionContext.addLayer(selection, selectionStyle);
-            renderer.setContext(selectionContext);
-
-            selectImage = new BufferedImage(dr.width, dr.height,
-                    BufferedImage.TYPE_INT_ARGB);
-            final Graphics2D ig = selectImage.createGraphics();
-            /* System.out.println("rendering selection"); */
-            renderer.paint((Graphics2D) ig, dr, mapArea);
-
-            ((Graphics2D) g).drawImage(selectImage, 0, 0, this);
-        }
-        if (highlight && highlightFeature != null
-                && highlightFeature.size() > 0) {
-            /*
-             * String type = selection.getDefaultGeometry().getGeometryType();
-             * System.out.println(type); if(type==null) type="polygon";
-             */
-            final String type = "polygon";
-            Style highlightStyle = null;
-            if (type.equalsIgnoreCase("polygon")) {
-
-                highlightStyle = polygonHighlightStyle;
-            } else if (type.equalsIgnoreCase("point")) {
-
-                highlightStyle = pointHighlightStyle;
-            } else if (type.equalsIgnoreCase("line")) {
-
-                highlightStyle = lineHighlightStyle;
-            }
-
-            final MapContext highlightContext = new DefaultMapContext();
-
-            highlightContext.addLayer(highlightFeature, highlightStyle);
-            renderer.setContext(highlightContext);
-
-            /* System.out.println("rendering highlight"); */
-            renderer.paint((Graphics2D) g, dr, mapArea);
-
-        }
-    }
-
-    public FeatureCollection doSelection(double x, double y, int layer) {
-        GeometryFilter f = null;
-        FeatureCollection select = null;
-        Geometry geometry = gf.createPoint(new Coordinate(x, y));
-        try {
-            f = ff.createGeometryFilter(GeometryFilter.GEOMETRY_CONTAINS);
-            f.addRightGeometry(ff.createLiteralExpression(geometry));
-        } catch (IllegalFilterException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-
-        if (layer == -1) {
-            for (int i = 0; i < context.getLayers().length; i++) {
-                FeatureCollection fx = findFeature(f, i);
-                if (select != null) {
-                    select.addAll(fx);
-                } else {
-                    select = fx;
-                }
-            }
-        } else {
-            select = findFeature(f, layer);
-        }
-        return select;
-    }
-
-    /**
-     * @param f -
-     *            a partial geometry filter. The geom name will be added
-     * @param i -
-     *            the index of the layer to search
-     * @throws IndexOutOfBoundsException
-     */
-    private FeatureCollection findFeature(GeometryFilter f, int i)
-            throws IndexOutOfBoundsException {
-        FeatureCollection fcol = null;
-        if (context != null && i > context.getLayers().length) {
-            return fcol;
-        }
-        MapLayer layer = context.getLayer(i);
-
-        try {
-            String name = layer.getFeatureSource().getSchema()
-                    .getDefaultGeometry().getName();
-            if (name == "")
-                name = "the_geom";
-            f.addLeftGeometry(ff.createAttributeExpression(name));
-            // System.out.println("looking with " + f);
-            FeatureCollection fc = layer.getFeatureSource().getFeatures(f);
-            if (fc.size() > 0) {
-                // selectionStyle.getFeatureTypeStyles()[0].getRules()[0].setFilter(f);
-                selectionLayer = i;
-            }
-            if (fcol == null) {
-                fcol = fc;
-                // here we should set the defaultgeom type
-            } else {
-                fcol.addAll(fc);
-            }
-            /*
-             * GeometryAttributeType gat =
-             * layer.getFeatureSource().getSchema().getDefaultGeometry();
-             * fcol.setDefaultGeometry((Geometry)gat.createDefaultValue());
-             */
-
-            /*
-             * Iterator fi = fc.iterator(); while (fi.hasNext()) { Feature feat =
-             * (Feature) fi.next(); System.out.println("selected " +
-             * feat.getAttribute("STATE_NAME")); }
-             */
-        } catch (IOException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        } catch (IllegalFilterException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }/*
-             * catch (IllegalAttributeException e) { // TODO Auto-generated
-             * catch block System.err.println(e.getMessage()); //
-             * e.printStackTrace(); }
-             */
-        return fcol;
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
-     */
-    public void mouseClicked(MouseEvent e) {
-        // System.out.println("before area "+mapArea+"\nw:"+mapArea.getWidth()+"
-        // h:"+mapArea.getHeight());
-        Rectangle bounds = this.getBounds();
-        double x = (double) (e.getX());
-        double y = (double) (e.getY());
-        double width = mapArea.getWidth();
-        double height = mapArea.getHeight();
-
-        double width2 = width / 2.0;
-        double height2 = height / 2.0;
-
-        double mapX = (x * width / (double) bounds.width) + mapArea.getMinX();
-        double mapY = ((bounds.getHeight() - y) * height / (double) bounds.height)
-                + mapArea.getMinY();
-        /*
-         * System.out.println(""+x+"->"+mapX);
-         * System.out.println(""+y+"->"+mapY);
-         */
-        /*
-         * Coordinate ll = new Coordinate(mapArea.getMinX(), mapArea.getMinY());
-         * Coordinate ur = new Coordinate(mapArea.getMaxX(), mapArea.getMaxY());
-         */
-
-        double zlevel = 1.0;
-        switch (state) {
-	        case Pan:
-	            zlevel = 1.0;
-
-	            // Changed by SK: return here.. a mouselistener is amanaging the PANNING
-	            return;
-	        case ZoomIn:
-	            zlevel = zoomFactor;
-	            break;
-	        case ZoomOut:
-	            zlevel = 1.0 / zoomFactor;
-	            break;
-	        case Select:
-	            selection = doSelection(mapX, mapY, selectionLayer);
-	            repaint();
-	            return;
-	        default:
-	            return;
-        }
-
-    	//****************************************************************************
-        // Changed by SK:
-    	// performing the zoom and/or pan by recalculating the mapArea
-        // important and new here: don't zoom in/out more that the min/max scale!
-        // n.b.: zoom is not only performed here, but also and with the mouse wheel and setMapArea
-    	//****************************************************************************
-
-    	Coordinate ll = new Coordinate(mapX - (width2 / zlevel), mapY
-    			- (height2 / zlevel));
-    	Coordinate ur = new Coordinate(mapX + (width2 / zlevel), mapY
-    			+ (height2 / zlevel));
-
-    	final Envelope newMapArea = new Envelope(ll, ur);
-
-    	// Hier passiert die Ueberpruefung und ggf Anpassung der Scale
-		mapArea = bestAllowedMapArea( newMapArea );
-
-        // System.out.println("after area "+mapArea+"\nw:"+mapArea.getWidth()+"
-        // h:"+mapArea.getHeight());
-        repaint();
-    }
-
-
-	  /**
-	   * Korrigiert den {@link Envelope} aka mapArea auf die beste erlaubte Flaeche damit
-	   * die Massstabsbeschaenkungen noch eingehalten werden, FALLS der uebergeben Envelope
-	   * nicht schon gueltig sein sollte.
-	   *
-	   * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons Kr&uuml;ger</a>
-	   */
-	  public Envelope bestAllowedMapArea(Envelope env) {
-		    if (getWidth() == 0) return env;
-		    
-		    if (env == null) return env;
-
-			double scale = env.getWidth() / getWidth();
-
-			double centerX = env.getMinX() + env.getWidth() / 2.;
-			double centerY = env.getMinY() + env.getHeight() / 2.;
-
-			double newWidth2;
-			double newHeight2;
-			if (scale < getMaxZoomScale()){
-
-				//****************************************************************************
-				// Wir zoomen weiter rein als erlaubt => Anpassen des envelope
-				//****************************************************************************
-		    	newWidth2 = getMaxZoomScale() * getWidth() / 2.;
-				newHeight2 = getMaxZoomScale() * getHeight() / 2.;
-			} else
-				if (scale > getMinZoomScale())
-				{
-
-					//****************************************************************************
-					// Wir zoomen weiter raus als erlaubt => Anpassen des envelope
-					//****************************************************************************
-					newWidth2 = getMinZoomScale() * getWidth() / 2.;
-					newHeight2 = getMinZoomScale() * getHeight() / 2.;
-				} else {
-
-					//****************************************************************************
-					// Die mapArea / der Envelope ist ist gueltig! Keine Aenderungen
-					//****************************************************************************
-					return env;
-				}
-
-			Coordinate ll = new Coordinate(centerX - newWidth2, centerY
-					- newHeight2);
-			Coordinate ur = new Coordinate(centerX + newWidth2, centerY
-					+ newHeight2);
-
-			return new Envelope(ll, ur);
-	}
-
-	public void mouseEntered(MouseEvent e) {
-    }
-
-    public void mouseExited(MouseEvent e) {
-    }
-
-    public void mousePressed(MouseEvent e) {
-    }
-
-    public void mouseReleased(MouseEvent e) {
-    }
-
-    private static final int POLYGON = 0;
-
-    private static final int LINE = 1;
-
-    private static final int POINT = 2;
-
-    private org.geotools.styling.Style setupStyle(int type, Color color) {
-        StyleFactory sf = StyleFactoryFinder.createStyleFactory();
-        StyleBuilder sb = new StyleBuilder(sf, ff);
-
-        org.geotools.styling.Style s = sf.createStyle();
-        s.setTitle("selection");
-
-        // TODO parameterise the color
-        PolygonSymbolizer ps = sb.createPolygonSymbolizer(color);
-        ps.setStroke(sb.createStroke(color));
-        LineSymbolizer ls = sb.createLineSymbolizer(color);
-        Graphic h = sb.createGraphic();
-        h.setMarks(new Mark[] { sb.createMark("square", color) });
-        PointSymbolizer pts = sb.createPointSymbolizer(h);
-
-        // Rule r = sb.createRule(new Symbolizer[]{ps,ls,pts});
-        switch (type) {
-        case POLYGON:
-            s = sb.createStyle(ps);
-            break;
-        case POINT:
-            s = sb.createStyle(pts);
-            break;
-        case LINE:
-            s = sb.createStyle(ls);
-        }
-
-        return s;
-
-    }
-
-    public void mouseDragged(MouseEvent e) {
-        // TODO Auto-generated method stub
-
-    }
-
-    public void highlightChanged(HighlightChangedEvent e) {
-        // TODO Auto-generated method stub
-
-        Filter f = e.getFilter();
-        try {
-            highlightFeature = highlightLayer.getFeatureSource().getFeatures(f);
-        } catch (IOException e1) {
-            // TODO Auto-generated catch block
-            e1.printStackTrace();
-        }
-        repaint();
-
-    }
-
-    public void propertyChange(PropertyChangeEvent evt) {
-        // TODO Auto-generated method stub
-        String prop = evt.getPropertyName();
-        if (prop.equalsIgnoreCase("crs")) {
-            context.setAreaOfInterest(context.getAreaOfInterest(),
-                    (CoordinateReferenceSystem) evt.getNewValue());
-        }
-    }
-
-    public boolean isReset() {
-        return reset;
-    }
-
-    public void setReset(boolean reset) {
-        this.reset = reset;
-    }
-
-
-
-    /**
-     * Retuns the minimum allowed zoom scale. This is the bigger number value of the two.
-     * Defaults to {@link Double}.MAX_VALUE
-     *
-     * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons Kr&uuml;ger</a>
-     */
-    public Double getMinZoomScale() {
-		return minZoomScale;
-	}
-
-
-	/**
-     * Retuns the maximum allowed zoom scale. This is the smaller number value of the two.
-     * Defaults to {@link Double}.MIN_VALUE
-     *
-     * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons Kr&uuml;ger</a>
-     */
-    public Double getMaxZoomScale() {
-		return maxZoomScale;
-	}
-
-    /**
-     * Set the maximum allowed zoom scale. This is the smaller number value of the two.
-     *
-     * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons Kr&uuml;ger</a>
-     */
-	public void setMaxZoomScale(Double maxZoomScale) {
-		// System.out.println("setting max scale to "+maxZoomScale);
-		this.maxZoomScale = maxZoomScale;
-	}
-	/**
-	 * Set the minimum (nearest) allowed zoom scale. This is the bigger number value of the two.
-	 *
-	 * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons Kr&uuml;ger</a>
-	 */
-	public void setMinZoomScale(Double minZoomScale) {
-		this.minZoomScale = minZoomScale;
-	}
-}

Deleted: branches/1.0-gt2-2.6/src/org/geotools/gui/swing/JMapPane.java
===================================================================
--- branches/1.0-gt2-2.6/src/org/geotools/gui/swing/JMapPane.java	2009-09-11 14:17:13 UTC (rev 383)
+++ branches/1.0-gt2-2.6/src/org/geotools/gui/swing/JMapPane.java	2009-09-11 16:16:38 UTC (rev 384)
@@ -1,1084 +0,0 @@
-/*
- *    GeoTools - OpenSource mapping toolkit
- *    http://geotools.org
- *    (C) 2002-2006, GeoTools Project Managment Committee (PMC)
- *
- *    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;
- *    version 2.1 of the License.
- *
- *    This library is distributed in the hope that it will be useful,
- *    but WITHOUT ANY WARRANTY; without even the implied warranty of
- *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *    Lesser General Public License for more details.
- */
-package org.geotools.gui.swing;
-
-/**
- * <b>Xulu:<br>
- *    Code taken from gt-2.4.5 to make some changes (marked with {@code xulu}),
- *    which can not be realized in a subclass:</b>
- *    <ul>
- *       <li>{@link #getMapArea()} declared as {@code final}<li>
- *       <li>some variables declared as {@code protected}</li>
- *       <li>minimal/maximal zoom scale</li>
- *       <li>zoom in and zoom out via mouse click realized by setMapArea(..)</li>
- *    </ul>
- * <br><br>
- * A simple map container that is a JPanel with a map in. provides simple
- * pan,zoom, highlight and selection The mappane stores an image of the map
- * (drawn from the context) and an image of the slected feature(s) to speed up
- * rendering of the highlights. Thus the whole map is only redrawn when the bbox
- * changes, selection is only redrawn when the selected feature changes.
- *
- *
- * @author Ian Turton
- *
- */
-
-import java.awt.Color;
-import java.awt.Cursor;
-import java.awt.Graphics;
-import java.awt.Graphics2D;
-import java.awt.LayoutManager;
-import java.awt.Rectangle;
-import java.awt.event.InputEvent;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.awt.event.MouseMotionListener;
-import java.awt.image.BufferedImage;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.io.IOException;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.swing.JPanel;
-
-import org.apache.log4j.Logger;
-import org.geotools.map.MapContext;
-import org.geotools.map.event.MapLayerListEvent;
-import org.geotools.map.event.MapLayerListListener;
-import org.geotools.renderer.GTRenderer;
-import org.geotools.renderer.label.LabelCacheImpl;
-import org.geotools.renderer.lite.LabelCache;
-import org.geotools.renderer.lite.StreamingRenderer;
-import org.geotools.renderer.shape.ShapefileRenderer;
-import org.geotools.styling.Graphic;
-import org.geotools.styling.LineSymbolizer;
-import org.geotools.styling.Mark;
-import org.geotools.styling.PointSymbolizer;
-import org.geotools.styling.PolygonSymbolizer;
-import org.geotools.styling.StyleBuilder;
-import org.geotools.styling.StyleFactory;
-import org.opengis.filter.FilterFactory2;
-import org.opengis.referencing.crs.CoordinateReferenceSystem;
-
-import schmitzm.swing.SwingUtil;
-
-import com.vividsolutions.jts.geom.Coordinate;
-import com.vividsolutions.jts.geom.Envelope;
-import com.vividsolutions.jts.geom.GeometryFactory;
-
-public class JMapPane extends JPanel implements MouseListener,
-		MouseMotionListener, PropertyChangeListener, MapLayerListListener {
-	private static Logger LOGGER = Logger.getLogger(JMapPane.class.getName());
-
-	private static final long serialVersionUID = -8647971481359690499L;
-
-	public static final int Reset = 0;
-
-	public static final int ZoomIn = 1;
-
-	public static final int ZoomOut = 2;
-
-	public static final int Pan = 3;
-
-	public static final int Select = 4;
-
-	private static final int POLYGON = 0;
-
-	private static final int LINE = 1;
-
-	private static final int POINT = 2;
-
-	/**
-	 * what renders the map
-	 */
-	GTRenderer renderer;
-
-	private GTRenderer highlightRenderer, selectionRenderer;
-
-	/**
-	 * the map context to render
-	 */
-	MapContext context;
-
-	private MapContext selectionContext;
-
-	/**
-	 * the area of the map to draw
-	 */
-	// xulu.sc
-	// Envelope mapArea;
-	protected Envelope mapArea;
-	// xulu.ec
-
-	/**
-	 * the size of the pane last time we drew
-	 */
-	// xulu.sc
-	// private Rectangle oldRect = null;
-	protected Rectangle oldRect = null;
-	// xulu.ec
-
-	/**
-	 * the last map area drawn.
-	 */
-	// xulu.sc
-	// private Envelope oldMapArea = null;
-	protected Envelope oldMapArea = null;
-	// xulu.ec
-
-	/**
-	 * the base image of the map
-	 */
-	protected BufferedImage baseImage, panningImage;
-	// SK: private BufferedImage baseImage, panningImage;
-
-	/**
-	 * a factory for filters
-	 */
-	FilterFactory2 ff;
-
-	/**
-	 * a factory for geometries
-	 */
-	GeometryFactory gf = new GeometryFactory(); // FactoryFinder.getGeometryFactory(null);
-
-	private int state = ZoomIn;
-
-	/**
-	 * how far to zoom in or out
-	 */
-	private double zoomFactor = 2.0;
-
-	boolean changed = true;
-
-	LabelCache labelCache = new LabelCacheImpl();
-
-	// xulu.sc
-	// private boolean reset = false;
-	protected boolean reset = false;
-	// xulu.ec
-
-	int startX;
-
-	int startY;
-
-	private boolean clickable;
-
-	int lastX;
-
-	int lastY;
-
-	// xulu.sn
-	private Double maxZoomScale = Double.MIN_VALUE;
-	private Double minZoomScale = Double.MAX_VALUE;
-	// xulu.en
-
-	// sk.sn
-	/**
-	 * Wenn true, dann wurde PANNING via mouseDraged-Events begonnen. Dieses
-	 * Flag wird benutzt um nur einmal den passenden Cursor nur einmal zu
-	 * setzen.
-	 */
-	private boolean panning_started = false;
-
-	// sk.en
-
-	public JMapPane() {
-		this(null, true, null, null);
-	}
-
-	/**
-	 * create a basic JMapPane
-	 * 
-	 * @param render
-	 *            - how to draw the map
-	 * @param context
-	 *            - the map context to display
-	 */
-	public JMapPane(final GTRenderer render, final MapContext context) {
-		this(null, true, render, context);
-	}
-
-	/**
-	 * full constructor extending JPanel
-	 * 
-	 * @param layout
-	 *            - layout (probably shouldn't be set)
-	 * @param isDoubleBuffered
-	 *            - a Swing thing I don't really understand
-	 * @param render
-	 *            - what to draw the map with
-	 * @param context
-	 *            - what to draw
-	 */
-	public JMapPane(final LayoutManager layout, final boolean isDoubleBuffered,
-			final GTRenderer render, final MapContext context) {
-		super(layout, isDoubleBuffered);
-
-		ff = (FilterFactory2) org.geotools.factory.CommonFactoryFinder
-				.getFilterFactory(null);
-		setRenderer(render);
-
-		setContext(context);
-
-		this.addMouseListener(this);
-		this.addMouseMotionListener(this);
-		setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
-	}
-
-	/**
-	 * get the renderer
-	 */
-	public GTRenderer getRenderer() {
-		return renderer;
-	}
-
-	public void setRenderer(final GTRenderer renderer) {
-		Map<Object,Object> hints = new HashMap<Object,Object>();
-		
-		this.renderer = renderer;
-		
-		if (renderer instanceof StreamingRenderer || renderer instanceof ShapefileRenderer) {
-			hints = renderer.getRendererHints();
-			if (hints == null) {
-				hints = new HashMap<Object,Object>();
-			}
-			if (hints.containsKey(StreamingRenderer.LABEL_CACHE_KEY)) {
-				labelCache = (LabelCache) hints
-						.get(StreamingRenderer.LABEL_CACHE_KEY);
-			} else {
-				hints.put(StreamingRenderer.LABEL_CACHE_KEY, labelCache);
-			}
-
-			hints.put("memoryPreloadingEnabled", Boolean.TRUE);
-			
-			renderer.setRendererHints(hints);
-		}
-
-//		this.highlightRenderer = new StreamingRenderer();
-//		this.selectionRenderer = new StreamingRenderer();
-
-//		highlightRenderer.setRendererHints(hints);
-//		selectionRenderer.setRendererHints(hints);
-		
-//		renderer.setRendererHints(hints);
-
-		if (this.context != null) {
-			this.renderer.setContext(this.context);
-		}
-	}
-
-	public MapContext getContext() {
-		return context;
-	}
-
-	public void setContext(final MapContext context) {
-		if (this.context != null) {
-			this.context.removeMapLayerListListener(this);
-		}
-
-		this.context = context;
-
-		if (context != null) {
-			this.context.addMapLayerListListener(this);
-		}
-
-		if (renderer != null) {
-			renderer.setContext(this.context);
-		}
-	}
-
-	public Envelope getMapArea() {
-		return mapArea;
-	}
-
-	public void setMapArea(final Envelope mapArea) {
-		this.mapArea = mapArea;
-	}
-
-	public int getState() {
-		return state;
-	}
-
-	public void setState(final int state) {
-		this.state = state;
-
-		// System.out.println("State: " + state);
-	}
-
-	public double getZoomFactor() {
-		return zoomFactor;
-	}
-
-	public void setZoomFactor(final double zoomFactor) {
-		this.zoomFactor = zoomFactor;
-	}
-
-
-	protected void paintComponent(final Graphics g) {
-		super.paintComponent(g);
-
-		if ((renderer == null) || (mapArea == null)) {
-			return;
-		}
-
-		final Rectangle r = getBounds();
-		final Rectangle dr = new Rectangle(r.width, r.height);
-
-		if (!r.equals(oldRect) || reset) {
-			if (!r.equals(oldRect) && (mapArea == null)) {
-				try {
-					mapArea = context.getLayerBounds();
-				} catch (final IOException e) {
-					LOGGER.warn("context.getLayerBounds()", e);
-				}
-			}
-
-			if (mapArea != null) {
-				/* either the viewer size has changed or we've done a reset */
-				changed = true; /* note we need to redraw */
-				reset = false; /* forget about the reset */
-				oldRect = r; /* store what the current size is */
-
-				mapArea = fixAspectRatio(r, mapArea);
-			}
-		}
-
-		if (!mapArea.equals(oldMapArea)) { /* did the map extent change? */
-			changed = true;
-			oldMapArea = mapArea;
-			// when we tell the context that the bounds have changed WMSLayers
-			// can refresh them selves
-			context.setAreaOfInterest(mapArea, context
-					.getCoordinateReferenceSystem());
-		}
-
-		if (changed ) { /* if the map changed then redraw */
-			changed = false;
-			baseImage = new BufferedImage(dr.width, dr.height,
-					BufferedImage.TYPE_INT_ARGB);
-
-			final Graphics2D ig = baseImage.createGraphics();
-			/* System.out.println("rendering"); */
-			if (renderer.getContext() != null) 
-				renderer.setContext(context);
-			labelCache.clear(); // work around anoying labelcache bug
-
-			// draw the map
-			renderer.paint((Graphics2D) ig, dr, mapArea);
-
-			// TODO nur machen, wenn panning beginnt
-			panningImage = new BufferedImage(dr.width, dr.height,
-					BufferedImage.TYPE_INT_RGB);
-
-		}
-
-		((Graphics2D) g).drawImage(baseImage, 0, 0, this);
-	}
-
-	private Envelope fixAspectRatio(final Rectangle r, final Envelope mapArea) {
-
-		final double mapWidth = mapArea.getWidth(); /* get the extent of the map */
-		final double mapHeight = mapArea.getHeight();
-		final double scaleX = r.getWidth() / mapArea.getWidth(); /*
-															 * calculate the new
-															 * scale
-															 */
-
-		final double scaleY = r.getHeight() / mapArea.getHeight();
-		double scale = 1.0; // stupid compiler!
-
-		if (scaleX < scaleY) { /* pick the smaller scale */
-			scale = scaleX;
-		} else {
-			scale = scaleY;
-		}
-
-		/* calculate the difference in width and height of the new extent */
-		final double deltaX = /* Math.abs */((r.getWidth() / scale) - mapWidth);
-		final double deltaY = /* Math.abs */((r.getHeight() / scale) - mapHeight);
-
-		/*
-		 * System.out.println("delta x " + deltaX);
-		 * System.out.println("delta y " + deltaY);
-		 */
-
-		/* create the new extent */
-		final Coordinate ll = new Coordinate(mapArea.getMinX() - (deltaX / 2.0),
-				mapArea.getMinY() - (deltaY / 2.0));
-		final Coordinate ur = new Coordinate(mapArea.getMaxX() + (deltaX / 2.0),
-				mapArea.getMaxY() + (deltaY / 2.0));
-
-		return new Envelope(ll, ur);
-	}
-
-//	public void doSelection(final double x, final double y, final MapLayer layer) {
-//
-//		final Geometry geometry = gf.createPoint(new Coordinate(x, y));
-//
-//		// org.opengis.geometry.Geometry geometry = new Point();
-//
-//		findFeature(geometry, layer);
-//
-//	}
-//
-//	/**
-//	 * @param geometry
-//	 *            - a geometry to construct the filter with
-//	 * @param i
-//	 *            - the index of the layer to search
-//	 * @throws IndexOutOfBoundsException
-//	 */
-//	private void findFeature(final Geometry geometry, final MapLayer layer)
-//			throws IndexOutOfBoundsException {
-//		org.opengis.filter.spatial.BinarySpatialOperator f = null;
-//
-//		if ((context == null) || (layer == null)) {
-//			return;
-//		}
-//
-//		try {
-//			String name = layer.getFeatureSource().getSchema()
-//					.getDefaultGeometry().getLocalName();
-//
-//			if (name == "") {
-//				name = "the_geom";
-//			}
-//
-//			try {
-//				f = ff.contains(ff.property(name), ff.literal(geometry));
-//				if (selectionManager != null) {
-////					System.out.println("selection changed");
-//					selectionManager.selectionChanged(this, f);
-//
-//				}
-//			} catch (final IllegalFilterException e) {
-//				// TODO Auto-generated catch block
-//				e.printStackTrace();
-//			}
-//
-//			/*
-//			 * // f.addLeftGeometry(ff.property(name)); //
-//			 * System.out.println("looking with " + f); FeatureCollection fc =
-//			 * layer.getFeatureSource().getFeatures(f);
-//			 * 
-//			 * 
-//			 * 
-//			 * if (fcol == null) { fcol = fc;
-//			 * 
-//			 * // here we should set the defaultgeom type } else {
-//			 * fcol.addAll(fc); }
-//			 */
-//
-//			/*
-//			 * GeometryAttributeType gat =
-//			 * layer.getFeatureSource().getSchema().getDefaultGeometry();
-//			 * fcol.setDefaultGeometry((Geometry)gat.createDefaultValue());
-//			 */
-//
-//			/*
-//			 * Iterator fi = fc.iterator(); while (fi.hasNext()) { SimpleFeature feat
-//			 * = (SimpleFeature) fi.next(); System.out.println("selected " +
-//			 * feat.getAttribute("STATE_NAME")); }
-//			 */
-//		} catch (final IllegalFilterException e) {
-//			// TODO Auto-generated catch block
-//			e.printStackTrace();
-//		}
-//		return;
-//	}
-
-	public void mouseClicked(final MouseEvent e) {
-		if (mapArea == null) return;
-		// System.out.println("before area "+mapArea+"\nw:"+mapArea.getWidth()+"
-		// h:"+mapArea.getHeight());
-		final Rectangle bounds = this.getBounds();
-		final double x = (double) (e.getX());
-		final double y = (double) (e.getY());
-		final double width = mapArea.getWidth();
-		final double height = mapArea.getHeight();
-		// xulu.sc
-		// double width2 = mapArea.getWidth() / 2.0;
-		// double height2 = mapArea.getHeight() / 2.0;
-		final double width2 = width / 2.0;
-		final double height2 = height / 2.0;
-		// xulu.ec
-		final double mapX = ((x * width) / (double) bounds.width) + mapArea.getMinX();
-		final double mapY = (((bounds.getHeight() - y) * height) / (double) bounds.height)
-				+ mapArea.getMinY();
-
-		/*
-		 * System.out.println(""+x+"->"+mapX);
-		 * System.out.println(""+y+"->"+mapY);
-		 */
-
-		/*
-		 * Coordinate ll = new Coordinate(mapArea.getMinX(), mapArea.getMinY());
-		 * Coordinate ur = new Coordinate(mapArea.getMaxX(), mapArea.getMaxY());
-		 */
-		double zlevel = 1.0;
-
-		switch (state) {
-		case Pan:
-			zlevel = 1.0;
-			// xulu.sc SK: return here.. a mouselistener is managing the PANNING
-			// break;
-			return;
-			// xulu.ec
-		case ZoomIn:
-			zlevel = zoomFactor;
-
-			break;
-
-		case ZoomOut:
-			zlevel = 1.0 / zoomFactor;
-
-			break;
-//
-//		case Select:
-//			doSelection(mapX, mapY, selectionLayer);
-//
-//			return;
-
-		default:
-			return;
-		}
-
-		final Coordinate ll = new Coordinate(mapX - (width2 / zlevel), mapY
-				- (height2 / zlevel));
-		final Coordinate ur = new Coordinate(mapX + (width2 / zlevel), mapY
-				+ (height2 / zlevel));
-		// xulu.sc SK: Check for min/max scale
-		// mapArea = new Envelope(ll, ur);
-		final Envelope newMapArea = new Envelope(ll, ur);
-		setMapArea(bestAllowedMapArea(newMapArea));
-		// xulu.ec
-
-		// sk.ec
-
-		// System.out.println("after area "+mapArea+"\nw:"+mapArea.getWidth()+"
-		// h:"+mapArea.getHeight());
-		repaint();
-	}
-
-	public void mouseEntered(final MouseEvent e) {
-	}
-
-	public void mouseExited(final MouseEvent e) {
-	}
-
-	public void mousePressed(final MouseEvent e) {
-		startX = e.getX();
-		startY = e.getY();
-		lastX = 0;
-		lastY = 0;
-	}
-
-	public void mouseReleased(final MouseEvent e) {
-		final int endX = e.getX();
-		final int endY = e.getY();
-
-		processDrag(startX, startY, endX, endY, e);
-		lastX = 0;
-		lastY = 0;
-
-		/**
-		 * Es wird nicht (mehr) gepannt!
-		 */
-		panning_started = false;
-	}
-
-	public void mouseDragged(final MouseEvent e) {
-		final Graphics graphics = this.getGraphics();
-		final int x = e.getX();
-		final int y = e.getY();
-
-		if ((state == JMapPane.Pan)
-				|| ((e.getModifiersEx() & InputEvent.BUTTON3_DOWN_MASK) != 0)) {
-			/**
-			 * SK: Der Cursor wird auf PANNING gesetzt.
-			 */
-			if (panning_started == false) {
-				panning_started = true;
-				setCursor(SwingUtil.PANNING_CURSOR);
-			}
-
-			// move the image with the mouse
-			if ((lastX > 0) && (lastY > 0)) {
-				final int dx = lastX - startX;
-				final int dy = lastY - startY;
-				// System.out.println("translate "+dx+","+dy);
-				final Graphics2D g2 = panningImage.createGraphics();
-				g2.setBackground(new Color(240, 240, 240)); // TODO richtige
-															// farbe? am besten
-															// vom L&F die
-															// hintergrundfarbe
-															// auslesen...
-				
-				g2.clearRect(0, 0, this.getWidth(), this.getHeight());
-				g2.drawImage(baseImage, dx, dy, this);
-				graphics.drawImage(panningImage, 0, 0, this);
-			}
-
-			lastX = x;
-			lastY = y;
-		} else
-
-		if ((state == JMapPane.ZoomIn) || (state == JMapPane.ZoomOut)) {
-
-			graphics.setXORMode(Color.WHITE);
-
-			if ((lastX > 0) && (lastY > 0)) {
-				drawRectangle(graphics);
-			}
-
-			// draw new box
-			lastX = x;
-			lastY = y;
-			drawRectangle(graphics);
-		} 
-//		else if (state == JMapPane.Select && selectionLayer != null) {
-//
-//			// construct a new bbox filter
-//			final Rectangle bounds = this.getBounds();
-//
-//			final double mapWidth = mapArea.getWidth();
-//			final double mapHeight = mapArea.getHeight();
-//
-//			final double x1 = ((this.startX * mapWidth) / (double) bounds.width)
-//					+ mapArea.getMinX();
-//			final double y1 = (((bounds.getHeight() - this.startY) * mapHeight) / (double) bounds.height)
-//					+ mapArea.getMinY();
-//			final double x2 = ((x * mapWidth) / (double) bounds.width)
-//					+ mapArea.getMinX();
-//			final double y2 = (((bounds.getHeight() - y) * mapHeight) / (double) bounds.height)
-//					+ mapArea.getMinY();
-//			final double left = Math.min(x1, x2);
-//			final double right = Math.max(x1, x2);
-//			final double bottom = Math.min(y1, y2);
-//			final double top = Math.max(y1, y2);
-//
-//			String name = selectionLayer.getFeatureSource().getSchema()
-//					.getDefaultGeometry().getName();
-//
-//			if (name == "") {
-//				name = "the_geom";
-//			}
-//			final Filter bb = ff.bbox(ff.property(name), left, bottom, right, top,
-//					getContext().getCoordinateReferenceSystem().toString());
-//			if (selectionManager != null) {
-//				selectionManager.selectionChanged(this, bb);
-//			}
-//
-//			graphics.setXORMode(Color.green);
-//
-//			/*
-//			 * if ((lastX > 0) && (lastY > 0)) { drawRectangle(graphics); }
-//			 */
-//
-//			// draw new box
-//			lastX = x;
-//			lastY = y;
-//			drawRectangle(graphics);
-//		}
-
-	}
-
-	// sk.cs
-	// private void processDrag(int x1, int y1, int x2, int y2) {
-	// sk.ce
-	protected void processDrag(final int x1, final int y1, final int x2,
-			final int y2, final MouseEvent e) {
-
-		/****
-		 * If no layer is availabe we dont want a NullPointerException
-		 */
-		if (mapArea == null)
-			return;
-
-		// System.out.println("processing drag from " + x1 + "," + y1 + " -> "
-		// + x2 + "," + y2);
-		if ((x1 == x2) && (y1 == y2)) {
-			if (isClickable()) {
-				mouseClicked(new MouseEvent(this, 0, new Date().getTime(), 0,
-						x1, y1, y2, false));
-			}
-
-			return;
-		}
-
-		final Rectangle bounds = this.getBounds();
-
-		final double mapWidth = mapArea.getWidth();
-		final double mapHeight = mapArea.getHeight();
-
-		final double startX = ((x1 * mapWidth) / (double) bounds.width)
-				+ mapArea.getMinX();
-		final double startY = (((bounds.getHeight() - y1) * mapHeight) / (double) bounds.height)
-				+ mapArea.getMinY();
-		final double endX = ((x2 * mapWidth) / (double) bounds.width)
-				+ mapArea.getMinX();
-		final double endY = (((bounds.getHeight() - y2) * mapHeight) / (double) bounds.height)
-				+ mapArea.getMinY();
-
-		if ((state == JMapPane.Pan) || (e.getButton() == MouseEvent.BUTTON3)) {
-			// move the image with the mouse
-			// calculate X offsets from start point to the end Point
-			final double deltaX1 = endX - startX;
-
-			// System.out.println("deltaX " + deltaX1);
-			// new edges
-			final double left = mapArea.getMinX() - deltaX1;
-			final double right = mapArea.getMaxX() - deltaX1;
-
-			// now for Y
-			final double deltaY1 = endY - startY;
-
-			// System.out.println("deltaY " + deltaY1);
-			final double bottom = mapArea.getMinY() - deltaY1;
-			final double top = mapArea.getMaxY() - deltaY1;
-			final Coordinate ll = new Coordinate(left, bottom);
-			final Coordinate ur = new Coordinate(right, top);
-			// xulu.sc
-			// mapArea = fixAspectRatio(this.getBounds(), new Envelope(ll, ur));
-			setMapArea(fixAspectRatio(this.getBounds(), new Envelope(ll, ur)));
-			// xulu.ec
-		} else if (state == JMapPane.ZoomIn) {
-
-			// Zu kleine Flächen sollen nicht gezoomt werden.
-			// sk.bc
-			if ((Math.abs(x1 - x2) * Math.abs(y2 - y1)) < 150)
-				return;
-			// sk.ec
-
-			drawRectangle(this.getGraphics());
-			// make the dragged rectangle (in map coords) the new BBOX
-			final double left = Math.min(startX, endX);
-			final double right = Math.max(startX, endX);
-			final double bottom = Math.min(startY, endY);
-			final double top = Math.max(startY, endY);
-			final Coordinate ll = new Coordinate(left, bottom);
-			final Coordinate ur = new Coordinate(right, top);
-			// xulu.sc
-
-			// mapArea = fixAspectRatio(this.getBounds(), new Envelope(ll, ur));
-			setMapArea(bestAllowedMapArea(new Envelope(ll, ur)));
-
-			// sk.sc
-//			{
-//			// SK tries to paint a preview of the zoom ;-9 aha.... well
-//			Graphics2D graphics = (Graphics2D) JMapPane.this.getGraphics();
-//			graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
-//					RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR);
-//			graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
-//					RenderingHints.VALUE_ANTIALIAS_OFF);
-//			graphics.setRenderingHint(RenderingHints.KEY_RENDERING,
-//					RenderingHints.VALUE_RENDER_SPEED);
-//			graphics.drawImage(baseImage, 0, 0, JMapPane.this.getWidth(),
-//					JMapPane.this.getHeight(), x1, y1, x2, y2, null);
-//			}
-			// xulu.ec
-		} else if (state == JMapPane.ZoomOut) {
-			drawRectangle(this.getGraphics());
-
-			// make the dragged rectangle in screen coords the new map size?
-			final double left = Math.min(startX, endX);
-			final double right = Math.max(startX, endX);
-			final double bottom = Math.min(startY, endY);
-			final double top = Math.max(startY, endY);
-			final double nWidth = (mapWidth * mapWidth) / (right - left);
-			final double nHeight = (mapHeight * mapHeight) / (top - bottom);
-			final double deltaX1 = left - mapArea.getMinX();
-			final double nDeltaX1 = (deltaX1 * nWidth) / mapWidth;
-			final double deltaY1 = bottom - mapArea.getMinY();
-			final double nDeltaY1 = (deltaY1 * nHeight) / mapHeight;
-			final Coordinate ll = new Coordinate(mapArea.getMinX() - nDeltaX1,
-					mapArea.getMinY() - nDeltaY1);
-			final double deltaX2 = mapArea.getMaxX() - right;
-			final double nDeltaX2 = (deltaX2 * nWidth) / mapWidth;
-			final double deltaY2 = mapArea.getMaxY() - top;
-			final double nDeltaY2 = (deltaY2 * nHeight) / mapHeight;
-			final Coordinate ur = new Coordinate(mapArea.getMaxX() + nDeltaX2,
-					mapArea.getMaxY() + nDeltaY2);
-			// xulu.sc
-			// mapArea = fixAspectRatio(this.getBounds(), new Envelope(ll, ur));
-			setMapArea(bestAllowedMapArea(new Envelope(ll, ur)));
-
-			// xulu.ec
-		} 
-//		else if (state == JMapPane.Select && selectionLayer != null) {
-//			final double left = Math.min(startX, endX);
-//			final double right = Math.max(startX, endX);
-//			final double bottom = Math.min(startY, endY);
-//			final double top = Math.max(startY, endY);
-//
-//			String name = selectionLayer.getFeatureSource().getSchema()
-//					.getDefaultGeometry().getLocalName();
-//
-//			if (name == "") {
-//				name = "the_geom";
-//			}
-//			final Filter bb = ff.bbox(ff.property(name), left, bottom, right, top,
-//					getContext().getCoordinateReferenceSystem().toString());
-//			// System.out.println(bb.toString());
-//			if (selectionManager != null) {
-//				selectionManager.selectionChanged(this, bb);
-//			}
-//			/*
-//			 * FeatureCollection fc; selection = null; try { fc =
-//			 * selectionLayer.getFeatureSource().getFeatures(bb); selection =
-//			 * fc; } catch (IOException e) { e.printStackTrace(); }
-//			 */
-//		}
-
-		// xulu.so
-		// setMapArea(mapArea);
-		// xulu.eo
-		repaint();
-	}
-
-	private boolean isClickable() {
-		return clickable;
-	}
-
-	private org.geotools.styling.Style setupStyle(final int type, final Color color) {
-		final StyleFactory sf = org.geotools.factory.CommonFactoryFinder
-				.getStyleFactory(null);
-		final StyleBuilder sb = new StyleBuilder();
-
-		org.geotools.styling.Style s = sf.createStyle();
-		s.setTitle("selection");
-
-		// TODO parameterise the color
-		final PolygonSymbolizer ps = sb.createPolygonSymbolizer(color);
-		ps.setStroke(sb.createStroke(color));
-
-		final LineSymbolizer ls = sb.createLineSymbolizer(color);
-		final Graphic h = sb.createGraphic();
-		h.setMarks(new Mark[] { sb.createMark("square", color) });
-
-		final PointSymbolizer pts = sb.createPointSymbolizer(h);
-
-		// Rule r = sb.createRule(new Symbolizer[]{ps,ls,pts});
-		switch (type) {
-		case POLYGON:
-			s = sb.createStyle(ps);
-
-			break;
-
-		case POINT:
-			s = sb.createStyle(pts);
-
-			break;
-
-		case LINE:
-			s = sb.createStyle(ls);
-		}
-
-		return s;
-	}
-
-
-	public void propertyChange(final PropertyChangeEvent evt) {
-		final String prop = evt.getPropertyName();
-
-		if (prop.equalsIgnoreCase("crs")) {
-			context.setAreaOfInterest(context.getAreaOfInterest(),
-					(CoordinateReferenceSystem) evt.getNewValue());
-		}
-	}
-
-	public boolean isReset() {
-		return reset;
-	}
-
-	public void setReset(final boolean reset) {
-		this.reset = reset;
-	}
-
-	public void layerAdded(final MapLayerListEvent event) {
-		changed = true;
-
-		if (context.getLayers().length == 1) { // the first one
-
-			try {
-				// xulu.sc
-				// mapArea = context.getLayerBounds();
-				mapArea = context.getAreaOfInterest();
-				if (mapArea == null)
-					mapArea = context.getLayerBounds();
-				// xulu.ec
-			} catch (final IOException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
-
-			reset = true;
-		}
-
-		repaint();
-	}
-
-	public void layerRemoved(final MapLayerListEvent event) {
-		changed = true;
-		repaint();
-	}
-
-	public void layerChanged(final MapLayerListEvent event) {
-		changed = true;
-		// System.out.println("layer changed - repaint");
-		repaint();
-	}
-
-	public void layerMoved(final MapLayerListEvent event) {
-		changed = true;
-		repaint();
-	}
-
-	protected void drawRectangle(final Graphics graphics) {
-		// undraw last box/draw new box
-		final int left = Math.min(startX, lastX);
-		final int right = Math.max(startX, lastX);
-		final int top = Math.max(startY, lastY);
-		final int bottom = Math.min(startY, lastY);
-		final int width = right - left;
-		final int height = top - bottom;
-		// System.out.println("drawing rect("+left+","+bottom+","+ width+","+
-		// height+")");
-		graphics.drawRect(left, bottom, width, height);
-	}
-
-	/**
-	 * if clickable is set to true then a single click on the map pane will zoom
-	 * or pan the map.
-	 * 
-	 * @param clickable
-	 */
-	public void setClickable(final boolean clickable) {
-		this.clickable = clickable;
-	}
-
-	public void mouseMoved(final MouseEvent e) {
-	}
-
-
-
-	// xulu.sn
-	/**
-	 * Korrigiert den {@link Envelope} aka {@code mapArea} auf die beste
-	 * erlaubte Flaeche damit die Massstabsbeschaenkungen noch eingehalten
-	 * werden, FALLS der uebergeben Envelope nicht schon gueltig sein sollte.<br/>
-	 * Since 21. April 09: Before thecalculation starts, the aspect ratio is
-	 * corrected. This change implies, that setMapArea() will most of the time
-	 * not allow setting to a wrong aspectRatio.
-	 * 
-	 * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons
-	 *         Kr&uuml;ger</a>
-	 */
-	public Envelope bestAllowedMapArea(Envelope env) {
-		if (getWidth() == 0)
-			return env;
-		if (env == null)
-			return env;
-
-		/**
-		 * Correct the aspect Ratio before we check the rest. Otherwise we might
-		 * easily fail.
-		 */
-		env = fixAspectRatio(this.getBounds(), env);
-
-		final double scale = env.getWidth() / getWidth();
-		final double centerX = env.getMinX() + env.getWidth() / 2.;
-		final double centerY = env.getMinY() + env.getHeight() / 2.;
-		double newWidth2;
-		double newHeight2;
-		if (scale < getMaxZoomScale()) {
-			// ****************************************************************************
-			// Wir zoomen weiter rein als erlaubt => Anpassen des envelope
-			// ****************************************************************************
-			newWidth2 = getMaxZoomScale() * getWidth() / 2.;
-			newHeight2 = getMaxZoomScale() * getHeight() / 2.;
-		} else if (scale > getMinZoomScale()) {
-			// ****************************************************************************
-			// Wir zoomen weiter raus als erlaubt => Anpassen des envelope
-			// ****************************************************************************
-			newWidth2 = getMinZoomScale() * getWidth() / 2.;
-			newHeight2 = getMinZoomScale() * getHeight() / 2.;
-		} else {
-			// ****************************************************************************
-			// Die mapArea / der Envelope ist ist gueltig! Keine Aenderungen
-			// ****************************************************************************
-			return env;
-		}
-
-		final Coordinate ll = new Coordinate(centerX - newWidth2, centerY
-				- newHeight2);
-		final Coordinate ur = new Coordinate(centerX + newWidth2, centerY
-				+ newHeight2);
-
-		return new Envelope(ll, ur);
-	}
-
-	/**
-	 * Retuns the minimum allowed zoom scale. This is the bigger number value of
-	 * the two. Defaults to {@link Double}.MAX_VALUE
-	 * 
-	 * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons
-	 *         Kr&uuml;ger</a>
-	 */
-	public Double getMinZoomScale() {
-		return minZoomScale;
-	}
-
-	/**
-	 * Retuns the maximum allowed zoom scale. This is the smaller number value
-	 * of the two. Defaults to {@link Double}.MIN_VALUE
-	 * 
-	 * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons
-	 *         Kr&uuml;ger</a>
-	 */
-	public Double getMaxZoomScale() {
-		return maxZoomScale;
-	}
-
-	/**
-	 * Set the maximum allowed zoom scale. This is the smaller number value of
-	 * the two.
-	 * 
-	 * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons
-	 *         Kr&uuml;ger</a>
-	 */
-	public void setMaxZoomScale(final Double maxZoomScale) {
-		// System.out.println("setting max scale to "+maxZoomScale);
-		this.maxZoomScale = maxZoomScale;
-	}
-
-	/**
-	 * Set the minimum (nearest) allowed zoom scale. This is the bigger number
-	 * value of the two.
-	 * 
-	 * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons
-	 *         Kr&uuml;ger</a>
-	 */
-	public void setMinZoomScale(final Double minZoomScale) {
-		this.minZoomScale = minZoomScale;
-	}
-	// xulu.en
-
-}

Deleted: branches/1.0-gt2-2.6/src/org/geotools/gui/swing/MouseSelectionTracker_Public.java
===================================================================
--- branches/1.0-gt2-2.6/src/org/geotools/gui/swing/MouseSelectionTracker_Public.java	2009-09-11 14:17:13 UTC (rev 383)
+++ branches/1.0-gt2-2.6/src/org/geotools/gui/swing/MouseSelectionTracker_Public.java	2009-09-11 16:16:38 UTC (rev 384)
@@ -1,16 +0,0 @@
-package org.geotools.gui.swing;
-
-import gtmig.org.geotools.gui.swing.MouseSelectionTracker;
-
-
-/**
- * Diese Klasse stellt lediglich eine Dummy-Klasse dar, um die Geotools-Klasse
- * {@link MouseSelectionTracker} auch von ausserhalb des Pakets
- * <code>org.geotools.gui.swing</code> verwenden zu koennen.
- * {@link MouseSelectionTracker org.geotools.gui.swing.MouseSelectionTracker}
- * ist naemlich keine <code>public</code>-Klasse.
- * @author <a href="mailto:martin.schmitz at koeln.de">Martin Schmitz</a> (University of Bonn/Germany)
- * @version 1.0
- */
-public abstract class MouseSelectionTracker_Public extends MouseSelectionTracker {
-}

Deleted: branches/1.0-gt2-2.6/src/org/geotools/gui/swing/package.html
===================================================================
--- branches/1.0-gt2-2.6/src/org/geotools/gui/swing/package.html	2009-09-11 14:17:13 UTC (rev 383)
+++ branches/1.0-gt2-2.6/src/org/geotools/gui/swing/package.html	2009-09-11 16:16:38 UTC (rev 384)
@@ -1,8 +0,0 @@
-<html>
-<body>
-	Dieses Paket enthält angepasste Klassen der
-	<a href="http://www.geotools.org" target=_blank>GeoTools</a>-Bibliothek, sowie
-	Klassen, die aus Zugriffsgründen direkt im Paket <code>org.geotools.gui.swing</code>
-	implementiert werden müssen.
-</body>
-</html>
\ No newline at end of file

Copied: branches/1.0-gt2-2.6/src/org/geotools/swing/JMapPane.GT2-2.3.1 (from rev 383, branches/1.0-gt2-2.6/src/org/geotools/gui/swing/JMapPane.GT2-2.3.1)

Copied: branches/1.0-gt2-2.6/src/org/geotools/swing/JMapPane.GT2-2.3.4 (from rev 383, branches/1.0-gt2-2.6/src/org/geotools/gui/swing/JMapPane.GT2-2.3.4)

Copied: branches/1.0-gt2-2.6/src/org/geotools/swing/JMapPane.java (from rev 382, branches/1.0-gt2-2.6/src/org/geotools/gui/swing/JMapPane.java)
===================================================================
--- branches/1.0-gt2-2.6/src/org/geotools/gui/swing/JMapPane.java	2009-09-04 17:02:58 UTC (rev 382)
+++ branches/1.0-gt2-2.6/src/org/geotools/swing/JMapPane.java	2009-09-11 16:16:38 UTC (rev 384)
@@ -0,0 +1,1084 @@
+/*
+ *    GeoTools - OpenSource mapping toolkit
+ *    http://geotools.org
+ *    (C) 2002-2006, GeoTools Project Managment Committee (PMC)
+ *
+ *    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;
+ *    version 2.1 of the License.
+ *
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ */
+package org.geotools.swing;
+
+/**
+ * <b>Xulu:<br>
+ *    Code taken from gt-2.4.5 to make some changes (marked with {@code xulu}),
+ *    which can not be realized in a subclass:</b>
+ *    <ul>
+ *       <li>{@link #getMapArea()} declared as {@code final}<li>
+ *       <li>some variables declared as {@code protected}</li>
+ *       <li>minimal/maximal zoom scale</li>
+ *       <li>zoom in and zoom out via mouse click realized by setMapArea(..)</li>
+ *    </ul>
+ * <br><br>
+ * A simple map container that is a JPanel with a map in. provides simple
+ * pan,zoom, highlight and selection The mappane stores an image of the map
+ * (drawn from the context) and an image of the slected feature(s) to speed up
+ * rendering of the highlights. Thus the whole map is only redrawn when the bbox
+ * changes, selection is only redrawn when the selected feature changes.
+ *
+ *
+ * @author Ian Turton
+ *
+ */
+
+import java.awt.Color;
+import java.awt.Cursor;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.LayoutManager;
+import java.awt.Rectangle;
+import java.awt.event.InputEvent;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
+import java.awt.image.BufferedImage;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.IOException;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.swing.JPanel;
+
+import org.apache.log4j.Logger;
+import org.geotools.map.MapContext;
+import org.geotools.map.event.MapLayerListEvent;
+import org.geotools.map.event.MapLayerListListener;
+import org.geotools.renderer.GTRenderer;
+import org.geotools.renderer.label.LabelCacheImpl;
+import org.geotools.renderer.lite.LabelCache;
+import org.geotools.renderer.lite.StreamingRenderer;
+import org.geotools.renderer.shape.ShapefileRenderer;
+import org.geotools.styling.Graphic;
+import org.geotools.styling.LineSymbolizer;
+import org.geotools.styling.Mark;
+import org.geotools.styling.PointSymbolizer;
+import org.geotools.styling.PolygonSymbolizer;
+import org.geotools.styling.StyleBuilder;
+import org.geotools.styling.StyleFactory;
+import org.opengis.filter.FilterFactory2;
+import org.opengis.referencing.crs.CoordinateReferenceSystem;
+
+import schmitzm.swing.SwingUtil;
+
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.Envelope;
+import com.vividsolutions.jts.geom.GeometryFactory;
+
+public class JMapPane extends JPanel implements MouseListener,
+		MouseMotionListener, PropertyChangeListener, MapLayerListListener {
+	private static Logger LOGGER = Logger.getLogger(JMapPane.class.getName());
+
+	private static final long serialVersionUID = -8647971481359690499L;
+
+	public static final int Reset = 0;
+
+	public static final int ZoomIn = 1;
+
+	public static final int ZoomOut = 2;
+
+	public static final int Pan = 3;
+
+	public static final int Select = 4;
+
+	private static final int POLYGON = 0;
+
+	private static final int LINE = 1;
+
+	private static final int POINT = 2;
+
+	/**
+	 * what renders the map
+	 */
+	GTRenderer renderer;
+
+	private GTRenderer highlightRenderer, selectionRenderer;
+
+	/**
+	 * the map context to render
+	 */
+	MapContext context;
+
+	private MapContext selectionContext;
+
+	/**
+	 * the area of the map to draw
+	 */
+	// xulu.sc
+	// Envelope mapArea;
+	protected Envelope mapArea;
+	// xulu.ec
+
+	/**
+	 * the size of the pane last time we drew
+	 */
+	// xulu.sc
+	// private Rectangle oldRect = null;
+	protected Rectangle oldRect = null;
+	// xulu.ec
+
+	/**
+	 * the last map area drawn.
+	 */
+	// xulu.sc
+	// private Envelope oldMapArea = null;
+	protected Envelope oldMapArea = null;
+	// xulu.ec
+
+	/**
+	 * the base image of the map
+	 */
+	protected BufferedImage baseImage, panningImage;
+	// SK: private BufferedImage baseImage, panningImage;
+
+	/**
+	 * a factory for filters
+	 */
+	FilterFactory2 ff;
+
+	/**
+	 * a factory for geometries
+	 */
+	GeometryFactory gf = new GeometryFactory(); // FactoryFinder.getGeometryFactory(null);
+
+	private int state = ZoomIn;
+
+	/**
+	 * how far to zoom in or out
+	 */
+	private double zoomFactor = 2.0;
+
+	boolean changed = true;
+
+	LabelCache labelCache = new LabelCacheImpl();
+
+	// xulu.sc
+	// private boolean reset = false;
+	protected boolean reset = false;
+	// xulu.ec
+
+	int startX;
+
+	int startY;
+
+	private boolean clickable;
+
+	int lastX;
+
+	int lastY;
+
+	// xulu.sn
+	private Double maxZoomScale = Double.MIN_VALUE;
+	private Double minZoomScale = Double.MAX_VALUE;
+	// xulu.en
+
+	// sk.sn
+	/**
+	 * Wenn true, dann wurde PANNING via mouseDraged-Events begonnen. Dieses
+	 * Flag wird benutzt um nur einmal den passenden Cursor nur einmal zu
+	 * setzen.
+	 */
+	private boolean panning_started = false;
+
+	// sk.en
+
+	public JMapPane() {
+		this(null, true, null, null);
+	}
+
+	/**
+	 * create a basic JMapPane
+	 * 
+	 * @param render
+	 *            - how to draw the map
+	 * @param context
+	 *            - the map context to display
+	 */
+	public JMapPane(final GTRenderer render, final MapContext context) {
+		this(null, true, render, context);
+	}
+
+	/**
+	 * full constructor extending JPanel
+	 * 
+	 * @param layout
+	 *            - layout (probably shouldn't be set)
+	 * @param isDoubleBuffered
+	 *            - a Swing thing I don't really understand
+	 * @param render
+	 *            - what to draw the map with
+	 * @param context
+	 *            - what to draw
+	 */
+	public JMapPane(final LayoutManager layout, final boolean isDoubleBuffered,
+			final GTRenderer render, final MapContext context) {
+		super(layout, isDoubleBuffered);
+
+		ff = (FilterFactory2) org.geotools.factory.CommonFactoryFinder
+				.getFilterFactory(null);
+		setRenderer(render);
+
+		setContext(context);
+
+		this.addMouseListener(this);
+		this.addMouseMotionListener(this);
+		setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+	}
+
+	/**
+	 * get the renderer
+	 */
+	public GTRenderer getRenderer() {
+		return renderer;
+	}
+
+	public void setRenderer(final GTRenderer renderer) {
+		Map<Object,Object> hints = new HashMap<Object,Object>();
+		
+		this.renderer = renderer;
+		
+		if (renderer instanceof StreamingRenderer || renderer instanceof ShapefileRenderer) {
+			hints = renderer.getRendererHints();
+			if (hints == null) {
+				hints = new HashMap<Object,Object>();
+			}
+			if (hints.containsKey(StreamingRenderer.LABEL_CACHE_KEY)) {
+				labelCache = (LabelCache) hints
+						.get(StreamingRenderer.LABEL_CACHE_KEY);
+			} else {
+				hints.put(StreamingRenderer.LABEL_CACHE_KEY, labelCache);
+			}
+
+			hints.put("memoryPreloadingEnabled", Boolean.TRUE);
+			
+			renderer.setRendererHints(hints);
+		}
+
+//		this.highlightRenderer = new StreamingRenderer();
+//		this.selectionRenderer = new StreamingRenderer();
+
+//		highlightRenderer.setRendererHints(hints);
+//		selectionRenderer.setRendererHints(hints);
+		
+//		renderer.setRendererHints(hints);
+
+		if (this.context != null) {
+			this.renderer.setContext(this.context);
+		}
+	}
+
+	public MapContext getContext() {
+		return context;
+	}
+
+	public void setContext(final MapContext context) {
+		if (this.context != null) {
+			this.context.removeMapLayerListListener(this);
+		}
+
+		this.context = context;
+
+		if (context != null) {
+			this.context.addMapLayerListListener(this);
+		}
+
+		if (renderer != null) {
+			renderer.setContext(this.context);
+		}
+	}
+
+	public Envelope getMapArea() {
+		return mapArea;
+	}
+
+	public void setMapArea(final Envelope mapArea) {
+		this.mapArea = mapArea;
+	}
+
+	public int getState() {
+		return state;
+	}
+
+	public void setState(final int state) {
+		this.state = state;
+
+		// System.out.println("State: " + state);
+	}
+
+	public double getZoomFactor() {
+		return zoomFactor;
+	}
+
+	public void setZoomFactor(final double zoomFactor) {
+		this.zoomFactor = zoomFactor;
+	}
+
+
+	protected void paintComponent(final Graphics g) {
+		super.paintComponent(g);
+
+		if ((renderer == null) || (mapArea == null)) {
+			return;
+		}
+
+		final Rectangle r = getBounds();
+		final Rectangle dr = new Rectangle(r.width, r.height);
+
+		if (!r.equals(oldRect) || reset) {
+			if (!r.equals(oldRect) && (mapArea == null)) {
+				try {
+					mapArea = context.getLayerBounds();
+				} catch (final IOException e) {
+					LOGGER.warn("context.getLayerBounds()", e);
+				}
+			}
+
+			if (mapArea != null) {
+				/* either the viewer size has changed or we've done a reset */
+				changed = true; /* note we need to redraw */
+				reset = false; /* forget about the reset */
+				oldRect = r; /* store what the current size is */
+
+				mapArea = fixAspectRatio(r, mapArea);
+			}
+		}
+
+		if (!mapArea.equals(oldMapArea)) { /* did the map extent change? */
+			changed = true;
+			oldMapArea = mapArea;
+			// when we tell the context that the bounds have changed WMSLayers
+			// can refresh them selves
+			context.setAreaOfInterest(mapArea, context
+					.getCoordinateReferenceSystem());
+		}
+
+		if (changed ) { /* if the map changed then redraw */
+			changed = false;
+			baseImage = new BufferedImage(dr.width, dr.height,
+					BufferedImage.TYPE_INT_ARGB);
+
+			final Graphics2D ig = baseImage.createGraphics();
+			/* System.out.println("rendering"); */
+			if (renderer.getContext() != null) 
+				renderer.setContext(context);
+			labelCache.clear(); // work around anoying labelcache bug
+
+			// draw the map
+			renderer.paint((Graphics2D) ig, dr, mapArea);
+
+			// TODO nur machen, wenn panning beginnt
+			panningImage = new BufferedImage(dr.width, dr.height,
+					BufferedImage.TYPE_INT_RGB);
+
+		}
+
+		((Graphics2D) g).drawImage(baseImage, 0, 0, this);
+	}
+
+	private Envelope fixAspectRatio(final Rectangle r, final Envelope mapArea) {
+
+		final double mapWidth = mapArea.getWidth(); /* get the extent of the map */
+		final double mapHeight = mapArea.getHeight();
+		final double scaleX = r.getWidth() / mapArea.getWidth(); /*
+															 * calculate the new
+															 * scale
+															 */
+
+		final double scaleY = r.getHeight() / mapArea.getHeight();
+		double scale = 1.0; // stupid compiler!
+
+		if (scaleX < scaleY) { /* pick the smaller scale */
+			scale = scaleX;
+		} else {
+			scale = scaleY;
+		}
+
+		/* calculate the difference in width and height of the new extent */
+		final double deltaX = /* Math.abs */((r.getWidth() / scale) - mapWidth);
+		final double deltaY = /* Math.abs */((r.getHeight() / scale) - mapHeight);
+
+		/*
+		 * System.out.println("delta x " + deltaX);
+		 * System.out.println("delta y " + deltaY);
+		 */
+
+		/* create the new extent */
+		final Coordinate ll = new Coordinate(mapArea.getMinX() - (deltaX / 2.0),
+				mapArea.getMinY() - (deltaY / 2.0));
+		final Coordinate ur = new Coordinate(mapArea.getMaxX() + (deltaX / 2.0),
+				mapArea.getMaxY() + (deltaY / 2.0));
+
+		return new Envelope(ll, ur);
+	}
+
+//	public void doSelection(final double x, final double y, final MapLayer layer) {
+//
+//		final Geometry geometry = gf.createPoint(new Coordinate(x, y));
+//
+//		// org.opengis.geometry.Geometry geometry = new Point();
+//
+//		findFeature(geometry, layer);
+//
+//	}
+//
+//	/**
+//	 * @param geometry
+//	 *            - a geometry to construct the filter with
+//	 * @param i
+//	 *            - the index of the layer to search
+//	 * @throws IndexOutOfBoundsException
+//	 */
+//	private void findFeature(final Geometry geometry, final MapLayer layer)
+//			throws IndexOutOfBoundsException {
+//		org.opengis.filter.spatial.BinarySpatialOperator f = null;
+//
+//		if ((context == null) || (layer == null)) {
+//			return;
+//		}
+//
+//		try {
+//			String name = layer.getFeatureSource().getSchema()
+//					.getDefaultGeometry().getLocalName();
+//
+//			if (name == "") {
+//				name = "the_geom";
+//			}
+//
+//			try {
+//				f = ff.contains(ff.property(name), ff.literal(geometry));
+//				if (selectionManager != null) {
+////					System.out.println("selection changed");
+//					selectionManager.selectionChanged(this, f);
+//
+//				}
+//			} catch (final IllegalFilterException e) {
+//				// TODO Auto-generated catch block
+//				e.printStackTrace();
+//			}
+//
+//			/*
+//			 * // f.addLeftGeometry(ff.property(name)); //
+//			 * System.out.println("looking with " + f); FeatureCollection fc =
+//			 * layer.getFeatureSource().getFeatures(f);
+//			 * 
+//			 * 
+//			 * 
+//			 * if (fcol == null) { fcol = fc;
+//			 * 
+//			 * // here we should set the defaultgeom type } else {
+//			 * fcol.addAll(fc); }
+//			 */
+//
+//			/*
+//			 * GeometryAttributeType gat =
+//			 * layer.getFeatureSource().getSchema().getDefaultGeometry();
+//			 * fcol.setDefaultGeometry((Geometry)gat.createDefaultValue());
+//			 */
+//
+//			/*
+//			 * Iterator fi = fc.iterator(); while (fi.hasNext()) { SimpleFeature feat
+//			 * = (SimpleFeature) fi.next(); System.out.println("selected " +
+//			 * feat.getAttribute("STATE_NAME")); }
+//			 */
+//		} catch (final IllegalFilterException e) {
+//			// TODO Auto-generated catch block
+//			e.printStackTrace();
+//		}
+//		return;
+//	}
+
+	public void mouseClicked(final MouseEvent e) {
+		if (mapArea == null) return;
+		// System.out.println("before area "+mapArea+"\nw:"+mapArea.getWidth()+"
+		// h:"+mapArea.getHeight());
+		final Rectangle bounds = this.getBounds();
+		final double x = (double) (e.getX());
+		final double y = (double) (e.getY());
+		final double width = mapArea.getWidth();
+		final double height = mapArea.getHeight();
+		// xulu.sc
+		// double width2 = mapArea.getWidth() / 2.0;
+		// double height2 = mapArea.getHeight() / 2.0;
+		final double width2 = width / 2.0;
+		final double height2 = height / 2.0;
+		// xulu.ec
+		final double mapX = ((x * width) / (double) bounds.width) + mapArea.getMinX();
+		final double mapY = (((bounds.getHeight() - y) * height) / (double) bounds.height)
+				+ mapArea.getMinY();
+
+		/*
+		 * System.out.println(""+x+"->"+mapX);
+		 * System.out.println(""+y+"->"+mapY);
+		 */
+
+		/*
+		 * Coordinate ll = new Coordinate(mapArea.getMinX(), mapArea.getMinY());
+		 * Coordinate ur = new Coordinate(mapArea.getMaxX(), mapArea.getMaxY());
+		 */
+		double zlevel = 1.0;
+
+		switch (state) {
+		case Pan:
+			zlevel = 1.0;
+			// xulu.sc SK: return here.. a mouselistener is managing the PANNING
+			// break;
+			return;
+			// xulu.ec
+		case ZoomIn:
+			zlevel = zoomFactor;
+
+			break;
+
+		case ZoomOut:
+			zlevel = 1.0 / zoomFactor;
+
+			break;
+//
+//		case Select:
+//			doSelection(mapX, mapY, selectionLayer);
+//
+//			return;
+
+		default:
+			return;
+		}
+
+		final Coordinate ll = new Coordinate(mapX - (width2 / zlevel), mapY
+				- (height2 / zlevel));
+		final Coordinate ur = new Coordinate(mapX + (width2 / zlevel), mapY
+				+ (height2 / zlevel));
+		// xulu.sc SK: Check for min/max scale
+		// mapArea = new Envelope(ll, ur);
+		final Envelope newMapArea = new Envelope(ll, ur);
+		setMapArea(bestAllowedMapArea(newMapArea));
+		// xulu.ec
+
+		// sk.ec
+
+		// System.out.println("after area "+mapArea+"\nw:"+mapArea.getWidth()+"
+		// h:"+mapArea.getHeight());
+		repaint();
+	}
+
+	public void mouseEntered(final MouseEvent e) {
+	}
+
+	public void mouseExited(final MouseEvent e) {
+	}
+
+	public void mousePressed(final MouseEvent e) {
+		startX = e.getX();
+		startY = e.getY();
+		lastX = 0;
+		lastY = 0;
+	}
+
+	public void mouseReleased(final MouseEvent e) {
+		final int endX = e.getX();
+		final int endY = e.getY();
+
+		processDrag(startX, startY, endX, endY, e);
+		lastX = 0;
+		lastY = 0;
+
+		/**
+		 * Es wird nicht (mehr) gepannt!
+		 */
+		panning_started = false;
+	}
+
+	public void mouseDragged(final MouseEvent e) {
+		final Graphics graphics = this.getGraphics();
+		final int x = e.getX();
+		final int y = e.getY();
+
+		if ((state == JMapPane.Pan)
+				|| ((e.getModifiersEx() & InputEvent.BUTTON3_DOWN_MASK) != 0)) {
+			/**
+			 * SK: Der Cursor wird auf PANNING gesetzt.
+			 */
+			if (panning_started == false) {
+				panning_started = true;
+				setCursor(SwingUtil.PANNING_CURSOR);
+			}
+
+			// move the image with the mouse
+			if ((lastX > 0) && (lastY > 0)) {
+				final int dx = lastX - startX;
+				final int dy = lastY - startY;
+				// System.out.println("translate "+dx+","+dy);
+				final Graphics2D g2 = panningImage.createGraphics();
+				g2.setBackground(new Color(240, 240, 240)); // TODO richtige
+															// farbe? am besten
+															// vom L&F die
+															// hintergrundfarbe
+															// auslesen...
+				
+				g2.clearRect(0, 0, this.getWidth(), this.getHeight());
+				g2.drawImage(baseImage, dx, dy, this);
+				graphics.drawImage(panningImage, 0, 0, this);
+			}
+
+			lastX = x;
+			lastY = y;
+		} else
+
+		if ((state == JMapPane.ZoomIn) || (state == JMapPane.ZoomOut)) {
+
+			graphics.setXORMode(Color.WHITE);
+
+			if ((lastX > 0) && (lastY > 0)) {
+				drawRectangle(graphics);
+			}
+
+			// draw new box
+			lastX = x;
+			lastY = y;
+			drawRectangle(graphics);
+		} 
+//		else if (state == JMapPane.Select && selectionLayer != null) {
+//
+//			// construct a new bbox filter
+//			final Rectangle bounds = this.getBounds();
+//
+//			final double mapWidth = mapArea.getWidth();
+//			final double mapHeight = mapArea.getHeight();
+//
+//			final double x1 = ((this.startX * mapWidth) / (double) bounds.width)
+//					+ mapArea.getMinX();
+//			final double y1 = (((bounds.getHeight() - this.startY) * mapHeight) / (double) bounds.height)
+//					+ mapArea.getMinY();
+//			final double x2 = ((x * mapWidth) / (double) bounds.width)
+//					+ mapArea.getMinX();
+//			final double y2 = (((bounds.getHeight() - y) * mapHeight) / (double) bounds.height)
+//					+ mapArea.getMinY();
+//			final double left = Math.min(x1, x2);
+//			final double right = Math.max(x1, x2);
+//			final double bottom = Math.min(y1, y2);
+//			final double top = Math.max(y1, y2);
+//
+//			String name = selectionLayer.getFeatureSource().getSchema()
+//					.getDefaultGeometry().getName();
+//
+//			if (name == "") {
+//				name = "the_geom";
+//			}
+//			final Filter bb = ff.bbox(ff.property(name), left, bottom, right, top,
+//					getContext().getCoordinateReferenceSystem().toString());
+//			if (selectionManager != null) {
+//				selectionManager.selectionChanged(this, bb);
+//			}
+//
+//			graphics.setXORMode(Color.green);
+//
+//			/*
+//			 * if ((lastX > 0) && (lastY > 0)) { drawRectangle(graphics); }
+//			 */
+//
+//			// draw new box
+//			lastX = x;
+//			lastY = y;
+//			drawRectangle(graphics);
+//		}
+
+	}
+
+	// sk.cs
+	// private void processDrag(int x1, int y1, int x2, int y2) {
+	// sk.ce
+	protected void processDrag(final int x1, final int y1, final int x2,
+			final int y2, final MouseEvent e) {
+
+		/****
+		 * If no layer is availabe we dont want a NullPointerException
+		 */
+		if (mapArea == null)
+			return;
+
+		// System.out.println("processing drag from " + x1 + "," + y1 + " -> "
+		// + x2 + "," + y2);
+		if ((x1 == x2) && (y1 == y2)) {
+			if (isClickable()) {
+				mouseClicked(new MouseEvent(this, 0, new Date().getTime(), 0,
+						x1, y1, y2, false));
+			}
+
+			return;
+		}
+
+		final Rectangle bounds = this.getBounds();
+
+		final double mapWidth = mapArea.getWidth();
+		final double mapHeight = mapArea.getHeight();
+
+		final double startX = ((x1 * mapWidth) / (double) bounds.width)
+				+ mapArea.getMinX();
+		final double startY = (((bounds.getHeight() - y1) * mapHeight) / (double) bounds.height)
+				+ mapArea.getMinY();
+		final double endX = ((x2 * mapWidth) / (double) bounds.width)
+				+ mapArea.getMinX();
+		final double endY = (((bounds.getHeight() - y2) * mapHeight) / (double) bounds.height)
+				+ mapArea.getMinY();
+
+		if ((state == JMapPane.Pan) || (e.getButton() == MouseEvent.BUTTON3)) {
+			// move the image with the mouse
+			// calculate X offsets from start point to the end Point
+			final double deltaX1 = endX - startX;
+
+			// System.out.println("deltaX " + deltaX1);
+			// new edges
+			final double left = mapArea.getMinX() - deltaX1;
+			final double right = mapArea.getMaxX() - deltaX1;
+
+			// now for Y
+			final double deltaY1 = endY - startY;
+
+			// System.out.println("deltaY " + deltaY1);
+			final double bottom = mapArea.getMinY() - deltaY1;
+			final double top = mapArea.getMaxY() - deltaY1;
+			final Coordinate ll = new Coordinate(left, bottom);
+			final Coordinate ur = new Coordinate(right, top);
+			// xulu.sc
+			// mapArea = fixAspectRatio(this.getBounds(), new Envelope(ll, ur));
+			setMapArea(fixAspectRatio(this.getBounds(), new Envelope(ll, ur)));
+			// xulu.ec
+		} else if (state == JMapPane.ZoomIn) {
+
+			// Zu kleine Flächen sollen nicht gezoomt werden.
+			// sk.bc
+			if ((Math.abs(x1 - x2) * Math.abs(y2 - y1)) < 150)
+				return;
+			// sk.ec
+
+			drawRectangle(this.getGraphics());
+			// make the dragged rectangle (in map coords) the new BBOX
+			final double left = Math.min(startX, endX);
+			final double right = Math.max(startX, endX);
+			final double bottom = Math.min(startY, endY);
+			final double top = Math.max(startY, endY);
+			final Coordinate ll = new Coordinate(left, bottom);
+			final Coordinate ur = new Coordinate(right, top);
+			// xulu.sc
+
+			// mapArea = fixAspectRatio(this.getBounds(), new Envelope(ll, ur));
+			setMapArea(bestAllowedMapArea(new Envelope(ll, ur)));
+
+			// sk.sc
+//			{
+//			// SK tries to paint a preview of the zoom ;-9 aha.... well
+//			Graphics2D graphics = (Graphics2D) JMapPane.this.getGraphics();
+//			graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
+//					RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR);
+//			graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+//					RenderingHints.VALUE_ANTIALIAS_OFF);
+//			graphics.setRenderingHint(RenderingHints.KEY_RENDERING,
+//					RenderingHints.VALUE_RENDER_SPEED);
+//			graphics.drawImage(baseImage, 0, 0, JMapPane.this.getWidth(),
+//					JMapPane.this.getHeight(), x1, y1, x2, y2, null);
+//			}
+			// xulu.ec
+		} else if (state == JMapPane.ZoomOut) {
+			drawRectangle(this.getGraphics());
+
+			// make the dragged rectangle in screen coords the new map size?
+			final double left = Math.min(startX, endX);
+			final double right = Math.max(startX, endX);
+			final double bottom = Math.min(startY, endY);
+			final double top = Math.max(startY, endY);
+			final double nWidth = (mapWidth * mapWidth) / (right - left);
+			final double nHeight = (mapHeight * mapHeight) / (top - bottom);
+			final double deltaX1 = left - mapArea.getMinX();
+			final double nDeltaX1 = (deltaX1 * nWidth) / mapWidth;
+			final double deltaY1 = bottom - mapArea.getMinY();
+			final double nDeltaY1 = (deltaY1 * nHeight) / mapHeight;
+			final Coordinate ll = new Coordinate(mapArea.getMinX() - nDeltaX1,
+					mapArea.getMinY() - nDeltaY1);
+			final double deltaX2 = mapArea.getMaxX() - right;
+			final double nDeltaX2 = (deltaX2 * nWidth) / mapWidth;
+			final double deltaY2 = mapArea.getMaxY() - top;
+			final double nDeltaY2 = (deltaY2 * nHeight) / mapHeight;
+			final Coordinate ur = new Coordinate(mapArea.getMaxX() + nDeltaX2,
+					mapArea.getMaxY() + nDeltaY2);
+			// xulu.sc
+			// mapArea = fixAspectRatio(this.getBounds(), new Envelope(ll, ur));
+			setMapArea(bestAllowedMapArea(new Envelope(ll, ur)));
+
+			// xulu.ec
+		} 
+//		else if (state == JMapPane.Select && selectionLayer != null) {
+//			final double left = Math.min(startX, endX);
+//			final double right = Math.max(startX, endX);
+//			final double bottom = Math.min(startY, endY);
+//			final double top = Math.max(startY, endY);
+//
+//			String name = selectionLayer.getFeatureSource().getSchema()
+//					.getDefaultGeometry().getLocalName();
+//
+//			if (name == "") {
+//				name = "the_geom";
+//			}
+//			final Filter bb = ff.bbox(ff.property(name), left, bottom, right, top,
+//					getContext().getCoordinateReferenceSystem().toString());
+//			// System.out.println(bb.toString());
+//			if (selectionManager != null) {
+//				selectionManager.selectionChanged(this, bb);
+//			}
+//			/*
+//			 * FeatureCollection fc; selection = null; try { fc =
+//			 * selectionLayer.getFeatureSource().getFeatures(bb); selection =
+//			 * fc; } catch (IOException e) { e.printStackTrace(); }
+//			 */
+//		}
+
+		// xulu.so
+		// setMapArea(mapArea);
+		// xulu.eo
+		repaint();
+	}
+
+	private boolean isClickable() {
+		return clickable;
+	}
+
+	private org.geotools.styling.Style setupStyle(final int type, final Color color) {
+		final StyleFactory sf = org.geotools.factory.CommonFactoryFinder
+				.getStyleFactory(null);
+		final StyleBuilder sb = new StyleBuilder();
+
+		org.geotools.styling.Style s = sf.createStyle();
+		s.setTitle("selection");
+
+		// TODO parameterise the color
+		final PolygonSymbolizer ps = sb.createPolygonSymbolizer(color);
+		ps.setStroke(sb.createStroke(color));
+
+		final LineSymbolizer ls = sb.createLineSymbolizer(color);
+		final Graphic h = sb.createGraphic();
+		h.setMarks(new Mark[] { sb.createMark("square", color) });
+
+		final PointSymbolizer pts = sb.createPointSymbolizer(h);
+
+		// Rule r = sb.createRule(new Symbolizer[]{ps,ls,pts});
+		switch (type) {
+		case POLYGON:
+			s = sb.createStyle(ps);
+
+			break;
+
+		case POINT:
+			s = sb.createStyle(pts);
+
+			break;
+
+		case LINE:
+			s = sb.createStyle(ls);
+		}
+
+		return s;
+	}
+
+
+	public void propertyChange(final PropertyChangeEvent evt) {
+		final String prop = evt.getPropertyName();
+
+		if (prop.equalsIgnoreCase("crs")) {
+			context.setAreaOfInterest(context.getAreaOfInterest(),
+					(CoordinateReferenceSystem) evt.getNewValue());
+		}
+	}
+
+	public boolean isReset() {
+		return reset;
+	}
+
+	public void setReset(final boolean reset) {
+		this.reset = reset;
+	}
+
+	public void layerAdded(final MapLayerListEvent event) {
+		changed = true;
+
+		if (context.getLayers().length == 1) { // the first one
+
+			try {
+				// xulu.sc
+				// mapArea = context.getLayerBounds();
+				mapArea = context.getAreaOfInterest();
+				if (mapArea == null)
+					mapArea = context.getLayerBounds();
+				// xulu.ec
+			} catch (final IOException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+
+			reset = true;
+		}
+
+		repaint();
+	}
+
+	public void layerRemoved(final MapLayerListEvent event) {
+		changed = true;
+		repaint();
+	}
+
+	public void layerChanged(final MapLayerListEvent event) {
+		changed = true;
+		// System.out.println("layer changed - repaint");
+		repaint();
+	}
+
+	public void layerMoved(final MapLayerListEvent event) {
+		changed = true;
+		repaint();
+	}
+
+	protected void drawRectangle(final Graphics graphics) {
+		// undraw last box/draw new box
+		final int left = Math.min(startX, lastX);
+		final int right = Math.max(startX, lastX);
+		final int top = Math.max(startY, lastY);
+		final int bottom = Math.min(startY, lastY);
+		final int width = right - left;
+		final int height = top - bottom;
+		// System.out.println("drawing rect("+left+","+bottom+","+ width+","+
+		// height+")");
+		graphics.drawRect(left, bottom, width, height);
+	}
+
+	/**
+	 * if clickable is set to true then a single click on the map pane will zoom
+	 * or pan the map.
+	 * 
+	 * @param clickable
+	 */
+	public void setClickable(final boolean clickable) {
+		this.clickable = clickable;
+	}
+
+	public void mouseMoved(final MouseEvent e) {
+	}
+
+
+
+	// xulu.sn
+	/**
+	 * Korrigiert den {@link Envelope} aka {@code mapArea} auf die beste
+	 * erlaubte Flaeche damit die Massstabsbeschaenkungen noch eingehalten
+	 * werden, FALLS der uebergeben Envelope nicht schon gueltig sein sollte.<br/>
+	 * Since 21. April 09: Before thecalculation starts, the aspect ratio is
+	 * corrected. This change implies, that setMapArea() will most of the time
+	 * not allow setting to a wrong aspectRatio.
+	 * 
+	 * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons
+	 *         Kr&uuml;ger</a>
+	 */
+	public Envelope bestAllowedMapArea(Envelope env) {
+		if (getWidth() == 0)
+			return env;
+		if (env == null)
+			return env;
+
+		/**
+		 * Correct the aspect Ratio before we check the rest. Otherwise we might
+		 * easily fail.
+		 */
+		env = fixAspectRatio(this.getBounds(), env);
+
+		final double scale = env.getWidth() / getWidth();
+		final double centerX = env.getMinX() + env.getWidth() / 2.;
+		final double centerY = env.getMinY() + env.getHeight() / 2.;
+		double newWidth2;
+		double newHeight2;
+		if (scale < getMaxZoomScale()) {
+			// ****************************************************************************
+			// Wir zoomen weiter rein als erlaubt => Anpassen des envelope
+			// ****************************************************************************
+			newWidth2 = getMaxZoomScale() * getWidth() / 2.;
+			newHeight2 = getMaxZoomScale() * getHeight() / 2.;
+		} else if (scale > getMinZoomScale()) {
+			// ****************************************************************************
+			// Wir zoomen weiter raus als erlaubt => Anpassen des envelope
+			// ****************************************************************************
+			newWidth2 = getMinZoomScale() * getWidth() / 2.;
+			newHeight2 = getMinZoomScale() * getHeight() / 2.;
+		} else {
+			// ****************************************************************************
+			// Die mapArea / der Envelope ist ist gueltig! Keine Aenderungen
+			// ****************************************************************************
+			return env;
+		}
+
+		final Coordinate ll = new Coordinate(centerX - newWidth2, centerY
+				- newHeight2);
+		final Coordinate ur = new Coordinate(centerX + newWidth2, centerY
+				+ newHeight2);
+
+		return new Envelope(ll, ur);
+	}
+
+	/**
+	 * Retuns the minimum allowed zoom scale. This is the bigger number value of
+	 * the two. Defaults to {@link Double}.MAX_VALUE
+	 * 
+	 * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons
+	 *         Kr&uuml;ger</a>
+	 */
+	public Double getMinZoomScale() {
+		return minZoomScale;
+	}
+
+	/**
+	 * Retuns the maximum allowed zoom scale. This is the smaller number value
+	 * of the two. Defaults to {@link Double}.MIN_VALUE
+	 * 
+	 * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons
+	 *         Kr&uuml;ger</a>
+	 */
+	public Double getMaxZoomScale() {
+		return maxZoomScale;
+	}
+
+	/**
+	 * Set the maximum allowed zoom scale. This is the smaller number value of
+	 * the two.
+	 * 
+	 * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons
+	 *         Kr&uuml;ger</a>
+	 */
+	public void setMaxZoomScale(final Double maxZoomScale) {
+		// System.out.println("setting max scale to "+maxZoomScale);
+		this.maxZoomScale = maxZoomScale;
+	}
+
+	/**
+	 * Set the minimum (nearest) allowed zoom scale. This is the bigger number
+	 * value of the two.
+	 * 
+	 * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons
+	 *         Kr&uuml;ger</a>
+	 */
+	public void setMinZoomScale(final Double minZoomScale) {
+		this.minZoomScale = minZoomScale;
+	}
+	// xulu.en
+
+}

Copied: branches/1.0-gt2-2.6/src/org/geotools/swing/MouseSelectionTracker_Public.java (from rev 382, branches/1.0-gt2-2.6/src/org/geotools/gui/swing/MouseSelectionTracker_Public.java)
===================================================================
--- branches/1.0-gt2-2.6/src/org/geotools/gui/swing/MouseSelectionTracker_Public.java	2009-09-04 17:02:58 UTC (rev 382)
+++ branches/1.0-gt2-2.6/src/org/geotools/swing/MouseSelectionTracker_Public.java	2009-09-11 16:16:38 UTC (rev 384)
@@ -0,0 +1,16 @@
+//package org.geotools.swing;
+//
+//import gtmig.org.geotools.gui.swing.MouseSelectionTracker;
+//
+//
+///**
+// * Diese Klasse stellt lediglich eine Dummy-Klasse dar, um die Geotools-Klasse
+// * {@link MouseSelectionTracker} auch von ausserhalb des Pakets
+// * <code>org.geotools.swing</code> verwenden zu koennen.
+// * {@link MouseSelectionTracker org.geotools.swing.MouseSelectionTracker}
+// * ist naemlich keine <code>public</code>-Klasse.
+// * @author <a href="mailto:martin.schmitz at koeln.de">Martin Schmitz</a> (University of Bonn/Germany)
+// * @version 1.0
+// */
+//public abstract class MouseSelectionTracker_Public extends gtmig.org.geotools.swing.MouseSelectionTracker {
+//}

Copied: branches/1.0-gt2-2.6/src/org/geotools/swing/package.html (from rev 383, branches/1.0-gt2-2.6/src/org/geotools/gui/swing/package.html)

Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/ColorMapTable.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/ColorMapTable.java	2009-09-11 14:17:13 UTC (rev 383)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/ColorMapTable.java	2009-09-11 16:16:38 UTC (rev 384)
@@ -36,7 +36,6 @@
 
 import org.geotools.styling.ColorMap;
 import org.geotools.styling.ColorMapEntry;
-import org.geotools.styling.ColorMapImpl;
 
 import schmitzm.geotools.styling.StylingUtil;
 import schmitzm.swing.CaptionsChangeable;

Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/GeoPositionLabel.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/GeoPositionLabel.java	2009-09-11 14:17:13 UTC (rev 383)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/GeoPositionLabel.java	2009-09-11 16:16:38 UTC (rev 384)
@@ -38,7 +38,7 @@
 import javax.swing.JLabel;
 import javax.swing.event.MouseInputListener;
 
-import org.geotools.gui.swing.event.MapMouseEvent;
+import org.geotools.swing.event.MapMouseEvent;
 
 /**
  * Diese Klasse stellt ein {@link JLabel} dar, in dem (2dimensionale) Geo-Koordinaten

Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/JMapPane.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/JMapPane.java	2009-09-11 14:17:13 UTC (rev 383)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/JMapPane.java	2009-09-11 16:16:38 UTC (rev 384)
@@ -73,8 +73,6 @@
 import org.geotools.geometry.GeneralEnvelope;
 import org.geotools.geometry.jts.JTS;
 import org.geotools.geometry.jts.ReferencedEnvelope;
-import org.geotools.gui.swing.MouseSelectionTracker_Public;
-import org.geotools.gui.swing.event.MapMouseEvent;
 import org.geotools.map.DefaultMapContext;
 import org.geotools.map.MapContext;
 import org.geotools.map.MapLayer;
@@ -86,6 +84,7 @@
 import org.geotools.renderer.shape.ShapefileRenderer;
 import org.geotools.resources.image.ImageUtilities;
 import org.geotools.styling.Style;
+import org.geotools.swing.event.MapMouseEvent;
 import org.opengis.coverage.CannotEvaluateException;
 import org.opengis.feature.simple.SimpleFeature;
 import org.opengis.feature.simple.SimpleFeatureType;
@@ -165,7 +164,7 @@
  *         (University of Bonn/Germany)
  * @version 1.0
  */
-public class JMapPane extends org.geotools.gui.swing.JMapPane {
+public class JMapPane extends org.geotools.swing.JMapPane {
 
 	private static final NameImpl GC_NAME = new NameImpl(
 			"http://www.opengis.net/gml", "GridCoverage");
@@ -204,15 +203,15 @@
 			.getName());
 
 	/** @deprecated ersetzt durch {@link #ZOOM_IN} */
-	public static final int ZoomIn = org.geotools.gui.swing.JMapPane.ZoomIn;
+	public static final int ZoomIn = org.geotools.swing.JMapPane.ZoomIn;
 	/** @deprecated ersetzt durch {@link #ZOOM_OUT} */
-	public static final int ZoomOut = org.geotools.gui.swing.JMapPane.ZoomOut;
+	public static final int ZoomOut = org.geotools.swing.JMapPane.ZoomOut;
 	/** @deprecated ersetzt durch {@link #PAN} */
-	public static final int Pan = org.geotools.gui.swing.JMapPane.Pan;
+	public static final int Pan = org.geotools.swing.JMapPane.Pan;
 	/** @deprecated ersetzt durch {@link #RESET} */
-	public static final int Reset = org.geotools.gui.swing.JMapPane.Reset;
+	public static final int Reset = org.geotools.swing.JMapPane.Reset;
 	/** @deprecated ersetzt durch {@link #SELECT_TOP} */
-	public static final int Select = org.geotools.gui.swing.JMapPane.Select;
+	public static final int Select = org.geotools.swing.JMapPane.Select;
 
 	/**
 	 * Flag fuer Modus "Nichts machen".
@@ -226,27 +225,27 @@
 	 * 
 	 * @see #setState(int)
 	 */
-	public static final int RESET = org.geotools.gui.swing.JMapPane.Reset;
+	public static final int RESET = org.geotools.swing.JMapPane.Reset;
 	/**
 	 * Flag fuer Modus "Kartenausschnitt bewegen". Nicht fuer Window-Auswahl
 	 * moeglich!
 	 * 
 	 * @see #setState(int)
 	 */
-	public static final int PAN = org.geotools.gui.swing.JMapPane.Pan;
+	public static final int PAN = org.geotools.swing.JMapPane.Pan;
 	/**
 	 * Flag fuer Modus "Heran zoomen".
 	 * 
 	 * @see #setWindowSelectionState(int)
 	 * @see #setState(int)
 	 */
-	public static final int ZOOM_IN = org.geotools.gui.swing.JMapPane.ZoomIn;
+	public static final int ZOOM_IN = org.geotools.swing.JMapPane.ZoomIn;
 	/**
 	 * Flag fuer Modus "Heraus zoomen". Nicht fuer Window-Auswahl moeglich!
 	 * 
 	 * @see #setState(int)
 	 */
-	public static final int ZOOM_OUT = org.geotools.gui.swing.JMapPane.ZoomOut;
+	public static final int ZOOM_OUT = org.geotools.swing.JMapPane.ZoomOut;
 	/**
 	 * Flag fuer Modus
 	 * "SimpleFeature-Auswahl auf dem obersten (sichtbaren) Layer".
@@ -254,7 +253,7 @@
 	 * @see #setWindowSelectionState(int)
 	 * @see #setState(int)
 	 */
-	public static final int SELECT_TOP = org.geotools.gui.swing.JMapPane.Select;
+	public static final int SELECT_TOP = org.geotools.swing.JMapPane.Select;
 	/**
 	 * Flag fuer Modus "SimpleFeature-Auswahl auf allen (sichtbaren) Layern".
 	 * 
@@ -286,7 +285,7 @@
 	 */
 	protected Vector<JMapPaneListener> mapPaneListeners = new Vector<JMapPaneListener>();
 
-	protected MouseSelectionTracker_Public selTracker = new MouseSelectionTracker_Public() {
+	protected gtmig.org.geotools.swing.MouseSelectionTracker selTracker = new gtmig.org.geotools.swing.MouseSelectionTracker() {
 		public void mouseDragged(final MouseEvent event) {
 			// Wenn
 			// Fenster

Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/MapContextControlPane.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/MapContextControlPane.java	2009-09-11 14:17:13 UTC (rev 383)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/MapContextControlPane.java	2009-09-11 16:16:38 UTC (rev 384)
@@ -45,7 +45,6 @@
 import javax.swing.JMenuItem;
 import javax.swing.JOptionPane;
 import javax.swing.JPanel;
-import javax.swing.JScrollPane;
 import javax.swing.event.MenuEvent;
 import javax.swing.event.MenuListener;
 

Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/MouseSelectionTracker.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/MouseSelectionTracker.java	2009-09-11 14:17:13 UTC (rev 383)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/MouseSelectionTracker.java	2009-09-11 16:16:38 UTC (rev 384)
@@ -31,16 +31,14 @@
 
 import java.awt.event.MouseEvent;
 
-import org.geotools.gui.swing.MouseSelectionTracker_Public;
-
 /**
- * Extends the geotools {@link org.geotools.gui.swing.MouseSelectionTracker} with an
+ * Extends the geotools {@link org.geotools.swing.MouseSelectionTracker} with an
  * enable/disable functionality. Furthermore the tracker (optionally)
  * also reacts on single clicks.
  * @see #setSelectionMode(SelectionMode)
  * @author <a href="mailto:Martin.Schmitz at koeln.de">Martin Schmitz</a>
  */
-public abstract class MouseSelectionTracker extends MouseSelectionTracker_Public {
+public abstract class MouseSelectionTracker extends gtmig.org.geotools.swing.MouseSelectionTracker {
   /** Selection events the tracker reacts on. */
   public enum SelectionMode {
     /** Tracker reacts on single clicks as well as on

Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/styling/StylingUtil.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/styling/StylingUtil.java	2009-09-11 14:17:13 UTC (rev 383)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/styling/StylingUtil.java	2009-09-11 16:16:38 UTC (rev 384)
@@ -1889,7 +1889,8 @@
 				// The labeltext is read from the SLD. Its either the title
 				// directly, or interpreted as OneLine Code
 				// ****************************************************************************
-				final String rawText = rule.getDescription().getTitle().toString();
+//				final String rawText = rule.getDescription().getTitle().toString();
+				final String rawText = rule.getTitle();
 
 				Translation labelT = new Translation();
 				labelT.fromOneLine(rawText);

Modified: branches/1.0-gt2-2.6/src/schmitzm/io/IOUtil.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/io/IOUtil.java	2009-09-11 14:17:13 UTC (rev 383)
+++ branches/1.0-gt2-2.6/src/schmitzm/io/IOUtil.java	2009-09-11 16:16:38 UTC (rev 384)
@@ -175,6 +175,7 @@
 	 * @return A new {@link URL} with new extension.
 	 *
 	 * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons Kr&uuml;ger</a>
+	 * 
 	 */
 	public static URL changeUrlExt(final URL url, final String postfix) throws IllegalArgumentException{
 		String a = url.toExternalForm();
@@ -198,12 +199,20 @@
 	 * 
 	 * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons
 	 *         Kr&uuml;ger</a>
+	 *         
+	 *         
 	 */
 	public static URL getParentUrl(final URL url) throws MalformedURLException {
 		String a = url.toExternalForm();
 		final int lastDotPos = a.lastIndexOf('/');
 		if (lastDotPos >= 0)
 			a = a.substring(0, lastDotPos);
+
+		/**
+		 * The parent of jar:file:some!/bar.file is jar:file:some!/, not jar:file:some!  
+		 */
+		if (a.endsWith("!")) a+="/";
+
 		return new URL(a);
 	}
 

Modified: branches/1.0-gt2-2.6/src/skrueger/geotools/io/GeoImportUtilURL.java
===================================================================
--- branches/1.0-gt2-2.6/src/skrueger/geotools/io/GeoImportUtilURL.java	2009-09-11 14:17:13 UTC (rev 383)
+++ branches/1.0-gt2-2.6/src/skrueger/geotools/io/GeoImportUtilURL.java	2009-09-11 16:16:38 UTC (rev 384)
@@ -33,7 +33,6 @@
 import java.awt.image.BufferedImage;
 import java.io.File;
 import java.io.IOException;
-import java.io.InputStream;
 import java.net.URL;
 
 import javax.imageio.IIOException;
@@ -42,7 +41,6 @@
 import org.apache.log4j.Logger;
 import org.geotools.coverage.grid.GridCoverage2D;
 import org.geotools.coverage.grid.GridCoverageFactory;
-import org.geotools.data.DataUtilities;
 import org.geotools.factory.Hints;
 import org.geotools.gce.geotiff.GeoTiffReader;
 import org.geotools.geometry.Envelope2D;

Modified: branches/1.0-gt2-2.6/src/skrueger/geotools/labelsearch/SearchMapDialog.java
===================================================================
--- branches/1.0-gt2-2.6/src/skrueger/geotools/labelsearch/SearchMapDialog.java	2009-09-11 14:17:13 UTC (rev 383)
+++ branches/1.0-gt2-2.6/src/skrueger/geotools/labelsearch/SearchMapDialog.java	2009-09-11 16:16:38 UTC (rev 384)
@@ -56,9 +56,9 @@
 import javax.swing.SwingWorker;
 
 import org.apache.log4j.Logger;
-import org.geotools.gui.swing.ExceptionMonitor;
-import org.geotools.gui.swing.JMapPane;
+import org.geotools.swing.ExceptionMonitor;
 
+import schmitzm.geotools.gui.JMapPane;
 import schmitzm.swing.SortableJTable;
 import schmitzm.swing.SwingUtil;
 



More information about the Schmitzm-commits mailing list