forked from organicmaps/organicmaps
Remove useless code.
This commit is contained in:
parent
bd4745605d
commit
564e3430a1
5 changed files with 5 additions and 140 deletions
|
@ -1,53 +0,0 @@
|
|||
#include "compass_filter.hpp"
|
||||
|
||||
//#include "../geometry/angles.hpp"
|
||||
|
||||
#include "../platform/location.hpp"
|
||||
|
||||
|
||||
/*
|
||||
namespace
|
||||
{
|
||||
double const LOW_PASS_FACTOR = 0.5;
|
||||
double const TRASHOLD = my::DegToRad(15.0);
|
||||
}
|
||||
*/
|
||||
|
||||
CompassFilter::CompassFilter()
|
||||
: m_headingRad(0.0)
|
||||
{
|
||||
}
|
||||
|
||||
void CompassFilter::OnCompassUpdate(location::CompassInfo const & info)
|
||||
{
|
||||
double const heading = ((info.m_trueHeading >= 0.0) ? info.m_trueHeading : info.m_magneticHeading);
|
||||
|
||||
//#ifdef OMIM_OS_IPHONE
|
||||
|
||||
// On iOS we shouldn't smooth the compass values.
|
||||
|
||||
m_headingRad = heading;
|
||||
|
||||
/*
|
||||
#else
|
||||
|
||||
// if new heading lies outside the twice treshold radius we immediately accept it
|
||||
if (fabs(ang::GetShortestDistance(m_headingRad, heading)) >= TRASHOLD)
|
||||
{
|
||||
m_headingRad = heading;
|
||||
}
|
||||
else
|
||||
{
|
||||
// else we smooth the received value with the following formula
|
||||
// O(n) = O(n-1) + k * (I - O(n - 1));
|
||||
m_headingRad = m_headingRad + LOW_PASS_FACTOR * (heading - m_headingRad);
|
||||
}
|
||||
|
||||
#endif
|
||||
*/
|
||||
}
|
||||
|
||||
double CompassFilter::GetHeadingRad() const
|
||||
{
|
||||
return m_headingRad;
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
namespace location { class CompassInfo; }
|
||||
|
||||
class CompassFilter
|
||||
{
|
||||
double m_headingRad;
|
||||
|
||||
public:
|
||||
CompassFilter();
|
||||
|
||||
// Getting new compass value
|
||||
void OnCompassUpdate(location::CompassInfo const & info);
|
||||
// get heading angle in radians.
|
||||
double GetHeadingRad() const;
|
||||
};
|
|
@ -37,6 +37,7 @@ namespace location
|
|||
: base_t(p),
|
||||
m_errorRadius(0),
|
||||
m_position(0, 0),
|
||||
m_drawHeading(0.0),
|
||||
m_hasPosition(false),
|
||||
m_hasCompass(false),
|
||||
m_isCentered(false),
|
||||
|
@ -45,7 +46,6 @@ namespace location
|
|||
m_compassProcessMode(ECompassDoNothing),
|
||||
m_currentSlotID(0)
|
||||
{
|
||||
m_drawHeading = m_compassFilter.GetHeadingRad();
|
||||
m_locationAreaColor = p.m_locationAreaColor;
|
||||
m_compassAreaColor = p.m_compassAreaColor;
|
||||
m_compassBorderColor = p.m_compassBorderColor;
|
||||
|
@ -148,7 +148,6 @@ namespace location
|
|||
m_framework->ShowRectExVisibleScale(rect, scales::GetUpperComfortScale());
|
||||
|
||||
SetIsCentered(true);
|
||||
CheckCompassRotation();
|
||||
CheckCompassFollowing();
|
||||
|
||||
m_locationProcessMode = ELocationCenterOnly;
|
||||
|
@ -158,7 +157,6 @@ namespace location
|
|||
m_framework->SetViewportCenter(center);
|
||||
|
||||
SetIsCentered(true);
|
||||
CheckCompassRotation();
|
||||
CheckCompassFollowing();
|
||||
break;
|
||||
|
||||
|
@ -173,9 +171,9 @@ namespace location
|
|||
{
|
||||
m_hasCompass = true;
|
||||
|
||||
m_compassFilter.OnCompassUpdate(info);
|
||||
m_drawHeading =
|
||||
((info.m_trueHeading >= 0.0) ? info.m_trueHeading : info.m_magneticHeading);
|
||||
|
||||
CheckCompassRotation();
|
||||
CheckCompassFollowing();
|
||||
|
||||
invalidate();
|
||||
|
@ -428,60 +426,6 @@ namespace location
|
|||
return (pt.SquareLength(pivot()) <= my::sq(radius));
|
||||
}
|
||||
|
||||
void State::CheckCompassRotation()
|
||||
{
|
||||
/*
|
||||
#ifndef OMIM_OS_IPHONE
|
||||
|
||||
if (m_headingInterpolation)
|
||||
m_headingInterpolation->Lock();
|
||||
|
||||
double headingDelta = 0;
|
||||
bool isRunning = m_headingInterpolation
|
||||
&& m_headingInterpolation->IsRunning();
|
||||
|
||||
if (isRunning)
|
||||
headingDelta = fabs(ang::GetShortestDistance(m_headingInterpolation->EndAngle(), m_compassFilter.GetHeadingRad()));
|
||||
|
||||
if (floor(my::RadToDeg(headingDelta)) > 0)
|
||||
m_headingInterpolation->SetEndAngle(m_compassFilter.GetHeadingRad());
|
||||
else
|
||||
{
|
||||
if (!isRunning)
|
||||
{
|
||||
headingDelta = fabs(ang::GetShortestDistance(m_drawHeading, m_compassFilter.GetHeadingRad()));
|
||||
|
||||
if (my::rounds(my::RadToDeg(headingDelta)) > 0)
|
||||
{
|
||||
if (m_headingInterpolation
|
||||
&& !m_headingInterpolation->IsCancelled()
|
||||
&& !m_headingInterpolation->IsEnded())
|
||||
{
|
||||
m_headingInterpolation->Cancel();
|
||||
m_headingInterpolation->Unlock();
|
||||
m_headingInterpolation.reset();
|
||||
}
|
||||
|
||||
m_headingInterpolation.reset(new anim::AngleInterpolation(m_drawHeading,
|
||||
m_compassFilter.GetHeadingRad(),
|
||||
m_framework->GetAnimator().GetRotationSpeed(),
|
||||
m_drawHeading));
|
||||
|
||||
m_framework->GetAnimController()->AddTask(m_headingInterpolation);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m_headingInterpolation)
|
||||
m_headingInterpolation->Unlock();
|
||||
|
||||
#else
|
||||
*/
|
||||
m_drawHeading = m_compassFilter.GetHeadingRad();
|
||||
//#endif
|
||||
}
|
||||
|
||||
void State::CheckCompassFollowing()
|
||||
{
|
||||
if (m_hasCompass
|
||||
|
@ -499,7 +443,7 @@ namespace location
|
|||
|
||||
m_framework->GetAnimator().RotateScreen(
|
||||
m_framework->GetNavigator().Screen().GetAngle(),
|
||||
-m_compassFilter.GetHeadingRad());
|
||||
-m_drawHeading);
|
||||
}
|
||||
|
||||
void State::AnimateToPosition()
|
||||
|
@ -558,7 +502,7 @@ namespace location
|
|||
{
|
||||
SetCompassProcessMode(ECompassFollow);
|
||||
SetLocationProcessMode(ELocationCenterOnly);
|
||||
CheckCompassRotation();
|
||||
|
||||
CheckCompassFollowing();
|
||||
setState(EPressed);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
#include "compass_filter.hpp"
|
||||
|
||||
#include "../gui/element.hpp"
|
||||
|
||||
#include "../platform/location.hpp"
|
||||
|
@ -16,8 +14,6 @@
|
|||
|
||||
class Framework;
|
||||
|
||||
//namespace anim { class AngleInterpolation; }
|
||||
|
||||
namespace graphics { class DisplayList; }
|
||||
|
||||
namespace location
|
||||
|
@ -55,7 +51,6 @@ namespace location
|
|||
double m_errorRadius; //< error radius in mercator
|
||||
m2::PointD m_position; //< position in mercator
|
||||
|
||||
CompassFilter m_compassFilter;
|
||||
double m_drawHeading;
|
||||
|
||||
bool m_hasPosition;
|
||||
|
@ -101,8 +96,6 @@ namespace location
|
|||
mutable vector<m2::AnyRectD> m_boundRects;
|
||||
m2::RectD m_boundRect;
|
||||
|
||||
//shared_ptr<anim::AngleInterpolation> m_headingInterpolation;
|
||||
|
||||
typedef map<int, TCompassStatusListener> TCompassStatusListeners;
|
||||
TCompassStatusListeners m_compassStatusListeners;
|
||||
int m_currentSlotID;
|
||||
|
@ -118,7 +111,6 @@ namespace location
|
|||
m2::PointD const & globalPt1,
|
||||
ScreenBase const & s);
|
||||
|
||||
void CheckCompassRotation();
|
||||
void CheckCompassFollowing();
|
||||
void FollowCompass();
|
||||
|
||||
|
|
|
@ -47,7 +47,6 @@ HEADERS += \
|
|||
country_status_display.hpp \
|
||||
rotate_screen_task.hpp \
|
||||
compass_arrow.hpp \
|
||||
compass_filter.hpp \
|
||||
animator.hpp \
|
||||
move_screen_task.hpp \
|
||||
change_viewport_task.hpp \
|
||||
|
@ -98,7 +97,6 @@ SOURCES += \
|
|||
country_status_display.cpp \
|
||||
rotate_screen_task.cpp \
|
||||
compass_arrow.cpp \
|
||||
compass_filter.cpp \
|
||||
animator.cpp \
|
||||
move_screen_task.cpp \
|
||||
change_viewport_task.cpp \
|
||||
|
|
Loading…
Add table
Reference in a new issue