org.jaitools.jts
Class Utils

java.lang.Object
  extended by org.jaitools.jts.Utils

public class Utils
extends Object

A helper class with methods to work with JTS geometry objects.

Since:
1.1
Version:
$Id$
Author:
Simone Giannecchini, GeoSolutions SAS, Michael Bedward

Method Summary
static com.vividsolutions.jts.geom.GeometryFactory getGeometryFactory()
          Gets the cached GeometryFactory instance.
static com.vividsolutions.jts.geom.Geometry removeCollinearVertices(com.vividsolutions.jts.geom.Geometry g)
          Removes collinear vertices from the provided Geometry.
static com.vividsolutions.jts.geom.LineString removeCollinearVertices(com.vividsolutions.jts.geom.LineString ls)
          Removes collinear points from the provided linestring.
static com.vividsolutions.jts.geom.Polygon removeCollinearVertices(com.vividsolutions.jts.geom.Polygon polygon)
          Removes collinear vertices from the provided Polygon.
static com.vividsolutions.jts.geom.GeometryFactory setPrecision(double scale)
          Sets the precision to be used by the cached GeometryFactory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getGeometryFactory

public static com.vividsolutions.jts.geom.GeometryFactory getGeometryFactory()
Gets the cached GeometryFactory instance.

Returns:
the geometry factory

setPrecision

public static com.vividsolutions.jts.geom.GeometryFactory setPrecision(double scale)
Sets the precision to be used by the cached GeometryFactory. For an explanation of the scale factor see PrecisionModel.

Parameters:
scale - the desired precision expressed as a scale factor
Returns:
the (possibly new) cached GeometryFactory instance

removeCollinearVertices

public static com.vividsolutions.jts.geom.LineString removeCollinearVertices(com.vividsolutions.jts.geom.LineString ls)
Removes collinear points from the provided linestring.

Parameters:
ls - the LineString to be simplified.
Returns:
a new version of the provided LineString with collinear points removed.

removeCollinearVertices

public static com.vividsolutions.jts.geom.Polygon removeCollinearVertices(com.vividsolutions.jts.geom.Polygon polygon)
Removes collinear vertices from the provided Polygon.

Parameters:
polygon - the instance of a Polygon to remove collinear vertices from.
Returns:
a new instance of the provided Polygon without collinear vertices.

removeCollinearVertices

public static com.vividsolutions.jts.geom.Geometry removeCollinearVertices(com.vividsolutions.jts.geom.Geometry g)
Removes collinear vertices from the provided Geometry.

For the moment this implementation only accepts, Polygon, LinearRing and LineString. It return null in case the geometry is not of these types.

Parameters:
g - the instance of a Geometry to remove collinear vertices from.
Returns:
a new instance of the provided Geometry without collinear vertices.


Copyright © 2009-2013. All Rights Reserved.