Add MultiLineString GeoJSON reading

This commit is contained in:
Tom Payne
2013-11-08 03:08:39 +01:00
parent 4d02ecf1e8
commit 53963b0f6b

View File

@@ -8,6 +8,7 @@ goog.require('goog.asserts');
goog.require('goog.json');
goog.require('ol.Feature');
goog.require('ol.geom.LineString');
goog.require('ol.geom.MultiLineString');
goog.require('ol.geom.Point');
goog.require('ol.geom.Polygon');
@@ -42,6 +43,17 @@ ol.reader.GeoJSON.readLineStringGeometry_ = function(geometry) {
};
/**
* @param {GeoJSONGeometry} geometry Geometry.
* @private
* @return {ol.geom.MultiLineString} MultiLineString.
*/
ol.reader.GeoJSON.readMultiLineStringGeometry_ = function(geometry) {
goog.asserts.assert(geometry.type == 'MultiLineString');
return new ol.geom.MultiLineString(geometry.coordinates);
};
/**
* @param {GeoJSONGeometry} geometry Geometry.
* @private
@@ -135,7 +147,8 @@ ol.reader.GeoJSON.readString = function(string, callback, opt_obj) {
ol.reader.GeoJSON.GEOMETRY_READERS_ = {
'Point': ol.reader.GeoJSON.readPointGeometry_,
'LineString': ol.reader.GeoJSON.readLineStringGeometry_,
'Polygon': ol.reader.GeoJSON.readPolygonGeometry_
'Polygon': ol.reader.GeoJSON.readPolygonGeometry_,
'MultiLineString': ol.reader.GeoJSON.readMultiLineStringGeometry_
};