Skip to content

Commit 791b2c3

Browse files
authored
Merge pull request #3324 from nyalldawson/qgis
QGis class rename and cleanup
2 parents 39da9d1 + 8f203c9 commit 791b2c3

File tree

513 files changed

+3508
-3511
lines changed

Some content is hidden

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

513 files changed

+3508
-3511
lines changed

doc/api_break.dox

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ This page tries to maintain a list with incompatible changes that happened in pr
4141

4242
</ul>
4343

44+
\subsection qgis_api_break_3_0_Qgis Qgis
45+
46+
<ul>
47+
<li>The QGis class was renamed to Qgis for capitalisation consistency with other class names</li>
48+
<li>permissiveToDouble() and permissiveToInt() where moved out of the QGis class and renamed to qgsPermissiveToDouble() and
49+
qgsPermissiveToInt()</li>
50+
<li>The constants DEFAULT_IDENTIFY_RADIUS and MINIMUM_POINT_SIZE were removed</li>
51+
</ul>
52+
4453
\subsection qgis_api_break_3_0_QgsAuthConfigUriEdit QgsAuthConfigUriEdit
4554

4655
<ul>

python/analysis/vector/qgsgeometryanalyzer.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/** \ingroup analysis
2-
* The QGis class provides vector geometry analysis functions
2+
* The Qgis class provides vector geometry analysis functions
33
*/
44

55
class QgsGeometryAnalyzer

python/analysis/vector/qgsoverlayanalyzer.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
/** \ingroup analysis
3-
* The QGis class provides vector overlay analysis functions
3+
* The Qgis class provides vector overlay analysis functions
44
*/
55

66
class QgsOverlayAnalyzer

python/analysis/vector/qgszonalstatistics.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/** \ingroup analysis
2-
* The QGis class that calculates raster statistics (count, sum, mean) for
2+
* The Qgis class that calculates raster statistics (count, sum, mean) for
33
* a polygon or multipolygon layer and appends the results as attributes
44
*/
55

python/core/dxf/qgsdxfexport.sip

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ class QgsDxfExport
6363
* Set map units
6464
* @param u unit
6565
*/
66-
void setMapUnits( QGis::UnitType u );
66+
void setMapUnits( Qgis::UnitType u );
6767

6868
/**
6969
* Retrieve map units
7070
* @returns unit
7171
* @see setMapUnits
7272
*/
73-
QGis::UnitType mapUnits() const;
73+
Qgis::UnitType mapUnits() const;
7474

7575
/**
7676
* Set symbology export mode
@@ -327,7 +327,7 @@ class QgsDxfExport
327327
//! @note added in 2.15
328328
void writeMText( const QString &layer, const QString &text, const QgsPointV2 &pt, double width, double angle, const QColor& color );
329329

330-
static double mapUnitScaleFactor( double scaleDenominator, QgsSymbolV2::OutputUnit symbolUnits, QGis::UnitType mapUnits );
330+
static double mapUnitScaleFactor( double scaleDenominator, QgsSymbolV2::OutputUnit symbolUnits, Qgis::UnitType mapUnits );
331331

332332
//! Return cleaned layer name for use in DXF
333333
static QString dxfLayerName( const QString &name );

python/core/geometry/qgsgeometry.sip

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,12 @@ class QgsGeometry
126126
/** Returns type of the geometry as a WKB type (point / linestring / polygon etc.)
127127
* @see type
128128
*/
129-
QGis::WkbType wkbType() const;
129+
Qgis::WkbType wkbType() const;
130130

131-
/** Returns type of the geometry as a QGis::GeometryType
131+
/** Returns type of the geometry as a Qgis::GeometryType
132132
* @see wkbType
133133
*/
134-
QGis::GeometryType type() const;
134+
Qgis::GeometryType type() const;
135135

136136
/** Returns true if WKB of the geometry is of WKBMulti* type */
137137
bool isMultipart() const;
@@ -312,7 +312,7 @@ class QgsGeometry
312312
* not disjoint with existing polygons of the feature
313313
*/
314314
// TODO QGIS 3.0 returns an enum instead of a magic constant
315-
int addPart( const QList<QgsPoint> &points, QGis::GeometryType geomType = QGis::UnknownGeometry );
315+
int addPart( const QList<QgsPoint> &points, Qgis::GeometryType geomType = Qgis::UnknownGeometry );
316316

317317
/** Adds a new part to a the geometry.
318318
* @param points points describing part to add
@@ -321,7 +321,7 @@ class QgsGeometry
321321
* not disjoint with existing polygons of the feature
322322
*/
323323
// TODO QGIS 3.0 returns an enum instead of a magic constant
324-
int addPart( const QList<QgsPointV2> &points, QGis::GeometryType geomType = QGis::UnknownGeometry );
324+
int addPart( const QList<QgsPointV2> &points, Qgis::GeometryType geomType = Qgis::UnknownGeometry );
325325

