Hi,
I wonder if it was ever intended, or possible to replace the
BaseLayerPicker, or the list of possible layers in CesiumViewerWidget?
what I'd like to do is simply to have a different list of imagery
providers. to achieve this, I tried the following:
- replace the baseLayerPicker object:
var widget = new CesiumViewerWidget({});
// place & start
widget.placeAt(options.divName);
widget.startup();
// override the base layer imagery providers
widget.baseLayerPicker.destroy();
var imageryLayers = widget.centralBody.getImageryLayers();
var providerViewModels =
myCreateImageryProviders(widget.dayImageUrl);
widget.baseLayerPicker = new
Cesium.BaseLayerPicker(widget.baseLayerPickerContainer, imageryLayers,
providerViewModels);
widget.baseLayerPicker.viewModel.selectedItem(providerViewModels[0]);
now this almost works - but the old drop-down menu remains in place, and
the new dropdown menu is put on top of it. this is despite the fact that
it seems in BaseLayerPicker.prototype.destory() provisions are taken to
clean the container element:
var container = this.container;
knockout.cleanNode(container);
container.removeChild(this._element);
- replace baseLayerPicker.viewModel :
as above, bust instead of creating anew BaseLayerPicker:
widget.baseLayerPicker.viewModel = new
Cesium.BaseLayerPickerViewModel(imageryLayers, providerViewModels);
this doesn't work
- replace CesiumViewerWidget.createImageryProviders
CesiumViewerWidget.createImageryProviders = myCreateImageryProviders;
this doesn't seem to have an effect
thus, what is the proper way to do this, if at all?
Akos