Split import_edge.hpp: node_based_edge.hpp, edge_based_edge.hpp closes #1604
This commit is contained in:
parent
fc292cc2d8
commit
4813488f84
@ -4,6 +4,7 @@
|
|||||||
#include "contractor/contractor.hpp"
|
#include "contractor/contractor.hpp"
|
||||||
#include "contractor/contractor_options.hpp"
|
#include "contractor/contractor_options.hpp"
|
||||||
#include "contractor/query_edge.hpp"
|
#include "contractor/query_edge.hpp"
|
||||||
|
#include "extractor/edge_based_edge.hpp"
|
||||||
#include "util/static_graph.hpp"
|
#include "util/static_graph.hpp"
|
||||||
#include "util/deallocating_vector.hpp"
|
#include "util/deallocating_vector.hpp"
|
||||||
#include "util/node_based_graph.hpp"
|
#include "util/node_based_graph.hpp"
|
||||||
|
80
include/extractor/edge_based_edge.hpp
Normal file
80
include/extractor/edge_based_edge.hpp
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
#ifndef EDGE_BASED_EDGE_HPP
|
||||||
|
#define EDGE_BASED_EDGE_HPP
|
||||||
|
|
||||||
|
#include "extractor/travel_mode.hpp"
|
||||||
|
#include "util/typedefs.hpp"
|
||||||
|
|
||||||
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace extractor
|
||||||
|
{
|
||||||
|
|
||||||
|
struct EdgeBasedEdge
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
EdgeBasedEdge();
|
||||||
|
|
||||||
|
template <class EdgeT> explicit EdgeBasedEdge(const EdgeT &other);
|
||||||
|
|
||||||
|
EdgeBasedEdge(const NodeID source,
|
||||||
|
const NodeID target,
|
||||||
|
const NodeID edge_id,
|
||||||
|
const EdgeWeight weight,
|
||||||
|
const bool forward,
|
||||||
|
const bool backward);
|
||||||
|
|
||||||
|
bool operator<(const EdgeBasedEdge &other) const;
|
||||||
|
|
||||||
|
NodeID source;
|
||||||
|
NodeID target;
|
||||||
|
NodeID edge_id;
|
||||||
|
EdgeWeight weight : 30;
|
||||||
|
bool forward : 1;
|
||||||
|
bool backward : 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Impl.
|
||||||
|
|
||||||
|
inline EdgeBasedEdge::EdgeBasedEdge()
|
||||||
|
: source(0), target(0), edge_id(0), weight(0), forward(false), backward(false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class EdgeT>
|
||||||
|
inline EdgeBasedEdge::EdgeBasedEdge(const EdgeT &other)
|
||||||
|
: source(other.source), target(other.target), edge_id(other.data.via),
|
||||||
|
weight(other.data.distance), forward(other.data.forward), backward(other.data.backward)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
inline EdgeBasedEdge::EdgeBasedEdge(const NodeID source,
|
||||||
|
const NodeID target,
|
||||||
|
const NodeID edge_id,
|
||||||
|
const EdgeWeight weight,
|
||||||
|
const bool forward,
|
||||||
|
const bool backward)
|
||||||
|
: source(source), target(target), edge_id(edge_id), weight(weight), forward(forward),
|
||||||
|
backward(backward)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool EdgeBasedEdge::operator<(const EdgeBasedEdge &other) const
|
||||||
|
{
|
||||||
|
if (source == other.source)
|
||||||
|
{
|
||||||
|
if (target == other.target)
|
||||||
|
{
|
||||||
|
if (weight == other.weight)
|
||||||
|
{
|
||||||
|
return forward && backward && ((!other.forward) || (!other.backward));
|
||||||
|
}
|
||||||
|
return weight < other.weight;
|
||||||
|
}
|
||||||
|
return target < other.target;
|
||||||
|
}
|
||||||
|
return source < other.source;
|
||||||
|
}
|
||||||
|
} // ns extractor
|
||||||
|
} // ns osrm
|
||||||
|
|
||||||
|
#endif /* EDGE_BASED_EDGE_HPP */
|
@ -3,6 +3,7 @@
|
|||||||
#ifndef EDGE_BASED_GRAPH_FACTORY_HPP_
|
#ifndef EDGE_BASED_GRAPH_FACTORY_HPP_
|
||||||
#define EDGE_BASED_GRAPH_FACTORY_HPP_
|
#define EDGE_BASED_GRAPH_FACTORY_HPP_
|
||||||
|
|
||||||
|
#include "extractor/edge_based_edge.hpp"
|
||||||
#include "extractor/speed_profile.hpp"
|
#include "extractor/speed_profile.hpp"
|
||||||
#include "util/typedefs.hpp"
|
#include "util/typedefs.hpp"
|
||||||
#include "extractor/compressed_edge_container.hpp"
|
#include "extractor/compressed_edge_container.hpp"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#ifndef EXTRACTOR_HPP
|
#ifndef EXTRACTOR_HPP
|
||||||
#define EXTRACTOR_HPP
|
#define EXTRACTOR_HPP
|
||||||
|
|
||||||
|
#include "extractor/edge_based_edge.hpp"
|
||||||
#include "extractor/extractor_options.hpp"
|
#include "extractor/extractor_options.hpp"
|
||||||
#include "extractor/edge_based_graph_factory.hpp"
|
#include "extractor/edge_based_graph_factory.hpp"
|
||||||
#include "extractor/graph_compressor.hpp"
|
#include "extractor/graph_compressor.hpp"
|
||||||
|
@ -1,152 +0,0 @@
|
|||||||
#ifndef IMPORT_EDGE_HPP
|
|
||||||
#define IMPORT_EDGE_HPP
|
|
||||||
|
|
||||||
#include "extractor/travel_mode.hpp"
|
|
||||||
#include "util/typedefs.hpp"
|
|
||||||
|
|
||||||
namespace osrm
|
|
||||||
{
|
|
||||||
namespace extractor
|
|
||||||
{
|
|
||||||
|
|
||||||
struct NodeBasedEdge
|
|
||||||
{
|
|
||||||
bool operator<(const NodeBasedEdge &other) const
|
|
||||||
{
|
|
||||||
if (source == other.source)
|
|
||||||
{
|
|
||||||
if (target == other.target)
|
|
||||||
{
|
|
||||||
if (weight == other.weight)
|
|
||||||
{
|
|
||||||
return forward && backward && ((!other.forward) || (!other.backward));
|
|
||||||
}
|
|
||||||
return weight < other.weight;
|
|
||||||
}
|
|
||||||
return target < other.target;
|
|
||||||
}
|
|
||||||
return source < other.source;
|
|
||||||
}
|
|
||||||
|
|
||||||
NodeBasedEdge()
|
|
||||||
: source(SPECIAL_NODEID), target(SPECIAL_NODEID), name_id(0), weight(0), forward(false),
|
|
||||||
backward(false), roundabout(false), access_restricted(false), startpoint(true),
|
|
||||||
is_split(false), travel_mode(false)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
NodeBasedEdge(NodeID source,
|
|
||||||
NodeID target,
|
|
||||||
NodeID name_id,
|
|
||||||
EdgeWeight weight,
|
|
||||||
bool forward,
|
|
||||||
bool backward,
|
|
||||||
bool roundabout,
|
|
||||||
bool access_restricted,
|
|
||||||
bool startpoint,
|
|
||||||
TravelMode travel_mode,
|
|
||||||
bool is_split)
|
|
||||||
: source(source), target(target), name_id(name_id), weight(weight), forward(forward),
|
|
||||||
backward(backward), roundabout(roundabout), access_restricted(access_restricted),
|
|
||||||
startpoint(startpoint), is_split(is_split), travel_mode(travel_mode)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
NodeID source;
|
|
||||||
NodeID target;
|
|
||||||
NodeID name_id;
|
|
||||||
EdgeWeight weight;
|
|
||||||
bool forward : 1;
|
|
||||||
bool backward : 1;
|
|
||||||
bool roundabout : 1;
|
|
||||||
bool access_restricted : 1;
|
|
||||||
bool startpoint : 1;
|
|
||||||
bool is_split : 1;
|
|
||||||
TravelMode travel_mode : 4;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct NodeBasedEdgeWithOSM : NodeBasedEdge
|
|
||||||
{
|
|
||||||
explicit NodeBasedEdgeWithOSM(OSMNodeID source,
|
|
||||||
OSMNodeID target,
|
|
||||||
NodeID name_id,
|
|
||||||
EdgeWeight weight,
|
|
||||||
bool forward,
|
|
||||||
bool backward,
|
|
||||||
bool roundabout,
|
|
||||||
bool access_restricted,
|
|
||||||
bool startpoint,
|
|
||||||
TravelMode travel_mode,
|
|
||||||
bool is_split)
|
|
||||||
: NodeBasedEdge(SPECIAL_NODEID,
|
|
||||||
SPECIAL_NODEID,
|
|
||||||
name_id,
|
|
||||||
weight,
|
|
||||||
forward,
|
|
||||||
backward,
|
|
||||||
roundabout,
|
|
||||||
access_restricted,
|
|
||||||
startpoint,
|
|
||||||
travel_mode,
|
|
||||||
is_split),
|
|
||||||
osm_source_id(source), osm_target_id(target)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
OSMNodeID osm_source_id;
|
|
||||||
OSMNodeID osm_target_id;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct EdgeBasedEdge
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
bool operator<(const EdgeBasedEdge &other) const
|
|
||||||
{
|
|
||||||
if (source == other.source)
|
|
||||||
{
|
|
||||||
if (target == other.target)
|
|
||||||
{
|
|
||||||
if (weight == other.weight)
|
|
||||||
{
|
|
||||||
return forward && backward && ((!other.forward) || (!other.backward));
|
|
||||||
}
|
|
||||||
return weight < other.weight;
|
|
||||||
}
|
|
||||||
return target < other.target;
|
|
||||||
}
|
|
||||||
return source < other.source;
|
|
||||||
}
|
|
||||||
template <class EdgeT>
|
|
||||||
explicit EdgeBasedEdge(const EdgeT &other)
|
|
||||||
: source(other.source), target(other.target), edge_id(other.data.via),
|
|
||||||
weight(other.data.distance), forward(other.data.forward), backward(other.data.backward)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
EdgeBasedEdge() : source(0), target(0), edge_id(0), weight(0), forward(false), backward(false)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
EdgeBasedEdge(const NodeID source,
|
|
||||||
const NodeID target,
|
|
||||||
const NodeID edge_id,
|
|
||||||
const EdgeWeight weight,
|
|
||||||
const bool forward,
|
|
||||||
const bool backward)
|
|
||||||
: source(source), target(target), edge_id(edge_id), weight(weight), forward(forward),
|
|
||||||
backward(backward)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
NodeID source;
|
|
||||||
NodeID target;
|
|
||||||
NodeID edge_id;
|
|
||||||
EdgeWeight weight : 30;
|
|
||||||
bool forward : 1;
|
|
||||||
bool backward : 1;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* IMPORT_EDGE_HPP */
|
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "util/typedefs.hpp"
|
#include "util/typedefs.hpp"
|
||||||
#include "extractor/travel_mode.hpp"
|
#include "extractor/travel_mode.hpp"
|
||||||
#include "extractor/import_edge.hpp"
|
#include "extractor/node_based_edge.hpp"
|
||||||
|
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
|
|
||||||
|
133
include/extractor/node_based_edge.hpp
Normal file
133
include/extractor/node_based_edge.hpp
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
#ifndef NODE_BASED_EDGE_HPP
|
||||||
|
#define NODE_BASED_EDGE_HPP
|
||||||
|
|
||||||
|
#include "extractor/travel_mode.hpp"
|
||||||
|
#include "util/typedefs.hpp"
|
||||||
|
|
||||||
|
namespace osrm
|
||||||
|
{
|
||||||
|
namespace extractor
|
||||||
|
{
|
||||||
|
|
||||||
|
struct NodeBasedEdge
|
||||||
|
{
|
||||||
|
NodeBasedEdge();
|
||||||
|
|
||||||
|
NodeBasedEdge(NodeID source,
|
||||||
|
NodeID target,
|
||||||
|
NodeID name_id,
|
||||||
|
EdgeWeight weight,
|
||||||
|
bool forward,
|
||||||
|
bool backward,
|
||||||
|
bool roundabout,
|
||||||
|
bool access_restricted,
|
||||||
|
bool startpoint,
|
||||||
|
TravelMode travel_mode,
|
||||||
|
bool is_split);
|
||||||
|
|
||||||
|
bool operator<(const NodeBasedEdge &other) const;
|
||||||
|
|
||||||
|
NodeID source;
|
||||||
|
NodeID target;
|
||||||
|
NodeID name_id;
|
||||||
|
EdgeWeight weight;
|
||||||
|
bool forward : 1;
|
||||||
|
bool backward : 1;
|
||||||
|
bool roundabout : 1;
|
||||||
|
bool access_restricted : 1;
|
||||||
|
bool startpoint : 1;
|
||||||
|
bool is_split : 1;
|
||||||
|
TravelMode travel_mode : 4;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct NodeBasedEdgeWithOSM : NodeBasedEdge
|
||||||
|
{
|
||||||
|
NodeBasedEdgeWithOSM(OSMNodeID source,
|
||||||
|
OSMNodeID target,
|
||||||
|
NodeID name_id,
|
||||||
|
EdgeWeight weight,
|
||||||
|
bool forward,
|
||||||
|
bool backward,
|
||||||
|
bool roundabout,
|
||||||
|
bool access_restricted,
|
||||||
|
bool startpoint,
|
||||||
|
TravelMode travel_mode,
|
||||||
|
bool is_split);
|
||||||
|
|
||||||
|
OSMNodeID osm_source_id;
|
||||||
|
OSMNodeID osm_target_id;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Impl.
|
||||||
|
|
||||||
|
inline NodeBasedEdge::NodeBasedEdge()
|
||||||
|
: source(SPECIAL_NODEID), target(SPECIAL_NODEID), name_id(0), weight(0), forward(false),
|
||||||
|
backward(false), roundabout(false), access_restricted(false), startpoint(true),
|
||||||
|
is_split(false), travel_mode(false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
inline NodeBasedEdge::NodeBasedEdge(NodeID source,
|
||||||
|
NodeID target,
|
||||||
|
NodeID name_id,
|
||||||
|
EdgeWeight weight,
|
||||||
|
bool forward,
|
||||||
|
bool backward,
|
||||||
|
bool roundabout,
|
||||||
|
bool access_restricted,
|
||||||
|
bool startpoint,
|
||||||
|
TravelMode travel_mode,
|
||||||
|
bool is_split)
|
||||||
|
: source(source), target(target), name_id(name_id), weight(weight), forward(forward),
|
||||||
|
backward(backward), roundabout(roundabout), access_restricted(access_restricted),
|
||||||
|
startpoint(startpoint), is_split(is_split), travel_mode(travel_mode)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool NodeBasedEdge::operator<(const NodeBasedEdge &other) const
|
||||||
|
{
|
||||||
|
if (source == other.source)
|
||||||
|
{
|
||||||
|
if (target == other.target)
|
||||||
|
{
|
||||||
|
if (weight == other.weight)
|
||||||
|
{
|
||||||
|
return forward && backward && ((!other.forward) || (!other.backward));
|
||||||
|
}
|
||||||
|
return weight < other.weight;
|
||||||
|
}
|
||||||
|
return target < other.target;
|
||||||
|
}
|
||||||
|
return source < other.source;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline NodeBasedEdgeWithOSM::NodeBasedEdgeWithOSM(OSMNodeID source,
|
||||||
|
OSMNodeID target,
|
||||||
|
NodeID name_id,
|
||||||
|
EdgeWeight weight,
|
||||||
|
bool forward,
|
||||||
|
bool backward,
|
||||||
|
bool roundabout,
|
||||||
|
bool access_restricted,
|
||||||
|
bool startpoint,
|
||||||
|
TravelMode travel_mode,
|
||||||
|
bool is_split)
|
||||||
|
: NodeBasedEdge(SPECIAL_NODEID,
|
||||||
|
SPECIAL_NODEID,
|
||||||
|
name_id,
|
||||||
|
weight,
|
||||||
|
forward,
|
||||||
|
backward,
|
||||||
|
roundabout,
|
||||||
|
access_restricted,
|
||||||
|
startpoint,
|
||||||
|
travel_mode,
|
||||||
|
is_split),
|
||||||
|
osm_source_id(source), osm_target_id(target)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
} // ns extractor
|
||||||
|
} // ns osrm
|
||||||
|
|
||||||
|
#endif /* NODE_BASED_EDGE_HPP */
|
@ -1,6 +1,7 @@
|
|||||||
#ifndef RESTRICTION_MAP_HPP
|
#ifndef RESTRICTION_MAP_HPP
|
||||||
#define RESTRICTION_MAP_HPP
|
#define RESTRICTION_MAP_HPP
|
||||||
|
|
||||||
|
#include "extractor/edge_based_edge.hpp"
|
||||||
#include "extractor/restriction.hpp"
|
#include "extractor/restriction.hpp"
|
||||||
#include "util/std_hash.hpp"
|
#include "util/std_hash.hpp"
|
||||||
#include "util/typedefs.hpp"
|
#include "util/typedefs.hpp"
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "util/typedefs.hpp"
|
#include "util/typedefs.hpp"
|
||||||
#include "util/deallocating_vector.hpp"
|
#include "util/deallocating_vector.hpp"
|
||||||
#include "extractor/import_edge.hpp"
|
#include "extractor/node_based_edge.hpp"
|
||||||
#include "extractor/query_node.hpp"
|
#include "extractor/query_node.hpp"
|
||||||
#include "util/percent.hpp"
|
#include "util/percent.hpp"
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include "util/osrm_exception.hpp"
|
#include "util/osrm_exception.hpp"
|
||||||
#include "util/simple_logger.hpp"
|
#include "util/simple_logger.hpp"
|
||||||
#include "extractor/external_memory_node.hpp"
|
#include "extractor/external_memory_node.hpp"
|
||||||
#include "extractor/import_edge.hpp"
|
#include "extractor/node_based_edge.hpp"
|
||||||
#include "extractor/query_node.hpp"
|
#include "extractor/query_node.hpp"
|
||||||
#include "extractor/restriction.hpp"
|
#include "extractor/restriction.hpp"
|
||||||
#include "util/typedefs.hpp"
|
#include "util/typedefs.hpp"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#define NODE_BASED_GRAPH_HPP
|
#define NODE_BASED_GRAPH_HPP
|
||||||
|
|
||||||
#include "util/dynamic_graph.hpp"
|
#include "util/dynamic_graph.hpp"
|
||||||
#include "extractor/import_edge.hpp"
|
#include "extractor/node_based_edge.hpp"
|
||||||
#include "util/graph_utils.hpp"
|
#include "util/graph_utils.hpp"
|
||||||
|
|
||||||
#include <tbb/parallel_sort.h>
|
#include <tbb/parallel_sort.h>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "contractor/processing_chain.hpp"
|
#include "contractor/processing_chain.hpp"
|
||||||
#include "contractor/contractor.hpp"
|
#include "contractor/contractor.hpp"
|
||||||
|
|
||||||
#include "contractor/contractor.hpp"
|
#include "extractor/edge_based_edge.hpp"
|
||||||
|
|
||||||
#include "util/deallocating_vector.hpp"
|
#include "util/deallocating_vector.hpp"
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#include "extractor/edge_based_edge.hpp"
|
||||||
#include "extractor/edge_based_graph_factory.hpp"
|
#include "extractor/edge_based_graph_factory.hpp"
|
||||||
#include "util/coordinate_calculation.hpp"
|
#include "util/coordinate_calculation.hpp"
|
||||||
#include "util/percent.hpp"
|
#include "util/percent.hpp"
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "extractor/extractor.hpp"
|
#include "extractor/extractor.hpp"
|
||||||
|
|
||||||
|
#include "extractor/edge_based_edge.hpp"
|
||||||
#include "extractor/extraction_containers.hpp"
|
#include "extractor/extraction_containers.hpp"
|
||||||
#include "extractor/extraction_node.hpp"
|
#include "extractor/extraction_node.hpp"
|
||||||
#include "extractor/extraction_way.hpp"
|
#include "extractor/extraction_way.hpp"
|
||||||
|
Loading…
Reference in New Issue
Block a user