Refactor routing plugins:
- remove superflous members from RawRouteData, partially implements #1238 - DescriptorTable moved to BaseDescriptor.h - added templated assignment c'tor to DescriptorConfig - refactored check for valid input coordinates, moved to BasePlugin.h - replaced shared_ptr's to descriptors in ViaRoutePlugin.h with unique_ptr - implemented FindIncrementalPhantomNode in facades for a single, i.e. first result - untangled a few includes
This commit is contained in:
@@ -35,13 +35,35 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <osrm/Reply.h>
|
||||
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
|
||||
struct DescriptorTable : public std::unordered_map<std::string, unsigned>
|
||||
{
|
||||
unsigned get_id(const std::string &key)
|
||||
{
|
||||
auto iter = find(key);
|
||||
if (iter != end())
|
||||
{
|
||||
return iter->second;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
struct DescriptorConfig
|
||||
{
|
||||
DescriptorConfig() : instructions(true), geometry(true), encode_geometry(true), zoom_level(18)
|
||||
{
|
||||
}
|
||||
|
||||
template<class OtherT>
|
||||
DescriptorConfig(const OtherT &other) : instructions(other.print_instructions),
|
||||
geometry(other.geometry),
|
||||
encode_geometry(other.compression),
|
||||
zoom_level(other.zoom_level) { }
|
||||
bool instructions;
|
||||
bool geometry;
|
||||
bool encode_geometry;
|
||||
|
||||
@@ -278,7 +278,7 @@ template <class DataFacadeT> class JSONDescriptor final : public BaseDescriptor<
|
||||
}
|
||||
|
||||
JSON::Object json_hint_object;
|
||||
json_hint_object.values["checksum"] = raw_route.check_sum;
|
||||
json_hint_object.values["checksum"] = facade->GetCheckSum();
|
||||
JSON::Array json_location_hint_array;
|
||||
std::string hint;
|
||||
for (const auto i : osrm::irange<std::size_t>(0, raw_route.segment_end_coordinates.size()))
|
||||
|
||||
Reference in New Issue
Block a user