Skip to content

Commit

Permalink
make geolocation faster
Browse files Browse the repository at this point in the history
  • Loading branch information
abeylot committed Mar 4, 2024
1 parent 34bb180 commit 6a3186d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
6 changes: 3 additions & 3 deletions CompiledDataManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ void CompiledDataManager::fillLinkedItems(Relation& r, uint64_t start, uint64_t
newWay = loadWay(buffer[i].id, fast);
if(newWay)
{
r.shape.mergePoints(newWay->points, newWay->pointsCount);
if(!fast) r.shape.mergePoints(newWay->points, newWay->pointsCount);
r.ways.push_back(newWay);
r.rect = r.rect + newWay->rect;
}
Expand All @@ -155,12 +155,12 @@ void CompiledDataManager::fillLinkedItems(Relation& r, uint64_t start, uint64_t
{
for(Line* l : newRel->shape.lines)
{
r.shape.mergePoints(l->points, l->pointsCount);
if(!fast)r.shape.mergePoints(l->points, l->pointsCount);
}
for(Relation* rel : newRel->relations)
for(Line* l : rel->shape.lines)
{
r.shape.mergePoints(l->points, l->pointsCount);
if(!fast) r.shape.mergePoints(l->points, l->pointsCount);
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions services/Geolocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,8 @@ Msg* Geolocation::processRequest(Msg* request, CompiledDataManager& mger)
{
areas = findExpression(word, mger);
new_areas.clear();
areas.sort(compare_weight);
if(areas.size() > 250) areas.resize(250);
if(!areas.empty())
{
for(auto a : areas)
Expand All @@ -614,6 +616,8 @@ Msg* Geolocation::processRequest(Msg* request, CompiledDataManager& mger)
}
}
best_areas = new_areas;
best_areas.sort(compare_weight);
if(best_areas.size() > 250) best_areas.resize(250);
}
}

Expand All @@ -622,6 +626,7 @@ Msg* Geolocation::processRequest(Msg* request, CompiledDataManager& mger)

weightedArea result;
best_areas.sort(compare_weight);
if(best_areas.size() > 250) best_areas.resize(250);


if(!best_areas.empty()) result = *(best_areas.begin());
Expand Down
4 changes: 2 additions & 2 deletions services/renderers/SvgRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ template<class ITEM> void SvgRenderer::iterate(const IndexDesc& idxDesc, const R
if( hash->addIfUnique(record.value.id*100 + indexId))
{
ITEM* item = NULL;
mger->load(item, record.value.id, true);
mger->load(item, record.value.id, false);
CssClass* cl = getCssClass(idxDesc, *item, zoom, record.value.zmMask & 0X100000LL);
label_s lbl;
if(cl)
Expand Down Expand Up @@ -253,7 +253,7 @@ template<class ITEM> void SvgRenderer::iterate(const IndexDesc& idxDesc, const R
if((record.value.zmMask & zmMask ) && ((record.value.r * (rect2) ).isValid()))
{
ITEM* item = NULL;
mger->load(item, record.value.id, true);
mger->load(item, record.value.id, false);

CssClass* cl = getCssClass(idxDesc, *item, zoom, record.value.zmMask & 0X100000LL);
label_s lbl;
Expand Down

0 comments on commit 6a3186d

Please sign in to comment.