2026-10-04 00:04:20 +08:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// 显示文件预览控件, 可参考ObjectARX2004安装目录下: Sample\BlockView文件
|
|
|
|
|
// 创建人: 黄荣平
|
2026-09-28 15:28:50 +08:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
#if !defined(AFX_GSPREVIEWCTRL_H__7DC11025_C827_11D2_B89C_080009DCA551__INCLUDED_)
|
|
|
|
|
#define AFX_GSPREVIEWCTRL_H__7DC11025_C827_11D2_B89C_080009DCA551__INCLUDED_
|
|
|
|
|
|
|
|
|
|
#if _MSC_VER > 1000
|
|
|
|
|
#pragma once
|
|
|
|
|
#endif // _MSC_VER > 1000
|
|
|
|
|
#include "acgi.h"
|
|
|
|
|
#include <math.h>
|
|
|
|
|
#include"gs.h "
|
|
|
|
|
#include"AcGsManager.h "
|
|
|
|
|
|
|
|
|
|
class CGsPreviewCtrl : public CStatic
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
// Overrides
|
|
|
|
|
// ClassWizard generated virtual function overrides
|
|
|
|
|
//{{AFX_VIRTUAL(CGsPreviewCtrl)
|
|
|
|
|
//}}AFX_VIRTUAL
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
CGsPreviewCtrl() : CStatic(),
|
|
|
|
|
mpManager(NULL), mpFactory(NULL), mpDevice(NULL), mpView(NULL),
|
|
|
|
|
mpModel(NULL),mbModelCreated(false),mbPanning(false),mbOrbiting(false)
|
|
|
|
|
{
|
|
|
|
|
m_bTracking=FALSE;
|
2026-10-04 00:04:20 +08:00
|
|
|
m_sDwgName="F:\\立面树.dwg";
|
|
|
|
|
m_sContent="未找到图块说明";
|
2026-09-28 15:28:50 +08:00
|
|
|
pDescDb=NULL;
|
|
|
|
|
mpModel=NULL;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CGsPreviewCtrl(CString sDwgName) : CStatic(),
|
|
|
|
|
mpManager(NULL), mpFactory(NULL), mpDevice(NULL), mpView(NULL),
|
|
|
|
|
mpModel(NULL),mbModelCreated(false),mbPanning(false),mbOrbiting(false)
|
|
|
|
|
{
|
|
|
|
|
m_sDwgName=sDwgName;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual ~CGsPreviewCtrl()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void init(HMODULE hRes, bool bCreateModel = true);
|
|
|
|
|
void erasePreview();
|
|
|
|
|
void ReleaseDb();
|
|
|
|
|
void clearAll();
|
|
|
|
|
void setBkGroundColor();
|
|
|
|
|
AcGsView* view() { return mpView; }
|
|
|
|
|
AcGsDevice* device() { return mpDevice; }
|
|
|
|
|
AcGsModel* model() { return mpModel; }
|
|
|
|
|
void setModel(AcGsModel* pModel);
|
|
|
|
|
void ViewBlock(CString sDwgName,CString sName);
|
|
|
|
|
void ViewDwg(CString sDwgName);
|
|
|
|
|
CString m_sDwgName;
|
|
|
|
|
AcDbObjectId m_RcdId;
|
|
|
|
|
AcDbObjectId m_BlfId;
|
|
|
|
|
CString m_sContent;
|
|
|
|
|
AcDbDatabase *pDescDb ;
|
|
|
|
|
BOOL m_bTracking;
|
|
|
|
|
BOOL Asdkaddblock(AcDbDatabase *&pDb ,AcGePoint3d &extMax,AcGePoint3d &extMin,CString sBlkName);
|
|
|
|
|
// Generated message map functions
|
|
|
|
|
protected:
|
|
|
|
|
//{{AFX_MSG(CGsPreviewCtrl)
|
|
|
|
|
afx_msg void OnPaint();
|
|
|
|
|
afx_msg void OnSize(UINT nType, int cx, int cy);
|
|
|
|
|
afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
|
|
|
|
|
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
|
|
|
|
afx_msg void OnMButtonDown(UINT nFlags, CPoint point);
|
|
|
|
|
afx_msg void OnMButtonUp(UINT nFlags, CPoint point);
|
|
|
|
|
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
|
|
|
|
|
afx_msg LRESULT OnNcHitTest(CPoint point);
|
|
|
|
|
afx_msg void OnSetFocus(CWnd* pOldWnd);
|
|
|
|
|
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
|
|
|
|
|
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
|
|
|
|
|
afx_msg void OnDestroy();
|
|
|
|
|
//}}AFX_MSG
|
|
|
|
|
|
|
|
|
|
DECLARE_MESSAGE_MAP()
|
|
|
|
|
public:
|
|
|
|
|
// LRESULT OnMouseLeave(WPARAM wParam, LPARAM lParam);
|
|
|
|
|
public:
|
|
|
|
|
AcGsView *mpView;
|
|
|
|
|
AcGsDevice *mpDevice;
|
|
|
|
|
private:
|
|
|
|
|
CBitmap m_Bitmap;
|
|
|
|
|
HCURSOR mhSavedCursor;
|
|
|
|
|
HCURSOR mhPanCursor;
|
|
|
|
|
HCURSOR mhCrossCursor;
|
|
|
|
|
HCURSOR mhOrbitCursor;
|
|
|
|
|
AcGsManager *mpManager;
|
|
|
|
|
#if (ARX > 19)
|
|
|
|
|
AcGsGraphicsKernel *mpFactory;
|
|
|
|
|
#else
|
|
|
|
|
AcGsClassFactory *mpFactory;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
AcGsModel *mpModel;
|
|
|
|
|
AcGsModel *mpGhostModel;
|
|
|
|
|
bool mbModelCreated;
|
|
|
|
|
bool mbPanning;
|
|
|
|
|
bool mbOrbiting;
|
|
|
|
|
CPoint mStartPt;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
//{{AFX_INSERT_LOCATION}}
|
|
|
|
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
|
|
|
|
|
|
|
|
|
#endif // !defined(AFX_GSPREVIEWCTRL_H__7DC11025_C827_11D2_B89C_080009DCA551__INCLUDED_)
|