///////////////////////////////////////////////////////////////////////////////
// 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_EXPORTUSERDATA_H_INCLUDED_
#define _ODTV_EXPORTUSERDATA_H_INCLUDED_
#include "TD_PackPush.h"
#include "OdaCommon.h"
#include "OdStreamBuf.h"
#include "Ge/GePoint2d.h"
#include "Tv.h"
#include "TvUserData.h"
#include "TvLayer.h"
#define OdTvDWGExportBlockAttributeDefinitionUserData L"Visualize2Dwg - ODA - BlockAttributeDefinition"
class OdTvDwgAttributeData;
class OdTvDwgAttributeDefinitionData;
/** \details
A data type that represents a to an object.
*/
typedef OdTvSmartPtr OdTvDwgAttributeDataPtr;
/** \details
A data type that represents an array of Visualize SDK entity identifiers.
*/
typedef OdArray OdTvDwgAttributeDatasArray;
/** \details
A data type that represents a to an object.
*/
typedef OdTvSmartPtr OdTvDwgAttributeDefinitionDataPtr;
/** \details
A data type that represents an array of Visualize SDK entity identifiers.
*/
typedef OdArray OdTvDwgAttributeDefinitionDatasArray;
/** \details
The structure for storing OdTvDwgAttributeDefinitionData or OdTvDwgAttributeData objects.
*/
class ODTV_EXPORT OdTvDwgAttributesDataStorage
{
public:
/** \details
Default constructor for the OdTvDwgAttributesDataStorage structure.
*/
OdTvDwgAttributesDataStorage();
/** \details
Setup array of attributes.
\param attributes [in] Input array of attributes.
*/
void setAttributes(const OdTvDwgAttributeDatasArray& attributes);
/** \details
Returns array of attributes.
\returns Array that may contain multiple attributes.
\remarks
The referenced object returned by the method can be modified, and modifications are saved in the attributes.
*/
OdTvDwgAttributeDatasArray& getAttributes();
/** \details
Returns array of attributes.
\returns Array that may contain multiple attributes.
\remarks
The referenced object returned by the method is read-only.
*/
const OdTvDwgAttributeDatasArray& getAttributes() const;
/** \details
Setup array of attribute definitions.
\param attributes [in] Input array of attribute definitions.
*/
void setAttributeDefinitions(const OdTvDwgAttributeDefinitionDatasArray& attributes);
/** \details
Returns array of attributes.
\returns Array that may contain multiple attribute definitions.
\remarks
The referenced object returned by the method can be modified, and modifications are saved in the attribute definitions.
*/
OdTvDwgAttributeDefinitionDatasArray& getAttributeDefinitions();
/** \details
Returns array of attributes.
\returns Array that may contain multiple attribute definitions.
\remarks
The referenced object returned by the method is read-only.
*/
const OdTvDwgAttributeDefinitionDatasArray& getAttributeDefinitions() 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:
OdTvDwgAttributeDefinitionDatasArray m_attributeDefinitions;
OdTvDwgAttributeDatasArray m_attributes;
};
/** \details
The structure for storing the DWG-specific block reference attribute parameters that can be used during export.
Add this user data to OdTvInsert.
*/
class ODTV_EXPORT OdTvDwgAttributeData : public OdTvIObject
{
friend class OdTvDwgAttributesDataStorage;
public:
/** \details
Enumerates attribute horizontal mode
*/
enum TextHorzMode
{
kTextLeft = 0, // Left horizontal alignment
kTextCenter = 1, // Center horizontal alignment
kTextRight = 2, // Right horizontal alignment
kTextAlign = 3, // Alignment to text by horizontal
kTextMid = 4, // Alignment to middle by horizontal
kTextFit = 5 // Alignment to fit by horizontal
};
/** \details
Enumerates attribute vertical mode
*/
enum TextVertMode
{
kTextBase = 0, // Base vertical alignment
kTextBottom = 1, // Bottom vertical alignment
kTextVertMid = 2, // Alignment to middle by vertical
kTextTop = 3 // Top vertical alignment
};
/** \details
Sets the tag string of this attribute.
\param sTag [in] Tag string.
*/
virtual void setTag(const OdString& sTag);
/** \details
Returns the tag string of this attribute.
\returns A OdString value of attribute tag.
*/
virtual const OdString getTag() const;
/** \details
Sets the horizontal mode of this attribute.
\param horizontalMode [in] Horizontal mode.
\remarks
horizontalMode must be one of the following:
Name Value Description
OdTvDwgBlockAttributeDefinitionData::kTextLeft 0 Left horizontal alignment
OdTvDwgBlockAttributeDefinitionData::kTextCenter 1 Center horizontal alignment
OdTvDwgBlockAttributeDefinitionData::kTextRight 2 Right horizontal alignment
OdTvDwgBlockAttributeDefinitionData::kTextAlign 3 Alignment to text by horizontal
OdTvDwgBlockAttributeDefinitionData::kTextMid 4 Alignment to middle by horizontal
OdTvDwgBlockAttributeDefinitionData::kTextFit 5 Alignment to fit by horizontal
*/
virtual void setHorizontalMode(OdTvDwgAttributeData::TextHorzMode horizontalMode);
/** \details
Returns the horizontal mode of this attribute.
\remarks
Returns one of the following:
Name Value Description
OdTvDwgBlockAttributeDefinitionData::kTextLeft 0 Left horizontal alignment
OdTvDwgBlockAttributeDefinitionData::kTextCenter 1 Center horizontal alignment
OdTvDwgBlockAttributeDefinitionData::kTextRight 2 Right horizontal alignment
OdTvDwgBlockAttributeDefinitionData::kTextAlign 3 Alignment to text by horizontal
OdTvDwgBlockAttributeDefinitionData::kTextMid 4 Alignment to middle by horizontal
OdTvDwgBlockAttributeDefinitionData::kTextFit 5 Alignment to fit by horizontal
*/
virtual OdTvDwgAttributeData::TextHorzMode getHorizontalMode() const;
/** \details
Sets the vertical mode of this attribute.
\param verticalMode [in] Vertical mode.
\remarks
verticalMode must be one of the following:
Name Value Description
OdTvDwgBlockAttributeDefinitionData::kTextBase 0 Base vertical alignment
OdTvDwgBlockAttributeDefinitionData::kTextBottom 1 Bottom vertical alignment
OdTvDwgBlockAttributeDefinitionData::kTextVertMid 2 Alignment to middle by vertical
OdTvDwgBlockAttributeDefinitionData::kTextTop 3 Top vertical alignment
*/
virtual void setVerticalMode(OdTvDwgAttributeData::TextVertMode verticalMode);
/** \details
Returns the vertical mode of this attribute.
\remarks
Returns one of the following:
Name Value Description
OdTvDwgBlockAttributeDefinitionData::kTextBase 0 Base vertical alignment
OdTvDwgBlockAttributeDefinitionData::kTextBottom 1 Bottom vertical alignment
OdTvDwgBlockAttributeDefinitionData::kTextVertMid 2 Alignment to middle by vertical
OdTvDwgBlockAttributeDefinitionData::kTextTop 3 Top vertical alignment
*/
virtual OdTvDwgAttributeData::TextVertMode getVerticalMode() const;
/** \details
Sets the text string of this attribute.
\param sTextString [in] Text string.
\remarks
sTextString cannot exceed 256 characters excluding the null terminator.
*/
virtual void setTextString(const OdString& sTextString);
/** \details
Returns the text string of this attribute.
\returns A OdString value of attribute text string.
*/
virtual OdString getTextString() const;
/** \details
Sets the height of text of this attribute.
\param dHeight [in] Text height.
*/
virtual void setHeight(double dHeight);
/** \details
Returns the height of this attribute.
\returns The height of this attribute.
*/
virtual double getHeight() const;
/** \details
Sets the position of this attribute.
\param position [in] Position.
*/
virtual void setPosition(const OdGePoint3d& position);
/** \details
Returns the position of this attribute.
\returns The position of this attribute.
*/
virtual OdGePoint3d getPosition() const;
/** \details
Applies the settings from the specified attribute definition to this Attribute entity.
\param pAttDef [in] Pointer to the attribute definition entity.
*/
virtual void setAttributeFromBlock(const OdTvDwgAttributeDefinitionDataPtr pAttDef);
/** \details
Creates a new block attribute definition object.
\returns A smart pointer to the created section geometry output object.
*/
static OdTvDwgAttributeDataPtr createObject();
protected:
/** \details
Default constructor for the OdTvDwgBlockAttributeDefintionData structure. Creates structure
with a set of properties initialized:
Name Value
m_sTag "" (blank)
m_horizontalMode TextHorzMode::kTextLeft
m_verticalMode TextVertMode::kTextBase
m_dHeight 1.0
m_sTextString "" (blank)
m_position OdTvPoint(0., 0., 0.);
*/
OdTvDwgAttributeData();
/** \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:
OdString m_sTag;
TextHorzMode m_horizontalMode;
TextVertMode m_verticalMode;
double m_dHeight;
OdString m_sTextString;
OdTvPoint m_position;
};
/** \details
The structure for storing the DWG-specific block attribute definition parameters that can be used during export.
Add this user data to OdTvBlock.
*/
class ODTV_EXPORT OdTvDwgAttributeDefinitionData : public OdTvDwgAttributeData
{
friend class OdTvDwgAttributesDataStorage;
public:
/** \details
Sets the prompt string of this attribute.
\param sPrompt [in] Prompt string
*/
virtual void setPrompt(const OdString& sPrompt);
/** \details
Returns the prompt string of this attribute.
\returns A OdString value of attribute definition prompt.
*/
virtual const OdString getPrompt() const;
/** \details
Creates a new block attribute definition object.
\returns A smart pointer to the created section geometry output object.
*/
static OdTvDwgAttributeDefinitionDataPtr createObject();
protected:
/** \details
Default constructor for the OdTvDwgBlockAttributeDefintionData structure. Creates structure
with a set of properties initialized:
*/
OdTvDwgAttributeDefinitionData();
/** \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:
OdString m_sPrompt;
};
#include "TD_PackPop.h"
#endif // _ODTV_EXPORTUSERDATA_H_INCLUDED_