HERE iOS SDK Developer's Guide

NMADynamicPenalty

Class Summary

class NMADynamicPenalty

Derived from: NSObject

This class represents a policy containing road, area, and traffic restriction factors that are taken into account while calculating routes.

Include: NMAKit.framework/headers/NMADynamicPenalty.h

Inheritance Diagrams

Figure 1. Public inheritance diagram for NMADynamicPenalty

[For complete information, see the section Class Details]

Public Property Summary

Table 1. Public Properties
Public Properties

[readable, writable, assign] NMATrafficPenaltyMode   trafficPenaltyMode

To decide route calculation should take traffic into account

Instance Method Summary

Table 2. Instance Methods
Instance Method Summary

-(BOOL) addBannedArea:(nonnull NMAMapPolygon *) area

Sets a banned area which is excluded from the routing calculation.

-(BOOL) addPenalty:(NSUInteger) penalty forArea:(nonnull NMAMapPolygon *) area

Deprecated: As of SDK 3.2. Use . The argument has no effect. Any area added is blocked from the routing calculation.

Sets a penalty for an area.

-(BOOL) addPenaltyForRoadElement:(nonnull NMARoadElement *) element withDrivingDirection:( NMADrivingDirection ) direction speed:(NSUInteger) newSpeed

Sets a penalty for a road segment.

-(nonnull) init

Constructs a default NMADynamicPenalty.

-(void) removeAllAreaPenalties

Removes all previously-added areas and their penalty from this policy.

-(void) removeAllRoadElementPenalties

Removes all previously-added road penalties.

-(BOOL) removeBannedArea:(nonnull NMAMapPolygon *) area

Removes a banned area, if added previously.

-(BOOL) removePenaltyForArea:(nonnull NMAMapPolygon *) area

Deprecated: As of SDK 3.2. Use .

Removes an area and its penalty from this policy, if added previously.

-(BOOL) removePenaltyForRoadElement:(nonnull NMARoadElement *) element

Remove a road segment from the penalty policy. This will remove penalties for every NMADrivingDirection.

Class Details

This class represents a policy containing road, area, and traffic restriction factors that are taken into account while calculating routes.

These restriction factors are also known as penalties. For example, you can use this class to set an area penalty to indicate that the travel speed in an area is 50% slower than the legal speed limit.

Public Property Details

[readable, writable, assign] NMATrafficPenaltyMode  trafficPenaltyMode

To decide route calculation should take traffic into account.

This property defaults to NMATrafficPenaltyModeDisabled.

Instance Method Details

-(BOOL) addBannedArea:(nonnull NMAMapPolygon *) area

Sets a banned area which is excluded from the routing calculation.

An area is defined in terms of NMAMapPolygon.

Parameters:

  • area

    area to with penalty is being added.

Returns:

YES if banned area is added successfully. NO if area is nil.

-(BOOL) addPenalty:(NSUInteger) penalty forArea:(nonnull NMAMapPolygon *) area

Deprecated: As of SDK 3.2. Use . The argument has no effect. Any area added is blocked from the routing calculation.

Sets a penalty for an area.

An area is defined in terms of NMAMapPolygon. Adding penalty to an area reduces the original speed in the area to the given factor. For example, a penalty value of 10 reduces the speed by 10% of the original speed in the defined area. Use a penalty value of 100 to block the area from being used route calculations.

Parameters:

  • penalty

    penalty for the area. Must be between 0 and 100, inclusive.

  • area

    area to with penalty is being added.

Returns:

YES if area penalty is added successfully. NO if area is nil OR penalty is greater than 100 OR otherwise.

-(BOOL) addPenaltyForRoadElement:(nonnull NMARoadElement *) element withDrivingDirection:( NMADrivingDirection ) direction speed:(NSUInteger) newSpeed

Sets a penalty for a road segment.

Note:

Road penalties are defined as a speed that overrides the original speed of the road segment. Road penalties are in kilometers per hour and must be between 0 and 254. A penalty of 0 blocks the road segment from route calculations altogether. Segments can be blocked in the forward, backward, or both directions. If a road segment is excluded in the backward direction, it can still be accessed in the forward direction. If you want to completely exclude the segment, block both directions.

Parameters:

  • element

    to identify the road segment.

  • direction

    - The road's direction represented by NMADrivingDirection to be used to apply penalty.

  • newSpeed-

    New Speed for the segment in kilometers per hour. Must be in between 0 to 254.

Returns:

YES if road penalty is added successfully. NO if element is nil OR newSpeed is less than 0 or greater than 254 OR otherwise.

-(nonnull) init

Constructs a default NMADynamicPenalty.

-(void) removeAllAreaPenalties

Removes all previously-added areas and their penalty from this policy.

-(void) removeAllRoadElementPenalties

Removes all previously-added road penalties.

-(BOOL) removeBannedArea:(nonnull NMAMapPolygon *) area

Removes a banned area, if added previously.

Note:

Area is defined in terms of NMAGeoPolygon.

Parameters:

  • area

    area to be removed from penalty policy

-(BOOL) removePenaltyForArea:(nonnull NMAMapPolygon *) area

Deprecated: As of SDK 3.2. Use .

Removes an area and its penalty from this policy, if added previously.

Note:

Area is defined in terms of NMAGeoPolygon.

Parameters:

  • area

    area to be removed from penalty policy

-(BOOL) removePenaltyForRoadElement:(nonnull NMARoadElement *) element

Remove a road segment from the penalty policy. This will remove penalties for every NMADrivingDirection.

Parameters:

  • element

    to identify the road segment.

Returns:

YES if road penalty is removed successfully. NO otherwise.

You cannot use this account to purchase a commercial plan on Developer Portal, as it is already associated to plans with different payment methods.

To purchase a commercial plan on Developer Portal, please register for or sign in with a different HERE Account.

Something took longer than expected.

The project should be available soon under your projects page.

Sorry, our services are not available in this region.

Something seems to have gone wrong. Please try again later.

We've detected that your account is set to Australian Dollars (AUD).
Unfortunately, we do not offer checkouts in AUD anymore.
You can continue using your current plan as normal, but to subscribe to one of our new plans,
please register for a new HERE account or contact us for billing questions on selfservesupport@here.com.