当前位置: 首页>>代码示例>>C++>>正文


C++ MarbleWidget::show方法代码示例

本文整理汇总了C++中MarbleWidget::show方法的典型用法代码示例。如果您正苦于以下问题:C++ MarbleWidget::show方法的具体用法?C++ MarbleWidget::show怎么用?C++ MarbleWidget::show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MarbleWidget的用法示例。


在下文中一共展示了MarbleWidget::show方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char** argv)
{
    QApplication app(argc,argv);

    // Create a Marble QWidget without a parent
    MarbleWidget *mapWidget = new MarbleWidget();

    // Load the OpenStreetMap map
    mapWidget->setMapThemeId("earth/bluemarble/bluemarble.dgml");

    mapWidget->setProjection( Mercator );

    // Enable the cloud cover and enable the country borders
    mapWidget->setShowClouds( true );
    mapWidget->setShowBorders( true );

    // Hide the FloatItems: Compass and StatusBar
    mapWidget->setShowOverviewMap(false);
    mapWidget->setShowScaleBar(false);

    foreach ( AbstractFloatItem * floatItem, mapWidget->floatItems() )
        if ( floatItem && floatItem->nameId() == "compass" ) {

            // Put the compass onto the left hand side
            floatItem->setPosition( QPoint( 10, 10 ) );
            // Make the content size of the compass smaller
            floatItem->setContentSize( QSize( 50, 50 ) );
        }

    mapWidget->resize( 400, 300 );
    mapWidget->show();

    return app.exec();
}
开发者ID:PayalPradhan,项目名称:marble,代码行数:34,代码来源:main.cpp

示例2: main

int main(int argc, char** argv)
{
    QApplication app(argc,argv);
    MarbleWidget *mapWidget = new MarbleWidget;

    // Create and register our paint layer
    MyPaintLayer* layer = new MyPaintLayer(mapWidget);
    // Uncomment for older versions of Marble:
    // mapWidget->map()->model()->addLayer(layer);
    mapWidget->addLayer(layer);

    // Install an event handler: Pressing + will change the layer we paint at
    mapWidget->installEventFilter(layer);

    // Finish widget creation.
    mapWidget->setMapThemeId("earth/bluemarble/bluemarble.dgml");
    mapWidget->show();

    // Update each second to give the clock second resolution
    QTimer seconds;
    seconds.setInterval(1000);
    QObject::connect(&seconds, SIGNAL(timeout()), mapWidget, SLOT(update()));
    seconds.start();

    return app.exec();
}
开发者ID:fgx,项目名称:fgx-marble,代码行数:26,代码来源:main.cpp

示例3: main

int main(int argc, char** argv)
{
    QApplication app(argc,argv);

    // Create a Marble QWidget without a parent
    MarbleWidget *mapWidget = new MarbleWidget();

    // Load the OpenStreetMap map
    mapWidget->setMapThemeId(QStringLiteral("earth/openstreetmap/openstreetmap.dgml"));
    mapWidget->setProjection( Mercator );

    // Access the shared route request (start, destination and parameters)
    RoutingManager* manager = mapWidget->model()->routingManager();
    RouteRequest* request = manager->routeRequest();

    // Use default routing settings for cars
    request->setRoutingProfile( manager->defaultProfile( RoutingProfile::Motorcar ) );

    // Set start and destination
    request->append( GeoDataCoordinates( 8.38942, 48.99738, 0.0, GeoDataCoordinates::Degree ) );
    request->append( GeoDataCoordinates( 8.42002, 49.0058, 0.0, GeoDataCoordinates::Degree ) );

    // Calculate the route
    manager->retrieveRoute();

    // Center the map on the route start point and show it
    mapWidget->centerOn( request->at( 0 ) );
    mapWidget->setDistance( 0.75 );
    mapWidget->show();

    return app.exec();
}
开发者ID:KDE,项目名称:marble,代码行数:32,代码来源:main.cpp

示例4: main

int main(int argc, char** argv) {

    QApplication app(argc,argv);

    QFileInfo inputFile( app.arguments().last() );
    if ( app.arguments().size() < 2 || !inputFile.exists() ) {
        qWarning() << "Usage: " << app.arguments().first() << "file.png";
        return 1;
    }

    // Create a Marble QWidget without a parent
    MarbleWidget *mapWidget = new MarbleWidget();

    // Load the Satellite map
    mapWidget->setMapThemeId( "earth/bluemarble/bluemarble.dgml" );

    // Create a bounding box from the given corner points
    GeoDataLatLonBox box( 55, 48, 14.5, 6, GeoDataCoordinates::Degree );
    box.setRotation( 0, GeoDataCoordinates::Degree );

    // Create an overlay and assign the image to render and its bounding box to it
    GeoDataGroundOverlay *overlay = new GeoDataGroundOverlay;
    overlay->setLatLonBox( box );
    overlay->setIcon( QImage( inputFile.absoluteFilePath() ) );

    // Create a document as a container for the overlay
    GeoDataDocument *document = new GeoDataDocument();
    document->append( overlay );

    // Add the document to MarbleWidget's tree model
    mapWidget->model()->treeModel()->addDocument( document );

    mapWidget->show();

    return app.exec();
}
开发者ID:AndreiDuma,项目名称:marble,代码行数:36,代码来源:main.cpp


注:本文中的MarbleWidget::show方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。