@snaptrude/plugin-core 0.3.0 → 0.5.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/AGENTS.md +130 -48
- package/CHANGELOG.md +111 -0
- package/api-manifest.full.json +3999 -0
- package/api-manifest.json +3845 -0
- package/dist/api/core/buildings.d.ts +427 -0
- package/dist/api/core/buildings.d.ts.map +1 -0
- package/dist/api/core/comment/index.d.ts +230 -0
- package/dist/api/core/comment/index.d.ts.map +1 -0
- package/dist/api/core/geom/create/index.d.ts +247 -0
- package/dist/api/core/geom/create/index.d.ts.map +1 -0
- package/dist/api/core/geom/delete/index.d.ts +72 -0
- package/dist/api/core/geom/delete/index.d.ts.map +1 -0
- package/dist/api/core/geom/index.d.ts +24 -23
- package/dist/api/core/geom/index.d.ts.map +1 -1
- package/dist/api/core/geom/query/arc.d.ts +169 -0
- package/dist/api/core/geom/query/arc.d.ts.map +1 -0
- package/dist/api/core/geom/query/brep.d.ts +402 -0
- package/dist/api/core/geom/query/brep.d.ts.map +1 -0
- package/dist/api/core/geom/query/circle.d.ts +378 -0
- package/dist/api/core/geom/query/circle.d.ts.map +1 -0
- package/dist/api/core/geom/query/contour.d.ts +450 -0
- package/dist/api/core/geom/query/contour.d.ts.map +1 -0
- package/dist/api/core/geom/query/curve.d.ts +918 -0
- package/dist/api/core/geom/query/curve.d.ts.map +1 -0
- package/dist/api/core/geom/query/edge.d.ts +128 -0
- package/dist/api/core/geom/query/edge.d.ts.map +1 -0
- package/dist/api/core/geom/query/face.d.ts +363 -0
- package/dist/api/core/geom/query/face.d.ts.map +1 -0
- package/dist/api/core/geom/query/halfedge.d.ts +206 -0
- package/dist/api/core/geom/query/halfedge.d.ts.map +1 -0
- package/dist/api/core/geom/query/index.d.ts +61 -0
- package/dist/api/core/geom/query/index.d.ts.map +1 -0
- package/dist/api/core/geom/query/profile.d.ts +410 -0
- package/dist/api/core/geom/query/profile.d.ts.map +1 -0
- package/dist/api/core/geom/query/vertex.d.ts +187 -0
- package/dist/api/core/geom/query/vertex.d.ts.map +1 -0
- package/dist/api/core/geom/update/contour.d.ts +272 -0
- package/dist/api/core/geom/update/contour.d.ts.map +1 -0
- package/dist/api/core/geom/update/curve.d.ts +180 -0
- package/dist/api/core/geom/update/curve.d.ts.map +1 -0
- package/dist/api/core/geom/update/index.d.ts +27 -0
- package/dist/api/core/geom/update/index.d.ts.map +1 -0
- package/dist/api/core/geom/update/profile.d.ts +329 -0
- package/dist/api/core/geom/update/profile.d.ts.map +1 -0
- package/dist/api/core/groups.d.ts +485 -0
- package/dist/api/core/groups.d.ts.map +1 -0
- package/dist/api/core/history/index.d.ts +78 -0
- package/dist/api/core/history/index.d.ts.map +1 -0
- package/dist/api/core/index.d.ts +46 -1
- package/dist/api/core/index.d.ts.map +1 -1
- package/dist/api/core/layers.d.ts +402 -0
- package/dist/api/core/layers.d.ts.map +1 -0
- package/dist/api/core/math/quat.d.ts +111 -128
- package/dist/api/core/math/quat.d.ts.map +1 -1
- package/dist/api/core/math/vec3.d.ts +120 -102
- package/dist/api/core/math/vec3.d.ts.map +1 -1
- package/dist/api/core/project/index.d.ts +399 -0
- package/dist/api/core/project/index.d.ts.map +1 -0
- package/dist/api/core/tags.d.ts +755 -0
- package/dist/api/core/tags.d.ts.map +1 -0
- package/dist/api/core/units/index.d.ts +175 -0
- package/dist/api/core/units/index.d.ts.map +1 -0
- package/dist/api/core/zoom/index.d.ts +45 -0
- package/dist/api/core/zoom/index.d.ts.map +1 -0
- package/dist/api/design/boolean/index.d.ts +168 -0
- package/dist/api/design/boolean/index.d.ts.map +1 -0
- package/dist/api/design/create/index.d.ts +828 -0
- package/dist/api/design/create/index.d.ts.map +1 -0
- package/dist/api/design/delete/index.d.ts +63 -0
- package/dist/api/design/delete/index.d.ts.map +1 -0
- package/dist/api/design/doors/index.d.ts +268 -0
- package/dist/api/design/doors/index.d.ts.map +1 -0
- package/dist/api/design/edit/index.d.ts +49 -0
- package/dist/api/design/edit/index.d.ts.map +1 -0
- package/dist/api/design/erase/index.d.ts +160 -0
- package/dist/api/design/erase/index.d.ts.map +1 -0
- package/dist/api/design/furniture/index.d.ts +123 -0
- package/dist/api/design/furniture/index.d.ts.map +1 -0
- package/dist/api/design/index.d.ts +153 -0
- package/dist/api/design/index.d.ts.map +1 -0
- package/dist/api/design/lock.d.ts +41 -0
- package/dist/api/design/lock.d.ts.map +1 -0
- package/dist/api/design/materials/index.d.ts +297 -0
- package/dist/api/design/materials/index.d.ts.map +1 -0
- package/dist/api/design/query/geometry/index.d.ts +140 -0
- package/dist/api/design/query/geometry/index.d.ts.map +1 -0
- package/dist/api/design/query/index.d.ts +1011 -0
- package/dist/api/design/query/index.d.ts.map +1 -0
- package/dist/api/design/query/spaces.d.ts +221 -0
- package/dist/api/design/query/spaces.d.ts.map +1 -0
- package/dist/api/design/selection/index.d.ts +138 -0
- package/dist/api/design/selection/index.d.ts.map +1 -0
- package/dist/api/design/shared.d.ts +38 -0
- package/dist/api/design/shared.d.ts.map +1 -0
- package/dist/api/design/transform/index.d.ts +87 -0
- package/dist/api/design/transform/index.d.ts.map +1 -0
- package/dist/api/design/update/index.d.ts +178 -0
- package/dist/api/design/update/index.d.ts.map +1 -0
- package/dist/api/design/windows/index.d.ts +189 -0
- package/dist/api/design/windows/index.d.ts.map +1 -0
- package/dist/api/entity/buildableEnvelope.d.ts +261 -0
- package/dist/api/entity/buildableEnvelope.d.ts.map +1 -0
- package/dist/api/entity/department.d.ts +0 -98
- package/dist/api/entity/department.d.ts.map +1 -1
- package/dist/api/entity/index.d.ts +9 -9
- package/dist/api/entity/index.d.ts.map +1 -1
- package/dist/api/entity/referenceLine.d.ts +49 -106
- package/dist/api/entity/referenceLine.d.ts.map +1 -1
- package/dist/api/entity/space.d.ts +482 -249
- package/dist/api/entity/space.d.ts.map +1 -1
- package/dist/api/entity/story.d.ts +49 -39
- package/dist/api/entity/story.d.ts.map +1 -1
- package/dist/api/index.d.ts +17 -12
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/presentation/aiInspiration.d.ts +440 -0
- package/dist/api/presentation/aiInspiration.d.ts.map +1 -0
- package/dist/api/presentation/diagrams.d.ts +81 -0
- package/dist/api/presentation/diagrams.d.ts.map +1 -0
- package/dist/api/presentation/import.d.ts +113 -0
- package/dist/api/presentation/import.d.ts.map +1 -0
- package/dist/api/presentation/index.d.ts +46 -0
- package/dist/api/presentation/index.d.ts.map +1 -0
- package/dist/api/presentation/sheets.d.ts +176 -0
- package/dist/api/presentation/sheets.d.ts.map +1 -0
- package/dist/api/presentation/views.d.ts +296 -0
- package/dist/api/presentation/views.d.ts.map +1 -0
- package/dist/api/program/adjacency.d.ts +155 -0
- package/dist/api/program/adjacency.d.ts.map +1 -0
- package/dist/api/program/areas.d.ts +360 -0
- package/dist/api/program/areas.d.ts.map +1 -0
- package/dist/api/program/classification.d.ts +135 -0
- package/dist/api/program/classification.d.ts.map +1 -0
- package/dist/api/program/cores.d.ts +174 -0
- package/dist/api/program/cores.d.ts.map +1 -0
- package/dist/api/program/departments.d.ts +431 -0
- package/dist/api/program/departments.d.ts.map +1 -0
- package/dist/api/program/index.d.ts +69 -0
- package/dist/api/program/index.d.ts.map +1 -0
- package/dist/api/program/layout.d.ts +63 -0
- package/dist/api/program/layout.d.ts.map +1 -0
- package/dist/api/program/metrics.d.ts +108 -0
- package/dist/api/program/metrics.d.ts.map +1 -0
- package/dist/api/program/site.d.ts +367 -0
- package/dist/api/program/site.d.ts.map +1 -0
- package/dist/api/program/spreadsheet.d.ts +2041 -0
- package/dist/api/program/spreadsheet.d.ts.map +1 -0
- package/dist/handles.d.ts +138 -0
- package/dist/handles.d.ts.map +1 -0
- package/dist/host-utils.d.ts +7 -5
- package/dist/host-utils.d.ts.map +1 -1
- package/dist/index.cjs +4001 -904
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3392 -870
- package/dist/index.js.map +1 -1
- package/package.json +6 -2
- package/scripts/generate-manifest.mjs +193 -0
- package/scripts/generate-manifest.test.mjs +193 -0
- package/src/api/core/buildings.ts +485 -0
- package/src/api/core/comment/index.ts +258 -0
- package/src/api/core/geom/create/index.ts +293 -0
- package/src/api/core/geom/delete/index.ts +78 -0
- package/src/api/core/geom/index.ts +24 -23
- package/src/api/core/geom/query/arc.ts +169 -0
- package/src/api/core/geom/query/brep.ts +444 -0
- package/src/api/core/geom/query/circle.ts +404 -0
- package/src/api/core/geom/query/contour.ts +540 -0
- package/src/api/core/geom/query/curve.ts +1078 -0
- package/src/api/core/geom/query/edge.ts +130 -0
- package/src/api/core/geom/query/face.ts +403 -0
- package/src/api/core/geom/query/halfedge.ts +210 -0
- package/src/api/core/geom/query/index.ts +63 -0
- package/src/api/core/geom/query/profile.ts +473 -0
- package/src/api/core/geom/query/vertex.ts +205 -0
- package/src/api/core/geom/update/contour.ts +315 -0
- package/src/api/core/geom/update/curve.ts +209 -0
- package/src/api/core/geom/update/index.ts +29 -0
- package/src/api/core/geom/update/profile.ts +377 -0
- package/src/api/core/groups.ts +521 -0
- package/src/api/core/history/index.ts +84 -0
- package/src/api/core/index.ts +46 -1
- package/src/api/core/layers.ts +333 -0
- package/src/api/core/math/quat.ts +112 -235
- package/src/api/core/math/vec3.ts +124 -159
- package/src/api/core/project/index.ts +418 -0
- package/src/api/core/tags.ts +808 -0
- package/src/api/core/units/index.ts +164 -0
- package/src/api/core/zoom/index.ts +47 -0
- package/src/api/design/boolean/index.ts +179 -0
- package/src/api/design/create/index.ts +886 -0
- package/src/api/design/delete/index.ts +67 -0
- package/src/api/design/doors/index.ts +285 -0
- package/src/api/design/edit/index.ts +54 -0
- package/src/api/design/erase/index.ts +151 -0
- package/src/api/design/furniture/index.ts +130 -0
- package/src/api/design/index.ts +162 -0
- package/src/api/design/lock.ts +42 -0
- package/src/api/design/materials/index.ts +301 -0
- package/src/api/design/query/geometry/index.ts +166 -0
- package/src/api/design/query/index.ts +937 -0
- package/src/api/design/query/spaces.ts +132 -0
- package/src/api/design/selection/index.ts +144 -0
- package/src/api/design/shared.ts +40 -0
- package/src/api/design/transform/index.ts +93 -0
- package/src/api/design/update/index.ts +117 -0
- package/src/api/design/windows/index.ts +207 -0
- package/src/api/entity/buildableEnvelope.ts +318 -0
- package/src/api/entity/department.ts +0 -113
- package/src/api/entity/index.ts +9 -9
- package/src/api/entity/referenceLine.ts +50 -38
- package/src/api/entity/space.ts +285 -226
- package/src/api/entity/story.ts +53 -42
- package/src/api/index.ts +17 -12
- package/src/api/presentation/aiInspiration.ts +362 -0
- package/src/api/presentation/diagrams.ts +84 -0
- package/src/api/presentation/import.ts +112 -0
- package/src/api/presentation/index.ts +48 -0
- package/src/api/presentation/sheets.ts +198 -0
- package/src/api/presentation/views.ts +303 -0
- package/src/api/program/adjacency.ts +164 -0
- package/src/api/program/areas.ts +335 -0
- package/src/api/program/classification.ts +138 -0
- package/src/api/program/cores.ts +171 -0
- package/src/api/program/departments.ts +465 -0
- package/src/api/program/index.ts +71 -0
- package/src/api/program/layout.ts +68 -0
- package/src/api/program/metrics.ts +120 -0
- package/src/api/program/site.ts +326 -0
- package/src/api/program/spreadsheet.ts +2075 -0
- package/src/handles.ts +148 -0
- package/src/host-utils.ts +10 -6
- package/src/index.ts +1 -0
- package/dist/api/core/geom/arc.d.ts +0 -81
- package/dist/api/core/geom/arc.d.ts.map +0 -1
- package/dist/api/core/geom/curve.d.ts +0 -70
- package/dist/api/core/geom/curve.d.ts.map +0 -1
- package/dist/api/core/geom/line.d.ts +0 -56
- package/dist/api/core/geom/line.d.ts.map +0 -1
- package/dist/api/core/geom/profile.d.ts +0 -121
- package/dist/api/core/geom/profile.d.ts.map +0 -1
- package/dist/api/tools/copy.d.ts +0 -59
- package/dist/api/tools/copy.d.ts.map +0 -1
- package/dist/api/tools/index.d.ts +0 -33
- package/dist/api/tools/index.d.ts.map +0 -1
- package/dist/api/tools/material.d.ts +0 -51
- package/dist/api/tools/material.d.ts.map +0 -1
- package/dist/api/tools/offset.d.ts +0 -43
- package/dist/api/tools/offset.d.ts.map +0 -1
- package/dist/api/tools/selection.d.ts +0 -48
- package/dist/api/tools/selection.d.ts.map +0 -1
- package/dist/api/tools/transform.d.ts +0 -114
- package/dist/api/tools/transform.d.ts.map +0 -1
- package/dist/api/units/index.d.ts +0 -163
- package/dist/api/units/index.d.ts.map +0 -1
- package/src/api/core/geom/arc.ts +0 -70
- package/src/api/core/geom/curve.ts +0 -41
- package/src/api/core/geom/line.ts +0 -53
- package/src/api/core/geom/profile.ts +0 -94
- package/src/api/tools/copy.ts +0 -55
- package/src/api/tools/index.ts +0 -39
- package/src/api/tools/material.ts +0 -49
- package/src/api/tools/offset.ts +0 -43
- package/src/api/tools/selection.ts +0 -51
- package/src/api/tools/transform.ts +0 -117
- package/src/api/units/index.ts +0 -163
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { PluginProgramDepartmentsApi } from "./departments"
|
|
2
|
+
import { PluginProgramAdjacencyApi } from "./adjacency"
|
|
3
|
+
import { PluginProgramLayoutApi } from "./layout"
|
|
4
|
+
import { PluginProgramMetricsApi } from "./metrics"
|
|
5
|
+
import { PluginProgramSpreadsheetApi } from "./spreadsheet"
|
|
6
|
+
import { PluginProgramSiteApi } from "./site"
|
|
7
|
+
import { PluginProgramCoresApi } from "./cores"
|
|
8
|
+
import { PluginProgramClassificationApi } from "./classification"
|
|
9
|
+
import { PluginProgramAreasApi } from "./areas"
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Program-mode planning APIs.
|
|
13
|
+
*
|
|
14
|
+
* The program is the space-planning layer: department groupings with area targets,
|
|
15
|
+
* the metrics that track allocated area against those targets, and the reports
|
|
16
|
+
* that render program/takeoff data to spreadsheet sheets. Reads describe the
|
|
17
|
+
* *plan* (intent + targets); the geometry that realizes the plan is authored
|
|
18
|
+
* through the geometry namespaces.
|
|
19
|
+
*
|
|
20
|
+
* - {@linkcode PluginProgramApi.departments} — Read & edit program departments (groupings + targets)
|
|
21
|
+
* - {@linkcode PluginProgramApi.adjacency} — Read & compute the department/space adjacency matrix
|
|
22
|
+
* - {@linkcode PluginProgramApi.layout} — Arrange/pack spaces in the envelope (authored ahead)
|
|
23
|
+
* - {@linkcode PluginProgramApi.metrics} — Read the area-program summary
|
|
24
|
+
* - {@linkcode PluginProgramApi.areas} — FAR / built-up-area rollup and groupings
|
|
25
|
+
* - {@linkcode PluginProgramApi.spreadsheet} — Render program data to sheets and read it back
|
|
26
|
+
* - {@linkcode PluginProgramApi.site} — Read the site/plot planning context
|
|
27
|
+
* - {@linkcode PluginProgramApi.cores} — Read & trigger vertical-circulation cores
|
|
28
|
+
* - {@linkcode PluginProgramApi.classification} — Classification catalog + display tags
|
|
29
|
+
*
|
|
30
|
+
* Sub-namespaces typed as optional (`?`) are **authored ahead of the host** —
|
|
31
|
+
* declared so plugins and codegen can see the shape, but not required of host
|
|
32
|
+
* implementations and kept out of the discovery manifest until the host lands
|
|
33
|
+
* them (at which point they are promoted to required `abstract` members).
|
|
34
|
+
*
|
|
35
|
+
* Accessed via `snaptrude.program`.
|
|
36
|
+
*/
|
|
37
|
+
export abstract class PluginProgramApi {
|
|
38
|
+
/** Program departments — groupings, area targets, and space assignment. See {@linkcode PluginProgramDepartmentsApi}. */
|
|
39
|
+
public abstract departments: PluginProgramDepartmentsApi
|
|
40
|
+
/** Adjacency matrix — read & compute proximity relationships. See {@linkcode PluginProgramAdjacencyApi}. */
|
|
41
|
+
public abstract adjacency: PluginProgramAdjacencyApi
|
|
42
|
+
/**
|
|
43
|
+
* Arrange/pack spaces in the envelope. See {@linkcode PluginProgramLayoutApi}.
|
|
44
|
+
* _(authored ahead — optional until the host lands it next increment.)_
|
|
45
|
+
*/
|
|
46
|
+
public layout?: PluginProgramLayoutApi
|
|
47
|
+
/** Area-program summary — targets vs allocated area. See {@linkcode PluginProgramMetricsApi}. */
|
|
48
|
+
public abstract metrics: PluginProgramMetricsApi
|
|
49
|
+
/** FAR / built-up-area rollup and groupings. See {@linkcode PluginProgramAreasApi}. */
|
|
50
|
+
public abstract areas: PluginProgramAreasApi
|
|
51
|
+
/** Spreadsheet reports — render tables to sheets, export, list, read back. See {@linkcode PluginProgramSpreadsheetApi}. */
|
|
52
|
+
public abstract spreadsheet: PluginProgramSpreadsheetApi
|
|
53
|
+
/** Site/plot planning context — total area, parcel footprints, geo rings. See {@linkcode PluginProgramSiteApi}. */
|
|
54
|
+
public abstract site: PluginProgramSiteApi
|
|
55
|
+
/** Vertical-circulation cores — read & predicate (live); generation trigger is optional. See {@linkcode PluginProgramCoresApi}. */
|
|
56
|
+
public abstract cores: PluginProgramCoresApi
|
|
57
|
+
/** Classification catalog (space/area/mass types) + display tags. See {@linkcode PluginProgramClassificationApi}. */
|
|
58
|
+
public abstract classification: PluginProgramClassificationApi
|
|
59
|
+
|
|
60
|
+
constructor() {}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export * from "./departments"
|
|
64
|
+
export * from "./adjacency"
|
|
65
|
+
export * from "./layout"
|
|
66
|
+
export * from "./metrics"
|
|
67
|
+
export * from "./spreadsheet"
|
|
68
|
+
export * from "./site"
|
|
69
|
+
export * from "./cores"
|
|
70
|
+
export * from "./classification"
|
|
71
|
+
export * from "./areas"
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import * as z from "zod"
|
|
2
|
+
import { PluginApiReturn } from "../../types"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Program layout — arrange and pack spaces inside the envelope.
|
|
6
|
+
*
|
|
7
|
+
* These wrap the product's **Arrange in envelope** / **Pack in envelope**
|
|
8
|
+
* tools (engine: `Planner.pack_arrange` in the react host) — stages two and
|
|
9
|
+
* three of the space-planning workflow that starts with
|
|
10
|
+
* {@linkcode PluginProgramAdjacencyApi} (`program.adjacency`).
|
|
11
|
+
*
|
|
12
|
+
* _(Authored ahead — both methods are optional until the host lands them in
|
|
13
|
+
* the next increment, and are kept out of the discovery manifest until then.)_
|
|
14
|
+
*
|
|
15
|
+
* Accessed via `snaptrude.program.layout`.
|
|
16
|
+
*/
|
|
17
|
+
export abstract class PluginProgramLayoutApi {
|
|
18
|
+
constructor() {}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Arrange the spaces inside the envelope using the computed adjacency data.
|
|
22
|
+
* _(Authored ahead — optional until the host lands.)_
|
|
23
|
+
*
|
|
24
|
+
* @examplePrompt Arrange the rooms in the envelope
|
|
25
|
+
* @examplePrompt Lay out the departments inside the building envelope
|
|
26
|
+
* @examplePrompt Auto-arrange the program spaces
|
|
27
|
+
*
|
|
28
|
+
* # Example
|
|
29
|
+
* ```ts
|
|
30
|
+
* const { success, error } = await snaptrude.program.layout.arrange()
|
|
31
|
+
* if (!success) console.log("Arrange failed:", error)
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
public arrange?: () => PluginApiReturn<PluginProgramLayoutRunResult>
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Pack the spaces into the envelope (a tighter fit than arrange).
|
|
38
|
+
* _(Authored ahead — optional until the host lands.)_
|
|
39
|
+
*
|
|
40
|
+
* @examplePrompt Pack the rooms into the envelope
|
|
41
|
+
* @examplePrompt Fit the program spaces tightly into the building
|
|
42
|
+
* @examplePrompt Run pack-in-envelope on this storey
|
|
43
|
+
*
|
|
44
|
+
* # Example
|
|
45
|
+
* ```ts
|
|
46
|
+
* const { success, error } = await snaptrude.program.layout.pack()
|
|
47
|
+
* if (!success) console.log("Pack failed:", error)
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
public pack?: () => PluginApiReturn<PluginProgramLayoutRunResult>
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Result of {@linkcode PluginProgramLayoutApi.arrange} /
|
|
55
|
+
* {@linkcode PluginProgramLayoutApi.pack}.
|
|
56
|
+
*
|
|
57
|
+
* | Property | Type | Description |
|
|
58
|
+
* |---|---|---|
|
|
59
|
+
* | `success` | `boolean` | Whether the layout run completed |
|
|
60
|
+
* | `error` | `string \| undefined` | Failure reason when `success` is `false` |
|
|
61
|
+
*/
|
|
62
|
+
export const PluginProgramLayoutRunResult = z.object({
|
|
63
|
+
success: z.boolean(),
|
|
64
|
+
error: z.string().optional(),
|
|
65
|
+
})
|
|
66
|
+
export type PluginProgramLayoutRunResult = z.infer<
|
|
67
|
+
typeof PluginProgramLayoutRunResult
|
|
68
|
+
>
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import * as z from "zod"
|
|
2
|
+
import { PluginApiReturn } from "../../types"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Program metrics — the area-program summary of the active project.
|
|
6
|
+
*
|
|
7
|
+
* Aggregate planning numbers: total target versus allocated area, plus a
|
|
8
|
+
* per-department breakdown. This is the program-mode "am I hitting my area
|
|
9
|
+
* targets?" read; per-entity geometry measurements (a single space's area,
|
|
10
|
+
* volume, bounding box) live under the geometry namespaces, not here.
|
|
11
|
+
*
|
|
12
|
+
* Every area is reported in the summary's `units` (ft² or m²). This is a read:
|
|
13
|
+
* it never throws and returns an empty breakdown with zero totals when the
|
|
14
|
+
* project has no program.
|
|
15
|
+
*
|
|
16
|
+
* Accessed via `snaptrude.program.metrics`.
|
|
17
|
+
*/
|
|
18
|
+
export abstract class PluginProgramMetricsApi {
|
|
19
|
+
constructor() {}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Get the area-program summary for the active project.
|
|
23
|
+
*
|
|
24
|
+
* @returns A {@linkcode PluginProgramMetricsSummary} with project-level totals
|
|
25
|
+
* and a per-department area breakdown.
|
|
26
|
+
*
|
|
27
|
+
* @examplePrompt How much area have I allocated versus my targets?
|
|
28
|
+
* @examplePrompt Give me the program area summary
|
|
29
|
+
* @examplePrompt Which departments are over or under their target area?
|
|
30
|
+
* @examplePrompt What's the total built area in the program?
|
|
31
|
+
* @examplePrompt Show the area breakdown per department
|
|
32
|
+
* @examplePrompt Am I within my area program?
|
|
33
|
+
*
|
|
34
|
+
* # Example
|
|
35
|
+
* ```ts
|
|
36
|
+
* const m = await snaptrude.program.metrics.get()
|
|
37
|
+
* console.log(`${m.totalAllocatedArea} / ${m.totalTargetArea} ${m.units}`)
|
|
38
|
+
* console.log("unassigned:", m.unassignedArea)
|
|
39
|
+
* for (const d of m.departments) {
|
|
40
|
+
* console.log(d.name, d.allocatedArea, d.targetArea)
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
public abstract get(): PluginApiReturn<PluginProgramMetricsSummary>
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The unit areas are reported in: square feet (`"ft2"`) or square metres (`"m2"`).
|
|
49
|
+
*
|
|
50
|
+
* **Area-units convention (applies to every area-returning method).** A result
|
|
51
|
+
* carries exactly one `units` field, at the **top level of the value the method
|
|
52
|
+
* returns**: on the response **envelope** for `list`/multi/composite results, and
|
|
53
|
+
* on the **record itself** only for a single `.get` that returns a bare record.
|
|
54
|
+
* Inner/leaf records never repeat it.
|
|
55
|
+
*/
|
|
56
|
+
export const PluginAreaUnit = z.enum(["ft2", "m2"])
|
|
57
|
+
export type PluginAreaUnit = z.infer<typeof PluginAreaUnit>
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Per-department area figures within the program summary. Areas are in the
|
|
61
|
+
* enclosing {@linkcode PluginProgramMetricsSummary}'s `units`.
|
|
62
|
+
*
|
|
63
|
+
* | Property | Type | Description |
|
|
64
|
+
* |---|---|---|
|
|
65
|
+
* | `departmentId` | `string` | Department id |
|
|
66
|
+
* | `name` | `string` | Department name |
|
|
67
|
+
* | `targetArea` | `number \| null` | Target area in project units, or `null` if no target is set |
|
|
68
|
+
* | `allocatedArea` | `number` | Area currently allocated to this department, in project units |
|
|
69
|
+
*/
|
|
70
|
+
export const PluginProgramDepartmentMetric = z.object({
|
|
71
|
+
departmentId: z.string(),
|
|
72
|
+
name: z.string(),
|
|
73
|
+
targetArea: z.number().nullable(),
|
|
74
|
+
allocatedArea: z.number(),
|
|
75
|
+
})
|
|
76
|
+
export type PluginProgramDepartmentMetric = z.infer<
|
|
77
|
+
typeof PluginProgramDepartmentMetric
|
|
78
|
+
>
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Result of {@linkcode PluginProgramMetricsApi.get}.
|
|
82
|
+
*
|
|
83
|
+
* Reconciliation invariant: `totalAllocatedArea === unassignedArea` plus the sum
|
|
84
|
+
* of every `departments[].allocatedArea`. `totalTargetArea` is the sum of every
|
|
85
|
+
* `departments[].targetArea` (a `null` target counts as 0); unassigned area has
|
|
86
|
+
* no target. Every area is in `units`.
|
|
87
|
+
*
|
|
88
|
+
* | Property | Type | Description |
|
|
89
|
+
* |---|---|---|
|
|
90
|
+
* | `units` | `"ft2" \| "m2"` | The unit every area in this summary is reported in |
|
|
91
|
+
* | `totalTargetArea` | `number` | Sum of all department target areas |
|
|
92
|
+
* | `totalAllocatedArea` | `number` | Total allocated area = departments + `unassignedArea` |
|
|
93
|
+
* | `unassignedArea` | `number` | Allocated area not attributed to any listed department (site/unassigned) — the delta that reconciles the total |
|
|
94
|
+
* | `departments` | {@linkcode PluginProgramDepartmentMetric}`[]` | Per-department area breakdown |
|
|
95
|
+
*/
|
|
96
|
+
export const PluginProgramMetricsSummary = z
|
|
97
|
+
.object({
|
|
98
|
+
units: PluginAreaUnit,
|
|
99
|
+
totalTargetArea: z.number(),
|
|
100
|
+
totalAllocatedArea: z.number(),
|
|
101
|
+
unassignedArea: z.number(),
|
|
102
|
+
departments: z.array(PluginProgramDepartmentMetric),
|
|
103
|
+
})
|
|
104
|
+
.refine(
|
|
105
|
+
(s) => {
|
|
106
|
+
const summed =
|
|
107
|
+
s.unassignedArea +
|
|
108
|
+
s.departments.reduce((acc, d) => acc + d.allocatedArea, 0)
|
|
109
|
+
// Reconciliation tolerance: 0.01 absolute or 0.01% relative, for float drift.
|
|
110
|
+
const tolerance = Math.max(0.01, Math.abs(s.totalAllocatedArea) * 1e-4)
|
|
111
|
+
return Math.abs(s.totalAllocatedArea - summed) <= tolerance
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
message:
|
|
115
|
+
"totalAllocatedArea must equal unassignedArea + the sum of departments[].allocatedArea",
|
|
116
|
+
},
|
|
117
|
+
)
|
|
118
|
+
export type PluginProgramMetricsSummary = z.infer<
|
|
119
|
+
typeof PluginProgramMetricsSummary
|
|
120
|
+
>
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
import * as z from "zod"
|
|
2
|
+
import { PluginApiReturn } from "../../types"
|
|
3
|
+
import { PluginAreaUnit } from "./metrics"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Program site — read the planning context of the project's site/plot.
|
|
7
|
+
*
|
|
8
|
+
* The **site** is the set of plot/parcel footprints the program is planned
|
|
9
|
+
* against: their total area, per-parcel footprints (in scene XZ coordinates),
|
|
10
|
+
* and — when the project is geo-located on terrain — their geographic
|
|
11
|
+
* (latitude/longitude) rings. This is the program-planning view of the site;
|
|
12
|
+
* zoning numbers (setbacks, FAR/FSI, height limits) live in the site-analysis
|
|
13
|
+
* sheet and are not read here.
|
|
14
|
+
*
|
|
15
|
+
* All methods are reads: they return plain records and never throw — `get`
|
|
16
|
+
* returns an empty snapshot (zero totals) when there is no site, and the `list`
|
|
17
|
+
* methods return `[]`.
|
|
18
|
+
*
|
|
19
|
+
* Accessed via `snaptrude.program.site`.
|
|
20
|
+
*/
|
|
21
|
+
export abstract class PluginProgramSiteApi {
|
|
22
|
+
constructor() {}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Get a snapshot of the project site.
|
|
26
|
+
*
|
|
27
|
+
* @returns A {@linkcode PluginProgramSiteSnapshot} with the total site area,
|
|
28
|
+
* parcel count, and each parcel's footprint. Empty (zero totals, no
|
|
29
|
+
* parcels) when the project has no site.
|
|
30
|
+
*
|
|
31
|
+
* @examplePrompt What is my total site area?
|
|
32
|
+
* @examplePrompt Give me a summary of the site
|
|
33
|
+
* @examplePrompt How many site parcels are on the canvas?
|
|
34
|
+
* @examplePrompt Show the site footprint and its area
|
|
35
|
+
* @examplePrompt How big is the plot I'm building on?
|
|
36
|
+
*
|
|
37
|
+
* # Example
|
|
38
|
+
* ```ts
|
|
39
|
+
* const site = await snaptrude.program.site.get()
|
|
40
|
+
* console.log(`${site.totalArea} ${site.units} across ${site.polygonCount} parcels`)
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
public abstract get(): PluginApiReturn<PluginProgramSiteSnapshot>
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Get just the total site area.
|
|
47
|
+
*
|
|
48
|
+
* A fast single-metric read — the same number as
|
|
49
|
+
* {@linkcode PluginProgramSiteSnapshot.totalArea}, without computing the
|
|
50
|
+
* per-parcel footprints.
|
|
51
|
+
*
|
|
52
|
+
* @returns A {@linkcode PluginProgramSiteAreaResult} with the total `area` and
|
|
53
|
+
* its `units` (`0` when there is no site).
|
|
54
|
+
*
|
|
55
|
+
* @examplePrompt What's the total site area?
|
|
56
|
+
* @examplePrompt How big is my plot in square metres?
|
|
57
|
+
* @examplePrompt Total parcel area on the site
|
|
58
|
+
*
|
|
59
|
+
* # Example
|
|
60
|
+
* ```ts
|
|
61
|
+
* const { area, units } = await snaptrude.program.site.getArea()
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
public abstract getArea(): PluginApiReturn<PluginProgramSiteAreaResult>
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* List the site parcels with their footprints (in scene coordinates).
|
|
68
|
+
*
|
|
69
|
+
* @returns A {@linkcode PluginProgramSiteListPolygonsResult} with each parcel's
|
|
70
|
+
* id, area, label, and 2D footprint (XZ ground-plane points). Empty when the
|
|
71
|
+
* project has no site.
|
|
72
|
+
*
|
|
73
|
+
* @examplePrompt List every site parcel
|
|
74
|
+
* @examplePrompt Show me each plot's footprint
|
|
75
|
+
* @examplePrompt Which site parcels are largest?
|
|
76
|
+
* @examplePrompt Get the boundary points of the site polygons
|
|
77
|
+
*
|
|
78
|
+
* # Example
|
|
79
|
+
* ```ts
|
|
80
|
+
* const { polygons, units } = await snaptrude.program.site.listPolygons()
|
|
81
|
+
* for (const p of polygons) console.log(p.label, p.area, units, p.footprint.length)
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
public abstract listPolygons(): PluginApiReturn<PluginProgramSiteListPolygonsResult>
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* List the site parcels as geographic latitude/longitude rings.
|
|
88
|
+
*
|
|
89
|
+
* Only available when the project is geo-located on terrain; returns `[]` (no
|
|
90
|
+
* rings) otherwise. Use {@linkcode PluginProgramSiteApi.listPolygons} for the
|
|
91
|
+
* scene-coordinate footprints that are always available.
|
|
92
|
+
*
|
|
93
|
+
* @returns A {@linkcode PluginProgramSiteListGeoPolygonsResult} with one ring
|
|
94
|
+
* of `{ lat, lng, alt }` points per parcel.
|
|
95
|
+
*
|
|
96
|
+
* @examplePrompt Give me the site polygons in latitude and longitude
|
|
97
|
+
* @examplePrompt Export the plot boundary as geo-coordinates
|
|
98
|
+
* @examplePrompt Where is the site located geographically?
|
|
99
|
+
* @examplePrompt Get the site parcels as lat/long rings
|
|
100
|
+
*
|
|
101
|
+
* # Example
|
|
102
|
+
* ```ts
|
|
103
|
+
* const { polygons } = await snaptrude.program.site.listGeoPolygons()
|
|
104
|
+
* const firstRing = polygons[0] // [{ lat, lng, alt }, ...]
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
public abstract listGeoPolygons(): PluginApiReturn<PluginProgramSiteListGeoPolygonsResult>
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Get the geo-referenced terrain context of the site.
|
|
111
|
+
*
|
|
112
|
+
* The map center and bounds, the terrain size in metres, the effective zoom,
|
|
113
|
+
* and each parcel's geographic footprint and area — the context used for site
|
|
114
|
+
* analysis. Returns `null` when the project is not geo-located on terrain.
|
|
115
|
+
*
|
|
116
|
+
* @returns A {@linkcode PluginProgramSiteContext}, or `null`.
|
|
117
|
+
*
|
|
118
|
+
* @examplePrompt What's the site's map center and bounds?
|
|
119
|
+
* @examplePrompt How wide is the terrain in metres?
|
|
120
|
+
* @examplePrompt Give me the parcel geometry and areas
|
|
121
|
+
* @examplePrompt Where is the site located on the map?
|
|
122
|
+
*
|
|
123
|
+
* # Example
|
|
124
|
+
* ```ts
|
|
125
|
+
* const ctx = await snaptrude.program.site.getContext()
|
|
126
|
+
* if (ctx) console.log(ctx.center, ctx.widthInM)
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
public abstract getContext(): PluginApiReturn<PluginProgramSiteContextResult>
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* A 2D ground-plane point of a site parcel footprint, in scene coordinates
|
|
134
|
+
* (metres on the project's XZ plane).
|
|
135
|
+
*
|
|
136
|
+
* | Property | Type | Description |
|
|
137
|
+
* |---|---|---|
|
|
138
|
+
* | `x` | `number` | X coordinate (scene metres) |
|
|
139
|
+
* | `z` | `number` | Z coordinate (scene metres) |
|
|
140
|
+
*/
|
|
141
|
+
export const PluginSiteFootprintPoint = z.object({
|
|
142
|
+
x: z.number(),
|
|
143
|
+
z: z.number(),
|
|
144
|
+
})
|
|
145
|
+
export type PluginSiteFootprintPoint = z.infer<typeof PluginSiteFootprintPoint>
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* A geographic point of a site parcel ring (WGS84).
|
|
149
|
+
*
|
|
150
|
+
* | Property | Type | Description |
|
|
151
|
+
* |---|---|---|
|
|
152
|
+
* | `lat` | `number` | Latitude (degrees) |
|
|
153
|
+
* | `lng` | `number` | Longitude (degrees) |
|
|
154
|
+
* | `alt` | `number` | Altitude (metres) |
|
|
155
|
+
*/
|
|
156
|
+
export const PluginSiteGeoPoint = z.object({
|
|
157
|
+
lat: z.number(),
|
|
158
|
+
lng: z.number(),
|
|
159
|
+
alt: z.number(),
|
|
160
|
+
})
|
|
161
|
+
export type PluginSiteGeoPoint = z.infer<typeof PluginSiteGeoPoint>
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* A single site parcel/polygon. Its `area` is in the enclosing result's `units`.
|
|
165
|
+
*
|
|
166
|
+
* | Property | Type | Description |
|
|
167
|
+
* |---|---|---|
|
|
168
|
+
* | `id` | `string` | Unique parcel/component id |
|
|
169
|
+
* | `area` | `number` | Footprint area, in the result's `units` |
|
|
170
|
+
* | `label` | `string` | Parcel label / room type (e.g. `"site"`) |
|
|
171
|
+
* | `footprint` | {@linkcode PluginSiteFootprintPoint}`[]` | 2D ground-plane boundary points |
|
|
172
|
+
*/
|
|
173
|
+
export const PluginSitePolygon = z.object({
|
|
174
|
+
id: z.string(),
|
|
175
|
+
area: z.number(),
|
|
176
|
+
label: z.string(),
|
|
177
|
+
footprint: z.array(PluginSiteFootprintPoint),
|
|
178
|
+
})
|
|
179
|
+
export type PluginSitePolygon = z.infer<typeof PluginSitePolygon>
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Result of {@linkcode PluginProgramSiteApi.get}. Per the area-units convention,
|
|
183
|
+
* `units` sits on this snapshot and every `area` below is reported in it.
|
|
184
|
+
*
|
|
185
|
+
* | Property | Type | Description |
|
|
186
|
+
* |---|---|---|
|
|
187
|
+
* | `units` | `"ft2" \| "m2"` | The unit all areas in this snapshot are reported in |
|
|
188
|
+
* | `totalArea` | `number` | Total area of all site parcels |
|
|
189
|
+
* | `polygonCount` | `number` | Number of site parcels |
|
|
190
|
+
* | `polygons` | {@linkcode PluginSitePolygon}`[]` | Each site parcel with its footprint |
|
|
191
|
+
*/
|
|
192
|
+
export const PluginProgramSiteSnapshot = z.object({
|
|
193
|
+
units: PluginAreaUnit,
|
|
194
|
+
totalArea: z.number(),
|
|
195
|
+
polygonCount: z.number(),
|
|
196
|
+
polygons: z.array(PluginSitePolygon),
|
|
197
|
+
})
|
|
198
|
+
export type PluginProgramSiteSnapshot = z.infer<
|
|
199
|
+
typeof PluginProgramSiteSnapshot
|
|
200
|
+
>
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Result of {@linkcode PluginProgramSiteApi.getArea}.
|
|
204
|
+
*
|
|
205
|
+
* | Property | Type | Description |
|
|
206
|
+
* |---|---|---|
|
|
207
|
+
* | `units` | `"ft2" \| "m2"` | The unit `area` is reported in |
|
|
208
|
+
* | `area` | `number` | Total site area |
|
|
209
|
+
*/
|
|
210
|
+
export const PluginProgramSiteAreaResult = z.object({
|
|
211
|
+
units: PluginAreaUnit,
|
|
212
|
+
area: z.number(),
|
|
213
|
+
})
|
|
214
|
+
export type PluginProgramSiteAreaResult = z.infer<
|
|
215
|
+
typeof PluginProgramSiteAreaResult
|
|
216
|
+
>
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Result of {@linkcode PluginProgramSiteApi.listPolygons}. `units` sits on the
|
|
220
|
+
* response; each parcel's `area` is in it.
|
|
221
|
+
*
|
|
222
|
+
* | Property | Type | Description |
|
|
223
|
+
* |---|---|---|
|
|
224
|
+
* | `units` | `"ft2" \| "m2"` | The unit every parcel `area` is reported in |
|
|
225
|
+
* | `polygons` | {@linkcode PluginSitePolygon}`[]` | All site parcels |
|
|
226
|
+
*/
|
|
227
|
+
export const PluginProgramSiteListPolygonsResult = z.object({
|
|
228
|
+
units: PluginAreaUnit,
|
|
229
|
+
polygons: z.array(PluginSitePolygon),
|
|
230
|
+
})
|
|
231
|
+
export type PluginProgramSiteListPolygonsResult = z.infer<
|
|
232
|
+
typeof PluginProgramSiteListPolygonsResult
|
|
233
|
+
>
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Result of {@linkcode PluginProgramSiteApi.listGeoPolygons} — one ring of
|
|
237
|
+
* geographic points per parcel (`[]` when the project is not geo-located).
|
|
238
|
+
*
|
|
239
|
+
* | Property | Type | Description |
|
|
240
|
+
* |---|---|---|
|
|
241
|
+
* | `polygons` | {@linkcode PluginSiteGeoPoint}`[][]` | One ring per parcel; each ring is a list of geographic points |
|
|
242
|
+
*/
|
|
243
|
+
export const PluginProgramSiteListGeoPolygonsResult = z.object({
|
|
244
|
+
polygons: z.array(z.array(PluginSiteGeoPoint)),
|
|
245
|
+
})
|
|
246
|
+
export type PluginProgramSiteListGeoPolygonsResult = z.infer<
|
|
247
|
+
typeof PluginProgramSiteListGeoPolygonsResult
|
|
248
|
+
>
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* A geographic latitude/longitude point (no altitude).
|
|
252
|
+
*
|
|
253
|
+
* | Property | Type | Description |
|
|
254
|
+
* |---|---|---|
|
|
255
|
+
* | `lat` | `number` | Latitude (degrees) |
|
|
256
|
+
* | `lng` | `number` | Longitude (degrees) |
|
|
257
|
+
*/
|
|
258
|
+
export const PluginSiteLatLng = z.object({
|
|
259
|
+
lat: z.number(),
|
|
260
|
+
lng: z.number(),
|
|
261
|
+
})
|
|
262
|
+
export type PluginSiteLatLng = z.infer<typeof PluginSiteLatLng>
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Geographic bounds of the site terrain.
|
|
266
|
+
*
|
|
267
|
+
* | Property | Type | Description |
|
|
268
|
+
* |---|---|---|
|
|
269
|
+
* | `north` | `number` | North latitude |
|
|
270
|
+
* | `south` | `number` | South latitude |
|
|
271
|
+
* | `east` | `number` | East longitude |
|
|
272
|
+
* | `west` | `number` | West longitude |
|
|
273
|
+
*/
|
|
274
|
+
export const PluginSiteBounds = z.object({
|
|
275
|
+
north: z.number(),
|
|
276
|
+
south: z.number(),
|
|
277
|
+
east: z.number(),
|
|
278
|
+
west: z.number(),
|
|
279
|
+
})
|
|
280
|
+
export type PluginSiteBounds = z.infer<typeof PluginSiteBounds>
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* A site parcel in the terrain context — geographic footprint and area.
|
|
284
|
+
*
|
|
285
|
+
* | Property | Type | Description |
|
|
286
|
+
* |---|---|---|
|
|
287
|
+
* | `footprint` | {@linkcode PluginSiteLatLng}`[]` | Geographic boundary points |
|
|
288
|
+
* | `area` | `number` | Parcel area (project area units) |
|
|
289
|
+
*/
|
|
290
|
+
export const PluginSiteContextParcel = z.object({
|
|
291
|
+
footprint: z.array(PluginSiteLatLng),
|
|
292
|
+
area: z.number(),
|
|
293
|
+
})
|
|
294
|
+
export type PluginSiteContextParcel = z.infer<typeof PluginSiteContextParcel>
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* The geo-referenced terrain context of the site.
|
|
298
|
+
*
|
|
299
|
+
* | Property | Type | Description |
|
|
300
|
+
* |---|---|---|
|
|
301
|
+
* | `center` | {@linkcode PluginSiteLatLng} | Map center |
|
|
302
|
+
* | `bounds` | {@linkcode PluginSiteBounds} | Terrain bounds |
|
|
303
|
+
* | `widthInM` | `number` | Terrain width in metres |
|
|
304
|
+
* | `heightInM` | `number` | Terrain height in metres |
|
|
305
|
+
* | `zoom` | `number` | Effective map zoom |
|
|
306
|
+
* | `parcels` | {@linkcode PluginSiteContextParcel}`[]` | Site parcels with geographic footprints |
|
|
307
|
+
*/
|
|
308
|
+
export const PluginProgramSiteContext = z.object({
|
|
309
|
+
center: PluginSiteLatLng,
|
|
310
|
+
bounds: PluginSiteBounds,
|
|
311
|
+
widthInM: z.number(),
|
|
312
|
+
heightInM: z.number(),
|
|
313
|
+
zoom: z.number(),
|
|
314
|
+
parcels: z.array(PluginSiteContextParcel),
|
|
315
|
+
})
|
|
316
|
+
export type PluginProgramSiteContext = z.infer<typeof PluginProgramSiteContext>
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Result of {@linkcode PluginProgramSiteApi.getContext} — the terrain context, or
|
|
320
|
+
* `null` when the project is not geo-located.
|
|
321
|
+
*/
|
|
322
|
+
export const PluginProgramSiteContextResult =
|
|
323
|
+
PluginProgramSiteContext.nullable()
|
|
324
|
+
export type PluginProgramSiteContextResult = z.infer<
|
|
325
|
+
typeof PluginProgramSiteContextResult
|
|
326
|
+
>
|