OpenLexocad  28.0
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;
56 
60  void setLocalPlacement(const Geom::Ax2& pos);
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 
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);
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;
173 
174  virtual int getScriptVersion();
175  virtual void convertFromOldVersion(int pythonProductVersion);
176  virtual void onPropertyChanged(const std::string& aPropertyName);
177  virtual void onScaling(const Geom::Vec& aVec, const Geom::Pnt& aScaleBasePnt);
178  virtual void translateAfterScaled(const Geom::Vec& aVec, const Geom::Pnt& aScaleBasePnt);
179 
181  void setPropertyHeader(const Base::String& aDefaultName, int aTranslationId);
182  void setPropertyHeader(const Base::String& aDefaultName);
183  void setPropertyGroupName(const Base::String& aDefaultName, int aTranslationId);
184  void setPropertyGroupName(const Base::String& aDefaultName);
188 
191  std::shared_ptr<PropertyUser> getPropertyUser(const std::string& aName) const;
192  std::vector<std::shared_ptr<PropertyUser>> getPropertyUser() const;
193  std::vector<Base::String> getPropertySetNames() const;
194  std::shared_ptr<PropertySet> getPropertySetByName(const Base::String& aName) const;
196 
197  virtual ~Product(void);
198 
199 
206 
207  /* Form UIElement
208  void setTmpVisible(bool onoff);
209  bool isTmpVisible() const;
210  //void setTmpSelected(bool on, bool singleselect = false);
211  //void setTmpGreyscale(bool on);
212  //void setTmpHiddenLine(bool on);
213  //void setTmpTexturesGrey(bool onoff);
214  void setHighlighted(bool onoff, int r, int g, int b);
215  //void setHasDragger(bool on);
216  //bool hasDragger();
217  //void setTmpDrawStyle(const Draw::DrawStyle& ds);
218  //void setPickable(bool);
219  //bool isPickable();
220  void setTmpBaseColor(int r, int g, int b);
221  void removeTmpBaseColor();
222  //int getTmpTransparency() const;
223  //void setTmpTransparency(int value);
224  //void setLODEnabled(bool onoff);
225  //void drawBoundingBox(bool onoff);
226  void setTmpWireframe(bool on);
227  bool hasTmpWireframe() const;
228  Geom::Bnd_Box getBoundingBox();
229  */
230 
231 protected:
232 #ifndef SWIG
233  void onChange(Core::DocObject* aCaller, const Core::DocObjectObserverMsg& aReason) override;
234 
235 #endif
237 };
238 
239 } // namespace OpenLxApp
OpenLxApp::Product::getLocalShape
pConstShape getLocalShape() const
OpenLxApp
Definition: ActiveScript.h:10
OpenLxApp::Product::getPositionNb
long getPositionNb() const
OpenLxApp::Product::getLocalPlacement
Geom::Ax2 getLocalPlacement() const
OpenLxApp::Product
The Product is an abstract representation of any object that relates to a geometric or spatial contex...
Definition: Product.h:45
Geom::Bnd_Box
Definition: Bnd_Box.h:67
Base::Color
Definition: Color.h:39
OpenLxApp::Product::getPropertyGroupName
Base::String getPropertyGroupName() const
Value.h
Trsf.h
OpenLxApp::Product::setOglMaterial
void setOglMaterial(const Draw::OglMaterial &mat, int faceIndex=-1)
OpenLxApp::Product::setPositionNb
void setPositionNb(long value)
OpenLxApp::Product::setSpatialStructure
void setSpatialStructure(std::shared_ptr< SpatialStructureElement > aSpatialStructureElement)
OpenLxApp::Product::getPropertySetByName
std::shared_ptr< PropertySet > getPropertySetByName(const Base::String &aName) const
FORWARD_DECL
#define FORWARD_DECL(x, y)
Definition: Globals.h:93
OpenLxApp::Product::getPropertyBool
std::shared_ptr< PropertyBool > getPropertyBool(const std::string &aName) const
OpenLxApp::Product::getShape
pConstShape getShape() const
OpenLxApp::Product::getPropertyButton
std::shared_ptr< PropertyButton > getPropertyButton(const std::string &aName) const
OpenLxApp::Product::setSpecularColor
void setSpecularColor(const Base::Color &aCol)
OpenLxApp::Product::getLocalToWorldTransform
Geom::Trsf getLocalToWorldTransform() const
Ax1.h
OpenLxApp::Product::getPropertyHeader
Base::String getPropertyHeader() const
Geom::CoordSpace::WCS
@ WCS
OpenLxApp::Product::getProperty
std::shared_ptr< OpenLxApp::Property > getProperty(const std::string &aName) const
OpenLxApp::Product::Product
Product()
OpenLxApp::Product::setAmbientColor
void setAmbientColor(const Base::Color &aCol)
OpenLxApp::Product::setTransform
void setTransform(const Geom::Trsf &t)
OpenLxApp::Product::setDiffuseColor
void setDiffuseColor(const Base::Color &aCol)
OpenLxApp::Product::updatePythonProductVersion
void updatePythonProductVersion()
Core::DocObjectObserverMsg
Definition: DocObjectObserver.h:9
Geom::Vec
Defines a non-persistent vector in 3D space.
Definition: Vec.h:41
OpenLxApp::Product::getScriptVersion
virtual int getScriptVersion()
Base::GlobalId
Definition: GlobalId.h:28
PROXY_HEADER_ABSTRACT
#define PROXY_HEADER_ABSTRACT(_openlexocadclass_, _corelexocadclass_, _type_)
Definition: Globals.h:137
OpenLxApp::Product::onChange
void onChange(Core::DocObject *aCaller, const Core::DocObjectObserverMsg &aReason) override
OpenLxApp::Product::getPropertyDouble
std::shared_ptr< PropertyDouble > getPropertyDouble(const std::string &aName) const
OpenLxApp::Product::setGeometry
virtual bool setGeometry(std::shared_ptr< Geometry > geo)
OpenLxApp::Product::setReflectiveColor
void setReflectiveColor(const Base::Color &aCol)
OpenLxApp::Product::setLineWidth
void setLineWidth(float width)
OpenLxApp::Product::isVisible
bool isVisible() const
Core::StandardManipulatorPolicy
Definition: StandardManipulatorPolicy.h:8
OpenLxApp::Property::Editable
Editable
Definition: Property.h:36
OpenLxApp::Product::getPropertyUser
std::vector< std::shared_ptr< PropertyUser > > getPropertyUser() const
OpenLxApp::Product::setExternalPythonTypeObject
void setExternalPythonTypeObject(ExternalPythonTypeObject *aObj)
OpenLxApp::Product::rotate
void rotate(const Geom::Ax1 &axis, double angle, Geom::CoordSpace aCoordSpace=Geom::CoordSpace::WCS)
OpenLxApp::Product::convertFromOldVersion
virtual void convertFromOldVersion(int pythonProductVersion)
OpenLxApp::Product::getLocalAxes
bool getLocalAxes(Geom::Ax2 &localAxes)
Geom::Ax1
Definition: Ax1.h:50
OpenLxApp::Product::onPropertyChanged
virtual void onPropertyChanged(const std::string &aPropertyName)
OpenLxApp::Product::setVisible
void setVisible(bool onoff)
OpenLxApp::Product::setLocalPlacement
void setLocalPlacement(const Geom::Ax2 &pos)
pConstShape
std::shared_ptr< Topo::Shape const > pConstShape
Definition: Variant.h:65
OpenLxApp::Product::setPropertyGroupName
void setPropertyGroupName(const Base::String &aDefaultName, int aTranslationId)
OpenLxApp::Product::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)
DocObjectObserver.h
Geom::Dir
Definition: Dir.h:45
OpenLxApp::Product::getDrawStyle
Draw::DrawStyle getDrawStyle() const
OpenLxApp::Product::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::Product::getPropertySetNames
std::vector< Base::String > getPropertySetNames() const
OpenLxApp::Product::setTransparency
void setTransparency(int aVal)
Core::DocObject
Definition: DocObject.h:54
OpenLxApp::Product::isRegisteredProperty
bool isRegisteredProperty(const std::string &aName) const
OpenLxApp::Product::getPropertyMap
std::map< std::string, std::shared_ptr< Property > > getPropertyMap() const
OpenLxApp::Product::registerPythonClass
bool registerPythonClass(const std::string &aClassName, const std::string &aParentClassName)
Property.h
OpenLxApp::Product::setPropertyHeader
void setPropertyHeader(const Base::String &aDefaultName)
OpenLxApp::Product::getTransform
Geom::Trsf getTransform() const
Geom::Pnt
Defines a non-persistent 3D Cartesian point.
Definition: Pnt.h:44
PropertySet.h
Geom::Ax2
Definition: Ax2.h:66
OpenLxApp::Product::setPropertyGroupName
void setPropertyGroupName(const Base::String &aDefaultName)
OpenLxApp::Product::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)
Geom::CoordSpace
CoordSpace
Definition: GeomEnums.h:6
OpenLxApp::Product::setStandardManipulatorPolicy
void setStandardManipulatorPolicy(const Core::StandardManipulatorPolicy &aPolicy)
OpenLxApp::Product::setShininess
void setShininess(int aVal)
OpenLxApp::Product::getPropertyColor
std::shared_ptr< PropertyColor > getPropertyColor(const std::string &aName) const
OpenLxApp::ExternalPythonTypeObject
DEPRECATED. Do not use!
Definition: ExternalPythonTypeObject.h:19
OpenLxApp::Product::translate
void translate(const Geom::Vec &aVec, Geom::CoordSpace aCoordSpace=Geom::CoordSpace::WCS)
OpenLxApp::Object
An IfcObject is the generalization of any semantically treated thing or process. Objects are things a...
Definition: Object.h:47
OpenLxApp::Product::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::Product::getPropertyInteger
std::shared_ptr< PropertyInteger > getPropertyInteger(const std::string &aName) const
OpenLxApp::Product::getGeometryToWorldTransform
Geom::Trsf getGeometryToWorldTransform() const
OpenLxApp::Product::setLengthAndCrossTexture
void setLengthAndCrossTexture(const Draw::Texture2 &lengthTexture, const Draw::Texture2 &crossTexture, const Draw::Texture2Transform &lengthTextureTrsf=Draw::Texture2Transform(), const Draw::Texture2Transform &crossTextureTrsf=Draw::Texture2Transform())
OpenLxApp::Product::setTexture
void setTexture(const Draw::Texture2 &tex, int faceIndex=-1)
Core::DocObjectObserver
Definition: DocObjectObserver.h:24
OpenLxApp::Product::~Product
virtual ~Product(void)
OpenLxApp::Product::setLocalAxes
void setLocalAxes(const Geom::Dir &zHeight, const Geom::Dir &xLength)
Bnd_Box.h
OpenLxApp::Product::getGlobalClassId
virtual Base::GlobalId getGlobalClassId() const
OpenLxApp::Property::Visible
Visible
Definition: Property.h:30
OpenLxApp::Product::onScaling
virtual void onScaling(const Geom::Vec &aVec, const Geom::Pnt &aScaleBasePnt)
OpenLxApp::Product::getPropertyUser
std::shared_ptr< PropertyUser > getPropertyUser(const std::string &aName) const
OpenLxApp::Product::getSpatialStructure
std::shared_ptr< SpatialStructureElement > getSpatialStructure() const
OpenLxApp::Product::removeExternalTypeObject
void removeExternalTypeObject()
StandardManipulatorPolicy.h
OpenLxApp::Product::registerPropertyButton
std::shared_ptr< PropertyButton > registerPropertyButton(const std::string &aName, Property::Visible aVisible=Property::VISIBLE, Property::Editable aEditable=Property::EDITABLE, int aTranslationId=-1)
OpenLxApp::Product::setEmissiveColor
void setEmissiveColor(const Base::Color &aCol)
OpenLxApp::Product::getBoundingBox
Geom::Bnd_Box getBoundingBox() const
Geom::Trsf
Definition: Trsf.h:58
Base::String
A Utf-16 (windows) or ucs4 (unix) encoded string class.
Definition: String.h:18
OpenLxApp::Product::getExternalPythonTypeObject
ExternalPythonTypeObject * getExternalPythonTypeObject() const
Ax2.h
OpenLxApp::Product::getGeometry
std::shared_ptr< Geometry > getGeometry() const
OpenLxApp::Property::VISIBLE
@ VISIBLE
Definition: Property.h:32
OpenLxApp::Product::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::Property::EDITABLE
@ EDITABLE
Definition: Property.h:38
Dir.h
Object.h
Geometry.h
OpenLxApp::Product::getPropertyString
std::shared_ptr< PropertyString > getPropertyString(const std::string &aName) const
OpenLxApp::Product::setPropertyHeader
void setPropertyHeader(const Base::String &aDefaultName, int aTranslationId)
OpenLxApp::Product::setDrawStyle
void setDrawStyle(const Draw::DrawStyle &ds)
OpenLxApp::Product::translateAfterScaled
virtual void translateAfterScaled(const Geom::Vec &aVec, const Geom::Pnt &aScaleBasePnt)
OpenLxApp::Product::getOglMaterial
Draw::OglMaterial getOglMaterial() const
OpenLxApp::Product::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)
OpenLxApp::Product::getPropertyEnum
std::shared_ptr< PropertyEnum > getPropertyEnum(const std::string &aName) const