diff --git a/data/svg/thenounproject/61698-mountain-biking.svg b/data/svg/thenounproject/61698-mountain-biking.svg
new file mode 100644
index 000000000..eff400f80
--- /dev/null
+++ b/data/svg/thenounproject/61698-mountain-biking.svg
@@ -0,0 +1,79 @@
+
+
\ No newline at end of file
diff --git a/src/apps/marble-maps/MarbleMaps.qrc b/src/apps/marble-maps/MarbleMaps.qrc
index 755ec42d0..9080e5f4d 100644
--- a/src/apps/marble-maps/MarbleMaps.qrc
+++ b/src/apps/marble-maps/MarbleMaps.qrc
@@ -1,87 +1,92 @@
AboutDialog.qml
FlatButton.qml
Completion.qml
MainScreen.qml
SearchResults.qml
SearchField.qml
Search.qml
CircularButton.qml
IconText.qml
PositionButton.qml
BoxedText.qml
ImageButton.qml
WaypointImage.qml
RoutingManager.qml
PlacemarkDialog.qml
SettingsDialog.qml
DeveloperDialog.qml
ProfileSelectorMenu.qml
FloatingMenuButton.qml
RouteEditor.qml
RoutesItem.qml
MenuIcon.qml
NavigationInfoBar.qml
NavigationManager.qml
PositionMarker.qml
Waypoint.qml
CurrentPosition.qml
SidePanel.qml
PublicTransport.qml
+ OutdoorActivities.qml
drawer.svg
../../../data/android/drawable-xxxhdpi/search.png
../../../data/android/drawable-xxxhdpi/ic_menu_black_48dp.png
../../../data/android/drawable-xxxhdpi/gps_fixed.png
../../../data/android/drawable-xxxhdpi/gps_not_fixed.png
../../../data/android/drawable-xxxhdpi/backdrop.png
../../../data/android/drawable-xxxhdpi/border_shadow.png
../../../data/android/drawable-xxxhdpi/map.png
../../../data/android/drawable-xxxhdpi/waypoint.png
../../../data/android/drawable-xxxhdpi/up.png
../../../data/android/drawable-xxxhdpi/down.png
../../../data/android/drawable-xxxhdpi/delete.png
../../../data/android/drawable-xxxhdpi/delete_white.png
../../../data/android/drawable-xxxhdpi/ic_close_black_18dp.png
../../../data/android/drawable-xxxhdpi/busy_indicator.png
../../../data/android/drawable-xxxhdpi/navigation_blue.png
../../../data/svg/navigation_blue.svg
../../../data/android/drawable-xxxhdpi/circular_menu_backdrop.png
../../../data/android/drawable-xxxhdpi/ic_place.png
../../../data/android/drawable-xxxhdpi/ic_place_arrival.png
../../../data/android/drawable-xxxhdpi/ic_place_departure.png
../../../data/android/drawable-xxxhdpi/ic_place_unknown.png
../../../data/android/drawable-xxxhdpi/ic_place_via.png
../../../data/android/drawable-xxxhdpi/ic_add_black_48dp.png
../../../data/android/drawable-xxxhdpi/ic_settings_black_48dp.png
material-icons/ic_local_gas_station_48px.svg
material-icons/ic_open_in_browser_48px.svg
material-icons/ic_volume_off_48px.svg
material-icons/ic_volume_up_48px.svg
material-icons/ic_directions_48px.svg
../../../data/svg/material/maps/ic_directions_bike_48px.svg
../../../data/svg/material/maps/ic_directions_boat_48px.svg
../../../data/svg/material/maps/ic_directions_bus_48px.svg
../../../data/svg/material/maps/ic_directions_car_48px.svg
../../../data/svg/material/maps/ic_directions_railway_48px.svg
../../../data/svg/material/maps/ic_directions_run_48px.svg
../../../data/svg/material/maps/ic_directions_subway_48px.svg
../../../data/svg/material/maps/ic_directions_walk_48px.svg
../../../data/svg/material/maps/ic_tram_48px.svg
+ ../../../data/svg/thenounproject/204712-hiker.svg
+ ../../../data/svg/thenounproject/61698-mountain-biking.svg
+ ../../../data/svg/thenounproject/101965-inline-skater.svg
+ ../../../data/svg/thenounproject/78374-horse-riding.svg
material-icons/ic_navigation_48px.svg
material-icons/ic_access_time_48px.svg
material-icons/ic_accessible_black_48px.svg
material-icons/ic_network_wifi_black_48px.svg
material-icons/ic_place_black_48px.svg
material-icons/ic_star_24px.svg
material-icons/ic_star_border_24px.svg
material-icons/ic_label_48px.svg
konqi/konqi-app-dev.png
konqi/konqi-dev-qt.png
konqi/konqi-group.png
konqi/konqi-globe.png
konqi/konqi-books.png
RouteProfileRadioButton.qml
MarbleScrollBar.qml
diff --git a/src/apps/marble-maps/OutdoorActivities.qml b/src/apps/marble-maps/OutdoorActivities.qml
new file mode 100644
index 000000000..6a5ea7a32
--- /dev/null
+++ b/src/apps/marble-maps/OutdoorActivities.qml
@@ -0,0 +1,105 @@
+//
+// This file is part of the Marble Virtual Globe.
+//
+// This program is free software licensed under the GNU LGPL. You can
+// find a copy of this license in LICENSE.txt in the top directory of
+// the source code.
+//
+// Copyright 2017 Dennis Nienhüser
+//
+
+import QtQuick 2.6
+import QtQuick.Window 2.2
+import QtQuick.Controls 2.0
+import QtQuick.Layouts 1.3
+
+
+Item {
+ id: root
+
+ implicitHeight: Math.min(0.75 * Screen.height, listView.contentHeight)
+ property var marbleMaps
+
+ ListModel {
+ id: transportModel
+ ListElement {
+ name: qsTr("Walkways")
+ icon: "material/directions-walk.svg"
+ key: "foot"
+ }
+ ListElement {
+ name: qsTr("Hiking Routes")
+ icon: "thenounproject/hiker.svg"
+ key: "hiking"
+ }
+ ListElement {
+ name: qsTr("Bicycle Routes")
+ icon: "material/directions-bike.svg"
+ key: "bicycle"
+ }
+ ListElement {
+ name: qsTr("Mountainbike Routes")
+ icon: "thenounproject/mountain-biking.svg"
+ key: "mountainbike"
+ }
+ ListElement {
+ name: qsTr("Inline Skating Routes")
+ icon: "thenounproject/inline-skater.svg"
+ key: "inline-skates"
+ }
+ ListElement {
+ name: qsTr("Bridleways")
+ icon: "thenounproject/horse-riding.svg"
+ key: "horse"
+ }
+ }
+
+ ListView {
+ id: listView
+ anchors.fill: parent
+ contentWidth: width
+
+ model: transportModel
+ clip: true
+ spacing: Screen.pixelDensity * 2
+
+ delegate: Row {
+ CheckBox {
+ id: control
+ text: name
+
+ checked: root.marbleMaps.isRelationTypeVisible(key)
+
+ contentItem: Row {
+ spacing: Screen.pixelDensity * 1
+
+ Item {
+ height: parent.height
+ width: control.indicator.width + control.spacing
+ }
+
+ Image {
+ source: icon
+ height: parent.height
+ sourceSize.height: height
+ fillMode: Image.PreserveAspectFit
+ }
+
+ Text {
+ height: parent.height
+ text: control.text
+ font: control.font
+ opacity: enabled ? 1.0 : 0.3
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ }
+ }
+
+ onCheckedChanged: {
+ root.marbleMaps.setRelationTypeVisible(key, checked)
+ }
+ }
+ }
+ ScrollBar.vertical: ScrollBar {}
+ }
+}
diff --git a/src/apps/marble-maps/SidePanel.qml b/src/apps/marble-maps/SidePanel.qml
index b485f1ce5..b5142ab04 100644
--- a/src/apps/marble-maps/SidePanel.qml
+++ b/src/apps/marble-maps/SidePanel.qml
@@ -1,107 +1,141 @@
//
// This file is part of the Marble Virtual Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2017 Dennis Nienhüser
//
import QtQuick 2.3
import QtQuick.Controls 2.0
import QtQuick.Window 2.2
import QtQuick.Dialogs 1.2
import org.kde.marble 0.20
Drawer {
id: root
property var marbleMaps
property alias showAccessibility: accessibilityAction.checked
signal aboutActionTriggered()
Settings {
id: settings
property bool showUpdateInfo: Number(value("MarbleMaps", "updateInfoVersion", "0")) < 1
Component.onDestruction: {
settings.setValue("MarbleMaps", "showAccessibility", accessibilityAction.checked ? "true" : "false")
}
}
Column {
id: drawerContent
anchors.fill: parent
spacing: Screen.pixelDensity * 2
Image {
source: "drawer.svg"
width: parent.width
sourceSize.width: width
fillMode: Image.PreserveAspectFit
}
MenuIcon {
id: publicTransportAction
anchors.leftMargin: Screen.pixelDensity * 2
anchors.rightMargin: anchors.leftMargin
checkable: true
checked: marbleMaps.showPublicTransport
hasSettings: true
text: qsTr("Public Transport")
icon: "qrc:/material/directions-bus.svg"
onTriggered: {
root.close()
root.marbleMaps.showPublicTransport = checked
}
onSettingsTriggered: {
root.close()
publicTransportLoader.source = "PublicTransport.qml"
publicTransportDialog.open()
}
}
+ MenuIcon {
+ id: outdoorActivitiesAction
+ anchors.leftMargin: Screen.pixelDensity * 2
+ anchors.rightMargin: anchors.leftMargin
+
+ checkable: true
+ checked: marbleMaps.showOutdoorActivities
+ hasSettings: true
+ text: qsTr("Outdoor Activities")
+ icon: "qrc:/material/directions-run.svg"
+ onTriggered: {
+ root.close()
+ root.marbleMaps.showOutdoorActivities = checked
+ }
+ onSettingsTriggered: {
+ root.close()
+ outdoorActivitiesLoader.source = "OutdoorActivities.qml"
+ outdoorActivitiesDialog.open()
+ }
+ }
+
MenuIcon {
id: accessibilityAction
anchors.leftMargin: Screen.pixelDensity * 2
anchors.rightMargin: anchors.leftMargin
checkable: true
checked: settings.value("MarbleMaps", "showAccessibility", "false") === "true"
text: qsTr("Accessibility")
icon: "qrc:/material/wheelchair.svg"
onTriggered: root.close()
}
Rectangle {
width: parent.width
height: 1
color: "gray"
}
MenuIcon {
text: qsTr("About Marble Maps…")
anchors.leftMargin: Screen.pixelDensity * 2
anchors.rightMargin: anchors.leftMargin
onTriggered: {
root.close()
root.aboutActionTriggered()
}
}
}
Dialog {
id: publicTransportDialog
title: qsTr("Public Transport")
Loader {
id: publicTransportLoader
onLoaded: {
item.implicitWidth = parent.width
item.marbleMaps = root.marbleMaps
}
}
}
+
+ Dialog {
+ id: outdoorActivitiesDialog
+ title: qsTr("Outdoor Activities")
+
+ Loader {
+ id: outdoorActivitiesLoader
+ onLoaded: {
+ item.implicitWidth = parent.width
+ item.marbleMaps = root.marbleMaps
+ }
+ }
+ }
}
diff --git a/src/lib/marble/declarative/MarbleQuickItem.cpp b/src/lib/marble/declarative/MarbleQuickItem.cpp
index 7369a9e68..ce12c9d83 100644
--- a/src/lib/marble/declarative/MarbleQuickItem.cpp
+++ b/src/lib/marble/declarative/MarbleQuickItem.cpp
@@ -1,1096 +1,1125 @@
//
// This file is part of the Marble Virtual Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2014 Adam Dabrowski
//
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "GeoDataRelation.h"
#include "osm/OsmPlacemarkData.h"
#include "GeoDataDocument.h"
namespace Marble
{
//TODO - move to separate files
class QuickItemSelectionRubber : public AbstractSelectionRubber
{ //TODO: support rubber selection in MarbleQuickItem
public:
QuickItemSelectionRubber();
void show() override { m_visible = true; }
void hide() override { m_visible = false; }
bool isVisible() const override { return m_visible; }
const QRect &geometry() const override { return m_geometry; }
void setGeometry(const QRect &/*geometry*/) override {}
private:
QRect m_geometry;
bool m_visible;
};
//TODO - implement missing functionalities
class MarbleQuickInputHandler : public MarbleDefaultInputHandler
{
public:
MarbleQuickInputHandler(MarbleAbstractPresenter *marblePresenter, MarbleQuickItem *marbleQuick)
: MarbleDefaultInputHandler(marblePresenter)
,m_marbleQuick(marbleQuick)
{
setInertialEarthRotationEnabled(false); //Disabled by default, it's buggy. TODO - fix
}
bool acceptMouse() override
{
return true;
}
void pinch(QPointF center, qreal scale, Qt::GestureState state)
{ //TODO - this whole thing should be moved to MarbleAbstractPresenter
(void)handlePinch(center, scale, state);
}
void handleMouseButtonPressAndHold(const QPoint &position) override
{
m_marbleQuick->reverseGeocoding(position);
}
private Q_SLOTS:
void showLmbMenu(int x, int y) override
{
m_marbleQuick->selectPlacemarkAt(x, y);
}
void showRmbMenu(int, int) override {}
void openItemToolTip() override {}
void setCursor(const QCursor &cursor) override
{
m_marbleQuick->setCursor(cursor);
}
private Q_SLOTS:
void installPluginEventFilter(RenderPlugin *) override {}
private:
bool layersEventFilter(QObject *o, QEvent *e) override
{
return m_marbleQuick->layersEventFilter(o, e);
}
//empty - don't check. It would be invalid with quick items
void checkReleasedMove(QMouseEvent *) override {}
bool handleTouch(QTouchEvent *event) override
{
if (event->touchPoints().count() > 1)
{ //not handling multi-touch at all, let PinchArea or MultiPointTouchArea take care of it
return false;
}
if (event->touchPoints().count() == 1)
{ //handle - but do not accept. I.e. pinchArea still needs to get this
QTouchEvent::TouchPoint p = event->touchPoints().at(0);
if (event->type() == QEvent::TouchBegin)
{
QMouseEvent press(QMouseEvent::MouseButtonPress, p.pos(),
Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
handleMouseEvent(&press);
}
else if (event->type() == QEvent::TouchUpdate)
{
QMouseEvent move(QMouseEvent::MouseMove, p.pos(),
Qt::NoButton, Qt::LeftButton, Qt::NoModifier);
handleMouseEvent(&move);
}
else if (event->type() == QEvent::TouchEnd)
{
QMouseEvent release(QMouseEvent::MouseButtonRelease, p.pos(),
Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
handleMouseEvent(&release);
}
}
return false;
}
AbstractSelectionRubber *selectionRubber() override
{
return &m_selectionRubber;
}
MarbleQuickItem *m_marbleQuick;
QuickItemSelectionRubber m_selectionRubber;
bool m_usePinchArea;
};
class MarbleQuickItemPrivate
{
public:
explicit MarbleQuickItemPrivate(MarbleQuickItem *marble) :
m_marble(marble),
m_model(),
m_map(&m_model),
m_presenter(&m_map),
m_positionVisible(false),
m_currentPosition(marble),
m_inputHandler(&m_presenter, marble),
m_placemarkDelegate(nullptr),
m_placemarkItem(nullptr),
m_placemark(nullptr),
m_reverseGeocoding(&m_model),
m_showScaleBar(false),
m_enabledRelationTypes(GeoDataRelation::RouteFerry |
GeoDataRelation::RouteTrain |
GeoDataRelation::RouteSubway |
GeoDataRelation::RouteTram |
GeoDataRelation::RouteBus |
- GeoDataRelation::RouteTrolleyBus),
- m_showPublicTransport(false)
+ GeoDataRelation::RouteTrolleyBus |
+ GeoDataRelation::RouteHiking),
+ m_showPublicTransport(false),
+ m_showOutdoorActivities(false)
{
m_currentPosition.setName(QObject::tr("Current Location"));
m_relationTypeConverter["road"] = GeoDataRelation::RouteRoad;
m_relationTypeConverter["detour"] = GeoDataRelation::RouteDetour;
m_relationTypeConverter["ferry"] = GeoDataRelation::RouteFerry;
m_relationTypeConverter["train"] = GeoDataRelation::RouteTrain;
m_relationTypeConverter["subway"] = GeoDataRelation::RouteSubway;
m_relationTypeConverter["tram"] = GeoDataRelation::RouteTram;
m_relationTypeConverter["bus"] = GeoDataRelation::RouteBus;
m_relationTypeConverter["trolley-bus"] = GeoDataRelation::RouteTrolleyBus;
m_relationTypeConverter["bicycle"] = GeoDataRelation::RouteBicycle;
m_relationTypeConverter["mountainbike"] = GeoDataRelation::RouteMountainbike;
m_relationTypeConverter["foot"] = GeoDataRelation::RouteFoot;
m_relationTypeConverter["hiking"] = GeoDataRelation::RouteHiking;
m_relationTypeConverter["horse"] = GeoDataRelation::RouteHorse;
m_relationTypeConverter["inline-skates"] = GeoDataRelation::RouteInlineSkates;
m_relationTypeConverter["downhill"] = GeoDataRelation::RouteSkiDownhill;
m_relationTypeConverter["ski-nordic"] = GeoDataRelation::RouteSkiNordic;
m_relationTypeConverter["skitour"] = GeoDataRelation::RouteSkitour;
m_relationTypeConverter["sled"] = GeoDataRelation::RouteSled;
}
void updateVisibleRoutes();
private:
MarbleQuickItem *m_marble;
friend class MarbleQuickItem;
MarbleModel m_model;
MarbleMap m_map;
MarbleAbstractPresenter m_presenter;
bool m_positionVisible;
Placemark m_currentPosition;
MarbleQuickInputHandler m_inputHandler;
QQmlComponent* m_placemarkDelegate;
QQuickItem* m_placemarkItem;
Placemark* m_placemark;
ReverseGeocodingRunnerManager m_reverseGeocoding;
bool m_showScaleBar;
QMap m_relationTypeConverter;
GeoDataRelation::RelationTypes m_enabledRelationTypes;
bool m_showPublicTransport;
+ bool m_showOutdoorActivities;
};
MarbleQuickItem::MarbleQuickItem(QQuickItem *parent) : QQuickPaintedItem(parent)
,d(new MarbleQuickItemPrivate(this))
{
setRenderTarget(QQuickPaintedItem::FramebufferObject);
setOpaquePainting(true);
qRegisterMetaType("Placemark*");
for (AbstractFloatItem *item: d->m_map.floatItems()) {
if (item->nameId() == QLatin1String("license")) {
item->setPosition(QPointF(5.0, -10.0));
} else {
item->hide();
}
}
d->m_model.positionTracking()->setTrackVisible(false);
connect(&d->m_map, SIGNAL(repaintNeeded(QRegion)), this, SLOT(update()));
connect(this, &MarbleQuickItem::widthChanged, this, &MarbleQuickItem::resizeMap);
connect(this, &MarbleQuickItem::heightChanged, this, &MarbleQuickItem::resizeMap);
connect(&d->m_map, &MarbleMap::visibleLatLonAltBoxChanged, this, &MarbleQuickItem::updatePositionVisibility);
connect(&d->m_map, &MarbleMap::visibleLatLonAltBoxChanged, this, &MarbleQuickItem::visibleLatLonAltBoxChanged);
connect(&d->m_map, &MarbleMap::radiusChanged, this, &MarbleQuickItem::radiusChanged);
connect(&d->m_map, &MarbleMap::radiusChanged, this, &MarbleQuickItem::zoomChanged);
connect(&d->m_reverseGeocoding, SIGNAL(reverseGeocodingFinished(GeoDataCoordinates,GeoDataPlacemark)),
this, SLOT(handleReverseGeocoding(GeoDataCoordinates,GeoDataPlacemark)));
setAcceptedMouseButtons(Qt::AllButtons);
installEventFilter(&d->m_inputHandler);
}
void MarbleQuickItem::resizeMap()
{
d->m_map.setSize(qMax(100, int(width())), qMax(100, int(height())));
update();
updatePositionVisibility();
}
void MarbleQuickItem::positionDataStatusChanged(PositionProviderStatus status)
{
bool const positionAvailable = status == PositionProviderStatusAvailable;
emit positionAvailableChanged(positionAvailable);
updatePositionVisibility();
}
void MarbleQuickItem::positionChanged(const GeoDataCoordinates &, GeoDataAccuracy)
{
updatePositionVisibility();
}
void MarbleQuickItem::updatePositionVisibility()
{
updatePlacemarks();
bool isVisible = false;
if ( positionAvailable() ) {
qreal x, y;
bool globeHidesPoint;
bool const valid = d->m_map.viewport()->screenCoordinates(d->m_model.positionTracking()->currentLocation(), x, y, globeHidesPoint);
isVisible = valid && !globeHidesPoint;
}
if ( isVisible != d->m_positionVisible ) {
d->m_positionVisible = isVisible;
emit positionVisibleChanged( isVisible );
}
}
void MarbleQuickItem::updateCurrentPosition(const GeoDataCoordinates &coordinates)
{
d->m_currentPosition.placemark().setCoordinate(coordinates);
emit currentPositionChanged(&d->m_currentPosition);
}
void MarbleQuickItem::updatePlacemarks()
{
if (!d->m_placemarkDelegate || !d->m_placemark) {
return;
}
if (!d->m_placemarkItem) {
QQmlContext * context = new QQmlContext(qmlContext(d->m_placemarkDelegate));
QObject * component = d->m_placemarkDelegate->create(context);
d->m_placemarkItem = qobject_cast( component );
if (d->m_placemarkItem) {
d->m_placemarkItem->setParentItem( this );
d->m_placemarkItem->setProperty("placemark", QVariant::fromValue(d->m_placemark));
} else {
delete component;
return;
}
}
qreal x = 0;
qreal y = 0;
const bool visible = d->m_map.viewport()->screenCoordinates(d->m_placemark->placemark().coordinate(), x, y);
d->m_placemarkItem->setVisible(visible);
if (visible) {
d->m_placemarkItem->setProperty("xPos", QVariant(x));
d->m_placemarkItem->setProperty("yPos", QVariant(y));
}
}
void MarbleQuickItem::handleReverseGeocoding(const GeoDataCoordinates &coordinates, const GeoDataPlacemark &placemark)
{
if (d->m_placemark && d->m_placemark->placemark().coordinate() == coordinates) {
d->m_placemark->setGeoDataPlacemark(placemark);
updatePlacemarks();
}
}
void MarbleQuickItem::paint(QPainter *painter)
{ //TODO - much to be done here still, i.e paint !enabled version
QPaintDevice *paintDevice = painter->device();
QRect rect = contentsBoundingRect().toRect();
painter->end();
{
GeoPainter geoPainter(paintDevice, d->m_map.viewport(), d->m_map.mapQuality());
d->m_map.paint(geoPainter, rect);
}
painter->begin(paintDevice);
}
void MarbleQuickItem::classBegin()
{
}
void MarbleQuickItem::componentComplete()
{
}
int MarbleQuickItem::mapWidth() const
{
return d->m_map.width();
}
int MarbleQuickItem::mapHeight() const
{
return d->m_map.height();
}
bool MarbleQuickItem::showFrameRate() const
{
return d->m_map.showFrameRate();
}
MarbleQuickItem::Projection MarbleQuickItem::projection() const
{
return Projection(d->m_map.projection());
}
QString MarbleQuickItem::mapThemeId() const
{
return d->m_map.mapThemeId();
}
bool MarbleQuickItem::showAtmosphere() const
{
return d->m_map.showAtmosphere();
}
bool MarbleQuickItem::showCompass() const
{
return d->m_map.showCompass();
}
bool MarbleQuickItem::showClouds() const
{
return d->m_map.showClouds();
}
bool MarbleQuickItem::showCrosshairs() const
{
return d->m_map.showCrosshairs();
}
bool MarbleQuickItem::showGrid() const
{
return d->m_map.showGrid();
}
bool MarbleQuickItem::showOverviewMap() const
{
return d->m_map.showOverviewMap();
}
bool MarbleQuickItem::showOtherPlaces() const
{
return d->m_map.showOtherPlaces();
}
bool MarbleQuickItem::showScaleBar() const
{
return d->m_showScaleBar;
}
bool MarbleQuickItem::showBackground() const
{
return d->m_map.showBackground();
}
bool MarbleQuickItem::showPositionMarker() const
{
QList plugins = d->m_map.renderPlugins();
for (const RenderPlugin * plugin: plugins) {
if (plugin->nameId() == QLatin1String("positionMarker")) {
return plugin->visible();
}
}
return false;
}
bool MarbleQuickItem::showPublicTransport() const
{
return d->m_showPublicTransport;
}
+ bool MarbleQuickItem::showOutdoorActivities() const
+ {
+ return d->m_showOutdoorActivities;
+ }
+
QString MarbleQuickItem::positionProvider() const
{
if ( d->m_model.positionTracking()->positionProviderPlugin() ) {
return d->m_model.positionTracking()->positionProviderPlugin()->nameId();
}
return QString();
}
MarbleModel* MarbleQuickItem::model()
{
return &d->m_model;
}
const MarbleModel* MarbleQuickItem::model() const
{
return &d->m_model;
}
MarbleMap* MarbleQuickItem::map()
{
return &d->m_map;
}
const MarbleMap* MarbleQuickItem::map() const
{
return &d->m_map;
}
bool MarbleQuickItem::inertialGlobeRotation() const
{
return d->m_inputHandler.inertialEarthRotationEnabled();
}
bool MarbleQuickItem::animationViewContext() const
{
return d->m_map.viewContext() == Animation;
}
QQmlComponent *MarbleQuickItem::placemarkDelegate() const
{
return d->m_placemarkDelegate;
}
void MarbleQuickItem::reverseGeocoding(const QPoint &point)
{
qreal lon, lat;
d->m_map.viewport()->geoCoordinates(point.x(), point.y(), lon, lat);
auto const coordinates = GeoDataCoordinates(lon, lat, 0.0, GeoDataCoordinates::Degree);
delete d->m_placemarkItem;
d->m_placemarkItem = nullptr;
delete d->m_placemark;
d->m_placemark = new Placemark(this);
d->m_placemark->placemark().setCoordinate(coordinates);
d->m_reverseGeocoding.reverseGeocoding(coordinates);
}
qreal MarbleQuickItem::speed() const
{
return d->m_model.positionTracking()->speed();
}
qreal MarbleQuickItem::angle() const
{
bool routeExists = d->m_model.routingManager()->routingModel()->route().distance() != 0.0;
bool onRoute = !d->m_model.routingManager()->routingModel()->deviatedFromRoute();
if ( routeExists && onRoute) {
GeoDataCoordinates curPoint = d->m_model.positionTracking()->positionProviderPlugin()->position();
return d->m_model.routingManager()->routingModel()->route().currentSegment().projectedDirection(curPoint);
} else {
return d->m_model.positionTracking()->direction();
}
}
bool MarbleQuickItem::positionAvailable() const
{
return d->m_model.positionTracking()->status() == PositionProviderStatusAvailable;
}
bool MarbleQuickItem::positionVisible()
{
return d->m_positionVisible;
}
qreal MarbleQuickItem::distanceFromPointToCurrentLocation(const QPoint & position) const
{
if ( positionAvailable() ) {
qreal lon1;
qreal lat1;
d->m_map.viewport()->geoCoordinates(position.x(), position.y(), lon1, lat1, GeoDataCoordinates::Radian );
GeoDataCoordinates currentCoordinates = d->m_model.positionTracking()->currentLocation();
qreal lon2 = currentCoordinates.longitude();
qreal lat2 = currentCoordinates.latitude();
return distanceSphere(lon1, lat1, lon2, lat2) * d->m_model.planetRadius();
}
return 0;
}
qreal MarbleQuickItem::angleFromPointToCurrentLocation( const QPoint & position ) const
{
if ( positionAvailable() ) {
qreal x, y;
PositionTracking const * positionTracking = d->m_model.positionTracking();
map()->viewport()->screenCoordinates( positionTracking->currentLocation(), x, y );
return atan2( y-position.y(), x-position.x() ) * RAD2DEG;
}
return 0;
}
Placemark * MarbleQuickItem::currentPosition() const
{
return &d->m_currentPosition;
}
QPointF MarbleQuickItem::screenCoordinatesFromCoordinate(Coordinate * coordinate) const
{
qreal x;
qreal y;
d->m_map.viewport()->screenCoordinates(coordinate->coordinates(), x, y);
return QPointF(x, y);
}
void MarbleQuickItem::setRadius(int radius)
{
d->m_map.setRadius(radius);
}
void MarbleQuickItem::setZoom(int newZoom, FlyToMode mode)
{
d->m_presenter.setZoom(newZoom, mode);
}
void MarbleQuickItem::setZoomToMaximumLevel()
{
d->m_presenter.setZoom(d->m_map.maximumZoom());
}
void MarbleQuickItem::centerOn(const GeoDataPlacemark& placemark, bool animated)
{
d->m_presenter.centerOn(placemark, animated);
}
void MarbleQuickItem::centerOn(const GeoDataLatLonBox& box, bool animated)
{
d->m_presenter.centerOn(box, animated);
}
void MarbleQuickItem::centerOn(const GeoDataCoordinates &coordinate)
{
GeoDataLookAt target = d->m_presenter.lookAt();
target.setCoordinates(coordinate);
d->m_presenter.flyTo(target, Automatic);
}
void MarbleQuickItem::centerOn(qreal longitude, qreal latitude)
{
d->m_presenter.centerOn(longitude, latitude);
}
void MarbleQuickItem::centerOnCoordinates(qreal longitude, qreal latitude) {
centerOn(longitude, latitude);
}
void MarbleQuickItem::centerOnCurrentPosition()
{
GeoDataCoordinates coordinates = d->m_model.positionTracking()->currentLocation();
if ( coordinates == GeoDataCoordinates() ) {
return;
}
d->m_presenter.centerOn(coordinates, true);
if (d->m_presenter.zoom() < 3000) {
d->m_presenter.setZoom(3500);
}
}
void MarbleQuickItem::selectPlacemarkAt(int x, int y)
{
auto features = d->m_map.whichFeatureAt(QPoint(x, y));
QVector placemarks;
for(auto feature: features) {
if (const auto placemark = geodata_cast(feature)) {
placemarks << placemark;
}
}
for(auto placemark: placemarks) {
if (d->m_placemark && placemark->coordinate() == d->m_placemark->placemark().coordinate()) {
d->m_placemark->deleteLater();
d->m_placemark = nullptr;
} else {
if (d->m_placemark) {
d->m_placemark->deleteLater();
}
d->m_placemark = new Placemark(this);
d->m_placemark->setGeoDataPlacemark(*placemark);
}
delete d->m_placemarkItem;
d->m_placemarkItem = nullptr;
updatePlacemarks();
return;
}
if (d->m_placemark) {
d->m_placemark->deleteLater();
d->m_placemark = nullptr;
delete d->m_placemarkItem;
d->m_placemarkItem = nullptr;
updatePlacemarks();
}
}
void MarbleQuickItem::goHome()
{
d->m_presenter.goHome();
}
void MarbleQuickItem::zoomIn(FlyToMode mode)
{
d->m_presenter.zoomIn(mode);
}
void MarbleQuickItem::zoomOut(FlyToMode mode)
{
d->m_presenter.zoomOut(mode);
}
void MarbleQuickItem::handlePinchStarted(const QPointF &point)
{
pinch(point, 1, Qt::GestureStarted);
}
void MarbleQuickItem::handlePinchFinished(const QPointF &point)
{
pinch(point, 1, Qt::GestureFinished);
}
void MarbleQuickItem::handlePinchUpdated(const QPointF &point, qreal scale)
{
scale = sqrt(sqrt(scale));
scale = qBound(static_cast(0.5), scale, static_cast(2.0));
pinch(point, scale, Qt::GestureUpdated);
}
void MarbleQuickItem::setMapWidth(int mapWidth)
{
if (d->m_map.width() == mapWidth) {
return;
}
d->m_map.setSize(mapWidth, mapHeight());
emit mapWidthChanged(mapWidth);
}
void MarbleQuickItem::setMapHeight(int mapHeight)
{
if (this->mapHeight() == mapHeight) {
return;
}
d->m_map.setSize(mapWidth(), mapHeight);
emit mapHeightChanged(mapHeight);
}
void MarbleQuickItem::setShowFrameRate(bool showFrameRate)
{
if (this->showFrameRate() == showFrameRate) {
return;
}
d->m_map.setShowFrameRate(showFrameRate);
emit showFrameRateChanged(showFrameRate);
}
void MarbleQuickItem::setProjection(Projection projection)
{
if (this->projection() == projection) {
return;
}
d->m_map.setProjection(Marble::Projection(projection));
emit projectionChanged(projection);
}
void MarbleQuickItem::setMapThemeId(const QString& mapThemeId)
{
if (this->mapThemeId() == mapThemeId) {
return;
}
bool const showCompass = d->m_map.showCompass();
bool const showOverviewMap = d->m_map.showOverviewMap();
bool const showOtherPlaces = d->m_map.showOtherPlaces();
bool const showGrid = d->m_map.showGrid();
d->m_map.setMapThemeId(mapThemeId);
// Map themes are allowed to change properties. Enforce ours.
d->m_map.setShowCompass(showCompass);
d->m_map.setShowOverviewMap(showOverviewMap);
d->m_map.setShowOtherPlaces(showOtherPlaces);
d->m_map.setShowGrid(showGrid);
d->m_map.setShowScaleBar(d->m_showScaleBar);
emit mapThemeIdChanged(mapThemeId);
}
void MarbleQuickItem::setShowAtmosphere(bool showAtmosphere)
{
if (this->showAtmosphere() == showAtmosphere) {
return;
}
d->m_map.setShowAtmosphere(showAtmosphere);
emit showAtmosphereChanged(showAtmosphere);
}
void MarbleQuickItem::setShowCompass(bool showCompass)
{
if (this->showCompass() == showCompass) {
return;
}
d->m_map.setShowCompass(showCompass);
emit showCompassChanged(showCompass);
}
void MarbleQuickItem::setShowClouds(bool showClouds)
{
if (this->showClouds() == showClouds) {
return;
}
d->m_map.setShowClouds(showClouds);
emit showCloudsChanged(showClouds);
}
void MarbleQuickItem::setShowCrosshairs(bool showCrosshairs)
{
if (this->showCrosshairs() == showCrosshairs) {
return;
}
d->m_map.setShowCrosshairs(showCrosshairs);
emit showCrosshairsChanged(showCrosshairs);
}
void MarbleQuickItem::setShowGrid(bool showGrid)
{
if (this->showGrid() == showGrid) {
return;
}
d->m_map.setShowGrid(showGrid);
emit showGridChanged(showGrid);
}
void MarbleQuickItem::setShowOverviewMap(bool showOverviewMap)
{
if (this->showOverviewMap() == showOverviewMap) {
return;
}
d->m_map.setShowOverviewMap(showOverviewMap);
emit showOverviewMapChanged(showOverviewMap);
}
void MarbleQuickItem::setShowOtherPlaces(bool showOtherPlaces)
{
if (this->showOtherPlaces() == showOtherPlaces) {
return;
}
d->m_map.setShowOtherPlaces(showOtherPlaces);
emit showOtherPlacesChanged(showOtherPlaces);
}
void MarbleQuickItem::setShowScaleBar(bool showScaleBar)
{
if (d->m_showScaleBar == showScaleBar) {
return;
}
d->m_showScaleBar = showScaleBar;
d->m_map.setShowScaleBar(d->m_showScaleBar);
emit showScaleBarChanged(showScaleBar);
}
void MarbleQuickItem::setShowBackground(bool showBackground)
{
if (this->showBackground() == showBackground) {
return;
}
d->m_map.setShowBackground(showBackground);
emit showBackgroundChanged(showBackground);
}
void MarbleQuickItem::setShowPositionMarker(bool showPositionMarker)
{
if (this->showPositionMarker() == showPositionMarker) {
return;
}
QList plugins = d->m_map.renderPlugins();
for ( RenderPlugin * plugin: plugins ) {
if (plugin->nameId() == QLatin1String("positionMarker")) {
plugin->setVisible(showPositionMarker);
break;
}
}
emit showPositionMarkerChanged(showPositionMarker);
}
void MarbleQuickItem::setShowPublicTransport(bool enabled)
{
if (d->m_showPublicTransport != enabled) {
d->m_showPublicTransport = enabled;
d->updateVisibleRoutes();
emit showPublicTransportChanged(enabled);
}
}
+ void MarbleQuickItem::setShowOutdoorActivities(bool showOutdoorActivities)
+ {
+ if (d->m_showOutdoorActivities != showOutdoorActivities) {
+ d->m_showOutdoorActivities = showOutdoorActivities;
+ d->updateVisibleRoutes();
+ emit showOutdoorActivitiesChanged(showOutdoorActivities);
+ }
+ }
+
void MarbleQuickItem::setPositionProvider(const QString &positionProvider)
{
QString name;
if ( d->m_model.positionTracking()->positionProviderPlugin() ) {
name = d->m_model.positionTracking()->positionProviderPlugin()->nameId();
if ( name == positionProvider ) {
return;
}
}
if ( positionProvider.isEmpty() ) {
d->m_model.positionTracking()->setPositionProviderPlugin( nullptr );
return;
}
QList plugins = d->m_model.pluginManager()->positionProviderPlugins();
for (const PositionProviderPlugin* plugin: plugins) {
if ( plugin->nameId() == positionProvider) {
PositionProviderPlugin * newPlugin = plugin->newInstance();
d->m_model.positionTracking()->setPositionProviderPlugin(newPlugin);
connect(newPlugin, SIGNAL(statusChanged(PositionProviderStatus)), this, SLOT(positionDataStatusChanged(PositionProviderStatus)));
connect(newPlugin, SIGNAL(positionChanged(GeoDataCoordinates,GeoDataAccuracy)), this, SLOT(updateCurrentPosition(GeoDataCoordinates)));
connect(newPlugin, SIGNAL(positionChanged(GeoDataCoordinates,GeoDataAccuracy)), this, SIGNAL(speedChanged()));
connect(newPlugin, SIGNAL(positionChanged(GeoDataCoordinates,GeoDataAccuracy)), this, SIGNAL(angleChanged()));
emit positionProviderChanged(positionProvider);
break;
}
}
}
void MarbleQuickItem::setInertialGlobeRotation(bool inertialGlobeRotation)
{
if (inertialGlobeRotation == d->m_inputHandler.inertialEarthRotationEnabled()) {
return;
}
d->m_inputHandler.setInertialEarthRotationEnabled(inertialGlobeRotation);
emit inertialGlobeRotationChanged(inertialGlobeRotation);
}
void MarbleQuickItem::setAnimationViewContext(bool animationViewContext)
{
d->m_map.setViewContext(animationViewContext ? Animation : Still );
emit inertialGlobeRotationChanged(animationViewContext);
}
void MarbleQuickItem::setPluginSetting(const QString &pluginId, const QString &key, const QString &value)
{
for (RenderPlugin* plugin: d->m_map.renderPlugins()) {
if (plugin->nameId() == pluginId) {
plugin->setSetting(key, value);
}
}
}
void MarbleQuickItem::setPropertyEnabled(const QString &property, bool enabled)
{
d->m_map.setPropertyValue(property, enabled);
}
bool MarbleQuickItem::isPropertyEnabled(const QString &property) const
{
return d->m_map.propertyValue(property);
}
void MarbleQuickItem::setShowRuntimeTrace(bool showRuntimeTrace)
{
d->m_map.setShowRuntimeTrace(showRuntimeTrace);
update();
}
void MarbleQuickItem::setShowDebugPolygons(bool showDebugPolygons)
{
d->m_map.setShowDebugPolygons(showDebugPolygons);
update();
}
void MarbleQuickItem::setShowDebugPlacemarks(bool showDebugPlacemarks)
{
d->m_map.setShowDebugPlacemarks(showDebugPlacemarks);
update();
}
void MarbleQuickItem::setShowDebugBatches(bool showDebugBatches)
{
d->m_map.setShowDebugBatchRender(showDebugBatches);
update();
}
void MarbleQuickItem::setPlacemarkDelegate(QQmlComponent *placemarkDelegate)
{
if (d->m_placemarkDelegate == placemarkDelegate) {
return;
}
delete d->m_placemarkItem;
d->m_placemarkItem = nullptr;
d->m_placemarkDelegate = placemarkDelegate;
emit placemarkDelegateChanged(placemarkDelegate);
}
void MarbleQuickItem::loadSettings()
{
QSettings settings;
settings.beginGroup(QStringLiteral("MarbleQuickItem"));
double lon = settings.value(QStringLiteral("centerLon"), QVariant(0.0)).toDouble();
double lat = settings.value(QStringLiteral("centerLat"), QVariant(0.0)).toDouble();
if (lat == 0.0 && lon == 0.0) {
centerOnCurrentPosition();
} else {
centerOn(lon, lat);
}
int const zoom = settings.value(QStringLiteral("zoom"), QVariant(0)).toInt();
if (zoom > 0) {
setZoom(zoom);
}
- auto const defaultRelationTypes = QStringList() << "ferry" << "train" << "subway" << "tram" << "bus" << "trolley-bus";
+ auto const defaultRelationTypes = QStringList() << "ferry" << "train" << "subway" << "tram" << "bus" << "trolley-bus" << "hiking";
auto const visibleRelationTypes = settings.value(QStringLiteral("visibleRelationTypes"), defaultRelationTypes).toStringList();
d->m_enabledRelationTypes = GeoDataRelation::UnknownType;
for (auto const &route: visibleRelationTypes) {
d->m_enabledRelationTypes |= d->m_relationTypeConverter.value(route, GeoDataRelation::UnknownType);
}
setShowPublicTransport(settings.value(QStringLiteral("showPublicTransport"), false).toBool());
settings.endGroup();
d->m_model.routingManager()->readSettings();
d->m_model.bookmarkManager()->loadFile(QStringLiteral("bookmarks/bookmarks.kml"));
d->m_model.bookmarkManager()->setShowBookmarks(true);
d->updateVisibleRoutes();
}
void MarbleQuickItem::writeSettings()
{
QSettings settings;
settings.beginGroup(QStringLiteral("MarbleQuickItem"));
settings.setValue(QStringLiteral("centerLon"), QVariant(d->m_map.centerLongitude()));
settings.setValue(QStringLiteral("centerLat"), QVariant(d->m_map.centerLatitude()));
settings.setValue(QStringLiteral("zoom"), QVariant(zoom()));
QStringList enabledRoutes;
QMap relationConverter;
for (auto iter = d->m_relationTypeConverter.cbegin(), end = d->m_relationTypeConverter.cend(); iter != end; ++iter) {
relationConverter[iter.value()] = iter.key();
}
for (auto iter = relationConverter.cbegin(), end = relationConverter.cend(); iter != end; ++iter) {
if (d->m_enabledRelationTypes & iter.key()) {
enabledRoutes << iter.value();
}
}
settings.setValue(QStringLiteral("visibleRelationTypes"), enabledRoutes);
settings.setValue(QStringLiteral("showPublicTransport"), d->m_showPublicTransport);
settings.endGroup();
d->m_model.routingManager()->writeSettings();
}
void MarbleQuickItem::reloadTiles()
{
d->m_map.reload();
}
void MarbleQuickItem::highlightRouteRelation(qint64 osmId, bool enabled)
{
d->m_map.highlightRouteRelation(osmId, enabled);
}
void MarbleQuickItem::setRelationTypeVisible(const QString &relationType, bool visible)
{
auto const relation = d->m_relationTypeConverter.value(relationType, GeoDataRelation::UnknownType);
if (visible) {
d->m_enabledRelationTypes |= relation;
} else {
d->m_enabledRelationTypes &= ~relation;
}
d->updateVisibleRoutes();
}
bool MarbleQuickItem::isRelationTypeVisible(const QString &relationType) const
{
auto const relation = d->m_relationTypeConverter.value(relationType, GeoDataRelation::UnknownType);
return d->m_enabledRelationTypes & relation;
}
QObject *MarbleQuickItem::getEventFilter() const
{ //We would want to install the same event filter for abstract layer QuickItems such as PinchArea
return &d->m_inputHandler;
}
void MarbleQuickItem::pinch(const QPointF& center, qreal scale, Qt::GestureState state)
{
d->m_inputHandler.pinch(center, scale, state);
}
MarbleInputHandler *MarbleQuickItem::inputHandler()
{
return &d->m_inputHandler;
}
int MarbleQuickItem::radius() const
{
return d->m_map.radius();
}
int MarbleQuickItem::zoom() const
{
return d->m_presenter.logzoom();
}
bool MarbleQuickItem::layersEventFilter(QObject *, QEvent *)
{ //Does nothing, but can be reimplemented in a subclass
return false;
}
QuickItemSelectionRubber::QuickItemSelectionRubber() :
m_visible(false)
{
// nothing to do
}
void MarbleQuickItemPrivate::updateVisibleRoutes()
{
GeoDataRelation::RelationTypes relationTypes = m_enabledRelationTypes;
if (!m_showPublicTransport) {
relationTypes &= ~GeoDataRelation::RouteTrain;
relationTypes &= ~GeoDataRelation::RouteSubway;
relationTypes &= ~GeoDataRelation::RouteTram;
relationTypes &= ~GeoDataRelation::RouteBus;
relationTypes &= ~GeoDataRelation::RouteTrolleyBus;
}
+ if (!m_showOutdoorActivities) {
+ relationTypes &= ~GeoDataRelation::RouteBicycle;
+ relationTypes &= ~GeoDataRelation::RouteMountainbike;
+ relationTypes &= ~GeoDataRelation::RouteFoot;
+ relationTypes &= ~GeoDataRelation::RouteHiking;
+ relationTypes &= ~GeoDataRelation::RouteHorse;
+ relationTypes &= ~GeoDataRelation::RouteInlineSkates;
+ relationTypes &= ~GeoDataRelation::RouteSkiDownhill;
+ relationTypes &= ~GeoDataRelation::RouteSkiNordic;
+ relationTypes &= ~GeoDataRelation::RouteSkitour;
+ relationTypes &= ~GeoDataRelation::RouteSled;
+ }
m_map.setVisibleRelationTypes(relationTypes);
}
}
diff --git a/src/lib/marble/declarative/MarbleQuickItem.h b/src/lib/marble/declarative/MarbleQuickItem.h
index 1deb79050..0074f5b80 100644
--- a/src/lib/marble/declarative/MarbleQuickItem.h
+++ b/src/lib/marble/declarative/MarbleQuickItem.h
@@ -1,247 +1,251 @@
//
// This file is part of the Marble Virtual Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2014 Adam Dabrowski
//
#ifndef MARBLEQUICKITEM_H
#define MARBLEQUICKITEM_H
#include "marble_declarative_export.h"
#include
#include
#include "GeoDataAccuracy.h"
#include "MarbleGlobal.h"
#include "PositionProviderPluginInterface.h"
#include "MarbleMap.h"
#include "Placemark.h"
#include "Coordinate.h"
namespace Marble
{
class GeoDataLatLonBox;
class GeoDataPlacemark;
class MarbleModel;
class MarbleInputHandler;
class MarbleQuickItemPrivate;
//Class is still being developed
class MARBLE_DECLARATIVE_EXPORT MarbleQuickItem : public QQuickPaintedItem
{
Q_OBJECT
Q_ENUMS(Projection)
Q_PROPERTY(int mapWidth READ mapWidth WRITE setMapWidth NOTIFY mapWidthChanged)
Q_PROPERTY(int mapHeight READ mapHeight WRITE setMapHeight NOTIFY mapHeightChanged)
Q_PROPERTY(int zoom READ zoom WRITE setZoom NOTIFY zoomChanged)
Q_PROPERTY(int radius READ radius WRITE setRadius NOTIFY radiusChanged)
Q_PROPERTY(bool showFrameRate READ showFrameRate WRITE setShowFrameRate NOTIFY showFrameRateChanged)
Q_PROPERTY(Projection projection READ projection WRITE setProjection NOTIFY projectionChanged)
Q_PROPERTY(QString mapThemeId READ mapThemeId WRITE setMapThemeId NOTIFY mapThemeIdChanged)
Q_PROPERTY(bool showAtmosphere READ showAtmosphere WRITE setShowAtmosphere NOTIFY showAtmosphereChanged)
Q_PROPERTY(bool showCompass READ showCompass WRITE setShowCompass NOTIFY showCompassChanged)
Q_PROPERTY(bool showClouds READ showClouds WRITE setShowClouds NOTIFY showCloudsChanged)
Q_PROPERTY(bool showCrosshairs READ showCrosshairs WRITE setShowCrosshairs NOTIFY showCrosshairsChanged)
Q_PROPERTY(bool showGrid READ showGrid WRITE setShowGrid NOTIFY showGridChanged)
Q_PROPERTY(bool showOverviewMap READ showOverviewMap WRITE setShowOverviewMap NOTIFY showOverviewMapChanged)
Q_PROPERTY(bool showOtherPlaces READ showOtherPlaces WRITE setShowOtherPlaces NOTIFY showOtherPlacesChanged)
Q_PROPERTY(bool showScaleBar READ showScaleBar WRITE setShowScaleBar NOTIFY showScaleBarChanged)
Q_PROPERTY(bool showBackground READ showBackground WRITE setShowBackground NOTIFY showBackgroundChanged)
Q_PROPERTY(bool showPositionMarker READ showPositionMarker WRITE setShowPositionMarker NOTIFY showPositionMarkerChanged)
Q_PROPERTY(bool showPublicTransport READ showPublicTransport WRITE setShowPublicTransport NOTIFY showPublicTransportChanged)
+ Q_PROPERTY(bool showOutdoorActivities READ showOutdoorActivities WRITE setShowOutdoorActivities NOTIFY showOutdoorActivitiesChanged)
Q_PROPERTY(QString positionProvider READ positionProvider WRITE setPositionProvider NOTIFY positionProviderChanged)
Q_PROPERTY(bool positionAvailable READ positionAvailable NOTIFY positionAvailableChanged)
Q_PROPERTY(bool positionVisible READ positionVisible NOTIFY positionVisibleChanged)
Q_PROPERTY(MarbleMap* marbleMap READ map NOTIFY marbleMapChanged)
Q_PROPERTY(Placemark* currentPosition READ currentPosition NOTIFY currentPositionChanged)
Q_PROPERTY(qreal speed READ speed NOTIFY speedChanged)
Q_PROPERTY(qreal angle READ angle NOTIFY angleChanged)
Q_PROPERTY(bool inertialGlobeRotation READ inertialGlobeRotation WRITE setInertialGlobeRotation NOTIFY inertialGlobeRotationChanged)
Q_PROPERTY(bool animationViewContext READ animationViewContext WRITE setAnimationViewContext NOTIFY animationViewContextChanged)
Q_PROPERTY(QQmlComponent* placemarkDelegate READ placemarkDelegate WRITE setPlacemarkDelegate NOTIFY placemarkDelegateChanged)
public:
explicit MarbleQuickItem(QQuickItem *parent = 0);
enum Projection{
Spherical = Marble::Spherical,
Equirectangular = Marble::Equirectangular,
Mercator = Marble::Mercator,
Gnomonic = Marble::Gnomonic,
Stereographic = Marble::Stereographic,
LambertAzimuthal = Marble::LambertAzimuthal,
AzimuthalEquidistant = Marble::AzimuthalEquidistant,
VerticalPerspective = Marble::VerticalPerspective
};
MarbleInputHandler *inputHandler();
int zoom() const;
int radius() const;
public Q_SLOTS:
void goHome();
void setZoom(int zoom, FlyToMode mode = Instant);
Q_INVOKABLE void setZoomToMaximumLevel();
void setRadius(int radius);
void centerOn(const GeoDataPlacemark& placemark, bool animated = false);
void centerOn(const GeoDataLatLonBox& box, bool animated = false);
void centerOn(const GeoDataCoordinates& coordinate);
void centerOn(qreal longitude, qreal latitude);
Q_INVOKABLE void centerOnCoordinates(qreal longitude, qreal latitude);
Q_INVOKABLE void centerOnCurrentPosition();
Q_INVOKABLE void selectPlacemarkAt(int x, int y);
void zoomIn(FlyToMode mode = Automatic);
void zoomOut(FlyToMode mode = Automatic);
Q_INVOKABLE void handlePinchStarted(const QPointF &point);
Q_INVOKABLE void handlePinchFinished(const QPointF &point);
Q_INVOKABLE void handlePinchUpdated(const QPointF &point, qreal scale);
void setMapWidth(int mapWidth);
void setMapHeight(int mapHeight);
void setShowFrameRate(bool showFrameRate);
void setProjection(Projection projection);
void setMapThemeId(const QString& mapThemeId);
void setShowAtmosphere(bool showAtmosphere);
void setShowCompass(bool showCompass);
void setShowClouds(bool showClouds);
void setShowCrosshairs(bool showCrosshairs);
void setShowGrid(bool showGrid);
void setShowOverviewMap(bool showOverviewMap);
void setShowOtherPlaces(bool showOtherPlaces);
void setShowScaleBar(bool showScaleBar);
void setShowBackground(bool showBackground);
void setShowPositionMarker(bool showPositionMarker);
void setShowPublicTransport(bool showPublicTransport);
+ void setShowOutdoorActivities(bool showOutdoorActivities);
void setPositionProvider(const QString & positionProvider);
void setInertialGlobeRotation(bool inertialGlobeRotation);
void setAnimationViewContext(bool animationViewContext);
void setPluginSetting(const QString &plugin, const QString &key, const QString &value);
void setPropertyEnabled(const QString &property, bool enabled);
bool isPropertyEnabled(const QString &property) const;
Q_INVOKABLE void setShowRuntimeTrace(bool showRuntimeTrace);
Q_INVOKABLE void setShowDebugPolygons(bool showDebugPolygons);
Q_INVOKABLE void setShowDebugPlacemarks(bool showDebugPlacemarks);
Q_INVOKABLE void setShowDebugBatches(bool showDebugBatches);
void setPlacemarkDelegate(QQmlComponent* placemarkDelegate);
Q_INVOKABLE void loadSettings();
Q_INVOKABLE void writeSettings();
Q_INVOKABLE void reloadTiles();
Q_INVOKABLE void highlightRouteRelation(qint64 osmId, bool enabled);
Q_INVOKABLE void setRelationTypeVisible(const QString &relationType, bool visible);
Q_INVOKABLE bool isRelationTypeVisible(const QString &relationType) const;
public:
void paint(QPainter *painter) override;
// QQmlParserStatus interface
public:
void classBegin() override;
void componentComplete() override;
public:
virtual bool layersEventFilter(QObject *o, QEvent *e);
int mapWidth() const;
int mapHeight() const;
bool showFrameRate() const;
Projection projection() const;
QString mapThemeId() const;
bool showAtmosphere() const;
bool showCompass() const;
bool showClouds() const;
bool showCrosshairs() const;
bool showGrid() const;
bool showOverviewMap() const;
bool showOtherPlaces() const;
bool showScaleBar() const;
bool showBackground() const;
bool showPositionMarker() const;
bool showPublicTransport() const;
+ bool showOutdoorActivities() const;
QString positionProvider() const;
bool positionAvailable() const;
bool positionVisible();
Q_INVOKABLE qreal distanceFromPointToCurrentLocation(const QPoint & position) const;
Q_INVOKABLE qreal angleFromPointToCurrentLocation(const QPoint & position) const;
Placemark* currentPosition() const;
Q_INVOKABLE QPointF screenCoordinatesFromCoordinate(Coordinate * coordinate) const;
qreal speed() const;
qreal angle() const;
MarbleModel* model();
const MarbleModel* model() const;
MarbleMap* map();
const MarbleMap* map() const;
bool inertialGlobeRotation() const;
bool animationViewContext() const;
QQmlComponent* placemarkDelegate() const;
void reverseGeocoding(const QPoint &point);
Q_SIGNALS:
void mapWidthChanged(int mapWidth);
void mapHeightChanged(int mapHeight);
void showFrameRateChanged(bool showFrameRate);
void projectionChanged(Projection projection);
void mapThemeIdChanged(const QString& mapThemeId);
void showAtmosphereChanged(bool showAtmosphere);
void showCompassChanged(bool showCompass);
void showCloudsChanged(bool showClouds);
void showCrosshairsChanged(bool showCrosshairs);
void showGridChanged(bool showGrid);
void showOverviewMapChanged(bool showOverviewMap);
void showOtherPlacesChanged(bool showOtherPlaces);
void showScaleBarChanged(bool showScaleBar);
void showBackgroundChanged(bool showBackground);
void showPositionMarkerChanged(bool showPositionMarker);
void showPublicTransportChanged(bool showPublicTransport);
+ void showOutdoorActivitiesChanged(bool showOutdoorActivities);
void positionProviderChanged(const QString & positionProvider);
void positionAvailableChanged(bool positionAvailable);
void positionVisibleChanged(bool positionVisible);
void marbleMapChanged();
void visibleLatLonAltBoxChanged();
void currentPositionChanged(Placemark* currentPosition);
void angleChanged();
void speedChanged();
void zoomChanged();
void radiusChanged(int radius);
void inertialGlobeRotationChanged(bool inertialGlobeRotation);
void animationViewContextChanged(bool animationViewContext);
void placemarkDelegateChanged(QQmlComponent* placemarkDelegate);
protected:
QObject *getEventFilter() const;
void pinch(const QPointF& center, qreal scale, Qt::GestureState state);
private Q_SLOTS:
void resizeMap();
void positionDataStatusChanged(PositionProviderStatus status);
void positionChanged(const GeoDataCoordinates &, GeoDataAccuracy);
void updatePositionVisibility();
void updateCurrentPosition(const GeoDataCoordinates & coordinates);
void updatePlacemarks();
void handleReverseGeocoding(const GeoDataCoordinates &coordinates, const GeoDataPlacemark &placemark);
private:
typedef QSharedPointer MarbleQuickItemPrivatePtr;
MarbleQuickItemPrivatePtr d;
friend class MarbleQuickItemPrivate;
};
}
#endif // MARBLEQUICKITEM_H