|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.shapelogic.polygon.BaseAnnotatedShape
org.shapelogic.polygon.Polygon
public class Polygon
Polygon is the bottom class for polygon works for points on any kind Almost immutable: you can extend it by adding more but you cannot change the element, and the underlying points are mutable. So point should not be changed after they are added. Note that this and the sub class MultiLinePolygon has the exactly same interface
| Field Summary | |
|---|---|
protected AnnotatedShapeImplementation |
_annotatedShape
|
protected double |
_aspectRatio
|
protected BBox |
_bBox
|
protected boolean |
_closed
|
protected MultiLine |
_currentMultiLine
|
protected boolean |
_dirty
|
protected int |
_endPointCount
|
protected java.util.List<java.util.Set<IPoint2D>> |
_endPointsClusters
|
protected java.util.Set<CLine> |
_lines
|
protected java.util.Set<IPoint2D> |
_points
|
protected java.util.Map<IPoint2D,java.lang.Integer> |
_pointsCountMap
|
protected java.util.Map<IPoint2D,java.util.Set<CLine>> |
_pointsToLineMap
|
protected java.util.List<Improver<Polygon>> |
_polygonImprovers
|
protected int |
_version
|
| Constructor Summary | |
|---|---|
Polygon()
|
|
Polygon(AnnotatedShapeImplementation annotatedShape)
|
|
| Method Summary | ||
|---|---|---|
void |
addAfterEnd(IPoint2D newPoint)
|
|
void |
addBeforeStart(IPoint2D newPoint)
|
|
protected CLine |
addIndependentLine(CLine line)
Most of the time this should not be used use the version taking input points instead |
|
CLine |
addIndependentLine(IPoint2D point1,
IPoint2D point2)
To have the same interface as MultiLinePolygon |
|
protected CLine |
addLine(CLine line)
Deprecated. |
|
CLine |
addLine(IPoint2D point1,
IPoint2D point2)
this should not be used use addIndependentLine() instead |
|
void |
addMultiLine(MultiLine multiLine)
|
|
Polygon |
calc()
|
|
Polygon |
cleanUp(boolean onlyInt,
double procentage)
Return a cleaned up polygon |
|
java.lang.Object |
clone()
|
|
boolean |
containsLine(ILine2D line)
|
|
boolean |
containsPoint(IPoint2D point)
|
|
void |
endMultiLine()
Add all the lines segments in the multi line to _lines |
|
|
filter(IFilter<Polygon,Element> filterObject)
|
|
|
filter(java.lang.String inputExpression)
|
|
int |
findPointCount()
|
|
double |
getAspectRatio()
|
|
BBox |
getBBox()
|
|
Polygon |
getCalcValue()
If dirty do calc() else return cached value. |
|
IPoint2D |
getCenter()
|
|
MultiLine |
getCurrentMultiLine()
|
|
double |
getDiameter()
|
|
int |
getEndPointCount()
|
|
java.util.List<java.util.Set<IPoint2D>> |
getEndPointsClusters()
|
|
java.util.List<java.util.Set<IPoint2D>> |
getEndPointsMultiClusters()
|
|
int |
getHoleCount()
|
|
java.util.List<CLine> |
getHorizontalLines()
|
|
java.util.Set<CLine> |
getIndependentLines()
To have the same interface as MultiLinePolygon |
|
java.util.Set<CLine> |
getLines()
|
|
java.util.Collection<CLine> |
getLinesForPoint(IPoint2D point)
|
|
java.util.List<MultiLine> |
getMultiLines()
To have the same interface as MultiLinePolygon returns null since this and the independent lines are supposed to be all the lines |
|
java.util.Set<IPoint2D> |
getPoints()
|
|
java.util.Map<IPoint2D,java.lang.Integer> |
getPointsCountMap()
Find how many lines each point is part of by making a map |
|
java.util.Map<IPoint2D,java.util.Set<CLine>> |
getPointsToLineMap()
Find how many lines each point is part of by making a map |
|
int |
getVersion()
|
|
java.util.List<CLine> |
getVerticalLines()
|
|
Polygon |
improve()
register a list of improvers and call them here |
|
protected void |
internalFactory()
All the objects that needs special version should be created here. |
|
boolean |
isClosed()
|
|
boolean |
isDirty()
|
|
Polygon |
replacePointsInMap(java.util.Map<IPoint2D,IPoint2D> pointReplacementMap,
AnnotatedShapeImplementation annotatedShape)
No filtering in first version |
|
void |
setPolygonImprovers(java.util.List<Improver<Polygon>> improvers)
|
|
void |
setup()
|
|
void |
setVersion(int version)
|
|
void |
startMultiLine()
|
|
java.lang.String |
toString()
|
|
| Methods inherited from class org.shapelogic.polygon.BaseAnnotatedShape |
|---|
getAnnotatedShape, getAnnotationForShapes, getMap, getShapesForAnnotation, putAllAnnotation, putAnnotation |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected BBox _bBox
protected java.util.Set<CLine> _lines
protected java.util.Set<IPoint2D> _points
protected boolean _dirty
protected double _aspectRatio
protected boolean _closed
protected int _endPointCount
protected java.util.Map<IPoint2D,java.lang.Integer> _pointsCountMap
protected java.util.Map<IPoint2D,java.util.Set<CLine>> _pointsToLineMap
protected int _version
protected MultiLine _currentMultiLine
protected java.util.List<java.util.Set<IPoint2D>> _endPointsClusters
protected AnnotatedShapeImplementation _annotatedShape
protected java.util.List<Improver<Polygon>> _polygonImprovers
| Constructor Detail |
|---|
public Polygon()
public Polygon(AnnotatedShapeImplementation annotatedShape)
| Method Detail |
|---|
protected void internalFactory()
public BBox getBBox()
getBBox in interface IPolygon2Dpublic java.util.Set<CLine> getLines()
getLines in interface IPolygon2Dpublic java.util.Set<IPoint2D> getPoints()
getPoints in interface IPolygon2Dpublic double getAspectRatio()
getAspectRatio in interface IPolygon2Dpublic boolean isClosed()
isClosed in interface IPolygon2Dpublic boolean isDirty()
isDirty in interface LazyCalc<Polygon>public void setup()
setup in interface LazyCalc<Polygon>setup in interface AnnotatedShapesetup in class BaseAnnotatedShapepublic boolean containsPoint(IPoint2D point)
public boolean containsLine(ILine2D line)
public CLine addLine(IPoint2D point1,
IPoint2D point2)
@Deprecated protected CLine addLine(CLine line)
public Polygon calc()
calc in interface Calc<Polygon>
public Polygon cleanUp(boolean onlyInt,
double procentage)
onlyInt - Change all coordinates to integersprocentage - of diagonal of b box that should be considered as same pointpublic Polygon improve()
public Polygon getCalcValue()
Calc
getCalcValue in interface Calc<Polygon>public java.util.List<CLine> getVerticalLines()
public java.util.List<CLine> getHorizontalLines()
public java.util.Map<IPoint2D,java.lang.Integer> getPointsCountMap()
public java.util.Map<IPoint2D,java.util.Set<CLine>> getPointsToLineMap()
public int findPointCount()
public int getEndPointCount()
public java.util.Collection<CLine> getLinesForPoint(IPoint2D point)
public int getVersion()
public void setVersion(int version)
public void startMultiLine()
public void addBeforeStart(IPoint2D newPoint)
public void addAfterEnd(IPoint2D newPoint)
public void endMultiLine()
public void addMultiLine(MultiLine multiLine)
public MultiLine getCurrentMultiLine()
public java.util.List<java.util.Set<IPoint2D>> getEndPointsClusters()
public java.util.List<java.util.Set<IPoint2D>> getEndPointsMultiClusters()
public java.lang.Object clone()
clone in class java.lang.Object
public Polygon replacePointsInMap(java.util.Map<IPoint2D,IPoint2D> pointReplacementMap,
AnnotatedShapeImplementation annotatedShape)
replacePointsInMap in interface PointReplacable<Polygon>public IPoint2D getCenter()
getCenter in interface GeometricShape2Dpublic double getDiameter()
getDiameter in interface GeometricShape2Dpublic void setPolygonImprovers(java.util.List<Improver<Polygon>> improvers)
public CLine addIndependentLine(IPoint2D point1,
IPoint2D point2)
protected CLine addIndependentLine(CLine line)
public java.util.Set<CLine> getIndependentLines()
public java.util.List<MultiLine> getMultiLines()
public <Element> java.util.Collection<Element> filter(IFilter<Polygon,Element> filterObject)
public <Element> java.util.Collection<Element> filter(java.lang.String inputExpression)
public int getHoleCount()
public java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||