///////////////////////////////////////////////////////////////////////////////
// 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_IMPORTUSERDATA_H_INCLUDED_
#define _ODTV_IMPORTUSERDATA_H_INCLUDED_
#include "TD_PackPush.h"
#include "OdaCommon.h"
#include "OdStreamBuf.h"
#include "Ge/GePoint2d.h"
#include "Tv.h"
#include "TvUserData.h"
#define OdTvDWGUserData L"Dwg2Visualize - ODA"
#define OdTvDWGPointUserData L"Dwg2Visualize - ODA - Points"
#define OdTvDWGPolylineUserData L"Dwg2Visualize - ODA - Polylines"
#define OdTvLinkedCameraUserData L"ODALinkedCamera"
#define OdTvPRCUserData L"Prc2Visualize - ODA - CollectedPrcUserData"
#define OdTvBimRvUserData L"Bim2Visualize - ODA"
#define OdTvImportUnitsUserData L"ODA - import - unitsNameInfo"
/** \details
The structure for storing the DWG specific layout parameters, which can be used during export through PE.
*/
struct ODTV_EXPORT OdTvDwgLayoutData
{
public:
OdString m_strPaperName; // Paper space name.
OdUInt16 m_iPaperUnits; // Measurement units for the paper space.
double m_dPrinterWidth; // Width for printing.
double m_dPrinterHeight; // Height for printing.
double m_dOffsetX; // Layout offset by the x-axis.
double m_dOffsetY; // Layout offset by the y-axis.
OdGePoint2d m_paperImageOrigin; // Origin of a paper space.
double m_dLeftMargin; // Margin from the left border
double m_dRightMargin; // Margin from the right border
double m_dTopMargin; // Margin from the top border
double m_dBottomMargin; // Margin from the bottom border
OdInt16 m_plotType; // Plot type
OdInt16 m_plotRot; // Plot rotation
//scale parameters
double m_dStdScale; // Standard layout scale
double m_dCustomScaleNumerator; // Numerator in the scale ratio. Specifies the number of inches or mm for the scale.
double m_dCustomScaleDenominator; // Denominator in the scale ratio. Specifies the number of drawing units for the scale.
// Corners of the plot window area
double m_dXmin; // coordinate of the lower - left corner.
double m_dYmin; // coordinate of the lower - left corner.
double m_dXmax; // coordinate of the upper - right corner.
double m_dYmax; // coordinate of the upper - right corner.
OdInt16 m_shadePlot; // shading mode for plot
/** \details
Layout-specific properties.
*/
enum Properties
{
kModelSpace = (1 << 0), // Defines that model space is used.
kScaledToFit = (1 << 1), // Defines that layout should be scaled to fit the contents.
kCentered = (1 << 2), // Defines that layout should be centered regarding contents.
kUseStandardScale = (1 << 3), // Defines that standard scale should be used.
kPrintLineweights = (1 << 4), // Defines that linewieghts should be printed in this layout.
kPlotHidden = (1 << 5), // Defines that hidden content should be plotted.
kScaleLineWeights = (1 << 6), // Defines that lineweights can be scaled.
kPlotPlotstyles = (1 << 7) // Defines plot styles.
};
OdUInt16 m_PlotLayoutFlags; // Plot layout flags.
OdString m_strCurStyleSheet; // String that represents a name of a currently used style sheet.
/** \details
Default constructor for the OdTvDwgLayoutData structure. Creates structure
with a set of properties initialized:
*/
OdTvDwgLayoutData();
/** \details
Reads layout-specific properties from the stream buffer.
\param strm [in] Pointer to a stream buffer to read the properties from.
*/
void read(OdStreamBuf* strm);
/** \details
Writes layout-specific properties to the specified stream buffer.
\param strm [in] Pointer to a stream buffer to write the data to.
*/
void write(OdStreamBuf* strm);
};
/** \details
The structure for storing the DWG specific view parameters, which can be used during export through PE.
*/
struct ODTV_EXPORT OdTvDwgViewData
{
/** \details
View types.
*/
enum Type
{
kModel = 0, // models space view
kUnderlayingPaper = 1, // underlaying view with paper
kPaper = 2, // main paper space view
kViewport = 3 // paper space viewports
};
Type m_type; // view type
OdGePoint3d m_target; // isn't used for the m_type = kViewport
OdInt16 m_shadePlot; // shading mode for plot (used only for the m_type = kViewport)
bool m_bPlotHidden; // use hidden for plot (used only for the m_type = kViewport)
/** \details
Default constructor for the OdTvDwgViewData structure. Creates structure
with m_type set to kModel, m_target set to OdGePoint3d::kOrigin, m_shadePlot set to 0
and m_bPlotHidden set to false.
*/
OdTvDwgViewData();
/** \details
Reads view-specific properties from the stream buffer.
\param strm [in] Pointer to a stream buffer to read the properties from.
*/
void read(OdStreamBuf* strm);
/** \details
Writes view-specific properties to the specified stream buffer.
\param strm [in] Pointer to a stream buffer to write the data to.
*/
void write(OdStreamBuf* strm);
};
/** \details
The structure for storing the DWG specific database parameters, which can be used during export through PE.
*/
struct ODTV_EXPORT OdTvDwgDbData
{
/** \details
Properties for the imported DWG database parameters.
*/
enum Properties
{
kDisplaySilhouettes = (1 << 0), // Only silhouettes of drawables are displayed.
};
OdUInt16 m_prop; // Stores import properties.
OdUInt16 m_iMeasurement; // Represents the measurement systems. 0 - english system, 1 - metric system
OdUInt16 m_insUnits; // INSUNITS specifies the drawing units used in the automatic scaling of blocks, Xrefs, and images
OdInt16 m_PDMODE; // PDMODE for Db points
double m_dPDSIZE; // Size of Db points
/** \details
Default constructor for the OdTvDwgDbData structure. Creates structure
with m_prop and m_iMeasurement members set to 0.
*/
OdTvDwgDbData();
/** \details
Reads database-specific properties from the stream buffer.
\param strm [in] Pointer to a stream buffer to read the properties from.
*/
void read(OdStreamBuf* strm);
/** \details
Writes database-specific properties to the specified stream buffer.
\param strm [in] Pointer to a stream buffer to write the data to.
*/
void write(OdStreamBuf* strm) const;
/** \details
Serializes data to the byte array and creates user data from it
\returns A pointer to the user data
*/
OdTvUserData* serialize() const;
/** \details
Deserializes data from user data.
\param strm [in] Pointer to a user data, which contains byte array to read the properties from
*/
bool deserialize(OdTvUserData* pUserData);
};
/** \details
The structure for storing the DB Point specific data.
*/
struct ODTV_EXPORT OdTvDwgDbPointData
{
OdTvPoint m_point; // the WCS position of the point entity
OdTvVector m_normal; // the WCS unit vector which is the normal to the plane of the entity.
// Normal defines the orientation of the plane in world space.
double m_dUcsXAngle; // the ECS Rotation which defines the angle in radians between the OCS X - axis for
// the point based on the normal vector and the X - axis that will be used for displaying the
// point entity. A positive angle value is measured clockwise. A negative angle
// value is measured counterclockwise.
double m_dThickness; // the thickness of the point entity in drawing units.Thickness is the extrusion length along the normal.
// A positive value defines the thickness to be drawn along the normal direction.A negative value defines the thickness to be
// drawn in the opposite direction from the normal.A zero value defines a entity without thickness.
/** \details
Default constructor for the OdTvDwgDbPointData structure. Creates structure
with m_point set to OdTvPoint::kOrigin, m_dUcsXAngle set to 0., m_normal set to OdTvVector::kZAxis
and m_dThickness set to 0..
*/
OdTvDwgDbPointData();
/** \details
Serializes data to the byte array and creates user data from it
\returns A pointer to the user data
*/
OdTvUserData* serialize() const;
/** \details
Deserializes data from user data.
\param strm [in] Pointer to a user data, which contains byte array to read the properties from
*/
bool deserialize(OdTvUserData* pUserData);
};
/** \details
The structure for storing the DB Polyline vertices data.
*/
struct ODTV_EXPORT OdTvDwgPolylineVerticesData
{
OdGePoint3dArray m_vertices; //Stores polyline vertices
/** \details
Default constructor for the OdTvPolylineVerticesData structure. Creates structure
with empty m_vertices.
*/
OdTvDwgPolylineVerticesData();
/** \details
Serializes data to the byte array and creates user data from it
\returns A pointer to the user data
*/
OdTvUserData* serialize() const;
/** \details
Deserializes data from user data.
\param strm [in] Pointer to a user data, which contains byte array to read the properties from
*/
bool deserialize(OdTvUserData* pUserData);
};
/** \details
The structure for storing the PRC specific info, which can be used during export through PE.
*/
struct ODTV_EXPORT OdTvPrcUserData
{
public:
/** \details
The class for storing the PRC attribute title specific info.
*/
class ODTV_EXPORT PrcAttributeTitle
{
public:
/** \details
Enumeration represents the list of valid attribute titles.
*/
enum ePRCAttributeEntry {
/** An empty attribute title.*/
kPRCAttributeEntryNotSet = 0,
/** The attribute contains a title.*/
kPRCAttributeEntryTitle = 2,
/** The attribute contains information about a subject.*/
kPRCAttributeEntrySubject = 3,
/** The attribute contains information about an author.*/
kPRCAttributeEntryAuthor = 4,
/** The attribute contains a list of keywords.*/
kPRCAttributeEntryKeywords = 5,
/** The attribute contains a comment.*/
kPRCAttributeEntryComments = 6,
/** The attribute contains a template.*/
kPRCAttributeEntryTemplate = 7,
/** The attribute contains information about a person who saved the entity last time.*/
kPRCAttributeEntryLastSavedBy = 8,
/** The attribute contains a revision number*/
kPRCAttributeEntryRevisionNumber = 9,
/** The attribute contains information about a total time the entity was being edited.*/
kPRCAttributeEntryTotalEditingTime = 10,
/** The attribute contains information about when the entity was printed last time.*/
kPRCAttributeEntryLastPrinted = 11,
/** The attribute contains date and time of creation. */
kPRCAttributeEntryCreateTimeDate = 12,
/** The attribute contains date and time of last saving. */
kPRCAttributeEntryLastSavedTimeDate = 13,
/** The attribute contains the number of pages. */
kPRCAttributeEntryNumberOfPages = 14,
/** The attribute contains the number of words. */
kPRCAttributeEntryNumberOfWords = 15,
/** The attribute contains the number of characters. */
kPRCAttributeEntryNumberOfChars = 16,
/** The attribute contains thumbnail.*/
kPRCAttributeEntryThumbnail = 17,
/** The attribute contains a name of application the entity was created with.*/
kPRCAttributeEntryNameOfCreatingApp = 18,
/** The attribute contains security information.*/
kPRCAttributeEntrySecurity = 19,
/** For internal use, contains the number of valid attributer titles.*/
kPRCAttributeEntryLAST = 20,
};
private:
OdUInt8 m_titleInt;
OdString m_titleStr;
public:
/** \details
Default constructor for the PrcAttributeTitle structure.
*/
PrcAttributeTitle();
/** \details
Checks whether the attribute title is a predefined title or not.
When an attribute title is a predefined title, its value is represented with an integer value.
When at attribute title is not a predefined title (a user-defined title), its value is represented with a string.
\return true if the attribute title object represents a predefined attribute title; otherwise, the method returns false.
*/
bool titleIsInteger() const;
/** \details
Sets a new value of the user-defined attribute title.
\param title [in] A string that contains the new title value to be set.
*/
void setData(const OdString& title);
/** \details
Sets a new value of the predefined attribute title.
\param titleIdx [in] A value of the ePRCAttributeEntry enumeration that represents the new predefined attribute title.
*/
void setData(ePRCAttributeEntry titleIdx);
/** \details
Requests the current value of the user-defined attribute title.
\returns A string that contains the title value.
*/
OdString getTitle() const;
/** \details
Requests the current value (index) of the predefined attribute title.
\returns An ePRCAttributeEntry enumeration value that contains the index of the predefined attribute title.
*/
ePRCAttributeEntry getIndex() const;
/** \details
The assignment operator for attribute title objects.
\param source [in] Another object to be assigned (the right-hand operand of the assignment operation.
\returns A reference to the attribute entry object modified with the assignment operation.
*/
PrcAttributeTitle& operator= (const OdTvPrcUserData::PrcAttributeTitle& source);
/** \details
Reads PRC attribute title from the stream buffer.
\param strm [in] Pointer to a stream buffer to read the properties from.
*/
void read(OdStreamBuf* strm);
/** \details
Writes PRC attribute title to the specified stream buffer.
\param strm [in] Pointer to a stream buffer to write the data to.
*/
void write(OdStreamBuf* strm);
};
/** \details
The class for storing the PRC single attribute specific info.
*/
class ODTV_EXPORT OdPrcSingleAttribute
{
public:
/** \details
Enumeration represents data types for PRC attribute.
*/
enum ePRCAttributeType {
/** A Null value.*/
kPRCAttributeTypeNull = 0,
/** An Integer value.*/
kPRCAttributeTypeInt = 1,
/** A real value.*/
kPRCAttributeTypeReal = 2,
/** A time value.*/
kPRCAttributeTypeTime = 3,
/** A string value.*/
kPRCAttributeTypeString = 4
};
private:
PrcAttributeTitle m_AttributeEntry;
OdUInt8 m_type;
union
{
OdInt32 int32_data;
double double_data;
OdUInt32 uint32_data;
OdString* pStr_data;
} m_data;
public:
/** \details
Default constructor for the OdPrcSingleAttribute structure.
*/
OdPrcSingleAttribute();
/** \details
Copy constructor for the OdPrcSingleAttribute structure.
*/
OdPrcSingleAttribute(const OdPrcSingleAttribute& source);
/** \details
Destroys the attribute and its data.
*/
~OdPrcSingleAttribute();
/** \details
Requests the title of the attribute.
\returns A reference to the object that represents the attribute title.
\remarks
Since the method returns the attribute title object via a reference, any modification of the returned attribute title object
affects the attribute object, and can be used to set a new title.
*/
PrcAttributeTitle& attributeEntry();
/** \details
Requests the title of the attribute.
\returns A constant reference to the object that represents the attribute title.
\remarks
Call this method if you want to restrict any modification of the .
*/
const PrcAttributeTitle& attributeEntry() const;
/** \details
The assignment operator for attributes.
\param source [in] Another object to be assigned (right-hand operand of the assignment operation).
\returns A reference to the attribute object modified with the assignment operation.
*/
OdPrcSingleAttribute& operator= (const OdPrcSingleAttribute& source);
/** \details
Sets the attribute data represented with a signed 32-bit integer value.
\param data [in] A signed 32-bit integer value that represents the data to be set.
*/
void setData(OdInt32 data);
/** \details
Sets the attribute data represented with a double value.
\param data [in] A double value that represents the data to be set.
*/
void setData(double data);
/** \details
Sets the attribute data represented with a date and time value.
\param data [in] A date and time value that represents the data to be set.
*/
void setData(const OdTimeStamp& data);
/** \details
Sets the attribute data represented with an unsigned 32-bit value.
\param data [in] An unsigned 32-bit value that represents the data to be set.
*/
void setData(OdUInt32 data);
/** \details
Sets the attribute data represented with a string value.
\param data [in] A string value that represents the data to be set.
*/
void setData(const OdString& data);
/** \details
Clears the data and type of the attribute.
*/
void empty();
/** \details
Requests the attribute data type.
\returns An ePRCAttributeType enumeration value that contains the attribute data type.
*/
ePRCAttributeType getType() const;
/** \details
Requests the current value of the attribute cast to the signed 32-bit integer data type.
\returns A signed 32-bit integer value that contains the current attribute value.
*/
OdInt32 getDataInt32() const;
/** \details
Requests the current value of the attribute cast to the double data type.
\returns A double value that contains the current attribute value.
*/
double getDataDouble() const;
/** \details
Requests the current value of the attribute cast to the unsigned 32-bit integer data type.
\returns An unsigned 32-bit integer value that contains the current attribute value.
*/
OdUInt32 getDataUInt32() const;
/** \details
Requests the current value of the attribute cast to the date and time data type.
\returns A date and time value that contains the current attribute value.
*/
OdTimeStamp getDataTime() const;
/** \details
Requests the current value of the attribute cast to the string data type.
\returns A string value that contains the current attribute value.
*/
const OdString& getDataStr() const;
/** \details
Reads PRC single attribute from the stream buffer.
\param strm [in] Pointer to a stream buffer to read the properties from.
*/
void read(OdStreamBuf* strm);
/** \details
Writes PRC single attribute to the specified stream buffer.
\param strm [in] Pointer to a stream buffer to write the data to.
*/
void write(OdStreamBuf* strm);
};
/** \details
The class for storing the PRC attribute specific info.
*/
class ODTV_EXPORT OdPrcAttribute
{
public:
PrcAttributeTitle m_Title; //title for PRC attribute
OdArray m_Attributes; //array of PRC single attribute
/** \details
Reads PRC attribute from the stream buffer.
\param strm [in] Pointer to a stream buffer to read the properties from.
*/
void read(OdStreamBuf* strm);
/** \details
Writes PRC attribute to the specified stream buffer.
\param strm [in] Pointer to a stream buffer to write the data to.
*/
void write(OdStreamBuf* strm);
};
OdUInt32 m_Type; //Type of PRC entity
OdUInt64 m_cardPersistentIndentifier; //cardPersistentIndentifier of PRC entity
OdUInt64 m_cadIdentifier; //cadIdentifier of PRC entity
OdString m_Name; //Name of PRC entity
OdString m_Title; //Title of PRC entity
OdString m_UnicID; //UnicID of PRC entity
OdString m_MarkupText; //Single - line text for Markup PRC entity
OdArray m_Attributes; //Attributes of PRC entity
OdTvPrcUserData();
/** \details
Reads PRC-specific properties from the stream buffer.
\param strm [in] Pointer to a stream buffer to read the properties from.
*/
void read(OdStreamBuf* strm);
/** \details
Writes PRC-specific properties to the specified stream buffer.
\param strm [in] Pointer to a stream buffer to write the data to.
*/
void write(OdStreamBuf* strm);
};
/** \details
The structure for storing the BimRv specific parameters.
*/
struct ODTV_EXPORT OdTvBimRvEntityData
{
public:
/** \details
Default constructor for the OdTvBimRvEntityData structure.
*/
OdTvBimRvEntityData();
/** \details
Set CategoryId of BimRv entity.
\param categoryId [in] A new value of CategoryId.
*/
void setCategoryId(const OdInt64& categoryId);
/** \details
Clear CategoryId of BimRv entity. CategoryId will be markered as unset.
*/
void clearCategoryId();
/** \details
Requests the current value of CategoryId.
\param categoryId [out] A current value of CategoryId.
\returns True if CategoryId was set.
*/
bool getCategoryId(OdInt64& categoryId) const;
/** \details
Set SymbodIdParam of BimRv entity.
\param symbodIdParam [in] A new value of SymbodIdParam.
*/
void setSymbodIdParam(const OdInt64& symbodIdParam);
/** \details
Clear SymbodIdParam of BimRv entity. SymbodIdParam will be markered as unset.
*/
void clearSymbodIdParam();
/** \details
Requests the current value of SymbodIdParam.
\param symbodIdParam [out] A current value of SymbodIdParam.
\returns True if SymbodIdParam was set.
*/
bool getSymbodIdParam(OdInt64& symbodIdParam) const;
/** \details
Check that at least one value is set.
\returns True if at least one value is set.
*/
bool isNotEmpty() const;
/** \details
Reads layout-specific properties from the stream buffer.
\param strm [in] Pointer to a stream buffer to read the properties from.
*/
void read(OdStreamBuf* strm);
/** \details
Writes layout-specific properties to the specified stream buffer.
\param strm [in] Pointer to a stream buffer to write the data to.
*/
void write(OdStreamBuf* strm);
protected:
/** \details
Defined properties.
*/
enum Properties
{
kCategoryId = (1 << 0), // Defines that CategoryId was set.
kSymbodIdParam = (1 << 1) // Defines that SymbodIdParam was set.
};
OdUInt16 m_definedParamsFlags; // Flags, which define which params was set.
OdInt64 m_categoryId;
OdInt64 m_symbodIdParam;
};
/** \details
The structure for storing the units name information.
*/
struct ODTV_EXPORT OdTvImportUnitsNameInfo
{
public:
OdString m_fullUnitName; // Full name of the unit (e.g., "US Survey Feet")
OdString m_shortUnitName; // Short name of the unit (e.g., "ftUS")
/** \details
Default constructor for the OdTvImportUnitsNameInfo structure. Creates structure
with empty strings.
*/
OdTvImportUnitsNameInfo();
/** \details
Reads units name information from the stream buffer.
\param strm [in] Pointer to a stream buffer to read the properties from.
*/
void read(OdStreamBuf* strm);
/** \details
Writes units name information to the specified stream buffer.
\param strm [in] Pointer to a stream buffer to write the data to.
*/
void write(OdStreamBuf* strm) const;
/** \details
Serializes data to the byte array and creates user data from it
\returns A pointer to the user data
*/
OdTvUserData* serialize() const;
/** \details
Deserializes data from user data.
\param pUserData [in] Pointer to a user data, which contains byte array to read the properties from
*/
bool deserialize(OdTvUserData* pUserData);
};
#include "TD_PackPop.h"
#endif // _ODTV_IMPORTUSERDATA_H_INCLUDED_