use of ol.source.ImageWmsOptions in project gwt-ol3 by TDesjardins.
the class WmsExample method show.
/* (non-Javadoc)
* @see de.desjardins.ol3.demo.client.example.Example#show()
*/
@Override
public void show(String exampleId) {
ImageWmsParams imageWMSParams = OLFactory.createOptions();
imageWMSParams.setLayers("ch.swisstopo.geologie-geotechnik-gk500-gesteinsklassierung,ch.bafu.schutzgebiete-paerke_nationaler_bedeutung");
ImageWmsOptions imageWMSOptions = OLFactory.createOptions();
imageWMSOptions.setUrl("http://wms.geo.admin.ch/");
imageWMSOptions.setParams(imageWMSParams);
imageWMSOptions.setRatio(1.5f);
ImageWms imageWMSSource = new ImageWms(imageWMSOptions);
LayerOptions layerOptions = OLFactory.createOptions();
layerOptions.setSource(imageWMSSource);
Image wmsLayer = new Image(layerOptions);
// create a projection
ProjectionOptions projectionOptions = OLFactory.createOptions();
projectionOptions.setCode("EPSG:21781");
projectionOptions.setUnits("m");
Projection projection = new Projection(projectionOptions);
// create a view
ViewOptions viewOptions = OLFactory.createOptions();
viewOptions.setProjection(projection);
View view = new View(viewOptions);
Coordinate centerCoordinate = new Coordinate(660000, 190000);
view.setCenter(centerCoordinate);
view.setZoom(9);
// create the map
MapOptions mapOptions = OLFactory.createOptions();
mapOptions.setTarget(exampleId);
mapOptions.setView(view);
Map map = new Map(mapOptions);
map.addLayer(wmsLayer);
// 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());
}
Aggregations