OSDN Git Service

create doc/readme.txt
[vem/vem.git] / test / view / mds / js / model.js
1 // model
2 var model = {
3   webSocket: null,
4   currentPicture: null,
5   EMParams: {
6               stage: {x: null, y: null, z: null},
7               mag  : null,
8               spotsize : null,
9               intensity: null,
10               beamShift: {x: null, y: null},
11               defocus: null,
12               imageSize: null,
13               exptime: null,
14               binning: null
15             },
16   MDSParams: {
17                search  : {mag: 21, spotsize:6},
18                focus   : {mag: 31, spotsize:4},
19                exposure: {mag: 31, spotsize:5}
20              },
21   searchCameraParams: {
22                         full: {imageSize: 0, binning: 4, exptime: 0.07},
23                         half: {imageSize: 1, binning: 4, exptime: 0.07}
24                 },
25   exposeCameraParams: {
26                   imageSize: null,
27                   binning: null,
28                   exptime: null
29                 },
30   fixXYParams: {
31                  x: 0, y: 0
32                },
33   getParams: function(data){
34                console.log("getParams");
35                console.log(data);
36                var params = JSON.parse(data);
37                console.log(params);
38                model.EMParams.stage    = params.stage;
39                model.EMParams.mag      = params.proj.magIndex;
40                model.EMParams.spotsize = params.ill.spotSizeIndex;
41                model.EMParams.beamShift = params.proj.beamShift;
42                model.EMParams.defocus  = params.proj.defocus;
43                model.EMParams.imageSize = params.ccdCamera.imageSize;
44                model.EMParams.exptime  = params.ccdCamera.expTime;
45                model.EMParams.binning  = params.ccdCamera.binning;
46              },
47  setExposeCameraParams: function(){
48                      model.exposeCameraParams.imageSize = $('#size').val();
49                      model.exposeCameraParams.binning   = $('#binning').val();
50                      model.exposeCameraParams.exptime   = 1/(model.exposeCameraParams.binning*model.exposeCameraParams.binning);
51                    },
52   setFixXYParams: function(){
53                     model.fixXYParams.x = $('#fixXStage').val();
54                     model.fixXYParams.y = $('#fixYStage').val();
55                   },
56   updateEMParams: function(response, item){
57                     var data = JSON.parse(response);
58                     model.EMParams[item] = data[item];
59                   }
60 }