use 4 bits for travel mode
This commit is contained in:
parent
6d6d299ea4
commit
dae9c9a7ed
@ -43,7 +43,7 @@ struct EdgeBasedNode
|
||||
unsigned packed_geometry_id,
|
||||
unsigned short fwd_segment_position,
|
||||
bool belongs_to_tiny_component,
|
||||
TravelMode travel_mode,
|
||||
TravelMode travel_mode ,
|
||||
TravelMode backward_travel_mode
|
||||
) :
|
||||
forward_edge_based_node_id(forward_edge_based_node_id),
|
||||
@ -91,8 +91,8 @@ struct EdgeBasedNode
|
||||
unsigned packed_geometry_id; // if set, then the edge represents a packed geometry
|
||||
unsigned short fwd_segment_position; // segment id in a compressed geometry
|
||||
bool is_in_tiny_cc;
|
||||
TravelMode travel_mode;
|
||||
TravelMode backward_travel_mode;
|
||||
TravelMode travel_mode : 4;
|
||||
TravelMode backward_travel_mode : 4;
|
||||
};
|
||||
|
||||
#endif //EDGE_BASED_NODE_H
|
||||
|
@ -58,7 +58,7 @@ struct NodeBasedEdge
|
||||
bool in_tiny_cc : 1;
|
||||
bool access_restricted : 1;
|
||||
bool is_split : 1;
|
||||
TravelMode travel_mode;
|
||||
TravelMode travel_mode : 4;
|
||||
|
||||
NodeBasedEdge() = delete;
|
||||
};
|
||||
|
@ -29,7 +29,7 @@ struct NodeBasedEdgeData
|
||||
bool backward : 1;
|
||||
bool roundabout : 1;
|
||||
bool ignore_in_grid : 1;
|
||||
TravelMode travel_mode;
|
||||
TravelMode travel_mode : 4;
|
||||
|
||||
void SwapDirectionFlags()
|
||||
{
|
||||
|
@ -79,8 +79,8 @@ struct PhantomNode
|
||||
unsigned packed_geometry_id;
|
||||
FixedPointCoordinate location;
|
||||
unsigned short fwd_segment_position;
|
||||
TravelMode travel_mode;
|
||||
TravelMode backward_travel_mode;
|
||||
TravelMode travel_mode : 4;
|
||||
TravelMode backward_travel_mode : 4;
|
||||
|
||||
int GetForwardWeightPlusOffset() const
|
||||
{
|
||||
|
@ -59,7 +59,7 @@ struct PathData
|
||||
unsigned name_id;
|
||||
EdgeWeight segment_duration;
|
||||
TurnInstruction turn_instruction;
|
||||
TravelMode travel_mode;
|
||||
TravelMode travel_mode : 4;
|
||||
};
|
||||
|
||||
struct RawRouteData
|
||||
|
@ -45,7 +45,7 @@ struct SegmentInformation
|
||||
TurnInstruction turn_instruction;
|
||||
bool necessary:1;
|
||||
bool is_via_location:1;
|
||||
TravelMode travel_mode;
|
||||
TravelMode travel_mode : 4;
|
||||
|
||||
explicit SegmentInformation(const FixedPointCoordinate &location,
|
||||
const NodeID name_id,
|
||||
|
@ -376,7 +376,11 @@ void ExtractionContainers::PrepareData(const std::string &output_file_name,
|
||||
file_out_stream.write((char *)&edge_iterator->is_roundabout, sizeof(bool));
|
||||
file_out_stream.write((char *)&edge_iterator->is_in_tiny_cc, sizeof(bool));
|
||||
file_out_stream.write((char *)&edge_iterator->is_access_restricted, sizeof(bool));
|
||||
file_out_stream.write((char *)&edge_iterator->travel_mode, sizeof(TravelMode));
|
||||
|
||||
// cannot take adress of bit field, so use local
|
||||
const TravelMode travel_mode = edge_iterator->travel_mode;
|
||||
file_out_stream.write((char *)&travel_mode, sizeof(TravelMode));
|
||||
|
||||
file_out_stream.write((char *)&edge_iterator->is_split, sizeof(bool));
|
||||
++number_of_used_edges;
|
||||
}
|
||||
|
@ -63,6 +63,7 @@ struct ExtractionWay
|
||||
bidirectional,
|
||||
opposite };
|
||||
|
||||
inline bool HasDuration() { return duration>0; }
|
||||
inline bool IsBidirectional() { return travel_mode!=0 && backward_travel_mode!=0; }
|
||||
inline bool IsOneway() { return travel_mode!=0 && backward_travel_mode==0; }
|
||||
inline bool IsOpposite() { return travel_mode==0 && backward_travel_mode!=0; }
|
||||
@ -78,6 +79,11 @@ struct ExtractionWay
|
||||
return ExtractionWay::bidirectional;
|
||||
}
|
||||
|
||||
inline void set_mode(const TravelMode m) { travel_mode = m; }
|
||||
inline const TravelMode get_mode() { return travel_mode; }
|
||||
inline void set_backward_mode(const TravelMode m) { backward_travel_mode = m; }
|
||||
inline const TravelMode get_backward_mode() { return backward_travel_mode; }
|
||||
|
||||
unsigned id;
|
||||
unsigned nameID;
|
||||
double speed;
|
||||
@ -92,8 +98,8 @@ struct ExtractionWay
|
||||
bool ignoreInGrid;
|
||||
std::vector<NodeID> path;
|
||||
HashTable<std::string, std::string> keyVals;
|
||||
TravelMode travel_mode;
|
||||
TravelMode backward_travel_mode;
|
||||
TravelMode travel_mode : 4;
|
||||
TravelMode backward_travel_mode : 4;
|
||||
};
|
||||
|
||||
#endif // EXTRACTION_WAY_H
|
||||
|
@ -83,7 +83,7 @@ struct InternalExtractorEdge
|
||||
bool is_in_tiny_cc;
|
||||
bool is_duration_set;
|
||||
bool is_access_restricted;
|
||||
TravelMode travel_mode;
|
||||
TravelMode travel_mode : 4;
|
||||
bool is_split;
|
||||
|
||||
FixedPointCoordinate source_coordinate;
|
||||
|
@ -86,8 +86,8 @@ void ScriptingEnvironment::initLuaState(lua_State* lua_state)
|
||||
.def_readwrite("ignore_in_grid", &ExtractionWay::ignoreInGrid)
|
||||
.def_readwrite("tags", &ExtractionWay::keyVals)
|
||||
.def_readwrite("direction", &ExtractionWay::direction)
|
||||
.def_readwrite("mode", &ExtractionWay::travel_mode)
|
||||
.def_readwrite("backward_mode", &ExtractionWay::backward_travel_mode)
|
||||
.property("mode", &ExtractionWay::get_mode, &ExtractionWay::set_mode)
|
||||
.property("backward_mode", &ExtractionWay::get_backward_mode, &ExtractionWay::set_backward_mode)
|
||||
.enum_("constants")[
|
||||
luabind::value("notSure", 0),
|
||||
luabind::value("oneway", 1),
|
||||
|
@ -155,7 +155,6 @@ template <class EdgeDataT> class InternalDataFacade : public BaseDataFacade<Edge
|
||||
for (unsigned i = 0; i < number_of_edges; ++i)
|
||||
{
|
||||
edges_input_stream.read((char *)&(current_edge_data), sizeof(OriginalEdgeData));
|
||||
std::cout << "read mode: " << (long)current_edge_data.travel_mode << std::endl;
|
||||
m_via_node_list[i] = current_edge_data.via_node;
|
||||
m_name_ID_list[i] = current_edge_data.name_id;
|
||||
m_turn_instruction_list[i] = current_edge_data.turn_instruction;
|
||||
|
@ -146,9 +146,6 @@ NodeID readBinaryOSRMGraphFromStream(std::istream &input_stream,
|
||||
input_stream.read((char *)&travel_mode, sizeof(TravelMode));
|
||||
input_stream.read((char *)&is_split, sizeof(bool));
|
||||
|
||||
|
||||
SimpleLogger().Write() << "mode read: " << (int)travel_mode;
|
||||
|
||||
BOOST_ASSERT_MSG(length > 0, "loaded null length edge");
|
||||
BOOST_ASSERT_MSG(weight > 0, "loaded null weight");
|
||||
BOOST_ASSERT_MSG(0 <= dir && dir <= 2, "loaded bogus direction");
|
||||
|
Loading…
Reference in New Issue
Block a user