osgearth icon indicating copy to clipboard operation
osgearth copied to clipboard

Remove ElevationLayer

Open marcoma9023 opened this issue 1 year ago • 0 comments

Good Morning,

I'm migrating code from version 2.x to 3.3.... then, I'm converting the logic for the switch layer.

I have a MapNodeCallback in which I Add and Remove Image and Elevation layers....

If for the ImageLayers it's all ok, for the ElevationLayer, the adding event it's correct, instead the removing has strange behaviour:

when I remove a layer from the map, the elevation persist on the map again, but the layer it's not presence in the map from

osg::ref_ptr <osgEarth::ElevationLayer> layerDEM = (osgEarth::ElevationLayer*)_mapNode->getMap()->getLayerByName(layerName); _mapNode->getMap()->removeLayer(layerDEM); if (_mapNode->getMap()->getLayerByName(layerName) != nullptr) { cout << "There is elevation layer" << endl; } else { cout << "It's not presence" << endl; }

Another strange behaviour it's related the clear operation on the map. Calling this function, the elvation layer it's correctly removed.

More informations:

  • Add and remove layer actions are perfomed inside the MapNodeCallback;
  • Using 2.1 version of osgearth, I had no problems.

Thanks

marcoma9023 avatar Sep 21 '22 07:09 marcoma9023