Check arguments passed to ol.geom.Polygon#setFlatCoordinates
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
goog.provide('ol.geom.Polygon');
|
goog.provide('ol.geom.Polygon');
|
||||||
|
|
||||||
|
goog.require('goog.asserts');
|
||||||
goog.require('ol.extent');
|
goog.require('ol.extent');
|
||||||
goog.require('ol.geom.GeometryType');
|
goog.require('ol.geom.GeometryType');
|
||||||
goog.require('ol.geom.LinearRing');
|
goog.require('ol.geom.LinearRing');
|
||||||
@@ -257,6 +258,13 @@ ol.geom.Polygon.prototype.setCoordinates = function(coordinates, opt_layout) {
|
|||||||
*/
|
*/
|
||||||
ol.geom.Polygon.prototype.setFlatCoordinates =
|
ol.geom.Polygon.prototype.setFlatCoordinates =
|
||||||
function(layout, flatCoordinates, ends) {
|
function(layout, flatCoordinates, ends) {
|
||||||
|
if (goog.isNull(flatCoordinates)) {
|
||||||
|
goog.asserts.assert(!goog.isNull(ends) && ends.length === 0);
|
||||||
|
} else if (ends.length === 0) {
|
||||||
|
goog.asserts.assert(flatCoordinates.length === 0);
|
||||||
|
} else {
|
||||||
|
goog.asserts.assert(flatCoordinates.length == ends[ends.length - 1]);
|
||||||
|
}
|
||||||
this.setFlatCoordinatesInternal(layout, flatCoordinates);
|
this.setFlatCoordinatesInternal(layout, flatCoordinates);
|
||||||
this.ends_ = ends;
|
this.ends_ = ends;
|
||||||
this.dispatchChangeEvent();
|
this.dispatchChangeEvent();
|
||||||
|
|||||||
Reference in New Issue
Block a user