Other Functions

The following functions are available globally.

  • Creates a new MGLMapPoint from the given X and Y coordinates, and zoom level.

    Declaration

    Objective-C

    static inline MGLMapPoint DingiMapPointMake(CGFloat x, CGFloat y,
                                                CGFloat zoomLevel)

    Swift

    func DingiMapPointMake(_ x: CGFloat, _ y: CGFloat, _ zoomLevel: CGFloat) -> MGLMapPoint
  • Returns Mercator projection of a WGS84 coordinate at the specified zoom level.

    Declaration

    Objective-C

    extern MGLMapPoint DingiMapPointForCoordinate(CLLocationCoordinate2D coordinate,
                                                  double zoomLevel)

    Swift

    func DingiMapPointForCoordinate(_ coordinate: CLLocationCoordinate2D, _ zoomLevel: Double) -> MGLMapPoint
  • Converts a map zoom level to a camera altitude.

    Declaration

    Objective-C

    extern CLLocationDistance DingiAltitudeForZoomLevel(double zoomLevel,
                                                        CGFloat pitch,
                                                        CLLocationDegrees latitude,
                                                        CGSize size)

    Swift

    func DingiAltitudeForZoomLevel(_ zoomLevel: Double, _ pitch: CGFloat, _ latitude: CLLocationDegrees, _ size: CGSize) -> CLLocationDistance

    Parameters

    zoomLevel

    The zoom level to convert.

    pitch

    The camera pitch, measured in degrees.

    latitude

    The latitude of the point at the center of the viewport.

    size

    The size of the viewport.

    Return Value

    An altitude measured in meters.

  • Converts a camera altitude to a map zoom level.

    Declaration

    Objective-C

    extern double DingiZoomLevelForAltitude(CLLocationDistance altitude,
                                            CGFloat pitch,
                                            CLLocationDegrees latitude, CGSize size)

    Swift

    func DingiZoomLevelForAltitude(_ altitude: CLLocationDistance, _ pitch: CGFloat, _ latitude: CLLocationDegrees, _ size: CGSize) -> Double

    Parameters

    altitude

    The altitude to convert, measured in meters.

    pitch

    The camera pitch, measured in degrees.

    latitude

    The latitude of the point at the center of the viewport.

    size

    The size of the viewport.

    Return Value

    A zero-based zoom level.

  • Creates a new DingiSphericalPosition from the given radial, azimuthal, polar.

    Declaration

    Objective-C

    static inline DingiSphericalPosition
    DingiSphericalPositionMake(CGFloat radial, CLLocationDirection azimuthal,
                               CLLocationDirection polar)

    Swift

    func DingiSphericalPositionMake(_ radial: CGFloat, _ azimuthal: CLLocationDirection, _ polar: CLLocationDirection) -> DingiSphericalPosition

    Parameters

    radial

    The radial coordinate.

    azimuthal

    The azimuthal angle.

    polar

    The polar angle.

    Return Value

    Returns a DingiSphericalPosition struct containing the position attributes.

  • Creates a new DingiTransition from the given duration and delay.

    Declaration

    Objective-C

    static inline DingiTransition DingiTransitionMake(NSTimeInterval duration,
                                                      NSTimeInterval delay)

    Swift

    func DingiTransitionMake(_ duration: TimeInterval, _ delay: TimeInterval) -> DingiTransition

    Parameters

    duration

    The amount of time the animation should take, not including the delay.

    delay

    The amount of time in seconds to wait before beginning the animation.

    Return Value

    Returns a DingiTransition struct containing the transition attributes.