@willcgage/module-schematic 0.62.0 → 0.64.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 +72 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +94 -1
- package/dist/index.d.ts +94 -1
- package/dist/index.js +68 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1262,6 +1262,42 @@ declare const ATLAS_CODE55_N: TrackPart[];
|
|
|
1262
1262
|
declare const BUILT_IN_TRACK_PARTS: TrackPart[];
|
|
1263
1263
|
/** Look a part up by its slug. */
|
|
1264
1264
|
declare function trackPart(id: string, library?: TrackPart[]): TrackPart | null;
|
|
1265
|
+
/** Half an N-scale tie, inches — a 8′6″ tie is 102″ prototype, /160 ≈ 0.638″.
|
|
1266
|
+
* The half-width a tie strip extends either side of the rail it carries, which
|
|
1267
|
+
* is what gives a drawn turnout body its width. */
|
|
1268
|
+
declare const TIE_HALF_LENGTH_INCHES = 0.319;
|
|
1269
|
+
/** Where a turnout part physically starts and stops, relative to its POINTS.
|
|
1270
|
+
* All inches; `aheadOfPoints` is the end of the tie strip, which is essentially
|
|
1271
|
+
* where the diverging rail stops and the owner's flex track begins. */
|
|
1272
|
+
interface PartExtent {
|
|
1273
|
+
/** Points → the near end of the tie strip. Positive = the strip starts this
|
|
1274
|
+
* far BEHIND the points (it always does — that end is plain approach track). */
|
|
1275
|
+
behindPoints: number;
|
|
1276
|
+
/** Points → the far end of the tie strip. */
|
|
1277
|
+
aheadOfPoints: number;
|
|
1278
|
+
/** Frog → the far end. How much turnout there still is past the frog. */
|
|
1279
|
+
pastFrog: number;
|
|
1280
|
+
}
|
|
1281
|
+
/**
|
|
1282
|
+
* A part's real extent, or **null when it hasn't been measured**.
|
|
1283
|
+
*
|
|
1284
|
+
* ⚠️ This deliberately does NOT fall back to a frog-number rule, unlike
|
|
1285
|
+
* {@link leadInchesForSize}. Overall length is not a function of N — the #5 and
|
|
1286
|
+
* the #7 are BOTH 6.00″, same tie strip, different frog. Angle is geometry;
|
|
1287
|
+
* length is packaging, and packaging can only be looked up. A renderer that
|
|
1288
|
+
* gets null should draw no part boundary rather than invent one: the absence is
|
|
1289
|
+
* a truthful signal that the library has a gap, and inventing a length here is
|
|
1290
|
+
* how hand-built geometry once reached owners as if it were part data.
|
|
1291
|
+
*
|
|
1292
|
+
* Requires `pointsOffset` and `overallLength`; `pastFrog` additionally needs
|
|
1293
|
+
* `frogOffset`. Every dimension must be `measured` — a derived one would launder
|
|
1294
|
+
* a guess into a drawing that says "this is where your turnout ends".
|
|
1295
|
+
*/
|
|
1296
|
+
declare function partExtent(part: TrackPart | null | undefined): PartExtent | null;
|
|
1297
|
+
/** The extent of the part a turnout of this frog number IS, or null when no
|
|
1298
|
+
* measured part matches EXACTLY. A #6 is not a #5 or a #7 — the nearest part's
|
|
1299
|
+
* length says nothing about it (see {@link partExtent}). */
|
|
1300
|
+
declare function partExtentForSize(size: number, library?: TrackPart[]): PartExtent | null;
|
|
1265
1301
|
/** The closest built-in turnout for a frog number — what a bare `size` maps to
|
|
1266
1302
|
* when a turnout names no part. Exact match wins; otherwise the nearest frog. */
|
|
1267
1303
|
declare function turnoutPartForSize(size: number, library?: TrackPart[]): TrackPart | null;
|
|
@@ -1347,6 +1383,63 @@ declare function frogNumberFromName(name: string | undefined): number | undefine
|
|
|
1347
1383
|
* land as `unverified`, because a community CAD file is not a measurement.
|
|
1348
1384
|
*/
|
|
1349
1385
|
declare function importedPartToTrackPart(part: ImportedPart, sourceName?: string): TrackPart;
|
|
1386
|
+
/**
|
|
1387
|
+
* A part as an application stores it — one flat row, so the package needs to
|
|
1388
|
+
* know nothing about any particular database. Dimensions are plain numbers with
|
|
1389
|
+
* a `source` beside each, mirroring {@link PartDimension}.
|
|
1390
|
+
*/
|
|
1391
|
+
interface StoredTrackPart {
|
|
1392
|
+
slug: string;
|
|
1393
|
+
manufacturer: string;
|
|
1394
|
+
line: string;
|
|
1395
|
+
scale?: string | null;
|
|
1396
|
+
name: string;
|
|
1397
|
+
kind?: string | null;
|
|
1398
|
+
partNumberLeft?: string | null;
|
|
1399
|
+
partNumberRight?: string | null;
|
|
1400
|
+
partNumberSingle?: string | null;
|
|
1401
|
+
frogNumber?: number | null;
|
|
1402
|
+
pointsOffsetInches?: number | null;
|
|
1403
|
+
pointsOffsetSource?: string | null;
|
|
1404
|
+
frogOffsetInches?: number | null;
|
|
1405
|
+
frogOffsetSource?: string | null;
|
|
1406
|
+
overallLengthInches?: number | null;
|
|
1407
|
+
overallLengthSource?: string | null;
|
|
1408
|
+
leadInches?: number | null;
|
|
1409
|
+
leadSource?: string | null;
|
|
1410
|
+
outerRadiusInches?: number | null;
|
|
1411
|
+
innerRadiusInches?: number | null;
|
|
1412
|
+
radiusSource?: string | null;
|
|
1413
|
+
actualAngleDeg?: number | null;
|
|
1414
|
+
actualAngleSource?: string | null;
|
|
1415
|
+
measurementNote?: string | null;
|
|
1416
|
+
}
|
|
1417
|
+
/**
|
|
1418
|
+
* Convert a stored row into a {@link TrackPart}.
|
|
1419
|
+
*
|
|
1420
|
+
* The LEAD is derived from the two offsets whenever both are present, rather
|
|
1421
|
+
* than read from its own column: they're measured from the same tie end, so
|
|
1422
|
+
* their difference is the lead by construction, and a separately-entered lead
|
|
1423
|
+
* could silently disagree with the positions it's supposed to summarise. A
|
|
1424
|
+
* stored `leadInches` is used only for a part whose offsets aren't known.
|
|
1425
|
+
*/
|
|
1426
|
+
declare function storedPartToTrackPart(row: StoredTrackPart): TrackPart;
|
|
1427
|
+
/**
|
|
1428
|
+
* Fold an application's STORED library over the built-in one, by slug.
|
|
1429
|
+
*
|
|
1430
|
+
* ⚠️ Unlike {@link mergeImportedParts}, a stored part **replaces** a built-in
|
|
1431
|
+
* outright. That difference is deliberate, and the reason is who is speaking: an
|
|
1432
|
+
* import is a third-party file that may have been fitted in someone else's CAD
|
|
1433
|
+
* program, so it may only fill gaps. The stored library is seeded FROM these
|
|
1434
|
+
* built-ins and edited by an admin with the part in their hand — it is the same
|
|
1435
|
+
* library, later. Refusing their correction would mean a wrong dimension could
|
|
1436
|
+
* only be fixed by shipping a release, which is exactly the limitation the
|
|
1437
|
+
* stored library exists to remove.
|
|
1438
|
+
*
|
|
1439
|
+
* The built-ins remain the floor: a part nobody has stored still resolves, so
|
|
1440
|
+
* geometry keeps working with no database at all.
|
|
1441
|
+
*/
|
|
1442
|
+
declare function mergeStoredParts(stored: StoredTrackPart[], library?: TrackPart[]): TrackPart[];
|
|
1350
1443
|
/**
|
|
1351
1444
|
* Fold imported parts into a library.
|
|
1352
1445
|
*
|
|
@@ -1637,4 +1730,4 @@ declare function poseOverridesFromDoc(doc: ModuleSchematicDoc): Record<string, {
|
|
|
1637
1730
|
heading: number;
|
|
1638
1731
|
}>;
|
|
1639
1732
|
|
|
1640
|
-
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 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, 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, moduleCenterline, moduleFeatures, moduleFootprint, moduleLengthFromSections, moduleSections, nextId, parseXtpLibrary, partOutlineAtFrog, pathLengthInches, poseNeedsManual, poseOverridesFromDoc, remapPos, returnLoop, sampleBenchworkOutline, samplePartSegments, samplePath, scaleFeetToInches, sectionAdjacency, sectionBand, sectionBreaksFromSections, sectionComponents, sectionFootprints, sectionNeighbours, sectionSpans, sectionSpansOrWhole, sectionedCenterline, sectionedEndPose, sliceCenterline, stateToDoc, toSectionRelative, trackMeetsEndplateIssues, trackPart, trackPath, turnoutClosure, turnoutPartForSize };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1262,6 +1262,42 @@ declare const ATLAS_CODE55_N: TrackPart[];
|
|
|
1262
1262
|
declare const BUILT_IN_TRACK_PARTS: TrackPart[];
|
|
1263
1263
|
/** Look a part up by its slug. */
|
|
1264
1264
|
declare function trackPart(id: string, library?: TrackPart[]): TrackPart | null;
|
|
1265
|
+
/** Half an N-scale tie, inches — a 8′6″ tie is 102″ prototype, /160 ≈ 0.638″.
|
|
1266
|
+
* The half-width a tie strip extends either side of the rail it carries, which
|
|
1267
|
+
* is what gives a drawn turnout body its width. */
|
|
1268
|
+
declare const TIE_HALF_LENGTH_INCHES = 0.319;
|
|
1269
|
+
/** Where a turnout part physically starts and stops, relative to its POINTS.
|
|
1270
|
+
* All inches; `aheadOfPoints` is the end of the tie strip, which is essentially
|
|
1271
|
+
* where the diverging rail stops and the owner's flex track begins. */
|
|
1272
|
+
interface PartExtent {
|
|
1273
|
+
/** Points → the near end of the tie strip. Positive = the strip starts this
|
|
1274
|
+
* far BEHIND the points (it always does — that end is plain approach track). */
|
|
1275
|
+
behindPoints: number;
|
|
1276
|
+
/** Points → the far end of the tie strip. */
|
|
1277
|
+
aheadOfPoints: number;
|
|
1278
|
+
/** Frog → the far end. How much turnout there still is past the frog. */
|
|
1279
|
+
pastFrog: number;
|
|
1280
|
+
}
|
|
1281
|
+
/**
|
|
1282
|
+
* A part's real extent, or **null when it hasn't been measured**.
|
|
1283
|
+
*
|
|
1284
|
+
* ⚠️ This deliberately does NOT fall back to a frog-number rule, unlike
|
|
1285
|
+
* {@link leadInchesForSize}. Overall length is not a function of N — the #5 and
|
|
1286
|
+
* the #7 are BOTH 6.00″, same tie strip, different frog. Angle is geometry;
|
|
1287
|
+
* length is packaging, and packaging can only be looked up. A renderer that
|
|
1288
|
+
* gets null should draw no part boundary rather than invent one: the absence is
|
|
1289
|
+
* a truthful signal that the library has a gap, and inventing a length here is
|
|
1290
|
+
* how hand-built geometry once reached owners as if it were part data.
|
|
1291
|
+
*
|
|
1292
|
+
* Requires `pointsOffset` and `overallLength`; `pastFrog` additionally needs
|
|
1293
|
+
* `frogOffset`. Every dimension must be `measured` — a derived one would launder
|
|
1294
|
+
* a guess into a drawing that says "this is where your turnout ends".
|
|
1295
|
+
*/
|
|
1296
|
+
declare function partExtent(part: TrackPart | null | undefined): PartExtent | null;
|
|
1297
|
+
/** The extent of the part a turnout of this frog number IS, or null when no
|
|
1298
|
+
* measured part matches EXACTLY. A #6 is not a #5 or a #7 — the nearest part's
|
|
1299
|
+
* length says nothing about it (see {@link partExtent}). */
|
|
1300
|
+
declare function partExtentForSize(size: number, library?: TrackPart[]): PartExtent | null;
|
|
1265
1301
|
/** The closest built-in turnout for a frog number — what a bare `size` maps to
|
|
1266
1302
|
* when a turnout names no part. Exact match wins; otherwise the nearest frog. */
|
|
1267
1303
|
declare function turnoutPartForSize(size: number, library?: TrackPart[]): TrackPart | null;
|
|
@@ -1347,6 +1383,63 @@ declare function frogNumberFromName(name: string | undefined): number | undefine
|
|
|
1347
1383
|
* land as `unverified`, because a community CAD file is not a measurement.
|
|
1348
1384
|
*/
|
|
1349
1385
|
declare function importedPartToTrackPart(part: ImportedPart, sourceName?: string): TrackPart;
|
|
1386
|
+
/**
|
|
1387
|
+
* A part as an application stores it — one flat row, so the package needs to
|
|
1388
|
+
* know nothing about any particular database. Dimensions are plain numbers with
|
|
1389
|
+
* a `source` beside each, mirroring {@link PartDimension}.
|
|
1390
|
+
*/
|
|
1391
|
+
interface StoredTrackPart {
|
|
1392
|
+
slug: string;
|
|
1393
|
+
manufacturer: string;
|
|
1394
|
+
line: string;
|
|
1395
|
+
scale?: string | null;
|
|
1396
|
+
name: string;
|
|
1397
|
+
kind?: string | null;
|
|
1398
|
+
partNumberLeft?: string | null;
|
|
1399
|
+
partNumberRight?: string | null;
|
|
1400
|
+
partNumberSingle?: string | null;
|
|
1401
|
+
frogNumber?: number | null;
|
|
1402
|
+
pointsOffsetInches?: number | null;
|
|
1403
|
+
pointsOffsetSource?: string | null;
|
|
1404
|
+
frogOffsetInches?: number | null;
|
|
1405
|
+
frogOffsetSource?: string | null;
|
|
1406
|
+
overallLengthInches?: number | null;
|
|
1407
|
+
overallLengthSource?: string | null;
|
|
1408
|
+
leadInches?: number | null;
|
|
1409
|
+
leadSource?: string | null;
|
|
1410
|
+
outerRadiusInches?: number | null;
|
|
1411
|
+
innerRadiusInches?: number | null;
|
|
1412
|
+
radiusSource?: string | null;
|
|
1413
|
+
actualAngleDeg?: number | null;
|
|
1414
|
+
actualAngleSource?: string | null;
|
|
1415
|
+
measurementNote?: string | null;
|
|
1416
|
+
}
|
|
1417
|
+
/**
|
|
1418
|
+
* Convert a stored row into a {@link TrackPart}.
|
|
1419
|
+
*
|
|
1420
|
+
* The LEAD is derived from the two offsets whenever both are present, rather
|
|
1421
|
+
* than read from its own column: they're measured from the same tie end, so
|
|
1422
|
+
* their difference is the lead by construction, and a separately-entered lead
|
|
1423
|
+
* could silently disagree with the positions it's supposed to summarise. A
|
|
1424
|
+
* stored `leadInches` is used only for a part whose offsets aren't known.
|
|
1425
|
+
*/
|
|
1426
|
+
declare function storedPartToTrackPart(row: StoredTrackPart): TrackPart;
|
|
1427
|
+
/**
|
|
1428
|
+
* Fold an application's STORED library over the built-in one, by slug.
|
|
1429
|
+
*
|
|
1430
|
+
* ⚠️ Unlike {@link mergeImportedParts}, a stored part **replaces** a built-in
|
|
1431
|
+
* outright. That difference is deliberate, and the reason is who is speaking: an
|
|
1432
|
+
* import is a third-party file that may have been fitted in someone else's CAD
|
|
1433
|
+
* program, so it may only fill gaps. The stored library is seeded FROM these
|
|
1434
|
+
* built-ins and edited by an admin with the part in their hand — it is the same
|
|
1435
|
+
* library, later. Refusing their correction would mean a wrong dimension could
|
|
1436
|
+
* only be fixed by shipping a release, which is exactly the limitation the
|
|
1437
|
+
* stored library exists to remove.
|
|
1438
|
+
*
|
|
1439
|
+
* The built-ins remain the floor: a part nobody has stored still resolves, so
|
|
1440
|
+
* geometry keeps working with no database at all.
|
|
1441
|
+
*/
|
|
1442
|
+
declare function mergeStoredParts(stored: StoredTrackPart[], library?: TrackPart[]): TrackPart[];
|
|
1350
1443
|
/**
|
|
1351
1444
|
* Fold imported parts into a library.
|
|
1352
1445
|
*
|
|
@@ -1637,4 +1730,4 @@ declare function poseOverridesFromDoc(doc: ModuleSchematicDoc): Record<string, {
|
|
|
1637
1730
|
heading: number;
|
|
1638
1731
|
}>;
|
|
1639
1732
|
|
|
1640
|
-
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 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, 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, moduleCenterline, moduleFeatures, moduleFootprint, moduleLengthFromSections, moduleSections, nextId, parseXtpLibrary, partOutlineAtFrog, pathLengthInches, poseNeedsManual, poseOverridesFromDoc, remapPos, returnLoop, sampleBenchworkOutline, samplePartSegments, samplePath, scaleFeetToInches, sectionAdjacency, sectionBand, sectionBreaksFromSections, sectionComponents, sectionFootprints, sectionNeighbours, sectionSpans, sectionSpansOrWhole, sectionedCenterline, sectionedEndPose, sliceCenterline, stateToDoc, toSectionRelative, trackMeetsEndplateIssues, trackPart, trackPath, turnoutClosure, turnoutPartForSize };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -1239,6 +1239,24 @@ var BUILT_IN_TRACK_PARTS = [...ATLAS_CODE55_N];
|
|
|
1239
1239
|
function trackPart(id, library = BUILT_IN_TRACK_PARTS) {
|
|
1240
1240
|
return library.find((p) => p.id === id) ?? null;
|
|
1241
1241
|
}
|
|
1242
|
+
var TIE_HALF_LENGTH_INCHES = 0.319;
|
|
1243
|
+
function partExtent(part) {
|
|
1244
|
+
const pts = part?.pointsOffset;
|
|
1245
|
+
const overall = part?.overallLength;
|
|
1246
|
+
if (!pts || !overall) return null;
|
|
1247
|
+
if (pts.source !== "measured" || overall.source !== "measured") return null;
|
|
1248
|
+
const frog = part?.frogOffset;
|
|
1249
|
+
const aheadOfPoints = overall.inches - pts.inches;
|
|
1250
|
+
return {
|
|
1251
|
+
behindPoints: pts.inches,
|
|
1252
|
+
aheadOfPoints,
|
|
1253
|
+
pastFrog: frog && frog.source === "measured" ? overall.inches - frog.inches : aheadOfPoints
|
|
1254
|
+
};
|
|
1255
|
+
}
|
|
1256
|
+
function partExtentForSize(size, library = BUILT_IN_TRACK_PARTS) {
|
|
1257
|
+
const part = turnoutPartForSize(size, library);
|
|
1258
|
+
return part && part.frogNumber === size ? partExtent(part) : null;
|
|
1259
|
+
}
|
|
1242
1260
|
function turnoutPartForSize(size, library = BUILT_IN_TRACK_PARTS) {
|
|
1243
1261
|
const turnouts = library.filter((p) => p.kind === "turnout" && p.frogNumber != null);
|
|
1244
1262
|
if (!turnouts.length) return null;
|
|
@@ -1385,6 +1403,55 @@ function importedPartToTrackPart(part, sourceName = "imported .xtp") {
|
|
|
1385
1403
|
}
|
|
1386
1404
|
return out;
|
|
1387
1405
|
}
|
|
1406
|
+
var asSource = (s) => s === "manufacturer" || s === "measured" || s === "derived" ? s : "unverified";
|
|
1407
|
+
function storedPartToTrackPart(row) {
|
|
1408
|
+
const note = row.measurementNote ?? void 0;
|
|
1409
|
+
const dim = (inches, source) => typeof inches === "number" && Number.isFinite(inches) ? { inches, source: asSource(source), ...note ? { note } : {} } : void 0;
|
|
1410
|
+
const points = dim(row.pointsOffsetInches, row.pointsOffsetSource);
|
|
1411
|
+
const frog = dim(row.frogOffsetInches, row.frogOffsetSource);
|
|
1412
|
+
const lead = points && frog ? {
|
|
1413
|
+
inches: frog.inches - points.inches,
|
|
1414
|
+
source: points.source === "measured" && frog.source === "measured" ? "measured" : "derived",
|
|
1415
|
+
...note ? { note } : {}
|
|
1416
|
+
} : dim(row.leadInches, row.leadSource);
|
|
1417
|
+
const kind = row.kind;
|
|
1418
|
+
const part = {
|
|
1419
|
+
id: row.slug,
|
|
1420
|
+
manufacturer: row.manufacturer,
|
|
1421
|
+
line: row.line,
|
|
1422
|
+
scale: "N",
|
|
1423
|
+
name: row.name,
|
|
1424
|
+
kind: kind === "wye" || kind === "curved-turnout" || kind === "crossing" ? kind : "turnout"
|
|
1425
|
+
};
|
|
1426
|
+
const numbers = {
|
|
1427
|
+
...row.partNumberLeft ? { left: row.partNumberLeft } : {},
|
|
1428
|
+
...row.partNumberRight ? { right: row.partNumberRight } : {},
|
|
1429
|
+
...row.partNumberSingle ? { single: row.partNumberSingle } : {}
|
|
1430
|
+
};
|
|
1431
|
+
if (Object.keys(numbers).length) part.partNumbers = numbers;
|
|
1432
|
+
if (typeof row.frogNumber === "number") part.frogNumber = row.frogNumber;
|
|
1433
|
+
if (points) part.pointsOffset = points;
|
|
1434
|
+
if (frog) part.frogOffset = frog;
|
|
1435
|
+
const overall = dim(row.overallLengthInches, row.overallLengthSource);
|
|
1436
|
+
if (overall) part.overallLength = overall;
|
|
1437
|
+
if (lead) part.lead = lead;
|
|
1438
|
+
const outer = dim(row.outerRadiusInches, row.radiusSource);
|
|
1439
|
+
const inner = dim(row.innerRadiusInches, row.radiusSource);
|
|
1440
|
+
if (outer) part.outerRadius = outer;
|
|
1441
|
+
if (inner) part.innerRadius = inner;
|
|
1442
|
+
if (typeof row.actualAngleDeg === "number")
|
|
1443
|
+
part.actualAngle = {
|
|
1444
|
+
deg: row.actualAngleDeg,
|
|
1445
|
+
source: asSource(row.actualAngleSource),
|
|
1446
|
+
...note ? { note } : {}
|
|
1447
|
+
};
|
|
1448
|
+
return part;
|
|
1449
|
+
}
|
|
1450
|
+
function mergeStoredParts(stored, library = BUILT_IN_TRACK_PARTS) {
|
|
1451
|
+
const bySlug = new Map(library.map((p) => [p.id, p]));
|
|
1452
|
+
for (const row of stored) bySlug.set(row.slug, storedPartToTrackPart(row));
|
|
1453
|
+
return [...bySlug.values()];
|
|
1454
|
+
}
|
|
1388
1455
|
function mergeImportedParts(imported, library = BUILT_IN_TRACK_PARTS, sourceName = "imported .xtp") {
|
|
1389
1456
|
const out = library.map((p) => ({ ...p }));
|
|
1390
1457
|
const numbersOf = (p) => [p.partNumbers?.left, p.partNumbers?.right, p.partNumbers?.single].filter(Boolean).map((s) => s.trim().toLowerCase());
|
|
@@ -2057,6 +2124,6 @@ function poseOverridesFromDoc(doc) {
|
|
|
2057
2124
|
return out;
|
|
2058
2125
|
}
|
|
2059
2126
|
|
|
2060
|
-
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, 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, moduleCenterline, moduleFeatures, moduleFootprint, moduleLengthFromSections, moduleSections, nextId, parseXtpLibrary, partOutlineAtFrog, pathLengthInches, poseNeedsManual, poseOverridesFromDoc, remapPos, returnLoop, sampleBenchworkOutline, samplePartSegments, samplePath, scaleFeetToInches, sectionAdjacency, sectionBand, sectionBreaksFromSections, sectionComponents, sectionFootprints, sectionNeighbours, sectionSpans, sectionSpansOrWhole, sectionedCenterline, sectionedEndPose, sliceCenterline, stateToDoc, toSectionRelative, trackMeetsEndplateIssues, trackPart, trackPath, turnoutClosure, turnoutPartForSize };
|
|
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 };
|
|
2061
2128
|
//# sourceMappingURL=index.js.map
|
|
2062
2129
|
//# sourceMappingURL=index.js.map
|