fix changed include paths

This commit is contained in:
Dennis Luxen 2014-11-24 17:57:01 +01:00
parent 59e9a67abd
commit b50a907ca3
48 changed files with 481 additions and 461 deletions

View File

@ -25,7 +25,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <osrm/Coordinate.h>
#include "../Util/MercatorUtil.h" #include "../Util/MercatorUtil.h"
#ifndef NDEBUG #ifndef NDEBUG
#include "../Util/simple_logger.hpp" #include "../Util/simple_logger.hpp"
@ -34,6 +33,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <osrm/coordinate.hpp>
#ifndef NDEBUG #ifndef NDEBUG
#include <bitset> #include <bitset>
#endif #endif

View File

@ -25,8 +25,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef FIXED_POINT_COORDINATE_H_ #ifndef COORDINATE_HPP_
#define FIXED_POINT_COORDINATE_H_ #define COORDINATE_HPP_
#include <iosfwd> //for std::ostream #include <iosfwd> //for std::ostream
#include <string> #include <string>
@ -34,7 +34,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace namespace
{ {
constexpr float COORDINATE_PRECISION = 1000000.f; constexpr static const float COORDINATE_PRECISION = 1000000.f;
} }
struct FixedPointCoordinate struct FixedPointCoordinate
{ {
@ -110,4 +110,4 @@ inline std::ostream &operator<<(std::ostream &out_stream, FixedPointCoordinate c
return out_stream; return out_stream;
} }
#endif /* FIXED_POINT_COORDINATE_H_ */ #endif /* COORDINATE_HPP_ */

View File

@ -28,7 +28,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ROUTE_PARAMETERS_H #ifndef ROUTE_PARAMETERS_H
#define ROUTE_PARAMETERS_H #define ROUTE_PARAMETERS_H
#include <osrm/Coordinate.h> #include <osrm/coordinate.hpp>
#include <boost/fusion/container/vector/vector_fwd.hpp> #include <boost/fusion/container/vector/vector_fwd.hpp>
@ -40,7 +40,7 @@ struct RouteParameters
RouteParameters(); RouteParameters();
void setZoomLevel(const short level); void setZoomLevel(const short level);
void setNumberOfResults(const short number); void setNumberOfResults(const short number);
void setAlternateRouteFlag(const bool flag); void setAlternateRouteFlag(const bool flag);

View File

@ -28,7 +28,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef OSRM_H #ifndef OSRM_H
#define OSRM_H #define OSRM_H
#include <osrm/ServerPaths.h> #include <osrm/server_paths.hpp>
#include <memory> #include <memory>

View File

@ -44,6 +44,8 @@ namespace boost { namespace interprocess { class named_mutex; } }
#include "../Server/DataStructures/InternalDataFacade.h" #include "../Server/DataStructures/InternalDataFacade.h"
#include "../Server/DataStructures/SharedBarriers.h" #include "../Server/DataStructures/SharedBarriers.h"
#include "../Server/DataStructures/SharedDataFacade.h" #include "../Server/DataStructures/SharedDataFacade.h"
//TODO: remove
#include "../Server/Http/Reply.h"
#include "../Util/make_unique.hpp" #include "../Util/make_unique.hpp"
#include "../Util/ProgramOptions.h" #include "../Util/ProgramOptions.h"
#include "../Util/simple_logger.hpp" #include "../Util/simple_logger.hpp"
@ -52,6 +54,9 @@ namespace boost { namespace interprocess { class named_mutex; } }
#include <boost/interprocess/sync/named_condition.hpp> #include <boost/interprocess/sync/named_condition.hpp>
#include <boost/interprocess/sync/scoped_lock.hpp> #include <boost/interprocess/sync/scoped_lock.hpp>
#include <osrm/route_parameters.hpp>
#include <osrm/server_paths.hpp>
#include <algorithm> #include <algorithm>
#include <fstream> #include <fstream>
#include <utility> #include <utility>

View File

@ -32,7 +32,7 @@ class BasePlugin;
namespace http { class Reply; } namespace http { class Reply; }
struct RouteParameters; struct RouteParameters;
#include <osrm/ServerPaths.h> #include <osrm/server_paths.hpp>
#include "../data_structures/query_edge.hpp" #include "../data_structures/query_edge.hpp"

View File

@ -30,10 +30,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// #include "RequestParser.h" // #include "RequestParser.h"
#include "Http/CompressionType.h" #include "Http/CompressionType.h"
#include "Http/Reply.h"
#include "Http/Request.h" #include "Http/Request.h"
#include <osrm/Reply.h>
#include <boost/array.hpp> #include <boost/array.hpp>
#include <boost/asio.hpp> #include <boost/asio.hpp>
#include <boost/config.hpp> #include <boost/config.hpp>

View File

@ -39,7 +39,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../../Util/string_util.hpp" #include "../../Util/string_util.hpp"
#include "../../typedefs.h" #include "../../typedefs.h"
#include <osrm/Coordinate.h> #include <osrm/coordinate.hpp>
#include <string> #include <string>

View File

@ -43,8 +43,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../../Util/graph_loader.hpp" #include "../../Util/graph_loader.hpp"
#include "../../Util/simple_logger.hpp" #include "../../Util/simple_logger.hpp"
#include <osrm/Coordinate.h> #include <osrm/coordinate.hpp>
#include <osrm/ServerPaths.h> #include <osrm/server_paths.hpp>
template <class EdgeDataT> class InternalDataFacade : public BaseDataFacade<EdgeDataT> template <class EdgeDataT> class InternalDataFacade : public BaseDataFacade<EdgeDataT>
{ {

View File

@ -25,7 +25,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <osrm/Reply.h> #include "Reply.h"
#include "../../Util/cast.hpp" #include "../../Util/cast.hpp"

View File

@ -28,17 +28,17 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "RequestHandler.h" #include "RequestHandler.h"
#include "APIGrammar.h" #include "APIGrammar.h"
#include "Http/Reply.h"
#include "Http/Request.h" #include "Http/Request.h"
#include "../data_structures/json_container.hpp"
#include "../Library/OSRM.h" #include "../Library/OSRM.h"
#include "../Util/json_renderer.hpp" #include "../Util/json_renderer.hpp"
#include "../Util/simple_logger.hpp" #include "../Util/simple_logger.hpp"
#include "../Util/string_util.hpp" #include "../Util/string_util.hpp"
#include "../typedefs.h" #include "../typedefs.h"
#include <osrm/Reply.h> #include <osrm/route_parameters.hpp>
#include <osrm/RouteParameters.h> #include <osrm/json_container.hpp>
#include <ctime> #include <ctime>

View File

@ -29,7 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define REQUEST_PARSER_H #define REQUEST_PARSER_H
#include "Http/CompressionType.h" #include "Http/CompressionType.h"
#include <osrm/Header.h> #include "Http/Header.h"
#include <boost/logic/tribool.hpp> #include <boost/logic/tribool.hpp>
#include <boost/tuple/tuple.hpp> #include <boost/tuple/tuple.hpp>

View File

@ -27,12 +27,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../../algorithms/douglas_peucker.hpp" #include "../../algorithms/douglas_peucker.hpp"
#include "../../data_structures/segment_information.hpp" #include "../../data_structures/segment_information.hpp"
#include "../../Include/osrm/Coordinate.h"
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
#include <boost/test/test_case_template.hpp> #include <boost/test/test_case_template.hpp>
#include <boost/mpl/list.hpp> #include <boost/mpl/list.hpp>
#include <osrm/coordinate.hpp>
#include <iostream> #include <iostream>
BOOST_AUTO_TEST_SUITE(douglas_peucker) BOOST_AUTO_TEST_SUITE(douglas_peucker)

View File

@ -31,12 +31,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../../Util/floating_point.hpp" #include "../../Util/floating_point.hpp"
#include "../../typedefs.h" #include "../../typedefs.h"
#include <osrm/Coordinate.h>
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
#include <boost/test/test_case_template.hpp> #include <boost/test/test_case_template.hpp>
#include <boost/mpl/list.hpp> #include <boost/mpl/list.hpp>
#include <osrm/coordinate.hpp>
#include <random> #include <random>
#include <unordered_set> #include <unordered_set>

View File

@ -34,7 +34,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "osrm_exception.hpp" #include "osrm_exception.hpp"
#include "simple_logger.hpp" #include "simple_logger.hpp"
#include <osrm/ServerPaths.h> #include <osrm/server_paths.hpp>
#include <boost/any.hpp> #include <boost/any.hpp>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>

View File

@ -33,11 +33,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "osrm_exception.hpp" #include "osrm_exception.hpp"
#include "simple_logger.hpp" #include "simple_logger.hpp"
#include <osrm/ServerPaths.h>
#include <boost/any.hpp> #include <boost/any.hpp>
#include <boost/program_options.hpp> #include <boost/program_options.hpp>
#include <osrm/server_paths.hpp>
#include <fstream> #include <fstream>
#include <string> #include <string>

View File

@ -29,7 +29,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "TrigonometryTables.h" #include "TrigonometryTables.h"
#include "../Util/MercatorUtil.h" #include "../Util/MercatorUtil.h"
#include <osrm/Coordinate.h>
#include <osrm/coordinate.hpp>
#include <cmath> #include <cmath>

View File

@ -31,9 +31,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef JSON_RENDERER_HPP #ifndef JSON_RENDERER_HPP
#define JSON_RENDERER_HPP #define JSON_RENDERER_HPP
#include "../data_structures/json_container.hpp"
#include "cast.hpp" #include "cast.hpp"
#include <osrm/json_container.hpp>
namespace JSON { namespace JSON {
struct Renderer : mapbox::util::static_visitor<> struct Renderer : mapbox::util::static_visitor<>

View File

@ -28,9 +28,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef XML_RENDERER_HPP #ifndef XML_RENDERER_HPP
#define XML_RENDERER_HPP #define XML_RENDERER_HPP
#include "../data_structures/json_container.hpp"
#include "cast.hpp" #include "cast.hpp"
#include <osrm/json_container.hpp>
namespace JSON { namespace JSON {
struct XMLToArrayRenderer : mapbox::util::static_visitor<> struct XMLToArrayRenderer : mapbox::util::static_visitor<>

View File

@ -30,7 +30,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../data_structures/segment_information.hpp" #include "../data_structures/segment_information.hpp"
#include "../Util/integer_range.hpp" #include "../Util/integer_range.hpp"
#include <osrm/Coordinate.h> #include <osrm/coordinate.hpp>
#include <boost/assert.hpp> #include <boost/assert.hpp>

View File

@ -28,7 +28,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "polyline_compressor.hpp" #include "polyline_compressor.hpp"
#include "../data_structures/segment_information.hpp" #include "../data_structures/segment_information.hpp"
#include <osrm/Coordinate.h> #include <osrm/coordinate.hpp>
std::string PolylineCompressor::encode_vector(std::vector<int> &numbers) const std::string PolylineCompressor::encode_vector(std::vector<int> &numbers) const
{ {

View File

@ -30,7 +30,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "polyline_compressor.hpp" #include "polyline_compressor.hpp"
#include "../data_structures/segment_information.hpp" #include "../data_structures/segment_information.hpp"
#include <osrm/Coordinate.h> #include <osrm/coordinate.hpp>
JSON::String JSON::String
PolylineFormatter::printEncodedString(const std::vector<SegmentInformation> &polyline) const PolylineFormatter::printEncodedString(const std::vector<SegmentInformation> &polyline) const

View File

@ -30,7 +30,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
struct SegmentInformation; struct SegmentInformation;
#include "../data_structures/json_container.hpp" #include <osrm/json_container.hpp>
#include <string> #include <string>
#include <vector> #include <vector>

View File

@ -42,7 +42,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../Util/std_hash.hpp" #include "../Util/std_hash.hpp"
#include "../Util/timing_util.hpp" #include "../Util/timing_util.hpp"
#include <osrm/Coordinate.h> #include <osrm/coordinate.hpp>
#include <boost/assert.hpp> #include <boost/assert.hpp>

View File

@ -25,14 +25,14 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "../data_structures/original_edge_data.hpp" #include "../DataStructures/OriginalEdgeData.h"
#include "../data_structures/query_node.hpp" #include "../DataStructures/QueryNode.h"
#include "../data_structures/shared_memory_vector_wrapper.hpp" #include "../DataStructures/SharedMemoryVectorWrapper.h"
#include "../data_structures/static_rtree.hpp" #include "../DataStructures/StaticRTree.h"
#include "../data_structures/edge_based_node.hpp"
#include "../Util/BoostFileSystemFix.h" #include "../Util/BoostFileSystemFix.h"
#include "../DataStructures/EdgeBasedNode.h"
#include <osrm/Coordinate.h> #include <osrm/coordinate.hpp>
#include <random> #include <random>

View File

@ -31,10 +31,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../data_structures/travel_mode.hpp" #include "../data_structures/travel_mode.hpp"
#include "../typedefs.h" #include "../typedefs.h"
#include <osrm/Coordinate.h>
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <osrm/coordinate.hpp>
#include <limits> #include <limits>
struct EdgeBasedNode struct EdgeBasedNode

View File

@ -27,7 +27,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "hilbert_value.hpp" #include "hilbert_value.hpp"
#include <osrm/Coordinate.h> #include <osrm/coordinate.hpp>
uint64_t HilbertCode::operator()(const FixedPointCoordinate &current_coordinate) const uint64_t HilbertCode::operator()(const FixedPointCoordinate &current_coordinate) const
{ {

View File

@ -28,10 +28,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef PHANTOM_NODES_H #ifndef PHANTOM_NODES_H
#define PHANTOM_NODES_H #define PHANTOM_NODES_H
#include <osrm/Coordinate.h> #include "../DataStructures/TravelMode.h"
#include "../data_structures/travel_mode.hpp"
#include "../typedefs.h" #include "../typedefs.h"
#include <osrm/coordinate.hpp>
#include <iostream> #include <iostream>
#include <vector> #include <vector>

View File

@ -30,10 +30,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../typedefs.h" #include "../typedefs.h"
#include <osrm/Coordinate.h>
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <osrm/coordinate.hpp>
#include <limits> #include <limits>
struct QueryNode struct QueryNode

View File

@ -33,7 +33,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../data_structures/turn_instructions.hpp" #include "../data_structures/turn_instructions.hpp"
#include "../typedefs.h" #include "../typedefs.h"
#include <osrm/Coordinate.h> #include <osrm/coordinate.hpp>
#include <vector> #include <vector>

View File

@ -25,12 +25,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <osrm/RouteParameters.h>
#include <boost/fusion/container/vector.hpp> #include <boost/fusion/container/vector.hpp>
#include <boost/fusion/sequence/intrinsic.hpp> #include <boost/fusion/sequence/intrinsic.hpp>
#include <boost/fusion/include/at_c.hpp> #include <boost/fusion/include/at_c.hpp>
#include <osrm/route_parameters.hpp>
RouteParameters::RouteParameters() RouteParameters::RouteParameters()
: zoom_level(18), print_instructions(false), alternate_route(true), geometry(true), : zoom_level(18), print_instructions(false), alternate_route(true), geometry(true),
compression(true), deprecatedAPI(false), uturn_default(false), check_sum(-1), num_results(1) compression(true), deprecatedAPI(false), uturn_default(false), check_sum(-1), num_results(1)

View File

@ -33,7 +33,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../data_structures/travel_mode.hpp" #include "../data_structures/travel_mode.hpp"
#include "../typedefs.h" #include "../typedefs.h"
#include <osrm/Coordinate.h> #include <osrm/coordinate.hpp>
// Struct fits everything in one cache line // Struct fits everything in one cache line
struct SegmentInformation struct SegmentInformation

View File

@ -44,7 +44,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../Util/timing_util.hpp" #include "../Util/timing_util.hpp"
#include "../typedefs.h" #include "../typedefs.h"
#include <osrm/Coordinate.h> #include <osrm/coordinate.hpp>
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>

View File

@ -43,7 +43,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "Util/FingerPrint.h" #include "Util/FingerPrint.h"
#include "typedefs.h" #include "typedefs.h"
#include <osrm/Coordinate.h> #include <osrm/coordinate.hpp>
using RTreeLeaf = BaseDataFacade<QueryEdge::EdgeData>::RTreeLeaf; using RTreeLeaf = BaseDataFacade<QueryEdge::EdgeData>::RTreeLeaf;
using RTreeNode = StaticRTree<RTreeLeaf, ShM<FixedPointCoordinate, true>::vector, true>::TreeNode; using RTreeNode = StaticRTree<RTreeLeaf, ShM<FixedPointCoordinate, true>::vector, true>::TreeNode;

View File

@ -27,8 +27,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "description_factory.hpp" #include "description_factory.hpp"
#include <osrm/Coordinate.h>
#include "../typedefs.h" #include "../typedefs.h"
#include "../algorithms/polyline_formatter.hpp" #include "../algorithms/polyline_formatter.hpp"
#include "../data_structures/raw_route_data.hpp" #include "../data_structures/raw_route_data.hpp"

View File

@ -33,11 +33,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../data_structures/json_container.hpp" #include "../data_structures/json_container.hpp"
#include "../data_structures/segment_information.hpp" #include "../data_structures/segment_information.hpp"
#include "../data_structures/turn_instructions.hpp" #include "../data_structures/turn_instructions.hpp"
#include "../typedefs.h"
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <osrm/Coordinate.h> #include <osrm/coordinate.hpp>
#include <osrm/json_container.hpp>
#include <cmath> #include <cmath>

View File

@ -32,13 +32,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../data_structures/raw_route_data.hpp" #include "../data_structures/raw_route_data.hpp"
#include "../typedefs.h" #include "../typedefs.h"
#include <osrm/Reply.h>
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
struct DescriptorTable : public std::unordered_map<std::string, unsigned> struct DescriptorTable : public std::unordered_map<std::string, unsigned>
{ {
unsigned get_id(const std::string &key) unsigned get_id(const std::string &key)

View File

@ -29,9 +29,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define GPX_DESCRIPTOR_HPP #define GPX_DESCRIPTOR_HPP
#include "descriptor_base.hpp" #include "descriptor_base.hpp"
#include "../data_structures/json_container.hpp"
#include "../Util/xml_renderer.hpp" #include "../Util/xml_renderer.hpp"
#include <osrm/json_container.hpp>
#include <iostream> #include <iostream>
template <class DataFacadeT> class GPXDescriptor final : public BaseDescriptor<DataFacadeT> template <class DataFacadeT> class GPXDescriptor final : public BaseDescriptor<DataFacadeT>

View File

@ -1,393 +1,395 @@
/* /*
Copyright (c) 2014, Project OSRM, Dennis Luxen, others Copyright (c) 2014, Project OSRM, Dennis Luxen, others
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met: are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer. of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution. other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef JSON_DESCRIPTOR_HPP #ifndef JSON_DESCRIPTOR_HPP
#define JSON_DESCRIPTOR_HPP #define JSON_DESCRIPTOR_HPP
#include "descriptor_base.hpp" #include "descriptor_base.hpp"
#include "description_factory.hpp" #include "description_factory.hpp"
#include "../algorithms/object_encoder.hpp" #include "../algorithms/object_encoder.hpp"
#include "../algorithms/route_name_extraction.hpp" #include "../algorithms/route_name_extraction.hpp"
#include "../data_structures/json_container.hpp" #include "../data_structures/json_container.hpp"
#include "../data_structures/segment_information.hpp" #include "../data_structures/segment_information.hpp"
#include "../data_structures/turn_instructions.hpp" #include "../data_structures/turn_instructions.hpp"
#include "../Util/bearing.hpp" #include "../Util/bearing.hpp"
#include "../Util/integer_range.hpp" #include "../Util/integer_range.hpp"
#include "../Util/json_renderer.hpp" #include "../Util/json_renderer.hpp"
#include "../Util/simple_logger.hpp" #include "../Util/simple_logger.hpp"
#include "../Util/string_util.hpp" #include "../Util/StringUtil.h"
#include "../Util/timing_util.hpp" #include "../Util/timing_util.hpp"
#include <algorithm> #include <osrm/json_container.hpp>
template <class DataFacadeT> class JSONDescriptor final : public BaseDescriptor<DataFacadeT> #include <algorithm>
{
private: template <class DataFacadeT> class JSONDescriptor final : public BaseDescriptor<DataFacadeT>
DataFacadeT *facade; {
DescriptorConfig config; private:
DescriptionFactory description_factory, alternate_description_factory; DataFacadeT *facade;
FixedPointCoordinate current; DescriptorConfig config;
unsigned entered_restricted_area_count; DescriptionFactory description_factory, alternate_description_factory;
struct RoundAbout FixedPointCoordinate current;
{ unsigned entered_restricted_area_count;
RoundAbout() : start_index(INT_MAX), name_id(INVALID_NAMEID), leave_at_exit(INT_MAX) {} struct RoundAbout
int start_index; {
unsigned name_id; RoundAbout() : start_index(INT_MAX), name_id(INVALID_NAMEID), leave_at_exit(INT_MAX) {}
int leave_at_exit; int start_index;
} round_about; unsigned name_id;
int leave_at_exit;
struct Segment } round_about;
{
Segment() : name_id(INVALID_NAMEID), length(-1), position(0) {} struct Segment
Segment(unsigned n, int l, unsigned p) : name_id(n), length(l), position(p) {} {
unsigned name_id; Segment() : name_id(INVALID_NAMEID), length(-1), position(0) {}
int length; Segment(unsigned n, int l, unsigned p) : name_id(n), length(l), position(p) {}
unsigned position; unsigned name_id;
}; int length;
std::vector<Segment> shortest_path_segments, alternative_path_segments; unsigned position;
ExtractRouteNames<DataFacadeT, Segment> GenerateRouteNames; };
std::vector<Segment> shortest_path_segments, alternative_path_segments;
public: ExtractRouteNames<DataFacadeT, Segment> GenerateRouteNames;
explicit JSONDescriptor(DataFacadeT *facade) : facade(facade), entered_restricted_area_count(0) {}
public:
void SetConfig(const DescriptorConfig &c) final { config = c; } explicit JSONDescriptor(DataFacadeT *facade) : facade(facade), entered_restricted_area_count(0) {}
unsigned DescribeLeg(const std::vector<PathData> route_leg, void SetConfig(const DescriptorConfig &c) final { config = c; }
const PhantomNodes &leg_phantoms,
const bool target_traversed_in_reverse, unsigned DescribeLeg(const std::vector<PathData> route_leg,
const bool is_via_leg) const PhantomNodes &leg_phantoms,
{ const bool target_traversed_in_reverse,
unsigned added_element_count = 0; const bool is_via_leg)
// Get all the coordinates for the computed route {
FixedPointCoordinate current_coordinate; unsigned added_element_count = 0;
for (const PathData &path_data : route_leg) // Get all the coordinates for the computed route
{ FixedPointCoordinate current_coordinate;
current_coordinate = facade->GetCoordinateOfNode(path_data.node); for (const PathData &path_data : route_leg)
description_factory.AppendSegment(current_coordinate, path_data); {
++added_element_count; current_coordinate = facade->GetCoordinateOfNode(path_data.node);
} description_factory.AppendSegment(current_coordinate, path_data);
description_factory.SetEndSegment( ++added_element_count;
leg_phantoms.target_phantom, target_traversed_in_reverse, is_via_leg); }
++added_element_count; description_factory.SetEndSegment(
BOOST_ASSERT((route_leg.size() + 1) == added_element_count); leg_phantoms.target_phantom, target_traversed_in_reverse, is_via_leg);
return added_element_count; ++added_element_count;
} BOOST_ASSERT((route_leg.size() + 1) == added_element_count);
return added_element_count;
void Run(const RawRouteData &raw_route, http::Reply &reply) final }
{
JSON::Object json_result; void Run(const RawRouteData &raw_route, http::Reply &reply) final
if (INVALID_EDGE_WEIGHT == raw_route.shortest_path_length) {
{ JSON::Object json_result;
// We do not need to do much, if there is no route ;-) if (INVALID_EDGE_WEIGHT == raw_route.shortest_path_length)
json_result.values["status"] = 207; {
json_result.values["status_message"] = "Cannot find route between points"; // We do not need to do much, if there is no route ;-)
JSON::render(reply.content, json_result); json_result.values["status"] = 207;
return; json_result.values["status_message"] = "Cannot find route between points";
} JSON::render(reply.content, json_result);
return;
// check if first segment is non-zero }
std::string road_name = facade->GetEscapedNameForNameID(
raw_route.segment_end_coordinates.front().source_phantom.name_id); // check if first segment is non-zero
std::string road_name = facade->GetEscapedNameForNameID(
BOOST_ASSERT(raw_route.unpacked_path_segments.size() == raw_route.segment_end_coordinates.front().source_phantom.name_id);
raw_route.segment_end_coordinates.size());
BOOST_ASSERT(raw_route.unpacked_path_segments.size() ==
description_factory.SetStartSegment( raw_route.segment_end_coordinates.size());
raw_route.segment_end_coordinates.front().source_phantom,
raw_route.source_traversed_in_reverse.front()); description_factory.SetStartSegment(
json_result.values["status"] = 0; raw_route.segment_end_coordinates.front().source_phantom,
json_result.values["status_message"] = "Found route between points"; raw_route.source_traversed_in_reverse.front());
json_result.values["status"] = 0;
// for each unpacked segment add the leg to the description json_result.values["status_message"] = "Found route between points";
for (const auto i : osrm::irange<std::size_t>(0, raw_route.unpacked_path_segments.size()))
{ // for each unpacked segment add the leg to the description
#ifndef NDEBUG for (const auto i : osrm::irange<std::size_t>(0, raw_route.unpacked_path_segments.size()))
const int added_segments = {
#endif #ifndef NDEBUG
DescribeLeg(raw_route.unpacked_path_segments[i], const int added_segments =
raw_route.segment_end_coordinates[i], #endif
raw_route.target_traversed_in_reverse[i], DescribeLeg(raw_route.unpacked_path_segments[i],
raw_route.is_via_leg(i)); raw_route.segment_end_coordinates[i],
BOOST_ASSERT(0 < added_segments); raw_route.target_traversed_in_reverse[i],
} raw_route.is_via_leg(i));
description_factory.Run(facade, config.zoom_level); BOOST_ASSERT(0 < added_segments);
}
if (config.geometry) description_factory.Run(facade, config.zoom_level);
{
JSON::Value route_geometry = if (config.geometry)
description_factory.AppendGeometryString(config.encode_geometry); {
json_result.values["route_geometry"] = route_geometry; JSON::Value route_geometry =
} description_factory.AppendGeometryString(config.encode_geometry);
if (config.instructions) json_result.values["route_geometry"] = route_geometry;
{ }
JSON::Array json_route_instructions; if (config.instructions)
BuildTextualDescription(description_factory, {
json_route_instructions, JSON::Array json_route_instructions;
raw_route.shortest_path_length, BuildTextualDescription(description_factory,
shortest_path_segments); json_route_instructions,
json_result.values["route_instructions"] = json_route_instructions; raw_route.shortest_path_length,
} shortest_path_segments);
description_factory.BuildRouteSummary(description_factory.get_entire_length(), json_result.values["route_instructions"] = json_route_instructions;
raw_route.shortest_path_length); }
JSON::Object json_route_summary; description_factory.BuildRouteSummary(description_factory.get_entire_length(),
json_route_summary.values["total_distance"] = description_factory.summary.distance; raw_route.shortest_path_length);
json_route_summary.values["total_time"] = description_factory.summary.duration; JSON::Object json_route_summary;
json_route_summary.values["start_point"] = json_route_summary.values["total_distance"] = description_factory.summary.distance;
facade->GetEscapedNameForNameID(description_factory.summary.source_name_id); json_route_summary.values["total_time"] = description_factory.summary.duration;
json_route_summary.values["end_point"] = json_route_summary.values["start_point"] =
facade->GetEscapedNameForNameID(description_factory.summary.target_name_id); facade->GetEscapedNameForNameID(description_factory.summary.source_name_id);
json_result.values["route_summary"] = json_route_summary; json_route_summary.values["end_point"] =
facade->GetEscapedNameForNameID(description_factory.summary.target_name_id);
BOOST_ASSERT(!raw_route.segment_end_coordinates.empty()); json_result.values["route_summary"] = json_route_summary;
JSON::Array json_via_points_array; BOOST_ASSERT(!raw_route.segment_end_coordinates.empty());
JSON::Array json_first_coordinate;
json_first_coordinate.values.push_back( JSON::Array json_via_points_array;
raw_route.segment_end_coordinates.front().source_phantom.location.lat / JSON::Array json_first_coordinate;
COORDINATE_PRECISION); json_first_coordinate.values.push_back(
json_first_coordinate.values.push_back( raw_route.segment_end_coordinates.front().source_phantom.location.lat /
raw_route.segment_end_coordinates.front().source_phantom.location.lon / COORDINATE_PRECISION);
COORDINATE_PRECISION); json_first_coordinate.values.push_back(
json_via_points_array.values.push_back(json_first_coordinate); raw_route.segment_end_coordinates.front().source_phantom.location.lon /
for (const PhantomNodes &nodes : raw_route.segment_end_coordinates) COORDINATE_PRECISION);
{ json_via_points_array.values.push_back(json_first_coordinate);
std::string tmp; for (const PhantomNodes &nodes : raw_route.segment_end_coordinates)
JSON::Array json_coordinate; {
json_coordinate.values.push_back(nodes.target_phantom.location.lat / std::string tmp;
COORDINATE_PRECISION); JSON::Array json_coordinate;
json_coordinate.values.push_back(nodes.target_phantom.location.lon / json_coordinate.values.push_back(nodes.target_phantom.location.lat /
COORDINATE_PRECISION); COORDINATE_PRECISION);
json_via_points_array.values.push_back(json_coordinate); json_coordinate.values.push_back(nodes.target_phantom.location.lon /
} COORDINATE_PRECISION);
json_result.values["via_points"] = json_via_points_array; json_via_points_array.values.push_back(json_coordinate);
}
JSON::Array json_via_indices_array; json_result.values["via_points"] = json_via_points_array;
std::vector<unsigned> const &shortest_leg_end_indices = description_factory.GetViaIndices(); JSON::Array json_via_indices_array;
json_via_indices_array.values.insert(json_via_indices_array.values.end(),
shortest_leg_end_indices.begin(), std::vector<unsigned> const &shortest_leg_end_indices = description_factory.GetViaIndices();
shortest_leg_end_indices.end()); json_via_indices_array.values.insert(json_via_indices_array.values.end(),
json_result.values["via_indices"] = json_via_indices_array; shortest_leg_end_indices.begin(),
shortest_leg_end_indices.end());
// only one alternative route is computed at this time, so this is hardcoded json_result.values["via_indices"] = json_via_indices_array;
if (INVALID_EDGE_WEIGHT != raw_route.alternative_path_length)
{ // only one alternative route is computed at this time, so this is hardcoded
json_result.values["found_alternative"] = JSON::True(); if (INVALID_EDGE_WEIGHT != raw_route.alternative_path_length)
BOOST_ASSERT(!raw_route.alt_source_traversed_in_reverse.empty()); {
alternate_description_factory.SetStartSegment( json_result.values["found_alternative"] = JSON::True();
raw_route.segment_end_coordinates.front().source_phantom, BOOST_ASSERT(!raw_route.alt_source_traversed_in_reverse.empty());
raw_route.alt_source_traversed_in_reverse.front()); alternate_description_factory.SetStartSegment(
// Get all the coordinates for the computed route raw_route.segment_end_coordinates.front().source_phantom,
for (const PathData &path_data : raw_route.unpacked_alternative) raw_route.alt_source_traversed_in_reverse.front());
{ // Get all the coordinates for the computed route
current = facade->GetCoordinateOfNode(path_data.node); for (const PathData &path_data : raw_route.unpacked_alternative)
alternate_description_factory.AppendSegment(current, path_data); {
} current = facade->GetCoordinateOfNode(path_data.node);
alternate_description_factory.SetEndSegment( alternate_description_factory.AppendSegment(current, path_data);
raw_route.segment_end_coordinates.back().target_phantom, }
raw_route.alt_source_traversed_in_reverse.back()); alternate_description_factory.SetEndSegment(
alternate_description_factory.Run(facade, config.zoom_level); raw_route.segment_end_coordinates.back().target_phantom,
raw_route.alt_source_traversed_in_reverse.back());
if (config.geometry) alternate_description_factory.Run(facade, config.zoom_level);
{
JSON::Value alternate_geometry_string = if (config.geometry)
alternate_description_factory.AppendGeometryString(config.encode_geometry); {
JSON::Array json_alternate_geometries_array; JSON::Value alternate_geometry_string =
json_alternate_geometries_array.values.push_back(alternate_geometry_string); alternate_description_factory.AppendGeometryString(config.encode_geometry);
json_result.values["alternative_geometries"] = json_alternate_geometries_array; JSON::Array json_alternate_geometries_array;
} json_alternate_geometries_array.values.push_back(alternate_geometry_string);
// Generate instructions for each alternative (simulated here) json_result.values["alternative_geometries"] = json_alternate_geometries_array;
JSON::Array json_alt_instructions; }
JSON::Array json_current_alt_instructions; // Generate instructions for each alternative (simulated here)
if (config.instructions) JSON::Array json_alt_instructions;
{ JSON::Array json_current_alt_instructions;
BuildTextualDescription(alternate_description_factory, if (config.instructions)
json_current_alt_instructions, {
raw_route.alternative_path_length, BuildTextualDescription(alternate_description_factory,
alternative_path_segments); json_current_alt_instructions,
json_alt_instructions.values.push_back(json_current_alt_instructions); raw_route.alternative_path_length,
json_result.values["alternative_instructions"] = json_alt_instructions; alternative_path_segments);
} json_alt_instructions.values.push_back(json_current_alt_instructions);
alternate_description_factory.BuildRouteSummary( json_result.values["alternative_instructions"] = json_alt_instructions;
alternate_description_factory.get_entire_length(), raw_route.alternative_path_length); }
alternate_description_factory.BuildRouteSummary(
JSON::Object json_alternate_route_summary; alternate_description_factory.get_entire_length(), raw_route.alternative_path_length);
JSON::Array json_alternate_route_summary_array;
json_alternate_route_summary.values["total_distance"] = JSON::Object json_alternate_route_summary;
alternate_description_factory.summary.distance; JSON::Array json_alternate_route_summary_array;
json_alternate_route_summary.values["total_time"] = json_alternate_route_summary.values["total_distance"] =
alternate_description_factory.summary.duration; alternate_description_factory.summary.distance;
json_alternate_route_summary.values["start_point"] = facade->GetEscapedNameForNameID( json_alternate_route_summary.values["total_time"] =
alternate_description_factory.summary.source_name_id); alternate_description_factory.summary.duration;
json_alternate_route_summary.values["end_point"] = facade->GetEscapedNameForNameID( json_alternate_route_summary.values["start_point"] = facade->GetEscapedNameForNameID(
alternate_description_factory.summary.target_name_id); alternate_description_factory.summary.source_name_id);
json_alternate_route_summary_array.values.push_back(json_alternate_route_summary); json_alternate_route_summary.values["end_point"] = facade->GetEscapedNameForNameID(
json_result.values["alternative_summaries"] = json_alternate_route_summary_array; alternate_description_factory.summary.target_name_id);
json_alternate_route_summary_array.values.push_back(json_alternate_route_summary);
std::vector<unsigned> const &alternate_leg_end_indices = json_result.values["alternative_summaries"] = json_alternate_route_summary_array;
alternate_description_factory.GetViaIndices();
JSON::Array json_altenative_indices_array; std::vector<unsigned> const &alternate_leg_end_indices =
json_altenative_indices_array.values.insert(json_altenative_indices_array.values.end(), alternate_description_factory.GetViaIndices();
alternate_leg_end_indices.begin(), JSON::Array json_altenative_indices_array;
alternate_leg_end_indices.end()); json_altenative_indices_array.values.insert(json_altenative_indices_array.values.end(),
json_result.values["alternative_indices"] = json_altenative_indices_array; alternate_leg_end_indices.begin(),
} alternate_leg_end_indices.end());
else json_result.values["alternative_indices"] = json_altenative_indices_array;
{ }
json_result.values["found_alternative"] = JSON::False(); else
} {
json_result.values["found_alternative"] = JSON::False();
// Get Names for both routes }
RouteNames route_names =
GenerateRouteNames(shortest_path_segments, alternative_path_segments, facade); // Get Names for both routes
JSON::Array json_route_names; RouteNames route_names =
json_route_names.values.push_back(route_names.shortest_path_name_1); GenerateRouteNames(shortest_path_segments, alternative_path_segments, facade);
json_route_names.values.push_back(route_names.shortest_path_name_2); JSON::Array json_route_names;
json_result.values["route_name"] = json_route_names; json_route_names.values.push_back(route_names.shortest_path_name_1);
json_route_names.values.push_back(route_names.shortest_path_name_2);
if (INVALID_EDGE_WEIGHT != raw_route.alternative_path_length) json_result.values["route_name"] = json_route_names;
{
JSON::Array json_alternate_names_array; if (INVALID_EDGE_WEIGHT != raw_route.alternative_path_length)
JSON::Array json_alternate_names; {
json_alternate_names.values.push_back(route_names.alternative_path_name_1); JSON::Array json_alternate_names_array;
json_alternate_names.values.push_back(route_names.alternative_path_name_2); JSON::Array json_alternate_names;
json_alternate_names_array.values.push_back(json_alternate_names); json_alternate_names.values.push_back(route_names.alternative_path_name_1);
json_result.values["alternative_names"] = json_alternate_names_array; json_alternate_names.values.push_back(route_names.alternative_path_name_2);
} json_alternate_names_array.values.push_back(json_alternate_names);
json_result.values["alternative_names"] = json_alternate_names_array;
JSON::Object json_hint_object; }
json_hint_object.values["checksum"] = facade->GetCheckSum();
JSON::Array json_location_hint_array; JSON::Object json_hint_object;
std::string hint; json_hint_object.values["checksum"] = facade->GetCheckSum();
for (const auto i : osrm::irange<std::size_t>(0, raw_route.segment_end_coordinates.size())) JSON::Array json_location_hint_array;
{ std::string hint;
ObjectEncoder::EncodeToBase64(raw_route.segment_end_coordinates[i].source_phantom, hint); for (const auto i : osrm::irange<std::size_t>(0, raw_route.segment_end_coordinates.size()))
json_location_hint_array.values.push_back(hint); {
} ObjectEncoder::EncodeToBase64(raw_route.segment_end_coordinates[i].source_phantom, hint);
ObjectEncoder::EncodeToBase64(raw_route.segment_end_coordinates.back().target_phantom, hint); json_location_hint_array.values.push_back(hint);
json_location_hint_array.values.push_back(hint); }
json_hint_object.values["locations"] = json_location_hint_array; ObjectEncoder::EncodeToBase64(raw_route.segment_end_coordinates.back().target_phantom, hint);
json_result.values["hint_data"] = json_hint_object; json_location_hint_array.values.push_back(hint);
json_hint_object.values["locations"] = json_location_hint_array;
// render the content to the output array json_result.values["hint_data"] = json_hint_object;
TIMER_START(route_render);
JSON::render(reply.content, json_result); // render the content to the output array
TIMER_STOP(route_render); TIMER_START(route_render);
SimpleLogger().Write(logDEBUG) << "rendering took: " << TIMER_MSEC(route_render); JSON::render(reply.content, json_result);
} TIMER_STOP(route_render);
SimpleLogger().Write(logDEBUG) << "rendering took: " << TIMER_MSEC(route_render);
// TODO: reorder parameters }
inline void BuildTextualDescription(DescriptionFactory &description_factory,
JSON::Array &json_instruction_array, // TODO: reorder parameters
const int route_length, inline void BuildTextualDescription(DescriptionFactory &description_factory,
std::vector<Segment> &route_segments_list) JSON::Array &json_instruction_array,
{ const int route_length,
// Segment information has following format: std::vector<Segment> &route_segments_list)
//["instruction id","streetname",length,position,time,"length","earth_direction",azimuth] {
unsigned necessary_segments_running_index = 0; // Segment information has following format:
round_about.leave_at_exit = 0; //["instruction id","streetname",length,position,time,"length","earth_direction",azimuth]
round_about.name_id = 0; unsigned necessary_segments_running_index = 0;
std::string temp_dist, temp_length, temp_duration, temp_bearing, temp_instruction; round_about.leave_at_exit = 0;
round_about.name_id = 0;
// Fetch data from Factory and generate a string from it. std::string temp_dist, temp_length, temp_duration, temp_bearing, temp_instruction;
for (const SegmentInformation &segment : description_factory.path_description)
{ // Fetch data from Factory and generate a string from it.
JSON::Array json_instruction_row; for (const SegmentInformation &segment : description_factory.path_description)
TurnInstruction current_instruction = segment.turn_instruction; {
entered_restricted_area_count += (current_instruction != segment.turn_instruction); JSON::Array json_instruction_row;
if (TurnInstructionsClass::TurnIsNecessary(current_instruction)) TurnInstruction current_instruction = segment.turn_instruction;
{ entered_restricted_area_count += (current_instruction != segment.turn_instruction);
if (TurnInstruction::EnterRoundAbout == current_instruction) if (TurnInstructionsClass::TurnIsNecessary(current_instruction))
{ {
round_about.name_id = segment.name_id; if (TurnInstruction::EnterRoundAbout == current_instruction)
round_about.start_index = necessary_segments_running_index; {
} round_about.name_id = segment.name_id;
else round_about.start_index = necessary_segments_running_index;
{ }
std::string current_turn_instruction; else
if (TurnInstruction::LeaveRoundAbout == current_instruction) {
{ std::string current_turn_instruction;
temp_instruction = if (TurnInstruction::LeaveRoundAbout == current_instruction)
cast::integral_to_string(cast::enum_to_underlying(TurnInstruction::EnterRoundAbout)); {
current_turn_instruction += temp_instruction; temp_instruction =
current_turn_instruction += "-"; cast::integral_to_string(cast::enum_to_underlying(TurnInstruction::EnterRoundAbout));
temp_instruction = cast::integral_to_string(round_about.leave_at_exit + 1); current_turn_instruction += temp_instruction;
current_turn_instruction += temp_instruction; current_turn_instruction += "-";
round_about.leave_at_exit = 0; temp_instruction = cast::integral_to_string(round_about.leave_at_exit + 1);
} current_turn_instruction += temp_instruction;
else round_about.leave_at_exit = 0;
{ }
temp_instruction = cast::integral_to_string(cast::enum_to_underlying(current_instruction)); else
current_turn_instruction += temp_instruction; {
} temp_instruction = cast::integral_to_string(cast::enum_to_underlying(current_instruction));
json_instruction_row.values.push_back(current_turn_instruction); current_turn_instruction += temp_instruction;
}
json_instruction_row.values.push_back( json_instruction_row.values.push_back(current_turn_instruction);
facade->GetEscapedNameForNameID(segment.name_id));
json_instruction_row.values.push_back(std::round(segment.length)); json_instruction_row.values.push_back(
json_instruction_row.values.push_back(necessary_segments_running_index); facade->GetEscapedNameForNameID(segment.name_id));
json_instruction_row.values.push_back(round(segment.duration / 10)); json_instruction_row.values.push_back(std::round(segment.length));
json_instruction_row.values.push_back( json_instruction_row.values.push_back(necessary_segments_running_index);
cast::integral_to_string(static_cast<unsigned>(segment.length)) + "m"); json_instruction_row.values.push_back(round(segment.duration / 10));
const double bearing_value = (segment.bearing / 10.); json_instruction_row.values.push_back(
json_instruction_row.values.push_back(Bearing::Get(bearing_value)); cast::integral_to_string(static_cast<unsigned>(segment.length)) + "m");
json_instruction_row.values.push_back( const double bearing_value = (segment.bearing / 10.);
static_cast<unsigned>(round(bearing_value))); json_instruction_row.values.push_back(Bearing::Get(bearing_value));
json_instruction_row.values.push_back(segment.travel_mode); json_instruction_row.values.push_back(
static_cast<unsigned>(round(bearing_value)));
route_segments_list.emplace_back( json_instruction_row.values.push_back(segment.travel_mode);
segment.name_id,
static_cast<int>(segment.length), route_segments_list.emplace_back(
static_cast<unsigned>(route_segments_list.size())); segment.name_id,
json_instruction_array.values.push_back(json_instruction_row); static_cast<int>(segment.length),
} static_cast<unsigned>(route_segments_list.size()));
} json_instruction_array.values.push_back(json_instruction_row);
else if (TurnInstruction::StayOnRoundAbout == current_instruction) }
{ }
++round_about.leave_at_exit; else if (TurnInstruction::StayOnRoundAbout == current_instruction)
} {
if (segment.necessary) ++round_about.leave_at_exit;
{ }
++necessary_segments_running_index; if (segment.necessary)
} {
} ++necessary_segments_running_index;
}
JSON::Array json_last_instruction_row; }
temp_instruction = cast::integral_to_string(cast::enum_to_underlying(TurnInstruction::ReachedYourDestination));
json_last_instruction_row.values.push_back(temp_instruction); JSON::Array json_last_instruction_row;
json_last_instruction_row.values.push_back(""); temp_instruction = cast::integral_to_string(cast::enum_to_underlying(TurnInstruction::ReachedYourDestination));
json_last_instruction_row.values.push_back(0); json_last_instruction_row.values.push_back(temp_instruction);
json_last_instruction_row.values.push_back(necessary_segments_running_index - 1); json_last_instruction_row.values.push_back("");
json_last_instruction_row.values.push_back(0); json_last_instruction_row.values.push_back(0);
json_last_instruction_row.values.push_back("0m"); json_last_instruction_row.values.push_back(necessary_segments_running_index - 1);
json_last_instruction_row.values.push_back(Bearing::Get(0.0)); json_last_instruction_row.values.push_back(0);
json_last_instruction_row.values.push_back(0.); json_last_instruction_row.values.push_back("0m");
json_instruction_array.values.push_back(json_last_instruction_row); json_last_instruction_row.values.push_back(Bearing::Get(0.0));
} json_last_instruction_row.values.push_back(0.);
}; json_instruction_array.values.push_back(json_last_instruction_row);
}
#endif /* JSON_DESCRIPTOR_HPP */ };
#endif /* JSON_DESCRIPTOR_HPP */

View File

@ -35,7 +35,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../Util/container.hpp" #include "../Util/container.hpp"
#include "../Util/simple_logger.hpp" #include "../Util/simple_logger.hpp"
#include <osrm/Coordinate.h> #include <osrm/coordinate.hpp>
#include <limits> #include <limits>
#include <string> #include <string>

View File

@ -34,6 +34,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <osrm/coordinate.hpp>
struct InternalExtractorEdge struct InternalExtractorEdge
{ {
InternalExtractorEdge() InternalExtractorEdge()

View File

@ -31,7 +31,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "plugin_base.hpp" #include "plugin_base.hpp"
#include "../algorithms/object_encoder.hpp" #include "../algorithms/object_encoder.hpp"
#include "../data_structures/json_container.hpp"
#include "../data_structures/query_edge.hpp" #include "../data_structures/query_edge.hpp"
#include "../data_structures/search_engine.hpp" #include "../data_structures/search_engine.hpp"
#include "../descriptors/descriptor_base.hpp" #include "../descriptors/descriptor_base.hpp"
@ -40,6 +39,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../Util/string_util.hpp" #include "../Util/string_util.hpp"
#include "../Util/timing_util.hpp" #include "../Util/timing_util.hpp"
#include <osrm/json_container.hpp>
#include <cstdlib> #include <cstdlib>
#include <algorithm> #include <algorithm>

View File

@ -34,6 +34,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../Util/cast.hpp" #include "../Util/cast.hpp"
#include "../Util/json_renderer.hpp" #include "../Util/json_renderer.hpp"
#include <osrm/json_container.hpp>
#include <string> #include <string>
class HelloWorldPlugin final : public BasePlugin class HelloWorldPlugin final : public BasePlugin

View File

@ -30,10 +30,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "plugin_base.hpp" #include "plugin_base.hpp"
#include "../data_structures/json_container.hpp"
#include "../Util/json_renderer.hpp" #include "../Util/json_renderer.hpp"
#include "../Util/string_util.hpp" #include "../Util/string_util.hpp"
#include <osrm/json_container.hpp>
#include <string> #include <string>
// locates the nearest node in the road network for a given coordinate. // locates the nearest node in the road network for a given coordinate.

View File

@ -30,11 +30,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "plugin_base.hpp" #include "plugin_base.hpp"
#include "../data_structures/json_container.hpp"
#include "../data_structures/phantom_node.hpp" #include "../data_structures/phantom_node.hpp"
#include "../Util/integer_range.hpp" #include "../Util/integer_range.hpp"
#include "../Util/json_renderer.hpp" #include "../Util/json_renderer.hpp"
#include <osrm/json_container.hpp>
#include <string> #include <string>
/* /*

View File

@ -28,9 +28,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef BASEPLUGIN_H_ #ifndef BASEPLUGIN_H_
#define BASEPLUGIN_H_ #define BASEPLUGIN_H_
#include <osrm/Coordinate.h> // remove
#include <osrm/Reply.h> #include "../Server/Http/Reply.h"
#include <osrm/RouteParameters.h>
#include <osrm/coordinate.hpp>
#include <osrm/route_parameters.hpp>
#include <string> #include <string>
#include <vector> #include <vector>

View File

@ -30,9 +30,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "plugin_base.hpp" #include "plugin_base.hpp"
#include "../data_structures/json_container.hpp"
#include "../Util/json_renderer.hpp" #include "../Util/json_renderer.hpp"
#include <osrm/json_container.hpp>
#include <string> #include <string>
template <class DataFacadeT> class TimestampPlugin final : public BasePlugin template <class DataFacadeT> class TimestampPlugin final : public BasePlugin

View File

@ -40,6 +40,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../Util/make_unique.hpp" #include "../Util/make_unique.hpp"
#include "../Util/simple_logger.hpp" #include "../Util/simple_logger.hpp"
#include <osrm/json_container.hpp>
#include <cstdlib> #include <cstdlib>
#include <algorithm> #include <algorithm>