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 class NDEVR_DESIGN_API MeasurementManager : public SnapController
42 {
43 class KeyManager;
44 public:
45 enum MeasureMode : uint01
46 {
47 e_no_measurement
48 , e_measure_points
49 , e_measure_distance
50 , e_measure_angle
51 , e_measure_cross_section
52 , e_measurement_mode_size
53 };
54 enum AngleMode
55 {
56 e_track_mouse
57 , e_clockwise
58 , e_counter_clockwise
59 };
60 MeasurementManager(DesignObjectLookup* manager);
61 ~MeasurementManager();
62 void createNewModel();
63 void addMeasurementPoint(const Vertex<3, fltp08>& point);
64 virtual void cancel() override;
65 const UUID& rootModelID() const { return m_root_model; }
66 const UUID& currentModel() const { return m_current_model; }
67 Model rootModel() const;
68 void updateFont();
69 void discardModels();
70 void finishModels();
71 void setGenerateNormals(bool generate_normals);
72 void setAutoWind(bool auto_wind_shapes);
73 void setRootModel(UUID model);
74 void setIsTouch(bool touch_mode);
75 bool tryCommandLock();
76 bool hasCommandLock();
77 void lockMovement(bool lock_movement) { m_lock_movement = lock_movement; }
78 bool movementLocked() const { return m_lock_movement; }
79 Buffer<UUID> measurementModelIDs() const;
80 TranslatedString getHint() const;
81 void finishCrossSection();
82 Buffer<PointMeasureModel> pointMeasurements() const;
83 void setPointNamingFormat(const TranslatedString& naming_format);
84 void setDistanceNamingFormat(const TranslatedString& naming_format);
85 void setAngleNamingFormat(const TranslatedString& naming_format);
86 void setPointType(const BitFlag& point_types);
87 void setLineEdgeType(const BitFlag& point_types);
88 void setMarkerScale(fltp08 thickness);
89 BitFlag pointType() const { return m_point_type; }
90 BitFlag lineEdgeType() const { return m_line_edge_type; }
91 Buffer<AngleMeasureModel> angleMeasurements() const;
92 const TranslatedString& pointNamingFormat() const { return m_point_naming_format; }
93 const TranslatedString& distanceNamingFormat() const { return m_distance_naming_format; }
94 bool useLineLeader() const { return m_use_line_leader; }
95 bool usePointLeader() const { return m_use_point_leader; }
96 void setUsePointLeader(bool use) { m_use_point_leader = use; }
97 void setUseLineLeader(bool use) { m_use_line_leader = use; }
98 const TranslatedString& rootName() const { return m_root_name; }
99 void setRootName(const TranslatedString& name);
100 void setCrossSectionSpacing(const Vector<3, fltp08>& spacing);
101 Vector<3, fltp08> crossSectionSpacing() const { return m_cross_section_spacing; }
102 void setCrossSectionalCenterline(bool centerline) { m_use_cross_sectional_centerline = centerline; };
103 bool crossSectionalCenterline() const { return m_use_cross_sectional_centerline; }
104 void setAngleMode(const AngleMode& mode) { m_angle_mode = mode; }
105 AngleMode angleMode() const { return m_angle_mode; }
106 void setAutoSetLockPlane(bool autoset_lock_plane);
107 virtual void finish() override;
108 virtual void undo();
109 public:
110 Resource<MeasureMode> measure_mode;
111 protected:
112 virtual void begin() override;
113
114 void autoName(const Model& model, uint04 index);
115 void calculateSolid(Geometry& mesh);
116 void createRootModel();
117 virtual SelectionInfo createSelectionInfo(const MouseEvent& event, Camera* camera) override;
118 void updatePrimitive(const Vertex<3, fltp08>& world_location, Camera* camera);
119 void onSelect(Camera* camera);
120 static Vector<3, Angle<fltp08>> getOrientation(const Vector<3, fltp08>& lookat, const Vector<3, fltp08>& up);
121 virtual bool processMouseEvent(const MouseEvent& mouse_event, DesignObjectLookup* lookup, Camera* camera) override;
122 virtual bool processKeyEvent(const KeyEvent& event, DesignObjectLookup* lookup, Camera* camera) override;
123 void processResizeEvent(const MeasureMode& spec, Model& model, Camera* camera);
124 protected:
125 void updateSnapIcon();
126 protected:
127 CommandLockObject m_command_lock;
128 PointMeasureModel m_point_model;
129 DistanceMeasureModel m_distance_measure_model;
130 #if NDEVR_CROSS_SECTION
131 CrossSectionModel m_cross_section_model;
132 #endif
133 AngleMeasureModel m_angle_measure_model;
134 AngleMode m_angle_mode = AngleMode::e_track_mouse;
135 TranslatedString m_point_naming_format;
136 TranslatedString m_distance_naming_format;
137 TranslatedString m_angle_naming_format;
138 TranslatedString m_root_name;
139 Plane<3, fltp08> m_draw_plane;
140 Vector<3, fltp08> m_cross_section_spacing;
141 UUID m_current_model;
142 UUID m_root_model;
143 UUID m_id;
144 BitFlag m_point_type;
145 BitFlag m_line_edge_type;
146 bool m_auto_wind_shapes;
147 bool m_generate_normals;
148 bool m_lock_movement;
149 bool m_is_moving;
150 bool m_is_touch_mode;
151 bool m_use_line_leader;
152 bool m_use_point_leader;
153 bool m_use_cross_sectional_centerline;
154 bool m_autoset_lock_plane = true;
155 };
156 template class NDEVR_DESIGN_API StringStream<MeasurementManager::MeasureMode>;
157}
158#endif
159
160
#define NDEVR_DESIGN_API
Definition DLLInfo.h:77
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:98