itowns 2.44.3-next.4 → 2.44.3-next.41

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.
Files changed (217) hide show
  1. package/README.md +3 -129
  2. package/examples/3dtiles_loader.html +123 -48
  3. package/examples/config.json +3 -10
  4. package/examples/copc_simple_loader.html +15 -5
  5. package/examples/effects_stereo.html +2 -2
  6. package/examples/entwine_3d_loader.html +3 -1
  7. package/examples/entwine_simple_loader.html +1 -1
  8. package/examples/images/itowns_logo.svg +123 -0
  9. package/examples/js/plugins/COGParser.js +1 -1
  10. package/examples/jsm/OGC3DTilesHelper.js +6 -1
  11. package/examples/layers/JSONLayers/GeoidMNT.json +3 -1
  12. package/examples/misc_collada.html +2 -2
  13. package/examples/source_file_geojson_3d.html +0 -1
  14. package/examples/source_file_kml_raster_usgs.html +0 -1
  15. package/examples/source_stream_wfs_raster.html +0 -7
  16. package/examples/vector_tile_mapbox_raster.html +91 -0
  17. package/examples/view_3d_map_webxr.html +3 -1
  18. package/examples/view_multi_25d.html +2 -2
  19. package/package.json +21 -75
  20. package/CODING.md +0 -120
  21. package/CONTRIBUTING.md +0 -150
  22. package/CONTRIBUTORS.md +0 -55
  23. package/LICENSE.md +0 -44
  24. package/changelog.md +0 -1361
  25. package/dist/455.js +0 -2
  26. package/dist/455.js.map +0 -1
  27. package/dist/debug.js +0 -3
  28. package/dist/debug.js.LICENSE.txt +0 -13
  29. package/dist/debug.js.map +0 -1
  30. package/dist/itowns.js +0 -3
  31. package/dist/itowns.js.LICENSE.txt +0 -7
  32. package/dist/itowns.js.map +0 -1
  33. package/dist/itowns_lasparser.js +0 -2
  34. package/dist/itowns_lasparser.js.map +0 -1
  35. package/dist/itowns_lasworker.js +0 -2
  36. package/dist/itowns_lasworker.js.map +0 -1
  37. package/dist/itowns_potree2worker.js +0 -2
  38. package/dist/itowns_potree2worker.js.map +0 -1
  39. package/dist/itowns_widgets.js +0 -2
  40. package/dist/itowns_widgets.js.map +0 -1
  41. package/examples/.eslintrc.cjs +0 -35
  42. package/examples/3dtiles_25d.html +0 -120
  43. package/examples/3dtiles_basic.html +0 -94
  44. package/examples/3dtiles_batch_table.html +0 -86
  45. package/examples/3dtiles_ion.html +0 -126
  46. package/examples/3dtiles_pointcloud.html +0 -95
  47. package/examples/jsm/.eslintrc.cjs +0 -38
  48. package/lib/Controls/FirstPersonControls.js +0 -308
  49. package/lib/Controls/FlyControls.js +0 -175
  50. package/lib/Controls/GlobeControls.js +0 -1162
  51. package/lib/Controls/PlanarControls.js +0 -1025
  52. package/lib/Controls/StateControl.js +0 -429
  53. package/lib/Controls/StreetControls.js +0 -392
  54. package/lib/Converter/Feature2Mesh.js +0 -608
  55. package/lib/Converter/Feature2Texture.js +0 -170
  56. package/lib/Converter/convertToTile.js +0 -75
  57. package/lib/Converter/textureConverter.js +0 -44
  58. package/lib/Core/3DTiles/C3DTBatchTable.js +0 -131
  59. package/lib/Core/3DTiles/C3DTBatchTableHierarchyExtension.js +0 -96
  60. package/lib/Core/3DTiles/C3DTBoundingVolume.js +0 -157
  61. package/lib/Core/3DTiles/C3DTExtensions.js +0 -97
  62. package/lib/Core/3DTiles/C3DTFeature.js +0 -110
  63. package/lib/Core/3DTiles/C3DTilesEnums.js +0 -20
  64. package/lib/Core/3DTiles/C3DTileset.js +0 -99
  65. package/lib/Core/3DTiles/utils/BinaryPropertyAccessor.js +0 -100
  66. package/lib/Core/AnimationPlayer.js +0 -142
  67. package/lib/Core/CopcNode.js +0 -174
  68. package/lib/Core/Deprecated/Undeprecator.js +0 -75
  69. package/lib/Core/EntwinePointTileNode.js +0 -126
  70. package/lib/Core/Feature.js +0 -490
  71. package/lib/Core/Geographic/CoordStars.js +0 -80
  72. package/lib/Core/Geographic/Coordinates.js +0 -320
  73. package/lib/Core/Geographic/Crs.js +0 -175
  74. package/lib/Core/Geographic/Extent.js +0 -726
  75. package/lib/Core/Geographic/GeoidGrid.js +0 -109
  76. package/lib/Core/Label.js +0 -222
  77. package/lib/Core/MainLoop.js +0 -211
  78. package/lib/Core/Math/Ellipsoid.js +0 -144
  79. package/lib/Core/Picking.js +0 -255
  80. package/lib/Core/PointCloudNode.js +0 -42
  81. package/lib/Core/Potree2Node.js +0 -206
  82. package/lib/Core/Potree2PointAttributes.js +0 -139
  83. package/lib/Core/PotreeNode.js +0 -101
  84. package/lib/Core/Prefab/Globe/Atmosphere.js +0 -299
  85. package/lib/Core/Prefab/Globe/BuilderEllipsoidTile.js +0 -110
  86. package/lib/Core/Prefab/Globe/GlobeLayer.js +0 -145
  87. package/lib/Core/Prefab/Globe/SkyShader.js +0 -78
  88. package/lib/Core/Prefab/GlobeView.js +0 -161
  89. package/lib/Core/Prefab/Planar/PlanarLayer.js +0 -53
  90. package/lib/Core/Prefab/Planar/PlanarTileBuilder.js +0 -72
  91. package/lib/Core/Prefab/PlanarView.js +0 -62
  92. package/lib/Core/Prefab/TileBuilder.js +0 -80
  93. package/lib/Core/Prefab/computeBufferTileGeometry.js +0 -183
  94. package/lib/Core/Scheduler/Cache.js +0 -256
  95. package/lib/Core/Scheduler/CancelledCommandException.js +0 -15
  96. package/lib/Core/Scheduler/Scheduler.js +0 -294
  97. package/lib/Core/Style.js +0 -1121
  98. package/lib/Core/System/Capabilities.js +0 -63
  99. package/lib/Core/TileGeometry.js +0 -40
  100. package/lib/Core/TileMesh.js +0 -108
  101. package/lib/Core/View.js +0 -1109
  102. package/lib/Layer/C3DTilesLayer.js +0 -455
  103. package/lib/Layer/ColorLayer.js +0 -128
  104. package/lib/Layer/CopcLayer.js +0 -58
  105. package/lib/Layer/ElevationLayer.js +0 -107
  106. package/lib/Layer/EntwinePointTileLayer.js +0 -64
  107. package/lib/Layer/FeatureGeometryLayer.js +0 -63
  108. package/lib/Layer/GeoidLayer.js +0 -80
  109. package/lib/Layer/GeometryLayer.js +0 -202
  110. package/lib/Layer/InfoLayer.js +0 -64
  111. package/lib/Layer/LabelLayer.js +0 -452
  112. package/lib/Layer/Layer.js +0 -304
  113. package/lib/Layer/LayerUpdateState.js +0 -89
  114. package/lib/Layer/LayerUpdateStrategy.js +0 -80
  115. package/lib/Layer/OGC3DTilesLayer.js +0 -387
  116. package/lib/Layer/OrientedImageLayer.js +0 -222
  117. package/lib/Layer/PointCloudLayer.js +0 -359
  118. package/lib/Layer/Potree2Layer.js +0 -164
  119. package/lib/Layer/PotreeLayer.js +0 -65
  120. package/lib/Layer/RasterLayer.js +0 -27
  121. package/lib/Layer/ReferencingLayerProperties.js +0 -62
  122. package/lib/Layer/TiledGeometryLayer.js +0 -403
  123. package/lib/Loader/LASLoader.js +0 -193
  124. package/lib/Loader/Potree2BrotliLoader.js +0 -261
  125. package/lib/Loader/Potree2Loader.js +0 -207
  126. package/lib/Main.js +0 -115
  127. package/lib/MainBundle.js +0 -4
  128. package/lib/Parser/B3dmParser.js +0 -174
  129. package/lib/Parser/CameraCalibrationParser.js +0 -94
  130. package/lib/Parser/GDFParser.js +0 -72
  131. package/lib/Parser/GTXParser.js +0 -75
  132. package/lib/Parser/GeoJsonParser.js +0 -212
  133. package/lib/Parser/GpxParser.js +0 -25
  134. package/lib/Parser/ISGParser.js +0 -71
  135. package/lib/Parser/KMLParser.js +0 -25
  136. package/lib/Parser/LASParser.js +0 -137
  137. package/lib/Parser/MapBoxUrlParser.js +0 -83
  138. package/lib/Parser/PntsParser.js +0 -131
  139. package/lib/Parser/Potree2BinParser.js +0 -92
  140. package/lib/Parser/PotreeBinParser.js +0 -106
  141. package/lib/Parser/PotreeCinParser.js +0 -29
  142. package/lib/Parser/ShapefileParser.js +0 -78
  143. package/lib/Parser/VectorTileParser.js +0 -202
  144. package/lib/Parser/XbilParser.js +0 -108
  145. package/lib/Parser/deprecated/LegacyGLTFLoader.js +0 -1386
  146. package/lib/Parser/iGLTFLoader.js +0 -168
  147. package/lib/Process/3dTilesProcessing.js +0 -304
  148. package/lib/Process/FeatureProcessing.js +0 -76
  149. package/lib/Process/LayeredMaterialNodeProcessing.js +0 -221
  150. package/lib/Process/ObjectRemovalHelper.js +0 -97
  151. package/lib/Process/handlerNodeError.js +0 -23
  152. package/lib/Provider/3dTilesProvider.js +0 -149
  153. package/lib/Provider/DataSourceProvider.js +0 -8
  154. package/lib/Provider/Fetcher.js +0 -229
  155. package/lib/Provider/PointCloudProvider.js +0 -45
  156. package/lib/Provider/TileProvider.js +0 -16
  157. package/lib/Provider/URLBuilder.js +0 -105
  158. package/lib/Renderer/Camera.js +0 -281
  159. package/lib/Renderer/Color.js +0 -56
  160. package/lib/Renderer/ColorLayersOrdering.js +0 -115
  161. package/lib/Renderer/CommonMaterial.js +0 -31
  162. package/lib/Renderer/Label2DRenderer.js +0 -190
  163. package/lib/Renderer/LayeredMaterial.js +0 -243
  164. package/lib/Renderer/OBB.js +0 -153
  165. package/lib/Renderer/OrientedImageCamera.js +0 -118
  166. package/lib/Renderer/OrientedImageMaterial.js +0 -167
  167. package/lib/Renderer/PointsMaterial.js +0 -485
  168. package/lib/Renderer/RasterTile.js +0 -209
  169. package/lib/Renderer/RenderMode.js +0 -31
  170. package/lib/Renderer/Shader/ShaderChunk.js +0 -160
  171. package/lib/Renderer/Shader/ShaderUtils.js +0 -47
  172. package/lib/Renderer/SphereHelper.js +0 -23
  173. package/lib/Renderer/WebXR.js +0 -51
  174. package/lib/Renderer/c3DEngine.js +0 -214
  175. package/lib/Source/C3DTilesGoogleSource.js +0 -74
  176. package/lib/Source/C3DTilesIonSource.js +0 -54
  177. package/lib/Source/C3DTilesSource.js +0 -30
  178. package/lib/Source/CopcSource.js +0 -115
  179. package/lib/Source/EntwinePointTileSource.js +0 -62
  180. package/lib/Source/FileSource.js +0 -189
  181. package/lib/Source/OGC3DTilesGoogleSource.js +0 -29
  182. package/lib/Source/OGC3DTilesIonSource.js +0 -34
  183. package/lib/Source/OGC3DTilesSource.js +0 -21
  184. package/lib/Source/OrientedImageSource.js +0 -59
  185. package/lib/Source/Potree2Source.js +0 -167
  186. package/lib/Source/PotreeSource.js +0 -82
  187. package/lib/Source/Source.js +0 -223
  188. package/lib/Source/TMSSource.js +0 -143
  189. package/lib/Source/VectorTilesSource.js +0 -178
  190. package/lib/Source/WFSSource.js +0 -165
  191. package/lib/Source/WMSSource.js +0 -130
  192. package/lib/Source/WMTSSource.js +0 -86
  193. package/lib/ThreeExtended/capabilities/WebGL.js +0 -69
  194. package/lib/ThreeExtended/libs/ktx-parse.module.js +0 -470
  195. package/lib/ThreeExtended/libs/zstddec.module.js +0 -29
  196. package/lib/ThreeExtended/loaders/DDSLoader.js +0 -200
  197. package/lib/ThreeExtended/loaders/DRACOLoader.js +0 -399
  198. package/lib/ThreeExtended/loaders/GLTFLoader.js +0 -2876
  199. package/lib/ThreeExtended/loaders/KTX2Loader.js +0 -625
  200. package/lib/ThreeExtended/utils/BufferGeometryUtils.js +0 -846
  201. package/lib/ThreeExtended/utils/WorkerPool.js +0 -70
  202. package/lib/Utils/CameraUtils.js +0 -555
  203. package/lib/Utils/DEMUtils.js +0 -350
  204. package/lib/Utils/FeaturesUtils.js +0 -156
  205. package/lib/Utils/Gradients.js +0 -16
  206. package/lib/Utils/OrientationUtils.js +0 -457
  207. package/lib/Utils/ThreeUtils.js +0 -115
  208. package/lib/Utils/gui/C3DTilesStyle.js +0 -216
  209. package/lib/Utils/gui/Main.js +0 -7
  210. package/lib/Utils/gui/Minimap.js +0 -154
  211. package/lib/Utils/gui/Navigation.js +0 -245
  212. package/lib/Utils/gui/Scale.js +0 -107
  213. package/lib/Utils/gui/Searchbar.js +0 -234
  214. package/lib/Utils/gui/Widget.js +0 -80
  215. package/lib/Utils/placeObjectOnGround.js +0 -137
  216. package/lib/Worker/LASLoaderWorker.js +0 -19
  217. package/lib/Worker/Potree2Worker.js +0 -21
