///////////////////////////////////////////////////////////////////////////////
// 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_EXPORT_H_INCLUDED_
#define _ODTV_EXPORT_H_INCLUDED_
#include "RxModule.h"
#include "SharedPtr.h"
#include "TD_PackPush.h"
#include "Tv.h"
#include "TvGsView.h"
#include "TvGsDevice.h"
#include "MemoryStream.h"
#include "OdPlatformStreamer.h"
#include "RxVariantValue.h"
#define OdTvDWGAllowEmptyViewsInPEUserData L"Visualize2Dwg - ODA - AllowEmptyViewsInPE"
/** \details
This class implements the base Visualize SDK export parameters.
*/
class ODTV_EXPORT OdTvBaseExportParams
{
public:
/** \details
Creates a new set of export parameters with default values.
*/
OdTvBaseExportParams() : m_strFilePath(OdString::kEmpty), m_pStreamBuf(NULL) {};
/** \details
Destroys the set of export parameters.
*/
virtual ~OdTvBaseExportParams() {}
/** \details
Sets a new file path for the export output.
\param filePath [in] A string that contains the output file path.
*/
void setFilePath(const OdString& filePath) { m_strFilePath = filePath; }
/** \details
Sets a new data stream buffer for the export operation.
\param pBuffer [in] A pointer to an OdStreamBuf object that represents a new data stream buffer.
*/
void setStreamBuffer(OdStreamBuf* pBuffer) { m_pStreamBuf = pBuffer; }
/** \details
Retrieves the file path for export output.
\returns The output file full path.
*/
OdString getFilePath() const { return m_strFilePath; }
/** \details
Retrieves current data stream buffer that is used for export operations.
\returns A smart pointer to an OdStreamBuf object that is used for import operations.
*/
OdStreamBufPtr getStreamBuffer() const { return m_pStreamBuf; }
//DOM-IGNORE-BEGIN
protected:
// common properties
OdString m_strFilePath; // File path for export with right extension
OdStreamBuf* m_pStreamBuf; // Stream buffer for export.
//DOM-IGNORE-END
};
/** \details
This class implements the Visualize SDK parameters for exporting to VSF format.
*/
class ODTV_EXPORT OdTvVsfExportParams : public OdTvBaseExportParams
{
public:
/** \details
Creates a new set of VSF export parameters with default values.
*/
OdTvVsfExportParams() : m_vCompression(0), m_nCompression(0) {}
/** \details
Sets the new value of the vertices compression option.
\param vCompression [in] A new value of the vertices compression.
*/
void setVerticesCompression(OdUInt8 vCompression)
{
m_vCompression = vCompression;
}
/** \details
Retrieves the current value of the vertices compression option.
\return The method returns value of vertices compression.
*/
OdUInt8 getVerticesCompression() const
{
return m_vCompression;
}
/** \details
Sets the new value of the normals compression option.
\param nCompression [in] A new value of the normals compression.
*/
void setNormalsCompression(OdUInt8 nCompression)
{
m_nCompression = nCompression;
}
/** \details
Retrieves the current value of the normals compression option.
\return The method returns enum value of normals compression.
*/
OdUInt8 getNormalsCompression() const
{
return m_nCompression;
}
//DOM-IGNORE-BEGIN
protected:
OdUInt8 m_vCompression;
OdUInt8 m_nCompression;
//DOM-IGNORE-END
};
/** \details
This class implements the Visualize SDK parameters for exporting to PDF (2D or 3D) format.
\sa
*/
class ODTV_EXPORT OdTvPdfExportParams : public OdTvBaseExportParams
{
public:
/** \details
Devices for the bitmap generation
*/
enum Device
{
kOpenGL = 0, // OpenGL ES2 device.
kOpenGLES2 = 1, // OpenGL device.
kBitmap = 2 // Bitmap device.
};
/** \details
Templates for publish to PDF
*/
enum PublishTemplate
{
kDefault = 0, // Default template
kOpenIfcViewer = 1, // Customized template designed for using in OpenIFCViewer
kOpenStepViewer = 2 // Customized template designed for using in OpenSTEPViewer
};
/** \details
Contains declarations of the PDF export options.
*/
enum Options
{
kEmbeddedTTF = 1 << 0, // Enable the embedding of the True Type font program into a PDF file. The whole True Type font file will be embedded (which may cause a huge .pdf size).
kEmbeddedTTFOptimized = 1 << 1, // Enable the embedding of the True Type font program into a PDF file. The True Type font will be reduced by removing unused parts (making a smaller .pdf file size but limiting editing functionality).
kTTFAsGeometry = 1 << 2, // Enable True Type font text to geometry conversion.
kSHXAsGeometry = 1 << 3, // Enable SHX font text to geometry conversion.
kTextSearchable = 1 << 4, // Make text searchable.
kSimpleGeomOptimization = 1 << 5, // Enable simple geometry optimization (separated segments to one polyline, Bezier curve control points).
kHiddenLineRemovalAlg = 1 << 6, // Determines whether software uses vector hidden-line removal for corresponding viewports.
kExportHyperlinks = 1 << 7, // Enable the export of hyperlinks.
kLinearizePDF = 1 << 8, // Create linearized .pdf file.
kIgnoreVisibleVpBorders = 1 << 9, // Sets the extents calculation mode value.
kTransparentShadedVpBg = 1 << 10, // Sets a new value for the shaded view transparency option.
kFlateCompression = 1 << 11, // Enable compression of internal PDF streams.
kASCIIHexEncoding = 1 << 12, // Enable ASCIIHex encoding of internal PDF streams.
kUseTransparency = 1 << 13, // Use transparencies during export.
kDefaultFlags = kTTFAsGeometry | kSHXAsGeometry | kFlateCompression
};
/** \details
Override for the align center state at the PDF page
Will have influence if zoom extents is switched off and if data was imported
from DWG with storing the plot settings data
*/
enum AlignCenter
{
kOff = 0, // Disabled
kOn = 1, // Enabled
kInherited = 2 // Get from dwg layout data (stored as user data after import from DWG). If layout data doesn't exists, "align center" will be disabled.
};
/** \details
Creates a new set of PDF export parameters with default values.
*/
OdTvPdfExportParams() : m_bIs3DPdf(false)
, m_backgroundColor(ODRGB(255, 255, 255)), m_bZoomToExtents(true), m_deviceForBitmap(kOpenGLES2), m_publishTemplate(kDefault), m_iFlags(kDefaultFlags), m_alignCenter(kOff) { }
/** \details
Destroys the set of PDF export parameters.
*/
virtual ~OdTvPdfExportParams() {}
/** \details
Sets the new value of the 3D PDF export flag. The 3D flag value determines whether 3D PDF export should be performed.
\param bIs3DPdf [in] A new value of the 3D PDF export flag.
*/
void set3DPdf(bool bIs3DPdf)
{
m_bIs3DPdf = bIs3DPdf;
}
/** \details
Retrieves the current value of the 3D PDF export flag.
\return The method returns true if the drawing should be exported to the 3D PDF format, otherwise returns false.
*/
bool is3DPdf() const
{
return m_bIs3DPdf;
}
/** \details
Sets the new value of background color.
\param backgroundColor [in] Background color value.
*/
void setBackgroundColor(ODCOLORREF backgroundColor)
{
m_backgroundColor = backgroundColor;
}
/** \details
Retrieves the current value of background color.
\return Background color value as ODCOLORREF.
*/
ODCOLORREF getBackgroundColor() const
{
return m_backgroundColor;
}
/** \details
Sets devices to export.
\param devices [in] Array of strings that contains names of devices to export.
*/
void setDevices(OdStringArray devices)
{
m_devices = devices;
}
/** \details
Retrieves reference to array of devices for export.
\returns Array of strings that contains names of devices to export.
*/
OdStringArray& getDevices()
{
return m_devices;
}
/** \details
Retrieves array of devices for export.
\returns Array of strings that contains names of devices to export.
*/
OdStringArray getDevices() const
{
return m_devices;
}
/** \details
Sets paper sizes of devices to export.
\param paperSizes [in] Array that consists of paper width and height values.
\remarks
Width and height are written consistently: for i device width is in 2*i position and height is on 2*i+1 position.
*/
void setPaperSizes(OdDoubleArray paperSizes)
{
m_paperSizes = paperSizes;
}
/** \details
Retrieves reference to array of paper sizes of devices for export.
\returns An array of double values that contain paper width and height.
\remarks
Width and height are written consistently: for i device width is in 2*i position and height is on 2*i+1 position.
*/
OdDoubleArray& getPaperSizes()
{
return m_paperSizes;
}
/** \details
Retrieves array of paper sizes of devices for export.
\returns \returns An array of double values that contain paper width and height.
\remarks
Width and height are written consistently: for i device width is in 2*i position and height is on 2*i+1 position.
*/
OdDoubleArray getPaperSizes() const
{
return m_paperSizes;
}
/** \details
Sets the new flag if need zoom to extents.
\param bVal [in] Zoom to extents flag.
*/
void setZoomToExtents(bool bVal)
{
m_bZoomToExtents = bVal;
}
/** \details
Retrieves flag that indicates whether it is needed zoom to extents.
\returns
true if it is needed zoom to extents, false otherwise.
*/
bool getZoomToExtents() const
{
return m_bZoomToExtents;
}
/** \details
Sets the device for the bitmap generation.
\param device [in] Device which should be used for the bitmap generation.
*/
void setDeviceForBitmap(Device device)
{
m_deviceForBitmap = device;
}
/** \details
Retrieves the device for the bitmap generation.
\returns the device which will be used for the bitmap generation.
*/
Device getDeviceForBitmap() const
{
return m_deviceForBitmap;
}
/** \details
Sets the template for the publish to PDF.
\param publishTemplate [in] Template which should be used for the publish to PDF.
*/
void setPublishTemplate(PublishTemplate publishTemplate)
{
m_publishTemplate = publishTemplate;
}
/** \details
Retrieves the template for the publish to PDF.
\returns the template which will be used for the publish to PDF.
*/
PublishTemplate getPublishTemplate() const
{
return m_publishTemplate;
}
/** \details
Sets the new value of the Align center state.
\param alignCenter [in] A new value of the Align centered state.
*/
void setAlignCenter(AlignCenter alignCenter)
{
m_alignCenter = alignCenter;
}
/** \details
Retrieves the current value of the Align center state.
\return The Align centered flag.
*/
AlignCenter getAlignCenter() const
{
return m_alignCenter;
}
/** \details
Sets the new PDF export options.
\param flags [in] An unsigned 32-bit value that contains export option values.
*/
void setOptions(OdUInt32 flags)
{
m_iFlags = flags;
}
/** \details
Retrieves the current PDF export options.
\returns An unsigned 32-bit value that contains export option values.
*/
OdUInt32 getOptions() const
{
return m_iFlags;
}
//DOM-IGNORE-BEGIN
protected:
bool m_bIs3DPdf; // Flag indicates what action should be performed: export to 2D PDF or publish to 3D PDF
ODCOLORREF m_backgroundColor; // Background color. Default: white.
OdStringArray m_devices; // Devices to export
OdDoubleArray m_paperSizes; // Paper sizes
bool m_bZoomToExtents; // Need zoom to extents
Device m_deviceForBitmap; // Device for bitmap generation
PublishTemplate m_publishTemplate; // Template for publish to PDF
OdUInt32 m_iFlags; // Flags for options
AlignCenter m_alignCenter; // Override for align center state
//DOM-IGNORE-END
};
/** \details
This class implements the Visualize SDK parameters for exporting to .dwg.
\sa
*/
class ODTV_EXPORT OdTvDwgExportParams : public OdTvBaseExportParams
{
/** \details
Specific options DWG export
*/
enum ParamFlags
{
kConvertNurbsToSpline = 1 << 0, // convert nurbs to Spline
kExportToDxf = 1 << 1, // need export to .dxf
kExportBrepAsBrep = 1 << 2, // export Brep as Brep
kSaveNativeHandle = 1 << 3, // save native handle
kExportDbPoints = 1 << 4, // need export Db points
kExportIn2d = 1 << 5, // need export as 2D (actual only for the special case of export the RVT sheets to the DWG)
kExportBlackAsIndex = 1 << 6 // need export black color as index 7
};
public:
/** \details
Creates a new set of export parameters.
*/
OdTvDwgExportParams() : m_version(kVersionAC_Latest), m_flags(kExportBrepAsBrep) { }
/** \details
This class implements the Visualize SDK parameters for exporting markup to .dwg.
*/
struct ODTV_EXPORT OdTvMarkupExportParam
{
//DOM-IGNORE-BEGIN
OdUInt64 m_markupHandle = 0;
OdTvPoint m_pos; // The view's camera position.
OdTvPoint m_target; // The view's camera target.
OdTvVector m_up; // The view's camera up-vector.
OdTvGsView::Projection m_proj = OdTvGsView::kParallel; // The view's camera projection type.
OdTvGsView::RenderMode m_mode = OdTvGsView::k2DOptimized;// The view's rendering mode.
double m_width = 0.; // The view's camera field width.
double m_height = 0.; // The view's camera field height.
OdString m_firstName;
OdString m_lastName;
OdString m_userName;
OdString m_oxygenId; //optional
protected:
template
void ioFunc(OdStreamBufPtr& pBuf, T pFunc);
//DOM-IGNORE-END
public:
/** \details
Writes this object data to the specified OdStreamBufPtr.
\param pBuf [in/out] Smart pointer to a StreamBuf object to put the data into.
*/
void write(OdStreamBufPtr& pBuf);
/** \details
Reads data from a OdStreamBufPtr to the current object.
\param pBuf [in] Smart pointer to a StreamBuf object from which to read the data.
*/
void read(OdStreamBufPtr& pBuf);
/** \details
Converts an array of a
to an OdRxObjectPtrArray.
\param markupsParam [in] OdArray of the .
\returns
An OdRxObjectPtrArray created from an
array of .
*/
static OdRxObjectPtrArray getFrom(const OdArray& markupsParam);
/** \details
Converts an OdRxObjectPtrArray to an
array of .
\param rxParamArr [in] OdRxObjectPtrArray object.
\returns
An OdArray of
created from the specified OdRxObjectPtrArray.
*/
static OdArray getFrom(const OdRxObjectPtrArray& rxParamArr);
};
/** \details
Destroys the set of export parameters.
*/
virtual ~OdTvDwgExportParams() {}
/** \details
Sets a new view to export for the 'view + model' export mode.
\param viewId [in] Identifier of a view to export.
\remarks
Deprecated: use the device export mode instead.
Also, set model to OdTvDwgExportParams if you use the 'view + model' export mode.
*/
void setView(OdTvGsViewId viewId) { m_viewId = viewId; }
/** \details
Retrieves the view for the export operation.
\returns The identifier of the view to export.
*/
OdTvGsViewId getView() const { return m_viewId; }
/** \details
Sets a new model to export for the 'view + model' export mode.
\param modelId [in] Identifier of a model to export.
\remarks
Deprecated: use the device export mode instead.
Also, set view to OdTvDwgExportParams if you use the 'view + model' export mode.
*/
void setModel(OdTvModelId modelId) { m_modelId = modelId; }
/** \details
Retrieves the model for the export operation.
\returns The identifier of the model to export.
*/
OdTvModelId getModel() const { return m_modelId; }
/** \details
Sets a new device to export for device export mode.
\param deviceId [in] Identifier of a device to export.
\remarks
You don't need to specify identifiers of a model and view in the device export mode.
*/
void setDevice(OdTvGsDeviceId deviceId) { m_deviceId = deviceId; }
/** \details
Retrieves the device identifier for the export operation.
\returns The identifier of the device to export.
*/
OdTvGsDeviceId getDevice() const { return m_deviceId; }
/** \details
Sets the convert to spline value.
\param bValue [in] An value for convert nurbs to spline.
*/
void setConvertNurbsToSpline(bool bValue) { SETBIT(m_flags, kConvertNurbsToSpline, bValue); }
/** \details
Sets parameters for saving a drawing with markup.
\param exportParams [in] An array
of objects that contains
markup export parameters.
*/
void setExportMarkupParams(const OdArray& exportParams) { m_exportMarkups = exportParams; }
/** \details
Retrieves the convert nurbs to spline value.
\returns The convert nurbs to spline value.
*/
bool getConvertNurbsToSpline() const { return GETBIT(m_flags, kConvertNurbsToSpline); }
/** \details
Sets the export to DXF value.
\param bValue [in] An value for export to DXF.
*/
void setExportToDxf(bool bValue) { SETBIT(m_flags, kExportToDxf, bValue); };
/** \details
Retrieves the export to DXF value.
\returns The export to DXF value.
*/
bool getExportToDxf() const { return GETBIT(m_flags, kExportToDxf); };
/** \details
Gets an array of markup parameters.
\returns An array of markup parameters.
*/
const OdArray& getExportMarkupParam() const { return m_exportMarkups; }
/** \details
Gets an array of markup parameters.
\returns An array of markup parameters.
*/
OdArray& getExportMarkupParam() { return m_exportMarkups; }
/** \details
Sets a new value of the 'export B-Rep as B-Rep' flag.
\param bExportBrepAsBrep [in] A new flag value.
*/
void setExportBrepAsBrep(bool bExportBrepAsBrep) { SETBIT(m_flags, kExportBrepAsBrep, bExportBrepAsBrep); }
/** \details
Checks whether B-Rep objects from the source files should be exported as B-Rep objects.
\returns
true if and only if B-Rep should be exported as B-Rep.
*/
bool getExportBrepAsBrep() const { return GETBIT(m_flags, kExportBrepAsBrep); }
/** \details
Sets a material, which need to make DWG global.
\param materialId [in] Identifier of a material to do global.
\remarks
If this parameter won't set, more suitable material will be set as global:
- Material, which was markered as global (if exists);
- More suitable material with UseVisualStyleSpecular == OdTvMaterial::kUseVisualStyleSpecular.
*/
void setMaterialToBeGlobal(OdTvMaterialId materialId) { m_materialToBeGlobal = materialId; };
/** \details
Retrieves the material, which need to make DWG global.
\returns The identifier of the material, which need to make DWG global.
*/
OdTvMaterialId getMaterialToBeGlobal() const { return m_materialToBeGlobal; };
/** \details
Defines output .dwg versions.
*/
enum AcadVersion
{
kVersionAC1_2 = 1,
kVersionAC1_40 = 2,
kVersionAC1_50 = 3,
kVersionAC2_20 = 4,
kVersionAC2_10 = 5,
kVersionAC2_21 = 6,
kVersionAC2_22 = 7,
kVersionAC025 = 9, // Release 2.5
kVersionAC026 = 10, // Release 2.6
kVersionAC09 = 11, // Release 9
kVersionAC10 = 13, // Release 10
kVersionAC12 = 16, // R11 and R12
kVersionAC13 = 19, // R13
kVersionAC14 = 21, // R14 release
kVersionAC15 = 23, // R15 (2000) release
kVersionAC18 = 25, // R18 (2004) release
kVersionAC21 = 27, // R21 (2007) release
kVersionAC24 = 29, // R24 (2010) release
kVersionAC27 = 31, // R27 (2013) release
kVersionAC32 = 33, // R32 (2018) release
kVersionAC_Latest, // Latest supported release
kVersionAC_AsIs // Used only for append case and means don't change the version
};
/** \details
Sets the output .dwg version.
\param version [in] A new output version to be set.
*/
void setOutputVersion( AcadVersion version ) { m_version = version; }
/** \details
Retrieves the current output .dwg version.
\returns The current output .dwg version.
*/
AcadVersion getOutputVersion() const { return m_version; }
/** \details
Sets a new value of the "Save Native handle" flag.
\param bSaveNativeHandle [in] A new flag value.
*/
void setSaveNativeEntityHandles(bool bSaveNativeHandle) { SETBIT(m_flags, kSaveNativeHandle, bSaveNativeHandle); }
/** \details
Checks whether the native enitity's handle (as XData) is saved in the output .dwg file.
\returns A boolean value that is equal to true if the native entity's handle is saved; otherwise, the method returns false.
*/
bool getSaveNativeEntityHandles() const { return GETBIT(m_flags, kSaveNativeHandle); }
/** \details
Sets a new value of the "Export Db points" flag.
\param bExportDbPoints [in] A new flag value.
*/
void setExportDbPoints(bool bExportDbPoints) { SETBIT(m_flags, kExportDbPoints, bExportDbPoints); }
/** \details
Checks whether Db points should be exported to the output .dwg file.
\returns A boolean value that is equal to true if Db points should be exported; otherwise, the method returns false.
*/
bool getExportDbPoints() const { return GETBIT(m_flags, kExportDbPoints); }
/** \details
Sets a new value of the "Export in 2D" flag.
\param bExportIn2d [in] A new flag value.
\remarks
This flag is relevant only for the special case of export the RVT sheets to the DWG. In other cases
using of this flag can give unpredictable results.
*/
void setExportIn2d(bool bExportIn2d) { SETBIT(m_flags, kExportIn2d, bExportIn2d); }
/** \details
Checks whether the special mode "Export in 2D" is active.
\returns A boolean value that is equal to true if it is need to perform export via special mode "Export in 2D"
*/
bool getExportIn2d() const { return GETBIT(m_flags, kExportIn2d); }
/** \details
Sets a new value of the "export black color as index 7" flag.
\param bExportIn2d [in] A new flag value.
\remarks
By default, if color has kByColor type and this is black color, it will be exported to cm color as color.
*/
void setExportBlackAsIndex(bool bExportBlackAsIndex) { SETBIT(m_flags, kExportBlackAsIndex, bExportBlackAsIndex); }
/** \details
Checks whether the special mode "export black color as index 7" is active.
\returns A boolean value that is equal to true if it is need to export black color as index 7.
*/
bool getExportBlackAsIndex() const { return GETBIT(m_flags, kExportBlackAsIndex); }
//DOM-IGNORE-BEGIN
protected:
OdArray m_exportMarkups;
OdTvGsViewId m_viewId;
OdTvModelId m_modelId;
OdTvGsDeviceId m_deviceId;
OdTvMaterialId m_materialToBeGlobal;
AcadVersion m_version;
OdUInt16 m_flags;
//DOM-IGNORE-END
};
/** \details
This class implements the Visualize SDK parameters for exporting to .xml or .tgs.
*/
class ODTV_EXPORT OdTvXmlExportParams : public OdTvBaseExportParams
{
public:
/** \details
Creates a new set of export parameters.
*/
OdTvXmlExportParams() : m_bBinary(false), m_bComposite(true) { }
/** \details
Destroys the set of export parameters.
*/
virtual ~OdTvXmlExportParams() {}
/** \details
Sets a device for export.
\param deviceId [in] An export device's identifier.
*/
void setDevice(OdTvGsDeviceId deviceId) { m_deviceId = deviceId; }
/** \details
Retrieves the device for the export operation.
\returns The identifier of the device to export.
*/
OdTvGsDeviceId getDevice() const { return m_deviceId; }
/** \details
Sets the new value of the binary flag. The binary flag value determines whether the export to the binary XML (TGS) should be performed.
\param bIsBinary [in] A new value of the binary flag.
*/
void setIsBinary(bool bIsBinary) { m_bBinary = bIsBinary; }
/** \details
Retrieves the current value of the binary flag.
\return The method returns true if the data should be exported to the binary XML (TGS), otherwise returns false.
*/
bool getIsBinary() const { return m_bBinary; }
/** \details
Sets the new value of the composite flag. The composite flag value determines whether the composite metafiles should be exported.
\param bIsComposite [in] A new value of the composite flag.
*/
void setIsComposite(bool bIsComposite) { m_bComposite = bIsComposite; }
/** \details
Retrieves the current value of the composite flag.
\return The method returns true if the composite metafiles should be exported, otherwise returns false.
*/
bool getIsComposite() const { return m_bComposite; }
//DOM-IGNORE-BEGIN
protected:
OdTvGsDeviceId m_deviceId;
bool m_bBinary;
bool m_bComposite;
//DOM-IGNORE-END
};
/** \details
This class implements the base Visualize SDK append (as export) parameters.
*/
class ODTV_EXPORT OdTvBaseAppendToParams
{
public:
/** \details
Creates a new set of append parameters with default values.
*/
OdTvBaseAppendToParams() : m_strFilePath(OdString::kEmpty), m_strSourceFilePath(OdString::kEmpty) {};
/** \details
Destroys the set of appendparameters.
*/
virtual ~OdTvBaseAppendToParams() {}
/** \details
Sets a new file path for the export output.
\param filePath [in] A string that contains the output file path.
*/
void setFilePath(const OdString& filePath) { m_strFilePath = filePath; }
/** \details
Sets a source file path for the append.
\param filePath [in] A string that contains the source file path.
*/
void setSourceFilePath(const OdString& filePath) { m_strSourceFilePath = filePath; }
/** \details
Retrieves the file path for export output.
\returns The output file full path.
*/
OdString getFilePath() const { return m_strFilePath; }
/** \details
Retrieves the source file path for append.
\returns The source file full path.
*/
OdString getSourceFilePath() const { return m_strSourceFilePath; }
//DOM-IGNORE-BEGIN
protected:
// common properties
OdString m_strFilePath; // Result file path for append with right extension
OdString m_strSourceFilePath; // Source file path for append with right extension
//DOM-IGNORE-END
};
/** \details
This class implements the Visualize SDK parameters for appending to .dwg.
*/
class ODTV_EXPORT OdTvAppendToDwgParams : public OdTvBaseAppendToParams
{
public:
/** \details
Specific options DWG append
*/
enum ParamFlags
{
kConvertNurbsToSpline = 1 << 0, // convert nurbs to Spline
kExportBrepAsBrep = 1 << 1, // export Brep as Brep
kSynchronizeLayers = 1 << 2, // need synchronize layers
kOverrideUnits = 1 << 3, // need override units
kApplyUnitsScaling = 1 << 4, // need apply units scaling
kUpdateElevation = 1 << 5, // update elevation
kSaveNativeHandle = 1 << 6, // save native handle
kSynchronizeErasedInserts = 1 << 7, // need synchronize erased inserts
kSynchronizeErasedEntities = 1 << 8, // need synchronize erased entities in models space
kExportDbPoints = 1 << 9, // need export Db points
kUseNewPDMODE = 1 << 10, // need use PDMODE from appended file
kReloadBlocks = 1 << 11, // reload all existed blocks, referenced by appended blocks
kPolygonInPlanarSurface = 1 << 12 // append polygon as planar surface
};
/** \details
Creates a new set of append parameters.
*/
OdTvAppendToDwgParams() : OdTvBaseAppendToParams(), m_dElevationThreshold(20000.), m_flags(kExportBrepAsBrep | kSynchronizeLayers | kOverrideUnits | kApplyUnitsScaling | kSynchronizeErasedInserts | kReloadBlocks), m_defaultUnits(OdTv::kMillimeters), m_version(OdTvDwgExportParams::kVersionAC_AsIs) { }
/** \details
Destroys the set of append parameters.
*/
virtual ~OdTvAppendToDwgParams() {}
/** \details
Sets new models for the append.
\param modelIds [in] List of the identifiers of a models to append.
*/
void setModels(const OdArray& modelIds) { m_modelIds = modelIds; }
/** \details
Retrieves the models for the append operation.
\returns The list of the identifiers of a models to append.
*/
const OdArray& getModels() const { return m_modelIds; }
/** \details
Sets the convert to spline value.
\param bValue [in] An value for convert nurbs to spline.
*/
void setConvertNurbsToSpline(bool bValue) { SETBIT(m_flags, kConvertNurbsToSpline, bValue); }
/** \details
Retrieves the convert nurbs to spline value.
\returns The convert nurbs to spline value.
*/
bool getConvertNurbsToSpline() const { return GETBIT(m_flags, kConvertNurbsToSpline); }
/** \details
Sets a new value of the 'export B-Rep as B-Rep' flag.
\param bExportBrepAsBrep [in] A new flag value.
*/
void setExportBrepAsBrep(bool bExportBrepAsBrep) { SETBIT(m_flags, kExportBrepAsBrep, bExportBrepAsBrep); }
/** \details
Checks whether B-Rep objects from the source files should be exported as B-Rep objects.
\returns
true if and only if B-Rep should be exported as B-Rep.
*/
bool getExportBrepAsBrep() const { return GETBIT(m_flags, kExportBrepAsBrep); }
/** \details
Sets a new value of the 'synchronize layers' flag.
\param bSynchronizeLayers [in] A new flag value.
*/
void setSynchronizeLayers(bool bSynchronizeLayers) { SETBIT(m_flags, kSynchronizeLayers, bSynchronizeLayers); }
/** \details
Checks whether layers (visibility at least) should be synchronized during append operation.
\returns
true if and only if layers (visibility at least) should be synchronized during append operation.
*/
bool getSynchronizeLayers() const { return GETBIT(m_flags, kSynchronizeLayers); }
/** \details
Sets a new value of the 'override units' flag.
\param bOverrideUnits [in] A new flag value.
\param bApplyUnitsScaling [in] Flag which indicates that it is need to apply units scaling matrix
\param defUnits [in] Units for the scaling matrix calculation in the case if source database has undefined units
*/
void setOverrideUnits(bool bOverrideUnits, bool bApplyUnitsScaling = true, OdTv::Units defUnits = OdTv::kMillimeters)
{
SETBIT(m_flags, kOverrideUnits, bOverrideUnits);
SETBIT(m_flags, kApplyUnitsScaling, bApplyUnitsScaling);
m_defaultUnits = defUnits;
}
/** \details
Checks whether units (getINSUNITS) should be overridden during append operation.
\param bApplyUnitsScaling [out] Flag which indicates that it is need to apply units scaling matrix
\param defUnits [out] Units for the scaling matrix calculation in the case if source database has undefined units
\returns
true if and only if units (getINSUNITS) should be overridden during append operation.
*/
bool getOverrideUnits(bool& bApplyUnitsScaling, OdTv::Units& defUnits) const
{
bApplyUnitsScaling = GETBIT(m_flags, kApplyUnitsScaling);
defUnits = m_defaultUnits;
return GETBIT(m_flags, kOverrideUnits); }
/** \details
Sets new elevation threshold
\param threshold [in] New elevation threshold
*/
void setElevationThreshold(double threshold) { m_dElevationThreshold = threshold; }
/** \details
Retrieves the elevation threshold.
\returns The elevation threshold
*/
double getElevationThreshold() const { return m_dElevationThreshold; }
/** \details
Sets a new value of the 'update elevation flag' flag.
\param bUpdateElevation [in] A new flag value.
\remarks
If this flag is set to true, for the some 2D objects in the source file (circles, polylines, arcs)
the z-ccordinate will be set to zero if it was greater than the threshold which can be set via 'setElevationThreshold' method
*/
void setUpdateElevation(bool bUpdateElevation) { SETBIT(m_flags, kUpdateElevation, bUpdateElevation); }
/** \details
Determines whether the elevation is updated.
\returns A boolean value that is equal to true if the elevation is updated; otherwise, the method returns false.
*/
bool getUpdateElevation() const { return GETBIT(m_flags, kUpdateElevation); }
/** \details
Sets a new value of the "Save Native handle" flag.
\param bSaveNativeHandle [in] A new flag value to be set.
\remarks
The flag value is equal to true if the native entity handle is saved; otherwise, the flag value is equal to false.
*/
void setSaveNativeEntityHandles(bool bSaveNativeHandle) { SETBIT(m_flags, kSaveNativeHandle, bSaveNativeHandle); }
/** \details
Checks whether it is need to save the native enitity's handle (as XData)
\returns
true if and only if the native enitity's handle should be saved.
*/
bool getSaveNativeEntityHandles() const { return GETBIT(m_flags, kSaveNativeHandle); }
/** \details
Sets a new value of the "synchronize erased inserts" flag.
\param bSynchronizeErasedInserts [in] A new flag value to be set.
\remarks
The flag value is equal to true if it is need to synchronize erased inserts; otherwise, the flag value is equal to false.
*/
void setSynchronizeErasedInserts(bool bSynchronizeErasedInserts) { SETBIT(m_flags, kSynchronizeErasedInserts, bSynchronizeErasedInserts); }
/** \details
Checks whether it is need to synchronize erased inserts
\returns
true if and only if it is need to synchronize erased inserts.
*/
bool getSynchronizeErasedInserts() const { return GETBIT(m_flags, kSynchronizeErasedInserts); }
/** \details
Sets a new value of the "synchronize erased entities" flag.
\param bSynchronizeErasedEntities [in] A new flag value to be set.
\remarks
The flag value is equal to true if it is need to synchronize erased entities; otherwise, the flag value is equal to false.
*/
void setSynchronizeErasedEntities(bool bSynchronizeErasedEntities) { SETBIT(m_flags, kSynchronizeErasedEntities, bSynchronizeErasedEntities); }
/** \details
Checks whether it is need to synchronize erased entities
\returns
true if and only if it is need to synchronize erased entities.
*/
bool getSynchronizeErasedEntities() const { return GETBIT(m_flags, kSynchronizeErasedEntities); }
/** \details
Sets a new value of the "Export Db points" flag.
\param bExportDbPoints [in] A new flag value.
*/
void setExportDbPoints(bool bExportDbPoints) { SETBIT(m_flags, kExportDbPoints, bExportDbPoints); }
/** \details
Checks whether Db points should be exported to the output .dwg file.
\returns A boolean value that is equal to true if Db points should be exported; otherwise, the method returns false.
*/
bool getExportDbPoints() const { return GETBIT(m_flags, kExportDbPoints); }
/** \details
Sets a new value of the flag that determines whether to use PDMODE from appended file.
\param bSet [in] A new flag value.
*/
void setUseNewPDMODE(bool bUseNewPDMODE) { SETBIT(m_flags, kUseNewPDMODE, bUseNewPDMODE); }
/** \details
Checks whether to use PDMODE from appended file.
\returns true if the PDMODE shuld be used from appended file; otherwise the method returns false.
*/
bool getUseNewPDMODE() const { return GETBIT(m_flags, kUseNewPDMODE); }
/** \details
Sets a new value of the 'reload all existed blocks, referenced by appended blocks' flag.
\param bReloadBlocks [in] A new flag value.
\remarks
If this parameter is enabled, all existed blocks, referenced by appended blocks, will be reloaded.
*/
void setReloadBlocks(bool bReloadBlocks) { SETBIT(m_flags, kReloadBlocks, bReloadBlocks); }
/** \details
Determines whether its need to reload all existed blocks, referenced by appended blocks.
\returns A boolean value that is equal to true if the blocks reloading is enabled; otherwise, the method returns false.
*/
bool getReloadBlocks() const { return GETBIT(m_flags, kReloadBlocks); }
/** \details
Sets the output .dwg version.
\param version [in] A new output version to be set.
*/
void setOutputVersion( OdTvDwgExportParams::AcadVersion version ) { m_version = version; }
/** \details
Retrieves the current output .dwg version.
\returns The current output .dwg version.
*/
OdTvDwgExportParams::AcadVersion getOutputVersion() const { return m_version; }
/** \details
Sets a new value of the 'polygon in planar surface' flag.
\param bPolygonInPlanarSurface [in] A new flag value.
\remarks
If this parameter is enabled, all filled polygons will be exported as planar surface.
*/
void setPolygonInPlanarSurface(bool bPolygonInPlanarSurface) { SETBIT(m_flags, kPolygonInPlanarSurface, bPolygonInPlanarSurface); }
/** \details
Determines whether its need to append all filled polygons as planar surfaces.
\returns A boolean value that is equal to true if need to append all filled polygons as planar surfaces; otherwise, the method returns false.
*/
bool getPolygonInPlanarSurface() const { return GETBIT(m_flags, kPolygonInPlanarSurface); }
//DOM-IGNORE-BEGIN
protected:
OdArray m_modelIds; // Models for append.
double m_dElevationThreshold; // Elevation threshold.
OdUInt16 m_flags; // Different options.
OdTv::Units m_defaultUnits; // Default units for the scaling matrix.
OdTvDwgExportParams::AcadVersion m_version; // Output .dwg version.
//DOM-IGNORE-END
};
/** \details
This class implements the Visualize SDK parameters for exporting to Navisworks.
*/
class ODTV_EXPORT OdTvNwdExportParams : public OdTvBaseExportParams
{
public:
/** \details
File type enumeration for Navisworks export.
*/
enum class FileType : OdUInt8
{
kNwd = 0, // Navisworks Document
kNwc = 1, // Navisworks Cache
kNwf = 2 // Navisworks File Set
};
/** \details
File format version enumeration for Navisworks export.
*/
enum class FileFormat : OdUInt8
{
kNW_2016 = 0, // Navisworks 2016
kNW_2026 = 1 // Navisworks 2026
};
/** \details
Specific options nwd export.
*/
enum ParamFlags
{
kDoPublish = 1 << 0, // export as publish
kCanResave = 1 << 1, // published copy can be resaved
kEmbedded = 1 << 2, // embedded textures and other external resources
kExportCDAParameters = 1 << 3, // export CDA attributes
};
/** \details
Creates the set of export parameters.
*/
OdTvNwdExportParams()
: m_flags(0)
, m_fileType(FileType::kNwd)
, m_fileFormat(FileFormat::kNW_2026)
{ }
/** \details
Destroys the set of export parameters.
*/
virtual ~OdTvNwdExportParams() {}
/** \details
Sets a device for export.
\param deviceId [in] An export device's identifier.
*/
void setDevice(OdTvGsDeviceId deviceId) { m_deviceId = deviceId; }
/** \details
Retrieves the device for the export operation.
\returns The identifier of the device to export.
*/
OdTvGsDeviceId getDevice() const { return m_deviceId; }
/** \details
Sets a new value of the flag that determines whether a publication occurs rather than just a simple save.
\param isPublish [in] A new flag value.
*/
void setPubSettingsPublishFlag(bool isPublish) { SETBIT(m_flags, kDoPublish, isPublish); }
/** \details
Sets a new title for the publish.
\param title [in] A string that contains title.
*/
void setPubSettingsTitle(const OdString& title) { m_sTitle = title; }
/** \details
Sets a new subject for the publish.
\param subject [in] A string that contains subject.
*/
void setPubSettingsSubject(const OdString& subject) { m_sSubject = subject; }
/** \details
Sets a new subject for the author.
\param author [in] A string that contains author.
*/
void setPubSettingsAuthor(const OdString& author) { m_sAuthor = author; }
/** \details
Sets a new value of the flag that determines whether a published file can be resaved.
\param isCanResave [in] A new flag value.
*/
void setPubSettingsCanResaveFlag(bool isCanResave) { SETBIT(m_flags, kCanResave, isCanResave); }
/** \details
Sets a new value of the flag that determines whether an external resources are includes.
\param isIncludeEmbedded [in] A new flag value.
*/
void setPubSettingsEmbeddedFlag(bool isIncludeEmbedded) { SETBIT(m_flags, kEmbedded, isIncludeEmbedded); }
/** \details
Checks whether a publication occurs rather than just a simple save.
\returns A boolean value that is equal to true if publication occurs; otherwise, the method returns false.
*/
bool getPubSettingsPublishFlag() const { return GETBIT(m_flags, kDoPublish); }
/** \details
Retrieves the title field of the publish settings.
\returns Title field of the publish settings.
*/
OdString getPubSettingsTitle() const { return m_sTitle; }
/** \details
Retrieves the subject field of the publish settings.
\returns Subject field of the publish settings.
*/
OdString getPubSettingsSubject() const { return m_sSubject; }
/** \details
Retrieves the author field of the publish settings.
\returns Author feld of the publish settings.
*/
OdString getPubSettingsAuthor() const { return m_sAuthor; }
/** \details
Checks whether a published file can be resaved.
\returns A boolean value that is equal to true if a published file can be resaved; otherwise, the method returns false.
*/
bool getPubSettingsCanResaveFlag() const { return GETBIT(m_flags, kCanResave); }
/** \details
Checks whether an external resources are includes.
\returns A boolean value that is equal to true if an external resources are includes; otherwise, the method returns false.
*/
bool getPubSettingsEmbeddedFlag() const { return GETBIT(m_flags, kEmbedded); }
/** \details
Sets the file type for export.
\param fileType [in] File type value (0=NWD, 1=NWC, 2=NWF).
*/
void setFileType(OdUInt32 fileType) { m_fileType = static_cast(fileType); }
/** \details
Retrieves the file type for export.
\returns File type value (0=NWD, 1=NWC, 2=NWF).
*/
OdUInt32 getFileType() const { return static_cast(m_fileType); }
/** \details
Sets the file version for export.
\param fileVersion [in] File version value (0=NW_2016, 1=NW_2026).
*/
void setFileVersion(OdUInt32 fileVersion) { m_fileFormat = static_cast(fileVersion); }
/** \details
Retrieves the file version for export.
\returns File version value (0=NW_2016, 1=NW_2026).
*/
OdUInt32 getFileVersion() const { return static_cast(m_fileFormat); }
/** \details
Checks whether CDA attributes are exported.
\returns A boolean value that is equal to true if CDA attributes are exported; otherwise, the method returns false.
*/
bool getExportCDAParametersFlag() const { return GETBIT(m_flags, kExportCDAParameters); }
/** \details
Sets a new value of the flag that determines whether CDA attributes are exported.
\param bSet [in] A new flag value.
*/
void setExportCDAParametersFlag(bool bSet) { SETBIT(m_flags, kExportCDAParameters, bSet); }
private:
OdUInt16 m_flags;
FileType m_fileType;
FileFormat m_fileFormat;
OdString m_sTitle;
OdString m_sSubject;
OdString m_sAuthor;
OdTvGsDeviceId m_deviceId;
};
/** \details
This class provides the common interface for the export operations.
*/
class ODTV_EXPORT OdTvVisualizeExport
{
public:
/** \details
Creates an instance of the Visualize SDK export functionality.
*/
OdTvVisualizeExport() {};
/** \details
Destroys an instance of the Visualize SDK export functionality.
*/
virtual ~OdTvVisualizeExport() {}
/** \details
Retrieves the set of export process properties.
\returns A smart pointer to the instance of the OdRxDictionary object that encapsulates export process properties.
*/
virtual OdRxDictionaryPtr properties() = 0;
/** \details
Exports the Visualize database to the specified file.
\param tvDbId [in] A Visualize database to export.
\param fileName [in] A full path to the output file.
\returns The result of the export operation represented with an value.
*/
virtual OdTvResult exportTo(const OdTvDatabaseId& tvDbId, const OdString& fileName) const = 0;
/** \details
Exports the Visualize database to the specified stream buffer.
\param tvDbId [in] A Visualize database to export.
\param pStreamBuf [in] Stream buffer to file for export.
\returns The result of the export operation represented with an value.
*/
virtual OdTvResult exportTo(const OdTvDatabaseId& tvDbId, OdStreamBuf* pStreamBuf) const = 0;
/** \details
Appends a list of Visualize models to the specified file.
\param tvModelIds [in] A Visualize models to append.
\param sourceFileName [in] A full path to the source file.
\param fileName [in] A full path to the output file.
\returns The result of the append operation represented with an value.
\remarks
tvModelIds parameter must be not empty and contain models from one database. Data from all models will be appended as one.
*/
virtual OdTvResult appendTo(const OdArray& tvModelIds, const OdString& sourceFileName, const OdString& fileName) const = 0;
};
/** \details
A data type that represents a smart pointer to an object.
*/
typedef OdSharedPtr OdTvVisualizeExportPtr;
/** \details
This class provides an interface for the module that exports data from a Visualize database.
*/
class ODTV_EXPORT OdTvVisualizeExportModule : public OdRxModule
{
public:
/** \details
Returns the object that exports a Visualize database to a specified file.
\returns A smart pointer to an object that implements the export functionality.
*/
virtual OdTvVisualizeExportPtr getVisualizeExporter() const = 0;
};
/** \details
A data type that represents a smart pointer to an object.
*/
typedef OdSmartPtr OdTvVisualizeExportModulePtr;
/** \details
A data type that represents a pointer to the export callback function for Visualize SDK.
*/
typedef void(*OdTvExportCallbackFunction)(OdTvVisualizeExport*);
/** \details
A data type that represents an array of objects.
*/
typedef OdArray OdTvMarkupExportParamArray;
#include "TD_PackPop.h"
#endif // _ODTV_EXPORT_H_INCLUDED_