adjust testscases for collapse of use lane

This commit is contained in:
Moritz Kobitzsch
2016-07-22 09:08:40 +02:00
parent 86fd04e556
commit a551286a8f
25 changed files with 225 additions and 255 deletions
+11 -12
View File
@@ -83,18 +83,17 @@ class EdgeBasedGraphFactory
EdgeBasedGraphFactory(const EdgeBasedGraphFactory &) = delete;
EdgeBasedGraphFactory &operator=(const EdgeBasedGraphFactory &) = delete;
explicit EdgeBasedGraphFactory(
std::shared_ptr<util::NodeBasedDynamicGraph> node_based_graph,
const CompressedEdgeContainer &compressed_edge_container,
const std::unordered_set<NodeID> &barrier_nodes,
const std::unordered_set<NodeID> &traffic_lights,
std::shared_ptr<const RestrictionMap> restriction_map,
const std::vector<QueryNode> &node_info_list,
ProfileProperties profile_properties,
const util::NameTable &name_table,
std::vector<std::uint32_t> &turn_lane_offsets,
std::vector<guidance::TurnLaneType::Mask> &turn_lane_masks,
guidance::LaneDescriptionMap &lane_description_map);
explicit EdgeBasedGraphFactory(std::shared_ptr<util::NodeBasedDynamicGraph> node_based_graph,
const CompressedEdgeContainer &compressed_edge_container,
const std::unordered_set<NodeID> &barrier_nodes,
const std::unordered_set<NodeID> &traffic_lights,
std::shared_ptr<const RestrictionMap> restriction_map,
const std::vector<QueryNode> &node_info_list,
ProfileProperties profile_properties,
const util::NameTable &name_table,
std::vector<std::uint32_t> &turn_lane_offsets,
std::vector<guidance::TurnLaneType::Mask> &turn_lane_masks,
guidance::LaneDescriptionMap &lane_description_map);
void Run(ScriptingEnvironment &scripting_environment,
const std::string &original_edge_data_filename,
+5 -3
View File
@@ -40,12 +40,11 @@ class ExtractorCallbacks
using MapKey = std::pair<std::string, std::string>;
using MapVal = unsigned;
std::unordered_map<MapKey, MapVal, boost::hash<MapKey>> string_map;
guidance::LaneDescriptionMap &lane_description_map;
guidance::LaneDescriptionMap lane_description_map;
ExtractionContainers &external_memory;
public:
explicit ExtractorCallbacks(ExtractionContainers &extraction_containers,
guidance::LaneDescriptionMap &lane_description_map);
explicit ExtractorCallbacks(ExtractionContainers &extraction_containers);
ExtractorCallbacks(const ExtractorCallbacks &) = delete;
ExtractorCallbacks &operator=(const ExtractorCallbacks &) = delete;
@@ -58,6 +57,9 @@ class ExtractorCallbacks
// warning: caller needs to take care of synchronization!
void ProcessWay(const osmium::Way &current_way, const ExtractionWay &result_way);
// destroys the internal laneDescriptionMap
guidance::LaneDescriptionMap &&moveOutLaneDescriptionMap();
};
}
}
@@ -40,10 +40,6 @@ LaneDataVector::iterator findTag(const TurnLaneType::Mask tag, LaneDataVector &d
// Returns true if any of the queried tags is contained
bool hasTag(const TurnLaneType::Mask tag, const LaneDataVector &data);
// Check if a set of lanes is a subset of a different set of lanes
bool isSubsetOf(const LaneDataVector &subset_candidate, const LaneDataVector &superset_candidate);
} // namespace lane_data_generation
} // namespace guidance
@@ -14,6 +14,8 @@
#include "util/node_based_graph.hpp"
#include "util/typedefs.hpp"
#include <atomic>
#include <cstddef>
#include <cstdint>
#include <map>
#include <string>
@@ -31,36 +33,39 @@ namespace guidance
// assigns appropriate turn tupels to the different turns.
namespace lanes
{
namespace
{
typedef enum TurnLaneScenario {
SIMPLE, // a straightforward assignment
PARTITION_LOCAL, // an assignment that requires partitioning, using local turns
SIMPLE_PREVIOUS, // an assignemtnn using the turns specified at the previous road (e.g.
// traffic light, lanes not drawn up to the intersection)
PARTITION_PREVIOUS, // a set of lanes on a turn with a traffic island. The lanes for the
// turn end at the previous turn (parts of it remain valid without being
// shown again)
SLIPROAD, // Sliproads are simple assignments that, for better visual representation should
// include turns from other roads in their listings
MERGE, // Merging Lanes
NONE, // not a turn lane scenario at all
INVALID, // some error might have occurred
UNKNOWN, // UNKNOWN describes all cases that we are currently not able to handle
NUM_SCENARIOS
} TurnLaneScenario;
const constexpr char *scenario_names[] = {"Simple",
"Partition Local",
"Simple Previous",
"Partition Previous",
"Sliproad",
"Merge",
"None",
"Invalid",
"Unknown"};
} // namespace
class TurnLaneHandler
{
typedef enum TurnLaneScenario {
SIMPLE, // a straightforward assignment
PARTITION_LOCAL, // an assignment that requires partitioning, using local turns
SIMPLE_PREVIOUS, // an assignemtnn using the turns specified at the previous road (e.g.
// traffic light, lanes not drawn up to the intersection)
PARTITION_PREVIOUS, // a set of lanes on a turn with a traffic island. The lanes for the
// turn end at the previous turn (parts of it remain valid without being
// shown again)
SLIPROAD, // Sliproads are simple assignments that, for better visual representation should
// include turns from other roads in their listings
MERGE, // Merging Lanes
NONE, // not a turn lane scenario at all
INVALID, // some error might have occurred
UNKNOWN, // UNKNOWN describes all cases that we are currently not able to handle
NUM_SCENARIOS
} TurnLaneScenario;
const constexpr static char *scenario_names[TurnLaneScenario::NUM_SCENARIOS] = {
"Simple",
"Partition Local",
"Simple Previous",
"Partition Previous",
"Sliproad",
"Merge",
"None",
"Invalid",
"Unknown"};
public:
typedef std::vector<TurnLaneData> LaneDataVector;
@@ -78,8 +83,8 @@ class TurnLaneHandler
Intersection assignTurnLanes(const NodeID at, const EdgeID via_edge, Intersection intersection);
private:
unsigned *count_handled;
unsigned *count_called;
mutable std::atomic<std::size_t> count_handled;
mutable std::atomic<std::size_t> count_called;
// we need to be able to look at previous intersections to, in some cases, find the correct turn
// lanes for a turn
const util::NodeBasedDynamicGraph &node_based_graph;
@@ -133,6 +138,9 @@ class TurnLaneHandler
LaneDataVector &lane_data) const;
};
static_assert(sizeof(scenario_names) / sizeof(*scenario_names) == TurnLaneScenario::NUM_SCENARIOS,
"Number of scenarios needs to match the number of scenario names.");
} // namespace lanes
} // namespace guidance
} // namespace extractor
@@ -32,10 +32,10 @@ typename Intersection::const_iterator findBestMatch(const TurnLaneType::Mask tag
const Intersection &intersection);
// the quality of a matching to decide between first/second possibility on segregated intersections
double getMatchingQuality( const TurnLaneType::Mask tag, const ConnectedRoad &road );
double getMatchingQuality(const TurnLaneType::Mask tag, const ConnectedRoad &road);
typename Intersection::const_iterator
findBestMatchForReverse(const TurnLaneType::Mask leftmost_tag, const Intersection &intersection);
typename Intersection::const_iterator findBestMatchForReverse(const TurnLaneType::Mask leftmost_tag,
const Intersection &intersection);
// a match is trivial if all turns can be associated with their best match in a valid way and the
// matches occur in order
@@ -9,7 +9,7 @@
#include <vector>
#include <boost/assert.hpp>
#include <boost/functional/hash_fwd.hpp>
#include <boost/functional/hash.hpp>
#include "util/json_container.hpp"
#include "util/simple_logger.hpp"
@@ -90,8 +90,7 @@ struct TurnLaneDescription_hash
std::size_t operator()(const TurnLaneDescription &lane_description) const
{
std::size_t seed = 0;
for (auto val : lane_description)
boost::hash_combine(seed, val);
boost::hash_range(seed, lane_description.begin(), lane_description.end());
return seed;
}
};