///////////////////////////////////////////////////////////////////////////////
// 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 _ODTV_SECTIONGEOMETRYOUTPUT_H_INCLUDED_
#define _ODTV_SECTIONGEOMETRYOUTPUT_H_INCLUDED_
#include "Tv.h"
#include "TvSectionGeometryTraits.h"
#include "TvGeometryTypifiedData.h"
#include "TvIObject.h"
#include "TvEntity.h"
#if defined _MSC_VER
#pragma warning(push)
#pragma warning(disable:4100) // unreferenced formal parameter
#endif
/** \details
This class provides an interface of a geometry collector callback for sections and cut geometry outputs.
\remarks
All points are in the Eye Coordinate System (ECS). Only the
and methods are used in both section and cut geometry outputs;
other class methods are used in the cut geometry output only.
*/
class ODTV_EXPORT OdTvGeometryOutputCollector
{
public:
/** \details
This method is called when entity being processed by clipping node.
\param entityId [in] Processing entity id.
\param threadId [in] Current thread id.
\remarks
In MT vectorization case the same collector may collect primitives from different objects at the same time. So, threadId parameter specifies current thread id
and other "out" methods (shellOut, polylineOut, etc) may use odGetCurrentThreadId() to retrive thread id and compare it with entity/subentity processing thread.
*/
virtual void entityOut( OdTvEntityId entityId, unsigned threadId ) {};
/** \details
This method is called when sub-entity being processed by clipping node.
\param subEntityId [in] Processing sub-entity id.
\param threadId [in] Current thread id.
\remarks
In MT vectorization case the same collector may collect primitives from different objects at the same time. So, threadId parameter specifies current thread id
and other "out" methods (shellOut, polylineOut, etc) may use odGetCurrentThreadId() to retrive thread id and compare it with entity/subentity processing thread.
*/
virtual void subEntityOut( OdTvGeometryDataId subEntityId, unsigned threadId ) {};
/** \details
This method is called for the shell geometry primitive.
\param nPoints [in] A number of vertices.
\param pPoints [in] A pointer to the vertex array in the ECS.
\param nFaceListSize [in] A size of the face list.
\param pFaceList [in] A pointer to the list of faces; each face is represented with N+1 numbers: [number of vertices N ][ vertex 0 index ]...[ vertex N-1 index ].
\param pFaceNormal [in] An optional pointer to the face normals, which can be NULL (by default).
*/
virtual void shellOut( OdUInt32 nPoints, const OdTvPoint* pPoints, OdUInt32 nFaceListSize, const OdInt32* pFaceList, const OdGeVector3d* pFaceNormal = nullptr ) = 0;
/** \details
This method is called for the polyline geometry primitive.
\param nPoints [in] A number of vertices.
\param pPoints [in] A pointer to the vertex array in the ECS.
\param pNormal [in] An optional pointer to the normal array, which can be NULL (by default).
\param pExtrusion [in] An optional pointer to the extrusion array, which can be NULL (by default).
*/
virtual void polylineOut( OdInt32 numPoints, const OdTvPoint* pPoints, const OdGeVector3d* pNormal = nullptr,
const OdGeVector3d* pExtrusion = nullptr ) = 0;
/** \details
This method is called for the polygon geometry primitive.
\param numPoints [in] A number of vertices.
\param pPoints [in] A pointer to the vertex array in the ECS.
\remarks
This method can be called for cut geometry output only.
*/
virtual void polygonOut( OdInt32 numPoints, const OdTvPoint* pPoints ) {}
/** \details
This method is called for the infinite line geometry primitive.
\param firstPoint [in] The first line point in the ECS.
\param secondPoint [in] The second line point in the ECS.
\param type [in] A type of the infinite line.
\remarks
This method can be called for cut geometry output only.
*/
virtual void infiniteLineOut( const OdTvPoint& firstPoint, const OdTvPoint& secondPoint, OdTvInfiniteLineData::Type type ) {}
/** \details
This method is called for the mesh geometry primitive.
\param nRows [in] A number of rows.
\param nColumns [in] A number of columns.
\param nVertices [in] A number of vertices.
\param vertices [in] A pointer to the vertex array in the ECS.
\remarks
This method can be called for cut geometry output only.
*/
virtual void meshOut( OdUInt32 nRows, OdUInt32 nColumns, OdUInt32 nVertices, const OdTvPoint* vertices ) {}
/** \details
This method is called for the circle geometry primitive.
\param center [in] The circle center in the ECS.
\param radius [in] The circle radius.
\param normal [in] The circle normal in the ECS.
\remarks
This method can be called for cut geometry output only.
*/
virtual void circleOut( const OdTvPoint& center, double radius, const OdTvVector& normal ) {}
/** \details
This method is called for the circle geometry primitive.
\param startPoint [in] The first circle point in the ECS.
\param middlePoint [in] The second circle point in the ECS.
\param endPoint [in] The third circle point in the ECS.
\remarks
This method can be called for cut geometry output only.
*/
virtual void circleOut( const OdTvPoint& startPoint, const OdTvPoint& middlePoint, const OdTvPoint& endPoint ) {}
/** \details
This method is called for the circular arc geometry primitive.
\param startPoint [in] The arc start point in the ECS.
\param middlePoint [in] The arc middle point in the ECS.
\param endPoint [in] The arc end point in the ECS.
\remarks
This method can be called for cut geometry output only.
*/
virtual void circularArcOut( const OdTvPoint& startPoint, const OdTvPoint& middlePoint, const OdTvPoint& endPoint ) {}
/** \details
This method is called for the elliptical arc geometry primitive.
\param centerPoint [in] A point that represents the ellipse center in the ECS.
\param majorPoint [in] A point that represents the ellipse major radius in the ECS.
\param minorPoint [in] A point that represents the ellipse minor radius in the ECS.
\param startAng [in] The start angle for the elliptical arc.
\param endAng [in] The end angle for the elliptical arc.
\remarks
This method can be called for cut geometry output only.
*/
virtual void ellipticArcOut( const OdTvPoint& centerPoint, const OdTvPoint& majorPoint, const OdTvPoint& minorPoint, double startAng, double endAng ) {}
/** \details
This method is called for the NURBS geometry primitive.
\param degree [in] A curve degree value.
\param controlPoints [in] An array of control points in the ECS.
\param weights [in] An array of weights.
\param knots [in] An array of knots.
\param start [in] A start value.
\param end [in] An end value.
\remarks
This method can be called for cut geometry output only.
*/
virtual void nurbsOut( unsigned int degree, unsigned int nControlPoints, const OdTvPoint* controlPoints, const double* weights, unsigned int nKnots, const double* knots, double start = 0., double end = 1. ) {}
/** \details
This method is called for the text geometry primitive.
\param refPoint [in] The reference point in the ECS.
\param message [in] The text message.
\remarks
This method can be called for cut geometry output only.
*/
virtual void textOut( const OdTvPoint& refPoint, const OdString& message ) {}
/** \details
This method is called for the point cloud geometry primitive.
\param numPoints [in] A number of points.
\param pPoint [in] A pointer to the points array in the ECS.
\remarks
This method can be called for cut geometry output only.
*/
virtual void pointCloudOut( OdInt32 numPoints, const OdTvPoint* pPoint ) {}
};
#if defined _MSC_VER
#pragma warning(pop)
#endif
class OdTvClippedGeometryOutput;
/** \details
A data type that represents a to an object.
*/
typedef OdTvSmartPtr OdTvClippedGeometryOutputPtr;
/** \details
This class is an implementation of the base class for the geometry output during 3D clipping.
*/
class ODTV_EXPORT OdTvClippedGeometryOutput : public OdTvIObject
{
protected:
/** \details
Enumerates flags that control the processing of the clipped geometry output.
*/
enum Flags
{
/** Enables processing of this geometry output.*/
kEnableProcessing = 1,
/** Enables clipping of non-sectionable geometry.*/
kAllowNonSectionableGeometryClip = 2,
/** Indicates the last flag. Used to start from in inheritors.*/
kLastFlag = kAllowNonSectionableGeometryClip
};
public:
/** \details
Checks whether processing of this geometry output is enabled.
\returns true if processing of this geometry output is enabled, false otherwise.
*/
bool isProcessingEnabled() const;
/** \details
Enables or disables processing of this geometry output.
\param bSet [in] New processing state for this geometry output.
*/
void setProcessingEnabled(bool bSet);
/** \details
Checks whether clipping of non-sectionable geometry is enabled.
\returns
true if clipping of non-sectionable geometry enabled, false otherwise.
*/
bool isNonSectionableGeometryClipping() const;
/** \details
Enables or disables clipping of non-sectionable geometry.
\param bSet [in] New state of non-sectionable geometry clipping.
*/
void setNonSectionableGeometryClipping(bool bSet);
/** \details
Retrieves trait override flags.
\returns
A set of trait override flags as an OdUInt32 value.
*/
OdUInt32 traitsOverrideFlags() const;
/** \details
Sets up trait overrides.
\param pData [in] Trait overrides.
*/
void setTraitsOverrides(const OdTvSectionGeometryTraitsPtr pData);
/** \details
Retrieves trait overrides (for changing).
\returns
subentity trait overrides as OdTvSectionGeometryTraits instance.
*/
OdTvSectionGeometryTraitsPtr traitsOverrides();
/** \details
Returns trait overrides.
\returns Pointer to the trait overrrides.
*/
const OdTvSectionGeometryTraitsPtr traitsOverrides() const;
/** \details
Retrieves the object.
\returns Pointer to the object.
*/
OdTvGeometryOutputCollector* geometryCollector();
/** \details
Specifies the object.
\param pCollector [in] A pointer to the object.
*/
void setGeometryCollector( OdTvGeometryOutputCollector* pCollector );
protected:
/** \details
Default constructor for the OdTvClippedGeometryOutput class.
sets kProcessingEnabled and kNonSectionableGeometryClip flags.
*/
OdTvClippedGeometryOutput();
protected:
OdUInt32 m_flags; // Generic flag storage.
OdTvSectionGeometryTraitsPtr m_pOverrides; // Trait override values.
OdTvGeometryOutputCollector* m_pCollector; // Geometry collector.
};
class OdTvSectionGeometryOutput;
/** \details
A data type that represents a to an object.
*/
typedef OdTvSmartPtr OdTvSectionGeometryOutputPtr;
/** \details
This template class is a specialization of the OdTvClippedGeometryOutput, which implements interface
and used for section geometry output.
*/
class ODTV_EXPORT OdTvSectionGeometryOutput : public OdTvClippedGeometryOutput
{
protected:
/** \details
Enumerates flags that control the processing of the section geometry output.
*/
enum Flags
{
/** Enables closed sections output. */
kEnableOutputClosedPrimitives = kLastFlag << 1,
/** Enables opened sections output. */
kEnableOutputOpenedPrimitives = kLastFlag << 2,
/** Enables output of closed sections as polyline primitives. */
kEnableClosedPrimitivesAsPolylines = kLastFlag << 3,
/** Enables overriding of the tolerance. */
kEnableToleranceOverride = kLastFlag << 4,
/** Enables output of closed sections as shell + polyline primitives. */
kEnableClosedPrimitivesAsShellPlusPolylines = kLastFlag << 5
};
public:
/** \details
Checks whether output of closed sections is enabled.
\returns true if output of closed sections is enabled, or false otherwise.
*/
bool isClosedSectionsOutputEnabled() const;
/** \details
Enables or disables output of closed sections.
\param bSet [in] New state of closed section output.
*/
void enableClosedSectionsOutput(bool bSet);
/** \details
Checks whether output of open sections is enabled.
\returns true if output of open sections is enabled, or false otherwise.
*/
bool isOpenedSectionsOutputEnabled() const;
/** \details
Enables or disables output of open sections.
\param bSet [in] New state of open section output.
*/
void enableOpenedSectionsOutput(bool bSet);
/** \details
Checks whether output of closed sections as polyline primitives is enabled.
\returns true if output of closed sections as polyline primitives is enabled, false otherwise.
*/
bool isOutputOfClosedSectionsAsPolylinesEnabled() const;
/** \details
Enables or disables output of closed sections as polyline primitives.
\param bSet [in] New state of closed sections output mode.
*/
void enableOutputOfClosedSectionsAsPolylines(bool bSet);
/** \details
Checks whether output of closed sections as shell + polyline primitives is enabled.
\returns true if output of closed sections as shell + polyline primitives is enabled, false otherwise.
*/
bool isOutputOfClosedSectionsAsShellWithPolylinesEnabled() const;
/** \details
Enables or disables output of closed sections as shell + polyline primitives.
\param bSet [in] New state of closed sections output mode.
*/
void enableOutputOfClosedSectionsAsShellWithPolylines(bool bSet);
/** \details
Checks whether tolerance overrides for section generation is enabled.
\returns true if tolerance overrides for section generation is enabled, or false otherwise.
*/
bool isSectionToleranceOverrideEnabled() const;
/** \details
Returns the tolerance override value for section generation.
\returns A double value for the tolerance override used when generating sections.
*/
double sectionToleranceOverride() const;
/** \details
Enables tolerance overrides for section generation and sets the tolerance override value.
\param tolOverride [in] Tolerance override for geometric operations.
*/
void setSectionToleranceOverride(double tolOverride);
/** \details
Disables tolerance overrides for section generation.
*/
void resetSectionToleranceOverride();
/** \details
Creates a new section geometry output object.
\returns A smart pointer to the created section geometry output object.
*/
static OdTvSectionGeometryOutputPtr createObject();
protected:
/** \details
Default constructor for the OdTvSectionGeometryOutput class.
Sets the tolerance for geometric operations to 1^-10 and sets the kOutputClosedPrimitives flag.
*/
OdTvSectionGeometryOutput();
protected:
double m_tolOverride; // Section tolerance override.
};
class OdTvCuttedGeometryOutput;
/** \details
A data type that represents a to an object.
*/
typedef OdTvSmartPtr OdTvCuttedGeometryOutputPtr;
/** \details
This class is an implementation of the cut geometry output for 3D clipping.
*/
class ODTV_EXPORT OdTvCuttedGeometryOutput : public OdTvClippedGeometryOutput
{
public:
/** \details
Creates a new cut geometry output object.
\returns A smart pointer to the created clipped geometry output object.
*/
static OdTvCuttedGeometryOutputPtr createObject();
protected:
/** \details
Default constructor for the OdTvCuttedGeometryOutput class.
*/
OdTvCuttedGeometryOutput();
};
#endif // _ODTV_SECTIONGEOMETRYOUTPUT_H_INCLUDED_