Skip to content

Commit

Permalink
Rename QgsMultiPolygonV2 to QgsMultiPolygon
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Oct 30, 2017
1 parent 3fcdcd8 commit 7f3ad76
Show file tree
Hide file tree
Showing 23 changed files with 88 additions and 88 deletions.
6 changes: 3 additions & 3 deletions python/core/geometry/qgsabstractgeometry.sip
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class QgsAbstractGeometry
sipType = sipType_QgsMultiPoint;
else if ( qgsgeometry_cast<QgsMultiLineString *>( sipCpp ) != nullptr )
sipType = sipType_QgsMultiLineString;
else if ( qgsgeometry_cast<QgsMultiPolygonV2 *>( sipCpp ) != nullptr )
sipType = sipType_QgsMultiPolygonV2;
else if ( qgsgeometry_cast<QgsMultiPolygon *>( sipCpp ) != nullptr )
sipType = sipType_QgsMultiPolygon;
else if ( qgsgeometry_cast<QgsMultiSurface *>( sipCpp ) != nullptr )
sipType = sipType_QgsMultiSurface;
else if ( qgsgeometry_cast<QgsMultiCurve *>( sipCpp ) != nullptr )
Expand Down Expand Up @@ -397,7 +397,7 @@ Returns the centroid of the geometry
%Docstring
Returns the geometry converted to the more generic curve type.
E.g. QgsLineString -> QgsCompoundCurve, QgsPolygon -> QgsCurvePolygon,
QgsMultiLineString -> QgsMultiCurve, QgsMultiPolygonV2 -> QgsMultiSurface
QgsMultiLineString -> QgsMultiCurve, QgsMultiPolygon -> QgsMultiSurface
:return: the converted geometry. Caller takes ownership
:rtype: QgsAbstractGeometry
%End
Expand Down
6 changes: 3 additions & 3 deletions python/core/geometry/qgsmultipolygon.sip
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ class QgsMultiPolygonV2: QgsMultiSurface
#include "qgsmultipolygon.h"
%End
public:
QgsMultiPolygonV2();
QgsMultiPolygon();
virtual QString geometryType() const;

virtual void clear();

virtual QgsMultiPolygonV2 *clone() const /Factory/;
virtual QgsMultiPolygon *clone() const /Factory/;

virtual bool fromWkt( const QString &wkt );

Expand All @@ -51,7 +51,7 @@ class QgsMultiPolygonV2: QgsMultiSurface


protected:
virtual QgsMultiPolygonV2 *createEmptyWithSameType() const /Factory/;
virtual QgsMultiPolygon *createEmptyWithSameType() const /Factory/;

virtual bool wktOmitChildType() const;

Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/qgis/LinesToPolygons.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def convertToPolygons(self, geometry):
output_wkb = self.convertWkbToPolygons(geometry.wkbType())
out_geom = None
if QgsWkbTypes.flatType(output_wkb) == QgsWkbTypes.MultiPolygon:
out_geom = QgsMultiPolygonV2()
out_geom = QgsMultiPolygon()
else:
out_geom = QgsMultiSurface()

