diff --git a/src/ol/format/featureformat.js b/src/ol/format/featureformat.js index 364ba16a86..b5b5f20144 100644 --- a/src/ol/format/featureformat.js +++ b/src/ol/format/featureformat.js @@ -50,18 +50,20 @@ ol.format.Feature.prototype.getReadOptions = function( featureProjection: opt_options.featureProjection }; } - return this.adaptOptionsWithDefaultDataProjection(options); + return this.adaptOptions(options); }; /** + * Sets the `defaultDataProjection` on the options, if no `dataProjection` + * is set. * @param {olx.format.WriteOptions|olx.format.ReadOptions|undefined} options * Options. * @protected * @return {olx.format.WriteOptions|olx.format.ReadOptions|undefined} * Updated options. */ -ol.format.Feature.prototype.adaptOptionsWithDefaultDataProjection = function( +ol.format.Feature.prototype.adaptOptions = function( options) { var updatedOptions; if (goog.isDef(options)) { diff --git a/src/ol/format/jsonfeatureformat.js b/src/ol/format/jsonfeatureformat.js index 109613a1ce..97c4fa4ebb 100644 --- a/src/ol/format/jsonfeatureformat.js +++ b/src/ol/format/jsonfeatureformat.js @@ -128,9 +128,7 @@ ol.format.JSONFeature.prototype.readProjectionFromObject = goog.abstractMethod; * @inheritDoc */ ol.format.JSONFeature.prototype.writeFeature = function(feature, opt_options) { - return this.writeFeatureObject( - feature, - this.adaptOptionsWithDefaultDataProjection(opt_options)); + return this.writeFeatureObject(feature, this.adaptOptions(opt_options)); }; @@ -148,9 +146,7 @@ ol.format.JSONFeature.prototype.writeFeatureObject = goog.abstractMethod; */ ol.format.JSONFeature.prototype.writeFeatures = function( features, opt_options) { - return this.writeFeaturesObject( - features, - this.adaptOptionsWithDefaultDataProjection(opt_options)); + return this.writeFeaturesObject(features, this.adaptOptions(opt_options)); }; @@ -168,9 +164,7 @@ ol.format.JSONFeature.prototype.writeFeaturesObject = goog.abstractMethod; */ ol.format.JSONFeature.prototype.writeGeometry = function( geometry, opt_options) { - return this.writeGeometryObject( - geometry, - this.adaptOptionsWithDefaultDataProjection(opt_options)); + return this.writeGeometryObject(geometry, this.adaptOptions(opt_options)); }; diff --git a/src/ol/format/polylineformat.js b/src/ol/format/polylineformat.js index c80e423565..56fbe5e2b9 100644 --- a/src/ol/format/polylineformat.js +++ b/src/ol/format/polylineformat.js @@ -317,7 +317,7 @@ ol.format.Polyline.prototype.readGeometryFromText = return /** @type {ol.geom.Geometry} */ ( ol.format.Feature.transformWithOptions( new ol.geom.LineString(coordinates), false, - this.adaptOptionsWithDefaultDataProjection(opt_options))); + this.adaptOptions(opt_options))); }; @@ -384,8 +384,7 @@ ol.format.Polyline.prototype.writeGeometryText = goog.asserts.assertInstanceof(geometry, ol.geom.LineString); geometry = /** @type {ol.geom.LineString} */ (ol.format.Feature.transformWithOptions( - geometry, true, - this.adaptOptionsWithDefaultDataProjection(opt_options))); + geometry, true, this.adaptOptions(opt_options))); var flatCoordinates = geometry.getFlatCoordinates(); var stride = geometry.getStride(); return ol.format.Polyline.encodeDeltas(flatCoordinates, stride, this.factor_); diff --git a/src/ol/format/textfeatureformat.js b/src/ol/format/textfeatureformat.js index 583d0a3062..c838c1a729 100644 --- a/src/ol/format/textfeatureformat.js +++ b/src/ol/format/textfeatureformat.js @@ -49,8 +49,7 @@ ol.format.TextFeature.prototype.getType = function() { */ ol.format.TextFeature.prototype.readFeature = function(source, opt_options) { return this.readFeatureFromText( - this.getText_(source), - this.adaptOptionsWithDefaultDataProjection(opt_options)); + this.getText_(source), this.adaptOptions(opt_options)); }; @@ -68,8 +67,7 @@ ol.format.TextFeature.prototype.readFeatureFromText = goog.abstractMethod; */ ol.format.TextFeature.prototype.readFeatures = function(source, opt_options) { return this.readFeaturesFromText( - this.getText_(source), - this.adaptOptionsWithDefaultDataProjection(opt_options)); + this.getText_(source), this.adaptOptions(opt_options)); }; @@ -87,8 +85,7 @@ ol.format.TextFeature.prototype.readFeaturesFromText = goog.abstractMethod; */ ol.format.TextFeature.prototype.readGeometry = function(source, opt_options) { return this.readGeometryFromText( - this.getText_(source), - this.adaptOptionsWithDefaultDataProjection(opt_options)); + this.getText_(source), this.adaptOptions(opt_options)); }; @@ -121,9 +118,7 @@ ol.format.TextFeature.prototype.readProjectionFromText = goog.abstractMethod; * @inheritDoc */ ol.format.TextFeature.prototype.writeFeature = function(feature, opt_options) { - return this.writeFeatureText( - feature, - this.adaptOptionsWithDefaultDataProjection(opt_options)); + return this.writeFeatureText(feature, this.adaptOptions(opt_options)); }; @@ -141,9 +136,7 @@ ol.format.TextFeature.prototype.writeFeatureText = goog.abstractMethod; */ ol.format.TextFeature.prototype.writeFeatures = function( features, opt_options) { - return this.writeFeaturesText( - features, - this.adaptOptionsWithDefaultDataProjection(opt_options)); + return this.writeFeaturesText(features, this.adaptOptions(opt_options)); }; @@ -161,9 +154,7 @@ ol.format.TextFeature.prototype.writeFeaturesText = goog.abstractMethod; */ ol.format.TextFeature.prototype.writeGeometry = function( geometry, opt_options) { - return this.writeGeometryText( - geometry, - this.adaptOptionsWithDefaultDataProjection(opt_options)); + return this.writeGeometryText(geometry, this.adaptOptions(opt_options)); }; diff --git a/src/ol/format/xmlfeatureformat.js b/src/ol/format/xmlfeatureformat.js index 319de0c18d..3c61ee6574 100644 --- a/src/ol/format/xmlfeatureformat.js +++ b/src/ol/format/xmlfeatureformat.js @@ -199,9 +199,7 @@ ol.format.XMLFeature.prototype.readProjectionFromNode = goog.abstractMethod; * @inheritDoc */ ol.format.XMLFeature.prototype.writeFeature = function(feature, opt_options) { - return this.writeFeatureNode( - feature, - this.adaptOptionsWithDefaultDataProjection(opt_options)); + return this.writeFeatureNode(feature, this.adaptOptions(opt_options)); }; @@ -218,9 +216,7 @@ ol.format.XMLFeature.prototype.writeFeatureNode = goog.abstractMethod; * @inheritDoc */ ol.format.XMLFeature.prototype.writeFeatures = function(features, opt_options) { - return this.writeFeaturesNode( - features, - this.adaptOptionsWithDefaultDataProjection(opt_options)); + return this.writeFeaturesNode(features, this.adaptOptions(opt_options)); }; @@ -237,9 +233,7 @@ ol.format.XMLFeature.prototype.writeFeaturesNode = goog.abstractMethod; * @inheritDoc */ ol.format.XMLFeature.prototype.writeGeometry = function(geometry, opt_options) { - return this.writeGeometryNode( - geometry, - this.adaptOptionsWithDefaultDataProjection(opt_options)); + return this.writeGeometryNode(geometry, this.adaptOptions(opt_options)); };