Skip to content

Commit 6809835

Browse files
author
Andrew McAninch
committed
Merge remote-tracking branch 'qgis/master' into grass
2 parents 05b8a98 + 0fb356e commit 6809835

File tree

108 files changed

+16561
-14350
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+16561
-14350
lines changed

doc/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ ELSE(TXT2TAGS_EXECUTABLE)
2323
)
2424
ENDIF(TXT2TAGS_EXECUTABLE)
2525

26-
SET(QGIS_DOC_FILES ${QGIS_DOC_FILES} index.html news.html developersmap.html contributors.json favicon.ico style.css AUTHORS CONTRIBUTORS SPONSORS DONORS TRANSLATORS LICENSE)
26+
SET(QGIS_DOC_FILES ${QGIS_DOC_FILES} index.html news.html developersmap.html whatsnew.html contributors.json favicon.ico style.css AUTHORS CONTRIBUTORS SPONSORS DONORS TRANSLATORS LICENSE)
2727

2828
INSTALL(FILES ${QGIS_DOC_FILES} DESTINATION ${QGIS_DATA_DIR}/doc)
2929
INSTALL(FILES ../images/icons/qgis-icon-60x60.png DESTINATION ${QGIS_DATA_DIR}/doc/images)

python/core/qgsconditionalstyle.sip

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class QgsConditionalLayerStyles
2424

2525
/**
2626
* @brief Set the conditional styles for the field UI properties.
27+
* @param fieldName name of field
2728
* @param styles
2829
*/
2930
void setFieldStyles( QString fieldName, QList<QgsConditionalStyle> styles );
@@ -36,11 +37,11 @@ class QgsConditionalLayerStyles
3637

3738
/** Reads field ui properties specific state from Dom node.
3839
*/
39-
virtual bool readXml( const QDomNode& node );
40+
bool readXml( const QDomNode& node );
4041

4142
/** Write field ui properties specific state from Dom node.
4243
*/
43-
virtual bool writeXml( QDomNode & node, QDomDocument & doc ) const;
44+
bool writeXml( QDomNode & node, QDomDocument & doc ) const;
4445
};
4546

4647
/** \class QgsConditionalStyle

python/core/qgsvectorlayer.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1245,7 +1245,7 @@ class QgsVectorLayer : QgsMapLayer
12451245
/**
12461246
* @brief Return the conditional styles that are set for this layer. Style information is
12471247
* used to render conditional formatting in the attribute table.
1248-
* @return Return a \class QgsConditionalLayerStyles object holding the conditional attribute
1248+
* @return Return a QgsConditionalLayerStyles object holding the conditional attribute
12491249
* style information. Style information is generic and can be used for anything.
12501250
* @note added in QGIS 2.12
12511251
*/

src/analysis/raster/qgsrastercalculator.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ int QgsRasterCalculator::processCalculation( QProgressDialog* p )
9090
// if crs transform needed
9191
if ( it->raster->crs() != mOutputCrs )
9292
{
93-
QgsRasterProjector* proj = new QgsRasterProjector();
94-
proj->setCRS( it->raster->crs(), mOutputCrs );
95-
proj->setInput( it->raster->dataProvider()->clone() );
96-
proj->setPrecision( QgsRasterProjector::Exact );
93+
QgsRasterProjector proj;
94+
proj.setCRS( it->raster->crs(), mOutputCrs );
95+
proj.setInput( it->raster->dataProvider() );
96+
proj.setPrecision( QgsRasterProjector::Exact );
9797

98-
block = proj->block( it->bandNumber, mOutputRectangle, mNumOutputColumns, mNumOutputRows );
98+
block = proj.block( it->bandNumber, mOutputRectangle, mNumOutputColumns, mNumOutputRows );
9999
}
100100
else
101101
{
@@ -155,10 +155,7 @@ int QgsRasterCalculator::processCalculation( QProgressDialog* p )
155155
qWarning( "RasterIO error!" );
156156
}
157157

158-
if ( resultIsNumber )
159-
{
160-
delete[] calcData;
161-
}
158+
delete[] calcData;
162159
}
163160

164161
}

src/app/qgisapp.cpp

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,16 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
582582
int myBlue = settings.value( "/qgis/default_canvas_color_blue", 255 ).toInt();
583583
mMapCanvas->setCanvasColor( QColor( myRed, myGreen, myBlue ) );
584584

585-
centralLayout->addWidget( mMapCanvas, 0, 0, 2, 1 );
585+
mWelcomePage = new QgsWelcomePage;
586+
587+
mCentralContainer = new QStackedWidget;
588+
mCentralContainer->insertWidget( 0, mMapCanvas );
589+
mCentralContainer->insertWidget( 1, mWelcomePage );
590+
591+
qobject_cast<QGridLayout *>( centralWidget->layout() )->addWidget( mCentralContainer, 0, 0, 2, 1 );
592+
593+
mCentralContainer->setCurrentIndex( 1 );
594+
586595

587596
// a bar to warn the user with non-blocking messages
588597
mInfoBar = new QgsMessageBar( centralWidget );
@@ -1143,14 +1152,12 @@ void QgisApp::readSettings()
11431152
data.path = project;
11441153
data.title = project;
11451154

1146-
mRecentProjects.prepend( data );
1155+
mRecentProjects.append( data );
11471156
}
11481157

11491158
settings.beginGroup( "/UI/recentProjects" );
11501159
QStringList projectKeys = settings.childGroups();
11511160

1152-
1153-
11541161
Q_FOREACH ( const QString& key, projectKeys )
11551162
{
11561163
QgsWelcomePageItemsModel::RecentProjectData data;
@@ -1159,7 +1166,7 @@ void QgisApp::readSettings()
11591166
data.path = settings.value( "path" ).toString();
11601167
data.previewImagePath = settings.value( "previewImage" ).toString();
11611168
settings.endGroup();
1162-
mRecentProjects.prepend( data );
1169+
mRecentProjects.append( data );
11631170
}
11641171
settings.endGroup();
11651172

@@ -3913,19 +3920,8 @@ void QgisApp::fileOpenAfterLaunch()
39133920
QString projPath = QString();
39143921
if ( projOpen == 0 ) // welcome page
39153922
{
3916-
mWelcomePage = new QgsWelcomePage;
3917-
3918-
mCentralContainer = new QStackedWidget;
3919-
mCentralContainer->insertWidget( 0, mMapCanvas );
3920-
mCentralContainer->insertWidget( 1, mWelcomePage );
3921-
39223923
connect( mMapCanvas, SIGNAL( layersChanged() ), this, SLOT( showMapCanvas() ) );
39233924
connect( this, SIGNAL( newProject() ), this, SLOT( showMapCanvas() ) );
3924-
3925-
qobject_cast<QGridLayout *>( centralWidget()->layout() )->addWidget( mCentralContainer, 0, 0, 2, 1 );
3926-
3927-
mCentralContainer->setCurrentIndex( 1 );
3928-
39293925
return;
39303926
}
39313927
if ( projOpen == 1 && mRecentProjects.size() > 0 ) // most recent project

src/app/qgsabout.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,15 @@ void QgsAbout::init()
5656
QTcpSocket socket;
5757
socket.connectToHost( "qgis.org", 80 );
5858
if ( socket.waitForConnected( 1000 ) )
59+
{
5960
setDevelopersMap();
61+
}
6062
else
63+
{
6164
mOptionsListWidget->item( DEVELOPERS_MAP_INDEX )->setHidden( true );
62-
65+
QModelIndex firstItem = mOptionsListWidget->model()->index( 0, 0, QModelIndex() );
66+
mOptionsListWidget->setCurrentIndex( firstItem );
67+
}
6368
developersMapView->page()->setLinkDelegationPolicy( QWebPage::DelegateAllLinks );
6469
developersMapView->setContextMenuPolicy( Qt::NoContextMenu );
6570

src/app/qgswelcomepage.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include <QDesktopServices>
2727

2828
QgsWelcomePage::QgsWelcomePage( QWidget* parent )
29-
: QWidget( parent )
29+
: QTabWidget( parent )
3030
{
3131
QVBoxLayout* mainLayout = new QVBoxLayout;
3232
mainLayout->setMargin( 0 );
@@ -62,7 +62,7 @@ QgsWelcomePage::QgsWelcomePage( QWidget* parent )
6262

6363
recentProjctsContainer->layout()->addWidget( recentProjectsListView );
6464

65-
layout->addWidget( recentProjctsContainer );
65+
addTab( recentProjctsContainer, "Recent Projects" );
6666

6767
QWidget* whatsNewContainer = new QWidget;
6868
whatsNewContainer->setLayout( new QVBoxLayout );
@@ -73,14 +73,14 @@ QgsWelcomePage::QgsWelcomePage( QWidget* parent )
7373
whatsNewPage->setUrl( QUrl::fromLocalFile( QgsApplication::whatsNewFilePath() ) );
7474
whatsNewPage->page()->setLinkDelegationPolicy( QWebPage::DelegateAllLinks );
7575
whatsNewPage->setContextMenuPolicy( Qt::NoContextMenu );
76-
whatsNewPage->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding );
76+
whatsNewPage->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
7777
whatsNewPage->setStyleSheet( "background:transparent" );
7878
whatsNewPage->setAttribute( Qt::WA_TranslucentBackground );
7979

8080
whatsNewContainer->layout()->addWidget( whatsNewPage );
81-
whatsNewContainer->setMaximumWidth( 250 );
82-
whatsNewContainer->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred );
83-
layout->addWidget( whatsNewContainer );
81+
// whatsNewContainer->setMaximumWidth( 250 );
82+
// whatsNewContainer->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred );
83+
addTab( whatsNewContainer, "News" );
8484

8585
connect( whatsNewPage, SIGNAL( linkClicked( QUrl ) ), this, SLOT( whatsNewLinkClicked( QUrl ) ) );
8686

src/app/qgswelcomepage.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@
1616
#ifndef QGSWELCOMEDIALOG_H
1717
#define QGSWELCOMEDIALOG_H
1818

19+
#include <QTabWidget>
1920
#include <QWidget>
2021
#include <QLabel>
2122

2223
#include "qgswelcomepageitemsmodel.h"
2324

24-
class QgsWelcomePage : public QWidget
25+
class QgsWelcomePage : public QTabWidget
2526
{
2627
Q_OBJECT
2728

src/core/pal/feature.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ namespace pal
110110
{
111111
mHoles.at( i )->holeOf = this;
112112
}
113+
113114
}
114115

115116

@@ -119,7 +120,6 @@ namespace pal
119120

120121
qDeleteAll( mHoles );
121122
mHoles.clear();
122-
123123
}
124124

125125
void FeaturePart::extractCoords( const GEOSGeometry* geom )
@@ -166,6 +166,7 @@ namespace pal
166166
xmax = ymax = -DBL_MAX;
167167

168168
// initialize coordinate arrays
169+
deleteCoords();
169170
x = new double[nbPoints];
170171
y = new double[nbPoints];
171172

src/core/pal/labelposition.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,6 @@ namespace pal
175175
probFeat = other.probFeat;
176176
nbOverlap = other.nbOverlap;
177177

178-
memcpy( x, other.x, sizeof( double )*4 );
179-
memcpy( y, other.y, sizeof( double )*4 );
180178
alpha = other.alpha;
181179
w = other.w;
182180
h = other.h;

src/core/pal/layer.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,10 @@ namespace pal
235235
delete biggest_part; // safe with NULL part
236236
biggest_part = fpart;
237237
}
238+
else
239+
{
240+
delete fpart;
241+
}
238242
continue; // don't add the feature part now, do it later
239243
// TODO: we should probably add also other parts to act just as obstacles
240244
}
@@ -463,6 +467,7 @@ namespace pal
463467
newFeatureParts->append( newfpart );
464468
newfpart->getBoundingBox( bmin, bmax );
465469
rtree->Insert( bmin, bmax, newfpart );
470+
delete fpart;
466471
}
467472
else
468473
{

src/core/pal/layer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ namespace pal
330330

331331
/** Add newly created feature part into r tree and to the list */
332332
void addFeaturePart( FeaturePart* fpart, const QString &labelText = QString() );
333+
333334
};
334335

335336
} // end namespace pal

src/core/pal/pal.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ namespace pal
386386

