summaryrefslogtreecommitdiff
path: root/src/location/declarativemaps
diff options
context:
space:
mode:
Diffstat (limited to 'src/location/declarativemaps')
-rw-r--r--src/location/declarativemaps/qdeclarativepolygonmapitem.cpp4
-rw-r--r--src/location/declarativemaps/qdeclarativepolylinemapitem.cpp16
2 files changed, 7 insertions, 13 deletions
diff --git a/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp b/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp
index f4cdc6bf..23ea5666 100644
--- a/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp
+++ b/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp
@@ -50,6 +50,7 @@
#include <QtPositioning/private/qdoublevector2d_p.h>
#include <QtPositioning/private/qclipperutils_p.h>
+#include <QtPositioning/private/qgeopolygon_p.h>
/* poly2tri triangulator includes */
#include <clip2tri.h>
@@ -318,6 +319,7 @@ QDeclarativePolygonMapItem::QDeclarativePolygonMapItem(QQuickItem *parent)
: QDeclarativeGeoMapItemBase(parent), border_(this), color_(Qt::transparent), dirtyMaterial_(true),
updatingGeometry_(false)
{
+ geopath_ = QGeoPolygonEager();
setFlag(ItemHasContents, true);
QObject::connect(&border_, SIGNAL(colorChanged(QColor)),
this, SLOT(markSourceDirtyAndUpdate()));
@@ -611,7 +613,7 @@ void QDeclarativePolygonMapItem::setGeoShape(const QGeoShape &shape)
if (shape == geopath_)
return;
- geopath_ = shape;
+ geopath_ = QGeoPathEager(shape);
regenerateCache();
geometry_.setPreserveGeometry(true, geopath_.boundingGeoRectangle().topLeft());
borderGeometry_.setPreserveGeometry(true, geopath_.boundingGeoRectangle().topLeft());
diff --git a/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp b/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp
index 2fb3098d..2bed0896 100644
--- a/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp
+++ b/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp
@@ -54,6 +54,7 @@
#include <QtGui/private/qtriangulator_p.h>
#include <QtPositioning/private/qclipperutils_p.h>
+#include <QtPositioning/private/qgeopath_p.h>
#include <array>
QT_BEGIN_NAMESPACE
@@ -738,6 +739,7 @@ bool QGeoMapPolylineGeometry::contains(const QPointF &point) const
QDeclarativePolylineMapItem::QDeclarativePolylineMapItem(QQuickItem *parent)
: QDeclarativeGeoMapItemBase(parent), line_(this), dirtyMaterial_(true), updatingGeometry_(false)
{
+ geopath_ = QGeoPathEager();
setFlag(ItemHasContents, true);
QObject::connect(&line_, SIGNAL(colorChanged(QColor)),
this, SLOT(updateAfterLinePropertiesChanged()));
@@ -806,7 +808,7 @@ void QDeclarativePolylineMapItem::setPath(const QGeoPath &path)
if (geopath_.path() == path.path())
return;
- geopath_ = path;
+ geopath_ = QGeoPathEager(path);
regenerateCache();
geometry_.setPreserveGeometry(true, geopath_.boundingGeoRectangle().topLeft());
markSourceDirtyAndUpdate();
@@ -1135,18 +1137,8 @@ const QGeoShape &QDeclarativePolylineMapItem::geoShape() const
void QDeclarativePolylineMapItem::setGeoShape(const QGeoShape &shape)
{
- if (shape == geopath_)
- return;
-
const QGeoPath geopath(shape); // if shape isn't a path, path will be created as a default-constructed path
- const bool pathHasChanged = geopath.path() != geopath_.path();
- geopath_ = geopath;
-
- regenerateCache();
- geometry_.setPreserveGeometry(true, geopath_.boundingGeoRectangle().topLeft());
- markSourceDirtyAndUpdate();
- if (pathHasChanged)
- emit pathChanged();
+ setPath(geopath);
}
QGeoMap::ItemType QDeclarativePolylineMapItem::itemType() const