~ubuntu-branches/ubuntu/jaunty/electric/jaunty

« back to all changes in this revision

Viewing changes to com/sun/electric/tool/routing/AutoStitch.java

  • Committer: Bazaar Package Importer
  • Author(s): Onkar Shinde
  • Date: 2009-01-08 02:05:08 UTC
  • mfrom: (1.1.2 upstream) (3.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20090108020508-0h3li7zt9mu5gf0i
Tags: 8.08-1
New upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
import com.sun.electric.database.topology.NodeInst;
48
48
import com.sun.electric.database.topology.PortInst;
49
49
import com.sun.electric.database.topology.RTBounds;
 
50
import com.sun.electric.database.topology.RTNode;
50
51
import com.sun.electric.database.variable.EditWindow_;
51
52
import com.sun.electric.database.variable.ElectricObject;
52
53
import com.sun.electric.database.variable.UserInterface;
184
185
                        Rectangle2D limitBound = null;
185
186
                        if (lX != hX && lY != hY)
186
187
                                limitBound = new Rectangle2D.Double(lX, lY, hX-lX, hY-lY);
187
 
                        runAutoStitch(cell, nodesToStitch, arcsToStitch, null, limitBound, forced, Routing.isAutoStitchCreateExports(), false);
 
188
                        runAutoStitch(cell, nodesToStitch, arcsToStitch, this, null, limitBound, forced, Routing.isAutoStitchCreateExports(), false);
188
189
                        return true;
189
190
                }
190
191
        }
200
201
         * @param createExports true to create exports in subcells where necessary.
201
202
         * @param showProgress true to show progress.
202
203
         */
