Editor catalog for wall presets. Provides paths, reads authored presets from arch/walls, saves presets to disk, and returns a set of built-in wall treatments.
using System.Collections.Generic;
namespace Sunless.Architecture;
public sealed class ArchWallCatalog : IArchCatalog
{
public const string Directory = "arch/walls";
public ArchShelf Shelf => ArchShelf.Walls;
public string Named( object entry ) => entry is ArchWallPreset preset ? preset.Name : null;
public IEnumerable<object> Authored()
{
return ArchCatalogFiles.Read<ArchWallPreset>( Directory, ".wall.json", preset => preset.Name );
}
public bool Save( object entry )
{
return entry is ArchWallPreset preset
&& !string.IsNullOrWhiteSpace( preset.Name )
&& ArchStorage.WriteDocument( PathFor( preset.Name ), preset );
}
public static string PathFor( string name ) => $"{Directory}/{ArchCatalogFiles.Slug( name, "wall" )}.wall.json";
public IEnumerable<object> Shipped() => Treatments();
// Height and thickness stay 0 - a preset says how, the room says how big.
public static List<ArchWallPreset> Treatments()
{
return new List<ArchWallPreset>
{
new() { Name = "plain" },
new() { Name = "capped", Cap = true },
new() { Name = "interior", Exterior = false },
new() { Name = "wainscot", Exterior = false, Wainscot = true },
new() { Name = "weatherboard", Cladding = WallCladding.Weatherboard },
// Brick to dado height with a stripe on the change.
new()
{
Name = "office",
Cap = true,
Bands = new List<ArchWallBand> { new() { Height = 44f, Field = ArchSurface.WallBase } }
},
// Plinth at the paving, brick line above it, panel over that.
new()
{
Name = "plinth_and_brick",
Bands = new List<ArchWallBand>
{
new() { Height = 12f, Field = ArchSurface.Foundation, CourseHeight = 5f, CourseDepth = 2.4f },
new() { Height = 60f, Field = ArchSurface.WallBase }
}
},
// The cap is heavier than the string course: it caps a field rather than dividing two.
new()
{
Name = "brick_and_plaster",
Bands = new List<ArchWallBand>
{
new() { Height = 96f, Field = ArchSurface.WallBase, CourseHeight = 3f, CourseDepth = 1.2f },
new() { AtHead = true, Field = ArchSurface.Panel, Seat = BandSeat.Above, CourseHeight = 14f, CourseDepth = 4.5f }
}
},
// Profiled sheeting on a concrete upstand, frame expressed outside.
new()
{
Name = "industrial",
Cladding = WallCladding.Profiled,
Baseboard = false,
Bands = new List<ArchWallBand> { new() { Height = 24f, Field = ArchSurface.Foundation } },
Pilasters = new ArchPilasterRun { Bay = 168f, Width = 14f, Depth = 3f }
}
};
}
}