org.jaitools.jts
Class AbstractSmoother

java.lang.Object
  extended by org.jaitools.jts.AbstractSmoother
Direct Known Subclasses:
LineSmoother, PolygonSmoother

public abstract class AbstractSmoother
extends Object

Base class for Bezier smoothing of JTS Geometry objects.

Since:
1.1
Version:
$Id$
Author:
Michael Bedward

Nested Class Summary
protected static class AbstractSmoother.InterpPoint
          Class to hold interpolation parameters for a given point.
 
Field Summary
protected  SmootherControl control
          The current SmootherControl instance.
static SmootherControl DEFAULT_CONTROL
          Default smoothing control.
protected  com.vividsolutions.jts.geom.GeometryFactory geomFactory
          The current GeometryFactory being used.
protected  Map<Integer,WeakReference<AbstractSmoother.InterpPoint[]>> lookup
          Cache of previously calculated interpolation parameters
 
Constructor Summary
AbstractSmoother(com.vividsolutions.jts.geom.GeometryFactory geomFactory)
          Creates a new smoother that will use the given GeometryFactory.
 
Method Summary
protected  com.vividsolutions.jts.geom.Coordinate[] cubicBezier(com.vividsolutions.jts.geom.Coordinate start, com.vividsolutions.jts.geom.Coordinate end, com.vividsolutions.jts.geom.Coordinate ctrl1, com.vividsolutions.jts.geom.Coordinate ctrl2, int nv)
          Calculates vertices along a cubic Bazier curve given start point, end point and two control points.
protected  AbstractSmoother.InterpPoint[] getInterpPoints(int npoints)
          Gets the interpolation parameters for a Bezier curve approximated by the given number of vertices.
 void setControl(SmootherControl control)
          Sets a new Control object to for smoothing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CONTROL

public static final SmootherControl DEFAULT_CONTROL
Default smoothing control. Specifies no minimum vertex distance and a constant number of points per smoothed segment.


control

protected SmootherControl control
The current SmootherControl instance.


geomFactory

protected final com.vividsolutions.jts.geom.GeometryFactory geomFactory
The current GeometryFactory being used.


lookup

protected Map<Integer,WeakReference<AbstractSmoother.InterpPoint[]>> lookup
Cache of previously calculated interpolation parameters

Constructor Detail

AbstractSmoother

public AbstractSmoother(com.vividsolutions.jts.geom.GeometryFactory geomFactory)
Creates a new smoother that will use the given GeometryFactory.

Parameters:
geomFactory - factory to use for creating smoothed objects
Throws:
IllegalArgumentException - if geomFactory is null
Method Detail

setControl

public void setControl(SmootherControl control)
Sets a new Control object to for smoothing.

Parameters:
control - the control to use for smoothing; if null the default control will be set

cubicBezier

protected com.vividsolutions.jts.geom.Coordinate[] cubicBezier(com.vividsolutions.jts.geom.Coordinate start,
                                                               com.vividsolutions.jts.geom.Coordinate end,
                                                               com.vividsolutions.jts.geom.Coordinate ctrl1,
                                                               com.vividsolutions.jts.geom.Coordinate ctrl2,
                                                               int nv)
Calculates vertices along a cubic Bazier curve given start point, end point and two control points.

Parameters:
start - start position
end - end position
ctrl1 - first control point
ctrl2 - second control point
nv - number of vertices including the start and end points
Returns:
vertices along the Bezier curve

getInterpPoints

protected AbstractSmoother.InterpPoint[] getInterpPoints(int npoints)
Gets the interpolation parameters for a Bezier curve approximated by the given number of vertices.

Parameters:
npoints - number of vertices
Returns:
array of InterpPoint objects holding the parameter values


Copyright © 2009-2013. All Rights Reserved.