Skip to content
Permalink
Browse files

Use QVector instead of QList in some private contexts

  • Loading branch information
nyalldawson committed Jan 25, 2016
1 parent 5574d40 commit f6c0d8dd63c2ff2df782989340a597e961738470
@@ -665,7 +665,7 @@ QList< QgsRelief::ReliefColor > QgsRelief::calculateOptimizedReliefClasses()
}

//set colors according to optimised class breaks
QList<QColor> colorList;
QVector<QColor> colorList;
colorList.push_back( QColor( 7, 165, 144 ) );
colorList.push_back( QColor( 12, 221, 162 ) );
colorList.push_back( QColor( 33, 252, 183 ) );
@@ -535,7 +535,7 @@ bool clipByRect( QLineF& line, const QPolygonF& rect )
borderLines << QLineF( rect.at( 2 ), rect.at( 3 ) );
borderLines << QLineF( rect.at( 3 ), rect.at( 0 ) );

QList<QPointF> intersectionList;
QVector<QPointF> intersectionList;
QVector<QLineF>::const_iterator it = borderLines.constBegin();
for ( ; it != borderLines.constEnd(); ++it )
{
@@ -534,7 +534,7 @@ static bool columnsBySortRank( QPair<int, QgsComposerTableColumn* > a, QPair<int
QList<QPair<int, bool> > QgsComposerAttributeTable::sortAttributes() const
{
//generate list of all sorted columns
QList< QPair<int, QgsComposerTableColumn* > > sortedColumns;
QVector< QPair<int, QgsComposerTableColumn* > > sortedColumns;
QList<QgsComposerTableColumn*>::const_iterator columnIt = mColumns.constBegin();
int idx = 0;
for ( ; columnIt != mColumns.constEnd(); ++columnIt )
@@ -551,7 +551,7 @@ QList<QPair<int, bool> > QgsComposerAttributeTable::sortAttributes() const

//generate list of column index, bool for sort direction (to match 2.0 api)
QList<QPair<int, bool> > attributesBySortRank;
QList< QPair<int, QgsComposerTableColumn* > >::const_iterator sortedColumnIt = sortedColumns.constBegin();
QVector< QPair<int, QgsComposerTableColumn* > >::const_iterator sortedColumnIt = sortedColumns.constBegin();
for ( ; sortedColumnIt != sortedColumns.constEnd(); ++sortedColumnIt )
{

@@ -645,7 +645,7 @@ static bool columnsBySortRank( QPair<int, QgsComposerTableColumn* > a, QPair<int
QList<QPair<int, bool> > QgsComposerAttributeTableV2::sortAttributes() const
{
//generate list of all sorted columns
QList< QPair<int, QgsComposerTableColumn* > > sortedColumns;
QVector< QPair<int, QgsComposerTableColumn* > > sortedColumns;
QList<QgsComposerTableColumn*>::const_iterator columnIt = mColumns.constBegin();
int idx = 0;
for ( ; columnIt != mColumns.constEnd(); ++columnIt )
@@ -662,7 +662,7 @@ QList<QPair<int, bool> > QgsComposerAttributeTableV2::sortAttributes() const

//generate list of column index, bool for sort direction (to match 2.0 api)
QList<QPair<int, bool> > attributesBySortRank;
QList< QPair<int, QgsComposerTableColumn* > >::const_iterator sortedColumnIt = sortedColumns.constBegin();
QVector< QPair<int, QgsComposerTableColumn* > >::const_iterator sortedColumnIt = sortedColumns.constBegin();
for ( ; sortedColumnIt != sortedColumns.constEnd(); ++sortedColumnIt )
{

@@ -1610,7 +1610,7 @@ int QgsComposerMapGrid::xGridLines( QList< QPair< double, QLineF > >& lines ) co
borderLines << QLineF( mapPolygon.at( 2 ), mapPolygon.at( 3 ) );
borderLines << QLineF( mapPolygon.at( 3 ), mapPolygon.at( 0 ) );

QList<QPointF> intersectionList; //intersects between border lines and grid lines
QVector<QPointF> intersectionList; //intersects between border lines and grid lines

while ( currentLevel <= mapBoundingRect.bottom() && gridLineCount < MAX_GRID_LINES )
{
@@ -1694,7 +1694,7 @@ int QgsComposerMapGrid::yGridLines( QList< QPair< double, QLineF > >& lines ) co
borderLines << QLineF( mapPolygon.at( 2 ), mapPolygon.at( 3 ) );
borderLines << QLineF( mapPolygon.at( 3 ), mapPolygon.at( 0 ) );

QList<QPointF> intersectionList; //intersects between border lines and grid lines
QVector<QPointF> intersectionList; //intersects between border lines and grid lines

while ( currentLevel <= mapBoundingRect.right() && gridLineCount < MAX_GRID_LINES )
{
@@ -16,6 +16,7 @@ email : marco.hugentobler at sourcepole dot com
#include "qgsgeometryutils.h"
#include "qgswkbptr.h"
#include <QStringList>
#include <QVector>

QgsPointV2 QgsGeometryUtils::closestVertex( const QgsAbstractGeometryV2& geom, const QgsPointV2& pt, QgsVertexId& id )
{
@@ -431,7 +432,7 @@ bool QgsGeometryUtils::segmentMidPoint( const QgsPointV2& p1, const QgsPointV2&
double midDy = midPoint.y() - p1.y();

//get the four possible midpoints
QList<QgsPointV2> possibleMidPoints;
QVector<QgsPointV2> possibleMidPoints;
possibleMidPoints.append( pointOnLineWithDistance( midPoint, QgsPointV2( midPoint.x() - midDy, midPoint.y() + midDx ), dist ) );
possibleMidPoints.append( pointOnLineWithDistance( midPoint, QgsPointV2( midPoint.x() - midDy, midPoint.y() + midDx ), 2 * radius - dist ) );
possibleMidPoints.append( pointOnLineWithDistance( midPoint, QgsPointV2( midPoint.x() + midDy, midPoint.y() - midDx ), dist ) );
@@ -17,7 +17,7 @@

#include "qgscrscache.h"
#include "qgscoordinatetransform.h"

#include <QVector>

QgsCoordinateTransformCache* QgsCoordinateTransformCache::instance()
{
@@ -69,7 +69,7 @@ void QgsCoordinateTransformCache::invalidateCrs( const QString& crsAuthId )
{
//get keys to remove first
QHash< QPair< QString, QString >, QgsCoordinateTransform* >::const_iterator it = mTransforms.constBegin();
QList< QPair< QString, QString > > updateList;
QVector< QPair< QString, QString > > updateList;

for ( ; it != mTransforms.constEnd(); ++it )
{
@@ -80,7 +80,7 @@ void QgsCoordinateTransformCache::invalidateCrs( const QString& crsAuthId )
}

//and remove after
QList< QPair< QString, QString > >::const_iterator updateIt = updateList.constBegin();
QVector< QPair< QString, QString > >::const_iterator updateIt = updateList.constBegin();
for ( ; updateIt != updateList.constEnd(); ++updateIt )
{
mTransforms.remove( *updateIt );
@@ -2432,7 +2432,6 @@ int QgsVectorLayer::snapWithContext( const QgsPoint& startPoint, double snapping
return 1;
}

QList<QgsFeature> featureList;
QgsRectangle searchRect( startPoint.x() - snappingTolerance, startPoint.y() - snappingTolerance,
startPoint.x() + snappingTolerance, startPoint.y() + snappingTolerance );
double sqrSnappingTolerance = snappingTolerance * snappingTolerance;
@@ -712,8 +712,6 @@ void QgsRasterProjector::insertCols( const QgsCoordinateTransform* ct )
{
for ( int r = 0; r < mCPRows; r++ )
{
QList<QgsPoint> myRow;
QList<bool> myLegalRow;
for ( int c = 0; c < mCPCols - 1; c++ )
{
mCPMatrix[r].insert( 1 + c*2, QgsPoint() );
@@ -279,8 +279,8 @@ int QgsMapCanvasSnapper::snapToBackgroundLayers( const QgsPoint& point, QList<Qg
if ( intersectionSnapping != 1 )
return 0;

QList<QgsSnappingResult> segments;
QList<QgsSnappingResult> points;
QVector<QgsSnappingResult> segments;
QVector<QgsSnappingResult> points;
for ( QList<QgsSnappingResult>::const_iterator it = results.constBegin();
it != results.constEnd();
++it )
@@ -297,12 +297,12 @@ int QgsMapCanvasSnapper::snapToBackgroundLayers( const QgsPoint& point, QList<Qg
}
}

if ( segments.length() < 2 )
if ( segments.count() < 2 )
return 0;

QList<QgsSnappingResult> myResults;

for ( QList<QgsSnappingResult>::const_iterator oSegIt = segments.constBegin();
for ( QVector<QgsSnappingResult>::const_iterator oSegIt = segments.constBegin();
oSegIt != segments.constEnd();
++oSegIt )
{
@@ -314,7 +314,7 @@ int QgsMapCanvasSnapper::snapToBackgroundLayers( const QgsPoint& point, QList<Qg

QgsGeometry* lineA = QgsGeometry::fromPolyline( vertexPoints );

for ( QList<QgsSnappingResult>::iterator iSegIt = segments.begin();
for ( QVector<QgsSnappingResult>::iterator iSegIt = segments.begin();
iSegIt != segments.end();
++iSegIt )
{
@@ -240,7 +240,7 @@ void QgsSingleBandPseudoColorRendererWidget::on_mClassifyButton_clicked()
int numberOfEntries = 0;

QList<double> entryValues;
QList<QColor> entryColors;
QVector<QColor> entryColors;

double min = lineEditValue( mMinLineEdit );
double max = lineEditValue( mMaxLineEdit );
@@ -333,7 +333,7 @@ void QgsSingleBandPseudoColorRendererWidget::on_mClassifyButton_clicked()
mColormapTreeWidget->clear();

QList<double>::const_iterator value_it = entryValues.begin();
QList<QColor>::const_iterator color_it = entryColors.begin();
QVector<QColor>::const_iterator color_it = entryColors.begin();

for ( ; value_it != entryValues.end(); ++value_it, ++color_it )
{
@@ -435,7 +435,6 @@ void QgsInterpolationDialog::on_mBBoxToCurrentExtent_clicked()
QgsRectangle QgsInterpolationDialog::boundingBoxOfLayers()
{
int nLayers = mLayersTreeWidget->topLevelItemCount();
QList< QgsInterpolator::LayerData > inputLayerList;
QgsRectangle combinedLayerExtent;

for ( int i = 0; i < nLayers; ++i )
@@ -337,7 +337,7 @@ void RgShortestPathWidget::findingPath()

int startVertexIdx = path->findVertex( p1 );
int stopVertexIdx = path->findVertex( p2 );
QList< QgsPoint > p;
QVector< QgsPoint > p;
while ( startVertexIdx != stopVertexIdx )
{
if ( stopVertexIdx < 0 )
@@ -356,7 +356,7 @@ void RgShortestPathWidget::findingPath()
stopVertexIdx = e.outVertex();
}
p.push_front( p1 );
QList< QgsPoint>::iterator it;
QVector< QgsPoint>::iterator it;
for ( it = p.begin(); it != p.end(); ++it )
{
mrbPath->addPoint( *it );
@@ -217,8 +217,7 @@ bool QgsVirtualLayerProvider::createIt()
}


QList<ColumnDef> fields, gFields;
QMap<QString, TableDef> refTables;
QVector<ColumnDef> gFields;
if ( !mDefinition.query().isEmpty() )
{

@@ -122,8 +122,8 @@ QgsMapLayer* QgsMSLayerCache::searchLayer( const QString& url, const QString& la
void QgsMSLayerCache::removeProjectFileLayers( const QString& project )
{
QgsMessageLog::logMessage( "Removing cache entries for project file: " + project, "Server", QgsMessageLog::INFO );
QList< QPair< QString, QString > > removeEntries;
QList< QgsMSLayerCacheEntry > removeEntriesValues;
QVector< QPair< QString, QString > > removeEntries;
QVector< QgsMSLayerCacheEntry > removeEntriesValues;

QHash<QPair<QString, QString>, QgsMSLayerCacheEntry>::iterator entryIt = mEntries.begin();
for ( ; entryIt != mEntries.end(); ++entryIt )
@@ -2828,7 +2828,7 @@ void QgsWMSServer::applyOpacities( const QStringList& layerList, QList< QPair< Q
QStringList opacityList = opIt.value().split( "," );

//collect leaf layers and their opacity
QList< QPair< QgsMapLayer*, int > > layerOpacityList;
QVector< QPair< QgsMapLayer*, int > > layerOpacityList;
QStringList::const_iterator oIt = opacityList.constBegin();
QStringList::const_iterator lIt = layerList.constBegin();
for ( ; oIt != opacityList.constEnd() && lIt != layerList.constEnd(); ++oIt, ++lIt )
@@ -2847,7 +2847,7 @@ void QgsWMSServer::applyOpacities( const QStringList& layerList, QList< QPair< Q
}
}

QList< QPair< QgsMapLayer*, int > >::const_iterator lOpIt = layerOpacityList.constBegin();
QVector< QPair< QgsMapLayer*, int > >::const_iterator lOpIt = layerOpacityList.constBegin();
for ( ; lOpIt != layerOpacityList.constEnd(); ++lOpIt )
{
//vector or raster?
@@ -230,7 +230,7 @@ void TestQgsRasterLayer::populateColorRampShader( QgsColorRampShader* colorRampS
QgsRasterBandStats myRasterBandStats = mpRasterLayer->dataProvider()->bandStatistics( bandNr );

QList<double> entryValues;
QList<QColor> entryColors;
QVector<QColor> entryColors;
double currentValue = myRasterBandStats.minimumValue;
double intervalDiff;
if ( numberOfEntries > 1 )
@@ -255,7 +255,7 @@ void TestQgsRasterLayer::populateColorRampShader( QgsColorRampShader* colorRampS
//items to imitate old pseudo color renderer
QList<QgsColorRampShader::ColorRampItem> colorRampItems;
QList<double>::const_iterator value_it = entryValues.begin();
QList<QColor>::const_iterator color_it = entryColors.begin();
QVector<QColor>::const_iterator color_it = entryColors.begin();
for ( ; value_it != entryValues.end(); ++value_it, ++color_it )
{
colorRampItems.append( QgsColorRampShader::ColorRampItem( *value_it, *color_it ) );
@@ -385,7 +385,7 @@ void TestQgsSymbolV2::testParseColorList()
++i;
}

QList< QPair< QString, QList<QColor> > > colorListTests;
QVector< QPair< QString, QList<QColor> > > colorListTests;
QList<QColor> list1;
list1 << QColor( QString( "blue" ) ) << QColor( QString( "red" ) ) << QColor( QString( "green" ) );
colorListTests.append( qMakePair( QString( "blue red green" ), list1 ) );
@@ -406,7 +406,7 @@ void TestQgsSymbolV2::testParseColorList()
colorListTests.append( qMakePair( QString( "rgb(255,0,0)\nrgb(0,255,0)\nrgb(0,0,255)" ), list3 ) );
colorListTests.append( qMakePair( QString( "rgb(255,0,0)\nrgb(0,255,0) rgb(0,0,255)" ), list3 ) );

QList< QPair< QString, QList<QColor> > >::const_iterator it = colorListTests.constBegin();
QVector< QPair< QString, QList<QColor> > >::const_iterator it = colorListTests.constBegin();
while ( it != colorListTests.constEnd() )
{
QgsDebugMsg( "color list string: " + ( *it ).first );

0 comments on commit f6c0d8d

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