From 94b780a98d13487e9f9eae7b8adb33dcb8c1b02f Mon Sep 17 00:00:00 2001 From: Dennis Luxen Date: Wed, 7 Jan 2015 13:29:12 +0100 Subject: [PATCH] build fixes after a painful rebase renamed: Descriptors/protobuf_descriptor.hpp -> descriptors/protobuf_descriptor.hpp --- CMakeLists.txt | 2 +- Descriptors/protobuf_descriptor.hpp | 21 +++++++++++---------- descriptors/descriptor_base.hpp | 8 +++++--- descriptors/gpx_descriptor.hpp | 5 ++--- descriptors/json_descriptor.hpp | 15 +++------------ plugins/viaroute.hpp | 2 +- 6 files changed, 23 insertions(+), 30 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f15935b47ae..656c70db3dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,7 +69,7 @@ add_library(PHANTOMNODE OBJECT data_structures/phantom_node.cpp) add_library(EXCEPTION OBJECT Util/osrm_exception.cpp) include_directories(${CMAKE_BINARY_DIR}) -set(ExtractorSources extractor.cpp ${ExtractorGlob}) +set(ExtractorSources extract.cpp ${ExtractorGlob}) add_executable(osrm-extract ${ExtractorSources} $ $ $ $ $ $) add_library(RESTRICTION OBJECT data_structures/restriction_map.cpp) diff --git a/Descriptors/protobuf_descriptor.hpp b/Descriptors/protobuf_descriptor.hpp index 456f24c9b68..f425010cf1d 100644 --- a/Descriptors/protobuf_descriptor.hpp +++ b/Descriptors/protobuf_descriptor.hpp @@ -1,6 +1,6 @@ /* -Copyright (c) 2014, Project OSRM, Kirill Zhdanovich +Copyright (c) 2015, Project OSRM, Kirill Zhdanovich All rights reserved. Redistribution and use in source and binary forms, with or without modification, @@ -25,10 +25,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef PROTOBUF_DESCRIPTOR_H -#define PROTOBUF_DESCRIPTOR_H +#ifndef PROTOBUF_DESCRIPTOR_HPP +#define PROTOBUF_DESCRIPTOR_HPP -#include "BaseDescriptor.h" +#include "descriptor_base.hpp" #include "response.pb.h" #include "../Util/simple_logger.hpp" @@ -72,8 +72,9 @@ template class PBFDescriptor : public BaseDescriptor result_vector; protobufResponse::Response response; std::string output; @@ -83,7 +84,7 @@ template class PBFDescriptor : public BaseDescriptor class PBFDescriptor : public BaseDescriptor class PBFDescriptor : public BaseDescriptor class PBFDescriptor : public BaseDescriptor class BaseDescriptor instruction.time = round(segment.duration / 10); instruction.length_string = cast::integral_to_string(static_cast(segment.length)) + "m"; const double bearing_value = (segment.bearing / 10.); - instruction.bearing = Azimuth::Get(bearing_value); + instruction.bearing = Bearing::Get(bearing_value); instruction.azimuth = static_cast(round(bearing_value)); instruction.travel_mode = segment.travel_mode; @@ -228,14 +231,13 @@ template class BaseDescriptor instruction.position = necessary_segments_running_index - 1; instruction.time = 0; instruction.length_string = "0m"; - instruction.bearing = Azimuth::Get(0.0); + instruction.bearing = Bearing::Get(0.0); instruction.azimuth = 0.; instructions.push_back(instruction); } virtual ~BaseDescriptor() {} virtual void Run(const InternalRouteResult &, JSON::Object &) = 0; - virtual void SetConfig(const DescriptorConfig &) = 0; }; #endif // DESCRIPTOR_BASE_HPP diff --git a/descriptors/gpx_descriptor.hpp b/descriptors/gpx_descriptor.hpp index 68942eb3a56..7b39cbc9447 100644 --- a/descriptors/gpx_descriptor.hpp +++ b/descriptors/gpx_descriptor.hpp @@ -1,6 +1,6 @@ /* -Copyright (c) 2014, Project OSRM, Dennis Luxen, others +Copyright (c) 2015, Project OSRM, Dennis Luxen, others All rights reserved. Redistribution and use in source and binary forms, with or without modification, @@ -82,13 +82,12 @@ template class GPXDescriptor final : public BaseDescriptorGetCoordinateOfNode(path_data.node); - AddRoutePoint(current_coordinate, reply.content); + AddRoutePoint(current_coordinate, json_route); } } AddRoutePoint(raw_route.segment_end_coordinates.back().target_phantom.location, json_route); } - // JSON::gpx_render(reply.content, json_route); json_result.values["route"] = json_route; } }; diff --git a/descriptors/json_descriptor.hpp b/descriptors/json_descriptor.hpp index 849608f2695..8ff0947d804 100644 --- a/descriptors/json_descriptor.hpp +++ b/descriptors/json_descriptor.hpp @@ -79,15 +79,13 @@ template class JSONDescriptor final : public BaseDescriptor< return added_element_count; } - void Run(const RawRouteData &raw_route, http::Reply &reply) final + void Run(const InternalRouteResult &raw_route, JSON::Object &json_result) final { - JSON::Object json_result; if (INVALID_EDGE_WEIGHT == raw_route.shortest_path_length) { // We do not need to do much, if there is no route ;-) json_result.values["status"] = 207; json_result.values["status_message"] = "Cannot find route between points"; - JSON::render(reply.content, json_result); return; } @@ -117,7 +115,7 @@ template class JSONDescriptor final : public BaseDescriptor< raw_route.is_via_leg(i)); BOOST_ASSERT(0 < added_segments); } - super::description_factory.Run(super::facade, super::config.zoom_level); + super::description_factory.Run(super::config.zoom_level); if (super::config.geometry) { @@ -194,8 +192,7 @@ template class JSONDescriptor final : public BaseDescriptor< super::alternate_description_factory.SetEndSegment( raw_route.segment_end_coordinates.back().target_phantom, raw_route.alt_source_traversed_in_reverse.back()); - super::alternate_description_factory.Run( - super::facade, super::config.zoom_level); + super::alternate_description_factory.Run(super::config.zoom_level); if (super::config.geometry) { @@ -278,12 +275,6 @@ template class JSONDescriptor final : public BaseDescriptor< json_location_hint_array.values.emplace_back(hint); json_hint_object.values["locations"] = json_location_hint_array; json_result.values["hint_data"] = json_hint_object; - - // render the content to the output array - TIMER_START(route_render); - JSON::render(reply.content, json_result); - TIMER_STOP(route_render); - SimpleLogger().Write(logDEBUG) << "rendering took: " << TIMER_MSEC(route_render); } // TODO: reorder parameters diff --git a/plugins/viaroute.hpp b/plugins/viaroute.hpp index 1611ca04658..7deeaaca5fc 100644 --- a/plugins/viaroute.hpp +++ b/plugins/viaroute.hpp @@ -35,7 +35,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "../descriptors/descriptor_base.hpp" #include "../descriptors/gpx_descriptor.hpp" #include "../descriptors/json_descriptor.hpp" -#include "../Descriptors/ProtoBufDescriptor.h" +#include "../descriptors/protobuf_descriptor.hpp" #include "../Util/integer_range.hpp" #include "../Util/json_renderer.hpp" #include "../Util/make_unique.hpp"