org.shapelogic.imageprocessing
Class ShortLineBasedVectorizer

java.lang.Object
  extended by org.shapelogic.imageutil.BaseImageOperation
      extended by org.shapelogic.imageprocessing.BaseVectorizer
          extended by org.shapelogic.imageprocessing.ShortLineBasedVectorizer
All Implemented Interfaces:
java.lang.Runnable, java.util.Iterator<Polygon>, IPixelTypeFinder, LazyPlugInFilter<Polygon>, PixelJumperByte, ImageOperation
Direct Known Subclasses:
DirectionBasedVectorizer, LineVectorizer

public abstract class ShortLineBasedVectorizer
extends BaseVectorizer

Base class for vectorizers that are using a local short line, to determine when to set point on multi line. This approach was not very successful.

Author:
Sami Badawi

Field Summary
 double _angleLimit
           
protected  double _currentAngle
           
protected  CircleInterval _currentCircleInterval
           
protected  LineType _currentLineType
           
protected  CPointInt _currentVectorDirection
          Short to current point
protected  CPointInt _firstPointInLine
          Start of current line, this is also the last point saved in the multi line
protected  byte _firstUsedDirection
           
 int _maxPointsInShortLine
           
protected  PixelTypeCalculator _pixelTypeCalculatorNextPoint
           
protected  int _pointsInCurrentShortLine
           
protected  byte _secondUsedDirection
           
protected  CPointInt _startOfShortLinePoint
          Try to do short lines and
static double ANGLE_DIFFERENCE_LIMIT
           
static int MAX_NUMBER_OF_POINTS_IN_SHORT_LINE
           
 
Fields inherited from class org.shapelogic.imageprocessing.BaseVectorizer
_cleanedupPolygon, _currentDirection, _currentPixelIndex, _currentPoint, _cyclePoints, _displayInternalInfo, _endPointsClusters, _errorMessage, _firstPointInLineIndex, _firstPointInMultiLine, _matchingOH, _maxX, _maxY, _minX, _minY, _nextCount, _numberOfPointsInAllLines, _pixels, _pixelTypeCalculator, _pixelTypeFinder, _rulesArrayForLetterMatching, _stream, _streamName, _unfinishedPoints, _yForUnporcessedPixel, MAX_DISTANCE_BETWEEN_CLUSTER_POINTS, STRAIGHT_LINE_COLOR
 
Fields inherited from class org.shapelogic.imageutil.BaseImageOperation
_arg, _guiWrapper, _image, _keyValueParser, _setupReturnValue
 
Constructor Summary
ShortLineBasedVectorizer()
           
 
Method Summary
protected  void findMultiLine()
          Take point off _unfinishedPoints try to start line from that, if nothing is found the remove point.
protected  void findMultiLinePostProcess()
          To be overridden.
protected  boolean findMultiLinePreProcess()
           
protected  boolean findNextLinePoint()
          Get the next point to investigate from _currentPoint.
 double getAngleLimit()
           
 int getMaxSinceLast()
           
protected  byte handleProblematicPoints()
          Find the maximum if there is more than one the add them all the unknown list.
protected  void internalFactory()
          All the objects that needs special version should be created here.
protected  boolean lastPixelOk(byte newDirection)
          Change to be an up front check.
protected  void makeNewPoint()
           
protected  void makeNewPointPostProcess()
           
protected  void moveCurrentPointForwards(byte newDirection)
           
 void newShortLine()
          Hook for creating new short line.
protected  void resetShortLine()
           
 void setAngleLimit(double angleLimit)
           
 void setMaxSinceLast(int maxSinceLast)
           
protected  void splitLine(CPointInt splitPoint)
          Insert point between current _firstPointInLine and newFirstPoint.
 
Methods inherited from class org.shapelogic.imageprocessing.BaseVectorizer
addToUnfinishedPoints, cleanPolygon, countRegionCrossingsAroundPoint, drawLine, drawLines, findAllLines, findFirstLinePoint, findPointType, getCleanedupPolygon, getCyclePoints, getErrorMessage, getImageProcessor, getMatchingOH, getMaxX, getMaxY, getMinX, getMinY, getPixels, getPoints, getPolygon, getStream, getStreamName, hasNext, init, isPixelUsed, matchLines, next, oppesiteDirection, pixelIndexToPoint, pointToPixelIndex, pointToPixelIndex, polygonFactory, remove, run, setStreamName
 
