DATAKIT API  V2025.1
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  }
28  {
31  return *this;
32  }
33 
38  };
39 
58  {
71  projectPhase("Project Phase"),
72  projectName("Project Name"),
73  projectDetailedName("Project Detailed Name"),
74  buildingAddress("Building Address"),
75  buildingName("Building Name"),
76  projectAuthor("Author"),
77  organizationName("Organization name"),
78  organizationDescription("Organization description"),
79  siteLatitude(0.),
80  siteLongitude(0.),
81  siteElevation(0.)
82  { };
85  };
86 
87 
92  {
93  private:
94  int day;
95  int month;
96  int year;
97  public:
100  IfcCalendarDate( const int& inDay, const int& inMonth, const int& iYear );
106  {
107  return day == d.day && month == d.month && year == d.year;
108  };
111  int GetDay() const;
114  int GetMonth() const;
117  int GetYear() const;
118  };
119 
120  namespace classification
121  {
128  {
129  private:
130  IfcCalendarDate editionDate;
131  Dtk_string source;
132  Dtk_string edition;
133  Dtk_string name;
134  public:
143  IfcClassification( const Dtk_string& inSource, const Dtk_string& inEdition, const Dtk_string& inName = "" );
145  IfcClassification( const IfcClassification& inClassification );
146  IfcClassification( IfcClassification&& inClassification );
150  {
151  return editionDate == c.editionDate && source == c.source && edition == c.edition && name == c.name;
152  };
154  {
155  editionDate = c.editionDate;
156  source = std::move( c.source );
157  edition = std::move( c.edition );
158  name = std::move( c.name );
159  }
165  const Dtk_string & GetSource() const;
168  const Dtk_string & GetEdition() const;
171  const Dtk_string & GetName() const;
174  void SetName( const Dtk_string& inName );
177  void SetSource( const Dtk_string& inSource );
180  void SetEdition( const Dtk_string& inEdition );
188  void SetEditionDate( int inDay, int inMonth, int inYear );
189  };
190 
198  {
199  private:
200  IfcClassification referencedSource;
201  Dtk_string location;
202  Dtk_string itemReference;
203  Dtk_string name;
204 
205  public:
208  IfcClassificationReference( const Dtk_string& inLocation = "", const Dtk_string& inItemReference = "", const Dtk_string& inName = "", IfcClassification inReferencedSource = IfcClassification() );
214  {
215  return referencedSource == cr.referencedSource && location == cr.location && itemReference == cr.itemReference && name == cr.name;
216  };
222  const Dtk_string & GetLocation() const;
225  const Dtk_string & GetItemReference() const;
228  const Dtk_string & GetName() const;
231  void SetLocation( const Dtk_string& inLocation );
234  void SetItemReference( const Dtk_string& inItemReference );
237  void SetName( const Dtk_string& inName );
238  };
239 
240  }
241 
247  {
265  IfcWindow
266  };
267 
273  class IfcType
274  {
275  private :
276  Dtk_tab<Dtk_MetaDataPtr> propertySet;
277  Dtk_tab <Dtk_EntityPtr> shapeReprensentation;
278  Dtk_string buildingElement;
279  Dtk_string predefinedType;
280  Dtk_string tag;
281  Dtk_string name;
282  Dtk_ID ID;
283 
284  public:
295  const Dtk_string & GetTag() const;
298  const Dtk_string & GetName() const;
301  Dtk_ID GetID() const;
307  const Dtk_string & GetPredefinedType() const;
310  void SetBuildingElementType( const Dtk_string & inType );
317  void SetPropertySet( Dtk_tab<Dtk_MetaDataPtr> inProperties, const Dtk_string & inSetName = "" );
321  void AddProperty( Dtk_MetaDataPtr inProperty, const Dtk_string & inSetName = "" );
327  void AddShape( Dtk_EntityPtr inShape );
330  void SetTag( const Dtk_string & inTag );
333  void SetName( const Dtk_string & inName );
336  void SetID( const Dtk_ID & inID );
339  void SetPredefinedType( const Dtk_string & inType );
340  };
341 
356  {
357  private:
358  classification::IfcClassificationReference classificationReference;
359  Dtk_tab<Dtk_MetaDataPtr> propertySet;
360  Dtk_string name;
361  Dtk_string buildingElementType;
362  Dtk_string predefinedType;
363  Dtk_string GUID;
364  Dtk_string level;
365  Dtk_string tag;
366  Dtk_RGB color;
367  Dtk_transfo instanceTrf;
368  Dtk_ID typeID;
369 
370  public:
384  Dtk_ID GetTypeID() const;
387  const Dtk_string & GetName() const;
390  const Dtk_string & GetGUID() const;
393  const Dtk_string & GetLevel() const;
396  const Dtk_string & GetTag() const;
402  const Dtk_string & GetPredefinedType() const;
405  Dtk_RGB GetColor() const;
408  const Dtk_transfo & GetInstanceTrf() const;
415  void SetPropertySet( Dtk_tab<Dtk_MetaDataPtr> inProperties, const Dtk_string & inSetName = "" );
419  void AddProperty( Dtk_MetaDataPtr inProperty, const Dtk_string & inSetName = "" );
422  void SetName( const Dtk_string & inName );
425  void SetTypeID( const Dtk_ID & inID );
428  void SetGUID( const Dtk_string & inGUID );
431  void SetLevel( const Dtk_string & inLevel );
434  void SetTag( const Dtk_string & inTag );
437  void SetBuildingElementType( const Dtk_string & inType );
443  void SetPredefinedType( const Dtk_string & inType );
446  void SetColor( const Dtk_RGB & inColor );
449  void SetInstanceTrf( const Dtk_transfo & inTrf );
453  };
454 
462  DtkErrorStatus InitWrite(const Dtk_string& inOutputFile, const Dtk_string& inLogFile, const WriteOptions& inOptions, ProjectInformation* inProjectInfo = nullptr);
463 
464 
469 
474  DtkErrorStatus InitObject( const IfcElement& inParameters );
475 
479 
485  Dtk_ErrorStatus WriteEntity(const Dtk_EntityPtr& inEntity, const Dtk_transfo & inMat = Dtk_transfo());
486 
492 
493 }// namespace Ifcw
494 
495 #endif
Ifcw::IfcType::GetPropertySet
const Dtk_tab< Dtk_MetaDataPtr > & GetPropertySet() const
Getter for type property set.
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.
Ifcw::IfcElement::SetBuildingElementType
void SetBuildingElementType(const Dtk_string &inType)
Setter for IfcElement building element type.
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:256
Ifcw::IfcElement::SetTag
void SetTag(const Dtk_string &inTag)
Setter for IfcElement tag.
Ifcw::ProjectInformation::buildingName
Dtk_string buildingName
Definition: IFCWriter.h:63
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::classification::IfcClassificationReference::SetName
void SetName(const Dtk_string &inName)
Setter for the reference name.
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::IfcRamp
@ IfcRamp
Definition: IFCWriter.h:258
Ifcw::IfcType::~IfcType
~IfcType()
Ifcw::IfcMember
@ IfcMember
Definition: IFCWriter.h:255
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:274
Ifcw::IfcRoof
@ IfcRoof
Definition: IFCWriter.h:260
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::IfcElement::SetGUID
void SetGUID(const Dtk_string &inGUID)
Setter for IfcElement GUID.
Ifcw::classification::IfcClassification::SetEditionDate
void SetEditionDate(int inDay, int inMonth, int inYear)
Setter for the classification edition date.
Ifcw::ProjectInformation::buildingAddress
Dtk_string buildingAddress
Definition: IFCWriter.h:62
Ifcw::ProjectInformation::siteElevation
Dtk_Double64 siteElevation
Definition: IFCWriter.h:69
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:35
Ifcw::classification::IfcClassification::operator=
void operator=(IfcClassification c)
Definition: IFCWriter.h:153
DTK_TRUE
#define DTK_TRUE
Definition: define.h:727
Ifcw::ProjectInformation::projectPhase
Dtk_string projectPhase
Definition: IFCWriter.h:59
Ifcw::WriteOptions::buildingTypeRecognition
Dtk_bool buildingTypeRecognition
DTK_TRUE : enable building type recognition (deduces if an element is an IFCWALL, IFCWINDOW....
Definition: IFCWriter.h:37
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:356
Ifcw::classification::IfcClassificationReference::SetItemReference
void SetItemReference(const Dtk_string &inItemReference)
Setter for the reference item reference.
Ifcw::classification::IfcClassificationReference::GetItemReference
const Dtk_string & GetItemReference() const
Getter for the reference item reference.
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:254
Ifcw::IfcStair
@ IfcStair
Definition: IFCWriter.h:262
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:64
Ifcw::IfcElement::SetLevel
void SetLevel(const Dtk_string &inLevel)
Setter for IfcElement level.
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::IfcElement::~IfcElement
~IfcElement()
Destructor.
Ifcw::IfcBuildingElementProxy
@ IfcBuildingElementProxy
Definition: IFCWriter.h:249
Dtk_Double64
double Dtk_Double64
Definition: define.h:699
Ifcw::IfcSlab
@ IfcSlab
Definition: IFCWriter.h:261
Ifcw::IfcRailing
@ IfcRailing
Definition: IFCWriter.h:257
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::classification::IfcClassification::IfcClassification
IfcClassification(const IfcClassification &inClassification)
Copy constructor.
Ifcw::IfcElement::SetPredefinedType
void SetPredefinedType(const Dtk_string &inType)
Setter for IfcElement predefined type.
Ifcw::IfcCalendarDate::~IfcCalendarDate
~IfcCalendarDate()
Destructor.
Ifcw::IfcCovering
@ IfcCovering
Definition: IFCWriter.h:251
Ifcw::IfcElement::IfcElement
IfcElement()
Base constructor.
Ifcw::classification::IfcClassificationReference::operator==
Dtk_bool operator==(IfcClassificationReference cr)
Definition: IFCWriter.h:213
Ifcw::IfcCalendarDate::GetMonth
int GetMonth() const
Getter for the date month.
Ifcw::IfcCalendarDate
This class represents an IFC date. .
Definition: IFCWriter.h:92
Ifcw::IfcCalendarDate::GetYear
int GetYear() const
Getter for the date year.
Ifcw::ProjectInformation::organizationName
Dtk_string organizationName
Definition: IFCWriter.h:65
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:67
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::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
Ifcw::InitObject
DtkErrorStatus InitObject(const IfcElement &inParameters)
Initialize an ifcobject with various information.
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:68
Ifcw::ProjectInformation::~ProjectInformation
~ProjectInformation()
Definition: IFCWriter.h:83
Ifcw::classification::IfcClassification::SetEditionDate
void SetEditionDate(IfcCalendarDate inDate)
Setter for the classification edition date.
Ifcw::classification::IfcClassificationReference::IfcClassificationReference
IfcClassificationReference(const Dtk_string &inLocation="", const Dtk_string &inItemReference="", const Dtk_string &inName="", IfcClassification inReferencedSource=IfcClassification())
Base constructor.
Ifcw::IfcWindow
@ IfcWindow
Definition: IFCWriter.h:265
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::SetSource
void SetSource(const Dtk_string &inSource)
Setter for the classification source.
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::ProjectInformation::organizationDescription
Dtk_string organizationDescription
Definition: IFCWriter.h:66
Ifcw::IfcElement::GetName
const Dtk_string & GetName() const
Getter for IfcElement name.
Ifcw::WriteOptions::WriteOptions
WriteOptions()
Base constructor.
Definition: IFCWriter.h:23
Ifcw::classification::IfcClassification::IfcClassification
IfcClassification(IfcClassification &&inClassification)
Ifcw::IfcElement::GetTypeID
Dtk_ID GetTypeID() const
Getter for IfcType ID.
Ifcw::classification::IfcClassification::SetName
void SetName(const Dtk_string &inName)
Setter for the classification name.
Ifcw::classification::IfcClassification::IfcClassification
IfcClassification(const Dtk_string &inSource, const Dtk_string &inEdition, const Dtk_string &inName="")
Constructor taking 3 parameters.
Dtk_tab
This is a high level array class.
Definition: util_stl_dtk.hpp:85
Ifcw::classification::IfcClassificationReference
This class represent a classification reference to be used for an ifc object, e.g....
Definition: IFCWriter.h:198
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:58
Ifcw::classification::IfcClassification::SetEdition
void SetEdition(const Dtk_string &inEdition)
Setter for the classification edition.
Ifcw::IfcStairFlight
@ IfcStairFlight
Definition: IFCWriter.h:263
Ifcw::classification::IfcClassificationReference::~IfcClassificationReference
~IfcClassificationReference()
Destructor.
Ifcw::IfcElement::SetBuildingElementType
void SetBuildingElementType(IfcBuildingElement inTypeEnum)
Setter for IfcElement building element type.
Ifcw::IfcCalendarDate::IfcCalendarDate
IfcCalendarDate(const IfcCalendarDate &inDate)
Copy constructor.
Ifcw::IfcColumn
@ IfcColumn
Definition: IFCWriter.h:250
Ifcw::IfcType::GetID
Dtk_ID GetID() const
Getter for type ID.
Ifcw::IfcWall
@ IfcWall
Definition: IFCWriter.h:264
Ifcw::ProjectInformation::projectName
Dtk_string projectName
Definition: IFCWriter.h:60
Ifcw::IfcCurtainWall
@ IfcCurtainWall
Definition: IFCWriter.h:252
Ifcw::ProjectInformation::ProjectInformation
ProjectInformation()
Definition: IFCWriter.h:70
Ifcw
Exported APIs for Ifc (.ifc) Write Library.
Definition: IFCWriter.h:6
Ifcw::classification::IfcClassification::operator==
Dtk_bool operator==(IfcClassification c)
Definition: IFCWriter.h:149
Ifcw::IfcRampFlight
@ IfcRampFlight
Definition: IFCWriter.h:259
Ifcw::IfcElement::SetInstanceTrf
void SetInstanceTrf(const Dtk_transfo &inTrf)
Setter for IfcElement instance transformation matrice.
Ifcw::IfcElement::AddProperty
void AddProperty(Dtk_MetaDataPtr inProperty, const Dtk_string &inSetName="")
Adds a property to IfcElement current property set.
Ifcw::classification::IfcClassification
A class that represents a classification system, like UniFormat, Omniclass, SfB...
Definition: IFCWriter.h:128
Ifcw::classification::IfcClassification::~IfcClassification
~IfcClassification()
Destructor.
Ifcw::classification::IfcClassificationReference::SetLocation
void SetLocation(const Dtk_string &inLocation)
Setter for the reference location.
Ifcw::IfcElement::SetName
void SetName(const Dtk_string &inName)
Setter for IfcElement name.
Dtk_RGB
Definition: dtk_rgb.hpp:7
Ifcw::IfcCalendarDate::operator==
Dtk_bool operator==(IfcCalendarDate d)
Definition: IFCWriter.h:105
Ifcw::IfcDoor
@ IfcDoor
Definition: IFCWriter.h:253
Ifcw::IfcElement::GetPropertySet
const Dtk_tab< Dtk_MetaDataPtr > & GetPropertySet() const
Getter for IfcElement propertySet.
Ifcw::ProjectInformation::projectDetailedName
Dtk_string projectDetailedName
Definition: IFCWriter.h:61
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:248
Ifcw::IfcBuildingElement
IfcBuildingElement
This enum provides commonly used ifc building elements types, to define entities to be written....
Definition: IFCWriter.h:247
Ifcw::IfcType::IfcType
IfcType()
Ifcw::classification::IfcClassificationReference::IfcClassificationReference
IfcClassificationReference(const IfcClassificationReference &inRef)
Copy constructor.
Ifcw::classification::IfcClassification::GetSource
const Dtk_string & GetSource() const
Getter for the classification source.
Ifcw::WriteOptions::operator=
WriteOptions & operator=(const WriteOptions &s)
\Operator =
Definition: IFCWriter.h:27