Skip to content

Commit 5d54b32

Browse files
committed
Merge branch 'master' of github.com:kiselev-dv/QGIS
2 parents 6004c14 + edeafa9 commit 5d54b32

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+2957
-348
lines changed

cmake/FindGRASS.cmake

+7
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,14 @@ MACRO (CHECK_GRASS G_PREFIX)
4141
MARK_AS_ADVANCED ( GRASS_LIBRARY${GRASS_FIND_VERSION}_${LIB} )
4242

4343
SET(LIB_PATH NOTFOUND)
44+
# FIND_PATH and FIND_LIBRARY normally search standard locations
45+
# before the specified paths. To search non-standard paths first,
46+
# FIND_* is invoked first with specified paths and NO_DEFAULT_PATH
47+
# and then again with no specified paths to search the default
48+
# locations. When an earlier FIND_* succeeds, subsequent FIND_*s
49+
# searching for the same item do nothing.
4450
FIND_LIBRARY(LIB_PATH NAMES grass_${LIB} PATHS ${G_PREFIX}/lib NO_DEFAULT_PATH)
51+
FIND_LIBRARY(LIB_PATH NAMES grass_${LIB} PATHS ${G_PREFIX}/lib)
4552

4653
IF(LIB_PATH)
4754
SET(GRASS_LIBRARY${GRASS_FIND_VERSION}_${LIB} ${LIB_PATH})

python/core/composer/qgscomposermap.sip

+2-2
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ class QgsComposerMap : QgsComposerItem
182182
/**Called when atlas preview is toggled, to force map item to update its extent and redraw
183183
* @deprecated no longer required
184184
*/
185-
void toggleAtlasPreview();
185+
void toggleAtlasPreview() /Deprecated/;
186186

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

625625
/** Set the overview's centering mode
626626
* @deprecated use overview()->setCentered() or overviews() instead

python/core/core.sip

+1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
%Include qgssnapper.sip
104104
%Include qgssnappingutils.sip
105105
%Include qgsspatialindex.sip
106+
%Include qgsstatisticalsummary.sip
106107
%Include qgstolerance.sip
107108
%Include qgsvectordataprovider.sip
108109
%Include qgsvectorfilewriter.sip

python/core/qgsexpression.sip

+9-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class QgsExpression
8383

8484
double scale();
8585

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

8989
//! Return the expression string that represents this QgsExpression.
@@ -202,6 +202,13 @@ class QgsExpression
202202
/** Does this function use a geometry object. */
203203
bool usesgeometry();
204204

205+
/** Returns a list of possible aliases for the function. These include
206+
* other permissible names for the function, eg deprecated names.
207+
* @return list of known aliases
208+
* @note added in QGIS 2.9
209+
*/
210+
virtual QStringList aliases() const;
211+
205212
/** True if this function should use lazy evaluation. Lazy evaluation functions take QgsExpression::Node objects
206213
* rather than the node results when called. You can use node->eval(parent, feature) to evaluate the node and return the result
207214
* Functions are non lazy default and will be given the node return value when called **/
@@ -231,7 +238,7 @@ class QgsExpression
231238
static bool isFunctionName( QString name );
232239

233240
// return index of the function in Functions array
234-
static int functionIndex( QString name );
241+
static int functionIndex( const QString& name );
235242

236243
/** Returns the number of functions defined in the parser
237244
* @return The number of function defined in the parser.

python/core/qgsfield.sip

+41-22
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
2-
/**
3-
\class QgsField
4-
\brief Class to encapsulate a field in an attribute table or data source.
5-
6-
QgsField stores metadata about an attribute field, including name, type
7-
length, and if applicable, precision.
1+
/** \class QgsField
2+
* \ingroup core
3+
* Encapsulate a field in an attribute table or data source.
4+
* QgsField stores metadata about an attribute field, including name, type
5+
* length, and if applicable, precision.
6+
* \note QgsField objects are implicitly shared.
87
*/
98

109
class QgsField
@@ -34,14 +33,18 @@ public:
3433
int prec = 0,
3534
QString comment = QString() );
3635

36+
/** Copy constructor
37+
*/
38+
QgsField( const QgsField& other );
39+
3740
//! Destructor
38-
~QgsField();
41+
virtual ~QgsField();
3942

4043
bool operator==( const QgsField& other ) const;
4144
bool operator!=( const QgsField& other ) const;
4245

