API Documentation
Loading...
Searching...
No Matches
MeasurementModels.h
Go to the documentation of this file.
1#pragma once
2#include <NDEVR/Model.h>
3#if NDEVR_MEASURE_MODELS
4namespace NDEVR
5{
6 class Text;
7 /**--------------------------------------------------------------------------------------------------
8 \brief Potential decorations that can be used together to represent a point in 3D space
9 **/
10 enum MeasurePointType
11 {
12 e_label
13 , e_leader
14 , e_90_crosshair
15 , e_45_crosshair
16 , e_square
17 , e_circle
18 , e_arrow
19 , e_measure_point_size
20 };
21 /**--------------------------------------------------------------------------------------------------
22 \brief The default layer for all Measurement Models
23 **/
24 NDEVR_DESIGN_API Model MeasurementLayer(Scene& scene);
25 /**--------------------------------------------------------------------------------------------------
26 \brief Typename for a container of Measurement
27 **/
28 static constexpr const char* MeasureGroupTypeName() { return "measurement_group"; }
29
30 /**--------------------------------------------------------------------------------------------------
31 \brief A Model which represents the measurement of a single point
32 **/
33 class NDEVR_DESIGN_API PointMeasureModel : public Model
34 {
35 public:
36 PointMeasureModel();
37 PointMeasureModel(const Model& model);
38 Model pointMeasurementLayer();
39 void setupDecoration();
40 static constexpr const char* TypeName() { return "point_measurement"; }
41 static constexpr const char* SubTypeName() { return "sub_point_measurement"; }
42 static constexpr const char* DecorationTypeName() { return "point_measurement_decoration"; }
43 void setPoint(const Vertex<3, fltp08>& location);
44 void setPoint(const Vertex<3, fltp08>& location, const Vertex<3, fltp08>& leader);
45 void setPointAndDirection(const Vertex<3, fltp08>& location, const Ray<3, fltp08>& direction);
46 void setLabel(const TranslatedString& label);
47 void setLabel(const String& label);
48 void setFont(const Font& font);
49 void setPointTypes(BitFlag pt_types);
50 void setMarkerScale(fltp08 scale);
51 void updateGeometry();
52 Vertex<3, fltp08> measurementPoint() const;
53 protected:
54 void setupGeometry(MeasurePointType pt_type);
55 void setup90Crosshairs(Geometry geo);
56 void setup45Crosshairs(Geometry geo);
57 void setupSquare(Geometry geo);
58 void setupCircle(Geometry geo);
59 void setupArrow(Geometry geo);
60 };
61
62 /**--------------------------------------------------------------------------------------------------
63 \brief A Model which represents the measurement of 2 points, and potentially the distance between them.
64 **/
65 class NDEVR_DESIGN_API DistanceMeasureModel : public Model
66 {
67 public:
68 DistanceMeasureModel();
69 DistanceMeasureModel(const Model& model);
70 void setPointTypes(BitFlag pt_types);
71 void setMarkerScale(fltp08 thickness);
72 static constexpr const char* TypeName() { return "distance_measurement"; }
73 static constexpr const char* DecorationTypeName() { return "distance_measurement_decoration"; }
74 void setEndpoints(const Vertex<3, fltp08>& p1, const Vertex<3, fltp08>& p2, const Vertex<3, fltp08>& leader = Constant<Vertex<3, fltp08>>::Invalid);
75 void setLabel(const TranslatedString& label);
76 void setFont(const Font& font);
77 void updateGeometry();
78 void setupDecoration();
79 Model distanceMeasurementLayer();
80 Text labelModel() const;
81 LineSegment<3, fltp08> measurementLine() const;
82 protected:
83 Model decoration() const;
84 PointMeasureModel endPoint(uint04 endpoint_number) const;
85 };
86
87 /**--------------------------------------------------------------------------------------------------
88 \brief A Model which represents a measured angle.
89 **/
90 class NDEVR_DESIGN_API AngleMeasureModel : public Model
91 {
92 public:
93 AngleMeasureModel();
94 AngleMeasureModel(const Model& model);
95
96 static constexpr const char* TypeName() { return "angle_measurement"; }
97 static constexpr const char* DecorationTypeName() { return "angle_measurement_decoration"; }
98 void setPoints(Vertex<3, fltp08> start, Vertex<3, fltp08> middle, Vertex<3, fltp08> end, Vertex<3, fltp08> perspective);
99 void setLabel(const TranslatedString& label);
100 void setFixedClockwise(bool clockwise);
101 void clearFixedClockwise();
102 Angle<fltp08> measurementAngle() const;
103 bool isClockwise() const;
104 protected:
105 Model decoration();
106 void init();
107 void updateGeometry();
108
109 };
110}
111#endif
#define NDEVR_DESIGN_API
Definition DLLInfo.h:55
Definition ACIColor.h:37