OpenLexocad  27.0
Product.h
Go to the documentation of this file.
1 #pragma once
2 
3 
4 #include <Base/Exception.h>
7 #include <Draw/DrawStyle.h>
8 #include <Draw/Texture2.h>
9 #include <Draw/Texture2Transform.h>
10 #include <Geom/Ax1.h>
11 #include <Geom/Ax2.h>
12 #include <Geom/Bnd_Box.h>
13 #include <Geom/Dir.h>
14 #include <Geom/Trsf.h>
15 #include <Geom/Vec.h>
16 #include <OpenLxApp/Geometry.h>
17 #include <OpenLxApp/Object.h>
19 #include <OpenLxApp/Property.h>
20 #include <OpenLxApp/PropertySet.h>
21 #include <OpenLxApp/Value.h>
22 
23 #include <memory>
24 
25 FORWARD_DECL(App, Product)
26 
27 namespace OpenLxApp
28 {
29 class Geometry;
30 class ExternalPythonTypeObject; // Deprecated
31 class SpatialStructureElement;
32 
42 
43 #ifndef SWIG
44  ,
46  public std::enable_shared_from_this<Product>
47 #endif
48 
49 {
50  PROXY_HEADER_ABSTRACT(Product, App::Product, IFCPRODUCT)
51 
52 public:
55  virtual bool setGeometry(std::shared_ptr<Geometry> geo);
56  std::shared_ptr<Geometry> getGeometry() const;
57  Geom::Trsf getGeometryToWorldTransform() const;
58  Geom::Bnd_Box getBoundingBox() const;
60 
63  Geom::Ax2 getLocalPlacement() const;
64  void setLocalPlacement(const Geom::Ax2& pos);
65  Geom::Trsf getTransform() const;
66  Geom::Trsf getLocalToWorldTransform() const;
67  void setTransform(const Geom::Trsf& t);
68  void translate(const Geom::Vec& aVec, Geom::CoordSpace aCoordSpace = Geom::CoordSpace::WCS);
69  void rotate(const Geom::Ax1& axis, double angle, Geom::CoordSpace aCoordSpace = Geom::CoordSpace::WCS);
70  bool getLocalAxes(Geom::Ax2& localAxes);
71  void setLocalAxes(const Geom::Dir& zHeight, const Geom::Dir& xLength);
73 
76  pConstShape getShape() const;
77  pConstShape getLocalShape() const;
79 
82  void setOglMaterial(const Draw::OglMaterial& mat, int faceIndex = -1);
83  Draw::OglMaterial getOglMaterial() const;
84 
85  void setAmbientColor(const Base::Color& aCol);
86  void setDiffuseColor(const Base::Color& aCol);
87  void setSpecularColor(const Base::Color& aCol);
88  void setEmissiveColor(const Base::Color& aCol);
89  void setReflectiveColor(const Base::Color& aCol);
90  void setShininess(int aVal);
91  void setTransparency(int aVal);
92 
93  void setDrawStyle(const Draw::DrawStyle& ds);
94  Draw::DrawStyle getDrawStyle() const;
95  void setLineWidth(float width);
96  void setTexture(const Draw::Texture2& tex, int faceIndex = -1);
97  void setLengthAndCrossTexture(const Draw::Texture2& lengthTexture,
98  const Draw::Texture2& crossTexture,
99  const Draw::Texture2Transform& lengthTextureTrsf = Draw::Texture2Transform(),
100  const Draw::Texture2Transform& crossTextureTrsf = Draw::Texture2Transform());
102 
105  std::shared_ptr<SpatialStructureElement> getSpatialStructure() const;
106  void setSpatialStructure(std::shared_ptr<SpatialStructureElement> aSpatialStructureElement);
108 
111  void setPositionNb(long value);
112  long getPositionNb() const;
113 
114  bool isVisible() const;
115  void setVisible(bool onoff);
117 
120  bool registerPythonClass(const std::string& aClassName, const std::string& aParentClassName);
121  virtual Base::GlobalId getGlobalClassId() const;
123 
126  std::shared_ptr<PropertyInteger> registerPropertyInteger(const std::string& aName,
127  int aDefaultValue,
130  int aTranslationId = -1);
131  std::shared_ptr<PropertyEnum> registerPropertyEnum(const std::string& aName,
132  int aDefaultValue,
135  int aTranslationId = -1);
136 
137  std::shared_ptr<PropertyDouble> registerPropertyDouble(const std::string& aName,
138  double aDefaultValue,
141  int aTranslationId = -1);
142 
143  std::shared_ptr<PropertyButton> registerPropertyButton(const std::string& aName,
146  int aTranslationId = -1);
147 
148  std::shared_ptr<PropertyBool> registerPropertyBool(const std::string& aName,
149  bool aDefaultValue,
152  int aTranslationId = -1);
153 
154  std::shared_ptr<PropertyString> registerPropertyString(const std::string& aName,
155  Base::String aDefaultValue,
158  int aTranslationId = -1);
159 
160  std::shared_ptr<PropertyColor> registerPropertyColor(const std::string& aName,
161  Base::Color aDefaultValue,
164  int aTranslationId = -1);
165 
166  std::shared_ptr<OpenLxApp::Property> getProperty(const std::string& aName) const;
167  std::map<std::string, std::shared_ptr<Property>> getPropertyMap() const;
168  std::shared_ptr<PropertyInteger> getPropertyInteger(const std::string& aName) const;
169  std::shared_ptr<PropertyEnum> getPropertyEnum(const std::string& aName) const;
170  std::shared_ptr<PropertyDouble> getPropertyDouble(const std::string& aName) const;
171  std::shared_ptr<PropertyButton> getPropertyButton(const std::string& aName) const;
172  std::shared_ptr<PropertyBool> getPropertyBool(const std::string& aName) const;
173  std::shared_ptr<PropertyString> getPropertyString(const std::string& aName) const;
174  std::shared_ptr<PropertyColor> getPropertyColor(const std::string& aName) const;
175  bool isRegisteredProperty(const std::string& aName) const;
176 
177  virtual void onPropertyChanged(const std::string& aPropertyName);
178  virtual void onScaling(const Geom::Vec& aVec, const Geom::Pnt& aScaleBasePnt);
179  virtual void translateAfterScaled(const Geom::Vec& aVec, const Geom::Pnt& aScaleBasePnt);
180 
181  void setStandardManipulatorPolicy(const Core::StandardManipulatorPolicy& aPolicy);
182  void setPropertyHeader(const Base::String& aDefaultName, int aTranslationId);
183  void setPropertyHeader(const Base::String& aDefaultName);
184  void setPropertyGroupName(const Base::String& aDefaultName, int aTranslationId);
185  void setPropertyGroupName(const Base::String& aDefaultName);
186  Base::String getPropertyHeader() const;
187  Base::String getPropertyGroupName() const;
189 
192  std::shared_ptr<PropertyUser> getPropertyUser(const std::string& aName) const;
193  std::vector<std::shared_ptr<PropertyUser>> getPropertyUser() const;
194  std::vector<Base::String> getPropertySetNames() const;
195  std::shared_ptr<PropertySet> getPropertySetByName(const Base::String& aName) const;
197 
198  virtual ~Product(void);
199 
200 
203  ExternalPythonTypeObject* getExternalPythonTypeObject() const;
204  void setExternalPythonTypeObject(ExternalPythonTypeObject* aObj);
205  void removeExternalTypeObject();
207 
208  /* Form UIElement
209  void setTmpVisible(bool onoff);
210  bool isTmpVisible() const;
211  //void setTmpSelected(bool on, bool singleselect = false);
212  //void setTmpGreyscale(bool on);
213  //void setTmpHiddenLine(bool on);
214  //void setTmpTexturesGrey(bool onoff);
215  void setHighlighted(bool onoff, int r, int g, int b);
216  //void setHasDragger(bool on);
217  //bool hasDragger();
218  //void setTmpDrawStyle(const Draw::DrawStyle& ds);
219  //void setPickable(bool);
220  //bool isPickable();
221  void setTmpBaseColor(int r, int g, int b);
222  void removeTmpBaseColor();
223  //int getTmpTransparency() const;
224  //void setTmpTransparency(int value);
225  //void setLODEnabled(bool onoff);
226  //void drawBoundingBox(bool onoff);
227  void setTmpWireframe(bool on);
228  bool hasTmpWireframe() const;
229  Geom::Bnd_Box getBoundingBox();
230  */
231 
232 protected:
233 #ifndef SWIG
234  void onChange(Core::DocObject* aCaller, const Core::DocObjectObserverMsg& aReason) override;
235 
236 #endif
237  Product();
238 };
239 
240 } // namespace OpenLxApp
The Product is an abstract representation of any object that relates to a geometric or spatial contex...
Definition: Product.h:41
Definition: Color.h:47
An IfcObject is the generalization of any semantically treated thing or process. Objects are things a...
Definition: Object.h:49
Definition: Property.h:41
Defines a non-persistent 3D Cartesian point.
Definition: Pnt.h:42
Editable
Definition: Property.h:38
Visible
Definition: Property.h:32
Definition: Property.h:35
Definition: Bnd_Box.h:66
A Utf-16 (windows) or ucs4 (unix) encoded string class.
Definition: String.h:29
#define PROXY_HEADER_ABSTRACT(_openlexocadclass_, _corelexocadclass_, _type_)
Definition: Globals.h:140
Definition: Ax2.h:69
Definition: Trsf.h:58
#define OPENLXAPP_EXPORT
Definition: OpenLxApp_defines.h:12
Definition: Dir.h:46
Definition: GlobalId.h:32
Definition: ActiveScript.h:9
Definition: StandardManipulatorPolicy.h:9
Definition: Ax1.h:52
Defines a non-persistent vector in 3D space.
Definition: Vec.h:45
std::shared_ptr< Topo::Shape const > pConstShape
Definition: Variant.h:81
#define FORWARD_DECL(x, y)
Definition: Globals.h:96
DEPRECATED. Do not use!
Definition: ExternalPythonTypeObject.h:19
Definition: DocObjectObserver.h:25
Definition: DocObject.h:28
CoordSpace
Definition: GeomEnums.h:8
Definition: DocObjectObserver.h:10