Merge pull request #7627 from fredj/import_name

Nicer import name
This commit is contained in:
Frédéric Junod
2017-12-18 15:44:17 +01:00
committed by GitHub
34 changed files with 347 additions and 370 deletions

View File

@@ -1,7 +1,7 @@
import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.js';
import KML from '../src/ol/format/KML.js';
import _ol_layer_Heatmap_ from '../src/ol/layer/Heatmap.js';
import HeatmapLayer from '../src/ol/layer/Heatmap.js';
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
import _ol_source_Stamen_ from '../src/ol/source/Stamen.js';
import _ol_source_Vector_ from '../src/ol/source/Vector.js';
@@ -9,7 +9,7 @@ import _ol_source_Vector_ from '../src/ol/source/Vector.js';
var blur = document.getElementById('blur');
var radius = document.getElementById('radius');
var vector = new _ol_layer_Heatmap_({
var vector = new HeatmapLayer({
source: new _ol_source_Vector_({
url: 'data/kml/2012_Earthquakes_Mag5.kml',
format: new KML({

View File

@@ -3,11 +3,20 @@
*/
import {inherits} from './index.js';
import AssertionError from './AssertionError.js';
import _ol_CollectionEventType_ from './CollectionEventType.js';
import CollectionEventType from './CollectionEventType.js';
import _ol_Object_ from './Object.js';
import Event from './events/Event.js';
/**
* @enum {string}
* @private
*/
var Property = {
LENGTH: 'length'
};
/**
* @typedef {{unique: (boolean|undefined)}}
*/
@@ -139,9 +148,7 @@ _ol_Collection_.prototype.item = function(index) {
* @api
*/
_ol_Collection_.prototype.getLength = function() {
return (
/** @type {number} */ this.get(_ol_Collection_.Property_.LENGTH)
);
return (/** @type {number} */ this.get(Property.LENGTH));
};
@@ -158,7 +165,7 @@ _ol_Collection_.prototype.insertAt = function(index, elem) {
this.array_.splice(index, 0, elem);
this.updateLength_();
this.dispatchEvent(
new _ol_Collection_.Event(_ol_CollectionEventType_.ADD, elem));
new _ol_Collection_.Event(CollectionEventType.ADD, elem));
};
@@ -219,7 +226,7 @@ _ol_Collection_.prototype.removeAt = function(index) {
this.array_.splice(index, 1);
this.updateLength_();
this.dispatchEvent(
new _ol_Collection_.Event(_ol_CollectionEventType_.REMOVE, prev));
new _ol_Collection_.Event(CollectionEventType.REMOVE, prev));
return prev;
};
@@ -239,9 +246,9 @@ _ol_Collection_.prototype.setAt = function(index, elem) {
var prev = this.array_[index];
this.array_[index] = elem;
this.dispatchEvent(
new _ol_Collection_.Event(_ol_CollectionEventType_.REMOVE, prev));
new _ol_Collection_.Event(CollectionEventType.REMOVE, prev));
this.dispatchEvent(
new _ol_Collection_.Event(_ol_CollectionEventType_.ADD, elem));
new _ol_Collection_.Event(CollectionEventType.ADD, elem));
} else {
var j;
for (j = n; j < index; ++j) {
@@ -256,7 +263,7 @@ _ol_Collection_.prototype.setAt = function(index, elem) {
* @private
*/
_ol_Collection_.prototype.updateLength_ = function() {
this.set(_ol_Collection_.Property_.LENGTH, this.array_.length);
this.set(Property.LENGTH, this.array_.length);
};
@@ -273,16 +280,6 @@ _ol_Collection_.prototype.assertUnique_ = function(elem, opt_except) {
}
};
/**
* @enum {string}
* @private
*/
_ol_Collection_.Property_ = {
LENGTH: 'length'
};
/**
* @classdesc
* Events emitted by {@link ol.Collection} instances are instances of this

View File

@@ -3,7 +3,7 @@
*/
import {inherits} from './index.js';
import _ol_ImageBase_ from './ImageBase.js';
import _ol_ImageState_ from './ImageState.js';
import ImageState from './ImageState.js';
import _ol_events_ from './events.js';
import EventType from './events/EventType.js';
import {getHeight} from './extent.js';
@@ -20,7 +20,7 @@ import {getHeight} from './extent.js';
*/
var _ol_Image_ = function(extent, resolution, pixelRatio, src, crossOrigin, imageLoadFunction) {
_ol_ImageBase_.call(this, extent, resolution, pixelRatio, _ol_ImageState_.IDLE);
_ol_ImageBase_.call(this, extent, resolution, pixelRatio, ImageState.IDLE);
/**
* @private
@@ -47,7 +47,7 @@ var _ol_Image_ = function(extent, resolution, pixelRatio, src, crossOrigin, imag
* @protected
* @type {ol.ImageState}
*/
this.state = _ol_ImageState_.IDLE;
this.state = ImageState.IDLE;
/**
* @private
@@ -75,7 +75,7 @@ _ol_Image_.prototype.getImage = function() {
* @private
*/
_ol_Image_.prototype.handleImageError_ = function() {
this.state = _ol_ImageState_.ERROR;
this.state = ImageState.ERROR;
this.unlistenImage_();
this.changed();
};
@@ -90,7 +90,7 @@ _ol_Image_.prototype.handleImageLoad_ = function() {
if (this.resolution === undefined) {
this.resolution = getHeight(this.extent) / this.image_.height;
}
this.state = _ol_ImageState_.LOADED;
this.state = ImageState.LOADED;
this.unlistenImage_();
this.changed();
};
@@ -104,8 +104,8 @@ _ol_Image_.prototype.handleImageLoad_ = function() {
* @api
*/
_ol_Image_.prototype.load = function() {
if (this.state == _ol_ImageState_.IDLE || this.state == _ol_ImageState_.ERROR) {
this.state = _ol_ImageState_.LOADING;
if (this.state == ImageState.IDLE || this.state == ImageState.ERROR) {
this.state = ImageState.LOADING;
this.changed();
this.imageListenerKeys_ = [
_ol_events_.listenOnce(this.image_, EventType.ERROR,

View File

@@ -3,7 +3,7 @@
*/
import {inherits} from './index.js';
import _ol_ImageBase_ from './ImageBase.js';
import _ol_ImageState_ from './ImageState.js';
import ImageState from './ImageState.js';
/**
* @constructor
@@ -24,8 +24,7 @@ var _ol_ImageCanvas_ = function(extent, resolution, pixelRatio, canvas, opt_load
*/
this.loader_ = opt_loader !== undefined ? opt_loader : null;
var state = opt_loader !== undefined ?
_ol_ImageState_.IDLE : _ol_ImageState_.LOADED;
var state = opt_loader !== undefined ? ImageState.IDLE : ImageState.LOADED;
_ol_ImageBase_.call(this, extent, resolution, pixelRatio, state);
@@ -63,9 +62,9 @@ _ol_ImageCanvas_.prototype.getError = function() {
_ol_ImageCanvas_.prototype.handleLoad_ = function(err) {
if (err) {
this.error_ = err;
this.state = _ol_ImageState_.ERROR;
this.state = ImageState.ERROR;
} else {
this.state = _ol_ImageState_.LOADED;
this.state = ImageState.LOADED;
}
this.changed();
};
@@ -75,8 +74,8 @@ _ol_ImageCanvas_.prototype.handleLoad_ = function(err) {
* @inheritDoc
*/
_ol_ImageCanvas_.prototype.load = function() {
if (this.state == _ol_ImageState_.IDLE) {
this.state = _ol_ImageState_.LOADING;
if (this.state == ImageState.IDLE) {
this.state = ImageState.LOADING;
this.changed();
this.loader_(this.handleLoad_.bind(this));
}

View File

@@ -2,7 +2,7 @@
* @module ol/Object
*/
import {getUid, inherits} from './index.js';
import _ol_ObjectEventType_ from './ObjectEventType.js';
import ObjectEventType from './ObjectEventType.js';
import _ol_Observable_ from './Observable.js';
import Event from './events/Event.js';
import _ol_obj_ from './obj.js';
@@ -136,7 +136,7 @@ _ol_Object_.prototype.notify = function(key, oldValue) {
var eventType;
eventType = _ol_Object_.getChangeEventType(key);
this.dispatchEvent(new _ol_Object_.Event(eventType, key, oldValue));
eventType = _ol_ObjectEventType_.PROPERTYCHANGE;
eventType = ObjectEventType.PROPERTYCHANGE;
this.dispatchEvent(new _ol_Object_.Event(eventType, key, oldValue));
};

View File

@@ -2,14 +2,28 @@
* @module ol/Overlay
*/
import {inherits} from './index.js';
import _ol_MapEventType_ from './MapEventType.js';
import MapEventType from './MapEventType.js';
import _ol_Object_ from './Object.js';
import _ol_OverlayPositioning_ from './OverlayPositioning.js';
import OverlayPositioning from './OverlayPositioning.js';
import _ol_css_ from './css.js';
import {removeNode, removeChildren, outerWidth, outerHeight} from './dom.js';
import _ol_events_ from './events.js';
import {containsExtent} from './extent.js';
/**
* @enum {string}
* @protected
*/
var Property = {
ELEMENT: 'element',
MAP: 'map',
OFFSET: 'offset',
POSITION: 'position',
POSITIONING: 'positioning'
};
/**
* @classdesc
* An element to be displayed over the map and attached to a single map
@@ -31,7 +45,7 @@ import {containsExtent} from './extent.js';
* @param {olx.OverlayOptions} options Overlay options.
* @api
*/
var _ol_Overlay_ = function(options) {
var Overlay = function(options) {
_ol_Object_.call(this);
@@ -112,23 +126,23 @@ var _ol_Overlay_ = function(options) {
this.mapPostrenderListenerKey = null;
_ol_events_.listen(
this, _ol_Object_.getChangeEventType(_ol_Overlay_.Property.ELEMENT),
this, _ol_Object_.getChangeEventType(Property.ELEMENT),
this.handleElementChanged, this);
_ol_events_.listen(
this, _ol_Object_.getChangeEventType(_ol_Overlay_.Property.MAP),
this, _ol_Object_.getChangeEventType(Property.MAP),
this.handleMapChanged, this);
_ol_events_.listen(
this, _ol_Object_.getChangeEventType(_ol_Overlay_.Property.OFFSET),
this, _ol_Object_.getChangeEventType(Property.OFFSET),
this.handleOffsetChanged, this);
_ol_events_.listen(
this, _ol_Object_.getChangeEventType(_ol_Overlay_.Property.POSITION),
this, _ol_Object_.getChangeEventType(Property.POSITION),
this.handlePositionChanged, this);
_ol_events_.listen(
this, _ol_Object_.getChangeEventType(_ol_Overlay_.Property.POSITIONING),
this, _ol_Object_.getChangeEventType(Property.POSITIONING),
this.handlePositioningChanged, this);
if (options.element !== undefined) {
@@ -139,7 +153,7 @@ var _ol_Overlay_ = function(options) {
this.setPositioning(options.positioning !== undefined ?
/** @type {ol.OverlayPositioning} */ (options.positioning) :
_ol_OverlayPositioning_.TOP_LEFT);
OverlayPositioning.TOP_LEFT);
if (options.position !== undefined) {
this.setPosition(options.position);
@@ -147,7 +161,7 @@ var _ol_Overlay_ = function(options) {
};
inherits(_ol_Overlay_, _ol_Object_);
inherits(Overlay, _ol_Object_);
/**
@@ -156,10 +170,8 @@ inherits(_ol_Overlay_, _ol_Object_);
* @observable
* @api
*/
_ol_Overlay_.prototype.getElement = function() {
return (
/** @type {Element|undefined} */ this.get(_ol_Overlay_.Property.ELEMENT)
);
Overlay.prototype.getElement = function() {
return (/** @type {Element|undefined} */ this.get(Property.ELEMENT));
};
@@ -168,7 +180,7 @@ _ol_Overlay_.prototype.getElement = function() {
* @return {number|string|undefined} Id.
* @api
*/
_ol_Overlay_.prototype.getId = function() {
Overlay.prototype.getId = function() {
return this.id;
};
@@ -179,10 +191,8 @@ _ol_Overlay_.prototype.getId = function() {
* @observable
* @api
*/
_ol_Overlay_.prototype.getMap = function() {
return (
/** @type {ol.PluggableMap|undefined} */ this.get(_ol_Overlay_.Property.MAP)
);
Overlay.prototype.getMap = function() {
return (/** @type {ol.PluggableMap|undefined} */ this.get(Property.MAP));
};
@@ -192,10 +202,8 @@ _ol_Overlay_.prototype.getMap = function() {
* @observable
* @api
*/
_ol_Overlay_.prototype.getOffset = function() {
return (
/** @type {Array.<number>} */ this.get(_ol_Overlay_.Property.OFFSET)
);
Overlay.prototype.getOffset = function() {
return (/** @type {Array.<number>} */ this.get(Property.OFFSET));
};
@@ -206,10 +214,8 @@ _ol_Overlay_.prototype.getOffset = function() {
* @observable
* @api
*/
_ol_Overlay_.prototype.getPosition = function() {
return (
/** @type {ol.Coordinate|undefined} */ this.get(_ol_Overlay_.Property.POSITION)
);
Overlay.prototype.getPosition = function() {
return (/** @type {ol.Coordinate|undefined} */ this.get(Property.POSITION));
};
@@ -220,17 +226,15 @@ _ol_Overlay_.prototype.getPosition = function() {
* @observable
* @api
*/
_ol_Overlay_.prototype.getPositioning = function() {
return (
/** @type {ol.OverlayPositioning} */ this.get(_ol_Overlay_.Property.POSITIONING)
);
Overlay.prototype.getPositioning = function() {
return (/** @type {ol.OverlayPositioning} */ this.get(Property.POSITIONING));
};
/**
* @protected
*/
_ol_Overlay_.prototype.handleElementChanged = function() {
Overlay.prototype.handleElementChanged = function() {
removeChildren(this.element);
var element = this.getElement();
if (element) {
@@ -242,7 +246,7 @@ _ol_Overlay_.prototype.handleElementChanged = function() {
/**
* @protected
*/
_ol_Overlay_.prototype.handleMapChanged = function() {
Overlay.prototype.handleMapChanged = function() {
if (this.mapPostrenderListenerKey) {
removeNode(this.element);
_ol_events_.unlistenByKey(this.mapPostrenderListenerKey);
@@ -251,7 +255,7 @@ _ol_Overlay_.prototype.handleMapChanged = function() {
var map = this.getMap();
if (map) {
this.mapPostrenderListenerKey = _ol_events_.listen(map,
_ol_MapEventType_.POSTRENDER, this.render, this);
MapEventType.POSTRENDER, this.render, this);
this.updatePixelPosition();
var container = this.stopEvent ?
map.getOverlayContainerStopEvent() : map.getOverlayContainer();
@@ -267,7 +271,7 @@ _ol_Overlay_.prototype.handleMapChanged = function() {
/**
* @protected
*/
_ol_Overlay_.prototype.render = function() {
Overlay.prototype.render = function() {
this.updatePixelPosition();
};
@@ -275,7 +279,7 @@ _ol_Overlay_.prototype.render = function() {
/**
* @protected
*/
_ol_Overlay_.prototype.handleOffsetChanged = function() {
Overlay.prototype.handleOffsetChanged = function() {
this.updatePixelPosition();
};
@@ -283,9 +287,9 @@ _ol_Overlay_.prototype.handleOffsetChanged = function() {
/**
* @protected
*/
_ol_Overlay_.prototype.handlePositionChanged = function() {
Overlay.prototype.handlePositionChanged = function() {
this.updatePixelPosition();
if (this.get(_ol_Overlay_.Property.POSITION) && this.autoPan) {
if (this.get(Property.POSITION) && this.autoPan) {
this.panIntoView();
}
};
@@ -294,7 +298,7 @@ _ol_Overlay_.prototype.handlePositionChanged = function() {
/**
* @protected
*/
_ol_Overlay_.prototype.handlePositioningChanged = function() {
Overlay.prototype.handlePositioningChanged = function() {
this.updatePixelPosition();
};
@@ -305,8 +309,8 @@ _ol_Overlay_.prototype.handlePositioningChanged = function() {
* @observable
* @api
*/
_ol_Overlay_.prototype.setElement = function(element) {
this.set(_ol_Overlay_.Property.ELEMENT, element);
Overlay.prototype.setElement = function(element) {
this.set(Property.ELEMENT, element);
};
@@ -316,8 +320,8 @@ _ol_Overlay_.prototype.setElement = function(element) {
* @observable
* @api
*/
_ol_Overlay_.prototype.setMap = function(map) {
this.set(_ol_Overlay_.Property.MAP, map);
Overlay.prototype.setMap = function(map) {
this.set(Property.MAP, map);
};
@@ -327,8 +331,8 @@ _ol_Overlay_.prototype.setMap = function(map) {
* @observable
* @api
*/
_ol_Overlay_.prototype.setOffset = function(offset) {
this.set(_ol_Overlay_.Property.OFFSET, offset);
Overlay.prototype.setOffset = function(offset) {
this.set(Property.OFFSET, offset);
};
@@ -340,8 +344,8 @@ _ol_Overlay_.prototype.setOffset = function(offset) {
* @observable
* @api
*/
_ol_Overlay_.prototype.setPosition = function(position) {
this.set(_ol_Overlay_.Property.POSITION, position);
Overlay.prototype.setPosition = function(position) {
this.set(Property.POSITION, position);
};
@@ -350,7 +354,7 @@ _ol_Overlay_.prototype.setPosition = function(position) {
* (if necessary).
* @protected
*/
_ol_Overlay_.prototype.panIntoView = function() {
Overlay.prototype.panIntoView = function() {
var map = this.getMap();
if (!map || !map.getTargetElement()) {
@@ -410,7 +414,7 @@ _ol_Overlay_.prototype.panIntoView = function() {
* @return {ol.Extent} The extent.
* @protected
*/
_ol_Overlay_.prototype.getRect = function(element, size) {
Overlay.prototype.getRect = function(element, size) {
var box = element.getBoundingClientRect();
var offsetX = box.left + window.pageXOffset;
var offsetY = box.top + window.pageYOffset;
@@ -430,8 +434,8 @@ _ol_Overlay_.prototype.getRect = function(element, size) {
* @observable
* @api
*/
_ol_Overlay_.prototype.setPositioning = function(positioning) {
this.set(_ol_Overlay_.Property.POSITIONING, positioning);
Overlay.prototype.setPositioning = function(positioning) {
this.set(Property.POSITIONING, positioning);
};
@@ -440,7 +444,7 @@ _ol_Overlay_.prototype.setPositioning = function(positioning) {
* @param {boolean} visible Element visibility.
* @protected
*/
_ol_Overlay_.prototype.setVisible = function(visible) {
Overlay.prototype.setVisible = function(visible) {
if (this.rendered.visible !== visible) {
this.element.style.display = visible ? '' : 'none';
this.rendered.visible = visible;
@@ -452,7 +456,7 @@ _ol_Overlay_.prototype.setVisible = function(visible) {
* Update pixel position.
* @protected
*/
_ol_Overlay_.prototype.updatePixelPosition = function() {
Overlay.prototype.updatePixelPosition = function() {
var map = this.getMap();
var position = this.getPosition();
if (!map || !map.isRendered() || !position) {
@@ -471,7 +475,7 @@ _ol_Overlay_.prototype.updatePixelPosition = function() {
* @param {ol.Size|undefined} mapSize The map size.
* @protected
*/
_ol_Overlay_.prototype.updateRenderedPosition = function(pixel, mapSize) {
Overlay.prototype.updateRenderedPosition = function(pixel, mapSize) {
var style = this.element.style;
var offset = this.getOffset();
@@ -481,9 +485,9 @@ _ol_Overlay_.prototype.updateRenderedPosition = function(pixel, mapSize) {
var offsetX = offset[0];
var offsetY = offset[1];
if (positioning == _ol_OverlayPositioning_.BOTTOM_RIGHT ||
positioning == _ol_OverlayPositioning_.CENTER_RIGHT ||
positioning == _ol_OverlayPositioning_.TOP_RIGHT) {
if (positioning == OverlayPositioning.BOTTOM_RIGHT ||
positioning == OverlayPositioning.CENTER_RIGHT ||
positioning == OverlayPositioning.TOP_RIGHT) {
if (this.rendered.left_ !== '') {
this.rendered.left_ = style.left = '';
}
@@ -495,9 +499,9 @@ _ol_Overlay_.prototype.updateRenderedPosition = function(pixel, mapSize) {
if (this.rendered.right_ !== '') {
this.rendered.right_ = style.right = '';
}
if (positioning == _ol_OverlayPositioning_.BOTTOM_CENTER ||
positioning == _ol_OverlayPositioning_.CENTER_CENTER ||
positioning == _ol_OverlayPositioning_.TOP_CENTER) {
if (positioning == OverlayPositioning.BOTTOM_CENTER ||
positioning == OverlayPositioning.CENTER_CENTER ||
positioning == OverlayPositioning.TOP_CENTER) {
offsetX -= this.element.offsetWidth / 2;
}
var left = Math.round(pixel[0] + offsetX) + 'px';
@@ -505,9 +509,9 @@ _ol_Overlay_.prototype.updateRenderedPosition = function(pixel, mapSize) {
this.rendered.left_ = style.left = left;
}
}
if (positioning == _ol_OverlayPositioning_.BOTTOM_LEFT ||
positioning == _ol_OverlayPositioning_.BOTTOM_CENTER ||
positioning == _ol_OverlayPositioning_.BOTTOM_RIGHT) {
if (positioning == OverlayPositioning.BOTTOM_LEFT ||
positioning == OverlayPositioning.BOTTOM_CENTER ||
positioning == OverlayPositioning.BOTTOM_RIGHT) {
if (this.rendered.top_ !== '') {
this.rendered.top_ = style.top = '';
}
@@ -519,9 +523,9 @@ _ol_Overlay_.prototype.updateRenderedPosition = function(pixel, mapSize) {
if (this.rendered.bottom_ !== '') {
this.rendered.bottom_ = style.bottom = '';
}
if (positioning == _ol_OverlayPositioning_.CENTER_LEFT ||
positioning == _ol_OverlayPositioning_.CENTER_CENTER ||
positioning == _ol_OverlayPositioning_.CENTER_RIGHT) {
if (positioning == OverlayPositioning.CENTER_LEFT ||
positioning == OverlayPositioning.CENTER_CENTER ||
positioning == OverlayPositioning.CENTER_RIGHT) {
offsetY -= this.element.offsetHeight / 2;
}
var top = Math.round(pixel[1] + offsetY) + 'px';
@@ -537,20 +541,8 @@ _ol_Overlay_.prototype.updateRenderedPosition = function(pixel, mapSize) {
* @public
* @return {olx.OverlayOptions} overlay options
*/
_ol_Overlay_.prototype.getOptions = function() {
Overlay.prototype.getOptions = function() {
return this.options;
};
/**
* @enum {string}
* @protected
*/
_ol_Overlay_.Property = {
ELEMENT: 'element',
MAP: 'map',
OFFSET: 'offset',
POSITION: 'position',
POSITIONING: 'positioning'
};
export default _ol_Overlay_;
export default Overlay;

View File

@@ -3,15 +3,15 @@
*/
import {getUid, inherits} from './index.js';
import _ol_Collection_ from './Collection.js';
import _ol_CollectionEventType_ from './CollectionEventType.js';
import CollectionEventType from './CollectionEventType.js';
import MapBrowserEvent from './MapBrowserEvent.js';
import MapBrowserEventHandler from './MapBrowserEventHandler.js';
import MapBrowserEventType from './MapBrowserEventType.js';
import MapEvent from './MapEvent.js';
import _ol_MapEventType_ from './MapEventType.js';
import MapEventType from './MapEventType.js';
import _ol_MapProperty_ from './MapProperty.js';
import _ol_Object_ from './Object.js';
import _ol_ObjectEventType_ from './ObjectEventType.js';
import ObjectEventType from './ObjectEventType.js';
import TileQueue from './TileQueue.js';
import _ol_View_ from './View.js';
import _ol_ViewHint_ from './ViewHint.js';
@@ -359,7 +359,7 @@ var _ol_PluggableMap_ = function(options) {
control.setMap(this);
}, this);
_ol_events_.listen(this.controls, _ol_CollectionEventType_.ADD,
_ol_events_.listen(this.controls, CollectionEventType.ADD,
/**
* @param {ol.Collection.Event} event Collection event.
*/
@@ -367,7 +367,7 @@ var _ol_PluggableMap_ = function(options) {
event.element.setMap(this);
}, this);
_ol_events_.listen(this.controls, _ol_CollectionEventType_.REMOVE,
_ol_events_.listen(this.controls, CollectionEventType.REMOVE,
/**
* @param {ol.Collection.Event} event Collection event.
*/
@@ -384,7 +384,7 @@ var _ol_PluggableMap_ = function(options) {
interaction.setMap(this);
}, this);
_ol_events_.listen(this.interactions, _ol_CollectionEventType_.ADD,
_ol_events_.listen(this.interactions, CollectionEventType.ADD,
/**
* @param {ol.Collection.Event} event Collection event.
*/
@@ -392,7 +392,7 @@ var _ol_PluggableMap_ = function(options) {
event.element.setMap(this);
}, this);
_ol_events_.listen(this.interactions, _ol_CollectionEventType_.REMOVE,
_ol_events_.listen(this.interactions, CollectionEventType.REMOVE,
/**
* @param {ol.Collection.Event} event Collection event.
*/
@@ -402,7 +402,7 @@ var _ol_PluggableMap_ = function(options) {
this.overlays_.forEach(this.addOverlayInternal_, this);
_ol_events_.listen(this.overlays_, _ol_CollectionEventType_.ADD,
_ol_events_.listen(this.overlays_, CollectionEventType.ADD,
/**
* @param {ol.Collection.Event} event Collection event.
*/
@@ -410,7 +410,7 @@ var _ol_PluggableMap_ = function(options) {
this.addOverlayInternal_(/** @type {ol.Overlay} */ (event.element));
}, this);
_ol_events_.listen(this.overlays_, _ol_CollectionEventType_.REMOVE,
_ol_events_.listen(this.overlays_, CollectionEventType.REMOVE,
/**
* @param {ol.Collection.Event} event Collection event.
*/
@@ -1072,7 +1072,7 @@ _ol_PluggableMap_.prototype.handleViewChanged_ = function() {
if (view) {
this.viewport_.setAttribute('data-view', getUid(view));
this.viewPropertyListenerKey_ = _ol_events_.listen(
view, _ol_ObjectEventType_.PROPERTYCHANGE,
view, ObjectEventType.PROPERTYCHANGE,
this.handleViewPropertyChanged_, this);
this.viewChangeListenerKey_ = _ol_events_.listen(
view, EventType.CHANGE,
@@ -1094,7 +1094,7 @@ _ol_PluggableMap_.prototype.handleLayerGroupChanged_ = function() {
if (layerGroup) {
this.layerGroupPropertyListenerKeys_ = [
_ol_events_.listen(
layerGroup, _ol_ObjectEventType_.PROPERTYCHANGE,
layerGroup, ObjectEventType.PROPERTYCHANGE,
this.render, this),
_ol_events_.listen(
layerGroup, EventType.CHANGE,
@@ -1254,7 +1254,7 @@ _ol_PluggableMap_.prototype.renderFrame_ = function(time) {
!equals(frameState.extent, this.previousExtent_));
if (moveStart) {
this.dispatchEvent(
new MapEvent(_ol_MapEventType_.MOVESTART, this, previousFrameState));
new MapEvent(MapEventType.MOVESTART, this, previousFrameState));
this.previousExtent_ = createOrUpdateEmpty(this.previousExtent_);
}
}
@@ -1266,13 +1266,13 @@ _ol_PluggableMap_.prototype.renderFrame_ = function(time) {
if (idle) {
this.dispatchEvent(
new MapEvent(_ol_MapEventType_.MOVEEND, this, frameState));
new MapEvent(MapEventType.MOVEEND, this, frameState));
clone(frameState.extent, this.previousExtent_);
}
}
this.dispatchEvent(
new MapEvent(_ol_MapEventType_.POSTRENDER, this, frameState));
new MapEvent(MapEventType.POSTRENDER, this, frameState));
setTimeout(this.handlePostRender.bind(this), 0);

View File

@@ -2,7 +2,7 @@
* @module ol/control/Control
*/
import {inherits, nullFunction} from '../index.js';
import _ol_MapEventType_ from '../MapEventType.js';
import MapEventType from '../MapEventType.js';
import _ol_Object_ from '../Object.js';
import {removeNode} from '../dom.js';
import _ol_events_ from '../events.js';
@@ -120,7 +120,7 @@ Control.prototype.setMap = function(map) {
target.appendChild(this.element);
if (this.render !== nullFunction) {
this.listenerKeys.push(_ol_events_.listen(map,
_ol_MapEventType_.POSTRENDER, this.render, this));
MapEventType.POSTRENDER, this.render, this));
}
map.render();
}

View File

@@ -4,12 +4,12 @@
import {inherits} from '../index.js';
import _ol_Collection_ from '../Collection.js';
import _ol_PluggableMap_ from '../PluggableMap.js';
import _ol_MapEventType_ from '../MapEventType.js';
import MapEventType from '../MapEventType.js';
import _ol_MapProperty_ from '../MapProperty.js';
import _ol_Object_ from '../Object.js';
import _ol_ObjectEventType_ from '../ObjectEventType.js';
import _ol_Overlay_ from '../Overlay.js';
import _ol_OverlayPositioning_ from '../OverlayPositioning.js';
import ObjectEventType from '../ObjectEventType.js';
import Overlay from '../Overlay.js';
import OverlayPositioning from '../OverlayPositioning.js';
import _ol_ViewProperty_ from '../ViewProperty.js';
import Control from '../control/Control.js';
import _ol_coordinate_ from '../coordinate.js';
@@ -140,9 +140,9 @@ var OverviewMap = function(opt_options) {
* @type {ol.Overlay}
* @private
*/
this.boxOverlay_ = new _ol_Overlay_({
this.boxOverlay_ = new Overlay({
position: [0, 0],
positioning: _ol_OverlayPositioning_.BOTTOM_LEFT,
positioning: OverlayPositioning.BOTTOM_LEFT,
element: box
});
this.ovmap_.addOverlay(this.boxOverlay_);
@@ -227,7 +227,7 @@ OverviewMap.prototype.setMap = function(map) {
if (map) {
this.ovmap_.setTarget(this.ovmapDiv_);
this.listenerKeys.push(_ol_events_.listen(
map, _ol_ObjectEventType_.PROPERTYCHANGE,
map, ObjectEventType.PROPERTYCHANGE,
this.handleMapPropertyChange_, this));
// TODO: to really support map switching, this would need to be reworked
@@ -504,7 +504,7 @@ OverviewMap.prototype.handleToggle_ = function() {
if (!this.collapsed_ && !ovmap.isRendered()) {
ovmap.updateSize();
this.resetExtent_();
_ol_events_.listenOnce(ovmap, _ol_MapEventType_.POSTRENDER,
_ol_events_.listenOnce(ovmap, MapEventType.POSTRENDER,
function(event) {
this.updateBox_();
},

View File

@@ -22,8 +22,8 @@ import _ol_math_ from '../math.js';
import {get as getProjection} from '../proj.js';
import _ol_style_Fill_ from '../style/Fill.js';
import _ol_style_Icon_ from '../style/Icon.js';
import _ol_style_IconAnchorUnits_ from '../style/IconAnchorUnits.js';
import _ol_style_IconOrigin_ from '../style/IconOrigin.js';
import IconAnchorUnits from '../style/IconAnchorUnits.js';
import IconOrigin from '../style/IconOrigin.js';
import _ol_style_Stroke_ from '../style/Stroke.js';
import _ol_style_Style_ from '../style/Style.js';
import _ol_style_Text_ from '../style/Text.js';
@@ -161,16 +161,14 @@ KML.createStyleDefaults_ = function() {
* @type {ol.style.IconAnchorUnits}
* @private
*/
KML.DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS_ =
_ol_style_IconAnchorUnits_.PIXELS;
KML.DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS_ = IconAnchorUnits.PIXELS;
/**
* @const
* @type {ol.style.IconAnchorUnits}
* @private
*/
KML.DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS_ =
_ol_style_IconAnchorUnits_.PIXELS;
KML.DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS_ = IconAnchorUnits.PIXELS;
/**
* @const
@@ -201,7 +199,7 @@ KML.createStyleDefaults_ = function() {
*/
KML.DEFAULT_IMAGE_STYLE_ = new _ol_style_Icon_({
anchor: KML.DEFAULT_IMAGE_STYLE_ANCHOR_,
anchorOrigin: _ol_style_IconOrigin_.BOTTOM_LEFT,
anchorOrigin: IconOrigin.BOTTOM_LEFT,
anchorXUnits: KML.DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS_,
anchorYUnits: KML.DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS_,
crossOrigin: 'anonymous',
@@ -280,9 +278,9 @@ KML.createStyleDefaults_ = function() {
* @private
*/
KML.ICON_ANCHOR_UNITS_MAP_ = {
'fraction': _ol_style_IconAnchorUnits_.FRACTION,
'pixels': _ol_style_IconAnchorUnits_.PIXELS,
'insetPixels': _ol_style_IconAnchorUnits_.PIXELS
'fraction': IconAnchorUnits.FRACTION,
'pixels': IconAnchorUnits.PIXELS,
'insetPixels': IconAnchorUnits.PIXELS
};
@@ -509,15 +507,15 @@ KML.readVec2_ = function(node) {
var origin;
if (xunits !== 'insetPixels') {
if (yunits !== 'insetPixels') {
origin = _ol_style_IconOrigin_.BOTTOM_LEFT;
origin = IconOrigin.BOTTOM_LEFT;
} else {
origin = _ol_style_IconOrigin_.TOP_LEFT;
origin = IconOrigin.TOP_LEFT;
}
} else {
if (yunits !== 'insetPixels') {
origin = _ol_style_IconOrigin_.BOTTOM_RIGHT;
origin = IconOrigin.BOTTOM_RIGHT;
} else {
origin = _ol_style_IconOrigin_.TOP_RIGHT;
origin = IconOrigin.TOP_RIGHT;
}
}
return {
@@ -579,7 +577,7 @@ KML.IconStyleParser_ = function(node, objectStack) {
src = KML.DEFAULT_IMAGE_STYLE_SRC_;
}
var anchor, anchorXUnits, anchorYUnits;
var anchorOrigin = _ol_style_IconOrigin_.BOTTOM_LEFT;
var anchorOrigin = IconOrigin.BOTTOM_LEFT;
var hotSpot = /** @type {ol.KMLVec2_|undefined} */
(object['hotSpot']);
if (hotSpot) {
@@ -593,8 +591,8 @@ KML.IconStyleParser_ = function(node, objectStack) {
anchorYUnits = KML.DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS_;
} else if (/^http:\/\/maps\.(?:google|gstatic)\.com\//.test(src)) {
anchor = [0.5, 0];
anchorXUnits = _ol_style_IconAnchorUnits_.FRACTION;
anchorYUnits = _ol_style_IconAnchorUnits_.FRACTION;
anchorXUnits = IconAnchorUnits.FRACTION;
anchorYUnits = IconAnchorUnits.FRACTION;
}
var offset;
@@ -640,7 +638,7 @@ KML.IconStyleParser_ = function(node, objectStack) {
anchorYUnits: anchorYUnits,
crossOrigin: 'anonymous', // FIXME should this be configurable?
offset: offset,
offsetOrigin: _ol_style_IconOrigin_.BOTTOM_LEFT,
offsetOrigin: IconOrigin.BOTTOM_LEFT,
rotation: rotation,
scale: scale,
size: size,
@@ -2279,9 +2277,9 @@ KML.writeIconStyle_ = function(node, style, objectStack) {
if (anchor && (anchor[0] !== size[0] / 2 || anchor[1] !== size[1] / 2)) {
var /** @type {ol.KMLVec2_} */ hotSpot = {
x: anchor[0],
xunits: _ol_style_IconAnchorUnits_.PIXELS,
xunits: IconAnchorUnits.PIXELS,
y: size[1] - anchor[1],
yunits: _ol_style_IconAnchorUnits_.PIXELS
yunits: IconAnchorUnits.PIXELS
};
properties['hotSpot'] = hotSpot;
}

View File

@@ -3,7 +3,7 @@
*/
import {getUid, inherits} from '../index.js';
import _ol_Collection_ from '../Collection.js';
import _ol_CollectionEventType_ from '../CollectionEventType.js';
import CollectionEventType from '../CollectionEventType.js';
import _ol_Feature_ from '../Feature.js';
import MapBrowserEventType from '../MapBrowserEventType.js';
import MapBrowserPointerEvent from '../MapBrowserPointerEvent.js';
@@ -214,9 +214,9 @@ var _ol_interaction_Modify_ = function(options) {
this.features_ = features;
this.features_.forEach(this.addFeature_, this);
_ol_events_.listen(this.features_, _ol_CollectionEventType_.ADD,
_ol_events_.listen(this.features_, CollectionEventType.ADD,
this.handleFeatureAdd_, this);
_ol_events_.listen(this.features_, _ol_CollectionEventType_.REMOVE,
_ol_events_.listen(this.features_, CollectionEventType.REMOVE,
this.handleFeatureRemove_, this);
/**

View File

@@ -2,7 +2,7 @@
* @module ol/interaction/Select
*/
import {getUid, inherits} from '../index.js';
import _ol_CollectionEventType_ from '../CollectionEventType.js';
import CollectionEventType from '../CollectionEventType.js';
import _ol_array_ from '../array.js';
import _ol_events_ from '../events.js';
import Event from '../events/Event.js';
@@ -135,9 +135,9 @@ var _ol_interaction_Select_ = function(opt_options) {
this.featureLayerAssociation_ = {};
var features = this.featureOverlay_.getSource().getFeaturesCollection();
_ol_events_.listen(features, _ol_CollectionEventType_.ADD,
_ol_events_.listen(features, CollectionEventType.ADD,
this.addFeature_, this);
_ol_events_.listen(features, _ol_CollectionEventType_.REMOVE,
_ol_events_.listen(features, CollectionEventType.REMOVE,
this.removeFeature_, this);
};

View File

@@ -3,7 +3,7 @@
*/
import {getUid, inherits} from '../index.js';
import _ol_Collection_ from '../Collection.js';
import _ol_CollectionEventType_ from '../CollectionEventType.js';
import CollectionEventType from '../CollectionEventType.js';
import _ol_coordinate_ from '../coordinate.js';
import _ol_events_ from '../events.js';
import EventType from '../events/EventType.js';
@@ -309,9 +309,9 @@ _ol_interaction_Snap_.prototype.setMap = function(map) {
if (map) {
if (this.features_) {
keys.push(
_ol_events_.listen(this.features_, _ol_CollectionEventType_.ADD,
_ol_events_.listen(this.features_, CollectionEventType.ADD,
this.handleFeatureAdd_, this),
_ol_events_.listen(this.features_, _ol_CollectionEventType_.REMOVE,
_ol_events_.listen(this.features_, CollectionEventType.REMOVE,
this.handleFeatureRemove_, this)
);
} else if (this.source_) {

View File

@@ -3,9 +3,9 @@
*/
import {getUid, inherits} from '../index.js';
import _ol_Collection_ from '../Collection.js';
import _ol_CollectionEventType_ from '../CollectionEventType.js';
import CollectionEventType from '../CollectionEventType.js';
import _ol_Object_ from '../Object.js';
import _ol_ObjectEventType_ from '../ObjectEventType.js';
import ObjectEventType from '../ObjectEventType.js';
import {assert} from '../asserts.js';
import _ol_events_ from '../events.js';
import EventType from '../events/EventType.js';
@@ -14,6 +14,16 @@ import _ol_layer_Base_ from '../layer/Base.js';
import _ol_obj_ from '../obj.js';
import _ol_source_State_ from '../source/State.js';
/**
* @enum {string}
* @private
*/
var Property = {
LAYERS: 'layers'
};
/**
* @classdesc
* A {@link ol.Collection} of layers that are handled together.
@@ -49,7 +59,7 @@ var _ol_layer_Group_ = function(opt_options) {
this.listenerKeys_ = {};
_ol_events_.listen(this,
_ol_Object_.getChangeEventType(_ol_layer_Group_.Property_.LAYERS),
_ol_Object_.getChangeEventType(Property.LAYERS),
this.handleLayersChanged_, this);
if (layers) {
@@ -89,9 +99,9 @@ _ol_layer_Group_.prototype.handleLayersChanged_ = function(event) {
var layers = this.getLayers();
this.layersListenerKeys_.push(
_ol_events_.listen(layers, _ol_CollectionEventType_.ADD,
_ol_events_.listen(layers, CollectionEventType.ADD,
this.handleLayersAdd_, this),
_ol_events_.listen(layers, _ol_CollectionEventType_.REMOVE,
_ol_events_.listen(layers, CollectionEventType.REMOVE,
this.handleLayersRemove_, this));
for (var id in this.listenerKeys_) {
@@ -104,7 +114,7 @@ _ol_layer_Group_.prototype.handleLayersChanged_ = function(event) {
for (i = 0, ii = layersArray.length; i < ii; i++) {
layer = layersArray[i];
this.listenerKeys_[getUid(layer).toString()] = [
_ol_events_.listen(layer, _ol_ObjectEventType_.PROPERTYCHANGE,
_ol_events_.listen(layer, ObjectEventType.PROPERTYCHANGE,
this.handleLayerChange_, this),
_ol_events_.listen(layer, EventType.CHANGE,
this.handleLayerChange_, this)
@@ -123,7 +133,7 @@ _ol_layer_Group_.prototype.handleLayersAdd_ = function(collectionEvent) {
var layer = /** @type {ol.layer.Base} */ (collectionEvent.element);
var key = getUid(layer).toString();
this.listenerKeys_[key] = [
_ol_events_.listen(layer, _ol_ObjectEventType_.PROPERTYCHANGE,
_ol_events_.listen(layer, ObjectEventType.PROPERTYCHANGE,
this.handleLayerChange_, this),
_ol_events_.listen(layer, EventType.CHANGE,
this.handleLayerChange_, this)
@@ -154,10 +164,7 @@ _ol_layer_Group_.prototype.handleLayersRemove_ = function(collectionEvent) {
* @api
*/
_ol_layer_Group_.prototype.getLayers = function() {
return (
/** @type {!ol.Collection.<ol.layer.Base>} */ this.get(
_ol_layer_Group_.Property_.LAYERS)
);
return (/** @type {!ol.Collection.<ol.layer.Base>} */ this.get(Property.LAYERS));
};
@@ -170,7 +177,7 @@ _ol_layer_Group_.prototype.getLayers = function() {
* @api
*/
_ol_layer_Group_.prototype.setLayers = function(layers) {
this.set(_ol_layer_Group_.Property_.LAYERS, layers);
this.set(Property.LAYERS, layers);
};
@@ -228,11 +235,4 @@ _ol_layer_Group_.prototype.getSourceState = function() {
return _ol_source_State_.READY;
};
/**
* @enum {string}
* @private
*/
_ol_layer_Group_.Property_ = {
LAYERS: 'layers'
};
export default _ol_layer_Group_;

View File

@@ -12,6 +12,25 @@ import _ol_render_EventType_ from '../render/EventType.js';
import _ol_style_Icon_ from '../style/Icon.js';
import _ol_style_Style_ from '../style/Style.js';
/**
* @enum {string}
* @private
*/
var Property = {
BLUR: 'blur',
GRADIENT: 'gradient',
RADIUS: 'radius'
};
/**
* @const
* @type {Array.<string>}
*/
var DEFAULT_GRADIENT = ['#00f', '#0ff', '#0f0', '#ff0', '#f00'];
/**
* @classdesc
* Layer for rendering vector data as a heatmap.
@@ -25,7 +44,7 @@ import _ol_style_Style_ from '../style/Style.js';
* @param {olx.layer.HeatmapOptions=} opt_options Options.
* @api
*/
var _ol_layer_Heatmap_ = function(opt_options) {
var Heatmap = function(opt_options) {
var options = opt_options ? opt_options : {};
var baseOptions = _ol_obj_.assign({}, options);
@@ -62,21 +81,20 @@ var _ol_layer_Heatmap_ = function(opt_options) {
this.styleCache_ = null;
_ol_events_.listen(this,
_ol_Object_.getChangeEventType(_ol_layer_Heatmap_.Property_.GRADIENT),
_ol_Object_.getChangeEventType(Property.GRADIENT),
this.handleGradientChanged_, this);
this.setGradient(options.gradient ?
options.gradient : _ol_layer_Heatmap_.DEFAULT_GRADIENT);
this.setGradient(options.gradient ? options.gradient : DEFAULT_GRADIENT);
this.setBlur(options.blur !== undefined ? options.blur : 15);
this.setRadius(options.radius !== undefined ? options.radius : 8);
_ol_events_.listen(this,
_ol_Object_.getChangeEventType(_ol_layer_Heatmap_.Property_.BLUR),
_ol_Object_.getChangeEventType(Property.BLUR),
this.handleStyleChanged_, this);
_ol_events_.listen(this,
_ol_Object_.getChangeEventType(_ol_layer_Heatmap_.Property_.RADIUS),
_ol_Object_.getChangeEventType(Property.RADIUS),
this.handleStyleChanged_, this);
this.handleStyleChanged_();
@@ -118,14 +136,7 @@ var _ol_layer_Heatmap_ = function(opt_options) {
_ol_events_.listen(this, _ol_render_EventType_.RENDER, this.handleRender_, this);
};
inherits(_ol_layer_Heatmap_, _ol_layer_Vector_);
/**
* @const
* @type {Array.<string>}
*/
_ol_layer_Heatmap_.DEFAULT_GRADIENT = ['#00f', '#0ff', '#0f0', '#ff0', '#f00'];
inherits(Heatmap, _ol_layer_Vector_);
/**
@@ -133,7 +144,7 @@ _ol_layer_Heatmap_.DEFAULT_GRADIENT = ['#00f', '#0ff', '#0f0', '#ff0', '#f00'];
* @return {Uint8ClampedArray} An array.
* @private
*/
_ol_layer_Heatmap_.createGradient_ = function(colors) {
var createGradient = function(colors) {
var width = 1;
var height = 256;
var context = createCanvasContext2D(width, height);
@@ -155,7 +166,7 @@ _ol_layer_Heatmap_.createGradient_ = function(colors) {
* @return {string} Data URL for a circle.
* @private
*/
_ol_layer_Heatmap_.prototype.createCircle_ = function() {
Heatmap.prototype.createCircle_ = function() {
var radius = this.getRadius();
var blur = this.getBlur();
var halfSize = radius + blur + 1;
@@ -178,10 +189,8 @@ _ol_layer_Heatmap_.prototype.createCircle_ = function() {
* @api
* @observable
*/
_ol_layer_Heatmap_.prototype.getBlur = function() {
return (
/** @type {number} */ this.get(_ol_layer_Heatmap_.Property_.BLUR)
);
Heatmap.prototype.getBlur = function() {
return (/** @type {number} */ this.get(Property.BLUR));
};
@@ -191,10 +200,8 @@ _ol_layer_Heatmap_.prototype.getBlur = function() {
* @api
* @observable
*/
_ol_layer_Heatmap_.prototype.getGradient = function() {
return (
/** @type {Array.<string>} */ this.get(_ol_layer_Heatmap_.Property_.GRADIENT)
);
Heatmap.prototype.getGradient = function() {
return (/** @type {Array.<string>} */ this.get(Property.GRADIENT));
};
@@ -204,25 +211,23 @@ _ol_layer_Heatmap_.prototype.getGradient = function() {
* @api
* @observable
*/
_ol_layer_Heatmap_.prototype.getRadius = function() {
return (
/** @type {number} */ this.get(_ol_layer_Heatmap_.Property_.RADIUS)
);
Heatmap.prototype.getRadius = function() {
return (/** @type {number} */ this.get(Property.RADIUS));
};
/**
* @private
*/
_ol_layer_Heatmap_.prototype.handleGradientChanged_ = function() {
this.gradient_ = _ol_layer_Heatmap_.createGradient_(this.getGradient());
Heatmap.prototype.handleGradientChanged_ = function() {
this.gradient_ = createGradient(this.getGradient());
};
/**
* @private
*/
_ol_layer_Heatmap_.prototype.handleStyleChanged_ = function() {
Heatmap.prototype.handleStyleChanged_ = function() {
this.circleImage_ = this.createCircle_();
this.styleCache_ = new Array(256);
this.changed();
@@ -233,7 +238,7 @@ _ol_layer_Heatmap_.prototype.handleStyleChanged_ = function() {
* @param {ol.render.Event} event Post compose event
* @private
*/
_ol_layer_Heatmap_.prototype.handleRender_ = function(event) {
Heatmap.prototype.handleRender_ = function(event) {
var context = event.context;
var canvas = context.canvas;
var image = context.getImageData(0, 0, canvas.width, canvas.height);
@@ -257,8 +262,8 @@ _ol_layer_Heatmap_.prototype.handleRender_ = function(event) {
* @api
* @observable
*/
_ol_layer_Heatmap_.prototype.setBlur = function(blur) {
this.set(_ol_layer_Heatmap_.Property_.BLUR, blur);
Heatmap.prototype.setBlur = function(blur) {
this.set(Property.BLUR, blur);
};
@@ -268,8 +273,8 @@ _ol_layer_Heatmap_.prototype.setBlur = function(blur) {
* @api
* @observable
*/
_ol_layer_Heatmap_.prototype.setGradient = function(colors) {
this.set(_ol_layer_Heatmap_.Property_.GRADIENT, colors);
Heatmap.prototype.setGradient = function(colors) {
this.set(Property.GRADIENT, colors);
};
@@ -279,18 +284,8 @@ _ol_layer_Heatmap_.prototype.setGradient = function(colors) {
* @api
* @observable
*/
_ol_layer_Heatmap_.prototype.setRadius = function(radius) {
this.set(_ol_layer_Heatmap_.Property_.RADIUS, radius);
Heatmap.prototype.setRadius = function(radius) {
this.set(Property.RADIUS, radius);
};
/**
* @enum {string}
* @private
*/
_ol_layer_Heatmap_.Property_ = {
BLUR: 'blur',
GRADIENT: 'gradient',
RADIUS: 'radius'
};
export default _ol_layer_Heatmap_;
export default Heatmap;

View File

@@ -8,6 +8,16 @@ import _ol_layer_VectorRenderType_ from '../layer/VectorRenderType.js';
import _ol_obj_ from '../obj.js';
import _ol_style_Style_ from '../style/Style.js';
/**
* @enum {string}
* @private
*/
var Property = {
RENDER_ORDER: 'renderOrder'
};
/**
* @classdesc
* Vector data that is rendered client-side.
@@ -123,9 +133,7 @@ _ol_layer_Vector_.prototype.getRenderBuffer = function() {
* order.
*/
_ol_layer_Vector_.prototype.getRenderOrder = function() {
return (
/** @type {ol.RenderOrderFunction|null|undefined} */ this.get(_ol_layer_Vector_.Property_.RENDER_ORDER)
);
return (/** @type {ol.RenderOrderFunction|null|undefined} */ this.get(Property.RENDER_ORDER));
};
@@ -183,7 +191,7 @@ _ol_layer_Vector_.prototype.getUpdateWhileInteracting = function() {
* Render order.
*/
_ol_layer_Vector_.prototype.setRenderOrder = function(renderOrder) {
this.set(_ol_layer_Vector_.Property_.RENDER_ORDER, renderOrder);
this.set(Property.RENDER_ORDER, renderOrder);
};
@@ -214,11 +222,4 @@ _ol_layer_Vector_.prototype.getRenderMode = function() {
};
/**
* @enum {string}
* @private
*/
_ol_layer_Vector_.Property_ = {
RENDER_ORDER: 'renderOrder'
};
export default _ol_layer_Vector_;

View File

@@ -12,7 +12,7 @@ import _ol_render_canvas_ from '../canvas.js';
import _ol_render_canvas_Instruction_ from '../canvas/Instruction.js';
import _ol_render_canvas_Replay_ from '../canvas/Replay.js';
import _ol_render_replay_ from '../replay.js';
import _ol_style_TextPlacement_ from '../../style/TextPlacement.js';
import TextPlacement from '../../style/TextPlacement.js';
/**
* @constructor
@@ -176,7 +176,7 @@ _ol_render_canvas_TextReplay_.prototype.drawText = function(geometry, feature) {
var stride = 2;
var i, ii;
if (textState.placement === _ol_style_TextPlacement_.LINE) {
if (textState.placement === TextPlacement.LINE) {
if (!intersects(this.getBufferedMaxExtent(), geometry.getExtent())) {
return;
}

View File

@@ -2,7 +2,7 @@
* @module ol/renderer/Layer
*/
import {getUid, inherits, nullFunction} from '../index.js';
import _ol_ImageState_ from '../ImageState.js';
import ImageState from '../ImageState.js';
import _ol_Observable_ from '../Observable.js';
import _ol_TileState_ from '../TileState.js';
import _ol_events_ from '../events.js';
@@ -98,7 +98,7 @@ _ol_renderer_Layer_.prototype.getLayer = function() {
*/
_ol_renderer_Layer_.prototype.handleImageChange_ = function(event) {
var image = /** @type {ol.Image} */ (event.target);
if (image.getState() === _ol_ImageState_.LOADED) {
if (image.getState() === ImageState.LOADED) {
this.renderIfReadyAndVisible();
}
};
@@ -114,16 +114,14 @@ _ol_renderer_Layer_.prototype.handleImageChange_ = function(event) {
*/
_ol_renderer_Layer_.prototype.loadImage = function(image) {
var imageState = image.getState();
if (imageState != _ol_ImageState_.LOADED &&
imageState != _ol_ImageState_.ERROR) {
_ol_events_.listen(image, EventType.CHANGE,
this.handleImageChange_, this);
if (imageState != ImageState.LOADED && imageState != ImageState.ERROR) {
_ol_events_.listen(image, EventType.CHANGE, this.handleImageChange_, this);
}
if (imageState == _ol_ImageState_.IDLE) {
if (imageState == ImageState.IDLE) {
image.load();
imageState = image.getState();
}
return imageState == _ol_ImageState_.LOADED;
return imageState == ImageState.LOADED;
};

View File

@@ -2,7 +2,7 @@
* @module ol/renderer/vector
*/
import {getUid} from '../index.js';
import _ol_ImageState_ from '../ImageState.js';
import ImageState from '../ImageState.js';
import GeometryType from '../geom/GeometryType.js';
import _ol_render_ReplayType_ from '../render/ReplayType.js';
var _ol_renderer_vector_ = {};
@@ -88,11 +88,10 @@ _ol_renderer_vector_.renderFeature = function(
imageStyle = style.getImage();
if (imageStyle) {
imageState = imageStyle.getImageState();
if (imageState == _ol_ImageState_.LOADED ||
imageState == _ol_ImageState_.ERROR) {
if (imageState == ImageState.LOADED || imageState == ImageState.ERROR) {
imageStyle.unlistenImageChange(listener, thisArg);
} else {
if (imageState == _ol_ImageState_.IDLE) {
if (imageState == ImageState.IDLE) {
imageStyle.load();
}
imageState = imageStyle.getImageState();
@@ -256,7 +255,7 @@ _ol_renderer_vector_.renderMultiPolygonGeometry_ = function(replayGroup, geometr
_ol_renderer_vector_.renderPointGeometry_ = function(replayGroup, geometry, style, feature) {
var imageStyle = style.getImage();
if (imageStyle) {
if (imageStyle.getImageState() != _ol_ImageState_.LOADED) {
if (imageStyle.getImageState() != ImageState.LOADED) {
return;
}
var imageReplay = replayGroup.getReplay(
@@ -284,7 +283,7 @@ _ol_renderer_vector_.renderPointGeometry_ = function(replayGroup, geometry, styl
_ol_renderer_vector_.renderMultiPointGeometry_ = function(replayGroup, geometry, style, feature) {
var imageStyle = style.getImage();
if (imageStyle) {
if (imageStyle.getImageState() != _ol_ImageState_.LOADED) {
if (imageStyle.getImageState() != ImageState.LOADED) {
return;
}
var imageReplay = replayGroup.getReplay(

View File

@@ -4,7 +4,7 @@
import {ERROR_THRESHOLD} from './common.js';
import {inherits} from '../index.js';
import _ol_ImageBase_ from '../ImageBase.js';
import _ol_ImageState_ from '../ImageState.js';
import ImageState from '../ImageState.js';
import _ol_events_ from '../events.js';
import EventType from '../events/EventType.js';
import {getCenter, getIntersection, getHeight, getWidth} from '../extent.js';
@@ -100,10 +100,10 @@ var _ol_reproj_Image_ = function(sourceProj, targetProj,
this.sourceListenerKey_ = null;
var state = _ol_ImageState_.LOADED;
var state = ImageState.LOADED;
if (this.sourceImage_) {
state = _ol_ImageState_.IDLE;
state = ImageState.IDLE;
}
_ol_ImageBase_.call(this, targetExtent, targetResolution, this.sourcePixelRatio_, state);
@@ -116,7 +116,7 @@ inherits(_ol_reproj_Image_, _ol_ImageBase_);
* @inheritDoc
*/
_ol_reproj_Image_.prototype.disposeInternal = function() {
if (this.state == _ol_ImageState_.LOADING) {
if (this.state == ImageState.LOADING) {
this.unlistenSource_();
}
_ol_ImageBase_.prototype.disposeInternal.call(this);
@@ -144,7 +144,7 @@ _ol_reproj_Image_.prototype.getProjection = function() {
*/
_ol_reproj_Image_.prototype.reproject_ = function() {
var sourceState = this.sourceImage_.getState();
if (sourceState == _ol_ImageState_.LOADED) {
if (sourceState == ImageState.LOADED) {
var width = getWidth(this.targetExtent_) / this.targetResolution_;
var height = getHeight(this.targetExtent_) / this.targetResolution_;
@@ -164,20 +164,18 @@ _ol_reproj_Image_.prototype.reproject_ = function() {
* @inheritDoc
*/
_ol_reproj_Image_.prototype.load = function() {
if (this.state == _ol_ImageState_.IDLE) {
this.state = _ol_ImageState_.LOADING;
if (this.state == ImageState.IDLE) {
this.state = ImageState.LOADING;
this.changed();
var sourceState = this.sourceImage_.getState();
if (sourceState == _ol_ImageState_.LOADED ||
sourceState == _ol_ImageState_.ERROR) {
if (sourceState == ImageState.LOADED || sourceState == ImageState.ERROR) {
this.reproject_();
} else {
this.sourceListenerKey_ = _ol_events_.listen(this.sourceImage_,
EventType.CHANGE, function(e) {
var sourceState = this.sourceImage_.getState();
if (sourceState == _ol_ImageState_.LOADED ||
sourceState == _ol_ImageState_.ERROR) {
if (sourceState == ImageState.LOADED || sourceState == ImageState.ERROR) {
this.unlistenSource_();
this.reproject_();
}

View File

@@ -3,7 +3,7 @@
*/
import {ENABLE_RASTER_REPROJECTION} from '../reproj/common.js';
import {inherits} from '../index.js';
import _ol_ImageState_ from '../ImageState.js';
import ImageState from '../ImageState.js';
import _ol_array_ from '../array.js';
import Event from '../events/Event.js';
import {equals} from '../extent.js';
@@ -142,17 +142,17 @@ _ol_source_Image_.prototype.getImageInternal = function(extent, resolution, pixe
_ol_source_Image_.prototype.handleImageChange = function(event) {
var image = /** @type {ol.Image} */ (event.target);
switch (image.getState()) {
case _ol_ImageState_.LOADING:
case ImageState.LOADING:
this.dispatchEvent(
new _ol_source_Image_.Event(_ol_source_Image_.EventType_.IMAGELOADSTART,
image));
break;
case _ol_ImageState_.LOADED:
case ImageState.LOADED:
this.dispatchEvent(
new _ol_source_Image_.Event(_ol_source_Image_.EventType_.IMAGELOADEND,
image));
break;
case _ol_ImageState_.ERROR:
case ImageState.ERROR:
this.dispatchEvent(
new _ol_source_Image_.Event(_ol_source_Image_.EventType_.IMAGELOADERROR,
image));

View File

@@ -3,7 +3,7 @@
*/
import {inherits} from '../index.js';
import _ol_Image_ from '../Image.js';
import _ol_ImageState_ from '../ImageState.js';
import ImageState from '../ImageState.js';
import {createCanvasContext2D} from '../dom.js';
import _ol_events_ from '../events.js';
import EventType from '../events/EventType.js';
@@ -70,7 +70,7 @@ _ol_source_ImageStatic_.prototype.getImageInternal = function(extent, resolution
* @inheritDoc
*/
_ol_source_ImageStatic_.prototype.handleImageChange = function(evt) {
if (this.image_.getState() == _ol_ImageState_.LOADED) {
if (this.image_.getState() == ImageState.LOADED) {
var imageExtent = this.image_.getExtent();
var image = this.image_.getImage();
var imageWidth, imageHeight;

View File

@@ -4,8 +4,8 @@
import {getUid, inherits, nullFunction} from '../index.js';
import _ol_Collection_ from '../Collection.js';
import _ol_CollectionEventType_ from '../CollectionEventType.js';
import _ol_ObjectEventType_ from '../ObjectEventType.js';
import CollectionEventType from '../CollectionEventType.js';
import ObjectEventType from '../ObjectEventType.js';
import _ol_array_ from '../array.js';
import {assert} from '../asserts.js';
import _ol_events_ from '../events.js';
@@ -205,7 +205,7 @@ _ol_source_Vector_.prototype.setupChangeEvents_ = function(featureKey, feature)
this.featureChangeKeys_[featureKey] = [
_ol_events_.listen(feature, EventType.CHANGE,
this.handleFeatureChange_, this),
_ol_events_.listen(feature, _ol_ObjectEventType_.PROPERTYCHANGE,
_ol_events_.listen(feature, ObjectEventType.PROPERTYCHANGE,
this.handleFeatureChange_, this)
];
};
@@ -314,7 +314,7 @@ _ol_source_Vector_.prototype.bindFeaturesCollection_ = function(collection) {
modifyingCollection = false;
}
});
_ol_events_.listen(collection, _ol_CollectionEventType_.ADD,
_ol_events_.listen(collection, CollectionEventType.ADD,
function(evt) {
if (!modifyingCollection) {
modifyingCollection = true;
@@ -322,7 +322,7 @@ _ol_source_Vector_.prototype.bindFeaturesCollection_ = function(collection) {
modifyingCollection = false;
}
}, this);
_ol_events_.listen(collection, _ol_CollectionEventType_.REMOVE,
_ol_events_.listen(collection, CollectionEventType.REMOVE,
function(evt) {
if (!modifyingCollection) {
modifyingCollection = true;

View File

@@ -1,12 +1,12 @@
/**
* @module ol/style
*/
import _ol_style_IconImageCache_ from './style/IconImageCache.js';
import IconImageCache from './style/IconImageCache.js';
var _ol_style_ = {};
/**
* The {@link ol.style.IconImageCache} for {@link ol.style.Icon} images.
* @api
*/
_ol_style_.iconImageCache = new _ol_style_IconImageCache_();
_ol_style_.iconImageCache = new IconImageCache();
export default _ol_style_;

View File

@@ -2,14 +2,14 @@
* @module ol/style/Icon
*/
import {getUid, inherits} from '../index.js';
import _ol_ImageState_ from '../ImageState.js';
import ImageState from '../ImageState.js';
import {assert} from '../asserts.js';
import _ol_color_ from '../color.js';
import _ol_events_ from '../events.js';
import EventType from '../events/EventType.js';
import _ol_style_IconAnchorUnits_ from '../style/IconAnchorUnits.js';
import IconAnchorUnits from '../style/IconAnchorUnits.js';
import _ol_style_IconImage_ from '../style/IconImage.js';
import _ol_style_IconOrigin_ from '../style/IconOrigin.js';
import IconOrigin from '../style/IconOrigin.js';
import _ol_style_Image_ from '../style/Image.js';
/**
@@ -42,21 +42,21 @@ var _ol_style_Icon_ = function(opt_options) {
* @type {ol.style.IconOrigin}
*/
this.anchorOrigin_ = options.anchorOrigin !== undefined ?
options.anchorOrigin : _ol_style_IconOrigin_.TOP_LEFT;
options.anchorOrigin : IconOrigin.TOP_LEFT;
/**
* @private
* @type {ol.style.IconAnchorUnits}
*/
this.anchorXUnits_ = options.anchorXUnits !== undefined ?
options.anchorXUnits : _ol_style_IconAnchorUnits_.FRACTION;
options.anchorXUnits : IconAnchorUnits.FRACTION;
/**
* @private
* @type {ol.style.IconAnchorUnits}
*/
this.anchorYUnits_ = options.anchorYUnits !== undefined ?
options.anchorYUnits : _ol_style_IconAnchorUnits_.FRACTION;
options.anchorYUnits : IconAnchorUnits.FRACTION;
/**
* @private
@@ -95,7 +95,7 @@ var _ol_style_Icon_ = function(opt_options) {
* @type {ol.ImageState}
*/
var imageState = options.src !== undefined ?
_ol_ImageState_.IDLE : _ol_ImageState_.LOADED;
ImageState.IDLE : ImageState.LOADED;
/**
* @private
@@ -122,7 +122,7 @@ var _ol_style_Icon_ = function(opt_options) {
* @type {ol.style.IconOrigin}
*/
this.offsetOrigin_ = options.offsetOrigin !== undefined ?
options.offsetOrigin : _ol_style_IconOrigin_.TOP_LEFT;
options.offsetOrigin : IconOrigin.TOP_LEFT;
/**
* @private
@@ -212,33 +212,33 @@ _ol_style_Icon_.prototype.getAnchor = function() {
}
var anchor = this.anchor_;
var size = this.getSize();
if (this.anchorXUnits_ == _ol_style_IconAnchorUnits_.FRACTION ||
this.anchorYUnits_ == _ol_style_IconAnchorUnits_.FRACTION) {
if (this.anchorXUnits_ == IconAnchorUnits.FRACTION ||
this.anchorYUnits_ == IconAnchorUnits.FRACTION) {
if (!size) {
return null;
}
anchor = this.anchor_.slice();
if (this.anchorXUnits_ == _ol_style_IconAnchorUnits_.FRACTION) {
if (this.anchorXUnits_ == IconAnchorUnits.FRACTION) {
anchor[0] *= size[0];
}
if (this.anchorYUnits_ == _ol_style_IconAnchorUnits_.FRACTION) {
if (this.anchorYUnits_ == IconAnchorUnits.FRACTION) {
anchor[1] *= size[1];
}
}
if (this.anchorOrigin_ != _ol_style_IconOrigin_.TOP_LEFT) {
if (this.anchorOrigin_ != IconOrigin.TOP_LEFT) {
if (!size) {
return null;
}
if (anchor === this.anchor_) {
anchor = this.anchor_.slice();
}
if (this.anchorOrigin_ == _ol_style_IconOrigin_.TOP_RIGHT ||
this.anchorOrigin_ == _ol_style_IconOrigin_.BOTTOM_RIGHT) {
if (this.anchorOrigin_ == IconOrigin.TOP_RIGHT ||
this.anchorOrigin_ == IconOrigin.BOTTOM_RIGHT) {
anchor[0] = -anchor[0] + size[0];
}
if (this.anchorOrigin_ == _ol_style_IconOrigin_.BOTTOM_LEFT ||
this.anchorOrigin_ == _ol_style_IconOrigin_.BOTTOM_RIGHT) {
if (this.anchorOrigin_ == IconOrigin.BOTTOM_LEFT ||
this.anchorOrigin_ == IconOrigin.BOTTOM_RIGHT) {
anchor[1] = -anchor[1] + size[1];
}
}
@@ -311,19 +311,19 @@ _ol_style_Icon_.prototype.getOrigin = function() {
}
var offset = this.offset_;
if (this.offsetOrigin_ != _ol_style_IconOrigin_.TOP_LEFT) {
if (this.offsetOrigin_ != IconOrigin.TOP_LEFT) {
var size = this.getSize();
var iconImageSize = this.iconImage_.getSize();
if (!size || !iconImageSize) {
return null;
}
offset = offset.slice();
if (this.offsetOrigin_ == _ol_style_IconOrigin_.TOP_RIGHT ||
this.offsetOrigin_ == _ol_style_IconOrigin_.BOTTOM_RIGHT) {
if (this.offsetOrigin_ == IconOrigin.TOP_RIGHT ||
this.offsetOrigin_ == IconOrigin.BOTTOM_RIGHT) {
offset[0] = iconImageSize[0] - size[0] - offset[0];
}
if (this.offsetOrigin_ == _ol_style_IconOrigin_.BOTTOM_LEFT ||
this.offsetOrigin_ == _ol_style_IconOrigin_.BOTTOM_RIGHT) {
if (this.offsetOrigin_ == IconOrigin.BOTTOM_LEFT ||
this.offsetOrigin_ == IconOrigin.BOTTOM_RIGHT) {
offset[1] = iconImageSize[1] - size[1] - offset[1];
}
}

View File

@@ -6,7 +6,7 @@ import {createCanvasContext2D} from '../dom.js';
import _ol_events_ from '../events.js';
import EventTarget from '../events/EventTarget.js';
import EventType from '../events/EventType.js';
import _ol_ImageState_ from '../ImageState.js';
import ImageState from '../ImageState.js';
import _ol_style_ from '../style.js';
/**
@@ -83,7 +83,7 @@ var _ol_style_IconImage_ = function(image, src, size, crossOrigin, imageState,
* @type {boolean}
*/
this.tainting_ = false;
if (this.imageState_ == _ol_ImageState_.LOADED) {
if (this.imageState_ == ImageState.LOADED) {
this.determineTainting_();
}
@@ -140,7 +140,7 @@ _ol_style_IconImage_.prototype.dispatchChangeEvent_ = function() {
* @private
*/
_ol_style_IconImage_.prototype.handleImageError_ = function() {
this.imageState_ = _ol_ImageState_.ERROR;
this.imageState_ = ImageState.ERROR;
this.unlistenImage_();
this.dispatchChangeEvent_();
};
@@ -150,7 +150,7 @@ _ol_style_IconImage_.prototype.handleImageError_ = function() {
* @private
*/
_ol_style_IconImage_.prototype.handleImageLoad_ = function() {
this.imageState_ = _ol_ImageState_.LOADED;
this.imageState_ = ImageState.LOADED;
if (this.size_) {
this.image_.width = this.size_[0];
this.image_.height = this.size_[1];
@@ -220,8 +220,8 @@ _ol_style_IconImage_.prototype.getSrc = function() {
* Load not yet loaded URI.
*/
_ol_style_IconImage_.prototype.load = function() {
if (this.imageState_ == _ol_ImageState_.IDLE) {
this.imageState_ = _ol_ImageState_.LOADING;
if (this.imageState_ == ImageState.IDLE) {
this.imageState_ = ImageState.LOADING;
this.imageListenerKeys_ = [
_ol_events_.listenOnce(this.image_, EventType.ERROR,
this.handleImageError_, this),

View File

@@ -7,7 +7,7 @@ import _ol_color_ from '../color.js';
* Singleton class. Available through {@link ol.style.iconImageCache}.
* @constructor
*/
var _ol_style_IconImageCache_ = function() {
var IconImageCache = function() {
/**
* @type {Object.<string, ol.style.IconImage>}
@@ -35,16 +35,16 @@ var _ol_style_IconImageCache_ = function() {
* @param {ol.Color} color Color.
* @return {string} Cache key.
*/
_ol_style_IconImageCache_.getKey = function(src, crossOrigin, color) {
function getKey(src, crossOrigin, color) {
var colorString = color ? _ol_color_.asString(color) : 'null';
return crossOrigin + ':' + src + ':' + colorString;
};
}
/**
* FIXME empty description for jsdoc
*/
_ol_style_IconImageCache_.prototype.clear = function() {
IconImageCache.prototype.clear = function() {
this.cache_ = {};
this.cacheSize_ = 0;
};
@@ -53,7 +53,7 @@ _ol_style_IconImageCache_.prototype.clear = function() {
/**
* FIXME empty description for jsdoc
*/
_ol_style_IconImageCache_.prototype.expire = function() {
IconImageCache.prototype.expire = function() {
if (this.cacheSize_ > this.maxCacheSize_) {
var i = 0;
var key, iconImage;
@@ -74,8 +74,8 @@ _ol_style_IconImageCache_.prototype.expire = function() {
* @param {ol.Color} color Color.
* @return {ol.style.IconImage} Icon image.
*/
_ol_style_IconImageCache_.prototype.get = function(src, crossOrigin, color) {
var key = _ol_style_IconImageCache_.getKey(src, crossOrigin, color);
IconImageCache.prototype.get = function(src, crossOrigin, color) {
var key = getKey(src, crossOrigin, color);
return key in this.cache_ ? this.cache_[key] : null;
};
@@ -86,8 +86,8 @@ _ol_style_IconImageCache_.prototype.get = function(src, crossOrigin, color) {
* @param {ol.Color} color Color.
* @param {ol.style.IconImage} iconImage Icon image.
*/
_ol_style_IconImageCache_.prototype.set = function(src, crossOrigin, color, iconImage) {
var key = _ol_style_IconImageCache_.getKey(src, crossOrigin, color);
IconImageCache.prototype.set = function(src, crossOrigin, color, iconImage) {
var key = getKey(src, crossOrigin, color);
this.cache_[key] = iconImage;
++this.cacheSize_;
};
@@ -100,8 +100,8 @@ _ol_style_IconImageCache_.prototype.set = function(src, crossOrigin, color, icon
* @param {number} maxCacheSize Cache max size.
* @api
*/
_ol_style_IconImageCache_.prototype.setSize = function(maxCacheSize) {
IconImageCache.prototype.setSize = function(maxCacheSize) {
this.maxCacheSize_ = maxCacheSize;
this.expire();
};
export default _ol_style_IconImageCache_;
export default IconImageCache;

View File

@@ -5,7 +5,7 @@ import {inherits} from '../index.js';
import {asColorLike} from '../colorlike.js';
import {createCanvasContext2D} from '../dom.js';
import _ol_has_ from '../has.js';
import _ol_ImageState_ from '../ImageState.js';
import ImageState from '../ImageState.js';
import _ol_render_canvas_ from '../render/canvas.js';
import _ol_style_Image_ from '../style/Image.js';
@@ -228,7 +228,7 @@ _ol_style_RegularShape_.prototype.getHitDetectionImageSize = function() {
* @inheritDoc
*/
_ol_style_RegularShape_.prototype.getImageState = function() {
return _ol_ImageState_.LOADED;
return ImageState.LOADED;
};

View File

@@ -2,7 +2,7 @@
* @module ol/style/Text
*/
import _ol_style_Fill_ from '../style/Fill.js';
import _ol_style_TextPlacement_ from '../style/TextPlacement.js';
import TextPlacement from '../style/TextPlacement.js';
/**
* @classdesc
@@ -75,7 +75,7 @@ var _ol_style_Text_ = function(opt_options) {
* @private
* @type {ol.style.TextPlacement|string}
*/
this.placement_ = options.placement !== undefined ? options.placement : _ol_style_TextPlacement_.POINT;
this.placement_ = options.placement !== undefined ? options.placement : TextPlacement.POINT;
/**
* @private

View File

@@ -1,6 +1,6 @@
import _ol_events_ from '../../../src/ol/events.js';
import _ol_Collection_ from '../../../src/ol/Collection.js';
import _ol_CollectionEventType_ from '../../../src/ol/CollectionEventType.js';
import CollectionEventType from '../../../src/ol/CollectionEventType.js';
describe('ol.collection', function() {
@@ -129,7 +129,7 @@ describe('ol.collection', function() {
it('fires a remove event', function() {
var collection = new _ol_Collection_([0, 1, 2]);
var cb = sinon.spy();
_ol_events_.listen(collection, _ol_CollectionEventType_.REMOVE, cb);
_ol_events_.listen(collection, CollectionEventType.REMOVE, cb);
expect(collection.remove(1)).to.eql(1);
expect(cb).to.be.called();
expect(cb.lastCall.args[0].element).to.eql(1);
@@ -152,11 +152,11 @@ describe('ol.collection', function() {
it('does dispatch events', function() {
var collection = new _ol_Collection_(['a', 'b']);
var added, removed;
_ol_events_.listen(collection, _ol_CollectionEventType_.ADD, function(e) {
_ol_events_.listen(collection, CollectionEventType.ADD, function(e) {
added = e.element;
});
_ol_events_.listen(
collection, _ol_CollectionEventType_.REMOVE, function(e) {
collection, CollectionEventType.REMOVE, function(e) {
removed = e.element;
});
collection.setAt(1, 1);
@@ -170,7 +170,7 @@ describe('ol.collection', function() {
var collection = new _ol_Collection_(['a']);
var removed;
_ol_events_.listen(
collection, _ol_CollectionEventType_.REMOVE, function(e) {
collection, CollectionEventType.REMOVE, function(e) {
removed = e.element;
});
collection.pop();
@@ -183,7 +183,7 @@ describe('ol.collection', function() {
var collection = new _ol_Collection_([0, 2]);
var added;
_ol_events_.listen(
collection, _ol_CollectionEventType_.ADD, function(e) {
collection, CollectionEventType.ADD, function(e) {
added = e.element;
});
collection.insertAt(1, 1);
@@ -195,7 +195,7 @@ describe('ol.collection', function() {
it('triggers events properly', function() {
var added = [];
_ol_events_.listen(
collection, _ol_CollectionEventType_.ADD, function(e) {
collection, CollectionEventType.ADD, function(e) {
added.push(e.element);
});
collection.setAt(2, 0);
@@ -244,7 +244,7 @@ describe('ol.collection', function() {
it('triggers add when pushing', function() {
var collection = new _ol_Collection_();
var elem;
_ol_events_.listen(collection, _ol_CollectionEventType_.ADD, function(e) {
_ol_events_.listen(collection, CollectionEventType.ADD, function(e) {
elem = e.element;
});
var length = collection.push(1);
@@ -261,8 +261,8 @@ describe('ol.collection', function() {
});
describe('setAt', function() {
it('triggers remove', function() {
_ol_events_.listen(collection, _ol_CollectionEventType_.ADD, cb1);
_ol_events_.listen(collection, _ol_CollectionEventType_.REMOVE, cb2);
_ol_events_.listen(collection, CollectionEventType.ADD, cb1);
_ol_events_.listen(collection, CollectionEventType.REMOVE, cb2);
collection.setAt(0, 2);
expect(cb2.lastCall.args[0].element).to.eql(1);
expect(cb1.lastCall.args[0].element).to.eql(2);
@@ -270,7 +270,7 @@ describe('ol.collection', function() {
});
describe('pop', function() {
it('triggers remove', function() {
_ol_events_.listen(collection, _ol_CollectionEventType_.REMOVE, cb1);
_ol_events_.listen(collection, CollectionEventType.REMOVE, cb1);
collection.pop();
expect(cb1.lastCall.args[0].element).to.eql(1);
});
@@ -288,7 +288,7 @@ describe('ol.collection', function() {
it('fires events', function() {
var collection = new _ol_Collection_();
var elems = [];
_ol_events_.listen(collection, _ol_CollectionEventType_.ADD, function(e) {
_ol_events_.listen(collection, CollectionEventType.ADD, function(e) {
elems.push(e.element);
});
collection.extend([1, 2]);

View File

@@ -16,8 +16,8 @@ import {remove as removeTransform} from '../../../../src/ol/proj/transforms.js';
import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js';
import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js';
import _ol_style_Icon_ from '../../../../src/ol/style/Icon.js';
import _ol_style_IconAnchorUnits_ from '../../../../src/ol/style/IconAnchorUnits.js';
import _ol_style_IconOrigin_ from '../../../../src/ol/style/IconOrigin.js';
import IconAnchorUnits from '../../../../src/ol/style/IconAnchorUnits.js';
import IconOrigin from '../../../../src/ol/style/IconOrigin.js';
import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js';
import _ol_style_Style_ from '../../../../src/ol/style/Style.js';
import _ol_style_Text_ from '../../../../src/ol/style/Text.js';
@@ -1843,25 +1843,25 @@ describe('ol.format.KML', function() {
if (f.getId() == 1) {
expect(imageStyle.anchor_[0]).to.be(0.5);
expect(imageStyle.anchor_[1]).to.be(0.5);
expect(imageStyle.anchorOrigin_).to.be(_ol_style_IconOrigin_.BOTTOM_LEFT);
expect(imageStyle.anchorXUnits_).to.be(_ol_style_IconAnchorUnits_.FRACTION);
expect(imageStyle.anchorYUnits_).to.be(_ol_style_IconAnchorUnits_.FRACTION);
expect(imageStyle.anchorOrigin_).to.be(IconOrigin.BOTTOM_LEFT);
expect(imageStyle.anchorXUnits_).to.be(IconAnchorUnits.FRACTION);
expect(imageStyle.anchorYUnits_).to.be(IconAnchorUnits.FRACTION);
} else {
expect(imageStyle.anchor_[0]).to.be(5);
expect(imageStyle.anchor_[1]).to.be(5);
expect(imageStyle.anchorXUnits_).to.be(_ol_style_IconAnchorUnits_.PIXELS);
expect(imageStyle.anchorYUnits_).to.be(_ol_style_IconAnchorUnits_.PIXELS);
expect(imageStyle.anchorXUnits_).to.be(IconAnchorUnits.PIXELS);
expect(imageStyle.anchorYUnits_).to.be(IconAnchorUnits.PIXELS);
if (f.getId() == 2) {
expect(imageStyle.anchorOrigin_).to.be(_ol_style_IconOrigin_.BOTTOM_LEFT);
expect(imageStyle.anchorOrigin_).to.be(IconOrigin.BOTTOM_LEFT);
}
if (f.getId() == 3) {
expect(imageStyle.anchorOrigin_).to.be(_ol_style_IconOrigin_.BOTTOM_RIGHT);
expect(imageStyle.anchorOrigin_).to.be(IconOrigin.BOTTOM_RIGHT);
}
if (f.getId() == 4) {
expect(imageStyle.anchorOrigin_).to.be(_ol_style_IconOrigin_.TOP_LEFT);
expect(imageStyle.anchorOrigin_).to.be(IconOrigin.TOP_LEFT);
}
if (f.getId() == 5) {
expect(imageStyle.anchorOrigin_).to.be(_ol_style_IconOrigin_.TOP_RIGHT);
expect(imageStyle.anchorOrigin_).to.be(IconOrigin.TOP_RIGHT);
}
}
expect(imageStyle.getRotation()).to.eql(0);

View File

@@ -1,4 +1,4 @@
import _ol_layer_Heatmap_ from '../../../../src/ol/layer/Heatmap.js';
import HeatmapLayer from '../../../../src/ol/layer/Heatmap.js';
describe('ol.layer.Heatmap', function() {
@@ -6,8 +6,8 @@ describe('ol.layer.Heatmap', function() {
describe('constructor', function() {
it('can be constructed without arguments', function() {
var instance = new _ol_layer_Heatmap_();
expect(instance).to.be.an(_ol_layer_Heatmap_);
var instance = new HeatmapLayer();
expect(instance).to.be.an(HeatmapLayer);
});
});

View File

@@ -1,7 +1,7 @@
import _ol_Feature_ from '../../../src/ol/Feature.js';
import _ol_Map_ from '../../../src/ol/Map.js';
import MapEvent from '../../../src/ol/MapEvent.js';
import _ol_Overlay_ from '../../../src/ol/Overlay.js';
import Overlay from '../../../src/ol/Overlay.js';
import _ol_View_ from '../../../src/ol/View.js';
import Point from '../../../src/ol/geom/Point.js';
import _ol_has_ from '../../../src/ol/has.js';
@@ -610,7 +610,7 @@ describe('ol.Map', function() {
});
it('returns an overlay by id', function() {
overlay = new _ol_Overlay_({
overlay = new Overlay({
id: 'foo',
element: overlay_target,
position: [0, 0]
@@ -620,7 +620,7 @@ describe('ol.Map', function() {
});
it('returns null when no overlay is found', function() {
overlay = new _ol_Overlay_({
overlay = new Overlay({
id: 'foo',
element: overlay_target,
position: [0, 0]
@@ -630,7 +630,7 @@ describe('ol.Map', function() {
});
it('returns null after removing overlay', function() {
overlay = new _ol_Overlay_({
overlay = new Overlay({
id: 'foo',
element: overlay_target,
position: [0, 0]

View File

@@ -1,5 +1,5 @@
import _ol_Map_ from '../../../src/ol/Map.js';
import _ol_Overlay_ from '../../../src/ol/Overlay.js';
import Overlay from '../../../src/ol/Overlay.js';
import _ol_View_ from '../../../src/ol/View.js';
@@ -38,13 +38,13 @@ describe('ol.Overlay', function() {
describe('constructor', function() {
it('can be constructed with minimal arguments', function() {
var instance = new _ol_Overlay_({});
expect(instance).to.be.an(_ol_Overlay_);
var instance = new Overlay({});
expect(instance).to.be.an(Overlay);
});
it('can be constructed with className', function() {
var instance = new _ol_Overlay_({className: 'my-class'});
expect(instance).to.be.an(_ol_Overlay_);
var instance = new Overlay({className: 'my-class'});
expect(instance).to.be.an(Overlay);
expect(instance.element.className).to.be('my-class');
});
@@ -61,14 +61,14 @@ describe('ol.Overlay', function() {
});
it('returns the overlay identifier', function() {
overlay = new _ol_Overlay_({
overlay = new Overlay({
element: target,
position: [0, 0]
});
map.addOverlay(overlay);
expect(overlay.getId()).to.be(undefined);
map.removeOverlay(overlay);
overlay = new _ol_Overlay_({
overlay = new Overlay({
id: 'foo',
element: target,
position: [0, 0]
@@ -90,7 +90,7 @@ describe('ol.Overlay', function() {
});
it('changes the CSS display value', function() {
overlay = new _ol_Overlay_({
overlay = new Overlay({
element: target,
position: [0, 0]
});