Named export for ol/asserts
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @module ol/Feature
|
||||
*/
|
||||
import _ol_asserts_ from './asserts.js';
|
||||
import {assert} from './asserts.js';
|
||||
import _ol_events_ from './events.js';
|
||||
import EventType from './events/EventType.js';
|
||||
import {inherits} from './index.js';
|
||||
@@ -307,7 +307,7 @@ _ol_Feature_.createStyleFunction = function(obj) {
|
||||
if (Array.isArray(obj)) {
|
||||
styles = obj;
|
||||
} else {
|
||||
_ol_asserts_.assert(obj instanceof _ol_style_Style_,
|
||||
assert(obj instanceof _ol_style_Style_,
|
||||
41); // Expected an `ol.style.Style` or an array of `ol.style.Style`
|
||||
styles = [obj];
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import _ol_ObjectEventType_ from './ObjectEventType.js';
|
||||
import TileQueue from './TileQueue.js';
|
||||
import _ol_View_ from './View.js';
|
||||
import _ol_ViewHint_ from './ViewHint.js';
|
||||
import _ol_asserts_ from './asserts.js';
|
||||
import {assert} from './asserts.js';
|
||||
import {removeNode} from './dom.js';
|
||||
import _ol_events_ from './events.js';
|
||||
import Event from './events/Event.js';
|
||||
@@ -1424,7 +1424,7 @@ _ol_PluggableMap_.createOptionsInternal = function(options) {
|
||||
} else if (typeof options.renderer === 'string') {
|
||||
rendererTypes = [options.renderer];
|
||||
} else {
|
||||
_ol_asserts_.assert(false, 46); // Incorrect format for `renderer` option
|
||||
assert(false, 46); // Incorrect format for `renderer` option
|
||||
}
|
||||
if (rendererTypes.indexOf(/** @type {ol.renderer.Type} */ ('dom')) >= 0) {
|
||||
rendererTypes = rendererTypes.concat(_ol_PluggableMap_.DEFAULT_RENDERER_TYPES);
|
||||
@@ -1459,7 +1459,7 @@ _ol_PluggableMap_.createOptionsInternal = function(options) {
|
||||
if (Array.isArray(options.controls)) {
|
||||
controls = new _ol_Collection_(options.controls.slice());
|
||||
} else {
|
||||
_ol_asserts_.assert(options.controls instanceof _ol_Collection_,
|
||||
assert(options.controls instanceof _ol_Collection_,
|
||||
47); // Expected `controls` to be an array or an `ol.Collection`
|
||||
controls = options.controls;
|
||||
}
|
||||
@@ -1470,7 +1470,7 @@ _ol_PluggableMap_.createOptionsInternal = function(options) {
|
||||
if (Array.isArray(options.interactions)) {
|
||||
interactions = new _ol_Collection_(options.interactions.slice());
|
||||
} else {
|
||||
_ol_asserts_.assert(options.interactions instanceof _ol_Collection_,
|
||||
assert(options.interactions instanceof _ol_Collection_,
|
||||
48); // Expected `interactions` to be an array or an `ol.Collection`
|
||||
interactions = options.interactions;
|
||||
}
|
||||
@@ -1481,7 +1481,7 @@ _ol_PluggableMap_.createOptionsInternal = function(options) {
|
||||
if (Array.isArray(options.overlays)) {
|
||||
overlays = new _ol_Collection_(options.overlays.slice());
|
||||
} else {
|
||||
_ol_asserts_.assert(options.overlays instanceof _ol_Collection_,
|
||||
assert(options.overlays instanceof _ol_Collection_,
|
||||
49); // Expected `overlays` to be an array or an `ol.Collection`
|
||||
overlays = options.overlays;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import _ol_RotationConstraint_ from './RotationConstraint.js';
|
||||
import _ol_ViewHint_ from './ViewHint.js';
|
||||
import _ol_ViewProperty_ from './ViewProperty.js';
|
||||
import _ol_array_ from './array.js';
|
||||
import _ol_asserts_ from './asserts.js';
|
||||
import {assert} from './asserts.js';
|
||||
import _ol_coordinate_ from './coordinate.js';
|
||||
import {inAndOut} from './easing.js';
|
||||
import {getForViewAndSize, getCenter, getHeight, getWidth, isEmpty} from './extent.js';
|
||||
@@ -608,11 +608,11 @@ _ol_View_.prototype.getHints = function(opt_hints) {
|
||||
_ol_View_.prototype.calculateExtent = function(opt_size) {
|
||||
var size = opt_size || this.getSizeFromViewport_();
|
||||
var center = /** @type {!ol.Coordinate} */ (this.getCenter());
|
||||
_ol_asserts_.assert(center, 1); // The view center is not defined
|
||||
assert(center, 1); // The view center is not defined
|
||||
var resolution = /** @type {!number} */ (this.getResolution());
|
||||
_ol_asserts_.assert(resolution !== undefined, 2); // The view resolution is not defined
|
||||
assert(resolution !== undefined, 2); // The view resolution is not defined
|
||||
var rotation = /** @type {!number} */ (this.getRotation());
|
||||
_ol_asserts_.assert(rotation !== undefined, 3); // The view rotation is not defined
|
||||
assert(rotation !== undefined, 3); // The view rotation is not defined
|
||||
|
||||
return getForViewAndSize(center, resolution, rotation, size);
|
||||
};
|
||||
@@ -880,9 +880,9 @@ _ol_View_.prototype.fit = function(geometryOrExtent, opt_options) {
|
||||
/** @type {ol.geom.SimpleGeometry} */
|
||||
var geometry;
|
||||
if (!(geometryOrExtent instanceof SimpleGeometry)) {
|
||||
_ol_asserts_.assert(Array.isArray(geometryOrExtent),
|
||||
assert(Array.isArray(geometryOrExtent),
|
||||
24); // Invalid extent or geometry provided as `geometry`
|
||||
_ol_asserts_.assert(!isEmpty(geometryOrExtent),
|
||||
assert(!isEmpty(geometryOrExtent),
|
||||
25); // Cannot fit empty extent provided as `geometry`
|
||||
geometry = Polygon.fromExtent(geometryOrExtent);
|
||||
} else if (geometryOrExtent.getType() === GeometryType.CIRCLE) {
|
||||
|
||||
@@ -2,16 +2,13 @@
|
||||
* @module ol/asserts
|
||||
*/
|
||||
import AssertionError from './AssertionError.js';
|
||||
var _ol_asserts_ = {};
|
||||
|
||||
|
||||
/**
|
||||
* @param {*} assertion Assertion we expected to be truthy.
|
||||
* @param {number} errorCode Error code.
|
||||
*/
|
||||
_ol_asserts_.assert = function(assertion, errorCode) {
|
||||
export function assert(assertion, errorCode) {
|
||||
if (!assertion) {
|
||||
throw new AssertionError(errorCode);
|
||||
}
|
||||
};
|
||||
export default _ol_asserts_;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @module ol/color
|
||||
*/
|
||||
import _ol_asserts_ from './asserts.js';
|
||||
import {assert} from './asserts.js';
|
||||
import _ol_math_ from './math.js';
|
||||
var _ol_color_ = {};
|
||||
|
||||
@@ -173,7 +173,7 @@ _ol_color_.fromStringInternal_ = function(s) {
|
||||
parts.push(1);
|
||||
color = _ol_color_.normalize(parts);
|
||||
} else {
|
||||
_ol_asserts_.assert(false, 14); // Invalid color
|
||||
assert(false, 14); // Invalid color
|
||||
}
|
||||
return /** @type {ol.Color} */ (color);
|
||||
};
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_Object_ from '../Object.js';
|
||||
import _ol_asserts_ from '../asserts.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import Control from '../control/Control.js';
|
||||
import ScaleLineUnits from '../control/ScaleLineUnits.js';
|
||||
import _ol_css_ from '../css.js';
|
||||
@@ -237,7 +237,7 @@ ScaleLine.prototype.updateElement_ = function() {
|
||||
pointResolution /= 1609.3472;
|
||||
}
|
||||
} else {
|
||||
_ol_asserts_.assert(false, 33); // Invalid units
|
||||
assert(false, 33); // Invalid units
|
||||
}
|
||||
|
||||
var i = 3 * Math.floor(
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @module ol/events/condition
|
||||
*/
|
||||
import MapBrowserEventType from '../MapBrowserEventType.js';
|
||||
import _ol_asserts_ from '../asserts.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import {TRUE, FALSE} from '../functions.js';
|
||||
import _ol_has_ from '../has.js';
|
||||
var _ol_events_condition_ = {};
|
||||
@@ -206,7 +206,7 @@ _ol_events_condition_.targetNotEditable = function(mapBrowserEvent) {
|
||||
* @api
|
||||
*/
|
||||
_ol_events_condition_.mouseOnly = function(mapBrowserEvent) {
|
||||
_ol_asserts_.assert(mapBrowserEvent.pointerEvent, 56); // mapBrowserEvent must originate from a pointer event
|
||||
assert(mapBrowserEvent.pointerEvent, 56); // mapBrowserEvent must originate from a pointer event
|
||||
// see http://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType
|
||||
return /** @type {ol.MapBrowserEvent} */ (mapBrowserEvent).pointerEvent.pointerType == 'mouse';
|
||||
};
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_Feature_ from '../Feature.js';
|
||||
import _ol_asserts_ from '../asserts.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import {containsExtent} from '../extent.js';
|
||||
import FeatureFormat from '../format/Feature.js';
|
||||
import JSONFeature from '../format/JSONFeature.js';
|
||||
@@ -277,7 +277,7 @@ EsriJSON.writePointGeometry_ = function(geometry, opt_options) {
|
||||
y: coordinates[1]
|
||||
});
|
||||
} else {
|
||||
_ol_asserts_.assert(false, 34); // Invalid geometry layout
|
||||
assert(false, 34); // Invalid geometry layout
|
||||
}
|
||||
return /** @type {EsriJSONGeometry} */ (esriJSON);
|
||||
};
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
// see https://github.com/openlayers/openlayers/issues/2078
|
||||
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_asserts_ from '../asserts.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import _ol_Feature_ from '../Feature.js';
|
||||
import FeatureFormat from '../format/Feature.js';
|
||||
import JSONFeature from '../format/JSONFeature.js';
|
||||
@@ -469,7 +469,7 @@ GeoJSON.prototype.readProjectionFromObject = function(object) {
|
||||
if (crs.type == 'name') {
|
||||
projection = getProjection(crs.properties.name);
|
||||
} else {
|
||||
_ol_asserts_.assert(false, 36); // Unknown SRS type
|
||||
assert(false, 36); // Unknown SRS type
|
||||
}
|
||||
} else {
|
||||
projection = this.defaultDataProjection;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_Feature_ from '../Feature.js';
|
||||
import _ol_array_ from '../array.js';
|
||||
import _ol_asserts_ from '../asserts.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import _ol_color_ from '../color.js';
|
||||
import FeatureFormat from '../format/Feature.js';
|
||||
import XMLFeature from '../format/XMLFeature.js';
|
||||
@@ -945,7 +945,7 @@ KML.readMultiGeometry_ = function(node, objectStack) {
|
||||
} else if (type == GeometryType.GEOMETRY_COLLECTION) {
|
||||
multiGeometry = new GeometryCollection(geometries);
|
||||
} else {
|
||||
_ol_asserts_.assert(false, 37); // Unknown geometry type found
|
||||
assert(false, 37); // Unknown geometry type found
|
||||
}
|
||||
} else {
|
||||
multiGeometry = new GeometryCollection(geometries);
|
||||
@@ -1171,7 +1171,7 @@ KML.PlacemarkStyleMapParser_ = function(node, objectStack) {
|
||||
} else if (typeof styleMapValue === 'string') {
|
||||
placemarkObject['styleUrl'] = styleMapValue;
|
||||
} else {
|
||||
_ol_asserts_.assert(false, 38); // `styleMapValue` has an unknown type
|
||||
assert(false, 38); // `styleMapValue` has an unknown type
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2124,7 +2124,7 @@ KML.writeCoordinatesTextNode_ = function(node, coordinates, objectStack) {
|
||||
layout == GeometryLayout.XYZM) {
|
||||
dimension = 3;
|
||||
} else {
|
||||
_ol_asserts_.assert(false, 34); // Invalid geometry layout
|
||||
assert(false, 34); // Invalid geometry layout
|
||||
}
|
||||
|
||||
var d, i;
|
||||
@@ -2382,7 +2382,7 @@ KML.writeMultiGeometry_ = function(node, geometry, objectStack) {
|
||||
(/** @type {ol.geom.MultiPolygon} */ (geometry)).getPolygons();
|
||||
factory = KML.POLYGON_NODE_FACTORY_;
|
||||
} else {
|
||||
_ol_asserts_.assert(false, 39); // Unknown geometry type
|
||||
assert(false, 39); // Unknown geometry type
|
||||
}
|
||||
_ol_xml_.pushSerializeAndPop(context,
|
||||
KML.MULTI_GEOMETRY_SERIALIZERS_, factory,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
//FIXME Implement projection handling
|
||||
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_asserts_ from '../asserts.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import PBF from 'pbf';
|
||||
import FeatureFormat from '../format/Feature.js';
|
||||
import _ol_format_FormatType_ from '../format/FormatType.js';
|
||||
@@ -225,7 +225,7 @@ MVT.readRawGeometry_ = function(pbf, feature, flatCoordinates, ends) {
|
||||
}
|
||||
|
||||
} else {
|
||||
_ol_asserts_.assert(false, 59); // Invalid command found in the PBF
|
||||
assert(false, 59); // Invalid command found in the PBF
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @module ol/format/Polyline
|
||||
*/
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_asserts_ from '../asserts.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import _ol_Feature_ from '../Feature.js';
|
||||
import FeatureFormat from '../format/Feature.js';
|
||||
import TextFeature from '../format/TextFeature.js';
|
||||
@@ -359,7 +359,7 @@ Polyline.prototype.writeFeatureText = function(feature, opt_options) {
|
||||
if (geometry) {
|
||||
return this.writeGeometryText(geometry, opt_options);
|
||||
} else {
|
||||
_ol_asserts_.assert(false, 40); // Expected `feature` to have a geometry
|
||||
assert(false, 40); // Expected `feature` to have a geometry
|
||||
return '';
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @module ol/format/WFS
|
||||
*/
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_asserts_ from '../asserts.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import GML2 from '../format/GML2.js';
|
||||
import GML3 from '../format/GML3.js';
|
||||
import GMLBase from '../format/GMLBase.js';
|
||||
@@ -450,7 +450,7 @@ WFS.getTypeName_ = function(featurePrefix, featureType) {
|
||||
*/
|
||||
WFS.writeDelete_ = function(node, feature, objectStack) {
|
||||
var context = objectStack[objectStack.length - 1];
|
||||
_ol_asserts_.assert(feature.getId() !== undefined, 26); // Features must have an id set
|
||||
assert(feature.getId() !== undefined, 26); // Features must have an id set
|
||||
var featureType = context['featureType'];
|
||||
var featurePrefix = context['featurePrefix'];
|
||||
var featureNS = context['featureNS'];
|
||||
@@ -473,7 +473,7 @@ WFS.writeDelete_ = function(node, feature, objectStack) {
|
||||
*/
|
||||
WFS.writeUpdate_ = function(node, feature, objectStack) {
|
||||
var context = objectStack[objectStack.length - 1];
|
||||
_ol_asserts_.assert(feature.getId() !== undefined, 27); // Features must have an id set
|
||||
assert(feature.getId() !== undefined, 27); // Features must have an id set
|
||||
var featureType = context['featureType'];
|
||||
var featurePrefix = context['featurePrefix'];
|
||||
var featureNS = context['featureNS'];
|
||||
@@ -958,7 +958,7 @@ WFS.prototype.writeGetFeature = function(options) {
|
||||
}
|
||||
filter = options.filter;
|
||||
if (options.bbox) {
|
||||
_ol_asserts_.assert(options.geometryName,
|
||||
assert(options.geometryName,
|
||||
12); // `options.geometryName` must also be provided when `options.bbox` is set
|
||||
var bbox = _ol_format_filter_.bbox(
|
||||
/** @type {string} */ (options.geometryName), options.bbox, options.srsName);
|
||||
@@ -982,7 +982,7 @@ WFS.prototype.writeGetFeature = function(options) {
|
||||
'filter': filter,
|
||||
'propertyNames': options.propertyNames ? options.propertyNames : []
|
||||
};
|
||||
_ol_asserts_.assert(Array.isArray(options.featureTypes),
|
||||
assert(Array.isArray(options.featureTypes),
|
||||
11); // `options.featureTypes` should be an Array
|
||||
WFS.writeGetFeature_(node, /** @type {!Array.<string>} */ (options.featureTypes), [context]);
|
||||
return node;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @module ol/format/filter/LogicalNary
|
||||
*/
|
||||
import {inherits} from '../../index.js';
|
||||
import _ol_asserts_ from '../../asserts.js';
|
||||
import {assert} from '../../asserts.js';
|
||||
import Filter from '../filter/Filter.js';
|
||||
|
||||
/**
|
||||
@@ -25,7 +25,7 @@ var LogicalNary = function(tagName, conditions) {
|
||||
* @type {Array.<ol.format.filter.Filter>}
|
||||
*/
|
||||
this.conditions = Array.prototype.slice.call(arguments, 1);
|
||||
_ol_asserts_.assert(this.conditions.length >= 2, 57); // At least 2 conditions are required.
|
||||
assert(this.conditions.length >= 2, 57); // At least 2 conditions are required.
|
||||
};
|
||||
|
||||
inherits(LogicalNary, Filter);
|
||||
|
||||
@@ -6,7 +6,7 @@ import _ol_Collection_ from '../Collection.js';
|
||||
import _ol_CollectionEventType_ from '../CollectionEventType.js';
|
||||
import _ol_Object_ from '../Object.js';
|
||||
import _ol_ObjectEventType_ from '../ObjectEventType.js';
|
||||
import _ol_asserts_ from '../asserts.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import _ol_events_ from '../events.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
import {getIntersection} from '../extent.js';
|
||||
@@ -56,7 +56,7 @@ var _ol_layer_Group_ = function(opt_options) {
|
||||
if (Array.isArray(layers)) {
|
||||
layers = new _ol_Collection_(layers.slice(), {unique: true});
|
||||
} else {
|
||||
_ol_asserts_.assert(layers instanceof _ol_Collection_,
|
||||
assert(layers instanceof _ol_Collection_,
|
||||
43); // Expected `layers` to be an array or an `ol.Collection`
|
||||
layers = layers;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_LayerType_ from '../LayerType.js';
|
||||
import _ol_asserts_ from '../asserts.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import _ol_layer_TileProperty_ from '../layer/TileProperty.js';
|
||||
import _ol_layer_Vector_ from '../layer/Vector.js';
|
||||
import _ol_layer_VectorTileRenderType_ from '../layer/VectorTileRenderType.js';
|
||||
@@ -25,7 +25,7 @@ var _ol_layer_VectorTile_ = function(opt_options) {
|
||||
var options = opt_options ? opt_options : {};
|
||||
|
||||
var renderMode = options.renderMode || _ol_layer_VectorTileRenderType_.HYBRID;
|
||||
_ol_asserts_.assert(renderMode == undefined ||
|
||||
assert(renderMode == undefined ||
|
||||
renderMode == _ol_layer_VectorTileRenderType_.IMAGE ||
|
||||
renderMode == _ol_layer_VectorTileRenderType_.HYBRID ||
|
||||
renderMode == _ol_layer_VectorTileRenderType_.VECTOR,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @module ol/math
|
||||
*/
|
||||
import _ol_asserts_ from './asserts.js';
|
||||
import {assert} from './asserts.js';
|
||||
var _ol_math_ = {};
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ _ol_math_.cosh = (function() {
|
||||
* @return {number} The smallest power of two greater than or equal to x.
|
||||
*/
|
||||
_ol_math_.roundUpToPowerOfTwo = function(x) {
|
||||
_ol_asserts_.assert(0 < x, 29); // `x` must be greater than `0`
|
||||
assert(0 < x, 29); // `x` must be greater than `0`
|
||||
return Math.pow(2, Math.ceil(Math.log(x) / Math.LN2));
|
||||
};
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
|
||||
import {getUid, inherits} from '../index.js';
|
||||
import _ol_asserts_ from '../asserts.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import _ol_Feature_ from '../Feature.js';
|
||||
import _ol_coordinate_ from '../coordinate.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
@@ -55,7 +55,7 @@ var _ol_source_Cluster_ = function(options) {
|
||||
*/
|
||||
this.geometryFunction = options.geometryFunction || function(feature) {
|
||||
var geometry = /** @type {ol.geom.Point} */ (feature.getGeometry());
|
||||
_ol_asserts_.assert(geometry instanceof Point,
|
||||
assert(geometry instanceof Point,
|
||||
10); // The default `geometryFunction` can only handle `ol.geom.Point` geometries
|
||||
return geometry;
|
||||
};
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_Image_ from '../Image.js';
|
||||
import _ol_asserts_ from '../asserts.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import _ol_events_ from '../events.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
import {containsExtent, getHeight, getWidth} from '../extent.js';
|
||||
@@ -216,7 +216,7 @@ _ol_source_ImageArcGISRest_.prototype.getRequestUrl_ = function(extent, size, pi
|
||||
.replace(/MapServer\/?$/, 'MapServer/export')
|
||||
.replace(/ImageServer\/?$/, 'ImageServer/exportImage');
|
||||
if (modifiedUrl == url) {
|
||||
_ol_asserts_.assert(false, 50); // `options.featureTypes` should be an Array
|
||||
assert(false, 50); // `options.featureTypes` should be an Array
|
||||
}
|
||||
return _ol_uri_.appendParams(modifiedUrl, params);
|
||||
};
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import {DEFAULT_WMS_VERSION} from './common.js';
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_Image_ from '../Image.js';
|
||||
import _ol_asserts_ from '../asserts.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import _ol_events_ from '../events.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
import {containsExtent, getCenter, getForViewAndSize, getHeight, getWidth} from '../extent.js';
|
||||
@@ -265,7 +265,7 @@ _ol_source_ImageWMS_.prototype.getImageLoadFunction = function() {
|
||||
*/
|
||||
_ol_source_ImageWMS_.prototype.getRequestUrl_ = function(extent, size, pixelRatio, projection, params) {
|
||||
|
||||
_ol_asserts_.assert(this.url_ !== undefined, 9); // `url` must be configured or set using `#setUrl()`
|
||||
assert(this.url_ !== undefined, 9); // `url` must be configured or set using `#setUrl()`
|
||||
|
||||
params[this.v13_ ? 'CRS' : 'SRS'] = projection.getCode();
|
||||
|
||||
@@ -291,7 +291,7 @@ _ol_source_ImageWMS_.prototype.getRequestUrl_ = function(extent, size, pixelRati
|
||||
params['DPI'] = 90 * pixelRatio;
|
||||
break;
|
||||
default:
|
||||
_ol_asserts_.assert(false, 8); // Unknown `serverType` configured
|
||||
assert(false, 8); // Unknown `serverType` configured
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
import {inherits} from '../index.js';
|
||||
import {createFromTemplates} from '../tileurlfunction.js';
|
||||
import _ol_asserts_ from '../asserts.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import {applyTransform, intersects} from '../extent.js';
|
||||
import _ol_net_ from '../net.js';
|
||||
import {get as getProjection, getTransformFromProjections} from '../proj.js';
|
||||
@@ -60,7 +60,7 @@ var _ol_source_TileJSON_ = function(options) {
|
||||
} else if (options.tileJSON) {
|
||||
this.handleTileJSONResponse(options.tileJSON);
|
||||
} else {
|
||||
_ol_asserts_.assert(false, 51); // Either `url` or `tileJSON` options must be provided
|
||||
assert(false, 51); // Either `url` or `tileJSON` options must be provided
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -5,7 +5,7 @@ import {inherits} from '../index.js';
|
||||
import _ol_Tile_ from '../Tile.js';
|
||||
import _ol_TileState_ from '../TileState.js';
|
||||
import {createFromTemplates, nullTileUrlFunction} from '../tileurlfunction.js';
|
||||
import _ol_asserts_ from '../asserts.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import _ol_events_ from '../events.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
import {applyTransform, intersects} from '../extent.js';
|
||||
@@ -70,7 +70,7 @@ var _ol_source_TileUTFGrid_ = function(options) {
|
||||
} else if (options.tileJSON) {
|
||||
this.handleTileJSONResponse(options.tileJSON);
|
||||
} else {
|
||||
_ol_asserts_.assert(false, 51); // Either `url` or `tileJSON` options must be provided
|
||||
assert(false, 51); // Either `url` or `tileJSON` options must be provided
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import {DEFAULT_WMS_VERSION} from './common.js';
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_asserts_ from '../asserts.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import {buffer, createEmpty} from '../extent.js';
|
||||
import _ol_obj_ from '../obj.js';
|
||||
import _ol_math_ from '../math.js';
|
||||
@@ -225,7 +225,7 @@ _ol_source_TileWMS_.prototype.getRequestUrl_ = function(tileCoord, tileSize, til
|
||||
params['DPI'] = 90 * pixelRatio;
|
||||
break;
|
||||
default:
|
||||
_ol_asserts_.assert(false, 52); // Unknown `serverType` configured
|
||||
assert(false, 52); // Unknown `serverType` configured
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import _ol_Collection_ from '../Collection.js';
|
||||
import _ol_CollectionEventType_ from '../CollectionEventType.js';
|
||||
import _ol_ObjectEventType_ from '../ObjectEventType.js';
|
||||
import _ol_array_ from '../array.js';
|
||||
import _ol_asserts_ from '../asserts.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import _ol_events_ from '../events.js';
|
||||
import Event from '../events/Event.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
@@ -71,7 +71,7 @@ var _ol_source_Vector_ = function(opt_options) {
|
||||
if (options.loader !== undefined) {
|
||||
this.loader_ = options.loader;
|
||||
} else if (this.url_ !== undefined) {
|
||||
_ol_asserts_.assert(this.format_, 7); // `format` must be set when `url` is set
|
||||
assert(this.format_, 7); // `format` must be set when `url` is set
|
||||
// create a XHR feature loader for "url" and "format"
|
||||
this.loader_ = xhr(this.url_, /** @type {ol.format.Feature} */ (this.format_));
|
||||
}
|
||||
@@ -228,7 +228,7 @@ _ol_source_Vector_.prototype.addToIndex_ = function(featureKey, feature) {
|
||||
valid = false;
|
||||
}
|
||||
} else {
|
||||
_ol_asserts_.assert(!(featureKey in this.undefIdIndex_),
|
||||
assert(!(featureKey in this.undefIdIndex_),
|
||||
30); // The passed `feature` was already added to the source
|
||||
this.undefIdIndex_[featureKey] = feature;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import {inherits} from '../index.js';
|
||||
import _ol_ImageTile_ from '../ImageTile.js';
|
||||
import _ol_TileState_ from '../TileState.js';
|
||||
import {expandUrl, createFromTileUrlFunctions} from '../tileurlfunction.js';
|
||||
import _ol_asserts_ from '../asserts.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import {createCanvasContext2D} from '../dom.js';
|
||||
import {getTopLeft} from '../extent.js';
|
||||
import _ol_size_ from '../size.js';
|
||||
@@ -62,7 +62,7 @@ var _ol_source_Zoomify_ = function(opt_options) {
|
||||
}
|
||||
break;
|
||||
default:
|
||||
_ol_asserts_.assert(false, 53); // Unknown `tierSizeCalculation` configured
|
||||
assert(false, 53); // Unknown `tierSizeCalculation` configured
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @module ol/structs/LRUCache
|
||||
*/
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_asserts_ from '../asserts.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import EventTarget from '../events/EventTarget.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
|
||||
@@ -107,7 +107,7 @@ LRUCache.prototype.forEach = function(f, opt_this) {
|
||||
*/
|
||||
LRUCache.prototype.get = function(key) {
|
||||
var entry = this.entries_[key];
|
||||
_ol_asserts_.assert(entry !== undefined,
|
||||
assert(entry !== undefined,
|
||||
15); // Tried to get a value for a key that does not exist in the cache
|
||||
if (entry === this.newest_) {
|
||||
return entry.value_;
|
||||
@@ -133,7 +133,7 @@ LRUCache.prototype.get = function(key) {
|
||||
*/
|
||||
LRUCache.prototype.remove = function(key) {
|
||||
var entry = this.entries_[key];
|
||||
_ol_asserts_.assert(entry !== undefined, 15); // Tried to get a value for a key that does not exist in the cache
|
||||
assert(entry !== undefined, 15); // Tried to get a value for a key that does not exist in the cache
|
||||
if (entry === this.newest_) {
|
||||
this.newest_ = /** @type {ol.LRUCacheEntry} */ (entry.older);
|
||||
if (this.newest_) {
|
||||
@@ -248,7 +248,7 @@ LRUCache.prototype.replace = function(key, value) {
|
||||
* @param {T} value Value.
|
||||
*/
|
||||
LRUCache.prototype.set = function(key, value) {
|
||||
_ol_asserts_.assert(!(key in this.entries_),
|
||||
assert(!(key in this.entries_),
|
||||
16); // Tried to set a value for a key that is used already
|
||||
var entry = /** @type {ol.LRUCacheEntry} */ ({
|
||||
key_: key,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @module ol/structs/PriorityQueue
|
||||
*/
|
||||
import _ol_asserts_ from '../asserts.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import _ol_obj_ from '../obj.js';
|
||||
|
||||
/**
|
||||
@@ -99,7 +99,7 @@ PriorityQueue.prototype.dequeue = function() {
|
||||
* @return {boolean} The element was added to the queue.
|
||||
*/
|
||||
PriorityQueue.prototype.enqueue = function(element) {
|
||||
_ol_asserts_.assert(!(this.keyFunction_(element) in this.queuedElements_),
|
||||
assert(!(this.keyFunction_(element) in this.queuedElements_),
|
||||
31); // Tried to enqueue an `element` that was already added to the queue
|
||||
var priority = this.priorityFunction_(element);
|
||||
if (priority != PriorityQueue.DROP) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
import {getUid, inherits} from '../index.js';
|
||||
import _ol_ImageState_ from '../ImageState.js';
|
||||
import _ol_asserts_ from '../asserts.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import _ol_color_ from '../color.js';
|
||||
import _ol_events_ from '../events.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
@@ -80,15 +80,15 @@ var _ol_style_Icon_ = function(opt_options) {
|
||||
*/
|
||||
var src = options.src;
|
||||
|
||||
_ol_asserts_.assert(!(src !== undefined && image),
|
||||
assert(!(src !== undefined && image),
|
||||
4); // `image` and `src` cannot be provided at the same time
|
||||
_ol_asserts_.assert(!image || (image && imgSize),
|
||||
assert(!image || (image && imgSize),
|
||||
5); // `imgSize` must be set when `image` is provided
|
||||
|
||||
if ((src === undefined || src.length === 0) && image) {
|
||||
src = image.src || getUid(image).toString();
|
||||
}
|
||||
_ol_asserts_.assert(src !== undefined && src.length > 0,
|
||||
assert(src !== undefined && src.length > 0,
|
||||
6); // A defined and non-empty `src` or `image` must be provided
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @module ol/style/Style
|
||||
*/
|
||||
import _ol_asserts_ from '../asserts.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import GeometryType from '../geom/GeometryType.js';
|
||||
import _ol_style_Circle_ from '../style/Circle.js';
|
||||
import _ol_style_Fill_ from '../style/Fill.js';
|
||||
@@ -291,7 +291,7 @@ _ol_style_Style_.createFunction = function(obj) {
|
||||
if (Array.isArray(obj)) {
|
||||
styles = obj;
|
||||
} else {
|
||||
_ol_asserts_.assert(obj instanceof _ol_style_Style_,
|
||||
assert(obj instanceof _ol_style_Style_,
|
||||
41); // Expected an `ol.style.Style` or an array of `ol.style.Style`
|
||||
styles = [obj];
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @module ol/tilegrid/TileGrid
|
||||
*/
|
||||
import {DEFAULT_TILE_SIZE} from './common.js';
|
||||
import _ol_asserts_ from '../asserts.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import TileRange from '../TileRange.js';
|
||||
import _ol_array_ from '../array.js';
|
||||
import {createOrUpdate, getTopLeft} from '../extent.js';
|
||||
@@ -33,7 +33,7 @@ var _ol_tilegrid_TileGrid_ = function(options) {
|
||||
* @type {!Array.<number>}
|
||||
*/
|
||||
this.resolutions_ = options.resolutions;
|
||||
_ol_asserts_.assert(_ol_array_.isSorted(this.resolutions_, function(a, b) {
|
||||
assert(_ol_array_.isSorted(this.resolutions_, function(a, b) {
|
||||
return b - a;
|
||||
}, true), 17); // `resolutions` must be sorted in descending order
|
||||
|
||||
@@ -80,7 +80,7 @@ var _ol_tilegrid_TileGrid_ = function(options) {
|
||||
this.origins_ = null;
|
||||
if (options.origins !== undefined) {
|
||||
this.origins_ = options.origins;
|
||||
_ol_asserts_.assert(this.origins_.length == this.resolutions_.length,
|
||||
assert(this.origins_.length == this.resolutions_.length,
|
||||
20); // Number of `origins` and `resolutions` must be equal
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ var _ol_tilegrid_TileGrid_ = function(options) {
|
||||
this.origin_ = getTopLeft(extent);
|
||||
}
|
||||
|
||||
_ol_asserts_.assert(
|
||||
assert(
|
||||
(!this.origin_ && this.origins_) || (this.origin_ && !this.origins_),
|
||||
18); // Either `origin` or `origins` must be configured, never both
|
||||
|
||||
@@ -102,7 +102,7 @@ var _ol_tilegrid_TileGrid_ = function(options) {
|
||||
this.tileSizes_ = null;
|
||||
if (options.tileSizes !== undefined) {
|
||||
this.tileSizes_ = options.tileSizes;
|
||||
_ol_asserts_.assert(this.tileSizes_.length == this.resolutions_.length,
|
||||
assert(this.tileSizes_.length == this.resolutions_.length,
|
||||
19); // Number of `tileSizes` and `resolutions` must be equal
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ var _ol_tilegrid_TileGrid_ = function(options) {
|
||||
this.tileSize_ = options.tileSize !== undefined ?
|
||||
options.tileSize :
|
||||
!this.tileSizes_ ? DEFAULT_TILE_SIZE : null;
|
||||
_ol_asserts_.assert(
|
||||
assert(
|
||||
(!this.tileSize_ && this.tileSizes_) ||
|
||||
(this.tileSize_ && !this.tileSizes_),
|
||||
22); // Either `tileSize` or `tileSizes` must be configured, never both
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @module ol/tileurlfunction
|
||||
*/
|
||||
import _ol_asserts_ from './asserts.js';
|
||||
import {assert} from './asserts.js';
|
||||
import _ol_math_ from './math.js';
|
||||
import _ol_tilecoord_ from './tilecoord.js';
|
||||
|
||||
@@ -36,7 +36,7 @@ export function createFromTemplate(template, tileGrid) {
|
||||
.replace(dashYRegEx, function() {
|
||||
var z = tileCoord[0];
|
||||
var range = tileGrid.getFullTileRange(z);
|
||||
_ol_asserts_.assert(range, 55); // The {-y} placeholder requires a tile grid with extent
|
||||
assert(range, 55); // The {-y} placeholder requires a tile grid with extent
|
||||
var y = range.getHeight() + tileCoord[2];
|
||||
return y.toString();
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @module ol/transform
|
||||
*/
|
||||
import _ol_asserts_ from './asserts.js';
|
||||
import {assert} from './asserts.js';
|
||||
var _ol_transform_ = {};
|
||||
|
||||
|
||||
@@ -204,7 +204,7 @@ _ol_transform_.compose = function(transform, dx1, dy1, sx, sy, angle, dx2, dy2)
|
||||
*/
|
||||
_ol_transform_.invert = function(transform) {
|
||||
var det = _ol_transform_.determinant(transform);
|
||||
_ol_asserts_.assert(det !== 0, 32); // Transformation matrix cannot be inverted
|
||||
assert(det !== 0, 32); // Transformation matrix cannot be inverted
|
||||
|
||||
var a = transform[0];
|
||||
var b = transform[1];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_asserts_ from '../../../src/ol/asserts.js';
|
||||
import {assert} from '../../../src/ol/asserts.js';
|
||||
|
||||
|
||||
describe('ol.asserts', function() {
|
||||
@@ -6,7 +6,7 @@ describe('ol.asserts', function() {
|
||||
describe('ol.asserts.assert', function() {
|
||||
it('throws an exception', function() {
|
||||
expect(function() {
|
||||
_ol_asserts_.assert(false, 42);
|
||||
assert(false, 42);
|
||||
}).to.throwException();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user