HERE iOS SDK Developer's Guide

NMAGeoPolygon

Class Summary

class NMAGeoPolygon

Derived from: NSObject

Object representing a Polygon, which consists of three or more points.

Include: NMAKit.framework/headers/NMAGeoPolygon.h

Inheritance Diagrams

Figure 1. Public inheritance diagram for NMAGeoPolygon

[For complete information, see the section Class Details]

Instance Method Summary

Table 1. Instance Methods
Instance Method Summary

-(void) addPoint:(nonnull NMAGeoCoordinates *) coordinate

Add a new point to the polygon

-(void) addPoints:(nonnull NSArray< NMAGeoCoordinates * > *) coordinates

Adds a list of points to the polygon

-(nonnull NSArray< NMAGeoCoordinates * > *) allPoints

Get an NSArray with all points of the polygon

-(void) clear

-(nonnull instancetype) init

Initialize an NMAGeoPolygon instance

-(nonnull instancetype) initWithCoordinates:(nonnull NSArray< NMAGeoCoordinates * > *) coordinates

Initializes an NMAGeoPolygon instance with the specified NMAGeoCoordinates

-(void) insertPoint:(nonnull NMAGeoCoordinates *) coordinate atIndex:(int) index

-(double) length

Return the geographical length of the polygon in meters

-(nullable NMAGeoCoordinates *) nearestCoordinateFrom:(nonnull NMAGeoCoordinates *) coordinate

Gets the NMAGeoCoordinates along the path of the polygon that is closest to the specified point

-(NSUInteger) nearestIndexFromCoordinate:(nonnull NMAGeoCoordinates *) coordinate

Gets the point index along the path of the polygon that is closest to the specified point

-(int) numberOfPoints

-(nullable NMAGeoCoordinates *) pointAtIndex:(int) index

Get the point coordinates from the specified index of this polygon

-(void) removePointAtIndex:(int) index

Class Details

Object representing a Polygon, which consists of three or more points. This class can be used to manipulate a polygon geometry along with NMAMapPolygon for map rendering. The minimum number of points in an NMAGeoPolygon must be three.

Instance Method Details

-(void) addPoint:(nonnull NMAGeoCoordinates *) coordinate

Add a new point to the polygon.

Parameters:

  • coordinate

    point to be added given as NMAGeoCoordinates

-(void) addPoints:(nonnull NSArray< NMAGeoCoordinates * > *) coordinates

Adds a list of points to the polygon.

Parameters:

  • coordinates

    NSArray containing the list of NMAGeoCoordinates

-(nonnull NSArray< NMAGeoCoordinates * > *) allPoints

Get an NSArray with all points of the polygon.

-(void) clear

Remove all points from the polygon

-(nonnull instancetype) init

Initialize an NMAGeoPolygon instance.

-(nonnull instancetype) initWithCoordinates:(nonnull NSArray< NMAGeoCoordinates * > *) coordinates

Initializes an NMAGeoPolygon instance with the specified NMAGeoCoordinates.

Parameters:

  • coordinates

    An NSArray containing two or more NMAGeoCoordinates.

Returns:

The NMAGeoPolygon instance, or nil if initialization failed

-(void) insertPoint:(nonnull NMAGeoCoordinates *) coordinate atIndex:(int) index

Insert a point to the polygon at the specified index

Parameters:

  • coordinate

    point to be added given as NMAGeoCoordinates

  • index

    position of the point along the polygon

-(double) length

Return the geographical length of the polygon in meters.

-(nullable NMAGeoCoordinates *) nearestCoordinateFrom:(nonnull NMAGeoCoordinates *) coordinate

Gets the NMAGeoCoordinates along the path of the polygon that is closest to the specified point.

Parameters:

  • coordinate

    the origin point to search from given in NMAGeoCoordinates.

-(NSUInteger) nearestIndexFromCoordinate:(nonnull NMAGeoCoordinates *) coordinate

Gets the point index along the path of the polygon that is closest to the specified point.

Parameters:

  • coordinate

    the origin point to search from given in NMAGeoCoordinates.

-(int) numberOfPoints

Get the total number of points that currently exists in the polygon

-(nullable NMAGeoCoordinates *) pointAtIndex:(int) index

Parameters:

  • index

    position of the point along the polygon

Returns:

The NMAGeoCoordinates instance, or nil if failed

-(void) removePointAtIndex:(int) index

Remove a point from the polygon with the specified index

Parameters:

  • index

    position of the point along the polygon