use of ol.Feature in project gwt-ol3 by TDesjardins.
the class WktTest method createTestFeature.
private Feature createTestFeature() {
Coordinate coordinate1 = new Coordinate(1, 1);
Coordinate coordinate2 = new Coordinate(5, 5);
Coordinate[] coordinates = { coordinate1, coordinate2 };
LineString lineString = new LineString(coordinates);
// Create feature
FeatureOptions featureOptions = new FeatureOptions();
featureOptions.setGeometry(lineString);
return new Feature(featureOptions);
}
use of ol.Feature in project gwt-ol3 by TDesjardins.
the class WktTest method testWktToFeatures.
public void testWktToFeatures() {
injectUrlAndTest(() -> {
String wkt = wktFormat.writeFeatures(createTestFeatures(), null);
assertNotNull(wkt);
Feature[] features;
features = wktFormat.readFeatures(wkt, null);
assertNotNull(features);
assertEquals(1, features.length);
features = splittingWktFormat.readFeatures(wkt, null);
assertNotNull(features);
assertEquals(2, features.length);
});
}
use of ol.Feature in project gwt-ol3 by TDesjardins.
the class WktTest method testWktToFeature.
public void testWktToFeature() {
injectUrlAndTest(() -> {
String wkt = wktFormat.writeFeature(createTestFeature(), null);
assertNotNull(wkt);
WktReadOptions readOptions = new WktReadOptions();
assertNotNull(readOptions);
Feature feature = wktFormat.readFeature(wkt, readOptions);
assertNotNull(feature);
});
}
use of ol.Feature in project gwt-ol3 by TDesjardins.
the class VectorTest method testVectorLayer.
@SuppressWarnings({ "static-method", "javadoc" })
public void testVectorLayer() {
injectUrlAndTest(() -> {
VectorLayerOptions vectorLayerOptions = new VectorLayerOptions();
assertNotNull(vectorLayerOptions);
Vector vectorLayer = new Vector(vectorLayerOptions);
assertTrue(vectorLayer instanceof Base);
assertTrue(vectorLayer instanceof Vector);
vectorLayer.setStyle(new Style());
assertTrue(vectorLayer.getStyle() instanceof Style);
assertTrue(vectorLayer.getStyles() instanceof Style[]);
Style[] styles = { new Style(), new Style() };
vectorLayer.setStyles(styles);
assertTrue(vectorLayer.getStyle() instanceof Style);
assertTrue(vectorLayer.getStyles() instanceof Style[]);
assertTrue(vectorLayer.getStyles().length == 2);
vectorLayer.setStyleFunction((Feature feature) -> {
return null;
});
assertTrue(vectorLayer.getStyle() == null);
assertTrue(vectorLayer.getStyleFunction() instanceof GenericFunction);
});
}
use of ol.Feature in project gwt-ol3 by TDesjardins.
the class GeoJsonTest method testGeoJsonToFeature.
public void testGeoJsonToFeature() {
injectUrlAndTest(() -> {
java.lang.Object geoJson = geoJsonFormat.writeFeatureObject(createTestFeature(), null);
// Convert Features from GeoJSON
Feature featureGeoJson = geoJsonFormat.readFeature(geoJson, null);
assertNotNull(featureGeoJson);
});
}
Aggregations