Wind Direction Input (windDirInput) state variables represent user inputs for METAR-style wind direction strings (e.g., "010", "180V270" or "VRB"). It is a type of unitInput that can support directions in either true north ("T") or magnetic north ("M").
Like other unitInput state variables MVCS supports a physical or virtual keyboard, a popup keypad, or a thumbwheel input mechanism and selects the desired mechanism by referring to the set_inputType state variable. See Standard Settings Page.
The standard keyboard mechanism will ignore invalid characters and automatically add a 'V' before the fourth typed number. The popup keypad is specialized so that only valid wind direction characters can be entered. The thumbwheel input is similarly specialized to quickly select valid wind direction strings. Invalid entries are ignored and will revert to the previous valid setting.
Here's a typical example of a page-specific wind direction and units:
ctl.createPage({
...,
stateVarInfo:[
{id:'page_windDir', type:'windDirInput',
unitClass:'page_windDir',
magVar: 0,
units: {M:{dflt:'010'}, T:{dflt:'010'}},
},
{id:'page_windDirUnit', type:'unitSelector',
unitClass:'page_windDir',
{value:'M', text:'Mag.'},
{value:'T', text:'True'},
],
dflt: 'M',
},
],
});
A unitSelector with the same unitClass will control which unit is displayed if the parent windDirInput is displayed. Here's an example:
ctl.create page({
...,
render () {
return (tml`
...
<Cr> <Cl>Wind direction</> <Cv>{{page_windDir}} {{page_windDirUnit}}</> </Cr>
`);
}
});
This will display a wind direction input box and a selector for the units.
'windDirInput', class: WindDirInputSvctl.createPage({
...,
stateVarInfo:[
{id:'page_windDir', type:'windDirInput',
unitClass:'page_windDir',
magVar: 0,
units: {M:{dflt:'010'}, T:{dflt:'010'}},
},
],
})
info
An object containing the state variable properties. The info object can contain the following properties, but subclasses of StateVar may have additional properties:
info properties.info properties.info properties.magVarmagVar value is added to a magnetic north direction to convert to true north.unitClassunitClass string for the unitSelector that controls which unit sibling is current for this state variable.unitsinfo object.The object for each unit has the following keys:
dflt (optional)magVarA magnetic variance in degrees. The magVar value is added to a magnetic north direction to convert to true north.
A number in degrees.
inputTypeThe inputType attribute establishes a particular user input type that overrides the set_inputType state variable if it exists. The values can be:
'keyboard''keypad''thumbwheel'A String.
keyboard inputType, the component will render an <input type="text">.value attribute will be synchronized with the current unit sibling value.<span> element containing the windspeed text string.<span> contents will be synchronized with the state variable value.<input> element will have a className that contains windDir and svIo_windDirInput.inputType, the component will render a <span>.<span> contents will be synchronized with the state variable value.