Search in sources :

Example 1 with TileWmsParams

use of ol.source.TileWmsParams in project gwt-ol3 by TDesjardins.

the class TileWmsExample method show.

/*
	 * (non-Javadoc)
	 * 
	 * @see de.desjardins.ol3.demo.client.example.Example#show()
	 */
@Override
public void show(String exampleId) {
    TileWmsParams params = new TileWmsParams();
    params.setLayers("topp:states");
    params.setTiled(true);
    TileWmsOptions options = new TileWmsOptions();
    options.setUrl("https://ahocevar.com/geoserver/wms");
    options.setParams(params);
    options.setServerType(WmsServerType.GEOSERVER);
    TileWms source = new TileWms(options);
    Extent extent = new Extent(-13884991, 2870341, -7455066, 6338219);
    Tile layer = new Tile();
    layer.setExtent(extent);
    layer.setSource(source);
    Coordinate centerCoordinate = new Coordinate(-10997148, 4569099);
    View view = new View();
    view.setCenter(centerCoordinate);
    view.setZoom(4);
    // create the map
    MapOptions mapOptions = new MapOptions();
    mapOptions.setTarget(exampleId);
    mapOptions.setView(view);
    Map map = new Map(mapOptions);
    map.addLayer(layer);
    // add some controls
    map.addControl(new ScaleLine());
    DemoUtils.addDefaultControls(map.getControls());
    // add some interactions
    map.addInteraction(new KeyboardPan());
    map.addInteraction(new KeyboardZoom());
    map.addControl(new Rotate());
}
Also used : TileWmsOptions(ol.source.TileWmsOptions) ScaleLine(ol.control.ScaleLine) KeyboardPan(ol.interaction.KeyboardPan) Rotate(ol.control.Rotate) Extent(ol.Extent) MapOptions(ol.MapOptions) Tile(ol.layer.Tile) View(ol.View) Coordinate(ol.Coordinate) TileWms(ol.source.TileWms) KeyboardZoom(ol.interaction.KeyboardZoom) TileWmsParams(ol.source.TileWmsParams) Map(ol.Map)

Aggregations

Coordinate (ol.Coordinate)1 Extent (ol.Extent)1 Map (ol.Map)1 MapOptions (ol.MapOptions)1 View (ol.View)1 Rotate (ol.control.Rotate)1 ScaleLine (ol.control.ScaleLine)1 KeyboardPan (ol.interaction.KeyboardPan)1 KeyboardZoom (ol.interaction.KeyboardZoom)1 Tile (ol.layer.Tile)1 TileWms (ol.source.TileWms)1 TileWmsOptions (ol.source.TileWmsOptions)1 TileWmsParams (ol.source.TileWmsParams)1