NDEVR
API Documentation
SnapsManager

Forward declaration for the NDEVR string type. More...

Collaboration diagram for SnapsManager:
[legend]

Public Member Functions

 SnapsManager ()
 Constructs a SnapsManager with default snap settings.
bool checkLine (const SelectionInfo &info, const LineSegment< 3, fltp08 > &seg, bool infinite_length, SnapPoint &closest_snap, SnapPoint::SnapLocationType line_snap, SnapPoint::SnapLocationType edge_snap, UUID id, uint04 index, bool is_smooth) const
 Checks whether a line segment qualifies as a snap candidate and updates the closest snap if so.
bool checkTriangle (const SelectionInfo &info, const Triangle< 3, fltp08 > &tri, SnapPoint &closest_snap, UUID id, uint04 index, bool is_smooth) const
 Checks whether a triangle qualifies as a snap candidate and updates the closest snap if so.
bool checkVertex (SnapPoint::SnapLocationType snap, const SelectionInfo &info, const Vertex< 3, fltp08 > &point, SnapPoint &closest_snap, UUID id, uint04 index) const
 Checks whether a vertex qualifies as a snap candidate and updates the closest snap if so.
SnapPoint getSnapLinePoint (const DesignObjectLookup *manager, const SelectionInfo &info, const SnapPoint &last, const Buffer< std::pair< UUID, uint04 > > &locations_of_interest, bool use_worldspace) const
 Finds the best snap point constrained to a line from a previous snap point.
void getSnapLinePoint (SnapPoint &current, const DesignObjectLookup *manager, const SelectionInfo &info, const SnapPoint &last, const Buffer< std::pair< UUID, uint04 > > &locations_of_interest, bool use_worldspace) const
 Finds the best snap point constrained to a line, updating an existing SnapPoint in place.
SnapPoint getSnapPoint (const DesignObjectLookup *manager, const SelectionInfo &info, bool use_worldspace) const
 Finds the best snap point for the given selection info.
void getSnapPoint (SnapPoint &current, const DesignObjectLookup *manager, const SelectionInfo &info, bool use_worldspace) const
 Finds the best snap point, updating an existing SnapPoint in place.
bool isSnapEnabled (SnapPoint::SnapLocationType snap) const
 Checks whether a specific snap location type is currently enabled.
void setAllEnabled (bool use_snap)
 Enables or disables all snap location types at once.
void setPriority (SnapPoint::SnapLocationType type, uint04 priority)
 Sets the priority for a specific snap location type.
void setSensitivity (SnapPoint::SnapLocationType type, fltp08 sensitivity)
 Sets the sensitivity radius for a specific snap location type.
void setSnapEnabled (SnapPoint::SnapLocationType snap, bool use_snap)
 Enables or disables a specific snap location type.

Static Public Member Functions

static StringView SnapIcon (SnapPoint::SnapLocationType snap_type)
 Returns the icon name associated with a snap location type.

Protected Attributes

Dictionary< SnapPoint::SnapLocationType, bool > m_enabled_snaps
 Maps each snap type to its enabled/disabled state.
Dictionary< SnapPoint::SnapLocationType, uint04m_priority
 Maps each snap type to its priority for conflict resolution.
Dictionary< SnapPoint::SnapLocationType, fltp08m_sensitivity
 Maps each snap type to its sensitivity distance threshold.

Detailed Description

Forward declaration for the NDEVR string type.


Manages which points are considered interesting based on defined criteria.

Provides snap-to-point functionality for design objects, allowing the user to snap to vertices, edges, midpoints, intersections, and other geometric features. Each snap type can be individually enabled/disabled and configured with its own sensitivity and priority.

See also
SnapPoint, SnapController, SelectionController

Definition at line 55 of file SnapsManager.h.

Member Function Documentation

◆ checkLine()

bool SnapsManager::checkLine ( const SelectionInfo & info,
const LineSegment< 3, fltp08 > & seg,
bool infinite_length,
SnapPoint & closest_snap,
SnapPoint::SnapLocationType line_snap,
SnapPoint::SnapLocationType edge_snap,
UUID id,
uint04 index,
bool is_smooth ) const

Checks whether a line segment qualifies as a snap candidate and updates the closest snap if so.

Parameters
[in]infoThe current selection info describing the cursor or pick location.
[in]segThe 3D line segment to evaluate.
[in]infinite_lengthWhether to treat the segment as an infinite line.
[in,out]closest_snapThe current closest snap point, updated if a point on the line is closer.
[in]line_snapThe snap type to use for the line body (e.g., nearest point on line).
[in]edge_snapThe snap type to use for edge endpoints or midpoints.
[in]idThe UUID of the design object owning this line.
[in]indexThe index of the line within its parent object.
[in]is_smoothWhether the line belongs to a smooth curve, affecting snap behavior.
Returns
True if the snap point was updated with a point on this line.

◆ checkTriangle()

bool SnapsManager::checkTriangle ( const SelectionInfo & info,
const Triangle< 3, fltp08 > & tri,
SnapPoint & closest_snap,
UUID id,
uint04 index,
bool is_smooth ) const

Checks whether a triangle qualifies as a snap candidate and updates the closest snap if so.

