Named exports from ol/obj

This commit is contained in:
Frederic Junod
2018-01-16 14:14:17 +01:00
parent 40f97eed85
commit 31e30d28b7
60 changed files with 174 additions and 183 deletions

View File

@@ -18,7 +18,7 @@ import Point from '../geom/Point.js';
import Polygon from '../geom/Polygon.js';
import _ol_geom_flat_deflate_ from '../geom/flat/deflate.js';
import _ol_geom_flat_orient_ from '../geom/flat/orient.js';
import _ol_obj_ from '../obj.js';
import {assign, isEmpty} from '../obj.js';
import {get as getProjection} from '../proj.js';
/**
@@ -73,7 +73,7 @@ EsriJSON.readGeometry_ = function(object, opt_options) {
} else if (object.rings) {
const layout = EsriJSON.getGeometryLayout_(object);
const rings = EsriJSON.convertRings_(object.rings, layout);
object = /** @type {EsriJSONGeometry} */(_ol_obj_.assign({}, object));
object = /** @type {EsriJSONGeometry} */(assign({}, object));
if (rings.length === 1) {
type = GeometryType.POLYGON;
object.rings = rings[0];
@@ -632,7 +632,7 @@ EsriJSON.prototype.writeFeatureObject = function(
}
const properties = feature.getProperties();
delete properties[feature.getGeometryName()];
if (!_ol_obj_.isEmpty(properties)) {
if (!isEmpty(properties)) {
object['attributes'] = properties;
} else {
object['attributes'] = {};

View File

@@ -2,7 +2,7 @@
* @module ol/format/Feature
*/
import Geometry from '../geom/Geometry.js';
import _ol_obj_ from '../obj.js';
import {assign} from '../obj.js';
import {get as getProjection, equivalent as equivalentProjection, transformExtent} from '../proj.js';
/**
@@ -65,7 +65,7 @@ FeatureFormat.prototype.getReadOptions = function(source, opt_options) {
* Updated options.
*/
FeatureFormat.prototype.adaptOptions = function(options) {
return _ol_obj_.assign({
return assign({
dataProjection: this.defaultDataProjection,
featureProjection: this.defaultFeatureProjection
}, options);

View File

@@ -7,7 +7,7 @@ import {transformWithOptions} from '../format/Feature.js';
import GMLBase from '../format/GMLBase.js';
import XSD from '../format/XSD.js';
import Geometry from '../geom/Geometry.js';
import _ol_obj_ from '../obj.js';
import {assign} from '../obj.js';
import {get as getProjection, transformExtent} from '../proj.js';
import _ol_xml_ from '../xml.js';
@@ -268,7 +268,7 @@ GML2.prototype.writeFeatureElement = function(node, feature, objectStack) {
}
}
}
const item = _ol_obj_.assign({}, context);
const item = assign({}, context);
item.node = node;
_ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
(item), context.serializers,
@@ -285,7 +285,7 @@ GML2.prototype.writeFeatureElement = function(node, feature, objectStack) {
*/
GML2.prototype.writeGeometryElement = function(node, geometry, objectStack) {
const context = /** @type {olx.format.WriteOptions} */ (objectStack[objectStack.length - 1]);
const item = _ol_obj_.assign({}, context);
const item = assign({}, context);
item.node = node;
let value;
if (Array.isArray(geometry)) {

View File

@@ -13,7 +13,7 @@ import LineString from '../geom/LineString.js';
import MultiLineString from '../geom/MultiLineString.js';
import MultiPolygon from '../geom/MultiPolygon.js';
import Polygon from '../geom/Polygon.js';
import _ol_obj_ from '../obj.js';
import {assign} from '../obj.js';
import {get as getProjection, transformExtent} from '../proj.js';
import _ol_xml_ from '../xml.js';
@@ -951,7 +951,7 @@ GML3.prototype.writeCurveSegments_ = function(node, line, objectStack) {
*/
GML3.prototype.writeGeometryElement = function(node, geometry, objectStack) {
const context = /** @type {olx.format.WriteOptions} */ (objectStack[objectStack.length - 1]);
const item = _ol_obj_.assign({}, context);
const item = assign({}, context);
item.node = node;
let value;
if (Array.isArray(geometry)) {
@@ -1009,7 +1009,7 @@ GML3.prototype.writeFeatureElement = function(node, feature, objectStack) {
}
}
}
const item = _ol_obj_.assign({}, context);
const item = assign({}, context);
item.node = node;
_ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
(item), context.serializers,
@@ -1033,7 +1033,7 @@ GML3.prototype.writeFeatureMembers_ = function(node, features, objectStack) {
serializers[featureNS] = {};
serializers[featureNS][featureType] = _ol_xml_.makeChildAppender(
this.writeFeatureElement, this);
const item = _ol_obj_.assign({}, context);
const item = assign({}, context);
item.node = node;
_ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
(item),
@@ -1206,7 +1206,7 @@ GML3.prototype.writeGeometryNode = function(geometry, opt_options) {
curve: this.curve_, surface: this.surface_,
multiSurface: this.multiSurface_, multiCurve: this.multiCurve_};
if (opt_options) {
_ol_obj_.assign(context, opt_options);
assign(context, opt_options);
}
this.writeGeometryElement(geom, geometry, [context]);
return geom;
@@ -1251,7 +1251,7 @@ GML3.prototype.writeFeaturesNode = function(features, opt_options) {
featureType: this.featureType
};
if (opt_options) {
_ol_obj_.assign(context, opt_options);
assign(context, opt_options);
}
this.writeFeatureMembers_(node, features, [context]);
return node;

View File

@@ -17,7 +17,7 @@ import MultiPoint from '../geom/MultiPoint.js';
import MultiPolygon from '../geom/MultiPolygon.js';
import Point from '../geom/Point.js';
import Polygon from '../geom/Polygon.js';
import _ol_obj_ from '../obj.js';
import {assign} from '../obj.js';
import {get as getProjection} from '../proj.js';
import _ol_xml_ from '../xml.js';
@@ -584,7 +584,7 @@ GMLBase.prototype.readFeaturesFromNode = function(node, opt_options) {
featureNS: this.featureNS
};
if (opt_options) {
_ol_obj_.assign(options, this.getReadOptions(node, opt_options));
assign(options, this.getReadOptions(node, opt_options));
}
const features = this.readFeaturesInternal(node, [options]);
return features || [];

View File

@@ -16,7 +16,7 @@ import MultiPoint from '../geom/MultiPoint.js';
import MultiPolygon from '../geom/MultiPolygon.js';
import Point from '../geom/Point.js';
import Polygon from '../geom/Polygon.js';
import _ol_obj_ from '../obj.js';
import {assign, isEmpty} from '../obj.js';
import {get as getProjection} from '../proj.js';
/**
@@ -216,7 +216,7 @@ function writeEmptyGeometryCollectionGeometry(geometry) {
*/
function writeGeometryCollectionGeometry(geometry, opt_options) {
const geometries = geometry.getGeometriesArray().map(function(geometry) {
const options = _ol_obj_.assign({}, opt_options);
const options = assign({}, opt_options);
delete options.featureProjection;
return writeGeometry(geometry, options);
});
@@ -492,7 +492,7 @@ GeoJSON.prototype.writeFeatureObject = function(feature, opt_options) {
}
const properties = feature.getProperties();
delete properties[feature.getGeometryName()];
if (!_ol_obj_.isEmpty(properties)) {
if (!isEmpty(properties)) {
object.properties = properties;
} else {
object.properties = null;

View File

@@ -11,7 +11,7 @@ import GeometryLayout from '../geom/GeometryLayout.js';
import LineString from '../geom/LineString.js';
import Point from '../geom/Point.js';
import Polygon from '../geom/Polygon.js';
import _ol_obj_ from '../obj.js';
import {isEmpty} from '../obj.js';
import {get as getProjection} from '../proj.js';
import _ol_xml_ from '../xml.js';
@@ -55,7 +55,7 @@ OSMXML.readNode_ = function(node, objectStack) {
const values = _ol_xml_.pushParseAndPop({
tags: {}
}, OSMXML.NODE_PARSERS_, node, objectStack);
if (!_ol_obj_.isEmpty(values.tags)) {
if (!isEmpty(values.tags)) {
const geometry = new Point(coordinates);
transformWithOptions(geometry, false, options);
const feature = new Feature(geometry);

View File

@@ -10,7 +10,7 @@ import _ol_format_filter_ from '../format/filter.js';
import XMLFeature from '../format/XMLFeature.js';
import XSD from '../format/XSD.js';
import Geometry from '../geom/Geometry.js';
import _ol_obj_ from '../obj.js';
import {assign} from '../obj.js';
import {get as getProjection} from '../proj.js';
import _ol_xml_ from '../xml.js';
@@ -153,8 +153,7 @@ WFS.prototype.readFeaturesFromNode = function(node, opt_options) {
'featureType': this.featureType_,
'featureNS': this.featureNS_
});
_ol_obj_.assign(context, this.getReadOptions(node,
opt_options ? opt_options : {}));
assign(context, this.getReadOptions(node, opt_options ? opt_options : {}));
const objectStack = [context];
this.gmlFormat_.FEATURE_COLLECTION_PARSERS[GMLBase.GMLNS][
'featureMember'] =
@@ -599,7 +598,7 @@ WFS.writeQuery_ = function(node, featureType, objectStack) {
_ol_xml_.setAttributeNS(node, WFS.XMLNS, 'xmlns:' + featurePrefix,
featureNS);
}
const item = /** @type {ol.XmlNodeStackItem} */ (_ol_obj_.assign({}, context));
const item = /** @type {ol.XmlNodeStackItem} */ (assign({}, context));
item.node = node;
_ol_xml_.pushSerializeAndPop(item,
WFS.QUERY_SERIALIZERS_,
@@ -916,7 +915,7 @@ WFS.writeFilter = function(filter) {
*/
WFS.writeGetFeature_ = function(node, featureTypes, objectStack) {
const context = /** @type {Object} */ (objectStack[objectStack.length - 1]);
const item = /** @type {ol.XmlNodeStackItem} */ (_ol_obj_.assign({}, context));
const item = /** @type {ol.XmlNodeStackItem} */ (assign({}, context));
item.node = node;
_ol_xml_.pushSerializeAndPop(item,
WFS.GETFEATURE_SERIALIZERS_,
@@ -1025,7 +1024,7 @@ WFS.prototype.writeTransaction = function(inserts, updates, deletes,
obj = {node: node, 'featureNS': options.featureNS,
'featureType': options.featureType, 'featurePrefix': featurePrefix,
'gmlVersion': gmlVersion, 'hasZ': options.hasZ, 'srsName': options.srsName};
_ol_obj_.assign(obj, baseObj);
assign(obj, baseObj);
_ol_xml_.pushSerializeAndPop(obj,
WFS.TRANSACTION_SERIALIZERS_,
_ol_xml_.makeSimpleNodeFactory('Insert'), inserts,
@@ -1035,7 +1034,7 @@ WFS.prototype.writeTransaction = function(inserts, updates, deletes,
obj = {node: node, 'featureNS': options.featureNS,
'featureType': options.featureType, 'featurePrefix': featurePrefix,
'gmlVersion': gmlVersion, 'hasZ': options.hasZ, 'srsName': options.srsName};
_ol_obj_.assign(obj, baseObj);
assign(obj, baseObj);
_ol_xml_.pushSerializeAndPop(obj,
WFS.TRANSACTION_SERIALIZERS_,
_ol_xml_.makeSimpleNodeFactory('Update'), updates,

View File

@@ -5,7 +5,7 @@ import {inherits} from '../index.js';
import {extend, includes} from '../array.js';
import GML2 from '../format/GML2.js';
import XMLFeature from '../format/XMLFeature.js';
import _ol_obj_ from '../obj.js';
import {assign} from '../obj.js';
import _ol_xml_ from '../xml.js';
/**
@@ -158,7 +158,7 @@ WMSGetFeatureInfo.prototype.readFeatures;
WMSGetFeatureInfo.prototype.readFeaturesFromNode = function(node, opt_options) {
const options = {};
if (opt_options) {
_ol_obj_.assign(options, this.getReadOptions(node, opt_options));
assign(options, this.getReadOptions(node, opt_options));
}
return this.readFeatures_(node, [options]);
};