Convert

Conversions between FSW and SWU, symbol keys/ids, coordinates, and symid helpers.

Source

Functions

Sgnw\Core\Convert\drop_none

function drop_none($arr)

Remove key-value pairs from a dictionary where the value is null.

Parameters

ParameterType
arrarray

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

ParameterType
zoommixed

Returns

float

Examples

\Sgnw\Core\Convert\to_zoom('x'); // 1.0

Sgnw\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

ParameterType
swuMarkstring

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

ParameterType
fswMarkstring

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

ParameterType
swuNumstring

Returns

int

Examples

\Sgnw\Core\Convert\swu_to_num('ðĪ†'); // 500

Sgnw\Core\Convert\num_to_swu

function num_to_swu($num)

Convert a number to an SWU number character.

Parameters

ParameterType
numint

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

ParameterType
swuCoordstring

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

ParameterType
coordarray

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

ParameterType
fswCoordstring

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

ParameterType
coordarray

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

ParameterType
swuSymstring

Returns

int

Examples

\Sgnw\Core\Convert\swu_to_code('򀀁'); // 0x40001

Sgnw\Core\Convert\code_to_swu

function code_to_swu($code)

Convert a codepoint on plane 4 to an SWU symbol character.

Parameters

ParameterType
codeint

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

ParameterType
swuSymstring

Returns

int

Examples

\Sgnw\Core\Convert\swu_to_id('򀀁'); // 1

Sgnw\Core\Convert\id_to_swu

function id_to_swu($id)

Convert a 16-bit ID to an SWU symbol character.

Parameters

ParameterType
idint

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

ParameterType
keystring

Returns

int

Examples

\Sgnw\Core\Convert\key_to_id('S10000'); // 1

Sgnw\Core\Convert\id_to_key

function id_to_key($id)

Convert a 16-bit ID to an FSW symbol key.

Parameters

ParameterType
idint

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

ParameterType
swuSymstring

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

ParameterType
keystring

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

ParameterType
swuTextstring

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

ParameterType
fswTextstring

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

ParameterType
symid_minstring

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

ParameterType
symid_maxstring

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

ParameterType
symidstring

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

ParameterType
keystring

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'