switch map 2d/3d with ol3cesium or leaflet and display some layers in 2d and some layers only in 3d

Using ol3cesium I have a button, call a javascript and switch fron 2d to 3d using

var ol3d = new olcs.OLCesium({map: map}); // map is the ol.Map instance
ol3d.setEnabled(true);
then, i have 2 questions:
1) how to create a similar javascript for switch 2d/3d using leaflet?
2) using openlayers3 and not leaflet, can I trap the name of current displayed map? I need to display some layers when I am in 2d mode and after the click, when the current map id 3d, i need to put off some layers and on different layers then i have not displayed in the 2d map (i need some layers only in 2d mode and some layers only in 3d mode)
Thanks!



Hi,

You can get the list of layers in a map with map.getLayers() as indicated in http://openlayers.org/en/master/apidoc/ol.Map.html.

Then you can check visiblity.

In OL3-Cesium, to get different layers in 2D and 3D you can replace the synchronizers. Check the OLCesium constructor
to see how to pass your own synchronizers. http://openlayers.org/ol3-cesium/apidoc/olcs.OLCesium.html.

Guillaume