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
+11 -10
View File
@@ -1,7 +1,7 @@
goog.provide('ol.style.Atlas');
goog.require('ol.dom');
/**
* @module ol/style/Atlas
*/
import _ol_dom_ from '../dom.js';
/**
* This class facilitates the creation of image atlases.
@@ -20,7 +20,7 @@ goog.require('ol.dom');
* edges overlap when being rendered). To avoid this we add a
* padding around each image.
*/
ol.style.Atlas = function(size, space) {
var _ol_style_Atlas_ = function(size, space) {
/**
* @private
@@ -44,7 +44,7 @@ ol.style.Atlas = function(size, space) {
* @private
* @type {CanvasRenderingContext2D}
*/
this.context_ = ol.dom.createCanvasContext2D(size, size);
this.context_ = _ol_dom_.createCanvasContext2D(size, size);
/**
* @private
@@ -58,7 +58,7 @@ ol.style.Atlas = function(size, space) {
* @param {string} id The identifier of the entry to check.
* @return {?ol.AtlasInfo} The atlas info.
*/
ol.style.Atlas.prototype.get = function(id) {
_ol_style_Atlas_.prototype.get = function(id) {
return this.entries_[id] || null;
};
@@ -73,7 +73,7 @@ ol.style.Atlas.prototype.get = function(id) {
* `renderCallback`.
* @return {?ol.AtlasInfo} The position and atlas image for the entry.
*/
ol.style.Atlas.prototype.add = function(id, width, height, renderCallback, opt_this) {
_ol_style_Atlas_.prototype.add = function(id, width, height, renderCallback, opt_this) {
var block, i, ii;
for (i = 0, ii = this.emptyBlocks_.length; i < ii; ++i) {
block = this.emptyBlocks_[i];
@@ -110,7 +110,7 @@ ol.style.Atlas.prototype.add = function(id, width, height, renderCallback, opt_t
* @param {number} width The width of the entry to insert.
* @param {number} height The height of the entry to insert.
*/
ol.style.Atlas.prototype.split_ = function(index, block, width, height) {
_ol_style_Atlas_.prototype.split_ = function(index, block, width, height) {
var deltaWidth = block.width - width;
var deltaHeight = block.height - height;
@@ -168,7 +168,7 @@ ol.style.Atlas.prototype.split_ = function(index, block, width, height) {
* @param {ol.AtlasBlock} newBlock1 The 1st block to add.
* @param {ol.AtlasBlock} newBlock2 The 2nd block to add.
*/
ol.style.Atlas.prototype.updateBlocks_ = function(index, newBlock1, newBlock2) {
_ol_style_Atlas_.prototype.updateBlocks_ = function(index, newBlock1, newBlock2) {
var args = [index, 1];
if (newBlock1.width > 0 && newBlock1.height > 0) {
args.push(newBlock1);
@@ -178,3 +178,4 @@ ol.style.Atlas.prototype.updateBlocks_ = function(index, newBlock1, newBlock2) {
}
this.emptyBlocks_.splice.apply(this.emptyBlocks_, args);
};
export default _ol_style_Atlas_;
+20 -19
View File
@@ -1,8 +1,8 @@
goog.provide('ol.style.AtlasManager');
goog.require('ol');
goog.require('ol.style.Atlas');
/**
* @module ol/style/AtlasManager
*/
import _ol_ from '../index.js';
import _ol_style_Atlas_ from '../style/Atlas.js';
/**
* Manages the creation of image atlases.
@@ -21,7 +21,7 @@ goog.require('ol.style.Atlas');
* @api
* @param {olx.style.AtlasManagerOptions=} opt_options Options.
*/
ol.style.AtlasManager = function(opt_options) {
var _ol_style_AtlasManager_ = function(opt_options) {
var options = opt_options || {};
@@ -31,7 +31,7 @@ ol.style.AtlasManager = function(opt_options) {
* @type {number}
*/
this.currentSize_ = options.initialSize !== undefined ?
options.initialSize : ol.INITIAL_ATLAS_SIZE;
options.initialSize : _ol_.INITIAL_ATLAS_SIZE;
/**
* The maximum size in pixels of atlas images.
@@ -39,9 +39,9 @@ ol.style.AtlasManager = function(opt_options) {
* @type {number}
*/
this.maxSize_ = options.maxSize !== undefined ?
options.maxSize : ol.MAX_ATLAS_SIZE != -1 ?
ol.MAX_ATLAS_SIZE : ol.WEBGL_MAX_TEXTURE_SIZE !== undefined ?
ol.WEBGL_MAX_TEXTURE_SIZE : 2048;
options.maxSize : _ol_.MAX_ATLAS_SIZE != -1 ?
_ol_.MAX_ATLAS_SIZE : _ol_.WEBGL_MAX_TEXTURE_SIZE !== undefined ?
_ol_.WEBGL_MAX_TEXTURE_SIZE : 2048;
/**
* The size in pixels between images.
@@ -54,7 +54,7 @@ ol.style.AtlasManager = function(opt_options) {
* @private
* @type {Array.<ol.style.Atlas>}
*/
this.atlases_ = [new ol.style.Atlas(this.currentSize_, this.space_)];
this.atlases_ = [new _ol_style_Atlas_(this.currentSize_, this.space_)];
/**
* The size in pixels of the latest atlas image for hit-detection images.
@@ -67,7 +67,7 @@ ol.style.AtlasManager = function(opt_options) {
* @private
* @type {Array.<ol.style.Atlas>}
*/
this.hitAtlases_ = [new ol.style.Atlas(this.currentHitSize_, this.space_)];
this.hitAtlases_ = [new _ol_style_Atlas_(this.currentHitSize_, this.space_)];
};
@@ -76,7 +76,7 @@ ol.style.AtlasManager = function(opt_options) {
* @return {?ol.AtlasManagerInfo} The position and atlas image for the
* entry, or `null` if the entry is not part of the atlas manager.
*/
ol.style.AtlasManager.prototype.getInfo = function(id) {
_ol_style_AtlasManager_.prototype.getInfo = function(id) {
/** @type {?ol.AtlasInfo} */
var info = this.getInfo_(this.atlases_, id);
@@ -96,7 +96,7 @@ ol.style.AtlasManager.prototype.getInfo = function(id) {
* @return {?ol.AtlasInfo} The position and atlas image for the entry,
* or `null` if the entry is not part of the atlases.
*/
ol.style.AtlasManager.prototype.getInfo_ = function(atlases, id) {
_ol_style_AtlasManager_.prototype.getInfo_ = function(atlases, id) {
var atlas, info, i, ii;
for (i = 0, ii = atlases.length; i < ii; ++i) {
atlas = atlases[i];
@@ -117,7 +117,7 @@ ol.style.AtlasManager.prototype.getInfo_ = function(atlases, id) {
* @return {?ol.AtlasManagerInfo} The position and atlas image for the
* entry, or `null` if the entry is not part of the atlases.
*/
ol.style.AtlasManager.prototype.mergeInfos_ = function(info, hitInfo) {
_ol_style_AtlasManager_.prototype.mergeInfos_ = function(info, hitInfo) {
return /** @type {ol.AtlasManagerInfo} */ ({
offsetX: info.offsetX,
offsetY: info.offsetY,
@@ -149,7 +149,7 @@ ol.style.AtlasManager.prototype.mergeInfos_ = function(info, hitInfo) {
* @return {?ol.AtlasManagerInfo} The position and atlas image for the
* entry, or `null` if the image is too big.
*/
ol.style.AtlasManager.prototype.add = function(id, width, height,
_ol_style_AtlasManager_.prototype.add = function(id, width, height,
renderCallback, opt_renderHitCallback, opt_this) {
if (width + this.space_ > this.maxSize_ ||
height + this.space_ > this.maxSize_) {
@@ -167,7 +167,7 @@ ol.style.AtlasManager.prototype.add = function(id, width, height,
// the hit-detection atlas, to make sure that the offset is the same for
// the original image and the hit-detection image.
var renderHitCallback = opt_renderHitCallback !== undefined ?
opt_renderHitCallback : ol.nullFunction;
opt_renderHitCallback : _ol_.nullFunction;
var hitInfo = /** @type {ol.AtlasInfo} */ (this.add_(true,
id, width, height, renderHitCallback, opt_this));
@@ -189,7 +189,7 @@ ol.style.AtlasManager.prototype.add = function(id, width, height,
* @return {?ol.AtlasInfo} The position and atlas image for the entry,
* or `null` if the image is too big.
*/
ol.style.AtlasManager.prototype.add_ = function(isHitAtlas, id, width, height,
_ol_style_AtlasManager_.prototype.add_ = function(isHitAtlas, id, width, height,
renderCallback, opt_this) {
var atlases = (isHitAtlas) ? this.hitAtlases_ : this.atlases_;
var atlas, info, i, ii;
@@ -209,7 +209,7 @@ ol.style.AtlasManager.prototype.add_ = function(isHitAtlas, id, width, height,
size = Math.min(this.currentSize_ * 2, this.maxSize_);
this.currentSize_ = size;
}
atlas = new ol.style.Atlas(size, this.space_);
atlas = new _ol_style_Atlas_(size, this.space_);
atlases.push(atlas);
// run the loop another time
++ii;
@@ -217,3 +217,4 @@ ol.style.AtlasManager.prototype.add_ = function(isHitAtlas, id, width, height,
}
return null;
};
export default _ol_style_AtlasManager_;
+13 -11
View File
@@ -1,8 +1,8 @@
goog.provide('ol.style.Circle');
goog.require('ol');
goog.require('ol.style.RegularShape');
/**
* @module ol/style/Circle
*/
import _ol_ from '../index.js';
import _ol_style_RegularShape_ from '../style/RegularShape.js';
/**
* @classdesc
@@ -13,11 +13,11 @@ goog.require('ol.style.RegularShape');
* @extends {ol.style.RegularShape}
* @api
*/
ol.style.Circle = function(opt_options) {
var _ol_style_Circle_ = function(opt_options) {
var options = opt_options || {};
ol.style.RegularShape.call(this, {
_ol_style_RegularShape_.call(this, {
points: Infinity,
fill: options.fill,
radius: options.radius,
@@ -27,7 +27,8 @@ ol.style.Circle = function(opt_options) {
});
};
ol.inherits(ol.style.Circle, ol.style.RegularShape);
_ol_.inherits(_ol_style_Circle_, _ol_style_RegularShape_);
/**
@@ -36,8 +37,8 @@ ol.inherits(ol.style.Circle, ol.style.RegularShape);
* @override
* @api
*/
ol.style.Circle.prototype.clone = function() {
var style = new ol.style.Circle({
_ol_style_Circle_.prototype.clone = function() {
var style = new _ol_style_Circle_({
fill: this.getFill() ? this.getFill().clone() : undefined,
stroke: this.getStroke() ? this.getStroke().clone() : undefined,
radius: this.getRadius(),
@@ -56,7 +57,8 @@ ol.style.Circle.prototype.clone = function() {
* @param {number} radius Circle radius.
* @api
*/
ol.style.Circle.prototype.setRadius = function(radius) {
_ol_style_Circle_.prototype.setRadius = function(radius) {
this.radius_ = radius;
this.render_(this.atlasManager_);
};
export default _ol_style_Circle_;
+14 -13
View File
@@ -1,8 +1,8 @@
goog.provide('ol.style.Fill');
goog.require('ol');
goog.require('ol.color');
/**
* @module ol/style/Fill
*/
import _ol_ from '../index.js';
import _ol_color_ from '../color.js';
/**
* @classdesc
@@ -12,7 +12,7 @@ goog.require('ol.color');
* @param {olx.style.FillOptions=} opt_options Options.
* @api
*/
ol.style.Fill = function(opt_options) {
var _ol_style_Fill_ = function(opt_options) {
var options = opt_options || {};
@@ -35,9 +35,9 @@ ol.style.Fill = function(opt_options) {
* @return {ol.style.Fill} The cloned style.
* @api
*/
ol.style.Fill.prototype.clone = function() {
_ol_style_Fill_.prototype.clone = function() {
var color = this.getColor();
return new ol.style.Fill({
return new _ol_style_Fill_({
color: (color && color.slice) ? color.slice() : color || undefined
});
};
@@ -48,7 +48,7 @@ ol.style.Fill.prototype.clone = function() {
* @return {ol.Color|ol.ColorLike} Color.
* @api
*/
ol.style.Fill.prototype.getColor = function() {
_ol_style_Fill_.prototype.getColor = function() {
return this.color_;
};
@@ -59,7 +59,7 @@ ol.style.Fill.prototype.getColor = function() {
* @param {ol.Color|ol.ColorLike} color Color.
* @api
*/
ol.style.Fill.prototype.setColor = function(color) {
_ol_style_Fill_.prototype.setColor = function(color) {
this.color_ = color;
this.checksum_ = undefined;
};
@@ -68,18 +68,19 @@ ol.style.Fill.prototype.setColor = function(color) {
/**
* @return {string} The checksum.
*/
ol.style.Fill.prototype.getChecksum = function() {
_ol_style_Fill_.prototype.getChecksum = function() {
if (this.checksum_ === undefined) {
if (
this.color_ instanceof CanvasPattern ||
this.color_ instanceof CanvasGradient
) {
this.checksum_ = ol.getUid(this.color_).toString();
this.checksum_ = _ol_.getUid(this.color_).toString();
} else {
this.checksum_ = 'f' + (this.color_ ?
ol.color.asString(this.color_) : '-');
_ol_color_.asString(this.color_) : '-');
}
}
return this.checksum_;
};
export default _ol_style_Fill_;
+60 -58
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_;
+6 -3
View File
@@ -1,10 +1,13 @@
goog.provide('ol.style.IconAnchorUnits');
/**
* @module ol/style/IconAnchorUnits
*/
/**
* Icon anchor units. One of 'fraction', 'pixels'.
* @enum {string}
*/
ol.style.IconAnchorUnits = {
var _ol_style_IconAnchorUnits_ = {
FRACTION: 'fraction',
PIXELS: 'pixels'
};
export default _ol_style_IconAnchorUnits_;
+41 -39
View File
@@ -1,13 +1,13 @@
goog.provide('ol.style.IconImage');
goog.require('ol');
goog.require('ol.dom');
goog.require('ol.events');
goog.require('ol.events.EventTarget');
goog.require('ol.events.EventType');
goog.require('ol.ImageState');
goog.require('ol.style');
/**
* @module ol/style/IconImage
*/
import _ol_ from '../index.js';
import _ol_dom_ from '../dom.js';
import _ol_events_ from '../events.js';
import _ol_events_EventTarget_ from '../events/EventTarget.js';
import _ol_events_EventType_ from '../events/EventType.js';
import _ol_ImageState_ from '../ImageState.js';
import _ol_style_ from '../style.js';
/**
* @constructor
@@ -19,10 +19,10 @@ goog.require('ol.style');
* @param {ol.Color} color Color.
* @extends {ol.events.EventTarget}
*/
ol.style.IconImage = function(image, src, size, crossOrigin, imageState,
var _ol_style_IconImage_ = function(image, src, size, crossOrigin, imageState,
color) {
ol.events.EventTarget.call(this);
_ol_events_EventTarget_.call(this);
/**
* @private
@@ -83,12 +83,13 @@ ol.style.IconImage = function(image, src, size, crossOrigin, imageState,
* @type {boolean}
*/
this.tainting_ = false;
if (this.imageState_ == ol.ImageState.LOADED) {
if (this.imageState_ == _ol_ImageState_.LOADED) {
this.determineTainting_();
}
};
ol.inherits(ol.style.IconImage, ol.events.EventTarget);
_ol_.inherits(_ol_style_IconImage_, _ol_events_EventTarget_);
/**
@@ -100,12 +101,12 @@ ol.inherits(ol.style.IconImage, ol.events.EventTarget);
* @param {ol.Color} color Color.
* @return {ol.style.IconImage} Icon image.
*/
ol.style.IconImage.get = function(image, src, size, crossOrigin, imageState,
_ol_style_IconImage_.get = function(image, src, size, crossOrigin, imageState,
color) {
var iconImageCache = ol.style.iconImageCache;
var iconImageCache = _ol_style_.iconImageCache;
var iconImage = iconImageCache.get(src, crossOrigin, color);
if (!iconImage) {
iconImage = new ol.style.IconImage(
iconImage = new _ol_style_IconImage_(
image, src, size, crossOrigin, imageState, color);
iconImageCache.set(src, crossOrigin, color, iconImage);
}
@@ -116,8 +117,8 @@ ol.style.IconImage.get = function(image, src, size, crossOrigin, imageState,
/**
* @private
*/
ol.style.IconImage.prototype.determineTainting_ = function() {
var context = ol.dom.createCanvasContext2D(1, 1);
_ol_style_IconImage_.prototype.determineTainting_ = function() {
var context = _ol_dom_.createCanvasContext2D(1, 1);
try {
context.drawImage(this.image_, 0, 0);
context.getImageData(0, 0, 1, 1);
@@ -130,16 +131,16 @@ ol.style.IconImage.prototype.determineTainting_ = function() {
/**
* @private
*/
ol.style.IconImage.prototype.dispatchChangeEvent_ = function() {
this.dispatchEvent(ol.events.EventType.CHANGE);
_ol_style_IconImage_.prototype.dispatchChangeEvent_ = function() {
this.dispatchEvent(_ol_events_EventType_.CHANGE);
};
/**
* @private
*/
ol.style.IconImage.prototype.handleImageError_ = function() {
this.imageState_ = ol.ImageState.ERROR;
_ol_style_IconImage_.prototype.handleImageError_ = function() {
this.imageState_ = _ol_ImageState_.ERROR;
this.unlistenImage_();
this.dispatchChangeEvent_();
};
@@ -148,8 +149,8 @@ ol.style.IconImage.prototype.handleImageError_ = function() {
/**
* @private
*/
ol.style.IconImage.prototype.handleImageLoad_ = function() {
this.imageState_ = ol.ImageState.LOADED;
_ol_style_IconImage_.prototype.handleImageLoad_ = function() {
this.imageState_ = _ol_ImageState_.LOADED;
if (this.size_) {
this.image_.width = this.size_[0];
this.image_.height = this.size_[1];
@@ -166,7 +167,7 @@ ol.style.IconImage.prototype.handleImageLoad_ = function() {
* @param {number} pixelRatio Pixel ratio.
* @return {Image|HTMLCanvasElement} Image or Canvas element.
*/
ol.style.IconImage.prototype.getImage = function(pixelRatio) {
_ol_style_IconImage_.prototype.getImage = function(pixelRatio) {
return this.canvas_ ? this.canvas_ : this.image_;
};
@@ -174,7 +175,7 @@ ol.style.IconImage.prototype.getImage = function(pixelRatio) {
/**
* @return {ol.ImageState} Image state.
*/
ol.style.IconImage.prototype.getImageState = function() {
_ol_style_IconImage_.prototype.getImageState = function() {
return this.imageState_;
};
@@ -183,12 +184,12 @@ ol.style.IconImage.prototype.getImageState = function() {
* @param {number} pixelRatio Pixel ratio.
* @return {Image|HTMLCanvasElement} Image element.
*/
ol.style.IconImage.prototype.getHitDetectionImage = function(pixelRatio) {
_ol_style_IconImage_.prototype.getHitDetectionImage = function(pixelRatio) {
if (!this.hitDetectionImage_) {
if (this.tainting_) {
var width = this.size_[0];
var height = this.size_[1];
var context = ol.dom.createCanvasContext2D(width, height);
var context = _ol_dom_.createCanvasContext2D(width, height);
context.fillRect(0, 0, width, height);
this.hitDetectionImage_ = context.canvas;
} else {
@@ -202,7 +203,7 @@ ol.style.IconImage.prototype.getHitDetectionImage = function(pixelRatio) {
/**
* @return {ol.Size} Image size.
*/
ol.style.IconImage.prototype.getSize = function() {
_ol_style_IconImage_.prototype.getSize = function() {
return this.size_;
};
@@ -210,7 +211,7 @@ ol.style.IconImage.prototype.getSize = function() {
/**
* @return {string|undefined} Image src.
*/
ol.style.IconImage.prototype.getSrc = function() {
_ol_style_IconImage_.prototype.getSrc = function() {
return this.src_;
};
@@ -218,13 +219,13 @@ ol.style.IconImage.prototype.getSrc = function() {
/**
* Load not yet loaded URI.
*/
ol.style.IconImage.prototype.load = function() {
if (this.imageState_ == ol.ImageState.IDLE) {
this.imageState_ = ol.ImageState.LOADING;
_ol_style_IconImage_.prototype.load = function() {
if (this.imageState_ == _ol_ImageState_.IDLE) {
this.imageState_ = _ol_ImageState_.LOADING;
this.imageListenerKeys_ = [
ol.events.listenOnce(this.image_, ol.events.EventType.ERROR,
_ol_events_.listenOnce(this.image_, _ol_events_EventType_.ERROR,
this.handleImageError_, this),
ol.events.listenOnce(this.image_, ol.events.EventType.LOAD,
_ol_events_.listenOnce(this.image_, _ol_events_EventType_.LOAD,
this.handleImageLoad_, this)
];
try {
@@ -239,7 +240,7 @@ ol.style.IconImage.prototype.load = function() {
/**
* @private
*/
ol.style.IconImage.prototype.replaceColor_ = function() {
_ol_style_IconImage_.prototype.replaceColor_ = function() {
if (this.tainting_ || this.color_ === null) {
return;
}
@@ -270,7 +271,8 @@ ol.style.IconImage.prototype.replaceColor_ = function() {
*
* @private
*/
ol.style.IconImage.prototype.unlistenImage_ = function() {
this.imageListenerKeys_.forEach(ol.events.unlistenByKey);
_ol_style_IconImage_.prototype.unlistenImage_ = function() {
this.imageListenerKeys_.forEach(_ol_events_.unlistenByKey);
this.imageListenerKeys_ = null;
};
export default _ol_style_IconImage_;
+15 -14
View File
@@ -1,13 +1,13 @@
goog.provide('ol.style.IconImageCache');
goog.require('ol.color');
/**
* @module ol/style/IconImageCache
*/
import _ol_color_ from '../color.js';
/**
* Singleton class. Available through {@link ol.style.iconImageCache}.
* @constructor
*/
ol.style.IconImageCache = function() {
var _ol_style_IconImageCache_ = function() {
/**
* @type {Object.<string, ol.style.IconImage>}
@@ -35,8 +35,8 @@ ol.style.IconImageCache = function() {
* @param {ol.Color} color Color.
* @return {string} Cache key.
*/
ol.style.IconImageCache.getKey = function(src, crossOrigin, color) {
var colorString = color ? ol.color.asString(color) : 'null';
_ol_style_IconImageCache_.getKey = function(src, crossOrigin, color) {
var colorString = color ? _ol_color_.asString(color) : 'null';
return crossOrigin + ':' + src + ':' + colorString;
};
@@ -44,7 +44,7 @@ ol.style.IconImageCache.getKey = function(src, crossOrigin, color) {
/**
* FIXME empty description for jsdoc
*/
ol.style.IconImageCache.prototype.clear = function() {
_ol_style_IconImageCache_.prototype.clear = function() {
this.cache_ = {};
this.cacheSize_ = 0;
};
@@ -53,7 +53,7 @@ ol.style.IconImageCache.prototype.clear = function() {
/**
* FIXME empty description for jsdoc
*/
ol.style.IconImageCache.prototype.expire = function() {
_ol_style_IconImageCache_.prototype.expire = function() {
if (this.cacheSize_ > this.maxCacheSize_) {
var i = 0;
var key, iconImage;
@@ -74,8 +74,8 @@ ol.style.IconImageCache.prototype.expire = function() {
* @param {ol.Color} color Color.
* @return {ol.style.IconImage} Icon image.
*/
ol.style.IconImageCache.prototype.get = function(src, crossOrigin, color) {
var key = ol.style.IconImageCache.getKey(src, crossOrigin, color);
_ol_style_IconImageCache_.prototype.get = function(src, crossOrigin, color) {
var key = _ol_style_IconImageCache_.getKey(src, crossOrigin, color);
return key in this.cache_ ? this.cache_[key] : null;
};
@@ -86,8 +86,8 @@ ol.style.IconImageCache.prototype.get = function(src, crossOrigin, color) {
* @param {ol.Color} color Color.
* @param {ol.style.IconImage} iconImage Icon image.
*/
ol.style.IconImageCache.prototype.set = function(src, crossOrigin, color, iconImage) {
var key = ol.style.IconImageCache.getKey(src, crossOrigin, color);
_ol_style_IconImageCache_.prototype.set = function(src, crossOrigin, color, iconImage) {
var key = _ol_style_IconImageCache_.getKey(src, crossOrigin, color);
this.cache_[key] = iconImage;
++this.cacheSize_;
};
@@ -100,7 +100,8 @@ ol.style.IconImageCache.prototype.set = function(src, crossOrigin, color, iconIm
* @param {number} maxCacheSize Cache max size.
* @api
*/
ol.style.IconImageCache.prototype.setSize = function(maxCacheSize) {
_ol_style_IconImageCache_.prototype.setSize = function(maxCacheSize) {
this.maxCacheSize_ = maxCacheSize;
this.expire();
};
export default _ol_style_IconImageCache_;
+6 -3
View File
@@ -1,12 +1,15 @@
goog.provide('ol.style.IconOrigin');
/**
* @module ol/style/IconOrigin
*/
/**
* Icon origin. One of 'bottom-left', 'bottom-right', 'top-left', 'top-right'.
* @enum {string}
*/
ol.style.IconOrigin = {
var _ol_style_IconOrigin_ = {
BOTTOM_LEFT: 'bottom-left',
BOTTOM_RIGHT: 'bottom-right',
TOP_LEFT: 'top-left',
TOP_RIGHT: 'top-right'
};
export default _ol_style_IconOrigin_;
+26 -25
View File
@@ -1,6 +1,6 @@
goog.provide('ol.style.Image');
/**
* @module ol/style/Image
*/
/**
* @classdesc
* A base class used for creating subclasses and not instantiated in
@@ -12,7 +12,7 @@ goog.provide('ol.style.Image');
* @param {ol.StyleImageOptions} options Options.
* @api
*/
ol.style.Image = function(options) {
var _ol_style_Image_ = function(options) {
/**
* @private
@@ -52,7 +52,7 @@ ol.style.Image = function(options) {
* @return {number} Opacity.
* @api
*/
ol.style.Image.prototype.getOpacity = function() {
_ol_style_Image_.prototype.getOpacity = function() {
return this.opacity_;
};
@@ -62,7 +62,7 @@ ol.style.Image.prototype.getOpacity = function() {
* @return {boolean} Rotate with map.
* @api
*/
ol.style.Image.prototype.getRotateWithView = function() {
_ol_style_Image_.prototype.getRotateWithView = function() {
return this.rotateWithView_;
};
@@ -72,7 +72,7 @@ ol.style.Image.prototype.getRotateWithView = function() {
* @return {number} Rotation.
* @api
*/
ol.style.Image.prototype.getRotation = function() {
_ol_style_Image_.prototype.getRotation = function() {
return this.rotation_;
};
@@ -82,7 +82,7 @@ ol.style.Image.prototype.getRotation = function() {
* @return {number} Scale.
* @api
*/
ol.style.Image.prototype.getScale = function() {
_ol_style_Image_.prototype.getScale = function() {
return this.scale_;
};
@@ -92,7 +92,7 @@ ol.style.Image.prototype.getScale = function() {
* @return {boolean} The symbolizer should snap to a pixel.
* @api
*/
ol.style.Image.prototype.getSnapToPixel = function() {
_ol_style_Image_.prototype.getSnapToPixel = function() {
return this.snapToPixel_;
};
@@ -103,7 +103,7 @@ ol.style.Image.prototype.getSnapToPixel = function() {
* @abstract
* @return {Array.<number>} Anchor.
*/
ol.style.Image.prototype.getAnchor = function() {};
_ol_style_Image_.prototype.getAnchor = function() {};
/**
@@ -112,7 +112,7 @@ ol.style.Image.prototype.getAnchor = function() {};
* @param {number} pixelRatio Pixel ratio.
* @return {HTMLCanvasElement|HTMLVideoElement|Image} Image element.
*/
ol.style.Image.prototype.getImage = function(pixelRatio) {};
_ol_style_Image_.prototype.getImage = function(pixelRatio) {};
/**
@@ -120,28 +120,28 @@ ol.style.Image.prototype.getImage = function(pixelRatio) {};
* @param {number} pixelRatio Pixel ratio.
* @return {HTMLCanvasElement|HTMLVideoElement|Image} Image element.
*/
ol.style.Image.prototype.getHitDetectionImage = function(pixelRatio) {};
_ol_style_Image_.prototype.getHitDetectionImage = function(pixelRatio) {};
/**
* @abstract
* @return {ol.ImageState} Image state.
*/
ol.style.Image.prototype.getImageState = function() {};
_ol_style_Image_.prototype.getImageState = function() {};
/**
* @abstract
* @return {ol.Size} Image size.
*/
ol.style.Image.prototype.getImageSize = function() {};
_ol_style_Image_.prototype.getImageSize = function() {};
/**
* @abstract
* @return {ol.Size} Size of the hit-detection image.
*/
ol.style.Image.prototype.getHitDetectionImageSize = function() {};
_ol_style_Image_.prototype.getHitDetectionImageSize = function() {};
/**
@@ -149,7 +149,7 @@ ol.style.Image.prototype.getHitDetectionImageSize = function() {};
* @abstract
* @return {Array.<number>} Origin.
*/
ol.style.Image.prototype.getOrigin = function() {};
_ol_style_Image_.prototype.getOrigin = function() {};
/**
@@ -157,7 +157,7 @@ ol.style.Image.prototype.getOrigin = function() {};
* @abstract
* @return {ol.Size} Size.
*/
ol.style.Image.prototype.getSize = function() {};
_ol_style_Image_.prototype.getSize = function() {};
/**
@@ -166,7 +166,7 @@ ol.style.Image.prototype.getSize = function() {};
* @param {number} opacity Opacity.
* @api
*/
ol.style.Image.prototype.setOpacity = function(opacity) {
_ol_style_Image_.prototype.setOpacity = function(opacity) {
this.opacity_ = opacity;
};
@@ -176,7 +176,7 @@ ol.style.Image.prototype.setOpacity = function(opacity) {
*
* @param {boolean} rotateWithView Rotate with map.
*/
ol.style.Image.prototype.setRotateWithView = function(rotateWithView) {
_ol_style_Image_.prototype.setRotateWithView = function(rotateWithView) {
this.rotateWithView_ = rotateWithView;
};
@@ -187,7 +187,7 @@ ol.style.Image.prototype.setRotateWithView = function(rotateWithView) {
* @param {number} rotation Rotation.
* @api
*/
ol.style.Image.prototype.setRotation = function(rotation) {
_ol_style_Image_.prototype.setRotation = function(rotation) {
this.rotation_ = rotation;
};
@@ -198,7 +198,7 @@ ol.style.Image.prototype.setRotation = function(rotation) {
* @param {number} scale Scale.
* @api
*/
ol.style.Image.prototype.setScale = function(scale) {
_ol_style_Image_.prototype.setScale = function(scale) {
this.scale_ = scale;
};
@@ -208,7 +208,7 @@ ol.style.Image.prototype.setScale = function(scale) {
*
* @param {boolean} snapToPixel Snap to pixel?
*/
ol.style.Image.prototype.setSnapToPixel = function(snapToPixel) {
_ol_style_Image_.prototype.setSnapToPixel = function(snapToPixel) {
this.snapToPixel_ = snapToPixel;
};
@@ -220,14 +220,14 @@ ol.style.Image.prototype.setSnapToPixel = function(snapToPixel) {
* @return {ol.EventsKey|undefined} Listener key.
* @template T
*/
ol.style.Image.prototype.listenImageChange = function(listener, thisArg) {};
_ol_style_Image_.prototype.listenImageChange = function(listener, thisArg) {};
/**
* Load not yet loaded URI.
* @abstract
*/
ol.style.Image.prototype.load = function() {};
_ol_style_Image_.prototype.load = function() {};
/**
@@ -236,4 +236,5 @@ ol.style.Image.prototype.load = function() {};
* @param {T} thisArg Value to use as `this` when executing `listener`.
* @template T
*/
ol.style.Image.prototype.unlistenImageChange = function(listener, thisArg) {};
_ol_style_Image_.prototype.unlistenImageChange = function(listener, thisArg) {};
export default _ol_style_Image_;
+52 -50
View File
@@ -1,13 +1,13 @@
goog.provide('ol.style.RegularShape');
goog.require('ol');
goog.require('ol.colorlike');
goog.require('ol.dom');
goog.require('ol.has');
goog.require('ol.ImageState');
goog.require('ol.render.canvas');
goog.require('ol.style.Image');
/**
* @module ol/style/RegularShape
*/
import _ol_ from '../index.js';
import _ol_colorlike_ from '../colorlike.js';
import _ol_dom_ from '../dom.js';
import _ol_has_ from '../has.js';
import _ol_ImageState_ from '../ImageState.js';
import _ol_render_canvas_ from '../render/canvas.js';
import _ol_style_Image_ from '../style/Image.js';
/**
* @classdesc
@@ -20,7 +20,7 @@ goog.require('ol.style.Image');
* @extends {ol.style.Image}
* @api
*/
ol.style.RegularShape = function(options) {
var _ol_style_RegularShape_ = function(options) {
/**
* @private
* @type {Array.<string>}
@@ -126,7 +126,7 @@ ol.style.RegularShape = function(options) {
var rotateWithView = options.rotateWithView !== undefined ?
options.rotateWithView : false;
ol.style.Image.call(this, {
_ol_style_Image_.call(this, {
opacity: 1,
rotateWithView: rotateWithView,
rotation: options.rotation !== undefined ? options.rotation : 0,
@@ -134,7 +134,8 @@ ol.style.RegularShape = function(options) {
snapToPixel: snapToPixel
});
};
ol.inherits(ol.style.RegularShape, ol.style.Image);
_ol_.inherits(_ol_style_RegularShape_, _ol_style_Image_);
/**
@@ -142,8 +143,8 @@ ol.inherits(ol.style.RegularShape, ol.style.Image);
* @return {ol.style.RegularShape} The cloned style.
* @api
*/
ol.style.RegularShape.prototype.clone = function() {
var style = new ol.style.RegularShape({
_ol_style_RegularShape_.prototype.clone = function() {
var style = new _ol_style_RegularShape_({
fill: this.getFill() ? this.getFill().clone() : undefined,
points: this.getPoints(),
radius: this.getRadius(),
@@ -165,7 +166,7 @@ ol.style.RegularShape.prototype.clone = function() {
* @inheritDoc
* @api
*/
ol.style.RegularShape.prototype.getAnchor = function() {
_ol_style_RegularShape_.prototype.getAnchor = function() {
return this.anchor_;
};
@@ -175,7 +176,7 @@ ol.style.RegularShape.prototype.getAnchor = function() {
* @return {number} Shape's rotation in radians.
* @api
*/
ol.style.RegularShape.prototype.getAngle = function() {
_ol_style_RegularShape_.prototype.getAngle = function() {
return this.angle_;
};
@@ -185,7 +186,7 @@ ol.style.RegularShape.prototype.getAngle = function() {
* @return {ol.style.Fill} Fill style.
* @api
*/
ol.style.RegularShape.prototype.getFill = function() {
_ol_style_RegularShape_.prototype.getFill = function() {
return this.fill_;
};
@@ -193,7 +194,7 @@ ol.style.RegularShape.prototype.getFill = function() {
/**
* @inheritDoc
*/
ol.style.RegularShape.prototype.getHitDetectionImage = function(pixelRatio) {
_ol_style_RegularShape_.prototype.getHitDetectionImage = function(pixelRatio) {
return this.hitDetectionCanvas_;
};
@@ -202,7 +203,7 @@ ol.style.RegularShape.prototype.getHitDetectionImage = function(pixelRatio) {
* @inheritDoc
* @api
*/
ol.style.RegularShape.prototype.getImage = function(pixelRatio) {
_ol_style_RegularShape_.prototype.getImage = function(pixelRatio) {
return this.canvas_;
};
@@ -210,7 +211,7 @@ ol.style.RegularShape.prototype.getImage = function(pixelRatio) {
/**
* @inheritDoc
*/
ol.style.RegularShape.prototype.getImageSize = function() {
_ol_style_RegularShape_.prototype.getImageSize = function() {
return this.imageSize_;
};
@@ -218,7 +219,7 @@ ol.style.RegularShape.prototype.getImageSize = function() {
/**
* @inheritDoc
*/
ol.style.RegularShape.prototype.getHitDetectionImageSize = function() {
_ol_style_RegularShape_.prototype.getHitDetectionImageSize = function() {
return this.hitDetectionImageSize_;
};
@@ -226,8 +227,8 @@ ol.style.RegularShape.prototype.getHitDetectionImageSize = function() {
/**
* @inheritDoc
*/
ol.style.RegularShape.prototype.getImageState = function() {
return ol.ImageState.LOADED;
_ol_style_RegularShape_.prototype.getImageState = function() {
return _ol_ImageState_.LOADED;
};
@@ -235,7 +236,7 @@ ol.style.RegularShape.prototype.getImageState = function() {
* @inheritDoc
* @api
*/
ol.style.RegularShape.prototype.getOrigin = function() {
_ol_style_RegularShape_.prototype.getOrigin = function() {
return this.origin_;
};
@@ -245,7 +246,7 @@ ol.style.RegularShape.prototype.getOrigin = function() {
* @return {number} Number of points for stars and regular polygons.
* @api
*/
ol.style.RegularShape.prototype.getPoints = function() {
_ol_style_RegularShape_.prototype.getPoints = function() {
return this.points_;
};
@@ -255,7 +256,7 @@ ol.style.RegularShape.prototype.getPoints = function() {
* @return {number} Radius.
* @api
*/
ol.style.RegularShape.prototype.getRadius = function() {
_ol_style_RegularShape_.prototype.getRadius = function() {
return this.radius_;
};
@@ -265,7 +266,7 @@ ol.style.RegularShape.prototype.getRadius = function() {
* @return {number|undefined} Radius2.
* @api
*/
ol.style.RegularShape.prototype.getRadius2 = function() {
_ol_style_RegularShape_.prototype.getRadius2 = function() {
return this.radius2_;
};
@@ -274,7 +275,7 @@ ol.style.RegularShape.prototype.getRadius2 = function() {
* @inheritDoc
* @api
*/
ol.style.RegularShape.prototype.getSize = function() {
_ol_style_RegularShape_.prototype.getSize = function() {
return this.size_;
};
@@ -284,7 +285,7 @@ ol.style.RegularShape.prototype.getSize = function() {
* @return {ol.style.Stroke} Stroke style.
* @api
*/
ol.style.RegularShape.prototype.getStroke = function() {
_ol_style_RegularShape_.prototype.getStroke = function() {
return this.stroke_;
};
@@ -292,26 +293,26 @@ ol.style.RegularShape.prototype.getStroke = function() {
/**
* @inheritDoc
*/
ol.style.RegularShape.prototype.listenImageChange = function(listener, thisArg) {};
_ol_style_RegularShape_.prototype.listenImageChange = function(listener, thisArg) {};
/**
* @inheritDoc
*/
ol.style.RegularShape.prototype.load = function() {};
_ol_style_RegularShape_.prototype.load = function() {};
/**
* @inheritDoc
*/
ol.style.RegularShape.prototype.unlistenImageChange = function(listener, thisArg) {};
_ol_style_RegularShape_.prototype.unlistenImageChange = function(listener, thisArg) {};
/**
* @protected
* @param {ol.style.AtlasManager|undefined} atlasManager An atlas manager.
*/
ol.style.RegularShape.prototype.render_ = function(atlasManager) {
_ol_style_RegularShape_.prototype.render_ = function(atlasManager) {
var imageSize;
var lineCap = '';
var lineJoin = '';
@@ -324,30 +325,30 @@ ol.style.RegularShape.prototype.render_ = function(atlasManager) {
if (this.stroke_) {
strokeStyle = this.stroke_.getColor();
if (strokeStyle === null) {
strokeStyle = ol.render.canvas.defaultStrokeStyle;
strokeStyle = _ol_render_canvas_.defaultStrokeStyle;
}
strokeStyle = ol.colorlike.asColorLike(strokeStyle);
strokeStyle = _ol_colorlike_.asColorLike(strokeStyle);
strokeWidth = this.stroke_.getWidth();
if (strokeWidth === undefined) {
strokeWidth = ol.render.canvas.defaultLineWidth;
strokeWidth = _ol_render_canvas_.defaultLineWidth;
}
lineDash = this.stroke_.getLineDash();
lineDashOffset = this.stroke_.getLineDashOffset();
if (!ol.has.CANVAS_LINE_DASH) {
if (!_ol_has_.CANVAS_LINE_DASH) {
lineDash = null;
lineDashOffset = 0;
}
lineJoin = this.stroke_.getLineJoin();
if (lineJoin === undefined) {
lineJoin = ol.render.canvas.defaultLineJoin;
lineJoin = _ol_render_canvas_.defaultLineJoin;
}
lineCap = this.stroke_.getLineCap();
if (lineCap === undefined) {
lineCap = ol.render.canvas.defaultLineCap;
lineCap = _ol_render_canvas_.defaultLineCap;
}
miterLimit = this.stroke_.getMiterLimit();
if (miterLimit === undefined) {
miterLimit = ol.render.canvas.defaultMiterLimit;
miterLimit = _ol_render_canvas_.defaultMiterLimit;
}
}
@@ -367,7 +368,7 @@ ol.style.RegularShape.prototype.render_ = function(atlasManager) {
if (atlasManager === undefined) {
// no atlas manager is used, create a new canvas
var context = ol.dom.createCanvasContext2D(size, size);
var context = _ol_dom_.createCanvasContext2D(size, size);
this.canvas_ = context.canvas;
// canvas.width and height are rounded to the closest integer
@@ -421,7 +422,7 @@ ol.style.RegularShape.prototype.render_ = function(atlasManager) {
* @param {number} x The origin for the symbol (x).
* @param {number} y The origin for the symbol (y).
*/
ol.style.RegularShape.prototype.draw_ = function(renderOptions, context, x, y) {
_ol_style_RegularShape_.prototype.draw_ = function(renderOptions, context, x, y) {
var i, angle0, radiusC;
// reset transform
context.setTransform(1, 0, 0, 1, 0, 0);
@@ -454,9 +455,9 @@ ol.style.RegularShape.prototype.draw_ = function(renderOptions, context, x, y) {
if (this.fill_) {
var color = this.fill_.getColor();
if (color === null) {
color = ol.render.canvas.defaultFillStyle;
color = _ol_render_canvas_.defaultFillStyle;
}
context.fillStyle = ol.colorlike.asColorLike(color);
context.fillStyle = _ol_colorlike_.asColorLike(color);
context.fill();
}
if (this.stroke_) {
@@ -479,7 +480,7 @@ ol.style.RegularShape.prototype.draw_ = function(renderOptions, context, x, y) {
* @private
* @param {ol.RegularShapeRenderOptions} renderOptions Render options.
*/
ol.style.RegularShape.prototype.createHitDetectionCanvas_ = function(renderOptions) {
_ol_style_RegularShape_.prototype.createHitDetectionCanvas_ = function(renderOptions) {
this.hitDetectionImageSize_ = [renderOptions.size, renderOptions.size];
if (this.fill_) {
this.hitDetectionCanvas_ = this.canvas_;
@@ -488,7 +489,7 @@ ol.style.RegularShape.prototype.createHitDetectionCanvas_ = function(renderOptio
// if no fill style is set, create an extra hit-detection image with a
// default fill style
var context = ol.dom.createCanvasContext2D(renderOptions.size, renderOptions.size);
var context = _ol_dom_.createCanvasContext2D(renderOptions.size, renderOptions.size);
this.hitDetectionCanvas_ = context.canvas;
this.drawHitDetectionCanvas_(renderOptions, context, 0, 0);
@@ -502,7 +503,7 @@ ol.style.RegularShape.prototype.createHitDetectionCanvas_ = function(renderOptio
* @param {number} x The origin for the symbol (x).
* @param {number} y The origin for the symbol (y).
*/
ol.style.RegularShape.prototype.drawHitDetectionCanvas_ = function(renderOptions, context, x, y) {
_ol_style_RegularShape_.prototype.drawHitDetectionCanvas_ = function(renderOptions, context, x, y) {
// reset transform
context.setTransform(1, 0, 0, 1, 0, 0);
@@ -531,7 +532,7 @@ ol.style.RegularShape.prototype.drawHitDetectionCanvas_ = function(renderOptions
}
}
context.fillStyle = ol.render.canvas.defaultFillStyle;
context.fillStyle = _ol_render_canvas_.defaultFillStyle;
context.fill();
if (this.stroke_) {
context.strokeStyle = renderOptions.strokeStyle;
@@ -549,7 +550,7 @@ ol.style.RegularShape.prototype.drawHitDetectionCanvas_ = function(renderOptions
/**
* @return {string} The checksum.
*/
ol.style.RegularShape.prototype.getChecksum = function() {
_ol_style_RegularShape_.prototype.getChecksum = function() {
var strokeChecksum = this.stroke_ ?
this.stroke_.getChecksum() : '-';
var fillChecksum = this.fill_ ?
@@ -575,3 +576,4 @@ ol.style.RegularShape.prototype.getChecksum = function() {
return this.checksums_[0];
};
export default _ol_style_RegularShape_;
+24 -23
View File
@@ -1,7 +1,7 @@
goog.provide('ol.style.Stroke');
goog.require('ol');
/**
* @module ol/style/Stroke
*/
import _ol_ from '../index.js';
/**
* @classdesc
@@ -14,7 +14,7 @@ goog.require('ol');
* @param {olx.style.StrokeOptions=} opt_options Options.
* @api
*/
ol.style.Stroke = function(opt_options) {
var _ol_style_Stroke_ = function(opt_options) {
var options = opt_options || {};
@@ -73,9 +73,9 @@ ol.style.Stroke = function(opt_options) {
* @return {ol.style.Stroke} The cloned style.
* @api
*/
ol.style.Stroke.prototype.clone = function() {
_ol_style_Stroke_.prototype.clone = function() {
var color = this.getColor();
return new ol.style.Stroke({
return new _ol_style_Stroke_({
color: (color && color.slice) ? color.slice() : color || undefined,
lineCap: this.getLineCap(),
lineDash: this.getLineDash() ? this.getLineDash().slice() : undefined,
@@ -92,7 +92,7 @@ ol.style.Stroke.prototype.clone = function() {
* @return {ol.Color|ol.ColorLike} Color.
* @api
*/
ol.style.Stroke.prototype.getColor = function() {
_ol_style_Stroke_.prototype.getColor = function() {
return this.color_;
};
@@ -102,7 +102,7 @@ ol.style.Stroke.prototype.getColor = function() {
* @return {string|undefined} Line cap.
* @api
*/
ol.style.Stroke.prototype.getLineCap = function() {
_ol_style_Stroke_.prototype.getLineCap = function() {
return this.lineCap_;
};
@@ -112,7 +112,7 @@ ol.style.Stroke.prototype.getLineCap = function() {
* @return {Array.<number>} Line dash.
* @api
*/
ol.style.Stroke.prototype.getLineDash = function() {
_ol_style_Stroke_.prototype.getLineDash = function() {
return this.lineDash_;
};
@@ -122,7 +122,7 @@ ol.style.Stroke.prototype.getLineDash = function() {
* @return {number|undefined} Line dash offset.
* @api
*/
ol.style.Stroke.prototype.getLineDashOffset = function() {
_ol_style_Stroke_.prototype.getLineDashOffset = function() {
return this.lineDashOffset_;
};
@@ -132,7 +132,7 @@ ol.style.Stroke.prototype.getLineDashOffset = function() {
* @return {string|undefined} Line join.
* @api
*/
ol.style.Stroke.prototype.getLineJoin = function() {
_ol_style_Stroke_.prototype.getLineJoin = function() {
return this.lineJoin_;
};
@@ -142,7 +142,7 @@ ol.style.Stroke.prototype.getLineJoin = function() {
* @return {number|undefined} Miter limit.
* @api
*/
ol.style.Stroke.prototype.getMiterLimit = function() {
_ol_style_Stroke_.prototype.getMiterLimit = function() {
return this.miterLimit_;
};
@@ -152,7 +152,7 @@ ol.style.Stroke.prototype.getMiterLimit = function() {
* @return {number|undefined} Width.
* @api
*/
ol.style.Stroke.prototype.getWidth = function() {
_ol_style_Stroke_.prototype.getWidth = function() {
return this.width_;
};
@@ -163,7 +163,7 @@ ol.style.Stroke.prototype.getWidth = function() {
* @param {ol.Color|ol.ColorLike} color Color.
* @api
*/
ol.style.Stroke.prototype.setColor = function(color) {
_ol_style_Stroke_.prototype.setColor = function(color) {
this.color_ = color;
this.checksum_ = undefined;
};
@@ -175,7 +175,7 @@ ol.style.Stroke.prototype.setColor = function(color) {
* @param {string|undefined} lineCap Line cap.
* @api
*/
ol.style.Stroke.prototype.setLineCap = function(lineCap) {
_ol_style_Stroke_.prototype.setLineCap = function(lineCap) {
this.lineCap_ = lineCap;
this.checksum_ = undefined;
};
@@ -193,7 +193,7 @@ ol.style.Stroke.prototype.setLineCap = function(lineCap) {
* @param {Array.<number>} lineDash Line dash.
* @api
*/
ol.style.Stroke.prototype.setLineDash = function(lineDash) {
_ol_style_Stroke_.prototype.setLineDash = function(lineDash) {
this.lineDash_ = lineDash;
this.checksum_ = undefined;
};
@@ -205,7 +205,7 @@ ol.style.Stroke.prototype.setLineDash = function(lineDash) {
* @param {number|undefined} lineDashOffset Line dash offset.
* @api
*/
ol.style.Stroke.prototype.setLineDashOffset = function(lineDashOffset) {
_ol_style_Stroke_.prototype.setLineDashOffset = function(lineDashOffset) {
this.lineDashOffset_ = lineDashOffset;
this.checksum_ = undefined;
};
@@ -217,7 +217,7 @@ ol.style.Stroke.prototype.setLineDashOffset = function(lineDashOffset) {
* @param {string|undefined} lineJoin Line join.
* @api
*/
ol.style.Stroke.prototype.setLineJoin = function(lineJoin) {
_ol_style_Stroke_.prototype.setLineJoin = function(lineJoin) {
this.lineJoin_ = lineJoin;
this.checksum_ = undefined;
};
@@ -229,7 +229,7 @@ ol.style.Stroke.prototype.setLineJoin = function(lineJoin) {
* @param {number|undefined} miterLimit Miter limit.
* @api
*/
ol.style.Stroke.prototype.setMiterLimit = function(miterLimit) {
_ol_style_Stroke_.prototype.setMiterLimit = function(miterLimit) {
this.miterLimit_ = miterLimit;
this.checksum_ = undefined;
};
@@ -241,7 +241,7 @@ ol.style.Stroke.prototype.setMiterLimit = function(miterLimit) {
* @param {number|undefined} width Width.
* @api
*/
ol.style.Stroke.prototype.setWidth = function(width) {
_ol_style_Stroke_.prototype.setWidth = function(width) {
this.width_ = width;
this.checksum_ = undefined;
};
@@ -250,14 +250,14 @@ ol.style.Stroke.prototype.setWidth = function(width) {
/**
* @return {string} The checksum.
*/
ol.style.Stroke.prototype.getChecksum = function() {
_ol_style_Stroke_.prototype.getChecksum = function() {
if (this.checksum_ === undefined) {
this.checksum_ = 's';
if (this.color_) {
if (typeof this.color_ === 'string') {
this.checksum_ += this.color_;
} else {
this.checksum_ += ol.getUid(this.color_).toString();
this.checksum_ += _ol_.getUid(this.color_).toString();
}
} else {
this.checksum_ += '-';
@@ -279,3 +279,4 @@ ol.style.Stroke.prototype.getChecksum = function() {
return this.checksum_;
};
export default _ol_style_Stroke_;
+68 -67
View File
@@ -1,11 +1,11 @@
goog.provide('ol.style.Style');
goog.require('ol.asserts');
goog.require('ol.geom.GeometryType');
goog.require('ol.style.Circle');
goog.require('ol.style.Fill');
goog.require('ol.style.Stroke');
/**
* @module ol/style/Style
*/
import _ol_asserts_ from '../asserts.js';
import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
import _ol_style_Circle_ from '../style/Circle.js';
import _ol_style_Fill_ from '../style/Fill.js';
import _ol_style_Stroke_ from '../style/Stroke.js';
/**
* @classdesc
@@ -18,7 +18,7 @@ goog.require('ol.style.Stroke');
* @param {olx.style.StyleOptions=} opt_options Style options.
* @api
*/
ol.style.Style = function(opt_options) {
var _ol_style_Style_ = function(opt_options) {
var options = opt_options || {};
@@ -32,7 +32,7 @@ ol.style.Style = function(opt_options) {
* @private
* @type {!ol.StyleGeometryFunction}
*/
this.geometryFunction_ = ol.style.Style.defaultGeometryFunction;
this.geometryFunction_ = _ol_style_Style_.defaultGeometryFunction;
if (options.geometry !== undefined) {
this.setGeometry(options.geometry);
@@ -82,12 +82,12 @@ ol.style.Style = function(opt_options) {
* @return {ol.style.Style} The cloned style.
* @api
*/
ol.style.Style.prototype.clone = function() {
_ol_style_Style_.prototype.clone = function() {
var geometry = this.getGeometry();
if (geometry && geometry.clone) {
geometry = geometry.clone();
}
return new ol.style.Style({
return new _ol_style_Style_({
geometry: geometry,
fill: this.getFill() ? this.getFill().clone() : undefined,
image: this.getImage() ? this.getImage().clone() : undefined,
@@ -104,7 +104,7 @@ ol.style.Style.prototype.clone = function() {
* @return {ol.StyleRenderFunction|null} Custom renderer function.
* @api
*/
ol.style.Style.prototype.getRenderer = function() {
_ol_style_Style_.prototype.getRenderer = function() {
return this.renderer_;
};
@@ -115,7 +115,7 @@ ol.style.Style.prototype.getRenderer = function() {
* @param {ol.StyleRenderFunction|null} renderer Custom renderer function.
* @api
*/
ol.style.Style.prototype.setRenderer = function(renderer) {
_ol_style_Style_.prototype.setRenderer = function(renderer) {
this.renderer_ = renderer;
};
@@ -127,7 +127,7 @@ ol.style.Style.prototype.setRenderer = function(renderer) {
* be rendered with this style.
* @api
*/
ol.style.Style.prototype.getGeometry = function() {
_ol_style_Style_.prototype.getGeometry = function() {
return this.geometry_;
};
@@ -138,7 +138,7 @@ ol.style.Style.prototype.getGeometry = function() {
* and returns the geometry to render instead of the feature's geometry.
* @api
*/
ol.style.Style.prototype.getGeometryFunction = function() {
_ol_style_Style_.prototype.getGeometryFunction = function() {
return this.geometryFunction_;
};
@@ -148,7 +148,7 @@ ol.style.Style.prototype.getGeometryFunction = function() {
* @return {ol.style.Fill} Fill style.
* @api
*/
ol.style.Style.prototype.getFill = function() {
_ol_style_Style_.prototype.getFill = function() {
return this.fill_;
};
@@ -158,7 +158,7 @@ ol.style.Style.prototype.getFill = function() {
* @param {ol.style.Fill} fill Fill style.
* @api
*/
ol.style.Style.prototype.setFill = function(fill) {
_ol_style_Style_.prototype.setFill = function(fill) {
this.fill_ = fill;
};
@@ -168,7 +168,7 @@ ol.style.Style.prototype.setFill = function(fill) {
* @return {ol.style.Image} Image style.
* @api
*/
ol.style.Style.prototype.getImage = function() {
_ol_style_Style_.prototype.getImage = function() {
return this.image_;
};
@@ -178,7 +178,7 @@ ol.style.Style.prototype.getImage = function() {
* @param {ol.style.Image} image Image style.
* @api
*/
ol.style.Style.prototype.setImage = function(image) {
_ol_style_Style_.prototype.setImage = function(image) {
this.image_ = image;
};
@@ -188,7 +188,7 @@ ol.style.Style.prototype.setImage = function(image) {
* @return {ol.style.Stroke} Stroke style.
* @api
*/
ol.style.Style.prototype.getStroke = function() {
_ol_style_Style_.prototype.getStroke = function() {
return this.stroke_;
};
@@ -198,7 +198,7 @@ ol.style.Style.prototype.getStroke = function() {
* @param {ol.style.Stroke} stroke Stroke style.
* @api
*/
ol.style.Style.prototype.setStroke = function(stroke) {
_ol_style_Style_.prototype.setStroke = function(stroke) {
this.stroke_ = stroke;
};
@@ -208,7 +208,7 @@ ol.style.Style.prototype.setStroke = function(stroke) {
* @return {ol.style.Text} Text style.
* @api
*/
ol.style.Style.prototype.getText = function() {
_ol_style_Style_.prototype.getText = function() {
return this.text_;
};
@@ -218,7 +218,7 @@ ol.style.Style.prototype.getText = function() {
* @param {ol.style.Text} text Text style.
* @api
*/
ol.style.Style.prototype.setText = function(text) {
_ol_style_Style_.prototype.setText = function(text) {
this.text_ = text;
};
@@ -228,7 +228,7 @@ ol.style.Style.prototype.setText = function(text) {
* @return {number|undefined} ZIndex.
* @api
*/
ol.style.Style.prototype.getZIndex = function() {
_ol_style_Style_.prototype.getZIndex = function() {
return this.zIndex_;
};
@@ -241,7 +241,7 @@ ol.style.Style.prototype.getZIndex = function() {
* for this style.
* @api
*/
ol.style.Style.prototype.setGeometry = function(geometry) {
_ol_style_Style_.prototype.setGeometry = function(geometry) {
if (typeof geometry === 'function') {
this.geometryFunction_ = geometry;
} else if (typeof geometry === 'string') {
@@ -249,7 +249,7 @@ ol.style.Style.prototype.setGeometry = function(geometry) {
return /** @type {ol.geom.Geometry} */ (feature.get(geometry));
};
} else if (!geometry) {
this.geometryFunction_ = ol.style.Style.defaultGeometryFunction;
this.geometryFunction_ = _ol_style_Style_.defaultGeometryFunction;
} else if (geometry !== undefined) {
this.geometryFunction_ = function() {
return /** @type {ol.geom.Geometry} */ (geometry);
@@ -265,7 +265,7 @@ ol.style.Style.prototype.setGeometry = function(geometry) {
* @param {number|undefined} zIndex ZIndex.
* @api
*/
ol.style.Style.prototype.setZIndex = function(zIndex) {
_ol_style_Style_.prototype.setZIndex = function(zIndex) {
this.zIndex_ = zIndex;
};
@@ -278,7 +278,7 @@ ol.style.Style.prototype.setZIndex = function(zIndex) {
* A style function, a single style, or an array of styles.
* @return {ol.StyleFunction} A style function.
*/
ol.style.Style.createFunction = function(obj) {
_ol_style_Style_.createFunction = function(obj) {
var styleFunction;
if (typeof obj === 'function') {
@@ -291,7 +291,7 @@ ol.style.Style.createFunction = function(obj) {
if (Array.isArray(obj)) {
styles = obj;
} else {
ol.asserts.assert(obj instanceof ol.style.Style,
_ol_asserts_.assert(obj instanceof _ol_style_Style_,
41); // Expected an `ol.style.Style` or an array of `ol.style.Style`
styles = [obj];
}
@@ -307,7 +307,7 @@ ol.style.Style.createFunction = function(obj) {
* @type {Array.<ol.style.Style>}
* @private
*/
ol.style.Style.default_ = null;
_ol_style_Style_.default_ = null;
/**
@@ -315,23 +315,23 @@ ol.style.Style.default_ = null;
* @param {number} resolution Resolution.
* @return {Array.<ol.style.Style>} Style.
*/
ol.style.Style.defaultFunction = function(feature, resolution) {
_ol_style_Style_.defaultFunction = function(feature, resolution) {
// We don't use an immediately-invoked function
// and a closure so we don't get an error at script evaluation time in
// browsers that do not support Canvas. (ol.style.Circle does
// canvas.getContext('2d') at construction time, which will cause an.error
// in such browsers.)
if (!ol.style.Style.default_) {
var fill = new ol.style.Fill({
if (!_ol_style_Style_.default_) {
var fill = new _ol_style_Fill_({
color: 'rgba(255,255,255,0.4)'
});
var stroke = new ol.style.Stroke({
var stroke = new _ol_style_Stroke_({
color: '#3399CC',
width: 1.25
});
ol.style.Style.default_ = [
new ol.style.Style({
image: new ol.style.Circle({
_ol_style_Style_.default_ = [
new _ol_style_Style_({
image: new _ol_style_Circle_({
fill: fill,
stroke: stroke,
radius: 5
@@ -341,7 +341,7 @@ ol.style.Style.defaultFunction = function(feature, resolution) {
})
];
}
return ol.style.Style.default_;
return _ol_style_Style_.default_;
};
@@ -349,53 +349,53 @@ ol.style.Style.defaultFunction = function(feature, resolution) {
* Default styles for editing features.
* @return {Object.<ol.geom.GeometryType, Array.<ol.style.Style>>} Styles
*/
ol.style.Style.createDefaultEditing = function() {
_ol_style_Style_.createDefaultEditing = function() {
/** @type {Object.<ol.geom.GeometryType, Array.<ol.style.Style>>} */
var styles = {};
var white = [255, 255, 255, 1];
var blue = [0, 153, 255, 1];
var width = 3;
styles[ol.geom.GeometryType.POLYGON] = [
new ol.style.Style({
fill: new ol.style.Fill({
styles[_ol_geom_GeometryType_.POLYGON] = [
new _ol_style_Style_({
fill: new _ol_style_Fill_({
color: [255, 255, 255, 0.5]
})
})
];
styles[ol.geom.GeometryType.MULTI_POLYGON] =
styles[ol.geom.GeometryType.POLYGON];
styles[_ol_geom_GeometryType_.MULTI_POLYGON] =
styles[_ol_geom_GeometryType_.POLYGON];
styles[ol.geom.GeometryType.LINE_STRING] = [
new ol.style.Style({
stroke: new ol.style.Stroke({
styles[_ol_geom_GeometryType_.LINE_STRING] = [
new _ol_style_Style_({
stroke: new _ol_style_Stroke_({
color: white,
width: width + 2
})
}),
new ol.style.Style({
stroke: new ol.style.Stroke({
new _ol_style_Style_({
stroke: new _ol_style_Stroke_({
color: blue,
width: width
})
})
];
styles[ol.geom.GeometryType.MULTI_LINE_STRING] =
styles[ol.geom.GeometryType.LINE_STRING];
styles[_ol_geom_GeometryType_.MULTI_LINE_STRING] =
styles[_ol_geom_GeometryType_.LINE_STRING];
styles[ol.geom.GeometryType.CIRCLE] =
styles[ol.geom.GeometryType.POLYGON].concat(
styles[ol.geom.GeometryType.LINE_STRING]
styles[_ol_geom_GeometryType_.CIRCLE] =
styles[_ol_geom_GeometryType_.POLYGON].concat(
styles[_ol_geom_GeometryType_.LINE_STRING]
);
styles[ol.geom.GeometryType.POINT] = [
new ol.style.Style({
image: new ol.style.Circle({
styles[_ol_geom_GeometryType_.POINT] = [
new _ol_style_Style_({
image: new _ol_style_Circle_({
radius: width * 2,
fill: new ol.style.Fill({
fill: new _ol_style_Fill_({
color: blue
}),
stroke: new ol.style.Stroke({
stroke: new _ol_style_Stroke_({
color: white,
width: width / 2
})
@@ -403,13 +403,13 @@ ol.style.Style.createDefaultEditing = function() {
zIndex: Infinity
})
];
styles[ol.geom.GeometryType.MULTI_POINT] =
styles[ol.geom.GeometryType.POINT];
styles[_ol_geom_GeometryType_.MULTI_POINT] =
styles[_ol_geom_GeometryType_.POINT];
styles[ol.geom.GeometryType.GEOMETRY_COLLECTION] =
styles[ol.geom.GeometryType.POLYGON].concat(
styles[ol.geom.GeometryType.LINE_STRING],
styles[ol.geom.GeometryType.POINT]
styles[_ol_geom_GeometryType_.GEOMETRY_COLLECTION] =
styles[_ol_geom_GeometryType_.POLYGON].concat(
styles[_ol_geom_GeometryType_.LINE_STRING],
styles[_ol_geom_GeometryType_.POINT]
);
return styles;
@@ -422,6 +422,7 @@ ol.style.Style.createDefaultEditing = function() {
* for.
* @return {ol.geom.Geometry|ol.render.Feature|undefined} Geometry to render.
*/
ol.style.Style.defaultGeometryFunction = function(feature) {
_ol_style_Style_.defaultGeometryFunction = function(feature) {
return feature.getGeometry();
};
export default _ol_style_Style_;
+45 -45
View File
@@ -1,9 +1,8 @@
goog.provide('ol.style.Text');
goog.require('ol.style.Fill');
goog.require('ol.style.TextPlacement');
/**
* @module ol/style/Text
*/
import _ol_style_Fill_ from '../style/Fill.js';
import _ol_style_TextPlacement_ from '../style/TextPlacement.js';
/**
* @classdesc
@@ -13,7 +12,7 @@ goog.require('ol.style.TextPlacement');
* @param {olx.style.TextOptions=} opt_options Options.
* @api
*/
ol.style.Text = function(opt_options) {
var _ol_style_Text_ = function(opt_options) {
var options = opt_options || {};
@@ -64,7 +63,7 @@ ol.style.Text = function(opt_options) {
* @type {ol.style.Fill}
*/
this.fill_ = options.fill !== undefined ? options.fill :
new ol.style.Fill({color: ol.style.Text.DEFAULT_FILL_COLOR_});
new _ol_style_Fill_({color: _ol_style_Text_.DEFAULT_FILL_COLOR_});
/**
* @private
@@ -76,7 +75,7 @@ ol.style.Text = function(opt_options) {
* @private
* @type {ol.style.TextPlacement|string}
*/
this.placement_ = options.placement !== undefined ? options.placement : ol.style.TextPlacement.POINT;
this.placement_ = options.placement !== undefined ? options.placement : _ol_style_TextPlacement_.POINT;
//TODO Use options.overflow directly after removing @deprecated exceedLength
var overflow = options.overflow === undefined ? options.exceedLength : options.overflow;
@@ -132,7 +131,7 @@ ol.style.Text = function(opt_options) {
* @const {string}
* @private
*/
ol.style.Text.DEFAULT_FILL_COLOR_ = '#333';
_ol_style_Text_.DEFAULT_FILL_COLOR_ = '#333';
/**
@@ -140,8 +139,8 @@ ol.style.Text.DEFAULT_FILL_COLOR_ = '#333';
* @return {ol.style.Text} The cloned style.
* @api
*/
ol.style.Text.prototype.clone = function() {
return new ol.style.Text({
_ol_style_Text_.prototype.clone = function() {
return new _ol_style_Text_({
font: this.getFont(),
placement: this.getPlacement(),
maxAngle: this.getMaxAngle(),
@@ -165,7 +164,7 @@ ol.style.Text.prototype.clone = function() {
* @return {boolean} Let text overflow the length of the path they follow.
* @api
*/
ol.style.Text.prototype.getOverflow = function() {
_ol_style_Text_.prototype.getOverflow = function() {
return this.overflow_;
};
@@ -175,7 +174,7 @@ ol.style.Text.prototype.getOverflow = function() {
* @return {string|undefined} Font.
* @api
*/
ol.style.Text.prototype.getFont = function() {
_ol_style_Text_.prototype.getFont = function() {
return this.font_;
};
@@ -185,7 +184,7 @@ ol.style.Text.prototype.getFont = function() {
* @return {number} Angle in radians.
* @api
*/
ol.style.Text.prototype.getMaxAngle = function() {
_ol_style_Text_.prototype.getMaxAngle = function() {
return this.maxAngle_;
};
@@ -195,7 +194,7 @@ ol.style.Text.prototype.getMaxAngle = function() {
* @return {ol.style.TextPlacement|string} Text placement.
* @api
*/
ol.style.Text.prototype.getPlacement = function() {
_ol_style_Text_.prototype.getPlacement = function() {
return this.placement_;
};
@@ -205,7 +204,7 @@ ol.style.Text.prototype.getPlacement = function() {
* @return {number} Horizontal text offset.
* @api
*/
ol.style.Text.prototype.getOffsetX = function() {
_ol_style_Text_.prototype.getOffsetX = function() {
return this.offsetX_;
};
@@ -215,7 +214,7 @@ ol.style.Text.prototype.getOffsetX = function() {
* @return {number} Vertical text offset.
* @api
*/
ol.style.Text.prototype.getOffsetY = function() {
_ol_style_Text_.prototype.getOffsetY = function() {
return this.offsetY_;
};
@@ -225,7 +224,7 @@ ol.style.Text.prototype.getOffsetY = function() {
* @return {ol.style.Fill} Fill style.
* @api
*/
ol.style.Text.prototype.getFill = function() {
_ol_style_Text_.prototype.getFill = function() {
return this.fill_;
};
@@ -235,7 +234,7 @@ ol.style.Text.prototype.getFill = function() {
* @return {boolean|undefined} Rotate with map.
* @api
*/
ol.style.Text.prototype.getRotateWithView = function() {
_ol_style_Text_.prototype.getRotateWithView = function() {
return this.rotateWithView_;
};
@@ -245,7 +244,7 @@ ol.style.Text.prototype.getRotateWithView = function() {
* @return {number|undefined} Rotation.
* @api
*/
ol.style.Text.prototype.getRotation = function() {
_ol_style_Text_.prototype.getRotation = function() {
return this.rotation_;
};
@@ -255,7 +254,7 @@ ol.style.Text.prototype.getRotation = function() {
* @return {number|undefined} Scale.
* @api
*/
ol.style.Text.prototype.getScale = function() {
_ol_style_Text_.prototype.getScale = function() {
return this.scale_;
};
@@ -265,7 +264,7 @@ ol.style.Text.prototype.getScale = function() {
* @return {ol.style.Stroke} Stroke style.
* @api
*/
ol.style.Text.prototype.getStroke = function() {
_ol_style_Text_.prototype.getStroke = function() {
return this.stroke_;
};
@@ -275,7 +274,7 @@ ol.style.Text.prototype.getStroke = function() {
* @return {string|undefined} Text.
* @api
*/
ol.style.Text.prototype.getText = function() {
_ol_style_Text_.prototype.getText = function() {
return this.text_;
};
@@ -285,7 +284,7 @@ ol.style.Text.prototype.getText = function() {
* @return {string|undefined} Text align.
* @api
*/
ol.style.Text.prototype.getTextAlign = function() {
_ol_style_Text_.prototype.getTextAlign = function() {
return this.textAlign_;
};
@@ -295,7 +294,7 @@ ol.style.Text.prototype.getTextAlign = function() {
* @return {string|undefined} Text baseline.
* @api
*/
ol.style.Text.prototype.getTextBaseline = function() {
_ol_style_Text_.prototype.getTextBaseline = function() {
return this.textBaseline_;
};
@@ -305,7 +304,7 @@ ol.style.Text.prototype.getTextBaseline = function() {
* @return {ol.style.Fill} Fill style.
* @api
*/
ol.style.Text.prototype.getBackgroundFill = function() {
_ol_style_Text_.prototype.getBackgroundFill = function() {
return this.backgroundFill_;
};
@@ -315,7 +314,7 @@ ol.style.Text.prototype.getBackgroundFill = function() {
* @return {ol.style.Stroke} Stroke style.
* @api
*/
ol.style.Text.prototype.getBackgroundStroke = function() {
_ol_style_Text_.prototype.getBackgroundStroke = function() {
return this.backgroundStroke_;
};
@@ -325,7 +324,7 @@ ol.style.Text.prototype.getBackgroundStroke = function() {
* @return {Array.<number>} Padding.
* @api
*/
ol.style.Text.prototype.getPadding = function() {
_ol_style_Text_.prototype.getPadding = function() {
return this.padding_;
};
@@ -336,7 +335,7 @@ ol.style.Text.prototype.getPadding = function() {
* @param {boolean} overflow Let text overflow the path that it follows.
* @api
*/
ol.style.Text.prototype.setOverflow = function(overflow) {
_ol_style_Text_.prototype.setOverflow = function(overflow) {
this.overflow_ = overflow;
};
@@ -347,7 +346,7 @@ ol.style.Text.prototype.setOverflow = function(overflow) {
* @param {string|undefined} font Font.
* @api
*/
ol.style.Text.prototype.setFont = function(font) {
_ol_style_Text_.prototype.setFont = function(font) {
this.font_ = font;
};
@@ -358,7 +357,7 @@ ol.style.Text.prototype.setFont = function(font) {
* @param {number} maxAngle Angle in radians.
* @api
*/
ol.style.Text.prototype.setMaxAngle = function(maxAngle) {
_ol_style_Text_.prototype.setMaxAngle = function(maxAngle) {
this.maxAngle_ = maxAngle;
};
@@ -369,7 +368,7 @@ ol.style.Text.prototype.setMaxAngle = function(maxAngle) {
* @param {number} offsetX Horizontal text offset.
* @api
*/
ol.style.Text.prototype.setOffsetX = function(offsetX) {
_ol_style_Text_.prototype.setOffsetX = function(offsetX) {
this.offsetX_ = offsetX;
};
@@ -380,7 +379,7 @@ ol.style.Text.prototype.setOffsetX = function(offsetX) {
* @param {number} offsetY Vertical text offset.
* @api
*/
ol.style.Text.prototype.setOffsetY = function(offsetY) {
_ol_style_Text_.prototype.setOffsetY = function(offsetY) {
this.offsetY_ = offsetY;
};
@@ -391,7 +390,7 @@ ol.style.Text.prototype.setOffsetY = function(offsetY) {
* @param {ol.style.TextPlacement|string} placement Placement.
* @api
*/
ol.style.Text.prototype.setPlacement = function(placement) {
_ol_style_Text_.prototype.setPlacement = function(placement) {
this.placement_ = placement;
};
@@ -402,7 +401,7 @@ ol.style.Text.prototype.setPlacement = function(placement) {
* @param {ol.style.Fill} fill Fill style.
* @api
*/
ol.style.Text.prototype.setFill = function(fill) {
_ol_style_Text_.prototype.setFill = function(fill) {
this.fill_ = fill;
};
@@ -413,7 +412,7 @@ ol.style.Text.prototype.setFill = function(fill) {
* @param {number|undefined} rotation Rotation.
* @api
*/
ol.style.Text.prototype.setRotation = function(rotation) {
_ol_style_Text_.prototype.setRotation = function(rotation) {
this.rotation_ = rotation;
};
@@ -424,7 +423,7 @@ ol.style.Text.prototype.setRotation = function(rotation) {
* @param {number|undefined} scale Scale.
* @api
*/
ol.style.Text.prototype.setScale = function(scale) {
_ol_style_Text_.prototype.setScale = function(scale) {
this.scale_ = scale;
};
@@ -435,7 +434,7 @@ ol.style.Text.prototype.setScale = function(scale) {
* @param {ol.style.Stroke} stroke Stroke style.
* @api
*/
ol.style.Text.prototype.setStroke = function(stroke) {
_ol_style_Text_.prototype.setStroke = function(stroke) {
this.stroke_ = stroke;
};
@@ -446,7 +445,7 @@ ol.style.Text.prototype.setStroke = function(stroke) {
* @param {string|undefined} text Text.
* @api
*/
ol.style.Text.prototype.setText = function(text) {
_ol_style_Text_.prototype.setText = function(text) {
this.text_ = text;
};
@@ -457,7 +456,7 @@ ol.style.Text.prototype.setText = function(text) {
* @param {string|undefined} textAlign Text align.
* @api
*/
ol.style.Text.prototype.setTextAlign = function(textAlign) {
_ol_style_Text_.prototype.setTextAlign = function(textAlign) {
this.textAlign_ = textAlign;
};
@@ -468,7 +467,7 @@ ol.style.Text.prototype.setTextAlign = function(textAlign) {
* @param {string|undefined} textBaseline Text baseline.
* @api
*/
ol.style.Text.prototype.setTextBaseline = function(textBaseline) {
_ol_style_Text_.prototype.setTextBaseline = function(textBaseline) {
this.textBaseline_ = textBaseline;
};
@@ -479,7 +478,7 @@ ol.style.Text.prototype.setTextBaseline = function(textBaseline) {
* @param {ol.style.Fill} fill Fill style.
* @api
*/
ol.style.Text.prototype.setBackgroundFill = function(fill) {
_ol_style_Text_.prototype.setBackgroundFill = function(fill) {
this.backgroundFill_ = fill;
};
@@ -490,7 +489,7 @@ ol.style.Text.prototype.setBackgroundFill = function(fill) {
* @param {ol.style.Stroke} stroke Stroke style.
* @api
*/
ol.style.Text.prototype.setBackgroundStroke = function(stroke) {
_ol_style_Text_.prototype.setBackgroundStroke = function(stroke) {
this.backgroundStroke_ = stroke;
};
@@ -501,6 +500,7 @@ ol.style.Text.prototype.setBackgroundStroke = function(stroke) {
* @param {!Array.<number>} padding Padding.
* @api
*/
ol.style.Text.prototype.setPadding = function(padding) {
_ol_style_Text_.prototype.setPadding = function(padding) {
this.padding_ = padding;
};
export default _ol_style_Text_;
+6 -4
View File
@@ -1,6 +1,6 @@
goog.provide('ol.style.TextPlacement');
/**
* @module ol/style/TextPlacement
*/
/**
* Text placement. One of `'point'`, `'line'`. Default is `'point'`. Note that
* `'line'` requires the underlying geometry to be a {@link ol.geom.LineString},
@@ -8,7 +8,9 @@ goog.provide('ol.style.TextPlacement');
* {@link ol.geom.MultiPolygon}.
* @enum {string}
*/
ol.style.TextPlacement = {
var _ol_style_TextPlacement_ = {
POINT: 'point',
LINE: 'line'
};
export default _ol_style_TextPlacement_;