HERE iOS SDK Developer's Guide

NMAMapPolygon

Class Summary

class NMAMapPolygon

Derived from: NMAMapObject

Represents a NMAMapObject in the shape of a polygon.

Include: NMAKit.framework/headers/NMAMapPolygon.h

Inheritance Diagrams

Figure 1. Public inheritance diagram for NMAMapPolygon

[For complete information, see the section Class Details]

Public Property Summary

Table 1. Public Properties
Public Properties

[readable, writable, assign] BOOL  depthTestEnabled

Indicates whether to render the NMAMapPolygon with depth test

[readable, writable, strong] UIColor *  fillColor

The fill color for the NMAMapPolygon

[readable, assign] NMAGeoPolygon geoPolygon

Gets copy of the NMAGeoPolygon rendered by this NMAMapPolygon

[readable, writable, strong] UIColor *  lineColor

The color for the NMAMapPolygon border line

[readable, writable, assign] NSUInteger  lineWidth

The line width, in pixels, for the NMAMapPolygon border

[readable, weak] NSArray< NMAGeoCoordinates * > *  vertices

The NSArray of NMAGeoCoordinates objects comprising the path that defines the NMAMapPolygon shape

Instance Method Summary

Table 2. Instance Methods
Instance Method Summary

-(void) addVertex:(nonnull NMAGeoCoordinates *) vertex atIndex:(NSUInteger) index

Insert a NMAGeoCoordinates point at the specified index of the NMAMapPolygon path

-(void) appendVertex:(nonnull NMAGeoCoordinates *) vertex

Append a NMAGeoCoordinates path point to the end of the NMAMapPolygon

-(void) clearVertices

Removes all vertices from the NMAMapPolygon's path

-(BOOL) containsGeoCoordinates:(nonnull NMAGeoCoordinates *) coordinates

Determines if the NMAMapPolygon contains the input NMAGeoCoordinates

-(nonnull instancetype) initWithPolygon:(nonnull NMAGeoPolygon *) geoPolygon

-(nonnull instancetype) initWithVertices:(nonnull NSArray< NMAGeoCoordinates * > *) vertices

Initializes a NMAMapPolygon instance with the specified NSArray of NMAGeoCoordinates objects

-(BOOL) isValid

Determines whether the NMAMapPolygon object is valid

-(void) removeLastVertex

-(void) removeVertexAtIndex:(NSUInteger) index

Remove a NMAGeoCoordinates point at the specified index of the NMAMapPolygon path

Class Method Summary

Table 3. Class Methods
Class Methods

+(nonnull instancetype) mapPolygonWithVertices:(nonnull NSArray< NMAGeoCoordinates * > *) vertices

A convenience method for constructing an NMAMapPolygon

Class Details

Represents a NMAMapObject in the shape of a polygon. In comparison to a NMAMapPolyline, it is assumed that the last coordinates within the path is connected with the first coordinates, thereby constructing an enclosed geometry.

Note:

The NMAViewObject location property for an NMAMapPolygon returns the coordinates of the first vertex (if available).

Public Property Details

[readable, writable, assign] BOOL depthTestEnabled

Indicates whether to render the NMAMapPolygon with depth test.

Note:

Rendering with depth test should be used if map object altitude is relevant in your application. Rendering objects with different heights while disabling depth test may cause object occlusion.

[readable, writable, strong] UIColor * fillColor

The fill color for the NMAMapPolygon.

[readable, assign] NMAGeoPolygongeoPolygon

Gets copy of the NMAGeoPolygon rendered by this NMAMapPolygon.

[readable, writable, strong] UIColor * lineColor

The color for the NMAMapPolygon border line.

Note:

Attempts to set this property to nil are ignored.

[readable, writable, assign] NSUInteger lineWidth

The line width, in pixels, for the NMAMapPolygon border.

The line width must be in the range [0, 100]. The default width is 1 pixel.

[readable, weak] NSArray< NMAGeoCoordinates * > * vertices

The NSArray of NMAGeoCoordinates objects comprising the path that defines the NMAMapPolygon shape.

Instance Method Details

-(void) addVertex:(nonnull NMAGeoCoordinates *) vertex atIndex:(NSUInteger) index

Insert a NMAGeoCoordinates point at the specified index of the NMAMapPolygon path.

Note:

If index is equal or greater than the total number of vertices, the vertex will be appended to the end of the polygon path.

Parameters:

  • vertex

    A NMAGeoCoordinates path point to add.

  • index

    Position to insert. Index starts with 0.

-(void) appendVertex:(nonnull NMAGeoCoordinates *) vertex

Append a NMAGeoCoordinates path point to the end of the NMAMapPolygon.

Parameters:

  • vertex

    A NMAGeoCoordinates path point to append

-(void) clearVertices

Removes all vertices from the NMAMapPolygon's path.

-(BOOL) containsGeoCoordinates:(nonnull NMAGeoCoordinates *) coordinates

Determines if the NMAMapPolygon contains the input NMAGeoCoordinates. Points at the peaks or corners of the polygon are considered outside the polygon.

Parameters:

  • coordinates

    NMAGeoCoordinates to test. The altitude is ignored.

Returns:

YES if the NMAGeoCoordinates is inside the NMAMapPolygon, NO otherwise

-(nonnull instancetype) initWithPolygon:(nonnull NMAGeoPolygon *) geoPolygon

Initializes a NMAMapPolygon instance with the specified NMAGeoPolygon

Parameters:

  • geoPolygon

    The NMAGeoPolygon defining the polygon.

Returns:

The NMAMapPolygon

-(nonnull instancetype) initWithVertices:(nonnull NSArray< NMAGeoCoordinates * > *) vertices

Initializes a NMAMapPolygon instance with the specified NSArray of NMAGeoCoordinates objects.

Parameters:

  • vertices

    A NSArray of NMAGeoCoordinates points defining the NMAMapPolygon shape

Returns:

The NMAMapPolygon

-(BOOL) isValid

Determines whether the NMAMapPolygon object is valid. A polygon is valid as long as it does not self-intersect and all vertices have the same altitude.

Returns:

YES if the NMAMapPolygon is valid, NO otherwise

-(void) removeLastVertex

Remove the last NMAGeoCoordinates point of the NMAMapPolygon

-(void) removeVertexAtIndex:(NSUInteger) index

Remove a NMAGeoCoordinates point at the specified index of the NMAMapPolygon path.

Parameters:

  • index

    Position to remove. Index starts with 0 and must be smaller than the total number of vertices.

Class Method Details

+(nonnull instancetype) mapPolygonWithVertices:(nonnull NSArray< NMAGeoCoordinates * > *) vertices

A convenience method for constructing an NMAMapPolygon.

Parameters: