diff --git a/src/lib/marble/CMakeLists.txt b/src/lib/marble/CMakeLists.txt --- a/src/lib/marble/CMakeLists.txt +++ b/src/lib/marble/CMakeLists.txt @@ -477,6 +477,7 @@ install( FILES ${CMAKE_CURRENT_BINARY_DIR}/marble_export.h + ${CMAKE_CURRENT_BINARY_DIR}/declarative/marble_declarative_export.h ${graphicsview_HDRS} ${marble_WebKit} AutoNavigation.h @@ -628,6 +629,9 @@ OsmcSymbol.h + + declarative/MarbleDeclarativePlugin.h + DESTINATION ${INCLUDE_INSTALL_DIR}/marble ) diff --git a/src/lib/marble/declarative/CMakeLists.txt b/src/lib/marble/declarative/CMakeLists.txt --- a/src/lib/marble/declarative/CMakeLists.txt +++ b/src/lib/marble/declarative/CMakeLists.txt @@ -13,6 +13,8 @@ add_library( marbledeclarative SHARED Bookmarks.cpp Coordinate.cpp + GeoItem.cpp + GeoPolylineItem.cpp DeclarativeMapThemeManager.cpp MapThemeModel.cpp MarbleDeclarativeObject.cpp diff --git a/src/lib/marble/declarative/GeoItem.h b/src/lib/marble/declarative/GeoItem.h new file mode 100644 --- /dev/null +++ b/src/lib/marble/declarative/GeoItem.h @@ -0,0 +1,124 @@ +// +// 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 2019 Torsten Rahn +// + +#ifndef MARBLE_DECLARATIVE_GEOITEM_H +#define MARBLE_DECLARATIVE_GEOITEM_H + +#include "GeoDataCoordinates.h" +#include +#include +#include + +/** + * Binds a QML item to a specific geodetic location in screen coordinates. + * + */ +namespace Marble +{ + class MarbleQuickItem; + + class GeoItem : public QQuickItem + { + Q_OBJECT + + Q_PROPERTY( Marble::MarbleQuickItem* map READ map WRITE setMap NOTIFY mapChanged ) + + Q_PROPERTY( qreal longitude READ longitude WRITE setLongitude NOTIFY longitudeChanged ) + Q_PROPERTY( qreal latitude READ latitude WRITE setLatitude NOTIFY latitudeChanged ) + Q_PROPERTY( qreal altitude READ altitude WRITE setAltitude NOTIFY altitudeChanged ) + // Determines whether the item is on the visible side of the globe + Q_PROPERTY( bool observable READ observable NOTIFY observableChanged ) + // We shadow QQuickItem's visible property in order to take the observable into account + Q_PROPERTY( bool visible READ visObservable WRITE setVisObservable NOTIFY visObservableChanged ) + + Q_PROPERTY( qreal x READ readonlyX NOTIFY readonlyXChanged ) + Q_PROPERTY( qreal y READ readonlyY NOTIFY readonlyYChanged ) + + public: + /** Constructor */ + explicit GeoItem( QQuickItem *parent = nullptr ); + + /** Provides access to the longitude (degree) of the coordinate */ + qreal longitude() const; + + /** Change the longitude of the coordinate */ + void setLongitude( qreal lon ); + + /** Provides access to the latitude (degree) of the coordinate */ + qreal latitude() const; + + /** Change the latitude of the coordinate */ + void setLatitude( qreal lat ); + + /** Provides access to the altitude (meters) of the coordinate */ + qreal altitude() const; + + /** Change the altitude of the coordinate */ + void setAltitude( qreal alt ); + + /** Return all coordinates at once */ + Marble::GeoDataCoordinates coordinates() const; + + /** Change all coordinates at once */ + void setCoordinates( const Marble::GeoDataCoordinates &coordinates ); + + /** Query the Marble map backend that this item uses for screen position determination */ + MarbleQuickItem* map() const; + + /** Hook up the GeoItem with Marble's map backend */ + void setMap(MarbleQuickItem* map); + + /** Return whether the item is visible or hidden on the backside of the globe. */ + bool observable() const; + + /** "Shadowed" version for the visible property to take observable into account. */ + bool visObservable() const; + /** "Shadowed" version for the visible() property to take observable into account. */ + void setVisObservable(bool visible); + + /** "Shadowed" version for the x property to disable writing to the property. */ + qreal readonlyX() const + { + return x(); + } + + /** "Shadowed" version for the y property to disable writing to the property. */ + qreal readonlyY() const + { + return y(); + } + + Q_SIGNALS: + void longitudeChanged(); + void latitudeChanged(); + void altitudeChanged(); + + void mapChanged(MarbleQuickItem* map); + + void observableChanged(bool observable); + + void visObservableChanged(bool visible); + + void readonlyXChanged(qreal x); + void readonlyYChanged(qreal y); + + private: + Marble::GeoDataCoordinates m_coordinate; + MarbleQuickItem* m_map; + bool m_observable; + bool m_visible; + qreal m_x; + qreal m_y; + + void updatePosition(); + }; +} + +#endif // MARBLE_DECLARATIVE_GEOITEM_H diff --git a/src/lib/marble/declarative/GeoItem.cpp b/src/lib/marble/declarative/GeoItem.cpp new file mode 100644 --- /dev/null +++ b/src/lib/marble/declarative/GeoItem.cpp @@ -0,0 +1,134 @@ +// +// 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 2019 Torsten Rahn +// + +#include "GeoItem.h" +#include "MarbleQuickItem.h" +#include "Coordinate.h" + +#include "MarbleGlobal.h" + +using Marble::GeoDataCoordinates; +using Marble::EARTH_RADIUS; +using Marble::DEG2RAD; + +namespace Marble +{ + GeoItem::GeoItem(QQuickItem *parent ) : + QQuickItem( parent ), + m_map(nullptr), + m_observable(false), + m_visible(true) + { + } + + qreal GeoItem::longitude() const + { + return m_coordinate.longitude( GeoDataCoordinates::Degree ); + } + + void GeoItem::setLongitude( qreal lon ) + { + m_coordinate.setLongitude( lon, GeoDataCoordinates::Degree ); + updatePosition(); + emit longitudeChanged(); + } + + qreal GeoItem::latitude() const + { + return m_coordinate.latitude( GeoDataCoordinates::Degree ); + } + + void GeoItem::setLatitude( qreal lat ) + { + m_coordinate.setLatitude( lat, GeoDataCoordinates::Degree ); + updatePosition(); + emit latitudeChanged(); + } + + qreal GeoItem::altitude() const + { + return m_coordinate.altitude(); + } + + void GeoItem::setAltitude( qreal alt ) + { + m_coordinate.setAltitude( alt ); + updatePosition(); + emit altitudeChanged(); + } + + GeoDataCoordinates GeoItem::coordinates() const + { + return m_coordinate; + } + + void GeoItem::setCoordinates( const GeoDataCoordinates &coordinates ) + { + m_coordinate = coordinates; + updatePosition(); + } + + MarbleQuickItem *GeoItem::map() const + { + return m_map; + } + + void GeoItem::setMap(MarbleQuickItem *map) + { + if (m_map == map) + return; + + m_map = map; + + connect(m_map, &MarbleQuickItem::visibleLatLonAltBoxChanged, this, [=]() { updatePosition(); }); + emit mapChanged(m_map); + } + + void GeoItem::updatePosition() { + if (m_map) { + QPointF relativePoint = m_map->screenCoordinatesFromGeoDataCoordinates(m_coordinate); + bool observable = !relativePoint.isNull(); + if (observable != m_observable) { + m_observable = observable; + QQuickItem::setVisible(m_visible && m_observable); + emit observableChanged(m_observable); + } + else { + setPosition(QPointF(0.0,0.0)); + QPointF screenPoint = mapFromItem(m_map, relativePoint); + setPosition(screenPoint); + emit readonlyXChanged(readonlyX()) ; + emit readonlyYChanged(readonlyY()) ; + } + } + } + + bool GeoItem::observable() const + { + return m_observable; + } + + bool GeoItem::visObservable() const + { + return m_visible; + } + + void GeoItem::setVisObservable(bool visible) + { + if (m_visible == visible) + return; + + m_visible = visible; + QQuickItem::setVisible(m_visible && m_observable); + emit visObservableChanged(m_visible); + } +} + +#include "moc_GeoItem.cpp" diff --git a/src/lib/marble/declarative/GeoPolylineItem.h b/src/lib/marble/declarative/GeoPolylineItem.h new file mode 100644 --- /dev/null +++ b/src/lib/marble/declarative/GeoPolylineItem.h @@ -0,0 +1,93 @@ +// +// 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 2019 Torsten Rahn +// + +#ifndef MARBLE_DECLARATIVE_GEOPOLYLINEITEM_H +#define MARBLE_DECLARATIVE_GEOPOLYLINEITEM_H + +#include "GeoDataCoordinates.h" +#include "GeoDataLineString.h" +#include +#include +#include + +/** + * Represents a coordinate with the properties of a name and coordinates + * + * @todo: Introduce GeoDataCoordinates + */ +namespace Marble +{ + class MarbleQuickItem; + + class GeoPolylineItem : public QQuickItem + { + Q_OBJECT + + Q_PROPERTY( Marble::MarbleQuickItem* map READ map WRITE setMap NOTIFY mapChanged ) + + Q_PROPERTY( QVariantList geoCoordinates READ geoCoordinates WRITE setGeoCoordinates NOTIFY geoCoordinatesChanged ) + Q_PROPERTY( QVariantList screenCoordinates READ screenCoordinates NOTIFY screenCoordinatesChanged ) + Q_PROPERTY( bool observable READ observable NOTIFY observableChanged ) + Q_PROPERTY( bool tessellate READ tessellate WRITE setTessellate NOTIFY tessellateChanged ) + Q_PROPERTY( QColor strokeColor READ strokeColor WRITE setStrokeColor NOTIFY strokeColorChanged ) + Q_PROPERTY( qreal strokeWidth READ strokeWidth WRITE setStrokeWidth NOTIFY strokeWidthChanged ) + + public: + /** Constructor */ + explicit GeoPolylineItem( QQuickItem *parent = nullptr ); + + MarbleQuickItem* map() const; + + void setMap(MarbleQuickItem* map); + void updatePosition(); + + bool observable() const; + + QVariantList geoCoordinates() const; + + void setGeoCoordinates(const QVariantList & geoCoordinates); + + QVariantList screenCoordinates() const; + + QColor strokeColor() const; + qreal strokeWidth() const; + bool tessellate() const; + + void setStrokeColor(const QColor& strokeColor); + void setStrokeWidth(const qreal strokeWidth); + void setTessellate(bool tessellate); + + Q_SIGNALS: + void mapChanged(MarbleQuickItem* map); + void observableChanged(bool observable); + void geoCoordinatesChanged(); + void screenCoordinatesChanged(); + void strokeColorChanged(QColor strokeColor); + void strokeWidthChanged(qreal strokeWidth); + + void tessellateChanged(bool tessellate); + + protected: + QSGNode * updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) override; + + private: + MarbleQuickItem* m_map; + bool m_observable; + GeoDataLineString m_lineString; + QVariantList m_geoCoordinates; + QVector m_screenPolygons; + QVariantList m_screenCoordinates; + QColor m_strokeColor; + qreal m_strokeWidth; + bool m_tessellate; + }; +} + +#endif // MARBLE_DECLARATIVE_GEOPOLYLINEITEM_H diff --git a/src/lib/marble/declarative/GeoPolylineItem.cpp b/src/lib/marble/declarative/GeoPolylineItem.cpp new file mode 100644 --- /dev/null +++ b/src/lib/marble/declarative/GeoPolylineItem.cpp @@ -0,0 +1,225 @@ +// +// 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 2019 Torsten Rahn +// + +#include "GeoPolylineItem.h" +#include "MarbleQuickItem.h" +#include "Coordinate.h" + +#include +#include +#include +#include +#include + +#include "MarbleGlobal.h" + +using Marble::GeoDataCoordinates; +using Marble::EARTH_RADIUS; +using Marble::DEG2RAD; + +namespace Marble +{ + GeoPolylineItem::GeoPolylineItem(QQuickItem *parent ) : + QQuickItem( parent ), + m_map(nullptr), + m_observable(false), + m_strokeColor(Qt::black), + m_strokeWidth(1), + m_tessellate(true) + { + setFlag(ItemHasContents, true); + } + + MarbleQuickItem * GeoPolylineItem::map() const + { + return m_map; + } + + void GeoPolylineItem::setMap(MarbleQuickItem *map) + { + if (m_map == map) + return; + + m_map = map; + + connect(m_map, &MarbleQuickItem::visibleLatLonAltBoxChanged, this, [=]() { updatePosition(); }); + emit mapChanged(m_map); + } + + void GeoPolylineItem::updatePosition() { + if (m_map) { + qDeleteAll(m_screenPolygons); + m_screenPolygons.clear(); + m_map->screenCoordinatesFromGeoDataLineString(m_lineString, m_screenPolygons); + m_screenCoordinates.clear(); + int i = 0; + for (auto polygon : m_screenPolygons) { + QVariantList m_polyline; + QPolygonF screenPolygon = *polygon; + for (auto node : screenPolygon) { + QVariantMap vmap; + vmap["x"] = node.x(); + vmap["y"] = node.y(); + m_polyline.append(vmap); + } + m_screenCoordinates.insert(i, m_polyline); + ++i; + } + emit screenCoordinatesChanged(); + update(); + } + } + + bool GeoPolylineItem::observable() const + { + return m_observable; + } + + QVariantList GeoPolylineItem::geoCoordinates() const + { + return m_geoCoordinates; + } + + void GeoPolylineItem::setGeoCoordinates(const QVariantList & coordinates) + { + m_lineString.clear(); + m_lineString.setTessellate(m_tessellate); + for(auto item : coordinates) { + QVariantMap map = item.toMap(); + m_lineString << GeoDataCoordinates( + map["lon"].toReal(), + map["lat"].toReal(), + map["alt"].toReal(), + GeoDataCoordinates::Degree + ); + } + + if (m_geoCoordinates == coordinates) + return; + + m_geoCoordinates = coordinates; + emit geoCoordinatesChanged(); + updatePosition(); + } + + QVariantList GeoPolylineItem::screenCoordinates() const + { + return m_screenCoordinates; + } + + QColor GeoPolylineItem::strokeColor() const + { + return m_strokeColor; + } + + qreal GeoPolylineItem::strokeWidth() const + { + return m_strokeWidth; + } + + void GeoPolylineItem::setStrokeColor(const QColor& strokeColor) + { + if (m_strokeColor == strokeColor) + return; + + m_strokeColor = strokeColor; + emit strokeColorChanged(m_strokeColor); + } + + void GeoPolylineItem::setStrokeWidth(const qreal strokeWidth) + { + if (m_strokeWidth == strokeWidth) + return; + + m_strokeWidth = strokeWidth; + emit strokeWidthChanged(m_strokeWidth); + } + + bool GeoPolylineItem::tessellate() const + { + return m_tessellate; + } + + void GeoPolylineItem::setTessellate(bool tessellate) + { + if (m_tessellate == tessellate) + return; + + m_tessellate = tessellate; + emit tessellateChanged(m_tessellate); + } + + QSGNode *GeoPolylineItem::updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData *) + { + qreal const halfWidth = m_strokeWidth; + + delete oldNode; + oldNode = new QSGNode; + + if (m_screenPolygons.isEmpty()) return oldNode; + for(int i = 0; i < m_screenPolygons.length(); ++i) { + QPolygonF * polygon = m_screenPolygons[i]; + QVector normals; + int segmentCount = polygon->size() - 1; + normals.reserve(segmentCount); + for(int i = 0; i < segmentCount; ++i) { + normals << QVector2D(polygon->at(i+1) - polygon->at(i)).normalized(); + } + QSGGeometryNode* lineNode = new QSGGeometryNode; + + QSGGeometry * lineNodeGeo = new QSGGeometry(QSGGeometry::defaultAttributes_Point2D(), segmentCount*4); + lineNodeGeo->setDrawingMode(0x0005); + lineNodeGeo->allocate(segmentCount*4); + + + QSGFlatColorMaterial *material = new QSGFlatColorMaterial; + material->setColor(m_strokeColor); + + lineNode->setGeometry(lineNodeGeo); + lineNode->setFlag(QSGNode::OwnsGeometry); + lineNode->setMaterial(material); + lineNode->setFlag(QSGNode::OwnsMaterial); + + auto points = lineNodeGeo->vertexDataAsPoint2D(); + int k = -1; + for(int i = 0; i < segmentCount; ++i) { + auto const & a = mapFromItem(m_map, polygon->at(i)); + auto const & b = mapFromItem(m_map, polygon->at(i+1)); + auto const & n = normals[i].toPointF(); + points[++k].set(a.x() - halfWidth * n.y(), a.y() + halfWidth * n.x()); + points[++k].set(a.x() + halfWidth * n.y(), a.y() - halfWidth * n.x()); + points[++k].set(b.x() - halfWidth * n.y(), b.y() + halfWidth * n.x()); + points[++k].set(b.x() + halfWidth * n.y(), b.y() - halfWidth * n.x()); + } + oldNode->appendChildNode(lineNode); + } +/* + if (m_nodeGlow) { + if (!m_nodeTexture) { + m_nodeTexture = createNodeTexture(m_color, defaultNodeWidth); + } + + for(int j = 0; j < m_polygon.size(); ++j) { + qreal nodeWidth = qPow(1.0 - qAbs(m_polygon[j].toPointF().x() - width()/2.0) / (width()/2.0), 2.0) * 4.0 * defaultNodeWidth; + + if (nodeWidth > 3.0 * m_strokeWidth) { + QSGSimpleTextureNode *pointNode = new QSGSimpleTextureNode; + pointNode->setTexture(m_nodeTexture); + pointNode->setRect(QRectF(m_polygon[j].toPointF().x() - 0.5 * nodeWidth, m_polygon[j].toPointF().y() - 0.5 * nodeWidth, nodeWidth, nodeWidth)); + oldNode->appendChildNode(pointNode); + } + } + } +*/ + return oldNode; + } +} + +#include "moc_GeoPolylineItem.cpp" diff --git a/src/lib/marble/declarative/MarbleDeclarativePlugin.cpp b/src/lib/marble/declarative/MarbleDeclarativePlugin.cpp --- a/src/lib/marble/declarative/MarbleDeclarativePlugin.cpp +++ b/src/lib/marble/declarative/MarbleDeclarativePlugin.cpp @@ -32,6 +32,8 @@ #include "MarblePlacemarkModel.h" #include "SearchBackend.h" #include "MarbleQuickItem.h" +#include "GeoItem.h" +#include "GeoPolylineItem.h" #include #include @@ -61,6 +63,9 @@ qmlRegisterType(uri, 0, 20, "SearchBackend"); qRegisterMetaType("MarblePlacemarkModel*"); qmlRegisterType(uri, 0, 20, "MarbleItem"); + qmlRegisterType(uri, 0, 20, "GeoItem"); + qmlRegisterType(uri, 0, 20, "GeoPolylineItem"); + qmlRegisterUncreatableType(uri, 1, 0, "MarblePlacemarkModel", QStringLiteral("MarblePlacemarkModel is not instantiable")); diff --git a/src/lib/marble/declarative/MarbleQuickItem.h b/src/lib/marble/declarative/MarbleQuickItem.h --- a/src/lib/marble/declarative/MarbleQuickItem.h +++ b/src/lib/marble/declarative/MarbleQuickItem.h @@ -15,6 +15,7 @@ #include #include #include "GeoDataAccuracy.h" +#include "GeoDataLineString.h" #include "MarbleGlobal.h" #include "PositionProviderPluginInterface.h" #include "MarbleMap.h" @@ -64,6 +65,7 @@ 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(bool animationsEnabled READ animationsEnabled WRITE setAnimationsEnabled NOTIFY animationsEnabledChanged) Q_PROPERTY(QQmlComponent* placemarkDelegate READ placemarkDelegate WRITE setPlacemarkDelegate NOTIFY placemarkDelegateChanged) public: @@ -126,6 +128,7 @@ void setInertialGlobeRotation(bool inertialGlobeRotation); void setAnimationViewContext(bool animationViewContext); + void setAnimationsEnabled(bool animationsEnabled); void setPluginSetting(const QString &plugin, const QString &key, const QString &value); @@ -147,6 +150,7 @@ Q_INVOKABLE void setRelationTypeVisible(const QString &relationType, bool visible); Q_INVOKABLE bool isRelationTypeVisible(const QString &relationType) const; + public: void paint(QPainter *painter) override; @@ -182,6 +186,9 @@ Q_INVOKABLE qreal angleFromPointToCurrentLocation(const QPoint & position) const; Placemark* currentPosition() const; Q_INVOKABLE QPointF screenCoordinatesFromCoordinate(Coordinate * coordinate) const; + Q_INVOKABLE QPointF screenCoordinatesFromGeoDataCoordinates(const GeoDataCoordinates & coordinates) const; + Q_INVOKABLE bool screenCoordinatesFromGeoDataLineString(const GeoDataLineString &lineString, QVector &polygons ) const; + qreal speed() const; qreal angle() const; @@ -193,6 +200,8 @@ bool inertialGlobeRotation() const; bool animationViewContext() const; + bool animationsEnabled() const; + QQmlComponent* placemarkDelegate() const; void reverseGeocoding(const QPoint &point); @@ -228,6 +237,8 @@ void animationViewContextChanged(bool animationViewContext); void placemarkDelegateChanged(QQmlComponent* placemarkDelegate); + void animationsEnabledChanged(bool animationsEnabled); + protected: QObject *getEventFilter() const; void pinch(const QPointF& center, qreal scale, Qt::GestureState state); diff --git a/src/lib/marble/declarative/MarbleQuickItem.cpp b/src/lib/marble/declarative/MarbleQuickItem.cpp --- a/src/lib/marble/declarative/MarbleQuickItem.cpp +++ b/src/lib/marble/declarative/MarbleQuickItem.cpp @@ -228,6 +228,7 @@ setRenderTarget(QQuickPaintedItem::FramebufferObject); setOpaquePainting(true); qRegisterMetaType("Placemark*"); + d->m_map.setMapQualityForViewContext(NormalQuality, Animation); for (AbstractFloatItem *item: d->m_map.floatItems()) { if (item->nameId() == QLatin1String("license")) { @@ -483,6 +484,11 @@ return d->m_map.viewContext() == Animation; } + bool MarbleQuickItem::animationsEnabled() const + { + return d->m_presenter.animationsEnabled(); + } + QQmlComponent *MarbleQuickItem::placemarkDelegate() const { return d->m_placemarkDelegate; @@ -501,6 +507,7 @@ d->m_reverseGeocoding.reverseGeocoding(coordinates); } + qreal MarbleQuickItem::speed() const { return d->m_model.positionTracking()->speed(); @@ -562,10 +569,24 @@ QPointF MarbleQuickItem::screenCoordinatesFromCoordinate(Coordinate * coordinate) const { - qreal x; - qreal y; - d->m_map.viewport()->screenCoordinates(coordinate->coordinates(), x, y); - return QPointF(x, y); + qreal x, y; + bool globeHidesPoint; + bool const valid = d->m_map.viewport()->screenCoordinates(coordinate->coordinates(), x, y, globeHidesPoint); + bool isVisible = valid && !globeHidesPoint; + return isVisible ? QPointF(x, y) : QPointF(); + } + + QPointF MarbleQuickItem::screenCoordinatesFromGeoDataCoordinates(const GeoDataCoordinates & coordinates) const + { + qreal x, y; + bool globeHidesPoint; + d->m_map.viewport()->screenCoordinates(coordinates, x, y, globeHidesPoint); + return !globeHidesPoint ? QPointF(x, y) : QPointF(); + } + + bool MarbleQuickItem::screenCoordinatesFromGeoDataLineString(const GeoDataLineString &lineString, QVector &polygons) const + { + return d->m_map.viewport()->screenCoordinates(lineString, polygons); } void MarbleQuickItem::setRadius(int radius) @@ -926,6 +947,15 @@ emit inertialGlobeRotationChanged(animationViewContext); } + void MarbleQuickItem::setAnimationsEnabled(bool animationsEnabled) + { + if (d->m_presenter.animationsEnabled() == animationsEnabled) + return; + + d->m_presenter.setAnimationsEnabled(animationsEnabled); + emit animationsEnabledChanged(d->m_presenter.animationsEnabled()); + } + void MarbleQuickItem::setPluginSetting(const QString &pluginId, const QString &key, const QString &value) { for (RenderPlugin* plugin: d->m_map.renderPlugins()) {