MBMFreeCameraOptions
@interface MBMFreeCameraOptions : NSObject
Various options for accessing physical properties of the underlying camera entity. A direct access to these properties allows more flexible and precise controlling of the camera while also being fully compatible and interchangeable with CameraOptions. All fields are optional.
-
Unavailable
Undocumented
Declaration
Objective-C
- (nonnull instancetype)init NS_UNAVAILABLE;
-
Unavailable
Undocumented
Declaration
Objective-C
+ (nonnull instancetype)new NS_UNAVAILABLE;
-
Get the position of the camera in slightly modified web mercator coordinates
- The size of 1 unit is the width of the projected world instead of the “mercator meter”. Coordinate [0, 0, 0] is the north-west corner and [1, 1, 0] is the south-east corner.
- Z coordinate is conformal and must respect minimum and maximum zoom values.
Zoom is automatically computed from the altitude (z)
Return Value
The position if set.
-
Set the position of the camera in slightly modified web mercator coordinates
- The size of 1 unit is the width of the projected world instead of the “mercator meter”. Coordinate [0, 0, 0] is the north-west corner and [1, 1, 0] is the south-east corner.
- Z coordinate is conformal and must respect minimum and maximum zoom values.
Zoom is automatically computed from the altitude (z)
Declaration
Objective-C
- (void)setPositionForPosition:(nullable MBMVec3 *)position;
Swift
func setPositionForPosition(_ position: MBMVec3?)
Parameters
position
The position to be set.
-
Get the orientation of the camera represented as a unit quaternion [x, y, z, w]. The default pose of the camera is such that the forward vector is looking up the -Z axis and the up vector is aligned with north orientation of the map: forward: [0, 0, -1] up: [0, -1, 0] right [1, 0, 0]
With the w value as the real part of the complex number
Declaration
Objective-C
- (nullable MBMVec4 *)getOrientation;
Swift
func getOrientation() -> MBMVec4?
Return Value
The orientation if set.
-
Set the orientation of the camera represented as a unit quaternion [x, y, z, w]. The default pose of the camera is such that the forward vector is looking up the -Z axis and the up vector is aligned with north orientation of the map: forward: [0, 0, -1] up: [0, -1, 0] right [1, 0, 0]
With the w value as the real part of the complex number
Orientation can be set freely but certain constraints still apply - Orientation must be representable with only pitch and bearing. - Pitch has an upper limit
Declaration
Objective-C
- (void)setOrientationForOrientation:(nullable MBMVec4 *)orientation;
Swift
func setOrientationForOrientation(_ orientation: MBMVec4?)
Parameters
orientation
The orientation to be set.
-
Helper function for setting the mercator position as Lat&Lng and altitude in meters
Declaration
Objective-C
- (void)setLocationForLocation:(CLLocationCoordinate2D)location altitude:(double)altitude;
Swift
func setLocationForLocation(_ location: CLLocationCoordinate2D, altitude: Double)
Parameters
location
The mercator
coordinate
.altitude
The altitude in meters.
-
Helper function for setting orientation of the camera by defining a focus point. Elevation of 0.0 is used and no up vector.
Note: Orientation can be invalid after this call, if the input leads to the camera being upside down or the quaternion has zero length.
Declaration
Objective-C
- (void)lookAtPointForLocation:(CLLocationCoordinate2D)location;
Swift
func lookAtPoint(forLocation location: CLLocationCoordinate2D)
Parameters
location
The
coordinate
representing focal point. -
Helper function for setting orientation of the camera by defining a focus point. No up vector is used.
Note: Orientation can be invalid after this call, if the input leads to the camera being upside down or the quaternion has zero length.
Declaration
Objective-C
- (void)lookAtPointForLocation:(CLLocationCoordinate2D)location altitude:(double)altitude;
Swift
func lookAtPoint(forLocation location: CLLocationCoordinate2D, altitude: Double)
Parameters
location
The
coordinate
representing focal point.altitude
The altitude in meters of the focal point.
-
Helper function for setting orientation of the camera by defining a focus point.
Up vector is required in certain scenarios where bearing can’t be deduced from the viewing direction.
Note: Orientation can be invalid after this call, if the input leads to the camera being upside down or the quaternion has zero length.
Declaration
Objective-C
- (void)lookAtPointForLocation:(CLLocationCoordinate2D)location altitude:(double)altitude upVector:(nonnull MBMVec3 *)upVector;
Swift
func lookAtPoint(forLocation location: CLLocationCoordinate2D, altitude: Double, upVector: MBMVec3)
Parameters
location
The
coordinate
representing focal point.altitude
The altitude in meters of the focal point.
upVector
The up vector.
-
Helper function for setting the orientation of the camera as a pitch and a bearing.
Declaration
Objective-C
- (void)setPitchBearingForPitch:(double)pitch bearing:(double)bearing;
Swift
func setPitchBearingForPitch(_ pitch: Double, bearing: Double)
Parameters
pitch
The pitch in degrees
bearing
The bearing in degrees