Skip to content
Permalink
Browse files

Rename QgsMultiPointV2 to QgsMultiPoint

  • Loading branch information
m-kuhn committed Oct 29, 2017
1 parent b6f46ea commit 3fcdcd87afd27cc46e42801cd6265b90932efdc1
@@ -39,8 +39,8 @@ class QgsAbstractGeometry
sipType = sipType_QgsPolygon;
else if ( qgsgeometry_cast<QgsCurvePolygon *>( sipCpp ) != nullptr )
sipType = sipType_QgsCurvePolygon;
else if ( qgsgeometry_cast<QgsMultiPointV2 *>( sipCpp ) != nullptr )
sipType = sipType_QgsMultiPointV2;
else if ( qgsgeometry_cast<QgsMultiPoint *>( sipCpp ) != nullptr )
sipType = sipType_QgsMultiPoint;
else if ( qgsgeometry_cast<QgsMultiLineString *>( sipCpp ) != nullptr )
sipType = sipType_QgsMultiLineString;
else if ( qgsgeometry_cast<QgsMultiPolygonV2 *>( sipCpp ) != nullptr )
@@ -19,13 +19,13 @@ class QgsMultiPointV2: QgsGeometryCollection
#include "qgsmultipoint.h"
%End
public:
QgsMultiPointV2();
QgsMultiPoint();

virtual QString geometryType() const;

virtual QgsMultiPointV2 *clone() const /Factory/;
virtual QgsMultiPoint *clone() const /Factory/;

virtual QgsMultiPointV2 *toCurveType() const /Factory/;
virtual QgsMultiPoint *toCurveType() const /Factory/;

virtual bool fromWkt( const QString &wkt );

@@ -50,7 +50,7 @@ class QgsMultiPointV2: QgsGeometryCollection


protected:
virtual QgsMultiPointV2 *createEmptyWithSameType() const /Factory/;
virtual QgsMultiPoint *createEmptyWithSameType() const /Factory/;

virtual bool wktOmitChildType() const;

@@ -148,7 +148,7 @@ def convertToCentroid(self, geom):
return [geom.centroid()]

