@@ -62,7 +62,88 @@ export class MultipleHighDensityRouteStitchSolver extends BaseSolver {
6262 } )
6363 }
6464
65- // visualize(): GraphicsObject {
65+ visualize ( ) : GraphicsObject {
66+ const graphics : GraphicsObject = {
67+ points : [ ] ,
68+ lines : [ ] ,
69+ circles : [ ] ,
70+ title : "Multiple High Density Route Stitch Solver" ,
71+ }
72+
73+ // Visualize the active solver if one exists
74+ if ( this . activeSolver ) {
75+ // Combine visualizations from the active solver
76+ const activeSolverGraphics = this . activeSolver . visualize ( )
77+
78+ // Merge points
79+ if ( activeSolverGraphics . points ?. length ) {
80+ graphics . points ?. push ( ...activeSolverGraphics . points )
81+ }
6682
67- // }
83+ // Merge lines
84+ if ( activeSolverGraphics . lines ?. length ) {
85+ graphics . lines ?. push ( ...activeSolverGraphics . lines )
86+ }
87+
88+ // Merge circles
89+ if ( activeSolverGraphics . circles ?. length ) {
90+ graphics . circles ?. push ( ...activeSolverGraphics . circles )
91+ }
92+
93+ // Merge rects if they exist
94+ if ( activeSolverGraphics . rects ?. length ) {
95+ graphics . rects = activeSolverGraphics . rects
96+ }
97+ }
98+
99+ // Visualize all remaining unsolved routes - start/end points only
100+ for ( const unsolvedRoute of this . unsolvedRoutes ) {
101+ // Add start and end points for unsolved connections
102+ graphics . points ?. push (
103+ {
104+ x : unsolvedRoute . start . x ,
105+ y : unsolvedRoute . start . y ,
106+ color : "lightgreen" ,
107+ label : `${ unsolvedRoute . connectionName } Start` ,
108+ } ,
109+ {
110+ x : unsolvedRoute . end . x ,
111+ y : unsolvedRoute . end . y ,
112+ color : "pink" ,
113+ label : `${ unsolvedRoute . connectionName } End` ,
114+ } ,
115+ )
116+
117+ // Add a light dashed line between start and end to show pending connections
118+ graphics . lines ?. push ( {
119+ points : [
120+ { x : unsolvedRoute . start . x , y : unsolvedRoute . start . y } ,
121+ { x : unsolvedRoute . end . x , y : unsolvedRoute . end . y } ,
122+ ] ,
123+ strokeColor : "gray" ,
124+ } )
125+
126+ // Visualize HD routes associated with unsolved routes (faded)
127+ for ( const hdRoute of unsolvedRoute . hdRoutes ) {
128+ if ( hdRoute . route . length > 1 ) {
129+ graphics . lines ?. push ( {
130+ points : hdRoute . route . map ( ( point ) => ( { x : point . x , y : point . y } ) ) ,
131+ strokeColor : "lightblue" ,
132+ } )
133+ }
134+
135+ // Visualize vias
136+ for ( const via of hdRoute . vias ) {
137+ graphics . circles ?. push ( {
138+ center : { x : via . x , y : via . y } ,
139+ radius : hdRoute . viaDiameter / 2 ,
140+ fill : "lavender" ,
141+ stroke : "lavender" ,
142+ } )
143+ }
144+ }
145+ }
146+
147+ return graphics
148+ }
68149}
0 commit comments