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>
50 enum class DeploymentQualityFactor
56 , e_warning_magnetometer
66 struct DeploymentRecord
75 UUID id = Constant<UUID>::Invalid;
76 DeploymentQualityFactor quality_factor = DeploymentQualityFactor::e_none;
83 bool operator==(
const DeploymentRecord& record)
const
85 return memcmp(
this, &record,
sizeof(DeploymentRecord)) == 0;
93 bool operator!=(
const DeploymentRecord& record)
const
95 return memcmp(
this, &record,
sizeof(DeploymentRecord)) != 0;
105 class NDEVR_DESIGN_API Deployment :
public Model
117 explicit Deployment(
const Model& root);
126 Model addSegment(
const Vector<3, fltp08>& location,
bool animate =
false,
bool calc_linework =
true);
136 Model addSegment(fltp08 distance, Vector<3, Angle<sint04>> tilt,
bool animate =
false,
bool calc_linework =
true);
147 Model addSegment(fltp08 distance, Vector<3, Angle<sint04>> tilt,
const Unit& unit,
bool animate =
false,
bool calc_linework =
true);
157 Model addSegment(fltp08 distance, Vector<3, Angle<fltp08>> tilt,
bool animate =
false,
bool calc_linework =
true);
168 Model addSegment(fltp08 distance, Vector<3, Angle<fltp08>> tilt,
const Unit& unit,
bool animate =
false,
bool calc_linework =
true);
175 Model segment(uint04 index)
const;
182 void setQualityFactor(uint04 segment, DeploymentQualityFactor is_valid);
189 static StringView QualityFactorIcon(DeploymentQualityFactor factor);
196 static DeploymentQualityFactor QualityFactorIcon(
const StringView& factor);
203 void addSegments(
const Buffer<Vertex<3, fltp08>>& locations,
const Buffer<Time>& times = Buffer<Time>());
209 Model deploymentLayer();
215 DeploymentQualityFactor deploymentQuality()
const;
221 static UUID DeploymentLayerUUID();
227 void ensureModelFormat(uint08 version);
233 Model plannedLayer();
239 static UUID PlannedLayerUUID();
245 Model& deploymentLinework() {
return m_linework_model; }
251 Model& deploymentModels() {
return m_deployment_model; }
257 Model& visualModel() {
return m_deployment; }
264 void removeSegment(uint04 segment_index,
bool update_linework =
true);
269 void removeAllSegments();
275 void straightenSegment(uint04 segment_index);
281 Vertex<3, fltp08> endPoint()
const;
287 void updateEndpoint(
const Vertex<3, fltp08>& end_point);
293 Vector<3, Angle<fltp08>> lastTilt()
const;
299 const Buffer<DeploymentRecord>& records()
const;
305 fltp08 deploymentLength()
const;
311 fltp08 currentLocationLength()
const;
317 Vertex<3, fltp08> currentLocation()
const;
324 fltp08 addToLocationLengthAndReturnRemainder(fltp08 length);
330 void setCurrentLocationLength(fltp08 length);
336 uint04 recordCount()
const;
343 void setUseTube(Geometry::ThicknessMode mode, fltp08 radius);
349 fltp08 tubeThickness()
const;
359 void updateIconFromReadings();
366 fltp08 locationAt(
const Vertex<3, fltp08>& location)
const;
373 Vertex<3, fltp08> pointAtLength(fltp08 location)
const;
379 StationModel getStation()
const;
385 Calibration getCalibration()
const;
391 Effect invalidSegmentEffect();
397 Effect growEffect()
const;
403 bool isHorizontal()
const;
409 bool isVertical()
const;
414 void cancelGrowEffect();
420 bool hasMissingRecords()
const;
426 void updateLineworkFromRecords(uint04 start_index = 0);
432 void updateModelsFromRecords(uint04 start_index = 0);
449 uint04 adjustTilt(
const Time& time,
const Vector<3, Angle<sint04>>& angle, TimeSpan max_time = TimeSpan(2.0));
458 uint04 adjustTilt(
const Time& time,
const Vector<3, Angle<fltp08>>& angle, TimeSpan max_time = TimeSpan(2.0));
465 void adjustLength(uint04 segment, fltp08 length);
472 void adjustTilt(uint04 segment,
const Vector<3, Angle<fltp08>>& angle);
478 Polyline<3, fltp08> toPolyline()
const;
489 bool isPlanned()
const;
495 void setIsPlanned(
bool is_design);
501 void setupAsDefaultPlanned(
bool add_segment);
507 Deployment getPlanned()
const;
512 void setupInvalidEffect();
519 static Deployment GetAssociatedPlan(
const Model& model);
525 static constexpr StringView TypeName() {
return "deployment"; }
531 static constexpr StringView DecorationTypeName() {
return "deployment_decoration"; }
533 static DynamicPointer<Model> s_deployment_model;
539 static void SetupMaterialToLayerDefaults(Material& mat);
545 UUID growTarget()
const;
551 uint04 segmentCount()
const;
556 void setupDeploymentModel();
561 void createSegmentChild();
566 void setupLineworkGeometry();
572 void calculateRecords(uint04 segment = 0)
const;
578 void updateRecordLocations(uint04 segment = 0)
const;
585 void setRecord(uint04 index,
const DeploymentRecord& record)
const;
595 void validateRecords()
const;
600 void ensureRecordsCached()
const;
603 mutable Buffer<DeploymentRecord> m_cached_records;
604 mutable Time m_record_cache_time;
606 Model m_deployment_model;
607 Model m_linework_model;
Stores an angle in an optimized internal format with support for efficient trigonometric operations.
A core class where all Design Objects including models, materials, and geometries are stored.
A core class that represents a node on model hierarchy.
Logic for reading or writing to a string or a user friendly, TranslatedString.
Represents a timestamp with utilities for manipulation and conversion.
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
A fixed-size array with N dimensions used as the basis for geometric and mathematical types.
A point in N-dimensional space, used primarily for spatial location information.
The primary namespace for the NDEVR SDK.
constexpr bool operator!=(const Vector< t_dims, t_type > &vec_a, const Vector< t_dims, t_type > &vec_b)
Inequality operator.
constexpr HSLColor Constant< HSLColor >::Invalid
The invalid HSLColor constant with all components set to invalid.
@ e_none
No defined value type.
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
double fltp08
Defines an alias representing an 8 byte floating-point number.
@ DEGREES
Angle measured in degrees (0 to 360 for a full circle).
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...
Defines a unit of measurement for converting and displaying data values.