remove an unneeded parameter
This commit is contained in:
parent
37f8285a6e
commit
0325861ef3
@ -54,9 +54,7 @@ template <class DataFacadeT> class BaseDescriptor
|
|||||||
BaseDescriptor() {}
|
BaseDescriptor() {}
|
||||||
// Maybe someone can explain the pure virtual destructor thing to me (dennis)
|
// Maybe someone can explain the pure virtual destructor thing to me (dennis)
|
||||||
virtual ~BaseDescriptor() {}
|
virtual ~BaseDescriptor() {}
|
||||||
virtual void Run(const RawRouteData &raw_route,
|
virtual void Run(const RawRouteData &raw_route, http::Reply &reply) = 0;
|
||||||
const PhantomNodes &phantom_nodes,
|
|
||||||
http::Reply &reply) = 0;
|
|
||||||
virtual void SetConfig(const DescriptorConfig &config) = 0;
|
virtual void SetConfig(const DescriptorConfig &config) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -27,7 +27,16 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
#include "DescriptionFactory.h"
|
#include "DescriptionFactory.h"
|
||||||
|
|
||||||
DescriptionFactory::DescriptionFactory() : entireLength(0) {}
|
DescriptionFactory::DescriptionFactory() : entireLength(0)
|
||||||
|
{
|
||||||
|
via_indices.push_back(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<unsigned> const & DescriptionFactory::GetViaIndices() const
|
||||||
|
{
|
||||||
|
return via_indices;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void DescriptionFactory::SetStartSegment(const PhantomNode &source)
|
void DescriptionFactory::SetStartSegment(const PhantomNode &source)
|
||||||
{
|
{
|
||||||
@ -39,7 +48,7 @@ void DescriptionFactory::SetEndSegment(const PhantomNode &target)
|
|||||||
{
|
{
|
||||||
target_phantom = target;
|
target_phantom = target;
|
||||||
path_description.emplace_back(
|
path_description.emplace_back(
|
||||||
target.location, target.name_id, 0, target.reverse_weight, TurnInstruction::NoTurn, true);
|
target.location, target.name_id, 0, target.reverse_weight, TurnInstruction::NoTurn, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DescriptionFactory::AppendSegment(const FixedPointCoordinate &coordinate,
|
void DescriptionFactory::AppendSegment(const FixedPointCoordinate &coordinate,
|
||||||
|
@ -54,6 +54,8 @@ class DescriptionFactory
|
|||||||
double DegreeToRadian(const double degree) const;
|
double DegreeToRadian(const double degree) const;
|
||||||
double RadianToDegree(const double degree) const;
|
double RadianToDegree(const double degree) const;
|
||||||
|
|
||||||
|
std::vector<unsigned> via_indices;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
struct RouteSummary
|
struct RouteSummary
|
||||||
{
|
{
|
||||||
@ -82,6 +84,7 @@ class DescriptionFactory
|
|||||||
void SetStartSegment(const PhantomNode &start_phantom);
|
void SetStartSegment(const PhantomNode &start_phantom);
|
||||||
void SetEndSegment(const PhantomNode &start_phantom);
|
void SetEndSegment(const PhantomNode &start_phantom);
|
||||||
JSON::Value AppendEncodedPolylineString(const bool return_encoded);
|
JSON::Value AppendEncodedPolylineString(const bool return_encoded);
|
||||||
|
std::vector<unsigned> const & GetViaIndices() const;
|
||||||
|
|
||||||
template <class DataFacadeT> void Run(const DataFacadeT *facade, const unsigned zoomLevel)
|
template <class DataFacadeT> void Run(const DataFacadeT *facade, const unsigned zoomLevel)
|
||||||
{
|
{
|
||||||
@ -190,14 +193,24 @@ class DescriptionFactory
|
|||||||
polyline_generalizer.Run(path_description, zoomLevel);
|
polyline_generalizer.Run(path_description, zoomLevel);
|
||||||
|
|
||||||
// fix what needs to be fixed else
|
// fix what needs to be fixed else
|
||||||
|
unsigned necessary_pieces = 0;
|
||||||
for (unsigned i = 0; i < path_description.size() - 1 && path_description.size() >= 2; ++i)
|
for (unsigned i = 0; i < path_description.size() - 1 && path_description.size() >= 2; ++i)
|
||||||
{
|
{
|
||||||
if (path_description[i].necessary)
|
if (path_description[i].necessary)
|
||||||
{
|
{
|
||||||
|
if (path_description[i].is_via_location)
|
||||||
|
{
|
||||||
|
via_indices.push_back(necessary_pieces);
|
||||||
|
}
|
||||||
|
|
||||||
const double angle = path_description[i+1].location.GetBearing(path_description[i].location);
|
const double angle = path_description[i+1].location.GetBearing(path_description[i].location);
|
||||||
path_description[i].bearing = angle * 10;
|
path_description[i].bearing = angle * 10;
|
||||||
|
++necessary_pieces;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
via_indices.push_back(necessary_pieces);
|
||||||
|
BOOST_ASSERT(via_indices.size() >= 2);
|
||||||
|
BOOST_ASSERT(0 != necessary_pieces);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -62,9 +62,7 @@ template <class DataFacadeT> class GPXDescriptor : public BaseDescriptor<DataFac
|
|||||||
void SetConfig(const DescriptorConfig &c) { config = c; }
|
void SetConfig(const DescriptorConfig &c) { config = c; }
|
||||||
|
|
||||||
// TODO: reorder parameters
|
// TODO: reorder parameters
|
||||||
void Run(const RawRouteData &raw_route,
|
void Run(const RawRouteData &raw_route, http::Reply &reply)
|
||||||
const PhantomNodes &phantom_node_list,
|
|
||||||
http::Reply &reply)
|
|
||||||
{
|
{
|
||||||
std::string header("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
|
std::string header("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
|
||||||
"<gpx creator=\"OSRM Routing Engine\" version=\"1.1\" "
|
"<gpx creator=\"OSRM Routing Engine\" version=\"1.1\" "
|
||||||
@ -81,7 +79,7 @@ template <class DataFacadeT> class GPXDescriptor : public BaseDescriptor<DataFac
|
|||||||
(!raw_route.unpacked_path_segments.front().empty());
|
(!raw_route.unpacked_path_segments.front().empty());
|
||||||
if (found_route)
|
if (found_route)
|
||||||
{
|
{
|
||||||
AddRoutePoint(phantom_node_list.source_phantom.location, reply.content);
|
AddRoutePoint(raw_route.segment_end_coordinates.front().source_phantom.location, reply.content);
|
||||||
|
|
||||||
for (const std::vector<PathData> &path_data_vector : raw_route.unpacked_path_segments)
|
for (const std::vector<PathData> &path_data_vector : raw_route.unpacked_path_segments)
|
||||||
{
|
{
|
||||||
@ -92,7 +90,7 @@ template <class DataFacadeT> class GPXDescriptor : public BaseDescriptor<DataFac
|
|||||||
AddRoutePoint(current_coordinate, reply.content);
|
AddRoutePoint(current_coordinate, reply.content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AddRoutePoint(phantom_node_list.target_phantom.location, reply.content);
|
AddRoutePoint(raw_route.segment_end_coordinates.back().target_phantom.location, reply.content);
|
||||||
|
|
||||||
}
|
}
|
||||||
std::string footer("</rte></gpx>");
|
std::string footer("</rte></gpx>");
|
||||||
|
@ -161,11 +161,8 @@ template <class DataFacadeT> class ViaRoutePlugin : public BasePlugin
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
PhantomNodes phantom_nodes;
|
|
||||||
phantom_nodes.source_phantom = raw_route.segment_end_coordinates.front().source_phantom;
|
|
||||||
phantom_nodes.target_phantom = raw_route.segment_end_coordinates.back().target_phantom;
|
|
||||||
descriptor->SetConfig(descriptor_config);
|
descriptor->SetConfig(descriptor_config);
|
||||||
descriptor->Run(raw_route, phantom_nodes, reply);
|
descriptor->Run(raw_route, reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user