WIP: Adds more tagged types for rectangular size calculations.

This commit is contained in:
2026-01-29 20:50:33 -05:00
parent 9379774fae
commit 9b618d55fa
9 changed files with 75 additions and 39 deletions

View File

@@ -1,7 +1,16 @@
import Tagged
public enum CFMTag {}
public typealias CFM = Tagged<CFMTag, Int>
/// A name space for general tag types.
public enum Tag {
public enum CFM {}
public enum DesignFrictionRate {}
public enum Height {}
public enum Round {}
public enum Width {}
}
public enum DesignFrictionRateTag {}
public typealias DesignFrictionRate = Tagged<DesignFrictionRateTag, Double>
public typealias CFM = Tagged<Tag.CFM, Int>
public typealias DesignFrictionRate = Tagged<Tag.DesignFrictionRate, Double>
public typealias Height = Tagged<Tag.Height, Int>
public typealias RoundSize = Tagged<Tag.Round, Int>
public typealias Width = Tagged<Tag.Width, Int>

View File

@@ -16,7 +16,7 @@ public struct TrunkSize: Codable, Equatable, Identifiable, Sendable {
public let rooms: [RoomProxy]
/// An optional rectangular height used to calculate the equivalent
/// rectangular size of the trunk.
public let height: Int?
public let height: Height?
/// An optional name / label used for identifying the trunk.
public let name: String?
@@ -25,7 +25,7 @@ public struct TrunkSize: Codable, Equatable, Identifiable, Sendable {
projectID: Project.ID,
type: TrunkType,
rooms: [RoomProxy],
height: Int? = nil,
height: Height? = nil,
name: String? = nil
) {
self.id = id
@@ -49,7 +49,7 @@ extension TrunkSize {
public let rooms: [Room.ID: [Int]]
/// An optional rectangular height used to calculate the equivalent
/// rectangular size of the trunk.
public let height: Int?
public let height: Height?
/// An optional name / label used for identifying the trunk.
public let name: String?
@@ -57,7 +57,7 @@ extension TrunkSize {
projectID: Project.ID,
type: TrunkType,
rooms: [Room.ID: [Int]],
height: Int? = nil,
height: Height? = nil,
name: String? = nil
) {
self.projectID = projectID
@@ -79,14 +79,14 @@ extension TrunkSize {
public let rooms: [Room.ID: [Int]]?
/// An optional rectangular height used to calculate the equivalent
/// rectangular size of the trunk.
public let height: Int?
public let height: Height?
/// An optional name / label used for identifying the trunk.
public let name: String?
public init(
type: TrunkType? = nil,
rooms: [Room.ID: [Int]]? = nil,
height: Int? = nil,
height: Height? = nil,
name: String? = nil
) {
self.type = type