Skip to content

RViewportData

Class in Core Module
Header: #include <src/core/RViewportData.h>
Inherits: REntityData, RPoint

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

Scriptable: This class is available in script environments.

Copyable: Objects are cleaned up automatically by the garbage collector of the script engine.

enum Status { Off }
RViewportData()
virtual RShape * castToShape()
virtual bool flipHorizontal()
virtual bool flipVertical()
virtual QList< RVector > getArcReferencePoints(const RBox &queryBox=RDEFAULT_RBOX) const
virtual RBox getBoundingBox() const
virtual RBox getBoundingBox(bool ignoreEmpty) const
RVector getCenter() const
virtual QList< RVector > getCenterPoints(const RBox &queryBox=RDEFAULT_RBOX, QList< RObject::Id > *subEntityIds=NULL) const
virtual double getDistanceTo(const RVector &point, bool limited=true, double range=0.0, bool draft=false, double strictRange=RMAXDOUBLE) const
QList< RLine > getEdges() const
virtual QList< RVector > getEndPoints(const RBox &queryBox=RDEFAULT_RBOX, QList< RObject::Id > *subEntityIds=NULL) const
QList< RObject::Id > getFrozenLayerIds() const
double getHeight() const
virtual QList< RRefPoint > getInternalReferencePoints(RS::ProjectionRenderingHint hint=RS::RenderTop, QList< RObject::Id > *subEntityIds=NULL) const
Can be overwritten to return internal, resolved reference points.
virtual QList< RVector > getIntersectionPoints(const REntityData &other, bool limited=true, bool same=false, const RBox &queryBox=RDEFAULT_RBOX, bool ignoreComplex=true, QList< QPair< RObject::Id, RObject::Id > > *entityIds=NULL) const
virtual QList< RVector > getIntersectionPoints(const RShape &shape, bool limited=true, const RBox &queryBox=RDEFAULT_RBOX, bool ignoreComplex=true) const
virtual QList< RVector > getMiddlePoints(const RBox &queryBox=RDEFAULT_RBOX, QList< RObject::Id > *subEntityIds=NULL) const
virtual QList< RVector > getPointsWithDistanceToEnd(double distance, int from=RS::FromAny, const RBox &queryBox=RDEFAULT_RBOX, QList< RObject::Id > *subEntityIds=NULL) const
virtual QList< RRefPoint > getReferencePoints(RS::ProjectionRenderingHint hint=RS::RenderTop) const
double getRotation() const
double getScale() const
virtual QList< QSharedPointer< RShape > > getShapes(const RBox &queryBox=RDEFAULT_RBOX, bool ignoreComplex=false, bool segment=false, QList< RObject::Id > *entityIds=NULL) const
int getStatus() const
virtual RS::EntityType getType() const
virtual RVector getVectorTo(const RVector &point, bool limited=true, double strictRange=RMAXDOUBLE) const
RVector getViewCenter() const
RVector getViewOffset() const
int getViewportId() const
RVector getViewTarget() const
double getWidth() const
virtual bool intersectsWith(const RShape &shape) const
bool isOff() const
bool isOverall() const
virtual bool isValid() const
virtual bool mirror(const RLine &axis)
virtual bool mirror(const RVector &axis1, const RVector &axis2)
virtual bool move(const RVector &offset)
Moves this entity by the given offset.
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.
virtual bool rotate(double rotation, const RVector &center=RDEFAULT_RVECTOR)
virtual bool scale(const RVector &scaleFactors, const RVector &center)
void setCenter(const RVector &c)
void setFrozenLayerIds(const QList< RObject::Id > &layerIds)
void setHeight(double h)
void setOff(bool v)
void setOverall(bool on)
void setRotation(double r)
void setScale(double s)
void setStatus(int s)
void setViewCenter(const RVector &c)
void setViewportId(int id)
void setViewTarget(const RVector &t)
void setWidth(double w)
virtual void setZ(double z)
virtual bool stretch(const RPolyline &area, const RVector &offset)
Stretches the end points of this entity that are inside area by offset.
virtual void to2D()
RViewportData(RDocument *document, const RViewportData &data)
void setStatusFlag(Status s, bool on)
bool testStatusFlag(Status s) const
QList< RObject::Id > frozenLayerIds
double height
bool overall
double rotation
double scaleFactor
int status
RVector viewCenter
int viewportId
RVector viewTarget
double width
class RViewportEntity

