ReadFramework
|
#include <Elements.h>
Public Types | |
enum | Type { type_unknown = 0, type_root, type_text_region, type_text_line, type_word, type_separator, type_image, type_graphic, type_chart, type_noise, type_end } |
Public Member Functions | |
Region (const Type &type=Type::type_unknown) | |
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... | |
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 | addChild (QSharedPointer< Region > child) |
Adds a child to the current Region. More... | |
void | addUniqueChild (QSharedPointer< Region > child) |
void | removeChild (QSharedPointer< Region > child) |
Removes the child specified. More... | |
void | setChildren (const QVector< QSharedPointer< Region > > &children) |
Sets the child regions. More... | |
QVector< QSharedPointer< Region > > | children () const |
Children of this instance. More... | |
virtual void | draw (QPainter &p, const RegionTypeConfig &config) const |
Draws the Region to the Painter. More... | |
virtual QString | toString (bool withChildren=false) const |
Returns a string discribing the Region. More... | |
virtual QString | childrenToString () const |
Returns a string with all attributes of the Region's children. More... | |
virtual bool | read (QXmlStreamReader &reader) |
Adds Attributes to the current region. More... | |
virtual void | write (QXmlStreamWriter &writer, bool withChildren=true, bool close=true) const |
Writes the Region to the XML stream. More... | |
virtual void | writeChildren (QXmlStreamWriter &writer) const |
Writes the Region's children to the XML stream. More... | |
virtual bool | operator== (const Region &r1) |
Static Public Member Functions | |
static QVector< QSharedPointer < Region > > | allRegions (QSharedPointer< Region > root) |
static QVector< QSharedPointer < Region > > | filter (QSharedPointer< Region > root, const Region::Type &type) |
Protected Member Functions | |
void | collectRegions (QVector< QSharedPointer< Region > > &allRegions, const Region::Type &type=type_unknown) const |
virtual bool | readPoints (QXmlStreamReader &reader) |
Protected Attributes | |
Type | mType = Type::type_unknown |
bool | mSelected = false |
QString | mId |
QString | mCustom |
Polygon | mPoly |
QVector< QSharedPointer< Region > > | mChildren |
Friends | |
DllCoreExport QDataStream & | operator<< (QDataStream &s, const Region &r) |
Writes the Region r to the data stream s More... | |
DllCoreExport QDebug | operator<< (QDebug d, const Region &r) |
Prints the Region r to the debug output. More... | |
enum rdf::Region::Type |
rdf::Region::Region | ( | const Type & | type = Type::type_unknown | ) |
void rdf::Region::addChild | ( | QSharedPointer< Region > | child | ) |
Adds a child to the current Region.
child | The child region. |
void rdf::Region::addUniqueChild | ( | QSharedPointer< Region > | child | ) |
QVector< QSharedPointer< Region > > rdf::Region::children | ( | ) | const |
Children of this instance.
|
virtual |
Returns a string with all attributes of the Region's children.
|
protected |
QString rdf::Region::custom | ( | ) | const |
|
virtual |
Draws the Region to the Painter.
p | The painter. |
config | The configuration containing colors etc. |
Reimplemented in rdf::TextLine.
|
static |
QString rdf::Region::id | ( | ) | const |
Returns the Region's unique identifier.
|
virtual |
Reimplemented in rdf::SeparatorRegion.
|
virtual |
Adds Attributes to the current region.
reader | XML reader set to the current line (inside a region type). |
Reimplemented in rdf::TextLine.
|
protectedvirtual |
void rdf::Region::removeChild | ( | QSharedPointer< Region > | child | ) |
Removes the child specified.
child | The child region. |
bool rdf::Region::selected | ( | ) | const |
void rdf::Region::setChildren | ( | const QVector< QSharedPointer< Region > > & | children | ) |
Sets the child regions.
children | The child regions. |
void rdf::Region::setCustom | ( | const QString & | c | ) |
void rdf::Region::setId | ( | const QString & | id | ) |
Set a unique identifier to the region.
id | A unique identifier. |
void rdf::Region::setPolygon | ( | const Polygon & | polygon | ) |
void rdf::Region::setSelected | ( | bool | select | ) |
void rdf::Region::setType | ( | const Region::Type & | type | ) |
Sets the Region type.
type | The type. |
|
virtual |
Region::Type rdf::Region::type | ( | ) | const |
The Region's type (e.g. type_text_region).
|
virtual |
Writes the Region to the XML stream.
writer | The XML stream at the position where the region should be written. |
withChildren | if set to true the Region's children are written too. |
close | if set to true the element's close tag is appended. |
Reimplemented in rdf::TextLine.
|
virtual |
Writes the Region's children to the XML stream.
writer | The XML stream. |
|
friend |
Writes the Region r to the data stream s
s | A data stream. |
r | A region r. |
|
friend |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |