[Marble-bugs] [Bug 299527] Red line does not shown

Dennis Nienhüser earthwings at gentoo.org
Wed May 23 19:26:51 UTC 2012


https://bugs.kde.org/show_bug.cgi?id=299527

Dennis Nienhüser <earthwings at gentoo.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |earthwings at gentoo.org

--- Comment #5 from Dennis Nienhüser <earthwings at gentoo.org> ---
I used the code pasted below and get two lines as expected. One is a placemark
with a line string geometry, the other one with a track geometry.


#include <QtGui/QApplication>
#include <marble/MarbleWidget.h>
#include <marble/MarbleModel.h>
#include <marble/MarbleClock.h>
#include <marble/GeoDataPlacemark.h>
#include <marble/GeoDataLineString.h>
#include <marble/GeoDataStyle.h>
#include <marble/GeoDataDocument.h>
#include <marble/GeoDataTrack.h>
#include <marble/GeoDataTreeModel.h>
#include <marble/RenderPlugin.h>

using namespace Marble;

int main(int argc, char** argv)
{
    QApplication app(argc,argv);

    // Create a Marble QWidget without a parent
    MarbleWidget *mapWidget = new MarbleWidget();

    // Load the OpenStreetMap map
    mapWidget->setMapThemeId("earth/openstreetmap/openstreetmap.dgml");

    GeoDataLineString* track_line_string = new GeoDataLineString();
    GeoDataTrack* track = new GeoDataTrack();
    for (int i=0; i<=360; ++i) {
        track_line_string->append(GeoDataCoordinates( i, 0, 20000.0 * 1000,
GeoDataCoordinates::Degree ));
        track->addPoint(mapWidget->model()->clock()->dateTime(),
GeoDataCoordinates( i, 0, 22000.0 * 1000, GeoDataCoordinates::Degree ));
    }

    QString satelliteName("test");
    GeoDataPlacemark* geoDataPlacemark = new GeoDataPlacemark("LineString
Geometry");
    geoDataPlacemark->setVisualCategory( GeoDataFeature::Satellite );
    geoDataPlacemark->setGeometry( track_line_string );
    GeoDataStyle *style = new GeoDataStyle( *geoDataPlacemark->style() );
    geoDataPlacemark->setStyle( style );
    geoDataPlacemark->style()->lineStyle().setColor( oxygenBrickRed4 );
    geoDataPlacemark->style()->lineStyle().setPenStyle( Qt::SolidLine );
    geoDataPlacemark->style()->labelStyle().setGlow( true );

    GeoDataPlacemark* geoDataPlacemarkTrack = new GeoDataPlacemark("Track
Geometry");
    geoDataPlacemarkTrack->setVisualCategory( GeoDataFeature::Satellite );
    geoDataPlacemarkTrack->setGeometry( track );
    GeoDataStyle *trackStyle = new GeoDataStyle(
*geoDataPlacemarkTrack->style() );
    geoDataPlacemarkTrack->setStyle( trackStyle );
    geoDataPlacemarkTrack->style()->lineStyle().setColor( oxygenSkyBlue4 );
    geoDataPlacemarkTrack->style()->lineStyle().setPenStyle( Qt::SolidLine );
    geoDataPlacemarkTrack->style()->labelStyle().setGlow( true );

    GeoDataDocument *geoDataContainer = new GeoDataDocument();
    geoDataContainer->setFileName("container_" + satelliteName);
    geoDataContainer->append( geoDataPlacemark );
    geoDataContainer->append( geoDataPlacemarkTrack );
    mapWidget->model()->treeModel()->addDocument(geoDataContainer);

    foreach( RenderPlugin* plugin, mapWidget->renderPlugins() ) {
        plugin->setEnabled(false);
        plugin->setVisible(false);
    }

    mapWidget->setRadius(120);
    mapWidget->centerOn(0,30);
    mapWidget->show();

    return app.exec();
}

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Marble-bugs mailing list