Marble 绘制线
2015-10-12 15:48
337 查看
#include <QtGui/QApplication> #include <marble/MarbleWidget.h> #include <marble/GeoPainter.h> #include <marble/GeoDataLineString.h> using namespace Marble; class MyMarbleWidget : public MarbleWidget { public: virtual void customPaint(GeoPainter* painter); }; void MyMarbleWidget::customPaint(GeoPainter* painter) { GeoDataCoordinates France( 2.2, 48.52, 0.0, GeoDataCoordinates::Degree ); painter->setPen( QColor( 0, 0, 0 ) ); painter->drawText( France, "France" ); GeoDataCoordinates Canada( -77.02, 48.52, 0.0, GeoDataCoordinates::Degree ); painter->setPen( QColor( 0, 0, 0 ) ); painter->drawText( Canada, "Canada" ); //A line from France to Canada without tessellation GeoDataLineString shapeNoTessellation( NoTessellation ); shapeNoTessellation << France << Canada; painter->setPen( oxygenSkyBlue4 ); painter->drawPolyline( shapeNoTessellation ); //The same line, but with tessellation GeoDataLineString shapeTessellate( Tessellate ); shapeTessellate << France << Canada; painter->setPen( oxygenBrickRed4 ); painter->drawPolyline( shapeTessellate ); //Now following the latitude circles GeoDataLineString shapeLatitudeCircle( RespectLatitudeCircle | Tessellate ); shapeLatitudeCircle << France << Canada; painter->setPen( oxygenForestGreen4 ); painter->drawPolyline( shapeLatitudeCircle ); } int main(int argc, char** argv) { QApplication app(argc,argv); // Create a Marble QWidget without a parent MarbleWidget *mapWidget = new MyMarbleWidget(); // Load the OpenStreetMap map mapWidget->setMapThemeId("earth/plain/plain.dgml"); mapWidget->show(); return app.exec(); }
相关文章推荐
- 1436 方程的解数
- 自定义searchBar
- 锁在java虚拟机中的实现和优化
- gradle project sync failed. basic functionality (e.g.editing, debugging )will not work properly
- MyEclipse中SVN的使用方法
- pom.xml详解
- 更改MyEclipse中的字符集设置
- hive1.0.0-1.2.1版本升级及升级中遇到bug
- 手风琴菜单集锦
- Singleton 种类
- mybatis基础(二)
- leetcode 26:Remove Duplicates from Sorted Array
- IOS自学之路0-开篇
- poj 2010
- web测试方法总结
- Marble 添加自定义Layer
- 石墨烯、二硫化钼和黑磷
- 深入解析Python中的变量和赋值运算符
- 利用jstl:functions截取字符串
- 如何解压war后缀的文件: