Add assert messages for all assertions up until ol.renderer.vector.
This commit is contained in:
@@ -59,7 +59,8 @@ goog.inherits(ol.geom.MultiLineString, ol.geom.SimpleGeometry);
|
||||
* @api stable
|
||||
*/
|
||||
ol.geom.MultiLineString.prototype.appendLineString = function(lineString) {
|
||||
goog.asserts.assert(lineString.getLayout() == this.layout);
|
||||
goog.asserts.assert(lineString.getLayout() == this.layout,
|
||||
'layout of lineString should match the layout');
|
||||
if (goog.isNull(this.flatCoordinates)) {
|
||||
this.flatCoordinates = lineString.getFlatCoordinates().slice();
|
||||
} else {
|
||||
@@ -164,7 +165,8 @@ ol.geom.MultiLineString.prototype.getEnds = function() {
|
||||
* @api stable
|
||||
*/
|
||||
ol.geom.MultiLineString.prototype.getLineString = function(index) {
|
||||
goog.asserts.assert(0 <= index && index < this.ends_.length);
|
||||
goog.asserts.assert(0 <= index && index < this.ends_.length,
|
||||
'index should be in between 0 and length of the this.ends_ array');
|
||||
if (index < 0 || this.ends_.length <= index) {
|
||||
return null;
|
||||
}
|
||||
@@ -285,11 +287,14 @@ ol.geom.MultiLineString.prototype.setCoordinates =
|
||||
ol.geom.MultiLineString.prototype.setFlatCoordinates =
|
||||
function(layout, flatCoordinates, ends) {
|
||||
if (goog.isNull(flatCoordinates)) {
|
||||
goog.asserts.assert(!goog.isNull(ends) && ends.length === 0);
|
||||
goog.asserts.assert(!goog.isNull(ends) && ends.length === 0,
|
||||
'ends cannot be null and ends.length should be 0');
|
||||
} else if (ends.length === 0) {
|
||||
goog.asserts.assert(flatCoordinates.length === 0);
|
||||
goog.asserts.assert(flatCoordinates.length === 0,
|
||||
'flatCoordinates should be an empty array');
|
||||
} else {
|
||||
goog.asserts.assert(flatCoordinates.length == ends[ends.length - 1]);
|
||||
goog.asserts.assert(flatCoordinates.length == ends[ends.length - 1],
|
||||
'length of flatCoordinates array should match the last value of ends');
|
||||
}
|
||||
this.setFlatCoordinatesInternal(layout, flatCoordinates);
|
||||
this.ends_ = ends;
|
||||
@@ -311,7 +316,8 @@ ol.geom.MultiLineString.prototype.setLineStrings = function(lineStrings) {
|
||||
layout = lineString.getLayout();
|
||||
} else {
|
||||
// FIXME better handle the case of non-matching layouts
|
||||
goog.asserts.assert(lineString.getLayout() == layout);
|
||||
goog.asserts.assert(lineString.getLayout() == layout,
|
||||
'layout of lineString should match layout');
|
||||
}
|
||||
goog.array.extend(flatCoordinates, lineString.getFlatCoordinates());
|
||||
ends.push(flatCoordinates.length);
|
||||
|
||||
Reference in New Issue
Block a user