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());
}
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());
}
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());
});
}
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");
});
}
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)));
});
}
Aggregations