@margoengine/points 0.0.0-stage → 1.0.0
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/LICENSE +201 -0
- package/NOTICE +4 -0
- package/README.md +876 -2
- package/dist/attributes-DNc-1pdr.js +256 -0
- package/dist/attributes.d.ts +48 -0
- package/dist/clip.d.ts +55 -0
- package/dist/clip.js +122 -0
- package/dist/cloud-B4O_G-Df.js +545 -0
- package/dist/cloud.d.ts +155 -0
- package/dist/color.d.ts +1 -0
- package/dist/copc-write.d.ts +95 -0
- package/dist/copc-write.js +318 -0
- package/dist/copc.d.ts +55 -0
- package/dist/copc.js +127 -0
- package/dist/depth-video.d.ts +98 -0
- package/dist/depth-video.js +164 -0
- package/dist/e57.d.ts +163 -0
- package/dist/e57.js +624 -0
- package/dist/frame.d.ts +14 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +1246 -0
- package/dist/las.d.ts +213 -0
- package/dist/las.js +500 -0
- package/dist/laz-encode-CHXgHra_.js +446 -0
- package/dist/laz-encode.d.ts +14 -0
- package/dist/laz-model-DCphHLqH.js +385 -0
- package/dist/laz-model.d.ts +47 -0
- package/dist/laz-write.d.ts +46 -0
- package/dist/laz-write.js +75 -0
- package/dist/laz.d.ts +50 -0
- package/dist/laz.js +645 -0
- package/dist/material.d.ts +167 -0
- package/dist/math.d.ts +103 -0
- package/dist/octree.d.ts +182 -0
- package/dist/octree.js +360 -0
- package/dist/pick.d.ts +76 -0
- package/dist/pick.js +192 -0
- package/dist/plugin.d.ts +235 -0
- package/dist/potree-las-RC8sjbYU.js +1 -0
- package/dist/potree-las.d.ts +1 -0
- package/dist/potree.d.ts +70 -0
- package/dist/potree.js +451 -0
- package/dist/range-BQuJAjUM.js +23 -0
- package/dist/range.d.ts +4 -0
- package/dist/screen-door-CALlYs39.js +7 -0
- package/dist/shaders-DCnbvb0-.js +282 -0
- package/dist/shaders.d.ts +52 -0
- package/dist/shared/fog.d.ts +33 -0
- package/dist/shared/pass.d.ts +53 -0
- package/dist/shared/selection-mask.d.ts +52 -0
- package/dist/shared/style-expression.d.ts +18 -0
- package/dist/sprites.d.ts +78 -0
- package/dist/storage-limit.d.ts +6 -0
- package/dist/style.d.ts +124 -0
- package/dist/style.js +709 -0
- package/dist/surfels.d.ts +95 -0
- package/dist/surfels.js +538 -0
- package/dist/survey-DToZwkJv.js +46 -0
- package/dist/survey.d.ts +10 -0
- package/dist/tier-BcFbLPVT.js +91 -0
- package/dist/tier.d.ts +6 -0
- package/package.json +102 -4
package/dist/style.d.ts
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { PointCloud } from './cloud.js';
|
|
2
|
+
import type { OctreeNodeData, OctreeSource } from './octree.js';
|
|
3
|
+
import { type StyleSource } from './shared/style-expression.js';
|
|
4
|
+
/** A style property: an expression string, a literal, or `{conditions: [[test, result], ...]}` (first true wins). */
|
|
5
|
+
export type PointStyleExpression = StyleSource;
|
|
6
|
+
/** An inclusive `[min, max]` range; either end may be `-Infinity` or `Infinity`. */
|
|
7
|
+
export type PointRange = readonly [number, number];
|
|
8
|
+
/**
|
|
9
|
+
* Potree-style attribute filters. A point is shown when it passes every filter given. Column names are looked up as
|
|
10
|
+
* described in {@link PointTable}, so `returnNumber` also finds a `return_number` column.
|
|
11
|
+
*/
|
|
12
|
+
export interface PointFilter {
|
|
13
|
+
/** ASPRS classes to show; every other class is hidden. Default all. */
|
|
14
|
+
classification?: readonly number[];
|
|
15
|
+
returnNumber?: PointRange;
|
|
16
|
+
numberOfReturns?: PointRange;
|
|
17
|
+
gpsTime?: PointRange;
|
|
18
|
+
pointSourceId?: PointRange;
|
|
19
|
+
intensity?: PointRange;
|
|
20
|
+
scanAngle?: PointRange;
|
|
21
|
+
userData?: PointRange;
|
|
22
|
+
/** Ranges of any other numeric column, by name (an extra bytes attribute, for example). */
|
|
23
|
+
ranges?: Readonly<Record<string, PointRange>>;
|
|
24
|
+
}
|
|
25
|
+
/** Options of {@link PointStyle}: the point cloud properties of an OGC 3D Tiles style, plus Potree filters. */
|
|
26
|
+
export interface PointStyleOptions {
|
|
27
|
+
/** Boolean expression; hidden points are not drawn. Default true. */
|
|
28
|
+
show?: PointStyleExpression;
|
|
29
|
+
/** Color expression (`color()`, `rgb()`, `hsl()`, `vec4`), sRGB. Default: the point keeps its own colour. */
|
|
30
|
+
color?: PointStyleExpression;
|
|
31
|
+
/** Point size in the material's units (pixels by default, as in 3D Tiles). Default: the point keeps its size. */
|
|
32
|
+
pointSize?: PointStyleExpression;
|
|
33
|
+
/** Named expressions, read as `${name}`; inside a define `${name}` is the column of that name. */
|
|
34
|
+
defines?: Readonly<Record<string, string>>;
|
|
35
|
+
/** Attribute filters, combined with `show` (both must pass). */
|
|
36
|
+
filter?: PointFilter;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Per-point attribute columns, one value per point or `k` values per point (2 to 4, read as a vector): a `LASPoints`
|
|
40
|
+
* from `margoengine/points/las` as it is, an octree node's `attributes`, or any object of typed arrays. A style reads
|
|
41
|
+
* `${name}` by its exact key first, then by the key that matches ignoring case, `_`, `-` and spaces (`${Classification}`
|
|
42
|
+
* finds `classification`, `${gps_time}` finds `gpsTime`). Point semantics: `${POSITION}` (from `positions`),
|
|
43
|
+
* `${POSITION_ABSOLUTE}` (plus `origin`, then `matrix`), `${COLOR}` (from `colors`, or 16-bit `rgb`) and `${NORMAL}`
|
|
44
|
+
* (from `normals`).
|
|
45
|
+
*/
|
|
46
|
+
export type PointTable = object;
|
|
47
|
+
/** Options of {@link PointStyle.evaluate}. */
|
|
48
|
+
export interface PointStyleEvaluateOptions {
|
|
49
|
+
/** Points to style. Default `positions.length / 3`, or the length of the first column. */
|
|
50
|
+
count?: number;
|
|
51
|
+
/** Column-major local-to-world matrix for `${POSITION_ABSOLUTE}`. Default identity. */
|
|
52
|
+
matrix?: ArrayLike<number>;
|
|
53
|
+
signal?: AbortSignal;
|
|
54
|
+
}
|
|
55
|
+
/** One evaluation of a style over every point. */
|
|
56
|
+
export interface PointStyleResult {
|
|
57
|
+
readonly count: number;
|
|
58
|
+
/** 1 for a shown point, 0 for a hidden one. */
|
|
59
|
+
readonly show: Uint8Array;
|
|
60
|
+
/** Points shown. */
|
|
61
|
+
readonly shown: number;
|
|
62
|
+
/** sRGB RGBA in 0..1 per point (a point with no matching condition keeps its own colour), or null without `color`. */
|
|
63
|
+
readonly colors: Float32Array | null;
|
|
64
|
+
/** Size per point, NaN where no condition matched, or null without `pointSize`. Hidden points read NaN. */
|
|
65
|
+
readonly sizes: Float32Array | null;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* A compiled point style: OGC 3D Tiles styling (show, color, pointSize, defines, conditions, vectors, maths, regular
|
|
69
|
+
* expressions) plus Potree attribute filters. Compile once; evaluate it over any number of tables.
|
|
70
|
+
*/
|
|
71
|
+
export declare class PointStyle {
|
|
72
|
+
/** The options it was compiled from. */
|
|
73
|
+
readonly options: Readonly<PointStyleOptions>;
|
|
74
|
+
/** Throws MargoError `state` for an expression that does not parse, RangeError for a malformed filter. */
|
|
75
|
+
constructor(options?: PointStyleOptions);
|
|
76
|
+
/** Whether the style hides any point it is given: a show expression or a filter. */
|
|
77
|
+
get filters(): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Evaluates the style for every point of `table`. Throws MargoError `state` when an expression gives the wrong
|
|
80
|
+
* type for a point (show not a boolean, color not four finite numbers, pointSize not a finite number of 0 or more),
|
|
81
|
+
* TypeError when a filter names a column the table lacks.
|
|
82
|
+
*/
|
|
83
|
+
evaluate(table: PointTable, options?: PointStyleEvaluateOptions): PointStyleResult;
|
|
84
|
+
}
|
|
85
|
+
/** A live style on one cloud: `update` restyles it, `dispose` (or `using`) puts back what it had. */
|
|
86
|
+
export interface PointStyleBinding extends Disposable {
|
|
87
|
+
/** The latest evaluation. */
|
|
88
|
+
readonly result: PointStyleResult;
|
|
89
|
+
/** Evaluates `style` (or the current one again, after the table changed) and writes it to the cloud. */
|
|
90
|
+
update(style?: PointStyle | PointStyleOptions): PointStyleResult;
|
|
91
|
+
/** Restores the colours, sizes and selection mask the cloud had when bound. */
|
|
92
|
+
dispose(): void;
|
|
93
|
+
}
|
|
94
|
+
/** Options of {@link bindPointStyle}. */
|
|
95
|
+
export interface BindPointStyleOptions {
|
|
96
|
+
/** Column-major matrix for `${POSITION_ABSOLUTE}`. Default the cloud's `matrix`. */
|
|
97
|
+
matrix?: ArrayLike<number>;
|
|
98
|
+
signal?: AbortSignal;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Styles a cloud in place from its table (rows in the cloud's source order, so a `reorder`ed cloud reads its
|
|
102
|
+
* `sourceIndex`). Colours replace the cloud's per-point colours (`${COLOR}` reads the colours it had when bound),
|
|
103
|
+
* point sizes its per-point sizes, and hidden points go through the cloud's selection mask in `'filter'` mode, so they
|
|
104
|
+
* draw nothing and cannot be picked while the cloud keeps its order and buffers. The binding owns the mask while it
|
|
105
|
+
* lives. Nothing on the cloud changes when an evaluation throws.
|
|
106
|
+
*/
|
|
107
|
+
export declare function bindPointStyle(cloud: PointCloud, table: PointTable, style: PointStyle | PointStyleOptions, options?: BindPointStyleOptions): PointStyleBinding;
|
|
108
|
+
/**
|
|
109
|
+
* A new cloud holding only the points the style shows, styled, plus their indices into `source`: hidden points take no
|
|
110
|
+
* memory, draw budget or picking. Re-run it after changing the style or the data.
|
|
111
|
+
*/
|
|
112
|
+
export declare function createStyledCloud(source: PointCloud, table: PointTable, style: PointStyle | PointStyleOptions, options?: BindPointStyleOptions): {
|
|
113
|
+
cloud: PointCloud;
|
|
114
|
+
indices: Uint32Array;
|
|
115
|
+
result: PointStyleResult;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Wraps an octree source (`PotreeSource`, `CopcSource`, `MemoryOctree`) so each node is styled as it loads: hidden
|
|
119
|
+
* points are dropped from the node and `color` becomes its colours. `pointSize` does not apply to octree nodes. To
|
|
120
|
+
* change the style, wrap the source again and give it to a new `OctreeCloud`.
|
|
121
|
+
*/
|
|
122
|
+
export declare function styleSource(source: OctreeSource, style: PointStyle | PointStyleOptions): OctreeSource;
|
|
123
|
+
/** Styles one node's points: what `styleSource` does to each node. */
|
|
124
|
+
export declare function styleNode(data: OctreeNodeData, style: PointStyle | PointStyleOptions, signal?: AbortSignal): OctreeNodeData;
|