TGGeoPolygon


@interface TGGeoPolygon : NSObject

Helper class to contain a polygon geometry for use in -[TGMarker polygon].

The polygon winding order and internal polygons must be set according to the GeoJSON specification.

  • Inits a polygon and allocates enough memory to hold size geographic coordinates in the polygon paths.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithSize:(NSUInteger)size;

    Swift

    init(size: UInt)
  • Starts a new polygon path for a given coordinate.

    Declaration

    Objective-C

    - (void)startPath:(CLLocationCoordinate2D)point;

    Swift

    func startPath(_ point: CLLocationCoordinate2D)

    Parameters

    point

    the coordinate to start a polygon path

  • Starts a new polygon path for a given coordinate and allocate enough memory to hold size coordinates in the polygon geometry.

    Declaration

    Objective-C

    - (void)startPath:(CLLocationCoordinate2D)point withSize:(NSUInteger)size;

    Swift

    func startPath(_ point: CLLocationCoordinate2D, withSize size: UInt)

    Parameters

    point

    the coordinate to start a polygon path

    size

    the size of the polygon path

  • Adds a single coordinate to the current polygon path.

    Note

    This operation is a no-op if no polygon path were already started.

    Declaration

    Objective-C

    - (void)addPoint:(CLLocationCoordinate2D)point;

    Swift

    func addPoint(_ point: CLLocationCoordinate2D)

    Parameters

    point

    the coordinate to add to the current path

  • Returns a pointer to a sequence of coordinates with a total array length equal to -[TGGeoPolygon count:].

    Declaration

    Objective-C

    - (nonnull CLLocationCoordinate2D *)coordinates;

    Swift

    func coordinates() -> UnsafeMutablePointer<CLLocationCoordinate2D>

    Return Value

    a pointer to the list of polygons coordinates

  • The list of polygon rings contained in this geometry. The sum of the values in -[TGGeoPolygon rings:] sum up to -[TGeoPolygon count:].

    Declaration

    Objective-C

    - (nonnull int *)rings;

    Swift

    func rings() -> UnsafeMutablePointer<Int32>

    Return Value

    a pointer to the list of polygon rings.

  • The polygon coordinates count.

    Declaration

    Objective-C

    - (NSUInteger)count;

    Swift

    func count() -> UInt

    Return Value

    the number of geographic coordinates of this polygon

  • The polygon rings count.

    Declaration

    Objective-C

    - (NSUInteger)ringsCount;

    Swift

    func ringsCount() -> UInt

    Return Value

    the number of rings of this polygon

  • Removes all coordinates and rings of this polygon.

    Declaration

    Objective-C

    - (void)removeAll;

    Swift

    func removeAll()