Search in sources :

Example 1 with ImageryLayer

use of org.cesiumjs.cs.scene.ImageryLayer in project gwt-cs by iSergio.

the class ImageryLayersSplit method buildPanel.

@Override
public void buildPanel() {
    ViewerOptions viewerOptions = new ViewerOptions();
    viewerOptions.imageryProvider = ArcGisMapServerImageryProvider.create("https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer");
    viewerOptions.baseLayerPicker = false;
    final ViewerPanel csVPanel = new ViewerPanel(viewerOptions);
    ImageryLayerCollection layers = csVPanel.getViewer().imageryLayers();
    TileMapServiceImageryProviderOptions tileMapServiceImageryProviderOptions = new TileMapServiceImageryProviderOptions();
    tileMapServiceImageryProviderOptions.url = "https://cesiumjs.org/blackmarble";
    tileMapServiceImageryProviderOptions.credit = Credit.create("Black Marble imagery courtesy NASA Earth Observatory");
    tileMapServiceImageryProviderOptions.flipXY = true;
    ImageryLayer blackMarble = layers.addImageryProvider(Cesium.createTileMapServiceImageryProvider(tileMapServiceImageryProviderOptions));
    blackMarble.splitDirection = ImagerySplitDirection.LEFT();
    csVPanel.getViewer().scene().imagerySplitPosition = 0.5;
    Slider slider = new Slider("Slider", 0, 100, 50);
    slider.setStep(1);
    slider.setWidth("100%");
    slider.addListener(new SliderListener() {

        @Override
        public void onStart(SliderEvent e) {
        // 
        }

        @Override
        public boolean onSlide(SliderEvent e) {
            Slider source = e.getSource();
            double value = source.getValue() / 100.;
            csVPanel.getViewer().scene().imagerySplitPosition = value;
            return true;
        }

        @Override
        public void onChange(SliderEvent e) {
        // 
        }

        @Override
        public void onStop(SliderEvent e) {
        // 
        }
    });
    AbsolutePanel aPanel = new AbsolutePanel();
    aPanel.add(csVPanel);
    aPanel.add(slider, 0, 5);
    contentPanel.add(aPanel);
    contentPanel.add(new HTML("<p>Use the split property to only show layers on one side of a slider.</p>"));
    initWidget(contentPanel);
}
Also used : ViewerPanel(org.cesiumjs.cs.widgets.ViewerPanel) SliderEvent(org.cleanlogic.showcase.client.examples.slider.SliderEvent) Slider(org.cleanlogic.showcase.client.examples.slider.Slider) ImageryLayer(org.cesiumjs.cs.scene.ImageryLayer) ViewerOptions(org.cesiumjs.cs.widgets.options.ViewerOptions) TileMapServiceImageryProviderOptions(org.cesiumjs.cs.scene.providers.options.TileMapServiceImageryProviderOptions) AbsolutePanel(com.google.gwt.user.client.ui.AbsolutePanel) ImageryLayerCollection(org.cesiumjs.cs.collections.ImageryLayerCollection) HTML(com.google.gwt.user.client.ui.HTML) SliderListener(org.cleanlogic.showcase.client.examples.slider.SliderListener)

Example 2 with ImageryLayer

use of org.cesiumjs.cs.scene.ImageryLayer in project gwt-cs by iSergio.

the class ImageryLayersManipulation method addBaseLayerOption.

private void addBaseLayerOption(String name, ImageryProvider imageryProvider) {
    ImageryLayer layer = null;
    if (imageryProvider == null) {
        layer = imageryLayers.get(0);
        selectedLayer = layer;
    } else {
        layer = new ImageryLayer(imageryProvider);
    }
    baseLayers.put(name, layer);
}
Also used : ImageryLayer(org.cesiumjs.cs.scene.ImageryLayer)

Example 3 with ImageryLayer

use of org.cesiumjs.cs.scene.ImageryLayer in project gwt-cs by iSergio.

the class ImageryLayersManipulation method buildPanel.

