use of org.cesiumjs.cs.scene.providers.IonImageryProvider in project gwt-cs by iSergio.
the class CustomBaseLayerPicker method buildPanel.
@Override
public void buildPanel() {
DivElement divElement = RootPanel.get().getElement().getOwnerDocument().createDivElement();
divElement.setId("baseLayerPickerContainer");
divElement.setPropertyString("style", "position:absolute;top:50px;right:42px;width:38px;height:38px;");
List<ProviderViewModel> imageryViewModels = new ArrayList<>();
ProviderViewModelOptions options = new ProviderViewModelOptions();
options.name = "Open\u00adStreet\u00adMap";
options.iconUrl = GWT.getModuleBaseURL() + "cs/CesiumUnminified/Widgets/Images/ImageryProviders/openStreetMap.png";
options.tooltip = "OpenStreetMap (OSM) is a collaborative project to create a free editable map of the world.\nhttp://www.openstreetmap.org";
options.imageryProviderCreationFunction = new ProviderViewModel.ImageryProviderCreationFunction() {
@Override
public ImageryProvider[] function() {
return new ImageryProvider[] { Cesium.createOpenStreetMapImageryProvider("https://a.tile.openstreetmap.org/") };
}
};
imageryViewModels.add(new ProviderViewModel(options));
options = new ProviderViewModelOptions();
options.name = "Earth at Night";
options.iconUrl = GWT.getModuleBaseURL() + "cs/CesiumUnminified/Widgets/Images/ImageryProviders/blueMarble.png";
options.tooltip = "The lights of cities and villages trace the outlines of civilization \n" + " in this global view of the Earth at night as seen by NASA/NOAA\\'s Suomi NPP satellite.";
options.imageryProviderCreationFunction = new ProviderViewModel.ImageryProviderCreationFunction() {
@Override
public ImageryProvider[] function() {
return new ImageryProvider[] { new IonImageryProvider(IonImageryProviderOptions.create(3812)) };
}
};
imageryViewModels.add(new ProviderViewModel(options));
options = new ProviderViewModelOptions();
options.name = "Natural Earth\u00a0II";
options.iconUrl = GWT.getModuleBaseURL() + "cs/CesiumUnminified/Widgets/Images/ImageryProviders/naturalEarthII.png";
options.tooltip = "The lights of cities and villages trace the outlines of civilization \n" + " in this global view of the Earth at night as seen by NASA/NOAA\\'s Suomi NPP satellite.";
options.imageryProviderCreationFunction = new ProviderViewModel.ImageryProviderCreationFunction() {
@Override
public ImageryProvider[] function() {
return new ImageryProvider[] { Cesium.createTileMapServiceImageryProvider(GWT.getModuleBaseURL() + "cs/CesiumUnminified/Assets/Textures/NaturalEarthII") };
}
};
imageryViewModels.add(new ProviderViewModel(options));
ViewerOptions viewerOptions = new ViewerOptions();
viewerOptions.imageryProvider = (ImageryProvider) JsObject.undefined();
viewerOptions.baseLayerPicker = false;
ViewerPanel csVPanel = new ViewerPanel(viewerOptions);
csVPanel.getViewer().scene().imageryLayers().removeAll(true);
csVPanel.getViewer().container().getFirstChildElement().appendChild(divElement);
BaseLayerPickerViewModelOptions baseLayerPickerOptions = BaseLayerPickerViewModelOptions.create(csVPanel.getViewer().scene().globe);
baseLayerPickerOptions.imageryProviderViewModels = imageryViewModels.toArray(new ProviderViewModel[imageryViewModels.size()]);
baseLayerPickerOptions.selectedImageryProviderViewModel = imageryViewModels.get(0);
BaseLayerPicker baseLayerPicker = new BaseLayerPicker(divElement, baseLayerPickerOptions);
contentPanel.add(new HTML("<p>Configure custom BaseLayerPicker widget.</p>"));
contentPanel.add(csVPanel);
initWidget(contentPanel);
}
Aggregations