Allow geometries to have null coordinates and add setFlatCoordinates

This commit is contained in:
Tom Payne
2013-12-03 16:59:52 +01:00
parent 580f7d2022
commit 1a9d19a2fb
13 changed files with 216 additions and 26 deletions

View File

@@ -57,8 +57,26 @@ ol.geom.MultiPoint.prototype.getType = function() {
*/
ol.geom.MultiPoint.prototype.setCoordinates =
function(coordinates, opt_layout) {
this.setLayout(opt_layout, coordinates, 1);
ol.geom.flat.deflateCoordinates(
this.flatCoordinates, 0, coordinates, this.stride);
if (goog.isNull(coordinates)) {
this.setFlatCoordinates(ol.geom.Layout.XY, null);
} else {
this.setLayout(opt_layout, coordinates, 1);
if (goog.isNull(this.flatCoordinates)) {
this.flatCoordinates = [];
}
this.flatCoordinates.length = ol.geom.flat.deflateCoordinates(
this.flatCoordinates, 0, coordinates, this.stride);
this.dispatchChangeEvent();
}
};
/**
* @param {ol.geom.Layout} layout Layout.
* @param {Array.<number>} flatCoordinates Flat coordinates.
*/
ol.geom.MultiPoint.prototype.setFlatCoordinates =
function(layout, flatCoordinates) {
this.setFlatCoordinatesInternal(layout, flatCoordinates);
this.dispatchChangeEvent();
};