OpenLexocad  28.0
PropertyPoint.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <Core/Property.h>
4 
5 namespace Core
6 {
7 class LX_CORE_EXPORT PropertyPoint : public Core::Property
8 {
10 
11 public:
12  void setValue(const Geom::Pnt& p);
13  virtual bool setValueFromVariant(const Core::Variant& value);
15  virtual bool setKeyValue(const std::string& name, const Core::Variant& value);
16  virtual void copyValue(Core::Property* p);
17 
18  const Geom::Pnt& getValue() const;
19  virtual Core::Variant getVariant(void) const;
21  virtual std::map<std::string, Core::Variant> getKeyValueMap() const;
22 
23  virtual void save(Base::AbstractWriter& writer, Base::PersistenceVersion& save_version);
25  virtual bool isEqual(const Property*) const;
26  virtual Core::Property* copy(void) const override;
27  virtual void paste(const Core::Property& from) override;
28 
29 protected:
30  Geom::Pnt _pnt{0,0,0};
31 };
32 
33 class LX_CORE_EXPORT PropertyPointList : public Core::Property
34 {
36 
37 public:
38  void setValue(const std::vector<Geom::Pnt>& list);
39  virtual bool setValueFromVariant(const Core::Variant& value);
40  virtual void copyValue(Core::Property* p);
41 
42  void addPoint(const Geom::Pnt& v);
43  void setEmpty();
44  bool isEmpty() const;
45 
46  const std::vector<Geom::Pnt>& getValue() const;
47  const size_t getSize() const;
48 
49  virtual Core::Variant getVariant(void) const { return Core::Variant(_pointList); }
50 
51  virtual void save(Base::AbstractWriter& writer, Base::PersistenceVersion& save_version);
53  virtual bool isEqual(const Property*) const;
54  virtual Core::Property* copy(void) const override;
55  virtual void paste(const Core::Property& from) override;
56 
57  static void save_static(Base::AbstractWriter& writer, Base::PersistenceVersion& save_version, const std::vector<Geom::Pnt>& pointList);
58  static void restore_static(Base::AbstractXMLReader& reader, Base::PersistenceVersion& version, std::vector<Geom::Pnt>& pointList);
59 
60 protected:
61  std::vector<Geom::Pnt> _pointList;
62 };
63 
64 class LX_CORE_EXPORT PropertyListPointList : public Core::Property
65 {
67 
68 public:
69  void setValue(const std::list<std::list<Geom::Pnt> >& list);
70  void setValue(
71  int num_i,
72  int num_j,
73  const std::vector<Geom::Pnt>& vector); // This sets the _pointList given a vector and the number of lines/rows of the _pointList itself
74  virtual bool setValueFromVariant(const Core::Variant& value);
75  virtual void copyValue(Core::Property* p);
76 
77  void setEmpty();
78  bool isEmpty() const;
79 
80  const std::list<std::list<Geom::Pnt> >& getValue() const;
81  const std::vector<Geom::Pnt> getValue(int& num_i, int& num_j)
82  const; // This returns a copy of the _pointList encoded in a vector and the number of lines/rows of the multidimensional array
83 
84  virtual Core::Variant getVariant(void) const { return Core::Variant(_pointList); }
85 
86  virtual void save(Base::AbstractWriter& writer, Base::PersistenceVersion& save_version);
87  virtual void save(std::ofstream& writer); // For test purposes
89  virtual bool isEqual(const Property*) const;
90  virtual Core::Property* copy(void) const override;
91  virtual void paste(const Core::Property& from) override;
92 
93 protected:
94  std::list<std::list<Geom::Pnt> > _pointList;
95 };
96 
97 class LX_CORE_EXPORT PropertyPoint2d : public Core::Property
98 {
100 
101 public:
102  void setValue(const Geom::Pnt2d& p);
103  bool setValueFromVariant(const Core::Variant& value);
105 
106  const Geom::Pnt2d& getValue() const;
108 
109  virtual void save(Base::AbstractWriter& writer, Base::PersistenceVersion& save_version);
111  virtual bool isEqual(const Property*) const;
112  virtual Core::Property* copy(void) const override;
113  virtual void paste(const Core::Property& from) override;
114 
115 protected:
116  Geom::Pnt2d _pnt{0,0};
117 };
118 
119 class LX_CORE_EXPORT PropertyPoint2dList : public Core::Property
120 {
122 
123 public:
124  void setValue(const std::vector<Geom::Pnt2d>& list);
125  bool setValueFromVariant(const Core::Variant& value);
127 
128  void addPoint(const Geom::Pnt2d& v);
129  void setEmpty();
130  bool isEmpty() const;
131 
132  const std::vector<Geom::Pnt2d>& getValue() const;
133 
134  Core::Variant getVariant(void) const { return Core::Variant(_pointList); }
135 
136  virtual void save(Base::AbstractWriter& writer, Base::PersistenceVersion& save_version);
138  virtual bool isEqual(const Property*) const;
139  virtual Core::Property* copy(void) const override;
140  virtual void paste(const Core::Property& from) override;
141 
142 protected:
143  std::vector<Geom::Pnt2d> _pointList;
144 };
145 
151 
152 
153 } // namespace Core
Core::PropertyListPointList::getValue
const std::vector< Geom::Pnt > getValue(int &num_i, int &num_j) const
Property.h
Core::PropertyPoint2d::save
virtual void save(Base::AbstractWriter &writer, Base::PersistenceVersion &save_version)
This method is used to save properties or very small amounts of data to an XML document.
Core::PropertyPointList::save_static
static void save_static(Base::AbstractWriter &writer, Base::PersistenceVersion &save_version, const std::vector< Geom::Pnt > &pointList)
Core::PropertyPointList::isEqual
virtual bool isEqual(const Property *) const
compare properties
Core::PropertyPointList::getSize
const size_t getSize() const
Core::PropertyListPointList::setValue
void setValue(const std::list< std::list< Geom::Pnt > > &list)
Core::PropertyPoint::copy
virtual Core::Property * copy(void) const override
Returns a new copy of the property (mainly for Undo/Redo and transactions). The copy has no container...
Core::PropertyPoint2dList::setValueFromVariant
bool setValueFromVariant(const Core::Variant &value)
Core::PropertyListPointList::save
virtual void save(std::ofstream &writer)
Core::PropertyPointList::restore_static
static void restore_static(Base::AbstractXMLReader &reader, Base::PersistenceVersion &version, std::vector< Geom::Pnt > &pointList)
Core::PropertyPoint2d::setValueFromVariant
bool setValueFromVariant(const Core::Variant &value)
Core::PropertyListPointList
Definition: PropertyPoint.h:65
Core::PropertyPoint2dList::addPoint
void addPoint(const Geom::Pnt2d &v)
Core::PropertyPointList::getVariant
virtual Core::Variant getVariant(void) const
Definition: PropertyPoint.h:49
Core::PropertyPointList::isEmpty
bool isEmpty() const
Core::PropertyPoint2dList::setValue
void setValue(const std::vector< Geom::Pnt2d > &list)
Core::PropertyPoint::isEqual
virtual bool isEqual(const Property *) const
compare properties
Core::PropertyPoint2d::restore
virtual void restore(Base::AbstractXMLReader &reader, Base::PersistenceVersion &version)
This method is used to restore properties from an XML document.
Core::PropertyPoint::paste
virtual void paste(const Core::Property &from) override
Paste the value from the property (mainly for Undo/Redo and transactions)
Core::PropertyPointList::setValueFromVariant
virtual bool setValueFromVariant(const Core::Variant &value)
Core::PropertyPoint2dList::paste
virtual void paste(const Core::Property &from) override
Paste the value from the property (mainly for Undo/Redo and transactions)
Core::PropertyPointList::addPoint
void addPoint(const Geom::Pnt &v)
Core::PropertyPoint2dList::save
virtual void save(Base::AbstractWriter &writer, Base::PersistenceVersion &save_version)
This method is used to save properties or very small amounts of data to an XML document.
Core::PropertyListPointList::save
virtual void save(Base::AbstractWriter &writer, Base::PersistenceVersion &save_version)
This method is used to save properties or very small amounts of data to an XML document.
Core::PropertyPointList::setEmpty
void setEmpty()
Core::PropertyPoint::copyValue
virtual void copyValue(Core::Property *p)
Core::PropertyPoint2d::getVariant
Core::Variant getVariant(void) const
Core::PropertyPoint2d::copy
virtual Core::Property * copy(void) const override
Returns a new copy of the property (mainly for Undo/Redo and transactions). The copy has no container...
Base::PersistenceVersion
Definition: Persistence.h:13
Core::PropertyPoint::getKeyValueMap
virtual std::map< std::string, Core::Variant > getKeyValueMap() const
Returns all keys and their values of this property.
Core::PropertyPoint2dList::copyValue
void copyValue(Core::Property *p)
Core::PropertyListPointList::setValue
void setValue(int num_i, int num_j, const std::vector< Geom::Pnt > &vector)
Core::PropertyListPointList::isEqual
virtual bool isEqual(const Property *) const
compare properties
Core::PropertyPoint
Definition: PropertyPoint.h:8
Core
Definition: Base.h:5
Core::PropertyPointList::copy
virtual Core::Property * copy(void) const override
Returns a new copy of the property (mainly for Undo/Redo and transactions). The copy has no container...
Core::Variant
Definition: Variant.h:78
Core::PropertyPoint2d::isEqual
virtual bool isEqual(const Property *) const
compare properties
Core::PropertyListPointList::paste
virtual void paste(const Core::Property &from) override
Paste the value from the property (mainly for Undo/Redo and transactions)
Geom::Pnt
Defines a non-persistent 3D Cartesian point.
Definition: Pnt.h:44
Core::PropertyListPointList::setEmpty
void setEmpty()
Core::PropertyListPointList::isEmpty
bool isEmpty() const
Base::AbstractWriter
Definition: Writer.h:13
Core::PropertyPoint2dList::isEqual
virtual bool isEqual(const Property *) const
compare properties
Core::PropertyPoint2dList::restore
virtual void restore(Base::AbstractXMLReader &reader, Base::PersistenceVersion &version)
This method is used to restore properties from an XML document.
Core::PropertyPointList::copyValue
virtual void copyValue(Core::Property *p)
Core::PropertyPoint::getVariant
virtual Core::Variant getVariant(void) const
Core::PropertyListPointList::getVariant
virtual Core::Variant getVariant(void) const
Definition: PropertyPoint.h:84
Core::PropertyPoint2dList::copy
virtual Core::Property * copy(void) const override
Returns a new copy of the property (mainly for Undo/Redo and transactions). The copy has no container...
Core::PropertyPointList::paste
virtual void paste(const Core::Property &from) override
Paste the value from the property (mainly for Undo/Redo and transactions)
Core::PropertyPointList::_pointList
std::vector< Geom::Pnt > _pointList
Definition: PropertyPoint.h:61
Core::PropertyPoint::setKeyValue
virtual bool setKeyValue(const std::string &name, const Core::Variant &value)
'x' sets x coordinate, 'y' sets y coordinate, 'z' sets z coordinate
Base::AbstractXMLReader
Definition: AbstractXMLReader.h:7
Core::PropertyPoint2dList::setEmpty
void setEmpty()
Core::PropertyPoint2dList::getVariant
Core::Variant getVariant(void) const
Definition: PropertyPoint.h:134
Core::PropertyListPointList::_pointList
std::list< std::list< Geom::Pnt > > _pointList
Definition: PropertyPoint.h:94
Core::PropertyPoint2d::paste
virtual void paste(const Core::Property &from) override
Paste the value from the property (mainly for Undo/Redo and transactions)
Core::PropertyPoint::save
virtual void save(Base::AbstractWriter &writer, Base::PersistenceVersion &save_version)
This method is used to save properties or very small amounts of data to an XML document.
Core::PropertyListPointList::getValue
const std::list< std::list< Geom::Pnt > > & getValue() const
Core::version
LX_CORE_EXPORT Version & version
Core::PropertyPoint2dList
Definition: PropertyPoint.h:120
Core::PropertyPoint2dList::_pointList
std::vector< Geom::Pnt2d > _pointList
Definition: PropertyPoint.h:143
Core::PropertyPointList::save
virtual void save(Base::AbstractWriter &writer, Base::PersistenceVersion &save_version)
This method is used to save properties or very small amounts of data to an XML document.
Core::Property
Definition: Property.h:72
Core::PropertyListPointList::copyValue
virtual void copyValue(Core::Property *p)
Core::PropertyPoint2dList::isEmpty
bool isEmpty() const
Core::PropertyPoint2d::getValue
const Geom::Pnt2d & getValue() const
Core::PropertyListPointList::restore
virtual void restore(Base::AbstractXMLReader &reader, Base::PersistenceVersion &version)
This method is used to restore properties from an XML document.
Geom::Pnt2d
Defines a non-persistent 2D cartesian point.
Definition: Pnt2d.h:34
Core::PropertyPoint::setValue
void setValue(const Geom::Pnt &p)
Core::PropertyPoint::setValueFromVariant
virtual bool setValueFromVariant(const Core::Variant &value)
Core::PropertyListPointList::setValueFromVariant
virtual bool setValueFromVariant(const Core::Variant &value)
Core::PropertyPointList::setValue
void setValue(const std::vector< Geom::Pnt > &list)
Core::PropertyPointList
Definition: PropertyPoint.h:34
Core::PropertyPoint2dList::getValue
const std::vector< Geom::Pnt2d > & getValue() const
Core::PropertyPointList::getValue
const std::vector< Geom::Pnt > & getValue() const
Core::PropertyPoint::getValue
const Geom::Pnt & getValue() const
TYPESYSTEM_HEADER
#define TYPESYSTEM_HEADER()
define for subclassing Base::BaseClass
Definition: Base.h:12
Core::DECLARE_PROPERTY_FACTORY
DECLARE_PROPERTY_FACTORY(PropertyAxis1_Factory, Core::PropertyAxis1)
Core::PropertyPointList::restore
virtual void restore(Base::AbstractXMLReader &reader, Base::PersistenceVersion &version)
This method is used to restore properties from an XML document.
Core::PropertyListPointList::copy
virtual Core::Property * copy(void) const override
Returns a new copy of the property (mainly for Undo/Redo and transactions). The copy has no container...
Core::PropertyPoint2d
Definition: PropertyPoint.h:98
Core::PropertyPoint2d::copyValue
void copyValue(Core::Property *p)
Core::PropertyPoint::restore
virtual void restore(Base::AbstractXMLReader &reader, Base::PersistenceVersion &version)
This method is used to restore properties from an XML document.
Core::PropertyPoint2d::setValue
void setValue(const Geom::Pnt2d &p)