-
Notifications
You must be signed in to change notification settings - Fork 0
/
edsmv1_nearest.h
56 lines (49 loc) · 1.2 KB
/
edsmv1_nearest.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
#ifndef EDSMV1_NEAREST_H
#define EDSMV1_NEAREST_H
#include "point.h"
#include "utils/restclient.h"
class EDSMV1NearerstSystem
{
private:
bool iscube{false};
RestClient::parameters p;
public:
EDSMV1NearerstSystem() = delete;
EDSMV1NearerstSystem(const Point& src, float size_or_radius, bool iscube = false) : iscube(iscube)
{
p = src.toParams();
addSize(size_or_radius);
}
EDSMV1NearerstSystem(const std::string& src, float size_or_radius, bool iscube = false) : iscube(iscube)
{
p["systemName"] = src;
addSize(size_or_radius);
}
constexpr bool isGet() const
{
return true;
}
const auto& params() const
{
return p;
}
const std::string& api() const
{
const static std::string cube{"cube-systems"};
const static std::string sphere{"sphere-systems"};
return (iscube) ? cube : sphere;
}
private:
void addSize(float size_or_radius)
{
const auto v = stringfmt("%0.4f", size_or_radius);
if (iscube)
p["size"] = v;
else
{
p["radius"] = v ;
p["minRadius"] = "0";
}
}
};
#endif // EDSMV1_NEAREST_H