123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- ////////////////////////////////////////////////////////////////////////////
- // System Pre-define Functions
- // 95099372-ef3e-11ea-9c81-bf848405c62e
- //Callback of data preparation stage before UI is fully loaded.
- function OnInitializeData(reload, preview) {
-
- PUI(()=>{
- //you can access the 'ui' namespace in the parent form using the variable 'pui' here.
- //The 'pui' variable is valid in all functions of this document.
- //For robustness, you'd better use 'PUI(cb);' to access 'pui' variable.
-
- });
- }
- //Callback after UI is fully loaded and displayed.
- function OnReady(reload, preview) {
-
- PUI(()=>{
- //you can access the 'ui' namespace in the parent form using the variable 'pui' here.
- //The 'pui' variable is valid in all functions of this document.
- //For robustness, you'd better use 'PUI(cb);' to access 'pui' variable.
-
- });
- }
- function OnCloseForm() {
- }
- function OnException(err) {
- //ui.MessageBox('Error', '' + err, MessageBox.Icon.Critical, MessageBox.Button.Ok);
- }
- //////////////////////////////////////////////////////////////////////////
- // Callback Functions.
- // 641a254c-ef3e-11ea-bc8a-379bb908bdd7
- function OnStress(){
- unit.form.mainfrm.OnSend('Stress ' + model.getCurrentDirectory() + 'data');
- unit.form.mainfrm.OnChangePicture(5, 2);
- //unit.form.mainfrm.OnCueline('<h4 style="font-family:arial;color: green;font-size:20px;">恭喜您已完成压力云图的切换!</h4>');
- unit.form.mainfrm.OnCueline('您已完成压力云图的切换!', 'green');
-
- }
- function OnMaxMin(){
- var id = parent.setTimeout(() => {
- unit.form.mainfrm.OnSend('0');
- }, 100);
- unit.form.mainfrm.OnSend('minmax');
- }
- function OnPointCloud(){
- var id = parent.setTimeout(() => {
- unit.form.mainfrm.OnSend('0');
- }, 100);
- unit.form.mainfrm.OnSend('pointCloud');
- }
- var tubiao = false;
- function OnTuBiao(){
- /*tubiao = !tubiao;
- if(tubiao === true){
- unit.form.mainfrm.OnSend('scalarBar true false');
- }else{
- unit.form.mainfrm.OnSend('closeScalarBar');
- }*/
- var id = parent.setTimeout(() => {
- unit.form.mainfrm.OnSend('0');
- }, 100);
- unit.form.mainfrm.OnSend('scalarBar true false');
- unit.form.mainfrm.OnChangePicture(5, 2);
- //unit.form.mainfrm.OnCueline('<h4 style="font-family:arial;color: green;font-size:20px;">恭喜您完成颜色条的开闭!</h4>');
- unit.form.mainfrm.OnCueline('您完成颜色条的开闭!', 'green');
- }
- function OnReset(){
- var id = parent.setTimeout(() => {
- unit.form.mainfrm.OnSend('0');
- }, 100);
- unit.form.mainfrm.OnSend('reset');
- }
- function OnChangeAttribute(){
- if(ui.attribute.index !== 4){
- unit.form.mainfrm.OnSend('attribute ' + (ui.attribute.index + 1));
- }else if(ui.attribute.index === 4){
- unit.form.mainfrm.OnSend('attribute 9');
- }
- //unit.form.mainfrm.OnSend('attribute ' + (ui.attribute.index + 1));
- unit.form.mainfrm.OnChangePicture(5, 2);
- //unit.form.mainfrm.OnCueline('<h4 style="font-family:arial;color: green;font-size:20px;">恭喜您已完成位移云图的切换!</h4>');
- unit.form.mainfrm.OnCueline('您已完成位移云图的切换!', 'green');
- //unit.form.mainfrm.OnSend('scalarBar true true');
- }
- function OnReturnMenu(){
- unit.form.mainfrm.menu(8);
- }
- function OnLoad(){
- //unit.form.mainfrm.OnChangeWindows(2);
- unit.form.mainfrm.OnSend('Renderer ' + model.getCurrentDirectory() + '/data');
- unit.form.mainfrm.OnChangePicture(5, 2);
- //unit.form.mainfrm.OnCueline('<h4 style="font-family:arial;color: green;font-size:20px;">ok!</h4>');
- unit.form.mainfrm.OnCueline('ok!', 'green');
- }
- //The message corresponding callback executed by the docker pane.
- // when calling [side_pane].fireEvent(type,para) in the main form.
- function OnParentDockerMessage(type, para) {
- }
- //////////////////////////////////////////////////////////////////////////
- // Utils Functions.
- // 6c165ad6-ef3e-11ea-987c-b761a131c2fe
- function onDragFile(filepath) {
- }
- function PUI(cb) {
- if(pui){cb();}
- }
- /*Usage of BLOCK_EVENT
- BLOCK_EVENT(()=>{
- ui.[name].[var] = ...;
- });
- */
- function BLOCK_EVENT(cb) {
- ui.block_event = true;
-
- cb();
-
- ui.block_event = false;
- }
- //////////////////////////////////////////////////////////////////////////
- // template codes for cw callback js.
- function CW_DeclareVariable(name, setter, getter) {
- if(typeof(__DeclareVariable) === 'function') {
- __DeclareVariable(name, setter, getter);
- }
- }
- function CW_DeclareOuterVariable(name) {
- if(typeof(__DeclareOuterVariable) === 'function') {
- __DeclareOuterVariable(name);
- }
- }
|