Skip to content

Commit

Permalink
feat: give credit to elevation provider
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardosimovic committed Aug 28, 2023
1 parent ab9913c commit 534e33f
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 5 deletions.
13 changes: 13 additions & 0 deletions src/PlanView/PlanView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,19 @@ Item {
}
}

QGCLabel {
// Elevation provider notice on top of terrain plot
readonly property string _licenseString: QGroundControl.elevationProviderNotice

id: licenseLabel
visible: terrainStatus.visible && _licenseString !== ""
anchors.bottom: terrainStatus.top
anchors.horizontalCenter: terrainStatus.horizontalCenter
anchors.bottomMargin: ScreenTools.defaultFontPixelWidth * 0.5
font.pointSize: ScreenTools.smallFontPointSize
text: qsTr("Powered by %1").arg(_licenseString)
}

TerrainStatus {
id: terrainStatus
anchors.margins: _toolsMargin
Expand Down
1 change: 0 additions & 1 deletion src/PlanView/TerrainStatus.qml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ Rectangle {

QGCFlickable {
id: terrainProfileFlickable
//anchors.margins: _margins
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.leftMargin: titleLabel.contentHeight
Expand Down
3 changes: 3 additions & 0 deletions src/QmlControls/QGroundControlQmlGlobal.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ class QGroundControlQmlGlobal : public QGCTool
//-------------------------------------------------------------------------
// Elevation Provider
Q_PROPERTY(QString elevationProviderName READ elevationProviderName CONSTANT)
Q_PROPERTY(QString elevationProviderNotice READ elevationProviderNotice CONSTANT)


#if defined(QGC_ENABLE_PAIRING)
Q_PROPERTY(PairingManager* pairingManager READ pairingManager CONSTANT)
Expand Down Expand Up @@ -208,6 +210,7 @@ class QGroundControlQmlGlobal : public QGCTool
#endif

QString elevationProviderName () { return UrlFactory::kCopernicusElevationProviderKey; }
QString elevationProviderNotice () { return UrlFactory::kCopernicusElevationProviderNotice; }

bool singleFirmwareSupport ();
bool singleVehicleSupport ();
Expand Down
9 changes: 5 additions & 4 deletions src/QtLocationPlugin/QGCMapUrlEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ QGC_LOGGING_CATEGORY(QGCMapUrlEngineLog, "QGCMapUrlEngineLog")
#include <QTimer>

const char* UrlFactory::kCopernicusElevationProviderKey = "Copernicus Elevation";
const char* UrlFactory::kCopernicusElevationProviderNotice = "© Airbus Defence and Space GmbH";

//-----------------------------------------------------------------------------
UrlFactory::UrlFactory() : _timeout(5 * 1000) {
Expand Down Expand Up @@ -73,7 +74,7 @@ UrlFactory::UrlFactory() : _timeout(5 * 1000) {

//_providersTable["MapQuest Map"] = new MapQuestMapMapProvider(this);
//_providersTable["MapQuest Sat"] = new MapQuestSatMapProvider(this);

_providersTable["VWorld Street Map"] = new VWorldStreetMapProvider(this);
_providersTable["VWorld Satellite Map"] = new VWorldSatMapProvider(this);

Expand All @@ -84,9 +85,9 @@ UrlFactory::UrlFactory() : _timeout(5 * 1000) {
_providersTable["Japan-GSI Anaglyph"] = new JapanAnaglyphMapProvider(this);
_providersTable["Japan-GSI Slope"] = new JapanSlopeMapProvider(this);
_providersTable["Japan-GSI Relief"] = new JapanReliefMapProvider(this);

_providersTable["LINZ Basemap"] = new LINZBasemapMapProvider(this);

_providersTable["CustomURL Custom"] = new CustomURLMapProvider(this);
}

Expand Down Expand Up @@ -142,7 +143,7 @@ QNetworkRequest UrlFactory::getTileURL(const QString& type, int x, int y, int zo
quint32 UrlFactory::averageSizeForType(const QString& type) {
if (_providersTable.find(type) != _providersTable.end()) {
return _providersTable[type]->getAverageSize();
}
}
qCDebug(QGCMapUrlEngineLog) << "UrlFactory::averageSizeForType " << type
<< " Not registered";

Expand Down
1 change: 1 addition & 0 deletions src/QtLocationPlugin/QGCMapUrlEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class UrlFactory : public QObject {
Q_OBJECT
public:
static const char* kCopernicusElevationProviderKey;
static const char* kCopernicusElevationProviderNotice;

UrlFactory ();
~UrlFactory ();
Expand Down

0 comments on commit 534e33f

Please sign in to comment.