Set geometry to null if no geometry given
This commit is contained in:
+3
-1
@@ -48,7 +48,7 @@ ol.Feature = function(opt_geometryOrValues) {
|
|||||||
this, ol.Object.getChangeEventType(ol.FeatureProperty.GEOMETRY),
|
this, ol.Object.getChangeEventType(ol.FeatureProperty.GEOMETRY),
|
||||||
this.handleGeometryChanged_, false, this);
|
this.handleGeometryChanged_, false, this);
|
||||||
|
|
||||||
if (goog.isDef(opt_geometryOrValues)) {
|
if (goog.isDefAndNotNull(opt_geometryOrValues)) {
|
||||||
if (opt_geometryOrValues instanceof ol.geom.Geometry) {
|
if (opt_geometryOrValues instanceof ol.geom.Geometry) {
|
||||||
var geometry = /** @type {ol.geom.Geometry} */ (opt_geometryOrValues);
|
var geometry = /** @type {ol.geom.Geometry} */ (opt_geometryOrValues);
|
||||||
this.setGeometry(geometry);
|
this.setGeometry(geometry);
|
||||||
@@ -57,6 +57,8 @@ ol.Feature = function(opt_geometryOrValues) {
|
|||||||
var values = /** @type {Object.<string, *>} */ (opt_geometryOrValues);
|
var values = /** @type {Object.<string, *>} */ (opt_geometryOrValues);
|
||||||
this.setValues(values);
|
this.setValues(values);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
this.setGeometry(null);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
goog.inherits(ol.Feature, ol.Object);
|
goog.inherits(ol.Feature, ol.Object);
|
||||||
|
|||||||
@@ -251,8 +251,8 @@ ol.geom.Geometry.prototype.setLayout =
|
|||||||
ol.geom.Geometry.prototype.transform = function(transformFn) {
|
ol.geom.Geometry.prototype.transform = function(transformFn) {
|
||||||
if (!goog.isNull(this.flatCoordinates)) {
|
if (!goog.isNull(this.flatCoordinates)) {
|
||||||
transformFn(this.flatCoordinates, this.flatCoordinates, this.stride);
|
transformFn(this.flatCoordinates, this.flatCoordinates, this.stride);
|
||||||
|
this.dispatchChangeEvent();
|
||||||
}
|
}
|
||||||
this.dispatchChangeEvent();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user