Annotation draping problem

classic Classic list List threaded Threaded
5 messages Options
ElRudi ElRudi
Reply | Threaded
Open this post in threaded view
|

Annotation draping problem

Hi,
i want to drape a circle an the terrain. I took the code from annotation sample and copied it to osgearth_qt_windows sample in main:

   osg::Node* node = osgDB::readNodeFiles( args );
    if ( !node )
        return usage("Can't load a scene!", args);

        Style circleStyle;
        circleStyle.getOrCreate<PolygonSymbol>()->fill()->color() = Color(Color::Cyan, 0.5);
        circleStyle.getOrCreate<AltitudeSymbol>()->clamping() = AltitudeSymbol::CLAMP_TO_TERRAIN;
        circleStyle.getOrCreate<AltitudeSymbol>()->technique() = AltitudeSymbol::TECHNIQUE_DRAPE;

        osgEarth::MapNode* mapNode = MapNode::findMapNode(node);
        if(mapNode)
        {
                osgEarth::Annotation::CircleNode* circle = new osgEarth::Annotation::CircleNode(
                        mapNode,
                        GeoPoint(mapNode->getMapSRS(), -90.25, 29.98, 1000., ALTMODE_RELATIVE),
                        Distance(300, Units::KILOMETERS),
                        circleStyle, Angle(0, Units::DEGREES), Angle(360, Units::DEGREES), true);

                mapNode->addChild(circle);
        }

At first i see the circle but if i move or rotate the view, there is a kind of boundingbox where the parts of the circle disapear that gets outside of this rectangle.




What's the problem here?

cheers,
ElRudi
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: Annotation draping problem

ElRudi,
Are you saying it works fine in osgearth_viewer, but it clips the geometry in osgearth_qt5_viewer?

If that is the case, I don't know the problem - but perhaps something like viewport resizing is not being propertly communicated from Qt to OSG. Just a guess though.
Glenn Waldron / Pelican Mapping
ElRudi ElRudi
Reply | Threaded
Open this post in threaded view
|

Re: Annotation draping problem

This post was updated on .
I modified the osgearth_viewer example, but there is no circle (using readymap.earth):

    osg::Group* node = MapNodeHelper().load(arguments, &viewer);
    if ( node )
    {
        osg::ref_ptr<osgEarth::MapNode> mapNode =  MapNode::findMapNode(node);

        Style circleStyle;
        circleStyle.getOrCreate<PolygonSymbol>()->fill()->color() = Color(Color::Cyan, 1);
        circleStyle.getOrCreate<AltitudeSymbol>()->clamping() = AltitudeSymbol::CLAMP_TO_TERRAIN;
        circleStyle.getOrCreate<AltitudeSymbol>()->technique() = AltitudeSymbol::TECHNIQUE_DRAPE;

        osgEarth::Annotation::CircleNode* circle = new osgEarth::Annotation::CircleNode(
            mapNode,
            GeoPoint(mapNode->getMapSRS(), 11, 45.85, 1000., ALTMODE_RELATIVE),
            Distance(30, Units::KILOMETERS),
            circleStyle, Angle(0.0, Units::DEGREES), Angle(360.0, Units::DEGREES), true);
        node->addChild( circle );

        viewer.setSceneData( node );
        Metrics::run(viewer);
    }

I have the same problem with osgearth_annotation sample. The circle around New Orleans have to be moved to the right position to see it. I think it's the center of the window.

If i don't add --window 100 100 1000 800 as parameter, osgearth_annotation is crashing after calling viewer.run().

By the way: I'm using Visual Studio 2013 on Windows 7.
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: Annotation draping problem

In reply to this post by ElRudi
I pushed a fix for the "chopped off" draped geometry.

https://github.com/gwaldron/osgearth/commit/bc66a87bbf19b8de1d3193460815f51f5f37f628
Glenn Waldron / Pelican Mapping
ElRudi ElRudi
Reply | Threaded
Open this post in threaded view
|

Re: Annotation draping problem

Works great. Thank you Glenn.