110 lines
1.9 KiB
TypeScript
110 lines
1.9 KiB
TypeScript
export type ShapeType = 'rectangle' | 'circle' | 'polygon';
|
|
|
|
export interface Point {
|
|
x: number;
|
|
y: number;
|
|
}
|
|
|
|
export interface Size {
|
|
width: number;
|
|
height: number;
|
|
}
|
|
|
|
export interface Rect extends Point, Size {}
|
|
|
|
export interface ShapeData {
|
|
type: ShapeType;
|
|
x: number;
|
|
y: number;
|
|
width: number;
|
|
height: number;
|
|
rotation?: number;
|
|
points?: Point[];
|
|
}
|
|
|
|
export type ConditionKind =
|
|
| 'walk_to_and_sit'
|
|
| 'around_open_area'
|
|
| 'near_entrance'
|
|
| 'near_object'
|
|
| 'not_blocking_path'
|
|
| 'accessible'
|
|
| 'open_circulation';
|
|
|
|
export interface ConditionSpec {
|
|
kind: ConditionKind;
|
|
weight: number;
|
|
params?: Record<string, unknown>;
|
|
}
|
|
|
|
export interface FurnitureConfig {
|
|
id: string;
|
|
name: string;
|
|
type?: string;
|
|
shape: ShapeData;
|
|
conditions: ConditionSpec[];
|
|
color?: string;
|
|
lockedForOptimization?: boolean;
|
|
placed?: boolean;
|
|
}
|
|
|
|
export interface Entrance {
|
|
x: number;
|
|
y: number;
|
|
width?: number;
|
|
height?: number;
|
|
rotation?: number;
|
|
}
|
|
|
|
export interface RoomConfig {
|
|
width: number;
|
|
height: number;
|
|
gridSize?: number;
|
|
}
|
|
|
|
export interface GridCell {
|
|
x: number;
|
|
y: number;
|
|
walkable: boolean;
|
|
}
|
|
|
|
export interface PathNode extends Point {
|
|
g: number;
|
|
h: number;
|
|
f: number;
|
|
parent?: PathNode;
|
|
}
|
|
|
|
export interface AccessibilityResult {
|
|
furnitureId: string;
|
|
distanceFromEntrance: number | null;
|
|
reachable: boolean;
|
|
pathLength: number | null;
|
|
}
|
|
|
|
export interface LayoutEvaluation {
|
|
totalScore: number;
|
|
conditionScores: Record<string, number>;
|
|
accessibility: AccessibilityResult[];
|
|
penalty: number;
|
|
}
|
|
|
|
export interface FurniturePreset {
|
|
id: string;
|
|
name: string;
|
|
shape: Omit<ShapeData, 'x' | 'y'>;
|
|
conditions: ConditionSpec[];
|
|
color?: string;
|
|
amount?: number;
|
|
isPreset?: boolean;
|
|
}
|
|
|
|
export interface LayoutState {
|
|
room: RoomConfig;
|
|
entrance: Entrance | null;
|
|
furniture: FurnitureConfig[];
|
|
presets?: FurniturePreset[];
|
|
objectCount?: number;
|
|
objectAmounts?: Record<string, number>;
|
|
}
|