2#include <NDEVR/DesignCommand.h>
3#include <NDEVR/Model.h>
4#include <NDEVR/Geometry.h>
5#include <NDEVR/Material.h>
6#include <NDEVR/Pointer.h>
21 , e_set_geometry_property
22 , e_set_material_property
23 , e_set_model_property
24 , e_set_model_material_mode
25 , e_set_design_property
33 , e_fill_holes_by_neighbor
36 , e_calculate_tangents
43 , e_set_real_thickness
46 , e_set_UV_property_channel
49 , e_delete_enclosed_area
55 , e_read_from_database
61 , e_set_active_filters
62 , e_add_active_filters
63 , e_slice_into_polylines
74 template<
class t_arg_type>
76 : command_type(command)
78 setParams(
String(param_a));
80 template<
class t_arg_type_a,
class t_arg_type_b>
82 : command_type(command)
86 template<
class t_arg_type_a,
class t_arg_type_b,
class t_arg_type_c>
88 : command_type(command)
92 template<
class t_arg_type_a,
class t_arg_type_b,
class t_arg_type_c,
class t_arg_type_d>
94 : command_type(command)
102 m_command_params = params;
110 return m_command_params;
114 auto iter = m_undo_params.find(uuid);
115 if (iter == m_undo_params.end())
124 return m_undo_params;
128 return m_undo_params;
130 template<
class t_arg_type>
133 if(!m_undo_params.hasKey(uuid))
134 m_undo_params.insert({ uuid, {
String(params)} });
136 template<
class t_arg_type_a,
class t_arg_type_b>
139 if (!m_undo_params.hasKey(uuid))
140 m_undo_params.insert({ uuid, {
String(param_a),
String(param_b)} });
142 template<
class t_arg_type_a,
class t_arg_type_b,
class t_arg_type_c>
143 void setUndoParams(
const UUID& uuid,
const t_arg_type_a& param_a,
const t_arg_type_b& param_b,
const t_arg_type_c& param_c)
145 if (!m_undo_params.hasKey(uuid))
150 return m_undo_params.hasKey(uuid);
158 m_undo_params.erase(uuid);
170 template<
class t_type>
175 template<
class t_type>
180 template<
class t_type>
189 template<
class t_type>
240 return new ManagedDesignCommand(e_smooth_laplacian, number_of_iterations, shrink_rate, grow_rate);
244 return new ManagedDesignCommand(e_smooth_cotangent, number_of_iterations, shrink_rate, grow_rate);
246 template<
class t_type>
369 String name = this->name().translation(
"en_US");
370 if (targets.size() > 0)
373 for (
const UUID& target_id : targets)
375 name +=
String(target_id) +
",";
383 if (params().size() > 0)
386 for (
const String& param : params())
388 name +=
String(param) +
"|";
The primary angle storage class for this API. Stores an angle in an optimized format.
Definition StringStream.h:408
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:59
void add(t_type &&object)
Definition Buffer.hpp:211
decltype(auto) last()
Definition Buffer.hpp:930
A command for safely modifying something in a DesignObjectLookup. Modifications will be done in a sep...
Definition DesignCommand.h:52
DesignProperty
Definition DesignObject.h:94
A core class where all Design Objects including models, materials, and geometries are stored.
Definition DesignObjectLookup.h:65
A hash-based key-value store, useful for quick associative lookups.
Definition Dictionary.h:59
Provides a modifiable pointer that has shared ownership of a dynamically allocated object.
Definition Pointer.hpp:319
GeometryProperty
Definition Geometry.h:89
A specified type of DesignCommand that performs common actions such as grouping or setting.
Definition ManagedDesignCommand.h:14
static DynamicPointer< DesignCommand > SetUVColor(const RGBColor &uv_color)
Definition ManagedDesignCommand.h:267
static DynamicPointer< DesignCommand > Explode()
Definition ManagedDesignCommand.h:283
bool isAsyncExecution() const override
const Dictionary< UUID, Buffer< String > > & undoParams() const
Definition ManagedDesignCommand.h:122
static DynamicPointer< DesignCommand > CalculateTangents(bool calc_tangent, bool calc_bitangent)
Definition ManagedDesignCommand.h:343
static DynamicPointer< DesignCommand > SetUVImage(UVType uv_type, const String &uv_image)
Definition ManagedDesignCommand.h:275
static DynamicPointer< DesignCommand > ScaleObject(const fltp08 &scale)
Definition ManagedDesignCommand.h:210
static DynamicPointer< DesignCommand > SetMaterialProperty(Material::MaterialProperties mat_property, const t_type &value)
Definition ManagedDesignCommand.h:176
static DynamicPointer< DesignCommand > SetMetadata(const String &label, const String &value)
Definition ManagedDesignCommand.h:359
static DynamicPointer< DesignCommand > ValidateCommand()
Definition ManagedDesignCommand.h:206
Buffer< String > m_command_params
Definition ManagedDesignCommand.h:402
CommandType
Definition ManagedDesignCommand.h:17
static DynamicPointer< DesignCommand > SmoothCotangentCommand(uint04 number_of_iterations)
Definition ManagedDesignCommand.h:234
static DynamicPointer< DesignCommand > SetWindingMode(WindingMode mode)
Definition ManagedDesignCommand.h:303
String toString() const
Definition ManagedDesignCommand.h:367
virtual TranslatedString name() const override
static DynamicPointer< DesignCommand > RemoveSmoothingCommand()
Definition ManagedDesignCommand.h:251
CommandType command_type
Definition ManagedDesignCommand.h:401
static DynamicPointer< DesignCommand > ClearAll()
Definition ManagedDesignCommand.h:363
static DynamicPointer< DesignCommand > SetProperty(DesignObject::DesignProperty design_property, const t_type &value)
Definition ManagedDesignCommand.h:190
static DynamicPointer< DesignCommand > SliceIntoPolylines(const Matrix< fltp08 > &transform, const Vector< 3, fltp08 > &spacing)
Definition ManagedDesignCommand.h:347
void deleteEnclosedSelection(DesignObjectLookup *lookup)
static DynamicPointer< DesignCommand > UpdateVertex(VertexProperty property, uint04 vertex_id, const t_type &new_location)
Definition ManagedDesignCommand.h:247
bool hasUndo(const UUID &uuid) const
Definition ManagedDesignCommand.h:148
static DynamicPointer< DesignCommand > SetUVIntensity(UVType uv_type, fltp08 uv_intensity)
Definition ManagedDesignCommand.h:291
static DynamicPointer< DesignCommand > ScaleObject(const Vector< 3, fltp08 > &scale)
Definition ManagedDesignCommand.h:214
static DynamicPointer< DesignCommand > SetNormalMode(NormalMode mode, Angle< fltp08 > smooth_angle)
Definition ManagedDesignCommand.h:331
static DynamicPointer< DesignCommand > SetUVPropertyChannel(UVType uv_type, String uv_channel)
Definition ManagedDesignCommand.h:295
static DynamicPointer< DesignCommand > SetRealThickness(fltp08 real_thickness)
Definition ManagedDesignCommand.h:226
static DynamicPointer< DesignCommand > SetModelProperty(Model::ModelProperty mod_property, const t_type &value)
Definition ManagedDesignCommand.h:181
static DynamicPointer< DesignCommand > Delete()
Definition ManagedDesignCommand.h:194
void setUndoParams(const UUID &uuid, const t_arg_type ¶ms)
Definition ManagedDesignCommand.h:131
static DynamicPointer< DesignCommand > MakeClosedSolid(bool is_closed_solid)
Definition ManagedDesignCommand.h:307
static DynamicPointer< DesignCommand > ScaleObject(const fltp08 &scale, const Vector< 3, fltp08 > &scale_center)
Definition ManagedDesignCommand.h:218
static DynamicPointer< DesignCommand > SetModelMaterialMode(PrimitiveProperty property, Model::MaterialMode mode)
Definition ManagedDesignCommand.h:185
static DynamicPointer< DesignCommand > CreateGeometry(const String &name="")
Definition ManagedDesignCommand.h:198
bool canGroupWith(const DynamicPointer< DesignCommand > &command) override
virtual String icon() const override
static DynamicPointer< DesignCommand > PlaceObject(const Matrix< fltp08 > &transform)
Definition ManagedDesignCommand.h:162
const Buffer< String > & params() const
Definition ManagedDesignCommand.h:108
static DynamicPointer< DesignCommand > SetNormalMode(NormalMode mode)
Definition ManagedDesignCommand.h:311
static DynamicPointer< DesignCommand > RemoveDuplicateVertices()
Definition ManagedDesignCommand.h:255
static DynamicPointer< DesignCommand > SmoothCotangentCommand(uint04 number_of_iterations, fltp08 shrink_rate, fltp08 grow_rate)
Definition ManagedDesignCommand.h:242
ManagedDesignCommand(CommandType command, const t_arg_type ¶m_a)
Definition ManagedDesignCommand.h:75
static DynamicPointer< DesignCommand > SmoothLaplacianCommand(uint04 number_of_iterations)
Definition ManagedDesignCommand.h:230
static DynamicPointer< DesignCommand > SendInfo(const String &info)
Definition ManagedDesignCommand.h:355
static DynamicPointer< DesignCommand > SetTransform(const Matrix< fltp08 > &transform)
Definition ManagedDesignCommand.h:166
static DynamicPointer< DesignCommand > Group(const String &model_name=String())
Definition ManagedDesignCommand.h:287
static DynamicPointer< DesignCommand > SetUVColor(UVType uv_type, const RGBColor &uv_color)
Definition ManagedDesignCommand.h:271
static DynamicPointer< DesignCommand > SetActiveFilters(const String &filters)
Definition ManagedDesignCommand.h:315
ManagedDesignCommand(CommandType command, const String ¶ms)
const Buffer< String > & undoParams(const UUID &uuid) const
Definition ManagedDesignCommand.h:112
void setUndoParams(const UUID &uuid, const t_arg_type_a ¶m_a, const t_arg_type_b ¶m_b)
Definition ManagedDesignCommand.h:137
static DynamicPointer< DesignCommand > AutoRegister(const String &filters, const UUID &reference)
Definition ManagedDesignCommand.h:323
static DynamicPointer< DesignCommand > SetUVMode(UVType uv_type, Material::UVMode uv_mode)
Definition ManagedDesignCommand.h:263
void setParams(const String ¶ms)
Definition ManagedDesignCommand.h:104
bool canCombineWith(const DynamicPointer< DesignCommand > &command) override
static DynamicPointer< DesignCommand > RemoveActiveFilter(const uint04 &index)
Definition ManagedDesignCommand.h:327
static DynamicPointer< DesignCommand > FillHolesByNeighbor()
Definition ManagedDesignCommand.h:279
static DynamicPointer< DesignCommand > CalibrateScan(bool calibrate_yaw, InterpolationValues value=InterpolationValues::e_linear)
Definition ManagedDesignCommand.h:335
Dictionary< UUID, Buffer< String > > m_undo_params
Definition ManagedDesignCommand.h:403
void execute(DesignObjectLookup *lookup) override
static DynamicPointer< DesignCommand > SetGeometryProperty(Geometry::GeometryProperty geo_property, const t_type &value)
Definition ManagedDesignCommand.h:171
static DynamicPointer< DesignCommand > FlipNormals()
Definition ManagedDesignCommand.h:351
static DynamicPointer< DesignCommand > ColorByChannel(String vertex_channel)
Definition ManagedDesignCommand.h:299
ManagedDesignCommand(CommandType command, const t_arg_type_a ¶m_a, const t_arg_type_b ¶m_b, const t_arg_type_c ¶m_c)
Definition ManagedDesignCommand.h:87
static DynamicPointer< DesignCommand > CreateMaterial(const String &name="")
Definition ManagedDesignCommand.h:202
ManagedDesignCommand(CommandType command, const t_arg_type_a ¶m_a, const t_arg_type_b ¶m_b, const t_arg_type_c ¶m_c, const t_arg_type_d ¶m_d)
Definition ManagedDesignCommand.h:93
static DynamicPointer< DesignCommand > AddActiveFilters(const String &filters)
Definition ManagedDesignCommand.h:319
static DynamicPointer< DesignCommand > DeleteEnclosedArea()
Definition ManagedDesignCommand.h:259
void combineWith(const DynamicPointer< DesignCommand > &command) override
static DynamicPointer< DesignCommand > CalibrateScan(Angle< fltp08 > angle, bool calibrate_yaw, InterpolationValues value=InterpolationValues::e_linear)
Definition ManagedDesignCommand.h:339
static DynamicPointer< DesignCommand > ScaleObject(const Vector< 3, fltp08 > &scale, const Vector< 3, fltp08 > &scale_center)
Definition ManagedDesignCommand.h:222
ManagedDesignCommand(CommandType command)
Dictionary< UUID, Buffer< String > > undoParams()
Definition ManagedDesignCommand.h:126
void setParams(const Buffer< String > ¶ms)
Definition ManagedDesignCommand.h:100
void setUndoParams(const UUID &uuid, const t_arg_type_a ¶m_a, const t_arg_type_b ¶m_b, const t_arg_type_c ¶m_c)
Definition ManagedDesignCommand.h:143
static DynamicPointer< DesignCommand > SmoothLaplacianCommand(uint04 number_of_iterations, fltp08 shrink_rate, fltp08 grow_rate)
Definition ManagedDesignCommand.h:238
void removeUndo(const UUID &uuid)
Definition ManagedDesignCommand.h:156
ManagedDesignCommand(CommandType command, const t_arg_type_a ¶m_a, const t_arg_type_b ¶m_b)
Definition ManagedDesignCommand.h:81
MaterialProperties
Definition Material.h:108
UVMode
Definition Material.h:68
Definition Matrix.hpp:176
MaterialMode
Definition Model.h:61
ModelProperty
Definition Model.h:103
Represents a color in the RGB space with optional alpha transparency.
Definition RGBColor.h:53
The core String class for the software.
Definition String.h:47
NDEVR_BASE_API String & append(const String &string)
NDEVR_BASE_API Buffer< String, uint04, ObjectAllocator< false > > splitString(char delimiter, bool preserve_empty=true) const
Logic for reading or writing to a string or a user friendly, TranslatedString.
Definition StringStream.h:118
Any text displayed to the user should be defined as a TranslatedString which allows the.
Definition TranslatedString.h:13
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:62
A fixed-size array with better performance compared to dynamic containers.
Definition Vector.hpp:60
NormalMode
Definition DesignObjectBase.h:105
VertexProperty
Definition DesignObjectBase.h:52
PrimitiveProperty
Definition DesignObjectBase.h:44
InterpolationValues
Values that represent interpolation functions. Useful in large or complicated geological or time.
Definition BaseValues.hpp:218
WindingMode
Definition DesignObjectBase.h:97
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:94
double fltp08
Defines an alias representing an 8 byte floating-point number.
Definition BaseValues.hpp:146
UVType
Channels that describe how an object should interact with light.
Definition DesignObjectBase.h:133