Skip to content

Commit

Permalink
Merge pull request #3324 from nyalldawson/qgis
Browse files Browse the repository at this point in the history
QGis class rename and cleanup
  • Loading branch information
nyalldawson committed Jul 22, 2016
2 parents 39da9d1 + 8f203c9 commit 791b2c3
Show file tree
Hide file tree
Showing 513 changed files with 3,508 additions and 3,511 deletions.
9 changes: 9 additions & 0 deletions doc/api_break.dox
Expand Up @@ -41,6 +41,15 @@ This page tries to maintain a list with incompatible changes that happened in pr

</ul>

\subsection qgis_api_break_3_0_Qgis Qgis

<ul>
<li>The QGis class was renamed to Qgis for capitalisation consistency with other class names</li>
<li>permissiveToDouble() and permissiveToInt() where moved out of the QGis class and renamed to qgsPermissiveToDouble() and
qgsPermissiveToInt()</li>
<li>The constants DEFAULT_IDENTIFY_RADIUS and MINIMUM_POINT_SIZE were removed</li>
</ul>

\subsection qgis_api_break_3_0_QgsAuthConfigUriEdit QgsAuthConfigUriEdit

<ul>
Expand Down
2 changes: 1 addition & 1 deletion python/analysis/vector/qgsgeometryanalyzer.sip
@@ -1,5 +1,5 @@
/** \ingroup analysis
* The QGis class provides vector geometry analysis functions
* The Qgis class provides vector geometry analysis functions
*/

class QgsGeometryAnalyzer
Expand Down
2 changes: 1 addition & 1 deletion python/analysis/vector/qgsoverlayanalyzer.sip
@@ -1,6 +1,6 @@

/** \ingroup analysis
* The QGis class provides vector overlay analysis functions
* The Qgis class provides vector overlay analysis functions
*/

class QgsOverlayAnalyzer
Expand Down
2 changes: 1 addition & 1 deletion python/analysis/vector/qgszonalstatistics.sip
@@ -1,5 +1,5 @@
/** \ingroup analysis
* The QGis class that calculates raster statistics (count, sum, mean) for
* The Qgis class that calculates raster statistics (count, sum, mean) for
* a polygon or multipolygon layer and appends the results as attributes
*/

Expand Down
6 changes: 3 additions & 3 deletions python/core/dxf/qgsdxfexport.sip
Expand Up @@ -63,14 +63,14 @@ class QgsDxfExport
* Set map units
* @param u unit
*/
void setMapUnits( QGis::UnitType u );
void setMapUnits( Qgis::UnitType u );

/**
* Retrieve map units
* @returns unit
* @see setMapUnits
*/
QGis::UnitType mapUnits() const;
Qgis::UnitType mapUnits() const;

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

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

//! Return cleaned layer name for use in DXF
static QString dxfLayerName( const QString &name );
Expand Down
14 changes: 7 additions & 7 deletions python/core/geometry/qgsgeometry.sip
Expand Up @@ -126,12 +126,12 @@ class QgsGeometry
/** Returns type of the geometry as a WKB type (point / linestring / polygon etc.)
* @see type
*/
QGis::WkbType wkbType() const;
Qgis::WkbType wkbType() const;

/** Returns type of the geometry as a QGis::GeometryType
/** Returns type of the geometry as a Qgis::GeometryType
* @see wkbType
*/
QGis::GeometryType type() const;
Qgis::GeometryType type() const;

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

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

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

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

/* Accessor functions for getting geometry data */

Expand Down
65 changes: 30 additions & 35 deletions python/core/qgis.sip
Expand Up @@ -19,9 +19,9 @@


/** \ingroup core
* The QGis class provides global constants for use throughout the application.
* The Qgis class provides global constants for use throughout the application.
*/
class QGis
class Qgis
{
%TypeHeaderCode
#include <qgis.h>
Expand Down Expand Up @@ -93,10 +93,10 @@ class QGis
static int wkbDimensions( WkbType type );

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

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

enum GeometryType
{
Expand Down Expand Up @@ -162,43 +162,23 @@ class QGis

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

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

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

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

//! Returns the conversion factor between the specified units
//! @deprecated use QgsUnitTyoes::fromUnitToUnitFactor() instead
static double fromUnitToUnitFactor( QGis::UnitType fromUnit, QGis::UnitType toUnit ) /Deprecated/;

/** Converts a string to a double in a permissive way, eg allowing for incorrect
* numbers of digits between thousand separators
* @param string string to convert
* @param ok will be set to true if conversion was successful
* @returns string converted to double if possible
* @note added in version 2.9
* @see permissiveToInt
*/
static double permissiveToDouble( QString string, bool& ok );

/** Converts a string to an integer in a permissive way, eg allowing for incorrect
* numbers of digits between thousand separators
* @param string string to convert
* @param ok will be set to true if conversion was successful
* @returns string converted to int if possible
* @note added in version 2.9
* @see permissiveToDouble
*/
static int permissiveToInt( QString string, bool& ok );
static double fromUnitToUnitFactor( Qgis::UnitType fromUnit, Qgis::UnitType toUnit ) /Deprecated/;

//! User defined event types
enum UserEvent
Expand All @@ -212,10 +192,6 @@ class QGis
ProviderCountCalcEvent
};

/** Old search radius in % of canvas width
* @deprecated since 2.3, use DEFAULT_SEARCH_RADIUS_MM */
static const double DEFAULT_IDENTIFY_RADIUS;

/** Identify search radius in mm
* @note added in 2.3 */
static const double DEFAULT_SEARCH_RADIUS_MM;
Expand Down Expand Up @@ -243,6 +219,27 @@ class QGis
static double SCALE_PRECISION;
};


