Webgl Layer / rename literalStyle property to style

This commit is contained in:
Olivier Guyot
2019-09-26 14:37:32 +02:00
parent 0732f17fd3
commit 7da3b60061
3 changed files with 7 additions and 7 deletions

View File

@@ -43,7 +43,7 @@ function refreshLayer() {
} }
pointsLayer = new WebGLPointsLayer({ pointsLayer = new WebGLPointsLayer({
source: vectorSource, source: vectorSource,
literalStyle: literalStyle style: literalStyle
}); });
map.addLayer(pointsLayer); map.addLayer(pointsLayer);
editor.value = JSON.stringify(literalStyle, null, ' '); editor.value = JSON.stringify(literalStyle, null, ' ');

View File

@@ -13,7 +13,7 @@ const vector = new WebGLPointsLayer({
extractStyles: false extractStyles: false
}) })
}), }),
literalStyle: { style: {
symbol: { symbol: {
size: 4, size: 4,
color: 'white' color: 'white'

View File

@@ -17,7 +17,7 @@ import Layer from './Layer.js';
/** /**
* @typedef {Object} Options * @typedef {Object} Options
* @property {import('../style/LiteralStyle.js').LiteralStyle} literalStyle Literal style to apply to the layer features. * @property {import('../style/LiteralStyle.js').LiteralStyle} style Literal style to apply to the layer features.
* @property {string} [className='ol-layer'] A CSS class name to set to the layer element. * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.
* @property {number} [opacity=1] Opacity (0, 1). * @property {number} [opacity=1] Opacity (0, 1).
* @property {boolean} [visible=true] Visibility. * @property {boolean} [visible=true] Visibility.
@@ -37,7 +37,7 @@ import Layer from './Layer.js';
/** /**
* @classdesc * @classdesc
* Layer optimized for rendering large point datasets. Takes a so-called *literalStyle* property which * Layer optimized for rendering large point datasets. Takes a `style` property which
* is a serializable JSON object describing how the layer should be rendered. * is a serializable JSON object describing how the layer should be rendered.
* *
* Here are a few samples of literal style objects: * Here are a few samples of literal style objects:
@@ -81,16 +81,16 @@ class WebGLPointsLayer extends Layer {
/** /**
* @type {import('../style/LiteralStyle.js').LiteralStyle} * @type {import('../style/LiteralStyle.js').LiteralStyle}
*/ */
this.literalStyle = options.literalStyle; this.style = options.style;
assert(this.literalStyle.symbol !== undefined, 65); assert(this.style.symbol !== undefined, 65);
} }
/** /**
* @inheritDoc * @inheritDoc
*/ */
createRenderer() { createRenderer() {
const symbolStyle = this.literalStyle.symbol; const symbolStyle = this.style.symbol;
const size = Array.isArray(symbolStyle.size) ? const size = Array.isArray(symbolStyle.size) ?
formatArray(symbolStyle.size) : formatNumber(symbolStyle.size); formatArray(symbolStyle.size) : formatNumber(symbolStyle.size);
const color = symbolStyle.color !== undefined ? const color = symbolStyle.color !== undefined ?