首页 > 其他 > 详细

Marble 绘制线

时间:2015-10-12 17:02:17      阅读:140      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!