forked from organicmaps/organicmaps
[drape] old code removed
preparations for track rendering
This commit is contained in:
parent
a98f5b689b
commit
b5598f55b3
14 changed files with 512 additions and 500 deletions
|
@ -73,7 +73,7 @@ void CacheUserMarks(UserMarksProvider const * provider,
|
|||
dp::RefPointer<dp::Batcher> batcher,
|
||||
dp::RefPointer<dp::TextureManager> textures)
|
||||
{
|
||||
size_t markCount = provider->GetCount();
|
||||
size_t markCount = provider->GetPointCount();
|
||||
if (markCount == 0)
|
||||
return;
|
||||
|
||||
|
@ -88,14 +88,24 @@ void CacheUserMarks(UserMarksProvider const * provider,
|
|||
buffer_vector<gpu::SolidTexturingVertex, 1024> buffer;
|
||||
buffer.reserve(vertexCount);
|
||||
|
||||
dp::TextureManager::SymbolRegion region;
|
||||
vector<UserPointMark const *> marks;
|
||||
for (size_t i = 0; i < markCount; ++i)
|
||||
marks.push_back(provider->GetUserPointMark(i));
|
||||
|
||||
sort(marks.begin(), marks.end(), [](UserPointMark const * v1, UserPointMark const * v2)
|
||||
{
|
||||
textures->GetSymbolRegion(provider->GetSymbolName(i), region);
|
||||
return v1->GetPivot().y < v2->GetPivot().y;
|
||||
});
|
||||
|
||||
dp::TextureManager::SymbolRegion region;
|
||||
for (size_t i = 0; i < marks.size(); ++i)
|
||||
{
|
||||
UserPointMark const * pointMark = marks[i];
|
||||
textures->GetSymbolRegion(pointMark->GetSymbolName(), region);
|
||||
m2::RectF const & texRect = region.GetTexRect();
|
||||
m2::PointF pxSize = region.GetPixelSize();
|
||||
dp::Anchor anchor = provider->GetAnchor(i);
|
||||
glsl::vec3 pos = glsl::vec3(glsl::ToVec2(provider->GetPivot(i)), provider->GetDepth(i));
|
||||
dp::Anchor anchor = pointMark->GetAnchor();
|
||||
glsl::vec3 pos = glsl::vec3(glsl::ToVec2(pointMark->GetPivot()), pointMark->GetDepth() + 10 * (markCount - i));
|
||||
|
||||
glsl::vec2 left, right, up, down;
|
||||
AlignHorizontal(pxSize.x * 0.5f, anchor, left, right);
|
||||
|
|
|
@ -11,6 +11,30 @@
|
|||
namespace df
|
||||
{
|
||||
|
||||
class UserPointMark
|
||||
{
|
||||
public:
|
||||
virtual ~UserPointMark() {}
|
||||
virtual m2::PointD const & GetPivot() const = 0;
|
||||
virtual string GetSymbolName() const = 0;
|
||||
virtual dp::Anchor GetAnchor() const = 0;
|
||||
virtual float GetDepth() const = 0;
|
||||
};
|
||||
|
||||
class UserLineMark
|
||||
{
|
||||
public:
|
||||
virtual ~UserLineMark() {}
|
||||
|
||||
virtual dp::Color const & GetColor() const = 0;
|
||||
virtual float GetWidth() const = 0;
|
||||
|
||||
/// Line geometry enumeration
|
||||
virtual bool HasPoint() const = 0;
|
||||
virtual m2::PointD const & GetCurrentPoint() const = 0;
|
||||
virtual void Advance() const = 0;
|
||||
};
|
||||
|
||||
class UserMarksProvider
|
||||
{
|
||||
public:
|
||||
|
@ -20,11 +44,15 @@ public:
|
|||
void BeginRead();
|
||||
bool IsDirty() const;
|
||||
virtual bool IsDrawable() const = 0;
|
||||
virtual size_t GetCount() const = 0;
|
||||
virtual m2::PointD const & GetPivot(size_t index) const = 0;
|
||||
virtual string const & GetSymbolName(size_t index) const = 0;
|
||||
virtual dp::Anchor GetAnchor(size_t index) const = 0;
|
||||
virtual float GetDepth(size_t index) const = 0;
|
||||
|
||||
virtual size_t GetPointCount() const = 0;
|
||||
/// never store UserPointMark reference
|
||||
virtual UserPointMark const * GetUserPointMark(size_t index) const = 0;
|
||||
|
||||
virtual size_t GetLineCount() const = 0;
|
||||
/// never store UserLineMark reference
|
||||
virtual UserLineMark const * GetUserLineMark(size_t index) const = 0;
|
||||
virtual
|
||||
void EndRead();
|
||||
|
||||
void IncrementCounter();
|
||||
|
|
191
map/bookmark.cpp
191
map/bookmark.cpp
|
@ -30,28 +30,47 @@
|
|||
#include "std/algorithm.hpp"
|
||||
#include "std/auto_ptr.hpp"
|
||||
|
||||
|
||||
Bookmark::Bookmark(m2::PointD const & ptOrg, UserMarkContainer * container)
|
||||
: TBase(ptOrg, container)
|
||||
{
|
||||
}
|
||||
|
||||
Bookmark::Bookmark(BookmarkData const & data, m2::PointD const & ptOrg, UserMarkContainer * container)
|
||||
: TBase(ptOrg, container)
|
||||
, m_data(data)
|
||||
{
|
||||
}
|
||||
|
||||
void Bookmark::SetData(BookmarkData const & data)
|
||||
{
|
||||
m_data = data;
|
||||
}
|
||||
|
||||
BookmarkData const & Bookmark::GetData() const
|
||||
{ return m_data;
|
||||
}
|
||||
|
||||
dp::Anchor Bookmark::GetAnchor() const
|
||||
{
|
||||
return dp::Bottom;
|
||||
}
|
||||
|
||||
string Bookmark::GetSymbolName() const
|
||||
{
|
||||
return GetType();
|
||||
}
|
||||
|
||||
UserMark::Type Bookmark::GetMarkType() const
|
||||
{
|
||||
return UserMark::Type::BOOKMARK;
|
||||
}
|
||||
|
||||
unique_ptr<UserMarkCopy> Bookmark::Copy() const
|
||||
{
|
||||
return unique_ptr<UserMarkCopy>(new UserMarkCopy(this, false));
|
||||
}
|
||||
|
||||
double Bookmark::GetAnimScaleFactor() const
|
||||
{
|
||||
return m_animScaleFactor;
|
||||
}
|
||||
|
||||
m2::PointD const & Bookmark::GetPixelOffset() const
|
||||
{
|
||||
static m2::PointD s_offset(0.0, 3.0);
|
||||
return s_offset;
|
||||
}
|
||||
|
||||
shared_ptr<anim::Task> Bookmark::CreateAnimTask(Framework & fm)
|
||||
{
|
||||
m_animScaleFactor = 0.0;
|
||||
return CreateDefaultPinAnim(fm, m_animScaleFactor);
|
||||
}
|
||||
|
||||
void Bookmark::FillLogEvent(TEventContainer & details) const
|
||||
{
|
||||
UserMark::FillLogEvent(details);
|
||||
|
@ -59,6 +78,63 @@ void Bookmark::FillLogEvent(TEventContainer & details) const
|
|||
details.emplace("name", GetData().GetName());
|
||||
}
|
||||
|
||||
string const & Bookmark::GetName() const
|
||||
{
|
||||
return m_data.GetName();
|
||||
}
|
||||
|
||||
void Bookmark::SetName(string const & name)
|
||||
{
|
||||
m_data.SetName(name);
|
||||
}
|
||||
|
||||
string const & Bookmark::GetType() const
|
||||
{
|
||||
return m_data.GetType();
|
||||
}
|
||||
|
||||
void Bookmark::SetType(string const & type)
|
||||
{
|
||||
m_data.SetType(type);
|
||||
}
|
||||
|
||||
m2::RectD Bookmark::GetViewport() const
|
||||
{
|
||||
return m2::RectD(GetPivot(), GetPivot());
|
||||
}
|
||||
|
||||
string const & Bookmark::GetDescription() const
|
||||
{
|
||||
return m_data.GetDescription();
|
||||
}
|
||||
|
||||
void Bookmark::SetDescription(string const & description)
|
||||
{
|
||||
m_data.SetDescription(description);
|
||||
}
|
||||
|
||||
time_t Bookmark::GetTimeStamp() const
|
||||
{
|
||||
return m_data.GetTimeStamp();
|
||||
}
|
||||
|
||||
void Bookmark::SetTimeStamp(time_t timeStamp)
|
||||
{
|
||||
m_data.SetTimeStamp(timeStamp);
|
||||
}
|
||||
|
||||
double Bookmark::GetScale() const
|
||||
{
|
||||
return m_data.GetScale();
|
||||
}
|
||||
|
||||
void Bookmark::SetScale(double scale)
|
||||
{
|
||||
m_data.SetScale(scale);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
void BookmarkCategory::AddTrack(Track & track)
|
||||
{
|
||||
m_tracks.push_back(track.CreatePersistent());
|
||||
|
@ -69,64 +145,6 @@ Track const * BookmarkCategory::GetTrack(size_t index) const
|
|||
return (index < m_tracks.size() ? m_tracks[index] : 0);
|
||||
}
|
||||
|
||||
//void BookmarkCategory::AddBookmark(m2::PointD const & ptOrg, BookmarkData const & bm)
|
||||
//{
|
||||
// UserMark * mark = base_t::GetController().CreateUserMark(ptOrg);
|
||||
// static_cast<Bookmark *>(mark)->SetData(bm);
|
||||
//}
|
||||
|
||||
//void BookmarkCategory::ReplaceBookmark(size_t index, BookmarkData const & bm)
|
||||
//{
|
||||
// Controller & c = base_t::GetController();
|
||||
// ASSERT_LESS (index, c.GetUserMarkCount(), ());
|
||||
// if (index < c.GetUserMarkCount())
|
||||
// {
|
||||
// Bookmark * mark = static_cast<Bookmark *>(c.GetUserMarkForEdit(index));
|
||||
// mark->SetData(bm);
|
||||
// }
|
||||
//}
|
||||
|
||||
//void BookmarkCategory::DeleteBookmark(size_t index)
|
||||
//{
|
||||
// base_t::Controller & c = base_t::GetController();
|
||||
// ASSERT_LESS(index, c.GetUserMarkCount(), ());
|
||||
// UserMark const * markForDelete = c.GetUserMark(index);
|
||||
|
||||
// int animIndex = -1;
|
||||
// for (size_t i = 0; i < m_anims.size(); ++i)
|
||||
// {
|
||||
// anim_node_t const & anim = m_anims[i];
|
||||
// if (anim.first == markForDelete)
|
||||
// {
|
||||
// anim.second->Cancel();
|
||||
// animIndex = i;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (animIndex != -1)
|
||||
// m_anims.erase(m_anims.begin() + animIndex);
|
||||
|
||||
// c.DeleteUserMark(index);
|
||||
//}
|
||||
|
||||
//size_t BookmarkCategory::GetBookmarksCount() const
|
||||
//{
|
||||
// return base_t::GetController().GetUserMarkCount();
|
||||
//}
|
||||
|
||||
//Bookmark const * BookmarkCategory::GetBookmark(size_t index) const
|
||||
//{
|
||||
// base_t::Controller const & c = base_t::GetController();
|
||||
// return static_cast<Bookmark const *>(index < c.GetUserMarkCount() ? c.GetUserMark(index) : 0);
|
||||
//}
|
||||
|
||||
//Bookmark * BookmarkCategory::GetBookmark(size_t index)
|
||||
//{
|
||||
// base_t::Controller & c = base_t::GetController();
|
||||
// return static_cast<Bookmark *>(index < c.GetUserMarkCount() ? c.GetUserMarkForEdit(index) : 0);
|
||||
//}
|
||||
|
||||
BookmarkCategory::BookmarkCategory(string const & name, Framework & framework)
|
||||
: TBase(0.0/*graphics::bookmarkDepth*/, UserMarkType::BOOKMARK_MARK, framework)
|
||||
, m_name(name)
|
||||
|
@ -138,28 +156,9 @@ BookmarkCategory::~BookmarkCategory()
|
|||
ClearTracks();
|
||||
}
|
||||
|
||||
string const & BookmarkCategory::GetSymbolName(size_t index) const
|
||||
{
|
||||
Bookmark const * bm = static_cast<Bookmark const *>(GetUserMark(index));
|
||||
return bm->GetData().GetType();
|
||||
}
|
||||
|
||||
dp::Anchor BookmarkCategory::GetAnchor(size_t index) const
|
||||
{
|
||||
UNUSED_VALUE(index);
|
||||
return dp::Bottom;
|
||||
}
|
||||
|
||||
void BookmarkCategory::ClearBookmarks()
|
||||
{
|
||||
RequestController().Clear();
|
||||
ReleaseController();
|
||||
}
|
||||
|
||||
void BookmarkCategory::ClearTracks()
|
||||
{
|
||||
for_each(m_tracks.begin(), m_tracks.end(), DeleteFunctor());
|
||||
m_tracks.clear();
|
||||
DeleteRange(m_tracks, DeleteFunctor());
|
||||
}
|
||||
|
||||
namespace
|
||||
|
@ -735,7 +734,7 @@ void BookmarkCategory::SaveToKML(ostream & s)
|
|||
}
|
||||
|
||||
s << " <styleUrl>#" << bm->GetType() << "</styleUrl>\n"
|
||||
<< " <Point><coordinates>" << PointToString(bm->GetOrg()) << "</coordinates></Point>\n";
|
||||
<< " <Point><coordinates>" << PointToString(bm->GetPivot()) << "</coordinates></Point>\n";
|
||||
|
||||
double const scale = bm->GetScale();
|
||||
if (scale != -1.0)
|
||||
|
|
|
@ -66,57 +66,50 @@ private:
|
|||
time_t m_timeStamp;
|
||||
};
|
||||
|
||||
class Bookmark : public style::StyledPoint
|
||||
class Bookmark : public UserMark, public style::StyledPoint
|
||||
{
|
||||
BookmarkData m_data;
|
||||
double m_animScaleFactor;
|
||||
|
||||
using TBase = UserMark;
|
||||
public:
|
||||
Bookmark(m2::PointD const & ptOrg, UserMarkContainer * container)
|
||||
: StyledPoint(ptOrg, container), m_animScaleFactor(1.0)
|
||||
{
|
||||
}
|
||||
Bookmark(m2::PointD const & ptOrg, UserMarkContainer * container);
|
||||
|
||||
Bookmark(BookmarkData const & data, m2::PointD const & ptOrg, UserMarkContainer * container)
|
||||
: StyledPoint(ptOrg, container), m_data(data), m_animScaleFactor(1.0)
|
||||
{
|
||||
}
|
||||
Bookmark(BookmarkData const & data, m2::PointD const & ptOrg,
|
||||
UserMarkContainer * container);
|
||||
|
||||
void SetData(BookmarkData const & data) { m_data = data; }
|
||||
void SetData(BookmarkData const & data);
|
||||
BookmarkData const & GetData() const;
|
||||
|
||||
BookmarkData const & GetData() const { return m_data; }
|
||||
dp::Anchor GetAnchor() const override;
|
||||
string GetSymbolName() const override;
|
||||
|
||||
virtual Type GetMarkType() const override { return UserMark::Type::BOOKMARK; }
|
||||
virtual void FillLogEvent(TEventContainer & details) const override;
|
||||
Type GetMarkType() const override;
|
||||
void FillLogEvent(TEventContainer & details) const override;
|
||||
|
||||
string const & GetName() const { return m_data.GetName(); }
|
||||
void SetName(string const & name) { m_data.SetName(name); }
|
||||
string const & GetName() const;
|
||||
void SetName(string const & name);
|
||||
/// @return Now its a bookmark color - name of icon file
|
||||
string const & GetType() const { return m_data.GetType(); }
|
||||
string const & GetType() const;
|
||||
void SetType(string const & type);
|
||||
m2::RectD GetViewport() const;
|
||||
|
||||
void SetType(string const & type) { m_data.SetType(type); }
|
||||
|
||||
m2::RectD GetViewport() const { return m2::RectD(GetOrg(), GetOrg()); }
|
||||
|
||||
string const & GetDescription() const { return m_data.GetDescription(); }
|
||||
void SetDescription(string const & description) { m_data.SetDescription(description); }
|
||||
string const & GetDescription() const;
|
||||
void SetDescription(string const & description);
|
||||
|
||||
/// @return my::INVALID_TIME_STAMP if bookmark has no timestamp
|
||||
time_t GetTimeStamp() const { return m_data.GetTimeStamp(); }
|
||||
void SetTimeStamp(time_t timeStamp) { m_data.SetTimeStamp(timeStamp); }
|
||||
time_t GetTimeStamp() const;
|
||||
void SetTimeStamp(time_t timeStamp);
|
||||
|
||||
double GetScale() const { return m_data.GetScale(); }
|
||||
void SetScale(double scale) { m_data.SetScale(scale); }
|
||||
double GetScale() const;
|
||||
void SetScale(double scale);
|
||||
|
||||
unique_ptr<UserMarkCopy> Copy() const override;
|
||||
|
||||
//virtual graphics::DisplayList * GetDisplayList(UserMarkDLCache * cache) const;
|
||||
virtual double GetAnimScaleFactor() const;
|
||||
virtual m2::PointD const & GetPixelOffset() const;
|
||||
shared_ptr<anim::Task> CreateAnimTask(Framework & fm);
|
||||
|
||||
// StyledPoint overrides:
|
||||
double GetAnimScaleFactor() const override;
|
||||
m2::PointD const & GetPixelOffset() const override;
|
||||
string const & GetStyle() const override { return m_data.GetType(); }
|
||||
|
||||
private:
|
||||
BookmarkData m_data;
|
||||
};
|
||||
|
||||
class BookmarkCategory : public UserMarkContainer
|
||||
|
@ -156,14 +149,10 @@ public:
|
|||
BookmarkCategory(string const & name, Framework & framework);
|
||||
~BookmarkCategory();
|
||||
|
||||
virtual string const & GetSymbolName(size_t index) const;
|
||||
virtual dp::Anchor GetAnchor(size_t index) const;
|
||||
|
||||
void ClearBookmarks();
|
||||
void ClearTracks();
|
||||
|
||||
static string GetDefaultType();
|
||||
|
||||
void ClearTracks();
|
||||
|
||||
/// @name Tracks routine.
|
||||
//@{
|
||||
/// @note Move semantics is used here.
|
||||
|
|
|
@ -55,107 +55,6 @@ void BookmarkManager::LoadState()
|
|||
Settings::Get(BOOKMARK_TYPE, m_lastType);
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
class LazyMatrixCalc
|
||||
{
|
||||
ScreenBase const & m_screen;
|
||||
double & m_lastScale;
|
||||
|
||||
typedef ScreenBase::MatrixT MatrixT;
|
||||
MatrixT m_matrix;
|
||||
double m_resScale;
|
||||
bool m_scaleChanged;
|
||||
|
||||
void CalcScaleG2P()
|
||||
{
|
||||
// Check whether viewport scale changed since the last drawing.
|
||||
m_scaleChanged = false;
|
||||
double const d = m_lastScale / m_screen.GetScale();
|
||||
if (d >= 2.0 || d <= 0.5)
|
||||
{
|
||||
m_scaleChanged = true;
|
||||
m_lastScale = m_screen.GetScale();
|
||||
}
|
||||
|
||||
// GtoP matrix for scaling only (with change Y-axis direction).
|
||||
m_resScale = 1.0 / m_lastScale;
|
||||
m_matrix = math::Scale(math::Identity<double, 3>(), m_resScale, -m_resScale);
|
||||
}
|
||||
|
||||
public:
|
||||
LazyMatrixCalc(ScreenBase const & screen, double & lastScale)
|
||||
: m_screen(screen), m_lastScale(lastScale), m_resScale(0.0)
|
||||
{
|
||||
}
|
||||
|
||||
bool IsScaleChanged()
|
||||
{
|
||||
if (m_resScale == 0.0)
|
||||
CalcScaleG2P();
|
||||
return m_scaleChanged;
|
||||
}
|
||||
|
||||
MatrixT const & GetScaleG2P()
|
||||
{
|
||||
if (m_resScale == 0.0)
|
||||
CalcScaleG2P();
|
||||
return m_matrix;
|
||||
}
|
||||
|
||||
MatrixT const & GetFinalG2P()
|
||||
{
|
||||
if (m_resScale == 0.0)
|
||||
{
|
||||
// Final GtoP matrix for drawing track's display lists.
|
||||
m_resScale = m_lastScale / m_screen.GetScale();
|
||||
m_matrix =
|
||||
math::Shift(
|
||||
math::Scale(
|
||||
math::Rotate(math::Identity<double, 3>(), m_screen.GetAngle()),
|
||||
m_resScale, m_resScale),
|
||||
m_screen.GtoP(m2::PointD(0.0, 0.0)));
|
||||
}
|
||||
return m_matrix;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
void BookmarkManager::PrepareToShutdown()
|
||||
{
|
||||
m_routeRenderer->PrepareToShutdown();
|
||||
}
|
||||
|
||||
void BookmarkManager::DrawCategory(BookmarkCategory const * cat, PaintOverlayEvent const & e) const
|
||||
{
|
||||
///@TODO UVR
|
||||
//#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();
|
||||
|
||||
// Drawer * pDrawer = e.GetDrawer();
|
||||
// graphics::Screen * pScreen = pDrawer->screen();
|
||||
|
||||
// LazyMatrixCalc matrix(screen, m_lastScale);
|
||||
|
||||
// // Draw tracks.
|
||||
// for (size_t i = 0; i < cat->GetTracksCount(); ++i)
|
||||
// {
|
||||
// Track const * track = cat->GetTrack(i);
|
||||
// if (track->HasDisplayList())
|
||||
// track->Draw(pScreen, matrix.GetFinalG2P());
|
||||
// }
|
||||
|
||||
// cat->Draw(e, m_cache);
|
||||
//#endif // USE_DRAPE
|
||||
}
|
||||
|
||||
void BookmarkManager::ClearItems()
|
||||
{
|
||||
for_each(m_categories.begin(), m_categories.end(), DeleteFunctor());
|
||||
|
@ -208,7 +107,7 @@ size_t BookmarkManager::MoveBookmark(size_t bmIndex, size_t curCatIndex, size_t
|
|||
BookmarkCategory::Guard guard(*cat);
|
||||
Bookmark const * bm = static_cast<Bookmark const *>(guard.m_controller.GetUserMark(bmIndex));
|
||||
BookmarkData data = bm->GetData();
|
||||
m2::PointD ptOrg = bm->GetOrg();
|
||||
m2::PointD ptOrg = bm->GetPivot();
|
||||
|
||||
guard.m_controller.DeleteUserMark(bmIndex);
|
||||
cat->SaveToKMLFile();
|
||||
|
@ -257,65 +156,6 @@ size_t BookmarkManager::CreateBmCategory(string const & name)
|
|||
return (m_categories.size()-1);
|
||||
}
|
||||
|
||||
void BookmarkManager::DrawItems(Drawer * drawer) const
|
||||
{
|
||||
//@TODO UVR
|
||||
//ASSERT(m_cache != NULL, ());
|
||||
//ASSERT(m_framework.GetLocationState(), ());
|
||||
|
||||
//ScreenBase const & screen = m_framework.GetNavigator().Screen();
|
||||
//m2::RectD const limitRect = screen.ClipRect();
|
||||
|
||||
//LazyMatrixCalc matrix(screen, m_lastScale);
|
||||
|
||||
//double const drawScale = m_framework.GetDrawScale();
|
||||
//double const visualScale = m_framework.GetVisualScale();
|
||||
//location::RouteMatchingInfo const & matchingInfo = m_framework.GetLocationState()->GetRouteMatchingInfo();
|
||||
|
||||
//auto trackUpdateFn = [&](Track const * track)
|
||||
//{
|
||||
// ASSERT(track, ());
|
||||
// if (limitRect.IsIntersect(track->GetLimitRect()))
|
||||
// track->CreateDisplayList(m_bmScreen, matrix.GetScaleG2P(), matrix.IsScaleChanged(), drawScale, visualScale, matchingInfo);
|
||||
// else
|
||||
// track->CleanUp();
|
||||
//};
|
||||
|
||||
//auto dlUpdateFn = [&trackUpdateFn] (BookmarkCategory const * cat)
|
||||
//{
|
||||
// bool const isVisible = cat->IsVisible();
|
||||
// for (size_t j = 0; j < cat->GetTracksCount(); ++j)
|
||||
// {
|
||||
// Track const * track = cat->GetTrack(j);
|
||||
// ASSERT(track, ());
|
||||
// if (isVisible)
|
||||
// trackUpdateFn(track);
|
||||
// else
|
||||
// track->CleanUp();
|
||||
// }
|
||||
//};
|
||||
|
||||
// Update track's display lists.
|
||||
//for (size_t i = 0; i < m_categories.size(); ++i)
|
||||
//{
|
||||
// BookmarkCategory const * cat = m_categories[i];
|
||||
// ASSERT(cat, ());
|
||||
// dlUpdateFn(cat);
|
||||
//}
|
||||
|
||||
//graphics::Screen * pScreen = GPUDrawer::GetScreen(drawer);
|
||||
//pScreen->beginFrame();
|
||||
|
||||
//PaintOverlayEvent event(drawer, screen);
|
||||
//for_each(m_userMarkLayers.begin(), m_userMarkLayers.end(), bind(&UserMarkContainer::Draw, _1, event, m_cache));
|
||||
//for_each(m_categories.begin(), m_categories.end(), bind(&BookmarkManager::DrawCategory, this, _1, event));
|
||||
//m_routeRenderer->Render(pScreen, screen);
|
||||
//m_selection.Draw(event, m_cache);
|
||||
|
||||
//pScreen->endFrame();
|
||||
#endif // USE_DRAPE
|
||||
}
|
||||
|
||||
void BookmarkManager::DeleteBmCategory(CategoryIter i)
|
||||
{
|
||||
BookmarkCategory * cat = *i;
|
||||
|
@ -338,26 +178,6 @@ bool BookmarkManager::DeleteBmCategory(size_t index)
|
|||
return false;
|
||||
}
|
||||
|
||||
///@TODO UVR
|
||||
//void BookmarkManager::ActivateMark(UserMark const * mark, bool needAnim)
|
||||
//{
|
||||
// m_selection.ActivateMark(mark, needAnim);
|
||||
//}
|
||||
|
||||
//bool BookmarkManager::UserMarkHasActive() const
|
||||
//{
|
||||
// return m_selection.IsActive();
|
||||
//}
|
||||
|
||||
//bool BookmarkManager::IsUserMarkActive(UserMark const * mark) const
|
||||
//{
|
||||
// if (mark == nullptr)
|
||||
// return false;
|
||||
|
||||
// return (m_selection.m_container == mark->GetContainer() &&
|
||||
// m_selection.m_ptOrg.EqualDxDy(mark->GetOrg(), 1.0E-4));
|
||||
//}
|
||||
|
||||
namespace
|
||||
{
|
||||
class BestUserMarkFinder
|
||||
|
|
|
@ -26,8 +26,6 @@ class BookmarkManager : private noncopyable
|
|||
|
||||
typedef vector<BookmarkCategory *>::iterator CategoryIter;
|
||||
|
||||
void DrawCategory(BookmarkCategory const * cat, PaintOverlayEvent const & e) const;
|
||||
|
||||
void SaveState() const;
|
||||
void LoadState();
|
||||
|
||||
|
@ -65,11 +63,7 @@ public:
|
|||
void DeleteBmCategory(CategoryIter i);
|
||||
bool DeleteBmCategory(size_t index);
|
||||
|
||||
//void ActivateMark(UserMark const * mark, bool needAnim);
|
||||
//bool UserMarkHasActive() const;
|
||||
//bool IsUserMarkActive(UserMark const * container) const;
|
||||
|
||||
typedef function<m2::AnyRectD const & (UserMarkContainer::Type)> TTouchRectHolder;
|
||||
typedef function<m2::AnyRectD const & (UserMarkType)> TTouchRectHolder;
|
||||
|
||||
UserMark const * FindNearestUserMark(m2::AnyRectD const & rect) const;
|
||||
UserMark const * FindNearestUserMark(TTouchRectHolder const & holder) const;
|
||||
|
|
|
@ -1863,8 +1863,8 @@ StringsBundle const & Framework::GetStringsBundle()
|
|||
|
||||
string Framework::CodeGe0url(Bookmark const * bmk, bool addName)
|
||||
{
|
||||
double lat = MercatorBounds::YToLat(bmk->GetOrg().y);
|
||||
double lon = MercatorBounds::XToLon(bmk->GetOrg().x);
|
||||
double lat = MercatorBounds::YToLat(bmk->GetPivot().y);
|
||||
double lon = MercatorBounds::XToLon(bmk->GetPivot().x);
|
||||
return CodeGe0url(lat, lon, bmk->GetScale(), addName ? bmk->GetName() : "");
|
||||
}
|
||||
|
||||
|
|
|
@ -64,6 +64,7 @@ SOURCES += \
|
|||
routing_session.cpp \
|
||||
storage_bridge.cpp \
|
||||
track.cpp \
|
||||
user_mark.cpp \
|
||||
user_mark_container.cpp \
|
||||
|
||||
!iphone*:!tizen*:!android* {
|
||||
|
|
|
@ -135,7 +135,7 @@ char const * kmlString =
|
|||
TEST_EQUAL(bm->GetTimeStamp(), 524214643, ());
|
||||
|
||||
bm = static_cast<Bookmark const *>(cat.GetUserMark(1));
|
||||
m2::PointD org = bm->GetOrg();
|
||||
m2::PointD org = bm->GetPivot();
|
||||
TEST_ALMOST_EQUAL_ULPS(MercatorBounds::XToLon(org.x), 27.566765, ());
|
||||
TEST_ALMOST_EQUAL_ULPS(MercatorBounds::YToLat(org.y), 53.900047, ());
|
||||
TEST_EQUAL(bm->GetName(), "From: Минск, Минская область, Беларусь", ());
|
||||
|
@ -144,7 +144,7 @@ char const * kmlString =
|
|||
TEST_EQUAL(bm->GetTimeStamp(), 888888888, ());
|
||||
|
||||
bm = static_cast<Bookmark const *>(cat.GetUserMark(0));
|
||||
org = bm->GetOrg();
|
||||
org = bm->GetPivot();
|
||||
TEST_ALMOST_EQUAL_ULPS(MercatorBounds::XToLon(org.x), 27.551532, ());
|
||||
TEST_ALMOST_EQUAL_ULPS(MercatorBounds::YToLat(org.y), 53.89306, ());
|
||||
TEST_EQUAL(bm->GetName(), "<MWM & Sons>", ());
|
||||
|
@ -606,7 +606,7 @@ char const * kmlString3 =
|
|||
return false;
|
||||
if (b1.GetType() != b2.GetType())
|
||||
return false;
|
||||
if (!m2::AlmostEqualULPs(b1.GetOrg(), b2.GetOrg()))
|
||||
if (!m2::AlmostEqualULPs(b1.GetPivot(), b2.GetPivot()))
|
||||
return false;
|
||||
if (!my::AlmostEqualULPs(b1.GetScale(), b2.GetScale()))
|
||||
return false;
|
||||
|
|
|
@ -47,16 +47,16 @@ UNIT_TEST(KMZ_UnzipTest)
|
|||
Bookmark const * bm = static_cast<Bookmark const *>(cat.GetUserMark(5));
|
||||
TEST_EQUAL(bm->GetName(), ("Lahaina Breakwall"), ("KML wrong name!"));
|
||||
TEST_EQUAL(bm->GetType(), "placemark-red", ("KML wrong type!"));
|
||||
TEST_ALMOST_EQUAL_ULPS(bm->GetOrg().x, -156.6777046791284, ("KML wrong org x!"));
|
||||
TEST_ALMOST_EQUAL_ULPS(bm->GetOrg().y, 21.34256685860084, ("KML wrong org y!"));
|
||||
TEST_ALMOST_EQUAL_ULPS(bm->GetPivot().x, -156.6777046791284, ("KML wrong org x!"));
|
||||
TEST_ALMOST_EQUAL_ULPS(bm->GetPivot().y, 21.34256685860084, ("KML wrong org y!"));
|
||||
TEST_EQUAL(bm->GetScale(), -1, ("KML wrong scale!"));
|
||||
}
|
||||
{
|
||||
Bookmark const * bm = static_cast<Bookmark const *>(cat.GetUserMark(4));
|
||||
TEST_EQUAL(bm->GetName(), ("Seven Sacred Pools, Kipahulu"), ("KML wrong name!"));
|
||||
TEST_EQUAL(bm->GetType(), "placemark-red", ("KML wrong type!"));
|
||||
TEST_ALMOST_EQUAL_ULPS(bm->GetOrg().x, -156.0405130750025, ("KML wrong org x!"));
|
||||
TEST_ALMOST_EQUAL_ULPS(bm->GetOrg().y, 21.12480639056074, ("KML wrong org y!"));
|
||||
TEST_ALMOST_EQUAL_ULPS(bm->GetPivot().x, -156.0405130750025, ("KML wrong org x!"));
|
||||
TEST_ALMOST_EQUAL_ULPS(bm->GetPivot().y, 21.12480639056074, ("KML wrong org y!"));
|
||||
TEST_EQUAL(bm->GetScale(), -1, ("KML wrong scale!"));
|
||||
}
|
||||
}
|
||||
|
|
228
map/user_mark.cpp
Normal file
228
map/user_mark.cpp
Normal file
|
@ -0,0 +1,228 @@
|
|||
#include "user_mark.hpp"
|
||||
#include "user_mark_container.hpp"
|
||||
|
||||
|
||||
UserMark::UserMark(m2::PointD const & ptOrg, UserMarkContainer * container)
|
||||
: m_ptOrg(ptOrg), m_container(container)
|
||||
{
|
||||
}
|
||||
|
||||
m2::PointD const & UserMark::GetPivot() const
|
||||
{
|
||||
return m_ptOrg;
|
||||
}
|
||||
|
||||
dp::Anchor UserMark::GetAnchor() const
|
||||
{
|
||||
return dp::Center;
|
||||
}
|
||||
|
||||
float UserMark::GetDepth() const
|
||||
{
|
||||
return GetContainer()->GetPointDepth();
|
||||
}
|
||||
|
||||
UserMarkContainer const * UserMark::GetContainer() const
|
||||
{
|
||||
ASSERT(m_container != nullptr, ());
|
||||
return m_container;
|
||||
}
|
||||
|
||||
void UserMark::GetLatLon(double & lat, double & lon) const
|
||||
{
|
||||
lon = MercatorBounds::XToLon(m_ptOrg.x);
|
||||
lat = MercatorBounds::YToLat(m_ptOrg.y);
|
||||
}
|
||||
|
||||
void UserMark::FillLogEvent(UserMark::TEventContainer & details) const
|
||||
{
|
||||
double lat, lon;
|
||||
GetLatLon(lat, lon);
|
||||
details.emplace("lat", strings::to_string(lat));
|
||||
details.emplace("lon", strings::to_string(lon));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
UserMarkCopy::UserMarkCopy(UserMark const * srcMark, bool needDestroy)
|
||||
: m_srcMark(srcMark)
|
||||
, m_needDestroy(needDestroy)
|
||||
{
|
||||
}
|
||||
|
||||
UserMarkCopy::~UserMarkCopy()
|
||||
{
|
||||
if (m_needDestroy)
|
||||
delete m_srcMark;
|
||||
}
|
||||
|
||||
UserMark const * UserMarkCopy::GetUserMark() const
|
||||
{
|
||||
return m_srcMark;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
ApiMarkPoint::ApiMarkPoint(m2::PointD const & ptOrg, UserMarkContainer * container)
|
||||
: UserMark(ptOrg, container)
|
||||
{
|
||||
}
|
||||
|
||||
ApiMarkPoint::ApiMarkPoint(string const & name, string const & id, m2::PointD const & ptOrg,
|
||||
UserMarkContainer * container)
|
||||
: UserMark(ptOrg, container)
|
||||
, m_name(name)
|
||||
, m_id(id)
|
||||
{
|
||||
}
|
||||
|
||||
string ApiMarkPoint::GetSymbolName() const
|
||||
{
|
||||
return "api-result";
|
||||
}
|
||||
|
||||
UserMark::Type ApiMarkPoint::GetMarkType() const
|
||||
{
|
||||
return UserMark::Type::API;
|
||||
}
|
||||
|
||||
string const & ApiMarkPoint::GetName() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
void ApiMarkPoint::SetName(string const & name)
|
||||
{
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
string const & ApiMarkPoint::GetID() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
void ApiMarkPoint::SetID(string const & id)
|
||||
{
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
unique_ptr<UserMarkCopy> ApiMarkPoint::Copy() const
|
||||
{
|
||||
return unique_ptr<UserMarkCopy>(
|
||||
new UserMarkCopy(new ApiMarkPoint(m_name, m_id, m_ptOrg, m_container)));
|
||||
}
|
||||
|
||||
void ApiMarkPoint::FillLogEvent(UserMark::TEventContainer & details) const
|
||||
{
|
||||
UserMark::FillLogEvent(details);
|
||||
details.emplace("markType", "API");
|
||||
details.emplace("name", GetName());
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
SearchMarkPoint::SearchMarkPoint(search::AddressInfo const & info, m2::PointD const & ptOrg,
|
||||
UserMarkContainer * container)
|
||||
: UserMark(ptOrg, container)
|
||||
, m_info(info)
|
||||
{
|
||||
}
|
||||
|
||||
SearchMarkPoint::SearchMarkPoint(m2::PointD const & ptOrg, UserMarkContainer * container)
|
||||
: UserMark(ptOrg, container)
|
||||
{
|
||||
}
|
||||
|
||||
string SearchMarkPoint::GetSymbolName() const
|
||||
{
|
||||
return "search-result";
|
||||
}
|
||||
|
||||
UserMark::Type SearchMarkPoint::GetMarkType() const
|
||||
{
|
||||
return UserMark::Type::SEARCH;
|
||||
}
|
||||
|
||||
search::AddressInfo const & SearchMarkPoint::GetInfo() const
|
||||
{
|
||||
return m_info;
|
||||
}
|
||||
|
||||
void SearchMarkPoint::SetInfo(search::AddressInfo const & info)
|
||||
{
|
||||
m_info = info;
|
||||
}
|
||||
|
||||
feature::FeatureMetadata const & SearchMarkPoint::GetMetadata() const
|
||||
{
|
||||
return m_metadata;
|
||||
}
|
||||
|
||||
void SearchMarkPoint::SetMetadata(const feature::FeatureMetadata & metadata)
|
||||
{
|
||||
m_metadata = metadata;
|
||||
}
|
||||
|
||||
unique_ptr<UserMarkCopy> SearchMarkPoint::Copy() const
|
||||
{
|
||||
return unique_ptr<UserMarkCopy>(
|
||||
new UserMarkCopy(new SearchMarkPoint(m_info, m_ptOrg, m_container)));
|
||||
}
|
||||
|
||||
void SearchMarkPoint::FillLogEvent(UserMark::TEventContainer & details) const
|
||||
{
|
||||
UserMark::FillLogEvent(details);
|
||||
details.emplace("markType", "SEARCH");
|
||||
details.emplace("name", m_info.GetPinName());
|
||||
details.emplace("type", m_info.GetPinType());
|
||||
details.emplace("metaData", m_metadata.Empty() ? "0" : "1");
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
PoiMarkPoint::PoiMarkPoint(UserMarkContainer * container)
|
||||
: SearchMarkPoint(m2::PointD(0.0, 0.0), container) {}
|
||||
|
||||
UserMark::Type PoiMarkPoint::GetMarkType() const
|
||||
{
|
||||
return UserMark::Type::POI;
|
||||
}
|
||||
|
||||
unique_ptr<UserMarkCopy> PoiMarkPoint::Copy() const
|
||||
{
|
||||
return unique_ptr<UserMarkCopy>(new UserMarkCopy(this, false));
|
||||
}
|
||||
|
||||
void PoiMarkPoint::FillLogEvent(UserMark::TEventContainer & details) const
|
||||
{
|
||||
SearchMarkPoint::FillLogEvent(details);
|
||||
details.emplace("markType", "POI");
|
||||
}
|
||||
|
||||
void PoiMarkPoint::SetPtOrg(m2::PointD const & ptOrg)
|
||||
{
|
||||
m_ptOrg = ptOrg;
|
||||
}
|
||||
|
||||
void PoiMarkPoint::SetName(string const & name)
|
||||
{
|
||||
m_info.m_name = name;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
MyPositionMarkPoint::MyPositionMarkPoint(UserMarkContainer * container)
|
||||
: PoiMarkPoint(container)
|
||||
{
|
||||
}
|
||||
|
||||
UserMark::Type MyPositionMarkPoint::GetMarkType() const
|
||||
{
|
||||
return UserMark::Type::MY_POSITION;
|
||||
}
|
||||
|
||||
void MyPositionMarkPoint::FillLogEvent(UserMark::TEventContainer & details) const
|
||||
{
|
||||
PoiMarkPoint::FillLogEvent(details);
|
||||
details.emplace("markType", "MY_POSITION");
|
||||
}
|
|
@ -2,25 +2,25 @@
|
|||
|
||||
#include "search/result.hpp"
|
||||
|
||||
#include "drape_frontend/user_marks_provider.hpp"
|
||||
|
||||
#include "indexer/feature.hpp"
|
||||
|
||||
#include "geometry/point2d.hpp"
|
||||
|
||||
#include "base/macros.hpp"
|
||||
|
||||
#include "std/string.hpp"
|
||||
#include "std/unique_ptr.hpp"
|
||||
#include "std/utility.hpp"
|
||||
|
||||
|
||||
class UserMarkContainer;
|
||||
class PaintOverlayEvent;
|
||||
class UserMarkDLCache;
|
||||
class UserMarkCopy;
|
||||
|
||||
class UserMark
|
||||
class UserMark : public df::UserPointMark
|
||||
{
|
||||
UserMark(UserMark const &) = delete;
|
||||
UserMark& operator=(UserMark const &) = delete;
|
||||
|
||||
DISALLOW_COPY_AND_MOVE(UserMark)
|
||||
public:
|
||||
enum class Type
|
||||
{
|
||||
|
@ -32,32 +32,24 @@ public:
|
|||
DEBUG_MARK
|
||||
};
|
||||
|
||||
UserMark(m2::PointD const & ptOrg, UserMarkContainer * container)
|
||||
: m_ptOrg(ptOrg), m_container(container)
|
||||
{
|
||||
}
|
||||
UserMark(m2::PointD const & ptOrg, UserMarkContainer * container);
|
||||
|
||||
virtual ~UserMark() {}
|
||||
|
||||
UserMarkContainer const * GetContainer() const { return m_container; }
|
||||
m2::PointD const & GetOrg() const { return m_ptOrg; }
|
||||
void GetLatLon(double & lat, double & lon) const
|
||||
{
|
||||
lon = MercatorBounds::XToLon(m_ptOrg.x);
|
||||
lat = MercatorBounds::YToLat(m_ptOrg.y);
|
||||
}
|
||||
virtual bool IsCustomDrawable() const { return false;}
|
||||
///////////////////////////////////////////////////////
|
||||
/// df::UserPointMark
|
||||
m2::PointD const & GetPivot() const override;
|
||||
dp::Anchor GetAnchor() const override;
|
||||
float GetDepth() const override;
|
||||
///////////////////////////////////////////////////////
|
||||
|
||||
UserMarkContainer const * GetContainer() const;
|
||||
void GetLatLon(double & lat, double & lon) const;
|
||||
virtual Type GetMarkType() const = 0;
|
||||
virtual unique_ptr<UserMarkCopy> Copy() const = 0;
|
||||
// Need it to calculate POI rank from all taps to features via statistics.
|
||||
typedef map<string, string> TEventContainer;
|
||||
virtual void FillLogEvent(TEventContainer & details) const
|
||||
{
|
||||
double lat, lon;
|
||||
GetLatLon(lat, lon);
|
||||
details["lat"] = strings::to_string(lat);
|
||||
details["lon"] = strings::to_string(lon);
|
||||
}
|
||||
using TEventContainer = map<string, string>;
|
||||
virtual void FillLogEvent(TEventContainer & details) const;
|
||||
|
||||
protected:
|
||||
m2::PointD m_ptOrg;
|
||||
|
@ -67,25 +59,44 @@ protected:
|
|||
class UserMarkCopy
|
||||
{
|
||||
public:
|
||||
UserMarkCopy(UserMark const * srcMark, bool needDestroy = true)
|
||||
: m_srcMark(srcMark)
|
||||
, m_needDestroy(needDestroy)
|
||||
{
|
||||
}
|
||||
UserMarkCopy(UserMark const * srcMark, bool needDestroy = true);
|
||||
~UserMarkCopy();
|
||||
|
||||
~UserMarkCopy()
|
||||
{
|
||||
if (m_needDestroy)
|
||||
delete m_srcMark;
|
||||
}
|
||||
|
||||
UserMark const * GetUserMark() const { return m_srcMark; }
|
||||
UserMark const * GetUserMark() const;
|
||||
|
||||
private:
|
||||
UserMark const * m_srcMark;
|
||||
bool m_needDestroy;
|
||||
};
|
||||
|
||||
class ApiMarkPoint : public UserMark
|
||||
{
|
||||
public:
|
||||
ApiMarkPoint(m2::PointD const & ptOrg, UserMarkContainer * container);
|
||||
|
||||
ApiMarkPoint(string const & name,
|
||||
string const & id,
|
||||
m2::PointD const & ptOrg,
|
||||
UserMarkContainer * container);
|
||||
|
||||
string GetSymbolName() const override;
|
||||
UserMark::Type GetMarkType() const override;
|
||||
|
||||
string const & GetName() const;
|
||||
void SetName(string const & name);
|
||||
|
||||
string const & GetID() const;
|
||||
void SetID(string const & id);
|
||||
|
||||
unique_ptr<UserMarkCopy> Copy() const override;
|
||||
|
||||
virtual void FillLogEvent(TEventContainer & details) const override;
|
||||
|
||||
private:
|
||||
string m_name;
|
||||
string m_id;
|
||||
};
|
||||
|
||||
class DebugMarkPoint : public UserMark
|
||||
{
|
||||
public:
|
||||
|
@ -113,39 +124,22 @@ class SearchMarkPoint : public UserMark
|
|||
public:
|
||||
SearchMarkPoint(search::AddressInfo const & info,
|
||||
m2::PointD const & ptOrg,
|
||||
UserMarkContainer * container)
|
||||
: UserMark(ptOrg, container)
|
||||
, m_info(info)
|
||||
{
|
||||
}
|
||||
UserMarkContainer * container);
|
||||
|
||||
SearchMarkPoint(m2::PointD const & ptOrg, UserMarkContainer * container)
|
||||
: UserMark(ptOrg, container)
|
||||
{
|
||||
}
|
||||
SearchMarkPoint(m2::PointD const & ptOrg, UserMarkContainer * container);
|
||||
|
||||
UserMark::Type GetMarkType() const override { return UserMark::Type::SEARCH; }
|
||||
string GetSymbolName() const override;
|
||||
UserMark::Type GetMarkType() const override;
|
||||
|
||||
search::AddressInfo const & GetInfo() const { return m_info; }
|
||||
void SetInfo(search::AddressInfo const & info) { m_info = info; }
|
||||
search::AddressInfo const & GetInfo() const;
|
||||
void SetInfo(search::AddressInfo const & info);
|
||||
|
||||
feature::Metadata const & GetMetadata() const { return m_metadata; }
|
||||
void SetMetadata(feature::Metadata && metadata) { m_metadata = move(metadata); }
|
||||
feature::Metadata const & GetMetadata() const;
|
||||
void SetMetadata(feature::Metadata && metadata);
|
||||
|
||||
unique_ptr<UserMarkCopy> Copy() const override
|
||||
{
|
||||
return unique_ptr<UserMarkCopy>(
|
||||
new UserMarkCopy(new SearchMarkPoint(m_info, m_ptOrg, m_container)));
|
||||
}
|
||||
unique_ptr<UserMarkCopy> Copy() const override;
|
||||
|
||||
virtual void FillLogEvent(TEventContainer & details) const override
|
||||
{
|
||||
UserMark::FillLogEvent(details);
|
||||
details["markType"] = "SEARCH";
|
||||
details["name"] = m_info.GetPinName();
|
||||
details["type"] = m_info.GetPinType();
|
||||
details["metaData"] = m_metadata.Empty() ? "0" : "1";
|
||||
}
|
||||
virtual void FillLogEvent(TEventContainer & details) const override;
|
||||
|
||||
protected:
|
||||
search::AddressInfo m_info;
|
||||
|
@ -155,43 +149,20 @@ protected:
|
|||
class PoiMarkPoint : public SearchMarkPoint
|
||||
{
|
||||
public:
|
||||
PoiMarkPoint(UserMarkContainer * container)
|
||||
: SearchMarkPoint(m2::PointD(0.0, 0.0), container) {}
|
||||
PoiMarkPoint(UserMarkContainer * container);
|
||||
UserMark::Type GetMarkType() const override;
|
||||
unique_ptr<UserMarkCopy> Copy() const override;
|
||||
virtual void FillLogEvent(TEventContainer & details) const override;
|
||||
|
||||
UserMark::Type GetMarkType() const override { return UserMark::Type::POI; }
|
||||
unique_ptr<UserMarkCopy> Copy() const override
|
||||
{
|
||||
return unique_ptr<UserMarkCopy>(new UserMarkCopy(this, false));
|
||||
}
|
||||
virtual void FillLogEvent(TEventContainer & details) const override
|
||||
{
|
||||
SearchMarkPoint::FillLogEvent(details);
|
||||
details["markType"] = "POI";
|
||||
}
|
||||
|
||||
void SetPtOrg(m2::PointD const & ptOrg) { m_ptOrg = ptOrg; }
|
||||
void SetName(string const & name) { m_info.m_name = name; }
|
||||
void SetPtOrg(m2::PointD const & ptOrg);
|
||||
void SetName(string const & name);
|
||||
};
|
||||
|
||||
class MyPositionMarkPoint : public PoiMarkPoint
|
||||
{
|
||||
public:
|
||||
MyPositionMarkPoint(UserMarkContainer * container) : PoiMarkPoint(container) {}
|
||||
MyPositionMarkPoint(UserMarkContainer * container);
|
||||
|
||||
UserMark::Type GetMarkType() const override { return UserMark::Type::MY_POSITION; }
|
||||
virtual void FillLogEvent(TEventContainer & details) const override
|
||||
{
|
||||
PoiMarkPoint::FillLogEvent(details);
|
||||
details["markType"] = "MY_POSITION";
|
||||
}
|
||||
};
|
||||
|
||||
class ICustomDrawable : public UserMark
|
||||
{
|
||||
public:
|
||||
ICustomDrawable(m2::PointD const & ptOrg, UserMarkContainer * container) : UserMark(ptOrg, container) {}
|
||||
bool IsCustomDrawable() const { return true; }
|
||||
//virtual graphics::DisplayList * GetDisplayList(UserMarkDLCache * cache) const = 0;
|
||||
virtual double GetAnimScaleFactor() const = 0;
|
||||
virtual m2::PointD const & GetPixelOffset() const = 0;
|
||||
UserMark::Type GetMarkType() const override;
|
||||
virtual void FillLogEvent(TEventContainer & details) const override;
|
||||
};
|
||||
|
|
|
@ -16,25 +16,6 @@
|
|||
|
||||
namespace
|
||||
{
|
||||
// class PinAnimation : public AnimPhaseChain
|
||||
// {
|
||||
// public:
|
||||
// PinAnimation(Framework & f)
|
||||
// : AnimPhaseChain(f, m_scale)
|
||||
// , m_scale(0.0)
|
||||
// {
|
||||
// InitDefaultPinAnim(this);
|
||||
// }
|
||||
|
||||
// double GetScale() const
|
||||
// {
|
||||
// return m_scale;
|
||||
// }
|
||||
|
||||
// private:
|
||||
// double m_scale;
|
||||
// };
|
||||
|
||||
class FindMarkFunctor
|
||||
{
|
||||
public:
|
||||
|
@ -48,7 +29,7 @@ namespace
|
|||
|
||||
void operator()(UserMark * mark)
|
||||
{
|
||||
m2::PointD const & org = mark->GetOrg();
|
||||
m2::PointD const & org = mark->GetPivot();
|
||||
if (m_rect.IsPointInside(org))
|
||||
{
|
||||
double minDCandidate = m_globalCenter.SquareLength(org);
|
||||
|
@ -109,7 +90,7 @@ UserMark const * UserMarkContainer::FindMarkInRect(m2::AnyRectD const & rect, do
|
|||
FindMarkFunctor f(&mark, d, rect);
|
||||
for (size_t i = 0; i < m_userMarks.size(); ++i)
|
||||
{
|
||||
if (rect.IsPointInside(m_userMarks[i]->GetOrg()))
|
||||
if (rect.IsPointInside(m_userMarks[i]->GetPivot()))
|
||||
f(m_userMarks[i].get());
|
||||
}
|
||||
}
|
||||
|
@ -174,28 +155,33 @@ void UserMarkContainer::ReleaseController()
|
|||
}
|
||||
}
|
||||
|
||||
size_t UserMarkContainer::GetCount() const
|
||||
size_t UserMarkContainer::GetPointCount() const
|
||||
{
|
||||
return m_userMarks.size();
|
||||
return GetUserMarkCount();
|
||||
}
|
||||
|
||||
m2::PointD const & UserMarkContainer::GetPivot(size_t index) const
|
||||
df::UserPointMark const * UserMarkContainer::GetUserPointMark(size_t index) const
|
||||
{
|
||||
return GetUserMark(index)->GetOrg();
|
||||
return GetUserMark(index);
|
||||
}
|
||||
|
||||
float UserMarkContainer::GetDepth(size_t index) const
|
||||
size_t UserMarkContainer::GetLineCount() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
df::UserLineMark const * UserMarkContainer::GetUserLineMark(size_t index) const
|
||||
{
|
||||
UNUSED_VALUE(index);
|
||||
ASSERT(false, ());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
float UserMarkContainer::GetPointDepth() const
|
||||
{
|
||||
return m_layerDepth;
|
||||
}
|
||||
|
||||
dp::Anchor UserMarkContainer::GetAnchor(size_t index) const
|
||||
{
|
||||
UNUSED_VALUE(index);
|
||||
return dp::Center;
|
||||
}
|
||||
|
||||
bool UserMarkContainer::IsVisible() const
|
||||
{
|
||||
return m_flags[VisibleFlag];
|
||||
|
@ -326,13 +312,6 @@ SearchUserMarkContainer::SearchUserMarkContainer(double layerDepth, Framework &
|
|||
{
|
||||
}
|
||||
|
||||
string const & SearchUserMarkContainer::GetSymbolName(size_t index) const
|
||||
{
|
||||
UNUSED_VALUE(index);
|
||||
static string s_symbol = "search-result";
|
||||
return s_symbol;
|
||||
}
|
||||
|
||||
UserMark * SearchUserMarkContainer::AllocateUserMark(const m2::PointD & ptOrg)
|
||||
{
|
||||
return new SearchMarkPoint(ptOrg, this);
|
||||
|
@ -343,13 +322,6 @@ ApiUserMarkContainer::ApiUserMarkContainer(double layerDepth, Framework & framew
|
|||
{
|
||||
}
|
||||
|
||||
string const & ApiUserMarkContainer::GetSymbolName(size_t index) const
|
||||
{
|
||||
UNUSED_VALUE(index);
|
||||
static string s_symbol = "api-result";
|
||||
return s_symbol;
|
||||
}
|
||||
|
||||
UserMark * ApiUserMarkContainer::AllocateUserMark(const m2::PointD & ptOrg)
|
||||
{
|
||||
return new ApiMarkPoint(ptOrg, this);
|
||||
|
|
|
@ -58,22 +58,26 @@ public:
|
|||
static PoiMarkPoint * UserMarkForPoi();
|
||||
static MyPositionMarkPoint * UserMarkForMyPostion();
|
||||
|
||||
/// newer save reference on UserMarksController
|
||||
/// never save reference on UserMarksController
|
||||
UserMarksController & RequestController();
|
||||
void ReleaseController();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
size_t GetCount() const;
|
||||
m2::PointD const & GetPivot(size_t index) const;
|
||||
float GetDepth(size_t index) const;
|
||||
dp::Anchor GetAnchor(size_t index) const;
|
||||
/// Render info
|
||||
virtual size_t GetPointCount() const;
|
||||
virtual df::UserPointMark const * GetUserPointMark(size_t index) const;
|
||||
|
||||
virtual size_t GetLineCount() const;
|
||||
virtual df::UserLineMark const * GetUserLineMark(size_t index) const;
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
float GetPointDepth() const;
|
||||
|
||||
/// @TODO uvr : send event to drape to change visibility
|
||||
bool IsVisible() const;
|
||||
virtual bool IsDrawable() const;
|
||||
virtual size_t GetUserMarkCount() const;
|
||||
virtual UserMark const * GetUserMark(size_t index) const;
|
||||
virtual UserMarkType GetType() const override final;
|
||||
bool IsDrawable() const override;
|
||||
size_t GetUserMarkCount() const override;
|
||||
UserMark const * GetUserMark(size_t index) const override;
|
||||
UserMarkType GetType() const override final;
|
||||
|
||||
protected:
|
||||
/// UserMarksController implementation
|
||||
|
@ -106,8 +110,6 @@ class SearchUserMarkContainer : public UserMarkContainer
|
|||
public:
|
||||
SearchUserMarkContainer(double layerDepth, Framework & framework);
|
||||
|
||||
string const & GetSymbolName(size_t index) const;
|
||||
|
||||
protected:
|
||||
virtual UserMark * AllocateUserMark(m2::PointD const & ptOrg);
|
||||
};
|
||||
|
@ -117,8 +119,6 @@ class ApiUserMarkContainer : public UserMarkContainer
|
|||
public:
|
||||
ApiUserMarkContainer(double layerDepth, Framework & framework);
|
||||
|
||||
string const & GetSymbolName(size_t index) const;
|
||||
|
||||
protected:
|
||||
virtual UserMark * AllocateUserMark(m2::PointD const & ptOrg);
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue