Skip to content
Permalink
Browse files

Misc optimisations identified by clazy:

- call reserve on container classes where applicable
- make sure Q_FOREACH uses references
- remove dynamic casts to base classes
- fix some implicit bool conversions
  • Loading branch information
nyalldawson committed Oct 5, 2015
1 parent 890dce8 commit 0caf944747b18c45ced0ae3966bbda18212f585d
Showing with 170 additions and 96 deletions.
  1. +1 −1 python/core/geometry/qgsgeometry.sip
  2. +2 −2 python/core/qgslegendsettings.sip
  3. +1 −1 python/core/qgsvectorlayer.sip
  4. +2 −1 python/core/symbology-ng/qgsheatmaprenderer.sip
  5. +1 −1 python/core/symbology-ng/qgsrendererv2.sip
  6. +1 −1 python/core/symbology-ng/qgssymbollayerv2utils.sip
  7. +1 −1 python/core/symbology-ng/qgssymbolv2.sip
  8. +1 −0 src/analysis/raster/qgsrelief.cpp
  9. +1 −0 src/analysis/vector/qgstransectsample.cpp
  10. +1 −1 src/app/qgsattributetabledialog.cpp
  11. +1 −0 src/app/qgsconfigureshortcutsdialog.cpp
  12. +3 −0 src/app/qgsdiagramproperties.cpp
  13. +1 −0 src/app/qgslabeldialog.cpp
  14. +1 −1 src/app/qgsmaptooladdfeature.cpp
  15. +1 −1 src/app/qgsmaptooladdpart.cpp
  16. +1 −1 src/app/qgsmaptooladdring.cpp
  17. +1 −0 src/app/qgsmergeattributesdialog.cpp
  18. +1 −0 src/app/qgsoptions.cpp
  19. +1 −0 src/app/qgsprojectproperties.cpp
  20. +6 −5 src/core/auth/qgsauthcertutils.cpp
  21. +1 −1 src/core/auth/qgsauthconfig.cpp
  22. +1 −1 src/core/auth/qgsauthmanager.cpp
  23. +2 −2 src/core/composer/qgscomposerlegend.cpp
  24. +2 −2 src/core/composer/qgscomposerlegend.h
  25. +1 −0 src/core/composer/qgscomposermap.cpp
  26. +1 −1 src/core/dxf/qgsdxfexport.cpp
  27. +4 −1 src/core/geometry/qgscurvepolygonv2.cpp
  28. +1 −1 src/core/geometry/qgscurvepolygonv2.h
  29. +2 −2 src/core/geometry/qgscurvev2.h
  30. +4 −1 src/core/geometry/qgsgeometry.cpp
  31. +1 −1 src/core/geometry/qgsgeometry.h
  32. +1 −0 src/core/geometry/qgsgeometryeditutils.cpp
  33. +2 −0 src/core/geometry/qgsgeos.cpp
  34. +1 −1 src/core/geometry/qgspolygonv2.cpp
  35. +1 −1 src/core/pal/rtree.hpp
  36. +1 −0 src/core/qgsconditionalstyle.cpp
  37. +1 −0 src/core/qgsdiagramrendererv2.cpp
  38. +1 −1 src/core/qgsdistancearea.cpp
  39. +1 −0 src/core/qgshistogram.cpp
  40. +1 −0 src/core/qgslabelsearchtree.cpp
  41. +2 −2 src/core/qgslegendsettings.h
  42. +2 −1 src/core/qgsmaplayerlegend.cpp
  43. +1 −1 src/core/qgspoint.h
  44. +1 −1 src/core/qgsvectorlayer.h
  45. +1 −1 src/core/qgsvectorlayerimport.cpp
  46. +1 −0 src/core/raster/qgsrasterfilewriter.cpp
  47. +1 −0 src/core/raster/qgsrasterlayer.cpp
  48. +3 −1 src/core/raster/qgsrasterprojector.cpp
  49. +1 −0 src/core/raster/qgsrastershader.cpp
  50. +2 −0 src/core/symbology-ng/qgscategorizedsymbolrendererv2.cpp
  51. +1 −0 src/core/symbology-ng/qgsellipsesymbollayerv2.cpp
  52. +4 −0 src/core/symbology-ng/qgsgraduatedsymbolrendererv2.cpp
  53. +2 −1 src/core/symbology-ng/qgsheatmaprenderer.h
  54. +5 −5 src/core/symbology-ng/qgsrendererv2.cpp
  55. +1 −1 src/core/symbology-ng/qgsrendererv2.h
  56. +5 −3 src/core/symbology-ng/qgssymbollayerv2utils.cpp
  57. +1 −1 src/core/symbology-ng/qgssymbollayerv2utils.h
  58. +1 −1 src/core/symbology-ng/qgssymbolv2.h
  59. +2 −1 src/core/symbology-ng/qgsvectorcolorrampv2.cpp
  60. +3 −1 src/gui/attributetable/qgsattributetablemodel.cpp
  61. +3 −1 src/gui/attributetable/qgsfeatureselectionmodel.cpp
  62. +2 −2 src/gui/auth/qgsauthauthoritieseditor.cpp
  63. +1 −1 src/gui/auth/qgsauthcertificateinfo.cpp
  64. +1 −1 src/gui/auth/qgsauthidentitieseditor.cpp
  65. +1 −1 src/gui/auth/qgsauthimportidentitydialog.cpp
  66. +1 −1 src/gui/auth/qgsauthserverseditor.cpp
  67. +1 −1 src/gui/auth/qgsauthtrustedcasdialog.cpp
  68. +1 −0 src/gui/editorwidgets/qgsrelationreferenceconfigdlg.cpp
  69. +1 −0 src/gui/editorwidgets/qgsrelationreferencefactory.cpp
  70. +1 −1 src/gui/qgisgui.cpp
  71. +1 −1 src/gui/qgscollapsiblegroupbox.cpp
  72. +2 −0 src/gui/qgsdatadefinedbutton.cpp
  73. +1 −0 src/gui/qgsexpressionbuilderwidget.cpp
  74. +1 −0 src/gui/qgsmanageconnectionsdialog.cpp
  75. +1 −1 src/gui/qgsmessagebar.cpp
  76. +3 −1 src/gui/qgsrasterlayersaveasdialog.cpp
  77. +3 −1 src/gui/qgsrelationmanagerdialog.cpp
  78. +4 −0 src/gui/raster/qgssinglebandpseudocolorrendererwidget.cpp
  79. +1 −2 src/gui/symbology-ng/qgscptcitycolorrampv2dialog.cpp
  80. +1 −0 src/gui/symbology-ng/qgsvectorgradientcolorrampv2dialog.cpp
  81. +1 −1 src/plugins/geometry_checker/ui/qgsgeometrycheckerresulttab.cpp
  82. +2 −2 src/plugins/grass/qgsgrassmodule.cpp
  83. +5 −5 src/plugins/grass/qgsgrassmoduleinput.cpp
  84. +8 −5 src/providers/grass/qgsgrass.cpp
  85. +5 −3 src/providers/grass/qgsgrassimport.cpp
  86. +6 −6 src/providers/grass/qgsgrassprovidermodule.cpp
  87. +1 −1 src/providers/grass/qgsgrassrasterprovider.cpp
  88. +3 −0 src/providers/grass/qgsgrassvectormap.cpp
  89. +3 −2 src/providers/grass/qgsgrassvectormaplayer.cpp
  90. +2 −1 src/providers/ogr/qgsogrdataitems.cpp
  91. +1 −0 src/providers/postgres/qgspostgresconn.cpp
  92. +2 −0 src/providers/postgres/qgspostgresprovider.cpp
  93. +1 −1 src/providers/wms/qgswmsprovider.cpp
