mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-21 05:43:37 +00:00
Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run: git remote add om-historic [om-historic.git repo url] git fetch --tags om-historic git replace squashed-history historic-commits
This commit is contained in:
46
drape_frontend/animation/interpolation_holder.cpp
Normal file
46
drape_frontend/animation/interpolation_holder.cpp
Normal file
@@ -0,0 +1,46 @@
|
||||
#include "drape_frontend/animation/base_interpolator.hpp"
|
||||
#include "drape_frontend/animation/interpolation_holder.hpp"
|
||||
|
||||
#include "base/assert.hpp"
|
||||
|
||||
namespace df
|
||||
{
|
||||
InterpolationHolder & InterpolationHolder::Instance()
|
||||
{
|
||||
static InterpolationHolder holder;
|
||||
return holder;
|
||||
}
|
||||
|
||||
bool InterpolationHolder::IsActive() const
|
||||
{
|
||||
return !m_interpolations.empty();
|
||||
}
|
||||
|
||||
void InterpolationHolder::Advance(double elapsedSeconds)
|
||||
{
|
||||
auto iter = m_interpolations.begin();
|
||||
while (iter != m_interpolations.end())
|
||||
{
|
||||
(*iter)->Advance(elapsedSeconds);
|
||||
if ((*iter)->IsFinished())
|
||||
iter = m_interpolations.erase(iter);
|
||||
else
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
InterpolationHolder::~InterpolationHolder()
|
||||
{
|
||||
ASSERT(m_interpolations.empty(), ());
|
||||
}
|
||||
|
||||
void InterpolationHolder::RegisterInterpolator(BaseInterpolator * interpolator)
|
||||
{
|
||||
VERIFY(m_interpolations.insert(interpolator).second, ());
|
||||
}
|
||||
|
||||
void InterpolationHolder::DeregisterInterpolator(BaseInterpolator * interpolator)
|
||||
{
|
||||
m_interpolations.erase(interpolator);
|
||||
}
|
||||
} // namespace df
|
||||
Reference in New Issue
Block a user