DATAKIT API  V2025.2
IFCWriter.h
Go to the documentation of this file.
1 #ifndef _IFCW_HPP_
2 #define _IFCW_HPP_
3 
5 namespace Ifcw
6 {
18  {
19  protected:
20  public:
21 
24  {
25  }
26 
31  };
32 
51  {
64  projectPhase("Project Phase"),
65  projectName("Project Name"),
66  projectDetailedName("Project Detailed Name"),
67  buildingAddress("Building Address"),
68  buildingName("Building Name"),
69  projectAuthor("Author"),
70  organizationName("Organization name"),
71  organizationDescription("Organization description"),
72  siteLatitude(0.),
73  siteLongitude(0.),
74  siteElevation(0.)
75  { };
78  };
79 
80 
85  {
86  private:
87  int day;
88  int month;
89  int year;
90  public:
93  IfcCalendarDate( const int& inDay, const int& inMonth, const int& iYear );
94  friend bool operator==( IfcCalendarDate const& lhs, IfcCalendarDate const& rhs )
95  {
96  return lhs.day == rhs.day && lhs.month == rhs.month && lhs.year == rhs.year;
97  };
100  int GetDay() const;
103  int GetMonth() const;
106  int GetYear() const;
107  };
108 
109  namespace classification
110  {
117  {
118  private:
119  IfcCalendarDate editionDate;
120  Dtk_string source;
121  Dtk_string edition;
122  Dtk_string name;
123  public:
132  IfcClassification( Dtk_string inSource, Dtk_string inEdition, Dtk_string inName = "" );
133  friend bool operator==( IfcClassification const& lhs, IfcClassification const& rhs )
134  {
135  return lhs.editionDate == rhs.editionDate && lhs.source == rhs.source && lhs.edition == rhs.edition && lhs.name == rhs.name;
136  };
142  const Dtk_string & GetSource() const;
145  const Dtk_string & GetEdition() const;
148  const Dtk_string & GetName() const;
151  void SetName( Dtk_string inName );
154  void SetSource( Dtk_string inSource );
157  void SetEdition( Dtk_string inEdition );
165  void SetEditionDate( int inDay, int inMonth, int inYear );
166  };
167 
175  {
176  private:
177  IfcClassification referencedSource;
178  Dtk_string location;
179  Dtk_string itemReference;
180  Dtk_string name;
181 
182  public:
185  IfcClassificationReference( Dtk_string inLocation = "", Dtk_string inItemReference = "", Dtk_string inName = "", IfcClassification inReferencedSource = IfcClassification() );
187  {
188  return lhs.referencedSource == rhs.referencedSource
189  && lhs.location == rhs.location
190  && lhs.itemReference == rhs.itemReference && lhs.name == rhs.name;
191  };
197  const Dtk_string & GetLocation() const;
200  const Dtk_string & GetItemReference() const;
203  const Dtk_string & GetName() const;
206  void SetLocation( Dtk_string inLocation );
209  void SetItemReference( Dtk_string inItemReference );
212  void SetName( Dtk_string inName );
213  };
214 
215  }
216 
222  {
240  IfcWindow
241  };
242 
248  class IfcType
249  {
250  private :
251  Dtk_tab<Dtk_MetaDataPtr> propertySet;
252  Dtk_tab <Dtk_EntityPtr> shapeReprensentation;
253  Dtk_string buildingElement;
254  Dtk_string predefinedType;
255  Dtk_string tag;
256  Dtk_string name;
257  Dtk_ID ID;
258 
259  public:
270  const Dtk_string & GetTag() const;
273  const Dtk_string & GetName() const;
276  Dtk_ID GetID() const;
282  const Dtk_string & GetPredefinedType() const;
285  void SetBuildingElementType( const Dtk_string & inType );
292  void SetPropertySet( Dtk_tab<Dtk_MetaDataPtr> inProperties, const Dtk_string & inSetName = "" );
296  void AddProperty( Dtk_MetaDataPtr inProperty, const Dtk_string & inSetName = "" );
302  void AddShape( Dtk_EntityPtr inShape );
305  void SetTag( const Dtk_string & inTag );
308  void SetName( const Dtk_string & inName );
311  void SetID( const Dtk_ID & inID );
314  void SetPredefinedType( const Dtk_string & inType );
315  };
316 
331  {
332  private:
333  classification::IfcClassificationReference classificationReference;
334  Dtk_tab<Dtk_MetaDataPtr> propertySet;
335  Dtk_string name;
336  Dtk_string buildingElementType;
337  Dtk_string predefinedType;
338  Dtk_string GUID;
339  Dtk_string level;
340  Dtk_string tag;
341  Dtk_RGB color;
342  Dtk_transfo instanceTrf;
343  Dtk_ID typeID;
344 
345  public:
357  Dtk_ID GetTypeID() const;
360  const Dtk_string & GetName() const;
363  const Dtk_string & GetGUID() const;
366  const Dtk_string & GetLevel() const;
369  const Dtk_string & GetTag() const;
375  const Dtk_string & GetPredefinedType() const;
378  Dtk_RGB GetColor() const;
381  const Dtk_transfo & GetInstanceTrf() const;
388  void SetPropertySet( Dtk_tab<Dtk_MetaDataPtr> inProperties, const Dtk_string & inSetName = "" );
392  void AddProperty( Dtk_MetaDataPtr inProperty, Dtk_string inSetName = "" );
395  void SetName( Dtk_string inName );
398  void SetTypeID( const Dtk_ID & inID );
401  void SetGUID( Dtk_string inGUID );
404  void SetLevel( Dtk_string inLevel );
407  void SetTag( Dtk_string inTag );
416  void SetPredefinedType( const Dtk_string & inType );
419  void SetColor( const Dtk_RGB & inColor );
422  void SetInstanceTrf( const Dtk_transfo & inTrf );
426  };
427 
435  DtkErrorStatus InitWrite(const Dtk_string& inOutputFile, const Dtk_string& inLogFile, const WriteOptions& inOptions, ProjectInformation* inProjectInfo = nullptr);
436 
437 
442 
448 
452 
458  Dtk_ErrorStatus WriteEntity(const Dtk_EntityPtr& inEntity, const Dtk_transfo & inMat = Dtk_transfo());
459 
465 
466 }// namespace Ifcw
467 
468 #endif
Ifcw::IfcType::GetPropertySet
const Dtk_tab< Dtk_MetaDataPtr > & GetPropertySet() const
Getter for type property set.
Ifcw::classification::IfcClassificationReference::SetLocation
void SetLocation(Dtk_string inLocation)
Setter for the reference location.
Ifcw::IfcType::SetPredefinedType
void SetPredefinedType(const Dtk_string &inType)
Setter for IfcType predefined type.
Ifcw::IfcType::GetName
const Dtk_string & GetName() const
Getter for type name.
Dtk_ID
uint32_t Dtk_ID
Definition: define.h:689
Dtk_transfo
This is the Transformation dedicated class.
Definition: dtk_transfo.hpp:19
Ifcw::IfcPlate
@ IfcPlate
Definition: IFCWriter.h:231
Ifcw::classification::IfcClassification::SetSource
void SetSource(Dtk_string inSource)
Setter for the classification source.
Ifcw::IfcElement::SetGUID
void SetGUID(Dtk_string inGUID)
Setter for IfcElement GUID.
Ifcw::ProjectInformation::buildingName
Dtk_string buildingName
Definition: IFCWriter.h:56
Ifcw::WriteEntity
Dtk_ErrorStatus WriteEntity(const Dtk_EntityPtr &inEntity, const Dtk_transfo &inMat=Dtk_transfo())
Write the entity provided in parameter. The entity corresponds to current object geometry (e....
Ifcw::IfcElement::SetPropertySet
void SetPropertySet(Dtk_tab< Dtk_MetaDataPtr > inProperties, const Dtk_string &inSetName="")
Setter for IfcElement propertySet.
Ifcw::IfcElement::SetLevel
void SetLevel(Dtk_string inLevel)
Setter for IfcElement level.
Ifcw::IfcType::SetBuildingElementType
void SetBuildingElementType(const Dtk_string &inType)
Setter for IfcType building element type.
Ifcw::classification::IfcClassification::GetName
const Dtk_string & GetName() const
Getter for the classification name.
Ifcw::IfcElement::GetGUID
const Dtk_string & GetGUID() const
Getter for IfcElement GUID.
Ifcw::classification::IfcClassification::GetEditionDate
const IfcCalendarDate & GetEditionDate() const
Getter for the classification edition date.
Ifcw::classification::IfcClassification::IfcClassification
IfcClassification(Dtk_string inSource, Dtk_string inEdition, Dtk_string inName="")
Constructor taking 3 parameters.
Ifcw::IfcRamp
@ IfcRamp
Definition: IFCWriter.h:233
Ifcw::IfcType::~IfcType
~IfcType()
Ifcw::IfcMember
@ IfcMember
Definition: IFCWriter.h:230
Ifcw::IfcElement::AddProperty
void AddProperty(Dtk_MetaDataPtr inProperty, Dtk_string inSetName="")
Adds a property to IfcElement current property set.
Ifcw::IfcType
A IfcType is used to define the common properties of a certain type or style of an entity that may be...
Definition: IFCWriter.h:249
Ifcw::IfcRoof
@ IfcRoof
Definition: IFCWriter.h:235
Ifcw::IfcType::SetBuildingElementType
void SetBuildingElementType(IfcBuildingElement inTypeEnum)
Setter for IfcElement building element subtype.
Ifcw::IfcType::GetTag
const Dtk_string & GetTag() const
Getter for type tag.
Ifcw::classification::IfcClassification::SetEditionDate
void SetEditionDate(int inDay, int inMonth, int inYear)
Setter for the classification edition date.
Ifcw::classification::IfcClassificationReference::operator==
friend bool operator==(IfcClassificationReference const &lhs, IfcClassificationReference const &rhs)
Definition: IFCWriter.h:186
Ifcw::ProjectInformation::buildingAddress
Dtk_string buildingAddress
Definition: IFCWriter.h:55
Ifcw::ProjectInformation::siteElevation
Dtk_Double64 siteElevation
Definition: IFCWriter.h:62
Ifcw::ProjectInformation::operator=
ProjectInformation & operator=(ProjectInformation &&p)
Ifcw::InitWrite
DtkErrorStatus InitWrite(const Dtk_string &inOutputFile, const Dtk_string &inLogFile, const WriteOptions &inOptions, ProjectInformation *inProjectInfo=nullptr)
Initialize the Ifc Writer and the IFC version you want to write.
Ifcw::IfcElement::SetColor
void SetColor(const Dtk_RGB &inColor)
Setter for IfcElement color.
Ifcw::WriteOptions::versionIndicator
int versionIndicator
Int representing IFC version to use : 0 ( default ) = IFC2x3; 1 = IFC4.
Definition: IFCWriter.h:28
DTK_TRUE
#define DTK_TRUE
Definition: define.h:727
Ifcw::ProjectInformation::projectPhase
Dtk_string projectPhase
Definition: IFCWriter.h:52
Ifcw::WriteOptions::buildingTypeRecognition
Dtk_bool buildingTypeRecognition
DTK_TRUE : enable building type recognition (deduces if an element is an IFCWALL, IFCWINDOW....
Definition: IFCWriter.h:30
Ifcw::IfcElement::GetBuildingElementType
const Dtk_string & GetBuildingElementType() const
Getter for IfcElement building element type.
Ifcw::IfcElement
This class provides several parameters for the next ifc entity to be written, as its custom property ...
Definition: IFCWriter.h:331
Ifcw::IfcElement::SetTag
void SetTag(Dtk_string inTag)
Setter for IfcElement tag.
Ifcw::classification::IfcClassificationReference::GetItemReference
const Dtk_string & GetItemReference() const
Getter for the reference item reference.
Ifcw::InitObject
DtkErrorStatus InitObject(IfcElement inParameters)
Initialize an ifcobject with various information.
Dtk_string
This is a high level string class.
Definition: dtk_string.hpp:58
Dtk_Size_t
size_t Dtk_Size_t
Definition: define.h:712
Ifcw::IfcFooting
@ IfcFooting
Definition: IFCWriter.h:229
Ifcw::classification::IfcClassificationReference::SetItemReference
void SetItemReference(Dtk_string inItemReference)
Setter for the reference item reference.
Ifcw::IfcStair
@ IfcStair
Definition: IFCWriter.h:237
Ifcw::IfcElement::GetPropertyAtPos
Dtk_MetaDataPtr GetPropertyAtPos(Dtk_Size_t pos) const
Getter for a single IfcElement property.
Ifcw::IfcElement::GetColor
Dtk_RGB GetColor() const
Getter for IfcElement color.
Ifcw::ProjectInformation::projectAuthor
Dtk_string projectAuthor
Definition: IFCWriter.h:57
Ifcw::IfcType::SetTag
void SetTag(const Dtk_string &inTag)
Setter for IfcType tag.
Dtk_bool
char Dtk_bool
Definition: define.h:725
Ifcw::IfcElement::GetTag
const Dtk_string & GetTag() const
Getter for IfcElement tag.
Ifcw::IfcBuildingElementProxy
@ IfcBuildingElementProxy
Definition: IFCWriter.h:224
Dtk_Double64
double Dtk_Double64
Definition: define.h:699
Ifcw::IfcSlab
@ IfcSlab
Definition: IFCWriter.h:236
Ifcw::IfcRailing
@ IfcRailing
Definition: IFCWriter.h:232
Ifcw::EndObject
DtkErrorStatus EndObject()
Ends the current object.
Ifcw::IfcCalendarDate::GetDay
int GetDay() const
Getter for the date day.
Ifcw::IfcType::AddShape
void AddShape(Dtk_EntityPtr inShape)
Adds an entity to IfcType shape representation (geometry)
Ifcw::classification::IfcClassificationReference::GetReferencedSource
const IfcClassification & GetReferencedSource() const
Getter for the classification the reference is linked to.
Ifcw::classification::IfcClassificationReference::GetLocation
const Dtk_string & GetLocation() const
Getter for the reference location.
Ifcw::IfcType::GetBuildingElementType
const Dtk_string & GetBuildingElementType() const
Getter for IfcType building element subtype.
Ifcw::IfcType::GetShapeRepresentation
const Dtk_tab< Dtk_EntityPtr > & GetShapeRepresentation() const
Getter for type shape representation.
Ifcw::IfcCalendarDate::operator==
friend bool operator==(IfcCalendarDate const &lhs, IfcCalendarDate const &rhs)
Definition: IFCWriter.h:94
Ifcw::IfcElement::SetPredefinedType
void SetPredefinedType(const Dtk_string &inType)
Setter for IfcElement predefined type.
Ifcw::IfcCovering
@ IfcCovering
Definition: IFCWriter.h:226
Ifcw::IfcElement::IfcElement
IfcElement()
Base constructor.
Ifcw::IfcCalendarDate::GetMonth
int GetMonth() const
Getter for the date month.
Ifcw::IfcCalendarDate
This class represents an IFC date. .
Definition: IFCWriter.h:85
Ifcw::IfcElement::SetBuildingElementType
void SetBuildingElementType(Dtk_string inType)
Setter for IfcElement building element type.
Ifcw::IfcCalendarDate::GetYear
int GetYear() const
Getter for the date year.
Ifcw::ProjectInformation::organizationName
Dtk_string organizationName
Definition: IFCWriter.h:58
Ifcw::classification::IfcClassificationReference::IfcClassificationReference
IfcClassificationReference(Dtk_string inLocation="", Dtk_string inItemReference="", Dtk_string inName="", IfcClassification inReferencedSource=IfcClassification())
Base constructor.
Ifcw::IfcCalendarDate::IfcCalendarDate
IfcCalendarDate()
Base constructor.
Ifcw::IfcElement::SetTypeID
void SetTypeID(const Dtk_ID &inID)
Setter for IfcElement IfcType ID.
Ifcw::IfcType::SetPropertySet
void SetPropertySet(Dtk_tab< Dtk_MetaDataPtr > inProperties, const Dtk_string &inSetName="")
Setter for IfcType propertySet.
Ifcw::ProjectInformation::siteLatitude
Dtk_Double64 siteLatitude
Definition: IFCWriter.h:60
Ifcw::IfcCalendarDate::IfcCalendarDate
IfcCalendarDate(const int &inDay, const int &inMonth, const int &iYear)
Ifcw::IfcElement::GetLevel
const Dtk_string & GetLevel() const
Getter for IfcElement level.
Ifcw::classification::IfcClassification::SetName
void SetName(Dtk_string inName)
Setter for the classification name.
Ifcw::IfcElement::GetInstanceTrf
const Dtk_transfo & GetInstanceTrf() const
Getter for IfcElement instance transformation matrice.
Ifcw::WriteOptions
This class provides several options to tune the IFC Writer. It must be provided to Ifcw::InitWrite me...
Definition: IFCWriter.h:18
Dtk_ErrorStatus
Dtk_ErrorStatus
Definition: error_dtk.hpp:6
Ifcw::IfcElement::SetClassificationReference
void SetClassificationReference(classification::IfcClassificationReference inClassificationRef)
Setter for IfcElement classification reference.
Ifcw::EndWrite
DtkErrorStatus EndWrite()
Creation of the output file and free the Ifc Writer
Dtk_SmartPtr
Definition: util_ptr_dtk.hpp:37
Ifcw::IfcType::SetID
void SetID(const Dtk_ID &inID)
Setter for IfcType ID.
Ifcw::ProjectInformation::siteLongitude
Dtk_Double64 siteLongitude
Definition: IFCWriter.h:61
Ifcw::ProjectInformation::~ProjectInformation
~ProjectInformation()
Definition: IFCWriter.h:76
Ifcw::classification::IfcClassification::SetEditionDate
void SetEditionDate(IfcCalendarDate inDate)
Setter for the classification edition date.
Ifcw::IfcWindow
@ IfcWindow
Definition: IFCWriter.h:240
Ifcw::WriteType
Dtk_ErrorStatus WriteType(const IfcType &inType)
Write the type provided in parameter. The type can exists by itself without having entities related t...
Ifcw::IfcType::AddProperty
void AddProperty(Dtk_MetaDataPtr inProperty, const Dtk_string &inSetName="")
Adds a property to IfcType current property set.
Ifcw::classification::IfcClassification::operator==
friend bool operator==(IfcClassification const &lhs, IfcClassification const &rhs)
Definition: IFCWriter.h:133
Ifcw::IfcType::SetShape
void SetShape(Dtk_tab< Dtk_EntityPtr > inShapes)
Setter for IfcType shapeRepresentation (geometry)
Ifcw::IfcType::GetPredefinedType
const Dtk_string & GetPredefinedType() const
Getter for IfcType predefined type.
Ifcw::IfcElement::SetName
void SetName(Dtk_string inName)
Setter for IfcElement name.
Ifcw::ProjectInformation::organizationDescription
Dtk_string organizationDescription
Definition: IFCWriter.h:59
Ifcw::IfcElement::GetName
const Dtk_string & GetName() const
Getter for IfcElement name.
Ifcw::WriteOptions::WriteOptions
WriteOptions()
Base constructor.
Definition: IFCWriter.h:23
Ifcw::IfcElement::GetTypeID
Dtk_ID GetTypeID() const
Getter for IfcType ID.
Dtk_tab
This is a high level array class.
Definition: util_stl_dtk.hpp:85
Ifcw::classification::IfcClassificationReference::SetName
void SetName(Dtk_string inName)
Setter for the reference name.
Ifcw::classification::IfcClassificationReference
This class represent a classification reference to be used for an ifc object, e.g....
Definition: IFCWriter.h:175
Ifcw::classification::IfcClassificationReference::GetName
const Dtk_string & GetName() const
Getter for the reference name.
Ifcw::IfcElement::GetPredefinedType
const Dtk_string & GetPredefinedType() const
Getter for IfcElement predefined type.
Ifcw::ProjectInformation
This struct enables the user to define global properties regarding the project, construction site and...
Definition: IFCWriter.h:51
Ifcw::IfcStairFlight
@ IfcStairFlight
Definition: IFCWriter.h:238
Ifcw::IfcElement::SetBuildingElementType
void SetBuildingElementType(IfcBuildingElement inTypeEnum)
Setter for IfcElement building element type.
Ifcw::IfcColumn
@ IfcColumn
Definition: IFCWriter.h:225
Ifcw::IfcType::GetID
Dtk_ID GetID() const
Getter for type ID.
Ifcw::IfcWall
@ IfcWall
Definition: IFCWriter.h:239
Ifcw::ProjectInformation::projectName
Dtk_string projectName
Definition: IFCWriter.h:53
Ifcw::IfcCurtainWall
@ IfcCurtainWall
Definition: IFCWriter.h:227
Ifcw::ProjectInformation::ProjectInformation
ProjectInformation()
Definition: IFCWriter.h:63
Ifcw
Exported APIs for Ifc (.ifc) Write Library.
Definition: IFCWriter.h:6
Ifcw::IfcRampFlight
@ IfcRampFlight
Definition: IFCWriter.h:234
Ifcw::IfcElement::SetInstanceTrf
void SetInstanceTrf(const Dtk_transfo &inTrf)
Setter for IfcElement instance transformation matrice.
Ifcw::classification::IfcClassification
A class that represents a classification system, like UniFormat, Omniclass, SfB...
Definition: IFCWriter.h:117
Dtk_RGB
Definition: dtk_rgb.hpp:7
Ifcw::IfcDoor
@ IfcDoor
Definition: IFCWriter.h:228
Ifcw::IfcElement::GetPropertySet
const Dtk_tab< Dtk_MetaDataPtr > & GetPropertySet() const
Getter for IfcElement propertySet.
Ifcw::ProjectInformation::projectDetailedName
Dtk_string projectDetailedName
Definition: IFCWriter.h:54
Ifcw::classification::IfcClassification::GetEdition
const Dtk_string & GetEdition() const
Getter for the classification edition.
Ifcw::IfcType::SetName
void SetName(const Dtk_string &inName)
Setter for IfcType name.
Ifcw::classification::IfcClassification::IfcClassification
IfcClassification()
Base constructor.
Ifcw::IfcElement::GetClassificationReference
const classification::IfcClassificationReference & GetClassificationReference() const
Getter for classification reference.
Ifcw::IfcBeam
@ IfcBeam
Definition: IFCWriter.h:223
Ifcw::classification::IfcClassification::SetEdition
void SetEdition(Dtk_string inEdition)
Setter for the classification edition.
Ifcw::IfcBuildingElement
IfcBuildingElement
This enum provides commonly used ifc building elements types, to define entities to be written....
Definition: IFCWriter.h:222
Ifcw::IfcType::IfcType
IfcType()
Ifcw::classification::IfcClassification::GetSource
const Dtk_string & GetSource() const
Getter for the classification source.