@openglobus/og 1.0.0-rc32 → 1.0.0-rc34

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 (37) hide show
  1. package/lib/Globe.d.ts +4 -0
  2. package/lib/assets/RgbTerrainWorker.worker-CEntGFYu.js.map +1 -0
  3. package/lib/control/DragAndDrop.d.ts +1 -0
  4. package/lib/control/depthCamera/DepthCamera.d.ts +2 -0
  5. package/lib/control/entityGizmo/EntityGizmo.d.ts +4 -3
  6. package/lib/control/entityGizmo/EntityGizmoScene.d.ts +13 -1
  7. package/lib/entity/EntityCollection.d.ts +13 -0
  8. package/lib/entity/pathTime.d.ts +2 -0
  9. package/lib/entity/polyline/Polyline.d.ts +32 -5
  10. package/lib/entity/polyline/PolylineBatchRenderer.d.ts +30 -6
  11. package/lib/entity/polyline/PolylineHandler.d.ts +22 -1
  12. package/lib/entity/ray/Ray.d.ts +7 -0
  13. package/lib/entity/ray/RayHandler.d.ts +4 -0
  14. package/lib/entity/strip/Strip.d.ts +34 -4
  15. package/lib/entity/strip/StripHandler.d.ts +21 -0
  16. package/lib/index.d.ts +1 -0
  17. package/lib/layer/BaseTileMaterialLayer.d.ts +1 -0
  18. package/lib/layer/GeoTIFFLayer.d.ts +8 -0
  19. package/lib/layer/Vector.d.ts +13 -0
  20. package/lib/layer/geotiff/GeoTIFFReader.d.ts +2 -0
  21. package/lib/layer/geotiff/MultiGeoTIFFReader.d.ts +2 -0
  22. package/lib/layer/geotiff/types.d.ts +3 -2
  23. package/lib/layer/geotiff/utm.d.ts +1 -1
  24. package/lib/og.es.js +1 -1
  25. package/lib/og.es.js.map +1 -1
  26. package/lib/proj/epsgIo.d.ts +5 -0
  27. package/lib/proj/proj4.d.ts +1 -0
  28. package/lib/quadTree/EntityCollectionNode.d.ts +2 -0
  29. package/lib/renderer/cascadeShadows/CascadeShadowMap.d.ts +2 -0
  30. package/lib/shaders/polyline/polyline.d.ts +4 -0
  31. package/lib/shaders/strip/strip.d.ts +2 -0
  32. package/lib/terrain/GlobusTerrain.d.ts +7 -0
  33. package/lib/terrain/RgbTerrain.d.ts +25 -3
  34. package/lib/terrain/rgbTerrainGrid.d.ts +81 -0
  35. package/lib/utils/RgbTerrainWorker.d.ts +21 -0
  36. package/lib/utils/RgbTerrainWorker.worker.d.ts +1 -0
  37. package/package.json +5 -3
package/lib/Globe.d.ts CHANGED
@@ -43,6 +43,7 @@ export interface IGlobeParams {
43
43
  sun?: {
44
44
  active?: boolean;
45
45
  stopped?: boolean;
46
+ dateTime?: Date | null;
46
47
  localDateTime?: Date | null;
47
48
  useTimeZones?: boolean;
48
49
  };
@@ -109,6 +110,9 @@ export interface IGlobeParams {
109
110
  * @param {string} [options.name] - Planet name. Default is uniq identifier.
110
111
  * @param {EmptyTerrain | Array.<EmptyTerrain>} [options.terrain] - Terrain provider or providers array, where the first one becomes active. Default no terrain - og.terrain.EmptyTerrain.
111
112
  * @param {Array.<Control>} [options.controls] - Controls.
113
+ * @param {Object} [options.sun] - Sun control options.
114
+ * @param {Date|null} [options.sun.dateTime] - Fixed UTC time.
115
+ * @param {Date|null} [options.sun.localDateTime] - Local time. Overrides dateTime if provided; null resets fixed lighting.
112
116
  * @param {Array.<Layer>} [options.layers] - Planet layers.
113
117
  * @param {Extent | ExtentBoundingBox} [options.viewExtent] [options.viewExtent] - Viewable starting extent.
114
118
  * @param {boolean} [options.autoActivate=true] - Globe rendering auto activation flag. True is default.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RgbTerrainWorker.worker-CEntGFYu.js","names":[],"sources":["../../src/terrain/rgbTerrainGrid.ts","../../src/utils/RgbTerrainWorker.worker.js"],"sourcesContent":["import type { TypedArray } from \"../utils/shared\";\n\nexport const RGB_ENCODING_CUSTOM = -1;\nexport const RGB_ENCODING_RGB = 0;\nexport const RGB_ENCODING_TERRARIUM = 1;\n\n/** Writes a row of pixel heights, NaN for no data pixels. */\nexport type DecodeHeightsRowFunc = (row: number, outHeights: Float32Array) => void;\n\nexport interface IRgbDecodeParams {\n encoding: number;\n minHeight: number;\n resolution: number;\n heightFactor: number;\n noDataValues: number[] | TypedArray;\n parentData: number[] | TypedArray | null;\n parentOffsetX: number;\n parentOffsetY: number;\n parentZoomDiff: number;\n skipPositiveHeights: boolean;\n}\n\nexport interface IRgbHeightsParams {\n decode: IRgbDecodeParams;\n size: number;\n gridSize: number;\n levels: number;\n noDataHeight: number;\n}\n\nconst PARAMS_ID = 0,\n PARAMS_SIZE = 1,\n PARAMS_GRID_SIZE = 2,\n PARAMS_LEVELS = 3,\n PARAMS_ENCODING = 4,\n PARAMS_MIN_HEIGHT = 5,\n PARAMS_RESOLUTION = 6,\n PARAMS_HEIGHT_FACTOR = 7,\n PARAMS_PARENT_OFFSET_X = 8,\n PARAMS_PARENT_OFFSET_Y = 9,\n PARAMS_PARENT_ZOOM_DIFF = 10,\n PARAMS_SKIP_POSITIVE_HEIGHTS = 11,\n PARAMS_NO_DATA_HEIGHT = 12,\n PARAMS_NO_DATA_VALUES = 13;\n\n/**\n * Packs heights parameters to the buffer for the worker message.\n * @param {number} id - Worker task id.\n * @param {IRgbHeightsParams} p - Heights parameters, parent data is sent separately.\n * @returns {Float64Array} -\n */\nexport function packRgbHeightsParams(id: number, p: IRgbHeightsParams): Float64Array {\n let d = p.decode,\n ndv = d.noDataValues;\n let params = new Float64Array(PARAMS_NO_DATA_VALUES + ndv.length);\n\n params[PARAMS_ID] = id;\n params[PARAMS_SIZE] = p.size;\n params[PARAMS_GRID_SIZE] = p.gridSize;\n params[PARAMS_LEVELS] = p.levels;\n params[PARAMS_ENCODING] = d.encoding;\n params[PARAMS_MIN_HEIGHT] = d.minHeight;\n params[PARAMS_RESOLUTION] = d.resolution;\n params[PARAMS_HEIGHT_FACTOR] = d.heightFactor;\n params[PARAMS_PARENT_OFFSET_X] = d.parentOffsetX;\n params[PARAMS_PARENT_OFFSET_Y] = d.parentOffsetY;\n params[PARAMS_PARENT_ZOOM_DIFF] = d.parentZoomDiff;\n params[PARAMS_SKIP_POSITIVE_HEIGHTS] = d.skipPositiveHeights ? 1 : 0;\n params[PARAMS_NO_DATA_HEIGHT] = p.noDataHeight;\n\n for (let i = 0; i < ndv.length; i++) {\n params[PARAMS_NO_DATA_VALUES + i] = ndv[i];\n }\n return params;\n}\n\n/**\n * Unpacks heights parameters from the worker message buffer.\n * @param {Float64Array} params - Packed parameters.\n * @param {Float32Array | null} parentData - Parent segment elevations.\n * @returns {Array} - Task id and parameters (exactly 2 entries).\n */\nexport function unpackRgbHeightsParams(\n params: Float64Array,\n parentData: Float32Array | null\n): [number, IRgbHeightsParams] {\n return [\n params[PARAMS_ID],\n {\n decode: {\n encoding: params[PARAMS_ENCODING],\n minHeight: params[PARAMS_MIN_HEIGHT],\n resolution: params[PARAMS_RESOLUTION],\n heightFactor: params[PARAMS_HEIGHT_FACTOR],\n noDataValues: params.subarray(PARAMS_NO_DATA_VALUES),\n parentData: parentData,\n parentOffsetX: params[PARAMS_PARENT_OFFSET_X],\n parentOffsetY: params[PARAMS_PARENT_OFFSET_Y],\n parentZoomDiff: params[PARAMS_PARENT_ZOOM_DIFF],\n skipPositiveHeights: params[PARAMS_SKIP_POSITIVE_HEIGHTS] === 1\n },\n size: params[PARAMS_SIZE],\n gridSize: params[PARAMS_GRID_SIZE],\n levels: params[PARAMS_LEVELS],\n noDataHeight: params[PARAMS_NO_DATA_HEIGHT]\n }\n ];\n}\n\n/**\n * Returns vertex grid cells for the image size, 2^n and (2^n + 1) sizes only.\n * @param {number} size - Image size.\n * @returns {number} -\n */\nexport function getGridCells(size: number): number {\n return (size & (size - 1)) === 0 ? size : size - 1;\n}\n\nfunction isNoDataValue(noDataValues: number[] | TypedArray, ndMin: number, ndMax: number, h: number): boolean {\n if (h > 50000) {\n return true;\n }\n if (h <= ndMin || h >= ndMax) {\n return false;\n }\n let start = 0,\n end = noDataValues.length - 1;\n while (start <= end) {\n let k = (start + end) >> 1;\n if (Math.abs(noDataValues[k] - h) < 1e-3) {\n return true;\n } else if (noDataValues[k] < h) {\n start = k + 1;\n } else {\n end = k - 1;\n }\n }\n return false;\n}\n\nexport function getParentHeight(\n oneByDz2: number,\n offsetX: number,\n offsetY: number,\n heights: TypedArray | number[],\n i: number,\n j: number,\n skipPositiveHeights?: boolean\n) {\n let parentGridSize = Math.sqrt(heights.length);\n let pi = Math.floor(offsetY * oneByDz2 * parentGridSize + i * oneByDz2),\n pj = Math.floor(offsetX * oneByDz2 * parentGridSize + j * oneByDz2);\n let h = heights[pi * parentGridSize + pj];\n return skipPositiveHeights ? (h > 0 ? 0 : h) : h;\n}\n\n/**\n * Decodes \"rgb\" or \"terrarium\" encoded pixel row heights.\n * @param {number[] | TypedArray} rgbaData - Image RGBA data.\n * @param {number} row - Pixel row.\n * @param {number} size - Image size.\n * @param {number} parentScale - Parent grid cells by image grid cells.\n * @param {IRgbDecodeParams} p - Decode parameters.\n * @param {Float32Array} outHeights - Row heights.\n * @param {number} noDataHeight - Height for no data pixels.\n */\nexport function decodeRgbHeightsRow(\n rgbaData: number[] | TypedArray,\n row: number,\n size: number,\n parentScale: number,\n p: IRgbDecodeParams,\n outHeights: Float32Array,\n noDataHeight: number\n) {\n let ndv = p.noDataValues,\n ndMin = ndv.length ? ndv[0] - 1e-3 : 0,\n ndMax = ndv.length ? ndv[ndv.length - 1] + 1e-3 : 0;\n\n let isTerrarium = p.encoding === RGB_ENCODING_TERRARIUM,\n minHeight = p.minHeight,\n resolution = p.resolution,\n heightFactor = p.heightFactor,\n parentData = p.parentData;\n\n let pi = Math.floor(row * parentScale);\n\n for (let j = 0, k4 = row * size * 4; j < size; j++, k4 += 4) {\n let r = rgbaData[k4],\n g = rgbaData[k4 + 1],\n b = rgbaData[k4 + 2];\n\n let height = isTerrarium\n ? r * 256 + g + b / 256 - 32768\n : r === 255\n ? minHeight\n : minHeight + resolution * (r * 65536 + g * 256 + b);\n\n height *= heightFactor;\n\n let isNoData = isNoDataValue(ndv, ndMin, ndMax, height);\n\n if ((isNoData || height === 0) && parentData) {\n height = getParentHeight(\n p.parentZoomDiff,\n p.parentOffsetX,\n p.parentOffsetY,\n parentData,\n pi,\n Math.floor(j * parentScale),\n p.skipPositiveHeights\n );\n isNoData = isNoDataValue(ndv, ndMin, ndMax, height);\n }\n\n outHeights[j] = isNoData ? noDataHeight : height;\n }\n}\n\n/**\n * Converts size x size pixel heights to (size + 1) x (size + 1) vertex grid in pixel corners.\n * @param {number} size - Image size.\n * @param {DecodeHeightsRowFunc} decodeRow - Decodes pixel row heights, NaN for no data.\n * @param {number} noDataHeight - Height for vertices without data around.\n * @returns {Float32Array} -\n */\nexport function createVertexGrid(size: number, decodeRow: DecodeHeightsRowFunc, noDataHeight: number): Float32Array {\n let gs = size + 1;\n\n // Per-axis taps for vertex v: two pixel indices with interpolation weights, and the nearest pixels.\n let i0 = new Int32Array(gs),\n i1 = new Int32Array(gs),\n w0 = new Float32Array(gs),\n w1 = new Float32Array(gs),\n n0 = new Int32Array(gs),\n n1 = new Int32Array(gs);\n\n for (let v = 0; v < gs; v++) {\n if (v === 0) {\n i0[v] = 0;\n i1[v] = 1;\n w0[v] = 1.5;\n w1[v] = -0.5;\n n0[v] = n1[v] = 0;\n } else if (v === size) {\n i0[v] = size - 1;\n i1[v] = size - 2;\n w0[v] = 1.5;\n w1[v] = -0.5;\n n0[v] = n1[v] = size - 1;\n } else {\n i0[v] = n0[v] = v - 1;\n i1[v] = n1[v] = v;\n w0[v] = w1[v] = 0.5;\n }\n }\n\n // Pixel row r is kept at (r & 1) * size\n let heights = new Float32Array(size * 2),\n rowHeights = [heights.subarray(0, size), heights.subarray(size)],\n lastRow = -1;\n\n let out = new Float32Array(gs * gs);\n\n for (let vi = 0; vi < gs; vi++) {\n let needRow = vi === 0 ? 1 : Math.min(vi, size - 1);\n while (lastRow < needRow) {\n lastRow++;\n decodeRow(lastRow, rowHeights[lastRow & 1]);\n }\n\n let r0 = (i0[vi] & 1) * size,\n r1 = (i1[vi] & 1) * size,\n wr0 = w0[vi],\n wr1 = w1[vi],\n nr0 = (n0[vi] & 1) * size,\n nr1 = (n1[vi] & 1) * size;\n\n for (let vj = 0; vj < gs; vj++) {\n let c0 = i0[vj],\n c1 = i1[vj];\n\n let h =\n wr0 * (w0[vj] * heights[r0 + c0] + w1[vj] * heights[r0 + c1]) +\n wr1 * (w0[vj] * heights[r1 + c0] + w1[vj] * heights[r1 + c1]);\n\n // NaN means at least one tap has no data\n if (h === h) {\n out[vi * gs + vj] = h;\n } else {\n let h00 = heights[nr0 + n0[vj]],\n h01 = heights[nr0 + n1[vj]],\n h10 = heights[nr1 + n0[vj]],\n h11 = heights[nr1 + n1[vj]];\n\n let sum = 0,\n count = 0;\n\n if (h00 === h00) {\n sum += h00;\n count++;\n }\n if (h01 === h01) {\n sum += h01;\n count++;\n }\n if (h10 === h10) {\n sum += h10;\n count++;\n }\n if (h11 === h11) {\n sum += h11;\n count++;\n }\n\n out[vi * gs + vj] = count ? sum / count : noDataHeight;\n }\n }\n }\n\n return out;\n}\n\n/**\n * Takes (gridSize + 1) x (gridSize + 1) vertices of the cells x cells square starting at\n * the row0, col0 vertex of the (size + 1) x (size + 1) grid. Cells must be gridSize multiplied by a power of two.\n */\nexport function sampleSubGrid(\n grid: Float32Array,\n size: number,\n row0: number,\n col0: number,\n cells: number,\n gridSize: number,\n out: Float32Array = new Float32Array((gridSize + 1) * (gridSize + 1)),\n outOffset: number = 0\n): Float32Array {\n let gs = size + 1,\n outGs = gridSize + 1,\n step = cells / gridSize;\n\n for (let i = 0; i < outGs; i++) {\n let src = (row0 + i * step) * gs + col0,\n dst = outOffset + i * outGs;\n for (let j = 0; j < outGs; j++) {\n out[dst + j] = grid[src + j * step];\n }\n }\n\n return out;\n}\n\n/**\n * Creates the tile heights grid and its subdivision levels, each tile is (gridSize + 1) x (gridSize + 1).\n * Output order is the tile itself, then 2x2 tiles of the first level, 4x4 of the second and so on, row by row.\n * @param {number} size - Image size, 2^n or (2^n + 1).\n * @param {number} gridSize - Tile grid size.\n * @param {number} levels - Subdivision levels.\n * @param {DecodeHeightsRowFunc} decodeRow - Decodes pixel row heights, NaN for no data.\n * @param {number} noDataHeight - Height for vertices without data.\n * @returns {Float32Array} -\n */\nexport function createHeightsLevels(\n size: number,\n gridSize: number,\n levels: number,\n decodeRow: DecodeHeightsRowFunc,\n noDataHeight: number\n): Float32Array {\n let cells = getGridCells(size);\n\n let grid: Float32Array;\n\n if (cells === size) {\n grid = createVertexGrid(size, decodeRow, noDataHeight);\n } else {\n grid = new Float32Array(size * size);\n for (let row = 0; row < size; row++) {\n let rowHeights = grid.subarray(row * size, (row + 1) * size);\n decodeRow(row, rowHeights);\n for (let j = 0; j < size; j++) {\n if (rowHeights[j] !== rowHeights[j]) {\n rowHeights[j] = noDataHeight;\n }\n }\n }\n }\n\n let tileLength = (gridSize + 1) * (gridSize + 1),\n tilesCount = 0;\n\n for (let k = 0; k <= levels; k++) {\n tilesCount += 1 << (2 * k);\n }\n\n let out = new Float32Array(tilesCount * tileLength);\n\n for (let k = 0, c = cells, offset = 0; k <= levels; k++, c >>= 1) {\n let d = 1 << k;\n for (let i = 0; i < d; i++) {\n for (let j = 0; j < d; j++) {\n sampleSubGrid(grid, cells, i * c, j * c, c, gridSize, out, offset);\n offset += tileLength;\n }\n }\n }\n\n return out;\n}\n","\"use strict\";\n//\n// RGB terrain heights worker\n//\nimport {\n createHeightsLevels,\n decodeRgbHeightsRow,\n getGridCells,\n unpackRgbHeightsParams\n} from \"../terrain/rgbTerrainGrid\";\n\nlet ctx = null;\n\nfunction getImageData(bitmap, size) {\n if (!ctx || ctx.canvas.width !== size) {\n ctx = new OffscreenCanvas(size, size).getContext(\"2d\", {\n willReadFrequently: true\n });\n }\n\n ctx.clearRect(0, 0, size, size);\n ctx.drawImage(bitmap, 0, 0);\n\n return ctx.getImageData(0, 0, size, size).data;\n}\n\nself.onmessage = function (e) {\n const [id, p] = unpackRgbHeightsParams(e.data.params, e.data.parentData);\n const bitmap = e.data.bitmap;\n\n let heights = null;\n\n try {\n const rgbaData = getImageData(bitmap, p.size);\n const parentScale = p.gridSize / getGridCells(p.size);\n\n heights = createHeightsLevels(\n p.size,\n p.gridSize,\n p.levels,\n (row, outHeights) => decodeRgbHeightsRow(rgbaData, row, p.size, parentScale, p.decode, outHeights, NaN),\n p.noDataHeight\n );\n } catch (err) {\n console.error(err);\n }\n\n bitmap.close();\n\n self.postMessage(\n {\n id: id,\n heights: heights\n },\n heights ? [heights.buffer] : []\n );\n};\n"],"mappings":"yBAkHA,SAAgB,EAAa,EAAA,CACzB,OAAQ,EAAQ,EAAO,EAAmB,EAAO,EAAd,CACvC,CAEA,SAAS,EAAc,EAAqC,EAAe,EAAe,EAAA,CACtF,GAAI,EAAI,IACJ,MAAA,CAAO,EAEX,GAAI,GAAK,GAAS,GAAK,EACnB,MAAA,CAAO,EAEX,IAAI,EAAQ,EACR,EAAM,EAAa,OAAS,EAChC,KAAO,GAAS,GAAK,CACjB,IAAI,EAAK,EAAQ,GAAQ,EACzB,GAAI,KAAK,IAAI,EAAa,GAAK,CAAA,EAAK,KAChC,MAAA,CAAO,EACA,EAAa,GAAK,EACzB,EAAQ,EAAI,EAEZ,EAAM,EAAI,CAElB,CACA,MAAA,CAAO,CACX,CAEA,SAAgB,EACZ,EACA,EACA,EACA,EACA,EACA,EACA,EAAA,CAEA,IAAI,EAAiB,KAAK,KAAK,EAAQ,MAAA,EAGnC,EAAI,EAFC,KAAK,MAAM,EAAU,EAAW,EAAiB,EAAI,CAAA,EAEzC,EADZ,KAAK,MAAM,EAAU,EAAW,EAAiB,EAAI,CAAA,GAE9D,OAAO,GAAuB,EAAI,EAAI,EAAS,CACnD,CA6KA,SAAgB,EACZ,EACA,EACA,EACA,EACA,EACA,EACA,EAAoB,IAAI,cAAc,EAAW,IAAM,EAAW,EAAA,EAClE,EAAoB,EAAA,CAEpB,IAAI,EAAK,EAAO,EACZ,EAAQ,EAAW,EACnB,EAAO,EAAQ,EAEnB,IAAK,IAAI,EAAI,EAAG,E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AAA,EAAA,CAAA"}
