result_Play_collision_pane.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. ////////////////////////////////////////////////////////////////////////////
  2. // System Pre-define Functions
  3. // 95099372-ef3e-11ea-9c81-bf848405c62e
  4. //Callback of data preparation stage before UI is fully loaded.
  5. function OnInitializeData(reload, preview) {
  6. PUI(()=>{
  7. //you can access the 'ui' namespace in the parent form using the variable 'pui' here.
  8. //The 'pui' variable is valid in all functions of this document.
  9. //For robustness, you'd better use 'PUI(cb);' to access 'pui' variable.
  10. });
  11. }
  12. //Callback after UI is fully loaded and displayed.
  13. function OnReady(reload, preview) {
  14. PUI(()=>{
  15. //you can access the 'ui' namespace in the parent form using the variable 'pui' here.
  16. //The 'pui' variable is valid in all functions of this document.
  17. //For robustness, you'd better use 'PUI(cb);' to access 'pui' variable.
  18. });
  19. }
  20. function OnCloseForm() {
  21. }
  22. function OnException(err) {
  23. //ui.MessageBox('Error', '' + err, MessageBox.Icon.Critical, MessageBox.Button.Ok);
  24. }
  25. let myArray = [];
  26. //////////////////////////////////////////////////////////////////////////
  27. // Callback Functions.
  28. // 641a254c-ef3e-11ea-bc8a-379bb908bdd7
  29. function OnReset(){
  30. var id = parent.setTimeout(() => {
  31. unit.form.mainfrm.OnSend('0');
  32. }, 100);
  33. unit.form.mainfrm.OnSend('reset');
  34. }
  35. function OnYes(){
  36. ui.msg.list = myArray;
  37. is_Click(true);
  38. }
  39. function is_Click(idx){
  40. ui.pb_leftFastPlay.enable = idx;
  41. ui.pb_leftPlay.enable = idx;
  42. ui.pb_play.enable = idx;
  43. ui.pb_stop.enable = idx;
  44. ui.pb_rightPlay.enable = idx;
  45. ui.pb_rightFastPlay.enable = idx;
  46. }
  47. function OnOpen(){
  48. var id = parent.setTimeout(() => {
  49. unit.form.mainfrm.OnSend('0');
  50. }, 100);
  51. unit.form.mainfrm.OnSend('rendererVTK E:/vs/QFrameSelect/mpm/box3D_FEMmpData1.vtk');
  52. }
  53. function OnRightPlay() {
  54. var id = parent.setTimeout(() => {
  55. unit.form.mainfrm.OnSend('rightPlay 0');
  56. }, 100);
  57. unit.form.mainfrm.OnSend('rightPlay 1');
  58. }
  59. function OnLeftPlay() {
  60. var id = parent.setTimeout(() => {
  61. unit.form.mainfrm.OnSend('leftPlay 0');
  62. }, 100);
  63. unit.form.mainfrm.OnSend('leftPlay 1');
  64. }
  65. function OnRightFastPlay() {
  66. var id = parent.setTimeout(() => {
  67. unit.form.mainfrm.OnSend('rightFastPlay 0');
  68. }, 100);
  69. unit.form.mainfrm.OnSend('rightFastPlay 1');
  70. }
  71. function OnLeftFastPlay() {
  72. var id = parent.setTimeout(() => {
  73. unit.form.mainfrm.OnSend('leftFastPlay 0');
  74. }, 100);
  75. unit.form.mainfrm.OnSend('leftFastPlay 1');
  76. }
  77. function OnStop() {
  78. ui.stack_play.index = 0;
  79. unit.form.mainfrm.OnSend('play 0');
  80. }
  81. function OnPlay() {
  82. ui.stack_play.index = 1;
  83. unit.form.mainfrm.OnSend('play 1');
  84. }
  85. function OnChangeValue() {
  86. var id = parent.setTimeout(() => {
  87. unit.form.mainfrm.OnSend('attri ' + ui.msg.value + ' 0');
  88. }, 100);
  89. unit.form.mainfrm.OnSend('attri ' + ui.msg.value + ' 1');
  90. }
  91. //The message corresponding callback executed by the docker pane.
  92. // when calling [side_pane].fireEvent(type,para) in the main form.
  93. function OnParentDockerMessage(type, para) {
  94. }
  95. //////////////////////////////////////////////////////////////////////////
  96. // Utils Functions.
  97. // 6c165ad6-ef3e-11ea-987c-b761a131c2fe
  98. function onDragFile(filepath) {
  99. }
  100. function PUI(cb) {
  101. if(pui){cb();}
  102. }
  103. /*Usage of BLOCK_EVENT
  104. BLOCK_EVENT(()=>{
  105. ui.[name].[var] = ...;
  106. });
  107. */
  108. function BLOCK_EVENT(cb) {
  109. ui.block_event = true;
  110. cb();
  111. ui.block_event = false;
  112. }
  113. //////////////////////////////////////////////////////////////////////////
  114. // template codes for cw callback js.
  115. CW_DeclareVariable("Array",
  116. val => {
  117. myArray.push(val);
  118. }, () => {});
  119. CW_DeclareVariable("frame",
  120. val => {
  121. ui.frame.value = val;
  122. }, () => {});
  123. function CW_DeclareVariable(name, setter, getter) {
  124. if(typeof(__DeclareVariable) === 'function') {
  125. __DeclareVariable(name, setter, getter);
  126. }
  127. }
  128. function CW_DeclareOuterVariable(name) {
  129. if(typeof(__DeclareOuterVariable) === 'function') {
  130. __DeclareOuterVariable(name);
  131. }
  132. }