Class LightStop

java.lang.Object
com.massifmaps.components.LightStop

public class LightStop extends Object
One point on a day-cycle light curve: the scene light at a given sun height.

A list of these IS the "formula" that turns an hour into a look. Everything downstream is
derived from the two lights it names - the colour every 2D surface is graded by, the sun and
ambient the 3D buildings and the terrain are lit with, and the brightness a style reads as
`view::brightness` - so replacing the list replaces the whole map's palette at every hour,
in 2D and in 3D, without a second theme and without a re-decode.

The default list is MapBox Standard's own four light setups, which is why a converted
Standard renders as its `day` preset at noon and its `dusk` preset at 19h.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs an empty LightStop, a white light at the horizon.
    LightStop(float sunAltitude, Color ambientColor, float ambientIntensity, Color sunColor, float sunIntensity)
    Constructs a LightStop.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Checks if this object is equal to the specified object.
    Returns the ambient colour.
    float
    Returns the ambient intensity.
    float
    Returns the sun height this light belongs to.
    Returns the directional colour.
    float
    Returns the directional intensity.
    int
    Returns the hash value of this object.
    Creates a string representation of this light stop, useful for logging.

    Methods inherited from class java.lang.Object

    clone, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • LightStop

      public LightStop()
      Constructs an empty LightStop, a white light at the horizon.
    • LightStop

      public LightStop(float sunAltitude, Color ambientColor, float ambientIntensity, Color sunColor, float sunIntensity)
      Constructs a LightStop.
      Parameters:
      sunAltitude - The sun height this light belongs to, in degrees above the horizon.
      ambientColor - The ambient (sky) colour.
      ambientIntensity - The ambient intensity, 0-1.
      sunColor - The directional (sun) colour.
      sunIntensity - The directional intensity, 0-1.
  • Method Details

    • equals

      public boolean equals(Object obj)
      Checks if this object is equal to the specified object.
      Overrides:
      equals in class Object
      Parameters:
      obj - The reference object.
      Returns:
      True when objects are equal, false otherwise.
    • hashCode

      public int hashCode()
      Returns the hash value of this object.
      Overrides:
      hashCode in class Object
      Returns:
      The hash value of this object.
    • getSunAltitude

      public float getSunAltitude()
      Returns the sun height this light belongs to.
      Returns:
      The sun height, in degrees above the horizon.
    • getAmbientColor

      public Color getAmbientColor()
      Returns the ambient colour.
      Returns:
      The ambient colour.
    • getAmbientIntensity

      public float getAmbientIntensity()
      Returns the ambient intensity.
      Returns:
      The ambient intensity, 0-1.
    • getSunColor

      public Color getSunColor()
      Returns the directional colour.
      Returns:
      The directional colour.
    • getSunIntensity

      public float getSunIntensity()
      Returns the directional intensity.
      Returns:
      The directional intensity, 0-1.
    • toString

      public String toString()
      Creates a string representation of this light stop, useful for logging.
      Overrides:
      toString in class Object
      Returns:
      The string representation of this light stop.