org.shapelogic.polygon
Class FilterPolygonForSmallLines

java.lang.Object
  extended by org.shapelogic.polygon.FilterPolygonForSmallLines
All Implemented Interfaces:
Calc0<Polygon>, CalcInvoke<Polygon>, CalcValue<Polygon>, LazyCalc<Polygon>, Improver<Polygon>

public class FilterPolygonForSmallLines
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

Field Summary
protected  java.util.Map<IPoint2D,IPoint2D> _clusterPointToCommonPointMapping
           
protected  java.util.Map<java.util.Set<IPoint2D>,IPoint2D> _clustersToPointMapping
           
protected  boolean _createdNewVersion
           
protected  boolean _dirty
           
protected  java.util.List<java.util.Set<IPoint2D>> _endPointsMultiClusters
           
protected  Polygon _inputPolygon
           
protected  double _smallLineCutOffLength
           
protected  int _smallLinesFiltered
           
protected  Polygon _value
           
static double SMALL_LINE_LIMIT
           
 
Constructor Summary
FilterPolygonForSmallLines()
           
FilterPolygonForSmallLines(Polygon inputPolygon)
           
 
Method Summary
 boolean createdNewVersion()
           
 Polygon getInput()
           
 Polygon getValue()
          Starts a lazy calculation.
protected  void handleLine(CLine line)
          I think that this need to be done differently for different types of polygons For Polygon: Just go through lines and filter For MultiLinePolygon: Run through both multi lines and independent lines How do I get this unified? Change so they have the same interface so now Polygon also return independent lines.
 Polygon invoke()
           
 boolean isDirty()
          When dirty is false that means that the calculated value can be used
 void setInput(Polygon input)
           
 void setup()
          Currently not super well define used for 2 purposes: Reset: called from the outside if you want to reuse it init: Called from the inside when calculation start to have everything setup maybe the semantic could work for both? TODO: This should be separated better.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SMALL_LINE_LIMIT

public static double SMALL_LINE_LIMIT

_inputPolygon

protected Polygon _inputPolygon

_value

protected Polygon _value

_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

_smallLineCutOffLength

protected double _smallLineCutOffLength

_smallLinesFiltered

protected int _smallLinesFiltered
Constructor Detail

FilterPolygonForSmallLines

public FilterPolygonForSmallLines()

FilterPolygonForSmallLines

public FilterPolygonForSmallLines(Polygon inputPolygon)
Method Detail

getInput

public Polygon getInput()
Specified by:
getInput in interface Improver<Polygon>

isDirty

public boolean isDirty()
Description copied from interface: LazyCalc
When dirty is false that means that the calculated value can be used

Specified by:
isDirty in interface LazyCalc<Polygon>

setup

public void setup()
Description copied from interface: LazyCalc
Currently not super well define used for 2 purposes: Reset: called from the outside if you want to reuse it init: Called from the inside when calculation start to have everything setup maybe the semantic could work for both? TODO: This should be separated better.

Specified by:
setup in interface LazyCalc<Polygon>

invoke

public Polygon invoke()
Specified by:
invoke in interface Calc0<Polygon>

getValue

public Polygon getValue()
Description copied from interface: CalcValue
Starts a lazy calculation. If dirty do calc() else return cached value. This should maybe be moved up in the hierarchy

Specified by:
getValue in interface CalcValue<Polygon>

handleLine

protected void handleLine(CLine line)
I think that this need to be done differently for different types of polygons For Polygon: Just go through lines and filter For MultiLinePolygon: Run through both multi lines and independent lines How do I get this unified? Change so they have the same interface so now Polygon also return independent lines. This can be optimized


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 © 2009. All Rights Reserved.