Skip to content

Commit

Permalink
fix most cppcheck warnings and implement suggestions
Browse files Browse the repository at this point in the history
also update and sync some sip interfaces
  • Loading branch information
jef-n committed Jan 5, 2014
1 parent d7237b7 commit 190c051
Show file tree
Hide file tree
Showing 140 changed files with 606 additions and 636 deletions.
16 changes: 8 additions & 8 deletions python/core/qgsmaplayer.sip
Expand Up @@ -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
Expand Down Expand Up @@ -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
/**
Expand Down Expand Up @@ -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.
Expand All @@ -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 **/
Expand Down
135 changes: 97 additions & 38 deletions python/core/qgsvectorlayer.sip
Expand Up @@ -15,6 +15,7 @@ class QgsAttributeEditorElement : QObject
{
AeTypeContainer,
AeTypeField,
AeTypeRelation,
AeTypeInvalid
};

Expand All @@ -41,6 +42,7 @@ class QgsAttributeEditorContainer : QgsAttributeEditorElement

virtual QDomElement toDomElement( QDomDocument& doc ) const;
virtual void addChildElement( QgsAttributeEditorElement *widget );
virtual bool isGroupBox() const;
QList<QgsAttributeEditorElement*> children() const;
};

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 );

Expand Down Expand Up @@ -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 );

Expand Down Expand Up @@ -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<QgsPoint>& 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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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<QString, QVariant>& config );

/** set string representing 'true' for a checkbox (added in 1.4) */
void setCheckedState( int idx, QString checked, QString notChecked );

Expand Down Expand Up @@ -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<QgsRelation> referencingRelations( int idx );

/**access date format
* @note added in 1.9
*/
Expand Down Expand Up @@ -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
*/
Expand All @@ -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 */
Expand All @@ -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:
/**
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
*/
Expand All @@ -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 );
Expand Down
27 changes: 20 additions & 7 deletions python/core/symbology-ng/qgsfillsymbollayerv2.sip
Expand Up @@ -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/;
Expand All @@ -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;


/**Sets the end point of the gradient to be the feature centroid*/
void setReferencePoint2IsCentroid( bool isCentroid );
bool referencePoint2IsCentroid() const;
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*/
Expand Down
1 change: 0 additions & 1 deletion src/analysis/interpolation/DualEdgeTriangulation.cc
Expand Up @@ -458,7 +458,6 @@ int DualEdgeTriangulation::baseEdgeOfPoint( int point )
{
mEdgeInside = actedge;
return actedge;
break;
}

else if ( leftofnumber <= 0 )
Expand Down

0 comments on commit 190c051

Please sign in to comment.