@Override
public void buildPanel() {
    ViewerOptions viewerOptions = new ViewerOptions();
    viewerOptions.baseLayerPicker = false;
    ViewerPanel csVPanel = new ViewerPanel(viewerOptions);
    imageryLayers = csVPanel.getViewer().imageryLayers();
    setupLayers();
    updateLayerList();
    _callback.onSuccess(null);
    HorizontalPanel baseLayersHPanel = new HorizontalPanel();
    baseLayersHPanel.setSpacing(5);
    baseLayersHPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    baseLayersHPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    final ListBox baseLayersLBox = new ListBox();
    baseLayersHPanel.add(baseLayersLBox);
    Slider baseLayersSlider = new Slider("baseLayersAlpha", 0, 100, 100);
    baseLayersSlider.setWidth("200px");
    baseLayersSlider.addListener(new MSliderListener());
    baseLayersHPanel.add(baseLayersSlider);
    baseLayersLBox.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent changeEvent) {
            ListBox source = (ListBox) changeEvent.getSource();
            ImageryLayer baseLayer = baseLayers.get(source.getSelectedValue());
            int activeLayerIndex = 0;
            int numLayers = layers.size();
            for (int i = 0; i < numLayers; ++i) {
                if (baseLayers.containsValue(layers.get(i))) {
                    activeLayerIndex = i;
                }
            }
            ImageryLayer activeLayer = layers.get(activeLayerIndex);
            float alpha = activeLayer.alpha;
            boolean show = activeLayer.show;
            imageryLayers.remove(activeLayer, false);
            imageryLayers.add(baseLayer, numLayers - activeLayerIndex - 1);
            baseLayer.show = show;
            baseLayer.alpha = alpha;
            updateLayerList();
            selectedLayer = baseLayer;
        }
    });
    Callback<Void, Void> cesiumCreated = new Callback<Void, Void>() {

        @Override
        public void onFailure(Void aVoid) {
        // 
        }

        @Override
        public void onSuccess(Void aVoid) {
            for (Map.Entry<String, ImageryLayer> entry : baseLayers.entrySet()) {
                baseLayersLBox.addItem(entry.getKey(), entry.getKey());
            }
        }
    };
    addCallback(cesiumCreated);
    contentPanel.add(new HTML("<p>Layer imagery from multiple sources, including WMS servers, Bing Maps, ArcGIS Online, OpenStreetMaps, and more, and adjust the alpha of each independently.</p>"));
    contentPanel.add(baseLayersHPanel);
    contentPanel.add(csVPanel);
    initWidget(contentPanel);
}
Also used : ViewerPanel(org.cesiumjs.cs.widgets.ViewerPanel) Slider(org.cleanlogic.showcase.client.examples.slider.Slider) ViewerOptions(org.cesiumjs.cs.widgets.options.ViewerOptions) Callback(com.google.gwt.core.client.Callback) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) ImageryLayer(org.cesiumjs.cs.scene.ImageryLayer) HashMap(java.util.HashMap) Map(java.util.Map)

Example 4 with ImageryLayer

use of org.cesiumjs.cs.scene.ImageryLayer in project gwt-cs by iSergio.

the class ImageryLayersManipulation method addAdditionalLayerOption.

private void addAdditionalLayerOption(String name, ImageryProvider imageryProvider, float alpha, boolean show) {
    ImageryLayer layer = imageryLayers.addImageryProvider(imageryProvider);
    layer.alpha = alpha;
    layer.show = show;
    additionalLayers.put(name, layer);
}
Also used : ImageryLayer(org.cesiumjs.cs.scene.ImageryLayer)

Example 5 with ImageryLayer

use of org.cesiumjs.cs.scene.ImageryLayer in project gwt-cs by iSergio.

the class ImageryLayers method buildPanel.

