@@ -1,7 +1,7 @@
|
|||||||
import _ol_Map_ from '../src/ol/Map.js';
|
import _ol_Map_ from '../src/ol/Map.js';
|
||||||
import _ol_View_ from '../src/ol/View.js';
|
import _ol_View_ from '../src/ol/View.js';
|
||||||
import KML from '../src/ol/format/KML.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_layer_Tile_ from '../src/ol/layer/Tile.js';
|
||||||
import _ol_source_Stamen_ from '../src/ol/source/Stamen.js';
|
import _ol_source_Stamen_ from '../src/ol/source/Stamen.js';
|
||||||
import _ol_source_Vector_ from '../src/ol/source/Vector.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 blur = document.getElementById('blur');
|
||||||
var radius = document.getElementById('radius');
|
var radius = document.getElementById('radius');
|
||||||
|
|
||||||
var vector = new _ol_layer_Heatmap_({
|
var vector = new HeatmapLayer({
|
||||||
source: new _ol_source_Vector_({
|
source: new _ol_source_Vector_({
|
||||||
url: 'data/kml/2012_Earthquakes_Mag5.kml',
|
url: 'data/kml/2012_Earthquakes_Mag5.kml',
|
||||||
format: new KML({
|
format: new KML({
|
||||||
|
|||||||
+16
-19
@@ -3,11 +3,20 @@
|
|||||||
*/
|
*/
|
||||||
import {inherits} from './index.js';
|
import {inherits} from './index.js';
|
||||||
import AssertionError from './AssertionError.js';
|
import AssertionError from './AssertionError.js';
|
||||||
import _ol_CollectionEventType_ from './CollectionEventType.js';
|
import CollectionEventType from './CollectionEventType.js';
|
||||||
import _ol_Object_ from './Object.js';
|
import _ol_Object_ from './Object.js';
|
||||||
import Event from './events/Event.js';
|
import Event from './events/Event.js';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @enum {string}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
var Property = {
|
||||||
|
LENGTH: 'length'
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {{unique: (boolean|undefined)}}
|
* @typedef {{unique: (boolean|undefined)}}
|
||||||
*/
|
*/
|
||||||
@@ -139,9 +148,7 @@ _ol_Collection_.prototype.item = function(index) {
|
|||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_Collection_.prototype.getLength = function() {
|
_ol_Collection_.prototype.getLength = function() {
|
||||||
return (
|
return (/** @type {number} */ this.get(Property.LENGTH));
|
||||||
/** @type {number} */ this.get(_ol_Collection_.Property_.LENGTH)
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -158,7 +165,7 @@ _ol_Collection_.prototype.insertAt = function(index, elem) {
|
|||||||
this.array_.splice(index, 0, elem);
|
this.array_.splice(index, 0, elem);
|
||||||
this.updateLength_();
|
this.updateLength_();
|
||||||
this.dispatchEvent(
|
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.array_.splice(index, 1);
|
||||||
this.updateLength_();
|
this.updateLength_();
|
||||||
this.dispatchEvent(
|
this.dispatchEvent(
|
||||||
new _ol_Collection_.Event(_ol_CollectionEventType_.REMOVE, prev));
|
new _ol_Collection_.Event(CollectionEventType.REMOVE, prev));
|
||||||
return prev;
|
return prev;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -239,9 +246,9 @@ _ol_Collection_.prototype.setAt = function(index, elem) {
|
|||||||
var prev = this.array_[index];
|
var prev = this.array_[index];
|
||||||
this.array_[index] = elem;
|
this.array_[index] = elem;
|
||||||
this.dispatchEvent(
|
this.dispatchEvent(
|
||||||
new _ol_Collection_.Event(_ol_CollectionEventType_.REMOVE, prev));
|
new _ol_Collection_.Event(CollectionEventType.REMOVE, prev));
|
||||||
this.dispatchEvent(
|
this.dispatchEvent(
|
||||||
new _ol_Collection_.Event(_ol_CollectionEventType_.ADD, elem));
|
new _ol_Collection_.Event(CollectionEventType.ADD, elem));
|
||||||
} else {
|
} else {
|
||||||
var j;
|
var j;
|
||||||
for (j = n; j < index; ++j) {
|
for (j = n; j < index; ++j) {
|
||||||
@@ -256,7 +263,7 @@ _ol_Collection_.prototype.setAt = function(index, elem) {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_Collection_.prototype.updateLength_ = function() {
|
_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
|
* @classdesc
|
||||||
* Events emitted by {@link ol.Collection} instances are instances of this
|
* Events emitted by {@link ol.Collection} instances are instances of this
|
||||||
|
|||||||
+7
-7
@@ -3,7 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
import {inherits} from './index.js';
|
import {inherits} from './index.js';
|
||||||
import _ol_ImageBase_ from './ImageBase.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 _ol_events_ from './events.js';
|
||||||
import EventType from './events/EventType.js';
|
import EventType from './events/EventType.js';
|
||||||
import {getHeight} from './extent.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) {
|
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
|
* @private
|
||||||
@@ -47,7 +47,7 @@ var _ol_Image_ = function(extent, resolution, pixelRatio, src, crossOrigin, imag
|
|||||||
* @protected
|
* @protected
|
||||||
* @type {ol.ImageState}
|
* @type {ol.ImageState}
|
||||||
*/
|
*/
|
||||||
this.state = _ol_ImageState_.IDLE;
|
this.state = ImageState.IDLE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -75,7 +75,7 @@ _ol_Image_.prototype.getImage = function() {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_Image_.prototype.handleImageError_ = function() {
|
_ol_Image_.prototype.handleImageError_ = function() {
|
||||||
this.state = _ol_ImageState_.ERROR;
|
this.state = ImageState.ERROR;
|
||||||
this.unlistenImage_();
|
this.unlistenImage_();
|
||||||
this.changed();
|
this.changed();
|
||||||
};
|
};
|
||||||
@@ -90,7 +90,7 @@ _ol_Image_.prototype.handleImageLoad_ = function() {
|
|||||||
if (this.resolution === undefined) {
|
if (this.resolution === undefined) {
|
||||||
this.resolution = getHeight(this.extent) / this.image_.height;
|
this.resolution = getHeight(this.extent) / this.image_.height;
|
||||||
}
|
}
|
||||||
this.state = _ol_ImageState_.LOADED;
|
this.state = ImageState.LOADED;
|
||||||
this.unlistenImage_();
|
this.unlistenImage_();
|
||||||
this.changed();
|
this.changed();
|
||||||
};
|
};
|
||||||
@@ -104,8 +104,8 @@ _ol_Image_.prototype.handleImageLoad_ = function() {
|
|||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_Image_.prototype.load = function() {
|
_ol_Image_.prototype.load = function() {
|
||||||
if (this.state == _ol_ImageState_.IDLE || this.state == _ol_ImageState_.ERROR) {
|
if (this.state == ImageState.IDLE || this.state == ImageState.ERROR) {
|
||||||
this.state = _ol_ImageState_.LOADING;
|
this.state = ImageState.LOADING;
|
||||||
this.changed();
|
this.changed();
|
||||||
this.imageListenerKeys_ = [
|
this.imageListenerKeys_ = [
|
||||||
_ol_events_.listenOnce(this.image_, EventType.ERROR,
|
_ol_events_.listenOnce(this.image_, EventType.ERROR,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
import {inherits} from './index.js';
|
import {inherits} from './index.js';
|
||||||
import _ol_ImageBase_ from './ImageBase.js';
|
import _ol_ImageBase_ from './ImageBase.js';
|
||||||
import _ol_ImageState_ from './ImageState.js';
|
import ImageState from './ImageState.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
@@ -24,8 +24,7 @@ var _ol_ImageCanvas_ = function(extent, resolution, pixelRatio, canvas, opt_load
|
|||||||
*/
|
*/
|
||||||
this.loader_ = opt_loader !== undefined ? opt_loader : null;
|
this.loader_ = opt_loader !== undefined ? opt_loader : null;
|
||||||
|
|
||||||
var state = opt_loader !== undefined ?
|
var state = opt_loader !== undefined ? ImageState.IDLE : ImageState.LOADED;
|
||||||
_ol_ImageState_.IDLE : _ol_ImageState_.LOADED;
|
|
||||||
|
|
||||||
_ol_ImageBase_.call(this, extent, resolution, pixelRatio, state);
|
_ol_ImageBase_.call(this, extent, resolution, pixelRatio, state);
|
||||||
|
|
||||||
@@ -63,9 +62,9 @@ _ol_ImageCanvas_.prototype.getError = function() {
|
|||||||
_ol_ImageCanvas_.prototype.handleLoad_ = function(err) {
|
_ol_ImageCanvas_.prototype.handleLoad_ = function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
this.error_ = err;
|
this.error_ = err;
|
||||||
this.state = _ol_ImageState_.ERROR;
|
this.state = ImageState.ERROR;
|
||||||
} else {
|
} else {
|
||||||
this.state = _ol_ImageState_.LOADED;
|
this.state = ImageState.LOADED;
|
||||||
}
|
}
|
||||||
this.changed();
|
this.changed();
|
||||||
};
|
};
|
||||||
@@ -75,8 +74,8 @@ _ol_ImageCanvas_.prototype.handleLoad_ = function(err) {
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
_ol_ImageCanvas_.prototype.load = function() {
|
_ol_ImageCanvas_.prototype.load = function() {
|
||||||
if (this.state == _ol_ImageState_.IDLE) {
|
if (this.state == ImageState.IDLE) {
|
||||||
this.state = _ol_ImageState_.LOADING;
|
this.state = ImageState.LOADING;
|
||||||
this.changed();
|
this.changed();
|
||||||
this.loader_(this.handleLoad_.bind(this));
|
this.loader_(this.handleLoad_.bind(this));
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -2,7 +2,7 @@
|
|||||||
* @module ol/Object
|
* @module ol/Object
|
||||||
*/
|
*/
|
||||||
import {getUid, inherits} from './index.js';
|
import {getUid, inherits} from './index.js';
|
||||||
import _ol_ObjectEventType_ from './ObjectEventType.js';
|
import ObjectEventType from './ObjectEventType.js';
|
||||||
import _ol_Observable_ from './Observable.js';
|
import _ol_Observable_ from './Observable.js';
|
||||||
import Event from './events/Event.js';
|
import Event from './events/Event.js';
|
||||||
import _ol_obj_ from './obj.js';
|
import _ol_obj_ from './obj.js';
|
||||||
@@ -136,7 +136,7 @@ _ol_Object_.prototype.notify = function(key, oldValue) {
|
|||||||
var eventType;
|
var eventType;
|
||||||
eventType = _ol_Object_.getChangeEventType(key);
|
eventType = _ol_Object_.getChangeEventType(key);
|
||||||
this.dispatchEvent(new _ol_Object_.Event(eventType, key, oldValue));
|
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));
|
this.dispatchEvent(new _ol_Object_.Event(eventType, key, oldValue));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+72
-80
@@ -2,14 +2,28 @@
|
|||||||
* @module ol/Overlay
|
* @module ol/Overlay
|
||||||
*/
|
*/
|
||||||
import {inherits} from './index.js';
|
import {inherits} from './index.js';
|
||||||
import _ol_MapEventType_ from './MapEventType.js';
|
import MapEventType from './MapEventType.js';
|
||||||
import _ol_Object_ from './Object.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 _ol_css_ from './css.js';
|
||||||
import {removeNode, removeChildren, outerWidth, outerHeight} from './dom.js';
|
import {removeNode, removeChildren, outerWidth, outerHeight} from './dom.js';
|
||||||
import _ol_events_ from './events.js';
|
import _ol_events_ from './events.js';
|
||||||
import {containsExtent} from './extent.js';
|
import {containsExtent} from './extent.js';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @enum {string}
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
var Property = {
|
||||||
|
ELEMENT: 'element',
|
||||||
|
MAP: 'map',
|
||||||
|
OFFSET: 'offset',
|
||||||
|
POSITION: 'position',
|
||||||
|
POSITIONING: 'positioning'
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @classdesc
|
* @classdesc
|
||||||
* An element to be displayed over the map and attached to a single map
|
* 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.
|
* @param {olx.OverlayOptions} options Overlay options.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
var _ol_Overlay_ = function(options) {
|
var Overlay = function(options) {
|
||||||
|
|
||||||
_ol_Object_.call(this);
|
_ol_Object_.call(this);
|
||||||
|
|
||||||
@@ -112,23 +126,23 @@ var _ol_Overlay_ = function(options) {
|
|||||||
this.mapPostrenderListenerKey = null;
|
this.mapPostrenderListenerKey = null;
|
||||||
|
|
||||||
_ol_events_.listen(
|
_ol_events_.listen(
|
||||||
this, _ol_Object_.getChangeEventType(_ol_Overlay_.Property.ELEMENT),
|
this, _ol_Object_.getChangeEventType(Property.ELEMENT),
|
||||||
this.handleElementChanged, this);
|
this.handleElementChanged, this);
|
||||||
|
|
||||||
_ol_events_.listen(
|
_ol_events_.listen(
|
||||||
this, _ol_Object_.getChangeEventType(_ol_Overlay_.Property.MAP),
|
this, _ol_Object_.getChangeEventType(Property.MAP),
|
||||||
this.handleMapChanged, this);
|
this.handleMapChanged, this);
|
||||||
|
|
||||||
_ol_events_.listen(
|
_ol_events_.listen(
|
||||||
this, _ol_Object_.getChangeEventType(_ol_Overlay_.Property.OFFSET),
|
this, _ol_Object_.getChangeEventType(Property.OFFSET),
|
||||||
this.handleOffsetChanged, this);
|
this.handleOffsetChanged, this);
|
||||||
|
|
||||||
_ol_events_.listen(
|
_ol_events_.listen(
|
||||||
this, _ol_Object_.getChangeEventType(_ol_Overlay_.Property.POSITION),
|
this, _ol_Object_.getChangeEventType(Property.POSITION),
|
||||||
this.handlePositionChanged, this);
|
this.handlePositionChanged, this);
|
||||||
|
|
||||||
_ol_events_.listen(
|
_ol_events_.listen(
|
||||||
this, _ol_Object_.getChangeEventType(_ol_Overlay_.Property.POSITIONING),
|
this, _ol_Object_.getChangeEventType(Property.POSITIONING),
|
||||||
this.handlePositioningChanged, this);
|
this.handlePositioningChanged, this);
|
||||||
|
|
||||||
if (options.element !== undefined) {
|
if (options.element !== undefined) {
|
||||||
@@ -139,7 +153,7 @@ var _ol_Overlay_ = function(options) {
|
|||||||
|
|
||||||
this.setPositioning(options.positioning !== undefined ?
|
this.setPositioning(options.positioning !== undefined ?
|
||||||
/** @type {ol.OverlayPositioning} */ (options.positioning) :
|
/** @type {ol.OverlayPositioning} */ (options.positioning) :
|
||||||
_ol_OverlayPositioning_.TOP_LEFT);
|
OverlayPositioning.TOP_LEFT);
|
||||||
|
|
||||||
if (options.position !== undefined) {
|
if (options.position !== undefined) {
|
||||||
this.setPosition(options.position);
|
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
|
* @observable
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_Overlay_.prototype.getElement = function() {
|
Overlay.prototype.getElement = function() {
|
||||||
return (
|
return (/** @type {Element|undefined} */ this.get(Property.ELEMENT));
|
||||||
/** @type {Element|undefined} */ this.get(_ol_Overlay_.Property.ELEMENT)
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -168,7 +180,7 @@ _ol_Overlay_.prototype.getElement = function() {
|
|||||||
* @return {number|string|undefined} Id.
|
* @return {number|string|undefined} Id.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_Overlay_.prototype.getId = function() {
|
Overlay.prototype.getId = function() {
|
||||||
return this.id;
|
return this.id;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -179,10 +191,8 @@ _ol_Overlay_.prototype.getId = function() {
|
|||||||
* @observable
|
* @observable
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_Overlay_.prototype.getMap = function() {
|
Overlay.prototype.getMap = function() {
|
||||||
return (
|
return (/** @type {ol.PluggableMap|undefined} */ this.get(Property.MAP));
|
||||||
/** @type {ol.PluggableMap|undefined} */ this.get(_ol_Overlay_.Property.MAP)
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -192,10 +202,8 @@ _ol_Overlay_.prototype.getMap = function() {
|
|||||||
* @observable
|
* @observable
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_Overlay_.prototype.getOffset = function() {
|
Overlay.prototype.getOffset = function() {
|
||||||
return (
|
return (/** @type {Array.<number>} */ this.get(Property.OFFSET));
|
||||||
/** @type {Array.<number>} */ this.get(_ol_Overlay_.Property.OFFSET)
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -206,10 +214,8 @@ _ol_Overlay_.prototype.getOffset = function() {
|
|||||||
* @observable
|
* @observable
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_Overlay_.prototype.getPosition = function() {
|
Overlay.prototype.getPosition = function() {
|
||||||
return (
|
return (/** @type {ol.Coordinate|undefined} */ this.get(Property.POSITION));
|
||||||
/** @type {ol.Coordinate|undefined} */ this.get(_ol_Overlay_.Property.POSITION)
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -220,17 +226,15 @@ _ol_Overlay_.prototype.getPosition = function() {
|
|||||||
* @observable
|
* @observable
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_Overlay_.prototype.getPositioning = function() {
|
Overlay.prototype.getPositioning = function() {
|
||||||
return (
|
return (/** @type {ol.OverlayPositioning} */ this.get(Property.POSITIONING));
|
||||||
/** @type {ol.OverlayPositioning} */ this.get(_ol_Overlay_.Property.POSITIONING)
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
_ol_Overlay_.prototype.handleElementChanged = function() {
|
Overlay.prototype.handleElementChanged = function() {
|
||||||
removeChildren(this.element);
|
removeChildren(this.element);
|
||||||
var element = this.getElement();
|
var element = this.getElement();
|
||||||
if (element) {
|
if (element) {
|
||||||
@@ -242,7 +246,7 @@ _ol_Overlay_.prototype.handleElementChanged = function() {
|
|||||||
/**
|
/**
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
_ol_Overlay_.prototype.handleMapChanged = function() {
|
Overlay.prototype.handleMapChanged = function() {
|
||||||
if (this.mapPostrenderListenerKey) {
|
if (this.mapPostrenderListenerKey) {
|
||||||
removeNode(this.element);
|
removeNode(this.element);
|
||||||
_ol_events_.unlistenByKey(this.mapPostrenderListenerKey);
|
_ol_events_.unlistenByKey(this.mapPostrenderListenerKey);
|
||||||
@@ -251,7 +255,7 @@ _ol_Overlay_.prototype.handleMapChanged = function() {
|
|||||||
var map = this.getMap();
|
var map = this.getMap();
|
||||||
if (map) {
|
if (map) {
|
||||||
this.mapPostrenderListenerKey = _ol_events_.listen(map,
|
this.mapPostrenderListenerKey = _ol_events_.listen(map,
|
||||||
_ol_MapEventType_.POSTRENDER, this.render, this);
|
MapEventType.POSTRENDER, this.render, this);
|
||||||
this.updatePixelPosition();
|
this.updatePixelPosition();
|
||||||
var container = this.stopEvent ?
|
var container = this.stopEvent ?
|
||||||
map.getOverlayContainerStopEvent() : map.getOverlayContainer();
|
map.getOverlayContainerStopEvent() : map.getOverlayContainer();
|
||||||
@@ -267,7 +271,7 @@ _ol_Overlay_.prototype.handleMapChanged = function() {
|
|||||||
/**
|
/**
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
_ol_Overlay_.prototype.render = function() {
|
Overlay.prototype.render = function() {
|
||||||
this.updatePixelPosition();
|
this.updatePixelPosition();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -275,7 +279,7 @@ _ol_Overlay_.prototype.render = function() {
|
|||||||
/**
|
/**
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
_ol_Overlay_.prototype.handleOffsetChanged = function() {
|
Overlay.prototype.handleOffsetChanged = function() {
|
||||||
this.updatePixelPosition();
|
this.updatePixelPosition();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -283,9 +287,9 @@ _ol_Overlay_.prototype.handleOffsetChanged = function() {
|
|||||||
/**
|
/**
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
_ol_Overlay_.prototype.handlePositionChanged = function() {
|
Overlay.prototype.handlePositionChanged = function() {
|
||||||
this.updatePixelPosition();
|
this.updatePixelPosition();
|
||||||
if (this.get(_ol_Overlay_.Property.POSITION) && this.autoPan) {
|
if (this.get(Property.POSITION) && this.autoPan) {
|
||||||
this.panIntoView();
|
this.panIntoView();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -294,7 +298,7 @@ _ol_Overlay_.prototype.handlePositionChanged = function() {
|
|||||||
/**
|
/**
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
_ol_Overlay_.prototype.handlePositioningChanged = function() {
|
Overlay.prototype.handlePositioningChanged = function() {
|
||||||
this.updatePixelPosition();
|
this.updatePixelPosition();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -305,8 +309,8 @@ _ol_Overlay_.prototype.handlePositioningChanged = function() {
|
|||||||
* @observable
|
* @observable
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_Overlay_.prototype.setElement = function(element) {
|
Overlay.prototype.setElement = function(element) {
|
||||||
this.set(_ol_Overlay_.Property.ELEMENT, element);
|
this.set(Property.ELEMENT, element);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -316,8 +320,8 @@ _ol_Overlay_.prototype.setElement = function(element) {
|
|||||||
* @observable
|
* @observable
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_Overlay_.prototype.setMap = function(map) {
|
Overlay.prototype.setMap = function(map) {
|
||||||
this.set(_ol_Overlay_.Property.MAP, map);
|
this.set(Property.MAP, map);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -327,8 +331,8 @@ _ol_Overlay_.prototype.setMap = function(map) {
|
|||||||
* @observable
|
* @observable
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_Overlay_.prototype.setOffset = function(offset) {
|
Overlay.prototype.setOffset = function(offset) {
|
||||||
this.set(_ol_Overlay_.Property.OFFSET, offset);
|
this.set(Property.OFFSET, offset);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -340,8 +344,8 @@ _ol_Overlay_.prototype.setOffset = function(offset) {
|
|||||||
* @observable
|
* @observable
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_Overlay_.prototype.setPosition = function(position) {
|
Overlay.prototype.setPosition = function(position) {
|
||||||
this.set(_ol_Overlay_.Property.POSITION, position);
|
this.set(Property.POSITION, position);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -350,7 +354,7 @@ _ol_Overlay_.prototype.setPosition = function(position) {
|
|||||||
* (if necessary).
|
* (if necessary).
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
_ol_Overlay_.prototype.panIntoView = function() {
|
Overlay.prototype.panIntoView = function() {
|
||||||
var map = this.getMap();
|
var map = this.getMap();
|
||||||
|
|
||||||
if (!map || !map.getTargetElement()) {
|
if (!map || !map.getTargetElement()) {
|
||||||
@@ -410,7 +414,7 @@ _ol_Overlay_.prototype.panIntoView = function() {
|
|||||||
* @return {ol.Extent} The extent.
|
* @return {ol.Extent} The extent.
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
_ol_Overlay_.prototype.getRect = function(element, size) {
|
Overlay.prototype.getRect = function(element, size) {
|
||||||
var box = element.getBoundingClientRect();
|
var box = element.getBoundingClientRect();
|
||||||
var offsetX = box.left + window.pageXOffset;
|
var offsetX = box.left + window.pageXOffset;
|
||||||
var offsetY = box.top + window.pageYOffset;
|
var offsetY = box.top + window.pageYOffset;
|
||||||
@@ -430,8 +434,8 @@ _ol_Overlay_.prototype.getRect = function(element, size) {
|
|||||||
* @observable
|
* @observable
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_Overlay_.prototype.setPositioning = function(positioning) {
|
Overlay.prototype.setPositioning = function(positioning) {
|
||||||
this.set(_ol_Overlay_.Property.POSITIONING, positioning);
|
this.set(Property.POSITIONING, positioning);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -440,7 +444,7 @@ _ol_Overlay_.prototype.setPositioning = function(positioning) {
|
|||||||
* @param {boolean} visible Element visibility.
|
* @param {boolean} visible Element visibility.
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
_ol_Overlay_.prototype.setVisible = function(visible) {
|
Overlay.prototype.setVisible = function(visible) {
|
||||||
if (this.rendered.visible !== visible) {
|
if (this.rendered.visible !== visible) {
|
||||||
this.element.style.display = visible ? '' : 'none';
|
this.element.style.display = visible ? '' : 'none';
|
||||||
this.rendered.visible = visible;
|
this.rendered.visible = visible;
|
||||||
@@ -452,7 +456,7 @@ _ol_Overlay_.prototype.setVisible = function(visible) {
|
|||||||
* Update pixel position.
|
* Update pixel position.
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
_ol_Overlay_.prototype.updatePixelPosition = function() {
|
Overlay.prototype.updatePixelPosition = function() {
|
||||||
var map = this.getMap();
|
var map = this.getMap();
|
||||||
var position = this.getPosition();
|
var position = this.getPosition();
|
||||||
if (!map || !map.isRendered() || !position) {
|
if (!map || !map.isRendered() || !position) {
|
||||||
@@ -471,7 +475,7 @@ _ol_Overlay_.prototype.updatePixelPosition = function() {
|
|||||||
* @param {ol.Size|undefined} mapSize The map size.
|
* @param {ol.Size|undefined} mapSize The map size.
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
_ol_Overlay_.prototype.updateRenderedPosition = function(pixel, mapSize) {
|
Overlay.prototype.updateRenderedPosition = function(pixel, mapSize) {
|
||||||
var style = this.element.style;
|
var style = this.element.style;
|
||||||
var offset = this.getOffset();
|
var offset = this.getOffset();
|
||||||
|
|
||||||
@@ -481,9 +485,9 @@ _ol_Overlay_.prototype.updateRenderedPosition = function(pixel, mapSize) {
|
|||||||
|
|
||||||
var offsetX = offset[0];
|
var offsetX = offset[0];
|
||||||
var offsetY = offset[1];
|
var offsetY = offset[1];
|
||||||
if (positioning == _ol_OverlayPositioning_.BOTTOM_RIGHT ||
|
if (positioning == OverlayPositioning.BOTTOM_RIGHT ||
|
||||||
positioning == _ol_OverlayPositioning_.CENTER_RIGHT ||
|
positioning == OverlayPositioning.CENTER_RIGHT ||
|
||||||
positioning == _ol_OverlayPositioning_.TOP_RIGHT) {
|
positioning == OverlayPositioning.TOP_RIGHT) {
|
||||||
if (this.rendered.left_ !== '') {
|
if (this.rendered.left_ !== '') {
|
||||||
this.rendered.left_ = style.left = '';
|
this.rendered.left_ = style.left = '';
|
||||||
}
|
}
|
||||||
@@ -495,9 +499,9 @@ _ol_Overlay_.prototype.updateRenderedPosition = function(pixel, mapSize) {
|
|||||||
if (this.rendered.right_ !== '') {
|
if (this.rendered.right_ !== '') {
|
||||||
this.rendered.right_ = style.right = '';
|
this.rendered.right_ = style.right = '';
|
||||||
}
|
}
|
||||||
if (positioning == _ol_OverlayPositioning_.BOTTOM_CENTER ||
|
if (positioning == OverlayPositioning.BOTTOM_CENTER ||
|
||||||
positioning == _ol_OverlayPositioning_.CENTER_CENTER ||
|
positioning == OverlayPositioning.CENTER_CENTER ||
|
||||||
positioning == _ol_OverlayPositioning_.TOP_CENTER) {
|
positioning == OverlayPositioning.TOP_CENTER) {
|
||||||
offsetX -= this.element.offsetWidth / 2;
|
offsetX -= this.element.offsetWidth / 2;
|
||||||
}
|
}
|
||||||
var left = Math.round(pixel[0] + offsetX) + 'px';
|
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;
|
this.rendered.left_ = style.left = left;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (positioning == _ol_OverlayPositioning_.BOTTOM_LEFT ||
|
if (positioning == OverlayPositioning.BOTTOM_LEFT ||
|
||||||
positioning == _ol_OverlayPositioning_.BOTTOM_CENTER ||
|
positioning == OverlayPositioning.BOTTOM_CENTER ||
|
||||||
positioning == _ol_OverlayPositioning_.BOTTOM_RIGHT) {
|
positioning == OverlayPositioning.BOTTOM_RIGHT) {
|
||||||
if (this.rendered.top_ !== '') {
|
if (this.rendered.top_ !== '') {
|
||||||
this.rendered.top_ = style.top = '';
|
this.rendered.top_ = style.top = '';
|
||||||
}
|
}
|
||||||
@@ -519,9 +523,9 @@ _ol_Overlay_.prototype.updateRenderedPosition = function(pixel, mapSize) {
|
|||||||
if (this.rendered.bottom_ !== '') {
|
if (this.rendered.bottom_ !== '') {
|
||||||
this.rendered.bottom_ = style.bottom = '';
|
this.rendered.bottom_ = style.bottom = '';
|
||||||
}
|
}
|
||||||
if (positioning == _ol_OverlayPositioning_.CENTER_LEFT ||
|
if (positioning == OverlayPositioning.CENTER_LEFT ||
|
||||||
positioning == _ol_OverlayPositioning_.CENTER_CENTER ||
|
positioning == OverlayPositioning.CENTER_CENTER ||
|
||||||
positioning == _ol_OverlayPositioning_.CENTER_RIGHT) {
|
positioning == OverlayPositioning.CENTER_RIGHT) {
|
||||||
offsetY -= this.element.offsetHeight / 2;
|
offsetY -= this.element.offsetHeight / 2;
|
||||||
}
|
}
|
||||||
var top = Math.round(pixel[1] + offsetY) + 'px';
|
var top = Math.round(pixel[1] + offsetY) + 'px';
|
||||||
@@ -537,20 +541,8 @@ _ol_Overlay_.prototype.updateRenderedPosition = function(pixel, mapSize) {
|
|||||||
* @public
|
* @public
|
||||||
* @return {olx.OverlayOptions} overlay options
|
* @return {olx.OverlayOptions} overlay options
|
||||||
*/
|
*/
|
||||||
_ol_Overlay_.prototype.getOptions = function() {
|
Overlay.prototype.getOptions = function() {
|
||||||
return this.options;
|
return this.options;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default Overlay;
|
||||||
/**
|
|
||||||
* @enum {string}
|
|
||||||
* @protected
|
|
||||||
*/
|
|
||||||
_ol_Overlay_.Property = {
|
|
||||||
ELEMENT: 'element',
|
|
||||||
MAP: 'map',
|
|
||||||
OFFSET: 'offset',
|
|
||||||
POSITION: 'position',
|
|
||||||
POSITIONING: 'positioning'
|
|
||||||
};
|
|
||||||
export default _ol_Overlay_;
|
|
||||||
|
|||||||
+14
-14
@@ -3,15 +3,15 @@
|
|||||||
*/
|
*/
|
||||||
import {getUid, inherits} from './index.js';
|
import {getUid, inherits} from './index.js';
|
||||||
import _ol_Collection_ from './Collection.js';
|
import _ol_Collection_ from './Collection.js';
|
||||||
import _ol_CollectionEventType_ from './CollectionEventType.js';
|
import CollectionEventType from './CollectionEventType.js';
|
||||||
import MapBrowserEvent from './MapBrowserEvent.js';
|
import MapBrowserEvent from './MapBrowserEvent.js';
|
||||||
import MapBrowserEventHandler from './MapBrowserEventHandler.js';
|
import MapBrowserEventHandler from './MapBrowserEventHandler.js';
|
||||||
import MapBrowserEventType from './MapBrowserEventType.js';
|
import MapBrowserEventType from './MapBrowserEventType.js';
|
||||||
import MapEvent from './MapEvent.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_MapProperty_ from './MapProperty.js';
|
||||||
import _ol_Object_ from './Object.js';
|
import _ol_Object_ from './Object.js';
|
||||||
import _ol_ObjectEventType_ from './ObjectEventType.js';
|
import ObjectEventType from './ObjectEventType.js';
|
||||||
import TileQueue from './TileQueue.js';
|
import TileQueue from './TileQueue.js';
|
||||||
import _ol_View_ from './View.js';
|
import _ol_View_ from './View.js';
|
||||||
import _ol_ViewHint_ from './ViewHint.js';
|
import _ol_ViewHint_ from './ViewHint.js';
|
||||||
@@ -359,7 +359,7 @@ var _ol_PluggableMap_ = function(options) {
|
|||||||
control.setMap(this);
|
control.setMap(this);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
_ol_events_.listen(this.controls, _ol_CollectionEventType_.ADD,
|
_ol_events_.listen(this.controls, CollectionEventType.ADD,
|
||||||
/**
|
/**
|
||||||
* @param {ol.Collection.Event} event Collection event.
|
* @param {ol.Collection.Event} event Collection event.
|
||||||
*/
|
*/
|
||||||
@@ -367,7 +367,7 @@ var _ol_PluggableMap_ = function(options) {
|
|||||||
event.element.setMap(this);
|
event.element.setMap(this);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
_ol_events_.listen(this.controls, _ol_CollectionEventType_.REMOVE,
|
_ol_events_.listen(this.controls, CollectionEventType.REMOVE,
|
||||||
/**
|
/**
|
||||||
* @param {ol.Collection.Event} event Collection event.
|
* @param {ol.Collection.Event} event Collection event.
|
||||||
*/
|
*/
|
||||||
@@ -384,7 +384,7 @@ var _ol_PluggableMap_ = function(options) {
|
|||||||
interaction.setMap(this);
|
interaction.setMap(this);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
_ol_events_.listen(this.interactions, _ol_CollectionEventType_.ADD,
|
_ol_events_.listen(this.interactions, CollectionEventType.ADD,
|
||||||
/**
|
/**
|
||||||
* @param {ol.Collection.Event} event Collection event.
|
* @param {ol.Collection.Event} event Collection event.
|
||||||
*/
|
*/
|
||||||
@@ -392,7 +392,7 @@ var _ol_PluggableMap_ = function(options) {
|
|||||||
event.element.setMap(this);
|
event.element.setMap(this);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
_ol_events_.listen(this.interactions, _ol_CollectionEventType_.REMOVE,
|
_ol_events_.listen(this.interactions, CollectionEventType.REMOVE,
|
||||||
/**
|
/**
|
||||||
* @param {ol.Collection.Event} event Collection event.
|
* @param {ol.Collection.Event} event Collection event.
|
||||||
*/
|
*/
|
||||||
@@ -402,7 +402,7 @@ var _ol_PluggableMap_ = function(options) {
|
|||||||
|
|
||||||
this.overlays_.forEach(this.addOverlayInternal_, this);
|
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.
|
* @param {ol.Collection.Event} event Collection event.
|
||||||
*/
|
*/
|
||||||
@@ -410,7 +410,7 @@ var _ol_PluggableMap_ = function(options) {
|
|||||||
this.addOverlayInternal_(/** @type {ol.Overlay} */ (event.element));
|
this.addOverlayInternal_(/** @type {ol.Overlay} */ (event.element));
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
_ol_events_.listen(this.overlays_, _ol_CollectionEventType_.REMOVE,
|
_ol_events_.listen(this.overlays_, CollectionEventType.REMOVE,
|
||||||
/**
|
/**
|
||||||
* @param {ol.Collection.Event} event Collection event.
|
* @param {ol.Collection.Event} event Collection event.
|
||||||
*/
|
*/
|
||||||
@@ -1072,7 +1072,7 @@ _ol_PluggableMap_.prototype.handleViewChanged_ = function() {
|
|||||||
if (view) {
|
if (view) {
|
||||||
this.viewport_.setAttribute('data-view', getUid(view));
|
this.viewport_.setAttribute('data-view', getUid(view));
|
||||||
this.viewPropertyListenerKey_ = _ol_events_.listen(
|
this.viewPropertyListenerKey_ = _ol_events_.listen(
|
||||||
view, _ol_ObjectEventType_.PROPERTYCHANGE,
|
view, ObjectEventType.PROPERTYCHANGE,
|
||||||
this.handleViewPropertyChanged_, this);
|
this.handleViewPropertyChanged_, this);
|
||||||
this.viewChangeListenerKey_ = _ol_events_.listen(
|
this.viewChangeListenerKey_ = _ol_events_.listen(
|
||||||
view, EventType.CHANGE,
|
view, EventType.CHANGE,
|
||||||
@@ -1094,7 +1094,7 @@ _ol_PluggableMap_.prototype.handleLayerGroupChanged_ = function() {
|
|||||||
if (layerGroup) {
|
if (layerGroup) {
|
||||||
this.layerGroupPropertyListenerKeys_ = [
|
this.layerGroupPropertyListenerKeys_ = [
|
||||||
_ol_events_.listen(
|
_ol_events_.listen(
|
||||||
layerGroup, _ol_ObjectEventType_.PROPERTYCHANGE,
|
layerGroup, ObjectEventType.PROPERTYCHANGE,
|
||||||
this.render, this),
|
this.render, this),
|
||||||
_ol_events_.listen(
|
_ol_events_.listen(
|
||||||
layerGroup, EventType.CHANGE,
|
layerGroup, EventType.CHANGE,
|
||||||
@@ -1254,7 +1254,7 @@ _ol_PluggableMap_.prototype.renderFrame_ = function(time) {
|
|||||||
!equals(frameState.extent, this.previousExtent_));
|
!equals(frameState.extent, this.previousExtent_));
|
||||||
if (moveStart) {
|
if (moveStart) {
|
||||||
this.dispatchEvent(
|
this.dispatchEvent(
|
||||||
new MapEvent(_ol_MapEventType_.MOVESTART, this, previousFrameState));
|
new MapEvent(MapEventType.MOVESTART, this, previousFrameState));
|
||||||
this.previousExtent_ = createOrUpdateEmpty(this.previousExtent_);
|
this.previousExtent_ = createOrUpdateEmpty(this.previousExtent_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1266,13 +1266,13 @@ _ol_PluggableMap_.prototype.renderFrame_ = function(time) {
|
|||||||
|
|
||||||
if (idle) {
|
if (idle) {
|
||||||
this.dispatchEvent(
|
this.dispatchEvent(
|
||||||
new MapEvent(_ol_MapEventType_.MOVEEND, this, frameState));
|
new MapEvent(MapEventType.MOVEEND, this, frameState));
|
||||||
clone(frameState.extent, this.previousExtent_);
|
clone(frameState.extent, this.previousExtent_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.dispatchEvent(
|
this.dispatchEvent(
|
||||||
new MapEvent(_ol_MapEventType_.POSTRENDER, this, frameState));
|
new MapEvent(MapEventType.POSTRENDER, this, frameState));
|
||||||
|
|
||||||
setTimeout(this.handlePostRender.bind(this), 0);
|
setTimeout(this.handlePostRender.bind(this), 0);
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* @module ol/control/Control
|
* @module ol/control/Control
|
||||||
*/
|
*/
|
||||||
import {inherits, nullFunction} from '../index.js';
|
import {inherits, nullFunction} from '../index.js';
|
||||||
import _ol_MapEventType_ from '../MapEventType.js';
|
import MapEventType from '../MapEventType.js';
|
||||||
import _ol_Object_ from '../Object.js';
|
import _ol_Object_ from '../Object.js';
|
||||||
import {removeNode} from '../dom.js';
|
import {removeNode} from '../dom.js';
|
||||||
import _ol_events_ from '../events.js';
|
import _ol_events_ from '../events.js';
|
||||||
@@ -120,7 +120,7 @@ Control.prototype.setMap = function(map) {
|
|||||||
target.appendChild(this.element);
|
target.appendChild(this.element);
|
||||||
if (this.render !== nullFunction) {
|
if (this.render !== nullFunction) {
|
||||||
this.listenerKeys.push(_ol_events_.listen(map,
|
this.listenerKeys.push(_ol_events_.listen(map,
|
||||||
_ol_MapEventType_.POSTRENDER, this.render, this));
|
MapEventType.POSTRENDER, this.render, this));
|
||||||
}
|
}
|
||||||
map.render();
|
map.render();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,12 +4,12 @@
|
|||||||
import {inherits} from '../index.js';
|
import {inherits} from '../index.js';
|
||||||
import _ol_Collection_ from '../Collection.js';
|
import _ol_Collection_ from '../Collection.js';
|
||||||
import _ol_PluggableMap_ from '../PluggableMap.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_MapProperty_ from '../MapProperty.js';
|
||||||
import _ol_Object_ from '../Object.js';
|
import _ol_Object_ from '../Object.js';
|
||||||
import _ol_ObjectEventType_ from '../ObjectEventType.js';
|
import ObjectEventType from '../ObjectEventType.js';
|
||||||
import _ol_Overlay_ from '../Overlay.js';
|
import Overlay from '../Overlay.js';
|
||||||
import _ol_OverlayPositioning_ from '../OverlayPositioning.js';
|
import OverlayPositioning from '../OverlayPositioning.js';
|
||||||
import _ol_ViewProperty_ from '../ViewProperty.js';
|
import _ol_ViewProperty_ from '../ViewProperty.js';
|
||||||
import Control from '../control/Control.js';
|
import Control from '../control/Control.js';
|
||||||
import _ol_coordinate_ from '../coordinate.js';
|
import _ol_coordinate_ from '../coordinate.js';
|
||||||
@@ -140,9 +140,9 @@ var OverviewMap = function(opt_options) {
|
|||||||
* @type {ol.Overlay}
|
* @type {ol.Overlay}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.boxOverlay_ = new _ol_Overlay_({
|
this.boxOverlay_ = new Overlay({
|
||||||
position: [0, 0],
|
position: [0, 0],
|
||||||
positioning: _ol_OverlayPositioning_.BOTTOM_LEFT,
|
positioning: OverlayPositioning.BOTTOM_LEFT,
|
||||||
element: box
|
element: box
|
||||||
});
|
});
|
||||||
this.ovmap_.addOverlay(this.boxOverlay_);
|
this.ovmap_.addOverlay(this.boxOverlay_);
|
||||||
@@ -227,7 +227,7 @@ OverviewMap.prototype.setMap = function(map) {
|
|||||||
if (map) {
|
if (map) {
|
||||||
this.ovmap_.setTarget(this.ovmapDiv_);
|
this.ovmap_.setTarget(this.ovmapDiv_);
|
||||||
this.listenerKeys.push(_ol_events_.listen(
|
this.listenerKeys.push(_ol_events_.listen(
|
||||||
map, _ol_ObjectEventType_.PROPERTYCHANGE,
|
map, ObjectEventType.PROPERTYCHANGE,
|
||||||
this.handleMapPropertyChange_, this));
|
this.handleMapPropertyChange_, this));
|
||||||
|
|
||||||
// TODO: to really support map switching, this would need to be reworked
|
// 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()) {
|
if (!this.collapsed_ && !ovmap.isRendered()) {
|
||||||
ovmap.updateSize();
|
ovmap.updateSize();
|
||||||
this.resetExtent_();
|
this.resetExtent_();
|
||||||
_ol_events_.listenOnce(ovmap, _ol_MapEventType_.POSTRENDER,
|
_ol_events_.listenOnce(ovmap, MapEventType.POSTRENDER,
|
||||||
function(event) {
|
function(event) {
|
||||||
this.updateBox_();
|
this.updateBox_();
|
||||||
},
|
},
|
||||||
|
|||||||
+18
-20
@@ -22,8 +22,8 @@ import _ol_math_ from '../math.js';
|
|||||||
import {get as getProjection} from '../proj.js';
|
import {get as getProjection} from '../proj.js';
|
||||||
import _ol_style_Fill_ from '../style/Fill.js';
|
import _ol_style_Fill_ from '../style/Fill.js';
|
||||||
import _ol_style_Icon_ from '../style/Icon.js';
|
import _ol_style_Icon_ from '../style/Icon.js';
|
||||||
import _ol_style_IconAnchorUnits_ from '../style/IconAnchorUnits.js';
|
import IconAnchorUnits from '../style/IconAnchorUnits.js';
|
||||||
import _ol_style_IconOrigin_ from '../style/IconOrigin.js';
|
import IconOrigin from '../style/IconOrigin.js';
|
||||||
import _ol_style_Stroke_ from '../style/Stroke.js';
|
import _ol_style_Stroke_ from '../style/Stroke.js';
|
||||||
import _ol_style_Style_ from '../style/Style.js';
|
import _ol_style_Style_ from '../style/Style.js';
|
||||||
import _ol_style_Text_ from '../style/Text.js';
|
import _ol_style_Text_ from '../style/Text.js';
|
||||||
@@ -161,16 +161,14 @@ KML.createStyleDefaults_ = function() {
|
|||||||
* @type {ol.style.IconAnchorUnits}
|
* @type {ol.style.IconAnchorUnits}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
KML.DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS_ =
|
KML.DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS_ = IconAnchorUnits.PIXELS;
|
||||||
_ol_style_IconAnchorUnits_.PIXELS;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @const
|
* @const
|
||||||
* @type {ol.style.IconAnchorUnits}
|
* @type {ol.style.IconAnchorUnits}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
KML.DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS_ =
|
KML.DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS_ = IconAnchorUnits.PIXELS;
|
||||||
_ol_style_IconAnchorUnits_.PIXELS;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @const
|
* @const
|
||||||
@@ -201,7 +199,7 @@ KML.createStyleDefaults_ = function() {
|
|||||||
*/
|
*/
|
||||||
KML.DEFAULT_IMAGE_STYLE_ = new _ol_style_Icon_({
|
KML.DEFAULT_IMAGE_STYLE_ = new _ol_style_Icon_({
|
||||||
anchor: KML.DEFAULT_IMAGE_STYLE_ANCHOR_,
|
anchor: KML.DEFAULT_IMAGE_STYLE_ANCHOR_,
|
||||||
anchorOrigin: _ol_style_IconOrigin_.BOTTOM_LEFT,
|
anchorOrigin: IconOrigin.BOTTOM_LEFT,
|
||||||
anchorXUnits: KML.DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS_,
|
anchorXUnits: KML.DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS_,
|
||||||
anchorYUnits: KML.DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS_,
|
anchorYUnits: KML.DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS_,
|
||||||
crossOrigin: 'anonymous',
|
crossOrigin: 'anonymous',
|
||||||
@@ -280,9 +278,9 @@ KML.createStyleDefaults_ = function() {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
KML.ICON_ANCHOR_UNITS_MAP_ = {
|
KML.ICON_ANCHOR_UNITS_MAP_ = {
|
||||||
'fraction': _ol_style_IconAnchorUnits_.FRACTION,
|
'fraction': IconAnchorUnits.FRACTION,
|
||||||
'pixels': _ol_style_IconAnchorUnits_.PIXELS,
|
'pixels': IconAnchorUnits.PIXELS,
|
||||||
'insetPixels': _ol_style_IconAnchorUnits_.PIXELS
|
'insetPixels': IconAnchorUnits.PIXELS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -509,15 +507,15 @@ KML.readVec2_ = function(node) {
|
|||||||
var origin;
|
var origin;
|
||||||
if (xunits !== 'insetPixels') {
|
if (xunits !== 'insetPixels') {
|
||||||
if (yunits !== 'insetPixels') {
|
if (yunits !== 'insetPixels') {
|
||||||
origin = _ol_style_IconOrigin_.BOTTOM_LEFT;
|
origin = IconOrigin.BOTTOM_LEFT;
|
||||||
} else {
|
} else {
|
||||||
origin = _ol_style_IconOrigin_.TOP_LEFT;
|
origin = IconOrigin.TOP_LEFT;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (yunits !== 'insetPixels') {
|
if (yunits !== 'insetPixels') {
|
||||||
origin = _ol_style_IconOrigin_.BOTTOM_RIGHT;
|
origin = IconOrigin.BOTTOM_RIGHT;
|
||||||
} else {
|
} else {
|
||||||
origin = _ol_style_IconOrigin_.TOP_RIGHT;
|
origin = IconOrigin.TOP_RIGHT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
@@ -579,7 +577,7 @@ KML.IconStyleParser_ = function(node, objectStack) {
|
|||||||
src = KML.DEFAULT_IMAGE_STYLE_SRC_;
|
src = KML.DEFAULT_IMAGE_STYLE_SRC_;
|
||||||
}
|
}
|
||||||
var anchor, anchorXUnits, anchorYUnits;
|
var anchor, anchorXUnits, anchorYUnits;
|
||||||
var anchorOrigin = _ol_style_IconOrigin_.BOTTOM_LEFT;
|
var anchorOrigin = IconOrigin.BOTTOM_LEFT;
|
||||||
var hotSpot = /** @type {ol.KMLVec2_|undefined} */
|
var hotSpot = /** @type {ol.KMLVec2_|undefined} */
|
||||||
(object['hotSpot']);
|
(object['hotSpot']);
|
||||||
if (hotSpot) {
|
if (hotSpot) {
|
||||||
@@ -593,8 +591,8 @@ KML.IconStyleParser_ = function(node, objectStack) {
|
|||||||
anchorYUnits = KML.DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS_;
|
anchorYUnits = KML.DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS_;
|
||||||
} else if (/^http:\/\/maps\.(?:google|gstatic)\.com\//.test(src)) {
|
} else if (/^http:\/\/maps\.(?:google|gstatic)\.com\//.test(src)) {
|
||||||
anchor = [0.5, 0];
|
anchor = [0.5, 0];
|
||||||
anchorXUnits = _ol_style_IconAnchorUnits_.FRACTION;
|
anchorXUnits = IconAnchorUnits.FRACTION;
|
||||||
anchorYUnits = _ol_style_IconAnchorUnits_.FRACTION;
|
anchorYUnits = IconAnchorUnits.FRACTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
var offset;
|
var offset;
|
||||||
@@ -640,7 +638,7 @@ KML.IconStyleParser_ = function(node, objectStack) {
|
|||||||
anchorYUnits: anchorYUnits,
|
anchorYUnits: anchorYUnits,
|
||||||
crossOrigin: 'anonymous', // FIXME should this be configurable?
|
crossOrigin: 'anonymous', // FIXME should this be configurable?
|
||||||
offset: offset,
|
offset: offset,
|
||||||
offsetOrigin: _ol_style_IconOrigin_.BOTTOM_LEFT,
|
offsetOrigin: IconOrigin.BOTTOM_LEFT,
|
||||||
rotation: rotation,
|
rotation: rotation,
|
||||||
scale: scale,
|
scale: scale,
|
||||||
size: size,
|
size: size,
|
||||||
@@ -2279,9 +2277,9 @@ KML.writeIconStyle_ = function(node, style, objectStack) {
|
|||||||
if (anchor && (anchor[0] !== size[0] / 2 || anchor[1] !== size[1] / 2)) {
|
if (anchor && (anchor[0] !== size[0] / 2 || anchor[1] !== size[1] / 2)) {
|
||||||
var /** @type {ol.KMLVec2_} */ hotSpot = {
|
var /** @type {ol.KMLVec2_} */ hotSpot = {
|
||||||
x: anchor[0],
|
x: anchor[0],
|
||||||
xunits: _ol_style_IconAnchorUnits_.PIXELS,
|
xunits: IconAnchorUnits.PIXELS,
|
||||||
y: size[1] - anchor[1],
|
y: size[1] - anchor[1],
|
||||||
yunits: _ol_style_IconAnchorUnits_.PIXELS
|
yunits: IconAnchorUnits.PIXELS
|
||||||
};
|
};
|
||||||
properties['hotSpot'] = hotSpot;
|
properties['hotSpot'] = hotSpot;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
import {getUid, inherits} from '../index.js';
|
import {getUid, inherits} from '../index.js';
|
||||||
import _ol_Collection_ from '../Collection.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 _ol_Feature_ from '../Feature.js';
|
||||||
import MapBrowserEventType from '../MapBrowserEventType.js';
|
import MapBrowserEventType from '../MapBrowserEventType.js';
|
||||||
import MapBrowserPointerEvent from '../MapBrowserPointerEvent.js';
|
import MapBrowserPointerEvent from '../MapBrowserPointerEvent.js';
|
||||||
@@ -214,9 +214,9 @@ var _ol_interaction_Modify_ = function(options) {
|
|||||||
this.features_ = features;
|
this.features_ = features;
|
||||||
|
|
||||||
this.features_.forEach(this.addFeature_, this);
|
this.features_.forEach(this.addFeature_, this);
|
||||||
_ol_events_.listen(this.features_, _ol_CollectionEventType_.ADD,
|
_ol_events_.listen(this.features_, CollectionEventType.ADD,
|
||||||
this.handleFeatureAdd_, this);
|
this.handleFeatureAdd_, this);
|
||||||
_ol_events_.listen(this.features_, _ol_CollectionEventType_.REMOVE,
|
_ol_events_.listen(this.features_, CollectionEventType.REMOVE,
|
||||||
this.handleFeatureRemove_, this);
|
this.handleFeatureRemove_, this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* @module ol/interaction/Select
|
* @module ol/interaction/Select
|
||||||
*/
|
*/
|
||||||
import {getUid, inherits} from '../index.js';
|
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_array_ from '../array.js';
|
||||||
import _ol_events_ from '../events.js';
|
import _ol_events_ from '../events.js';
|
||||||
import Event from '../events/Event.js';
|
import Event from '../events/Event.js';
|
||||||
@@ -135,9 +135,9 @@ var _ol_interaction_Select_ = function(opt_options) {
|
|||||||
this.featureLayerAssociation_ = {};
|
this.featureLayerAssociation_ = {};
|
||||||
|
|
||||||
var features = this.featureOverlay_.getSource().getFeaturesCollection();
|
var features = this.featureOverlay_.getSource().getFeaturesCollection();
|
||||||
_ol_events_.listen(features, _ol_CollectionEventType_.ADD,
|
_ol_events_.listen(features, CollectionEventType.ADD,
|
||||||
this.addFeature_, this);
|
this.addFeature_, this);
|
||||||
_ol_events_.listen(features, _ol_CollectionEventType_.REMOVE,
|
_ol_events_.listen(features, CollectionEventType.REMOVE,
|
||||||
this.removeFeature_, this);
|
this.removeFeature_, this);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
import {getUid, inherits} from '../index.js';
|
import {getUid, inherits} from '../index.js';
|
||||||
import _ol_Collection_ from '../Collection.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_coordinate_ from '../coordinate.js';
|
||||||
import _ol_events_ from '../events.js';
|
import _ol_events_ from '../events.js';
|
||||||
import EventType from '../events/EventType.js';
|
import EventType from '../events/EventType.js';
|
||||||
@@ -309,9 +309,9 @@ _ol_interaction_Snap_.prototype.setMap = function(map) {
|
|||||||
if (map) {
|
if (map) {
|
||||||
if (this.features_) {
|
if (this.features_) {
|
||||||
keys.push(
|
keys.push(
|
||||||
_ol_events_.listen(this.features_, _ol_CollectionEventType_.ADD,
|
_ol_events_.listen(this.features_, CollectionEventType.ADD,
|
||||||
this.handleFeatureAdd_, this),
|
this.handleFeatureAdd_, this),
|
||||||
_ol_events_.listen(this.features_, _ol_CollectionEventType_.REMOVE,
|
_ol_events_.listen(this.features_, CollectionEventType.REMOVE,
|
||||||
this.handleFeatureRemove_, this)
|
this.handleFeatureRemove_, this)
|
||||||
);
|
);
|
||||||
} else if (this.source_) {
|
} else if (this.source_) {
|
||||||
|
|||||||
+19
-19
@@ -3,9 +3,9 @@
|
|||||||
*/
|
*/
|
||||||
import {getUid, inherits} from '../index.js';
|
import {getUid, inherits} from '../index.js';
|
||||||
import _ol_Collection_ from '../Collection.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_Object_ from '../Object.js';
|
||||||
import _ol_ObjectEventType_ from '../ObjectEventType.js';
|
import ObjectEventType from '../ObjectEventType.js';
|
||||||
import {assert} from '../asserts.js';
|
import {assert} from '../asserts.js';
|
||||||
import _ol_events_ from '../events.js';
|
import _ol_events_ from '../events.js';
|
||||||
import EventType from '../events/EventType.js';
|
import EventType from '../events/EventType.js';
|
||||||
@@ -14,6 +14,16 @@ import _ol_layer_Base_ from '../layer/Base.js';
|
|||||||
import _ol_obj_ from '../obj.js';
|
import _ol_obj_ from '../obj.js';
|
||||||
import _ol_source_State_ from '../source/State.js';
|
import _ol_source_State_ from '../source/State.js';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @enum {string}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
var Property = {
|
||||||
|
LAYERS: 'layers'
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @classdesc
|
* @classdesc
|
||||||
* A {@link ol.Collection} of layers that are handled together.
|
* A {@link ol.Collection} of layers that are handled together.
|
||||||
@@ -49,7 +59,7 @@ var _ol_layer_Group_ = function(opt_options) {
|
|||||||
this.listenerKeys_ = {};
|
this.listenerKeys_ = {};
|
||||||
|
|
||||||
_ol_events_.listen(this,
|
_ol_events_.listen(this,
|
||||||
_ol_Object_.getChangeEventType(_ol_layer_Group_.Property_.LAYERS),
|
_ol_Object_.getChangeEventType(Property.LAYERS),
|
||||||
this.handleLayersChanged_, this);
|
this.handleLayersChanged_, this);
|
||||||
|
|
||||||
if (layers) {
|
if (layers) {
|
||||||
@@ -89,9 +99,9 @@ _ol_layer_Group_.prototype.handleLayersChanged_ = function(event) {
|
|||||||
|
|
||||||
var layers = this.getLayers();
|
var layers = this.getLayers();
|
||||||
this.layersListenerKeys_.push(
|
this.layersListenerKeys_.push(
|
||||||
_ol_events_.listen(layers, _ol_CollectionEventType_.ADD,
|
_ol_events_.listen(layers, CollectionEventType.ADD,
|
||||||
this.handleLayersAdd_, this),
|
this.handleLayersAdd_, this),
|
||||||
_ol_events_.listen(layers, _ol_CollectionEventType_.REMOVE,
|
_ol_events_.listen(layers, CollectionEventType.REMOVE,
|
||||||
this.handleLayersRemove_, this));
|
this.handleLayersRemove_, this));
|
||||||
|
|
||||||
for (var id in this.listenerKeys_) {
|
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++) {
|
for (i = 0, ii = layersArray.length; i < ii; i++) {
|
||||||
layer = layersArray[i];
|
layer = layersArray[i];
|
||||||
this.listenerKeys_[getUid(layer).toString()] = [
|
this.listenerKeys_[getUid(layer).toString()] = [
|
||||||
_ol_events_.listen(layer, _ol_ObjectEventType_.PROPERTYCHANGE,
|
_ol_events_.listen(layer, ObjectEventType.PROPERTYCHANGE,
|
||||||
this.handleLayerChange_, this),
|
this.handleLayerChange_, this),
|
||||||
_ol_events_.listen(layer, EventType.CHANGE,
|
_ol_events_.listen(layer, EventType.CHANGE,
|
||||||
this.handleLayerChange_, this)
|
this.handleLayerChange_, this)
|
||||||
@@ -123,7 +133,7 @@ _ol_layer_Group_.prototype.handleLayersAdd_ = function(collectionEvent) {
|
|||||||
var layer = /** @type {ol.layer.Base} */ (collectionEvent.element);
|
var layer = /** @type {ol.layer.Base} */ (collectionEvent.element);
|
||||||
var key = getUid(layer).toString();
|
var key = getUid(layer).toString();
|
||||||
this.listenerKeys_[key] = [
|
this.listenerKeys_[key] = [
|
||||||
_ol_events_.listen(layer, _ol_ObjectEventType_.PROPERTYCHANGE,
|
_ol_events_.listen(layer, ObjectEventType.PROPERTYCHANGE,
|
||||||
this.handleLayerChange_, this),
|
this.handleLayerChange_, this),
|
||||||
_ol_events_.listen(layer, EventType.CHANGE,
|
_ol_events_.listen(layer, EventType.CHANGE,
|
||||||
this.handleLayerChange_, this)
|
this.handleLayerChange_, this)
|
||||||
@@ -154,10 +164,7 @@ _ol_layer_Group_.prototype.handleLayersRemove_ = function(collectionEvent) {
|
|||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_layer_Group_.prototype.getLayers = function() {
|
_ol_layer_Group_.prototype.getLayers = function() {
|
||||||
return (
|
return (/** @type {!ol.Collection.<ol.layer.Base>} */ this.get(Property.LAYERS));
|
||||||
/** @type {!ol.Collection.<ol.layer.Base>} */ this.get(
|
|
||||||
_ol_layer_Group_.Property_.LAYERS)
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -170,7 +177,7 @@ _ol_layer_Group_.prototype.getLayers = function() {
|
|||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_layer_Group_.prototype.setLayers = function(layers) {
|
_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;
|
return _ol_source_State_.READY;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @enum {string}
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
_ol_layer_Group_.Property_ = {
|
|
||||||
LAYERS: 'layers'
|
|
||||||
};
|
|
||||||
export default _ol_layer_Group_;
|
export default _ol_layer_Group_;
|
||||||
|
|||||||
+44
-49
@@ -12,6 +12,25 @@ import _ol_render_EventType_ from '../render/EventType.js';
|
|||||||
import _ol_style_Icon_ from '../style/Icon.js';
|
import _ol_style_Icon_ from '../style/Icon.js';
|
||||||
import _ol_style_Style_ from '../style/Style.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
|
* @classdesc
|
||||||
* Layer for rendering vector data as a heatmap.
|
* 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.
|
* @param {olx.layer.HeatmapOptions=} opt_options Options.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
var _ol_layer_Heatmap_ = function(opt_options) {
|
var Heatmap = function(opt_options) {
|
||||||
var options = opt_options ? opt_options : {};
|
var options = opt_options ? opt_options : {};
|
||||||
|
|
||||||
var baseOptions = _ol_obj_.assign({}, options);
|
var baseOptions = _ol_obj_.assign({}, options);
|
||||||
@@ -62,21 +81,20 @@ var _ol_layer_Heatmap_ = function(opt_options) {
|
|||||||
this.styleCache_ = null;
|
this.styleCache_ = null;
|
||||||
|
|
||||||
_ol_events_.listen(this,
|
_ol_events_.listen(this,
|
||||||
_ol_Object_.getChangeEventType(_ol_layer_Heatmap_.Property_.GRADIENT),
|
_ol_Object_.getChangeEventType(Property.GRADIENT),
|
||||||
this.handleGradientChanged_, this);
|
this.handleGradientChanged_, this);
|
||||||
|
|
||||||
this.setGradient(options.gradient ?
|
this.setGradient(options.gradient ? options.gradient : DEFAULT_GRADIENT);
|
||||||
options.gradient : _ol_layer_Heatmap_.DEFAULT_GRADIENT);
|
|
||||||
|
|
||||||
this.setBlur(options.blur !== undefined ? options.blur : 15);
|
this.setBlur(options.blur !== undefined ? options.blur : 15);
|
||||||
|
|
||||||
this.setRadius(options.radius !== undefined ? options.radius : 8);
|
this.setRadius(options.radius !== undefined ? options.radius : 8);
|
||||||
|
|
||||||
_ol_events_.listen(this,
|
_ol_events_.listen(this,
|
||||||
_ol_Object_.getChangeEventType(_ol_layer_Heatmap_.Property_.BLUR),
|
_ol_Object_.getChangeEventType(Property.BLUR),
|
||||||
this.handleStyleChanged_, this);
|
this.handleStyleChanged_, this);
|
||||||
_ol_events_.listen(this,
|
_ol_events_.listen(this,
|
||||||
_ol_Object_.getChangeEventType(_ol_layer_Heatmap_.Property_.RADIUS),
|
_ol_Object_.getChangeEventType(Property.RADIUS),
|
||||||
this.handleStyleChanged_, this);
|
this.handleStyleChanged_, this);
|
||||||
|
|
||||||
this.handleStyleChanged_();
|
this.handleStyleChanged_();
|
||||||
@@ -118,14 +136,7 @@ var _ol_layer_Heatmap_ = function(opt_options) {
|
|||||||
_ol_events_.listen(this, _ol_render_EventType_.RENDER, this.handleRender_, this);
|
_ol_events_.listen(this, _ol_render_EventType_.RENDER, this.handleRender_, this);
|
||||||
};
|
};
|
||||||
|
|
||||||
inherits(_ol_layer_Heatmap_, _ol_layer_Vector_);
|
inherits(Heatmap, _ol_layer_Vector_);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @const
|
|
||||||
* @type {Array.<string>}
|
|
||||||
*/
|
|
||||||
_ol_layer_Heatmap_.DEFAULT_GRADIENT = ['#00f', '#0ff', '#0f0', '#ff0', '#f00'];
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -133,7 +144,7 @@ _ol_layer_Heatmap_.DEFAULT_GRADIENT = ['#00f', '#0ff', '#0f0', '#ff0', '#f00'];
|
|||||||
* @return {Uint8ClampedArray} An array.
|
* @return {Uint8ClampedArray} An array.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_layer_Heatmap_.createGradient_ = function(colors) {
|
var createGradient = function(colors) {
|
||||||
var width = 1;
|
var width = 1;
|
||||||
var height = 256;
|
var height = 256;
|
||||||
var context = createCanvasContext2D(width, height);
|
var context = createCanvasContext2D(width, height);
|
||||||
@@ -155,7 +166,7 @@ _ol_layer_Heatmap_.createGradient_ = function(colors) {
|
|||||||
* @return {string} Data URL for a circle.
|
* @return {string} Data URL for a circle.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_layer_Heatmap_.prototype.createCircle_ = function() {
|
Heatmap.prototype.createCircle_ = function() {
|
||||||
var radius = this.getRadius();
|
var radius = this.getRadius();
|
||||||
var blur = this.getBlur();
|
var blur = this.getBlur();
|
||||||
var halfSize = radius + blur + 1;
|
var halfSize = radius + blur + 1;
|
||||||
@@ -178,10 +189,8 @@ _ol_layer_Heatmap_.prototype.createCircle_ = function() {
|
|||||||
* @api
|
* @api
|
||||||
* @observable
|
* @observable
|
||||||
*/
|
*/
|
||||||
_ol_layer_Heatmap_.prototype.getBlur = function() {
|
Heatmap.prototype.getBlur = function() {
|
||||||
return (
|
return (/** @type {number} */ this.get(Property.BLUR));
|
||||||
/** @type {number} */ this.get(_ol_layer_Heatmap_.Property_.BLUR)
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -191,10 +200,8 @@ _ol_layer_Heatmap_.prototype.getBlur = function() {
|
|||||||
* @api
|
* @api
|
||||||
* @observable
|
* @observable
|
||||||
*/
|
*/
|
||||||
_ol_layer_Heatmap_.prototype.getGradient = function() {
|
Heatmap.prototype.getGradient = function() {
|
||||||
return (
|
return (/** @type {Array.<string>} */ this.get(Property.GRADIENT));
|
||||||
/** @type {Array.<string>} */ this.get(_ol_layer_Heatmap_.Property_.GRADIENT)
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -204,25 +211,23 @@ _ol_layer_Heatmap_.prototype.getGradient = function() {
|
|||||||
* @api
|
* @api
|
||||||
* @observable
|
* @observable
|
||||||
*/
|
*/
|
||||||
_ol_layer_Heatmap_.prototype.getRadius = function() {
|
Heatmap.prototype.getRadius = function() {
|
||||||
return (
|
return (/** @type {number} */ this.get(Property.RADIUS));
|
||||||
/** @type {number} */ this.get(_ol_layer_Heatmap_.Property_.RADIUS)
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_layer_Heatmap_.prototype.handleGradientChanged_ = function() {
|
Heatmap.prototype.handleGradientChanged_ = function() {
|
||||||
this.gradient_ = _ol_layer_Heatmap_.createGradient_(this.getGradient());
|
this.gradient_ = createGradient(this.getGradient());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_layer_Heatmap_.prototype.handleStyleChanged_ = function() {
|
Heatmap.prototype.handleStyleChanged_ = function() {
|
||||||
this.circleImage_ = this.createCircle_();
|
this.circleImage_ = this.createCircle_();
|
||||||
this.styleCache_ = new Array(256);
|
this.styleCache_ = new Array(256);
|
||||||
this.changed();
|
this.changed();
|
||||||
@@ -233,7 +238,7 @@ _ol_layer_Heatmap_.prototype.handleStyleChanged_ = function() {
|
|||||||
* @param {ol.render.Event} event Post compose event
|
* @param {ol.render.Event} event Post compose event
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_layer_Heatmap_.prototype.handleRender_ = function(event) {
|
Heatmap.prototype.handleRender_ = function(event) {
|
||||||
var context = event.context;
|
var context = event.context;
|
||||||
var canvas = context.canvas;
|
var canvas = context.canvas;
|
||||||
var image = context.getImageData(0, 0, canvas.width, canvas.height);
|
var image = context.getImageData(0, 0, canvas.width, canvas.height);
|
||||||
@@ -257,8 +262,8 @@ _ol_layer_Heatmap_.prototype.handleRender_ = function(event) {
|
|||||||
* @api
|
* @api
|
||||||
* @observable
|
* @observable
|
||||||
*/
|
*/
|
||||||
_ol_layer_Heatmap_.prototype.setBlur = function(blur) {
|
Heatmap.prototype.setBlur = function(blur) {
|
||||||
this.set(_ol_layer_Heatmap_.Property_.BLUR, blur);
|
this.set(Property.BLUR, blur);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -268,8 +273,8 @@ _ol_layer_Heatmap_.prototype.setBlur = function(blur) {
|
|||||||
* @api
|
* @api
|
||||||
* @observable
|
* @observable
|
||||||
*/
|
*/
|
||||||
_ol_layer_Heatmap_.prototype.setGradient = function(colors) {
|
Heatmap.prototype.setGradient = function(colors) {
|
||||||
this.set(_ol_layer_Heatmap_.Property_.GRADIENT, colors);
|
this.set(Property.GRADIENT, colors);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -279,18 +284,8 @@ _ol_layer_Heatmap_.prototype.setGradient = function(colors) {
|
|||||||
* @api
|
* @api
|
||||||
* @observable
|
* @observable
|
||||||
*/
|
*/
|
||||||
_ol_layer_Heatmap_.prototype.setRadius = function(radius) {
|
Heatmap.prototype.setRadius = function(radius) {
|
||||||
this.set(_ol_layer_Heatmap_.Property_.RADIUS, radius);
|
this.set(Property.RADIUS, radius);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default Heatmap;
|
||||||
/**
|
|
||||||
* @enum {string}
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
_ol_layer_Heatmap_.Property_ = {
|
|
||||||
BLUR: 'blur',
|
|
||||||
GRADIENT: 'gradient',
|
|
||||||
RADIUS: 'radius'
|
|
||||||
};
|
|
||||||
export default _ol_layer_Heatmap_;
|
|
||||||
|
|||||||
+12
-11
@@ -8,6 +8,16 @@ import _ol_layer_VectorRenderType_ from '../layer/VectorRenderType.js';
|
|||||||
import _ol_obj_ from '../obj.js';
|
import _ol_obj_ from '../obj.js';
|
||||||
import _ol_style_Style_ from '../style/Style.js';
|
import _ol_style_Style_ from '../style/Style.js';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @enum {string}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
var Property = {
|
||||||
|
RENDER_ORDER: 'renderOrder'
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @classdesc
|
* @classdesc
|
||||||
* Vector data that is rendered client-side.
|
* Vector data that is rendered client-side.
|
||||||
@@ -123,9 +133,7 @@ _ol_layer_Vector_.prototype.getRenderBuffer = function() {
|
|||||||
* order.
|
* order.
|
||||||
*/
|
*/
|
||||||
_ol_layer_Vector_.prototype.getRenderOrder = function() {
|
_ol_layer_Vector_.prototype.getRenderOrder = function() {
|
||||||
return (
|
return (/** @type {ol.RenderOrderFunction|null|undefined} */ this.get(Property.RENDER_ORDER));
|
||||||
/** @type {ol.RenderOrderFunction|null|undefined} */ this.get(_ol_layer_Vector_.Property_.RENDER_ORDER)
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -183,7 +191,7 @@ _ol_layer_Vector_.prototype.getUpdateWhileInteracting = function() {
|
|||||||
* Render order.
|
* Render order.
|
||||||
*/
|
*/
|
||||||
_ol_layer_Vector_.prototype.setRenderOrder = function(renderOrder) {
|
_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_;
|
export default _ol_layer_Vector_;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import _ol_render_canvas_ from '../canvas.js';
|
|||||||
import _ol_render_canvas_Instruction_ from '../canvas/Instruction.js';
|
import _ol_render_canvas_Instruction_ from '../canvas/Instruction.js';
|
||||||
import _ol_render_canvas_Replay_ from '../canvas/Replay.js';
|
import _ol_render_canvas_Replay_ from '../canvas/Replay.js';
|
||||||
import _ol_render_replay_ from '../replay.js';
|
import _ol_render_replay_ from '../replay.js';
|
||||||
import _ol_style_TextPlacement_ from '../../style/TextPlacement.js';
|
import TextPlacement from '../../style/TextPlacement.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
@@ -176,7 +176,7 @@ _ol_render_canvas_TextReplay_.prototype.drawText = function(geometry, feature) {
|
|||||||
var stride = 2;
|
var stride = 2;
|
||||||
var i, ii;
|
var i, ii;
|
||||||
|
|
||||||
if (textState.placement === _ol_style_TextPlacement_.LINE) {
|
if (textState.placement === TextPlacement.LINE) {
|
||||||
if (!intersects(this.getBufferedMaxExtent(), geometry.getExtent())) {
|
if (!intersects(this.getBufferedMaxExtent(), geometry.getExtent())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* @module ol/renderer/Layer
|
* @module ol/renderer/Layer
|
||||||
*/
|
*/
|
||||||
import {getUid, inherits, nullFunction} from '../index.js';
|
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_Observable_ from '../Observable.js';
|
||||||
import _ol_TileState_ from '../TileState.js';
|
import _ol_TileState_ from '../TileState.js';
|
||||||
import _ol_events_ from '../events.js';
|
import _ol_events_ from '../events.js';
|
||||||
@@ -98,7 +98,7 @@ _ol_renderer_Layer_.prototype.getLayer = function() {
|
|||||||
*/
|
*/
|
||||||
_ol_renderer_Layer_.prototype.handleImageChange_ = function(event) {
|
_ol_renderer_Layer_.prototype.handleImageChange_ = function(event) {
|
||||||
var image = /** @type {ol.Image} */ (event.target);
|
var image = /** @type {ol.Image} */ (event.target);
|
||||||
if (image.getState() === _ol_ImageState_.LOADED) {
|
if (image.getState() === ImageState.LOADED) {
|
||||||
this.renderIfReadyAndVisible();
|
this.renderIfReadyAndVisible();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -114,16 +114,14 @@ _ol_renderer_Layer_.prototype.handleImageChange_ = function(event) {
|
|||||||
*/
|
*/
|
||||||
_ol_renderer_Layer_.prototype.loadImage = function(image) {
|
_ol_renderer_Layer_.prototype.loadImage = function(image) {
|
||||||
var imageState = image.getState();
|
var imageState = image.getState();
|
||||||
if (imageState != _ol_ImageState_.LOADED &&
|
if (imageState != ImageState.LOADED && imageState != ImageState.ERROR) {
|
||||||
imageState != _ol_ImageState_.ERROR) {
|
_ol_events_.listen(image, EventType.CHANGE, this.handleImageChange_, this);
|
||||||
_ol_events_.listen(image, EventType.CHANGE,
|
|
||||||
this.handleImageChange_, this);
|
|
||||||
}
|
}
|
||||||
if (imageState == _ol_ImageState_.IDLE) {
|
if (imageState == ImageState.IDLE) {
|
||||||
image.load();
|
image.load();
|
||||||
imageState = image.getState();
|
imageState = image.getState();
|
||||||
}
|
}
|
||||||
return imageState == _ol_ImageState_.LOADED;
|
return imageState == ImageState.LOADED;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* @module ol/renderer/vector
|
* @module ol/renderer/vector
|
||||||
*/
|
*/
|
||||||
import {getUid} from '../index.js';
|
import {getUid} from '../index.js';
|
||||||
import _ol_ImageState_ from '../ImageState.js';
|
import ImageState from '../ImageState.js';
|
||||||
import GeometryType from '../geom/GeometryType.js';
|
import GeometryType from '../geom/GeometryType.js';
|
||||||
import _ol_render_ReplayType_ from '../render/ReplayType.js';
|
import _ol_render_ReplayType_ from '../render/ReplayType.js';
|
||||||
var _ol_renderer_vector_ = {};
|
var _ol_renderer_vector_ = {};
|
||||||
@@ -88,11 +88,10 @@ _ol_renderer_vector_.renderFeature = function(
|
|||||||
imageStyle = style.getImage();
|
imageStyle = style.getImage();
|
||||||
if (imageStyle) {
|
if (imageStyle) {
|
||||||
imageState = imageStyle.getImageState();
|
imageState = imageStyle.getImageState();
|
||||||
if (imageState == _ol_ImageState_.LOADED ||
|
if (imageState == ImageState.LOADED || imageState == ImageState.ERROR) {
|
||||||
imageState == _ol_ImageState_.ERROR) {
|
|
||||||
imageStyle.unlistenImageChange(listener, thisArg);
|
imageStyle.unlistenImageChange(listener, thisArg);
|
||||||
} else {
|
} else {
|
||||||
if (imageState == _ol_ImageState_.IDLE) {
|
if (imageState == ImageState.IDLE) {
|
||||||
imageStyle.load();
|
imageStyle.load();
|
||||||
}
|
}
|
||||||
imageState = imageStyle.getImageState();
|
imageState = imageStyle.getImageState();
|
||||||
@@ -256,7 +255,7 @@ _ol_renderer_vector_.renderMultiPolygonGeometry_ = function(replayGroup, geometr
|
|||||||
_ol_renderer_vector_.renderPointGeometry_ = function(replayGroup, geometry, style, feature) {
|
_ol_renderer_vector_.renderPointGeometry_ = function(replayGroup, geometry, style, feature) {
|
||||||
var imageStyle = style.getImage();
|
var imageStyle = style.getImage();
|
||||||
if (imageStyle) {
|
if (imageStyle) {
|
||||||
if (imageStyle.getImageState() != _ol_ImageState_.LOADED) {
|
if (imageStyle.getImageState() != ImageState.LOADED) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var imageReplay = replayGroup.getReplay(
|
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) {
|
_ol_renderer_vector_.renderMultiPointGeometry_ = function(replayGroup, geometry, style, feature) {
|
||||||
var imageStyle = style.getImage();
|
var imageStyle = style.getImage();
|
||||||
if (imageStyle) {
|
if (imageStyle) {
|
||||||
if (imageStyle.getImageState() != _ol_ImageState_.LOADED) {
|
if (imageStyle.getImageState() != ImageState.LOADED) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var imageReplay = replayGroup.getReplay(
|
var imageReplay = replayGroup.getReplay(
|
||||||
|
|||||||
+9
-11
@@ -4,7 +4,7 @@
|
|||||||
import {ERROR_THRESHOLD} from './common.js';
|
import {ERROR_THRESHOLD} from './common.js';
|
||||||
import {inherits} from '../index.js';
|
import {inherits} from '../index.js';
|
||||||
import _ol_ImageBase_ from '../ImageBase.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 _ol_events_ from '../events.js';
|
||||||
import EventType from '../events/EventType.js';
|
import EventType from '../events/EventType.js';
|
||||||
import {getCenter, getIntersection, getHeight, getWidth} from '../extent.js';
|
import {getCenter, getIntersection, getHeight, getWidth} from '../extent.js';
|
||||||
@@ -100,10 +100,10 @@ var _ol_reproj_Image_ = function(sourceProj, targetProj,
|
|||||||
this.sourceListenerKey_ = null;
|
this.sourceListenerKey_ = null;
|
||||||
|
|
||||||
|
|
||||||
var state = _ol_ImageState_.LOADED;
|
var state = ImageState.LOADED;
|
||||||
|
|
||||||
if (this.sourceImage_) {
|
if (this.sourceImage_) {
|
||||||
state = _ol_ImageState_.IDLE;
|
state = ImageState.IDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
_ol_ImageBase_.call(this, targetExtent, targetResolution, this.sourcePixelRatio_, state);
|
_ol_ImageBase_.call(this, targetExtent, targetResolution, this.sourcePixelRatio_, state);
|
||||||
@@ -116,7 +116,7 @@ inherits(_ol_reproj_Image_, _ol_ImageBase_);
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
_ol_reproj_Image_.prototype.disposeInternal = function() {
|
_ol_reproj_Image_.prototype.disposeInternal = function() {
|
||||||
if (this.state == _ol_ImageState_.LOADING) {
|
if (this.state == ImageState.LOADING) {
|
||||||
this.unlistenSource_();
|
this.unlistenSource_();
|
||||||
}
|
}
|
||||||
_ol_ImageBase_.prototype.disposeInternal.call(this);
|
_ol_ImageBase_.prototype.disposeInternal.call(this);
|
||||||
@@ -144,7 +144,7 @@ _ol_reproj_Image_.prototype.getProjection = function() {
|
|||||||
*/
|
*/
|
||||||
_ol_reproj_Image_.prototype.reproject_ = function() {
|
_ol_reproj_Image_.prototype.reproject_ = function() {
|
||||||
var sourceState = this.sourceImage_.getState();
|
var sourceState = this.sourceImage_.getState();
|
||||||
if (sourceState == _ol_ImageState_.LOADED) {
|
if (sourceState == ImageState.LOADED) {
|
||||||
var width = getWidth(this.targetExtent_) / this.targetResolution_;
|
var width = getWidth(this.targetExtent_) / this.targetResolution_;
|
||||||
var height = getHeight(this.targetExtent_) / this.targetResolution_;
|
var height = getHeight(this.targetExtent_) / this.targetResolution_;
|
||||||
|
|
||||||
@@ -164,20 +164,18 @@ _ol_reproj_Image_.prototype.reproject_ = function() {
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
_ol_reproj_Image_.prototype.load = function() {
|
_ol_reproj_Image_.prototype.load = function() {
|
||||||
if (this.state == _ol_ImageState_.IDLE) {
|
if (this.state == ImageState.IDLE) {
|
||||||
this.state = _ol_ImageState_.LOADING;
|
this.state = ImageState.LOADING;
|
||||||
this.changed();
|
this.changed();
|
||||||
|
|
||||||
var sourceState = this.sourceImage_.getState();
|
var sourceState = this.sourceImage_.getState();
|
||||||
if (sourceState == _ol_ImageState_.LOADED ||
|
if (sourceState == ImageState.LOADED || sourceState == ImageState.ERROR) {
|
||||||
sourceState == _ol_ImageState_.ERROR) {
|
|
||||||
this.reproject_();
|
this.reproject_();
|
||||||
} else {
|
} else {
|
||||||
this.sourceListenerKey_ = _ol_events_.listen(this.sourceImage_,
|
this.sourceListenerKey_ = _ol_events_.listen(this.sourceImage_,
|
||||||
EventType.CHANGE, function(e) {
|
EventType.CHANGE, function(e) {
|
||||||
var sourceState = this.sourceImage_.getState();
|
var sourceState = this.sourceImage_.getState();
|
||||||
if (sourceState == _ol_ImageState_.LOADED ||
|
if (sourceState == ImageState.LOADED || sourceState == ImageState.ERROR) {
|
||||||
sourceState == _ol_ImageState_.ERROR) {
|
|
||||||
this.unlistenSource_();
|
this.unlistenSource_();
|
||||||
this.reproject_();
|
this.reproject_();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
import {ENABLE_RASTER_REPROJECTION} from '../reproj/common.js';
|
import {ENABLE_RASTER_REPROJECTION} from '../reproj/common.js';
|
||||||
import {inherits} from '../index.js';
|
import {inherits} from '../index.js';
|
||||||
import _ol_ImageState_ from '../ImageState.js';
|
import ImageState from '../ImageState.js';
|
||||||
import _ol_array_ from '../array.js';
|
import _ol_array_ from '../array.js';
|
||||||
import Event from '../events/Event.js';
|
import Event from '../events/Event.js';
|
||||||
import {equals} from '../extent.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) {
|
_ol_source_Image_.prototype.handleImageChange = function(event) {
|
||||||
var image = /** @type {ol.Image} */ (event.target);
|
var image = /** @type {ol.Image} */ (event.target);
|
||||||
switch (image.getState()) {
|
switch (image.getState()) {
|
||||||
case _ol_ImageState_.LOADING:
|
case ImageState.LOADING:
|
||||||
this.dispatchEvent(
|
this.dispatchEvent(
|
||||||
new _ol_source_Image_.Event(_ol_source_Image_.EventType_.IMAGELOADSTART,
|
new _ol_source_Image_.Event(_ol_source_Image_.EventType_.IMAGELOADSTART,
|
||||||
image));
|
image));
|
||||||
break;
|
break;
|
||||||
case _ol_ImageState_.LOADED:
|
case ImageState.LOADED:
|
||||||
this.dispatchEvent(
|
this.dispatchEvent(
|
||||||
new _ol_source_Image_.Event(_ol_source_Image_.EventType_.IMAGELOADEND,
|
new _ol_source_Image_.Event(_ol_source_Image_.EventType_.IMAGELOADEND,
|
||||||
image));
|
image));
|
||||||
break;
|
break;
|
||||||
case _ol_ImageState_.ERROR:
|
case ImageState.ERROR:
|
||||||
this.dispatchEvent(
|
this.dispatchEvent(
|
||||||
new _ol_source_Image_.Event(_ol_source_Image_.EventType_.IMAGELOADERROR,
|
new _ol_source_Image_.Event(_ol_source_Image_.EventType_.IMAGELOADERROR,
|
||||||
image));
|
image));
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
import {inherits} from '../index.js';
|
import {inherits} from '../index.js';
|
||||||
import _ol_Image_ from '../Image.js';
|
import _ol_Image_ from '../Image.js';
|
||||||
import _ol_ImageState_ from '../ImageState.js';
|
import ImageState from '../ImageState.js';
|
||||||
import {createCanvasContext2D} from '../dom.js';
|
import {createCanvasContext2D} from '../dom.js';
|
||||||
import _ol_events_ from '../events.js';
|
import _ol_events_ from '../events.js';
|
||||||
import EventType from '../events/EventType.js';
|
import EventType from '../events/EventType.js';
|
||||||
@@ -70,7 +70,7 @@ _ol_source_ImageStatic_.prototype.getImageInternal = function(extent, resolution
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
_ol_source_ImageStatic_.prototype.handleImageChange = function(evt) {
|
_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 imageExtent = this.image_.getExtent();
|
||||||
var image = this.image_.getImage();
|
var image = this.image_.getImage();
|
||||||
var imageWidth, imageHeight;
|
var imageWidth, imageHeight;
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
import {getUid, inherits, nullFunction} from '../index.js';
|
import {getUid, inherits, nullFunction} from '../index.js';
|
||||||
import _ol_Collection_ from '../Collection.js';
|
import _ol_Collection_ from '../Collection.js';
|
||||||
import _ol_CollectionEventType_ from '../CollectionEventType.js';
|
import CollectionEventType from '../CollectionEventType.js';
|
||||||
import _ol_ObjectEventType_ from '../ObjectEventType.js';
|
import ObjectEventType from '../ObjectEventType.js';
|
||||||
import _ol_array_ from '../array.js';
|
import _ol_array_ from '../array.js';
|
||||||
import {assert} from '../asserts.js';
|
import {assert} from '../asserts.js';
|
||||||
import _ol_events_ from '../events.js';
|
import _ol_events_ from '../events.js';
|
||||||
@@ -205,7 +205,7 @@ _ol_source_Vector_.prototype.setupChangeEvents_ = function(featureKey, feature)
|
|||||||
this.featureChangeKeys_[featureKey] = [
|
this.featureChangeKeys_[featureKey] = [
|
||||||
_ol_events_.listen(feature, EventType.CHANGE,
|
_ol_events_.listen(feature, EventType.CHANGE,
|
||||||
this.handleFeatureChange_, this),
|
this.handleFeatureChange_, this),
|
||||||
_ol_events_.listen(feature, _ol_ObjectEventType_.PROPERTYCHANGE,
|
_ol_events_.listen(feature, ObjectEventType.PROPERTYCHANGE,
|
||||||
this.handleFeatureChange_, this)
|
this.handleFeatureChange_, this)
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
@@ -314,7 +314,7 @@ _ol_source_Vector_.prototype.bindFeaturesCollection_ = function(collection) {
|
|||||||
modifyingCollection = false;
|
modifyingCollection = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_ol_events_.listen(collection, _ol_CollectionEventType_.ADD,
|
_ol_events_.listen(collection, CollectionEventType.ADD,
|
||||||
function(evt) {
|
function(evt) {
|
||||||
if (!modifyingCollection) {
|
if (!modifyingCollection) {
|
||||||
modifyingCollection = true;
|
modifyingCollection = true;
|
||||||
@@ -322,7 +322,7 @@ _ol_source_Vector_.prototype.bindFeaturesCollection_ = function(collection) {
|
|||||||
modifyingCollection = false;
|
modifyingCollection = false;
|
||||||
}
|
}
|
||||||
}, this);
|
}, this);
|
||||||
_ol_events_.listen(collection, _ol_CollectionEventType_.REMOVE,
|
_ol_events_.listen(collection, CollectionEventType.REMOVE,
|
||||||
function(evt) {
|
function(evt) {
|
||||||
if (!modifyingCollection) {
|
if (!modifyingCollection) {
|
||||||
modifyingCollection = true;
|
modifyingCollection = true;
|
||||||
|
|||||||
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* @module ol/style
|
* @module ol/style
|
||||||
*/
|
*/
|
||||||
import _ol_style_IconImageCache_ from './style/IconImageCache.js';
|
import IconImageCache from './style/IconImageCache.js';
|
||||||
var _ol_style_ = {};
|
var _ol_style_ = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The {@link ol.style.IconImageCache} for {@link ol.style.Icon} images.
|
* The {@link ol.style.IconImageCache} for {@link ol.style.Icon} images.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_style_.iconImageCache = new _ol_style_IconImageCache_();
|
_ol_style_.iconImageCache = new IconImageCache();
|
||||||
export default _ol_style_;
|
export default _ol_style_;
|
||||||
|
|||||||
+22
-22
@@ -2,14 +2,14 @@
|
|||||||
* @module ol/style/Icon
|
* @module ol/style/Icon
|
||||||
*/
|
*/
|
||||||
import {getUid, inherits} from '../index.js';
|
import {getUid, inherits} from '../index.js';
|
||||||
import _ol_ImageState_ from '../ImageState.js';
|
import ImageState from '../ImageState.js';
|
||||||
import {assert} from '../asserts.js';
|
import {assert} from '../asserts.js';
|
||||||
import _ol_color_ from '../color.js';
|
import _ol_color_ from '../color.js';
|
||||||
import _ol_events_ from '../events.js';
|
import _ol_events_ from '../events.js';
|
||||||
import EventType from '../events/EventType.js';
|
import EventType from '../events/EventType.js';
|
||||||
import _ol_style_IconAnchorUnits_ from '../style/IconAnchorUnits.js';
|
import IconAnchorUnits from '../style/IconAnchorUnits.js';
|
||||||
import _ol_style_IconImage_ from '../style/IconImage.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';
|
import _ol_style_Image_ from '../style/Image.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -42,21 +42,21 @@ var _ol_style_Icon_ = function(opt_options) {
|
|||||||
* @type {ol.style.IconOrigin}
|
* @type {ol.style.IconOrigin}
|
||||||
*/
|
*/
|
||||||
this.anchorOrigin_ = options.anchorOrigin !== undefined ?
|
this.anchorOrigin_ = options.anchorOrigin !== undefined ?
|
||||||
options.anchorOrigin : _ol_style_IconOrigin_.TOP_LEFT;
|
options.anchorOrigin : IconOrigin.TOP_LEFT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {ol.style.IconAnchorUnits}
|
* @type {ol.style.IconAnchorUnits}
|
||||||
*/
|
*/
|
||||||
this.anchorXUnits_ = options.anchorXUnits !== undefined ?
|
this.anchorXUnits_ = options.anchorXUnits !== undefined ?
|
||||||
options.anchorXUnits : _ol_style_IconAnchorUnits_.FRACTION;
|
options.anchorXUnits : IconAnchorUnits.FRACTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {ol.style.IconAnchorUnits}
|
* @type {ol.style.IconAnchorUnits}
|
||||||
*/
|
*/
|
||||||
this.anchorYUnits_ = options.anchorYUnits !== undefined ?
|
this.anchorYUnits_ = options.anchorYUnits !== undefined ?
|
||||||
options.anchorYUnits : _ol_style_IconAnchorUnits_.FRACTION;
|
options.anchorYUnits : IconAnchorUnits.FRACTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -95,7 +95,7 @@ var _ol_style_Icon_ = function(opt_options) {
|
|||||||
* @type {ol.ImageState}
|
* @type {ol.ImageState}
|
||||||
*/
|
*/
|
||||||
var imageState = options.src !== undefined ?
|
var imageState = options.src !== undefined ?
|
||||||
_ol_ImageState_.IDLE : _ol_ImageState_.LOADED;
|
ImageState.IDLE : ImageState.LOADED;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -122,7 +122,7 @@ var _ol_style_Icon_ = function(opt_options) {
|
|||||||
* @type {ol.style.IconOrigin}
|
* @type {ol.style.IconOrigin}
|
||||||
*/
|
*/
|
||||||
this.offsetOrigin_ = options.offsetOrigin !== undefined ?
|
this.offsetOrigin_ = options.offsetOrigin !== undefined ?
|
||||||
options.offsetOrigin : _ol_style_IconOrigin_.TOP_LEFT;
|
options.offsetOrigin : IconOrigin.TOP_LEFT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -212,33 +212,33 @@ _ol_style_Icon_.prototype.getAnchor = function() {
|
|||||||
}
|
}
|
||||||
var anchor = this.anchor_;
|
var anchor = this.anchor_;
|
||||||
var size = this.getSize();
|
var size = this.getSize();
|
||||||
if (this.anchorXUnits_ == _ol_style_IconAnchorUnits_.FRACTION ||
|
if (this.anchorXUnits_ == IconAnchorUnits.FRACTION ||
|
||||||
this.anchorYUnits_ == _ol_style_IconAnchorUnits_.FRACTION) {
|
this.anchorYUnits_ == IconAnchorUnits.FRACTION) {
|
||||||
if (!size) {
|
if (!size) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
anchor = this.anchor_.slice();
|
anchor = this.anchor_.slice();
|
||||||
if (this.anchorXUnits_ == _ol_style_IconAnchorUnits_.FRACTION) {
|
if (this.anchorXUnits_ == IconAnchorUnits.FRACTION) {
|
||||||
anchor[0] *= size[0];
|
anchor[0] *= size[0];
|
||||||
}
|
}
|
||||||
if (this.anchorYUnits_ == _ol_style_IconAnchorUnits_.FRACTION) {
|
if (this.anchorYUnits_ == IconAnchorUnits.FRACTION) {
|
||||||
anchor[1] *= size[1];
|
anchor[1] *= size[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.anchorOrigin_ != _ol_style_IconOrigin_.TOP_LEFT) {
|
if (this.anchorOrigin_ != IconOrigin.TOP_LEFT) {
|
||||||
if (!size) {
|
if (!size) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (anchor === this.anchor_) {
|
if (anchor === this.anchor_) {
|
||||||
anchor = this.anchor_.slice();
|
anchor = this.anchor_.slice();
|
||||||
}
|
}
|
||||||
if (this.anchorOrigin_ == _ol_style_IconOrigin_.TOP_RIGHT ||
|
if (this.anchorOrigin_ == IconOrigin.TOP_RIGHT ||
|
||||||
this.anchorOrigin_ == _ol_style_IconOrigin_.BOTTOM_RIGHT) {
|
this.anchorOrigin_ == IconOrigin.BOTTOM_RIGHT) {
|
||||||
anchor[0] = -anchor[0] + size[0];
|
anchor[0] = -anchor[0] + size[0];
|
||||||
}
|
}
|
||||||
if (this.anchorOrigin_ == _ol_style_IconOrigin_.BOTTOM_LEFT ||
|
if (this.anchorOrigin_ == IconOrigin.BOTTOM_LEFT ||
|
||||||
this.anchorOrigin_ == _ol_style_IconOrigin_.BOTTOM_RIGHT) {
|
this.anchorOrigin_ == IconOrigin.BOTTOM_RIGHT) {
|
||||||
anchor[1] = -anchor[1] + size[1];
|
anchor[1] = -anchor[1] + size[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -311,19 +311,19 @@ _ol_style_Icon_.prototype.getOrigin = function() {
|
|||||||
}
|
}
|
||||||
var offset = this.offset_;
|
var offset = this.offset_;
|
||||||
|
|
||||||
if (this.offsetOrigin_ != _ol_style_IconOrigin_.TOP_LEFT) {
|
if (this.offsetOrigin_ != IconOrigin.TOP_LEFT) {
|
||||||
var size = this.getSize();
|
var size = this.getSize();
|
||||||
var iconImageSize = this.iconImage_.getSize();
|
var iconImageSize = this.iconImage_.getSize();
|
||||||
if (!size || !iconImageSize) {
|
if (!size || !iconImageSize) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
offset = offset.slice();
|
offset = offset.slice();
|
||||||
if (this.offsetOrigin_ == _ol_style_IconOrigin_.TOP_RIGHT ||
|
if (this.offsetOrigin_ == IconOrigin.TOP_RIGHT ||
|
||||||
this.offsetOrigin_ == _ol_style_IconOrigin_.BOTTOM_RIGHT) {
|
this.offsetOrigin_ == IconOrigin.BOTTOM_RIGHT) {
|
||||||
offset[0] = iconImageSize[0] - size[0] - offset[0];
|
offset[0] = iconImageSize[0] - size[0] - offset[0];
|
||||||
}
|
}
|
||||||
if (this.offsetOrigin_ == _ol_style_IconOrigin_.BOTTOM_LEFT ||
|
if (this.offsetOrigin_ == IconOrigin.BOTTOM_LEFT ||
|
||||||
this.offsetOrigin_ == _ol_style_IconOrigin_.BOTTOM_RIGHT) {
|
this.offsetOrigin_ == IconOrigin.BOTTOM_RIGHT) {
|
||||||
offset[1] = iconImageSize[1] - size[1] - offset[1];
|
offset[1] = iconImageSize[1] - size[1] - offset[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import {createCanvasContext2D} from '../dom.js';
|
|||||||
import _ol_events_ from '../events.js';
|
import _ol_events_ from '../events.js';
|
||||||
import EventTarget from '../events/EventTarget.js';
|
import EventTarget from '../events/EventTarget.js';
|
||||||
import EventType from '../events/EventType.js';
|
import EventType from '../events/EventType.js';
|
||||||
import _ol_ImageState_ from '../ImageState.js';
|
import ImageState from '../ImageState.js';
|
||||||
import _ol_style_ from '../style.js';
|
import _ol_style_ from '../style.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -83,7 +83,7 @@ var _ol_style_IconImage_ = function(image, src, size, crossOrigin, imageState,
|
|||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
this.tainting_ = false;
|
this.tainting_ = false;
|
||||||
if (this.imageState_ == _ol_ImageState_.LOADED) {
|
if (this.imageState_ == ImageState.LOADED) {
|
||||||
this.determineTainting_();
|
this.determineTainting_();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,7 +140,7 @@ _ol_style_IconImage_.prototype.dispatchChangeEvent_ = function() {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_style_IconImage_.prototype.handleImageError_ = function() {
|
_ol_style_IconImage_.prototype.handleImageError_ = function() {
|
||||||
this.imageState_ = _ol_ImageState_.ERROR;
|
this.imageState_ = ImageState.ERROR;
|
||||||
this.unlistenImage_();
|
this.unlistenImage_();
|
||||||
this.dispatchChangeEvent_();
|
this.dispatchChangeEvent_();
|
||||||
};
|
};
|
||||||
@@ -150,7 +150,7 @@ _ol_style_IconImage_.prototype.handleImageError_ = function() {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_style_IconImage_.prototype.handleImageLoad_ = function() {
|
_ol_style_IconImage_.prototype.handleImageLoad_ = function() {
|
||||||
this.imageState_ = _ol_ImageState_.LOADED;
|
this.imageState_ = ImageState.LOADED;
|
||||||
if (this.size_) {
|
if (this.size_) {
|
||||||
this.image_.width = this.size_[0];
|
this.image_.width = this.size_[0];
|
||||||
this.image_.height = this.size_[1];
|
this.image_.height = this.size_[1];
|
||||||
@@ -220,8 +220,8 @@ _ol_style_IconImage_.prototype.getSrc = function() {
|
|||||||
* Load not yet loaded URI.
|
* Load not yet loaded URI.
|
||||||
*/
|
*/
|
||||||
_ol_style_IconImage_.prototype.load = function() {
|
_ol_style_IconImage_.prototype.load = function() {
|
||||||
if (this.imageState_ == _ol_ImageState_.IDLE) {
|
if (this.imageState_ == ImageState.IDLE) {
|
||||||
this.imageState_ = _ol_ImageState_.LOADING;
|
this.imageState_ = ImageState.LOADING;
|
||||||
this.imageListenerKeys_ = [
|
this.imageListenerKeys_ = [
|
||||||
_ol_events_.listenOnce(this.image_, EventType.ERROR,
|
_ol_events_.listenOnce(this.image_, EventType.ERROR,
|
||||||
this.handleImageError_, this),
|
this.handleImageError_, this),
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import _ol_color_ from '../color.js';
|
|||||||
* Singleton class. Available through {@link ol.style.iconImageCache}.
|
* Singleton class. Available through {@link ol.style.iconImageCache}.
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
var _ol_style_IconImageCache_ = function() {
|
var IconImageCache = function() {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {Object.<string, ol.style.IconImage>}
|
* @type {Object.<string, ol.style.IconImage>}
|
||||||
@@ -35,16 +35,16 @@ var _ol_style_IconImageCache_ = function() {
|
|||||||
* @param {ol.Color} color Color.
|
* @param {ol.Color} color Color.
|
||||||
* @return {string} Cache key.
|
* @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';
|
var colorString = color ? _ol_color_.asString(color) : 'null';
|
||||||
return crossOrigin + ':' + src + ':' + colorString;
|
return crossOrigin + ':' + src + ':' + colorString;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME empty description for jsdoc
|
* FIXME empty description for jsdoc
|
||||||
*/
|
*/
|
||||||
_ol_style_IconImageCache_.prototype.clear = function() {
|
IconImageCache.prototype.clear = function() {
|
||||||
this.cache_ = {};
|
this.cache_ = {};
|
||||||
this.cacheSize_ = 0;
|
this.cacheSize_ = 0;
|
||||||
};
|
};
|
||||||
@@ -53,7 +53,7 @@ _ol_style_IconImageCache_.prototype.clear = function() {
|
|||||||
/**
|
/**
|
||||||
* FIXME empty description for jsdoc
|
* FIXME empty description for jsdoc
|
||||||
*/
|
*/
|
||||||
_ol_style_IconImageCache_.prototype.expire = function() {
|
IconImageCache.prototype.expire = function() {
|
||||||
if (this.cacheSize_ > this.maxCacheSize_) {
|
if (this.cacheSize_ > this.maxCacheSize_) {
|
||||||
var i = 0;
|
var i = 0;
|
||||||
var key, iconImage;
|
var key, iconImage;
|
||||||
@@ -74,8 +74,8 @@ _ol_style_IconImageCache_.prototype.expire = function() {
|
|||||||
* @param {ol.Color} color Color.
|
* @param {ol.Color} color Color.
|
||||||
* @return {ol.style.IconImage} Icon image.
|
* @return {ol.style.IconImage} Icon image.
|
||||||
*/
|
*/
|
||||||
_ol_style_IconImageCache_.prototype.get = function(src, crossOrigin, color) {
|
IconImageCache.prototype.get = function(src, crossOrigin, color) {
|
||||||
var key = _ol_style_IconImageCache_.getKey(src, crossOrigin, color);
|
var key = getKey(src, crossOrigin, color);
|
||||||
return key in this.cache_ ? this.cache_[key] : null;
|
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.Color} color Color.
|
||||||
* @param {ol.style.IconImage} iconImage Icon image.
|
* @param {ol.style.IconImage} iconImage Icon image.
|
||||||
*/
|
*/
|
||||||
_ol_style_IconImageCache_.prototype.set = function(src, crossOrigin, color, iconImage) {
|
IconImageCache.prototype.set = function(src, crossOrigin, color, iconImage) {
|
||||||
var key = _ol_style_IconImageCache_.getKey(src, crossOrigin, color);
|
var key = getKey(src, crossOrigin, color);
|
||||||
this.cache_[key] = iconImage;
|
this.cache_[key] = iconImage;
|
||||||
++this.cacheSize_;
|
++this.cacheSize_;
|
||||||
};
|
};
|
||||||
@@ -100,8 +100,8 @@ _ol_style_IconImageCache_.prototype.set = function(src, crossOrigin, color, icon
|
|||||||
* @param {number} maxCacheSize Cache max size.
|
* @param {number} maxCacheSize Cache max size.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_style_IconImageCache_.prototype.setSize = function(maxCacheSize) {
|
IconImageCache.prototype.setSize = function(maxCacheSize) {
|
||||||
this.maxCacheSize_ = maxCacheSize;
|
this.maxCacheSize_ = maxCacheSize;
|
||||||
this.expire();
|
this.expire();
|
||||||
};
|
};
|
||||||
export default _ol_style_IconImageCache_;
|
export default IconImageCache;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import {inherits} from '../index.js';
|
|||||||
import {asColorLike} from '../colorlike.js';
|
import {asColorLike} from '../colorlike.js';
|
||||||
import {createCanvasContext2D} from '../dom.js';
|
import {createCanvasContext2D} from '../dom.js';
|
||||||
import _ol_has_ from '../has.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_render_canvas_ from '../render/canvas.js';
|
||||||
import _ol_style_Image_ from '../style/Image.js';
|
import _ol_style_Image_ from '../style/Image.js';
|
||||||
|
|
||||||
@@ -228,7 +228,7 @@ _ol_style_RegularShape_.prototype.getHitDetectionImageSize = function() {
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
_ol_style_RegularShape_.prototype.getImageState = function() {
|
_ol_style_RegularShape_.prototype.getImageState = function() {
|
||||||
return _ol_ImageState_.LOADED;
|
return ImageState.LOADED;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* @module ol/style/Text
|
* @module ol/style/Text
|
||||||
*/
|
*/
|
||||||
import _ol_style_Fill_ from '../style/Fill.js';
|
import _ol_style_Fill_ from '../style/Fill.js';
|
||||||
import _ol_style_TextPlacement_ from '../style/TextPlacement.js';
|
import TextPlacement from '../style/TextPlacement.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @classdesc
|
* @classdesc
|
||||||
@@ -75,7 +75,7 @@ var _ol_style_Text_ = function(opt_options) {
|
|||||||
* @private
|
* @private
|
||||||
* @type {ol.style.TextPlacement|string}
|
* @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
|
* @private
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import _ol_events_ from '../../../src/ol/events.js';
|
import _ol_events_ from '../../../src/ol/events.js';
|
||||||
import _ol_Collection_ from '../../../src/ol/Collection.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() {
|
describe('ol.collection', function() {
|
||||||
@@ -129,7 +129,7 @@ describe('ol.collection', function() {
|
|||||||
it('fires a remove event', function() {
|
it('fires a remove event', function() {
|
||||||
var collection = new _ol_Collection_([0, 1, 2]);
|
var collection = new _ol_Collection_([0, 1, 2]);
|
||||||
var cb = sinon.spy();
|
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(collection.remove(1)).to.eql(1);
|
||||||
expect(cb).to.be.called();
|
expect(cb).to.be.called();
|
||||||
expect(cb.lastCall.args[0].element).to.eql(1);
|
expect(cb.lastCall.args[0].element).to.eql(1);
|
||||||
@@ -152,11 +152,11 @@ describe('ol.collection', function() {
|
|||||||
it('does dispatch events', function() {
|
it('does dispatch events', function() {
|
||||||
var collection = new _ol_Collection_(['a', 'b']);
|
var collection = new _ol_Collection_(['a', 'b']);
|
||||||
var added, removed;
|
var added, removed;
|
||||||
_ol_events_.listen(collection, _ol_CollectionEventType_.ADD, function(e) {
|
_ol_events_.listen(collection, CollectionEventType.ADD, function(e) {
|
||||||
added = e.element;
|
added = e.element;
|
||||||
});
|
});
|
||||||
_ol_events_.listen(
|
_ol_events_.listen(
|
||||||
collection, _ol_CollectionEventType_.REMOVE, function(e) {
|
collection, CollectionEventType.REMOVE, function(e) {
|
||||||
removed = e.element;
|
removed = e.element;
|
||||||
});
|
});
|
||||||
collection.setAt(1, 1);
|
collection.setAt(1, 1);
|
||||||
@@ -170,7 +170,7 @@ describe('ol.collection', function() {
|
|||||||
var collection = new _ol_Collection_(['a']);
|
var collection = new _ol_Collection_(['a']);
|
||||||
var removed;
|
var removed;
|
||||||
_ol_events_.listen(
|
_ol_events_.listen(
|
||||||
collection, _ol_CollectionEventType_.REMOVE, function(e) {
|
collection, CollectionEventType.REMOVE, function(e) {
|
||||||
removed = e.element;
|
removed = e.element;
|
||||||
});
|
});
|
||||||
collection.pop();
|
collection.pop();
|
||||||
@@ -183,7 +183,7 @@ describe('ol.collection', function() {
|
|||||||
var collection = new _ol_Collection_([0, 2]);
|
var collection = new _ol_Collection_([0, 2]);
|
||||||
var added;
|
var added;
|
||||||
_ol_events_.listen(
|
_ol_events_.listen(
|
||||||
collection, _ol_CollectionEventType_.ADD, function(e) {
|
collection, CollectionEventType.ADD, function(e) {
|
||||||
added = e.element;
|
added = e.element;
|
||||||
});
|
});
|
||||||
collection.insertAt(1, 1);
|
collection.insertAt(1, 1);
|
||||||
@@ -195,7 +195,7 @@ describe('ol.collection', function() {
|
|||||||
it('triggers events properly', function() {
|
it('triggers events properly', function() {
|
||||||
var added = [];
|
var added = [];
|
||||||
_ol_events_.listen(
|
_ol_events_.listen(
|
||||||
collection, _ol_CollectionEventType_.ADD, function(e) {
|
collection, CollectionEventType.ADD, function(e) {
|
||||||
added.push(e.element);
|
added.push(e.element);
|
||||||
});
|
});
|
||||||
collection.setAt(2, 0);
|
collection.setAt(2, 0);
|
||||||
@@ -244,7 +244,7 @@ describe('ol.collection', function() {
|
|||||||
it('triggers add when pushing', function() {
|
it('triggers add when pushing', function() {
|
||||||
var collection = new _ol_Collection_();
|
var collection = new _ol_Collection_();
|
||||||
var elem;
|
var elem;
|
||||||
_ol_events_.listen(collection, _ol_CollectionEventType_.ADD, function(e) {
|
_ol_events_.listen(collection, CollectionEventType.ADD, function(e) {
|
||||||
elem = e.element;
|
elem = e.element;
|
||||||
});
|
});
|
||||||
var length = collection.push(1);
|
var length = collection.push(1);
|
||||||
@@ -261,8 +261,8 @@ describe('ol.collection', function() {
|
|||||||
});
|
});
|
||||||
describe('setAt', function() {
|
describe('setAt', function() {
|
||||||
it('triggers remove', function() {
|
it('triggers remove', function() {
|
||||||
_ol_events_.listen(collection, _ol_CollectionEventType_.ADD, cb1);
|
_ol_events_.listen(collection, CollectionEventType.ADD, cb1);
|
||||||
_ol_events_.listen(collection, _ol_CollectionEventType_.REMOVE, cb2);
|
_ol_events_.listen(collection, CollectionEventType.REMOVE, cb2);
|
||||||
collection.setAt(0, 2);
|
collection.setAt(0, 2);
|
||||||
expect(cb2.lastCall.args[0].element).to.eql(1);
|
expect(cb2.lastCall.args[0].element).to.eql(1);
|
||||||
expect(cb1.lastCall.args[0].element).to.eql(2);
|
expect(cb1.lastCall.args[0].element).to.eql(2);
|
||||||
@@ -270,7 +270,7 @@ describe('ol.collection', function() {
|
|||||||
});
|
});
|
||||||
describe('pop', function() {
|
describe('pop', function() {
|
||||||
it('triggers remove', function() {
|
it('triggers remove', function() {
|
||||||
_ol_events_.listen(collection, _ol_CollectionEventType_.REMOVE, cb1);
|
_ol_events_.listen(collection, CollectionEventType.REMOVE, cb1);
|
||||||
collection.pop();
|
collection.pop();
|
||||||
expect(cb1.lastCall.args[0].element).to.eql(1);
|
expect(cb1.lastCall.args[0].element).to.eql(1);
|
||||||
});
|
});
|
||||||
@@ -288,7 +288,7 @@ describe('ol.collection', function() {
|
|||||||
it('fires events', function() {
|
it('fires events', function() {
|
||||||
var collection = new _ol_Collection_();
|
var collection = new _ol_Collection_();
|
||||||
var elems = [];
|
var elems = [];
|
||||||
_ol_events_.listen(collection, _ol_CollectionEventType_.ADD, function(e) {
|
_ol_events_.listen(collection, CollectionEventType.ADD, function(e) {
|
||||||
elems.push(e.element);
|
elems.push(e.element);
|
||||||
});
|
});
|
||||||
collection.extend([1, 2]);
|
collection.extend([1, 2]);
|
||||||
|
|||||||
@@ -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_Circle_ from '../../../../src/ol/style/Circle.js';
|
||||||
import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js';
|
import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js';
|
||||||
import _ol_style_Icon_ from '../../../../src/ol/style/Icon.js';
|
import _ol_style_Icon_ from '../../../../src/ol/style/Icon.js';
|
||||||
import _ol_style_IconAnchorUnits_ from '../../../../src/ol/style/IconAnchorUnits.js';
|
import IconAnchorUnits from '../../../../src/ol/style/IconAnchorUnits.js';
|
||||||
import _ol_style_IconOrigin_ from '../../../../src/ol/style/IconOrigin.js';
|
import IconOrigin from '../../../../src/ol/style/IconOrigin.js';
|
||||||
import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js';
|
import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js';
|
||||||
import _ol_style_Style_ from '../../../../src/ol/style/Style.js';
|
import _ol_style_Style_ from '../../../../src/ol/style/Style.js';
|
||||||
import _ol_style_Text_ from '../../../../src/ol/style/Text.js';
|
import _ol_style_Text_ from '../../../../src/ol/style/Text.js';
|
||||||
@@ -1843,25 +1843,25 @@ describe('ol.format.KML', function() {
|
|||||||
if (f.getId() == 1) {
|
if (f.getId() == 1) {
|
||||||
expect(imageStyle.anchor_[0]).to.be(0.5);
|
expect(imageStyle.anchor_[0]).to.be(0.5);
|
||||||
expect(imageStyle.anchor_[1]).to.be(0.5);
|
expect(imageStyle.anchor_[1]).to.be(0.5);
|
||||||
expect(imageStyle.anchorOrigin_).to.be(_ol_style_IconOrigin_.BOTTOM_LEFT);
|
expect(imageStyle.anchorOrigin_).to.be(IconOrigin.BOTTOM_LEFT);
|
||||||
expect(imageStyle.anchorXUnits_).to.be(_ol_style_IconAnchorUnits_.FRACTION);
|
expect(imageStyle.anchorXUnits_).to.be(IconAnchorUnits.FRACTION);
|
||||||
expect(imageStyle.anchorYUnits_).to.be(_ol_style_IconAnchorUnits_.FRACTION);
|
expect(imageStyle.anchorYUnits_).to.be(IconAnchorUnits.FRACTION);
|
||||||
} else {
|
} else {
|
||||||
expect(imageStyle.anchor_[0]).to.be(5);
|
expect(imageStyle.anchor_[0]).to.be(5);
|
||||||
expect(imageStyle.anchor_[1]).to.be(5);
|
expect(imageStyle.anchor_[1]).to.be(5);
|
||||||
expect(imageStyle.anchorXUnits_).to.be(_ol_style_IconAnchorUnits_.PIXELS);
|
expect(imageStyle.anchorXUnits_).to.be(IconAnchorUnits.PIXELS);
|
||||||
expect(imageStyle.anchorYUnits_).to.be(_ol_style_IconAnchorUnits_.PIXELS);
|
expect(imageStyle.anchorYUnits_).to.be(IconAnchorUnits.PIXELS);
|
||||||
if (f.getId() == 2) {
|
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) {
|
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) {
|
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) {
|
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);
|
expect(imageStyle.getRotation()).to.eql(0);
|
||||||
|
|||||||
@@ -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() {
|
describe('ol.layer.Heatmap', function() {
|
||||||
@@ -6,8 +6,8 @@ describe('ol.layer.Heatmap', function() {
|
|||||||
describe('constructor', function() {
|
describe('constructor', function() {
|
||||||
|
|
||||||
it('can be constructed without arguments', function() {
|
it('can be constructed without arguments', function() {
|
||||||
var instance = new _ol_layer_Heatmap_();
|
var instance = new HeatmapLayer();
|
||||||
expect(instance).to.be.an(_ol_layer_Heatmap_);
|
expect(instance).to.be.an(HeatmapLayer);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import _ol_Feature_ from '../../../src/ol/Feature.js';
|
import _ol_Feature_ from '../../../src/ol/Feature.js';
|
||||||
import _ol_Map_ from '../../../src/ol/Map.js';
|
import _ol_Map_ from '../../../src/ol/Map.js';
|
||||||
import MapEvent from '../../../src/ol/MapEvent.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 _ol_View_ from '../../../src/ol/View.js';
|
||||||
import Point from '../../../src/ol/geom/Point.js';
|
import Point from '../../../src/ol/geom/Point.js';
|
||||||
import _ol_has_ from '../../../src/ol/has.js';
|
import _ol_has_ from '../../../src/ol/has.js';
|
||||||
@@ -610,7 +610,7 @@ describe('ol.Map', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('returns an overlay by id', function() {
|
it('returns an overlay by id', function() {
|
||||||
overlay = new _ol_Overlay_({
|
overlay = new Overlay({
|
||||||
id: 'foo',
|
id: 'foo',
|
||||||
element: overlay_target,
|
element: overlay_target,
|
||||||
position: [0, 0]
|
position: [0, 0]
|
||||||
@@ -620,7 +620,7 @@ describe('ol.Map', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('returns null when no overlay is found', function() {
|
it('returns null when no overlay is found', function() {
|
||||||
overlay = new _ol_Overlay_({
|
overlay = new Overlay({
|
||||||
id: 'foo',
|
id: 'foo',
|
||||||
element: overlay_target,
|
element: overlay_target,
|
||||||
position: [0, 0]
|
position: [0, 0]
|
||||||
@@ -630,7 +630,7 @@ describe('ol.Map', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('returns null after removing overlay', function() {
|
it('returns null after removing overlay', function() {
|
||||||
overlay = new _ol_Overlay_({
|
overlay = new Overlay({
|
||||||
id: 'foo',
|
id: 'foo',
|
||||||
element: overlay_target,
|
element: overlay_target,
|
||||||
position: [0, 0]
|
position: [0, 0]
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import _ol_Map_ from '../../../src/ol/Map.js';
|
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';
|
import _ol_View_ from '../../../src/ol/View.js';
|
||||||
|
|
||||||
|
|
||||||
@@ -38,13 +38,13 @@ describe('ol.Overlay', function() {
|
|||||||
describe('constructor', function() {
|
describe('constructor', function() {
|
||||||
|
|
||||||
it('can be constructed with minimal arguments', function() {
|
it('can be constructed with minimal arguments', function() {
|
||||||
var instance = new _ol_Overlay_({});
|
var instance = new Overlay({});
|
||||||
expect(instance).to.be.an(_ol_Overlay_);
|
expect(instance).to.be.an(Overlay);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('can be constructed with className', function() {
|
it('can be constructed with className', function() {
|
||||||
var instance = new _ol_Overlay_({className: 'my-class'});
|
var instance = new Overlay({className: 'my-class'});
|
||||||
expect(instance).to.be.an(_ol_Overlay_);
|
expect(instance).to.be.an(Overlay);
|
||||||
expect(instance.element.className).to.be('my-class');
|
expect(instance.element.className).to.be('my-class');
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -61,14 +61,14 @@ describe('ol.Overlay', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('returns the overlay identifier', function() {
|
it('returns the overlay identifier', function() {
|
||||||
overlay = new _ol_Overlay_({
|
overlay = new Overlay({
|
||||||
element: target,
|
element: target,
|
||||||
position: [0, 0]
|
position: [0, 0]
|
||||||
});
|
});
|
||||||
map.addOverlay(overlay);
|
map.addOverlay(overlay);
|
||||||
expect(overlay.getId()).to.be(undefined);
|
expect(overlay.getId()).to.be(undefined);
|
||||||
map.removeOverlay(overlay);
|
map.removeOverlay(overlay);
|
||||||
overlay = new _ol_Overlay_({
|
overlay = new Overlay({
|
||||||
id: 'foo',
|
id: 'foo',
|
||||||
element: target,
|
element: target,
|
||||||
position: [0, 0]
|
position: [0, 0]
|
||||||
@@ -90,7 +90,7 @@ describe('ol.Overlay', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('changes the CSS display value', function() {
|
it('changes the CSS display value', function() {
|
||||||
overlay = new _ol_Overlay_({
|
overlay = new Overlay({
|
||||||
element: target,
|
element: target,
|
||||||
position: [0, 0]
|
position: [0, 0]
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user