Fixed user marks updating.

This commit is contained in:
Daria Volvenkova 2017-06-30 18:25:19 +03:00 committed by Roman Kuznetsov
parent 94b0cfac7c
commit d615f042fb
5 changed files with 10 additions and 18 deletions

View file

@ -26,19 +26,19 @@ void UserMarkGenerator::ClearUserMarks(GroupID groupId)
UpdateLinesIndex(groupId);
}
void UserMarkGenerator::SetUserMarks(uint32_t groupId, drape_ptr<UserMarksRenderCollection> && marks)
void UserMarkGenerator::SetUserMarks(GroupID groupId, drape_ptr<UserMarksRenderCollection> && marks)
{
m_marks.insert(std::make_pair(groupId, std::move(marks)));
m_marks[groupId] = std::move(marks);
UpdateMarksIndex(groupId);
}
void UserMarkGenerator::SetUserLines(uint32_t groupId, drape_ptr<UserLinesRenderCollection> && lines)
void UserMarkGenerator::SetUserLines(GroupID groupId, drape_ptr<UserLinesRenderCollection> && lines)
{
m_lines.insert(std::make_pair(groupId, std::move(lines)));
m_lines[groupId] = std::move(lines);
UpdateLinesIndex(groupId);
}
void UserMarkGenerator::UpdateMarksIndex(uint32_t groupId)
void UserMarkGenerator::UpdateMarksIndex(GroupID groupId)
{
for (auto & tileGroups : m_marksIndex)
{
@ -65,7 +65,7 @@ void UserMarkGenerator::UpdateMarksIndex(uint32_t groupId)
CleanIndex();
}
void UserMarkGenerator::UpdateLinesIndex(uint32_t groupId)
void UserMarkGenerator::UpdateLinesIndex(GroupID groupId)
{
for (auto & tileGroups : m_marksIndex)
{

View file

@ -12,7 +12,7 @@
namespace df
{
using GroupID = uint32_t;
using GroupID = size_t;
using MarkGroups = std::map<GroupID, drape_ptr<UserMarksRenderCollection>>;
using LineGroups = std::map<GroupID, drape_ptr<UserLinesRenderCollection>>;

View file

@ -6,20 +6,14 @@ df::UserMarksProvider::UserMarksProvider()
{
}
void df::UserMarksProvider::BeginRead()
{
Lock();
}
bool df::UserMarksProvider::IsDirty() const
{
return m_isDirty;
}
void df::UserMarksProvider::EndRead()
void df::UserMarksProvider::ResetDirty()
{
m_isDirty = false;
Unlock();
}
void df::UserMarksProvider::IncrementCounter()

View file

@ -43,8 +43,6 @@ public:
UserMarksProvider();
virtual ~UserMarksProvider() {}
void BeginRead();
bool IsDirty() const;
virtual bool IsDrawable() const = 0;
@ -56,8 +54,6 @@ public:
/// never store UserLineMark reference
virtual UserLineMark const * GetUserLineMark(size_t index) const = 0;
void EndRead();
void IncrementCounter();
void DecrementCounter();
bool CanBeDeleted();
@ -67,6 +63,7 @@ public:
protected:
void BeginWrite();
void SetDirty();
void ResetDirty();
void EndWrite();
private:

View file

@ -134,6 +134,7 @@ void UserMarkContainer::ReleaseController()
engine->ClearUserMarksLayer(layerId);
else
engine->UpdateUserMarksLayer(layerId, this);
ResetDirty();
}
}