org.shapelogic.polygon
Class MultiLine

java.lang.Object
  extended by org.shapelogic.polygon.BaseAnnotatedShape
      extended by org.shapelogic.polygon.MultiLine
All Implemented Interfaces:
java.lang.Comparable<ILine2D>, Calc0<MultiLine>, CalcInvoke<MultiLine>, CalcValue<MultiLine>, LazyCalc<MultiLine>, AnnotatedShape, GeometricShape2D, ILine2D, PointReplacable<MultiLine>

public class MultiLine
extends BaseAnnotatedShape
implements ILine2D, CalcInvoke<MultiLine>, PointReplacable<MultiLine>, AnnotatedShape

A list of point on a continues line that does not have any intersections. But it can contain turns. Should this be mutable or immutable? This is just a list of already existing point so immutable should be fine. I can change this later.

Author:
Sami Badawi

Field Summary
protected  BBox _bBox
           
protected  IPoint2D _centerForCircle
          Should be set if the multi line turns out to be a circle
protected  java.lang.Boolean _closedLineClockWise
           
protected  boolean _dirty
           
protected  LineType _lineType
           
protected  java.util.ArrayList<IPoint2D> _points
          UNKNOWN means not tested for round, but treat as a multi line NOT_ROUND means that it is tested for any of the round categories and it is not, treat it as a multi line STRAIGHT lines combined to a straight line, say for an F CIRCLE_ARCH_FORWARDS, from the first point move in increasing angle to get to second point
 
Fields inherited from class org.shapelogic.polygon.BaseAnnotatedShape
_annotatedShape
 
Constructor Summary
MultiLine(AnnotatedShapeImplementation annotatedShape)
           
 
Method Summary
 void addAfterEnd(IPoint2D newPoint)
           
 void addBeforeStart(IPoint2D newPoint)
           
 int compareTo(ILine2D other)
           
 boolean equals(java.lang.Object obj)
           
 BBox getBBox()
           
 IPoint2D getCenter()
           
 IPoint2D getCenterForCircle()
           
 double getDiameter()
           
 IPoint2D getEnd()
           
 LineType getLineType()
           
 java.util.List<? extends IPoint2D> getPoints()
           
 IPoint2D getStart()
           
 MultiLine getValue()
          Starts a lazy calculation.
 java.lang.String internalInfo(java.lang.StringBuffer sb)
           
 MultiLine invoke()
           
 boolean isClosed()
           
 java.lang.Boolean isClosedLineClockWise()
           
 boolean isDirty()
          When dirty is false that means that the calculated value can be used
 MultiLine replacePointsInMap(java.util.Map<IPoint2D,IPoint2D> pointReplacementMap, AnnotatedShapeImplementation annotatedShape)
           
 void setCenterForCircle(IPoint2D forCircle)
           
 void setClosedLineClockWise(java.lang.Boolean lineClockWise)
           
 void setPoints(java.util.List<? extends IPoint2D> points)
           
 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.
 MultiLine[] split(int splitIndex)
          Not sure what to return.
 MultiLine[] split(IPoint2D splitPoint)
          Not sure what to return.
 CLine toCLine()
           
 
Methods inherited from class org.shapelogic.polygon.BaseAnnotatedShape
getAnnotatedShape, getAnnotationForShapes, getMap, getShapesForAnnotation, putAllAnnotation, putAnnotation
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.shapelogic.polygon.AnnotatedShape
getAnnotatedShape, getAnnotationForShapes, getMap, getShapesForAnnotation, putAllAnnotation, putAnnotation
 

Field Detail

_points

protected java.util.ArrayList<IPoint2D> _points
UNKNOWN means not tested for round, but treat as a multi line NOT_ROUND means that it is tested for any of the round categories and it is not, treat it as a multi line STRAIGHT lines combined to a straight line, say for an F CIRCLE_ARCH_FORWARDS, from the first point move in increasing angle to get to second point


_centerForCircle

protected IPoint2D _centerForCircle
Should be set if the multi line turns out to be a circle


_bBox

protected BBox _bBox

_dirty

protected boolean _dirty

_lineType

protected LineType _lineType

_closedLineClockWise

protected java.lang.Boolean _closedLineClockWise
Constructor Detail

MultiLine

public MultiLine(AnnotatedShapeImplementation annotatedShape)
Method Detail

getEnd

public IPoint2D getEnd()
Specified by:
getEnd in interface ILine2D

getStart

public IPoint2D getStart()
Specified by:
getStart in interface ILine2D

addBeforeStart

public void addBeforeStart(IPoint2D newPoint)

addAfterEnd

public void addAfterEnd(IPoint2D newPoint)

compareTo

public int compareTo(ILine2D other)
Specified by:
compareTo in interface java.lang.Comparable<ILine2D>

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

getPoints

public java.util.List<? extends IPoint2D> getPoints()

setPoints

public void setPoints(java.util.List<? extends IPoint2D> points)

split

public MultiLine[] split(IPoint2D splitPoint)
Not sure what to return. Maybe an array of CMultiLine

Parameters:
splitPoint -

split

public MultiLine[] split(int splitIndex)
Not sure what to return. Maybe an array of CMultiLine

Parameters:
splitIndex -

getCenterForCircle

public IPoint2D getCenterForCircle()

setCenterForCircle

public void setCenterForCircle(IPoint2D forCircle)

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<MultiLine>

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<MultiLine>
Specified by:
setup in interface AnnotatedShape
Overrides:
setup in class BaseAnnotatedShape

invoke

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

getValue

public MultiLine 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<MultiLine>

getBBox

public BBox getBBox()

toCLine

public CLine toCLine()

getLineType

public LineType getLineType()

isClosed

public boolean isClosed()

replacePointsInMap

public MultiLine replacePointsInMap(java.util.Map<IPoint2D,IPoint2D> pointReplacementMap,
                                    AnnotatedShapeImplementation annotatedShape)
Specified by:
replacePointsInMap in interface PointReplacable<MultiLine>

getCenter

public IPoint2D getCenter()
Specified by:
getCenter in interface GeometricShape2D

getDiameter

public double getDiameter()
Specified by:
getDiameter in interface GeometricShape2D

isClosedLineClockWise

public java.lang.Boolean isClosedLineClockWise()

setClosedLineClockWise

public void setClosedLineClockWise(java.lang.Boolean lineClockWise)

internalInfo

public java.lang.String internalInfo(java.lang.StringBuffer sb)


Copyright © 2008. All Rights Reserved.