From 577cf5ddc4f63cef91b3336bd85e2372083d408c Mon Sep 17 00:00:00 2001 From: Dennis Luxen Date: Thu, 16 Oct 2014 15:42:33 +0200 Subject: [PATCH] retrieve first and last nodes of a compressed segment --- Contractor/GeometryCompressor.cpp | 14 ++++++++++++++ Contractor/GeometryCompressor.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/Contractor/GeometryCompressor.cpp b/Contractor/GeometryCompressor.cpp index 82d83bad4..af0e1be1c 100644 --- a/Contractor/GeometryCompressor.cpp +++ b/Contractor/GeometryCompressor.cpp @@ -225,3 +225,17 @@ GeometryCompressor::GetBucketReference(const EdgeID edge_id) const const unsigned index = m_edge_id_to_list_index_map.at(edge_id); return m_compressed_geometries.at(index); } + + NodeID GeometryCompressor::GetFirstNodeIDOfBucket(const EdgeID edge_id) const + { + const auto &bucket = GetBucketReference(edge_id); + BOOST_ASSERT(bucket.size() >= 2); + return bucket[1].first; + } + NodeID GeometryCompressor::GetLastNodeIDOfBucket(const EdgeID edge_id) const + { + const auto &bucket = GetBucketReference(edge_id); + BOOST_ASSERT(bucket.size() >= 2); + return bucket[bucket.size()-2].first; + } + diff --git a/Contractor/GeometryCompressor.h b/Contractor/GeometryCompressor.h index 5ccbf886c..f0af3710c 100644 --- a/Contractor/GeometryCompressor.h +++ b/Contractor/GeometryCompressor.h @@ -54,6 +54,8 @@ class GeometryCompressor unsigned GetPositionForID(const EdgeID edge_id) const; const std::vector & GetBucketReference(const EdgeID edge_id) const; + NodeID GetFirstNodeIDOfBucket(const EdgeID edge_id) const; + NodeID GetLastNodeIDOfBucket(const EdgeID edge_id) const; private: void IncreaseFreeList();