fixes #1041, some only_ turn restrictions are inverted under certain conditions
This commit is contained in:
parent
d80c8cbd2f
commit
621a5a86a0
@ -30,7 +30,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
#include "../Util/SimpleLogger.h"
|
#include "../Util/SimpleLogger.h"
|
||||||
|
|
||||||
bool RestrictionMap::IsNodeAViaNode(const NodeID node) const
|
bool RestrictionMap::IsViaNode(const NodeID node) const
|
||||||
{
|
{
|
||||||
return m_no_turn_via_node_set.find(node) != m_no_turn_via_node_set.end();
|
return m_no_turn_via_node_set.find(node) != m_no_turn_via_node_set.end();
|
||||||
}
|
}
|
||||||
@ -86,7 +86,7 @@ void RestrictionMap::FixupArrivingTurnRestriction(const NodeID node_u,
|
|||||||
BOOST_ASSERT(node_v != SPECIAL_NODEID);
|
BOOST_ASSERT(node_v != SPECIAL_NODEID);
|
||||||
BOOST_ASSERT(node_w != SPECIAL_NODEID);
|
BOOST_ASSERT(node_w != SPECIAL_NODEID);
|
||||||
|
|
||||||
if (!RestrictionStartsAtNode(node_u))
|
if (!IsViaNode(node_u))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -106,7 +106,7 @@ void RestrictionMap::FixupArrivingTurnRestriction(const NodeID node_u,
|
|||||||
|
|
||||||
for (const NodeID node_x : predecessors)
|
for (const NodeID node_x : predecessors)
|
||||||
{
|
{
|
||||||
auto restriction_iterator = m_restriction_map.find({node_x, node_u});
|
const auto restriction_iterator = m_restriction_map.find({node_x, node_u});
|
||||||
if (restriction_iterator == m_restriction_map.end())
|
if (restriction_iterator == m_restriction_map.end())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@ -133,7 +133,7 @@ void RestrictionMap::FixupStartingTurnRestriction(const NodeID node_u,
|
|||||||
BOOST_ASSERT(node_v != SPECIAL_NODEID);
|
BOOST_ASSERT(node_v != SPECIAL_NODEID);
|
||||||
BOOST_ASSERT(node_w != SPECIAL_NODEID);
|
BOOST_ASSERT(node_w != SPECIAL_NODEID);
|
||||||
|
|
||||||
if (!RestrictionStartsAtNode(node_u))
|
if (!IsSourceNode(node_v))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -144,8 +144,8 @@ void RestrictionMap::FixupStartingTurnRestriction(const NodeID node_u,
|
|||||||
const unsigned index = restriction_iterator->second;
|
const unsigned index = restriction_iterator->second;
|
||||||
// remove old restriction start (v,w)
|
// remove old restriction start (v,w)
|
||||||
m_restriction_map.erase(restriction_iterator);
|
m_restriction_map.erase(restriction_iterator);
|
||||||
|
m_restriction_start_nodes.emplace(node_u);
|
||||||
// insert new restriction start (u,w) (point to index)
|
// insert new restriction start (u,w) (pointing to index)
|
||||||
RestrictionSource new_source = {node_u, node_w};
|
RestrictionSource new_source = {node_u, node_w};
|
||||||
m_restriction_map.emplace(new_source, index);
|
m_restriction_map.emplace(new_source, index);
|
||||||
}
|
}
|
||||||
@ -159,7 +159,7 @@ NodeID RestrictionMap::CheckForEmanatingIsOnlyTurn(const NodeID node_u,
|
|||||||
BOOST_ASSERT(node_u != SPECIAL_NODEID);
|
BOOST_ASSERT(node_u != SPECIAL_NODEID);
|
||||||
BOOST_ASSERT(node_v != SPECIAL_NODEID);
|
BOOST_ASSERT(node_v != SPECIAL_NODEID);
|
||||||
|
|
||||||
if (!RestrictionStartsAtNode(node_u))
|
if (!IsSourceNode(node_u))
|
||||||
{
|
{
|
||||||
return SPECIAL_NODEID;
|
return SPECIAL_NODEID;
|
||||||
}
|
}
|
||||||
@ -185,11 +185,13 @@ bool RestrictionMap::CheckIfTurnIsRestricted(const NodeID node_u,
|
|||||||
const NodeID node_v,
|
const NodeID node_v,
|
||||||
const NodeID node_w) const
|
const NodeID node_w) const
|
||||||
{
|
{
|
||||||
|
// return false;
|
||||||
|
|
||||||
BOOST_ASSERT(node_u != SPECIAL_NODEID);
|
BOOST_ASSERT(node_u != SPECIAL_NODEID);
|
||||||
BOOST_ASSERT(node_v != SPECIAL_NODEID);
|
BOOST_ASSERT(node_v != SPECIAL_NODEID);
|
||||||
BOOST_ASSERT(node_w != SPECIAL_NODEID);
|
BOOST_ASSERT(node_w != SPECIAL_NODEID);
|
||||||
|
|
||||||
if (!RestrictionStartsAtNode(node_u))
|
if (!IsSourceNode(node_u))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -212,7 +214,7 @@ bool RestrictionMap::CheckIfTurnIsRestricted(const NodeID node_u,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check of node is the start of any restriction
|
// check of node is the start of any restriction
|
||||||
bool RestrictionMap::RestrictionStartsAtNode(const NodeID node) const
|
bool RestrictionMap::IsSourceNode(const NodeID node) const
|
||||||
{
|
{
|
||||||
if (m_restriction_start_nodes.find(node) == m_restriction_start_nodes.end())
|
if (m_restriction_start_nodes.find(node) == m_restriction_start_nodes.end())
|
||||||
{
|
{
|
||||||
|
@ -51,11 +51,11 @@ class RestrictionMap
|
|||||||
void FixupStartingTurnRestriction(const NodeID u, const NodeID v, const NodeID w);
|
void FixupStartingTurnRestriction(const NodeID u, const NodeID v, const NodeID w);
|
||||||
NodeID CheckForEmanatingIsOnlyTurn(const NodeID u, const NodeID v) const;
|
NodeID CheckForEmanatingIsOnlyTurn(const NodeID u, const NodeID v) const;
|
||||||
bool CheckIfTurnIsRestricted(const NodeID u, const NodeID v, const NodeID w) const;
|
bool CheckIfTurnIsRestricted(const NodeID u, const NodeID v, const NodeID w) const;
|
||||||
bool IsNodeAViaNode(const NodeID node) const;
|
bool IsViaNode(const NodeID node) const;
|
||||||
unsigned size() { return m_count; }
|
unsigned size() { return m_count; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool RestrictionStartsAtNode(const NodeID node) const;
|
bool IsSourceNode(const NodeID node) const;
|
||||||
typedef std::pair<NodeID, NodeID> RestrictionSource;
|
typedef std::pair<NodeID, NodeID> RestrictionSource;
|
||||||
typedef std::pair<NodeID, bool> RestrictionTarget;
|
typedef std::pair<NodeID, bool> RestrictionTarget;
|
||||||
typedef std::vector<RestrictionTarget> EmanatingRestrictionsVector;
|
typedef std::vector<RestrictionTarget> EmanatingRestrictionsVector;
|
||||||
|
@ -46,8 +46,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <boost/filesystem/fstream.hpp>
|
#include <boost/filesystem/fstream.hpp>
|
||||||
|
|
||||||
#include <boost/thread.hpp>
|
#include <boost/thread.hpp>
|
||||||
|
#include <boost/variant.hpp>
|
||||||
|
|
||||||
#include <tbb/parallel_for.h>
|
#include <tbb/parallel_for.h>
|
||||||
#include <tbb/parallel_sort.h>
|
#include <tbb/parallel_sort.h>
|
||||||
@ -257,6 +257,27 @@ class StaticRTree
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename InnerNode, typename LeafNode>
|
||||||
|
struct IncrementalQueryCandidate
|
||||||
|
{
|
||||||
|
explicit IncrementalQueryCandidate(const float dist, const uint32_t n_id)
|
||||||
|
: min_dist(dist), node_id(n_id)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
IncrementalQueryCandidate() : min_dist(std::numeric_limits<float>::max()), node_id(UINT_MAX) {}
|
||||||
|
float min_dist;
|
||||||
|
uint32_t node_id;
|
||||||
|
inline bool operator<(const IncrementalQueryCandidate &other) const
|
||||||
|
{
|
||||||
|
// Attn: this is reversed order. std::pq is a max pq!
|
||||||
|
return other.min_dist < min_dist;
|
||||||
|
}
|
||||||
|
|
||||||
|
boost::variant<InnerNode, LeafNode> NodeWrapper;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typename ShM<TreeNode, UseSharedMemory>::vector m_search_tree;
|
typename ShM<TreeNode, UseSharedMemory>::vector m_search_tree;
|
||||||
uint64_t m_element_count;
|
uint64_t m_element_count;
|
||||||
const std::string m_leaf_node_filename;
|
const std::string m_leaf_node_filename;
|
||||||
@ -580,6 +601,18 @@ class StaticRTree
|
|||||||
return result_coordinate.isValid();
|
return result_coordinate.isValid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// implementation of the Hjaltason/Samet query [3]
|
||||||
|
bool IncrementalFindPhantomNodeForCoordinate(const FixedPointCoordinate &input_coordinate,
|
||||||
|
PhantomNode &result_phantom_node,
|
||||||
|
const unsigned zoom_level)
|
||||||
|
{
|
||||||
|
bool found_result = false;
|
||||||
|
|
||||||
|
|
||||||
|
// BOOST_ASSERT(found_result);
|
||||||
|
return found_result;
|
||||||
|
}
|
||||||
|
|
||||||
bool FindPhantomNodeForCoordinate(const FixedPointCoordinate &input_coordinate,
|
bool FindPhantomNodeForCoordinate(const FixedPointCoordinate &input_coordinate,
|
||||||
PhantomNode &result_phantom_node,
|
PhantomNode &result_phantom_node,
|
||||||
const unsigned zoom_level)
|
const unsigned zoom_level)
|
||||||
@ -753,5 +786,5 @@ class StaticRTree
|
|||||||
|
|
||||||
//[1] "On Packing R-Trees"; I. Kamel, C. Faloutsos; 1993; DOI: 10.1145/170088.170403
|
//[1] "On Packing R-Trees"; I. Kamel, C. Faloutsos; 1993; DOI: 10.1145/170088.170403
|
||||||
//[2] "Nearest Neighbor Queries", N. Roussopulos et al; 1995; DOI: 10.1145/223784.223794
|
//[2] "Nearest Neighbor Queries", N. Roussopulos et al; 1995; DOI: 10.1145/223784.223794
|
||||||
|
//[3] "Distance Browsing in Spatial Databases"; G. Hjaltason, H. Samet; 1999; ACM Trans. DB Sys Vol.24 No.2, pp.265-318
|
||||||
#endif // STATICRTREE_H
|
#endif // STATICRTREE_H
|
||||||
|
Loading…
Reference in New Issue
Block a user