From 190c0511bc8ce9e1380c4497aa06a8fde383eda8 Mon Sep 17 00:00:00 2001 From: "Juergen E. Fischer" Date: Fri, 3 Jan 2014 23:06:49 +0100 Subject: [PATCH] fix most cppcheck warnings and implement suggestions also update and sync some sip interfaces --- python/core/qgsmaplayer.sip | 16 +-- python/core/qgsvectorlayer.sip | 135 +++++++++++++----- .../symbology-ng/qgsfillsymbollayerv2.sip | 29 ++-- .../interpolation/DualEdgeTriangulation.cc | 1 - src/analysis/interpolation/MathUtils.cc | 17 +-- .../interpolation/NormVecDecorator.cc | 12 +- src/app/composer/qgscompositionwidget.cpp | 2 +- src/app/gps/qgsgpsmarker.cpp | 2 +- src/app/legend/qgslegend.cpp | 2 +- src/app/legend/qgslegenditem.cpp | 4 +- src/app/legend/qgslegendlayer.cpp | 1 - src/app/pluginmanager/qgspluginmanager.cpp | 14 +- src/app/qgisapp.cpp | 25 ++-- src/app/qgisapp.h | 6 +- src/app/qgsattributetypedialog.cpp | 4 +- src/app/qgsattributetypeloaddialog.cpp | 4 +- src/app/qgsdecorationnortharrow.cpp | 11 -- src/app/qgsdecorationscalebar.cpp | 2 - src/app/qgsidentifyresultsdialog.cpp | 22 +-- src/app/qgslabelinggui.cpp | 8 +- src/app/qgsmaptoollabel.cpp | 1 - src/app/qgsmaptoolpinlabels.cpp | 12 +- src/app/qgsmaptoolselectutils.cpp | 2 +- src/app/qgsmaptoolselectutils.h | 2 +- src/app/qgspluginregistry.cpp | 13 +- src/app/qgsprojectproperties.cpp | 6 +- src/core/composer/qgscomposereffect.cpp | 2 +- src/core/composer/qgscomposereffect.h | 2 +- src/core/composer/qgscomposeritem.cpp | 2 +- src/core/composer/qgscomposermap.cpp | 6 - src/core/dxf/qgsdxfexport.cpp | 16 +-- src/core/pal/feature.cpp | 3 +- src/core/pal/pal.cpp | 10 +- src/core/pal/problem.cpp | 30 ++-- src/core/qgsapplication.cpp | 12 +- src/core/qgsapplication.h | 12 +- src/core/qgsattributeaction.cpp | 2 +- src/core/qgscoordinatereferencesystem.cpp | 8 +- src/core/qgscoordinatereferencesystem.h | 8 +- src/core/qgscoordinatetransform.cpp | 36 ++--- src/core/qgsexpression.cpp | 4 +- src/core/qgsexpression.h | 4 +- src/core/qgsgeometry.cpp | 28 +--- src/core/qgsmaplayer.cpp | 12 +- src/core/qgsmaplayer.h | 18 +-- src/core/qgsmaprenderer.cpp | 8 +- src/core/qgsmaprenderer.h | 4 +- src/core/qgsmaptopixelgeometrysimplifier.cpp | 5 +- src/core/qgsogcutils.cpp | 10 +- src/core/qgsogcutils.h | 4 +- src/core/qgspallabeling.cpp | 4 +- src/core/qgsprojectfiletransform.cpp | 4 +- src/core/qgsprojectfiletransform.h | 4 +- src/core/qgsprojectproperty.cpp | 29 ++-- src/core/qgsprojectproperty.h | 2 +- src/core/qgsproviderregistry.cpp | 6 +- src/core/qgsvectorlayer.cpp | 16 +-- src/core/qgsvectorlayer.h | 22 +-- src/core/qgsvectorlayereditbuffer.cpp | 4 +- src/core/qgsvectorlayerfeatureiterator.cpp | 2 +- src/core/raster/qgsmultibandcolorrenderer.cpp | 4 +- .../raster/qgssinglebandcolordatarenderer.cpp | 5 +- src/core/spatialite/spatialite.c | 4 +- .../qgscategorizedsymbolrendererv2.cpp | 4 +- .../symbology-ng/qgsfillsymbollayerv2.cpp | 10 +- src/core/symbology-ng/qgsfillsymbollayerv2.h | 12 +- .../qgsgraduatedsymbolrendererv2.cpp | 9 +- .../symbology-ng/qgsrulebasedrendererv2.cpp | 4 +- src/core/symbology-ng/qgsstylev2.cpp | 2 +- .../symbology-ng/qgssymbollayerv2utils.cpp | 6 +- src/gui/qgisgui.h | 1 + src/gui/qgsattributeeditor.cpp | 12 +- src/gui/qgscollapsiblegroupbox.cpp | 5 +- src/gui/qgsmapcanvas.cpp | 6 +- src/gui/qgsmaptoolidentify.cpp | 2 +- src/gui/qgsowssourceselect.cpp | 2 +- .../qgscptcitycolorrampv2dialog.cpp | 3 +- src/mapserver/qgis_map_serv.cpp | 26 ++-- src/mapserver/qgsprojectparser.cpp | 26 ++-- src/mapserver/qgssldparser.cpp | 8 +- src/mapserver/qgssldparser.h | 6 +- src/mapserver/qgssoaprequesthandler.cpp | 4 +- src/mapserver/qgswfsserver.cpp | 32 ++--- src/mapserver/qgswmsserver.cpp | 16 +-- src/mapserver/qgswmsserver.h | 2 + src/plugins/compass/qgscompassplugin.cpp | 6 +- src/plugins/dxf2shp_converter/builder.cpp | 38 +++-- src/plugins/evis/evis.cpp | 11 +- src/plugins/georeferencer/qgsgcplist.cpp | 2 +- src/plugins/georeferencer/qgsgeorefplugin.cpp | 8 +- .../georeferencer/qgsgeorefplugingui.cpp | 2 +- .../georeferencer/qgsgeorefplugingui.h | 2 +- .../georeferencer/qgsgeoreftransform.cpp | 8 +- src/plugins/georeferencer/qgsimagewarper.cpp | 3 +- src/plugins/georeferencer/qgsleastsquares.cpp | 2 +- .../georeferencer/qgsmapcoordsdialog.cpp | 2 +- .../georeferencer/qgsmapcoordsdialog.h | 2 +- src/plugins/globe/globe_plugin.cpp | 2 +- src/plugins/globe/osgEarthUtil/Controls.cpp | 2 +- src/plugins/grass/qgsgrassmapcalc.cpp | 11 +- src/plugins/grass/qgsgrassmodel.cpp | 4 +- src/plugins/grass/qgsgrassmodule.cpp | 1 - src/plugins/grass/qgsgrassplugin.cpp | 17 +-- src/plugins/grass/qgsgrassplugin.h | 2 +- src/plugins/grass/qgsgrasstools.cpp | 4 +- src/plugins/heatmap/heatmap.cpp | 7 +- .../interpolation/qgsinterpolationdialog.cpp | 1 - .../oracle_raster/qgsoracle_plugin.cpp | 6 +- src/plugins/roadgraph/roadgraphplugin.cpp | 6 +- .../qgsgeometrycoordinatetransform.h | 2 +- .../spatialquery/qgsreaderfeatures.cpp | 2 +- src/plugins/spatialquery/qgsspatialquery.cpp | 5 +- .../spatialquery/qgsspatialquerydialog.cpp | 5 - src/plugins/spit/qgsspit.cpp | 10 +- src/plugins/spit/qgsspit.h | 4 +- src/plugins/spit/qgsspitplugin.cpp | 6 +- src/plugins/sqlanywhere/sqlanywhere.cpp | 6 +- src/plugins/topology/topol.cpp | 6 +- .../qgszonalstatisticsplugin.cpp | 2 - .../delimitedtext/qgsdelimitedtextfile.cpp | 1 - src/providers/gdal/qgsgdalprovider.cpp | 4 +- src/providers/grass/qgsgrassgislib.h | 2 +- .../memory/qgsmemoryfeatureiterator.cpp | 8 +- src/providers/mssql/qgsmssqldataitems.cpp | 12 +- .../mssql/qgsmssqlfeatureiterator.cpp | 1 - src/providers/mssql/qgsmssqlsourceselect.cpp | 1 + src/providers/ogr/qgsogrprovider.cpp | 1 - .../oracle/qgsoraclecolumntypethread.cpp | 1 + src/providers/oracle/qgsoracleprovider.cpp | 5 +- .../postgres/qgspostgresfeatureiterator.cpp | 4 +- .../postgres/qgspostgresprovider.cpp | 4 +- .../spatialite/qgsspatialiteprovider.cpp | 14 +- .../qgssqlanywherefeatureiterator.cpp | 2 +- .../sqlanywhere/qgssqlanywhereprovider.cpp | 58 ++++---- src/providers/wcs/qgswcscapabilities.cpp | 7 +- src/providers/wcs/qgswcssourceselect.cpp | 2 +- src/providers/wfs/qgswfsprovider.cpp | 4 +- src/providers/wfs/qgswfsprovider.h | 2 +- src/providers/wms/qgswmsprovider.cpp | 7 +- src/providers/wms/qgswmssourceselect.cpp | 4 +- 140 files changed, 607 insertions(+), 637 deletions(-) diff --git a/python/core/qgsmaplayer.sip b/python/core/qgsmaplayer.sip index b7bd26fe9f0..d12b0095714 100644 --- a/python/core/qgsmaplayer.sip +++ b/python/core/qgsmaplayer.sip @@ -166,7 +166,7 @@ class QgsMapLayer : QObject virtual bool isEditable() const; /** sets state from Dom document - @param layer_node is Dom node corresponding to ``maplayer'' tag + @param layerElement The Dom element corresponding to ``maplayer'' tag @note The Dom node corresponds to a Dom document project file XML element read @@ -276,9 +276,9 @@ class QgsMapLayer : QObject * @return a QString with any status messages * @see also loadDefaultStyle (); */ - virtual QString loadNamedStyle( const QString theURI, bool & theResultFlag /Out/ ); + virtual QString loadNamedStyle( const QString &theURI, bool &theResultFlag /Out/ ); - virtual bool loadNamedStyleFromDb( const QString db, const QString theURI, QString &qml /Out/ ); + virtual bool loadNamedStyleFromDb( const QString &db, const QString &theURI, QString &qml /Out/ ); //TODO edit infos /** @@ -321,12 +321,12 @@ class QgsMapLayer : QObject * @return a QString with any status messages * @sa saveDefaultStyle() */ - virtual QString saveNamedStyle( const QString theURI, bool & theResultFlag /Out/ ); + virtual QString saveNamedStyle( const QString &theURI, bool &theResultFlag /Out/ ); - virtual QString saveSldStyle( const QString theURI, bool & theResultFlag ); - virtual QString loadSldStyle( const QString theURI, bool &theResultFlag ); + virtual QString saveSldStyle( const QString &theURI, bool &theResultFlag ); + virtual QString loadSldStyle( const QString &theURI, bool &theResultFlag ); - virtual bool readSld( const QDomNode& node, QString& errorMessage ); + virtual bool readSld( const QDomNode &node, QString &errorMessage ); /** Read the symbology for the current layer from the Dom node supplied. * @param node node that will contain the symbology definition for this layer. @@ -344,7 +344,7 @@ class QgsMapLayer : QObject virtual bool writeSymbology( QDomNode &node, QDomDocument& doc, QString& errorMessage ) const = 0; /** Return pointer to layer's undo stack */ - QUndoStack* undoStack(); + QUndoStack *undoStack(); /** Get the QImage used for caching render operations * @note This method was added in QGIS 1.4 **/ diff --git a/python/core/qgsvectorlayer.sip b/python/core/qgsvectorlayer.sip index e9242535251..1ddeabc091d 100644 --- a/python/core/qgsvectorlayer.sip +++ b/python/core/qgsvectorlayer.sip @@ -15,6 +15,7 @@ class QgsAttributeEditorElement : QObject { AeTypeContainer, AeTypeField, + AeTypeRelation, AeTypeInvalid }; @@ -41,6 +42,7 @@ class QgsAttributeEditorContainer : QgsAttributeEditorElement virtual QDomElement toDomElement( QDomDocument& doc ) const; virtual void addChildElement( QgsAttributeEditorElement *widget ); + virtual bool isGroupBox() const; QList children() const; }; @@ -105,19 +107,20 @@ class QgsVectorLayer : QgsMapLayer Classification, EditRange, SliderRange, - CheckBox, /* added in 1.4 */ + CheckBox, /**< @note added in 1.4 */ FileName, Enumeration, - Immutable, /* The attribute value should not be changed in the attribute form */ - Hidden, /* The attribute value should not be shown in the attribute form @added in 1.4 */ - TextEdit, /* multiline edit @added in 1.4*/ - Calendar, /* calendar widget @added in 1.5 */ - DialRange, /* dial range @added in 1.5 */ - ValueRelation, /* value map from an table @added in 1.8 */ - UuidGenerator, /* uuid generator - readonly and automatically intialized @added in 1.9 */ - Photo, /* phote widget @added in 1.9 */ - WebView, /* webview widget @added in 1.9 */ - Color, /* color @added in 1.9 */ + Immutable, /**< The attribute value should not be changed in the attribute form */ + Hidden, /**< The attribute value should not be shown in the attribute form @note added in 1.4 */ + TextEdit, /**< multiline edit @note added in 1.4*/ + Calendar, /**< calendar widget @note added in 1.5 */ + DialRange, /**< dial range @note added in 1.5 */ + ValueRelation, /**< value map from an table @note added in 1.8 */ + UuidGenerator, /**< uuid generator - readonly and automatically intialized @note added in 1.9 */ + Photo, /**< phote widget @note added in 1.9 */ + WebView, /**< webview widget @note added in 1.9 */ + Color, /**< color @note added in 1.9 */ + EditorWidgetV2, /**< modularized edit widgets @note added in 2.1 */ }; /** Types of feature form suppression after feature creation @@ -418,13 +421,13 @@ class QgsVectorLayer : QgsMapLayer * @param theResultFlag will be set to true if a named style is correctly loaded * @param loadFromLocalDb if true forces to load from local db instead of datasource one */ - virtual QString loadNamedStyle( const QString theURI, bool &theResultFlag, bool loadFromLocalDb ); + virtual QString loadNamedStyle( const QString &theURI, bool &theResultFlag, bool loadFromLocalDb ); /** * Calls loadNamedStyle( theURI, theResultFlag, false ); * Retained for backward compatibility */ - virtual QString loadNamedStyle( const QString theURI, bool &theResultFlag ); + virtual QString loadNamedStyle( const QString &theURI, bool &theResultFlag ); virtual bool applyNamedStyle( QString namedStyle , QString errorMsg ); @@ -503,10 +506,12 @@ class QgsVectorLayer : QgsMapLayer */ bool addFeature( QgsFeature& f, bool alsoUpdateExtent = true ); - /** Updates an existing feature - @param f feature to update - @return True in case of success and False in case of error - @note added in 1.8 + /** Updates an existing feature. This method needs to query the datasource + on every call. Consider using {@link changeAttributeValue()} or + {@link changeGeometry()} instead. + @param f Feature to update + @return True in case of success and False in case of error + @note Added in 1.8 */ bool updateFeature( QgsFeature &f ); @@ -561,6 +566,15 @@ class QgsVectorLayer : QgsMapLayer @return 0 in case of success*/ int translateFeature( QgsFeatureId featureId, double dx, double dy ); + /**Splits parts cut by the given line + * @param splitLine line that splits the layer features + * @param topologicalEditing true if topological editing is enabled + * @return + * 0 in case of success, + * 4 if there is a selection but no feature split + */ + int splitParts( const QList& splitLine, bool topologicalEditing = false ); + /**Splits features cut by the given line * @param splitLine line that splits the layer features * @param topologicalEditing true if topological editing is enabled @@ -688,26 +702,57 @@ class QgsVectorLayer : QgsMapLayer @note added in version 1.2 */ bool addAttribute( const QgsField &field ); - /**Sets an alias (a display name) for attributes to display in dialogs - @note added in version 1.2*/ + /** + * Sets an alias (a display name) for attributes to display in dialogs + * @note added in version 1.2 + */ void addAttributeAlias( int attIndex, QString aliasString ); - /**Adds a tab (for the attribute editor form) holding groups and fields - @note added in version 1.9*/ + /** + * Adds a tab (for the attribute editor form) holding groups and fields + * @note added in version 2.0 + */ void addAttributeEditorWidget( QgsAttributeEditorElement* data ); - /**Returns a list of tabs holding groups and fields - @note added in version 1.9*/ + + /** + * Get the id for the editor widget used to represent the field at the given index + * + * @param fieldIdx The index of the field + * + * @return The id for the editor widget or a NULL string if not applicable + */ + const QString editorWidgetV2( int fieldIdx ); + + /** + * Get the configuration for the editor widget used to represent the field at the given index + * + * @param fieldIdx The index of the field + * + * @return The id for the editor widget or a NULL string if not configured + */ + const QgsEditorWidgetConfig editorWidgetV2Config( int fieldIdx ); + + /** + * Returns a list of tabs holding groups and fields + * @note added in version 2.0 + */ QList< QgsAttributeEditorElement* > &attributeEditorElements(); - /**Clears all the tabs for the attribute editor form - @note added in version 1.9*/ + /** + * Clears all the tabs for the attribute editor form + * @note added in version 2.0 + */ void clearAttributeEditorWidgets(); - /**Returns the alias of an attribute name or an empty string if there is no alias - @note added in version 1.2*/ + /** + * Returns the alias of an attribute name or an empty string if there is no alias + * @note added in version 1.2 + */ QString attributeAlias( int attributeIndex ) const; - /**Convenience function that returns the attribute alias if defined or the field name else - @note added in version 1.2*/ + /** + * Convenience function that returns the attribute alias if defined or the field name else + * @note added in version 1.2 + */ QString attributeDisplayName( int attributeIndex ) const; const QMap< QString, QString >& attributeAliases() const; @@ -771,6 +816,10 @@ class QgsVectorLayer : QgsMapLayer /** set the active layout for the attribute editor for this layer (added in 1.9) */ void setEditorLayout( EditorLayout editorLayout ); + void setEditorWidgetV2( int attrIdx, const QString& widgetType ); + + void setEditorWidgetV2Config( int attrIdx, const QMap& config ); + /** set string representing 'true' for a checkbox (added in 1.4) */ void setCheckedState( int idx, QString checked, QString notChecked ); @@ -817,6 +866,14 @@ class QgsVectorLayer : QgsMapLayer **/ ValueRelationData &valueRelation( int idx ); + /** + * Get relations, where the foreign key is on this layer + * + * @param idx Only get relations, where idx forms part of the foreign key + * @return A list of relations + */ + QList referencingRelations( int idx ); + /**access date format * @note added in 1.9 */ @@ -906,7 +963,7 @@ class QgsVectorLayer : QgsMapLayer /* Set the blending mode used for rendering each feature * @note added in 2.0 */ - void setFeatureBlendMode( const QPainter::CompositionMode blendMode ); + void setFeatureBlendMode( const QPainter::CompositionMode &blendMode ); /* Returns the current blending mode for features * @note added in 2.0 */ @@ -920,7 +977,12 @@ class QgsVectorLayer : QgsMapLayer * @note added in 2.0 */ int layerTransparency() const; - + + QString metadata(); + + /** @note not available in python bindings */ + // inline QgsGeometryCache* cache(); + /** Set the Map2pixel simplification threshold for fast rendering of features */ void setSimplifyDrawingTol( float simplifyDrawingTol ); /** Returns the Map2pixel simplification threshold for fast rendering of features */ @@ -942,7 +1004,7 @@ class QgsVectorLayer : QgsMapLayer int simplifyDrawingHints() const; /** Returns whether the VectorLayer can apply the specified simplification hint */ - bool simplifyDrawingCanbeApplied( int simplifyHint ) const; + bool simplifyDrawingCanbeApplied( int simplifyHint ) const; public slots: /** @@ -999,11 +1061,6 @@ class QgsVectorLayer : QgsMapLayer @note added in 1.7 */ void checkJoinLayerRemove( QString theLayerId ); - QString metadata(); - - /** @note not available in python bindings */ - // QgsGeometryCache* cache(); - /** * @brief Is called when the cache image is being deleted. Overwrite and use to clean up. * @note added in 2.0 @@ -1080,6 +1137,8 @@ class QgsVectorLayer : QgsMapLayer void committedAttributeValuesChanges( const QString& layerId, const QgsChangedAttributesMap& changedAttributesValues ); void committedGeometriesChanges( const QString& layerId, const QgsGeometryMap& changedGeometries ); + void saveLayerToProject(); + /** Emitted when the font family defined for labeling layer is not found on system * @note added in 1.9 */ @@ -1089,7 +1148,7 @@ class QgsVectorLayer : QgsMapLayer void rendererChanged(); /** Signal emitted when setFeatureBlendMode() is called */ - void featureBlendModeChanged( const QPainter::CompositionMode blendMode ); + void featureBlendModeChanged( const QPainter::CompositionMode &blendMode ); /** Signal emitted when setLayerTransparency() is called */ void layerTransparencyChanged( int layerTransparency ); diff --git a/python/core/symbology-ng/qgsfillsymbollayerv2.sip b/python/core/symbology-ng/qgsfillsymbollayerv2.sip index 0787ecd7c05..66b1ed739c0 100644 --- a/python/core/symbology-ng/qgsfillsymbollayerv2.sip +++ b/python/core/symbology-ng/qgsfillsymbollayerv2.sip @@ -92,14 +92,14 @@ class QgsGradientFillSymbolLayerV2 : QgsFillSymbolLayerV2 Reflect, Repeat }; - + QgsGradientFillSymbolLayerV2( QColor color = DEFAULT_SIMPLEFILL_COLOR, QColor color2 = Qt::white, GradientColorType gradientColorType = SimpleTwoColor, GradientType gradientType = Linear, GradientCoordinateMode coordinateMode = Feature, - GradientSpread gradientSpread = Pad ); - + GradientSpread gradientSpread = Pad + ); // static stuff static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() ) /Factory/; @@ -118,45 +118,58 @@ class QgsGradientFillSymbolLayerV2 : QgsFillSymbolLayerV2 QgsSymbolLayerV2* clone() const /Factory/; + /**Type of gradient, eg linear or radial*/ GradientType gradientType() const; void setGradientType( GradientType gradientType ); + /**Gradient color mode, controls how gradient color stops are created*/ GradientColorType gradientColorType() const; void setGradientColorType( GradientColorType gradientColorType ); + /**Color ramp used for the gradient fill, only used if the gradient color type is set to ColorRamp*/ QgsVectorColorRampV2* colorRamp(); void setColorRamp( QgsVectorColorRampV2* ramp ); + /**Color for endpoint of gradient, only used if the gradient color type is set to SimpleTwoColor*/ QColor color2() const; void setColor2( QColor color2 ); + /**Coordinate mode for gradient. Controls how the gradient stops are positioned.*/ GradientCoordinateMode coordinateMode() const; void setCoordinateMode( GradientCoordinateMode coordinateMode ); + /**Gradient spread mode. Controls how the gradient behaves outside of the predefined stops*/ GradientSpread gradientSpread() const; void setGradientSpread( GradientSpread gradientSpread ); + /**Starting point of gradient fill, in the range [0,0] - [1,1]*/ void setReferencePoint1( QPointF referencePoint ); QPointF referencePoint1() const; - + + /**Sets the starting point of the gradient to be the feature centroid*/ void setReferencePoint1IsCentroid( bool isCentroid ); bool referencePoint1IsCentroid() const; + /**End point of gradient fill, in the range [0,0] - [1,1]*/ void setReferencePoint2( QPointF referencePoint ); QPointF referencePoint2() const; - - void setReferencePoint2IsCentroid( bool isCentroid ); - bool referencePoint2IsCentroid() const; + /**Sets the end point of the gradient to be the feature centroid*/ + void setReferencePoint2IsCentroid( bool isCentroid ); + bool referencePoint2IsCentroid() const; + + /**Rotation angle for gradient fill. Can be used to rotate a gradient around its centre point*/ void setAngle( double angle ); double angle() const; + /**Offset for gradient fill*/ void setOffset( QPointF offset ); QPointF offset() const; + /**Units for gradient fill offset*/ void setOffsetUnit( QgsSymbolV2::OutputUnit unit ); QgsSymbolV2::OutputUnit offsetUnit() const; - + }; /**Base class for polygon renderers generating texture images*/ diff --git a/src/analysis/interpolation/DualEdgeTriangulation.cc b/src/analysis/interpolation/DualEdgeTriangulation.cc index 8a351881b6a..41eaafdb9ad 100644 --- a/src/analysis/interpolation/DualEdgeTriangulation.cc +++ b/src/analysis/interpolation/DualEdgeTriangulation.cc @@ -458,7 +458,6 @@ int DualEdgeTriangulation::baseEdgeOfPoint( int point ) { mEdgeInside = actedge; return actedge; - break; } else if ( leftofnumber <= 0 ) diff --git a/src/analysis/interpolation/MathUtils.cc b/src/analysis/interpolation/MathUtils.cc index 27876e59396..d740bee5663 100644 --- a/src/analysis/interpolation/MathUtils.cc +++ b/src/analysis/interpolation/MathUtils.cc @@ -267,21 +267,8 @@ bool MathUtils::inCircle( Point3D* testp, Point3D* p1, Point3D* p2, Point3D* p3 aValue = aValue - (( bx * bx + by * by ) * triArea( p1, p3, testp ) ); aValue = aValue + (( cx * cx + cy * cy ) * triArea( p1, p2, testp ) ); aValue = aValue - (( px * px + py * py ) * triArea( p1, p2, p3 ) ); - //return aValue>0.0; - if ( aValue > tolerance ) - { - return true; - } - else if ( aValue < -tolerance ) - { - return false; - } - else//point is approximately on the circle - { - //cout << "aValue " << aValue << endl << flush; - //return aValue>0.0; - return false; - } + + return aValue > tolerance; } else { diff --git a/src/analysis/interpolation/NormVecDecorator.cc b/src/analysis/interpolation/NormVecDecorator.cc index 0ef509d4f7b..7eed122e9ec 100644 --- a/src/analysis/interpolation/NormVecDecorator.cc +++ b/src/analysis/interpolation/NormVecDecorator.cc @@ -62,15 +62,15 @@ int NormVecDecorator::addPoint( Point3D* p ) while ( it != list->end() ) { int point; - point = ( *it ); + point = *it; if ( point != -1 ) { estimateFirstDerivative( point ); } - it++; - it++; - it++; - it++; + ++it; + ++it; + ++it; + ++it; } delete list; } @@ -161,7 +161,7 @@ bool NormVecDecorator::calcNormalForPoint( double x, double y, int point, Vector if ( numberofbreaks > 0 ) { - if ( p1 != -1 && p2 != -1 && p2 != -1 ) + if ( p1 != -1 && p2 != -1 && p3 != -1 ) { if ( MathUtils::pointInsideTriangle( x, y, getPoint( p1 ), getPoint( p2 ), getPoint( p3 ) ) ) { diff --git a/src/app/composer/qgscompositionwidget.cpp b/src/app/composer/qgscompositionwidget.cpp index 0944060befe..c7739e8f43c 100644 --- a/src/app/composer/qgscompositionwidget.cpp +++ b/src/app/composer/qgscompositionwidget.cpp @@ -134,7 +134,7 @@ void QgsCompositionWidget::createPaperEntries() ; mPaperSizeComboBox->addItem( tr( "Custom" ) ); - for ( QList::const_iterator it = formats.begin(); it != formats.end(); it++ ) + for ( QList::const_iterator it = formats.begin(); it != formats.end(); ++it ) { mPaperSizeComboBox->addItem( it->mName ); mPaperMap.insert( it->mName, *it ); diff --git a/src/app/gps/qgsgpsmarker.cpp b/src/app/gps/qgsgpsmarker.cpp index 551fcd1e411..9d88870f326 100644 --- a/src/app/gps/qgsgpsmarker.cpp +++ b/src/app/gps/qgsgpsmarker.cpp @@ -48,7 +48,7 @@ void QgsGpsMarker::setCenter( const QgsPoint& point ) { mCenter = t.transform( point ); } - catch ( QgsCsException e ) //silently ignore transformation exceptions + catch ( QgsCsException &e ) //silently ignore transformation exceptions { return; } diff --git a/src/app/legend/qgslegend.cpp b/src/app/legend/qgslegend.cpp index 3de4dbcbf13..d7a73fa366e 100644 --- a/src/app/legend/qgslegend.cpp +++ b/src/app/legend/qgslegend.cpp @@ -2159,7 +2159,7 @@ QgsLegendGroup* QgsLegend::findLegendGroup( const QString& name, const QString& void QgsLegend::adjustIconSize() { - if ( mPixmapWidthValues.size() > 0 && mPixmapHeightValues.size() > 0 ) + if ( !mPixmapWidthValues.empty() && !mPixmapHeightValues.empty() ) { std::multiset::const_reverse_iterator width_it = mPixmapWidthValues.rbegin(); std::multiset::const_reverse_iterator height_it = mPixmapHeightValues.rbegin(); diff --git a/src/app/legend/qgslegenditem.cpp b/src/app/legend/qgslegenditem.cpp index b1a57285e65..f8a4043a585 100644 --- a/src/app/legend/qgslegenditem.cpp +++ b/src/app/legend/qgslegenditem.cpp @@ -18,13 +18,13 @@ #include "qgslogger.h" -QgsLegendItem::QgsLegendItem( QTreeWidgetItem * theItem, QString theName ) +QgsLegendItem::QgsLegendItem( QTreeWidgetItem *theItem, QString theName ) : QTreeWidgetItem( theItem ) { setText( 0, theName ); } -QgsLegendItem::QgsLegendItem( QTreeWidget* theListView, QString theString ) +QgsLegendItem::QgsLegendItem( QTreeWidget *theListView, QString theString ) : QTreeWidgetItem( theListView ) { setText( 0, theString ); diff --git a/src/app/legend/qgslegendlayer.cpp b/src/app/legend/qgslegendlayer.cpp index 71fdde56002..7748424751b 100644 --- a/src/app/legend/qgslegendlayer.cpp +++ b/src/app/legend/qgslegendlayer.cpp @@ -594,7 +594,6 @@ void QgsLegendLayer::updateItemListCountV2( SymbologyList& itemList, QgsVectorLa QgsLegendSymbolList symbolList = renderer->legendSymbolItems(); QgsLegendSymbolList::const_iterator symbolIt = symbolList.constBegin(); - symbolIt = symbolList.constBegin(); for ( ; symbolIt != symbolList.constEnd(); ++symbolIt ) { itemList.push_back( qMakePair( symbolIt->first + " [" + QString::number( layer->featureCount( symbolIt->second ) ) + "]", itemMap[symbolIt->first] ) ); diff --git a/src/app/pluginmanager/qgspluginmanager.cpp b/src/app/pluginmanager/qgspluginmanager.cpp index 0bc85eec9cf..64f8829367b 100644 --- a/src/app/pluginmanager/qgspluginmanager.cpp +++ b/src/app/pluginmanager/qgspluginmanager.cpp @@ -464,7 +464,7 @@ void QgsPluginManager::reloadModelData() for ( QMap >::iterator it = mPlugins.begin(); it != mPlugins.end(); - it++ ) + ++it ) { if ( ! it->value( "id" ).isEmpty() ) { @@ -1244,7 +1244,7 @@ bool QgsPluginManager::hasAvailablePlugins( ) { for ( QMap >::iterator it = mPlugins.begin(); it != mPlugins.end(); - it++ ) + ++it ) { if ( it->value( "status" ) == "not installed" || it->value( "status" ) == "new" ) { @@ -1261,7 +1261,7 @@ bool QgsPluginManager::hasReinstallablePlugins( ) { for ( QMap >::iterator it = mPlugins.begin(); it != mPlugins.end(); - it++ ) + ++it ) { // plugins marked as "installed" are available for download (otherwise they are marked "orphans") if ( it->value( "status" ) == "installed" ) @@ -1279,7 +1279,7 @@ bool QgsPluginManager::hasUpgradeablePlugins( ) { for ( QMap >::iterator it = mPlugins.begin(); it != mPlugins.end(); - it++ ) + ++it ) { if ( it->value( "status" ) == "upgradeable" ) { @@ -1296,7 +1296,7 @@ bool QgsPluginManager::hasNewPlugins( ) { for ( QMap >::iterator it = mPlugins.begin(); it != mPlugins.end(); - it++ ) + ++it ) { if ( it->value( "status" ) == "new" ) { @@ -1313,7 +1313,7 @@ bool QgsPluginManager::hasNewerPlugins( ) { for ( QMap >::iterator it = mPlugins.begin(); it != mPlugins.end(); - it++ ) + ++it ) { if ( it->value( "status" ) == "newer" ) { @@ -1330,7 +1330,7 @@ bool QgsPluginManager::hasInvalidPlugins( ) { for ( QMap >::iterator it = mPlugins.begin(); it != mPlugins.end(); - it++ ) + ++it ) { if ( ! it->value( "error" ).isEmpty() ) { diff --git a/src/app/qgisapp.cpp b/src/app/qgisapp.cpp index e4645a1fadb..83d69d9dada 100644 --- a/src/app/qgisapp.cpp +++ b/src/app/qgisapp.cpp @@ -269,6 +269,11 @@ // Conditional Includes // #ifdef HAVE_PGCONFIG +#undef PACKAGE_BUGREPORT +#undef PACKAGE_NAME +#undef PACKAGE_STRING +#undef PACKAGE_TARNAME +#undef PACKAGE_VERSION #include #else #define PG_VERSION "unknown" @@ -860,7 +865,7 @@ void QgisApp::dropEvent( QDropEvent *event ) // get the file list QList::iterator i; QListurls = event->mimeData()->urls(); - for ( i = urls.begin(); i != urls.end(); i++ ) + for ( i = urls.begin(); i != urls.end(); ++i ) { QString fileName = i->toLocalFile(); // seems that some drag and drop operations include an empty url @@ -2480,7 +2485,7 @@ void QgisApp::addVectorLayer() } -bool QgisApp::addVectorLayers( QStringList const & theLayerQStringList, const QString& enc, const QString dataSourceType ) +bool QgisApp::addVectorLayers( const QStringList &theLayerQStringList, const QString &enc, const QString &dataSourceType ) { bool wasfrozen = mMapCanvas->isFrozen(); QList myList; @@ -4775,7 +4780,7 @@ void QgisApp::checkForDeprecatedLabelsInProject() { bool depLabelsUsed = false; QMap layers = QgsMapLayerRegistry::instance()->mapLayers(); - for ( QMap::iterator it = layers.begin(); it != layers.end(); it++ ) + for ( QMap::iterator it = layers.begin(); it != layers.end(); ++it ) { QgsVectorLayer *vl = qobject_cast( it.value() ); if ( !vl ) @@ -4954,8 +4959,12 @@ QgsGeometry* QgisApp::unionGeometries( const QgsVectorLayer* vl, QgsFeatureList& //convert unionGeom to a multipart geometry in case it is necessary to match the layer type QGis::WkbType t = vl->wkbType(); - bool layerIsMultiType = ( t == QGis::WKBMultiPoint || t == QGis::WKBMultiPoint25D || t == QGis::WKBMultiLineString - || t == QGis::WKBMultiLineString25D || t == QGis::WKBMultiPolygon || t == QGis::WKBMultiPoint25D ); + bool layerIsMultiType = ( t == QGis::WKBMultiPoint || + t == QGis::WKBMultiPoint25D || + t == QGis::WKBMultiLineString || + t == QGis::WKBMultiLineString25D || + t == QGis::WKBMultiPolygon || + t == QGis::WKBMultiPolygon25D ); if ( layerIsMultiType && !unionGeom->isMultipart() ) { unionGeom->convertToMultiType(); @@ -5557,7 +5566,7 @@ void QgisApp::deselectAll() mMapCanvas->setRenderFlag( false ); QMap layers = QgsMapLayerRegistry::instance()->mapLayers(); - for ( QMap::iterator it = layers.begin(); it != layers.end(); it++ ) + for ( QMap::iterator it = layers.begin(); it != layers.end(); ++it ) { QgsVectorLayer *vl = qobject_cast( it.value() ); if ( !vl ) @@ -7369,7 +7378,7 @@ bool QgisApp::saveDirty() if ( QgsMapLayerRegistry::instance()->count() > 0 ) { QMap layers = QgsMapLayerRegistry::instance()->mapLayers(); - for ( QMap::iterator it = layers.begin(); it != layers.end(); it++ ) + for ( QMap::iterator it = layers.begin(); it != layers.end(); ++it ) { QgsVectorLayer *vl = qobject_cast( it.value() ); if ( !vl ) @@ -8351,7 +8360,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer ) bool enableMove = false, enableRotate = false, enablePin = false, enableShowHide = false, enableChange = false; QMap layers = QgsMapLayerRegistry::instance()->mapLayers(); - for ( QMap::iterator it = layers.begin(); it != layers.end(); it++ ) + for ( QMap::iterator it = layers.begin(); it != layers.end(); ++it ) { QgsVectorLayer *vlayer = qobject_cast( it.value() ); if ( !vlayer || !vlayer->isEditable() || diff --git a/src/app/qgisapp.h b/src/app/qgisapp.h index c28c081ca5d..c7d9728159a 100644 --- a/src/app/qgisapp.h +++ b/src/app/qgisapp.h @@ -129,21 +129,21 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow @param dataSourceType type of ogr datasource @returns true if successfully added layer */ - bool addVectorLayers( QStringList const & theLayerQStringList, const QString& enc, const QString dataSourceType ); + bool addVectorLayers( const QStringList &theLayerQStringList, const QString &enc, const QString &dataSourceType ); /** overloaded vesion of the private addRasterLayer() Method that takes a list of file names instead of prompting user with a dialog. @returns true if successfully added layer(s) */ - bool addRasterLayers( QStringList const & theLayerQStringList, bool guiWarning = true ); + bool addRasterLayers( const QStringList &theLayerQStringList, bool guiWarning = true ); /** open a raster layer for the given file @returns false if unable to open a raster layer for rasterFile @note This is essentially a simplified version of the above */ - QgsRasterLayer* addRasterLayer( QString const & rasterFile, QString const & baseName, bool guiWarning = true ); + QgsRasterLayer *addRasterLayer( const QString &rasterFile, const QString &baseName, bool guiWarning = true ); /** Add a 'pre-made' map layer to the project */ void addMapLayer( QgsMapLayer *theMapLayer ); diff --git a/src/app/qgsattributetypedialog.cpp b/src/app/qgsattributetypedialog.cpp index c2be3532071..e35f4b3c21e 100644 --- a/src/app/qgsattributetypedialog.cpp +++ b/src/app/qgsattributetypedialog.cpp @@ -335,7 +335,7 @@ void QgsAttributeTypeDialog::updateMap( const QMap &map, bool ++row; } - for ( QMap::const_iterator mit = map.begin(); mit != map.end(); mit++, row++ ) + for ( QMap::const_iterator mit = map.begin(); mit != map.end(); ++mit, row++ ) { tableWidget->insertRow( row ); if ( mit.value().isNull() ) @@ -533,7 +533,7 @@ void QgsAttributeTypeDialog::setIndex( int index, QgsVectorLayer::EditType editT } int row = 0; - for ( QMap::iterator mit = mValueMap.begin(); mit != mValueMap.end(); mit++, row++ ) + for ( QMap::iterator mit = mValueMap.begin(); mit != mValueMap.end(); ++mit, row++ ) { tableWidget->insertRow( row ); if ( mit.value().isNull() ) diff --git a/src/app/qgsattributetypeloaddialog.cpp b/src/app/qgsattributetypeloaddialog.cpp index 2b49f261a17..c8dc2efca90 100644 --- a/src/app/qgsattributetypeloaddialog.cpp +++ b/src/app/qgsattributetypeloaddialog.cpp @@ -97,7 +97,7 @@ void QgsAttributeTypeLoadDialog::fillComboBoxes( int layerIndex ) } QMap fieldMap = vLayer->dataProvider()->fieldNameMap(); QMap::iterator it = fieldMap.begin(); - for ( ; it != fieldMap.end(); it++ ) + for ( ; it != fieldMap.end(); ++it ) { keyComboBox->addItem( it.key(), it.value() ); valueComboBox->addItem( it.key(), it.value() ); @@ -148,7 +148,7 @@ void QgsAttributeTypeLoadDialog::createPreview( int fieldIndex, bool full ) break; //just first entries all on button } int row = 0; - for ( QMap::iterator mit = valueMap.begin(); mit != valueMap.end(); mit++, row++ ) + for ( QMap::iterator mit = valueMap.begin(); mit != valueMap.end(); ++mit, row++ ) { previewTableWidget->insertRow( row ); previewTableWidget->setItem( row, 0, new QTableWidgetItem( mit.value().toString() ) ); diff --git a/src/app/qgsdecorationnortharrow.cpp b/src/app/qgsdecorationnortharrow.cpp index 2cae961c55c..213c614f4e4 100644 --- a/src/app/qgsdecorationnortharrow.cpp +++ b/src/app/qgsdecorationnortharrow.cpp @@ -103,23 +103,12 @@ void QgsDecorationNorthArrow::render( QPainter * theQPainter ) //Large IF statement controlled by enable check box if ( enabled() ) { - if ( theQPainter->isActive() ) - { - //QgsDebugMsg("Rendering north arrow on active painter"); - } - else - { - //QgsDebugMsg("Rendering north arrow on INactive painter!!!"); - } - QPixmap myQPixmap; //to store the north arrow image in QString myFileNameQString = ":/images/north_arrows/default.png"; - //QgsDebugMsg("Trying to load " + myFileNameQString); if ( myQPixmap.load( myFileNameQString ) ) { - double centerXDouble = myQPixmap.width() / 2; double centerYDouble = myQPixmap.height() / 2; //save the current canvas rotation diff --git a/src/app/qgsdecorationscalebar.cpp b/src/app/qgsdecorationscalebar.cpp index 18792178a80..168b9f37903 100644 --- a/src/app/qgsdecorationscalebar.cpp +++ b/src/app/qgsdecorationscalebar.cpp @@ -465,8 +465,6 @@ void QgsDecorationScaleBar::render( QPainter * theQPainter ) //Draw unit label // theQPainter->setPen( myBackColor ); - myFontWidth = myFontMetrics.width( myScaleBarUnitLabel ); - myFontHeight = myFontMetrics.height(); //first the buffer for ( int i = 0 - myBufferSize; i <= myBufferSize; i++ ) { diff --git a/src/app/qgsidentifyresultsdialog.cpp b/src/app/qgsidentifyresultsdialog.cpp index 74486e45c7e..2db3fd67019 100644 --- a/src/app/qgsidentifyresultsdialog.cpp +++ b/src/app/qgsidentifyresultsdialog.cpp @@ -412,7 +412,7 @@ void QgsIdentifyResultsDialog::addFeature( QgsVectorLayer *vlayer, const QgsFeat derivedItem->setData( 0, Qt::UserRole, "derived" ); featItem->addChild( derivedItem ); - for ( QMap< QString, QString>::const_iterator it = derivedAttributes.begin(); it != derivedAttributes.end(); it++ ) + for ( QMap< QString, QString>::const_iterator it = derivedAttributes.begin(); it != derivedAttributes.end(); ++it ) { derivedItem->addChild( new QTreeWidgetItem( QStringList() << it.key() << it.value() ) ); } @@ -541,7 +541,7 @@ void QgsIdentifyResultsDialog::addFeature( QgsRasterLayer *layer, } else { - for ( QMap::const_iterator it = attributes.begin(); it != attributes.end(); it++ ) + for ( QMap::const_iterator it = attributes.begin(); it != attributes.end(); ++it ) { featItem->addChild( new QTreeWidgetItem( QStringList() << it.key() << it.value() ) ); } @@ -553,7 +553,7 @@ void QgsIdentifyResultsDialog::addFeature( QgsRasterLayer *layer, derivedItem->setData( 0, Qt::UserRole, "derived" ); featItem->addChild( derivedItem ); - for ( QMap< QString, QString>::const_iterator it = derivedAttributes.begin(); it != derivedAttributes.end(); it++ ) + for ( QMap< QString, QString>::const_iterator it = derivedAttributes.begin(); it != derivedAttributes.end(); ++it ) { derivedItem->addChild( new QTreeWidgetItem( QStringList() << it.key() << it.value() ) ); } @@ -1186,25 +1186,24 @@ void QgsIdentifyResultsDialog::zoomToFeature() { QTreeWidgetItem *item = lstResults->currentItem(); - QgsMapLayer *layer; QgsVectorLayer *vlayer = vectorLayer( item ); QgsRasterLayer *rlayer = rasterLayer( item ); if ( !vlayer && !rlayer ) return; - layer = vlayer ? ( QgsMapLayer * )vlayer : ( QgsMapLayer * )rlayer; + QgsMapLayer *layer; + if ( vlayer ) + layer = vlayer; + else + layer = rlayer; QgsIdentifyResultsFeatureItem *featItem = dynamic_cast( featureItem( item ) ); if ( !featItem ) - { return; - } QgsFeature feat = featItem->feature(); if ( !feat.geometry() ) - { return; - } // TODO: verify CRS for raster WMS features QgsRectangle rect = mCanvas->mapRenderer()->layerExtentToOutputExtent( layer, feat.geometry()->boundingBox() ); @@ -1332,10 +1331,11 @@ void QgsIdentifyResultsDialog::copyFeatureAttributes() QgsVectorLayer *vlayer = vectorLayer( lstResults->currentItem() ); QgsRasterLayer *rlayer = rasterLayer( lstResults->currentItem() ); - if ( !vlayer & !rlayer ) + if ( !vlayer && !rlayer ) { return; } + if ( vlayer ) { int idx; @@ -1344,7 +1344,7 @@ void QgsIdentifyResultsDialog::copyFeatureAttributes() const QgsFields &fields = vlayer->pendingFields(); - for ( QgsAttributeMap::const_iterator it = attributes.begin(); it != attributes.end(); it++ ) + for ( QgsAttributeMap::const_iterator it = attributes.begin(); it != attributes.end(); ++it ) { int attrIdx = it.key(); if ( attrIdx < 0 || attrIdx >= fields.count() ) diff --git a/src/app/qgslabelinggui.cpp b/src/app/qgslabelinggui.cpp index 3d670b354b5..2e12566b4d7 100644 --- a/src/app/qgslabelinggui.cpp +++ b/src/app/qgslabelinggui.cpp @@ -1585,9 +1585,7 @@ void QgsLabelingGui::on_mPreviewBackgroundBtn_colorChanged( const QColor &color void QgsLabelingGui::on_mDirectSymbLeftToolBtn_clicked() { bool gotChar = false; - QChar dirSymb = QChar(); - - dirSymb = mCharDlg->selectCharacter( &gotChar, mRefFont, mFontDB.styleString( mRefFont ) ); + QChar dirSymb = mCharDlg->selectCharacter( &gotChar, mRefFont, mFontDB.styleString( mRefFont ) ); if ( !gotChar ) return; @@ -1599,9 +1597,7 @@ void QgsLabelingGui::on_mDirectSymbLeftToolBtn_clicked() void QgsLabelingGui::on_mDirectSymbRightToolBtn_clicked() { bool gotChar = false; - QChar dirSymb = QChar(); - - dirSymb = mCharDlg->selectCharacter( &gotChar, mRefFont, mFontDB.styleString( mRefFont ) ); + QChar dirSymb = mCharDlg->selectCharacter( &gotChar, mRefFont, mFontDB.styleString( mRefFont ) ); if ( !gotChar ) return; diff --git a/src/app/qgsmaptoollabel.cpp b/src/app/qgsmaptoollabel.cpp index 7f70b26029c..b1589eeddd6 100644 --- a/src/app/qgsmaptoollabel.cpp +++ b/src/app/qgsmaptoollabel.cpp @@ -409,7 +409,6 @@ bool QgsMapToolLabel::rotationPoint( QgsPoint& pos, bool ignoreUpsideDown, bool } else if ( valiString.compare( "Half", Qt::CaseInsensitive ) == 0 ) { - ydiff = labelSizeY * descentRatio; ydiff = labelSizeY * 0.5 * ( 1 - descentRatio ); } } diff --git a/src/app/qgsmaptoolpinlabels.cpp b/src/app/qgsmaptoolpinlabels.cpp index 6e08acf96e4..7a10b9661a2 100644 --- a/src/app/qgsmaptoolpinlabels.cpp +++ b/src/app/qgsmaptoolpinlabels.cpp @@ -419,10 +419,12 @@ bool QgsMapToolPinLabels::pinUnpinLabel( QgsVectorLayer* vlayer, vlayer->beginEditCommand( tr( "Pinned label" ) + QString( " '%1'" ).arg( labelText ) ); writeFailed = !vlayer->changeAttributeValue( fid, xCol, labelX, true ); - writeFailed = !vlayer->changeAttributeValue( fid, yCol, labelY, true ); + if ( !vlayer->changeAttributeValue( fid, yCol, labelY, true ) ) + writeFailed = true; if ( hasRCol && !preserveRot ) { - writeFailed = !vlayer->changeAttributeValue( fid, rCol, labelR, true ); + if ( !vlayer->changeAttributeValue( fid, rCol, labelR, true ) ) + writeFailed = true; } vlayer->endEditCommand(); } @@ -430,10 +432,12 @@ bool QgsMapToolPinLabels::pinUnpinLabel( QgsVectorLayer* vlayer, { vlayer->beginEditCommand( tr( "Unpinned label" ) + QString( " '%1'" ).arg( labelText ) ); writeFailed = !vlayer->changeAttributeValue( fid, xCol, QVariant( QString::null ), true ); - writeFailed = !vlayer->changeAttributeValue( fid, yCol, QVariant( QString::null ), true ); + if ( !vlayer->changeAttributeValue( fid, yCol, QVariant( QString::null ), true ) ) + writeFailed = true; if ( hasRCol && !preserveRot ) { - writeFailed = !vlayer->changeAttributeValue( fid, rCol, QVariant( QString::null ), true ); + if ( !vlayer->changeAttributeValue( fid, rCol, QVariant( QString::null ), true ) ) + writeFailed = true; } vlayer->endEditCommand(); } diff --git a/src/app/qgsmaptoolselectutils.cpp b/src/app/qgsmaptoolselectutils.cpp index 7e1b785b8d7..19ba902d8b0 100644 --- a/src/app/qgsmaptoolselectutils.cpp +++ b/src/app/qgsmaptoolselectutils.cpp @@ -64,7 +64,7 @@ void QgsMapToolSelectUtils::setRubberBand( QgsMapCanvas* canvas, QRect& selectRe void QgsMapToolSelectUtils::expandSelectRectangle( QRect& selectRect, QgsVectorLayer* vlayer, - QPoint point ) + const QPoint &point ) { int boxSize = 0; if ( vlayer->geometryType() != QGis::Polygon ) diff --git a/src/app/qgsmaptoolselectutils.h b/src/app/qgsmaptoolselectutils.h index d04c3831b1a..08a06026560 100644 --- a/src/app/qgsmaptoolselectutils.h +++ b/src/app/qgsmaptoolselectutils.h @@ -73,7 +73,7 @@ namespace QgsMapToolSelectUtils @param vlayer The vector layer layer @param vlayer The point to expand the rectangle around */ - void expandSelectRectangle( QRect& selectRect, QgsVectorLayer* vlayer, const QPoint point ); + void expandSelectRectangle( QRect& selectRect, QgsVectorLayer* vlayer, const QPoint &point ); /** Sets a QgsRubberband to rectangle in map units using a rectangle defined in device coords diff --git a/src/app/qgspluginregistry.cpp b/src/app/qgspluginregistry.cpp index 44528d309d5..9ba4e481788 100644 --- a/src/app/qgspluginregistry.cpp +++ b/src/app/qgspluginregistry.cpp @@ -127,7 +127,7 @@ void QgsPluginRegistry::dump() QgsDebugMsg( "PLUGINS IN REGISTRY: key -> (name, library)" ); for ( QMap::iterator it = mPlugins.begin(); it != mPlugins.end(); - it++ ) + ++it ) { QgsDebugMsg( QString( "PLUGIN: %1 -> (%2, %3)" ) .arg( it.key() ) @@ -162,7 +162,7 @@ void QgsPluginRegistry::unloadAll() { for ( QMap::iterator it = mPlugins.begin(); it != mPlugins.end(); - it++ ) + ++it ) { if ( it->plugin() ) { @@ -237,15 +237,6 @@ bool QgsPluginRegistry::checkQgisVersion( QString minVersion, QString maxVersion // our qgis version - cut release name after version number QString qgisVersion = QString( QGis::QGIS_VERSION ).section( '-', 0, 0 ); - // ///////////////////////////////////////////////////////////////////////////// - // TEMPORARY WORKAROUND UNTIL VERSION NUMBER IS GLOBALY SWITCHED TO 2.0 // - // ///////////////////////////////////////////////////////////////////////////// - // ////////////////////////////////// - qgisVersion = "2.0.0"; ////////////////////////////////// - // ////////////////////////////////// - // ///////////////////////////////////////////////////////////////////////////// - // ///////////////////////////////////////////////////////////////////////////// - QStringList qgisVersionParts = qgisVersion.split( "." ); int qgisMajor = qgisVersionParts.at( 0 ).toInt(); diff --git a/src/app/qgsprojectproperties.cpp b/src/app/qgsprojectproperties.cpp index a5fd5279e17..cc4cde686b5 100644 --- a/src/app/qgsprojectproperties.cpp +++ b/src/app/qgsprojectproperties.cpp @@ -224,7 +224,7 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa twIdentifyLayers->verticalHeader()->setResizeMode( QHeaderView::ResizeToContents ); int i = 0; - for ( QMap::const_iterator it = mapLayers.constBegin(); it != mapLayers.constEnd(); it++, i++ ) + for ( QMap::const_iterator it = mapLayers.constBegin(); it != mapLayers.constEnd(); ++it, i++ ) { currentLayer = it.value(); @@ -373,7 +373,7 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa i = 0; int j = 0; - for ( QMap::const_iterator it = mapLayers.constBegin(); it != mapLayers.constEnd(); it++, i++ ) + for ( QMap::const_iterator it = mapLayers.constBegin(); it != mapLayers.constEnd(); ++it, i++ ) { currentLayer = it.value(); if ( currentLayer->type() == QgsMapLayer::VectorLayer ) @@ -1044,7 +1044,7 @@ void QgsProjectProperties::on_pbnWMSSetUsedSRS_clicked() } const QMap &mapLayers = QgsMapLayerRegistry::instance()->mapLayers(); - for ( QMap::const_iterator it = mapLayers.constBegin(); it != mapLayers.constEnd(); it++ ) + for ( QMap::const_iterator it = mapLayers.constBegin(); it != mapLayers.constEnd(); ++it ) { crsList << it.value()->crs().authid(); } diff --git a/src/core/composer/qgscomposereffect.cpp b/src/core/composer/qgscomposereffect.cpp index 99a8a45e052..96598e5db3b 100644 --- a/src/core/composer/qgscomposereffect.cpp +++ b/src/core/composer/qgscomposereffect.cpp @@ -60,7 +60,7 @@ void QgsComposerEffect::draw( QPainter *painter ) } -void QgsComposerEffect::setCompositionMode( const QPainter::CompositionMode compositionMode ) +void QgsComposerEffect::setCompositionMode( const QPainter::CompositionMode &compositionMode ) { mCompositionMode = compositionMode; diff --git a/src/core/composer/qgscomposereffect.h b/src/core/composer/qgscomposereffect.h index d27934ba593..a257f5dc2e7 100644 --- a/src/core/composer/qgscomposereffect.h +++ b/src/core/composer/qgscomposereffect.h @@ -29,7 +29,7 @@ class CORE_EXPORT QgsComposerEffect : public QGraphicsEffect QgsComposerEffect(); ~QgsComposerEffect(); - void setCompositionMode( const QPainter::CompositionMode compositionMode ); + void setCompositionMode( const QPainter::CompositionMode &compositionMode ); protected: /** Called whenever source needs to be drawn */ diff --git a/src/core/composer/qgscomposeritem.cpp b/src/core/composer/qgscomposeritem.cpp index 933f571f7f5..1b677051367 100644 --- a/src/core/composer/qgscomposeritem.cpp +++ b/src/core/composer/qgscomposeritem.cpp @@ -767,7 +767,7 @@ QRectF QgsComposerItem::largestRotatedRectWithinBounds( QRectF originalRect, QRe { return QRectF(( boundsWidth - rectScaledWidth ) / 2.0, ( boundsHeight - rectScaledHeight ) / 2.0, rectScaledWidth, rectScaledHeight ); } - else if ( rotation == 0 || rotation == 180 ) + else { return QRectF(( boundsWidth - rectScaledHeight ) / 2.0, ( boundsHeight - rectScaledWidth ) / 2.0, rectScaledHeight, rectScaledWidth ); } diff --git a/src/core/composer/qgscomposermap.cpp b/src/core/composer/qgscomposermap.cpp index c831937aa9d..d1ce0c5c805 100644 --- a/src/core/composer/qgscomposermap.cpp +++ b/src/core/composer/qgscomposermap.cpp @@ -347,12 +347,6 @@ void QgsComposerMap::paint( QPainter* painter, const QStyleOptionGraphicsItem* i QgsRectangle cExtent = *currentMapExtent(); - double horizontalVScaleFactor = horizontalViewScaleFactor(); - if ( horizontalVScaleFactor < 0 ) - { - horizontalVScaleFactor = mLastValidViewScaleFactor; - } - double imagePixelWidth = cExtent.width() / requestRectangle.width() * mCacheImage.width() ; //how many pixels of the image are for the map extent? double scale = rect().width() / imagePixelWidth; QgsPoint rotationPoint = QgsPoint(( cExtent.xMaximum() + cExtent.xMinimum() ) / 2.0, ( cExtent.yMaximum() + cExtent.yMinimum() ) / 2.0 ); diff --git a/src/core/dxf/qgsdxfexport.cpp b/src/core/dxf/qgsdxfexport.cpp index 8f183434644..629577c81b1 100644 --- a/src/core/dxf/qgsdxfexport.cpp +++ b/src/core/dxf/qgsdxfexport.cpp @@ -503,7 +503,7 @@ void QgsDxfExport::writeBlocks() if ( hasDataDefinedProperties( ml, slIt->second ) ) { continue; - ml->stopRender( ctx ); + // ml->stopRender( ctx ); } writeGroup( 0, "BLOCK" ); writeGroup( 8, 0 ); @@ -513,8 +513,8 @@ void QgsDxfExport::writeBlocks() //x/y/z coordinates of reference point //todo: consider anchor point - double size = ml->size(); - size *= mapUnitScaleFactor( mSymbologyScaleDenominator, ml->sizeUnit(), mMapUnits ); + // double size = ml->size(); + // size *= mapUnitScaleFactor( mSymbologyScaleDenominator, ml->sizeUnit(), mMapUnits ); writeGroup( 10, 0 ); writeGroup( 20, 0 ); writeGroup( 30, 0 ); @@ -1112,14 +1112,14 @@ double QgsDxfExport::mapUnitScaleFactor( double scaleDenominator, QgsSymbolV2::O { return 1.0; } + else if ( symbolUnits == QgsSymbolV2::MM && mapUnits == QGis::Meters ) + { + return scaleDenominator / 1000; + } else { - if ( symbolUnits == QgsSymbolV2::MM && mapUnits == QGis::Meters ) - { - return scaleDenominator / 1000; - } + return 1.0; } - return 1.0; } QList< QPair< QgsSymbolLayerV2*, QgsSymbolV2* > > QgsDxfExport::symbolLayers() diff --git a/src/core/pal/feature.cpp b/src/core/pal/feature.cpp index 30f016abda1..e830b832e97 100644 --- a/src/core/pal/feature.cpp +++ b/src/core/pal/feature.cpp @@ -483,7 +483,7 @@ namespace pal if ( nbp == 1 ) cost = 0.0001; else - cost = 0.0001 + 0.0020 * double( icost ) / double( nbp - 1 ); + cost = 0.0001 + 0.0020 * double( icost ) / double( nbp - 1 ); ( *lPos )[i] = new LabelPosition( i, lx, ly, xrm, yrm, angle, cost, this ); @@ -892,7 +892,6 @@ namespace pal { orientation = -orientation; delete slp; - slp = NULL; slp = curvedPlacementAtOffset( path_positions, path_distances, orientation, initial_index, initial_distance ); } else diff --git a/src/core/pal/pal.cpp b/src/core/pal/pal.cpp index 8fd0a394cef..5e790fa3351 100644 --- a/src/core/pal/pal.cpp +++ b/src/core/pal/pal.cpp @@ -125,7 +125,7 @@ namespace pal Layer *Pal::getLayer( const char *lyrName ) { lyrsMutex->lock(); - for ( QList::iterator it = layers->begin(); it != layers->end(); it++ ) + for ( QList::iterator it = layers->begin(); it != layers->end(); ++it ) if ( strcmp(( *it )->name, lyrName ) == 0 ) { lyrsMutex->unlock(); @@ -178,7 +178,7 @@ namespace pal std::cout << "nbLayers:" << layers->size() << std::endl; #endif - for ( QList::iterator it = layers->begin(); it != layers->end(); it++ ) + for ( QList::iterator it = layers->begin(); it != layers->end(); ++it ) { if ( strcmp(( *it )->name, lyrName ) == 0 ) // if layer already known { @@ -408,7 +408,7 @@ namespace pal lyrsMutex->lock(); for ( i = 0; i < nbLayers; i++ ) { - for ( QList::iterator it = layers->begin(); it != layers->end(); it++ ) // iterate on pal->layers + for ( QList::iterator it = layers->begin(); it != layers->end(); ++it ) // iterate on pal->layers { layer = *it; // Only select those who are active and labellable (with scale constraint) or those who are active and which must be treated as obstaclewhich must be treated as obstacle @@ -643,7 +643,7 @@ namespace pal double *priorities = new double[nbLayers]; Layer *layer; i = 0; - for ( QList::iterator it = layers->begin(); it != layers->end(); it++ ) + for ( QList::iterator it = layers->begin(); it != layers->end(); ++it ) { layer = *it; layersName[i] = layer->name; @@ -808,7 +808,7 @@ namespace pal double *priorities = new double[nbLayers]; Layer *layer; int i = 0; - for ( QList::iterator it = layers->begin(); it != layers->end(); it++ ) + for ( QList::iterator it = layers->begin(); it != layers->end(); ++it ) { layer = *it; layersName[i] = layer->name; diff --git a/src/core/pal/problem.cpp b/src/core/pal/problem.cpp index aa719e3a733..6a98ae35421 100644 --- a/src/core/pal/problem.cpp +++ b/src/core/pal/problem.cpp @@ -177,7 +177,6 @@ namespace pal double amin[2]; double amax[2]; - LabelPosition *lp; LabelPosition *lp2; while ( run ) @@ -190,7 +189,7 @@ namespace pal { if ( !ok[featStartId[i] + j] ) { - if (( lp = labelpositions[featStartId[i] + j] )->getNumOverlaps() == 0 ) // if candidate has no overlap + if ( labelpositions[featStartId[i] + j]->getNumOverlaps() == 0 ) // if candidate has no overlap { run = true; ok[featStartId[i] + j] = true; @@ -212,7 +211,6 @@ namespace pal lp2->removeFromIndex( candidates ); } - //lp->removeFromIndex(candidates); featNbLp[i] = j + 1; break; } @@ -455,7 +453,9 @@ namespace pal SubPart *current = NULL; +#if _VERBOSE_ int subPartTotalSize = 0; +#endif labelPositionCost = new double[all_nblp]; nbOlap = new int[all_nblp]; @@ -472,7 +472,9 @@ namespace pal for ( i = 0; i < nbft; i++ ) { parts[i] = subPart( r, i, isIn ); +#if _VERBOSE_ subPartTotalSize += parts[i]->subSize; +#endif ok[i] = false; } delete[] isIn; @@ -605,7 +607,9 @@ namespace pal search_time = clock(); std::cout << " Improved solution: " << ( double )( search_time - start_time ) / ( double ) CLOCKS_PER_SEC << " (solution cost: " << sol->cost << ", nbDisplayed: " << nbActive << " (" << ( double ) nbActive / ( double ) nbft << ")" << std::endl; +#if _VERBOSE_ std::cerr << "\t" << subPartTotalSize; +#endif if ( searchMethod == POPMUSIC_TABU ) std::cerr << "\tpop_tabu\t"; else if ( searchMethod == POPMUSIC_TABU_CHAIN ) @@ -970,8 +974,6 @@ namespace pal itwImp = probSize * pal->tabuMinIt; stop_it = itwImp; - max_it = probSize * pal->tabuMaxIt; - cur_cost = 0.0; nbOverlap = 0; @@ -1983,7 +1985,7 @@ namespace pal double cur_cost = 0; double best_cost = 0; - int nbOverlap = 0; + // int nbOverlap = 0; int seed; @@ -2008,7 +2010,7 @@ namespace pal for ( i = 0; i < subSize; i++ ) { cur_cost += compute_feature_cost( part, i, sol[i], &featOv ); - nbOverlap += featOv; + // nbOverlap += featOv; } initial_cost = cur_cost; @@ -2140,7 +2142,7 @@ namespace pal double cur_cost = 0; double best_cost = 0; - int nbOverlap = 0; + // int nbOverlap = 0; int seed; @@ -2149,9 +2151,6 @@ namespace pal int lid; int fid; - int *tmpsol = new int[subSize]; - - int *tabu_list = new int[subSize]; Chain *retainedChain = NULL; @@ -2176,7 +2175,7 @@ namespace pal for ( i = 0; i < subSize; i++ ) { cur_cost += compute_feature_cost( part, i, sol[i], &featOv ); - nbOverlap += featOv; + // nbOverlap += featOv; } initial_cost = cur_cost; @@ -2375,7 +2374,6 @@ namespace pal featWrap[sub[i]] = -1; delete[] best_sol; - delete[] tmpsol; delete[] tabu_list; @@ -2393,8 +2391,6 @@ namespace pal void Problem::check_solution() { - - LabelPosition *lp; int *solution = new int[nbft]; double amin[2]; @@ -2427,7 +2423,7 @@ namespace pal while ( list->size() > 0 ) { - lp = list->pop_front(); + LabelPosition *lp = list->pop_front(); int probFeatId = lp->getProblemFeatureId(); if ( solution[probFeatId] >= 0 ) { @@ -2447,6 +2443,8 @@ namespace pal std::cerr << "Feat " << i << " : " << solution[i] << "<-->" << sol->s[i] << std::endl; } } + + delete [] solution; } typedef struct _nokContext diff --git a/src/core/qgsapplication.cpp b/src/core/qgsapplication.cpp index 9a6e7948f27..513c9a2eeb4 100644 --- a/src/core/qgsapplication.cpp +++ b/src/core/qgsapplication.cpp @@ -261,7 +261,7 @@ void QgsApplication::setFileOpenEventReceiver( QObject * receiver ) } } -void QgsApplication::setPrefixPath( const QString thePrefixPath, bool useDefaultPaths ) +void QgsApplication::setPrefixPath( const QString &thePrefixPath, bool useDefaultPaths ) { ABISYM( mPrefixPath ) = thePrefixPath; #if defined(_MSC_VER) @@ -279,12 +279,12 @@ void QgsApplication::setPrefixPath( const QString thePrefixPath, bool useDefault ABISYM( mLibexecPath ) = ABISYM( mPrefixPath ) + "/" + QGIS_LIBEXEC_SUBDIR + "/"; } -void QgsApplication::setPluginPath( const QString thePluginPath ) +void QgsApplication::setPluginPath( const QString &thePluginPath ) { ABISYM( mPluginPath ) = thePluginPath; } -void QgsApplication::setPkgDataPath( const QString thePkgDataPath ) +void QgsApplication::setPkgDataPath( const QString &thePkgDataPath ) { ABISYM( mPkgDataPath ) = thePkgDataPath; QString mySvgPath = thePkgDataPath + ( ABISYM( mRunningFromBuildDir ) ? "/images/svg/" : "/svg/" ); @@ -336,7 +336,7 @@ QString QgsApplication::iconPath( QString iconFile ) return defaultThemePath() + iconFile; } -QIcon QgsApplication::getThemeIcon( const QString theName ) +QIcon QgsApplication::getThemeIcon( const QString &theName ) { QString myPreferredPath = activeThemePath() + QDir::separator() + theName; QString myDefaultPath = defaultThemePath() + QDir::separator() + theName; @@ -357,7 +357,7 @@ QIcon QgsApplication::getThemeIcon( const QString theName ) } // TODO: add some caching mechanism ? -QPixmap QgsApplication::getThemePixmap( const QString theName ) +QPixmap QgsApplication::getThemePixmap( const QString &theName ) { QString myPreferredPath = activeThemePath() + QDir::separator() + theName; QString myDefaultPath = defaultThemePath() + QDir::separator() + theName; @@ -376,7 +376,7 @@ QPixmap QgsApplication::getThemePixmap( const QString theName ) /*! Set the theme path to the specified theme. */ -void QgsApplication::setThemeName( const QString theThemeName ) +void QgsApplication::setThemeName( const QString &theThemeName ) { QString myPath = ":/images/themes/" + theThemeName + "/"; //check it exists and if not roll back to default theme diff --git a/src/core/qgsapplication.h b/src/core/qgsapplication.h index 39863ecc420..be069a5c2c0 100644 --- a/src/core/qgsapplication.h +++ b/src/core/qgsapplication.h @@ -64,7 +64,7 @@ class CORE_EXPORT QgsApplication: public QApplication * based on the supplied theme name exists. If it does not the theme name will * be reverted to 'default'. */ - static void setThemeName( const QString theThemeName ); + static void setThemeName( const QString &theThemeName ); /** Set the active theme to the specified theme. * The theme name should be a single word e.g. 'default','classic'. @@ -157,12 +157,12 @@ class CORE_EXPORT QgsApplication: public QApplication //! Helper to get a theme icon. It will fall back to the //! default theme if the active theme does not have the required icon. //! @note Added in 2.0 - static QIcon getThemeIcon( const QString theName ); + static QIcon getThemeIcon( const QString &theName ); //! Helper to get a theme icon as a pixmap. It will fall back to the //! default theme if the active theme does not have the required icon. //! @note Added in 2.0 - static QPixmap getThemePixmap( const QString theName ); + static QPixmap getThemePixmap( const QString &theName ); //! Returns the path to user's style. Added in QGIS 1.4 static const QString userStyleV2Path(); @@ -179,13 +179,13 @@ class CORE_EXPORT QgsApplication: public QApplication static const QString libexecPath(); //! Alters prefix path - used by 3rd party apps - static void setPrefixPath( const QString thePrefixPath, bool useDefaultPaths = false ); + static void setPrefixPath( const QString &thePrefixPath, bool useDefaultPaths = false ); //! Alters plugin path - used by 3rd party apps - static void setPluginPath( const QString thePluginPath ); + static void setPluginPath( const QString &thePluginPath ); //! Alters pkg data path - used by 3rd party apps - static void setPkgDataPath( const QString thePkgDataPath ); + static void setPkgDataPath( const QString &thePkgDataPath ); //! Alters default svg paths - used by 3rd party apps. Added in QGIS 1.5 static void setDefaultSvgPaths( const QStringList& pathList ); diff --git a/src/core/qgsattributeaction.cpp b/src/core/qgsattributeaction.cpp index 3c8fb59d650..1d756cac486 100644 --- a/src/core/qgsattributeaction.cpp +++ b/src/core/qgsattributeaction.cpp @@ -149,7 +149,7 @@ QString QgsAttributeAction::expandAction( QString action, const QgsAttributeMap for ( int i = 0; i < 4; i++ ) { - for ( QgsAttributeMap::const_iterator it = attributes.begin(); it != attributes.end(); it++ ) + for ( QgsAttributeMap::const_iterator it = attributes.begin(); it != attributes.end(); ++it ) { int attrIdx = it.key(); if ( attrIdx < 0 || attrIdx >= fields.count() ) diff --git a/src/core/qgscoordinatereferencesystem.cpp b/src/core/qgscoordinatereferencesystem.cpp index 2612e849fc1..7fc0e74adb7 100644 --- a/src/core/qgscoordinatereferencesystem.cpp +++ b/src/core/qgscoordinatereferencesystem.cpp @@ -113,7 +113,7 @@ bool QgsCoordinateReferenceSystem::createFromId( const long theId, CrsType theTy return result; } -bool QgsCoordinateReferenceSystem::createFromString( const QString theDefinition ) +bool QgsCoordinateReferenceSystem::createFromString( const QString &theDefinition ) { bool result = false; QRegExp reCrsId( "^(epsg|postgis|internal)\\:(\\d+)$", Qt::CaseInsensitive ); @@ -157,7 +157,7 @@ bool QgsCoordinateReferenceSystem::createFromString( const QString theDefinition return result; } -bool QgsCoordinateReferenceSystem::createFromUserInput( const QString theDefinition ) +bool QgsCoordinateReferenceSystem::createFromUserInput( const QString &theDefinition ) { QString theWkt; char *wkt = NULL; @@ -416,7 +416,7 @@ bool QgsCoordinateReferenceSystem::axisInverted() const return mAxisInverted != 0; } -bool QgsCoordinateReferenceSystem::createFromWkt( QString theWkt ) +bool QgsCoordinateReferenceSystem::createFromWkt( const QString &theWkt ) { mIsValidFlag = false; mWkt.clear(); @@ -496,7 +496,7 @@ bool QgsCoordinateReferenceSystem::isValid() const return mIsValidFlag; } -bool QgsCoordinateReferenceSystem::createFromProj4( const QString theProj4String ) +bool QgsCoordinateReferenceSystem::createFromProj4( const QString &theProj4String ) { // // Examples: diff --git a/src/core/qgscoordinatereferencesystem.h b/src/core/qgscoordinatereferencesystem.h index 55e0daf42d9..736168e3296 100644 --- a/src/core/qgscoordinatereferencesystem.h +++ b/src/core/qgscoordinatereferencesystem.h @@ -116,7 +116,7 @@ class CORE_EXPORT QgsCoordinateReferenceSystem * @param theWkt The Wkt for the desired spatial reference system. * @return bool TRUE if success else false */ - bool createFromWkt( const QString theWkt ); + bool createFromWkt( const QString &theWkt ); /*! Set up this srs by fetching the appropriate information from the * sqlite backend. If the srsid is < 100000, only the system srs.db @@ -154,7 +154,7 @@ class CORE_EXPORT QgsCoordinateReferenceSystem * @param theProjString A proj4 format string * @return bool TRUE if success else false */ - bool createFromProj4( const QString theProjString ); + bool createFromProj4( const QString &theProjString ); /*! Set up this srs from a string definition, by default a WKT definition. Otherwise * the string defines a authority, followed by a colon, followed by the definition. @@ -163,7 +163,7 @@ class CORE_EXPORT QgsCoordinateReferenceSystem * uses the corresponding createFrom... function. * @param theDefinition A String containing a coordinate reference system definition. */ - bool createFromString( const QString theDefinition ); + bool createFromString( const QString &theDefinition ); /*! Set up this srs from a various text formats. * @@ -180,7 +180,7 @@ class CORE_EXPORT QgsCoordinateReferenceSystem * * @note added in 1.8 */ - bool createFromUserInput( const QString theDefinition ); + bool createFromUserInput( const QString &theDefinition ); /*! Make sure that ESRI WKT import is done properly. * This is required for proper shapefile CRS import when using gdal>= 1.9. diff --git a/src/core/qgscoordinatetransform.cpp b/src/core/qgscoordinatetransform.cpp index cb9c05b953d..5b0f1acda52 100644 --- a/src/core/qgscoordinatetransform.cpp +++ b/src/core/qgscoordinatetransform.cpp @@ -276,11 +276,11 @@ QgsPoint QgsCoordinateTransform::transform( const QgsPoint thePoint, TransformDi { transformCoords( 1, &x, &y, &z, direction ); } - catch ( QgsCsException &cse ) + catch ( const QgsCsException & ) { // rethrow the exception QgsDebugMsg( "rethrowing exception" ); - throw cse; + throw; } return QgsPoint( x, y ); @@ -293,11 +293,11 @@ QgsPoint QgsCoordinateTransform::transform( const double theX, const double theY { return transform( QgsPoint( theX, theY ), direction ); } - catch ( QgsCsException &cse ) + catch ( const QgsCsException & ) { // rethrow the exception QgsDebugMsg( "rethrowing exception" ); - throw cse; + throw; } } @@ -320,11 +320,11 @@ QgsRectangle QgsCoordinateTransform::transform( const QgsRectangle theRect, Tran transformCoords( 1, &x1, &y1, &z, direction ); transformCoords( 1, &x2, &y2, &z, direction ); } - catch ( QgsCsException &cse ) + catch ( const QgsCsException & ) { // rethrow the exception QgsDebugMsg( "rethrowing exception" ); - throw cse; + throw; } #ifdef COORDINATE_TRANSFORM_VERBOSE @@ -354,11 +354,11 @@ void QgsCoordinateTransform::transformInPlace( double& x, double& y, double& z, { transformCoords( 1, &x, &y, &z, direction ); } - catch ( QgsCsException &cse ) + catch ( const QgsCsException & ) { // rethrow the exception QgsDebugMsg( "rethrowing exception" ); - throw cse; + throw; } } @@ -388,11 +388,11 @@ void QgsCoordinateTransform::transformPolygon( QPolygonF& poly, TransformDirecti { transformCoords( nVertices, x.data(), y.data(), z.data(), direction ); } - catch ( QgsCsException &cse ) + catch ( const QgsCsException & ) { // rethrow the exception QgsDebugMsg( "rethrowing exception" ); - throw cse; + throw; } for ( int i = 0; i < nVertices; ++i ) @@ -421,11 +421,11 @@ void QgsCoordinateTransform::transformInPlace( { transformCoords( x.size(), &x[0], &y[0], &z[0], direction ); } - catch ( QgsCsException &cse ) + catch ( const QgsCsException & ) { // rethrow the exception QgsDebugMsg( "rethrowing exception" ); - throw cse; + throw; } } @@ -449,11 +449,11 @@ void QgsCoordinateTransform::transformInPlace( float& x, float& y, float& z, y = yd; z = zd; } - catch ( QgsCsException &cse ) + catch ( QgsCsException & ) { // rethrow the exception QgsDebugMsg( "rethrowing exception" ); - throw cse; + throw; } } @@ -494,11 +494,11 @@ void QgsCoordinateTransform::transformInPlace( z[i] = zd[i]; } } - catch ( QgsCsException &cse ) + catch ( QgsCsException & ) { // rethrow the exception QgsDebugMsg( "rethrowing exception" ); - throw cse; + throw; } } #endif //ANDROID @@ -565,11 +565,11 @@ QgsRectangle QgsCoordinateTransform::transformBoundingBox( const QgsRectangle re { transformCoords( numP * numP, x, y, z, direction ); } - catch ( QgsCsException &cse ) + catch ( const QgsCsException & ) { // rethrow the exception QgsDebugMsg( "rethrowing exception" ); - throw cse; + throw; } // Calculate the bounding box and use that for the extent diff --git a/src/core/qgsexpression.cpp b/src/core/qgsexpression.cpp index 3b0b3ec904d..4d03c9d7096 100644 --- a/src/core/qgsexpression.cpp +++ b/src/core/qgsexpression.cpp @@ -1728,8 +1728,8 @@ void QgsExpression::acceptVisitor( QgsExpression::Visitor& v ) const mRootNode->accept( v ); } -QString QgsExpression::replaceExpressionText( QString action, const QgsFeature* feat, - QgsVectorLayer* layer, +QString QgsExpression::replaceExpressionText( const QString &action, const QgsFeature *feat, + QgsVectorLayer *layer, const QMap *substitutionMap ) { QString expr_action; diff --git a/src/core/qgsexpression.h b/src/core/qgsexpression.h index da5e17f42f2..6eb5968182f 100644 --- a/src/core/qgsexpression.h +++ b/src/core/qgsexpression.h @@ -174,8 +174,8 @@ class CORE_EXPORT QgsExpression Additional substitutions can be passed through the substitutionMap parameter */ - static QString replaceExpressionText( const QString action, const QgsFeature* feat, - QgsVectorLayer* layer, + static QString replaceExpressionText( const QString &action, const QgsFeature *feat, + QgsVectorLayer *layer, const QMap *substitutionMap = 0 ); enum UnaryOperator { diff --git a/src/core/qgsgeometry.cpp b/src/core/qgsgeometry.cpp index bcbdde3221a..32261151f22 100644 --- a/src/core/qgsgeometry.cpp +++ b/src/core/qgsgeometry.cpp @@ -1603,7 +1603,7 @@ bool QgsGeometry::deleteVertex( int atVertex ) int* nPoints = ( int* )ptr; if (( *nPoints ) < 3 || vertexnr > ( *nPoints ) - 1 || vertexnr < 0 ) //line needs at least 2 vertices { - delete newbuffer; + delete [] newbuffer; return false; } int newNPoints = ( *nPoints ) - 1; //new number of points @@ -1659,7 +1659,7 @@ bool QgsGeometry::deleteVertex( int atVertex ) { if ( *nPoints < 3 ) //line needs at least 2 vertices { - delete newbuffer; + delete [] newbuffer; return false; } newNPoint = ( *nPoints ) - 1; @@ -1717,7 +1717,7 @@ bool QgsGeometry::deleteVertex( int atVertex ) { if ( *nPoints < 5 ) //a ring has at least 3 points { - delete newbuffer; + delete [] newbuffer; return false; } newNPoints = *nPoints - 1; @@ -1795,7 +1795,7 @@ bool QgsGeometry::deleteVertex( int atVertex ) { if ( *nPoints < 5 ) //a ring has at least 3 points { - delete newbuffer; + delete [] newbuffer; return false; } newNPoints = *nPoints - 1; @@ -1917,7 +1917,7 @@ bool QgsGeometry::insertVertex( double x, double y, int beforeVertex ) case QGis::WKBPoint25D: case QGis::WKBPoint://cannot insert a vertex before another one on point types { - delete newbuffer; + delete [] newbuffer; return false; } case QGis::WKBMultiPoint25D: @@ -2167,7 +2167,7 @@ bool QgsGeometry::insertVertex( double x, double y, int beforeVertex ) } else { - delete newbuffer; + delete [] newbuffer; return false; } } @@ -4096,10 +4096,6 @@ QString QgsGeometry::exportToWkt() const { return QString(); } - int *ringStart; // index of first point for each ring - int *ringNumPoints; // number of points in each ring - ringStart = new int[*numRings]; - ringNumPoints = new int[*numRings]; ptr = mGeometry + 1 + 2 * sizeof( int ); // set pointer to the first ring for ( idx = 0; idx < *numRings; idx++ ) { @@ -4110,7 +4106,6 @@ QString QgsGeometry::exportToWkt() const mWkt += "("; // get number of points in the ring nPoints = ( int * ) ptr; - ringNumPoints[idx] = *nPoints; ptr += 4; for ( jdx = 0; jdx < *nPoints; jdx++ ) @@ -4134,8 +4129,6 @@ QString QgsGeometry::exportToWkt() const mWkt += ")"; } mWkt += ")"; - delete [] ringStart; - delete [] ringNumPoints; return mWkt; } @@ -4378,10 +4371,6 @@ QString QgsGeometry::exportToGeoJSON() const { return QString(); } - int *ringStart; // index of first point for each ring - int *ringNumPoints; // number of points in each ring - ringStart = new int[*numRings]; - ringNumPoints = new int[*numRings]; ptr = mGeometry + 1 + 2 * sizeof( int ); // set pointer to the first ring for ( idx = 0; idx < *numRings; idx++ ) { @@ -4392,7 +4381,6 @@ QString QgsGeometry::exportToGeoJSON() const mWkt += "[ "; // get number of points in the ring nPoints = ( int * ) ptr; - ringNumPoints[idx] = *nPoints; ptr += 4; for ( jdx = 0; jdx < *nPoints; jdx++ ) @@ -4418,8 +4406,6 @@ QString QgsGeometry::exportToGeoJSON() const mWkt += " ]"; } mWkt += " ] }"; - delete [] ringStart; - delete [] ringNumPoints; return mWkt; } @@ -5274,7 +5260,7 @@ bool QgsGeometry::convertToMultiType() newMultiType = QGis::WKBMultiPolygon25D; break; default: - delete newGeometry; + delete [] newGeometry; return false; } memcpy( &newGeometry[currentWkbPosition], &newMultiType, sizeof( int ) ); diff --git a/src/core/qgsmaplayer.cpp b/src/core/qgsmaplayer.cpp index c60e8addb50..c7b54ffb515 100644 --- a/src/core/qgsmaplayer.cpp +++ b/src/core/qgsmaplayer.cpp @@ -134,7 +134,7 @@ QgsRectangle QgsMapLayer::extent() } /** Write blend mode for layer */ -void QgsMapLayer::setBlendMode( const QPainter::CompositionMode blendMode ) +void QgsMapLayer::setBlendMode( const QPainter::CompositionMode &blendMode ) { mBlendMode = blendMode; emit blendModeChanged( blendMode ); @@ -766,7 +766,7 @@ QString QgsMapLayer::loadDefaultStyle( bool & theResultFlag ) return loadNamedStyle( styleURI(), theResultFlag ); } -bool QgsMapLayer::loadNamedStyleFromDb( const QString db, const QString theURI, QString &qml ) +bool QgsMapLayer::loadNamedStyleFromDb( const QString &db, const QString &theURI, QString &qml ) { QgsDebugMsg( QString( "db = %1 uri = %2" ).arg( db ).arg( theURI ) ); @@ -810,7 +810,7 @@ bool QgsMapLayer::loadNamedStyleFromDb( const QString db, const QString theURI, return theResultFlag; } -QString QgsMapLayer::loadNamedStyle( const QString theURI, bool &theResultFlag ) +QString QgsMapLayer::loadNamedStyle( const QString &theURI, bool &theResultFlag ) { QgsDebugMsg( QString( "uri = %1 myURI = %2" ).arg( theURI ).arg( publicSource() ) ); @@ -948,7 +948,7 @@ QString QgsMapLayer::saveDefaultStyle( bool & theResultFlag ) return saveNamedStyle( styleURI(), theResultFlag ); } -QString QgsMapLayer::saveNamedStyle( const QString theURI, bool & theResultFlag ) +QString QgsMapLayer::saveNamedStyle( const QString &theURI, bool &theResultFlag ) { QString myErrorMessage; QDomDocument myDocument; @@ -1123,7 +1123,7 @@ void QgsMapLayer::exportSldStyle( QDomDocument &doc, QString &errorMsg ) doc = myDocument; } -QString QgsMapLayer::saveSldStyle( const QString theURI, bool & theResultFlag ) +QString QgsMapLayer::saveSldStyle( const QString &theURI, bool &theResultFlag ) { QString errorMsg; QDomDocument myDocument; @@ -1180,7 +1180,7 @@ QString QgsMapLayer::saveSldStyle( const QString theURI, bool & theResultFlag ) return tr( "ERROR: Failed to created SLD style file as %1. Check file permissions and retry." ).arg( filename ); } -QString QgsMapLayer::loadSldStyle( const QString theURI, bool &theResultFlag ) +QString QgsMapLayer::loadSldStyle( const QString &theURI, bool &theResultFlag ) { QgsDebugMsg( "Entered." ); diff --git a/src/core/qgsmaplayer.h b/src/core/qgsmaplayer.h index 258b06a4f5b..7a9f4d6b640 100644 --- a/src/core/qgsmaplayer.h +++ b/src/core/qgsmaplayer.h @@ -120,7 +120,7 @@ class CORE_EXPORT QgsMapLayer : public QObject const QString& metadataUrlFormat() const { return mMetadataUrlFormat; } /* Set the blending mode used for rendering a layer */ - void setBlendMode( const QPainter::CompositionMode blendMode ); + void setBlendMode( const QPainter::CompositionMode &blendMode ); /* Returns the current blending mode for a layer */ QPainter::CompositionMode blendMode() const; @@ -288,9 +288,9 @@ class CORE_EXPORT QgsMapLayer : public QObject * @return a QString with any status messages * @see also loadDefaultStyle (); */ - virtual QString loadNamedStyle( const QString theURI, bool & theResultFlag ); + virtual QString loadNamedStyle( const QString &theURI, bool &theResultFlag ); - virtual bool loadNamedStyleFromDb( const QString db, const QString theURI, QString &qml ); + virtual bool loadNamedStyleFromDb( const QString &db, const QString &theURI, QString &qml ); //TODO edit infos /** @@ -333,12 +333,12 @@ class CORE_EXPORT QgsMapLayer : public QObject * @return a QString with any status messages * @sa saveDefaultStyle() */ - virtual QString saveNamedStyle( const QString theURI, bool & theResultFlag ); + virtual QString saveNamedStyle( const QString &theURI, bool &theResultFlag ); - virtual QString saveSldStyle( const QString theURI, bool & theResultFlag ); - virtual QString loadSldStyle( const QString theURI, bool &theResultFlag ); + virtual QString saveSldStyle( const QString &theURI, bool &theResultFlag ); + virtual QString loadSldStyle( const QString &theURI, bool &theResultFlag ); - virtual bool readSld( const QDomNode& node, QString& errorMessage ) + virtual bool readSld( const QDomNode &node, QString &errorMessage ) { Q_UNUSED( node ); errorMessage = QString( "Layer type %1 not supported" ).arg( type() ); return false; } @@ -358,7 +358,7 @@ class CORE_EXPORT QgsMapLayer : public QObject virtual bool writeSymbology( QDomNode &node, QDomDocument& doc, QString& errorMessage ) const = 0; /** Return pointer to layer's undo stack */ - QUndoStack* undoStack(); + QUndoStack *undoStack(); /** Get the QImage used for caching render operations * @note This method was added in QGIS 1.4 **/ @@ -433,7 +433,7 @@ class CORE_EXPORT QgsMapLayer : public QObject void dataChanged(); /** Signal emitted when the blend mode is changed, through QgsMapLayer::setBlendMode() */ - void blendModeChanged( const QPainter::CompositionMode blendMode ); + void blendModeChanged( const QPainter::CompositionMode &blendMode ); protected: /** Set the extent */ diff --git a/src/core/qgsmaprenderer.cpp b/src/core/qgsmaprenderer.cpp index cd1c09f07ab..db4684f88fe 100644 --- a/src/core/qgsmaprenderer.cpp +++ b/src/core/qgsmaprenderer.cpp @@ -1010,7 +1010,7 @@ void QgsMapRenderer::updateFullExtent() if ( lyr->extent().isEmpty() ) { - it++; + ++it; continue; } @@ -1022,7 +1022,7 @@ void QgsMapRenderer::updateFullExtent() mFullExtent.unionRect( extent ); } - it++; + ++it; } if ( mFullExtent.width() == 0.0 || mFullExtent.height() == 0.0 ) @@ -1302,7 +1302,7 @@ const QgsCoordinateTransform *QgsMapRenderer::transformation( const QgsMapLayer /** Returns a QPainter::CompositionMode corresponding to a QgsMapRenderer::BlendMode */ -QPainter::CompositionMode QgsMapRenderer::getCompositionMode( const QgsMapRenderer::BlendMode blendMode ) +QPainter::CompositionMode QgsMapRenderer::getCompositionMode( const QgsMapRenderer::BlendMode &blendMode ) { // Map QgsMapRenderer::BlendNormal to QPainter::CompositionMode switch ( blendMode ) @@ -1338,7 +1338,7 @@ QPainter::CompositionMode QgsMapRenderer::getCompositionMode( const QgsMapRender } } -QgsMapRenderer::BlendMode QgsMapRenderer::getBlendModeEnum( const QPainter::CompositionMode blendMode ) +QgsMapRenderer::BlendMode QgsMapRenderer::getBlendModeEnum( const QPainter::CompositionMode &blendMode ) { // Map QPainter::CompositionMode to QgsMapRenderer::BlendNormal switch ( blendMode ) diff --git a/src/core/qgsmaprenderer.h b/src/core/qgsmaprenderer.h index 57830eb6f8c..3882b87c44f 100644 --- a/src/core/qgsmaprenderer.h +++ b/src/core/qgsmaprenderer.h @@ -290,10 +290,10 @@ class CORE_EXPORT QgsMapRenderer : public QObject //! Returns a QPainter::CompositionMode corresponding to a BlendMode //! Added in 1.9 - static QPainter::CompositionMode getCompositionMode( const QgsMapRenderer::BlendMode blendMode ); + static QPainter::CompositionMode getCompositionMode( const QgsMapRenderer::BlendMode &blendMode ); //! Returns a BlendMode corresponding to a QPainter::CompositionMode //! Added in 1.9 - static QgsMapRenderer::BlendMode getBlendModeEnum( const QPainter::CompositionMode blendMode ); + static QgsMapRenderer::BlendMode getBlendModeEnum( const QPainter::CompositionMode &blendMode ); void addLayerCoordinateTransform( const QString& layerId, const QString& srcAuthId, const QString& destAuthId, int srcDatumTransform = -1, int destDatumTransform = -1 ); void clearLayerCoordinateTransforms(); diff --git a/src/core/qgsmaptopixelgeometrysimplifier.cpp b/src/core/qgsmaptopixelgeometrysimplifier.cpp index 1eb1726424f..446d5675d36 100644 --- a/src/core/qgsmaptopixelgeometrysimplifier.cpp +++ b/src/core/qgsmaptopixelgeometrysimplifier.cpp @@ -70,8 +70,6 @@ float QgsMapToPixelSimplifier::calculateViewPixelTolerance( const QgsRectangle& //! Returns the BBOX of the specified WKB-point stream inline static QgsRectangle calculateBoundingBox( QGis::WkbType wkbType, unsigned char* wkb, size_t numPoints ) { - unsigned char* wkb2 = wkb; - double xmin = std::numeric_limits::max(), x, y; double ymin = std::numeric_limits::max(); double xmax = -std::numeric_limits::max(); @@ -90,7 +88,6 @@ inline static QgsRectangle calculateBoundingBox( QGis::WkbType wkbType, unsigned if ( xmax < x ) xmax = x; if ( ymax < y ) ymax = y; } - wkb = wkb2; return QgsRectangle( xmin, ymin, xmax, ymax ); } @@ -167,7 +164,7 @@ inline static bool generalizeWkbGeometry( QGis::WkbType wkbType, unsigned char* memcpy( targetWkb, &y1, sizeof( double ) ); targetWkb += sizeof( double ); } targetWkbSize += targetWkb - wkb2; - targetWkb = wkb2; + return true; } diff --git a/src/core/qgsogcutils.cpp b/src/core/qgsogcutils.cpp index 6748e60b5fc..48234ed3e6a 100644 --- a/src/core/qgsogcutils.cpp +++ b/src/core/qgsogcutils.cpp @@ -780,7 +780,7 @@ QgsGeometry* QgsOgcUtils::geometryFromGMLMultiPolygon( const QDomElement& geomet return g; } -bool QgsOgcUtils::readGMLCoordinates( QgsPolyline &coords, const QDomElement elem ) +bool QgsOgcUtils::readGMLCoordinates( QgsPolyline &coords, const QDomElement &elem ) { QString coordSeparator = ","; QString tupelSeparator = " "; @@ -861,7 +861,7 @@ QgsRectangle QgsOgcUtils::rectangleFromGMLBox( const QDomNode& boxNode ) return rect; } -bool QgsOgcUtils::readGMLPositions( QgsPolyline &coords, const QDomElement elem ) +bool QgsOgcUtils::readGMLPositions( QgsPolyline &coords, const QDomElement &elem ) { //tupel and coord separator are the same QString coordSeparator = " "; @@ -1243,10 +1243,7 @@ QDomElement QgsOgcUtils::geometryToGML( QgsGeometry* geometry, QDomDocument& doc { return QDomElement(); } - int *ringStart; // index of first point for each ring - int *ringNumPoints; // number of points in each ring - ringStart = new int[*numRings]; - ringNumPoints = new int[*numRings]; + int *ringNumPoints = new int[*numRings]; // number of points in each ring ptr = wkb + 1 + 2 * sizeof( int ); // set pointer to the first ring for ( idx = 0; idx < *numRings; idx++ ) { @@ -1287,7 +1284,6 @@ QDomElement QgsOgcUtils::geometryToGML( QgsGeometry* geometry, QDomDocument& doc boundaryElem.appendChild( ringElem ); polygonElem.appendChild( boundaryElem ); } - delete [] ringStart; delete [] ringNumPoints; return polygonElem; } diff --git a/src/core/qgsogcutils.h b/src/core/qgsogcutils.h index 191874ed8b2..4b376248313 100644 --- a/src/core/qgsogcutils.h +++ b/src/core/qgsogcutils.h @@ -95,14 +95,14 @@ class CORE_EXPORT QgsOgcUtils @param coords list where the found coordinates are appended @param elem the \verbatim \endverbatim element @return boolean for success*/ - static bool readGMLCoordinates( QgsPolyline &coords, const QDomElement elem ); + static bool readGMLCoordinates( QgsPolyline &coords, const QDomElement &elem ); /** Reads the \verbatim \endverbatim or \verbatim \endverbatim and extracts the coordinates as points @param coords list where the found coordinates are appended @param elem the \verbatim \endverbatim or \verbatim \endverbatim element @return boolean for success*/ - static bool readGMLPositions( QgsPolyline &coords, const QDomElement elem ); + static bool readGMLPositions( QgsPolyline &coords, const QDomElement &elem ); /**Create a GML coordinates element from a point list. diff --git a/src/core/qgspallabeling.cpp b/src/core/qgspallabeling.cpp index 5c96aeb253a..76da110237d 100644 --- a/src/core/qgspallabeling.cpp +++ b/src/core/qgspallabeling.cpp @@ -1372,9 +1372,7 @@ void QgsPalLayerSettings::calculateLabelSize( const QFontMetricsF* fm, QString t } else // called externally with passed-in feature, evaluate data defined { - QVariant exprVal = QVariant(); - - exprVal = dataDefinedValue( QgsPalLayerSettings::MultiLineWrapChar, *f, *mCurFields ); + QVariant exprVal = dataDefinedValue( QgsPalLayerSettings::MultiLineWrapChar, *f, *mCurFields ); if ( exprVal.isValid() ) { wrapchr = exprVal.toString(); diff --git a/src/core/qgsprojectfiletransform.cpp b/src/core/qgsprojectfiletransform.cpp index 4a06912ad92..b2c0e32aa08 100644 --- a/src/core/qgsprojectfiletransform.cpp +++ b/src/core/qgsprojectfiletransform.cpp @@ -809,8 +809,8 @@ void QgsProjectFileTransform::convertRasterProperties( QDomDocument& doc, QDomNo } } -int QgsProjectFileTransform::rasterBandNumber( const QDomElement& rasterPropertiesElem, const QString bandName, - QgsRasterLayer* rlayer ) +int QgsProjectFileTransform::rasterBandNumber( const QDomElement &rasterPropertiesElem, const QString &bandName, + QgsRasterLayer *rlayer ) { if ( !rlayer ) { diff --git a/src/core/qgsprojectfiletransform.h b/src/core/qgsprojectfiletransform.h index d9d7e82b8b0..bb350a7d0b0 100644 --- a/src/core/qgsprojectfiletransform.h +++ b/src/core/qgsprojectfiletransform.h @@ -87,8 +87,8 @@ class CORE_EXPORT QgsProjectFileTransform void transform1800to1900(); //helper functions - static int rasterBandNumber( const QDomElement& rasterPropertiesElem, const QString bandName, QgsRasterLayer* rlayer ); - static void transformContrastEnhancement( QDomDocument& doc, const QDomElement& rasterproperties, QDomElement& rendererElem ); + static int rasterBandNumber( const QDomElement &rasterPropertiesElem, const QString &bandName, QgsRasterLayer *rlayer ); + static void transformContrastEnhancement( QDomDocument &doc, const QDomElement &rasterproperties, QDomElement &rendererElem ); static void transformRasterTransparency( QDomDocument& doc, const QDomElement& orig, QDomElement& rendererElem ); }; diff --git a/src/core/qgsprojectproperty.cpp b/src/core/qgsprojectproperty.cpp index 9a810cb39f1..28f1dfe5f5f 100644 --- a/src/core/qgsprojectproperty.cpp +++ b/src/core/qgsprojectproperty.cpp @@ -42,7 +42,6 @@ void QgsPropertyValue::dump( int tabs ) const } // QgsPropertyValue::dump() - bool QgsPropertyValue::readXML( QDomNode & keyNode ) { // this *should* be a Dom element node @@ -265,9 +264,7 @@ bool QgsPropertyValue::writeXML( QString const & nodeName, } // QgsPropertyValue::writeXML - - -QgsPropertyKey::QgsPropertyKey( QString const name ) +QgsPropertyKey::QgsPropertyKey( const QString &name ) : mName( name ) {} @@ -330,17 +327,19 @@ void QgsPropertyKey::dump( int tabs ) const i.value()->dump( tabs + 1 ); } -// qDebug("<%s>", name().toUtf8().constData()); -// if ( i.value()->isValue() ) -// { -// qDebug(" <%s>", i.key().toUtf8().constData() ); -// } -// i.value()->dump(); -// if ( i.value()->isValue() ) -// { -// qDebug(" ", i.key().toUtf8().constData() ); -// } -// qDebug("", name().toUtf8().constData()); +#if 0 + qDebug( "<%s>", name().toUtf8().constData() ); + if ( i.value()->isValue() ) + { + qDebug( " <%s>", i.key().toUtf8().constData() ); + } + i.value()->dump(); + if ( i.value()->isValue() ) + { + qDebug( " ", i.key().toUtf8().constData() ); + } + qDebug( "", name().toUtf8().constData() ); +#endif } } diff --git a/src/core/qgsprojectproperty.h b/src/core/qgsprojectproperty.h index b72015bbc1e..bee9ec54d7e 100644 --- a/src/core/qgsprojectproperty.h +++ b/src/core/qgsprojectproperty.h @@ -198,7 +198,7 @@ class CORE_EXPORT QgsPropertyValue : public QgsProperty class CORE_EXPORT QgsPropertyKey : public QgsProperty { public: - QgsPropertyKey( const QString name = "" ); + QgsPropertyKey( const QString &name = "" ); virtual ~ QgsPropertyKey(); /// every key has a name diff --git a/src/core/qgsproviderregistry.cpp b/src/core/qgsproviderregistry.cpp index 6f3e11aa7e5..f3e1fe75da5 100644 --- a/src/core/qgsproviderregistry.cpp +++ b/src/core/qgsproviderregistry.cpp @@ -216,7 +216,7 @@ QgsProviderRegistry::~QgsProviderRegistry() if ( cleanupFunc ) cleanupFunc(); } - it++; + ++it; } } @@ -282,7 +282,7 @@ QString QgsProviderRegistry::pluginList( bool asHTML ) const else list += "\n"; - it++; + ++it; } if ( asHTML ) @@ -462,7 +462,7 @@ QString QgsProviderRegistry::protocolDrivers() const QStringList QgsProviderRegistry::providerList() const { QStringList lst; - for ( Providers::const_iterator it = mProviders.begin(); it != mProviders.end(); it++ ) + for ( Providers::const_iterator it = mProviders.begin(); it != mProviders.end(); ++it ) { lst.append( it->first ); } diff --git a/src/core/qgsvectorlayer.cpp b/src/core/qgsvectorlayer.cpp index e24c817a8ce..c6ff6993a65 100644 --- a/src/core/qgsvectorlayer.cpp +++ b/src/core/qgsvectorlayer.cpp @@ -1177,7 +1177,7 @@ QgsRectangle QgsVectorLayer::extent() rect.combineExtentWith( &r ); } - for ( QgsFeatureMap::iterator it = mEditBuffer->mAddedFeatures.begin(); it != mEditBuffer->mAddedFeatures.end(); it++ ) + for ( QgsFeatureMap::iterator it = mEditBuffer->mAddedFeatures.begin(); it != mEditBuffer->mAddedFeatures.end(); ++it ) { if ( it->geometry() ) { @@ -1701,7 +1701,7 @@ bool QgsVectorLayer::setDataProvider( QString const & provider ) const QMap &layers = QgsMapLayerRegistry::instance()->mapLayers(); QMap::const_iterator it; - for ( it = layers.constBegin(); it != layers.constEnd() && ( *it )->name() != lName; it++ ) + for ( it = layers.constBegin(); it != layers.constEnd() && ( *it )->name() != lName; ++it ) ; if ( it != layers.constEnd() && stuff.size() > 2 ) @@ -2284,7 +2284,7 @@ bool QgsVectorLayer::writeSymbology( QDomNode& node, QDomDocument& doc, QString& { const QMap &map = mValueMaps[ it.key()]; - for ( QMap::const_iterator vmit = map.begin(); vmit != map.end(); vmit++ ) + for ( QMap::const_iterator vmit = map.begin(); vmit != map.end(); ++vmit ) { QDomElement value = doc.createElement( "valuepair" ); value.setAttribute( "key", vmit.key() ); @@ -2448,7 +2448,7 @@ bool QgsVectorLayer::writeSymbology( QDomNode& node, QDomDocument& doc, QString& { QDomElement tabsElem = doc.createElement( "attributeEditorForm" ); - for ( QList< QgsAttributeEditorElement* >::const_iterator it = mAttributeEditorElements.begin(); it != mAttributeEditorElements.end(); it++ ) + for ( QList< QgsAttributeEditorElement* >::const_iterator it = mAttributeEditorElements.begin(); it != mAttributeEditorElements.end(); ++it ) { QDomElement attributeEditorWidgetElem = ( *it )->toDomElement( doc ); tabsElem.appendChild( attributeEditorWidgetElem ); @@ -3023,7 +3023,7 @@ const QString QgsVectorLayer::displayField() const return mDisplayField; } -void QgsVectorLayer::setDisplayExpression( const QString displayExpression ) +void QgsVectorLayer::setDisplayExpression( const QString &displayExpression ) { mDisplayExpression = displayExpression; } @@ -3517,7 +3517,7 @@ QVariant QgsVectorLayer::maximumValue( int index ) } /** Write blend mode for features */ -void QgsVectorLayer::setFeatureBlendMode( const QPainter::CompositionMode featureBlendMode ) +void QgsVectorLayer::setFeatureBlendMode( const QPainter::CompositionMode &featureBlendMode ) { mFeatureBlendMode = featureBlendMode; emit featureBlendModeChanged( featureBlendMode ); @@ -4083,12 +4083,12 @@ void QgsVectorLayer::saveStyleToDatabase( QString name, QString description, -QString QgsVectorLayer::loadNamedStyle( const QString theURI, bool &theResultFlag ) +QString QgsVectorLayer::loadNamedStyle( const QString &theURI, bool &theResultFlag ) { return loadNamedStyle( theURI, theResultFlag, false ); } -QString QgsVectorLayer::loadNamedStyle( const QString theURI, bool &theResultFlag , bool loadFromLocalDB ) +QString QgsVectorLayer::loadNamedStyle( const QString &theURI, bool &theResultFlag, bool loadFromLocalDB ) { QgsDataSourceURI dsUri( theURI ); if ( !loadFromLocalDB && !dsUri.database().isEmpty() ) diff --git a/src/core/qgsvectorlayer.h b/src/core/qgsvectorlayer.h index 872250ef289..8f6bd15c797 100644 --- a/src/core/qgsvectorlayer.h +++ b/src/core/qgsvectorlayer.h @@ -129,11 +129,11 @@ class CORE_EXPORT QgsAttributeEditorField : public QgsAttributeEditorElement class CORE_EXPORT QgsAttributeEditorRelation : public QgsAttributeEditorElement { public: - QgsAttributeEditorRelation( QString name , const QString relationId, QObject *parent ) + QgsAttributeEditorRelation( QString name, const QString &relationId, QObject *parent ) : QgsAttributeEditorElement( AeTypeRelation, name, parent ) , mRelationId( relationId ) {} - QgsAttributeEditorRelation( QString name , const QgsRelation& relation, QObject *parent ) + QgsAttributeEditorRelation( QString name, const QgsRelation& relation, QObject *parent ) : QgsAttributeEditorElement( AeTypeRelation, name, parent ) , mRelationId( relation.id() ) , mRelation( relation ) {} @@ -589,7 +589,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer * for this layer * @note added in 2.0 */ - void setDisplayExpression( const QString displayExpression ); + void setDisplayExpression( const QString &displayExpression ); /** * Get the preview expression, used to create a human readable preview string. @@ -794,13 +794,13 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer * @param theResultFlag will be set to true if a named style is correctly loaded * @param loadFromLocalDb if true forces to load from local db instead of datasource one */ - virtual QString loadNamedStyle( const QString theURI, bool &theResultFlag, bool loadFromLocalDb ); + virtual QString loadNamedStyle( const QString &theURI, bool &theResultFlag, bool loadFromLocalDb ); /** * Calls loadNamedStyle( theURI, theResultFlag, false ); * Retained for backward compatibility */ - virtual QString loadNamedStyle( const QString theURI, bool &theResultFlag ); + virtual QString loadNamedStyle( const QString &theURI, bool &theResultFlag ); virtual bool applyNamedStyle( QString namedStyle , QString errorMsg ); @@ -1247,14 +1247,6 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer */ QList referencingRelations( int idx ); - /** - * Get relations, where the foreign key is on another layer, referencing this layer - * - * @param idx Only get relations, where idx forms part of the referenced key - * @return A list of relations - */ - QList referencedRelations( int idx ); - /**access date format * @note added in 1.9 */ @@ -1344,7 +1336,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer /* Set the blending mode used for rendering each feature * @note added in 2.0 */ - void setFeatureBlendMode( const QPainter::CompositionMode blendMode ); + void setFeatureBlendMode( const QPainter::CompositionMode &blendMode ); /* Returns the current blending mode for features * @note added in 2.0 */ @@ -1532,7 +1524,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer void rendererChanged(); /** Signal emitted when setFeatureBlendMode() is called */ - void featureBlendModeChanged( const QPainter::CompositionMode blendMode ); + void featureBlendModeChanged( const QPainter::CompositionMode &blendMode ); /** Signal emitted when setLayerTransparency() is called */ void layerTransparencyChanged( int layerTransparency ); diff --git a/src/core/qgsvectorlayereditbuffer.cpp b/src/core/qgsvectorlayereditbuffer.cpp index 8d3a1af6f97..dc8647d64d3 100644 --- a/src/core/qgsvectorlayereditbuffer.cpp +++ b/src/core/qgsvectorlayereditbuffer.cpp @@ -85,7 +85,7 @@ void QgsVectorLayerEditBuffer::updateChangedAttributes( QgsFeature &f ) if ( mChangedAttributeValues.contains( f.id() ) ) { const QgsAttributeMap &map = mChangedAttributeValues[f.id()]; - for ( QgsAttributeMap::const_iterator it = map.begin(); it != map.end(); it++ ) + for ( QgsAttributeMap::const_iterator it = map.begin(); it != map.end(); ++it ) attrs[it.key()] = it.value(); } } @@ -377,7 +377,7 @@ bool QgsVectorLayerEditBuffer::commitChanges( QStringList& commitErrors ) { commitErrors << tr( "SUCCESS: %n feature(s) deleted.", "deleted features count", mDeletedFeatureIds.size() ); // TODO[MD]: we should not need this here - for ( QgsFeatureIds::const_iterator it = mDeletedFeatureIds.begin(); it != mDeletedFeatureIds.end(); it++ ) + for ( QgsFeatureIds::const_iterator it = mDeletedFeatureIds.begin(); it != mDeletedFeatureIds.end(); ++it ) { mChangedAttributeValues.remove( *it ); mChangedGeometries.remove( *it ); diff --git a/src/core/qgsvectorlayerfeatureiterator.cpp b/src/core/qgsvectorlayerfeatureiterator.cpp index 9f5a64f75c3..7fa4856b1b0 100644 --- a/src/core/qgsvectorlayerfeatureiterator.cpp +++ b/src/core/qgsvectorlayerfeatureiterator.cpp @@ -579,7 +579,7 @@ void QgsVectorLayerFeatureIterator::updateChangedAttributes( QgsFeature &f ) if ( mChangedAttributeValues.contains( f.id() ) ) { const QgsAttributeMap &map = mChangedAttributeValues[f.id()]; - for ( QgsAttributeMap::const_iterator it = map.begin(); it != map.end(); it++ ) + for ( QgsAttributeMap::const_iterator it = map.begin(); it != map.end(); ++it ) attrs[it.key()] = it.value(); } } diff --git a/src/core/raster/qgsmultibandcolorrenderer.cpp b/src/core/raster/qgsmultibandcolorrenderer.cpp index 752ce090761..52a495f942b 100644 --- a/src/core/raster/qgsmultibandcolorrenderer.cpp +++ b/src/core/raster/qgsmultibandcolorrenderer.cpp @@ -183,8 +183,8 @@ QgsRasterBlock* QgsMultiBandColorRenderer::block( int bandNo, QgsRectangle cons { // We should free the alloced mem from block(). QgsDebugMsg( "No input band" ); - bandIt--; - for ( ; bandIt != bands.constBegin(); bandIt-- ) + --bandIt; + for ( ; bandIt != bands.constBegin(); --bandIt ) { delete bandBlocks[*bandIt]; } diff --git a/src/core/raster/qgssinglebandcolordatarenderer.cpp b/src/core/raster/qgssinglebandcolordatarenderer.cpp index 97eb37431a6..1002feec45c 100644 --- a/src/core/raster/qgssinglebandcolordatarenderer.cpp +++ b/src/core/raster/qgssinglebandcolordatarenderer.cpp @@ -89,9 +89,8 @@ QgsRasterBlock* QgsSingleBandColorDataRenderer::block( int bandNo, QgsRectangle for ( qgssize i = 0; i < ( qgssize )width*height; i++ ) { QRgb pixelColor; - double alpha = 255.0; QRgb c = inputBlock->color( i ); - alpha = qAlpha( c ); + double alpha = qAlpha( c ); pixelColor = qRgba( mOpacity * qRed( c ), mOpacity * qGreen( c ), mOpacity * qBlue( c ), mOpacity * alpha ); outputBlock->setColor( i, pixelColor ); } @@ -103,9 +102,7 @@ QgsRasterBlock* QgsSingleBandColorDataRenderer::block( int bandNo, QgsRectangle void QgsSingleBandColorDataRenderer::writeXML( QDomDocument& doc, QDomElement& parentElem ) const { if ( parentElem.isNull() ) - { return; - } QDomElement rasterRendererElem = doc.createElement( "rasterrenderer" ); _writeXML( doc, rasterRendererElem ); diff --git a/src/core/spatialite/spatialite.c b/src/core/spatialite/spatialite.c index 328f1181b34..d54ebbc7e7d 100644 --- a/src/core/spatialite/spatialite.c +++ b/src/core/spatialite/spatialite.c @@ -37882,7 +37882,7 @@ fnct_IsClosed (sqlite3_context * context, int argc, sqlite3_value ** argv) else { line = simpleLinestring (geo); - if (!line < 0) + if (!line) sqlite3_result_int (context, -1); else sqlite3_result_int (context, gaiaIsClosed (line)); @@ -37957,7 +37957,7 @@ fnct_IsRing (sqlite3_context * context, int argc, sqlite3_value ** argv) else { line = simpleLinestring (geo); - if (!line < 0) + if (!line) sqlite3_result_int (context, -1); else { diff --git a/src/core/symbology-ng/qgscategorizedsymbolrendererv2.cpp b/src/core/symbology-ng/qgscategorizedsymbolrendererv2.cpp index 3c954aba476..43c8098c161 100644 --- a/src/core/symbology-ng/qgscategorizedsymbolrendererv2.cpp +++ b/src/core/symbology-ng/qgscategorizedsymbolrendererv2.cpp @@ -468,7 +468,7 @@ void QgsCategorizedSymbolRendererV2::toSld( QDomDocument &doc, QDomElement &elem props[ "scale" ] = QString( mSizeScaleField ).append( "\"" ).prepend( "\"" ); // create a Rule for each range - for ( QgsCategoryList::const_iterator it = mCategories.constBegin(); it != mCategories.constEnd(); it++ ) + for ( QgsCategoryList::const_iterator it = mCategories.constBegin(); it != mCategories.constEnd(); ++it ) { QgsStringMap catProps( props ); it->toSld( doc, element, catProps ); @@ -566,7 +566,7 @@ QDomElement QgsCategorizedSymbolRendererV2::save( QDomDocument& doc ) QgsSymbolV2Map symbols; QDomElement catsElem = doc.createElement( "categories" ); QgsCategoryList::const_iterator it = mCategories.constBegin(); - for ( ; it != mCategories.end(); it++ ) + for ( ; it != mCategories.end(); ++it ) { const QgsRendererCategoryV2& cat = *it; QString symbolName = QString::number( i ); diff --git a/src/core/symbology-ng/qgsfillsymbollayerv2.cpp b/src/core/symbology-ng/qgsfillsymbollayerv2.cpp index b87ef9f4e01..3bd86caff97 100644 --- a/src/core/symbology-ng/qgsfillsymbollayerv2.cpp +++ b/src/core/symbology-ng/qgsfillsymbollayerv2.cpp @@ -581,11 +581,11 @@ QPointF QgsGradientFillSymbolLayerV2::rotateReferencePoint( const QPointF & refP return rotatedReferencePoint; } -void QgsGradientFillSymbolLayerV2::applyGradient( const QgsSymbolV2RenderContext& context, QBrush& brush, - const QColor& color, const QColor& color2, const GradientColorType gradientColorType, - QgsVectorColorRampV2 * gradientRamp, const GradientType gradientType, - const GradientCoordinateMode coordinateMode, const GradientSpread gradientSpread, - const QPointF referencePoint1, const QPointF referencePoint2, const double angle ) +void QgsGradientFillSymbolLayerV2::applyGradient( const QgsSymbolV2RenderContext &context, QBrush &brush, + const QColor &color, const QColor &color2, const GradientColorType &gradientColorType, + QgsVectorColorRampV2 *gradientRamp, const GradientType &gradientType, + const GradientCoordinateMode &coordinateMode, const GradientSpread &gradientSpread, + const QPointF &referencePoint1, const QPointF &referencePoint2, const double angle ) { //update alpha of gradient colors QColor fillColor = color; diff --git a/src/core/symbology-ng/qgsfillsymbollayerv2.h b/src/core/symbology-ng/qgsfillsymbollayerv2.h index b8cc3d1cfa8..c7eada438ae 100644 --- a/src/core/symbology-ng/qgsfillsymbollayerv2.h +++ b/src/core/symbology-ng/qgsfillsymbollayerv2.h @@ -136,8 +136,10 @@ class CORE_EXPORT QgsGradientFillSymbolLayerV2 : public QgsFillSymbolLayerV2 Repeat }; - QgsGradientFillSymbolLayerV2( QColor color = DEFAULT_SIMPLEFILL_COLOR, QColor color2 = Qt::white, - GradientColorType gradientColorType = SimpleTwoColor, GradientType gradientType = Linear, + QgsGradientFillSymbolLayerV2( QColor color = DEFAULT_SIMPLEFILL_COLOR, + QColor color2 = Qt::white, + GradientColorType gradientColorType = SimpleTwoColor, + GradientType gradientType = Linear, GradientCoordinateMode coordinateMode = Feature, GradientSpread gradientSpread = Pad ); @@ -243,9 +245,9 @@ class CORE_EXPORT QgsGradientFillSymbolLayerV2 : public QgsFillSymbolLayerV2 /**Applies the gradient to a brush*/ void applyGradient( const QgsSymbolV2RenderContext& context, QBrush& brush, const QColor& color, const QColor& color2, - const GradientColorType gradientColorType, QgsVectorColorRampV2 * gradientRamp, const GradientType gradientType, - const GradientCoordinateMode coordinateMode, const GradientSpread gradientSpread, const QPointF referencePoint1, - const QPointF referencePoint2, const double angle ); + const GradientColorType &gradientColorType, QgsVectorColorRampV2 *gradientRamp, const GradientType &gradientType, + const GradientCoordinateMode &coordinateMode, const GradientSpread &gradientSpread, + const QPointF &referencePoint1, const QPointF &referencePoint2, const double angle ); /**rotates a reference point by a specified angle around the point (0.5, 0.5)*/ QPointF rotateReferencePoint( const QPointF & refPoint, double angle ); diff --git a/src/core/symbology-ng/qgsgraduatedsymbolrendererv2.cpp b/src/core/symbology-ng/qgsgraduatedsymbolrendererv2.cpp index dd1a490be87..83ff9d6ad6d 100644 --- a/src/core/symbology-ng/qgsgraduatedsymbolrendererv2.cpp +++ b/src/core/symbology-ng/qgsgraduatedsymbolrendererv2.cpp @@ -377,7 +377,7 @@ void QgsGraduatedSymbolRendererV2::toSld( QDomDocument& doc, QDomElement &elemen props[ "scale" ] = QString( mSizeScaleField ).append( "\"" ).prepend( "\"" ); // create a Rule for each range - for ( QgsRangeList::const_iterator it = mRanges.constBegin(); it != mRanges.constEnd(); it++ ) + for ( QgsRangeList::const_iterator it = mRanges.constBegin(); it != mRanges.constEnd(); ++it ) { QgsStringMap catProps( props ); it->toSld( doc, element, catProps ); @@ -578,11 +578,6 @@ static QList _calcPrettyBreaks( double minimum, double maximum, int clas start = start - k / 2; end = end + k / 2 + k % 2; } - divisions = minimumCount; - } - else - { - divisions = k; } double minimumBreak = start * unit; //double maximumBreak = end * unit; @@ -1009,7 +1004,7 @@ QDomElement QgsGraduatedSymbolRendererV2::save( QDomDocument& doc ) QgsSymbolV2Map symbols; QDomElement rangesElem = doc.createElement( "ranges" ); QgsRangeList::const_iterator it = mRanges.constBegin(); - for ( ; it != mRanges.constEnd(); it++ ) + for ( ; it != mRanges.constEnd(); ++it ) { const QgsRendererRangeV2& range = *it; QString symbolName = QString::number( i ); diff --git a/src/core/symbology-ng/qgsrulebasedrendererv2.cpp b/src/core/symbology-ng/qgsrulebasedrendererv2.cpp index 0e7ebc244da..f75b211982c 100644 --- a/src/core/symbology-ng/qgsrulebasedrendererv2.cpp +++ b/src/core/symbology-ng/qgsrulebasedrendererv2.cpp @@ -105,7 +105,7 @@ QgsRuleBasedRendererV2::Rule* QgsRuleBasedRendererV2::Rule::takeChildAt( int i ) Rule* rule = mChildren.takeAt( i ); rule->mParent = NULL; return rule; - updateElseRules(); + // updateElseRules(); } void QgsRuleBasedRendererV2::Rule::updateElseRules() @@ -838,7 +838,7 @@ QgsLegendSymbologyList QgsRuleBasedRendererV2::legendSymbologyItems( QSize iconS { QgsLegendSymbologyList lst; QgsLegendSymbolList items = legendSymbolItems(); - for ( QgsLegendSymbolList::iterator it = items.begin(); it != items.end(); it++ ) + for ( QgsLegendSymbolList::iterator it = items.begin(); it != items.end(); ++it ) { QPair pair = *it; QPixmap pix = QgsSymbolLayerV2Utils::symbolPreviewPixmap( pair.second, iconSize ); diff --git a/src/core/symbology-ng/qgsstylev2.cpp b/src/core/symbology-ng/qgsstylev2.cpp index 4bfa724024a..370e74c318a 100644 --- a/src/core/symbology-ng/qgsstylev2.cpp +++ b/src/core/symbology-ng/qgsstylev2.cpp @@ -1392,7 +1392,7 @@ bool QgsStyleV2::importXML( QString filename ) } // save the symbols with proper name - for ( QMap::iterator it = symbols.begin(); it != symbols.end(); it++ ) + for ( QMap::iterator it = symbols.begin(); it != symbols.end(); ++it ) { addSymbol( it.key(), it.value() ); } diff --git a/src/core/symbology-ng/qgssymbollayerv2utils.cpp b/src/core/symbology-ng/qgssymbollayerv2utils.cpp index 3acc92a8542..fe94a345786 100644 --- a/src/core/symbology-ng/qgssymbollayerv2utils.cpp +++ b/src/core/symbology-ng/qgssymbollayerv2utils.cpp @@ -1069,10 +1069,12 @@ bool QgsSymbolLayerV2Utils::hasExternalGraphic( QDomElement &element ) { return true; } +#if 0 else if ( !inlineContentElem.isNull() ) { return false; // not implemented yet } +#endif else { return false; @@ -1369,8 +1371,10 @@ bool QgsSymbolLayerV2Utils::convertPolygonSymbolizerToPointMarker( QDomElement & found = true; break; } +#if 0 else if ( !inlineContentElem.isNull() ) - continue; // TODO: not implemeneted yet + continue; // TODO: not implemented yet +#endif else continue; } diff --git a/src/gui/qgisgui.h b/src/gui/qgisgui.h index 03357ef67de..431dc359d21 100644 --- a/src/gui/qgisgui.h +++ b/src/gui/qgisgui.h @@ -79,6 +79,7 @@ namespace QgisGui * provide filters with all available writable image formats. * @param theParent widget that should act as the parent for the file dialog * @param theMessage the message to display to the user + * @param defaultFilename default file name (empty by default) * @return QPair where first is the file name and second is * the file type * @note added in 1.6 diff --git a/src/gui/qgsattributeeditor.cpp b/src/gui/qgsattributeeditor.cpp index 031a2ab5188..bc934f15aa7 100644 --- a/src/gui/qgsattributeeditor.cpp +++ b/src/gui/qgsattributeeditor.cpp @@ -312,7 +312,7 @@ QWidget* QgsAttributeEditor::createAttributeEditor( QWidget* parent, QWidget* ed { cb->setEditable( false ); - for ( QList::iterator it = values.begin(); it != values.end(); it++ ) + for ( QList::iterator it = values.begin(); it != values.end(); ++it ) cb->addItem( it->toString(), it->toString() ); myWidget = cb; @@ -347,7 +347,7 @@ QWidget* QgsAttributeEditor::createAttributeEditor( QWidget* parent, QWidget* ed QComboBox *cb = comboBox( editor, parent ); if ( cb ) { - for ( QMap::const_iterator it = map.begin(); it != map.end(); it++ ) + for ( QMap::const_iterator it = map.begin(); it != map.end(); ++it ) { cb->addItem( it.key(), it.value() ); } @@ -421,7 +421,7 @@ QWidget* QgsAttributeEditor::createAttributeEditor( QWidget* parent, QWidget* ed cb->addItem( tr( "(no selection)" ), settings.value( "qgis/nullValue", "NULL" ).toString() ); } - for ( QMap< QString, QString >::const_iterator it = map.begin(); it != map.end(); it++ ) + for ( QMap< QString, QString >::const_iterator it = map.begin(); it != map.end(); ++it ) { if ( data.mOrderByValue ) cb->addItem( it.key(), it.value() ); @@ -439,7 +439,7 @@ QWidget* QgsAttributeEditor::createAttributeEditor( QWidget* parent, QWidget* ed { QStringList checkList = value.toString().remove( QChar( '{' ) ).remove( QChar( '}' ) ).split( "," ); - for ( QMap< QString, QString >::const_iterator it = map.begin(); it != map.end(); it++ ) + for ( QMap< QString, QString >::const_iterator it = map.begin(); it != map.end(); ++it ) { QListWidgetItem *item; if ( data.mOrderByValue ) @@ -496,7 +496,7 @@ QWidget* QgsAttributeEditor::createAttributeEditor( QWidget* parent, QWidget* ed QComboBox *cb = comboBox( editor, parent ); if ( cb ) { - for ( QMap::const_iterator it = classes.begin(); it != classes.end(); it++ ) + for ( QMap::const_iterator it = classes.begin(); it != classes.end(); ++it ) { cb->addItem( it.value(), it.key() ); } @@ -644,7 +644,7 @@ QWidget* QgsAttributeEditor::createAttributeEditor( QWidget* parent, QWidget* ed vl->dataProvider()->uniqueValues( idx, values ); QStringList svalues; - for ( QList::const_iterator it = values.begin(); it != values.end(); it++ ) + for ( QList::const_iterator it = values.begin(); it != values.end(); ++it ) svalues << it->toString(); QCompleter *c = new QCompleter( svalues ); diff --git a/src/gui/qgscollapsiblegroupbox.cpp b/src/gui/qgscollapsiblegroupbox.cpp index dd85eba0c18..88ad182996c 100644 --- a/src/gui/qgscollapsiblegroupbox.cpp +++ b/src/gui/qgscollapsiblegroupbox.cpp @@ -233,9 +233,8 @@ void QgsCollapsibleGroupBoxBasic::checkClicked( bool chkd ) void QgsCollapsibleGroupBoxBasic::toggleCollapsed() { // verify if sender is this group box's collapse button - bool senderCollBtn = false; - QgsGroupBoxCollapseButton* collBtn = qobject_cast( QObject::sender() ); - senderCollBtn = ( collBtn && collBtn == mCollapseButton ); + QgsGroupBoxCollapseButton *collBtn = qobject_cast( QObject::sender() ); + bool senderCollBtn = ( collBtn && collBtn == mCollapseButton ); mAltDown = ( mAltDown || mCollapseButton->altDown() ); mShiftDown = ( mShiftDown || mCollapseButton->shiftDown() ); diff --git a/src/gui/qgsmapcanvas.cpp b/src/gui/qgsmapcanvas.cpp index 08ed4b3ca2b..88954342439 100644 --- a/src/gui/qgsmapcanvas.cpp +++ b/src/gui/qgsmapcanvas.cpp @@ -162,7 +162,7 @@ QgsMapCanvas::~QgsMapCanvas() { QGraphicsItem* item = *it; delete item; - it++; + ++it; } mScene->deleteLater(); // crashes in python tests on windows @@ -1094,7 +1094,7 @@ void QgsMapCanvas::updateCanvasItemPositions() item->updatePosition(); } - it++; + ++it; } } @@ -1488,7 +1488,7 @@ void QgsMapCanvas::moveCanvasContents( bool reset ) canvasItem->setPanningOffset( pnt ); } - it++; + ++it; } // show items diff --git a/src/gui/qgsmaptoolidentify.cpp b/src/gui/qgsmaptoolidentify.cpp index 0efea5ed70f..bb1cbfa5cac 100644 --- a/src/gui/qgsmaptoolidentify.cpp +++ b/src/gui/qgsmaptoolidentify.cpp @@ -107,7 +107,7 @@ QList QgsMapToolIdentify::identify( int x, i mLayerIdResults.clear(); QList idResult = identify( x, y, TopDownAll ); QList::const_iterator it = idResult.constBegin(); - for ( ; it != idResult.constEnd(); it++ ) + for ( ; it != idResult.constEnd(); ++it ) { QgsMapLayer *layer = it->mLayer; if ( mLayerIdResults.contains( layer ) ) diff --git a/src/gui/qgsowssourceselect.cpp b/src/gui/qgsowssourceselect.cpp index 4048706662b..bae0930401b 100644 --- a/src/gui/qgsowssourceselect.cpp +++ b/src/gui/qgsowssourceselect.cpp @@ -428,7 +428,7 @@ void QgsOWSSourceSelect::populateCRS() // if not, use one of the available CRS QString defaultCRS; QSet::const_iterator it = mSelectedLayersCRSs.begin(); - for ( ; it != mSelectedLayersCRSs.end(); it++ ) + for ( ; it != mSelectedLayersCRSs.end(); ++it ) { if ( it->compare( mSelectedCRS, Qt::CaseInsensitive ) == 0 ) break; diff --git a/src/gui/symbology-ng/qgscptcitycolorrampv2dialog.cpp b/src/gui/symbology-ng/qgscptcitycolorrampv2dialog.cpp index c3919d887bb..8f780962d57 100644 --- a/src/gui/symbology-ng/qgscptcitycolorrampv2dialog.cpp +++ b/src/gui/symbology-ng/qgscptcitycolorrampv2dialog.cpp @@ -145,8 +145,7 @@ QgsCptCityColorRampV2Dialog::QgsCptCityColorRampV2Dialog( QgsCptCityColorRampV2* QgsDebugMsg( "looking for ramp " + mRamp->schemeName() ); if ( mRamp->schemeName() != "" ) { - bool found = false; - found = updateRamp(); + bool found = updateRamp(); if ( ! found ) { tabBar->setCurrentIndex( 1 ); diff --git a/src/mapserver/qgis_map_serv.cpp b/src/mapserver/qgis_map_serv.cpp index d3c06c50897..ac15cccfc40 100644 --- a/src/mapserver/qgis_map_serv.cpp +++ b/src/mapserver/qgis_map_serv.cpp @@ -357,7 +357,7 @@ int main( int argc, char * argv[] ) { theServer = new QgsWCSServer( parameterMap ); } - catch ( QgsMapServiceException e ) //admin.sld may be invalid + catch ( const QgsMapServiceException &e ) //admin.sld may be invalid { theRequestHandler->sendServiceException( e ); continue; @@ -449,7 +449,7 @@ int main( int argc, char * argv[] ) { theServer = new QgsWFSServer( parameterMap ); } - catch ( QgsMapServiceException e ) //admin.sld may be invalid + catch ( const QgsMapServiceException &e ) //admin.sld may be invalid { theRequestHandler->sendServiceException( e ); continue; @@ -516,26 +516,16 @@ int main( int argc, char * argv[] ) QString outputFormat = parameterMap.value( "OUTPUTFORMAT" ); try { - if ( theServer->getFeature( *theRequestHandler, outputFormat ) != 0 ) - { - delete theRequestHandler; - delete theServer; - continue; - } - else - { - delete theRequestHandler; - delete theServer; - continue; - } + theServer->getFeature( *theRequestHandler, outputFormat ); } catch ( QgsMapServiceException& ex ) { theRequestHandler->sendServiceException( ex ); - delete theRequestHandler; - delete theServer; - continue; } + + delete theRequestHandler; + delete theServer; + continue; } else if ( request.compare( "Transaction", Qt::CaseInsensitive ) == 0 ) { @@ -565,7 +555,7 @@ int main( int argc, char * argv[] ) { theServer = new QgsWMSServer( parameterMap, theMapRenderer ); } - catch ( QgsMapServiceException e ) //admin.sld may be invalid + catch ( const QgsMapServiceException &e ) //admin.sld may be invalid { theRequestHandler->sendServiceException( e ); continue; diff --git a/src/mapserver/qgsprojectparser.cpp b/src/mapserver/qgsprojectparser.cpp index 66fe7dea145..bcd410b42ac 100644 --- a/src/mapserver/qgsprojectparser.cpp +++ b/src/mapserver/qgsprojectparser.cpp @@ -169,7 +169,7 @@ void QgsProjectParser::featureTypeList( QDomElement& parentElement, QDomDocument //We use the layer name even though it might not be unique. //Because the id sometimes contains user/pw information and the name is more descriptive QString typeName = layer->name(); - typeName = typeName.replace( QString( " " ), QString( "_" ) ); + typeName = typeName.replace( " ", "_" ); QDomText nameText = doc.createTextNode( typeName ); nameElem.appendChild( nameText ); layerElem.appendChild( nameElem ); @@ -304,7 +304,7 @@ void QgsProjectParser::wcsContentMetadata( QDomElement& parentElement, QDomDocum //We use the layer name even though it might not be unique. //Because the id sometimes contains user/pw information and the name is more descriptive QString typeName = layer->name(); - typeName = typeName.replace( QString( " " ), QString( "_" ) ); + typeName = typeName.replace( " ", "_" ); QDomText nameText = doc.createTextNode( typeName ); nameElem.appendChild( nameText ); layerElem.appendChild( nameElem ); @@ -492,11 +492,13 @@ void QgsProjectParser::describeFeatureType( const QString& aTypeName, QDomElemen { QgsMapLayer *mLayer = createLayerFromElement( elem ); QgsVectorLayer* layer = dynamic_cast( mLayer ); + if ( !layer ) + continue; QString typeName = layer->name(); - typeName = typeName.replace( QString( " " ), QString( "_" ) ); + typeName = typeName.replace( " ", "_" ); - if ( layer && wfsLayersId.contains( layer->id() ) && ( aTypeName == "" || typeNameList.contains( typeName ) ) ) + if ( wfsLayersId.contains( layer->id() ) && ( aTypeName == "" || typeNameList.contains( typeName ) ) ) { //do a select with searchRect and go through all the features QgsVectorDataProvider* provider = layer->dataProvider(); @@ -657,9 +659,11 @@ void QgsProjectParser::describeCoverage( const QString& aCoveName, QDomElement& { //QgsMapLayer *layer = createLayerFromElement( *layerIt ); QgsMapLayer *layer = createLayerFromElement( elem ); + if ( !layer ) + continue; QString coveName = layer->name(); - coveName = coveName.replace( QString( " " ), QString( "_" ) ); - if ( layer && ( aCoveName == "" || coveNameList.contains( coveName ) ) ) + coveName = coveName.replace( " ", "_" ); + if ( aCoveName == "" || coveNameList.contains( coveName ) ) { QgsDebugMsg( QString( "add layer %1 to map" ).arg( layer->id() ) ); layerMap.insert( layer->id(), layer ); @@ -669,7 +673,7 @@ void QgsProjectParser::describeCoverage( const QString& aCoveName, QDomElement& //We use the layer name even though it might not be unique. //Because the id sometimes contains user/pw information and the name is more descriptive QString typeName = layer->name(); - typeName = typeName.replace( QString( " " ), QString( "_" ) ); + typeName = typeName.replace( " ", "_" ); QDomText nameText = doc.createTextNode( typeName ); nameElem.appendChild( nameText ); layerElem.appendChild( nameElem ); @@ -850,7 +854,7 @@ QList QgsProjectParser::mapLayerFromTypeName( const QString& tName QgsVectorLayer* layer = dynamic_cast( mLayer ); QString typeName = layer->name(); - typeName = typeName.replace( QString( " " ), QString( "_" ) ); + typeName = typeName.replace( " ", "_" ); if ( tName == typeName ) { layerList.push_back( mLayer ); @@ -879,7 +883,7 @@ QList QgsProjectParser::mapLayerFromCoverage( const QString& cName QgsRasterLayer* layer = dynamic_cast( mLayer ); QString coveName = layer->name(); - coveName = coveName.replace( QString( " " ), QString( "_" ) ); + coveName = coveName.replace( " ", "_" ); if ( cName == coveName ) { layerList.push_back( mLayer ); @@ -934,9 +938,9 @@ void QgsProjectParser::addLayers( QDomDocument &doc, QgsDebugMsg( QString( "Project path: %1" ).arg( project ) ); QString embeddedGroupName = currentChildElem.attribute( "name" ); QgsProjectParser* p = dynamic_cast( QgsConfigCache::instance()->searchConfiguration( project ) ); - QList embeddedGroupElements = p->mLegendGroupElements; if ( p ) { + QList embeddedGroupElements = p->mLegendGroupElements; QStringList pIdDisabled = p->identifyDisabledLayers(); QDomElement embeddedGroupElem; @@ -1284,9 +1288,9 @@ void QgsProjectParser::addOWSLayers( QDomDocument &doc, QgsDebugMsg( QString( "Project path: %1" ).arg( project ) ); QString embeddedGroupName = currentChildElem.attribute( "name" ); QgsProjectParser* p = dynamic_cast( QgsConfigCache::instance()->searchConfiguration( project ) ); - QList embeddedGroupElements = p->mLegendGroupElements; if ( p ) { + QList embeddedGroupElements = p->mLegendGroupElements; QStringList pIdDisabled = p->identifyDisabledLayers(); QDomElement embeddedGroupElem; diff --git a/src/mapserver/qgssldparser.cpp b/src/mapserver/qgssldparser.cpp index 6f0891b5084..5f24ed06c82 100644 --- a/src/mapserver/qgssldparser.cpp +++ b/src/mapserver/qgssldparser.cpp @@ -1176,7 +1176,7 @@ QgsMapLayer* QgsSLDParser::mapLayerFromUserLayer( const QDomElement& userLayerEl return theMapLayer; } -QgsVectorLayer* QgsSLDParser::vectorLayerFromGML( const QDomElement gmlRootElement ) const +QgsVectorLayer* QgsSLDParser::vectorLayerFromGML( const QDomElement &gmlRootElement ) const { QgsDebugMsg( "Entering." ); @@ -1367,7 +1367,7 @@ QgsVectorLayer* QgsSLDParser::contourLayerFromRaster( const QDomElement& userSty hLayer, 0, nElevField, GDALTermProgress, NULL ); - delete adfFixedLevels; + delete [] adfFixedLevels; OGR_DS_Destroy( hDS ); GDALClose( hSrcDS ); @@ -1474,9 +1474,8 @@ void QgsSLDParser::setOpacityForLayer( const QDomElement& layerElem, QgsMapLayer QgsDebugMsg( "Setting opacity value: " + QString::number( opacityValue ) ); layer->setTransparency( opacityValue ); } -#endif -void QgsSLDParser::clearRasterSymbology( QgsRasterLayer* rl ) const +void QgsSLDParser::clearRasterSymbology( QgsRasterLayer *rl ) const { if ( rl ) { @@ -1487,6 +1486,7 @@ void QgsSLDParser::clearRasterSymbology( QgsRasterLayer* rl ) const } } } +#endif void QgsSLDParser::setCrsForLayer( const QDomElement& layerElem, QgsMapLayer* ml ) const { diff --git a/src/mapserver/qgssldparser.h b/src/mapserver/qgssldparser.h index fee99aa6316..d1609c496fe 100644 --- a/src/mapserver/qgssldparser.h +++ b/src/mapserver/qgssldparser.h @@ -123,7 +123,7 @@ class QgsSLDParser: public QgsConfigParser Delegates the work to specific methods for , or */ QgsMapLayer* mapLayerFromUserLayer( const QDomElement& userLayerElem, const QString& layerName, bool allowCaching = true ) const; /**Writes a temporary file and creates a vector layer. The file is removed at destruction time*/ - QgsVectorLayer* vectorLayerFromGML( const QDomElement gmlRootElement ) const; + QgsVectorLayer* vectorLayerFromGML( const QDomElement &gmlRootElement ) const; /**Creates a line layer (including renderer) from contour symboliser @return the layer or 0 if no layer could be created*/ QgsVectorLayer* contourLayerFromRaster( const QDomElement& userStyleElem, QgsRasterLayer* rasterLayer ) const; @@ -132,10 +132,10 @@ class QgsSLDParser: public QgsConfigParser #if 0 /**Sets the opacity on layer level if the tag is present*/ void setOpacityForLayer( const QDomElement& layerElem, QgsMapLayer* layer ) const; -#endif /**Resets the former symbology of a raster layer. This is important for single band layers (e.g. dems) coming from the cash*/ - void clearRasterSymbology( QgsRasterLayer* rl ) const; + void clearRasterSymbology( QgsRasterLayer *rl ) const; +#endif /**Reads attributes "epsg" or "proj" from layer element and sets specified CRS if present*/ void setCrsForLayer( const QDomElement& layerElem, QgsMapLayer* ml ) const; diff --git a/src/mapserver/qgssoaprequesthandler.cpp b/src/mapserver/qgssoaprequesthandler.cpp index 2896b629b69..2e856296c94 100644 --- a/src/mapserver/qgssoaprequesthandler.cpp +++ b/src/mapserver/qgssoaprequesthandler.cpp @@ -145,11 +145,11 @@ QMap QgsSOAPRequestHandler::parseInput() { formatString = "JPG"; } - else if ( formatString == "image/png" || formatString == "PNG" || formatString == "PNG" ) + else if ( formatString == "image/png" || formatString == "PNG" || formatString == "png" ) { formatString = "PNG"; } - else if ( formatString == "image/gif" || formatString == "GIF" || formatString == "GIF" ) + else if ( formatString == "image/gif" || formatString == "GIF" || formatString == "gif" ) { formatString = "GIF"; } diff --git a/src/mapserver/qgswfsserver.cpp b/src/mapserver/qgswfsserver.cpp index 4615dcbbd40..d2f4ae99e17 100644 --- a/src/mapserver/qgswfsserver.cpp +++ b/src/mapserver/qgswfsserver.cpp @@ -510,12 +510,12 @@ int QgsWFSServer::getFeature( QgsRequestHandler& request, const QString& format else { QgsExpression *mFilter = QgsOgcUtils::expressionFromOgcFilter( filterElem ); - if ( mFilter->hasParserError() ) - { - throw QgsMapServiceException( "RequestNotWellFormed", mFilter->parserErrorString() ); - } if ( mFilter ) { + if ( mFilter->hasParserError() ) + { + throw QgsMapServiceException( "RequestNotWellFormed", mFilter->parserErrorString() ); + } while ( fit.nextFeature( feature ) && featureCounter < maxFeat ) { QVariant res = mFilter->evaluate( &feature, fields ); @@ -828,12 +828,12 @@ int QgsWFSServer::getFeature( QgsRequestHandler& request, const QString& format req.setSubsetOfAttributes( attrIndexes ); QgsFeatureIterator fit = layer->getFeatures( req ); QgsExpression *mFilter = new QgsExpression( expFilter ); - if ( mFilter->hasParserError() ) - { - throw QgsMapServiceException( "RequestNotWellFormed", QString( "Expression filter error message: %1." ).arg( mFilter->parserErrorString() ) ); - } if ( mFilter ) { + if ( mFilter->hasParserError() ) + { + throw QgsMapServiceException( "RequestNotWellFormed", QString( "Expression filter error message: %1." ).arg( mFilter->parserErrorString() ) ); + } while ( fit.nextFeature( feature ) && featureCounter < maxFeat ) { QVariant res = mFilter->evaluate( &feature, fields ); @@ -928,12 +928,12 @@ int QgsWFSServer::getFeature( QgsRequestHandler& request, const QString& format else { QgsExpression *mFilter = QgsOgcUtils::expressionFromOgcFilter( filterElem ); - if ( mFilter->hasParserError() ) - { - throw QgsMapServiceException( "RequestNotWellFormed", QString( "OGC expression filter error message: %1." ).arg( mFilter->parserErrorString() ) ); - } if ( mFilter ) { + if ( mFilter->hasParserError() ) + { + throw QgsMapServiceException( "RequestNotWellFormed", QString( "OGC expression filter error message: %1." ).arg( mFilter->parserErrorString() ) ); + } QgsFeatureRequest req; if ( layer->wkbType() != QGis::WKBNoGeometry ) { @@ -1607,12 +1607,12 @@ QgsFeatureIds QgsWFSServer::getFeatureIdsFromFilter( QDomElement filterElem, Qgs else { QgsExpression *mFilter = QgsOgcUtils::expressionFromOgcFilter( filterElem ); - if ( mFilter->hasParserError() ) - { - throw QgsMapServiceException( "RequestNotWellFormed", mFilter->parserErrorString() ); - } if ( mFilter ) { + if ( mFilter->hasParserError() ) + { + throw QgsMapServiceException( "RequestNotWellFormed", mFilter->parserErrorString() ); + } QgsFeature feature; const QgsFields& fields = provider->fields(); QgsFeatureIterator fit = layer->getFeatures(); diff --git a/src/mapserver/qgswmsserver.cpp b/src/mapserver/qgswmsserver.cpp index bc72e8fa663..3e4297a3104 100644 --- a/src/mapserver/qgswmsserver.cpp +++ b/src/mapserver/qgswmsserver.cpp @@ -703,6 +703,7 @@ QByteArray* QgsWMSServer::getPrint( const QString& formatString ) return ba; } +#if 0 QImage* QgsWMSServer::printCompositionToImage( QgsComposition* c ) const { int width = ( int )( c->paperWidth() * c->printResolution() / 25.4 ); //width in pixel @@ -718,6 +719,7 @@ QImage* QgsWMSServer::printCompositionToImage( QgsComposition* c ) const p.end(); return image; } +#endif QImage* QgsWMSServer::getMap() { @@ -833,19 +835,15 @@ int QgsWMSServer::getFeatureInfo( QDomDocument& result, QString version ) } //read I,J resp. X,Y - QString iString, jString; - int i = -1; - int j = -1; - - iString = mParameterMap.value( "I", mParameterMap.value( "X" ) ); - i = iString.toInt( &conversionSuccess ); + QString iString = mParameterMap.value( "I", mParameterMap.value( "X" ) ); + int i = iString.toInt( &conversionSuccess ); if ( !conversionSuccess ) { i = -1; } - jString = mParameterMap.value( "J", mParameterMap.value( "Y" ) ); - j = jString.toInt( &conversionSuccess ); + QString jString = mParameterMap.value( "J", mParameterMap.value( "Y" ) ); + int j = jString.toInt( &conversionSuccess ); if ( !conversionSuccess ) { j = -1; @@ -1647,9 +1645,9 @@ QStringList QgsWMSServer::layerSet( const QStringList &layersList, for ( listIndex = layerList.size() - 1; listIndex >= 0; listIndex-- ) { theMapLayer = layerList.at( listIndex ); - QgsDebugMsg( QString( "Checking layer: %1" ).arg( theMapLayer->name() ) ); if ( theMapLayer ) { + QgsDebugMsg( QString( "Checking layer: %1" ).arg( theMapLayer->name() ) ); //test if layer is visible in requested scale bool useScaleConstraint = ( scaleDenominator > 0 && theMapLayer->hasScaleBasedVisibility() ); if ( !useScaleConstraint || diff --git a/src/mapserver/qgswmsserver.h b/src/mapserver/qgswmsserver.h index 3c20b9704b3..921648e5271 100644 --- a/src/mapserver/qgswmsserver.h +++ b/src/mapserver/qgswmsserver.h @@ -168,7 +168,9 @@ class QgsWMSServer void legendParameters( double mmToPixelFactor, double fontOversamplingFactor, double& boxSpace, double& layerSpace, double& layerTitleSpace, double& symbolSpace, double& iconLabelSpace, double& symbolWidth, double& symbolHeight, QFont& layerFont, QFont& itemFont, QColor& layerFontColor, QColor& itemFontColor ); +#if 0 QImage* printCompositionToImage( QgsComposition* c ) const; +#endif /**Apply filter (subset) strings from the request to the layers. Example: '&FILTER=:"AND property > 100",:"AND bla = 'hallo!'" ' @return a map with the original filters ( layer id / filter string )*/ diff --git a/src/plugins/compass/qgscompassplugin.cpp b/src/plugins/compass/qgscompassplugin.cpp index 4fa467a6e54..eff9d7a0ff9 100644 --- a/src/plugins/compass/qgscompassplugin.cpp +++ b/src/plugins/compass/qgscompassplugin.cpp @@ -45,9 +45,9 @@ static const QString sPluginIcon = ":/compass.svn"; * @param qgis Pointer to the QGIS main window * @param _qI Pointer to the QGIS interface object */ -QgsCompassPlugin::QgsCompassPlugin( QgisInterface * themQGisIface ) - : QgisPlugin( sName, sDescription, sCategory, sPluginVersion, sPluginType ), - mQGisIface( themQGisIface ) +QgsCompassPlugin::QgsCompassPlugin( QgisInterface *themQGisIface ) + : QgisPlugin( sName, sDescription, sCategory, sPluginVersion, sPluginType ) + , mQGisIface( themQGisIface ) { /** Initialize the plugin */ mDock = NULL; diff --git a/src/plugins/dxf2shp_converter/builder.cpp b/src/plugins/dxf2shp_converter/builder.cpp index de65a1ae436..54326c155dc 100644 --- a/src/plugins/dxf2shp_converter/builder.cpp +++ b/src/plugins/dxf2shp_converter/builder.cpp @@ -32,20 +32,20 @@ Builder::Builder( std::string theFname, double *theGrpXVals, double *theGrpYVals, std::string *theGrpNames, int theInsertCount, - bool theConvertText ) : - fname( theFname ), - shapefileType( theShapefileType ), - grpXVals( theGrpXVals ), - grpYVals( theGrpYVals ), - grpNames( theGrpNames ), - insertCount( theInsertCount ), - convertText( theConvertText ), - fetchedprims( 0 ), - fetchedtexts( 0 ), - ignoringBlock( false ), - current_polyline_pointcount( 0 ), - currentBlockX( 0.0 ), - currentBlockY( 0.0 ) + bool theConvertText ) + : fname( theFname ) + , shapefileType( theShapefileType ) + , grpXVals( theGrpXVals ) + , grpYVals( theGrpYVals ) + , grpNames( theGrpNames ) + , insertCount( theInsertCount ) + , convertText( theConvertText ) + , fetchedprims( 0 ) + , fetchedtexts( 0 ) + , ignoringBlock( false ) + , current_polyline_pointcount( 0 ) + , currentBlockX( 0.0 ) + , currentBlockY( 0.0 ) { } @@ -529,14 +529,8 @@ void Builder::print_shpObjects() } else { - outputdbf = fname; - outputdbf = outputdbf.append( ".dbf" ); - outputshp = fname; - outputshp = outputdbf.append( ".shp" ); - outputtdbf = fname; - outputtdbf = outputtdbf.append( ".dbf" ); - outputtshp = fname; - outputtshp = outputtdbf.append( ".shp" ); + outputdbf = outputtdbf = fname + ".dbf"; + outputshp = outputtshp = fname + ".shp"; } DBFHandle dbffile = DBFCreate( outputdbf.c_str() ); diff --git a/src/plugins/evis/evis.cpp b/src/plugins/evis/evis.cpp index bf2c240d3ef..c982aa4d51c 100644 --- a/src/plugins/evis/evis.cpp +++ b/src/plugins/evis/evis.cpp @@ -88,20 +88,19 @@ static const QString sIcon = ":/evis/eVisEventBrowser.png"; -eVis::eVis( QgisInterface * theQgisInterface ): - QgisPlugin( sName, sDescription, sCategory, sPluginVersion, sPluginType ), - mQGisIface( theQgisInterface ) +eVis::eVis( QgisInterface * theQgisInterface ) + : QgisPlugin( sName, sDescription, sCategory, sPluginVersion, sPluginType ) + , mQGisIface( theQgisInterface ) { mIdTool = 0; } -eVis::~eVis( ) +eVis::~eVis() { } -void eVis::initGui( ) +void eVis::initGui() { - // Create the action for tool mDatabaseConnectionActionPointer = new QAction( QIcon( ":/evis/eVisDatabaseConnection.png" ), tr( "eVis Database Connection" ), this ); mEventIdToolActionPointer = new QAction( QIcon( ":/evis/eVisEventIdTool.png" ), tr( "eVis Event Id Tool" ), this ); diff --git a/src/plugins/georeferencer/qgsgcplist.cpp b/src/plugins/georeferencer/qgsgcplist.cpp index eaf99062b7e..d596b405ace 100644 --- a/src/plugins/georeferencer/qgsgcplist.cpp +++ b/src/plugins/georeferencer/qgsgcplist.cpp @@ -63,7 +63,7 @@ int QgsGCPList::size() const { if (( *it )->isEnabled() ) s++; - it++; + ++it; } return s; } diff --git a/src/plugins/georeferencer/qgsgeorefplugin.cpp b/src/plugins/georeferencer/qgsgeorefplugin.cpp index 93992e6d84c..2e7536ba3bf 100644 --- a/src/plugins/georeferencer/qgsgeorefplugin.cpp +++ b/src/plugins/georeferencer/qgsgeorefplugin.cpp @@ -78,10 +78,10 @@ static const QString sPluginIcon = ":/icons/default/mGeorefRun.png"; * @param theQGisApp - Pointer to the QGIS main window * @param theQGisInterface - Pointer to the QGIS interface object */ -QgsGeorefPlugin::QgsGeorefPlugin( QgisInterface * theQgisInterface ): - QgisPlugin( sName, sDescription, sCategory, sPluginVersion, sPluginType ), - mQGisIface( theQgisInterface ), - mPluginGui( NULL ) +QgsGeorefPlugin::QgsGeorefPlugin( QgisInterface * theQgisInterface ) + : QgisPlugin( sName, sDescription, sCategory, sPluginVersion, sPluginType ) + , mQGisIface( theQgisInterface ) + , mPluginGui( NULL ) { } diff --git a/src/plugins/georeferencer/qgsgeorefplugingui.cpp b/src/plugins/georeferencer/qgsgeorefplugingui.cpp index 6cb25dea4d6..21e9fc574a3 100644 --- a/src/plugins/georeferencer/qgsgeorefplugingui.cpp +++ b/src/plugins/georeferencer/qgsgeorefplugingui.cpp @@ -734,7 +734,7 @@ void QgsGeorefPluginGui::extentsChangedQGisCanvas() } // Canvas info slots (copy/pasted from QGIS :) ) -void QgsGeorefPluginGui::showMouseCoords( QgsPoint p ) +void QgsGeorefPluginGui::showMouseCoords( const QgsPoint &p ) { mCoordsLabel->setText( p.toString( mMousePrecisionDecimalPlaces ) ); // Set minimum necessary width diff --git a/src/plugins/georeferencer/qgsgeorefplugingui.h b/src/plugins/georeferencer/qgsgeorefplugingui.h index 6581c419ed5..e5298030974 100644 --- a/src/plugins/georeferencer/qgsgeorefplugingui.h +++ b/src/plugins/georeferencer/qgsgeorefplugingui.h @@ -105,7 +105,7 @@ class QgsGeorefPluginGui : public QMainWindow, private Ui::QgsGeorefPluginGuiBas void extentsChangedQGisCanvas(); // canvas info - void showMouseCoords( const QgsPoint pt ); + void showMouseCoords( const QgsPoint &pt ); void updateMouseCoordinatePrecision(); // Histogram stretch diff --git a/src/plugins/georeferencer/qgsgeoreftransform.cpp b/src/plugins/georeferencer/qgsgeoreftransform.cpp index 3d6f4a7b074..c763735a702 100644 --- a/src/plugins/georeferencer/qgsgeoreftransform.cpp +++ b/src/plugins/georeferencer/qgsgeoreftransform.cpp @@ -35,8 +35,8 @@ using std::pow; class QgsLinearGeorefTransform : public QgsGeorefTransformInterface { public: - QgsLinearGeorefTransform() { } - ~QgsLinearGeorefTransform() { } + QgsLinearGeorefTransform() {} + ~QgsLinearGeorefTransform() {} bool getOriginScale( QgsPoint &origin, double &scaleX, double &scaleY ) const; @@ -114,8 +114,8 @@ class QgsGDALGeorefTransform : public QgsGeorefTransformInterface class QgsProjectiveGeorefTransform : public QgsGeorefTransformInterface { public: - QgsProjectiveGeorefTransform() { } - ~QgsProjectiveGeorefTransform() { } + QgsProjectiveGeorefTransform() {} + ~QgsProjectiveGeorefTransform() {} bool updateParametersFromGCPs( const std::vector &mapCoords, const std::vector &pixelCoords ); uint getMinimumGCPCount() const; diff --git a/src/plugins/georeferencer/qgsimagewarper.cpp b/src/plugins/georeferencer/qgsimagewarper.cpp index 1690d2b3d9e..41c9d7addb7 100644 --- a/src/plugins/georeferencer/qgsimagewarper.cpp +++ b/src/plugins/georeferencer/qgsimagewarper.cpp @@ -282,7 +282,8 @@ void *QgsImageWarper::addGeoToPixelTransform( GDALTransformerFunc GDALTransforme if ( !GDALInvGeoTransform( chain->adfGeotransform, chain->adfInvGeotransform ) ) { // Error handling if inversion fails - although the inverse transform is not needed for warp operation - return NULL; + delete chain; + return 0; } return ( void* )chain; } diff --git a/src/plugins/georeferencer/qgsleastsquares.cpp b/src/plugins/georeferencer/qgsleastsquares.cpp index 61aee9dc4ec..8e574e40647 100644 --- a/src/plugins/georeferencer/qgsleastsquares.cpp +++ b/src/plugins/georeferencer/qgsleastsquares.cpp @@ -179,7 +179,7 @@ void QgsLeastSquares::affine( std::vector mapCoords, * * Also returns 3x3 homogenous matrices which can be used to normalize and de-normalize coordinates. */ -void normalizeCoordinates( const std::vector coords, std::vector &normalizedCoords, +void normalizeCoordinates( const std::vector &coords, std::vector &normalizedCoords, double normalizeMatrix[9], double denormalizeMatrix[9] ) { // Calculate center of gravity diff --git a/src/plugins/georeferencer/qgsmapcoordsdialog.cpp b/src/plugins/georeferencer/qgsmapcoordsdialog.cpp index 1c61768677b..234a500b169 100644 --- a/src/plugins/georeferencer/qgsmapcoordsdialog.cpp +++ b/src/plugins/georeferencer/qgsmapcoordsdialog.cpp @@ -21,7 +21,7 @@ #include "qgsgeorefvalidators.h" #include "qgsmapcoordsdialog.h" -QgsMapCoordsDialog::QgsMapCoordsDialog( QgsMapCanvas* qgisCanvas, QgsPoint pixelCoords, QWidget* parent ) +QgsMapCoordsDialog::QgsMapCoordsDialog( QgsMapCanvas* qgisCanvas, const QgsPoint &pixelCoords, QWidget* parent ) : QDialog( parent, Qt::Dialog ), mQgisCanvas( qgisCanvas ), mPixelCoords( pixelCoords ) { setupUi( this ); diff --git a/src/plugins/georeferencer/qgsmapcoordsdialog.h b/src/plugins/georeferencer/qgsmapcoordsdialog.h index 9ea984020f2..89c5d863681 100644 --- a/src/plugins/georeferencer/qgsmapcoordsdialog.h +++ b/src/plugins/georeferencer/qgsmapcoordsdialog.h @@ -46,7 +46,7 @@ class QgsMapCoordsDialog : public QDialog, private Ui::QgsMapCoordsDialogBase Q_OBJECT public: - QgsMapCoordsDialog( QgsMapCanvas* qgisCanvas, const QgsPoint pixelCoords, QWidget* parent = 0 ); + QgsMapCoordsDialog( QgsMapCanvas *qgisCanvas, const QgsPoint &pixelCoords, QWidget *parent = 0 ); ~QgsMapCoordsDialog(); private slots: diff --git a/src/plugins/globe/globe_plugin.cpp b/src/plugins/globe/globe_plugin.cpp index 57283d0c9c8..4bb923e1a82 100644 --- a/src/plugins/globe/globe_plugin.cpp +++ b/src/plugins/globe/globe_plugin.cpp @@ -798,7 +798,7 @@ void GlobePlugin::elevationLayersChanged() // Remove elevation layers ElevationLayerVector list; map->getElevationLayers( list ); - for ( ElevationLayerVector::iterator i = list.begin(); i != list.end(); i++ ) + for ( ElevationLayerVector::iterator i = list.begin(); i != list.end(); ++i ) { map->removeElevationLayer( *i ); } diff --git a/src/plugins/globe/osgEarthUtil/Controls.cpp b/src/plugins/globe/osgEarthUtil/Controls.cpp index 19cda0828c2..0d5c1fb56c8 100644 --- a/src/plugins/globe/osgEarthUtil/Controls.cpp +++ b/src/plugins/globe/osgEarthUtil/Controls.cpp @@ -1799,7 +1799,7 @@ ControlNodeBin::draw( const ControlContext& context, bool newContext, int bin ) if ( _sortingEnabled && _sortByDistance ) { - for( ControlNodeCollection::iterator i = _controlNodes.begin(); i != _controlNodes.end(); i++) + for( ControlNodeCollection::iterator i = _controlNodes.begin(); i != _controlNodes.end(); ++i ) { ControlNode* node = i->second.get(); if ( node->getNumParents() == 0 ) diff --git a/src/plugins/grass/qgsgrassmapcalc.cpp b/src/plugins/grass/qgsgrassmapcalc.cpp index 8bfa1b74aa3..d6dde8c1649 100644 --- a/src/plugins/grass/qgsgrassmapcalc.cpp +++ b/src/plugins/grass/qgsgrassmapcalc.cpp @@ -1479,7 +1479,7 @@ void QgsGrassMapcalc::clear() } /******************** CANVAS ITEMS ******************************/ -QgsGrassMapcalcItem::QgsGrassMapcalcItem(): mSelected( false ) +QgsGrassMapcalcItem::QgsGrassMapcalcItem() : mSelected( false ) { QgsDebugMsg( "entered." ); } @@ -1500,9 +1500,12 @@ bool QgsGrassMapcalcItem::selected() /**************************** OBJECT ************************/ QgsGrassMapcalcObject::QgsGrassMapcalcObject( int type ) - : QGraphicsRectItem( -1000, -1000, 50, 20, 0 ), QgsGrassMapcalcItem(), - mType( type ), mCenter( -1000, -1000 ), mSelectionBoxSize( 5 ), - mOutputConnector( 0 ) + : QGraphicsRectItem( -1000, -1000, 50, 20, 0 ) + , QgsGrassMapcalcItem() + , mType( type ) + , mCenter( -1000, -1000 ) + , mSelectionBoxSize( 5 ) + , mOutputConnector( 0 ) { QgsDebugMsg( "entered." ); diff --git a/src/plugins/grass/qgsgrassmodel.cpp b/src/plugins/grass/qgsgrassmodel.cpp index b2a79a1c429..c5cd2d52f4a 100644 --- a/src/plugins/grass/qgsgrassmodel.cpp +++ b/src/plugins/grass/qgsgrassmodel.cpp @@ -74,7 +74,9 @@ class QgsGrassModelItem }; QgsGrassModelItem::QgsGrassModelItem() - : mParent( 0 ), mType( QgsGrassModel::None ), mPopulated( false ) + : mParent( 0 ) + , mType( QgsGrassModel::None ) + , mPopulated( false ) { } diff --git a/src/plugins/grass/qgsgrassmodule.cpp b/src/plugins/grass/qgsgrassmodule.cpp index 5c30583c623..acd195593b7 100644 --- a/src/plugins/grass/qgsgrassmodule.cpp +++ b/src/plugins/grass/qgsgrassmodule.cpp @@ -562,7 +562,6 @@ QgsGrassModuleStandardOptions::QgsGrassModuleStandardOptions( mModule, key, e, gDocElem, gnode, mDirect, mParent ); layout->addWidget( so ); - created = true; mItems.push_back( so ); } } diff --git a/src/plugins/grass/qgsgrassplugin.cpp b/src/plugins/grass/qgsgrassplugin.cpp index 0bfe0821e8d..e2b00e5736e 100644 --- a/src/plugins/grass/qgsgrassplugin.cpp +++ b/src/plugins/grass/qgsgrassplugin.cpp @@ -57,14 +57,15 @@ static const QString pluginIcon = ":/images/themes/default/grass/grass_tools.png * @param theQGisApp Pointer to the QGIS main window * @param theQgisInterFace Pointer to the QGIS interface object */ -QgsGrassPlugin::QgsGrassPlugin( QgisInterface * theQgisInterFace ): - qGisInterface( theQgisInterFace ), mTools( NULL ), mEdit( NULL ) +QgsGrassPlugin::QgsGrassPlugin( QgisInterface * theQgisInterFace ) + : qGisInterface( theQgisInterFace ) + , mTools( 0 ) + , mEdit( 0 ) + , pluginNameQString( tr( "GrassVector" ) ) + , pluginVersionQString( tr( "0.1" ) ) + , pluginDescriptionQString( tr( "GRASS layer" ) ) + , pluginCategoryQString( tr( "Plugins" ) ) { - /** Initialize the plugin and set the required attributes */ - pluginNameQString = tr( "GrassVector" ); - pluginVersionQString = tr( "0.1" ); - pluginDescriptionQString = tr( "GRASS layer" ); - pluginCategoryQString = tr( "Plugins" ); } QgsGrassPlugin::~QgsGrassPlugin() @@ -899,7 +900,7 @@ void QgsGrassPlugin::setCurrentTheme( QString theThemeName ) // I didnt want to make plugins dependent on qgsapplication // and because it needs grass specific path into // the GRASS plugin resource bundle [TS] -QIcon QgsGrassPlugin::getThemeIcon( const QString theName ) +QIcon QgsGrassPlugin::getThemeIcon( const QString &theName ) { QString myCurThemePath = QgsApplication::activeThemePath() + "/grass/" + theName; QString myDefThemePath = QgsApplication::defaultThemePath() + "/grass/" + theName; diff --git a/src/plugins/grass/qgsgrassplugin.h b/src/plugins/grass/qgsgrassplugin.h index 84072c7f70b..505c71a7579 100644 --- a/src/plugins/grass/qgsgrassplugin.h +++ b/src/plugins/grass/qgsgrassplugin.h @@ -80,7 +80,7 @@ class QgsGrassPlugin : public QObject, public QgisPlugin //! Set Region Pen void setRegionPen( QPen & ); //! Get an icon from the active theme if possible - static QIcon getThemeIcon( const QString theName ); + static QIcon getThemeIcon( const QString &theName ); public slots: //! init the gui diff --git a/src/plugins/grass/qgsgrasstools.cpp b/src/plugins/grass/qgsgrasstools.cpp index 4a3d86ba12f..5a0503ad40e 100644 --- a/src/plugins/grass/qgsgrasstools.cpp +++ b/src/plugins/grass/qgsgrasstools.cpp @@ -202,7 +202,7 @@ void QgsGrassTools::runModule( QString name, bool direct ) if ( name.length() == 0 ) return; // Section -#ifndef WIN32 +#ifdef HAVE_OPENPTY QgsGrassShell* sh = 0; #endif @@ -262,7 +262,7 @@ void QgsGrassTools::runModule( QString name, bool direct ) /* TODO: Implement something that resizes the terminal without * crashes. */ -#ifndef WIN32 +#ifdef HAVE_OPENPTY if ( sh ) sh->resizeTerminal(); #endif diff --git a/src/plugins/heatmap/heatmap.cpp b/src/plugins/heatmap/heatmap.cpp index 880c59376bd..3adf591889e 100644 --- a/src/plugins/heatmap/heatmap.cpp +++ b/src/plugins/heatmap/heatmap.cpp @@ -65,9 +65,9 @@ static const QString sPluginIcon = ":/heatmap/heatmap.png"; * an interface object that provides access to exposed functions in QGIS. * @param theQGisInterface - Pointer to the QGIS interface object */ -Heatmap::Heatmap( QgisInterface * theQgisInterface ): - QgisPlugin( sName, sDescription, sCategory, sPluginVersion, sPluginType ), - mQGisIface( theQgisInterface ) +Heatmap::Heatmap( QgisInterface * theQgisInterface ) + : QgisPlugin( sName, sDescription, sCategory, sPluginVersion, sPluginType ) + , mQGisIface( theQgisInterface ) { } @@ -82,7 +82,6 @@ Heatmap::~Heatmap() */ void Heatmap::initGui() { - // Create the action for tool mQActionPointer = new QAction( QIcon( ":/heatmap/heatmap.png" ), tr( "Heatmap" ), this ); // Set the what's this text diff --git a/src/plugins/interpolation/qgsinterpolationdialog.cpp b/src/plugins/interpolation/qgsinterpolationdialog.cpp index 6c3b058e515..97277e2ffc1 100644 --- a/src/plugins/interpolation/qgsinterpolationdialog.cpp +++ b/src/plugins/interpolation/qgsinterpolationdialog.cpp @@ -348,7 +348,6 @@ QgsVectorLayer* QgsInterpolationDialog::vectorLayerFromName( const QString& name if ( layer_it.value()->name() == name ) { return qobject_cast( layer_it.value() ); - break; } } diff --git a/src/plugins/oracle_raster/qgsoracle_plugin.cpp b/src/plugins/oracle_raster/qgsoracle_plugin.cpp index 558aa7329d1..3b32d76ecc1 100644 --- a/src/plugins/oracle_raster/qgsoracle_plugin.cpp +++ b/src/plugins/oracle_raster/qgsoracle_plugin.cpp @@ -36,9 +36,9 @@ static const QString sPluginIcon = ":/oracleplugin/oracleraster.svg"; * an interface object that provides access to exposed functions in QGIS. * @param theQGisInterface - Pointer to the QGIS interface object */ -QgsOraclePlugin::QgsOraclePlugin( QgisInterface * theQgisInterface ) : - QgisPlugin( sName, sDescription, sCategory, sPluginVersion, sPluginType ), - mQGisIface( theQgisInterface ) +QgsOraclePlugin::QgsOraclePlugin( QgisInterface * theQgisInterface ) + : QgisPlugin( sName, sDescription, sCategory, sPluginVersion, sPluginType ) + , mQGisIface( theQgisInterface ) { } diff --git a/src/plugins/roadgraph/roadgraphplugin.cpp b/src/plugins/roadgraph/roadgraphplugin.cpp index 26c2e9edfad..dbf4be35b31 100644 --- a/src/plugins/roadgraph/roadgraphplugin.cpp +++ b/src/plugins/roadgraph/roadgraphplugin.cpp @@ -74,9 +74,9 @@ static const QgisPlugin::PLUGINTYPE sPluginType = QgisPlugin::UI; * an interface object that provides access to exposed functions in QGIS. * @param theQgisInterface - Pointer to the QGIS interface object */ -RoadGraphPlugin::RoadGraphPlugin( QgisInterface * theQgisInterface ): - QgisPlugin( sName, sDescription, sCategory, sPluginVersion, sPluginType ), - mQGisIface( theQgisInterface ) +RoadGraphPlugin::RoadGraphPlugin( QgisInterface * theQgisInterface ) + : QgisPlugin( sName, sDescription, sCategory, sPluginVersion, sPluginType ) + , mQGisIface( theQgisInterface ) { mQShortestPathDock = NULL; diff --git a/src/plugins/spatialquery/qgsgeometrycoordinatetransform.h b/src/plugins/spatialquery/qgsgeometrycoordinatetransform.h index 4a9844a4a94..9de9c3e94c6 100644 --- a/src/plugins/spatialquery/qgsgeometrycoordinatetransform.h +++ b/src/plugins/spatialquery/qgsgeometrycoordinatetransform.h @@ -33,7 +33,7 @@ class QgsGeometryCoordinateTransform * \brief Constructor for a Geometry Coordinate Transform. * */ - QgsGeometryCoordinateTransform() {}; + QgsGeometryCoordinateTransform() {} /** * \brief Destructor diff --git a/src/plugins/spatialquery/qgsreaderfeatures.cpp b/src/plugins/spatialquery/qgsreaderfeatures.cpp index 512992d927d..1c670f38beb 100644 --- a/src/plugins/spatialquery/qgsreaderfeatures.cpp +++ b/src/plugins/spatialquery/qgsreaderfeatures.cpp @@ -70,7 +70,7 @@ bool QgsReaderFeatures::nextFeatureSelected( QgsFeature & feature ) return false; feature = *mIterSelectedFeature; - mIterSelectedFeature++; + ++mIterSelectedFeature; return true; } // bool QgsReaderFeatures::nextFeatureSelected( QgsFeature &feature ) diff --git a/src/plugins/spatialquery/qgsspatialquery.cpp b/src/plugins/spatialquery/qgsspatialquery.cpp index dce2bcde5f0..5588a2e14ec 100644 --- a/src/plugins/spatialquery/qgsspatialquery.cpp +++ b/src/plugins/spatialquery/qgsspatialquery.cpp @@ -27,7 +27,6 @@ QgsSpatialQuery::QgsSpatialQuery( MngProgressBar *pb ) { mPb = pb; mUseTargetSelection = mUseReferenceSelection = false; - } // QgsSpatialQuery::QgsSpatialQuery(MngProgressBar *pb) QgsSpatialQuery::~QgsSpatialQuery() @@ -291,7 +290,7 @@ void QgsSpatialQuery::populateIndexResult( QgsFeature featureReference; QgsGeometry * geomReference; QList::iterator iterIdReference = listIdReference.begin(); - for ( ; iterIdReference != listIdReference.end(); iterIdReference++ ) + for ( ; iterIdReference != listIdReference.end(); ++iterIdReference ) { mLayerReference->getFeatures( QgsFeatureRequest().setFilterFid( *iterIdReference ) ).nextFeature( featureReference ); geomReference = featureReference.geometry(); @@ -319,7 +318,7 @@ void QgsSpatialQuery::populateIndexResultDisjoint( QgsGeometry * geomReference; QList::iterator iterIdReference = listIdReference.begin(); bool addIndex = true; - for ( ; iterIdReference != listIdReference.end(); iterIdReference++ ) + for ( ; iterIdReference != listIdReference.end(); ++iterIdReference ) { mLayerReference->getFeatures( QgsFeatureRequest().setFilterFid( *iterIdReference ) ).nextFeature( featureReference ); geomReference = featureReference.geometry(); diff --git a/src/plugins/spatialquery/qgsspatialquerydialog.cpp b/src/plugins/spatialquery/qgsspatialquerydialog.cpp index fff011af759..d849991d2d1 100644 --- a/src/plugins/spatialquery/qgsspatialquerydialog.cpp +++ b/src/plugins/spatialquery/qgsspatialquerydialog.cpp @@ -1077,8 +1077,3 @@ void QgsSpatialQueryDialog::signal_layerReference_selectionFeaturesChanged() { evaluateCheckBoxLayer( false ); } // void QgsSpatialQueryDialog::signal_layerReference_selectionFeaturesChanged() - -void QgsSpatialQueryDialog::MsgDEBUG( QString sMSg ) -{ - QMessageBox::warning( 0, tr( "DEBUG" ), sMSg, QMessageBox::Ok ); -} diff --git a/src/plugins/spit/qgsspit.cpp b/src/plugins/spit/qgsspit.cpp index c25c7bfb0c7..4de66f5a1f7 100644 --- a/src/plugins/spit/qgsspit.cpp +++ b/src/plugins/spit/qgsspit.cpp @@ -282,7 +282,7 @@ void QgsSpit::removeFile() for ( int n = 0; n < tblShapefiles->rowCount(); n++ ) if ( tblShapefiles->isItemSelected( tblShapefiles->item( n, 0 ) ) ) { - for ( QVector::iterator vit = fileList.begin(); vit != fileList.end(); vit++ ) + for ( QVector::iterator vit = fileList.begin(); vit != fileList.end(); ++vit ) { if (( *vit ) ->getName() == tblShapefiles->item( n, 0 )->text() ) { @@ -584,13 +584,11 @@ void QgsSpit::import() // Check and set destination table fileList[ i ] ->setTable( tblShapefiles->item( i, ColDBRELATIONNAME )->text() ); pro.setLabelText( tr( "Importing files\n%1" ).arg( tblShapefiles->item( i, ColFILENAME )->text() ) ); - bool rel_exists1 = false; - bool rel_exists2 = false; query = QString( "SELECT f_table_name FROM geometry_columns WHERE f_table_name=%1 AND f_table_schema=%2" ) .arg( QgsPgUtil::quotedValue( tblShapefiles->item( i, ColDBRELATIONNAME )->text() ) ) .arg( QgsPgUtil::quotedValue( tblShapefiles->item( i, ColDBSCHEMA )->text() ) ); res = PQexec( conn, query.toUtf8() ); - rel_exists1 = ( PQntuples( res ) > 0 ); + bool rel_exists1 = ( PQntuples( res ) > 0 ); if ( PQresultStatus( res ) != PGRES_TUPLES_OK ) { @@ -610,7 +608,7 @@ void QgsSpit::import() .arg( QgsPgUtil::quotedValue( tblShapefiles->item( i, ColDBSCHEMA )->text() ) ); res = PQexec( conn, query.toUtf8() ); - rel_exists2 = ( PQntuples( res ) > 0 ); + bool rel_exists2 = ( PQntuples( res ) > 0 ); if ( PQresultStatus( res ) != PGRES_TUPLES_OK ) { @@ -857,7 +855,6 @@ QWidget *ShapefileTableDelegate::createEditor( QWidget *parent, editor->setSizeAdjustPolicy( QComboBox::AdjustToContents ); editor->installEventFilter( const_cast( this ) ); return editor; - break; } case 1: case 3: @@ -865,7 +862,6 @@ QWidget *ShapefileTableDelegate::createEditor( QWidget *parent, QLineEdit* editor = new QLineEdit( parent ); editor->installEventFilter( const_cast( this ) ); return editor; - break; } } return NULL; diff --git a/src/plugins/spit/qgsspit.h b/src/plugins/spit/qgsspit.h index aaf0a6bd5b6..9c5cb72b7b2 100644 --- a/src/plugins/spit/qgsspit.h +++ b/src/plugins/spit/qgsspit.h @@ -128,8 +128,8 @@ class ShapefileTableDelegate : public QItemDelegate Q_OBJECT public: - ShapefileTableDelegate( QObject *parent, QStringList& schema_list ) : - mSchemaList( schema_list ) + ShapefileTableDelegate( QObject *parent, QStringList& schema_list ) + : mSchemaList( schema_list ) { Q_UNUSED( parent ); } QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, diff --git a/src/plugins/spit/qgsspitplugin.cpp b/src/plugins/spit/qgsspitplugin.cpp index b030623d9f2..a84d8a98235 100644 --- a/src/plugins/spit/qgsspitplugin.cpp +++ b/src/plugins/spit/qgsspitplugin.cpp @@ -46,9 +46,9 @@ static const QString icon_ = ":/spit.png"; * @parma _qI Pointer to the QGIS interface object */ QgsSpitPlugin::QgsSpitPlugin( QgisInterface * _qI ) - : QgisPlugin( name_, description_, category_, version_, type_ ), - qgisMainWindow( _qI->mainWindow() ), - qI( _qI ) + : QgisPlugin( name_, description_, category_, version_, type_ ) + , qgisMainWindow( _qI->mainWindow() ) + , qI( _qI ) { } diff --git a/src/plugins/sqlanywhere/sqlanywhere.cpp b/src/plugins/sqlanywhere/sqlanywhere.cpp index f3084badb59..16351332a3c 100644 --- a/src/plugins/sqlanywhere/sqlanywhere.cpp +++ b/src/plugins/sqlanywhere/sqlanywhere.cpp @@ -58,9 +58,9 @@ static const QString sIcon = ":/sqlanywhere/sqlanywhere.svg"; * an interface object that provides access to exposed functions in QGIS. * @param theQGisInterface - Pointer to the QGIS interface object */ -SqlAnywhere::SqlAnywhere( QgisInterface * theQgisInterface ): - QgisPlugin( sName, sDescription, sCategory, sPluginVersion, sPluginType ), - mQGisIface( theQgisInterface ) +SqlAnywhere::SqlAnywhere( QgisInterface * theQgisInterface ) + : QgisPlugin( sName, sDescription, sCategory, sPluginVersion, sPluginType ) + , mQGisIface( theQgisInterface ) { } diff --git a/src/plugins/topology/topol.cpp b/src/plugins/topology/topol.cpp index 104a72b140a..d4385c637f6 100644 --- a/src/plugins/topology/topol.cpp +++ b/src/plugins/topology/topol.cpp @@ -49,9 +49,9 @@ static const QString sPluginIcon = ":/topology/topol.png"; * an interface object that provides access to exposed functions in QGIS. * @param theQGisInterface - Pointer to the QGIS interface object */ -Topol::Topol( QgisInterface * theQgisInterface ): - QgisPlugin( sName, sDescription, sCategory, sPluginVersion, sPluginType ), - mQGisIface( theQgisInterface ) +Topol::Topol( QgisInterface * theQgisInterface ) + : QgisPlugin( sName, sDescription, sCategory, sPluginVersion, sPluginType ) + , mQGisIface( theQgisInterface ) { mDock = 0; } diff --git a/src/plugins/zonal_statistics/qgszonalstatisticsplugin.cpp b/src/plugins/zonal_statistics/qgszonalstatisticsplugin.cpp index bdc8e68031c..a41797c6d9e 100644 --- a/src/plugins/zonal_statistics/qgszonalstatisticsplugin.cpp +++ b/src/plugins/zonal_statistics/qgszonalstatisticsplugin.cpp @@ -31,12 +31,10 @@ static const QString pluginIcon_ = ":/zonal_statistics/raster-stats.png"; QgsZonalStatisticsPlugin::QgsZonalStatisticsPlugin( QgisInterface* iface ): mIface( iface ), mAction( 0 ) { - } QgsZonalStatisticsPlugin::~QgsZonalStatisticsPlugin() { - } void QgsZonalStatisticsPlugin::initGui() diff --git a/src/providers/delimitedtext/qgsdelimitedtextfile.cpp b/src/providers/delimitedtext/qgsdelimitedtextfile.cpp index 8ba0d7df50a..88650589971 100644 --- a/src/providers/delimitedtext/qgsdelimitedtextfile.cpp +++ b/src/providers/delimitedtext/qgsdelimitedtextfile.cpp @@ -374,7 +374,6 @@ QString QgsDelimitedTextFile::encodeChars( QString chars ) void QgsDelimitedTextFile::setTypeCSV( QString delim, QString quote, QString escape ) { resetDefinition(); - mType = DelimTypeRegexp; mType = DelimTypeCSV; mDelimChars = decodeChars( delim ); mQuoteChar = decodeChars( quote ); diff --git a/src/providers/gdal/qgsgdalprovider.cpp b/src/providers/gdal/qgsgdalprovider.cpp index e3a2f204436..b7e10f69fd9 100644 --- a/src/providers/gdal/qgsgdalprovider.cpp +++ b/src/providers/gdal/qgsgdalprovider.cpp @@ -94,7 +94,7 @@ int CPL_STDCALL progressCallback( double dfComplete, return true; } -QgsGdalProvider::QgsGdalProvider( QString const & uri, QgsError error ) +QgsGdalProvider::QgsGdalProvider( const QString &uri, QgsError error ) : QgsRasterDataProvider( uri ) , mValid( false ) , mGdalBaseDataset( 0 ) @@ -103,7 +103,7 @@ QgsGdalProvider::QgsGdalProvider( QString const & uri, QgsError error ) setError( error ); } -QgsGdalProvider::QgsGdalProvider( QString const & uri, bool update ) +QgsGdalProvider::QgsGdalProvider( const QString &uri, bool update ) : QgsRasterDataProvider( uri ) , QgsGdalProviderBase() , mUpdate( update ) diff --git a/src/providers/grass/qgsgrassgislib.h b/src/providers/grass/qgsgrassgislib.h index a4d4f7d242c..0c96eb0ec7b 100644 --- a/src/providers/grass/qgsgrassgislib.h +++ b/src/providers/grass/qgsgrassgislib.h @@ -65,7 +65,7 @@ class GRASS_LIB_EXPORT QgsGrassGisLib QgsRasterInterface *input; int band; int row; // next row to be written - Raster(): provider( 0 ), projector( 0 ), input( 0 ), band( 1 ), row( 0 ) {} + Raster() : provider( 0 ), projector( 0 ), input( 0 ), band( 1 ), row( 0 ) {} double noDataValue; // output no data value }; diff --git a/src/providers/memory/qgsmemoryfeatureiterator.cpp b/src/providers/memory/qgsmemoryfeatureiterator.cpp index 246d41684cc..c0973276726 100644 --- a/src/providers/memory/qgsmemoryfeatureiterator.cpp +++ b/src/providers/memory/qgsmemoryfeatureiterator.cpp @@ -95,14 +95,14 @@ bool QgsMemoryFeatureIterator::nextFeatureUsingList( QgsFeature& feature ) if ( hasFeature ) break; - mFeatureIdListIterator++; + ++mFeatureIdListIterator; } // copy feature if ( hasFeature ) { feature = P->mFeatures[*mFeatureIdListIterator]; - mFeatureIdListIterator++; + ++mFeatureIdListIterator; } else close(); @@ -145,14 +145,14 @@ bool QgsMemoryFeatureIterator::nextFeatureTraverseAll( QgsFeature& feature ) if ( hasFeature ) break; - mSelectIterator++; + ++mSelectIterator; } // copy feature if ( hasFeature ) { feature = mSelectIterator.value(); - mSelectIterator++; + ++mSelectIterator; feature.setValid( true ); feature.setFields( &P->mFields ); // allow name-based attribute lookups } diff --git a/src/providers/mssql/qgsmssqldataitems.cpp b/src/providers/mssql/qgsmssqldataitems.cpp index cc5f5587045..eebbb48d6fb 100644 --- a/src/providers/mssql/qgsmssqldataitems.cpp +++ b/src/providers/mssql/qgsmssqldataitems.cpp @@ -255,18 +255,18 @@ void QgsMssqlConnectionItem::setLayerType( QgsMssqlLayerProperty layerProperty ) } } - foreach ( QgsDataItem *layerItem, schemaItem->children() ) - { - if ( layerItem->name() == layerProperty.tableName ) - return; // already added - } - if ( !schemaItem ) { QgsDebugMsg( QString( "schema item for %1 not found." ).arg( layerProperty.schemaName ) ); return; } + foreach ( QgsDataItem *layerItem, schemaItem->children() ) + { + if ( layerItem->name() == layerProperty.tableName ) + return; // already added + } + QStringList typeList = layerProperty.type.split( ",", QString::SkipEmptyParts ); QStringList sridList = layerProperty.srid.split( ",", QString::SkipEmptyParts ); Q_ASSERT( typeList.size() == sridList.size() ); diff --git a/src/providers/mssql/qgsmssqlfeatureiterator.cpp b/src/providers/mssql/qgsmssqlfeatureiterator.cpp index 2b47ada92a9..04ac88ae7ca 100644 --- a/src/providers/mssql/qgsmssqlfeatureiterator.cpp +++ b/src/providers/mssql/qgsmssqlfeatureiterator.cpp @@ -175,7 +175,6 @@ void QgsMssqlFeatureIterator::BuildStatement( const QgsFeatureRequest& request ) mStatement += " where (" + mProvider->mSqlWhereClause + ")"; else mStatement += " and (" + mProvider->mSqlWhereClause + ")"; - filterAdded = true; } if ( fieldCount == 0 ) diff --git a/src/providers/mssql/qgsmssqlsourceselect.cpp b/src/providers/mssql/qgsmssqlsourceselect.cpp index 134f3899bfb..42b4870e78c 100644 --- a/src/providers/mssql/qgsmssqlsourceselect.cpp +++ b/src/providers/mssql/qgsmssqlsourceselect.cpp @@ -725,6 +725,7 @@ QgsMssqlGeomColumnTypeThread::QgsMssqlGeomColumnTypeThread( QString connectionNa : QThread() , mConnectionName( connectionName ) , mUseEstimatedMetadata( useEstimatedMetadata ) + , mStopped( false ) { qRegisterMetaType( "QgsMssqlLayerProperty" ); } diff --git a/src/providers/ogr/qgsogrprovider.cpp b/src/providers/ogr/qgsogrprovider.cpp index de940af05b4..80bb669b778 100644 --- a/src/providers/ogr/qgsogrprovider.cpp +++ b/src/providers/ogr/qgsogrprovider.cpp @@ -2027,7 +2027,6 @@ QGISEXTERN bool createEmptyDataSource( const QString &uri, { QgsMessageLog::logMessage( QObject::tr( "Unknown vector type of %1" ).arg(( int )( vectortype ) ), QObject::tr( "OGR" ) ); return false; - break; } } diff --git a/src/providers/oracle/qgsoraclecolumntypethread.cpp b/src/providers/oracle/qgsoraclecolumntypethread.cpp index df225fe2c47..4391cba34c1 100644 --- a/src/providers/oracle/qgsoraclecolumntypethread.cpp +++ b/src/providers/oracle/qgsoraclecolumntypethread.cpp @@ -25,6 +25,7 @@ QgsOracleColumnTypeThread::QgsOracleColumnTypeThread( QString name, bool useEsti , mName( name ) , mUseEstimatedMetadata( useEstimatedMetadata ) , mAllowGeometrylessTables( allowGeometrylessTables ) + , mStopped( false ) { qRegisterMetaType( "QgsOracleLayerProperty" ); } diff --git a/src/providers/oracle/qgsoracleprovider.cpp b/src/providers/oracle/qgsoracleprovider.cpp index 0790e396e1f..2baa9d8545a 100644 --- a/src/providers/oracle/qgsoracleprovider.cpp +++ b/src/providers/oracle/qgsoracleprovider.cpp @@ -1288,7 +1288,7 @@ bool QgsOracleProvider::addFeatures( QgsFeatureList &flist ) throw OracleException( tr( "Could not prepare insert statement" ), qry ); } - for ( QgsFeatureList::iterator features = flist.begin(); features != flist.end(); features++ ) + for ( QgsFeatureList::iterator features = flist.begin(); features != flist.end(); ++features ) { const QgsAttributes &attributevec = features->attributes(); @@ -1345,7 +1345,7 @@ bool QgsOracleProvider::addFeatures( QgsFeatureList &flist ) // update feature ids if ( mPrimaryKeyType == pktInt || mPrimaryKeyType == pktFidMap ) { - for ( QgsFeatureList::iterator features = flist.begin(); features != flist.end(); features++ ) + for ( QgsFeatureList::iterator features = flist.begin(); features != flist.end(); ++features ) { const QgsAttributes &attributevec = features->attributes(); @@ -1804,7 +1804,6 @@ void QgsOracleProvider::appendGeomParam( const QgsGeometry *geom, QSqlQuery &qry g.ordinates << *ptr.dPtr++; if ( dim == 3 ) g.ordinates << *ptr.dPtr++; - iOrdinate += dim; } } break; diff --git a/src/providers/postgres/qgspostgresfeatureiterator.cpp b/src/providers/postgres/qgspostgresfeatureiterator.cpp index 651abf8be82..6c088ab4452 100644 --- a/src/providers/postgres/qgspostgresfeatureiterator.cpp +++ b/src/providers/postgres/qgspostgresfeatureiterator.cpp @@ -178,7 +178,7 @@ bool QgsPostgresFeatureIterator::rewind() // move cursor to first record P->mConnectionRO->PQexecNR( QString( "move absolute 0 in %1" ).arg( mCursorName ) ); - mFeatureQueue.empty(); + mFeatureQueue.clear(); mFetched = 0; return true; @@ -361,8 +361,8 @@ bool QgsPostgresFeatureIterator::getFeature( QgsPostgresResult &queryResult, int if ( returnedLength > 0 ) { unsigned char *featureGeom = new unsigned char[returnedLength + 1]; - memset( featureGeom, 0, returnedLength + 1 ); memcpy( featureGeom, PQgetvalue( queryResult.result(), row, col ), returnedLength ); + memset( featureGeom + returnedLength, 0, 1 ); // modify 2.5D WKB types to make them compliant with OGR unsigned int wkbType; diff --git a/src/providers/postgres/qgspostgresprovider.cpp b/src/providers/postgres/qgspostgresprovider.cpp index add3d9781fc..dd97bf14bb8 100644 --- a/src/providers/postgres/qgspostgresprovider.cpp +++ b/src/providers/postgres/qgspostgresprovider.cpp @@ -1707,7 +1707,7 @@ bool QgsPostgresProvider::addFeatures( QgsFeatureList &flist ) if ( stmt.PQresultStatus() != PGRES_COMMAND_OK ) throw PGException( stmt ); - for ( QgsFeatureList::iterator features = flist.begin(); features != flist.end(); features++ ) + for ( QgsFeatureList::iterator features = flist.begin(); features != flist.end(); ++features ) { const QgsAttributes &attrs = features->attributes(); @@ -1756,7 +1756,7 @@ bool QgsPostgresProvider::addFeatures( QgsFeatureList &flist ) // update feature ids if ( mPrimaryKeyType == pktInt || mPrimaryKeyType == pktFidMap ) { - for ( QgsFeatureList::iterator features = flist.begin(); features != flist.end(); features++ ) + for ( QgsFeatureList::iterator features = flist.begin(); features != flist.end(); ++features ) { const QgsAttributes &attrs = features->attributes(); diff --git a/src/providers/spatialite/qgsspatialiteprovider.cpp b/src/providers/spatialite/qgsspatialiteprovider.cpp index fda8af5abc0..8f27dbbc25a 100644 --- a/src/providers/spatialite/qgsspatialiteprovider.cpp +++ b/src/providers/spatialite/qgsspatialiteprovider.cpp @@ -902,10 +902,9 @@ int QgsSpatiaLiteProvider::computeSizeFromGeosWKB2D( const unsigned char *blob, int rings; int points; int ib; - const unsigned char *p_in = blob; + const unsigned char *p_in = blob + 5; int gsize = 5; - p_in = blob + 5; switch ( type ) { // compunting the required size @@ -1075,10 +1074,9 @@ int QgsSpatiaLiteProvider::computeSizeFromGeosWKB3D( const unsigned char *blob, int rings; int points; int ib; - const unsigned char *p_in = blob; + const unsigned char *p_in = blob + 5; int gsize = 5; - p_in = blob + 5; switch ( type ) { // compunting the required size @@ -1278,8 +1276,8 @@ void QgsSpatiaLiteProvider::convertFromGeosWKB( const unsigned char *blob, { // already 2D: simply copying is required unsigned char *wkbGeom = new unsigned char[blob_size + 1]; - memset( wkbGeom, '\0', blob_size + 1 ); memcpy( wkbGeom, blob, blob_size ); + memset( wkbGeom + blob_size, 0, 1 ); *wkb = wkbGeom; *geom_size = blob_size + 1; return; @@ -2472,8 +2470,8 @@ void QgsSpatiaLiteProvider::convertToGeosWKB( const unsigned char *blob, { // already 2D: simply copying is required unsigned char *wkbGeom = new unsigned char[blob_size + 1]; - memset( wkbGeom, '\0', blob_size + 1 ); memcpy( wkbGeom, blob, blob_size ); + memset( wkbGeom + blob_size, 0, 1 ); *wkb = wkbGeom; *geom_size = blob_size + 1; return; @@ -3591,7 +3589,7 @@ bool QgsSpatiaLiteProvider::addFeatures( QgsFeatureList & flist ) ret = sqlite3_prepare_v2( sqliteHandle, sql.toUtf8().constData(), -1, &stmt, NULL ); if ( ret == SQLITE_OK ) { - for ( QgsFeatureList::iterator feature = flist.begin(); feature != flist.end(); feature++ ) + for ( QgsFeatureList::iterator feature = flist.begin(); feature != flist.end(); ++feature ) { // looping on each feature to insert const QgsAttributes& attributevec = feature->attributes(); @@ -4133,7 +4131,7 @@ void QgsSpatiaLiteProvider::SqliteHandles::closeDb( SqliteHandles * &handle ) void QgsSpatiaLiteProvider::SqliteHandles::closeDb( QMap < QString, SqliteHandles * >&handles, SqliteHandles * &handle ) { QMap < QString, SqliteHandles * >::iterator i; - for ( i = handles.begin(); i != handles.end() && i.value() != handle; i++ ) + for ( i = handles.begin(); i != handles.end() && i.value() != handle; ++i ) ; Q_ASSERT( i.value() == handle ); diff --git a/src/providers/sqlanywhere/qgssqlanywherefeatureiterator.cpp b/src/providers/sqlanywhere/qgssqlanywherefeatureiterator.cpp index ebe868ed88c..471070e9175 100644 --- a/src/providers/sqlanywhere/qgssqlanywherefeatureiterator.cpp +++ b/src/providers/sqlanywhere/qgssqlanywherefeatureiterator.cpp @@ -158,8 +158,8 @@ bool QgsSqlAnywhereFeatureIterator::nextFeature( QgsFeature& feature, SqlAnyStat if ( !ok ) break; QgsDebugMsgLevel( QString( "retrieved geometry column" ), 3 ); geomBuf = new unsigned char[ *geom.length + 1 ]; - memset( geomBuf, '\0', *geom.length ); memcpy( geomBuf, geom.buffer, *geom.length ); + memset( geomBuf + *geom.length, 0, 1 ); feature.setGeometryAndOwnership( geomBuf, *geom.length + 1 ); } else diff --git a/src/providers/sqlanywhere/qgssqlanywhereprovider.cpp b/src/providers/sqlanywhere/qgssqlanywhereprovider.cpp index 79c433e79ae..04a98143550 100644 --- a/src/providers/sqlanywhere/qgssqlanywhereprovider.cpp +++ b/src/providers/sqlanywhere/qgssqlanywhereprovider.cpp @@ -184,9 +184,9 @@ void QgsSqlAnywhereProvider::setNativeTypes() { const SqlAnyTypeMap *map = mConnRO->typeMap(); - for ( SqlAnyTypeMap::const_iterator it = map->constBegin() - ; it != map->constEnd() - ; it++ ) + for ( SqlAnyTypeMap::const_iterator it = map->constBegin(); + it != map->constEnd(); + ++it ) { if ( it.key() != DT_NOTYPE ) mNativeTypes << it.value(); @@ -493,7 +493,6 @@ QgsSqlAnywhereProvider::findKeyColumn() // test suitability of given key if ( !mKeyColumn.isEmpty() ) { - bool keyIsValid = true; unsigned int colId = 0; // test whether key column is a member of table and appropriate type @@ -505,7 +504,7 @@ QgsSqlAnywhereProvider::findKeyColumn() .arg( mTableId ) .arg( quotedValue( mKeyColumn ) ); stmt = mConnRO->execute_direct( sql ); - keyIsValid = stmt->isValid() && stmt->fetchNext() && stmt->getUInt( 0, colId ); + bool keyIsValid = stmt->isValid() && stmt->fetchNext() && stmt->getUInt( 0, colId ); delete stmt; if ( keyIsValid ) @@ -791,9 +790,9 @@ QgsSqlAnywhereProvider::addFeatures( QgsFeatureList & flist ) mConnRW->begin(); // iterate features - for ( QgsFeatureList::iterator fit = flist.begin() - ; ok && fit != flist.end() - ; fit++ ) + for ( QgsFeatureList::iterator fit = flist.begin(); + ok && fit != flist.end(); + ++fit ) { SqlAnyStatement *stmt; @@ -903,9 +902,9 @@ QgsSqlAnywhereProvider::deleteFeatures( const QgsFeatureIds & id ) .arg( mQuotedTableName ) .arg( getWhereClause() ) .arg( mKeyColumn ); - for ( QgsFeatureIds::const_iterator it = id.constBegin() - ; it != id.constEnd() - ; it++ ) + for ( QgsFeatureIds::const_iterator it = id.constBegin(); + it != id.constEnd(); + ++it ) { if ( it != id.constBegin() ) { @@ -962,9 +961,9 @@ QgsSqlAnywhereProvider::addAttributes( const QList &attributes ) } sql = QString( "ALTER TABLE %1 " ).arg( mQuotedTableName ); - for ( QList::const_iterator it = attributes.constBegin() - ; ok && it != attributes.constEnd() - ; it++ ) + for ( QList::const_iterator it = attributes.constBegin(); + ok && it != attributes.constEnd(); + ++it ) { QString datatype = it->typeName(); @@ -1001,9 +1000,9 @@ QgsSqlAnywhereProvider::addAttributes( const QList &attributes ) // Add column comments. The ALTER TABLE statement was // already committed, so treat this operation as best-effort. mConnRW->begin(); - for ( QList::const_iterator it = attributes.constBegin() - ; ok && it != attributes.constEnd() - ; it++ ) + for ( QList::const_iterator it = attributes.constBegin(); + ok && it != attributes.constEnd(); + ++it ) { if ( !it->comment().isEmpty() ) @@ -1062,11 +1061,10 @@ QgsSqlAnywhereProvider::deleteAttributes( const QgsAttributeIds & ids ) sql = QString( "ALTER TABLE %1 " ).arg( mQuotedTableName ); int cnt = 0; - for ( QgsAttributeIds::const_iterator it = ids.constBegin() - ; it != ids.constEnd() - ; it++ ) + for ( QgsAttributeIds::const_iterator it = ids.constBegin(); + it != ids.constEnd(); + ++it ) { - QString attr = field( *it ).name(); if ( !attr.isEmpty() ) { @@ -1127,9 +1125,9 @@ QgsSqlAnywhereProvider::changeAttributeValues( const QgsChangedAttributesMap & a mConnRW->begin(); // iterate each feature requiring update - for ( QgsChangedAttributesMap::const_iterator fit = attr_map.constBegin() - ; ok && fit != attr_map.constEnd() - ; fit++ ) + for ( QgsChangedAttributesMap::const_iterator fit = attr_map.constBegin(); + ok && fit != attr_map.constEnd(); + ++fit ) { // skip added features @@ -1139,9 +1137,9 @@ QgsSqlAnywhereProvider::changeAttributeValues( const QgsChangedAttributesMap & a // iterate each attribute requiring update QString sql = QString( "UPDATE %1 SET " ).arg( mQuotedTableName ); int cnt = 0; - for ( QgsAttributeMap::const_iterator ait = fit->constBegin() - ; ok && ait != fit->constEnd() - ; ait++ ) + for ( QgsAttributeMap::const_iterator ait = fit->constBegin(); + ok && ait != fit->constEnd(); + ++ait ) { QString attr; if ( ait.key() < mAttributeFields.size() ) @@ -1231,9 +1229,9 @@ QgsSqlAnywhereProvider::changeGeometryValues( QgsGeometryMap & gmap ) stmt = mConnRW->prepare( sql ); ok = stmt->isValid(); - for ( QgsGeometryMap::const_iterator it = gmap.constBegin() - ; ok && it != gmap.constEnd() - ; it++ ) + for ( QgsGeometryMap::const_iterator it = gmap.constBegin(); + ok && it != gmap.constEnd(); + ++it ) { QgsFeatureId key = it.key(); QgsGeometry geom = *it; diff --git a/src/providers/wcs/qgswcscapabilities.cpp b/src/providers/wcs/qgswcscapabilities.cpp index 84d74fa5460..be436acd5d0 100644 --- a/src/providers/wcs/qgswcscapabilities.cpp +++ b/src/providers/wcs/qgswcscapabilities.cpp @@ -74,8 +74,8 @@ QgsWcsCapabilities::QgsWcsCapabilities( QgsDataSourceURI const &theUri ): retrieveServerCapabilities(); } -QgsWcsCapabilities::QgsWcsCapabilities( ): - mCoverageCount( 0 ) +QgsWcsCapabilities::QgsWcsCapabilities() + : mCoverageCount( 0 ) { } @@ -196,8 +196,7 @@ void QgsWcsCapabilities::clear() QgsDebugMsg( "Entered" ); mCoverageCount = 0; mCoveragesSupported.clear(); - QgsWcsCapabilitiesProperty c; - mCapabilities = c; + mCapabilities = QgsWcsCapabilitiesProperty(); } QString QgsWcsCapabilities::getCapabilitiesUrl( const QString version ) const diff --git a/src/providers/wcs/qgswcssourceselect.cpp b/src/providers/wcs/qgswcssourceselect.cpp index 76dace50444..1c19c0ee232 100644 --- a/src/providers/wcs/qgswcssourceselect.cpp +++ b/src/providers/wcs/qgswcssourceselect.cpp @@ -79,7 +79,7 @@ void QgsWCSSourceSelect::populateLayerList( ) for ( QVector::iterator coverage = coverages.begin(); coverage != coverages.end(); - coverage++ ) + ++coverage ) { QgsDebugMsg( QString( "coverage orderId = %1 identifier = %2" ).arg( coverage->orderId ).arg( coverage->identifier ) ); diff --git a/src/providers/wfs/qgswfsprovider.cpp b/src/providers/wfs/qgswfsprovider.cpp index 649e944afee..6bca57a8f93 100644 --- a/src/providers/wfs/qgswfsprovider.cpp +++ b/src/providers/wfs/qgswfsprovider.cpp @@ -1500,7 +1500,7 @@ QgsFeatureId QgsWFSProvider::findNewKey() const //else return highest key + 1 QMap::const_iterator lastIt = mFeatures.end(); - lastIt--; + --lastIt; QgsFeatureId id = lastIt.key(); return ++id; } @@ -1592,7 +1592,7 @@ void QgsWFSProvider::appendSupportedOperations( const QDomElement& operationsEle //initialization for getRenderedOnly option //(formerly "Only request features overlapping the current view extent") -bool QgsWFSProvider::initGetRenderedOnly( const QgsRectangle rect ) +bool QgsWFSProvider::initGetRenderedOnly( const QgsRectangle &rect ) { Q_UNUSED( rect ); diff --git a/src/providers/wfs/qgswfsprovider.h b/src/providers/wfs/qgswfsprovider.h index 3ede43cd052..4848e4b2c3f 100644 --- a/src/providers/wfs/qgswfsprovider.h +++ b/src/providers/wfs/qgswfsprovider.h @@ -235,7 +235,7 @@ class QgsWFSProvider: public QgsVectorDataProvider /**records provider error*/ void handleException( const QDomDocument& serverResponse ); /**Initializes "Cache Features" inactive processing*/ - bool initGetRenderedOnly( QgsRectangle ); + bool initGetRenderedOnly( const QgsRectangle &rect ); /**Converts DescribeFeatureType schema geometry property type to WKBType*/ QGis::WkbType geomTypeFromPropertyType( QString attName, QString propType ); diff --git a/src/providers/wms/qgswmsprovider.cpp b/src/providers/wms/qgswmsprovider.cpp index 801530f90ac..6781e808c4e 100644 --- a/src/providers/wms/qgswmsprovider.cpp +++ b/src/providers/wms/qgswmsprovider.cpp @@ -787,7 +787,7 @@ QImage *QgsWmsProvider::draw( QgsRectangle const &viewExtent, int pixelWidth, i { QgsDebugMsg( QString( "res:%1 >= %2" ).arg( it.key() ).arg( vres ) ); prev = it; - it++; + ++it; } if ( it == m.constEnd() || @@ -2616,7 +2616,6 @@ void QgsWmsProvider::parseLayer( QDomElement const & e, QgsWmsLayerProperty& lay void QgsWmsProvider::parseTileSetProfile( QDomElement const &e ) { QStringList resolutions, layers, styles; - QgsWmsBoundingBoxProperty boundingBox; QgsWmtsTileMatrixSet ms; QgsWmtsTileMatrix m; QgsWmtsTileLayer l; @@ -3882,7 +3881,7 @@ QString QgsWmsProvider::metadata() metadata += ""; for ( QHash::const_iterator it = mTileLayer->getTileURLs.constBegin(); it != mTileLayer->getTileURLs.constEnd(); - it++ ) + ++it ) { metadata += QString( "%1:%2
" ).arg( it.key() ).arg( it.value() ); } @@ -3894,7 +3893,7 @@ QString QgsWmsProvider::metadata() metadata += ""; for ( QHash::const_iterator it = mTileLayer->getFeatureInfoURLs.constBegin(); it != mTileLayer->getFeatureInfoURLs.constEnd(); - it++ ) + ++it ) { metadata += QString( "%1:%2
" ).arg( it.key() ).arg( it.value() ); } diff --git a/src/providers/wms/qgswmssourceselect.cpp b/src/providers/wms/qgswmssourceselect.cpp index 9255b230f4b..16180fd14c5 100644 --- a/src/providers/wms/qgswmssourceselect.cpp +++ b/src/providers/wms/qgswmssourceselect.cpp @@ -309,7 +309,7 @@ bool QgsWMSSourceSelect::populateLayerList( QgsWmsProvider *wmsProvider ) for ( QVector::iterator layer = layers.begin(); layer != layers.end(); - layer++ ) + ++layer ) { QgsNumericSortTreeWidgetItem *lItem = createItem( layer->orderId, QStringList() << layer->name << layer->title << layer->abstract, items, layerAndStyleCount, layerParents, layerParentNames ); @@ -806,7 +806,7 @@ void QgsWMSSourceSelect::on_lstLayers_itemSelectionChanged() // if not, use one of the available CRS QString defaultCRS; QSet::const_iterator it = mCRSs.begin(); - for ( ; it != mCRSs.end(); it++ ) + for ( ; it != mCRSs.end(); ++it ) { if ( it->compare( mCRS, Qt::CaseInsensitive ) == 0 ) break;