summaryrefslogtreecommitdiffstats
path: root/server/src/geo/utm_zone_local.cppm
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/geo/utm_zone_local.cppm')
-rw-r--r--server/src/geo/utm_zone_local.cppm95
1 files changed, 55 insertions, 40 deletions
diff --git a/server/src/geo/utm_zone_local.cppm b/server/src/geo/utm_zone_local.cppm
index 98a1344..b2147ad 100644
--- a/server/src/geo/utm_zone_local.cppm
+++ b/server/src/geo/utm_zone_local.cppm
@@ -11,35 +11,32 @@ import :geo.utm;
11// Coordinates that are local to some known UTM zone. 11// Coordinates that are local to some known UTM zone.
12namespace routemon::geo::utm::zone_local { 12namespace routemon::geo::utm::zone_local {
13 13
14 using cs = bgeo::cs::cartesian; 14using cs = bgeo::cs::cartesian;
15 15
16 namespace prim { 16namespace prim {
17 17
18 using point = bgeo::model::d2::point_xy<double>; 18using point = bgeo::model::d2::point_xy<double>;
19 using linestring = bgeo::model::linestring<point>; 19using linestring = bgeo::model::linestring<point>;
20 using box = bgeo::model::box<point>; 20using box = bgeo::model::box<point>;
21 21
22 } // namespace prim 22} // namespace prim
23 23
24 struct point : public prim::point 24struct point : public prim::point
25 { 25{
26 zone zone; 26 zone zone;
27
28 explicit point(class zone zone, double x, double y)
29 : prim::point{x, y}, zone{zone}
30 {
31 }
32 };
33 27
34 struct linestring : public prim::linestring 28 explicit inline point(class zone zone, double x, double y)
29 : prim::point{x, y}, zone{zone}
35 { 30 {
36 zone zone; 31 }
32};
33
34struct linestring : public prim::linestring
35{
36 zone zone;
37 37
38 explicit linestring(class zone zone) 38 explicit inline linestring(class zone zone) : zone{zone} {}
39 : zone{zone} 39};
40 {
41 }
42 };
43 40
44} // namespace routemon::geo::utm::zone_local 41} // namespace routemon::geo::utm::zone_local
45 42
@@ -47,28 +44,46 @@ BOOST_GEOMETRY_REGISTER_LINESTRING(routemon::geo::utm::zone_local::linestring)
47 44
48namespace boost::geometry::traits { 45namespace boost::geometry::traits {
49 46
50 namespace { 47namespace {
51 48
52 using zone_local_point = routemon::geo::utm::zone_local::point; 49using zone_local_point = routemon::geo::utm::zone_local::point;
53 50
54 } // namespace <anonymous> 51} // namespace
55 52
56 template<> struct tag<zone_local_point> { using type = point_tag; }; 53template <>
57 template<> struct dimension<zone_local_point> : boost::mpl::int_<2> {}; 54struct tag<zone_local_point>
58 template<> struct coordinate_type<zone_local_point> { using type = double; }; 55{
59 template<> struct coordinate_system<zone_local_point> { using type = routemon::geo::utm::zone_local::cs; }; 56 using type = point_tag;
57};
58template <>
59struct dimension<zone_local_point> : boost::mpl::int_<2>
60{
61};
62template <>
63struct coordinate_type<zone_local_point>
64{
65 using type = double;
66};
67template <>
68struct coordinate_system<zone_local_point>
69{
70 using type = routemon::geo::utm::zone_local::cs;
71};
60 72
61 template<std::size_t index> 73template <std::size_t index>
62 struct access<zone_local_point, index> { 74struct access<zone_local_point, index>
63 static inline auto get(zone_local_point const& p) -> double 75{
64 { 76 static inline auto get(zone_local_point const& p) -> double
65 return bgeo::get<index>(static_cast<routemon::geo::utm::zone_local::prim::point const&>(p)); 77 {
66 } 78 return bgeo::get<index>(
79 static_cast<routemon::geo::utm::zone_local::prim::point const&>(p));
80 }
67 81
68 static inline auto set(zone_local_point& p, double v) -> void 82 static inline auto set(zone_local_point& p, double v) -> void
69 { 83 {
70 return bgeo::set<index>(static_cast<routemon::geo::utm::zone_local::prim::point&>(p), v); 84 return bgeo::set<index>(
71 } 85 static_cast<routemon::geo::utm::zone_local::prim::point&>(p), v);
72 }; 86 }
87};
73 88
74} // namespace boost::geometry::traits 89} // namespace boost::geometry::traits