@tscircuit/schematic-trace-solver 0.0.14 → 0.0.15
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.d.ts +13 -0
- package/dist/index.js +12 -1
- package/lib/solvers/NetLabelPlacementSolver/NetLabelPlacementSolver.ts +14 -1
- package/lib/solvers/NetLabelPlacementSolver/SingleNetLabelPlacementSolver/SingleNetLabelPlacementSolver.ts +11 -1
- package/lib/solvers/NetLabelPlacementSolver/SingleNetLabelPlacementSolver/solvePortOnlyPin.ts +3 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -347,6 +347,19 @@ type OverlappingSameNetTraceGroup = {
|
|
|
347
347
|
interface NetLabelPlacement {
|
|
348
348
|
globalConnNetId: string;
|
|
349
349
|
dcConnNetId?: string;
|
|
350
|
+
/**
|
|
351
|
+
* Optional user-provided net identifier (if present in the input problem).
|
|
352
|
+
*/
|
|
353
|
+
netId?: string;
|
|
354
|
+
/**
|
|
355
|
+
* MSP pair ids that the label is associated with. Port-only labels use [].
|
|
356
|
+
*/
|
|
357
|
+
mspConnectionPairIds: MspConnectionPairId[];
|
|
358
|
+
/**
|
|
359
|
+
* Pin ids relevant to this label. For a host trace, the two pins of that pair;
|
|
360
|
+
* for a port-only label, the single port pin id.
|
|
361
|
+
*/
|
|
362
|
+
pinIds: PinId[];
|
|
350
363
|
orientation: FacingDirection;
|
|
351
364
|
/**
|
|
352
365
|
* The anchor point is the point on the trace where the net label connects
|
package/dist/index.js
CHANGED
|
@@ -7431,6 +7431,9 @@ function solveNetLabelPlacementForPortOnlyPin(params) {
|
|
|
7431
7431
|
const placement = {
|
|
7432
7432
|
globalConnNetId: overlappingSameNetTraceGroup.globalConnNetId,
|
|
7433
7433
|
dcConnNetId: void 0,
|
|
7434
|
+
netId: overlappingSameNetTraceGroup.netId,
|
|
7435
|
+
mspConnectionPairIds: [],
|
|
7436
|
+
pinIds: [pinId],
|
|
7434
7437
|
orientation,
|
|
7435
7438
|
anchorPoint: anchor,
|
|
7436
7439
|
width,
|
|
@@ -7664,7 +7667,9 @@ var SingleNetLabelPlacementSolver = class extends BaseSolver {
|
|
|
7664
7667
|
height,
|
|
7665
7668
|
center,
|
|
7666
7669
|
hostSegIndex: si,
|
|
7667
|
-
dcConnNetId: curr.dcConnNetId
|
|
7670
|
+
dcConnNetId: curr.dcConnNetId,
|
|
7671
|
+
mspPairId: curr.mspPairId,
|
|
7672
|
+
pinIds: [curr.pins[0].pinId, curr.pins[1].pinId]
|
|
7668
7673
|
};
|
|
7669
7674
|
}
|
|
7670
7675
|
continue;
|
|
@@ -7672,6 +7677,9 @@ var SingleNetLabelPlacementSolver = class extends BaseSolver {
|
|
|
7672
7677
|
this.netLabelPlacement = {
|
|
7673
7678
|
globalConnNetId: this.overlappingSameNetTraceGroup.globalConnNetId,
|
|
7674
7679
|
dcConnNetId: curr.dcConnNetId,
|
|
7680
|
+
netId: this.overlappingSameNetTraceGroup.netId,
|
|
7681
|
+
mspConnectionPairIds: [curr.mspPairId],
|
|
7682
|
+
pinIds: [curr.pins[0].pinId, curr.pins[1].pinId],
|
|
7675
7683
|
orientation,
|
|
7676
7684
|
anchorPoint: anchor,
|
|
7677
7685
|
width,
|
|
@@ -7688,6 +7696,9 @@ var SingleNetLabelPlacementSolver = class extends BaseSolver {
|
|
|
7688
7696
|
this.netLabelPlacement = {
|
|
7689
7697
|
globalConnNetId: this.overlappingSameNetTraceGroup.globalConnNetId,
|
|
7690
7698
|
dcConnNetId: bestCandidate.dcConnNetId,
|
|
7699
|
+
netId: this.overlappingSameNetTraceGroup.netId,
|
|
7700
|
+
mspConnectionPairIds: [bestCandidate.mspPairId],
|
|
7701
|
+
pinIds: bestCandidate.pinIds,
|
|
7691
7702
|
orientation: bestCandidate.orientation,
|
|
7692
7703
|
anchorPoint: bestCandidate.anchor,
|
|
7693
7704
|
width: bestCandidate.width,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseSolver } from "lib/solvers/BaseSolver/BaseSolver"
|
|
2
|
-
import type { InputProblem } from "lib/types/InputProblem"
|
|
2
|
+
import type { InputProblem, PinId } from "lib/types/InputProblem"
|
|
3
3
|
import type { SolvedTracePath } from "../SchematicTraceLinesSolver/SchematicTraceLinesSolver"
|
|
4
4
|
import type { MspConnectionPairId } from "../MspConnectionPairSolver/MspConnectionPairSolver"
|
|
5
5
|
import { SingleNetLabelPlacementSolver } from "./SingleNetLabelPlacementSolver/SingleNetLabelPlacementSolver"
|
|
@@ -24,6 +24,19 @@ export type OverlappingSameNetTraceGroup = {
|
|
|
24
24
|
export interface NetLabelPlacement {
|
|
25
25
|
globalConnNetId: string
|
|
26
26
|
dcConnNetId?: string
|
|
27
|
+
/**
|
|
28
|
+
* Optional user-provided net identifier (if present in the input problem).
|
|
29
|
+
*/
|
|
30
|
+
netId?: string
|
|
31
|
+
/**
|
|
32
|
+
* MSP pair ids that the label is associated with. Port-only labels use [].
|
|
33
|
+
*/
|
|
34
|
+
mspConnectionPairIds: MspConnectionPairId[]
|
|
35
|
+
/**
|
|
36
|
+
* Pin ids relevant to this label. For a host trace, the two pins of that pair;
|
|
37
|
+
* for a port-only label, the single port pin id.
|
|
38
|
+
*/
|
|
39
|
+
pinIds: PinId[]
|
|
27
40
|
orientation: FacingDirection
|
|
28
41
|
|
|
29
42
|
/**
|
|
@@ -3,7 +3,7 @@ import type {
|
|
|
3
3
|
NetLabelPlacement,
|
|
4
4
|
OverlappingSameNetTraceGroup,
|
|
5
5
|
} from "../NetLabelPlacementSolver"
|
|
6
|
-
import type { InputProblem } from "lib/types/InputProblem"
|
|
6
|
+
import type { InputProblem, PinId } from "lib/types/InputProblem"
|
|
7
7
|
import type { SolvedTracePath } from "lib/solvers/SchematicTraceLinesSolver/SchematicTraceLinesSolver"
|
|
8
8
|
import type { MspConnectionPairId } from "lib/solvers/MspConnectionPairSolver/MspConnectionPairSolver"
|
|
9
9
|
import type { FacingDirection } from "lib/utils/dir"
|
|
@@ -172,6 +172,8 @@ export class SingleNetLabelPlacementSolver extends BaseSolver {
|
|
|
172
172
|
center: { x: number; y: number }
|
|
173
173
|
hostSegIndex: number
|
|
174
174
|
dcConnNetId: string
|
|
175
|
+
mspPairId: MspConnectionPairId
|
|
176
|
+
pinIds: PinId[]
|
|
175
177
|
} | null = null
|
|
176
178
|
let bestScore = -Infinity
|
|
177
179
|
|
|
@@ -285,6 +287,8 @@ export class SingleNetLabelPlacementSolver extends BaseSolver {
|
|
|
285
287
|
center,
|
|
286
288
|
hostSegIndex: si,
|
|
287
289
|
dcConnNetId: curr.dcConnNetId,
|
|
290
|
+
mspPairId: curr.mspPairId,
|
|
291
|
+
pinIds: [curr.pins[0].pinId, curr.pins[1].pinId],
|
|
288
292
|
}
|
|
289
293
|
}
|
|
290
294
|
// Continue traversing to prioritize the furthest valid point
|
|
@@ -295,6 +299,9 @@ export class SingleNetLabelPlacementSolver extends BaseSolver {
|
|
|
295
299
|
globalConnNetId:
|
|
296
300
|
this.overlappingSameNetTraceGroup.globalConnNetId,
|
|
297
301
|
dcConnNetId: curr.dcConnNetId,
|
|
302
|
+
netId: this.overlappingSameNetTraceGroup.netId,
|
|
303
|
+
mspConnectionPairIds: [curr.mspPairId],
|
|
304
|
+
pinIds: [curr.pins[0].pinId, curr.pins[1].pinId],
|
|
298
305
|
orientation,
|
|
299
306
|
anchorPoint: anchor,
|
|
300
307
|
width,
|
|
@@ -312,6 +319,9 @@ export class SingleNetLabelPlacementSolver extends BaseSolver {
|
|
|
312
319
|
this.netLabelPlacement = {
|
|
313
320
|
globalConnNetId: this.overlappingSameNetTraceGroup.globalConnNetId,
|
|
314
321
|
dcConnNetId: bestCandidate.dcConnNetId,
|
|
322
|
+
netId: this.overlappingSameNetTraceGroup.netId,
|
|
323
|
+
mspConnectionPairIds: [bestCandidate.mspPairId],
|
|
324
|
+
pinIds: bestCandidate.pinIds,
|
|
315
325
|
orientation: bestCandidate.orientation,
|
|
316
326
|
anchorPoint: bestCandidate.anchor,
|
|
317
327
|
width: bestCandidate.width,
|
package/lib/solvers/NetLabelPlacementSolver/SingleNetLabelPlacementSolver/solvePortOnlyPin.ts
CHANGED
|
@@ -159,6 +159,9 @@ export function solveNetLabelPlacementForPortOnlyPin(params: {
|
|
|
159
159
|
const placement: NetLabelPlacement = {
|
|
160
160
|
globalConnNetId: overlappingSameNetTraceGroup.globalConnNetId,
|
|
161
161
|
dcConnNetId: undefined,
|
|
162
|
+
netId: overlappingSameNetTraceGroup.netId,
|
|
163
|
+
mspConnectionPairIds: [],
|
|
164
|
+
pinIds: [pinId],
|
|
162
165
|
orientation,
|
|
163
166
|
anchorPoint: anchor,
|
|
164
167
|
width,
|