@willcgage/module-schematic 0.63.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 +51 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +58 -1
- package/dist/index.d.ts +58 -1
- package/dist/index.js +50 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1383,6 +1383,63 @@ declare function frogNumberFromName(name: string | undefined): number | undefine
|
|
|
1383
1383
|
* land as `unverified`, because a community CAD file is not a measurement.
|
|
1384
1384
|
*/
|
|
1385
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[];
|
|
1386
1443
|
/**
|
|
1387
1444
|
* Fold imported parts into a library.
|
|
1388
1445
|
*
|
|
@@ -1673,4 +1730,4 @@ declare function poseOverridesFromDoc(doc: ModuleSchematicDoc): Record<string, {
|
|
|
1673
1730
|
heading: number;
|
|
1674
1731
|
}>;
|
|
1675
1732
|
|
|
1676
|
-
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, 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, 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, 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
|
@@ -1383,6 +1383,63 @@ declare function frogNumberFromName(name: string | undefined): number | undefine
|
|
|
1383
1383
|
* land as `unverified`, because a community CAD file is not a measurement.
|
|
1384
1384
|
*/
|
|
1385
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[];
|
|
1386
1443
|
/**
|
|
1387
1444
|
* Fold imported parts into a library.
|
|
1388
1445
|
*
|
|
@@ -1673,4 +1730,4 @@ declare function poseOverridesFromDoc(doc: ModuleSchematicDoc): Record<string, {
|
|
|
1673
1730
|
heading: number;
|
|
1674
1731
|
}>;
|
|
1675
1732
|
|
|
1676
|
-
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, 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, 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, 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
|
@@ -1403,6 +1403,55 @@ function importedPartToTrackPart(part, sourceName = "imported .xtp") {
|
|
|
1403
1403
|
}
|
|
1404
1404
|
return out;
|
|
1405
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
|
+
}
|
|
1406
1455
|
function mergeImportedParts(imported, library = BUILT_IN_TRACK_PARTS, sourceName = "imported .xtp") {
|
|
1407
1456
|
const out = library.map((p) => ({ ...p }));
|
|
1408
1457
|
const numbersOf = (p) => [p.partNumbers?.left, p.partNumbers?.right, p.partNumbers?.single].filter(Boolean).map((s) => s.trim().toLowerCase());
|
|
@@ -2075,6 +2124,6 @@ function poseOverridesFromDoc(doc) {
|
|
|
2075
2124
|
return out;
|
|
2076
2125
|
}
|
|
2077
2126
|
|
|
2078
|
-
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, 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, 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 };
|
|
2079
2128
|
//# sourceMappingURL=index.js.map
|
|
2080
2129
|
//# sourceMappingURL=index.js.map
|