|
QGroundControl
Ground Control Station for MAVLink Drones
|
#include <GeoScene.h>
Inheritance diagram for GeoScene:
Collaboration diagram for GeoScene:Signals | |
| void | cameraChanged () |
| void | sceneOriginChanged () |
| void | terrainScaleChanged () |
| void | content3DChanged () |
Public Member Functions | |
| GeoScene (QObject *parent=nullptr) | |
| GeoMapCamera * | camera () const |
| void | setCamera (GeoMapCamera *camera) |
| QPointF | sceneOrigin () const |
| qreal | verticalScale () const |
| qreal | terrainScale () const |
| void | setTerrainScale (qreal scale) |
| QObject * | content3D () const |
| void | setContent3D (QObject *node) |
| Q_INVOKABLE QVector3D | scenePositionFor (const QGeoCoordinate &coordinate) const |
| Q_INVOKABLE QVariant | screenPositionFor (const QGeoCoordinate &coordinate) const |
| Q_INVOKABLE QGeoCoordinate | centerForCoordinateAtScreenPoint (const QGeoCoordinate &coordinate, const QPointF &screenPos, double centerElevation=qQNaN()) const |
Static Public Attributes | |
| static constexpr double | kReanchorDistance = 50000.0 |
| scene-origin re-anchor threshold (m) | |
Owns the scene-space definition shared by everything GeoMap renders.
Scene coordinates are world mercator meters relative to sceneOrigin. The origin re-anchors to the camera center whenever the camera strays more than kReanchorDistance from it, keeping scene coordinates small enough for the renderer's float precision.
All renderable content (surface patches, and later map items such as vehicles, flight paths, and mission markers) must place itself through this one origin so everything shifts consistently on re-anchor.
Definition at line 34 of file GeoScene.h.
|
explicit |
Definition at line 20 of file GeoScene.cc.
|
inline |
Definition at line 49 of file GeoScene.h.
Referenced by setCamera().
|
signal |
Referenced by setCamera(), GeoMapItem::setScene(), and SurfacePatchModel::setScene().
| QGeoCoordinate GeoScene::centerForCoordinateAtScreenPoint | ( | const QGeoCoordinate & | coordinate, |
| const QPointF & | screenPos, | ||
| double | centerElevation = qQNaN() |
||
| ) | const |
Camera center that places coordinate at screenPos, solved at the coordinate's rendered height (altitude scaled to scene units and the terrain scale, NaN treated as 0) — the inverse of screenPositionFor. centerElevation (true meters, scaled to rendered height internally like altitude) overrides the camera pivot elevation for the solve — pass the terrain elevation at the destination center when the pivot follows terrain; NaN keeps the camera's current value. Invalid coordinate when there is no camera.
Definition at line 100 of file GeoScene.cc.
References GeoMapCamera::centerForCoordinateAtScreenPoint(), and verticalScale().
|
inline |
Container node inside the View3D for map item 3D content (a QQuick3DNode, typed QObject* to keep QtQuick3D out of this header). Items parent their delegate3D instances here.
Definition at line 74 of file GeoScene.h.
|
signal |
Referenced by setContent3D(), and GeoMapItem::setScene().
|
inline |
Until a camera anchors the scene, the origin is the mercator origin (0, 0): results stay well-defined but are not precision-safe far from it. If the camera goes away, the origin retains its last anchor.
Definition at line 56 of file GeoScene.h.
Referenced by SurfacePatchModel::data().
|
signal |
Referenced by FlightPathGeometry::setScene(), GeoMapItem::setScene(), and SurfacePatchModel::setScene().
| QVector3D GeoScene::scenePositionFor | ( | const QGeoCoordinate & | coordinate | ) | const |
Scene position for a geographic coordinate (double math internally; once a camera has anchored the origin the result is origin-relative and small enough for floats). Altitude (true meters, NaN treated as 0) lands on z scaled to scene units.
Definition at line 81 of file GeoScene.cc.
References TileMath::geoToWorld(), and verticalScale().
| QVariant GeoScene::screenPositionFor | ( | const QGeoCoordinate & | coordinate | ) | const |
Screen position (pixels) of a geographic coordinate through the camera, at its rendered height (altitude scaled to scene units and the terrain scale, matching GeoMapItem placement). Invalid QVariant when there is no camera or the point is at or behind the camera plane.
Definition at line 89 of file GeoScene.cc.
References TileMath::geoToWorld(), verticalScale(), and GeoMapCamera::worldToScreen().
| void GeoScene::setCamera | ( | GeoMapCamera * | camera | ) |
Definition at line 22 of file GeoScene.cc.
References camera(), cameraChanged(), and GeoMapCamera::centerChanged().
| void GeoScene::setContent3D | ( | QObject * | node | ) |
Definition at line 62 of file GeoScene.cc.
References content3DChanged().
| void GeoScene::setTerrainScale | ( | qreal | scale | ) |
Definition at line 53 of file GeoScene.cc.
References terrainScaleChanged().
|
inline |
Terrain displacement factor: 1 in 3D, 0 in 2D (map stays flat). Everything placing content by altitude must scale z by it to stay on the rendered surface. Startup mode is 2D, so it starts at 0.
Definition at line 67 of file GeoScene.h.
|
signal |
Referenced by GeoMapItem::setScene(), and setTerrainScale().
| qreal GeoScene::verticalScale | ( | ) | const |
Mercator scale factor at the scene origin: heights and altitudes are true meters, but scene x/y are mercator meters (stretched by 1/cos(lat)). Rendering must scale z by this factor or geometry appears vertically squashed away from the equator.
Definition at line 48 of file GeoScene.cc.
References TileMath::mercatorScale(), and TileMath::worldToGeo().
Referenced by SurfacePatchModel::analyzeSurface(), centerForCoordinateAtScreenPoint(), scenePositionFor(), and screenPositionFor().
|
staticconstexpr |
scene-origin re-anchor threshold (m)
Definition at line 47 of file GeoScene.h.