203
 
        public static void runAutoStitch(Cell cell, List<NodeInst> nodesToStitch, List<ArcInst> arcsToStitch,
 
204
        public static void runAutoStitch(Cell cell, List<NodeInst> nodesToStitch, List<ArcInst> arcsToStitch, Job job,
204
205
                PolyMerge stayInside, Rectangle2D limitBound, boolean forced, boolean createExports, boolean showProgress)
205
206
        {
 
207
                // initialization
 
208
                if (cell.isAllLocked())
 
209
                {
 
210
                        System.out.println("WARNING: Cell " + cell.describe(false) + " is locked: no changes can be made");
 
211
                        return;
 
212
                }
 
213
 
206
214
                AutoStitch as = new AutoStitch();
207
 
                as.runNow(cell, nodesToStitch, arcsToStitch, stayInside, limitBound, forced, createExports, showProgress);
 
215
                as.runNow(cell, nodesToStitch, arcsToStitch, job, stayInside, limitBound, forced, createExports, showProgress);
208
216
        }
209
217
 
210
218
        private AutoStitch()
217
225
         * @param cell the cell in which to stitch.
218
226
         * @param nodesToStitch a list of NodeInsts to stitch (null to use all in the cell).
219
227
         * @param arcsToStitch a list of ArcInsts to stitch (null to use all in the cell).
 
228
         * @param job the Job running this, for aborting.
220
229
         * @param stayInside is the area in which to route (null to route arbitrarily).
221
230
         * @param limitBound if not null, only consider connections that occur in this area.
222
231
         * @param forced true if the stitching was explicitly requested (and so results should be printed).
223
232
         * @param createExports true to create exports in subcells where necessary.
224
233
         * @param showProgress true to show progress.
225
234
         */
226
 
        private void runNow(Cell cell, List<NodeInst> nodesToStitch, List<ArcInst> arcsToStitch,
 
235
        private void runNow(Cell cell, List<NodeInst> nodesToStitch, List<ArcInst> arcsToStitch, Job job,
227
236
                PolyMerge stayInside, Rectangle2D limitBound, boolean forced, boolean createExports, boolean showProgress)
228
237
        {
229
 
                // initialization
230
 
                if (cell.isAllLocked())
231
 
                {
232
 
                        System.out.println("WARNING: Cell " + cell.describe(false) + " is locked: no changes can be made");
233
 
                        return;
234
 
                }
235
238
                if (showProgress) Job.getUserInterface().setProgressNote("Initializing routing");
236
239
                ArcProto preferredArc = Routing.getPreferredRoutingArcProto();
237
240
 
253
256
                                nodesToStitch.add(ni);
254
257
                        }
255
258
                }
 
259
 
256
260
                if (arcsToStitch == null)
257
261
                {
258
262
                        arcsToStitch = new ArrayList<ArcInst>();
270
274
 
271
275
                // compute the number of tasks to perform and start progress bar
272
276
                int totalToStitch = nodesToStitch.size() + arcsToStitch.size();
 
277
                if (createExports) totalToStitch *= 2;
 
278
                totalToStitch += arcsToStitch.size();
 
279
                int soFar = 0;
 
280
 
 
281
                if (job != null && job.checkAbort()) return;
273
282
 
274
283
                // if creating exports, make first pass in which exports must be created
275
284
                if (createExports)
276
285
                {
277
 
                        int soFar = 0;
278
286
                        if (showProgress) Job.getUserInterface().setProgressNote("Routing " + totalToStitch + " objects with export creation...");
279
287
 
280
288
                        // run through the nodeinsts to be checked for export-creation stitching
282
290
                        {
283
291
                                soFar++;
284
292
                                if (showProgress && (soFar%100) == 0)
 
293
                                {
 
294
                                        if (job != null && job.checkAbort()) return;
285
295
                                        Job.getUserInterface().setProgressValue(soFar * 100 / totalToStitch);
 
296
                                }
286
297
                                checkExportCreationStitching(ni);
287
298
                        }
288
299
 
291
302
                        {
292
303
                                soFar++;
293
304
                                if (showProgress && (soFar%100) == 0)
 
305
                                {
 
306
                                        if (job != null && job.checkAbort()) return;
294
307
                                        Job.getUserInterface().setProgressValue(soFar * 100 / totalToStitch);
 
308
                                }
295
309
 
296
310
                                // only interested in arcs that are wider than their nodes (and have geometry that sticks out)
297
311
                                if (!arcTooWide(ai)) continue;
358
372
                // get the topology object for knowing what is connected
359
373
                Topology top = new Topology(cell);
360
374
 
361
 
                int soFar = 0;
362
375
                if (showProgress) Job.getUserInterface().setProgressNote("Routing " + totalToStitch + " objects...");
363
376
 
 
377
                // first check for arcs that daisy-chain many nodes
 
378
                for(ArcInst ai : arcsToStitch)
 
379
                {
 
380
                        soFar++;
 
381
                        if (showProgress && (soFar%100) == 0)
 
382
                        {
 
383
                                if (job != null && job.checkAbort()) return;
 
384
                                Job.getUserInterface().setProgressValue(soFar * 100 / totalToStitch);
 
385
                        }
 
386
                        checkDaisyChain(ai, nodePortBounds, stayInside, top);
 
387
                }
 
388
                if (allRoutes.size() > 0)
 
389
                {
 
390
                        // found daisy-chain elements: do them now
 
391
                        System.out.println("Auto-routing detected " + allRoutes.size() + " daisy-chained arcs");
 
392
                        for(Route route : allRoutes)
 
393
                        {
 
394
                                Router.createRouteNoJob(route, cell, false, arcsCreatedMap, nodesCreatedMap);
 
395
                        }
 
396
 
 
397
                        // reset for the rest of the analysis
 
398
                        allRoutes = new ArrayList<Route>();
 
399
                        top = new Topology(cell);
 
400
                }
 
401
 
364
402
                // now run through the nodeinsts to be checked for stitching
365
403
                for(NodeInst ni : nodesToStitch)
366
404
                {
367
405
                        soFar++;
368
406
                        if (showProgress && (soFar%100) == 0)
 
407
                        {
 
408
                                if (job != null && job.checkAbort()) return;
369
409
                                Job.getUserInterface().setProgressValue(soFar * 100 / totalToStitch);
 
410
                        }
370
411
                        checkStitching(ni, nodeBounds, nodePortBounds, arcLayers, stayInside, top, limitBound, preferredArc);
371
412
                }
372
413
 
375
416
                {
376
417
                        soFar++;
377
418
                        if (showProgress && (soFar%100) == 0)
 
419
                        {
 
420
                                if (job != null && job.checkAbort()) return;
378
421
                                Job.getUserInterface().setProgressValue(soFar * 100 / totalToStitch);
 
422
                        }
379
423
 
380
424
                        if (!ai.isLinked()) continue;
381
425
 
393
437
                // check for any inline pins due to created wires
394
438
                if (showProgress)
395
439
                {
 
440
                        if (job != null && job.checkAbort()) return;
396
441
                        Job.getUserInterface().setProgressValue(0);
397
442
                        Job.getUserInterface().setProgressNote("Cleaning up pins...");
398
443
                }
410
455
                }
411
456
                if (pinsToPassThrough.size() > 0)
412
457
                {
413
 
                        CircuitChangeJobs.CleanupChanges job = new CircuitChangeJobs.CleanupChanges(cell, true, Collections.<NodeInst>emptySet(),
 
458
                        CircuitChangeJobs.CleanupChanges ccJob = new CircuitChangeJobs.CleanupChanges(cell, true, Collections.<NodeInst>emptySet(),
414
459
                                pinsToPassThrough, new HashMap<NodeInst,EPoint>(), new ArrayList<NodeInst>(), new HashSet<ArcInst>(), 0, 0, 0);
415
460
                        try
416
461
                        {
417
 
                                job.doIt();
 
462
                                ccJob.doIt();
418
463
                        } catch (JobException e)
419
464
                        {
420
465
                        }
469
514
                }
470
515
        }
471
516
 
 
517
        /****************************************** ARCS THAT DAISY-CHAIN ******************************************/
 
518
 
 
519
        private static class DaisyChainPoint
 
520
        {
 
521
                PortInst pi;
 
522
                EPoint location;
 
523
 
 
524
                DaisyChainPoint(PortInst p, Point2D loc)
 
525
                {
 
526
                        pi = p;
 
527
                        location = new EPoint(loc.getX(), loc.getY());
 
528
                }
 
529
        }
 
530
 
 
531
        /**
 
532
         * Class to sort DaisyChainPoints.
 
533
         */
 
534
        private static class SortDaisyPoints implements Comparator<DaisyChainPoint>
 
535
        {
 
536
                public int compare(DaisyChainPoint dcp1, DaisyChainPoint dcp2)
 
537
                {
 
538
                        if (dcp1.location.getX() < dcp2.location.getX()) return 1;
 
539
                        if (dcp1.location.getX() > dcp2.location.getX()) return -1;
 
540
                        if (dcp1.location.getY() < dcp2.location.getY()) return 1;
 
541
                        if (dcp1.location.getY() > dcp2.location.getY()) return -1;
 
542
                        return 0;
 
543
                }
 
544
        }
 
545
 
 
546
        /**
 
547
         * Method to see if an ArcInst daisy-chains over multiple ports.
 
548
         * @param ai the ArcInst in question.
 
549
         * @param nodePortBounds quad-tree bounds information for all nodes in the Cell.
 
550
         * @param stayInside is the area in which to route (null to route arbitrarily).
 
551
         * @param top network information for the Cell with these objects.
 
552
         */
 
553
        private void checkDaisyChain(ArcInst ai, Map<NodeInst, ObjectQTree> nodePortBounds, PolyMerge stayInside, Topology top)
 
554
        {
 
555
                // make a list of PortInsts that are on the centerline of this arc
 
556
                Cell cell = ai.getParent();
 
557
                Network arcNet = top.getArcNetwork(ai);
 
558
                Point2D e1 = ai.getHeadLocation();
 
559
                Point2D e2 = ai.getTailLocation();
 
560
                List<DaisyChainPoint> daisyPoints = new ArrayList<DaisyChainPoint>();
 
561
                Rectangle2D searchBounds = ai.getBounds();
 
562
                for(Iterator<RTBounds> it = cell.searchIterator(searchBounds); it.hasNext(); )
 
563
                {
 
564
                        Geometric geom = (Geometric)it.next();
 
565
                        if (geom instanceof NodeInst)
 
566
                        {
 
567
                                NodeInst ni = (NodeInst)geom;
 
568
                                if (USEQTREE)
 
569
                                {
 
570
                                        // find ports on this arc
 
571
                                        ObjectQTree oqt = nodePortBounds.get(ni);
 
572
                                        Set set = oqt.find(searchBounds);
 
573
                                        if (set != null)
 
574
                                        {
 
575
                                                for (Object obj : set)
 
576
                                                {
 
577
                                                        PortInst pi = (PortInst)obj;
 
578
                                                        if (!pi.getPortProto().getBasePort().connectsTo(ai.getProto())) continue;
 
579
                                                        PolyBase portPoly = pi.getPoly();
 
580
                                                        Point2D closest = GenMath.closestPointToSegment(e1, e2, portPoly.getCenter());
 
581
 
 
582
                                                        // if this port can connect, save it
 
583
                                                        if (DBMath.pointInRect(closest, portPoly.getBounds2D()))
 
584
                                                        {
 
585
                                                                // ignore if they are already connected
 
586
                                                                Network portNet = top.getPortNetwork(pi);
 
587
                                                                if (portNet == arcNet) continue;
 
588
                                                                daisyPoints.add(new DaisyChainPoint(pi, closest));
 
589
                                                        }
 
590
                                                }
 
591
                                        }
 
592
                                } else
 
593
                                {
 
594
                                        // can't handle this yet
 
595
                                        assert false;
 
596
                                }
 
597
                        }
 
598
                }
 
599
 
 
600
                // now see if there are multiple intermediate daisy-chain points
 
601
                if (daisyPoints.size() <= 1) return;
 
602
                Collections.sort(daisyPoints, new SortDaisyPoints());
 
603
 
 
604
        Route route = new Route();
 
605
        route.add(RouteElementArc.deleteArc(ai));
 
606
 
 
607
        RouteElementPort headRE = RouteElementPort.existingPortInst(ai.getHeadPortInst(), ai.getHeadLocation());
 
608
        RouteElementPort tailRE = RouteElementPort.existingPortInst(ai.getTailPortInst(), ai.getTailLocation());
 
609
        DaisyChainPoint firstDCP = daisyPoints.get(0);
 
610
        DaisyChainPoint lastDCP = daisyPoints.get(daisyPoints.size()-1);
 
611
        if (firstDCP.location.distance(ai.getHeadLocation()) > firstDCP.location.distance(ai.getTailLocation()))
 
612
        {
 
613
                RouteElementPort swap = headRE;   headRE = tailRE;   tailRE = swap;
 
614
        }
 
615
        if (headRE.getNodeInst().getNumConnections() == 1 && headRE.getLocation().equals(firstDCP.location))
 
616
        {
 
617
                route.add(RouteElementPort.deleteNode(headRE.getNodeInst()));
 
618
                headRE = null;
 
619
        }
 
620
        if (tailRE.getNodeInst().getNumConnections() == 1 && tailRE.getLocation().equals(lastDCP.location))
 
621
        {
 
622
                route.add(RouteElementPort.deleteNode(tailRE.getNodeInst()));
 
623
                tailRE = null;
 
624
        }
 
625
        String name = ai.getName();
 
626
        for(DaisyChainPoint dcp : daisyPoints)
 
627
        {
 
628
            RouteElementPort dcpRE = RouteElementPort.existingPortInst(dcp.pi, dcp.location);
 
629
            if (headRE != null)
 
630
            {
 
631
                        RouteElement re = RouteElementArc.newArc(cell, ai.getProto(), ai.getLambdaBaseWidth(), headRE, dcpRE,
 
632
                                headRE.getLocation(), dcpRE.getLocation(), name, ai.getTextDescriptor(ArcInst.ARC_NAME),
 
633
                        ai, ai.isHeadExtended(), ai.isTailExtended(), stayInside);
 
634
                    route.add(re);
 
635
            }
 
636
                headRE = dcpRE;
 
637
                name = null;
 
638
        }
 
639
        if (tailRE != null)
 
640
        {
 
641
                RouteElement re = RouteElementArc.newArc(cell, ai.getProto(), ai.getLambdaBaseWidth(), headRE, tailRE,
 
642
                        headRE.getLocation(), tailRE.getLocation(), name, ai.getTextDescriptor(ArcInst.ARC_NAME),
 
643
                    ai, ai.isHeadExtended(), ai.isTailExtended(), stayInside);
 
644
                route.add(re);
 
645
        }
 
646
                allRoutes.add(route);
 
647
        }
 
648
 
472
649
        /****************************************** NORMAL STITCHING ******************************************/
473
650
 
474
651
        /**
1590
1767
 
1591
1768
                Route route = router.planRoute(cell, eobj1, eobj2, ctr, stayInside, true, true);
1592
1769
                if (route.size() == 0) return false;
1593
 
                allRoutes.add(route);
 
1770
 
 
1771
//              // see if this caused an arc to be deleted
 
1772
//              boolean deletedArc = false;
 
1773
//        for (RouteElement e : route)
 
1774
//            if (e.getAction() == RouteElement.RouteElementAction.deleteArc) { deletedArc = true;  break; }
 
1775
 
 
1776
        allRoutes.add(route);
1594
1777
                top.connect(net1, net2);
1595
1778
 
1596
1779
                // if either ni or oNi is a pin primitive, see if it is a candidate for clean-up
1671
1854
 
1672
1855
                                // compare node "ni" against node "oNi"
1673
1856
                                if (oNi.isCellInstance() && ni.isCellInstance())
 
1857
                                {
1674
1858
                                        compareTwoNodesMakeExport(ni, oNi);
 
1859
                                }
1675
1860
                        }
1676
1861
                }
1677
1862
        }
1946
2131
        /**
1947
2132
         * Class to define a polygon that is down in the hierarchy and has a context.
1948
2133
         */
1949
 
        private static class SubPolygon
 
2134
        private static class SubPolygon implements RTBounds
1950
2135
        {
1951
2136
                PolyBase poly;
1952
2137
                int netID;
1962
2147
                        this.theObj = theObj;
1963
2148
                        this.xfToTop = xfToTop;
1964
2149
                }
 
2150
 
 
2151
                public Rectangle2D getBounds() { return poly.getBounds2D(); }
1965
2152
        }
1966
2153
 
1967
2154
        /**
2006
2193
                Rectangle2D intersectArea = bound1.createIntersection(bound2);
2007
2194
 
2008
2195
                // now find all polygons in Node 1 that are in the intersection area
2009
 
                List<SubPolygon> polygons = new ArrayList<SubPolygon>();
 
2196
                RTNode rtree = null;
2010
2197
                if (ni1.isCellInstance())
2011
2198
                {
2012
 
                        GatherPolygonVisitor gpv = new GatherPolygonVisitor(polygons, intersectArea, ni1);
 
2199
                        GatherPolygonVisitor gpv = new GatherPolygonVisitor(intersectArea, ni1);
2013
2200
                        HierarchyEnumerator.enumerateCell(ni1.getParent(), VarContext.globalContext, gpv);
 
2201
                        rtree = gpv.getRTree();
2014
2202
                } else
2015
2203
                {
 
2204
                        rtree = RTNode.makeTopLevel();
2016
2205
                        Technology tech = ni1.getProto().getTechnology();
2017
2206
                        Poly[] polys = tech.getShapeOfNode(ni1, true, true, null);
2018
2207
                        AffineTransform trans = ni1.rotateOut();
2021
2210
                                Poly poly = polys[i];
2022
2211
                                poly.transform(trans);
2023
2212
                                if (!DBMath.rectsIntersect(poly.getBounds2D(), intersectArea)) continue;
2024
 
                                polygons.add(new SubPolygon(poly, VarContext.globalContext, -1, ni1, null));
 
2213
                                rtree = RTNode.linkGeom(null, rtree, new SubPolygon(poly, VarContext.globalContext, -1, ni1, null));
2025
2214
                        }
2026
2215
                }
2027
2216
 
2028
2217
                // now take the list into the second node and look for connections
2029
 
                CheckPolygonVisitor cpv = new CheckPolygonVisitor(polygons, intersectArea, ni2);
 
2218
                CheckPolygonVisitor cpv = new CheckPolygonVisitor(rtree, intersectArea, ni2);
2030
2219
                HierarchyEnumerator.enumerateCell(ni2.getParent(), VarContext.globalContext, cpv);
2031
2220
                List<PolyConnection> polysFound = cpv.getFoundConnections();
2032
2221
 
2044
2233
         */
2045
2234
        private class CheckPolygonVisitor extends HierarchyEnumerator.Visitor
2046
2235
        {
2047
 
                private List<SubPolygon> polygons;
 
2236
                private RTNode rtree;
2048
2237
                private Rectangle2D intersectArea;
2049
2238
                private NodeInst cellOfInterest;
2050
2239
                private List<PolyConnection> connectionsFound;
2051
2240
 
2052
 
                public CheckPolygonVisitor(List<SubPolygon> polygons, Rectangle2D intersectArea, NodeInst cellOfInterest)
 
2241
                public CheckPolygonVisitor(RTNode rtree, Rectangle2D intersectArea, NodeInst cellOfInterest)
2053
2242
                {
2054
 
                        this.polygons = polygons;
 
2243
                        this.rtree = rtree;
2055
2244
                        this.intersectArea = intersectArea;
2056
2245
                        this.cellOfInterest = cellOfInterest;
2057
2246
                        connectionsFound = new ArrayList<PolyConnection>();
2080
2269
                                        if (poly.getPort() == null) continue;
2081
2270
                                        poly.transform(nodeTrans);
2082
2271
                                        if (!DBMath.rectsIntersect(poly.getBounds2D(), intersectArea)) continue;
2083
 
                                        for(SubPolygon sp : polygons)
 
2272
                                        for(RTNode.Search sea = new RTNode.Search(poly.getBounds2D(), rtree, true); sea.hasNext(); )
2084
2273
                                        {
 
2274
                                                SubPolygon sp = (SubPolygon)sea.next();
2085
2275
                                                if (sp.poly.getLayer() != poly.getLayer()) continue;
2086
2276
                                                if (sp.poly.separation(poly) >= DBMath.getEpsilon()) continue;
2087
2277
                                                int netID = -1;
2104
2294
                                        PolyBase poly = arcPolyList[i];
2105
2295
                                        poly.transform(toTop);
2106
2296
                                        if (!DBMath.rectsIntersect(poly.getBounds2D(), intersectArea)) continue;
2107
 
                                        for(SubPolygon sp : polygons)
 
2297
                                        for(RTNode.Search sea = new RTNode.Search(poly.getBounds2D(), rtree, true); sea.hasNext(); )
2108
2298
                                        {
 
2299
                                                SubPolygon sp = (SubPolygon)sea.next();
2109
2300
                                                if (sp.poly.getLayer() != poly.getLayer()) continue;
2110
2301
                                                if (sp.poly.separation(poly) > 0) continue;
2111
2302
                                                Network net = nl.getNetwork(ai, 0);
2171
2362
         */
2172
2363
        private class GatherPolygonVisitor extends HierarchyEnumerator.Visitor
2173
2364
        {
2174
 
                private List<SubPolygon> polygons;
 
2365
                private RTNode rtree;
2175
2366
                private Rectangle2D intersectArea;
2176
2367
                private NodeInst cellOfInterest;
2177
2368
 
2178
 
                public GatherPolygonVisitor(List<SubPolygon> polygons, Rectangle2D intersectArea, NodeInst cellOfInterest)
 
2369
                public GatherPolygonVisitor(Rectangle2D intersectArea, NodeInst cellOfInterest)
2179
2370
                {
2180
 
                        this.polygons = polygons;
 
2371
                        rtree = RTNode.makeTopLevel();
2181
2372
                        this.intersectArea = intersectArea;
2182
2373
                        this.cellOfInterest = cellOfInterest;
2183
2374
                }
2184
2375
 
 
2376
                public RTNode getRTree() { return rtree; }
 
2377
 
2185
2378
                public boolean enterCell(HierarchyEnumerator.CellInfo info) { return true; }
2186
2379
 
2187
2380
                public void exitCell(HierarchyEnumerator.CellInfo info)
2208
2401
                                        int netID = -1;
2209
2402
                                        Network net = nl.getNetwork(ni, poly.getPort(), 0);
2210
2403
                                        if (net != null) netID = info.getNetID(net);
2211
 
                                        polygons.add(new SubPolygon(poly, info.getContext(), netID, ni, null));
 
2404
                                        rtree = RTNode.linkGeom(null, rtree, new SubPolygon(poly, info.getContext(), netID, ni, null));
2212
2405
                                }
2213
2406
                        }
2214
2407
 
2227
2420
                                        if (!DBMath.rectsIntersect(poly.getBounds2D(), intersectArea)) continue;
2228
2421
                                        Network net = nl.getNetwork(ai, 0);
2229
2422
                                        int netID = info.getNetID(net);
2230
 
                                        polygons.add(new SubPolygon(poly, info.getContext(), netID, ai, null));
 
2423
                                        rtree = RTNode.linkGeom(null, rtree, new SubPolygon(poly, info.getContext(), netID, ai, null));
2231
2424
                                }
2232
2425
                        }
2233
2426
                }
2439
2632
                        if (res != 0) return res;
2440
2633
                        res = r1e.getPortInst().getPortProto().getName().compareTo(r2e.getPortInst().getPortProto().getName());
2441
2634
                        if (res != 0) return res;
2442
 
 
2443
 
//                      // sort by the starting and ending port locations
2444
 
//                      Poly p1s = r1s.getPortInst().getPoly();
2445
 
//                      Poly p2s = r2s.getPortInst().getPoly();
2446
 
//                      double x1 = p1s.getCenterX();
2447
 
//                      double y1 = p1s.getCenterY();
2448
 
//                      double x2 = p2s.getCenterX();
2449
 
//                      double y2 = p2s.getCenterY();
2450
 
//                      if (x1 < x2) return 1;
2451
 
//                      if (x1 > x2) return -1;
2452
 
//                      if (y1 < y2) return 1;
2453
 
//                      if (y1 > y2) return -1;
2454
 
//
2455
 
//                      Poly p1e = r1e.getPortInst().getPoly();
2456
 
//                      Poly p2e = r2e.getPortInst().getPoly();
2457
 
//                      x1 = p1e.getCenterX();
2458
 
//                      y1 = p1e.getCenterY();
2459
 
//                      x2 = p2e.getCenterX();
2460
 
//                      y2 = p2e.getCenterY();
2461
 
//                      if (x1 < x2) return 1;
2462
 
//                      if (x1 > x2) return -1;
2463
 
//                      if (y1 < y2) return 1;
2464
 
//                      if (y1 > y2) return -1;
2465
2635
                        return 0;
2466
2636
                }
2467
2637
        }