Skip to content

Commit 82e6d12

Browse files
committed
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()
1 parent bde014e commit 82e6d12

35 files changed

+173
-168
lines changed

doc/api_break.dox

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,6 +1324,11 @@ empty geometry collection)
13241324
- fromPolyline() now requires a list of QgsPoint objects, instead of QgsPointXY 2d points. A new method fromPolylineXY was
13251325
added which uses the old list of 2d QgsPointXY objects. Using the newer method with QgsPoint is greatly preferred, as it
13261326
maintains Z or M dimensions from the input points and is more efficient.
1327+
- fromPoint() was renamed to fromPointXY()
1328+
- fromMultiPoint() was renamed to fromMultiPointXY()
1329+
- fromMultiPolyline() was renamed to fromMultiPolylineXY()
1330+
- fromPolygon() was renamed to fromPolygonXY()
1331+
- fromMultiPolygon() was renamed to fromMultiPolygonXY()
13271332

13281333

13291334
QgsGeometryAnalyzer {#qgis_api_break_3_0_QgsGeometryAnalyzer}

python/core/geometry/qgsgeometry.sip

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ Creates a new geometry from a WKT string
150150
Creates a new geometry from a QgsPointXY object
151151
:rtype: QgsGeometry
152152
%End
153-
static QgsGeometry fromMultiPoint( const QgsMultiPointXY &multipoint );
153+
static QgsGeometry fromMultiPointXY( const QgsMultiPointXY &multipoint );
154154
%Docstring
155155
Creates a new geometry from a QgsMultiPointXY object
156156
:rtype: QgsGeometry
@@ -184,17 +184,17 @@ Creates a new geometry from a QgsMultiPointXY object
184184
:rtype: QgsGeometry
185185
%End
186186

187-
static QgsGeometry fromMultiPolyline( const QgsMultiPolylineXY &multiline );
187+
static QgsGeometry fromMultiPolylineXY( const QgsMultiPolylineXY &multiline );
188188
%Docstring
189189
Creates a new geometry from a QgsMultiPolylineXY object
190190
:rtype: QgsGeometry
191191
%End
192-
static QgsGeometry fromPolygon( const QgsPolygonXY &polygon );
192+
static QgsGeometry fromPolygonXY( const QgsPolygonXY &polygon );
193193
%Docstring
194194
Creates a new geometry from a QgsPolygon
195195
:rtype: QgsGeometry
196196
%End
197-
static QgsGeometry fromMultiPolygon( const QgsMultiPolygonXY &multipoly );
197+
static QgsGeometry fromMultiPolygonXY( const QgsMultiPolygonXY &multipoly );
198198
%Docstring
199199
Creates a new geometry from a QgsMultiPolygon
200200
:rtype: QgsGeometry

src/app/qgsmaptooladdfeature.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ void QgsMapToolAddFeature::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
160160
}
161161
else if ( layerWKBType == QgsWkbTypes::MultiPoint )
162162
{
163-
g = QgsGeometry::fromMultiPoint( QgsMultiPointXY() << savePoint );
163+
g = QgsGeometry::fromMultiPointXY( QgsMultiPointXY() << savePoint );
164164
}
165165
else if ( layerWKBType == QgsWkbTypes::MultiPoint25D )
166166
{

src/app/qgsmaptooldeletepart.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ QgsGeometry QgsMapToolDeletePart::partUnderPoint( QPoint point, QgsFeatureId &fi
179179
for ( int part = 0; part < mpolygon.count(); part++ ) // go through the polygons
180180
{
181181
const QgsPolygonXY &polygon = mpolygon[part];
182-
QgsGeometry partGeo = QgsGeometry::fromPolygon( polygon );
182+
QgsGeometry partGeo = QgsGeometry::fromPolygonXY( polygon );
183183
if ( partGeo.contains( &layerCoords ) )
184184
{
185185
fid = f.id();

src/app/qgsmaptooldeletering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ QgsGeometry QgsMapToolDeleteRing::ringUnderPoint( const QgsPointXY &p, QgsFeatur
152152
for ( int j = 1; j < pol[i].size(); ++j )
153153
{
154154
tempPol = QgsPolygonXY() << pol[i][j];
155-
tempGeom = QgsGeometry::fromPolygon( tempPol );
155+
tempGeom = QgsGeometry::fromPolygonXY( tempPol );
156156
if ( tempGeom.area() < area && tempGeom.contains( &p ) )
157157
{
158158
fid = f.id();

src/app/qgsmaptoolfillring.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ void QgsMapToolFillRing::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
125125
return;
126126
}
127127

128-
g = QgsGeometry::fromPolygon( QgsPolygonXY() << pointList.toVector() );
128+
g = QgsGeometry::fromPolygonXY( QgsPolygonXY() << pointList.toVector() );
129129
}
130130
else
131131
{
@@ -217,7 +217,7 @@ QgsGeometry QgsMapToolFillRing::ringUnderPoint( const QgsPointXY &p, QgsFeatureI
217217
for ( int j = 1; j < pol[i].size(); ++j )
218218
{
219219
QgsPolygonXY tempPol = QgsPolygonXY() << pol[i][j];
220-
QgsGeometry tempGeom = QgsGeometry::fromPolygon( tempPol );
220+
QgsGeometry tempGeom = QgsGeometry::fromPolygonXY( tempPol );
221221
if ( tempGeom.area() < area && tempGeom.contains( &p ) )
222222
{
223223
fid = f.id();

src/app/qgsmaptoolselectutils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ QgsFeatureIds QgsMapToolSelectUtils::getMatchingFeatures( QgsMapCanvas *canvas,
204204
}
205205
ringOut[ i++ ] = ringIn.at( j );
206206
}
207-
selectGeomTrans = QgsGeometry::fromPolygon( newpoly );
207+
selectGeomTrans = QgsGeometry::fromPolygonXY( newpoly );
208208
}
209209
}
210210

src/core/geometry/qgsgeometry.cpp

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -181,39 +181,39 @@ QgsGeometry QgsGeometry::fromPolyline( const QgsPolyline &polyline )
181181
return QgsGeometry( qgis::make_unique< QgsLineString >( polyline ) );
182182
}
183183

184-
QgsGeometry QgsGeometry::fromPolygon( const QgsPolygonXY &polygon )
184+
QgsGeometry QgsGeometry::fromPolygonXY( const QgsPolygonXY &polygon )
185185
{
186-
std::unique_ptr< QgsPolygon > geom = QgsGeometryFactory::fromPolygon( polygon );
186+
std::unique_ptr< QgsPolygon > geom = QgsGeometryFactory::fromPolygonXY( polygon );
187187
if ( geom )
188188
{
189189
return QgsGeometry( std::move( geom.release() ) );
190190
}
191191
return QgsGeometry();
192192
}
193193

194-
QgsGeometry QgsGeometry::fromMultiPoint( const QgsMultiPointXY &multipoint )
194+
QgsGeometry QgsGeometry::fromMultiPointXY( const QgsMultiPointXY &multipoint )
195195
{
196-
std::unique_ptr< QgsMultiPoint > geom = QgsGeometryFactory::fromMultiPoint( multipoint );
196+
std::unique_ptr< QgsMultiPoint > geom = QgsGeometryFactory::fromMultiPointXY( multipoint );
197197
if ( geom )
198198
{
199199
return QgsGeometry( std::move( geom ) );
200200
}
201201
return QgsGeometry();
202202
}
203203

204-
QgsGeometry QgsGeometry::fromMultiPolyline( const QgsMultiPolylineXY &multiline )
204+
QgsGeometry QgsGeometry::fromMultiPolylineXY( const QgsMultiPolylineXY &multiline )
205205
{
206-
std::unique_ptr< QgsMultiLineString > geom = QgsGeometryFactory::fromMultiPolyline( multiline );
206+
std::unique_ptr< QgsMultiLineString > geom = QgsGeometryFactory::fromMultiPolylineXY( multiline );
207207
if ( geom )
208208
{
209209
return QgsGeometry( std::move( geom ) );
210210
}
211211
return QgsGeometry();
212212
}
213213

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

236-
return fromPolygon( polygon );
236+
return fromPolygonXY( polygon );
237237
}
238238

239239
QgsGeometry QgsGeometry::collectGeometry( const QList< QgsGeometry > &geometries )
@@ -2549,7 +2549,7 @@ QgsGeometry QgsGeometry::fromQPolygonF( const QPolygonF &polygon )
25492549
{
25502550
if ( polygon.isClosed() )
25512551
{
2552-
return QgsGeometry::fromPolygon( createPolygonFromQPolygonF( polygon ) );
2552+
return QgsGeometry::fromPolygonXY( createPolygonFromQPolygonF( polygon ) );
25532553
}
25542554
else
25552555
{
@@ -2805,7 +2805,7 @@ QgsGeometry QgsGeometry::convertToPoint( bool destMultipart ) const
28052805
if ( destMultipart )
28062806
{
28072807
// layer is multipart => make a multipoint with a single point
2808-
return fromMultiPoint( QgsMultiPointXY() << asPoint() );
2808+
return fromMultiPointXY( QgsMultiPointXY() << asPoint() );
28092809
}
28102810
else
28112811
{
@@ -2833,14 +2833,14 @@ QgsGeometry QgsGeometry::convertToPoint( bool destMultipart ) const
28332833
for ( const QgsPolylineXY &l : multiLine )
28342834
for ( const QgsPointXY &p : l )
28352835
multiPoint << p;
2836-
return fromMultiPoint( multiPoint );
2836+
return fromMultiPointXY( multiPoint );
28372837
}
28382838
// input geometry is not multipart: copy directly the line into a multipoint
28392839
else
28402840
{
28412841
QgsPolylineXY line = asPolyline();
28422842
if ( !line.isEmpty() )
2843-
return fromMultiPoint( line );
2843+
return fromMultiPointXY( line );
28442844
}
28452845
return QgsGeometry();
28462846
}
@@ -2860,7 +2860,7 @@ QgsGeometry QgsGeometry::convertToPoint( bool destMultipart ) const
28602860
for ( const QgsPolylineXY &line : poly )
28612861
for ( const QgsPointXY &pt : line )
28622862
multiPoint << pt;
2863-
return fromMultiPoint( multiPoint );
2863+
return fromMultiPointXY( multiPoint );
28642864
}
28652865
// input geometry is not multipart: make a multipoint from polygon
28662866
else
@@ -2870,7 +2870,7 @@ QgsGeometry QgsGeometry::convertToPoint( bool destMultipart ) const
28702870
for ( const QgsPolylineXY &line : polygon )
28712871
for ( const QgsPointXY &pt : line )
28722872
multiPoint << pt;
2873-
return fromMultiPoint( multiPoint );
2873+
return fromMultiPointXY( multiPoint );
28742874
}
28752875
}
28762876

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

28952895
if ( destMultipart )
2896-
return fromMultiPolyline( QgsMultiPolylineXY() << multiPoint );
2896+
return fromMultiPolylineXY( QgsMultiPolylineXY() << multiPoint );
28972897
else
28982898
return fromPolylineXY( multiPoint );
28992899
}
@@ -2913,7 +2913,7 @@ QgsGeometry QgsGeometry::convertToLine( bool destMultipart ) const
29132913
// destination is multipart => makes a multipoint with a single line
29142914
QgsPolylineXY line = asPolyline();
29152915
if ( !line.isEmpty() )
2916-
return fromMultiPolyline( QgsMultiPolylineXY() << line );
2916+
return fromMultiPolylineXY( QgsMultiPolylineXY() << line );
29172917
}
29182918
else
29192919
{
@@ -2939,7 +2939,7 @@ QgsGeometry QgsGeometry::convertToLine( bool destMultipart ) const
29392939
if ( destMultipart )
29402940
{
29412941
// destination is multipart
2942-
return fromMultiPolyline( multiLine );
2942+
return fromMultiPolylineXY( multiLine );
29432943
}
29442944
else if ( multiLine.count() == 1 )
29452945
{
@@ -2962,15 +2962,15 @@ QgsGeometry QgsGeometry::convertToLine( bool destMultipart ) const
29622962
QgsMultiPolylineXY multiLine;
29632963
for ( const QgsPolylineXY &line : polygon )
29642964
multiLine << line;
2965-
return fromMultiPolyline( multiLine );
2965+
return fromMultiPolylineXY( multiLine );
29662966
}
29672967
}
29682968
// no rings
29692969
else if ( polygon.count() == 1 )
29702970
{
29712971
if ( destMultipart )
29722972
{
2973-
return fromMultiPolyline( polygon );
2973+
return fromMultiPolylineXY( polygon );
29742974
}
29752975
else
29762976
{
@@ -3004,9 +3004,9 @@ QgsGeometry QgsGeometry::convertToPolygon( bool destMultipart ) const
30043004

30053005
QgsPolygonXY polygon = QgsPolygonXY() << multiPoint;
30063006
if ( destMultipart )
3007-
return fromMultiPolygon( QgsMultiPolygonXY() << polygon );
3007+
return fromMultiPolygonXY( QgsMultiPolygonXY() << polygon );
30083008
else
3009-
return fromPolygon( polygon );
3009+
return fromPolygonXY( polygon );
30103010
}
30113011

30123012
case QgsWkbTypes::LineGeometry:
@@ -3034,12 +3034,12 @@ QgsGeometry QgsGeometry::convertToPolygon( bool destMultipart ) const
30343034
{
30353035
if ( destMultipart )
30363036
{
3037-
return fromMultiPolygon( multiPolygon );
3037+
return fromMultiPolygonXY( multiPolygon );
30383038
}
30393039
else if ( multiPolygon.count() == 1 )
30403040
{
30413041
// destination is singlepart => make a single part if possible
3042-
return fromPolygon( multiPolygon[0] );
3042+
return fromPolygonXY( multiPolygon[0] );
30433043
}
30443044
}
30453045
}
@@ -3061,11 +3061,11 @@ QgsGeometry QgsGeometry::convertToPolygon( bool destMultipart ) const
30613061
// destination is multipart
30623062
if ( destMultipart )
30633063
{
3064-
return fromMultiPolygon( QgsMultiPolygonXY() << ( QgsPolygonXY() << line ) );
3064+
return fromMultiPolygonXY( QgsMultiPolygonXY() << ( QgsPolygonXY() << line ) );
30653065
}
30663066
else
30673067
{
3068-
return fromPolygon( QgsPolygonXY() << line );
3068+
return fromPolygonXY( QgsPolygonXY() << line );
30693069
}
30703070
}
30713071
return QgsGeometry();
@@ -3086,15 +3086,15 @@ QgsGeometry QgsGeometry::convertToPolygon( bool destMultipart ) const
30863086
// destination is multipart => makes a multipoint with a single polygon
30873087
QgsPolygonXY polygon = asPolygon();
30883088
if ( !polygon.isEmpty() )
3089-
return fromMultiPolygon( QgsMultiPolygonXY() << polygon );
3089+
return fromMultiPolygonXY( QgsMultiPolygonXY() << polygon );
30903090
}
30913091
else
30923092
{
30933093
QgsMultiPolygonXY multiPolygon = asMultiPolygon();
30943094
if ( multiPolygon.count() == 1 )
30953095
{
30963096
// destination is singlepart => make a single part if possible
3097-
return fromPolygon( multiPolygon[0] );
3097+
return fromPolygonXY( multiPolygon[0] );
30983098
}
30993099
}
31003100
return QgsGeometry();

