OpenLexocad  27.1
SubElement.h
Go to the documentation of this file.
1 #pragma once
2 
3 
6 #include <Draw/DrawStyle.h>
7 #include <Draw/Texture2.h>
8 #include <Draw/Texture2Transform.h>
9 #include <Geom/Ax2.h>
10 #include <Geom/Bnd_Box.h>
11 #include <Geom/Trsf.h>
12 #include <Geom/Vec.h>
13 #include <OpenLxApp/Geometry.h>
14 #include <OpenLxApp/Material.h>
15 #include <OpenLxApp/Root.h>
16 
17 #include <memory>
18 
19 namespace App
20 {
21 class SubElement;
22 }
23 
24 namespace OpenLxApp
25 {
26 class Element;
27 
35 class LX_OPENLXAPP_EXPORT SubElement : public Root
36 #ifndef SWIG
37  ,
39  public std::enable_shared_from_this<SubElement>
40 #endif
41 {
42  PROXY_HEADER(SubElement, App::SubElement, IFCCDWKELEMENT)
43 
44 public:
45  virtual ~SubElement(void);
46 
49  std::shared_ptr<Element> getElement() const;
50  std::shared_ptr<SubElement> copy() const;
52 
55  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  void setPositionNb(long value);
106  long getPositionNb() const;
107 
108  bool isVisible() const;
109  void setVisible(bool onoff);
111 
114  void setAssociatedMaterial(std::shared_ptr<Material> aMaterial);
115  std::shared_ptr<Material> getAssociatedMaterial() const;
116  void removeAssociatedMaterial();
118 
121  bool registerPythonClass(const std::string& aClassName, const std::string& aParentClassName);
122  virtual Base::GlobalId getGlobalClassId() const;
124 
127  std::shared_ptr<PropertyInteger> registerPropertyInteger(const std::string& aName,
128  int aDefaultValue,
131  int aTranslationId = -1);
132  std::shared_ptr<PropertyEnum> registerPropertyEnum(const std::string& aName,
133  int aDefaultValue,
136  int aTranslationId = -1);
137 
138  std::shared_ptr<PropertyDouble> registerPropertyDouble(const std::string& aName,
139  double aDefaultValue,
142  int aTranslationId = -1);
143 
144  std::shared_ptr<PropertyButton> registerPropertyButton(const std::string& aName,
147  int aTranslationId = -1);
148 
149  std::shared_ptr<PropertyBool> registerPropertyBool(const std::string& aName,
150  bool aDefaultValue,
153  int aTranslationId = -1);
154 
155  std::shared_ptr<PropertyString> registerPropertyString(const std::string& aName,
156  Base::String aDefaultValue,
159  int aTranslationId = -1);
160 
161  std::shared_ptr<PropertyColor> registerPropertyColor(const std::string& aName,
162  Base::Color aDefaultValue,
165  int aTranslationId = -1);
166 
167  std::shared_ptr<OpenLxApp::Property> getProperty(const std::string& aName) const;
168  std::map<std::string, std::shared_ptr<Property>> getPropertyMap() const;
169  std::shared_ptr<PropertyInteger> getPropertyInteger(const std::string& aName) const;
170  std::shared_ptr<PropertyEnum> getPropertyEnum(const std::string& aName) const;
171  std::shared_ptr<PropertyDouble> getPropertyDouble(const std::string& aName) const;
172  std::shared_ptr<PropertyButton> getPropertyButton(const std::string& aName) const;
173  std::shared_ptr<PropertyBool> getPropertyBool(const std::string& aName) const;
174  std::shared_ptr<PropertyString> getPropertyString(const std::string& aName) const;
175  std::shared_ptr<PropertyColor> getPropertyColor(const std::string& aName) const;
176  bool isRegisteredProperty(const std::string& aName) const;
177 
178  virtual void onPropertyChanged(const std::string& aPropertyName);
179  virtual void onScaling(const Geom::Vec& aVec, const Geom::Pnt& aScaleBasePnt);
180  virtual void translateAfterScaled(const Geom::Vec& aVec, const Geom::Pnt& aScaleBasePnt);
181 
182  void setStandardManipulatorPolicy(const Core::StandardManipulatorPolicy& aPolicy);
183  void setPropertyHeader(const Base::String& aDefaultName, int aTranslationId);
184  void setPropertyGroupName(const Base::String& aDefaultName, int aTranslationId);
185  Base::String getPropertyHeader() const;
186  Base::String getPropertyGroupName() const;
188 protected:
189 #ifndef SWIG
190  void onChange(Core::DocObject* aCaller, const Core::DocObjectObserverMsg& aReason) override;
191 #endif
192 
194 };
195 
196 } // namespace OpenLxApp
Definition: Color.h:45
Definition: Property.h:38
Defines a non-persistent 3D Cartesian point.
Definition: Pnt.h:43
Editable
Definition: Property.h:35
#define PROXY_HEADER(_openlexocadclass_, _corelexocadclass_, _type_)
Definition: Globals.h:146
Visible
Definition: Property.h:29
Definition: Property.h:32
Definition: Bnd_Box.h:63
SubElement()
Definition: SubElement.h:193
A Utf-16 (windows) or ucs4 (unix) encoded string class.
Definition: String.h:23
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
Root is the base class of all BIM related entities. All BIM entities can be identified by a Globally ...
Definition: Root.h:19
Definition: DocObjectObserver.h:24
Definition: DocObject.h:51
A SubElement extends an Element. Together with the (parent) Element it describes an entity with multi...
Definition: SubElement.h:35
CoordSpace
Definition: GeomEnums.h:5
Definition: DocObjectObserver.h:9