com.mapinfo.midev.geometry

## Class DirectPosition

- java.lang.Object
- - com.mapinfo.midev.geometry.DirectPosition

All Implemented Interfaces:
  Serializable

    public final class DirectPosition
    extends Object
    implements Serializable

Holds the values that define or can be associated with a single point.

The x,y coordinate values are represented as doubles and must always be set to valid, finite values.

See Also:
  Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`DirectPosition()` Create a default `DirectPosition`.
`DirectPosition(DirectPosition dp)` Create a `DirectPosition` that is a copy of the specified `DirectPosition`.
`DirectPosition(double x, double y)` Create a `DirectPosition` with the specified x and y values.

### Method Summary

All Methods Instance Methods Concrete Methods
`boolean` `equals(Object obj)`
`DirectPosition` `getCopy()` Returns a copy of this `DirectPosition`.
`double` `getX()` Returns the x-ordinate of this `DirectPosition`.
`double` `getY()` Returns the y-ordinate of this `DirectPosition`.
`int` `hashCode()`
`void` `offsetXY(double deltaX, double deltaY)` Change the x,y values of this DirectPosition by the given amounts.
`void` `set(DirectPosition dp)` Set the state of this `DirectPosition` to that of the specified `DirectPosition`.
`void` `setX(double x)` Set the value of the x-ordinate.
`void` `setY(double y)` Set the value of the y-ordinate.
`String` `toString()`

### Methods inherited from class java.lang.Object

`getClass, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### DirectPosition

    public DirectPosition()

Create a default `DirectPosition`. Initialized to (x,y,z,m) values (0,0,NaN,null).

#### DirectPosition

    public DirectPosition(double x,
                          double y)

Create a `DirectPosition` with the specified x and y values.

Parameters:
  `x` - x-ordinate
  `y` - y-ordinate

#### DirectPosition

    public DirectPosition(DirectPosition dp)

Create a `DirectPosition` that is a copy of the specified `DirectPosition`.

Parameters:
  `dp` - the `DirectPosition` to clone.

### Method Detail

#### getCopy

    public DirectPosition getCopy()

Returns a copy of this `DirectPosition`. Changes to the returned copy do not affect this `DirectPosition`.

Returns:
  a copy of this `DirectPosition`.

#### equals

    public boolean equals(Object obj)

Overrides:
  `equals` in class `Object`

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `Object`

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

#### getX

    public double getX()

Returns the x-ordinate of this `DirectPosition`.

Returns:
  the x-ordinate of this `DirectPosition`.

#### setX

    public void setX(double x)

Set the value of the x-ordinate.

Parameters:
  `x` - the value of the x-ordinate to set

#### getY

    public double getY()

Returns the y-ordinate of this `DirectPosition`.

Returns:
  the y-ordinate of this `DirectPosition`.

#### setY

    public void setY(double y)

Set the value of the y-ordinate.

Parameters:
  `y` - the value of the y-ordinate to set.

#### set

    public void set(DirectPosition dp)

Set the state of this `DirectPosition` to that of the specified `DirectPosition`.

Parameters:
  `dp` - the `DirectPosition` to copy.

#### offsetXY

    public void offsetXY(double deltaX,
                         double deltaY)

Change the x,y values of this DirectPosition by the given amounts.

Parameters:
  `deltaX` - change in x, a valid double value
  `deltaY` - change in y, a valid double value