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

@@ -6,7 +6,7 @@ import PluggableMap from './PluggableMap.js';
import PluginType from './PluginType.js'; import PluginType from './PluginType.js';
import {defaults as defaultControls} from './control.js'; import {defaults as defaultControls} from './control.js';
import {defaults as defaultInteractions} from './interaction.js'; import {defaults as defaultInteractions} from './interaction.js';
import _ol_obj_ from './obj.js'; import {assign} from './obj.js';
import {register, registerMultiple} from './plugins.js'; import {register, registerMultiple} from './plugins.js';
import CanvasImageLayerRenderer from './renderer/canvas/ImageLayer.js'; import CanvasImageLayerRenderer from './renderer/canvas/ImageLayer.js';
import CanvasMapRenderer from './renderer/canvas/Map.js'; import CanvasMapRenderer from './renderer/canvas/Map.js';
@@ -73,7 +73,7 @@ registerMultiple(PluginType.LAYER_RENDERER, [
* @api * @api
*/ */
const CanvasMap = function(options) { const CanvasMap = function(options) {
options = _ol_obj_.assign({}, options); options = assign({}, options);
delete options.renderer; delete options.renderer;
if (!options.controls) { if (!options.controls) {
options.controls = defaultControls(); options.controls = defaultControls();

View File

@@ -6,7 +6,7 @@ import PluggableMap from './PluggableMap.js';
import PluginType from './PluginType.js'; import PluginType from './PluginType.js';
import {defaults as defaultControls} from './control.js'; import {defaults as defaultControls} from './control.js';
import {defaults as defaultInteractions} from './interaction.js'; import {defaults as defaultInteractions} from './interaction.js';
import _ol_obj_ from './obj.js'; import {assign} from './obj.js';
import {register, registerMultiple} from './plugins.js'; import {register, registerMultiple} from './plugins.js';
import CanvasImageLayerRenderer from './renderer/canvas/ImageLayer.js'; import CanvasImageLayerRenderer from './renderer/canvas/ImageLayer.js';
import CanvasMapRenderer from './renderer/canvas/Map.js'; import CanvasMapRenderer from './renderer/canvas/Map.js';
@@ -85,7 +85,7 @@ registerMultiple(PluginType.LAYER_RENDERER, [
* @api * @api
*/ */
const Map = function(options) { const Map = function(options) {
options = _ol_obj_.assign({}, options); options = assign({}, options);
if (!options.controls) { if (!options.controls) {
options.controls = defaultControls(); options.controls = defaultControls();
} }

View File

@@ -5,7 +5,7 @@ import {getUid, inherits} from './index.js';
import ObjectEventType from './ObjectEventType.js'; import ObjectEventType from './ObjectEventType.js';
import Observable from './Observable.js'; import Observable from './Observable.js';
import Event from './events/Event.js'; import Event from './events/Event.js';
import _ol_obj_ from './obj.js'; import {assign} from './obj.js';
/** /**
* @classdesc * @classdesc
@@ -124,7 +124,7 @@ BaseObject.prototype.getKeys = function() {
* @api * @api
*/ */
BaseObject.prototype.getProperties = function() { BaseObject.prototype.getProperties = function() {
return _ol_obj_.assign({}, this.values_); return assign({}, this.values_);
}; };

View File

@@ -18,7 +18,7 @@ import GeometryType from './geom/GeometryType.js';
import {fromExtent as polygonFromExtent} from './geom/Polygon.js'; import {fromExtent as polygonFromExtent} from './geom/Polygon.js';
import SimpleGeometry from './geom/SimpleGeometry.js'; import SimpleGeometry from './geom/SimpleGeometry.js';
import {clamp, modulo} from './math.js'; import {clamp, modulo} from './math.js';
import _ol_obj_ from './obj.js'; import {assign} from './obj.js';
import {createProjection, METERS_PER_UNIT} from './proj.js'; import {createProjection, METERS_PER_UNIT} from './proj.js';
import Units from './proj/Units.js'; import Units from './proj/Units.js';
@@ -89,7 +89,7 @@ const DEFAULT_MIN_ZOOM = 0;
const View = function(opt_options) { const View = function(opt_options) {
BaseObject.call(this); BaseObject.call(this);
const options = _ol_obj_.assign({}, opt_options); const options = assign({}, opt_options);
/** /**
* @private * @private
@@ -217,7 +217,7 @@ View.prototype.applyOptions_ = function(options) {
* @return {olx.ViewOptions} New options updated with the current view state. * @return {olx.ViewOptions} New options updated with the current view state.
*/ */
View.prototype.getUpdatedOptions_ = function(newOptions) { View.prototype.getUpdatedOptions_ = function(newOptions) {
const options = _ol_obj_.assign({}, this.options_); const options = assign({}, this.options_);
// preserve resolution (or zoom) // preserve resolution (or zoom)
if (options.resolution !== undefined) { if (options.resolution !== undefined) {
@@ -232,7 +232,7 @@ View.prototype.getUpdatedOptions_ = function(newOptions) {
// preserve rotation // preserve rotation
options.rotation = this.getRotation(); options.rotation = this.getRotation();
return _ol_obj_.assign({}, options, newOptions); return assign({}, options, newOptions);
}; };

View File

@@ -1,7 +1,7 @@
/** /**
* @module ol/events * @module ol/events
*/ */
import _ol_obj_ from './obj.js'; import {clear} from './obj.js';
const _ol_events_ = {}; const _ol_events_ = {};
@@ -93,7 +93,7 @@ _ol_events_.removeListeners_ = function(target, type) {
if (listeners) { if (listeners) {
for (let i = 0, ii = listeners.length; i < ii; ++i) { for (let i = 0, ii = listeners.length; i < ii; ++i) {
target.removeEventListener(type, listeners[i].boundListener); target.removeEventListener(type, listeners[i].boundListener);
_ol_obj_.clear(listeners[i]); clear(listeners[i]);
} }
listeners.length = 0; listeners.length = 0;
const listenerMap = target.ol_lm; const listenerMap = target.ol_lm;
@@ -223,7 +223,7 @@ _ol_events_.unlistenByKey = function(key) {
_ol_events_.removeListeners_(key.target, key.type); _ol_events_.removeListeners_(key.target, key.type);
} }
} }
_ol_obj_.clear(key); clear(key);
} }
}; };

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -11,7 +11,7 @@ import GeometryLayout from '../geom/GeometryLayout.js';
import LineString from '../geom/LineString.js'; import LineString from '../geom/LineString.js';
import Point from '../geom/Point.js'; import Point from '../geom/Point.js';
import Polygon from '../geom/Polygon.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 {get as getProjection} from '../proj.js';
import _ol_xml_ from '../xml.js'; import _ol_xml_ from '../xml.js';
@@ -55,7 +55,7 @@ OSMXML.readNode_ = function(node, objectStack) {
const values = _ol_xml_.pushParseAndPop({ const values = _ol_xml_.pushParseAndPop({
tags: {} tags: {}
}, OSMXML.NODE_PARSERS_, node, objectStack); }, OSMXML.NODE_PARSERS_, node, objectStack);
if (!_ol_obj_.isEmpty(values.tags)) { if (!isEmpty(values.tags)) {
const geometry = new Point(coordinates); const geometry = new Point(coordinates);
transformWithOptions(geometry, false, options); transformWithOptions(geometry, false, options);
const feature = new Feature(geometry); 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 XMLFeature from '../format/XMLFeature.js';
import XSD from '../format/XSD.js'; import XSD from '../format/XSD.js';
import Geometry from '../geom/Geometry.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 {get as getProjection} from '../proj.js';
import _ol_xml_ from '../xml.js'; import _ol_xml_ from '../xml.js';
@@ -153,8 +153,7 @@ WFS.prototype.readFeaturesFromNode = function(node, opt_options) {
'featureType': this.featureType_, 'featureType': this.featureType_,
'featureNS': this.featureNS_ 'featureNS': this.featureNS_
}); });
_ol_obj_.assign(context, this.getReadOptions(node, assign(context, this.getReadOptions(node, opt_options ? opt_options : {}));
opt_options ? opt_options : {}));
const objectStack = [context]; const objectStack = [context];
this.gmlFormat_.FEATURE_COLLECTION_PARSERS[GMLBase.GMLNS][ this.gmlFormat_.FEATURE_COLLECTION_PARSERS[GMLBase.GMLNS][
'featureMember'] = 'featureMember'] =
@@ -599,7 +598,7 @@ WFS.writeQuery_ = function(node, featureType, objectStack) {
_ol_xml_.setAttributeNS(node, WFS.XMLNS, 'xmlns:' + featurePrefix, _ol_xml_.setAttributeNS(node, WFS.XMLNS, 'xmlns:' + featurePrefix,
featureNS); featureNS);
} }
const item = /** @type {ol.XmlNodeStackItem} */ (_ol_obj_.assign({}, context)); const item = /** @type {ol.XmlNodeStackItem} */ (assign({}, context));
item.node = node; item.node = node;
_ol_xml_.pushSerializeAndPop(item, _ol_xml_.pushSerializeAndPop(item,
WFS.QUERY_SERIALIZERS_, WFS.QUERY_SERIALIZERS_,
@@ -916,7 +915,7 @@ WFS.writeFilter = function(filter) {
*/ */
WFS.writeGetFeature_ = function(node, featureTypes, objectStack) { WFS.writeGetFeature_ = function(node, featureTypes, objectStack) {
const context = /** @type {Object} */ (objectStack[objectStack.length - 1]); 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; item.node = node;
_ol_xml_.pushSerializeAndPop(item, _ol_xml_.pushSerializeAndPop(item,
WFS.GETFEATURE_SERIALIZERS_, WFS.GETFEATURE_SERIALIZERS_,
@@ -1025,7 +1024,7 @@ WFS.prototype.writeTransaction = function(inserts, updates, deletes,
obj = {node: node, 'featureNS': options.featureNS, obj = {node: node, 'featureNS': options.featureNS,
'featureType': options.featureType, 'featurePrefix': featurePrefix, 'featureType': options.featureType, 'featurePrefix': featurePrefix,
'gmlVersion': gmlVersion, 'hasZ': options.hasZ, 'srsName': options.srsName}; 'gmlVersion': gmlVersion, 'hasZ': options.hasZ, 'srsName': options.srsName};
_ol_obj_.assign(obj, baseObj); assign(obj, baseObj);
_ol_xml_.pushSerializeAndPop(obj, _ol_xml_.pushSerializeAndPop(obj,
WFS.TRANSACTION_SERIALIZERS_, WFS.TRANSACTION_SERIALIZERS_,
_ol_xml_.makeSimpleNodeFactory('Insert'), inserts, _ol_xml_.makeSimpleNodeFactory('Insert'), inserts,
@@ -1035,7 +1034,7 @@ WFS.prototype.writeTransaction = function(inserts, updates, deletes,
obj = {node: node, 'featureNS': options.featureNS, obj = {node: node, 'featureNS': options.featureNS,
'featureType': options.featureType, 'featurePrefix': featurePrefix, 'featureType': options.featureType, 'featurePrefix': featurePrefix,
'gmlVersion': gmlVersion, 'hasZ': options.hasZ, 'srsName': options.srsName}; 'gmlVersion': gmlVersion, 'hasZ': options.hasZ, 'srsName': options.srsName};
_ol_obj_.assign(obj, baseObj); assign(obj, baseObj);
_ol_xml_.pushSerializeAndPop(obj, _ol_xml_.pushSerializeAndPop(obj,
WFS.TRANSACTION_SERIALIZERS_, WFS.TRANSACTION_SERIALIZERS_,
_ol_xml_.makeSimpleNodeFactory('Update'), updates, _ol_xml_.makeSimpleNodeFactory('Update'), updates,

View File

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

View File

@@ -7,7 +7,7 @@ import EventType from '../events/EventType.js';
import {createOrUpdateEmpty, closestSquaredDistanceXY, extend, getCenter} from '../extent.js'; import {createOrUpdateEmpty, closestSquaredDistanceXY, extend, getCenter} from '../extent.js';
import Geometry from '../geom/Geometry.js'; import Geometry from '../geom/Geometry.js';
import GeometryType from '../geom/GeometryType.js'; import GeometryType from '../geom/GeometryType.js';
import _ol_obj_ from '../obj.js'; import {clear} from '../obj.js';
/** /**
* @classdesc * @classdesc
@@ -162,7 +162,7 @@ GeometryCollection.prototype.getGeometriesArray = function() {
*/ */
GeometryCollection.prototype.getSimplifiedGeometry = function(squaredTolerance) { GeometryCollection.prototype.getSimplifiedGeometry = function(squaredTolerance) {
if (this.simplifiedGeometryRevision != this.getRevision()) { if (this.simplifiedGeometryRevision != this.getRevision()) {
_ol_obj_.clear(this.simplifiedGeometryCache); clear(this.simplifiedGeometryCache);
this.simplifiedGeometryMaxMinSquaredTolerance = 0; this.simplifiedGeometryMaxMinSquaredTolerance = 0;
this.simplifiedGeometryRevision = this.getRevision(); this.simplifiedGeometryRevision = this.getRevision();
} }

View File

@@ -7,7 +7,7 @@ import {createOrUpdateFromFlatCoordinates, getCenter} from '../extent.js';
import Geometry from '../geom/Geometry.js'; import Geometry from '../geom/Geometry.js';
import GeometryLayout from '../geom/GeometryLayout.js'; import GeometryLayout from '../geom/GeometryLayout.js';
import _ol_geom_flat_transform_ from '../geom/flat/transform.js'; import _ol_geom_flat_transform_ from '../geom/flat/transform.js';
import _ol_obj_ from '../obj.js'; import {clear} from '../obj.js';
/** /**
* @classdesc * @classdesc
@@ -145,7 +145,7 @@ SimpleGeometry.prototype.getLayout = function() {
*/ */
SimpleGeometry.prototype.getSimplifiedGeometry = function(squaredTolerance) { SimpleGeometry.prototype.getSimplifiedGeometry = function(squaredTolerance) {
if (this.simplifiedGeometryRevision != this.getRevision()) { if (this.simplifiedGeometryRevision != this.getRevision()) {
_ol_obj_.clear(this.simplifiedGeometryCache); clear(this.simplifiedGeometryCache);
this.simplifiedGeometryMaxMinSquaredTolerance = 0; this.simplifiedGeometryMaxMinSquaredTolerance = 0;
this.simplifiedGeometryRevision = this.getRevision(); this.simplifiedGeometryRevision = this.getRevision();
} }

View File

@@ -6,7 +6,7 @@ import {FALSE} from '../functions.js';
import MapBrowserEventType from '../MapBrowserEventType.js'; import MapBrowserEventType from '../MapBrowserEventType.js';
import MapBrowserPointerEvent from '../MapBrowserPointerEvent.js'; import MapBrowserPointerEvent from '../MapBrowserPointerEvent.js';
import Interaction from '../interaction/Interaction.js'; import Interaction from '../interaction/Interaction.js';
import _ol_obj_ from '../obj.js'; import {getValues} from '../obj.js';
/** /**
* @classdesc * @classdesc
@@ -133,7 +133,7 @@ PointerInteraction.prototype.updateTrackedPointers_ = function(mapBrowserEvent)
// update only when there was a pointerdown event for this pointer // update only when there was a pointerdown event for this pointer
this.trackedPointers_[id] = event; this.trackedPointers_[id] = event;
} }
this.targetPointers = _ol_obj_.getValues(this.trackedPointers_); this.targetPointers = getValues(this.trackedPointers_);
} }
}; };

View File

@@ -11,7 +11,7 @@ import {TRUE} from '../functions.js';
import GeometryType from '../geom/GeometryType.js'; import GeometryType from '../geom/GeometryType.js';
import Interaction from '../interaction/Interaction.js'; import Interaction from '../interaction/Interaction.js';
import VectorLayer from '../layer/Vector.js'; import VectorLayer from '../layer/Vector.js';
import _ol_obj_ from '../obj.js'; import {clear} from '../obj.js';
import VectorSource from '../source/Vector.js'; import VectorSource from '../source/Vector.js';
import Style from '../style/Style.js'; import Style from '../style/Style.js';
@@ -215,7 +215,7 @@ Select.handleEvent = function(mapBrowserEvent) {
// Replace the currently selected feature(s) with the feature(s) at the // Replace the currently selected feature(s) with the feature(s) at the
// pixel, or clear the selected feature(s) if there is no feature at // pixel, or clear the selected feature(s) if there is no feature at
// the pixel. // the pixel.
_ol_obj_.clear(this.featureLayerAssociation_); clear(this.featureLayerAssociation_);
map.forEachFeatureAtPixel(mapBrowserEvent.pixel, map.forEachFeatureAtPixel(mapBrowserEvent.pixel,
( (
/** /**

View File

@@ -12,7 +12,7 @@ import {TRUE, FALSE} from '../functions.js';
import GeometryType from '../geom/GeometryType.js'; import GeometryType from '../geom/GeometryType.js';
import {fromCircle} from '../geom/Polygon.js'; import {fromCircle} from '../geom/Polygon.js';
import PointerInteraction from '../interaction/Pointer.js'; import PointerInteraction from '../interaction/Pointer.js';
import _ol_obj_ from '../obj.js'; import {getValues} from '../obj.js';
import VectorSource from '../source/Vector.js'; import VectorSource from '../source/Vector.js';
import VectorEventType from '../source/VectorEventType.js'; import VectorEventType from '../source/VectorEventType.js';
import RBush from '../structs/RBush.js'; import RBush from '../structs/RBush.js';
@@ -611,7 +611,7 @@ Snap.handleEvent_ = function(evt) {
* @private * @private
*/ */
Snap.handleUpEvent_ = function(evt) { Snap.handleUpEvent_ = function(evt) {
const featuresToUpdate = _ol_obj_.getValues(this.pendingFeatures_); const featuresToUpdate = getValues(this.pendingFeatures_);
if (featuresToUpdate.length) { if (featuresToUpdate.length) {
featuresToUpdate.forEach(this.updateFeature_.bind(this)); featuresToUpdate.forEach(this.updateFeature_.bind(this));
this.pendingFeatures_ = {}; this.pendingFeatures_ = {};

View File

@@ -5,7 +5,7 @@ import {inherits} from '../index.js';
import BaseObject from '../Object.js'; import BaseObject from '../Object.js';
import LayerProperty from '../layer/Property.js'; import LayerProperty from '../layer/Property.js';
import {clamp} from '../math.js'; import {clamp} from '../math.js';
import _ol_obj_ from '../obj.js'; import {assign} from '../obj.js';
/** /**
* @classdesc * @classdesc
@@ -28,7 +28,7 @@ const BaseLayer = function(options) {
/** /**
* @type {Object.<string, *>} * @type {Object.<string, *>}
*/ */
const properties = _ol_obj_.assign({}, options); const properties = assign({}, options);
properties[LayerProperty.OPACITY] = properties[LayerProperty.OPACITY] =
options.opacity !== undefined ? options.opacity : 1; options.opacity !== undefined ? options.opacity : 1;
properties[LayerProperty.VISIBLE] = properties[LayerProperty.VISIBLE] =

View File

@@ -11,7 +11,7 @@ import _ol_events_ from '../events.js';
import EventType from '../events/EventType.js'; import EventType from '../events/EventType.js';
import {getIntersection} from '../extent.js'; import {getIntersection} from '../extent.js';
import BaseLayer from '../layer/Base.js'; import BaseLayer from '../layer/Base.js';
import _ol_obj_ from '../obj.js'; import {assign, clear} from '../obj.js';
import SourceState from '../source/State.js'; import SourceState from '../source/State.js';
@@ -38,8 +38,7 @@ const Property = {
const LayerGroup = function(opt_options) { const LayerGroup = function(opt_options) {
const options = opt_options || {}; const options = opt_options || {};
const baseOptions = /** @type {olx.layer.GroupOptions} */ const baseOptions = /** @type {olx.layer.GroupOptions} */ (assign({}, options));
(_ol_obj_.assign({}, options));
delete baseOptions.layers; delete baseOptions.layers;
let layers = options.layers; let layers = options.layers;
@@ -107,7 +106,7 @@ LayerGroup.prototype.handleLayersChanged_ = function(event) {
for (const id in this.listenerKeys_) { for (const id in this.listenerKeys_) {
this.listenerKeys_[id].forEach(_ol_events_.unlistenByKey); this.listenerKeys_[id].forEach(_ol_events_.unlistenByKey);
} }
_ol_obj_.clear(this.listenerKeys_); clear(this.listenerKeys_);
const layersArray = layers.getArray(); const layersArray = layers.getArray();
let i, ii, layer; let i, ii, layer;

View File

@@ -7,7 +7,7 @@ import BaseObject from '../Object.js';
import {createCanvasContext2D} from '../dom.js'; import {createCanvasContext2D} from '../dom.js';
import VectorLayer from '../layer/Vector.js'; import VectorLayer from '../layer/Vector.js';
import {clamp} from '../math.js'; import {clamp} from '../math.js';
import _ol_obj_ from '../obj.js'; import {assign} from '../obj.js';
import RenderEventType from '../render/EventType.js'; import RenderEventType from '../render/EventType.js';
import Icon from '../style/Icon.js'; import Icon from '../style/Icon.js';
import Style from '../style/Style.js'; import Style from '../style/Style.js';
@@ -47,7 +47,7 @@ const DEFAULT_GRADIENT = ['#00f', '#0ff', '#0f0', '#ff0', '#f00'];
const Heatmap = function(opt_options) { const Heatmap = function(opt_options) {
const options = opt_options ? opt_options : {}; const options = opt_options ? opt_options : {};
const baseOptions = _ol_obj_.assign({}, options); const baseOptions = assign({}, options);
delete baseOptions.gradient; delete baseOptions.gradient;
delete baseOptions.radius; delete baseOptions.radius;

View File

@@ -7,7 +7,7 @@ import {getUid, inherits} from '../index.js';
import BaseObject from '../Object.js'; import BaseObject from '../Object.js';
import BaseLayer from '../layer/Base.js'; import BaseLayer from '../layer/Base.js';
import LayerProperty from '../layer/Property.js'; import LayerProperty from '../layer/Property.js';
import _ol_obj_ from '../obj.js'; import {assign} from '../obj.js';
import RenderEventType from '../render/EventType.js'; import RenderEventType from '../render/EventType.js';
import SourceState from '../source/State.js'; import SourceState from '../source/State.js';
@@ -35,7 +35,7 @@ import SourceState from '../source/State.js';
*/ */
const Layer = function(options) { const Layer = function(options) {
const baseOptions = _ol_obj_.assign({}, options); const baseOptions = assign({}, options);
delete baseOptions.source; delete baseOptions.source;
BaseLayer.call(this, /** @type {olx.layer.BaseOptions} */ (baseOptions)); BaseLayer.call(this, /** @type {olx.layer.BaseOptions} */ (baseOptions));

View File

@@ -5,7 +5,7 @@ import {inherits} from '../index.js';
import LayerType from '../LayerType.js'; import LayerType from '../LayerType.js';
import Layer from '../layer/Layer.js'; import Layer from '../layer/Layer.js';
import _ol_layer_TileProperty_ from '../layer/TileProperty.js'; import _ol_layer_TileProperty_ from '../layer/TileProperty.js';
import _ol_obj_ from '../obj.js'; import {assign} from '../obj.js';
/** /**
* @classdesc * @classdesc
@@ -24,7 +24,7 @@ import _ol_obj_ from '../obj.js';
const TileLayer = function(opt_options) { const TileLayer = function(opt_options) {
const options = opt_options ? opt_options : {}; const options = opt_options ? opt_options : {};
const baseOptions = _ol_obj_.assign({}, options); const baseOptions = assign({}, options);
delete baseOptions.preload; delete baseOptions.preload;
delete baseOptions.useInterimTilesOnError; delete baseOptions.useInterimTilesOnError;

View File

@@ -5,7 +5,7 @@ import {inherits} from '../index.js';
import LayerType from '../LayerType.js'; import LayerType from '../LayerType.js';
import Layer from '../layer/Layer.js'; import Layer from '../layer/Layer.js';
import _ol_layer_VectorRenderType_ from '../layer/VectorRenderType.js'; import _ol_layer_VectorRenderType_ from '../layer/VectorRenderType.js';
import _ol_obj_ from '../obj.js'; import {assign} from '../obj.js';
import Style from '../style/Style.js'; import Style from '../style/Style.js';
@@ -35,7 +35,7 @@ const VectorLayer = function(opt_options) {
const options = opt_options ? const options = opt_options ?
opt_options : /** @type {olx.layer.VectorOptions} */ ({}); opt_options : /** @type {olx.layer.VectorOptions} */ ({});
const baseOptions = _ol_obj_.assign({}, options); const baseOptions = assign({}, options);
delete baseOptions.style; delete baseOptions.style;
delete baseOptions.renderBuffer; delete baseOptions.renderBuffer;

View File

@@ -7,7 +7,7 @@ import {assert} from '../asserts.js';
import _ol_layer_TileProperty_ from '../layer/TileProperty.js'; import _ol_layer_TileProperty_ from '../layer/TileProperty.js';
import VectorLayer from '../layer/Vector.js'; import VectorLayer from '../layer/Vector.js';
import _ol_layer_VectorTileRenderType_ from '../layer/VectorTileRenderType.js'; import _ol_layer_VectorTileRenderType_ from '../layer/VectorTileRenderType.js';
import _ol_obj_ from '../obj.js'; import {assign} from '../obj.js';
/** /**
* @classdesc * @classdesc
@@ -35,7 +35,7 @@ const VectorTileLayer = function(opt_options) {
} }
options.renderMode = renderMode; options.renderMode = renderMode;
const baseOptions = _ol_obj_.assign({}, options); const baseOptions = assign({}, options);
delete baseOptions.preload; delete baseOptions.preload;
delete baseOptions.useInterimTilesOnError; delete baseOptions.useInterimTilesOnError;

View File

@@ -1,7 +1,6 @@
/** /**
* @module ol/obj * @module ol/obj
*/ */
const _ol_obj_ = {};
/** /**
@@ -13,7 +12,7 @@ const _ol_obj_ = {};
* @param {...Object} var_sources The source object(s). * @param {...Object} var_sources The source object(s).
* @return {!Object} The modified target object. * @return {!Object} The modified target object.
*/ */
_ol_obj_.assign = (typeof Object.assign === 'function') ? Object.assign : function(target, var_sources) { export const assign = (typeof Object.assign === 'function') ? Object.assign : function(target, var_sources) {
if (target === undefined || target === null) { if (target === undefined || target === null) {
throw new TypeError('Cannot convert undefined or null to object'); throw new TypeError('Cannot convert undefined or null to object');
} }
@@ -37,11 +36,11 @@ _ol_obj_.assign = (typeof Object.assign === 'function') ? Object.assign : functi
* Removes all properties from an object. * Removes all properties from an object.
* @param {Object} object The object to clear. * @param {Object} object The object to clear.
*/ */
_ol_obj_.clear = function(object) { export function clear(object) {
for (const property in object) { for (const property in object) {
delete object[property]; delete object[property];
} }
}; }
/** /**
@@ -50,13 +49,13 @@ _ol_obj_.clear = function(object) {
* @return {!Array<V>} The property values. * @return {!Array<V>} The property values.
* @template K,V * @template K,V
*/ */
_ol_obj_.getValues = function(object) { export function getValues(object) {
const values = []; const values = [];
for (const property in object) { for (const property in object) {
values.push(object[property]); values.push(object[property]);
} }
return values; return values;
}; }
/** /**
@@ -64,11 +63,10 @@ _ol_obj_.getValues = function(object) {
* @param {Object} object The object to check. * @param {Object} object The object to check.
* @return {boolean} The object is empty. * @return {boolean} The object is empty.
*/ */
_ol_obj_.isEmpty = function(object) { export function isEmpty(object) {
let property; let property;
for (property in object) { for (property in object) {
return false; return false;
} }
return !property; return !property;
}; }
export default _ol_obj_;

View File

@@ -1,7 +1,7 @@
/** /**
* @module ol/proj/transforms * @module ol/proj/transforms
*/ */
import _ol_obj_ from '../obj.js'; import {isEmpty} from '../obj.js';
/** /**
@@ -51,7 +51,7 @@ export function remove(source, destination) {
const destinationCode = destination.getCode(); const destinationCode = destination.getCode();
const transform = transforms[sourceCode][destinationCode]; const transform = transforms[sourceCode][destinationCode];
delete transforms[sourceCode][destinationCode]; delete transforms[sourceCode][destinationCode];
if (_ol_obj_.isEmpty(transforms[sourceCode])) { if (isEmpty(transforms[sourceCode])) {
delete transforms[sourceCode]; delete transforms[sourceCode];
} }
return transform; return transform;

View File

@@ -3,7 +3,7 @@
*/ */
import {getFontFamilies} from '../css.js'; import {getFontFamilies} from '../css.js';
import {createCanvasContext2D} from '../dom.js'; import {createCanvasContext2D} from '../dom.js';
import _ol_obj_ from '../obj.js'; import {clear} from '../obj.js';
import LRUCache from '../structs/LRUCache.js'; import LRUCache from '../structs/LRUCache.js';
import _ol_transform_ from '../transform.js'; import _ol_transform_ from '../transform.js';
const _ol_render_canvas_ = {}; const _ol_render_canvas_ = {};
@@ -155,7 +155,7 @@ _ol_render_canvas_.checkFont = (function() {
if (checked[font] < retries) { if (checked[font] < retries) {
if (isAvailable(font)) { if (isAvailable(font)) {
checked[font] = retries; checked[font] = retries;
_ol_obj_.clear(_ol_render_canvas_.textHeights_); clear(_ol_render_canvas_.textHeights_);
// Make sure that loaded fonts are picked up by Safari // Make sure that loaded fonts are picked up by Safari
_ol_render_canvas_.measureContext_ = null; _ol_render_canvas_.measureContext_ = null;
labelCache.clear(); labelCache.clear();

View File

@@ -13,7 +13,7 @@ import _ol_geom_flat_length_ from '../../geom/flat/length.js';
import _ol_geom_flat_textpath_ from '../../geom/flat/textpath.js'; import _ol_geom_flat_textpath_ from '../../geom/flat/textpath.js';
import _ol_geom_flat_transform_ from '../../geom/flat/transform.js'; import _ol_geom_flat_transform_ from '../../geom/flat/transform.js';
import _ol_has_ from '../../has.js'; import _ol_has_ from '../../has.js';
import _ol_obj_ from '../../obj.js'; import {isEmpty} from '../../obj.js';
import VectorContext from '../VectorContext.js'; import VectorContext from '../VectorContext.js';
import _ol_render_canvas_ from '../canvas.js'; import _ol_render_canvas_ from '../canvas.js';
import _ol_render_canvas_Instruction_ from '../canvas/Instruction.js'; import _ol_render_canvas_Instruction_ from '../canvas/Instruction.js';
@@ -556,7 +556,7 @@ CanvasReplay.prototype.replay_ = function(
transform, this.pixelCoordinates_); transform, this.pixelCoordinates_);
_ol_transform_.setFromArray(this.renderedTransform_, transform); _ol_transform_.setFromArray(this.renderedTransform_, transform);
} }
const skipFeatures = !_ol_obj_.isEmpty(skippedFeaturesHash); const skipFeatures = !isEmpty(skippedFeaturesHash);
let i = 0; // instruction index let i = 0; // instruction index
const ii = instructions.length; // end of instructions const ii = instructions.length; // end of instructions
let d = 0; // data index let d = 0; // data index

View File

@@ -6,7 +6,7 @@ import {numberSafeCompareFunction} from '../../array.js';
import {createCanvasContext2D} from '../../dom.js'; import {createCanvasContext2D} from '../../dom.js';
import {buffer, createEmpty, extendCoordinate} from '../../extent.js'; import {buffer, createEmpty, extendCoordinate} from '../../extent.js';
import _ol_geom_flat_transform_ from '../../geom/flat/transform.js'; import _ol_geom_flat_transform_ from '../../geom/flat/transform.js';
import _ol_obj_ from '../../obj.js'; import {isEmpty} from '../../obj.js';
import ReplayGroup from '../ReplayGroup.js'; import ReplayGroup from '../ReplayGroup.js';
import ReplayType from '../ReplayType.js'; import ReplayType from '../ReplayType.js';
import CanvasReplay from '../canvas/Replay.js'; import CanvasReplay from '../canvas/Replay.js';
@@ -434,7 +434,7 @@ CanvasReplayGroup.prototype.getReplays = function() {
* @inheritDoc * @inheritDoc
*/ */
CanvasReplayGroup.prototype.isEmpty = function() { CanvasReplayGroup.prototype.isEmpty = function() {
return _ol_obj_.isEmpty(this.replaysByZIndex_); return isEmpty(this.replaysByZIndex_);
}; };

View File

@@ -5,7 +5,7 @@ import {getUid, inherits} from '../../index.js';
import {equals} from '../../array.js'; import {equals} from '../../array.js';
import {asArray} from '../../color.js'; import {asArray} from '../../color.js';
import {intersects} from '../../extent.js'; import {intersects} from '../../extent.js';
import _ol_obj_ from '../../obj.js'; import {isEmpty} from '../../obj.js';
import _ol_geom_flat_transform_ from '../../geom/flat/transform.js'; import _ol_geom_flat_transform_ from '../../geom/flat/transform.js';
import _ol_render_webgl_circlereplay_defaultshader_ from '../webgl/circlereplay/defaultshader.js'; import _ol_render_webgl_circlereplay_defaultshader_ from '../webgl/circlereplay/defaultshader.js';
import _ol_render_webgl_circlereplay_defaultshader_Locations_ from '../webgl/circlereplay/defaultshader/Locations.js'; import _ol_render_webgl_circlereplay_defaultshader_Locations_ from '../webgl/circlereplay/defaultshader/Locations.js';
@@ -246,7 +246,7 @@ WebGLCircleReplay.prototype.shutDownProgram = function(gl, locations) {
* @inheritDoc * @inheritDoc
*/ */
WebGLCircleReplay.prototype.drawReplay = function(gl, context, skippedFeaturesHash, hitDetection) { WebGLCircleReplay.prototype.drawReplay = function(gl, context, skippedFeaturesHash, hitDetection) {
if (!_ol_obj_.isEmpty(skippedFeaturesHash)) { if (!isEmpty(skippedFeaturesHash)) {
this.drawReplaySkipping_(gl, context, skippedFeaturesHash); this.drawReplaySkipping_(gl, context, skippedFeaturesHash);
} else { } else {
//Draw by style groups to minimize drawElements() calls. //Draw by style groups to minimize drawElements() calls.

View File

@@ -8,7 +8,7 @@ import {intersects} from '../../extent.js';
import _ol_geom_flat_orient_ from '../../geom/flat/orient.js'; import _ol_geom_flat_orient_ from '../../geom/flat/orient.js';
import _ol_geom_flat_transform_ from '../../geom/flat/transform.js'; import _ol_geom_flat_transform_ from '../../geom/flat/transform.js';
import _ol_geom_flat_topology_ from '../../geom/flat/topology.js'; import _ol_geom_flat_topology_ from '../../geom/flat/topology.js';
import _ol_obj_ from '../../obj.js'; import {isEmpty} from '../../obj.js';
import _ol_render_webgl_ from '../webgl.js'; import _ol_render_webgl_ from '../webgl.js';
import WebGLReplay from '../webgl/Replay.js'; import WebGLReplay from '../webgl/Replay.js';
import _ol_render_webgl_linestringreplay_defaultshader_ from '../webgl/linestringreplay/defaultshader.js'; import _ol_render_webgl_linestringreplay_defaultshader_ from '../webgl/linestringreplay/defaultshader.js';
@@ -506,7 +506,7 @@ WebGLLineStringReplay.prototype.drawReplay = function(gl, context, skippedFeatur
gl.depthFunc(gl.NOTEQUAL); gl.depthFunc(gl.NOTEQUAL);
} }
if (!_ol_obj_.isEmpty(skippedFeaturesHash)) { if (!isEmpty(skippedFeaturesHash)) {
this.drawReplaySkipping_(gl, context, skippedFeaturesHash); this.drawReplaySkipping_(gl, context, skippedFeaturesHash);
} else { } else {
//Draw by style groups to minimize drawElements() calls. //Draw by style groups to minimize drawElements() calls.

View File

@@ -5,7 +5,7 @@ import {getUid, inherits} from '../../index.js';
import {equals} from '../../array.js'; import {equals} from '../../array.js';
import {asArray} from '../../color.js'; import {asArray} from '../../color.js';
import {intersects} from '../../extent.js'; import {intersects} from '../../extent.js';
import _ol_obj_ from '../../obj.js'; import {isEmpty} from '../../obj.js';
import _ol_geom_flat_contains_ from '../../geom/flat/contains.js'; import _ol_geom_flat_contains_ from '../../geom/flat/contains.js';
import _ol_geom_flat_orient_ from '../../geom/flat/orient.js'; import _ol_geom_flat_orient_ from '../../geom/flat/orient.js';
import _ol_geom_flat_transform_ from '../../geom/flat/transform.js'; import _ol_geom_flat_transform_ from '../../geom/flat/transform.js';
@@ -924,7 +924,7 @@ WebGLPolygonReplay.prototype.drawReplay = function(gl, context, skippedFeaturesH
gl.depthFunc(gl.NOTEQUAL); gl.depthFunc(gl.NOTEQUAL);
} }
if (!_ol_obj_.isEmpty(skippedFeaturesHash)) { if (!isEmpty(skippedFeaturesHash)) {
this.drawReplaySkipping_(gl, context, skippedFeaturesHash); this.drawReplaySkipping_(gl, context, skippedFeaturesHash);
} else { } else {
//Draw by style groups to minimize drawElements() calls. //Draw by style groups to minimize drawElements() calls.

View File

@@ -4,7 +4,7 @@
import {inherits} from '../../index.js'; import {inherits} from '../../index.js';
import {numberSafeCompareFunction} from '../../array.js'; import {numberSafeCompareFunction} from '../../array.js';
import {buffer, createOrUpdateFromCoordinate} from '../../extent.js'; import {buffer, createOrUpdateFromCoordinate} from '../../extent.js';
import _ol_obj_ from '../../obj.js'; import {isEmpty} from '../../obj.js';
import _ol_render_replay_ from '../replay.js'; import _ol_render_replay_ from '../replay.js';
import ReplayGroup from '../ReplayGroup.js'; import ReplayGroup from '../ReplayGroup.js';
import WebGLCircleReplay from '../webgl/CircleReplay.js'; import WebGLCircleReplay from '../webgl/CircleReplay.js';
@@ -127,7 +127,7 @@ WebGLReplayGroup.prototype.getReplay = function(zIndex, replayType) {
* @inheritDoc * @inheritDoc
*/ */
WebGLReplayGroup.prototype.isEmpty = function() { WebGLReplayGroup.prototype.isEmpty = function() {
return _ol_obj_.isEmpty(this.replaysByZIndex_); return isEmpty(this.replaysByZIndex_);
}; };

View File

@@ -3,7 +3,7 @@
*/ */
import {getUid, inherits} from '../../index.js'; import {getUid, inherits} from '../../index.js';
import {intersects} from '../../extent.js'; import {intersects} from '../../extent.js';
import _ol_obj_ from '../../obj.js'; import {isEmpty} from '../../obj.js';
import _ol_render_webgl_texturereplay_defaultshader_ from '../webgl/texturereplay/defaultshader.js'; import _ol_render_webgl_texturereplay_defaultshader_ from '../webgl/texturereplay/defaultshader.js';
import _ol_render_webgl_texturereplay_defaultshader_Locations_ from '../webgl/texturereplay/defaultshader/Locations.js'; import _ol_render_webgl_texturereplay_defaultshader_Locations_ from '../webgl/texturereplay/defaultshader/Locations.js';
import WebGLReplay from '../webgl/Replay.js'; import WebGLReplay from '../webgl/Replay.js';
@@ -331,9 +331,8 @@ WebGLTextureReplay.prototype.drawReplay = function(gl, context, skippedFeaturesH
const textures = hitDetection ? this.getHitDetectionTextures() : this.getTextures(); const textures = hitDetection ? this.getHitDetectionTextures() : this.getTextures();
const groupIndices = hitDetection ? this.hitDetectionGroupIndices : this.groupIndices; const groupIndices = hitDetection ? this.hitDetectionGroupIndices : this.groupIndices;
if (!_ol_obj_.isEmpty(skippedFeaturesHash)) { if (!isEmpty(skippedFeaturesHash)) {
this.drawReplaySkipping( this.drawReplaySkipping(gl, context, skippedFeaturesHash, textures, groupIndices);
gl, context, skippedFeaturesHash, textures, groupIndices);
} else { } else {
let i, ii, start; let i, ii, start;
for (i = 0, ii = textures.length, start = 0; i < ii; ++i) { for (i = 0, ii = textures.length, start = 0; i < ii; ++i) {

View File

@@ -9,7 +9,7 @@ import ViewHint from '../../ViewHint.js';
import {equals} from '../../array.js'; import {equals} from '../../array.js';
import {getHeight, getIntersection, getWidth, isEmpty} from '../../extent.js'; import {getHeight, getIntersection, getWidth, isEmpty} from '../../extent.js';
import _ol_layer_VectorRenderType_ from '../../layer/VectorRenderType.js'; import _ol_layer_VectorRenderType_ from '../../layer/VectorRenderType.js';
import _ol_obj_ from '../../obj.js'; import {assign} from '../../obj.js';
import {getLayerRendererPlugins} from '../../plugins.js'; import {getLayerRendererPlugins} from '../../plugins.js';
import RendererType from '../Type.js'; import RendererType from '../Type.js';
import IntermediateCanvasRenderer from '../canvas/IntermediateCanvas.js'; import IntermediateCanvasRenderer from '../canvas/IntermediateCanvas.js';
@@ -137,12 +137,12 @@ CanvasImageLayerRenderer.prototype.prepareFrame = function(frameState, layerStat
const vectorRenderer = this.vectorRenderer_; const vectorRenderer = this.vectorRenderer_;
if (vectorRenderer) { if (vectorRenderer) {
const context = vectorRenderer.context; const context = vectorRenderer.context;
const imageFrameState = /** @type {olx.FrameState} */ (_ol_obj_.assign({}, frameState, { const imageFrameState = /** @type {olx.FrameState} */ (assign({}, frameState, {
size: [ size: [
getWidth(renderedExtent) / viewResolution, getWidth(renderedExtent) / viewResolution,
getHeight(renderedExtent) / viewResolution getHeight(renderedExtent) / viewResolution
], ],
viewState: /** @type {olx.ViewState} */ (_ol_obj_.assign({}, frameState.viewState, { viewState: /** @type {olx.ViewState} */ (assign({}, frameState.viewState, {
rotation: 0 rotation: 0
})) }))
})); }));

View File

@@ -2,7 +2,7 @@
* @module ol/source/CartoDB * @module ol/source/CartoDB
*/ */
import {inherits} from '../index.js'; import {inherits} from '../index.js';
import _ol_obj_ from '../obj.js'; import {assign} from '../obj.js';
import SourceState from '../source/State.js'; import SourceState from '../source/State.js';
import XYZ from '../source/XYZ.js'; import XYZ from '../source/XYZ.js';
@@ -74,7 +74,7 @@ CartoDB.prototype.getConfig = function() {
* @api * @api
*/ */
CartoDB.prototype.updateConfig = function(config) { CartoDB.prototype.updateConfig = function(config) {
_ol_obj_.assign(this.config_, config); assign(this.config_, config);
this.initializeMap_(); this.initializeMap_();
}; };

View File

@@ -7,7 +7,7 @@ import {assert} from '../asserts.js';
import _ol_events_ from '../events.js'; import _ol_events_ from '../events.js';
import EventType from '../events/EventType.js'; import EventType from '../events/EventType.js';
import {containsExtent, getHeight, getWidth} from '../extent.js'; import {containsExtent, getHeight, getWidth} from '../extent.js';
import _ol_obj_ from '../obj.js'; import {assign} from '../obj.js';
import ImageSource from '../source/Image.js'; import ImageSource from '../source/Image.js';
import {appendParams} from '../uri.js'; import {appendParams} from '../uri.js';
@@ -136,7 +136,7 @@ ImageArcGISRest.prototype.getImageInternal = function(extent, resolution, pixelR
'FORMAT': 'PNG32', 'FORMAT': 'PNG32',
'TRANSPARENT': true 'TRANSPARENT': true
}; };
_ol_obj_.assign(params, this.params_); assign(params, this.params_);
extent = extent.slice(); extent = extent.slice();
const centerX = (extent[0] + extent[2]) / 2; const centerX = (extent[0] + extent[2]) / 2;
@@ -264,7 +264,7 @@ ImageArcGISRest.prototype.setUrl = function(url) {
* @api * @api
*/ */
ImageArcGISRest.prototype.updateParams = function(params) { ImageArcGISRest.prototype.updateParams = function(params) {
_ol_obj_.assign(this.params_, params); assign(this.params_, params);
this.image_ = null; this.image_ = null;
this.changed(); this.changed();
}; };

View File

@@ -6,7 +6,7 @@ import _ol_Image_ from '../Image.js';
import _ol_events_ from '../events.js'; import _ol_events_ from '../events.js';
import EventType from '../events/EventType.js'; import EventType from '../events/EventType.js';
import {containsExtent, getCenter, getHeight, getWidth, scaleFromCenter} from '../extent.js'; import {containsExtent, getCenter, getHeight, getWidth, scaleFromCenter} from '../extent.js';
import _ol_obj_ from '../obj.js'; import {assign} from '../obj.js';
import ImageSource from '../source/Image.js'; import ImageSource from '../source/Image.js';
import {appendParams} from '../uri.js'; import {appendParams} from '../uri.js';
@@ -193,7 +193,7 @@ ImageMapGuide.getScale = function(extent, size, metersPerUnit, dpi) {
* @api * @api
*/ */
ImageMapGuide.prototype.updateParams = function(params) { ImageMapGuide.prototype.updateParams = function(params) {
_ol_obj_.assign(this.params_, params); assign(this.params_, params);
this.changed(); this.changed();
}; };
@@ -223,7 +223,7 @@ ImageMapGuide.prototype.getUrl = function(baseUrl, params, extent, size, project
'SETVIEWCENTERX': center[0], 'SETVIEWCENTERX': center[0],
'SETVIEWCENTERY': center[1] 'SETVIEWCENTERY': center[1]
}; };
_ol_obj_.assign(baseParams, params); assign(baseParams, params);
return appendParams(baseUrl, baseParams); return appendParams(baseUrl, baseParams);
}; };

View File

@@ -9,7 +9,7 @@ import {assert} from '../asserts.js';
import _ol_events_ from '../events.js'; import _ol_events_ from '../events.js';
import EventType from '../events/EventType.js'; import EventType from '../events/EventType.js';
import {containsExtent, getCenter, getForViewAndSize, getHeight, getWidth} from '../extent.js'; import {containsExtent, getCenter, getForViewAndSize, getHeight, getWidth} from '../extent.js';
import _ol_obj_ from '../obj.js'; import {assign} from '../obj.js';
import {get as getProjection, transform} from '../proj.js'; import {get as getProjection, transform} from '../proj.js';
import _ol_reproj_ from '../reproj.js'; import _ol_reproj_ from '../reproj.js';
import ImageSource from '../source/Image.js'; import ImageSource from '../source/Image.js';
@@ -156,7 +156,7 @@ ImageWMS.prototype.getGetFeatureInfoUrl = function(coordinate, resolution, proje
'TRANSPARENT': true, 'TRANSPARENT': true,
'QUERY_LAYERS': this.params_['LAYERS'] 'QUERY_LAYERS': this.params_['LAYERS']
}; };
_ol_obj_.assign(baseParams, this.params_, params); assign(baseParams, this.params_, params);
const x = Math.floor((coordinate[0] - extent[0]) / resolution); const x = Math.floor((coordinate[0] - extent[0]) / resolution);
const y = Math.floor((extent[3] - coordinate[1]) / resolution); const y = Math.floor((extent[3] - coordinate[1]) / resolution);
@@ -223,7 +223,7 @@ ImageWMS.prototype.getImageInternal = function(extent, resolution, pixelRatio, p
'FORMAT': 'image/png', 'FORMAT': 'image/png',
'TRANSPARENT': true 'TRANSPARENT': true
}; };
_ol_obj_.assign(params, this.params_); assign(params, this.params_);
this.imageSize_[0] = Math.round(getWidth(requestExtent) / imageResolution); this.imageSize_[0] = Math.round(getWidth(requestExtent) / imageResolution);
this.imageSize_[1] = Math.round(getHeight(requestExtent) / imageResolution); this.imageSize_[1] = Math.round(getHeight(requestExtent) / imageResolution);
@@ -355,7 +355,7 @@ ImageWMS.prototype.setUrl = function(url) {
* @api * @api
*/ */
ImageWMS.prototype.updateParams = function(params) { ImageWMS.prototype.updateParams = function(params) {
_ol_obj_.assign(this.params_, params); assign(this.params_, params);
this.updateV13_(); this.updateV13_();
this.image_ = null; this.image_ = null;
this.changed(); this.changed();

View File

@@ -12,7 +12,7 @@ import {Processor} from 'pixelworks';
import {equals, getCenter, getHeight, getWidth} from '../extent.js'; import {equals, getCenter, getHeight, getWidth} from '../extent.js';
import ImageLayer from '../layer/Image.js'; import ImageLayer from '../layer/Image.js';
import TileLayer from '../layer/Tile.js'; import TileLayer from '../layer/Tile.js';
import _ol_obj_ from '../obj.js'; import {assign} from '../obj.js';
import CanvasImageLayerRenderer from '../renderer/canvas/ImageLayer.js'; import CanvasImageLayerRenderer from '../renderer/canvas/ImageLayer.js';
import CanvasTileLayerRenderer from '../renderer/canvas/TileLayer.js'; import CanvasTileLayerRenderer from '../renderer/canvas/TileLayer.js';
import ImageSource from '../source/Image.js'; import ImageSource from '../source/Image.js';
@@ -189,11 +189,9 @@ RasterSource.prototype.setOperation = function(operation, opt_lib) {
*/ */
RasterSource.prototype.updateFrameState_ = function(extent, resolution, projection) { RasterSource.prototype.updateFrameState_ = function(extent, resolution, projection) {
const frameState = /** @type {olx.FrameState} */ ( const frameState = /** @type {olx.FrameState} */ (assign({}, this.frameState_));
_ol_obj_.assign({}, this.frameState_));
frameState.viewState = /** @type {olx.ViewState} */ ( frameState.viewState = /** @type {olx.ViewState} */ (assign({}, frameState.viewState));
_ol_obj_.assign({}, frameState.viewState));
const center = getCenter(extent); const center = getCenter(extent);

View File

@@ -4,7 +4,7 @@
import {inherits} from '../index.js'; import {inherits} from '../index.js';
import {createEmpty} from '../extent.js'; import {createEmpty} from '../extent.js';
import {modulo} from '../math.js'; import {modulo} from '../math.js';
import _ol_obj_ from '../obj.js'; import {assign} from '../obj.js';
import _ol_size_ from '../size.js'; import _ol_size_ from '../size.js';
import TileImage from '../source/TileImage.js'; import TileImage from '../source/TileImage.js';
import _ol_tilecoord_ from '../tilecoord.js'; import _ol_tilecoord_ from '../tilecoord.js';
@@ -166,7 +166,7 @@ TileArcGISRest.prototype.fixedTileUrlFunction = function(tileCoord, pixelRatio,
'FORMAT': 'PNG32', 'FORMAT': 'PNG32',
'TRANSPARENT': true 'TRANSPARENT': true
}; };
_ol_obj_.assign(baseParams, this.params_); assign(baseParams, this.params_);
return this.getRequestUrl_(tileCoord, tileSize, tileExtent, return this.getRequestUrl_(tileCoord, tileSize, tileExtent,
pixelRatio, projection, baseParams); pixelRatio, projection, baseParams);
@@ -179,7 +179,7 @@ TileArcGISRest.prototype.fixedTileUrlFunction = function(tileCoord, pixelRatio,
* @api * @api
*/ */
TileArcGISRest.prototype.updateParams = function(params) { TileArcGISRest.prototype.updateParams = function(params) {
_ol_obj_.assign(this.params_, params); assign(this.params_, params);
this.setKey(this.getKeyForParams_()); this.setKey(this.getKeyForParams_());
}; };
export default TileArcGISRest; export default TileArcGISRest;

View File

@@ -6,7 +6,7 @@ import {DEFAULT_WMS_VERSION} from './common.js';
import {inherits} from '../index.js'; import {inherits} from '../index.js';
import {assert} from '../asserts.js'; import {assert} from '../asserts.js';
import {buffer, createEmpty} from '../extent.js'; import {buffer, createEmpty} from '../extent.js';
import _ol_obj_ from '../obj.js'; import {assign} from '../obj.js';
import {modulo} from '../math.js'; import {modulo} from '../math.js';
import {get as getProjection, transform, transformExtent} from '../proj.js'; import {get as getProjection, transform, transformExtent} from '../proj.js';
import _ol_reproj_ from '../reproj.js'; import _ol_reproj_ from '../reproj.js';
@@ -148,7 +148,7 @@ TileWMS.prototype.getGetFeatureInfoUrl = function(coordinate, resolution, projec
'TRANSPARENT': true, 'TRANSPARENT': true,
'QUERY_LAYERS': this.params_['LAYERS'] 'QUERY_LAYERS': this.params_['LAYERS']
}; };
_ol_obj_.assign(baseParams, this.params_, params); assign(baseParams, this.params_, params);
const x = Math.floor((coordinate[0] - tileExtent[0]) / tileResolution); const x = Math.floor((coordinate[0] - tileExtent[0]) / tileResolution);
const y = Math.floor((tileExtent[3] - coordinate[1]) / tileResolution); const y = Math.floor((tileExtent[3] - coordinate[1]) / tileResolution);
@@ -317,7 +317,7 @@ TileWMS.prototype.fixedTileUrlFunction = function(tileCoord, pixelRatio, project
'FORMAT': 'image/png', 'FORMAT': 'image/png',
'TRANSPARENT': true 'TRANSPARENT': true
}; };
_ol_obj_.assign(baseParams, this.params_); assign(baseParams, this.params_);
return this.getRequestUrl_(tileCoord, tileSize, tileExtent, return this.getRequestUrl_(tileCoord, tileSize, tileExtent,
pixelRatio, projection, baseParams); pixelRatio, projection, baseParams);
@@ -329,7 +329,7 @@ TileWMS.prototype.fixedTileUrlFunction = function(tileCoord, pixelRatio, project
* @api * @api
*/ */
TileWMS.prototype.updateParams = function(params) { TileWMS.prototype.updateParams = function(params) {
_ol_obj_.assign(this.params_, params); assign(this.params_, params);
this.updateV13_(); this.updateV13_();
this.setKey(this.getKeyForParams_()); this.setKey(this.getKeyForParams_());
}; };

View File

@@ -15,7 +15,7 @@ import {containsExtent, equals} from '../extent.js';
import {xhr} from '../featureloader.js'; import {xhr} from '../featureloader.js';
import {TRUE} from '../functions.js'; import {TRUE} from '../functions.js';
import _ol_loadingstrategy_ from '../loadingstrategy.js'; import _ol_loadingstrategy_ from '../loadingstrategy.js';
import _ol_obj_ from '../obj.js'; import {isEmpty, getValues} from '../obj.js';
import Source from '../source/Source.js'; import Source from '../source/Source.js';
import SourceState from '../source/State.js'; import SourceState from '../source/State.js';
import VectorEventType from '../source/VectorEventType.js'; import VectorEventType from '../source/VectorEventType.js';
@@ -506,8 +506,8 @@ VectorSource.prototype.getFeatures = function() {
features = this.featuresCollection_.getArray(); features = this.featuresCollection_.getArray();
} else if (this.featuresRtree_) { } else if (this.featuresRtree_) {
features = this.featuresRtree_.getAll(); features = this.featuresRtree_.getAll();
if (!_ol_obj_.isEmpty(this.nullGeometryFeatures_)) { if (!isEmpty(this.nullGeometryFeatures_)) {
extend(features, _ol_obj_.getValues(this.nullGeometryFeatures_)); extend(features, getValues(this.nullGeometryFeatures_));
} }
} }
return /** @type {Array.<ol.Feature>} */ (features); return /** @type {Array.<ol.Feature>} */ (features);
@@ -722,8 +722,7 @@ VectorSource.prototype.handleFeatureChange_ = function(event) {
* @return {boolean} Is empty. * @return {boolean} Is empty.
*/ */
VectorSource.prototype.isEmpty = function() { VectorSource.prototype.isEmpty = function() {
return this.featuresRtree_.isEmpty() && return this.featuresRtree_.isEmpty() && isEmpty(this.nullGeometryFeatures_);
_ol_obj_.isEmpty(this.nullGeometryFeatures_);
}; };

View File

@@ -5,7 +5,7 @@ import {inherits} from '../index.js';
import {expandUrl, createFromTileUrlFunctions, nullTileUrlFunction} from '../tileurlfunction.js'; import {expandUrl, createFromTileUrlFunctions, nullTileUrlFunction} from '../tileurlfunction.js';
import {find, findIndex, includes} from '../array.js'; import {find, findIndex, includes} from '../array.js';
import {containsExtent} from '../extent.js'; import {containsExtent} from '../extent.js';
import _ol_obj_ from '../obj.js'; import {assign} from '../obj.js';
import {get as getProjection, equivalent, transformExtent} from '../proj.js'; import {get as getProjection, equivalent, transformExtent} from '../proj.js';
import TileImage from '../source/TileImage.js'; import TileImage from '../source/TileImage.js';
import WMTSRequestEncoding from '../source/WMTSRequestEncoding.js'; import WMTSRequestEncoding from '../source/WMTSRequestEncoding.js';
@@ -92,7 +92,7 @@ const WMTS = function(options) {
}; };
if (requestEncoding == WMTSRequestEncoding.KVP) { if (requestEncoding == WMTSRequestEncoding.KVP) {
_ol_obj_.assign(context, { assign(context, {
'Service': 'WMTS', 'Service': 'WMTS',
'Request': 'GetTile', 'Request': 'GetTile',
'Version': this.version_, 'Version': this.version_,
@@ -135,7 +135,7 @@ const WMTS = function(options) {
'TileCol': tileCoord[1], 'TileCol': tileCoord[1],
'TileRow': -tileCoord[2] - 1 'TileRow': -tileCoord[2] - 1
}; };
_ol_obj_.assign(localContext, dimensions); assign(localContext, dimensions);
let url = template; let url = template;
if (requestEncoding == WMTSRequestEncoding.KVP) { if (requestEncoding == WMTSRequestEncoding.KVP) {
url = appendParams(url, localContext); url = appendParams(url, localContext);
@@ -280,7 +280,7 @@ WMTS.prototype.getKeyForDimensions_ = function() {
* @api * @api
*/ */
WMTS.prototype.updateDimensions = function(dimensions) { WMTS.prototype.updateDimensions = function(dimensions) {
_ol_obj_.assign(this.dimensions_, dimensions); assign(this.dimensions_, dimensions);
this.setKey(this.getKeyForDimensions_()); this.setKey(this.getKeyForDimensions_());
}; };

View File

@@ -2,7 +2,7 @@
* @module ol/structs/PriorityQueue * @module ol/structs/PriorityQueue
*/ */
import {assert} from '../asserts.js'; import {assert} from '../asserts.js';
import _ol_obj_ from '../obj.js'; import {clear} from '../obj.js';
/** /**
* Priority queue. * Priority queue.
@@ -67,7 +67,7 @@ PriorityQueue.DROP = Infinity;
PriorityQueue.prototype.clear = function() { PriorityQueue.prototype.clear = function() {
this.elements_.length = 0; this.elements_.length = 0;
this.priorities_.length = 0; this.priorities_.length = 0;
_ol_obj_.clear(this.queuedElements_); clear(this.queuedElements_);
}; };

View File

@@ -4,7 +4,7 @@
import {getUid} from '../index.js'; import {getUid} from '../index.js';
import rbush from 'rbush'; import rbush from 'rbush';
import {createOrUpdate, equals} from '../extent.js'; import {createOrUpdate, equals} from '../extent.js';
import _ol_obj_ from '../obj.js'; import {isEmpty} from '../obj.js';
/** /**
* Wrapper around the RBush by Vladimir Agafonkin. * Wrapper around the RBush by Vladimir Agafonkin.
@@ -193,7 +193,7 @@ RBush.prototype.forEach_ = function(values, callback, opt_this) {
* @return {boolean} Is empty. * @return {boolean} Is empty.
*/ */
RBush.prototype.isEmpty = function() { RBush.prototype.isEmpty = function() {
return _ol_obj_.isEmpty(this.items_); return isEmpty(this.items_);
}; };

View File

@@ -5,7 +5,7 @@ import {DEFAULT_MAX_ZOOM, DEFAULT_TILE_SIZE} from './tilegrid/common.js';
import _ol_size_ from './size.js'; import _ol_size_ from './size.js';
import {containsCoordinate, createOrUpdate, getCorner, getHeight, getWidth} from './extent.js'; import {containsCoordinate, createOrUpdate, getCorner, getHeight, getWidth} from './extent.js';
import Corner from './extent/Corner.js'; import Corner from './extent/Corner.js';
import _ol_obj_ from './obj.js'; import {assign} from './obj.js';
import {get as getProjection, METERS_PER_UNIT} from './proj.js'; import {get as getProjection, METERS_PER_UNIT} from './proj.js';
import Units from './proj/Units.js'; import Units from './proj/Units.js';
import TileGrid from './tilegrid/TileGrid.js'; import TileGrid from './tilegrid/TileGrid.js';
@@ -80,7 +80,7 @@ _ol_tilegrid_.createForExtent = function(extent, opt_maxZoom, opt_tileSize, opt_
*/ */
_ol_tilegrid_.createXYZ = function(opt_options) { _ol_tilegrid_.createXYZ = function(opt_options) {
const options = /** @type {olx.tilegrid.TileGridOptions} */ ({}); const options = /** @type {olx.tilegrid.TileGridOptions} */ ({});
_ol_obj_.assign(options, opt_options !== undefined ? assign(options, opt_options !== undefined ?
opt_options : /** @type {olx.tilegrid.XYZOptions} */ ({})); opt_options : /** @type {olx.tilegrid.XYZOptions} */ ({}));
if (options.extent === undefined) { if (options.extent === undefined) {
options.extent = getProjection('EPSG:3857').getExtent(); options.extent = getProjection('EPSG:3857').getExtent();

View File

@@ -5,7 +5,7 @@ import {WEBGL_EXTENSIONS, getUid, inherits} from '../index.js';
import Disposable from '../Disposable.js'; import Disposable from '../Disposable.js';
import {includes} from '../array.js'; import {includes} from '../array.js';
import _ol_events_ from '../events.js'; import _ol_events_ from '../events.js';
import _ol_obj_ from '../obj.js'; import {clear} from '../obj.js';
import _ol_webgl_ from '../webgl.js'; import _ol_webgl_ from '../webgl.js';
import ContextEventType from '../webgl/ContextEventType.js'; import ContextEventType from '../webgl/ContextEventType.js';
@@ -247,9 +247,9 @@ _ol_webgl_Context_.prototype.getProgram = function(
* FIXME empy description for jsdoc * FIXME empy description for jsdoc
*/ */
_ol_webgl_Context_.prototype.handleWebGLContextLost = function() { _ol_webgl_Context_.prototype.handleWebGLContextLost = function() {
_ol_obj_.clear(this.bufferCache_); clear(this.bufferCache_);
_ol_obj_.clear(this.shaderCache_); clear(this.shaderCache_);
_ol_obj_.clear(this.programCache_); clear(this.programCache_);
this.currentProgram_ = null; this.currentProgram_ = null;
this.hitDetectionFramebuffer_ = null; this.hitDetectionFramebuffer_ = null;
this.hitDetectionTexture_ = null; this.hitDetectionTexture_ = null;

View File

@@ -1,7 +1,7 @@
import Map from '../../../../src/ol/Map.js'; import Map from '../../../../src/ol/Map.js';
import View from '../../../../src/ol/View.js'; import View from '../../../../src/ol/View.js';
import ImageLayer from '../../../../src/ol/layer/Image.js'; import ImageLayer from '../../../../src/ol/layer/Image.js';
import _ol_obj_ from '../../../../src/ol/obj.js'; import {assign} from '../../../../src/ol/obj.js';
import {get as getProjection, transform, transformExtent} from '../../../../src/ol/proj.js'; import {get as getProjection, transform, transformExtent} from '../../../../src/ol/proj.js';
import Static from '../../../../src/ol/source/ImageStatic.js'; import Static from '../../../../src/ol/source/ImageStatic.js';
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js'; import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
@@ -56,7 +56,7 @@ describe('ol.rendering.layer.Image', function() {
const options = { const options = {
source: source source: source
}; };
_ol_obj_.assign(options, layerOptions); assign(options, layerOptions);
map.addLayer(new ImageLayer(options)); map.addLayer(new ImageLayer(options));
}); });
} }

View File

@@ -3,7 +3,7 @@ import View from '../../../../src/ol/View.js';
import * as _ol_extent_ from '../../../../src/ol/extent.js'; import * as _ol_extent_ from '../../../../src/ol/extent.js';
import Point from '../../../../src/ol/geom/Point.js'; import Point from '../../../../src/ol/geom/Point.js';
import TileLayer from '../../../../src/ol/layer/Tile.js'; import TileLayer from '../../../../src/ol/layer/Tile.js';
import _ol_obj_ from '../../../../src/ol/obj.js'; import {assign} from '../../../../src/ol/obj.js';
import {transform} from '../../../../src/ol/proj.js'; import {transform} from '../../../../src/ol/proj.js';
import TileImage from '../../../../src/ol/source/TileImage.js'; import TileImage from '../../../../src/ol/source/TileImage.js';
import XYZ from '../../../../src/ol/source/XYZ.js'; import XYZ from '../../../../src/ol/source/XYZ.js';
@@ -65,7 +65,7 @@ describe('ol.rendering.layer.Tile', function() {
const options = { const options = {
source: source source: source
}; };
_ol_obj_.assign(options, layerOptions[i] || layerOptions); assign(options, layerOptions[i] || layerOptions);
map.addLayer(new TileLayer(options)); map.addLayer(new TileLayer(options));
}); });
} }

View File

@@ -5,7 +5,7 @@ import MVT from '../../../../src/ol/format/MVT.js';
import Point from '../../../../src/ol/geom/Point.js'; import Point from '../../../../src/ol/geom/Point.js';
import VectorLayer from '../../../../src/ol/layer/Vector.js'; import VectorLayer from '../../../../src/ol/layer/Vector.js';
import VectorTileLayer from '../../../../src/ol/layer/VectorTile.js'; import VectorTileLayer from '../../../../src/ol/layer/VectorTile.js';
import _ol_obj_ from '../../../../src/ol/obj.js'; import {assign} from '../../../../src/ol/obj.js';
import VectorSource from '../../../../src/ol/source/Vector.js'; import VectorSource from '../../../../src/ol/source/Vector.js';
import VectorTileSource from '../../../../src/ol/source/VectorTile.js'; import VectorTileSource from '../../../../src/ol/source/VectorTile.js';
import CircleStyle from '../../../../src/ol/style/Circle.js'; import CircleStyle from '../../../../src/ol/style/Circle.js';
@@ -61,7 +61,7 @@ describe('ol.rendering.layer.VectorTile', function() {
const options = { const options = {
source: source source: source
}; };
_ol_obj_.assign(options, layerOptions); assign(options, layerOptions);
map.addLayer(new VectorTileLayer(options)); map.addLayer(new VectorTileLayer(options));
} }

View File

@@ -1,6 +1,6 @@
import Feature from '../../../src/ol/Feature.js'; import Feature from '../../../src/ol/Feature.js';
import Point from '../../../src/ol/geom/Point.js'; import Point from '../../../src/ol/geom/Point.js';
import _ol_obj_ from '../../../src/ol/obj.js'; import {isEmpty} from '../../../src/ol/obj.js';
import Style from '../../../src/ol/style/Style.js'; import Style from '../../../src/ol/style/Style.js';
@@ -85,7 +85,7 @@ describe('ol.Feature', function() {
it('is empty by default', function() { it('is empty by default', function() {
const feature = new Feature(); const feature = new Feature();
const properties = feature.getProperties(); const properties = feature.getProperties();
expect(_ol_obj_.isEmpty(properties)).to.be(true); expect(isEmpty(properties)).to.be(true);
}); });
}); });

View File

@@ -4,7 +4,7 @@ import Collection from '../../../../src/ol/Collection.js';
import * as _ol_extent_ from '../../../../src/ol/extent.js'; import * as _ol_extent_ from '../../../../src/ol/extent.js';
import LayerGroup from '../../../../src/ol/layer/Group.js'; import LayerGroup from '../../../../src/ol/layer/Group.js';
import Layer from '../../../../src/ol/layer/Layer.js'; import Layer from '../../../../src/ol/layer/Layer.js';
import _ol_obj_ from '../../../../src/ol/obj.js'; import {assign} from '../../../../src/ol/obj.js';
import MapRenderer from '../../../../src/ol/renderer/Map.js'; import MapRenderer from '../../../../src/ol/renderer/Map.js';
import Source from '../../../../src/ol/source/Source.js'; import Source from '../../../../src/ol/source/Source.js';
@@ -373,9 +373,9 @@ describe('ol.layer.Group', function() {
expect(layerStatesArray[0]).to.eql(layer1.getLayerState()); expect(layerStatesArray[0]).to.eql(layer1.getLayerState());
// layer state should match except for layer reference // layer state should match except for layer reference
const layerState = _ol_obj_.assign({}, layerStatesArray[0]); const layerState = assign({}, layerStatesArray[0]);
delete layerState.layer; delete layerState.layer;
const groupState = _ol_obj_.assign({}, layerGroup.getLayerState()); const groupState = assign({}, layerGroup.getLayerState());
delete groupState.layer; delete groupState.layer;
expect(layerState).to.eql(groupState); expect(layerState).to.eql(groupState);
@@ -421,14 +421,14 @@ describe('ol.layer.Group', function() {
// compare layer state to group state // compare layer state to group state
// layer state should match except for layer reference // layer state should match except for layer reference
let layerState = _ol_obj_.assign({}, layerStatesArray[0]); let layerState = assign({}, layerStatesArray[0]);
delete layerState.layer; delete layerState.layer;
const groupState = _ol_obj_.assign({}, layerGroup.getLayerState()); const groupState = assign({}, layerGroup.getLayerState());
delete groupState.layer; delete groupState.layer;
expect(layerState).to.eql(groupState); expect(layerState).to.eql(groupState);
// layer state should be transformed (and we ignore layer reference) // layer state should be transformed (and we ignore layer reference)
layerState = _ol_obj_.assign({}, layerStatesArray[1]); layerState = assign({}, layerStatesArray[1]);
delete layerState.layer; delete layerState.layer;
expect(layerState).to.eql({ expect(layerState).to.eql({
opacity: 0.25, opacity: 0.25,

View File

@@ -1,11 +1,11 @@
import _ol_obj_ from '../../../src/ol/obj.js'; import {assign, clear, isEmpty, getValues} from '../../../src/ol/obj.js';
describe('ol.obj.assign()', function() { describe('ol.obj.assign()', function() {
it('is an alias for Object.assign() where available', function() { it('is an alias for Object.assign() where available', function() {
if (typeof Object.assign === 'function') { if (typeof Object.assign === 'function') {
expect(_ol_obj_.assign).to.be(Object.assign); expect(assign).to.be(Object.assign);
} }
}); });
@@ -21,7 +21,7 @@ describe('ol.obj.assign()', function() {
targetProp1: 'targetValue1' targetProp1: 'targetValue1'
}; };
const assigned = _ol_obj_.assign(target, source); const assigned = assign(target, source);
expect(assigned).to.be(target); expect(assigned).to.be(target);
expect(assigned.sourceProp1).to.be('sourceValue1'); expect(assigned.sourceProp1).to.be('sourceValue1');
expect(assigned.sourceProp2).to.be('sourceValue2'); expect(assigned.sourceProp2).to.be('sourceValue2');
@@ -30,13 +30,13 @@ describe('ol.obj.assign()', function() {
}); });
it('throws a TypeError with `undefined` as target', function() { it('throws a TypeError with `undefined` as target', function() {
expect(_ol_obj_.assign).withArgs(undefined).to.throwException(function(e) { expect(assign).withArgs(undefined).to.throwException(function(e) {
expect(e).to.be.a(TypeError); expect(e).to.be.a(TypeError);
}); });
}); });
it('throws a TypeError with `null` as target', function() { it('throws a TypeError with `null` as target', function() {
expect(_ol_obj_.assign).withArgs(null).to.throwException(function(e) { expect(assign).withArgs(null).to.throwException(function(e) {
expect(e).to.be.a(TypeError); expect(e).to.be.a(TypeError);
}); });
}); });
@@ -46,8 +46,6 @@ describe('ol.obj.assign()', function() {
describe('ol.obj.clear()', function() { describe('ol.obj.clear()', function() {
it('removes all properties from an object', function() { it('removes all properties from an object', function() {
const clear = _ol_obj_.clear;
const isEmpty = _ol_obj_.isEmpty;
expect(isEmpty(clear({foo: 'bar'}))).to.be(true); expect(isEmpty(clear({foo: 'bar'}))).to.be(true);
expect(isEmpty(clear({foo: 'bar', num: 42}))).to.be(true); expect(isEmpty(clear({foo: 'bar', num: 42}))).to.be(true);
expect(isEmpty(clear({}))).to.be(true); expect(isEmpty(clear({}))).to.be(true);
@@ -59,8 +57,8 @@ describe('ol.obj.clear()', function() {
describe('ol.obj.getValues()', function() { describe('ol.obj.getValues()', function() {
it('gets a list of property values from an object', function() { it('gets a list of property values from an object', function() {
expect(_ol_obj_.getValues({foo: 'bar', num: 42}).sort()).to.eql([42, 'bar']); expect(getValues({foo: 'bar', num: 42}).sort()).to.eql([42, 'bar']);
expect(_ol_obj_.getValues(null)).to.eql([]); expect(getValues(null)).to.eql([]);
}); });
}); });
@@ -68,10 +66,10 @@ describe('ol.obj.getValues()', function() {
describe('ol.obj.isEmpty()', function() { describe('ol.obj.isEmpty()', function() {
it('checks if an object has any properties', function() { it('checks if an object has any properties', function() {
expect(_ol_obj_.isEmpty({})).to.be(true); expect(isEmpty({})).to.be(true);
expect(_ol_obj_.isEmpty(null)).to.be(true); expect(isEmpty(null)).to.be(true);
expect(_ol_obj_.isEmpty({foo: 'bar'})).to.be(false); expect(isEmpty({foo: 'bar'})).to.be(false);
expect(_ol_obj_.isEmpty({foo: false})).to.be(false); expect(isEmpty({foo: false})).to.be(false);
}); });
}); });

View File

@@ -2,8 +2,9 @@ import _ol_events_ from '../../../../src/ol/events.js';
import Event from '../../../../src/ol/events/Event.js'; import Event from '../../../../src/ol/events/Event.js';
import EventTarget from '../../../../src/ol/events/EventTarget.js'; import EventTarget from '../../../../src/ol/events/EventTarget.js';
import _ol_has_ from '../../../../src/ol/has.js'; import _ol_has_ from '../../../../src/ol/has.js';
import _ol_obj_ from '../../../../src/ol/obj.js'; import {assign} from '../../../../src/ol/obj.js';
import PointerEventHandler from '../../../../src/ol/pointer/PointerEventHandler.js'; import PointerEventHandler from '../../../../src/ol/pointer/PointerEventHandler.js';
describe('ol.pointer.TouchSource', function() { describe('ol.pointer.TouchSource', function() {
let handler; let handler;
let target; let target;
@@ -123,7 +124,7 @@ describe('ol.pointer.TouchSource', function() {
touches = touches !== undefined ? touches : changedTouches; touches = touches !== undefined ? touches : changedTouches;
const event = new Event(type); const event = new Event(type);
_ol_obj_.assign(event, { assign(event, {
touches: touches, touches: touches,
changedTouches: changedTouches changedTouches: changedTouches
}); });

View File

@@ -1,5 +1,5 @@
import _ol_events_ from '../../../../../src/ol/events.js'; import _ol_events_ from '../../../../../src/ol/events.js';
import _ol_obj_ from '../../../../../src/ol/obj.js'; import {clear} from '../../../../../src/ol/obj.js';
import _ol_render_canvas_ from '../../../../../src/ol/render/canvas.js'; import _ol_render_canvas_ from '../../../../../src/ol/render/canvas.js';
@@ -13,7 +13,7 @@ describe('ol.render.canvas', function() {
describe('ol.render.canvas.checkFont()', function() { describe('ol.render.canvas.checkFont()', function() {
beforeEach(function() { beforeEach(function() {
_ol_obj_.clear(_ol_render_canvas_.checkedFonts_); clear(_ol_render_canvas_.checkedFonts_);
_ol_render_canvas_.getMeasureContext(); _ol_render_canvas_.getMeasureContext();
_ol_render_canvas_.measureTextHeight('12px sans-serif'); _ol_render_canvas_.measureTextHeight('12px sans-serif');
}); });

View File

@@ -5,7 +5,7 @@ import View from '../../../../../src/ol/View.js';
import * as _ol_extent_ from '../../../../../src/ol/extent.js'; import * as _ol_extent_ from '../../../../../src/ol/extent.js';
import Point from '../../../../../src/ol/geom/Point.js'; import Point from '../../../../../src/ol/geom/Point.js';
import VectorLayer from '../../../../../src/ol/layer/Vector.js'; import VectorLayer from '../../../../../src/ol/layer/Vector.js';
import _ol_obj_ from '../../../../../src/ol/obj.js'; import {clear} from '../../../../../src/ol/obj.js';
import {get as getProjection} from '../../../../../src/ol/proj.js'; import {get as getProjection} from '../../../../../src/ol/proj.js';
import _ol_render_canvas_ from '../../../../../src/ol/render/canvas.js'; import _ol_render_canvas_ from '../../../../../src/ol/render/canvas.js';
import CanvasVectorLayerRenderer from '../../../../../src/ol/renderer/canvas/VectorLayer.js'; import CanvasVectorLayerRenderer from '../../../../../src/ol/renderer/canvas/VectorLayer.js';
@@ -85,7 +85,7 @@ describe('ol.renderer.canvas.VectorLayer', function() {
}); });
it('does not re-render for unavailable fonts', function(done) { it('does not re-render for unavailable fonts', function(done) {
_ol_obj_.clear(_ol_render_canvas_.checkedFonts_); clear(_ol_render_canvas_.checkedFonts_);
const map = new Map({ const map = new Map({
view: new View({ view: new View({
center: [0, 0], center: [0, 0],
@@ -116,7 +116,7 @@ describe('ol.renderer.canvas.VectorLayer', function() {
}); });
it('does not re-render for available fonts', function(done) { it('does not re-render for available fonts', function(done) {
_ol_obj_.clear(_ol_render_canvas_.checkedFonts_); clear(_ol_render_canvas_.checkedFonts_);
const map = new Map({ const map = new Map({
view: new View({ view: new View({
center: [0, 0], center: [0, 0],
@@ -147,7 +147,7 @@ describe('ol.renderer.canvas.VectorLayer', function() {
}); });
it('re-renders for fonts that become available', function(done) { it('re-renders for fonts that become available', function(done) {
_ol_obj_.clear(_ol_render_canvas_.checkedFonts_); clear(_ol_render_canvas_.checkedFonts_);
head.appendChild(font); head.appendChild(font);
const map = new Map({ const map = new Map({
view: new View({ view: new View({

View File

@@ -1,5 +1,5 @@
import {getUid, inherits} from '../../../../../src/ol/index.js'; import {getUid, inherits} from '../../../../../src/ol/index.js';
import _ol_obj_ from '../../../../../src/ol/obj.js'; import {clear} from '../../../../../src/ol/obj.js';
import Feature from '../../../../../src/ol/Feature.js'; import Feature from '../../../../../src/ol/Feature.js';
import Map from '../../../../../src/ol/Map.js'; import Map from '../../../../../src/ol/Map.js';
import TileState from '../../../../../src/ol/TileState.js'; import TileState from '../../../../../src/ol/TileState.js';
@@ -154,7 +154,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() {
it('does not re-render for unavailable fonts', function(done) { it('does not re-render for unavailable fonts', function(done) {
map.renderSync(); map.renderSync();
_ol_obj_.clear(_ol_render_canvas_.checkedFonts_); clear(_ol_render_canvas_.checkedFonts_);
layerStyle[0].getText().setFont('12px "Unavailable font",sans-serif'); layerStyle[0].getText().setFont('12px "Unavailable font",sans-serif');
layer.changed(); layer.changed();
const revision = layer.getRevision(); const revision = layer.getRevision();
@@ -166,7 +166,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() {
it('does not re-render for available fonts', function(done) { it('does not re-render for available fonts', function(done) {
map.renderSync(); map.renderSync();
_ol_obj_.clear(_ol_render_canvas_.checkedFonts_); clear(_ol_render_canvas_.checkedFonts_);
layerStyle[0].getText().setFont('12px sans-serif'); layerStyle[0].getText().setFont('12px sans-serif');
layer.changed(); layer.changed();
const revision = layer.getRevision(); const revision = layer.getRevision();
@@ -178,7 +178,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() {
it('re-renders for fonts that become available', function(done) { it('re-renders for fonts that become available', function(done) {
map.renderSync(); map.renderSync();
_ol_obj_.clear(_ol_render_canvas_.checkedFonts_); clear(_ol_render_canvas_.checkedFonts_);
head.appendChild(font); head.appendChild(font);
layerStyle[0].getText().setFont('12px "Dancing Script",sans-serif'); layerStyle[0].getText().setFont('12px "Dancing Script",sans-serif');
layer.changed(); layer.changed();