Skip to content

RSnap

Class in Core Module
Header: #include <src/core/RSnap.h>
Inherited by: RSnapAuto, RSnapEntityBase, RSnapFree, RSnapGrid, RSnapIntersection, RSnapSelection

Abstract base class for all grid and object snap implementations.

A snap class implements an object or grid snap tool. For example to snap to end points of objects.

Scriptable: This class is available in script environments.

\generateScriptShell

enum Status { Unknown, Free, Grid, Endpoint, OnEntity, Center, Middle, Distance, Intersection, IntersectionManual, Reference, Perpendicular, Tangential, Coordinate, CoordinatePolar, TopLeft, TopMiddle, TopRight, MiddleLeft, MiddleMiddle, MiddleRight, BottomLeft, BottomMiddle, BottomRight }
Snap status, returned by snap tools (most importantly auto snap tool) to indicate what snap was used.
RSnap(RSnap::Status s=RSnap::Unknown)
~RSnap()
virtual void finishEvent()
QList< RObject::Id > getEntityIds()
RVector getLastSnap() const
virtual QList< RRefPoint > getSnapReferencePoints() const
RSnap::Status getStatus() const
virtual void hideUiOptions()
virtual void reset()
void setLastSnap(const RVector &v)
void setStatus(RSnap::Status s)
virtual void showUiOptions()
virtual RVector snap(const RVector &position, RGraphicsView &view, double range=RNANDOUBLE)
virtual RVector snap(RMouseEvent &event)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
virtual void suspendEvent()
static bool isInRange(const RVector &snapped, const RVector &position, double range, RGraphicsView &view)
static bool isThreeDimensionalView(RGraphicsView &view)
QList< RObject::Id > entityIds
RVector lastSnap
RSnap::Status status

enum Status

Snap status, returned by snap tools (most importantly auto snap tool) to indicate what snap was used.

Value Description
Unknown = 0
Free = 1
Grid = 2
Endpoint = 3
OnEntity = 4
Center = 5
Middle = 6
Distance = 7
Intersection = 8
IntersectionManual = 9
Reference = 10
Perpendicular = 11
Tangential = 12
Coordinate = 13
CoordinatePolar = 14
TopLeft = 15
TopMiddle = 16
TopRight = 17
MiddleLeft = 18
MiddleMiddle = 19
MiddleRight = 20
BottomLeft = 21
BottomMiddle = 22
BottomRight = 23

RSnap::RSnap(RSnap::Status s=RSnap::Unknown)

RSnap::~RSnap()

virtual void RSnap::finishEvent()

virtual inline

QList< RObject::Id > RSnap::getEntityIds()

inline

Returns: Set of entity IDs that are relevant for the last performed snap, usually used for highlighting.

RVector RSnap::getLastSnap() const

inline const

virtual QList< RRefPoint > RSnap::getSnapReferencePoints() const

virtual inline const

Reimplemented in getSnapReferencePoints.

RSnap::Status RSnap::getStatus() const

inline const

virtual void RSnap::hideUiOptions()

virtual inline

Reimplemented in hideUiOptions.

virtual void RSnap::reset()

virtual inline

Reimplemented in reset, reset.

void RSnap::setLastSnap(const RVector &v)

inline

void RSnap::setStatus(RSnap::Status s)

inline

virtual void RSnap::showUiOptions()

virtual inline

Reimplemented in showUiOptions.

virtual RVector RSnap::snap(const RVector &position, RGraphicsView &view, double range=RNANDOUBLE)

virtual inline

Returns: The snapped position (closest relevant position) for the given mouse position.

Reimplemented in snap, snap, snap, snap, snap, snap.

virtual RVector RSnap::snap(RMouseEvent &event)

virtual

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Non-Scriptable: This function is not available in script environments.

virtual void RSnap::suspendEvent()

virtual inline

static bool RSnap::isInRange(const RVector &snapped, const RVector &position, double range, RGraphicsView &view)

static

Returns: True if the given snapped position is within the given range of the given cursor position: in the drawing plane for 2D views, on screen (snap range in pixels, see RSettings::getSnapRange) for 3D views.

static bool RSnap::isThreeDimensionalView(RGraphicsView &view)

static

Returns: True if the given view is a 3D view (a graphics scene with the projection rendering hint RS::RenderThreeD, e.g. the RHI 3D view): snap distances are then compared on screen (see isInRange), not in the drawing plane.

QList<RObject::Id> RSnap::entityIds

protected

RVector RSnap::lastSnap

protected

RSnap::Status RSnap::status

protected