private static class LocationTextExtractionStrategy.TextChunk extends Object implements Comparable<LocationTextExtractionStrategy.TextChunk>
Modifier and Type | Field and Description |
---|---|
(package private) float |
charSpaceWidth
the width of a single space character in the font of the chunk
|
(package private) float |
distParallelEnd
distance of the end of the chunk parallel to the orientation unit vector (i.e. the X position in an unrotated coordinate system)
|
(package private) float |
distParallelStart
distance of the start of the chunk parallel to the orientation unit vector (i.e. the X position in an unrotated coordinate system)
|
(package private) int |
distPerpendicular
perpendicular distance to the orientation unit vector (i.e. the Y position in an unrotated coordinate system)
we round to the nearest integer to handle the fuzziness of comparing floats
|
(package private) Vector |
endLocation
the ending location of the chunk
|
(package private) int |
orientationMagnitude
the orientation as a scalar for quick sorting
|
(package private) Vector |
orientationVector
unit vector in the orientation of the chunk
|
(package private) Vector |
startLocation
the starting location of the chunk
|
(package private) String |
text
the text of the chunk
|
Constructor and Description |
---|
TextChunk(String string,
Vector startLocation,
Vector endLocation,
float charSpaceWidth) |
Modifier and Type | Method and Description |
---|---|
private static int |
compareInts(int int1,
int int2) |
int |
compareTo(LocationTextExtractionStrategy.TextChunk rhs)
Compares based on orientation, perpendicular distance, then parallel distance
|
float |
distanceFromEndOf(LocationTextExtractionStrategy.TextChunk other)
Computes the distance between the end of 'other' and the beginning of this chunk
in the direction of this chunk's orientation vector.
|
private void |
printDiagnostics() |
boolean |
sameLine(LocationTextExtractionStrategy.TextChunk as) |
final Vector startLocation
final Vector endLocation
final Vector orientationVector
final int orientationMagnitude
final int distPerpendicular
final float distParallelStart
final float distParallelEnd
final float charSpaceWidth
private void printDiagnostics()
public boolean sameLine(LocationTextExtractionStrategy.TextChunk as)
as
- the location to compare topublic float distanceFromEndOf(LocationTextExtractionStrategy.TextChunk other)
other
- public int compareTo(LocationTextExtractionStrategy.TextChunk rhs)
compareTo
in interface Comparable<LocationTextExtractionStrategy.TextChunk>
Comparable.compareTo(java.lang.Object)
private static int compareInts(int int1, int int2)
int1
- int2
- WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses