summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Beschow <bbeschow@cs.tu-berlin.de>2016-09-11 10:25:03 (GMT)
committerBernhard Beschow <bbeschow@cs.tu-berlin.de>2016-09-11 13:07:45 (GMT)
commitf72396cb4cb1879559c42e84431cb20591df2110 (patch)
tree79ddc83ad17a873ea28f4441f33efdab16780ed4
parentc78b2f09485ab9cb2aaae8bca2db7f75dd9396df (diff)
make GeoGraphicsItem::latLonAltBox() purely virtual
GeoGraphicsItem::setLatLonAltBox() wasn't called anywhere, so any subclass not overriding latLonAltBox() had an empty bounding box.
-rw-r--r--src/lib/marble/geodata/graphicsitem/GeoPolygonGraphicsItem.cpp6
-rw-r--r--src/lib/marble/graphicsview/GeoGraphicsItem.cpp10
-rw-r--r--src/lib/marble/graphicsview/GeoGraphicsItem.h8
-rw-r--r--src/lib/marble/graphicsview/GeoGraphicsItem_p.h5
-rw-r--r--src/plugins/render/annotate/SceneGraphicsItem.cpp5
-rw-r--r--src/plugins/render/annotate/SceneGraphicsItem.h5
6 files changed, 14 insertions, 25 deletions
diff --git a/src/lib/marble/geodata/graphicsitem/GeoPolygonGraphicsItem.cpp b/src/lib/marble/geodata/graphicsitem/GeoPolygonGraphicsItem.cpp
index 0c1faff..183190f 100644
--- a/src/lib/marble/geodata/graphicsitem/GeoPolygonGraphicsItem.cpp
+++ b/src/lib/marble/geodata/graphicsitem/GeoPolygonGraphicsItem.cpp
@@ -323,11 +323,9 @@ const GeoDataLatLonAltBox& GeoPolygonGraphicsItem::latLonAltBox() const
{
if( m_polygon ) {
return m_polygon->latLonAltBox();
- } else if ( m_ring ) {
- return m_ring->latLonAltBox();
- } else {
- return GeoGraphicsItem::latLonAltBox();
}
+
+ return m_ring->latLonAltBox();
}
void GeoPolygonGraphicsItem::paint( GeoPainter* painter, const ViewportParams* viewport, const QString &layer ) {
diff --git a/src/lib/marble/graphicsview/GeoGraphicsItem.cpp b/src/lib/marble/graphicsview/GeoGraphicsItem.cpp
index 401db22..7c7c81c 100644
--- a/src/lib/marble/graphicsview/GeoGraphicsItem.cpp
+++ b/src/lib/marble/graphicsview/GeoGraphicsItem.cpp
@@ -66,16 +66,6 @@ const GeoDataFeature* GeoGraphicsItem::feature() const
return d->m_feature;
}
-const GeoDataLatLonAltBox& GeoGraphicsItem::latLonAltBox() const
-{
- return d->m_latLonAltBox;
-}
-
-void GeoGraphicsItem::setLatLonAltBox( const GeoDataLatLonAltBox& latLonAltBox )
-{
- d->m_latLonAltBox = latLonAltBox;
-}
-
void GeoGraphicsItem::setHighlightStyle( const GeoDataStyle::ConstPtr &highlightStyle)
{
/**
diff --git a/src/lib/marble/graphicsview/GeoGraphicsItem.h b/src/lib/marble/graphicsview/GeoGraphicsItem.h
index d1a55c8..9e479a9 100644
--- a/src/lib/marble/graphicsview/GeoGraphicsItem.h
+++ b/src/lib/marble/graphicsview/GeoGraphicsItem.h
@@ -96,15 +96,9 @@ class MARBLE_EXPORT GeoGraphicsItem
/**
* Returns the bounding box covered by the item.
*/
- virtual const GeoDataLatLonAltBox& latLonAltBox() const;
+ virtual const GeoDataLatLonAltBox &latLonAltBox() const = 0;
/**
- * Set the box used to determine if an item is active or inactive. If an empty box is passed
- * the item will be shown in every case.
- */
- void setLatLonAltBox( const GeoDataLatLonAltBox& latLonAltBox );
-
- /**
* Returns the style of item.
*/
GeoDataStyle::ConstPtr style() const;
diff --git a/src/lib/marble/graphicsview/GeoGraphicsItem_p.h b/src/lib/marble/graphicsview/GeoGraphicsItem_p.h
index f2500e0..d13a373 100644
--- a/src/lib/marble/graphicsview/GeoGraphicsItem_p.h
+++ b/src/lib/marble/graphicsview/GeoGraphicsItem_p.h
@@ -11,13 +11,12 @@
#ifndef MARBLE_GEOGRAPHICSITEMPRIVATE_H
#define MARBLE_GEOGRAPHICSITEMPRIVATE_H
+#include "GeoGraphicsItem.h"
// Marble
-#include "GeoDataLatLonAltBox.h"
#include "GeoDataStyle.h"
#include "ViewportParams.h"
#include "StyleBuilder.h"
-#include "GeoGraphicsItem.h"
namespace Marble
{
@@ -29,7 +28,6 @@ class GeoGraphicsItemPrivate
: m_zValue( 0 ),
m_minZoomLevel( 0 ),
m_feature( feature ),
- m_latLonAltBox(),
m_highlighted( false )
{
}
@@ -43,7 +41,6 @@ class GeoGraphicsItemPrivate
int m_minZoomLevel;
const GeoDataFeature *m_feature;
- GeoDataLatLonAltBox m_latLonAltBox;
RenderContext m_renderContext;
GeoDataStyle::ConstPtr m_style;
const StyleBuilder *m_styleBuilder;
diff --git a/src/plugins/render/annotate/SceneGraphicsItem.cpp b/src/plugins/render/annotate/SceneGraphicsItem.cpp
index fb12a12..6bc3780 100644
--- a/src/plugins/render/annotate/SceneGraphicsItem.cpp
+++ b/src/plugins/render/annotate/SceneGraphicsItem.cpp
@@ -35,6 +35,11 @@ SceneGraphicsItem::~SceneGraphicsItem()
// nothing to do
}
+const GeoDataLatLonAltBox &SceneGraphicsItem::latLonAltBox() const
+{
+ return m_placemark->geometry()->latLonAltBox();
+}
+
SceneGraphicsItem::ActionState SceneGraphicsItem::state() const
{
return m_state;
diff --git a/src/plugins/render/annotate/SceneGraphicsItem.h b/src/plugins/render/annotate/SceneGraphicsItem.h
index a74e3f7..78a41e5 100644
--- a/src/plugins/render/annotate/SceneGraphicsItem.h
+++ b/src/plugins/render/annotate/SceneGraphicsItem.h
@@ -90,6 +90,11 @@ public:
};
/**
+ * @copydoc
+ */
+ const GeoDataLatLonAltBox &latLonAltBox() const override;
+
+ /**
* @brief Pure virtual method which is implemented by concrete scene graphic items
* and returns true if the item contains the @p eventPos.
*/