API Documentation
Loading...
Searching...
No Matches
MeasurementManager.h
Go to the documentation of this file.
1#pragma once
2/*--------------------------------------------------------------------------------------------
3Copyright (c) 2019, NDEVR LLC
4tyler.parke@ndevr.org
5 __ __ ____ _____ __ __ _______
6 | \ | | | __ \ | ___|\ \ / / | __ \
7 | \ | | | | \ \ | |___ \ \ / / | |__) |
8 | . \| | | |__/ / | |___ \ V / | _ /
9 | |\ |_|_____/__|_____|___\_/____| | \ \
10 |__| \__________________________________| \__\
11
12Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
13Licensee a limited, non-exclusive, non-transferable, royalty-free license
14(without the right to sublicense) to use the API solely for the purpose of
15Licensee's internal development efforts to develop applications for which
16the API was provided.
17
18The above copyright notice and this permission notice shall be included in all
19copies or substantial portions of the Software.
20
21THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
22INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
23PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
24FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
25OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26DEALINGS IN THE SOFTWARE.
27
28Library: Design
29File: GeometryMaker
30Included in API: True
31Author(s): Tyler Parke
32 *-----------------------------------------------------------------------------------------**/
33#pragma once
34#include <NDEVR/SnapController.h>
35#if NDEVR_VIEWPORT && NDEVR_MEASURE_MODELS
36#include <NDEVR/PointMeasureModel.h>
37#include <NDEVR/CrossSectionModel.h>
38#include <NDEVR/CommandLockObject.h>
39namespace NDEVR
40{
41 /**--------------------------------------------------------------------------------------------------
42 \brief Allows the user to create 3D measurements.
43 **/
44 class NDEVR_DESIGN_API MeasurementManager : public SnapController
45 {
46 class KeyManager;
47 public:
48 enum MeasureMode : uint01
49 {
50 e_no_measurement
51 , e_measure_points
52 , e_measure_distance
53 , e_measure_angle
54 , e_measure_cross_section
55 , e_measurement_mode_size
56 };
57 enum AngleMode
58 {
59 e_track_mouse
60 , e_clockwise
61 , e_counter_clockwise
62 };
63 MeasurementManager(DesignObjectLookup* manager);
64 ~MeasurementManager();
65 void createNewModel();
66 void addMeasurementPoint(const Vertex<3, fltp08>& point);
67 virtual void cancel() override;
68 const UUID& rootModelID() const { return m_root_model; }
69 const UUID& currentModel() const { return m_current_model; }
70 Model rootModel() const;
71 void updateFont();
72 void discardModels();
73 void finishModels();
74 void setGenerateNormals(bool generate_normals);
75 void setAutoWind(bool auto_wind_shapes);
76 void setRootModel(UUID model);
77 void setIsTouch(bool touch_mode);
78 bool tryCommandLock();
79 bool hasCommandLock();
80 void lockMovement(bool lock_movement) { m_lock_movement = lock_movement; }
81 bool movementLocked() const { return m_lock_movement; }
82 Buffer<UUID> measurementModelIDs() const;
83 TranslatedString getHint() const;
84 void finishCrossSection();
85 Buffer<PointMeasureModel> pointMeasurements() const;
86 void setPointNamingFormat(const TranslatedString& naming_format);
87 void setDistanceNamingFormat(const TranslatedString& naming_format);
88 void setAngleNamingFormat(const TranslatedString& naming_format);
89 void setPointType(const BitFlag& point_types);
90 void setLineEdgeType(const BitFlag& point_types);
91 void setMarkerScale(fltp08 thickness);
92 BitFlag pointType() const { return m_point_type; }
93 BitFlag lineEdgeType() const { return m_line_edge_type; }
94 Buffer<AngleMeasureModel> angleMeasurements() const;
95 const TranslatedString& pointNamingFormat() const { return m_point_naming_format; }
96 const TranslatedString& distanceNamingFormat() const { return m_distance_naming_format; }
97 bool useLineLeader() const { return m_use_line_leader; }
98 bool usePointLeader() const { return m_use_point_leader; }
99 void setUsePointLeader(bool use) { m_use_point_leader = use; }
100 void setUseLineLeader(bool use) { m_use_line_leader = use; }
101 const TranslatedString& rootName() const { return m_root_name; }
102 void setRootName(const TranslatedString& name);
103 void setCrossSectionSpacing(const Vector<3, fltp08>& spacing);
104 Vector<3, fltp08> crossSectionSpacing() const { return m_cross_section_spacing; }
105 void setCrossSectionalCenterline(bool centerline) { m_use_cross_sectional_centerline = centerline; };
106 bool crossSectionalCenterline() const { return m_use_cross_sectional_centerline; }
107 void setAngleMode(const AngleMode& mode) { m_angle_mode = mode; }
108 AngleMode angleMode() const { return m_angle_mode; }
109 void setAutoSetLockPlane(bool autoset_lock_plane);
110 virtual void finish() override;
111 virtual void undo();
112 public:
113 Resource<MeasureMode> measure_mode;
114 protected:
115 virtual void begin() override;
116
117 void autoName(const Model& model, uint04 index);
118 void calculateSolid(Geometry& mesh);
119 void createRootModel();
120 virtual SelectionInfo createSelectionInfo(const MouseEvent& event, Camera* camera) override;
121 void updatePrimitive(const Vertex<3, fltp08>& world_location, Camera* camera);
122 void onSelect(Camera* camera);
123 static Vector<3, Angle<fltp08>> getOrientation(const Vector<3, fltp08>& lookat, const Vector<3, fltp08>& up);
124 virtual bool processMouseEvent(const MouseEvent& mouse_event, DesignObjectLookup* lookup, Camera* camera) override;
125 virtual bool processKeyEvent(const KeyEvent& event, DesignObjectLookup* lookup, Camera* camera) override;
126 void processResizeEvent(const MeasureMode& spec, Model& model, Camera* camera);
127 protected:
128 void updateSnapIcon();
129 protected:
130 CommandLockObject m_command_lock;
131 PointMeasureModel m_point_model;
132 DistanceMeasureModel m_distance_measure_model;
133 #if NDEVR_CROSS_SECTION
134 CrossSectionModel m_cross_section_model;
135 #endif
136 AngleMeasureModel m_angle_measure_model;
137 AngleMode m_angle_mode = AngleMode::e_track_mouse;
138 TranslatedString m_point_naming_format;
139 TranslatedString m_distance_naming_format;
140 TranslatedString m_angle_naming_format;
141 TranslatedString m_root_name;
142 Plane<3, fltp08> m_draw_plane;
143 Vector<3, fltp08> m_cross_section_spacing;
144 UUID m_current_model;
145 UUID m_root_model;
146 UUID m_id;
147 BitFlag m_point_type;
148 BitFlag m_line_edge_type;
149 bool m_auto_wind_shapes;
150 bool m_generate_normals;
151 bool m_lock_movement;
152 bool m_is_moving;
153 bool m_is_touch_mode;
154 bool m_use_line_leader;
155 bool m_use_point_leader;
156 bool m_use_cross_sectional_centerline;
157 bool m_autoset_lock_plane = true;
158 };
159 template class NDEVR_DESIGN_API StringStream<MeasurementManager::MeasureMode>;
160}
161#endif
162
163
#define NDEVR_DESIGN_API
Definition DLLInfo.h:55
Definition ACIColor.h:37
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:80