Class SimpleShadingAlgorithm

  • All Implemented Interfaces:
    ShadingAlgorithm

    public class SimpleShadingAlgorithm
    extends AbsShadingAlgorithmDefaults
    Simple, but expressive slope visualisation (e.g. no pretentions of physical accuracy, separate north and west lightsources instead of one northwest, so a round dome would not look round, saturation works different depending on slope direction)

    variations can be created by overriding exaggerate(double)

    • Field Detail

      • linearity

        public final double linearity
      • scale

        public final double scale
    • Constructor Detail

      • SimpleShadingAlgorithm

        public SimpleShadingAlgorithm()
      • SimpleShadingAlgorithm

        public SimpleShadingAlgorithm​(double linearity,
                                      double scale)
        customization constructor for controlling some parameters of the shading formula
        Parameters:
        linearity - 1 or higher for linear grade, 0 or lower for a triple-applied sine of grade that gives high emphasis on changes in slope in near-flat areas, but reduces details within steep slopes (default 0.1)
        scale - scales the input slopes, with lower values slopes will saturate later, but nuances closer to flat will suffer (default: 0.666d)
    • Method Detail

      • exaggerate

        protected double exaggerate​(double in)
        should calculate values from -128 to +127 using whatever range required (within reason)
        Parameters:
        in - a grade, ascent per projected distance (along coordinate axis)
      • getAxisLenght

        public int getAxisLenght​(org.mapsforge.map.layer.hills.HgtCache.HgtFileInfo source)
      • convert

        protected byte[] convert​(java.nio.ByteBuffer din,
                                 int axisLength,
                                 int rowLen,
                                 int padding,
                                 org.mapsforge.map.layer.hills.HgtCache.HgtFileInfo fileInfo)
                          throws java.io.IOException
        Specified by:
        convert in class AbsShadingAlgorithmDefaults
        Throws:
        java.io.IOException
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object