From c5597ad6f1b5140406d8059d27c7a5ca90ba40de Mon Sep 17 00:00:00 2001 From: "Justin R. Miller" Date: Mon, 23 Mar 2015 20:49:02 -0700 Subject: annotations perf improvements & iOS app testing squash of #1061 --- include/mbgl/map/annotation.hpp | 9 +++++---- include/mbgl/map/tile.hpp | 7 +++++++ 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'include/mbgl/map') diff --git a/include/mbgl/map/annotation.hpp b/include/mbgl/map/annotation.hpp index 2eb0509d9a..efd91d9087 100644 --- a/include/mbgl/map/annotation.hpp +++ b/include/mbgl/map/annotation.hpp @@ -9,9 +9,10 @@ #include #include -#include #include #include +#include +#include namespace mbgl { @@ -29,7 +30,7 @@ public: void setDefaultPointAnnotationSymbol(const std::string& symbol); std::pair, AnnotationIDs> addPointAnnotations( const std::vector&, const std::vector& symbols, const Map&); - std::vector removeAnnotations(const AnnotationIDs&); + std::vector removeAnnotations(const AnnotationIDs&, const Map&); AnnotationIDs getAnnotationsInBounds(const LatLngBounds&, const Map&) const; LatLngBounds getBoundsForAnnotations(const AnnotationIDs&) const; @@ -44,8 +45,8 @@ private: private: mutable std::mutex mtx; std::string defaultPointAnnotationSymbol; - std::map> annotations; - std::map>> annotationTiles; + std::unordered_map> annotations; + std::unordered_map, std::unique_ptr>, Tile::ID::Hash> tiles; uint32_t nextID_ = 0; }; diff --git a/include/mbgl/map/tile.hpp b/include/mbgl/map/tile.hpp index bdb127030b..146ebe6ad7 100644 --- a/include/mbgl/map/tile.hpp +++ b/include/mbgl/map/tile.hpp @@ -12,6 +12,7 @@ #include #include #include +#include namespace mbgl { @@ -44,6 +45,12 @@ public: return ((std::pow(2, z) * y + x) * 32) + z; } + struct Hash { + std::size_t operator()(ID const& i) const { + return std::hash()(i.to_uint64()); + } + }; + inline bool operator==(const ID& rhs) const { return w == rhs.w && z == rhs.z && x == rhs.x && y == rhs.y; } -- cgit v1.2.1