summaryrefslogtreecommitdiff
path: root/src/mbgl/annotation
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2017-05-10 18:51:52 +0300
committerBruno de Oliveira Abinader <bruno@mapbox.com>2017-05-12 18:07:36 +0300
commit25b2250c32c1881990718c7de7b87f33ab703e79 (patch)
tree0d5b0a1daa8764489a351b8c757d196be315fc24 /src/mbgl/annotation
parentfa36110dfbdc05b511a3f85461eaca4a29e446a1 (diff)
downloadqtlocation-mapboxgl-25b2250c32c1881990718c7de7b87f33ab703e79.tar.gz
[tidy] modernize-use-using
Diffstat (limited to 'src/mbgl/annotation')
-rw-r--r--src/mbgl/annotation/symbol_annotation_impl.hpp46
1 files changed, 38 insertions, 8 deletions
diff --git a/src/mbgl/annotation/symbol_annotation_impl.hpp b/src/mbgl/annotation/symbol_annotation_impl.hpp
index c9a99ffb8d..b5be4e9ed9 100644
--- a/src/mbgl/annotation/symbol_annotation_impl.hpp
+++ b/src/mbgl/annotation/symbol_annotation_impl.hpp
@@ -26,10 +26,6 @@
#include <boost/geometry/index/rtree.hpp>
#pragma GCC diagnostic pop
-// Make Boost Geometry aware of our LatLng type
-BOOST_GEOMETRY_REGISTER_POINT_2D_CONST(mbgl::LatLng, double, boost::geometry::cs::cartesian, longitude(), latitude())
-BOOST_GEOMETRY_REGISTER_BOX(mbgl::LatLngBounds, mbgl::LatLng, southwest(), northeast())
-
namespace mbgl {
class AnnotationTileLayer;
@@ -47,9 +43,42 @@ public:
} // namespace mbgl
-// Tell Boost Geometry how to access a std::shared_ptr<mbgl::SymbolAnnotation> object.
namespace boost {
namespace geometry {
+
+// Make Boost Geometry aware of our LatLng type
+namespace traits {
+
+template<> struct tag<mbgl::LatLng> { using type = point_tag; };
+template<> struct dimension<mbgl::LatLng> : boost::mpl::int_<2> {};
+template<> struct coordinate_type<mbgl::LatLng> { using type = double; };
+template<> struct coordinate_system<mbgl::LatLng> { using type = boost::geometry::cs::cartesian; };
+
+template<> struct access<mbgl::LatLng, 0> { static inline double get(mbgl::LatLng const& p) { return p.longitude(); } };
+template<> struct access<mbgl::LatLng, 1> { static inline double get(mbgl::LatLng const& p) { return p.latitude(); } };
+
+template<> struct tag<mbgl::LatLngBounds> { using type = box_tag; };
+template<> struct point_type<mbgl::LatLngBounds> { using type = mbgl::LatLng; };
+
+template <size_t D>
+struct indexed_access<mbgl::LatLngBounds, min_corner, D>
+{
+ using ct = coordinate_type<mbgl::LatLng>::type;
+ static inline ct get(mbgl::LatLngBounds const& b) { return geometry::get<D>(b.southwest()); }
+ static inline void set(mbgl::LatLngBounds& b, ct const& value) { geometry::set<D>(b.southwest(), value); }
+};
+
+template <size_t D>
+struct indexed_access<mbgl::LatLngBounds, max_corner, D>
+{
+ using ct = coordinate_type<mbgl::LatLng>::type;
+ static inline ct get(mbgl::LatLngBounds const& b) { return geometry::get<D>(b.northeast()); }
+ static inline void set(mbgl::LatLngBounds& b, ct const& value) { geometry::set<D>(b.northeast(), value); }
+};
+
+} // namespace traits
+
+// Tell Boost Geometry how to access a std::shared_ptr<mbgl::SymbolAnnotation> object.
namespace index {
template <>
@@ -61,6 +90,7 @@ struct indexable<std::shared_ptr<const mbgl::SymbolAnnotationImpl>> {
}
};
-} // end namespace index
-} // end namespace geometry
-} // end namespace boost
+} // namespace index
+
+} // namespace geometry
+} // namespace boost