326326
/** Adds a new part to this geometry.
327327
* @param part part to add (ownership is transferred)
@@ -330,7 +330,7 @@ class QgsGeometry
330330
* not disjoint with existing polygons of the feature
331331
*/
332332
// TODO QGIS 3.0 returns an enum instead of a magic constant
333-
int addPart( QgsAbstractGeometryV2* part /Transfer/, QGis::GeometryType geomType = QGis::UnknownGeometry );
333+
int addPart( QgsAbstractGeometryV2* part /Transfer/, Qgis::GeometryType geomType = Qgis::UnknownGeometry );
334334

335335
/** Adds a new island polygon to a multipolygon feature
336336
* @param newPart part to add. Ownership is NOT transferred.
@@ -514,7 +514,7 @@ class QgsGeometry
514514
* @return the converted geometry or nullptr if the conversion fails.
515515
* @note added in 2.2
516516
*/
517-
QgsGeometry* convertToType( QGis::GeometryType destType, bool destMultipart = false ) const /Factory/;
517+
QgsGeometry* convertToType( Qgis::GeometryType destType, bool destMultipart = false ) const /Factory/;
518518

519519
/* Accessor functions for getting geometry data */
520520

python/core/qgis.sip

Lines changed: 30 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919

2020

2121
/** \ingroup core
22-
* The QGis class provides global constants for use throughout the application.
22+
* The Qgis class provides global constants for use throughout the application.
2323
*/
24-
class QGis
24+
class Qgis
2525
{
2626
%TypeHeaderCode
2727
#include <qgis.h>
@@ -93,10 +93,10 @@ class QGis
9393
static int wkbDimensions( WkbType type );
9494

9595
//! Converts from old (pre 2.10) WKB type (OGR) to new WKB type
96-
static QgsWKBTypes::Type fromOldWkbType( QGis::WkbType type );
96+
static QgsWKBTypes::Type fromOldWkbType( Qgis::WkbType type );
9797

9898
//! Converts from new (post 2.10) WKB type (OGC) to old WKB type
99-
static QGis::WkbType fromNewWkbType( QgsWKBTypes::Type type );
99+
static Qgis::WkbType fromNewWkbType( QgsWKBTypes::Type type );
100100

101101
enum GeometryType
102102
{
@@ -162,43 +162,23 @@ class QGis
162162

163163
//! Provides the canonical name of the type value
164164
//! @deprecated use QgsUnitTypes::encodeUnit() instead
165-
static QString toLiteral( QGis::UnitType unit ) /Deprecated/;
165+
static QString toLiteral( Qgis::UnitType unit ) /Deprecated/;
166166

167167
//! Converts from the canonical name to the type value
168168
//! @deprecated use QgsUnitTypes::decodeDistanceUnit() instead
169-
static UnitType fromLiteral( const QString& literal, QGis::UnitType defaultType = UnknownUnit ) /Deprecated/;
169+
static UnitType fromLiteral( const QString& literal, Qgis::UnitType defaultType = UnknownUnit ) /Deprecated/;
170170

171171
//! Provides translated version of the type value
172172
//! @deprecated use QgsUnitTypes::toString() instead
173-
static QString tr( QGis::UnitType unit ) /Deprecated/;
173+
static QString tr( Qgis::UnitType unit ) /Deprecated/;
174174

175175
//! Provides type value from translated version
176176
//! @deprecated use QgsUnitTypes::stringToDistanceUnit() instead
177-
static UnitType fromTr( const QString& literal, QGis::UnitType defaultType = UnknownUnit ) /Deprecated/;
177+
static UnitType fromTr( const QString& literal, Qgis::UnitType defaultType = UnknownUnit ) /Deprecated/;
178178

179179
//! Returns the conversion factor between the specified units
180180
//! @deprecated use QgsUnitTyoes::fromUnitToUnitFactor() instead
181-
static double fromUnitToUnitFactor( QGis::UnitType fromUnit, QGis::UnitType toUnit ) /Deprecated/;
182-
183-
/** Converts a string to a double in a permissive way, eg allowing for incorrect
184-
* numbers of digits between thousand separators
185-
* @param string string to convert
186-
* @param ok will be set to true if conversion was successful
187-
* @returns string converted to double if possible
188-
* @note added in version 2.9
189-
* @see permissiveToInt
190-
*/
191-
static double permissiveToDouble( QString string, bool& ok );
192-
193-
/** Converts a string to an integer in a permissive way, eg allowing for incorrect
194-
* numbers of digits between thousand separators
195-
* @param string string to convert
196-
* @param ok will be set to true if conversion was successful
197-
* @returns string converted to int if possible
198-
* @note added in version 2.9
199-
* @see permissiveToDouble
200-
*/
201-
static int permissiveToInt( QString string, bool& ok );
181+
static double fromUnitToUnitFactor( Qgis::UnitType fromUnit, Qgis::UnitType toUnit ) /Deprecated/;
202182

203183
//! User defined event types
204184
enum UserEvent
@@ -212,10 +192,6 @@ class QGis
212192
ProviderCountCalcEvent
213193
};
214194

215-
/** Old search radius in % of canvas width
216-
* @deprecated since 2.3, use DEFAULT_SEARCH_RADIUS_MM */
217-
static const double DEFAULT_IDENTIFY_RADIUS;
218-
219195
/** Identify search radius in mm
220196
* @note added in 2.3 */
221197
static const double DEFAULT_SEARCH_RADIUS_MM;
@@ -243,6 +219,27 @@ class QGis
243219
static double SCALE_PRECISION;
244220
};
245221

