Use ol.object.assign() instead of goog.object.clone()

This commit is contained in:
Tim Schaub
2016-02-03 07:22:39 -07:00
parent 619e070d80
commit a74af66d5f
13 changed files with 34 additions and 28 deletions

View File

@@ -17,6 +17,7 @@ goog.require('ol.geom.MultiPolygon');
goog.require('ol.geom.Point');
goog.require('ol.geom.Polygon');
goog.require('ol.geom.flat.orient');
goog.require('ol.object');
goog.require('ol.proj');
@@ -70,7 +71,7 @@ ol.format.EsriJSON.readGeometry_ = function(object, opt_options) {
} else if (object.rings) {
var layout = ol.format.EsriJSON.getGeometryLayout_(object);
var rings = ol.format.EsriJSON.convertRings_(object.rings, layout);
object = /** @type {EsriJSONGeometry} */(goog.object.clone(object));
object = /** @type {EsriJSONGeometry} */(ol.object.assign({}, object));
if (rings.length === 1) {
type = ol.geom.GeometryType.POLYGON;
object.rings = rings[0];

View File

@@ -19,6 +19,7 @@ goog.require('ol.geom.MultiLineString');
goog.require('ol.geom.MultiPolygon');
goog.require('ol.geom.Point');
goog.require('ol.geom.Polygon');
goog.require('ol.object');
goog.require('ol.proj');
goog.require('ol.xml');
@@ -1003,7 +1004,7 @@ ol.format.GML3.prototype.writeCurveSegments_ = function(node, line, objectStack)
ol.format.GML3.prototype.writeGeometryElement = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1];
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
var item = goog.object.clone(context);
var item = ol.object.assign({}, context);
item.node = node;
var value;
if (goog.isArray(geometry)) {
@@ -1064,7 +1065,7 @@ ol.format.GML3.prototype.writeFeatureElement = function(node, feature, objectSta
}
}
}
var item = goog.object.clone(context);
var item = ol.object.assign({}, context);
item.node = node;
ol.xml.pushSerializeAndPop(/** @type {ol.xml.NodeStackItem} */
(item), context.serializers,
@@ -1089,7 +1090,7 @@ ol.format.GML3.prototype.writeFeatureMembers_ = function(node, features, objectS
serializers[featureNS] = {};
serializers[featureNS][featureType] = ol.xml.makeChildAppender(
this.writeFeatureElement, this);
var item = goog.object.clone(context);
var item = ol.object.assign({}, context);
item.node = node;
ol.xml.pushSerializeAndPop(/** @type {ol.xml.NodeStackItem} */
(item),

View File

@@ -9,6 +9,7 @@ goog.require('ol.format.GMLBase');
goog.require('ol.format.XMLFeature');
goog.require('ol.format.XSD');
goog.require('ol.geom.Geometry');
goog.require('ol.object');
goog.require('ol.proj');
goog.require('ol.xml');
@@ -543,7 +544,7 @@ ol.format.WFS.writeQuery_ = function(node, featureType, objectStack) {
ol.xml.setAttributeNS(node, ol.format.WFS.XMLNS, 'xmlns:' + featurePrefix,
featureNS);
}
var item = goog.object.clone(context);
var item = ol.object.assign({}, context);
item.node = node;
ol.xml.pushSerializeAndPop(item,
ol.format.WFS.QUERY_SERIALIZERS_,
@@ -610,7 +611,7 @@ ol.format.WFS.GETFEATURE_SERIALIZERS_ = {
ol.format.WFS.writeGetFeature_ = function(node, featureTypes, objectStack) {
var context = objectStack[objectStack.length - 1];
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
var item = goog.object.clone(context);
var item = ol.object.assign({}, context);
item.node = node;
ol.xml.pushSerializeAndPop(item,
ol.format.WFS.GETFEATURE_SERIALIZERS_,