org.shapelogic.imageprocessing
Class BaseMaxDistanceVectorizer

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

public class BaseMaxDistanceVectorizer
extends BaseVectorizer

Vectorizer that is splitting lines based on max distance to line between end points.

The main idea is that this will read a whole multi line at a time. Then later it will split it according to max distance of pixels to the line between start and end point of the multi line.

Maybe this could be completely abstracted out, maybe but at that point I will just take most of this class and turn it into a base class.

Always stop on junctions, if there is one junction point use that, but stop after. N points are chosen last. Never go from one N point to another, unless that the N point is the first point, to handle an X, where you have 4 N points in the center. If you are at a start point then just chose one direction. Can I delegate this to a different object. I always need to find all the neighbors first. I might have to know how many N points there are if there are more just add all to _unfinishedPoints.

Treatment of different points: Junction: add to new point, move to first junction. N points: count, keep track of first. Other: count, keep track of first. Unused: count, keep track of first. I think that is already done. Used: count, keep track of first.

For each junction add to unfinished. Go to first junction. If other points are available take first and go to it. If only N point is available, if current point an N and not the first point stop else go to that.

When coming to a new point check if it is a junction if stop if not on first point. It does not matter if the start point is used or not. I think that at the end check to see if you can go to either a junction point or to the start point. Also stop if you do not know what to do, at the end of handleProblematicPoints().

Author:
Sami Badawi

Field Summary
protected  ChainCodeHandler _chainCodeHandler
           
 
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
BaseMaxDistanceVectorizer()
           
 
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 This also contains check if this should cause a new new point to be created.
protected  byte handleProblematicPoints()
           
 void init()
          Cannot handle the last pixel at the edge, so for now just ignore it.
protected  void internalFactory()
          All the objects that needs special version should be created here.
protected  boolean lastPixelOk(byte newDirection)
          Everything is always OK.
 
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, isPixelUsed, matchLines, moveCurrentPointForwards, 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

_chainCodeHandler

protected ChainCodeHandler _chainCodeHandler
Constructor Detail

BaseMaxDistanceVectorizer

public BaseMaxDistanceVectorizer()
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

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

handleProblematicPoints

protected byte handleProblematicPoints()
Specified by:
handleProblematicPoints in class BaseVectorizer

lastPixelOk

protected boolean lastPixelOk(byte newDirection)
Everything is always OK. Stop only on junctions and end points.

Specified by:
lastPixelOk in class BaseVectorizer

internalFactory

protected void internalFactory()
Description copied from class: BaseVectorizer
All the objects that needs special version should be created here.

Specified by:
internalFactory in class BaseVectorizer

findMultiLinePreProcess

protected boolean findMultiLinePreProcess()
Overrides:
findMultiLinePreProcess 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

init

public void init()
Description copied from class: BaseVectorizer
Cannot handle the last pixel at the edge, so for now just ignore it.

Overrides:
init in class BaseVectorizer


Copyright © 2009. All Rights Reserved.