enum Status
Value Description
Off = 0x20000

RViewportData::RViewportData()

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.

virtual RShape * RViewportData::castToShape()

virtual inline

Reimplemented from castToShape.

virtual bool RViewportData::flipHorizontal()

virtual inline

Reimplemented from flipHorizontal.

virtual bool RViewportData::flipVertical()

virtual inline

Reimplemented from flipVertical.

virtual QList< RVector > RViewportData::getArcReferencePoints(const RBox &queryBox=RDEFAULT_RBOX) const

virtual inline const

Returns: Vector of reference points of this entity. Used for snap to reference points.

Reimplemented from getArcReferencePoints.

virtual RBox RViewportData::getBoundingBox() const

virtual inline const

Returns: The bounding box of this shape.

Reimplemented from getBoundingBox.

virtual RBox RViewportData::getBoundingBox(bool ignoreEmpty) const

virtual const

Returns: The bounding box that contains this entity.

Reimplemented from getBoundingBox.

RVector RViewportData::getCenter() const

inline const

virtual QList< RVector > RViewportData::getCenterPoints(const RBox &queryBox=RDEFAULT_RBOX, QList< RObject::Id > *subEntityIds=NULL) const

virtual inline const

Returns: Vector of center points of this entity. Used for snap to center points.

Reimplemented from getCenterPoints.

virtual double RViewportData::getDistanceTo(const RVector &point, bool limited=true, double range=0.0, bool draft=false, double strictRange=RMAXDOUBLE) const

virtual const

Returns: The shortest distance from this entity to the given point.

Parameters:

  • limited: Limit lines, arcs at end points, otherwise the orthogonal distance to the unlimited line / circle is returned.
  • range: This 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.
  • draft: Calculate based on draft mode representation of the entity.
  • strictRange: If 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 getDistanceTo.

QList< RLine > RViewportData::getEdges() const

const

virtual QList< RVector > RViewportData::getEndPoints(const RBox &queryBox=RDEFAULT_RBOX, QList< RObject::Id > *subEntityIds=NULL) const

virtual inline const

Returns: Vector of end points of this entity. Used for snap to end points.

Reimplemented from getEndPoints.

QList< RObject::Id > RViewportData::getFrozenLayerIds() const

inline const

double RViewportData::getHeight() const

inline const

virtual QList< RRefPoint > RViewportData::getInternalReferencePoints(RS::ProjectionRenderingHint hint=RS::RenderTop, QList< RObject::Id > *subEntityIds=NULL) const

virtual const

Can be overwritten to return internal, resolved reference points.

This is used for example for block references in combination with snap to reference points. Default implementation returns same as getReferencePoints().

Reimplemented from getInternalReferencePoints.

virtual QList< RVector > RViewportData::getIntersectionPoints(const REntityData &other, bool limited=true, bool same=false, const RBox &queryBox=RDEFAULT_RBOX, bool ignoreComplex=true, QList< QPair< RObject::Id, RObject::Id > > *entityIds=NULL) const

virtual inline const

Returns: Points on entity which are intersection points with the given other entity. If same is true, the two datas originate from the same entity.

Reimplemented from getIntersectionPoints.

virtual QList< RVector > RViewportData::getIntersectionPoints(const RShape &shape, bool limited=true, const RBox &queryBox=RDEFAULT_RBOX, bool ignoreComplex=true) const

virtual inline const

Returns: Points on entity which are intersection points with the given shape.

Reimplemented from getIntersectionPoints.

virtual QList< RVector > RViewportData::getMiddlePoints(const RBox &queryBox=RDEFAULT_RBOX, QList< RObject::Id > *subEntityIds=NULL) const

virtual inline const

Returns: Vector of middle points of this entity. Used for snap to middle points.

Reimplemented from getMiddlePoints.

virtual QList< RVector > RViewportData::getPointsWithDistanceToEnd(double distance, int from=RS::FromAny, const RBox &queryBox=RDEFAULT_RBOX, QList< RObject::Id > *subEntityIds=NULL) const

virtual inline const

Returns: Points on entity with given distance to either endpoint. Used for snap to points with distance on entity.

