Add new geometry layout option for polyline format

To be able to choose the geometry layout of the feature geometries created by
the format reader.

Default is `ol.geom.GeometryLayout.XY`
This commit is contained in:
Frederic Junod
2015-03-24 11:39:15 +01:00
parent ae2c9144e1
commit e669b20ed5
4 changed files with 47 additions and 9 deletions

View File

@@ -314,6 +314,25 @@ describe('ol.format.Polyline', function() {
expect(geometry.getFlatCoordinates()).to.eql(flatPoints);
});
it('parses XYZ linestring', function() {
var xyz = ol.format.Polyline.encodeDeltas([
38.500, -120.200, 100,
40.700, -120.950, 200,
43.252, -126.453, 20
], 3);
var format = new ol.format.Polyline({
geometryLayout: ol.geom.GeometryLayout.XYZ
});
var geometry = format.readGeometry(xyz);
expect(geometry.getLayout()).to.eql(ol.geom.GeometryLayout.XYZ);
expect(geometry.getCoordinates()).to.eql([
[-120.200, 38.500, 100],
[-120.950, 40.700, 200],
[-126.453, 43.252, 20]
]);
});
it('transforms and returns the expected geometry', function() {
var geometry = format.readGeometry(encodedFlatPoints, {
featureProjection: 'EPSG:3857'