com.java4less.ocr.docparser.fields
Class FieldPositionDef

java.lang.Object
  extended by com.java4less.ocr.docparser.fields.FieldPositionDef

public class FieldPositionDef
extends java.lang.Object

The file position definition call is used to dynamically find the location of a field based on references to other fields, marks, or predefined locations


Field Summary
static int DIR_BETWEEN
           
static int DIR_DOWN
           
static int DIR_LEFT
           
static int DIR_RIGHT
           
static int DIR_UP
           
 
Constructor Summary
FieldPositionDef(IReference ref, int dist, int dir)
          defines a position
 
Method Summary
 int getDirection()
          in which direction (from the reference) is the field location?
 int getDistance()
          how many words or lines is this field away from the reference
 IReference getReference1()
          reference object
 IReference getReference2()
          second reference (for the direction DIR_BETWEEN)
 boolean isFixedColumnPosition()
          if true, the distance property will be the column (x) position of the field
 void load(org.w3c.dom.Node n, SectionDef sec)
          load from XML node
 void saveToXml(org.w3c.dom.Document document, org.w3c.dom.Node n)
          save to xml
 void setDirection(int direction)
           
 void setDistance(int distance)
          how many words or lines is this field away from the reference
 void setFixedColumnPosition(boolean fixedColumnPosition)
          if true, the distance property will be the column (x) position of the field
 void setReference1(IReference reference1)
           
 void setReference2(IReference reference2)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DIR_RIGHT

public static int DIR_RIGHT

DIR_LEFT

public static int DIR_LEFT

DIR_UP

public static int DIR_UP

DIR_DOWN

public static int DIR_DOWN

DIR_BETWEEN

public static int DIR_BETWEEN
Constructor Detail

FieldPositionDef

public FieldPositionDef(IReference ref,
                        int dist,
                        int dir)
defines a position

Parameters:
ref - reference object, normally a label
dist - distance to object
dir - direction
Method Detail

getReference1

public IReference getReference1()
reference object

Returns:

setReference1

public void setReference1(IReference reference1)

getReference2

public IReference getReference2()
second reference (for the direction DIR_BETWEEN)

Returns:

setReference2

public void setReference2(IReference reference2)

getDistance

public int getDistance()
how many words or lines is this field away from the reference

Returns:

setDistance

public void setDistance(int distance)
how many words or lines is this field away from the reference

Parameters:
distance -

getDirection

public int getDirection()
in which direction (from the reference) is the field location?

Returns:

setDirection

public void setDirection(int direction)

saveToXml

public void saveToXml(org.w3c.dom.Document document,
                      org.w3c.dom.Node n)
               throws java.lang.Exception
save to xml

Parameters:
document -
root -
Throws:
java.lang.Exception

load

public void load(org.w3c.dom.Node n,
                 SectionDef sec)
load from XML node

Parameters:
n -

isFixedColumnPosition

public boolean isFixedColumnPosition()
if true, the distance property will be the column (x) position of the field

Returns:

setFixedColumnPosition

public void setFixedColumnPosition(boolean fixedColumnPosition)
if true, the distance property will be the column (x) position of the field

Parameters:
fixedColumnPossition -