Skip to content

Commit 5f1959b

Browse files
committed
move more stl usage to qt
1 parent 4530c2a commit 5f1959b

19 files changed

+51
-76
lines changed

src/analysis/network/qgslinevectorlayerdirector.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@
2828
#include <QString>
2929
#include <QtAlgorithms>
3030

31-
//standard includes
32-
#include <limits>
33-
#include <algorithm>
34-
3531
class QgsPointCompare
3632
{
3733
public:
@@ -318,7 +314,7 @@ void QgsLineVectorLayerDirector::makeGraph( QgsGraphBuilderInterface *builder, c
318314

319315
if ( !isFirstPoint )
320316
{
321-
std::map< double, QgsPoint > pointsOnArc;
317+
QMap< double, QgsPoint > pointsOnArc;
322318
pointsOnArc[ 0.0 ] = pt1;
323319
pointsOnArc[ pt1.sqrDist( pt2 )] = pt2;
324320

@@ -347,14 +343,14 @@ void QgsLineVectorLayerDirector::makeGraph( QgsGraphBuilderInterface *builder, c
347343
}
348344
}
349345

350-
std::map< double, QgsPoint >::iterator pointsIt;
346+
QMap< double, QgsPoint >::iterator pointsIt;
351347
QgsPoint pt1;
352348
QgsPoint pt2;
353349
int pt1idx = -1, pt2idx = -1;
354350
bool isFirstPoint = true;
355351
for ( pointsIt = pointsOnArc.begin(); pointsIt != pointsOnArc.end(); ++pointsIt )
356352
{
357-
pt2 = pointsIt->second;
353+
pt2 = *pointsIt;
358354
tmp = my_binary_search( points.begin(), points.end(), pt2, pointCompare );
359355
pt2 = *tmp;
360356
pt2idx = tmp - points.begin();

src/app/qgsabout.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@
2727
#include <QSqlDatabase>
2828
#include <QTcpSocket>
2929

30-
/* Uncomment this block to use preloaded images
31-
#include <map>
32-
std::map<QString, QPixmap> mugs;
33-
*/
3430
#ifdef Q_OS_MACX
3531
QgsAbout::QgsAbout( QWidget *parent )
3632
: QgsOptionsDialogBase( "about", parent, Qt::WindowSystemMenuHint ) // Modeless dialog with close button only

src/app/qgscustomprojectiondialog.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ void QgsCustomProjectionDialog::on_buttonBox_accepted()
403403

404404
//Check if all CRS are valid:
405405
QgsCoordinateReferenceSystem CRS;
406-
for ( size_t i = 0; i < customCRSids.size(); ++i )
406+
for ( int i = 0; i < customCRSids.size(); ++i )
407407
{
408408
CRS.createFromProj4( customCRSparameters[i] );
409409
if ( !CRS.isValid() )
@@ -415,19 +415,19 @@ void QgsCustomProjectionDialog::on_buttonBox_accepted()
415415
}
416416
//Modify the CRS changed:
417417
bool save_success = true;
418-
for ( size_t i = 0; i < customCRSids.size(); ++i )
418+
for ( int i = 0; i < customCRSids.size(); ++i )
419419
{
420420
CRS.createFromProj4( customCRSparameters[i] );
421421
//Test if we just added this CRS (if it has no existing ID)
422422
if ( customCRSids[i] == "" )
423423
{
424-
save_success = save_success && saveCRS( CRS, customCRSnames[i], "", true );
424+
save_success &= saveCRS( CRS, customCRSnames[i], "", true );
425425
}
426426
else
427427
{
428428
if ( existingCRSnames[customCRSids[i]] != customCRSnames[i] || existingCRSparameters[customCRSids[i]] != customCRSparameters[i] )
429429
{
430-
save_success = save_success && saveCRS( CRS, customCRSnames[i], customCRSids[i], false );
430+
save_success &= saveCRS( CRS, customCRSnames[i], customCRSids[i], false );
431431
}
432432
}
433433
if ( ! save_success )
@@ -436,9 +436,9 @@ void QgsCustomProjectionDialog::on_buttonBox_accepted()
436436
}
437437
}
438438
QgsDebugMsg( "We remove the deleted CRS." );
439-
for ( size_t i = 0; i < deletedCRSs.size(); ++i )
439+
for ( int i = 0; i < deletedCRSs.size(); ++i )
440440
{
441-
save_success = save_success && deleteCRS( deletedCRSs[i] );
441+
save_success &= deleteCRS( deletedCRSs[i] );
442442
if ( ! save_success )
443443
{
444444
QgsDebugMsg( QString( "Problem for layer '%1'" ).arg( customCRSparameters[i] ) );

src/app/qgscustomprojectiondialog.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ class APP_EXPORT QgsCustomProjectionDialog : public QDialog, private Ui::QgsCust
5959
QMap <QString, QString> existingCRSparameters;
6060
QMap <QString, QString> existingCRSnames;
6161

62-
//These three vectors store the value updated with the current modifications
63-
std::vector<QString> customCRSnames;
64-
std::vector<QString> customCRSids;
65-
std::vector<QString> customCRSparameters;
62+
//These three list store the value updated with the current modifications
63+
QStringList customCRSnames;
64+
QStringList customCRSids;
65+
QStringList customCRSparameters;
6666

6767
//vector saving the CRS to be deleted
68-
std::vector<QString> deletedCRSs;
68+
QStringList deletedCRSs;
6969

7070
//Columns in the tree widget
7171
enum columns { QGIS_CRS_NAME_COLUMN, QGIS_CRS_ID_COLUMN, QGIS_CRS_PARAMETERS_COLUMN };

src/core/pal/pal.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ namespace pal
478478
/*
479479
* BIG MACHINE
480480
*/
481-
std::list<LabelPosition*>* Pal::labeller( double bbox[4], PalStat **stats, bool displayAll )
481+
QList<LabelPosition*>* Pal::labeller( double bbox[4], PalStat **stats, bool displayAll )
482482
{
483483
#ifdef _DEBUG_
484484
std::cout << "LABELLER (selection)" << std::endl;
@@ -508,7 +508,7 @@ namespace pal
508508
// nothing to be done => return an empty result set
509509
if ( stats )
510510
( *stats ) = new PalStat();
511-
return new std::list<LabelPosition*>();
511+
return new QList<LabelPosition*>();
512512
}
513513

514514
std::cout << "PAL EXTRACT: " << t.elapsed() / 1000.0 << " s" << std::endl;
@@ -548,7 +548,7 @@ namespace pal
548548
//prob->post_optimization();
549549

550550

551-
std::list<LabelPosition*> * solution = prob->getSolution( displayAll );
551+
QList<LabelPosition*> * solution = prob->getSolution( displayAll );
552552

553553
if ( stats )
554554
*stats = prob->getStats();
@@ -581,10 +581,10 @@ namespace pal
581581
return extract( bbox[0], bbox[1], bbox[2], bbox[3] );
582582
}
583583

584-
std::list<LabelPosition*>* Pal::solveProblem( Problem* prob, bool displayAll )
584+
QList<LabelPosition*>* Pal::solveProblem( Problem* prob, bool displayAll )
585585
{
586586
if ( !prob )
587-
return new std::list<LabelPosition*>();
587+
return new QList<LabelPosition*>();
588588

589589
prob->reduce();
590590

@@ -599,7 +599,7 @@ namespace pal
599599
}
600600
catch ( InternalException::Empty )
601601
{
602-
return new std::list<LabelPosition*>();
602+
return new QList<LabelPosition*>();
603603
}
604604

605605
return prob->getSolution( displayAll );

src/core/pal/pal.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ namespace pal
153153
*
154154
* @return A list of label to display on map
155155
*/
156-
std::list<LabelPosition*> *labeller( double bbox[4], PalStat **stats, bool displayAll );
156+
QList<LabelPosition*> *labeller( double bbox[4], PalStat **stats, bool displayAll );
157157

158158
typedef bool ( *FnIsCancelled )( void* ctx );
159159

@@ -165,7 +165,7 @@ namespace pal
165165

166166
Problem* extractProblem( double bbox[4] );
167167

168-
std::list<LabelPosition*>* solveProblem( Problem* prob, bool displayAll );
168+
QList<LabelPosition*>* solveProblem( Problem* prob, bool displayAll );
169169

170170
/**
171171
*\brief Set flag show partial label

src/core/pal/problem.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2614,11 +2614,11 @@ namespace pal
26142614
return l1->getWidth() * l1->getHeight() > l2->getWidth() * l2->getHeight();
26152615
}
26162616

2617-
std::list<LabelPosition*> * Problem::getSolution( bool returnInactive )
2617+
QList<LabelPosition*> * Problem::getSolution( bool returnInactive )
26182618
{
26192619

26202620
int i;
2621-
std::list<LabelPosition*> *solList = new std::list<LabelPosition*>();
2621+
QList<LabelPosition*> *solList = new QList<LabelPosition*>();
26222622

26232623
if ( nbft == 0 )
26242624
{
@@ -2642,7 +2642,7 @@ namespace pal
26422642
// if features collide, order by size, so smaller ones appear on top
26432643
if ( returnInactive )
26442644
{
2645-
solList->sort( compareLabelArea );
2645+
qSort( solList->begin(), solList->end(), compareLabelArea );
26462646
}
26472647

26482648
return solList;

src/core/pal/problem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ namespace pal
136136
*/
137137
void chain_search();
138138

139-
std::list<LabelPosition*> * getSolution( bool returnInactive );
139+
QList<LabelPosition*> * getSolution( bool returnInactive );
140140

141141
PalStat * getStats();
142142

src/core/qgslabelingenginev2.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ void QgsLabelingEngineV2::run( QgsRenderContext& context )
243243
// do the labeling itself
244244
double bbox[] = { extent.xMinimum(), extent.yMinimum(), extent.xMaximum(), extent.yMaximum() };
245245

246-
std::list<pal::LabelPosition*>* labels;
246+
QList<pal::LabelPosition*>* labels;
247247
pal::Problem *problem;
248248
try
249249
{
@@ -307,7 +307,7 @@ void QgsLabelingEngineV2::run( QgsRenderContext& context )
307307
painter->setRenderHint( QPainter::Antialiasing );
308308

309309
// draw the labels
310-
std::list<pal::LabelPosition*>::iterator it = labels->begin();
310+
QList<pal::LabelPosition*>::iterator it = labels->begin();
311311
for ( ; it != labels->end(); ++it )
312312
{
313313
if ( context.renderingStopped() )

src/gui/qgsmapcanvas.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@
2020

2121
#include "qgsconfig.h"
2222

23-
#include <list>
24-
#include <memory>
25-
#include <deque>
26-
2723
#include "qgsexpressioncontext.h"
2824
#include "qgsrectangle.h"
2925
#include "qgspoint.h"

0 commit comments

Comments
 (0)