File tree 1 file changed +14
-11
lines changed
1 file changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -223,17 +223,20 @@ QgsGeometry QgsGeometry::fromMultiPolygonXY( const QgsMultiPolygonXY &multipoly
223
223
224
224
QgsGeometry QgsGeometry::fromRect ( const QgsRectangle &rect )
225
225
{
226
- QgsPolylineXY ring;
227
- ring.append ( QgsPointXY ( rect.xMinimum (), rect.yMinimum () ) );
228
- ring.append ( QgsPointXY ( rect.xMaximum (), rect.yMinimum () ) );
229
- ring.append ( QgsPointXY ( rect.xMaximum (), rect.yMaximum () ) );
230
- ring.append ( QgsPointXY ( rect.xMinimum (), rect.yMaximum () ) );
231
- ring.append ( QgsPointXY ( rect.xMinimum (), rect.yMinimum () ) );
232
-
233
- QgsPolygonXY polygon;
234
- polygon.append ( ring );
235
-
236
- return fromPolygonXY ( polygon );
226
+ std::unique_ptr< QgsLineString > ext = qgis::make_unique< QgsLineString >(
227
+ QVector< double >() << rect.xMinimum ()
228
+ << rect.xMaximum ()
229
+ << rect.xMaximum ()
230
+ << rect.xMinimum ()
231
+ << rect.xMinimum (),
232
+ QVector< double >() << rect.yMinimum ()
233
+ << rect.yMinimum ()
234
+ << rect.yMaximum ()
235
+ << rect.yMaximum ()
236
+ << rect.yMinimum () );
237
+ std::unique_ptr< QgsPolygon > polygon = qgis::make_unique< QgsPolygon >();
238
+ polygon->setExteriorRing ( ext.release () );
239
+ return QgsGeometry ( std::move ( polygon ) );
237
240
}
238
241
239
242
QgsGeometry QgsGeometry::collectGeometry ( const QVector< QgsGeometry > &geometries )
You can’t perform that action at this time.
0 commit comments