clsStruct.h
2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#ifndef _clsStruct_H_
#define _clsStruct_H_
#include<vector>
namespace DmapCore_30
{
class clsMalloc;
class Rect;
class clsStruct
{
public:
clsStruct();
~clsStruct();
enum StructType
{
Struct_Point = 0,
Struct_Line = 1,
Struct_MLine = 2,
Struct_Polygon = 3,
Struct_MPolygon = 4,
Struct_Heat = 4
};
struct POINT
{
double x;
double y;
};
struct POLY_STRUCT
{
int nPoint;
POINT* pPoint;
int nPartCount;
clsMalloc* pPartStart;
clsMalloc* pAllFieldName;
clsMalloc* pAllFields; //除shape之外的所有字段
};
struct LINE
{
int nPoint;
POINT* p;
};
struct MLINE
{
int nLine;
LINE* p;
};
struct POLYGON
{
int nRing;
LINE* p;
};
struct MPOLYGON
{
int nPolygon;
POLYGON* p;
};
static bool GetCenter(double& x, double& y, LINE* pLine);
static bool GetCenter(double & x, double & y, MLINE* pMLine);
static bool GetCenter(double& x, double& y, POLYGON* pPolygon);
static bool GetCenter(double& x, double &y, MPOLYGON* pMPolygon);
static bool GetGravity(double& x, double&y, LINE* pLine);
static bool GetGravity(double&x, double&y, int& iIndex, LINE*pLine);
static bool GetGravity(double& x, double&y, MLINE* pMLine);
static bool GetGravity(double& x, double&y, int& iIndex, MLINE* pMLine);
static bool GetGravity(double& x, double&y, POLYGON* pPolygon);
static bool GetGravity(double& x, double&y, MPOLYGON* pMPolygon);
static bool GetRingGravity(double& x, double & y, LINE* pRing);
//获取起点线段,终点线段,中心点线段
//不考虑一个multilinestring 有多条line
static bool GetStart(MLINE*pMLine, double& x1, double&y1, double&x2, double&y2);
static bool GetEnd(MLINE* pMLine, double&x1, double&y1, double&x2, double&y2);
static bool GetCenter(MLINE* pMLine, double &x1, double&y1, double&x2, double&y2);
static double GetLength(LINE* pLine); //计算长度
static double GetLength5(LINE* pLine, int & iPointIndex, double& beginX, double &beginY, double& dRadia, int w, int h, double dw); //简单计算长度
static double GetMaxRing(MPOLYGON* pMPolygon, int& iPolygonIndex, int& iRingIndex);
static bool GetConvexRing(LINE* pRing, std::vector<double>&vX, std::vector<double>& vY); //计算多边形凸壳
static int GetNextConvexPointMin(LINE* pRing, int iPointIndexNow);
static int GetNextConvexPointRotate(LINE* pRing, int iPointIndexNow, int iPointIndexLast);
static bool GetIsInRing(LINE* pRing, double x, double y);
};
}
#endif