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/MarbleGlobal.h> 0009 #include <marble/MarbleWidget.h> 0010 #include <marble/AbstractFloatItem.h> 0011 0012 using namespace Marble; 0013 0014 int main(int argc, char** argv) 0015 { 0016 QApplication app(argc,argv); 0017 0018 // Create a Marble QWidget without a parent 0019 MarbleWidget *mapWidget = new MarbleWidget(); 0020 0021 // Load the OpenStreetMap map 0022 mapWidget->setMapThemeId(QStringLiteral("earth/bluemarble/bluemarble.dgml")); 0023 0024 mapWidget->setProjection( Mercator ); 0025 0026 // Enable the cloud cover and enable the country borders 0027 mapWidget->setShowClouds( true ); 0028 mapWidget->setShowBorders( true ); 0029 0030 // Hide the FloatItems: Compass and StatusBar 0031 mapWidget->setShowOverviewMap(false); 0032 mapWidget->setShowScaleBar(false); 0033 0034 foreach ( AbstractFloatItem * floatItem, mapWidget->floatItems() ) 0035 if (floatItem && floatItem->nameId() == QLatin1String("compass")) { 0036 0037 // Put the compass onto the left hand side 0038 floatItem->setPosition( QPoint( 10, 10 ) ); 0039 // Make the content size of the compass smaller 0040 floatItem->setContentSize( QSize( 50, 50 ) ); 0041 } 0042 0043 mapWidget->resize( 400, 300 ); 0044 mapWidget->show(); 0045 0046 return app.exec(); 0047 }