#if !defined(__KTENTITYDRAGMGR_H__) #define __KTENTITYDRAGMGR_H__ #ifdef EARTHWORM_EXPORT #define DLLIMPEXP __declspec(dllexport) #else #define DLLIMPEXP __declspec(dllimport) #endif // Description: // 类CKTEntityDragMgr用于管理对实体的交换拖动变换等操作 // 使用时加入需要操作的实体 // Company: Kingtouch Software Corporation. Copyright 2002-2005 // Author: WangYongguang // Date: 2002.05.01 #include "KTEntityDumb.h" #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 class DLLIMPEXP CKTEntityDragMgr : public AcEdJig { public: // 默认构造函数 CKTEntityDragMgr(BOOL bAutoRelease = TRUE); // 构造函数, 加入拖动的实体 CKTEntityDragMgr(const AcGePoint3d& ptDrag, const AcDbObjectId& idEnt, BOOL bAutoRelease = TRUE); CKTEntityDragMgr(const AcGePoint3d& ptDrag, const AcDbObjectIdArray& aridEnts, BOOL bAutoRelease = TRUE); CKTEntityDragMgr(const AcGePoint3d& ptDrag, AcDbEntity* pEnt, BOOL bAutoRelease = FALSE); CKTEntityDragMgr(const AcGePoint3d& ptDrag, const AcDbVoidPtrArray& arpEnts, BOOL bAutoRelease = FALSE); // 判断是否自动close/delete管理的实体 BOOL IsAutoRelease(); // 设置自动close/delete标志 void EnableAutoRelease(BOOL bEnable = TRUE); // 取得哑元对象 CKTEntityDumb& GetDumbEntity(); // 添加拖动对象 BOOL Add(AcDbEntity* pEnt); BOOL Add(const AcDbObjectId& idEnt); // 取得所有拖动对象 AcDbVoidPtrArray* GetAll(); // 设置拖动点 void SetDragPoint(const AcGePoint3d& pt, BOOL bMoveEnt = FALSE); void TransformBy(const AcGeMatrix3d& mat); // 取得拖动点 AcGePoint3d GetDragPoint(); // 取得拖动值 double GetDragValue(); // 设置移动标志,和移动时的提示 void EnableMove(BOOL bEnable, LPCTSTR pszPrompt = NULL/*, const AcGePoint3d& pt = AcGePoint3d::kOrigin, BOOL bMoveEnt = FALSE*/); // 设置缩放标志,和缩放时的提示 void EnableScale(BOOL bEnable, LPCTSTR pszPrompt = NULL, double dScale = 1.0); // 设置旋转标志,和旋转时的提示 void EnableRotate(BOOL bEnable, LPCTSTR pszPrompt = NULL, double dAngle = 0.0); // 移除数据, 不处理 BOOL Remove(); // 移除数据, 处理, 是否调用erase(对在数据库中的) BOOL Release(BOOL bErase = FALSE); // 加入当前数据库 BOOL append(); BOOL append(AcDbObjectIdArray& aridEnts); // 开始拖动操作 BOOL DoDrag(); public: double m_dInitAngle; double m_dLastVal; protected: // overridden methods from AcEdJig class virtual AcDbEntity* entity() const; virtual DragStatus sampler(); virtual Adesk::Boolean update(); DragStatus drag(); CKTEntityDumb m_DumbEntity; AcGeMatrix3d m_matTrans; AcGeMatrix3d m_matMoveTrans; AcGeMatrix3d m_matScaleTrans; AcGeMatrix3d m_matRotateTrans; AcGePoint3d m_ptDrag; double m_dInitScale; int m_iDragStep; BOOL m_bMove; BOOL m_bScale; BOOL m_bRotate; CString m_sMove; CString m_sScale; CString m_sRotate; private: AcEdJig::DragStatus m_iStatus; }; #endif // !defined(__KTENTITYDRAGMGR_H__)