@nice2dev/spatial-core 1.0.10
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 +160 -0
- package/dist/bim/index.d.ts +366 -0
- package/dist/bim/index.d.ts.map +1 -0
- package/dist/bim/index.js +60 -0
- package/dist/bim/index.js.map +1 -0
- package/dist/cad/index.d.ts +329 -0
- package/dist/cad/index.d.ts.map +1 -0
- package/dist/cad/index.js +124 -0
- package/dist/cad/index.js.map +1 -0
- package/dist/ecad/index.d.ts +316 -0
- package/dist/ecad/index.d.ts.map +1 -0
- package/dist/ecad/index.js +11 -0
- package/dist/ecad/index.js.map +1 -0
- package/dist/export/index.d.ts +93 -0
- package/dist/export/index.d.ts.map +1 -0
- package/dist/export/index.js +522 -0
- package/dist/export/index.js.map +1 -0
- package/dist/floor-plan/index.d.ts +248 -0
- package/dist/floor-plan/index.d.ts.map +1 -0
- package/dist/floor-plan/index.js +228 -0
- package/dist/floor-plan/index.js.map +1 -0
- package/dist/grid/index.d.ts +160 -0
- package/dist/grid/index.d.ts.map +1 -0
- package/dist/grid/index.js +319 -0
- package/dist/grid/index.js.map +1 -0
- package/dist/import/import.worker.d.ts +28 -0
- package/dist/import/import.worker.d.ts.map +1 -0
- package/dist/import/import.worker.js +52 -0
- package/dist/import/import.worker.js.map +1 -0
- package/dist/import/index.d.ts +111 -0
- package/dist/import/index.d.ts.map +1 -0
- package/dist/import/index.js +1092 -0
- package/dist/import/index.js.map +1 -0
- package/dist/import/workerImport.d.ts +56 -0
- package/dist/import/workerImport.d.ts.map +1 -0
- package/dist/import/workerImport.js +207 -0
- package/dist/import/workerImport.js.map +1 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +86 -0
- package/dist/index.js.map +1 -0
- package/dist/interior/index.d.ts +241 -0
- package/dist/interior/index.d.ts.map +1 -0
- package/dist/interior/index.js +101 -0
- package/dist/interior/index.js.map +1 -0
- package/dist/measurement/index.d.ts +186 -0
- package/dist/measurement/index.d.ts.map +1 -0
- package/dist/measurement/index.js +400 -0
- package/dist/measurement/index.js.map +1 -0
- package/dist/objects/index.d.ts +288 -0
- package/dist/objects/index.d.ts.map +1 -0
- package/dist/objects/index.js +463 -0
- package/dist/objects/index.js.map +1 -0
- package/dist/serialization/index.d.ts +421 -0
- package/dist/serialization/index.d.ts.map +1 -0
- package/dist/serialization/index.js +412 -0
- package/dist/serialization/index.js.map +1 -0
- package/dist/topology/index.d.ts +252 -0
- package/dist/topology/index.d.ts.map +1 -0
- package/dist/topology/index.js +525 -0
- package/dist/topology/index.js.map +1 -0
- package/dist/transitions/index.d.ts +141 -0
- package/dist/transitions/index.d.ts.map +1 -0
- package/dist/transitions/index.js +160 -0
- package/dist/transitions/index.js.map +1 -0
- package/dist/unified/index.d.ts +225 -0
- package/dist/unified/index.d.ts.map +1 -0
- package/dist/unified/index.js +474 -0
- package/dist/unified/index.js.map +1 -0
- package/dist/virtualization/QuadTree.d.ts +68 -0
- package/dist/virtualization/QuadTree.d.ts.map +1 -0
- package/dist/virtualization/QuadTree.js +228 -0
- package/dist/virtualization/QuadTree.js.map +1 -0
- package/dist/virtualization/ViewportCulling.d.ts +92 -0
- package/dist/virtualization/ViewportCulling.d.ts.map +1 -0
- package/dist/virtualization/ViewportCulling.js +123 -0
- package/dist/virtualization/ViewportCulling.js.map +1 -0
- package/dist/virtualization/index.d.ts +9 -0
- package/dist/virtualization/index.d.ts.map +1 -0
- package/dist/virtualization/index.js +9 -0
- package/dist/virtualization/index.js.map +1 -0
- package/package.json +64 -0
package/README.md
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# @nice2dev/spatial-core
|
|
2
|
+
|
|
3
|
+
> Unified spatial/floor-plan/CAD core logic for Nice2Dev UI components.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
`@nice2dev/spatial-core` provides framework-agnostic core functionality for spatial editing applications:
|
|
8
|
+
|
|
9
|
+
- **Grid System** — Snap-to-grid, alignment guides, intelligent snapping
|
|
10
|
+
- **Spatial Objects** — Unified object model for devices, furniture, network equipment
|
|
11
|
+
- **Floor Plan Model** — Walls, rooms, zones, layers, floors
|
|
12
|
+
- **Measurement** — Distance, angle, area calculations with unit conversion
|
|
13
|
+
- **Serialization** — `.nsp.json` format for saving/loading spatial documents
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @nice2dev/spatial-core
|
|
19
|
+
# or
|
|
20
|
+
pnpm add @nice2dev/spatial-core
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
### Grid System
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
import {
|
|
29
|
+
snapToGrid,
|
|
30
|
+
generateAlignmentGuides,
|
|
31
|
+
performSnap,
|
|
32
|
+
DEFAULT_GRID_CONFIG
|
|
33
|
+
} from '@nice2dev/spatial-core/grid';
|
|
34
|
+
|
|
35
|
+
// Snap point to grid
|
|
36
|
+
const snapped = snapToGrid({ x: 123, y: 456 }, DEFAULT_GRID_CONFIG);
|
|
37
|
+
|
|
38
|
+
// Generate alignment guides while dragging
|
|
39
|
+
const guides = generateAlignmentGuides(draggedBounds, otherObjects, 10);
|
|
40
|
+
|
|
41
|
+
// Intelligent snap with multiple modes
|
|
42
|
+
const result = performSnap(mousePos, targetObjects, gridConfig);
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Object Catalog
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
import {
|
|
49
|
+
OBJECT_CATALOG,
|
|
50
|
+
getCatalogByCategory,
|
|
51
|
+
searchCatalog
|
|
52
|
+
} from '@nice2dev/spatial-core/objects';
|
|
53
|
+
|
|
54
|
+
// Get all smart home devices
|
|
55
|
+
const devices = getCatalogByCategory('smart-home');
|
|
56
|
+
|
|
57
|
+
// Search catalog
|
|
58
|
+
const results = searchCatalog('camera');
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Floor Plan
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
import {
|
|
65
|
+
createFloorPlanDocument,
|
|
66
|
+
createFloor,
|
|
67
|
+
addObjectToLayer,
|
|
68
|
+
calculatePolygonArea
|
|
69
|
+
} from '@nice2dev/spatial-core/floor-plan';
|
|
70
|
+
|
|
71
|
+
// Create new floor plan
|
|
72
|
+
const doc = createFloorPlanDocument('My House', 'floor-plan');
|
|
73
|
+
|
|
74
|
+
// Add a floor
|
|
75
|
+
const floor = createFloor('Ground Floor', 0, { x: 0, y: 0, width: 20, height: 15 });
|
|
76
|
+
doc.floors.push(floor);
|
|
77
|
+
|
|
78
|
+
// Calculate room area
|
|
79
|
+
const area = calculatePolygonArea(roomBoundary);
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Measurement
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
import {
|
|
86
|
+
distance2D,
|
|
87
|
+
polygonArea,
|
|
88
|
+
formatLength,
|
|
89
|
+
autoFormatArea,
|
|
90
|
+
convertLength
|
|
91
|
+
} from '@nice2dev/spatial-core/measurement';
|
|
92
|
+
|
|
93
|
+
// Calculate distance
|
|
94
|
+
const dist = distance2D({ x: 0, y: 0 }, { x: 3, y: 4 }); // 5
|
|
95
|
+
|
|
96
|
+
// Format with units
|
|
97
|
+
const formatted = autoFormatArea(150.5, 'metric'); // "150.50 m²"
|
|
98
|
+
|
|
99
|
+
// Convert units
|
|
100
|
+
const feet = convertLength(10, 'm', 'ft'); // 32.8084
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Serialization
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
import {
|
|
107
|
+
serialize,
|
|
108
|
+
deserialize,
|
|
109
|
+
validate,
|
|
110
|
+
downloadNSP,
|
|
111
|
+
exportFloorToSVG
|
|
112
|
+
} from '@nice2dev/spatial-core/serialization';
|
|
113
|
+
|
|
114
|
+
// Save document
|
|
115
|
+
const json = serialize(document, { pretty: true });
|
|
116
|
+
|
|
117
|
+
// Load document
|
|
118
|
+
const result = deserialize(jsonString);
|
|
119
|
+
if (result.success) {
|
|
120
|
+
const doc = result.data;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Validate
|
|
124
|
+
const validation = validate(document);
|
|
125
|
+
console.log(validation.errors, validation.warnings);
|
|
126
|
+
|
|
127
|
+
// Download as file
|
|
128
|
+
downloadNSP(document, 'my-floor-plan.nsp.json');
|
|
129
|
+
|
|
130
|
+
// Export to SVG
|
|
131
|
+
const svg = exportFloorToSVG(floor, { showGrid: true, showLabels: true });
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Document Types
|
|
135
|
+
|
|
136
|
+
The `.nsp.json` format supports multiple document types:
|
|
137
|
+
|
|
138
|
+
| Type | Description | Use Case |
|
|
139
|
+
|------|-------------|----------|
|
|
140
|
+
| `floor-plan` | 2D floor plan | Smart home, building automation |
|
|
141
|
+
| `network-topology` | Network diagram | IT infrastructure planning |
|
|
142
|
+
| `infrastructure` | Data center layout | Server room, rack planning |
|
|
143
|
+
| `cad` | Architectural CAD | Detailed building design |
|
|
144
|
+
| `interior` | Interior design | Furniture placement |
|
|
145
|
+
| `game-scene` | Game level/scene | Game development |
|
|
146
|
+
|
|
147
|
+
## Object Categories
|
|
148
|
+
|
|
149
|
+
Unified catalog of placeable objects:
|
|
150
|
+
|
|
151
|
+
- **smart-home** — Lights, thermostats, cameras, sensors, locks
|
|
152
|
+
- **furniture** — Sofas, tables, beds, wardrobes, desks
|
|
153
|
+
- **network** — Routers, switches, servers, access points
|
|
154
|
+
- **infrastructure** — Racks, UPS, PDU, cooling units
|
|
155
|
+
- **building** — Walls, doors, windows, stairs
|
|
156
|
+
- **game** — Spawn points, triggers, pickups
|
|
157
|
+
|
|
158
|
+
## License
|
|
159
|
+
|
|
160
|
+
MIT
|
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BIM / AEC Features — IFC, Revit interop, MEP routing, clash detection,
|
|
3
|
+
* scheduling, costing, point-cloud, digital twin.
|
|
4
|
+
*
|
|
5
|
+
* PRO-2.4 — 16 items
|
|
6
|
+
*
|
|
7
|
+
* @module @nice2dev/spatial-core/bim
|
|
8
|
+
*/
|
|
9
|
+
import type { Point2D, Point3D } from '../grid/index';
|
|
10
|
+
export type IfcSchema = 'IFC2x3' | 'IFC4' | 'IFC4x3';
|
|
11
|
+
export interface IfcEntity {
|
|
12
|
+
id: string;
|
|
13
|
+
type: string;
|
|
14
|
+
name?: string;
|
|
15
|
+
properties: Record<string, unknown>;
|
|
16
|
+
geometry?: {
|
|
17
|
+
vertices: number[];
|
|
18
|
+
indices: number[];
|
|
19
|
+
};
|
|
20
|
+
parentId?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface IfcProject {
|
|
23
|
+
schema: IfcSchema;
|
|
24
|
+
name: string;
|
|
25
|
+
entities: IfcEntity[];
|
|
26
|
+
spatialStructure: IfcSpatialNode[];
|
|
27
|
+
}
|
|
28
|
+
export interface IfcSpatialNode {
|
|
29
|
+
id: string;
|
|
30
|
+
type: 'IfcSite' | 'IfcBuilding' | 'IfcBuildingStorey' | 'IfcSpace';
|
|
31
|
+
name: string;
|
|
32
|
+
children: IfcSpatialNode[];
|
|
33
|
+
entityIds: string[];
|
|
34
|
+
}
|
|
35
|
+
export interface IfcImportOptions {
|
|
36
|
+
schema?: IfcSchema;
|
|
37
|
+
includeGeometry?: boolean;
|
|
38
|
+
filterTypes?: string[];
|
|
39
|
+
}
|
|
40
|
+
export interface IfcExportOptions {
|
|
41
|
+
schema: IfcSchema;
|
|
42
|
+
includePropertySets?: boolean;
|
|
43
|
+
coordinateSystem?: 'local' | 'project' | 'wgs84';
|
|
44
|
+
}
|
|
45
|
+
export interface RevitElement {
|
|
46
|
+
elementId: number;
|
|
47
|
+
category: string;
|
|
48
|
+
familyName?: string;
|
|
49
|
+
typeName?: string;
|
|
50
|
+
parameters: Record<string, string | number | boolean>;
|
|
51
|
+
geometry?: {
|
|
52
|
+
meshes: Array<{
|
|
53
|
+
vertices: number[];
|
|
54
|
+
indices: number[];
|
|
55
|
+
}>;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export interface RevitImportOptions {
|
|
59
|
+
categories?: string[];
|
|
60
|
+
includeLinkedModels?: boolean;
|
|
61
|
+
detailLevel?: 'coarse' | 'medium' | 'fine';
|
|
62
|
+
}
|
|
63
|
+
export interface BimRoom {
|
|
64
|
+
id: string;
|
|
65
|
+
name: string;
|
|
66
|
+
number?: string;
|
|
67
|
+
level: string;
|
|
68
|
+
area: number;
|
|
69
|
+
volume: number;
|
|
70
|
+
perimeter: number;
|
|
71
|
+
height: number;
|
|
72
|
+
/** Boundary polygon points */
|
|
73
|
+
boundary: Point2D[];
|
|
74
|
+
/** Occupancy type */
|
|
75
|
+
usage?: string;
|
|
76
|
+
/** Connected rooms via doors/openings */
|
|
77
|
+
adjacentRoomIds: string[];
|
|
78
|
+
}
|
|
79
|
+
export declare function computeRoomArea(boundary: Point2D[]): number;
|
|
80
|
+
export type MepDiscipline = 'hvac' | 'plumbing' | 'electrical' | 'fire-protection';
|
|
81
|
+
export type MepElementType = 'duct' | 'pipe' | 'conduit' | 'cable-tray' | 'fitting' | 'equipment' | 'terminal';
|
|
82
|
+
export interface MepElement {
|
|
83
|
+
id: string;
|
|
84
|
+
discipline: MepDiscipline;
|
|
85
|
+
type: MepElementType;
|
|
86
|
+
systemName: string;
|
|
87
|
+
/** Start/end points for linear elements */
|
|
88
|
+
start?: Point3D;
|
|
89
|
+
end?: Point3D;
|
|
90
|
+
/** Diameter/width in mm */
|
|
91
|
+
size: number;
|
|
92
|
+
/** Insulation thickness in mm */
|
|
93
|
+
insulation?: number;
|
|
94
|
+
material: string;
|
|
95
|
+
/** Flow rate (l/s for pipes, m³/h for ducts) */
|
|
96
|
+
flowRate?: number;
|
|
97
|
+
}
|
|
98
|
+
export interface MepSystem {
|
|
99
|
+
id: string;
|
|
100
|
+
name: string;
|
|
101
|
+
discipline: MepDiscipline;
|
|
102
|
+
elements: MepElement[];
|
|
103
|
+
/** Total pressure drop (Pa) */
|
|
104
|
+
pressureDrop?: number;
|
|
105
|
+
}
|
|
106
|
+
export type StructuralType = 'beam' | 'column' | 'slab' | 'wall' | 'foundation' | 'brace' | 'truss';
|
|
107
|
+
export type StructuralMaterial = 'concrete' | 'steel' | 'timber' | 'masonry' | 'composite';
|
|
108
|
+
export interface StructuralElement {
|
|
109
|
+
id: string;
|
|
110
|
+
type: StructuralType;
|
|
111
|
+
material: StructuralMaterial;
|
|
112
|
+
profile?: string;
|
|
113
|
+
start: Point3D;
|
|
114
|
+
end: Point3D;
|
|
115
|
+
/** Section dimensions (mm) */
|
|
116
|
+
width: number;
|
|
117
|
+
height: number;
|
|
118
|
+
/** Load capacity (kN) */
|
|
119
|
+
capacity?: number;
|
|
120
|
+
/** Reinforcement details for concrete */
|
|
121
|
+
reinforcement?: {
|
|
122
|
+
bars: string;
|
|
123
|
+
stirrups: string;
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
export interface QuantityItem {
|
|
127
|
+
id: string;
|
|
128
|
+
category: string;
|
|
129
|
+
description: string;
|
|
130
|
+
unit: string;
|
|
131
|
+
quantity: number;
|
|
132
|
+
/** Unit cost for estimation */
|
|
133
|
+
unitCost?: number;
|
|
134
|
+
/** Source element IDs */
|
|
135
|
+
sourceIds: string[];
|
|
136
|
+
}
|
|
137
|
+
export interface QuantityReport {
|
|
138
|
+
projectName: string;
|
|
139
|
+
date: string;
|
|
140
|
+
items: QuantityItem[];
|
|
141
|
+
totalCost: number;
|
|
142
|
+
currency: string;
|
|
143
|
+
}
|
|
144
|
+
export declare function generateQuantityReport(projectName: string, items: QuantityItem[], currency?: string): QuantityReport;
|
|
145
|
+
export type ClashSeverity = 'hard' | 'soft' | 'clearance';
|
|
146
|
+
export type ClashStatus = 'new' | 'active' | 'reviewed' | 'resolved' | 'approved';
|
|
147
|
+
export interface ClashResult {
|
|
148
|
+
id: string;
|
|
149
|
+
severity: ClashSeverity;
|
|
150
|
+
status: ClashStatus;
|
|
151
|
+
elementA: {
|
|
152
|
+
id: string;
|
|
153
|
+
discipline: string;
|
|
154
|
+
type: string;
|
|
155
|
+
};
|
|
156
|
+
elementB: {
|
|
157
|
+
id: string;
|
|
158
|
+
discipline: string;
|
|
159
|
+
type: string;
|
|
160
|
+
};
|
|
161
|
+
point: Point3D;
|
|
162
|
+
distance: number;
|
|
163
|
+
description: string;
|
|
164
|
+
/** Image snapshot reference */
|
|
165
|
+
snapshotUrl?: string;
|
|
166
|
+
}
|
|
167
|
+
export interface ClashTest {
|
|
168
|
+
id: string;
|
|
169
|
+
name: string;
|
|
170
|
+
setA: string[];
|
|
171
|
+
setB: string[];
|
|
172
|
+
tolerance: number;
|
|
173
|
+
severity: ClashSeverity;
|
|
174
|
+
}
|
|
175
|
+
export interface ScheduleTask {
|
|
176
|
+
id: string;
|
|
177
|
+
name: string;
|
|
178
|
+
startDate: string;
|
|
179
|
+
endDate: string;
|
|
180
|
+
/** Linked BIM element IDs */
|
|
181
|
+
elementIds: string[];
|
|
182
|
+
/** Predecessor task IDs */
|
|
183
|
+
predecessors: string[];
|
|
184
|
+
/** Completion percentage 0-100 */
|
|
185
|
+
progress: number;
|
|
186
|
+
color?: string;
|
|
187
|
+
}
|
|
188
|
+
export interface ConstructionSchedule {
|
|
189
|
+
id: string;
|
|
190
|
+
name: string;
|
|
191
|
+
tasks: ScheduleTask[];
|
|
192
|
+
/** Current simulation date */
|
|
193
|
+
currentDate?: string;
|
|
194
|
+
}
|
|
195
|
+
export interface CostItem {
|
|
196
|
+
id: string;
|
|
197
|
+
code: string;
|
|
198
|
+
description: string;
|
|
199
|
+
unit: string;
|
|
200
|
+
quantity: number;
|
|
201
|
+
laborCost: number;
|
|
202
|
+
materialCost: number;
|
|
203
|
+
equipmentCost: number;
|
|
204
|
+
overhead: number;
|
|
205
|
+
linkToScheduleTaskId?: string;
|
|
206
|
+
linkToElementIds?: string[];
|
|
207
|
+
}
|
|
208
|
+
export interface CostEstimate {
|
|
209
|
+
projectName: string;
|
|
210
|
+
currency: string;
|
|
211
|
+
items: CostItem[];
|
|
212
|
+
contingency: number;
|
|
213
|
+
totalLabor: number;
|
|
214
|
+
totalMaterial: number;
|
|
215
|
+
totalEquipment: number;
|
|
216
|
+
totalOverhead: number;
|
|
217
|
+
grandTotal: number;
|
|
218
|
+
}
|
|
219
|
+
export declare function computeCostEstimate(projectName: string, items: CostItem[], contingencyPercent?: number, currency?: string): CostEstimate;
|
|
220
|
+
export interface CobieSheet {
|
|
221
|
+
facility: {
|
|
222
|
+
name: string;
|
|
223
|
+
category: string;
|
|
224
|
+
address: string;
|
|
225
|
+
};
|
|
226
|
+
floors: Array<{
|
|
227
|
+
name: string;
|
|
228
|
+
elevation: number;
|
|
229
|
+
height: number;
|
|
230
|
+
}>;
|
|
231
|
+
spaces: Array<{
|
|
232
|
+
name: string;
|
|
233
|
+
floorName: string;
|
|
234
|
+
area: number;
|
|
235
|
+
usage: string;
|
|
236
|
+
}>;
|
|
237
|
+
types: Array<{
|
|
238
|
+
name: string;
|
|
239
|
+
category: string;
|
|
240
|
+
manufacturer?: string;
|
|
241
|
+
modelNumber?: string;
|
|
242
|
+
}>;
|
|
243
|
+
components: Array<{
|
|
244
|
+
name: string;
|
|
245
|
+
typeName: string;
|
|
246
|
+
spaceName: string;
|
|
247
|
+
serialNumber?: string;
|
|
248
|
+
}>;
|
|
249
|
+
}
|
|
250
|
+
export interface GbxmlSurface {
|
|
251
|
+
id: string;
|
|
252
|
+
type: 'ExteriorWall' | 'InteriorWall' | 'Roof' | 'Floor' | 'Ceiling' | 'UndergroundWall';
|
|
253
|
+
area: number;
|
|
254
|
+
tilt: number;
|
|
255
|
+
azimuth: number;
|
|
256
|
+
uValue: number;
|
|
257
|
+
adjacentSpaceIds: string[];
|
|
258
|
+
}
|
|
259
|
+
export interface GbxmlBuilding {
|
|
260
|
+
name: string;
|
|
261
|
+
buildingType: string;
|
|
262
|
+
zipCode?: string;
|
|
263
|
+
spaces: Array<{
|
|
264
|
+
id: string;
|
|
265
|
+
name: string;
|
|
266
|
+
volume: number;
|
|
267
|
+
area: number;
|
|
268
|
+
conditionType: 'Heated' | 'Cooled' | 'HeatedAndCooled' | 'Unconditioned';
|
|
269
|
+
}>;
|
|
270
|
+
surfaces: GbxmlSurface[];
|
|
271
|
+
}
|
|
272
|
+
export interface PointCloudData {
|
|
273
|
+
id: string;
|
|
274
|
+
name: string;
|
|
275
|
+
pointCount: number;
|
|
276
|
+
/** Bounding box */
|
|
277
|
+
bounds: {
|
|
278
|
+
min: Point3D;
|
|
279
|
+
max: Point3D;
|
|
280
|
+
};
|
|
281
|
+
/** Data format */
|
|
282
|
+
format: 'las' | 'laz' | 'e57' | 'ply' | 'xyz';
|
|
283
|
+
/** Coordinate reference system */
|
|
284
|
+
crs?: string;
|
|
285
|
+
/** Point density (pts/m²) */
|
|
286
|
+
density?: number;
|
|
287
|
+
}
|
|
288
|
+
export interface PhotogrammetryModel {
|
|
289
|
+
id: string;
|
|
290
|
+
name: string;
|
|
291
|
+
meshVertexCount: number;
|
|
292
|
+
textureResolution?: number;
|
|
293
|
+
/** Source photos count */
|
|
294
|
+
photoCount: number;
|
|
295
|
+
format: 'obj' | 'fbx' | 'glb' | 'ply';
|
|
296
|
+
accuracy?: number;
|
|
297
|
+
}
|
|
298
|
+
export interface IoTSensor {
|
|
299
|
+
id: string;
|
|
300
|
+
name: string;
|
|
301
|
+
type: 'temperature' | 'humidity' | 'co2' | 'occupancy' | 'energy' | 'water' | 'light' | 'motion' | 'pressure';
|
|
302
|
+
unit: string;
|
|
303
|
+
/** Current value */
|
|
304
|
+
value: number;
|
|
305
|
+
/** Last update timestamp */
|
|
306
|
+
lastUpdate: number;
|
|
307
|
+
/** Location in building */
|
|
308
|
+
position: Point3D;
|
|
309
|
+
/** Linked BIM element */
|
|
310
|
+
elementId?: string;
|
|
311
|
+
/** Alert thresholds */
|
|
312
|
+
thresholds?: {
|
|
313
|
+
min?: number;
|
|
314
|
+
max?: number;
|
|
315
|
+
};
|
|
316
|
+
status: 'online' | 'offline' | 'warning' | 'error';
|
|
317
|
+
}
|
|
318
|
+
export interface DigitalTwinConfig {
|
|
319
|
+
buildingId: string;
|
|
320
|
+
/** WebSocket or REST endpoint for sensor data */
|
|
321
|
+
dataEndpoint: string;
|
|
322
|
+
/** Update interval in ms */
|
|
323
|
+
pollInterval: number;
|
|
324
|
+
sensors: IoTSensor[];
|
|
325
|
+
/** Overlay mode */
|
|
326
|
+
visualization: 'heatmap' | 'markers' | 'gradient' | 'text';
|
|
327
|
+
}
|
|
328
|
+
export interface ConstructionPhase {
|
|
329
|
+
id: string;
|
|
330
|
+
name: string;
|
|
331
|
+
order: number;
|
|
332
|
+
startDate: string;
|
|
333
|
+
endDate: string;
|
|
334
|
+
color: string;
|
|
335
|
+
/** BIM elements visible in this phase */
|
|
336
|
+
elementIds: string[];
|
|
337
|
+
/** Description / notes */
|
|
338
|
+
description?: string;
|
|
339
|
+
}
|
|
340
|
+
export interface SunPathPoint {
|
|
341
|
+
azimuth: number;
|
|
342
|
+
altitude: number;
|
|
343
|
+
hour: number;
|
|
344
|
+
month: number;
|
|
345
|
+
}
|
|
346
|
+
export interface SiteAnalysis {
|
|
347
|
+
latitude: number;
|
|
348
|
+
longitude: number;
|
|
349
|
+
elevation: number;
|
|
350
|
+
/** Sun path data for key dates */
|
|
351
|
+
sunPath: SunPathPoint[];
|
|
352
|
+
/** Prevailing wind direction (degrees from N) */
|
|
353
|
+
windDirection: number;
|
|
354
|
+
/** Average wind speed (m/s) */
|
|
355
|
+
windSpeed: number;
|
|
356
|
+
/** Terrain slope angle */
|
|
357
|
+
terrainSlope: number;
|
|
358
|
+
/** Terrain aspect (facing direction in degrees) */
|
|
359
|
+
terrainAspect: number;
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Compute solar altitude for given date/time and location.
|
|
363
|
+
* Simplified formula — accurate within ~1°.
|
|
364
|
+
*/
|
|
365
|
+
export declare function computeSolarAltitude(latitude: number, dayOfYear: number, hourAngle: number): number;
|
|
366
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bim/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAMtD,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;AAErD,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,QAAQ,CAAC,EAAE;QAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IACrD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,SAAS,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,SAAS,EAAE,CAAC;IACtB,gBAAgB,EAAE,cAAc,EAAE,CAAC;CACpC;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,SAAS,GAAG,aAAa,GAAG,mBAAmB,GAAG,UAAU,CAAC;IACnE,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,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;IACrB,mBAAmB;IACnB,aAAa,EAAE,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,MAAM,CAAC;CAC5D;AAMD,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,yCAAyC;IACzC,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,0BAA0B;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAMD,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,kCAAkC;IAClC,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,iDAAiD;IACjD,aAAa,EAAE,MAAM,CAAC;IACtB,+BAA+B;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,0BAA0B;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,MAAM,CAUR"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BIM / AEC Features — IFC, Revit interop, MEP routing, clash detection,
|
|
3
|
+
* scheduling, costing, point-cloud, digital twin.
|
|
4
|
+
*
|
|
5
|
+
* PRO-2.4 — 16 items
|
|
6
|
+
*
|
|
7
|
+
* @module @nice2dev/spatial-core/bim
|
|
8
|
+
*/
|
|
9
|
+
export function computeRoomArea(boundary) {
|
|
10
|
+
let area = 0;
|
|
11
|
+
const n = boundary.length;
|
|
12
|
+
for (let i = 0; i < n; i++) {
|
|
13
|
+
const j = (i + 1) % n;
|
|
14
|
+
area += boundary[i].x * boundary[j].y;
|
|
15
|
+
area -= boundary[j].x * boundary[i].y;
|
|
16
|
+
}
|
|
17
|
+
return Math.abs(area) / 2;
|
|
18
|
+
}
|
|
19
|
+
export function generateQuantityReport(projectName, items, currency = 'EUR') {
|
|
20
|
+
const totalCost = items.reduce((sum, i) => sum + i.quantity * (i.unitCost ?? 0), 0);
|
|
21
|
+
return {
|
|
22
|
+
projectName,
|
|
23
|
+
date: new Date().toISOString().split('T')[0],
|
|
24
|
+
items,
|
|
25
|
+
totalCost,
|
|
26
|
+
currency,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export function computeCostEstimate(projectName, items, contingencyPercent = 10, currency = 'EUR') {
|
|
30
|
+
const totalLabor = items.reduce((s, i) => s + i.laborCost * i.quantity, 0);
|
|
31
|
+
const totalMaterial = items.reduce((s, i) => s + i.materialCost * i.quantity, 0);
|
|
32
|
+
const totalEquipment = items.reduce((s, i) => s + i.equipmentCost * i.quantity, 0);
|
|
33
|
+
const totalOverhead = items.reduce((s, i) => s + i.overhead * i.quantity, 0);
|
|
34
|
+
const subtotal = totalLabor + totalMaterial + totalEquipment + totalOverhead;
|
|
35
|
+
const contingency = subtotal * (contingencyPercent / 100);
|
|
36
|
+
return {
|
|
37
|
+
projectName,
|
|
38
|
+
currency,
|
|
39
|
+
items,
|
|
40
|
+
contingency,
|
|
41
|
+
totalLabor,
|
|
42
|
+
totalMaterial,
|
|
43
|
+
totalEquipment,
|
|
44
|
+
totalOverhead,
|
|
45
|
+
grandTotal: subtotal + contingency,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Compute solar altitude for given date/time and location.
|
|
50
|
+
* Simplified formula — accurate within ~1°.
|
|
51
|
+
*/
|
|
52
|
+
export function computeSolarAltitude(latitude, dayOfYear, hourAngle) {
|
|
53
|
+
const declination = 23.45 * Math.sin((360 / 365) * (dayOfYear - 81) * (Math.PI / 180));
|
|
54
|
+
const latRad = latitude * (Math.PI / 180);
|
|
55
|
+
const declRad = declination * (Math.PI / 180);
|
|
56
|
+
const haRad = hourAngle * (Math.PI / 180);
|
|
57
|
+
const sinAlt = Math.sin(latRad) * Math.sin(declRad) + Math.cos(latRad) * Math.cos(declRad) * Math.cos(haRad);
|
|
58
|
+
return Math.asin(sinAlt) * (180 / Math.PI);
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/bim/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAsFH,MAAM,UAAU,eAAe,CAAC,QAAmB;IACjD,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,MAAM,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC;IAC1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3B,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;QACtB,IAAI,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACtC,IAAI,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC5B,CAAC;AAyFD,MAAM,UAAU,sBAAsB,CACpC,WAAmB,EACnB,KAAqB,EACrB,QAAQ,GAAG,KAAK;IAE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