-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBS.cpp
122 lines (90 loc) · 1.49 KB
/
BS.cpp
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
#include "BS.h"
int BS::IdNow = 0;
double BS::RMax = 1000;
OGRSpatialReference sr;
double BS::getR()
{
return R;
}
double BS::getRMax()
{
return RMax;
}
void BS::setRMax(double R)
{
if (R < 0) {
RMax = 0;
}
else {
RMax = R;
}
}
void BS::setR(double R)
{
if (R < 0) {
this->R = 0;
}
else {
if (R < RMax) {
this->R = R;
}
else {
this->R = RMax;
}
}
}
void BS::setR(BS BorderBS)
{
double RRes = this->R, Rbuff;
BorderBS.Coordinate.transformTo(Coordinate.getSpatialReference());
Rbuff = Coordinate.Distance(&BorderBS.Coordinate);
if (Rbuff < RRes) {
RRes = Rbuff;
}
setR(RRes);
}
void BS::setR(std::vector<BS> BorderBSList)
{
double RRes = RMax, Rbuff;
for (int i = 0; i < BorderBSList.size(); i++) {
Rbuff = Coordinate.Distance(&BorderBSList[i].Coordinate);
if (Rbuff < RRes) {
RRes = Rbuff;
}
}
setR(RRes);
}
int BS::getBsId()
{
return BsId;
}
BS::BS(double R)
{
setR(R);
BsId = getNext();
}
BS::BS(double X, double Y, double R)
{
sr.SetGeogCS("My geographic CRS",
"World Geodetic System 1984",
"My WGS84 Spheroid",
SRS_WGS84_SEMIMAJOR, SRS_WGS84_INVFLATTENING,
"Greenwich", 0.0,
"degree", 0.0174532925199433);
setR(R);
Coordinate.setX(X);
Coordinate.setY(Y);
Coordinate.assignSpatialReference(&sr);
BsId = getNext();
}
BS::BS(double X, double Y, OGRSpatialReference srNow, double R)
{
setR(R);
Coordinate.setX(X);
Coordinate.setY(Y);
Coordinate.assignSpatialReference(&srNow);
}
int BS::getNext()
{
return IdNow++;
}