码迷,mamicode.com
首页 > 其他好文 > 详细

Marble 绘制线

时间:2015-10-12 17:05:12      阅读:165      评论:0      收藏:0      [点我收藏+]

标签:

#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();
}

 

Marble 绘制线

标签:

原文地址:http://www.cnblogs.com/nmgxbc/p/4871879.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!