Skip to content
Permalink
Browse files

Rename from[GeometryType] to from[GeometryType]XY

- QgsGeometry::fromPoint() was renamed to fromPointXY()
- QgsGeometry::fromMultiPoint() was renamed to fromMultiPointXY()
- QgsGeometry::fromMultiPolyline() was renamed to fromMultiPolylineXY()
- QgsGeometry::fromPolygon() was renamed to fromPolygonXY()
- QgsGeometry::fromMultiPolygon() was renamed to fromMultiPolygonXY()
  • Loading branch information
m-kuhn committed Oct 30, 2017
1 parent bde014e commit 82e6d1219fb67cfd74b404530c9016b9b21d8306
Showing with 173 additions and 168 deletions.
  1. +5 −0 doc/api_break.dox
  2. +4 −4 python/core/geometry/qgsgeometry.sip
  3. +1 −1 src/app/qgsmaptooladdfeature.cpp
  4. +1 −1 src/app/qgsmaptooldeletepart.cpp
  5. +1 −1 src/app/qgsmaptooldeletering.cpp
  6. +2 −2 src/app/qgsmaptoolfillring.cpp
  7. +1 −1 src/app/qgsmaptoolselectutils.cpp
  8. +28 −28 src/core/geometry/qgsgeometry.cpp
  9. +4 −4 src/core/geometry/qgsgeometry.h
  10. +5 −5 src/core/geometry/qgsgeometryfactory.cpp
  11. +4 −4 src/core/geometry/qgsgeometryfactory.h
  12. +1 −1 src/core/qgstracer.cpp
  13. +3 −3 src/core/symbology/qgsinvertedpolygonrenderer.cpp
  14. +2 −2 src/core/symbology/qgssymbollayerutils.cpp
  15. +3 −3 src/gui/qgsrubberband.cpp
  16. +1 −1 src/plugins/topology/topolTest.cpp
  17. +1 −1 src/providers/grass/qgsgrassgislib.cpp
  18. +1 −1 tests/src/app/testqgsattributetable.cpp
  19. +1 −1 tests/src/app/testqgsfieldcalculator.cpp
  20. +2 −2 tests/src/app/testqgsmaptoolidentifyaction.cpp
  21. +1 −1 tests/src/app/testqgsnodetool.cpp
  22. +1 −1 tests/src/core/testqgscadutils.cpp
  23. +2 −2 tests/src/core/testqgsdistancearea.cpp
  24. +25 −25 tests/src/core/testqgsexpression.cpp
  25. +3 −3 tests/src/core/testqgsgeometry.cpp
  26. +1 −1 tests/src/core/testqgsmaprendererjob.cpp
  27. +2 −2 tests/src/core/testqgspointlocator.cpp
  28. +1 −1 tests/src/core/testqgssnappingutils.cpp
  29. +3 −3 tests/src/core/testqgsvectorfilewriter.cpp
  30. +1 −1 tests/src/python/test_qgsatlascomposition.py
  31. +6 −6 tests/src/python/test_qgsdistancearea.py
  32. +53 −53 tests/src/python/test_qgsgeometry.py
  33. +1 −1 tests/src/python/test_qgssymbollayer_readsld.py
  34. +1 −1 tests/src/python/test_qgsvectorlayer.py
  35. +1 −1 tests/src/python/test_qgsvectorlayereditbuffer.py
@@ -1324,6 +1324,11 @@ empty geometry collection)
- fromPolyline() now requires a list of QgsPoint objects, instead of QgsPointXY 2d points. A new method fromPolylineXY was
added which uses the old list of 2d QgsPointXY objects. Using the newer method with QgsPoint is greatly preferred, as it
maintains Z or M dimensions from the input points and is more efficient.
- fromPoint() was renamed to fromPointXY()
- fromMultiPoint() was renamed to fromMultiPointXY()
- fromMultiPolyline() was renamed to fromMultiPolylineXY()
- fromPolygon() was renamed to fromPolygonXY()
- fromMultiPolygon() was renamed to fromMultiPolygonXY()