Reimplemented from getPointsWithDistanceToEnd.

virtual QList< RRefPoint > RViewportData::getReferencePoints(RS::ProjectionRenderingHint hint=RS::RenderTop) const

virtual const

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.

Reimplemented from getReferencePoints.

double RViewportData::getRotation() const

inline const

double RViewportData::getScale() const

inline const

virtual QList< QSharedPointer< RShape > > RViewportData::getShapes(const RBox &queryBox=RDEFAULT_RBOX, bool ignoreComplex=false, bool segment=false, QList< RObject::Id > *entityIds=NULL) const

virtual const

Returns: Shapes that represent the geometry of this entity.

Parameters:

  • queryBox: Limit returned shapes to query box
  • ignoreComplex: Ignore complex shapes and explode those into simple shapes
  • segment: Split up splines into spline segments

Reimplemented from getShapes.

int RViewportData::getStatus() const

inline const

virtual RS::EntityType RViewportData::getType() const

virtual inline const

Reimplemented from getType.

virtual RVector RViewportData::getVectorTo(const RVector &point, bool limited=true, double strictRange=RMAXDOUBLE) const

virtual inline const

Returns: The distance vector from this entity to the given point.

Parameters:

  • point: the point to which the distance was measured
  • limited: If true, an invalid vector is returned if the closest point on the entity is outside of the entity (e.g. in the extension line of a line or outside the start / end angle of an arc).

Reimplemented from getVectorTo.

RVector RViewportData::getViewCenter() const

inline const

RVector RViewportData::getViewOffset() const

const

Returns: Offset or position of 0/0 of view (model space block) for this viewport.

int RViewportData::getViewportId() const

inline const

RVector RViewportData::getViewTarget() const

inline const

double RViewportData::getWidth() const

inline const

virtual bool RViewportData::intersectsWith(const RShape &shape) const

virtual inline const

Returns: True if this entity intersects with the given shape, false otherwise.

Reimplemented from intersectsWith.

bool RViewportData::isOff() const

inline const

bool RViewportData::isOverall() const

inline const

virtual bool RViewportData::isValid() const

virtual inline const

Reimplemented from isValid.

virtual bool RViewportData::mirror(const RLine &axis)

virtual inline

Reimplemented from mirror.

virtual bool RViewportData::mirror(const RVector &axis1, const RVector &axis2)

virtual inline

Reimplemented from mirror.

virtual bool RViewportData::move(const RVector &offset)

virtual inline

Moves this entity by the given offset.

Reimplemented from move.

virtual bool RViewportData::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.

Reimplemented from moveReferencePoint.

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

virtual inline

Reimplemented from rotate.

virtual bool RViewportData::scale(const RVector &scaleFactors, const RVector &center)

virtual

Reimplemented from scale.

void RViewportData::setCenter(const RVector &c)

inline

void RViewportData::setFrozenLayerIds(const QList< RObject::Id > &layerIds)

inline

void RViewportData::setHeight(double h)

inline

void RViewportData::setOff(bool v)

inline

void RViewportData::setOverall(bool on)

inline

void RViewportData::setRotation(double r)

inline

void RViewportData::setScale(double s)

inline

void RViewportData::setStatus(int s)

inline

void RViewportData::setViewCenter(const RVector &c)

inline

void RViewportData::setViewportId(int id)

inline

void RViewportData::setViewTarget(const RVector &t)

inline

void RViewportData::setWidth(double w)

inline

virtual void RViewportData::setZ(double z)

virtual inline

Reimplemented from setZ.

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

virtual inline

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

Reimplemented from stretch.

virtual void RViewportData::to2D()

virtual

Reimplemented from to2D.

RViewportData::RViewportData(RDocument *document, const RViewportData &data)

protected

void RViewportData::setStatusFlag(Status s, bool on)

inline protected

bool RViewportData::testStatusFlag(Status s) const

inline const protected

QList<RObject::Id> RViewportData::frozenLayerIds

private

double RViewportData::height

private

bool RViewportData::overall

private

double RViewportData::rotation

private

double RViewportData::scaleFactor

private

int RViewportData::status

private

RVector RViewportData::viewCenter

private

int RViewportData::viewportId

private

RVector RViewportData::viewTarget

private

double RViewportData::width

private

friend class RViewportEntity

private