ReadFramework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
rdf::TextLine Class Reference

#include <Elements.h>

Inheritance diagram for rdf::TextLine:
Collaboration diagram for rdf::TextLine:

Public Member Functions

 TextLine (const Type &type=Type::type_unknown)
 Initializes a new instance of the TextLine class. This class represents Text lines (Region::type_text_line). More...
 
void setBaseLine (const BaseLine &baseLine)
 Set the BaseLine. More...
 
BaseLine baseLine () const
 Returns the Textline's Baseline. More...
 
void setText (const QString &text)
 Set the GT/HTR text of the TextLine. More...
 
QString text () const
 GT/HTR Text of the Textline. More...
 
virtual bool read (QXmlStreamReader &reader) override
 Reads a Textline from the XML stream. The stream must be at the position of the Textline's tag and is forwarded until its end More...
 
virtual void write (QXmlStreamWriter &writer, bool withChildren=true, bool close=true) const override
 Writes the TextLine instance to the XML stream. More...
 
virtual QString toString (bool withChildren=false) const override
 Returns a string with all important properties of the TextLine. More...
 
virtual void draw (QPainter &p, const RegionTypeConfig &config) const override
 Draws the TextLine to the Painter. More...
 
- Public Member Functions inherited from rdf::Region
 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 QString childrenToString () const
 Returns a string with all attributes of the Region's children. More...
 
virtual void writeChildren (QXmlStreamWriter &writer) const
 Writes the Region's children to the XML stream. More...
 
virtual bool operator== (const Region &r1)
 

Protected Attributes

BaseLine mBaseLine
 
QString mText
 
bool mTextPresent = false
 
- 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_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 > > 
allRegions (QSharedPointer< Region > root)
 
static QVector< QSharedPointer
< Region > > 
filter (QSharedPointer< 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)
 

Constructor & Destructor Documentation

rdf::TextLine::TextLine ( const Type type = Type::type_unknown)

Initializes a new instance of the TextLine class. This class represents Text lines (Region::type_text_line).

Member Function Documentation

BaseLine rdf::TextLine::baseLine ( ) const

Returns the Textline's Baseline.

Returns
void rdf::TextLine::draw ( QPainter &  p,
const RegionTypeConfig config 
) const
overridevirtual

Draws the TextLine to the Painter.

Parameters
pThe painter.
configThe configuration (e.g. color of the Region).

Reimplemented from rdf::Region.

bool rdf::TextLine::read ( QXmlStreamReader &  reader)
overridevirtual

Reads a Textline from the XML stream. The stream must be at the position of the Textline's tag and is forwarded until its end

Parameters
readerThe XML stream.
Returns
true on success

Reimplemented from rdf::Region.

void rdf::TextLine::setBaseLine ( const BaseLine baseLine)

Set the BaseLine.

Parameters
baseLineThe Textline's base line.
void rdf::TextLine::setText ( const QString &  text)

Set the GT/HTR text of the TextLine.

Parameters
textThe text corresponding to the textline.
QString rdf::TextLine::text ( ) const

GT/HTR Text of the Textline.

Returns
QString rdf::TextLine::toString ( bool  withChildren = false) const
overridevirtual

Returns a string with all important properties of the TextLine.

Parameters
withChildrenif set to true children properties are written too.
Returns

Reimplemented from rdf::Region.

void rdf::TextLine::write ( QXmlStreamWriter &  writer,
bool  withChildren = true,
bool  close = true 
) const
overridevirtual

Writes the TextLine instance to the XML stream.

Parameters
writerThe XML stream.
withChildrenif set to true the TextLine's children are written to the XML.
closeif set to true the TextLine's end element is written.

Reimplemented from rdf::Region.

Member Data Documentation

BaseLine rdf::TextLine::mBaseLine
protected
QString rdf::TextLine::mText
protected
bool rdf::TextLine::mTextPresent = false
protected

The documentation for this class was generated from the following files: