TileViewListController.js
6.54 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
/// <reference path="../views/atlas-anatomy-detail.html" />
/// <reference path="../views/atlas-anatomy-detail.html" />
'use strict';
AIA.controller("TileViewListController", ["$scope", "$rootScope", "$compile", "$http", "$log", "$location", "BodyRegions", "BodySystems", "ViewOrientations", "ImageTypes", "$timeout", "Modules", "$routeParams", "DataService","ModuleService" ,
function ($scope, $rootScope, $compile, $http, $log, $location, BodyRegions, BodySystems, ViewOrientations, ImageTypes, $timeout, Modules, $routeParam, DataService,ModuleService)
{
var ATLAS_ANATOMY = 'Atlas Anatomy';
var CLINICAL_ILLUSTRATION ='Clinical Illustrations';
var CLINICAL_ANIMATION='Clinical Animations';
var moduleData = [];
$scope.AllBodyRegion = [];
$scope.AllBodySystem = [];
$scope.AllOrientation = [];
$scope.AllImageType = [];
$scope.moduleData = [];
$rootScope.moduleName;
$rootScope.OpenItemImageName;
$rootScope.OpenItemImagePath;
$scope.test;
$scope.loadForModuleById = function (moduleId) {
$scope.moduleId = moduleId;
console.log('loadForModuleById is called')
$rootScope.moduleName = Modules[moduleId].Name;
var promise = ModuleService.loadModuleDataBasedOnModuleName($scope.moduleName)
.then(
function (result) {
$scope.moduleLandingData = result;
console.log(JSON.stringify(result, null, 4));
},
function (error) {
// handle errors here
console.log(' error: ' + error.statusText);
}
)
},
$scope.scroll = function () {
$("html,body").scrollTop(0);
}
$scope.openModuleItem11 = function (event) {
alert('hi');
//// debugger;
var moduleItemDataToBeSaved = event.target.id;
var OpendTileData = [];
OpendTileData = ModuleService.GetOpenedTileData(moduleItemDataToBeSaved, $scope.moduleLandingData);
$location.url('/atlas-anatomy-detail');
}
$scope.openModuleItemView = function(event)
{
//alert('openModuleItemView is called')
var moduleItemDataToBeSaved = event.target.id;
var OpendTileData = [];
OpendTileData = ModuleService.GetOpenedTileData(moduleItemDataToBeSaved, $scope.moduleLandingData);
$rootScope.imageName = OpendTileData[3];
$rootScope.OpenItemImagePath = "../../../content/images/aa/images/" + OpendTileData[3];
//alert('img Name: ' +$scope.OpenItemImageName);
var u = $location.url();
$location.url('/module-item-view');
}
$scope.getImgUrl = function () {
alert('called...')
// $scope.myImgUrl = $rootScope.OpenItemImageName;
//alert('getImgurl: ' + $scope.myImgUrl);
}
$scope.openModuleItem = function (elSelector)
{
debugger;
alert($rootScope.OpenItemImageName);
var OpendTileData = [];
var url;
if ($rootScope.moduleName == ATLAS_ANATOMY)
{
url = 'app/views/aa/atlas-anatomy-detail.html';
$scope.test = url;
$scope.showAllPins();
}
else if ($rootScope.moduleName == CLINICAL_ANIMATION) {
//to do, in next phase of project
}
else if ($rootScope.moduleName == CLINICAL_ILLUSTRATION) {
//to do, in next phase of project
}
$.jsPanel({
id: 'ImagePanel',
selector: '.JsPannelContainer',
theme: 'success',
currentController: 'TileViewListController',
parentSlug: 'tile-view-list',
ajax: {
url: url
},
title: "AA page view",
position: {
top: 70,
left: 1,
},
size: { width: $(window).outerWidth() - 10, height: $(window).outerHeight() - 110 },
});
var jsElement = angular.element(document.getElementById("JsPannelContainer"));
$timeout(function () {
$compile(jsElement.contents())($scope);
if ($rootScope.moduleName == ATLAS_ANATOMY) {
$scope.addPinDataCanvas();
}
}, 250);
//document.getElementById('aaDetailPageDiv').appendChild(imgCanvas);
}
$scope.addPinDataCanvas = function()
{
//var pinDataCanvas = document.createElement('addPinDataCanvas');
//pinDataCanvas.id = "addPinDataCanvas";
//pinDataCanvas.height = 216;
//pinDataCanvas.width = 216;
//pinDataCanvas.style.position = "absolute";
//pinDataCanvas.style.left = 0 + "px";
//pinDataCanvas.style.top = 0 + "px";
////pinDataCanvas.style.background = "red";
////pinDataCanvas.style.border = "black 10px solid";
//var divReference = document.getElementById("imageDiv");
//divReference.appendChild(pinDataCanvas);
debugger;
var pinLength1 = Math.sqrt((638 - 604) * (638 - 604) + (83 - 120) * (83 - 120));
var pinLength = pinLength1.toPrecision(2);
var pinData = '<div class="pin" style="border:1px dashed #000;position:absolute;left:604px;top:120px;width:' + pinLength + 'px;"><div style="border:1px dashed #000;position:absolute;left:604px;"><img src="~/content/images/img181.png"/></div></div>';
// <div class="pin" style="border:1px dashed #000;position:absolute;left:604px;top:120px;width:50px;"><div style="/* border:1px dashed #000; */position:absolute;left: -22px;/* width: 0px; */top: -11px;"><img src="~/content/images/img181.png"></div></div>
// var divReference = document.getElementById("imageDiv");
// divReference.appendChild(pinData);
alert(pinData);
$("#imageDiv").append(pinData);
}
$scope.showAllPins = function ()
{
var promise = ModuleService.getPinDataForImage($rootScope.imageName)
.then(
function (result) {
$scope.aaPinData = result;
console.log(JSON.stringify(result, null, 4));
},
function (error) {
// handle errors here
console.log(' error: ' + error.statusText);
}
)
}
}]);