public final class EPoint
extends java.awt.geom.Point2D
implements java.io.Serializable
EPoint
immutable class defines a point representing
a location in (x, y) coordinate space. This class extends abstract
class Point2D. This class is used in Electric database.
Coordiates are snapped to grid according to DBMath.round
method.Modifier and Type | Field and Description |
---|---|
static EPoint |
ORIGIN
EPoint with both zero coordinates.
|
Constructor and Description |
---|
EPoint(double lambdaX,
double lambdaY)
Constructs and initializes a
EPoint with the
specified coordinates in lambda units snapped to the grid. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(EPoint that)
Returns true if this EPoint is equal to the other EPoint.
|
static EPoint |
fromGrid(long gridX,
long gridY)
Returns
EPoint with specified grid coordinates. |
static EPoint |
fromLambda(double lambdaX,
double lambdaY)
Returns
EPoint with specified grid coordinates. |
long |
getGridX()
Returns the X coordinate of this
EPoint
in grid units in long precision. |
long |
getGridY()
Returns the Y coordinate of this
EPoint
in grid units in long precision. |
double |
getLambdaX()
Returns the X coordinate of this
EPoint
in lambda units in double precision. |
double |
getLambdaY()
Returns the Y coordinate of this
EPoint
in lambda units in double precision. |
double |
getX()
Returns the X coordinate of this
EPoint
in lambda units in double precision. |
double |
getY()
Returns the Y coordinate of this
EPoint
in lambda unuts in double precision. |
double |
gridDistance(EPoint pt)
Returns the distance from this
EPoint to a
specified EPoint in grid units. |
java.awt.geom.Point2D.Double |
gridMutable()
Creates mutable
Point2D.Double from the EPoint in grid units. |
boolean |
isSmall()
Returns true if both coordinates of this EPoint are "small ints".
|
double |
lambdaDistance(EPoint pt)
Returns the distance from this
EPoint to a
specified EPoint in lambda units. |
java.awt.geom.Point2D.Double |
lambdaMutable()
Creates mutable
Point2D.Double from the EPoint in lambda units. |
static void |
printStatistics()
Prints statistics about EPoint objects.
|
void |
setLocation(double x,
double y)
This method overrides
Point2D.setLocation method. |
static EPoint |
snap(java.awt.geom.Point2D p)
Returns
EPoint from specified Point2D
snapped to the grid. |
java.lang.String |
toString()
Returns a
String that represents the value
of this EPoint . |
public static final EPoint ORIGIN
public EPoint(double lambdaX, double lambdaY)
EPoint
with the
specified coordinates in lambda units snapped to the grid.lambdaX
- the x-coordinate to which to set the newly
constructed EPoint
in lambda units.lambdaY
- the y-coordinate to which to set the newly
constructed EPoint
in lambda units.public static EPoint fromLambda(double lambdaX, double lambdaY)
EPoint
with specified grid coordinates.lambdaX
- the x-coordinate in lambda units.lambdaY
- the y-coordinate in lambda units.public static EPoint fromGrid(long gridX, long gridY)
EPoint
with specified grid coordinates.gridX
- the x-coordinate in grid units.gridY
- the y-coordinate in grid units.public static EPoint snap(java.awt.geom.Point2D p)
EPoint
from specified Point2D
snapped to the grid.p
- specified Point2Dpublic double getX()
EPoint
in lambda units in double
precision.getX
in class java.awt.geom.Point2D
EPoint
.public double getY()
EPoint
in lambda unuts in double
precision.getY
in class java.awt.geom.Point2D
EPoint
.public double getLambdaX()
EPoint
in lambda units in double
precision.EPoint
.public double getLambdaY()
EPoint
in lambda units in double
precision.EPoint
.public long getGridX()
EPoint
in grid units in long
precision.EPoint
.public long getGridY()
EPoint
in grid units in long
precision.EPoint
.public void setLocation(double x, double y)
Point2D.setLocation
method.
It throws UnsupportedOperationException.setLocation
in class java.awt.geom.Point2D
x
- the x-coordinate to which to set this EPoint
y
- the y-coordinate to which to set this EPoint
java.lang.UnsupportedOperationException
public java.awt.geom.Point2D.Double lambdaMutable()
Point2D.Double
from the EPoint
in lambda units.public java.awt.geom.Point2D.Double gridMutable()
Point2D.Double
from the EPoint
in grid units.public double lambdaDistance(EPoint pt)
EPoint
to a
specified EPoint
in lambda units.pt
- the specified EPoint
EPoint
and
the specified Point
in lambdaUnits.public double gridDistance(EPoint pt)
EPoint
to a
specified EPoint
in grid units.pt
- the specified EPoint
EPoint
and
the specified Point
in gridUnits.public boolean isSmall()
GenMath.MIN_SMALL_COORD
,
GenMath.MAX_SMALL_COORD
public boolean equals(EPoint that)
equals
,
but it could be a little faster, because no virtual method dispatching is required.Point2D.equals(java.lang.Object)
public java.lang.String toString()
String
that represents the value
of this EPoint
.toString
in class java.lang.Object
EPoint
.public static void printStatistics()