2014-11-28 04:07:06 -05:00
|
|
|
#ifndef POLYLINECOMPRESSOR_H_
|
|
|
|
#define POLYLINECOMPRESSOR_H_
|
|
|
|
|
2016-01-02 11:13:44 -05:00
|
|
|
#include "osrm/coordinate.hpp"
|
2015-05-31 07:57:27 -04:00
|
|
|
|
2014-11-28 04:07:06 -05:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
2016-01-05 10:51:13 -05:00
|
|
|
namespace osrm
|
|
|
|
{
|
|
|
|
namespace engine
|
|
|
|
{
|
2016-01-28 10:28:44 -05:00
|
|
|
namespace detail
|
|
|
|
{
|
|
|
|
constexpr double POLYLINE_PECISION = 1e5;
|
|
|
|
constexpr double COORDINATE_TO_POLYLINE = POLYLINE_PECISION / COORDINATE_PRECISION;
|
|
|
|
constexpr double POLYLINE_TO_COORDINATE = COORDINATE_PRECISION / POLYLINE_PECISION;
|
|
|
|
}
|
|
|
|
|
|
|
|
using CoordVectorForwardIter = std::vector<FixedPointCoordinate>::const_iterator;
|
2016-01-08 07:00:24 -05:00
|
|
|
// Encodes geometry into polyline format.
|
|
|
|
// See: https://developers.google.com/maps/documentation/utilities/polylinealgorithm
|
2016-01-28 10:28:44 -05:00
|
|
|
std::string encodePolyline(CoordVectorForwardIter begin, CoordVectorForwardIter end);
|
2016-01-05 10:51:13 -05:00
|
|
|
|
2016-01-08 07:00:24 -05:00
|
|
|
// Decodes geometry from polyline format
|
|
|
|
// See: https://developers.google.com/maps/documentation/utilities/polylinealgorithm
|
2016-01-28 10:28:44 -05:00
|
|
|
std::vector<util::FixedPointCoordinate> decodePolyline(const std::string &polyline);
|
2016-01-05 10:51:13 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-28 04:07:06 -05:00
|
|
|
#endif /* POLYLINECOMPRESSOR_H_ */
|