QCAD Application Framework
CAD Application Development and Automation.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RTextData Class Reference

Stores and manages all data that defines the geometry and appearance of a text entity. More...

#include <RTextData.h>

Inheritance diagram for RTextData:
REntityData RPainterPathSource

List of all members.

Public Member Functions

bool flipHorizontal ()
bool flipVertical ()
RVector getAlignmentPoint () const
double getAngle () const
virtual RBox getBoundingBox () const
virtual RVector getClosestPointOnEntity (const RVector &point, double range, bool limited) const
virtual double getDistanceTo (const RVector &point, bool limited=true, double range=0.0, bool draft=false) const
QString getEscapedText () const
virtual QList< QSharedPointer
< RShape > > 
getExploded () const
QString getFontName () const
RS::HAlign getHAlign () const
double getHeight () const
 Height of the text (this is not equal to the bounding box height as it is the height of the text at 0 angle).
double getLineSpacingFactor () const
QFont getMainFont () const
virtual QList< RPainterPathgetPainterPaths (bool draft=false) const
QString getPlainText () const
virtual RVector getPointOnEntity () const
RVector getPosition () const
virtual QList< RVectorgetReferencePoints (RS::ProjectionRenderingHint hint=RS::RenderTop) const
virtual QList< QSharedPointer
< RShape > > 
getShapes (const RBox &queryBox=RDEFAULT_RBOX) const
double getTextHeight () const
double getTextWidth () const
 Width of the text box used for line wrapping (not supported).
RS::VAlign getVAlign () const
double getWidth () const
 Width of the text (this is not equal to the bounding box width as it is the width of the text at 0 angle).
virtual bool intersectsWith (const RShape &shape) const
bool isBold () const
bool isDirty () const
bool isItalic () const
bool isSimple () const
bool mirror (const RLine &axis)
bool move (const RVector &offset)
 Moves this entity by the given offset.
virtual bool moveReferencePoint (const RVector &referencePoint, const RVector &targetPoint)
 Moves the given reference point to the given target point or does nothing if this entity has no reference point as the given location.
bool rotate (double rotation, const RVector &center)
 RTextData ()
 RTextData (const RVector &position, const RVector &alignmentPoint, double textHeight, double textWidth, RS::VAlign verticalAlignment, RS::HAlign horizontalAlignment, RS::TextDrawingDirection drawingDirection, RS::TextLineSpacingStyle lineSpacingStyle, double lineSpacingFactor, const QString &text, const QString &fontName, bool bold, bool italic, double angle, bool simple)
bool scale (const RVector &scaleFactors, const RVector &center)
void setAlignmentPoint (const RVector &alignmentPoint)
void setAngle (double angle)
void setBold (bool on)
void setDrawingDirection (RS::TextDrawingDirection drawingDirection)
void setFontName (const QString &fontName)
void setHAlign (RS::HAlign halign)
void setItalic (bool on)
void setLineSpacingFactor (double lineSpacingFactor)
void setLineSpacingStyle (RS::TextLineSpacingStyle lineSpacingStyle)
void setPosition (const RVector &position)
void setSimple (bool on)
void setText (const QString &text)
void setTextHeight (double h)
void setTextWidth (double w)
void setVAlign (RS::VAlign valign)
virtual void update () const
 Entities can reimplement this function to invalidate any internal cache (mark the entity as dirty).
