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