MaplyLocationTracker

Objective-C

@interface MaplyLocationTracker : NSObject <CLLocationManagerDelegate>

/// Exposes MaplyLocationTracker's location manager for use elsewhere
@property (nonatomic, readonly, nullable) CLLocationManager *locationManager;

/** 
    MaplyLocationTracker constructor
 
    @param viewC The globe or map view controller
 
    @param delegate The MaplyLocationTrackerDelegate for receiving location event callbacks
 
    @param useHeading Use location services heading information (requires physical magnetometer)
 
    @param useCourse Use location services course information as fallback if heading unavailable
 */
- (nonnull instancetype)initWithViewC:(MaplyBaseViewController *__nullable)viewC delegate:(NSObject<MaplyLocationTrackerDelegate> *__nullable)delegate useHeading:(bool)useHeading useCourse:(bool)useCourse simulate:(bool)simulate;

/**
    Min/max visibility for the marker assigned to follow location.
  */
@property (nonatomic,assign) float markerMinVis,markerMaxVis;

/**
    Draw priority for the marker assigned to follow location.
  */
@property (nonatomic,assign) int markerDrawPriority;

/** 
    Change lock type
 
    @param lockType The MaplyLocationLockType value for lock behavior
 
    @param forwardTrackOffset The vertical offset if using MaplyLocationLockHeadingUpOffset (positive values are below the view center)
 */
- (void) changeLockType:(MaplyLocationLockType)lockType forwardTrackOffset:(int)forwardTrackOffset;

/** 
    Stop the MaplyLocationTracker behavior and shut it down.
 */
- (void) teardown;

/** 
    Get the current device location
 
    @return The coordinate if valid, else kMaplyNullCoordinate
 */
- (MaplyCoordinate)getLocation;

@end

Swift

class MaplyLocationTracker : NSObject, CLLocationManagerDelegate

Undocumented

  • Exposes MaplyLocationTracker’s location manager for use elsewhere

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) CLLocationManager *locationManager;

    Swift

    var locationManager: CLLocationManager? { get }
  • MaplyLocationTracker constructor

    Declaration

    Objective-C

    - (nonnull instancetype)
        initWithViewC:(MaplyBaseViewController *_Nullable)viewC
             delegate:(NSObject<MaplyLocationTrackerDelegate> *_Nullable)delegate
           useHeading:(_Bool)useHeading
            useCourse:(_Bool)useCourse
             simulate:(_Bool)simulate;

    Swift

    init(viewC: MaplyBaseViewController?, delegate: (NSObjectProtocol & MaplyLocationTrackerDelegate)?, useHeading: Bool, useCourse: Bool, simulate: Bool)

    Parameters

    viewC

    The globe or map view controller

    delegate

    The MaplyLocationTrackerDelegate for receiving location event callbacks

    useHeading

    Use location services heading information (requires physical magnetometer)

    useCourse

    Use location services course information as fallback if heading unavailable

  • Min/max visibility for the marker assigned to follow location.

    Declaration

    Objective-C

    @property (nonatomic) float markerMinVis;

    Swift

    var markerMinVis: Float { get set }
  • Min/max visibility for the marker assigned to follow location.

    Declaration

    Objective-C

    @property (nonatomic) float markerMaxVis;

    Swift

    var markerMaxVis: Float { get set }
  • Draw priority for the marker assigned to follow location.

    Declaration

    Objective-C

    @property (nonatomic) int markerDrawPriority;

    Swift

    var markerDrawPriority: Int32 { get set }
  • Change lock type

    Declaration

    Objective-C

    - (void)changeLockType:(MaplyLocationLockType)lockType
        forwardTrackOffset:(int)forwardTrackOffset;

    Swift

    func change(_ lockType: MaplyLocationLockType, forwardTrackOffset: Int32)

    Parameters

    lockType

    The MaplyLocationLockType value for lock behavior

    forwardTrackOffset

    The vertical offset if using MaplyLocationLockHeadingUpOffset (positive values are below the view center)

  • Stop the MaplyLocationTracker behavior and shut it down.

    Declaration

    Objective-C

    - (void)teardown;

    Swift

    func teardown()
  • Get the current device location

    Declaration

    Objective-C

    - (MaplyCoordinate)getLocation;

    Swift

    func getLocation() -> MaplyCoordinate

    Return Value

    The coordinate if valid, else kMaplyNullCoordinate