- Public Member Functions inherited from REntityData
virtual const RShapecastToConstShape () const
virtual RShapecastToShape ()
RLayer::Id getBlockId () const
QString getBlockName () const
virtual QList< RBoxgetBoundingBoxes () const
virtual QList< RVectorgetCenterPoints (const RBox &queryBox=RDEFAULT_RBOX) const
virtual QSharedPointer< RShapegetClosestShape (const RVector &pos, double range=RNANDOUBLE) const
RColor getColor () const
RColor getColor (bool resolve, const QStack< RBlockReferenceEntity * > &blockRefStack) const
RDocumentgetDocument ()
const RDocumentgetDocument () const
virtual int getDrawOrder () const
virtual QList< RVectorgetEndPoints (const RBox &queryBox=RDEFAULT_RBOX) const
virtual QList< RVectorgetIntersectionPoints (const REntityData &other, bool limited=true, bool same=false, const RBox &queryBox=RDEFAULT_RBOX) const
virtual QList< RVectorgetIntersectionPoints (const RShape &shape, bool limited=true, const RBox &queryBox=RDEFAULT_RBOX) const
RLayer::Id getLayerId () const
QString getLayerName ()
RLinetype::Id getLinetypeId () const
RLinetype::Id getLinetypeId (bool resolve, const QStack< RBlockReferenceEntity * > &blockRefStack) const
RLineweight::Lineweight getLineweight () const
RLineweight::Lineweight getLineweight (bool resolve, const QStack< RBlockReferenceEntity * > &blockRefStack) const
double getLineweightInUnits (const QStack< RBlockReferenceEntity * > &blockRefStack) const
virtual QList< RVectorgetMiddlePoints (const RBox &queryBox=RDEFAULT_RBOX) const
virtual QList< RVectorgetPointsWithDistanceToEnd (double distance, RS::From from=RS::FromAny, const RBox &queryBox=RDEFAULT_RBOX) const
virtual RVector getVectorTo (const RVector &point, bool limited=true) const
virtual bool isInside (const RBox &box) const
virtual bool isOnEntity (const RVector &point, bool limited=true) const
virtual bool isSelected () const
virtual bool mirror (const RVector &axis1, const RVector &axis2)
 REntityData (RDocument *document=NULL)
virtual bool scale (double scaleFactor, const RVector &center=RDEFAULT_RVECTOR)
virtual void setBlockId (RBlock::Id blockId)
void setColor (const RColor &color)
void setDocument (RDocument *document)
virtual void setDrawOrder (int drawOrder)
 Sets the draw order of this entity.
virtual void setLayerId (RLayer::Id layerId)
virtual void setLinetype (RLinetype linetype)
virtual void setLinetypeId (RLinetype::Id linetypeId)
void setLineweight (RLineweight::Lineweight lineweight)
virtual void setSelected (bool on)
 Selects or deselects this entity.
virtual bool stretch (const RPolyline &area, const RVector &offset)
 Stretches the end points of this entity that are inside area by offset.
virtual ~REntityData ()
- Public Member Functions inherited from RPainterPathSource
virtual ~RPainterPathSource ()

Static Public Member Functions

static QString toEscapedText (const QTextDocument &textDocument, const RColor &initialColor, double fontHeightFactor=1.0)
 Converts the given text document (typically from a QTextEdit) into CAD escaped text.
static QString toRichText (const QString &escapedText, const QFont &mainFont, double fontHeightFactor=1.0)

Protected Member Functions

 RTextData (RDocument *document, const RTextData &data)

Private Attributes

RVector alignmentPoint
double angle
bool bold
RBox boundingBox
bool dirty
RS::TextDrawingDirection drawingDirection
QString fontName
bool gotDraft
double height
RS::HAlign horizontalAlignment
bool italic
double lineSpacingFactor
RS::TextLineSpacingStyle lineSpacingStyle
QList< RPainterPathpainterPaths
RVector position
bool simple
QString text
double textHeight
double textWidth
RS::VAlign verticalAlignment
double width

Friends

QDebug operator<< (QDebug dbg, const RTextData &t)
class RTextEntity

Additional Inherited Members

- Protected Attributes inherited from REntityData
RBlock::Id blockId
RColor color
RDocumentdocument
int drawOrder
RLayer::Id layerId
RLinetype::Id linetypeId
RLineweight::Lineweight lineweight
bool selectionStatus

Detailed Description

Stores and manages all data that defines the geometry and appearance of a text entity.

Scriptable:
This class is wrapped for script environments.
Shared Pointer Support:
Script wrappers of this class support wrapping in QSharedPointer.
Copyable:
Script wrappers of this class should pass objects by reference.

