33 if (
scene == _scene) {
37 disconnect(_scene,
nullptr,
this,
nullptr);
44 connect(_scene, &QObject::destroyed,
this, [
this] {
60 disconnect(_surfaceModel,
nullptr,
this,
nullptr);
65 &GeoMapProjectedPath::_terrainHeightsChanged);
66 connect(_surfaceModel, &QObject::destroyed,
this, [
this] {
67 _surfaceModel =
nullptr;
78 if (mode == _altitudeMode) {
86void GeoMapProjectedPath::_connectCamera()
89 if (camera == _connectedCamera) {
93 if (_connectedCamera) {
94 disconnect(_connectedCamera,
nullptr,
this,
nullptr);
96 _connectedCamera = camera;
97 if (_connectedCamera) {
101 connect(_connectedCamera, &QObject::destroyed,
this, [
this] {
102 _connectedCamera =
nullptr;
109void GeoMapProjectedPath::_terrainHeightsChanged()
116void GeoMapProjectedPath::_rebuild()
119 points.reserve(_coordinates.size());
120 bool allProjected = !_coordinates.isEmpty();
124 for (
const QVariant& variant : std::as_const(_coordinates)) {
125 const QGeoCoordinate
coordinate = variant.value<QGeoCoordinate>();
126 if (!_scene || !camera || !
coordinate.isValid()) {
127 allProjected =
false;
131 double altitude = 0.0;
134 }
else if (_surfaceModel) {
142 allProjected =
false;
145 points.append(*screen);
148 if (points != _screenPoints) {
149 _screenPoints = points;
152 if (allProjected != _projected) {
153 _projected = allProjected;
161 if (!center.isValid() || radiusMeters <= 0.0 || segments < 3) {
165 for (
int i = 0; i <= segments; ++i) {
166 const double azimuth = (360.0 * i) / segments;
167 coordinates.append(QVariant::fromValue(center.atDistanceAndAzimuth(radiusMeters, azimuth)));
std::optional< QPointF > worldToScreen(const QPointF &worldGround, double worldZ=0.0) const
void fieldOfViewChanged()
void viewportSizeChanged()
AltitudeMode
How the coordinate's vertical position is resolved.
@ ClampToGround
sit on the rendered terrain surface (default)
@ Absolute
use coordinate.altitude (NaN treated as 0)
GeoMapProjectedPath(QObject *parent=nullptr)
void setScene(GeoScene *scene)
QVariantList coordinates() const
SurfacePatchModel * surfaceModel() const
void altitudeModeChanged()
void setCoordinates(const QVariantList &coordinates)
static Q_INVOKABLE QVariantList circleCoordinates(const QGeoCoordinate ¢er, double radiusMeters, int segments=32)
void coordinatesChanged()
void surfaceModelChanged()
void setSurfaceModel(SurfacePatchModel *surfaceModel)
void screenPointsChanged()
void setAltitudeMode(GeoMapItem::AltitudeMode mode)
qreal verticalScale() const
void sceneOriginChanged()
qreal terrainScale() const
void terrainScaleChanged()
GeoMapCamera * camera() const
void terrainHeightsChanged()
terrainHeightAt answers changed somewhere: consumers re-query
Q_INVOKABLE double terrainHeightAt(const QGeoCoordinate &coordinate) const
std::optional< double > coordinate(std::string_view field, std::string_view hemisphere, bool latitude)
QPointF geoToWorld(const QGeoCoordinate &coord)
Geo -> world meters. Latitude is clamped to +/-kMaxLatitude.