Programmatic ModelLayer

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

Programmatic ModelLayer

Hi,

I'm having trouble building a programmatic ModelLayer. I can build and visualize an equivalent AGGLite image layer, but the following code isn't giving me anything on screen, nor in an output earth file:

        osgEarth::Drivers::OGRFeatureOptions* featureOpt = new osgEarth::Drivers::OGRFeatureOptions;
        featureOpt->url() = "D:/gis/myshapes.shp";

        osgEarth::Symbology::Style* style = new osgEarth::Symbology::Style;

        osgEarth::Symbology::LineSymbol* ls = new osgEarth::Symbology::LineSymbol;
        ls->stroke()->color() = osg::Vec4f( 1,1,0,1 );
        ls->stroke()->width() = 1.5f;
        style->addSymbol(ls);

        osgEarth::Drivers::FeatureStencilModelOptions* modelOpt = new osgEarth::Drivers::FeatureStencilModelOptions;

        modelOpt->featureOptions() = featureOpt;
        modelOpt->geometryTypeOverride() = osgEarth::Symbology::Geometry::TYPE_LINESTRING;
        modelOpt->styles()->addStyle( style );

        pMap->addModelLayer(new osgEarth::ModelLayer("world", modelOpt));


In the earth file that I output from this map, I get:

    <model driver="feature_stencil" name="world">
       
    </model>

What am I doing wrong?

Thanks,
Jesse
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: Programmatic ModelLayer

Jesse,

I tried your code and got the same result. I will take a closer look tomorrow.

Glenn
Glenn Waldron / Pelican Mapping
jasonbeverage jasonbeverage
Reply | Threaded
Open this post in threaded view
|

Re: Programmatic ModelLayer

Hi Jesse,

I've committed a fix for this issue in r1195, can you update and give it a try?

Thanks!

Jason

On Wed, Jul 7, 2010 at 5:45 PM, gwaldron [via osgEarth]
<[hidden email]> wrote:

> Jesse,
>
> I tried your code and got the same result. I will take a closer look
> tomorrow.
>
> Glenn
>
> ________________________________
> View message @
> http://forum.osgearth.org/Programmatic-ModelLayer-tp5267121p5267497.html
> To start a new topic under osgEarth, email
> [hidden email]
> To unsubscribe from osgEarth, click here.
>
JesseStimpson JesseStimpson
Reply | Threaded
Open this post in threaded view
|

Re: Programmatic ModelLayer

Jason,

I think I'll have time to test this one and the other one (db pager issue) out next Monday.

Thanks,
Jesse
JesseStimpson JesseStimpson
Reply | Threaded
Open this post in threaded view
|

Re: Programmatic ModelLayer

In reply to this post by jasonbeverage
Jason,

Your fix works for me. Thanks!

Jesse