Search in sources :

Example 6 with Extent

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

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