Editor/Wall/ArchWallExpectedReport.cs
using System.Linq;
namespace Sunless.Architecture;
public sealed class ArchWallExpectedReport : IArchExpectedReport {
public ArchKind Kind => ArchKind.Wall;
public object Describe( object payload, ArchTarget target, ArchTool tool ) {
if ( payload is not ArchWall wall || target.Room is null ) {
return null;
}
var room = target.Room;
var kit = tool.Kit;
var height = ArchWallSection.Height( wall, room, kit );
return new {
wall.Id,
Start = $"{wall.Start.x:0.#},{wall.Start.y:0.#}",
End = $"{wall.End.x:0.#},{wall.End.y:0.#}",
wall.Length,
Height = height,
Thickness = wall.Thickness > 0f ? wall.Thickness : kit.WallThickness,
BaseZ = room.BaseHeight,
TopZ = room.BaseHeight + height,
Cladding = wall.Cladding.ToString(),
wall.Wainscot,
wall.Baseboard,
wall.Cap,
Bands = ArchWallTreatments.Ordered( wall.Bands, height )
.Select( band => $"{band.At( height ):0.#}{(band.AtHead ? " (head)" : "")} {band.Field}"
+ $"{(band.Course ? $" {band.Seat.ToString().ToLowerInvariant()} course" : "")}" )
.ToList(),
Pilasters = wall.Pilasters.Stands ? $"{wall.Pilasters.Bay:0.#} bay, {wall.Pilasters.Width:0.#} wide" : null,
// The entablature is the STOREY's ring, filed under the room as its own Cornice piece - this wall only
// names the style and hands the ring the segment it covers.
Cornice = string.IsNullOrWhiteSpace( wall.Cornice )
? null
: $"{wall.Cornice} on the storey ring, soffit at "
+ $"{room.BaseHeight + ArchStoreyCornice.Soffit( wall, kit, height ):0.#}",
Openings = wall.Openings.Select( opening => new {
opening.Id,
opening.Preset,
Kind = opening.Kind.ToString(),
opening.Offset,
opening.Width,
opening.Height,
opening.SillHeight,
LeftAlong = opening.Left,
RightAlong = opening.Right,
BottomZ = room.BaseHeight + opening.SillHeight,
TopZ = room.BaseHeight + opening.Top,
Glazed = opening.IsGlazed,
Hung = opening.IsHung,
Furniture = opening.Fitted.ToString()
} ).ToList()
};
}
}