Search in sources :

Example 16 with LayerOptions

use of ol.layer.LayerOptions in project gwt-ol3 by TDesjardins.

the class DemoUtils method createOsmLayer.

public static Base createOsmLayer() {
    XyzOptions osmSourceOptions = OLFactory.createOptions();
    Osm osmSource = new Osm(osmSourceOptions);
    LayerOptions osmLayerOptions = OLFactory.createOptions();
    osmLayerOptions.setSource(osmSource);
    return new Tile(osmLayerOptions);
}
Also used : XyzOptions(ol.source.XyzOptions) Osm(ol.source.Osm) Tile(ol.layer.Tile) LayerOptions(ol.layer.LayerOptions)

Example 17 with LayerOptions

use of ol.layer.LayerOptions in project gwt-ol3 by TDesjardins.

the class ArcGISExample method show.

/* (non-Javadoc)
     * @see de.desjardins.ol3.demo.client.example.Example#show() */
@Override
public void show(String exampleId) {
    ImageArcGisRestParams params = new ImageArcGisRestParams();
    params.showLayers("2");
    ImageArcGisRestOptions options = new ImageArcGisRestOptions();
    options.setUrl("https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StateCityHighway_USA/MapServer");
    options.setParams(params);
    options.setRatio(1f);
    ImageArcGisRest source = new ImageArcGisRest(options);
    LayerOptions layerOptions = OLFactory.createOptions();
    layerOptions.setSource(source);
    Image layer = new Image(layerOptions);
    // create a view
    View view = new View();
    Coordinate center = OLFactory.createCoordinate(-10997148, 4569099);
    view.setCenter(center);
    view.setZoom(4);
    // create the map
    MapOptions mapOptions = OLFactory.createOptions();
    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 : ImageArcGisRest(ol.source.ImageArcGisRest) ScaleLine(ol.control.ScaleLine) KeyboardPan(ol.interaction.KeyboardPan) Rotate(ol.control.Rotate) MapOptions(ol.MapOptions) Image(ol.layer.Image) LayerOptions(ol.layer.LayerOptions) View(ol.View) Coordinate(ol.Coordinate) KeyboardZoom(ol.interaction.KeyboardZoom) ImageArcGisRestParams(ol.source.ImageArcGisRestParams) Map(ol.Map) ImageArcGisRestOptions(ol.source.ImageArcGisRestOptions)

Example 18 with LayerOptions

use of ol.layer.LayerOptions in project gwt-ol3 by TDesjardins.

the class ConstrainedViewExample method show.

/* (non-Javadoc)
     * @see de.desjardins.ol3.demo.client.example.Example#show()
     */
@Override
public void show(String exampleId) {
    XyzOptions xyzOptions = OLFactory.createOptions();
    xyzOptions.setUrl("http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}");
    xyzOptions.setAttributions("Tiles &copy; <a href=\"http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer\">ArcGIS</a>");
    Xyz xyzSource = new Xyz(xyzOptions);
    LayerOptions xyzLayerOptions = OLFactory.createOptions();
    xyzLayerOptions.setSource(xyzSource);
    Tile xyzLayer = new Tile(xyzLayerOptions);
    // create a view
    View view = new View();
    Coordinate centerCoordinate = new Coordinate(-121.1, 47.5);
    Coordinate transformedCenterCoordinate = Projection.transform(centerCoordinate, "EPSG:4326", "EPSG:3857");
    view.setCenter(transformedCenterCoordinate);
    view.setZoom(12);
    // restrict zoom
    view.setMinZoom(11);
    view.setMaxZoom(14);
    // create the map
    MapOptions mapOptions = OLFactory.createOptions();
    mapOptions.setTarget(exampleId);
    mapOptions.setView(view);
    Map map = new Map(mapOptions);
    // restrict extent
    ViewOptions viewOptions = new ViewOptions();
    viewOptions.setCenter(map.getView().getCenter());
    viewOptions.setExtent(map.getView().calculateExtent(map.getSize()));
    viewOptions.setZoom(map.getView().getZoom());
    viewOptions.setMinZoom(map.getView().getMinZoom());
    viewOptions.setMaxZoom(map.getView().getMaxZoom());
    View restrictedView = new View(viewOptions);
    map.setView(restrictedView);
    ol.control.Attribution attributionControl = new ol.control.Attribution();
    attributionControl.setCollapsed(false);
    map.addControl(attributionControl);
    MousePosition mousePosition = new MousePosition();
    mousePosition.setCoordinateFormat(Coordinate.createStringXY(2));
    map.addControl(mousePosition);
    map.addLayer(xyzLayer);
}
Also used : XyzOptions(ol.source.XyzOptions) MapOptions(ol.MapOptions) ViewOptions(ol.ViewOptions) Tile(ol.layer.Tile) LayerOptions(ol.layer.LayerOptions) View(ol.View) MousePosition(ol.control.MousePosition) Coordinate(ol.Coordinate) Xyz(ol.source.Xyz) Map(ol.Map)

Example 19 with LayerOptions

use of ol.layer.LayerOptions in project gwt-ol3 by TDesjardins.

the class OsmExample method show.

/* (non-Javadoc)
     * @see de.desjardins.ol3.demo.client.example.Example#show()
     */
@Override
public void show(String exampleId) {
    // create a OSM-layer
    XyzOptions osmSourceOptions = OLFactory.createOptions();
    Osm osmSource = new Osm(osmSourceOptions);
    LayerOptions osmLayerOptions = OLFactory.createOptions();
    osmLayerOptions.setSource(osmSource);
    Tile osmLayer = new Tile(osmLayerOptions);
    // create debug layer
    TileDebugOptions tileDebugOptions = OLFactory.createOptions();
    tileDebugOptions.setProjection("EPSG:3857");
    tileDebugOptions.setTileGrid(osmSource.getTileGrid());
    TileDebug tileDebugSource = new TileDebug(tileDebugOptions);
    LayerOptions tileDebugLayerOptions = OLFactory.createOptions();
    tileDebugLayerOptions.setSource(tileDebugSource);
    Tile tileDebugLayer = new Tile(tileDebugLayerOptions);
    // create a view
    View view = new View();
    Coordinate centerCoordinate = OLFactory.createCoordinate(-0.1275, 51.507222);
    Coordinate transformedCenterCoordinate = Projection.transform(centerCoordinate, "EPSG:4326", "EPSG:3857");
    view.setCenter(transformedCenterCoordinate);
    view.setZoom(10);
    // create the map
    MapOptions mapOptions = OLFactory.createOptions();
    mapOptions.setTarget(exampleId);
    mapOptions.setView(view);
    Map map = new Map(mapOptions);
    map.addLayer(osmLayer);
    map.addLayer(tileDebugLayer);
    // add some controls
    map.addControl(OLFactory.createScaleLine());
    DemoUtils.addDefaultControls(map.getControls());
    Attribution attribution = new Attribution();
    attribution.setCollapsed(true);
    map.addControl(attribution);
    // add some interactions
    map.addInteraction(new KeyboardPan());
    map.addInteraction(new KeyboardZoom());
}
Also used : XyzOptions(ol.source.XyzOptions) KeyboardPan(ol.interaction.KeyboardPan) MapOptions(ol.MapOptions) Osm(ol.source.Osm) Tile(ol.layer.Tile) LayerOptions(ol.layer.LayerOptions) View(ol.View) Attribution(ol.control.Attribution) TileDebug(ol.source.TileDebug) Coordinate(ol.Coordinate) KeyboardZoom(ol.interaction.KeyboardZoom) TileDebugOptions(ol.source.TileDebugOptions) Map(ol.Map)

Example 20 with LayerOptions

use of ol.layer.LayerOptions in project gwt-ol3 by TDesjardins.

the class StaticImageExample method show.

/* (non-Javadoc)
     * @see de.desjardins.ol3.demo.client.example.Example#show()
     */
@Override
public void show(String exampleId) {
    ProjectionOptions projectionOptions = OLFactory.createOptions();
    Extent imageExtent = new Extent(0, 0, 1024, 968);
    projectionOptions.setCode("pixel");
    projectionOptions.setExtent(imageExtent);
    projectionOptions.setUnits("pixels");
    Projection projection = new Projection(projectionOptions);
    ImageStaticOptions imageStaticOptions = OLFactory.createOptions();
    imageStaticOptions.setUrl("http://imgs.xkcd.com/comics/online_communities.png");
    imageStaticOptions.setImageSize(new Size(1024, 968));
    imageStaticOptions.setImageExtent(imageExtent);
    imageStaticOptions.setProjection(projection);
    // create attribution
    imageStaticOptions.setAttributions("&copy; <a href=\"http://xkcd.com/license.html\">xkcd</a>");
    ImageStatic imageStatic = new ImageStatic(imageStaticOptions);
    LayerOptions layerOptions = OLFactory.createOptions();
    layerOptions.setSource(imageStatic);
    Image image = new Image(layerOptions);
    Collection<Base> layers = new Collection<Base>();
    layers.push(image);
    ViewOptions viewOptions = OLFactory.createOptions();
    viewOptions.setCenter(new Coordinate(500, 500));
    viewOptions.setProjection(projection);
    viewOptions.setZoom(2);
    View view = new View(viewOptions);
    MapOptions mapOptions = OLFactory.createOptions();
    mapOptions.setTarget(exampleId);
    mapOptions.setView(view);
    mapOptions.setLayers(layers);
    Map map = new Map(mapOptions);
    // add some controls
    DemoUtils.addDefaultControls(map.getControls());
    ol.control.Attribution attributionControl = new ol.control.Attribution();
    attributionControl.setCollapsed(false);
    map.addControl(attributionControl);
}
Also used : ImageStatic(ol.source.ImageStatic) Extent(ol.Extent) MapOptions(ol.MapOptions) Size(ol.Size) ViewOptions(ol.ViewOptions) Projection(ol.proj.Projection) Image(ol.layer.Image) LayerOptions(ol.layer.LayerOptions) View(ol.View) Base(ol.layer.Base) Coordinate(ol.Coordinate) Collection(ol.Collection) ProjectionOptions(ol.proj.ProjectionOptions) ImageStaticOptions(ol.source.ImageStaticOptions) Map(ol.Map)

Aggregations

LayerOptions (ol.layer.LayerOptions)23 Coordinate (ol.Coordinate)21 Map (ol.Map)21 MapOptions (ol.MapOptions)21 View (ol.View)21 Tile (ol.layer.Tile)18 XyzOptions (ol.source.XyzOptions)16 Osm (ol.source.Osm)14 ScaleLine (ol.control.ScaleLine)13 KeyboardPan (ol.interaction.KeyboardPan)12 KeyboardZoom (ol.interaction.KeyboardZoom)12 Collection (ol.Collection)8 Rotate (ol.control.Rotate)8 Base (ol.layer.Base)8 Attribution (ol.control.Attribution)6 MousePosition (ol.control.MousePosition)6 VectorLayerOptions (ol.layer.VectorLayerOptions)6 Projection (ol.proj.Projection)6 ViewOptions (ol.ViewOptions)5 Image (ol.layer.Image)5