@Override
public void buildPanel() {
    ViewerOptions viewerOptions = new ViewerOptions();
    ArcGisMapServerImageryProviderOptions arcGisMapServerImageryProviderOptions = new ArcGisMapServerImageryProviderOptions();
    arcGisMapServerImageryProviderOptions.url = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer";
    viewerOptions.imageryProvider = new ArcGisMapServerImageryProvider(arcGisMapServerImageryProviderOptions);
    viewerOptions.baseLayerPicker = false;
    ViewerPanel csVPanel = new ViewerPanel(viewerOptions);
    ImageryLayerCollection layers = csVPanel.getViewer().imageryLayers();
    TileMapServiceImageryProviderOptions tileMapServiceImageryProviderOptions = new TileMapServiceImageryProviderOptions();
    tileMapServiceImageryProviderOptions.url = "https://cesiumjs.org/blackmarble";
    tileMapServiceImageryProviderOptions.credit = Credit.create("Black Marble imagery courtesy NASA Earth Observatory");
    tileMapServiceImageryProviderOptions.flipXY = true;
    ImageryLayer blackMarble = layers.addImageryProvider(Cesium.createTileMapServiceImageryProvider(tileMapServiceImageryProviderOptions));
    blackMarble.alpha = 0.5f;
    blackMarble.brightness = 2.0f;
    SingleTileImageryProviderOptions singleTileImageryProviderOptions = new SingleTileImageryProviderOptions();
    singleTileImageryProviderOptions.url = GWT.getModuleBaseURL() + "images/Cesium_Logo_overlay.png";
    singleTileImageryProviderOptions.rectangle = Rectangle.fromDegrees(-75.0, 28.0, -67.0, 29.75);
    layers.addImageryProvider(new SingleTileImageryProvider(singleTileImageryProviderOptions));
    contentPanel.add(new HTML("<p>Create imagery layers from multiple sources.</p>"));
    contentPanel.add(csVPanel);
    initWidget(contentPanel);
}
Also used : ViewerPanel(org.cesiumjs.cs.widgets.ViewerPanel) ImageryLayer(org.cesiumjs.cs.scene.ImageryLayer) ArcGisMapServerImageryProvider(org.cesiumjs.cs.scene.providers.ArcGisMapServerImageryProvider) ViewerOptions(org.cesiumjs.cs.widgets.options.ViewerOptions) ArcGisMapServerImageryProviderOptions(org.cesiumjs.cs.scene.providers.options.ArcGisMapServerImageryProviderOptions) SingleTileImageryProviderOptions(org.cesiumjs.cs.scene.providers.options.SingleTileImageryProviderOptions) TileMapServiceImageryProviderOptions(org.cesiumjs.cs.scene.providers.options.TileMapServiceImageryProviderOptions) SingleTileImageryProvider(org.cesiumjs.cs.scene.providers.SingleTileImageryProvider) ImageryLayerCollection(org.cesiumjs.cs.collections.ImageryLayerCollection) HTML(com.google.gwt.user.client.ui.HTML)

Aggregations

ImageryLayer (org.cesiumjs.cs.scene.ImageryLayer)5 ViewerPanel (org.cesiumjs.cs.widgets.ViewerPanel)3 ViewerOptions (org.cesiumjs.cs.widgets.options.ViewerOptions)3 HTML (com.google.gwt.user.client.ui.HTML)2 ImageryLayerCollection (org.cesiumjs.cs.collections.ImageryLayerCollection)2 TileMapServiceImageryProviderOptions (org.cesiumjs.cs.scene.providers.options.TileMapServiceImageryProviderOptions)2 Slider (org.cleanlogic.showcase.client.examples.slider.Slider)2 Callback (com.google.gwt.core.client.Callback)1 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)1 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)1 AbsolutePanel (com.google.gwt.user.client.ui.AbsolutePanel)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 ArcGisMapServerImageryProvider (org.cesiumjs.cs.scene.providers.ArcGisMapServerImageryProvider)1 SingleTileImageryProvider (org.cesiumjs.cs.scene.providers.SingleTileImageryProvider)1 ArcGisMapServerImageryProviderOptions (org.cesiumjs.cs.scene.providers.options.ArcGisMapServerImageryProviderOptions)1 SingleTileImageryProviderOptions (org.cesiumjs.cs.scene.providers.options.SingleTileImageryProviderOptions)1 SliderEvent (org.cleanlogic.showcase.client.examples.slider.SliderEvent)1 SliderListener (org.cleanlogic.showcase.client.examples.slider.SliderListener)1