Constructor & Destructor Documentation

RTextData::RTextData ( RDocument document,
const RTextData data 
)
protected
RTextData::RTextData ( )
RTextData::RTextData ( const RVector position,
const RVector alignmentPoint,
double  height,
double  textWidth,
RS::VAlign  valign,
RS::HAlign  halign,
RS::TextDrawingDirection  drawingDirection,
RS::TextLineSpacingStyle  lineSpacingStyle,
double  lineSpacingFactor,
const QString &  text,
const QString &  fontName,
bool  bold,
bool  italic,
double  angle,
bool  simple 
)
Parameters:
positionInsertion point (see DXF code 10 doc).
alignmentPointAlignement point of text (see DXF code 11 doc).
heightNominal (initial) text height
textWidthReference rectangle width for wrapping (not supported)
valignVertical alignment
halignHorizontal alignment
drawingDirectionDrawing direction
lineSpacingStyleLine spacing style
lineSpacingFactorLine spacing factor
textText string
fontNameText font name
angleRotation angle in rad

Member Function Documentation

bool RTextData::flipHorizontal ( )
virtual

Reimplemented from REntityData.

bool RTextData::flipVertical ( )
virtual

Reimplemented from REntityData.

RVector RTextData::getAlignmentPoint ( ) const
inline
double RTextData::getAngle ( ) const
inline
RBox RTextData::getBoundingBox ( ) const
virtual
Returns:
The bounding box that contains this entity.

Reimplemented from REntityData.

RVector RTextData::getClosestPointOnEntity ( const RVector point,
double  range,
bool  limited 
) const
virtual
Returns:
Closest point to point on this entity. Used for snap to points on entity.

Reimplemented from REntityData.

double RTextData::getDistanceTo ( const RVector point,
bool  limited = true,
double  range = 0.0,
bool  draft = false 
) const
virtual
Returns:
The shortest distance from this entity to the given point.

Reimplemented from REntityData.

QString RTextData::getEscapedText ( ) const
QList< QSharedPointer< RShape > > RTextData::getExploded ( ) const
virtual
QString RTextData::getFontName ( ) const
inline
RS::HAlign RTextData::getHAlign ( ) const
inline
double RTextData::getHeight ( ) const

Height of the text (this is not equal to the bounding box height as it is the height of the text at 0 angle).

double RTextData::getLineSpacingFactor ( ) const
inline
QFont RTextData::getMainFont ( ) const
QList< RPainterPath > RTextData::getPainterPaths ( bool  draft = false) const
virtual

Implements RPainterPathSource.

QString RTextData::getPlainText ( ) const
RVector RTextData::getPointOnEntity ( ) const
virtual
Returns:
A point that is on the entity. Used to check if an entity is inside a polygon.

Reimplemented from REntityData.

RVector RTextData::getPosition ( ) const
inline
QList< RVector > RTextData::getReferencePoints ( RS::ProjectionRenderingHint  hint = RS::RenderTop) const
virtual
Returns:
Vector of reference points of this entity. Reference points can usually be moved around by the user to change the geometry of the entity.

Implements REntityData.

QList< QSharedPointer< RShape > > RTextData::getShapes ( const RBox queryBox = RDEFAULT_RBOX) const
virtual
Returns:
Shapes that represent the geometry of this entity.

Reimplemented from REntityData.

double RTextData::getTextHeight ( ) const
inline
double RTextData::getTextWidth ( ) const
inline

Width of the text box used for line wrapping (not supported).

RS::VAlign RTextData::getVAlign ( ) const
inline
double RTextData::getWidth ( ) const

Width of the text (this is not equal to the bounding box width as it is the width of the text at 0 angle).

bool RTextData::intersectsWith ( const RShape shape) const
virtual
Returns:
True if this entity intersects with the given shape, false otherwise.
Todo:
better to pass another entity data object?

Reimplemented from REntityData.

