OpenLexocad  28.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/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;
60 
64  void setLocalPlacement(const Geom::Ax2& pos);
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 
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;
118 
121  bool registerPythonClass(const std::string& aClassName, const std::string& aParentClassName);
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;
178 
179  virtual int getScriptVersion();
180  virtual void convertFromOldVersion(int pythonProductVersion);
181  virtual void onPropertyChanged(const std::string& aPropertyName);
182  virtual void onScaling(const Geom::Vec& aVec, const Geom::Pnt& aScaleBasePnt);
183  virtual void translateAfterScaled(const Geom::Vec& aVec, const Geom::Pnt& aScaleBasePnt);
184 
186  void setPropertyHeader(const Base::String& aDefaultName, int aTranslationId);
187  void setPropertyGroupName(const Base::String& aDefaultName, int aTranslationId);
191 protected:
192 #ifndef SWIG
193  void onChange(Core::DocObject* aCaller, const Core::DocObjectObserverMsg& aReason) override;
194 #endif
195 
197 };
198 
199 } // namespace OpenLxApp
OpenLxApp::SubElement::isVisible
bool isVisible() const
OpenLxApp
Definition: ActiveScript.h:10
OpenLxApp::SubElement::getShape
pConstShape getShape() const
OpenLxApp::SubElement::removeAssociatedMaterial
void removeAssociatedMaterial()
Geom::Bnd_Box
Definition: Bnd_Box.h:67
Vec.h
Base::Color
Definition: Color.h:39
Trsf.h
OpenLxApp::SubElement::setTransform
void setTransform(const Geom::Trsf &t)
OpenLxApp::SubElement::registerPropertyInteger
std::shared_ptr< PropertyInteger > registerPropertyInteger(const std::string &aName, int aDefaultValue, Property::Visible aVisible=Property::VISIBLE, Property::Editable aEditable=Property::EDITABLE, int aTranslationId=-1)
OpenLxApp::SubElement::setLocalPlacement
void setLocalPlacement(const Geom::Ax2 &pos)
OpenLxApp::SubElement::getPropertyHeader
Base::String getPropertyHeader() const
OpenLxApp::SubElement::setShininess
void setShininess(int aVal)
OpenLxApp::SubElement::setGeometry
bool setGeometry(std::shared_ptr< Geometry > geo)
OpenLxApp::SubElement::registerPythonClass
bool registerPythonClass(const std::string &aClassName, const std::string &aParentClassName)
Geom::CoordSpace::WCS
@ WCS
OpenLxApp::SubElement::getBoundingBox
Geom::Bnd_Box getBoundingBox() const
OpenLxApp::SubElement::getPropertyInteger
std::shared_ptr< PropertyInteger > getPropertyInteger(const std::string &aName) const
OpenLxApp::SubElement::getGlobalClassId
virtual Base::GlobalId getGlobalClassId() const
Core::DocObjectObserverMsg
Definition: DocObjectObserver.h:9
Geom::Vec
Defines a non-persistent vector in 3D space.
Definition: Vec.h:41
Base::GlobalId
Definition: GlobalId.h:28
OpenLxApp::SubElement::setPropertyHeader
void setPropertyHeader(const Base::String &aDefaultName, int aTranslationId)
OpenLxApp::SubElement::setStandardManipulatorPolicy
void setStandardManipulatorPolicy(const Core::StandardManipulatorPolicy &aPolicy)
OpenLxApp::SubElement::translateAfterScaled
virtual void translateAfterScaled(const Geom::Vec &aVec, const Geom::Pnt &aScaleBasePnt)
OpenLxApp::SubElement::copy
std::shared_ptr< SubElement > copy() const
OpenLxApp::SubElement::registerPropertyString
std::shared_ptr< PropertyString > registerPropertyString(const std::string &aName, Base::String aDefaultValue, Property::Visible aVisible=Property::VISIBLE, Property::Editable aEditable=Property::EDITABLE, int aTranslationId=-1)
OpenLxApp::SubElement::getPropertyString
std::shared_ptr< PropertyString > getPropertyString(const std::string &aName) const
OpenLxApp::SubElement::getLocalToWorldTransform
Geom::Trsf getLocalToWorldTransform() const
OpenLxApp::SubElement::getPropertyButton
std::shared_ptr< PropertyButton > getPropertyButton(const std::string &aName) const
OpenLxApp::SubElement::getPropertyBool
std::shared_ptr< PropertyBool > getPropertyBool(const std::string &aName) const
OpenLxApp::SubElement::setDrawStyle
void setDrawStyle(const Draw::DrawStyle &ds)
OpenLxApp::SubElement::setLengthAndCrossTexture
void setLengthAndCrossTexture(const Draw::Texture2 &lengthTexture, const Draw::Texture2 &crossTexture, const Draw::Texture2Transform &lengthTextureTrsf=Draw::Texture2Transform(), const Draw::Texture2Transform &crossTextureTrsf=Draw::Texture2Transform())
Core::StandardManipulatorPolicy
Definition: StandardManipulatorPolicy.h:8
OpenLxApp::Property::Editable
Editable
Definition: Property.h:36
Material.h
OpenLxApp::SubElement::~SubElement
virtual ~SubElement(void)
OpenLxApp::SubElement::setDiffuseColor
void setDiffuseColor(const Base::Color &aCol)
Geom::Ax1
Definition: Ax1.h:50
pConstShape
std::shared_ptr< Topo::Shape const > pConstShape
Definition: Variant.h:65
OpenLxApp::SubElement
A SubElement extends an Element. Together with the (parent) Element it describes an entity with multi...
Definition: SubElement.h:41
OpenLxApp::SubElement::setEmissiveColor
void setEmissiveColor(const Base::Color &aCol)
OpenLxApp::SubElement::setPositionNb
void setPositionNb(long value)
DocObjectObserver.h
OpenLxApp::SubElement::translate
void translate(const Geom::Vec &aVec, Geom::CoordSpace aCoordSpace=Geom::CoordSpace::WCS)
OpenLxApp::SubElement::setAmbientColor
void setAmbientColor(const Base::Color &aCol)
OpenLxApp::SubElement::getScriptVersion
virtual int getScriptVersion()
Geom::Dir
Definition: Dir.h:45
OpenLxApp::SubElement::getPropertyColor
std::shared_ptr< PropertyColor > getPropertyColor(const std::string &aName) const
OpenLxApp::SubElement::getPropertyMap
std::map< std::string, std::shared_ptr< Property > > getPropertyMap() const
OpenLxApp::SubElement::getDrawStyle
Draw::DrawStyle getDrawStyle() const
OpenLxApp::SubElement::getTransform
Geom::Trsf getTransform() const
OpenLxApp::SubElement::getGeometry
std::shared_ptr< Geometry > getGeometry() const
Core::DocObject
Definition: DocObject.h:54
OpenLxApp::SubElement::getGeometryToWorldTransform
Geom::Trsf getGeometryToWorldTransform() const
OpenLxApp::SubElement::setVisible
void setVisible(bool onoff)
OpenLxApp::SubElement::setSpecularColor
void setSpecularColor(const Base::Color &aCol)
OpenLxApp::SubElement::getLocalAxes
bool getLocalAxes(Geom::Ax2 &localAxes)
OpenLxApp::SubElement::setReflectiveColor
void setReflectiveColor(const Base::Color &aCol)
OpenLxApp::SubElement::convertFromOldVersion
virtual void convertFromOldVersion(int pythonProductVersion)
OpenLxApp::SubElement::SubElement
SubElement()
Definition: SubElement.h:196
Geom::Pnt
Defines a non-persistent 3D Cartesian point.
Definition: Pnt.h:44
Geom::Ax2
Definition: Ax2.h:66
Root.h
OpenLxApp::SubElement::setOglMaterial
void setOglMaterial(const Draw::OglMaterial &mat, int faceIndex=-1)
OpenLxApp::SubElement::setPropertyGroupName
void setPropertyGroupName(const Base::String &aDefaultName, int aTranslationId)
OpenLxApp::SubElement::onScaling
virtual void onScaling(const Geom::Vec &aVec, const Geom::Pnt &aScaleBasePnt)
OpenLxApp::SubElement::getOglMaterial
Draw::OglMaterial getOglMaterial() const
Geom::CoordSpace
CoordSpace
Definition: GeomEnums.h:6
OpenLxApp::SubElement::getAssociatedMaterial
std::shared_ptr< Material > getAssociatedMaterial() const
OpenLxApp::SubElement::getPropertyGroupName
Base::String getPropertyGroupName() const
OpenLxApp::SubElement::getLocalPlacement
Geom::Ax2 getLocalPlacement() const
OpenLxApp::SubElement::registerPropertyEnum
std::shared_ptr< PropertyEnum > registerPropertyEnum(const std::string &aName, int aDefaultValue, Property::Visible aVisible=Property::VISIBLE, Property::Editable aEditable=Property::EDITABLE, int aTranslationId=-1)
OpenLxApp::SubElement::onChange
void onChange(Core::DocObject *aCaller, const Core::DocObjectObserverMsg &aReason) override
OpenLxApp::SubElement::updatePythonProductVersion
void updatePythonProductVersion()
OpenLxApp::SubElement::registerPropertyColor
std::shared_ptr< PropertyColor > registerPropertyColor(const std::string &aName, Base::Color aDefaultValue, Property::Visible aVisible=Property::VISIBLE, Property::Editable aEditable=Property::EDITABLE, int aTranslationId=-1)
OpenLxApp::SubElement::getPropertyEnum
std::shared_ptr< PropertyEnum > getPropertyEnum(const std::string &aName) const
OpenLxApp::SubElement::getProperty
std::shared_ptr< OpenLxApp::Property > getProperty(const std::string &aName) const
OpenLxApp::SubElement::getLocalShape
pConstShape getLocalShape() const
Core::DocObjectObserver
Definition: DocObjectObserver.h:24
OpenLxApp::SubElement::onPropertyChanged
virtual void onPropertyChanged(const std::string &aPropertyName)
OpenLxApp::Root
Root is the base class of all BIM related entities. All BIM entities can be identified by a Globally ...
Definition: Root.h:20
OpenLxApp::SubElement::getPropertyDouble
std::shared_ptr< PropertyDouble > getPropertyDouble(const std::string &aName) const
OpenLxApp::SubElement::setTransparency
void setTransparency(int aVal)
OpenLxApp::SubElement::registerPropertyDouble
std::shared_ptr< PropertyDouble > registerPropertyDouble(const std::string &aName, double aDefaultValue, Property::Visible aVisible=Property::VISIBLE, Property::Editable aEditable=Property::EDITABLE, int aTranslationId=-1)
Bnd_Box.h
OpenLxApp::Property::Visible
Visible
Definition: Property.h:30
OpenLxApp::SubElement::isRegisteredProperty
bool isRegisteredProperty(const std::string &aName) const
StandardManipulatorPolicy.h
OpenLxApp::SubElement::getElement
std::shared_ptr< Element > getElement() const
OpenLxApp::SubElement::setLocalAxes
void setLocalAxes(const Geom::Dir &zHeight, const Geom::Dir &xLength)
Geom::Trsf
Definition: Trsf.h:58
Base::String
A Utf-16 (windows) or ucs4 (unix) encoded string class.
Definition: String.h:18
Ax2.h
OpenLxApp::SubElement::registerPropertyBool
std::shared_ptr< PropertyBool > registerPropertyBool(const std::string &aName, bool aDefaultValue, Property::Visible aVisible=Property::VISIBLE, Property::Editable aEditable=Property::EDITABLE, int aTranslationId=-1)
OpenLxApp::Property::VISIBLE
@ VISIBLE
Definition: Property.h:32
OpenLxApp::Property::EDITABLE
@ EDITABLE
Definition: Property.h:38
OpenLxApp::SubElement::setTexture
void setTexture(const Draw::Texture2 &tex, int faceIndex=-1)
Geometry.h
OpenLxApp::SubElement::setAssociatedMaterial
void setAssociatedMaterial(std::shared_ptr< Material > aMaterial)
OpenLxApp::SubElement::rotate
void rotate(const Geom::Ax1 &axis, double angle, Geom::CoordSpace aCoordSpace=Geom::CoordSpace::WCS)
OpenLxApp::SubElement::getPositionNb
long getPositionNb() const
OpenLxApp::SubElement::setLineWidth
void setLineWidth(float width)
PROXY_HEADER
#define PROXY_HEADER(_openlexocadclass_, _corelexocadclass_, _type_)
Definition: Globals.h:146
OpenLxApp::SubElement::registerPropertyButton
std::shared_ptr< PropertyButton > registerPropertyButton(const std::string &aName, Property::Visible aVisible=Property::VISIBLE, Property::Editable aEditable=Property::EDITABLE, int aTranslationId=-1)