@build-qube/takeoff-calculator 2.0.3 → 2.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/index.d.ts +304 -171
- package/index.js +754 -749
- package/package.json +11 -31
package/index.d.ts
CHANGED
|
@@ -1,215 +1,348 @@
|
|
|
1
1
|
/* auto-generated by NAPI-RS */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
export declare class ContourWrapper {
|
|
4
|
+
constructor(contour: ContourInput);
|
|
5
|
+
/** Get the surface points for the contour. */
|
|
6
|
+
getSurfacePoints(): Array<Point3D> | null;
|
|
7
|
+
/**
|
|
8
|
+
* Compute cut/fill volume against a reference surface.
|
|
9
|
+
* Returns None if the surface mesh is not available (e.g. contour conversion failed).
|
|
10
|
+
*/
|
|
11
|
+
volumeAgainst(
|
|
12
|
+
reference: ReferenceSurfaceInput,
|
|
13
|
+
cellSize?: number | undefined | null,
|
|
14
|
+
): VolumetricResult | null;
|
|
15
|
+
/**
|
|
16
|
+
* Get the z value at a given x, y coordinate.
|
|
17
|
+
* Returns None if the surface mesh is not available (e.g. contour conversion failed).
|
|
18
|
+
*/
|
|
19
|
+
getZAt(x: number, y: number): number | null;
|
|
20
|
+
/**
|
|
21
|
+
* Get scatter data for the contour.
|
|
22
|
+
* Returns None if the surface mesh is not available (e.g. contour conversion failed).
|
|
23
|
+
*
|
|
24
|
+
* # Arguments
|
|
25
|
+
*
|
|
26
|
+
* * `step` - The step size for the scatter data.
|
|
27
|
+
*
|
|
28
|
+
* # Returns
|
|
29
|
+
*
|
|
30
|
+
* * `Vec<Point3D>` - The scatter data.
|
|
31
|
+
* * `None` - If the surface mesh is not available (e.g. contour conversion failed).
|
|
32
|
+
*/
|
|
33
|
+
getScatterData(step: number): Array<Point3D> | null;
|
|
34
|
+
}
|
|
35
|
+
|
|
3
36
|
export declare class GroupWrapper {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
37
|
+
/** Get the id of the group. */
|
|
38
|
+
get id(): string;
|
|
39
|
+
get area(): UnitValue | null;
|
|
40
|
+
get length(): UnitValue | null;
|
|
41
|
+
get points(): number | null;
|
|
42
|
+
get count(): number | null;
|
|
43
|
+
get group(): Group;
|
|
10
44
|
}
|
|
11
45
|
|
|
12
46
|
export declare class MeasurementWrapper {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
47
|
+
get points(): number;
|
|
48
|
+
get measurement(): Measurement;
|
|
49
|
+
get area(): UnitValue | null;
|
|
50
|
+
convertArea(unit: Unit): number | null;
|
|
51
|
+
convertLength(unit: Unit): number | null;
|
|
52
|
+
get length(): UnitValue | null;
|
|
53
|
+
get scale(): Scale | null;
|
|
54
|
+
get id(): string;
|
|
55
|
+
get pageId(): string;
|
|
56
|
+
get groupId(): string;
|
|
57
|
+
get rawArea(): number;
|
|
58
|
+
get rawPerimeter(): number;
|
|
25
59
|
}
|
|
26
60
|
|
|
27
61
|
export declare class TakeoffStateHandler {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
-
|
|
62
|
+
/**
|
|
63
|
+
* Creates a new state.
|
|
64
|
+
*
|
|
65
|
+
* # Arguments
|
|
66
|
+
*
|
|
67
|
+
* * `options` - The options for the state.
|
|
68
|
+
*
|
|
69
|
+
* # Returns
|
|
70
|
+
*
|
|
71
|
+
* * `State` - The new state.
|
|
72
|
+
*/
|
|
73
|
+
constructor(options?: StateOptions | undefined | null);
|
|
74
|
+
getMeasurementsByGroupId(groupId: string): Array<MeasurementWrapper>;
|
|
75
|
+
/**
|
|
76
|
+
* Get the scale for a measurement.
|
|
77
|
+
*
|
|
78
|
+
* # Arguments
|
|
79
|
+
*
|
|
80
|
+
* * `measurement_id` - The id of the measurement.
|
|
81
|
+
*
|
|
82
|
+
* # Returns
|
|
83
|
+
*
|
|
84
|
+
* * `None` - If the measurement was not found.
|
|
85
|
+
* * `Some(scale)` - If the scale was found.
|
|
86
|
+
*/
|
|
87
|
+
getMeasurementScale(measurementId: string): Scale | null;
|
|
88
|
+
/**
|
|
89
|
+
* Inserts or updates a page in the state.
|
|
90
|
+
*
|
|
91
|
+
* # Arguments
|
|
92
|
+
*
|
|
93
|
+
* * `page` - The page to insert or update.
|
|
94
|
+
*
|
|
95
|
+
* # Returns
|
|
96
|
+
*
|
|
97
|
+
* * `None` - If the page was not found.
|
|
98
|
+
* * `Some(page)` - If the page was found and updated.
|
|
99
|
+
*/
|
|
100
|
+
upsertPage(page: Page): Page | null;
|
|
101
|
+
removePage(pageId: string): Page | null;
|
|
102
|
+
getGroup(groupId: string): GroupWrapper | null;
|
|
103
|
+
/**
|
|
104
|
+
* Inserts or updates a group in the state.
|
|
105
|
+
*
|
|
106
|
+
* # Arguments
|
|
107
|
+
*
|
|
108
|
+
* * `group` - The group to insert or update.
|
|
109
|
+
*
|
|
110
|
+
* # Returns
|
|
111
|
+
*
|
|
112
|
+
* * `None` - If the group was not found.
|
|
113
|
+
* * `Some(group)` - If the group was found and updated.
|
|
114
|
+
*/
|
|
115
|
+
upsertGroup(group: Group): Group | null;
|
|
116
|
+
/**
|
|
117
|
+
* Removes a group from the state.
|
|
118
|
+
*
|
|
119
|
+
* # Arguments
|
|
120
|
+
*
|
|
121
|
+
* * `group_id` - The id of the group to remove.
|
|
122
|
+
*
|
|
123
|
+
* # Returns
|
|
124
|
+
* * `None` - If the group was not found.
|
|
125
|
+
* * `Some(group)` - If the group was found and removed.
|
|
126
|
+
*/
|
|
127
|
+
removeGroup(groupId: string): Group | null;
|
|
128
|
+
/**
|
|
129
|
+
* Inserts or updates a measurement in the state.
|
|
130
|
+
*
|
|
131
|
+
* # Arguments
|
|
132
|
+
*
|
|
133
|
+
* * `measurement` - The measurement to insert or update.
|
|
134
|
+
*
|
|
135
|
+
* # Returns
|
|
136
|
+
*
|
|
137
|
+
* * `None` - If the measurement was not found.
|
|
138
|
+
* * `Some(measurement)` - If the measurement was found and updated.
|
|
139
|
+
*/
|
|
140
|
+
upsertMeasurement(measurement: Measurement): Measurement | null;
|
|
141
|
+
/**
|
|
142
|
+
* Removes a measurement from the state.
|
|
143
|
+
*
|
|
144
|
+
* # Arguments
|
|
145
|
+
*
|
|
146
|
+
* * `measurement_id` - The id of the measurement to remove.
|
|
147
|
+
*
|
|
148
|
+
* # Returns
|
|
149
|
+
*
|
|
150
|
+
* * `None` - If the measurement was not found.
|
|
151
|
+
* * `Some(measurement)` - If the measurement was found and removed.
|
|
152
|
+
*/
|
|
153
|
+
removeMeasurement(measurementId: string): Measurement | null;
|
|
154
|
+
getMeasurement(measurementId: string): MeasurementWrapper | null;
|
|
155
|
+
/**
|
|
156
|
+
* Inserts or updates a scale in the state.
|
|
157
|
+
*
|
|
158
|
+
* # Arguments
|
|
159
|
+
*
|
|
160
|
+
* * `scale` - The scale to insert or update.
|
|
161
|
+
*
|
|
162
|
+
* # Returns
|
|
163
|
+
*
|
|
164
|
+
* * `None` - If the scale was not found.
|
|
165
|
+
* * `Some(scale)` - If the scale was found and updated.
|
|
166
|
+
*/
|
|
167
|
+
upsertScale(scale: Scale): Scale | null;
|
|
168
|
+
/**
|
|
169
|
+
* Removes a scale from the state.
|
|
170
|
+
*
|
|
171
|
+
* # Arguments
|
|
172
|
+
*
|
|
173
|
+
* * `scale_id` - The id of the scale to remove.
|
|
174
|
+
*
|
|
175
|
+
* # Returns
|
|
176
|
+
* * `None` - If the scale was not found.
|
|
177
|
+
* * `Some(scale)` - If the scale was found and removed.
|
|
178
|
+
*/
|
|
179
|
+
removeScale(scaleId: string): Scale | null;
|
|
180
|
+
/**
|
|
181
|
+
* Get the measurements that are missing a scale.
|
|
182
|
+
*
|
|
183
|
+
* # Returns
|
|
184
|
+
*
|
|
185
|
+
* * `Vec<MeasurementWrapper>` - The measurements that are missing a scale.
|
|
186
|
+
*/
|
|
187
|
+
getMeasurementsMissingScale(): Array<MeasurementWrapper>;
|
|
116
188
|
}
|
|
117
189
|
|
|
190
|
+
/** Add 100 to the input */
|
|
118
191
|
export declare function plus100(input: number): number;
|
|
192
|
+
|
|
193
|
+
/** Add 200 to the input */
|
|
194
|
+
export declare function plus200(input: number): number;
|
|
119
195
|
export declare class UnitValue {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
196
|
+
constructor(value: number, unit: Unit, magnitude: UnitValueItemType);
|
|
197
|
+
display(unit: Unit): string;
|
|
198
|
+
getConvertedValue(to: Unit): number;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export interface ContourInput {
|
|
202
|
+
id: string;
|
|
203
|
+
name?: string;
|
|
204
|
+
pageId: string;
|
|
205
|
+
/** The lines that make up the contour map */
|
|
206
|
+
lines: Array<ContourLineInput>;
|
|
207
|
+
/** The points of interest that are used to create the contour map */
|
|
208
|
+
pointsOfInterest: Array<ContourPointOfInterestInput>;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export interface ContourLineInput {
|
|
212
|
+
/** The elevation of the contour line (in pixels) */
|
|
213
|
+
elevation: number;
|
|
214
|
+
points: Array<Point>;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export interface ContourPointOfInterestInput {
|
|
218
|
+
/** The elevation of the point of interest (in pixels) */
|
|
219
|
+
elevation: number;
|
|
220
|
+
point: Point;
|
|
123
221
|
}
|
|
124
222
|
|
|
223
|
+
/** Calculate distance between two points */
|
|
224
|
+
export declare function distance(
|
|
225
|
+
points: [Point, Point] | [Point3D, Point3D],
|
|
226
|
+
): number;
|
|
227
|
+
|
|
228
|
+
/** Get the centroid of a measurement */
|
|
229
|
+
export declare function getCentroid(measurement: Measurement): Point | null;
|
|
230
|
+
|
|
125
231
|
export interface Group {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
232
|
+
id: string;
|
|
233
|
+
name?: string;
|
|
234
|
+
measurementType: MeasurementType;
|
|
129
235
|
}
|
|
130
236
|
|
|
131
237
|
export type Measurement =
|
|
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
|
-
|
|
238
|
+
| {
|
|
239
|
+
type: "Count";
|
|
240
|
+
id: string;
|
|
241
|
+
pageId: string;
|
|
242
|
+
groupId: string;
|
|
243
|
+
points: [Point];
|
|
244
|
+
}
|
|
245
|
+
| {
|
|
246
|
+
type: "Polygon";
|
|
247
|
+
id: string;
|
|
248
|
+
pageId: string;
|
|
249
|
+
groupId: string;
|
|
250
|
+
points: Array<Point>;
|
|
251
|
+
}
|
|
252
|
+
| {
|
|
253
|
+
type: "Polyline";
|
|
254
|
+
id: string;
|
|
255
|
+
pageId: string;
|
|
256
|
+
groupId: string;
|
|
257
|
+
points: Array<Point>;
|
|
258
|
+
}
|
|
259
|
+
| {
|
|
260
|
+
type: "Rectangle";
|
|
261
|
+
id: string;
|
|
262
|
+
pageId: string;
|
|
263
|
+
groupId: string;
|
|
264
|
+
points: [Point, Point];
|
|
265
|
+
};
|
|
160
266
|
|
|
161
267
|
export type MeasurementType = "Area" | "Linear" | "Count";
|
|
162
268
|
|
|
163
269
|
export interface Page {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
270
|
+
id: string;
|
|
271
|
+
name?: string;
|
|
272
|
+
width?: number;
|
|
273
|
+
height?: number;
|
|
274
|
+
viewport?: PageViewport;
|
|
169
275
|
}
|
|
170
276
|
|
|
171
277
|
export interface PageViewport {
|
|
172
|
-
|
|
173
|
-
|
|
278
|
+
width: number;
|
|
279
|
+
height: number;
|
|
174
280
|
}
|
|
175
281
|
|
|
176
282
|
/** Represents a 2D point with floating point coordinates */
|
|
177
283
|
export interface Point {
|
|
178
|
-
|
|
179
|
-
|
|
284
|
+
x: number;
|
|
285
|
+
y: number;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
export interface Point3D {
|
|
289
|
+
x: number;
|
|
290
|
+
y: number;
|
|
291
|
+
z: number;
|
|
180
292
|
}
|
|
181
293
|
|
|
294
|
+
/** Input for creating a reference surface from JS/TS. */
|
|
295
|
+
export type ReferenceSurfaceInput =
|
|
296
|
+
| { type: "Polygon"; points: Array<Point>; elevation: number }
|
|
297
|
+
| { type: "Rectangle"; points: [Point, Point]; elevation: number };
|
|
298
|
+
|
|
182
299
|
export type Scale =
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
300
|
+
| {
|
|
301
|
+
type: "Area";
|
|
302
|
+
id: string;
|
|
303
|
+
pageId: string;
|
|
304
|
+
scale: ScaleDefinition;
|
|
305
|
+
boundingBox: [Point, Point];
|
|
306
|
+
}
|
|
307
|
+
| { type: "Default"; id: string; pageId: string; scale: ScaleDefinition };
|
|
191
308
|
|
|
192
309
|
export interface ScaleDefinition {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
310
|
+
pixelDistance: number;
|
|
311
|
+
realDistance: number;
|
|
312
|
+
unit: Unit;
|
|
196
313
|
}
|
|
197
314
|
|
|
315
|
+
/** Simplify a polyline using the Ramer-Douglas-Peucker algorithm */
|
|
316
|
+
export declare function simplifyPolyline(
|
|
317
|
+
points: Array<Point>,
|
|
318
|
+
tolerance: number,
|
|
319
|
+
): Array<Point>;
|
|
320
|
+
|
|
198
321
|
export interface StateOptions {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
322
|
+
pages: Array<Page>;
|
|
323
|
+
groups: Array<Group>;
|
|
324
|
+
measurements: Array<Measurement>;
|
|
325
|
+
scales: Array<Scale>;
|
|
203
326
|
}
|
|
204
327
|
|
|
205
328
|
/** Measurement units supported by the system */
|
|
206
329
|
export type Unit =
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
330
|
+
/** Imperial units */
|
|
331
|
+
| "Yards"
|
|
332
|
+
| "Feet"
|
|
333
|
+
| "Inches"
|
|
334
|
+
/** Metric units */
|
|
335
|
+
| "Meters"
|
|
336
|
+
| "Centimeters";
|
|
214
337
|
|
|
215
338
|
export type UnitValueItemType = "Area" | "Length";
|
|
339
|
+
|
|
340
|
+
/** Result of a volumetric cut/fill calculation. */
|
|
341
|
+
export interface VolumetricResult {
|
|
342
|
+
/** Volume to remove (terrain above reference). */
|
|
343
|
+
cut: number;
|
|
344
|
+
/** Volume to add (terrain below reference). */
|
|
345
|
+
fill: number;
|
|
346
|
+
/** Area where terrain data was unavailable (z_at returned None). */
|
|
347
|
+
uncoveredArea: number;
|
|
348
|
+
}
|