QgsGeometryAnalyzer {#qgis_api_break_3_0_QgsGeometryAnalyzer}
@@ -150,7 +150,7 @@ Creates a new geometry from a WKT string
Creates a new geometry from a QgsPointXY object
:rtype: QgsGeometry
%End
static QgsGeometry fromMultiPoint( const QgsMultiPointXY &multipoint );
static QgsGeometry fromMultiPointXY( const QgsMultiPointXY &multipoint );
%Docstring
Creates a new geometry from a QgsMultiPointXY object
:rtype: QgsGeometry
@@ -184,17 +184,17 @@ Creates a new geometry from a QgsMultiPointXY object
:rtype: QgsGeometry
%End

static QgsGeometry fromMultiPolyline( const QgsMultiPolylineXY &multiline );
static QgsGeometry fromMultiPolylineXY( const QgsMultiPolylineXY &multiline );
%Docstring
Creates a new geometry from a QgsMultiPolylineXY object
:rtype: QgsGeometry
%End
static QgsGeometry fromPolygon( const QgsPolygonXY &polygon );
static QgsGeometry fromPolygonXY( const QgsPolygonXY &polygon );
%Docstring
Creates a new geometry from a QgsPolygon
:rtype: QgsGeometry
%End
static QgsGeometry fromMultiPolygon( const QgsMultiPolygonXY &multipoly );
static QgsGeometry fromMultiPolygonXY( const QgsMultiPolygonXY &multipoly );
%Docstring
Creates a new geometry from a QgsMultiPolygon
:rtype: QgsGeometry
@@ -160,7 +160,7 @@ void QgsMapToolAddFeature::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
}
else if ( layerWKBType == QgsWkbTypes::MultiPoint )
{
g = QgsGeometry::fromMultiPoint( QgsMultiPointXY() << savePoint );
g = QgsGeometry::fromMultiPointXY( QgsMultiPointXY() << savePoint );
}
else if ( layerWKBType == QgsWkbTypes::MultiPoint25D )
{
@@ -179,7 +179,7 @@ QgsGeometry QgsMapToolDeletePart::partUnderPoint( QPoint point, QgsFeatureId &fi
for ( int part = 0; part < mpolygon.count(); part++ ) // go through the polygons
{
const QgsPolygonXY &polygon = mpolygon[part];
QgsGeometry partGeo = QgsGeometry::fromPolygon( polygon );
QgsGeometry partGeo = QgsGeometry::fromPolygonXY( polygon );
if ( partGeo.contains( &layerCoords ) )
{
fid = f.id();
@@ -152,7 +152,7 @@ QgsGeometry QgsMapToolDeleteRing::ringUnderPoint( const QgsPointXY &p, QgsFeatur
for ( int j = 1; j < pol[i].size(); ++j )
{
tempPol = QgsPolygonXY() << pol[i][j];
tempGeom = QgsGeometry::fromPolygon( tempPol );
tempGeom = QgsGeometry::fromPolygonXY( tempPol );
if ( tempGeom.area() < area && tempGeom.contains( &p ) )
{
fid = f.id();
@@ -125,7 +125,7 @@ void QgsMapToolFillRing::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
return;
}

g = QgsGeometry::fromPolygon( QgsPolygonXY() << pointList.toVector() );
g = QgsGeometry::fromPolygonXY( QgsPolygonXY() << pointList.toVector() );
}
else
{
@@ -217,7 +217,7 @@ QgsGeometry QgsMapToolFillRing::ringUnderPoint( const QgsPointXY &p, QgsFeatureI
for ( int j = 1; j < pol[i].size(); ++j )
{
QgsPolygonXY tempPol = QgsPolygonXY() << pol[i][j];
QgsGeometry tempGeom = QgsGeometry::fromPolygon( tempPol );
QgsGeometry tempGeom = QgsGeometry::fromPolygonXY( tempPol );
if ( tempGeom.area() < area && tempGeom.contains( &p ) )
{
fid = f.id();
@@ -204,7 +204,7 @@ QgsFeatureIds QgsMapToolSelectUtils::getMatchingFeatures( QgsMapCanvas *canvas,
}
ringOut[ i++ ] = ringIn.at( j );
}
selectGeomTrans = QgsGeometry::fromPolygon( newpoly );
selectGeomTrans = QgsGeometry::fromPolygonXY( newpoly );
}
}

@@ -181,39 +181,39 @@ QgsGeometry QgsGeometry::fromPolyline( const QgsPolyline &polyline )
return QgsGeometry( qgis::make_unique< QgsLineString >( polyline ) );
}

QgsGeometry QgsGeometry::fromPolygon( const QgsPolygonXY &polygon )
QgsGeometry QgsGeometry::fromPolygonXY( const QgsPolygonXY &polygon )
{
std::unique_ptr< QgsPolygon > geom = QgsGeometryFactory::fromPolygon( polygon );
std::unique_ptr< QgsPolygon > geom = QgsGeometryFactory::fromPolygonXY( polygon );
if ( geom )
{
return QgsGeometry( std::move( geom.release() ) );
}
return QgsGeometry();
}

QgsGeometry QgsGeometry::fromMultiPoint( const QgsMultiPointXY &multipoint )
QgsGeometry QgsGeometry::fromMultiPointXY( const QgsMultiPointXY &multipoint )
{
std::unique_ptr< QgsMultiPoint > geom = QgsGeometryFactory::fromMultiPoint( multipoint );
std::unique_ptr< QgsMultiPoint > geom = QgsGeometryFactory::fromMultiPointXY( multipoint );
if ( geom )
{
return QgsGeometry( std::move( geom ) );
}
return QgsGeometry();
}

QgsGeometry QgsGeometry::fromMultiPolyline( const QgsMultiPolylineXY &multiline )
QgsGeometry QgsGeometry::fromMultiPolylineXY( const QgsMultiPolylineXY &multiline )
{
std::unique_ptr< QgsMultiLineString > geom = QgsGeometryFactory::fromMultiPolyline( multiline );
std::unique_ptr< QgsMultiLineString > geom = QgsGeometryFactory::fromMultiPolylineXY( multiline );
if ( geom )
{
return QgsGeometry( std::move( geom ) );
}
return QgsGeometry();
}

QgsGeometry QgsGeometry::fromMultiPolygon( const QgsMultiPolygonXY &multipoly )
QgsGeometry QgsGeometry::fromMultiPolygonXY( const QgsMultiPolygonXY &multipoly )
{
std::unique_ptr< QgsMultiPolygon > geom = QgsGeometryFactory::fromMultiPolygon( multipoly );
std::unique_ptr< QgsMultiPolygon > geom = QgsGeometryFactory::fromMultiPolygonXY( multipoly );
if ( geom )
{
return QgsGeometry( std::move( geom ) );
@@ -233,7 +233,7 @@ QgsGeometry QgsGeometry::fromRect( const QgsRectangle &rect )
QgsPolygonXY polygon;
polygon.append( ring );

return fromPolygon( polygon );
return fromPolygonXY( polygon );
}

QgsGeometry QgsGeometry::collectGeometry( const QList< QgsGeometry > &geometries )
@@ -2549,7 +2549,7 @@ QgsGeometry QgsGeometry::fromQPolygonF( const QPolygonF &polygon )
{
if ( polygon.isClosed() )
{
return QgsGeometry::fromPolygon( createPolygonFromQPolygonF( polygon ) );
return QgsGeometry::fromPolygonXY( createPolygonFromQPolygonF( polygon ) );
}
else
{
@@ -2805,7 +2805,7 @@ QgsGeometry QgsGeometry::convertToPoint( bool destMultipart ) const
if ( destMultipart )
{
// layer is multipart => make a multipoint with a single point
return fromMultiPoint( QgsMultiPointXY() << asPoint() );
return fromMultiPointXY( QgsMultiPointXY() << asPoint() );
}
else
{
@@ -2833,14 +2833,14 @@ QgsGeometry QgsGeometry::convertToPoint( bool destMultipart ) const
for ( const QgsPolylineXY &l : multiLine )
for ( const QgsPointXY &p : l )
multiPoint << p;
return fromMultiPoint( multiPoint );
return fromMultiPointXY( multiPoint );
}
// input geometry is not multipart: copy directly the line into a multipoint
else
{
QgsPolylineXY line = asPolyline();
if ( !line.isEmpty() )
return fromMultiPoint( line );
return fromMultiPointXY( line );
}
return QgsGeometry();
}
@@ -2860,7 +2860,7 @@ QgsGeometry QgsGeometry::convertToPoint( bool destMultipart ) const
for ( const QgsPolylineXY &line : poly )
for ( const QgsPointXY &pt : line )
multiPoint << pt;
return fromMultiPoint( multiPoint );
return fromMultiPointXY( multiPoint );
}
// input geometry is not multipart: make a multipoint from polygon
else
@@ -2870,7 +2870,7 @@ QgsGeometry QgsGeometry::convertToPoint( bool destMultipart ) const
for ( const QgsPolylineXY &line : polygon )
for ( const QgsPointXY &pt : line )
multiPoint << pt;
return fromMultiPoint( multiPoint );
return fromMultiPointXY( multiPoint );
}
}

@@ -2893,7 +2893,7 @@ QgsGeometry QgsGeometry::convertToLine( bool destMultipart ) const
return QgsGeometry();

if ( destMultipart )
return fromMultiPolyline( QgsMultiPolylineXY() << multiPoint );
return fromMultiPolylineXY( QgsMultiPolylineXY() << multiPoint );
else
return fromPolylineXY( multiPoint );
}
@@ -2913,7 +2913,7 @@ QgsGeometry QgsGeometry::convertToLine( bool destMultipart ) const
// destination is multipart => makes a multipoint with a single line
QgsPolylineXY line = asPolyline();
if ( !line.isEmpty() )
return fromMultiPolyline( QgsMultiPolylineXY() << line );
return fromMultiPolylineXY( QgsMultiPolylineXY() << line );
}
else
{
@@ -2939,7 +2939,7 @@ QgsGeometry QgsGeometry::convertToLine( bool destMultipart ) const
if ( destMultipart )
{
// destination is multipart
return fromMultiPolyline( multiLine );
return fromMultiPolylineXY( multiLine );
}
else if ( multiLine.count() == 1 )
{
@@ -2962,15 +2962,15 @@ QgsGeometry QgsGeometry::convertToLine( bool destMultipart ) const
QgsMultiPolylineXY multiLine;
for ( const QgsPolylineXY &line : polygon )
multiLine << line;
return fromMultiPolyline( multiLine );
return fromMultiPolylineXY( multiLine );
}
}
// no rings
else if ( polygon.count() == 1 )
{
if ( destMultipart )
{
return fromMultiPolyline( polygon );
return fromMultiPolylineXY( polygon );
}
else
{
@@ -3004,9 +3004,9 @@ QgsGeometry QgsGeometry::convertToPolygon( bool destMultipart ) const

QgsPolygonXY polygon = QgsPolygonXY() << multiPoint;
if ( destMultipart )
return fromMultiPolygon( QgsMultiPolygonXY() << polygon );
return fromMultiPolygonXY( QgsMultiPolygonXY() << polygon );
else
return fromPolygon( polygon );
return fromPolygonXY( polygon );
}

case QgsWkbTypes::LineGeometry:
@@ -3034,12 +3034,12 @@ QgsGeometry QgsGeometry::convertToPolygon( bool destMultipart ) const
{
if ( destMultipart )
{
return fromMultiPolygon( multiPolygon );
return fromMultiPolygonXY( multiPolygon );
}
else if ( multiPolygon.count() == 1 )
{
// destination is singlepart => make a single part if possible
return fromPolygon( multiPolygon[0] );
return fromPolygonXY( multiPolygon[0] );
}
}
}
@@ -3061,11 +3061,11 @@ QgsGeometry QgsGeometry::convertToPolygon( bool destMultipart ) const
// destination is multipart
if ( destMultipart )
{
return fromMultiPolygon( QgsMultiPolygonXY() << ( QgsPolygonXY() << line ) );
return fromMultiPolygonXY( QgsMultiPolygonXY() << ( QgsPolygonXY() << line ) );
}
else
{
return fromPolygon( QgsPolygonXY() << line );
return fromPolygonXY( QgsPolygonXY() << line );
}
}
return QgsGeometry();
@@ -3086,15 +3086,15 @@ QgsGeometry QgsGeometry::convertToPolygon( bool destMultipart ) const
// destination is multipart => makes a multipoint with a single polygon
QgsPolygonXY polygon = asPolygon();
if ( !polygon.isEmpty() )
return fromMultiPolygon( QgsMultiPolygonXY() << polygon );
return fromMultiPolygonXY( QgsMultiPolygonXY() << polygon );
}
else
{
QgsMultiPolygonXY multiPolygon = asMultiPolygon();
if ( multiPolygon.count() == 1 )
{
// destination is singlepart => make a single part if possible
return fromPolygon( multiPolygon[0] );
return fromPolygonXY( multiPolygon[0] );
}
}
return QgsGeometry();
@@ -215,7 +215,7 @@ class CORE_EXPORT QgsGeometry
//! Creates a new geometry from a QgsPointXY object
static QgsGeometry fromPoint( const QgsPointXY &point );
//! Creates a new geometry from a QgsMultiPointXY object
static QgsGeometry fromMultiPoint( const QgsMultiPointXY &multipoint );
static QgsGeometry fromMultiPointXY( const QgsMultiPointXY &multipoint );