4346
//! Gets the name of the field
44-
const QString & name() const;
47+
const QString& name() const;
4548

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

5860
/**
5961
Gets the length of the field.
6062
@return int containing the length of the field
6163
*/
6264
int length() const;
6365

64-
6566
/**
6667
Gets the precision of the field. Not all field types have a related precision.
6768
@return int containing the precision or zero if not applicable to the field type.
@@ -71,13 +72,13 @@ public:
7172
/**
7273
Returns the field comment
7374
*/
74-
const QString & comment() const;
75+
const QString& comment() const;
7576

7677
/**
7778
Set the field name.
78-
@param nam Name of the field
79+
@param name Name of the field
7980
*/
80-
void setName( const QString & nam );
81+
void setName( const QString& name );
8182

8283
/**
8384
Set variant type.
@@ -86,9 +87,9 @@ public:
8687

8788
/**
8889
Set the field type.
89-
@param typ Field type
90+
@param typeName Field type
9091
*/
91-
void setTypeName( const QString & typ );
92+
void setTypeName( const QString& typeName );
9293

9394
/**
9495
Set the field length.
@@ -98,15 +99,14 @@ public:
9899

99100
/**
100101
Set the field precision.
101-
@param prec Precision of the field
102+
@param precision Precision of the field
102103
*/
103-
void setPrecision( int prec );
104-
104+
void setPrecision( int precision );
105105

106106
/**
107107
Set the field comment
108108
*/
109-
void setComment( const QString & comment );
109+
void setComment( const QString& comment );
110110

111111
/** Formats string for display*/
112112
QString displayString( const QVariant& v ) const;
@@ -171,6 +171,15 @@ public:
171171
}; // class QgsField
172172

173173

174+
/** \class QgsFields
175+
* \ingroup core
176+
* Container of fields for a vector layer.
177+
*
178+
* In addition to storing a list of QgsField instances, it also:
179+
* - allows quick lookups of field names to index in the list
180+
*- keeps track of where the field definition comes from (vector data provider, joined layer or newly added from an editing operation)
181+
* \note QgsFields objects are implicitly shared.
182+
*/
174183

175184
class QgsFields
176185
{
@@ -188,6 +197,16 @@ class QgsFields
188197
OriginExpression //!< field is calculated from an expression
189198
};
190199

200+
/** Constructor for an empty field container
201+
*/
202+
QgsFields();
203+
204+
/** Copy constructor
205+
*/
206+
QgsFields( const QgsFields& other );
207+
208+
virtual ~QgsFields();
209+
191210
//! Remove all fields
192211
void clear();
193212
//! Append a field. The field must have unique name, otherwise it is rejected (returns false)
@@ -217,7 +236,7 @@ class QgsFields
217236
bool exists( int i ) const;
218237

219238
//! Get field at particular index (must be in range 0..N-1)
220-
// inline const QgsField& operator[]( int i ) const;
239+
// const QgsField& operator[]( int i ) const;
221240
QgsField& operator[](int i) /Factory/;
222241
%MethodCode
223242
SIP_SSIZE_T idx = sipConvertFromSequenceIndex(a0, sipCpp->count());

python/core/qgsstatisticalsummary.sip

+157
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
/** \ingroup core
2+
* \class QgsStatisticalSummary
3+
* \brief Calculator for summary statistics for a list of doubles.
4+
*
5+
* Statistics are calculated by calling @link calculate @endlink and passing a list of doubles. The
6+
* individual statistics can then be retrieved using the associated methods. Note that not all statistics
7+
* are calculated by default. Statistics which require slower computations are only calculated by
8+
* specifying the statistic in the constructor or via @link setStatistics @endlink.
9+
*
10+
* \note Added in version 2.9
11+
*/
12+
13+
class QgsStatisticalSummary
14+
{
15+
%TypeHeaderCode
16+
#include <qgsstatisticalsummary.h>
17+
%End
18+
19+
public:
20+
21+
//! Enumeration of flags that specify statistics to be calculated
22+
enum Statistic
23+
{
24+
Count, //!< Count
25+
Sum, //!< Sum of values
26+
Mean, //!< Mean of values
27+
Median, //!< Median of values
28+
StDev, //!< Standard deviation of values
29+
StDevSample, //!< Sample standard deviation of values
30+
Min, //!< Min of values
31+
Max, //!< Max of values
32+
Range, //!< Range of values (max - min)
33+
Minority, //!< Minority of values
34+
Majority, //!< Majority of values
35+
Variety, //!< Variety (count of distinct) values
36+
FirstQuartile, //!< First quartile
37+
ThirdQuartile, //!< Third quartile
38+
InterQuartileRange, //!< Inter quartile range (IQR)
39+
All
40+
};
41+
typedef QFlags<QgsStatisticalSummary::Statistic> Statistics;
42+
43+
/** Constructor for QgsStatisticalSummary
44+
* @param stats flags for statistics to calculate
45+
*/
46+
QgsStatisticalSummary( QgsStatisticalSummary::Statistics stats = QgsStatisticalSummary::Statistics( 0 ) );
47+
48+
virtual ~QgsStatisticalSummary();
49+
50+
/** Returns flags which specify which statistics will be calculated. Some statistics
51+
* are always calculated (eg sum, min and max).
52+
* @see setStatistics
53+
*/
54+
QgsStatisticalSummary::Statistics statistics() const;
55+
56+
/** Sets flags which specify which statistics will be calculated. Some statistics
57+
* are always calculated (eg sum, min and max).
58+
* @param stats flags for statistics to calculate
59+
* @see statistics
60+
*/
61+
void setStatistics( QgsStatisticalSummary::Statistics stats );
62+
63+
/** Resets the calculated values
64+
*/
65+
void reset();
66+
67+
/** Calculates summary statistics for a list of values
68+
* @param values list of doubles
69+
*/
70+
void calculate( const QList<double>& values );
71+
72+
/** Returns calculated count of values
73+
*/
74+
int count() const;
75+
76+
/** Returns calculated sum of values
77+
*/
78+
double sum() const;
79+
80+
/** Returns calculated mean of values
81+
*/
82+
double mean() const;
83+
84+
/** Returns calculated median of values. This is only calculated if Statistic::Median has
85+
* been specified in the constructor or via setStatistics.
86+
*/
87+
double median() const;
88+
89+
/** Returns calculated minimum from values.
90+
*/
91+
double min() const;
92+
93+
/** Returns calculated maximum from values.
94+
*/
95+
double max() const;
96+
97+
/** Returns calculated range (difference between maximum and minimum values).
98+
*/
99+
double range() const;
100+
101+
/** Returns population standard deviation. This is only calculated if Statistic::StDev has
102+
* been specified in the constructor or via setStatistics.
103+
* @see sampleStDev
104+
*/
105+
double stDev() const;
106+
107+
/** Returns sample standard deviation. This is only calculated if Statistic::StDev has
108+
* been specified in the constructor or via setStatistics.
109+
* @see stDev
110+
*/
111+
double sampleStDev() const;
112+
113+
/** Returns variety of values. The variety is the count of unique values from the list.
114+
* This is only calculated if Statistic::Variety has been specified in the constructor
115+
* or via setStatistics.
116+
*/
117+
int variety() const;
118+
119+
/** Returns minority of values. The minority is the value with least occurances in the list
120+
* This is only calculated if Statistic::Minority has been specified in the constructor
121+
* or via setStatistics.
122+
* @see majority
123+
*/
124+
double minority() const;
125+
126+
/** Returns majority of values. The majority is the value with most occurances in the list
127+
* This is only calculated if Statistic::Majority has been specified in the constructor
128+
* or via setStatistics.
129+
* @see minority
130+
*/
131+
double majority() const;
132+
133+
/** Returns the first quartile of the values. The quartile is calculated using the
134+
* "Tukey's hinges" method.
135+
* @see thirdQuartile
136+
* @see interQuartileRange
137+
*/
138+
double firstQuartile() const;
139+
140+
/** Returns the third quartile of the values. The quartile is calculated using the
141+
* "Tukey's hinges" method.
142+
* @see firstQuartile
143+
* @see interQuartileRange
144+
*/
145+
double thirdQuartile() const;
146+
147+
/** Returns the inter quartile range of the values. The quartiles are calculated using the
148+
* "Tukey's hinges" method.
149+
* @see firstQuartile
150+
* @see thirdQuartile
151+
*/
152+
double interQuartileRange() const;
153+
154+
};
155+
156+
QFlags<QgsStatisticalSummary::Statistic> operator|(QgsStatisticalSummary::Statistic f1, QFlags<QgsStatisticalSummary::Statistic> f2);
157+

0 commit comments

Comments
 (0)