forked from organicmaps/organicmaps
Enabling and disabling 3d mode on desktop via search panel.
Conflicts: map/framework.cpp
This commit is contained in:
parent
e2d1b91262
commit
49021cfa61
4 changed files with 27 additions and 0 deletions
|
@ -2046,3 +2046,12 @@ void Framework::SetRouteFinishPoint(m2::PointD const & pt, bool isValid)
|
|||
if (m_drapeEngine != nullptr)
|
||||
m_drapeEngine->SetRoutePoint(pt, false /* isStart */, isValid);
|
||||
}
|
||||
|
||||
void Framework::Enable3dMode(bool enable)
|
||||
{
|
||||
ASSERT(m_drapeEngine != nullptr, ());
|
||||
if (enable)
|
||||
m_drapeEngine->Enable3dMode(M_PI / 3.0f, -M_PI_4, 0.5f);
|
||||
else
|
||||
m_drapeEngine->Disable3dMode();
|
||||
}
|
||||
|
|
|
@ -543,6 +543,8 @@ public:
|
|||
void SetRouteStartPoint(m2::PointD const & pt, bool isValid);
|
||||
void SetRouteFinishPoint(m2::PointD const & pt, bool isValid);
|
||||
|
||||
void Enable3dMode(bool enable);
|
||||
|
||||
private:
|
||||
void SetRouterImpl(routing::RouterType type);
|
||||
void RemoveRoute(bool deactivateFollowing);
|
||||
|
|
|
@ -191,6 +191,19 @@ bool SearchPanel::TryChangeRouterCmd(QString const & str)
|
|||
return true;
|
||||
}
|
||||
|
||||
// TODO: This code only for demonstration purposes and will be removed soon
|
||||
bool SearchPanel::Try3dModeCmd(QString const & str)
|
||||
{
|
||||
bool const is3dModeOn = (str == "?3d");
|
||||
bool const is3dModeOff = (str == "?2d");
|
||||
|
||||
if (!is3dModeOn && !is3dModeOff)
|
||||
return false;
|
||||
|
||||
m_pDrawWidget->GetFramework().Enable3dMode(is3dModeOn);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void SearchPanel::OnSearchTextChanged(QString const & str)
|
||||
{
|
||||
|
@ -201,6 +214,8 @@ void SearchPanel::OnSearchTextChanged(QString const & str)
|
|||
return;
|
||||
if (TryChangeRouterCmd(normalized))
|
||||
return;
|
||||
if (Try3dModeCmd(normalized))
|
||||
return;
|
||||
|
||||
// search even with empty query
|
||||
if (!normalized.isEmpty())
|
||||
|
|
|
@ -66,6 +66,7 @@ private slots:
|
|||
|
||||
bool TryChangeMapStyleCmd(QString const & str);
|
||||
bool TryChangeRouterCmd(QString const & str);
|
||||
bool Try3dModeCmd(QString const & str);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue