import { type Box, type CrowdStands, type Pt, type RealBowl } from "./crowd.ts"; import { type ParkInput } from "./crowd.park.ts"; import { type Ground } from "./grounds.core.ts"; import { VENUE_ATTRIBUTION } from "./venues.ts"; export { VENUE_ATTRIBUTION }; /** How a fact is known: `documented` is what a source cited with it says; `plausible` is ours, for a bowl no source describes. */ export type StadiumBasis = "documented" | "plausible"; /** The configurations of a stadium: the field the seats are counted for. `cfl` and `nfl` are the football fields of the two leagues, `soccer` a soccer pitch, `mlb` a baseball field, `boxing` a boxing ring in a hall, `nba` a basketball court in a hall (an arena that stages basketball, Barclays Center). */ export type StadiumConfigId = "cfl" | "nfl" | "soccer" | "mlb" | "boxing" | "nba"; /** What a stadium is: a `stadium` has a football field and a soccer pitch lying along its length, a `park` is a baseball park, whose frame is home plate's, a `hall` is a hall with a ring in the middle and the seats round it. */ export type StadiumKind = "stadium" | "park" | "hall"; /** * The kinds of roof: `cable` is a cable-supported roof with an opening over the field that a retractable fabric closes (BC Place's); `fixed` a lid over the bowl; `canopy` roofs over some of the stands that leave the field * open (Lumen Field's); `panels` a retractable roof of sections high over a ballpark (T-Mobile Park's); `dome` an air-supported roof, a membrane held up by the air inside (Tokyo Dome's); `open` no roof over the * field (Koshien Stadium's). */ export type StadiumRoof = "cable" | "fixed" | "canopy" | "panels" | "dome" | "open"; /** What one configuration of a stadium is: its sport and its seats, and where the figure was read. */ export interface StadiumConfigData { sport: StadiumConfigId; /** The seats for this configuration: the infobox's figure for it, or Wikidata's. */ seats: number; source: "wikidata" | "wikipedia"; /** What was read, in a few words of ours. */ read: string; } /** The facts of a stadium: the seats of each configuration, the number of bowls and the kind of roof, each with what a source says. No text of an article is kept. */ export interface RealStadiumData { /** The key: `bc-place`, the key of the stadium's ground in `GROUNDS` (or of its park in `PARKS`). */ id: string; kind?: StadiumKind; /** The Wikidata item of the stadium. */ wikidata: string; /** The key of the stadium's ground in `GROUNDS` (its name, its place, its pitch): a stadium has one. */ ground?: string; /** The key of a ballpark in `PARKS` (its name, its place, its fence): a park has one. */ park?: string; /** Whose football field the first row stands round: the CFL's (the default) or the NFL's. */ gridiron?: "cfl" | "nfl"; /** The English Wikipedia article the facts that are not Wikidata's were read from, at a revision. */ en: { title: string; revision: number; }; /** The Japanese Wikipedia article some of the facts were read from, at a revision. */ ja?: { title: string; revision: number; }; /** The names of a hall, in both languages (a stadium's and a park's are those of its ground and its park): Wikidata's labels. */ names?: { en: string; ja: string; readingJa?: string; }; /** * Plain drawing choices where the sources say so, each with what was read: `ivyWalls` draws the building's walls in green (Koshien Stadium's ivy), `dirtInfield` draws the infield all dirt, with no grass inside the bases * (the same stadium's). They are drawn as plain colours, not as a picture of the plants or the soil. */ looks?: { ivyWalls?: string; dirtInfield?: string; brickWalls?: string; }; /** Which way a ballpark's field lies where no map says but a published list does: the heading from home plate to centre field in degrees clockwise from north, `streets` (the streets the list names at the bases and the outfield), where it was read and what was read. */ orientation?: { heading: number; basis: "streets"; source: string; read: string; }; configs: Partial>; /** The seats of the whole bowl where it holds more than a configuration's (Lumen Field's soccer seats are fewer: the upper sections are closed): the bowl is fitted to these and a configuration opens its seats from the lowest bowl up. */ bowlSeats?: number; /** Wikidata's own capacities (P1083), kept beside the figures used: they are often for another event or another year. */ wikidataSeats?: number[]; tiers: { /** The seating levels (bowls): a ballpark's four levels are drawn as a lower bowl, an upper bowl and the bleachers. */ count: 1 | 2 | 3 | 4; basis: StadiumBasis; /** The seats of the lowest bowl, where a source gives them: the lower tier's band holds this many whatever the configuration (the upper bowl is what is opened or closed for the others). */ lowerSeats?: number; /** A ballpark's seats by band, where the article gives them by level: the lower bowl, the upper bowl (the club, suite and view levels) and the bleachers. */ tierSeats?: { lower: number; upper: number; bleachers: number; }; read: string; }; /** A tower that leans over the stadium (the Olympic Stadium's Montreal Tower): its height and its inclination, as the article gives them. The tower's footprint is `StadiumOsm.tower`. */ tower?: { height: number; unit: "m"; angle: number; basis: StadiumBasis; read: string; }; /** The building's lower band, a podium under the concourse levels: its height in feet and how it is known (ours where the sources do not say). */ facade?: { podium: number; unit: "ft"; basis: StadiumBasis; read: string; }; /** A tower standing apart from the bowl, `endTower` (Lumen Field's, at the open north end): the storeys the article gives, and ours (`plausible`) the height in metres, the footprint in metres, and how far it stands along the field's axis from the middle of the pitch, in metres (positive towards the heading of the axis). */ endTower?: { storeys: number; height: number; size: [number, number]; along: number; basis: StadiumBasis; read: string; }; roof: { kind: StadiumRoof; basis: StadiumBasis; read: string; /** A cable roof's opening over the field, as the article gives it, in metres. */ opening?: { length: number; width: number; unit: "m"; }; /** A cable roof's masts round its rim, as the engineering article gives them: how many, and how high they rise over the ring beam, in metres (the source is named, apart from Wikipedia's, in `source`). */ masts?: { count: number; height: number; unit: "m"; source: string; }; /** A canopy's share of the seats it covers, as the article gives it. */ cover?: number; /** A retractable roof's bottom and top above the field, in feet, as the article gives them (an air-supported roof's height is the building's, from OpenStreetMap; a fixed roof's `top` is its crown's). */ bottom?: number; top?: number; /** A fixed roof on a frame of ribs (the Olympic Stadium's consoles): how many, how many of them are anchored to the ground, and where it is read. */ ribs?: { count: number; anchored: number; source: string; }; }; } /** What OpenStreetMap gave of a stadium: ODbL 1.0 data, "(c) OpenStreetMap contributors". */ export interface StadiumOsm { /** The element the outline is: `way/24705904`, `relation/2305831`. */ source: string; read: string; base: string; licence: "ODbL-1.0"; attribution: string; /** The building's height in metres, where OpenStreetMap maps one. */ height?: number; /** The roof OpenStreetMap maps over the building: its heights in metres (`height` to the top of the roof, `rise` of that the roof's own) and the opening in it as `[longitude, latitude]`. */ roof?: { source: string; height?: number; rise?: number; outer?: string; opening?: { source: string; ring: [number, number][]; }; ring?: [number, number][]; }; /** The canopies OpenStreetMap maps over some of the stands: each one's outline, the height of its top and how far it rises (metres). */ canopies?: { source: string; height: number; rise: number; /** OpenStreetMap's `roof:shape` where the roof has one (`round` for Lumen Field's two). */ shape?: string; ring: [number, number][]; }[]; /** * The tower OpenStreetMap maps beside the building, where the stadium has one (`RealStadiumData.tower`): its footprint (the tower's shaft seen from above, with its base) as `[longitude, latitude]`, the height OpenStreetMap * maps for it in metres, and the two ends of its axis worked out from them: the base, the footprint's point farthest from the middle of the building, and the top, 165 m up, which lies over the building (the shaft leans over * it at the inclination the article gives, so its top is that many metres from the base, towards the middle of the building). */ tower?: { source: string; height: number; ring: [number, number][]; base: [number, number]; top: [number, number]; }; /** The building's outline as `[longitude, latitude]`, not repeating its first point. */ ring: [number, number][]; /** * How the field lies, worked out when the data was made: the heading of its long side (degrees clockwise from north, 0 to under 180; for a ballpark, the heading from home plate out to centre field, 0 to under 360), how that * is known (`opening`: from the roof's opening, which the article says is the field's size; `pitch`: from the pitches OpenStreetMap maps, and for a ballpark from the grass of the field it maps, fitted to the fence * the park publishes (`rms`, in metres, is how far the two lie apart); `infield`: from the mapped infield, with the outline choosing which way is out to centre field; `building`: from the long axis of the * building's main hall, an inference; `streets`: from the streets a published list gives at the bases and the outfield of a ballpark, to the nearest 45 degrees, an inference; `none`: no direction is known, and the heading is a stand-in (90 for a field with a long side, and for a ballpark the way that keeps its fence and its stands inside the building)), * how much of a direction the building has (`strength`) and how much longer than wide the opening, the pitch or the hall is (`elongation`), and the middle of the field as `[longitude, latitude]` (home plate for a ballpark). */ axis: { heading: number; basis: "opening" | "pitch" | "infield" | "building" | "streets" | "none"; strength: number; elongation: number; centre: [number, number]; rms?: number; }; } /** A stadium: its facts and what OpenStreetMap gave. */ export interface RealStadium extends RealStadiumData { osm: StadiumOsm; } /** How the field lies in the building: its long side's heading (a ballpark's: home plate to centre field), how that is known, and the way north points on the page (degrees clockwise from the top). */ export interface StadiumOrientation { heading: number; basis: StadiumOsm["axis"]["basis"]; north: number; } /** The stadiums by key. */ export declare const STADIUMS: Readonly>; /** The keys of `STADIUMS`, in the order of the data. */ export declare const STADIUM_IDS: readonly string[]; /** The stadium with a key, or `undefined`. */ export declare const stadiumById: (id: string | undefined) => RealStadium | undefined; /** The stadium whose Wikidata item is `Q612227`, or `undefined`. */ export declare const stadiumByWikidata: (wikidata: string | undefined) => RealStadium | undefined; /** The kind of a stadium: a `stadium` unless it is a ballpark. */ export declare const stadiumKind: (stadium: RealStadium) => StadiumKind; /** The configurations a stadium has, in the order of its data. */ export declare const stadiumConfigs: (stadium: RealStadium) => StadiumConfigId[]; /** The ground a stadium is (its name, place and pitch). Throws for a ballpark, which has a park, and for a hall, which has none. */ export declare const groundOfStadium: (stadium: RealStadium) => Ground; /** The names a stadium goes by in both languages, of its ground or its park (a hall's own). */ export declare function stadiumNames(stadium: RealStadium): { en: string; ja: string; }; /** The heading the field's frame runs along, degrees clockwise from north: the long side's, and for a ballpark (whose frame has home plate at its origin, x to the right of the way out and y minus the way out) a quarter turn from the way out to centre field. */ export declare const stadiumFrameHeading: (stadium: RealStadium) => number; /** How the field lies in a stadium's building (see `StadiumOsm.axis`). */ export declare const stadiumOrientation: (stadium: RealStadium) => StadiumOrientation; /** The configuration a sport is: `cfl`, `nfl`, `soccer`, `mlb`, `boxing` or `nba`, or `undefined` for a sport a stadium has no configuration for. */ export declare const stadiumConfigOf: (sport: string | undefined) => StadiumConfigId | undefined; /** The seats of a stadium for a configuration (0 for one it has none of). */ export declare const stadiumSeats: (stadium: RealStadium, config: StadiumConfigId) => number; /** * The stylesheet of a stadium that stages more than one field (`data-stadium` on the drawing's root): the ground round the building is its own, the football field's, whichever field lies in it, so that a soccer pitch does not tint it * green (light only: the dark ground is one for every sport), and the crowd's dimming in the dark kept on a layer of its own. */ export declare const KYOGIJO_STADIUM_STYLE: string; /** How far a hall's first row is from the box of the ring, on every side, in feet (ours: the seats at the ringside are a few feet from the ropes). */ export declare const HALL_FIRST_ROW = 8; /** The height of the first row above the field, in feet, the rise of a bowl's rows by the number of bowls (what the lowest, a middle and the upper rise, at most), and the rise of the walk between two bowls (a suite level): ours, no source gives them. */ export declare const STADIUM_FIRST_HEIGHT = 5; export declare const STADIUM_RISES: Readonly>; export declare const STADIUM_WALK_RISE = 24; /** The height a roof's rim stands over the top row, at the least, in feet. */ export declare const STADIUM_CLEARANCE = 22; /** How far a canopy's low edge stands over the top row at the least, in feet: a bowl under a canopy is lowered to keep it. */ export declare const CANOPY_CLEARANCE = 6; /** The plan of a stadium for a configuration: its building in the drawing's frame, the bowl fitted inside, and how it lies. */ export interface StadiumPlan { stadium: RealStadium; config: StadiumConfigId; orientation: StadiumOrientation; /** The field, in the drawing's frame. */ box: Box; /** The building's outline in feet, in the drawing's frame (the field's long side along x, in the middle of the building's hall). */ footprint: Pt[]; /** The roof's opening in feet, in the drawing's frame, where OpenStreetMap maps it. */ opening: Pt[] | undefined; /** The stands for `layoutOf`: bowls, first row, ground, and the building and roof. */ bowl: RealBowl; /** The seats the bowls hold, by bowl, and in all: equal to the bowl's seats where the building has room (`fit` is `fits`). */ seats: { tier: string; seats: number; }[]; total: number; /** The seats open in this configuration: the configuration's own, counted from the lowest bowl up (the rest of a larger bowl is closed). */ open: number; /** The floor a seat takes in the plan, in square feet (one of `SEAT_AREAS`). */ seatArea: number; fit: "fits" | "tight"; } /** * The plan of a stadium's bowl for a configuration: the building's outline turned so that the field lies along x, a first row round a football field's footprint as a gridiron's stands have it, the largest bowl-shaped * outline that fits the building round the middle of the field, and between the two the bowls, the outer edge of each placed so that its band holds the share of the seats the sources give it, with a walk * between them. The bowl is the same building for every configuration (the seats of the configuration differ, and the field); where a bowl holds more seats than a configuration opens, the rest are closed. * @example * ```ts * import { planStadium, stadiumById } from "@johnmorrisdotca/kyogijo-stadiums/stadiums"; * const plan = planStadium(stadiumById("bc-place")!, "soccer", { x: 0, y: 0, w: 344.5, h: 223.1 }); * console.log(plan.orientation.basis, plan.seats.map((t) => `${t.tier} ${t.seats}`).join(", "), plan.total); * // opening lower 27695, upper 26805 54500 * ``` */ export declare function planStadium(stadium: RealStadium, config: StadiumConfigId, box: Box): StadiumPlan; /** The stands of a stadium for `layoutOf` and the 3D view, round a field: `planStadium`'s bowl. */ export declare const stadiumBowl: (stadium: RealStadium, config: StadiumConfigId, box: Box) => RealBowl; /** Whether the bowl lies inside the building: every corner of every bowl's outer edge is inside the footprint. */ export declare function stadiumBowlInside(plan: StadiumPlan): boolean; /** The plan of a ballpark: its usual stands (`parkLayout`), the depth of each band set so that it holds the seats the article gives for its level, and the building, the way home plate faces and the roof round them. */ export interface ParkPlan { stadium: RealStadium; config: StadiumConfigId; orientation: StadiumOrientation; /** The building's outline in feet, in the park's frame (home plate at its origin, x to the right of the way out to centre field, y minus the way out). */ footprint: Pt[]; /** The stands, with the building and the roof (`real`). */ stands: CrowdStands; /** The depth of each band of stands the seats gave, in feet. */ depths: { lower: number; upper: number; bleachers: number; }; /** The seats each band holds, and in all, against the configuration's. */ seats: { tier: string; seats: number; }[]; total: number; /** The floor a seat takes in the plan, in square feet: 4.6 as the usual stands have it, less where the building is too small for them and the bowl is steeper. */ seatArea: number; /** Whether the stands hold the configuration's seats to within two percent. */ fit: "fits" | "tight"; } /** * The plan of a ballpark from what its stands are laid from (`input`: the park's fence, the backstop and the crowd): the usual stands with each band as deep as its seats need, the building's outline turned so that home * plate faces where OpenStreetMap's infield and the outline say, and the roof: sections far over the field, closed over the stands and the field or resting over the east side where the article says they rest. */ export declare function planPark(stadium: RealStadium, input: ParkInput): ParkPlan;