def convertToNodes(self, geom):
mp = QgsMultiPointV2()
mp = QgsMultiPoint()
# TODO: mega inefficient - needs rework when geometry iterators land
# (but at least it doesn't lose Z/M values)
for g in geom.constGet().coordinateSequence():
@@ -228,7 +228,7 @@ def createFeature(self, feedback, feature_id, type, geometries, class_field=None
if class_field is not None:
attrs.append(class_field)

multi_point = QgsMultiPointV2()
multi_point = QgsMultiPoint()

for g in geometries:
if feedback.isCanceled():
@@ -90,7 +90,7 @@ void QgsGeometryTypeCheck::fixError( QgsGeometryCheckError *error, int method, c
{
case QgsWkbTypes::MultiPoint:
{
geomCollection = new QgsMultiPointV2();
geomCollection = new QgsMultiPoint();
break;
}
case QgsWkbTypes::MultiLineString:
@@ -124,7 +124,7 @@ static bool isCircularVertex( const QgsGeometry &geom, int vertexIndex )
//! Create a multi-point geometry that can be used to highlight vertices of a feature
static QgsGeometry geometryToMultiPoint( const QgsGeometry &geom )
{
QgsMultiPointV2 *multiPoint = new QgsMultiPointV2();
QgsMultiPoint *multiPoint = new QgsMultiPoint();
QgsGeometry outputGeom( multiPoint );
const QgsAbstractGeometry *g = geom.constGet();
for ( int i = 0; i < g->partCount(); ++i )
@@ -164,7 +164,7 @@ void QgsMapToolAddFeature::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
}
else if ( layerWKBType == QgsWkbTypes::MultiPoint25D )
{
QgsMultiPointV2 *mp = new QgsMultiPointV2();
QgsMultiPoint *mp = new QgsMultiPoint();
mp->addGeometry( new QgsPoint( QgsWkbTypes::PointZ, savePoint.x(), savePoint.y(), defaultZValue() ) );
g = QgsGeometry( mp );
}
@@ -1725,7 +1725,7 @@ static QVariant fcnNodesToPoints( const QVariantList &values, const QgsExpressio
ignoreClosing = QgsExpressionUtils::getIntValue( values.at( 1 ), parent );
}

QgsMultiPointV2 *mp = new QgsMultiPointV2();
QgsMultiPoint *mp = new QgsMultiPoint();

const QgsCoordinateSequence sequence = geom.constGet()->coordinateSequence();
for ( const QgsRingSequence &part : sequence )
@@ -27,7 +27,7 @@ email : marco.hugentobler at sourcepole dot com
class QgsMapToPixel;
class QgsCurve;
class QgsMultiCurve;
class QgsMultiPointV2;
class QgsMultiPoint;
class QgsPoint;
struct QgsVertexId;
class QgsVertexIterator;
@@ -69,8 +69,8 @@ class CORE_EXPORT QgsAbstractGeometry
sipType = sipType_QgsPolygon;
else if ( qgsgeometry_cast<QgsCurvePolygon *>( sipCpp ) != nullptr )
sipType = sipType_QgsCurvePolygon;
else if ( qgsgeometry_cast<QgsMultiPointV2 *>( sipCpp ) != nullptr )
sipType = sipType_QgsMultiPointV2;
else if ( qgsgeometry_cast<QgsMultiPoint *>( sipCpp ) != nullptr )
sipType = sipType_QgsMultiPoint;
else if ( qgsgeometry_cast<QgsMultiLineString *>( sipCpp ) != nullptr )
sipType = sipType_QgsMultiLineString;
else if ( qgsgeometry_cast<QgsMultiPolygonV2 *>( sipCpp ) != nullptr )
@@ -125,7 +125,7 @@ QgsAbstractGeometry *QgsCurve::boundary() const
if ( isClosed() )
return nullptr;

QgsMultiPointV2 *multiPoint = new QgsMultiPointV2();
QgsMultiPoint *multiPoint = new QgsMultiPoint();
multiPoint->addGeometry( new QgsPoint( startPoint() ) );
multiPoint->addGeometry( new QgsPoint( endPoint() ) );
return multiPoint;
@@ -193,7 +193,7 @@ QgsGeometry QgsGeometry::fromPolygon( const QgsPolygonXY &polygon )

QgsGeometry QgsGeometry::fromMultiPoint( const QgsMultiPointXY &multipoint )
{
std::unique_ptr< QgsMultiPointV2 > geom = QgsGeometryFactory::fromMultiPoint( multipoint );
std::unique_ptr< QgsMultiPoint > geom = QgsGeometryFactory::fromMultiPoint( multipoint );
if ( geom )
{
return QgsGeometry( std::move( geom ) );
@@ -664,7 +664,7 @@ QgsGeometry::OperationResult QgsGeometry::addPart( QgsAbstractGeometry *part, Qg
switch ( geomType )
{
case QgsWkbTypes::PointGeometry:
reset( qgis::make_unique< QgsMultiPointV2 >() );
reset( qgis::make_unique< QgsMultiPoint >() );
break;
case QgsWkbTypes::LineGeometry:
reset( qgis::make_unique< QgsMultiLineString >() );
@@ -1377,7 +1377,7 @@ QgsMultiPointXY QgsGeometry::asMultiPoint() const
return QgsMultiPointXY();
}

const QgsMultiPointV2 *mp = qgsgeometry_cast<QgsMultiPointV2 *>( d->geometry.get() );
const QgsMultiPoint *mp = qgsgeometry_cast<QgsMultiPoint *>( d->geometry.get() );
if ( !mp )
{
return QgsMultiPointXY();
@@ -302,7 +302,7 @@ bool QgsGeometryCollection::fromWkt( const QString &wkt )
return fromCollectionWkt( wkt, QList<QgsAbstractGeometry *>() << new QgsPoint << new QgsLineString << new QgsPolygonV2
<< new QgsCircularString << new QgsCompoundCurve
<< new QgsCurvePolygon
<< new QgsMultiPointV2 << new QgsMultiLineString
<< new QgsMultiPoint << new QgsMultiLineString
<< new QgsMultiPolygonV2 << new QgsGeometryCollection
<< new QgsMultiCurve << new QgsMultiSurface, QStringLiteral( "GeometryCollection" ) );
}
@@ -99,7 +99,7 @@ std::unique_ptr<QgsAbstractGeometry> QgsGeometryFactory::geomFromWkt( const QStr
}
else if ( trimmed.startsWith( QLatin1String( "MultiPoint" ), Qt::CaseInsensitive ) )
{
geom = qgis::make_unique< QgsMultiPointV2 >();
geom = qgis::make_unique< QgsMultiPoint >();
}
else if ( trimmed.startsWith( QLatin1String( "MultiCurve" ), Qt::CaseInsensitive ) )
{
@@ -139,7 +139,7 @@ std::unique_ptr< QgsAbstractGeometry > QgsGeometryFactory::fromPoint( const QgsP

std::unique_ptr<QgsMultiPointV2> QgsGeometryFactory::fromMultiPoint( const QgsMultiPointXY &multipoint )
{
std::unique_ptr< QgsMultiPointV2 > mp = qgis::make_unique< QgsMultiPointV2 >();
std::unique_ptr< QgsMultiPoint > mp = qgis::make_unique< QgsMultiPoint >();
QgsMultiPointXY::const_iterator ptIt = multipoint.constBegin();
for ( ; ptIt != multipoint.constEnd(); ++ptIt )
{
@@ -235,7 +235,7 @@ std::unique_ptr<QgsAbstractGeometry> QgsGeometryFactory::geomFromWkbType( QgsWkb
case QgsWkbTypes::MultiPolygon:
return qgis::make_unique< QgsMultiPolygonV2 >();
case QgsWkbTypes::MultiPoint:
return qgis::make_unique< QgsMultiPointV2 >();
return qgis::make_unique< QgsMultiPoint >();
case QgsWkbTypes::MultiCurve:
return qgis::make_unique< QgsMultiCurve >();
case QgsWkbTypes::MultiSurface:
@@ -256,7 +256,7 @@ std::unique_ptr<QgsGeometryCollection> QgsGeometryFactory::createCollectionOfTyp
switch ( type )
{
case QgsWkbTypes::MultiPoint:
collect = qgis::make_unique< QgsMultiPointV2 >();
collect = qgis::make_unique< QgsMultiPoint >();
break;
case QgsWkbTypes::MultiLineString:
collect = qgis::make_unique< QgsMultiLineString >();
@@ -29,7 +29,7 @@ class QgsLineString;
class QgsConstWkbPtr;
class QgsRectangle;
class QgsGeometryCollection;
class QgsMultiPointV2;
class QgsMultiPoint;
class QgsMultiLineString;
class QgsPolygon;
class QgsMultiPolygonV2;
@@ -947,7 +947,7 @@ std::unique_ptr< QgsAbstractGeometry > _qgis_lwgeom_make_valid( const QgsAbstrac
switch ( QgsWkbTypes::multiType( lwgeom_out->wkbType() ) )
{
case QgsWkbTypes::MultiPoint:
collection = new QgsMultiPointV2();
collection = new QgsMultiPoint();
break;
case QgsWkbTypes::MultiLineString:
collection = new QgsMultiLineString();
@@ -1050,7 +1050,7 @@ std::unique_ptr<QgsAbstractGeometry> QgsGeos::fromGeos( const GEOSGeometry *geos
}
case GEOS_MULTIPOINT:
{
std::unique_ptr< QgsMultiPointV2 > multiPoint( new QgsMultiPointV2() );
std::unique_ptr< QgsMultiPoint > multiPoint( new QgsMultiPoint() );
int nParts = GEOSGetNumGeometries_r( geosinit.ctxt, geos );
for ( int i = 0; i < nParts; ++i )
{
@@ -180,7 +180,7 @@ QgsMultiCurve *QgsMultiCurve::reversed() const

QgsAbstractGeometry *QgsMultiCurve::boundary() const
{
std::unique_ptr< QgsMultiPointV2 > multiPoint( new QgsMultiPointV2() );
std::unique_ptr< QgsMultiPoint > multiPoint( new QgsMultiPoint() );
for ( int i = 0; i < mGeometries.size(); ++i )
{
if ( QgsCurve *curve = qgsgeometry_cast<QgsCurve *>( mGeometries.at( i ) ) )
@@ -19,34 +19,34 @@ email : marco.hugentobler at sourcepole dot com
#include "qgspoint.h"
#include "qgswkbptr.h"

QgsMultiPointV2::QgsMultiPointV2()
QgsMultiPoint::QgsMultiPoint()
{
mWkbType = QgsWkbTypes::MultiPoint;
}

QString QgsMultiPointV2::geometryType() const
QString QgsMultiPoint::geometryType() const
{
return QStringLiteral( "MultiPoint" );
}

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

QgsMultiPointV2 *QgsMultiPointV2::clone() const
QgsMultiPoint *QgsMultiPoint::clone() const
{
return new QgsMultiPointV2( *this );
}

QgsMultiPointV2 *QgsMultiPointV2::toCurveType() const
QgsMultiPoint *QgsMultiPoint::toCurveType() const
{
return clone();
}

bool QgsMultiPointV2::fromWkt( const QString &wkt )
bool QgsMultiPoint::fromWkt( const QString &wkt )
{
QString collectionWkt( wkt );
//test for non-standard MultiPoint(x1 y1, x2 y2) format
@@ -61,13 +61,13 @@ bool QgsMultiPointV2::fromWkt( const QString &wkt )
return fromCollectionWkt( collectionWkt, QList<QgsAbstractGeometry *>() << new QgsPoint, QStringLiteral( "Point" ) );
}

void QgsMultiPointV2::clear()
void QgsMultiPoint::clear()
{
QgsGeometryCollection::clear();
mWkbType = QgsWkbTypes::MultiPoint;
}

QDomElement QgsMultiPointV2::asGML2( QDomDocument &doc, int precision, const QString &ns ) const
QDomElement QgsMultiPoint::asGML2( QDomDocument &doc, int precision, const QString &ns ) const
{
QDomElement elemMultiPoint = doc.createElementNS( ns, QStringLiteral( "MultiPoint" ) );

@@ -87,7 +87,7 @@ QDomElement QgsMultiPointV2::asGML2( QDomDocument &doc, int precision, const QSt
return elemMultiPoint;
}

QDomElement QgsMultiPointV2::asGML3( QDomDocument &doc, int precision, const QString &ns ) const
QDomElement QgsMultiPoint::asGML3( QDomDocument &doc, int precision, const QString &ns ) const
{
QDomElement elemMultiPoint = doc.createElementNS( ns, QStringLiteral( "MultiPoint" ) );

@@ -107,7 +107,7 @@ QDomElement QgsMultiPointV2::asGML3( QDomDocument &doc, int precision, const QSt
return elemMultiPoint;
}

QString QgsMultiPointV2::asJSON( int precision ) const
QString QgsMultiPoint::asJSON( int precision ) const
{
QString json = QStringLiteral( "{\"type\": \"MultiPoint\", \"coordinates\": " );

@@ -125,12 +125,12 @@ QString QgsMultiPointV2::asJSON( int precision ) const
return json;
}

int QgsMultiPointV2::nCoordinates() const
int QgsMultiPoint::nCoordinates() const
{
return mGeometries.size();
}

bool QgsMultiPointV2::addGeometry( QgsAbstractGeometry *g )
bool QgsMultiPoint::addGeometry( QgsAbstractGeometry *g )
{
if ( !qgsgeometry_cast<QgsPoint *>( g ) )
{
@@ -153,7 +153,7 @@ bool QgsMultiPointV2::addGeometry( QgsAbstractGeometry *g )
return QgsGeometryCollection::addGeometry( g );
}

bool QgsMultiPointV2::insertGeometry( QgsAbstractGeometry *g, int index )
bool QgsMultiPoint::insertGeometry( QgsAbstractGeometry *g, int index )
{
if ( !g || QgsWkbTypes::flatType( g->wkbType() ) != QgsWkbTypes::Point )
{
@@ -164,20 +164,20 @@ bool QgsMultiPointV2::insertGeometry( QgsAbstractGeometry *g, int index )
return QgsGeometryCollection::insertGeometry( g, index );
}

QgsAbstractGeometry *QgsMultiPointV2::boundary() const
QgsAbstractGeometry *QgsMultiPoint::boundary() const
{
return nullptr;
}

int QgsMultiPointV2::vertexNumberFromVertexId( QgsVertexId id ) const
int QgsMultiPoint::vertexNumberFromVertexId( QgsVertexId id ) const
{
if ( id.part < 0 || id.part >= mGeometries.count() || id.vertex != 0 || id.ring != 0 )
return -1;

return id.part; // can shortcut the calculation, since each part will have 1 vertex
}

bool QgsMultiPointV2::wktOmitChildType() const
bool QgsMultiPoint::wktOmitChildType() const
{
return true;
}
@@ -29,11 +29,11 @@ email : marco.hugentobler at sourcepole dot com
class CORE_EXPORT QgsMultiPointV2: public QgsGeometryCollection
{
public:
QgsMultiPointV2();
QgsMultiPoint();

QString geometryType() const override;
QgsMultiPointV2 *clone() const override SIP_FACTORY;
QgsMultiPointV2 *toCurveType() const override SIP_FACTORY;
QgsMultiPoint *clone() const override SIP_FACTORY;
QgsMultiPoint *toCurveType() const override SIP_FACTORY;
bool fromWkt( const QString &wkt ) override;
void clear() override;
QDomElement asGML2( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const override;
@@ -55,15 +55,15 @@ class CORE_EXPORT QgsMultiPointV2: public QgsGeometryCollection
* \note Not available in Python. Objects will be automatically be converted to the appropriate target type.
* \since QGIS 3.0
*/
inline const QgsMultiPointV2 *cast( const QgsAbstractGeometry *geom ) const
inline const QgsMultiPoint *cast( const QgsAbstractGeometry *geom ) const
{
if ( geom && QgsWkbTypes::flatType( geom->wkbType() ) == QgsWkbTypes::MultiPoint )
return static_cast<const QgsMultiPointV2 *>( geom );
return static_cast<const QgsMultiPoint *>( geom );
return nullptr;
}
#endif
protected:
QgsMultiPointV2 *createEmptyWithSameType() const override SIP_FACTORY;
QgsMultiPoint *createEmptyWithSameType() const override SIP_FACTORY;
bool wktOmitChildType() const override;

};
@@ -139,7 +139,7 @@ bool QgsPointDistanceRenderer::renderFeature( QgsFeature &feature, QgsRenderCont
void QgsPointDistanceRenderer::drawGroup( const ClusteredGroup &group, QgsRenderContext &context )
{
//calculate centroid of all points, this will be center of group
QgsMultiPointV2 *groupMultiPoint = new QgsMultiPointV2();
QgsMultiPoint *groupMultiPoint = new QgsMultiPoint();
Q_FOREACH ( const GroupedFeature &f, group )
{
groupMultiPoint->addGeometry( f.feature.geometry().constGet()->clone() );

0 comments on commit 3fcdcd8

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