Move ApiMarkPoint and ApiUserMarkContainer to separate files.

This commit is contained in:
Keith Wansbrough 2015-10-21 19:04:20 +01:00
parent 94df024da8
commit 89121cdf36
9 changed files with 101 additions and 79 deletions

View file

@ -0,0 +1,29 @@
#include "api_mark_container.hpp"
#include "api_mark_point.hpp"
#include "framework.hpp"
////////////////////////////////////////////////////////////////////////
ApiUserMarkContainer::ApiUserMarkContainer(double layerDepth, Framework & framework)
: UserMarkContainer(layerDepth, framework)
{
}
string ApiUserMarkContainer::GetTypeName() const
{
return "api-result";
}
string ApiUserMarkContainer::GetActiveTypeName() const
{
return "search-result-active";
}
UserMark * ApiUserMarkContainer::AllocateUserMark(const m2::PointD & ptOrg)
{
return new ApiMarkPoint(ptOrg, this);
}

View file

@ -0,0 +1,18 @@
#pragma once
#include "user_mark_container.hpp"
#include "api_mark_point.hpp"
class ApiUserMarkContainer : public UserMarkContainer
{
public:
ApiUserMarkContainer(double layerDepth, Framework & framework);
virtual Type GetType() const { return API_MARK; }
virtual string GetActiveTypeName() const;
protected:
virtual string GetTypeName() const;
virtual UserMark * AllocateUserMark(m2::PointD const & ptOrg);
};

48
map/api_mark_point.hpp Normal file
View file

@ -0,0 +1,48 @@
#pragma once
#include "map/user_mark.hpp"
class ApiMarkPoint : public UserMark
{
public:
ApiMarkPoint(m2::PointD const & ptOrg, UserMarkContainer * container)
: UserMark(ptOrg, container)
{
}
ApiMarkPoint(string const & name,
string const & id,
m2::PointD const & ptOrg,
UserMarkContainer * container)
: UserMark(ptOrg, container)
, m_name(name)
, m_id(id)
{
}
UserMark::Type GetMarkType() const override { return UserMark::Type::API; }
string const & GetName() const { return m_name; }
void SetName(string const & name) { m_name = name; }
string const & GetID() const { return m_id; }
void SetID(string const & id) { m_id = id; }
unique_ptr<UserMarkCopy> Copy() const override
{
return unique_ptr<UserMarkCopy>(
new UserMarkCopy(new ApiMarkPoint(m_name, m_id, m_ptOrg, m_container)));
}
virtual void FillLogEvent(TEventContainer & details) const override
{
UserMark::FillLogEvent(details);
details["markType"] = "API";
details["name"] = GetName();
}
private:
string m_name;
string m_id;
};

View file

@ -8,6 +8,8 @@
#include "map/bookmark.hpp"
#include "map/bookmark_manager.hpp"
#include "map/api_mark_point.hpp"
#include "map/api_mark_container.hpp"
#include "map/pin_click_manager.hpp"
#include "map/mwm_url.hpp"

View file

@ -36,6 +36,8 @@ HEADERS += \
user_mark_container.hpp \
user_mark.hpp \
user_mark_dl_cache.hpp \
api_mark_container.hpp \
api_mark_point.hpp \
anim_phase_chain.hpp \
pin_click_manager.hpp \
country_tree.hpp \
@ -69,6 +71,7 @@ SOURCES += \
alfa_animation_task.cpp \
user_mark_container.cpp \
user_mark_dl_cache.cpp \
api_mark_container.cpp \
anim_phase_chain.cpp \
pin_click_manager.cpp \
country_tree.cpp \

View file

@ -1,6 +1,6 @@
#pragma once
#include "user_mark_container.hpp"
#include "api_mark_container.hpp"
#include "geometry/rect2d.hpp"

View file

@ -92,50 +92,6 @@ private:
bool m_needDestroy;
};
class ApiMarkPoint : public UserMark
{
public:
ApiMarkPoint(m2::PointD const & ptOrg, UserMarkContainer * container)
: UserMark(ptOrg, container)
{
}
ApiMarkPoint(string const & name,
string const & id,
m2::PointD const & ptOrg,
UserMarkContainer * container)
: UserMark(ptOrg, container)
, m_name(name)
, m_id(id)
{
}
UserMark::Type GetMarkType() const override { return UserMark::Type::API; }
string const & GetName() const { return m_name; }
void SetName(string const & name) { m_name = name; }
string const & GetID() const { return m_id; }
void SetID(string const & id) { m_id = id; }
unique_ptr<UserMarkCopy> Copy() const override
{
return unique_ptr<UserMarkCopy>(
new UserMarkCopy(new ApiMarkPoint(m_name, m_id, m_ptOrg, m_container)));
}
virtual void FillLogEvent(TEventContainer & details) const override
{
UserMark::FillLogEvent(details);
details["markType"] = "API";
details["name"] = GetName();
}
private:
string m_name;
string m_id;
};
class DebugMarkPoint : public UserMark
{
public:

View file

@ -267,27 +267,6 @@ UserMark * SearchUserMarkContainer::AllocateUserMark(const m2::PointD & ptOrg)
return new SearchMarkPoint(ptOrg, this);
}
ApiUserMarkContainer::ApiUserMarkContainer(double layerDepth, Framework & framework)
: UserMarkContainer(layerDepth, framework)
{
}
string ApiUserMarkContainer::GetTypeName() const
{
return "api-result";
}
string ApiUserMarkContainer::GetActiveTypeName() const
{
return "search-result-active";
}
UserMark * ApiUserMarkContainer::AllocateUserMark(const m2::PointD & ptOrg)
{
return new ApiMarkPoint(ptOrg, this);
}
DebugUserMarkContainer::DebugUserMarkContainer(double layerDepth, Framework & framework)
: UserMarkContainer(layerDepth, framework)
{

View file

@ -133,19 +133,6 @@ protected:
virtual UserMark * AllocateUserMark(m2::PointD const & ptOrg);
};
class ApiUserMarkContainer : public UserMarkContainer
{
public:
ApiUserMarkContainer(double layerDepth, Framework & framework);
virtual Type GetType() const { return API_MARK; }
virtual string GetActiveTypeName() const;
protected:
virtual string GetTypeName() const;
virtual UserMark * AllocateUserMark(m2::PointD const & ptOrg);
};
class DebugUserMarkContainer : public UserMarkContainer
{
public: