diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2015-06-26 18:49:06 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2015-06-29 10:54:17 -0700 |
commit | 42c06e70392941a9c07b842f019c4b060f716ff7 (patch) | |
tree | 18dfc09adcabc7239a738a416d7bac98b0ef50f9 /include | |
parent | f675d233142bbbfbe77c0145128c3eedfb18e824 (diff) | |
download | qtlocation-mapboxgl-42c06e70392941a9c07b842f019c4b060f716ff7.tar.gz |
Use array of structs rather than parallel arrays for annotations
Diffstat (limited to 'include')
-rw-r--r-- | include/mbgl/annotation/point_annotation.hpp | 22 | ||||
-rw-r--r-- | include/mbgl/annotation/shape_annotation.hpp | 24 | ||||
-rw-r--r-- | include/mbgl/map/map.hpp | 19 |
3 files changed, 56 insertions, 9 deletions
diff --git a/include/mbgl/annotation/point_annotation.hpp b/include/mbgl/annotation/point_annotation.hpp new file mode 100644 index 0000000000..17b6fe5369 --- /dev/null +++ b/include/mbgl/annotation/point_annotation.hpp @@ -0,0 +1,22 @@ +#ifndef MBGL_ANNOTATION_POINT_ANNOTATION +#define MBGL_ANNOTATION_POINT_ANNOTATION + +#include <mbgl/util/geo.hpp> + +#include <string> + +namespace mbgl { + +class PointAnnotation { +public: + inline PointAnnotation(const LatLng& position_, const std::string& icon_ = "") + : position(position_), icon(icon_) { + } + + const LatLng position; + const std::string icon; +}; + +} + +#endif diff --git a/include/mbgl/annotation/shape_annotation.hpp b/include/mbgl/annotation/shape_annotation.hpp new file mode 100644 index 0000000000..a35b867266 --- /dev/null +++ b/include/mbgl/annotation/shape_annotation.hpp @@ -0,0 +1,24 @@ +#ifndef MBGL_ANNOTATION_SHAPE_ANNOTATION +#define MBGL_ANNOTATION_SHAPE_ANNOTATION + +#include <mbgl/util/geo.hpp> +#include <mbgl/map/map.hpp> +#include <mbgl/style/style_properties.hpp> + +#include <string> + +namespace mbgl { + +class ShapeAnnotation { +public: + inline ShapeAnnotation(const AnnotationSegments& segments_, const StyleProperties& styleProperties_) + : segments(segments_), styleProperties(styleProperties_) { + } + + const AnnotationSegments segments; + const StyleProperties styleProperties; +}; + +} + +#endif diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp index 6fd5e96063..59f23fe2b2 100644 --- a/include/mbgl/map/map.hpp +++ b/include/mbgl/map/map.hpp @@ -4,7 +4,6 @@ #include <mbgl/util/chrono.hpp> #include <mbgl/map/update.hpp> #include <mbgl/map/mode.hpp> -#include <mbgl/style/style_properties.hpp> #include <mbgl/util/geo.hpp> #include <mbgl/util/noncopyable.hpp> #include <mbgl/util/vec.hpp> @@ -14,7 +13,6 @@ #include <functional> #include <vector> #include <memory> -#include <unordered_map> namespace mbgl { @@ -24,6 +22,8 @@ class MapData; class MapContext; class StillImage; class Transform; +class PointAnnotation; +class ShapeAnnotation; namespace util { template <class T> class Thread; @@ -129,15 +129,16 @@ public: // Annotations void setDefaultPointAnnotationSymbol(const std::string&); double getTopOffsetPixelsForAnnotationSymbol(const std::string&); - uint32_t addPointAnnotation(const LatLng&, const std::string& symbol); - AnnotationIDs addPointAnnotations(const AnnotationSegment&, - const std::vector<std::string>& symbols); - uint32_t addShapeAnnotation(const AnnotationSegments&, - const StyleProperties&); - AnnotationIDs addShapeAnnotations(const std::vector<AnnotationSegments>&, - const std::vector<StyleProperties>&); + + uint32_t addPointAnnotation(const PointAnnotation&); + AnnotationIDs addPointAnnotations(const std::vector<PointAnnotation>&); + + uint32_t addShapeAnnotation(const ShapeAnnotation&); + AnnotationIDs addShapeAnnotations(const std::vector<ShapeAnnotation>&); + void removeAnnotation(uint32_t); void removeAnnotations(const AnnotationIDs&); + AnnotationIDs getAnnotationsInBounds(const LatLngBounds&, const AnnotationType& = AnnotationType::Any); LatLngBounds getBoundsForAnnotations(const AnnotationIDs&); |