Loading...
Searching...
No Matches

Runtime snapshot of a visible icon cluster on the location view. More...

#include <com/navigine/idl/objc/NCClusterMapObject.h>

+ Inheritance diagram for NCClusterMapObject:

Instance Methods

(BOOL) - setBitmap:
 Method is used to specify the decoded raster for the cluster marker.
 
(void) - addListener:
 Adds a listener for cluster state updates ClusterMapObjectListener.
 
(void) - removeListener:
 Removes a previously added listener.
 
(int32_t) - getId
 Gets the unique identifier of the map object.
 
(NCMapObjectType- getType
 Gets the type of the map object.
 
(nonnull NSData *) - getData
 Gets the user-defined data associated with the map object.
 
(BOOL) - setVisible:
 Method is used to specify the visibility of the map object.
 
(BOOL) - setInteractive:
 Method is used to specify whether the map object can be interacted with.
 
(void) - setData:
 Method is used to set user-defined data for the map object.
 
(BOOL) - setTitle:
 Method is used to set the title of the map object.
 
(BOOL) - setAlpha:
 Method is used to set the opacity of the map object.
 

Properties

NCLocationPointposition
 Cluster center in metrics coordinates.
 
int32_t count
 Number of icon map objects in the cluster (at least 2 while the cluster is visible).
 
NSArray< NCIconMapObject * > * iconMapObjects
 Icon map objects currently grouped into this cluster.
 

Detailed Description

Runtime snapshot of a visible icon cluster on the location view.

Created and updated by ClusterMapObjectController. Member IconMapObject instances are hidden while grouped; the cluster marker is shown instead.

Note
Position and membership are managed by the controller and cannot be changed through this interface. Use ClusterMapObjectListener (onClusterChanged) to refresh a custom cluster bitmap when the member count changes.

Definition at line 28 of file NCClusterMapObject.h.

Method Documentation

◆ addListener:

- (void) addListener: (nullable id< NCClusterMapObjectListener >) listener

Adds a listener for cluster state updates ClusterMapObjectListener.

Parameters
listenerListener instance.

Swift code snippet:

cluster.add(clusterChangeListener)
print("Added cluster change listener, initial count: \‍(cluster.count)")

Objective C code snippet:

[cluster addListener:_clusterChangeListener];
NSLog(@"Added cluster change listener, initial count: %d", [cluster getCount]);

◆ getData

- (nonnull NSData *) getData

Gets the user-defined data associated with the map object.

Returns
The data stored in the map object.

Swift code snippet:

// Get custom data
let retrievedData = circleMapObject.data
print("Circle custom data: \‍(retrievedData)")

Objective C code snippet:

// Get custom data
NSDictionary *retrievedData = circleObject.data;
NSLog(@"Circle custom data: %@", retrievedData);

◆ getId

- (int32_t) getId

Gets the unique identifier of the map object.

Returns
The unique identifier of the map object.

Swift code snippet:

// Get object ID
let objectId = circleMapObject.id
print("Circle object ID: \‍(objectId)")

Objective C code snippet:

// Get object ID
NSInteger objectId = circleObject.id;
NSLog(@"Circle object ID: %ld", (long)objectId);

◆ getType

- (NCMapObjectType) getType

Gets the type of the map object.

Returns
The type of the map object MapObjectType.

Swift code snippet:

// Get object type
let objectTypeString = circleMapObject.type
print("Circle object type: \‍(objectTypeString)")

Objective C code snippet:

// Get object type
NSString *objectTypeString = circleObject.type;
NSLog(@"Circle object type: %@", objectTypeString);

◆ removeListener:

- (void) removeListener: (nullable id< NCClusterMapObjectListener >) listener

Removes a previously added listener.

Parameters
listenerListener instance to remove.

Swift code snippet:

cluster.remove(clusterChangeListener)
print("Removed cluster change listener")

Objective C code snippet:

[_activeCluster removeListener:_clusterChangeListener];
NSLog(@"Removed cluster change listener");

◆ setAlpha:

- (BOOL) setAlpha: (float) alpha

Method is used to set the opacity of the map object.

Parameters
alphaOpacity multiplier. Values below 0 will be set to 0. Values above 1 will be set to 1. Default: 1.
Returns
true if the operation is successful, false otherwise.

Swift code snippet:

// Set alpha transparency
let alphaSuccess = circleMapObject.setAlpha(0.7)
print("Set circle alpha to 0.7: \‍(alphaSuccess)")

Objective C code snippet:

// Set alpha transparency
BOOL alphaSuccess = [circleObject setAlpha:0.7];
NSLog(@"Set circle alpha to 0.7: %@", alphaSuccess ? @"YES" : @"NO");

◆ setBitmap:

- (BOOL) setBitmap: (nullable UIImage *) bitmap

Method is used to specify the decoded raster for the cluster marker.

Parameters
bitmapImage provider: Android com.navigine.image.ImageProvider; iOS UIImage via binding; Flutter navigine_sdk ImageProvider.
Returns
true if the operation is successful, false otherwise.

Swift code snippet:

if let clusterImage = UIImage(contentsOfFile: "/path/to/cluster.png") {
let bitmapSuccess = cluster.setBitmap(clusterImage)
print("Set cluster bitmap (UIImage): \‍(bitmapSuccess)")
}

Objective C code snippet:

UIImage *clusterImage = [UIImage imageWithContentsOfFile:@"/path/to/cluster.png"];
BOOL bitmapSuccess = [cluster setBitmap:clusterImage];
NSLog(@"Set cluster bitmap (UIImage): %d", bitmapSuccess);

◆ setData:

- (void) setData: (nonnull NSData *) data

Method is used to set user-defined data for the map object.

Parameters
dataData to store in the map object.

Swift code snippet:

// Set custom data
let customData = ["key": "value", "number": "42"]
let dataSuccess = circleMapObject.setData(customData)
print("Set circle custom data: \‍(dataSuccess)")

Objective C code snippet:

// Set custom data
NSDictionary *customData = @{@"key": @"value", @"number": @"42"};
BOOL dataSuccess = [circleObject setData:customData];
NSLog(@"Set circle custom data: %@", dataSuccess ? @"YES" : @"NO");

◆ setInteractive:

- (BOOL) setInteractive: (BOOL) interactive

Method is used to specify whether the map object can be interacted with.

Parameters
interactiveSpecifies whether the object can be picked in the pickMapObjectAt method (true) or not (false). Default: false.
Returns
true if the operation is successful, false otherwise.

Swift code snippet:

// Set interactive mode
let interactiveSuccess = circleMapObject.setInteractive(true)
print("Set circle interactive to true: \‍(interactiveSuccess)")

Objective C code snippet:

// Set interactive mode
BOOL interactiveSuccess = [circleObject setInteractive:YES];
NSLog(@"Set circle interactive to true: %@", interactiveSuccess ? @"YES" : @"NO");

◆ setTitle:

- (BOOL) setTitle: (nonnull NSString *) title

Method is used to set the title of the map object.

Parameters
titleThe title to display on the location view.
Returns
true if the operation is successful, false otherwise.

Swift code snippet:

// Set title
let titleSuccess = circleMapObject.setTitle("Circle Object")
print("Set circle title to 'Circle Object': \‍(titleSuccess)")

Objective C code snippet:

// Set title
BOOL titleSuccess = [circleObject setTitle:@"Circle Object"];
NSLog(@"Set circle title to 'Circle Object': %@", titleSuccess ? @"YES" : @"NO");

◆ setVisible:

- (BOOL) setVisible: (BOOL) visible

Method is used to specify the visibility of the map object.

Parameters
visibleSpecifies whether the object is visible (true) or hidden (false). Default: true.
Returns
true if the operation is successful, false otherwise.

Swift code snippet:

// Set visibility
let visibleSuccess = circleMapObject.setVisible(true)
print("Set circle visibility to true: \‍(visibleSuccess)")

Objective C code snippet:

// Set visibility
BOOL visibleSuccess = [circleObject setVisible:YES];
NSLog(@"Set circle visibility to true: %@", visibleSuccess ? @"YES" : @"NO");

Property Documentation

◆ count

- (int32_t) count
readnonatomicassign

Number of icon map objects in the cluster (at least 2 while the cluster is visible).

Definition at line 89 of file NCClusterMapObject.h.

◆ iconMapObjects

- (NSArray<NCIconMapObject *>*) iconMapObjects
readnonatomicassign

Icon map objects currently grouped into this cluster.

Definition at line 95 of file NCClusterMapObject.h.

◆ position

- (NCLocationPoint*) position
readnonatomicassign

Cluster center in metrics coordinates.

Definition at line 83 of file NCClusterMapObject.h.


The documentation for this class was generated from the following file: