com.mapinfo.midev.geometry

## Interface IRing

All Superinterfaces:
  IGeometry, Iterable, Serializable

    public interface IRing
    extends IGeometry, Iterable

An `IRing` is a list of consecutively connected `ICurveSegment`s where the last position is exactly equal to the first position.

By policy, instances of classes that implement this interface cannot be empty, must be closed and must contain at least one `ICurveSegment`.

### Method Summary

All Methods Instance Methods Abstract Methods
`ILineString` `asLineString()` Returns an `ILineString` that approximates this `IRing`.
`ILineString` `asLineString(Length maxSpacing, Length maxOffset)` Returns a linear approximation of this `IRing` as a single `ILineString`.
`IRing` `getCopy()` Get a (permanent) copy of this `IGeometry`.
`IRing` `getCopy(CoordSys crs)` Get a (permanent) copy of this `IGeometry` transformed to the given coordinate system.
`ICurveSegment` `getCurveSegment(int i)` Returns the `ICurveSegment` at the specified index.
`int` `getCurveSegmentCount()` Returns the number of `ICurveSegment`s that this IRing contains.
`Length` `getEndDistance(ComputationType ct)` Returns the distance corresponding to the last direct position of this `IRing`.
`DirectPosition` `getEndPosition()` Return the last position of the IRing.
`DirectPosition` `getPointForDistance(Length len)` Returns the `DirectPosition` that lies at the specified distance along this `IRing`.
`Length` `getStartDistance(ComputationType ct)` Returns the distance corresponding to the first direct position of this `IRing`.
`DirectPosition` `getStartPosition()` Return the first position of the IRing.
`boolean` `isLinear()` Return `true` if this `IRing` is linear; `false` if not.
`IRing` `reverse()` Returns a new `IRing` that has the opposite orientation of this `IRing`.

### Methods inherited from interface com.mapinfo.midev.geometry.IGeometry

`contains, getArea, getCoordSys, getDimension, getEnvelope, getPerimeter, getSpatialInfo, getType, isEmpty, isTransient, mAllSet, mSet, zAllSet, zSet`

### Methods inherited from interface java.lang.Iterable

`forEach, iterator, spliterator`

### Method Detail

#### getStartPosition

    DirectPosition getStartPosition()

Return the first position of the IRing.

Returns:
  the first position of the IRing.

#### getEndPosition

    DirectPosition getEndPosition()

Return the last position of the IRing.

Returns:
  the last position of the IRing.

#### isLinear

    boolean isLinear()

Return `true` if this `IRing` is linear; `false` if not. An `IRing` is linear if all the contained `ICurveSegment`s are of type `CurveInterpolationType.LINEAR`.

Returns:
  `true` if this `IRing` is linear; `false` if not.

#### getStartDistance

    Length getStartDistance(ComputationType ct)

Returns the distance corresponding to the first direct position of this `IRing`.

The start distance for any `IRing` is always 0.0. However, the start distance for any `ICurveSegment` contained in an `IRing` is always the distance along that `IRing` where it's first direct position lies. The start distance for a stand alone `ICurveSegment` that is not part of an `IRing` is always 0.0.

For any IRing:

       pointForDistance(startDistance(ct)) == first direct position
       endDistance(ct) - startDistance(ct) == getLength() or getPerimeter()

Parameters:
  `ct` - `ComputationType` to use for the distance calculation
Returns:
  the distance corresponding to the first direct position of this `IRing`.

#### getEndDistance

    Length getEndDistance(ComputationType ct)

Returns the distance corresponding to the last direct position of this `IRing`.

The end distance for any `IRing` is always the same value as that returned by `IGeometry.getPerimeter(ComputationType)` respectively. However, the end distance for any `ICurveSegment` contained in an `IRing` is always the distance along that `IRing` where it's last direct position lies. The end distance for a stand alone `ICurveSegment` that is not part of an `IRing` is always the same as it's length.

For any IGenericCurve:

       pointForDistance(endDistance(ct)) == last direct position
       endDistance(ct) - startDistance(ct) == getLength() or getPerimeter()

Parameters:
  `ct` - ComputationType to use for the distance calculation
Returns:
  the end distance of the last direct position of this generic curve
Throws:
  `InvalidComputationTypeException` - if the given computation type is incompatible with the coordinate system of this geometry

#### getPointForDistance

    DirectPosition getPointForDistance(Length len)

Returns the `DirectPosition` that lies at the specified distance along this `IRing`.

Parameters:
  `len` - length along this `IRing` to return the point. Value must be inclusively between the values returned by `IRing.getStartDistance(ComputationType)` and `IRing.getEndDistance(ComputationType)`
Returns:
  the `DirectPosition` that lies at the specified distance along this `IRing`.
Throws:
  `InvalidComputationTypeException` - if the computation type of the length is incompatible with the coordinate system of the geometry or if the value of len is not inclusively between the values returned by `IRing.getStartDistance(ComputationType)` and `IRing.getEndDistance(ComputationType)`

#### getCurveSegmentCount

    int getCurveSegmentCount()

Returns the number of `ICurveSegment`s that this IRing contains.

Returns:
  the number of `ICurveSegment`s that this IRing contains.

#### getCurveSegment

    ICurveSegment getCurveSegment(int i)

Returns the `ICurveSegment` at the specified index.

Parameters:
  `i` - zero-based index of `ICurveSegment` to return.
Returns:
  A new copy of the ith segment.

#### getCopy

    IRing getCopy(CoordSys crs)

Description copied from interface: `IGeometry`
Get a (permanent) copy of this `IGeometry` transformed to the given coordinate system.

Specified by:
  `getCopy` in interface `IGeometry`
Parameters:
  `crs` - coordinate system of the returned copy
Returns:
  copy of this `IGeometry` in the given coordinate system
See Also:
  `IGeometry.isTransient()`

#### getCopy

    IRing getCopy()

Description copied from interface: `IGeometry`
Get a (permanent) copy of this `IGeometry`.

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

#### reverse

    IRing reverse()

Returns a new `IRing` that has the opposite orientation of this `IRing`.

Returns:
  a new `IRing` that has the opposite orientation of this `IRing`.

#### asLineString

    ILineString asLineString()

Returns an `ILineString` that approximates this `IRing`.

Returns:
  an `ILineString` that approximates this `IRing`.

#### asLineString

    ILineString asLineString(Length maxSpacing,
                             Length maxOffset)

Returns a linear approximation of this `IRing` as a single `ILineString`. The first position of the second and subsequent segments of this curve are omitted because they would be x/y equal to the end position of the previous segment.

Regardless of parameters, the control points of all the curve segments are always included (except the first position of all but the first segment, as explained above). If both parameters are zero, then only the control points are returned.

Parameters:
  `maxSpacing` - the maximum distance between points in the constructed `ILineString`. A maxSpacing of zero means "no limit".
  `maxOffset` - the maximum deviation of the constructed `ILineString` from this curve. A maxOffset of zero means "no limit".
Returns:
  a linear approximation of this `IRing` as a single `ILineString`.