ReadFramework
|
#include <Elements.h>
Public Member Functions | |
TextRegion (const Type &type=Type::type_unknown) | |
Initializes a new instance of the TextRegion class. This class represents Text regions (Region::type_text_region). More... | |
void | setText (const QString &text) |
Set the GT/HTR text of the TextRegion. More... | |
QString | text () const |
GT/HTR Text of the TextRegion. More... | |
virtual bool | read (QXmlStreamReader &reader) override |
Reads a TextRegion from the XML stream. The stream must be at the position of the TextRegion's tag and is forwarded until its end More... | |
virtual void | write (QXmlStreamWriter &writer) const override |
Writes the TextRegion instance to the XML stream. More... | |
virtual QString | toString (bool withChildren=false) const override |
Returns a string with all important properties of the TextRegion. More... | |
virtual void | draw (QPainter &p, const RegionTypeConfig &config) const override |
Draws the TextRegion to the Painter. More... | |
Public Member Functions inherited from rdf::Region | |
Region (const Type &type=Type::type_unknown, const QString &id="") | |
Initializes a new instance of the Region class. The Region is the base class for all Region elements that are contained in the extended PAGE XML. More... | |
bool | isEmpty () const |
void | setSelected (bool select) |
bool | selected () const |
void | setType (const Region::Type &type) |
Sets the Region type. More... | |
Region::Type | type () const |
The Region's type (e.g. type_text_region). More... | |
void | setId (const QString &id) |
Set a unique identifier to the region. More... | |
QString | id () const |
Returns the Region's unique identifier. More... | |
void | setCustom (const QString &c) |
QString | custom () const |
void | setPolygon (const Polygon &polygon) |
Set the polygon which enclosed the Region. The polygon's coordinates are w.r.t the image coordinates. More... | |
Polygon | polygon () const |
The Region's polygon. More... | |
void | scaleRegion (double scale) |
void | addChild (QSharedPointer< Region > child) |
Adds a child to the current Region. More... | |
bool | reassignChild (QSharedPointer< Region > child) |
Reassigns the child w.r.t its ID. This function is needed if an element was converted (e.g. table cell to text block) but needs to be updated. If the child ID is found, the children of the existing region are replaced by those of child and true is returned. More... | |
void | addUniqueChild (QSharedPointer< Region > child, bool update=false) |
Adds the child if it does not exist already. If update is true, the duplicate element is updated, otherwise nothing happens if the child exists already. More... | |
void | removeChild (QSharedPointer< Region > child) |
Removes the child specified. More... | |
void | removeAllChildren () |
void | setChildren (const QVector< QSharedPointer< Region > > &children) |
Sets the child regions. More... | |
QVector< QSharedPointer< Region > > | children () const |
Children of this instance. More... | |
virtual QString | childrenToString () const |
Returns a string with all attributes of the Region's children. More... | |
virtual void | readAttributes (QXmlStreamReader &reader) |
virtual void | writeChildren (QXmlStreamWriter &writer) const |
Writes the Region's children to the XML stream. More... | |
void | createElement (QXmlStreamWriter &writer) const |
Creates the element. After a call to this method, attributes can be appended to the element. More... | |
void | writePolygon (QXmlStreamWriter &writer) const |
Writes the polygon. This is a convenience function for derived classes. Typically writePolygon is called after all (additional) attributes of the current element are set. More... | |
virtual bool | operator== (const Region &r1) |
Compare operator. Returns true if both regions have the same type and polygon. More... | |
Protected Attributes | |
TextEquiv | mTextEquiv |
Protected Attributes inherited from rdf::Region | |
Type | mType = Type::type_unknown |
bool | mSelected = false |
QString | mId |
QString | mCustom |
Polygon | mPoly |
QVector< QSharedPointer< Region > > | mChildren |
Additional Inherited Members | |
Public Types inherited from rdf::Region | |
enum | Type { type_unknown = 0, type_root, type_table_region, type_table_cell, type_text_region, type_text_line, type_word, type_separator, type_image, type_graphic, type_chart, type_noise, type_end } |
Static Public Member Functions inherited from rdf::Region | |
static QVector< QSharedPointer< Region > > | selectedRegions (const Region *root) |
static QVector< QSharedPointer< Region > > | allRegions (const Region *root) |
static QVector< QSharedPointer< Region > > | filter (const Region *root, const Region::Type &type) |
Protected Member Functions inherited from rdf::Region | |
void | collectRegions (QVector< QSharedPointer< Region > > &allRegions, const Region::Type &type=type_unknown) const |
virtual bool | readPoints (QXmlStreamReader &reader) |
rdf::TextRegion::TextRegion | ( | const Type & | type = Type::type_unknown | ) |
Initializes a new instance of the TextRegion class. This class represents Text regions (Region::type_text_region).
|
overridevirtual |
Draws the TextRegion to the Painter.
p | The painter. |
config | The configuration (e.g. color of the Region). |
Reimplemented from rdf::Region.
|
overridevirtual |
Reads a TextRegion from the XML stream. The stream must be at the position of the TextRegion's tag and is forwarded until its end
reader | The XML stream. |
Reimplemented from rdf::Region.
void rdf::TextRegion::setText | ( | const QString & | text | ) |
Set the GT/HTR text of the TextRegion.
text | The text corresponding to the text region. |
QString rdf::TextRegion::text | ( | ) | const |
|
overridevirtual |
Returns a string with all important properties of the TextRegion.
withChildren | if set to true children properties are written too. |
Reimplemented from rdf::Region.
|
overridevirtual |
Writes the TextRegion instance to the XML stream.
writer | The XML stream. |
Reimplemented from rdf::Region.
|
protected |