use enum for TravelMode
This commit is contained in:
parent
35988d8f09
commit
207cddd50b
@ -1,6 +1,7 @@
|
|||||||
#ifndef EDGE_BASED_NODE_H
|
#ifndef EDGE_BASED_NODE_H
|
||||||
#define EDGE_BASED_NODE_H
|
#define EDGE_BASED_NODE_H
|
||||||
|
|
||||||
|
#include "../DataStructures/TravelMode.h"
|
||||||
#include "../Util/SimpleLogger.h"
|
#include "../Util/SimpleLogger.h"
|
||||||
#include "../typedefs.h"
|
#include "../typedefs.h"
|
||||||
|
|
||||||
@ -26,8 +27,8 @@ struct EdgeBasedNode
|
|||||||
packed_geometry_id(SPECIAL_EDGEID),
|
packed_geometry_id(SPECIAL_EDGEID),
|
||||||
fwd_segment_position( std::numeric_limits<unsigned short>::max() ),
|
fwd_segment_position( std::numeric_limits<unsigned short>::max() ),
|
||||||
is_in_tiny_cc(false),
|
is_in_tiny_cc(false),
|
||||||
travel_mode(0),
|
travel_mode(TravelMode::None),
|
||||||
backward_travel_mode(0)
|
backward_travel_mode(TravelMode::None)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
explicit EdgeBasedNode(
|
explicit EdgeBasedNode(
|
||||||
|
@ -28,6 +28,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#ifndef IMPORT_EDGE_H
|
#ifndef IMPORT_EDGE_H
|
||||||
#define IMPORT_EDGE_H
|
#define IMPORT_EDGE_H
|
||||||
|
|
||||||
|
#include "../DataStructures/TravelMode.h"
|
||||||
#include "../typedefs.h"
|
#include "../typedefs.h"
|
||||||
|
|
||||||
struct NodeBasedEdge
|
struct NodeBasedEdge
|
||||||
|
@ -15,7 +15,7 @@ struct NodeBasedEdgeData
|
|||||||
: distance(INVALID_EDGE_WEIGHT), edgeBasedNodeID(SPECIAL_NODEID),
|
: distance(INVALID_EDGE_WEIGHT), edgeBasedNodeID(SPECIAL_NODEID),
|
||||||
nameID(std::numeric_limits<unsigned>::max()), type(std::numeric_limits<short>::max()),
|
nameID(std::numeric_limits<unsigned>::max()), type(std::numeric_limits<short>::max()),
|
||||||
isAccessRestricted(false), shortcut(false), forward(false), backward(false),
|
isAccessRestricted(false), shortcut(false), forward(false), backward(false),
|
||||||
roundabout(false), ignore_in_grid(false), travel_mode(false)
|
roundabout(false), ignore_in_grid(false), travel_mode(TravelMode::None)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#define ORIGINAL_EDGE_DATA_H
|
#define ORIGINAL_EDGE_DATA_H
|
||||||
|
|
||||||
#include "TurnInstructions.h"
|
#include "TurnInstructions.h"
|
||||||
|
#include "../DataStructures/TravelMode.h"
|
||||||
#include "../typedefs.h"
|
#include "../typedefs.h"
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
@ -49,7 +50,7 @@ struct OriginalEdgeData
|
|||||||
: via_node(std::numeric_limits<unsigned>::max()),
|
: via_node(std::numeric_limits<unsigned>::max()),
|
||||||
name_id(std::numeric_limits<unsigned>::max()),
|
name_id(std::numeric_limits<unsigned>::max()),
|
||||||
turn_instruction(TurnInstruction::NoTurn), compressed_geometry(false),
|
turn_instruction(TurnInstruction::NoTurn), compressed_geometry(false),
|
||||||
travel_mode(0)
|
travel_mode(TravelMode::None)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#define PHANTOM_NODES_H
|
#define PHANTOM_NODES_H
|
||||||
|
|
||||||
#include <osrm/Coordinate.h>
|
#include <osrm/Coordinate.h>
|
||||||
|
#include "../DataStructures/TravelMode.h"
|
||||||
#include "../Util/SimpleLogger.h"
|
#include "../Util/SimpleLogger.h"
|
||||||
#include "../typedefs.h"
|
#include "../typedefs.h"
|
||||||
|
|
||||||
@ -65,8 +66,8 @@ struct PhantomNode
|
|||||||
reverse_offset(0),
|
reverse_offset(0),
|
||||||
packed_geometry_id(SPECIAL_EDGEID),
|
packed_geometry_id(SPECIAL_EDGEID),
|
||||||
fwd_segment_position(0),
|
fwd_segment_position(0),
|
||||||
travel_mode(0),
|
travel_mode(TravelMode::None),
|
||||||
backward_travel_mode(0)
|
backward_travel_mode(TravelMode::None)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
NodeID forward_node_id;
|
NodeID forward_node_id;
|
||||||
|
@ -29,6 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#define RAW_ROUTE_DATA_H
|
#define RAW_ROUTE_DATA_H
|
||||||
|
|
||||||
#include "../DataStructures/PhantomNodes.h"
|
#include "../DataStructures/PhantomNodes.h"
|
||||||
|
#include "../DataStructures/TravelMode.h"
|
||||||
#include "../DataStructures/TurnInstructions.h"
|
#include "../DataStructures/TurnInstructions.h"
|
||||||
#include "../typedefs.h"
|
#include "../typedefs.h"
|
||||||
|
|
||||||
@ -42,7 +43,7 @@ struct PathData
|
|||||||
: node(SPECIAL_NODEID), name_id(INVALID_EDGE_WEIGHT),
|
: node(SPECIAL_NODEID), name_id(INVALID_EDGE_WEIGHT),
|
||||||
segment_duration(INVALID_EDGE_WEIGHT),
|
segment_duration(INVALID_EDGE_WEIGHT),
|
||||||
turn_instruction(TurnInstruction::NoTurn),
|
turn_instruction(TurnInstruction::NoTurn),
|
||||||
travel_mode(0)
|
travel_mode(TravelMode::None)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
#include "TurnInstructions.h"
|
#include "TurnInstructions.h"
|
||||||
|
|
||||||
|
#include "../DataStructures/TravelMode.h"
|
||||||
#include "../typedefs.h"
|
#include "../typedefs.h"
|
||||||
|
|
||||||
#include <osrm/Coordinate.h>
|
#include <osrm/Coordinate.h>
|
||||||
|
35
DataStructures/TravelMode.h
Normal file
35
DataStructures/TravelMode.h
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
Redistributions of source code must retain the above copyright notice, this list
|
||||||
|
of conditions and the following disclaimer.
|
||||||
|
Redistributions in binary form must reproduce the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer in the documentation and/or
|
||||||
|
other materials provided with the distribution.
|
||||||
|
|
||||||
|
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
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
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
|
||||||
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef TRAVEL_MODE_H
|
||||||
|
#define TRAVEL_MODE_H
|
||||||
|
|
||||||
|
enum TravelMode : unsigned char {
|
||||||
|
None=0, Default=1
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* TRAVEL_MODE_H */
|
@ -29,6 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#define EXTRACTION_WAY_H
|
#define EXTRACTION_WAY_H
|
||||||
|
|
||||||
#include "../DataStructures/HashTable.h"
|
#include "../DataStructures/HashTable.h"
|
||||||
|
#include "../DataStructures/TravelMode.h"
|
||||||
#include "../typedefs.h"
|
#include "../typedefs.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -53,8 +54,8 @@ struct ExtractionWay
|
|||||||
roundabout = false;
|
roundabout = false;
|
||||||
isAccessRestricted = false;
|
isAccessRestricted = false;
|
||||||
ignoreInGrid = false;
|
ignoreInGrid = false;
|
||||||
travel_mode = 1;
|
travel_mode = TravelMode::Default;
|
||||||
backward_travel_mode = 1;
|
backward_travel_mode = TravelMode::Default;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Directions
|
enum Directions
|
||||||
|
@ -121,12 +121,12 @@ void ExtractorCallbacks::ProcessWay(ExtractionWay &parsed_way)
|
|||||||
std::reverse(parsed_way.path.begin(), parsed_way.path.end());
|
std::reverse(parsed_way.path.begin(), parsed_way.path.end());
|
||||||
parsed_way.direction = ExtractionWay::oneway;
|
parsed_way.direction = ExtractionWay::oneway;
|
||||||
parsed_way.travel_mode = parsed_way.backward_travel_mode;
|
parsed_way.travel_mode = parsed_way.backward_travel_mode;
|
||||||
parsed_way.backward_travel_mode = 0;
|
parsed_way.backward_travel_mode = TravelMode::None;
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool split_edge =
|
const bool split_edge =
|
||||||
(parsed_way.speed>0) && (parsed_way.travel_mode>0) &&
|
(parsed_way.speed>0) && (parsed_way.travel_mode>0) &&
|
||||||
(parsed_way.backward_speed>0) && (parsed_way.backward_travel_mode>0) &&
|
(TravelMode::None != parsed_way.backward_speed) && (TravelMode::None != parsed_way.backward_travel_mode) &&
|
||||||
((parsed_way.speed != parsed_way.backward_speed) ||
|
((parsed_way.speed != parsed_way.backward_speed) ||
|
||||||
(parsed_way.travel_mode != parsed_way.backward_travel_mode));
|
(parsed_way.travel_mode != parsed_way.backward_travel_mode));
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#define INTERNAL_EXTRACTOR_EDGE_H
|
#define INTERNAL_EXTRACTOR_EDGE_H
|
||||||
|
|
||||||
#include "../typedefs.h"
|
#include "../typedefs.h"
|
||||||
|
#include "../DataStructures/TravelMode.h"
|
||||||
#include <osrm/Coordinate.h>
|
#include <osrm/Coordinate.h>
|
||||||
|
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
@ -38,7 +39,7 @@ struct InternalExtractorEdge
|
|||||||
InternalExtractorEdge()
|
InternalExtractorEdge()
|
||||||
: start(0), target(0), type(0), direction(0), speed(0), name_id(0), is_roundabout(false),
|
: start(0), target(0), type(0), direction(0), speed(0), name_id(0), is_roundabout(false),
|
||||||
is_in_tiny_cc(false), is_duration_set(false), is_access_restricted(false),
|
is_in_tiny_cc(false), is_duration_set(false), is_access_restricted(false),
|
||||||
travel_mode(0), is_split(false)
|
travel_mode(TravelMode::None), is_split(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,12 +66,12 @@ struct InternalExtractorEdge
|
|||||||
// necessary static util functions for stxxl's sorting
|
// necessary static util functions for stxxl's sorting
|
||||||
static InternalExtractorEdge min_value()
|
static InternalExtractorEdge min_value()
|
||||||
{
|
{
|
||||||
return InternalExtractorEdge(0, 0, 0, 0, 0, 0, false, false, false, false, 0, false);
|
return InternalExtractorEdge(0, 0, 0, 0, 0, 0, false, false, false, false, TravelMode::None, false);
|
||||||
}
|
}
|
||||||
static InternalExtractorEdge max_value()
|
static InternalExtractorEdge max_value()
|
||||||
{
|
{
|
||||||
return InternalExtractorEdge(
|
return InternalExtractorEdge(
|
||||||
SPECIAL_NODEID, SPECIAL_NODEID, 0, 0, 0, 0, false, false, false, false, 0, false);
|
SPECIAL_NODEID, SPECIAL_NODEID, 0, 0, 0, 0, false, false, false, false, TravelMode::None, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeID start;
|
NodeID start;
|
||||||
|
Loading…
Reference in New Issue
Block a user