📄 artwork.java
字号:
/* -*- tab-width: 4 -*- * * Electric(tm) VLSI Design System * * File: Artwork.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.technology.technologies;import com.sun.electric.database.ImmutableArcInst;import com.sun.electric.database.ImmutableElectricObject;import com.sun.electric.database.geometry.EGraphics;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.prototype.PortCharacteristic;import com.sun.electric.database.text.Pref;import com.sun.electric.database.topology.NodeInst;import com.sun.electric.database.variable.ElectricObject;import com.sun.electric.database.variable.Variable;import com.sun.electric.technology.AbstractShapeBuilder;import com.sun.electric.technology.ArcProto;import com.sun.electric.technology.EdgeH;import com.sun.electric.technology.EdgeV;import com.sun.electric.technology.Foundry;import com.sun.electric.technology.Layer;import com.sun.electric.technology.PrimitiveNode;import com.sun.electric.technology.PrimitivePort;import com.sun.electric.technology.Technology;import com.sun.electric.tool.user.User;import java.awt.Color;import java.awt.geom.Point2D;/** * This is the general purpose sketching technology. */public class Artwork extends Technology{ /** * Key of Variable holding starting and ending angles. * As a special case, NodeInst.checkPossibleVariableEffects() * updates the node when this variable changes. */ public static final Variable.Key ART_DEGREES = Variable.newKey("ART_degrees"); /** key of Variable holding message text. */ public static final Variable.Key ART_MESSAGE = Variable.newKey("ART_message"); /** key of Variable holding color information */ public static final Variable.Key ART_COLOR = Variable.newKey("ART_color"); /** key of Variable holding color information */ public static final Variable.Key ART_PATTERN = Variable.newKey("ART_pattern"); /** the Artwork Technology object. */ public static Artwork tech() { return sysArtwork; } /** number of lines in an ellipse */ private static final int ELLIPSEPOINTS = 30; /** granularity of a spline */ private static final int SPLINEGRAIN = 20; /** Defines a Pin node. */ public final PrimitiveNode pinNode; /** Defines a Box node. */ public final PrimitiveNode boxNode; /** Defines a Crossed-Box node. */ public final PrimitiveNode crossedBoxNode; /** Defines a Filled-Box node. */ public final PrimitiveNode filledBoxNode; /** Defines a Circle node. */ public final PrimitiveNode circleNode; /** Defines a Filled-Circle node. */ public final PrimitiveNode filledCircleNode; /** Defines a Spline node. */ public final PrimitiveNode splineNode; /** Defines a Triangle node. */ public final PrimitiveNode triangleNode; /** Defines a Filled-Triangle node. */ public final PrimitiveNode filledTriangleNode; /** Defines a Arrow node. */ public final PrimitiveNode arrowNode; /** Defines a Opened-Polygon node. */ public final PrimitiveNode openedPolygonNode; /** Defines a Opened-Dotted-Polygon node. */ public final PrimitiveNode openedDottedPolygonNode; /** Defines a Opened-Dashed-Polygon node. */ public final PrimitiveNode openedDashedPolygonNode; /** Defines a Opened-Thicker-Polygon node. */ public final PrimitiveNode openedThickerPolygonNode; /** Defines a Closed-Polygon node. */ public final PrimitiveNode closedPolygonNode; /** Defines a Filled-Polygon node. */ public final PrimitiveNode filledPolygonNode; /** Defines a Thick-Circle node. */ public final PrimitiveNode thickCircleNode; /** Defines a Solid arc. */ public final ArcProto solidArc; /** Defines a Dotted arc. */ public final ArcProto dottedArc; /** Defines a Dashed arc. */ public final ArcProto dashedArc; /** Defines a Thick arc. */ public final ArcProto thickerArc; /** the layer */ public final Layer defaultLayer; // -------------------- private and protected methods ------------------------ public Artwork(Generic generic) { super(generic, "artwork"); setTechShortName("Artwork"); setTechDesc("General-purpose artwork components"); setFactoryScale(2000, false); // in nanometers: really 2 micron setNonStandard(); setNonElectrical(); setNoNegatedArcs(); setStaticTechnology(); //**************************************** LAYERS **************************************** /** Graphics layer */ defaultLayer = Layer.newInstance(this, "Graphics", new EGraphics(false, false, null, 0, 0,0,0,0.8,true, new int[] {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff})); // The layer functions defaultLayer.setFunction(Layer.Function.ART, Layer.Function.NONELEC); // Graphics // The DXF names defaultLayer.setFactoryDXFLayer("OBJECT"); // Graphics //******************** ARCS ******************** /** Solid arc */ solidArc = newArcProto("Solid", 0, 0, ArcProto.Function.NONELEC, new Technology.ArcLayer(defaultLayer, 0, Poly.Type.FILLED) ); solidArc.setFactoryFixedAngle(false); solidArc.setCurvable(); solidArc.setWipable(); solidArc.setFactoryAngleIncrement(0); /** Dotted arc */ dottedArc = newArcProto("Dotted", 0, 0, ArcProto.Function.NONELEC, new Technology.ArcLayer(defaultLayer, 0, Poly.Type.OPENEDT1) ); dottedArc.setFactoryFixedAngle(false); dottedArc.setCurvable(); dottedArc.setWipable(); dottedArc.setFactoryAngleIncrement(0); /** Dashed arc */ dashedArc = newArcProto("Dashed", 0, 0, ArcProto.Function.NONELEC, new Technology.ArcLayer(defaultLayer, 0, Poly.Type.OPENEDT2) ); dashedArc.setFactoryFixedAngle(false); dashedArc.setCurvable(); dashedArc.setWipable(); dashedArc.setFactoryAngleIncrement(0); /** Thicker arc */ thickerArc = newArcProto("Thicker", 0, 0, ArcProto.Function.NONELEC, new Technology.ArcLayer(defaultLayer, 0, Poly.Type.OPENEDT3) ); thickerArc.setFactoryFixedAngle(false); thickerArc.setCurvable(); thickerArc.setWipable(); thickerArc.setFactoryAngleIncrement(0); //******************** RECTANGLE DESCRIPTIONS ******************** Technology.TechPoint [] box_1 = new Technology.TechPoint[] { new Technology.TechPoint(EdgeH.makeLeftEdge(), EdgeV.makeCenter()), new Technology.TechPoint(EdgeH.makeCenter(), EdgeV.makeTopEdge()), new Technology.TechPoint(EdgeH.makeRightEdge(), EdgeV.makeBottomEdge()), new Technology.TechPoint(EdgeH.makeCenter(), EdgeV.makeBottomEdge()), }; Technology.TechPoint [] box_2 = new Technology.TechPoint[] { new Technology.TechPoint(EdgeH.makeLeftEdge(), EdgeV.makeBottomEdge()), new Technology.TechPoint(new EdgeH(-0.125, 0), EdgeV.makeTopEdge()), new Technology.TechPoint(new EdgeH(0.125, 0), EdgeV.makeBottomEdge()), new Technology.TechPoint(EdgeH.makeRightEdge(), EdgeV.makeTopEdge()), }; Technology.TechPoint [] box_4 = new Technology.TechPoint[] { new Technology.TechPoint(EdgeH.makeLeftEdge(), EdgeV.makeBottomEdge()), new Technology.TechPoint(EdgeH.makeRightEdge(), EdgeV.makeBottomEdge()), new Technology.TechPoint(EdgeH.makeCenter(), EdgeV.makeTopEdge()), }; Technology.TechPoint [] box_6 = new Technology.TechPoint[] { new Technology.TechPoint(EdgeH.makeCenter(), EdgeV.makeCenter()), new Technology.TechPoint(EdgeH.makeRightEdge(), EdgeV.makeCenter()), }; //******************** NODES ******************** /** Pin */ pinNode = PrimitiveNode.newInstance0("Pin", this, 1, 1, new Technology.NodeLayer [] { new Technology.NodeLayer(defaultLayer, 0, Poly.Type.DISC, Technology.NodeLayer.POINTS, box_6) }); pinNode.addPrimitivePorts(new PrimitivePort[] { PrimitivePort.newInstance(this, pinNode, new ArcProto [] {solidArc, dottedArc, dashedArc, thickerArc}, "site", 0,180, 0, PortCharacteristic.UNKNOWN, EdgeH.makeCenter(), EdgeV.makeCenter(), EdgeH.makeCenter(), EdgeV.makeCenter()) }); pinNode.setFunction(PrimitiveNode.Function.PIN); pinNode.setArcsWipe(); pinNode.setArcsShrink(); /** Box */ boxNode = PrimitiveNode.newInstance0("Box", this, 6, 6, new Technology.NodeLayer [] { new Technology.NodeLayer(defaultLayer, 0, Poly.Type.CLOSED, Technology.NodeLayer.BOX, Technology.TechPoint.makeFullBox()) }); boxNode.addPrimitivePorts(new PrimitivePort[] { PrimitivePort.newInstance(this, boxNode, new ArcProto [] {solidArc, dottedArc, dashedArc, thickerArc}, "box", 180,0, 0, PortCharacteristic.UNKNOWN, EdgeH.makeLeftEdge(), EdgeV.makeBottomEdge(), EdgeH.makeRightEdge(), EdgeV.makeTopEdge()) }); boxNode.setFunction(PrimitiveNode.Function.ART); boxNode.setEdgeSelect(); /** Crossed-Box */ crossedBoxNode = PrimitiveNode.newInstance0("Crossed-Box", this, 6, 6, new Technology.NodeLayer [] { new Technology.NodeLayer(defaultLayer, 0, Poly.Type.CROSSED, Technology.NodeLayer.BOX, Technology.TechPoint.makeFullBox()) }); crossedBoxNode.addPrimitivePorts(new PrimitivePort[] { PrimitivePort.newInstance(this, crossedBoxNode, new ArcProto [] {solidArc, dottedArc, dashedArc, thickerArc}, "fbox", 180,0, 0, PortCharacteristic.UNKNOWN, EdgeH.makeLeftEdge(), EdgeV.makeBottomEdge(), EdgeH.makeRightEdge(), EdgeV.makeTopEdge()) }); crossedBoxNode.setFunction(PrimitiveNode.Function.ART); /** Filled-Box */ filledBoxNode = PrimitiveNode.newInstance0("Filled-Box", this, 6, 6, new Technology.NodeLayer [] { new Technology.NodeLayer(defaultLayer, 0, Poly.Type.FILLED, Technology.NodeLayer.BOX, Technology.TechPoint.makeFullBox()) }); filledBoxNode.addPrimitivePorts(new PrimitivePort[] { PrimitivePort.newInstance(this, filledBoxNode, new ArcProto [] {solidArc, dottedArc, dashedArc, thickerArc}, "fbox", 180,0, 0, PortCharacteristic.UNKNOWN, EdgeH.makeLeftEdge(), EdgeV.makeBottomEdge(), EdgeH.makeRightEdge(), EdgeV.makeTopEdge()) }); filledBoxNode.setFunction(PrimitiveNode.Function.ART); filledBoxNode.setEdgeSelect(); /** Circle */ circleNode = PrimitiveNode.newInstance0("Circle", this, 6, 6, new Technology.NodeLayer [] { new Technology.NodeLayer(defaultLayer, 0, Poly.Type.CIRCLE, Technology.NodeLayer.POINTS, box_6) }); circleNode.addPrimitivePorts(new PrimitivePort[] { PrimitivePort.newInstance(this, circleNode, new ArcProto [] {solidArc, dottedArc, dashedArc, thickerArc}, "site", 0,180, 0, PortCharacteristic.UNKNOWN, EdgeH.makeLeftEdge(), EdgeV.makeBottomEdge(), EdgeH.makeRightEdge(), EdgeV.makeTopEdge()) }); circleNode.setFunction(PrimitiveNode.Function.ART); circleNode.setEdgeSelect(); /** Filled-Circle */ filledCircleNode = PrimitiveNode.newInstance0("Filled-Circle", this, 6, 6, new Technology.NodeLayer [] { new Technology.NodeLayer(defaultLayer, 0, Poly.Type.DISC, Technology.NodeLayer.POINTS, box_6) }); filledCircleNode.addPrimitivePorts(new PrimitivePort[] { PrimitivePort.newInstance(this, filledCircleNode, new ArcProto [] {solidArc, dottedArc, dashedArc, thickerArc}, "site", 0,180, 0, PortCharacteristic.UNKNOWN, EdgeH.makeLeftEdge(), EdgeV.makeBottomEdge(), EdgeH.makeRightEdge(), EdgeV.makeTopEdge()) }); filledCircleNode.setFunction(PrimitiveNode.Function.ART); filledCircleNode.setSquare(); filledCircleNode.setEdgeSelect(); /** Spline */ splineNode = PrimitiveNode.newInstance0("Spline", this, 6, 6, new Technology.NodeLayer [] { new Technology.NodeLayer(defaultLayer, 0, Poly.Type.OPENED, Technology.NodeLayer.POINTS, box_2) }); splineNode.addPrimitivePorts(new PrimitivePort[] { PrimitivePort.newInstance(this, splineNode, new ArcProto [] {solidArc, dottedArc, dashedArc, thickerArc}, "site", 0,180, 0, PortCharacteristic.UNKNOWN, EdgeH.makeLeftEdge(), EdgeV.makeBottomEdge(), EdgeH.makeRightEdge(), EdgeV.makeTopEdge()) }); splineNode.setFunction(PrimitiveNode.Function.ART); splineNode.setHoldsOutline(); splineNode.setEdgeSelect(); /** Triangle */ triangleNode = PrimitiveNode.newInstance0("Triangle", this, 6, 6, new Technology.NodeLayer [] { new Technology.NodeLayer(defaultLayer, 0, Poly.Type.CLOSED, Technology.NodeLayer.POINTS, box_4) }); triangleNode.addPrimitivePorts(new PrimitivePort[] { PrimitivePort.newInstance(this, triangleNode, new ArcProto [] {solidArc, dottedArc, dashedArc, thickerArc}, "triangle", 180,0, 0, PortCharacteristic.UNKNOWN, EdgeH.makeLeftEdge(), EdgeV.makeBottomEdge(), EdgeH.makeRightEdge(), EdgeV.makeTopEdge()) }); triangleNode.setFunction(PrimitiveNode.Function.ART); triangleNode.setEdgeSelect(); /** Filled-Triangle */ filledTriangleNode = PrimitiveNode.newInstance0("Filled-Triangle", this, 6, 6, new Technology.NodeLayer [] { new Technology.NodeLayer(defaultLayer, 0, Poly.Type.FILLED, Technology.NodeLayer.POINTS, box_4) }); filledTriangleNode.addPrimitivePorts(new PrimitivePort[] { PrimitivePort.newInstance(this, filledTriangleNode, new ArcProto [] {solidArc, dottedArc, dashedArc, thickerArc}, "ftriangle", 180,0, 0, PortCharacteristic.UNKNOWN, EdgeH.makeLeftEdge(), EdgeV.makeBottomEdge(), EdgeH.makeRightEdge(), EdgeV.makeTopEdge()) }); filledTriangleNode.setFunction(PrimitiveNode.Function.ART); filledTriangleNode.setEdgeSelect(); /** Arrow */ arrowNode = PrimitiveNode.newInstance0("Arrow", this, 2, 2, new Technology.NodeLayer [] { new Technology.NodeLayer(defaultLayer, 0, Poly.Type.OPENED, Technology.NodeLayer.POINTS, new Technology.TechPoint[] { new Technology.TechPoint(EdgeH.makeLeftEdge(), EdgeV.makeTopEdge()), new Technology.TechPoint(EdgeH.makeRightEdge(), EdgeV.makeCenter()), new Technology.TechPoint(EdgeH.makeLeftEdge(), EdgeV.makeBottomEdge()), }) }); arrowNode.addPrimitivePorts(new PrimitivePort[] { PrimitivePort.newInstance(this, arrowNode, new ArcProto [] {solidArc, dottedArc, dashedArc, thickerArc}, "arrow", 0,180, 0, PortCharacteristic.UNKNOWN, EdgeH.makeRightEdge(), EdgeV.makeCenter(), EdgeH.makeRightEdge(), EdgeV.makeCenter()) }); arrowNode.setFunction(PrimitiveNode.Function.ART); arrowNode.setEdgeSelect(); /** Opened-Polygon */ openedPolygonNode = PrimitiveNode.newInstance0("Opened-Polygon", this, 6, 6, new Technology.NodeLayer [] { new Technology.NodeLayer(defaultLayer, 0, Poly.Type.OPENED, Technology.NodeLayer.POINTS, box_2) }); openedPolygonNode.addPrimitivePorts(new PrimitivePort[] { PrimitivePort.newInstance(this, openedPolygonNode, new ArcProto [] {solidArc, dottedArc, dashedArc, thickerArc}, "site", 0,180, 0, PortCharacteristic.UNKNOWN, EdgeH.makeLeftEdge(), EdgeV.makeBottomEdge(), EdgeH.makeRightEdge(), EdgeV.makeTopEdge()) }); openedPolygonNode.setFunction(PrimitiveNode.Function.ART); openedPolygonNode.setHoldsOutline(); openedPolygonNode.setEdgeSelect();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -