use of org.gwtopenmaps.openlayers.client.control.ScaleLine in project kapua by eclipse.
the class DevicesMap method onRender.
protected void onRender(final Element parent, int index) {
super.onRender(parent, index);
setLayout(new FitLayout());
setBorders(false);
// create some MapOptions
MapOptions defaultMapOptions = new MapOptions();
defaultMapOptions.setNumZoomLevels(16);
defaultMapOptions.removeDefaultControls();
// Create a MapWidget
m_mapWidget = new MapWidget("500px", "500px", defaultMapOptions);
// create the mapquest base layer
OSMOptions osmOptions = new OSMOptions();
osmOptions.setAttribution("<p>Tiles Courtesy of <a href=\"http://www.mapquest.com/\" target=\"_blank\">MapQuest</a> <img src=\"http://developer.mapquest.com/content/osm/mq_logo.png\"></p> - © <a href=\"http://www.openstreetmap.org/copyright\" target=\"_blank\">OpenStreetMap</a> contributors");
OSM mapQuest = new OSM("Map", "http://otile1.mqcdn.com/tiles/1.0.0/map/${z}/${x}/${y}.png", osmOptions);
mapQuest.setIsBaseLayer(true);
// Create a marker layer to the current location marker
m_markerLayer = new Vector(MSGS.devices());
// add selection
SelectFeature selectFeature = new SelectFeature(m_markerLayer);
// And add them to the map
m_map = m_mapWidget.getMap();
m_map.addLayer(mapQuest);
m_map.addLayer(m_markerLayer);
m_map.addControl(selectFeature);
// Lets add some default controls to the map
// Display the scaleline
m_map.addControl(new Attribution());
// Display the scaleline
m_map.addControl(new Navigation());
// Display the scaleline
m_map.addControl(new DragPan());
// Display the scaleline
m_map.addControl(new PanZoom());
// Display the scaleline
m_map.addControl(new ScaleLine());
// Center and zoom to a location
// transform lonlat to OSM coordinate system
// Open a map centered in Amaro, Italy. Required
LonLat lonLat = new LonLat(13.097, 46.375);
lonLat.transform(DEFAULT_PROJECTION.getProjectionCode(), m_map.getProjection());
m_map.setCenter(lonLat, 12);
add(m_mapWidget);
// force the map to fall behind popups
m_mapWidget.getElement().getFirstChildElement().getStyle().setZIndex(0);
}
Aggregations