use of ol.style.StyleOptions in project gwt-ol3 by TDesjardins.
the class MarkerExample method show.
/* (non-Javadoc)
* @see de.desjardins.ol3.demo.client.example.Example#show() */
@Override
public void show(String exampleId) {
// create a point
Coordinate coordinate1 = OLFactory.createCoordinate(4e6, 2e6);
Point point1 = new Point(coordinate1);
// create feature
FeatureOptions featureOptions = OLFactory.createOptions();
featureOptions.setGeometry(point1);
Feature feature = new Feature(featureOptions);
Collection<Feature> features = new Collection<Feature>();
features.push(feature);
// create source
VectorOptions vectorSourceOptions = OLFactory.createOptions();
vectorSourceOptions.setFeatures(features);
Vector vectorSource = new Vector(vectorSourceOptions);
// create style
StyleOptions styleOptions = new StyleOptions();
IconOptions iconOptions = new IconOptions();
iconOptions.setSrc("https://openlayers.org/en/v3.20.1/examples/data/icon.png");
Icon icon = new Icon(iconOptions);
styleOptions.setImage(icon);
Style style = new Style(styleOptions);
VectorLayerOptions vectorLayerOptions = OLFactory.createOptions();
vectorLayerOptions.setSource(vectorSource);
vectorLayerOptions.setStyle(style);
ol.layer.Vector vectorLayer = new ol.layer.Vector(vectorLayerOptions);
// create a OSM-layer
XyzOptions osmSourceOptions = OLFactory.createOptions();
Osm osmSource = new Osm(osmSourceOptions);
LayerOptions osmLayerOptions = OLFactory.createOptions();
osmLayerOptions.setSource(osmSource);
Tile osmLayer = new Tile(osmLayerOptions);
// create a view
View view = new View();
Coordinate centerCoordinate = OLFactory.createCoordinate(0, 0);
view.setCenter(centerCoordinate);
view.setZoom(2);
// create the map
MapOptions mapOptions = new MapOptions();
mapOptions.setTarget(exampleId);
mapOptions.setView(view);
Collection<Base> lstLayer = new Collection<Base>();
lstLayer.push(osmLayer);
lstLayer.push(vectorLayer);
mapOptions.setLayers(lstLayer);
Map map = new Map(mapOptions);
// add some controls
map.addControl(new ScaleLine());
DemoUtils.addDefaultControls(map.getControls());
// add some interactions
map.addInteraction(new KeyboardPan());
map.addInteraction(new KeyboardZoom());
map.addControl(new Rotate());
}
use of ol.style.StyleOptions in project gwt-ol3 by TDesjardins.
the class OLFactory method createStyle.
/**
* Creates a new {@link Style} style.
* @param text {@link Text}
* @return {@link Style}
*/
public static Style createStyle(Text text) {
StyleOptions styleOptions = createOptions();
styleOptions.setText(text);
return createStyle(styleOptions);
}
use of ol.style.StyleOptions in project gwt-ol3 by TDesjardins.
the class OLFactory method createStyle.
/**
* Creates a new {@link Style} style.
*
* @param stroke
* {@link Stroke}
* @return {@link Style}
*/
public static Style createStyle(Stroke stroke) {
StyleOptions styleOptions = createOptions();
styleOptions.setStroke(stroke);
return createStyle(styleOptions);
}
use of ol.style.StyleOptions in project gwt-ol3 by TDesjardins.
the class OLFactory method createStyle.
/**
* Creates a new {@link Style} style.
*
* @param image
* {@link ol.style.Image}
* @return {@link Style}
*/
public static Style createStyle(ol.style.Image image) {
StyleOptions styleOptions = createOptions();
styleOptions.setImage(image);
return createStyle(styleOptions);
}
use of ol.style.StyleOptions in project gwt-ol3 by TDesjardins.
the class OLFactory method createStyle.
/**
* Creates a new {@link Style} style.
*
* @param fill
* {@link Fill}
* @return {@link Style}
*/
public static Style createStyle(Fill fill) {
StyleOptions styleOptions = createOptions();
styleOptions.setFill(fill);
return createStyle(styleOptions);
}
Aggregations