Represents an icon object on the location view.
More...
#include <com/navigine/idl/objc/NCIconMapObject.h>
|
| (BOOL) | - setPosition: |
| | Method is used to specify the center of the icon.
|
| |
| (BOOL) | - setPositionAnimated:duration:type: |
| | Method is used to move the center of the icon with the specified animation.
|
| |
| (BOOL) | - setBitmap: |
| | Method is used to specify the decoded raster for the icon.
|
| |
| (BOOL) | - setSize:height: |
| | Method is used to specify the size of the icon.
|
| |
| (BOOL) | - setCollisionEnabled: |
| | Method is used to enable or disable collision detection for the icon.
|
| |
| (BOOL) | - setAngle: |
| | Method is used to specify the rotation angle of the icon.
|
| |
| (BOOL) | - setAngleAnimated:duration:type: |
| | Method is used to rotate the icon with the specified animation.
|
| |
| (BOOL) | - setBuffer:height: |
| | Method is used to specify the buffer size around the icon for collision detection.
|
| |
| (BOOL) | - setOffset:height: |
| | Method is used to specify an offset for the icon’s anchor on screen.
|
| |
| (BOOL) | - setPriority: |
| | Method is used to specify the priority of the icon.
|
| |
| (BOOL) | - setFlat: |
| | Method is used to specify whether the icon is flat or billboarded.
|
| |
| (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.
|
| |
Represents an icon object on the location view.
Referenced from LocationWindow.
- Note
- IconMapObject maintains orientation to the screen surface by default.
Definition at line 25 of file NCIconMapObject.h.
◆ 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:
NSDictionary *retrievedData = circleObject.data;
NSLog(@"Circle custom data: %@", retrievedData);
◆ 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:
NSInteger objectId = circleObject.id;
NSLog(@"Circle object ID: %ld", (long)objectId);
◆ 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:
NSString *objectTypeString = circleObject.type;
NSLog(@"Circle object type: %@", objectTypeString);
◆ setAlpha:
| - (BOOL) setAlpha: |
|
(float) | alpha |
|
Method is used to set the opacity of the map object.
- Parameters
-
| alpha | Opacity 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:
BOOL alphaSuccess = [circleObject
setAlpha:0.7];
NSLog(@"Set circle alpha to 0.7: %@", alphaSuccess ? @"YES" : @"NO");
◆ setAngle:
| - (BOOL) setAngle: |
|
(float) | angle |
|
Method is used to specify the rotation angle of the icon.
- Parameters
-
| angle | Rotation angle in degrees. Default: 0. |
- Returns
- true if the operation is successful, false otherwise.
Swift code snippet:
// Set icon rotation angle
let angleSuccess = iconMapObject.setAngle(45.0)
print("Set icon rotation angle to 45 degrees: \(angleSuccess)")
Objective C code snippet:
BOOL angleSuccess = [iconObject
setAngle:45.0];
NSLog(@"Set icon rotation angle to 45 degrees: %@", angleSuccess ? @"YES" : @"NO");
◆ setAngleAnimated:duration:type:
| - (BOOL) setAngleAnimated: |
|
(float) | angle |
| duration: |
|
(float) | duration |
| type: |
|
(NCAnimationType) | type |
Method is used to rotate the icon with the specified animation.
- Parameters
-
| angle | Rotation angle in degrees. |
| duration | Animation duration in seconds. |
| type | Animation type AnimationType. |
- Returns
- true if the operation is successful, false otherwise.
Swift code snippet:
// Set icon rotation with animation
let angleAnimatedSuccess = iconMapObject.setAngleAnimated(90.0, duration: 2.0, animationType: .sine)
print("Set icon rotation with animation to 90 degrees: \(angleAnimatedSuccess)")
Objective C code snippet:
BOOL angleAnimatedSuccess = [iconObject setAngleAnimated:90.0 duration:2.0 animationType:NCSine];
NSLog(@"Set icon rotation with animation to 90 degrees: %@", angleAnimatedSuccess ? @"YES" : @"NO");
◆ setBitmap:
| - (BOOL) setBitmap: |
|
(nullable UIImage *) | bitmap |
|
Method is used to specify the decoded raster for the icon.
- Parameters
-
| bitmap | Image 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 iconImage = UIImage(contentsOfFile: "/path/to/icon.png") {
let bitmapSuccess = iconMapObject.setBitmap(iconImage)
print("Set icon bitmap (UIImage): \(bitmapSuccess)")
}
Objective C code snippet:
UIImage *iconImage = [UIImage imageWithContentsOfFile:@"/path/to/icon.png"];
BOOL bitmapSuccess = (iconImage != nil) && [iconObject setBitmap:iconImage];
NSLog(@"Set icon bitmap (UIImage): %@", bitmapSuccess ? @"YES" : @"NO");
◆ setBuffer:height:
| - (BOOL) setBuffer: |
|
(float) | width |
| height: |
|
(float) | height |
Method is used to specify the buffer size around the icon for collision detection.
- Parameters
-
| width | Width of the buffer in pixels. Default: 0. |
| height | Height of the buffer in pixels. Default: 0. |
- Returns
- true if the operation is successful, false otherwise.
Swift code snippet:
// Set collision buffer
let bufferSuccess = iconMapObject.setBuffer(width: 10.0, height: 10.0)
print("Set collision buffer to 10x10 pixels: \(bufferSuccess)")
Objective C code snippet:
BOOL bufferSuccess = [iconObject setBufferWithWidth:10.0 height:10.0];
NSLog(@"Set collision buffer to 10x10 pixels: %@", bufferSuccess ? @"YES" : @"NO");
◆ setCollisionEnabled:
| - (BOOL) setCollisionEnabled: |
|
(BOOL) | enabled |
|
Method is used to enable or disable collision detection for the icon.
- Parameters
-
| enabled | Specifies whether collision detection is enabled (true) or disabled (false). Default: false. |
- Returns
- true if the operation is successful, false otherwise.
Swift code snippet:
// Enable collision detection
let collisionSuccess = iconMapObject.setCollisionEnabled(true)
print("Enabled collision detection for icon: \(collisionSuccess)")
Objective C code snippet:
NSLog(@"Enabled collision detection for icon: %@", collisionSuccess ? @"YES" : @"NO");
◆ setData:
| - (void) setData: |
|
(nonnull NSData *) | data |
|
Method is used to set user-defined data for the map object.
- Parameters
-
| data | Data 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:
NSDictionary *customData = @{@"key": @"value", @"number": @"42"};
BOOL dataSuccess = [circleObject
setData:customData];
NSLog(@"Set circle custom data: %@", dataSuccess ? @"YES" : @"NO");
◆ setFlat:
| - (BOOL) setFlat: |
|
(BOOL) | flat |
|
Method is used to specify whether the icon is flat or billboarded.
- Parameters
-
| flat | If true, the icon aligns with the location view surface; if false, it maintains orientation to the screen surface. Default: false. |
- Returns
- true if the operation is successful, false otherwise.
Swift code snippet:
// Set icon flat mode
let flatSuccess = iconMapObject.setFlat(true)
print("Set icon flat mode to true: \(flatSuccess)")
Objective C code snippet:
BOOL flatSuccess = [iconObject
setFlat:YES];
NSLog(@"Set icon flat mode to true: %@", flatSuccess ? @"YES" : @"NO");
◆ setInteractive:
| - (BOOL) setInteractive: |
|
(BOOL) | interactive |
|
Method is used to specify whether the map object can be interacted with.
- Parameters
-
| interactive | Specifies 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:
NSLog(@"Set circle interactive to true: %@", interactiveSuccess ? @"YES" : @"NO");
◆ setOffset:height:
| - (BOOL) setOffset: |
|
(float) | width |
| height: |
|
(float) | height |
Method is used to specify an offset for the icon’s anchor on screen.
- Parameters
-
| width | Horizontal offset in pixels. |
| height | Vertical offset in pixels. |
- Returns
- true if the operation is successful, false otherwise.
Swift code snippet:
// Set position offset
let offsetSuccess = iconMapObject.setOffset(x: 0.0, y: -16.0)
print("Set position offset to (0.0, -16.0) pixels: \(offsetSuccess)")
Objective C code snippet:
BOOL offsetSuccess = [iconObject setOffsetWithWidth:5.0 height:5.0];
NSLog(@"Set icon offset to 5x5 pixels: %@", offsetSuccess ? @"YES" : @"NO");
◆ setPosition:
Method is used to specify the center of the icon.
- Parameters
-
- Returns
- true if the operation is successful, false otherwise.
Swift code snippet:
// Set icon position
let position = NCLocationPoint(x: 30.0, y: 40.0)
let success = iconMapObject.setPosition(position)
print("Set icon position to (\(position.x), \(position.y)): \(success)")
Objective C code snippet:
NCLocationPoint *newPosition = [[
NCLocationPoint alloc] initWithX:35.0 y:45.0];
BOOL positionSuccess = [iconObject
setPosition:newPosition];
NSLog(@"Set icon position to (%.1f, %.1f): %@", newPosition.x, newPosition.y, positionSuccess ? @"YES" : @"NO");
◆ setPositionAnimated:duration:type:
Method is used to move the center of the icon with the specified animation.
- Parameters
-
- Returns
- true if the operation is successful, false otherwise.
Swift code snippet:
// Set icon position with animation
let animatedPosition = NCLocationPoint(x: 35.0, y: 45.0)
let animatedSuccess = iconMapObject.setPositionAnimated(animatedPosition, duration: 1.5, animationType: .cubic)
print("Set icon position with animation to (\(animatedPosition.x), \(animatedPosition.y)): \(animatedSuccess)")
Objective C code snippet:
NCLocationPoint *animatedPosition = [[
NCLocationPoint alloc] initWithX:40.0 y:50.0];
BOOL animatedSuccess = [iconObject setPositionAnimated:animatedPosition duration:2.0 animationType:NCLinear];
NSLog(@"Set icon position with animation to (%.1f, %.1f): %@", animatedPosition.x, animatedPosition.y, animatedSuccess ? @"YES" : @"NO");
◆ setPriority:
| - (BOOL) setPriority: |
|
(float) | priority |
|
Method is used to specify the priority of the icon.
- Parameters
-
| priority | The priority value for rendering or interaction. Default: max. |
- Returns
- true if the operation is successful, false otherwise.
Swift code snippet:
// Set rendering priority
let prioritySuccess = iconMapObject.setPriority(2)
print("Set rendering priority to 2: \(prioritySuccess)")
Objective C code snippet:
NSLog(@"Set icon priority to 1: %@", prioritySuccess ? @"YES" : @"NO");
◆ setSize:height:
| - (BOOL) setSize: |
|
(float) | width |
| height: |
|
(float) | height |
Method is used to specify the size of the icon.
- Parameters
-
| width | Width of the icon in pixels. |
| height | Height of the icon in pixels. |
- Returns
- true if the operation is successful, false otherwise.
Swift code snippet:
// Set icon size
let size = NCSize(width: 32.0, height: 32.0)
let sizeSuccess = iconMapObject.setSize(size)
print("Set icon size to (\(size.width), \(size.height)): \(sizeSuccess)")
Objective C code snippet:
NCSize *size = [[NCSize alloc] initWithWidth:32.0 height:32.0];
BOOL sizeSuccess = [iconObject setSize:size];
NSLog(@"Set icon size to (%.1f, %.1f): %@", size.width, size.height, sizeSuccess ? @"YES" : @"NO");
◆ setTitle:
| - (BOOL) setTitle: |
|
(nonnull NSString *) | title |
|
Method is used to set the title of the map object.
- Parameters
-
| title | The 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:
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
-
| visible | Specifies 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:
BOOL visibleSuccess = [circleObject
setVisible:YES];
NSLog(@"Set circle visibility to true: %@", visibleSuccess ? @"YES" : @"NO");
◆ valid
Tells if this object is valid or not. Any method called on an invalid object will throw an exception. The object becomes invalid only on UI thread, and only when its implementation depends on objects already destroyed by now.
Definition at line 234 of file NCIconMapObject.h.
The documentation for this class was generated from the following file: