QCAD
Open Source 2D CAD
RHatchData Class Reference

Copyright (c) 2011-2018 by Andrew Mustun. More...

#include <RHatchData.h>

Inheritance diagram for RHatchData:
REntityData RPainterPathSource

Public Member Functions

void addBoundary (QSharedPointer< RShape > shape, bool addAutoLoops=true)
 Add a boundary shape to the current loop. More...
 
void cancelLoop ()
 
virtual RShapecastToShape ()
 
void clearBoundary ()
 
void clearCustomPattern ()
 
virtual bool cloneOnChange () const
 Reimplement to force clone on change in transactions. More...
 
double getAngle () const
 
QList< QList< QSharedPointer< RShape > > > getBoundary () const
 
QList< RPolylinegetBoundaryAsPolylines (double segmentLength) const
 
QPair< QSharedPointer< RShape >, QSharedPointer< RShape > > getBoundaryElementsAt (int index, int &internalIndex) const
 
RPainterPath getBoundaryPath (double pixelSizeHint=RDEFAULT_MIN1) const
 
virtual RBox getBoundingBox (bool ignoreEmpty=false) const
 
virtual RColor getColor () const
 
virtual RColor getColor (bool resolve, const QStack< REntity * > &blockRefStack) const
 
virtual RColor getColor (const RColor &unresolvedColor, const QStack< REntity * > &blockRefStack) const
 
int getComplexity () const
 
RPattern getCustomPattern () const
 
virtual double getDistanceTo (const RVector &point, bool limited=true, double range=0.0, bool draft=false, double strictRange=RMAXDOUBLE) const
 
virtual QList< QSharedPointer< RShape > > getExploded () const
 
QList< QSharedPointer< RShape > > getLoopBoundary (int index) const
 
int getLoopCount () const
 
RVector getOriginPoint () const
 
virtual QList< RPainterPathgetPainterPaths (bool draft=false, double pixelSizeHint=RDEFAULT_MIN1) const
 
QString getPatternName () const
 
virtual RVector getPointOnEntity () const
 
virtual QList< RRefPointgetReferencePoints (RS::ProjectionRenderingHint hint=RS::RenderTop) const
 
double getScale () const
 
virtual QList< QSharedPointer< RShape > > getShapes (const RBox &queryBox=RDEFAULT_RBOX, bool ignoreComplex=false, bool segment=false) const
 
int getTransparency () const
 
virtual RS::EntityType getType () const
 
bool hasCustomPattern () const
 
virtual bool intersectsWith (const RShape &shape) const
 
bool isSolid () const
 
virtual bool mirror (const RLine &axis)
 
virtual bool move (const RVector &offset)
 Moves this entity by the given offset. More...
 
virtual bool moveReferencePoint (const RVector &referencePoint, const RVector &targetPoint, Qt::KeyboardModifiers modifiers=Qt::NoModifier)
 Moves the given reference point to the given target point or does nothing if this entity has no reference point as the given location. More...
 
void newLoop ()
 
RHatchDataoperator= (const RHatchData &other)
 
bool order ()
 
 RHatchData ()
 
 RHatchData (bool solid, double scaleFactor, double angle, const QString &patternName)
 
 RHatchData (const RHatchData &other)
 
virtual bool rotate (double rotation, const RVector &center=RDEFAULT_RVECTOR)
 
virtual bool scale (const RVector &scaleFactors, const RVector &center=RDEFAULT_RVECTOR)
 
void setAngle (double a)
 
void setCustomPattern (const RPattern &p)
 
void setOriginPoint (const RVector &op, bool clearCustom=true)
 
void setPattern (const RPattern &p)
 
void setPatternName (const QString &n)
 
void setScale (double s)
 
void setSolid (bool on)
 
void setTransparency (int t)
 
virtual bool stretch (const RPolyline &area, const RVector &offset)
 Stretches the end points of this entity that are inside area by offset. More...
 
virtual void update () const
 Entities can reimplement this function to invalidate any internal cache (mark the entity as dirty). More...
 
- Public Member Functions inherited from REntityData
virtual const RShapecastToConstShape () const
 
virtual bool clickReferencePoint (const RVector &referencePoint)
 Called when user clicks a reference point. More...
 
void copyAttributesFrom (const REntityData &entityData, bool copyBlockId=true)
 
virtual bool flipHorizontal ()
 
virtual bool flipVertical ()
 
virtual QList< RVectorgetArcReferencePoints (const RBox &queryBox=RDEFAULT_RBOX) const
 
RBlock::Id getBlockId () const
 
QString getBlockName () const
 
virtual QList< RBoxgetBoundingBoxes (bool ignoreEmpty=false) const
 
virtual QList< RVectorgetCenterPoints (const RBox &queryBox=RDEFAULT_RBOX) const
 
virtual RVector getClosestPointOnEntity (const RVector &point, double range=RNANDOUBLE, bool limited=true) const
 
virtual QSharedPointer< RShapegetClosestShape (const RVector &pos, double range=RNANDOUBLE, bool ignoreComplex=false) const
 
virtual RColor getDisplayColor ()
 
RDocumentgetDocument ()
 
const RDocumentgetDocument () const
 
virtual int getDrawOrder () const
 
virtual QList< RVectorgetEndPoints (const RBox &queryBox=RDEFAULT_RBOX) const
 
virtual RPolyline getHull (double offset) const
 
virtual QList< RRefPointgetInternalReferencePoints (RS::ProjectionRenderingHint hint=RS::RenderTop) const
 Can be overwritten to return internal, resolved reference points. More...
 
virtual QList< RVectorgetIntersectionPoints (const REntityData &other, bool limited=true, bool same=false, const RBox &queryBox=RDEFAULT_RBOX, bool ignoreComplex=true) const
 
virtual QList< RVectorgetIntersectionPoints (const RShape &shape, bool limited=true, const RBox &queryBox=RDEFAULT_RBOX, bool ignoreComplex=true) const
 
RLayer::Id getLayerId () const
 
QString getLayerName () const
 
virtual RLinetype::Id getLinetypeId () const
 
virtual RLinetype::Id getLinetypeId (bool resolve, const QStack< REntity * > &blockRefStack) const
 
virtual RLinetypePattern getLinetypePattern () const
 
virtual double getLinetypeScale () const
 
virtual RLineweight::Lineweight getLineweight () const
 
virtual RLineweight::Lineweight getLineweight (bool resolve, const QStack< REntity * > &blockRefStack) const
 
double getLineweightInUnits (const QStack< REntity * > &blockRefStack) const
 
virtual QList< RVectorgetMiddlePoints (const RBox &queryBox=RDEFAULT_RBOX) const
 
RObject::Id getParentId () const
 
virtual QList< RVectorgetPointsWithDistanceToEnd (double distance, int from=RS::FromAny, const RBox &queryBox=RDEFAULT_RBOX) const
 
virtual RVector getVectorTo (const RVector &point, bool limited=true, double strictRange=RMAXDOUBLE) const
 
virtual bool isInside (const RBox &box) const
 
virtual bool isOnEntity (const RVector &point, bool limited=true, double tolerance=RDEFAULT_TOLERANCE_1E_MIN4) const
 
virtual bool isPointType () const
 
virtual bool isSane () const
 
virtual bool isSelected () const
 
virtual bool isSelectedWorkingSet () const
 
virtual bool isUpdatesEnabled () const
 
virtual bool isValid () const
 
virtual bool mirror (const RVector &axis1, const RVector &axis2)
 
 REntityData (RDocument *document=NULL)
 Copyright (c) 2011-2018 by Andrew Mustun. More...
 
virtual bool scale (double scaleFactor, const RVector &center=RDEFAULT_RVECTOR)
 
virtual void scaleVisualProperties (double scaleFactor)
 
void setAutoUpdatesBlocked (bool on)
 
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. More...
 
virtual void setLayerId (RLayer::Id layerId)
 
void setLayerName (const QString &layerName)
 
virtual void setLinetypeId (RLinetype::Id linetypeId)
 Sets the linetype of this entity to the given linetype ID. More...
 
virtual void setLinetypePattern (const RLinetypePattern &p)
 
virtual void setLinetypeScale (double linetypeScale)
 
void setLineweight (RLineweight::Lineweight lineweight)
 
virtual void setParentId (RObject::Id parentId)
 
virtual void setSelected (bool on)
 Selects or deselects this entity. More...
 
virtual void setSelectedWorkingSet (bool on)
 Selects or deselects this entity for addition to the current working set. More...
 
void setUpdatesEnabled (bool on)
 Enables / disables cache updates. More...
 
virtual void setZ (double z)
 
virtual void to2D ()
 
virtual ~REntityData ()
 
- Public Member Functions inherited from RPainterPathSource
virtual ~RPainterPathSource ()
 

Static Public Member Functions

static RHatchProxygetHatchProxy ()
 
static bool hasProxy ()
 
static void setHatchProxy (RHatchProxy *p)
 
- Static Public Member Functions inherited from REntityData
static int getDefaultDrawOrder ()
 

Protected Member Functions

QList< RLinegetSegments (const RLine &line) const
 
 RHatchData (RDocument *document, const RHatchData &data)
 

Private Attributes

double angle
 
QList< QList< QSharedPointer< RShape > > > boundary
 Hatch boundary, ordered by loops, in strictly defined order. More...
 
RPainterPath boundaryPath
 
bool dirty
 
bool gotDraft
 
double gotPixelSizeHint
 
RVector originPoint
 
QList< RPainterPathpainterPaths
 
RPattern pattern
 Custom pattern loaded from DXF file, not LIN file. More...
 
QString patternName
 
double scaleFactor
 
bool solid
 
int transparency
 

Static Private Attributes

static RHatchProxyhatchProxy = NULL
 Copyright (c) 2011-2018 by Andrew Mustun. More...
 

Friends

class RHatchEntity
 

Additional Inherited Members

- Protected Attributes inherited from REntityData
bool autoUpdatesBlocked
 Block auto updates is true during imports, undo and redo. More...
 
RBlock::Id blockId
 
RColor color
 
RDocumentdocument
 
int drawOrder
 
RLayer::Id layerId
 
RLinetype::Id linetypeId
 
double linetypeScale
 
RLineweight::Lineweight lineweight
 
RObject::Id parentId
 
bool selectionStatus
 
bool selectionStatusWorkingSet
 
bool updatesEnabled
 

Detailed Description

Copyright (c) 2011-2018 by Andrew Mustun.

All rights reserved.

This file is part of the QCAD project.

QCAD is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

QCAD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with QCAD. Stores and manages all data that defines the geometry and appearance of a hatch or solid fill entity.

Scriptable:\nThis class is available in script environments.\n
Copyable:\nObjects are cleaned up automatically by the garbage collector of the script engine.\n

Constructor & Destructor Documentation

◆ RHatchData() [1/4]

RHatchData::RHatchData ( RDocument document,
const RHatchData data 
)
protected

◆ RHatchData() [2/4]

RHatchData::RHatchData ( )

◆ RHatchData() [3/4]

RHatchData::RHatchData ( const RHatchData other)

◆ RHatchData() [4/4]

RHatchData::RHatchData ( bool  solid,
double  scaleFactor,
double  angle,
const QString &  patternName 
)
Parameters
solidTrue for a solid fill, false for a hatch pattern.
scaleFactorScale factor of the hatch pattern.
angleRotation angle of the hatch pattern.
patternNameName of the hatch pattern. "SOLID" for solid fills.

Member Function Documentation

◆ addBoundary()

void RHatchData::addBoundary ( QSharedPointer< RShape shape,
bool  addAutoLoops = true 
)

Add a boundary shape to the current loop.

Parameters
addAutoLoopsTrue: create new loop if boundary does not connect. Otherwise add line segment on the fly (DXF/DWG import).

◆ cancelLoop()

void RHatchData::cancelLoop ( )

◆ castToShape()

virtual RShape* RHatchData::castToShape ( )
inlinevirtual

Reimplemented from REntityData.

◆ clearBoundary()

void RHatchData::clearBoundary ( )

◆ clearCustomPattern()

void RHatchData::clearCustomPattern ( )

◆ cloneOnChange()

virtual bool RHatchData::cloneOnChange ( ) const
inlinevirtual

Reimplement to force clone on change in transactions.

Reimplemented from REntityData.

◆ getAngle()

double RHatchData::getAngle ( ) const
inline

◆ getBoundary()

QList<QList<QSharedPointer<RShape> > > RHatchData::getBoundary ( ) const
inline

◆ getBoundaryAsPolylines()

QList< RPolyline > RHatchData::getBoundaryAsPolylines ( double  segmentLength) const

◆ getBoundaryElementsAt()

QPair< QSharedPointer< RShape >, QSharedPointer< RShape > > RHatchData::getBoundaryElementsAt ( int  index,
int &  internalIndex 
) const
Non-Scriptable:\nThis function is not available in script environments.\n
Returns
Pair of two shapes that connect to the vertex at the given index. The first shape connects with its end point, the second with its start point.

◆ getBoundaryPath()

RPainterPath RHatchData::getBoundaryPath ( double  pixelSizeHint = RDEFAULT_MIN1) const
Returns
Painter path that represents this hatch boundary.

◆ getBoundingBox()

RBox RHatchData::getBoundingBox ( bool  ignoreEmpty = false) const
virtual
Returns
The bounding box that contains this entity.

Reimplemented from REntityData.

◆ getColor() [1/3]

virtual RColor RHatchData::getColor ( ) const
inlinevirtual

Reimplemented from REntityData.

◆ getColor() [2/3]

virtual RColor RHatchData::getColor ( bool  resolve,
const QStack< REntity * > &  blockRefStack 
) const
inlinevirtual
Returns
Color of this entity.
Parameters
resolveResolve color if ByLayer or ByBlock.

Reimplemented from REntityData.

◆ getColor() [3/3]

virtual RColor RHatchData::getColor ( const RColor unresolvedColor,
const QStack< REntity * > &  blockRefStack 
) const
inlinevirtual

Reimplemented from REntityData.

◆ getComplexity()

int RHatchData::getComplexity ( ) const

◆ getCustomPattern()

RPattern RHatchData::getCustomPattern ( ) const
inline

◆ getDistanceTo()

double RHatchData::getDistanceTo ( const RVector point,
bool  limited = true,
double  range = 0.0,
bool  draft = false,
double  strictRange = RMAXDOUBLE 
) const
virtual
Returns
The shortest distance from this entity to the given point.
Parameters
limitedLimit lines, arcs at end points, otherwise the orthogonal distance to the unlimited line / circle is returned.
rangeThis is returned for solid filled entities (solid filled or dense hatches, text entities) if the point is on the entity and the distance would be zero.
draftCalculate based on draft mode representation of the entity.
strictRangeIf limited, this is the maximum range from either end point of the entity. Zero to only return distances that are strictly orthogonal to the entity.

Reimplemented from REntityData.

◆ getExploded()

QList< QSharedPointer< RShape > > RHatchData::getExploded ( ) const
virtual

◆ getHatchProxy()

static RHatchProxy* RHatchData::getHatchProxy ( )
inlinestatic
Non-Scriptable:\nThis function is not available in script environments.\n

◆ getLoopBoundary()

QList< QSharedPointer< RShape > > RHatchData::getLoopBoundary ( int  index) const

◆ getLoopCount()

int RHatchData::getLoopCount ( ) const
inline

◆ getOriginPoint()

RVector RHatchData::getOriginPoint ( ) const
inline

◆ getPainterPaths()

QList< RPainterPath > RHatchData::getPainterPaths ( bool  draft = false,
double  pixelSizeHint = RDEFAULT_MIN1 
) const
virtual
Parameters
pixelSizeHintPixel size hint for rendering arcs. Negative if it does not matter (current cached painter paths are returned).

Implements RPainterPathSource.

◆ getPatternName()

QString RHatchData::getPatternName ( ) const
inline

◆ getPointOnEntity()

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

Reimplemented from REntityData.

◆ getReferencePoints()

QList< RRefPoint > RHatchData::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.

◆ getScale()

double RHatchData::getScale ( ) const
inline

◆ getSegments()

QList< RLine > RHatchData::getSegments ( const RLine line) const
protected

◆ getShapes()

QList< QSharedPointer< RShape > > RHatchData::getShapes ( const RBox queryBox = RDEFAULT_RBOX,
bool  ignoreComplex = false,
bool  segment = false 
) const
virtual
Returns
Shapes that represent the geometry of this entity.
Parameters
queryBoxLimit returned shapes to query box
ignoreComplexIgnore complex shapes and explode those into simple shapes
segmentSplit up splines into spline segments

Reimplemented from REntityData.

◆ getTransparency()

int RHatchData::getTransparency ( ) const
inline

◆ getType()

virtual RS::EntityType RHatchData::getType ( ) const
inlinevirtual

Reimplemented from REntityData.

◆ hasCustomPattern()

bool RHatchData::hasCustomPattern ( ) const
inline

◆ hasProxy()

static bool RHatchData::hasProxy ( )
inlinestatic

◆ intersectsWith()

bool RHatchData::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.

◆ isSolid()

bool RHatchData::isSolid ( ) const
inline

◆ mirror()

bool RHatchData::mirror ( const RLine axis)
virtual

Reimplemented from REntityData.

◆ move()

bool RHatchData::move ( const RVector offset)
virtual

Moves this entity by the given offset.

Reimplemented from REntityData.

◆ moveReferencePoint()

bool RHatchData::moveReferencePoint ( const RVector referencePoint,
const RVector targetPoint,
Qt::KeyboardModifiers  modifiers = Qt::NoModifier 
)
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.

◆ newLoop()

void RHatchData::newLoop ( )

◆ operator=()

RHatchData & RHatchData::operator= ( const RHatchData other)

◆ order()

bool RHatchData::order ( )

◆ rotate()

bool RHatchData::rotate ( double  rotation,
const RVector center = RDEFAULT_RVECTOR 
)
virtual

Reimplemented from REntityData.

◆ scale()

bool RHatchData::scale ( const RVector scaleFactors,
const RVector center = RDEFAULT_RVECTOR 
)
virtual

Reimplemented from REntityData.

◆ setAngle()

void RHatchData::setAngle ( double  a)
inline

◆ setCustomPattern()

void RHatchData::setCustomPattern ( const RPattern p)
inline

◆ setHatchProxy()

static void RHatchData::setHatchProxy ( RHatchProxy p)
inlinestatic
Non-Scriptable:\nThis function is not available in script environments.\n

◆ setOriginPoint()

void RHatchData::setOriginPoint ( const RVector op,
bool  clearCustom = true 
)
inline

◆ setPattern()

void RHatchData::setPattern ( const RPattern p)
inline

◆ setPatternName()

void RHatchData::setPatternName ( const QString &  n)
inline

◆ setScale()

void RHatchData::setScale ( double  s)
inline

◆ setSolid()

void RHatchData::setSolid ( bool  on)
inline

◆ setTransparency()

void RHatchData::setTransparency ( int  t)
inline

◆ stretch()

bool RHatchData::stretch ( const RPolyline area,
const RVector offset 
)
virtual

Stretches the end points of this entity that are inside area by offset.

Reimplemented from REntityData.

◆ update()

void RHatchData::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

◆ RHatchEntity

friend class RHatchEntity
friend

Member Data Documentation

◆ angle

double RHatchData::angle
private

◆ boundary

QList<QList<QSharedPointer<RShape> > > RHatchData::boundary
private

Hatch boundary, ordered by loops, in strictly defined order.

◆ boundaryPath

RPainterPath RHatchData::boundaryPath
mutableprivate

◆ dirty

bool RHatchData::dirty
mutableprivate

◆ gotDraft

bool RHatchData::gotDraft
mutableprivate

◆ gotPixelSizeHint

double RHatchData::gotPixelSizeHint
mutableprivate

◆ hatchProxy

RHatchProxy * RHatchData::hatchProxy = NULL
staticprivate

Copyright (c) 2011-2018 by Andrew Mustun.

All rights reserved.

This file is part of the QCAD project.

QCAD is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

QCAD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with QCAD.

◆ originPoint

RVector RHatchData::originPoint
private

◆ painterPaths

QList<RPainterPath> RHatchData::painterPaths
mutableprivate

◆ pattern

RPattern RHatchData::pattern
mutableprivate

Custom pattern loaded from DXF file, not LIN file.

Pattern is stored independent of pattern origin point.

◆ patternName

QString RHatchData::patternName
private

◆ scaleFactor

double RHatchData::scaleFactor
private

◆ solid

bool RHatchData::solid
private

◆ transparency

int RHatchData::transparency
private

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