@willcgage/module-schematic 0.64.0 → 0.66.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 +17 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +49 -18
- package/dist/index.d.ts +49 -18
- package/dist/index.js +17 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -972,24 +972,32 @@ interface DrawCrossover {
|
|
|
972
972
|
toLane: number;
|
|
973
973
|
}
|
|
974
974
|
/**
|
|
975
|
-
* A route leaving the module at a third endplate
|
|
976
|
-
*
|
|
977
|
-
* `posFrac`, drops to its own `lane`, then runs to `endFrac` and ends at an
|
|
978
|
-
* endplate face.
|
|
975
|
+
* A route leaving the module at a third endplate — and an endplate is an
|
|
976
|
+
* endplate, whatever letter it carries (#183).
|
|
979
977
|
*
|
|
980
|
-
*
|
|
981
|
-
*
|
|
982
|
-
*
|
|
983
|
-
* route
|
|
984
|
-
*
|
|
985
|
-
*
|
|
978
|
+
* There is no split in the standard between "the two ends" and "the others": an
|
|
979
|
+
* endplate is the standardised face where a module joins another module, and a
|
|
980
|
+
* module may present two, three, or one. So a route to C is drawn the way a
|
|
981
|
+
* route to A or B is drawn — **it runs to the edge of the module and terminates
|
|
982
|
+
* in an endplate face carrying its letter**, rather than stopping partway along
|
|
983
|
+
* the strip as a stub.
|
|
984
|
+
*
|
|
985
|
+
* ⚠️ Because it runs the full width it would otherwise read as just another
|
|
986
|
+
* parallel main, which is exactly the confusion a dispatcher must not have. Its
|
|
987
|
+
* lane is therefore placed with a clear GAP beyond every other lane (see
|
|
988
|
+
* `laneGapFromOthers`), and it ends at a plate rather than running off the edge.
|
|
989
|
+
* The two requirements — full width, and not-a-parallel-main — are in tension by
|
|
990
|
+
* design, and the separation is what resolves it.
|
|
991
|
+
*
|
|
992
|
+
* The LETTER is the module's own fact and is fine to draw. The DESTINATION
|
|
993
|
+
* ("to Fillmore") depends on which module is physically attached at that
|
|
994
|
+
* junction, so it stays Free-Dispatcher's to derive at runtime.
|
|
986
995
|
*/
|
|
987
996
|
interface BranchConnector {
|
|
988
997
|
/** Endplate id — "C", "D", … */
|
|
989
998
|
id: string;
|
|
990
|
-
/** The
|
|
991
|
-
* physically attached, so FD derives
|
|
992
|
-
* the owner's local name, for tooltips and FD's fallback. */
|
|
999
|
+
/** The owner's local name for the plate. NOT the destination — that depends
|
|
1000
|
+
* on what's physically attached, so FD derives it at runtime. */
|
|
993
1001
|
label: string;
|
|
994
1002
|
/** The route's own name, from the track. */
|
|
995
1003
|
name: string;
|
|
@@ -1005,12 +1013,15 @@ interface BranchConnector {
|
|
|
1005
1013
|
fromLane: number;
|
|
1006
1014
|
/** Which side of the module it exits. */
|
|
1007
1015
|
side: "up" | "down";
|
|
1008
|
-
/** The branch's own lane, signed by `side
|
|
1009
|
-
* lane
|
|
1016
|
+
/** The branch's own lane, signed by `side`, placed a clear GAP beyond every
|
|
1017
|
+
* other lane so it can't be mistaken for a parallel main — already folded
|
|
1018
|
+
* into laneMin/laneMax. */
|
|
1010
1019
|
lane: number;
|
|
1011
|
-
/** Where the run ends
|
|
1020
|
+
/** Where the run ends and the endplate face is drawn: the module EDGE, 0 or
|
|
1021
|
+
* 1, because this is an end of the module like any other (#183). */
|
|
1012
1022
|
endFrac: number;
|
|
1013
|
-
/** The route's own arc length, inches.
|
|
1023
|
+
/** The route's own arc length on this module, inches — for the tooltip. The
|
|
1024
|
+
* drawn run is the strip's width, not this. */
|
|
1014
1025
|
lengthInches: number;
|
|
1015
1026
|
}
|
|
1016
1027
|
/** An industry — draw a car-spot span beside its track's lane, on `side`, with
|
|
@@ -1315,6 +1326,26 @@ declare function turnoutPartForSize(size: number, library?: TrackPart[]): TrackP
|
|
|
1315
1326
|
* wye is a long way out. Treat those as placeholders until a part is measured.
|
|
1316
1327
|
*/
|
|
1317
1328
|
declare function leadInchesForSize(size: number, library?: TrackPart[]): number;
|
|
1329
|
+
/**
|
|
1330
|
+
* How far a turnout of this size keeps going PAST its frog — the rest of the
|
|
1331
|
+
* moulding, after which the owner's flex track begins.
|
|
1332
|
+
*
|
|
1333
|
+
* The companion to {@link leadInchesForSize}, and it follows the same rule: an
|
|
1334
|
+
* exact measured part wins, otherwise interpolate across the measured ones. Both
|
|
1335
|
+
* numbers describe *how long to draw a turnout*, which is a question that always
|
|
1336
|
+
* has to be answered — you cannot draw nothing — so a reasoned interpolation is
|
|
1337
|
+
* the honest floor, and it is a far better answer than the alternative it
|
|
1338
|
+
* replaced (running the diverging route until it arrived parallel with the track
|
|
1339
|
+
* it fed, which was 10.79″ on a 6.00″ part).
|
|
1340
|
+
*
|
|
1341
|
+
* ⚠️ Do NOT confuse this with {@link partExtent}, which returns null rather than
|
|
1342
|
+
* guess. The difference is what is being claimed. `partExtent` says "THIS part
|
|
1343
|
+
* stops HERE" — a statement about a specific product, which may only be made
|
|
1344
|
+
* from a measurement. This says "a turnout of about this frog number runs about
|
|
1345
|
+
* this far past its frog", which is a drawing approximation and is labelled as
|
|
1346
|
+
* one: renderers draw the part's boundary only where {@link partExtent} answers.
|
|
1347
|
+
*/
|
|
1348
|
+
declare function pastFrogInchesForSize(size: number, library?: TrackPart[]): number;
|
|
1318
1349
|
/** One drawn piece of a part's geometry, in the part's own local frame. */
|
|
1319
1350
|
type PartSegment = {
|
|
1320
1351
|
kind: "straight";
|
|
@@ -1730,4 +1761,4 @@ declare function poseOverridesFromDoc(doc: ModuleSchematicDoc): Record<string, {
|
|
|
1730
1761
|
heading: number;
|
|
1731
1762
|
}>;
|
|
1732
1763
|
|
|
1733
|
-
export { ATLAS_CODE55_N, BUILT_IN_TRACK_PARTS, type BenchworkPoint, type BranchConnector, CODE55_RAIL_HEIGHT_INCHES, 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 EndplatePose, type EndplateTrackIssue, type EndplateWidthIssue, FREEMO_ENDPLATE_TRACK_FASCIA_CLEARANCE_INCHES, FREEMO_ENDPLATE_WIDTH_MIN_INCHES, FREEMO_ENDPLATE_WIDTH_RECOMMENDED_INCHES, FREEMO_TRACK_SPACING_INCHES, type FrogCasting, type GeometryType, type ImportedPart, type IndustryLabelMode, type IndustrySpot, 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 OutlineFace, type PartAngle, type PartDimension, type PartEnd, type PartExtent, type PartSegment, RAIL_GAUGE_INCHES, type ReturnLoopGeometry, type ReturnLoopShape, type SchematicBlock, type SchematicControlPoint, type SchematicCrossing, type SchematicEndplate, type SchematicEndplateTrack, type SchematicIndustry, type SchematicSection, type SchematicSignal, type SchematicTrack, type SchematicTurnout, type SectionAdjacency, type SectionFootprint, type SectionRelativePos, type SignalFacing, type SignalSide, type StoredTrackPart, TIE_HALF_LENGTH_INCHES, TURNOUT_LEAD_INCHES_PER_FROG, type TrackConfig, type TrackPart, type TrackRole, type TurnoutClosure, type TurnoutKind, WHOLE_MODULE_SECTION_ID, asModuleSchematic, benchworkBand, benchworkOutline, buildCrossover, buildPassingSiding, buildTransition, carCapacity, checkEndplateWidth, deriveEndplatePoses, divergeSideForHand, docToState, emptyEditorState, endplateFaceSegments, endplateLead, endplateTrackOffsetFor, endplateTrackOffsetInches, endplateWidthInches, frogCasting, frogNumberFromName, fromSectionRelative, geometryTurnDegrees, importedPartToTrackPart, inchesToScaleFeet, isLoopDoc, isTransitionTurnout, leadInchesForSize, mergeImportedParts, mergeStoredParts, moduleCenterline, moduleFeatures, moduleFootprint, moduleLengthFromSections, moduleSections, nextId, parseXtpLibrary, partExtent, partExtentForSize, partOutlineAtFrog, pathLengthInches, poseNeedsManual, poseOverridesFromDoc, remapPos, returnLoop, sampleBenchworkOutline, samplePartSegments, samplePath, scaleFeetToInches, sectionAdjacency, sectionBand, sectionBreaksFromSections, sectionComponents, sectionFootprints, sectionNeighbours, sectionSpans, sectionSpansOrWhole, sectionedCenterline, sectionedEndPose, sliceCenterline, stateToDoc, storedPartToTrackPart, toSectionRelative, trackMeetsEndplateIssues, trackPart, trackPath, turnoutClosure, turnoutPartForSize };
|
|
1764
|
+
export { ATLAS_CODE55_N, BUILT_IN_TRACK_PARTS, type BenchworkPoint, type BranchConnector, CODE55_RAIL_HEIGHT_INCHES, 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 EndplatePose, type EndplateTrackIssue, type EndplateWidthIssue, FREEMO_ENDPLATE_TRACK_FASCIA_CLEARANCE_INCHES, FREEMO_ENDPLATE_WIDTH_MIN_INCHES, FREEMO_ENDPLATE_WIDTH_RECOMMENDED_INCHES, FREEMO_TRACK_SPACING_INCHES, type FrogCasting, type GeometryType, type ImportedPart, type IndustryLabelMode, type IndustrySpot, 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 OutlineFace, type PartAngle, type PartDimension, type PartEnd, type PartExtent, type PartSegment, RAIL_GAUGE_INCHES, type ReturnLoopGeometry, type ReturnLoopShape, type SchematicBlock, type SchematicControlPoint, type SchematicCrossing, type SchematicEndplate, type SchematicEndplateTrack, type SchematicIndustry, type SchematicSection, type SchematicSignal, type SchematicTrack, type SchematicTurnout, type SectionAdjacency, type SectionFootprint, type SectionRelativePos, type SignalFacing, type SignalSide, type StoredTrackPart, TIE_HALF_LENGTH_INCHES, TURNOUT_LEAD_INCHES_PER_FROG, type TrackConfig, type TrackPart, type TrackRole, type TurnoutClosure, type TurnoutKind, WHOLE_MODULE_SECTION_ID, asModuleSchematic, benchworkBand, benchworkOutline, buildCrossover, buildPassingSiding, buildTransition, carCapacity, checkEndplateWidth, deriveEndplatePoses, divergeSideForHand, docToState, emptyEditorState, endplateFaceSegments, endplateLead, endplateTrackOffsetFor, endplateTrackOffsetInches, endplateWidthInches, frogCasting, frogNumberFromName, fromSectionRelative, geometryTurnDegrees, importedPartToTrackPart, inchesToScaleFeet, isLoopDoc, isTransitionTurnout, leadInchesForSize, mergeImportedParts, mergeStoredParts, moduleCenterline, moduleFeatures, moduleFootprint, moduleLengthFromSections, moduleSections, nextId, parseXtpLibrary, partExtent, partExtentForSize, partOutlineAtFrog, pastFrogInchesForSize, pathLengthInches, poseNeedsManual, poseOverridesFromDoc, remapPos, returnLoop, sampleBenchworkOutline, samplePartSegments, samplePath, scaleFeetToInches, sectionAdjacency, sectionBand, sectionBreaksFromSections, sectionComponents, sectionFootprints, sectionNeighbours, sectionSpans, sectionSpansOrWhole, sectionedCenterline, sectionedEndPose, sliceCenterline, stateToDoc, storedPartToTrackPart, toSectionRelative, trackMeetsEndplateIssues, trackPart, trackPath, turnoutClosure, turnoutPartForSize };
|
package/dist/index.d.ts
CHANGED
|
@@ -972,24 +972,32 @@ interface DrawCrossover {
|
|
|
972
972
|
toLane: number;
|
|
973
973
|
}
|
|
974
974
|
/**
|
|
975
|
-
* A route leaving the module at a third endplate
|
|
976
|
-
*
|
|
977
|
-
* `posFrac`, drops to its own `lane`, then runs to `endFrac` and ends at an
|
|
978
|
-
* endplate face.
|
|
975
|
+
* A route leaving the module at a third endplate — and an endplate is an
|
|
976
|
+
* endplate, whatever letter it carries (#183).
|
|
979
977
|
*
|
|
980
|
-
*
|
|
981
|
-
*
|
|
982
|
-
*
|
|
983
|
-
* route
|
|
984
|
-
*
|
|
985
|
-
*
|
|
978
|
+
* There is no split in the standard between "the two ends" and "the others": an
|
|
979
|
+
* endplate is the standardised face where a module joins another module, and a
|
|
980
|
+
* module may present two, three, or one. So a route to C is drawn the way a
|
|
981
|
+
* route to A or B is drawn — **it runs to the edge of the module and terminates
|
|
982
|
+
* in an endplate face carrying its letter**, rather than stopping partway along
|
|
983
|
+
* the strip as a stub.
|
|
984
|
+
*
|
|
985
|
+
* ⚠️ Because it runs the full width it would otherwise read as just another
|
|
986
|
+
* parallel main, which is exactly the confusion a dispatcher must not have. Its
|
|
987
|
+
* lane is therefore placed with a clear GAP beyond every other lane (see
|
|
988
|
+
* `laneGapFromOthers`), and it ends at a plate rather than running off the edge.
|
|
989
|
+
* The two requirements — full width, and not-a-parallel-main — are in tension by
|
|
990
|
+
* design, and the separation is what resolves it.
|
|
991
|
+
*
|
|
992
|
+
* The LETTER is the module's own fact and is fine to draw. The DESTINATION
|
|
993
|
+
* ("to Fillmore") depends on which module is physically attached at that
|
|
994
|
+
* junction, so it stays Free-Dispatcher's to derive at runtime.
|
|
986
995
|
*/
|
|
987
996
|
interface BranchConnector {
|
|
988
997
|
/** Endplate id — "C", "D", … */
|
|
989
998
|
id: string;
|
|
990
|
-
/** The
|
|
991
|
-
* physically attached, so FD derives
|
|
992
|
-
* the owner's local name, for tooltips and FD's fallback. */
|
|
999
|
+
/** The owner's local name for the plate. NOT the destination — that depends
|
|
1000
|
+
* on what's physically attached, so FD derives it at runtime. */
|
|
993
1001
|
label: string;
|
|
994
1002
|
/** The route's own name, from the track. */
|
|
995
1003
|
name: string;
|
|
@@ -1005,12 +1013,15 @@ interface BranchConnector {
|
|
|
1005
1013
|
fromLane: number;
|
|
1006
1014
|
/** Which side of the module it exits. */
|
|
1007
1015
|
side: "up" | "down";
|
|
1008
|
-
/** The branch's own lane, signed by `side
|
|
1009
|
-
* lane
|
|
1016
|
+
/** The branch's own lane, signed by `side`, placed a clear GAP beyond every
|
|
1017
|
+
* other lane so it can't be mistaken for a parallel main — already folded
|
|
1018
|
+
* into laneMin/laneMax. */
|
|
1010
1019
|
lane: number;
|
|
1011
|
-
/** Where the run ends
|
|
1020
|
+
/** Where the run ends and the endplate face is drawn: the module EDGE, 0 or
|
|
1021
|
+
* 1, because this is an end of the module like any other (#183). */
|
|
1012
1022
|
endFrac: number;
|
|
1013
|
-
/** The route's own arc length, inches.
|
|
1023
|
+
/** The route's own arc length on this module, inches — for the tooltip. The
|
|
1024
|
+
* drawn run is the strip's width, not this. */
|
|
1014
1025
|
lengthInches: number;
|
|
1015
1026
|
}
|
|
1016
1027
|
/** An industry — draw a car-spot span beside its track's lane, on `side`, with
|
|
@@ -1315,6 +1326,26 @@ declare function turnoutPartForSize(size: number, library?: TrackPart[]): TrackP
|
|
|
1315
1326
|
* wye is a long way out. Treat those as placeholders until a part is measured.
|
|
1316
1327
|
*/
|
|
1317
1328
|
declare function leadInchesForSize(size: number, library?: TrackPart[]): number;
|
|
1329
|
+
/**
|
|
1330
|
+
* How far a turnout of this size keeps going PAST its frog — the rest of the
|
|
1331
|
+
* moulding, after which the owner's flex track begins.
|
|
1332
|
+
*
|
|
1333
|
+
* The companion to {@link leadInchesForSize}, and it follows the same rule: an
|
|
1334
|
+
* exact measured part wins, otherwise interpolate across the measured ones. Both
|
|
1335
|
+
* numbers describe *how long to draw a turnout*, which is a question that always
|
|
1336
|
+
* has to be answered — you cannot draw nothing — so a reasoned interpolation is
|
|
1337
|
+
* the honest floor, and it is a far better answer than the alternative it
|
|
1338
|
+
* replaced (running the diverging route until it arrived parallel with the track
|
|
1339
|
+
* it fed, which was 10.79″ on a 6.00″ part).
|
|
1340
|
+
*
|
|
1341
|
+
* ⚠️ Do NOT confuse this with {@link partExtent}, which returns null rather than
|
|
1342
|
+
* guess. The difference is what is being claimed. `partExtent` says "THIS part
|
|
1343
|
+
* stops HERE" — a statement about a specific product, which may only be made
|
|
1344
|
+
* from a measurement. This says "a turnout of about this frog number runs about
|
|
1345
|
+
* this far past its frog", which is a drawing approximation and is labelled as
|
|
1346
|
+
* one: renderers draw the part's boundary only where {@link partExtent} answers.
|
|
1347
|
+
*/
|
|
1348
|
+
declare function pastFrogInchesForSize(size: number, library?: TrackPart[]): number;
|
|
1318
1349
|
/** One drawn piece of a part's geometry, in the part's own local frame. */
|
|
1319
1350
|
type PartSegment = {
|
|
1320
1351
|
kind: "straight";
|
|
@@ -1730,4 +1761,4 @@ declare function poseOverridesFromDoc(doc: ModuleSchematicDoc): Record<string, {
|
|
|
1730
1761
|
heading: number;
|
|
1731
1762
|
}>;
|
|
1732
1763
|
|
|
1733
|
-
export { ATLAS_CODE55_N, BUILT_IN_TRACK_PARTS, type BenchworkPoint, type BranchConnector, CODE55_RAIL_HEIGHT_INCHES, 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 EndplatePose, type EndplateTrackIssue, type EndplateWidthIssue, FREEMO_ENDPLATE_TRACK_FASCIA_CLEARANCE_INCHES, FREEMO_ENDPLATE_WIDTH_MIN_INCHES, FREEMO_ENDPLATE_WIDTH_RECOMMENDED_INCHES, FREEMO_TRACK_SPACING_INCHES, type FrogCasting, type GeometryType, type ImportedPart, type IndustryLabelMode, type IndustrySpot, 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 OutlineFace, type PartAngle, type PartDimension, type PartEnd, type PartExtent, type PartSegment, RAIL_GAUGE_INCHES, type ReturnLoopGeometry, type ReturnLoopShape, type SchematicBlock, type SchematicControlPoint, type SchematicCrossing, type SchematicEndplate, type SchematicEndplateTrack, type SchematicIndustry, type SchematicSection, type SchematicSignal, type SchematicTrack, type SchematicTurnout, type SectionAdjacency, type SectionFootprint, type SectionRelativePos, type SignalFacing, type SignalSide, type StoredTrackPart, TIE_HALF_LENGTH_INCHES, TURNOUT_LEAD_INCHES_PER_FROG, type TrackConfig, type TrackPart, type TrackRole, type TurnoutClosure, type TurnoutKind, WHOLE_MODULE_SECTION_ID, asModuleSchematic, benchworkBand, benchworkOutline, buildCrossover, buildPassingSiding, buildTransition, carCapacity, checkEndplateWidth, deriveEndplatePoses, divergeSideForHand, docToState, emptyEditorState, endplateFaceSegments, endplateLead, endplateTrackOffsetFor, endplateTrackOffsetInches, endplateWidthInches, frogCasting, frogNumberFromName, fromSectionRelative, geometryTurnDegrees, importedPartToTrackPart, inchesToScaleFeet, isLoopDoc, isTransitionTurnout, leadInchesForSize, mergeImportedParts, mergeStoredParts, moduleCenterline, moduleFeatures, moduleFootprint, moduleLengthFromSections, moduleSections, nextId, parseXtpLibrary, partExtent, partExtentForSize, partOutlineAtFrog, pathLengthInches, poseNeedsManual, poseOverridesFromDoc, remapPos, returnLoop, sampleBenchworkOutline, samplePartSegments, samplePath, scaleFeetToInches, sectionAdjacency, sectionBand, sectionBreaksFromSections, sectionComponents, sectionFootprints, sectionNeighbours, sectionSpans, sectionSpansOrWhole, sectionedCenterline, sectionedEndPose, sliceCenterline, stateToDoc, storedPartToTrackPart, toSectionRelative, trackMeetsEndplateIssues, trackPart, trackPath, turnoutClosure, turnoutPartForSize };
|
|
1764
|
+
export { ATLAS_CODE55_N, BUILT_IN_TRACK_PARTS, type BenchworkPoint, type BranchConnector, CODE55_RAIL_HEIGHT_INCHES, 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 EndplatePose, type EndplateTrackIssue, type EndplateWidthIssue, FREEMO_ENDPLATE_TRACK_FASCIA_CLEARANCE_INCHES, FREEMO_ENDPLATE_WIDTH_MIN_INCHES, FREEMO_ENDPLATE_WIDTH_RECOMMENDED_INCHES, FREEMO_TRACK_SPACING_INCHES, type FrogCasting, type GeometryType, type ImportedPart, type IndustryLabelMode, type IndustrySpot, 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 OutlineFace, type PartAngle, type PartDimension, type PartEnd, type PartExtent, type PartSegment, RAIL_GAUGE_INCHES, type ReturnLoopGeometry, type ReturnLoopShape, type SchematicBlock, type SchematicControlPoint, type SchematicCrossing, type SchematicEndplate, type SchematicEndplateTrack, type SchematicIndustry, type SchematicSection, type SchematicSignal, type SchematicTrack, type SchematicTurnout, type SectionAdjacency, type SectionFootprint, type SectionRelativePos, type SignalFacing, type SignalSide, type StoredTrackPart, TIE_HALF_LENGTH_INCHES, TURNOUT_LEAD_INCHES_PER_FROG, type TrackConfig, type TrackPart, type TrackRole, type TurnoutClosure, type TurnoutKind, WHOLE_MODULE_SECTION_ID, asModuleSchematic, benchworkBand, benchworkOutline, buildCrossover, buildPassingSiding, buildTransition, carCapacity, checkEndplateWidth, deriveEndplatePoses, divergeSideForHand, docToState, emptyEditorState, endplateFaceSegments, endplateLead, endplateTrackOffsetFor, endplateTrackOffsetInches, endplateWidthInches, frogCasting, frogNumberFromName, fromSectionRelative, geometryTurnDegrees, importedPartToTrackPart, inchesToScaleFeet, isLoopDoc, isTransitionTurnout, leadInchesForSize, mergeImportedParts, mergeStoredParts, moduleCenterline, moduleFeatures, moduleFootprint, moduleLengthFromSections, moduleSections, nextId, parseXtpLibrary, partExtent, partExtentForSize, partOutlineAtFrog, pastFrogInchesForSize, pathLengthInches, poseNeedsManual, poseOverridesFromDoc, remapPos, returnLoop, sampleBenchworkOutline, samplePartSegments, samplePath, scaleFeetToInches, sectionAdjacency, sectionBand, sectionBreaksFromSections, sectionComponents, sectionFootprints, sectionNeighbours, sectionSpans, sectionSpansOrWhole, sectionedCenterline, sectionedEndPose, sliceCenterline, stateToDoc, storedPartToTrackPart, toSectionRelative, trackMeetsEndplateIssues, trackPart, trackPath, turnoutClosure, turnoutPartForSize };
|
package/dist/index.js
CHANGED
|
@@ -1283,6 +1283,18 @@ function leadInchesForSize(size, library = BUILT_IN_TRACK_PARTS) {
|
|
|
1283
1283
|
const t = (size - lo.n) / (hi.n - lo.n);
|
|
1284
1284
|
return lo.lead + t * (hi.lead - lo.lead);
|
|
1285
1285
|
}
|
|
1286
|
+
function pastFrogInchesForSize(size, library = BUILT_IN_TRACK_PARTS) {
|
|
1287
|
+
const measured = library.filter((p) => p.kind === "turnout" && p.frogNumber != null).map((p) => ({ n: p.frogNumber, ext: partExtent(p) })).filter((p) => p.ext != null).map((p) => ({ n: p.n, past: p.ext.pastFrog })).sort((a, b) => a.n - b.n);
|
|
1288
|
+
if (!measured.length) return RAIL_GAUGE_INCHES * size;
|
|
1289
|
+
if (measured.length === 1) return measured[0].past;
|
|
1290
|
+
let i;
|
|
1291
|
+
if (size >= measured[measured.length - 1].n) i = measured.length - 2;
|
|
1292
|
+
else i = Math.max(0, measured.findIndex((p) => p.n >= size) - 1);
|
|
1293
|
+
const lo = measured[i];
|
|
1294
|
+
const hi = measured[i + 1];
|
|
1295
|
+
const t = (size - lo.n) / (hi.n - lo.n);
|
|
1296
|
+
return Math.max(0, lo.past + t * (hi.past - lo.past));
|
|
1297
|
+
}
|
|
1286
1298
|
function parseXtpLibrary(text) {
|
|
1287
1299
|
const parts = [];
|
|
1288
1300
|
let cur = null;
|
|
@@ -1765,8 +1777,9 @@ function moduleFeatures(doc) {
|
|
|
1765
1777
|
...crossings.flatMap((x) => [x.laneA, x.laneB]),
|
|
1766
1778
|
...crossovers.flatMap((x) => [x.fromLane, x.toLane])
|
|
1767
1779
|
];
|
|
1768
|
-
|
|
1769
|
-
let
|
|
1780
|
+
const LANE_GAP_FROM_OTHERS = 2;
|
|
1781
|
+
let upLane = Math.max(...baseLanes, 0) + (LANE_GAP_FROM_OTHERS - 1);
|
|
1782
|
+
let downLane = Math.min(...baseLanes, 0) - (LANE_GAP_FROM_OTHERS - 1);
|
|
1770
1783
|
const branchConnectors = doc.endplates.filter(
|
|
1771
1784
|
(e) => e.id !== "A" && e.id !== "B" && e.at && !!e.trackId && (doc.tracks ?? []).some((t) => t.id === e.trackId)
|
|
1772
1785
|
).map((e) => {
|
|
@@ -1777,10 +1790,6 @@ function moduleFeatures(doc) {
|
|
|
1777
1790
|
const lane = side === "down" ? --downLane : ++upLane;
|
|
1778
1791
|
const runInches = pathLengthInches(trk.path) || Math.abs(e.at.pos - startPos) || FREEMO_ENDPLATE_WIDTH_MIN_INCHES;
|
|
1779
1792
|
const toB = e.at.pos >= startPos;
|
|
1780
|
-
const fits = (p) => p >= 0 && p <= len;
|
|
1781
|
-
const ahead = startPos + runInches;
|
|
1782
|
-
const behind = startPos - runInches;
|
|
1783
|
-
const endPos = toB && fits(ahead) ? ahead : !toB && fits(behind) ? behind : fits(toB ? behind : ahead) ? toB ? behind : ahead : ahead;
|
|
1784
1793
|
return {
|
|
1785
1794
|
id: e.id,
|
|
1786
1795
|
label: e.label ?? e.id,
|
|
@@ -1791,7 +1800,7 @@ function moduleFeatures(doc) {
|
|
|
1791
1800
|
fromLane: sw ? trackLane.get(sw.onTrack) ?? 0 : 0,
|
|
1792
1801
|
side,
|
|
1793
1802
|
lane,
|
|
1794
|
-
endFrac:
|
|
1803
|
+
endFrac: toB ? 1 : 0,
|
|
1795
1804
|
lengthInches: runInches
|
|
1796
1805
|
};
|
|
1797
1806
|
});
|
|
@@ -2124,6 +2133,6 @@ function poseOverridesFromDoc(doc) {
|
|
|
2124
2133
|
return out;
|
|
2125
2134
|
}
|
|
2126
2135
|
|
|
2127
|
-
export { ATLAS_CODE55_N, BUILT_IN_TRACK_PARTS, CODE55_RAIL_HEIGHT_INCHES, ENDPLATE_FASCIA_CLEAR_INCHES, ENDPLATE_LEAD_INCHES, FREEMO_ENDPLATE_TRACK_FASCIA_CLEARANCE_INCHES, FREEMO_ENDPLATE_WIDTH_MIN_INCHES, FREEMO_ENDPLATE_WIDTH_RECOMMENDED_INCHES, FREEMO_TRACK_SPACING_INCHES, MAIN2_TRACK_ID, MAIN_TRACK_ID, N_CAR_LENGTH_INCHES, N_SCALE_RATIO, RAIL_GAUGE_INCHES, TIE_HALF_LENGTH_INCHES, TURNOUT_LEAD_INCHES_PER_FROG, WHOLE_MODULE_SECTION_ID, asModuleSchematic, benchworkBand, benchworkOutline, buildCrossover, buildPassingSiding, buildTransition, carCapacity, checkEndplateWidth, deriveEndplatePoses, divergeSideForHand, docToState, emptyEditorState, endplateFaceSegments, endplateLead, endplateTrackOffsetFor, endplateTrackOffsetInches, endplateWidthInches, frogCasting, frogNumberFromName, fromSectionRelative, geometryTurnDegrees, importedPartToTrackPart, inchesToScaleFeet, isLoopDoc, isTransitionTurnout, leadInchesForSize, mergeImportedParts, mergeStoredParts, moduleCenterline, moduleFeatures, moduleFootprint, moduleLengthFromSections, moduleSections, nextId, parseXtpLibrary, partExtent, partExtentForSize, partOutlineAtFrog, pathLengthInches, poseNeedsManual, poseOverridesFromDoc, remapPos, returnLoop, sampleBenchworkOutline, samplePartSegments, samplePath, scaleFeetToInches, sectionAdjacency, sectionBand, sectionBreaksFromSections, sectionComponents, sectionFootprints, sectionNeighbours, sectionSpans, sectionSpansOrWhole, sectionedCenterline, sectionedEndPose, sliceCenterline, stateToDoc, storedPartToTrackPart, toSectionRelative, trackMeetsEndplateIssues, trackPart, trackPath, turnoutClosure, turnoutPartForSize };
|
|
2136
|
+
export { ATLAS_CODE55_N, BUILT_IN_TRACK_PARTS, CODE55_RAIL_HEIGHT_INCHES, ENDPLATE_FASCIA_CLEAR_INCHES, ENDPLATE_LEAD_INCHES, FREEMO_ENDPLATE_TRACK_FASCIA_CLEARANCE_INCHES, FREEMO_ENDPLATE_WIDTH_MIN_INCHES, FREEMO_ENDPLATE_WIDTH_RECOMMENDED_INCHES, FREEMO_TRACK_SPACING_INCHES, MAIN2_TRACK_ID, MAIN_TRACK_ID, N_CAR_LENGTH_INCHES, N_SCALE_RATIO, RAIL_GAUGE_INCHES, TIE_HALF_LENGTH_INCHES, TURNOUT_LEAD_INCHES_PER_FROG, WHOLE_MODULE_SECTION_ID, asModuleSchematic, benchworkBand, benchworkOutline, buildCrossover, buildPassingSiding, buildTransition, carCapacity, checkEndplateWidth, deriveEndplatePoses, divergeSideForHand, docToState, emptyEditorState, endplateFaceSegments, endplateLead, endplateTrackOffsetFor, endplateTrackOffsetInches, endplateWidthInches, frogCasting, frogNumberFromName, fromSectionRelative, geometryTurnDegrees, importedPartToTrackPart, inchesToScaleFeet, isLoopDoc, isTransitionTurnout, leadInchesForSize, mergeImportedParts, mergeStoredParts, moduleCenterline, moduleFeatures, moduleFootprint, moduleLengthFromSections, moduleSections, nextId, parseXtpLibrary, partExtent, partExtentForSize, partOutlineAtFrog, pastFrogInchesForSize, pathLengthInches, poseNeedsManual, poseOverridesFromDoc, remapPos, returnLoop, sampleBenchworkOutline, samplePartSegments, samplePath, scaleFeetToInches, sectionAdjacency, sectionBand, sectionBreaksFromSections, sectionComponents, sectionFootprints, sectionNeighbours, sectionSpans, sectionSpansOrWhole, sectionedCenterline, sectionedEndPose, sliceCenterline, stateToDoc, storedPartToTrackPart, toSectionRelative, trackMeetsEndplateIssues, trackPart, trackPath, turnoutClosure, turnoutPartForSize };
|
|
2128
2137
|
//# sourceMappingURL=index.js.map
|
|
2129
2138
|
//# sourceMappingURL=index.js.map
|