src/core/geometry/qgsgeometry.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ class CORE_EXPORT QgsGeometry
215215
//! Creates a new geometry from a QgsPointXY object
216216
static QgsGeometry fromPoint( const QgsPointXY &point );
217217
//! Creates a new geometry from a QgsMultiPointXY object
218-
static QgsGeometry fromMultiPoint( const QgsMultiPointXY &multipoint );
218+
static QgsGeometry fromMultiPointXY( const QgsMultiPointXY &multipoint );
219219

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

244244
//! Creates a new geometry from a QgsMultiPolylineXY object
245-
static QgsGeometry fromMultiPolyline( const QgsMultiPolylineXY &multiline );
245+
static QgsGeometry fromMultiPolylineXY( const QgsMultiPolylineXY &multiline );
246246
//! Creates a new geometry from a QgsPolygon
247-
static QgsGeometry fromPolygon( const QgsPolygonXY &polygon );
247+
static QgsGeometry fromPolygonXY( const QgsPolygonXY &polygon );
248248
//! Creates a new geometry from a QgsMultiPolygon
249-
static QgsGeometry fromMultiPolygon( const QgsMultiPolygonXY &multipoly );
249+
static QgsGeometry fromMultiPolygonXY( const QgsMultiPolygonXY &multipoly );
250250
//! Creates a new geometry from a QgsRectangle
251251
static QgsGeometry fromRect( const QgsRectangle &rect );
252252
//! Creates a new multipart geometry from a list of QgsGeometry objects

