Search in sources :

Example 1 with LFeatureGroup

use of org.vaadin.addon.leaflet.LFeatureGroup in project v-leaflet by mstahv.

the class BasicJtsTest method getTestComponent.

public Component getTestComponent() {
    leafletMap = new LMap();
    // Not creating a name -> not added to the
    lfg = new LFeatureGroup();
    // overlay controller
    Polygon poly = getPolygon();
    Collection<LeafletLayer> lPoly = JTSUtil.toLayers(poly);
    lfg.addComponent(lPoly);
    MultiPolygon multiPolygon = getMultiPolygon();
    Collection<LeafletLayer> lMultiPoly = JTSUtil.toLayers(multiPolygon);
    lfg.addComponent(lMultiPoly);
    LineString lineString = getLineString();
    Collection<LeafletLayer> lLine = JTSUtil.toLayers(lineString);
    lfg.addComponent(lLine);
    // MultiLineString multiLineString = getMultiLineString();
    // Collection<LeafletLayer> lMultiLine = JTSUtil.toLayers(multiLineString);
    // lfg.addComponent(lMultiLine);
    MultiPoint multiPoint = getMultiPoint();
    Collection<LeafletLayer> lMultiPoint = JTSUtil.toLayers(multiPoint);
    lfg.addComponent(lMultiPoint);
    Point point = getPoint();
    Collection<LeafletLayer> lPoint = JTSUtil.toLayers(point);
    lfg.addComponent(lPoint);
    leafletMap.setZoomLevel(5);
    leafletMap.setCenter(multiPolygon.getCentroid());
    leafletMap.addComponent(lfg);
    return leafletMap;
}
Also used : MultiPoint(com.vividsolutions.jts.geom.MultiPoint) LMap(org.vaadin.addon.leaflet.LMap) LFeatureGroup(org.vaadin.addon.leaflet.LFeatureGroup) MultiPolygon(com.vividsolutions.jts.geom.MultiPolygon) LineString(com.vividsolutions.jts.geom.LineString) MultiLineString(com.vividsolutions.jts.geom.MultiLineString) LeafletLayer(org.vaadin.addon.leaflet.LeafletLayer) Point(com.vividsolutions.jts.geom.Point) MultiPoint(com.vividsolutions.jts.geom.MultiPoint) MultiPolygon(com.vividsolutions.jts.geom.MultiPolygon) Polygon(com.vividsolutions.jts.geom.Polygon)

Example 2 with LFeatureGroup

use of org.vaadin.addon.leaflet.LFeatureGroup in project v-leaflet by mstahv.

the class PolygonWithHolesTest method getTestComponent.

public Component getTestComponent() {
    leafletMap = new LMap();
    // Not creating a name -> not added to the
    lfg = new LFeatureGroup();
    // overlay controller
    LPolygon polygon = new LPolygon();
    polygon.setPoints(new Point[] { new Point(0, 0), new Point(30, 30), new Point(30, 0) });
    polygon.setHoles(new Point[] { new Point(20, 20), new Point(25, 25), new Point(25, 20) });
    // non complete hole
    polygon.setHoles(new Point[] { new Point(5, 10), new Point(15, 15), new Point(15, 10) });
    polygon.setColor("green");
    lfg.addComponent(polygon);
    Polygon poly = getPolygon();
    Collection<LeafletLayer> lPoly = JTSUtil.toLayers(poly);
    lfg.addComponent(lPoly);
    leafletMap.setZoomLevel(5);
    leafletMap.addComponent(lfg);
    leafletMap.zoomToContent();
    return leafletMap;
}
Also used : LMap(org.vaadin.addon.leaflet.LMap) LFeatureGroup(org.vaadin.addon.leaflet.LFeatureGroup) LeafletLayer(org.vaadin.addon.leaflet.LeafletLayer) Point(org.vaadin.addon.leaflet.shared.Point) LPolygon(org.vaadin.addon.leaflet.LPolygon) Polygon(com.vividsolutions.jts.geom.Polygon) LPolygon(org.vaadin.addon.leaflet.LPolygon)

Aggregations

Polygon (com.vividsolutions.jts.geom.Polygon)2 LFeatureGroup (org.vaadin.addon.leaflet.LFeatureGroup)2 LMap (org.vaadin.addon.leaflet.LMap)2 LeafletLayer (org.vaadin.addon.leaflet.LeafletLayer)2 LineString (com.vividsolutions.jts.geom.LineString)1 MultiLineString (com.vividsolutions.jts.geom.MultiLineString)1 MultiPoint (com.vividsolutions.jts.geom.MultiPoint)1 MultiPolygon (com.vividsolutions.jts.geom.MultiPolygon)1 Point (com.vividsolutions.jts.geom.Point)1 LPolygon (org.vaadin.addon.leaflet.LPolygon)1 Point (org.vaadin.addon.leaflet.shared.Point)1