org.shapelogic.polygon
Class PolygonEndPointAdjuster
java.lang.Object
org.shapelogic.polygon.PolygonEndPointAdjuster
- All Implemented Interfaces:
- Calc<Polygon>, LazyCalc<Polygon>, Improver<Polygon>
public class PolygonEndPointAdjuster
- extends java.lang.Object
- implements Improver<Polygon>
Take a polygon as input and a list of sets of point that potentially can be
combined. Create a new polygon.
I think that if there have been no changes then just return the original polygon.
I think that polygons are supposed to be immutable.
- Author:
- Sami Badawi
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
_inputPolygon
protected Polygon _inputPolygon
_calcValue
protected Polygon _calcValue
_dirty
protected boolean _dirty
_endPointsMultiClusters
protected java.util.List<java.util.Set<IPoint2D>> _endPointsMultiClusters
_clustersToPointMapping
protected java.util.Map<java.util.Set<IPoint2D>,IPoint2D> _clustersToPointMapping
_clusterPointToCommonPointMapping
protected java.util.Map<IPoint2D,IPoint2D> _clusterPointToCommonPointMapping
_createdNewVersion
protected boolean _createdNewVersion
PolygonEndPointAdjuster
public PolygonEndPointAdjuster()
PolygonEndPointAdjuster
public PolygonEndPointAdjuster(Polygon inputPolygon)
getInput
public Polygon getInput()
- Specified by:
getInput
in interface Improver<Polygon>
isDirty
public boolean isDirty()
- Specified by:
isDirty
in interface LazyCalc<Polygon>
setup
public void setup()
- Specified by:
setup
in interface LazyCalc<Polygon>
calc
public Polygon calc()
- Specified by:
calc
in interface Calc<Polygon>
getCalcValue
public Polygon getCalcValue()
- Description copied from interface:
Calc
- If dirty do calc() else return cached value.
This should maybe be moved up in the hierarchy
- Specified by:
getCalcValue
in interface Calc<Polygon>
testCluster
protected IPoint2D testCluster(java.util.Set<IPoint2D> cluster)
- If all the points in a cluster can be combined to a single point
- Returns:
- the point if it is possible otherwise null
This class has very strict criteria for joining points.
Only join if all lines are either very small or straight,
and the new point keep all the straight lines straight.
This might be relaxed in subclasses, by overriding this method
startPointIsClosest
public static boolean startPointIsClosest(CLine line,
IPoint2D clusterPoint)
extendLine
public static IPoint2D extendLine(CLine line,
IPoint2D clusterPoint)
adjustmentPointOkForLine
public boolean adjustmentPointOkForLine(CLine line,
IPoint2D newPoint)
getEndPointsMultiClusters
public java.util.List<java.util.Set<IPoint2D>> getEndPointsMultiClusters()
createdNewVersion
public boolean createdNewVersion()
- Specified by:
createdNewVersion
in interface Improver<Polygon>
setInput
public void setInput(Polygon input)
- Specified by:
setInput
in interface Improver<Polygon>
Copyright © 2007. All Rights Reserved.