summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Beschow <bbeschow@cs.tu-berlin.de>2016-10-03 11:34:59 (GMT)
committerBernhard Beschow <bbeschow@cs.tu-berlin.de>2016-10-03 13:17:35 (GMT)
commit493ece18986ff3ac9e1904ec3c5f82c91dc645b0 (patch)
tree91dc317331c65b2b10d1bbf299d5e61b50796c94
parentfabf916f54939db7ef5a851bdeab7bc97bfd84bd (diff)
accept GeoDataPlacemark rather than GeoDataFeature
Avoids a few downcasts.
-rw-r--r--src/lib/marble/geodata/graphicsitem/AbstractGeoPolygonGraphicsItem.cpp25
-rw-r--r--src/lib/marble/geodata/graphicsitem/AbstractGeoPolygonGraphicsItem.h8
-rw-r--r--src/lib/marble/geodata/graphicsitem/BuildingGeoPolygonGraphicsItem.cpp105
-rw-r--r--src/lib/marble/geodata/graphicsitem/BuildingGeoPolygonGraphicsItem.h10
-rw-r--r--src/lib/marble/geodata/graphicsitem/GeoLineStringGraphicsItem.cpp12
-rw-r--r--src/lib/marble/geodata/graphicsitem/GeoLineStringGraphicsItem.h3
-rw-r--r--src/lib/marble/geodata/graphicsitem/GeoPointGraphicsItem.cpp10
-rw-r--r--src/lib/marble/geodata/graphicsitem/GeoPointGraphicsItem.h3
-rw-r--r--src/lib/marble/geodata/graphicsitem/GeoPolygonGraphicsItem.cpp33
-rw-r--r--src/lib/marble/geodata/graphicsitem/GeoPolygonGraphicsItem.h8
-rw-r--r--src/lib/marble/geodata/graphicsitem/GeoTrackGraphicsItem.cpp10
-rw-r--r--src/lib/marble/geodata/graphicsitem/GeoTrackGraphicsItem.h7
12 files changed, 114 insertions, 120 deletions
diff --git a/src/lib/marble/geodata/graphicsitem/AbstractGeoPolygonGraphicsItem.cpp b/src/lib/marble/geodata/graphicsitem/AbstractGeoPolygonGraphicsItem.cpp
index 4744aef..b78cc96 100644
--- a/src/lib/marble/geodata/graphicsitem/AbstractGeoPolygonGraphicsItem.cpp
+++ b/src/lib/marble/geodata/graphicsitem/AbstractGeoPolygonGraphicsItem.cpp
@@ -14,28 +14,28 @@
#include "GeoDataPolygon.h"
#include "GeoPainter.h"
#include "GeoDataLatLonAltBox.h"
-#include "ViewportParams.h"
#include "GeoDataStyle.h"
#include "GeoDataIconStyle.h"
#include "GeoDataLineStyle.h"
+#include "GeoDataPlacemark.h"
#include "GeoDataPolyStyle.h"
#include "GeoDataTypes.h"
-#include "GeoDataPlacemark.h"
#include "OsmPlacemarkData.h"
#include "MarbleDebug.h"
+#include "ViewportParams.h"
namespace Marble
{
-AbstractGeoPolygonGraphicsItem::AbstractGeoPolygonGraphicsItem(const GeoDataFeature *feature, const GeoDataPolygon *polygon) :
- GeoGraphicsItem(feature),
+AbstractGeoPolygonGraphicsItem::AbstractGeoPolygonGraphicsItem(const GeoDataPlacemark *placemark, const GeoDataPolygon *polygon) :
+ GeoGraphicsItem(placemark),
m_polygon(polygon),
m_ring(0)
{
}
-AbstractGeoPolygonGraphicsItem::AbstractGeoPolygonGraphicsItem(const GeoDataFeature *feature, const GeoDataLinearRing *ring) :
- GeoGraphicsItem(feature),
+AbstractGeoPolygonGraphicsItem::AbstractGeoPolygonGraphicsItem(const GeoDataPlacemark *placemark, const GeoDataLinearRing *ring) :
+ GeoGraphicsItem(placemark),
m_polygon(0),
m_ring(ring)
{
@@ -137,18 +137,15 @@ QPen AbstractGeoPolygonGraphicsItem::configurePainter(GeoPainter *painter, const
return currentPen;
}
-int AbstractGeoPolygonGraphicsItem::extractElevation(const GeoDataFeature &feature)
+int AbstractGeoPolygonGraphicsItem::extractElevation(const GeoDataPlacemark &placemark)
{
int elevation = 0;
- if (feature.nodeType() == GeoDataTypes::GeoDataPlacemarkType) {
- const GeoDataPlacemark *placemark = static_cast<const GeoDataPlacemark *>(&feature);
- const OsmPlacemarkData &osmData = placemark->osmData();
+ const OsmPlacemarkData &osmData = placemark.osmData();
- const auto tagIter = osmData.findTag(QStringLiteral("ele"));
- if (tagIter != osmData.tagsEnd()) {
- elevation = tagIter.value().toInt();
- }
+ const auto tagIter = osmData.findTag(QStringLiteral("ele"));
+ if (tagIter != osmData.tagsEnd()) {
+ elevation = tagIter.value().toInt();
}
return elevation;
diff --git a/src/lib/marble/geodata/graphicsitem/AbstractGeoPolygonGraphicsItem.h b/src/lib/marble/geodata/graphicsitem/AbstractGeoPolygonGraphicsItem.h
index 220af59..b0c02e9 100644
--- a/src/lib/marble/geodata/graphicsitem/AbstractGeoPolygonGraphicsItem.h
+++ b/src/lib/marble/geodata/graphicsitem/AbstractGeoPolygonGraphicsItem.h
@@ -21,14 +21,14 @@ namespace Marble
{
class GeoDataLinearRing;
+class GeoDataPlacemark;
class GeoDataPolygon;
-class GeoDataFeature;
class MARBLE_EXPORT AbstractGeoPolygonGraphicsItem : public GeoGraphicsItem
{
protected:
- explicit AbstractGeoPolygonGraphicsItem(const GeoDataFeature *feature, const GeoDataPolygon* polygon);
- explicit AbstractGeoPolygonGraphicsItem(const GeoDataFeature *feature, const GeoDataLinearRing* ring);
+ explicit AbstractGeoPolygonGraphicsItem(const GeoDataPlacemark *placemark, const GeoDataPolygon *polygon);
+ explicit AbstractGeoPolygonGraphicsItem(const GeoDataPlacemark *placemark, const GeoDataLinearRing *ring);
public:
virtual const GeoDataLatLonAltBox& latLonAltBox() const;
@@ -41,7 +41,7 @@ protected:
inline
const GeoDataLinearRing *ring() const { return m_ring; }
- static int extractElevation(const GeoDataFeature &feature);
+ static int extractElevation(const GeoDataPlacemark &placemark);
private:
const GeoDataPolygon *const m_polygon;
diff --git a/src/lib/marble/geodata/graphicsitem/BuildingGeoPolygonGraphicsItem.cpp b/src/lib/marble/geodata/graphicsitem/BuildingGeoPolygonGraphicsItem.cpp
index df77493..cf86ea7 100644
--- a/src/lib/marble/geodata/graphicsitem/BuildingGeoPolygonGraphicsItem.cpp
+++ b/src/lib/marble/geodata/graphicsitem/BuildingGeoPolygonGraphicsItem.cpp
@@ -24,12 +24,12 @@
namespace Marble
{
-BuildingGeoPolygonGraphicsItem::BuildingGeoPolygonGraphicsItem(const GeoDataFeature *feature,
+BuildingGeoPolygonGraphicsItem::BuildingGeoPolygonGraphicsItem(const GeoDataPlacemark *placemark,
const GeoDataPolygon *polygon)
- : AbstractGeoPolygonGraphicsItem(feature, polygon)
- , m_buildingHeight(extractBuildingHeight(feature))
- , m_buildingLabel(extractBuildingLabel(feature))
- , m_entries(extractNamedEntries(feature))
+ : AbstractGeoPolygonGraphicsItem(placemark, polygon)
+ , m_buildingHeight(extractBuildingHeight(*placemark))
+ , m_buildingLabel(extractBuildingLabel(*placemark))
+ , m_entries(extractNamedEntries(*placemark))
{
setZValue(this->zValue() + m_buildingHeight);
Q_ASSERT(m_buildingHeight > 0.0);
@@ -40,12 +40,12 @@ BuildingGeoPolygonGraphicsItem::BuildingGeoPolygonGraphicsItem(const GeoDataFeat
setPaintLayers(paintLayers);
}
-BuildingGeoPolygonGraphicsItem::BuildingGeoPolygonGraphicsItem(const GeoDataFeature *feature,
+BuildingGeoPolygonGraphicsItem::BuildingGeoPolygonGraphicsItem(const GeoDataPlacemark *placemark,
const GeoDataLinearRing* ring)
- : AbstractGeoPolygonGraphicsItem(feature, ring)
- , m_buildingHeight(extractBuildingHeight(feature))
- , m_buildingLabel(extractBuildingLabel(feature))
- , m_entries(extractNamedEntries(feature))
+ : AbstractGeoPolygonGraphicsItem(placemark, ring)
+ , m_buildingHeight(extractBuildingHeight(*placemark))
+ , m_buildingLabel(extractBuildingLabel(*placemark))
+ , m_entries(extractNamedEntries(*placemark))
{
setZValue(this->zValue() + m_buildingHeight);
Q_ASSERT(m_buildingHeight > 0.0);
@@ -134,71 +134,64 @@ QPointF BuildingGeoPolygonGraphicsItem::buildingOffset(const QPointF &point, con
return QPointF(shiftX, shiftY);
}
-double BuildingGeoPolygonGraphicsItem::extractBuildingHeight(const GeoDataFeature *feature)
+double BuildingGeoPolygonGraphicsItem::extractBuildingHeight(const GeoDataPlacemark &placemark)
{
double height = 8.0;
- if (feature->nodeType() == GeoDataTypes::GeoDataPlacemarkType) {
- const GeoDataPlacemark *placemark = static_cast<const GeoDataPlacemark *>(feature);
- const OsmPlacemarkData &osmData = placemark->osmData();
- QHash<QString, QString>::const_iterator tagIter;
- if ((tagIter = osmData.findTag(QStringLiteral("height"))) != osmData.tagsEnd()) {
- /** @todo Also parse non-SI units, see https://wiki.openstreetmap.org/wiki/Key:height#Height_of_buildings */
- QString const heightValue = QString(tagIter.value()).remove(QStringLiteral(" meters")).remove(QStringLiteral(" m"));
- bool extracted = false;
- double extractedHeight = heightValue.toDouble(&extracted);
- if (extracted) {
- height = extractedHeight;
- }
- } else if ((tagIter = osmData.findTag(QStringLiteral("building:levels"))) != osmData.tagsEnd()) {
- int const levels = tagIter.value().toInt();
- int const skipLevels = osmData.tagValue(QStringLiteral("building:min_level")).toInt();
- /** @todo Is 35 as an upper bound for the number of levels sane? */
- height = 3.0 * qBound(1, 1+levels-skipLevels, 35);
+ const OsmPlacemarkData &osmData = placemark.osmData();
+
+ QHash<QString, QString>::const_iterator tagIter;
+ if ((tagIter = osmData.findTag(QStringLiteral("height"))) != osmData.tagsEnd()) {
+ /** @todo Also parse non-SI units, see https://wiki.openstreetmap.org/wiki/Key:height#Height_of_buildings */
+ QString const heightValue = QString(tagIter.value()).remove(QStringLiteral(" meters")).remove(QStringLiteral(" m"));
+ bool extracted = false;
+ double extractedHeight = heightValue.toDouble(&extracted);
+ if (extracted) {
+ height = extractedHeight;
}
+ } else if ((tagIter = osmData.findTag(QStringLiteral("building:levels"))) != osmData.tagsEnd()) {
+ int const levels = tagIter.value().toInt();
+ int const skipLevels = osmData.tagValue(QStringLiteral("building:min_level")).toInt();
+ /** @todo Is 35 as an upper bound for the number of levels sane? */
+ height = 3.0 * qBound(1, 1+levels-skipLevels, 35);
}
return qBound(1.0, height, 1000.0);
}
-QString BuildingGeoPolygonGraphicsItem::extractBuildingLabel(const GeoDataFeature *feature)
+QString BuildingGeoPolygonGraphicsItem::extractBuildingLabel(const GeoDataPlacemark &placemark)
{
- if (feature->nodeType() == GeoDataTypes::GeoDataPlacemarkType) {
- const GeoDataPlacemark *placemark = static_cast<const GeoDataPlacemark *>(feature);
+ if (!placemark.name().isEmpty()) {
+ return placemark.name();
+ }
- if (!placemark->name().isEmpty()) {
- return placemark->name();
- }
- const OsmPlacemarkData &osmData = placemark->osmData();
- auto tagIter = osmData.findTag(QStringLiteral("addr:housename"));
- if (tagIter != osmData.tagsEnd()) {
- return tagIter.value();
- }
- tagIter = osmData.findTag(QStringLiteral("addr:housenumber"));
- if (tagIter != osmData.tagsEnd()) {
- return tagIter.value();
- }
+ const OsmPlacemarkData &osmData = placemark.osmData();
+
+ auto tagIter = osmData.findTag(QStringLiteral("addr:housename"));
+ if (tagIter != osmData.tagsEnd()) {
+ return tagIter.value();
+ }
+
+ tagIter = osmData.findTag(QStringLiteral("addr:housenumber"));
+ if (tagIter != osmData.tagsEnd()) {
+ return tagIter.value();
}
return QString();
}
-QVector<BuildingGeoPolygonGraphicsItem::NamedEntry> BuildingGeoPolygonGraphicsItem::extractNamedEntries(const GeoDataFeature *feature)
+QVector<BuildingGeoPolygonGraphicsItem::NamedEntry> BuildingGeoPolygonGraphicsItem::extractNamedEntries(const GeoDataPlacemark &placemark)
{
QVector<NamedEntry> entries;
- if (feature->nodeType() == GeoDataTypes::GeoDataPlacemarkType) {
- const GeoDataPlacemark *placemark = static_cast<const GeoDataPlacemark *>(feature);
-
- const auto end = placemark->osmData().nodeReferencesEnd();
- for (auto iter = placemark->osmData().nodeReferencesBegin(); iter != end; ++iter) {
- const auto tagIter = iter.value().findTag(QStringLiteral("addr:housenumber"));
- if (tagIter != iter.value().tagsEnd()) {
- NamedEntry entry;
- entry.point = iter.key();
- entry.label = tagIter.value();
- entries.push_back(entry);
- }
+ const auto end = placemark.osmData().nodeReferencesEnd();
+ for (auto iter = placemark.osmData().nodeReferencesBegin(); iter != end; ++iter) {
+ const auto tagIter = iter.value().findTag(QStringLiteral("addr:housenumber"));
+ if (tagIter != iter.value().tagsEnd()) {
+ NamedEntry entry;
+ entry.point = iter.key();
+ entry.label = tagIter.value();
+ entries.push_back(entry);
}
}
diff --git a/src/lib/marble/geodata/graphicsitem/BuildingGeoPolygonGraphicsItem.h b/src/lib/marble/geodata/graphicsitem/BuildingGeoPolygonGraphicsItem.h
index c243bfc..8514cc5 100644
--- a/src/lib/marble/geodata/graphicsitem/BuildingGeoPolygonGraphicsItem.h
+++ b/src/lib/marble/geodata/graphicsitem/BuildingGeoPolygonGraphicsItem.h
@@ -22,8 +22,8 @@ namespace Marble
class MARBLE_EXPORT BuildingGeoPolygonGraphicsItem : public AbstractGeoPolygonGraphicsItem
{
public:
- explicit BuildingGeoPolygonGraphicsItem(const GeoDataFeature *feature, const GeoDataPolygon* polygon);
- explicit BuildingGeoPolygonGraphicsItem(const GeoDataFeature *feature, const GeoDataLinearRing* ring);
+ explicit BuildingGeoPolygonGraphicsItem(const GeoDataPlacemark *placemark, const GeoDataPolygon *polygon);
+ explicit BuildingGeoPolygonGraphicsItem(const GeoDataPlacemark *placemark, const GeoDataLinearRing *ring);
public:
virtual void paint(GeoPainter* painter, const ViewportParams *viewport, const QString &layer);
@@ -46,9 +46,9 @@ private:
static QPointF centroid(const QPolygonF &polygon, double &area);
static void screenPolygons(const ViewportParams *viewport, const GeoDataPolygon* polygon,
QVector<QPolygonF*> &polygons, QVector<QPolygonF*> &outlines);
- static double extractBuildingHeight(const GeoDataFeature *feature);
- static QString extractBuildingLabel(const GeoDataFeature *feature);
- static QVector<NamedEntry> extractNamedEntries(const GeoDataFeature *feature);
+ static double extractBuildingHeight(const GeoDataPlacemark &placemark);
+ static QString extractBuildingLabel(const GeoDataPlacemark &placemark);
+ static QVector<NamedEntry> extractNamedEntries(const GeoDataPlacemark &placemark);
private:
const double m_buildingHeight;
diff --git a/src/lib/marble/geodata/graphicsitem/GeoLineStringGraphicsItem.cpp b/src/lib/marble/geodata/graphicsitem/GeoLineStringGraphicsItem.cpp
index bcc72ad..907b8fe 100644
--- a/src/lib/marble/geodata/graphicsitem/GeoLineStringGraphicsItem.cpp
+++ b/src/lib/marble/geodata/graphicsitem/GeoLineStringGraphicsItem.cpp
@@ -10,10 +10,10 @@
#include "GeoLineStringGraphicsItem.h"
-#include "GeoDataFeature.h"
#include "GeoDataLineString.h"
#include "GeoDataLineStyle.h"
#include "GeoDataLabelStyle.h"
+#include "GeoDataPlacemark.h"
#include "GeoDataPolyStyle.h"
#include "GeoPainter.h"
#include "StyleBuilder.h"
@@ -26,12 +26,12 @@
namespace Marble
{
-GeoLineStringGraphicsItem::GeoLineStringGraphicsItem( const GeoDataFeature *feature,
- const GeoDataLineString* lineString )
- : GeoGraphicsItem( feature ),
- m_lineString( lineString )
+GeoLineStringGraphicsItem::GeoLineStringGraphicsItem(const GeoDataPlacemark *placemark,
+ const GeoDataLineString *lineString) :
+ GeoGraphicsItem(placemark),
+ m_lineString(lineString)
{
- QString const category = StyleBuilder::visualCategoryName(feature->visualCategory());
+ QString const category = StyleBuilder::visualCategoryName(placemark->visualCategory());
QStringList paintLayers;
paintLayers << QLatin1String("LineString/") + category + QLatin1String("/outline");
paintLayers << QLatin1String("LineString/") + category + QLatin1String("/inline");
diff --git a/src/lib/marble/geodata/graphicsitem/GeoLineStringGraphicsItem.h b/src/lib/marble/geodata/graphicsitem/GeoLineStringGraphicsItem.h
index 404ee5a..f79a20c 100644
--- a/src/lib/marble/geodata/graphicsitem/GeoLineStringGraphicsItem.h
+++ b/src/lib/marble/geodata/graphicsitem/GeoLineStringGraphicsItem.h
@@ -19,11 +19,12 @@ namespace Marble
{
class GeoDataLineString;
+class GeoDataPlacemark;
class MARBLE_EXPORT GeoLineStringGraphicsItem : public GeoGraphicsItem
{
public:
- explicit GeoLineStringGraphicsItem( const GeoDataFeature *feature, const GeoDataLineString *lineString );
+ explicit GeoLineStringGraphicsItem(const GeoDataPlacemark *placemark, const GeoDataLineString *lineString);
void setLineString( const GeoDataLineString* lineString );
diff --git a/src/lib/marble/geodata/graphicsitem/GeoPointGraphicsItem.cpp b/src/lib/marble/geodata/graphicsitem/GeoPointGraphicsItem.cpp
index c9e46a1..a4bdf5e 100644
--- a/src/lib/marble/geodata/graphicsitem/GeoPointGraphicsItem.cpp
+++ b/src/lib/marble/geodata/graphicsitem/GeoPointGraphicsItem.cpp
@@ -10,7 +10,7 @@
#include "GeoPointGraphicsItem.h"
-#include "GeoDataFeature.h"
+#include "GeoDataPlacemark.h"
#include "GeoDataPoint.h"
#include "GeoPainter.h"
#include "StyleBuilder.h"
@@ -18,12 +18,12 @@
namespace Marble
{
-GeoPointGraphicsItem::GeoPointGraphicsItem(const GeoDataFeature *feature , const GeoDataPoint *point) :
- GeoGraphicsItem(feature),
+GeoPointGraphicsItem::GeoPointGraphicsItem(const GeoDataPlacemark *placemark, const GeoDataPoint *point) :
+ GeoGraphicsItem(placemark),
m_point(point)
{
- if (feature) {
- QString const paintLayer = QLatin1String("Point/") + StyleBuilder::visualCategoryName(feature->visualCategory());
+ if (placemark) {
+ QString const paintLayer = QLatin1String("Point/") + StyleBuilder::visualCategoryName(placemark->visualCategory());
setPaintLayers(QStringList() << paintLayer);
}
}
diff --git a/src/lib/marble/geodata/graphicsitem/GeoPointGraphicsItem.h b/src/lib/marble/geodata/graphicsitem/GeoPointGraphicsItem.h
index cba189f..0c87dc1 100644
--- a/src/lib/marble/geodata/graphicsitem/GeoPointGraphicsItem.h
+++ b/src/lib/marble/geodata/graphicsitem/GeoPointGraphicsItem.h
@@ -17,12 +17,13 @@
namespace Marble
{
+class GeoDataPlacemark;
class GeoDataPoint;
class MARBLE_EXPORT GeoPointGraphicsItem : public GeoGraphicsItem
{
public:
- explicit GeoPointGraphicsItem(const GeoDataFeature *feature, const GeoDataPoint *point);
+ explicit GeoPointGraphicsItem(const GeoDataPlacemark *placemark, const GeoDataPoint *point);
virtual void paint(GeoPainter* painter, const ViewportParams *viewport, const QString &layer);
diff --git a/src/lib/marble/geodata/graphicsitem/GeoPolygonGraphicsItem.cpp b/src/lib/marble/geodata/graphicsitem/GeoPolygonGraphicsItem.cpp
index 085b08d..6496a6c 100644
--- a/src/lib/marble/geodata/graphicsitem/GeoPolygonGraphicsItem.cpp
+++ b/src/lib/marble/geodata/graphicsitem/GeoPolygonGraphicsItem.cpp
@@ -11,46 +11,47 @@
#include "GeoPolygonGraphicsItem.h"
#include "BuildingGeoPolygonGraphicsItem.h"
+#include "GeoDataPlacemark.h"
#include "StyleBuilder.h"
namespace Marble
{
-AbstractGeoPolygonGraphicsItem* GeoPolygonGraphicsItem::createGraphicsItem(const GeoDataFeature *feature, const GeoDataPolygon *polygon)
+AbstractGeoPolygonGraphicsItem *GeoPolygonGraphicsItem::createGraphicsItem(const GeoDataPlacemark *placemark, const GeoDataPolygon *polygon)
{
- if (feature->visualCategory() == GeoDataFeature::Building) {
- return new BuildingGeoPolygonGraphicsItem(feature, polygon);
+ if (placemark->visualCategory() == GeoDataFeature::Building) {
+ return new BuildingGeoPolygonGraphicsItem(placemark, polygon);
}
- return new GeoPolygonGraphicsItem(feature, polygon);
+ return new GeoPolygonGraphicsItem(placemark, polygon);
}
-AbstractGeoPolygonGraphicsItem* GeoPolygonGraphicsItem::createGraphicsItem(const GeoDataFeature *feature, const GeoDataLinearRing *ring)
+AbstractGeoPolygonGraphicsItem *GeoPolygonGraphicsItem::createGraphicsItem(const GeoDataPlacemark *placemark, const GeoDataLinearRing *ring)
{
- if (feature->visualCategory() == GeoDataFeature::Building) {
- return new BuildingGeoPolygonGraphicsItem(feature, ring);
+ if (placemark->visualCategory() == GeoDataFeature::Building) {
+ return new BuildingGeoPolygonGraphicsItem(placemark, ring);
}
- return new GeoPolygonGraphicsItem(feature, ring);
+ return new GeoPolygonGraphicsItem(placemark, ring);
}
-GeoPolygonGraphicsItem::GeoPolygonGraphicsItem(const GeoDataFeature *feature, const GeoDataPolygon *polygon) :
- AbstractGeoPolygonGraphicsItem(feature, polygon)
+GeoPolygonGraphicsItem::GeoPolygonGraphicsItem(const GeoDataPlacemark *placemark, const GeoDataPolygon *polygon) :
+ AbstractGeoPolygonGraphicsItem(placemark, polygon)
{
- const int elevation = extractElevation(*feature);
+ const int elevation = extractElevation(*placemark);
setZValue(zValue() + elevation);
- const GeoDataFeature::GeoDataVisualCategory visualCategory = feature->visualCategory();
+ const GeoDataFeature::GeoDataVisualCategory visualCategory = placemark->visualCategory();
const QString paintLayer = QLatin1String("Polygon/") + StyleBuilder::visualCategoryName(visualCategory);
setPaintLayers(QStringList(paintLayer));
}
-GeoPolygonGraphicsItem::GeoPolygonGraphicsItem(const GeoDataFeature *feature, const GeoDataLinearRing *ring) :
- AbstractGeoPolygonGraphicsItem(feature, ring)
+GeoPolygonGraphicsItem::GeoPolygonGraphicsItem(const GeoDataPlacemark *placemark, const GeoDataLinearRing *ring) :
+ AbstractGeoPolygonGraphicsItem(placemark, ring)
{
- const int elevation = extractElevation(*feature);
+ const int elevation = extractElevation(*placemark);
setZValue(zValue() + elevation);
- const GeoDataFeature::GeoDataVisualCategory visualCategory = feature->visualCategory();
+ const GeoDataFeature::GeoDataVisualCategory visualCategory = placemark->visualCategory();
const QString paintLayer = QLatin1String("Polygon/") + StyleBuilder::visualCategoryName(visualCategory);
setPaintLayers(QStringList(paintLayer));
}
diff --git a/src/lib/marble/geodata/graphicsitem/GeoPolygonGraphicsItem.h b/src/lib/marble/geodata/graphicsitem/GeoPolygonGraphicsItem.h
index b518259..bc93c54 100644
--- a/src/lib/marble/geodata/graphicsitem/GeoPolygonGraphicsItem.h
+++ b/src/lib/marble/geodata/graphicsitem/GeoPolygonGraphicsItem.h
@@ -22,11 +22,11 @@ class GeoDataPolygon;
class MARBLE_EXPORT GeoPolygonGraphicsItem : public AbstractGeoPolygonGraphicsItem
{
public:
- static AbstractGeoPolygonGraphicsItem* createGraphicsItem(const GeoDataFeature *feature, const GeoDataPolygon *polygon);
- static AbstractGeoPolygonGraphicsItem* createGraphicsItem(const GeoDataFeature *feature, const GeoDataLinearRing* ring);
+ static AbstractGeoPolygonGraphicsItem *createGraphicsItem(const GeoDataPlacemark *placemark, const GeoDataPolygon *polygon);
+ static AbstractGeoPolygonGraphicsItem *createGraphicsItem(const GeoDataPlacemark *placemark, const GeoDataLinearRing *ring);
- explicit GeoPolygonGraphicsItem( const GeoDataFeature *feature, const GeoDataPolygon* polygon );
- explicit GeoPolygonGraphicsItem( const GeoDataFeature *feature, const GeoDataLinearRing* ring );
+ explicit GeoPolygonGraphicsItem(const GeoDataPlacemark *placemark, const GeoDataPolygon *polygon);
+ explicit GeoPolygonGraphicsItem(const GeoDataPlacemark *placemark, const GeoDataLinearRing *ring);
};
}
diff --git a/src/lib/marble/geodata/graphicsitem/GeoTrackGraphicsItem.cpp b/src/lib/marble/geodata/graphicsitem/GeoTrackGraphicsItem.cpp
index 289d9e9..23572f9 100644
--- a/src/lib/marble/geodata/graphicsitem/GeoTrackGraphicsItem.cpp
+++ b/src/lib/marble/geodata/graphicsitem/GeoTrackGraphicsItem.cpp
@@ -11,19 +11,19 @@
#include "GeoTrackGraphicsItem.h"
#include "GeoDataLineString.h"
+#include "GeoDataPlacemark.h"
#include "GeoDataTrack.h"
-#include "GeoDataFeature.h"
#include "MarbleDebug.h"
#include "StyleBuilder.h"
using namespace Marble;
-GeoTrackGraphicsItem::GeoTrackGraphicsItem( const GeoDataFeature *feature, const GeoDataTrack *track )
- : GeoLineStringGraphicsItem( feature, track->lineString() )
+GeoTrackGraphicsItem::GeoTrackGraphicsItem(const GeoDataPlacemark *placemark, const GeoDataTrack *track) :
+ GeoLineStringGraphicsItem(placemark, track->lineString())
{
setTrack( track );
- if (feature) {
- QString const paintLayer = QLatin1String("Track/") + StyleBuilder::visualCategoryName(feature->visualCategory());
+ if (placemark) {
+ QString const paintLayer = QLatin1String("Track/") + StyleBuilder::visualCategoryName(placemark->visualCategory());
setPaintLayers(QStringList() << paintLayer);
}
}
diff --git a/src/lib/marble/geodata/graphicsitem/GeoTrackGraphicsItem.h b/src/lib/marble/geodata/graphicsitem/GeoTrackGraphicsItem.h
index e80a610..9c0af4e 100644
--- a/src/lib/marble/geodata/graphicsitem/GeoTrackGraphicsItem.h
+++ b/src/lib/marble/geodata/graphicsitem/GeoTrackGraphicsItem.h
@@ -16,19 +16,20 @@
namespace Marble
{
+class GeoDataPlacemark;
class GeoDataTrack;
class MARBLE_EXPORT GeoTrackGraphicsItem : public GeoLineStringGraphicsItem
{
public:
- explicit GeoTrackGraphicsItem( const GeoDataFeature *feature, const GeoDataTrack *track );
-
- void setTrack( const GeoDataTrack *track );
+ explicit GeoTrackGraphicsItem(const GeoDataPlacemark *placemark, const GeoDataTrack *track);
virtual void paint(GeoPainter *painter, const ViewportParams *viewport, const QString &layer);
private:
+ void setTrack(const GeoDataTrack *track);
+
const GeoDataTrack *m_track;
void update();
};