222+
223+
/** Converts a string to a double in a permissive way, eg allowing for incorrect
224+
* numbers of digits between thousand separators
225+
* @param string string to convert
226+
* @param ok will be set to true if conversion was successful
227+
* @returns string converted to double if possible
228+
* @note added in version 2.9
229+
* @see permissiveToInt
230+
*/
231+
double qgsPermissiveToDouble( QString string, bool& ok );
232+
233+
/** Converts a string to an integer in a permissive way, eg allowing for incorrect
234+
* numbers of digits between thousand separators
235+
* @param string string to convert
236+
* @param ok will be set to true if conversion was successful
237+
* @returns string converted to int if possible
238+
* @note added in version 2.9
239+
* @see permissiveToDouble
240+
*/
241+
int qgsPermissiveToInt( QString string, bool& ok );
242+
246243
//! Compares two QVariant values and returns whether the first is less than the second.
247244
//! Useful for sorting lists of variants, correctly handling sorting of the various
248245
//! QVariant data types (such as strings, numeric values, dates and times)
@@ -288,8 +285,6 @@ const QString GEO_NONE;
288285
// Constants for point symbols
289286
//
290287

291-
/** Magic number that determines the minimum allowable point size for point symbols */
292-
const double MINIMUM_POINT_SIZE;
293288
/** Magic number that determines the default point size for point symbols */
294289
const double DEFAULT_POINT_SIZE;
295290
const double DEFAULT_LINE_WIDTH;

python/core/qgscoordinatereferencesystem.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ class QgsCoordinateReferenceSystem
446446

447447
/** Returns the units for the projection used by the CRS.
448448
*/
449-
QGis::UnitType mapUnits() const;
449+
Qgis::UnitType mapUnits() const;
450450

451451

452452
// Mutators -----------------------------------

python/core/qgsdatasourceuri.sip

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,14 +165,14 @@ class QgsDataSourceURI
165165

166166
/** The (old) wkb type.
167167
@deprecated Will return QgsWKBTypes::Type in 3.0. Prefer newWkbType() in the meantime */
168-
QGis::WkbType wkbType() const /Deprecated/;
168+
Qgis::WkbType wkbType() const /Deprecated/;
169169

170170
/** The wkb type.
171171
@note Will be removed in 3.0 */
172172
QgsWKBTypes::Type newWkbType() const;
173173

174174
//! @deprecated See setWkbType( QgsWKBTypes::Type )
175-
void setWkbType( QGis::WkbType type ) /Deprecated/;
175+
void setWkbType( Qgis::WkbType type ) /Deprecated/;
176176

177177
//! Sets the wkb type
178178
void setWkbType( QgsWKBTypes::Type type );

python/core/qgsdistancearea.sip

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ class QgsDistanceArea
155155
* @note added in QGIS 2.14
156156
* @see areaUnits()
157157
*/
158-
QGis::UnitType lengthUnits() const;
158+
Qgis::UnitType lengthUnits() const;
159159

160160
/** Returns the units of area for areal calculations made by this object.
161161
* @note added in QGIS 2.14
@@ -179,7 +179,7 @@ class QgsDistanceArea
179179
* @return formatted measurement string
180180
* @deprecated use formatDistance() or formatArea() instead
181181
*/
182-
static QString textUnit( double value, int decimals, QGis::UnitType u, bool isArea, bool keepBaseUnit = false ) /Deprecated/;
182+
static QString textUnit( double value, int decimals, Qgis::UnitType u, bool isArea, bool keepBaseUnit = false ) /Deprecated/;
183183

184184
/** Returns an distance formatted as a friendly string.
185185
* @param distance distance to format
@@ -191,7 +191,7 @@ class QgsDistanceArea
191191
* @note added in QGIS 2.16
192192
* @see formatArea()
193193
*/
194-
static QString formatDistance( double distance, int decimals, QGis::UnitType unit, bool keepBaseUnit = false );
194+
static QString formatDistance( double distance, int decimals, Qgis::UnitType unit, bool keepBaseUnit = false );
195195

