indentation and minor sip updates

This commit is contained in:
Juergen E. Fischer 2015-05-03 17:10:32 +02:00
parent bae9cea4f9
commit edeafa95ac
16 changed files with 75 additions and 71 deletions

View File

@ -182,7 +182,7 @@ class QgsComposerMap : QgsComposerItem
/**Called when atlas preview is toggled, to force map item to update its extent and redraw /**Called when atlas preview is toggled, to force map item to update its extent and redraw
* @deprecated no longer required * @deprecated no longer required
*/ */
void toggleAtlasPreview(); void toggleAtlasPreview() /Deprecated/;
/**Returns a pointer to the current map extent, which is either the original user specified /**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 * extent or the temporary atlas-driven feature extent depending on the current atlas state
@ -620,7 +620,7 @@ class QgsComposerMap : QgsComposerItem
/** Returns true if the extent is forced to center on the overview /** Returns true if the extent is forced to center on the overview
* @deprecated use overview()->centered() or overviews() instead * @deprecated use overview()->centered() or overviews() instead
*/ */
bool overviewCentered() const; bool overviewCentered() const /Deprecated/;
/** Set the overview's centering mode /** Set the overview's centering mode
* @deprecated use overview()->setCentered() or overviews() instead * @deprecated use overview()->setCentered() or overviews() instead

View File

@ -83,7 +83,7 @@ class QgsExpression
double scale(); double scale();
//! Return the expression string that was given when created. //! Alias for dump()
const QString expression() const; const QString expression() const;
//! Return the expression string that represents this QgsExpression. //! Return the expression string that represents this QgsExpression.

View File

@ -44,7 +44,7 @@ public:
bool operator!=( const QgsField& other ) const; bool operator!=( const QgsField& other ) const;
//! Gets the name of the field //! 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 //! Gets variant type of the field as it will be retrieved from data source
QVariant::Type type() const; QVariant::Type type() const;
@ -55,8 +55,7 @@ public:
the data store reports it, with no attempt to standardize the value. the data store reports it, with no attempt to standardize the value.
@return QString containing the field type @return QString containing the field type
*/ */
const QString & typeName() const; const QString& typeName() const;
/** /**
Gets the length of the field. Gets the length of the field.
@ -64,7 +63,6 @@ public:
*/ */
int length() const; int length() const;
/** /**
Gets the precision of the field. Not all field types have a related precision. 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. @return int containing the precision or zero if not applicable to the field type.
@ -74,7 +72,7 @@ public:
/** /**
Returns the field comment Returns the field comment
*/ */
const QString & comment() const; const QString& comment() const;
/** /**
Set the field name. Set the field name.
@ -105,7 +103,6 @@ public:
*/ */
void setPrecision( int precision ); void setPrecision( int precision );
/** /**
Set the field comment Set the field comment
*/ */
@ -239,7 +236,7 @@ class QgsFields
bool exists( int i ) const; bool exists( int i ) const;
//! Get field at particular index (must be in range 0..N-1) //! 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/; QgsField& operator[](int i) /Factory/;
%MethodCode %MethodCode
SIP_SSIZE_T idx = sipConvertFromSequenceIndex(a0, sipCpp->count()); SIP_SSIZE_T idx = sipConvertFromSequenceIndex(a0, sipCpp->count());

View File

@ -21,24 +21,23 @@ class QgsStatisticalSummary
//! Enumeration of flags that specify statistics to be calculated //! Enumeration of flags that specify statistics to be calculated
enum Statistic enum Statistic
{ {
Count , //!< Count Count, //!< Count
Sum, //!< Sum of values Sum, //!< Sum of values
Mean, //!< Mean of values Mean, //!< Mean of values
Median, //!< Median of values Median, //!< Median of values
StDev, //!< Standard deviation of values StDev, //!< Standard deviation of values
StDevSample, //!< Sample standard deviation of values StDevSample, //!< Sample standard deviation of values
Min, //!< Min of values Min, //!< Min of values
Max, //!< Max of values Max, //!< Max of values
Range, //!< Range of values (max - min) Range, //!< Range of values (max - min)
Minority, //!< Minority of values Minority, //!< Minority of values
Majority, //!< Majority of values Majority, //!< Majority of values
Variety, //!< Variety (count of distinct) values Variety, //!< Variety (count of distinct) values
FirstQuartile, //!< First quartile FirstQuartile, //!< First quartile
ThirdQuartile, //!< Third quartile ThirdQuartile, //!< Third quartile
InterQuartileRange, //!< Inter quartile range (IQR) InterQuartileRange, //!< Inter quartile range (IQR)
All All
}; };
typedef QFlags<QgsStatisticalSummary::Statistic> Statistics; typedef QFlags<QgsStatisticalSummary::Statistic> Statistics;
/** Constructor for QgsStatisticalSummary /** Constructor for QgsStatisticalSummary
@ -130,8 +129,8 @@ class QgsStatisticalSummary
* @see minority * @see minority
*/ */
double majority() const; 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. * "Tukey's hinges" method.
* @see thirdQuartile * @see thirdQuartile
* @see interQuartileRange * @see interQuartileRange
@ -156,4 +155,3 @@ class QgsStatisticalSummary
QFlags<QgsStatisticalSummary::Statistic> operator|(QgsStatisticalSummary::Statistic f1, QFlags<QgsStatisticalSummary::Statistic> f2); QFlags<QgsStatisticalSummary::Statistic> operator|(QgsStatisticalSummary::Statistic f1, QFlags<QgsStatisticalSummary::Statistic> f2);

