Search in sources :

Example 1 with StyleMap

use of org.gwtopenmaps.openlayers.client.StyleMap in project geo-platform by geosdi.

the class PrintUtility method createRectangle.

public static Vector createRectangle(LonLat center, float scale, Map map, double sizeFactor, boolean portrait) {
    Bounds extent = getExtent(center, scale, map, sizeFactor, portrait);
    Geometry rect = extent.toGeometry();
    VectorFeature features = new VectorFeature(rect);
    Vector vectorLayer = new Vector(GPPrintWidget.PRINT_VECTOR_NAME);
    vectorLayer.addFeature(features);
    // Define a style for the vectors
    Style style = new Style();
    style.setFillColor("white");
    style.setStrokeColor("violet");
    style.setStrokeWidth(1);
    style.setStrokeDashstyle("dash");
    style.setFillOpacity(0.4);
    StyleMap styleMap = new StyleMap(style);
    vectorLayer.setStyleMap(styleMap);
    return vectorLayer;
}
Also used : Geometry(org.gwtopenmaps.openlayers.client.geometry.Geometry) VectorFeature(org.gwtopenmaps.openlayers.client.feature.VectorFeature) StyleMap(org.gwtopenmaps.openlayers.client.StyleMap) Bounds(org.gwtopenmaps.openlayers.client.Bounds) Style(org.gwtopenmaps.openlayers.client.Style) Vector(org.gwtopenmaps.openlayers.client.layer.Vector)

Aggregations

Bounds (org.gwtopenmaps.openlayers.client.Bounds)1 Style (org.gwtopenmaps.openlayers.client.Style)1 StyleMap (org.gwtopenmaps.openlayers.client.StyleMap)1 VectorFeature (org.gwtopenmaps.openlayers.client.feature.VectorFeature)1 Geometry (org.gwtopenmaps.openlayers.client.geometry.Geometry)1 Vector (org.gwtopenmaps.openlayers.client.layer.Vector)1