/**
* Creates a new LineString geometry from a list of QgsPointXY points.
@@ -242,11 +242,11 @@ class CORE_EXPORT QgsGeometry
static QgsGeometry fromPolyline( const QgsPolyline &polyline );

//! Creates a new geometry from a QgsMultiPolylineXY object
static QgsGeometry fromMultiPolyline( const QgsMultiPolylineXY &multiline );
static QgsGeometry fromMultiPolylineXY( const QgsMultiPolylineXY &multiline );
//! Creates a new geometry from a QgsPolygon
static QgsGeometry fromPolygon( const QgsPolygonXY &polygon );
static QgsGeometry fromPolygonXY( const QgsPolygonXY &polygon );
//! Creates a new geometry from a QgsMultiPolygon
static QgsGeometry fromMultiPolygon( const QgsMultiPolygonXY &multipoly );
static QgsGeometry fromMultiPolygonXY( const QgsMultiPolygonXY &multipoly );
//! Creates a new geometry from a QgsRectangle
static QgsGeometry fromRect( const QgsRectangle &rect );
//! Creates a new multipart geometry from a list of QgsGeometry objects
@@ -137,7 +137,7 @@ std::unique_ptr< QgsAbstractGeometry > QgsGeometryFactory::fromPoint( const QgsP
return qgis::make_unique< QgsPoint >( point.x(), point.y() );
}

std::unique_ptr<QgsMultiPoint> QgsGeometryFactory::fromMultiPoint( const QgsMultiPointXY &multipoint )
std::unique_ptr<QgsMultiPoint> QgsGeometryFactory::fromMultiPointXY( const QgsMultiPointXY &multipoint )
{
std::unique_ptr< QgsMultiPoint > mp = qgis::make_unique< QgsMultiPoint >();
QgsMultiPointXY::const_iterator ptIt = multipoint.constBegin();
@@ -154,7 +154,7 @@ std::unique_ptr<QgsAbstractGeometry> QgsGeometryFactory::fromPolyline( const Qgs
return linestringFromPolyline( polyline );
}

std::unique_ptr<QgsMultiLineString> QgsGeometryFactory::fromMultiPolyline( const QgsMultiPolylineXY &multiline )
std::unique_ptr<QgsMultiLineString> QgsGeometryFactory::fromMultiPolylineXY( const QgsMultiPolylineXY &multiline )
{
std::unique_ptr< QgsMultiLineString > mLine = qgis::make_unique< QgsMultiLineString >();
for ( int i = 0; i < multiline.size(); ++i )
@@ -164,7 +164,7 @@ std::unique_ptr<QgsMultiLineString> QgsGeometryFactory::fromMultiPolyline( const
return mLine;
}

std::unique_ptr<QgsPolygon> QgsGeometryFactory::fromPolygon( const QgsPolygonXY &polygon )
std::unique_ptr<QgsPolygon> QgsGeometryFactory::fromPolygonXY( const QgsPolygonXY &polygon )
{
std::unique_ptr< QgsPolygon > poly = qgis::make_unique< QgsPolygon >();

@@ -187,12 +187,12 @@ std::unique_ptr<QgsPolygon> QgsGeometryFactory::fromPolygon( const QgsPolygonXY
return poly;
}

std::unique_ptr< QgsMultiPolygon > QgsGeometryFactory::fromMultiPolygon( const QgsMultiPolygonXY &multipoly )
std::unique_ptr< QgsMultiPolygon > QgsGeometryFactory::fromMultiPolygonXY( const QgsMultiPolygonXY &multipoly )
{
std::unique_ptr< QgsMultiPolygon > mp = qgis::make_unique< QgsMultiPolygon >();
for ( int i = 0; i < multipoly.size(); ++i )
{
mp->addGeometry( fromPolygon( multipoly.at( i ) ).release() );
mp->addGeometry( fromPolygonXY( multipoly.at( i ) ).release() );
}
return mp;
}
@@ -67,15 +67,15 @@ class CORE_EXPORT QgsGeometryFactory
//! Construct geometry from a point
static std::unique_ptr< QgsAbstractGeometry > fromPoint( const QgsPointXY &point );
//! Construct geometry from a multipoint
static std::unique_ptr<QgsMultiPoint> fromMultiPoint( const QgsMultiPointXY &multipoint );
static std::unique_ptr<QgsMultiPoint> fromMultiPointXY( const QgsMultiPointXY &multipoint );
//! Construct geometry from a polyline
static std::unique_ptr< QgsAbstractGeometry > fromPolyline( const QgsPolylineXY &polyline );
//! Construct geometry from a multipolyline
static std::unique_ptr<QgsMultiLineString> fromMultiPolyline( const QgsMultiPolylineXY &multiline );
static std::unique_ptr<QgsMultiLineString> fromMultiPolylineXY( const QgsMultiPolylineXY &multiline );
//! Construct geometry from a polygon
static std::unique_ptr<QgsPolygon> fromPolygon( const QgsPolygonXY &polygon );
static std::unique_ptr<QgsPolygon> fromPolygonXY( const QgsPolygonXY &polygon );
//! Construct geometry from a multipolygon
static std::unique_ptr<QgsMultiPolygon> fromMultiPolygon( const QgsMultiPolygonXY &multipoly );
static std::unique_ptr<QgsMultiPolygon> fromMultiPolygonXY( const QgsMultiPolygonXY &multipoly );
//! Return empty geometry from wkb type
static std::unique_ptr< QgsAbstractGeometry > geomFromWkbType( QgsWkbTypes::Type t );

0 comments on commit 82e6d12

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