@openglobus/og 1.0.0-rc33 → 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.
- package/lib/Globe.d.ts +4 -0
- package/lib/assets/RgbTerrainWorker.worker-CEntGFYu.js.map +1 -0
- package/lib/control/DragAndDrop.d.ts +1 -0
- package/lib/control/entityGizmo/EntityGizmo.d.ts +4 -3
- package/lib/control/entityGizmo/EntityGizmoScene.d.ts +13 -1
- package/lib/index.d.ts +1 -0
- package/lib/layer/BaseTileMaterialLayer.d.ts +1 -0
- package/lib/layer/GeoTIFFLayer.d.ts +8 -0
- package/lib/layer/geotiff/GeoTIFFReader.d.ts +2 -0
- package/lib/layer/geotiff/MultiGeoTIFFReader.d.ts +2 -0
- package/lib/layer/geotiff/types.d.ts +3 -2
- package/lib/layer/geotiff/utm.d.ts +1 -1
- package/lib/og.es.js +1 -1
- package/lib/og.es.js.map +1 -1
- package/lib/proj/epsgIo.d.ts +5 -0
- package/lib/proj/proj4.d.ts +1 -0
- package/lib/quadTree/EntityCollectionNode.d.ts +2 -0
- package/lib/terrain/GlobusTerrain.d.ts +7 -0
- package/lib/terrain/RgbTerrain.d.ts +25 -3
- package/lib/terrain/rgbTerrainGrid.d.ts +81 -0
- package/lib/utils/RgbTerrainWorker.d.ts +21 -0
- package/lib/utils/RgbTerrainWorker.worker.d.ts +1 -0
- 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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IAAI,EAAI,EAAG,EAAK,EAAM,EAAO,EAAG,EAAI,EAAM,IAAK,GAAM,EAAG,CACzD,IAAI,EAAI,EAAS,GACb,EAAI,EAAS,EAAK,GAClB,EAAI,EAAS,EAAK,GAElB,EAAS,EACH,IAAJ,EAAU,EAAI,EAAI,IAAM,MACxB,IAAM,IACJ,EACA,EAAY,GAAkB,MAAJ,EAAgB,IAAJ,EAAU,GAExD,GAAU,EAEV,IAAI,EAAW,EAAc,EAAK,EAAO,EAAO,CAAA,GAE3C,GAAY,IAAW,IAAM,IAC9B,EAAS,EACL,EAAE,eACF,EAAE,cACF,EAAE,cACF,EACA,EACA,KAAK,MAAM,EAAI,CAAA,EACf,EAAE,mBAAA,EAEN,EAAW,EAAc,EAAK,EAAO,EAAO,CAAA,GAGhD,EAAW,GAAK,EAAW,EAAe,CAC9C,CACJ,ECjLqD,EAAU,EAAK,EAAE,KAAM,EAAa,EAAE,OAAQ,EAAY,GAAA,EACnG,EAAE,YAAA,CAEV,OAAS,EAAA,CACL,QAAQ,MAAM,CAAA,CAClB,CAEA,EAAO,MAAA,EAEP,KAAK,YACD,CACQ,GAAA,EACK,QAAA,CAAA,EAEb,EAAU,CAAC,EAAQ,MAAA,EAAU,CAAA,CAAA,CAErC,CAAA,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
|
}
|
|
@@ -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
|
|
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 `
|
|
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
|
|
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
|
-
/**
|
|
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;
|
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;
|
|
@@ -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;
|
|
@@ -63,9 +63,9 @@ export interface IGeoTIFFRequestOptions {
|
|
|
63
63
|
credentials?: boolean;
|
|
64
64
|
maxRanges?: number;
|
|
65
65
|
allowFullFile?: boolean;
|
|
66
|
-
/** Size of a cached byte range,
|
|
66
|
+
/** Size of a cached byte range, 256 KB by default. */
|
|
67
67
|
blockSize?: number;
|
|
68
|
-
/** Number of cached byte ranges,
|
|
68
|
+
/** Number of cached byte ranges, by default as many as fit in 32 MB. */
|
|
69
69
|
cacheSize?: number;
|
|
70
70
|
[key: string]: any;
|
|
71
71
|
}
|
|
@@ -141,6 +141,7 @@ export interface IGeoTIFFReader {
|
|
|
141
141
|
export interface IGeoTIFFMetadata {
|
|
142
142
|
bbox: [number, number, number, number];
|
|
143
143
|
crsCode: number;
|
|
144
|
+
crsResolved: boolean;
|
|
144
145
|
width: number;
|
|
145
146
|
height: number;
|
|
146
147
|
samplesPerPixel: number;
|
|
@@ -17,6 +17,6 @@ export interface IProjectionHelper {
|
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* Returns a projection helper { project, unproject } if the given code is a supported UTM EPSG code
|
|
20
|
-
* (EPSG:32601-32660 or EPSG:32701-32760), or if
|
|
20
|
+
* (EPSG:32601-32660 or EPSG:32701-32760), or if its definition is registered in proj4.
|
|
21
21
|
*/
|
|
22
22
|
export declare function getProjectionHelper(crsCode: number, customProjFunc?: (code: number) => IProjectionHelper | undefined): IProjectionHelper | null;
|