Skip to content
Permalink
Browse files

Merge pull request #2240 from bjornharrtell/fgb-minor-opt

FlatGeobuf: Minor optimization to tree search
  • Loading branch information
rouault committed Feb 13, 2020
2 parents ef49c00 + e24a831 commit 9d0d9b1ed0bc819b70064afd0d60ab63c0f57c43
@@ -566,7 +566,7 @@ OGRErr OGRFlatGeobufLayer::parseFeature(OGRFeature *poFeature) {
auto seek = false;
if (m_queriedSpatialIndex && !m_ignoreSpatialFilter) {
const auto item = m_foundItems[m_featuresPos];
m_offset = m_offsetFeatures + item.nodeItem.offset;
m_offset = m_offsetFeatures + item.offset;
fid = item.index;
seek = true;
} else {
@@ -270,7 +270,7 @@ std::vector<SearchResultItem> PackedRTree::search(double minX, double minY, doub
if (!n.intersects(nodeItem))
continue;
if (isLeafNode)
results.push_back({ nodeItem, pos - 1 });
results.push_back({ nodeItem.offset, pos - 1 });
else
queue.insert(std::pair<uint64_t, uint64_t>(nodeItem.offset, level - 1));
}
@@ -318,7 +318,7 @@ std::vector<SearchResultItem> PackedRTree::streamSearch(
if (!item.intersects(nodeItem))
continue;
if (isLeafNode)
results.push_back({ nodeItem, pos - 1 });
results.push_back({ nodeItem.offset, pos - 1 });
else
queue.insert(std::pair<uint64_t, uint64_t>(nodeItem.offset, level - 1));
}
@@ -31,7 +31,7 @@ struct Item {
};

struct SearchResultItem {
NodeItem nodeItem;
uint64_t offset;
uint64_t index;
};

0 comments on commit 9d0d9b1

Please sign in to comment.
You can’t perform that action at this time.