-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPoint.h
executable file
·131 lines (100 loc) · 3.51 KB
/
Point.h
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
//////////////////////////////////////////////////////////////////////////
// _ _ ____ ____
// Project | | | | / ___) / ___)
// | | | || | __ | |
// | |_| || |_\ || \___
// \____/ \____| \ ___) 6.0
//
//! \file Point.h
//! \brief Class 。
//! \details 。
//! \author liyq。
//! \attention
//! Copyright (c) 1996-2010 SuperMap Software Limited Company. <br>
//! All Rights Reserved.
//! \version 6.0
//////////////////////////////////////////////////////////////////////////
#ifndef POINT_INCLUDE_H
#define POINT_INCLUDE_H
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "PyGISCore/Size.h"
#include <vector>
using namespace std;
class Size;
//! \brief 二维坐标点,int型,常用来表达屏幕坐标点或设备坐标点
class GISCORE_API Point
{
public:
//! \brief 点的横坐标
int x;
//! \brief 点的纵坐标
int y;
public:
//! \brief 缺省构造函数
Point();
//! \brief 默认析构函数
~Point();
//! \brief 带参构造函数
//! \param nX 横坐标
//! \param nY 纵坐标
Point(int nX, int nY);
//! \brief 拷贝构造函数
//! \param sz
Point(const Size& sz);
//! \brief 绕点旋转
//! \param pntAnchor 中心点
//! \param dRadian 顺时针旋转角度(弧度)
void Rotate(const Point& pntAnchor, double dRadian);
//! \brief 绕点旋转
//! \param pntAnchor 中心点
//! \param dCos 余弦值
//! \param dSin 正弦值
void Rotate(const Point& pntAnchor, double dCos, double dSin);
//! \brief 点偏移
//! \param szValue 偏移量
void Offset(const Size &szValue);
//! \brief 点偏移
//! \param nOffsetX 横坐标偏移
//! \param nOffsetY 纵坐标偏移
void Offset(int nOffsetX, int nOffsetY);
//! \brief 重载 ==
//! \return 返回pntStart与pntEnd的比较结果,相等返回true,不等返回false。
friend GISCORE_API bool operator==(const Point& pntStart,const Point& pntEnd);
//! \brief 重载 !=
//! \return 返回pntStart与pntEnd的比较结果,不等返回true,相等返回false。
friend GISCORE_API bool operator!=(const Point& pntStart,const Point& pntEnd);
//! \brief 重载 =
Point& operator=(const Size& sz);
//! \brief 重载 =
Point& operator=(const Point& pnt);
//! \brief 重载 +=
Point& operator+=(const Point& pnt);
//! \brief 重载 +=
Point& operator+=(const Size& sz);
//! \brief 重载 -=
Point& operator-=(const Point& pnt);
//! \brief 重载 -=
Point& operator-=(const Size& sz);
//! \brief 重载 -(取相反数)
//! \return Point
//! \remarks
Point operator-() const;
//! \brief 重载 <
bool operator<(const Point& pt) const;
//! \brief 重载 +
friend GISCORE_API Point operator+(const Point& pntStart,const Point& pntEnd);
//! \brief 重载 +
friend GISCORE_API Point operator+(const Point& pnt,const Size& sz);
//! \brief 重载 +
friend GISCORE_API Point operator+(const Size& sz,const Point& pnt);
//! \brief 重载 -
friend GISCORE_API Point operator-(const Point& pntStart,const Point& pntEnd);
//! \brief 重载 -
friend GISCORE_API Point operator-(const Point& pnt,const Size& sz);
//! \brief 重载 -
friend GISCORE_API Point operator-(const Size& sz,const Point& pnt);
};
typedef vector<Point> Points;
#endif