@@ -33,5 +33,6 @@ export declare class DragAndDrop extends Control {
33
33
  protected _addObj(file: File, lonLat: LonLat, mtlFile?: File | null): Promise<void>;
34
34
  protected _selectEntity(entity: Entity): void;
35
35
  protected _addBillboard(file: File, lonLat: LonLat): Promise<void>;
36
+ protected _createTiffLayer(file: File): GeoTIFFLayer;
36
37
  protected _addTiff(file: File): Promise<void>;
37
38
  }
@@ -7,6 +7,7 @@ import { Vec4, type NumberArray4 } from "../../math/Vec4";
7
7
  import { QuadTreeStrategy } from "../../quadTree";
8
8
  import type { Renderer } from "../../renderer/Renderer";
9
9
  import type { Planet } from "../../scene/Planet";
10
+ import type { EmptyTerrain } from "../../terrain/EmptyTerrain";
10
11
  import { Framebuffer } from "../../webgl";
11
12
  import { Vector } from "../../layer/Vector";
12
13
  import type { ShadowMap } from "../../renderer/shadows/ShadowMap";
@@ -65,6 +66,7 @@ export declare class DepthCamera {
65
66
  protected _isOrthographic: boolean;
66
67
  protected _focusDistance: number;
67
68
  protected _lastPlanetHeightFactor: number;
69
+ protected _lastPlanetTerrain: EmptyTerrain | null;
68
70
  protected _orthoTexelSizeX: number;
69
71
  protected _orthoTexelSizeY: number;
70
72
  protected _frustumLength: number;
@@ -20,12 +20,13 @@ type EntityGizmoEventsList = [
20
20
  * @class
21
21
  * @extends {Control}
22
22
  * @param {IEntityGizmoParams} [options] - Gizmo options:
23
- * @param {GizmoTools} [options.tools] - Gizmo tool set, i.e. which handles are shown. `translate`
23
+ * @param {GizmoTools} [options.tools] - Gizmo tool set, i.e., which handles are shown. `translate`
24
24
  * shows move axes and planes only, `full` adds rotation rings. Orthogonal to `editMode`.
25
25
  * @param {EditModeName} [options.editMode] - Rotation mode. `native` rotates in the entity's own
26
26
  * frame, `yaw` rotates in the local horizon frame. Affects the rotation rings only, so it does
27
27
  * nothing with `tools: "translate"`.
28
- * @param {boolean} [options.autoSelect] - When `false`, a left click on a map entity does not
28
+ * @param {boolean} [options.autoSelect] - When `true`, a left click on a map entity selects it and
29
+ * a left click anywhere else drops the selection. When `false`, clicks do not
29
30
  * change the gizmo selection, so the host application stays the only source of the selection.
30
31
  * Default is `true`.
31
32
  */
@@ -50,7 +51,7 @@ export declare class EntityGizmo extends Control {
50
51
  get editMode(): EditModeName;
51
52
  set editMode(editMode: EditModeName);
52
53
  /**
53
- * When `false`, a left click on a map entity does not change the gizmo selection.
54
+ * When `false`, a left click neither selects a map entity nor drops the current selection.
54
55
  * @public
55
56
  */
56
57
  get autoSelect(): boolean;
@@ -133,7 +133,9 @@ declare class EntityGizmoScene extends Scene {
133
133
  /** Gizmo tool set: which handles are shown. */
134
134
  get tools(): GizmoTools;
135
135
  set tools(tools: GizmoTools);
136
- /** When `false`, a left click on a map entity does not change the gizmo selection. */
136
+ /**
137
+ * When `false`, a left click neither selects a map entity nor drops the current selection.
138
+ */
137
139
  get autoSelect(): boolean;
138
140
  set autoSelect(autoSelect: boolean);
139
141
  protected get _rotateEnabled(): boolean;
@@ -170,6 +172,16 @@ declare class EntityGizmoScene extends Scene {
170
172
  readyToEdit(entity: Entity): boolean;
171
173
  select(entity: Entity): void;
172
174
  unselect(): void;
175
+ /**
176
+ * Returns `true` when the entity is one of the gizmo handles.
177
+ * @protected
178
+ */
179
+ protected _isGizmoEntity(entity: Entity): boolean;
180
+ /**
181
+ * `lclick` fires on the left button release without dragging, so dropping the selection
182
+ * here does not interfere with the map navigation.
183
+ * @protected
184
+ */
173
185
  protected _onLclick: (e: IMouseState) => void;
174
186
  clear(): void;
175
187
  protected _onForwardpass: () => void;
@@ -252,6 +252,19 @@ declare class EntityCollection {
252
252
  * @public
253
253
  */
254
254
  requestRedraw(): void;
255
+ /**
256
+ * Sets the current time of polylines and strips with path times.
257
+ * @public
258
+ * @param {number} time - Time in the same units as the path times.
259
+ */
260
+ setTime(time: number): void;
261
+ /**
262
+ * Sets opacity multipliers of the path parts passed and ahead of the current time.
263
+ * @public
264
+ * @param {number} past - Multiplier up to the current time.
265
+ * @param {number} future - Multiplier after the current time.
266
+ */
267
+ setTimeOpacity(past: number, future: number): void;
255
268
  /**
256
269
  * Returns collection visibility.
257
270
  * @public
@@ -0,0 +1,2 @@
1
+ export declare const PATH_TIME_SPLIT = 1048576;
2
+ export declare function splitPathTime(time: number): [number, number];
@@ -30,6 +30,7 @@ export interface IPolylineParams {
30
30
  visibility?: boolean;
31
31
  isClosed?: boolean;
32
32
  pathColors?: SegmentPathColor[];
33
+ pathTimes?: number[][];
33
34
  path3v?: SegmentPath3vExt[];
34
35
  pathLonLat?: SegmentPathLonLatExt[];
35
36
  src?: StrokeSource;
@@ -48,6 +49,8 @@ export interface IPolylineParams {
48
49
  * @param {SegmentPathLonLatExt[]} [options.pathLonLat] - Polyline geodetic coordinates array. [[[0,0,0], [1,1,1],...]]
49
50
  * @param {SegmentPath3vExt[]} [options.path3v] - LinesString cartesian coordinates array. [[[0,0,0], [1,1,1],...]]
50
51
  * @param {SegmentPathColor[]} [options.pathColors] - Coordinates color. [[[1,0,0,1], [0,1,0,1],...]] for right and green colors.
52
+ * @param {number[][]} [options.pathTimes] - Time of every point, per segment. Makes the line follow the
53
+ * entity collection time, see {@link EntityCollection#setTime} and {@link EntityCollection#setTimeOpacity}.
51
54
  * @param {TexParam} [options.texParams] - Texture params for all segments: texOffset, strokeSize and texOffsetSpeed.
52
55
  */
53
56
  declare class Polyline {
@@ -62,6 +65,7 @@ declare class Polyline {
62
65
  _path3v: SegmentPath3vExt[];
63
66
  protected _pathLonLat: SegmentPathLonLatExt[];
64
67
  protected _pathColors: SegmentPathColor[];
68
+ protected _pathTimes: number[][] | null;
65
69
  protected _color: string[];
66
70
  protected _segmentTexParams: Partial<TexParam> | null;
67
71
  protected _src: StrokeSource;
@@ -79,6 +83,10 @@ declare class Polyline {
79
83
  get altitude(): number;
80
84
  _addToBatchRenderer(): void;
81
85
  _removeFromBatchRenderer(): void;
86
+ protected _batchIndex(segmentIndex: number): number;
87
+ protected _forEachBatchPath(callback: (batchIndex: number, segmentIndex: number) => void): void;
88
+ protected _removeBatchPath(segmentIndex: number): void;
89
+ protected _hasSameBatchPaths(paths: SegmentPath3vExt[] | SegmentPathLonLatExt[]): boolean;
82
90
  protected _getDefaultHtmlColor(segmentIndex?: number): string | undefined;
83
91
  protected _getDefaultPathColor(segmentIndex?: number): NumberArray4 | undefined;
84
92
  protected _applySegmentProps(batchIndex: number, segmentIndex?: number): void;
@@ -125,24 +133,27 @@ declare class Polyline {
125
133
  * @param {number} [index=0] - Index in the path
126
134
  * @param {NumberArray4} [color] - Point color
127
135
  * @param {number} [segmentIndex=0] - Path segment index
136
+ * @param {number} [time] - Point time
128
137
  */
129
- insertPoint3v(point3v: Vec3, index?: number, color?: NumberArray4, segmentIndex?: number): void;
138
+ insertPoint3v(point3v: Vec3, index?: number, color?: NumberArray4, segmentIndex?: number, time?: number): void;
130
139
  /**
131
140
  * Append new point in the end of the path.
132
141
  * @public
133
142
  * @param {Vec3} point3v - New point coordinates.
134
143
  * @param {number} [segmentIndex=0] - Path segment index, first by default.
135
144
  * @param {NumberArray4} [color] - Point color
145
+ * @param {number} [time] - Point time
136
146
  */
137
- addPoint3v(point3v: Vec3, segmentIndex?: number, color?: NumberArray4): void;
147
+ addPoint3v(point3v: Vec3, segmentIndex?: number, color?: NumberArray4, time?: number): void;
138
148
  /**
139
149
  * Append new geodetic point in the end of the path.
140
150
  * @public
141
151
  * @param {LonLat} lonLat - New coordinate.
142
152
  * @param {number} [segmentIndex=0] - Path segment index, first by default.
143
153
  * @param {NumberArray4} [color] - Point color.
154
+ * @param {number} [time] - Point time.
144
155
  */
145
- addPointLonLat(lonLat: LonLat, segmentIndex?: number, color?: NumberArray4): void;
156
+ addPointLonLat(lonLat: LonLat, segmentIndex?: number, color?: NumberArray4, time?: number): void;
146
157
  /**
147
158
  * Change path point color
148
159
  * @param {NumberArray4} color - New color
@@ -155,8 +166,8 @@ declare class Polyline {
155
166
  * @param {number} index - Segment index in multiline
156
167
  */
157
168
  removePath(index: number): void;
158
- appendPath3v(path3v: SegmentPath3vExt, pathColors?: NumberArray4[]): void;
159
- appendPathLonLat(pathLonLat: SegmentPathLonLatExt): void;
169
+ appendPath3v(path3v: SegmentPath3vExt, pathColors?: NumberArray4[], pathTimes?: number[]): void;
170
+ appendPathLonLat(pathLonLat: SegmentPathLonLatExt, pathColors?: NumberArray4[], pathTimes?: number[]): void;
160
171
  setPathLonLatFast(pathLonLat: SegmentPathLonLatExt[], pathColors?: (SegmentPathColor | NumberArray4)[] | SegmentPathColor | NumberArray4): void;
161
172
  setPath3vFast(path3v: SegmentPath3vExt[], pathColors?: (SegmentPathColor | NumberArray4)[] | SegmentPathColor | NumberArray4): void;
162
173
  /**
@@ -177,6 +188,22 @@ declare class Polyline {
177
188
  */
178
189
  setPathLonLat(pathLonLat: SegmentPathLonLatExt[], pathColors?: (SegmentPathColor | NumberArray4)[], forceEqual?: boolean): void;
179
190
  setPathLonLat(pathLonLat: SegmentPathLonLatExt, pathColors?: SegmentPathColor | NumberArray4, forceEqual?: boolean, segmentIndex?: number): void;
191
+ protected _pushPointTime(segmentIndex: number, index: number, time?: number): void;
192
+ /**
193
+ * Returns true when the polyline has point times and follows the entity collection time.
194
+ * @public
195
+ * @returns {boolean}
196
+ */
197
+ isTimed(): boolean;
198
+ getPathTimes(): number[][] | null;
199
+ /**
200
+ * Sets point times. Null removes them and the line stops following the entity collection time.
201
+ * @public
202
+ * @param {number[][] | number[] | null} times - Times per segment, or times of one segment.
203
+ * @param {number} [segmentIndex] - Segment index when times of one segment are given.
204
+ */
205
+ setPathTimes(pathTimes: number[][] | null): void;
206
+ setPathTimes(times: number[], segmentIndex: number): void;
180
207
  /**
181
208
  * Sets polyline opacity.
182
209
  * @public
@@ -29,6 +29,7 @@ export interface IPolylineBatchRendererParams {
29
29
  color?: string[];
30
30
  visibility?: boolean;
31
31
  isTextured?: boolean;
32
+ isTimed?: boolean;
32
33
  isClosed?: boolean[];
33
34
  pathColors?: SegmentPathColor[];
34
35
  path3v?: SegmentPath3vExt[];
@@ -126,6 +127,10 @@ declare class PolylineBatchRenderer {
126
127
  protected _pathPhaseBuffer: WebGLBufferExt | null;
127
128
  protected _boundingSphereBuffer: WebGLBufferExt | null;
128
129
  protected _pickingColorsBuffer: WebGLBufferExt | null;
130
+ isTimed: boolean;
131
+ protected _pathTimes: (number[] | undefined)[];
132
+ protected _timesArr: TypedArray | number[];
133
+ protected _timesBuffer: WebGLBufferExt | null;
129
134
  protected _scene: Scene | null;
130
135
  /**
131
136
  * Entity instance that holds this Polyline.
@@ -203,6 +208,17 @@ declare class PolylineBatchRenderer {
203
208
  protected _updateTextureMetrics(segmentIndex: number): void;
204
209
  protected _updateAllTextureMetrics(): void;
205
210
  protected _updateTextureMetricsAfterPointChange(segmentIndex: number): void;
211
+ protected _pushPointTime(segmentIndex: number, index: number, time?: number): void;
212
+ protected _resolveTimeAt(segmentIndex: number, index: number): number;
213
+ protected _resolveSegmentTimes(segmentIndex: number, count: number): number[];
214
+ /**
215
+ * Sets point times of a path segment, used by the time opacity of timed renderers.
216
+ * @public
217
+ * @param {number[]} times - Time per point, missing values repeat the previous one.
218
+ * @param {number} segmentIndex - Path segment index.
219
+ */
220
+ setPathTimes(times: number[] | undefined, segmentIndex: number): void;
221
+ getPathTimes(): (number[] | undefined)[];
206
222
  protected _markGeometryBuffersChanged(includeTexCoords: boolean): void;
207
223
  protected _applyForceEqualSegmentUpdate<TSegment extends any[]>(segmentPath: TSegment, segmentIndex: number, pathColors: SegmentPathColor | NumberArray4 | undefined, currentPaths: TSegment[], equalUpdate: (segmentPath: TSegment, segmentIndex: number, pathColors?: SegmentPathColor | NumberArray4) => void, recreateData: (nextPaths: TSegment[]) => void, includeTexCoords: boolean): boolean;
208
224
  protected __appendLineDataCore(pathInput: SegmentPath3vExt[] | SegmentPathLonLatExt[], pathColors: SegmentPathColor[], pathPickingColors: NumberArray3[][], defaultColor: NumberArray4, opacity: number[], pathClosed: boolean[], outVerticesHigh: number[], outVerticesLow: number[], outOrders: number[], outIndexes: number[], outTexCoords: number[], ellipsoid: Ellipsoid | null, outPath3v: SegmentPath3vExt[], outPathLonLat: SegmentPathLonLatExt[], outPathMerc: LonLat[][], outExtent: Extent, outColors: number[], outThickness: number[], outTexParams: number[], outBoundingSpheres: number[], outPickingColors: number[], sourceType: LineSourceMode, segmentOffset?: number, indexFormat?: IndexFormatMode, skipTexCoords?: boolean, resetExtent?: boolean): void;
@@ -256,8 +272,8 @@ declare class PolylineBatchRenderer {
256
272
  * @param {number} index - Segment index in multiline
257
273
  */
258
274
  removePath(index: number): void;
259
- appendPath3v(path3v: SegmentPath3vExt, pathColors?: NumberArray4[], opacity?: number): void;
260
- appendPathLonLat(pathLonLat: SegmentPathLonLatExt, pathColors?: NumberArray4[], opacity?: number): void;
275
+ appendPath3v(path3v: SegmentPath3vExt, pathColors?: NumberArray4[], opacity?: number, pathTimes?: number[]): void;
276
+ appendPathLonLat(pathLonLat: SegmentPathLonLatExt, pathColors?: NumberArray4[], opacity?: number, pathTimes?: number[]): void;
261
277
  /**
262
278
  * Remove point from the path
263
279
  * @param {number} index - Point index in a path segment
@@ -270,8 +286,9 @@ declare class PolylineBatchRenderer {
270
286
  * @param {number} [index=0] - Index in the path
271
287
  * @param {NumberArray4} [color] - Point color
272
288
  * @param {number} [segmentIndex=0] - Path segment index
289
+ * @param {number} [time] - Point time
273
290
  */
274
- insertPoint3v(point3v: Vec3, index?: number, color?: NumberArray4, segmentIndex?: number): void;
291
+ insertPoint3v(point3v: Vec3, index?: number, color?: NumberArray4, segmentIndex?: number, time?: number): void;
275
292
  /**
276
293
  * Append new point in the end of the path.
277
294
  * @public
@@ -279,17 +296,18 @@ declare class PolylineBatchRenderer {
279
296
  * @param {number} [segmentIndex=0] - Path segment index, first by default.
280
297
  * @param {NumberArray4} [color] - Point color.
281
298
  * @param {number} [opacity=1] - Point opacity.
299
+ * @param {number} [time] - Point time.
282
300
  */
283
- addPoint3v(point3v: Vec3, segmentIndex?: number, color?: NumberArray4, opacity?: number): void;
301
+ addPoint3v(point3v: Vec3, segmentIndex?: number, color?: NumberArray4, opacity?: number, time?: number): void;
284
302
  /**
285
- * Append new geodetic point in the end of the path.
303
+ * Append a new geodetic point at the end of the path.
286
304
  * @public
287
305
  * @param {LonLat} lonLat - New coordinate.
288
306
  * @param {number} [segmentIndex=0] - Path segment index, first by default.
289
307
  * @param {NumberArray4} [color] - Point color.
290
308
  * @param {number} [opacity=1]
291
309
  */
292
- addPointLonLat(lonLat: LonLat, segmentIndex?: number, color?: NumberArray4, opacity?: number): void;
310
+ addPointLonLat(lonLat: LonLat, segmentIndex?: number, color?: NumberArray4, opacity?: number, time?: number): void;
293
311
  /**
294
312
  * Clear polyline data.
295
313
  * @public
@@ -403,6 +421,11 @@ declare class PolylineBatchRenderer {
403
421
  setPathLonLat(pathLonLat: SegmentPathLonLatExt, pathColors?: SegmentPathColor | NumberArray4, forceEqual?: boolean, segmentIndex?: number): void;
404
422
  drawOpaque(): void;
405
423
  drawTransparent(): void;
424
+ protected _bindTime(gl: WebGL2RenderingContext, sha: {
425
+ [id: string]: number;
426
+ }, shu: {
427
+ [id: string]: WebGLUniformLocation;
428
+ }): void;
406
429
  drawPicking(): void;
407
430
  /**
408
431
  * Refresh buffers.
@@ -431,6 +454,7 @@ declare class PolylineBatchRenderer {
431
454
  */
432
455
  protected _createIndexBuffer(): void;
433
456
  protected _createColorsBuffer(): void;
457
+ protected _createTimesBuffer(): void;
434
458
  protected _createPickingColorsBuffer(): void;
435
459
  protected _createThicknessBuffer(): void;
436
460
  protected _createTexParamsBuffer(): void;
@@ -10,6 +10,7 @@ declare class PolylineHandler {
10
10
  _entityCollection: EntityCollection;
11
11
  pickingEnabled: boolean;
12
12
  protected _renderer: Renderer | null;
13
+ protected _scene: Scene | null;
13
14
  _relativeCenter: Vec3;
14
15
  _rtcEyePositionHigh: Float32Array;
15
16
  _rtcEyePositionLow: Float32Array;
@@ -17,7 +18,25 @@ declare class PolylineHandler {
17
18
  _transparentRenderer: PolylineBatchRenderer;
18
19
  _opaqueTexRenderer: PolylineBatchRenderer;
19
20
  _transparentTexRenderer: PolylineBatchRenderer;
21
+ _timedRenderer: PolylineBatchRenderer | null;
22
+ _timedTexRenderer: PolylineBatchRenderer | null;
20
23
  protected _polylines: Polyline[];
24
+ protected _visibleSpherePosition: Vec3 | null;
25
+ protected _visibleSphereRadius: number;
26
+ /**
27
+ * Current time of the lines with path times, in the same units as their times.
28
+ * @public
29
+ * @type {number}
30
+ */
31
+ time: number;
32
+ /**
33
+ * Opacity multipliers of the path parts already passed and still ahead of the current time.
34
+ * @public
35
+ * @type {Float32Array}
36
+ */
37
+ timeOpacity: Float32Array;
38
+ setTime(time: number): void;
39
+ setTimeOpacity(past: number, future: number): void;
21
40
  constructor(entityCollection: EntityCollection);
22
41
  setVisibleSphere(p: Vec3, r: number): void;
23
42
  /**
@@ -26,10 +45,12 @@ declare class PolylineHandler {
26
45
  */
27
46
  requestRedraw(): void;
28
47
  protected _initProgram(): void;
48
+ protected _initTimedPrograms(): void;
49
+ protected _createTimedRenderer(textured: boolean): PolylineBatchRenderer;
29
50
  bindScene(scene: Scene): void;
30
51
  add(polyline: Polyline): void;
31
52
  remove(polyline: Polyline): void;
32
- getRenderer(opacity: number, textured: boolean): PolylineBatchRenderer;
53
+ getRenderer(opacity: number, textured: boolean, timed?: boolean): PolylineBatchRenderer;
33
54
  reindexAfterRemoval(removedBatchIndex: number, renderer: PolylineBatchRenderer): void;
34
55
  reindexPolylineArray(startIndex: number): void;
35
56
  drawForward(): void;
@@ -99,6 +99,13 @@ declare class Ray {
99
99
  * @param {number} z - Z coordinate.
100
100
  */
101
101
  setStartPosition(x: number, y: number, z: number): void;
102
+ protected _splitPosition(position: Vec3, high: Vec3, low: Vec3): void;
103
+ _splitPositions(): void;
104
+ /**
105
+ * Recomputes the start and end positions relative to the handler relative center.
106
+ * @public
107
+ */
108
+ updateRTCPosition(): void;
102
109
  getLength(): number;
103
110
  /**
104
111
  * Sets image template url source.
@@ -19,6 +19,9 @@ declare class RayHandler {
19
19
  protected _renderer: Renderer | null;
20
20
  protected _rays: Ray[];
21
21
  protected _opaqueCounterIndex: number;
22
+ _relativeCenter: Vec3;
23
+ protected _rtcEyePositionHigh: Float32Array;
24
+ protected _rtcEyePositionLow: Float32Array;
22
25
  protected _vertexBuffer: WebGLBufferExt | null;
23
26
  protected _startPositionHighBuffer: WebGLBufferExt | null;
24
27
  protected _startPositionLowBuffer: WebGLBufferExt | null;
@@ -71,6 +74,7 @@ declare class RayHandler {
71
74
  drawPicking(): void;
72
75
  reindexRaysArray(startIndex: number): void;
73
76
  protected _removeRay(ray: Ray): void;
77
+ setRelativeCenter(c: Vec3): void;
74
78
  remove(ray: Ray): void;
75
79
  setStartPositionArr(index: number, positionHigh: Vec3, positionLow: Vec3): void;
76
80
  setEndPositionArr(index: number, positionHigh: Vec3, positionLow: Vec3): void;
@@ -16,12 +16,15 @@ export interface IStripParams {
16
16
  color?: string | NumberArray4 | Vec4;
17
17
  opacity?: number;
18
18
  path?: TStrip[];
19
+ pathTimes?: number[];
19
20
  }
20
21
  /**
21
22
  * Strip object.
22
23
  * @class
23
24
  * @param {*} [options] - Strip options:
24
25
  * @param {boolean} [options.visibility] - Strip visibility.
26
+ * @param {number[]} [options.pathTimes] - Time of every path edge. Makes the strip follow the
27
+ * entity collection time, see {@link EntityCollection#setTime} and {@link EntityCollection#setTimeOpacity}.
25
28
  * @example <caption>Stripe example</caption>
26
29
  * new og.Entity({
27
30
  * strip: {
@@ -62,6 +65,11 @@ declare class Strip {
62
65
  protected _verticesLow: number[];
63
66
  protected _indexes: number[];
64
67
  protected _path: TStrip[];
68
+ protected _times: number[] | null;
69
+ protected _timesArr: Int32Array;
70
+ protected _timesBuffer: WebGLBufferExt | null;
71
+ protected _suspendBuffers: boolean;
72
+ protected _rtcCenter: Vec3;
65
73
  protected _pickingColor: Float32Array;
66
74
  protected _gridSize: number;
67
75
  /**
@@ -103,6 +111,21 @@ declare class Strip {
103
111
  */
104
112
  setOpacity(opacity: number): void;
105
113
  isOpaque(): boolean;
114
+ /**
115
+ * Returns true when the strip has edge times and follows the entity collection time.
116
+ * @public
117
+ * @returns {boolean}
118
+ */
119
+ isTimed(): boolean;
120
+ getPathTimes(): number[] | null;
121
+ /**
122
+ * Sets edge times. Null removes them and the strip stops following the entity collection time.
123
+ * @public
124
+ * @param {number[] | null} times - Time of every path edge, missing values repeat the previous one.
125
+ */
126
+ setPathTimes(times: number[] | null): void;
127
+ protected _resolveTimes(): number[];
128
+ protected _rebuildTimes(): void;
106
129
  /**
107
130
  * Sets strip visibility.
108
131
  * @public
@@ -119,6 +142,13 @@ declare class Strip {
119
142
  * @param {Scene} scene - Assigned render node.
120
143
  */
121
144
  bindScene(scene: Scene): void;
145
+ protected _toTwoFloats(p: Vec3): void;
146
+ /**
147
+ * Rebuilds vertices relative to the handler relative center when it has moved.
148
+ * @public
149
+ * @returns {boolean} True when the strip was rebuilt.
150
+ */
151
+ updateRTCPosition(): boolean;
122
152
  /**
123
153
  * Removes from entity.
124
154
  * @public
@@ -134,12 +164,12 @@ declare class Strip {
134
164
  */
135
165
  _deleteBuffers(): void;
136
166
  protected _createBuffers(): void;
137
- addEdge3v(p2: Vec3, p3: Vec3): void;
138
- setEdge3v(p2: Vec3, p3: Vec3, index: number): void;
167
+ addEdge3v(p2: Vec3, p3: Vec3, time?: number): void;
168
+ setEdge3v(p2: Vec3, p3: Vec3, index: number, time?: number): void;
139
169
  removeEdge(index: number): void;
140
170
  setGridSize(gridSize: number): void;
141
171
  getPath(): TStrip[];
142
- setPath(path: TStripExt[] | TStrip[]): void;
143
- insertEdge3v(p0: Vec3, p1: Vec3, index: number): void;
172
+ setPath(path: TStripExt[] | TStrip[], pathTimes?: number[]): void;
173
+ insertEdge3v(p0: Vec3, p1: Vec3, index: number, time?: number): void;
144
174
  }
145
175
  export { Strip };
@@ -2,6 +2,7 @@ import { EntityCollection } from "../EntityCollection";
2
2
  import { Renderer } from "../../renderer/Renderer";
3
3
  import { Scene } from "../../scene/Scene";
4
4
  import { Strip } from "./Strip";
5
+ import { Vec3 } from "../../math/Vec3";
5
6
  declare class StripHandler {
6
7
  static __counter__: number;
7
8
  protected __id: number;
@@ -30,8 +31,28 @@ declare class StripHandler {
30
31
  */
31
32
  protected _strips: Strip[];
32
33
  protected _opaqueCount: number;
34
+ _relativeCenter: Vec3;
35
+ _rtcEyePositionHigh: Float32Array;
36
+ _rtcEyePositionLow: Float32Array;
37
+ /**
38
+ * Current time of the lines with path times, in the same units as their times.
39
+ * @public
40
+ * @type {number}
41
+ */
42
+ time: number;
43
+ /**
44
+ * Opacity multipliers of the path parts already passed and still ahead of the current time.
45
+ * @public
46
+ * @type {Float32Array}
47
+ */
48
+ timeOpacity: Float32Array;
49
+ setTime(time: number): void;
50
+ setTimeOpacity(past: number, future: number): void;
33
51
  constructor(entityCollection: EntityCollection);
52
+ setRelativeCenter(c: Vec3): void;
53
+ protected _updateRTCEyePosition(): void;
34
54
  protected _initProgram(): void;
55
+ initTimedPrograms(): void;
35
56
  bindScene(scene: Scene): void;
36
57
  protected _swap(i: number, j: number): void;
37
58
  add(strip: Strip): void;
package/lib/index.d.ts CHANGED
@@ -14,6 +14,7 @@ export * from "./control/Control";
14
14
  export * from "./entity/index";
15
15
  export * from "./layer/index";
16
16
  export * from "./Globe";
17
+ export { proj4 } from "./proj/proj4";
17
18
  export type { IControlParams } from "./control/Control";
18
19
  export type { IMouseState, ITouchState } from "./renderer/RendererEvents";
19
20
  export type { IDeferredShadingPass } from "./renderer/IDeferredShadingPass";
@@ -20,6 +20,7 @@ export declare abstract class BaseTileMaterialLayer extends Layer {
20
20
  events: BaseTileMaterialLayerEventsType;
21
21
  minNativeZoom: number;
22
22
  maxNativeZoom: number;
23
+ protected _loadendFrame: number;
23
24
  constructor(name?: string | null, options?: IBaseTileMaterialLayerParams);
24
25
  addTo(planet: Planet): void;
25
26
  remove(): this;
@@ -66,6 +66,14 @@ export declare class GeoTIFFLayer extends BaseTileMaterialLayer {
66
66
  clear(): void;
67
67
  redraw(): void;
68
68
  private _reapplyRenderOptions;
69
+ /**
70
+ * Opens the source. If its CRS is unresolved, fetches the projection
71
+ * from the EPSG registry and reopens the source with it.
72
+ *
73
+ * Projections provided via `projFunc` or registered in {@link proj4}
74
+ * are already resolved and require no lookup.
75
+ */
76
+ private _readSource;
69
77
  private _initSource;
70
78
  private _initSources;
71
79
  private _normalizeRenderOptions;
@@ -279,6 +279,19 @@ declare class Vector extends BaseTileMaterialLayer {
279
279
  * @param entityCollection
280
280
  */
281
281
  _bindEventsDefault(entityCollection: EntityCollection): void;
282
+ /**
283
+ * Sets the current time of polylines and strips with path times.
284
+ * @public
285
+ * @param {number} time - Time in the same units as the path times.
286
+ */
287
+ setTime(time: number): void;
288
+ /**
289
+ * Sets opacity multipliers of the path parts passed and ahead of the current time.
290
+ * @public
291
+ * @param {number} past - Multiplier up to the current time.
292
+ * @param {number} future - Multiplier after the current time.
293
+ */
294
+ setTimeOpacity(past: number, future: number): void;
282
295
  protected _collectStripCollectionPASS(outArr: EntityCollection[]): void;
283
296
  protected _collectPolylineCollectionPASS(outArr: EntityCollection[]): void;
284
297
  protected _collectGeoObjectCollectionPASS(outArr: EntityCollection[]): void;
@@ -14,6 +14,8 @@ export declare class GeoTIFFReader implements IGeoTIFFReader {
14
14
  extentWgs84: Extent;
15
15
  nativeBBox: [number, number, number, number];
16
16
  crsCode: number;
17
+ /** Whether `crsCode` could be georeferenced, see {@link IGeoTIFFMetadata.crsResolved} */
18
+ crsResolved: boolean;
17
19
  projFunc?: ProjFunc;
18
20
  reverseY: boolean;
19
21
  requestLevels: number[];
@@ -16,6 +16,8 @@ export declare class MultiGeoTIFFReader implements IGeoTIFFReader {
16
16
  extentWgs84: Extent;
17
17
  isReady: boolean;
18
18
  crsCode: number;
19
+ /** Whether every source could be georeferenced, see {@link IGeoTIFFMetadata.crsResolved} */
20
+ crsResolved: boolean;
19
21
  workerPool: Pool | null;
20
22
  private _poolHandle;
21
23
  private _bandMappings;