|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.fhstralsund.vinets.geometry.NetElementGeometry
public class NetElementGeometry
Models the geometric aspects of a NetElement as positon and size. These values are manipulated usually by layout algorithms.
The values apply to a virtual coordinate system with coordinates ranging from 0 to MAX_X and MAX_Y for x- and y-values, respectively. Accordingly, all changes of the geometry are guaranteed to meet these constraints.
Coordinates are considered as equal if they differ by EPS or less.
Usually, the top level graph in the VinetS editor has width and height equal to MAX_X and MAX_Y, respectively. Any other NetElement has coordinates in the local graph space of its host and thus smaller values (since it is contained geometrically in the host.) But, if a Block has an inner Graph, its own inner graph space (which is used as coordinate system for the contained NetElements) has again dimension MAX_X times MAX_Y.
All methods that set coordinates guarantee that the values of all corners are always on the rectangular grid defined by the host of this NetElement if grid snapping is on for the host.
Field Summary | |
---|---|
static double |
EPS
The precision. |
static double |
MAX_X
The maximum x-coordinate. |
static double |
MAX_Y
The maximum y-coordinate. |
protected double |
x
The x-coordinate of the left upper corner of the bounding box of this NetElement in the relative coordinate system of its host. |
protected double |
y
The y-coordinate of the left upper corner of the bounding box of this NetElement in the relative coordinate system of its host. |
Constructor Summary | |
---|---|
NetElementGeometry(NetElement owner)
Constructs a new NetElementGeometry at position (0,0) with width and height being 0 as well. |
|
NetElementGeometry(NetElement owner,
boolean ignored)
Convenience constructor that constructs a new NetElementGeometry at position (0,0) with width=MAX_X and height=MAX_Y. |
|
NetElementGeometry(NetElement owner,
double x,
double y)
Constructs a new NetElementGeometry at the given position in the relative coordinate system of the host of this NetElement with width and height being 0. |
|
NetElementGeometry(NetElement owner,
double x,
double y,
double width,
double height)
Constructs a new NetElementGeometry at the given position and size in the relative coordinate system of the host of this NetElement. |
|
NetElementGeometry(NetElement owner,
java.awt.geom.Point2D origin)
Constructs a new NetElementGeometry at the given position in the relative coordinate system of the host of this NetElement with width and height being 0. |
|
NetElementGeometry(NetElement owner,
java.awt.geom.Point2D origin,
java.awt.geom.Dimension2D size)
Constructs a new NetElementGeometry at the given position and size in the relative coordinate system of the host of this NetElement. |
Method Summary | |
---|---|
java.lang.Object |
clone()
Creates and returns a copy of this NetElementGeometry. |
static boolean |
equals(double one,
double two)
Compares two double values for equality upto EPS. |
boolean |
equals(java.lang.Object obj)
Indicates whether some other Object is equal to this NetElementGeometry. |
double |
getGlobalHeight()
Returns the height of this NetElementGeometry in the global coordinate system of the host of its owner. |
java.awt.geom.Point2D |
getGlobalPosition()
Returns the position of this NetElementGeometry in the global coordinate system of the host of its owner (that is, the graph space coordinates for an inner block). |
java.awt.geom.Dimension2D |
getGlobalSize()
Returns the size of this NetElementGeometry in the global coordinate system of the host of its owner. |
double |
getGlobalWidth()
Returns the width of this NetElementGeometry in the global coordinate system of the host of its owner. |
double |
getGlobalX()
Returns the x-coordinate of this NetElementGeometry in the global coordinate system of the host of its owner. |
double |
getGlobalY()
Returns the y-coordinate of this NetElementGeometry in the global coordinate system of the host of its owner. |
double |
getHeight()
Returns the height in y-direction. |
NetElement |
getOwner()
Getter for property owner. |
java.awt.geom.Point2D |
getPosition()
Returns the coordinates. |
java.awt.geom.Dimension2D |
getSize()
Returns the size. |
java.awt.geom.AffineTransform |
getToGlobalTransform()
The returned transform matrix can be used to transform the local coordinates of any point contained in this NetElementGeometry into the coordinates system of the host of its owner. |
java.awt.geom.AffineTransform |
getToLocalTransform()
The returned transform matrix can be used to transform global graph coordinates into local coordinates of the owner of this geometry. |
double |
getWidth()
Returns the width in x-direction. |
double |
getX()
Returns the x-coordinate of the left upper corner. |
double |
getXGrid()
Getter for property xGrid. |
double |
getY()
Returns the y-coordinate of the left upper corner. |
double |
getYGrid()
Getter for property yGrid. |
int |
hashCode()
Returns a hash code value for this NetElementGeometry. |
boolean |
isGridSnappingOn()
Getter for property gridSnappingOn. |
void |
setGridSnappingOn(boolean gridSnappingOn)
Setter for property gridSnappingOn. |
void |
setHeight(double value)
Sets the height. |
void |
setOwner(NetElement el)
Restricted setter for property owner. |
void |
setPosition(java.awt.geom.Point2D pos)
Sets the position. |
void |
setSize(java.awt.geom.Dimension2D size)
Sets the size. |
void |
setSize(double width,
double height)
Sets the size. |
void |
setWidth(double value)
Sets the width. |
void |
setX(double value)
Sets the x-coordinate. |
void |
setXGrid(double xGrid)
Setter for property xGrid. |
void |
setY(double value)
Sets the y-coordinate. |
void |
setYGrid(double yGrid)
Setter for property yGrid. |
java.lang.String |
toString()
Returns a String representation of the NetElementGeometry. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final double EPS
public static final double MAX_X
public static final double MAX_Y
protected double x
protected double y
Constructor Detail |
---|
public NetElementGeometry(NetElement owner, double x, double y)
owner
- the NetElement to which this geometry belongs.x
- the x-coordinate of the left upper corner.y
- the y-coordinate of the left upper corner.public NetElementGeometry(NetElement owner, double x, double y, double width, double height)
owner
- the NetElement to which this geometry belongs.x
- the x-coordinate of the left upper corner.y
- the y-coordinate of the left upper corner.width
- the width of the bounding box in x-direction.height
- the height of the bounding box in y-direction.public NetElementGeometry(NetElement owner)
owner
- the NetElement to which this geometry belongs.public NetElementGeometry(NetElement owner, boolean ignored)
owner
- the NetElement to which this geometry belongs.ignored
- dummy to identify this special constructor.public NetElementGeometry(NetElement owner, java.awt.geom.Point2D origin)
owner
- the NetElement to which this geometry belongs.origin
- the coordinates of the left upper corner.public NetElementGeometry(NetElement owner, java.awt.geom.Point2D origin, java.awt.geom.Dimension2D size)
owner
- the NetElement to which this geometry belongs.origin
- the coordinates of the left upper corner.size
- the distance of the right bottom corner from the origin.Method Detail |
---|
public void setX(double value)
value
- the x-coordinate.public double getX()
public void setY(double value)
value
- the y-coordinate.public double getY()
public void setPosition(java.awt.geom.Point2D pos)
pos
- the coordinates of the left upper corner.public java.awt.geom.Point2D getPosition()
public void setWidth(double value)
value
- the width.public double getWidth()
public void setHeight(double value)
value
- the height.public double getHeight()
public void setSize(java.awt.geom.Dimension2D size)
size
- the width in x-direction and the height in y-direction.public java.awt.geom.Dimension2D getSize()
public void setSize(double width, double height)
width
- the width in x-direction.height
- the height in y-direction.public java.awt.geom.AffineTransform getToGlobalTransform()
IllegalStateExcpetion
- if the owner does not have a host.public java.awt.geom.AffineTransform getToLocalTransform()
getToGlobalTransform()
.
IllegalStateExcpetion
- if the owner does not have a host.public java.awt.geom.Point2D getGlobalPosition()
IllegalStateExcpetion
- if the owner does not have a host.public double getGlobalX()
IllegalStateExcpetion
- if the owner does not have a host.public double getGlobalY()
IllegalStateExcpetion
- if the owner does not have a host.public java.awt.geom.Dimension2D getGlobalSize()
IllegalStateExcpetion
- if the owner does not have a host.public double getGlobalWidth()
IllegalStateExcpetion
- if the owner does not have a host.public double getGlobalHeight()
IllegalStateExcpetion
- if the owner does not have a host.public boolean isGridSnappingOn()
public void setGridSnappingOn(boolean gridSnappingOn)
gridSnappingOn
- new value of property gridSnappingOn.public double getXGrid()
public void setXGrid(double xGrid)
xGrid
- the distance between vertical grid lines.public double getYGrid()
public void setYGrid(double yGrid)
yGrid
- the distance between horizontal grid lines.public NetElement getOwner()
public void setOwner(NetElement el)
el
- the new owner.
java.lang.UnsupportedOperationException
- if the current owner
is not null.public java.lang.Object clone()
clone
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the reference Object with which to compare.
Object.equals(Object)
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public static boolean equals(double one, double two)
one
- first value to be compared.two
- second value to be compared.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |