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

📄 circuitchangejobs.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
					if (firstEObj instanceof PortInst) {						ni = ((PortInst)firstEObj).getNodeInst();					} else {						ni = (NodeInst)firstEObj;					}					// make sure moving the node is allowed					if (cantEdit(cell, ni, true, false, true) != 0) return false;					ni.move(dX, dY);					if (verbose) System.out.println("Moved node " + ni.describe(false) + " by (" + dX + "," + dY + ")");					updateStatusBar = true;					fieldVariableChanged("updateStatusBar");					return true;				}			}			// special case if moving diagonal fixed-angle arcs connected to single manhattan arcs			boolean found = false;			for(ElectricObject eobj : highlightedObjs)			{				if (eobj instanceof ArcInst)				{					ArcInst ai = (ArcInst)eobj;					if (ai.getHeadLocation().getX() != ai.getTailLocation().getX() &&						ai.getHeadLocation().getY() != ai.getTailLocation().getY())					{						if (ai.isFixedAngle() && !ai.isRigid())						{							int j;							for(j=0; j<2; j++)							{								NodeInst ni = ai.getPortInst(j).getNodeInst();								ArcInst oai = null;								for(Iterator<Connection> pIt = ni.getConnections(); pIt.hasNext(); )								{									Connection con = pIt.next();									if (con.getArc() == ai) continue;									if (oai == null) oai = con.getArc(); else									{										oai = null;										break;									}								}								if (oai == null) break;								if (oai.getHeadLocation().getX() != oai.getTailLocation().getX() &&									oai.getHeadLocation().getY() != oai.getTailLocation().getY()) break;							}							if (j >= 2) { found = true;   break; }						}					}				}			}			if (found)			{				// meets the test: make the special move to slide other orthogonal arcs				for(ElectricObject eobj : highlightedObjs)				{					if (!(eobj instanceof ArcInst)) continue;					ArcInst ai = (ArcInst)eobj;					double [] deltaXs = new double[2];					double [] deltaYs = new double[2];					NodeInst [] niList = new NodeInst[2];					deltaXs[0] = deltaYs[0] = deltaXs[1] = deltaYs[1] = 0;					int arcangle = ai.getAngle();					int j;					for(j=0; j<2; j++)					{						NodeInst ni = ai.getPortInst(j).getNodeInst();						niList[j] = ni;						ArcInst oai = null;						for(Iterator<Connection> pIt = ni.getConnections(); pIt.hasNext(); )						{							Connection con = pIt.next();							if (con.getArc() != ai) { oai = con.getArc();   break; }						}						if (oai == null) break;						if (DBMath.doublesEqual(oai.getHeadLocation().getX(), oai.getTailLocation().getX()))						{							Point2D iPt = DBMath.intersect(oai.getHeadLocation(), 900,								new Point2D.Double(ai.getHeadLocation().getX()+dX, ai.getHeadLocation().getY()+dY), arcangle);							if (iPt != null)							{								deltaXs[j] = iPt.getX() - ai.getLocation(j).getX();								deltaYs[j] = iPt.getY() - ai.getLocation(j).getY();							}						} else if (DBMath.doublesEqual(oai.getHeadLocation().getY(), oai.getTailLocation().getY()))						{							Point2D iPt = DBMath.intersect(oai.getHeadLocation(), 0,								new Point2D.Double(ai.getHeadLocation().getX()+dX, ai.getHeadLocation().getY()+dY), arcangle);							if (iPt != null)							{								deltaXs[j] = iPt.getX() - ai.getLocation(j).getX();								deltaYs[j] = iPt.getY() - ai.getLocation(j).getY();							}						}					}					if (j < 2) continue;					NodeInst.modifyInstances(niList, deltaXs, deltaYs, null, null);				}				if (verbose) System.out.println("Moved multiple objects by (" + dX + "," + dY + ")");				updateStatusBar = true;				fieldVariableChanged("updateStatusBar");				return true;			}			// special case if moving only arcs and they slide			boolean onlySlidable = true, foundArc = false;			for(ElectricObject eobj : highlightedObjs)			{				if (eobj instanceof ArcInst)				{					ArcInst ai = (ArcInst)eobj;					foundArc = true;					// see if the arc moves in its ports					if (ai.isSlidable())					{						Point2D newHead = new Point2D.Double(ai.getHeadLocation().getX()+dX, ai.getHeadLocation().getY()+dY);						Point2D newTail = new Point2D.Double(ai.getTailLocation().getX()+dX, ai.getTailLocation().getY()+dY);						if (ai.headStillInPort(newHead, true) && ai.tailStillInPort(newTail, true)) continue;					}				}				onlySlidable = false;			}			if (foundArc && onlySlidable)			{				for(ElectricObject eobj : highlightedObjs)				{					if (eobj instanceof ArcInst)					{						ArcInst ai = (ArcInst)eobj;						ai.modify(dX, dY, dX, dY);						if (verbose) System.out.println("Moved arc " + ai.describe(false) + " by (" + dX + "," + dY + ")");					}				}				updateStatusBar = true;				fieldVariableChanged("updateStatusBar");				return true;			}			// ignore arc motion if the nodes are locked			for(int i=0; i<highlightedObjs.size(); i++)			{				ElectricObject eobj = highlightedObjs.get(i);				if (eobj instanceof ArcInst)				{					ArcInst ai = (ArcInst)eobj;					int errorCode = cantEdit(cell, ai.getHeadPortInst().getNodeInst(), true, false, true);					if (errorCode < 0) return false;					if (errorCode > 0)					{						highlightedObjs.remove(i);						i--;						continue;					}					errorCode = cantEdit(cell, ai.getTailPortInst().getNodeInst(), true, false, true);					if (errorCode < 0) return false;					if (errorCode > 0)					{						highlightedObjs.remove(i);						i--;						continue;					}				}			}			// make flag to track the nodes that move			Set<NodeInst> flag = new HashSet<NodeInst>();			// remember the location of every node and arc			Map<NodeInst,Point2D.Double> nodeLocation = new HashMap<NodeInst,Point2D.Double>();			for(Iterator<NodeInst> it = cell.getNodes(); it.hasNext(); )			{				NodeInst ni = it.next();				nodeLocation.put(ni, new Point2D.Double(ni.getAnchorCenterX(), ni.getAnchorCenterY()));			}			Map<ArcInst,Point2D.Double> arcLocation = new HashMap<ArcInst,Point2D.Double>();			for(Iterator<ArcInst> it = cell.getArcs(); it.hasNext(); )			{				ArcInst ai = it.next();				arcLocation.put(ai, new Point2D.Double(ai.getTrueCenterX(), ai.getTrueCenterY()));			}			// mark all nodes that want to move			for(ElectricObject eobj : highlightedObjs)			{				if (eobj instanceof PortInst) eobj = ((PortInst)eobj).getNodeInst();				if (eobj instanceof NodeInst)				{					NodeInst ni = (NodeInst)eobj;					flag.add(ni);				} else if (eobj instanceof ArcInst)				{					ArcInst ai = (ArcInst)eobj;					NodeInst ni1 = ai.getHeadPortInst().getNodeInst();					NodeInst ni2 = ai.getTailPortInst().getNodeInst();					flag.add(ni1);					flag.add(ni2);					Layout.setTempRigid(ai, true);				}			}			// count the number of nodes that will move			int numNodes = 0;			for(Iterator<NodeInst> it = cell.getNodes(); it.hasNext(); )			{				NodeInst ni = it.next();				if (!flag.contains(ni)) continue;				// make sure moving the node is allowed				int errorCode = cantEdit(cell, ni, true, false, true);				if (errorCode < 0) return false;				if (errorCode > 0)				{					flag.remove(ni);					continue;				}				numNodes++;			}			// look at all nodes and move them appropriately			if (numNodes > 0)			{				NodeInst [] nis = new NodeInst[numNodes];				double [] dXs = new double[numNodes];				double [] dYs = new double[numNodes];				numNodes = 0;				for(Iterator<NodeInst> it = cell.getNodes(); it.hasNext(); )				{					NodeInst ni = it.next();					if (!flag.contains(ni)) continue;					nis[numNodes] = ni;					dXs[numNodes] = dX;					dYs[numNodes] = dY;					numNodes++;				}				NodeInst.modifyInstances(nis, dXs, dYs, null, null);			}			flag = null;			// look at all arcs and move them appropriately			for(ElectricObject eobj : highlightedObjs)			{				if (!(eobj instanceof ArcInst)) continue;				ArcInst ai = (ArcInst)eobj;				Point2D pt = arcLocation.get(ai);				if (pt.getX() != ai.getTrueCenterX() ||					pt.getY() != ai.getTrueCenterY()) continue;				// see if the arc moves in its ports				boolean headInPort = false, tailInPort = false;				if (!ai.isRigid() && ai.isSlidable())				{					headInPort = ai.headStillInPort(						new Point2D.Double(ai.getHeadLocation().getX()+dX, ai.getHeadLocation().getY()+dY), true);					tailInPort = ai.tailStillInPort(						new Point2D.Double(ai.getTailLocation().getX()+dX, ai.getTailLocation().getY()+dY), true);				}				// if both ends slide in their port, move the arc				if (headInPort && tailInPort)				{					ai.modify(dX, dY, dX, dY);					continue;				}				// if neither end can slide in its port, move the nodes				if (!headInPort && !tailInPort)				{					for(int k=0; k<2; k++)					{						NodeInst ni;						if (k == 0) ni = ai.getHeadPortInst().getNodeInst(); else							ni = ai.getTailPortInst().getNodeInst();						Point2D nPt = nodeLocation.get(ni);						if (ni.getAnchorCenterX() != nPt.getX() || ni.getAnchorCenterY() != nPt.getY()) continue;						// fix all arcs that aren't sliding						for(ElectricObject oEObj : highlightedObjs)						{							if (oEObj instanceof ArcInst)							{								ArcInst oai = (ArcInst)oEObj;								Point2D aPt = arcLocation.get(oai);								if (aPt.getX() != oai.getTrueCenterX() ||									aPt.getY() != oai.getTrueCenterY()) continue;								if (oai.headStillInPort(										new Point2D.Double(ai.getHeadLocation().getX()+dX, ai.getHeadLocation().getY()+dY), true) ||									oai.tailStillInPort(										new Point2D.Double(ai.getTailLocation().getX()+dX, ai.getTailLocation().getY()+dY), true))											continue;								Layout.setTempRigid(oai, true);							}						}						ni.move(dX - (ni.getAnchorCenterX() - nPt.getX()),							dY - (ni.getAnchorCenterY() - nPt.getY()));					}					continue;				}			}			// also move selected text			moveSelectedText(cell, highlightedText);			if (verbose) System.out.println("Moved multiple objects by (" + dX + "," + dY + ")");			updateStatusBar = true;			fieldVariableChanged("updateStatusBar");			return true;		}		public void terminateOK()		{			if (updateStatusBar) StatusBar.updateStatusBar();		}		/**		 * Method to move the "numtexts" text objects described (as highlight strings)		 * in the array "textlist", by "odx" and "ody".  Geometry objects in "list" (NOGEOM-terminated)		 * and the "total" nodes in "nodelist" have already been moved, so don't move any text that		 * is on these objects.		 */		private void moveSelectedText(Cell cell, List<DisplayedText> highlightedText)		{			for(DisplayedText dt : highlightedText)			{				// disallow moving if lock is on				if (cell != null)				{					int errorCode = cantEdit(cell, null, true, true, true);					if (errorCode < 0) return;					if (errorCode > 0) continue;				}				// handle nodes that move with text				ElectricObject eobj = dt.getElectricObject();				if (dt.movesWithText())				{					NodeInst ni = null;					if (eobj instanceof NodeInst) ni = (NodeInst)eobj;					if (eobj instanceof Export) ni = ((Export)eobj).getOriginalPort().getNodeInst();					if (ni != null)					{						ni.move(dX, dY);						continue;					}				}				// moving variable on object				Variable.Key varKey = dt.getVariableKey();				TextDescriptor td = eobj.getTextDescriptor(varKey);				if (td == null) continue;				NodeInst ni = null;				if (eobj instanceof NodeInst) ni = (NodeInst)eobj; else					if (eobj instanceof PortInst) ni = ((PortInst)eobj).getNodeInst(); else						if (eobj instanceof Export && varKey == Export.EXPORT_NAME) ni = ((Export)eobj).getOriginalPort().getNodeInst();				if (ni != null)				{					Point2D curLoc = new Point2D.Double(ni.getAnchorCenterX()+td.getXOff(), ni.getAnchorCenterY()+td.getYOff());					AffineTransform rotateOut = ni.rotateOut();					rotateOut.transform(curLoc, curLoc);					curLoc.setLocation(curLoc.getX()+dX, curLoc.getY()+dY);					AffineTransform rotateIn = ni.rotateIn();					rotateIn.transform(curLoc, curLoc);					eobj.setOff(varKey, curLoc.getX()-ni.getAnchorCenterX(), curLoc.getY()-ni.getAnchorCenterY());				} else				{					eobj.setOff(varKey, td.getXOff()+dX, td.getYOff()+dY);				}			}		}	}	/**	 * Store information of new arc to be created that reconnects	 * two arcs that will be deleted	 */	private static class ReconnectedArc implements Serializable	{		/** port at other end of arc */						private PortInst [] reconPi;		/** coordinate at other end of arc */				private EPoint [] recon;		/** old arc insts that will be deleted */           private ArcInst [] reconAr;		/** prototype of new arc */							private ArcProto ap;		/** width of new arc */								private double wid;		/** true to make new arc have arrow on head */		private boolean directionalHead;		/** true to make new arc have arrow on tail */		private boolean directionalTail;		/** true to make new arc have arrow on body */		private boolean directionalBody;		/** true to extend the head of the new arc */		private boolean extendHead;		/** true to extend the tail of the new arc */		private boolean extendTail;		/** true to negate the head of the new arc */		private boolean negateHead;		/** true to negate the tail of the new arc */		private boolean negateTail;		/** the name to use on the reconnected arc */		private String arcName;		/** TextDescriptor for the reconnected arc name */	private TextDescriptor arcNameTD;	}	public static List<Reconnect> getPinsToPassThrough(Cell cell)	{		List<Reconnect> pinsToPassThrough = new ArrayList<Reconnect>();		for(Iterator<NodeInst> it = cell.getNodes(); it.hasNext(); )		{			NodeInst ni = it.next();			if (ni.getFunction() != PrimitiveNode.Function.PIN) continue;			// if the pin is an export, save it			if (ni.hasExports()) continue;			// if the pin is connected to two arcs along the same slope, delete it			if (ni.isInlinePin())			{				Reconnect re = Reconnect.erasePassThru(ni, false, true);				if (re != null)				{					pinsToPassThrough.add(re);				}			}		}		retu

⌨️ 快捷键说明

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