src/core/geometry/qgsgeometryfactory.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ std::unique_ptr< QgsAbstractGeometry > QgsGeometryFactory::fromPoint( const QgsP
137137
return qgis::make_unique< QgsPoint >( point.x(), point.y() );
138138
}
139139

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

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

167-
std::unique_ptr<QgsPolygon> QgsGeometryFactory::fromPolygon( const QgsPolygonXY &polygon )
167+
std::unique_ptr<QgsPolygon> QgsGeometryFactory::fromPolygonXY( const QgsPolygonXY &polygon )
168168
{
169169
std::unique_ptr< QgsPolygon > poly = qgis::make_unique< QgsPolygon >();
170170

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

190-
std::unique_ptr< QgsMultiPolygon > QgsGeometryFactory::fromMultiPolygon( const QgsMultiPolygonXY &multipoly )
190+
std::unique_ptr< QgsMultiPolygon > QgsGeometryFactory::fromMultiPolygonXY( const QgsMultiPolygonXY &multipoly )
191191
{
192192
std::unique_ptr< QgsMultiPolygon > mp = qgis::make_unique< QgsMultiPolygon >();
193193
for ( int i = 0; i < multipoly.size(); ++i )
194194
{
195-
mp->addGeometry( fromPolygon( multipoly.at( i ) ).release() );
195+
mp->addGeometry( fromPolygonXY( multipoly.at( i ) ).release() );
196196
}
197197
return mp;
198198
}

0 commit comments

Comments
 (0)