Skip to content

RSplineData

Class in Entity Module
Header: #include <src/entity/RSplineData.h>
Inherits: REntityData, RSpline

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

Scriptable: This class is available in script environments.

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

RSplineData()
RSplineData(const RSpline &spline)
void appendControlPoint(const RVector &point)
void appendFitPoint(const RVector &point)
RPolyline approximateWithArcs(double tolerance, double radiusLimit=RDEFAULT_MIN1) const
virtual RShape * castToShape()
virtual bool flipHorizontal()
virtual bool flipVertical()
QList< double > getActualKnotVector() const
virtual double getAngleAt(double distance, RS::From from=RS::FromStart) const
virtual QList< RVector > getArcReferencePoints(const RBox &queryBox=RDEFAULT_RBOX) const
virtual RBox getBoundingBox(bool ignoreEmpty=false) const
virtual QList< RVector > getCenterPoints(const RBox &queryBox=RDEFAULT_RBOX, QList< RObject::Id > *subEntityIds=NULL) const
QList< RVector > getControlPoints() const
QList< RVector > getControlPointsWrapped() const
int getDegree() const
virtual double getDirection1() const
virtual double getDirection2() const
virtual double getDistanceTo(const RVector &point, bool limited=true, double range=0.0, bool draft=false, double strictRange=RMAXDOUBLE) const
virtual RVector getEndPoint() const
virtual QList< RVector > getEndPoints(const RBox &queryBox=RDEFAULT_RBOX, QList< RObject::Id > *subEntityIds=NULL) const
QList< RVector > getFitPoints() const
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
QList< double > getKnotVector() const
virtual double getLength() const
virtual QList< RVector > getMiddlePoints(const RBox &queryBox=RDEFAULT_RBOX, QList< RObject::Id > *subEntityIds=NULL) const
RVector getPointAt(double t) const
RVector getPointAtDistance(double distance) 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
virtual QList< QSharedPointer< RShape > > getShapes(const RBox &queryBox=RDEFAULT_RBOX, bool ignoreComplex=false, bool segment=false, QList< RObject::Id > *entityIds=NULL) const
virtual RVector getStartPoint() const
RVector getTangentAtEnd() const
RVector getTangentAtStart() const
virtual RS::Ending getTrimEnd(const RVector &trimPoint, const RVector &clickPoint)
virtual RS::EntityType getType() const
virtual RVector getVectorTo(const RVector &point, bool limited=true, double strictRange=RMAXDOUBLE) const
QList< double > getWeights() const
void insertFitPointAt(const RVector &point)
virtual bool intersectsWith(const RShape &shape) const
bool isClosed() const
bool isPeriodic() 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.
void prependFitPoint(const RVector &point)
void removeFitPointAt(const RVector &point)
virtual bool reverse()
virtual bool rotate(double rotation, const RVector &center=RDEFAULT_RVECTOR)
virtual bool scale(const RVector &scaleFactors, const RVector &center=RDEFAULT_RVECTOR)
void setEndPoint(const RVector &ep)
void setPeriodic(bool on)
void setShape(const RSpline &s)
void setStartPoint(const RVector &sp)
virtual void setZ(double z)
void simplify(double tolerance)
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()
RPolyline toPolyline(int segments) const
virtual bool trimEndPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
virtual bool trimStartPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
virtual void update() const
Entities can reimplement this function to invalidate any internal cache (mark the entity as dirty).
RSplineData(RDocument *document, const RSplineData &data)
class RSplineEntity

RSplineData::RSplineData()

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.

RSplineData::RSplineData(const RSpline &spline)

void RSplineData::appendControlPoint(const RVector &point)

inline

void RSplineData::appendFitPoint(const RVector &point)

inline

RPolyline RSplineData::approximateWithArcs(double tolerance, double radiusLimit=RDEFAULT_MIN1) const

const

virtual RShape * RSplineData::castToShape()

virtual inline

Reimplemented from castToShape.

virtual bool RSplineData::flipHorizontal()

virtual inline

Reimplemented from flipHorizontal.

virtual bool RSplineData::flipVertical()

virtual inline

Reimplemented from flipVertical.

QList< double > RSplineData::getActualKnotVector() const

inline const

virtual double RSplineData::getAngleAt(double distance, RS::From from=RS::FromStart) const

virtual inline const

Returns: Angle on the entity at the given distance from the start point.

Reimplemented from getAngleAt.

