Skip to content

Commit

Permalink
build fixes after a painful rebase
Browse files Browse the repository at this point in the history
renamed:    Descriptors/protobuf_descriptor.hpp -> descriptors/protobuf_descriptor.hpp
  • Loading branch information
DennisOSRM committed Jan 7, 2015
1 parent 51c8e10 commit 94b780a
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 30 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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} $<TARGET_OBJECTS:COORDINATE> $<TARGET_OBJECTS:FINGERPRINT> $<TARGET_OBJECTS:GITDESCRIPTION> $<TARGET_OBJECTS:IMPORT> $<TARGET_OBJECTS:LOGGER> $<TARGET_OBJECTS:EXCEPTION>)

add_library(RESTRICTION OBJECT data_structures/restriction_map.cpp)
Expand Down
21 changes: 11 additions & 10 deletions Descriptors/protobuf_descriptor.hpp
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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"
Expand Down Expand Up @@ -72,8 +72,9 @@ template <class DataFacadeT> class PBFDescriptor : public BaseDescriptor<DataFac
public:
PBFDescriptor(DataFacadeT *facade) : super(facade) {}

void Run(const RawRouteData &raw_route, http::Reply &reply)
void Run(const InternalRouteResult &raw_route, JSON::Object &json_result) final
{
std::vector<char> result_vector;
protobufResponse::Response response;
std::string output;

Expand All @@ -83,7 +84,7 @@ template <class DataFacadeT> class PBFDescriptor : public BaseDescriptor<DataFac
response.set_status(207);
response.set_status_message("Cannot find route between points");
response.SerializeToString(&output);
reply.content.insert(reply.content.end(), output.begin(), output.end());
result_vector.insert(result_vector.end(), output.begin(), output.end());
return;
}

Expand Down Expand Up @@ -113,7 +114,7 @@ template <class DataFacadeT> class PBFDescriptor : public BaseDescriptor<DataFac
}

protobufResponse::Route main_route;
super::description_factory.Run(super::facade, super::config.zoom_level);
super::description_factory.Run(super::config.zoom_level);
if (super::config.geometry)
{
std::string route_geometry;
Expand Down Expand Up @@ -183,7 +184,7 @@ template <class DataFacadeT> class PBFDescriptor : public BaseDescriptor<DataFac
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)
{
Expand Down Expand Up @@ -250,7 +251,7 @@ template <class DataFacadeT> class PBFDescriptor : public BaseDescriptor<DataFac
SimpleLogger().Write(logDEBUG) << response.DebugString();

response.SerializeToString(&output);
reply.content.insert(reply.content.end(), output.begin(), output.end());
result_vector.insert(result_vector.end(), output.begin(), output.end());
}
};
#endif // PROTOBUF_DESCRIPTOR_H
#endif // PROTOBUF_DESCRIPTOR_HPP
8 changes: 5 additions & 3 deletions descriptors/descriptor_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef DESCRIPTOR_BASE_HPP
#define DESCRIPTOR_BASE_HPP

#include "description_factory.hpp"
#include "../algorithms/route_name_extraction.hpp"
#include "../data_structures/internal_route_result.hpp"
#include "../data_structures/phantom_node.hpp"
#include "../Util/bearing.hpp"
#include "../Util/cast.hpp"
#include "../typedefs.h"

Expand Down Expand Up @@ -202,7 +205,7 @@ template <class DataFacadeT> class BaseDescriptor
instruction.time = round(segment.duration / 10);
instruction.length_string = cast::integral_to_string(static_cast<int>(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<unsigned>(round(bearing_value));
instruction.travel_mode = segment.travel_mode;

Expand All @@ -228,14 +231,13 @@ template <class DataFacadeT> 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
5 changes: 2 additions & 3 deletions descriptors/gpx_descriptor.hpp
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -82,13 +82,12 @@ template <class DataFacadeT> class GPXDescriptor final : public BaseDescriptor<D
{
const FixedPointCoordinate current_coordinate =
super::facade->GetCoordinateOfNode(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;
}
};
Expand Down
15 changes: 3 additions & 12 deletions descriptors/json_descriptor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,13 @@ template <class DataFacadeT> 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;
}

Expand Down Expand Up @@ -117,7 +115,7 @@ template <class DataFacadeT> 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)
{
Expand Down Expand Up @@ -194,8 +192,7 @@ template <class DataFacadeT> 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)
{
Expand Down Expand Up @@ -278,12 +275,6 @@ template <class DataFacadeT> 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
Expand Down
2 changes: 1 addition & 1 deletion plugins/viaroute.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 94b780a

Please sign in to comment.