@tscircuit/schematic-trace-solver 0.0.78 → 0.0.80
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 +5 -0
- package/dist/index.js +92 -23
- package/lib/solvers/Example28Solver/getMovedAnchorPointForReroute.ts +37 -0
- package/lib/solvers/Example28Solver/isLabelAttachedToTrace.ts +9 -0
- package/lib/solvers/Example28Solver/labelMovement.ts +2 -43
- package/lib/solvers/NetLabelTraceCollisionSolver/NetLabelTraceCollisionSolver.ts +87 -1
- package/package.json +1 -1
- package/site/examples/example46.page.tsx +4 -0
- package/site/examples/example47.page.tsx +4 -0
- package/site/examples/example48.page.tsx +4 -0
- package/site/examples/example49.page.tsx +4 -0
- package/tests/assets/example46.json +236 -0
- package/tests/assets/example47.json +206 -0
- package/tests/assets/example48.json +104 -0
- package/tests/assets/example49.json +390 -0
- package/tests/examples/__snapshots__/example46.snap.svg +343 -0
- package/tests/examples/__snapshots__/example47.snap.svg +324 -0
- package/tests/examples/__snapshots__/example48.snap.svg +168 -0
- package/tests/examples/__snapshots__/example49.snap.svg +566 -0
- package/tests/examples/example46.test.ts +12 -0
- package/tests/examples/example47.test.ts +12 -0
- package/tests/examples/example48.test.ts +12 -0
- package/tests/examples/example49.test.ts +12 -0
package/dist/index.d.ts
CHANGED
|
@@ -901,6 +901,11 @@ declare class NetLabelTraceCollisionSolver extends BaseSolver {
|
|
|
901
901
|
constructor(params: NetLabelTraceCollisionSolverParams);
|
|
902
902
|
getConstructorParams(): ConstructorParameters<typeof NetLabelTraceCollisionSolver>[0];
|
|
903
903
|
_step(): void;
|
|
904
|
+
/**
|
|
905
|
+
* When a trace is rerouted, net labels that were anchored on the old path
|
|
906
|
+
* can be left floating in space. Snap their anchor back onto the new path.
|
|
907
|
+
*/
|
|
908
|
+
private reanchorLabelsOnMovedTrace;
|
|
904
909
|
getOutput(): {
|
|
905
910
|
traces: SolvedTracePath[];
|
|
906
911
|
netLabelPlacements: NetLabelPlacement[];
|
package/dist/index.js
CHANGED
|
@@ -5314,6 +5314,33 @@ var segmentRunsAlongRectBoundary = (start, end, rect) => {
|
|
|
5314
5314
|
return false;
|
|
5315
5315
|
};
|
|
5316
5316
|
|
|
5317
|
+
// lib/solvers/Example28Solver/getMovedAnchorPointForReroute.ts
|
|
5318
|
+
var getMovedAnchorPointForReroute = (anchorPoint, originalTracePath, reroutedTracePath) => {
|
|
5319
|
+
const originalSegment = findSegmentContainingPoint(
|
|
5320
|
+
originalTracePath,
|
|
5321
|
+
anchorPoint
|
|
5322
|
+
);
|
|
5323
|
+
if (!originalSegment) return null;
|
|
5324
|
+
const preferredSegment = findPreferredReroutedSegment(
|
|
5325
|
+
reroutedTracePath,
|
|
5326
|
+
originalSegment.index,
|
|
5327
|
+
originalTracePath.length - 1,
|
|
5328
|
+
originalSegment.orientation,
|
|
5329
|
+
anchorPoint
|
|
5330
|
+
);
|
|
5331
|
+
if (!preferredSegment) {
|
|
5332
|
+
return projectPointToPath(anchorPoint, reroutedTracePath);
|
|
5333
|
+
}
|
|
5334
|
+
return projectPointToSegment(
|
|
5335
|
+
anchorPoint,
|
|
5336
|
+
preferredSegment.start,
|
|
5337
|
+
preferredSegment.end
|
|
5338
|
+
);
|
|
5339
|
+
};
|
|
5340
|
+
|
|
5341
|
+
// lib/solvers/Example28Solver/isLabelAttachedToTrace.ts
|
|
5342
|
+
var isLabelAttachedToTrace = (label, trace) => label.globalConnNetId === trace.globalConnNetId || label.mspConnectionPairIds.includes(trace.mspPairId);
|
|
5343
|
+
|
|
5317
5344
|
// lib/solvers/Example28Solver/labelMovement.ts
|
|
5318
5345
|
var moveAttachedLabelsToReroutedTrace = ({
|
|
5319
5346
|
trace,
|
|
@@ -5341,29 +5368,6 @@ var moveAttachedLabelsToReroutedTrace = ({
|
|
|
5341
5368
|
}
|
|
5342
5369
|
};
|
|
5343
5370
|
});
|
|
5344
|
-
var isLabelAttachedToTrace = (label, trace) => label.globalConnNetId === trace.globalConnNetId || label.mspConnectionPairIds.includes(trace.mspPairId);
|
|
5345
|
-
var getMovedAnchorPointForReroute = (anchorPoint, originalTracePath, reroutedTracePath) => {
|
|
5346
|
-
const originalSegment = findSegmentContainingPoint(
|
|
5347
|
-
originalTracePath,
|
|
5348
|
-
anchorPoint
|
|
5349
|
-
);
|
|
5350
|
-
if (!originalSegment) return null;
|
|
5351
|
-
const preferredSegment = findPreferredReroutedSegment(
|
|
5352
|
-
reroutedTracePath,
|
|
5353
|
-
originalSegment.index,
|
|
5354
|
-
originalTracePath.length - 1,
|
|
5355
|
-
originalSegment.orientation,
|
|
5356
|
-
anchorPoint
|
|
5357
|
-
);
|
|
5358
|
-
if (!preferredSegment) {
|
|
5359
|
-
return projectPointToPath(anchorPoint, reroutedTracePath);
|
|
5360
|
-
}
|
|
5361
|
-
return projectPointToSegment(
|
|
5362
|
-
anchorPoint,
|
|
5363
|
-
preferredSegment.start,
|
|
5364
|
-
preferredSegment.end
|
|
5365
|
-
);
|
|
5366
|
-
};
|
|
5367
5371
|
|
|
5368
5372
|
// lib/utils/dir.ts
|
|
5369
5373
|
var dir = (facingDirection) => {
|
|
@@ -7815,6 +7819,43 @@ var TraceAnchoredNetLabelOverlapSolver = class extends BaseSolver {
|
|
|
7815
7819
|
};
|
|
7816
7820
|
|
|
7817
7821
|
// lib/solvers/NetLabelTraceCollisionSolver/NetLabelTraceCollisionSolver.ts
|
|
7822
|
+
var ON_PATH_EPS = 1e-6;
|
|
7823
|
+
function getClosestPointOnSegment(params) {
|
|
7824
|
+
const { point, segmentStart, segmentEnd } = params;
|
|
7825
|
+
const dx = segmentEnd.x - segmentStart.x;
|
|
7826
|
+
const dy = segmentEnd.y - segmentStart.y;
|
|
7827
|
+
const segmentLengthSq = dx * dx + dy * dy;
|
|
7828
|
+
if (segmentLengthSq === 0) return { x: segmentStart.x, y: segmentStart.y };
|
|
7829
|
+
const projection = ((point.x - segmentStart.x) * dx + (point.y - segmentStart.y) * dy) / segmentLengthSq;
|
|
7830
|
+
const clampedProjection = Math.max(0, Math.min(1, projection));
|
|
7831
|
+
return {
|
|
7832
|
+
x: segmentStart.x + clampedProjection * dx,
|
|
7833
|
+
y: segmentStart.y + clampedProjection * dy
|
|
7834
|
+
};
|
|
7835
|
+
}
|
|
7836
|
+
function getClosestPointOnPath(point, path) {
|
|
7837
|
+
let closestPoint = path[0];
|
|
7838
|
+
let closestDistSq = Infinity;
|
|
7839
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
7840
|
+
const candidatePoint = getClosestPointOnSegment({
|
|
7841
|
+
point,
|
|
7842
|
+
segmentStart: path[i],
|
|
7843
|
+
segmentEnd: path[i + 1]
|
|
7844
|
+
});
|
|
7845
|
+
const dx = candidatePoint.x - point.x;
|
|
7846
|
+
const dy = candidatePoint.y - point.y;
|
|
7847
|
+
const candidateDistSq = dx * dx + dy * dy;
|
|
7848
|
+
if (candidateDistSq < closestDistSq) {
|
|
7849
|
+
closestDistSq = candidateDistSq;
|
|
7850
|
+
closestPoint = candidatePoint;
|
|
7851
|
+
}
|
|
7852
|
+
}
|
|
7853
|
+
return closestPoint;
|
|
7854
|
+
}
|
|
7855
|
+
function isPointOnPath(point, path) {
|
|
7856
|
+
const closestPoint = getClosestPointOnPath(point, path);
|
|
7857
|
+
return Math.hypot(closestPoint.x - point.x, closestPoint.y - point.y) < ON_PATH_EPS;
|
|
7858
|
+
}
|
|
7818
7859
|
function buildMergedObstacleLabel(seedLabel, allLabels) {
|
|
7819
7860
|
const TOUCH_MARGIN = 0.01;
|
|
7820
7861
|
const getBounds3 = (l) => getRectBounds(l.center, l.width, l.height);
|
|
@@ -7908,10 +7949,12 @@ var NetLabelTraceCollisionSolver = class extends BaseSolver {
|
|
|
7908
7949
|
(t) => t.mspPairId === this.activeSubSolver.initialTrace.mspPairId
|
|
7909
7950
|
);
|
|
7910
7951
|
if (idx !== -1) {
|
|
7952
|
+
const oldPath = this.outputTraces[idx].tracePath;
|
|
7911
7953
|
this.outputTraces[idx] = {
|
|
7912
7954
|
...this.outputTraces[idx],
|
|
7913
7955
|
tracePath: solvedPath
|
|
7914
7956
|
};
|
|
7957
|
+
this.reanchorLabelsOnMovedTrace(this.outputTraces[idx], oldPath);
|
|
7915
7958
|
}
|
|
7916
7959
|
}
|
|
7917
7960
|
this.activeSubSolver = null;
|
|
@@ -7966,6 +8009,32 @@ var NetLabelTraceCollisionSolver = class extends BaseSolver {
|
|
|
7966
8009
|
detourCount
|
|
7967
8010
|
});
|
|
7968
8011
|
}
|
|
8012
|
+
/**
|
|
8013
|
+
* When a trace is rerouted, net labels that were anchored on the old path
|
|
8014
|
+
* can be left floating in space. Snap their anchor back onto the new path.
|
|
8015
|
+
*/
|
|
8016
|
+
reanchorLabelsOnMovedTrace(movedTrace, oldPath) {
|
|
8017
|
+
for (let i = 0; i < this.outputNetLabelPlacements.length; i++) {
|
|
8018
|
+
const label = this.outputNetLabelPlacements[i];
|
|
8019
|
+
if (label.globalConnNetId !== movedTrace.globalConnNetId) continue;
|
|
8020
|
+
if (isPointOnPath(label.anchorPoint, movedTrace.tracePath)) continue;
|
|
8021
|
+
if (!isPointOnPath(label.anchorPoint, oldPath)) continue;
|
|
8022
|
+
const newAnchor = getClosestPointOnPath(
|
|
8023
|
+
label.anchorPoint,
|
|
8024
|
+
movedTrace.tracePath
|
|
8025
|
+
);
|
|
8026
|
+
this.outputNetLabelPlacements[i] = {
|
|
8027
|
+
...label,
|
|
8028
|
+
anchorPoint: newAnchor,
|
|
8029
|
+
center: getCenterFromAnchor(
|
|
8030
|
+
newAnchor,
|
|
8031
|
+
label.orientation,
|
|
8032
|
+
label.width,
|
|
8033
|
+
label.height
|
|
8034
|
+
)
|
|
8035
|
+
};
|
|
8036
|
+
}
|
|
8037
|
+
}
|
|
7969
8038
|
getOutput() {
|
|
7970
8039
|
return {
|
|
7971
8040
|
traces: this.outputTraces,
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Point } from "@tscircuit/math-utils"
|
|
2
|
+
import {
|
|
3
|
+
findPreferredReroutedSegment,
|
|
4
|
+
findSegmentContainingPoint,
|
|
5
|
+
projectPointToPath,
|
|
6
|
+
projectPointToSegment,
|
|
7
|
+
} from "./geometry"
|
|
8
|
+
|
|
9
|
+
export const getMovedAnchorPointForReroute = (
|
|
10
|
+
anchorPoint: Point,
|
|
11
|
+
originalTracePath: Point[],
|
|
12
|
+
reroutedTracePath: Point[],
|
|
13
|
+
) => {
|
|
14
|
+
const originalSegment = findSegmentContainingPoint(
|
|
15
|
+
originalTracePath,
|
|
16
|
+
anchorPoint,
|
|
17
|
+
)
|
|
18
|
+
if (!originalSegment) return null
|
|
19
|
+
|
|
20
|
+
const preferredSegment = findPreferredReroutedSegment(
|
|
21
|
+
reroutedTracePath,
|
|
22
|
+
originalSegment.index,
|
|
23
|
+
originalTracePath.length - 1,
|
|
24
|
+
originalSegment.orientation,
|
|
25
|
+
anchorPoint,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
if (!preferredSegment) {
|
|
29
|
+
return projectPointToPath(anchorPoint, reroutedTracePath)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return projectPointToSegment(
|
|
33
|
+
anchorPoint,
|
|
34
|
+
preferredSegment.start,
|
|
35
|
+
preferredSegment.end,
|
|
36
|
+
)
|
|
37
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { NetLabelPlacement } from "lib/solvers/NetLabelPlacementSolver/NetLabelPlacementSolver"
|
|
2
|
+
import type { SolvedTracePath } from "lib/solvers/SchematicTraceLinesSolver/SchematicTraceLinesSolver"
|
|
3
|
+
|
|
4
|
+
export const isLabelAttachedToTrace = (
|
|
5
|
+
label: NetLabelPlacement,
|
|
6
|
+
trace: SolvedTracePath,
|
|
7
|
+
) =>
|
|
8
|
+
label.globalConnNetId === trace.globalConnNetId ||
|
|
9
|
+
label.mspConnectionPairIds.includes(trace.mspPairId)
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import type { Point } from "@tscircuit/math-utils"
|
|
2
2
|
import type { NetLabelPlacement } from "lib/solvers/NetLabelPlacementSolver/NetLabelPlacementSolver"
|
|
3
3
|
import type { SolvedTracePath } from "lib/solvers/SchematicTraceLinesSolver/SchematicTraceLinesSolver"
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
findSegmentContainingPoint,
|
|
7
|
-
projectPointToPath,
|
|
8
|
-
projectPointToSegment,
|
|
9
|
-
} from "./geometry"
|
|
4
|
+
import { getMovedAnchorPointForReroute } from "./getMovedAnchorPointForReroute"
|
|
5
|
+
import { isLabelAttachedToTrace } from "./isLabelAttachedToTrace"
|
|
10
6
|
|
|
11
7
|
export const moveAttachedLabelsToReroutedTrace = ({
|
|
12
8
|
trace,
|
|
@@ -43,40 +39,3 @@ export const moveAttachedLabelsToReroutedTrace = ({
|
|
|
43
39
|
},
|
|
44
40
|
}
|
|
45
41
|
})
|
|
46
|
-
|
|
47
|
-
const isLabelAttachedToTrace = (
|
|
48
|
-
label: NetLabelPlacement,
|
|
49
|
-
trace: SolvedTracePath,
|
|
50
|
-
) =>
|
|
51
|
-
label.globalConnNetId === trace.globalConnNetId ||
|
|
52
|
-
label.mspConnectionPairIds.includes(trace.mspPairId)
|
|
53
|
-
|
|
54
|
-
const getMovedAnchorPointForReroute = (
|
|
55
|
-
anchorPoint: Point,
|
|
56
|
-
originalTracePath: Point[],
|
|
57
|
-
reroutedTracePath: Point[],
|
|
58
|
-
) => {
|
|
59
|
-
const originalSegment = findSegmentContainingPoint(
|
|
60
|
-
originalTracePath,
|
|
61
|
-
anchorPoint,
|
|
62
|
-
)
|
|
63
|
-
if (!originalSegment) return null
|
|
64
|
-
|
|
65
|
-
const preferredSegment = findPreferredReroutedSegment(
|
|
66
|
-
reroutedTracePath,
|
|
67
|
-
originalSegment.index,
|
|
68
|
-
originalTracePath.length - 1,
|
|
69
|
-
originalSegment.orientation,
|
|
70
|
-
anchorPoint,
|
|
71
|
-
)
|
|
72
|
-
|
|
73
|
-
if (!preferredSegment) {
|
|
74
|
-
return projectPointToPath(anchorPoint, reroutedTracePath)
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return projectPointToSegment(
|
|
78
|
-
anchorPoint,
|
|
79
|
-
preferredSegment.start,
|
|
80
|
-
preferredSegment.end,
|
|
81
|
-
)
|
|
82
|
-
}
|
|
@@ -1,14 +1,67 @@
|
|
|
1
|
+
import type { Point } from "@tscircuit/math-utils"
|
|
1
2
|
import type { GraphicsObject } from "graphics-debug"
|
|
2
3
|
import { BaseSolver } from "lib/solvers/BaseSolver/BaseSolver"
|
|
3
4
|
import type { NetLabelPlacement } from "lib/solvers/NetLabelPlacementSolver/NetLabelPlacementSolver"
|
|
4
5
|
import type { SolvedTracePath } from "lib/solvers/SchematicTraceLinesSolver/SchematicTraceLinesSolver"
|
|
5
6
|
import { visualizeInputProblem } from "lib/solvers/SchematicTracePipelineSolver/visualizeInputProblem"
|
|
6
7
|
import { SingleOverlapSolver } from "lib/solvers/TraceLabelOverlapAvoidanceSolver/sub-solvers/SingleOverlapSolver/SingleOverlapSolver"
|
|
7
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
getCenterFromAnchor,
|
|
10
|
+
getRectBounds,
|
|
11
|
+
} from "lib/solvers/NetLabelPlacementSolver/SingleNetLabelPlacementSolver/geometry"
|
|
8
12
|
import { segmentIntersectsRect } from "lib/solvers/NetLabelPlacementSolver/SingleNetLabelPlacementSolver/collisions"
|
|
9
13
|
import { getColorFromString } from "lib/utils/getColorFromString"
|
|
10
14
|
import type { InputProblem } from "lib/types/InputProblem"
|
|
11
15
|
|
|
16
|
+
const ON_PATH_EPS = 1e-6
|
|
17
|
+
|
|
18
|
+
function getClosestPointOnSegment(params: {
|
|
19
|
+
point: Point
|
|
20
|
+
segmentStart: Point
|
|
21
|
+
segmentEnd: Point
|
|
22
|
+
}): Point {
|
|
23
|
+
const { point, segmentStart, segmentEnd } = params
|
|
24
|
+
const dx = segmentEnd.x - segmentStart.x
|
|
25
|
+
const dy = segmentEnd.y - segmentStart.y
|
|
26
|
+
const segmentLengthSq = dx * dx + dy * dy
|
|
27
|
+
if (segmentLengthSq === 0) return { x: segmentStart.x, y: segmentStart.y }
|
|
28
|
+
const projection =
|
|
29
|
+
((point.x - segmentStart.x) * dx + (point.y - segmentStart.y) * dy) /
|
|
30
|
+
segmentLengthSq
|
|
31
|
+
const clampedProjection = Math.max(0, Math.min(1, projection))
|
|
32
|
+
return {
|
|
33
|
+
x: segmentStart.x + clampedProjection * dx,
|
|
34
|
+
y: segmentStart.y + clampedProjection * dy,
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function getClosestPointOnPath(point: Point, path: Point[]): Point {
|
|
39
|
+
let closestPoint: Point = path[0]!
|
|
40
|
+
let closestDistSq = Infinity
|
|
41
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
42
|
+
const candidatePoint = getClosestPointOnSegment({
|
|
43
|
+
point,
|
|
44
|
+
segmentStart: path[i]!,
|
|
45
|
+
segmentEnd: path[i + 1]!,
|
|
46
|
+
})
|
|
47
|
+
const dx = candidatePoint.x - point.x
|
|
48
|
+
const dy = candidatePoint.y - point.y
|
|
49
|
+
const candidateDistSq = dx * dx + dy * dy
|
|
50
|
+
if (candidateDistSq < closestDistSq) {
|
|
51
|
+
closestDistSq = candidateDistSq
|
|
52
|
+
closestPoint = candidatePoint
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return closestPoint
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function isPointOnPath(point: Point, path: Point[]): boolean {
|
|
59
|
+
const closestPoint = getClosestPointOnPath(point, path)
|
|
60
|
+
return (
|
|
61
|
+
Math.hypot(closestPoint.x - point.x, closestPoint.y - point.y) < ON_PATH_EPS
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
12
65
|
/**
|
|
13
66
|
* Merges all labels that touch/overlap with each other (transitively) around
|
|
14
67
|
* a seed label into a single bounding-box label. This prevents the situation
|
|
@@ -159,10 +212,12 @@ export class NetLabelTraceCollisionSolver extends BaseSolver {
|
|
|
159
212
|
(t) => t.mspPairId === this.activeSubSolver!.initialTrace.mspPairId,
|
|
160
213
|
)
|
|
161
214
|
if (idx !== -1) {
|
|
215
|
+
const oldPath = this.outputTraces[idx]!.tracePath
|
|
162
216
|
this.outputTraces[idx] = {
|
|
163
217
|
...this.outputTraces[idx],
|
|
164
218
|
tracePath: solvedPath,
|
|
165
219
|
}
|
|
220
|
+
this.reanchorLabelsOnMovedTrace(this.outputTraces[idx]!, oldPath)
|
|
166
221
|
}
|
|
167
222
|
}
|
|
168
223
|
this.activeSubSolver = null
|
|
@@ -229,6 +284,37 @@ export class NetLabelTraceCollisionSolver extends BaseSolver {
|
|
|
229
284
|
})
|
|
230
285
|
}
|
|
231
286
|
|
|
287
|
+
/**
|
|
288
|
+
* When a trace is rerouted, net labels that were anchored on the old path
|
|
289
|
+
* can be left floating in space. Snap their anchor back onto the new path.
|
|
290
|
+
*/
|
|
291
|
+
private reanchorLabelsOnMovedTrace(
|
|
292
|
+
movedTrace: SolvedTracePath,
|
|
293
|
+
oldPath: Point[],
|
|
294
|
+
) {
|
|
295
|
+
for (let i = 0; i < this.outputNetLabelPlacements.length; i++) {
|
|
296
|
+
const label = this.outputNetLabelPlacements[i]!
|
|
297
|
+
if (label.globalConnNetId !== movedTrace.globalConnNetId) continue
|
|
298
|
+
if (isPointOnPath(label.anchorPoint, movedTrace.tracePath)) continue
|
|
299
|
+
if (!isPointOnPath(label.anchorPoint, oldPath)) continue
|
|
300
|
+
|
|
301
|
+
const newAnchor = getClosestPointOnPath(
|
|
302
|
+
label.anchorPoint,
|
|
303
|
+
movedTrace.tracePath,
|
|
304
|
+
)
|
|
305
|
+
this.outputNetLabelPlacements[i] = {
|
|
306
|
+
...label,
|
|
307
|
+
anchorPoint: newAnchor,
|
|
308
|
+
center: getCenterFromAnchor(
|
|
309
|
+
newAnchor,
|
|
310
|
+
label.orientation,
|
|
311
|
+
label.width,
|
|
312
|
+
label.height,
|
|
313
|
+
),
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
232
318
|
getOutput() {
|
|
233
319
|
return {
|
|
234
320
|
traces: this.outputTraces,
|
package/package.json
CHANGED
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
{
|
|
2
|
+
"chips": [
|
|
3
|
+
{
|
|
4
|
+
"chipId": "schematic_component_0",
|
|
5
|
+
"center": {
|
|
6
|
+
"x": -2.71,
|
|
7
|
+
"y": 0.7199999999999998
|
|
8
|
+
},
|
|
9
|
+
"width": 0.8599999999999999,
|
|
10
|
+
"height": 1.04,
|
|
11
|
+
"pins": [
|
|
12
|
+
{
|
|
13
|
+
"pinId": "DPROT.1",
|
|
14
|
+
"x": -2.87,
|
|
15
|
+
"y": 1.2399999999999998
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"pinId": "DPROT.2",
|
|
19
|
+
"x": -2.87,
|
|
20
|
+
"y": 0.19999999999999973
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
"sectionId": "pwr"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"chipId": "schematic_component_1",
|
|
27
|
+
"center": {
|
|
28
|
+
"x": -3.25,
|
|
29
|
+
"y": 3.05
|
|
30
|
+
},
|
|
31
|
+
"width": 1.8800000000000003,
|
|
32
|
+
"height": 1.13,
|
|
33
|
+
"pins": [
|
|
34
|
+
{
|
|
35
|
+
"pinId": "F1.1",
|
|
36
|
+
"x": -2.87,
|
|
37
|
+
"y": 3.58
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"pinId": "F1.2",
|
|
41
|
+
"x": -2.87,
|
|
42
|
+
"y": 2.5199999999999996
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"sectionId": "pwr"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"chipId": "schematic_component_2",
|
|
49
|
+
"center": {
|
|
50
|
+
"x": 0,
|
|
51
|
+
"y": 0
|
|
52
|
+
},
|
|
53
|
+
"width": 1.77,
|
|
54
|
+
"height": 0.6,
|
|
55
|
+
"pins": [
|
|
56
|
+
{
|
|
57
|
+
"pinId": "U2.1",
|
|
58
|
+
"x": -1.2850000000000001,
|
|
59
|
+
"y": 0.2
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"pinId": "U2.2",
|
|
63
|
+
"x": -1.2850000000000001,
|
|
64
|
+
"y": 0
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"pinId": "U2.3",
|
|
68
|
+
"x": -1.2850000000000001,
|
|
69
|
+
"y": -0.2
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"pinId": "U2.4",
|
|
73
|
+
"x": 1.2850000000000001,
|
|
74
|
+
"y": -0.1
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"pinId": "U2.5",
|
|
78
|
+
"x": 1.2850000000000001,
|
|
79
|
+
"y": 0.1
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
"sectionId": "pwr"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"chipId": "schematic_component_3",
|
|
86
|
+
"center": {
|
|
87
|
+
"x": -2.755,
|
|
88
|
+
"y": -1.56
|
|
89
|
+
},
|
|
90
|
+
"width": 0.9600000000000004,
|
|
91
|
+
"height": 1.1000000000000003,
|
|
92
|
+
"pins": [
|
|
93
|
+
{
|
|
94
|
+
"pinId": "C1.1",
|
|
95
|
+
"x": -2.97,
|
|
96
|
+
"y": -1.01
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"pinId": "C1.2",
|
|
100
|
+
"x": -2.97,
|
|
101
|
+
"y": -2.1100000000000003
|
|
102
|
+
}
|
|
103
|
+
],
|
|
104
|
+
"sectionId": "pwr"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"chipId": "schematic_component_4",
|
|
108
|
+
"center": {
|
|
109
|
+
"x": -0.5950000000000002,
|
|
110
|
+
"y": -2.4550000000000005
|
|
111
|
+
},
|
|
112
|
+
"width": 0.9599999999999999,
|
|
113
|
+
"height": 1.1000000000000003,
|
|
114
|
+
"pins": [
|
|
115
|
+
{
|
|
116
|
+
"pinId": "C4.1",
|
|
117
|
+
"x": -0.8100000000000003,
|
|
118
|
+
"y": -1.9050000000000005
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"pinId": "C4.2",
|
|
122
|
+
"x": -0.8100000000000003,
|
|
123
|
+
"y": -3.005000000000001
|
|
124
|
+
}
|
|
125
|
+
],
|
|
126
|
+
"sectionId": "pwr"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"chipId": "schematic_component_5",
|
|
130
|
+
"center": {
|
|
131
|
+
"x": 2.9724999999999997,
|
|
132
|
+
"y": -1.8699999999999997
|
|
133
|
+
},
|
|
134
|
+
"width": 1.245,
|
|
135
|
+
"height": 1.13,
|
|
136
|
+
"pins": [
|
|
137
|
+
{
|
|
138
|
+
"pinId": "DPWR.1",
|
|
139
|
+
"x": 2.675,
|
|
140
|
+
"y": -1.3299999999999996
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"pinId": "DPWR.2",
|
|
144
|
+
"x": 2.675,
|
|
145
|
+
"y": -2.4099999999999997
|
|
146
|
+
}
|
|
147
|
+
],
|
|
148
|
+
"sectionId": "pwr"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"chipId": "schematic_component_6",
|
|
152
|
+
"center": {
|
|
153
|
+
"x": 1.5519553499999992,
|
|
154
|
+
"y": -4.1899999999999995
|
|
155
|
+
},
|
|
156
|
+
"width": 0.9739106999999991,
|
|
157
|
+
"height": 1.0999999999999996,
|
|
158
|
+
"pins": [
|
|
159
|
+
{
|
|
160
|
+
"pinId": "R1.1",
|
|
161
|
+
"x": 1.2594553499999992,
|
|
162
|
+
"y": -3.6399999999999997
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"pinId": "R1.2",
|
|
166
|
+
"x": 1.2594553499999992,
|
|
167
|
+
"y": -4.739999999999999
|
|
168
|
+
}
|
|
169
|
+
],
|
|
170
|
+
"sectionId": "pwr"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"chipId": "schematic_component_7",
|
|
174
|
+
"center": {
|
|
175
|
+
"x": -0.5950000000000001,
|
|
176
|
+
"y": -4.765000000000001
|
|
177
|
+
},
|
|
178
|
+
"width": 0.8400000000000001,
|
|
179
|
+
"height": 1.0999999999999996,
|
|
180
|
+
"pins": [
|
|
181
|
+
{
|
|
182
|
+
"pinId": "C18.1",
|
|
183
|
+
"x": -0.75,
|
|
184
|
+
"y": -4.215000000000001
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"pinId": "C18.2",
|
|
188
|
+
"x": -0.75,
|
|
189
|
+
"y": -5.315
|
|
190
|
+
}
|
|
191
|
+
],
|
|
192
|
+
"sectionId": "pwr"
|
|
193
|
+
}
|
|
194
|
+
],
|
|
195
|
+
"directConnections": [
|
|
196
|
+
{
|
|
197
|
+
"pinIds": ["F1.2", "DPROT.1"],
|
|
198
|
+
"netId": ".F1 > .pin2 to .DPROT > .anode"
|
|
199
|
+
}
|
|
200
|
+
],
|
|
201
|
+
"netConnections": [
|
|
202
|
+
{
|
|
203
|
+
"netId": "VBUS",
|
|
204
|
+
"pinIds": ["DPROT.1", "F1.1", "F1.2"],
|
|
205
|
+
"netLabelWidth": 0.6
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"netId": "RAW",
|
|
209
|
+
"pinIds": ["DPROT.2", "U2.1", "U2.3", "C1.1"],
|
|
210
|
+
"netLabelWidth": 0.48
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"netId": "GND",
|
|
214
|
+
"pinIds": ["U2.2", "C1.2", "C4.2", "R1.2", "C18.2"],
|
|
215
|
+
"netLabelWidth": 0.48
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
"netId": "V3V3",
|
|
219
|
+
"pinIds": ["U2.5", "C4.1", "DPWR.1", "C18.1"],
|
|
220
|
+
"netLabelWidth": 0.6
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"netId": "PWR_LED_K",
|
|
224
|
+
"pinIds": ["DPWR.2", "R1.1"],
|
|
225
|
+
"netLabelWidth": 1.2
|
|
226
|
+
}
|
|
227
|
+
],
|
|
228
|
+
"availableNetLabelOrientations": {
|
|
229
|
+
"VBUS": ["y+"],
|
|
230
|
+
"RAW": ["x-", "x+", "y+", "y-"],
|
|
231
|
+
"V3V3": ["y+"],
|
|
232
|
+
"GND": ["y-"],
|
|
233
|
+
"PWR_LED_K": ["x-", "x+", "y+", "y-"]
|
|
234
|
+
},
|
|
235
|
+
"maxMspPairDistance": 2.4
|
|
236
|
+
}
|