Parameters
[in]infoThe current selection info describing the cursor or pick location.
[in]triThe 3D triangle to evaluate.
[in,out]closest_snapThe current closest snap point, updated if a point on the triangle is closer.
[in]idThe UUID of the design object owning this triangle.
[in]indexThe index of the triangle within its parent object.
[in]is_smoothWhether the triangle belongs to a smooth surface, affecting snap behavior.
Returns
True if the snap point was updated with a point on this triangle.

◆ checkVertex()

bool SnapsManager::checkVertex ( SnapPoint::SnapLocationType snap,
const SelectionInfo & info,
const Vertex< 3, fltp08 > & point,
SnapPoint & closest_snap,
UUID id,
uint04 index ) const

Checks whether a vertex qualifies as a snap candidate and updates the closest snap if so.

Parameters
[in]snapThe snap location type to check against.
[in]infoThe current selection info describing the cursor or pick location.
[in]pointThe 3D vertex position to evaluate.
[in,out]closest_snapThe current closest snap point, updated if this vertex is closer.
[in]idThe UUID of the design object owning this vertex.
[in]indexThe index of the vertex within its parent object.
Returns
True if the snap point was updated with this vertex.

◆ getSnapLinePoint() [1/2]

SnapPoint SnapsManager::getSnapLinePoint ( const DesignObjectLookup * manager,
const SelectionInfo & info,
const SnapPoint & last,
const Buffer< std::pair< UUID, uint04 > > & locations_of_interest,
bool use_worldspace ) const

Finds the best snap point constrained to a line from a previous snap point.

Parameters
[in]managerThe design object lookup used to query scene objects.
[in]infoThe current selection info describing the cursor or pick location.
[in]lastThe previous snap point used to define the constraint line.
[in]locations_of_interestBuffer of UUID and index pairs identifying objects of interest.
[in]use_worldspaceWhether to perform snapping in world space coordinates.
Returns
The best matching SnapPoint along the constraint line.

◆ getSnapLinePoint() [2/2]

void SnapsManager::getSnapLinePoint ( SnapPoint & current,
const DesignObjectLookup * manager,
const SelectionInfo & info,
const SnapPoint & last,
const Buffer< std::pair< UUID, uint04 > > & locations_of_interest,
bool use_worldspace ) const

Finds the best snap point constrained to a line, updating an existing SnapPoint in place.

Parameters
[in,out]currentThe current snap point to compare against and potentially update.
[in]managerThe design object lookup used to query scene objects.
[in]infoThe current selection info describing the cursor or pick location.
[in]lastThe previous snap point used to define the constraint line.
[in]locations_of_interestBuffer of UUID and index pairs identifying objects of interest.
[in]use_worldspaceWhether to perform snapping in world space coordinates.

◆ getSnapPoint() [1/2]

SnapPoint SnapsManager::getSnapPoint ( const DesignObjectLookup * manager,
const SelectionInfo & info,
bool use_worldspace ) const

Finds the best snap point for the given selection info.

Parameters
[in]managerThe design object lookup used to query scene objects.
[in]infoThe current selection info describing the cursor or pick location.
[in]use_worldspaceWhether to perform snapping in world space coordinates.
Returns
The best matching SnapPoint, or an invalid snap if none found.

◆ getSnapPoint() [2/2]

void SnapsManager::getSnapPoint ( SnapPoint & current,
const DesignObjectLookup * manager,
const SelectionInfo & info,
bool use_worldspace ) const

Finds the best snap point, updating an existing SnapPoint in place.

Parameters
[in,out]currentThe current snap point to compare against and potentially update.
[in]managerThe design object lookup used to query scene objects.
[in]infoThe current selection info describing the cursor or pick location.
[in]use_worldspaceWhether to perform snapping in world space coordinates.

◆ isSnapEnabled()

bool SnapsManager::isSnapEnabled ( SnapPoint::SnapLocationType snap) const
inline

Checks whether a specific snap location type is currently enabled.

Parameters
[in]snapThe snap location type to query.
Returns
True if the specified snap type is enabled.

Definition at line 141 of file SnapsManager.h.

References m_enabled_snaps.

◆ setAllEnabled()

void SnapsManager::setAllEnabled ( bool use_snap)

Enables or disables all snap location types at once.

Parameters
[in]use_snapWhether to enable or disable all snap types.

◆ setPriority()

void SnapsManager::setPriority ( SnapPoint::SnapLocationType type,
uint04 priority )

Sets the priority for a specific snap location type.

Higher priority snaps are preferred when multiple snap candidates are within range.

Parameters
[in]typeThe snap location type to configure.
[in]priorityThe priority value to assign.

◆ setSensitivity()

void SnapsManager::setSensitivity ( SnapPoint::SnapLocationType type,
fltp08 sensitivity )

Sets the sensitivity radius for a specific snap location type.

Parameters
[in]typeThe snap location type to configure.
[in]sensitivityThe sensitivity distance threshold for snapping.

◆ setSnapEnabled()

void SnapsManager::setSnapEnabled ( SnapPoint::SnapLocationType snap,
bool use_snap )
inline

Enables or disables a specific snap location type.

Parameters
[in]snapThe snap location type to configure.
[in]use_snapWhether to enable or disable the snap type.

Definition at line 146 of file SnapsManager.h.

References m_enabled_snaps.

◆ SnapIcon()

StringView SnapsManager::SnapIcon ( SnapPoint::SnapLocationType snap_type)
static

Returns the icon name associated with a snap location type.

Parameters
[in]snap_typeThe snap location type to get the icon for.
Returns
A StringView containing the icon resource name.

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