[Schmitzm-commits] r866 - trunk/src/skrueger/geotools

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue May 25 16:10:41 CEST 2010


Author: alfonx
Date: 2010-05-25 16:10:41 +0200 (Tue, 25 May 2010)
New Revision: 866

Removed:
   trunk/src/skrueger/geotools/SelectXMapPaneMouseListener.java
Log:
Removed an unused old class

Deleted: trunk/src/skrueger/geotools/SelectXMapPaneMouseListener.java
===================================================================
--- trunk/src/skrueger/geotools/SelectXMapPaneMouseListener.java	2010-05-25 14:09:59 UTC (rev 865)
+++ trunk/src/skrueger/geotools/SelectXMapPaneMouseListener.java	2010-05-25 14:10:41 UTC (rev 866)
@@ -1,251 +0,0 @@
-
-//package skrueger.geotools;
-//
-//import java.awt.Cursor;
-//import java.awt.Point;
-//import java.awt.event.MouseAdapter;
-//import java.awt.event.MouseEvent;
-//import java.awt.event.MouseWheelEvent;
-//import java.awt.geom.Point2D;
-//import java.util.Enumeration;
-//import java.util.Hashtable;
-//import java.util.Iterator;
-//
-//import org.apache.log4j.Logger;
-//import org.geotools.data.memory.MemoryFeatureCollection;
-//import org.geotools.feature.FeatureCollection;
-//import org.geotools.map.MapLayer;
-//import org.opengis.feature.simple.SimpleFeature;
-//import org.opengis.feature.simple.SimpleFeatureType;
-//
-//import schmitzm.geotools.gui.SelectableXMapPane;
-//import schmitzm.geotools.map.event.FeatureSelectedEvent;
-//import skrueger.geotools.GeomFilterGenerator.PointFilterGenerator;
-//
-//import com.vividsolutions.jts.geom.Coordinate;
-//import com.vividsolutions.jts.geom.Envelope;
-//import com.vividsolutions.jts.geom.Geometry;
-//import com.vividsolutions.jts.geom.GeometryFactory;
-//
-//public class SelectXMapPaneMouseListener extends MouseAdapter {
-//	private static Logger LOGGER = Logger
-//	.getLogger(SelectXMapPaneMouseListener.class);
-//
-//	private final SelectableXMapPane xMapPane;
-//	private boolean enabled;
-//
-//	public boolean isEnabled() {
-//		if (!xMapPane.isWellDefined())
-//			return false;
-//		if ((xMapPane.getState() == XMapPane.ZOOM_IN
-//				|| xMapPane.getState() == XMapPane.ZOOM_OUT || xMapPane
-//				.getState() == XMapPane.PAN))
-//			return false;
-//		if (xMapPane.getState() == XMapPane.NONE)
-//			return false;
-//		return enabled;
-//	}
-//
-//	/**
-//	 * Default distance fraction used with line and point features. When the
-//	 * user clicks on the map, this tool searches for features within a
-//	 * rectangle of width w centred on the mouse location, where w is the
-//	 * average map side length multiplied by the value of this constant.
-//	 */
-//	public static final double DEFAULT_DISTANCE_FRACTION = 0.01d;
-//
-//	/**
-//	 * Reagiert auf Linksklick mit der ueber {@link #setState(int)}eingestellten
-//	 * Aktion und auf Rechtsklick mit Zoom-Out (sofern {@link #ZOOM_IN}-State
-//	 * fuer Linksklick eingestellt). Alle anderen Klicks werden ignoriert.
-//	 * 
-//	 * @author <a href="mailto:martin.schmitz at koeln.de">Martin Schmitz</a>
-//	 *         (University of Bonn/Germany)
-//	 * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons
-//	 *         Kr&uuml;ger</a>
-//	 */
-//	public void mouseClicked(MouseEvent e) {
-//
-//		if (!isEnabled())
-//			return;
-//
-//		xMapPane.setCursor(Cursor
-//				.getPredefinedCursor(Cursor.WAIT_CURSOR));
-//
-//		int state = xMapPane.getState();
-//
-//		/**
-//		 * BEGIN StefanChange Dieser Block findet sichtbare Features im Umkreis
-//		 * des Mausklicks und kümmert sich selbst um das verschicken der Events.
-//		 * Dabei wird z.Zt. immer eine FeaterCollection mit nur einem
-//		 * SimpleFeature verschickt. Und zwar jenes SimpleFeature, welches am
-//		 * nächsten liegt.
-//		 */
-//
-//		// Fenster-Koordinate in Geo-Koordinate umwandelt
-//		Point2D geoCoord = xMapPane.getScreenToWorld().transform(e.getPoint(),
-//				null);
-//
-//		double radius = DEFAULT_DISTANCE_FRACTION
-//				* (xMapPane.getMapArea().getWidth() + xMapPane.getMapArea()
-//						.getHeight()) / 2;
-//
-//		PointFilterGenerator filterGenerator = new PointFilterGenerator(geoCoord, radius,
-//				xMapPane.getMapContext().getCoordinateReferenceSystem());
-//		Hashtable<MapLayer, FeatureCollection<SimpleFeatureType, SimpleFeature>> result = xMapPane
-//				.findVisibleFeatures(filterGenerator,
-//						state, new Envelope(geoCoord.getX(), geoCoord.getX(),
-//								geoCoord.getY(), geoCoord.getY()));
-//		
-//		// Ein Event auslösen für das jeweils nächste Feature pro Layer
-//		for (Enumeration<MapLayer> element = result.keys(); element
-//				.hasMoreElements();) {
-//
-//			MapLayer layer = element.nextElement();
-//			FeatureCollection<SimpleFeatureType, SimpleFeature> fc = result
-//					.get(layer);
-//			FeatureCollection<SimpleFeatureType, SimpleFeature> fcOne;
-//
-//			if (fc != null && !fc.isEmpty()) {
-//
-//				if (fc.size() > 1) {
-//					// If the result contains more that one feature, we only
-//					// return the nearest one.
-//
-//					SimpleFeature nearestFeature = null;
-//					Double nearestDist = 0.0;
-//
-//					Iterator<SimpleFeature> fcIt = fc.iterator();
-//					try {
-//						com.vividsolutions.jts.geom.Point mousePoint = FeatureUtil.GEOMETRY_FACTORY
-//						.createPoint(new Coordinate(geoCoord.getX(), geoCoord.getY()));
-//
-//						while (fcIt.hasNext()) {
-//							SimpleFeature f = fcIt.next();
-//							Geometry obj = (Geometry) f
-//									.getDefaultGeometryProperty().getValue();
-//
-//							// TODO Hier muss doch irgendwie noch CRS
-//							// umgewrechnet werden...
-//
-//							Geometry featureGeometry = (Geometry) obj;
-//
-//							double distance = featureGeometry
-//									.distance(mousePoint);
-//
-//							if ((nearestFeature == null)
-//									|| (distance < nearestDist)) {
-//								nearestFeature = f;
-//								nearestDist = distance;
-//							}
-//
-//						}
-//
-//					} finally {
-//						fc.close(fcIt);
-//					}
-//
-//					fcOne = new MemoryFeatureCollection(fc.getSchema());
-//					fc.clear();
-//					fcOne.add(nearestFeature);
-//				} else {
-//					fcOne = fc;
-//				}
-//
-//				// Fire the event with the one selected feature
-//				xMapPane.fireMapPaneEvent(new FeatureSelectedEvent(xMapPane,
-//						layer, fcOne.getBounds(), fcOne));
-//			}
-//		}
-//		
-//		// If no vector features were found, or we are in SELECT_ALL mode, we check the raster layers now
-//		if (state == XMapPane.SELECT_ALL || result.isEmpty()) {
-//			xMapPane.findGridCoverageValuesAndFireEvents(geoCoord, state);			
-//		}
-//
-//		xMapPane.updateCursor();
-//
-//	}
-//
-//	/**
-//	 * Verarbeitet die Mausrad-Aktion, indem gezoomed wird.
-//	 * 
-//	 * @param wheelEvt
-//	 *            Mausrad-Event
-//	 */
-//	@Override
-//	public void mouseWheelMoved(MouseWheelEvent wheelEvt) {
-//		if (!isEnabled())
-//			return;
-//
-//		final int units = wheelEvt.getUnitsToScroll();
-//		if (units > 0)
-//			xMapPane.zoomTo(wheelEvt.getPoint(), 1. + .11 * units);
-//		else
-//			xMapPane.zoomTo(wheelEvt.getPoint(), 2. / -units);
-//	}
-////
-////	@Override
-////	public void mouseDragged(final MouseEvent event) {
-////		if (!isEnabled())
-////			return;
-////
-////		xMapPane.mouseDragged(startPos, lastPos, event);
-////
-////		lastPos = event.getPoint();
-////	}
-//
-//	/**
-//	 * Stores beginning of a drag event in window coordinates
-//	 */
-//	protected Point startPos;
-////
-////	/**
-////	 * Stores last position of a drag event in window coordinates
-////	 */
-////	protected Point lastPos;
-////
-////	public void mouseReleased(final MouseEvent event) {
-////		if (!isEnabled())
-////			return;
-////
-//////		if (xMapPane.getState() == XMapPane.PAN
-//////				|| event.getButton() == MouseEvent.BUTTON3) {
-//////			xMapPane.performPan();
-//////		} else 
-//////			
-////			if (xMapPane.getState() == XMapPane.SELECT_ALL
-////				|| xMapPane.getState() == XMapPane.SELECT_TOP
-////				) {
-////			
-////			Point mp = event.getPoint();
-////
-////			// Ist es eine wirkliche Selektion, oder etwas nur ein Klick?
-////			if (startPos.x != mp.x && startPos.y != mp.y) {
-////				xMapPane.drawRectangle(xMapPane.getGraphics(), startPos, event
-////						.getPoint());
-////			}
-////
-////			// SELECTION!
-////			xMapPane.performSelectionEvent(startPos.x, startPos.y, mp.x, mp.y);
-////		}
-//
-////	}
-////
-////	public void mousePressed(final MouseEvent e) {
-////		if (!isEnabled())
-////			return;
-////		startPos = new Point(e.getPoint());
-////		lastPos = new Point(e.getPoint());
-////	}
-//
-//	public SelectXMapPaneMouseListener(SelectableXMapPane xMapPane) {
-//		this.xMapPane = xMapPane;
-//	}
-//
-//	public void setEnabled(boolean enabled) {
-//		this.enabled = enabled;
-//	}
-//
-//
-//}



More information about the Schmitzm-commits mailing list