On this page
fsMapViewSetWeatherRadarRainColors
This function can be used to set an array of colour structs which will then be used to draw the weather (when enabled). The colour struct at index 0 of the array will be used to colour rainfall from 0mm/h to the rate set for index 0, then the colour at index 1 will be used for rates between index 0 rate and index 1 rate, etc… up to a maximum rate of 100mm/h.
Syntax
bool fsMapViewSetWeatherRadarRainColors(
FsContext ctx,
FsTextureId id,
FsRainRateColor* colors,
unsigned nColors
)
Members
| Parameters | Description |
|---|---|
ctx | A value of type FsContext provided as an argument of the gauge callback. |
id | The MapView render ID as returned by the function fsMapViewCreate. |
colors | An array containing a minimum of 2 structs - comprised of an FsColor struct and a rate value (in mm/hour) - up to a maximum of 128 structs. |
nColors | The total size of the colour array. |
Return Values
Returns false if:
nColors< 2 or ifnColors> 128- no texture matches the given MapView ID
- the
ctxis invalid
Otherwise it will return true.
Remarks
The colors array is made up of at least 2 FsColor structs and would be created and used as shown in the following example:
const int size = 4;
FsRainRateColor colors[size] =
{
{ { 1.f, 0.7f, 0.25f, 0.1f }, 0.2f},
{ { 0.7f, 0.2f, 0.63f, 0.88f }, 10.f},
{ { 0.8f, 0.3f, 0.7f, 0.62f }, 50.f},
{ { 0.f, 0.9f, 1.f, 1.f } 100.f}
}
fsMapViewSetWeatherRadarRainColors(ctx, mapID, colors, size);