result_attribute_pane.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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. //////////////////////////////////////////////////////////////////////////
  26. // Callback Functions.
  27. // 641a254c-ef3e-11ea-bc8a-379bb908bdd7
  28. function OnStress(){
  29. unit.form.mainfrm.OnSend('Stress ' + model.getCurrentDirectory() + 'data');
  30. unit.form.mainfrm.OnChangePicture(5, 2);
  31. //unit.form.mainfrm.OnCueline('<h4 style="font-family:arial;color: green;font-size:20px;">恭喜您已完成压力云图的切换!</h4>');
  32. unit.form.mainfrm.OnCueline('您已完成压力云图的切换!', 'green');
  33. }
  34. function OnMaxMin(){
  35. var id = parent.setTimeout(() => {
  36. unit.form.mainfrm.OnSend('0');
  37. }, 100);
  38. unit.form.mainfrm.OnSend('minmax');
  39. }
  40. function OnPointCloud(){
  41. var id = parent.setTimeout(() => {
  42. unit.form.mainfrm.OnSend('0');
  43. }, 100);
  44. unit.form.mainfrm.OnSend('pointCloud');
  45. }
  46. var tubiao = false;
  47. function OnTuBiao(){
  48. /*tubiao = !tubiao;
  49. if(tubiao === true){
  50. unit.form.mainfrm.OnSend('scalarBar true false');
  51. }else{
  52. unit.form.mainfrm.OnSend('closeScalarBar');
  53. }*/
  54. var id = parent.setTimeout(() => {
  55. unit.form.mainfrm.OnSend('0');
  56. }, 100);
  57. unit.form.mainfrm.OnSend('scalarBar true false');
  58. unit.form.mainfrm.OnChangePicture(5, 2);
  59. //unit.form.mainfrm.OnCueline('<h4 style="font-family:arial;color: green;font-size:20px;">恭喜您完成颜色条的开闭!</h4>');
  60. unit.form.mainfrm.OnCueline('您完成颜色条的开闭!', 'green');
  61. }
  62. function OnReset(){
  63. var id = parent.setTimeout(() => {
  64. unit.form.mainfrm.OnSend('0');
  65. }, 100);
  66. unit.form.mainfrm.OnSend('reset');
  67. }
  68. function OnChangeAttribute(){
  69. if(ui.attribute.index !== 4){
  70. unit.form.mainfrm.OnSend('attribute ' + (ui.attribute.index + 1));
  71. }else if(ui.attribute.index === 4){
  72. unit.form.mainfrm.OnSend('attribute 9');
  73. }
  74. //unit.form.mainfrm.OnSend('attribute ' + (ui.attribute.index + 1));
  75. unit.form.mainfrm.OnChangePicture(5, 2);
  76. //unit.form.mainfrm.OnCueline('<h4 style="font-family:arial;color: green;font-size:20px;">恭喜您已完成位移云图的切换!</h4>');
  77. unit.form.mainfrm.OnCueline('您已完成位移云图的切换!', 'green');
  78. //unit.form.mainfrm.OnSend('scalarBar true true');
  79. }
  80. function OnReturnMenu(){
  81. unit.form.mainfrm.menu(8);
  82. }
  83. function OnLoad(){
  84. //unit.form.mainfrm.OnChangeWindows(2);
  85. unit.form.mainfrm.OnSend('Renderer ' + model.getCurrentDirectory() + '/data');
  86. unit.form.mainfrm.OnChangePicture(5, 2);
  87. //unit.form.mainfrm.OnCueline('<h4 style="font-family:arial;color: green;font-size:20px;">ok!</h4>');
  88. unit.form.mainfrm.OnCueline('ok!', 'green');
  89. }
  90. //The message corresponding callback executed by the docker pane.
  91. // when calling [side_pane].fireEvent(type,para) in the main form.
  92. function OnParentDockerMessage(type, para) {
  93. }
  94. //////////////////////////////////////////////////////////////////////////
  95. // Utils Functions.
  96. // 6c165ad6-ef3e-11ea-987c-b761a131c2fe
  97. function onDragFile(filepath) {
  98. }
  99. function PUI(cb) {
  100. if(pui){cb();}
  101. }
  102. /*Usage of BLOCK_EVENT
  103. BLOCK_EVENT(()=>{
  104. ui.[name].[var] = ...;
  105. });
  106. */
  107. function BLOCK_EVENT(cb) {
  108. ui.block_event = true;
  109. cb();
  110. ui.block_event = false;
  111. }
  112. //////////////////////////////////////////////////////////////////////////
  113. // template codes for cw callback js.
  114. function CW_DeclareVariable(name, setter, getter) {
  115. if(typeof(__DeclareVariable) === 'function') {
  116. __DeclareVariable(name, setter, getter);
  117. }
  118. }
  119. function CW_DeclareOuterVariable(name) {
  120. if(typeof(__DeclareOuterVariable) === 'function') {
  121. __DeclareOuterVariable(name);
  122. }
  123. }