com.mapinfo.midev.geometry

## Interface IGeometry

All Superinterfaces:
  Serializable

All Known Subinterfaces:
  ICurve, ICurveSegment, IFeatureGeometry, ILineString, IMultiCurve, IMultiFeatureGeometry, IMultiPoint, IMultiPolygon, IPoint, IPolygon, IRectangle, IRing

    public interface IGeometry
    extends Serializable

## Z and M values

All objects derived from this interface are 2D objects. Some particular implementations derived from this interface may also store Z values or M values, but excluding `equals()` and methods which explicitly refer to Z or M, all predicates test only 2D values, and the 2D output of any method which produces a geometry is defined independently of the Z or M values, if any, of the input. NOTE: Not all implementations of `IGeometry` are serializable. Make sure you serialize the copy of the geometry with getCopy() when transferring geometry objects.

### Method Summary

All Methods Instance Methods Abstract Methods
`boolean` `contains(DirectPosition dp)` Test if a direct position is in the set of direct positions defined by this geometry.
`Area` `getArea(ComputationType ct)` Computes the total area of this geometry using the specified model.
`CoordSys` `getCoordSys()` Returns the coordinate reference system of this geometry.
`IGeometry` `getCopy()` Get a (permanent) copy of this `IGeometry`.
`IGeometry` `getCopy(CoordSys csys)` Get a (permanent) copy of this `IGeometry` transformed to the given coordinate system.
`int` `getDimension()` Get the topological dimension of a geometry instance based on the geometry type.
`Envelope` `getEnvelope()` Gets the bounding box of the geometry (the range of direct positions that the geometry spans).
`Length` `getPerimeter(ComputationType ct)` Computes the total perimeter of this geometry.
`SpatialInfo` `getSpatialInfo()` Get the spatial info for this geometry.
`GeometryType` `getType()` Return the type of this geometry.
`boolean` `isEmpty()` Does this geometry have any contents.
`boolean` `isTransient()` Answers whether this is a transient geometry.
`boolean` `mAllSet()` Does this geometry have all non-null MValues.
`boolean` `mSet()` Does this geometry have at least one non-null MValue.
`boolean` `zAllSet()` Do all the Z values in this geometry have a value that is not Double.NaN.
`boolean` `zSet()` Does at least one Z value in this geometry have a value that is not Double.NaN.

### Method Detail

#### zSet

    boolean zSet()

Does at least one Z value in this geometry have a value that is not Double.NaN.

Returns:
  true if at least one direct position in the geometry has a Z value that is not Double.NaN; false if all Z values are Double.NaN or geometry is empty.
See Also:
  `IGeometry.isEmpty()`

#### zAllSet

    boolean zAllSet()

Do all the Z values in this geometry have a value that is not Double.NaN.

Returns:
  true if geometry is not empty and no Z values are Double.NaN; false if geometry is empty or at least one Z value is Double.NaN.
See Also:
  `IGeometry.isEmpty()`

#### mSet

    boolean mSet()

Does this geometry have at least one non-null MValue.

Returns:
  true if at least one direct position in the geometry has an MValue that is not null; false if all MValues are null or geometry is empty.
See Also:
  `IGeometry.isEmpty()`

#### mAllSet

    boolean mAllSet()

Does this geometry have all non-null MValues.

Returns:
  true if geometry is not empty and no MValues are null; false if geometry is empty or at least one MValue is null
See Also:
  `IGeometry.isEmpty()`

#### getDimension

    int getDimension()

Get the topological dimension of a geometry instance based on the geometry type.

0
  IPoint, IMultiPoint, ILegacyText
1
  ICurveSegment, ICurve, IMultiCurve, ILegacyArc
2
  IRing, IPolygon, IMultiPolygon, IRectangle, IRoundedRectangle, IEllipse,

The dimension of an IMultiFeatureGeometry is the largest dimension its contents or 0 if it is empty. The dimension of any other empty geometry is the dimension of its type, e.g. the dimension of an empty IMultiCurve is 1.

Returns:
  The dimension of the geometry.
See Also:
  `GeometryType`, `IGeometry.isEmpty()`

#### getEnvelope

    Envelope getEnvelope()

Gets the bounding box of the geometry (the range of direct positions that the geometry spans). An empty geometry returns an empty Envelope.

Returns:
  an Envelope containing the geometry.

#### isEmpty

    boolean isEmpty()

Does this geometry have any contents.

Returns:
  `true` if the geometry does not define any direct positions.

#### getSpatialInfo

    SpatialInfo getSpatialInfo()

Get the spatial info for this geometry.

Returns:
  spatial info for this geometry

#### getCoordSys

    CoordSys getCoordSys()

Returns the coordinate reference system of this geometry.

Returns:
  This geometry's coordinate system.

#### getType

    GeometryType getType()

Return the type of this geometry.

Returns:
  The GeometryType this geometry belongs to.

#### isTransient

    boolean isTransient()

Answers whether this is a transient geometry.

Returns:
  `true` if this geometry is transient and `false` if it is permanent.

#### contains

    boolean contains(DirectPosition dp)

Test if a direct position is in the set of direct positions defined by this geometry.

Only check x,y values.

Parameters:
  `dp` - the DirectPosition to test.
Returns:
  `true` if the specified position is part of this geometry.

#### getCopy

    IGeometry getCopy()

Get a (permanent) copy of this `IGeometry`.

Returns:
  permanent copy of this `IGeometry`.
See Also:
  `IGeometry.getCopy(CoordSys)`, `IGeometry.isTransient()`

#### getCopy

    IGeometry getCopy(CoordSys csys)

Get a (permanent) copy of this `IGeometry` transformed to the given coordinate system.

Parameters:
  `csys` - coordinate system of the returned copy
Returns:
  copy of this `IGeometry` in the given coordinate system
See Also:
  `IGeometry.isTransient()`

#### getArea

    Area getArea(ComputationType ct)

Computes the total area of this geometry using the specified model.

The total area is the sum of the areas of all the constituent parts of the geometry. It is possible for the total area to be zero if the geometry is degenerate and all its points are co-linear.

If the geometry is self intersecting, this method does not detect that irregularity and may return an answer which is too small. We guarantee that the returned area is non-negative.

The area of an empty geometry is 0.

Parameters:
  `ct` - the preferred computation model.
Returns:
  total area of this geometry. Never null.
Throws:
  `InvalidComputationTypeException` - if the given computation type is incompatible with the coordinate system of this geometry
See Also:
  `IGeometry.isEmpty()`

#### getPerimeter

    Length getPerimeter(ComputationType ct)

Computes the total perimeter of this geometry.

The total perimeter is the sum of the perimeters of all the constituent parts of the geometry. It is possible for the total perimeter to be zero if the geometry is degenerate and all its points are co-incident.

The perimeter of an empty geometry is 0.

Parameters:
  `ct` - the preferred computation model.
Returns:
  total perimeter of this geometry. Never null.
Throws:
  `InvalidComputationTypeException` - if the given computation type is incompatible with the coordinate system of this geometry
See Also:
  `IGeometry.isEmpty()`