⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 geogisdoc.h

📁 用vc和cj60lib做的读取shape文件的源代码.还有些小问题没做完。
💻 H
字号:
// GeoGisDoc.h : interface of the CGeoGisDoc class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_GEOGISDOC_H__24E1EC15_53E3_4AA1_B34D_AB7D5693E31B__INCLUDED_)
#define AFX_GEOGISDOC_H__24E1EC15_53E3_4AA1_B34D_AB7D5693E31B__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include  <afxtempl.h>

struct  LayerStruct
{
	char  m_Name[21];
	BOOL  b_Display;
	int  reserved;
};
class  CGraphPara
{
protected:
	int  n_ColorNumbAll;
	int  n_LayerNumbAll;
	int  n_ColorNumb;
	int  n_LayerNumb;
	long  *m_ColorList;
	LayerStruct  *m_LayerList;
public:
	CGraphPara()
	{
		n_ColorNumb=100;
		n_LayerNumb=100;
		m_ColorList=new  long[n_ColorNumb];
		m_LayerList=new  LayerStruct[n_LayerNumb];
		n_ColorNumb=4;
		n_LayerNumb=1;

		m_ColorList[0]=RGB(0,0,0);
		m_ColorList[1]=RGB(255,0,0);
		m_ColorList[2]=RGB(0,255,0);
		m_ColorList[3]=RGB(0,0,255);
		m_LayerList[0].b_Display=1;
		strcpy(m_LayerList[0].m_Name,"Layer 0");
	}
	~CGraphPara()
	{
		delete  m_LayerList;
		delete  m_ColorList;
	}
public:
	COLORREF   GetColor(int n);
	BOOL  GetDisplayStatue(int n);
};

struct  PointStruct
{
	float  x;
	float  y;
	float  z;
};

class  CDraw:public   CObject
{
protected:
	short  m_ColorPen;
	short  m_ColorBrush;
	short  m_LineWide;
	short  m_LineType;
	short  m_Layer;
	BOOL   b_Delete;
	int   m_id_only;
public:
	int GetID();
	virtual void   Draw(CDC* pDC,int  m_DrawMode,int  m_DrawMode1,short  BackColor) =0;
	CDraw(){}
	CDraw(short  ColorPen,short  ColorBrush,short LineWide,short  LineType,short Layer,int  id_only,BOOL  Delete)
	{
		m_ColorPen=ColorPen;
		m_ColorBrush=ColorBrush;
		m_LineWide=LineWide;
		m_LineType=LineType;
		m_Layer=Layer;
		b_Delete=Delete;
		m_id_only=id_only;
	}	
};

class  Cpoint:public  CDraw
{
protected:
	float  m_x,m_y;
public:
	virtual void Draw(CDC* pDC,int  m_DrawMode,int  m_DrawMode1,short  BackColor);
	Cpoint(){}
	Cpoint(short  ColorPen,short  ColorBrush,short LineWide,short  LineType,short Layer,int  id_only,BOOL  Delete,
		float  x,float y):CDraw(ColorPen,ColorBrush,LineWide,LineType,Layer,id_only,Delete)
	{
		m_x = x;
		m_y = y;
	}
};
class  CLine:public  CDraw
{
protected:
	float  m_x1,m_x2,m_y1,m_y2;
public:
	virtual void Draw(CDC* pDC,int  m_DrawMode,int  m_DrawMode1,short  BackColor);
	CLine(){}
	CLine(short  ColorPen,short  ColorBrush,short LineWide,short  LineType,short Layer,int  id_only,BOOL  Delete,
		float x1,float y1,float x2,float  y2)
		:CDraw(ColorPen,ColorBrush,LineWide,LineType,Layer,id_only,Delete)
	{
		m_x1 = x1;
		m_y1 = y1;
		m_x2 = x2;
		m_y2 = y2;
	}
};

class   CPline:public   CDraw
{
protected:
	int  m_Number;
	BOOL  b_Fill;
	PointStruct   *m_PointList;
public:
	virtual void Draw(CDC* pDC,int  m_DrawMode,int  m_DrawMode1,short  BackColor);
	CPline()
	{m_Number=0;}
	CPline(short  ColorPen,short  ColorBrush,short LineWide,short  LineType,short Layer,int  id_only,BOOL  Delete,
		int  Number,PointStruct *PointList,BOOL  Fill)
		:CDraw(ColorPen,ColorBrush,LineWide,LineType,Layer,id_only,Delete)
	{
		m_Number=Number;
		b_Fill=Fill;
		m_PointList = new  PointStruct[Number+1];
		if(Number>0)
		{
			for(int i=0;i<Number;i++)
				m_PointList[i]= PointList[i];
		}
	}
	~CPline()
	{
		if(m_Number>0)
			delete  m_PointList;
	}
};

class  CCircle:public  CDraw
{
protected:
	float  m_CircleX,m_CircleY,m_CircleR;
	BOOL  b_Fill;
public:
	virtual void Draw(CDC* pDC,int  m_DrawMode,int  m_DrawMode1,short  BackColor);
	CCircle(){}
	CCircle(short  ColorPen,short  ColorBrush,short LineWide,short  LineType,short Layer,int  id_only,BOOL  Delete,
		float  CircleX,float CircleY,float  CircleR,BOOL  Fill)
		:CDraw(ColorPen,ColorBrush,LineWide,LineType,Layer,id_only,Delete)
	{
		m_CircleX = CircleX;
		m_CircleY = CircleY;
		m_CircleR = CircleR;
		b_Fill = Fill;
	}
};
class CGeoGisDoc : public CDocument
{
protected: // create from serialization only
	CGeoGisDoc();
	DECLARE_DYNCREATE(CGeoGisDoc)

// Attributes
public:
	CTypedPtrArray<CObArray,Cpoint*>m_PointArray;
	CTypedPtrArray<CObArray,CLine*>m_LineArray;
	CTypedPtrArray<CObArray,CPline*>m_PlineArray;
	CTypedPtrArray<CObArray,CCircle*>m_CircleArray;
	

// Operations
public:
	CGraphPara  m_GraphPara;	

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CGeoGisDoc)
	public:
	virtual BOOL OnNewDocument();
	virtual void Serialize(CArchive& ar);
	//}}AFX_VIRTUAL

// Implementation
public:	
	int* m_Index;
	int GetGraphID(short  Lb);
	void Draw(CDC *pDC, int m_DrawMode, int m_DrawMode1, short BackColor);
	int GetGraphUpperBound(short Lb);
	int GetGraphNumb(short Lb);
	void DeleteGraph(short  Lb,int Index);
	CDraw* GetGraph(short  Lb,int  Index);
	CCircle* AddCircle(short  ColorPen,short ColorBrush,short LineWide,short LineType,short Layer,int  id_only,float CircleX,float  CircleY,float CircleR,BOOL Fill);
	CPline* AddPline(short  ColorPen,short ColorBrush,short LineWide,short LineType,short Layer,int  id_only,int  Number,PointStruct *PointList,BOOL b_Fill);
	CLine* AddLine(short  ColorPen,short ColorBrush,short LineWide,short LineType,short Layer,int  id_only,float x1,float y1,float x2,float y2);
	Cpoint* AddPoint(short  ColorPen,short ColorBrush,short LineWide,short LineType,short Layer,int  id_only,float x,float y);
	virtual ~CGeoGisDoc();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CGeoGisDoc)
		// NOTE - the ClassWizard will add and remove member functions here.
		//    DO NOT EDIT what you see in these blocks of generated code !
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_GEOGISDOC_H__24E1EC15_53E3_4AA1_B34D_AB7D5693E31B__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -