|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.electric.tool.generator.layout.LayoutLib
public class LayoutLib
Nested Class Summary | |
---|---|
static class |
LayoutLib.Corner
|
Field Summary | |
---|---|
static double |
DEF_SIZE
Use the default size. |
Constructor Summary | |
---|---|
LayoutLib()
|
Method Summary | |
---|---|
static void |
abutBottom(NodeInst node,
double originX,
double botY)
Move a NodeInst so it's bottom edge is at botY . |
static void |
abutBottomTop(java.util.Collection<NodeInst> nodeInsts,
double space)
Abut a list of NodeInsts bottom to top. |
static void |
abutBottomTop(double originX,
double botY,
java.util.Collection<NodeInst> nodeInsts,
double space)
Abut a list of NodeInsts bottom to top. |
static void |
abutBottomTop(NodeInst bottomNode,
double space,
NodeInst topNode)
Abut two NodeInsts bottom to top. |
static void |
abutLeft(NodeInst node,
double leftX,
double originY)
Move NodeInst so it's left edge is at leftX and
the y-coordinate of it's origin is at
originY . |
static void |
abutLeftRight(java.util.Collection<NodeInst> nodeInsts)
Abut an array of NodeInsts left to right. |
static void |
abutLeftRight(double leftX,
double originY,
java.util.Collection<NodeInst> nodeInsts)
Abut an array of NodeInsts left to right. |
static void |
abutLeftRight(NodeInst leftNode,
NodeInst rightNode)
Abut two NodeInsts left to right. |
static void |
alignCorners(NodeInst niFixed,
LayoutLib.Corner cnrFixed,
NodeInst niMove,
LayoutLib.Corner cnrMove,
double offsetX,
double offsetY)
|
static java.awt.geom.Rectangle2D |
calculateNodeInst(NodeProto np,
double x,
double y,
double width,
double height)
|
static void |
error(boolean errorHasOccurred,
java.lang.String msg)
Print a message, dump a stack trace, and throw a RuntimeException if errorHasOccurred argument is true. |
static java.util.Iterator<ArcInst> |
getArcInstsOnPortInst(PortInst pi)
Return a list of ArcInsts attached to PortInst, pi. |
static double |
getArcInstWidth(ArcInst ai)
Get the width of an ArcInst. |
static java.awt.geom.Rectangle2D |
getBounds(Cell c)
Get the essential or regular bounds. |
static java.awt.geom.Rectangle2D |
getBounds(Cell cell,
Layer.Function function)
Get the bounding box for the layer in the Cell. |
static java.awt.geom.Rectangle2D |
getBounds(NodeInst node)
Get the essential or regular bounds. |
static double |
getNodeProtoHeight(NodeProto np)
Get the default height of a NodeProto. |
static double |
getNodeProtoWidth(NodeProto np)
Get the default width of a NodeProto. |
static java.awt.geom.Point2D |
getPosition(NodeInst ni)
Get the position of a NodeInst. |
static void |
modNodeInst(NodeInst ni,
double dx,
double dy,
double dw,
double dh,
boolean mirrorAboutYAxis,
boolean mirrorAboutXAxis,
double dAngle)
Modify the position of a NodeInst. |
static ArcInst |
newArcInst(ArcProto ap,
double width,
PortInst head,
double hX,
double hY,
PortInst tail,
double tX,
double tY)
Create a new ArcInst. |
static ArcInst |
newArcInst(ArcProto ap,
double width,
PortInst head,
PortInst tail)
Create a new ArcInst. |
static Export |
newExport(Cell cell,
java.lang.String name,
PortCharacteristic role,
ArcProto ap,
double w,
double x,
double y)
Create an export for a particular layer. |
static NodeInst |
newNodeInst(NodeProto np,
double x,
double y,
double width,
double height,
double angle,
Cell parent)
Create a new NodeInst. |
static NodeInst |
newNodeInst(NodeProto np,
java.awt.geom.Rectangle2D rect,
double angle,
Cell parent)
|
static Library |
openLibForRead(java.lang.String libFileName)
Open a library for reading. |
static Library |
openLibForWrite(java.lang.String libName)
Open a library for modification. |
static java.awt.geom.Rectangle2D |
roundBounds(java.awt.geom.Rectangle2D r)
|
static double |
roundCenterX(PortInst pi)
The center returned by bounds might have a slight amount of rounding error. |
static double |
roundCenterY(PortInst pi)
|
static double |
widestWireWidth(PortInst port)
Find the width of the widest wire connected hierarchically to port. |
static void |
writeLibrary(Library lib)
Write a library in JELIB format. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final double DEF_SIZE
Constructor Detail |
---|
public LayoutLib()
Method Detail |
---|
public static void error(boolean errorHasOccurred, java.lang.String msg)
errorHasOccurred
- indicates a runtime error has been detectedmsg
- the message to print when an error occurs
java.lang.RuntimeException
- if errorHasOccurred is truepublic static Library openLibForRead(java.lang.String libFileName)
libFileName
- the fully qualified path name of the Library
file on disk
public static Library openLibForWrite(java.lang.String libName)
libName
- the name of the Library
file on disk
public static void writeLibrary(Library lib)
lib
- the library to be written.public static double getArcInstWidth(ArcInst ai)
ai
- the ArcInst whose width is reported
public static double getNodeProtoWidth(NodeProto np)
np
- the NodeProto we want the width of.
public static double getNodeProtoHeight(NodeProto np)
np
- the NodeProto we want the height of
public static double widestWireWidth(PortInst port)
port
- the PortInst to check for attached wires.
public static java.util.Iterator<ArcInst> getArcInstsOnPortInst(PortInst pi)
pi
- PortInst on which to find attached ArcInsts.public static double roundCenterX(PortInst pi)
public static double roundCenterY(PortInst pi)
public static java.awt.geom.Rectangle2D calculateNodeInst(NodeProto np, double x, double y, double width, double height)
public static NodeInst newNodeInst(NodeProto np, double x, double y, double width, double height, double angle, Cell parent)
np
- the NodeProto to instantiatewidth
- the desired width of the NodeInstheight
- the desired height of the NodeInstx
- the desired x-coordinate of the NodeProto's origin in
the coordinate space of the parent. If x is negative then the
NodeInst mirrors about the y-axis.y
- the desired y-coordinate of the NodeProto's origin in
the coordinate space of the parent. If y is negative then the
NodeInst mirrors about the x-axis.angle
- the angle, in degrees, of rotation about the
NodeProto's origin.parent
- the Cell that will contain the NodeInst.
public static NodeInst newNodeInst(NodeProto np, java.awt.geom.Rectangle2D rect, double angle, Cell parent)
public static void modNodeInst(NodeInst ni, double dx, double dy, double dw, double dh, boolean mirrorAboutYAxis, boolean mirrorAboutXAxis, double dAngle)
The modNodeInst method differs from NodeInst.modifyInstance in the following ways:
ni
- the NodeInst to modifydx
- the amount by which to change the x-coordinate of the
NodeInst's positiondy
- the amount by which to change the y-coordinate of the
NodeInst's positiondw
- the amount by which to change to absolute value of
the NodeInst's widthdh
- the amount by which to change to absolute value of
the NodeInst's height.mirrorAboutYAxis
- if true then toggle the mirroring of
the NodeInst about the y-axismirrorAboutXAxis
- if true then toggle the mirroring of
the NodeInst about the x-axisdAngle
- the amount by which to change the NodeInst's anglepublic static java.awt.geom.Point2D getPosition(NodeInst ni)
ni
- the NodeInst we want the position of
public static ArcInst newArcInst(ArcProto ap, double width, PortInst head, double hX, double hY, PortInst tail, double tX, double tY)
ap
- the ArcProto to instantiatewidth
- the desired width of the ArcInsthead
- the head PortInsthX
- the x-coordinate of the head PortInsthY
- the y-coordinate of the head PortInsttail
- the tail PortInsttX
- the x-coordinate of the tail PortInsttY
- the y-coordinate of the tail PortInst
public static ArcInst newArcInst(ArcProto ap, double width, PortInst head, PortInst tail)
Connect the new ArcInst to the centers of the PortInsts. If the centers don't share an X or y-coordinate then connect the head and the tail using two ArcInsts. The ArcInst attached to the head is horizontal and the ArcInst attached to the tail is vertical.
ap
- the head PortInstwidth
- the desired width of the ArcInsthead
- the head ArcInsttail
- the tail ArcInst
public static Export newExport(Cell cell, java.lang.String name, PortCharacteristic role, ArcProto ap, double w, double x, double y)
At the coordinates (x, y)
create a NodeInst of
a layer-pin for the layer ap
. Export that
layer-pin's PortInst.
Attach an ArcInst of ArcProto ap to the layer-pin. The ArcInst is useful because Electric uses the widest ArcInst on a PortInst as a hint for the width to use for all future arcs. Because Electric doesn't use the size of layer-pins as width hints, the layer-pin is created in it's default size.
newExport
seems very specialized, but it's
nearly the only one I use when generating layout.
cell
- the Cell to which to add the Export.name
- the name of the Export.role
- the Export's type.ap
- the ArcProto indicating the layer on which to create
the Export.w
- width of the ArcInst serving as a hint.x
- the x-coordinate of the layer pin.y
- the y-coordinate of the layer pin.public static java.awt.geom.Rectangle2D roundBounds(java.awt.geom.Rectangle2D r)
public static java.awt.geom.Rectangle2D getBounds(NodeInst node)
node
has an Essential Bounds then return
it. Otherwise return the regular bounds.
node
- the NodeInst.
public static java.awt.geom.Rectangle2D getBounds(Cell c)
c
- the Cell.
public static void abutLeft(NodeInst node, double leftX, double originY)
leftX
and
the y-coordinate of it's origin is at
originY
. Don't alter the NodeInst's scale or
rotation.
node
- the NodeInstleftX
- desired x-coordinate of left edge of node
.originY
- desired y-coordinate of node
's originpublic static void abutLeftRight(double leftX, double originY, java.util.Collection<NodeInst> nodeInsts)
leftX
and it the
y-coordinate of its origin is at originY
. Abut the
remaining nodes left to right. Don't alter any NodeInst's
scale or rotation.
leftX
- desired x-coordinate of left edge of 0th NodeInst.originY
- desired y-coordinate of all NodeInst originsnodeInsts
- the ArrayList of NodeInsts.public static void abutLeftRight(NodeInst leftNode, NodeInst rightNode)
rightNode
so its left edge coincides with leftNode
's right
edge, and the y-coordinate of rightNode
's is equal
to the y-coordinate of leftNode
's origin. Don't
move leftNode
. Don't alter any node's scale or
rotation.
leftNode
- the NodeInst that doesn't move.rightNode
- the NodeInst that is moved to butt against
leftNode.public static void abutLeftRight(java.util.Collection<NodeInst> nodeInsts)
nodeInsts
- the ArrayList of NodeInstspublic static void abutBottom(NodeInst node, double originX, double botY)
botY
.
Place node
's origin at
originX
. Don't alter node
's scale or
rotation.
node
- the NodeInst to moveoriginX
- desired x-coordinate of NodeInst's originbotY
- desired y-coordinate of bottom edge of NodeInstpublic static void abutBottomTop(NodeInst bottomNode, double space, NodeInst topNode)
topNode
so
its bottom edge coincides with bottomNode
's top
edge, and the y-coordinate of topNode
's origin is
equal to the y-coorinate of bottomNode
's
origin. Don't move bottomNode
. Don't alter any
node's scale or rotation.
public static void abutBottomTop(double originX, double botY, java.util.Collection<NodeInst> nodeInsts, double space)
originX
- desired x-coordinate of all NodeInst reference points.
Lambda units.botY
- desired y-coordinate of bottom edge of first NodeInst.nodeInsts
- Collection of NodeInsts to abut.public static void abutBottomTop(java.util.Collection<NodeInst> nodeInsts, double space)
nodeInsts
- the list of NodeInsts to abut.public static void alignCorners(NodeInst niFixed, LayoutLib.Corner cnrFixed, NodeInst niMove, LayoutLib.Corner cnrMove, double offsetX, double offsetY)
public static java.awt.geom.Rectangle2D getBounds(Cell cell, Layer.Function function)
cell
- the cell to examinefunction
- the layer's function
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |