2#pragma warning(disable : 4251)
14class EntityProperties;
16namespace ot {
class Property; };
17namespace ot {
class Painter2D; };
19class __declspec(dllexport) EntityPropertiesBase
22 EntityPropertiesBase();
23 virtual ~EntityPropertiesBase() {};
25 EntityPropertiesBase(
const EntityPropertiesBase &other);
27 virtual EntityPropertiesBase *createCopy(
void) = 0;
29 void setContainer(EntityProperties *c) { m_container = c; };
31 void setName(
const std::string& _name) { m_name = _name; };
32 const std::string& getName(
void)
const {
return m_name; };
34 void setGroup(
const std::string& _group) { m_group = _group; };
35 const std::string& getGroup(
void)
const {
return m_group; };
37 enum eType { DOUBLE, INTEGER, BOOLEAN, STRING, SELECTION, COLOR, ENTITYLIST, PROJECTLIST, GUIPAINTER };
38 virtual eType getType(
void)
const = 0;
39 virtual std::string getTypeString(
void)
const = 0;
41 void resetNeedsUpdate(
void) { m_needsUpdateFlag =
false; };
42 bool needsUpdate(
void);
43 void setNeedsUpdate(
void);
45 void setHasMultipleValues(
bool b) { m_multipleValues =
b; };
46 bool hasMultipleValues(
void)
const {
return m_multipleValues; };
48 virtual bool isCompatible(EntityPropertiesBase *other) {
return true; };
49 virtual bool hasSameValue(EntityPropertiesBase *other) = 0;
52 virtual void setFromConfiguration(
const ot::Property* _property, EntityBase* root);
54 virtual void addToJsonDocument(
ot::JsonDocument& jsonDoc, EntityBase* root) = 0;
57 void setToolTip(
const std::string& _toolTip) { m_toolTip = _toolTip; };
58 const std::string&
getToolTip(
void)
const {
return m_toolTip; };
60 void setReadOnly(
bool _flag) { m_readOnly = _flag; };
61 bool getReadOnly(
void)
const {
return m_readOnly; };
63 void setProtected(
bool _flag) { m_protectedProperty = _flag; };
64 bool getProtected(
void)
const {
return m_protectedProperty; };
66 void setVisible(
bool _flag) { m_visible = _flag; };
67 bool getVisible(
void)
const {
return m_visible; };
70 bool getErrorState(
void)
const {
return m_errorState; };
72 virtual void copySettings(EntityPropertiesBase *other, EntityBase *root);
74 EntityPropertiesBase& operator=(
const EntityPropertiesBase &other);
81 void setMultipleValues(
void) { m_multipleValues =
true; }
83 EntityProperties* m_container;
84 bool m_needsUpdateFlag;
87 std::string m_toolTip;
88 bool m_multipleValues;
90 bool m_protectedProperty;
97class __declspec(dllexport) EntityPropertiesDouble :
public EntityPropertiesBase
100 static std::string typeString(
void) {
return "double"; };
102 EntityPropertiesDouble();
103 virtual ~EntityPropertiesDouble() {};
105 EntityPropertiesDouble(
const std::string& _name,
double _value);
107 EntityPropertiesDouble(
const EntityPropertiesDouble& _other);
109 virtual EntityPropertiesBase *createCopy(
void)
override {
return new EntityPropertiesDouble(*
this); };
111 EntityPropertiesDouble& operator=(
const EntityPropertiesDouble& _other);
113 virtual eType getType(
void)
const override {
return DOUBLE; };
114 virtual std::string getTypeString(
void)
const override {
return EntityPropertiesDouble::typeString(); };
116 void setValue(
double _value);
117 double getValue(
void)
const {
return m_value; };
119 void setRange(
double _min,
double _max);
120 void setMin(
double _min);
121 double getMin(
void)
const {
return m_min; };
122 void setMax(
double _max);
123 double getMax(
void)
const {
return m_max; };
125 void setAllowCustomValues(
bool _allowCustomValues);
126 bool getAllowCustomValues(
void)
const {
return m_allowCustomValues; };
128 virtual bool hasSameValue(EntityPropertiesBase *other)
override;
130 virtual void addToConfiguration(
ot::PropertyGridCfg& _configuration, EntityBase *root)
override;
131 virtual void setFromConfiguration(
const ot::Property* _property, EntityBase* root)
override;
133 virtual void addToJsonDocument(
ot::JsonDocument& jsonDoc, EntityBase* root)
override;
134 virtual void readFromJsonObject(
const ot::ConstJsonObject&
object, EntityBase* root)
override;
136 virtual void copySettings(EntityPropertiesBase *other, EntityBase *root);
138 static EntityPropertiesDouble* createProperty(
const std::string& _group,
const std::string& _name,
double _defaultValue,
const std::string& _defaultCategory, EntityProperties& _properties);
139 static EntityPropertiesDouble* createProperty(
const std::string& _group,
const std::string& _name,
double _defaultValue,
double _minValue,
double _maxValue,
const std::string& _defaultCategory, EntityProperties& _properties);
143 bool m_allowCustomValues;
150class __declspec(dllexport) EntityPropertiesInteger :
public EntityPropertiesBase
153 static std::string typeString(
void) {
return "integer"; };
155 EntityPropertiesInteger();
156 virtual ~EntityPropertiesInteger() {};
158 EntityPropertiesInteger(
const std::string& _name,
long _value);
160 EntityPropertiesInteger(
const EntityPropertiesInteger& _other);
162 virtual EntityPropertiesBase *createCopy(
void)
override {
return new EntityPropertiesInteger(*
this); };
164 EntityPropertiesInteger& operator=(
const EntityPropertiesInteger& _other);
166 virtual eType getType(
void)
const override {
return INTEGER; };
167 virtual std::string getTypeString(
void)
const override {
return EntityPropertiesInteger::typeString(); };
169 void setValue(
long _value);
170 long getValue(
void)
const {
return m_value; };
172 void setRange(
long _min,
long _max);
173 void setMin(
long _min);
174 long getMin(
void)
const {
return m_min; };
175 void setMax(
long _max);
176 long getMax(
void)
const {
return m_max; };
178 void setAllowCustomValues(
bool _allowCustomValues);
179 bool getAllowCustomValues(
void)
const {
return m_allowCustomValues; };
181 virtual bool hasSameValue(EntityPropertiesBase *other)
override;
183 virtual void addToConfiguration(
ot::PropertyGridCfg& _configuration, EntityBase *root)
override;
184 virtual void setFromConfiguration(
const ot::Property* _property, EntityBase* root)
override;
186 virtual void addToJsonDocument(
ot::JsonDocument& jsonDoc, EntityBase* root)
override;
187 virtual void readFromJsonObject(
const ot::ConstJsonObject&
object, EntityBase* root)
override;
189 virtual void copySettings(EntityPropertiesBase *other, EntityBase *root);
191 static EntityPropertiesInteger* createProperty(
const std::string& _group,
const std::string& _name,
long _defaultValue,
const std::string& _defaultCategory, EntityProperties& _properties);
192 static EntityPropertiesInteger* createProperty(
const std::string& _group,
const std::string& _name,
long _defaultValue,
long _minValue,
long _maxValue,
const std::string& _defaultCategory, EntityProperties& _properties);
196 bool m_allowCustomValues;
203class __declspec(dllexport) EntityPropertiesBoolean :
public EntityPropertiesBase
206 static std::string typeString(
void) {
return "boolean"; };
208 EntityPropertiesBoolean() : m_value(false) {};
209 virtual ~EntityPropertiesBoolean() {};
211 EntityPropertiesBoolean(
const std::string &n,
bool v) : m_value(v) { setName(n); };
213 EntityPropertiesBoolean(
const EntityPropertiesBoolean &other) : EntityPropertiesBase(other) { m_value = other.m_value; };
215 virtual EntityPropertiesBase *createCopy(
void)
override {
return new EntityPropertiesBoolean(*
this); };
217 EntityPropertiesBoolean& operator=(
const EntityPropertiesBoolean &other) {
if (&other !=
this) { EntityPropertiesBase::operator=(other); m_value = other.getValue(); };
return *
this; };
219 virtual eType getType(
void)
const override {
return BOOLEAN; };
220 virtual std::string getTypeString(
void)
const override {
return EntityPropertiesBoolean::typeString(); };
222 void setValue(
bool b) {
if (m_value != b) setNeedsUpdate(); m_value =
b; };
223 bool getValue(
void)
const {
return m_value; };
225 virtual bool hasSameValue(EntityPropertiesBase *other)
override;
227 virtual void addToConfiguration(
ot::PropertyGridCfg& _configuration, EntityBase *root)
override;
228 virtual void setFromConfiguration(
const ot::Property* _property, EntityBase* root)
override;
230 virtual void addToJsonDocument(
ot::JsonDocument& jsonDoc, EntityBase* root)
override;
231 virtual void readFromJsonObject(
const ot::ConstJsonObject&
object, EntityBase* root)
override;
233 virtual void copySettings(EntityPropertiesBase *other, EntityBase *root);
235 static EntityPropertiesBoolean* createProperty(
const std::string &group,
const std::string &name,
bool defaultValue,
const std::string &defaultCategory, EntityProperties &properties);
243class __declspec(dllexport) EntityPropertiesString :
public EntityPropertiesBase
246 static std::string typeString(
void) {
return "string"; };
248 EntityPropertiesString() {};
249 virtual ~EntityPropertiesString() {};
251 EntityPropertiesString(
const std::string &n,
const std::string &v) : m_value(v) { setName(n); };
253 EntityPropertiesString(
const EntityPropertiesString &other) : EntityPropertiesBase(other) { m_value = other.m_value; };
255 virtual EntityPropertiesBase *createCopy(
void)
override {
return new EntityPropertiesString(*
this); };
257 EntityPropertiesString& operator=(
const EntityPropertiesString &other) {
if (&other !=
this) { EntityPropertiesBase::operator=(other); m_value =other.getValue(); };
return *
this; };
259 virtual eType getType(
void)
const override {
return STRING; };
260 virtual std::string getTypeString(
void)
const override {
return EntityPropertiesString::typeString(); };
262 void setValue(
const std::string &s) {
if (m_value != s) setNeedsUpdate(); m_value = s; };
263 const std::string& getValue(
void)
const {
return m_value; };
265 virtual bool hasSameValue(EntityPropertiesBase *other)
override;
267 virtual void addToConfiguration(
ot::PropertyGridCfg& _configuration, EntityBase *root)
override;
268 virtual void setFromConfiguration(
const ot::Property* _property, EntityBase* root)
override;
270 virtual void addToJsonDocument(
ot::JsonDocument& jsonDoc, EntityBase* root)
override;
271 virtual void readFromJsonObject(
const ot::ConstJsonObject&
object, EntityBase* root)
override;
273 virtual void copySettings(EntityPropertiesBase *other, EntityBase *root);
275 static EntityPropertiesString* createProperty(
const std::string &group,
const std::string &name,
const std::string &defaultValue,
const std::string &defaultCategory, EntityProperties &properties);
283class __declspec(dllexport) EntityPropertiesSelection :
public EntityPropertiesBase
286 static std::string typeString(
void) {
return "selection"; };
288 EntityPropertiesSelection() {};
289 virtual ~EntityPropertiesSelection() {};
291 EntityPropertiesSelection(
const EntityPropertiesSelection &other) : EntityPropertiesBase(other) { m_options = other.m_options; m_value = other.m_value; };
293 virtual EntityPropertiesBase *createCopy(
void)
override {
return new EntityPropertiesSelection(*
this); };
295 EntityPropertiesSelection& operator=(
const EntityPropertiesSelection &other) {
if (&other !=
this) { assert(checkCompatibilityOfSettings(other)); EntityPropertiesBase::operator=(other); m_value = other.getValue(); };
return *
this; };
297 virtual eType getType(
void)
const override {
return SELECTION; };
298 virtual std::string getTypeString(
void)
const override {
return EntityPropertiesSelection::typeString(); };
300 virtual bool isCompatible(EntityPropertiesBase *other)
override;
302 bool setValue(
const std::string &s);
303 const std::string& getValue(
void)
const {
return m_value; };
305 void clearOptions() { m_options.clear(); };
306 void addOption(
const std::string &option) { assert(std::find(m_options.begin(), m_options.end(), option) == m_options.end()); m_options.push_back(option); }
307 void resetOptions(std::list<std::string>& _options);
308 const std::vector<std::string> &getOptions(
void) {
return m_options; };
310 virtual bool hasSameValue(EntityPropertiesBase *other)
override;
312 virtual void addToConfiguration(
ot::PropertyGridCfg& _configuration, EntityBase *root)
override;
313 virtual void setFromConfiguration(
const ot::Property* _property, EntityBase* root)
override;
315 virtual void addToJsonDocument(
ot::JsonDocument& jsonDoc, EntityBase* root)
override;
316 virtual void readFromJsonObject(
const ot::ConstJsonObject&
object, EntityBase* root)
override;
318 virtual void copySettings(EntityPropertiesBase *other, EntityBase *root);
320 static EntityPropertiesSelection* createProperty(
const std::string &group,
const std::string &name, std::list<std::string>& options,
const std::string &defaultValue,
const std::string &defaultCategory, EntityProperties &properties);
321 static EntityPropertiesSelection* createProperty(
const std::string &group,
const std::string &name, std::list<std::string>&& options,
const std::string &defaultValue,
const std::string &defaultCategory, EntityProperties &properties);
324 bool checkCompatibilityOfSettings(
const EntityPropertiesSelection &other);
326 std::vector<std::string> m_options;
332class __declspec(dllexport) EntityPropertiesColor :
public EntityPropertiesBase
335 static std::string typeString(
void) {
return "color"; };
337 EntityPropertiesColor() : m_color{ 0.0, 0.0, 0.0 } {};
339 EntityPropertiesColor(
const EntityPropertiesColor &other) : EntityPropertiesBase(other) { m_color[0] = other.getColorR(); m_color[1] = other.getColorG(); m_color[2] = other.getColorB(); };
341 EntityPropertiesColor(
const std::string &n,
double r,
double g,
double b) : m_color{ r, g,
b } { setName(n); };
342 virtual ~EntityPropertiesColor() {};
344 virtual EntityPropertiesBase *createCopy(
void)
override {
return new EntityPropertiesColor(*
this); };
346 EntityPropertiesColor& operator=(
const EntityPropertiesColor &other);
348 virtual eType getType(
void)
const override {
return COLOR; };
349 virtual std::string getTypeString(
void)
const override {
return EntityPropertiesColor::typeString(); };
351 void setColorR(
double c) {
if (m_color[0] != c) setNeedsUpdate(); m_color[0] = c; };
352 void setColorG(
double c) {
if (m_color[1] != c) setNeedsUpdate(); m_color[1] = c; };
353 void setColorB(
double c) {
if (m_color[2] != c) setNeedsUpdate(); m_color[2] = c; };
355 void setColorRGB(
double r,
double g,
double b) {
if (m_color[0] != r || m_color[1] != g || m_color[2] != b) setNeedsUpdate(); m_color[0] = r; m_color[1] = g; m_color[2] =
b; };
357 double getColorR(
void)
const {
return m_color[0]; };
358 double getColorG(
void)
const {
return m_color[1]; };
359 double getColorB(
void)
const {
return m_color[2]; };
361 virtual bool hasSameValue(EntityPropertiesBase *other)
override;
363 virtual void addToConfiguration(
ot::PropertyGridCfg& _configuration, EntityBase *root)
override;
364 virtual void setFromConfiguration(
const ot::Property* _property, EntityBase* root)
override;
366 virtual void addToJsonDocument(
ot::JsonDocument& jsonDoc, EntityBase* root)
override;
367 virtual void readFromJsonObject(
const ot::ConstJsonObject&
object, EntityBase* root)
override;
369 virtual void copySettings(EntityPropertiesBase *other, EntityBase *root);
371 static EntityPropertiesColor* createProperty(
const std::string &group,
const std::string &name, std::vector<int> defaultValue,
const std::string &defaultCategory, EntityProperties &properties);
379class __declspec(dllexport) EntityPropertiesEntityList :
public EntityPropertiesBase
382 static std::string typeString(
void) {
return "entitylist"; };
384 EntityPropertiesEntityList() : m_entityContainerID(0), m_valueID(0) {};
386 EntityPropertiesEntityList(
const EntityPropertiesEntityList &other) : EntityPropertiesBase(other) { m_entityContainerName = other.getEntityContainerName(); m_entityContainerID = other.getEntityContainerID(); m_valueName = other.getValueName(); m_valueID = other.getValueID(); };
387 EntityPropertiesEntityList(
const std::string &n,
const std::string &contName,
ot::UID contID,
const std::string &valName,
ot::UID valID) : m_entityContainerName(contName), m_entityContainerID(contID), m_valueName(valName), m_valueID(valID) { setName(n); };
389 virtual ~EntityPropertiesEntityList() {};
391 virtual EntityPropertiesBase *createCopy(
void)
override {
return new EntityPropertiesEntityList(*
this); };
393 EntityPropertiesEntityList& operator=(
const EntityPropertiesEntityList &other);
395 virtual eType getType(
void)
const override {
return ENTITYLIST; };
396 virtual std::string getTypeString(
void)
const override {
return EntityPropertiesEntityList::typeString(); };
398 virtual bool hasSameValue(EntityPropertiesBase *other)
override;
400 virtual void addToConfiguration(
ot::PropertyGridCfg& _configuration, EntityBase *root)
override;
401 virtual void setFromConfiguration(
const ot::Property* _property, EntityBase* root)
override;
403 virtual void addToJsonDocument(
ot::JsonDocument& jsonDoc, EntityBase* root)
override;
404 virtual void readFromJsonObject(
const ot::ConstJsonObject&
object, EntityBase* root)
override;
406 virtual void copySettings(EntityPropertiesBase *other, EntityBase *root);
408 void setEntityContainerName(
const std::string &containerName) {
if (m_entityContainerName != containerName) setNeedsUpdate(); m_entityContainerName = containerName; };
409 void setEntityContainerID(
ot::UID containerID) {
if (m_entityContainerID != containerID) setNeedsUpdate(); m_entityContainerID = containerID; };
411 void setValueName(
const std::string &vname) {
if (m_valueName != vname) setNeedsUpdate(); m_valueName = vname; };
412 void setValueID(
ot::UID vid) {
if (m_valueID != vid) setNeedsUpdate(); m_valueID = vid; };
414 std::string getEntityContainerName(
void)
const {
return m_entityContainerName; };
415 ot::UID getEntityContainerID(
void)
const {
return m_entityContainerID; };
417 std::string getValueName(
void)
const {
return m_valueName; };
418 ot::UID getValueID(
void)
const {
return m_valueID; };
420 static EntityPropertiesEntityList* createProperty(
const std::string &group,
const std::string &name,
const std::string &contName,
ot::UID contID,
const std::string &valName,
ot::UID valID,
const std::string &defaultCategory, EntityProperties &properties);
427 void updateValueAndContainer(EntityBase* _root, std::list<std::string>& _containerOptions);
429 EntityContainer *findContainerFromID(EntityBase *root,
ot::UID entityID);
430 EntityContainer *findContainerFromName(EntityBase *root,
const std::string &entityName);
431 EntityBase *findEntityFromName(EntityBase *root,
const std::string &entityName);
432 EntityBase *findEntityFromID(EntityBase *root,
ot::UID entityID);
434 std::string m_entityContainerName;
437 std::string m_valueName;
443class __declspec(dllexport) EntityPropertiesProjectList :
public EntityPropertiesBase
446 static std::string typeString(
void) {
return "projectlist"; };
448 EntityPropertiesProjectList() {};
449 EntityPropertiesProjectList(
const std::string& name) { setName(name); }
450 virtual EntityPropertiesBase* createCopy(
void)
override {
return new EntityPropertiesProjectList(*
this); };
451 virtual eType getType(
void)
const override {
return PROJECTLIST; };
452 virtual std::string getTypeString(
void)
const override {
return EntityPropertiesProjectList::typeString(); };
454 virtual void copySettings(EntityPropertiesBase* other, EntityBase* root);
456 virtual bool hasSameValue(EntityPropertiesBase* other)
override {
return true; };
458 virtual void addToConfiguration(
ot::PropertyGridCfg& _configuration, EntityBase* root)
override;
459 virtual void setFromConfiguration(
const ot::Property* _property, EntityBase* root)
override;
461 virtual void addToJsonDocument(
ot::JsonDocument& jsonDoc, EntityBase* root)
override;
462 virtual void readFromJsonObject(
const ot::ConstJsonObject&
object, EntityBase* root)
override;
464 void setValue(std::string&
value) { m_value =
value; }
465 std::string getValue()
const {
return m_value;}
472class __declspec(dllexport) EntityPropertiesGuiPainter :
public EntityPropertiesBase
475 static std::string typeString(
void) {
return "guipainter"; };
477 EntityPropertiesGuiPainter();
478 virtual ~EntityPropertiesGuiPainter();
482 EntityPropertiesGuiPainter(
const std::string& n,
ot::Painter2D* _painter) : m_painter(_painter) { setName(n); };
484 EntityPropertiesGuiPainter(
const EntityPropertiesGuiPainter& other);
486 virtual EntityPropertiesBase* createCopy(
void)
override {
return new EntityPropertiesGuiPainter(*
this); };
488 EntityPropertiesGuiPainter& operator=(
const EntityPropertiesGuiPainter& other);
490 virtual eType getType(
void)
const override {
return GUIPAINTER; };
491 virtual std::string getTypeString(
void)
const override {
return EntityPropertiesGuiPainter::typeString(); };
497 const ot::Painter2D* getValue(
void)
const {
return m_painter; };
499 virtual bool hasSameValue(EntityPropertiesBase* other)
override;
501 virtual void addToConfiguration(
ot::PropertyGridCfg& _configuration, EntityBase* root)
override;
502 virtual void setFromConfiguration(
const ot::Property* _property, EntityBase* root)
override;
504 virtual void addToJsonDocument(
ot::JsonDocument& jsonDoc, EntityBase* root)
override;
505 virtual void readFromJsonObject(
const ot::ConstJsonObject&
object, EntityBase* root)
override;
507 virtual void copySettings(EntityPropertiesBase* other, EntityBase* root);
509 static EntityPropertiesGuiPainter* createProperty(
const std::string& group,
const std::string& name,
ot::Painter2D* _defaultPainter,
const std::string& defaultCategory, EntityProperties& properties);
bsoncxx::types::value value
Definition DocumentManager.h:16
JSON document.
Definition JSON.h:276
Definition Painter2D.h:17
Definition PropertyGridCfg.h:21
The Property class is used as a base class for all Properties that can be displayed and modified in t...
Definition Property.h:21
double double double b[]
Definition GeometryOperations.h:24
UICORE_API_EXPORT void setErrorState(UID _lineEditUid, bool _error)
Will set the nice line edit error state.
Definition uiAPI.cpp:436
UICORE_API_EXPORT void setToolTip(UID _objectUID, const QString &_toolTip)
Will set the objects ToolTip For the list of suitable objects refer to the documentation.
Definition uiAPI.cpp:530
unsigned long UID
Unique identifier (32 bit unsigned integer)
Definition CoreTypes.h:27
rapidjson::Value JsonValue
Writable JSON value.
Definition JSON.h:27
rapidjson::GenericObject< true, rapidjson::GenericValue< rapidjson::UTF8<>, rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > > > ConstJsonObject
Read only JSON Object.
Definition JSON.h:35
rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > JsonAllocator
Allocator used for writing to JSON values.
Definition JSON.h:30