OpenLexocad  27.0
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/Ax1.h>
10 #include <Geom/Ax2.h>
11 #include <Geom/Bnd_Box.h>
12 #include <Geom/Dir.h>
13 #include <Geom/Trsf.h>
14 #include <Geom/Vec.h>
15 #include <OpenLxApp/Geometry.h>
16 #include <OpenLxApp/Material.h>
18 #include <OpenLxApp/Root.h>
19 #include <Topo/Shape.h>
20 
21 #include <memory>
22 
23 namespace App
24 {
25 class SubElement;
26 }
27 
28 namespace OpenLxApp
29 {
30 class Element;
31 
40 #ifndef SWIG
41  ,
43  public std::enable_shared_from_this<SubElement>
44 #endif
45 {
46  PROXY_HEADER(SubElement, App::SubElement, IFCCDWKELEMENT)
47 
48 public:
49  virtual ~SubElement(void);
50 
53  std::shared_ptr<Element> getElement() const;
54  std::shared_ptr<SubElement> copy() const;
56 
59  bool setGeometry(std::shared_ptr<Geometry> geo);
60  std::shared_ptr<Geometry> getGeometry() const;
61  Geom::Trsf getGeometryToWorldTransform() const;
62  Geom::Bnd_Box getBoundingBox() const;
64 
67  Geom::Ax2 getLocalPlacement() const;
68  void setLocalPlacement(const Geom::Ax2& pos);
69  Geom::Trsf getTransform() const;
70  Geom::Trsf getLocalToWorldTransform() const;
71  void setTransform(const Geom::Trsf& t);
72  void translate(const Geom::Vec& aVec, Geom::CoordSpace aCoordSpace = Geom::CoordSpace::WCS);
73  void rotate(const Geom::Ax1& axis, double angle, Geom::CoordSpace aCoordSpace = Geom::CoordSpace::WCS);
74  bool getLocalAxes(Geom::Ax2& localAxes);
75  void setLocalAxes(const Geom::Dir& zHeight, const Geom::Dir& xLength);
77 
80  pConstShape getShape() const;
81  pConstShape getLocalShape() const;
83 
86  void setOglMaterial(const Draw::OglMaterial& mat, int faceIndex = -1);
87  Draw::OglMaterial getOglMaterial() const;
88 
89  void setAmbientColor(const Base::Color& aCol);
90  void setDiffuseColor(const Base::Color& aCol);
91  void setSpecularColor(const Base::Color& aCol);
92  void setEmissiveColor(const Base::Color& aCol);
93  void setReflectiveColor(const Base::Color& aCol);
94  void setShininess(int aVal);
95  void setTransparency(int aVal);
96 
97  void setDrawStyle(const Draw::DrawStyle& ds);
98  Draw::DrawStyle getDrawStyle() const;
99  void setLineWidth(float width);
100  void setTexture(const Draw::Texture2& tex, int faceIndex = -1);
101  void setLengthAndCrossTexture(const Draw::Texture2& lengthTexture,
102  const Draw::Texture2& crossTexture,
103  const Draw::Texture2Transform& lengthTextureTrsf = Draw::Texture2Transform(),
104  const Draw::Texture2Transform& crossTextureTrsf = Draw::Texture2Transform());
106 
109  void setPositionNb(long value);
110  long getPositionNb() const;
111 
112  bool isVisible() const;
113  void setVisible(bool onoff);
115 
118  void setAssociatedMaterial(std::shared_ptr<Material> aMaterial);
119  std::shared_ptr<Material> getAssociatedMaterial() const;
120  void removeAssociatedMaterial();
122 
125  bool registerPythonClass(const std::string& aClassName, const std::string& aParentClassName);
126  virtual Base::GlobalId getGlobalClassId() const;
128 
131  std::shared_ptr<PropertyInteger> registerPropertyInteger(const std::string& aName,
132  int aDefaultValue,
135  int aTranslationId = -1);
136  std::shared_ptr<PropertyEnum> registerPropertyEnum(const std::string& aName,
137  int aDefaultValue,
140  int aTranslationId = -1);
141 
142  std::shared_ptr<PropertyDouble> registerPropertyDouble(const std::string& aName,
143  double aDefaultValue,
146  int aTranslationId = -1);
147 
148  std::shared_ptr<PropertyButton> registerPropertyButton(const std::string& aName,
151  int aTranslationId = -1);
152 
153  std::shared_ptr<PropertyBool> registerPropertyBool(const std::string& aName,
154  bool aDefaultValue,
157  int aTranslationId = -1);
158 
159  std::shared_ptr<PropertyString> registerPropertyString(const std::string& aName,
160  Base::String aDefaultValue,
163  int aTranslationId = -1);
164 
165  std::shared_ptr<PropertyColor> registerPropertyColor(const std::string& aName,
166  Base::Color aDefaultValue,
169  int aTranslationId = -1);
170 
171  std::shared_ptr<OpenLxApp::Property> getProperty(const std::string& aName) const;
172  std::map<std::string, std::shared_ptr<Property>> getPropertyMap() const;
173  std::shared_ptr<PropertyInteger> getPropertyInteger(const std::string& aName) const;
174  std::shared_ptr<PropertyEnum> getPropertyEnum(const std::string& aName) const;
175  std::shared_ptr<PropertyDouble> getPropertyDouble(const std::string& aName) const;
176  std::shared_ptr<PropertyButton> getPropertyButton(const std::string& aName) const;
177  std::shared_ptr<PropertyBool> getPropertyBool(const std::string& aName) const;
178  std::shared_ptr<PropertyString> getPropertyString(const std::string& aName) const;
179  std::shared_ptr<PropertyColor> getPropertyColor(const std::string& aName) const;
180  bool isRegisteredProperty(const std::string& aName) const;
181 
182  virtual void onPropertyChanged(const std::string& aPropertyName);
183  virtual void onScaling(const Geom::Vec& aVec, const Geom::Pnt& aScaleBasePnt);
184  virtual void translateAfterScaled(const Geom::Vec& aVec, const Geom::Pnt& aScaleBasePnt);
185 
186  void setStandardManipulatorPolicy(const Core::StandardManipulatorPolicy& aPolicy);
187  void setPropertyHeader(const Base::String& aDefaultName, int aTranslationId);
188  void setPropertyGroupName(const Base::String& aDefaultName, int aTranslationId);
189  Base::String getPropertyHeader() const;
190  Base::String getPropertyGroupName() const;
192 protected:
193 #ifndef SWIG
194  void onChange(Core::DocObject* aCaller, const Core::DocObjectObserverMsg& aReason) override;
195 #endif
196 
198 };
199 
200 } // namespace OpenLxApp
Definition: Color.h:47
Definition: Property.h:41
Defines a non-persistent 3D Cartesian point.
Definition: Pnt.h:42
Editable
Definition: Property.h:38
#define PROXY_HEADER(_openlexocadclass_, _corelexocadclass_, _type_)
Definition: Globals.h:149
Visible
Definition: Property.h:32
Definition: Property.h:35
Definition: Bnd_Box.h:66
SubElement()
Definition: SubElement.h:197
A Utf-16 (windows) or ucs4 (unix) encoded string class.
Definition: String.h:29
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
Root is the base class of all BIM related entities. All BIM entities can be identified by a Globally ...
Definition: Root.h:20
Definition: DocObjectObserver.h:25
Definition: DocObject.h:28
A SubElement extends an Element. Together with the (parent) Element it describes an entity with multi...
Definition: SubElement.h:39
CoordSpace
Definition: GeomEnums.h:8
Definition: DocObjectObserver.h:10