Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make nCoordinates virtual, and provide shortcuts for some geometry types. The base method which calls coordinateSequence() is quite slow in certain circumstances. Speeds up rendering point layers by ~25%, also likely to speed up lots of geometry heavy operations throughout QGIS Refs #15752
- Loading branch information
1 parent
5798a82
commit 49432a8
Showing
14 changed files
with
50 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -632,6 +632,27 @@ QgsCoordinateSequence QgsCurvePolygon::coordinateSequence() const | |
return mCoordinateSequence; | ||
} | ||
|
||
int QgsCurvePolygon::nCoordinates() const | ||
{ | ||
if ( !mCoordinateSequence.isEmpty() ) | ||
return QgsAbstractGeometry::nCoordinates(); | ||
|
||
int count = 0; | ||
|
||
if ( mExteriorRing ) | ||
{ | ||
count += mExteriorRing->nCoordinates(); | ||
} | ||
|
||
QList<QgsCurve*>::const_iterator it = mInteriorRings.constBegin(); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
nyalldawson
Author
Collaborator
|
||
for ( ; it != mInteriorRings.constEnd(); ++it ) | ||
{ | ||
count += ( *it )->nCoordinates(); | ||
} | ||
|
||
return count; | ||
} | ||
|
||
double QgsCurvePolygon::closestSegment( const QgsPointV2& pt, QgsPointV2& segmentPt, QgsVertexId& vertexAfter, bool* leftOf, double epsilon ) const | ||
{ | ||
if ( !mExteriorRing ) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Is there a reason you are prefering this over
Q_FOREACH
(orfor ( ring : mInteriorRings )
)?