mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 04:53:36 +00:00
[android] Improve AA route simulator.
Signed-off-by: Viktor Govako <viktor.govako@gmail.com>
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#include "geometry/point_with_altitude.hpp"
|
||||
|
||||
#include "std/boost_container_hash.hpp"
|
||||
#include "geometry/mercator.hpp"
|
||||
|
||||
#include <boost/functional/hash.hpp>
|
||||
|
||||
#include <sstream>
|
||||
|
||||
@@ -26,6 +28,11 @@ bool PointWithAltitude::operator<(PointWithAltitude const & r) const
|
||||
return m_altitude < r.m_altitude;
|
||||
}
|
||||
|
||||
ms::LatLon PointWithAltitude::ToLatLon() const
|
||||
{
|
||||
return ms::LatLon(mercator::YToLat(m_point.y), mercator::XToLon(m_point.x));
|
||||
}
|
||||
|
||||
std::string DebugPrint(PointWithAltitude const & r)
|
||||
{
|
||||
std::ostringstream ss;
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "geometry/latlon.hpp"
|
||||
#include "geometry/point2d.hpp"
|
||||
|
||||
#include "base/math.hpp"
|
||||
|
||||
#include <limits>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -26,11 +29,19 @@ public:
|
||||
bool operator<(PointWithAltitude const & r) const;
|
||||
|
||||
m2::PointD const & GetPoint() const { return m_point; }
|
||||
ms::LatLon ToLatLon() const;
|
||||
Altitude GetAltitude() const { return m_altitude; }
|
||||
|
||||
void SetPoint(m2::PointD const & point) { m_point = point; }
|
||||
void SetAltitude(Altitude altitude) { m_altitude = altitude; }
|
||||
|
||||
/// @param[in] f in range [0, 1]
|
||||
PointWithAltitude Interpolate(PointWithAltitude const & to, double f) const
|
||||
{
|
||||
return PointWithAltitude(m_point + (to.m_point - m_point) * f,
|
||||
math::iround(m_altitude + (to.m_altitude - m_altitude) * f));
|
||||
}
|
||||
|
||||
private:
|
||||
friend std::string DebugPrint(PointWithAltitude const & r);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user