www.pudn.com > VC++-develop-GIS.rar > drawView.h


// DrawView.h : interface of the CDrawView class 
// 
///////////////////////////////////////////////////////////////////////////// 
 
#if !defined(AFX_DrawVIEW_H__0EFFC630_8953_11D2_AE7B_444553540000__INCLUDED_) 
#define AFX_DrawVIEW_H__0EFFC630_8953_11D2_AE7B_444553540000__INCLUDED_ 
 
#if _MSC_VER >= 1000 
#pragma once 
#endif // _MSC_VER >= 1000 
 
class CDrawCntrItem; 
class CText; 
class TextWriteDlg; 
 
 
class CDrawView : public CView 
{ 
protected: // create from serialization only 
	CDrawView(); 
	DECLARE_DYNCREATE(CDrawView) 
 
protected: 
    float xLeft,xRight,yTop,yBottom,xPage,yPage,xWide,yHigh; 
    int   nPageX,nPageY; 
	int m_MapMode; 
	int m_hScreen1,m_wScreen1;	//当前视图的高度和宽度 
	CWinThread* m_PDrawThread; 
	int nHScrollMax,nHScrollPos,nVScrollMax,nVScrollPos; 
	int nXPage,nXLine,nYPage,nYLine,nScrollMin; 
	float m_xStart,m_yStart,blc; //绘制图形时的起点坐标和比例尺 
	int m_hScreen,m_wScreen;	//当前视图的高度和宽度 
//	int m_CurrentScreen;		//当前屏幕的序号 
//	int m_MaxScreen;			//最多能够有的屏幕数 
	int m_DrawCurrent;			//当前正进行操作的序号 
	int PushNumb;				//记录按下鼠标的次数 
	ScreenStruct* p_Screen;		//记录屏幕参数的结构指针 
	PointStruct *PointXyz;		//记录连续直线顶点坐标的数组指针 
	CPoint mPointOrign,mPointOrign1,mPointOld;//记录鼠标移动时的鼠标点顶坐标 
	short m_pColor;		//当前画笔颜色的序号 
	short m_bColor;		//当前底色的序号 
	short m_brColor;	//当前画刷颜色的序号 
	short m_LineWide;	//当前直线宽度(像素) 
	short m_LineType;	//当前线型 
	short m_Layer;		//当前层 
	BOOL b_RunFirst;			//是否第一次运行 
	BOOL DrawArcYes;			 
	//用来存储圆或圆弧的参数 
	float m_CircleX,m_CircleY,m_CircleR,m_Angle1,m_Angle2; 
	//用来存储标注文字的参数 
	float m_FontHeight,m_FontWide,m_FontBetween,m_TextAngle,m_FontAngle; 
	float m_TextX,m_TextY; 
	CString m_TextString;	//存储标注的文字 
	// Attributes 
	CText *m_Text1;			//声明一个文字类 
	CArc m_Arc1;	//声明一个圆弧类指针 
	GraphSelectStruct GraphUndo[4];	//声明一个存储恢复信息的数组 
	void InitVScroll();  //设定纵向滚动条 
	void InitHScroll();  //设定横向滚动条 
public: 
	CLinkDataSet* m_pLinkSet; 
	TextWriteDlg *pTextDlg;		//标注文字的对话框的指针 
	CDrawDoc* GetDocument();	//得到文档类的指针 
	// TODO: replace this selection mechanism with one appropriate to your app. 
	CDrawCntrItem* m_pSelection; 
public: 
	void PutTracker(CDrawCntrItem* pItem,CRectTracker* pTracker); 
	void DPtoVP(float x,float y,int *X,int *Y); 
	void VPtoDP(int x,int y,float *X,float *Y); 
	int DLtoVL(float l); 
	float VLtoDL(int l); 
protected: 
	void DrawBack(CDC* pDC);	//用底色绘制屏幕 
	BOOL jsarc(CPoint p1,CPoint p2,CPoint p3,float *CircleX,float *CircleY, 
			float *CircleR,float *Angle1,float *Angle2);//由三个点计算圆弧参数 
	void Delete(CDC* pDC,int Lb,int Index);	//删除图形操作 
	BOOL RectCross(float *x1,float *y1,float *x2,float *y2,float xx1, 
		float yy1,float xx2,float yy2);		//计算两个矩形的交面 
	void ReDrawRect(float X1,float Y1,float X2,float Y2); //重新绘制视图的区域 
	// Operations 
public: 
//	UINT Draw(CDC *pDC); 
 
// Overrides 
	// ClassWizard generated virtual function overrides 
	//{{AFX_VIRTUAL(CDrawView) 
	public: 
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view 
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs); 
	virtual void OnPrepareDC(CDC* pDC, CPrintInfo* pInfo = NULL); 
	protected: 
	virtual void OnInitialUpdate(); // called first time after construct 
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo); 
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo); 
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo); 
	virtual BOOL IsSelected(const CObject* pDocItem) const;// Container support 
	virtual void OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView); 
	virtual void OnPrint(CDC* pDC, CPrintInfo* pInfo); 
	//}}AFX_VIRTUAL 
 
