Files
WebtreesFullDiagram/src/Model/FamilyNode.php
T
Alexander 273e398431 Initial commit: webtrees full diagram chart module
Interactive SVG family tree visualization using ELK (Sugiyama) for
layout and D3 for rendering. Shows ancestors, descendants, and siblings
in a single diagram with orthogonal bus-line connectors.

Features:
- Bidirectional tree traversal (ancestors + descendants + siblings)
- Generation-aligned layout with post-processing Y-snap
- Person cards with photos, names, dates, and hover bio cards
- "More ancestors" indicator for persons with hidden parents
- Pan/zoom navigation
- Docker dev environment
2026-03-14 18:52:17 +01:00

40 lines
935 B
PHP

<?php
declare(strict_types=1);
namespace FullDiagram\Model;
use JsonSerializable;
class FamilyNode implements JsonSerializable
{
/**
* @param NodeData|null $spouse
* @param list<NodeData> $children
* @param string $familyXref
* @param list<NodeData> $parents Used in ancestor context (both parents)
*/
public function __construct(
private readonly ?NodeData $spouse,
private readonly array $children = [],
private readonly string $familyXref = '',
private readonly array $parents = [],
) {
}
public function jsonSerialize(): mixed
{
$data = [
'familyXref' => $this->familyXref,
'spouse' => $this->spouse,
'children' => $this->children,
];
if ($this->parents !== []) {
$data['parents'] = $this->parents;
}
return $data;
}
}