Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaria Volvenkova <d.volvenkova@corp.mail.ru>2018-02-08 15:32:28 +0300
committerRoman Kuznetsov <r.kuznetsow@gmail.com>2018-02-15 11:12:21 +0300
commit3c42afe7229e13790576f023446afa514fb87189 (patch)
tree767513436214577b4e7689c6e200e8099bfb1556 /drape_frontend
parentf403f41296458acaa1cc891e520d00acd7315da0 (diff)
User mark id contains information about user mark type. User line id added.
Diffstat (limited to 'drape_frontend')
-rw-r--r--drape_frontend/drape_engine.cpp10
-rw-r--r--drape_frontend/message_subclasses.hpp18
-rw-r--r--drape_frontend/user_mark_generator.cpp18
-rw-r--r--drape_frontend/user_mark_generator.hpp10
-rw-r--r--drape_frontend/user_mark_shapes.cpp4
-rw-r--r--drape_frontend/user_mark_shapes.hpp4
-rw-r--r--drape_frontend/user_marks_global.hpp5
-rw-r--r--drape_frontend/user_marks_provider.cpp17
-rw-r--r--drape_frontend/user_marks_provider.hpp18
9 files changed, 49 insertions, 55 deletions
diff --git a/drape_frontend/drape_engine.cpp b/drape_frontend/drape_engine.cpp
index 057a3a5ef4..d5ea7b38a7 100644
--- a/drape_frontend/drape_engine.cpp
+++ b/drape_frontend/drape_engine.cpp
@@ -229,8 +229,8 @@ void DrapeEngine::UpdateUserMarks(UserMarksProvider * provider)
auto marksRenderCollection = make_unique_dp<UserMarksRenderCollection>();
auto linesRenderCollection = make_unique_dp<UserLinesRenderCollection>();
- auto createdIdCollection = make_unique_dp<MarkIDCollection>();
- auto removedIdCollection = make_unique_dp<MarkIDCollection>();
+ auto createdIdCollection = make_unique_dp<IDCollections>();
+ auto removedIdCollection = make_unique_dp<IDCollections>();
df::MarkGroupID lastGroupId = *dirtyGroupIds.begin();
bool visibilityChanged = provider->IsGroupVisiblityChanged(lastGroupId);
@@ -239,7 +239,7 @@ void DrapeEngine::UpdateUserMarks(UserMarksProvider * provider)
auto const HandleMark = [&](
df::MarkID markId,
UserMarksRenderCollection & renderCollection,
- IDCollection * idCollection)
+ MarkIDCollection * idCollection)
{
auto const * mark = provider->GetUserPointMark(markId);
if (!mark->IsDirty())
@@ -269,10 +269,10 @@ void DrapeEngine::UpdateUserMarks(UserMarksProvider * provider)
removedIdCollection->m_marksID.reserve(removedMarkIds.size());
removedIdCollection->m_marksID.assign(removedMarkIds.begin(), removedMarkIds.end());
- std::map<df::MarkGroupID, drape_ptr<MarkIDCollection>> dirtyMarkIds;
+ std::map<df::MarkGroupID, drape_ptr<IDCollections>> dirtyMarkIds;
for (auto groupId : dirtyGroupIds)
{
- auto & idCollection = *(dirtyMarkIds.emplace(groupId, make_unique_dp<MarkIDCollection>()).first->second);
+ auto & idCollection = *(dirtyMarkIds.emplace(groupId, make_unique_dp<IDCollections>()).first->second);
visibilityChanged = provider->IsGroupVisiblityChanged(groupId);
groupIsVisible = provider->IsGroupVisible(groupId);
if (!groupIsVisible && !visibilityChanged)
diff --git a/drape_frontend/message_subclasses.hpp b/drape_frontend/message_subclasses.hpp
index 0b259f541c..9191638647 100644
--- a/drape_frontend/message_subclasses.hpp
+++ b/drape_frontend/message_subclasses.hpp
@@ -239,8 +239,8 @@ private:
class UpdateUserMarksMessage : public Message
{
public:
- UpdateUserMarksMessage(drape_ptr<MarkIDCollection> && createdIds,
- drape_ptr<MarkIDCollection> && removedIds,
+ UpdateUserMarksMessage(drape_ptr<IDCollections> && createdIds,
+ drape_ptr<IDCollections> && removedIds,
drape_ptr<UserMarksRenderCollection> && marksRenderParams,
drape_ptr<UserLinesRenderCollection> && linesRenderParams)
: m_createdIds(std::move(createdIds))
@@ -253,12 +253,12 @@ public:
drape_ptr<UserMarksRenderCollection> && AcceptMarkRenderParams() { return std::move(m_marksRenderParams); }
drape_ptr<UserLinesRenderCollection> && AcceptLineRenderParams() { return std::move(m_linesRenderParams); }
- drape_ptr<MarkIDCollection> && AcceptRemovedIds() { return std::move(m_removedIds); }
- drape_ptr<MarkIDCollection> && AcceptCreatedIds() { return std::move(m_createdIds); }
+ drape_ptr<IDCollections> && AcceptRemovedIds() { return std::move(m_removedIds); }
+ drape_ptr<IDCollections> && AcceptCreatedIds() { return std::move(m_createdIds); }
private:
- drape_ptr<MarkIDCollection> m_createdIds;
- drape_ptr<MarkIDCollection> m_removedIds;
+ drape_ptr<IDCollections> m_createdIds;
+ drape_ptr<IDCollections> m_removedIds;
drape_ptr<UserMarksRenderCollection> m_marksRenderParams;
drape_ptr<UserLinesRenderCollection> m_linesRenderParams;
};
@@ -267,7 +267,7 @@ class UpdateUserMarkGroupMessage : public Message
{
public:
UpdateUserMarkGroupMessage(MarkGroupID groupId,
- drape_ptr<MarkIDCollection> && ids)
+ drape_ptr<IDCollections> && ids)
: m_groupId(groupId)
, m_ids(std::move(ids))
{}
@@ -275,11 +275,11 @@ public:
Type GetType() const override { return Message::UpdateUserMarkGroup; }
MarkGroupID GetGroupId() const { return m_groupId; }
- drape_ptr<MarkIDCollection> && AcceptIds() { return std::move(m_ids); }
+ drape_ptr<IDCollections> && AcceptIds() { return std::move(m_ids); }
private:
MarkGroupID m_groupId;
- drape_ptr<MarkIDCollection> m_ids;
+ drape_ptr<IDCollections> m_ids;
};
using FlushUserMarksMessage = FlushRenderDataMessage<TUserMarksRenderData,
diff --git a/drape_frontend/user_mark_generator.cpp b/drape_frontend/user_mark_generator.cpp
index 8a96d59611..79be6c90f4 100644
--- a/drape_frontend/user_mark_generator.cpp
+++ b/drape_frontend/user_mark_generator.cpp
@@ -28,13 +28,13 @@ void UserMarkGenerator::RemoveGroup(MarkGroupID groupId)
UpdateIndex(groupId);
}
-void UserMarkGenerator::SetGroup(MarkGroupID groupId, drape_ptr<MarkIDCollection> && ids)
+void UserMarkGenerator::SetGroup(MarkGroupID groupId, drape_ptr<IDCollections> && ids)
{
m_groups[groupId] = std::move(ids);
UpdateIndex(groupId);
}
-void UserMarkGenerator::SetRemovedUserMarks(drape_ptr<MarkIDCollection> && ids)
+void UserMarkGenerator::SetRemovedUserMarks(drape_ptr<IDCollections> && ids)
{
if (ids == nullptr)
return;
@@ -44,7 +44,7 @@ void UserMarkGenerator::SetRemovedUserMarks(drape_ptr<MarkIDCollection> && ids)
m_lines.erase(id);
}
-void UserMarkGenerator::SetCreatedUserMarks(drape_ptr<MarkIDCollection> && ids)
+void UserMarkGenerator::SetCreatedUserMarks(drape_ptr<IDCollections> && ids)
{
if (ids == nullptr)
return;
@@ -93,7 +93,7 @@ void UserMarkGenerator::UpdateIndex(MarkGroupID groupId)
if (groupIt == m_groups.end())
return;
- MarkIDCollection & idCollection = *groupIt->second.get();
+ IDCollections & idCollection = *groupIt->second.get();
for (auto markId : idCollection.m_marksID)
{
@@ -101,7 +101,7 @@ void UserMarkGenerator::UpdateIndex(MarkGroupID groupId)
for (int zoomLevel = params.m_minZoom; zoomLevel <= scales::GetUpperScale(); ++zoomLevel)
{
TileKey const tileKey = GetTileKeyByPoint(params.m_pivot, zoomLevel);
- ref_ptr<MarkIDCollection> groupIDs = GetIdCollection(tileKey, groupId);
+ ref_ptr<IDCollections> groupIDs = GetIdCollection(tileKey, groupId);
groupIDs->m_marksID.push_back(static_cast<uint32_t>(markId));
}
}
@@ -125,7 +125,7 @@ void UserMarkGenerator::UpdateIndex(MarkGroupID groupId)
CalcTilesCoverage(segmentRect, zoomLevel, [&](int tileX, int tileY)
{
TileKey const tileKey(tileX, tileY, zoomLevel);
- ref_ptr<MarkIDCollection> groupIDs = GetIdCollection(tileKey, groupId);
+ ref_ptr<IDCollections> groupIDs = GetIdCollection(tileKey, groupId);
groupIDs->m_linesID.push_back(static_cast<uint32_t>(lineId));
});
return true;
@@ -136,7 +136,7 @@ void UserMarkGenerator::UpdateIndex(MarkGroupID groupId)
CleanIndex();
}
-ref_ptr<MarkIDCollection> UserMarkGenerator::GetIdCollection(TileKey const & tileKey, MarkGroupID groupId)
+ref_ptr<IDCollections> UserMarkGenerator::GetIdCollection(TileKey const & tileKey, MarkGroupID groupId)
{
ref_ptr<MarksIDGroups> tileGroups;
auto itTileGroups = m_index.find(tileKey);
@@ -151,11 +151,11 @@ ref_ptr<MarkIDCollection> UserMarkGenerator::GetIdCollection(TileKey const & til
tileGroups = make_ref(itTileGroups->second);
}
- ref_ptr<MarkIDCollection> groupIDs;
+ ref_ptr<IDCollections> groupIDs;
auto itGroupIDs = tileGroups->find(groupId);
if (itGroupIDs == tileGroups->end())
{
- auto groupMarkIndexes = make_unique_dp<MarkIDCollection>();
+ auto groupMarkIndexes = make_unique_dp<IDCollections>();
groupIDs = make_ref(groupMarkIndexes);
tileGroups->insert(make_pair(groupId, std::move(groupMarkIndexes)));
}
diff --git a/drape_frontend/user_mark_generator.hpp b/drape_frontend/user_mark_generator.hpp
index 0013041f8f..60adce9d34 100644
--- a/drape_frontend/user_mark_generator.hpp
+++ b/drape_frontend/user_mark_generator.hpp
@@ -12,7 +12,7 @@
namespace df
{
-using MarksIDGroups = std::map<MarkGroupID, drape_ptr<MarkIDCollection>>;
+using MarksIDGroups = std::map<MarkGroupID, drape_ptr<IDCollections>>;
using MarksIndex = std::map<TileKey, drape_ptr<MarksIDGroups>>;
class UserMarkGenerator
@@ -24,10 +24,10 @@ public:
void SetUserMarks(drape_ptr<UserMarksRenderCollection> && marks);
void SetUserLines(drape_ptr<UserLinesRenderCollection> && lines);
- void SetRemovedUserMarks(drape_ptr<MarkIDCollection> && ids);
- void SetCreatedUserMarks(drape_ptr<MarkIDCollection> && ids);
+ void SetRemovedUserMarks(drape_ptr<IDCollections> && ids);
+ void SetCreatedUserMarks(drape_ptr<IDCollections> && ids);
- void SetGroup(MarkGroupID groupId, drape_ptr<MarkIDCollection> && ids);
+ void SetGroup(MarkGroupID groupId, drape_ptr<IDCollections> && ids);
void RemoveGroup(MarkGroupID groupId);
void SetGroupVisibility(MarkGroupID groupId, bool isVisible);
@@ -36,7 +36,7 @@ public:
private:
void UpdateIndex(MarkGroupID groupId);
- ref_ptr<MarkIDCollection> GetIdCollection(TileKey const & tileKey, MarkGroupID groupId);
+ ref_ptr<IDCollections> GetIdCollection(TileKey const & tileKey, MarkGroupID groupId);
void CleanIndex();
int GetNearestLineIndexZoom(int zoom) const;
diff --git a/drape_frontend/user_mark_shapes.cpp b/drape_frontend/user_mark_shapes.cpp
index f7bcd56165..655d2b0d43 100644
--- a/drape_frontend/user_mark_shapes.cpp
+++ b/drape_frontend/user_mark_shapes.cpp
@@ -96,7 +96,7 @@ struct UserPointVertex : gpu::BaseVertex
} // namespace
void CacheUserMarks(TileKey const & tileKey, ref_ptr<dp::TextureManager> textures,
- IDCollection const & marksId, UserMarksRenderCollection & renderParams,
+ MarkIDCollection const & marksId, UserMarksRenderCollection & renderParams,
dp::Batcher & batcher)
{
float const vs = static_cast<float>(df::VisualParams::Instance().GetVisualScale());
@@ -338,7 +338,7 @@ void ProcessSplineSegmentRects(m2::SharedSpline const & spline, double maxSegmen
}
void CacheUserLines(TileKey const & tileKey, ref_ptr<dp::TextureManager> textures,
- IDCollection const & linesId, UserLinesRenderCollection & renderParams,
+ LineIDCollection const & linesId, UserLinesRenderCollection & renderParams,
dp::Batcher & batcher)
{
float const vs = static_cast<float>(df::VisualParams::Instance().GetVisualScale());
diff --git a/drape_frontend/user_mark_shapes.hpp b/drape_frontend/user_mark_shapes.hpp
index f649dc5400..3b5bb76529 100644
--- a/drape_frontend/user_mark_shapes.hpp
+++ b/drape_frontend/user_mark_shapes.hpp
@@ -81,10 +81,10 @@ void ProcessSplineSegmentRects(m2::SharedSpline const & spline, double maxSegmen
std::function<bool(m2::RectD const & segmentRect)> const & func);
void CacheUserMarks(TileKey const & tileKey, ref_ptr<dp::TextureManager> textures,
- IDCollection const & marksId, UserMarksRenderCollection & renderParams,
+ MarkIDCollection const & marksId, UserMarksRenderCollection & renderParams,
dp::Batcher & batcher);
void CacheUserLines(TileKey const & tileKey, ref_ptr<dp::TextureManager> textures,
- IDCollection const & linesId, UserLinesRenderCollection & renderParams,
+ LineIDCollection const & linesId, UserLinesRenderCollection & renderParams,
dp::Batcher & batcher);
} // namespace df
diff --git a/drape_frontend/user_marks_global.hpp b/drape_frontend/user_marks_global.hpp
index b815b159a5..3096c3d828 100644
--- a/drape_frontend/user_marks_global.hpp
+++ b/drape_frontend/user_marks_global.hpp
@@ -6,9 +6,12 @@
namespace df
{
using MarkID = uint32_t;
+using LineID = uint32_t;
using MarkGroupID = size_t;
-using IDCollection = std::vector<MarkID>;
+using MarkIDCollection = std::vector<MarkID>;
+using LineIDCollection = std::vector<LineID>;
using MarkIDSet = std::set<MarkID>;
+using LineIDSet = std::set<LineID>;
using GroupIDList = std::vector<MarkGroupID>;
using GroupIDSet = std::set<MarkGroupID>;
} // namespace df
diff --git a/drape_frontend/user_marks_provider.cpp b/drape_frontend/user_marks_provider.cpp
index 7301accdc8..0a406070d0 100644
--- a/drape_frontend/user_marks_provider.cpp
+++ b/drape_frontend/user_marks_provider.cpp
@@ -1,24 +1,15 @@
#include "user_marks_provider.hpp"
-namespace
-{
-df::MarkID GetNextUserMarkId()
-{
- static uint32_t nextMarkId = 0;
- return static_cast<df::MarkID>(++nextMarkId);
-}
-} // namespace
-
namespace df
{
-UserPointMark::UserPointMark()
- : m_id(GetNextUserMarkId())
+UserPointMark::UserPointMark(df::MarkID id)
+ : m_id(id)
{
}
-UserLineMark::UserLineMark()
- : m_id(GetNextUserMarkId())
+UserLineMark::UserLineMark(df::LineID id)
+ : m_id(id)
{
}
diff --git a/drape_frontend/user_marks_provider.hpp b/drape_frontend/user_marks_provider.hpp
index 41b356cd97..fd35b62cc8 100644
--- a/drape_frontend/user_marks_provider.hpp
+++ b/drape_frontend/user_marks_provider.hpp
@@ -15,10 +15,10 @@
namespace df
{
-struct MarkIDCollection
+struct IDCollections
{
- IDCollection m_marksID;
- IDCollection m_linesID;
+ MarkIDCollection m_marksID;
+ LineIDCollection m_linesID;
bool IsEmpty()
{
@@ -41,7 +41,7 @@ public:
using SymbolSizes = std::vector<m2::PointF>;
using SymbolOffsets = std::vector<m2::PointF>;
- UserPointMark();
+ UserPointMark(df::MarkID id);
virtual ~UserPointMark() {}
virtual bool IsDirty() const = 0;
@@ -77,13 +77,13 @@ private:
class UserLineMark
{
public:
- UserLineMark();
+ UserLineMark(df::LineID id);
virtual ~UserLineMark() {}
virtual bool IsDirty() const = 0;
virtual void ResetChanges() const = 0;
- virtual MarkID GetId() const { return m_id; }
+ virtual LineID GetId() const { return m_id; }
virtual int GetMinZoom() const = 0;
virtual RenderState::DepthLayer GetDepthLayer() const = 0;
@@ -94,7 +94,7 @@ public:
virtual std::vector<m2::PointD> const & GetPoints() const = 0;
private:
- MarkID m_id;
+ LineID m_id;
};
class UserMarksProvider
@@ -105,14 +105,14 @@ public:
virtual bool IsGroupVisible(MarkGroupID groupID) const = 0;
virtual bool IsGroupVisiblityChanged(MarkGroupID groupID) const = 0;
virtual MarkIDSet const & GetGroupPointIds(MarkGroupID groupID) const = 0;
- virtual MarkIDSet const & GetGroupLineIds(MarkGroupID groupID) const = 0;
+ virtual LineIDSet const & GetGroupLineIds(MarkGroupID groupID) const = 0;
virtual MarkIDSet const & GetCreatedMarkIds() const = 0;
virtual MarkIDSet const & GetRemovedMarkIds() const = 0;
virtual MarkIDSet const & GetUpdatedMarkIds() const = 0;
/// Never store UserPointMark reference.
virtual UserPointMark const * GetUserPointMark(MarkID markID) const = 0;
/// Never store UserLineMark reference.
- virtual UserLineMark const * GetUserLineMark(MarkID markID) const = 0;
+ virtual UserLineMark const * GetUserLineMark(LineID lineID) const = 0;
};
} // namespace df