Loading...
Searching...
No Matches

Layer that automatically renders current user position (arrow and accuracy circle) on the map. Provides visibility and anchoring controls. Referenced from LocationView. More...

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

Inherits NSObject.

Instance Methods

(void) - setVisible:
 Shows or hides user location layer.
 
(BOOL) - isVisible
 Returns true if user location layer is visible.
 
(void) - setAnchor:
 Sets anchor point for user indicator in screen pixels.
 
(void) - resetAnchor
 Resets anchor to default (center).
 
(BOOL) - anchorEnabled
 Returns true if custom anchor is enabled.
 
(void) - setHeadingModeActive:
 Enables or disables heading-up mode while the user location layer is anchored.
 
(BOOL) - headingModeActive
 Returns true if heading-up mode is enabled. Same as followMode == HEADING.
 
(void) - setFollowMode:
 Sets how the camera follows the user. NONE stops following and keeps a previously set anchor point. POSITION, HEADING and COURSE follow even without setAnchor (screen center). setAnchor() from NONE switches to POSITION. resetAnchor switches to NONE. setHeadingModeActive(true) switches to HEADING.
 
(NCUserLocationFollowMode) - followMode
 Returns the current follow mode.
 
(void) - setArrowBitmap:
 Replaces the heading arrow bitmap. Null restores the built-in heading fan.
 
(void) - setAccuracyColor:
 Sets the accuracy-circle fill. Default is a translucent blue.
 

Properties

BOOL valid
 

Detailed Description

Layer that automatically renders current user position (arrow and accuracy circle) on the map. Provides visibility and anchoring controls. Referenced from LocationView.

Definition at line 22 of file NCUserLocationLayer.h.

Method Documentation

◆ anchorEnabled

- (BOOL) anchorEnabled

Returns true if custom anchor is enabled.

Swift code snippet:

let anchorEnabled = userLocationLayer.anchorEnabled()
print("Anchor enabled: \‍(anchorEnabled)")

Objective C code snippet:

BOOL anchorEnabled = [_userLocationLayer anchorEnabled];
NSLog(@"Anchor enabled: %@", anchorEnabled ? @"YES" : @"NO");

◆ followMode

- (NCUserLocationFollowMode) followMode

Returns the current follow mode.

Swift code snippet:

let followMode = userLocationLayer.followMode()
print("Follow mode: \‍(followMode)")

Objective C code snippet:

NSLog(@"Follow mode: %ld", (long)followMode);

◆ headingModeActive

- (BOOL) headingModeActive

Returns true if heading-up mode is enabled. Same as followMode == HEADING.

Swift code snippet:

let headingModeActive = userLocationLayer.headingModeActive()
print("Heading-up mode active: \‍(headingModeActive)")

Objective C code snippet:

BOOL headingModeActive = [_userLocationLayer headingModeActive];
NSLog(@"Heading-up mode active: %@", headingModeActive ? @"YES" : @"NO");

◆ isVisible

- (BOOL) isVisible

Returns true if user location layer is visible.

Swift code snippet:

let visible = userLocationLayer.isVisible()
print("User location layer is visible: \‍(visible)")

Objective C code snippet:

BOOL visible = [_userLocationLayer isVisible];
NSLog(@"User location layer is visible: %@", visible ? @"YES" : @"NO");

◆ resetAnchor

- (void) resetAnchor

Resets anchor to default (center).

Swift code snippet:

userLocationLayer.resetAnchor()
print("Anchor reset to default")

Objective C code snippet:

NSLog(@"Anchor reset to default");

◆ setAccuracyColor:

- (void) setAccuracyColor: (nonnull UIColor *) color

Sets the accuracy-circle fill. Default is a translucent blue.

Swift code snippet:

userLocationLayer.setAccuracyColor(UIColor(red: 0.19, green: 0.67, blue: 0.85, alpha: 0.26))
print("Accuracy circle color updated")

Objective C code snippet:

[_userLocationLayer setAccuracyColor:[UIColor colorWithRed:0.19 green:0.67 blue:0.85 alpha:0.26]];
NSLog(@"Accuracy circle color updated");

◆ setAnchor:

- (void) setAnchor: (CGPoint) anchor

Sets anchor point for user indicator in screen pixels.

Swift code snippet:

let anchor = ScreenPoint(x: 100.0, y: 200.0)
userLocationLayer.setAnchor(anchor)
print("Set user location anchor to: (\‍(anchor.x), \‍(anchor.y))")

Objective C code snippet:

NCScreenPoint *anchor = [[NCScreenPoint alloc] initWithX:100.0f y:200.0f];
NSLog(@"Set user location anchor to: (%.1f, %.1f)", anchor.x, anchor.y);

◆ setArrowBitmap:

- (void) setArrowBitmap: (nullable UIImage *) bitmap

Replaces the heading arrow bitmap. Null restores the built-in heading fan.

Swift code snippet:

if let arrow = UIImage(contentsOfFile: "/path/to/arrow.png") {
userLocationLayer.setArrowBitmap(arrow)
}
userLocationLayer.setArrowBitmap(nil)
print("Custom arrow bitmap cleared")

Objective C code snippet:

UIImage *arrow = [UIImage imageWithContentsOfFile:@"/path/to/arrow.png"];
if (arrow != nil) {
}
NSLog(@"Custom arrow bitmap cleared");

◆ setFollowMode:

- (void) setFollowMode: (NCUserLocationFollowMode) mode

Sets how the camera follows the user. NONE stops following and keeps a previously set anchor point. POSITION, HEADING and COURSE follow even without setAnchor (screen center). setAnchor() from NONE switches to POSITION. resetAnchor switches to NONE. setHeadingModeActive(true) switches to HEADING.

Swift code snippet:

userLocationLayer.setFollowMode(.HEADING)
print("Follow mode set to heading")

Objective C code snippet:

[_userLocationLayer setFollowMode:NCUserLocationFollowModeHEADING];
NSLog(@"Follow mode set to heading");

◆ setHeadingModeActive:

- (void) setHeadingModeActive: (BOOL) active

Enables or disables heading-up mode while the user location layer is anchored.

When enabled and a location heading is available, the map camera rotates to keep the user's heading pointed toward the top of the screen. Without an anchor the location icon keeps rotating independently.

Swift code snippet:

userLocationLayer.setHeadingModeActive(true)
print("Heading-up mode enabled")

Objective C code snippet:

NSLog(@"Heading-up mode enabled");

◆ setVisible:

- (void) setVisible: (BOOL) visible

Shows or hides user location layer.

Swift code snippet:

userLocationLayer.setVisible(true)
print("User location layer set visible")

Objective C code snippet:

NSLog(@"User location layer set visible");

Property Documentation

◆ valid

- (BOOL) valid
readnonatomicassign

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 204 of file NCUserLocationLayer.h.


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