///////////////////////////////////////////////////////////////////////////////
// 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_REPRESENTATIONCONTEXT_H_
#define _IFC_REPRESENTATIONCONTEXT_H_
#include "IfcCommon.h"
#include "IfcBuildOptions.h"
#include "IfcCachedCompound.h"
#include "TD_PackPush.h"
/** \details
Contains declarations related to working with IFC file content.
*/
namespace OdIfc {
/** \details
A base class that implements storing and handling IfcRepresentationContext data.
*/
class IFCGEOM_EXPORT OdIfcRepresentationContext : public OdIfcCachedCompound
{
ODRX_DECLARE_MEMBERS(OdIfcRepresentationContext);
public:
/** \details
Composes the compound object into a specified model.
*/
void compose() override;
/** \details
Retrieves identifier string of the context.
\returns OdString which contains identifier of the context.
*/
OdString getContextIdentifier() const;
/** \details
Retrieves type of the context.
\returns OdString which contains type of the context.
*/
OdString getContextType() const;
};
/** \details
A data type that represents a smart pointer to an OdIfcRepresentationContext object.
*/
typedef OdSmartPtr OdIfcRepresentationContextPtr;
/** \details
A base class that implements storing and handling IfcGeometricRepresentationContext data.
*/
class IFCGEOM_EXPORT OdIfcGeometricRepresentationContext : public OdIfcRepresentationContext
{
ODRX_DECLARE_MEMBERS(OdIfcGeometricRepresentationContext);
protected:
OdGeVector3d m_direction;
OdGeMatrix3d m_WCS;
bool m_hasCoordinateOperation{ false };
OdGeMatrix3d m_mapConversionMatrix;
public:
/** \details
Composes the compound object for the geometric representation context and all of its sub contexts into a specified model.
*/
void compose() override;
/** \details
Retrieves a Coordinate Space Dimension value of the geometric representation context.
\returns Integer value that contains dimensionality of the context.
*/
int getCoordinateSpaceDimension() const;
/** \details
Retrieves a Precision attribute value of the context.
\returns Double value which contains precision for the context.
*/
double getPrecision();
/** \details
Retrieves if geometric representation context has coordinate operation assigned.
\returns true if context has coordinate operation assigned; otherwise returns false.
*/
virtual bool hasCoordinateOperation() const;
/** \details
Retrieves an object identifier of coordinate operation isntance associated with geometric representation context.
\returns Object identifier of associated coordinate operation isntance.
*/
OdDAIObjectId getCoordinateOperation() const;
/** \details
Retrieves map conversion transformation matrix for the geometric representation context.
\returns Reference to OdGeMatrix3d with map conversion transformation for the context.
*/
virtual const OdGeMatrix3d& getMapConversionMatrix() const;
/** \details
Retrieves Conversion Factor of MapUnit, if exists; otherwise returns 1.
\param idTargetCRS [in] An object identifier of TargetCRS instance.
\param conversionFactor [out] A variable in which conversion factor should be returned.
\returns True if conversion factor has been found.
*/
bool targetCRSConversionFactor(const OdDAIObjectId& idTargetCRS, double& conversionFactor);
//DOM-IGNORE-BEGIN
bool subWorldDraw(OdGiWorldDraw* pWd) const override;
//DOM-IGNORE-END
protected:
void composeSubContexts();
private:
void applyCRSUnits(const OdDAIObjectId& idTargetCRS, double &eastingsValue, double&northingsValue, double&orthogonalHeight);
void composeIfcMapConversion(OdIfcInstancePtr& ifcMapConversion);
void composeIfcRigidOperation(OdIfcInstancePtr& ifcRigidOperation);
};
/** \details
A data type that represents a smart pointer to an OdIfcGeometricRepresentationContext object.
*/
typedef OdSmartPtr OdIfcGeometricRepresentationContextPtr;
/** \details
A base class that implements storing and handling IfcGeometricRepresentationSubContext data.
*/
class IFCGEOM_EXPORT OdIfcGeometricRepresentationSubContext : public OdIfcGeometricRepresentationContext
{
ODRX_DECLARE_MEMBERS(OdIfcGeometricRepresentationSubContext);
OdDAIObjectId m_parentContext;
public:
/** \details
Composes the compound object into a specified model.
*/
void compose() override;
/** \details
Retrieves if geometric representation sub context has coordinate operation assigned.
\returns true if sub context has coordinate operation assigned; otherwise returns false.
*/
bool hasCoordinateOperation() const override;
/** \details
Retrieves an object identifier of parent geometric representation context for the sub context.
\returns OdDAIObjectId of parent representation context.
*/
const OdDAIObjectId& getParentContext() const;
/** \details
Retrieves map conversion transformation matrix for the sub context.
\returns Reference to OdGeMatrix3d with map conversion transformation for the sub context.
*/
const OdGeMatrix3d& getMapConversionMatrix() const override;
};
/** \details
A data type that represents a smart pointer to an OdIfcGeometricRepresentationSubContext object.
*/
typedef OdSmartPtr OdIfcGeometricRepresentationSubContextPtr;
} //namespace OdIfc
#include "TD_PackPop.h"
#endif // _IFC_REPRESENTATIONCONTEXT_H_