Expand Down
2 changes: 1 addition & 1 deletion src/3d/symbols/qgsline3dsymbol_p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Qt3DRender::QGeometryRenderer *QgsLine3DSymbolEntityNode::renderer( const Qgs3DM
}
else if ( QgsWkbTypes::flatType( buffered->wkbType() ) == QgsWkbTypes::MultiPolygon )
{
QgsMultiPolygonV2 *mpolyBuffered = static_cast<QgsMultiPolygonV2 *>( buffered );
QgsMultiPolygon *mpolyBuffered = static_cast<QgsMultiPolygon *>( buffered );
for ( int i = 0; i < mpolyBuffered->numGeometries(); ++i )
{
QgsAbstractGeometry *partBuffered = mpolyBuffered->geometryN( i );
Expand Down
2 changes: 1 addition & 1 deletion src/3d/symbols/qgspolygon3dsymbol_p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ Qt3DRender::QGeometryRenderer *QgsPolygon3DSymbolEntityNode::renderer( const Qgs
if ( hasDDExtrusion )
extrusionHeightPerPolygon.append( extrusionHeight );
}
else if ( const QgsMultiPolygonV2 *mpoly = qgsgeometry_cast< const QgsMultiPolygonV2 *>( g ) )
else if ( const QgsMultiPolygon *mpoly = qgsgeometry_cast< const QgsMultiPolygon *>( g ) )
{
for ( int i = 0; i < mpoly->numGeometries(); ++i )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ void QgsGeometrySelfIntersectionCheck::fixError( QgsGeometryCheckError *error, i
// Otherwise, create multipolygon
else
{
QgsMultiPolygonV2 *multiPoly = new QgsMultiPolygonV2();
QgsMultiPolygon *multiPoly = new QgsMultiPolygon();
multiPoly->addGeometry( poly->clone() );
multiPoly->addGeometry( poly2 );
feature.setGeometry( QgsGeometry( multiPoly ) );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void QgsGeometryTypeCheck::fixError( QgsGeometryCheckError *error, int method, c
}
case QgsWkbTypes::MultiPolygon:
{
geomCollection = new QgsMultiPolygonV2();
geomCollection = new QgsMultiPolygon();
break;
}
case QgsWkbTypes::MultiCurve:
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsmaptoolcircle2tangentspoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ void QgsMapToolCircle2TangentsPoint::radiusSpinBoxChanged( int radius )
mRubberBands.clear();
if ( mPoints.size() == 4 )
{
std::unique_ptr<QgsMultiPolygonV2> rb( new QgsMultiPolygonV2() );
std::unique_ptr<QgsMultiPolygonV2> rb( new QgsMultiPolygon() );
for ( int i = 0; i < mCenters.size(); ++i )
{
std::unique_ptr<QgsGeometryRubberBand> tempRB( createGeometryRubberBand( QgsWkbTypes::PointGeometry, true ) );
Expand Down
6 changes: 3 additions & 3 deletions src/core/geometry/qgsabstractgeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ class CORE_EXPORT QgsAbstractGeometry
sipType = sipType_QgsMultiPoint;
else if ( qgsgeometry_cast<QgsMultiLineString *>( sipCpp ) != nullptr )
sipType = sipType_QgsMultiLineString;
else if ( qgsgeometry_cast<QgsMultiPolygonV2 *>( sipCpp ) != nullptr )
sipType = sipType_QgsMultiPolygonV2;
else if ( qgsgeometry_cast<QgsMultiPolygon *>( sipCpp ) != nullptr )
sipType = sipType_QgsMultiPolygon;
else if ( qgsgeometry_cast<QgsMultiSurface *>( sipCpp ) != nullptr )
sipType = sipType_QgsMultiSurface;
else if ( qgsgeometry_cast<QgsMultiCurve *>( sipCpp ) != nullptr )
Expand Down Expand Up @@ -406,7 +406,7 @@ class CORE_EXPORT QgsAbstractGeometry
/**
* Returns the geometry converted to the more generic curve type.
* E.g. QgsLineString -> QgsCompoundCurve, QgsPolygon -> QgsCurvePolygon,
* QgsMultiLineString -> QgsMultiCurve, QgsMultiPolygonV2 -> QgsMultiSurface
* QgsMultiLineString -> QgsMultiCurve, QgsMultiPolygon -> QgsMultiSurface
* \returns the converted geometry. Caller takes ownership
*/
virtual QgsAbstractGeometry *toCurveType() const = 0 SIP_FACTORY;
Expand Down
8 changes: 4 additions & 4 deletions src/core/geometry/qgsgeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ QgsGeometry QgsGeometry::fromMultiPolyline( const QgsMultiPolylineXY &multiline

QgsGeometry QgsGeometry::fromMultiPolygon( const QgsMultiPolygonXY &multipoly )
{
std::unique_ptr< QgsMultiPolygonV2 > geom = QgsGeometryFactory::fromMultiPolygon( multipoly );
std::unique_ptr< QgsMultiPolygon > geom = QgsGeometryFactory::fromMultiPolygon( multipoly );
if ( geom )
{
return QgsGeometry( std::move( geom ) );
Expand Down Expand Up @@ -670,7 +670,7 @@ QgsGeometry::OperationResult QgsGeometry::addPart( QgsAbstractGeometry *part, Qg
reset( qgis::make_unique< QgsMultiLineString >() );
break;
case QgsWkbTypes::PolygonGeometry:
reset( qgis::make_unique< QgsMultiPolygonV2 >() );
reset( qgis::make_unique< QgsMultiPolygon >() );
break;
default:
reset( nullptr );
Expand Down Expand Up @@ -2656,9 +2656,9 @@ QgsGeometry QgsGeometry::smooth( const unsigned int iterations, const double off

case QgsWkbTypes::MultiPolygon:
{
QgsMultiPolygonV2 *multiPoly = static_cast< QgsMultiPolygonV2 * >( d->geometry.get() );
QgsMultiPolygon *multiPoly = static_cast< QgsMultiPolygon * >( d->geometry.get() );

std::unique_ptr< QgsMultiPolygonV2 > resultMultiPoly = qgis::make_unique< QgsMultiPolygonV2 >();
std::unique_ptr< QgsMultiPolygon > resultMultiPoly = qgis::make_unique< QgsMultiPolygon >();
for ( int i = 0; i < multiPoly->numGeometries(); ++i )
{
resultMultiPoly->addGeometry( smoothPolygon( *( static_cast< QgsPolygon * >( multiPoly->geometryN( i ) ) ), iterations, offset, minimumDistance, maxAngle ).release() );
Expand Down
2 changes: 1 addition & 1 deletion src/core/geometry/qgsgeometrycollection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ bool QgsGeometryCollection::fromWkt( const QString &wkt )
<< new QgsCircularString << new QgsCompoundCurve
<< new QgsCurvePolygon
<< new QgsMultiPoint << new QgsMultiLineString
<< new QgsMultiPolygonV2 << new QgsGeometryCollection
<< new QgsMultiPolygon << new QgsGeometryCollection
<< new QgsMultiCurve << new QgsMultiSurface, QStringLiteral( "GeometryCollection" ) );
}

Expand Down
10 changes: 5 additions & 5 deletions src/core/geometry/qgsgeometryfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ std::unique_ptr<QgsAbstractGeometry> QgsGeometryFactory::geomFromWkt( const QStr
}
else if ( trimmed.startsWith( QLatin1String( "MultiPolygon" ), Qt::CaseInsensitive ) )
{
geom = qgis::make_unique< QgsMultiPolygonV2 >();
geom = qgis::make_unique< QgsMultiPolygon >();
}
else if ( trimmed.startsWith( QLatin1String( "GeometryCollection" ), Qt::CaseInsensitive ) )
{
Expand Down Expand Up @@ -187,9 +187,9 @@ std::unique_ptr<QgsPolygonV2> QgsGeometryFactory::fromPolygon( const QgsPolygonX
return poly;
}

std::unique_ptr< QgsMultiPolygonV2 > QgsGeometryFactory::fromMultiPolygon( const QgsMultiPolygonXY &multipoly )
std::unique_ptr< QgsMultiPolygon > QgsGeometryFactory::fromMultiPolygon( const QgsMultiPolygonXY &multipoly )
{
std::unique_ptr< QgsMultiPolygonV2 > mp = qgis::make_unique< QgsMultiPolygonV2 >();
std::unique_ptr< QgsMultiPolygon > mp = qgis::make_unique< QgsMultiPolygon >();
for ( int i = 0; i < multipoly.size(); ++i )
{
mp->addGeometry( fromPolygon( multipoly.at( i ) ).release() );
Expand Down Expand Up @@ -233,7 +233,7 @@ std::unique_ptr<QgsAbstractGeometry> QgsGeometryFactory::geomFromWkbType( QgsWkb
case QgsWkbTypes::MultiLineString:
return qgis::make_unique< QgsMultiLineString >();
case QgsWkbTypes::MultiPolygon:
return qgis::make_unique< QgsMultiPolygonV2 >();
return qgis::make_unique< QgsMultiPolygon >();
case QgsWkbTypes::MultiPoint:
return qgis::make_unique< QgsMultiPoint >();
case QgsWkbTypes::MultiCurve:
Expand Down Expand Up @@ -265,7 +265,7 @@ std::unique_ptr<QgsGeometryCollection> QgsGeometryFactory::createCollectionOfTyp
collect = qgis::make_unique< QgsMultiCurve >();
break;
case QgsWkbTypes::MultiPolygon:
collect = qgis::make_unique< QgsMultiPolygonV2 >();
collect = qgis::make_unique< QgsMultiPolygon >();
break;
case QgsWkbTypes::MultiSurface:
collect = qgis::make_unique< QgsMultiSurface >();
Expand Down
4 changes: 2 additions & 2 deletions src/core/geometry/qgsgeometryfactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class QgsGeometryCollection;
class QgsMultiPoint;
class QgsMultiLineString;
class QgsPolygon;
class QgsMultiPolygonV2;
class QgsMultiPolygon;

//compatibility with old classes
#include "qgspointxy.h"
Expand Down Expand Up @@ -81,7 +81,7 @@ class CORE_EXPORT QgsGeometryFactory

/**
* Returns a new geometry collection matching a specified WKB \a type. For instance, if
* type is PolygonM the returned geometry will be a QgsMultiPolygonV2 with M values.
* type is PolygonM the returned geometry will be a QgsMultiPolygon with M values.
*/
static std::unique_ptr< QgsGeometryCollection > createCollectionOfType( QgsWkbTypes::Type type );

Expand Down
2 changes: 1 addition & 1 deletion src/core/geometry/qgsgeometrymakevalid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,7 @@ std::unique_ptr< QgsAbstractGeometry > _qgis_lwgeom_make_valid( const QgsAbstrac
collection = new QgsMultiLineString();
break;
case QgsWkbTypes::MultiPolygon:
collection = new QgsMultiPolygonV2();
collection = new QgsMultiPolygon();
break;
default:
collection = new QgsGeometryCollection();
Expand Down
2 changes: 1 addition & 1 deletion src/core/geometry/qgsgeos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,7 @@ std::unique_ptr<QgsAbstractGeometry> QgsGeos::fromGeos( const GEOSGeometry *geos
}
case GEOS_MULTIPOLYGON:
{
std::unique_ptr< QgsMultiPolygonV2 > multiPolygon( new QgsMultiPolygonV2() );
std::unique_ptr< QgsMultiPolygon > multiPolygon( new QgsMultiPolygon() );

int nParts = GEOSGetNumGeometries_r( geosinit.ctxt, geos );
for ( int i = 0; i < nParts; ++i )
Expand Down
2 changes: 1 addition & 1 deletion src/core/geometry/qgsinternalgeometryengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ QgsGeometry QgsInternalGeometryEngine::extrude( double x, double y ) const
linesToProcess << static_cast<QgsLineString *>( curve->segmentize() );
}

std::unique_ptr<QgsMultiPolygonV2> multipolygon( linesToProcess.size() > 1 ? new QgsMultiPolygonV2() : nullptr );
std::unique_ptr<QgsMultiPolygonV2> multipolygon( linesToProcess.size() > 1 ? new QgsMultiPolygon() : nullptr );
QgsPolygon *polygon = nullptr;

if ( !linesToProcess.empty() )
Expand Down
30 changes: 15 additions & 15 deletions src/core/geometry/qgsmultipolygon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,40 +22,40 @@ email : marco.hugentobler at sourcepole dot com
#include "qgscurvepolygon.h"
#include "qgsmultilinestring.h"

QgsMultiPolygonV2::QgsMultiPolygonV2()
QgsMultiPolygon::QgsMultiPolygon()
{
mWkbType = QgsWkbTypes::MultiPolygon;
}

QString QgsMultiPolygonV2::geometryType() const
QString QgsMultiPolygon::geometryType() const
{
return QStringLiteral( "MultiPolygon" );
}

void QgsMultiPolygonV2::clear()
void QgsMultiPolygon::clear()
{
QgsMultiSurface::clear();
mWkbType = QgsWkbTypes::MultiPolygon;
}

QgsMultiPolygonV2 *QgsMultiPolygonV2::createEmptyWithSameType() const
QgsMultiPolygon *QgsMultiPolygon::createEmptyWithSameType() const
{
auto result = qgis::make_unique< QgsMultiPolygonV2 >();
auto result = qgis::make_unique< QgsMultiPolygon >();
result->mWkbType = mWkbType;
return result.release();
}

QgsMultiPolygonV2 *QgsMultiPolygonV2::clone() const
QgsMultiPolygon *QgsMultiPolygon::clone() const
{
return new QgsMultiPolygonV2( *this );
}

bool QgsMultiPolygonV2::fromWkt( const QString &wkt )
bool QgsMultiPolygon::fromWkt( const QString &wkt )
{
return fromCollectionWkt( wkt, QList<QgsAbstractGeometry *>() << new QgsPolygonV2, QStringLiteral( "Polygon" ) );
}

QDomElement QgsMultiPolygonV2::asGML2( QDomDocument &doc, int precision, const QString &ns ) const
QDomElement QgsMultiPolygon::asGML2( QDomDocument &doc, int precision, const QString &ns ) const
{
// GML2 does not support curves
QDomElement elemMultiPolygon = doc.createElementNS( ns, QStringLiteral( "MultiPolygon" ) );
Expand All @@ -76,7 +76,7 @@ QDomElement QgsMultiPolygonV2::asGML2( QDomDocument &doc, int precision, const Q
return elemMultiPolygon;
}

QDomElement QgsMultiPolygonV2::asGML3( QDomDocument &doc, int precision, const QString &ns ) const
QDomElement QgsMultiPolygon::asGML3( QDomDocument &doc, int precision, const QString &ns ) const
{
QDomElement elemMultiSurface = doc.createElementNS( ns, QStringLiteral( "MultiPolygon" ) );

Expand All @@ -96,7 +96,7 @@ QDomElement QgsMultiPolygonV2::asGML3( QDomDocument &doc, int precision, const Q
return elemMultiSurface;
}

QString QgsMultiPolygonV2::asJSON( int precision ) const
QString QgsMultiPolygon::asJSON( int precision ) const
{
// GeoJSON does not support curves
QString json = QStringLiteral( "{\"type\": \"MultiPolygon\", \"coordinates\": [" );
Expand Down Expand Up @@ -137,7 +137,7 @@ QString QgsMultiPolygonV2::asJSON( int precision ) const
return json;
}

bool QgsMultiPolygonV2::addGeometry( QgsAbstractGeometry *g )
bool QgsMultiPolygon::addGeometry( QgsAbstractGeometry *g )
{
if ( !qgsgeometry_cast<QgsPolygon *>( g ) )
{
Expand All @@ -161,7 +161,7 @@ bool QgsMultiPolygonV2::addGeometry( QgsAbstractGeometry *g )
return QgsGeometryCollection::addGeometry( g );
}

bool QgsMultiPolygonV2::insertGeometry( QgsAbstractGeometry *g, int index )
bool QgsMultiPolygon::insertGeometry( QgsAbstractGeometry *g, int index )
{
if ( !g || !qgsgeometry_cast< QgsPolygon * >( g ) )
{
Expand All @@ -172,7 +172,7 @@ bool QgsMultiPolygonV2::insertGeometry( QgsAbstractGeometry *g, int index )
return QgsMultiSurface::insertGeometry( g, index );
}

QgsMultiSurface *QgsMultiPolygonV2::toCurveType() const
QgsMultiSurface *QgsMultiPolygon::toCurveType() const
{
QgsMultiSurface *multiSurface = new QgsMultiSurface();
for ( int i = 0; i < mGeometries.size(); ++i )
Expand All @@ -182,7 +182,7 @@ QgsMultiSurface *QgsMultiPolygonV2::toCurveType() const
return multiSurface;
}

QgsAbstractGeometry *QgsMultiPolygonV2::boundary() const
QgsAbstractGeometry *QgsMultiPolygon::boundary() const
{
std::unique_ptr< QgsMultiLineString > multiLine( new QgsMultiLineString() );
for ( int i = 0; i < mGeometries.size(); ++i )
Expand Down Expand Up @@ -216,7 +216,7 @@ QgsAbstractGeometry *QgsMultiPolygonV2::boundary() const
return multiLine.release();
}

bool QgsMultiPolygonV2::wktOmitChildType() const
bool QgsMultiPolygon::wktOmitChildType() const
{
return true;
}
12 changes: 6 additions & 6 deletions src/core/geometry/qgsmultipolygon.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ email : marco.hugentobler at sourcepole dot com
class CORE_EXPORT QgsMultiPolygonV2: public QgsMultiSurface
{
public:
QgsMultiPolygonV2();
QgsMultiPolygon();
QString geometryType() const override;
void clear() override;
QgsMultiPolygonV2 *clone() const override SIP_FACTORY;
QgsMultiPolygon *clone() const override SIP_FACTORY;
bool fromWkt( const QString &wkt ) override;
QDomElement asGML2( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const override;
QDomElement asGML3( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const override;
Expand All @@ -50,21 +50,21 @@ class CORE_EXPORT QgsMultiPolygonV2: public QgsMultiSurface

/**
* Cast the \a geom to a QgsMultiPolygonV2.
* Should be used by qgsgeometry_cast<QgsMultiPolygonV2 *>( geometry ).
* Should be used by qgsgeometry_cast<QgsMultiPolygon *>( geometry ).
*
* \note Not available in Python. Objects will be automatically be converted to the appropriate target type.
* \since QGIS 3.0
*/
inline const QgsMultiPolygonV2 *cast( const QgsAbstractGeometry *geom ) const
inline const QgsMultiPolygon *cast( const QgsAbstractGeometry *geom ) const
{
if ( geom && QgsWkbTypes::flatType( geom->wkbType() ) == QgsWkbTypes::MultiPolygon )
return static_cast<const QgsMultiPolygonV2 *>( geom );
return static_cast<const QgsMultiPolygon *>( geom );
return nullptr;
}
#endif

protected:
QgsMultiPolygonV2 *createEmptyWithSameType() const override SIP_FACTORY;
QgsMultiPolygon *createEmptyWithSameType() const override SIP_FACTORY;
bool wktOmitChildType() const override;
};

Expand Down
Loading

0 comments on commit 7f3ad76

Please sign in to comment.