NDEVR
API Documentation
MeasurementModels.h
1#pragma once
2#include <NDEVR/Model.h>
3#if NDEVR_MEASURE_MODELS
4namespace NDEVR
5{
6 class Text;
10 enum MeasurePointType : uint01
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 };
26 NDEVR_DESIGN_API Model MeasurementLayer(Scene& scene);
31 static constexpr StringView MeasureGroupTypeName() { return StringView("measurement_group"); }
32
40 class NDEVR_DESIGN_API PointMeasureModel : public Model
41 {
42 public:
46 PointMeasureModel();
51 PointMeasureModel(const Model& model);
57 PointMeasureModel(const Model& model, Vector<7, Geometry>& markers);
62 Model pointMeasurementLayer();
67 void setupDecoration(Vector<7, Geometry>& geos);
72 static constexpr StringView TypeName() { return ("point_measurement"); }
77 static constexpr StringView SubTypeName() { return "sub_point_measurement"; }
82 static constexpr StringView DecorationTypeName() { return "point_measurement_decoration"; }
87 void setPoint(const Vertex<3, fltp08>& location);
93 void setPoint(const Vertex<3, fltp08>& location, const Vertex<3, fltp08>& leader);
99 void setPointAndDirection(const Vertex<3, fltp08>& location, const Ray<3, fltp08>& direction);
104 void setLabel(const TranslatedString& label);
109 Model labelModel() const;
114 void setLabel(const StringView& label);
119 void setFont(const Font& font);
124 void setPointTypes(BitFlag pt_types);
130 void setPointTypes(BitFlag pt_types, Vector<7, Geometry>& markers);
135 void setMarkerScale(fltp08 scale);
139 void updateGeometry();
146 static Vector<7, Geometry> DefaultMarkers(const Scene& scene, BitFlag pt_types = BitFlag(0));
153 static void DefaultMarkers(const Scene& scene, BitFlag pt_types, Vector<7, Geometry>& geos);
159 static void SetDefaultMarkers(Scene& scene, Vector<7, Geometry>& markers);
164 Vertex<3, fltp08> measurementPoint() const;
169 Vector<7, Geometry> typeGeometry();
170 protected:
177 static void setupGeometry(MeasurePointType pt_type, Model geo_item, Vector<7, Geometry>& geos);
182 static void Setup90Crosshairs(Geometry geo);
187 static void Setup45Crosshairs(Geometry geo);
192 static void SetupSquare(Geometry geo);
197 static void SetupCircle(Geometry geo);
202 static void SetupArrow(Geometry geo);
208 void _setPointTypes(BitFlag pt_types, Vector<7, Geometry>& geos);
209 };
210
218 class NDEVR_DESIGN_API DistanceMeasureModel : public Model
219 {
220 public:
224 DistanceMeasureModel();
229 DistanceMeasureModel(const Model& model);
235 DistanceMeasureModel(const Model& model, Vector<7, Geometry>& markers);
240 void setPointTypes(BitFlag pt_types);
246 void setPointTypes(BitFlag pt_types, Vector<7, Geometry>& markers);
251 void setMarkerScale(fltp08 thickness);
256 static constexpr StringView TypeName() { return "distance_measurement"; }
261 static constexpr StringView DecorationTypeName() { return "distance_measurement_decoration"; }
268 void setEndpoints(const Vertex<3, fltp08>& p1, const Vertex<3, fltp08>& p2, const Vertex<3, fltp08>& leader = Constant<Vertex<3, fltp08>>::Invalid);
273 void setLabel(const TranslatedString& label);
278 void setFont(const Font& font);
282 void updateGeometry();
287 void setupDecoration(Vector<7, Geometry>& geos);
292 Model distanceMeasurementLayer();
297 Text labelModel() const;
303 static Vector<7, Geometry> DefaultMarkers(const Scene& scene);
308 LineSegment<3, fltp08> measurementLine() const;
309 protected:
314 Model decoration() const;
320 PointMeasureModel endPoint(uint04 endpoint_number) const;
321 };
322
330 class NDEVR_DESIGN_API AngleMeasureModel : public Model
331 {
332 public:
336 AngleMeasureModel();
341 AngleMeasureModel(const Model& model);
346 void setFont(const Font& font);
351 static constexpr StringView TypeName() { return "angle_measurement"; }
356 static constexpr StringView DecorationTypeName() { return "angle_measurement_decoration"; }
364 void setPoints(Vertex<3, fltp08> start, Vertex<3, fltp08> middle, Vertex<3, fltp08> end, Vertex<3, fltp08> perspective);
369 void setLabel(const TranslatedString& label);
374 void setFixedClockwise(bool clockwise);
378 void clearFixedClockwise();
383 Angle<fltp08> measurementAngle() const;
388 bool isClockwise() const;
389 protected:
394 Model decoration();
401 void init();
405 void updateGeometry();
406
407 };
408}
409#endif
A core class that represents a node on model hierarchy.
Definition Model.h:292
The root Model that is responsible for storing the underlying data for all Scene Models.
Definition Scene.h:52
The core String View class for the NDEVR API.
Definition StringView.h:58
The primary namespace for the NDEVR SDK.
@ BitFlag
Per-vertex bit flags (selected, hidden, etc.).
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...