Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
indentation and minor sip updates
  • Loading branch information
jef-n committed May 3, 2015
1 parent bae9cea commit edeafa9
Show file tree
Hide file tree
Showing 16 changed files with 75 additions and 71 deletions.
4 changes: 2 additions & 2 deletions python/core/composer/qgscomposermap.sip
Expand Up @@ -182,7 +182,7 @@ class QgsComposerMap : QgsComposerItem
/**Called when atlas preview is toggled, to force map item to update its extent and redraw
* @deprecated no longer required
*/
void toggleAtlasPreview();
void toggleAtlasPreview() /Deprecated/;

/**Returns a pointer to the current map extent, which is either the original user specified
* extent or the temporary atlas-driven feature extent depending on the current atlas state
Expand Down Expand Up @@ -620,7 +620,7 @@ class QgsComposerMap : QgsComposerItem
/** Returns true if the extent is forced to center on the overview
* @deprecated use overview()->centered() or overviews() instead
*/
bool overviewCentered() const;
bool overviewCentered() const /Deprecated/;

/** Set the overview's centering mode
* @deprecated use overview()->setCentered() or overviews() instead
Expand Down
2 changes: 1 addition & 1 deletion python/core/qgsexpression.sip
Expand Up @@ -83,7 +83,7 @@ class QgsExpression

double scale();

//! Return the expression string that was given when created.
//! Alias for dump()
const QString expression() const;

//! Return the expression string that represents this QgsExpression.
Expand Down
11 changes: 4 additions & 7 deletions python/core/qgsfield.sip
Expand Up @@ -44,7 +44,7 @@ public:
bool operator!=( const QgsField& other ) const;

//! Gets the name of the field
const QString & name() const;
const QString& name() const;

//! Gets variant type of the field as it will be retrieved from data source
QVariant::Type type() const;
Expand All @@ -55,16 +55,14 @@ public:
the data store reports it, with no attempt to standardize the value.
@return QString containing the field type
*/
const QString & typeName() const;

const QString& typeName() const;

/**
Gets the length of the field.
@return int containing the length of the field
*/
int length() const;


/**
Gets the precision of the field. Not all field types have a related precision.
@return int containing the precision or zero if not applicable to the field type.
Expand All @@ -74,7 +72,7 @@ public:
/**
Returns the field comment
*/
const QString & comment() const;
const QString& comment() const;

/**
Set the field name.
Expand Down Expand Up @@ -105,7 +103,6 @@ public:
*/
void setPrecision( int precision );


/**
Set the field comment
*/
Expand Down Expand Up @@ -239,7 +236,7 @@ class QgsFields
bool exists( int i ) const;

//! Get field at particular index (must be in range 0..N-1)
// inline const QgsField& operator[]( int i ) const;
// const QgsField& operator[]( int i ) const;
QgsField& operator[](int i) /Factory/;
%MethodCode
SIP_SSIZE_T idx = sipConvertFromSequenceIndex(a0, sipCpp->count());
Expand Down
38 changes: 18 additions & 20 deletions python/core/qgsstatisticalsummary.sip
Expand Up @@ -21,24 +21,23 @@ class QgsStatisticalSummary
//! Enumeration of flags that specify statistics to be calculated
enum Statistic
{
Count , //!< Count
Sum, //!< Sum of values
Mean, //!< Mean of values
Median, //!< Median of values
StDev, //!< Standard deviation of values
StDevSample, //!< Sample standard deviation of values
Min, //!< Min of values
Max, //!< Max of values
Range, //!< Range of values (max - min)
Minority, //!< Minority of values
Majority, //!< Majority of values
Variety, //!< Variety (count of distinct) values
FirstQuartile, //!< First quartile
ThirdQuartile, //!< Third quartile
InterQuartileRange, //!< Inter quartile range (IQR)
All
Count, //!< Count
Sum, //!< Sum of values
Mean, //!< Mean of values
Median, //!< Median of values
StDev, //!< Standard deviation of values
StDevSample, //!< Sample standard deviation of values
Min, //!< Min of values
Max, //!< Max of values
Range, //!< Range of values (max - min)
Minority, //!< Minority of values
Majority, //!< Majority of values
Variety, //!< Variety (count of distinct) values
FirstQuartile, //!< First quartile
ThirdQuartile, //!< Third quartile
InterQuartileRange, //!< Inter quartile range (IQR)
All
};

