Skip to content

Commit

Permalink
Use group centroid for nearest group test
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Sep 29, 2016
1 parent 36e276f commit 3aeef8d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/core/symbology-ng/qgspointdistancerenderer.cpp
Expand Up @@ -114,6 +114,11 @@ bool QgsPointDistanceRenderer::renderFeature( QgsFeature& feature, QgsRenderCont
int groupIdx = mGroupIndex[ minDistFeatureId ];
ClusteredGroup& group = mClusteredGroups[groupIdx];

// calculate new centroid of group
QgsPoint oldCenter = mGroupLocations.value( minDistFeatureId );
mGroupLocations[ minDistFeatureId ] = QgsPoint(( oldCenter.x() * group.size() + point.x() ) / ( group.size() + 1.0 ),
( oldCenter.y() * group.size() + point.y() ) / ( group.size() + 1.0 ) );

// add to a group
group << GroupedFeature( feature, symbol, selected, label );
// add to group index
Expand Down

0 comments on commit 3aeef8d

Please sign in to comment.