@seatmap-fyi/map-domain 0.1.0-alpha.3 → 0.1.0-alpha.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/arc-fan-rebuild.d.ts +13 -0
- package/dist/arc-fan-rebuild.js +163 -0
- package/dist/arc-fan.d.ts +27 -0
- package/dist/arc-fan.interface.d.ts +83 -0
- package/dist/arc-fan.interface.js +30 -0
- package/dist/arc-fan.js +182 -0
- package/dist/catalog.d.ts +10 -3
- package/dist/catalog.js +66 -10
- package/dist/categories.d.ts +27 -0
- package/dist/categories.js +217 -0
- package/dist/editor-state.d.ts +4 -1
- package/dist/editor-state.js +61 -31
- package/dist/floors.d.ts +22 -0
- package/dist/floors.js +77 -0
- package/dist/geometry/boundary.d.ts +1 -1
- package/dist/geometry/boundary.js +16 -12
- package/dist/geometry/curve-warnings.d.ts +1 -1
- package/dist/geometry/curve-warnings.js +3 -5
- package/dist/geometry/decoration-bounds.d.ts +4 -0
- package/dist/geometry/decoration-bounds.js +42 -0
- package/dist/geometry/ellipse.js +4 -12
- package/dist/geometry/geometry.d.ts +12 -3
- package/dist/geometry/geometry.js +37 -28
- package/dist/geometry/layout-transform.d.ts +10 -0
- package/dist/geometry/layout-transform.interface.d.ts +6 -0
- package/dist/geometry/layout-transform.interface.js +1 -0
- package/dist/geometry/layout-transform.js +206 -0
- package/dist/geometry/polygon-curves.d.ts +17 -0
- package/dist/geometry/polygon-curves.interface.d.ts +21 -0
- package/dist/geometry/polygon-curves.interface.js +5 -0
- package/dist/geometry/polygon-curves.js +169 -0
- package/dist/geometry/primitives.d.ts +1 -1
- package/dist/geometry/primitives.js +2 -3
- package/dist/geometry/seat-shape.d.ts +24 -0
- package/dist/geometry/seat-shape.js +101 -0
- package/dist/geometry/seating-layout.d.ts +20 -3
- package/dist/geometry/seating-layout.js +113 -19
- package/dist/geometry/units.d.ts +8 -0
- package/dist/geometry/units.js +13 -0
- package/dist/geometry/venue-outline.d.ts +4 -18
- package/dist/geometry/venue-outline.interface.d.ts +23 -0
- package/dist/geometry/venue-outline.interface.js +7 -0
- package/dist/geometry/venue-outline.js +107 -49
- package/dist/identity.d.ts +3 -1
- package/dist/identity.js +32 -9
- package/dist/issues.d.ts +15 -2
- package/dist/issues.js +16 -6
- package/dist/labels.d.ts +12 -1
- package/dist/labels.js +76 -11
- package/dist/layers.d.ts +26 -0
- package/dist/layers.js +86 -0
- package/dist/media.d.ts +27 -0
- package/dist/media.js +89 -0
- package/dist/physical-document.interface.d.ts +592 -0
- package/dist/physical-document.interface.js +179 -0
- package/dist/preview.d.ts +1 -1
- package/dist/preview.js +70 -25
- package/dist/reference.js +1 -1
- package/dist/row-segments.d.ts +30 -0
- package/dist/row-segments.js +113 -0
- package/dist/schema.d.ts +1578 -68
- package/dist/schema.js +467 -98
- package/dist/seat-proximity.d.ts +4 -0
- package/dist/seat-proximity.js +119 -0
- package/dist/section-elevation.d.ts +5 -0
- package/dist/section-elevation.interface.d.ts +26 -0
- package/dist/section-elevation.interface.js +8 -0
- package/dist/section-elevation.js +53 -0
- package/dist/section-fill-rebuild.d.ts +10 -0
- package/dist/section-fill-rebuild.js +64 -0
- package/dist/section-fill.d.ts +84 -0
- package/dist/section-fill.interface.d.ts +94 -0
- package/dist/section-fill.interface.js +22 -0
- package/dist/section-fill.js +306 -0
- package/dist/section-growth.d.ts +11 -0
- package/dist/section-growth.interface.d.ts +12 -0
- package/dist/section-growth.interface.js +1 -0
- package/dist/section-growth.js +198 -0
- package/dist/section-layout.d.ts +95 -0
- package/dist/section-layout.interface.d.ts +8 -0
- package/dist/section-layout.interface.js +5 -0
- package/dist/section-layout.js +70 -0
- package/dist/section-outline-refit.d.ts +8 -0
- package/dist/section-outline-refit.js +246 -0
- package/dist/section-refit.d.ts +22 -0
- package/dist/section-refit.interface.d.ts +49 -0
- package/dist/section-refit.interface.js +6 -0
- package/dist/section-refit.js +179 -0
- package/dist/section-scale.d.ts +2 -0
- package/dist/section-scale.js +128 -0
- package/dist/sections.d.ts +23 -0
- package/dist/sections.js +144 -0
- package/dist/selling.d.ts +34 -0
- package/dist/selling.js +148 -0
- package/dist/spacing-repairs.d.ts +31 -0
- package/dist/spacing-repairs.js +168 -0
- package/dist/table-layout.d.ts +29 -0
- package/dist/table-layout.js +134 -0
- package/dist/validation.d.ts +7 -2
- package/dist/validation.interface.d.ts +20 -0
- package/dist/validation.interface.js +9 -0
- package/dist/validation.js +227 -78
- package/dist/wayfinding.d.ts +10 -0
- package/dist/wayfinding.interface.d.ts +52 -0
- package/dist/wayfinding.interface.js +28 -0
- package/dist/wayfinding.js +63 -0
- package/package.json +109 -4
- package/dist/types.d.ts +0 -313
- package/dist/types.js +0 -91
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
// Structural capacity; the measured qualification workload remains 50,000 seats.
|
|
2
|
+
export const DocumentLimits = {
|
|
3
|
+
PhysicalSeats: 100_000,
|
|
4
|
+
JsonBytes: 64 * 1024 * 1024,
|
|
5
|
+
};
|
|
6
|
+
export var NumberingScheme;
|
|
7
|
+
(function (NumberingScheme) {
|
|
8
|
+
NumberingScheme["Numeric"] = "numeric";
|
|
9
|
+
NumberingScheme["Odd"] = "odd";
|
|
10
|
+
NumberingScheme["Even"] = "even";
|
|
11
|
+
NumberingScheme["Alphabetic"] = "alphabetic";
|
|
12
|
+
NumberingScheme["LowerAlphabetic"] = "lowerAlphabetic";
|
|
13
|
+
NumberingScheme["Roman"] = "roman";
|
|
14
|
+
NumberingScheme["OutsideIn"] = "outsideIn";
|
|
15
|
+
NumberingScheme["InsideOut"] = "insideOut";
|
|
16
|
+
})(NumberingScheme || (NumberingScheme = {}));
|
|
17
|
+
export var LabelDirection;
|
|
18
|
+
(function (LabelDirection) {
|
|
19
|
+
LabelDirection["Forward"] = "forward";
|
|
20
|
+
LabelDirection["Reverse"] = "reverse";
|
|
21
|
+
LabelDirection["Centre"] = "centre";
|
|
22
|
+
})(LabelDirection || (LabelDirection = {}));
|
|
23
|
+
export var RowLabelPosition;
|
|
24
|
+
(function (RowLabelPosition) {
|
|
25
|
+
RowLabelPosition["Left"] = "left";
|
|
26
|
+
RowLabelPosition["Right"] = "right";
|
|
27
|
+
RowLabelPosition["Both"] = "both";
|
|
28
|
+
})(RowLabelPosition || (RowLabelPosition = {}));
|
|
29
|
+
export var AccessNeed;
|
|
30
|
+
(function (AccessNeed) {
|
|
31
|
+
AccessNeed["Companion"] = "companion";
|
|
32
|
+
AccessNeed["LimitedMobility"] = "limitedMobility";
|
|
33
|
+
AccessNeed["AisleTransfer"] = "aisleTransfer";
|
|
34
|
+
AccessNeed["StepFree"] = "stepFree";
|
|
35
|
+
AccessNeed["PlusSize"] = "plusSize";
|
|
36
|
+
AccessNeed["LiftUpArmrest"] = "liftUpArmrest";
|
|
37
|
+
AccessNeed["HearingLoop"] = "hearingLoop";
|
|
38
|
+
AccessNeed["LiveCaptions"] = "liveCaptions";
|
|
39
|
+
AccessNeed["SignLanguageView"] = "signLanguageView";
|
|
40
|
+
AccessNeed["LowVision"] = "lowVision";
|
|
41
|
+
AccessNeed["SensoryFriendly"] = "sensoryFriendly";
|
|
42
|
+
})(AccessNeed || (AccessNeed = {}));
|
|
43
|
+
export var TicketRestriction;
|
|
44
|
+
(function (TicketRestriction) {
|
|
45
|
+
TicketRestriction["Anyone"] = "anyone";
|
|
46
|
+
TicketRestriction["Child"] = "child";
|
|
47
|
+
TicketRestriction["Senior"] = "senior";
|
|
48
|
+
TicketRestriction["Student"] = "student";
|
|
49
|
+
TicketRestriction["Companion"] = "companion";
|
|
50
|
+
TicketRestriction["Membership"] = "membership";
|
|
51
|
+
TicketRestriction["Custom"] = "custom";
|
|
52
|
+
})(TicketRestriction || (TicketRestriction = {}));
|
|
53
|
+
export const TicketOptionLimit = 20;
|
|
54
|
+
export var SeatShape;
|
|
55
|
+
(function (SeatShape) {
|
|
56
|
+
SeatShape["Circle"] = "circle";
|
|
57
|
+
SeatShape["Theatre"] = "theatre";
|
|
58
|
+
SeatShape["Dining"] = "dining";
|
|
59
|
+
SeatShape["Folding"] = "folding";
|
|
60
|
+
SeatShape["Armchair"] = "armchair";
|
|
61
|
+
SeatShape["Recliner"] = "recliner";
|
|
62
|
+
SeatShape["Stool"] = "stool";
|
|
63
|
+
SeatShape["Bench"] = "bench";
|
|
64
|
+
})(SeatShape || (SeatShape = {}));
|
|
65
|
+
export var RowEnds;
|
|
66
|
+
(function (RowEnds) {
|
|
67
|
+
RowEnds["Start"] = "start";
|
|
68
|
+
RowEnds["End"] = "end";
|
|
69
|
+
RowEnds["Both"] = "both";
|
|
70
|
+
RowEnds["None"] = "none";
|
|
71
|
+
})(RowEnds || (RowEnds = {}));
|
|
72
|
+
export var RowStagger;
|
|
73
|
+
(function (RowStagger) {
|
|
74
|
+
RowStagger["First"] = "first";
|
|
75
|
+
RowStagger["Second"] = "second";
|
|
76
|
+
})(RowStagger || (RowStagger = {}));
|
|
77
|
+
export var RowAlignment;
|
|
78
|
+
(function (RowAlignment) {
|
|
79
|
+
RowAlignment["Start"] = "start";
|
|
80
|
+
RowAlignment["Center"] = "center";
|
|
81
|
+
RowAlignment["End"] = "end";
|
|
82
|
+
})(RowAlignment || (RowAlignment = {}));
|
|
83
|
+
export var LabelAlignment;
|
|
84
|
+
(function (LabelAlignment) {
|
|
85
|
+
LabelAlignment["Left"] = "left";
|
|
86
|
+
LabelAlignment["Center"] = "center";
|
|
87
|
+
LabelAlignment["Right"] = "right";
|
|
88
|
+
})(LabelAlignment || (LabelAlignment = {}));
|
|
89
|
+
export var RowJoin;
|
|
90
|
+
(function (RowJoin) {
|
|
91
|
+
RowJoin["Aisle"] = "aisle";
|
|
92
|
+
RowJoin["Continuous"] = "continuous";
|
|
93
|
+
})(RowJoin || (RowJoin = {}));
|
|
94
|
+
export var TableBookingMode;
|
|
95
|
+
(function (TableBookingMode) {
|
|
96
|
+
TableBookingMode["Individual"] = "individual";
|
|
97
|
+
TableBookingMode["Whole"] = "whole";
|
|
98
|
+
TableBookingMode["Party"] = "party";
|
|
99
|
+
})(TableBookingMode || (TableBookingMode = {}));
|
|
100
|
+
export var StandingBookingMode;
|
|
101
|
+
(function (StandingBookingMode) {
|
|
102
|
+
StandingBookingMode["Standing"] = "standing";
|
|
103
|
+
StandingBookingMode["Whole"] = "whole";
|
|
104
|
+
StandingBookingMode["Party"] = "party";
|
|
105
|
+
})(StandingBookingMode || (StandingBookingMode = {}));
|
|
106
|
+
export var TableChairDistribution;
|
|
107
|
+
(function (TableChairDistribution) {
|
|
108
|
+
TableChairDistribution["Interior"] = "interior";
|
|
109
|
+
TableChairDistribution["EqualSegments"] = "equalSegments";
|
|
110
|
+
})(TableChairDistribution || (TableChairDistribution = {}));
|
|
111
|
+
export var SectionOutlineRole;
|
|
112
|
+
(function (SectionOutlineRole) {
|
|
113
|
+
SectionOutlineRole["Boundary"] = "boundary";
|
|
114
|
+
SectionOutlineRole["Overview"] = "overview";
|
|
115
|
+
})(SectionOutlineRole || (SectionOutlineRole = {}));
|
|
116
|
+
export const RowRefitStrength = { min: 0, max: 100 };
|
|
117
|
+
export const SectionRotation = { min: -180, max: 180, initial: 0 };
|
|
118
|
+
export const SectionScale = { min: 50, max: 160, initial: 100 };
|
|
119
|
+
export var SectionTier;
|
|
120
|
+
(function (SectionTier) {
|
|
121
|
+
SectionTier["Floor"] = "floor";
|
|
122
|
+
SectionTier["RaisedOne"] = "raised-one";
|
|
123
|
+
SectionTier["RaisedTwo"] = "raised-two";
|
|
124
|
+
SectionTier["RaisedThree"] = "raised-three";
|
|
125
|
+
})(SectionTier || (SectionTier = {}));
|
|
126
|
+
export const SectionRake = { min: 0, max: 45, step: 1 };
|
|
127
|
+
export const SectionFrontRowHeight = { min: 0, max: 120, step: 0.5 };
|
|
128
|
+
export var EntityFamily;
|
|
129
|
+
(function (EntityFamily) {
|
|
130
|
+
EntityFamily["Group"] = "group";
|
|
131
|
+
EntityFamily["Area"] = "area";
|
|
132
|
+
EntityFamily["Decoration"] = "decoration";
|
|
133
|
+
EntityFamily["Collection"] = "collection";
|
|
134
|
+
EntityFamily["Section"] = "section";
|
|
135
|
+
EntityFamily["Asset"] = "asset";
|
|
136
|
+
EntityFamily["Seat"] = "seat";
|
|
137
|
+
EntityFamily["Row"] = "row";
|
|
138
|
+
})(EntityFamily || (EntityFamily = {}));
|
|
139
|
+
export var SeatingKind;
|
|
140
|
+
(function (SeatingKind) {
|
|
141
|
+
SeatingKind["Straight"] = "straightRows";
|
|
142
|
+
SeatingKind["Curved"] = "curvedRows";
|
|
143
|
+
SeatingKind["Rectangular"] = "rectangularTable";
|
|
144
|
+
SeatingKind["Round"] = "roundTable";
|
|
145
|
+
})(SeatingKind || (SeatingKind = {}));
|
|
146
|
+
export var DecorationKind;
|
|
147
|
+
(function (DecorationKind) {
|
|
148
|
+
DecorationKind["Polygon"] = "polygon";
|
|
149
|
+
DecorationKind["Text"] = "text";
|
|
150
|
+
DecorationKind["Rectangle"] = "rectangle";
|
|
151
|
+
DecorationKind["Circle"] = "circle";
|
|
152
|
+
DecorationKind["Line"] = "line";
|
|
153
|
+
DecorationKind["Icon"] = "icon";
|
|
154
|
+
DecorationKind["Image"] = "image";
|
|
155
|
+
})(DecorationKind || (DecorationKind = {}));
|
|
156
|
+
export var AreaKind;
|
|
157
|
+
(function (AreaKind) {
|
|
158
|
+
AreaKind["GeneralAdmission"] = "generalAdmission";
|
|
159
|
+
AreaKind["Booth"] = "booth";
|
|
160
|
+
})(AreaKind || (AreaKind = {}));
|
|
161
|
+
export var VenueGlyph;
|
|
162
|
+
(function (VenueGlyph) {
|
|
163
|
+
VenueGlyph["Stage"] = "stage";
|
|
164
|
+
VenueGlyph["Entrance"] = "entrance";
|
|
165
|
+
VenueGlyph["Exit"] = "exit";
|
|
166
|
+
VenueGlyph["Bar"] = "bar";
|
|
167
|
+
VenueGlyph["Restroom"] = "restroom";
|
|
168
|
+
VenueGlyph["Accessible"] = "accessible";
|
|
169
|
+
})(VenueGlyph || (VenueGlyph = {}));
|
|
170
|
+
export var ShapeKind;
|
|
171
|
+
(function (ShapeKind) {
|
|
172
|
+
ShapeKind["Rectangle"] = "rectangle";
|
|
173
|
+
ShapeKind["Polygon"] = "polygon";
|
|
174
|
+
})(ShapeKind || (ShapeKind = {}));
|
|
175
|
+
export var CurveMode;
|
|
176
|
+
(function (CurveMode) {
|
|
177
|
+
CurveMode["Sweep"] = "fixedSweep";
|
|
178
|
+
CurveMode["Pitch"] = "fixedPitch";
|
|
179
|
+
})(CurveMode || (CurveMode = {}));
|
package/dist/preview.d.ts
CHANGED
package/dist/preview.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LineCap, LineJoin } from "./wayfinding.interface.js";
|
|
2
|
+
import { polygonContour } from "./geometry/polygon-curves.js";
|
|
3
|
+
import { layerCatalog } from "./layers.js";
|
|
4
|
+
import { sectionCatalog } from "./sections.js";
|
|
5
|
+
import { documentGroupSeats } from "./catalog.js";
|
|
6
|
+
import { footprint, project, worldMatrices, multiply, transformMatrix } from "./geometry/geometry.js";
|
|
2
7
|
import { emptyBounds, extend } from "./geometry/primitives.js";
|
|
3
|
-
import {
|
|
8
|
+
import { categoryCatalog, categorySeatShape } from "./categories.js";
|
|
9
|
+
import { seatShapeParts, SeatShapePartKind } from "./geometry/seat-shape.js";
|
|
10
|
+
import { DecorationKind, SeatingKind, ShapeKind, SeatShape } from "./physical-document.interface.js";
|
|
4
11
|
export const ThumbnailPolicy = {
|
|
5
12
|
MaximumSvgLength: 128000,
|
|
6
13
|
MaximumContentLength: 120000,
|
|
@@ -13,6 +20,8 @@ export const ThumbnailPolicy = {
|
|
|
13
20
|
export function projectMapPreview(document) {
|
|
14
21
|
const bounds = emptyBounds();
|
|
15
22
|
const matrices = worldMatrices(document);
|
|
23
|
+
const categories = categoryCatalog(document);
|
|
24
|
+
const owners = sectionCatalog(document).owners;
|
|
16
25
|
const sections = new Map(document.sections.map((section) => [section.id, section]));
|
|
17
26
|
const foreground = parseInt(document.background.color.slice(1, 3), 16) +
|
|
18
27
|
parseInt(document.background.color.slice(3, 5), 16) +
|
|
@@ -22,19 +31,24 @@ export function projectMapPreview(document) {
|
|
|
22
31
|
: "#ffffff";
|
|
23
32
|
const paint = (value, fallback = foreground) => `fill="${value?.color ?? fallback}" fill-opacity="${value?.opacity ?? 0.45}"`;
|
|
24
33
|
const number = (value) => value.toFixed(3);
|
|
34
|
+
const layers = layerCatalog(document);
|
|
35
|
+
const fragments = [];
|
|
36
|
+
let layer = -Infinity;
|
|
25
37
|
let content = "";
|
|
26
38
|
let glyphs = 0;
|
|
27
39
|
let empty = true;
|
|
28
40
|
const append = (markup) => {
|
|
29
|
-
if (content.length + markup.length <= ThumbnailPolicy.MaximumContentLength)
|
|
41
|
+
if (content.length + markup.length <= ThumbnailPolicy.MaximumContentLength) {
|
|
30
42
|
content += markup;
|
|
43
|
+
fragments.push({ order: layer, markup });
|
|
44
|
+
}
|
|
31
45
|
};
|
|
32
46
|
const point = (value, matrix) => {
|
|
33
47
|
const result = matrix ? project(matrix, value) : value;
|
|
34
48
|
extend(bounds, result);
|
|
35
49
|
return `${number(result.x)},${number(result.y)}`;
|
|
36
50
|
};
|
|
37
|
-
const polygon = (value, matrix) => [value.outer, ...value.holes]
|
|
51
|
+
const polygon = (value, matrix) => [polygonContour(value).outer, ...value.holes]
|
|
38
52
|
.map((ring) => {
|
|
39
53
|
for (const entry of ring)
|
|
40
54
|
point(entry, matrix);
|
|
@@ -58,9 +72,10 @@ export function projectMapPreview(document) {
|
|
|
58
72
|
append(`<path d="${polygon(section.outline)}" ${paint(section.style?.fill)} fill-rule="evenodd"/>`);
|
|
59
73
|
}
|
|
60
74
|
for (const group of document.seatingGroups) {
|
|
75
|
+
layer = layers.order.get(group.id);
|
|
61
76
|
empty = false;
|
|
62
77
|
const matrix = matrices.get(group.id);
|
|
63
|
-
const colour = sections.get(group.
|
|
78
|
+
const colour = sections.get(owners.get(group.id) ?? "")?.style?.fill?.color ?? foreground;
|
|
64
79
|
if (group.boundary)
|
|
65
80
|
append(`<path d="${polygon(group.boundary, matrix)}" fill="${colour}" fill-opacity=".3" fill-rule="evenodd"/>`);
|
|
66
81
|
if (group.kind === SeatingKind.Rectangular)
|
|
@@ -73,12 +88,15 @@ export function projectMapPreview(document) {
|
|
|
73
88
|
append(`<path d="${polygon({ outer: ring, holes: [] }, matrix)}" fill="${colour}" fill-opacity=".55"/>`);
|
|
74
89
|
}
|
|
75
90
|
const rows = new Map();
|
|
76
|
-
const rowCounts = new Map("rows" in group
|
|
77
|
-
? group.rows.map((row) => [row.id, row.seats.length])
|
|
78
|
-
: []);
|
|
91
|
+
const rowCounts = new Map("rows" in group ? group.rows.map((row) => [row.id, row.seats.length]) : []);
|
|
79
92
|
let index = 0;
|
|
80
93
|
const rowIndices = new Map();
|
|
81
|
-
for (const seat of
|
|
94
|
+
for (const seat of documentGroupSeats(document, group)) {
|
|
95
|
+
layer = layers.order.get(seat.rowId ?? group.id);
|
|
96
|
+
if (seat.slot.gap) {
|
|
97
|
+
index++;
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
82
100
|
const position = project(matrix, seat.position);
|
|
83
101
|
const radius = Math.max(seat.size.width, seat.size.height) / 2;
|
|
84
102
|
for (const corner of footprint(seat, matrix))
|
|
@@ -88,31 +106,57 @@ export function projectMapPreview(document) {
|
|
|
88
106
|
const count = rowCounts.get(seat.rowId) ?? 1;
|
|
89
107
|
const slot = rowIndices.get(seat.rowId) ?? 0;
|
|
90
108
|
rowIndices.set(seat.rowId, slot + 1);
|
|
91
|
-
if (slot % Math.max(1, Math.ceil(count / 24)) === 0 ||
|
|
92
|
-
slot === count - 1)
|
|
109
|
+
if (slot % Math.max(1, Math.ceil(count / 24)) === 0 || slot === count - 1)
|
|
93
110
|
row.push(`${number(position.x)},${number(position.y)}`);
|
|
94
111
|
rows.set(seat.rowId, row);
|
|
95
112
|
}
|
|
96
113
|
if (glyphs < ThumbnailPolicy.MaximumSeatGlyphs && index % 8 === 0) {
|
|
97
|
-
|
|
114
|
+
const category = seat.categoryId ? categories.get(seat.categoryId) : undefined;
|
|
115
|
+
const shape = categorySeatShape(category, seat.slot);
|
|
116
|
+
const seatColour = category?.color ?? colour;
|
|
117
|
+
if (shape === SeatShape.Circle) {
|
|
118
|
+
append(`<circle cx="${number(position.x)}" cy="${number(position.y)}" r="${number(radius)}" fill="${seatColour}" fill-opacity=".8"/>`);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
const transform = multiply(matrix, transformMatrix({
|
|
122
|
+
positionM: seat.position,
|
|
123
|
+
rotationDeg: seat.rotationDeg,
|
|
124
|
+
}));
|
|
125
|
+
const shapeMarkup = seatShapeParts(shape)
|
|
126
|
+
.map((part) => {
|
|
127
|
+
if (part.kind === SeatShapePartKind.Rectangle)
|
|
128
|
+
return `<rect x="${number(part.x * seat.size.width)}" y="${number(part.y * seat.size.height)}" width="${number(part.width * seat.size.width)}" height="${number(part.height * seat.size.height)}" rx="${number(part.radius * Math.min(seat.size.width, seat.size.height))}"/>`;
|
|
129
|
+
const points = [];
|
|
130
|
+
for (let index = 0; index < part.points.length; index += 2)
|
|
131
|
+
points.push(`${number(part.points[index] * seat.size.width)},${number(part.points[index + 1] * seat.size.height)}`);
|
|
132
|
+
return `<polygon points="${points.join(" ")}"/>`;
|
|
133
|
+
})
|
|
134
|
+
.join("");
|
|
135
|
+
append(`<g transform="matrix(${transform.a} ${transform.b} ${transform.c} ${transform.d} ${transform.tx} ${transform.ty})" fill="${seatColour}" fill-opacity=".8">${shapeMarkup}</g>`);
|
|
136
|
+
}
|
|
98
137
|
glyphs++;
|
|
99
138
|
}
|
|
100
139
|
index++;
|
|
101
140
|
}
|
|
102
141
|
if (!group.boundary) {
|
|
103
|
-
for (const points of rows
|
|
142
|
+
for (const [id, points] of rows) {
|
|
143
|
+
layer = layers.order.get(id);
|
|
104
144
|
append(`<polyline points="${points.join(" ")}" fill="none" stroke="${colour}" stroke-width="${number(group.seatSizeM.height)}" stroke-opacity=".6" stroke-linecap="round"/>`);
|
|
145
|
+
}
|
|
105
146
|
}
|
|
106
147
|
}
|
|
107
148
|
for (const area of document.areas) {
|
|
149
|
+
layer = layers.order.get(area.id);
|
|
108
150
|
empty = false;
|
|
109
151
|
const matrix = matrices.get(area.id);
|
|
110
152
|
const path = area.shape.kind === ShapeKind.Polygon
|
|
111
153
|
? polygon(area.shape.boundary, matrix)
|
|
112
154
|
: rectangle(area.shape.widthM, area.shape.heightM, matrix);
|
|
113
|
-
|
|
155
|
+
const category = area.categoryId ? categories.get(area.categoryId) : undefined;
|
|
156
|
+
append(`<path d="${path}" ${paint(category ? { color: category.color, opacity: 1 } : sections.get(owners.get(area.id) ?? "")?.style?.fill)} fill-rule="evenodd"/>`);
|
|
114
157
|
}
|
|
115
|
-
for (const art of
|
|
158
|
+
for (const art of document.decorations) {
|
|
159
|
+
layer = layers.order.get(art.id);
|
|
116
160
|
empty = false;
|
|
117
161
|
const matrix = matrices.get(art.id);
|
|
118
162
|
let path;
|
|
@@ -132,17 +176,18 @@ export function projectMapPreview(document) {
|
|
|
132
176
|
path = rectangle(Math.max(art.fontSizeM, Array.from(art.text).length * art.fontSizeM * 0.65), art.fontSizeM, matrix);
|
|
133
177
|
else
|
|
134
178
|
path = rectangle(art.sizeM.width, art.sizeM.height, matrix);
|
|
135
|
-
const outline = art.kind === DecorationKind.Image ||
|
|
136
|
-
|
|
137
|
-
art.
|
|
138
|
-
|
|
179
|
+
const outline = art.kind === DecorationKind.Image || art.kind === DecorationKind.Line || art.kind === DecorationKind.Text;
|
|
180
|
+
const lineStyle = art.kind === DecorationKind.Line
|
|
181
|
+
? `stroke-linecap="${art.lineCap ?? LineCap.Flat}" stroke-linejoin="${art.lineJoin ?? LineJoin.Sharp}"`
|
|
182
|
+
: "";
|
|
183
|
+
append(`<path d="${path}" ${lineStyle} ${outline ? 'fill="none"' : paint(art.style?.fill)} stroke="${art.style?.stroke?.color ?? foreground}" stroke-opacity="${art.style?.stroke?.opacity ?? 0.5}" stroke-width="${art.style?.strokeWidthM ?? 0.08}" fill-rule="evenodd"/>`);
|
|
139
184
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
185
|
+
content = fragments
|
|
186
|
+
.sort((a, b) => a.order - b.order)
|
|
187
|
+
.map((fragment) => fragment.markup)
|
|
188
|
+
.join("");
|
|
189
|
+
const width = Number.isFinite(bounds.minX) ? Math.max(1, bounds.maxX - bounds.minX) : 1;
|
|
190
|
+
const height = Number.isFinite(bounds.minY) ? Math.max(1, bounds.maxY - bounds.minY) : 1;
|
|
146
191
|
const padding = Math.max(width, height) * 0.08;
|
|
147
192
|
const x = Number.isFinite(bounds.minX) ? bounds.minX - padding : -padding;
|
|
148
193
|
const y = Number.isFinite(bounds.minY) ? bounds.minY - padding : -padding;
|
package/dist/reference.js
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { RowEnds, type PhysicalDocumentV1, type SeatingGroup, type RowInventory, type RowSlot, type SegmentedRow, type UUID, type PointM } from "./physical-document.interface.js";
|
|
2
|
+
export type RowSegment = {
|
|
3
|
+
row: SegmentedRow;
|
|
4
|
+
displayLabel: string;
|
|
5
|
+
coherent: boolean;
|
|
6
|
+
group: RowInventory;
|
|
7
|
+
part: RowSlot;
|
|
8
|
+
partIndex: number;
|
|
9
|
+
firstIndex: number;
|
|
10
|
+
totalSeats: number;
|
|
11
|
+
};
|
|
12
|
+
export type SegmentedRowEntry = {
|
|
13
|
+
row: SegmentedRow;
|
|
14
|
+
displayLabel: string;
|
|
15
|
+
coherent: boolean;
|
|
16
|
+
parts: readonly RowSegment[];
|
|
17
|
+
};
|
|
18
|
+
export declare function isRowInventory(group: SeatingGroup): group is RowInventory;
|
|
19
|
+
/** Logical rows associate independent physical parts without moving them between rendering banks. */
|
|
20
|
+
export declare function rowSegments(document: PhysicalDocumentV1): ReadonlyMap<UUID, RowSegment>;
|
|
21
|
+
export declare function changedSegmentGroups(before: PhysicalDocumentV1, after: PhysicalDocumentV1): ReadonlySet<UUID>;
|
|
22
|
+
export declare function suggestedRowEnds(document: PhysicalDocumentV1, rowId: UUID): RowEnds;
|
|
23
|
+
export type RowAisleGap = {
|
|
24
|
+
nextPartIndex: number;
|
|
25
|
+
distanceM: number;
|
|
26
|
+
requiredM: number;
|
|
27
|
+
deltaM: PointM;
|
|
28
|
+
};
|
|
29
|
+
/** A marked aisle leaves one seat of space between the adjacent seat centres. */
|
|
30
|
+
export declare function rowAisleGaps(document: PhysicalDocumentV1, rowId: UUID): RowAisleGap[];
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { generateGroup, project, worldMatrices } from "./geometry/geometry.js";
|
|
2
|
+
import { labelKey } from "./labels.js";
|
|
3
|
+
import { SeatingKind, RowEnds, RowJoin, } from "./physical-document.interface.js";
|
|
4
|
+
const segments = new WeakMap();
|
|
5
|
+
export function isRowInventory(group) {
|
|
6
|
+
return group.kind === SeatingKind.Straight || group.kind === SeatingKind.Curved;
|
|
7
|
+
}
|
|
8
|
+
/** Logical rows associate independent physical parts without moving them between rendering banks. */
|
|
9
|
+
export function rowSegments(document) {
|
|
10
|
+
const cached = segments.get(document);
|
|
11
|
+
if (cached)
|
|
12
|
+
return cached;
|
|
13
|
+
const owners = new Map(document.seatingGroups.flatMap((group) => isRowInventory(group) ? group.rows.map((part) => [part.id, { group, part }]) : []));
|
|
14
|
+
const result = new Map();
|
|
15
|
+
for (const row of document.segmentedRows ?? []) {
|
|
16
|
+
const parts = row.parts.map((part) => owners.get(part.rowId));
|
|
17
|
+
const names = row.parts.map((part) => part.labelOverride ?? row.label);
|
|
18
|
+
const coherent = Boolean(labelKey(names[0])) && names.every((name) => name === names[0]);
|
|
19
|
+
const totalSeats = parts.reduce((sum, item) => sum + item.part.seats.length, 0);
|
|
20
|
+
let firstIndex = 0;
|
|
21
|
+
parts.forEach((item, partIndex) => {
|
|
22
|
+
result.set(item.part.id, {
|
|
23
|
+
row,
|
|
24
|
+
displayLabel: names[partIndex],
|
|
25
|
+
coherent,
|
|
26
|
+
...item,
|
|
27
|
+
partIndex,
|
|
28
|
+
firstIndex,
|
|
29
|
+
totalSeats,
|
|
30
|
+
});
|
|
31
|
+
firstIndex += item.part.seats.length;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
segments.set(document, result);
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
export function changedSegmentGroups(before, after) {
|
|
38
|
+
const groups = new Set();
|
|
39
|
+
if (before.segmentedRows === after.segmentedRows && before.seatingGroups === after.seatingGroups)
|
|
40
|
+
return groups;
|
|
41
|
+
const previous = new Map((before.segmentedRows ?? []).map((row) => [row.id, row]));
|
|
42
|
+
const next = new Map((after.segmentedRows ?? []).map((row) => [row.id, row]));
|
|
43
|
+
for (const id of new Set([...previous.keys(), ...next.keys()])) {
|
|
44
|
+
const previousRow = previous.get(id), nextRow = next.get(id);
|
|
45
|
+
if (previousRow === nextRow &&
|
|
46
|
+
previousRow?.parts.every((part) => rowSegments(before).get(part.rowId).part.seats.length ===
|
|
47
|
+
rowSegments(after).get(part.rowId).part.seats.length))
|
|
48
|
+
continue;
|
|
49
|
+
for (const part of previous.get(id)?.parts ?? [])
|
|
50
|
+
groups.add(rowSegments(before).get(part.rowId).group.id);
|
|
51
|
+
for (const part of next.get(id)?.parts ?? [])
|
|
52
|
+
groups.add(rowSegments(after).get(part.rowId).group.id);
|
|
53
|
+
}
|
|
54
|
+
return groups;
|
|
55
|
+
}
|
|
56
|
+
export function suggestedRowEnds(document, rowId) {
|
|
57
|
+
const segment = rowSegments(document).get(rowId);
|
|
58
|
+
if (!segment)
|
|
59
|
+
return RowEnds.Both;
|
|
60
|
+
const first = segment.partIndex === 0 || segment.row.parts[segment.partIndex].joinBefore === RowJoin.Aisle;
|
|
61
|
+
const last = segment.partIndex === segment.row.parts.length - 1 ||
|
|
62
|
+
segment.row.parts[segment.partIndex + 1].joinBefore === RowJoin.Aisle;
|
|
63
|
+
if (first && last)
|
|
64
|
+
return RowEnds.Both;
|
|
65
|
+
if (first)
|
|
66
|
+
return RowEnds.Start;
|
|
67
|
+
return last ? RowEnds.End : RowEnds.None;
|
|
68
|
+
}
|
|
69
|
+
/** A marked aisle leaves one seat of space between the adjacent seat centres. */
|
|
70
|
+
export function rowAisleGaps(document, rowId) {
|
|
71
|
+
const row = document.segmentedRows.find((row) => row.id === rowId);
|
|
72
|
+
const segments = rowSegments(document);
|
|
73
|
+
const matrices = worldMatrices(document);
|
|
74
|
+
const seats = new Map();
|
|
75
|
+
const edges = row.parts.map((part) => {
|
|
76
|
+
const segment = segments.get(part.rowId);
|
|
77
|
+
let generated = seats.get(segment.group.id);
|
|
78
|
+
if (!generated) {
|
|
79
|
+
generated = [...generateGroup(segment.group)];
|
|
80
|
+
seats.set(segment.group.id, generated);
|
|
81
|
+
}
|
|
82
|
+
const physical = generated.filter((seat) => seat.rowId === part.rowId);
|
|
83
|
+
const matrix = matrices.get(segment.group.id);
|
|
84
|
+
return {
|
|
85
|
+
first: project(matrix, physical[0].position),
|
|
86
|
+
last: project(matrix, physical.at(-1).position),
|
|
87
|
+
pitchM: segment.part.layout.seatPitchM,
|
|
88
|
+
};
|
|
89
|
+
});
|
|
90
|
+
return row.parts.flatMap((part, index) => {
|
|
91
|
+
if (!index || part.joinBefore !== RowJoin.Aisle)
|
|
92
|
+
return [];
|
|
93
|
+
const previous = edges[index - 1], next = edges[index];
|
|
94
|
+
const dx = next.first.x - previous.last.x;
|
|
95
|
+
const dy = next.first.y - previous.last.y;
|
|
96
|
+
const distanceM = Math.hypot(dx, dy);
|
|
97
|
+
const requiredM = previous.pitchM + next.pitchM;
|
|
98
|
+
if (distanceM >= requiredM - 1e-9)
|
|
99
|
+
return [];
|
|
100
|
+
const angle = Math.atan2(dy, dx);
|
|
101
|
+
return [
|
|
102
|
+
{
|
|
103
|
+
nextPartIndex: index,
|
|
104
|
+
distanceM,
|
|
105
|
+
requiredM,
|
|
106
|
+
deltaM: {
|
|
107
|
+
x: Math.cos(angle) * (requiredM - distanceM),
|
|
108
|
+
y: Math.sin(angle) * (requiredM - distanceM),
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
];
|
|
112
|
+
});
|
|
113
|
+
}
|