typedef QFlags<QgsStatisticalSummary::Statistic> Statistics;

/** Constructor for QgsStatisticalSummary
Expand Down Expand Up @@ -130,8 +129,8 @@ class QgsStatisticalSummary
* @see minority
*/
double majority() const;
/** Returns the first quartile of the values. The quartile is calculated using the

/** Returns the first quartile of the values. The quartile is calculated using the
* "Tukey's hinges" method.
* @see thirdQuartile
* @see interQuartileRange
Expand All @@ -156,4 +155,3 @@ class QgsStatisticalSummary

QFlags<QgsStatisticalSummary::Statistic> operator|(QgsStatisticalSummary::Statistic f1, QFlags<QgsStatisticalSummary::Statistic> f2);


14 changes: 7 additions & 7 deletions python/core/qgsvectorlayer.sip
Expand Up @@ -88,15 +88,15 @@ struct QgsVectorJoinInfo
#include "qgsvectorlayer.h"
%End

/**Join field in the target layer*/
/** Join field in the target layer*/
QString targetFieldName;
/**Source layer*/
/** Source layer*/
QString joinLayerId;
/**Join field in the source layer*/
/** Join field in the source layer*/
QString joinFieldName;
/**True if the join is cached in virtual memory*/
/** True if the join is cached in virtual memory*/
bool memoryCache;
/**Cache for joined attributes to provide fast lookup (size is 0 if no memory caching)
/** Cache for joined attributes to provide fast lookup (size is 0 if no memory caching)
@note not available in python bindings
*/
// QHash< QString, QgsAttributeMap> cachedAttributes;
Expand Down Expand Up @@ -1130,7 +1130,7 @@ class QgsVectorLayer : QgsMapLayer

/**Returns maximum value for an attribute column or invalid variant in case of error */
QVariant maximumValue( int index );

/** Fetches all values from a specified field name or expression.
* @param fieldOrExpression field name or an expression string
* @param ok will be set to false if field or expression is invalid, otherwise true
Expand All @@ -1139,7 +1139,7 @@ class QgsVectorLayer : QgsMapLayer
* @see getDoubleValues
*/
QList< QVariant > getValues( const QString &fieldOrExpression, bool &ok );

