⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 routeelementport.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* -*- tab-width: 4 -*- * * Electric(tm) VLSI Design System * * File: RouteElementPort.java * * Copyright (c) 2003 Sun Microsystems and Static Free Software * * Electric(tm) is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * Electric(tm) is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Electric(tm); see the file COPYING.  If not, write to * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, Mass 02111-1307, USA. */package com.sun.electric.tool.routing;import com.sun.electric.database.geometry.Dimension2D;import com.sun.electric.database.geometry.EPoint;import com.sun.electric.database.geometry.Poly;import com.sun.electric.database.hierarchy.Cell;import com.sun.electric.database.hierarchy.EDatabase;import com.sun.electric.technology.ArcProto;import com.sun.electric.database.prototype.NodeProto;import com.sun.electric.database.prototype.PortProto;import com.sun.electric.database.topology.ArcInst;import com.sun.electric.database.topology.Connection;import com.sun.electric.database.topology.NodeInst;import com.sun.electric.database.topology.PortInst;import com.sun.electric.database.variable.ElectricObject;import com.sun.electric.technology.SizeOffset;import com.sun.electric.tool.routing.RouteElement.RouteElementAction;import com.sun.electric.tool.user.Highlighter;import java.awt.geom.Point2D;import java.awt.geom.Rectangle2D;import java.util.ArrayList;import java.util.Iterator;import java.util.List;/** * Class for defining RouteElements that are ports. */public class RouteElementPort extends RouteElement {    // ---- New Port info ----    /** Node type to create */                      private NodeProto np;    /** Port on node to use */                      private PortProto portProto;    /** location to create Node */                  private EPoint location;    /** size aspect that is seen on screen */       private double width, height;    /** if this bisects an arc */                   private boolean isBisectArcPin;    /** RouteElementArcs connecting to this */      private List<RouteElementArc> newArcs;    /** port site spatial extents (db units) */     private transient Poly portInstSite;    /** This contains the newly created instance, or the instance to delete */ private NodeInst nodeInst;    /** This contains the newly created portinst, or the existing port inst */ private PortInst portInst;    /**     * Private Constructor     * @param action the action this RouteElementAction will do.     */    private RouteElementPort(RouteElementAction action, Cell cell) { super(action, cell); }    /**     * Factory method for making a newNode RouteElement     * @param np Type of NodeInst to make     * @param location the location of the new NodeInst     * @param width the width of the new NodeInst     * @param height the height of the new NodeInst     */    public static RouteElementPort newNode(Cell cell, NodeProto np, PortProto newNodePort, Point2D location,                                       double width, double height) {        RouteElementPort e = new RouteElementPort(RouteElement.RouteElementAction.newNode, cell);        e.np = np;        e.portProto = newNodePort;        e.location = EPoint.snap(location);        e.isBisectArcPin = false;        e.newArcs = new ArrayList<RouteElementArc>();        e.setNodeSize(new Dimension2D.Double(width, height));        e.nodeInst = null;        e.portInst = null;        Point2D [] points = {location};        e.portInstSite = new Poly(points);        return e;    }    /**     * Factory method for making a deleteNode RouteElement     * @param nodeInstToDelete the nodeInst to delete     */    public static RouteElementPort deleteNode(NodeInst nodeInstToDelete) {        RouteElementPort e = new RouteElementPort(RouteElement.RouteElementAction.deleteNode, nodeInstToDelete.getParent());        e.np = nodeInstToDelete.getProto();        e.portProto = null;        e.location = EPoint.snap(nodeInstToDelete.getTrueCenter());        e.isBisectArcPin = false;        e.newArcs = new ArrayList<RouteElementArc>();        e.setNodeSize(new Dimension2D.Double(nodeInstToDelete.getXSize(), nodeInstToDelete.getYSize()));        e.nodeInst = nodeInstToDelete;        e.portInst = null;        e.portInstSite = null;        return e;    }    /**     * Factory method for making a dummy RouteElement for an     * existing PortInst. This is usually use to demark the     * start and/or ends of the route, which exist before     * we start building the route.     * @param existingPortInst the already existing portInst to connect to     */    public static RouteElementPort existingPortInst(PortInst existingPortInst, EPoint portInstSite) {        Point2D [] points = {portInstSite};        Poly poly = new Poly(points);        return existingPortInst(existingPortInst, poly);    }    /**     * Factory method for making a dummy RouteElement for an     * existing PortInst. This is usually use to demark the     * start and/or ends of the route, which exist before     * we start building the route.     * @param existingPortInst the already existing portInst to connect to     */    public static RouteElementPort existingPortInst(PortInst existingPortInst, Poly portInstSite) {        RouteElementPort e = new RouteElementPort(RouteElement.RouteElementAction.existingPortInst, existingPortInst.getNodeInst().getParent());        NodeInst nodeInst = existingPortInst.getNodeInst();        e.np = nodeInst.getProto();        e.portProto = existingPortInst.getPortProto();        e.location = EPoint.snap(nodeInst.getTrueCenter());        e.isBisectArcPin = false;        e.newArcs = new ArrayList<RouteElementArc>();        e.setNodeSize(new Dimension2D.Double(nodeInst.getXSize(), nodeInst.getYSize()));        e.nodeInst = nodeInst;        e.portInst = existingPortInst;        e.portInstSite = portInstSite;        return e;   }    /**     * Get the PortProto for connecting to this RouteElementPort.     * This is not the same as getPortInst().getPortProto(),     * because if the action has not yet been done the PortInst     * returned by getPortInst() may have not yet been created.     * For a deleteNode, this will return null.     * @return a PortProto of port to connect to this RouteElement.     */    public PortProto getPortProto() { return portProto; }    /**     * Get Connecting Port on RouteElement.     * @return the PortInst, or null on error     */    public PortInst getPortInst() { return portInst; }    /**     * Get Connecting Node on RouteElement.     * @return the NodeInst, or null on error     */    public NodeInst getNodeInst() { return nodeInst; }    /** Returns location of newNode, existingPortInst, or deleteNode,     * or null otherwise */    public Point2D getLocation() { return location; }    /** Set true by Interactive router if pin used to bisect arc     * Router may want to remove this pin later if it places a     * connecting contact cut in the same position.     */    public void setBisectArcPin(boolean state) { isBisectArcPin = state; }    /** see setBisectArcPin */    public boolean isBisectArcPin() { return isBisectArcPin; }    /**     * Book-keeping: Adds a newArc RouteElement to a list to keep     * track of what newArc elements use this object as an end point.     * This must be a RouteElement of type newNode or existingPortInst.     * @param re the RouteElement to add.     */    public void addConnectingNewArc(RouteElementArc re) {        if (re.getAction() != RouteElementAction.newArc) return;        newArcs.add(re);    }    /**     * Reomve a newArc that connects to this newNode or existingPortInst.     * @param re the RouteElement to remove     */    public void removeConnectingNewArc(RouteElementArc re) {        if (re.getAction() != RouteElementAction.newArc) return;        newArcs.remove(re);    }    /**     * Get largest arc width of newArc RouteElements attached to this     * RouteElement.  If none present returns -1.     * <p>Note that these width values should have been pre-adjusted for     * the arc width offset, so these values have had the offset subtracted away.     */    public double getWidestConnectingArc(ArcProto ap) {        double width = -1;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -