Package org.mapsforge.map.layer.hills
Class SimpleShadingAlgorithm
- java.lang.Object
-
- org.mapsforge.map.layer.hills.AbsShadingAlgorithmDefaults
-
- org.mapsforge.map.layer.hills.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)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.mapsforge.map.layer.hills.ShadingAlgorithm
ShadingAlgorithm.RawHillTileSource, ShadingAlgorithm.RawShadingResult
-
-
Constructor Summary
Constructors Constructor Description SimpleShadingAlgorithm()SimpleShadingAlgorithm(double linearity, double scale)customization constructor for controlling some parameters of the shading formula
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected byte[]convert(java.nio.ByteBuffer din, int axisLength, int rowLen, int padding, org.mapsforge.map.layer.hills.HgtCache.HgtFileInfo fileInfo)booleanequals(java.lang.Object o)protected doubleexaggerate(double in)should calculate values from -128 to +127 using whatever range required (within reason)intgetAxisLenght(org.mapsforge.map.layer.hills.HgtCache.HgtFileInfo source)inthashCode()java.lang.StringtoString()-
Methods inherited from class org.mapsforge.map.layer.hills.AbsShadingAlgorithmDefaults
transformToByteBuffer
-
-
-
-
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:
convertin classAbsShadingAlgorithmDefaults- Throws:
java.io.IOException
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-