387387
if ( isCancelled() )
388388
{
389+
qDeleteAll( *fFeats );
389390
delete fFeats;
390391
delete prob;
391392
delete obstacles;
@@ -464,6 +465,7 @@ namespace pal
464465
{
465466
if ( isCancelled() )
466467
{
468+
qDeleteAll( *fFeats );
467469
delete fFeats;
468470
delete prob;
469471
delete obstacles;

src/core/pal/pointset.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,8 @@ namespace pal
126126
nbPoints = ps.nbPoints;
127127
x = new double[nbPoints];
128128
y = new double[nbPoints];
129-
130-
for ( i = 0; i < nbPoints; i++ )
131-
{
132-
x[i] = ps.x[i];
133-
y[i] = ps.y[i];
134-
}
129+
memcpy( x, ps.x, sizeof( double )* nbPoints );
130+
memcpy( y, ps.y, sizeof( double )* nbPoints );
135131

136132
if ( ps.cHull )
137133
{

src/core/qgsconditionalstyle.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,12 @@ QgsConditionalStyle::QgsConditionalStyle( QString rule )
119119

120120
QgsConditionalStyle::QgsConditionalStyle( const QgsConditionalStyle &other )
121121
: mValid( other.mValid )
122+
, mName( other.mName )
122123
, mRule( other.mRule )
123124
, mFont( other.mFont )
124125
, mBackColor( other.mBackColor )
125126
, mTextColor( other.mTextColor )
126127
, mIcon( other.mIcon )
127-
, mName( other.mName )
128128
{
129129
if ( other.mSymbol.data() )
130130
mSymbol.reset( other.mSymbol->clone() );

src/core/qgsconditionalstyle.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class CORE_EXPORT QgsConditionalLayerStyles
3636

3737
/**
3838
* @brief Set the conditional styles for the field UI properties.
39+
* @param fieldName name of field
3940
* @param styles
4041
*/
4142
void setFieldStyles( QString fieldName, QList<QgsConditionalStyle> styles );
@@ -48,11 +49,11 @@ class CORE_EXPORT QgsConditionalLayerStyles
4849

4950
/** Reads field ui properties specific state from Dom node.
5051
*/
51-
virtual bool readXml( const QDomNode& node );
52+
bool readXml( const QDomNode& node );
5253

5354
/** Write field ui properties specific state from Dom node.
5455
*/
55-
virtual bool writeXml( QDomNode & node, QDomDocument & doc ) const;
56+
bool writeXml( QDomNode & node, QDomDocument & doc ) const;
5657

5758
private:
5859
QHash<QString, QgsConditionalStyles> mFieldStyles;

src/core/qgslabelsearchtree.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,17 +86,15 @@ bool QgsLabelSearchTree::insertLabel( LabelPosition* labelPos, int featureId, co
8686
QgsLabelPosition* newEntry = new QgsLabelPosition( featureId, labelPos->getAlpha(), cornerPoints, QgsRectangle( c_min[0], c_min[1], c_max[0], c_max[1] ),
8787
labelPos->getWidth(), labelPos->getHeight(), layerName, labeltext, labelfont, labelPos->getUpsideDown(), diagram, pinned );
8888
mSpatialIndex.Insert( c_min, c_max, newEntry );
89+
mOwnedPositions << newEntry;
8990
return true;
9091
}
9192

9293
void QgsLabelSearchTree::clear()
9394
{
94-
RTree<QgsLabelPosition*, double, 2, double>::Iterator indexIt;
95-
mSpatialIndex.GetFirst( indexIt );
96-
while ( !mSpatialIndex.IsNull( indexIt ) )
97-
{
98-
delete mSpatialIndex.GetAt( indexIt );
99-
mSpatialIndex.GetNext( indexIt );
100-
}
10195
mSpatialIndex.RemoveAll();
96+
97+
//PAL rtree iterator is buggy and doesn't iterate over all items, so we can't iterate through the tree to delete positions
98+
qDeleteAll( mOwnedPositions );
99+
mOwnedPositions.clear();
102100
}

src/core/qgslabelsearchtree.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class CORE_EXPORT QgsLabelSearchTree
6060
private:
6161
// set as mutable because RTree template is not const-correct
6262
mutable RTree<QgsLabelPosition*, double, 2, double> mSpatialIndex;
63+
QList< QgsLabelPosition* > mOwnedPositions;
6364
};
6465

6566
#endif // QGSLABELTREE_H

src/core/qgspallabeling.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4227,6 +4227,7 @@ void QgsPalLabeling::drawLabeling( QgsRenderContext& context )
42274227
if ( context.renderingStopped() )
42284228
{
42294229
delete problem;
4230+
deleteTemporaryData();
42304231
return; // it has been cancelled
42314232
}
42324233

src/core/qgspointlocator.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,9 @@ bool QgsPointLocator::rebuildIndex( int maxFeaturesToIndex )
670670

671671
SpatialIndex::Region r( rect2region( f.constGeometry()->boundingBox() ) );
672672
dataList << new RTree::Data( 0, 0, r, f.id() );
673+
674+
if ( mGeoms.contains( f.id() ) )
675+
delete mGeoms.take( f.id() );
673676
mGeoms[f.id()] = new QgsGeometry( *f.constGeometry() );
674677
++indexedCount;
675678

@@ -748,6 +751,9 @@ void QgsPointLocator::onFeatureAdded( QgsFeatureId fid )
748751
{
749752
SpatialIndex::Region r( rect2region( bbox ) );
750753
mRTree->insertData( 0, 0, r, f.id() );
754+
755+
if ( mGeoms.contains( f.id() ) )
756+
delete mGeoms.take( f.id() );
751757
mGeoms[fid] = new QgsGeometry( *f.constGeometry() );
752758
}
753759
}
@@ -761,7 +767,7 @@ void QgsPointLocator::onFeatureDeleted( QgsFeatureId fid )
761767
if ( mGeoms.contains( fid ) )
762768
{
763769
mRTree->deleteData( rect2region( mGeoms[fid]->boundingBox() ), fid );
764-
mGeoms.remove( fid );
770+
delete mGeoms.take( fid );
765771
}
766772
}
767773

0 commit comments

Comments
 (0)