Shorter module paths for default exports
This commit is contained in:
@@ -89,7 +89,7 @@ const AtlasManager = function(opt_options) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Array.<module:ol/style/Atlas~Atlas>}
|
||||
* @type {Array.<module:ol/style/Atlas>}
|
||||
*/
|
||||
this.atlases_ = [new Atlas(this.currentSize_, this.space_)];
|
||||
|
||||
@@ -102,7 +102,7 @@ const AtlasManager = function(opt_options) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Array.<module:ol/style/Atlas~Atlas>}
|
||||
* @type {Array.<module:ol/style/Atlas>}
|
||||
*/
|
||||
this.hitAtlases_ = [new Atlas(this.currentHitSize_, this.space_)];
|
||||
};
|
||||
@@ -128,7 +128,7 @@ AtlasManager.prototype.getInfo = function(id) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param {Array.<module:ol/style/Atlas~Atlas>} atlases The atlases to search.
|
||||
* @param {Array.<module:ol/style/Atlas>} atlases The atlases to search.
|
||||
* @param {string} id The identifier of the entry to check.
|
||||
* @return {?module:ol/style/Atlas~AtlasInfo} The position and atlas image for the entry,
|
||||
* or `null` if the entry is not part of the atlases.
|
||||
@@ -154,12 +154,14 @@ AtlasManager.prototype.getInfo_ = function(atlases, id) {
|
||||
* entry, or `null` if the entry is not part of the atlases.
|
||||
*/
|
||||
AtlasManager.prototype.mergeInfos_ = function(info, hitInfo) {
|
||||
return /** @type {module:ol/style/AtlasManager~AtlasManagerInfo} */ ({
|
||||
offsetX: info.offsetX,
|
||||
offsetY: info.offsetY,
|
||||
image: info.image,
|
||||
hitImage: hitInfo.image
|
||||
});
|
||||
return (
|
||||
/** @type {module:ol/style/AtlasManager~AtlasManagerInfo} */ ({
|
||||
offsetX: info.offsetX,
|
||||
offsetY: info.offsetY,
|
||||
image: info.image,
|
||||
hitImage: hitInfo.image
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -7,14 +7,14 @@ import RegularShape from '../style/RegularShape.js';
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {module:ol/style/Fill~Fill} [fill] Fill style.
|
||||
* @property {module:ol/style/Fill} [fill] Fill style.
|
||||
* @property {number} radius Circle radius.
|
||||
* @property {boolean} [snapToPixel=true] If `true` integral numbers of pixels are used as the X and Y pixel coordinate
|
||||
* when drawing the circle in the output canvas. If `false` fractional numbers may be used. Using `true` allows for
|
||||
* "sharp" rendering (no blur), while using `false` allows for "accurate" rendering. Note that accuracy is important if
|
||||
* the circle's position is animated. Without it, the circle may jitter noticeably.
|
||||
* @property {module:ol/style/Stroke~Stroke} [stroke] Stroke style.
|
||||
* @property {module:ol/style/AtlasManager~AtlasManager} [atlasManager] The atlas manager to use for this circle.
|
||||
* @property {module:ol/style/Stroke} [stroke] Stroke style.
|
||||
* @property {module:ol/style/AtlasManager} [atlasManager] The atlas manager to use for this circle.
|
||||
* When using WebGL it is recommended to use an atlas manager to avoid texture switching. If an atlas manager is given,
|
||||
* the circle is added to an atlas. By default no atlas manager is used.
|
||||
*/
|
||||
@@ -26,7 +26,7 @@ import RegularShape from '../style/RegularShape.js';
|
||||
*
|
||||
* @constructor
|
||||
* @param {module:ol/style/Circle~Options=} opt_options Options.
|
||||
* @extends {module:ol/style/RegularShape~RegularShape}
|
||||
* @extends {module:ol/style/RegularShape}
|
||||
* @api
|
||||
*/
|
||||
const CircleStyle = function(opt_options) {
|
||||
@@ -49,7 +49,7 @@ inherits(CircleStyle, RegularShape);
|
||||
|
||||
/**
|
||||
* Clones the style. If an atlasmanager was provided to the original style it will be used in the cloned style, too.
|
||||
* @return {module:ol/style/Circle~CircleStyle} The cloned style.
|
||||
* @return {module:ol/style/Circle} The cloned style.
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
|
||||
@@ -41,7 +41,7 @@ const Fill = function(opt_options) {
|
||||
|
||||
/**
|
||||
* Clones the style. The color is not cloned if it is an {@link module:ol/colorlike~ColorLike}.
|
||||
* @return {module:ol/style/Fill~Fill} The cloned style.
|
||||
* @return {module:ol/style/Fill} The cloned style.
|
||||
* @api
|
||||
*/
|
||||
Fill.prototype.clone = function() {
|
||||
|
||||
@@ -58,7 +58,7 @@ import ImageStyle from '../style/Image.js';
|
||||
*
|
||||
* @constructor
|
||||
* @param {module:ol/style/Icon~Options=} opt_options Options.
|
||||
* @extends {module:ol/style/Image~ImageStyle}
|
||||
* @extends {module:ol/style/Image}
|
||||
* @api
|
||||
*/
|
||||
const Icon = function(opt_options) {
|
||||
@@ -145,7 +145,7 @@ const Icon = function(opt_options) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/style/IconImage~IconImage}
|
||||
* @type {module:ol/style/IconImage}
|
||||
*/
|
||||
this.iconImage_ = getIconImage(
|
||||
image, /** @type {string} */ (src), imgSize, this.crossOrigin_, imageState, this.color_);
|
||||
@@ -217,7 +217,7 @@ inherits(Icon, ImageStyle);
|
||||
|
||||
/**
|
||||
* Clones the style. The underlying Image/HTMLCanvasElement is not cloned.
|
||||
* @return {module:ol/style/Icon~Icon} The cloned style.
|
||||
* @return {module:ol/style/Icon} The cloned style.
|
||||
* @api
|
||||
*/
|
||||
Icon.prototype.clone = function() {
|
||||
|
||||
@@ -17,7 +17,7 @@ import {shared as iconImageCache} from '../style/IconImageCache.js';
|
||||
* @param {?string} crossOrigin Cross origin.
|
||||
* @param {module:ol/ImageState~ImageState} imageState Image state.
|
||||
* @param {module:ol/color~Color} color Color.
|
||||
* @extends {module:ol/events/EventTarget~EventTarget}
|
||||
* @extends {module:ol/events/EventTarget}
|
||||
*/
|
||||
const IconImage = function(image, src, size, crossOrigin, imageState, color) {
|
||||
|
||||
@@ -98,7 +98,7 @@ inherits(IconImage, EventTarget);
|
||||
* @param {?string} crossOrigin Cross origin.
|
||||
* @param {module:ol/ImageState~ImageState} imageState Image state.
|
||||
* @param {module:ol/color~Color} color Color.
|
||||
* @return {module:ol/style/IconImage~IconImage} Icon image.
|
||||
* @return {module:ol/style/IconImage} Icon image.
|
||||
*/
|
||||
export function get(image, src, size, crossOrigin, imageState, color) {
|
||||
let iconImage = iconImageCache.get(src, crossOrigin, color);
|
||||
|
||||
@@ -10,7 +10,7 @@ import {asString} from '../color.js';
|
||||
const IconImageCache = function() {
|
||||
|
||||
/**
|
||||
* @type {!Object.<string, module:ol/style/IconImage~IconImage>}
|
||||
* @type {!Object.<string, module:ol/style/IconImage>}
|
||||
* @private
|
||||
*/
|
||||
this.cache_ = {};
|
||||
@@ -71,7 +71,7 @@ IconImageCache.prototype.expire = function() {
|
||||
* @param {string} src Src.
|
||||
* @param {?string} crossOrigin Cross origin.
|
||||
* @param {module:ol/color~Color} color Color.
|
||||
* @return {module:ol/style/IconImage~IconImage} Icon image.
|
||||
* @return {module:ol/style/IconImage} Icon image.
|
||||
*/
|
||||
IconImageCache.prototype.get = function(src, crossOrigin, color) {
|
||||
const key = getKey(src, crossOrigin, color);
|
||||
@@ -83,7 +83,7 @@ IconImageCache.prototype.get = function(src, crossOrigin, color) {
|
||||
* @param {string} src Src.
|
||||
* @param {?string} crossOrigin Cross origin.
|
||||
* @param {module:ol/color~Color} color Color.
|
||||
* @param {module:ol/style/IconImage~IconImage} iconImage Icon image.
|
||||
* @param {module:ol/style/IconImage} iconImage Icon image.
|
||||
*/
|
||||
IconImageCache.prototype.set = function(src, crossOrigin, color, iconImage) {
|
||||
const key = getKey(src, crossOrigin, color);
|
||||
|
||||
@@ -229,7 +229,7 @@ ImageStyle.prototype.setSnapToPixel = function(snapToPixel) {
|
||||
|
||||
/**
|
||||
* @abstract
|
||||
* @param {function(this: T, module:ol/events/Event~Event)} listener Listener function.
|
||||
* @param {function(this: T, module:ol/events/Event)} listener Listener function.
|
||||
* @param {T} thisArg Value to use as `this` when executing `listener`.
|
||||
* @return {module:ol/events~EventsKey|undefined} Listener key.
|
||||
* @template T
|
||||
@@ -246,7 +246,7 @@ ImageStyle.prototype.load = function() {};
|
||||
|
||||
/**
|
||||
* @abstract
|
||||
* @param {function(this: T, module:ol/events/Event~Event)} listener Listener function.
|
||||
* @param {function(this: T, module:ol/events/Event)} listener Listener function.
|
||||
* @param {T} thisArg Value to use as `this` when executing `listener`.
|
||||
* @template T
|
||||
*/
|
||||
|
||||
@@ -13,7 +13,7 @@ import ImageStyle from '../style/Image.js';
|
||||
/**
|
||||
* Specify radius for regular polygons, or radius1 and radius2 for stars.
|
||||
* @typedef {Object} Options
|
||||
* @property {module:ol/style/Fill~Fill} [fill] Fill style.
|
||||
* @property {module:ol/style/Fill} [fill] Fill style.
|
||||
* @property {number} points Number of points for stars and regular polygons. In case of a polygon, the number of points
|
||||
* is the number of sides.
|
||||
* @property {number} [radius] Radius of a regular polygon.
|
||||
@@ -24,10 +24,10 @@ import ImageStyle from '../style/Image.js';
|
||||
* when drawing the shape in the output canvas. If `false` fractional numbers may be used. Using `true` allows for
|
||||
* "sharp" rendering (no blur), while using `false` allows for "accurate" rendering. Note that accuracy is important if
|
||||
* the shape's position is animated. Without it, the shape may jitter noticeably.
|
||||
* @property {module:ol/style/Stroke~Stroke} [stroke] Stroke style.
|
||||
* @property {module:ol/style/Stroke} [stroke] Stroke style.
|
||||
* @property {number} [rotation=0] Rotation in radians (positive rotation clockwise).
|
||||
* @property {boolean} [rotateWithView=false] Whether to rotate the shape with the view.
|
||||
* @property {module:ol/style/AtlasManager~AtlasManager} [atlasManager] The atlas manager to use for this symbol. When
|
||||
* @property {module:ol/style/AtlasManager} [atlasManager] The atlas manager to use for this symbol. When
|
||||
* using WebGL it is recommended to use an atlas manager to avoid texture switching. If an atlas manager is given, the
|
||||
* symbol is added to an atlas. By default no atlas manager is used.
|
||||
*/
|
||||
@@ -53,7 +53,7 @@ import ImageStyle from '../style/Image.js';
|
||||
*
|
||||
* @constructor
|
||||
* @param {module:ol/style/RegularShape~Options} options Options.
|
||||
* @extends {module:ol/style/Image~ImageStyle}
|
||||
* @extends {module:ol/style/Image}
|
||||
* @api
|
||||
*/
|
||||
const RegularShape = function(options) {
|
||||
@@ -77,7 +77,7 @@ const RegularShape = function(options) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/style/Fill~Fill}
|
||||
* @type {module:ol/style/Fill}
|
||||
*/
|
||||
this.fill_ = options.fill !== undefined ? options.fill : null;
|
||||
|
||||
@@ -114,7 +114,7 @@ const RegularShape = function(options) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/style/Stroke~Stroke}
|
||||
* @type {module:ol/style/Stroke}
|
||||
*/
|
||||
this.stroke_ = options.stroke !== undefined ? options.stroke : null;
|
||||
|
||||
@@ -144,7 +144,7 @@ const RegularShape = function(options) {
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @type {module:ol/style/AtlasManager~AtlasManager|undefined}
|
||||
* @type {module:ol/style/AtlasManager|undefined}
|
||||
*/
|
||||
this.atlasManager_ = options.atlasManager;
|
||||
|
||||
@@ -176,7 +176,7 @@ inherits(RegularShape, ImageStyle);
|
||||
|
||||
/**
|
||||
* Clones the style. If an atlasmanager was provided to the original style it will be used in the cloned style, too.
|
||||
* @return {module:ol/style/RegularShape~RegularShape} The cloned style.
|
||||
* @return {module:ol/style/RegularShape} The cloned style.
|
||||
* @api
|
||||
*/
|
||||
RegularShape.prototype.clone = function() {
|
||||
@@ -219,7 +219,7 @@ RegularShape.prototype.getAngle = function() {
|
||||
|
||||
/**
|
||||
* Get the fill style for the shape.
|
||||
* @return {module:ol/style/Fill~Fill} Fill style.
|
||||
* @return {module:ol/style/Fill} Fill style.
|
||||
* @api
|
||||
*/
|
||||
RegularShape.prototype.getFill = function() {
|
||||
@@ -318,7 +318,7 @@ RegularShape.prototype.getSize = function() {
|
||||
|
||||
/**
|
||||
* Get the stroke style for the shape.
|
||||
* @return {module:ol/style/Stroke~Stroke} Stroke style.
|
||||
* @return {module:ol/style/Stroke} Stroke style.
|
||||
* @api
|
||||
*/
|
||||
RegularShape.prototype.getStroke = function() {
|
||||
@@ -346,7 +346,7 @@ RegularShape.prototype.unlistenImageChange = function(listener, thisArg) {};
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @param {module:ol/style/AtlasManager~AtlasManager|undefined} atlasManager An atlas manager.
|
||||
* @param {module:ol/style/AtlasManager|undefined} atlasManager An atlas manager.
|
||||
*/
|
||||
RegularShape.prototype.render_ = function(atlasManager) {
|
||||
let imageSize;
|
||||
|
||||
@@ -87,7 +87,7 @@ const Stroke = function(opt_options) {
|
||||
|
||||
/**
|
||||
* Clones the style.
|
||||
* @return {module:ol/style/Stroke~Stroke} The cloned style.
|
||||
* @return {module:ol/style/Stroke} The cloned style.
|
||||
* @api
|
||||
*/
|
||||
Stroke.prototype.clone = function() {
|
||||
|
||||
+43
-39
@@ -8,11 +8,11 @@ import Fill from '../style/Fill.js';
|
||||
import Stroke from '../style/Stroke.js';
|
||||
|
||||
/**
|
||||
* A function that takes an {@link module:ol/Feature~Feature} as argument and returns an
|
||||
* {@link module:ol/geom/Geometry~Geometry} that will be rendered and styled for the feature.
|
||||
* A function that takes an {@link module:ol/Feature} as argument and returns an
|
||||
* {@link module:ol/geom/Geometry} that will be rendered and styled for the feature.
|
||||
*
|
||||
* @typedef {function((module:ol/Feature~Feature|module:ol/render/Feature~RenderFeature)):
|
||||
* (module:ol/geom/Geometry~Geometry|module:ol/render/Feature~RenderFeature|undefined)} GeometryFunction
|
||||
* @typedef {function((module:ol/Feature|module:ol/render/Feature)):
|
||||
* (module:ol/geom/Geometry|module:ol/render/Feature|undefined)} GeometryFunction
|
||||
*/
|
||||
|
||||
|
||||
@@ -29,14 +29,14 @@ import Stroke from '../style/Stroke.js';
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {string|module:ol/geom/Geometry~Geometry|module:ol/style/Style~GeometryFunction} [geometry] Feature property or geometry
|
||||
* @property {string|module:ol/geom/Geometry|module:ol/style/Style~GeometryFunction} [geometry] Feature property or geometry
|
||||
* or function returning a geometry to render for this style.
|
||||
* @property {module:ol/style/Fill~Fill} [fill] Fill style.
|
||||
* @property {module:ol/style/Image~ImageStyle} [image] Image style.
|
||||
* @property {module:ol/style/Fill} [fill] Fill style.
|
||||
* @property {module:ol/style/Image} [image] Image style.
|
||||
* @property {module:ol/style/Style~RenderFunction} [renderer] Custom renderer. When configured, `fill`, `stroke` and `image` will be
|
||||
* ignored, and the provided function will be called with each render frame for each geometry.
|
||||
* @property {module:ol/style/Stroke~Stroke} [stroke] Stroke style.
|
||||
* @property {module:ol/style/Text~Text} [text] Text style.
|
||||
* @property {module:ol/style/Stroke} [stroke] Stroke style.
|
||||
* @property {module:ol/style/Text} [text] Text style.
|
||||
* @property {number} [zIndex] Z index.
|
||||
*/
|
||||
|
||||
@@ -58,7 +58,7 @@ const Style = function(opt_options) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {string|module:ol/geom/Geometry~Geometry|module:ol/style/Style~GeometryFunction}
|
||||
* @type {string|module:ol/geom/Geometry|module:ol/style/Style~GeometryFunction}
|
||||
*/
|
||||
this.geometry_ = null;
|
||||
|
||||
@@ -74,14 +74,14 @@ const Style = function(opt_options) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/style/Fill~Fill}
|
||||
* @type {module:ol/style/Fill}
|
||||
*/
|
||||
this.fill_ = options.fill !== undefined ? options.fill : null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/style/Image~ImageStyle}
|
||||
*/
|
||||
* @private
|
||||
* @type {module:ol/style/Image}
|
||||
*/
|
||||
this.image_ = options.image !== undefined ? options.image : null;
|
||||
|
||||
/**
|
||||
@@ -92,13 +92,13 @@ const Style = function(opt_options) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/style/Stroke~Stroke}
|
||||
* @type {module:ol/style/Stroke}
|
||||
*/
|
||||
this.stroke_ = options.stroke !== undefined ? options.stroke : null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/style/Text~Text}
|
||||
* @type {module:ol/style/Text}
|
||||
*/
|
||||
this.text_ = options.text !== undefined ? options.text : null;
|
||||
|
||||
@@ -113,7 +113,7 @@ const Style = function(opt_options) {
|
||||
|
||||
/**
|
||||
* Clones the style.
|
||||
* @return {module:ol/style/Style~Style} The cloned style.
|
||||
* @return {module:ol/style/Style} The cloned style.
|
||||
* @api
|
||||
*/
|
||||
Style.prototype.clone = function() {
|
||||
@@ -156,7 +156,7 @@ Style.prototype.setRenderer = function(renderer) {
|
||||
|
||||
/**
|
||||
* Get the geometry to be rendered.
|
||||
* @return {string|module:ol/geom/Geometry~Geometry|module:ol/style/Style~GeometryFunction}
|
||||
* @return {string|module:ol/geom/Geometry|module:ol/style/Style~GeometryFunction}
|
||||
* Feature property or geometry or function that returns the geometry that will
|
||||
* be rendered with this style.
|
||||
* @api
|
||||
@@ -179,7 +179,7 @@ Style.prototype.getGeometryFunction = function() {
|
||||
|
||||
/**
|
||||
* Get the fill style.
|
||||
* @return {module:ol/style/Fill~Fill} Fill style.
|
||||
* @return {module:ol/style/Fill} Fill style.
|
||||
* @api
|
||||
*/
|
||||
Style.prototype.getFill = function() {
|
||||
@@ -189,7 +189,7 @@ Style.prototype.getFill = function() {
|
||||
|
||||
/**
|
||||
* Set the fill style.
|
||||
* @param {module:ol/style/Fill~Fill} fill Fill style.
|
||||
* @param {module:ol/style/Fill} fill Fill style.
|
||||
* @api
|
||||
*/
|
||||
Style.prototype.setFill = function(fill) {
|
||||
@@ -199,7 +199,7 @@ Style.prototype.setFill = function(fill) {
|
||||
|
||||
/**
|
||||
* Get the image style.
|
||||
* @return {module:ol/style/Image~ImageStyle} Image style.
|
||||
* @return {module:ol/style/Image} Image style.
|
||||
* @api
|
||||
*/
|
||||
Style.prototype.getImage = function() {
|
||||
@@ -209,7 +209,7 @@ Style.prototype.getImage = function() {
|
||||
|
||||
/**
|
||||
* Set the image style.
|
||||
* @param {module:ol/style/Image~ImageStyle} image Image style.
|
||||
* @param {module:ol/style/Image} image Image style.
|
||||
* @api
|
||||
*/
|
||||
Style.prototype.setImage = function(image) {
|
||||
@@ -219,7 +219,7 @@ Style.prototype.setImage = function(image) {
|
||||
|
||||
/**
|
||||
* Get the stroke style.
|
||||
* @return {module:ol/style/Stroke~Stroke} Stroke style.
|
||||
* @return {module:ol/style/Stroke} Stroke style.
|
||||
* @api
|
||||
*/
|
||||
Style.prototype.getStroke = function() {
|
||||
@@ -229,7 +229,7 @@ Style.prototype.getStroke = function() {
|
||||
|
||||
/**
|
||||
* Set the stroke style.
|
||||
* @param {module:ol/style/Stroke~Stroke} stroke Stroke style.
|
||||
* @param {module:ol/style/Stroke} stroke Stroke style.
|
||||
* @api
|
||||
*/
|
||||
Style.prototype.setStroke = function(stroke) {
|
||||
@@ -239,7 +239,7 @@ Style.prototype.setStroke = function(stroke) {
|
||||
|
||||
/**
|
||||
* Get the text style.
|
||||
* @return {module:ol/style/Text~Text} Text style.
|
||||
* @return {module:ol/style/Text} Text style.
|
||||
* @api
|
||||
*/
|
||||
Style.prototype.getText = function() {
|
||||
@@ -249,7 +249,7 @@ Style.prototype.getText = function() {
|
||||
|
||||
/**
|
||||
* Set the text style.
|
||||
* @param {module:ol/style/Text~Text} text Text style.
|
||||
* @param {module:ol/style/Text} text Text style.
|
||||
* @api
|
||||
*/
|
||||
Style.prototype.setText = function(text) {
|
||||
@@ -270,7 +270,7 @@ Style.prototype.getZIndex = function() {
|
||||
/**
|
||||
* Set a geometry that is rendered instead of the feature's geometry.
|
||||
*
|
||||
* @param {string|module:ol/geom/Geometry~Geometry|module:ol/style/Style~GeometryFunction} geometry
|
||||
* @param {string|module:ol/geom/Geometry|module:ol/style/Style~GeometryFunction} geometry
|
||||
* Feature property or geometry or function returning a geometry to render
|
||||
* for this style.
|
||||
* @api
|
||||
@@ -280,13 +280,17 @@ Style.prototype.setGeometry = function(geometry) {
|
||||
this.geometryFunction_ = geometry;
|
||||
} else if (typeof geometry === 'string') {
|
||||
this.geometryFunction_ = function(feature) {
|
||||
return /** @type {module:ol/geom/Geometry~Geometry} */ (feature.get(geometry));
|
||||
return (
|
||||
/** @type {module:ol/geom/Geometry} */ (feature.get(geometry))
|
||||
);
|
||||
};
|
||||
} else if (!geometry) {
|
||||
this.geometryFunction_ = defaultGeometryFunction;
|
||||
} else if (geometry !== undefined) {
|
||||
this.geometryFunction_ = function() {
|
||||
return /** @type {module:ol/geom/Geometry~Geometry} */ (geometry);
|
||||
return (
|
||||
/** @type {module:ol/geom/Geometry} */ (geometry)
|
||||
);
|
||||
};
|
||||
}
|
||||
this.geometry_ = geometry;
|
||||
@@ -306,9 +310,9 @@ Style.prototype.setZIndex = function(zIndex) {
|
||||
|
||||
/**
|
||||
* Convert the provided object into a style function. Functions passed through
|
||||
* unchanged. Arrays of module:ol/style/Style~Style or single style objects wrapped in a
|
||||
* unchanged. Arrays of module:ol/style/Style or single style objects wrapped in a
|
||||
* new style function.
|
||||
* @param {module:ol/style~StyleFunction|Array.<module:ol/style/Style~Style>|module:ol/style/Style~Style} obj
|
||||
* @param {module:ol/style~StyleFunction|Array.<module:ol/style/Style>|module:ol/style/Style} obj
|
||||
* A style function, a single style, or an array of styles.
|
||||
* @return {module:ol/style~StyleFunction} A style function.
|
||||
*/
|
||||
@@ -319,7 +323,7 @@ export function toFunction(obj) {
|
||||
styleFunction = obj;
|
||||
} else {
|
||||
/**
|
||||
* @type {Array.<module:ol/style/Style~Style>}
|
||||
* @type {Array.<module:ol/style/Style>}
|
||||
*/
|
||||
let styles;
|
||||
if (Array.isArray(obj)) {
|
||||
@@ -338,15 +342,15 @@ export function toFunction(obj) {
|
||||
|
||||
|
||||
/**
|
||||
* @type {Array.<module:ol/style/Style~Style>}
|
||||
* @type {Array.<module:ol/style/Style>}
|
||||
*/
|
||||
let defaultStyles = null;
|
||||
|
||||
|
||||
/**
|
||||
* @param {module:ol/Feature~Feature|module:ol/render/Feature~RenderFeature} feature Feature.
|
||||
* @param {module:ol/Feature|module:ol/render/Feature} feature Feature.
|
||||
* @param {number} resolution Resolution.
|
||||
* @return {Array.<module:ol/style/Style~Style>} Style.
|
||||
* @return {Array.<module:ol/style/Style>} Style.
|
||||
*/
|
||||
export function createDefaultStyle(feature, resolution) {
|
||||
// We don't use an immediately-invoked function
|
||||
@@ -380,10 +384,10 @@ export function createDefaultStyle(feature, resolution) {
|
||||
|
||||
/**
|
||||
* Default styles for editing features.
|
||||
* @return {Object.<module:ol/geom/GeometryType, Array.<module:ol/style/Style~Style>>} Styles
|
||||
* @return {Object.<module:ol/geom/GeometryType, Array.<module:ol/style/Style>>} Styles
|
||||
*/
|
||||
export function createEditingStyle() {
|
||||
/** @type {Object.<module:ol/geom/GeometryType, Array.<module:ol/style/Style~Style>>} */
|
||||
/** @type {Object.<module:ol/geom/GeometryType, Array.<module:ol/style/Style>>} */
|
||||
const styles = {};
|
||||
const white = [255, 255, 255, 1];
|
||||
const blue = [0, 153, 255, 1];
|
||||
@@ -451,8 +455,8 @@ export function createEditingStyle() {
|
||||
|
||||
/**
|
||||
* Function that is called with a feature and returns its default geometry.
|
||||
* @param {module:ol/Feature~Feature|module:ol/render/Feature~RenderFeature} feature Feature to get the geometry for.
|
||||
* @return {module:ol/geom/Geometry~Geometry|module:ol/render/Feature~RenderFeature|undefined} Geometry to render.
|
||||
* @param {module:ol/Feature|module:ol/render/Feature} feature Feature to get the geometry for.
|
||||
* @return {module:ol/geom/Geometry|module:ol/render/Feature|undefined} Geometry to render.
|
||||
*/
|
||||
function defaultGeometryFunction(feature) {
|
||||
return feature.getGeometry();
|
||||
|
||||
+17
-17
@@ -34,11 +34,11 @@ const DEFAULT_FILL_COLOR = '#333';
|
||||
* placement where `maxAngle` is not exceeded.
|
||||
* @property {string} [textBaseline='middle'] Text base line. Possible values: 'bottom', 'top', 'middle', 'alphabetic',
|
||||
* 'hanging', 'ideographic'.
|
||||
* @property {module:ol/style/Fill~Fill} [fill] Fill style. If none is provided, we'll use a dark fill-style (#333).
|
||||
* @property {module:ol/style/Stroke~Stroke} [stroke] Stroke style.
|
||||
* @property {module:ol/style/Fill~Fill} [backgroundFill] Fill style for the text background when `placement` is
|
||||
* @property {module:ol/style/Fill} [fill] Fill style. If none is provided, we'll use a dark fill-style (#333).
|
||||
* @property {module:ol/style/Stroke} [stroke] Stroke style.
|
||||
* @property {module:ol/style/Fill} [backgroundFill] Fill style for the text background when `placement` is
|
||||
* `'point'`. Default is no fill.
|
||||
* @property {module:ol/style/Stroke~Stroke} [backgroundStroke] Stroke style for the text background when `placement`
|
||||
* @property {module:ol/style/Stroke} [backgroundStroke] Stroke style for the text background when `placement`
|
||||
* is `'point'`. Default is no stroke.
|
||||
* @property {Array.<number>} [padding=[0, 0, 0, 0]] Padding in pixels around the text for decluttering and background. The order of
|
||||
* values in the array is `[top, right, bottom, left]`.
|
||||
@@ -101,7 +101,7 @@ const Text = function(opt_options) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/style/Fill~Fill}
|
||||
* @type {module:ol/style/Fill}
|
||||
*/
|
||||
this.fill_ = options.fill !== undefined ? options.fill :
|
||||
new Fill({color: DEFAULT_FILL_COLOR});
|
||||
@@ -126,7 +126,7 @@ const Text = function(opt_options) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/style/Stroke~Stroke}
|
||||
* @type {module:ol/style/Stroke}
|
||||
*/
|
||||
this.stroke_ = options.stroke !== undefined ? options.stroke : null;
|
||||
|
||||
@@ -144,13 +144,13 @@ const Text = function(opt_options) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/style/Fill~Fill}
|
||||
* @type {module:ol/style/Fill}
|
||||
*/
|
||||
this.backgroundFill_ = options.backgroundFill ? options.backgroundFill : null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/style/Stroke~Stroke}
|
||||
* @type {module:ol/style/Stroke}
|
||||
*/
|
||||
this.backgroundStroke_ = options.backgroundStroke ? options.backgroundStroke : null;
|
||||
|
||||
@@ -164,7 +164,7 @@ const Text = function(opt_options) {
|
||||
|
||||
/**
|
||||
* Clones the style.
|
||||
* @return {module:ol/style/Text~Text} The cloned style.
|
||||
* @return {module:ol/style/Text} The cloned style.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.clone = function() {
|
||||
@@ -251,7 +251,7 @@ Text.prototype.getOffsetY = function() {
|
||||
|
||||
/**
|
||||
* Get the fill style for the text.
|
||||
* @return {module:ol/style/Fill~Fill} Fill style.
|
||||
* @return {module:ol/style/Fill} Fill style.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.getFill = function() {
|
||||
@@ -291,7 +291,7 @@ Text.prototype.getScale = function() {
|
||||
|
||||
/**
|
||||
* Get the stroke style for the text.
|
||||
* @return {module:ol/style/Stroke~Stroke} Stroke style.
|
||||
* @return {module:ol/style/Stroke} Stroke style.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.getStroke = function() {
|
||||
@@ -331,7 +331,7 @@ Text.prototype.getTextBaseline = function() {
|
||||
|
||||
/**
|
||||
* Get the background fill style for the text.
|
||||
* @return {module:ol/style/Fill~Fill} Fill style.
|
||||
* @return {module:ol/style/Fill} Fill style.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.getBackgroundFill = function() {
|
||||
@@ -341,7 +341,7 @@ Text.prototype.getBackgroundFill = function() {
|
||||
|
||||
/**
|
||||
* Get the background stroke style for the text.
|
||||
* @return {module:ol/style/Stroke~Stroke} Stroke style.
|
||||
* @return {module:ol/style/Stroke} Stroke style.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.getBackgroundStroke = function() {
|
||||
@@ -428,7 +428,7 @@ Text.prototype.setPlacement = function(placement) {
|
||||
/**
|
||||
* Set the fill.
|
||||
*
|
||||
* @param {module:ol/style/Fill~Fill} fill Fill style.
|
||||
* @param {module:ol/style/Fill} fill Fill style.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.setFill = function(fill) {
|
||||
@@ -461,7 +461,7 @@ Text.prototype.setScale = function(scale) {
|
||||
/**
|
||||
* Set the stroke.
|
||||
*
|
||||
* @param {module:ol/style/Stroke~Stroke} stroke Stroke style.
|
||||
* @param {module:ol/style/Stroke} stroke Stroke style.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.setStroke = function(stroke) {
|
||||
@@ -505,7 +505,7 @@ Text.prototype.setTextBaseline = function(textBaseline) {
|
||||
/**
|
||||
* Set the background fill.
|
||||
*
|
||||
* @param {module:ol/style/Fill~Fill} fill Fill style.
|
||||
* @param {module:ol/style/Fill} fill Fill style.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.setBackgroundFill = function(fill) {
|
||||
@@ -516,7 +516,7 @@ Text.prototype.setBackgroundFill = function(fill) {
|
||||
/**
|
||||
* Set the background stroke.
|
||||
*
|
||||
* @param {module:ol/style/Stroke~Stroke} stroke Stroke style.
|
||||
* @param {module:ol/style/Stroke} stroke Stroke style.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.setBackgroundStroke = function(stroke) {
|
||||
|
||||
Reference in New Issue
Block a user