@willcgage/module-schematic 0.95.1 → 0.97.0
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/index.cjs +87 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +72 -2
- package/dist/index.d.ts +72 -2
- package/dist/index.js +84 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -218,6 +218,15 @@ interface SchematicTrack {
|
|
|
218
218
|
* the crossover at the spacing it was actually built to — the Fast Tracks N
|
|
219
219
|
* fixtures are 1.09″ against Free-moN's 1.125″, and the difference is real. */
|
|
220
220
|
crossoverPartId?: string | null;
|
|
221
|
+
/**
|
|
222
|
+
* Which end of this track is CLOSED BY A BUMPER — deliberately the end of the
|
|
223
|
+
* line, rather than track that merely stops.
|
|
224
|
+
*
|
|
225
|
+
* ⭐ The difference is operational, not decorative: a bumpered end is where a
|
|
226
|
+
* cut of cars can be shoved to, and it is where usable length runs out. An
|
|
227
|
+
* end that just stops might only be unfinished.
|
|
228
|
+
*/
|
|
229
|
+
bumperAt?: "from" | "to" | null;
|
|
221
230
|
/** The owner's MEASURED usable length, real inches (#20) — for what the
|
|
222
231
|
* drawing can't know: a bumper post short of the drawn end, a structure
|
|
223
232
|
* fouling the track. Absent = derive it from the clearance points (#19). */
|
|
@@ -1649,7 +1658,12 @@ interface TrackPart {
|
|
|
1649
1658
|
* {@link secondaryFrogAngle}, which no single turnout has, and
|
|
1650
1659
|
* {@link piecesPerAssembly} — because its lengths describe the HALF, not the
|
|
1651
1660
|
* finished crossover. */
|
|
1652
|
-
kind: "turnout" | "wye" | "curved-turnout" | "crossover" | "crossing" | "flex"
|
|
1661
|
+
kind: "turnout" | "wye" | "curved-turnout" | "crossover" | "crossing" | "flex"
|
|
1662
|
+
/** ⚠️ A SECTIONAL PIECE IS NOT FLEX CUT TO LENGTH, even though the rail ends
|
|
1663
|
+
* up in the same place. Its length belongs to the PART and cannot be
|
|
1664
|
+
* changed, because an owner has a box of them and cannot cut one — which is
|
|
1665
|
+
* the whole reason to model it separately from flex. */
|
|
1666
|
+
| "straight" | "curve" | "bumper";
|
|
1653
1667
|
/** Manufacturer part numbers by hand, where the part has a hand. */
|
|
1654
1668
|
partNumbers?: {
|
|
1655
1669
|
left?: string;
|
|
@@ -1719,6 +1733,23 @@ interface TrackPart {
|
|
|
1719
1733
|
divergingLength?: PartDimension;
|
|
1720
1734
|
/** Diverging route radius (straight turnouts). */
|
|
1721
1735
|
divergingRadius?: PartDimension;
|
|
1736
|
+
/**
|
|
1737
|
+
* SECTIONAL CURVE only: the radius it is built to.
|
|
1738
|
+
*
|
|
1739
|
+
* ⚠️ Distinct from {@link outerRadius}/{@link innerRadius}, which are the two
|
|
1740
|
+
* routes of a CURVED TURNOUT. A plain curve has one radius, and giving it the
|
|
1741
|
+
* "outer" one would say there is another.
|
|
1742
|
+
*/
|
|
1743
|
+
radius?: PartDimension;
|
|
1744
|
+
/**
|
|
1745
|
+
* SECTIONAL CURVE only: how much of a circle the piece covers, degrees.
|
|
1746
|
+
*
|
|
1747
|
+
* ⭐ Radius and arc are how curves are SOLD ("19″ radius, 10°"), so they are
|
|
1748
|
+
* what an owner can read off the box. The piece's length is the arc between
|
|
1749
|
+
* them and is never stored — a chord recorded as a length would quietly
|
|
1750
|
+
* shorten every curve on the module.
|
|
1751
|
+
*/
|
|
1752
|
+
arcDegrees?: number;
|
|
1722
1753
|
/** Curved turnouts: the two concentric radii. */
|
|
1723
1754
|
outerRadius?: PartDimension;
|
|
1724
1755
|
innerRadius?: PartDimension;
|
|
@@ -1955,6 +1986,17 @@ declare const FAST_TRACKS_N_ME55_CROSSOVERS: TrackPart[];
|
|
|
1955
1986
|
/** What a track is laid with when nobody has said — the commonest N-scale flex. */
|
|
1956
1987
|
declare const DEFAULT_FLEX_PART_ID = "atlas-c55-n-flex";
|
|
1957
1988
|
/** Every built-in part, across manufacturers. */
|
|
1989
|
+
/**
|
|
1990
|
+
* A bumper that is not a product.
|
|
1991
|
+
*
|
|
1992
|
+
* ⭐ DELIBERATELY GENERIC, AND CARRYING NO DIMENSIONS AT ALL. Owners build these
|
|
1993
|
+
* out of a tie and a scrap of rail as often as they buy them, and what a bumper
|
|
1994
|
+
* MEANS — this end of the track is closed on purpose — does not depend on which
|
|
1995
|
+
* one it is. Recording an invented length here would be exactly the mistake the
|
|
1996
|
+
* rest of this library exists to avoid; a named product can be added with its
|
|
1997
|
+
* own measurement, and will draw at it.
|
|
1998
|
+
*/
|
|
1999
|
+
declare const GENERIC_END_OF_TRACK: TrackPart[];
|
|
1958
2000
|
declare const BUILT_IN_TRACK_PARTS: TrackPart[];
|
|
1959
2001
|
/** Every flex product a track can be laid with. */
|
|
1960
2002
|
declare function flexParts(library?: TrackPart[]): TrackPart[];
|
|
@@ -2284,6 +2326,9 @@ interface StoredTrackPart {
|
|
|
2284
2326
|
outerRadiusInches?: number | null;
|
|
2285
2327
|
innerRadiusInches?: number | null;
|
|
2286
2328
|
radiusSource?: string | null;
|
|
2329
|
+
/** Sectional curve: its single radius, and how far it turns. */
|
|
2330
|
+
radiusInches?: number | null;
|
|
2331
|
+
arcDegrees?: number | null;
|
|
2287
2332
|
actualAngleDeg?: number | null;
|
|
2288
2333
|
actualAngleSource?: string | null;
|
|
2289
2334
|
measurementNote?: string | null;
|
|
@@ -2598,6 +2643,28 @@ interface TrackGraph {
|
|
|
2598
2643
|
* tight enough that nothing joins by accident, loose enough to absorb the
|
|
2599
2644
|
* rounding of a drag. */
|
|
2600
2645
|
declare const JOINT_SNAP_INCHES = 0.01;
|
|
2646
|
+
/**
|
|
2647
|
+
* How long a bumper draws when it is not a named product.
|
|
2648
|
+
*
|
|
2649
|
+
* ⚠️ A DRAWING DEFAULT, NOT A MEASUREMENT, and deliberately not recorded as one
|
|
2650
|
+
* on any part. What a bumper is FOR — saying this end of the track is closed on
|
|
2651
|
+
* purpose — does not depend on its length, and plenty are a tie and a bit of
|
|
2652
|
+
* scrap. A named product supplies its own `overallLength` and this stops
|
|
2653
|
+
* applying.
|
|
2654
|
+
*/
|
|
2655
|
+
/** Every kind of part the library can hold. Beside the type it mirrors, so a
|
|
2656
|
+
* new kind is one edit and not two. */
|
|
2657
|
+
declare const TRACK_PART_KINDS: TrackPart["kind"][];
|
|
2658
|
+
declare const BUMPER_DRAWN_INCHES = 0.75;
|
|
2659
|
+
/**
|
|
2660
|
+
* How long a sectional curve's RAIL is — the arc, not the chord across it.
|
|
2661
|
+
*
|
|
2662
|
+
* ⚠️ Curves are sold as a radius and an arc, never as a length, and the chord is
|
|
2663
|
+
* always shorter. Recording one as the piece's length would put everything past
|
|
2664
|
+
* that curve closer to endplate A than it is — the same mistake the walk exists
|
|
2665
|
+
* to avoid, arriving through the parts library instead.
|
|
2666
|
+
*/
|
|
2667
|
+
declare function sectionalArcInches(part: TrackPart): number;
|
|
2601
2668
|
/**
|
|
2602
2669
|
* Where a bent run's far end lands, and which way it points — in the piece's own
|
|
2603
2670
|
* frame, starting at its origin heading +x.
|
|
@@ -2687,6 +2754,9 @@ interface GraphRoute {
|
|
|
2687
2754
|
bornAt: string | null;
|
|
2688
2755
|
/** The turnout it runs back into. Set = a SIDING; null = it dead-ends. */
|
|
2689
2756
|
endsAt: string | null;
|
|
2757
|
+
/** The piece that CLOSES this route — a bumper. Set = the track ends here on
|
|
2758
|
+
* purpose; null = it simply stops, which may just mean unfinished. */
|
|
2759
|
+
closedBy: string | null;
|
|
2690
2760
|
pieces: string[];
|
|
2691
2761
|
/** The same pieces, each with where it starts and ends along the route. */
|
|
2692
2762
|
spans: RouteSpan[];
|
|
@@ -3104,4 +3174,4 @@ declare function poseOverridesFromDoc(doc: ModuleSchematicDoc): Record<string, {
|
|
|
3104
3174
|
heading: number;
|
|
3105
3175
|
}>;
|
|
3106
3176
|
|
|
3107
|
-
export { ATLAS_CODE55_N, BUILT_IN_TRACK_PARTS, type BenchworkPoint, type BranchConnector, CLEARANCE_SPACING_INCHES, CODE55_RAIL_HEIGHT_INCHES, DEFAULT_FLEX_PART_ID, type DimensionSource, type DrawCrossing, type DrawCrossover, type DrawIndustry, type DrawSignal, type DrawTrack, type DrawTurnout, ENDPLATE_FASCIA_CLEAR_INCHES, ENDPLATE_LEAD_INCHES, type EditorBranch, type EditorControlPoint, type EditorCpSignal, type EditorCrossing, type EditorIndustry, type EditorState, type EditorTrack, type EditorTurnout, type EndplateBConfig, type EndplateEdge, type EndplateEdgePose, type EndplatePose, type EndplateTrackIssue, type EndplateWidthIssue, FAST_TRACKS_N_ME55, FAST_TRACKS_N_ME55_CROSSOVERS, FLEX_TRACK_PARTS, FREEMO_ENDPLATE_TRACK_FASCIA_CLEARANCE_INCHES, FREEMO_ENDPLATE_WIDTH_MIN_INCHES, FREEMO_ENDPLATE_WIDTH_RECOMMENDED_INCHES, FREEMO_MAIN_MIN_RADIUS_INCHES, FREEMO_REVERSE_CURVE_STRAIGHT_INCHES, FREEMO_TRACK_SPACING_INCHES, type FlexPiece, type FlexPieceEnd, type FrogCasting, type GeometryType, type GraphAnchor, type GraphConflict, type GraphConnection, type GraphDocInput, type GraphDocResult, type GraphRoute, type GraphTurnout, type GraphWalk, type ImportedPart, type IndustryLabelMode, type IndustrySpot, JOINT_SNAP_INCHES, type LanePinch, MAIN2_TRACK_ID, MAIN_TRACK_ID, type ModuleFeatures, type ModuleFootprint, type ModuleFootprintInput, type ModuleGeometryInput, type ModuleSchematicDoc, type ModuleTrackRow, N_CAR_LENGTH_INCHES, N_SCALE_RATIO, type OccupiedSpan, type OutlineFace, PINCH_EASE_INCHES, type PartAngle, type PartDimension, type PartEnd, type PartExtent, type PartGeometry, type PartJoint, type PartJointRole, type PartSegment, type PieceSnap, type PlacedJoint, RAIL_GAUGE_INCHES, type ResolvedAnchor, type ReturnLoopGeometry, type ReturnLoopShape, type RouteSpan, type SchematicBlock, type SchematicControlPoint, type SchematicCrossing, type SchematicEndplate, type SchematicEndplateTrack, type SchematicIndustry, type SchematicSection, type SchematicSignal, type SchematicTrack, type SchematicTurnout, type SectionAdjacency, type SectionEnd, type SectionEndAssessment, type SectionFootprint, type SectionJointAssessment, type SectionRelativePos, type SignalFacing, type SignalSide, type SpanOverhang, type StoredTrackPart, TIE_HALF_LENGTH_INCHES, TURNOUT_LEAD_INCHES_PER_FROG, type TrackConfig, type TrackGraph, type TrackPart, type TrackPiece, type TrackRole, type TurnoutClosure, type TurnoutKind, type UsableCapacity, WHOLE_MODULE_SECTION_ID, asModuleSchematic, assessSectionEnd, assessSectionJoint, benchworkBand, benchworkOutline, buildCrossover, buildPassingSiding, buildTrackGraph, buildTransition, carCapacity, checkEndplateWidth, clearancePointPastFrogInches, crossoverPinches, deriveEndplatePoses, deriveGraphDoc, divergeSideForHand, docToState, emptyEditorState, endplateCentreOffsetInches, endplateEdgePose, endplateFaceSegments, endplateLead, endplateTrackOffsetInches, endplateWidthInches, fitFlexBetween, flexPartFor, flexParts, flexPieces, flexRunEnd, flexUsage, frogCasting, frogNumberFromName, fromSectionRelative, geometryTurnDegrees, graphToDoc, hasNoFarEndplate, importedPartToTrackPart, inchesToScaleFeet, isLoopDoc, isTransitionTurnout, laneOffsetAt, leadInchesForSize, maxFlexPieceInches, mergeImportedParts, mergeStoredParts, moduleCenterline, moduleFeatures, moduleFootprint, moduleLengthFromSections, moduleSections, nextId, parseXtpLibrary, partExtent, partExtentForSize, partGeometry, partGeometryGap, partOutlineAtFrog, partsPlaceable, pastFrogInchesForSize, pathLengthInches, pieceHand, piecePartNumber, pieceRoutePaths, placedJoints, poseNeedsManual, poseOverridesFromDoc, remapPos, resizeFlexPiece, resolveGraphAnchor, returnLoop, sampleBenchworkOutline, samplePartSegments, samplePath, scaleFeetToInches, sectionAdjacency, sectionBand, sectionBreaksFromSections, sectionComponents, sectionFootprints, sectionNeighbours, sectionSpans, sectionSpansOrWhole, sectionedCenterline, sectionedEndPose, sliceCenterline, snapPiece, spanOverhang, stateToDoc, storedPartToTrackPart, toSectionRelative, trackMeetsEndplateIssues, trackPart, trackPath, turnoutClosure, turnoutFacing, turnoutOccupiedSpan, turnoutPartForSize, usableCapacity, walkTrackGraph };
|
|
3177
|
+
export { ATLAS_CODE55_N, BUILT_IN_TRACK_PARTS, BUMPER_DRAWN_INCHES, type BenchworkPoint, type BranchConnector, CLEARANCE_SPACING_INCHES, CODE55_RAIL_HEIGHT_INCHES, DEFAULT_FLEX_PART_ID, type DimensionSource, type DrawCrossing, type DrawCrossover, type DrawIndustry, type DrawSignal, type DrawTrack, type DrawTurnout, ENDPLATE_FASCIA_CLEAR_INCHES, ENDPLATE_LEAD_INCHES, type EditorBranch, type EditorControlPoint, type EditorCpSignal, type EditorCrossing, type EditorIndustry, type EditorState, type EditorTrack, type EditorTurnout, type EndplateBConfig, type EndplateEdge, type EndplateEdgePose, type EndplatePose, type EndplateTrackIssue, type EndplateWidthIssue, FAST_TRACKS_N_ME55, FAST_TRACKS_N_ME55_CROSSOVERS, FLEX_TRACK_PARTS, FREEMO_ENDPLATE_TRACK_FASCIA_CLEARANCE_INCHES, FREEMO_ENDPLATE_WIDTH_MIN_INCHES, FREEMO_ENDPLATE_WIDTH_RECOMMENDED_INCHES, FREEMO_MAIN_MIN_RADIUS_INCHES, FREEMO_REVERSE_CURVE_STRAIGHT_INCHES, FREEMO_TRACK_SPACING_INCHES, type FlexPiece, type FlexPieceEnd, type FrogCasting, GENERIC_END_OF_TRACK, type GeometryType, type GraphAnchor, type GraphConflict, type GraphConnection, type GraphDocInput, type GraphDocResult, type GraphRoute, type GraphTurnout, type GraphWalk, type ImportedPart, type IndustryLabelMode, type IndustrySpot, JOINT_SNAP_INCHES, type LanePinch, MAIN2_TRACK_ID, MAIN_TRACK_ID, type ModuleFeatures, type ModuleFootprint, type ModuleFootprintInput, type ModuleGeometryInput, type ModuleSchematicDoc, type ModuleTrackRow, N_CAR_LENGTH_INCHES, N_SCALE_RATIO, type OccupiedSpan, type OutlineFace, PINCH_EASE_INCHES, type PartAngle, type PartDimension, type PartEnd, type PartExtent, type PartGeometry, type PartJoint, type PartJointRole, type PartSegment, type PieceSnap, type PlacedJoint, RAIL_GAUGE_INCHES, type ResolvedAnchor, type ReturnLoopGeometry, type ReturnLoopShape, type RouteSpan, type SchematicBlock, type SchematicControlPoint, type SchematicCrossing, type SchematicEndplate, type SchematicEndplateTrack, type SchematicIndustry, type SchematicSection, type SchematicSignal, type SchematicTrack, type SchematicTurnout, type SectionAdjacency, type SectionEnd, type SectionEndAssessment, type SectionFootprint, type SectionJointAssessment, type SectionRelativePos, type SignalFacing, type SignalSide, type SpanOverhang, type StoredTrackPart, TIE_HALF_LENGTH_INCHES, TRACK_PART_KINDS, TURNOUT_LEAD_INCHES_PER_FROG, type TrackConfig, type TrackGraph, type TrackPart, type TrackPiece, type TrackRole, type TurnoutClosure, type TurnoutKind, type UsableCapacity, WHOLE_MODULE_SECTION_ID, asModuleSchematic, assessSectionEnd, assessSectionJoint, benchworkBand, benchworkOutline, buildCrossover, buildPassingSiding, buildTrackGraph, buildTransition, carCapacity, checkEndplateWidth, clearancePointPastFrogInches, crossoverPinches, deriveEndplatePoses, deriveGraphDoc, divergeSideForHand, docToState, emptyEditorState, endplateCentreOffsetInches, endplateEdgePose, endplateFaceSegments, endplateLead, endplateTrackOffsetInches, endplateWidthInches, fitFlexBetween, flexPartFor, flexParts, flexPieces, flexRunEnd, flexUsage, frogCasting, frogNumberFromName, fromSectionRelative, geometryTurnDegrees, graphToDoc, hasNoFarEndplate, importedPartToTrackPart, inchesToScaleFeet, isLoopDoc, isTransitionTurnout, laneOffsetAt, leadInchesForSize, maxFlexPieceInches, mergeImportedParts, mergeStoredParts, moduleCenterline, moduleFeatures, moduleFootprint, moduleLengthFromSections, moduleSections, nextId, parseXtpLibrary, partExtent, partExtentForSize, partGeometry, partGeometryGap, partOutlineAtFrog, partsPlaceable, pastFrogInchesForSize, pathLengthInches, pieceHand, piecePartNumber, pieceRoutePaths, placedJoints, poseNeedsManual, poseOverridesFromDoc, remapPos, resizeFlexPiece, resolveGraphAnchor, returnLoop, sampleBenchworkOutline, samplePartSegments, samplePath, scaleFeetToInches, sectionAdjacency, sectionBand, sectionBreaksFromSections, sectionComponents, sectionFootprints, sectionNeighbours, sectionSpans, sectionSpansOrWhole, sectionalArcInches, sectionedCenterline, sectionedEndPose, sliceCenterline, snapPiece, spanOverhang, stateToDoc, storedPartToTrackPart, toSectionRelative, trackMeetsEndplateIssues, trackPart, trackPath, turnoutClosure, turnoutFacing, turnoutOccupiedSpan, turnoutPartForSize, usableCapacity, walkTrackGraph };
|
package/dist/index.d.ts
CHANGED
|
@@ -218,6 +218,15 @@ interface SchematicTrack {
|
|
|
218
218
|
* the crossover at the spacing it was actually built to — the Fast Tracks N
|
|
219
219
|
* fixtures are 1.09″ against Free-moN's 1.125″, and the difference is real. */
|
|
220
220
|
crossoverPartId?: string | null;
|
|
221
|
+
/**
|
|
222
|
+
* Which end of this track is CLOSED BY A BUMPER — deliberately the end of the
|
|
223
|
+
* line, rather than track that merely stops.
|
|
224
|
+
*
|
|
225
|
+
* ⭐ The difference is operational, not decorative: a bumpered end is where a
|
|
226
|
+
* cut of cars can be shoved to, and it is where usable length runs out. An
|
|
227
|
+
* end that just stops might only be unfinished.
|
|
228
|
+
*/
|
|
229
|
+
bumperAt?: "from" | "to" | null;
|
|
221
230
|
/** The owner's MEASURED usable length, real inches (#20) — for what the
|
|
222
231
|
* drawing can't know: a bumper post short of the drawn end, a structure
|
|
223
232
|
* fouling the track. Absent = derive it from the clearance points (#19). */
|
|
@@ -1649,7 +1658,12 @@ interface TrackPart {
|
|
|
1649
1658
|
* {@link secondaryFrogAngle}, which no single turnout has, and
|
|
1650
1659
|
* {@link piecesPerAssembly} — because its lengths describe the HALF, not the
|
|
1651
1660
|
* finished crossover. */
|
|
1652
|
-
kind: "turnout" | "wye" | "curved-turnout" | "crossover" | "crossing" | "flex"
|
|
1661
|
+
kind: "turnout" | "wye" | "curved-turnout" | "crossover" | "crossing" | "flex"
|
|
1662
|
+
/** ⚠️ A SECTIONAL PIECE IS NOT FLEX CUT TO LENGTH, even though the rail ends
|
|
1663
|
+
* up in the same place. Its length belongs to the PART and cannot be
|
|
1664
|
+
* changed, because an owner has a box of them and cannot cut one — which is
|
|
1665
|
+
* the whole reason to model it separately from flex. */
|
|
1666
|
+
| "straight" | "curve" | "bumper";
|
|
1653
1667
|
/** Manufacturer part numbers by hand, where the part has a hand. */
|
|
1654
1668
|
partNumbers?: {
|
|
1655
1669
|
left?: string;
|
|
@@ -1719,6 +1733,23 @@ interface TrackPart {
|
|
|
1719
1733
|
divergingLength?: PartDimension;
|
|
1720
1734
|
/** Diverging route radius (straight turnouts). */
|
|
1721
1735
|
divergingRadius?: PartDimension;
|
|
1736
|
+
/**
|
|
1737
|
+
* SECTIONAL CURVE only: the radius it is built to.
|
|
1738
|
+
*
|
|
1739
|
+
* ⚠️ Distinct from {@link outerRadius}/{@link innerRadius}, which are the two
|
|
1740
|
+
* routes of a CURVED TURNOUT. A plain curve has one radius, and giving it the
|
|
1741
|
+
* "outer" one would say there is another.
|
|
1742
|
+
*/
|
|
1743
|
+
radius?: PartDimension;
|
|
1744
|
+
/**
|
|
1745
|
+
* SECTIONAL CURVE only: how much of a circle the piece covers, degrees.
|
|
1746
|
+
*
|
|
1747
|
+
* ⭐ Radius and arc are how curves are SOLD ("19″ radius, 10°"), so they are
|
|
1748
|
+
* what an owner can read off the box. The piece's length is the arc between
|
|
1749
|
+
* them and is never stored — a chord recorded as a length would quietly
|
|
1750
|
+
* shorten every curve on the module.
|
|
1751
|
+
*/
|
|
1752
|
+
arcDegrees?: number;
|
|
1722
1753
|
/** Curved turnouts: the two concentric radii. */
|
|
1723
1754
|
outerRadius?: PartDimension;
|
|
1724
1755
|
innerRadius?: PartDimension;
|
|
@@ -1955,6 +1986,17 @@ declare const FAST_TRACKS_N_ME55_CROSSOVERS: TrackPart[];
|
|
|
1955
1986
|
/** What a track is laid with when nobody has said — the commonest N-scale flex. */
|
|
1956
1987
|
declare const DEFAULT_FLEX_PART_ID = "atlas-c55-n-flex";
|
|
1957
1988
|
/** Every built-in part, across manufacturers. */
|
|
1989
|
+
/**
|
|
1990
|
+
* A bumper that is not a product.
|
|
1991
|
+
*
|
|
1992
|
+
* ⭐ DELIBERATELY GENERIC, AND CARRYING NO DIMENSIONS AT ALL. Owners build these
|
|
1993
|
+
* out of a tie and a scrap of rail as often as they buy them, and what a bumper
|
|
1994
|
+
* MEANS — this end of the track is closed on purpose — does not depend on which
|
|
1995
|
+
* one it is. Recording an invented length here would be exactly the mistake the
|
|
1996
|
+
* rest of this library exists to avoid; a named product can be added with its
|
|
1997
|
+
* own measurement, and will draw at it.
|
|
1998
|
+
*/
|
|
1999
|
+
declare const GENERIC_END_OF_TRACK: TrackPart[];
|
|
1958
2000
|
declare const BUILT_IN_TRACK_PARTS: TrackPart[];
|
|
1959
2001
|
/** Every flex product a track can be laid with. */
|
|
1960
2002
|
declare function flexParts(library?: TrackPart[]): TrackPart[];
|
|
@@ -2284,6 +2326,9 @@ interface StoredTrackPart {
|
|
|
2284
2326
|
outerRadiusInches?: number | null;
|
|
2285
2327
|
innerRadiusInches?: number | null;
|
|
2286
2328
|
radiusSource?: string | null;
|
|
2329
|
+
/** Sectional curve: its single radius, and how far it turns. */
|
|
2330
|
+
radiusInches?: number | null;
|
|
2331
|
+
arcDegrees?: number | null;
|
|
2287
2332
|
actualAngleDeg?: number | null;
|
|
2288
2333
|
actualAngleSource?: string | null;
|
|
2289
2334
|
measurementNote?: string | null;
|
|
@@ -2598,6 +2643,28 @@ interface TrackGraph {
|
|
|
2598
2643
|
* tight enough that nothing joins by accident, loose enough to absorb the
|
|
2599
2644
|
* rounding of a drag. */
|
|
2600
2645
|
declare const JOINT_SNAP_INCHES = 0.01;
|
|
2646
|
+
/**
|
|
2647
|
+
* How long a bumper draws when it is not a named product.
|
|
2648
|
+
*
|
|
2649
|
+
* ⚠️ A DRAWING DEFAULT, NOT A MEASUREMENT, and deliberately not recorded as one
|
|
2650
|
+
* on any part. What a bumper is FOR — saying this end of the track is closed on
|
|
2651
|
+
* purpose — does not depend on its length, and plenty are a tie and a bit of
|
|
2652
|
+
* scrap. A named product supplies its own `overallLength` and this stops
|
|
2653
|
+
* applying.
|
|
2654
|
+
*/
|
|
2655
|
+
/** Every kind of part the library can hold. Beside the type it mirrors, so a
|
|
2656
|
+
* new kind is one edit and not two. */
|
|
2657
|
+
declare const TRACK_PART_KINDS: TrackPart["kind"][];
|
|
2658
|
+
declare const BUMPER_DRAWN_INCHES = 0.75;
|
|
2659
|
+
/**
|
|
2660
|
+
* How long a sectional curve's RAIL is — the arc, not the chord across it.
|
|
2661
|
+
*
|
|
2662
|
+
* ⚠️ Curves are sold as a radius and an arc, never as a length, and the chord is
|
|
2663
|
+
* always shorter. Recording one as the piece's length would put everything past
|
|
2664
|
+
* that curve closer to endplate A than it is — the same mistake the walk exists
|
|
2665
|
+
* to avoid, arriving through the parts library instead.
|
|
2666
|
+
*/
|
|
2667
|
+
declare function sectionalArcInches(part: TrackPart): number;
|
|
2601
2668
|
/**
|
|
2602
2669
|
* Where a bent run's far end lands, and which way it points — in the piece's own
|
|
2603
2670
|
* frame, starting at its origin heading +x.
|
|
@@ -2687,6 +2754,9 @@ interface GraphRoute {
|
|
|
2687
2754
|
bornAt: string | null;
|
|
2688
2755
|
/** The turnout it runs back into. Set = a SIDING; null = it dead-ends. */
|
|
2689
2756
|
endsAt: string | null;
|
|
2757
|
+
/** The piece that CLOSES this route — a bumper. Set = the track ends here on
|
|
2758
|
+
* purpose; null = it simply stops, which may just mean unfinished. */
|
|
2759
|
+
closedBy: string | null;
|
|
2690
2760
|
pieces: string[];
|
|
2691
2761
|
/** The same pieces, each with where it starts and ends along the route. */
|
|
2692
2762
|
spans: RouteSpan[];
|
|
@@ -3104,4 +3174,4 @@ declare function poseOverridesFromDoc(doc: ModuleSchematicDoc): Record<string, {
|
|
|
3104
3174
|
heading: number;
|
|
3105
3175
|
}>;
|
|
3106
3176
|
|
|
3107
|
-
export { ATLAS_CODE55_N, BUILT_IN_TRACK_PARTS, type BenchworkPoint, type BranchConnector, CLEARANCE_SPACING_INCHES, CODE55_RAIL_HEIGHT_INCHES, DEFAULT_FLEX_PART_ID, type DimensionSource, type DrawCrossing, type DrawCrossover, type DrawIndustry, type DrawSignal, type DrawTrack, type DrawTurnout, ENDPLATE_FASCIA_CLEAR_INCHES, ENDPLATE_LEAD_INCHES, type EditorBranch, type EditorControlPoint, type EditorCpSignal, type EditorCrossing, type EditorIndustry, type EditorState, type EditorTrack, type EditorTurnout, type EndplateBConfig, type EndplateEdge, type EndplateEdgePose, type EndplatePose, type EndplateTrackIssue, type EndplateWidthIssue, FAST_TRACKS_N_ME55, FAST_TRACKS_N_ME55_CROSSOVERS, FLEX_TRACK_PARTS, FREEMO_ENDPLATE_TRACK_FASCIA_CLEARANCE_INCHES, FREEMO_ENDPLATE_WIDTH_MIN_INCHES, FREEMO_ENDPLATE_WIDTH_RECOMMENDED_INCHES, FREEMO_MAIN_MIN_RADIUS_INCHES, FREEMO_REVERSE_CURVE_STRAIGHT_INCHES, FREEMO_TRACK_SPACING_INCHES, type FlexPiece, type FlexPieceEnd, type FrogCasting, type GeometryType, type GraphAnchor, type GraphConflict, type GraphConnection, type GraphDocInput, type GraphDocResult, type GraphRoute, type GraphTurnout, type GraphWalk, type ImportedPart, type IndustryLabelMode, type IndustrySpot, JOINT_SNAP_INCHES, type LanePinch, MAIN2_TRACK_ID, MAIN_TRACK_ID, type ModuleFeatures, type ModuleFootprint, type ModuleFootprintInput, type ModuleGeometryInput, type ModuleSchematicDoc, type ModuleTrackRow, N_CAR_LENGTH_INCHES, N_SCALE_RATIO, type OccupiedSpan, type OutlineFace, PINCH_EASE_INCHES, type PartAngle, type PartDimension, type PartEnd, type PartExtent, type PartGeometry, type PartJoint, type PartJointRole, type PartSegment, type PieceSnap, type PlacedJoint, RAIL_GAUGE_INCHES, type ResolvedAnchor, type ReturnLoopGeometry, type ReturnLoopShape, type RouteSpan, type SchematicBlock, type SchematicControlPoint, type SchematicCrossing, type SchematicEndplate, type SchematicEndplateTrack, type SchematicIndustry, type SchematicSection, type SchematicSignal, type SchematicTrack, type SchematicTurnout, type SectionAdjacency, type SectionEnd, type SectionEndAssessment, type SectionFootprint, type SectionJointAssessment, type SectionRelativePos, type SignalFacing, type SignalSide, type SpanOverhang, type StoredTrackPart, TIE_HALF_LENGTH_INCHES, TURNOUT_LEAD_INCHES_PER_FROG, type TrackConfig, type TrackGraph, type TrackPart, type TrackPiece, type TrackRole, type TurnoutClosure, type TurnoutKind, type UsableCapacity, WHOLE_MODULE_SECTION_ID, asModuleSchematic, assessSectionEnd, assessSectionJoint, benchworkBand, benchworkOutline, buildCrossover, buildPassingSiding, buildTrackGraph, buildTransition, carCapacity, checkEndplateWidth, clearancePointPastFrogInches, crossoverPinches, deriveEndplatePoses, deriveGraphDoc, divergeSideForHand, docToState, emptyEditorState, endplateCentreOffsetInches, endplateEdgePose, endplateFaceSegments, endplateLead, endplateTrackOffsetInches, endplateWidthInches, fitFlexBetween, flexPartFor, flexParts, flexPieces, flexRunEnd, flexUsage, frogCasting, frogNumberFromName, fromSectionRelative, geometryTurnDegrees, graphToDoc, hasNoFarEndplate, importedPartToTrackPart, inchesToScaleFeet, isLoopDoc, isTransitionTurnout, laneOffsetAt, leadInchesForSize, maxFlexPieceInches, mergeImportedParts, mergeStoredParts, moduleCenterline, moduleFeatures, moduleFootprint, moduleLengthFromSections, moduleSections, nextId, parseXtpLibrary, partExtent, partExtentForSize, partGeometry, partGeometryGap, partOutlineAtFrog, partsPlaceable, pastFrogInchesForSize, pathLengthInches, pieceHand, piecePartNumber, pieceRoutePaths, placedJoints, poseNeedsManual, poseOverridesFromDoc, remapPos, resizeFlexPiece, resolveGraphAnchor, returnLoop, sampleBenchworkOutline, samplePartSegments, samplePath, scaleFeetToInches, sectionAdjacency, sectionBand, sectionBreaksFromSections, sectionComponents, sectionFootprints, sectionNeighbours, sectionSpans, sectionSpansOrWhole, sectionedCenterline, sectionedEndPose, sliceCenterline, snapPiece, spanOverhang, stateToDoc, storedPartToTrackPart, toSectionRelative, trackMeetsEndplateIssues, trackPart, trackPath, turnoutClosure, turnoutFacing, turnoutOccupiedSpan, turnoutPartForSize, usableCapacity, walkTrackGraph };
|
|
3177
|
+
export { ATLAS_CODE55_N, BUILT_IN_TRACK_PARTS, BUMPER_DRAWN_INCHES, type BenchworkPoint, type BranchConnector, CLEARANCE_SPACING_INCHES, CODE55_RAIL_HEIGHT_INCHES, DEFAULT_FLEX_PART_ID, type DimensionSource, type DrawCrossing, type DrawCrossover, type DrawIndustry, type DrawSignal, type DrawTrack, type DrawTurnout, ENDPLATE_FASCIA_CLEAR_INCHES, ENDPLATE_LEAD_INCHES, type EditorBranch, type EditorControlPoint, type EditorCpSignal, type EditorCrossing, type EditorIndustry, type EditorState, type EditorTrack, type EditorTurnout, type EndplateBConfig, type EndplateEdge, type EndplateEdgePose, type EndplatePose, type EndplateTrackIssue, type EndplateWidthIssue, FAST_TRACKS_N_ME55, FAST_TRACKS_N_ME55_CROSSOVERS, FLEX_TRACK_PARTS, FREEMO_ENDPLATE_TRACK_FASCIA_CLEARANCE_INCHES, FREEMO_ENDPLATE_WIDTH_MIN_INCHES, FREEMO_ENDPLATE_WIDTH_RECOMMENDED_INCHES, FREEMO_MAIN_MIN_RADIUS_INCHES, FREEMO_REVERSE_CURVE_STRAIGHT_INCHES, FREEMO_TRACK_SPACING_INCHES, type FlexPiece, type FlexPieceEnd, type FrogCasting, GENERIC_END_OF_TRACK, type GeometryType, type GraphAnchor, type GraphConflict, type GraphConnection, type GraphDocInput, type GraphDocResult, type GraphRoute, type GraphTurnout, type GraphWalk, type ImportedPart, type IndustryLabelMode, type IndustrySpot, JOINT_SNAP_INCHES, type LanePinch, MAIN2_TRACK_ID, MAIN_TRACK_ID, type ModuleFeatures, type ModuleFootprint, type ModuleFootprintInput, type ModuleGeometryInput, type ModuleSchematicDoc, type ModuleTrackRow, N_CAR_LENGTH_INCHES, N_SCALE_RATIO, type OccupiedSpan, type OutlineFace, PINCH_EASE_INCHES, type PartAngle, type PartDimension, type PartEnd, type PartExtent, type PartGeometry, type PartJoint, type PartJointRole, type PartSegment, type PieceSnap, type PlacedJoint, RAIL_GAUGE_INCHES, type ResolvedAnchor, type ReturnLoopGeometry, type ReturnLoopShape, type RouteSpan, type SchematicBlock, type SchematicControlPoint, type SchematicCrossing, type SchematicEndplate, type SchematicEndplateTrack, type SchematicIndustry, type SchematicSection, type SchematicSignal, type SchematicTrack, type SchematicTurnout, type SectionAdjacency, type SectionEnd, type SectionEndAssessment, type SectionFootprint, type SectionJointAssessment, type SectionRelativePos, type SignalFacing, type SignalSide, type SpanOverhang, type StoredTrackPart, TIE_HALF_LENGTH_INCHES, TRACK_PART_KINDS, TURNOUT_LEAD_INCHES_PER_FROG, type TrackConfig, type TrackGraph, type TrackPart, type TrackPiece, type TrackRole, type TurnoutClosure, type TurnoutKind, type UsableCapacity, WHOLE_MODULE_SECTION_ID, asModuleSchematic, assessSectionEnd, assessSectionJoint, benchworkBand, benchworkOutline, buildCrossover, buildPassingSiding, buildTrackGraph, buildTransition, carCapacity, checkEndplateWidth, clearancePointPastFrogInches, crossoverPinches, deriveEndplatePoses, deriveGraphDoc, divergeSideForHand, docToState, emptyEditorState, endplateCentreOffsetInches, endplateEdgePose, endplateFaceSegments, endplateLead, endplateTrackOffsetInches, endplateWidthInches, fitFlexBetween, flexPartFor, flexParts, flexPieces, flexRunEnd, flexUsage, frogCasting, frogNumberFromName, fromSectionRelative, geometryTurnDegrees, graphToDoc, hasNoFarEndplate, importedPartToTrackPart, inchesToScaleFeet, isLoopDoc, isTransitionTurnout, laneOffsetAt, leadInchesForSize, maxFlexPieceInches, mergeImportedParts, mergeStoredParts, moduleCenterline, moduleFeatures, moduleFootprint, moduleLengthFromSections, moduleSections, nextId, parseXtpLibrary, partExtent, partExtentForSize, partGeometry, partGeometryGap, partOutlineAtFrog, partsPlaceable, pastFrogInchesForSize, pathLengthInches, pieceHand, piecePartNumber, pieceRoutePaths, placedJoints, poseNeedsManual, poseOverridesFromDoc, remapPos, resizeFlexPiece, resolveGraphAnchor, returnLoop, sampleBenchworkOutline, samplePartSegments, samplePath, scaleFeetToInches, sectionAdjacency, sectionBand, sectionBreaksFromSections, sectionComponents, sectionFootprints, sectionNeighbours, sectionSpans, sectionSpansOrWhole, sectionalArcInches, sectionedCenterline, sectionedEndPose, sliceCenterline, snapPiece, spanOverhang, stateToDoc, storedPartToTrackPart, toSectionRelative, trackMeetsEndplateIssues, trackPart, trackPath, turnoutClosure, turnoutFacing, turnoutOccupiedSpan, turnoutPartForSize, usableCapacity, walkTrackGraph };
|
package/dist/index.js
CHANGED
|
@@ -1701,11 +1701,22 @@ var FAST_TRACKS_N_ME55_CROSSOVERS = [
|
|
|
1701
1701
|
};
|
|
1702
1702
|
});
|
|
1703
1703
|
var DEFAULT_FLEX_PART_ID = "atlas-c55-n-flex";
|
|
1704
|
+
var GENERIC_END_OF_TRACK = [
|
|
1705
|
+
{
|
|
1706
|
+
id: "generic-bumper",
|
|
1707
|
+
manufacturer: "Generic",
|
|
1708
|
+
line: "N scale",
|
|
1709
|
+
scale: "N",
|
|
1710
|
+
name: "Bumper",
|
|
1711
|
+
kind: "bumper"
|
|
1712
|
+
}
|
|
1713
|
+
];
|
|
1704
1714
|
var BUILT_IN_TRACK_PARTS = [
|
|
1705
1715
|
...ATLAS_CODE55_N,
|
|
1706
1716
|
...FAST_TRACKS_N_ME55,
|
|
1707
1717
|
...FAST_TRACKS_N_ME55_CROSSOVERS,
|
|
1708
|
-
...FLEX_TRACK_PARTS
|
|
1718
|
+
...FLEX_TRACK_PARTS,
|
|
1719
|
+
...GENERIC_END_OF_TRACK
|
|
1709
1720
|
];
|
|
1710
1721
|
function flexParts(library = BUILT_IN_TRACK_PARTS) {
|
|
1711
1722
|
return library.filter((p) => p.kind === "flex");
|
|
@@ -2006,14 +2017,14 @@ function storedPartToTrackPart(row) {
|
|
|
2006
2017
|
source: points.source === "measured" && frog.source === "measured" ? "measured" : "derived",
|
|
2007
2018
|
...note ? { note } : {}
|
|
2008
2019
|
} : dim(row.leadInches, row.leadSource);
|
|
2009
|
-
const kind = row.kind;
|
|
2020
|
+
const kind = TRACK_PART_KINDS.includes(row.kind) ? row.kind : "turnout";
|
|
2010
2021
|
const part = {
|
|
2011
2022
|
id: row.slug,
|
|
2012
2023
|
manufacturer: row.manufacturer,
|
|
2013
2024
|
line: row.line,
|
|
2014
2025
|
scale: "N",
|
|
2015
2026
|
name: row.name,
|
|
2016
|
-
kind
|
|
2027
|
+
kind
|
|
2017
2028
|
};
|
|
2018
2029
|
const numbers = {
|
|
2019
2030
|
...row.partNumberLeft ? { left: row.partNumberLeft } : {},
|
|
@@ -2048,6 +2059,9 @@ function storedPartToTrackPart(row) {
|
|
|
2048
2059
|
const inner = dim(row.innerRadiusInches, row.radiusSource);
|
|
2049
2060
|
if (outer) part.outerRadius = outer;
|
|
2050
2061
|
if (inner) part.innerRadius = inner;
|
|
2062
|
+
const radius = dim(row.radiusInches, row.radiusSource);
|
|
2063
|
+
if (radius) part.radius = radius;
|
|
2064
|
+
if (typeof row.arcDegrees === "number") part.arcDegrees = row.arcDegrees;
|
|
2051
2065
|
if (typeof row.actualAngleDeg === "number")
|
|
2052
2066
|
part.actualAngle = {
|
|
2053
2067
|
deg: row.actualAngleDeg,
|
|
@@ -2160,6 +2174,14 @@ function turnoutClosure(size, opts = {}) {
|
|
|
2160
2174
|
}
|
|
2161
2175
|
function partGeometryGap(part) {
|
|
2162
2176
|
if (part.kind === "flex") return null;
|
|
2177
|
+
if (part.kind === "bumper") return null;
|
|
2178
|
+
if (part.kind === "straight")
|
|
2179
|
+
return part.overallLength ? null : "no overall length \u2014 a sectional straight IS its length";
|
|
2180
|
+
if (part.kind === "curve") {
|
|
2181
|
+
if (!part.radius) return "no radius \u2014 a sectional curve is a radius and an arc";
|
|
2182
|
+
if (part.arcDegrees == null) return "no arc \u2014 the radius alone does not say how far it turns";
|
|
2183
|
+
return null;
|
|
2184
|
+
}
|
|
2163
2185
|
if (part.kind === "crossover")
|
|
2164
2186
|
return "a crossover fixture builds one HALF of the assembly (piecesPerAssembly), so its published lengths describe a piece, not the finished part \u2014 the geometry of the whole crossover is not yet derivable from them";
|
|
2165
2187
|
if (part.kind === "crossing") return "crossing geometry is not modelled yet";
|
|
@@ -2173,6 +2195,26 @@ function partGeometryGap(part) {
|
|
|
2173
2195
|
}
|
|
2174
2196
|
function partGeometry(part, library = BUILT_IN_TRACK_PARTS) {
|
|
2175
2197
|
if (partGeometryGap(part)) return null;
|
|
2198
|
+
if (part.kind === "straight" || part.kind === "curve") {
|
|
2199
|
+
const end = part.kind === "curve" ? flexRunEnd(sectionalArcInches(part), part.radius.inches) : { x: part.overallLength.inches, y: 0, headingDeg: 0 };
|
|
2200
|
+
return {
|
|
2201
|
+
joints: [
|
|
2202
|
+
{ id: "a", role: "throat", x: 0, y: 0, angleDeg: 180 },
|
|
2203
|
+
{ id: "b", role: "through", x: end.x, y: end.y, angleDeg: end.headingDeg }
|
|
2204
|
+
],
|
|
2205
|
+
routes: [["a", "b"]],
|
|
2206
|
+
source: (part.kind === "curve" ? part.radius : part.overallLength)?.source ?? "unverified",
|
|
2207
|
+
divergingEndMeasured: false
|
|
2208
|
+
};
|
|
2209
|
+
}
|
|
2210
|
+
if (part.kind === "bumper") {
|
|
2211
|
+
return {
|
|
2212
|
+
joints: [{ id: "a", role: "throat", x: 0, y: 0, angleDeg: 180 }],
|
|
2213
|
+
routes: [],
|
|
2214
|
+
source: part.overallLength?.source ?? "unverified",
|
|
2215
|
+
divergingEndMeasured: false
|
|
2216
|
+
};
|
|
2217
|
+
}
|
|
2176
2218
|
if (part.kind === "flex") {
|
|
2177
2219
|
return {
|
|
2178
2220
|
joints: [
|
|
@@ -2263,6 +2305,12 @@ function pieceRoutePaths(piece, library = BUILT_IN_TRACK_PARTS) {
|
|
|
2263
2305
|
return { x: piece.x + x * c - ly * s, y: piece.y + x * s + ly * c };
|
|
2264
2306
|
};
|
|
2265
2307
|
const out = [];
|
|
2308
|
+
if (part.kind === "bumper") {
|
|
2309
|
+
const at2 = joints[0];
|
|
2310
|
+
if (!at2) return out;
|
|
2311
|
+
const len = part.overallLength?.inches ?? BUMPER_DRAWN_INCHES;
|
|
2312
|
+
return [{ route: ["a", "a"], points: [{ x: at2.x, y: at2.y }, place(len, 0)] }];
|
|
2313
|
+
}
|
|
2266
2314
|
for (const route of geo.routes) {
|
|
2267
2315
|
const a = at(route[0]);
|
|
2268
2316
|
const b = at(route[1]);
|
|
@@ -2326,6 +2374,22 @@ function partsPlaceable(library = BUILT_IN_TRACK_PARTS) {
|
|
|
2326
2374
|
return { placeable, blocked };
|
|
2327
2375
|
}
|
|
2328
2376
|
var JOINT_SNAP_INCHES = 0.01;
|
|
2377
|
+
var TRACK_PART_KINDS = [
|
|
2378
|
+
"turnout",
|
|
2379
|
+
"wye",
|
|
2380
|
+
"curved-turnout",
|
|
2381
|
+
"crossover",
|
|
2382
|
+
"crossing",
|
|
2383
|
+
"flex",
|
|
2384
|
+
"straight",
|
|
2385
|
+
"curve",
|
|
2386
|
+
"bumper"
|
|
2387
|
+
];
|
|
2388
|
+
var BUMPER_DRAWN_INCHES = 0.75;
|
|
2389
|
+
function sectionalArcInches(part) {
|
|
2390
|
+
if (part.kind !== "curve" || !part.radius || part.arcDegrees == null) return 0;
|
|
2391
|
+
return part.radius.inches * Math.abs(part.arcDegrees) * Math.PI / 180;
|
|
2392
|
+
}
|
|
2329
2393
|
function flexRunEnd(lengthInches, radiusInches) {
|
|
2330
2394
|
const L = lengthInches;
|
|
2331
2395
|
const R = radiusInches;
|
|
@@ -2501,6 +2565,7 @@ function walkTrackGraph(graph, pieces, startAt, library = BUILT_IN_TRACK_PARTS)
|
|
|
2501
2565
|
const piece = pieceById.get(a.piece);
|
|
2502
2566
|
const part = piece ? partOf(a.piece) : void 0;
|
|
2503
2567
|
if (piece && part?.kind === "flex") return piece.lengthInches ?? 0;
|
|
2568
|
+
if (part?.kind === "curve") return sectionalArcInches(part);
|
|
2504
2569
|
}
|
|
2505
2570
|
return Math.hypot(a.x - b.x, a.y - b.y);
|
|
2506
2571
|
};
|
|
@@ -2517,6 +2582,7 @@ function walkTrackGraph(graph, pieces, startAt, library = BUILT_IN_TRACK_PARTS)
|
|
|
2517
2582
|
toPos: startPos,
|
|
2518
2583
|
bornAt,
|
|
2519
2584
|
endsAt: null,
|
|
2585
|
+
closedBy: null,
|
|
2520
2586
|
pieces: [],
|
|
2521
2587
|
spans: [],
|
|
2522
2588
|
lateral: 0
|
|
@@ -2531,7 +2597,11 @@ function walkTrackGraph(graph, pieces, startAt, library = BUILT_IN_TRACK_PARTS)
|
|
|
2531
2597
|
const geo = geoOf(here.piece);
|
|
2532
2598
|
if (!geo) break;
|
|
2533
2599
|
const opts = geo.routes.filter((r) => r.includes(here.joint));
|
|
2534
|
-
if (!opts.length)
|
|
2600
|
+
if (!opts.length) {
|
|
2601
|
+
route.pieces.push(here.piece);
|
|
2602
|
+
route.closedBy = here.piece;
|
|
2603
|
+
break;
|
|
2604
|
+
}
|
|
2535
2605
|
const pick = opts.find((r) => r.includes("through")) ?? opts[0];
|
|
2536
2606
|
const exitJoint = pick[0] === here.joint ? pick[1] : pick[0];
|
|
2537
2607
|
const exit = byKey.get(`${here.piece}.${exitJoint}`);
|
|
@@ -2689,7 +2759,10 @@ function graphToDoc(pieces, input) {
|
|
|
2689
2759
|
role: "main",
|
|
2690
2760
|
lane: 0,
|
|
2691
2761
|
from: epA?.id ?? "A",
|
|
2692
|
-
...epB ? { to: epB.id } : {}
|
|
2762
|
+
...epB ? { to: epB.id } : {},
|
|
2763
|
+
// A main can be closed too — that is a pocket module, where the track
|
|
2764
|
+
// runs in and stops rather than crossing to a second endplate.
|
|
2765
|
+
...main.closedBy ? { bumperAt: "to" } : {}
|
|
2693
2766
|
},
|
|
2694
2767
|
...twoMains ? [
|
|
2695
2768
|
{
|
|
@@ -2716,6 +2789,11 @@ function graphToDoc(pieces, input) {
|
|
|
2716
2789
|
lane: laneOf(r, uniqueBranches),
|
|
2717
2790
|
fromPos: round(Math.min(r.fromPos, r.toPos)),
|
|
2718
2791
|
toPos: round(Math.max(r.fromPos, r.toPos)),
|
|
2792
|
+
// ⚠️ ALWAYS THE `to` END, and not because of an assumption: a branch's
|
|
2793
|
+
// positions are ARC LENGTH FROM ITS THROAT, so they only ever grow — a
|
|
2794
|
+
// spur running physically back toward endplate A still ends at the larger
|
|
2795
|
+
// number. The closed end is the far one from the turnout, by definition.
|
|
2796
|
+
...r.closedBy ? { bumperAt: "to" } : {},
|
|
2719
2797
|
...meta.trackName ? { trackName: meta.trackName } : {},
|
|
2720
2798
|
...meta.capacityFeet != null ? { capacityFeet: meta.capacityFeet } : {},
|
|
2721
2799
|
...meta.moduleTrackId != null ? { moduleTrackId: meta.moduleTrackId } : {}
|
|
@@ -3473,6 +3551,6 @@ function poseOverridesFromDoc(doc) {
|
|
|
3473
3551
|
return out;
|
|
3474
3552
|
}
|
|
3475
3553
|
|
|
3476
|
-
export { ATLAS_CODE55_N, BUILT_IN_TRACK_PARTS, CLEARANCE_SPACING_INCHES, CODE55_RAIL_HEIGHT_INCHES, DEFAULT_FLEX_PART_ID, ENDPLATE_FASCIA_CLEAR_INCHES, ENDPLATE_LEAD_INCHES, FAST_TRACKS_N_ME55, FAST_TRACKS_N_ME55_CROSSOVERS, FLEX_TRACK_PARTS, FREEMO_ENDPLATE_TRACK_FASCIA_CLEARANCE_INCHES, FREEMO_ENDPLATE_WIDTH_MIN_INCHES, FREEMO_ENDPLATE_WIDTH_RECOMMENDED_INCHES, FREEMO_MAIN_MIN_RADIUS_INCHES, FREEMO_REVERSE_CURVE_STRAIGHT_INCHES, FREEMO_TRACK_SPACING_INCHES, JOINT_SNAP_INCHES, MAIN2_TRACK_ID, MAIN_TRACK_ID, N_CAR_LENGTH_INCHES, N_SCALE_RATIO, PINCH_EASE_INCHES, RAIL_GAUGE_INCHES, TIE_HALF_LENGTH_INCHES, TURNOUT_LEAD_INCHES_PER_FROG, WHOLE_MODULE_SECTION_ID, asModuleSchematic, assessSectionEnd, assessSectionJoint, benchworkBand, benchworkOutline, buildCrossover, buildPassingSiding, buildTrackGraph, buildTransition, carCapacity, checkEndplateWidth, clearancePointPastFrogInches, crossoverPinches, deriveEndplatePoses, deriveGraphDoc, divergeSideForHand, docToState, emptyEditorState, endplateCentreOffsetInches, endplateEdgePose, endplateFaceSegments, endplateLead, endplateTrackOffsetInches, endplateWidthInches, fitFlexBetween, flexPartFor, flexParts, flexPieces, flexRunEnd, flexUsage, frogCasting, frogNumberFromName, fromSectionRelative, geometryTurnDegrees, graphToDoc, hasNoFarEndplate, importedPartToTrackPart, inchesToScaleFeet, isLoopDoc, isTransitionTurnout, laneOffsetAt, leadInchesForSize, maxFlexPieceInches, mergeImportedParts, mergeStoredParts, moduleCenterline, moduleFeatures, moduleFootprint, moduleLengthFromSections, moduleSections, nextId, parseXtpLibrary, partExtent, partExtentForSize, partGeometry, partGeometryGap, partOutlineAtFrog, partsPlaceable, pastFrogInchesForSize, pathLengthInches, pieceHand, piecePartNumber, pieceRoutePaths, placedJoints, poseNeedsManual, poseOverridesFromDoc, remapPos, resizeFlexPiece, resolveGraphAnchor, returnLoop, sampleBenchworkOutline, samplePartSegments, samplePath, scaleFeetToInches, sectionAdjacency, sectionBand, sectionBreaksFromSections, sectionComponents, sectionFootprints, sectionNeighbours, sectionSpans, sectionSpansOrWhole, sectionedCenterline, sectionedEndPose, sliceCenterline, snapPiece, spanOverhang, stateToDoc, storedPartToTrackPart, toSectionRelative, trackMeetsEndplateIssues, trackPart, trackPath, turnoutClosure, turnoutFacing, turnoutOccupiedSpan, turnoutPartForSize, usableCapacity, walkTrackGraph };
|
|
3554
|
+
export { ATLAS_CODE55_N, BUILT_IN_TRACK_PARTS, BUMPER_DRAWN_INCHES, CLEARANCE_SPACING_INCHES, CODE55_RAIL_HEIGHT_INCHES, DEFAULT_FLEX_PART_ID, ENDPLATE_FASCIA_CLEAR_INCHES, ENDPLATE_LEAD_INCHES, FAST_TRACKS_N_ME55, FAST_TRACKS_N_ME55_CROSSOVERS, FLEX_TRACK_PARTS, FREEMO_ENDPLATE_TRACK_FASCIA_CLEARANCE_INCHES, FREEMO_ENDPLATE_WIDTH_MIN_INCHES, FREEMO_ENDPLATE_WIDTH_RECOMMENDED_INCHES, FREEMO_MAIN_MIN_RADIUS_INCHES, FREEMO_REVERSE_CURVE_STRAIGHT_INCHES, FREEMO_TRACK_SPACING_INCHES, GENERIC_END_OF_TRACK, JOINT_SNAP_INCHES, MAIN2_TRACK_ID, MAIN_TRACK_ID, N_CAR_LENGTH_INCHES, N_SCALE_RATIO, PINCH_EASE_INCHES, RAIL_GAUGE_INCHES, TIE_HALF_LENGTH_INCHES, TRACK_PART_KINDS, TURNOUT_LEAD_INCHES_PER_FROG, WHOLE_MODULE_SECTION_ID, asModuleSchematic, assessSectionEnd, assessSectionJoint, benchworkBand, benchworkOutline, buildCrossover, buildPassingSiding, buildTrackGraph, buildTransition, carCapacity, checkEndplateWidth, clearancePointPastFrogInches, crossoverPinches, deriveEndplatePoses, deriveGraphDoc, divergeSideForHand, docToState, emptyEditorState, endplateCentreOffsetInches, endplateEdgePose, endplateFaceSegments, endplateLead, endplateTrackOffsetInches, endplateWidthInches, fitFlexBetween, flexPartFor, flexParts, flexPieces, flexRunEnd, flexUsage, frogCasting, frogNumberFromName, fromSectionRelative, geometryTurnDegrees, graphToDoc, hasNoFarEndplate, importedPartToTrackPart, inchesToScaleFeet, isLoopDoc, isTransitionTurnout, laneOffsetAt, leadInchesForSize, maxFlexPieceInches, mergeImportedParts, mergeStoredParts, moduleCenterline, moduleFeatures, moduleFootprint, moduleLengthFromSections, moduleSections, nextId, parseXtpLibrary, partExtent, partExtentForSize, partGeometry, partGeometryGap, partOutlineAtFrog, partsPlaceable, pastFrogInchesForSize, pathLengthInches, pieceHand, piecePartNumber, pieceRoutePaths, placedJoints, poseNeedsManual, poseOverridesFromDoc, remapPos, resizeFlexPiece, resolveGraphAnchor, returnLoop, sampleBenchworkOutline, samplePartSegments, samplePath, scaleFeetToInches, sectionAdjacency, sectionBand, sectionBreaksFromSections, sectionComponents, sectionFootprints, sectionNeighbours, sectionSpans, sectionSpansOrWhole, sectionalArcInches, sectionedCenterline, sectionedEndPose, sliceCenterline, snapPiece, spanOverhang, stateToDoc, storedPartToTrackPart, toSectionRelative, trackMeetsEndplateIssues, trackPart, trackPath, turnoutClosure, turnoutFacing, turnoutOccupiedSpan, turnoutPartForSize, usableCapacity, walkTrackGraph };
|
|
3477
3555
|
//# sourceMappingURL=index.js.map
|
|
3478
3556
|
//# sourceMappingURL=index.js.map
|