pelicanmapping / rocky

3D Geospatial SDK (C++17 / Vulkan / VSG)
MIT License
91 stars 15 forks source link

Removing a layer at runtime - todo #54

Open gwaldron opened 2 weeks ago

gwaldron commented 2 weeks ago

Discussed in https://github.com/pelicanmapping/rocky/discussions/53

Originally posted by **ComradeMashkov** August 27, 2024 Hey there! Recently I tried to add layers during runtime and I did it successfully: ```cpp auto layer = rocky::MBTilesImageLayer::create(); layer->setURI("data\\world\\world_white.mbtiles"); app_.mapNode->map->layers().add(layer); ``` It works just fine but I was wondering: am I able to remove layers during runtime? I tried it too but it didn't work (mostly because of lack of experience from my side). I tried naive solution: ```cpp app_.mapNode->map->layers().remove(layer); ``` And nothing happens. I guess we should tell map node or application to redraw layers or to update LayerCollection somehow but I don't know how exactly... I would appreciate it so much if you give me a clear explanation about this moment :)