/////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance"). // All rights reserved. // // This software and its documentation and related materials are owned by // the Alliance. The software may only be incorporated into application // programs owned by members of the Alliance, subject to a signed // Membership Agreement and Supplemental Software License Agreement with the // Alliance. The structure and organization of this software are the valuable // trade secrets of the Alliance and its suppliers. The software is also // protected by copyright law and international treaty provisions. Application // programs incorporating this software must include the following statement // with their copyright notices: // // This application incorporates Open Design Alliance software pursuant to a license // agreement with Open Design Alliance. // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance. // All rights reserved. // // By use of this software, its documentation or related materials, you // acknowledge and accept the above terms. /////////////////////////////////////////////////////////////////////////////// #ifndef _IFC_MODEL_PROCESSOR_H #define _IFC_MODEL_PROCESSOR_H #include "IfcBuildOptions.h" #include "IfcModel.h" #include "IfcEntity.h" #include "IfcModelOps.h" #include "daiObjectId.h" #include "daiObjectSDAI.h" #include "daiUtils/daiModelProcessor.h" #include "TD_PackPush.h" namespace OdIfc { /** \details Contains declarations to provide high-level operations with IFC model content. */ namespace ModelOps { /** \details Class that provides modification operations within model content. */ class IFCCORE_EXPORT IfcModelProcessor { public: /** \details Default constructor for the IfcModelProcessor class. */ IfcModelProcessor(); /** \details Model based constructor for the IfcModelProcessor class. \param targetModel [in] Pointer to the model that is target for processable entities (if target one isn't the same as source). */ IfcModelProcessor(const OdDAI::ModelPtr targetModel); /** \details Sets new placement of entity/entities in the model, if needed. \param targetPoint [in] OdGePoint3d of new location in WCS. */ void setTargetLocation(OdGePoint3d targetPoint); /** \details Sets new offset of entity/entities in the model, if needed. \param targetOffset [in] OdGePoint3d that represents offset values per axis. */ void setTargetOffset(OdGePoint3d targetOffset); void setRotationRefDirection(const OdGeVector3d& refDirVector); void setRotationAxis(const OdGeVector3d& axisVector); /** \details Clones IFC entity of IfcProduct subtype and its nested content to the target model (general case). \param sourceProduct [in] Object id of the entity (its step id stored in OdDbHandle). \param targetProduct [in] Object id of the target entity (taken from source model anyway) \returns Object id of the cloned entity or OdDAIObjectId::kNullHandle otherwise. */ OdDAIObjectId ifcCloneTo(const OdDAIObjectId& sourceProduct, const OdDAIObjectId& targetProduct); /** \details Clones IFC entity of IfcSpatialStructureElement type that belongs to IfcRelAggregates and its nested content to the model. \param sourceProduct [in] Object id of the entity (its step id stored in OdDbHandle). \param targetProduct [in] Object id of the target entity (taken from source model anyway) \returns Object id of the cloned entity or OdDAIObjectId::kNullHandle otherwise */ OdDAIObjectId cloneContainedInRelAggregate(const OdDAIObjectId& sourceProduct, const OdDAIObjectId& targetProduct); /** \details Clones IFC entity of IfcBuildingElement type that belongs to IfcRelContainedInSpatialStructure and its nested content to the model. \param sourceProduct [in] Object id of the entity (its step id stored in OdDbHandle). \param targetProduct [in] Object id of the target entity (taken from source model anyway) \returns Object id of the cloned entity or OdDAIObjectId::kNullHandle otherwise */ OdDAIObjectId cloneContainedInSpatialStructure(const OdDAIObjectId& sourceProduct, const OdDAIObjectId& targetProduct); /** \details Clones an IFC entity of IfcProfuct subtype without nested content (any decompose relationship) to the model. \param sourceProduct [in] An object identifier of the entity (the STEP ID is stored in the OdDbHandle). \param targetProduct [in] Object id of the target entity (taken from source model anyway). \returns The object identifier of the cloned entity or the kNullHandle value otherwise. */ OdDAIObjectId cloneProductShallow(const OdDAIObjectId& sourceProduct, const OdDAIObjectId& targetProduct); /** \details Returns location of IfcProduct entity absolute placement. \param instance [in] OdDAI::ApplicationInstancePtr to the entity which location should be extracted. \returns Object id of the instance or OdDAIObjectId::kNullHandle otherwise */ OdDAIObjectId getAbsolutePlacement(const OdDAI::ApplicationInstancePtr instance); /** \details Merges content from IFC sourceModel to the target model, that is specified in ctor, with the specified merge level. \param sourceModel [in] OdDAI::ModelPtr pointer to model which entities are extracted). \param level [in] Target merging level for entities \returns Object id of the specified merge level target model entity or OdDAIObjectId::kNullHandle otherwise. */ OdDAIObjectId ifcCombineWith(const OdDAI::ModelPtr sourceModel, OdIfc::ModelOps::MergeLevel level); private: void processLocation(OdDAI::ModelOps::DaiStrategy & cloneStrategy, const OdDAIObjectId & clonedProductId); bool needMapConversionFix(const OdDAIObjectId& sourceEntity); OdDAIObjectId getCoordinateOperation(const OdDAIObjectId& sourceEntity) const; OdGeMatrix3d getIfcMapConversion(OdIfcInstancePtr& ifcMapConversion); OdDAIObjectId getMappingEntity(const OdDAIObjectId& entityId); OdDAI::ModelPtr m_sourceModel; OdDAI::ModelPtr m_targetModel; OdDAI::ModelOps::ModelCtxPtr m_context; OdGeMatrix3d m_targetConversionMatrix; OdGeMatrix3d m_sourceConversionMatrix; OdGeVector3d m_translationVector; OdGeVector3d m_rotationVector; }; } } #include "TD_PackPop.h" #endif // _IFC_MODEL_PROCESSOR_H