mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-16 00:03:12 -04:00
QgsAbstractGeometryV2::wkbType always returns a valid type
This commit is contained in:
parent
fdb28c09aa
commit
c07f02d6dc
@ -114,11 +114,6 @@ class QgsAbstractGeometryV2
|
|||||||
*/
|
*/
|
||||||
QgsWKBTypes::Type wkbType() const;
|
QgsWKBTypes::Type wkbType() const;
|
||||||
|
|
||||||
/** Returns the flat WKB type of the geometry class. Corresponds to information obtained from
|
|
||||||
* geometryType().
|
|
||||||
*/
|
|
||||||
virtual QgsWKBTypes::Type flatWkbType() const = 0;
|
|
||||||
|
|
||||||
/** Returns the WKT type string of the geometry.
|
/** Returns the WKT type string of the geometry.
|
||||||
* @see geometryType
|
* @see geometryType
|
||||||
* @see wkbType
|
* @see wkbType
|
||||||
|
@ -12,7 +12,6 @@ class QgsCircularStringV2: public QgsCurveV2
|
|||||||
virtual bool operator!=( const QgsCurveV2& other ) const;
|
virtual bool operator!=( const QgsCurveV2& other ) const;
|
||||||
|
|
||||||
virtual QString geometryType() const;
|
virtual QString geometryType() const;
|
||||||
virtual QgsWKBTypes::Type flatWkbType() const;
|
|
||||||
virtual int dimension() const;
|
virtual int dimension() const;
|
||||||
virtual QgsCircularStringV2* clone() const;
|
virtual QgsCircularStringV2* clone() const;
|
||||||
virtual void clear();
|
virtual void clear();
|
||||||
|
@ -14,7 +14,6 @@ class QgsCompoundCurveV2: public QgsCurveV2
|
|||||||
virtual bool operator!=( const QgsCurveV2& other ) const;
|
virtual bool operator!=( const QgsCurveV2& other ) const;
|
||||||
|
|
||||||
virtual QString geometryType() const;
|
virtual QString geometryType() const;
|
||||||
virtual QgsWKBTypes::Type flatWkbType() const;
|
|
||||||
virtual int dimension() const;
|
virtual int dimension() const;
|
||||||
virtual QgsCompoundCurveV2* clone() const;
|
virtual QgsCompoundCurveV2* clone() const;
|
||||||
virtual void clear();
|
virtual void clear();
|
||||||
|
@ -11,7 +11,6 @@ class QgsCurvePolygonV2: public QgsSurfaceV2
|
|||||||
~QgsCurvePolygonV2();
|
~QgsCurvePolygonV2();
|
||||||
|
|
||||||
virtual QString geometryType() const;
|
virtual QString geometryType() const;
|
||||||
virtual QgsWKBTypes::Type flatWkbType() const;
|
|
||||||
virtual int dimension() const;
|
virtual int dimension() const;
|
||||||
virtual QgsCurvePolygonV2* clone() const;
|
virtual QgsCurvePolygonV2* clone() const;
|
||||||
void clear();
|
void clear();
|
||||||
|
@ -29,7 +29,6 @@ class QgsGeometryCollectionV2: public QgsAbstractGeometryV2
|
|||||||
//methods inherited from QgsAbstractGeometry
|
//methods inherited from QgsAbstractGeometry
|
||||||
virtual int dimension() const;
|
virtual int dimension() const;
|
||||||
virtual QString geometryType() const;
|
virtual QString geometryType() const;
|
||||||
virtual QgsWKBTypes::Type flatWkbType() const;
|
|
||||||
virtual void clear();
|
virtual void clear();
|
||||||
|
|
||||||
/** Adds a geometry and takes ownership. Returns true in case of success.*/
|
/** Adds a geometry and takes ownership. Returns true in case of success.*/
|
||||||
|
@ -113,7 +113,6 @@ class QgsLineStringV2: public QgsCurveV2
|
|||||||
//reimplemented methods
|
//reimplemented methods
|
||||||
|
|
||||||
virtual QString geometryType() const;
|
virtual QString geometryType() const;
|
||||||
virtual QgsWKBTypes::Type flatWkbType() const;
|
|
||||||
virtual int dimension() const;
|
virtual int dimension() const;
|
||||||
virtual QgsLineStringV2* clone() const /Factory/;
|
virtual QgsLineStringV2* clone() const /Factory/;
|
||||||
virtual void clear();
|
virtual void clear();
|
||||||
|
@ -6,7 +6,6 @@ class QgsMultiCurveV2: public QgsGeometryCollectionV2
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
virtual QString geometryType() const;
|
virtual QString geometryType() const;
|
||||||
virtual QgsWKBTypes::Type flatWkbType() const;
|
|
||||||
virtual QgsMultiCurveV2* clone() const;
|
virtual QgsMultiCurveV2* clone() const;
|
||||||
|
|
||||||
bool fromWkt( const QString& wkt );
|
bool fromWkt( const QString& wkt );
|
||||||
|
@ -6,7 +6,6 @@ class QgsMultiLineStringV2: public QgsMultiCurveV2
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
virtual QString geometryType() const;
|
virtual QString geometryType() const;
|
||||||
virtual QgsWKBTypes::Type flatWkbType() const;
|
|
||||||
virtual QgsMultiLineStringV2* clone() const;
|
virtual QgsMultiLineStringV2* clone() const;
|
||||||
|
|
||||||
bool fromWkt( const QString& wkt );
|
bool fromWkt( const QString& wkt );
|
||||||
|
@ -5,7 +5,6 @@ class QgsMultiPointV2: public QgsGeometryCollectionV2
|
|||||||
%End
|
%End
|
||||||
public:
|
public:
|
||||||
virtual QString geometryType() const;
|
virtual QString geometryType() const;
|
||||||
virtual QgsWKBTypes::Type flatWkbType() const;
|
|
||||||
virtual QgsMultiPointV2* clone() const;
|
virtual QgsMultiPointV2* clone() const;
|
||||||
|
|
||||||
bool fromWkt( const QString& wkt );
|
bool fromWkt( const QString& wkt );
|
||||||
|
@ -5,7 +5,6 @@ class QgsMultiPolygonV2: public QgsMultiSurfaceV2
|
|||||||
%End
|
%End
|
||||||
public:
|
public:
|
||||||
virtual QString geometryType() const;
|
virtual QString geometryType() const;
|
||||||
virtual QgsWKBTypes::Type flatWkbType() const;
|
|
||||||
virtual QgsMultiPolygonV2* clone() const;
|
virtual QgsMultiPolygonV2* clone() const;
|
||||||
|
|
||||||
bool fromWkt( const QString& wkt );
|
bool fromWkt( const QString& wkt );
|
||||||
|
@ -5,7 +5,6 @@ class QgsMultiSurfaceV2: public QgsGeometryCollectionV2
|
|||||||
%End
|
%End
|
||||||
public:
|
public:
|
||||||
virtual QString geometryType() const;
|
virtual QString geometryType() const;
|
||||||
virtual QgsWKBTypes::Type flatWkbType() const;
|
|
||||||
virtual QgsMultiSurfaceV2* clone() const;
|
virtual QgsMultiSurfaceV2* clone() const;
|
||||||
|
|
||||||
bool fromWkt( const QString& wkt );
|
bool fromWkt( const QString& wkt );
|
||||||
|
@ -141,7 +141,6 @@ class QgsPointV2: public QgsAbstractGeometryV2
|
|||||||
//implementation of inherited methods
|
//implementation of inherited methods
|
||||||
virtual QgsRectangle boundingBox() const;
|
virtual QgsRectangle boundingBox() const;
|
||||||
virtual QString geometryType() const;
|
virtual QString geometryType() const;
|
||||||
virtual QgsWKBTypes::Type flatWkbType() const;
|
|
||||||
virtual int dimension() const;
|
virtual int dimension() const;
|
||||||
virtual QgsPointV2* clone() const /Factory/;
|
virtual QgsPointV2* clone() const /Factory/;
|
||||||
void clear();
|
void clear();
|
||||||
|
@ -11,8 +11,8 @@ class QgsPolygonV2: public QgsCurvePolygonV2
|
|||||||
bool operator!=( const QgsPolygonV2& other ) const;
|
bool operator!=( const QgsPolygonV2& other ) const;
|
||||||
|
|
||||||
virtual QString geometryType() const;
|
virtual QString geometryType() const;
|
||||||
virtual QgsWKBTypes::Type flatWkbType() const;
|
|
||||||
virtual QgsPolygonV2* clone() const;
|
virtual QgsPolygonV2* clone() const;
|
||||||
|
void clear();
|
||||||
|
|
||||||
virtual bool fromWkb( QgsConstWkbPtr wkb );
|
virtual bool fromWkb( QgsConstWkbPtr wkb );
|
||||||
|
|
||||||
|
@ -75,23 +75,18 @@ class CORE_EXPORT QgsAbstractGeometryV2
|
|||||||
virtual int dimension() const = 0;
|
virtual int dimension() const = 0;
|
||||||
//virtual int coordDim() const { return mCoordDimension; }
|
//virtual int coordDim() const { return mCoordDimension; }
|
||||||
|
|
||||||
/** Returns a unique string representing the geometry class type.
|
/** Returns a unique string representing the geometry type.
|
||||||
* @see wkbType
|
* @see wkbType
|
||||||
* @see wktTypeStr
|
* @see wktTypeStr
|
||||||
*/
|
*/
|
||||||
virtual QString geometryType() const = 0;
|
virtual QString geometryType() const = 0;
|
||||||
|
|
||||||
/** Returns the WKB type of the saved geometry.
|
/** Returns the WKB type of the geometry.
|
||||||
* @see geometryType
|
* @see geometryType
|
||||||
* @see wktTypeStr
|
* @see wktTypeStr
|
||||||
*/
|
*/
|
||||||
QgsWKBTypes::Type wkbType() const { return mWkbType; }
|
QgsWKBTypes::Type wkbType() const { return mWkbType; }
|
||||||
|
|
||||||
/** Returns the flat WKB type of the geometry class. Corresponds to information obtained from
|
|
||||||
* geometryType().
|
|
||||||
*/
|
|
||||||
virtual QgsWKBTypes::Type flatWkbType() const = 0;
|
|
||||||
|
|
||||||
/** Returns the WKT type string of the geometry.
|
/** Returns the WKT type string of the geometry.
|
||||||
* @see geometryType
|
* @see geometryType
|
||||||
* @see wkbType
|
* @see wkbType
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
QgsCircularStringV2::QgsCircularStringV2(): QgsCurveV2()
|
QgsCircularStringV2::QgsCircularStringV2(): QgsCurveV2()
|
||||||
{
|
{
|
||||||
|
mWkbType = QgsWKBTypes::CircularString;
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsCircularStringV2::~QgsCircularStringV2()
|
QgsCircularStringV2::~QgsCircularStringV2()
|
||||||
@ -57,11 +57,11 @@ QgsCircularStringV2 *QgsCircularStringV2::clone() const
|
|||||||
|
|
||||||
void QgsCircularStringV2::clear()
|
void QgsCircularStringV2::clear()
|
||||||
{
|
{
|
||||||
|
mWkbType = QgsWKBTypes::CircularString;
|
||||||
mX.clear();
|
mX.clear();
|
||||||
mY.clear();
|
mY.clear();
|
||||||
mZ.clear();
|
mZ.clear();
|
||||||
mM.clear();
|
mM.clear();
|
||||||
mWkbType = QgsWKBTypes::Unknown;
|
|
||||||
clearCache();
|
clearCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,6 @@ class CORE_EXPORT QgsCircularStringV2: public QgsCurveV2
|
|||||||
virtual bool operator!=( const QgsCurveV2& other ) const override;
|
virtual bool operator!=( const QgsCurveV2& other ) const override;
|
||||||
|
|
||||||
virtual QString geometryType() const override { return "CircularString"; }
|
virtual QString geometryType() const override { return "CircularString"; }
|
||||||
virtual QgsWKBTypes::Type flatWkbType() const override { return QgsWKBTypes::CircularString; }
|
|
||||||
virtual int dimension() const override { return 1; }
|
virtual int dimension() const override { return 1; }
|
||||||
virtual QgsCircularStringV2* clone() const override;
|
virtual QgsCircularStringV2* clone() const override;
|
||||||
virtual void clear() override;
|
virtual void clear() override;
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
QgsCompoundCurveV2::QgsCompoundCurveV2(): QgsCurveV2()
|
QgsCompoundCurveV2::QgsCompoundCurveV2(): QgsCurveV2()
|
||||||
{
|
{
|
||||||
|
mWkbType = QgsWKBTypes::CompoundCurve;
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsCompoundCurveV2::~QgsCompoundCurveV2()
|
QgsCompoundCurveV2::~QgsCompoundCurveV2()
|
||||||
@ -51,6 +51,7 @@ bool QgsCompoundCurveV2::operator!=( const QgsCurveV2& other ) const
|
|||||||
|
|
||||||
QgsCompoundCurveV2::QgsCompoundCurveV2( const QgsCompoundCurveV2& curve ): QgsCurveV2( curve )
|
QgsCompoundCurveV2::QgsCompoundCurveV2( const QgsCompoundCurveV2& curve ): QgsCurveV2( curve )
|
||||||
{
|
{
|
||||||
|
mWkbType = QgsWKBTypes::CompoundCurve;
|
||||||
Q_FOREACH ( const QgsCurveV2* c, curve.mCurves )
|
Q_FOREACH ( const QgsCurveV2* c, curve.mCurves )
|
||||||
{
|
{
|
||||||
mCurves.append( static_cast<QgsCurveV2*>( c->clone() ) );
|
mCurves.append( static_cast<QgsCurveV2*>( c->clone() ) );
|
||||||
@ -78,9 +79,9 @@ QgsCompoundCurveV2 *QgsCompoundCurveV2::clone() const
|
|||||||
|
|
||||||
void QgsCompoundCurveV2::clear()
|
void QgsCompoundCurveV2::clear()
|
||||||
{
|
{
|
||||||
|
mWkbType = QgsWKBTypes::CompoundCurve;
|
||||||
qDeleteAll( mCurves );
|
qDeleteAll( mCurves );
|
||||||
mCurves.clear();
|
mCurves.clear();
|
||||||
mWkbType = QgsWKBTypes::Unknown;
|
|
||||||
clearCache();
|
clearCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,6 @@ class CORE_EXPORT QgsCompoundCurveV2: public QgsCurveV2
|
|||||||
virtual bool operator!=( const QgsCurveV2& other ) const override;
|
virtual bool operator!=( const QgsCurveV2& other ) const override;
|
||||||
|
|
||||||
virtual QString geometryType() const override { return "CompoundCurve"; }
|
virtual QString geometryType() const override { return "CompoundCurve"; }
|
||||||
virtual QgsWKBTypes::Type flatWkbType() const override { return QgsWKBTypes::CompoundCurve; }
|
|
||||||
virtual int dimension() const override { return 1; }
|
virtual int dimension() const override { return 1; }
|
||||||
virtual QgsCompoundCurveV2* clone() const override;
|
virtual QgsCompoundCurveV2* clone() const override;
|
||||||
virtual void clear() override;
|
virtual void clear() override;
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
QgsCurvePolygonV2::QgsCurvePolygonV2(): QgsSurfaceV2(), mExteriorRing( nullptr )
|
QgsCurvePolygonV2::QgsCurvePolygonV2(): QgsSurfaceV2(), mExteriorRing( nullptr )
|
||||||
{
|
{
|
||||||
|
mWkbType = QgsWKBTypes::CurvePolygon;
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsCurvePolygonV2::~QgsCurvePolygonV2()
|
QgsCurvePolygonV2::~QgsCurvePolygonV2()
|
||||||
@ -40,6 +40,7 @@ QgsCurvePolygonV2::QgsCurvePolygonV2( const QgsCurvePolygonV2& p )
|
|||||||
: QgsSurfaceV2( p )
|
: QgsSurfaceV2( p )
|
||||||
, mExteriorRing( nullptr )
|
, mExteriorRing( nullptr )
|
||||||
{
|
{
|
||||||
|
mWkbType = p.mWkbType;
|
||||||
if ( p.mExteriorRing )
|
if ( p.mExteriorRing )
|
||||||
{
|
{
|
||||||
mExteriorRing = static_cast<QgsCurveV2*>( p.mExteriorRing->clone() );
|
mExteriorRing = static_cast<QgsCurveV2*>( p.mExteriorRing->clone() );
|
||||||
@ -77,11 +78,11 @@ QgsCurvePolygonV2* QgsCurvePolygonV2::clone() const
|
|||||||
|
|
||||||
void QgsCurvePolygonV2::clear()
|
void QgsCurvePolygonV2::clear()
|
||||||
{
|
{
|
||||||
|
mWkbType = QgsWKBTypes::CurvePolygon;
|
||||||
delete mExteriorRing;
|
delete mExteriorRing;
|
||||||
mExteriorRing = nullptr;
|
mExteriorRing = nullptr;
|
||||||
qDeleteAll( mInteriorRings );
|
qDeleteAll( mInteriorRings );
|
||||||
mInteriorRings.clear();
|
mInteriorRings.clear();
|
||||||
mWkbType = QgsWKBTypes::Unknown;
|
|
||||||
clearCache();
|
clearCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,7 +150,7 @@ bool QgsCurvePolygonV2::fromWkt( const QString& wkt )
|
|||||||
|
|
||||||
QPair<QgsWKBTypes::Type, QString> parts = QgsGeometryUtils::wktReadBlock( wkt );
|
QPair<QgsWKBTypes::Type, QString> parts = QgsGeometryUtils::wktReadBlock( wkt );
|
||||||
|
|
||||||
if ( QgsWKBTypes::flatType( parts.first ) != QgsWKBTypes::Polygon )
|
if ( QgsWKBTypes::geometryType( parts.first ) != QgsWKBTypes::PolygonGeometry )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
mWkbType = parts.first;
|
mWkbType = parts.first;
|
||||||
|
@ -37,7 +37,6 @@ class CORE_EXPORT QgsCurvePolygonV2: public QgsSurfaceV2
|
|||||||
~QgsCurvePolygonV2();
|
~QgsCurvePolygonV2();
|
||||||
|
|
||||||
virtual QString geometryType() const override { return "CurvePolygon"; }
|
virtual QString geometryType() const override { return "CurvePolygon"; }
|
||||||
virtual QgsWKBTypes::Type flatWkbType() const override { return QgsWKBTypes::CurvePolygon; }
|
|
||||||
virtual int dimension() const override { return 2; }
|
virtual int dimension() const override { return 2; }
|
||||||
virtual QgsCurvePolygonV2* clone() const override;
|
virtual QgsCurvePolygonV2* clone() const override;
|
||||||
void clear() override;
|
void clear() override;
|
||||||
|
@ -72,7 +72,6 @@ void QgsGeometryCollectionV2::clear()
|
|||||||
{
|
{
|
||||||
qDeleteAll( mGeometries );
|
qDeleteAll( mGeometries );
|
||||||
mGeometries.clear();
|
mGeometries.clear();
|
||||||
mWkbType = QgsWKBTypes::Unknown;
|
|
||||||
clearCache(); //set bounding box invalid
|
clearCache(); //set bounding box invalid
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -491,7 +490,7 @@ bool QgsGeometryCollectionV2::fromCollectionWkt( const QString &wkt, const QList
|
|||||||
|
|
||||||
QPair<QgsWKBTypes::Type, QString> parts = QgsGeometryUtils::wktReadBlock( wkt );
|
QPair<QgsWKBTypes::Type, QString> parts = QgsGeometryUtils::wktReadBlock( wkt );
|
||||||
|
|
||||||
if ( QgsWKBTypes::flatType( parts.first ) != flatWkbType() )
|
if ( QgsWKBTypes::flatType( parts.first ) != QgsWKBTypes::flatType( wkbType() ) )
|
||||||
return false;
|
return false;
|
||||||
mWkbType = parts.first;
|
mWkbType = parts.first;
|
||||||
|
|
||||||
@ -504,7 +503,7 @@ bool QgsGeometryCollectionV2::fromCollectionWkt( const QString &wkt, const QList
|
|||||||
bool success = false;
|
bool success = false;
|
||||||
Q_FOREACH ( const QgsAbstractGeometryV2* geom, subtypes )
|
Q_FOREACH ( const QgsAbstractGeometryV2* geom, subtypes )
|
||||||
{
|
{
|
||||||
if ( QgsWKBTypes::flatType( childParts.first ) == geom->flatWkbType() )
|
if ( QgsWKBTypes::flatType( childParts.first ) == QgsWKBTypes::flatType( geom->wkbType() ) )
|
||||||
{
|
{
|
||||||
mGeometries.append( geom->clone() );
|
mGeometries.append( geom->clone() );
|
||||||
if ( mGeometries.back()->fromWkt( childWkt ) )
|
if ( mGeometries.back()->fromWkt( childWkt ) )
|
||||||
|
@ -53,7 +53,6 @@ class CORE_EXPORT QgsGeometryCollectionV2: public QgsAbstractGeometryV2
|
|||||||
//methods inherited from QgsAbstractGeometry
|
//methods inherited from QgsAbstractGeometry
|
||||||
virtual int dimension() const override;
|
virtual int dimension() const override;
|
||||||
virtual QString geometryType() const override { return "GeometryCollection"; }
|
virtual QString geometryType() const override { return "GeometryCollection"; }
|
||||||
virtual QgsWKBTypes::Type flatWkbType() const override { return QgsWKBTypes::GeometryCollection; }
|
|
||||||
virtual void clear() override;
|
virtual void clear() override;
|
||||||
|
|
||||||
/** Adds a geometry and takes ownership. Returns true in case of success.*/
|
/** Adds a geometry and takes ownership. Returns true in case of success.*/
|
||||||
|
@ -87,7 +87,7 @@ void QgsLineStringV2::clear()
|
|||||||
mY.clear();
|
mY.clear();
|
||||||
mZ.clear();
|
mZ.clear();
|
||||||
mM.clear();
|
mM.clear();
|
||||||
mWkbType = QgsWKBTypes::Unknown;
|
mWkbType = QgsWKBTypes::LineString;
|
||||||
clearCache();
|
clearCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +139,6 @@ class CORE_EXPORT QgsLineStringV2: public QgsCurveV2
|
|||||||
//reimplemented methods
|
//reimplemented methods
|
||||||
|
|
||||||
virtual QString geometryType() const override { return "LineString"; }
|
virtual QString geometryType() const override { return "LineString"; }
|
||||||
virtual QgsWKBTypes::Type flatWkbType() const override { return QgsWKBTypes::LineString; }
|
|
||||||
virtual int dimension() const override { return 1; }
|
virtual int dimension() const override { return 1; }
|
||||||
virtual QgsLineStringV2* clone() const override;
|
virtual QgsLineStringV2* clone() const override;
|
||||||
virtual void clear() override;
|
virtual void clear() override;
|
||||||
|
@ -21,6 +21,12 @@ email : marco.hugentobler at sourcepole dot com
|
|||||||
#include "qgsgeometryutils.h"
|
#include "qgsgeometryutils.h"
|
||||||
#include "qgslinestringv2.h"
|
#include "qgslinestringv2.h"
|
||||||
|
|
||||||
|
QgsMultiCurveV2::QgsMultiCurveV2()
|
||||||
|
: QgsGeometryCollectionV2()
|
||||||
|
{
|
||||||
|
mWkbType = QgsWKBTypes::MultiCurve;
|
||||||
|
}
|
||||||
|
|
||||||
QgsMultiCurveV2 *QgsMultiCurveV2::clone() const
|
QgsMultiCurveV2 *QgsMultiCurveV2::clone() const
|
||||||
{
|
{
|
||||||
return new QgsMultiCurveV2( *this );
|
return new QgsMultiCurveV2( *this );
|
||||||
|
@ -27,8 +27,8 @@ email : marco.hugentobler at sourcepole dot com
|
|||||||
class CORE_EXPORT QgsMultiCurveV2: public QgsGeometryCollectionV2
|
class CORE_EXPORT QgsMultiCurveV2: public QgsGeometryCollectionV2
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
QgsMultiCurveV2();
|
||||||
virtual QString geometryType() const override { return "MultiCurve"; }
|
virtual QString geometryType() const override { return "MultiCurve"; }
|
||||||
virtual QgsWKBTypes::Type flatWkbType() const override { return QgsWKBTypes::MultiCurve; }
|
|
||||||
QgsMultiCurveV2* clone() const override;
|
QgsMultiCurveV2* clone() const override;
|
||||||
|
|
||||||
bool fromWkt( const QString& wkt ) override;
|
bool fromWkt( const QString& wkt ) override;
|
||||||
|
@ -22,6 +22,12 @@ email : marco.hugentobler at sourcepole dot com
|
|||||||
#include "qgslinestringv2.h"
|
#include "qgslinestringv2.h"
|
||||||
#include "qgsmulticurvev2.h"
|
#include "qgsmulticurvev2.h"
|
||||||
|
|
||||||
|
QgsMultiLineStringV2::QgsMultiLineStringV2()
|
||||||
|
: QgsMultiCurveV2()
|
||||||
|
{
|
||||||
|
mWkbType = QgsWKBTypes::MultiLineString;
|
||||||
|
}
|
||||||
|
|
||||||
QgsMultiLineStringV2* QgsMultiLineStringV2::clone() const
|
QgsMultiLineStringV2* QgsMultiLineStringV2::clone() const
|
||||||
{
|
{
|
||||||
return new QgsMultiLineStringV2( *this );
|
return new QgsMultiLineStringV2( *this );
|
||||||
|
@ -27,8 +27,8 @@ email : marco.hugentobler at sourcepole dot com
|
|||||||
class CORE_EXPORT QgsMultiLineStringV2: public QgsMultiCurveV2
|
class CORE_EXPORT QgsMultiLineStringV2: public QgsMultiCurveV2
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
QgsMultiLineStringV2();
|
||||||
virtual QString geometryType() const override { return "MultiLineString"; }
|
virtual QString geometryType() const override { return "MultiLineString"; }
|
||||||
virtual QgsWKBTypes::Type flatWkbType() const override { return QgsWKBTypes::MultiLineString; }
|
|
||||||
QgsMultiLineStringV2* clone() const override;
|
QgsMultiLineStringV2* clone() const override;
|
||||||
|
|
||||||
bool fromWkt( const QString& wkt ) override;
|
bool fromWkt( const QString& wkt ) override;
|
||||||
|
@ -19,6 +19,12 @@ email : marco.hugentobler at sourcepole dot com
|
|||||||
#include "qgspointv2.h"
|
#include "qgspointv2.h"
|
||||||
#include "qgswkbptr.h"
|
#include "qgswkbptr.h"
|
||||||
|
|
||||||
|
QgsMultiPointV2::QgsMultiPointV2()
|
||||||
|
: QgsGeometryCollectionV2()
|
||||||
|
{
|
||||||
|
mWkbType = QgsWKBTypes::MultiPoint;
|
||||||
|
}
|
||||||
|
|
||||||
QgsMultiPointV2 *QgsMultiPointV2::clone() const
|
QgsMultiPointV2 *QgsMultiPointV2::clone() const
|
||||||
{
|
{
|
||||||
return new QgsMultiPointV2( *this );
|
return new QgsMultiPointV2( *this );
|
||||||
|
@ -27,8 +27,8 @@ email : marco.hugentobler at sourcepole dot com
|
|||||||
class CORE_EXPORT QgsMultiPointV2: public QgsGeometryCollectionV2
|
class CORE_EXPORT QgsMultiPointV2: public QgsGeometryCollectionV2
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
QgsMultiPointV2();
|
||||||
virtual QString geometryType() const override { return "MultiPoint"; }
|
virtual QString geometryType() const override { return "MultiPoint"; }
|
||||||
virtual QgsWKBTypes::Type flatWkbType() const override { return QgsWKBTypes::MultiPoint; }
|
|
||||||
QgsMultiPointV2* clone() const override;
|
QgsMultiPointV2* clone() const override;
|
||||||
|
|
||||||
bool fromWkt( const QString& wkt ) override;
|
bool fromWkt( const QString& wkt ) override;
|
||||||
|
@ -21,6 +21,12 @@ email : marco.hugentobler at sourcepole dot com
|
|||||||
#include "qgspolygonv2.h"
|
#include "qgspolygonv2.h"
|
||||||
#include "qgscurvepolygonv2.h"
|
#include "qgscurvepolygonv2.h"
|
||||||
|
|
||||||
|
QgsMultiPolygonV2::QgsMultiPolygonV2()
|
||||||
|
: QgsMultiSurfaceV2()
|
||||||
|
{
|
||||||
|
mWkbType = QgsWKBTypes::MultiPolygon;
|
||||||
|
}
|
||||||
|
|
||||||
QgsMultiPolygonV2 *QgsMultiPolygonV2::clone() const
|
QgsMultiPolygonV2 *QgsMultiPolygonV2::clone() const
|
||||||
{
|
{
|
||||||
return new QgsMultiPolygonV2( *this );
|
return new QgsMultiPolygonV2( *this );
|
||||||
|
@ -27,8 +27,8 @@ email : marco.hugentobler at sourcepole dot com
|
|||||||
class CORE_EXPORT QgsMultiPolygonV2: public QgsMultiSurfaceV2
|
class CORE_EXPORT QgsMultiPolygonV2: public QgsMultiSurfaceV2
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
QgsMultiPolygonV2();
|
||||||
virtual QString geometryType() const override { return "MultiPolygon"; }
|
virtual QString geometryType() const override { return "MultiPolygon"; }
|
||||||
virtual QgsWKBTypes::Type flatWkbType() const override { return QgsWKBTypes::MultiPolygon; }
|
|
||||||
QgsMultiPolygonV2* clone() const override;
|
QgsMultiPolygonV2* clone() const override;
|
||||||
|
|
||||||
bool fromWkt( const QString& wkt ) override;
|
bool fromWkt( const QString& wkt ) override;
|
||||||
|
@ -22,6 +22,12 @@ email : marco.hugentobler at sourcepole dot com
|
|||||||
#include "qgspolygonv2.h"
|
#include "qgspolygonv2.h"
|
||||||
#include "qgscurvepolygonv2.h"
|
#include "qgscurvepolygonv2.h"
|
||||||
|
|
||||||
|
QgsMultiSurfaceV2::QgsMultiSurfaceV2()
|
||||||
|
: QgsGeometryCollectionV2()
|
||||||
|
{
|
||||||
|
mWkbType = QgsWKBTypes::MultiSurface;
|
||||||
|
}
|
||||||
|
|
||||||
QgsMultiSurfaceV2 *QgsMultiSurfaceV2::clone() const
|
QgsMultiSurfaceV2 *QgsMultiSurfaceV2::clone() const
|
||||||
{
|
{
|
||||||
return new QgsMultiSurfaceV2( *this );
|
return new QgsMultiSurfaceV2( *this );
|
||||||
|
@ -27,8 +27,8 @@ email : marco.hugentobler at sourcepole dot com
|
|||||||
class CORE_EXPORT QgsMultiSurfaceV2: public QgsGeometryCollectionV2
|
class CORE_EXPORT QgsMultiSurfaceV2: public QgsGeometryCollectionV2
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
QgsMultiSurfaceV2();
|
||||||
virtual QString geometryType() const override { return "MultiSurface"; }
|
virtual QString geometryType() const override { return "MultiSurface"; }
|
||||||
virtual QgsWKBTypes::Type flatWkbType() const override { return QgsWKBTypes::MultiSurface; }
|
|
||||||
QgsMultiSurfaceV2* clone() const override;
|
QgsMultiSurfaceV2* clone() const override;
|
||||||
|
|
||||||
bool fromWkt( const QString& wkt ) override;
|
bool fromWkt( const QString& wkt ) override;
|
||||||
|
@ -253,7 +253,6 @@ void QgsPointV2::draw( QPainter& p ) const
|
|||||||
|
|
||||||
void QgsPointV2::clear()
|
void QgsPointV2::clear()
|
||||||
{
|
{
|
||||||
mWkbType = QgsWKBTypes::Unknown;
|
|
||||||
mX = mY = mZ = mM = 0.;
|
mX = mY = mZ = mM = 0.;
|
||||||
clearCache();
|
clearCache();
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,6 @@ class CORE_EXPORT QgsPointV2: public QgsAbstractGeometryV2
|
|||||||
//implementation of inherited methods
|
//implementation of inherited methods
|
||||||
virtual QgsRectangle boundingBox() const override { return QgsRectangle( mX, mY, mX, mY ); }
|
virtual QgsRectangle boundingBox() const override { return QgsRectangle( mX, mY, mX, mY ); }
|
||||||
virtual QString geometryType() const override { return "Point"; }
|
virtual QString geometryType() const override { return "Point"; }
|
||||||
virtual QgsWKBTypes::Type flatWkbType() const override { return QgsWKBTypes::Point; }
|
|
||||||
virtual int dimension() const override { return 0; }
|
virtual int dimension() const override { return 0; }
|
||||||
virtual QgsPointV2* clone() const override;
|
virtual QgsPointV2* clone() const override;
|
||||||
void clear() override;
|
void clear() override;
|
||||||
|
@ -70,6 +70,12 @@ QgsPolygonV2* QgsPolygonV2::clone() const
|
|||||||
return new QgsPolygonV2( *this );
|
return new QgsPolygonV2( *this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QgsPolygonV2::clear()
|
||||||
|
{
|
||||||
|
QgsCurvePolygonV2::clear();
|
||||||
|
mWkbType = QgsWKBTypes::Polygon;
|
||||||
|
}
|
||||||
|
|
||||||
bool QgsPolygonV2::fromWkb( QgsConstWkbPtr wkbPtr )
|
bool QgsPolygonV2::fromWkb( QgsConstWkbPtr wkbPtr )
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
|
@ -35,8 +35,8 @@ class CORE_EXPORT QgsPolygonV2: public QgsCurvePolygonV2
|
|||||||
bool operator!=( const QgsPolygonV2& other ) const;
|
bool operator!=( const QgsPolygonV2& other ) const;
|
||||||
|
|
||||||
virtual QString geometryType() const override { return "Polygon"; }
|
virtual QString geometryType() const override { return "Polygon"; }
|
||||||
virtual QgsWKBTypes::Type flatWkbType() const override { return QgsWKBTypes::Polygon; }
|
|
||||||
virtual QgsPolygonV2* clone() const override;
|
virtual QgsPolygonV2* clone() const override;
|
||||||
|
void clear() override;
|
||||||
|
|
||||||
virtual bool fromWkb( QgsConstWkbPtr wkb ) override;
|
virtual bool fromWkb( QgsConstWkbPtr wkb ) override;
|
||||||
|
|
||||||
|
@ -514,7 +514,7 @@ void TestQgsGeometry::pointV2()
|
|||||||
//clear
|
//clear
|
||||||
QgsPointV2 p11( 5.0, 6.0 );
|
QgsPointV2 p11( 5.0, 6.0 );
|
||||||
p11.clear();
|
p11.clear();
|
||||||
QCOMPARE( p11.wkbType(), QgsWKBTypes::Unknown );
|
QCOMPARE( p11.wkbType(), QgsWKBTypes::Point );
|
||||||
QCOMPARE( p11.x(), 0.0 );
|
QCOMPARE( p11.x(), 0.0 );
|
||||||
QCOMPARE( p11.y(), 0.0 );
|
QCOMPARE( p11.y(), 0.0 );
|
||||||
|
|
||||||
@ -538,14 +538,14 @@ void TestQgsGeometry::pointV2()
|
|||||||
//bad WKB - check for no crash
|
//bad WKB - check for no crash
|
||||||
p13 = QgsPointV2( 1, 2 );
|
p13 = QgsPointV2( 1, 2 );
|
||||||
QVERIFY( !p13.fromWkb( QgsConstWkbPtr( nullptr, 0 ) ) );
|
QVERIFY( !p13.fromWkb( QgsConstWkbPtr( nullptr, 0 ) ) );
|
||||||
QCOMPARE( p13.wkbType(), QgsWKBTypes::Unknown );
|
QCOMPARE( p13.wkbType(), QgsWKBTypes::Point );
|
||||||
QgsLineStringV2 line;
|
QgsLineStringV2 line;
|
||||||
p13 = QgsPointV2( 1, 2 );
|
p13 = QgsPointV2( 1, 2 );
|
||||||
wkb = line.asWkb( size );
|
wkb = line.asWkb( size );
|
||||||
QVERIFY( !p13.fromWkb( QgsConstWkbPtr( wkb, size ) ) );
|
QVERIFY( !p13.fromWkb( QgsConstWkbPtr( wkb, size ) ) );
|
||||||
delete[] wkb;
|
delete[] wkb;
|
||||||
wkb = 0;
|
wkb = 0;
|
||||||
QCOMPARE( p13.wkbType(), QgsWKBTypes::Unknown );
|
QCOMPARE( p13.wkbType(), QgsWKBTypes::Point );
|
||||||
|
|
||||||
//to/from WKT
|
//to/from WKT
|
||||||
p13 = QgsPointV2( QgsWKBTypes::PointZM, 1.0, 2.0, 3.0, -4.0 );
|
p13 = QgsPointV2( QgsWKBTypes::PointZM, 1.0, 2.0, 3.0, -4.0 );
|
||||||
@ -557,7 +557,6 @@ void TestQgsGeometry::pointV2()
|
|||||||
|
|
||||||
//bad WKT
|
//bad WKT
|
||||||
QVERIFY( !p14.fromWkt( "Polygon()" ) );
|
QVERIFY( !p14.fromWkt( "Polygon()" ) );
|
||||||
QCOMPARE( p14.wkbType(), QgsWKBTypes::Unknown );
|
|
||||||
|
|
||||||
//asGML2
|
//asGML2
|
||||||
QgsPointV2 exportPoint( 1, 2 );
|
QgsPointV2 exportPoint( 1, 2 );
|
||||||
@ -873,7 +872,7 @@ void TestQgsGeometry::lineStringV2()
|
|||||||
QCOMPARE( l7.partCount(), 0 );
|
QCOMPARE( l7.partCount(), 0 );
|
||||||
QVERIFY( !l7.is3D() );
|
QVERIFY( !l7.is3D() );
|
||||||
QVERIFY( !l7.isMeasure() );
|
QVERIFY( !l7.isMeasure() );
|
||||||
QCOMPARE( l7.wkbType(), QgsWKBTypes::Unknown );
|
QCOMPARE( l7.wkbType(), QgsWKBTypes::LineString );
|
||||||
|
|
||||||
//setPoints
|
//setPoints
|
||||||
QgsLineStringV2 l8;
|
QgsLineStringV2 l8;
|
||||||
@ -897,7 +896,7 @@ void TestQgsGeometry::lineStringV2()
|
|||||||
QCOMPARE( l8.nCoordinates(), 0 );
|
QCOMPARE( l8.nCoordinates(), 0 );
|
||||||
QCOMPARE( l8.ringCount(), 0 );
|
QCOMPARE( l8.ringCount(), 0 );
|
||||||
QCOMPARE( l8.partCount(), 0 );
|
QCOMPARE( l8.partCount(), 0 );
|
||||||
QCOMPARE( l8.wkbType(), QgsWKBTypes::Unknown );
|
QCOMPARE( l8.wkbType(), QgsWKBTypes::LineString );
|
||||||
|
|
||||||
//setPoints with z
|
//setPoints with z
|
||||||
l8.setPoints( QgsPointSequenceV2() << QgsPointV2( QgsWKBTypes::PointZ, 1, 2, 3 ) << QgsPointV2( QgsWKBTypes::PointZ, 2, 3, 4 ) );
|
l8.setPoints( QgsPointSequenceV2() << QgsPointV2( QgsWKBTypes::PointZ, 1, 2, 3 ) << QgsPointV2( QgsWKBTypes::PointZ, 2, 3, 4 ) );
|
||||||
@ -1318,13 +1317,13 @@ void TestQgsGeometry::lineStringV2()
|
|||||||
QCOMPARE( cloned->numPoints(), 0 );
|
QCOMPARE( cloned->numPoints(), 0 );
|
||||||
QVERIFY( !cloned->is3D() );
|
QVERIFY( !cloned->is3D() );
|
||||||
QVERIFY( !cloned->isMeasure() );
|
QVERIFY( !cloned->isMeasure() );
|
||||||
QCOMPARE( cloned->wkbType(), QgsWKBTypes::Unknown );
|
QCOMPARE( cloned->wkbType(), QgsWKBTypes::LineString );
|
||||||
segmentized.reset( static_cast< QgsLineStringV2* >( l14.segmentize() ) );
|
segmentized.reset( static_cast< QgsLineStringV2* >( l14.segmentize() ) );
|
||||||
QVERIFY( segmentized->isEmpty() );
|
QVERIFY( segmentized->isEmpty() );
|
||||||
QCOMPARE( segmentized->numPoints(), 0 );
|
QCOMPARE( segmentized->numPoints(), 0 );
|
||||||
QVERIFY( !segmentized->is3D() );
|
QVERIFY( !segmentized->is3D() );
|
||||||
QVERIFY( !segmentized->isMeasure() );
|
QVERIFY( !segmentized->isMeasure() );
|
||||||
QCOMPARE( segmentized->wkbType(), QgsWKBTypes::Unknown );
|
QCOMPARE( segmentized->wkbType(), QgsWKBTypes::LineString );
|
||||||
|
|
||||||
//to/from WKB
|
//to/from WKB
|
||||||
QgsLineStringV2 l15;
|
QgsLineStringV2 l15;
|
||||||
@ -1355,13 +1354,13 @@ void TestQgsGeometry::lineStringV2()
|
|||||||
//bad WKB - check for no crash
|
//bad WKB - check for no crash
|
||||||
l16.clear();
|
l16.clear();
|
||||||
QVERIFY( !l16.fromWkb( QgsConstWkbPtr( nullptr, 0 ) ) );
|
QVERIFY( !l16.fromWkb( QgsConstWkbPtr( nullptr, 0 ) ) );
|
||||||
QCOMPARE( l16.wkbType(), QgsWKBTypes::Unknown );
|
QCOMPARE( l16.wkbType(), QgsWKBTypes::LineString );
|
||||||
QgsPointV2 point( 1, 2 );
|
QgsPointV2 point( 1, 2 );
|
||||||
wkb = point.asWkb( size ) ;
|
wkb = point.asWkb( size ) ;
|
||||||
QVERIFY( !l16.fromWkb( QgsConstWkbPtr( wkb, size ) ) );
|
QVERIFY( !l16.fromWkb( QgsConstWkbPtr( wkb, size ) ) );
|
||||||
delete[] wkb;
|
delete[] wkb;
|
||||||
wkb = 0;
|
wkb = 0;
|
||||||
QCOMPARE( l16.wkbType(), QgsWKBTypes::Unknown );
|
QCOMPARE( l16.wkbType(), QgsWKBTypes::LineString );
|
||||||
|
|
||||||
//to/from WKT
|
//to/from WKT
|
||||||
QgsLineStringV2 l17;
|
QgsLineStringV2 l17;
|
||||||
@ -1389,7 +1388,7 @@ void TestQgsGeometry::lineStringV2()
|
|||||||
QCOMPARE( l18.numPoints(), 0 );
|
QCOMPARE( l18.numPoints(), 0 );
|
||||||
QVERIFY( !l18.is3D() );
|
QVERIFY( !l18.is3D() );
|
||||||
QVERIFY( !l18.isMeasure() );
|
QVERIFY( !l18.isMeasure() );
|
||||||
QCOMPARE( l18.wkbType(), QgsWKBTypes::Unknown );
|
QCOMPARE( l18.wkbType(), QgsWKBTypes::LineString );
|
||||||
|
|
||||||
//asGML2
|
//asGML2
|
||||||
QgsLineStringV2 exportLine;
|
QgsLineStringV2 exportLine;
|
||||||
@ -2568,7 +2567,7 @@ void TestQgsGeometry::polygonV2()
|
|||||||
QCOMPARE( p9.partCount(), 0 );
|
QCOMPARE( p9.partCount(), 0 );
|
||||||
QVERIFY( !p9.is3D() );
|
QVERIFY( !p9.is3D() );
|
||||||
QVERIFY( !p9.isMeasure() );
|
QVERIFY( !p9.isMeasure() );
|
||||||
QCOMPARE( p9.wkbType(), QgsWKBTypes::Unknown );
|
QCOMPARE( p9.wkbType(), QgsWKBTypes::Polygon );
|
||||||
|
|
||||||
//equality operator
|
//equality operator
|
||||||
QgsPolygonV2 p10;
|
QgsPolygonV2 p10;
|
||||||
@ -2772,13 +2771,13 @@ void TestQgsGeometry::polygonV2()
|
|||||||
//bad WKB - check for no crash
|
//bad WKB - check for no crash
|
||||||
p17.clear();
|
p17.clear();
|
||||||
QVERIFY( !p17.fromWkb( QgsConstWkbPtr( nullptr, 0 ) ) );
|
QVERIFY( !p17.fromWkb( QgsConstWkbPtr( nullptr, 0 ) ) );
|
||||||
QCOMPARE( p17.wkbType(), QgsWKBTypes::Unknown );
|
QCOMPARE( p17.wkbType(), QgsWKBTypes::Polygon );
|
||||||
QgsPointV2 point( 1, 2 );
|
QgsPointV2 point( 1, 2 );
|
||||||
wkb = point.asWkb( size ) ;
|
wkb = point.asWkb( size ) ;
|
||||||
QVERIFY( !p17.fromWkb( QgsConstWkbPtr( wkb, size ) ) );
|
QVERIFY( !p17.fromWkb( QgsConstWkbPtr( wkb, size ) ) );
|
||||||
delete[] wkb;
|
delete[] wkb;
|
||||||
wkb = 0;
|
wkb = 0;
|
||||||
QCOMPARE( p17.wkbType(), QgsWKBTypes::Unknown );
|
QCOMPARE( p17.wkbType(), QgsWKBTypes::Polygon );
|
||||||
|
|
||||||
//to/from WKT
|
//to/from WKT
|
||||||
QgsPolygonV2 p18;
|
QgsPolygonV2 p18;
|
||||||
@ -2806,7 +2805,7 @@ void TestQgsGeometry::polygonV2()
|
|||||||
QCOMPARE( p19.numInteriorRings(), 0 );
|
QCOMPARE( p19.numInteriorRings(), 0 );
|
||||||
QVERIFY( !p19.is3D() );
|
QVERIFY( !p19.is3D() );
|
||||||
QVERIFY( !p19.isMeasure() );
|
QVERIFY( !p19.isMeasure() );
|
||||||
QCOMPARE( p19.wkbType(), QgsWKBTypes::Unknown );
|
QCOMPARE( p19.wkbType(), QgsWKBTypes::Polygon );
|
||||||
|
|
||||||
//as JSON
|
//as JSON
|
||||||
QgsPolygonV2 exportPolygon;
|
QgsPolygonV2 exportPolygon;
|
||||||
|
@ -21,6 +21,17 @@ from qgis.core import (
|
|||||||
QgsFeature,
|
QgsFeature,
|
||||||
QgsPoint,
|
QgsPoint,
|
||||||
QgsPointV2,
|
QgsPointV2,
|
||||||
|
QgsCircularStringV2,
|
||||||
|
QgsCompoundCurveV2,
|
||||||
|
QgsCurvePolygonV2,
|
||||||
|
QgsGeometryCollectionV2,
|
||||||
|
QgsLineStringV2,
|
||||||
|
QgsMultiCurveV2,
|
||||||
|
QgsMultiLineStringV2,
|
||||||
|
QgsMultiPointV2,
|
||||||
|
QgsMultiPolygonV2,
|
||||||
|
QgsMultiSurfaceV2,
|
||||||
|
QgsPolygonV2,
|
||||||
QgsCoordinateTransform,
|
QgsCoordinateTransform,
|
||||||
QgsRectangle,
|
QgsRectangle,
|
||||||
QgsWKBTypes,
|
QgsWKBTypes,
|
||||||
@ -1853,6 +1864,34 @@ class TestQgsGeometry(unittest.TestCase):
|
|||||||
self.assertEqual(g.distanceToVertex(4), 4)
|
self.assertEqual(g.distanceToVertex(4), 4)
|
||||||
self.assertEqual(g.distanceToVertex(5), -1)
|
self.assertEqual(g.distanceToVertex(5), -1)
|
||||||
|
|
||||||
|
def testTypeInformation(self):
|
||||||
|
""" Test type information """
|
||||||
|
types = [
|
||||||
|
(QgsCircularStringV2, "CircularString", QgsWKBTypes.CircularString),
|
||||||
|
(QgsCompoundCurveV2, "CompoundCurve", QgsWKBTypes.CompoundCurve),
|
||||||
|
(QgsCurvePolygonV2, "CurvePolygon", QgsWKBTypes.CurvePolygon),
|
||||||
|
(QgsGeometryCollectionV2, "GeometryCollection", QgsWKBTypes.GeometryCollection),
|
||||||
|
(QgsLineStringV2, "LineString", QgsWKBTypes.LineString),
|
||||||
|
(QgsMultiCurveV2, "MultiCurve", QgsWKBTypes.MultiCurve),
|
||||||
|
(QgsMultiLineStringV2, "MultiLineString", QgsWKBTypes.MultiLineString),
|
||||||
|
(QgsMultiPointV2, "MultiPoint", QgsWKBTypes.MultiPoint),
|
||||||
|
(QgsMultiPolygonV2, "MultiPolygon", QgsWKBTypes.MultiPolygon),
|
||||||
|
(QgsMultiSurfaceV2, "MultiSurface", QgsWKBTypes.MultiSurface),
|
||||||
|
(QgsPointV2, "Point", QgsWKBTypes.Point),
|
||||||
|
(QgsPolygonV2, "Polygon", QgsWKBTypes.Polygon),
|
||||||
|
]
|
||||||
|
|
||||||
|
for geomtype in types:
|
||||||
|
geom = geomtype[0]()
|
||||||
|
self.assertEqual(geom.geometryType(), geomtype[1])
|
||||||
|
self.assertEqual(geom.wkbType(), geomtype[2])
|
||||||
|
geom.clear()
|
||||||
|
self.assertEqual(geom.geometryType(), geomtype[1])
|
||||||
|
self.assertEqual(geom.wkbType(), geomtype[2])
|
||||||
|
clone = geom.clone()
|
||||||
|
self.assertEqual(clone.geometryType(), geomtype[1])
|
||||||
|
self.assertEqual(clone.wkbType(), geomtype[2])
|
||||||
|
|
||||||
def testRelates(self):
|
def testRelates(self):
|
||||||
""" Test relationships between geometries. Note the bulk of these tests were taken from the PostGIS relate testdata """
|
""" Test relationships between geometries. Note the bulk of these tests were taken from the PostGIS relate testdata """
|
||||||
with open(os.path.join(TEST_DATA_DIR, 'relates_data.csv'), 'r') as d:
|
with open(os.path.join(TEST_DATA_DIR, 'relates_data.csv'), 'r') as d:
|
||||||
|
@ -104,7 +104,7 @@ class TestQgsSymbolV2(unittest.TestCase):
|
|||||||
|
|
||||||
for test in tests:
|
for test in tests:
|
||||||
geom = QgsGeometry.fromWkt(test['wkt'])
|
geom = QgsGeometry.fromWkt(test['wkt'])
|
||||||
assert geom and not geom.isEmpty(), 'Could not create geometry'
|
assert geom and not geom.isEmpty(), 'Could not create geometry {}'.format(test['wkt'])
|
||||||
rendered_image = self.renderGeometry(geom)
|
rendered_image = self.renderGeometry(geom)
|
||||||
assert self.imageCheck(test['name'], test['reference_image'], rendered_image)
|
assert self.imageCheck(test['name'], test['reference_image'], rendered_image)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user