View File

@ -88,15 +88,15 @@ struct QgsVectorJoinInfo
#include "qgsvectorlayer.h" #include "qgsvectorlayer.h"
%End %End
/**Join field in the target layer*/ /** Join field in the target layer*/
QString targetFieldName; QString targetFieldName;
/**Source layer*/ /** Source layer*/
QString joinLayerId; QString joinLayerId;
/**Join field in the source layer*/ /** Join field in the source layer*/
QString joinFieldName; QString joinFieldName;
/**True if the join is cached in virtual memory*/ /** True if the join is cached in virtual memory*/
bool memoryCache; 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 @note not available in python bindings
*/ */
// QHash< QString, QgsAttributeMap> cachedAttributes; // QHash< QString, QgsAttributeMap> cachedAttributes;
@ -1130,7 +1130,7 @@ class QgsVectorLayer : QgsMapLayer
/**Returns maximum value for an attribute column or invalid variant in case of error */ /**Returns maximum value for an attribute column or invalid variant in case of error */
QVariant maximumValue( int index ); QVariant maximumValue( int index );
/** Fetches all values from a specified field name or expression. /** Fetches all values from a specified field name or expression.
* @param fieldOrExpression field name or an expression string * @param fieldOrExpression field name or an expression string
* @param ok will be set to false if field or expression is invalid, otherwise true * @param ok will be set to false if field or expression is invalid, otherwise true
@ -1139,7 +1139,7 @@ class QgsVectorLayer : QgsMapLayer
* @see getDoubleValues * @see getDoubleValues
*/ */
QList< QVariant > getValues( const QString &fieldOrExpression, bool &ok ); QList< QVariant > getValues( const QString &fieldOrExpression, bool &ok );
/** Fetches all double values from a specified field name or expression. Null values or /** Fetches all double values from a specified field name or expression. Null values or
* invalid expression results are skipped. * invalid expression results are skipped.
* @param fieldOrExpression field name or an expression string evaluating to a double value * @param fieldOrExpression field name or an expression string evaluating to a double value

View File

@ -81,8 +81,8 @@ class QgsGraduatedSymbolRendererV2 : QgsFeatureRendererV2
%TypeHeaderCode %TypeHeaderCode
#include <qgsgraduatedsymbolrendererv2.h> #include <qgsgraduatedsymbolrendererv2.h>
%End %End
public: public:
QgsGraduatedSymbolRendererV2( QString attrName = QString(), QgsRangeList ranges = QgsRangeList() ); QgsGraduatedSymbolRendererV2( QString attrName = QString(), QgsRangeList ranges = QgsRangeList() );
virtual ~QgsGraduatedSymbolRendererV2(); virtual ~QgsGraduatedSymbolRendererV2();
@ -152,6 +152,7 @@ class QgsGraduatedSymbolRendererV2 : QgsFeatureRendererV2
//! @param nclasses The number of classes to calculate (approximate for some modes) //! @param nclasses The number of classes to calculate (approximate for some modes)
//! @note Added in 2.6 //! @note Added in 2.6
void updateClasses( QgsVectorLayer *vlayer, Mode mode, int nclasses ); void updateClasses( QgsVectorLayer *vlayer, Mode mode, int nclasses );
//! Evaluates the data expression and returns the list of values from the layer //! Evaluates the data expression and returns the list of values from the layer
//! @param vlayer The layer for which to evaluate the expression //! @param vlayer The layer for which to evaluate the expression
//! @note Added in 2.6 //! @note Added in 2.6
@ -180,7 +181,7 @@ class QgsGraduatedSymbolRendererV2 : QgsFeatureRendererV2
QgsSymbolV2* symbol /Transfer/, QgsSymbolV2* symbol /Transfer/,
QgsVectorColorRampV2* ramp /Transfer/, QgsVectorColorRampV2* ramp /Transfer/,
bool inverted = false, bool inverted = false,
QgsRendererRangeV2LabelFormat labelFormat=QgsRendererRangeV2LabelFormat() QgsRendererRangeV2LabelFormat legendFormat = QgsRendererRangeV2LabelFormat()
); );
//! create renderer from XML element //! create renderer from XML element

View File

@ -369,7 +369,7 @@ class Grass7Algorithm(GeoAlgorithm):
if self.grassName == 'r.horizon': if self.grassName == 'r.horizon':
command += out.name + uniqueSufix + '_0' command += out.name + uniqueSufix + '_0'
elif self.grassName == 'r.composite': elif self.grassName == 'r.composite':
commands.append(command) commands.append(command)
outputCommands.append(command) outputCommands.append(command)
else: else:

View File

@ -243,7 +243,7 @@ class Eliminate(GeoAlgorithm):
# We have a candidate # We have a candidate
iGeom = geom2Eliminate.intersection(selGeom) iGeom = geom2Eliminate.intersection(selGeom)
if iGeom == None: if iGeom is None:
continue continue
if boundary: if boundary:

View File

@ -634,11 +634,14 @@ bool QgsPointLocator::rebuildIndex( int maxFeaturesToIndex )
QgsRectangle rect = *mExtent; QgsRectangle rect = *mExtent;
if ( mTransform ) if ( mTransform )
{ {
try { try
{
rect = mTransform->transformBoundingBox( rect, QgsCoordinateTransform::ReverseTransform ); rect = mTransform->transformBoundingBox( rect, QgsCoordinateTransform::ReverseTransform );
} catch (const QgsException& e) { }
catch ( const QgsException& e )
{
// See http://hub.qgis.org/issues/12634 // 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 ); request.setFilterRect( rect );
@ -652,11 +655,14 @@ bool QgsPointLocator::rebuildIndex( int maxFeaturesToIndex )
if ( mTransform ) if ( mTransform )
{ {
try { try
{
f.geometry()->transform( *mTransform ); f.geometry()->transform( *mTransform );
} catch (const QgsException& e) { }
catch ( const QgsException& e )
{
// See http://hub.qgis.org/issues/12634 // 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; continue;
} }
} }
@ -724,11 +730,14 @@ void QgsPointLocator::onFeatureAdded( QgsFeatureId fid )
if ( mTransform ) if ( mTransform )
{ {
try { try
{
f.geometry()->transform( *mTransform ); f.geometry()->transform( *mTransform );
} catch (const QgsException& e) { }
catch ( const QgsException& e )
{
// See http://hub.qgis.org/issues/12634 // 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; return;
} }
} }

View File

@ -408,7 +408,7 @@ QWidget* QgsProviderRegistry::selectWidget( const QString & providerKey,
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000
QFunctionPointer QgsProviderRegistry::function( QString const & providerKey, QFunctionPointer QgsProviderRegistry::function( QString const & providerKey,
QString const & functionName ) QString const & functionName )
{ {
QLibrary myLib( library( providerKey ) ); QLibrary myLib( library( providerKey ) );

View File

@ -37,8 +37,8 @@ class CORE_EXPORT QgsStatisticalSummary
//! Enumeration of flags that specify statistics to be calculated //! Enumeration of flags that specify statistics to be calculated
enum Statistic enum Statistic
{ {
Count = 1, //!< Count Count = 1, //!< Count
Sum = 2, //!< Sum of values Sum = 2, //!< Sum of values
Mean = 4, //!< Mean of values Mean = 4, //!< Mean of values
Median = 8, //!< Median of values Median = 8, //!< Median of values
StDev = 16, //!< Standard deviation of values StDev = 16, //!< Standard deviation of values

View File

@ -269,7 +269,6 @@ class CORE_EXPORT QgsGraduatedSymbolRendererV2 : public QgsFeatureRendererV2
//! @note added in 2.10 //! @note added in 2.10
void setGraduatedMethod( GraduatedMethod method ) { mGraduatedMethod = method; } void setGraduatedMethod( GraduatedMethod method ) { mGraduatedMethod = method; }
void setRotationField( QString fieldOrExpression ) override; void setRotationField( QString fieldOrExpression ) override;
QString rotationField() const override; QString rotationField() const override;

View File

@ -535,7 +535,7 @@ void QgsRelationReferenceWidget::init()
mComboBox->setCurrentIndex( mComboBox->findData( mFeature.id(), QgsAttributeTableModel::FeatureIdRole ) ); mComboBox->setCurrentIndex( mComboBox->findData( mFeature.id(), QgsAttributeTableModel::FeatureIdRole ) );
// Only connect after iterating, to have only one iterator on the referenced table at once // 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(); QApplication::restoreOverrideCursor();
} }
} }

View File

@ -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 ) if ( mWidgetList.count() == 0 )
{ {
hide(); hide();

View File

@ -31,7 +31,7 @@ class GUI_EXPORT QgsUserInputToolBar : public QToolBar
void addUserInputWidget( QWidget* widget ); void addUserInputWidget( QWidget* widget );
protected: protected:
void paintEvent(QPaintEvent *event); void paintEvent( QPaintEvent *event );
private slots: private slots:
void widgetDestroyed( QObject* obj ); void widgetDestroyed( QObject* obj );

View File

@ -37,9 +37,9 @@ class TestQgsScaleExpression: public QObject
{ {
{ {
QgsScaleExpression exp( "scale_linear(column, 1, 7, 2, 10)" ); QgsScaleExpression exp( "scale_linear(column, 1, 7, 2, 10)" );
QCOMPARE( bool(exp), true ); QCOMPARE( bool( exp ), true );
QCOMPARE( exp.type(), QgsScaleExpression::Linear ); QCOMPARE( exp.type(), QgsScaleExpression::Linear );
QCOMPARE( exp.baseExpression(), QString("column") ); QCOMPARE( exp.baseExpression(), QString( "column" ) );
QCOMPARE( exp.minValue(), 1. ); QCOMPARE( exp.minValue(), 1. );
QCOMPARE( exp.maxValue(), 7. ); QCOMPARE( exp.maxValue(), 7. );
QCOMPARE( exp.minSize(), 2. ); QCOMPARE( exp.minSize(), 2. );
@ -47,34 +47,34 @@ class TestQgsScaleExpression: public QObject
} }
{ {
QgsScaleExpression exp( "scale_exp(column, 1, 7, 2, 10, 0.5)" ); QgsScaleExpression exp( "scale_exp(column, 1, 7, 2, 10, 0.5)" );
QCOMPARE( bool(exp), true ); QCOMPARE( bool( exp ), true );
QCOMPARE( exp.type(), QgsScaleExpression::Area ); QCOMPARE( exp.type(), QgsScaleExpression::Area );
} }
{ {
QgsScaleExpression exp( "scale_exp(column, 1, 7, 2, 10, 0.57)" ); QgsScaleExpression exp( "scale_exp(column, 1, 7, 2, 10, 0.57)" );
QCOMPARE( bool(exp), true ); QCOMPARE( bool( exp ), true );
QCOMPARE( exp.type(), QgsScaleExpression::Flannery ); QCOMPARE( exp.type(), QgsScaleExpression::Flannery );
} }
{ {
QgsScaleExpression exp( "scale_exp(column, 1, 7, 2, 10, 0.51)" ); QgsScaleExpression exp( "scale_exp(column, 1, 7, 2, 10, 0.51)" );
QCOMPARE( bool(exp), false ); QCOMPARE( bool( exp ), false );
QCOMPARE( exp.type(), QgsScaleExpression::Unknown ); QCOMPARE( exp.type(), QgsScaleExpression::Unknown );
} }
{ {
QgsScaleExpression exp( "scale_exp(column, 1, 7, a, 10, 0.5)" ); 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 ); 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 ); QgsScaleExpression exp( QgsScaleExpression::Linear, "column", 1, 7, 2, 10 );
QCOMPARE( bool(exp), true ); QCOMPARE( bool( exp ), true );
QCOMPARE( exp.type(), QgsScaleExpression::Linear ); QCOMPARE( exp.type(), QgsScaleExpression::Linear );
QCOMPARE( exp.baseExpression(), QString("column") ); QCOMPARE( exp.baseExpression(), QString( "column" ) );
QCOMPARE( exp.minValue(), 1. ); QCOMPARE( exp.minValue(), 1. );
QCOMPARE( exp.maxValue(), 7. ); QCOMPARE( exp.maxValue(), 7. );
QCOMPARE( exp.minSize(), 2. ); QCOMPARE( exp.minSize(), 2. );