Skip to content
Permalink
Browse files

Remove deprecated Qgis::WKBType and API cleanup (#3325)

* Remove deprecated Qgis::WKBType and API cleanup

Renames QgsWKBTypes to QgsWkbTypes

Replaces usage of the enums:

* Qgis::WKBType with QgsWkbTypes::Type
* Qgis::GeometryType with QgsWkbTypes::GeometryType

Their values should be forward compatible (a fact that was already
explited up to now by casting between the types)

Renames some SSLxxx to SslXxx and URIxxx to UriXxx

* Fix build warnings and simplify type handling

* Add a fixer to rewrite imports

* The forgotten rebase conflictThe forgotten rebase conflicts

* QgsDataSourcURI > QgsDataSourceUri

* QgsWKBTypes > QgsWkbTypes

* Qgis.WKBGeom > QgsWkbTypes.Geom

* Further python fixes

* Guess what... Qgis::wkbDimensions != QgsWkbTypes::wkbDimensions

* Fix tests

* Python 3 updates

* [travis] pull request caching cannot be disabled

so at least use it in r/w mode

* Fix python3 print in plugins
  • Loading branch information
m-kuhn committed Aug 4, 2016
1 parent 6dbe63f commit bb79d13e82a7ac406a7f0404ec529d7c8e29c6a8
Showing 512 changed files with 5,281 additions and 5,788 deletions.
@@ -19,9 +19,5 @@ export LD_LIBRARY_PATH=${HOME}/osgeo4travis/lib
export CTEST_PARALLEL_LEVEL=1
export CCACHE_CPP2=yes
export CCACHE_TEMPDIR=/tmp
if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then
export CCACHE_READONLY=yes
chmod -R ugo-w ~/.ccache
fi

xvfb-run ctest -V -E 'qgis_openstreetmaptest|qgis_wcsprovidertest' -S ./qgis-test-travis.ctest --output-on-failure
@@ -18,10 +18,6 @@ export PATH=${HOME}/osgeo4travis/bin:${HOME}/osgeo4travis/sbin:${PATH}
export LD_LIBRARY_PATH=${HOME}/osgeo4travis/lib
export CTEST_PARALLEL_LEVEL=1
export CCACHE_TEMPDIR=/tmp
if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then
export CCACHE_READONLY=yes
chmod -R ugo-w ~/.ccache
fi

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

@@ -44,7 +44,8 @@ should now call QgsCoordinateReferenceSystem::invalidateCache() and QgsCoordinat
<li>All destCrs() methods have been renamed to destinationCrs()</li>
<li>All exportXML() methods have been renamed to exportXml()</li>
<li>All importXML() methods have been renamed to importXml()</li>

<li>All methods taking or returning QGis::WkbType have been changed to use QgsWkbTypes::Type</li>
<li>All methods taking or returning QGis::GeometryType have been changed to use QgsWkbTypes::GeometryType</li>
</ul>


@@ -78,6 +79,18 @@ Some of these unit types have also been renamed - see the notes on QgsUnitTypes
QGis::UnitType parameters have been updated to take QgsUnitTypes::DistanceUnit instead.</li>
<li>The unit handling methods toLiteral, fromLiteral, tr, fromTr, fromUnitToUnitFactor have been removed. Their
corresponding counterparts in QgsUnitTypes should be used instead.</li>
<li>The enum QGis::WkbType has been removed in favor of QgsWkbTypes::Type
<li>The enum QGis::GeometryType has been removed in favor of QgsWkbTypes::GeometryType
<li>singleType() has been removed. Use the equivalent QgsWkbTypes::singleType() instead
<li>multiType() has been removed. Use the equivalent QgsWkbTypes::multiType() instead
<li>flatType() has been removed. Use the equivalent QgsWkbTypes::flatType() instead
<li>isSingleType() has been removed. Use the equivalent QgsWkbTypes::issingleType() instead
<li>isMultiType() has been removed. Use the equivalent QgsWkbTypes::isMultiType() instead
<li>wkbDimensions() has been removed. Use the equivalent QgsWkbTypes::coordDimensions() instead
<li>fromOldWkbType() has been removed. This is no longer required.
<li>fromNewWkbType() has been removed. This is no longer required.
<li>vectorGeometryType() has been removed. Use the equivalent QgsWkbTypes::geometrydisplayString() instead.
<li>featureType() has been removed. Use the equivalent QgsWkbTypes::displayString() instead.
</ul>

\subsection qgis_api_break_3_0_QgsAtlasComposition QgsAtlasComposition
@@ -92,6 +105,12 @@ corresponding counterparts in QgsUnitTypes should be used instead.</li>
<li>hasConfigID() has been renamed to hasConfigId()</li>
</ul>

\subsection qgis_api_break_3_0_QgsAuthMethod QgsAuthMethod
<ul>
<li>DataSourceURI has been renamed to DataSourceUri</li>
<li>GenericDataSourceURI has been renamed to GenericDataSourceUri</li>
</ul>

\subsection qgis_api_break_3_0_QgsComposerLegendItem QgsComposerLegendItem

<ul>
@@ -199,6 +218,13 @@ instead.</li>
<li>emitBeginInsertItems(), emitEndInsertItems(), emitBeginRemoveItems(), emitEndRemoveItems(), emitDataChanged(), emitStateChanged() have been removed.</li>
</ul>

\subsection qgis_api_break_3_0_QgsDatasourceUri QgsDataSourceURI

<ul>
<li>QgsDataSourceURI has been renamed to QgsDataSourceUri</li>
<li>QgsDataSourceURI::SSLmode has been renamed to QgsDataSourceUri::SslMode. All items of this enum have been properly CamelCased.</li>
</ul>

\subsection qgis_api_break_3_0_QgsDatumTransformStore QgsDatumTransformStore

<ul>
@@ -544,6 +570,7 @@ only affects third party c++ providers, and does not affect PyQGIS scripts.</li>
capabilities have been removed, as they were unused and had no effect.</li>
<li>capabilities() now returns a typesafe QgsVectorDataProvider::Capabilities object, not an integer.</li>
<li>convertToProviderType() now takes a geometry reference, not a pointer.</li>
<li>geometryType() has been renamed to wkbType() to be in line with QgsVectorLayer</li>
</ul>


@@ -168,7 +168,7 @@ class QgsAuthManager : QObject
QWidget *authMethodEditWidget( const QString &authMethodKey, QWidget *parent );

/**
* Get supported authentication method expansion(s), e.g. NetworkRequest | DataSourceURI, as flags
* Get supported authentication method expansion(s), e.g. NetworkRequest | DataSourceUri, as flags
* @param authcfg
*/
QgsAuthMethod::Expansions supportedAuthMethodExpansions( const QString &authcfg );
@@ -268,8 +268,8 @@ class QgsAuthManager : QObject
const QString &dataprovider = QString() );

