650 lines
16 KiB
JavaScript
650 lines
16 KiB
JavaScript
|
|
/**
|
|
* @type {Object}
|
|
*/
|
|
let olx;
|
|
|
|
|
|
/**
|
|
* @typedef {{context: CanvasRenderingContext2D,
|
|
* feature: (module:ol/Feature~Feature|ol.render.Feature),
|
|
* geometry: module:ol/geom/SimpleGeometry~SimpleGeometry,
|
|
* pixelRatio: number,
|
|
* resolution: number,
|
|
* rotation: number}}
|
|
*/
|
|
olx.render.State;
|
|
|
|
|
|
/**
|
|
* Canvas context that the layer is being rendered to.
|
|
* @type {CanvasRenderingContext2D}
|
|
* @api
|
|
*/
|
|
olx.render.State.prototype.context;
|
|
|
|
|
|
/**
|
|
* Pixel ratio used by the layer renderer.
|
|
* @type {number}
|
|
* @api
|
|
*/
|
|
olx.render.State.prototype.pixelRatio;
|
|
|
|
|
|
/**
|
|
* Resolution that the render batch was created and optimized for. This is
|
|
* not the view's resolution that is being rendered.
|
|
* @type {number}
|
|
* @api
|
|
*/
|
|
olx.render.State.prototype.resolution;
|
|
|
|
|
|
/**
|
|
* Rotation of the rendered layer in radians.
|
|
* @type {number}
|
|
* @api
|
|
*/
|
|
olx.render.State.prototype.rotation;
|
|
|
|
|
|
/**
|
|
* @typedef {{fill: (module:ol/style/Fill~Fill|undefined),
|
|
* radius: number,
|
|
* snapToPixel: (boolean|undefined),
|
|
* stroke: (module:ol/style/Stroke~Stroke|undefined),
|
|
* atlasManager: (module:ol/style/AtlasManager~AtlasManager|undefined)}}
|
|
*/
|
|
olx.style.CircleOptions;
|
|
|
|
|
|
/**
|
|
* Fill style.
|
|
* @type {module:ol/style/Fill~Fill|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.CircleOptions.prototype.fill;
|
|
|
|
|
|
/**
|
|
* Circle radius.
|
|
* @type {number}
|
|
* @api
|
|
*/
|
|
olx.style.CircleOptions.prototype.radius;
|
|
|
|
|
|
/**
|
|
* 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.
|
|
* Default value is `true`.
|
|
* @type {boolean|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.CircleOptions.prototype.snapToPixel;
|
|
|
|
|
|
/**
|
|
* Stroke style.
|
|
* @type {module:ol/style/Stroke~Stroke|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.CircleOptions.prototype.stroke;
|
|
|
|
|
|
/**
|
|
* 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.
|
|
* @type {module:ol/style/AtlasManager~AtlasManager|undefined}
|
|
*/
|
|
olx.style.CircleOptions.prototype.atlasManager;
|
|
|
|
|
|
/**
|
|
* @typedef {{anchor: (Array.<number>|undefined),
|
|
* anchorOrigin: (module:ol/style/IconOrigin~IconOrigin|undefined),
|
|
* anchorXUnits: (module:ol/style/IconAnchorUnits~IconAnchorUnits|undefined),
|
|
* anchorYUnits: (module:ol/style/IconAnchorUnits~IconAnchorUnits|undefined),
|
|
* color: (ol.Color|string|undefined),
|
|
* crossOrigin: (null|string|undefined),
|
|
* img: (Image|HTMLCanvasElement|undefined),
|
|
* offset: (Array.<number>|undefined),
|
|
* offsetOrigin: (module:ol/style/IconOrigin~IconOrigin|undefined),
|
|
* opacity: (number|undefined),
|
|
* scale: (number|undefined),
|
|
* snapToPixel: (boolean|undefined),
|
|
* rotateWithView: (boolean|undefined),
|
|
* rotation: (number|undefined),
|
|
* size: (ol.Size|undefined),
|
|
* imgSize: (ol.Size|undefined),
|
|
* src: (string|undefined)}}
|
|
*/
|
|
olx.style.IconOptions;
|
|
|
|
|
|
/**
|
|
* Anchor. Default value is `[0.5, 0.5]` (icon center).
|
|
* @type {Array.<number>|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.IconOptions.prototype.anchor;
|
|
|
|
|
|
/**
|
|
* Origin of the anchor: `bottom-left`, `bottom-right`, `top-left` or
|
|
* `top-right`. Default is `top-left`.
|
|
* @type {module:ol/style/IconOrigin~IconOrigin|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.IconOptions.prototype.anchorOrigin;
|
|
|
|
|
|
/**
|
|
* Units in which the anchor x value is specified. A value of `'fraction'`
|
|
* indicates the x value is a fraction of the icon. A value of `'pixels'`
|
|
* indicates the x value in pixels. Default is `'fraction'`.
|
|
* @type {module:ol/style/IconAnchorUnits~IconAnchorUnits|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.IconOptions.prototype.anchorXUnits;
|
|
|
|
|
|
/**
|
|
* Units in which the anchor y value is specified. A value of `'fraction'`
|
|
* indicates the y value is a fraction of the icon. A value of `'pixels'`
|
|
* indicates the y value in pixels. Default is `'fraction'`.
|
|
* @type {module:ol/style/IconAnchorUnits~IconAnchorUnits|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.IconOptions.prototype.anchorYUnits;
|
|
|
|
|
|
/**
|
|
* Color to tint the icon. If not specified, the icon will be left as is.
|
|
* @type {ol.Color|string|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.IconOptions.prototype.color;
|
|
|
|
|
|
/**
|
|
* The `crossOrigin` attribute for loaded images. Note that you must provide a
|
|
* `crossOrigin` value if you are using the WebGL renderer or if you want to
|
|
* access pixel data with the Canvas renderer. See
|
|
* {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image}
|
|
* for more detail.
|
|
* @type {null|string|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.IconOptions.prototype.crossOrigin;
|
|
|
|
|
|
/**
|
|
* Image object for the icon. If the `src` option is not provided then the
|
|
* provided image must already be loaded. And in that case, it is required
|
|
* to provide the size of the image, with the `imgSize` option.
|
|
* @type {Image|HTMLCanvasElement|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.IconOptions.prototype.img;
|
|
|
|
|
|
/**
|
|
* Offset, which, together with the size and the offset origin,
|
|
* define the sub-rectangle to use from the original icon image. Default value
|
|
* is `[0, 0]`.
|
|
* @type {Array.<number>|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.IconOptions.prototype.offset;
|
|
|
|
|
|
/**
|
|
* Origin of the offset: `bottom-left`, `bottom-right`, `top-left` or
|
|
* `top-right`. Default is `top-left`.
|
|
* @type {module:ol/style/IconOrigin~IconOrigin|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.IconOptions.prototype.offsetOrigin;
|
|
|
|
|
|
/**
|
|
* Opacity of the icon. Default is `1`.
|
|
* @type {number|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.IconOptions.prototype.opacity;
|
|
|
|
|
|
/**
|
|
* Scale. Default is `1`.
|
|
* @type {number|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.IconOptions.prototype.scale;
|
|
|
|
|
|
/**
|
|
* If `true` integral numbers of pixels are used as the X and Y pixel
|
|
* coordinate when drawing the icon 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 icon's position
|
|
* is animated. Without it, the icon may jitter noticeably. Default
|
|
* value is `true`.
|
|
* @type {boolean|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.IconOptions.prototype.snapToPixel;
|
|
|
|
|
|
/**
|
|
* Whether to rotate the icon with the view. Default is `false`.
|
|
* @type {boolean|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.IconOptions.prototype.rotateWithView;
|
|
|
|
|
|
/**
|
|
* Rotation in radians (positive rotation clockwise). Default is `0`.
|
|
* @type {number|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.IconOptions.prototype.rotation;
|
|
|
|
|
|
/**
|
|
* Icon size in pixel. Can be used together with `offset` to define the
|
|
* sub-rectangle to use from the origin (sprite) icon image.
|
|
* @type {ol.Size|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.IconOptions.prototype.size;
|
|
|
|
|
|
/**
|
|
* Image size in pixels. Only required if `img` is set and `src` is not, and for
|
|
* SVG images in Internet Explorer 11. The provided `imgSize` needs to match
|
|
* the actual size of the image.
|
|
* @type {ol.Size|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.IconOptions.prototype.imgSize;
|
|
|
|
|
|
/**
|
|
* Image source URI.
|
|
* @type {string|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.IconOptions.prototype.src;
|
|
|
|
|
|
/**
|
|
* Specify radius for regular polygons, or radius1 and radius2 for stars.
|
|
* @typedef {{fill: (module:ol/style/Fill~Fill|undefined),
|
|
* points: number,
|
|
* radius: (number|undefined),
|
|
* radius1: (number|undefined),
|
|
* radius2: (number|undefined),
|
|
* angle: (number|undefined),
|
|
* snapToPixel: (boolean|undefined),
|
|
* stroke: (module:ol/style/Stroke~Stroke|undefined),
|
|
* rotation: (number|undefined),
|
|
* rotateWithView: (boolean|undefined),
|
|
* atlasManager: (module:ol/style/AtlasManager~AtlasManager|undefined)}}
|
|
*/
|
|
olx.style.RegularShapeOptions;
|
|
|
|
|
|
/**
|
|
* Fill style.
|
|
* @type {module:ol/style/Fill~Fill|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.RegularShapeOptions.prototype.fill;
|
|
|
|
|
|
/**
|
|
* Number of points for stars and regular polygons. In case of a polygon, the
|
|
* number of points is the number of sides.
|
|
* @type {number}
|
|
* @api
|
|
*/
|
|
olx.style.RegularShapeOptions.prototype.points;
|
|
|
|
|
|
/**
|
|
* Radius of a regular polygon.
|
|
* @type {number|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.RegularShapeOptions.prototype.radius;
|
|
|
|
|
|
/**
|
|
* Outer radius of a star.
|
|
* @type {number|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.RegularShapeOptions.prototype.radius1;
|
|
|
|
|
|
/**
|
|
* Inner radius of a star.
|
|
* @type {number|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.RegularShapeOptions.prototype.radius2;
|
|
|
|
|
|
/**
|
|
* Shape's angle in radians. A value of 0 will have one of the shape's point
|
|
* facing up.
|
|
* Default value is 0.
|
|
* @type {number|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.RegularShapeOptions.prototype.angle;
|
|
|
|
|
|
/**
|
|
* If `true` integral numbers of pixels are used as the X and Y pixel
|
|
* coordinate 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.
|
|
* Default value is `true`.
|
|
* @type {boolean|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.RegularShapeOptions.prototype.snapToPixel;
|
|
|
|
|
|
/**
|
|
* Stroke style.
|
|
* @type {module:ol/style/Stroke~Stroke|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.RegularShapeOptions.prototype.stroke;
|
|
|
|
|
|
/**
|
|
* Rotation in radians (positive rotation clockwise). Default is `0`.
|
|
* @type {number|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.RegularShapeOptions.prototype.rotation;
|
|
|
|
|
|
/**
|
|
* Whether to rotate the shape with the view. Default is `false`.
|
|
* @type {boolean|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.RegularShapeOptions.prototype.rotateWithView;
|
|
|
|
|
|
/**
|
|
* 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.
|
|
* @type {module:ol/style/AtlasManager~AtlasManager|undefined}
|
|
*/
|
|
olx.style.RegularShapeOptions.prototype.atlasManager;
|
|
|
|
|
|
/**
|
|
* @typedef {{font: (string|undefined),
|
|
* maxAngle: (number|undefined),
|
|
* offsetX: (number|undefined),
|
|
* offsetY: (number|undefined),
|
|
* overflow: (boolean|undefined),
|
|
* placement: (module:ol/style/Text~TextPlacement|string|undefined),
|
|
* scale: (number|undefined),
|
|
* rotateWithView: (boolean|undefined),
|
|
* rotation: (number|undefined),
|
|
* text: (string|undefined),
|
|
* textAlign: (string|undefined),
|
|
* textBaseline: (string|undefined),
|
|
* fill: (module:ol/style/Fill~Fill|undefined),
|
|
* stroke: (module:ol/style/Stroke~Stroke|undefined),
|
|
* backgroundFill: (module:ol/style/Fill~Fill|undefined),
|
|
* backgroundStroke: (module:ol/style/Stroke~Stroke|undefined),
|
|
* padding: (Array.<number>|undefined)}}
|
|
*/
|
|
olx.style.TextOptions;
|
|
|
|
|
|
/**
|
|
* Font style as CSS 'font' value, see:
|
|
* {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/font}.
|
|
* Default is '10px sans-serif'
|
|
* @type {string|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.TextOptions.prototype.font;
|
|
|
|
|
|
/**
|
|
* When `placement` is set to `'line'`, allow a maximum angle between adjacent
|
|
* characters. The expected value is in radians, and the default is 45°
|
|
* (`Math.PI / 4`).
|
|
* @type {number|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.TextOptions.prototype.maxAngle;
|
|
|
|
|
|
/**
|
|
* Horizontal text offset in pixels. A positive will shift the text right.
|
|
* Default is `0`.
|
|
* @type {number|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.TextOptions.prototype.offsetX;
|
|
|
|
|
|
/**
|
|
* Vertical text offset in pixels. A positive will shift the text down. Default
|
|
* is `0`.
|
|
* @type {number|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.TextOptions.prototype.offsetY;
|
|
|
|
|
|
/**
|
|
* For polygon labels or when `placement` is set to `'line'`, allow text to
|
|
* exceed the width of the polygon at the label position or the length of
|
|
* the path that it follows. Default is `false`.
|
|
* @type {boolean|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.TextOptions.prototype.overflow;
|
|
|
|
|
|
/**
|
|
* Text placement.
|
|
* @type {module:ol/style/Text~TextPlacement|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.TextOptions.prototype.placement;
|
|
|
|
|
|
/**
|
|
* Scale.
|
|
* @type {number|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.TextOptions.prototype.scale;
|
|
|
|
|
|
/**
|
|
* Whether to rotate the text with the view. Default is `false`.
|
|
* @type {boolean|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.TextOptions.prototype.rotateWithView;
|
|
|
|
|
|
/**
|
|
* Rotation in radians (positive rotation clockwise). Default is `0`.
|
|
* @type {number|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.TextOptions.prototype.rotation;
|
|
|
|
|
|
/**
|
|
* Text content.
|
|
* @type {string|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.TextOptions.prototype.text;
|
|
|
|
|
|
/**
|
|
* Text alignment. Possible values: 'left', 'right', 'center', 'end' or 'start'.
|
|
* Default is 'center' for `placement: 'point'`. For `placement: 'line'`, the
|
|
* default is to let the renderer choose a placement where `maxAngle` is not
|
|
* exceeded.
|
|
* @type {string|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.TextOptions.prototype.textAlign;
|
|
|
|
|
|
/**
|
|
* Text base line. Possible values: 'bottom', 'top', 'middle', 'alphabetic',
|
|
* 'hanging', 'ideographic'. Default is 'middle'.
|
|
* @type {string|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.TextOptions.prototype.textBaseline;
|
|
|
|
|
|
/**
|
|
* Fill style. If none is provided, we'll use a dark fill-style (#333).
|
|
* @type {module:ol/style/Fill~Fill|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.TextOptions.prototype.fill;
|
|
|
|
|
|
/**
|
|
* Stroke style.
|
|
* @type {module:ol/style/Stroke~Stroke|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.TextOptions.prototype.stroke;
|
|
|
|
|
|
/**
|
|
* Fill style for the text background when `placement` is `'point'`. Default is
|
|
* no fill.
|
|
* @type {module:ol/style/Fill~Fill|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.TextOptions.prototype.backgroundFill;
|
|
|
|
|
|
/**
|
|
* Stroke style for the text background when `placement` is `'point'`. Default
|
|
* is no stroke.
|
|
* @type {module:ol/style/Stroke~Stroke|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.TextOptions.prototype.backgroundStroke;
|
|
|
|
|
|
/**
|
|
* Padding in pixels around the text for decluttering and background. The order
|
|
* of values in the array is `[top, right, bottom, left]`. Default is
|
|
* `[0, 0, 0, 0]`.
|
|
* @type {Array.<number>|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.TextOptions.prototype.padding;
|
|
|
|
|
|
/**
|
|
* @typedef {{geometry: (undefined|string|module:ol/geom/Geometry~Geometry|ol.StyleGeometryFunction),
|
|
* fill: (module:ol/style/Fill~Fill|undefined),
|
|
* image: (module:ol/style/Image~ImageStyle|undefined),
|
|
* renderer: (ol.StyleRenderFunction|undefined),
|
|
* stroke: (module:ol/style/Stroke~Stroke|undefined),
|
|
* text: (module:ol/style/Text~Text|undefined),
|
|
* zIndex: (number|undefined)}}
|
|
*/
|
|
olx.style.StyleOptions;
|
|
|
|
|
|
/**
|
|
* Feature property or geometry or function returning a geometry to render for
|
|
* this style.
|
|
* @type {undefined|string|module:ol/geom/Geometry~Geometry|ol.StyleGeometryFunction}
|
|
* @api
|
|
*/
|
|
olx.style.StyleOptions.prototype.geometry;
|
|
|
|
|
|
/**
|
|
* Fill style.
|
|
* @type {module:ol/style/Fill~Fill|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.StyleOptions.prototype.fill;
|
|
|
|
|
|
/**
|
|
* Image style.
|
|
* @type {module:ol/style/Image~ImageStyle|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.StyleOptions.prototype.image;
|
|
|
|
|
|
/**
|
|
* 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.
|
|
*
|
|
* @type {ol.StyleRenderFunction|undefined}
|
|
*/
|
|
olx.style.StyleOptions.prototype.renderer;
|
|
|
|
|
|
/**
|
|
* Stroke style.
|
|
* @type {module:ol/style/Stroke~Stroke|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.StyleOptions.prototype.stroke;
|
|
|
|
|
|
/**
|
|
* Text style.
|
|
* @type {module:ol/style/Text~Text|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.StyleOptions.prototype.text;
|
|
|
|
|
|
/**
|
|
* Z index.
|
|
* @type {number|undefined}
|
|
* @api
|
|
*/
|
|
olx.style.StyleOptions.prototype.zIndex;
|