Add assertions to pass the validation step.
This commit is contained in:
@@ -623,6 +623,8 @@ ol.interaction.Draw.prototype.addToDrawing_ = function(event) {
|
|||||||
*/
|
*/
|
||||||
ol.interaction.Draw.prototype.removeLastPoint = function() {
|
ol.interaction.Draw.prototype.removeLastPoint = function() {
|
||||||
var geometry = this.sketchFeature_.getGeometry();
|
var geometry = this.sketchFeature_.getGeometry();
|
||||||
|
goog.asserts.assertInstanceof(geometry, ol.geom.SimpleGeometry,
|
||||||
|
'geometry must be an ol.geom.SimpleGeometry');
|
||||||
var coordinates, sketchLineGeom;
|
var coordinates, sketchLineGeom;
|
||||||
if (this.mode_ === ol.interaction.DrawMode.LINE_STRING) {
|
if (this.mode_ === ol.interaction.DrawMode.LINE_STRING) {
|
||||||
coordinates = this.sketchCoords_;
|
coordinates = this.sketchCoords_;
|
||||||
@@ -632,6 +634,8 @@ ol.interaction.Draw.prototype.removeLastPoint = function() {
|
|||||||
coordinates = this.sketchCoords_[0];
|
coordinates = this.sketchCoords_[0];
|
||||||
coordinates.splice(-2, 1);
|
coordinates.splice(-2, 1);
|
||||||
sketchLineGeom = this.sketchLine_.getGeometry();
|
sketchLineGeom = this.sketchLine_.getGeometry();
|
||||||
|
goog.asserts.assertInstanceof(sketchLineGeom, ol.geom.LineString,
|
||||||
|
'sketchLineGeom must be an ol.geom.LineString');
|
||||||
sketchLineGeom.setCoordinates(coordinates);
|
sketchLineGeom.setCoordinates(coordinates);
|
||||||
this.geometryFunction_(this.sketchCoords_, geometry);
|
this.geometryFunction_(this.sketchCoords_, geometry);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user