229 lines
4.8 KiB
C++
229 lines
4.8 KiB
C++
#if !defined(__KTADSENTITY_H__)
|
|
#define __KTADSENTITY_H__
|
|
|
|
// Description:
|
|
// 类CKTAdsEntity用于管理由ads_name表示的实体对象, 用于代替ads_name的使用,
|
|
// 它支持AcDbObjectId.
|
|
// 用法同ads_name做实体对象使用时相同
|
|
// Company: Kingtouch Software Corporation. Copyright 2002-2005
|
|
// Author: WangYongguang
|
|
// Date: 2002.05.01
|
|
|
|
|
|
#if _MSC_VER > 1000
|
|
#pragma once
|
|
#endif // _MSC_VER > 1000
|
|
|
|
#if ARX > 20
|
|
#ifndef _WIN64
|
|
typedef int32_t* ADS_NAME;
|
|
#else
|
|
typedef int64_t* ADS_NAME;
|
|
#endif
|
|
#else
|
|
#ifndef _WIN64
|
|
typedef long* ADS_NAME;
|
|
#else
|
|
typedef __int64* ADS_NAME;
|
|
#endif
|
|
#endif
|
|
|
|
#ifdef EARTHWORM_EXPORT
|
|
#define DLLIMPEXP __declspec(dllexport)
|
|
#else
|
|
#define DLLIMPEXP __declspec(dllimport)
|
|
#endif
|
|
|
|
class DLLIMPEXP CKTAdsEntity
|
|
{
|
|
public:
|
|
// 默认构造函数
|
|
CKTAdsEntity();
|
|
// 构造函数,拷贝构造
|
|
CKTAdsEntity(const CKTAdsEntity& cEnt);
|
|
// 构造函数,传入ID
|
|
CKTAdsEntity(const AcDbObjectId& idEnt);
|
|
// 构造函数,传入handle
|
|
CKTAdsEntity(const AcDbHandle& handle);
|
|
// 构造函数,传入ads_name
|
|
CKTAdsEntity(const ads_name adsName);
|
|
// 析构函数
|
|
virtual ~CKTAdsEntity();
|
|
|
|
// 从旧的ID方式获得ads_name
|
|
#ifdef _WIN64
|
|
CKTAdsEntity& SetFromOldId(__int64 lOldId);
|
|
#else
|
|
CKTAdsEntity& SetFromOldId(long lOldId);
|
|
#endif
|
|
|
|
|
|
// 从Handle字符串方式获得ads_name
|
|
CKTAdsEntity& SetFromHandle(LPCTSTR pszHandle);
|
|
// 获取旧的ID值
|
|
Adesk::IntDbId AsOldId() const;
|
|
// 获取ads_name
|
|
ADS_NAME AsAdsName();
|
|
ADS_NAME AsAdsName() const;
|
|
|
|
// 取得ads_name
|
|
void GetAdsName(ads_name adsName) const;
|
|
// 取得AcDbObjectId
|
|
void GetObjectId(AcDbObjectId& idEnt) const;
|
|
|
|
// 获得与之关联的Handle
|
|
AcDbHandle Handle() const;
|
|
|
|
// 判断是否有效
|
|
bool IsValid() const;
|
|
// 判断是否被删除
|
|
bool IsErased() const;
|
|
|
|
// 设置高亮显示
|
|
void Highlight(BOOL bHighlight = TRUE, BOOL bUpdate = TRUE);
|
|
// 设置夹点显示
|
|
void Griplight(BOOL bGriplight = TRUE, BOOL bUpdate = TRUE);
|
|
|
|
// 重载运算符号=
|
|
CKTAdsEntity& operator=(const CKTAdsEntity& adsEnt);
|
|
CKTAdsEntity& operator=(const AcDbObjectId& idEnt);
|
|
CKTAdsEntity& operator=(const AcDbHandle& handle);
|
|
CKTAdsEntity& operator=(const ads_name adsName);
|
|
CKTAdsEntity& operator=(int iNull);
|
|
|
|
// 重载运算符号
|
|
operator AcDbObjectId();
|
|
operator AcDbHandle();
|
|
operator ADS_NAME();
|
|
|
|
// 重载运算符号&
|
|
ADS_NAME operator&();
|
|
ADS_NAME operator&() const;
|
|
|
|
// 重载运算符号bool
|
|
operator bool() const;
|
|
// 重载运算符号==
|
|
bool operator==(const CKTAdsEntity& adsEnt) const;
|
|
bool operator==(const AcDbObjectId& idEnt) const;
|
|
bool operator==(const AcDbHandle& handle) const;
|
|
bool operator==(const ads_name adsName) const;
|
|
bool operator==(int iNull) const;
|
|
// 重载运算符号!=
|
|
bool operator!=(const CKTAdsEntity& adsEnt) const;
|
|
bool operator!=(const AcDbObjectId& idEnt) const;
|
|
bool operator!=(const AcDbHandle& handle) const;
|
|
bool operator!=(const ads_name adsName) const;
|
|
bool operator!=(int iNull) const;
|
|
|
|
protected:
|
|
ads_name m_adsName;
|
|
// 放在m_adsName之后,符合CopyMemory内存顺序
|
|
BOOL m_bHighlight;
|
|
BOOL m_bGriplight;
|
|
};
|
|
|
|
// 重载运算符号==
|
|
inline bool operator==(const AcDbObjectId& idEnt, const CKTAdsEntity& adsEnt)
|
|
{
|
|
return (adsEnt == idEnt);
|
|
}
|
|
|
|
inline bool operator==(const AcDbHandle& handle, const CKTAdsEntity& adsEnt)
|
|
{
|
|
return (adsEnt == handle);
|
|
}
|
|
|
|
inline bool operator==(const ads_name adsName, const CKTAdsEntity& adsEnt)
|
|
{
|
|
return (adsEnt == adsName);
|
|
}
|
|
|
|
inline bool operator==(int iNull, const CKTAdsEntity& adsEnt)
|
|
{
|
|
return (adsEnt == iNull);
|
|
}
|
|
|
|
// 重载运算符号!=
|
|
inline bool operator!=(const AcDbObjectId& idEnt, const CKTAdsEntity& adsEnt)
|
|
{
|
|
return (adsEnt != idEnt);
|
|
}
|
|
|
|
inline bool operator!=(const AcDbHandle& handle, const CKTAdsEntity& adsEnt)
|
|
{
|
|
return (adsEnt != handle);
|
|
}
|
|
|
|
inline bool operator!=(const ads_name adsName, const CKTAdsEntity& adsEnt)
|
|
{
|
|
return (adsEnt != adsName);
|
|
}
|
|
|
|
inline bool operator!=(int iNull, const CKTAdsEntity& adsEnt)
|
|
{
|
|
return (adsEnt != iNull);
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////
|
|
|
|
// 获取ads_name
|
|
inline ADS_NAME CKTAdsEntity::AsAdsName()
|
|
{
|
|
return m_adsName;
|
|
}
|
|
|
|
inline ADS_NAME CKTAdsEntity::AsAdsName() const
|
|
{
|
|
return (ADS_NAME)m_adsName;
|
|
}
|
|
|
|
inline CKTAdsEntity::operator ADS_NAME()
|
|
{
|
|
return m_adsName;
|
|
}
|
|
|
|
// 重载运算符号&
|
|
inline ADS_NAME CKTAdsEntity::operator&()
|
|
{
|
|
return m_adsName;
|
|
}
|
|
|
|
inline ADS_NAME CKTAdsEntity::operator&() const
|
|
{
|
|
return (ADS_NAME)m_adsName;
|
|
}
|
|
|
|
// 重载运算符号bool
|
|
inline CKTAdsEntity::operator bool() const
|
|
{
|
|
return IsValid();
|
|
}
|
|
|
|
// 重载运算符号!=
|
|
inline bool CKTAdsEntity::operator!=(const CKTAdsEntity& adsEnt) const
|
|
{
|
|
return !(operator==(adsEnt));
|
|
}
|
|
|
|
inline bool CKTAdsEntity::operator!=(const AcDbObjectId& idEnt) const
|
|
{
|
|
return !(operator==(idEnt));
|
|
}
|
|
|
|
inline bool CKTAdsEntity::operator!=(const AcDbHandle& handle) const
|
|
{
|
|
return !(operator==(handle));
|
|
}
|
|
|
|
inline bool CKTAdsEntity::operator!=(const ads_name adsName) const
|
|
{
|
|
return !(operator==(adsName));
|
|
}
|
|
|
|
inline bool CKTAdsEntity::operator!=(int iNull) const
|
|
{
|
|
return !(operator==(iNull));
|
|
}
|
|
|
|
#endif // __KTADSENTITY_H__
|