ol 7.0.0-dev.1658343947608 → 7.0.0-dev.1658477212801
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ImageTile.d.ts.map +1 -1
- package/ImageTile.js +34 -1
- package/ImageTile.js.map +1 -1
- package/Tile.d.ts.map +1 -1
- package/Tile.js +6 -1
- package/Tile.js.map +1 -1
- package/TileCache.d.ts.map +1 -1
- package/TileCache.js +6 -0
- package/TileCache.js.map +1 -1
- package/TileQueue.d.ts.map +1 -1
- package/TileQueue.js +3 -1
- package/TileQueue.js.map +1 -1
- package/geom/flat/deflate.d.ts.map +1 -1
- package/geom/flat/deflate.js +3 -0
- package/geom/flat/deflate.js.map +1 -1
- package/geom/flat/inflate.d.ts.map +1 -1
- package/geom/flat/inflate.js +4 -1
- package/geom/flat/inflate.js.map +1 -1
- package/package.json +2 -1
- package/render/webgl/BatchRenderer.d.ts +92 -0
- package/render/webgl/BatchRenderer.d.ts.map +1 -0
- package/render/webgl/BatchRenderer.js +165 -0
- package/render/webgl/BatchRenderer.js.map +1 -0
- package/render/webgl/LineStringBatchRenderer.d.ts +27 -0
- package/render/webgl/LineStringBatchRenderer.d.ts.map +1 -0
- package/render/webgl/LineStringBatchRenderer.js +114 -0
- package/render/webgl/LineStringBatchRenderer.js.map +1 -0
- package/render/webgl/MixedGeometryBatch.d.ts +306 -0
- package/render/webgl/MixedGeometryBatch.d.ts.map +1 -0
- package/render/webgl/MixedGeometryBatch.js +342 -0
- package/render/webgl/MixedGeometryBatch.js.map +1 -0
- package/render/webgl/PointBatchRenderer.d.ts +26 -0
- package/render/webgl/PointBatchRenderer.d.ts.map +1 -0
- package/render/webgl/PointBatchRenderer.js +102 -0
- package/render/webgl/PointBatchRenderer.js.map +1 -0
- package/render/webgl/PolygonBatchRenderer.d.ts +25 -0
- package/render/webgl/PolygonBatchRenderer.d.ts.map +1 -0
- package/render/webgl/PolygonBatchRenderer.js +110 -0
- package/render/webgl/PolygonBatchRenderer.js.map +1 -0
- package/render/webgl/constants.d.ts +43 -0
- package/render/webgl/constants.d.ts.map +1 -0
- package/render/webgl/constants.js +26 -0
- package/render/webgl/constants.js.map +1 -0
- package/render/webgl/utils.d.ts +76 -0
- package/render/webgl/utils.d.ts.map +1 -0
- package/render/webgl/utils.js +257 -0
- package/render/webgl/utils.js.map +1 -0
- package/renderer/canvas/TileLayer.d.ts.map +1 -1
- package/renderer/canvas/TileLayer.js +1 -5
- package/renderer/canvas/TileLayer.js.map +1 -1
- package/renderer/webgl/Layer.d.ts +0 -98
- package/renderer/webgl/Layer.d.ts.map +1 -1
- package/renderer/webgl/Layer.js +0 -134
- package/renderer/webgl/Layer.js.map +1 -1
- package/renderer/webgl/PointsLayer.d.ts +4 -1
- package/renderer/webgl/PointsLayer.d.ts.map +1 -1
- package/renderer/webgl/PointsLayer.js +15 -8
- package/renderer/webgl/PointsLayer.js.map +1 -1
- package/renderer/webgl/TileLayer.js +1 -1
- package/renderer/webgl/TileLayer.js.map +1 -1
- package/renderer/webgl/VectorLayer.d.ts +142 -0
- package/renderer/webgl/VectorLayer.d.ts.map +1 -0
- package/renderer/webgl/VectorLayer.js +304 -0
- package/renderer/webgl/VectorLayer.js.map +1 -0
- package/renderer/webgl/shaders.d.ts +43 -0
- package/renderer/webgl/shaders.d.ts.map +1 -0
- package/renderer/webgl/shaders.js +53 -0
- package/renderer/webgl/shaders.js.map +1 -0
- package/source/TileEventType.d.ts.map +1 -1
- package/source/TileEventType.js +3 -1
- package/source/TileEventType.js.map +1 -1
- package/src/ImageTile.js +34 -1
- package/src/Tile.js +6 -1
- package/src/TileCache.js +7 -0
- package/src/TileQueue.js +3 -1
- package/src/geom/flat/deflate.js +3 -0
- package/src/geom/flat/inflate.js +10 -7
- package/src/render/webgl/BatchRenderer.js +201 -0
- package/src/render/webgl/LineStringBatchRenderer.js +116 -0
- package/src/render/webgl/MixedGeometryBatch.js +364 -0
- package/src/render/webgl/PointBatchRenderer.js +97 -0
- package/src/render/webgl/PolygonBatchRenderer.js +117 -0
- package/src/render/webgl/constants.js +27 -0
- package/src/render/webgl/utils.js +351 -0
- package/src/renderer/canvas/TileLayer.js +1 -4
- package/src/renderer/webgl/Layer.js +0 -160
- package/src/renderer/webgl/PointsLayer.js +16 -12
- package/src/renderer/webgl/TileLayer.js +1 -1
- package/src/renderer/webgl/VectorLayer.js +409 -0
- package/src/renderer/webgl/shaders.js +198 -0
- package/src/source/TileEventType.js +3 -1
- package/src/webgl/Helper.js +30 -45
- package/src/worker/webgl.js +1 -1
- package/util.js +1 -1
- package/webgl/Helper.d.ts +17 -25
- package/webgl/Helper.d.ts.map +1 -1
- package/webgl/Helper.js +29 -43
- package/webgl/Helper.js.map +1 -1
- package/worker/webgl.js +1 -1
- package/worker/webgl.js.map +1 -1
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
+
extendStatics(d, b);
|
|
12
|
+
function __() { this.constructor = d; }
|
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
/**
|
|
17
|
+
* @module ol/render/webgl/LineStringBatchRenderer
|
|
18
|
+
*/
|
|
19
|
+
import AbstractBatchRenderer from './BatchRenderer.js';
|
|
20
|
+
import { AttributeType } from '../../webgl/Helper.js';
|
|
21
|
+
import { transform2D } from '../../geom/flat/transform.js';
|
|
22
|
+
/**
|
|
23
|
+
* Names of attributes made available to the vertex shader.
|
|
24
|
+
* Please note: changing these *will* break custom shaders!
|
|
25
|
+
* @enum {string}
|
|
26
|
+
*/
|
|
27
|
+
export var Attributes = {
|
|
28
|
+
SEGMENT_START: 'a_segmentStart',
|
|
29
|
+
SEGMENT_END: 'a_segmentEnd',
|
|
30
|
+
PARAMETERS: 'a_parameters',
|
|
31
|
+
};
|
|
32
|
+
var LineStringBatchRenderer = /** @class */ (function (_super) {
|
|
33
|
+
__extends(LineStringBatchRenderer, _super);
|
|
34
|
+
/**
|
|
35
|
+
* @param {import("../../webgl/Helper.js").default} helper WebGL helper instance
|
|
36
|
+
* @param {Worker} worker WebGL worker instance
|
|
37
|
+
* @param {string} vertexShader Vertex shader
|
|
38
|
+
* @param {string} fragmentShader Fragment shader
|
|
39
|
+
* @param {Array<import('./BatchRenderer.js').CustomAttribute>} customAttributes List of custom attributes
|
|
40
|
+
*/
|
|
41
|
+
function LineStringBatchRenderer(helper, worker, vertexShader, fragmentShader, customAttributes) {
|
|
42
|
+
var _this = _super.call(this, helper, worker, vertexShader, fragmentShader, customAttributes) || this;
|
|
43
|
+
// vertices for lines must hold both a position (x,y) and an offset (dx,dy)
|
|
44
|
+
_this.attributes = [
|
|
45
|
+
{
|
|
46
|
+
name: Attributes.SEGMENT_START,
|
|
47
|
+
size: 2,
|
|
48
|
+
type: AttributeType.FLOAT,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: Attributes.SEGMENT_END,
|
|
52
|
+
size: 2,
|
|
53
|
+
type: AttributeType.FLOAT,
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: Attributes.PARAMETERS,
|
|
57
|
+
size: 1,
|
|
58
|
+
type: AttributeType.FLOAT,
|
|
59
|
+
},
|
|
60
|
+
].concat(customAttributes.map(function (attribute) {
|
|
61
|
+
return {
|
|
62
|
+
name: 'a_' + attribute.name,
|
|
63
|
+
size: 1,
|
|
64
|
+
type: AttributeType.FLOAT,
|
|
65
|
+
};
|
|
66
|
+
}));
|
|
67
|
+
return _this;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Render instructions for lines are structured like so:
|
|
71
|
+
* [ customAttr0, ... , customAttrN, numberOfVertices0, x0, y0, ... , xN, yN, numberOfVertices1, ... ]
|
|
72
|
+
* @param {import("./MixedGeometryBatch.js").LineStringGeometryBatch} batch Linestring geometry batch
|
|
73
|
+
* @override
|
|
74
|
+
*/
|
|
75
|
+
LineStringBatchRenderer.prototype.generateRenderInstructions = function (batch) {
|
|
76
|
+
// here we anticipate the amount of render instructions for lines:
|
|
77
|
+
// 2 instructions per vertex for position (x and y)
|
|
78
|
+
// + 1 instruction per line per custom attributes
|
|
79
|
+
// + 1 instruction per line (for vertices count)
|
|
80
|
+
var totalInstructionsCount = 2 * batch.verticesCount +
|
|
81
|
+
(1 + this.customAttributes.length) * batch.geometriesCount;
|
|
82
|
+
if (!batch.renderInstructions ||
|
|
83
|
+
batch.renderInstructions.length !== totalInstructionsCount) {
|
|
84
|
+
batch.renderInstructions = new Float32Array(totalInstructionsCount);
|
|
85
|
+
}
|
|
86
|
+
// loop on features to fill the render instructions
|
|
87
|
+
var batchEntry;
|
|
88
|
+
var flatCoords = [];
|
|
89
|
+
var renderIndex = 0;
|
|
90
|
+
var value;
|
|
91
|
+
for (var featureUid in batch.entries) {
|
|
92
|
+
batchEntry = batch.entries[featureUid];
|
|
93
|
+
for (var i = 0, ii = batchEntry.flatCoordss.length; i < ii; i++) {
|
|
94
|
+
flatCoords.length = batchEntry.flatCoordss[i].length;
|
|
95
|
+
transform2D(batchEntry.flatCoordss[i], 0, flatCoords.length, 2, batch.renderInstructionsTransform, flatCoords);
|
|
96
|
+
// custom attributes
|
|
97
|
+
for (var k = 0, kk = this.customAttributes.length; k < kk; k++) {
|
|
98
|
+
value = this.customAttributes[k].callback(batchEntry.feature);
|
|
99
|
+
batch.renderInstructions[renderIndex++] = value;
|
|
100
|
+
}
|
|
101
|
+
// vertices count
|
|
102
|
+
batch.renderInstructions[renderIndex++] = flatCoords.length / 2;
|
|
103
|
+
// looping on points for positions
|
|
104
|
+
for (var j = 0, jj = flatCoords.length; j < jj; j += 2) {
|
|
105
|
+
batch.renderInstructions[renderIndex++] = flatCoords[j];
|
|
106
|
+
batch.renderInstructions[renderIndex++] = flatCoords[j + 1];
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
return LineStringBatchRenderer;
|
|
112
|
+
}(AbstractBatchRenderer));
|
|
113
|
+
export default LineStringBatchRenderer;
|
|
114
|
+
//# sourceMappingURL=LineStringBatchRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LineStringBatchRenderer.js","sourceRoot":"","sources":["../../src/render/webgl/LineStringBatchRenderer.js"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;GAEG;AACH,OAAO,qBAAqB,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAEzD;;;;GAIG;AACH,MAAM,CAAC,IAAM,UAAU,GAAG;IACxB,aAAa,EAAE,gBAAgB;IAC/B,WAAW,EAAE,cAAc;IAC3B,UAAU,EAAE,cAAc;CAC3B,CAAC;AAEF;IAAsC,2CAAqB;IACzD;;;;;;OAMG;IACH,iCAAY,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,gBAAgB;QAA1E,YACE,kBAAM,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,gBAAgB,CAAC,SA4BtE;QA1BC,2EAA2E;QAC3E,KAAI,CAAC,UAAU,GAAG;YAChB;gBACE,IAAI,EAAE,UAAU,CAAC,aAAa;gBAC9B,IAAI,EAAE,CAAC;gBACP,IAAI,EAAE,aAAa,CAAC,KAAK;aAC1B;YACD;gBACE,IA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+
* Object that holds a reference to a feature as well as the raw coordinates of its various geometries
|
|
4
|
+
*/
|
|
5
|
+
export type GeometryBatchItem = {
|
|
6
|
+
/**
|
|
7
|
+
* Feature
|
|
8
|
+
*/
|
|
9
|
+
feature: import("../../Feature").default;
|
|
10
|
+
/**
|
|
11
|
+
* Array of flat coordinates arrays, one for each geometry related to the feature
|
|
12
|
+
*/
|
|
13
|
+
flatCoordss: Array<Array<number>>;
|
|
14
|
+
/**
|
|
15
|
+
* Only defined for linestring and polygon batches
|
|
16
|
+
*/
|
|
17
|
+
verticesCount?: number | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Only defined for polygon batches
|
|
20
|
+
*/
|
|
21
|
+
ringsCount?: number | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Array of vertices counts in each ring for each geometry; only defined for polygons batches
|
|
24
|
+
*/
|
|
25
|
+
ringsVerticesCounts?: number[][] | undefined;
|
|
26
|
+
};
|
|
27
|
+
export type GeometryBatch = PointGeometryBatch | LineStringGeometryBatch | PolygonGeometryBatch;
|
|
28
|
+
/**
|
|
29
|
+
* A geometry batch specific to polygons
|
|
30
|
+
*/
|
|
31
|
+
export type PolygonGeometryBatch = {
|
|
32
|
+
/**
|
|
33
|
+
* Dictionary of all entries in the batch with associated computed values.
|
|
34
|
+
* One entry corresponds to one feature. Key is feature uid.
|
|
35
|
+
*/
|
|
36
|
+
entries: {
|
|
37
|
+
[x: string]: GeometryBatchItem;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Amount of geometries in the batch.
|
|
41
|
+
*/
|
|
42
|
+
geometriesCount: number;
|
|
43
|
+
/**
|
|
44
|
+
* Render instructions for polygons are structured like so:
|
|
45
|
+
* [ numberOfRings, numberOfVerticesInRing0, ..., numberOfVerticesInRingN, x0, y0, customAttr0, ..., xN, yN, customAttrN, numberOfRings,... ]
|
|
46
|
+
*/
|
|
47
|
+
renderInstructions: Float32Array;
|
|
48
|
+
/**
|
|
49
|
+
* Vertices WebGL buffer
|
|
50
|
+
*/
|
|
51
|
+
verticesBuffer: WebGLArrayBuffer;
|
|
52
|
+
/**
|
|
53
|
+
* Indices WebGL buffer
|
|
54
|
+
*/
|
|
55
|
+
indicesBuffer: WebGLArrayBuffer;
|
|
56
|
+
/**
|
|
57
|
+
* Converts world space coordinates to screen space; applies to the rendering instructions
|
|
58
|
+
*/
|
|
59
|
+
renderInstructionsTransform: import("../../transform.js").Transform;
|
|
60
|
+
/**
|
|
61
|
+
* Converts world space coordinates to screen space; applies to the webgl vertices buffer
|
|
62
|
+
*/
|
|
63
|
+
verticesBufferTransform: import("../../transform.js").Transform;
|
|
64
|
+
/**
|
|
65
|
+
* Screen space to world space; applies to the webgl vertices buffer
|
|
66
|
+
*/
|
|
67
|
+
invertVerticesBufferTransform: import("../../transform.js").Transform;
|
|
68
|
+
/**
|
|
69
|
+
* Amount of vertices from geometries in the batch.
|
|
70
|
+
*/
|
|
71
|
+
verticesCount: number;
|
|
72
|
+
/**
|
|
73
|
+
* How many outer and inner rings in this batch.
|
|
74
|
+
*/
|
|
75
|
+
ringsCount: number;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* A geometry batch specific to lines
|
|
79
|
+
*/
|
|
80
|
+
export type LineStringGeometryBatch = {
|
|
81
|
+
/**
|
|
82
|
+
* Dictionary of all entries in the batch with associated computed values.
|
|
83
|
+
* One entry corresponds to one feature. Key is feature uid.
|
|
84
|
+
*/
|
|
85
|
+
entries: {
|
|
86
|
+
[x: string]: GeometryBatchItem;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Amount of geometries in the batch.
|
|
90
|
+
*/
|
|
91
|
+
geometriesCount: number;
|
|
92
|
+
/**
|
|
93
|
+
* Render instructions for polygons are structured like so:
|
|
94
|
+
* [ numberOfRings, numberOfVerticesInRing0, ..., numberOfVerticesInRingN, x0, y0, customAttr0, ..., xN, yN, customAttrN, numberOfRings,... ]
|
|
95
|
+
*/
|
|
96
|
+
renderInstructions: Float32Array;
|
|
97
|
+
/**
|
|
98
|
+
* Vertices WebGL buffer
|
|
99
|
+
*/
|
|
100
|
+
verticesBuffer: WebGLArrayBuffer;
|
|
101
|
+
/**
|
|
102
|
+
* Indices WebGL buffer
|
|
103
|
+
*/
|
|
104
|
+
indicesBuffer: WebGLArrayBuffer;
|
|
105
|
+
/**
|
|
106
|
+
* Converts world space coordinates to screen space; applies to the rendering instructions
|
|
107
|
+
*/
|
|
108
|
+
renderInstructionsTransform: import("../../transform.js").Transform;
|
|
109
|
+
/**
|
|
110
|
+
* Converts world space coordinates to screen space; applies to the webgl vertices buffer
|
|
111
|
+
*/
|
|
112
|
+
verticesBufferTransform: import("../../transform.js").Transform;
|
|
113
|
+
/**
|
|
114
|
+
* Screen space to world space; applies to the webgl vertices buffer
|
|
115
|
+
*/
|
|
116
|
+
invertVerticesBufferTransform: import("../../transform.js").Transform;
|
|
117
|
+
/**
|
|
118
|
+
* Amount of vertices from geometries in the batch.
|
|
119
|
+
*/
|
|
120
|
+
verticesCount: number;
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* A geometry batch specific to points
|
|
124
|
+
*/
|
|
125
|
+
export type PointGeometryBatch = {
|
|
126
|
+
/**
|
|
127
|
+
* Dictionary of all entries in the batch with associated computed values.
|
|
128
|
+
* One entry corresponds to one feature. Key is feature uid.
|
|
129
|
+
*/
|
|
130
|
+
entries: {
|
|
131
|
+
[x: string]: GeometryBatchItem;
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* Amount of geometries in the batch.
|
|
135
|
+
*/
|
|
136
|
+
geometriesCount: number;
|
|
137
|
+
/**
|
|
138
|
+
* Render instructions for polygons are structured like so:
|
|
139
|
+
* [ numberOfRings, numberOfVerticesInRing0, ..., numberOfVerticesInRingN, x0, y0, customAttr0, ..., xN, yN, customAttrN, numberOfRings,... ]
|
|
140
|
+
*/
|
|
141
|
+
renderInstructions: Float32Array;
|
|
142
|
+
/**
|
|
143
|
+
* Vertices WebGL buffer
|
|
144
|
+
*/
|
|
145
|
+
verticesBuffer: WebGLArrayBuffer;
|
|
146
|
+
/**
|
|
147
|
+
* Indices WebGL buffer
|
|
148
|
+
*/
|
|
149
|
+
indicesBuffer: WebGLArrayBuffer;
|
|
150
|
+
/**
|
|
151
|
+
* Converts world space coordinates to screen space; applies to the rendering instructions
|
|
152
|
+
*/
|
|
153
|
+
renderInstructionsTransform: import("../../transform.js").Transform;
|
|
154
|
+
/**
|
|
155
|
+
* Converts world space coordinates to screen space; applies to the webgl vertices buffer
|
|
156
|
+
*/
|
|
157
|
+
verticesBufferTransform: import("../../transform.js").Transform;
|
|
158
|
+
/**
|
|
159
|
+
* Screen space to world space; applies to the webgl vertices buffer
|
|
160
|
+
*/
|
|
161
|
+
invertVerticesBufferTransform: import("../../transform.js").Transform;
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* @typedef {Object} GeometryBatchItem Object that holds a reference to a feature as well as the raw coordinates of its various geometries
|
|
165
|
+
* @property {import("../../Feature").default} feature Feature
|
|
166
|
+
* @property {Array<Array<number>>} flatCoordss Array of flat coordinates arrays, one for each geometry related to the feature
|
|
167
|
+
* @property {number} [verticesCount] Only defined for linestring and polygon batches
|
|
168
|
+
* @property {number} [ringsCount] Only defined for polygon batches
|
|
169
|
+
* @property {Array<Array<number>>} [ringsVerticesCounts] Array of vertices counts in each ring for each geometry; only defined for polygons batches
|
|
170
|
+
*/
|
|
171
|
+
/**
|
|
172
|
+
* @typedef {PointGeometryBatch|LineStringGeometryBatch|PolygonGeometryBatch} GeometryBatch
|
|
173
|
+
*/
|
|
174
|
+
/**
|
|
175
|
+
* @typedef {Object} PolygonGeometryBatch A geometry batch specific to polygons
|
|
176
|
+
* @property {Object<string, GeometryBatchItem>} entries Dictionary of all entries in the batch with associated computed values.
|
|
177
|
+
* One entry corresponds to one feature. Key is feature uid.
|
|
178
|
+
* @property {number} geometriesCount Amount of geometries in the batch.
|
|
179
|
+
* @property {Float32Array} renderInstructions Render instructions for polygons are structured like so:
|
|
180
|
+
* [ numberOfRings, numberOfVerticesInRing0, ..., numberOfVerticesInRingN, x0, y0, customAttr0, ..., xN, yN, customAttrN, numberOfRings,... ]
|
|
181
|
+
* @property {WebGLArrayBuffer} verticesBuffer Vertices WebGL buffer
|
|
182
|
+
* @property {WebGLArrayBuffer} indicesBuffer Indices WebGL buffer
|
|
183
|
+
* @property {import("../../transform.js").Transform} renderInstructionsTransform Converts world space coordinates to screen space; applies to the rendering instructions
|
|
184
|
+
* @property {import("../../transform.js").Transform} verticesBufferTransform Converts world space coordinates to screen space; applies to the webgl vertices buffer
|
|
185
|
+
* @property {import("../../transform.js").Transform} invertVerticesBufferTransform Screen space to world space; applies to the webgl vertices buffer
|
|
186
|
+
* @property {number} verticesCount Amount of vertices from geometries in the batch.
|
|
187
|
+
* @property {number} ringsCount How many outer and inner rings in this batch.
|
|
188
|
+
*/
|
|
189
|
+
/**
|
|
190
|
+
* @typedef {Object} LineStringGeometryBatch A geometry batch specific to lines
|
|
191
|
+
* @property {Object<string, GeometryBatchItem>} entries Dictionary of all entries in the batch with associated computed values.
|
|
192
|
+
* One entry corresponds to one feature. Key is feature uid.
|
|
193
|
+
* @property {number} geometriesCount Amount of geometries in the batch.
|
|
194
|
+
* @property {Float32Array} renderInstructions Render instructions for polygons are structured like so:
|
|
195
|
+
* [ numberOfRings, numberOfVerticesInRing0, ..., numberOfVerticesInRingN, x0, y0, customAttr0, ..., xN, yN, customAttrN, numberOfRings,... ]
|
|
196
|
+
* @property {WebGLArrayBuffer} verticesBuffer Vertices WebGL buffer
|
|
197
|
+
* @property {WebGLArrayBuffer} indicesBuffer Indices WebGL buffer
|
|
198
|
+
* @property {import("../../transform.js").Transform} renderInstructionsTransform Converts world space coordinates to screen space; applies to the rendering instructions
|
|
199
|
+
* @property {import("../../transform.js").Transform} verticesBufferTransform Converts world space coordinates to screen space; applies to the webgl vertices buffer
|
|
200
|
+
* @property {import("../../transform.js").Transform} invertVerticesBufferTransform Screen space to world space; applies to the webgl vertices buffer
|
|
201
|
+
* @property {number} verticesCount Amount of vertices from geometries in the batch.
|
|
202
|
+
*/
|
|
203
|
+
/**
|
|
204
|
+
* @typedef {Object} PointGeometryBatch A geometry batch specific to points
|
|
205
|
+
* @property {Object<string, GeometryBatchItem>} entries Dictionary of all entries in the batch with associated computed values.
|
|
206
|
+
* One entry corresponds to one feature. Key is feature uid.
|
|
207
|
+
* @property {number} geometriesCount Amount of geometries in the batch.
|
|
208
|
+
* @property {Float32Array} renderInstructions Render instructions for polygons are structured like so:
|
|
209
|
+
* [ numberOfRings, numberOfVerticesInRing0, ..., numberOfVerticesInRingN, x0, y0, customAttr0, ..., xN, yN, customAttrN, numberOfRings,... ]
|
|
210
|
+
* @property {WebGLArrayBuffer} verticesBuffer Vertices WebGL buffer
|
|
211
|
+
* @property {WebGLArrayBuffer} indicesBuffer Indices WebGL buffer
|
|
212
|
+
* @property {import("../../transform.js").Transform} renderInstructionsTransform Converts world space coordinates to screen space; applies to the rendering instructions
|
|
213
|
+
* @property {import("../../transform.js").Transform} verticesBufferTransform Converts world space coordinates to screen space; applies to the webgl vertices buffer
|
|
214
|
+
* @property {import("../../transform.js").Transform} invertVerticesBufferTransform Screen space to world space; applies to the webgl vertices buffer
|
|
215
|
+
*/
|
|
216
|
+
/**
|
|
217
|
+
* @classdesc This class is used to group several geometries of various types together for faster rendering.
|
|
218
|
+
* Three inner batches are maintained for polygons, lines and points. Each time a feature is added, changed or removed
|
|
219
|
+
* from the batch, these inner batches are modified accordingly in order to keep them up-to-date.
|
|
220
|
+
*
|
|
221
|
+
* A feature can be present in several inner batches, for example a polygon geometry will be present in the polygon batch
|
|
222
|
+
* and its linar rings will be present in the line batch. Multi geometries are also broken down into individual geometries
|
|
223
|
+
* and added to the corresponding batches in a recursive manner.
|
|
224
|
+
*
|
|
225
|
+
* Corresponding {@link module:ol/render/webgl/BatchRenderer} instances are then used to generate the render instructions
|
|
226
|
+
* and WebGL buffers (vertices and indices) for each inner batches; render instructions are stored on the inner batches,
|
|
227
|
+
* alongside the transform used to convert world coords to screen coords at the time these instructions were generated.
|
|
228
|
+
* The resulting WebGL buffers are stored on the batches as well.
|
|
229
|
+
*
|
|
230
|
+
* An important aspect of geometry batches is that there is no guarantee that render instructions and WebGL buffers
|
|
231
|
+
* are synchronized, i.e. render instructions can describe a new state while WebGL buffers might not have been written yet.
|
|
232
|
+
* This is why two world-to-screen transforms are stored on each batch: one for the render instructions and one for
|
|
233
|
+
* the WebGL buffers.
|
|
234
|
+
*/
|
|
235
|
+
declare class MixedGeometryBatch {
|
|
236
|
+
/**
|
|
237
|
+
* @type {PolygonGeometryBatch}
|
|
238
|
+
*/
|
|
239
|
+
polygonBatch: PolygonGeometryBatch;
|
|
240
|
+
/**
|
|
241
|
+
* @type {PointGeometryBatch}
|
|
242
|
+
*/
|
|
243
|
+
pointBatch: PointGeometryBatch;
|
|
244
|
+
/**
|
|
245
|
+
* @type {LineStringGeometryBatch}
|
|
246
|
+
*/
|
|
247
|
+
lineStringBatch: LineStringGeometryBatch;
|
|
248
|
+
/**
|
|
249
|
+
* @param {Array<import("../../Feature").default>} features Array of features to add to the batch
|
|
250
|
+
*/
|
|
251
|
+
addFeatures(features: Array<import("../../Feature").default>): void;
|
|
252
|
+
/**
|
|
253
|
+
* @param {import("../../Feature").default} feature Feature to add to the batch
|
|
254
|
+
*/
|
|
255
|
+
addFeature(feature: import("../../Feature").default): void;
|
|
256
|
+
/**
|
|
257
|
+
* @param {import("../../Feature").default} feature Feature
|
|
258
|
+
* @return {GeometryBatchItem} Batch item added (or existing one)
|
|
259
|
+
* @private
|
|
260
|
+
*/
|
|
261
|
+
private addFeatureEntryInPointBatch_;
|
|
262
|
+
/**
|
|
263
|
+
* @param {import("../../Feature").default} feature Feature
|
|
264
|
+
* @return {GeometryBatchItem} Batch item added (or existing one)
|
|
265
|
+
* @private
|
|
266
|
+
*/
|
|
267
|
+
private addFeatureEntryInLineStringBatch_;
|
|
268
|
+
/**
|
|
269
|
+
* @param {import("../../Feature").default} feature Feature
|
|
270
|
+
* @return {GeometryBatchItem} Batch item added (or existing one)
|
|
271
|
+
* @private
|
|
272
|
+
*/
|
|
273
|
+
private addFeatureEntryInPolygonBatch_;
|
|
274
|
+
/**
|
|
275
|
+
* @param {import("../../Feature").default} feature Feature
|
|
276
|
+
* @private
|
|
277
|
+
*/
|
|
278
|
+
private clearFeatureEntryInPointBatch_;
|
|
279
|
+
/**
|
|
280
|
+
* @param {import("../../Feature").default} feature Feature
|
|
281
|
+
* @private
|
|
282
|
+
*/
|
|
283
|
+
private clearFeatureEntryInLineStringBatch_;
|
|
284
|
+
/**
|
|
285
|
+
* @param {import("../../Feature").default} feature Feature
|
|
286
|
+
* @private
|
|
287
|
+
*/
|
|
288
|
+
private clearFeatureEntryInPolygonBatch_;
|
|
289
|
+
/**
|
|
290
|
+
* @param {import("../../geom").Geometry} geometry Geometry
|
|
291
|
+
* @param {import("../../Feature").default} feature Feature
|
|
292
|
+
* @private
|
|
293
|
+
*/
|
|
294
|
+
private addGeometry_;
|
|
295
|
+
/**
|
|
296
|
+
* @param {import("../../Feature").default} feature Feature
|
|
297
|
+
*/
|
|
298
|
+
changeFeature(feature: import("../../Feature").default): void;
|
|
299
|
+
/**
|
|
300
|
+
* @param {import("../../Feature").default} feature Feature
|
|
301
|
+
*/
|
|
302
|
+
removeFeature(feature: import("../../Feature").default): void;
|
|
303
|
+
clear(): void;
|
|
304
|
+
}
|
|
305
|
+
import WebGLArrayBuffer from "../../webgl/Buffer.js";
|
|
306
|
+
//# sourceMappingURL=MixedGeometryBatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MixedGeometryBatch.d.ts","sourceRoot":"","sources":["../../src/render/webgl/MixedGeometryBatch.js"],"names":[],"mappings":";;;;;;;;aAUc,OAAO,eAAe,EAAE,OAAO;;;;iBAC/B,MAAM,MAAM,MAAM,CAAC,CAAC;;;;;;;;;;;;;;4BAOrB,kBAAkB,GAAC,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