use of ol.control.Attribution in project gwt-ol3 by TDesjardins.
the class OverlayExample method show.
/* (non-Javadoc)
* @see de.desjardins.ol3.demo.client.example.Example#show()
*/
@Override
public void show(String exampleId) {
// create a OSM-layer
XyzOptions osmSourceOptions = OLFactory.createOptions();
Osm osmSource = new Osm(osmSourceOptions);
LayerOptions osmLayerOptions = OLFactory.createOptions();
osmLayerOptions.setSource(osmSource);
Tile osmLayer = new Tile(osmLayerOptions);
// create a view
View view = new View();
Coordinate centerCoordinate = OLFactory.createCoordinate(2.3, 51.507222);
Coordinate transformedCenterCoordinate = Projection.transform(centerCoordinate, "EPSG:4326", "EPSG:3857");
view.setCenter(transformedCenterCoordinate);
view.setZoom(10);
// create the map
MapOptions mapOptions = OLFactory.createOptions();
mapOptions.setTarget(exampleId);
mapOptions.setView(view);
Map map = new Map(mapOptions);
map.addLayer(osmLayer);
// add some controls
map.addControl(OLFactory.createScaleLine());
DemoUtils.addDefaultControls(map.getControls());
Attribution attribution = new Attribution();
attribution.setCollapsed(true);
map.addControl(attribution);
// add some interactions
map.addInteraction(OLFactory.createKeyboardPan());
map.addInteraction(OLFactory.createKeyboardZoom());
DivElement overlay = Document.get().createDivElement();
overlay.setClassName("overlay-font");
overlay.setInnerText("Created with GWT SDK " + GWT.getVersion());
OverlayOptions overlayOptions = OLFactory.createOptions();
overlayOptions.setElement(overlay);
overlayOptions.setPosition(transformedCenterCoordinate);
overlayOptions.setOffset(OLFactory.createPixel(-300, 0));
map.addOverlay(new Overlay(overlayOptions));
}
use of ol.control.Attribution in project gwt-ol3 by TDesjardins.
the class OsmExample method show.
/* (non-Javadoc)
* @see de.desjardins.ol3.demo.client.example.Example#show()
*/
@Override
public void show(String exampleId) {
// create a OSM-layer
XyzOptions osmSourceOptions = OLFactory.createOptions();
Osm osmSource = new Osm(osmSourceOptions);
LayerOptions osmLayerOptions = OLFactory.createOptions();
osmLayerOptions.setSource(osmSource);
Tile osmLayer = new Tile(osmLayerOptions);
// create debug layer
TileDebugOptions tileDebugOptions = OLFactory.createOptions();
tileDebugOptions.setProjection("EPSG:3857");
tileDebugOptions.setTileGrid(osmSource.getTileGrid());
TileDebug tileDebugSource = new TileDebug(tileDebugOptions);
LayerOptions tileDebugLayerOptions = OLFactory.createOptions();
tileDebugLayerOptions.setSource(tileDebugSource);
Tile tileDebugLayer = new Tile(tileDebugLayerOptions);
// create a view
View view = new View();
Coordinate centerCoordinate = OLFactory.createCoordinate(-0.1275, 51.507222);
Coordinate transformedCenterCoordinate = Projection.transform(centerCoordinate, "EPSG:4326", "EPSG:3857");
view.setCenter(transformedCenterCoordinate);
view.setZoom(10);
// create the map
MapOptions mapOptions = OLFactory.createOptions();
mapOptions.setTarget(exampleId);
mapOptions.setView(view);
Map map = new Map(mapOptions);
map.addLayer(osmLayer);
map.addLayer(tileDebugLayer);
// add some controls
map.addControl(OLFactory.createScaleLine());
DemoUtils.addDefaultControls(map.getControls());
Attribution attribution = new Attribution();
attribution.setCollapsed(true);
map.addControl(attribution);
// add some interactions
map.addInteraction(new KeyboardPan());
map.addInteraction(new KeyboardZoom());
}
use of ol.control.Attribution in project gwt-ol3 by TDesjardins.
the class GpxExample method show.
/* (non-Javadoc)
* @see de.desjardins.ol3.demo.client.example.Example#show()
*/
@Override
public void show(String exampleId) {
// create a OSM-layer
Osm osmSource = new Osm();
LayerOptions osmLayerOptions = OLFactory.createOptions();
osmLayerOptions.setSource(osmSource);
Tile osmLayer = new Tile(osmLayerOptions);
// create a GPX vector layer
VectorOptions vectorOptions = new VectorOptions();
vectorOptions.setUrl("https://openlayers.org/en/v4.6.4/examples/data/gpx/fells_loop.gpx");
vectorOptions.setFormat(new Gpx());
ol.source.Vector vectorSource = new ol.source.Vector(vectorOptions);
VectorLayerOptions vectorLayerOptions = new VectorLayerOptions();
vectorLayerOptions.setSource(vectorSource);
ol.layer.Vector gpxLayer = new ol.layer.Vector(vectorLayerOptions);
// create a view
View view = new View();
Coordinate center = new Coordinate(-7916041.528716288, 5228379.045749711);
view.setCenter(center);
view.setZoom(12);
// create the map
MapOptions mapOptions = OLFactory.createOptions();
mapOptions.setTarget(exampleId);
mapOptions.setView(view);
Map map = new Map(mapOptions);
map.addLayer(osmLayer);
map.addLayer(gpxLayer);
// add some controls
map.addControl(new ScaleLine());
DemoUtils.addDefaultControls(map.getControls());
Attribution attribution = new Attribution();
attribution.setCollapsed(true);
map.addControl(attribution);
// add some interactions
map.addInteraction(new KeyboardPan());
map.addInteraction(new KeyboardZoom());
}
Aggregations