@@ -532,7 +532,7 @@ class QgsGeometry
public:
Error();
Error( QString m );
Error( QString m, QgsPoint p );
Error( QString m, const QgsPoint& p );

QString what();
QgsPoint where();
@@ -47,10 +47,10 @@ class QgsLegendSettings
int columnCount() const;
void setColumnCount( int c );

int splitLayer() const;
bool splitLayer() const;
void setSplitLayer( bool s );

int equalColumnWidth() const;
bool equalColumnWidth() const;
void setEqualColumnWidth( bool s );

QColor fontColor() const;
@@ -190,7 +190,7 @@ class QgsVectorLayer : QgsMapLayer
struct RangeData
{
RangeData();
RangeData( QVariant theMin, QVariant theMax, QVariant theStep );
RangeData( const QVariant& theMin, const QVariant& theMax, const QVariant& theStep );

QVariant mMin;
QVariant mMax;
@@ -43,7 +43,8 @@ class QgsHeatmapRenderer : QgsFeatureRendererV2
* @see setInvertRamp
* @see colorRamp
*/
double invertRamp() const;
bool invertRamp() const;

/** Sets whether the ramp is inverted
* @param invert set to true to invert color ramp
* @see invertRamp
@@ -274,7 +274,7 @@ class QgsFeatureRendererV2
bool drawVertexMarker );

//! render editing vertex marker at specified point
void renderVertexMarker( QPointF& pt, QgsRenderContext& context );
void renderVertexMarker( const QPointF& pt, QgsRenderContext& context );
//! render editing vertex marker for a polyline
void renderVertexMarkerPolyline( QPolygonF& pts, QgsRenderContext& context );
//! render editing vertex marker for a polygon
@@ -169,7 +169,7 @@ class QgsSymbolLayerV2Utils


static void labelTextToSld( QDomDocument &doc, QDomElement &element, QString label,
QFont font, QColor color = QColor(), double size = -1 );
const QFont& font, QColor color = QColor(), double size = -1 );

/** Create ogr feature style string for pen */
static QString ogrFeatureStylePen( double width, double mmScaleFactor, double mapUnitsScaleFactor, const QColor& c,
@@ -156,7 +156,7 @@ class QgsSymbolV2
* @note added in QGIS 2.9
* @see setClipFeaturesToExtent
*/
double clipFeaturesToExtent() const;
bool clipFeaturesToExtent() const;

QSet<QString> usedAttributes() const;

@@ -674,6 +674,7 @@ QList< QgsRelief::ReliefColor > QgsRelief::calculateOptimizedReliefClasses()
colorList.push_back( QColor( 255, 133, 92 ) );
colorList.push_back( QColor( 204, 204, 204 ) );

resultList.reserve( classBreaks.size() );
for ( int i = 1; i < classBreaks.size(); ++i )
{
double minElevation = minMax[0] + classBreaks[i - 1] * frequencyClassRange;
@@ -614,6 +614,7 @@ QgsGeometry* QgsTransectSample::clipBufferLine( const QgsGeometry* stratumGeom,
}

int size = bufferPolygon.size();
mpl.reserve( size );
for ( int j = 0; j < size; ++j )
{
mpl.append( bufferPolygon[j] );
@@ -329,7 +329,7 @@ void QgsAttributeTableDialog::columnBoxInit()

QList<QgsField> fields = mLayer->fields().toList();

Q_FOREACH ( const QgsField field, fields )
Q_FOREACH ( const QgsField& field, fields )
{
int idx = mLayer->fieldNameIndex( field.name() );
if ( idx < 0 )
@@ -75,6 +75,7 @@ void QgsConfigureShortcutsDialog::populateActions()
QList<QAction*> actions = QgsShortcutsManager::instance()->listActions();

QList<QTreeWidgetItem *> items;
items.reserve( actions.count() );
for ( int i = 0; i < actions.count(); ++i )
{
QString actionText = actions[i]->text();
@@ -683,6 +683,9 @@ void QgsDiagramProperties::apply()
QList<QColor> categoryColors;
QList<QString> categoryAttributes;
QList<QString> categoryLabels;
categoryColors.reserve( mDiagramAttributesTreeWidget->topLevelItemCount() );
categoryAttributes.reserve( mDiagramAttributesTreeWidget->topLevelItemCount() );
categoryLabels.reserve( mDiagramAttributesTreeWidget->topLevelItemCount() );
for ( int i = 0; i < mDiagramAttributesTreeWidget->topLevelItemCount(); ++i )
{
QColor color = mDiagramAttributesTreeWidget->topLevelItem( i )->background( 1 ).color();
@@ -61,6 +61,7 @@ void QgsLabelDialog::init()
const QgsFields& myFields = mLabel->fields();
QStringList myFieldStringList;
myFieldStringList.append( "" );
myFieldStringList.reserve( 1 + myFields.count() );
for ( int i = 0; i < myFields.count(); ++i )
{
myFieldStringList.append( myFields[i].name() );
@@ -223,7 +223,7 @@ void QgsMapToolAddFeature::cadCanvasReleaseEvent( QgsMapMouseEvent* e )
QgsCurveV2* curveToAdd = 0;
if ( hasCurvedSegments && providerSupportsCurvedSegments )
{
curveToAdd = dynamic_cast<QgsCurveV2*>( captureCurve()->clone() );
curveToAdd = captureCurve()->clone();
}
else
{
@@ -134,7 +134,7 @@ void QgsMapToolAddPart::cadCanvasReleaseEvent( QgsMapMouseEvent * e )
QgsCurveV2* curveToAdd = 0;
if ( hasCurvedSegments && providerSupportsCurvedSegments )
{
curveToAdd = dynamic_cast<QgsCurveV2*>( captureCurve()->clone() );
curveToAdd = captureCurve()->clone();
}
else
{
@@ -92,7 +92,7 @@ void QgsMapToolAddRing::cadCanvasReleaseEvent( QgsMapMouseEvent * e )
QgsCurveV2* curveToAdd = 0;
if ( hasCurvedSegments && providerSupportsCurvedSegments )
{
curveToAdd = dynamic_cast<QgsCurveV2*>( captureCurve()->clone() );
curveToAdd = captureCurve()->clone();
}
else
{
@@ -449,6 +449,7 @@ QVariant QgsMergeAttributesDialog::sumAttribute( int col )
QVariant QgsMergeAttributesDialog::concatenationAttribute( int col )
{
QStringList concatString;
concatString.reserve( mFeatureList.size() );
for ( int i = 0; i < mFeatureList.size(); ++i )
{
concatString << mTableWidget->item( i + 1, col )->text();
@@ -1911,6 +1911,7 @@ void QgsOptions::on_pbnExportScales_clicked()
}

QStringList myScales;
myScales.reserve( mListGlobalScales->count() );
for ( int i = 0; i < mListGlobalScales->count(); ++i )
{
myScales.append( mListGlobalScales->item( i )->text() );
@@ -686,6 +686,7 @@ void QgsProjectProperties::apply()

//save project scales
QStringList myScales;
myScales.reserve( lstScales->count() );
for ( int i = 0; i < lstScales->count(); ++i )
{
myScales.append( lstScales->item( i )->text() );
@@ -49,7 +49,7 @@ QString QgsAuthCertUtils::getSslProtocolName( QSsl::SslProtocol protocol )
QMap<QString, QSslCertificate> QgsAuthCertUtils::mapDigestToCerts( QList<QSslCertificate> certs )
{
QMap<QString, QSslCertificate> digestmap;
Q_FOREACH ( QSslCertificate cert, certs )
Q_FOREACH ( const QSslCertificate& cert, certs )
{
digestmap.insert( shaHexForCert( cert ), cert );
}
@@ -59,7 +59,7 @@ QMap<QString, QSslCertificate> QgsAuthCertUtils::mapDigestToCerts( QList<QSslCer
QMap<QString, QList<QSslCertificate> > QgsAuthCertUtils::certsGroupedByOrg( QList<QSslCertificate> certs )
{
QMap< QString, QList<QSslCertificate> > orgcerts;
Q_FOREACH ( QSslCertificate cert, certs )
Q_FOREACH ( const QSslCertificate& cert, certs )
{
QString org( cert.subjectInfo( QSslCertificate::Organization ) );
if ( org.isEmpty() )
@@ -73,7 +73,7 @@ QMap<QString, QList<QSslCertificate> > QgsAuthCertUtils::certsGroupedByOrg( QLis
QMap<QString, QgsAuthConfigSslServer> QgsAuthCertUtils::mapDigestToSslConfigs( QList<QgsAuthConfigSslServer> configs )
{
QMap<QString, QgsAuthConfigSslServer> digestmap;
Q_FOREACH ( QgsAuthConfigSslServer config, configs )
Q_FOREACH ( const QgsAuthConfigSslServer& config, configs )
{
digestmap.insert( shaHexForCert( config.sslCertificate() ), config );
}
@@ -83,7 +83,7 @@ QMap<QString, QgsAuthConfigSslServer> QgsAuthCertUtils::mapDigestToSslConfigs( Q
QMap<QString, QList<QgsAuthConfigSslServer> > QgsAuthCertUtils::sslConfigsGroupedByOrg( QList<QgsAuthConfigSslServer> configs )
{
QMap< QString, QList<QgsAuthConfigSslServer> > orgconfigs;
Q_FOREACH ( QgsAuthConfigSslServer config, configs )
Q_FOREACH ( const QgsAuthConfigSslServer& config, configs )
{
QString org( config.sslCertificate().subjectInfo( QSslCertificate::Organization ) );
if ( org.isEmpty() )
@@ -371,6 +371,7 @@ QString QgsAuthCertUtils::getColonDelimited( const QString &txt )
// 64321c05b0ebab8e2b67ec0d7d9e2b6d4bc3c303
// -> 64:32:1c:05:b0:eb:ab:8e:2b:67:ec:0d:7d:9e:2b:6d:4b:c3:c3:03
QStringList sl;
sl.reserve( txt.size() );
for ( int i = 0; i < txt.size(); i += 2 )
{
sl << txt.mid( i, ( i + 2 > txt.size() ) ? -1 : 2 );
@@ -593,7 +594,7 @@ QList<QgsAuthCertUtils::CertUsageType> QgsAuthCertUtils::certificateUsageTypes(
}

QList<QCA::ConstraintType> certconsts = qcacert.constraints();
Q_FOREACH ( QCA::ConstraintType certconst, certconsts )
Q_FOREACH ( const QCA::ConstraintType& certconst, certconsts )
{
if ( certconst.known() == QCA::KeyCertificateSign )
{
@@ -285,7 +285,7 @@ const QgsPkiBundle QgsPkiBundle::fromPkcs12Paths( const QString &bundlepath,
if ( cert_chain.size() > 1 )
{
QList<QSslCertificate> ca_chain;
Q_FOREACH ( QCA::Certificate ca_cert, cert_chain )
Q_FOREACH ( const QCA::Certificate& ca_cert, cert_chain )
{
if ( ca_cert != cert_chain.primary() )
{
@@ -2328,7 +2328,7 @@ const QList<QSslCertificate> QgsAuthManager::getExtraFileCAs()
filecerts = QgsAuthCertUtils::certsFromFile( cafile );
}
// only CAs or certs capable of signing other certs are allowed
Q_FOREACH ( QSslCertificate cert, filecerts )
Q_FOREACH ( const QSslCertificate& cert, filecerts )
{
if ( !allowinvalid.toBool() && !cert.isValid() )
{
@@ -235,10 +235,10 @@ QString QgsComposerLegend::wrapChar() const {return mSettings.wrapChar(); }
int QgsComposerLegend::columnCount() const { return mSettings.columnCount(); }
void QgsComposerLegend::setColumnCount( int c ) { mSettings.setColumnCount( c ); }

int QgsComposerLegend::splitLayer() const { return mSettings.splitLayer(); }
bool QgsComposerLegend::splitLayer() const { return mSettings.splitLayer(); }
void QgsComposerLegend::setSplitLayer( bool s ) { mSettings.setSplitLayer( s ); }

int QgsComposerLegend::equalColumnWidth() const { return mSettings.equalColumnWidth(); }
bool QgsComposerLegend::equalColumnWidth() const { return mSettings.equalColumnWidth(); }
void QgsComposerLegend::setEqualColumnWidth( bool s ) { mSettings.setEqualColumnWidth( s ); }


@@ -150,10 +150,10 @@ class CORE_EXPORT QgsComposerLegend : public QgsComposerItem
int columnCount() const;
void setColumnCount( int c );

int splitLayer() const;
bool splitLayer() const;
void setSplitLayer( bool s );

int equalColumnWidth() const;
bool equalColumnWidth() const;
void setEqualColumnWidth( bool s );

void setComposerMap( const QgsComposerMap* map );
@@ -1425,6 +1425,7 @@ bool QgsComposerMap::readXML( const QDomElement& itemElem, const QDomDocument& d
{
QDomElement layerSetElem = layerSetNodeList.at( 0 ).toElement();
QDomNodeList layerIdNodeList = layerSetElem.elementsByTagName( "Layer" );
layerSet.reserve( layerIdNodeList.size() );
for ( int i = 0; i < layerIdNodeList.size(); ++i )
{
const QDomElement& layerIdElement = layerIdNodeList.at( i ).toElement();
@@ -4127,7 +4127,7 @@ QString QgsDxfExport::layerName( const QString &id, const QgsFeature &f ) const

QString QgsDxfExport::dxfEncoding( const QString &name )
{
Q_FOREACH ( QByteArray codec, QTextCodec::availableCodecs() )
Q_FOREACH ( const QByteArray& codec, QTextCodec::availableCodecs() )
{
if ( name != codec )
continue;
@@ -358,7 +358,9 @@ QgsPolygonV2* QgsCurvePolygonV2::surfaceToPolygon() const
QgsPolygonV2* polygon = new QgsPolygonV2();
polygon->setExteriorRing( exteriorRing()->curveToLine() );
QList<QgsCurveV2*> interiors;
for ( int i = 0, n = numInteriorRings(); i < n; ++i )
int n = numInteriorRings();
interiors.reserve( n );
for ( int i = 0; i < n; ++i )
{
interiors.append( interiorRing( i )->curveToLine() );
}
@@ -681,6 +683,7 @@ double QgsCurvePolygonV2::vertexAngle( const QgsVertexId& vertex ) const
{
if ( !mExteriorRing || vertex.ring < 0 || vertex.ring >= 1 + mInteriorRings.size() )
{
//makes no sense - conversion of false to double!
return false;
}

@@ -100,7 +100,7 @@ class CORE_EXPORT QgsCurvePolygonV2: public QgsSurfaceV2

virtual int vertexCount( int /*part*/ = 0, int ring = 0 ) const override;
virtual int ringCount( int /*part*/ = 0 ) const override { return ( mExteriorRing != 0 ) + mInteriorRings.size(); }
virtual int partCount() const override { return ringCount() > 0; }
virtual int partCount() const override { return ringCount() > 0 ? 1 : 0; }
virtual QgsPointV2 vertexAt( const QgsVertexId& id ) const override;

protected:
@@ -92,8 +92,8 @@ class CORE_EXPORT QgsCurveV2: public QgsAbstractGeometryV2
QgsAbstractGeometryV2* segmentize() const override;

virtual int vertexCount( int /*part*/ = 0, int /*ring*/ = 0 ) const override { return numPoints(); }
virtual int ringCount( int /*part*/ = 0 ) const override { return numPoints() > 0; }
virtual int partCount() const override { return numPoints() > 0; }
virtual int ringCount( int /*part*/ = 0 ) const override { return numPoints() > 0 ? 1 : 0; }
virtual int partCount() const override { return numPoints() > 0 ? 1 : 0; }
virtual QgsPointV2 vertexAt( const QgsVertexId& id ) const override;
};

@@ -1415,6 +1415,7 @@ QList<QgsGeometry*> QgsGeometry::asGeometryCollection() const
if ( gc )
{
int numGeom = gc->numGeometries();
geometryList.reserve( numGeom );
for ( int i = 0; i < numGeom; ++i )
{
geometryList.append( new QgsGeometry( gc->geometryN( i )->clone() ) );
@@ -1683,7 +1684,7 @@ int QgsGeometry::vertexNrFromVertexId( const QgsVertexId& id ) const
{
if ( !d || !d->geometry )
{
return false;
return -1;
}

QList< QList< QList< QgsPointV2 > > > coords;
@@ -1911,6 +1912,7 @@ QgsPolyline QgsGeometry::smoothLine( const QgsPolyline& polyline, const unsigned
for ( unsigned int iteration = 0; iteration < iterations; ++iteration )
{
QgsPolyline outputLine = QgsPolyline();
outputLine.reserve( 2 * ( result.count() - 1 ) );
for ( int i = 0; i < result.count() - 1; i++ )
{
const QgsPoint& p1 = result.at( i );
@@ -1933,6 +1935,7 @@ QgsPolygon QgsGeometry::smoothPolygon( const QgsPolygon& polygon, const unsigned
for ( unsigned int iteration = 0; iteration < iterations; ++iteration )
{
QgsPolyline outputRing = QgsPolyline();
outputRing.reserve( 2 * ( resultRing.count() - 1 ) + 1 );
for ( int i = 0; i < resultRing.count() - 1; ++i )
{
const QgsPoint& p1 = resultRing.at( i );
@@ -575,7 +575,7 @@ class CORE_EXPORT QgsGeometry
public:
Error() : message( "none" ), hasLocation( false ) {}
explicit Error( QString m ) : message( m ), hasLocation( false ) {}
Error( QString m, QgsPoint p ) : message( m ), location( p ), hasLocation( true ) {}
Error( QString m, const QgsPoint& p ) : message( m ), location( p ), hasLocation( true ) {}

QString what() { return message; }
QgsPoint where() { return location; }
@@ -42,6 +42,7 @@ int QgsGeometryEditUtils::addRing( QgsAbstractGeometryV2* geom, QgsCurveV2* ring
}
else if ( multiGeom )
{
polygonList.reserve( multiGeom->numGeometries() );
for ( int i = 0; i < multiGeom->numGeometries(); ++i )
{
polygonList.append( dynamic_cast< QgsCurvePolygonV2* >( multiGeom->geometryN( i ) ) );
@@ -561,6 +561,7 @@ int QgsGeos::splitLinearGeometry( GEOSGeometry* splitLine, QList<QgsAbstractGeom
if ( splitType == GEOS_MULTILINESTRING )
{
int nGeoms = GEOSGetNumGeometries_r( geosinit.ctxt, splitGeom );
lineGeoms.reserve( nGeoms );
for ( int i = 0; i < nGeoms; ++i )
lineGeoms << GEOSGeom_clone_r( geosinit.ctxt, GEOSGetGeometryN_r( geosinit.ctxt, splitGeom, i ) );

@@ -930,6 +931,7 @@ QgsLineStringV2* QgsGeos::sequenceToLinestring( const GEOSGeometry* geos, bool h
const GEOSCoordSequence* cs = GEOSGeom_getCoordSeq_r( geosinit.ctxt, geos );
unsigned int nPoints;
GEOSCoordSeq_getSize_r( geosinit.ctxt, cs, &nPoints );
pts.reserve( nPoints );
for ( unsigned int i = 0; i < nPoints; ++i )
{
pts.push_back( coordSeqPoint( cs, i, hasZ, hasM ) );
@@ -107,5 +107,5 @@ unsigned char* QgsPolygonV2::asWkb( int& binarySize ) const

QgsPolygonV2* QgsPolygonV2::surfaceToPolygon() const
{
return dynamic_cast<QgsPolygonV2*>( clone() );
return clone();
}

0 comments on commit 0caf944

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