use of org.vaadin.addon.leaflet.LCircleMarker in project v-leaflet by mstahv.
the class LayerOrdering method createMarker.
private LCircleMarker createMarker(String color, int x, int y, int r) {
final LCircleMarker lCircleMarker;
lCircleMarker = new LCircleMarker(x, y, r);
lCircleMarker.setFillOpacity(1.0);
lCircleMarker.setColor(color);
lCircleMarker.setFillColor(color);
buttons.addComponent(new Button(color + " to top", new Button.ClickListener() {
@Override
public void buttonClick(Button.ClickEvent event) {
lCircleMarker.bringToFront();
}
}));
return lCircleMarker;
}
use of org.vaadin.addon.leaflet.LCircleMarker in project v-leaflet by mstahv.
the class TransparentMap method getTestComponent.
@Override
public Component getTestComponent() {
Page.getCurrent().getStyles().add(".v-leaflet .leaflet-container {background: yellow;}");
leafletMap = new LMap();
leafletMap.setWidth("300px");
leafletMap.setHeight("300px");
leafletMap.setCenter(0, 0);
leafletMap.setZoomLevel(2);
LPolyline lPolyline = new LPolyline(new Point(-30, -30), new Point(0, 30), new Point(30, 0));
lPolyline.setColor("red");
lPolyline.setFill(true);
lPolyline.getStyle().setFillOpacity(1.0);
leafletMap.addLayer(lPolyline);
LCircleMarker lCircleMarker = new LCircleMarker(30, 30, 40);
lCircleMarker.getStyle().setFillOpacity(0.05);
leafletMap.addLayer(lCircleMarker);
return leafletMap;
}
use of org.vaadin.addon.leaflet.LCircleMarker 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;
}
Aggregations