Convert
Conversions between FSW and SWU, symbol keys/ids, coordinates, and symid helpers.
Functions
Sgnw\Core\Convert\drop_none
function drop_none($arr)
Remove key-value pairs from a dictionary where the value is null.
Parameters
| Parameter | Type |
|---|---|
arr | array |
Returns
array
Examples
\Sgnw\Core\Convert\drop_none(['a' => 1, 'b' => null, 'c' => 'x']);
// ['a' => 1, 'c' => 'x']Sgnw\Core\Convert\null
function null($zoom)
Sgnw\Core\Convert\to_zoom
function to_zoom($zoom)
Convert zoom to float, handling 'x' and null.
Parameters
| Parameter | Type |
|---|---|
zoom | mixed |
Returns
float
Examples
\Sgnw\Core\Convert\to_zoom('x'); // 1.0Sgnw\Core\Convert\symid_arr
function symid_arr()
Sgnw\Core\Convert\_swu_to_mark_map
function _swu_to_mark_map()
Sgnw\Core\Convert\_mark_to_swu_map
function _mark_to_swu_map()
Sgnw\Core\Convert\swu_to_mark
function swu_to_mark($swuMark)
Convert an SWU structural marker to FSW equivalent.
Parameters
| Parameter | Type |
|---|---|
swuMark | string |
Returns
string
Examples
\Sgnw\Core\Convert\swu_to_mark('ð '); // 'A'Sgnw\Core\Convert\mark_to_swu
function mark_to_swu($fswMark)
Convert an FSW structural marker to SWU equivalent.
Parameters
| Parameter | Type |
|---|---|
fswMark | string |
Returns
string
Examples
\Sgnw\Core\Convert\mark_to_swu('A'); // 'ð 'Sgnw\Core\Convert\swu_to_num
function swu_to_num($swuNum)
Convert an SWU number character to an integer.
Parameters
| Parameter | Type |
|---|---|
swuNum | string |
Returns
int
Examples
\Sgnw\Core\Convert\swu_to_num('ðĪ'); // 500Sgnw\Core\Convert\num_to_swu
function num_to_swu($num)
Convert a number to an SWU number character.
Parameters
| Parameter | Type |
|---|---|
num | int |
Returns
string
Examples
\Sgnw\Core\Convert\num_to_swu(500); // 'ðĪ'Sgnw\Core\Convert\swu_to_coord
function swu_to_coord($swuCoord)
Convert two SWU number characters to an [x, y] integer list.
Parameters
| Parameter | Type |
|---|---|
swuCoord | string |
Returns
array
Examples
\Sgnw\Core\Convert\swu_to_coord('ðĪðĪ'); // [500, 500]Sgnw\Core\Convert\coord_to_swu
function coord_to_swu($coord)
Convert an [x, y] integer list to two SWU number characters.
Parameters
| Parameter | Type |
|---|---|
coord | array |
Returns
string
Examples
\Sgnw\Core\Convert\coord_to_swu([500, 500]); // 'ðĪðĪ'Sgnw\Core\Convert\fsw_to_coord
function fsw_to_coord($fswCoord)
Convert an FSW coordinate string to [x, y] integer list.
Parameters
| Parameter | Type |
|---|---|
fswCoord | string |
Returns
array
Examples
\Sgnw\Core\Convert\fsw_to_coord('500x500'); // [500, 500]Sgnw\Core\Convert\coord_to_fsw
function coord_to_fsw($coord)
Convert an [x, y] list to an FSW coordinate string.
Parameters
| Parameter | Type |
|---|---|
coord | array |
Returns
string
Examples
\Sgnw\Core\Convert\coord_to_fsw([500, 500]); // '500x500'Sgnw\Core\Convert\swu_to_code
function swu_to_code($swuSym)
Convert an SWU symbol character to its Unicode code point.
Parameters
| Parameter | Type |
|---|---|
swuSym | string |
Returns
int
Examples
\Sgnw\Core\Convert\swu_to_code('ņ'); // 0x40001Sgnw\Core\Convert\code_to_swu
function code_to_swu($code)
Convert a codepoint on plane 4 to an SWU symbol character.
Parameters
| Parameter | Type |
|---|---|
code | int |
Returns
string
Examples
\Sgnw\Core\Convert\code_to_swu(0x40001); // 'ņ'Sgnw\Core\Convert\swu_to_id
function swu_to_id($swuSym)
Convert an SWU symbol character to a 16-bit ID.
Parameters
| Parameter | Type |
|---|---|
swuSym | string |
Returns
int
Examples
\Sgnw\Core\Convert\swu_to_id('ņ'); // 1Sgnw\Core\Convert\id_to_swu
function id_to_swu($id)
Convert a 16-bit ID to an SWU symbol character.
Parameters
| Parameter | Type |
|---|---|
id | int |
Returns
string
Examples
\Sgnw\Core\Convert\id_to_swu(1); // 'ņ'Sgnw\Core\Convert\key_to_id
function key_to_id($key)
Convert an FSW symbol key to a 16-bit ID.
Parameters
| Parameter | Type |
|---|---|
key | string |
Returns
int
Examples
\Sgnw\Core\Convert\key_to_id('S10000'); // 1Sgnw\Core\Convert\id_to_key
function id_to_key($id)
Convert a 16-bit ID to an FSW symbol key.
Parameters
| Parameter | Type |
|---|---|
id | int |
Returns
string
Examples
\Sgnw\Core\Convert\id_to_key(1); // 'S10000'Sgnw\Core\Convert\swu_to_key
function swu_to_key($swuSym)
Convert an SWU symbol character to an FSW symbol key.
Parameters
| Parameter | Type |
|---|---|
swuSym | string |
Returns
string
Examples
\Sgnw\Core\Convert\swu_to_key('ņ'); // 'S10000'Sgnw\Core\Convert\key_to_swu
function key_to_swu($key)
Convert an FSW symbol key to an SWU symbol character.
Parameters
| Parameter | Type |
|---|---|
key | string |
Returns
string
Examples
\Sgnw\Core\Convert\key_to_swu('S10000'); // 'ņ'Sgnw\Core\Convert\swu_to_fsw
function swu_to_fsw($swuText)
Convert SWU text to FSW text.
Parameters
| Parameter | Type |
|---|---|
swuText | string |
Returns
string
Examples
\Sgnw\Core\Convert\swu_to_fsw('ð ņņņĨņĐð ðĪðĪĐņĐðĢĩðĪņðĪðĢĪņĨðĪðĪņðĢŪðĢ');
// 'AS10011S10019S2e704S2e748M525x535S2e748483x510S10011501x466S2e704510x500S10019476x475'Sgnw\Core\Convert\fsw_to_swu
function fsw_to_swu($fswText)
Convert FSW text to SWU text.
Parameters
| Parameter | Type |
|---|---|
fswText | string |
Returns
string
Examples
\Sgnw\Core\Convert\fsw_to_swu('AS10011S10019S2e704S2e748M525x535S2e748483x510S10011501x466S2e704510x500S10019476x475');
// 'ð ņņņĨņĐð ðĪðĪĐņĐðĢĩðĪņðĪðĢĪņĨðĪðĪņðĢŪðĢ'Sgnw\Core\Convert\symid_max
function symid_max($symid_min)
Convert base or full symbol ID Min to symbol ID Max.
Parameters
| Parameter | Type |
|---|---|
symid_min | string |
Returns
string
Examples
\Sgnw\Core\Convert\symid_max('101011616'); // '01-01-001-01-06-16'\Sgnw\Core\Convert\symid_max('101011616'); // '01-01-001-01-06-16'Sgnw\Core\Convert\symid_min
function symid_min($symid_max)
Convert base or full symbol ID Max to symbol ID Min.
Parameters
| Parameter | Type |
|---|---|
symid_max | string |
Returns
string
Examples
\Sgnw\Core\Convert\symid_min('01-01-001-01-06-16'); // '101011616'\Sgnw\Core\Convert\symid_min('01-01-001-01-06-16'); // '101011616'Sgnw\Core\Convert\symid_to_key
function symid_to_key($symid)
Convert base or full symbol ID Max to FSW symbol key.
Parameters
| Parameter | Type |
|---|---|
symid | string |
Returns
string
Examples
\Sgnw\Core\Convert\symid_to_key('01-01-001-01-06-16'); // 'S1005f'\Sgnw\Core\Convert\symid_to_key('01-01-001-01-06-16'); // 'S1005f'Sgnw\Core\Convert\key_to_symid
function key_to_symid($key)
Convert base or full FSW symbol key to maximized symbol ID.
Parameters
| Parameter | Type |
|---|---|
key | string |
Returns
string
Examples
\Sgnw\Core\Convert\key_to_symid('S1005f'); // '01-01-001-01-06-16'\Sgnw\Core\Convert\key_to_symid('S1005f'); // '01-01-001-01-06-16'