summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <[email protected]>2015-10-13 19:59:40 +0200
committerDennis Nienhüser <[email protected]>2015-10-13 19:59:40 +0200
commitbc40d30ceba921ceb47642875d6d7942535d6ce3 (patch)
tree869bd9c729cd19c18d453059b9a003e933852d60
parentacd72bc70a741db255fc6344117736fdf5bb2e59 (diff)
Autumn styling for trees based on date and location
-rw-r--r--src/plugins/runner/osm/OsmNode.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/plugins/runner/osm/OsmNode.cpp b/src/plugins/runner/osm/OsmNode.cpp
index 94b59d5..459b6f5 100644
--- a/src/plugins/runner/osm/OsmNode.cpp
+++ b/src/plugins/runner/osm/OsmNode.cpp
@@ -13,6 +13,10 @@
#include "osm/OsmPresetLibrary.h"
#include "osm/OsmObjectManager.h"
#include <GeoDataPlacemark.h>
+#include <GeoDataStyle.h>
+#include <GeoDataIconStyle.h>
+#include <MarbleDirs.h>
+#include <QDate>
namespace Marble {
@@ -45,6 +49,26 @@ void OsmNode::create(GeoDataDocument *document) const
placemark->setVisualCategory(category);
placemark->setStyle( 0 );
+ if (category == GeoDataFeature::NaturalTree) {
+ qreal const lat = m_coordinates.latitude(GeoDataCoordinates::Degree);
+ if (qAbs(lat) > 15) {
+ /** @todo Should maybe auto-adjust to MarbleClock at some point */
+ QDate const date = QDate::currentDate();
+ bool const southernHemisphere = lat < 0;
+ QDate const autumnStart = QDate(date.year(), southernHemisphere ? 3 : 9, 15);
+ QDate const autumnEnd = QDate(date.year(), southernHemisphere ? 5 : 11, 15);
+ if (date > autumnStart && date < autumnEnd) {
+ GeoDataIconStyle iconStyle = placemark->style()->iconStyle();
+ iconStyle.setIconPath(MarbleDirs::path("bitmaps/osmcarto/symbols/48/individual/tree-29-autumn.png"));
+
+ GeoDataStyle* style = new GeoDataStyle(*placemark->style());
+ style->setIconStyle(iconStyle);
+ placemark->setStyle(style);
+
+ }
+ }
+ }
+
OsmObjectManager::registerId(m_osmData.id());
document->append(placemark);
}