Removing track DisplayList if the track goes to invisible state.

This commit is contained in:
Vladimir Byko-Ianko 2015-03-18 13:59:22 +03:00 committed by Alex Zolotarev
parent 194c42af99
commit e5aa3f18c2
3 changed files with 12 additions and 12 deletions

View file

@ -130,6 +130,10 @@ void BookmarkManager::DrawCategory(BookmarkCategory const * cat, PaintOverlayEve
{
#ifndef USE_DRAPE
/// TODO cutomize draw in UserMarkContainer for user Draw method
ASSERT(cat, ());
if (!cat->IsVisible())
return;
Navigator const & navigator = m_framework.GetNavigator();
ScreenBase const & screen = navigator.Screen();
@ -275,14 +279,15 @@ void BookmarkManager::DrawItems(shared_ptr<PaintEvent> const & e) const
auto dlUpdateFn = [&trackUpdateFn] (BookmarkCategory const * cat)
{
if (cat->IsVisible())
bool const isVisible = cat->IsVisible();
for (size_t j = 0; j < cat->GetTracksCount(); ++j)
{
for (size_t j = 0; j < cat->GetTracksCount(); ++j)
{
Track const * track = cat->GetTrack(j);
ASSERT(track, ());
Track const * track = cat->GetTrack(j);
ASSERT(track, ());
if (isVisible)
trackUpdateFn(track);
}
else
track->CleanUp();
}
};

View file

@ -117,7 +117,6 @@ double Track::GetLengthMeters() const
void Track::Swap(Track & rhs)
{
swap(m_isVisible, rhs.m_isVisible);
swap(m_rect, rhs.m_rect);
swap(m_outlines, rhs.m_outlines);
m_name.swap(rhs.m_name);

View file

@ -42,8 +42,7 @@ public:
virtual ~Track();
explicit Track(PolylineD const & polyline)
: m_isVisible(true),
m_polyline(polyline)
: m_polyline(polyline)
{
ASSERT_GREATER(polyline.GetSize(), 1, ());
@ -63,8 +62,6 @@ public:
/// @name Simple Getters-Setter
//@{
bool IsVisible() const { return m_isVisible; }
void SetVisible(bool visible) { m_isVisible = visible; }
struct TrackOutline
{
@ -90,7 +87,6 @@ protected:
void DeleteDisplayList() const;
private:
bool m_isVisible = false;
string m_name;
vector<TrackOutline> m_outlines;