[Schmitzm-commits] r388 - in branches/1.0-gt2-2.6/src: gtmig/org/geotools/swing org/geotools/swing schmitzm/geotools/gui
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri Sep 11 21:06:19 CEST 2009
Author: alfonx
Date: 2009-09-11 21:06:17 +0200 (Fri, 11 Sep 2009)
New Revision: 388
Added:
branches/1.0-gt2-2.6/src/gtmig/org/geotools/swing/JMapPane.java
Removed:
branches/1.0-gt2-2.6/src/org/geotools/swing/JMapPane.java
Modified:
branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/JMapPane.java
Log:
* Moving JMapPane out of org.geotools.swing allows me to start the application in debug mode, without haveing a libUnsigned dir...
Copied: branches/1.0-gt2-2.6/src/gtmig/org/geotools/swing/JMapPane.java (from rev 384, branches/1.0-gt2-2.6/src/org/geotools/swing/JMapPane.java)
===================================================================
--- branches/1.0-gt2-2.6/src/org/geotools/swing/JMapPane.java 2009-09-11 16:16:38 UTC (rev 384)
+++ branches/1.0-gt2-2.6/src/gtmig/org/geotools/swing/JMapPane.java 2009-09-11 19:06:17 UTC (rev 388)
@@ -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 gtmig.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ü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ü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ü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ü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üger</a>
+ */
+ public void setMinZoomScale(final Double minZoomScale) {
+ this.minZoomScale = minZoomScale;
+ }
+ // xulu.en
+
+}
Deleted: branches/1.0-gt2-2.6/src/org/geotools/swing/JMapPane.java
===================================================================
--- branches/1.0-gt2-2.6/src/org/geotools/swing/JMapPane.java 2009-09-11 16:49:23 UTC (rev 387)
+++ branches/1.0-gt2-2.6/src/org/geotools/swing/JMapPane.java 2009-09-11 19:06:17 UTC (rev 388)
@@ -1,1080 +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.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;
-
- /**
- * the map context to render
- */
- MapContext context;
-
- /**
- * 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ü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ü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ü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ü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üger</a>
- */
- public void setMinZoomScale(final Double minZoomScale) {
- this.minZoomScale = minZoomScale;
- }
- // xulu.en
-
-}
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 16:49:23 UTC (rev 387)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/JMapPane.java 2009-09-11 19:06:17 UTC (rev 388)
@@ -164,7 +164,7 @@
* (University of Bonn/Germany)
* @version 1.0
*/
-public class JMapPane extends org.geotools.swing.JMapPane {
+public class JMapPane extends gtmig.org.geotools.swing.JMapPane {
private static final NameImpl GC_NAME = new NameImpl(
"http://www.opengis.net/gml", "GridCoverage");
@@ -203,15 +203,15 @@
.getName());
/** @deprecated ersetzt durch {@link #ZOOM_IN} */
- public static final int ZoomIn = org.geotools.swing.JMapPane.ZoomIn;
+ public static final int ZoomIn = gtmig.org.geotools.swing.JMapPane.ZoomIn;
/** @deprecated ersetzt durch {@link #ZOOM_OUT} */
- public static final int ZoomOut = org.geotools.swing.JMapPane.ZoomOut;
+ public static final int ZoomOut = gtmig.org.geotools.swing.JMapPane.ZoomOut;
/** @deprecated ersetzt durch {@link #PAN} */
- public static final int Pan = org.geotools.swing.JMapPane.Pan;
+ public static final int Pan = gtmig.org.geotools.swing.JMapPane.Pan;
/** @deprecated ersetzt durch {@link #RESET} */
- public static final int Reset = org.geotools.swing.JMapPane.Reset;
+ public static final int Reset = gtmig.org.geotools.swing.JMapPane.Reset;
/** @deprecated ersetzt durch {@link #SELECT_TOP} */
- public static final int Select = org.geotools.swing.JMapPane.Select;
+ public static final int Select = gtmig.org.geotools.swing.JMapPane.Select;
/**
* Flag fuer Modus "Nichts machen".
@@ -225,27 +225,27 @@
*
* @see #setState(int)
*/
- public static final int RESET = org.geotools.swing.JMapPane.Reset;
+ public static final int RESET = gtmig.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.swing.JMapPane.Pan;
+ public static final int PAN = gtmig.org.geotools.swing.JMapPane.Pan;
/**
* Flag fuer Modus "Heran zoomen".
*
* @see #setWindowSelectionState(int)
* @see #setState(int)
*/
- public static final int ZOOM_IN = org.geotools.swing.JMapPane.ZoomIn;
+ public static final int ZOOM_IN = gtmig.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.swing.JMapPane.ZoomOut;
+ public static final int ZOOM_OUT = gtmig.org.geotools.swing.JMapPane.ZoomOut;
/**
* Flag fuer Modus
* "SimpleFeature-Auswahl auf dem obersten (sichtbaren) Layer".
@@ -253,7 +253,7 @@
* @see #setWindowSelectionState(int)
* @see #setState(int)
*/
- public static final int SELECT_TOP = org.geotools.swing.JMapPane.Select;
+ public static final int SELECT_TOP = gtmig.org.geotools.swing.JMapPane.Select;
/**
* Flag fuer Modus "SimpleFeature-Auswahl auf allen (sichtbaren) Layern".
*
@@ -455,7 +455,11 @@
* {@link BorderLayout})
* @param isDoubleBuffered
* siehe Konstruktor der
+<<<<<<< .mine
+ * {@linkplain org.gtmig.org.geotools.swing.JMapPane#JMapPane(LayoutManager,boolean,GTRenderer,MapContext)
+=======
* {@linkplain org.geotools.swing.JMapPane#JMapPane(LayoutManager,boolean,GTRenderer,MapContext)
+>>>>>>> .r387
* Oberklasse}
* @param renderer
* Renderer fuer die graphische Darestellung (z.B.
@@ -477,7 +481,11 @@
* {@link BorderLayout})
* @param isDoubleBuffered
* siehe Konstruktor der
+<<<<<<< .mine
+ * {@linkplain org.gtmig.org.geotools.swing.JMapPane#JMapPane(LayoutManager,boolean,GTRenderer,MapContext)
+=======
* {@linkplain org.geotools.swing.JMapPane#JMapPane(LayoutManager,boolean,GTRenderer,MapContext)
+>>>>>>> .r387
* Oberklasse}. Bei <code>null</code> wird <code>true</code>
* andgenommen.
* @param renderer
@@ -1457,7 +1465,11 @@
* angepasst wird, muss diese Methode ueberschrieben werden.
* <p>
* Neu von SK: Ich habe in der Geotools
+<<<<<<< .mine
+ * {@link org.gtmig.org.geotools.swing.JMapPane} die noetigen variablen protected
+=======
* {@link org.geotools.swing.JMapPane} die noetigen variablen protected
+>>>>>>> .r387
* gemacht, um hier schon festzustellen, ob der aufruf von
* super.paintComponent das eigentliche aussehen der Karte veraendern wird.
* Die Methode paintComponent wird naemlich bei jeder Bewegung der Maus
More information about the Schmitzm-commits
mailing list