org.shapelogic.imageprocessing
Class LineProperties

java.lang.Object
  extended by org.shapelogic.imageprocessing.LineProperties
All Implemented Interfaces:
Calc0<java.util.Set<LineType>>, CalcInvoke<java.util.Set<LineType>>, CalcValue<java.util.Set<LineType>>, LazyCalc<java.util.Set<LineType>>

public class LineProperties
extends java.lang.Object
implements CalcInvoke<java.util.Set<LineType>>

LineProperties contains properties that are important for a line when you are dealing with curved multi line.

Author:
Sami Badawi Properties to keep track of Min and max point Number of positive, almost zero and negative pixels Sum of positive and sum of negative distances If direction change for the 2 adjacent point is different sign Assumptions I do not think that this class is going be reused

Field Summary
 LineType _lineType
           
 double angle
           
 int areaNegativeDistance
           
 int areaPositiveDistance
           
 boolean inflectionPoint
           
 double lastDist
           
 double lengthOfDistanceUnit
           
 int maxNegativeDist
           
 int maxNegativeIndex
           
 CPointInt maxNegativePoint
           
 int maxPositiveDist
           
 int maxPositiveIndex
           
 double nextDist
           
 CPointInt orthogonalVector
           
 int pixelsWithAlmostZeroDistance
           
 int pixelsWithNegativeDistance
           
 int pixelsWithPositiveDistance
           
 CPointInt relativeVector
           
 CPointInt startPoint
           
static int STRAIGHT_LIMIT
           
 
Constructor Summary
LineProperties()
           
 
Method Summary
 LineType calcLineType()
          The main LineType for a line there are 3 options: straight, arch, wave.
 double distanceToPoint(CPointInt point)
          Same unnormalized point distance to line used in splitting line.
 java.util.Set<LineType> getValue()
          Starts a lazy calculation.
 java.util.Set<LineType> invoke()
           
 boolean isConcaveArch()
          lineType needs to be set first.
 boolean isDirty()
          When dirty is false that means that the calculated value can be used
 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

STRAIGHT_LIMIT

public static int STRAIGHT_LIMIT

pixelsWithPositiveDistance

public int pixelsWithPositiveDistance

pixelsWithNegativeDistance

public int pixelsWithNegativeDistance

pixelsWithAlmostZeroDistance

public int pixelsWithAlmostZeroDistance

areaPositiveDistance

public int areaPositiveDistance

areaNegativeDistance

public int areaNegativeDistance

maxPositiveDist

public int maxPositiveDist

maxPositiveIndex

public int maxPositiveIndex

maxNegativeDist

public int maxNegativeDist

maxNegativeIndex

public int maxNegativeIndex

maxNegativePoint

public CPointInt maxNegativePoint

angle

public double angle

_lineType

public LineType _lineType

startPoint

public CPointInt startPoint

relativeVector

public CPointInt relativeVector

orthogonalVector

public CPointInt orthogonalVector

lengthOfDistanceUnit

public double lengthOfDistanceUnit

lastDist

public double lastDist

nextDist

public double nextDist

inflectionPoint

public boolean inflectionPoint
Constructor Detail

LineProperties

public LineProperties()
Method Detail

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<java.util.Set<LineType>>

invoke

public java.util.Set<LineType> invoke()
Specified by:
invoke in interface Calc0<java.util.Set<LineType>>

getValue

public java.util.Set<LineType> 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<java.util.Set<LineType>>

calcLineType

public LineType calcLineType()
The main LineType for a line there are 3 options: straight, arch, wave.


distanceToPoint

public double distanceToPoint(CPointInt point)
Same unnormalized point distance to line used in splitting line.

Parameters:
point - an input
Returns:
unnormalized distance to the line from the star to end point

isConcaveArch

public boolean isConcaveArch()
lineType needs to be set first.


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<java.util.Set<LineType>>


Copyright © 2009. All Rights Reserved.