Merge pull request #2098 from tschaub/empty-feature

Do not set geometry by default.
This commit is contained in:
Tim Schaub
2014-05-21 09:52:09 -06:00
2 changed files with 22 additions and 6 deletions

View File

@@ -63,8 +63,9 @@ ol.Feature = function(opt_geometryOrValues) {
this, ol.Object.getChangeEventType(this.geometryName_),
this.handleGeometryChanged_, false, this);
if (goog.isDefAndNotNull(opt_geometryOrValues)) {
if (opt_geometryOrValues instanceof ol.geom.Geometry) {
if (goog.isDef(opt_geometryOrValues)) {
if (opt_geometryOrValues instanceof ol.geom.Geometry ||
goog.isNull(opt_geometryOrValues)) {
var geometry = /** @type {ol.geom.Geometry} */ (opt_geometryOrValues);
this.setGeometry(geometry);
} else {
@@ -72,8 +73,6 @@ ol.Feature = function(opt_geometryOrValues) {
var values = /** @type {Object.<string, *>} */ (opt_geometryOrValues);
this.setValues(values);
}
} else {
this.setGeometry(null);
}
};
goog.inherits(ol.Feature, ol.Object);