ModuleService.js
4.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
var ATLAS_ANATOMY = 'Atlas Anatomy';
var CLINICAL_ILLUSTRATION = 'Clinical Illustrations';
var CLINICAL_ANIMATION = 'Clinical Animations';
var OpenedModuleItemList = [];
var ModDetail = [];
var moduleData;
var modName;
AIA.service('ModuleService', function($http, DataService) {
return {
loadModuleDataBasedOnModuleName: function(moduleName) {
var jsonPath;
modName = moduleName;
//debugger;
if (moduleName == ATLAS_ANATOMY) {
jsonPath = '~/../content/data/json/aa/aa_dat_contentlist.json';
}
else if (moduleName == CLINICAL_ANIMATION) {
//to do, in next phase of project
jsonPath = '~/../content/data/json/ca/ca_dat_contentlist.json';
}
else if (moduleName == CLINICAL_ILLUSTRATION) {
//to do, in next phase of project
jsonPath = '~/../content/data/json/ci/ci_dat_contentlist.json';
}
return $http.get(jsonPath, function (response) {
moduleData = new jinqJs()
.from(response.data.root.Item)
// .orderBy([{field: '_Title', sort: 'asc' }])
.select();
// console.log(JSON.stringify(response, null, 4));
// response.data= moduleData;
// return response.data;
return moduleData;
});
},
GetOpenedTileData: function (id,moduleJson) {
if (modName == ATLAS_ANATOMY)
{
//debugger;
var AADataForSelectedItem = [];
var title = id;
var selectedTileData = new jinqJs()
.from(moduleJson.data.root.Item)
.where("_Title == " + title)
.select();
AADataForSelectedItem.push(selectedTileData[0]._ImageId);
AADataForSelectedItem.push(selectedTileData[0]._BodyRegion);
AADataForSelectedItem.push(selectedTileData[0]._BodySystem);
AADataForSelectedItem.push(selectedTileData[0]._ImageName);
AADataForSelectedItem.push(selectedTileData[0]._ImageType);
AADataForSelectedItem.push(selectedTileData[0]._TileImageName);
AADataForSelectedItem.push(selectedTileData[0]._Title);
AADataForSelectedItem.push("ViewOrientation: " + selectedTileData[0]._ViewOrientation);
return AADataForSelectedItem;
}
},
getPinDataForImage: function (imageName)
{
var pindataFileNamePart1 = imageName.replace("aa_img_", "");
var pinFileNamePart2 = pindataFileNamePart1.replace(".jpg", "");
var pinDatajsonPath = '~/../content/data/json/aa/aa_pindata/aa_dat_pindata_' + pinFileNamePart2 + '.json';
return $http.get(pinDatajsonPath, function (response) {
var pinData = new jinqJs()
.from(response.data.Root.Item)
.select();
// alert(pinData.Root.Item);
return pinData;
});
},
getTermTextDataForPin: function (moduleName) {
var jsonPath;
if (moduleName == ATLAS_ANATOMY) {
jsonPath = '~/../content/data/json/aa/aa_dat_term.json';
}
return $http.get(jsonPath, function (response) {
var termdata = new jinqJs()
.from(response.data.Terms.Term)
.select();
// alert(pinData.Root.Item);
return termdata;
});
},
getTermTextDataForAAImage: function (imageId) {
var jsonPath = '~/../content/data/json/aa/aa_pinterm/aa_dat_pinterm_' + imageId + '.json';
return $http.get(jsonPath, function (response) {
var termdata = new jinqJs()
.from(response.data.Terms.Term)
.select();
return termdata;
});
},
};
});