MSFBaseMapView

Objective-C


@interface MSFBaseMapView : NSObject {
  void *swigCPtr;
  BOOL swigCMemOwn;
}

Swift

class MSFBaseMapView : NSObject

A platform independent main view class for all mapping operations. Allows the user to manipulate the map and access various related components.

  • Returns the SDK version and build info. The result should be used only for reporting purposes.

    Declaration

    Objective-C

    + (NSString *)getSDKVersion;

    Swift

    class func getSDKVersion() -> String!

    Return Value

    The SDK version and build info.

  • Undocumented

    Declaration

    Objective-C

    -(id)init;

    Swift

    init!()
  • Prepares renderers for drawing. Has to be called again if the graphics context was lost.

    Declaration

    Objective-C

    - (void)onSurfaceCreated;

    Swift

    func onSurfaceCreated()
  • Changes the screen size of the map view. Calling this method before onSurfaceCreated is called results in undefined behaviour.

    Declaration

    Objective-C

    - (void)onSurfaceChanged:(int)width height:(int)height;

    Swift

    func onSurfaceChanged(_ width: Int32, height: Int32)

    Parameters

    width

    The new width of the map view.

    height

    The new height of the map view.

  • Draws a single frame to the current graphics context. Calling this method before onSurfaceCreated and onSurfaceChanged are called results in undefined behaviour.

    Declaration

    Objective-C

    - (void)onDrawFrame;

    Swift

    func onDrawFrame()
  • Stops renderer. Rendering may resume only after onSurfaceCreated is called again.

    Declaration

    Objective-C

    - (void)onSurfaceDestroyed;

    Swift

    func onSurfaceDestroyed()
  • Finish all rendering (wait until all rendering commands have finished executing).

    Declaration

    Objective-C

    - (void)finishRendering;

    Swift

    func finishRendering()
  • Handles a user input event.

    Declaration

    Objective-C

    - (void)onInputEvent:(int)event
                      x1:(float)x1
                      y1:(float)y1
                      x2:(float)x2
                      y2:(float)y2;

    Swift

    func onInputEvent(_ event: Int32, x1: Float, y1: Float, x2: Float, y2: Float)

    Parameters

    event

    The event type. First pointer down = 0, second pointer down = 1, either pointer moved = 2, gesture canceled = 3, first pointer up = 4, second pointer up = 5.

    x1

    The x coordinate of the first pointer. -1 if there are no coordinates.

    y1

    The y coordinate of the first pointer. -1 if there are no coordinates.

    x2

    The x coordinate of the second pointer. -1 if there are no coordinates.

    y2

    The y coordinate of the second pointer. -1 if there are no coordinates.

  • Handles a wheel-rotation event.

    Declaration

    Objective-C

    - (void)onWheelEvent:(int)delta x:(float)x y:(float)y;

    Swift

    func onWheelEvent(_ delta: Int32, x: Float, y: Float)

    Parameters

    delta

    The number of ticks wheel changed with sign showing the direction of change.

    x

    The x coordinate of the pointer.

    y

    The y coordinate of the pointer.

  • Zooms by a continuous delta, for a host whose wheel does not come in ticks (a trackpad, a browser). Keeps the ground under the pointer still, also over 3D terrain, unlike setZoom with a target.

    Declaration

    Objective-C

    - (void)onWheelZoom:(float)zoomDelta x:(float)x y:(float)y;

    Swift

    func onWheelZoom(_ zoomDelta: Float, x: Float, y: Float)

    Parameters

    zoomDelta

    The zoom change, positive zooms in.

    x

    The x coordinate of the pointer.

    y

    The y coordinate of the pointer.

  • Returns the Layers object, that can be used for adding and removing map layers.

    Declaration

    Objective-C

    - (MSFLayers *)getLayers;

    Swift

    func getLayers() -> MSFLayers!

    Return Value

    The Layer object.

  • Returns the Options object, that can be used for modifying various map options.

    Declaration

    Objective-C

    - (MSFOptions *)getOptions;

    Swift

    func getOptions() -> MSFOptions!

    Return Value

    the Option object.

  • Returns the MapRenderer object, that can be used for controlling rendering options.

    Declaration

    Objective-C

    - (MSFMapRenderer *)getMapRenderer;

    Swift

    func getMapRenderer() -> MSFMapRenderer!

    Return Value

    the MapRenderer object.

  • Returns the position that the camera is currently looking at.

    Declaration

    Objective-C

    - (MSFMapPos *)getFocusPos;

    Swift

    func getFocusPos() -> MSFMapPos!

    Return Value

    The current focus position in the coordinate system of the base projection.

  • Returns the position the camera itself is above (the viewpoint), which at a low tilt is far from the focus it looks at. Where a top-down view has to be centred to come back to the same place.

    Declaration

    Objective-C

    - (MSFMapPos *)getCameraPos;

    Swift

    func getCameraPos() -> MSFMapPos!

    Return Value

    The camera’s ground position in the coordinate system of the base projection.

  • Returns the map rotation in degrees. 0 means looking north, 90 means west, -90 means east and 180 means south.

    Declaration

    Objective-C

    - (float)getRotation;

    Swift

    func getRotation() -> Float

    Return Value

    The map rotation in degrees in range of (-180 .. 180].

  • Returns the tilt angle in degrees. 0 means looking directly at the horizon, 90 means looking directly down.

    Declaration

    Objective-C

    - (float)getTilt;

    Swift

    func getTilt() -> Float

    Return Value

    The tilt angle in degrees.

  • Returns the zoom level. The value returned is never negative, 0 means absolutely zoomed out and all other values describe some level of zoom.

    Declaration

    Objective-C

    - (float)getZoom;

    Swift

    func getZoom() -> Float

    Return Value

    The zoom level.

  • Pans the view relative to the current focus position, deltaPos in the base projection’s coordinate system. The new focus is clamped to the world bounds and to Options::setPanBounds. If durationSeconds > 0 the pan is animated; a previous pan animation still running is stopped.

    Declaration

    Objective-C

    - (void)pan:(MSFMapVec *)deltaPos durationSeconds:(float)durationSeconds;

    Swift

    func pan(_ deltaPos: MSFMapVec!, durationSeconds: Float)

    Parameters

    deltaPos

    The relative coordinate shift.

    durationSeconds

    The duration in which the panning operation will be completed in seconds.

  • Sets the new absolute focus position, in the base projection’s coordinate system, clamped to the world bounds and to Options::setPanBounds. If durationSeconds > 0 the pan is animated; a previous pan animation still running is stopped.

    Declaration

    Objective-C

    - (void)setFocusPos:(MSFMapPos *)pos durationSeconds:(float)durationSeconds;

    Swift

    func setFocus(_ pos: MSFMapPos!, durationSeconds: Float)

    Parameters

    pos

    The new absolute focus position.

    durationSeconds

    The duration in which the panning operation will be completed in seconds.

  • Points the camera at a position and a zoom level immediately, with no animation, and before the first frame too. Prefer it over setFocusPos + setZoom: with restricted panning, a focus set at a world view is clamped to the middle of the pan bounds and the zoom that follows does not undo it.

    Declaration

    Objective-C

    - (void)moveTo:(MSFMapPos *)pos zoom:(float)zoom;

    Swift

    func move(to pos: MSFMapPos!, zoom: Float)

    Parameters

    pos

    The target position in base projection coordinate system.

    zoom

    The target zoom level.

  • The same, also setting rotation and tilt. See moveTo.

    Declaration

    Objective-C

    - (void)moveTo:(MSFMapPos *)pos
              zoom:(float)zoom
          rotation:(float)rotation
              tilt:(float)tilt;

    Swift

    func move(to pos: MSFMapPos!, zoom: Float, rotation: Float, tilt: Float)

    Parameters

    pos

    The target position in base projection coordinate system.

    zoom

    The target zoom level.

    rotation

    The rotation in degrees.

    tilt

    The tilt in degrees.

  • Puts the camera itself at a position, where moveTo places the focus it looks at: for a first-person or panorama view. Rotation and tilt are applied first. Exact on a planar projection; on the globe a very long move lands close rather than exact.

    Declaration

    Objective-C

    - (void)moveCameraTo:(MSFMapPos *)pos
                    zoom:(float)zoom
                rotation:(float)rotation
                    tilt:(float)tilt;

    Swift

    func moveCamera(to pos: MSFMapPos!, zoom: Float, rotation: Float, tilt: Float)

    Parameters

    pos

    The target camera position in base projection coordinate system.

    zoom

    The target zoom level.

    rotation

    The rotation in degrees.

    tilt

    The tilt in degrees.

  • The same, keeping the current rotation and tilt. See moveCameraTo.

    Declaration

    Objective-C

    - (void)moveCameraTo:(MSFMapPos *)pos zoom:(float)zoom;

    Swift

    func moveCamera(to pos: MSFMapPos!, zoom: Float)

    Parameters

    pos

    The target camera position in base projection coordinate system.

    zoom

    The target zoom level.

  • Moves the camera to a position and a zoom level in one animation, pulling back over a long move and coming down at the target (Van Wijk & Nuij’s optimal path). Asked for before the first frame, the flight runs from that frame.

    Declaration

    Objective-C

    - (void)flyTo:(MSFMapPos *)pos
                   zoom:(float)zoom
        durationSeconds:(float)durationSeconds;

    Swift

    func fly(to pos: MSFMapPos!, zoom: Float, durationSeconds: Float)

    Parameters

    pos

    The target position in base projection coordinate system.

    zoom

    The target zoom level.

    durationSeconds

    The duration in seconds, or 0 to derive it from the length of the path. 0 is not “immediate”; for that use moveTo.

  • Moves the camera to a position, zoom, rotation and tilt in one animation. See flyTo.

    Declaration

    Objective-C

    - (void)flyTo:(MSFMapPos *)pos
                   zoom:(float)zoom
               rotation:(float)rotation
                   tilt:(float)tilt
        durationSeconds:(float)durationSeconds;

    Swift

    func fly(to pos: MSFMapPos!, zoom: Float, rotation: Float, tilt: Float, durationSeconds: Float)

    Parameters

    pos

    The target position in base projection coordinate system.

    zoom

    The target zoom level.

    rotation

    The target rotation in degrees.

    tilt

    The target tilt in degrees.

    durationSeconds

    The duration in seconds, or 0 to derive it from the path.

  • Moves the camera to a position, zoom, rotation and tilt in one animation, climbing on the way: the climb is added to the target Z (the final viewpoint height) as a parabola, highest halfway.

    Declaration

    Objective-C

    - (void)flyTo:(MSFMapPos *)pos
                   zoom:(float)zoom
               rotation:(float)rotation
                   tilt:(float)tilt
            climbHeight:(float)climbHeight
        durationSeconds:(float)durationSeconds;

    Swift

    func fly(to pos: MSFMapPos!, zoom: Float, rotation: Float, tilt: Float, climbHeight: Float, durationSeconds: Float)

    Parameters

    pos

    The target position in base projection coordinate system; its Z is the target height.

    zoom

    The target zoom level.

    rotation

    The target rotation in degrees.

    tilt

    The target tilt in degrees.

    climbHeight

    The extra height at the middle of the path, in the base projection’s units.

    durationSeconds

    The duration in seconds, or 0 to derive it from the path.

  • Moves the camera as the overload above, on a chosen timing curve. The others fly on FLIGHT_EASING_EASE.

    Declaration

    Objective-C

    - (void)flyTo:(MSFMapPos *)pos
                   zoom:(float)zoom
               rotation:(float)rotation
                   tilt:(float)tilt
            climbHeight:(float)climbHeight
        durationSeconds:(float)durationSeconds
                 easing:(enum MSFFlightEasing)easing;

    Swift

    func fly(to pos: MSFMapPos!, zoom: Float, rotation: Float, tilt: Float, climbHeight: Float, durationSeconds: Float, easing: MSFFlightEasing)

    Parameters

    pos

    The target position in base projection coordinate system; its Z is the target height.

    zoom

    The target zoom level.

    rotation

    The target rotation in degrees.

    tilt

    The target tilt in degrees.

    climbHeight

    The extra height at the middle of the path, in the base projection’s units.

    durationSeconds

    The duration in seconds, or 0 to derive it from the path.

    easing

    The timing curve the whole move runs on.

  • Stops a flight started with flyTo, leaving the camera where it is.

    Declaration

    Objective-C

    - (void)stopFlight;

    Swift

    func stopFlight()
  • Returns true while a flyTo animation is running.

    Declaration

    Objective-C

    - (BOOL)isFlightActive;

    Swift

    func isFlightActive() -> Bool

    Return Value

    True if the camera is in flight.

  • How far along a flyTo animation is, from 0 to 1, or -1 when none is running. The value the camera is actually at, so an app animating its own state alongside the move reads it rather than its own clock.

    Declaration

    Objective-C

    - (float)getFlightProgress;

    Swift

    func getFlightProgress() -> Float

    Return Value

    The flight progress, or -1.

  • Rotates the view relative to the current rotation, positive clockwise, wrapped to (-180 .. 180]. Ignored if Options::setRotatable is false. If durationSeconds > 0 the rotation is animated; a previous rotation animation still running is stopped.

    Declaration

    Objective-C

    - (void)rotate:(float)deltaAngle durationSeconds:(float)durationSeconds;

    Swift

    func rotate(_ deltaAngle: Float, durationSeconds: Float)

    Parameters

    deltaAngle

    The delta rotation value in degrees.

    durationSeconds

    The duration in which the rotation operation will be completed in seconds.

  • Rotates the view relative to the current rotation, positive clockwise, wrapped to (-180 .. 180], around targetPos, which keeps its screen location. Ignored if Options::setRotatable is false. If durationSeconds > 0 the rotation is animated; a previous rotation animation still running is stopped.

    Declaration

    Objective-C

    - (void)rotate:(float)deltaAngle
              targetPos:(MSFMapPos *)targetPos
        durationSeconds:(float)durationSeconds;

    Swift

    func rotate(_ deltaAngle: Float, targetPos: MSFMapPos!, durationSeconds: Float)

    Parameters

    deltaAngle

    The delta angle value in degrees.

    targetPos

    The zooming target position in the coordinate system of the base projection.

    durationSeconds

    The duration in which the rotation operation will be completed in seconds.

  • Sets the new absolute rotation: 0 looks north, 90 west, -90 east, 180 south; wrapped to (-180 .. 180]. Ignored if Options::setRotatable is false. If durationSeconds > 0 the rotation is animated; a previous rotation animation still running is stopped.

    Declaration

    Objective-C

    - (void)setRotation:(float)angle durationSeconds:(float)durationSeconds;

    Swift

    func setRotation(_ angle: Float, durationSeconds: Float)

    Parameters

    angle

    The new absolute angle value in degrees.

    durationSeconds

    The duration in which the rotation operation will be completed in seconds.

  • Sets the new absolute rotation (0 north, 90 west, -90 east, 180 south; wrapped to (-180 .. 180]) around targetPos, which keeps its screen location. Ignored if Options::setRotatable is false. If durationSeconds > 0 the rotation is animated; a previous rotation animation still running is stopped.

    Declaration

    Objective-C

    - (void)setRotation:(float)angle
              targetPos:(MSFMapPos *)targetPos
        durationSeconds:(float)durationSeconds;

    Swift

    func setRotation(_ angle: Float, targetPos: MSFMapPos!, durationSeconds: Float)

    Parameters

    angle

    The new absolute angle value in degrees.

    targetPos

    The zooming target position in the coordinate system of the base projection.

    durationSeconds

    The duration in which the rotation operation will be completed in seconds.

  • Tilts the view relative to the current tilt: positive down towards the map, negative up towards the horizon. The result is clamped to the range set by Options::setTiltRange. If durationSeconds > 0 the tilt is animated; a previous tilt animation still running is stopped.

    Declaration

    Objective-C

    - (void)tilt:(float)deltaTilt durationSeconds:(float)durationSeconds;

    Swift

    func tilt(_ deltaTilt: Float, durationSeconds: Float)

    Parameters

    deltaTilt

    The number of degrees the camera should be tilted by.

    durationSeconds

    The duration in which the tilting operation will be completed in seconds.

  • Sets the new absolute tilt: 0 looks at the horizon, 90 straight down. Clamped to the range set by Options::setTiltRange. If durationSeconds > 0 the tilt is animated; a previous tilt animation still running is stopped.

    Declaration

    Objective-C

    - (void)setTilt:(float)tilt durationSeconds:(float)durationSeconds;

    Swift

    func setTilt(_ tilt: Float, durationSeconds: Float)

    Parameters

    tilt

    The new absolute tilt value in degrees.

    durationSeconds

    The duration in which the tilting operation will be completed in seconds.

  • Zooms the view relative to the current zoom, positive in, negative out; clamped to [0 .. 24] and to Options::setZoomRange. If durationSeconds > 0 the zoom is animated; a previous zoom animation still running is stopped.

    Declaration

    Objective-C

    - (void)zoom:(float)deltaZoom durationSeconds:(float)durationSeconds;

    Swift

    func zoom(_ deltaZoom: Float, durationSeconds: Float)

    Parameters

    deltaZoom

    The delta zoom value.

    durationSeconds

    The duration in which the zooming operation will be completed in seconds.

  • Zooms the view relative to the current zoom (positive in, negative out; clamped to [0 .. 24] and to Options::setZoomRange) towards targetPos, which keeps its screen location. If durationSeconds > 0 the zoom is animated; a previous zoom animation still running is stopped.

    Declaration

    Objective-C

    - (void)zoom:(float)deltaZoom
              targetPos:(MSFMapPos *)targetPos
        durationSeconds:(float)durationSeconds;

    Swift

    func zoom(_ deltaZoom: Float, targetPos: MSFMapPos!, durationSeconds: Float)

    Parameters

    deltaZoom

    The delta zoom value.

    targetPos

    The zooming target position in the coordinate system of the base projection.

    durationSeconds

    The duration in which the zooming operation will be completed in seconds.

  • Sets the new absolute zoom, clamped to 0 .. 24 and to Options::setZoomRange. If durationSeconds > 0 the zoom is animated; a previous zoom animation still running is stopped.

    Declaration

    Objective-C

    - (void)setZoom:(float)zoom durationSeconds:(float)durationSeconds;

    Swift

    func setZoom(_ zoom: Float, durationSeconds: Float)

    Parameters

    zoom

    The new absolute zoom value.

    durationSeconds

    The duration in which the zooming operation will be completed in seconds.

  • Sets the new absolute zoom, clamped to [0 .. 24] and to Options::setZoomRange, towards targetPos, which keeps its screen location. If durationSeconds > 0 the zoom is animated; a previous zoom animation still running is stopped.

    Declaration

    Objective-C

    - (void)setZoom:(float)zoom
              targetPos:(MSFMapPos *)targetPos
        durationSeconds:(float)durationSeconds;

    Swift

    func setZoom(_ zoom: Float, targetPos: MSFMapPos!, durationSeconds: Float)

    Parameters

    zoom

    The new absolute zoom value.

    targetPos

    The zooming target position in the coordinate system of the base projection.

    durationSeconds

    The duration in which the zooming operation will be completed in seconds.

  • Animate the view parameters (focus position, tilt, rotation, zoom) so that the specified bounding box becomes fully visible. This method does not work before the screen size is set.

    Declaration

    Objective-C

    - (void)moveToFitBounds:(MSFMapBounds *)mapBounds
               screenBounds:(MSFScreenBounds *)screenBounds
                integerZoom:(BOOL)integerZoom
            durationSeconds:(float)durationSeconds;

    Swift

    func move(toFit mapBounds: MSFMapBounds!, screenBounds: MSFScreenBounds!, integerZoom: Bool, durationSeconds: Float)

    Parameters

    mapBounds

    The bounding box on the map to be made visible in the base projection’s coordinate system.

    screenBounds

    The screen bounding box where to fit the map bounding box.

    integerZoom

    If true, then closest integer zoom level will be used. If false, exact fractional zoom level will be used.

    durationSeconds

    The duration in which the operation will be completed in seconds.

  • Animate the view parameters (focus position, tilt, rotation, zoom) so that the specified bounding box becomes fully visible. Also supports resetting the tilt and rotation angles over the course of the animation. This method does not work before the screen size is set.

    Declaration

    Objective-C

    - (void)moveToFitBounds:(MSFMapBounds *)mapBounds
               screenBounds:(MSFScreenBounds *)screenBounds
                integerZoom:(BOOL)integerZoom
              resetRotation:(BOOL)resetRotation
                  resetTilt:(BOOL)resetTilt
            durationSeconds:(float)durationSeconds;

    Swift

    func move(toFit mapBounds: MSFMapBounds!, screenBounds: MSFScreenBounds!, integerZoom: Bool, resetRotation: Bool, resetTilt: Bool, durationSeconds: Float)

    Parameters

    mapBounds

    The bounding box on the map to be made visible in the base projection’s coordinate system.

    screenBounds

    The screen bounding box where to fit the map bounding box.

    integerZoom

    If true, then closest integer zoom level will be used. If false, exact fractional zoom level will be used.

    resetTilt

    If true, view will be untilted. If false, current tilt will be kept.

    resetRotation

    If true, rotation will be reset. If false, current rotation will be kept.

    durationSeconds

    The duration in which the operation will be completed in seconds.

  • Returns the map event listener. May be null.

    Declaration

    Objective-C

    - (MSFMapEventListener *)getMapEventListener;

    Swift

    func getMapEventListener() -> MSFMapEventListener!

    Return Value

    The map event listener.

  • Sets the map event listener. If a null pointer is passed no map events will be generated. The default is null.

    Declaration

    Objective-C

    - (void)setMapEventListener:(MSFMapEventListener *)mapEventListener;

    Swift

    func setMapEventListener(_ mapEventListener: MSFMapEventListener!)

    Parameters

    mapEventListener

    The new map event listener.

  • Returns the redraw request listener.

    Declaration

    Objective-C

    - (MSFRedrawRequestListener *)getRedrawRequestListener;

    Swift

    func getRedrawRequestListener() -> MSFRedrawRequestListener!

    Return Value

    The redraw request listener.

  • Sets the listener which will notified when the map needs to be redrawn

    Declaration

    Objective-C

    - (void)setRedrawRequestListener:(MSFRedrawRequestListener *)listener;

    Swift

    func setRedrawRequestListener(_ listener: MSFRedrawRequestListener!)

    Parameters

    listener

    The redraw listener.

  • Calculates the map position corresponding to a screen position, using the current view parameters.

    Declaration

    Objective-C

    - (MSFMapPos *)screenToMap:(MSFScreenPos *)screenPos;

    Swift

    func screen(toMap screenPos: MSFScreenPos!) -> MSFMapPos!

    Parameters

    screenPos

    The screen position.

    Return Value

    The calculated map position in base projection coordinate system. If the given screen position is not on the map, NaNs are returned.

  • Calculates the screen position corresponding to a map position, using the current view parameters.

    Declaration

    Objective-C

    - (MSFScreenPos *)mapToScreen:(MSFMapPos *)mapPos;

    Swift

    func map(toScreen mapPos: MSFMapPos!) -> MSFScreenPos!

    Parameters

    mapPos

    The map position in base projection coordinate system.

    Return Value

    The calculated screen position. Can be off-screen.

  • Cancels all qued tasks such as tile and vector data fetches. Tasks that have already started may continue until they finish. Tasks that are added after this method call are not affected.

    Declaration

    Objective-C

    - (void)cancelAllTasks;

    Swift

    func cancelAllTasks()
  • Releases the memory occupied by the preloading area. Calling this method releases some memory if preloading is enabled, but means that the area right outside the visible area has to be fetched again.

    Declaration

    Objective-C

    - (void)clearPreloadingCaches;

    Swift

    func clearPreloadingCaches()
  • Releases memory occupied by all caches. Calling this means that everything has to be fetched again, including the visible area.

    Declaration

    Objective-C

    - (void)clearAllCaches;

    Swift

    func clearAllCaches()
  • Undocumented

    Declaration

    Objective-C

    -(void)dealloc;

    Swift

    func dealloc()