/** Converts a string to a double in a permissive way, eg allowing for incorrect
* numbers of digits between thousand separators
* @param string string to convert
* @param ok will be set to true if conversion was successful
* @returns string converted to double if possible
* @note added in version 2.9
* @see permissiveToInt
*/
double qgsPermissiveToDouble( QString string, bool& ok );

/** Converts a string to an integer in a permissive way, eg allowing for incorrect
* numbers of digits between thousand separators
* @param string string to convert
* @param ok will be set to true if conversion was successful
* @returns string converted to int if possible
* @note added in version 2.9
* @see permissiveToDouble
*/
int qgsPermissiveToInt( QString string, bool& ok );

//! Compares two QVariant values and returns whether the first is less than the second.
//! Useful for sorting lists of variants, correctly handling sorting of the various
//! QVariant data types (such as strings, numeric values, dates and times)
Expand Down Expand Up @@ -288,8 +285,6 @@ const QString GEO_NONE;
// Constants for point symbols
//

/** Magic number that determines the minimum allowable point size for point symbols */
const double MINIMUM_POINT_SIZE;
/** Magic number that determines the default point size for point symbols */
const double DEFAULT_POINT_SIZE;
const double DEFAULT_LINE_WIDTH;
Expand Down
2 changes: 1 addition & 1 deletion python/core/qgscoordinatereferencesystem.sip
Expand Up @@ -446,7 +446,7 @@ class QgsCoordinateReferenceSystem

/** Returns the units for the projection used by the CRS.
*/
QGis::UnitType mapUnits() const;
Qgis::UnitType mapUnits() const;


// Mutators -----------------------------------
Expand Down
4 changes: 2 additions & 2 deletions python/core/qgsdatasourceuri.sip
Expand Up @@ -165,14 +165,14 @@ class QgsDataSourceURI

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

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

//! @deprecated See setWkbType( QgsWKBTypes::Type )
void setWkbType( QGis::WkbType type ) /Deprecated/;
void setWkbType( Qgis::WkbType type ) /Deprecated/;

//! Sets the wkb type
void setWkbType( QgsWKBTypes::Type type );
Expand Down
10 changes: 5 additions & 5 deletions python/core/qgsdistancearea.sip
Expand Up @@ -155,7 +155,7 @@ class QgsDistanceArea
* @note added in QGIS 2.14
* @see areaUnits()
*/
QGis::UnitType lengthUnits() const;
Qgis::UnitType lengthUnits() const;

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

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

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

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

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

/** Takes an area measurement calculated by this QgsDistanceArea object and converts it to a
* different areal unit.
Expand Down
4 changes: 2 additions & 2 deletions python/core/qgsexpression.sip
Expand Up @@ -167,14 +167,14 @@ class QgsExpression
* @note added in QGIS 2.14
* @see setDistanceUnits()
*/
QGis::UnitType distanceUnits() const;
Qgis::UnitType distanceUnits() const;

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

/** Returns the desired areal units for calculations involving geomCalculator(), eg "$area".
* @note areas are only converted when a geomCalculator() has been set
Expand Down
4 changes: 2 additions & 2 deletions python/core/qgsgml.sip
Expand Up @@ -24,7 +24,7 @@ class QgsGml: QObject
* @note available in python as getFeaturesUri
*/
int getFeatures( const QString& uri,
QGis::WkbType* wkbType,
Qgis::WkbType* wkbType,
QgsRectangle* extent = 0,
const QString& userName = QString(),
const QString& password = QString(),
Expand All @@ -33,7 +33,7 @@ class QgsGml: QObject
/** Read from GML data. Constructor uri param is ignored
* Supports only UTF-8, UTF-16, ISO-8859-1, ISO-8859-1 XML encodings.
*/
int getFeatures( const QByteArray &data, QGis::WkbType* wkbType, QgsRectangle* extent = 0 );
int getFeatures( const QByteArray &data, Qgis::WkbType* wkbType, QgsRectangle* extent = 0 );

/** Get parsed features for given type name */
QMap<qint64, QgsFeature* > featuresMap() const;
Expand Down
4 changes: 2 additions & 2 deletions python/core/qgsmaprenderer.sip
Expand Up @@ -178,8 +178,8 @@ class QgsMapRenderer : QObject
//! Recalculate the map scale
void updateScale();

QGis::UnitType mapUnits() const;
void setMapUnits( QGis::UnitType u );
Qgis::UnitType mapUnits() const;
void setMapUnits( Qgis::UnitType u );

//! sets whether map image will be for overview
void enableOverviewMode( bool isOverview = true );
Expand Down
4 changes: 2 additions & 2 deletions python/core/qgsmapsettings.sip
Expand Up @@ -91,9 +91,9 @@ class QgsMapSettings
QgsCoordinateReferenceSystem destinationCrs() const;

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

//! Set the background color of the map
void setBackgroundColor( const QColor& color );
Expand Down
2 changes: 1 addition & 1 deletion python/core/qgsproject.sip
Expand Up @@ -246,7 +246,7 @@ class QgsProject : QObject
* @note added in QGIS 2.14
* @see areaUnits()
*/
QGis::UnitType distanceUnits() const;
Qgis::UnitType distanceUnits() const;

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

0 comments on commit 791b2c3

Please sign in to comment.