Search in sources :

Example 1 with Extent

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

use of ol.Extent in project gwt-ol3 by TDesjardins.

the class TileWmsExample method show.

/*
	 * (non-Javadoc)
	 * 
	 * @see de.desjardins.ol3.demo.client.example.Example#show()
	 */
@Override
public void show(String exampleId) {
    TileWmsParams params = new TileWmsParams();
    params.setLayers("topp:states");
    params.setTiled(true);
    TileWmsOptions options = new TileWmsOptions();
    options.setUrl("https://ahocevar.com/geoserver/wms");
    options.setParams(params);
    options.setServerType(WmsServerType.GEOSERVER);
    TileWms source = new TileWms(options);
    Extent extent = new Extent(-13884991, 2870341, -7455066, 6338219);
    Tile layer = new Tile();
    layer.setExtent(extent);
    layer.setSource(source);
    Coordinate centerCoordinate = new Coordinate(-10997148, 4569099);
    View view = new View();
    view.setCenter(centerCoordinate);
    view.setZoom(4);
    // create the map
    MapOptions mapOptions = new MapOptions();
    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 : TileWmsOptions(ol.source.TileWmsOptions) ScaleLine(ol.control.ScaleLine) KeyboardPan(ol.interaction.KeyboardPan) Rotate(ol.control.Rotate) Extent(ol.Extent) MapOptions(ol.MapOptions) Tile(ol.layer.Tile) View(ol.View) Coordinate(ol.Coordinate) TileWms(ol.source.TileWms) KeyboardZoom(ol.interaction.KeyboardZoom) TileWmsParams(ol.source.TileWmsParams) Map(ol.Map)

Example 3 with Extent

use of ol.Extent in project gwt-ol3 by TDesjardins.

the class TileGridTest method testTileGrid.

public void testTileGrid() {
    injectUrlAndTest(() -> {
        TileGridOptions tileGridOptions = new TileGridOptions();
        tileGridOptions.setExtent(new Extent(1, 1, 50000, 50000));
        tileGridOptions.setMinZoom(0);
        tileGridOptions.setResolutions(new double[] { 4, 3, 2, 1 });
        assertNotNull(tileGridOptions);
        TileGrid tileGrid = new TileGrid(tileGridOptions);
        assertNotNull(tileGrid);
        assertEquals(0, tileGrid.getMinZoom());
        assertEquals(3, tileGrid.getMaxZoom());
        XyzTileGridOptions xyzTileGridOptions = new XyzTileGridOptions();
        xyzTileGridOptions.setMinZoom(0);
        xyzTileGridOptions.setMaxZoom(12);
        assertNotNull(xyzTileGridOptions);
        TileGrid tileGridXyz = OLFactory.createTileGridXYZ(xyzTileGridOptions);
        assertNotNull(tileGridXyz);
        assertEquals(0, tileGridXyz.getMinZoom());
        assertEquals(12, tileGridXyz.getMaxZoom());
    });
}
Also used : Extent(ol.Extent)

Example 4 with Extent

use of ol.Extent in project gwt-ol3 by TDesjardins.

the class FilterTest method testBbox.

public void testBbox() {
    injectUrlAndTest(() -> {
        Bbox bboxFilter = new Bbox("geometryName", new Extent(0, 0, 1, 1), "EPSG:3857");
        assertNotNull(bboxFilter);
        bboxFilter.setExtent(new Extent(1, 1, 2, 2));
        bboxFilter.setGeometryName("geometryAttribute");
        bboxFilter.setSrsName("EPSG:4326");
        Filter.bbox("geometryName", new Extent(0, 0, 100, 100), "EPSG:3857");
    });
}
Also used : Extent(ol.Extent)

Example 5 with Extent

use of ol.Extent in project gwt-ol3 by TDesjardins.

the class CircleTest method testCircle.

public void testCircle() {
    injectUrlAndTest(() -> {
        double radius = 5;
        Circle circle = new Circle(new Coordinate(10, 10), radius);
        assertNotNull(circle);
        assertTrue(circle instanceof Geometry);
        Coordinate coordinate = circle.getCenter();
        assertNotNull(coordinate);
        assert (10 == coordinate.getX());
        assert (10 == coordinate.getY());
        assert (radius == circle.getRadius());
        assertTrue(circle.intersectsExtent(new Extent(0, 0, 15, 15)));
        assertFalse(circle.intersectsExtent(new Extent(0, 0, 5, 5)));
    });
}
Also used : Coordinate(ol.Coordinate) Extent(ol.Extent)

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