/** Fetches all double values from a specified field name or expression. Null values or
* invalid expression results are skipped.
* @param fieldOrExpression field name or an expression string evaluating to a double value
Expand Down
5 changes: 3 additions & 2 deletions python/core/symbology-ng/qgsgraduatedsymbolrendererv2.sip
Expand Up @@ -81,8 +81,8 @@ class QgsGraduatedSymbolRendererV2 : QgsFeatureRendererV2
%TypeHeaderCode
#include <qgsgraduatedsymbolrendererv2.h>
%End

public:

QgsGraduatedSymbolRendererV2( QString attrName = QString(), QgsRangeList ranges = QgsRangeList() );

virtual ~QgsGraduatedSymbolRendererV2();
Expand Down Expand Up @@ -152,6 +152,7 @@ class QgsGraduatedSymbolRendererV2 : QgsFeatureRendererV2
//! @param nclasses The number of classes to calculate (approximate for some modes)
//! @note Added in 2.6
void updateClasses( QgsVectorLayer *vlayer, Mode mode, int nclasses );

//! Evaluates the data expression and returns the list of values from the layer
//! @param vlayer The layer for which to evaluate the expression
//! @note Added in 2.6
Expand Down Expand Up @@ -180,7 +181,7 @@ class QgsGraduatedSymbolRendererV2 : QgsFeatureRendererV2
QgsSymbolV2* symbol /Transfer/,
QgsVectorColorRampV2* ramp /Transfer/,
bool inverted = false,
QgsRendererRangeV2LabelFormat labelFormat=QgsRendererRangeV2LabelFormat()
QgsRendererRangeV2LabelFormat legendFormat = QgsRendererRangeV2LabelFormat()
);

//! create renderer from XML element
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/grass7/Grass7Algorithm.py
Expand Up @@ -369,7 +369,7 @@ def processAlgorithm(self, progress):

if self.grassName == 'r.horizon':
command += out.name + uniqueSufix + '_0'
elif self.grassName == 'r.composite':
elif self.grassName == 'r.composite':
commands.append(command)
outputCommands.append(command)
else:
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/qgis/Eliminate.py
Expand Up @@ -243,7 +243,7 @@ def processAlgorithm(self, progress):
# We have a candidate
iGeom = geom2Eliminate.intersection(selGeom)

if iGeom == None:
if iGeom is None:
continue

if boundary:
Expand Down
27 changes: 18 additions & 9 deletions src/core/qgspointlocator.cpp
Expand Up @@ -634,11 +634,14 @@ bool QgsPointLocator::rebuildIndex( int maxFeaturesToIndex )
QgsRectangle rect = *mExtent;
if ( mTransform )
{
try {
try
{
rect = mTransform->transformBoundingBox( rect, QgsCoordinateTransform::ReverseTransform );
} catch (const QgsException& e) {
}
catch ( const QgsException& e )
{
// See http://hub.qgis.org/issues/12634
QgsDebugMsg( QString("could not transform bounding box to map, skipping the snap filter (%1)").arg(e.what()) );
QgsDebugMsg( QString( "could not transform bounding box to map, skipping the snap filter (%1)" ).arg( e.what() ) );
}
}
request.setFilterRect( rect );
Expand All @@ -652,11 +655,14 @@ bool QgsPointLocator::rebuildIndex( int maxFeaturesToIndex )

if ( mTransform )
{
try {
try
{
f.geometry()->transform( *mTransform );
} catch (const QgsException& e) {
}
catch ( const QgsException& e )
{
// See http://hub.qgis.org/issues/12634
QgsDebugMsg( QString("could not transform geometry to map, skipping the snap for it (%1)").arg(e.what()) );
QgsDebugMsg( QString( "could not transform geometry to map, skipping the snap for it (%1)" ).arg( e.what() ) );
continue;
}
}
Expand Down Expand Up @@ -724,11 +730,14 @@ void QgsPointLocator::onFeatureAdded( QgsFeatureId fid )

if ( mTransform )
{
try {
try
{
f.geometry()->transform( *mTransform );
} catch (const QgsException& e) {
}
catch ( const QgsException& e )
{
// See http://hub.qgis.org/issues/12634
QgsDebugMsg( QString("could not transform geometry to map, skipping the snap for it (%1)").arg(e.what()) );
QgsDebugMsg( QString( "could not transform geometry to map, skipping the snap for it (%1)" ).arg( e.what() ) );
return;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsproviderregistry.cpp
Expand Up @@ -408,7 +408,7 @@ QWidget* QgsProviderRegistry::selectWidget( const QString & providerKey,

#if QT_VERSION >= 0x050000
QFunctionPointer QgsProviderRegistry::function( QString const & providerKey,
QString const & functionName )
QString const & functionName )
{
QLibrary myLib( library( providerKey ) );

Expand Down
4 changes: 2 additions & 2 deletions src/core/qgsstatisticalsummary.h
Expand Up @@ -37,8 +37,8 @@ class CORE_EXPORT QgsStatisticalSummary
//! Enumeration of flags that specify statistics to be calculated
enum Statistic
{
Count = 1, //!< Count
Sum = 2, //!< Sum of values
Count = 1, //!< Count
Sum = 2, //!< Sum of values
Mean = 4, //!< Mean of values
Median = 8, //!< Median of values
StDev = 16, //!< Standard deviation of values
Expand Down
1 change: 0 additions & 1 deletion src/core/symbology-ng/qgsgraduatedsymbolrendererv2.h
Expand Up @@ -269,7 +269,6 @@ class CORE_EXPORT QgsGraduatedSymbolRendererV2 : public QgsFeatureRendererV2
//! @note added in 2.10
void setGraduatedMethod( GraduatedMethod method ) { mGraduatedMethod = method; }


void setRotationField( QString fieldOrExpression ) override;
QString rotationField() const override;

Expand Down
2 changes: 1 addition & 1 deletion src/gui/editorwidgets/qgsrelationreferencewidget.cpp
Expand Up @@ -535,7 +535,7 @@ void QgsRelationReferenceWidget::init()
mComboBox->setCurrentIndex( mComboBox->findData( mFeature.id(), QgsAttributeTableModel::FeatureIdRole ) );

// Only connect after iterating, to have only one iterator on the referenced table at once
connect( mComboBox, SIGNAL( currentIndexChanged(int) ), this, SLOT( comboReferenceChanged( int ) ) );
connect( mComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( comboReferenceChanged( int ) ) );
QApplication::restoreOverrideCursor();
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgsuserinputtoolbar.cpp
Expand Up @@ -72,9 +72,9 @@ void QgsUserInputToolBar::widgetDestroyed( QObject *obj )
}
}

void QgsUserInputToolBar::paintEvent(QPaintEvent * event)
void QgsUserInputToolBar::paintEvent( QPaintEvent * event )
{
QToolBar::paintEvent(event);
QToolBar::paintEvent( event );
if ( mWidgetList.count() == 0 )
{
hide();
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsuserinputtoolbar.h
Expand Up @@ -31,7 +31,7 @@ class GUI_EXPORT QgsUserInputToolBar : public QToolBar
void addUserInputWidget( QWidget* widget );

protected:
void paintEvent(QPaintEvent *event);
void paintEvent( QPaintEvent *event );

private slots:
void widgetDestroyed( QObject* obj );
Expand Down
26 changes: 13 additions & 13 deletions tests/src/core/testqgsscaleexpression.cpp
Expand Up @@ -37,44 +37,44 @@ class TestQgsScaleExpression: public QObject
{
{
QgsScaleExpression exp( "scale_linear(column, 1, 7, 2, 10)" );
QCOMPARE( bool(exp), true );
QCOMPARE( bool( exp ), true );
QCOMPARE( exp.type(), QgsScaleExpression::Linear );
QCOMPARE( exp.baseExpression(), QString("column") );
QCOMPARE( exp.baseExpression(), QString( "column" ) );
QCOMPARE( exp.minValue(), 1. );
QCOMPARE( exp.maxValue(), 7. );
QCOMPARE( exp.minSize(), 2. );
QCOMPARE( exp.maxSize(), 10. );
}
{
QgsScaleExpression exp( "scale_exp(column, 1, 7, 2, 10, 0.5)" );
QCOMPARE( bool(exp), true );
QCOMPARE( bool( exp ), true );
QCOMPARE( exp.type(), QgsScaleExpression::Area );
}
{
QgsScaleExpression exp( "scale_exp(column, 1, 7, 2, 10, 0.57)" );
QCOMPARE( bool(exp), true );
QCOMPARE( bool( exp ), true );
QCOMPARE( exp.type(), QgsScaleExpression::Flannery );
}
{
QgsScaleExpression exp( "scale_exp(column, 1, 7, 2, 10, 0.51)" );
QCOMPARE( bool(exp), false );
QCOMPARE( bool( exp ), false );
QCOMPARE( exp.type(), QgsScaleExpression::Unknown );
}
{
QgsScaleExpression exp( "scale_exp(column, 1, 7, a, 10, 0.5)" );
QCOMPARE( bool(exp), false );
QCOMPARE( bool( exp ), false );
QCOMPARE( exp.type(), QgsScaleExpression::Unknown );
}
{
QgsScaleExpression exp( "scale_exp(column, 1, 7)" );
QCOMPARE( bool( exp ), false );
QCOMPARE( exp.type(), QgsScaleExpression::Unknown );
}
{
QgsScaleExpression exp( "scale_exp(column, 1, 7)" );
QCOMPARE( bool(exp), false );
QCOMPARE( exp.type(), QgsScaleExpression::Unknown );
}
{
QgsScaleExpression exp( QgsScaleExpression::Linear, "column", 1, 7, 2, 10 );
QCOMPARE( bool(exp), true );
QCOMPARE( bool( exp ), true );
QCOMPARE( exp.type(), QgsScaleExpression::Linear );
QCOMPARE( exp.baseExpression(), QString("column") );
QCOMPARE( exp.baseExpression(), QString( "column" ) );
QCOMPARE( exp.minValue(), 1. );
QCOMPARE( exp.maxValue(), 7. );
QCOMPARE( exp.minSize(), 2. );
Expand Down

0 comments on commit edeafa9

Please sign in to comment.