130 lines
3.6 KiB
C++
130 lines
3.6 KiB
C++
#if !defined(AFX_BLKRECSPREVIEWCTRL_H__7BE1538E_7635_4FAA_BB6E_48D00E0A24EF__INCLUDED_)
|
|
#define AFX_BLKRECSPREVIEWCTRL_H__7BE1538E_7635_4FAA_BB6E_48D00E0A24EF__INCLUDED_
|
|
|
|
#if _MSC_VER > 1000
|
|
#pragma once
|
|
#endif
|
|
|
|
#include "acgi.h"
|
|
|
|
#ifdef EARTHWORM_EXPORT
|
|
#define DLLIMPEXP __declspec(dllexport)
|
|
#else
|
|
#define DLLIMPEXP __declspec(dllimport)
|
|
#endif
|
|
|
|
class CGsPreviewCtrlEx;
|
|
class DLLIMPEXP CBlkRecsPreviewCtrlEx: public CWnd
|
|
{
|
|
public:
|
|
CBlkRecsPreviewCtrlEx();
|
|
virtual ~CBlkRecsPreviewCtrlEx();
|
|
|
|
public:
|
|
|
|
BOOL Create(const RECT& rect, CWnd* pParentWnd, UINT nID = 0xffff);
|
|
|
|
void SetLogFont(LOGFONT* plf);
|
|
|
|
// 初始化 nCount 为Add方法使用
|
|
BOOL Init(HMODULE hRes,int nRows,int nCols,int nCount = -1,AcDbDatabase* pDb = NULL,bool b3D = true);
|
|
|
|
// 擦除视口 -1 : ALL
|
|
void Clear(int nIndex = -1);
|
|
|
|
// 添加实体到view
|
|
BOOL Add(AcDbEntity* pEnt,int nIndex,AcDbExtents* pExtAll = NULL);
|
|
|
|
BOOL Add(AcDbEntity* pEnt,int nIndex,LPCTSTR pszName,AcDbExtents* pExtAll = NULL);
|
|
|
|
BOOL Add(LPCTSTR pszDwgFile,LPCTSTR pszName);
|
|
|
|
BOOL Add(LPCTSTR pszDwgFile,LPCTSTR pszShowRc,LPCTSTR pszName,bool bIs3D = true);
|
|
|
|
BOOL PreviewWinDoor(LPCTSTR pszDwgFile,LPCTSTR pszShowRc,LPCTSTR pszName,bool bIsDoor = false,bool bIs3D = true);
|
|
|
|
BOOL Add(AcDbDatabase* pDb,LPCTSTR pszName);
|
|
|
|
// 预览db的特定以 特定字符串 开头的块
|
|
BOOL PreViewNamedRecs(LPCTSTR pszDwgFile,LPCTSTR pszHead = NULL);
|
|
|
|
// 获取选择的索引 rec 名称
|
|
BOOL GetCurSelRec(CString& sRecName);
|
|
|
|
// 获取选择的索引 rec 名称
|
|
BOOL GetCurSelRec(CString& sDwgFile,CString& sRecName);
|
|
|
|
//设置选择当前
|
|
BOOL SetCurSelRec(CString &sDwgFile, CString &sRecName);
|
|
|
|
// 获取选择的索引
|
|
int GetCurSelIndex();
|
|
|
|
void Redraw(AcDbExtents* pExtAll = NULL,int nGsViewIndex = -1);
|
|
|
|
void ZoomExtent(AcGsView* pView,AcDbExtents* pExtAll);
|
|
|
|
void ZoomExtent(int nGsViewIndex,AcDbExtents* pExtAll);
|
|
|
|
protected:
|
|
afx_msg void OnPaint();
|
|
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
|
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
|
|
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
|
|
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
|
|
afx_msg void OnSize(UINT nType, int cx, int cy);
|
|
afx_msg void OnDestroy();
|
|
afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
|
|
DECLARE_MESSAGE_MAP()
|
|
|
|
protected:
|
|
|
|
// 销毁所有的gs对象
|
|
void DestroyAll();
|
|
|
|
// 计算或画单元
|
|
void DrawGridCell(CDC* pDC,CArray<CRect,CRect>& arCells);
|
|
|
|
int HitViewCell(CPoint point);
|
|
|
|
void SetShowViewPort(CDC* pDC,CArray<CRect,CRect>& arCells);
|
|
|
|
void DrawCurselCell(CDC* pDC);
|
|
|
|
//nIndex 为 DC 的坐标的 cell 索引
|
|
CRect GetCellIndexRect(int nIndex);
|
|
|
|
bool GetActiveViewPortInfo (AcDbDatabase *pDb, ads_real &height, ads_real &width, AcGePoint3d &target, AcGeVector3d &viewDir, ads_real &viewTwist, bool getViewCenter);
|
|
|
|
Acad::ErrorStatus InitDrawingControl (CGsPreviewCtrlEx* pPreViewCtrl,AcDbDatabase *pDb, const TCHAR *space = ACDB_MODEL_SPACE,bool b3D = true);
|
|
Acad::ErrorStatus InitDrawingControlWinDoor(CGsPreviewCtrlEx* pPreViewCtrl,AcDbDatabase *pDb, LPCTSTR space,bool bIsDoor = false,bool b3D = true);
|
|
|
|
void SetViewTo(AcGsView *pView, AcDbDatabase *pDb, AcGeMatrix3d& viewMat,bool b3D = true);
|
|
|
|
void RefreshView(AcGsView *pView);
|
|
|
|
protected:
|
|
|
|
CPtrArray m_arPreViewCtrls;
|
|
CStringArray m_arDwgFiles;
|
|
CStringArray m_arRecNames;
|
|
CPtrArray m_arDbPtrs;
|
|
|
|
int m_nRows;
|
|
int m_nCols;
|
|
int m_nCurSel;
|
|
int m_nIDAdd;
|
|
static int s_nSpace;
|
|
|
|
BOOL m_bInit;
|
|
HMODULE m_hRes;
|
|
LOGFONT m_lfFont;
|
|
BOOL m_bLfFont;
|
|
CMapPtrToWord m_mapViewCtrl2Pt;
|
|
CMapStringToString m_mapEntPtr2Name;
|
|
CMapStringToPtr m_mapDwgFile2Db;
|
|
};
|
|
|
|
//{{AFX_INSERT_LOCATION}}
|
|
#endif //_BLKRECSPREVIEWCTRL_H__
|