use of org.vaadin.addon.leaflet.LOpenStreetMapLayer in project v-leaflet by mstahv.
the class DynamicChanges method getTestComponent.
@Override
public Component getTestComponent() {
leafletMap = new LMap();
leafletMap.addBaseLayer(new LOpenStreetMapLayer(), "OSM");
leafletMap.addComponent(polyline);
leafletMap.zoomToExtent(new Bounds(polyline.getPoints()));
return leafletMap;
}
use of org.vaadin.addon.leaflet.LOpenStreetMapLayer in project v-leaflet by mstahv.
the class FontawesomeMarkerAndSVGInMarker method getTestComponent.
@Override
public Component getTestComponent() {
final VerticalLayout layout = new VerticalLayout();
layout.setMargin(true);
layout.setSizeFull();
// Getting my map.
LMap map = new LMap();
map.addComponent(new LOpenStreetMapLayer());
LMarker lMarker = new LMarker(61, 22);
lMarker.setIcon(FontAwesome.BEER);
lMarker.setPopup("FontAwesome marker popup with anchor beer");
lMarker.setPopupAnchor(new Point(0, -45));
lMarker.addStyleName("beer");
map.addComponent(lMarker);
LCircleMarker lCircleMarker = new LCircleMarker(61, 22, 2);
map.addComponent(lCircleMarker);
getPage().getStyles().add(".v-leaflet-custom-svg circle {stroke: blue;}");
LMarker lMarker2 = new LMarker(62, 23);
String svgCode = "<svg width=\"100\" height=\"100\">\n" + " <circle cx=\"50\" cy=\"50\" r=\"40\" stroke-width=\"4\" fill=\"yellow\" />\n" + "</svg>";
lMarker2.setIconSize(new Point(100, 100));
lMarker2.setIconAnchor(new Point(50, 50));
lMarker2.setPopup("Custom svg popup with anchor");
lMarker2.setPopupAnchor(new Point(0, -40));
lMarker2.addStyleName("v-leaflet-custom-svg");
lMarker2.setDivIcon(svgCode);
lMarker2.addClickListener(new LeafletClickListener() {
@Override
public void onClick(LeafletClickEvent event) {
Notification.show("Clicked " + event.getPoint().toString());
}
});
map.addComponent(lMarker2);
LCircleMarker lCircleMarker2 = new LCircleMarker(62, 23, 2);
map.addComponent(lCircleMarker2);
LMarker lMarker3 = new LMarker(60.1698560, 24.9383790);
lMarker3.setIcon(FontAwesome.GOOGLE);
lMarker3.setIconTextFill("#F00");
lMarker3.setIconPathFill("#666");
lMarker3.setIconPathStroke("#000");
lMarker3.setPopup("Configurable FontAwesome marker popup with anchor");
lMarker3.setPopupAnchor(new Point(0, -45));
map.addComponent(lMarker3);
LMarker svgDataUrlMarker = new LMarker(62, 24);
// Note that styling is not easy this way as css don't hook into images
svgDataUrlMarker.addStyleName("red");
svgDataUrlMarker.setIcon(new ExternalResource("data:image/svg+xml;utf8," + svgMarker.replace("FILLCOLOR", "red")));
svgDataUrlMarker.setIconSize(new Point(50, 50));
svgDataUrlMarker.setIconAnchor(new Point(25, 50));
map.addComponent(svgDataUrlMarker);
map.zoomToContent();
layout.addComponent(map);
return layout;
}
use of org.vaadin.addon.leaflet.LOpenStreetMapLayer in project v-leaflet by mstahv.
the class ImageLayerOnOSM method getTestComponent.
@Override
public Component getTestComponent() {
leafletMap.addLayer(new LOpenStreetMapLayer());
// Old map overlayed approximately over OSM map
ExternalResource url = new ExternalResource("https://www.lib.utexas.edu/maps/historical/newark_nj_1922.jpg");
LImageOverlay imageOverlay = new LImageOverlay(url, new Bounds(new Point(40.712216, -74.22655), new Point(40.773941, -74.12544)));
imageOverlay.setOpacity(0.5);
imageOverlay.setAttribution("University of Texas");
leafletMap.addLayer(imageOverlay);
leafletMap.zoomToContent();
return leafletMap;
}
Aggregations