Transformed

This commit is contained in:
Tim Schaub
2017-12-11 16:29:33 -07:00
parent 1cdb6a66f0
commit 7f47883c48
737 changed files with 22216 additions and 21609 deletions

View File

@@ -1,16 +1,16 @@
goog.provide('ol.style.Icon');
goog.require('ol');
goog.require('ol.ImageState');
goog.require('ol.asserts');
goog.require('ol.color');
goog.require('ol.events');
goog.require('ol.events.EventType');
goog.require('ol.style.IconAnchorUnits');
goog.require('ol.style.IconImage');
goog.require('ol.style.IconOrigin');
goog.require('ol.style.Image');
/**
* @module ol/style/Icon
*/
import _ol_ from '../index.js';
import _ol_ImageState_ from '../ImageState.js';
import _ol_asserts_ from '../asserts.js';
import _ol_color_ from '../color.js';
import _ol_events_ from '../events.js';
import _ol_events_EventType_ from '../events/EventType.js';
import _ol_style_IconAnchorUnits_ from '../style/IconAnchorUnits.js';
import _ol_style_IconImage_ from '../style/IconImage.js';
import _ol_style_IconOrigin_ from '../style/IconOrigin.js';
import _ol_style_Image_ from '../style/Image.js';
/**
* @classdesc
@@ -21,7 +21,7 @@ goog.require('ol.style.Image');
* @extends {ol.style.Image}
* @api
*/
ol.style.Icon = function(opt_options) {
var _ol_style_Icon_ = function(opt_options) {
var options = opt_options || {};
@@ -42,21 +42,21 @@ ol.style.Icon = function(opt_options) {
* @type {ol.style.IconOrigin}
*/
this.anchorOrigin_ = options.anchorOrigin !== undefined ?
options.anchorOrigin : ol.style.IconOrigin.TOP_LEFT;
options.anchorOrigin : _ol_style_IconOrigin_.TOP_LEFT;
/**
* @private
* @type {ol.style.IconAnchorUnits}
*/
this.anchorXUnits_ = options.anchorXUnits !== undefined ?
options.anchorXUnits : ol.style.IconAnchorUnits.FRACTION;
options.anchorXUnits : _ol_style_IconAnchorUnits_.FRACTION;
/**
* @private
* @type {ol.style.IconAnchorUnits}
*/
this.anchorYUnits_ = options.anchorYUnits !== undefined ?
options.anchorYUnits : ol.style.IconAnchorUnits.FRACTION;
options.anchorYUnits : _ol_style_IconAnchorUnits_.FRACTION;
/**
* @private
@@ -80,35 +80,35 @@ ol.style.Icon = function(opt_options) {
*/
var src = options.src;
ol.asserts.assert(!(src !== undefined && image),
_ol_asserts_.assert(!(src !== undefined && image),
4); // `image` and `src` cannot be provided at the same time
ol.asserts.assert(!image || (image && imgSize),
_ol_asserts_.assert(!image || (image && imgSize),
5); // `imgSize` must be set when `image` is provided
if ((src === undefined || src.length === 0) && image) {
src = image.src || ol.getUid(image).toString();
src = image.src || _ol_.getUid(image).toString();
}
ol.asserts.assert(src !== undefined && src.length > 0,
_ol_asserts_.assert(src !== undefined && src.length > 0,
6); // A defined and non-empty `src` or `image` must be provided
/**
* @type {ol.ImageState}
*/
var imageState = options.src !== undefined ?
ol.ImageState.IDLE : ol.ImageState.LOADED;
_ol_ImageState_.IDLE : _ol_ImageState_.LOADED;
/**
* @private
* @type {ol.Color}
*/
this.color_ = options.color !== undefined ? ol.color.asArray(options.color) :
this.color_ = options.color !== undefined ? _ol_color_.asArray(options.color) :
null;
/**
* @private
* @type {ol.style.IconImage}
*/
this.iconImage_ = ol.style.IconImage.get(
this.iconImage_ = _ol_style_IconImage_.get(
image, /** @type {string} */ (src), imgSize, this.crossOrigin_, imageState, this.color_);
/**
@@ -122,7 +122,7 @@ ol.style.Icon = function(opt_options) {
* @type {ol.style.IconOrigin}
*/
this.offsetOrigin_ = options.offsetOrigin !== undefined ?
options.offsetOrigin : ol.style.IconOrigin.TOP_LEFT;
options.offsetOrigin : _ol_style_IconOrigin_.TOP_LEFT;
/**
* @private
@@ -163,7 +163,7 @@ ol.style.Icon = function(opt_options) {
var snapToPixel = options.snapToPixel !== undefined ?
options.snapToPixel : true;
ol.style.Image.call(this, {
_ol_style_Image_.call(this, {
opacity: opacity,
rotation: rotation,
scale: scale,
@@ -172,7 +172,8 @@ ol.style.Icon = function(opt_options) {
});
};
ol.inherits(ol.style.Icon, ol.style.Image);
_ol_.inherits(_ol_style_Icon_, _ol_style_Image_);
/**
@@ -180,8 +181,8 @@ ol.inherits(ol.style.Icon, ol.style.Image);
* @return {ol.style.Icon} The cloned style.
* @api
*/
ol.style.Icon.prototype.clone = function() {
return new ol.style.Icon({
_ol_style_Icon_.prototype.clone = function() {
return new _ol_style_Icon_({
anchor: this.anchor_.slice(),
anchorOrigin: this.anchorOrigin_,
anchorXUnits: this.anchorXUnits_,
@@ -205,39 +206,39 @@ ol.style.Icon.prototype.clone = function() {
* @inheritDoc
* @api
*/
ol.style.Icon.prototype.getAnchor = function() {
_ol_style_Icon_.prototype.getAnchor = function() {
if (this.normalizedAnchor_) {
return this.normalizedAnchor_;
}
var anchor = this.anchor_;
var size = this.getSize();
if (this.anchorXUnits_ == ol.style.IconAnchorUnits.FRACTION ||
this.anchorYUnits_ == ol.style.IconAnchorUnits.FRACTION) {
if (this.anchorXUnits_ == _ol_style_IconAnchorUnits_.FRACTION ||
this.anchorYUnits_ == _ol_style_IconAnchorUnits_.FRACTION) {
if (!size) {
return null;
}
anchor = this.anchor_.slice();
if (this.anchorXUnits_ == ol.style.IconAnchorUnits.FRACTION) {
if (this.anchorXUnits_ == _ol_style_IconAnchorUnits_.FRACTION) {
anchor[0] *= size[0];
}
if (this.anchorYUnits_ == ol.style.IconAnchorUnits.FRACTION) {
if (this.anchorYUnits_ == _ol_style_IconAnchorUnits_.FRACTION) {
anchor[1] *= size[1];
}
}
if (this.anchorOrigin_ != ol.style.IconOrigin.TOP_LEFT) {
if (this.anchorOrigin_ != _ol_style_IconOrigin_.TOP_LEFT) {
if (!size) {
return null;
}
if (anchor === this.anchor_) {
anchor = this.anchor_.slice();
}
if (this.anchorOrigin_ == ol.style.IconOrigin.TOP_RIGHT ||
this.anchorOrigin_ == ol.style.IconOrigin.BOTTOM_RIGHT) {
if (this.anchorOrigin_ == _ol_style_IconOrigin_.TOP_RIGHT ||
this.anchorOrigin_ == _ol_style_IconOrigin_.BOTTOM_RIGHT) {
anchor[0] = -anchor[0] + size[0];
}
if (this.anchorOrigin_ == ol.style.IconOrigin.BOTTOM_LEFT ||
this.anchorOrigin_ == ol.style.IconOrigin.BOTTOM_RIGHT) {
if (this.anchorOrigin_ == _ol_style_IconOrigin_.BOTTOM_LEFT ||
this.anchorOrigin_ == _ol_style_IconOrigin_.BOTTOM_RIGHT) {
anchor[1] = -anchor[1] + size[1];
}
}
@@ -251,7 +252,7 @@ ol.style.Icon.prototype.getAnchor = function() {
* @return {ol.Color} Color.
* @api
*/
ol.style.Icon.prototype.getColor = function() {
_ol_style_Icon_.prototype.getColor = function() {
return this.color_;
};
@@ -263,7 +264,7 @@ ol.style.Icon.prototype.getColor = function() {
* @override
* @api
*/
ol.style.Icon.prototype.getImage = function(pixelRatio) {
_ol_style_Icon_.prototype.getImage = function(pixelRatio) {
return this.iconImage_.getImage(pixelRatio);
};
@@ -271,7 +272,7 @@ ol.style.Icon.prototype.getImage = function(pixelRatio) {
/**
* @override
*/
ol.style.Icon.prototype.getImageSize = function() {
_ol_style_Icon_.prototype.getImageSize = function() {
return this.iconImage_.getSize();
};
@@ -279,7 +280,7 @@ ol.style.Icon.prototype.getImageSize = function() {
/**
* @override
*/
ol.style.Icon.prototype.getHitDetectionImageSize = function() {
_ol_style_Icon_.prototype.getHitDetectionImageSize = function() {
return this.getImageSize();
};
@@ -287,7 +288,7 @@ ol.style.Icon.prototype.getHitDetectionImageSize = function() {
/**
* @override
*/
ol.style.Icon.prototype.getImageState = function() {
_ol_style_Icon_.prototype.getImageState = function() {
return this.iconImage_.getImageState();
};
@@ -295,7 +296,7 @@ ol.style.Icon.prototype.getImageState = function() {
/**
* @override
*/
ol.style.Icon.prototype.getHitDetectionImage = function(pixelRatio) {
_ol_style_Icon_.prototype.getHitDetectionImage = function(pixelRatio) {
return this.iconImage_.getHitDetectionImage(pixelRatio);
};
@@ -304,25 +305,25 @@ ol.style.Icon.prototype.getHitDetectionImage = function(pixelRatio) {
* @inheritDoc
* @api
*/
ol.style.Icon.prototype.getOrigin = function() {
_ol_style_Icon_.prototype.getOrigin = function() {
if (this.origin_) {
return this.origin_;
}
var offset = this.offset_;
if (this.offsetOrigin_ != ol.style.IconOrigin.TOP_LEFT) {
if (this.offsetOrigin_ != _ol_style_IconOrigin_.TOP_LEFT) {
var size = this.getSize();
var iconImageSize = this.iconImage_.getSize();
if (!size || !iconImageSize) {
return null;
}
offset = offset.slice();
if (this.offsetOrigin_ == ol.style.IconOrigin.TOP_RIGHT ||
this.offsetOrigin_ == ol.style.IconOrigin.BOTTOM_RIGHT) {
if (this.offsetOrigin_ == _ol_style_IconOrigin_.TOP_RIGHT ||
this.offsetOrigin_ == _ol_style_IconOrigin_.BOTTOM_RIGHT) {
offset[0] = iconImageSize[0] - size[0] - offset[0];
}
if (this.offsetOrigin_ == ol.style.IconOrigin.BOTTOM_LEFT ||
this.offsetOrigin_ == ol.style.IconOrigin.BOTTOM_RIGHT) {
if (this.offsetOrigin_ == _ol_style_IconOrigin_.BOTTOM_LEFT ||
this.offsetOrigin_ == _ol_style_IconOrigin_.BOTTOM_RIGHT) {
offset[1] = iconImageSize[1] - size[1] - offset[1];
}
}
@@ -336,7 +337,7 @@ ol.style.Icon.prototype.getOrigin = function() {
* @return {string|undefined} Image src.
* @api
*/
ol.style.Icon.prototype.getSrc = function() {
_ol_style_Icon_.prototype.getSrc = function() {
return this.iconImage_.getSrc();
};
@@ -345,7 +346,7 @@ ol.style.Icon.prototype.getSrc = function() {
* @inheritDoc
* @api
*/
ol.style.Icon.prototype.getSize = function() {
_ol_style_Icon_.prototype.getSize = function() {
return !this.size_ ? this.iconImage_.getSize() : this.size_;
};
@@ -353,8 +354,8 @@ ol.style.Icon.prototype.getSize = function() {
/**
* @override
*/
ol.style.Icon.prototype.listenImageChange = function(listener, thisArg) {
return ol.events.listen(this.iconImage_, ol.events.EventType.CHANGE,
_ol_style_Icon_.prototype.listenImageChange = function(listener, thisArg) {
return _ol_events_.listen(this.iconImage_, _ol_events_EventType_.CHANGE,
listener, thisArg);
};
@@ -367,7 +368,7 @@ ol.style.Icon.prototype.listenImageChange = function(listener, thisArg) {
* @override
* @api
*/
ol.style.Icon.prototype.load = function() {
_ol_style_Icon_.prototype.load = function() {
this.iconImage_.load();
};
@@ -375,7 +376,8 @@ ol.style.Icon.prototype.load = function() {
/**
* @override
*/
ol.style.Icon.prototype.unlistenImageChange = function(listener, thisArg) {
ol.events.unlisten(this.iconImage_, ol.events.EventType.CHANGE,
_ol_style_Icon_.prototype.unlistenImageChange = function(listener, thisArg) {
_ol_events_.unlisten(this.iconImage_, _ol_events_EventType_.CHANGE,
listener, thisArg);
};
export default _ol_style_Icon_;