Skip to content

Commit cd6ca37

Browse files
marcoalexbruy
marco
authored andcommitted
Save some time in node tool for geometry export and avoid detachs
1 parent 3a58d8c commit cd6ca37

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/app/qgsmaptoolnodetool.cpp

+8-6
Original file line numberDiff line numberDiff line change
@@ -1164,11 +1164,12 @@ QgsFeature* SelectionFeature::feature()
11641164
void SelectionFeature::createVertexMapPolygon()
11651165
{
11661166
int y = 0;
1167-
if ( !mFeature->geometry()->asPolygon().empty() )
1167+
QgsPolygon polygon = mFeature->geometry()->asPolygon();
1168+
if ( !polygon.empty() )
11681169
{ //polygon
1169-
for ( int i2 = 0; i2 < mFeature->geometry()->asPolygon().size(); i2++ )
1170+
for ( int i2 = 0; i2 < polygon.size(); i2++ )
11701171
{
1171-
QgsPolyline poly = mFeature->geometry()->asPolygon()[i2];
1172+
const QgsPolyline& poly = polygon[i2];
11721173
int i;
11731174
for ( i = 0; i < poly.size(); i++ )
11741175
{
@@ -1191,12 +1192,13 @@ void SelectionFeature::createVertexMapPolygon()
11911192
}
11921193
else //multipolygon
11931194
{
1194-
for ( int i2 = 0; i2 < mFeature->geometry()->asMultiPolygon().size(); i2++ )
1195+
QgsMultiPolygon multiPolygon = mFeature->geometry()->asMultiPolygon();
1196+
for ( int i2 = 0; i2 < multiPolygon.size(); i2++ )
11951197
{ //iterating through polygons
1196-
QgsPolygon poly2 = mFeature->geometry()->asMultiPolygon()[i2];
1198+
const QgsPolygon& poly2 = multiPolygon[i2];
11971199
for ( int i3 = 0; i3 < poly2.size(); i3++ )
11981200
{ //iterating through polygon rings
1199-
QgsPolyline poly = poly2[i3];
1201+
const QgsPolyline& poly = poly2[i3];
12001202
int i;
12011203
for ( i = 0; i < poly.size(); i++ )
12021204
{

0 commit comments

Comments
 (0)