From cf1895971c5a933a2b390ec3c562eb10a3fb8904 Mon Sep 17 00:00:00 2001 From: DonLakeFlyer Date: Tue, 13 Mar 2018 15:41:24 -0700 Subject: [PATCH] Better performance of KML loading --- src/MissionManager/QGCMapPolygon.cc | 17 ++++++++++++++--- src/MissionManager/QGCMapPolygon.h | 1 + 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/MissionManager/QGCMapPolygon.cc b/src/MissionManager/QGCMapPolygon.cc index 18ae00fdf..8ac2ba1a0 100644 --- a/src/MissionManager/QGCMapPolygon.cc +++ b/src/MissionManager/QGCMapPolygon.cc @@ -258,6 +258,19 @@ void QGCMapPolygon::appendVertex(const QGeoCoordinate& coordinate) emit pathChanged(); } +void QGCMapPolygon::appendVertices(const QList& coordinates) +{ + QList objects; + + foreach (const QGeoCoordinate& coordinate, coordinates) { + objects.append(new QGCQGeoCoordinate(coordinate, this)); + _polygonPath.append(QVariant::fromValue(coordinate)); + } + _polygonModel.append(objects); + emit pathChanged(); +} + + void QGCMapPolygon::_polygonModelDirtyChanged(bool dirty) { if (dirty) { @@ -509,9 +522,7 @@ bool QGCMapPolygon::loadKMLFile(const QString& kmlFile) } clear(); - for (int i=0; i& coordinates); /// Adjust the value for the specified coordinate /// @param vertexIndex Polygon point index to modify (0-based) -- 2.22.0