Search in sources :

Example 1 with ZoomToExtent

use of ol.control.ZoomToExtent in project gwt-ol3 by TDesjardins.

the class GraticuleExample method show.

/* (non-Javadoc)
     * @see de.desjardins.ol3.demo.client.example.Example#show()
     */
@Override
public void show(String exampleId) {
    // create an OSM-layer
    XyzOptions osmSourceOptions = OLFactory.createOptions();
    Osm osmSource = new Osm(osmSourceOptions);
    LayerOptions osmLayerOptions = OLFactory.createOptions();
    osmLayerOptions.setSource(osmSource);
    Tile osmLayer = new Tile(osmLayerOptions);
    // create a view
    View view = new View();
    Coordinate centerCoordinate = new Coordinate(1490463, 6894388);
    view.setCenter(centerCoordinate);
    view.setZoom(10);
    // create the map
    MapOptions mapOptions = OLFactory.createOptions();
    mapOptions.setTarget(exampleId);
    mapOptions.setView(view);
    Map map = new Map(mapOptions);
    map.addLayer(osmLayer);
    // add some controls
    map.addControl(new ZoomSlider());
    MousePosition mousePosition = new MousePosition();
    mousePosition.setCoordinateFormat(Coordinate.createStringXY(2));
    map.addControl(mousePosition);
    map.addControl(new ZoomToExtent());
    OverviewMap overviewMap = new OverviewMap();
    map.addControl(overviewMap);
    Graticule graticule = new Graticule();
    graticule.setMap(map);
}
Also used : XyzOptions(ol.source.XyzOptions) MapOptions(ol.MapOptions) OverviewMap(ol.control.OverviewMap) ZoomToExtent(ol.control.ZoomToExtent) Osm(ol.source.Osm) Tile(ol.layer.Tile) LayerOptions(ol.layer.LayerOptions) View(ol.View) MousePosition(ol.control.MousePosition) Graticule(ol.Graticule) Coordinate(ol.Coordinate) ZoomSlider(ol.control.ZoomSlider) OverviewMap(ol.control.OverviewMap) Map(ol.Map)

Example 2 with ZoomToExtent

use of ol.control.ZoomToExtent in project gwt-ol3 by TDesjardins.

the class DemoUtils method addDefaultControls.

/**
 * Creates some default controls.
 *
 * @param controls
 */
public static void addDefaultControls(final Collection<Control> controls) {
    controls.push(new FullScreen());
    controls.push(new ZoomSlider());
    MousePosition mousePosition = new MousePosition();
    mousePosition.setCoordinateFormat(Coordinate.createStringXY(5));
    controls.push(mousePosition);
    controls.push(new ZoomToExtent());
}
Also used : MousePosition(ol.control.MousePosition) ZoomToExtent(ol.control.ZoomToExtent) ZoomSlider(ol.control.ZoomSlider) FullScreen(ol.control.FullScreen)

Aggregations

MousePosition (ol.control.MousePosition)2 ZoomSlider (ol.control.ZoomSlider)2 ZoomToExtent (ol.control.ZoomToExtent)2 Coordinate (ol.Coordinate)1 Graticule (ol.Graticule)1 Map (ol.Map)1 MapOptions (ol.MapOptions)1 View (ol.View)1 FullScreen (ol.control.FullScreen)1 OverviewMap (ol.control.OverviewMap)1 LayerOptions (ol.layer.LayerOptions)1 Tile (ol.layer.Tile)1 Osm (ol.source.Osm)1 XyzOptions (ol.source.XyzOptions)1