33#include <NDEVR/Vector.h>
34#include <NDEVR/Buffer.h>
35#include <NDEVR/Model.h>
36#include <NDEVR/Geometry.h>
37#include <NDEVR/TimeSpan.h>
38#include <NDEVR/Angle.h>
43 class DesignObjectLookup;
47 enum class DeploymentQualityFactor
53 , e_warning_magnetometer
62 struct DeploymentRecord
64 Vector<3, Angle<fltp08>> computed_orientation = Vector<3, Angle<fltp08>>(Angle<fltp08>(
DEGREES, 0.0));
65 Vector<3, Angle<fltp08>> measured_orientation = Vector<3, Angle<fltp08>>(Angle<fltp08>(
DEGREES, 0.0));
69 Vertex<3, fltp08> location = Constant<Vertex<3, fltp08>>::NaN;
70 Ray<3, fltp08> direction = Constant<Vertex<3, fltp08>>::NaN;
72 DeploymentQualityFactor quality_factor = DeploymentQualityFactor::e_none;
73 bool operator==(
const DeploymentRecord& record)
const
75 return memcmp(
this, &record,
sizeof(DeploymentRecord)) == 0;
77 bool operator!=(
const DeploymentRecord& record)
const
79 return memcmp(
this, &record,
sizeof(DeploymentRecord)) != 0;
88 explicit Deployment(
const Model& root);
90 Model addSegment(
const Vector<3, fltp08>& location,
bool animate =
false,
bool calc_linework =
true);
91 Model addSegment(fltp08 distance, Vector<3, Angle<sint04>> tilt,
bool animate =
false,
bool calc_linework =
true);
92 Model addSegment(fltp08 distance, Vector<3, Angle<sint04>> tilt,
const Unit& unit,
bool animate =
false,
bool calc_linework =
true);
93 Model addSegment(fltp08 distance, Vector<3, Angle<fltp08>> tilt,
bool animate =
false,
bool calc_linework =
true);
94 Model addSegment(fltp08 distance, Vector<3, Angle<fltp08>> tilt,
const Unit& unit,
bool animate =
false,
bool calc_linework =
true);
95 Model segment(uint04 index)
const;
96 void setQualityFactor(uint04 segment, DeploymentQualityFactor is_valid);
97 static String QualityFactorIcon(DeploymentQualityFactor factor);
98 static DeploymentQualityFactor QualityFactorIcon(
const String& factor);
99 void addSegments(
const Buffer<Vertex<3, fltp08>>& locations,
const Buffer<Time>& times = Buffer<Time>());
100 Model deploymentLayer();
101 DeploymentQualityFactor deploymentQuality()
const;
102 static UUID DeploymentLayerUUID();
103 void ensureModelFormat(uint08 version);
104 Model plannedLayer();
105 static UUID PlannedLayerUUID();
106 Model& deploymentLinework() {
return m_linework_model; }
107 Model& deploymentModels() {
return m_boretrak_model; }
108 Model& visualModel() {
return m_deployment; }
109 void removeSegment(uint04 segment_index,
bool update_linework =
true);
110 void removeAllSegments();
111 void straightenSegment(uint04 segment_index);
112 Vertex<3, fltp08> endPoint()
const;
113 void updateEndpoint(
const Vertex<3, fltp08>& end_point);
114 Vector<3, Angle<fltp08>> lastTilt()
const;
115 const Buffer<DeploymentRecord>& records()
const;
116 fltp08 deploymentLength()
const;
117 fltp08 currentLocationLength()
const;
118 Vertex<3, fltp08> currentLocation()
const;
119 fltp08 addToLocationLengthAndReturnRemainder(fltp08 length);
120 void setCurrentLocationLength(fltp08 length);
121 uint04 recordCount()
const;
122 void setUseTube(Geometry::ThicknessMode mode, fltp08 radius);
123 fltp08 tubeThickness()
const;
125 void updateIconFromReadings();
126 fltp08 locationAt(
const Vertex<3, fltp08>& location)
const;
127 Vertex<3, fltp08> pointAtLength(fltp08 location)
const;
128 StationModel getStation()
const;
129 Calibration getCalibration()
const;
132 Effect invalidSegmentEffect();
133 Effect growEffect()
const;
134 bool isHorizontal()
const;
135 bool isVertical()
const;
136 void cancelGrowEffect();
137 bool hasMissingRecords()
const;
138 void updateLineworkFromRecords(uint04 start_index = 0);
139 void updateModelsFromRecords(uint04 start_index = 0);
150 uint04 adjustTilt(
const Time& time,
const Vector<3, Angle<sint04>>& angle, TimeSpan max_time = TimeSpan(2.0));
151 uint04 adjustTilt(
const Time& time,
const Vector<3, Angle<fltp08>>& angle, TimeSpan max_time = TimeSpan(2.0));
152 void adjustLength(uint04 segment, fltp08 length);
153 void adjustTilt(uint04 segment,
const Vector<3, Angle<fltp08>>& angle);
154 Polyline<3, fltp08> toPolyline()
const;
156 bool isPlanned()
const;
157 void setIsPlanned(
bool is_design);
158 void setupAsDefaultPlanned(
bool add_segment);
159 Deployment getPlanned()
const;
160 void setupInvalidEffect();
161 static Deployment GetAssociatedPlan(
const Model& model);
162 static constexpr const char* TypeName() {
return "deployment"; }
163 static constexpr const char* DecorationTypeName() {
return "deployment_decoration"; }
164 static DynamicPointer<Model> s_deployment_model;
165 static void SetupMaterialToLayerDefaults(Material& mat);
167 UUID growTarget()
const;
168 uint04 segmentCount()
const;
169 void setupBoretrakModel();
170 void createSegmentChild();
171 void setupLineworkGeometry();
172 void calculateRecords(uint04 segment = 0)
const;
173 void updateRecordLocations(uint04 segment = 0)
const;
174 void setRecord(uint04 index,
const DeploymentRecord& record)
const;
176 void validateRecords()
const;
177 void ensureRecordsCached()
const;
180 mutable Buffer<DeploymentRecord> m_cached_records;
181 mutable Time m_record_cache_time;
183 Model m_boretrak_model;
184 Model m_linework_model;
bool operator==(const char(&v1)[t_size], const String &v2)
Definition String.h:437
constexpr bool operator!=(const Vector< t_dims, t_type > &vec_a, const Vector< t_dims, t_type > &vec_b)
Definition Vector.hpp:724
@ DEGREES
Definition Angle.h:66
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:120
double fltp08
Defines an alias representing an 8 byte floating-point number.
Definition BaseValues.hpp:181
static const t_type NaN
Definition BaseValues.hpp:274