@build-qube/takeoff-calculator 2.1.0 → 3.1.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/README.md +4 -0
- package/browser.js +1 -1
- package/index.d.ts +640 -271
- package/index.js +766 -750
- package/package.json +15 -13
package/index.d.ts
CHANGED
|
@@ -1,348 +1,717 @@
|
|
|
1
1
|
/* auto-generated by NAPI-RS */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
export declare class GeometryClient {
|
|
4
|
+
constructor(
|
|
5
|
+
svg: string,
|
|
6
|
+
pageBackgroundColor?: Array<number> | undefined | null,
|
|
7
|
+
);
|
|
8
|
+
/** Get the geometry stats */
|
|
9
|
+
getGeometryStats(): JsGeometryStats;
|
|
10
|
+
/** Initialize the geometry */
|
|
11
|
+
initializeGeometry(): Promise<JsGeometryStats>;
|
|
12
|
+
/** Query the snap points near a point */
|
|
13
|
+
querySnapPointsNear(x: number, y: number, radius: number): Array<JsSnapPoint>;
|
|
14
|
+
/** Query the nearest snap point */
|
|
15
|
+
queryNearestSnapPoint(x: number, y: number): JsSnapPoint | null;
|
|
16
|
+
queryNearestNSnapPoints(x: number, y: number, n: number): Array<JsSnapPoint>;
|
|
17
|
+
queryElementsNear(
|
|
18
|
+
x: number,
|
|
19
|
+
y: number,
|
|
20
|
+
radius: number,
|
|
21
|
+
): Array<JsGeometryElement>;
|
|
22
|
+
detectClosedRegionsAsync(
|
|
23
|
+
config?: JsMergeConfig | undefined | null,
|
|
24
|
+
): Promise<Array<JsDetectedPolygon>>;
|
|
25
|
+
detectClosedRegions(
|
|
26
|
+
config?: JsMergeConfig | undefined | null,
|
|
27
|
+
): Array<JsDetectedPolygon>;
|
|
28
|
+
identifyContourLine(
|
|
29
|
+
tracePoints: Array<JsTracePoint>,
|
|
30
|
+
config?: JsContourDetectConfig | undefined | null,
|
|
31
|
+
): JsContourDetectionResult;
|
|
32
|
+
detectContourAtPoint(
|
|
33
|
+
x: number,
|
|
34
|
+
y: number,
|
|
35
|
+
radius?: number | undefined | null,
|
|
36
|
+
config?: JsContourDetectConfig | undefined | null,
|
|
37
|
+
): JsDetectedContourLine | null;
|
|
38
|
+
clearContourSignature(): void;
|
|
39
|
+
/**
|
|
40
|
+
* Build the topology graph off the main thread. Requires geometry to be
|
|
41
|
+
* initialized first. Idempotent: returns cached stats on later calls.
|
|
42
|
+
*/
|
|
43
|
+
initializeTopology(
|
|
44
|
+
config?: JsTopologyConfig | undefined | null,
|
|
45
|
+
): Promise<JsTopologyStats>;
|
|
46
|
+
/** Stats of the built topology graph, or None if not initialized yet. */
|
|
47
|
+
getTopologyStats(): JsTopologyStats | null;
|
|
48
|
+
/**
|
|
49
|
+
* Rank likely next drawing points from the node nearest (lastX, lastY),
|
|
50
|
+
* scored by cursor heading, style continuity with the arrival direction
|
|
51
|
+
* (prevX/prevY), and edge trust. Returns [] until topology is initialized.
|
|
52
|
+
*/
|
|
53
|
+
suggestNextPoints(
|
|
54
|
+
lastX: number,
|
|
55
|
+
lastY: number,
|
|
56
|
+
cursorX: number,
|
|
57
|
+
cursorY: number,
|
|
58
|
+
prevX?: number | undefined | null,
|
|
59
|
+
prevY?: number | undefined | null,
|
|
60
|
+
radius?: number | undefined | null,
|
|
61
|
+
maxResults?: number | undefined | null,
|
|
62
|
+
): Array<JsSuggestedPoint>;
|
|
63
|
+
/**
|
|
64
|
+
* Trace the closed region containing (x, y) by walking the topology
|
|
65
|
+
* graph's faces. Returns None until topology is initialized, if no edge
|
|
66
|
+
* lies within `radius`, or if the point is not inside a bounded region.
|
|
67
|
+
* The boundary is Douglas-Peucker simplified with `simplify_tolerance`
|
|
68
|
+
* (PDF units, 0 disables); area and perimeter reflect the full walk.
|
|
69
|
+
*/
|
|
70
|
+
detectFaceAtPoint(
|
|
71
|
+
x: number,
|
|
72
|
+
y: number,
|
|
73
|
+
radius?: number | undefined | null,
|
|
74
|
+
minArea?: number | undefined | null,
|
|
75
|
+
simplifyTolerance?: number | undefined | null,
|
|
76
|
+
): JsDetectedFace | null;
|
|
77
|
+
/**
|
|
78
|
+
* Detect door symbols (swing arc + leaf + jambs) across the page.
|
|
79
|
+
* Detection runs once and is cached; `min_confidence` (default 0.7)
|
|
80
|
+
* filters the cached results. Rotation-invariant; thresholds give the
|
|
81
|
+
* jamb-to-jamb opening segment in PDF units.
|
|
82
|
+
*/
|
|
83
|
+
detectDoors(minConfidence?: number | undefined | null): Array<JsDetectedDoor>;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface ElementStyle {
|
|
87
|
+
stroke?: StrokeStyle;
|
|
88
|
+
fill?: FillStyle;
|
|
89
|
+
visible: boolean;
|
|
90
|
+
opacity: number;
|
|
91
|
+
strokeMatchesBackground: boolean;
|
|
92
|
+
fillMatchesBackground: boolean;
|
|
93
|
+
matchesBackground: boolean;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export type FillRule = 'NonZero' | 'EvenOdd';
|
|
97
|
+
|
|
98
|
+
export interface FillStyle {
|
|
99
|
+
color: Array<number>;
|
|
100
|
+
opacity: number;
|
|
101
|
+
rule: FillRule;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface JsContourDetectConfig {
|
|
105
|
+
corridorWidth?: number;
|
|
106
|
+
colorTolerance?: number;
|
|
107
|
+
widthTolerance?: number;
|
|
108
|
+
dashRatioTolerance?: number;
|
|
109
|
+
directionThreshold?: number;
|
|
110
|
+
maxGapMultiplier?: number;
|
|
111
|
+
loopClosureTolerance?: number;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface JsContourDetectionResult {
|
|
115
|
+
detected: boolean;
|
|
116
|
+
contour?: JsDetectedContourLine;
|
|
117
|
+
mode: string;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface JsDetectedContourLine {
|
|
121
|
+
points: Array<Array<number>>;
|
|
122
|
+
elementIndices: Array<number>;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export interface JsDetectedDoor {
|
|
126
|
+
/** "single" or "double". */
|
|
127
|
+
kind: string;
|
|
128
|
+
confidence: number;
|
|
129
|
+
/** Opening width (threshold length, PDF units). */
|
|
130
|
+
width: number;
|
|
131
|
+
/** Hinge-side jamb as [x, y]. */
|
|
132
|
+
hinge: Array<number>;
|
|
133
|
+
/**
|
|
134
|
+
* Jamb-to-jamb opening segment as [x1, y1, x2, y2] — the room boundary
|
|
135
|
+
* at this door.
|
|
136
|
+
*/
|
|
137
|
+
threshold: Array<number>;
|
|
138
|
+
/**
|
|
139
|
+
* Oriented box covering threshold plus swing: [cx, cy, ax, ay, hw, hh]
|
|
140
|
+
* where (ax, ay) is the unit threshold axis and hw/hh the half-extents
|
|
141
|
+
* along axis/normal (normal points toward the swing side).
|
|
142
|
+
*/
|
|
143
|
+
obb: Array<number>;
|
|
144
|
+
/** Indices of the elements whose swing arcs produced this door. */
|
|
145
|
+
arcElements: Array<number>;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export interface JsDetectedFace {
|
|
149
|
+
/** Closed boundary ring as [x, y] pairs (first point repeated at the end). */
|
|
150
|
+
points: Array<Array<number>>;
|
|
151
|
+
sourceElements: Array<number>;
|
|
152
|
+
confidence: number;
|
|
153
|
+
area: number;
|
|
154
|
+
perimeter: number;
|
|
155
|
+
/** Gap spans synthesized to close the region, as [x1, y1, x2, y2]. */
|
|
156
|
+
bridgedSpans: Array<Array<number>>;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export interface JsDetectedPolygon {
|
|
160
|
+
points: Array<Array<number>>;
|
|
161
|
+
sourceElements: Array<number>;
|
|
162
|
+
confidence: number;
|
|
163
|
+
area: number;
|
|
164
|
+
perimeter: number;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export interface JsGeometryElement {
|
|
168
|
+
id: string;
|
|
169
|
+
geometryType: JsGeometryType;
|
|
170
|
+
bbox: Array<number>;
|
|
171
|
+
style: ElementStyle;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export interface JsGeometryStats {
|
|
175
|
+
elementCount: number;
|
|
176
|
+
snapPointCount: number;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export type JsGeometryType =
|
|
180
|
+
| { type: 'Point'; points: [Point] }
|
|
181
|
+
| { type: 'LineString'; points: Array<Point> }
|
|
182
|
+
| { type: 'Polygon'; points: Array<Point> }
|
|
183
|
+
| { type: 'MultiLineString'; points: Array<Array<Point>> };
|
|
184
|
+
|
|
185
|
+
export interface JsMergeConfig {
|
|
186
|
+
endpointTolerance?: number;
|
|
187
|
+
minEdges?: number;
|
|
188
|
+
minArea?: number;
|
|
189
|
+
maxEdgeLength?: number;
|
|
190
|
+
minSegmentLength?: number;
|
|
191
|
+
styleMustMatch?: boolean;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export interface JsSnapPoint {
|
|
195
|
+
x: number;
|
|
196
|
+
y: number;
|
|
197
|
+
snapType: SnapType;
|
|
198
|
+
elementIndex: number;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export interface JsSuggestedPoint {
|
|
202
|
+
x: number;
|
|
203
|
+
y: number;
|
|
204
|
+
score: number;
|
|
205
|
+
bridged: boolean;
|
|
206
|
+
/** Source element index of the suggested edge; absent for bridged gaps. */
|
|
207
|
+
elementIndex?: number;
|
|
208
|
+
nodeDegree: number;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export interface JsTopologyConfig {
|
|
212
|
+
nodeTolerance?: number;
|
|
213
|
+
bridgeTolerance?: number;
|
|
214
|
+
extensionTolerance?: number;
|
|
215
|
+
bridgeStyleMatch?: boolean;
|
|
216
|
+
sealDoorways?: boolean;
|
|
217
|
+
doorwayMinConfidence?: number;
|
|
218
|
+
minElementExtent?: number;
|
|
219
|
+
simplifyTolerance?: number;
|
|
220
|
+
maxSegments?: number;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export interface JsTopologyStats {
|
|
224
|
+
nodeCount: number;
|
|
225
|
+
edgeCount: number;
|
|
226
|
+
bridgedEdges: number;
|
|
227
|
+
doorwayEdges: number;
|
|
228
|
+
tJunctions: number;
|
|
229
|
+
elementsUsed: number;
|
|
230
|
+
elementsFiltered: number;
|
|
231
|
+
buildMs: number;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export interface JsTracePoint {
|
|
235
|
+
x: number;
|
|
236
|
+
y: number;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
export type LineCap = 'Butt' | 'Round' | 'Square';
|
|
240
|
+
|
|
241
|
+
export type LineJoin = 'Miter' | 'MiterClip' | 'Round' | 'Bevel';
|
|
242
|
+
|
|
243
|
+
export declare function scaleGeometry(
|
|
244
|
+
geometry: JsGeometryType,
|
|
245
|
+
x: number,
|
|
246
|
+
y: number,
|
|
247
|
+
): JsGeometryType;
|
|
248
|
+
|
|
249
|
+
export type SnapType = 'Endpoint' | 'Vertex' | 'Midpoint';
|
|
250
|
+
|
|
251
|
+
export interface StrokeStyle {
|
|
252
|
+
color: Array<number>;
|
|
253
|
+
width: number;
|
|
254
|
+
opacity: number;
|
|
255
|
+
linecap: LineCap;
|
|
256
|
+
linejoin: LineJoin;
|
|
257
|
+
dasharray?: Array<number>;
|
|
258
|
+
dashoffset: number;
|
|
259
|
+
}
|
|
260
|
+
export declare class PdfPage {
|
|
261
|
+
pageNumber: number;
|
|
262
|
+
get svg(): string;
|
|
263
|
+
getGeometryClient(
|
|
264
|
+
options?: JsGeometryClientOptions | undefined | null,
|
|
265
|
+
): GeometryClient;
|
|
266
|
+
renderPage(scale: number): Array<number>;
|
|
267
|
+
renderPageToBase64(scale: number): string;
|
|
268
|
+
getScaledDimensions(scale: number): [number, number];
|
|
269
|
+
renderPageWithOptions(
|
|
270
|
+
scale: number,
|
|
271
|
+
format: ImageOutputFormat,
|
|
272
|
+
quality: number,
|
|
273
|
+
): Array<number>;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
export declare class PdfReader {
|
|
277
|
+
constructor(blob: Uint8Array);
|
|
278
|
+
getPage(pageNumber: number): PdfPage;
|
|
279
|
+
get pageCount(): number;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export type ImageOutputFormat = 'Jpeg' | 'Png' | 'Webp';
|
|
283
|
+
|
|
284
|
+
export interface JsGeometryClientOptions {
|
|
285
|
+
backgroundColor?: Array<number>;
|
|
286
|
+
}
|
|
3
287
|
export declare class ContourWrapper {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
288
|
+
/** Create a new contour wrapper from a contour input. */
|
|
289
|
+
constructor(contour: ContourInput);
|
|
290
|
+
/**
|
|
291
|
+
* Set the scale of the contour.
|
|
292
|
+
* This will rebuild the surface mesh.
|
|
293
|
+
*/
|
|
294
|
+
setScale(scale: Scale): void;
|
|
295
|
+
/** Get the id of the contour. */
|
|
296
|
+
get id(): string;
|
|
297
|
+
/** Get the page id of the contour. */
|
|
298
|
+
get pageId(): string;
|
|
299
|
+
/** Get the scale of the contour. */
|
|
300
|
+
get scale(): Scale | null;
|
|
301
|
+
/** Get the surface points of the contour. */
|
|
302
|
+
getSurfacePoints(): Array<Point3D> | null;
|
|
303
|
+
/** Get the z value at the given x and y coordinates. */
|
|
304
|
+
getZAt(x: number, y: number): number | null;
|
|
305
|
+
/** Get the scatter data of the contour. */
|
|
306
|
+
getScatterData(step: number): Array<Point3D> | null;
|
|
307
|
+
/** Get scaled scatter data of the contour. */
|
|
308
|
+
getRealWorldScatterData(step: number): Array<Point3D> | null;
|
|
309
|
+
/** Compute raw cut/fill volume (pixel-space values) against a reference surface. */
|
|
310
|
+
rawVolumeAgainst(
|
|
311
|
+
reference: ReferenceSurfaceInput,
|
|
312
|
+
cellSize?: number | undefined | null,
|
|
313
|
+
): VolumetricResult | null;
|
|
314
|
+
/**
|
|
315
|
+
* Compute unit-aware cut/fill volume against a reference surface.
|
|
316
|
+
* Returns None if surface mesh or scale is not available.
|
|
317
|
+
*/
|
|
318
|
+
volumeAgainst(
|
|
319
|
+
reference: ReferenceSurfaceInput,
|
|
320
|
+
cellSize?: number | undefined | null,
|
|
321
|
+
): VolumetricUnitResult | null;
|
|
34
322
|
}
|
|
35
323
|
|
|
36
324
|
export declare class GroupWrapper {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
325
|
+
/** Get the id of the group. */
|
|
326
|
+
get id(): string;
|
|
327
|
+
/**
|
|
328
|
+
* Get the area for this group.
|
|
329
|
+
*
|
|
330
|
+
* Returns `None` if the area has not been computed or if the mutex is poisoned.
|
|
331
|
+
*/
|
|
332
|
+
get area(): UnitValue | null;
|
|
333
|
+
/**
|
|
334
|
+
* Get the length for this group.
|
|
335
|
+
*
|
|
336
|
+
* Returns `None` if the length has not been computed or if the mutex is poisoned.
|
|
337
|
+
*/
|
|
338
|
+
get length(): UnitValue | null;
|
|
339
|
+
/**
|
|
340
|
+
* Get the points count for this group.
|
|
341
|
+
*
|
|
342
|
+
* Returns `None` if the points count has not been computed or if the mutex is poisoned.
|
|
343
|
+
*/
|
|
344
|
+
get points(): number | null;
|
|
345
|
+
/**
|
|
346
|
+
* Get the count for this group.
|
|
347
|
+
*
|
|
348
|
+
* Returns `None` if the count has not been computed or if the mutex is poisoned.
|
|
349
|
+
*/
|
|
350
|
+
get count(): number | null;
|
|
351
|
+
get group(): Group;
|
|
44
352
|
}
|
|
45
353
|
|
|
46
354
|
export declare class MeasurementWrapper {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
355
|
+
get points(): number;
|
|
356
|
+
get count(): number;
|
|
357
|
+
get measurement(): Measurement;
|
|
358
|
+
get area(): UnitValue | null;
|
|
359
|
+
convertArea(unit: Unit): number | null;
|
|
360
|
+
convertLength(unit: Unit): number | null;
|
|
361
|
+
get length(): UnitValue | null;
|
|
362
|
+
get scale(): Scale | null;
|
|
363
|
+
get id(): string;
|
|
364
|
+
get pageId(): string;
|
|
365
|
+
get groupId(): string;
|
|
366
|
+
get rawArea(): number;
|
|
367
|
+
get rawPerimeter(): number;
|
|
59
368
|
}
|
|
60
369
|
|
|
61
370
|
export declare class TakeoffStateHandler {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
371
|
+
/**
|
|
372
|
+
* Creates a new state.
|
|
373
|
+
*
|
|
374
|
+
* # Arguments
|
|
375
|
+
*
|
|
376
|
+
* * `options` - The options for the state.
|
|
377
|
+
*
|
|
378
|
+
* # Returns
|
|
379
|
+
*
|
|
380
|
+
* * `State` - The new state.
|
|
381
|
+
*/
|
|
382
|
+
constructor(options?: StateOptions | undefined | null);
|
|
383
|
+
getMeasurementsByGroupId(groupId: string): Array<MeasurementWrapper>;
|
|
384
|
+
/**
|
|
385
|
+
* Get the measurements by page id.
|
|
386
|
+
*
|
|
387
|
+
* # Arguments
|
|
388
|
+
*
|
|
389
|
+
* * `page_id` - The id of the page.
|
|
390
|
+
*
|
|
391
|
+
* # Returns
|
|
392
|
+
*
|
|
393
|
+
* * `Vec<MeasurementWrapper>` - The measurements that are on the page.
|
|
394
|
+
*/
|
|
395
|
+
getMeasurementsByPageId(pageId: string): Array<MeasurementWrapper>;
|
|
396
|
+
/**
|
|
397
|
+
* Get the scale for a measurement.
|
|
398
|
+
*
|
|
399
|
+
* # Arguments
|
|
400
|
+
*
|
|
401
|
+
* * `measurement_id` - The id of the measurement.
|
|
402
|
+
*
|
|
403
|
+
* # Returns
|
|
404
|
+
*
|
|
405
|
+
* * `None` - If the measurement was not found.
|
|
406
|
+
* * `Some(scale)` - If the scale was found.
|
|
407
|
+
*/
|
|
408
|
+
getMeasurementScale(measurementId: string): Scale | null;
|
|
409
|
+
/**
|
|
410
|
+
* Inserts or updates a page in the state.
|
|
411
|
+
*
|
|
412
|
+
* # Arguments
|
|
413
|
+
*
|
|
414
|
+
* * `page` - The page to insert or update.
|
|
415
|
+
*
|
|
416
|
+
* # Returns
|
|
417
|
+
*
|
|
418
|
+
* * `None` - If the page was not found.
|
|
419
|
+
* * `Some(page)` - If the page was found and updated.
|
|
420
|
+
*/
|
|
421
|
+
upsertPage(page: Page): Page | null;
|
|
422
|
+
removePage(pageId: string): Page | null;
|
|
423
|
+
getGroup(groupId: string): GroupWrapper | null;
|
|
424
|
+
/**
|
|
425
|
+
* Inserts or updates a group in the state.
|
|
426
|
+
*
|
|
427
|
+
* # Arguments
|
|
428
|
+
*
|
|
429
|
+
* * `group` - The group to insert or update.
|
|
430
|
+
*
|
|
431
|
+
* # Returns
|
|
432
|
+
*
|
|
433
|
+
* * `None` - If the group was not found.
|
|
434
|
+
* * `Some(group)` - If the group was found and updated.
|
|
435
|
+
*/
|
|
436
|
+
upsertGroup(group: Group): Group | null;
|
|
437
|
+
/**
|
|
438
|
+
* Removes a group from the state.
|
|
439
|
+
*
|
|
440
|
+
* # Arguments
|
|
441
|
+
*
|
|
442
|
+
* * `group_id` - The id of the group to remove.
|
|
443
|
+
*
|
|
444
|
+
* # Returns
|
|
445
|
+
* * `None` - If the group was not found.
|
|
446
|
+
* * `Some(group)` - If the group was found and removed.
|
|
447
|
+
*/
|
|
448
|
+
removeGroup(groupId: string): Group | null;
|
|
449
|
+
/**
|
|
450
|
+
* Inserts or updates a measurement in the state.
|
|
451
|
+
*
|
|
452
|
+
* # Arguments
|
|
453
|
+
*
|
|
454
|
+
* * `measurement` - The measurement to insert or update.
|
|
455
|
+
*
|
|
456
|
+
* # Returns
|
|
457
|
+
*
|
|
458
|
+
* * `None` - If the measurement was not found.
|
|
459
|
+
* * `Some(measurement)` - If the measurement was found and updated.
|
|
460
|
+
*/
|
|
461
|
+
upsertMeasurement(measurement: Measurement): Measurement | null;
|
|
462
|
+
/**
|
|
463
|
+
* Removes a measurement from the state.
|
|
464
|
+
*
|
|
465
|
+
* # Arguments
|
|
466
|
+
*
|
|
467
|
+
* * `measurement_id` - The id of the measurement to remove.
|
|
468
|
+
*
|
|
469
|
+
* # Returns
|
|
470
|
+
*
|
|
471
|
+
* * `None` - If the measurement was not found.
|
|
472
|
+
* * `Some(measurement)` - If the measurement was found and removed.
|
|
473
|
+
*/
|
|
474
|
+
removeMeasurement(measurementId: string): Measurement | null;
|
|
475
|
+
getMeasurement(measurementId: string): MeasurementWrapper | null;
|
|
476
|
+
/**
|
|
477
|
+
* Inserts or updates a scale in the state.
|
|
478
|
+
*
|
|
479
|
+
* # Arguments
|
|
480
|
+
*
|
|
481
|
+
* * `scale` - The scale to insert or update.
|
|
482
|
+
*
|
|
483
|
+
* # Returns
|
|
484
|
+
*
|
|
485
|
+
* * `None` - If the scale was not found.
|
|
486
|
+
* * `Some(scale)` - If the scale was found and updated.
|
|
487
|
+
*/
|
|
488
|
+
upsertScale(scale: Scale): Scale | null;
|
|
489
|
+
/**
|
|
490
|
+
* Removes a scale from the state.
|
|
491
|
+
*
|
|
492
|
+
* # Arguments
|
|
493
|
+
*
|
|
494
|
+
* * `scale_id` - The id of the scale to remove.
|
|
495
|
+
*
|
|
496
|
+
* # Returns
|
|
497
|
+
* * `None` - If the scale was not found.
|
|
498
|
+
* * `Some(scale)` - If the scale was found and removed.
|
|
499
|
+
*/
|
|
500
|
+
removeScale(scaleId: string): Scale | null;
|
|
501
|
+
/**
|
|
502
|
+
* Get the measurements that are missing a scale.
|
|
503
|
+
*
|
|
504
|
+
* # Returns
|
|
505
|
+
*
|
|
506
|
+
* * `Vec<MeasurementWrapper>` - The measurements that are missing a scale.
|
|
507
|
+
*/
|
|
508
|
+
getMeasurementsMissingScale(): Array<MeasurementWrapper>;
|
|
509
|
+
upsertContour(input: ContourInput): void;
|
|
510
|
+
removeContour(contourId: string): boolean;
|
|
511
|
+
getContour(contourId: string): ContourWrapper | null;
|
|
512
|
+
getContoursByPageId(pageId: string): Array<ContourWrapper>;
|
|
513
|
+
getContoursMissingScale(): Array<ContourWrapper>;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
export declare class VolumetricUnitResult {
|
|
517
|
+
get cut(): UnitValue;
|
|
518
|
+
get fill(): UnitValue;
|
|
519
|
+
get uncoveredArea(): UnitValue;
|
|
188
520
|
}
|
|
189
521
|
|
|
522
|
+
export declare function asyncMultiTwo(arg: number): Promise<number>;
|
|
523
|
+
|
|
190
524
|
/** Add 100 to the input */
|
|
191
525
|
export declare function plus100(input: number): number;
|
|
192
526
|
|
|
193
527
|
/** Add 200 to the input */
|
|
194
528
|
export declare function plus200(input: number): number;
|
|
529
|
+
|
|
530
|
+
/** Input for creating a reference surface from JS/TS. */
|
|
531
|
+
export type ReferenceSurfaceInputJs =
|
|
532
|
+
| { type: 'Polygon'; points: Array<Point>; elevation: number; unit: Unit }
|
|
533
|
+
| {
|
|
534
|
+
type: 'Rectangle';
|
|
535
|
+
points: [Point, Point];
|
|
536
|
+
elevation: number;
|
|
537
|
+
unit: Unit;
|
|
538
|
+
};
|
|
539
|
+
|
|
540
|
+
export declare function withinAsyncRuntimeIfAvailable(): void;
|
|
195
541
|
export declare class UnitValue {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
542
|
+
constructor(value: number, unit: Unit, magnitude: UnitValueItemType);
|
|
543
|
+
display(unit: Unit): string;
|
|
544
|
+
getConvertedValue(to: Unit): number;
|
|
199
545
|
}
|
|
200
546
|
|
|
201
547
|
export interface ContourInput {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
548
|
+
id: string;
|
|
549
|
+
name?: string;
|
|
550
|
+
pageId: string;
|
|
551
|
+
/** The lines that make up the contour map */
|
|
552
|
+
lines: Array<ContourLineInput>;
|
|
553
|
+
/** The points of interest that are used to create the contour map */
|
|
554
|
+
pointsOfInterest: Array<ContourPointOfInterestInput>;
|
|
209
555
|
}
|
|
210
556
|
|
|
211
557
|
export interface ContourLineInput {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
558
|
+
/** The elevation of the contour line (real-world value) */
|
|
559
|
+
elevation: number;
|
|
560
|
+
points: Array<Point>;
|
|
561
|
+
unit: Unit;
|
|
215
562
|
}
|
|
216
563
|
|
|
217
564
|
export interface ContourPointOfInterestInput {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
565
|
+
/** The elevation of the point of interest (real-world value) */
|
|
566
|
+
elevation: number;
|
|
567
|
+
point: Point;
|
|
568
|
+
unit: Unit;
|
|
221
569
|
}
|
|
222
570
|
|
|
223
571
|
/** Calculate distance between two points */
|
|
224
572
|
export declare function distance(
|
|
225
|
-
|
|
573
|
+
points: [Point, Point] | [Point3D, Point3D],
|
|
226
574
|
): number;
|
|
227
575
|
|
|
228
|
-
/**
|
|
576
|
+
/** Generate a random id */
|
|
577
|
+
export declare function generateRandomId(): string;
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* Get the centroid of a measurement
|
|
581
|
+
*
|
|
582
|
+
* Returns `None` if the measurement has invalid geometry.
|
|
583
|
+
* For more detailed error information, use `measurement.get_centroid()` directly.
|
|
584
|
+
*/
|
|
229
585
|
export declare function getCentroid(measurement: Measurement): Point | null;
|
|
230
586
|
|
|
231
587
|
export interface Group {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
588
|
+
id: string;
|
|
589
|
+
name?: string;
|
|
590
|
+
measurementType: MeasurementType;
|
|
235
591
|
}
|
|
236
592
|
|
|
237
593
|
export type Measurement =
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
export type MeasurementType =
|
|
594
|
+
| {
|
|
595
|
+
type: 'Count';
|
|
596
|
+
id: string;
|
|
597
|
+
pageId: string;
|
|
598
|
+
groupId: string;
|
|
599
|
+
points: [Point];
|
|
600
|
+
}
|
|
601
|
+
| {
|
|
602
|
+
type: 'Polygon';
|
|
603
|
+
id: string;
|
|
604
|
+
pageId: string;
|
|
605
|
+
groupId: string;
|
|
606
|
+
points: Array<Point>;
|
|
607
|
+
}
|
|
608
|
+
| {
|
|
609
|
+
type: 'Polyline';
|
|
610
|
+
id: string;
|
|
611
|
+
pageId: string;
|
|
612
|
+
groupId: string;
|
|
613
|
+
points: Array<Point>;
|
|
614
|
+
}
|
|
615
|
+
| {
|
|
616
|
+
type: 'Rectangle';
|
|
617
|
+
id: string;
|
|
618
|
+
pageId: string;
|
|
619
|
+
groupId: string;
|
|
620
|
+
points: [Point, Point];
|
|
621
|
+
};
|
|
622
|
+
|
|
623
|
+
export type MeasurementType = 'Area' | 'Linear' | 'Count';
|
|
268
624
|
|
|
269
625
|
export interface Page {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
626
|
+
id: string;
|
|
627
|
+
name?: string;
|
|
628
|
+
width?: number;
|
|
629
|
+
height?: number;
|
|
630
|
+
viewport?: PageViewport;
|
|
275
631
|
}
|
|
276
632
|
|
|
277
633
|
export interface PageViewport {
|
|
278
|
-
|
|
279
|
-
|
|
634
|
+
width: number;
|
|
635
|
+
height: number;
|
|
280
636
|
}
|
|
281
637
|
|
|
282
638
|
/** Represents a 2D point with floating point coordinates */
|
|
283
639
|
export interface Point {
|
|
284
|
-
|
|
285
|
-
|
|
640
|
+
x: number;
|
|
641
|
+
y: number;
|
|
286
642
|
}
|
|
287
643
|
|
|
288
644
|
export interface Point3D {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
645
|
+
x: number;
|
|
646
|
+
y: number;
|
|
647
|
+
z: number;
|
|
292
648
|
}
|
|
293
649
|
|
|
294
650
|
/** Input for creating a reference surface from JS/TS. */
|
|
295
651
|
export type ReferenceSurfaceInput =
|
|
296
|
-
|
|
297
|
-
|
|
652
|
+
| { type: 'Polygon'; points: Array<Point>; elevation: number }
|
|
653
|
+
| { type: 'Rectangle'; points: [Point, Point]; elevation: number };
|
|
654
|
+
|
|
655
|
+
/**
|
|
656
|
+
* Reposition a measurement so its centroid is at the given point.
|
|
657
|
+
* Returns a new measurement (same kind and metadata); area, length, and count are unchanged.
|
|
658
|
+
*
|
|
659
|
+
* # Errors
|
|
660
|
+
*
|
|
661
|
+
* Returns an error if the measurement has invalid or empty geometry (e.g. `EmptyGeometry`).
|
|
662
|
+
*/
|
|
663
|
+
export declare function repositionMeasurementToCentroid(
|
|
664
|
+
measurement: Measurement,
|
|
665
|
+
newCentroid: Point,
|
|
666
|
+
): Measurement;
|
|
298
667
|
|
|
299
668
|
export type Scale =
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
669
|
+
| {
|
|
670
|
+
type: 'Area';
|
|
671
|
+
id: string;
|
|
672
|
+
pageId: string;
|
|
673
|
+
scale: ScaleDefinition;
|
|
674
|
+
boundingBox: [Point, Point];
|
|
675
|
+
}
|
|
676
|
+
| { type: 'Default'; id: string; pageId: string; scale: ScaleDefinition };
|
|
308
677
|
|
|
309
678
|
export interface ScaleDefinition {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
679
|
+
pixelDistance: number;
|
|
680
|
+
realDistance: number;
|
|
681
|
+
unit: Unit;
|
|
313
682
|
}
|
|
314
683
|
|
|
315
684
|
/** Simplify a polyline using the Ramer-Douglas-Peucker algorithm */
|
|
316
685
|
export declare function simplifyPolyline(
|
|
317
|
-
|
|
318
|
-
|
|
686
|
+
points: Array<Point>,
|
|
687
|
+
tolerance: number,
|
|
319
688
|
): Array<Point>;
|
|
320
689
|
|
|
321
690
|
export interface StateOptions {
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
691
|
+
pages: Array<Page>;
|
|
692
|
+
groups: Array<Group>;
|
|
693
|
+
measurements: Array<Measurement>;
|
|
694
|
+
scales: Array<Scale>;
|
|
326
695
|
}
|
|
327
696
|
|
|
328
697
|
/** Measurement units supported by the system */
|
|
329
698
|
export type Unit =
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
699
|
+
/** Imperial units */
|
|
700
|
+
| 'Yards'
|
|
701
|
+
| 'Feet'
|
|
702
|
+
| 'Inches'
|
|
703
|
+
/** Metric units */
|
|
704
|
+
| 'Meters'
|
|
705
|
+
| 'Centimeters';
|
|
337
706
|
|
|
338
|
-
export type UnitValueItemType =
|
|
707
|
+
export type UnitValueItemType = 'Area' | 'Length' | 'Volume';
|
|
339
708
|
|
|
340
709
|
/** Result of a volumetric cut/fill calculation. */
|
|
341
710
|
export interface VolumetricResult {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
711
|
+
/** Volume to remove (terrain above reference). */
|
|
712
|
+
cut: number;
|
|
713
|
+
/** Volume to add (terrain below reference). */
|
|
714
|
+
fill: number;
|
|
715
|
+
/** Area where terrain data was unavailable (z_at returned None). */
|
|
716
|
+
uncoveredArea: number;
|
|
348
717
|
}
|