OpenLexocad  27.0
PropertyPoint.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <Core/core_defines2.h>
4 #include <Geom/Pnt.h>
5 #include <Geom/Pnt2d.h>
6 
7 #include <vector>
8 
9 #include "Core/Property.h"
10 #include "Core/Variant.h"
11 
12 namespace Core
13 {
15 {
17 
18 public:
19  PropertyPoint(void);
20  virtual ~PropertyPoint(void);
21 
22  void setValue(const Geom::Pnt& p);
23  virtual bool setValueFromVariant(const Core::Variant& value);
25  virtual bool setKeyValue(const std::string& name, const Core::Variant& value);
26  virtual void copyValue(Core::Property* p);
27 
28  const Geom::Pnt& getValue() const;
29  virtual Core::Variant getVariant(void) const;
31  virtual std::map<std::string, Core::Variant> getKeyValueMap() const;
32 
33  virtual void save(Base::AbstractWriter& writer, Base::PersistanceVersion& save_version);
34  inline virtual void restore(Base::AbstractXMLReader& reader, Base::PersistanceVersion& version);
35  virtual bool isEqual(const Property*) const;
36 
37 protected:
39 };
40 
42 {
44 
45 public:
48 
49  void setValue(const std::vector<Geom::Pnt>& list);
50  virtual bool setValueFromVariant(const Core::Variant& value);
51  virtual void copyValue(Core::Property* p);
52 
53  void addPoint(const Geom::Pnt& v);
54  void setEmpty();
55  bool isEmpty() const;
56 
57  const std::vector<Geom::Pnt>& getValue() const;
58  const size_t getSize() const;
59 
60  virtual Core::Variant getVariant(void) const { return Core::Variant(_pointList); }
61 
62  virtual void save(Base::AbstractWriter& writer, Base::PersistanceVersion& save_version);
63  virtual void restore(Base::AbstractXMLReader& reader, Base::PersistanceVersion& version);
64  virtual bool isEqual(const Property*) const;
65 
66  static void save_static(Base::AbstractWriter& writer, Base::PersistanceVersion& save_version, const std::vector<Geom::Pnt>& pointList);
67  static void restore_static(Base::AbstractXMLReader& reader, Base::PersistanceVersion& version, std::vector<Geom::Pnt>& pointList);
68 
69 protected:
70  std::vector<Geom::Pnt> _pointList;
71 };
72 
74 {
76 
77 public:
80 
81  void setValue(const std::list<std::list<Geom::Pnt> >& list);
82  void setValue(
83  int num_i,
84  int num_j,
85  const std::vector<Geom::Pnt>& vector); // This sets the _pointList given a vector and the number of lines/rows of the _pointList itself
86  virtual bool setValueFromVariant(const Core::Variant& value);
87  virtual void copyValue(Core::Property* p);
88 
89  void setEmpty();
90  bool isEmpty() const;
91 
92  const std::list<std::list<Geom::Pnt> >& getValue() const;
93  const std::vector<Geom::Pnt> getValue(int& num_i, int& num_j)
94  const; // This returns a copy of the _pointList encoded in a vector and the number of lines/rows of the multidimensional array
95 
96  virtual Core::Variant getVariant(void) const { return Core::Variant(_pointList); }
97 
98  virtual void save(Base::AbstractWriter& writer, Base::PersistanceVersion& save_version);
99  virtual void save(std::ofstream& writer); // For test purposes
100  virtual void restore(Base::AbstractXMLReader& reader, Base::PersistanceVersion& version);
101  virtual bool isEqual(const Property*) const;
102 
103 protected:
104  std::list<std::list<Geom::Pnt> > _pointList;
105 };
106 
108 {
110 
111 public:
112  PropertyPoint2d(void);
113  virtual ~PropertyPoint2d(void);
114 
115  void setValue(const Geom::Pnt2d& p);
116  bool setValueFromVariant(const Core::Variant& value);
117  void copyValue(Core::Property* p);
118 
119  const Geom::Pnt2d& getValue() const;
120  Core::Variant getVariant(void) const;
121 
122  virtual void save(Base::AbstractWriter& writer, Base::PersistanceVersion& save_version);
123  virtual void restore(Base::AbstractXMLReader& reader, Base::PersistanceVersion& version);
124  virtual bool isEqual(const Property*) const;
125 
126 protected:
128 };
129 
131 {
133 
134 public:
137 
138  void setValue(const std::vector<Geom::Pnt2d>& list);
139  bool setValueFromVariant(const Core::Variant& value);
140  void copyValue(Core::Property* p);
141 
142  void addPoint(const Geom::Pnt2d& v);
143  void setEmpty();
144  bool isEmpty() const;
145 
146  const std::vector<Geom::Pnt2d>& getValue() const;
147 
148  Core::Variant getVariant(void) const { return Core::Variant(_pointList); }
149 
150  virtual void save(Base::AbstractWriter& writer, Base::PersistanceVersion& save_version);
151  virtual void restore(Base::AbstractXMLReader& reader, Base::PersistanceVersion& version);
152  virtual bool isEqual(const Property*) const;
153 
154 protected:
155  std::vector<Geom::Pnt2d> _pointList;
156 };
157 
158 DECLARE_PROPERTY_FACTORY(PropertyPoint_Factory, Core::PropertyPoint);
159 DECLARE_PROPERTY_FACTORY(PropertyPointList_Factory, Core::PropertyPointList);
160 DECLARE_PROPERTY_FACTORY(PropertyListPointList_Factory, Core::PropertyListPointList);
161 DECLARE_PROPERTY_FACTORY(PropertyPoint2d_Factory, Core::PropertyPoint2d);
162 DECLARE_PROPERTY_FACTORY(PropertyPoint2dList_Factory, Core::PropertyPoint2dList);
163 
164 
165 } // namespace Core
#define CORE_EXPORT
Definition: core_defines2.h:10
Core::Variant getVariant(void) const
Definition: PropertyPoint.h:148
Definition: PropertyPoint.h:130
Geom::Pnt2d _pnt
Definition: PropertyPoint.h:127
Definition: PropertyPoint.h:73
std::vector< Geom::Pnt2d > _pointList
Definition: PropertyPoint.h:155
Defines a non-persistent 3D Cartesian point.
Definition: Pnt.h:42
std::list< std::list< Geom::Pnt > > _pointList
Definition: PropertyPoint.h:104
virtual Core::Variant getVariant(void) const
Definition: PropertyPoint.h:96
Core::PropertyText name
Definition: CoreDocument.h:143
Geom::Pnt _pnt
Definition: PropertyPoint.h:38
virtual Core::Variant getVariant(void) const
Definition: PropertyPoint.h:60
Definition: Persistance.h:20
LX_CORE_EXPORT Version & version
Definition: Variant.h:90
Definition: AbstractXMLReader.h:10
Definition: PropertyPoint.h:107
Definition: Base.h:19
std::vector< Geom::Pnt > _pointList
Definition: PropertyPoint.h:70
Definition: Writer.h:27
Definition: PropertyPoint.h:14
Definition: PropertyPoint.h:41
Definition: Property.h:81
Defines a non-persistent 2D cartesian point.
Definition: Pnt2d.h:33
TYPESYSTEM_HEADER()
DECLARE_PROPERTY_FACTORY(PropertyAxis1_Factory, Core::PropertyAxis1)