marble 基本函数(一)
2024-10-04 23:52:28
. 标记
GeoDataPlacemark *place = new GeoDataPlacemark( "Bucharest" );
place->setCoordinate( 25.97, 44.43, 0.0, GeoDataCoordinates::Degree );
place->setPopulation( );
place->setCountryCode ( "Romania" ); GeoDataDocument *document = new GeoDataDocument;
document->append( place ); // Add the document to MarbleWidget's tree model
mapWidget->model()->treeModel()->addDocument( document ); . 初始位置
GeoDataCoordinates home(, 30.0, 10.0, GeoDataCoordinates::Degree);
mapWidget->centerOn(home); .鼠标当前位置
// 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!");
}
最新文章
- Linux实战教学笔记07:Linux系统目录结构介绍
- Asp.net 面向接口可扩展框架之业务规则引擎扩展组件
- linux学习日记之老男孩
- 详解JavaScript中的this
- django的信号
- Hadoop组件之-HDFS(HA实现细节)
- paip.一千 常用汉字 高频汉字 覆盖率90%
- HDU 5821 Ball (排序)
- ionic默认样式android和ios的一些不同(当时真是纠结啊~)
- 移动Web开发,4行代码检测浏览器是否支持position:fixed
- 用Jpush极光推送实现抓取特定某个用户Log到七牛云服务器
- ThinkPHP - 查询语句
- apache 安装[转]
- MongoDB 学习笔记(原创)
- 单词计数,杭电0j-2072
- log4j日志框架学习
- JDBC 连接Oracle
- MacPro4,1升级到MacPro5,1
- 给定一个只包含正整数的非空数组,返回该数组中重复次数最多的前N个数字 ,返回的结果按重复次数从多到少降序排列(N不存在取值非法的情况)
- 解决方案:ppt打不开,显示发现文件中的内容有问题。可尝试修复此演示文稿
热门文章
- C# 语言规范_版本5.0 (第20章 附录B_语法)
- ios微信支付成功后点击左上角返回不走回调的问题
- CodeForces 707C Pythagorean Triples
- google 技巧
- javascript和jquery比较中学习
- How to fix 'sudo: no tty present and no askpass program'以及硬盘序列号的读写
- IIS SSL取消证书合法性验证
- .net 可枚举类型的构建方法
- jQuery(7)——jQuery与Ajax的应用
- linux虚拟机正常安装完成后获取不到IP的解决办法