com.sun.electric.technology
Class SizeOffset

java.lang.Object
  extended by com.sun.electric.technology.SizeOffset
All Implemented Interfaces:
java.io.Serializable

public class SizeOffset
extends java.lang.Object
implements java.io.Serializable

The SizeOffset object describes the difference between the stored bounds of a NodeInst and the displayed/selected bounds.

In Electric, extra space may surround a NodeInst, in order to leave room for expansion of the definition. For example, in the MOCMOS technology, a metal-1/metal-2 contact is 5x5 (in memory) but when displayed, it is only 4x4. The extra space does not scale, meaning that if you stretch the node so that it appears to be 10x10, then it will be 11x11 in memory.

The distance from each edge is stored in a SizeOffset object. For the Via described above, all four offsets would be 0.5 to indicate a half-unit surround between the stored and displayed/selected bounds.

See Also:
Serialized Form

Field Summary
static SizeOffset ZERO_OFFSET
          Offset with all zero distances.
 
Constructor Summary
SizeOffset(double lx, double hx, double ly, double hy)
          Constructor to create a SizeOffset from the specified parameters.
 
Method Summary
 long getHighXGridOffset()
          Method to return the high-X offset of this SizeOffset in grid units.
 double getHighXOffset()
          Method to return the high-X offset of this SizeOffset.
 long getHighYGridOffset()
          Method to return the high-Y offset of this SizeOffset in grid units.
 double getHighYOffset()
          Method to return the high-Y offset of this SizeOffset.
 long getLowXGridOffset()
          Method to return the low-X offset of this SizeOffset in grid units.
 double getLowXOffset()
          Method to return the low-X offset of this SizeOffset.
 long getLowYGridOffset()
          Method to return the low-Y offset of this SizeOffset in grid units.
 double getLowYOffset()
          Method to return the low-Y offset of this SizeOffset.
 java.awt.geom.Rectangle2D modifyBounds(java.awt.geom.Rectangle2D bounds)
          Returns a Rectangle2D representing bounds modified by this size offset.
 java.lang.String toString()
          Returns a printable version of this SizeOffset.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ZERO_OFFSET

public static final SizeOffset ZERO_OFFSET
Offset with all zero distances.

Constructor Detail

SizeOffset

public SizeOffset(double lx,
                  double hx,
                  double ly,
                  double hy)
Constructor to create a SizeOffset from the specified parameters.

Parameters:
lx - the low-X offset (distance from left side to actual bounds).
hx - the high-X offset (distance from left side to actual bounds).
ly - the low-Y offset (distance from bottom side to actual bounds).
hy - the high-Y offset (distance from top side to actual bounds).
Method Detail

getLowXOffset

public double getLowXOffset()
Method to return the low-X offset of this SizeOffset. The low-X offset is the distance from the left side to the acutal bounds.

Returns:
the low-X offset of this SizeOffset.

getHighXOffset

public double getHighXOffset()
Method to return the high-X offset of this SizeOffset. The high-X offset is the distance from the right side to the acutal bounds.

Returns:
the high-X offset of this SizeOffset.

getLowYOffset

public double getLowYOffset()
Method to return the low-Y offset of this SizeOffset. The low-Y offset is the distance from the bottom side to the acutal bounds.

Returns:
the low-Y offset of this SizeOffset.

getHighYOffset

public double getHighYOffset()
Method to return the high-Y offset of this SizeOffset. The high-Y offset is the distance from the top side to the acutal bounds.

Returns:
the high-Y offset of this SizeOffset.

getLowXGridOffset

public long getLowXGridOffset()
Method to return the low-X offset of this SizeOffset in grid units. The low-X offset is the distance from the left side to the acutal bounds.

Returns:
the low-X offset of this SizeOffset.

getHighXGridOffset

public long getHighXGridOffset()
Method to return the high-X offset of this SizeOffset in grid units. The high-X offset is the distance from the right side to the acutal bounds.

Returns:
the high-X offset of this SizeOffset.

getLowYGridOffset

public long getLowYGridOffset()
Method to return the low-Y offset of this SizeOffset in grid units. The low-Y offset is the distance from the bottom side to the acutal bounds.

Returns:
the low-Y offset of this SizeOffset.

getHighYGridOffset

public long getHighYGridOffset()
Method to return the high-Y offset of this SizeOffset in grid units. The high-Y offset is the distance from the top side to the acutal bounds.

Returns:
the high-Y offset of this SizeOffset.

toString

public java.lang.String toString()
Returns a printable version of this SizeOffset.

Overrides:
toString in class java.lang.Object
Returns:
a printable version of this SizeOffset.

modifyBounds

public java.awt.geom.Rectangle2D modifyBounds(java.awt.geom.Rectangle2D bounds)
Returns a Rectangle2D representing bounds modified by this size offset. Note here that I use the convention that +x is to the left and +y is up, whereas in Java components +y is down.

Parameters:
bounds - the bounds to be modified
Returns:
the modified bounds