标签:
#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(); }
标签:
原文地址:http://www.cnblogs.com/nmgxbc/p/4871879.html