Icon images are handled by a separate class

This commit is contained in:
Éric Lemoine
2014-02-03 13:58:20 +01:00
parent e0db06c39a
commit 3626ff5b16
3 changed files with 315 additions and 137 deletions
+36 -61
View File
@@ -2,9 +2,6 @@ goog.provide('ol.style.Image');
goog.provide('ol.style.ImageState');
goog.require('goog.array');
goog.require('goog.events');
goog.require('goog.events.EventTarget');
goog.require('goog.events.EventType');
/**
@@ -19,11 +16,8 @@ ol.style.ImageState = {
/**
* @typedef {{anchor: Array.<number>,
* imageState: ol.style.ImageState,
* rotation: number,
* @typedef {{rotation: number,
* scale: number,
* size: ol.Size,
* snapToPixel: (boolean|undefined),
* subtractViewRotation: boolean}}
*/
@@ -34,24 +28,9 @@ ol.style.ImageOptions;
/**
* @constructor
* @param {ol.style.ImageOptions} options Options.
* @extends {goog.events.EventTarget}
*/
ol.style.Image = function(options) {
goog.base(this);
/**
* @protected
* @type {Array.<number>}
*/
this.anchor = options.anchor;
/**
* @protected
* @type {ol.style.ImageState}
*/
this.imageState = options.imageState;
/**
* @private
* @type {number}
@@ -64,12 +43,6 @@ ol.style.Image = function(options) {
*/
this.scale_ = options.scale;
/**
* @protected
* @type {ol.Size}
*/
this.size = options.size;
/**
* @private
* @type {boolean|undefined}
@@ -83,31 +56,6 @@ ol.style.Image = function(options) {
this.subtractViewRotation_ = options.subtractViewRotation;
};
goog.inherits(ol.style.Image, goog.events.EventTarget);
/**
* @protected
*/
ol.style.Image.prototype.dispatchChangeEvent = function() {
this.dispatchEvent(goog.events.EventType.CHANGE);
};
/**
* @return {Array.<number>} Anchor.
*/
ol.style.Image.prototype.getAnchor = function() {
return this.anchor;
};
/**
* @return {ol.style.ImageState} Image state.
*/
ol.style.Image.prototype.getImageState = function() {
return this.imageState;
};
/**
@@ -126,14 +74,6 @@ ol.style.Image.prototype.getScale = function() {
};
/**
* @return {ol.Size} Size.
*/
ol.style.Image.prototype.getSize = function() {
return this.size;
};
/**
* @return {boolean|undefined} Snap to pixel?
*/
@@ -150,6 +90,12 @@ ol.style.Image.prototype.getSubtractViewRotation = function() {
};
/**
* @return {Array.<number>} Anchor.
*/
ol.style.Image.prototype.getAnchor = goog.abstractMethod;
/**
* @param {number} pixelRatio Pixel ratio.
* @return {HTMLCanvasElement|HTMLVideoElement|Image} Image element.
@@ -157,6 +103,12 @@ ol.style.Image.prototype.getSubtractViewRotation = function() {
ol.style.Image.prototype.getImage = goog.abstractMethod;
/**
* @return {ol.style.ImageState} Image state.
*/
ol.style.Image.prototype.getImageState = goog.abstractMethod;
/**
* @param {number} pixelRatio Pixel ratio.
* @return {HTMLCanvasElement|HTMLVideoElement|Image} Image element.
@@ -164,7 +116,30 @@ ol.style.Image.prototype.getImage = goog.abstractMethod;
ol.style.Image.prototype.getHitDetectionImage = goog.abstractMethod;
/**
* @return {ol.Size} Size.
*/
ol.style.Image.prototype.getSize = goog.abstractMethod;
/**
* @param {function(this: T, goog.events.Event)} listener Listener function.
* @param {T} thisArg Value to use as `this` when executing `listener`.
* @return {goog.events.Key|undefined} Listener key.
* @template T
*/
ol.style.Image.prototype.listenImageChange = goog.abstractMethod;
/**
* Load not yet loaded URI.
*/
ol.style.Image.prototype.load = goog.abstractMethod;
/**
* @param {function(this: T, goog.events.Event)} listener Listener function.
* @param {T} thisArg Value to use as `this` when executing `listener`.
* @template T
*/
ol.style.Image.prototype.unlistenImageChange = goog.abstractMethod;