Package com.levigo.jadice.document
Class DocumentLayer
java.lang.Object
com.levigo.jadice.document.DocumentLayer
- All Implemented Interfaces:
Comparable<DocumentLayer>
Class representing a layer of a
Document. The layers represent the z-axis of a document.
Each Page in the document consists of a stack of AbstractPageSegments which
correspond to DocumentLayers. In other words, a DocumentLayer
represents a virtual slot in the stack of layers that make up the document whereas the
PageSegments fill these slots.
Please note: the layers pertain to the whole document, therefore not all layers of a page need to be occupied with page segments.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DocumentLayerA layer typically used for annotations.static final DocumentLayerA layer typically used for a document backdrop, e.g. a form image behind plain-text form-contents.static final DocumentLayerA layer typically used for the document itself.static final DocumentLayerA layer typically used for format specific inline annotations.static final DocumentLayerA layer typically used for form elements.static final DocumentLayerA layer typically used for OCR informations, e.g. a hocr file produced by Tesseract which contains text and position information
HINT:
This layer is installed by default in the default layer cache. -
Method Summary
Modifier and TypeMethodDescriptionintCompare two DocumentLayers.booleanstatic DocumentLayerReturn the document layer with the given name.static DocumentLayerReturn the document layer with the given name and priority.getName()Gets the name.intReturn this layer's default ordering priority.inthashCode()toString()Return text representation of the layer.
-
Field Details
-
ANNOTATIONS
A layer typically used for annotations. -
FORM
A layer typically used for form elements. -
OCR
A layer typically used for OCR informations, e.g. a hocr file produced by Tesseract which contains text and position information
HINT:
This layer is installed by default in the default layer cache. If the layer cache implementation is replaced by another layer cache, it is up to that cache implementation to provide this layer as well. -
EMBEDDED_ANNOTATIONS
A layer typically used for format specific inline annotations.
HINT:
This layer is installed by default in the default layer cache. If the layer cache implementation is replaced by another layer cache, it is up to that cache implementation to provide this layer as well. -
DEFAULT
A layer typically used for the document itself. -
BACKGROUND
A layer typically used for a document backdrop, e.g. a form image behind plain-text form-contents.
-
-
Method Details
-
get
Return the document layer with the given name. All layers with the same name will share the same instance as long as the defaultDocumentLayerCacheis not replaced. If the layer does not already exist, a new layer will be created with its default priority being the same asDEFAULT.- Parameters:
name-- Returns:
- the document layer for the given name.
- Throws:
IllegalArgumentException- ifnameisnull
-
get
Return the document layer with the given name and priority. All layers with the same name will share the same instance as long as the defaultDocumentLayerCacheis not replaced. If the layer does not already exist, a new layer will be created the given priority. If the layer does already exist, but the requested priority differs from the one of the existing layer, anIllegalArgumentExceptionis thrown.- Parameters:
name- the layer namepriority- the default priority.- Returns:
- the document layer for the given name.
- Throws:
IllegalArgumentException- if name isnullor there is already a document layer with the given name, but the requested priority differs from the existing one's.
-
getName
Gets the name.- Returns:
- Returns a String
-
compareTo
Compare two DocumentLayers. Comparison is done by comparing default priorities. For identical priorities the comparison falls back to the layers' names.- Specified by:
compareToin interfaceComparable<DocumentLayer>- See Also:
-
toString
Return text representation of the layer. -
getPriority
public int getPriority()Return this layer's default ordering priority.Ordering priorities indicate the layer position within the layer stack. Higher priorities indicating a position closer to the top of the layer stack, lower priorities positions closer to the bottom.
- Returns:
- priority the layer's ordering priority
-
hashCode
public int hashCode() -
equals
-