shpreaderdoc.h

来自「读取shp文件源码。」· C头文件 代码 · 共 107 行

H
107
字号
/*
读取ShapeFile格式
工程:ShpReader
作者:醍醐灌顶
创建时间:星期一,四月,04,2005
*/
// ShpReaderDoc.h : interface of the CShpReaderDoc class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_SHPREADERDOC_H__FE2DBD60_03F3_488A_B864_9A2F1F775710__INCLUDED_)
#define AFX_SHPREADERDOC_H__FE2DBD60_03F3_488A_B864_9A2F1F775710__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <vector>
using namespace std;
typedef unsigned char uchar;

typedef struct def_shppoint
{
	int id;
	double x;
	double y;
}ShpPoint;

typedef struct def_point
{
	double x;
	double y;	
}Point;
typedef struct def_shppolyline
{
	int id;
	int partnum;
	int pointnum;
	int *parts;
	Point *points;
}ShpPolyLine;
typedef struct def_shppolygon
{
	int id;
	int partnum;
	int pointnum;
	int *parts;
	Point *points;
}ShpPolygon;

class CShpReaderDoc : public CDocument
{
protected: // create from serialization only
	CShpReaderDoc();
	DECLARE_DYNCREATE(CShpReaderDoc)

// Attributes
public:
	vector<ShpPoint> pointV;
	vector<ShpPolyLine> polylineV;
	vector<ShpPolygon> polygonV;
	int shapeType;
	unsigned int fileSize;
	double xmin;
	double xmax;
	double ymin;
	double ymax;
// Operations
public:
// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CShpReaderDoc)
	public:
	virtual BOOL OnNewDocument();
	virtual void Serialize(CArchive& ar);
	//}}AFX_VIRTUAL

// Implementation
public:
	int ReadPolygons(FILE *fp);
	int ReadPolyLines(FILE *fp);
	int ReadPoints(FILE *fp);
	void ReadHeadInfo(FILE *fp);
	void SwapWord(int length,void * pword);
	virtual ~CShpReaderDoc();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CShpReaderDoc)
	afx_msg void OnMenuitemOpen();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

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

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

#endif // !defined(AFX_SHPREADERDOC_H__FE2DBD60_03F3_488A_B864_9A2F1F775710__INCLUDED_)

⌨️ 快捷键说明

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