API Documentation
Loading...
Searching...
No Matches
SnapsManager.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: Design
28File: SnapsManager
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <NDEVR/SnapPoint.h>
35#include <NDEVR/LineSegment.h>
36#include <NDEVR/Triangle.h>
37#include <NDEVR/Dictionary.h>
38#include <NDEVR/UUID.h>
39#include <NDEVR/Buffer.h>
40namespace NDEVR
41{
42 class DesignObjectLookup;
43 class SelectionInfo;
44 class String;
45
46 /**--------------------------------------------------------------------------------------------------
47 \brief Manages which points are considered interesting based on defined criteria
48 **/
50 {
51 public:
55 SnapPoint getSnapPoint(const DesignObjectLookup* manager, const SelectionInfo& info, bool use_worldspace) const;
56 void getSnapPoint(SnapPoint& current, const DesignObjectLookup* manager, const SelectionInfo& info, bool use_worldspace) const;
57 SnapPoint getSnapLinePoint(const DesignObjectLookup* manager, const SelectionInfo& info, const SnapPoint& last, const Buffer<std::pair<UUID, uint04>>& locations_of_interest, bool use_worldspace) const;
58 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;
59
60 bool checkVertex(SnapPoint::SnapLocationType snap, const SelectionInfo& info, const Vertex<3, fltp08>& point, SnapPoint& closest_snap, UUID id, uint04 index) const;
61 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;
62 bool checkTriangle(const SelectionInfo& info, const Triangle<3, fltp08>& tri, SnapPoint& closest_snap, UUID id, uint04 index, bool is_smooth) const;
63
64 bool isSnapEnabled(SnapPoint::SnapLocationType snap) const { return m_enabled_snaps[snap]; }
65 void setSnapEnabled(SnapPoint::SnapLocationType snap, bool use_snap) { m_enabled_snaps[snap] = use_snap; }
66 void setAllEnabled(bool use_snap);
68 protected:
72 };
73}
74
75
76
#define NDEVR_DESIGN_API
Definition DLLInfo.h:55
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:56
A core class where all Design Objects including models, materials, and geometries are stored....
Definition DesignObjectLookup.h:65
A hash-based key-value store, useful for quick associative lookups. Key features include:
Definition Dictionary.h:61
A line segment represented by two vertices, a start and end.
Definition Line.hpp:49
Responsible for turning a user interaction into a selection within a DesignObjectLookup.
Definition Selector.h:50
Contains information about a particular point of interest created from a user mouse interaction.
Definition SnapPoint.h:44
SnapLocationType
Definition SnapPoint.h:47
Manages which points are considered interesting based on defined criteria.
Definition SnapsManager.h:50
Dictionary< SnapPoint::SnapLocationType, fltp08 > m_sensitivity
Definition SnapsManager.h:70
void setSensitivity(SnapPoint::SnapLocationType type, fltp08 sensitivity)
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
bool checkVertex(SnapPoint::SnapLocationType snap, const SelectionInfo &info, const Vertex< 3, fltp08 > &point, SnapPoint &closest_snap, UUID id, uint04 index) const
void getSnapPoint(SnapPoint &current, const DesignObjectLookup *manager, const SelectionInfo &info, bool use_worldspace) const
SnapPoint getSnapLinePoint(const DesignObjectLookup *manager, const SelectionInfo &info, const SnapPoint &last, const Buffer< std::pair< UUID, uint04 > > &locations_of_interest, bool use_worldspace) const
Dictionary< SnapPoint::SnapLocationType, uint04 > m_priority
Definition SnapsManager.h:71
static String SnapIcon(SnapPoint::SnapLocationType snap_type)
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
SnapPoint getSnapPoint(const DesignObjectLookup *manager, const SelectionInfo &info, bool use_worldspace) const
void setAllEnabled(bool use_snap)
void setSnapEnabled(SnapPoint::SnapLocationType snap, bool use_snap)
Definition SnapsManager.h:65
bool isSnapEnabled(SnapPoint::SnapLocationType snap) const
Definition SnapsManager.h:64
void setPriority(SnapPoint::SnapLocationType type, uint04 priority)
bool checkTriangle(const SelectionInfo &info, const Triangle< 3, fltp08 > &tri, SnapPoint &closest_snap, UUID id, uint04 index, bool is_smooth) const
Dictionary< SnapPoint::SnapLocationType, bool > m_enabled_snaps
Definition SnapsManager.h:69
The core String class for the NDEVR API.
Definition String.h:69
A triangle is a polygon with three edges and three vertices. It is one of the basic shapes in geometr...
Definition Triangle.hpp:138
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:60
A vertex or point. A specific type of Vector used primarily for spacial location information.
Definition Vertex.hpp:48
Definition ACIColor.h:37
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:96
double fltp08
Defines an alias representing an 8 byte floating-point number.
Definition BaseValues.hpp:149