POI Helper (v2.1.x – 2.2.x)

POI HELPER

To provide you with a convenient way to handle POI representation there is a poiCategoryHelper property in NMSdk singleton instance. This property is a NMPoiCategoryHelper instance. There are three groups in with all the POIs are divided in Navmii SDK:

  • road events
  • speed cameras 
  • all the other POIs

You can retrieve a NSArray of NMPoiCategories belonging to each of this groups separately using these readonly properties: roadEventCategories, speedCameraCategories and poiCategories respectively. For the info on NMPoiCategory please refer to POI CATEGORY section.

NSArray <NMPoiCategory *> *roadEvents = [NMSdk sharedInstance].poiCategoryHelper.roadEventCategories;
NSArray <NMPoiCategory *> *speedCameras = [NMSdk sharedInstance].poiCategoryHelper.speedCameraCategories;
NSArray <NMPoiCategory *> *poiCategories = [NMSdk sharedInstance].poiCategoryHelper.poiCategories;

The NMPoiHelper allows to:

  • check if a category with the ID number exists
  • check if a category is displayed on the map
  • make a category displayed/hidden on the map
  • get an UIImage for a category
  • get a NMPoiCategory from a NSInteger representing the category ID number
NMPoiCategoryHelper *helper = [NMSdk sharedInstance].poiCategoryHelper;
//logs out 1 if the category exists or 0 if it doesn't
NSLog(@"POI category with number %d exists - %d", someInt, (int)[helper isPoiCategoryExist:someInt]);
//logs out 1 if the category is displayed on the map and 0 if it isn't
NSLog(@"POI category with number %d is shown on map - %d", number, (int)[helper isPoiCategoryDisplayedOnMap:number]);
//hides all POIs belonging to the category
[helper setPoiCategory:number displayedOnMap:NO];
//fetches the image associated with the category
UIImage *image = [helper poiCategoryImage:categoryNumber];
//creates a NMPoiCategory from a number
NMPoiCategory *poiCategory = [helper poiCategoryById:categoryNumber];

POI CATEGORY

NMPoiCategory has the following info:

  • name
  • category ID number
  • zoom level
  • BOOL value indicating if POIs belonging to the category should be displayed on the map
NSLog(@"category name - %@", category.name);
NSLog(@"category ID number - %d", (int)category.categoryId);
NSLog(@"category zoom level - %d", category. zoomLevel);
NSLog(@"should be displayed on map - %d", category.shouldDisplayOnMap);

Importing custom POI categories

When importing POI categories, it is possible to overwrite the existing ones (including the categories that come preinstalled with the SDK) by using the same identifiers. For the complete list of preinstalled categories and their identifiers please refer to this page.

NMPoiCategoryHelper contains methods to create a POI Category. They accept a NMPoiCategory object as an input parameter.

- (void)importPoiCategory:(nonnull NMPoiCategory *)poiCategory;

- (void)importPoiCategory:(nonnull NMPoiCategory *)poiCategory completion:(nullable NMPoiCategoryImportCompletion)completion;


A NMPoiCategory object can be created using one of it's instantiation methods:

- (nonnull instancetype)initWithName:(nonnull NSString *)name
                               image:(nonnull UIImage *)image
                          categoryId:(int)categoryId
                  shouldDisplayOnMap:(BOOL)shouldDisplayOnMap
                           zoomLevel:(int)zoomLevel
                               scale:(int)scale;

- (nonnull instancetype)initWithName:(nonnull NSString *)name
                               image:(nonnull UIImage *)image
                          categoryId:(int)categoryId;


Removing POI categories

NMPoiCategoryHelper also contains methods to remove existing POI Category. A non null NMPoiCategory object should be set as an input parameter.

- (void)removePoiCategory:(nonnull NMPoiCategory *)poiCategory;

- (void)removePoiCategory:(nonnull NMPoiCategory *)poiCategory completion:(nullable NMPoiCategoryImportCompletion)completion;


POI categories adjustments

NMPoiCategoryHelper provides a convenient way to adjust POI categories.


To set a custom zoom level:

- (void)setPoiCategory:(NSUInteger)categoryId zoomLevel:(int)zoomLevel;


To enable/disable displaying on Map:

- (void)setPoiCategory:(NSUInteger)categoryId displayedOnMap:(BOOL)displayedOnMap;