博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
marble 基本函数(一)
阅读量:6966 次
发布时间:2019-06-27

本文共 1419 字,大约阅读时间需要 4 分钟。

1. 标记    GeoDataPlacemark *place = new GeoDataPlacemark( "Bucharest" );    place->setCoordinate( 25.97, 44.43, 0.0, GeoDataCoordinates::Degree );    place->setPopulation( 1877155 );    place->setCountryCode ( "Romania" );      GeoDataDocument *document = new GeoDataDocument;    document->append( place );     // Add the document to MarbleWidget's tree model    mapWidget->model()->treeModel()->addDocument( document );2. 初始位置    GeoDataCoordinates home(112, 30.0, 10.0, GeoDataCoordinates::Degree);    mapWidget->centerOn(home);3.鼠标当前位置        // Connect the map widget to the position label.    QObject::connect(mapWidget, SIGNAL(mouseMoveGeoPosition(QString)),        positionLabel, SLOT(setText(QString))); 4.设置投影    mapWidget->setProjection( Mercator ); 5.获取设置控件   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 ) ); }
 6.绘制标记

  void MyMarbleWidget::customPaint(GeoPainter* painter)

  {
    GeoDataCoordinates home(8.4, 49.0, 0.0, GeoDataCoordinates::Degree);
    painter->setPen(Qt::green);
    painter->drawEllipse(home, 17, 17);
    painter->setPen(Qt::red);
    painter->drawText(home, "Hello Marble!");
  }

 

 

转载于:https://www.cnblogs.com/nmgxbc/p/4871761.html

你可能感兴趣的文章
eval()函数用法详解
查看>>
Angular 基础入门
查看>>
Xcode的一个简单的UITests
查看>>
前端--CSS之使用display:inline-block来布局(转)
查看>>
需求工程——软件建模与分析阅读笔记05
查看>>
备战找工作
查看>>
方维O2O调用UCENTER头像的方法
查看>>
一个非常标准的Java连接Oracle数据库的示例代码
查看>>
深入理解CSS绝对定位absolute
查看>>
poj3261
查看>>
bbs项目实现点赞和评论的功能
查看>>
贪心算法的实现框架
查看>>
循环例题
查看>>
关于form/input 的autocomplete="off"属性
查看>>
Java 8 Nashorn JavaScript
查看>>
hibernate映射数据库时@ManyToOne和@OneToMany
查看>>
初探单点登录 SSO
查看>>
Ubuntu apt-get出现unable to locate package解决方案
查看>>
mvn jetty:run PermGen溢出问题
查看>>
回答自己的提问!
查看>>