@@ -1,294 +0,0 @@
1
- /**
2
- * Generated On: 2015-10-5
3
- * Class: Scheduler
4
- * Description: Cette classe singleton gère les requetes/Commandes de la scène. Ces commandes peuvent etre synchrone ou asynchrone. Elle permet d'executer, de prioriser et d'annuler les commandes de la pile. Les commandes executées sont placées dans une autre file d'attente.
5
- */
6
-
7
- import PriorityQueue from 'js-priority-queue';
8
- import DataSourceProvider from "../../Provider/DataSourceProvider.js";
9
- import TileProvider from "../../Provider/TileProvider.js";
10
- import $3dTilesProvider from "../../Provider/3dTilesProvider.js";
11
- import PointCloudProvider from "../../Provider/PointCloudProvider.js";
12
- import URLBuilder from "../../Provider/URLBuilder.js";
13
- import CancelledCommandException from "./CancelledCommandException.js";
14
- function queueOrdering(a, b) {
15
- const cmp = b.priority - a.priority;
16
- // Prioritize recent commands
17
- if (cmp === 0) {
18
- return b.timestamp - a.timestamp;
19
- }
20
- return cmp;
21
- }
22
- function drawNextLayer(storages) {
23
- // Dithering algorithm to select the next layer
24
- // see https://gamedev.stackexchange.com/a/95696 for more details
25
- let sum = 0;
26
- let selected;
27
- let max;
28
- for (const item of storages) {
29
- const st = item[1];
30
- if (st.q.length > 0) {
31
- sum += st.priority;
32
- st.accumulator += st.priority;
33
- // Select the biggest accumulator
34
- if (!selected || st.accumulator > max) {
35
- selected = st;
36
- max = st.accumulator;
37
- }
38
- }
39
- }
40
- if (selected) {
41
- selected.accumulator -= sum;
42
- return selected.q;
43
- }
44
- }
45
- function _instanciateQueue() {
46
- return {
47
- queue(command) {
48
- const layer = command.layer;
49
- let st = this.storages.get(layer.id);
50
- if (!st) {
51
- st = {
52
- q: new PriorityQueue({
53
- comparator: queueOrdering
54
- }),
55
- priority: 1,
56
- accumulator: 0
57
- };
58
- this.storages.set(layer.id, st);
59
- }
60
- // update priority (layer.priority may have changed)
61
- st.priority = layer.priority || 1;
62
- st.q.queue(command);
63
- this.counters.pending++;
64
- },
65
- storages: new Map(),
66
- counters: {
67
- // commands in progress
68
- executing: 0,
69
- // commands successfully executed
70
- executed: 0,
71
- // commands failed
72
- failed: 0,
73
- // commands cancelled
74
- cancelled: 0,
75
- // commands pending
76
- pending: 0
77
- },
78
- execute(cmd, provider) {
79
- this.counters.pending--;
80
- this.counters.executing++;
81
- return provider.executeCommand(cmd).then(result => {
82
- this.counters.executing--;
83
- cmd.resolve(result);
84
- // only count successul commands
85
- this.counters.executed++;
86
- }, err => {
87
- this.counters.executing--;
88
- cmd.reject(err);
89
- this.counters.failed++;
90
- });
91
- }
92
- };
93
- }
94
-
95
- /**
96
- * The Scheduler is in charge of managing the [Providers]{@link Provider} that
97
- * are used to gather resources needed to display the layers on a {@link View}.
98
- * There is only one instance of a Scheduler per webview, and it is instanciated
99
- * with the creation of the first view.
100
- *
101
- * @constructor
102
- */
103
- function Scheduler() {
104
- // Constructor
105
- this.defaultQueue = _instanciateQueue();
106
- this.hostQueues = new Map();
107
- this.providers = {};
108
- this.maxCommandsPerHost = 6;
109
-
110
- // TODO: add an options to not instanciate default providers
111
- this.initDefaultProviders();
112
- }
113
- Scheduler.prototype.constructor = Scheduler;
114
- Scheduler.prototype.initDefaultProviders = function () {
115
- // Register all providers
116
- this.addProtocolProvider('tile', TileProvider);
117
- this.addProtocolProvider('3d-tiles', $3dTilesProvider);
118
- this.addProtocolProvider('pointcloud', PointCloudProvider);
119
- };
120
- Scheduler.prototype.runCommand = function (command, queue, executingCounterUpToDate) {
121
- const provider = this.getProtocolProvider(command.layer.protocol);
122
- if (!provider) {
123
- throw new Error(`No known provider for layer ${command.layer.id}`);
124
- }
125
- queue.execute(command, provider, executingCounterUpToDate).then(() => {
126
- // notify view that one command ended.
127
- command.view.notifyChange(command.requester, command.redraw);
128
-
129
- // try to execute next command
130
- if (queue.counters.executing < this.maxCommandsPerHost) {
131
- const cmd = this.deQueue(queue);
132
- if (cmd) {
133
- this.runCommand(cmd, queue);
134
- }
135
- }
136
- });
137
- };
138
- Scheduler.prototype.execute = function (command) {
139
- // TODO: check for mandatory commands fields
140
-
141
- // parse host
142
- const layer = command.layer;
143
- const host = layer.source && layer.source.url && layer.source.url !== 'none' ? new URL(URLBuilder.subDomains(layer.source.url), document.location).host : undefined;
144
- command.promise = new Promise((resolve, reject) => {
145
- command.resolve = resolve;
146
- command.reject = reject;
147
- });
148
-
149
- // init queue if needed
150
- if (host && !this.hostQueues.has(host)) {
151
- this.hostQueues.set(host, _instanciateQueue());
152
- }
153
- const q = host ? this.hostQueues.get(host) : this.defaultQueue;
154
- command.timestamp = Date.now();
155
- q.queue(command);
156
- if (q.counters.executing < this.maxCommandsPerHost) {
157
- // Defer the processing after the end of the current frame.
158
- // Promise.resolve or setTimeout(..., 0) will do the job, the difference
159
- // is:
160
- // - setTimeout is a new task, queued in the event-loop queues
161
- // - Promise is a micro-task, executed before other tasks
162
- Promise.resolve().then(() => {
163
- if (q.counters.executing < this.maxCommandsPerHost) {
164
- const cmd = this.deQueue(q);
165
- if (cmd) {
166
- this.runCommand(cmd, q);
167
- }
168
- }
169
- });
170
- }
171
- return command.promise;
172
- };
173
-
174
- /**
175
- * A Provider has the responsability to handle protocols and datablobs. Given a
176
- * data request (see {@link Provider#executeCommand} for details about this
177
- * request), it fetches serialized datasets, file content or even file chunks.
178
- *
179
- * @interface Provider
180
- */
181
-
182
- /**
183
- * When adding a layer to a view, some preprocessing can be done on it, before
184
- * fetching or creating resources attached to it. For example, in the WMTS and
185
- * WFS providers (included in iTowns), default options to the layer are added if
186
- * some are missing.
187
- *
188
- * @param {Layer} layer
189
- * @param {View} [view]
190
- * @param {Scheduler} [scheduler]
191
- * @param {Layer} [parentLayer]
192
- */
193
-
194
- /**
195
- * In the {@link Scheduler} loop, this function is called every time the layer
196
- * needs new information about itself. For tiled layers, it gets the necessary
197
- * tiles, given the current position of the camera on the map. For simple layers
198
- * like a GPX trace, it gets the data once.
199
- * <br><br>
200
- * It passes a `command` object as a parameter, with the `view` and the `layer`
201
- * always present. The other parameters are optional.
202
- *
203
- * @function
204
- * @name Provider#executeCommand
205
- *
206
- * @param {Object} command
207
- * @param {View} command.view
208
- * @param {Layer} command.layer
209
- * @param {TileMesh} [command.requester] - Every layer is attached to a tile.
210
- * @param {number} [command.targetLevel] - The target level is used when there
211
- * is a tiled layer, such as WMTS or TMS, but not in case like a GPX layer.
212
- *
213
- * @return {Promise} The {@link Scheduler} always expect a Promise as a result,
214
- * resolving to an object containing sufficient information for the associated
215
- * processing to the current layer. For example, see the
216
- * [LayeredMaterialNodeProcessing#updateLayeredMaterialNodeElevation]{@link
217
- * https://github.com/iTowns/itowns/blob/master/src/Process/LayeredMaterialNodeProcessing.js}
218
- * class or other processing class.
219
- */
220
-
221
- /**
222
- * Adds a provider for a specified protocol. The provider will be used when
223
- * executing the queue to provide resources. See {@link Provider} for more
224
- * informations.
225
- * By default, some protocols are already set in iTowns: WMTS, WMS, WFS, TMS,
226
- * XYZ, PotreeConverter, Rasterizer, 3D-Tiles and Static.
227
- * <br><br>
228
- * Warning: if the specified protocol has already a provider attached to it, the
229
- * current provider will be overwritten by the given provider.
230
- *
231
- * @param {string} protocol - The name of the protocol to add. This is the
232
- * `protocol` parameter put inside the configuration when adding a layer. The
233
- * capitalization of the name is not taken into account here.
234
- * @param {Provider} provider - The provider to link to the protocol, that must
235
- * respect the {@link Provider} interface description.
236
- *
237
- * @throws {Error} an error if any method of the {@link Provider} is not present
238
- * in the provider.
239
- */
240
- Scheduler.prototype.addProtocolProvider = function (protocol, provider) {
241
- if (typeof provider.executeCommand !== 'function') {
242
- throw new Error(`Can't add provider for ${protocol}: missing a executeCommand function.`);
243
- }
244
- this.providers[protocol] = provider;
245
- };
246
-
247
- /**
248
- * Get a specific {@link Provider} given a particular protocol.
249
- *
250
- * @param {string} protocol
251
- *
252
- * @return {Provider}
253
- */
254
- Scheduler.prototype.getProtocolProvider = function (protocol) {
255
- return this.providers[protocol] || DataSourceProvider;
256
- };
257
- Scheduler.prototype.commandsWaitingExecutionCount = function () {
258
- let sum = this.defaultQueue.counters.pending + this.defaultQueue.counters.executing;
259
- for (const q of this.hostQueues) {
260
- sum += q[1].counters.pending + q[1].counters.executing;
261
- }
262
- return sum;
263
- };
264
- Scheduler.prototype.commandsRunningCount = function () {
265
- let sum = this.defaultQueue.counters.executing;
266
- for (const q of this.hostQueues) {
267
- sum += q[1].counters.executing;
268
- }
269
- return sum;
270
- };
271
- Scheduler.prototype.resetCommandsCount = function (type) {
272
- let sum = this.defaultQueue.counters[type];
273
- this.defaultQueue.counters[type] = 0;
274
- for (const q of this.hostQueues) {
275
- sum += q[1].counters[type];
276
- q[1].counters[type] = 0;
277
- }
278
- return sum;
279
- };
280
- Scheduler.prototype.deQueue = function (queue) {
281
- const st = drawNextLayer(queue.storages);
282
- while (st && st.length > 0) {
283
- const cmd = st.dequeue();
284
- if (cmd.earlyDropFunction && cmd.earlyDropFunction(cmd)) {
285
- queue.counters.pending--;
286
- queue.counters.cancelled++;
287
- cmd.reject(new CancelledCommandException(cmd));
288
- } else {
289
- return cmd;
290
- }
291
- }
292
- return undefined;
293
- };
294
- export default Scheduler;