virtual QList< RVector > RSplineData::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 RSplineData::getBoundingBox(bool ignoreEmpty=false) const

virtual const

Returns: The bounding box that contains this entity.

Reimplemented from getBoundingBox.

virtual QList< RVector > RSplineData::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.

QList< RVector > RSplineData::getControlPoints() const

inline const

QList< RVector > RSplineData::getControlPointsWrapped() const

inline const

int RSplineData::getDegree() const

inline const

virtual double RSplineData::getDirection1() const

virtual inline const

Returns: Tangent angle of spline at start point.

Reimplemented from getDirection1.

virtual double RSplineData::getDirection2() const

virtual inline const

Returns: Tangent angle of spline at end point.

Reimplemented from getDirection2.

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

virtual inline 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.

virtual RVector RSplineData::getEndPoint() const

virtual inline const

Reimplemented from getEndPoint.

virtual QList< RVector > RSplineData::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< RVector > RSplineData::getFitPoints() const

inline const

virtual QList< RVector > RSplineData::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 > RSplineData::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.

QList< double > RSplineData::getKnotVector() const

inline const

virtual double RSplineData::getLength() const

virtual inline const

Returns: The total length of this shape if applicable or NaN if not.

Reimplemented from getLength.

virtual QList< RVector > RSplineData::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.

RVector RSplineData::getPointAt(double t) const

inline const

RVector RSplineData::getPointAtDistance(double distance) const

inline const

virtual QList< RVector > RSplineData::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 > RSplineData::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.

virtual QList< QSharedPointer< RShape > > RSplineData::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.

virtual RVector RSplineData::getStartPoint() const

virtual inline const

Reimplemented from getStartPoint.

RVector RSplineData::getTangentAtEnd() const

inline const

RVector RSplineData::getTangentAtStart() const

inline const

virtual RS::Ending RSplineData::getTrimEnd(const RVector &trimPoint, const RVector &clickPoint)

virtual inline

Parameters:

  • trimPoint: Trim start point or end point to this coordinate.
  • clickPoint: Point that was clicked by user.

Reimplemented from getTrimEnd.

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

virtual inline const

Reimplemented from getType.

virtual RVector RSplineData::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.

QList< double > RSplineData::getWeights() const

inline const

void RSplineData::insertFitPointAt(const RVector &point)

inline

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

virtual inline const

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

Reimplemented from intersectsWith.

bool RSplineData::isClosed() const

inline const

bool RSplineData::isPeriodic() const

inline const

virtual bool RSplineData::isValid() const

virtual inline const

Reimplemented from isValid.

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

virtual inline

Reimplemented from mirror.

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

virtual inline

Reimplemented from mirror.

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

virtual inline

Moves this entity by the given offset.

Reimplemented from move.

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

void RSplineData::prependFitPoint(const RVector &point)

inline

void RSplineData::removeFitPointAt(const RVector &point)

inline

virtual bool RSplineData::reverse()

virtual inline

Reimplemented from reverse.

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

virtual inline

Reimplemented from rotate.

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

virtual inline

Reimplemented from scale.

void RSplineData::setEndPoint(const RVector &ep)

inline

void RSplineData::setPeriodic(bool on)

inline

void RSplineData::setShape(const RSpline &s)

inline

void RSplineData::setStartPoint(const RVector &sp)

inline

virtual void RSplineData::setZ(double z)

virtual inline

Reimplemented from setZ.

void RSplineData::simplify(double tolerance)

inline

virtual bool RSplineData::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 RSplineData::to2D()

virtual inline

Reimplemented from to2D.

RPolyline RSplineData::toPolyline(int segments) const

const

virtual bool RSplineData::trimEndPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)

virtual inline

Parameters:

  • trimPoint: Trim start point or end point to this coordinate.
  • clickPoint: Point that was clicked by user.
  • extend: True if the shape is to be extended. Used for polylines to determine that the last segment has to be trimmed even if another segment was clicked.

Reimplemented from trimEndPoint.

virtual bool RSplineData::trimStartPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)

virtual inline

Parameters:

  • trimPoint: Trim start point or end point to this coordinate.
  • clickPoint: Point that was clicked by user.
  • extend: True if the shape is to be extended. Used for polylines to determine that the first segment has to be trimmed even if another segment was clicked.

Reimplemented from trimStartPoint.

virtual void RSplineData::update() const

virtual inline const

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

Reimplemented from update.

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

protected

friend class RSplineEntity

private