NDEVR
API Documentation
LocationOperations.h
1#pragma once
2#include "DLLInfo.h"
3#include <NDEVR/Model.h>
4#include <NDEVR/Vertex.h>
5namespace NDEVR
6{
13 class NDEVR_DESIGN_API LocationOperations : public Model
14 {
15 public:
26
31
36 explicit LocationOperations(const Model& model);
37
43 void setLocation(const Vertex<3, fltp08>& location);
44
49 void setReferenceObject(const Model& reference);
50
55 void setReferenceObject(const UUID& reference);
56
66 void setReferenceObject(const UUID& reference, const Vector<3, Angle<fltp08>>& angle, fltp08 distance, bool is_location_relative);
67
76 void setReferenceObject(const Model& reference, const Vector<3, Angle<sint04>>& angle, fltp08 distance, bool is_location_relative);
77
85 void setReferenceObject(const Model& reference, const Vector<3, Angle<fltp08>>& angle, fltp08 distance, bool is_location_relative);
86
92
99
105
111
117
122 void setLocationType(const LocationType& type);
123
132
139
145
152
158 bool isPrismEditable(uint04 location) const;
159
167 void setPrismLocation(uint04 index, const Vertex<3, fltp08>& vertex, bool is_editable);
168
174
180
186
192
199
206 void setPrismOffset(const Vector<3, fltp08>& prism_offset, bool is_editable);
207
216 static bool HasDependency(const Model& object, const Model& potential_dependecy, DesignObjectLookup* lookup);
217
226 static bool HasDependency(const Model& object, const Model& potential_dependecy, const Buffer<Model>& models);
227
239 Vertex<3, fltp08> calculateFromLocation(const Vertex<3, fltp08>& location, const Vector<3, Angle<fltp08>>& angle, fltp08 distance, bool is_location_relative);
240 protected:
252 Vertex<3, fltp08> calculateFromReference(const Model& reference, const Vector<3, Angle<fltp08>>& angle, fltp08 distance, bool is_location_relative, const void* lock = nullptr);
253 };
254}
Stores an angle in an optimized internal format with support for efficient trigonometric operations.
Definition Angle.h:83
The equivelent of std::vector but with a bit more control.
Definition Buffer.hpp:58
A core class where all Design Objects including models, materials, and geometries are stored.
uint04 index() const
Returns the primary row index of this object within the DesignObjectBase property table.
static bool HasDependency(const Model &object, const Model &potential_dependecy, DesignObjectLookup *lookup)
Checks whether a model has a location dependency on another model by walking the reference chain.
void setLocationType(const LocationType &type)
Sets the LocationType that determines how this object's position is computed.
static bool HasDependency(const Model &object, const Model &potential_dependecy, const Buffer< Model > &models)
Checks whether a model has a location dependency on another model by walking the reference chain,...
LocationOperations()
Default constructor.
void setPrismOffset(const Vector< 3, fltp08 > &prism_offset, bool is_editable)
Sets the active prism offset and editability.
void setPrismLocation(uint04 index, const Vertex< 3, fltp08 > &vertex, bool is_editable)
Sets the location and editability of a prism target at the given index.
void updateLocation(DesignObjectLookup *lookup)
Recomputes this object's location based on the current LocationType and reference model state.
LocationOperations(const Model &model)
Wraps an existing Model as a LocationOperations object.
void setReferenceObject(const Model &reference)
Sets the reference object by Model, storing its UUID as the location reference.
LocationType
Defines how the location of this object is determined.
@ e_same_as_model
Location mirrors the position of a reference model exactly.
@ e_relative_to_model_w_distance_angle
Location is computed relative to a reference model using a distance and angle offset.
@ e_location
Location is set directly as an absolute position.
@ e_none
No location behavior assigned.
Vertex< 3, fltp08 > calculateFromReference(const Model &reference, const Vector< 3, Angle< fltp08 > > &angle, fltp08 distance, bool is_location_relative, const void *lock=nullptr)
Computes a world-space position from a reference Model's transform, angular offset,...
Vertex< 3, fltp08 > prismLocation(uint04 index) const
Returns the 3D offset for a prism target at the given index.
void setLocation(const Vertex< 3, fltp08 > &location)
Sets the absolute world-space location of this object, updating both the transform matrix and the sto...
Vector< 3, Angle< fltp08 > > relativeAngle() const
Returns the stored angular offset used to compute this object's position relative to its reference mo...
bool isPrismEditable(uint04 location) const
Checks whether the prism at the given index is user-editable.
Vertex< 3, fltp08 > activePrismOffset() const
Returns the 3D offset of the currently active prism target.
LocationType locationType() const
Returns the current LocationType describing how this object's position is determined.
void setReferenceObject(const Model &reference, const Vector< 3, Angle< sint04 > > &angle, fltp08 distance, bool is_location_relative)
Sets the reference object by Model with integer-typed angle offsets, which are converted to floating-...
void autoUpdateLocationType()
Automatically determines and sets the LocationType based on current metadata.
UUID referenceID() const
Returns the UUID of the primary reference model used for location computation.
void setReferenceObject(const Model &reference, const Vector< 3, Angle< fltp08 > > &angle, fltp08 distance, bool is_location_relative)
Sets the reference object by Model with floating-point angle offsets.
void setReferenceObject(const UUID &reference, const Vector< 3, Angle< fltp08 > > &angle, fltp08 distance, bool is_location_relative)
Sets the reference object by UUID along with angle, distance, and relativity parameters that define t...
bool activePrismEditable() const
Checks whether the currently active prism target is user-editable.
UUID referenceModelA() const
Returns the UUID of the primary reference model (alias for referenceID).
uint04 activePrismIndex() const
Returns the index of the currently active prism target.
void setReferenceObject(const UUID &reference)
Sets the reference object by UUID, storing it as the location reference.
Vertex< 3, fltp08 > calculateFromLocation(const Vertex< 3, fltp08 > &location, const Vector< 3, Angle< fltp08 > > &angle, fltp08 distance, bool is_location_relative)
Computes a world-space position from a reference location, angular offset, and distance.
uint04 prismCount() const
Returns the total number of prism targets defined on this object.
fltp08 relativeDistance() const
Returns the stored scalar distance offset from the reference model.
void setReferenceDistance(fltp08 distance)
Updates the stored distance offset used when computing location relative to a reference model.
void setActivePrismIndex(uint04 index)
Sets the active prism index and updates the active prism offset and editability accordingly.
Model()
Default constructor. Creates an uninitialized Model.
Definition Model.h:365
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:61
A fixed-size array with N dimensions used as the basis for geometric and mathematical types.
Definition Vector.hpp:62
A point in N-dimensional space, used primarily for spatial location information.
Definition Vertex.hpp:44
The primary namespace for the NDEVR SDK.
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.