File indexing completed on 2024-12-08 09:32:23
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2012 Dennis Nienhüser <nienhueser@kde.org> 0004 // 0005 0006 #include <QApplication> 0007 0008 #include <marble/MarbleWidget.h> 0009 #include <marble/GeoPainter.h> 0010 0011 using namespace Marble; 0012 0013 class MyMarbleWidget : public MarbleWidget 0014 { 0015 public: 0016 void customPaint(GeoPainter* painter) override; 0017 }; 0018 0019 void MyMarbleWidget::customPaint(GeoPainter* painter) 0020 { 0021 GeoDataCoordinates home(8.4, 49.0, 0.0, GeoDataCoordinates::Degree); 0022 painter->setPen(Qt::green); 0023 painter->drawEllipse(home, 7, 7); 0024 painter->setPen(Qt::black); 0025 painter->drawText(home, QStringLiteral("Hello Marble!")); 0026 } 0027 0028 int main(int argc, char** argv) 0029 { 0030 QApplication app(argc,argv); 0031 MyMarbleWidget *mapWidget = new MyMarbleWidget; 0032 mapWidget->setMapThemeId(QStringLiteral("earth/openstreetmap/openstreetmap.dgml")); 0033 mapWidget->centerOn(8.4, 49.0); 0034 mapWidget->show(); 0035 return app.exec(); 0036 }