MapSceneLights

public class MapSceneLights
extension MapSceneLights: NativeBase
extension MapSceneLights: Hashable

Manage the lights and their attributes in a scene.

  • This callback function allows handling errors that occur during the setting of light attributes.

    Note: The error code NO_LIGHTS may be returned when attempting to set light attributes in map schemes that do not support lights, for instance road.network map scheme.

    Please refer to the error code documentation for further details on error handling.

    Declaration

    Swift

    public typealias AttributeSettingCompletionHandler = (_ setLightError: MapSceneLights.AttributeSettingError?) -> Void

    Parameters

    setLightError

    The cause for the failure when setting the light attributes, or nil if no error occurred.

  • The scene uses three categories of lighting which are: Main light, Back light and Rim light. These lights are directional lights.

    The properties of all lights have an impact on the shading of 3D objects, for instance, extruded buildings within the scene. However, shadow casting is only affected by the direction of the main light.

    Category primarily serves as an identifier type for managing the lights.

    See more

    Declaration

    Swift

    public enum Category : UInt32, CaseIterable, Codable
  • Error enum indicating reasons for failure when setting light attributes.

    See more

    Declaration

    Swift

    public enum AttributeSettingError : UInt32, CaseIterable, Codable
  • The direction of lights as a pair of azimuth and altitude angles. See https://en.wikipedia.org/wiki/Horizontal_coordinate_system

    See more

    Declaration

    Swift

    public struct Direction : Hashable
  • Set a new color for the light based on its category.

    Declaration

    Swift

    public func setColor(category: MapSceneLights.Category, color: UIColor, completion: MapSceneLights.AttributeSettingCompletionHandler?)

    Parameters

    category

    The category of light for which the color is set.

    color

    The Color type includes red, green, blue, and alpha components. The value of these components must be inside the range [0, 1].

    completion

    Optional callback that will receive the result of this operation.

  • Set a new intensity for the light based on its category.

    Declaration

    Swift

    public func setIntensity(category: MapSceneLights.Category, intensity: Double, completion: MapSceneLights.AttributeSettingCompletionHandler?)

    Parameters

    category

    The category of light for which the intensity is set.

    intensity

    The light intensity value must be inside the range [0, 10]. The intensity value is clamped to this range. If the value falls outside its supported range, it will be adjusted to stay within the range. Note: When the intensity value is big, 3D objects might turn completely white because all the color channels could go over the limit of 1.0.

    completion

    Optional callback that will receive the result of this operation.

  • Set a new direction for the light based on its category.

    Declaration

    Swift

    public func setDirection(category: MapSceneLights.Category, direction: MapSceneLights.Direction, completion: MapSceneLights.AttributeSettingCompletionHandler?)

    Parameters

    category

    The category of light for which the direction is set.

    direction

    The Direction contains azimuth and altitude angles in degrees.

    completion

    Optional callback that will receive the result of this operation.

  • Retrieves the current color of the light based on its category.

    Declaration

    Swift

    public func getColor(category: MapSceneLights.Category) -> UIColor?

    Parameters

    category

    The category of light from which the color is retrieved.

    Return Value

    The current color of the light, or nil if the light is missing from the loaded scene or MapScene is not intitialized.

  • Retrieves the current intensity of the light based on its category.

    Declaration

    Swift

    public func getIntensity(category: MapSceneLights.Category) -> Double?

    Parameters

    category

    The category of light from which the intensity is retrieved.

    Return Value

    The current intensity of the light, or nil if the light is missing from the loaded scene or MapScene is not intitialized.

  • Retrieves the current direction of the light based on its category.

    Declaration

    Swift

    public func getDirection(category: MapSceneLights.Category) -> MapSceneLights.Direction?

    Parameters

    category

    The category of light from which the direction is retrieved.

    Return Value

    The current direction of the light, or nil if the light is missing from the loaded scene or MapScene is not intitialized.

  • Resets all attributes of each light to their default values based on the current map scene settings.

    Declaration

    Swift

    public func reset()