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
widthThe new width of the map view.
heightThe 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
eventThe 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.
x1The x coordinate of the first pointer. -1 if there are no coordinates.
y1The y coordinate of the first pointer. -1 if there are no coordinates.
x2The x coordinate of the second pointer. -1 if there are no coordinates.
y2The 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
deltaThe number of ticks wheel changed with sign showing the direction of change.
xThe x coordinate of the pointer.
yThe 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
zoomDeltaThe zoom change, positive zooms in.
xThe x coordinate of the pointer.
yThe y coordinate of the pointer.
-
Returns the Options object, that can be used for modifying various map options.
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 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.
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() -> FloatReturn 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() -> FloatReturn 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() -> FloatReturn 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
deltaPosThe relative coordinate shift.
durationSecondsThe 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
posThe new absolute focus position.
durationSecondsThe 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
posThe target position in base projection coordinate system.
zoomThe 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
posThe target position in base projection coordinate system.
zoomThe target zoom level.
rotationThe rotation in degrees.
tiltThe 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
posThe target camera position in base projection coordinate system.
zoomThe target zoom level.
rotationThe rotation in degrees.
tiltThe 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
posThe target camera position in base projection coordinate system.
zoomThe 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
posThe target position in base projection coordinate system.
zoomThe target zoom level.
durationSecondsThe 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
posThe target position in base projection coordinate system.
zoomThe target zoom level.
rotationThe target rotation in degrees.
tiltThe target tilt in degrees.
durationSecondsThe 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
posThe target position in base projection coordinate system; its Z is the target height.
zoomThe target zoom level.
rotationThe target rotation in degrees.
tiltThe target tilt in degrees.
climbHeightThe extra height at the middle of the path, in the base projection’s units.
durationSecondsThe 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
posThe target position in base projection coordinate system; its Z is the target height.
zoomThe target zoom level.
rotationThe target rotation in degrees.
tiltThe target tilt in degrees.
climbHeightThe extra height at the middle of the path, in the base projection’s units.
durationSecondsThe duration in seconds, or 0 to derive it from the path.
easingThe 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() -> BoolReturn 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() -> FloatReturn 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
deltaAngleThe delta rotation value in degrees.
durationSecondsThe 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
deltaAngleThe delta angle value in degrees.
targetPosThe zooming target position in the coordinate system of the base projection.
durationSecondsThe 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
angleThe new absolute angle value in degrees.
durationSecondsThe 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
angleThe new absolute angle value in degrees.
targetPosThe zooming target position in the coordinate system of the base projection.
durationSecondsThe 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
deltaTiltThe number of degrees the camera should be tilted by.
durationSecondsThe 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
tiltThe new absolute tilt value in degrees.
durationSecondsThe 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
deltaZoomThe delta zoom value.
durationSecondsThe 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
deltaZoomThe delta zoom value.
targetPosThe zooming target position in the coordinate system of the base projection.
durationSecondsThe 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
zoomThe new absolute zoom value.
durationSecondsThe 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
zoomThe new absolute zoom value.
targetPosThe zooming target position in the coordinate system of the base projection.
durationSecondsThe 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
mapBoundsThe bounding box on the map to be made visible in the base projection’s coordinate system.
screenBoundsThe screen bounding box where to fit the map bounding box.
integerZoomIf true, then closest integer zoom level will be used. If false, exact fractional zoom level will be used.
durationSecondsThe 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
mapBoundsThe bounding box on the map to be made visible in the base projection’s coordinate system.
screenBoundsThe screen bounding box where to fit the map bounding box.
integerZoomIf true, then closest integer zoom level will be used. If false, exact fractional zoom level will be used.
resetTiltIf true, view will be untilted. If false, current tilt will be kept.
resetRotationIf true, rotation will be reset. If false, current rotation will be kept.
durationSecondsThe 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
mapEventListenerThe 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
listenerThe 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
screenPosThe 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
mapPosThe 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()