Parameter Statement |
Syntax | PARAMETER %<param_name> [ = <default>] |
Example | PARAMETER %color_set = 1 |
The parameter statement declares a constant and exposes it to user code. This allows the value of the parameter to be set before the map is drawn. The parameter can then be used to change the appearance of the map by testing the value in if statements.
A parameter defined in Chameleon can be accessed from user code via the GetParameterValue(String) and SetParameter methods. A list of parameters is available via ParameterNames.
MapStyle style = MapStyle.Create("style.cam"); if (style.GetParameterValue("param") == 1.5) style.SetParameter("param", 1); ... /* Resets "param" to the value it was defined as in the Chameleon script file */ style.ClearParameter("param");