See: Description
Package | Description |
---|---|
net.java.html.leaflet |
Leaflet API for Java built around the
Map class. |
net.java.html.leaflet.event |
Listeners and events for the leaflet API
|
This is Java version of leaflet library for rendering of mobile friendly interactive maps. The API has been designed by students of Johannes Kepler University of Linz (Andreas Grimmer, Christoph Sperl, Stefan Wurzinger) as part of their 2015 API Design course. The API has been adopted and is distributed as part of the DukeScript project. Here is a sample code to help you relalize where the Johannes Kepler University is:
// Create a map zoomed to Linz.MapOptions
mapOptions = newMapOptions
() .setCenter(new LatLng(48.336614, 14.319305)) .setZoom(15); finalMap
map = newMap
("map", mapOptions); // add a tile layer to the mapTileLayerOptions
tlo = newTileLayerOptions
(); tlo.setAttribution("Map data © <a href='http://www.thunderforest.com/opencyclemap/'>OpenCycleMap</a> contributors, " + "<a href='http://creativecommons.org/licenses/by-sa/2.0/'>CC-BY-SA</a>, " + "Imagery © <a href='http://www.thunderforest.com/'>Thunderforest</a>"); tlo.setMaxZoom(18);TileLayer
layer = newTileLayer
("http://{s}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png", tlo); map.addLayer(layer); // Add a polygon. When you click on the polygon a popup shows upPolygon
polygonLayer = newPolygon
(new LatLng[] { newLatLng
(48.335067, 14.320660), newLatLng
(48.337335, 14.323642), newLatLng
(48.335238, 14.328942), newLatLng
(48.333883, 14.327612) }); polygonLayer.addMouseListener(MouseEvent
.Type.CLICK, newMouseListener
() {@Override
public void onEvent(MouseEvent ev) {PopupOptions
popupOptions = newPopupOptions
().setMaxWidth(400);Popup
popup = newPopup
(popupOptions); popup.setLatLng(ev.getLatLng()); popup.setContent("The Leaflet API for Java has been created here!"); popup.openOn(map); } }); map.addLayer(polygonLayer);
Copyright © 2017. All rights reserved.