summaryrefslogtreecommitdiff
path: root/src/location/labs/qsg/qmapcircleobjectqsg.cpp
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2018-12-08 18:45:36 +0100
committerPaolo Angelelli <paolo.angelelli@qt.io>2019-02-01 14:09:48 +0000
commit587b8812c9b2fc7ed7ad4ab35d27114ee98eafc6 (patch)
tree4589a6518d38b504a6941524a959d871cbf2537c /src/location/labs/qsg/qmapcircleobjectqsg.cpp
parent8e923d801b460ccc6fdc92d4a7bc8750410ad042 (diff)
downloadqtlocation-587b8812c9b2fc7ed7ad4ab35d27114ee98eafc6.tar.gz
Introduce QGeoMapObject::geoShape property
In this way MapObjects become a little closer to MapItems, and this property can be used to, for example, center the map on one specific object or object group. Fixes: QTBUG-69640 Change-Id: I4dbead9e670bf5d1eeaccb2bd09d956b8de7da87 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/location/labs/qsg/qmapcircleobjectqsg.cpp')
-rw-r--r--src/location/labs/qsg/qmapcircleobjectqsg.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/location/labs/qsg/qmapcircleobjectqsg.cpp b/src/location/labs/qsg/qmapcircleobjectqsg.cpp
index 269c9ebb..32f3030b 100644
--- a/src/location/labs/qsg/qmapcircleobjectqsg.cpp
+++ b/src/location/labs/qsg/qmapcircleobjectqsg.cpp
@@ -50,12 +50,10 @@ QMapCircleObjectPrivateQSG::QMapCircleObjectPrivateQSG(const QMapCircleObjectPri
: QMapCircleObjectPrivateDefault(other)
{
// Data already cloned by the *Default copy constructor, but necessary
- // update operations triggered by setters overrides
- setCenter(center());
- setRadius(radius());
- setColor(color());
- setBorderColor(borderColor());
- setBorderWidth(borderWidth());
+ // update operations triggered only by setters overrides
+ updateGeometry();
+ if (m_map)
+ emit m_map->sgNodeChanged();
}
QMapCircleObjectPrivateQSG::~QMapCircleObjectPrivateQSG()
@@ -77,7 +75,7 @@ void QMapCircleObjectPrivateQSG::updateCirclePath()
void QMapCircleObjectPrivateQSG::updateGeometry()
{
if (!m_map || m_map->geoProjection().projectionType() != QGeoProjection::ProjectionWebMercator
- || !qIsFinite(m_radius) || !m_center.isValid())
+ || !qIsFinite(radius()) || !center().isValid())
return;
const QGeoProjectionWebMercator &p = static_cast<const QGeoProjectionWebMercator&>(m_map->geoProjection());
@@ -182,7 +180,7 @@ QSGNode *QMapCircleObjectPrivateQSG::updateMapObjectNode(QSGNode *oldNode,
void QMapCircleObjectPrivateQSG::setCenter(const QGeoCoordinate &center)
{
- m_center = center;
+ QMapCircleObjectPrivateDefault::setCenter(center);
updateGeometry();
if (m_map)
emit m_map->sgNodeChanged();
@@ -190,7 +188,7 @@ void QMapCircleObjectPrivateQSG::setCenter(const QGeoCoordinate &center)
void QMapCircleObjectPrivateQSG::setRadius(qreal radius)
{
- m_radius = radius;
+ QMapCircleObjectPrivateDefault::setRadius(radius);
updateGeometry();
if (m_map)
emit m_map->sgNodeChanged();
@@ -198,7 +196,7 @@ void QMapCircleObjectPrivateQSG::setRadius(qreal radius)
void QMapCircleObjectPrivateQSG::setColor(const QColor &color)
{
- m_fillColor = color;
+ QMapCircleObjectPrivateDefault::setColor(color);
updateGeometry();
if (m_map)
emit m_map->sgNodeChanged();
@@ -206,7 +204,7 @@ void QMapCircleObjectPrivateQSG::setColor(const QColor &color)
void QMapCircleObjectPrivateQSG::setBorderColor(const QColor &color)
{
- m_borderColor = color;
+ QMapCircleObjectPrivateDefault::setBorderColor(color);
updateGeometry();
if (m_map)
emit m_map->sgNodeChanged();
@@ -214,7 +212,7 @@ void QMapCircleObjectPrivateQSG::setBorderColor(const QColor &color)
void QMapCircleObjectPrivateQSG::setBorderWidth(qreal width)
{
- m_borderWidth = width;
+ QMapCircleObjectPrivateDefault::setBorderWidth(width);
updateGeometry();
if (m_map)
emit m_map->sgNodeChanged();