Fix linting and typechecking errors
This commit is contained in:
@@ -2,13 +2,13 @@
|
|||||||
* @module ol/render/webgl/BatchRenderer
|
* @module ol/render/webgl/BatchRenderer
|
||||||
*/
|
*/
|
||||||
import GeometryType from '../../geom/GeometryType.js';
|
import GeometryType from '../../geom/GeometryType.js';
|
||||||
|
import {WebGLWorkerMessageType} from './constants.js';
|
||||||
|
import {abstract} from '../../util.js';
|
||||||
import {
|
import {
|
||||||
create as createTransform,
|
create as createTransform,
|
||||||
makeInverse as makeInverseTransform,
|
makeInverse as makeInverseTransform,
|
||||||
multiply as multiplyTransform,
|
multiply as multiplyTransform,
|
||||||
} from '../../transform.js';
|
} from '../../transform.js';
|
||||||
import {abstract} from '../../util.js';
|
|
||||||
import {WebGLWorkerMessageType} from './constants.js';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} CustomAttribute A description of a custom attribute to be passed on to the GPU, with a value different
|
* @typedef {Object} CustomAttribute A description of a custom attribute to be passed on to the GPU, with a value different
|
||||||
@@ -27,11 +27,11 @@ let workerMessageCounter = 0;
|
|||||||
*/
|
*/
|
||||||
class AbstractBatchRenderer {
|
class AbstractBatchRenderer {
|
||||||
/**
|
/**
|
||||||
* @param {import("../../webgl/Helper.js").default} helper
|
* @param {import("../../webgl/Helper.js").default} helper WebGL helper instance
|
||||||
* @param {Worker} worker
|
* @param {Worker} worker WebGL worker instance
|
||||||
* @param {string} vertexShader
|
* @param {string} vertexShader Vertex shader
|
||||||
* @param {string} fragmentShader
|
* @param {string} fragmentShader Fragment shader
|
||||||
* @param {Array<CustomAttribute>} customAttributes
|
* @param {Array<CustomAttribute>} customAttributes List of custom attributes
|
||||||
*/
|
*/
|
||||||
constructor(helper, worker, vertexShader, fragmentShader, customAttributes) {
|
constructor(helper, worker, vertexShader, fragmentShader, customAttributes) {
|
||||||
/**
|
/**
|
||||||
@@ -69,9 +69,9 @@ class AbstractBatchRenderer {
|
|||||||
/**
|
/**
|
||||||
* Rebuild rendering instructions and webgl buffers based on the provided frame state
|
* Rebuild rendering instructions and webgl buffers based on the provided frame state
|
||||||
* Note: this is a costly operation.
|
* Note: this is a costly operation.
|
||||||
* @param {import("./MixedGeometryBatch.js").AbstractGeometryBatch} batch
|
* @param {import("./MixedGeometryBatch.js").GeometryBatch} batch Geometry batch
|
||||||
* @param {import("../../PluggableMap").FrameState} frameState Frame state.
|
* @param {import("../../PluggableMap").FrameState} frameState Frame state.
|
||||||
* @param {import("../../geom/GeometryType.js").default} geometryType
|
* @param {import("../../geom/GeometryType.js").default} geometryType Geometry type
|
||||||
*/
|
*/
|
||||||
rebuild(batch, frameState, geometryType) {
|
rebuild(batch, frameState, geometryType) {
|
||||||
// store transform for rendering instructions
|
// store transform for rendering instructions
|
||||||
@@ -86,12 +86,13 @@ class AbstractBatchRenderer {
|
|||||||
/**
|
/**
|
||||||
* Render the geometries in the batch. This will also update the current transform used for rendering according to
|
* Render the geometries in the batch. This will also update the current transform used for rendering according to
|
||||||
* the invert transform of the webgl buffers
|
* the invert transform of the webgl buffers
|
||||||
* @param {import("./MixedGeometryBatch.js").AbstractGeometryBatch} batch
|
* @param {import("./MixedGeometryBatch.js").GeometryBatch} batch Geometry batch
|
||||||
* @param {import("../../transform.js").Transform} currentTransform
|
* @param {import("../../transform.js").Transform} currentTransform Transform
|
||||||
* @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
|
* @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
|
||||||
*/
|
*/
|
||||||
render(batch, currentTransform, frameState) {
|
render(batch, currentTransform, frameState) {
|
||||||
// multiply the current projection transform with the invert of the one used to fill buffers
|
// multiply the current projection transform with the invert of the one used to fill buffers
|
||||||
|
// FIXME: this should probably be done directly in the layer renderer
|
||||||
this.helper_.makeProjectionTransform(frameState, currentTransform);
|
this.helper_.makeProjectionTransform(frameState, currentTransform);
|
||||||
multiplyTransform(currentTransform, batch.invertVerticesBufferTransform);
|
multiplyTransform(currentTransform, batch.invertVerticesBufferTransform);
|
||||||
|
|
||||||
@@ -108,7 +109,7 @@ class AbstractBatchRenderer {
|
|||||||
/**
|
/**
|
||||||
* Rebuild rendering instructions based on the provided frame state
|
* Rebuild rendering instructions based on the provided frame state
|
||||||
* This is specific to the geometry type and has to be implemented by subclasses.
|
* This is specific to the geometry type and has to be implemented by subclasses.
|
||||||
* @param {import("./MixedGeometryBatch.js").default} batch
|
* @param {import("./MixedGeometryBatch.js").GeometryBatch} batch Geometry batch
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
generateRenderInstructions_(batch) {
|
generateRenderInstructions_(batch) {
|
||||||
@@ -118,8 +119,8 @@ class AbstractBatchRenderer {
|
|||||||
/**
|
/**
|
||||||
* Rebuild internal webgl buffers for rendering based on the current rendering instructions;
|
* Rebuild internal webgl buffers for rendering based on the current rendering instructions;
|
||||||
* This is asynchronous: webgl buffers wil _not_ be updated right away
|
* This is asynchronous: webgl buffers wil _not_ be updated right away
|
||||||
* @param {import("./MixedGeometryBatch.js").AbstractGeometryBatch} batch
|
* @param {import("./MixedGeometryBatch.js").GeometryBatch} batch Geometry batch
|
||||||
* @param {import("../../geom/GeometryType.js").default} geometryType
|
* @param {import("../../geom/GeometryType.js").default} geometryType Geometry type
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
generateBuffers_(batch, geometryType) {
|
generateBuffers_(batch, geometryType) {
|
||||||
@@ -136,6 +137,8 @@ class AbstractBatchRenderer {
|
|||||||
case GeometryType.LINE_STRING:
|
case GeometryType.LINE_STRING:
|
||||||
messageType = WebGLWorkerMessageType.GENERATE_LINE_STRING_BUFFERS;
|
messageType = WebGLWorkerMessageType.GENERATE_LINE_STRING_BUFFERS;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
// pass
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @type {import('./constants.js').WebGLWorkerGenerateBuffersMessage} */
|
/** @type {import('./constants.js').WebGLWorkerGenerateBuffersMessage} */
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
/**
|
/**
|
||||||
* @module ol/render/webgl/LineStringBatchRenderer
|
* @module ol/render/webgl/LineStringBatchRenderer
|
||||||
*/
|
*/
|
||||||
|
import AbstractBatchRenderer from './BatchRenderer.js';
|
||||||
import {AttributeType} from '../../webgl/Helper.js';
|
import {AttributeType} from '../../webgl/Helper.js';
|
||||||
import {transform2D} from '../../geom/flat/transform.js';
|
import {transform2D} from '../../geom/flat/transform.js';
|
||||||
import AbstractBatchRenderer from './BatchRenderer.js';
|
|
||||||
|
|
||||||
class LineStringBatchRenderer extends AbstractBatchRenderer {
|
class LineStringBatchRenderer extends AbstractBatchRenderer {
|
||||||
/**
|
/**
|
||||||
* @param {import("../../webgl/Helper.js").default} helper
|
* @param {import("../../webgl/Helper.js").default} helper WebGL helper instance
|
||||||
* @param {Worker} worker
|
* @param {Worker} worker WebGL worker instance
|
||||||
* @param {string} vertexShader
|
* @param {string} vertexShader Vertex shader
|
||||||
* @param {string} fragmentShader
|
* @param {string} fragmentShader Fragment shader
|
||||||
* @param {Array<import('./BatchRenderer.js').CustomAttribute>} customAttributes
|
* @param {Array<import('./BatchRenderer.js').CustomAttribute>} customAttributes List of custom attributes
|
||||||
*/
|
*/
|
||||||
constructor(helper, worker, vertexShader, fragmentShader, customAttributes) {
|
constructor(helper, worker, vertexShader, fragmentShader, customAttributes) {
|
||||||
super(helper, worker, vertexShader, fragmentShader, customAttributes);
|
super(helper, worker, vertexShader, fragmentShader, customAttributes);
|
||||||
@@ -47,7 +47,7 @@ class LineStringBatchRenderer extends AbstractBatchRenderer {
|
|||||||
/**
|
/**
|
||||||
* Render instructions for lines are structured like so:
|
* Render instructions for lines are structured like so:
|
||||||
* [ customAttr0, ... , customAttrN, numberOfVertices0, x0, y0, ... , xN, yN, numberOfVertices1, ... ]
|
* [ customAttr0, ... , customAttrN, numberOfVertices0, x0, y0, ... , xN, yN, numberOfVertices1, ... ]
|
||||||
* @param {import("./MixedGeometryBatch.js").PointGeometryBatch} batch
|
* @param {import("./MixedGeometryBatch.js").LineStringGeometryBatch} batch Linestring geometry batch
|
||||||
* @override
|
* @override
|
||||||
*/
|
*/
|
||||||
generateRenderInstructions_(batch) {
|
generateRenderInstructions_(batch) {
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
/**
|
/**
|
||||||
* @module ol/render/webgl/MixedGeometryBatch
|
* @module ol/render/webgl/MixedGeometryBatch
|
||||||
*/
|
*/
|
||||||
import {getUid} from '../../util.js';
|
|
||||||
import GeometryType from '../../geom/GeometryType.js';
|
import GeometryType from '../../geom/GeometryType.js';
|
||||||
import WebGLArrayBuffer from '../../webgl/Buffer.js';
|
import WebGLArrayBuffer from '../../webgl/Buffer.js';
|
||||||
import {ARRAY_BUFFER, DYNAMIC_DRAW, ELEMENT_ARRAY_BUFFER} from '../../webgl.js';
|
import {ARRAY_BUFFER, DYNAMIC_DRAW, ELEMENT_ARRAY_BUFFER} from '../../webgl.js';
|
||||||
import {create as createTransform} from '../../transform.js';
|
import {create as createTransform} from '../../transform.js';
|
||||||
|
import {getUid} from '../../util.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} GeometryBatchItem Object that holds a reference to a feature as well as the raw coordinates of its various geometries
|
* @typedef {Object} GeometryBatchItem Object that holds a reference to a feature as well as the raw coordinates of its various geometries
|
||||||
@@ -18,36 +18,52 @@ import {create as createTransform} from '../../transform.js';
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} AbstractGeometryBatch
|
* @typedef {PointGeometryBatch|LineStringGeometryBatch|PolygonGeometryBatch} GeometryBatch
|
||||||
* @abstract
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} PolygonGeometryBatch A geometry batch specific to polygons
|
||||||
* @property {Object<string, GeometryBatchItem>} entries Dictionary of all entries in the batch with associated computed values.
|
* @property {Object<string, GeometryBatchItem>} entries Dictionary of all entries in the batch with associated computed values.
|
||||||
* One entry corresponds to one feature. Key is feature uid.
|
* One entry corresponds to one feature. Key is feature uid.
|
||||||
* @property {number} geometriesCount Amount of geometries in the batch.
|
* @property {number} geometriesCount Amount of geometries in the batch.
|
||||||
* @property {Float32Array} renderInstructions Render instructions for polygons are structured like so:
|
* @property {Float32Array} renderInstructions Render instructions for polygons are structured like so:
|
||||||
* [ numberOfRings, numberOfVerticesInRing0, ..., numberOfVerticesInRingN, x0, y0, customAttr0, ..., xN, yN, customAttrN, numberOfRings,... ]
|
* [ numberOfRings, numberOfVerticesInRing0, ..., numberOfVerticesInRingN, x0, y0, customAttr0, ..., xN, yN, customAttrN, numberOfRings,... ]
|
||||||
* @property {WebGLArrayBuffer} verticesBuffer
|
* @property {WebGLArrayBuffer} verticesBuffer Vertices WebGL buffer
|
||||||
* @property {WebGLArrayBuffer} indicesBuffer
|
* @property {WebGLArrayBuffer} indicesBuffer Indices WebGL buffer
|
||||||
* @property {import("../../transform.js").Transform} renderInstructionsTransform Converts world space coordinates to screen space; applies to the rendering instructions
|
* @property {import("../../transform.js").Transform} renderInstructionsTransform Converts world space coordinates to screen space; applies to the rendering instructions
|
||||||
* @property {import("../../transform.js").Transform} verticesBufferTransform Converts world space coordinates to screen space; applies to the webgl vertices buffer
|
* @property {import("../../transform.js").Transform} verticesBufferTransform Converts world space coordinates to screen space; applies to the webgl vertices buffer
|
||||||
* @property {import("../../transform.js").Transform} invertVerticesBufferTransform Screen space to world space; applies to the webgl vertices buffer
|
* @property {import("../../transform.js").Transform} invertVerticesBufferTransform Screen space to world space; applies to the webgl vertices buffer
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {Object} PolygonGeometryBatch A geometry batch specific to polygons
|
|
||||||
* @extends {AbstractGeometryBatch}
|
|
||||||
* @property {number} verticesCount Amount of vertices from geometries in the batch.
|
* @property {number} verticesCount Amount of vertices from geometries in the batch.
|
||||||
* @property {number} ringsCount How many outer and inner rings in this batch.
|
* @property {number} ringsCount How many outer and inner rings in this batch.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} LineStringGeometryBatch A geometry batch specific to lines
|
* @typedef {Object} LineStringGeometryBatch A geometry batch specific to lines
|
||||||
* @extends {AbstractGeometryBatch}
|
* @property {Object<string, GeometryBatchItem>} entries Dictionary of all entries in the batch with associated computed values.
|
||||||
|
* One entry corresponds to one feature. Key is feature uid.
|
||||||
|
* @property {number} geometriesCount Amount of geometries in the batch.
|
||||||
|
* @property {Float32Array} renderInstructions Render instructions for polygons are structured like so:
|
||||||
|
* [ numberOfRings, numberOfVerticesInRing0, ..., numberOfVerticesInRingN, x0, y0, customAttr0, ..., xN, yN, customAttrN, numberOfRings,... ]
|
||||||
|
* @property {WebGLArrayBuffer} verticesBuffer Vertices WebGL buffer
|
||||||
|
* @property {WebGLArrayBuffer} indicesBuffer Indices WebGL buffer
|
||||||
|
* @property {import("../../transform.js").Transform} renderInstructionsTransform Converts world space coordinates to screen space; applies to the rendering instructions
|
||||||
|
* @property {import("../../transform.js").Transform} verticesBufferTransform Converts world space coordinates to screen space; applies to the webgl vertices buffer
|
||||||
|
* @property {import("../../transform.js").Transform} invertVerticesBufferTransform Screen space to world space; applies to the webgl vertices buffer
|
||||||
* @property {number} verticesCount Amount of vertices from geometries in the batch.
|
* @property {number} verticesCount Amount of vertices from geometries in the batch.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} PointGeometryBatch A geometry batch specific to points
|
* @typedef {Object} PointGeometryBatch A geometry batch specific to points
|
||||||
* @extends {AbstractGeometryBatch}
|
* @property {Object<string, GeometryBatchItem>} entries Dictionary of all entries in the batch with associated computed values.
|
||||||
|
* One entry corresponds to one feature. Key is feature uid.
|
||||||
|
* @property {number} geometriesCount Amount of geometries in the batch.
|
||||||
|
* @property {Float32Array} renderInstructions Render instructions for polygons are structured like so:
|
||||||
|
* [ numberOfRings, numberOfVerticesInRing0, ..., numberOfVerticesInRingN, x0, y0, customAttr0, ..., xN, yN, customAttrN, numberOfRings,... ]
|
||||||
|
* @property {WebGLArrayBuffer} verticesBuffer Vertices WebGL buffer
|
||||||
|
* @property {WebGLArrayBuffer} indicesBuffer Indices WebGL buffer
|
||||||
|
* @property {import("../../transform.js").Transform} renderInstructionsTransform Converts world space coordinates to screen space; applies to the rendering instructions
|
||||||
|
* @property {import("../../transform.js").Transform} verticesBufferTransform Converts world space coordinates to screen space; applies to the webgl vertices buffer
|
||||||
|
* @property {import("../../transform.js").Transform} invertVerticesBufferTransform Screen space to world space; applies to the webgl vertices buffer
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -118,7 +134,7 @@ class MixedGeometryBatch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import("../../Feature").default[]} features
|
* @param {Array<import("../../Feature").default>} features Array of features to add to the batch
|
||||||
*/
|
*/
|
||||||
addFeatures(features) {
|
addFeatures(features) {
|
||||||
for (let i = 0; i < features.length; i++) {
|
for (let i = 0; i < features.length; i++) {
|
||||||
@@ -127,7 +143,7 @@ class MixedGeometryBatch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import("../../Feature").default} feature
|
* @param {import("../../Feature").default} feature Feature to add to the batch
|
||||||
*/
|
*/
|
||||||
addFeature(feature) {
|
addFeature(feature) {
|
||||||
const geometry = feature.getGeometry();
|
const geometry = feature.getGeometry();
|
||||||
@@ -138,8 +154,8 @@ class MixedGeometryBatch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import("../../Feature").default} feature
|
* @param {import("../../Feature").default} feature Feature
|
||||||
* @return {GeometryBatchItem}
|
* @return {GeometryBatchItem} Batch item added (or existing one)
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
addFeatureEntryInPointBatch_(feature) {
|
addFeatureEntryInPointBatch_(feature) {
|
||||||
@@ -155,8 +171,8 @@ class MixedGeometryBatch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import("../../Feature").default} feature
|
* @param {import("../../Feature").default} feature Feature
|
||||||
* @return {GeometryBatchItem}
|
* @return {GeometryBatchItem} Batch item added (or existing one)
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
addFeatureEntryInLineStringBatch_(feature) {
|
addFeatureEntryInLineStringBatch_(feature) {
|
||||||
@@ -173,8 +189,8 @@ class MixedGeometryBatch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import("../../Feature").default} feature
|
* @param {import("../../Feature").default} feature Feature
|
||||||
* @return {GeometryBatchItem}
|
* @return {GeometryBatchItem} Batch item added (or existing one)
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
addFeatureEntryInPolygonBatch_(feature) {
|
addFeatureEntryInPolygonBatch_(feature) {
|
||||||
@@ -193,35 +209,41 @@ class MixedGeometryBatch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import("../../Feature").default} feature
|
* @param {import("../../Feature").default} feature Feature
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
clearFeatureEntryInPointBatch_(feature) {
|
clearFeatureEntryInPointBatch_(feature) {
|
||||||
const entry = this.pointBatch.entries[getUid(feature)];
|
const entry = this.pointBatch.entries[getUid(feature)];
|
||||||
if (!entry) return;
|
if (!entry) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.pointBatch.geometriesCount -= entry.flatCoordss.length;
|
this.pointBatch.geometriesCount -= entry.flatCoordss.length;
|
||||||
delete this.pointBatch.entries[getUid(feature)];
|
delete this.pointBatch.entries[getUid(feature)];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import("../../Feature").default} feature
|
* @param {import("../../Feature").default} feature Feature
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
clearFeatureEntryInLineStringBatch_(feature) {
|
clearFeatureEntryInLineStringBatch_(feature) {
|
||||||
const entry = this.lineStringBatch.entries[getUid(feature)];
|
const entry = this.lineStringBatch.entries[getUid(feature)];
|
||||||
if (!entry) return;
|
if (!entry) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.lineStringBatch.verticesCount -= entry.verticesCount;
|
this.lineStringBatch.verticesCount -= entry.verticesCount;
|
||||||
this.lineStringBatch.geometriesCount -= entry.flatCoordss.length;
|
this.lineStringBatch.geometriesCount -= entry.flatCoordss.length;
|
||||||
delete this.lineStringBatch.entries[getUid(feature)];
|
delete this.lineStringBatch.entries[getUid(feature)];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import("../../Feature").default} feature
|
* @param {import("../../Feature").default} feature Feature
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
clearFeatureEntryInPolygonBatch_(feature) {
|
clearFeatureEntryInPolygonBatch_(feature) {
|
||||||
const entry = this.polygonBatch.entries[getUid(feature)];
|
const entry = this.polygonBatch.entries[getUid(feature)];
|
||||||
if (!entry) return;
|
if (!entry) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.polygonBatch.verticesCount -= entry.verticesCount;
|
this.polygonBatch.verticesCount -= entry.verticesCount;
|
||||||
this.polygonBatch.ringsCount -= entry.ringsCount;
|
this.polygonBatch.ringsCount -= entry.ringsCount;
|
||||||
this.polygonBatch.geometriesCount -= entry.flatCoordss.length;
|
this.polygonBatch.geometriesCount -= entry.flatCoordss.length;
|
||||||
@@ -229,8 +251,8 @@ class MixedGeometryBatch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import("../../geom").Geometry} geometry
|
* @param {import("../../geom").Geometry} geometry Geometry
|
||||||
* @param {import("../../Feature").default} feature
|
* @param {import("../../Feature").default} feature Feature
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
addGeometry_(geometry, feature) {
|
addGeometry_(geometry, feature) {
|
||||||
@@ -240,29 +262,34 @@ class MixedGeometryBatch {
|
|||||||
let batchEntry;
|
let batchEntry;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case GeometryType.GEOMETRY_COLLECTION:
|
case GeometryType.GEOMETRY_COLLECTION:
|
||||||
geometry
|
/** @type {import("../../geom").GeometryCollection} */ (geometry)
|
||||||
.getGeometries()
|
.getGeometries()
|
||||||
.map((geom) => this.addGeometry_(geom, feature));
|
.map((geom) => this.addGeometry_(geom, feature));
|
||||||
break;
|
break;
|
||||||
case GeometryType.MULTI_POLYGON:
|
case GeometryType.MULTI_POLYGON:
|
||||||
geometry
|
/** @type {import("../../geom").MultiPolygon} */ (geometry)
|
||||||
.getPolygons()
|
.getPolygons()
|
||||||
.map((polygon) => this.addGeometry_(polygon, feature));
|
.map((polygon) => this.addGeometry_(polygon, feature));
|
||||||
break;
|
break;
|
||||||
case GeometryType.MULTI_LINE_STRING:
|
case GeometryType.MULTI_LINE_STRING:
|
||||||
geometry
|
/** @type {import("../../geom").MultiLineString} */ (geometry)
|
||||||
.getLineStrings()
|
.getLineStrings()
|
||||||
.map((line) => this.addGeometry_(line, feature));
|
.map((line) => this.addGeometry_(line, feature));
|
||||||
break;
|
break;
|
||||||
case GeometryType.MULTI_POINT:
|
case GeometryType.MULTI_POINT:
|
||||||
geometry.getPoints().map((point) => this.addGeometry_(point, feature));
|
/** @type {import("../../geom").MultiPoint} */ (geometry)
|
||||||
|
.getPoints()
|
||||||
|
.map((point) => this.addGeometry_(point, feature));
|
||||||
break;
|
break;
|
||||||
case GeometryType.POLYGON:
|
case GeometryType.POLYGON:
|
||||||
|
const polygonGeom = /** @type {import("../../geom").Polygon} */ (
|
||||||
|
geometry
|
||||||
|
);
|
||||||
batchEntry = this.addFeatureEntryInPolygonBatch_(feature);
|
batchEntry = this.addFeatureEntryInPolygonBatch_(feature);
|
||||||
flatCoords = geometry.getFlatCoordinates();
|
flatCoords = polygonGeom.getFlatCoordinates();
|
||||||
verticesCount = flatCoords.length / 2;
|
verticesCount = flatCoords.length / 2;
|
||||||
const ringsCount = geometry.getLinearRingCount();
|
const ringsCount = polygonGeom.getLinearRingCount();
|
||||||
const ringsVerticesCount = geometry
|
const ringsVerticesCount = polygonGeom
|
||||||
.getEnds()
|
.getEnds()
|
||||||
.map((end, ind, arr) =>
|
.map((end, ind, arr) =>
|
||||||
ind > 0 ? (end - arr[ind - 1]) / 2 : end / 2
|
ind > 0 ? (end - arr[ind - 1]) / 2 : end / 2
|
||||||
@@ -274,31 +301,37 @@ class MixedGeometryBatch {
|
|||||||
batchEntry.ringsVerticesCounts.push(ringsVerticesCount);
|
batchEntry.ringsVerticesCounts.push(ringsVerticesCount);
|
||||||
batchEntry.verticesCount += verticesCount;
|
batchEntry.verticesCount += verticesCount;
|
||||||
batchEntry.ringsCount += ringsCount;
|
batchEntry.ringsCount += ringsCount;
|
||||||
geometry
|
polygonGeom
|
||||||
.getLinearRings()
|
.getLinearRings()
|
||||||
.map((ring) => this.addGeometry_(ring, feature));
|
.map((ring) => this.addGeometry_(ring, feature));
|
||||||
break;
|
break;
|
||||||
case GeometryType.POINT:
|
case GeometryType.POINT:
|
||||||
|
const pointGeom = /** @type {import("../../geom").Point} */ (geometry);
|
||||||
batchEntry = this.addFeatureEntryInPointBatch_(feature);
|
batchEntry = this.addFeatureEntryInPointBatch_(feature);
|
||||||
flatCoords = geometry.getFlatCoordinates();
|
flatCoords = pointGeom.getFlatCoordinates();
|
||||||
this.pointBatch.geometriesCount++;
|
this.pointBatch.geometriesCount++;
|
||||||
batchEntry.flatCoordss.push(flatCoords);
|
batchEntry.flatCoordss.push(flatCoords);
|
||||||
break;
|
break;
|
||||||
case GeometryType.LINE_STRING:
|
case GeometryType.LINE_STRING:
|
||||||
case GeometryType.LINEAR_RING:
|
case GeometryType.LINEAR_RING:
|
||||||
|
const lineGeom = /** @type {import("../../geom").LineString} */ (
|
||||||
|
geometry
|
||||||
|
);
|
||||||
batchEntry = this.addFeatureEntryInLineStringBatch_(feature);
|
batchEntry = this.addFeatureEntryInLineStringBatch_(feature);
|
||||||
flatCoords = geometry.getFlatCoordinates();
|
flatCoords = lineGeom.getFlatCoordinates();
|
||||||
verticesCount = flatCoords.length / 2;
|
verticesCount = flatCoords.length / 2;
|
||||||
this.lineStringBatch.verticesCount += verticesCount;
|
this.lineStringBatch.verticesCount += verticesCount;
|
||||||
this.lineStringBatch.geometriesCount++;
|
this.lineStringBatch.geometriesCount++;
|
||||||
batchEntry.flatCoordss.push(flatCoords);
|
batchEntry.flatCoordss.push(flatCoords);
|
||||||
batchEntry.verticesCount += verticesCount;
|
batchEntry.verticesCount += verticesCount;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
// pass
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import("../../Feature").default} feature
|
* @param {import("../../Feature").default} feature Feature
|
||||||
*/
|
*/
|
||||||
changeFeature(feature) {
|
changeFeature(feature) {
|
||||||
this.clearFeatureEntryInPointBatch_(feature);
|
this.clearFeatureEntryInPointBatch_(feature);
|
||||||
@@ -312,7 +345,7 @@ class MixedGeometryBatch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import("../../Feature").default} feature
|
* @param {import("../../Feature").default} feature Feature
|
||||||
*/
|
*/
|
||||||
removeFeature(feature) {
|
removeFeature(feature) {
|
||||||
this.clearFeatureEntryInPointBatch_(feature);
|
this.clearFeatureEntryInPointBatch_(feature);
|
||||||
|
|||||||
@@ -2,17 +2,17 @@
|
|||||||
* @module ol/render/webgl/PointBatchRenderer
|
* @module ol/render/webgl/PointBatchRenderer
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {apply as applyTransform} from '../../transform.js';
|
|
||||||
import {AttributeType} from '../../webgl/Helper.js';
|
|
||||||
import AbstractBatchRenderer from './BatchRenderer.js';
|
import AbstractBatchRenderer from './BatchRenderer.js';
|
||||||
|
import {AttributeType} from '../../webgl/Helper.js';
|
||||||
|
import {apply as applyTransform} from '../../transform.js';
|
||||||
|
|
||||||
class PointBatchRenderer extends AbstractBatchRenderer {
|
class PointBatchRenderer extends AbstractBatchRenderer {
|
||||||
/**
|
/**
|
||||||
* @param {import("../../webgl/Helper.js").default} helper
|
* @param {import("../../webgl/Helper.js").default} helper WebGL helper instance
|
||||||
* @param {Worker} worker
|
* @param {Worker} worker WebGL worker instance
|
||||||
* @param {string} vertexShader
|
* @param {string} vertexShader Vertex shader
|
||||||
* @param {string} fragmentShader
|
* @param {string} fragmentShader Fragment shader
|
||||||
* @param {Array<import('./BatchRenderer.js').CustomAttribute>} customAttributes
|
* @param {Array<import('./BatchRenderer.js').CustomAttribute>} customAttributes List of custom attributes
|
||||||
*/
|
*/
|
||||||
constructor(helper, worker, vertexShader, fragmentShader, customAttributes) {
|
constructor(helper, worker, vertexShader, fragmentShader, customAttributes) {
|
||||||
super(helper, worker, vertexShader, fragmentShader, customAttributes);
|
super(helper, worker, vertexShader, fragmentShader, customAttributes);
|
||||||
@@ -43,7 +43,7 @@ class PointBatchRenderer extends AbstractBatchRenderer {
|
|||||||
/**
|
/**
|
||||||
* Render instructions for lines are structured like so:
|
* Render instructions for lines are structured like so:
|
||||||
* [ x0, y0, customAttr0, ... , xN, yN, customAttrN ]
|
* [ x0, y0, customAttr0, ... , xN, yN, customAttrN ]
|
||||||
* @param {import("./MixedGeometryBatch.js").PointGeometryBatch} batch
|
* @param {import("./MixedGeometryBatch.js").PointGeometryBatch} batch Point geometry batch
|
||||||
* @override
|
* @override
|
||||||
*/
|
*/
|
||||||
generateRenderInstructions_(batch) {
|
generateRenderInstructions_(batch) {
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
/**
|
/**
|
||||||
* @module ol/render/webgl/PolygonBatchRenderer
|
* @module ol/render/webgl/PolygonBatchRenderer
|
||||||
*/
|
*/
|
||||||
|
import AbstractBatchRenderer from './BatchRenderer.js';
|
||||||
import {AttributeType} from '../../webgl/Helper.js';
|
import {AttributeType} from '../../webgl/Helper.js';
|
||||||
import {transform2D} from '../../geom/flat/transform.js';
|
import {transform2D} from '../../geom/flat/transform.js';
|
||||||
import AbstractBatchRenderer from './BatchRenderer.js';
|
|
||||||
|
|
||||||
class PolygonBatchRenderer extends AbstractBatchRenderer {
|
class PolygonBatchRenderer extends AbstractBatchRenderer {
|
||||||
/**
|
/**
|
||||||
* @param {import("../../webgl/Helper.js").default} helper
|
* @param {import("../../webgl/Helper.js").default} helper WebGL helper instance
|
||||||
* @param {Worker} worker
|
* @param {Worker} worker WebGL worker instance
|
||||||
* @param {string} vertexShader
|
* @param {string} vertexShader Vertex shader
|
||||||
* @param {string} fragmentShader
|
* @param {string} fragmentShader Fragment shader
|
||||||
* @param {Array<import('./BatchRenderer.js').CustomAttribute>} customAttributes
|
* @param {Array<import('./BatchRenderer.js').CustomAttribute>} customAttributes List of custom attributes
|
||||||
*/
|
*/
|
||||||
constructor(helper, worker, vertexShader, fragmentShader, customAttributes) {
|
constructor(helper, worker, vertexShader, fragmentShader, customAttributes) {
|
||||||
super(helper, worker, vertexShader, fragmentShader, customAttributes);
|
super(helper, worker, vertexShader, fragmentShader, customAttributes);
|
||||||
@@ -37,7 +37,7 @@ class PolygonBatchRenderer extends AbstractBatchRenderer {
|
|||||||
/**
|
/**
|
||||||
* Render instructions for polygons are structured like so:
|
* Render instructions for polygons are structured like so:
|
||||||
* [ customAttr0, ..., customAttrN, numberOfRings, numberOfVerticesInRing0, ..., numberOfVerticesInRingN, x0, y0, ..., xN, yN, numberOfRings,... ]
|
* [ customAttr0, ..., customAttrN, numberOfRings, numberOfVerticesInRing0, ..., numberOfVerticesInRingN, x0, y0, ..., xN, yN, numberOfRings,... ]
|
||||||
* @param {import("./MixedGeometryBatch.js").PolygonGeometryBatch} batch
|
* @param {import("./MixedGeometryBatch.js").PolygonGeometryBatch} batch Polygon geometry batch
|
||||||
* @override
|
* @override
|
||||||
*/
|
*/
|
||||||
generateRenderInstructions_(batch) {
|
generateRenderInstructions_(batch) {
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* @module ol/render/webgl/utils
|
* @module ol/render/webgl/utils
|
||||||
*/
|
*/
|
||||||
|
import earcut from 'earcut';
|
||||||
import {apply as applyTransform} from '../../transform.js';
|
import {apply as applyTransform} from '../../transform.js';
|
||||||
import {clamp} from '../../math.js';
|
import {clamp} from '../../math.js';
|
||||||
import earcut from 'earcut';
|
|
||||||
|
|
||||||
const tmpArray_ = [];
|
const tmpArray_ = [];
|
||||||
|
|
||||||
@@ -103,9 +103,9 @@ export function writePointFeatureToBuffers(
|
|||||||
* @param {number} segmentEndIndex Index of the segment start point from which render instructions will be read.
|
* @param {number} segmentEndIndex Index of the segment start point from which render instructions will be read.
|
||||||
* @param {number|null} beforeSegmentIndex Index of the point right before the segment (null if none, e.g this is a line start)
|
* @param {number|null} beforeSegmentIndex Index of the point right before the segment (null if none, e.g this is a line start)
|
||||||
* @param {number|null} afterSegmentIndex Index of the point right after the segment (null if none, e.g this is a line end)
|
* @param {number|null} afterSegmentIndex Index of the point right after the segment (null if none, e.g this is a line end)
|
||||||
* @param {number[]} vertexArray Array containing vertices.
|
* @param {Array<number>} vertexArray Array containing vertices.
|
||||||
* @param {number[]} indexArray Array containing indices.
|
* @param {Array<number>} indexArray Array containing indices.
|
||||||
* @param {number[]} customAttributes Array of custom attributes value
|
* @param {Array<number>} customAttributes Array of custom attributes value
|
||||||
* @param {import('../../transform.js').Transform} instructionsTransform Transform matrix used to project coordinates in instructions
|
* @param {import('../../transform.js').Transform} instructionsTransform Transform matrix used to project coordinates in instructions
|
||||||
* @param {import('../../transform.js').Transform} invertInstructionsTransform Transform matrix used to project coordinates in instructions
|
* @param {import('../../transform.js').Transform} invertInstructionsTransform Transform matrix used to project coordinates in instructions
|
||||||
* @private
|
* @private
|
||||||
@@ -125,7 +125,7 @@ export function writeLineSegmentToBuffers(
|
|||||||
// compute the stride to determine how many vertices were already pushed
|
// compute the stride to determine how many vertices were already pushed
|
||||||
const baseVertexAttrsCount = 5; // base attributes: x0, y0, x1, y1, params (vertex number [0-3], join angle 1, join angle 2)
|
const baseVertexAttrsCount = 5; // base attributes: x0, y0, x1, y1, params (vertex number [0-3], join angle 1, join angle 2)
|
||||||
const stride = baseVertexAttrsCount + customAttributes.length;
|
const stride = baseVertexAttrsCount + customAttributes.length;
|
||||||
let baseIndex = vertexArray.length / stride;
|
const baseIndex = vertexArray.length / stride;
|
||||||
|
|
||||||
// The segment is composed of two positions called P0[x0, y0] and P1[x1, y1]
|
// The segment is composed of two positions called P0[x0, y0] and P1[x1, y1]
|
||||||
// Depending on whether there are points before and after the segment, its final shape
|
// Depending on whether there are points before and after the segment, its final shape
|
||||||
@@ -253,8 +253,8 @@ export function writeLineSegmentToBuffers(
|
|||||||
* Pushes several triangles to form a polygon, including holes
|
* Pushes several triangles to form a polygon, including holes
|
||||||
* @param {Float32Array} instructions Array of render instructions for lines.
|
* @param {Float32Array} instructions Array of render instructions for lines.
|
||||||
* @param {number} polygonStartIndex Index of the polygon start point from which render instructions will be read.
|
* @param {number} polygonStartIndex Index of the polygon start point from which render instructions will be read.
|
||||||
* @param {number[]} vertexArray Array containing vertices.
|
* @param {Array<number>} vertexArray Array containing vertices.
|
||||||
* @param {number[]} indexArray Array containing indices.
|
* @param {Array<number>} indexArray Array containing indices.
|
||||||
* @param {number} customAttributesCount Amount of custom attributes for each element.
|
* @param {number} customAttributesCount Amount of custom attributes for each element.
|
||||||
* @return {number} Next polygon instructions index
|
* @return {number} Next polygon instructions index
|
||||||
* @private
|
* @private
|
||||||
@@ -279,7 +279,9 @@ export function writePolygonTrianglesToBuffers(
|
|||||||
const holes = new Array(ringsCount - 1);
|
const holes = new Array(ringsCount - 1);
|
||||||
for (let i = 0; i < ringsCount; i++) {
|
for (let i = 0; i < ringsCount; i++) {
|
||||||
verticesCount += instructions[instructionsIndex++];
|
verticesCount += instructions[instructionsIndex++];
|
||||||
if (i < ringsCount - 1) holes[i] = verticesCount;
|
if (i < ringsCount - 1) {
|
||||||
|
holes[i] = verticesCount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const flatCoords = instructions.slice(
|
const flatCoords = instructions.slice(
|
||||||
instructionsIndex,
|
instructionsIndex,
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import WebGLLayerRenderer from './Layer.js';
|
|||||||
import WebGLRenderTarget from '../../webgl/RenderTarget.js';
|
import WebGLRenderTarget from '../../webgl/RenderTarget.js';
|
||||||
import {ARRAY_BUFFER, DYNAMIC_DRAW, ELEMENT_ARRAY_BUFFER} from '../../webgl.js';
|
import {ARRAY_BUFFER, DYNAMIC_DRAW, ELEMENT_ARRAY_BUFFER} from '../../webgl.js';
|
||||||
import {AttributeType, DefaultUniform} from '../../webgl/Helper.js';
|
import {AttributeType, DefaultUniform} from '../../webgl/Helper.js';
|
||||||
|
import {WebGLWorkerMessageType} from '../../render/webgl/constants.js';
|
||||||
import {
|
import {
|
||||||
apply as applyTransform,
|
apply as applyTransform,
|
||||||
create as createTransform,
|
create as createTransform,
|
||||||
@@ -18,11 +19,10 @@ import {
|
|||||||
} from '../../transform.js';
|
} from '../../transform.js';
|
||||||
import {assert} from '../../asserts.js';
|
import {assert} from '../../asserts.js';
|
||||||
import {buffer, createEmpty, equals, getWidth} from '../../extent.js';
|
import {buffer, createEmpty, equals, getWidth} from '../../extent.js';
|
||||||
|
import {colorDecodeId, colorEncodeId} from '../../render/webgl/utils.js';
|
||||||
import {create as createWebGLWorker} from '../../worker/webgl.js';
|
import {create as createWebGLWorker} from '../../worker/webgl.js';
|
||||||
import {getUid} from '../../util.js';
|
import {getUid} from '../../util.js';
|
||||||
import {listen, unlistenByKey} from '../../events.js';
|
import {listen, unlistenByKey} from '../../events.js';
|
||||||
import {colorDecodeId, colorEncodeId} from '../../render/webgl/utils.js';
|
|
||||||
import {WebGLWorkerMessageType} from '../../render/webgl/constants.js';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} CustomAttribute A description of a custom attribute to be passed on to the GPU, with a value different
|
* @typedef {Object} CustomAttribute A description of a custom attribute to be passed on to the GPU, with a value different
|
||||||
|
|||||||
@@ -1,21 +1,20 @@
|
|||||||
/**
|
/**
|
||||||
* @module ol/renderer/webgl/VectorLayer
|
* @module ol/renderer/webgl/VectorLayer
|
||||||
*/
|
*/
|
||||||
import WebGLLayerRenderer from './Layer.js';
|
import BaseVector from '../../layer/BaseVector.js';
|
||||||
import {create as createTransform} from '../../transform.js';
|
import GeometryType from '../../geom/GeometryType.js';
|
||||||
import {DefaultUniform} from '../../webgl/Helper.js';
|
import LineStringBatchRenderer from '../../render/webgl/LineStringBatchRenderer.js';
|
||||||
import {buffer, createEmpty, equals} from '../../extent.js';
|
import MixedGeometryBatch from '../../render/webgl/MixedGeometryBatch.js';
|
||||||
import {create as createWebGLWorker} from '../../worker/webgl.js';
|
import PointBatchRenderer from '../../render/webgl/PointBatchRenderer.js';
|
||||||
import {listen, unlistenByKey} from '../../events.js';
|
import PolygonBatchRenderer from '../../render/webgl/PolygonBatchRenderer.js';
|
||||||
import VectorEventType from '../../source/VectorEventType.js';
|
import VectorEventType from '../../source/VectorEventType.js';
|
||||||
import ViewHint from '../../ViewHint.js';
|
import ViewHint from '../../ViewHint.js';
|
||||||
import BaseVector from '../../layer/BaseVector.js';
|
import WebGLLayerRenderer from './Layer.js';
|
||||||
import MixedGeometryBatch from '../../render/webgl/MixedGeometryBatch.js';
|
import {DefaultUniform} from '../../webgl/Helper.js';
|
||||||
import GeometryType from '../../geom/GeometryType.js';
|
import {buffer, createEmpty, equals} from '../../extent.js';
|
||||||
import PolygonBatchRenderer from '../../render/webgl/PolygonBatchRenderer.js';
|
import {create as createTransform} from '../../transform.js';
|
||||||
import PointBatchRenderer from '../../render/webgl/PointBatchRenderer.js';
|
import {create as createWebGLWorker} from '../../worker/webgl.js';
|
||||||
import LineStringBatchRenderer from '../../render/webgl/LineStringBatchRenderer.js';
|
import {listen, unlistenByKey} from '../../events.js';
|
||||||
import WebGLRenderTarget from '../../webgl/RenderTarget.js';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} CustomAttribute A description of a custom attribute to be passed on to the GPU, with a value different
|
* @typedef {Object} CustomAttribute A description of a custom attribute to be passed on to the GPU, with a value different
|
||||||
|
|||||||
@@ -2,17 +2,17 @@
|
|||||||
* A worker that does cpu-heavy tasks related to webgl rendering.
|
* A worker that does cpu-heavy tasks related to webgl rendering.
|
||||||
* @module ol/worker/webgl
|
* @module ol/worker/webgl
|
||||||
*/
|
*/
|
||||||
import {assign} from '../obj.js';
|
|
||||||
import {WebGLWorkerMessageType} from '../render/webgl/constants.js';
|
import {WebGLWorkerMessageType} from '../render/webgl/constants.js';
|
||||||
|
import {assign} from '../obj.js';
|
||||||
|
import {
|
||||||
|
create as createTransform,
|
||||||
|
makeInverse as makeInverseTransform,
|
||||||
|
} from '../transform.js';
|
||||||
import {
|
import {
|
||||||
writeLineSegmentToBuffers,
|
writeLineSegmentToBuffers,
|
||||||
writePointFeatureToBuffers,
|
writePointFeatureToBuffers,
|
||||||
writePolygonTrianglesToBuffers,
|
writePolygonTrianglesToBuffers,
|
||||||
} from '../render/webgl/utils.js';
|
} from '../render/webgl/utils.js';
|
||||||
import {
|
|
||||||
create as createTransform,
|
|
||||||
makeInverse as makeInverseTransform,
|
|
||||||
} from '../transform.js';
|
|
||||||
|
|
||||||
/** @type {any} */
|
/** @type {any} */
|
||||||
const worker = self;
|
const worker = self;
|
||||||
@@ -170,6 +170,8 @@ worker.onmessage = (event) => {
|
|||||||
]);
|
]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
// pass
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
import PointBatchRenderer from '../../../../../../src/ol/render/webgl/PointBatchRenderer.js';
|
|
||||||
import WebGLHelper from '../../../../../../src/ol/webgl/Helper.js';
|
|
||||||
import {create as createWebGLWorker} from '../../../../../../src/ol/worker/webgl.js';
|
|
||||||
import MixedGeometryBatch from '../../../../../../src/ol/render/webgl/MixedGeometryBatch.js';
|
|
||||||
import Feature from '../../../../../../src/ol/Feature.js';
|
import Feature from '../../../../../../src/ol/Feature.js';
|
||||||
import Point from '../../../../../../src/ol/geom/Point.js';
|
|
||||||
import Polygon from '../../../../../../src/ol/geom/Polygon.js';
|
|
||||||
import LineString from '../../../../../../src/ol/geom/LineString.js';
|
|
||||||
import GeometryType from '../../../../../../src/ol/geom/GeometryType.js';
|
import GeometryType from '../../../../../../src/ol/geom/GeometryType.js';
|
||||||
import {create as createTransform} from '../../../../../../src/ol/transform.js';
|
import LineString from '../../../../../../src/ol/geom/LineString.js';
|
||||||
import {WebGLWorkerMessageType} from '../../../../../../src/ol/render/webgl/constants.js';
|
|
||||||
import LineStringBatchRenderer from '../../../../../../src/ol/render/webgl/LineStringBatchRenderer.js';
|
import LineStringBatchRenderer from '../../../../../../src/ol/render/webgl/LineStringBatchRenderer.js';
|
||||||
import {FLOAT} from '../../../../../../src/ol/webgl.js';
|
import MixedGeometryBatch from '../../../../../../src/ol/render/webgl/MixedGeometryBatch.js';
|
||||||
|
import Point from '../../../../../../src/ol/geom/Point.js';
|
||||||
|
import PointBatchRenderer from '../../../../../../src/ol/render/webgl/PointBatchRenderer.js';
|
||||||
|
import Polygon from '../../../../../../src/ol/geom/Polygon.js';
|
||||||
import PolygonBatchRenderer from '../../../../../../src/ol/render/webgl/PolygonBatchRenderer.js';
|
import PolygonBatchRenderer from '../../../../../../src/ol/render/webgl/PolygonBatchRenderer.js';
|
||||||
|
import WebGLHelper from '../../../../../../src/ol/webgl/Helper.js';
|
||||||
|
import {FLOAT} from '../../../../../../src/ol/webgl.js';
|
||||||
|
import {WebGLWorkerMessageType} from '../../../../../../src/ol/render/webgl/constants.js';
|
||||||
|
import {create as createTransform} from '../../../../../../src/ol/transform.js';
|
||||||
|
import {create as createWebGLWorker} from '../../../../../../src/ol/worker/webgl.js';
|
||||||
|
|
||||||
const POINT_VERTEX_SHADER = `precision mediump float;
|
const POINT_VERTEX_SHADER = `precision mediump float;
|
||||||
void main(void) {}`;
|
void main(void) {}`;
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import Feature from '../../../../../../src/ol/Feature.js';
|
import Feature from '../../../../../../src/ol/Feature.js';
|
||||||
import Point from '../../../../../../src/ol/geom/Point.js';
|
|
||||||
import MixedGeometryBatch from '../../../../../../src/ol/render/webgl/MixedGeometryBatch.js';
|
|
||||||
import LineString from '../../../../../../src/ol/geom/LineString.js';
|
|
||||||
import {getUid} from '../../../../../../src/ol/index.js';
|
|
||||||
import Polygon from '../../../../../../src/ol/geom/Polygon.js';
|
|
||||||
import LinearRing from '../../../../../../src/ol/geom/LinearRing.js';
|
|
||||||
import MultiPolygon from '../../../../../../src/ol/geom/MultiPolygon.js';
|
|
||||||
import GeometryCollection from '../../../../../../src/ol/geom/GeometryCollection.js';
|
import GeometryCollection from '../../../../../../src/ol/geom/GeometryCollection.js';
|
||||||
|
import LineString from '../../../../../../src/ol/geom/LineString.js';
|
||||||
|
import LinearRing from '../../../../../../src/ol/geom/LinearRing.js';
|
||||||
|
import MixedGeometryBatch from '../../../../../../src/ol/render/webgl/MixedGeometryBatch.js';
|
||||||
import MultiLineString from '../../../../../../src/ol/geom/MultiLineString.js';
|
import MultiLineString from '../../../../../../src/ol/geom/MultiLineString.js';
|
||||||
import MultiPoint from '../../../../../../src/ol/geom/MultiPoint.js';
|
import MultiPoint from '../../../../../../src/ol/geom/MultiPoint.js';
|
||||||
|
import MultiPolygon from '../../../../../../src/ol/geom/MultiPolygon.js';
|
||||||
|
import Point from '../../../../../../src/ol/geom/Point.js';
|
||||||
|
import Polygon from '../../../../../../src/ol/geom/Polygon.js';
|
||||||
|
import {getUid} from '../../../../../../src/ol/index.js';
|
||||||
|
|
||||||
describe('MixedGeometryBatch', function () {
|
describe('MixedGeometryBatch', function () {
|
||||||
let mixedBatch;
|
let mixedBatch;
|
||||||
|
|||||||
@@ -8,12 +8,6 @@ import VectorSource from '../../../../../../src/ol/source/Vector.js';
|
|||||||
import View from '../../../../../../src/ol/View.js';
|
import View from '../../../../../../src/ol/View.js';
|
||||||
import WebGLLayerRenderer from '../../../../../../src/ol/renderer/webgl/Layer.js';
|
import WebGLLayerRenderer from '../../../../../../src/ol/renderer/webgl/Layer.js';
|
||||||
import {getUid} from '../../../../../../src/ol/util.js';
|
import {getUid} from '../../../../../../src/ol/util.js';
|
||||||
import {
|
|
||||||
colorDecodeId,
|
|
||||||
colorEncodeId,
|
|
||||||
getBlankImageData,
|
|
||||||
writePointFeatureToBuffers,
|
|
||||||
} from '../../../../../../src/ol/render/webgl/utils.js';
|
|
||||||
|
|
||||||
describe('ol/renderer/webgl/Layer', function () {
|
describe('ol/renderer/webgl/Layer', function () {
|
||||||
describe('constructor', function () {
|
describe('constructor', function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user