// Implementation 
public: 
	LPVOID bmpdata; 
	HPALETTE hpal; 
	HBITMAP bhm_ddb; 
	int nPalate; 
	void DrawBmp1(CDC* pDC,int x,int y,int wide,int high,UINT idCBitmap,int DrawMode); 
	void DrawBmp2(CDC* pDC,int x,int y,int wide,int high,char *fName,int DrawMode); 
	void DrawBmp3(CDC* pDC,int x,int y,int wide,int high,char *fName,int DrawMode); 
	void DIBtoDDB(HDC hdc); 
	void make_palette(); 
 
	virtual ~CDrawView(); 
#ifdef _DEBUG 
	virtual void AssertValid() const; 
	virtual void Dump(CDumpContext& dc) const; 
#endif 
 
protected: 
 
// Generated message map functions 
protected: 
	//{{AFX_MSG(CDrawView) 
	afx_msg void OnDestroy(); 
	afx_msg void OnSetFocus(CWnd* pOldWnd); 
	afx_msg void OnSize(UINT nType, int cx, int cy);//视图大小改变时调用	 
	afx_msg void OnInsertObject();	 
	afx_msg void OnCancelEditCntr(); 
	afx_msg void OnDrawArc();		//绘制圆弧 
	afx_msg void OnDrawCircle();	//绘制圆 
	afx_msg void OnDrawCircle1();	//绘制圆形区域(填充圆) 
	afx_msg void OnDrawLine();		//绘制直线 
	afx_msg void OnDrawPline();		//绘制连续直线 
	afx_msg void OnDrawRgn();		//绘制多边形区域 
	afx_msg void OnDrawText();		//标注文字 
	afx_msg void DrawText();//在标注文字对话框中填入文字时被调用在屏幕上写文字 
	afx_msg void DrawTextOnOk();	//按‘确定'退出标注文字对话框时被调用 
	afx_msg void DrawTextOnCancel();//按‘放弃'退出标注文字对话框时被调用 
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);//按下鼠标左键时调用 
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);  //鼠标移动时调用	 
	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);//按下鼠标右键时调用 
	afx_msg void OnGraphRedraw();	//图形重画 
	afx_msg void OnGraphZoom();		//图形放大 
	afx_msg void OnGraphPan();		//图形移动 
	afx_msg void OnGraphUp();		//重画上屏图形 
	afx_msg void OnGraphFirst();	//重画首屏图形 
	afx_msg void OnGraphAll();		//重画全屏 
	afx_msg void OnSelectMouse();	//运行鼠标选中图形 
	afx_msg void OnSelectClear();	//放弃选中图形 
	afx_msg void OnSelectDelete();	//删除选中图形 
	afx_msg void OnEditCut();		//裁剪选中图形进裁剪板 
	afx_msg void OnEditPaste();		//粘贴图形 
	afx_msg void OnEditUndo();		//逆向放弃操作 
	afx_msg void OnEditCopy();		//拷贝选中图形进裁剪板 
	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); 
	afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); 
	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); 
	afx_msg void OnBitmapCut(); 
	afx_msg void OnBitmapPaste(); 
	afx_msg void OnUpdateEditPaste(CCmdUI* pCmdUI); 
	afx_msg void OnGraphDraw(); 
	afx_msg void OnChangeDlgEdit(); 
	afx_msg void OnChangeDlgCom(); 
	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point); 
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point); 
	afx_msg void OnDataSeacher(); 
	//}}AFX_MSG 
	DECLARE_MESSAGE_MAP() 
}; 
 
#ifndef _DEBUG  // debug version in DrawView.cpp 
inline CDrawDoc* CDrawView::GetDocument() 
   { return (CDrawDoc*)m_pDocument; } 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
 
//{{AFX_INSERT_LOCATION}} 
// Microsoft Developer Studio will insert additional declarations immediately before the previous line. 
 
#endif // !defined(AFX_DrawVIEW_H__0EFFC630_8953_11D2_AE7B_444553540000__INCLUDED_)