196196
/** Returns an area formatted as a friendly string.
197197
* @param area area to format
@@ -208,7 +208,7 @@ class QgsDistanceArea
208208

209209
//! Helper for conversion between physical units
210210
// TODO QGIS 3.0 - remove this method, as its behaviour is non-intuitive.
211-
void convertMeasurement( double &measure /In,Out/, QGis::UnitType &measureUnits /In,Out/, QGis::UnitType displayUnits, bool isArea ) const;
211+
void convertMeasurement( double &measure /In,Out/, Qgis::UnitType &measureUnits /In,Out/, Qgis::UnitType displayUnits, bool isArea ) const;
212212

213213
/** Takes a length measurement calculated by this QgsDistanceArea object and converts it to a
214214
* different distance unit.
@@ -219,7 +219,7 @@ class QgsDistanceArea
219219
* @see convertAreaMeasurement()
220220
* @note added in QGIS 2.14
221221
*/
222-
double convertLengthMeasurement( double length, QGis::UnitType toUnits ) const;
222+
double convertLengthMeasurement( double length, Qgis::UnitType toUnits ) const;
223223

224224
/** Takes an area measurement calculated by this QgsDistanceArea object and converts it to a
225225
* different areal unit.

python/core/qgsexpression.sip

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,14 @@ class QgsExpression
167167
* @note added in QGIS 2.14
168168
* @see setDistanceUnits()
169169
*/
170-
QGis::UnitType distanceUnits() const;
170+
Qgis::UnitType distanceUnits() const;
171171

172172
/** Sets the desired distance units for calculations involving geomCalculator(), eg "$length" and "$perimeter".
173173
* @note distances are only converted when a geomCalculator() has been set
174174
* @note added in QGIS 2.14
175175
* @see distanceUnits()
176176
*/
177-
void setDistanceUnits( QGis::UnitType unit );
177+
void setDistanceUnits( Qgis::UnitType unit );
178178

179179
/** Returns the desired areal units for calculations involving geomCalculator(), eg "$area".
180180
* @note areas are only converted when a geomCalculator() has been set

python/core/qgsgml.sip

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class QgsGml: QObject
2424
* @note available in python as getFeaturesUri
2525
*/
2626
int getFeatures( const QString& uri,
27-
QGis::WkbType* wkbType,
27+
Qgis::WkbType* wkbType,
2828
QgsRectangle* extent = 0,
2929
const QString& userName = QString(),
3030
const QString& password = QString(),
@@ -33,7 +33,7 @@ class QgsGml: QObject
3333
/** Read from GML data. Constructor uri param is ignored
3434
* Supports only UTF-8, UTF-16, ISO-8859-1, ISO-8859-1 XML encodings.
3535
*/
36-
int getFeatures( const QByteArray &data, QGis::WkbType* wkbType, QgsRectangle* extent = 0 );
36+
int getFeatures( const QByteArray &data, Qgis::WkbType* wkbType, QgsRectangle* extent = 0 );
3737

3838
/** Get parsed features for given type name */
3939
QMap<qint64, QgsFeature* > featuresMap() const;

python/core/qgsmaprenderer.sip

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ class QgsMapRenderer : QObject
178178
//! Recalculate the map scale
179179
void updateScale();
180180

181-
QGis::UnitType mapUnits() const;
182-
void setMapUnits( QGis::UnitType u );
181+
Qgis::UnitType mapUnits() const;
182+
void setMapUnits( Qgis::UnitType u );
183183

184184
//! sets whether map image will be for overview
185185
void enableOverviewMode( bool isOverview = true );

python/core/qgsmapsettings.sip

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ class QgsMapSettings
9191
QgsCoordinateReferenceSystem destinationCrs() const;
9292

9393
//! Get units of map's geographical coordinates - used for scale calculation
94-
QGis::UnitType mapUnits() const;
94+
Qgis::UnitType mapUnits() const;
9595
//! Set units of map's geographical coordinates - used for scale calculation
96-
void setMapUnits( QGis::UnitType u );
96+
void setMapUnits( Qgis::UnitType u );
9797

9898
//! Set the background color of the map
9999
void setBackgroundColor( const QColor& color );

python/core/qgsproject.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ class QgsProject : QObject
246246
* @note added in QGIS 2.14
247247
* @see areaUnits()
248248
*/
249-
QGis::UnitType distanceUnits() const;
249+
Qgis::UnitType distanceUnits() const;
250250

251251
/** Convenience function to query default area measurement units for project.
252252
* @note added in QGIS 2.14

0 commit comments

Comments
 (0)