use of ol.Size in project gwt-ol3 by TDesjardins.
the class MapboxExample method show.
/* (non-Javadoc)
* @see de.desjardins.ol3.demo.client.example.Example#show()
*/
@Override
public void show(String exampleId) {
XyzOptions mapboxOptions = new XyzOptions();
mapboxOptions.setTileSize(new Size(512, 512));
mapboxOptions.setUrl("https://api.mapbox.com/styles/v1/mapbox/dark-v8/tiles/{z}/{x}/{y}?access_token=" + ACCESS_TOKEN);
mapboxOptions.setAttributions("© <a href='https://www.mapbox.com/about/maps/'>Mapbox</a> © <a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a>");
Xyz mapboxSource = new Xyz(mapboxOptions);
LayerOptions xyzLayerOptions = OLFactory.createOptions();
xyzLayerOptions.setSource(mapboxSource);
Tile mapboxLayer = new Tile(xyzLayerOptions);
// create a view
View view = new View();
Coordinate centerCoordinate = new Coordinate(1490463, 6894388);
view.setCenter(centerCoordinate);
view.setZoom(10);
// create the map
MapOptions mapOptions = new MapOptions();
mapOptions.setTarget(exampleId);
mapOptions.setView(view);
Map map = new Map(mapOptions);
ol.control.Attribution attributionControl = new ol.control.Attribution();
attributionControl.setCollapsed(false);
map.addControl(attributionControl);
map.addControl(new MousePosition());
map.addControl(DemoUtils.createMapboxLogo());
map.addLayer(mapboxLayer);
}
use of ol.Size 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("© <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);
}
Aggregations