bool RTextData::isBold ( ) const
inline
bool RTextData::isDirty ( ) const
bool RTextData::isItalic ( ) const
inline
bool RTextData::isSimple ( ) const
inline
bool RTextData::mirror ( const RLine axis)
virtual

Reimplemented from REntityData.

bool RTextData::move ( const RVector offset)
virtual

Moves this entity by the given offset.

Returns:
Points on entity which are intersection points in the given document.
True if this entity intersects with the given box or is completely inside it, false otherwise.

Reimplemented from REntityData.

bool RTextData::moveReferencePoint ( const RVector referencePoint,
const RVector targetPoint 
)
virtual

Moves the given reference point to the given target point or does nothing if this entity has no reference point as the given location.

Returns:
True if a reference point has been moved successfully, false otherwise.

Implements REntityData.

bool RTextData::rotate ( double  rotation,
const RVector center 
)
virtual

Reimplemented from REntityData.

bool RTextData::scale ( const RVector scaleFactors,
const RVector center 
)
virtual

Reimplemented from REntityData.

void RTextData::setAlignmentPoint ( const RVector alignmentPoint)
inline
void RTextData::setAngle ( double  angle)
inline
void RTextData::setBold ( bool  on)
inline
void RTextData::setDrawingDirection ( RS::TextDrawingDirection  drawingDirection)
inline
void RTextData::setFontName ( const QString &  fontName)
inline
void RTextData::setHAlign ( RS::HAlign  halign)
inline
void RTextData::setItalic ( bool  on)
inline
void RTextData::setLineSpacingFactor ( double  lineSpacingFactor)
inline
void RTextData::setLineSpacingStyle ( RS::TextLineSpacingStyle  lineSpacingStyle)
inline
void RTextData::setPosition ( const RVector position)
inline
void RTextData::setSimple ( bool  on)
inline
void RTextData::setText ( const QString &  text)
void RTextData::setTextHeight ( double  h)
inline
void RTextData::setTextWidth ( double  w)
inline
void RTextData::setVAlign ( RS::VAlign  valign)
inline
QString RTextData::toEscapedText ( const QTextDocument &  textDocument,
const RColor initialColor,
double  fontHeightFactor = 1.0 
)
static

Converts the given text document (typically from a QTextEdit) into CAD escaped text.

Parameters:
fontHeightFactorfactor applied to all font heights. This allows the text edit to use a bigger / smaller font that needed in the end.
QString RTextData::toRichText ( const QString &  escapedText,
const QFont &  mainFont,
double  fontHeightFactor = 1.0 
)
static
Returns:
HTML representing this text.
void RTextData::update ( ) const
virtual

Entities can reimplement this function to invalidate any internal cache (mark the entity as dirty).

Reimplemented from REntityData.


Friends And Related Function Documentation

QDebug operator<< ( QDebug  dbg,
const RTextData t 
)
friend
   \par Non-Scriptable:

This function is not available in script environments.

HTML helper function.

HTML helper function.

HTML helper function.

HTML helper function.

HTML helper function.

HTML helper function.

HTML helper function.

HTML helper function.

friend class RTextEntity
friend

Member Data Documentation

RVector RTextData::alignmentPoint
private
double RTextData::angle
private
bool RTextData::bold
private
RBox RTextData::boundingBox
mutableprivate
bool RTextData::dirty
mutableprivate
RS::TextDrawingDirection RTextData::drawingDirection
private
QString RTextData::fontName
private
bool RTextData::gotDraft
mutableprivate
double RTextData::height
mutableprivate
RS::HAlign RTextData::horizontalAlignment
private
bool RTextData::italic
private
double RTextData::lineSpacingFactor
private
RS::TextLineSpacingStyle RTextData::lineSpacingStyle
private
QList<RPainterPath> RTextData::painterPaths
mutableprivate
RVector RTextData::position
private
bool RTextData::simple
private
QString RTextData::text
private
double RTextData::textHeight
private
double RTextData::textWidth
private
RS::VAlign RTextData::verticalAlignment
private
double RTextData::width
mutableprivate

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