Methods inherited from class org.shapelogic.imageutil.BaseImageOperation
getGuiWrapper, getImage, getKeyValueParser, getSetupReturnValue, isImageValid, setArg, setGuiWrapper, setKeyValueParser, setSetupReturnValue, setup, showAbout, showMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_NUMBER_OF_POINTS_IN_SHORT_LINE

public static final int MAX_NUMBER_OF_POINTS_IN_SHORT_LINE
See Also:
Constant Field Values

ANGLE_DIFFERENCE_LIMIT

public static final double ANGLE_DIFFERENCE_LIMIT
See Also:
Constant Field Values

_angleLimit

public double _angleLimit

_currentAngle

protected double _currentAngle

_pointsInCurrentShortLine

protected int _pointsInCurrentShortLine

_maxPointsInShortLine

public int _maxPointsInShortLine

_secondUsedDirection

protected byte _secondUsedDirection

_startOfShortLinePoint

protected CPointInt _startOfShortLinePoint
Try to do short lines and


_currentVectorDirection

protected CPointInt _currentVectorDirection
Short to current point


_pixelTypeCalculatorNextPoint

protected PixelTypeCalculator _pixelTypeCalculatorNextPoint

_currentCircleInterval

protected CircleInterval _currentCircleInterval

_firstPointInLine

protected CPointInt _firstPointInLine
Start of current line, this is also the last point saved in the multi line


_firstUsedDirection

protected byte _firstUsedDirection

_currentLineType

protected LineType _currentLineType
Constructor Detail

ShortLineBasedVectorizer

public ShortLineBasedVectorizer()
Method Detail

findMultiLine

protected void findMultiLine()
Take point off _unfinishedPoints try to start line from that, if nothing is found the remove point.

Specified by:
findMultiLine in class BaseVectorizer

findMultiLinePostProcess

protected void findMultiLinePostProcess()
Description copied from class: BaseVectorizer
To be overridden. If I want to do more matching at the end.

Overrides:
findMultiLinePostProcess in class BaseVectorizer

findMultiLinePreProcess

protected boolean findMultiLinePreProcess()
Overrides:
findMultiLinePreProcess in class BaseVectorizer

handleProblematicPoints

protected byte handleProblematicPoints()
Find the maximum if there is more than one the add them all the unknown list.

Specified by:
handleProblematicPoints in class BaseVectorizer

newShortLine

public void newShortLine()
Hook for creating new short line.


resetShortLine

protected void resetShortLine()

getMaxSinceLast

public int getMaxSinceLast()

setMaxSinceLast

public void setMaxSinceLast(int maxSinceLast)

setAngleLimit

public void setAngleLimit(double angleLimit)

lastPixelOk

protected boolean lastPixelOk(byte newDirection)
Change to be an up front check.

Specified by:
lastPixelOk in class BaseVectorizer

getAngleLimit

public double getAngleLimit()

moveCurrentPointForwards

protected void moveCurrentPointForwards(byte newDirection)
Overrides:
moveCurrentPointForwards in class BaseVectorizer

makeNewPoint

protected void makeNewPoint()

makeNewPointPostProcess

protected void makeNewPointPostProcess()

internalFactory

protected void internalFactory()
All the objects that needs special version should be created here.

Specified by:
internalFactory in class BaseVectorizer

findNextLinePoint

protected boolean findNextLinePoint()
Get the next point to investigate from _currentPoint. This also contains check if this should cause a new new point to be created. if there is more than one point to chose from add the point to: _unfinishedPoints that is a list of points that need to be revisited. assumes that _pixelTypeCalculator is set to current point

Returns:
true if there are more points

splitLine

protected void splitLine(CPointInt splitPoint)
Insert point between current _firstPointInLine and newFirstPoint. There are currently several things that I am not sure how to handle look in makeNewPoint()



Copyright © 2008. All Rights Reserved.