com.mapinfo.midev.geometry

## Interface ICurve

All Superinterfaces:
  IGeometry, Iterable, Serializable

    public interface ICurve
    extends IGeometry, Iterable

An `ICurve` is an ordered, connected, sequence of `ICurveSegment`.

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

### Method Summary

All Methods Instance Methods Abstract Methods
`ILineString` `asLineString()` Return an `ILineString` that approximates this curve.
`ILineString` `asLineString(Length maxSpacing, Length maxOffset)` Approximates the curve as a single `ILineString`.
`ICurve` `getCopy()` Get a (permanent) copy of this `IGeometry`.
`ICurve` `getCopy(CoordSys crs)` Get a (permanent) copy of this `IGeometry` transformed to the given coordinate system.
`ICurveSegment` `getCurveSegment(int i)` Return the specified `ICurveSegment` from this `ICurve`.
`int` `getCurveSegmentCount()` Returns the number of segments making up this curve.
`Length` `getEndDistance(ComputationType ct)` Returns the distance corresponding to the last `IDirectPosition` of this generic curve.
`DirectPosition` `getEndPosition()` Returns the last position of the curve.
`Length` `getLength(ComputationType ct)` Returns the total length of this geometry using the given `ComputationType`.
`DirectPosition` `getPointForDistance(Length len)` Returns the `DirectPosition` that lies at the specified distance along this curve.
`Length` `getStartDistance(ComputationType ct)` Returns the distance corresponding to the first `IDirectPosition` of this generic curve.
`DirectPosition` `getStartPosition()` Returns the first position of the curve.
`boolean` `isClosed()` Return `true` if this `ICurve` forms a cycle; `false` if not.
`boolean` `isLinear()` Returns `true` if this `ICurve` contains only straight lines; `false` if not.
`ICurve` `reverse()` Create a new curve, defining the same set of direct positions, but with the opposite orientation.

### 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()

Returns the first position of the curve.

Returns:
  the first position of the curve

#### getEndPosition

    DirectPosition getEndPosition()

Returns the last position of the curve.

Returns:
  the last position of the curve

#### isLinear

    boolean isLinear()

Returns `true` if this `ICurve` contains only straight lines; `false` if not.

Returns:
  `true` if this `ICurve` contains only straight lines; `false` if not.

#### getStartDistance

    Length getStartDistance(ComputationType ct)

Returns the distance corresponding to the first `IDirectPosition` of this generic curve.

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

For any generic curve:

       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 `IDirectPosition` of this generic curve.
Throws:
  `InvalidGeometryOperationException` - if the given computation type is incompatible with the coordinate system of this geometry

#### getEndDistance

    Length getEndDistance(ComputationType ct)

Returns the distance corresponding to the last `IDirectPosition` of this generic curve.

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

For any generic curve:

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

Parameters:
  `ct` - ComputationType to use for the distance calculation
Returns:
  the distance corresponding to the last `IDirectPosition` 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 curve.

Parameters:
  `len` - length along this `ICurve` to return the point. Value must be inclusively between the values returned by `ICurve.getStartDistance(ComputationType)` and `ICurve.getEndDistance(com.mapinfo.midev.unit.ComputationType)`
Returns:
  direct position that is the given distance along this line string.
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 `ICurve.getStartDistance(com.mapinfo.midev.unit.ComputationType)` and `ICurve.getEndDistance(ComputationType)`

#### isClosed

    boolean isClosed()

Return `true` if this `ICurve` forms a cycle; `false` if not.

Returns:
  `true` if the last position of this `ICurve` is equal to the first position; false if geometry is empty or first and last position are not equal. Considers x,y.
See Also:
  `IRing`

#### getCurveSegmentCount

    int getCurveSegmentCount()

Returns the number of segments making up this curve.

Returns:
  the number of segments making up this curve.

#### getCurveSegment

    ICurveSegment getCurveSegment(int i)

Return the specified `ICurveSegment` from this `ICurve`.

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

#### getCopy

    ICurve 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

    ICurve 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

    ICurve reverse()

Create a new curve, defining the same set of direct positions, but with the opposite orientation.

Returns:
  a new `ICurve` whose start position and end position are reversed from this segment.

#### getLength

    Length getLength(ComputationType ct)

Returns the total length of this geometry using the given `ComputationType`.

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

The length of an empty geometry is 0.

Parameters:
  `ct` - the preferred computation model.
Returns:
  total length of the geometry. Never null.
Throws:
  `InvalidComputationTypeException` - if the given computation type is incompatible with the coordinate system of this geometry

#### asLineString

    ILineString asLineString()

Return an `ILineString` that approximates this curve.

Returns:
  A single `ILineString` approximating this curve.

#### asLineString

    ILineString asLineString(Length maxSpacing,
                             Length maxOffset)

Approximates the curve 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 LineString. A maxSpacing of zero means "no limit".
  `maxOffset` - the maximum deviation of the constructed LineString from this curve. A maxOffset of zero means "no limit".
Returns:
  a `ILineString` approximating this curve.