SFCentroidCurve

Objective-C

@interface SFCentroidCurve : NSObject

Swift

class SFCentroidCurve : NSObject

Calculate the centroid from curve based geometries. Implementation based on the JTS (Java Topology Suite) CentroidLine.

  • Initialize

    Declaration

    Objective-C

    - (instancetype)init;

    Swift

    init!()

    Return Value

    new instance

  • Initialize

    Declaration

    Objective-C

    - (instancetype)initWithGeometry:(SFGeometry *)geometry;

    Swift

    init!(geometry: SFGeometry!)

    Parameters

    geometry

    geometry to add

    Return Value

    new instance

  • Add a curve based dimension 1 geometry to the centroid total. Ignores dimension 0 geometries.

    Declaration

    Objective-C

    - (void)addGeometry:(SFGeometry *)geometry;

    Swift

    func add(_ geometry: SFGeometry!)

    Parameters

    geometry

    geometry

  • Get the centroid point

    Declaration

    Objective-C

    - (SFPoint *)centroid;

    Swift

    func centroid() -> SFPoint!

    Return Value

    centroid point