/**
* Provider call to update a QgsDataSourceURI with an authentication config
* @param connectionItems The connection items, e.g. username=myname, of QgsDataSourceURI
* Provider call to update a QgsDataSourceUri with an authentication config
* @param connectionItems The connection items, e.g. username=myname, of QgsDataSourceUri
* @param authcfg Associated authentication config id
* @param dataprovider Provider key filter, offering logic branching in authentication method
* @return Whether operation succeeded
@@ -18,8 +18,8 @@ class QgsAuthMethod : QObject
// TODO: Figure out all different authentication expansions current layer providers use
NetworkRequest,
NetworkReply,
DataSourceURI,
GenericDataSourceURI,
DataSourceUri,
GenericDataSourceUri,
All
};
typedef QFlags<QgsAuthMethod::Expansion> Expansions;
@@ -70,7 +70,7 @@ class QgsAuthMethod : QObject
const QString &dataprovider = QString() );

/** Update data source connection items with authentication components
* @param connectionItems QStringlist of 'key=value' pairs, as utilized in QgsDataSourceURI::connectionInfo()
* @param connectionItems QStringlist of 'key=value' pairs, as utilized in QgsDataSourceUri::connectionInfo()
* @param authcfg Authentication configuration ID
* @param dataprovider Textual key for a data provider, e.g. 'postgres', that allows
* for custom updater code specific to the provider
@@ -112,7 +112,7 @@ class QgsAbstractGeometryV2
* @see geometryType
* @see wktTypeStr
*/
QgsWKBTypes::Type wkbType() const;
QgsWkbTypes::Type wkbType() const;

/** Returns the WKT type string of the geometry.
* @see geometryType
@@ -390,13 +390,13 @@ class QgsAbstractGeometryV2
* @returns true if conversion was successful
* @note added in QGIS 2.14
*/
virtual bool convertTo( QgsWKBTypes::Type type );
virtual bool convertTo( QgsWkbTypes::Type type );

protected:

/** Updates the geometry type based on whether sub geometries contain z or m values.
*/
void setZMTypeFromSubGeometry( const QgsAbstractGeometryV2* subggeom, QgsWKBTypes::Type baseGeomType );
void setZMTypeFromSubGeometry( const QgsAbstractGeometryV2* subggeom, QgsWkbTypes::Type baseGeomType );

/** Default calculator for the minimal bounding box for the geometry. Derived classes should override this method
* if a more efficient bounding box calculation is available.
@@ -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;
QgsWkbTypes::Type wkbType() const;

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

/** Returns true if WKB of the geometry is of WKBMulti* type */
bool isMultipart() const;
@@ -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, QgsWkbTypes::GeometryType geomType = QgsWkbTypes::UnknownGeometry );

/** Adds a new part to a the geometry.
* @param points points describing part to add
@@ -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, QgsWkbTypes::GeometryType geomType = QgsWkbTypes::UnknownGeometry );

/** Adds a new part to this geometry.
* @param part part to add (ownership is transferred)
@@ -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/, QgsWkbTypes::GeometryType geomType = QgsWkbTypes::UnknownGeometry );

/** Adds a new island polygon to a multipolygon feature
* @param newPart part to add. Ownership is NOT transferred.
@@ -531,7 +531,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;
QgsGeometry convertToType( QgsWkbTypes::GeometryType destType, bool destMultipart = false ) const /Factory/;

/* Accessor functions for getting geometry data */

@@ -168,7 +168,7 @@ class QgsLineStringV2: public QgsCurveV2
virtual bool dropZValue();
virtual bool dropMValue();

virtual bool convertTo( QgsWKBTypes::Type type );
virtual bool convertTo( QgsWkbTypes::Type type );

protected:

@@ -32,12 +32,12 @@ class QgsPointV2: public QgsAbstractGeometryV2
* @param z z-coordinate of point, for PointZ or PointZM types
* @param m m-value of point, for PointM or PointZM types
*/
QgsPointV2( QgsWKBTypes::Type type, double x = 0.0, double y = 0.0, double z = 0.0, double m = 0.0 );
QgsPointV2( QgsWkbTypes::Type type, double x = 0.0, double y = 0.0, double z = 0.0, double m = 0.0 );
%MethodCode
if ( QgsWKBTypes::flatType( a0 ) != QgsWKBTypes::Point )
if ( QgsWkbTypes::flatType( a0 ) != QgsWkbTypes::Point )
{
PyErr_SetString(PyExc_ValueError,
QString( "%1 is not a valid WKB type for point geometries" ).arg( QgsWKBTypes::displayString( a0 ) ).toUtf8().constData() );
QString( "%1 is not a valid WKB type for point geometries" ).arg( QgsWkbTypes::displayString( a0 ) ).toUtf8().constData() );
sipIsErr = 1;
}
else
@@ -181,6 +181,6 @@ class QgsPointV2: public QgsAbstractGeometryV2
virtual bool addMValue( double mValue = 0 );
virtual bool dropZValue();
virtual bool dropMValue();
virtual bool convertTo( QgsWKBTypes::Type type );
virtual bool convertTo( QgsWkbTypes::Type type );

};
@@ -1,4 +1,4 @@
class QgsWKBTypes
class QgsWkbTypes
{
%TypeHeaderCode
#include <qgswkbtypes.h>
@@ -146,6 +146,22 @@ class QgsWKBTypes
*/
static QString displayString( Type type );

/**
* Return a display string for a geometry type.
*
* This will return one of the following strings:
*
* - Point
* - Line
* - Polygon
* - Unknown Geometry
* - No Geometry
* - Invalid Geometry
*
* @note added in QGIS 3.0
*/
static QString geometryDisplayString( GeometryType type );

/** Tests whether a WKB type contains the z-dimension.
* @returns true if type has z values
* @see addZ()
@@ -42,77 +42,6 @@ class Qgis
// Enumerations
//

//! Used for symbology operations
// Feature types
enum WkbType
{
WKBUnknown,
WKBPoint,
WKBLineString,
WKBPolygon,
WKBMultiPoint,
WKBMultiLineString,
WKBMultiPolygon,
WKBNoGeometry, //attributes only
WKBPoint25D,
WKBLineString25D,
WKBPolygon25D,
WKBMultiPoint25D,
WKBMultiLineString25D,
WKBMultiPolygon25D,
};

//! Map multi to single type
// @deprecated use QgsWKBTypes::singleType
/* Q_DECL_DEPRECATED */
static WkbType singleType( WkbType type );

//! Map single to multitype type
// @deprecated use QgsWKBTypes::multiType
/* Q_DECL_DEPRECATED */
static WkbType multiType( WkbType type );

//! Map 2d+ to 2d type
// @deprecated use QgsWKBTypes::flatType
/* Q_DECL_DEPRECATED */
static WkbType flatType( WkbType type );

//! Return if type is a single type
// @deprecated use QgsWKBTypes::isSingleType
/* Q_DECL_DEPRECATED */
static bool isSingleType( WkbType type );

//! Return if type is a multi type
// @deprecated use QgsWKBTypes::isMultiType
/* Q_DECL_DEPRECATED */
static bool isMultiType( WkbType type );

// get dimension of points
// @deprecated use QgsWKBTypes::coordDimensions()
/* Q_DECL_DEPRECATED */
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 );

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

enum GeometryType
{
Point,
Line,
Polygon,
UnknownGeometry,
NoGeometry
};

//! description strings for geometry types
static const char *vectorGeometryType( GeometryType type );

//! description strings for feature types
static const char *featureType( WkbType type );

/** Raster data types.
* This is modified and extended copy of GDALDataType.
*/
@@ -175,7 +104,6 @@ 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
@@ -195,7 +123,6 @@ double qgsPermissiveToDouble( QString string, bool& ok );
* @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)

0 comments on commit bb79d13

Please sign in to comment.
You can’t perform that action at this time.