314 lines
7.3 KiB
C++
314 lines
7.3 KiB
C++
#if !defined(__KTADSPICKSET_H__)
|
|
#define __KTADSPICKSET_H__
|
|
|
|
// Description:
|
|
// 类CKTAdsPickSet用于管理由ads_name表示的选择集, 用于代替ads_name的使用,
|
|
// 它支持AcDbObjectIdArray.
|
|
// 用法同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_SSNAME;
|
|
#else
|
|
typedef int64_t* ADS_SSNAME;
|
|
#endif
|
|
#else
|
|
#ifndef _WIN64
|
|
typedef long* ADS_SSNAME;
|
|
#else
|
|
typedef __int64* ADS_SSNAME;
|
|
#endif
|
|
#endif
|
|
|
|
#include "KTAdsEntity.h"
|
|
|
|
#ifdef EARTHWORM_EXPORT
|
|
#define DLLIMPEXP __declspec(dllexport)
|
|
#else
|
|
#define DLLIMPEXP __declspec(dllimport)
|
|
#endif
|
|
|
|
class DLLIMPEXP CKTAdsPickSet
|
|
{
|
|
public:
|
|
// 默认构造函数
|
|
CKTAdsPickSet();
|
|
// 构造函数
|
|
CKTAdsPickSet(const CKTAdsPickSet& ssEnt);
|
|
// 构造函数
|
|
CKTAdsPickSet(const ads_name ssName);
|
|
// 构造函数
|
|
CKTAdsPickSet(const AcDbObjectIdArray& aridSet);
|
|
// 析构函数
|
|
virtual ~CKTAdsPickSet();
|
|
|
|
// 开始记录实体创建
|
|
BOOL PickStart();
|
|
// 结束记录实体创建
|
|
int PickEnd();
|
|
|
|
// 取得ObjectIdArray
|
|
void GetObjectIdArray(AcDbObjectIdArray& aridSet) const;
|
|
|
|
// 取得指定位置的实体
|
|
BOOL GetAt(int i, ads_name adsEnt) const;
|
|
BOOL GetAt(int i, AcDbObjectId& idEnt) const;
|
|
|
|
// 删除选择集
|
|
void RemoveAll();
|
|
// 添加实体或选择集
|
|
CKTAdsPickSet& Add(const CKTAdsPickSet& ssEnt);
|
|
CKTAdsPickSet& Add(const AcDbObjectId& idEnt);
|
|
CKTAdsPickSet& Add(const AcDbObjectIdArray& aridEnts);
|
|
// 可以添加实体adsEnt, 也可以添加选择集ssEnt
|
|
CKTAdsPickSet& Add(const ads_name adsEnt, const ads_name ssEnt = NULL);
|
|
// 删除实体或选择集合
|
|
CKTAdsPickSet& Delete(const CKTAdsPickSet& ssEnt);
|
|
CKTAdsPickSet& Delete(const AcDbObjectId& idEnt);
|
|
CKTAdsPickSet& Delete(const AcDbObjectIdArray& aridEnts);
|
|
// 可以删除实体adsEnt, 也可以删除选择集ssEnt
|
|
CKTAdsPickSet& Delete(const ads_name adsEnt, const ads_name ssEnt = NULL);
|
|
|
|
// 取得实体个数
|
|
long GetCount() const;
|
|
|
|
// 判断是否为空
|
|
BOOL IsEmpty() const;
|
|
// 判断实体是否在选择集内
|
|
BOOL IsInPickSet(const ads_name adsEnt) const;
|
|
BOOL IsInPickSet(const AcDbObjectId& idEnt) const;
|
|
BOOL IsInPickSet(const CKTAdsEntity& adsEnt) const;
|
|
|
|
// 设置高亮显示
|
|
void Highlight(BOOL bHighlight = TRUE, BOOL bUpdate = TRUE);
|
|
// 设置夹点显示
|
|
void Griplight(BOOL bGriplight = TRUE, BOOL bUpdate = TRUE);
|
|
|
|
// 去除重复的实体
|
|
void Distinct();
|
|
|
|
// 返回ads_ssname
|
|
ADS_SSNAME AsAdsName();
|
|
ADS_SSNAME AsAdsName() const;
|
|
|
|
// 功能同acedSSNameX
|
|
int SSNameX(struct resbuf ** rbpp, const long i);
|
|
// 功能同acedSSNameXEx
|
|
int SSNameXEx(struct resbuf ** rbpp, const long i, unsigned int flags = 0);
|
|
// 功能同acedXformSS
|
|
int XformSS(ads_matrix matrix);
|
|
|
|
// 重载操作符
|
|
operator ADS_SSNAME();
|
|
operator AcDbObjectIdArray();
|
|
|
|
AcDbObjectId operator[](int iIndex);
|
|
|
|
// 重载操作符
|
|
ADS_SSNAME operator&();
|
|
ADS_SSNAME operator&() const;
|
|
|
|
// 赋值
|
|
CKTAdsPickSet& operator=(const CKTAdsPickSet& ssEnt);
|
|
CKTAdsPickSet& operator=(const ads_name ssEnt);
|
|
|
|
// 集合添加与删除
|
|
CKTAdsPickSet& operator+=(const CKTAdsPickSet& ssEnt);
|
|
CKTAdsPickSet& operator+=(const AcDbObjectIdArray& aridEnts);
|
|
CKTAdsPickSet& operator+=(const ads_name ssEnt);
|
|
CKTAdsPickSet& operator+=(const AcDbObjectId& idEnt);
|
|
// ads_name型的单个实体,先转化成CKTAdsEntity,以免和选择集的ads_name混淆
|
|
CKTAdsPickSet& operator+=(CKTAdsEntity& cEnt);
|
|
CKTAdsPickSet& operator-=(const CKTAdsPickSet& ssEnt);
|
|
CKTAdsPickSet& operator-=(const AcDbObjectIdArray& aridEnts);
|
|
CKTAdsPickSet& operator-=(const ads_name ssEnt);
|
|
CKTAdsPickSet& operator-=(const AcDbObjectId& idEnt);
|
|
// ads_name型的单个实体,先转化成CKTAdsEntity,以免和选择集的ads_name混淆
|
|
CKTAdsPickSet& operator-=(CKTAdsEntity& cEnt);
|
|
|
|
// 操作符重载==
|
|
BOOL operator==(const CKTAdsPickSet& ssEnt) const;
|
|
BOOL operator==(const ads_name ssEnt) const;
|
|
|
|
// 操作符重载!=
|
|
BOOL operator!=(const CKTAdsPickSet& ssEnt) const;
|
|
BOOL operator!=(const ads_name ssEnt) const;
|
|
|
|
protected:
|
|
ads_name m_ssName;
|
|
// 放在m_ssName之后,符合CopyMemory内存顺序
|
|
ads_name m_entMark;
|
|
BOOL m_bHighlight;
|
|
BOOL m_bGriplight;
|
|
};
|
|
|
|
// 操作符重载==
|
|
inline BOOL operator==(const ads_name ssSet, const CKTAdsPickSet& ssEnt)
|
|
{
|
|
return (ssEnt == ssSet);
|
|
}
|
|
|
|
// 操作符重载!=
|
|
inline BOOL operator!=(const ads_name ssSet, const CKTAdsPickSet& ssEnt)
|
|
{
|
|
return (ssEnt != ssSet);
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////////
|
|
|
|
// 取得实体个数
|
|
inline long CKTAdsPickSet::GetCount() const
|
|
{
|
|
Adesk::Int32 lLen = 0;
|
|
acedSSLength(m_ssName, &lLen);
|
|
return lLen;
|
|
}
|
|
|
|
// 判断是否为空
|
|
inline BOOL CKTAdsPickSet::IsEmpty() const
|
|
{
|
|
Adesk::Int32 lLen = 0;
|
|
acedSSLength(m_ssName, &lLen);
|
|
|
|
|
|
return (lLen == 0l) ? true : false;
|
|
}
|
|
|
|
// 判断实体是否在选择集内
|
|
inline BOOL CKTAdsPickSet::IsInPickSet(const ads_name adsEnt) const
|
|
{
|
|
return (acedSSMemb(adsEnt, m_ssName) == RTNORM);
|
|
}
|
|
|
|
inline BOOL CKTAdsPickSet::IsInPickSet(const CKTAdsEntity& adsEnt) const
|
|
{
|
|
return (acedSSMemb(&adsEnt, m_ssName) == RTNORM);
|
|
}
|
|
|
|
inline ADS_SSNAME CKTAdsPickSet::AsAdsName()
|
|
{
|
|
return m_ssName;
|
|
}
|
|
|
|
inline ADS_SSNAME CKTAdsPickSet::AsAdsName() const
|
|
{
|
|
return (ADS_SSNAME)m_ssName;
|
|
}
|
|
|
|
// 功能同acedSSNameX
|
|
inline int CKTAdsPickSet::SSNameX(struct resbuf ** rbpp, const long i)
|
|
{
|
|
return acedSSNameX(rbpp, m_ssName, i);
|
|
}
|
|
|
|
// 功能同acedSSNameXEx
|
|
inline int CKTAdsPickSet::SSNameXEx(struct resbuf ** rbpp, const long i, unsigned int flags)
|
|
{
|
|
return acedSSNameXEx(rbpp, m_ssName, i, flags);
|
|
}
|
|
|
|
// 功能同acedXformSS
|
|
inline int CKTAdsPickSet::XformSS(ads_matrix matrix)
|
|
{
|
|
return acedXformSS(m_ssName, matrix);
|
|
}
|
|
|
|
// 重载操作符
|
|
inline CKTAdsPickSet::operator ADS_SSNAME()
|
|
{
|
|
return m_ssName;
|
|
}
|
|
|
|
inline AcDbObjectId CKTAdsPickSet::operator[](int i)
|
|
{
|
|
ads_name adsName;
|
|
AcDbObjectId idEnt;
|
|
if (acedSSName(m_ssName, i, adsName) == RTNORM)
|
|
acdbGetObjectId(idEnt, adsName);
|
|
return idEnt;
|
|
}
|
|
|
|
inline ADS_SSNAME CKTAdsPickSet::operator&()
|
|
{
|
|
return m_ssName;
|
|
}
|
|
|
|
inline ADS_SSNAME CKTAdsPickSet::operator&() const
|
|
{
|
|
return (ADS_SSNAME)m_ssName;
|
|
}
|
|
|
|
// 集合添加与删除
|
|
inline CKTAdsPickSet& CKTAdsPickSet::operator+=(const CKTAdsPickSet& ssEnt)
|
|
{
|
|
return Add(ssEnt);
|
|
}
|
|
|
|
inline CKTAdsPickSet& CKTAdsPickSet::operator+=(const AcDbObjectIdArray& aridEnts)
|
|
{
|
|
return Add(aridEnts);
|
|
}
|
|
|
|
inline CKTAdsPickSet& CKTAdsPickSet::operator+=(const ads_name ssEnt)
|
|
{
|
|
return Add(NULL, ssEnt);
|
|
}
|
|
|
|
inline CKTAdsPickSet& CKTAdsPickSet::operator+=(const AcDbObjectId& idEnt)
|
|
{
|
|
return Add(idEnt);
|
|
}
|
|
|
|
// ads_name型的单个实体,先转化成CKTAdsEntity,以免和选择集的ads_name混淆
|
|
inline CKTAdsPickSet& CKTAdsPickSet::operator+=(CKTAdsEntity& cEnt)
|
|
{
|
|
return Add(cEnt, NULL);
|
|
}
|
|
|
|
inline CKTAdsPickSet& CKTAdsPickSet::operator-=(const CKTAdsPickSet& ssEnt)
|
|
{
|
|
return Delete(ssEnt);
|
|
}
|
|
|
|
inline CKTAdsPickSet& CKTAdsPickSet::operator-=(const AcDbObjectIdArray& aridEnts)
|
|
{
|
|
return Delete(aridEnts);
|
|
}
|
|
|
|
inline CKTAdsPickSet& CKTAdsPickSet::operator-=(const ads_name ssEnt)
|
|
{
|
|
return Delete(NULL, ssEnt);
|
|
}
|
|
|
|
inline CKTAdsPickSet& CKTAdsPickSet::operator-=(const AcDbObjectId& idEnt)
|
|
{
|
|
return Delete(idEnt);
|
|
}
|
|
|
|
// ads_name型的单个实体,先转化成CKTAdsEntity,以免和选择集的ads_name混淆
|
|
inline CKTAdsPickSet& CKTAdsPickSet::operator-=(CKTAdsEntity& cEnt)
|
|
{
|
|
return Delete(cEnt, NULL);
|
|
}
|
|
|
|
// 操作符重载!=
|
|
inline BOOL CKTAdsPickSet::operator!=(const CKTAdsPickSet& ssEnt) const
|
|
{
|
|
return !(operator==(ssEnt));
|
|
}
|
|
|
|
inline BOOL CKTAdsPickSet::operator!=(const ads_name ssEnt) const
|
|
{
|
|
return !(operator==(ssEnt));
|
|
}
|
|
|
|
#endif // !defined(__KTADSPICKSET_H__)
|