How to set max_level and min_level by code

classic Classic list List threaded Threaded
4 messages Options
iyigitel iyigitel
Reply | Threaded
Open this post in threaded view
|

How to set max_level and min_level by code

Hi,
I am trying to add an image layer by code using Gdal driver. Sample code is given below.

Drivers::GDALOptions gdalOptions;
gdalOptions.url() = myPathToImageFile;

osg::ref_ptr<ImageLayer> imageLayer = new ImageLayer(layerText, gdal);
_mapNode->getMap()->addLayer(imageLayer.get());

how can I set the "max_level" and "min_level" for this layer by code.
NOTE: I am using osgearth version 2.9

Regards,
Iskender Yigitel
Iskender Yigitel
Josiah425 Josiah425
Reply | Threaded
Open this post in threaded view
|

Re: How to set max_level and min_level by code

On the imageLayer itself, call setMinVisibleRange and setMaxVisibleRange.  This isn't done on the GDALOptions.

Edit: sorry didn't see min_LEVEL

This is done on the imageLayer->options().minLevel()
iyigitel iyigitel
Reply | Threaded
Open this post in threaded view
|

Re: How to set max_level and min_level by code

Thanks for the tip. I will give it a try.

Iskender Yigitel
iyigitel iyigitel
Reply | Threaded
Open this post in threaded view
|

Re: How to set max_level and min_level by code

Yeah, It works.

To help others who may need this, the code sample is given below

ImageLayer* yourImageLayer;
yourImageLayer->options().minLevel() = yourMinLod;
yourImageLayer->options().maxLevel() = yourMaxLod;
Iskender Yigitel