Search in sources :

Example 1 with Image

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

the class MapGuideExample method show.

/* (non-Javadoc)
     * @see de.desjardins.ol3.demo.client.example.Example#show()
     */
@Override
public void show(String exampleId) {
    // create a projection
    Projection projection = Projection.get("EPSG:4326");
    // create a MapGuide params
    ImageMapGuideParams imageMapGuideParams = new ImageMapGuideParams();
    imageMapGuideParams.setFormat("PNG");
    imageMapGuideParams.setMapDefinition("Library://Public/Samples/Sheboygan/Maps/Sheboygan.MapDefinition");
    imageMapGuideParams.setUserName("OpenLayers");
    imageMapGuideParams.setPassword("OpenLayers");
    // create a MapGuide image
    ImageMapGuideOptions imageMapGuideOptions = new ImageMapGuideOptions();
    imageMapGuideOptions.setParams(imageMapGuideParams);
    imageMapGuideOptions.setUrl("http://www.buoyshark.com/mapguide/mapagent/mapagent.fcgi?");
    imageMapGuideOptions.setUseOverlay(false);
    imageMapGuideOptions.setMetersPerUnit(111319.4908d);
    imageMapGuideOptions.setRatio(2.0f);
    ImageMapGuide imageMapGuideSource = new ImageMapGuide(imageMapGuideOptions);
    LayerOptions layerOptions = new LayerOptions();
    Extent bounds = new Extent(-87.865114442365922d, 43.665065564837931d, -87.595394059497067d, 43.823852564430069d);
    layerOptions.setExtent(bounds);
    layerOptions.setSource(imageMapGuideSource);
    Image mapGuideLayer = new Image(layerOptions);
    // create a view
    ViewOptions viewOptions = new ViewOptions();
    viewOptions.setProjection(projection);
    viewOptions.setZoom(12.0d);
    Coordinate centerCoordinate = new Coordinate(-87.7302542509315d, 43.744459064634d);
    viewOptions.setCenter(centerCoordinate);
    View view = new View(viewOptions);
    // create the map
    MapOptions mapOptions = new MapOptions();
    mapOptions.setTarget(exampleId);
    mapOptions.setView(view);
    Collection<Base> lstLayer = new Collection<Base>();
    lstLayer.push(mapGuideLayer);
    mapOptions.setLayers(lstLayer);
    Map map = new Map(mapOptions);
    // 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 : ScaleLine(ol.control.ScaleLine) KeyboardPan(ol.interaction.KeyboardPan) Rotate(ol.control.Rotate) Extent(ol.Extent) MapOptions(ol.MapOptions) ViewOptions(ol.ViewOptions) Projection(ol.proj.Projection) Image(ol.layer.Image) LayerOptions(ol.layer.LayerOptions) View(ol.View) ImageMapGuideParams(ol.source.ImageMapGuideParams) Base(ol.layer.Base) ImageMapGuideOptions(ol.source.ImageMapGuideOptions) ImageMapGuide(ol.source.ImageMapGuide) Coordinate(ol.Coordinate) KeyboardZoom(ol.interaction.KeyboardZoom) Collection(ol.Collection) Map(ol.Map)

Example 2 with Image

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

the class RasterExample method show.

/*
     * (non-Javadoc)
     * @see de.desjardins.ol3.demo.client.example.Example#show()
     */
@Override
public void show(String exampleId) {
    XyzOptions osmSourceOptions = OLFactory.createOptions();
    osmSourceOptions.setCrossOrigin("Anonymous");
    Osm osmSource = new Osm(osmSourceOptions);
    LayerOptions osmLayerOptions = OLFactory.createOptions();
    osmLayerOptions.setSource(osmSource);
    // create OSM layer only for background and attribution
    Tile osmLayer = new Tile(osmLayerOptions);
    // create raster source
    Raster raster = getRasterSource(osmSource, RasterOperationType.PIXEL);
    LayerOptions layerOptions = OLFactory.createOptions();
    layerOptions.setSource(raster);
    Image image = new Image(layerOptions);
    Collection<Base> layers = new Collection<>();
    layers.push(osmLayer);
    layers.push(image);
    View view = new View();
    Coordinate centerCoordinate = new Coordinate(-0.1275, 51.507222);
    Coordinate transformedCenterCoordinate = Projection.transform(centerCoordinate, DemoConstants.EPSG_4326, DemoConstants.EPSG_3857);
    view.setCenter(transformedCenterCoordinate);
    view.setZoom(10);
    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());
}
Also used : XyzOptions(ol.source.XyzOptions) MapOptions(ol.MapOptions) Raster(ol.source.Raster) Osm(ol.source.Osm) Tile(ol.layer.Tile) Image(ol.layer.Image) LayerOptions(ol.layer.LayerOptions) View(ol.View) Base(ol.layer.Base) Coordinate(ol.Coordinate) Collection(ol.Collection) Map(ol.Map)

Example 3 with Image

use of ol.layer.Image 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());
}
Also used : ScaleLine(ol.control.ScaleLine) KeyboardPan(ol.interaction.KeyboardPan) ImageWmsOptions(ol.source.ImageWmsOptions) Rotate(ol.control.Rotate) MapOptions(ol.MapOptions) ViewOptions(ol.ViewOptions) Projection(ol.proj.Projection) Image(ol.layer.Image) LayerOptions(ol.layer.LayerOptions) View(ol.View) Coordinate(ol.Coordinate) KeyboardZoom(ol.interaction.KeyboardZoom) ImageWmsParams(ol.source.ImageWmsParams) ProjectionOptions(ol.proj.ProjectionOptions) Map(ol.Map) ImageWms(ol.source.ImageWms)

Example 4 with Image

use of ol.layer.Image 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 5 with Image

use of ol.layer.Image 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

Coordinate (ol.Coordinate)5 Map (ol.Map)5 MapOptions (ol.MapOptions)5 View (ol.View)5 Image (ol.layer.Image)5 LayerOptions (ol.layer.LayerOptions)5 Collection (ol.Collection)3 ViewOptions (ol.ViewOptions)3 Rotate (ol.control.Rotate)3 ScaleLine (ol.control.ScaleLine)3 KeyboardPan (ol.interaction.KeyboardPan)3 KeyboardZoom (ol.interaction.KeyboardZoom)3 Base (ol.layer.Base)3 Projection (ol.proj.Projection)3 Extent (ol.Extent)2 ProjectionOptions (ol.proj.ProjectionOptions)2 Size (ol.Size)1 Tile (ol.layer.Tile)1 ImageArcGisRest (ol.source.ImageArcGisRest)1 ImageArcGisRestOptions (ol.source.ImageArcGisRestOptions)1