use of org.vaadin.addon.leaflet.LOpenStreetMapLayer in project v-leaflet by mstahv.
the class ReadOnlyTest method getTestComponent.
@Override
public Component getTestComponent() {
leafletMap = new LMap();
leafletMap.setCenter(60.4525, 22.301);
leafletMap.setZoomLevel(10);
LOpenStreetMapLayer layer = new LOpenStreetMapLayer();
leafletMap.addBaseLayer(layer, "OSM");
leafletMap.addControl(new LZoom());
leafletMap.setReadOnly(true);
Button getStates = new Button("getStates", new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
StringBuilder sb = new StringBuilder("\nisDraggingEnabled() = ").append(leafletMap.isDraggingEnabled()).append("\nisBooxZoomEnabled() = ").append(leafletMap.isBoxZoomEnabled());
Notification.show("States", sb.toString(), Type.HUMANIZED_MESSAGE);
}
});
Button toggleReadOnly = new Button("toggle readonly", new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
leafletMap.setReadOnly(!leafletMap.isReadOnly());
}
});
VerticalLayout verticalLayout = new VerticalLayout(leafletMap, new HorizontalLayout(getStates, toggleReadOnly));
verticalLayout.setSizeFull();
verticalLayout.setExpandRatio(leafletMap, 1);
return verticalLayout;
}
use of org.vaadin.addon.leaflet.LOpenStreetMapLayer in project v-leaflet by mstahv.
the class SizeChangeInWindow method getTestComponent.
@Override
public Component getTestComponent() {
final LMap map = new LMap();
map.setCenter(50.06465, 19.94498);
map.addBaseLayer(new LOpenStreetMapLayer(), "OpenStreetMap");
map.setSizeFull();
Window window = new Window("Map window");
window.setContent(map);
window.setWidth("300px");
window.setHeight("300px");
getUI().addWindow(window);
return new Label("Use the window...");
}
use of org.vaadin.addon.leaflet.LOpenStreetMapLayer in project v-leaflet by mstahv.
the class TextOnMap method getTestComponent.
@Override
public Component getTestComponent() {
leafletMap = new LMap();
leafletMap.addLayer(new LOpenStreetMapLayer());
leafletMap.setCenter(0, 0);
leafletMap.setZoomLevel(2);
LMarker m = new LMarker(0, 0);
// <- this becomes's to div icon's class names
m.setStyleName("mycustomclassname");
m.setDivIcon("Hello <strong>world</strong>!");
// define the size for the html box
m.setIconSize(new Point(80, 20));
leafletMap.addLayer(m);
return leafletMap;
}
use of org.vaadin.addon.leaflet.LOpenStreetMapLayer in project v-leaflet by mstahv.
the class ZoomLimitTest method getTestComponent.
@Override
public Component getTestComponent() {
LOpenStreetMapLayer layer = new LOpenStreetMapLayer();
leafletMap.addBaseLayer(layer, "OSM");
leafletMap.setCenter(42.3625, -71.112);
leafletMap.setZoomLevel(15);
leafletMap.setMinZoom(MIN_ZOOM_LEVEL);
leafletMap.setMaxZoom(MAX_ZOOM_LEVEL);
leafletMap.addMoveEndListener(new LeafletMoveEndListener() {
@Override
public void onMoveEnd(LeafletMoveEndEvent event) {
updateZoomLabel();
}
});
return leafletMap;
}
use of org.vaadin.addon.leaflet.LOpenStreetMapLayer in project v-leaflet by mstahv.
the class ZoomToExtendOnInitilaRender method getTestComponent.
@Override
public Component getTestComponent() {
final double[] latitude = { 44.03664d, 43.961669d, 43.859999d };
final double[] longitude = { 11.161893d, 11.129769d, 11.061234d };
final VerticalLayout layout = new VerticalLayout();
layout.setMargin(true);
layout.setSizeFull();
// Getting my map.
LMap map = new LMap();
map.setControls(new ArrayList<Control>(Arrays.asList(Control.values())));
map.setSizeFull();
// Setting backgroud layer.
map.addBaseLayer(new LOpenStreetMapLayer(), "OSM");
// I am here.
LMarker myPositon = new LMarker(43.894367, 11.078185);
myPositon.setVisible(true);
map.addComponent(myPositon);
// Get random other point.
int idxOther = Math.min((int) (Math.random() * 3.d), 2);
// Put other point on map.
LMarker leafletMarker = new LMarker(latitude[idxOther], longitude[idxOther]);
map.addComponent(leafletMarker);
// Build map bounds.
Point[] mapPoints = { new Point(43.894367, 11.078185), new Point(latitude[idxOther], longitude[idxOther]) };
Bounds mapBounds = new Bounds(mapPoints);
// I'm expecting to see my map with two points.
map.setCenter(mapBounds);
map.zoomToExtent(mapBounds);
layout.addComponent(map);
return layout;
}
Aggregations