Add assert messages for all assertions up until ol.renderer.vector.
This commit is contained in:
@@ -54,7 +54,7 @@ ol.interaction.DoubleClickZoom.handleEvent = function(mapBrowserEvent) {
|
||||
var anchor = mapBrowserEvent.coordinate;
|
||||
var delta = browserEvent.shiftKey ? -this.delta_ : this.delta_;
|
||||
var view = map.getView();
|
||||
goog.asserts.assert(!goog.isNull(view));
|
||||
goog.asserts.assert(!goog.isNull(view), 'view should not be null');
|
||||
ol.interaction.Interaction.zoomByDelta(
|
||||
map, view, delta, anchor, this.duration_);
|
||||
mapBrowserEvent.preventDefault();
|
||||
|
||||
@@ -98,13 +98,14 @@ ol.interaction.DragAndDrop.prototype.handleDrop_ = function(event) {
|
||||
*/
|
||||
ol.interaction.DragAndDrop.prototype.handleResult_ = function(file, result) {
|
||||
var map = this.getMap();
|
||||
goog.asserts.assert(!goog.isNull(map));
|
||||
goog.asserts.assert(!goog.isNull(map), 'map should not be null');
|
||||
var projection = this.projection_;
|
||||
if (goog.isNull(projection)) {
|
||||
var view = map.getView();
|
||||
goog.asserts.assert(!goog.isNull(view));
|
||||
goog.asserts.assert(!goog.isNull(view), 'view should not be null');
|
||||
projection = view.getProjection();
|
||||
goog.asserts.assert(goog.isDef(projection));
|
||||
goog.asserts.assert(goog.isDef(projection),
|
||||
'projection should be defined');
|
||||
}
|
||||
var formatConstructors = this.formatConstructors_;
|
||||
var features = [];
|
||||
@@ -155,7 +156,8 @@ ol.interaction.DragAndDrop.prototype.setMap = function(map) {
|
||||
goog.dispose(this.fileDropHandler_);
|
||||
this.fileDropHandler_ = null;
|
||||
}
|
||||
goog.asserts.assert(!goog.isDef(this.dropListenKey_));
|
||||
goog.asserts.assert(!goog.isDef(this.dropListenKey_),
|
||||
'this.dropListenKey_ should be undefined');
|
||||
goog.base(this, 'setMap', map);
|
||||
if (!goog.isNull(map)) {
|
||||
this.fileDropHandler_ = new goog.events.FileDropHandler(map.getViewport());
|
||||
|
||||
@@ -70,7 +70,8 @@ goog.inherits(ol.interaction.DragPan, ol.interaction.Pointer);
|
||||
* @private
|
||||
*/
|
||||
ol.interaction.DragPan.handleDragEvent_ = function(mapBrowserEvent) {
|
||||
goog.asserts.assert(this.targetPointers.length >= 1);
|
||||
goog.asserts.assert(this.targetPointers.length >= 1,
|
||||
'the length of this.targetPointers should be more than 1');
|
||||
var centroid =
|
||||
ol.interaction.Pointer.centroid(this.targetPointers);
|
||||
if (this.kinetic_) {
|
||||
@@ -108,7 +109,7 @@ ol.interaction.DragPan.handleUpEvent_ = function(mapBrowserEvent) {
|
||||
var distance = this.kinetic_.getDistance();
|
||||
var angle = this.kinetic_.getAngle();
|
||||
var center = view.getCenter();
|
||||
goog.asserts.assert(goog.isDef(center));
|
||||
goog.asserts.assert(goog.isDef(center), 'center should be defined');
|
||||
this.kineticPreRenderFn_ = this.kinetic_.pan(center);
|
||||
map.beforeRender(this.kineticPreRenderFn_);
|
||||
var centerpx = map.getPixelFromCoordinate(center);
|
||||
|
||||
@@ -54,11 +54,11 @@ goog.inherits(ol.interaction.DragZoom, ol.interaction.DragBox);
|
||||
ol.interaction.DragZoom.prototype.onBoxEnd = function() {
|
||||
var map = this.getMap();
|
||||
var view = map.getView();
|
||||
goog.asserts.assert(!goog.isNull(view));
|
||||
goog.asserts.assert(!goog.isNull(view), 'view should not be null');
|
||||
var extent = this.getGeometry().getExtent();
|
||||
var center = ol.extent.getCenter(extent);
|
||||
var size = map.getSize();
|
||||
goog.asserts.assert(goog.isDef(size));
|
||||
goog.asserts.assert(goog.isDef(size), 'size should be defined');
|
||||
ol.interaction.Interaction.zoom(map, view,
|
||||
view.getResolutionForExtent(extent, size),
|
||||
center, ol.DRAGZOOM_ANIMATION_DURATION);
|
||||
|
||||
@@ -336,10 +336,12 @@ ol.interaction.Draw.prototype.atFinish_ = function(event) {
|
||||
var potentiallyDone = false;
|
||||
var potentiallyFinishCoordinates = [this.finishCoordinate_];
|
||||
if (this.mode_ === ol.interaction.DrawMode.LINE_STRING) {
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.LineString);
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.LineString,
|
||||
'geometry should be an ol.geom.LineString');
|
||||
potentiallyDone = geometry.getCoordinates().length > 2;
|
||||
} else if (this.mode_ === ol.interaction.DrawMode.POLYGON) {
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.Polygon);
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.Polygon,
|
||||
'geometry should be an ol.geom.Polygon');
|
||||
potentiallyDone = geometry.getCoordinates()[0].length >
|
||||
this.minPointsPerRing_;
|
||||
potentiallyFinishCoordinates = [this.sketchPolygonCoords_[0][0],
|
||||
@@ -376,7 +378,8 @@ ol.interaction.Draw.prototype.createOrUpdateSketchPoint_ = function(event) {
|
||||
this.updateSketchFeatures_();
|
||||
} else {
|
||||
var sketchPointGeom = this.sketchPoint_.getGeometry();
|
||||
goog.asserts.assertInstanceof(sketchPointGeom, ol.geom.Point);
|
||||
goog.asserts.assertInstanceof(sketchPointGeom, ol.geom.Point,
|
||||
'sketchPointGeom should be an ol.geom.Point');
|
||||
sketchPointGeom.setCoordinates(coordinates);
|
||||
}
|
||||
};
|
||||
@@ -407,7 +410,7 @@ ol.interaction.Draw.prototype.startDrawing_ = function(event) {
|
||||
start.slice()]));
|
||||
}
|
||||
}
|
||||
goog.asserts.assert(goog.isDef(geometry));
|
||||
goog.asserts.assert(goog.isDef(geometry), 'geometry should be defined');
|
||||
this.sketchFeature_ = new ol.Feature();
|
||||
if (goog.isDef(this.geometryName_)) {
|
||||
this.sketchFeature_.setGeometryName(this.geometryName_);
|
||||
@@ -429,20 +432,24 @@ ol.interaction.Draw.prototype.modifyDrawing_ = function(event) {
|
||||
var geometry = this.sketchFeature_.getGeometry();
|
||||
var coordinates, last, sketchLineGeom;
|
||||
if (this.mode_ === ol.interaction.DrawMode.POINT) {
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.Point);
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.Point,
|
||||
'geometry should be an ol.geom.Point');
|
||||
last = geometry.getCoordinates();
|
||||
last[0] = coordinate[0];
|
||||
last[1] = coordinate[1];
|
||||
geometry.setCoordinates(last);
|
||||
} else {
|
||||
if (this.mode_ === ol.interaction.DrawMode.LINE_STRING) {
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.LineString);
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.LineString,
|
||||
'geometry should be an ol.geom.LineString');
|
||||
coordinates = geometry.getCoordinates();
|
||||
} else if (this.mode_ === ol.interaction.DrawMode.POLYGON) {
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.Polygon);
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.Polygon,
|
||||
'geometry should be an ol.geom.Polygon');
|
||||
coordinates = this.sketchPolygonCoords_[0];
|
||||
} else if (this.mode_ === ol.interaction.DrawMode.CIRCLE) {
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.Circle);
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.Circle,
|
||||
'geometry should be an ol.geom.Circle');
|
||||
coordinates = geometry.getCenter();
|
||||
}
|
||||
if (this.atFinish_(event)) {
|
||||
@@ -450,24 +457,30 @@ ol.interaction.Draw.prototype.modifyDrawing_ = function(event) {
|
||||
coordinate = this.finishCoordinate_.slice();
|
||||
}
|
||||
var sketchPointGeom = this.sketchPoint_.getGeometry();
|
||||
goog.asserts.assertInstanceof(sketchPointGeom, ol.geom.Point);
|
||||
goog.asserts.assertInstanceof(sketchPointGeom, ol.geom.Point,
|
||||
'sketchPointGeom should be an ol.geom.Point');
|
||||
sketchPointGeom.setCoordinates(coordinate);
|
||||
last = coordinates[coordinates.length - 1];
|
||||
last[0] = coordinate[0];
|
||||
last[1] = coordinate[1];
|
||||
if (this.mode_ === ol.interaction.DrawMode.LINE_STRING) {
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.LineString);
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.LineString,
|
||||
'geometry should be an ol.geom.LineString');
|
||||
geometry.setCoordinates(coordinates);
|
||||
} else if (this.mode_ === ol.interaction.DrawMode.POLYGON) {
|
||||
sketchLineGeom = this.sketchLine_.getGeometry();
|
||||
goog.asserts.assertInstanceof(sketchLineGeom, ol.geom.LineString);
|
||||
goog.asserts.assertInstanceof(sketchLineGeom, ol.geom.LineString,
|
||||
'sketchLineGeom should be an ol.geom.LineString');
|
||||
sketchLineGeom.setCoordinates(coordinates);
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.Polygon);
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.Polygon,
|
||||
'geometry should be an ol.geom.Polygon');
|
||||
geometry.setCoordinates(this.sketchPolygonCoords_);
|
||||
} else if (this.mode_ === ol.interaction.DrawMode.CIRCLE) {
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.Circle);
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.Circle,
|
||||
'geometry should be an ol.geom.Circle');
|
||||
sketchLineGeom = this.sketchLine_.getGeometry();
|
||||
goog.asserts.assertInstanceof(sketchLineGeom, ol.geom.LineString);
|
||||
goog.asserts.assertInstanceof(sketchLineGeom, ol.geom.LineString,
|
||||
'sketchLineGeom should be an ol.geom.LineString');
|
||||
sketchLineGeom.setCoordinates([geometry.getCenter(), coordinate]);
|
||||
geometry.setRadius(sketchLineGeom.getLength());
|
||||
}
|
||||
@@ -487,13 +500,15 @@ ol.interaction.Draw.prototype.addToDrawing_ = function(event) {
|
||||
var coordinates;
|
||||
if (this.mode_ === ol.interaction.DrawMode.LINE_STRING) {
|
||||
this.finishCoordinate_ = coordinate.slice();
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.LineString);
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.LineString,
|
||||
'geometry should be an ol.geom.LineString');
|
||||
coordinates = geometry.getCoordinates();
|
||||
coordinates.push(coordinate.slice());
|
||||
geometry.setCoordinates(coordinates);
|
||||
} else if (this.mode_ === ol.interaction.DrawMode.POLYGON) {
|
||||
this.sketchPolygonCoords_[0].push(coordinate.slice());
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.Polygon);
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.Polygon,
|
||||
'geometry should be an ol.geom.Polygon');
|
||||
geometry.setCoordinates(this.sketchPolygonCoords_);
|
||||
}
|
||||
this.updateSketchFeatures_();
|
||||
@@ -506,20 +521,24 @@ ol.interaction.Draw.prototype.addToDrawing_ = function(event) {
|
||||
*/
|
||||
ol.interaction.Draw.prototype.finishDrawing = function() {
|
||||
var sketchFeature = this.abortDrawing_();
|
||||
goog.asserts.assert(!goog.isNull(sketchFeature));
|
||||
goog.asserts.assert(!goog.isNull(sketchFeature),
|
||||
'sketchFeature should not be null');
|
||||
var coordinates;
|
||||
var geometry = sketchFeature.getGeometry();
|
||||
if (this.mode_ === ol.interaction.DrawMode.POINT) {
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.Point);
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.Point,
|
||||
'geometry should be an ol.geom.Point');
|
||||
coordinates = geometry.getCoordinates();
|
||||
} else if (this.mode_ === ol.interaction.DrawMode.LINE_STRING) {
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.LineString);
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.LineString,
|
||||
'geometry should be an ol.geom.LineString');
|
||||
coordinates = geometry.getCoordinates();
|
||||
// remove the redundant last point
|
||||
coordinates.pop();
|
||||
geometry.setCoordinates(coordinates);
|
||||
} else if (this.mode_ === ol.interaction.DrawMode.POLYGON) {
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.Polygon);
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.Polygon,
|
||||
'geometry should be an ol.geom.Polygon');
|
||||
// When we finish drawing a polygon on the last point,
|
||||
// the last coordinate is duplicated as for LineString
|
||||
// we force the replacement by the first point
|
||||
@@ -625,7 +644,7 @@ ol.interaction.Draw.getMode_ = function(type) {
|
||||
} else if (type === ol.geom.GeometryType.CIRCLE) {
|
||||
mode = ol.interaction.DrawMode.CIRCLE;
|
||||
}
|
||||
goog.asserts.assert(goog.isDef(mode));
|
||||
goog.asserts.assert(goog.isDef(mode), 'mode should be defined');
|
||||
return mode;
|
||||
};
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ ol.interaction.KeyboardPan.handleEvent = function(mapBrowserEvent) {
|
||||
keyCode == goog.events.KeyCodes.UP)) {
|
||||
var map = mapBrowserEvent.map;
|
||||
var view = map.getView();
|
||||
goog.asserts.assert(!goog.isNull(view));
|
||||
goog.asserts.assert(!goog.isNull(view), 'view should not be null');
|
||||
var viewState = view.getState();
|
||||
var mapUnitsDelta = viewState.resolution * this.pixelDelta_;
|
||||
var deltaX = 0, deltaY = 0;
|
||||
|
||||
@@ -74,7 +74,7 @@ ol.interaction.KeyboardZoom.handleEvent = function(mapBrowserEvent) {
|
||||
var delta = (charCode == '+'.charCodeAt(0)) ? this.delta_ : -this.delta_;
|
||||
map.render();
|
||||
var view = map.getView();
|
||||
goog.asserts.assert(!goog.isNull(view));
|
||||
goog.asserts.assert(!goog.isNull(view), 'view should not be null');
|
||||
ol.interaction.Interaction.zoomByDelta(
|
||||
map, view, delta, undefined, this.duration_);
|
||||
mapBrowserEvent.preventDefault();
|
||||
|
||||
@@ -183,7 +183,8 @@ ol.interaction.Modify.prototype.setMap = function(map) {
|
||||
*/
|
||||
ol.interaction.Modify.prototype.handleFeatureAdd_ = function(evt) {
|
||||
var feature = evt.element;
|
||||
goog.asserts.assertInstanceof(feature, ol.Feature);
|
||||
goog.asserts.assertInstanceof(feature, ol.Feature,
|
||||
'feature should be an ol.Feature');
|
||||
this.addFeature_(feature);
|
||||
};
|
||||
|
||||
@@ -549,7 +550,8 @@ ol.interaction.Modify.handleEvent = function(mapBrowserEvent) {
|
||||
if (!goog.isNull(this.vertexFeature_) &&
|
||||
this.deleteCondition_(mapBrowserEvent)) {
|
||||
var geometry = this.vertexFeature_.getGeometry();
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.Point);
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.Point,
|
||||
'geometry should be an ol.geom.Point');
|
||||
handled = this.removeVertex_();
|
||||
}
|
||||
return ol.interaction.Pointer.handleEvent.call(this, mapBrowserEvent) &&
|
||||
@@ -651,22 +653,26 @@ ol.interaction.Modify.prototype.insertVertex_ = function(segmentData, vertex) {
|
||||
|
||||
switch (geometry.getType()) {
|
||||
case ol.geom.GeometryType.MULTI_LINE_STRING:
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.MultiLineString);
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.MultiLineString,
|
||||
'geometry should be an ol.geom.MultiLineString');
|
||||
coordinates = geometry.getCoordinates();
|
||||
coordinates[depth[0]].splice(index + 1, 0, vertex);
|
||||
break;
|
||||
case ol.geom.GeometryType.POLYGON:
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.Polygon);
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.Polygon,
|
||||
'geometry should be an ol.geom.Polygon');
|
||||
coordinates = geometry.getCoordinates();
|
||||
coordinates[depth[0]].splice(index + 1, 0, vertex);
|
||||
break;
|
||||
case ol.geom.GeometryType.MULTI_POLYGON:
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.MultiPolygon);
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.MultiPolygon,
|
||||
'geometry should be an ol.geom.MultiPolygon');
|
||||
coordinates = geometry.getCoordinates();
|
||||
coordinates[depth[1]][depth[0]].splice(index + 1, 0, vertex);
|
||||
break;
|
||||
case ol.geom.GeometryType.LINE_STRING:
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.LineString);
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.LineString,
|
||||
'geometry should be an ol.geom.LineString');
|
||||
coordinates = geometry.getCoordinates();
|
||||
coordinates.splice(index + 1, 0, vertex);
|
||||
break;
|
||||
@@ -676,9 +682,9 @@ ol.interaction.Modify.prototype.insertVertex_ = function(segmentData, vertex) {
|
||||
|
||||
geometry.setCoordinates(coordinates);
|
||||
var rTree = this.rBush_;
|
||||
goog.asserts.assert(goog.isDef(segment));
|
||||
goog.asserts.assert(goog.isDef(segment), 'segment should be defined');
|
||||
rTree.remove(segmentData);
|
||||
goog.asserts.assert(goog.isDef(index));
|
||||
goog.asserts.assert(goog.isDef(index), 'index should be defined');
|
||||
this.updateSegmentIndices_(geometry, index, depth, 1);
|
||||
var newSegmentData = /** @type {ol.interaction.SegmentDataType} */ ({
|
||||
segment: [segment[0], vertex],
|
||||
@@ -780,7 +786,7 @@ ol.interaction.Modify.prototype.removeVertex_ = function() {
|
||||
this.rBush_.remove(newSegment[0]);
|
||||
this.rBush_.remove(newSegment[1]);
|
||||
geometry.setCoordinates(coordinates);
|
||||
goog.asserts.assert(newIndex >= 0);
|
||||
goog.asserts.assert(newIndex >= 0, 'newIndex should be larger than 0');
|
||||
var newSegmentData = /** @type {ol.interaction.SegmentDataType} */ ({
|
||||
depth: segmentData.depth,
|
||||
feature: segmentData.feature,
|
||||
|
||||
@@ -73,7 +73,8 @@ ol.interaction.MouseWheelZoom.handleEvent = function(mapBrowserEvent) {
|
||||
goog.events.MouseWheelHandler.EventType.MOUSEWHEEL) {
|
||||
var map = mapBrowserEvent.map;
|
||||
var mouseWheelEvent = mapBrowserEvent.browserEvent;
|
||||
goog.asserts.assertInstanceof(mouseWheelEvent, goog.events.MouseWheelEvent);
|
||||
goog.asserts.assertInstanceof(mouseWheelEvent, goog.events.MouseWheelEvent,
|
||||
'mouseWheelEvent should be of type MouseWheelEvent');
|
||||
|
||||
this.lastAnchor_ = mapBrowserEvent.coordinate;
|
||||
this.delta_ += mouseWheelEvent.deltaY;
|
||||
@@ -105,7 +106,7 @@ ol.interaction.MouseWheelZoom.prototype.doZoom_ = function(map) {
|
||||
var delta = goog.math.clamp(this.delta_, -maxDelta, maxDelta);
|
||||
|
||||
var view = map.getView();
|
||||
goog.asserts.assert(!goog.isNull(view));
|
||||
goog.asserts.assert(!goog.isNull(view), 'view should not be null');
|
||||
|
||||
map.render();
|
||||
ol.interaction.Interaction.zoomByDelta(map, view, -delta, this.lastAnchor_,
|
||||
|
||||
@@ -71,7 +71,8 @@ goog.inherits(ol.interaction.PinchRotate, ol.interaction.Pointer);
|
||||
* @private
|
||||
*/
|
||||
ol.interaction.PinchRotate.handleDragEvent_ = function(mapBrowserEvent) {
|
||||
goog.asserts.assert(this.targetPointers.length >= 2);
|
||||
goog.asserts.assert(this.targetPointers.length >= 2,
|
||||
'length of this.targetPointers should be greater than or equal to 2');
|
||||
var rotationDelta = 0.0;
|
||||
|
||||
var touch0 = this.targetPointers[0];
|
||||
|
||||
@@ -64,7 +64,8 @@ goog.inherits(ol.interaction.PinchZoom, ol.interaction.Pointer);
|
||||
* @private
|
||||
*/
|
||||
ol.interaction.PinchZoom.handleDragEvent_ = function(mapBrowserEvent) {
|
||||
goog.asserts.assert(this.targetPointers.length >= 2);
|
||||
goog.asserts.assert(this.targetPointers.length >= 2,
|
||||
'length of this.targetPointers should be 2 or more');
|
||||
var scaleDelta = 1.0;
|
||||
|
||||
var touch0 = this.targetPointers[0];
|
||||
|
||||
@@ -311,7 +311,8 @@ ol.interaction.Select.getDefaultStyleFunction = function() {
|
||||
ol.interaction.Select.prototype.addFeature_ = function(evt) {
|
||||
var feature = evt.element;
|
||||
var map = this.getMap();
|
||||
goog.asserts.assertInstanceof(feature, ol.Feature);
|
||||
goog.asserts.assertInstanceof(feature, ol.Feature,
|
||||
'feature should be an ol.Feature');
|
||||
if (!goog.isNull(map)) {
|
||||
map.skipFeature(feature);
|
||||
}
|
||||
@@ -325,7 +326,8 @@ ol.interaction.Select.prototype.addFeature_ = function(evt) {
|
||||
ol.interaction.Select.prototype.removeFeature_ = function(evt) {
|
||||
var feature = evt.element;
|
||||
var map = this.getMap();
|
||||
goog.asserts.assertInstanceof(feature, ol.Feature);
|
||||
goog.asserts.assertInstanceof(feature, ol.Feature,
|
||||
'feature should be an ol.Feature');
|
||||
if (!goog.isNull(map)) {
|
||||
map.unskipFeature(feature);
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ ol.interaction.Snap.prototype.getFeatures_ = function() {
|
||||
} else if (!goog.isNull(this.source_)) {
|
||||
features = this.source_.getFeatures();
|
||||
}
|
||||
goog.asserts.assert(goog.isDef(features));
|
||||
goog.asserts.assert(goog.isDef(features), 'features should be defined');
|
||||
return features;
|
||||
};
|
||||
|
||||
@@ -229,7 +229,8 @@ ol.interaction.Snap.prototype.handleFeatureAdd_ = function(evt) {
|
||||
} else if (evt instanceof ol.CollectionEvent) {
|
||||
feature = evt.element;
|
||||
}
|
||||
goog.asserts.assertInstanceof(feature, ol.Feature);
|
||||
goog.asserts.assertInstanceof(feature, ol.Feature,
|
||||
'feature should be an ol.Feature');
|
||||
this.addFeature(feature);
|
||||
};
|
||||
|
||||
@@ -245,7 +246,8 @@ ol.interaction.Snap.prototype.handleFeatureRemove_ = function(evt) {
|
||||
} else if (evt instanceof ol.CollectionEvent) {
|
||||
feature = evt.element;
|
||||
}
|
||||
goog.asserts.assertInstanceof(feature, ol.Feature);
|
||||
goog.asserts.assertInstanceof(feature, ol.Feature,
|
||||
'feature should be an ol.Feature');
|
||||
this.removeFeature(feature);
|
||||
};
|
||||
|
||||
@@ -300,7 +302,6 @@ ol.interaction.Snap.prototype.removeFeature = function(feature, opt_unlisten) {
|
||||
for (i = nodesToRemove.length - 1; i >= 0; --i) {
|
||||
rBush.remove(nodesToRemove[i]);
|
||||
}
|
||||
|
||||
if (unlisten) {
|
||||
ol.Observable.unByKey(this.geometryModifyListenerKeys_[feature_uid]);
|
||||
delete this.geometryModifyListenerKeys_[feature_uid];
|
||||
|
||||
Reference in New Issue
Block a user