Allow ol.geom.LinearRings to have null coordinates and add setFlatCoordinates
This commit is contained in:
@@ -50,8 +50,26 @@ ol.geom.LinearRing.prototype.getType = function() {
|
|||||||
*/
|
*/
|
||||||
ol.geom.LinearRing.prototype.setCoordinates =
|
ol.geom.LinearRing.prototype.setCoordinates =
|
||||||
function(coordinates, opt_layout) {
|
function(coordinates, opt_layout) {
|
||||||
this.setLayout(opt_layout, coordinates, 1);
|
if (goog.isNull(coordinates)) {
|
||||||
ol.geom.flat.deflateCoordinates(
|
this.setFlatCoordinates(ol.geom.GeometryLayout.XY, null);
|
||||||
this.flatCoordinates, 0, coordinates, this.stride);
|
} 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.GeometryLayout} layout Layout.
|
||||||
|
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
||||||
|
*/
|
||||||
|
ol.geom.LinearRing.prototype.setFlatCoordinates =
|
||||||
|
function(layout, flatCoordinates) {
|
||||||
|
this.setFlatCoordinatesInternal(layout, flatCoordinates);
|
||||||
this.dispatchChangeEvent();
|
this.dispatchChangeEvent();
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user