/*! StateMachineGenerator */ /* * This is currently in JS but can be transfered to JSON at any time * just call StateMachineGenerator.asJSON(true) in the console to dump the current * state maschine into the console. Use StateMachineGenerator.asJSON(true, 4) * to get a formated (uncompressed) version. */ /* ########## Generator START ############ */ if("StateMachineGenerator" in window === false) window['StateMachineGenerator'] = (function () { /* List helper */ function nextListItem (current, list) { var index = list.indexOf(current); if (index==-1) { log('"'+current+'" is not in the list!'); return; } index += 1; index = index % list.length; return list[index]; } function prevListItem (current, list) { var index = list.indexOf(current); if (index==-1) { log('"'+current+'" is not in the list!'); return; } if (index == 0) index = list.length; index -= 1; return list[index]; } function P_Factory (nr, obj){ if (!obj) obj={ PatSym1:{}, PatSym2:{}, PatSym3:{}, PatSym4:{} }; return { 'PatSym1': Object.assign( { show: 'PatSym1'+(nr=='1P' ? 'H':'L') }, obj.PatSym1 ), 'PatSym2': Object.assign( { show: 'PatSym2'+(nr=='2P' ? 'H':'L') }, obj.PatSym2 ), 'PatSym3': Object.assign( { show: 'PatSym3'+(nr=='3P' ? 'H':'L') }, obj.PatSym3 ), 'PatSym4': Object.assign( { show: 'PatSym4'+(nr=='4P' ? 'H':'L') }, obj.PatSym4 ), } } function Quick_Factory (mode, obj){ return Object.assign( { text: 'QUICK
' + mode }, obj); } /* _____ _ _ | __ \ /\ | \ | | | |__) | / \ | \| | | ___/ / /\ \ | . ` | | | / ____ \ | |\ | |_| /_/ \_\ |_| \_| */ /* Lists */ var PAN_ArrowList = [ 'P1_3p_off_4q', 'P2_3p_off_4q', 'P10_3p_off_4q', 'P12_3p_4q', 'BW1_3p_4q', 'BW1_3p', 'TM1.1_3p_Grad0', 'TM3_3p', 'S1_3p', 'S3_3p' ]; var PAN_ButtonList = [ 'P1_3p_off_4q','P1A_3p_off_4q', 'P1C_3p_off_4q' ]; // Replace generator with final JSON var stateMachine = { /* initial state if not overriden */ '_START': { _sceneName: 'LOADER', }, /* Base state always inherithed */ '_MENU': { 'MAIN_PAN': { goto: 'P1_3p_off_4q' }, 'MAIN_CEPH': { goto: 'C1_3p_off_Voll' }, 'MAIN_3D': { goto: '3D_8_ohne_3p_q_all_hd' }, }, /* helper */ '_1P': P_Factory('1P'), '_2P': P_Factory('2P'), '_3P': P_Factory('3P'), '_4P': P_Factory('4P'), '_DISABLE_ARROWS': { 'ArrowMinus': {}, 'ArrowPlus': {}, }, /* Shared scene base */ '_PAN': { _sceneName: 'PAN', 'Angle0Degree': { hidden: true }, 'Head': { show: 'HeadHorYellow' }, 'Light': { show: 'Light_' }, 'Text_Info': { text: '69kV
12mA' }, 'Head_1': { action: 'showExposureVideo', video: 'Video_Stirnstuetze_PAN', gotoAfterVideo: -1 }, 'Head_2': { action: 'showExposureVideo', video: 'Video_Stirnstuetze_PAN', gotoAfterVideo: -1 }, 'Head_3': { action: 'showExposureVideo', video: 'Video_Stirnstuetze_PAN', gotoAfterVideo: -1 }, 'Head_4': { action: 'showExposureVideo', video: 'Video_Stirnstuetze_PAN', gotoAfterVideo: -1 }, 'Frame_ArrowDown': { action: 'showExposureVideo', video: 'Video_Hoehneverstellung_PAN', gotoAfterVideo: -1 }, 'Frame_ArrowUp': { action: 'showExposureVideo', video: 'Video_Hoehneverstellung_PAN', gotoAfterVideo: -1 }, }, '_PAN_DIALOG_4Q': { _sceneName: 'PAN-DIALOG', 'Angle0Degree': { hidden: true }, 'DIALOG_KV_MA': { hidden: true }, 'DIALOG_QUICK': { hidden: true }, 'Head': { show: 'HeadHorYellow' }, 'Light': { show: 'Light_' }, }, '_PAN_DIALOG_KV_MA': { _sceneName: 'PAN-DIALOG', 'Angle0Degree': { hidden: true }, 'DIALOG_4Q': { hidden: true }, 'DIALOG_QUICK': { hidden: true }, 'Head': { show: 'HeadHorYellow' }, 'Light': { show: 'Light_' }, }, '_PAN_QUICK': { _sceneName: 'PAN-DIALOG', 'Angle0Degree': { hidden: true }, 'DIALOG_4Q': { hidden: true }, 'DIALOG_KV_MA': { hidden: true }, 'Head': { show: 'HeadHorYellow' }, 'Light': { show: 'Light_' }, }, /* States */ 'BW1_3p_4q' : { _stateInherit: ['_PAN', '_3P', '_MENU'], 'Button_Normal': { hidden: true }, 'Text_Quick': { hidden: true }, 'Text_Mode': { text: 'BW1' }, 'Text_Duration': { text: '8.8 s' }, 'Pan_Icon': { show: 'Pan_Icon_BW1_Jaw' }, 'QuadrantSmall': { show: 'QuadrantSmall_5' }, 'ArrowMinus': { goto: prevListItem('BW1_3p_4q', PAN_ArrowList) }, 'ArrowPlus': { goto: nextListItem('BW1_3p_4q', PAN_ArrowList) }, }, 'BW1_3p' : { _stateInherit: ['_PAN', '_3P', '_MENU'], 'Button_Normal': { hidden: true }, 'Text_Quick': { hidden: true }, 'QuadrantSmall': { hidden: true }, 'Pan_Icon': { show: 'Pan_Icon_BW2_Jaw' }, 'Text_Mode': { text: 'BW2' }, 'Text_Duration': { text: '5.1 s' }, 'ArrowMinus': { goto: prevListItem('BW1_3p', PAN_ArrowList) }, 'ArrowPlus': { goto: nextListItem('BW1_3p', PAN_ArrowList) }, }, /* Share bases */ '_P1_BASE': { 'Text_Mode': { text: 'P1', goto: nextListItem('P1_3p_off_4q', PAN_ButtonList) }, 'ArrowMinus': { goto: prevListItem('P1_3p_off_4q', PAN_ArrowList) }, 'ArrowPlus': { goto: nextListItem('P1_3p_off_4q', PAN_ArrowList) }, }, '_P1X_BASE': { 'Pan_Icon': { show: 'Pan_Icon_P1_Jaw' }, 'QuadrantSmall': { show: 'QuadrantSmall_5' }, 'Text_Info': { text: '69kV
12mA' }, 'Text_Quick': Quick_Factory( 'OFF' ), }, /* Alias */ //'P1_1p_off_4q': 'P1_1p_off_4Q', /* States */ 'P1A_3p_off_4q': { _stateInherit: ['_PAN', '_P1_BASE', '_3P', '_P1X_BASE', '_MENU'], 'Text_Mode': { text: 'P1A', goto: nextListItem('P1A_3p_off_4q', PAN_ButtonList) }, 'Text_Duration': { text: '14.1 s' }, }, 'P1C_3p_off_4q': { _stateInherit: ['_PAN', '_P1_BASE', '_3P', '_P1X_BASE', '_MENU'], 'Text_Mode': { text: 'P1C', goto: nextListItem('P1C_3p_off_4q', PAN_ButtonList) }, 'Text_Duration': { text: '14.1 s' }, }, 'P2_3p_off_4q': { _stateInherit: ['_PAN', '_3P', '_P1X_BASE', '_MENU'], 'Pan_Icon': { show: 'Pan_Icon_P2_Jaw' }, 'Text_Mode': { text: 'P2' }, 'Text_Duration': { text: '11.5 s' }, 'ArrowMinus': { goto: prevListItem('P2_3p_off_4q', PAN_ArrowList) }, 'ArrowPlus': { goto: nextListItem('P2_3p_off_4q', PAN_ArrowList) }, }, 'P10_3p_off_4q': { _stateInherit: ['_PAN', '_3P', '_P1X_BASE', '_MENU'], 'Pan_Icon': { show: 'Pan_Icon_P10_Jaw' }, 'Text_Mode': { text: 'P10' }, 'Text_Duration': { text: '11.5 s' }, 'ArrowMinus': { goto: prevListItem('P10_3p_off_4q', PAN_ArrowList) }, 'ArrowPlus': { goto: nextListItem('P10_3p_off_4q', PAN_ArrowList) }, }, /* Share bases */ '_SX_BASE': { 'Button_Normal': { hidden: true }, 'Text_Quick': { hidden: true }, 'QuadrantSmall': { hidden: true }, 'Text_Info': { text: '78kV
14mA' }, }, /* States */ 'P12_3p_4q': { /* this PX is more like a SX */ _stateInherit: ['_PAN', '_3P', '_SX_BASE', '_MENU'], 'QuadrantSmall': { show: 'QuadrantSmall_5' }, 'Pan_Icon': { show: 'Pan_Icon_P12_Jaw' }, 'Text_Mode': { text: 'P12' }, 'Text_Duration': { text: '4.9 s' }, 'ArrowMinus': { goto: prevListItem('P12_3p_4q', PAN_ArrowList) }, 'ArrowPlus': { goto: nextListItem('P12_3p_4q', PAN_ArrowList) }, }, 'S1_3p': { _stateInherit: ['_PAN', '_3P', '_SX_BASE', '_MENU'], 'Head': { show: 'HeadBwdBlueEar_H'}, 'Pan_Icon': { show: 'Pan_Icon_S1_Jaw' }, 'Text_Mode': { text: 'S1' }, 'Text_Duration': { text: '14.4 s' }, 'ArrowMinus': { goto: prevListItem('S1_3p', PAN_ArrowList) }, 'ArrowPlus': { goto: nextListItem('S1_3p', PAN_ArrowList) }, }, 'S3_3p': { _stateInherit: ['_PAN', '_3P', '_SX_BASE', '_MENU'], 'Head': { show: 'HeadBwdBlueEar_H'}, 'Pan_Icon': { show: 'Pan_Icon_S3_Jaw' }, 'Text_Mode': { text: 'S3' }, 'Text_Duration': { text: '8.1 s' }, 'ArrowMinus': { goto: prevListItem('S3_3p', PAN_ArrowList) }, 'ArrowPlus': { goto: nextListItem('S3_3p', PAN_ArrowList) }, }, 'TM1.1_3p_Grad0': { _stateInherit: ['_PAN', '_3P', '_SX_BASE', '_MENU'], 'Head': { show: 'HeadHorEar_H'}, 'Pan_Icon': { show: 'Pan_Icon_TM11_Jaw' }, 'Angle0Degree': { show: 'Angle0DegreeState'}, 'Text_Mode': { text: 'TM1.1' }, 'Text_Duration': { text: '12.8 s' }, 'Text_Info': { text: '72kV
14mA' }, 'ArrowMinus': { goto: prevListItem('TM1.1_3p_Grad0', PAN_ArrowList) }, 'ArrowPlus': { goto: nextListItem('TM1.1_3p_Grad0', PAN_ArrowList) }, }, 'TM3_3p': { _stateInherit: ['_PAN', '_3P', '_SX_BASE', '_MENU'], 'Head': { show: 'HeadHorEar_H'}, 'Pan_Icon': { show: 'Pan_Icon_TM3_Jaw' }, 'Text_Mode': { text: 'TM3' }, 'Text_Duration': { text: '8.1 s' }, 'Text_Info': { text: '62kV
12mA' }, 'ArrowMinus': { goto: prevListItem('TM3_3p', PAN_ArrowList) }, 'ArrowPlus': { goto: nextListItem('TM3_3p', PAN_ArrowList) }, }, } // P1 State Factory function P1(o){ // extract var p = o.p, quick = o.quick, q = o.q, qS = o.qS, panIcon = o.panIcon, time = o.times[ (o.quick=='OFF'? 0:1)]; textInfo = o.textInfo; // modified data (lowercase etc.) var pL = p.toLowerCase(); var qL = q.toLowerCase(); var qD = (q=='4Q')? '4q' : q; var quickL = quick.toLowerCase(); var quickInvL = quickL=='on' ? 'off' : 'on'; // state names var stateP1_default = 'P1_'+pL+'_'+quickL+'_'+qD; var stateP1_dialogKVMA = 'P1_'+pL+'_'+quickL+'_'+qD+'_DialogKV-MA'; var stateP1_dialogQuick = 'P1_'+pL+'_'+quickL+'_4q_Dialog'+((quick=='ON')? 'On':'Off'); var stateP1_inverseQuick = 'P1_'+pL+'_'+quickL+'_4q_Dialog'+((quick=='ON')? 'On':'Off'); var stateP1_dialog4Q = 'P1_'+pL+'_'+quickL+'_4q_Dialog'+q; // clean names var _stateP1_clickzones = '_P1_'+p+'_'+quick+'_CLICK'; var _stateP1_base = '_P1_'+pL+'_'+quickL+'_'+q+'_ICONS'; // return object return Object.assign({ [_stateP1_base] : Object.assign(P_Factory(p, { PatSym1: { goto: 'P1_1p_'+quickL+'_'+qD }, PatSym2: { goto: 'P1_2p_'+quickL+'_'+qD }, PatSym3: { goto: 'P1_3p_'+quickL+'_'+qD }, PatSym4: { goto: 'P1_4p_'+quickL+'_'+qD }, }), { } ), /* state without 4Q Dialog */ [stateP1_default] : { _stateInherit: ['_PAN', '_P1_BASE', _stateP1_base, '_MENU'], 'Text_Quick': Quick_Factory( quick, { goto: stateP1_inverseQuick }), 'QuadrantSmall': { show: 'QuadrantSmall_'+qS, goto: stateP1_dialog4Q }, 'Pan_Icon': { show: panIcon }, 'Text_Duration': { text: time }, 'Text_Info': { text: textInfo, goto: stateP1_dialogKVMA }, }, /* state of 4Q with dialog */ [stateP1_dialog4Q] : { _stateInherit: ['_PAN_DIALOG_4Q', '_'+p, stateP1_default, _stateP1_clickzones], 'Text_Quick': Quick_Factory( quick ), 'QuadrantLarge': { show: 'QuadrantLarge_'+qS }, 'Close': { goto: stateP1_default}, }, /* state of KV-MA dialog */ [stateP1_dialogKVMA] : { _stateInherit: ['_PAN_DIALOG_KV_MA', '_P1_BASE', stateP1_default, '_'+pL, '_DISABLE_ARROWS'], 'QuadrantSmall': { show: 'QuadrantSmall_'+qS }, 'Text_Quick': Quick_Factory( quick ), 'Text_Info': { text: textInfo }, 'Text_Info_Y': { text: textInfo }, 'Close': { goto: stateP1_default}, }, }, //if q=='4Q' --> override to display Quick dialog (q=='4Q'? { // state without 4Q Dialog with Quick dialog link (override) [stateP1_default] : { _stateInherit: ['_PAN', '_P1_BASE', _stateP1_base, '_MENU'], 'Text_Quick': Quick_Factory( quick, { goto: stateP1_dialogQuick }), 'QuadrantSmall': { show: 'QuadrantSmall_'+qS, goto: stateP1_dialog4Q }, 'Pan_Icon': { show: panIcon }, 'Text_Duration': { text: time }, 'Text_Info': { text: textInfo, goto: stateP1_dialogKVMA }, }, // state of Quick dialog [stateP1_dialogQuick]: { _stateInherit: ['_PAN_QUICK', '_P1_BASE', stateP1_default, '_'+pL], 'QuadrantSmall': { show: 'QuadrantSmall_'+qS }, 'Text_Quick': Quick_Factory( quick ), 'Text_Info': { text: textInfo }, 'Text_Quick_On': { goto: 'P1_'+pL+'_on_4q_DialogOn', show: ((quick=='ON')? 'quickHover':'quickDefault') }, 'Text_Quick_Off': { goto: 'P1_'+pL+'_off_4q_DialogOff', show: ((quick=='ON')? 'quickDefault':'quickHover') }, 'Close': { goto: stateP1_default}, } } : {}) ); } // 4Q Dialog click zones 1-9 generator based on q and quick function QuadrantLargeFactory (p, quick){ var pL = p.toLowerCase(); var quickL = quick.toLowerCase(); return { QL_1: { goto: 'P1_'+pL+'_'+quickL+'_4q_DialogQ1'}, QL_2: { goto: 'P1_'+pL+'_'+quickL+'_4q_DialogQ2'}, QL_3: { goto: 'P1_'+pL+'_'+quickL+'_4q_DialogQ3'}, QL_4: { goto: 'P1_'+pL+'_'+quickL+'_4q_DialogQ4'}, QL_5: { goto: 'P1_'+pL+'_'+quickL+'_4q_Dialog4Q'}, QL_6: { goto: 'P1_'+pL+'_'+quickL+'_4q_DialogOK'}, QL_7: { goto: 'P1_'+pL+'_'+quickL+'_4q_DialogLinks'}, QL_8: { goto: 'P1_'+pL+'_'+quickL+'_4q_DialogRechts'}, QL_9: { goto: 'P1_'+pL+'_'+quickL+'_4q_DialogUK'}, } } // P1 States Quick ON and OFF Factory Wrapper function P1_Q(o) { o.pL = o.p.toLowerCase(); return Object.assign( P1(Object.assign(o, {quick:'OFF'})), P1(Object.assign(o, {quick:'ON'})), // 4Q Dialog click zones 1-9 generator based on q and quick { ['_P1_'+o.p+'_OFF_CLICK']: QuadrantLargeFactory (o.p, 'OFF'), ['_P1_'+o.p+'_ON_CLICK']: QuadrantLargeFactory (o.p, 'ON'), } ); } // P1 States 1P, 2P, 3P and 4P Factory Wrapper Loop var P1_P= [ {p:'1P', textInfo: '63kV
6mA'}, {p:'2P', textInfo: '63kV
8mA'}, {p:'3P', textInfo: '69kV
12mA'}, {p:'4P', textInfo: '72kV
14mA'}, ]; P1_P.forEach(function(o){ Object.assign( stateMachine, P1_Q(Object.assign(o, { q:'4Q', qS:'5', panIcon:'Pan_Icon_P1_Jaw', times:['14.1 s','9.0 s'] }) ), P1_Q(Object.assign(o, { q:'Q1', qS:'1', panIcon:'Pan_Icon_P1_RJaw', times:['8.0 s', '5.1 s'] }) ), P1_Q(Object.assign(o, { q:'Q2', qS:'2', panIcon:'Pan_Icon_P1_LJaw', times:['8.0 s', '5.1 s'] }) ), P1_Q(Object.assign(o, { q:'Q3', qS:'3', panIcon:'Pan_Icon_P1_LJaw', times:['8.0 s', '5.1 s'] }) ), P1_Q(Object.assign(o, { q:'Q4', qS:'4', panIcon:'Pan_Icon_P1_RJaw', times:['8.0 s', '5.1 s'] }) ), P1_Q(Object.assign(o, { q:'Links', qS:'6', panIcon:'Pan_Icon_P1_RJaw', times:['8.0 s', '5.1 s'] }) ), P1_Q(Object.assign(o, { q:'Rechts', qS:'7', panIcon:'Pan_Icon_P1_LJaw', times:['8.0 s', '5.1 s'] }) ), P1_Q(Object.assign(o, { q:'OK', qS:'8', panIcon:'Pan_Icon_P1_Jaw', times:['14.1 s','9.0 s'] }) ), P1_Q(Object.assign(o, { q:'UK', qS:'9', panIcon:'Pan_Icon_P1_Jaw', times:['14.1 s','9.0 s'] }) ), ); }); /* _____ ______ _____ _ _ / ____| | ____| | __ \ | | | | | | | |__ | |__) | | |__| | | | | __| | ___/ | __ | | |____ | |____ | | | | | | \_____| |______| |_| |_| |_| */ Object.assign(stateMachine,{ /* Base */ '_CEPH': { _sceneName: 'CEPH', 'Light': { show: 'Light_' }, }, '_CEPH_DIALOG_QUICK': { _sceneName: 'CEPH-DIALOG', 'DIALOG_KV': { hidden: true }, 'DIALOG_KV_MA': { hidden: true }, 'Light': { show: 'Light_' }, }, '_CEPH_DIALOG_KV': { _sceneName: 'CEPH-DIALOG', 'DIALOG_QUICK': { hidden: true }, 'DIALOG_KV_MA': { hidden: true }, 'Light': { show: 'Light_' }, }, '_CEPH_DIALOG_KV_MA': { _sceneName: 'CEPH-DIALOG', 'DIALOG_QUICK': { hidden: true }, 'DIALOG_KV': { hidden: true }, 'Light': { show: 'Light_' }, }, }); var CEPH_ArrowList = [ 'C1','C2','C3','C4' ]; var CEPH_M = [ { c: 'C1', cephIconKoll: 'Ceph_Icon_Back_shaded', filterSymKoll: 'FilterSymC1on_H', cephIconVoll: 'Ceph_Icon_Back', filterSymVoll: 'FilterSymC1off_H', prevC: prevListItem('C1', CEPH_ArrowList), nextC: nextListItem('C1', CEPH_ArrowList), times: ['6.1', '9.1'], textInfo: { '1P': '80kV
14mA', '2P': '80kV
14mA', '3P': '84kV
13mA', '4P': '90kV
12mA' }, }, { c: 'C2', cephIconKoll: 'Ceph_Icon_Face_Shaded', filterSymKoll: 'FilterSymC2on_H', cephIconVoll: 'Ceph_Icon_Face', filterSymVoll: 'FilterSymC2off_H', prevC: prevListItem('C2', CEPH_ArrowList), nextC: nextListItem('C2', CEPH_ArrowList), times: ['6.1', '9.1'], textInfo: { '1P': '80kV
14mA', '2P': '80kV
14mA', '3P': '84kV
13mA', '4P': '90kV
12mA' }, }, { c: 'C3', cephIconKoll: 'Ceph_Icon_Profile_Shaded', filterSymKoll: 'FilterSymC3on_H', cephIconVoll: 'Ceph_Icon_Profile', filterSymVoll: 'FilterSymC3off_H', prevC: prevListItem('C3', CEPH_ArrowList), nextC: nextListItem('C3', CEPH_ArrowList), times: ['4.7', '9.4'], textInfo: { '1P': '73kV
15mA', '2P': '73kV
15mA', '3P': '77kV
14mA', '4P': '84kV
13mA' }, }, { c: 'C3F', cephIconKoll: 'Ceph_Icon_ProfileFull_Shaded', filterSymKoll: 'FilterSymC3on_H', cephIconVoll: 'Ceph_Icon_ProfileFull', filterSymVoll: 'FilterSymC3off_H', prevC: prevListItem('C3', CEPH_ArrowList), nextC: nextListItem('C3', CEPH_ArrowList), times: ['7.5', '14.9'], textInfo: { '1P': '73kV
15mA', '2P': '73kV
15mA', '3P': '77kV
14mA', '4P': '84kV
13mA' }, }, { c: 'C4', cephIconKoll: 'Ceph_Icon_Hand', filterSymKoll: '', cephIconVoll: 'Ceph_Icon_Hand', filterSymVoll: '', prevC: prevListItem('C4', CEPH_ArrowList), nextC: nextListItem('C4', CEPH_ArrowList), times: ['4.6', '9.1'], textInfo: { '1P': '64kV
16mA', '2P': '64kV
16mA', '3P': '64kV
16mA', '4P': '64kV
16mA' }, }, ]; ['1P', '2P', '3P', '4P'].forEach(function(p){ CEPH_M.forEach(function(o){ Object.assign( stateMachine, CEPH (Object.assign(o, { p: p, quick:'Off', mode:'Koll' }) ), CEPH (Object.assign(o, { p: p, quick:'On', mode:'Koll' }) ), CEPH (Object.assign(o, { p: p, quick:'Off', mode:'Voll' }) ), CEPH (Object.assign(o, { p: p, quick:'On', mode:'Voll' }) ), ); }); }); function CEPH(o){ // extract var p = o.p, quick = o.quick, c = o.c, cephIcon = o.cephIcon, filterSym = o.filterSym, textInfo = o.textInfo[o.p], mode = o.mode, time = o.times[ (o.quick=='Off'? 1:0)]; // modified data (lowercase etc.) var pL = p.toLowerCase(); var quickL = quick.toLowerCase(); var quickU = quick.toUpperCase(); var quickInv = quick=='On' ? 'Off' : 'On'; var quickInvL = quickInv.toLowerCase(); // next prev states var stateCEPH_prev = o.prevC+'_'+pL+'_'+quickL+'_'+mode; var stateCEPH_next = o.nextC+'_'+pL+'_'+quickL+'_'+mode; // modified data (lowercase etc.) var stateCEPH_default = c+'_'+pL+'_'+quickL+'_'+mode; var stateCEPH_dialogMAkV = stateCEPH_default +'_Dialog-mAkV'; var stateCEPH_dialogKV = stateCEPH_default +'_Dialog'+mode; var stateCEPH_dialogQuick = stateCEPH_default +'_DialogQuick'+quick; // clean var _stateCEPH_base = stateCEPH_default +'_BASE'; // links var stateCEPH_dialogQuickOn = c+'_'+pL+'_on_'+mode +'_DialogQuickOn'; var stateCEPH_dialogQuickOff= c+'_'+pL+'_off_'+mode +'_DialogQuickOff'; var stateCEPH_dialogVoll = c+'_'+pL+'_'+quickL+'_Koll_DialogKoll'; var stateCEPH_dialogKoll = c+'_'+pL+'_'+quickL+'_Voll_DialogVoll'; // //return return Object.assign({ [_stateCEPH_base] : Object.assign(P_Factory(p, { PatSym1: { goto: c+'_1p_'+quickL+'_'+mode }, PatSym2: { goto: c+'_2p_'+quickL+'_'+mode }, PatSym3: { goto: c+'_3p_'+quickL+'_'+mode }, PatSym4: { goto: c+'_4p_'+quickL+'_'+mode }, }), { 'Ceph_Icon': { show: o['cephIcon'+mode] }, 'FilterSym': c!='C4'? { show: o['filterSym'+mode], goto: stateCEPH_dialogKV } : { hidden: true }, 'Text_Quick': Quick_Factory( quickU ), 'Text_Mode': { text: c }, 'Text_Duration': { text: time }, 'Text_Info': { text: textInfo }, 'Button_Normal': c=='C3'||c=='C3F'? { } : { hidden: true }, } ), [stateCEPH_default] : { _stateInherit: ['_CEPH', _stateCEPH_base, '_MENU'], 'Text_Quick': Quick_Factory( quickU, { goto: stateCEPH_dialogQuick } ), 'Text_Info': { text: textInfo, goto: stateCEPH_dialogMAkV }, 'ArrowMinus': { goto: stateCEPH_prev }, 'ArrowPlus': { goto: stateCEPH_next }, }, [stateCEPH_dialogQuick] : { _stateInherit: ['_CEPH_DIALOG_QUICK', _stateCEPH_base, '_'+p, '_DISABLE_ARROWS'], 'Text_Quick_On': { goto: stateCEPH_dialogQuickOn, show: ((quick=='On')? 'quickHover':'quickDefault') }, 'Text_Quick_Off': { goto: stateCEPH_dialogQuickOff, show: ((quick=='On')? 'quickDefault':'quickHover') }, 'Close': { goto: stateCEPH_default}, }, [stateCEPH_dialogMAkV] : { _stateInherit: ['_CEPH_DIALOG_KV_MA', _stateCEPH_base, '_'+p, '_DISABLE_ARROWS'], 'Text_Info': { text: textInfo }, 'Text_Info_Y': { text: textInfo }, 'Close': { goto: stateCEPH_default }, }, }, // if not C4 add dialog (c!='C4'? { [stateCEPH_dialogKV] : { _stateInherit: ['_CEPH_DIALOG_KV', _stateCEPH_base, '_'+p, '_DISABLE_ARROWS'], 'Text_Quick': Quick_Factory( quickU ), 'FilterSym_1': { show: mode=='Koll'? o.filterSymKoll : o.filterSymKoll.replace('_H','_L'), goto: stateCEPH_dialogVoll }, 'FilterSym_2': { show: mode=='Voll'? o.filterSymVoll : o.filterSymVoll.replace('_H','_L'), goto: stateCEPH_dialogKoll }, 'Close': { goto: stateCEPH_default}, }, } : {}), (c=='C3'||c=='C3F'? { [stateCEPH_default] : { _stateInherit: ['_CEPH', _stateCEPH_base, '_MENU'], 'Text_Mode': { text: c, goto: (c=='C3'? 'C3F':'C3')+'_'+pL+'_'+quickL+'_'+mode }, 'Text_Quick': Quick_Factory( quickU, { goto: stateCEPH_dialogQuick } ), 'Text_Info': { text: textInfo, goto: stateCEPH_dialogMAkV }, 'ArrowMinus': { goto: stateCEPH_prev }, 'ArrowPlus': { goto: stateCEPH_next }, }, } : {}), ); } /* ____ _____ |___ \ | __ \ __) | | | | | |__ < | | | | ___) | | |__| | |____/ |_____/ */ Object.assign(stateMachine,{ /* Base */ '_3D': { _sceneName: '3D', 'Filter': { show:'Filter_' }, 'Head_1': { action: 'showExposureVideo', video: 'Video_Stirnstuetze_3D', gotoAfterVideo: -1 }, 'Head_2': { action: 'showExposureVideo', video: 'Video_Stirnstuetze_3D', gotoAfterVideo: -1 }, 'Head_3': { action: 'showExposureVideo', video: 'Video_Stirnstuetze_3D', gotoAfterVideo: -1 }, 'Head_4': { action: 'showExposureVideo', video: 'Video_Stirnstuetze_3D', gotoAfterVideo: -1 }, 'Frame_ArrowDown': { action: 'showExposureVideo', video: 'Video_Hoehneverstellung_3D', gotoAfterVideo: -1 }, 'Frame_ArrowUp': { action: 'showExposureVideo', video: 'Video_Hoehneverstellung_3D', gotoAfterVideo: -1 }, }, '_3D_DIALOG_RES': { _sceneName: '3D-DIALOG', 'DIALOG_DIA': { hidden: true }, 'DIALOG_KV_MA': { hidden: true }, 'DIALOG_4Q': { hidden: true }, 'Light': { show: 'Light_' }, }, '_3D_DIALOG_DIA': { _sceneName: '3D-DIALOG', 'DIALOG_RES': { hidden: true }, 'DIALOG_KV_MA': { hidden: true }, 'DIALOG_4Q': { hidden: true }, 'Light': { show: 'Light_' }, }, '_3D_DIALOG_KV_MA': { _sceneName: '3D-DIALOG', 'DIALOG_DIA': { hidden: true }, 'DIALOG_RES': { hidden: true }, 'DIALOG_4Q': { hidden: true }, 'Light': { show: 'Light_' }, }, '_3D_DIALOG_4Q': { _sceneName: '3D-DIALOG', 'DIALOG_DIA': { hidden: true }, 'DIALOG_KV_MA': { hidden: true }, 'DIALOG_RES': { hidden: true }, 'Light': { show: 'Light_' }, }, }); /* ########## 3D_5 ########## */ function quadGen_front(p,o){ return { QuadrantLarge: 'QuadrantLarge_'+p.quadrant, QL_OK: '3D_5_front_3p_q_ok_'+'dialog_k_'+o.res, /* QL_6 */ QL_OH: '3D_5_front_3p_q_ohne_'+'dialog_k_'+o.res, /* QL_5 */ QL_UK: '3D_5_front_3p_q_uk_'+'dialog_k_'+o.res, /* QL_9 */ } } function quadGen_ml(p,o){ return { QuadrantLarge: 'QuadrantLarge_'+p.quadrant, QL_OK: '3D_5_ml_3p_q_2_'+'dialog_k_'+o.res, /* QL_2 */ QL_OH: '3D_5_ml_3p_q_ohne_'+'dialog_k_'+o.res, /* QL_5 */ QL_UK: '3D_5_ml_3p_q_3_'+'dialog_k_'+o.res, /* QL_3 */ } } function quadGen_mr(p,o){ return { QuadrantLarge: 'QuadrantLarge_'+p.quadrant, QL_OK: '3D_5_mr_3p_q_1_'+'dialog_k_'+o.res, /* QL_1 */ QL_OH: '3D_5_mr_3p_q_ohne_'+'dialog_k_'+o.res, /* QL_5 */ QL_UK: '3D_5_mr_3p_q_4_'+'dialog_k_'+o.res, /* QL_4 */ } } function quadGen_ohnerc(p,o){ return { QuadrantLarge: 'QuadrantLarge_'+p.quadrant, QL_OK: '3D_5_ohnerc_3p_q_ok_'+'dialog_k_'+o.res, /* QL_6 */ QL_OH: '3D_5_ohnerc_3p_q_ohne_'+'dialog_k_'+o.res, /* QL_5 */ QL_UK: '3D_5_ohnerc_3p_q_uk_'+'dialog_k_'+o.res, /* QL_9 */ } } function quadGen_pl(p,o){ return { QuadrantLarge: 'QuadrantLarge_'+p.quadrant, QL_OK: '3D_5_pl_3p_q_2_'+'dialog_k_'+o.res, /* QL_2 */ QL_OH: '3D_5_pl_3p_q_ohne_'+'dialog_k_'+o.res, /* QL_5 */ QL_UK: '3D_5_pl_3p_q_3_'+'dialog_k_'+o.res, /* QL_3 */ } } function quadGen_pr(p,o){ return { QuadrantLarge: 'QuadrantLarge_'+p.quadrant, QL_OK: '3D_5_pr_3p_q_1_'+'dialog_k_'+o.res, /* QL_1 */ QL_OH: '3D_5_pr_3p_q_ohne_'+'dialog_k_'+o.res, /* QL_5 */ QL_UK: '3D_5_pr_3p_q_4_'+'dialog_k_'+o.res, /* QL_4 */ } } function button3D_5cm(p,o){ function isCurrentStateToggle(name){ if (name==p.basename+o.res) { switch (p.r) { case 'oh': return '3D_5_ohnerc_3p_q_ohne_'+o.res; case 'ok': return '3D_5_ohnerc_3p_q_ok_'+o.res; case 'uk': return '3D_5_ohnerc_3p_q_uk_'+o.res; } } else { return name; } } switch (p.r) { case 'oh': return { Button_3D_front: isCurrentStateToggle('3D_5_front_3p_q_ohne_'+o.res), Button_3D_ml: isCurrentStateToggle('3D_5_ml_3p_q_ohne_'+o.res), Button_3D_mr: isCurrentStateToggle('3D_5_mr_3p_q_ohne_'+o.res), Button_3D_pl: isCurrentStateToggle('3D_5_pl_3p_q_ohne_'+o.res), Button_3D_pr: isCurrentStateToggle('3D_5_pr_3p_q_ohne_'+o.res), } case 'ok': return { Button_3D_front: isCurrentStateToggle('3D_5_front_3p_q_ok_'+o.res), Button_3D_ml: isCurrentStateToggle('3D_5_ml_3p_q_2_'+o.res), Button_3D_mr: isCurrentStateToggle('3D_5_mr_3p_q_1_'+o.res), Button_3D_pl: isCurrentStateToggle('3D_5_pl_3p_q_2_'+o.res), Button_3D_pr: isCurrentStateToggle('3D_5_pr_3p_q_1_'+o.res), } case 'uk': return { Button_3D_front: isCurrentStateToggle('3D_5_front_3p_q_uk_'+o.res), Button_3D_ml: isCurrentStateToggle('3D_5_ml_3p_q_3_'+o.res), Button_3D_mr: isCurrentStateToggle('3D_5_mr_3p_q_4_'+o.res), Button_3D_pl: isCurrentStateToggle('3D_5_pl_3p_q_3_'+o.res), Button_3D_pr: isCurrentStateToggle('3D_5_pr_3p_q_4_'+o.res), } } } var Mode_3D_Quadrant = [ /* Front_AndHer_ok */ { basename: '3D_5_front_3p_q_ohne_', r:'oh', c: 'VOL2', Jaw_3D: '3D_Jaw_5x5_front', Head: 'HeadHorYellowDefault5', quadrant: '10', quadrantFunc: quadGen_front, buttonFunc: button3D_5cm, }, { basename: '3D_5_front_3p_q_ok_', r:'ok', c: 'VOL2', Jaw_3D: '3D_Jaw_5x5_front', Head: 'HeadHorYellowOK', quadrant: '8' , quadrantFunc: quadGen_front, buttonFunc: button3D_5cm, Light:true }, { basename: '3D_5_front_3p_q_uk_', r:'uk', c: 'VOL2', Jaw_3D: '3D_Jaw_5x5_front', Head: 'HeadHorYellowUK', quadrant: '9' , quadrantFunc: quadGen_front, buttonFunc: button3D_5cm, Light:true }, /* Molar Links_AndHer_ok */ { basename: '3D_5_ml_3p_q_ohne_', r:'oh', c: 'VOL2', Jaw_3D: '3D_Jaw_5x5_mol_left', Head: 'HeadHorYellowDefault5', quadrant: '10', quadrantFunc: quadGen_ml, buttonFunc: button3D_5cm }, { basename: '3D_5_ml_3p_q_2_', r:'ok', c: 'VOL2', Jaw_3D: '3D_Jaw_5x5_mol_left', Head: 'HeadHorYellowOK', quadrant: '2', quadrantFunc: quadGen_ml, buttonFunc: button3D_5cm, Light:true }, { basename: '3D_5_ml_3p_q_3_', r:'uk', c: 'VOL2', Jaw_3D: '3D_Jaw_5x5_mol_left', Head: 'HeadHorYellowUK', quadrant: '3', quadrantFunc: quadGen_ml, buttonFunc: button3D_5cm, Light:true }, /* Molar Rechts_AndHer_ok */ { basename: '3D_5_mr_3p_q_ohne_', r:'oh', c: 'VOL2', Jaw_3D: '3D_Jaw_5x5_mol_right', Head: 'HeadHorYellowDefault5', quadrant: '10', quadrantFunc: quadGen_mr, buttonFunc: button3D_5cm }, { basename: '3D_5_mr_3p_q_1_', r:'ok', c: 'VOL2', Jaw_3D: '3D_Jaw_5x5_mol_right', Head: 'HeadHorYellowOK', quadrant: '1', quadrantFunc: quadGen_mr, buttonFunc: button3D_5cm, Light:true }, { basename: '3D_5_mr_3p_q_4_', r:'uk', c: 'VOL2', Jaw_3D: '3D_Jaw_5x5_mol_right', Head: 'HeadHorYellowUK', quadrant: '4', quadrantFunc: quadGen_mr, buttonFunc: button3D_5cm, Light:true }, /* Ohne Rotationszentrum_frariv_ok */ { basename: '3D_5_ohnerc_3p_q_ohne_', r:'oh', c: 'VOL2', Jaw_3D: '3D_Jaw_5x5_empty', Head: 'HeadHorYellowDefault5', quadrant: '10', quadrantFunc: quadGen_ohnerc, buttonFunc: button3D_5cm }, { basename: '3D_5_ohnerc_3p_q_ok_', r:'ok', c: 'VOL2', Jaw_3D: '3D_Jaw_5x5_empty', Head: 'HeadHorYellowOK', quadrant: '8', quadrantFunc: quadGen_ohnerc, buttonFunc: button3D_5cm, Light:true }, { basename: '3D_5_ohnerc_3p_q_uk_', r:'uk', c: 'VOL2', Jaw_3D: '3D_Jaw_5x5_empty', Head: 'HeadHorYellowUK', quadrant: '9', quadrantFunc: quadGen_ohnerc, buttonFunc: button3D_5cm, Light:true }, /* Premolar Links_frariv_ok */ { basename: '3D_5_pl_3p_q_ohne_', r:'oh', c: 'VOL2', Jaw_3D: '3D_Jaw_5x5_premol_left', Head: 'HeadHorYellowDefault5', quadrant: '10', quadrantFunc: quadGen_pl, buttonFunc: button3D_5cm }, { basename: '3D_5_pl_3p_q_2_', r:'ok', c: 'VOL2', Jaw_3D: '3D_Jaw_5x5_premol_left', Head: 'HeadHorYellowOK', quadrant: '2', quadrantFunc: quadGen_pl, buttonFunc: button3D_5cm, Light:true }, { basename: '3D_5_pl_3p_q_3_', r:'uk', c: 'VOL2', Jaw_3D: '3D_Jaw_5x5_premol_left', Head: 'HeadHorYellowUK', quadrant: '3', quadrantFunc: quadGen_pl, buttonFunc: button3D_5cm, Light:true }, /* Premolar Links_frariv_ok */ { basename: '3D_5_pr_3p_q_ohne_', r:'oh', c: 'VOL2', Jaw_3D: '3D_Jaw_5x5_premol_right', Head: 'HeadHorYellowDefault5', quadrant: '10', quadrantFunc: quadGen_pr, buttonFunc: button3D_5cm, }, { basename: '3D_5_pr_3p_q_1_', r:'ok', c: 'VOL2', Jaw_3D: '3D_Jaw_5x5_premol_right', Head: 'HeadHorYellowOK', quadrant: '1', quadrantFunc: quadGen_pr, buttonFunc: button3D_5cm, Light:true }, { basename: '3D_5_pr_3p_q_4_', r:'uk', c: 'VOL2', Jaw_3D: '3D_Jaw_5x5_premol_right', Head: 'HeadHorYellowUK', quadrant: '4', quadrantFunc: quadGen_pr, buttonFunc: button3D_5cm, Light:true }, ]; var Mode_3D_Collection = [ { res: 'hd', time: '14.4 s', textFilter: '0.3mm Cu', textInfo: '85kV
6mA', }, { res: 'low', time: '2.2 s', textFilter: '1mm Cu', textInfo: '85kV
10mA', }, { res: 'sd', time: '4.4 s', textFilter: '0.3mm Cu', textInfo: '85kV
10mA', }, ]; Mode_3D_Quadrant.forEach(function(p){ var basename = p.basename; var quadrant = p.quadrant; Mode_3D_Collection.forEach(function(o){ var quadrantObject = p.quadrantFunc(p,o) || {}; var buttonObject = p.buttonFunc(p,o) || {}; var navObject = navPrevNext(p,o); Object.assign( stateMachine, Mode_3D (basename+o.res, Object.assign( {}, p, o, buttonObject, navObject, { QuadrantSmall: 'QuadrantSmall_'+quadrant, diameter: '5', state_dialog_a: basename+'dialog_a_'+o.res, state_dialog_d: basename+'dialog_d_'+o.res, state_dialog_k: basename+'dialog_k_'+o.res, state_dialog_v: basename+'dialog_v_'+o.res, })), Mode_3D_dialog_a (basename+o.res, basename+'dialog_a_'+o.res, Object.assign( {}, p, o, { state_hd: basename+'dialog_a_'+'hd', state_sd: basename+'dialog_a_'+'sd', state_low: basename+'dialog_a_'+'low', })), Mode_3D_dialog_d (basename+o.res, basename+'dialog_d_'+o.res, Object.assign( {}, p, o, { })), Mode_3D_dialog_k (basename+o.res, basename+'dialog_k_'+o.res, Object.assign( {}, p, o, quadrantObject )), Mode_3D_dialog_v (basename+o.res, basename+'dialog_v_'+o.res , Object.assign( {}, p, o, { diameter: '5' })), ); }); }); /* ########## 3D_8 HD/SD ########## */ function button3D_8cm(p,o){ function isCurrentStateToggle(name, res){ var noLowState=(name=='3D_8_ml_3p_q_links_' || name=='3D_8_mr_3p_q_rechts_') && res=='low'; if (name+res==p.basename+res) { return '3D_8_ohne_3p_q_all_'+(noLowState? 'sd' : res ); } else { return name+(noLowState? 'sd' : res ); } } return { Button_3D_front: isCurrentStateToggle('3D_8_zentral_3p_q_all_', o.res), Button_3D_ml: isCurrentStateToggle('3D_8_ml_3p_q_links_', o.res), Button_3D_mr: isCurrentStateToggle('3D_8_mr_3p_q_rechts_', o.res), Button_3D_pl: isCurrentStateToggle('3D_8_pl_3p_q_links_', o.res), Button_3D_pr: isCurrentStateToggle('3D_8_pr_3p_q_rechts_', o.res), } } var Mode_3D_Quadrant = [ { basename: '3D_8_ml_3p_q_links_', c: 'VOL1', Jaw_3D: '3D_Jaw_8x8_mol_left', Head: 'HeadHorBlueKG', quadrant: '7', buttonFunc: button3D_8cm, Light:true }, { basename: '3D_8_mr_3p_q_rechts_', c: 'VOL1', Jaw_3D: '3D_Jaw_8x8_mol_right', Head: 'HeadHorBlueKG', quadrant: '6', buttonFunc: button3D_8cm, Light:true }, ]; var Mode_3D_Collection = [ { res: 'hd', time: '14.4 s', textFilter: '0.3mm Cu', textInfo: '85kV
6mA', }, { res: 'sd', time: '4.4 s', textFilter: '0.3mm Cu', textInfo: '85kV
10mA', }, ]; Mode_3D_Quadrant.forEach(function(p){ var basename = p.basename; var quadrant = p.quadrant; Mode_3D_Collection.forEach(function(o){ var buttonObject = p.buttonFunc(p,o) || {}; var navObject = navPrevNext(p,o); Object.assign( stateMachine, Mode_3D (basename+o.res, Object.assign( {}, p, o, buttonObject, navObject, { QuadrantSmall: 'QuadrantSmall_'+quadrant, diameter: '8', state_dialog_a: basename+'dialog_a_'+o.res, state_dialog_d: basename+'dialog_d_'+o.res, state_dialog_v: basename+'dialog_v_'+o.res, })), Mode_3D_dialog_a (basename+o.res, basename+'dialog_a_'+o.res, Object.assign( {}, p, o, { state_hd: basename+'dialog_a_'+'hd', state_sd: basename+'dialog_a_'+'sd', })), Mode_3D_dialog_d (basename+o.res, basename+'dialog_d_'+o.res, Object.assign( {}, p, o, { })), Mode_3D_dialog_v (basename+o.res, basename+'dialog_v_'+o.res , Object.assign( {}, p, o, { diameter: '8', })), ); }); }); /* ########## 3D_8 + 3D_11 HD/LOW/SD ########## */ function button3D_11cm(){ return {}; } var Mode_3D_Quadrant = [ /* 8 */ { basename: '3D_8_ohne_3p_q_all_', diameter: '8', c: 'VOL1', Jaw_3D: '3D_Jaw_8x8_empty', Head: 'HeadHorYellowZ8', quadrant: '5', buttonFunc: button3D_8cm, Light:true }, { basename: '3D_8_pl_3p_q_links_', diameter: '8', c: 'VOL1', Jaw_3D: '3D_Jaw_8x8_premol_left', Head: 'HeadHorYellowZ8', quadrant: '7', buttonFunc: button3D_8cm, Light:true }, { basename: '3D_8_pr_3p_q_rechts_', diameter: '8', c: 'VOL1', Jaw_3D: '3D_Jaw_8x8_premol_right', Head: 'HeadHorYellowZ8', quadrant: '6', buttonFunc: button3D_8cm, Light:true }, { basename: '3D_8_zentral_3p_q_all_', diameter: '8', c: 'VOL1', Jaw_3D: '3D_Jaw_8x8_front', Head: 'HeadHorYellowZ8', quadrant: '5', buttonFunc: button3D_8cm, Light:true }, /* 11 */ { basename: '3D_11_m_3p_q_all_', diameter: '11', c: 'VOL3', Jaw_3D: '3D_Jaw_11x10_front_XL', Head: 'HeadHorYellowZ8', quadrant: '5', buttonFunc: button3D_11cm, Light:true }, { basename: '3D_17_m_3p_q_all_', diameter: '17', c: 'VOL4', Jaw_3D: '3D_Jaw_17x13_center', Head: 'HeadHorYellowZ8', quadrant: '5', buttonFunc: button3D_11cm, Light:true }, ]; var Mode_3D_Collection = [ { res: 'hd', time: '14.4 s', textFilter: '0.3mm Cu', textInfo: '85kV
6mA', }, { res: 'low', time: '2.2 s', textFilter: '1mm Cu', textInfo: '85kV
10mA', }, { res: 'sd', time: '4.4 s', textFilter: '0.3mm Cu', textInfo: '85kV
10mA', }, ]; var Mode_3D_Collection_17 = [ { res: 'hd', time: '16.7 s', textFilter: '0.5mm Cu', textInfo: '85kV
6mA', }, { res: 'low', time: '3.9 s', textFilter: '1mm Cu', textInfo: '85kV
10mA', }, { res: 'sd', time: '5.9 s', textFilter: '0.5mm Cu', textInfo: '85kV
10mA', }, ]; Mode_3D_Quadrant.forEach(function(p){ var basename = p.basename; var quadrant = p.quadrant; if (p.diameter=='17') Mode_3D_Collection = Mode_3D_Collection_17; Mode_3D_Collection.forEach(function(o){ var buttonObject = p.buttonFunc(p,o) || {}; var navObject = navPrevNext(p,o); Object.assign( stateMachine, Mode_3D (basename+o.res, Object.assign( {}, p, o, buttonObject, navObject, { QuadrantSmall: 'QuadrantSmall_'+quadrant, state_dialog_a: basename+'dialog_a_'+o.res, state_dialog_d: basename+'dialog_d_'+o.res, state_dialog_v: basename+'dialog_v_'+o.res, })), Mode_3D_dialog_a (basename+o.res, basename+'dialog_a_'+o.res, Object.assign( {}, p, o, { state_hd: basename+'dialog_a_'+'hd', state_sd: basename+'dialog_a_'+'sd', state_low: basename+'dialog_a_'+'low', })), Mode_3D_dialog_d (basename+o.res, basename+'dialog_d_'+o.res, Object.assign( {}, p, o, { })), Mode_3D_dialog_v (basename+o.res, basename+'dialog_v_'+o.res , Object.assign( {}, p, o, { })), ); }); }); /* 3D States helper */ function Mode_3D(state3D_name, o){ var p = o.p || '3P'; var state3D_base = '_'+state3D_name+'_BASE'; //return return { [state3D_base]: { _stateInherit: ['_3D', '_'+p, '_MENU'], 'Light': o.hasOwnProperty('Light')? { show: 'Light_' } : { hidden:true }, 'Blue': o.res != 'low'? { hidden: true } : {}, 'Jaw_3D': { show: (o.c == 'VOL1' && o.res == 'low') ? o.Jaw_3D+'_LD' : o.Jaw_3D }, 'Head': { show: o.Head }, 'VolDiameter': { show: 'VolDiameter'+o.diameter+'cmNorm', }, 'ResMode_3D': { show: ResModeNameFactory(o.res) }, 'QuadrantSmall': { show: o.QuadrantSmall }, 'Text_Mode': { text: o.c }, 'Text_Duration': { text: o.time }, 'Text_Info': { text: o.textInfo }, 'Text_Filter': { text: o.textFilter }, 'Button_3D_front': ifSetGotoElseHide(o.Button_3D_front), 'Button_3D_pl': ifSetGotoElseHide(o.Button_3D_pl), 'Button_3D_pr': ifSetGotoElseHide(o.Button_3D_pr), 'Button_3D_ml': ifSetGotoElseHide(o.Button_3D_ml), 'Button_3D_mr': ifSetGotoElseHide(o.Button_3D_mr), }, [state3D_name]: { _stateInherit: ['_3D', state3D_base, '_'+p, '_MENU'], 'VolDiameter': { show: 'VolDiameter'+o.diameter+'cmNorm', goto: o.state_dialog_v}, 'ResMode_3D': { show: ResModeNameFactory(o.res), goto: o.state_dialog_a }, 'QuadrantSmall': { show: o.QuadrantSmall, goto: o.state_dialog_k }, 'Text_Info': { text: o.textInfo ,goto: o.state_dialog_d }, 'ArrowPlus': { goto: o.nextC }, 'ArrowMinus': { goto: o.prevC }, } } } function Mode_3D_dialog_a(state3D_default, state3D_dialog, o){ var p = o.p || '3P'; var state3D_base = '_'+state3D_default+'_BASE'; return { [state3D_dialog]: { _stateInherit: ['_3D_DIALOG_RES', state3D_base, '_'+p, '_DISABLE_ARROWS'], 'ResModeHigh_3D': { show:'3D_ResModeHigh_' +(o.res=='hd'? 'H':'Norm'), goto: o.state_hd }, 'ResModeStd_3D': { show:'3D_ResModeStd_' +(o.res=='sd'? 'H':'Norm'), goto: o.state_sd }, 'ResModeLow_3D': { show:'3D_ResModeLow_' +(o.res=='low'? 'H':'Norm'), goto: o.state_low }, 'Close': { goto: state3D_default}, } } } function ResModeFactory(o, res){ if (o.res == res){ return { show: '3D_ResMode'+ResModeNameFactory(res)+'_H' } } else { return { show: '3D_ResMode'+ResModeNameFactory(res)+'_H', goto: o['state_'+res] } } } function Mode_3D_dialog_d(state3D_default, state3D_dialog, o){ var p = o.p || '3P'; var state3D_base = '_'+state3D_default+'_BASE'; return { [state3D_dialog]: { _stateInherit: ['_3D_DIALOG_KV_MA', state3D_base, '_'+p, '_DISABLE_ARROWS'], 'Text_Info': { text: o.textInfo }, 'Text_Info_Y': { text: o.textInfo }, 'Close': { goto: state3D_default }, } } } function Mode_3D_dialog_v(state3D_default, state3D_dialog, o){ var p = o.p || '3P'; var state3D_base = '_'+state3D_default+'_BASE'; return { [state3D_dialog]: { _stateInherit: ['_3D_DIALOG_DIA', state3D_base, '_'+p, '_DISABLE_ARROWS'], 'VolDiameter5cm': DiameterFactory(o, '5'), 'VolDiameter8cm': DiameterFactory(o, '8'), 'VolDiameter11cm': DiameterFactory(o, '11'), 'VolDiameter17cm': DiameterFactory(o, '17'), 'Close': { goto: state3D_default }, } } } function Mode_3D_dialog_k(state3D_default, state3D_dialog, o){ var p = o.p || '3P'; var state3D_base = '_'+state3D_default+'_BASE'; if (o.QL_OK) { o.QL_1 = o.QL_6 = o.QL_2 = o.QL_OK; } if (o.QL_OH) { o.QL_7 = o.QL_5 = o.QL_8 = o.QL_OH; } if (o.QL_UK) { o.QL_3 = o.QL_9 = o.QL_4 = o.QL_UK; } return { [state3D_dialog]: { _stateInherit: ['_3D_DIALOG_4Q', state3D_base, '_'+p, '_DISABLE_ARROWS'], 'QuadrantLarge': { show: o.QuadrantLarge }, 'QL_1': ifSetGotoElseHide(o.QL_1), 'QL_2': ifSetGotoElseHide(o.QL_2), 'QL_3': ifSetGotoElseHide(o.QL_3), 'QL_4': ifSetGotoElseHide(o.QL_4), 'QL_5': ifSetGotoElseHide(o.QL_5), 'QL_6': ifSetGotoElseHide(o.QL_6), 'QL_7': ifSetGotoElseHide(o.QL_7), 'QL_8': ifSetGotoElseHide(o.QL_8), 'QL_9': ifSetGotoElseHide(o.QL_9), 'Close': { goto: state3D_default }, } } } /* 3D Helper */ function ResModeNameFactory(res){ switch(res){ case 'hd' : return '3D_ResModeHigh_Norm'; break; case 'sd' : return '3D_ResModeStd_Norm'; break; case 'low' : return '3D_ResModeLow_Norm'; break; } } function ifSetGotoElseHide(name){ return name? { goto: name } : { hidden: true } } function navPrevNext (p,o){ var res=o.res; if (res=='low') res='sd'; var vol1 = '3D_8_ohne_3p_q_all_'+res; var vol2 = '3D_5_ohnerc_3p_q_ohne_'+res; var vol3 = '3D_11_m_3p_q_all_'+res; var vol4 = '3D_17_m_3p_q_all_'+res; switch (p.c){ case 'VOL1': return { prevC: vol4, nextC: vol2} case 'VOL2': return { prevC: vol1, nextC: vol3} case 'VOL3': return { prevC: vol2, nextC: vol4} case 'VOL4': return { prevC: vol3, nextC: vol1} default: log('navPrevNext: p.c out of norm!'); break; } return {} } function DiameterEntryState (o, diameter){ var res=o.res; if (res=='low') res='sd'; switch (diameter){ case '5': return '3D_5_ohnerc_3p_q_ohne_dialog_v_'+res; break; case '8': return '3D_8_ohne_3p_q_all_dialog_v_'+res; break; case '11': return '3D_11_m_3p_q_all_dialog_v_'+res; break; case '17': return '3D_17_m_3p_q_all_dialog_v_'+res; break; default: log('DiameterEntryState: diameter out of norm!'); break; } return ''; } function DiameterFactory(o, diameter){ if (o.diameter == diameter){ return { show: 'VolDiameter'+diameter+'cmH' } } else { return { show: 'VolDiameter'+diameter+'cmNorm', goto: DiameterEntryState(o, diameter) } } } /* Reveal Public interface to window['StateMachineGenerator'] */ return { 'asObject': function(log){ if (log) console.dir(stateMachine); return stateMachine; }, /** * setHypeSingleton * @param {Boolean} dump to console, good for copy and paste * @param {Number} if a number then output is formated with spaces */ 'asJSON': function(log, spaces){ var str = JSON.stringify( stateMachine, null, spaces ); if (log) console.log(str); return str; }, logParseJSON: function(){ var str = "var rawJSON = '"+JSON.stringify( stateMachine )+"';\n"+ "var StateMachineGenerator = {};\n"+ 'StateMachineGenerator.asObject = function(){ return JSON.parse(rawJSON); }'; console.log(str); } }; })();