Add assertions to pass the validation step.

This commit is contained in:
geonux
2015-07-06 13:49:42 +02:00
parent 29b1f0d55d
commit 314b04df7a

View File

@@ -623,6 +623,8 @@ ol.interaction.Draw.prototype.addToDrawing_ = function(event) {
*/
ol.interaction.Draw.prototype.removeLastPoint = function() {
var geometry = this.sketchFeature_.getGeometry();
goog.asserts.assertInstanceof(geometry, ol.geom.SimpleGeometry,
'geometry must be an ol.geom.SimpleGeometry');
var coordinates, sketchLineGeom;
if (this.mode_ === ol.interaction.DrawMode.LINE_STRING) {
coordinates = this.sketchCoords_;
@@ -632,6 +634,8 @@ ol.interaction.Draw.prototype.removeLastPoint = function() {
coordinates = this.sketchCoords_[0];
coordinates.splice(-2, 1);
sketchLineGeom = this.sketchLine_.getGeometry();
goog.asserts.assertInstanceof(sketchLineGeom, ol.geom.LineString,
'sketchLineGeom must be an ol.geom.LineString');
sketchLineGeom.setCoordinates(coordinates);
this.geometryFunction_(this.sketchCoords_, geometry);
}