use of ol.Coordinate in project gwt-ol3 by TDesjardins.
the class AnimationExample method show.
/* (non-Javadoc)
* @see de.desjardins.ol3.demo.client.example.Example#show() */
@Override
public void show(String exampleId) {
Coordinate centerCoordinate = new Coordinate(13.37, 52.52);
Coordinate transformedMidPoint = Projection.transform(centerCoordinate, DemoConstants.EPSG_4326, DemoConstants.EPSG_3857);
// create an OSM-layer
XyzOptions osmSourceOptions = new XyzOptions();
Osm osmSource = new Osm(osmSourceOptions);
LayerOptions osmLayerOptions = new LayerOptions();
osmLayerOptions.setSource(osmSource);
Tile osmLayer = new Tile(osmLayerOptions);
// create a view
View view = new View();
view.setCenter(transformedMidPoint);
view.setZoom(16);
// create the map
MapOptions mapOptions = new MapOptions();
mapOptions.setLoadTilesWhileAnimating(true);
mapOptions.setTarget(exampleId);
mapOptions.setView(view);
Collection<Base> lstLayer = new Collection<Base>();
lstLayer.push(osmLayer);
mapOptions.setLayers(lstLayer);
Map map = new Map(mapOptions);
// add some controls
map.addControl(new ScaleLine());
MousePositionOptions mousePositionOptions = new MousePositionOptions();
ProjectionOptions projectionOptions = new ProjectionOptions();
projectionOptions.setCode(DemoConstants.EPSG_4326);
mousePositionOptions.setProjection(new Projection(projectionOptions));
MousePosition mousePosition = new MousePosition(mousePositionOptions);
mousePosition.setCoordinateFormat(Coordinate.createStringXY(5));
map.addControl(mousePosition);
Coordinate tvTowerCoordinate = Projection.transform(new Coordinate(13.409, 52.52), DemoConstants.EPSG_4326, DemoConstants.EPSG_3857);
Coordinate pplaceCoordinate = Projection.transform(new Coordinate(13.377, 52.509), DemoConstants.EPSG_4326, DemoConstants.EPSG_3857);
Coordinate zooCoordinate = Projection.transform(new Coordinate(13.338, 52.508), DemoConstants.EPSG_4326, DemoConstants.EPSG_3857);
final List<Coordinate> coordinates = Arrays.asList(transformedMidPoint, tvTowerCoordinate, pplaceCoordinate, zooCoordinate);
Scheduler.get().scheduleFixedPeriod(() -> {
int index = getNextIndex(coordinates.size());
AnimationOptions panAnimationOptions = new AnimationOptions();
panAnimationOptions.setDuration(2000);
// Switch this to rotate the animation while animating.
// panAnimationOptions.setRotation(view.getRotation() + 2 * Math.PI);
panAnimationOptions.setCenter(coordinates.get(index));
view.animate(panAnimationOptions);
AnimationOptions zoomOutAnimationOptions = new AnimationOptions();
zoomOutAnimationOptions.setDuration(1000);
zoomOutAnimationOptions.setResolution(view.getResolution() + 4);
AnimationOptions zoomInAnimationOptions = new AnimationOptions();
zoomInAnimationOptions.setDuration(1000);
zoomInAnimationOptions.setResolution(view.getResolution());
view.animate(zoomOutAnimationOptions, zoomInAnimationOptions);
return true;
}, 6000);
}
use of ol.Coordinate in project gwt-ol3 by TDesjardins.
the class GeoJsonTest 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.Coordinate 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.Coordinate in project gwt-ol3 by TDesjardins.
the class PointTest method testPoint.
public void testPoint() {
injectUrlAndTest(() -> {
Point point = OLFactory.createPoint(1, 2);
assertNotNull(point);
assertTrue(point instanceof Geometry);
Coordinate coordinate = point.getCoordinates();
assertNotNull(coordinate);
assert (1 == coordinate.getX());
assert (2 == coordinate.getY());
});
}
use of ol.Coordinate in project gwt-ol3 by TDesjardins.
the class FilterTest method testIntersects.
public void testIntersects() {
injectUrlAndTest(() -> {
Intersects intersectsFilter = new Intersects("geometryName", new Circle(new Coordinate(0, 0), 2), "EPSG:3857");
assertNotNull(intersectsFilter);
Intersects intersectsFilter2 = Filter.intersects("geometryName", new Circle(new Coordinate(0, 0), 2), "EPSG:3857");
assertTrue(intersectsFilter2 instanceof Intersects);
});
}
Aggregations