UArFrame.fromMap constructor
Implementation
factory UArFrame.fromMap(Map<Object?, Object?> map) {
final Map<String, UArProjection> projections = <String, UArProjection>{};
final Object? raw = map["projections"];
if (raw is List<Object?>) {
for (final Object? entry in raw) {
if (entry is! List<Object?> || entry.length < 5) continue;
final String id = "${entry[0]}";
projections[id] = UArProjection(id: id, x: _d(entry[1]), y: _d(entry[2]), distance: _d(entry[3]), visibility: _i(entry[4]));
}
}
final Map<Object?, Object?> semantics = _map(map["semantics"]);
return UArFrame(
timestamp: _d(map["t"]),
camera: UArPose.fromList(map["camera"]),
fov: _d(map["fov"], 60),
light: map["light"] is Map<Object?, Object?> ? UArLightEstimate.fromMap(_map(map["light"])) : null,
geo: map["geo"] is Map<Object?, Object?> ? UArGeoPose.fromMap(_map(map["geo"])) : null,
centerHit: map["center"] is Map<Object?, Object?> ? UArHitResult.fromMap(_map(map["center"])) : null,
northYaw: map["northYaw"] is num ? _d(map["northYaw"]) : null,
heading: map["heading"] is num ? _d(map["heading"]) : null,
headingAccuracy: map["headingAccuracy"] is num ? _d(map["headingAccuracy"]) : null,
semantics: <String, double>{for (final MapEntry<Object?, Object?> e in semantics.entries) "${e.key}": _d(e.value)},
projections: projections,
);
}