/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ /** * Relationships display component for IFC element structural relationships. */ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible'; import { Link2, Focus } from 'lucide-react'; import type { EntityRelationships } from '@ifc-lite/parser'; interface RelationshipsCardProps { relationships: EntityRelationships; onSelectEntity?: (entityId: number) => void; /** Isolate + select all member objects of a group/zone in 3D (#1075). */ onIsolateGroupMembers?: (groupId: number) => void; } export function RelationshipsCard({ relationships, onSelectEntity, onIsolateGroupMembers }: RelationshipsCardProps) { const { voids, fills, groups, connections } = relationships; const totalCount = voids.length + fills.length + groups.length + connections.length; if (totalCount === 0) return null; return ( Relationships {totalCount}
{voids.length > 0 && (
Openings ({voids.length})
{voids.map((item) => ( ))}
)} {fills.length > 0 && (
Fills ({fills.length})
{fills.map((item) => ( ))}
)} {groups.length > 0 && (
Groups & Zones ({groups.length})
{groups.map((item) => ( ))}
)} {connections.length > 0 && (
Connections ({connections.length})
{connections.map((item) => ( ))}
)}
); } function RelItem({ item, onSelect }: { item: { id: number; name?: string; type: string }; onSelect?: (id: number) => void; }) { return ( ); } /** A group/zone row (IfcZone / IfcGroup / IfcSystem): click the name to inspect * the group's own attributes; click the focus button to isolate + select all of * its member objects (e.g. every space in a dwelling) in the 3D view (#1075). */ function GroupItem({ item, onSelect, onIsolateMembers }: { item: { id: number; name?: string; type: string }; onSelect?: (id: number) => void; onIsolateMembers?: (id: number) => void; }) { return (
{onIsolateMembers && ( )}
); }