Skip to content
Permalink
Browse files

Changed QList to QVector for faster access.

  • Loading branch information
henrik authored and nyalldawson committed Mar 26, 2019
1 parent 969fe29 commit 12b17b38c42a4e14330cf18b753d0daab4e5770d
@@ -61,22 +61,24 @@ void QgsPointDisplacementRenderer::drawGroup( QPointF centerPoint, QgsRenderCont

//calculate max diagonal size from all symbols in group
double diagonal = 0;
QList<double> diagonals;
QVector<double> diagonals(group.size());
double currentDiagonal;

int groupPosition = 0;
for ( const GroupedFeature &feature : group )
{
if ( QgsMarkerSymbol *symbol = feature.symbol() )
{
currentDiagonal = M_SQRT2 * symbol->size( context );
diagonals.append( currentDiagonal );
diagonals[groupPosition] = currentDiagonal;
diagonal = std::max( diagonal, currentDiagonal );

}
else
{
diagonals.append( 0.0 );
diagonals[groupPosition] = 0.0;
}
groupPosition++;
}

QgsSymbolRenderContext symbolContext( context, QgsUnitTypes::RenderMillimeters, 1.0, false );
@@ -244,7 +246,7 @@ void QgsPointDisplacementRenderer::setCenterSymbol( QgsMarkerSymbol *symbol )

void QgsPointDisplacementRenderer::calculateSymbolAndLabelPositions( QgsSymbolRenderContext &symbolContext, QPointF centerPoint, int nPosition,
double symbolDiagonal, QList<QPointF> &symbolPositions, QList<QPointF> &labelShifts, double &circleRadius, double &gridRadius,
int &gridSize, QList<double> &diagonals ) const
int &gridSize, QVector<double> &diagonals ) const
{
symbolPositions.clear();
labelShifts.clear();
@@ -172,7 +172,7 @@ class CORE_EXPORT QgsPointDisplacementRenderer: public QgsPointDistanceRenderer

//helper functions
void calculateSymbolAndLabelPositions( QgsSymbolRenderContext &symbolContext, QPointF centerPoint, int nPosition, double symbolDiagonal, QList<QPointF> &symbolPositions, QList<QPointF> &labelShifts, double &circleRadius,
double &gridRadius, int &gridSize, QList<double> &diagonals ) const;
double &gridRadius, int &gridSize, QVector<double> &diagonals ) const;
void drawCircle( double radiusPainterUnits, QgsSymbolRenderContext &context, QPointF centerPoint, int nSymbols );
void drawSymbols( const ClusteredGroup &group, QgsRenderContext &context, const QList<QPointF> &symbolPositions );
void drawGrid( int gridSizeUnits, QgsSymbolRenderContext &context,

0 comments on commit 12b17b3

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