[Schmitzm-commits] r1304 - trunk/src/schmitzm/geotools

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Nov 24 15:25:20 CET 2010


Author: mojays
Date: 2010-11-24 15:25:18 +0100 (Wed, 24 Nov 2010)
New Revision: 1304

Modified:
   trunk/src/schmitzm/geotools/JTSUtil.java
Log:
JTSUtil: new methods to create a JTS point from scratch

Modified: trunk/src/schmitzm/geotools/JTSUtil.java
===================================================================
--- trunk/src/schmitzm/geotools/JTSUtil.java	2010-11-24 13:51:22 UTC (rev 1303)
+++ trunk/src/schmitzm/geotools/JTSUtil.java	2010-11-24 14:25:18 UTC (rev 1304)
@@ -49,6 +49,8 @@
 import com.vividsolutions.jts.geom.Envelope;
 import com.vividsolutions.jts.geom.Geometry;
 import com.vividsolutions.jts.geom.GeometryFactory;
+import com.vividsolutions.jts.geom.Location;
+import com.vividsolutions.jts.geom.Point;
 import com.vividsolutions.jts.io.ParseException;
 import com.vividsolutions.jts.io.WKTReader;
 
@@ -63,7 +65,27 @@
 public class JTSUtil {
 	private static Logger LOGGER = Logger.getLogger(JTSUtil.class.getName());
 
+	public static final GeometryFactory GEOM_FACT = JTSFactoryFinder.getGeometryFactory(null);
+
 	/**
+	 * Creates a point from scratch.
+	 * @param point a awt point with x = longitude and y = latitude
+	 */
+	public static Point createPoint(java.awt.Point point) {
+		return createPoint(point.x, point.y);
+	}
+	
+	/**
+	 * Creates a point from scratch.
+	 * @param lon longitude
+	 * @param lat latitude
+	 */
+	public static Point createPoint(double lon, double lat) {
+		Coordinate coord = new Coordinate(lon, lat);
+		return GEOM_FACT.createPoint(coord);
+	}
+
+	/**
 	 * Created an (CRS-less) JTS-Envelope from an OpenGIS-Envelope.
 	 * 
 	 * @param envelope



More information about the Schmitzm-commits mailing list