Commit 47a6b3f53ca01f4b18b35b1e48d5c43382133be1

Authored by Nikita Kulshreshtha
2 parents 9e600dfd 06cddfd0

commit

400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
... ... @@ -46,8 +46,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
46 46 $scope.previousSelectedTermList = [];
47 47  
48 48  
49   -
50   - $scope.machedBodyRegion = [];
  49 + // This variable is used for unhighlight previously highlighted body portion, if multiAnnotation is false.
  50 + $scope.machedIcolorInBodyRegion = [];
51 51  
52 52 //array for bodyviewid correspoing to male female(used for gender change)
53 53 $scope.correspondingBodyViewIds = {
... ... @@ -860,6 +860,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
860 860  
861 861 FlipedImgCanvas.addEventListener('click', function (evt) {
862 862  
  863 + if (evt.ctrlKey) {
  864 + $scope.multiAnnotationIsON = true;
  865 + }
  866 + else {
  867 + $scope.multiAnnotationIsON = false;
  868 + }
863 869  
864 870 //get mouse coordinate of mirror image click
865 871 var mousePos = $scope.getMousePos(evt);
... ... @@ -922,24 +928,57 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
922 928 var RGBColor = (Red + Green + Blue);
923 929  
924 930 if ($rootScope.isHighLight) {
925   - //2. Find Actul Term No Based on Icolor.
926   - var ActualTermNo = $scope.getActualTermNumber(RGBColor);
927   - //alert('actual term no: ' + ActualTermNo);
  931 + ////2. Find Actul Term No Based on Icolor.
  932 + //var ActualTermNo = $scope.getActualTermNumber(RGBColor);
  933 + ////alert('actual term no: ' + ActualTermNo);
  934 +
  935 + ////3. Find Term No List Based on ActualTermNo
  936 + //var TermList = $scope.getTermNumberList(ActualTermNo);
  937 + //// alert('termList.count: ' + TermList.length);
  938 +
  939 + ////4.
928 940  
929   - //3. Find Term No List Based on ActualTermNo
930   - var TermList = $scope.getTermNumberList(ActualTermNo);
931   - // alert('termList.count: ' + TermList.length);
  941 + //$scope.machedTermNoLocation = [];
  942 + //for (var i = 0; i < TermList.length; i++) {
  943 +
  944 + // var termNumber = parseInt(TermList[i]._TermNumber);
932 945  
933   - //4.
  946 + // //Match Term No List in each bodyRegion
  947 + // $scope.getLocationsForMatchedTermsInWholeBody(termNumber);
  948 + //}
934 949  
935   - $scope.machedTermNoLocation = [];
936   - for (var i = 0; i < TermList.length; i++) {
  950 + if ($scope.machedIcolorInBodyRegion.length > 0) {
  951 + if ($scope.multiAnnotationIsON == false) {
  952 + for (var i = 0; i < $scope.machedIcolorInBodyRegion.length; i++) {
  953 + var bodyRegionId = $scope.machedIcolorInBodyRegion[i];
937 954  
938   - var termNumber = parseInt(TermList[i]._TermNumber);
  955 + var grayCanvasID = 'imageCanvas' + bodyRegionId;
  956 + var grayCanvas = document.getElementById(grayCanvasID);
  957 +
  958 + var grayCanvasContext = grayCanvas.getContext("2d");
  959 +
  960 + var grayImageData = $rootScope.grayImageDataList[bodyRegionId - 1];
  961 +
  962 + grayCanvasContext.putImageData(grayImageData, 0, 0)
939 963  
940   - //Match Term No List in each bodyRegion
941   - $scope.getLocationsForMatchedTermsInWholeBody(termNumber);
  964 + // for mirrored canvas
  965 +
  966 + if (bodyRegionId == 4 || bodyRegionId == 5 || bodyRegionId == 6) {
  967 + var grayCanvasID = 'imageCanvas' + bodyRegionId + '_MR';
  968 + var grayCanvasMR = document.getElementById(grayCanvasID);
  969 +
  970 + var grayCanvasContextMR = grayCanvasMR.getContext("2d");
  971 +
  972 + var grayImageDataMR = $rootScope.grayImageMRDataList[bodyRegionId];
  973 +
  974 + grayCanvasContextMR.putImageData(grayImageDataMR, 0, 0)
  975 + }
  976 +
  977 + }
  978 + }
942 979 }
  980 +
  981 + $scope.highLightBodyBasedOnIcolor(RGBColor);
943 982 }
944 983  
945 984  
... ... @@ -954,8 +993,13 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
954 993  
955 994 }
956 995 else {
957   - if ($('#speechBubble').length > 0) {
958   - $('#speechBubble').remove();
  996 +
  997 + if ($('#dot').length > 0) {
  998 + $('#dot').remove();
  999 + }
  1000 +
  1001 + if ($('#sppeachBubble').length > 0) {
  1002 + $('#sppeachBubble').remove();
959 1003  
960 1004  
961 1005 $scope.createDynamicSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top);
... ... @@ -1051,6 +1095,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1051 1095 imgCanvas.style.zIndex = "500";
1052 1096 }
1053 1097 }
  1098 +
1054 1099 imgCanvas.addEventListener('click', function (evt) {
1055 1100  
1056 1101 if (evt.ctrlKey) {
... ... @@ -1097,10 +1142,14 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1097 1142 var RGBColor = $scope.GetRGBColor(maskCanvasContext, actulalX, actualY, x, y);
1098 1143  
1099 1144 if ($rootScope.isHighLight) {
1100   - if ($scope.machedBodyRegion.length > 0) {
1101   - if ($scope.multiAnnotationIsON == false) {
1102   - for (var i = 0; i < $scope.machedBodyRegion.length; i++) {
1103   - var bodyRegionId = $scope.machedBodyRegion[i];
  1145 +
  1146 + if ($scope.machedIcolorInBodyRegion.length > 0)
  1147 + {
  1148 + if ($scope.multiAnnotationIsON == false)
  1149 + {
  1150 + for (var i = 0; i < $scope.machedIcolorInBodyRegion.length; i++)
  1151 + {
  1152 + var bodyRegionId = $scope.machedIcolorInBodyRegion[i];
1104 1153  
1105 1154 var grayCanvasID = 'imageCanvas' + bodyRegionId;
1106 1155 var grayCanvas = document.getElementById(grayCanvasID);
... ... @@ -1111,6 +1160,18 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1111 1160  
1112 1161 grayCanvasContext.putImageData(grayImageData, 0, 0)
1113 1162  
  1163 + // for unhighlight the mirrored body region
  1164 + if (bodyRegionId == 4 || bodyRegionId == 5 || bodyRegionId == 6) {
  1165 + var grayCanvasID = 'imageCanvas' + bodyRegionId + '_MR';
  1166 + var grayCanvasMR = document.getElementById(grayCanvasID);
  1167 +
  1168 + var grayCanvasContextMR = grayCanvasMR.getContext("2d");
  1169 +
  1170 + var grayImageDataMR = $rootScope.grayImageMRDataList[bodyRegionId];
  1171 +
  1172 + grayCanvasContextMR.putImageData(grayImageDataMR, 0, 0)
  1173 + }
  1174 +
1114 1175 }
1115 1176 }
1116 1177 }
... ... @@ -1147,7 +1208,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1147 1208 }
1148 1209  
1149 1210 else {
1150   - $scope.highLightBodyBasedOnIcolor(RGBColor);
  1211 + // $scope.highLightBodyBasedOnIcolor(RGBColor);
1151 1212  
1152 1213 ////2. Find Actul Term No Based on Icolor.
1153 1214 //var ActualTermNo = $scope.getActualTermNumber(RGBColor);
... ... @@ -1210,8 +1271,13 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1210 1271  
1211 1272 }
1212 1273 else {
1213   - if ($('#speechBubble').length > 0) {
1214   - $('#speechBubble').remove();
  1274 + if ($('#dot').length > 0) {
  1275 + $('#dot').remove();
  1276 +
  1277 + if ($('#sppeachBubble').length > 0) {
  1278 + $('#sppeachBubble').remove();
  1279 + }
  1280 +
1215 1281  
1216 1282  
1217 1283 $scope.createDynamicSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top);
... ... @@ -1245,7 +1311,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1245 1311  
1246 1312 }
1247 1313  
1248   - $scope.highLightBodyBasedOnIcolor = function (RGBColor) {
  1314 + $scope.highLightBodyBasedOnIcolor = function (RGBColor)
  1315 + {
1249 1316  
1250 1317 //2. Find Actul Term No Based on Icolor.
1251 1318 var ActualTermNo = $scope.getActualTermNumber(RGBColor);
... ... @@ -1298,7 +1365,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1298 1365 }
1299 1366 var maskCanvas = document.getElementById(maskCanvasID);
1300 1367 var maskCanvasContext = maskCanvas.getContext("2d");
1301   - debugger;
1302 1368 var maskImgData = maskCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight);
1303 1369  
1304 1370 // 2. get coloured canvas for this body region.
... ... @@ -1388,11 +1454,11 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1388 1454 if (parseInt(termNo) == parseInt(Icolor)) {
1389 1455  
1390 1456 counter++;
1391   - var have = $scope.machedBodyRegion.indexOf(bodyRegionId);
  1457 + var have = $scope.machedIcolorInBodyRegion.indexOf(bodyRegionId);
1392 1458  
1393 1459  
1394 1460 if (have == -1) {
1395   - $scope.machedBodyRegion.push(bodyRegionId);
  1461 + $scope.machedIcolorInBodyRegion.push(bodyRegionId);
1396 1462 }
1397 1463 else {
1398 1464  
... ... @@ -1720,7 +1786,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1720 1786  
1721 1787 $(".com").css("display", "none");
1722 1788 $("#bord").css({ "width": "0px", "display": "none" });
1723   - $('<div style="position:absolute;height:15px;width:35px;display:none;border-top:2px solid #000;transform:rotate(40deg);-moz-transform:rotate(40deg);-o-transform:rotate(40deg);-ms-transform:rotate(40deg);-webkit-transform:rotate(40deg);" id="dot"></div>'
  1789 +
  1790 + $('<div id="dot" style="position:absolute;height:15px;width:35px;display:none;border-top:2px solid #000;transform:rotate(40deg);-moz-transform:rotate(40deg);-o-transform:rotate(40deg);-ms-transform:rotate(40deg);-webkit-transform:rotate(40deg);"></div>'
1724 1791 + '<div id="sppeachBubble" style="height:auto!important;z-index:10000;margin-left:25px;border:1px solid #000;display:none;padding:5px 10px;width:200px;position:absolute;color:#000;text-align:left;font-size:12px;background-color:#fff;font-weight:bold;"><span>' + text + '</span>'
1725 1792 + '<span style="position:absolute;right:-4px;top:-4px;color:#ffffff;cursor:pointer;">'
1726 1793 + '<img class="crossDiv_temp" src="/AIA/content/images/speeachBubbleClose.png"></span></div>'
... ... @@ -3157,6 +3224,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
3157 3224 img.src = dataURL;
3158 3225  
3159 3226  
  3227 +
3160 3228 img.onload = function () {
3161 3229 console.log(Math.max(img.width) + ', ' + Math.max(img.height))
3162 3230  
... ... @@ -3192,13 +3260,14 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
3192 3260  
3193 3261 $rootScope.grayImageDataList[parseInt(value.bodyRegionId - 1)] = grayImageData;
3194 3262 }
3195   - }
  3263 + }
  3264 + })
3196 3265  
3197   - });
  3266 + }
3198 3267  
3199 3268 // alert('length: '+ $scope.coloredImageCanvasList.length);
3200 3269  
3201   - }
  3270 +
3202 3271  
3203 3272 if ($scope.previousSelectedTermList.length > 0) {
3204 3273 for (var i = 0; i < $scope.previousSelectedTermList.length; i++) {
... ...
400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js.orig
... ... @@ -13,7 +13,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
13 13 $scope.isTransparencyActivated;
14 14 $scope.BodyLayerData;
15 15 $scope.VocabTermData;
  16 + $scope.CommonData
16 17 $scope.TermNumberData;
  18 + $rootScope.BodySystemData
17 19 $scope.bodyViewId = 0;
18 20 $scope.bgartData;
19 21 //view specific constants
... ... @@ -27,10 +29,31 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
27 29 $scope.TBDrawStartX;
28 30 $scope.TBDrawStartY;
29 31  
30   - $scope.isHighLight = false;
31   - $scope.coloredImageCanvasList = [];
  32 + $rootScope.isHighLight = false;
  33 + $rootScope.coloredImageCanvasList = [];
  34 + $rootScope.coloredImageMRCanvasList = [];
  35 +
  36 + $rootScope.grayImageDataList = [];
  37 + $rootScope.grayImageMRDataList = [];
32 38  
33 39 $scope.zoomInOut = 75;
  40 + $scope.i = 0;
  41 + $scope.speachBubbleArray = [];
  42 + $scope.multiAnnotationIsON = true;
  43 + $scope.previousGrayImageDataVar;
  44 + $scope.previousGrayCanvas;
  45 +
  46 + $scope.previousSelectedTermList = [];
  47 +
  48 +<<<<<<< HEAD
  49 +
  50 +
  51 + $scope.machedBodyRegion = [];
  52 +=======
  53 +
  54 + // This variable is used for unhighlight previously highlighted body portion, if multiAnnotation is false.
  55 + $scope.machedIcolorInBodyRegion = [];
  56 +>>>>>>> 06cddfd0f16578a9c42e80367bb28ee0cede2c3e
34 57  
35 58 //array for bodyviewid correspoing to male female(used for gender change)
36 59 $scope.correspondingBodyViewIds = {
... ... @@ -136,7 +159,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
136 159  
137 160 }
138 161  
139   - $scope.imagePath = "~/../content/images/DA/"+$scope.zoomInOut +"/body-views/" + value._id + '/skintone/' + userEthnicity + '/' + thumbnailImage;
  162 + $scope.imagePath = "~/../content/images/DA/" + $scope.zoomInOut + "/body-views/" + value._id + '/skintone/' + userEthnicity + '/' + thumbnailImage;
140 163 // debugger;
141 164  
142 165 var $el = $('<div id=' + value._id + ' class="col-sm-3 col-lg-2" title = ' + value._title + ' data-ng-click="openView($event)"><div class="thumbnail" >'
... ... @@ -176,45 +199,43 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
176 199  
177 200 $rootScope.ClearIframe();
178 201  
179   -<<<<<<< HEAD
180   - //load body-views data
181   -=======
182   - //load body-view data
183   ->>>>>>> f02adb91be9d04918a612b7ac16241017c20e360
184   - $http({ method: 'GET', url: '~/../content/data/json/da/da_dat_contentlist.json' }).success(function (data) {
  202 + //load common data
  203 + var commondataJsonPath = '~/../content/data/json/da/da_dat_common.json';
185 204  
186   - $scope.BodyViewData = data;
187   - //load default body view list for male
188   - $scope.getDAViewList();
  205 + DataService.getAnotherJson(commondataJsonPath)
  206 + .then(
  207 + function (result) {
189 208  
190   - })
  209 + $rootScope.CommonData = result;
  210 + $http({ method: 'GET', url: '~/../content/data/json/da/da_dat_contentlist.json' }).success(function (data) {
  211 +
  212 + $scope.BodyViewData = data;
  213 + //load default body view list for male
  214 + $scope.getDAViewList();
  215 +
  216 + })
191 217 .error(function (data, status, headers, config) {
192 218 console.log(data);
193 219 });
194 220  
195 221  
  222 + },
  223 + function (error) {
  224 + console.log(error.statusText)
  225 + }
  226 + )
  227 + //load body-views data
  228 +
  229 +
196 230 // $('#daLoaderLabel').css('visibility', 'hidden')
197 231 $rootScope.isLoading = false;
198 232  
199   - $http({ method: 'GET', url: '~/../content/data/json/da_dat_tm_sg_1.json' }).success(function (data) {
200   - $scope.TermNumberData = data;
201   -
202   - })
203   - .error(function (data, status, headers, config) {
204   - console.log(data);
205   - });
206 233  
207 234  
208   - //load vocabterm data
209   - $http({ method: 'GET', url: '~/../content/data/json/cm_dat_vocabterm_1.json' }).success(function (data) {
210   - $scope.VocabTermData = data;
211   - })
212   - .error(function (data, status, headers, config) {
213   - console.log(data);
214   - });
215   -
216 235 //push the details of open module in array $rootScope.openModules
217 236 $rootScope.openModules.push({ "ModuleId": 1 });
  237 +
  238 +
218 239 }
219 240  
220 241  
... ... @@ -310,7 +331,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
310 331 selector: '.daBodyView',
311 332 theme: 'success',
312 333 currentController: 'DAController',
313   - parentSlug:'da-view-list',
  334 + parentSlug: 'da-view-list',
314 335 ajax: {
315 336 url: 'app/views/da/da-view.html'
316 337 },
... ... @@ -327,7 +348,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
327 348  
328 349  
329 350 // $rootScope.openViewsDA.push({ "ViewId": 1 });
330   - $rootScope.currentSlug = 'da-body-views';
  351 + $rootScope.currentSlug = 'da-body-view';
331 352  
332 353 //hide scrollbar
333 354  
... ... @@ -377,9 +398,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
377 398 })
378 399  
379 400  
380   -
381   -
382   -
383 401 $scope.LoadDefaultLayerImage = function () {
384 402 // debugger;
385 403  
... ... @@ -622,7 +640,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
622 640 //multiple conditions are not working in where clause of JinQ so need multiple filtered variables
623 641 if (dtlOfSktn.length > 0) {
624 642  
625   - if ((parseInt(dtlOfSktn[0]._lns) <= parseInt($scope.layerNumber)) && (parseInt(dtlOfSktn[0]._lne) >= parseInt($scope.layerNumber)) && (dtlOfSktn[0]._isfr == 'Y')) {
  643 + if ((parseInt(dtlOfSktn[0]._lns) <= parseInt($scope.layerNumber)) && (parseInt(dtlOfSktn[0]._lne) > parseInt($scope.layerNumber)) && (dtlOfSktn[0]._isfr == 'Y')) {
626 644 $scope.figLaefImageName = dtlOfSktn[0]._ImageId;
627 645 //$scope.figLaefX = filtereddata[0]._X;
628 646 //$scope.figLaefY = filtereddata[0]._Y;
... ... @@ -630,11 +648,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
630 648 var rectangle = scaleRectangle(value._X, value._Y, value._Height, value._Width, value._MirrorValue);
631 649  
632 650  
633   -<<<<<<< HEAD
634   - var src = "content/images/DA/body-views/" + $scope.voId + "/layers/0/" + value._BodyRegionId + "/" + $scope.figLaefImageName;
635   -=======
636   - var src = "content/images/da/body-views/" + $scope.voId + "/layers/0/" + value._BodyRegionId + "/" + $scope.figLaefImageName;
637   ->>>>>>> f02adb91be9d04918a612b7ac16241017c20e360
  651 + var src = "content/images/DA/" + $scope.zoomInOut + "/body-views/" + $scope.voId + "/layers/0/" + value._BodyRegionId + "/" + $scope.figLaefImageName;
638 652  
639 653 $scope.DrawImage(rectangle.scaledHeight, rectangle.scaledWidth, rectangle.scaledX, rectangle.scaledY, src, 'modestyImg' + value._BodyRegionId, 'N')
640 654  
... ... @@ -673,11 +687,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
673 687 // $('#canvasDiv').scrollLeft($scope.imageHorizontlScrollPosition)
674 688 $('#canvasDiv').scrollTop(50)
675 689 var abc = $scope.BodyRegionCordinatesData;
676   -<<<<<<< HEAD
677 690 //debugger;
678   -=======
679   - // debugger;
680   ->>>>>>> f02adb91be9d04918a612b7ac16241017c20e360
681 691 $('#layerChangeSlider').slider("option", "value", parseInt($scope.totalLayers) - parseInt($scope.layerNumber));
682 692 // $('#spinner').css('visibility', 'hidden');
683 693 $rootScope.isLoading = false;
... ... @@ -740,11 +750,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
740 750  
741 751 //set max for LayerNumber input
742 752 $scope.totalLayers = dataLength - 1;
743   -<<<<<<< HEAD
744 753 // debugger
745   -=======
746   - // debugger
747   ->>>>>>> f02adb91be9d04918a612b7ac16241017c20e360
748 754 $('#txtLayerNumber').attr('max', $scope.totalLayers);
749 755 $('#layerChangeSlider').slider("option", "max", $scope.totalLayers);
750 756 // $('#layerChangeSlider').slider("option", "value",parseInt($scope.totalLayers)-parseInt($scope.layerNumber));
... ... @@ -764,7 +770,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
764 770  
765 771 if (bodyRegion == bodyRegionId && bodyRegionSkinTone == $scope.skinTone) {
766 772  
767   - return "content/images/DA/"+$scope.zoomInOut +"/body-views/" + $scope.voId + "/layers/" + $scope.layerNumber + "/" + bodyRegionId + "/" + $scope.skinTone + "/" + SelectedLayerData.BodyRegion[z].Image._ImageName;
  773 + return "content/images/DA/" + $scope.zoomInOut + "/body-views/" + $scope.voId + "/layers/" + $scope.layerNumber + "/" + bodyRegionId + "/" + $scope.skinTone + "/" + SelectedLayerData.BodyRegion[z].Image._ImageName;
768 774 }
769 775 }
770 776 }
... ... @@ -786,7 +792,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
786 792 if (bodyRegion == bodyRegionId) {
787 793  
788 794 return "content/images/DA/" + $scope.zoomInOut + "/body-views/" + $scope.voId + "/layers/" + $scope.layerNumber + "/" + bodyRegionId + "/" + SelectedLayerData.BodyRegion[z].Image._ImageName;
789   -
  795 +
790 796  
791 797 }
792 798 }
... ... @@ -822,7 +828,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
822 828 for (var z = 0; z <= $scope.bagartDetailsOnSktn.length; z++) {
823 829 var gender = $scope.bagartDetailsOnSktn[z]._Gender;
824 830 if (gender == selectedGender) {
825   - return "content/images/DA/"+$scope.zoomInOut+"/body-views/" + $scope.voId + "/layers/0/" + bodyRegionId + "/" + $scope.skinTone + "/" + $scope.bagartDetailsOnSktn[z]._ImageId;
  831 + return "content/images/DA/" + $scope.zoomInOut + "/body-views/" + $scope.voId + "/layers/0/" + bodyRegionId + "/" + $scope.skinTone + "/" + $scope.bagartDetailsOnSktn[z]._ImageId;
826 832 }
827 833 }
828 834 }
... ... @@ -843,6 +849,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
843 849 FlipedImgCanvas.style.left = x + "px";
844 850 FlipedImgCanvas.style.top = y + "px";
845 851  
  852 +
  853 +
846 854 if (isMaskImage == 'Y') {
847 855 FlipedImgCanvas.id = 'imageCanvas' + bodyRegionId + '_MR_mci';
848 856 FlipedImgCanvas.style.visibility = 'hidden'
... ... @@ -853,21 +861,35 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
853 861 FlipedImgCanvas.style.visibility = 'visible'
854 862  
855 863 }
  864 +
  865 +
  866 +
856 867 FlipedImgCanvas.addEventListener('click', function (evt) {
857 868  
  869 +<<<<<<< HEAD
  870 +
  871 +=======
  872 + if (evt.ctrlKey) {
  873 + $scope.multiAnnotationIsON = true;
  874 + }
  875 + else {
  876 + $scope.multiAnnotationIsON = false;
  877 + }
  878 +
  879 +>>>>>>> 06cddfd0f16578a9c42e80367bb28ee0cede2c3e
858 880 //get mouse coordinate of mirror image click
859 881 var mousePos = $scope.getMousePos(evt);
860   - //alert(mousePos.x + ',' + mousePos.y);
861 882  
862 883 var context = FlipedImgCanvas.getContext("2d");
863 884 var canvasId = context.canvas.getAttribute('id');
864 885  
  886 +
865 887 var mirrorCanvasX = context.canvas.offsetLeft;
866 888 var mirrorCanvasWidth = context.canvas.clientWidth;
867 889  
868 890 var maskCanvasId = (canvasId.replace('_MR', '')) + '_mci';
869 891 var maskCanvas = document.getElementById(maskCanvasId);
870   - var canvasContextForRGB = maskCanvas.getContext("2d");
  892 + var maskCanvasContext = maskCanvas.getContext("2d");
871 893  
872 894  
873 895 var canvasDiv = document.getElementById('canvasDiv');
... ... @@ -876,15 +898,13 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
876 898  
877 899 var distanceXOnMirrorImage = (parseInt(mirrorCanvasX) + parseInt(mirrorCanvasWidth)) - (parseInt(mousePos.x) + horizontlScrollPosition);// - 135);
878 900  
879   - var mirrorXOnNormalImage = parseInt(canvasContextForRGB.canvas.offsetLeft) + parseInt(distanceXOnMirrorImage);
  901 + var mirrorXOnNormalImage = parseInt(maskCanvasContext.canvas.offsetLeft) + parseInt(distanceXOnMirrorImage);
880 902  
881 903 var actulalX = mirrorXOnNormalImage
882 904 var actualY = mousePos.y + verticalScrollPosition
883 905  
884 906  
885   -
886   -
887   - var pixelData = canvasContextForRGB.getImageData(Math.round(actulalX - parseInt(canvasContextForRGB.canvas.offsetLeft)), Math.round(actualY - y), 1, 1);
  907 + var pixelData = maskCanvasContext.getImageData(Math.round(actulalX - parseInt(maskCanvasContext.canvas.offsetLeft)), Math.round(actualY - y), 1, 1);
888 908  
889 909 pixelData.data[0] = pixelData.data[0] - 9;
890 910 pixelData.data[1] = pixelData.data[1] - 9;
... ... @@ -917,23 +937,90 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
917 937 }
918 938 var RGBColor = (Red + Green + Blue);
919 939  
  940 + if ($rootScope.isHighLight) {
  941 + ////2. Find Actul Term No Based on Icolor.
  942 + //var ActualTermNo = $scope.getActualTermNumber(RGBColor);
  943 + ////alert('actual term no: ' + ActualTermNo);
  944 +
  945 + ////3. Find Term No List Based on ActualTermNo
  946 + //var TermList = $scope.getTermNumberList(ActualTermNo);
  947 + //// alert('termList.count: ' + TermList.length);
  948 +
  949 + ////4.
  950 +
  951 + //$scope.machedTermNoLocation = [];
  952 + //for (var i = 0; i < TermList.length; i++) {
  953 +
  954 + // var termNumber = parseInt(TermList[i]._TermNumber);
  955 +
  956 + // //Match Term No List in each bodyRegion
  957 + // $scope.getLocationsForMatchedTermsInWholeBody(termNumber);
  958 + //}
  959 +
  960 + if ($scope.machedIcolorInBodyRegion.length > 0) {
  961 + if ($scope.multiAnnotationIsON == false) {
  962 + for (var i = 0; i < $scope.machedIcolorInBodyRegion.length; i++) {
  963 + var bodyRegionId = $scope.machedIcolorInBodyRegion[i];
  964 +
  965 + var grayCanvasID = 'imageCanvas' + bodyRegionId;
  966 + var grayCanvas = document.getElementById(grayCanvasID);
  967 +
  968 + var grayCanvasContext = grayCanvas.getContext("2d");
  969 +
  970 + var grayImageData = $rootScope.grayImageDataList[bodyRegionId - 1];
  971 +
  972 + grayCanvasContext.putImageData(grayImageData, 0, 0)
  973 +
  974 + // for mirrored canvas
  975 +
  976 + if (bodyRegionId == 4 || bodyRegionId == 5 || bodyRegionId == 6) {
  977 + var grayCanvasID = 'imageCanvas' + bodyRegionId + '_MR';
  978 + var grayCanvasMR = document.getElementById(grayCanvasID);
  979 +
  980 + var grayCanvasContextMR = grayCanvasMR.getContext("2d");
  981 +
  982 + var grayImageDataMR = $rootScope.grayImageMRDataList[bodyRegionId];
  983 +
  984 + grayCanvasContextMR.putImageData(grayImageDataMR, 0, 0)
  985 + }
  986 +
  987 + }
  988 + }
  989 + }
  990 +
  991 + $scope.highLightBodyBasedOnIcolor(RGBColor);
  992 + }
  993 +
920 994  
921 995 var annotationText = $scope.GetAnnotationText(parseInt(RGBColor));
922 996  
923 997 if ($('#speechBubbleTrns').length > 0)
924 998 $('#speechBubbleTrns').remove();
925 999  
926   - if ($('#speechBubble').length > 0) {
927   - $('#speechBubble').remove();
  1000 + if ($scope.multiAnnotationIsON == true) {
928 1001  
929   - $scope.createSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50)
  1002 + $scope.createDynamicSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top);
930 1003  
931 1004 }
932   - else
933   - $scope.createSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50)
  1005 + else {
  1006 +
  1007 + if ($('#dot').length > 0) {
  1008 + $('#dot').remove();
  1009 + }
  1010 +
  1011 + if ($('#sppeachBubble').length > 0) {
  1012 + $('#sppeachBubble').remove();
  1013 +
934 1014  
  1015 + $scope.createDynamicSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top);
  1016 + }
  1017 + else {
  1018 +
  1019 + $scope.createDynamicSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top);
  1020 + }
935 1021  
936 1022  
  1023 + }
937 1024 }, false);
938 1025  
939 1026 FlipedImgCanvas.addEventListener('mousedown', function (evt) {
... ... @@ -983,7 +1070,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
983 1070  
984 1071 $scope.DrawImage = function (h, w, x, y, src, bodyRegionId, isMaskImage) {
985 1072  
986   - // debugger;
987 1073 var imgCanvas = document.createElement('canvas');
988 1074 // imgCanvas.style.backgroundColor = 'red';
989 1075 imgCanvas.height = h;
... ... @@ -1015,14 +1101,21 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1015 1101 //set z index to make leaf canvas on top of hip canavs
1016 1102 imgCanvas.style.zIndex = "200";
1017 1103 }
1018   - if ($scope.voId == 11 && bodyRegionId == 6) {
  1104 + if (($scope.voId == 11 || $scope.voId == 9) && bodyRegionId == 6) {
1019 1105 imgCanvas.style.zIndex = "500";
1020 1106 }
1021 1107 }
1022   - imgCanvas.addEventListener('click', function (evt) {
1023 1108  
  1109 + imgCanvas.addEventListener('click', function (evt) {
1024 1110  
  1111 + if (evt.ctrlKey) {
  1112 + $scope.multiAnnotationIsON = true;
  1113 + }
  1114 + else {
  1115 + $scope.multiAnnotationIsON = false;
  1116 + }
1025 1117  
  1118 + var annotationText;
1026 1119 var context = imgCanvas.getContext("2d");
1027 1120  
1028 1121  
... ... @@ -1036,9 +1129,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1036 1129 maskCanvasId = canvasId + '_mci';
1037 1130 }
1038 1131 var maskCanvas = document.getElementById(maskCanvasId);
1039   - var canvasContextForRGB = maskCanvas.getContext("2d");
1040   -
  1132 + var maskCanvasContext = maskCanvas.getContext("2d");
1041 1133  
  1134 + //if ($scope.zoomInOut == 25) {
  1135 + // var mousePos = $scope.getMousePos1(evt);
  1136 + //}
  1137 + //else
1042 1138 var mousePos = $scope.getMousePos(evt);
1043 1139 // alert(mousePos.x + ',' + mousePos.y);
1044 1140  
... ... @@ -1051,14 +1147,123 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1051 1147 var actulalX = mousePos.x + horizontlScrollPosition;
1052 1148 var actualY = mousePos.y + verticalScrollPosition;
1053 1149  
1054   - //debugger;
1055   - var RGBColor = $scope.GetRGBColor(canvasContextForRGB, actulalX, actualY, x, y);
1056   - var annotationText;
1057 1150  
  1151 +
  1152 + var RGBColor = $scope.GetRGBColor(maskCanvasContext, actulalX, actualY, x, y);
  1153 +
  1154 +<<<<<<< HEAD
  1155 + if ($rootScope.isHighLight) {
  1156 + if ($scope.machedBodyRegion.length > 0) {
  1157 + if ($scope.multiAnnotationIsON == false) {
  1158 + for (var i = 0; i < $scope.machedBodyRegion.length; i++) {
  1159 + var bodyRegionId = $scope.machedBodyRegion[i];
  1160 +=======
  1161 + if ($rootScope.isHighLight)
  1162 + {
  1163 + if ($scope.machedIcolorInBodyRegion.length > 0)
  1164 + {
  1165 + if ($scope.multiAnnotationIsON == false)
  1166 + {
  1167 + for (var i = 0; i < $scope.machedIcolorInBodyRegion.length; i++)
  1168 + {
  1169 + var bodyRegionId = $scope.machedIcolorInBodyRegion[i];
  1170 +>>>>>>> 06cddfd0f16578a9c42e80367bb28ee0cede2c3e
  1171 +
  1172 + var grayCanvasID = 'imageCanvas' + bodyRegionId;
  1173 + var grayCanvas = document.getElementById(grayCanvasID);
  1174 +
  1175 + var grayCanvasContext = grayCanvas.getContext("2d");
  1176 +
  1177 + var grayImageData = $rootScope.grayImageDataList[bodyRegionId - 1];
  1178 +
  1179 + grayCanvasContext.putImageData(grayImageData, 0, 0)
  1180 +
  1181 + // for unhighlight the mirrored body region
  1182 + if (bodyRegionId == 4 || bodyRegionId == 5 || bodyRegionId == 6) {
  1183 + var grayCanvasID = 'imageCanvas' + bodyRegionId + '_MR';
  1184 + var grayCanvasMR = document.getElementById(grayCanvasID);
  1185 +
  1186 + var grayCanvasContextMR = grayCanvasMR.getContext("2d");
  1187 +
  1188 + var grayImageDataMR = $rootScope.grayImageMRDataList[bodyRegionId];
  1189 +
  1190 + grayCanvasContextMR.putImageData(grayImageDataMR, 0, 0)
  1191 + }
  1192 +
  1193 + }
  1194 + }
  1195 + }
  1196 +
  1197 + // var IcolorWithCordinate = new Object;
  1198 + var previousIcolor = RGBColor;
  1199 + //var previousX;
  1200 + // var previousY;
  1201 +
  1202 + //IcolorWithCordinate.previousIcolor= RGBColor;
  1203 + // IcolorWithCordinate.previousX = x;
  1204 + // IcolorWithCordinate.previousY = y;
  1205 +
  1206 + $scope.previousSelectedTermList.push(previousIcolor);
  1207 +
  1208 + $scope.highLightBodyBasedOnIcolor(RGBColor);
  1209 +
  1210 + //var ActualTermNo = $scope.getActualTermNumber(RGBColor);
  1211 + ////3. Find Term No List Based on ActualTermNo
  1212 + //var TermList = $scope.getTermNumberList(ActualTermNo);
  1213 + //// alert('termList.count: ' + TermList.length);
  1214 +
  1215 + ////4.
  1216 +
  1217 + //$scope.machedTermNoLocation = [];
  1218 + //for (var i = 0; i < TermList.length; i++) {
  1219 +
  1220 + // var termNumber = parseInt(TermList[i]._TermNumber);
  1221 +
  1222 + // //Match Term No List in each bodyRegion
  1223 + // $scope.getLocationsForMatchedTermsInWholeBody(termNumber, x, y);
  1224 + //}
  1225 +
  1226 + }
  1227 +
  1228 + else {
  1229 + $scope.highLightBodyBasedOnIcolor(RGBColor);
  1230 +
  1231 +<<<<<<< HEAD
  1232 + ////2. Find Actul Term No Based on Icolor.
  1233 + //var ActualTermNo = $scope.getActualTermNumber(RGBColor);
  1234 +=======
  1235 + else
  1236 + {
  1237 + // $scope.highLightBodyBasedOnIcolor(RGBColor);
  1238 +>>>>>>> 06cddfd0f16578a9c42e80367bb28ee0cede2c3e
  1239 +
  1240 + ////3. Find Term No List Based on ActualTermNo
  1241 + //var TermList = $scope.getTermNumberList(ActualTermNo);
  1242 +
  1243 +
  1244 + ////4.
  1245 +
  1246 + //$scope.machedTermNoLocation = [];
  1247 + //for (var i = 0; i < TermList.length; i++) {
  1248 +
  1249 + // var termNumber = parseInt(TermList[i]._TermNumber);
  1250 +
  1251 + // //Match Term No List in each bodyRegion
  1252 + // $scope.getLocationsForMatchedTermsInWholeBody(termNumber, x, y);
  1253 + //}
  1254 + }
  1255 +
  1256 +
  1257 +
  1258 +
  1259 + //Modesty ON
1058 1260 if (maskCanvasId.match('modestyImg') && RGBColor != '000000') {
1059 1261 RGBColor = DA[0].figLeafTermId;
1060 1262 annotationText = $scope.GetAnnotationBasedOnActualTermNo(RGBColor);
1061 1263 }
  1264 + //Modesty On but clicked somewhre else, we did modesty check because the modesty image covers whole body region so if user will click to
  1265 + //see the annotation apart from leaf then the actual click will be on modesty canvas, but for annotation er
  1266 + //
1062 1267 else if (maskCanvasId.match('modestyImg') && RGBColor == '000000') {
1063 1268 //if ($scope.voId == 11) {
1064 1269 // maskCanvasId = 'imageCanvas6_mci';
... ... @@ -1070,66 +1275,263 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1070 1275 maskCanvasId = 'imageCanvas' + bodyRegionId + '_mci';
1071 1276 // }
1072 1277 var maskCanvas = document.getElementById(maskCanvasId);
1073   - var canvasContextForRGB = maskCanvas.getContext("2d");
1074   - RGBColor = $scope.GetRGBColor(canvasContextForRGB, actulalX, actualY, x, y);
  1278 + var maskCanvasContext = maskCanvas.getContext("2d");
  1279 + RGBColor = $scope.GetRGBColor(maskCanvasContext, actulalX, actualY, x, y);
1075 1280 annotationText = $scope.GetAnnotationText(parseInt(RGBColor));
1076 1281 }
1077 1282 else {
1078   - RGBColor = $scope.GetRGBColor(canvasContextForRGB, actulalX, actualY, x, y);
  1283 + RGBColor = $scope.GetRGBColor(maskCanvasContext, actulalX, actualY, x, y);
1079 1284 annotationText = $scope.GetAnnotationText(parseInt(RGBColor));
1080 1285  
1081 1286 }
1082 1287  
  1288 +
1083 1289 if ($('#speechBubbleTrns').length > 0)
1084 1290 $('#speechBubbleTrns').remove();
1085 1291  
1086   - if ($('#speechBubble').length > 0) {
1087   - $('#speechBubble').remove();
  1292 + if ($scope.multiAnnotationIsON == true) {
1088 1293  
1089   - $scope.createSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50)
  1294 + $scope.createDynamicSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top);
1090 1295  
1091 1296 }
1092   - else
1093   - $scope.createSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50)
  1297 + else {
  1298 + if ($('#dot').length > 0) {
  1299 + $('#dot').remove();
1094 1300  
  1301 + if ($('#sppeachBubble').length > 0) {
  1302 + $('#sppeachBubble').remove();
  1303 + }
  1304 +
1095 1305  
1096   - }, false);
1097 1306  
  1307 + $scope.createDynamicSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top);
  1308 + }
  1309 + else {
1098 1310  
  1311 + $scope.createDynamicSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top);
  1312 + }
1099 1313  
1100 1314  
  1315 + }
  1316 + }, false);
  1317 +
1101 1318 var PI = Math.PI;
1102 1319 var PI2 = PI * 2;
1103 1320 var cw, ch, imgW, imgH, mouseX, mouseY;
1104 1321 var scaleFactor = 1.00;
1105 1322  
1106   - //$scaler = $("#scaler");
1107   - //$scaler.val(scaleFactor);
1108   - //$scaler.hide();
1109   -
1110 1323 var context = imgCanvas.getContext('2d');
1111 1324 var img = new Image();
1112 1325 img.onload = start;
1113 1326  
1114 1327 img.src = src;
1115   - // img.src = img.src = "~/../content/images/" + src;
1116   -
1117 1328  
1118 1329 function start() {
1119 1330 // debugger;
1120 1331 context.drawImage(img, 0, 0);
1121 1332 };
1122   - // $('#daLoaderLabel').css('visibility', 'visible')
1123   -
1124   - // $rootScope.isLoading = true;
1125 1333  
1126 1334 document.getElementById('canvasDiv').appendChild(imgCanvas);
1127 1335  
1128 1336 }
1129 1337  
1130   - $scope.GetRGBColor = function (canvasContextForRGB, actulalX, actualY, x, y) {
  1338 + $scope.highLightBodyBasedOnIcolor = function (RGBColor) {
  1339 +
  1340 + //2. Find Actul Term No Based on Icolor.
  1341 + var ActualTermNo = $scope.getActualTermNumber(RGBColor);
  1342 +
  1343 + //3. Find Term No List Based on ActualTermNo
  1344 + var TermList = $scope.getTermNumberList(ActualTermNo);
  1345 +
  1346 +
  1347 + //4.
  1348 +
  1349 + $scope.machedTermNoLocation = [];
  1350 + for (var i = 0; i < TermList.length; i++) {
  1351 +
  1352 + var termNumber = parseInt(TermList[i]._TermNumber);
  1353 +
  1354 + //Match Term No List in each bodyRegion
  1355 + $scope.getLocationsForMatchedTermsInWholeBody(termNumber);
  1356 + }
  1357 + }
  1358 +
  1359 + $scope.getLocationsForMatchedTermsInWholeBody = function (termNo) {
  1360 +
  1361 + for (var x = 0; x < $scope.ColoredImageSRC.length; x++) {
  1362 + // alert('called for bodyRegionId: ' + $scope.MaskImageSRC[x].bodyRegionId);
  1363 + var bodyRegionId = $scope.ColoredImageSRC[x].bodyRegionId;
  1364 +
  1365 + {
  1366 + var scaledWidth = $scope.ColoredImageSRC[x].Width;
  1367 + var scaledHeight = $scope.ColoredImageSRC[x].Height;
  1368 + //var maskImg = $scope.ColoredImageSRC[x].SRC;
  1369 +
  1370 +
  1371 + var coloredImg = $scope.ColoredImageSRC[x].SRC;
  1372 +
  1373 + var maskImg = $scope.GetMaskImageSource(coloredImg);
  1374 +
  1375 +
  1376 + var scledX = $scope.ColoredImageSRC[x].x;
  1377 + var scledY = $scope.ColoredImageSRC[x].y;
  1378 +
  1379 +
  1380 + // 1. get mask canvas for this body region.
  1381 + var maskCanvasID;
  1382 + if ($scope.ColoredImageSRC[x].haveMirror == 'true') {
  1383 + maskCanvasID = 'imageCanvas' + bodyRegionId + '_MR_mci';
  1384 + }
  1385 + else {
  1386 + maskCanvasID = 'imageCanvas' + bodyRegionId + '_mci';
  1387 +
  1388 + }
  1389 + var maskCanvas = document.getElementById(maskCanvasID);
  1390 + var maskCanvasContext = maskCanvas.getContext("2d");
  1391 + debugger;
  1392 + var maskImgData = maskCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight);
  1393 +
  1394 + // 2. get coloured canvas for this body region.
  1395 +
  1396 +
  1397 + var coloredImageDataVar;
  1398 + var coloredImageDataMRVar
  1399 +
  1400 + if ($scope.ColoredImageSRC[x].haveMirror == 'true') {
  1401 +
  1402 + coloredImageDataVar = $rootScope.coloredImageMRCanvasList[parseInt(bodyRegionId)];
  1403 + }
  1404 + else {
  1405 + coloredImageDataVar = $rootScope.coloredImageCanvasList[parseInt(bodyRegionId - 1)];
  1406 + }
  1407 + var grayImageDataVar;
  1408 + var grayCanvas;
  1409 + if ($scope.ColoredImageSRC[x].haveMirror == 'true') {
  1410 +
  1411 + //// 3. get mask canvas for this body region._MR
  1412 + var grayCanvasID = 'imageCanvas' + bodyRegionId + '_MR';
  1413 + grayCanvas = document.getElementById(grayCanvasID);
  1414 + var grayCanvasContext = grayCanvas.getContext("2d");
  1415 + var grayImageData = grayCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight);
  1416 + grayImageDataVar = grayImageData.data;
  1417 + }
  1418 +
  1419 + else {
  1420 + var grayCanvasID = 'imageCanvas' + bodyRegionId;
  1421 + grayCanvas = document.getElementById(grayCanvasID);
  1422 + var grayCanvasContext = grayCanvas.getContext("2d");
  1423 + var grayImageData = grayCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight);
  1424 + grayImageDataVar = grayImageData.data;
  1425 + }
  1426 +
  1427 + var coloredImageDataVarMR;
  1428 + var coloredImageDataMR
  1429 +
  1430 +
  1431 + var counter = 0;
  1432 +
  1433 + var imageDataVar = maskImgData.data;
  1434 +
  1435 + // var previousBRID;
  1436 +
  1437 + var counter = 0;
  1438 +
  1439 +
  1440 + var n = maskImgData.data.length;
  1441 +
  1442 + for (var i = 0; i < n; i += 4) {
  1443 +
  1444 +
  1445 + var RED = imageDataVar[i] - 9;
  1446 + var GREEN = imageDataVar[i + 1] - 9;
  1447 + var BLUE = imageDataVar[i + 2] - 9;
  1448 +
  1449 + var Red;
  1450 + var Green;
  1451 + var Blue;
  1452 + var zero = "0";
  1453 +
  1454 + if ((RED).toString().length != 2) {
  1455 + Red = zero.concat((RED).toString())
  1456 + }
  1457 + else {
  1458 + Red = (RED).toString()
  1459 + }
  1460 + if ((GREEN).toString().length != 2) {
  1461 + Green = zero.concat((GREEN).toString())
  1462 + }
  1463 + else {
  1464 + Green = (GREEN).toString()
  1465 +
  1466 + }
  1467 + if ((BLUE).toString().length != 2) {
  1468 + Blue = zero.concat((BLUE).toString())
  1469 + }
  1470 + else {
  1471 + Blue = (BLUE).toString()
  1472 +
  1473 + }
  1474 +
  1475 + var Icolor = (Red + Green + Blue);
  1476 + // alert('Icolor: ' + Icolor)
  1477 +
  1478 + if (parseInt(termNo) == parseInt(Icolor)) {
  1479 +
  1480 + counter++;
  1481 + var have = $scope.machedIcolorInBodyRegion.indexOf(bodyRegionId);
  1482 +
  1483 +
  1484 +<<<<<<< HEAD
  1485 + if (have == -1) {
  1486 + $scope.machedBodyRegion.push(bodyRegionId);
  1487 +=======
  1488 + if (have == -1)
  1489 + {
  1490 + $scope.machedIcolorInBodyRegion.push(bodyRegionId);
  1491 +>>>>>>> 06cddfd0f16578a9c42e80367bb28ee0cede2c3e
  1492 + }
  1493 + else {
  1494 +
  1495 + }
  1496 +
  1497 +
  1498 + //previousGrayColoredData = i;
  1499 + if (coloredImageDataVar != null) {
  1500 +
  1501 +
  1502 + var RED_coloredImage = coloredImageDataVar[i];
  1503 +
  1504 + grayImageDataVar[i] = RED_coloredImage;
  1505 +
  1506 +
  1507 + var GREEN_coloredImage = coloredImageDataVar[i + 1];
  1508 + grayImageDataVar[i + 1] = GREEN_coloredImage;
  1509 +
  1510 + var BLUE_coloredImage = coloredImageDataVar[i + 2];
  1511 + grayImageDataVar[i + 2] = BLUE_coloredImage;
  1512 +
  1513 +
  1514 + var ALPHA_coloredImage = coloredImageDataVar[i + 3];
  1515 + grayImageDataVar[i + 3] = ALPHA_coloredImage;
  1516 +
  1517 +
  1518 + }
  1519 +
  1520 + }
  1521 +
  1522 +
  1523 + }
  1524 +
  1525 + grayCanvasContext.putImageData(grayImageData, 0, 0);
  1526 + }
  1527 + }
  1528 +
  1529 +
  1530 + }
  1531 +
  1532 + $scope.GetRGBColor = function (maskCanvasContext, actulalX, actualY, x, y) {
1131 1533  
1132   - var pixelData = canvasContextForRGB.getImageData(Math.round(actulalX - x), Math.round(actualY - y), 1, 1);
  1534 + var pixelData = maskCanvasContext.getImageData(Math.round(actulalX - x), Math.round(actualY - y), 1, 1);
1133 1535  
1134 1536 pixelData.data[0] = pixelData.data[0] - 9;
1135 1537 pixelData.data[1] = pixelData.data[1] - 9;
... ... @@ -1218,6 +1620,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1218 1620  
1219 1621 //layer change function
1220 1622 $scope.LayerChange = function () {
  1623 + // alert('layer chnage')
  1624 +
1221 1625 var canvasDiv = document.getElementById('canvasDiv');
1222 1626 $scope.imageVerticalScrollPosition = canvasDiv.scrollTop;
1223 1627 $scope.imageHorizontlScrollPosition = canvasDiv.scrollLeft;
... ... @@ -1228,6 +1632,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1228 1632  
1229 1633  
1230 1634 if ($scope.isTransparencyActivated) {
  1635 +
1231 1636 //crete temp canavs to store the original data which will be used to chnange the transparency
1232 1637 if (document.getElementById('tempCanvas') != null) {
1233 1638 $('#tempCanvas').remove();
... ... @@ -1281,6 +1686,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1281 1686 // alert(' $.each(BodyRegionDictionary3. bodyRegionRight: ' + bodyRegionRight + ', bodyRegionBottom: ' + bodyRegionBottom)
1282 1687 if (TransparencyBoxStartX <= bodyRegionRight && value.X <= transparencyBoxRight && TransparencyBoxStartY <= bodyRegionBottom && value.Y <= transparencyBoxBottom) {
1283 1688 //var transNumber = parseInt(document.getElementById("txtTransparencyChange").value);
  1689 + // debugger;
1284 1690 $scope.layerNumber = parseInt(txtlayerNumber.value);
1285 1691  
1286 1692  
... ... @@ -1292,6 +1698,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1292 1698 }
1293 1699  
1294 1700 else {
  1701 + $scope.currentLayerNumber = parseInt($('#txtlayerNumber').val());
1295 1702  
1296 1703 $rootScope.isLoading = true;
1297 1704 $('#spinner').css('visibility', 'visible');
... ... @@ -1317,6 +1724,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1317 1724  
1318 1725 $timeout(function () { $scope.highLightBody() }, 350);
1319 1726  
  1727 +
  1728 +
1320 1729 }
1321 1730  
1322 1731 }
... ... @@ -1330,7 +1739,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1330 1739 //alert('Disabled wait cursor is done.See val :' + $rootScope.isLoading);
1331 1740 }
1332 1741  
1333   -
  1742 +
1334 1743 $scope.changeLayer = function () {
1335 1744 console.log('changeLayer');
1336 1745 // alert('slide')
... ... @@ -1353,6 +1762,175 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1353 1762 }
1354 1763 }
1355 1764  
  1765 + $scope.createDynamicSpeechBubble = function (event, text, x, y) {
  1766 +
  1767 + if (event.ctrlKey) {
  1768 +
  1769 + $scope.multiAnnotationIsON = true;
  1770 +
  1771 + $scope.i = $scope.i + 1;
  1772 + // var a = $("#sppeachBubble").find('span').html();
  1773 + // alert(a);
  1774 + var sub_id = "black" + $scope.i;
  1775 + $("#canvasDiv").append("<div class='com'><div style='position:absolute;border-top:2px solid #000;transform:rotate(40deg);-moz-transform:rotate(40deg);-o-transform:rotate(40deg);-ms-transform:rotate(40deg);-webkit-transform:rotate(40deg);height:15px;width:35px;left:" + (x - 10) + "px;top:" + (y + 10) + "px;'' id='bubble" + $scope.i + "'></div><div data=" + $scope.i + " id=" + sub_id + " class='appendDragg' style='z-index:10000;margin-left:25px;border:1px solid #000;padding:5px 10px;width:200px;position:absolute;color:#000;text-align:left;font-size: 12px;background-color:#fff;font-weight:bold;left:" + x + "px;top:" + y + "px;'>" + text + "<div style='z-index:7000;position:absolute;right:-4px;top:-4px;color:#ffffff;cursor:pointer;'><img id=" + $scope.i + " class='dynCross' src='/AIA/content/images/speeachBubbleClose.png'></div></div><div style='position:absolute;border:1px solid #000;display:none;z-index:9000;' id='bord" + $scope.i + "'></div></div>");
  1776 +
  1777 +
  1778 + $scope.speachBubbleArray.push({ xaxis: x, yaxis: y, ids: sub_id });
  1779 +
  1780 + $('.appendDragg').draggable({
  1781 + drag: function (evt) {
  1782 + $(this).prev('div').css("display", "none");
  1783 + var bor_id = $(this).next('div').attr('id');
  1784 + var sub_id1 = $(this).attr('id');
  1785 + var verticalScrollPosition = canvasDiv.scrollTop;
  1786 + var horizontlScrollPosition = canvasDiv.scrollLeft;
  1787 + for (var m = 0; m <= $scope.speachBubbleArray.length - 1; m++) {
  1788 + if ($scope.speachBubbleArray[m].ids == sub_id1) {
  1789 +
  1790 + $scope.angle1($scope.speachBubbleArray[m].xaxis, $scope.speachBubbleArray[m].yaxis, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, bor_id);
  1791 + break;
  1792 +
  1793 + }
  1794 + }
  1795 +
  1796 + },
  1797 + });
  1798 +
  1799 +
  1800 +
  1801 + $('.dynCross').on('click', function (evt) {
  1802 + $(this).parent().parent().parent().css('display', 'none');
  1803 +
  1804 + // $("#bord").css("display", "none");
  1805 + // $("#dot").css("display", "none");
  1806 +
  1807 +
  1808 + });
  1809 +
  1810 +
  1811 + }
  1812 +
  1813 +
  1814 + else {
  1815 + $scope.multiAnnotationIsON = false;
  1816 +
  1817 + $(".com").css("display", "none");
  1818 + $("#bord").css({ "width": "0px", "display": "none" });
  1819 +<<<<<<< HEAD
  1820 + $('<div style="position:absolute;height:15px;width:35px;display:none;border-top:2px solid #000;transform:rotate(40deg);-moz-transform:rotate(40deg);-o-transform:rotate(40deg);-ms-transform:rotate(40deg);-webkit-transform:rotate(40deg);" id="dot"></div>'
  1821 + + '<div id="sppeachBubble" style="height:auto!important;z-index:10000;margin-left:25px;border:1px solid #000;display:none;padding:5px 10px;width:200px;position:absolute;color:#000;text-align:left;font-size:12px;background-color:#fff;font-weight:bold;"><span>' + text + '</span>'
  1822 +=======
  1823 +
  1824 + $('<div id="dot" style="position:absolute;height:15px;width:35px;display:none;border-top:2px solid #000;transform:rotate(40deg);-moz-transform:rotate(40deg);-o-transform:rotate(40deg);-ms-transform:rotate(40deg);-webkit-transform:rotate(40deg);"></div>'
  1825 + + '<div id="sppeachBubble" style="height:auto!important;z-index:10000;margin-left:25px;border:1px solid #000;display:none;padding:5px 10px;width:200px;position:absolute;color:#000;text-align:left;font-size:12px;background-color:#fff;font-weight:bold;"><span>'+text+'</span>'
  1826 +>>>>>>> 06cddfd0f16578a9c42e80367bb28ee0cede2c3e
  1827 + + '<span style="position:absolute;right:-4px;top:-4px;color:#ffffff;cursor:pointer;">'
  1828 + + '<img class="crossDiv_temp" src="/AIA/content/images/speeachBubbleClose.png"></span></div>'
  1829 +
  1830 + + '<div style="position:absolute;border:1px solid #000;display:none;z-index:9000;" id="bord">'
  1831 + + '</div>').appendTo('#canvasDiv');
  1832 + var Globe = [];
  1833 + Globe.push({ currentX: x, currentY: y });
  1834 +
  1835 + document.getElementById('dot').style.display = 'block';
  1836 + document.getElementById('dot').style.left = ((Globe[0].currentX) - 10) + 'px';
  1837 + document.getElementById('dot').style.top = ((Globe[0].currentY) + 10) + 'px';
  1838 + document.getElementById('sppeachBubble').style.display = 'block';
  1839 + document.getElementById('sppeachBubble').style.left = (Globe[0].currentX) + 'px';
  1840 + document.getElementById('sppeachBubble').style.top = (Globe[0].currentY) + 'px';
  1841 +
  1842 + $('#sppeachBubble').draggable(
  1843 + {
  1844 + drag: function (evt) {
  1845 +
  1846 + $("#dot").css("display", "none");
  1847 + var verticalScrollPosition = canvasDiv.scrollTop;
  1848 + var horizontlScrollPosition = canvasDiv.scrollLeft;
  1849 + $scope.angle(x, y, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top);
  1850 +
  1851 +
  1852 + },
  1853 + });
  1854 +
  1855 +
  1856 + $('.crossDiv_temp').on('click', function (evt) {
  1857 + $('#sppeachBubble').css('display', 'none');
  1858 +
  1859 + $("#bord").css("display", "none");
  1860 + $("#dot").css("display", "none");
  1861 +
  1862 +
  1863 + });
  1864 +
  1865 + }
  1866 +
  1867 +
  1868 + }
  1869 +
  1870 + $scope.angle1 = function (cx1, cy1, ex1, ey1, id, id2) {
  1871 +
  1872 + console.log(cx1 + " " + cy1);
  1873 + var dy = ey1 - cy1;
  1874 + var dx = ex1 - cx1;
  1875 + var theta = 0;
  1876 + if (dx < 0) {
  1877 + theta = Math.atan(dy / dx) * (180 / Math.PI);
  1878 + theta = theta + 180;
  1879 +
  1880 + }
  1881 + else if (dy < 0) {
  1882 + theta = Math.atan(dy / dx) * (180 / Math.PI);
  1883 + theta = theta + 360;
  1884 +
  1885 + }
  1886 + else {
  1887 + theta = Math.atan(dy / dx) * (180 / Math.PI);
  1888 + }
  1889 +
  1890 + var g = Math.sqrt((cx1 - ex1) * (cx1 - ex1) + (cy1 - ey1) * (cy1 - ey1));
  1891 + var e = cy1 - 19;
  1892 + var f = cx1;
  1893 +
  1894 + $('#' + id).css({ 'display': 'block', 'width': g + 'px', 'top': e + 'px', 'left': f + 'px', 'transform': 'rotate(' + theta + 'deg)', '-moz-transform': 'rotate(' + theta + 'deg)', '-webkit-transform': 'rotate(' + theta + 'deg)', 'transform-origin': '0% 0%' });
  1895 +
  1896 + }
  1897 +
  1898 + function myFunction(crossId) {
  1899 + alert(crossId);
  1900 + $('#' + crossId).parent().parent().parent().css("display", "none");
  1901 +
  1902 + }
  1903 +
  1904 +
  1905 + $scope.angle = function (cx, cy, ex, ey) {
  1906 +
  1907 +
  1908 + var dy = ey - cy;
  1909 + var dx = ex - cx;
  1910 + var theta = 0;
  1911 + if (dx < 0) {
  1912 + theta = Math.atan(dy / dx) * (180 / Math.PI);
  1913 + theta = theta + 180;
  1914 +
  1915 + }
  1916 + else if (dy < 0) {
  1917 + theta = Math.atan(dy / dx) * (180 / Math.PI);
  1918 + theta = theta + 360;
  1919 +
  1920 + }
  1921 + else {
  1922 + theta = Math.atan(dy / dx) * (180 / Math.PI);
  1923 + }
  1924 +
  1925 + var d = Math.sqrt((cx - ex) * (cx - ex) + (cy - ey) * (cy - ey));
  1926 + var e = cy;
  1927 + var f = cx;
  1928 +
  1929 + $("#bord").css({ 'display': 'block', 'width': d + 'px', 'top': e + 'px', 'left': f + 'px', 'transform': 'rotate(' + theta + 'deg)', '-moz-transform': 'rotate(' + theta + 'deg)', '-webkit-transform': 'rotate(' + theta + 'deg)', 'transform-origin': '0% 0%' });
  1930 +
  1931 +
  1932 + }
  1933 +
1356 1934  
1357 1935 $scope.createSpeechBubble = function (event, text, x, y) {
1358 1936 //set z index to make annoation speech buble on top others
... ... @@ -1363,7 +1941,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1363 1941 //+'<div class="bottomRightArrow"></div><div class="topLeftArrow"></div><div class="topRightArrow"></div>
1364 1942 + '</div></div></div>').appendTo('#canvasDiv');
1365 1943  
1366   - $('#speechBubble').on('click', '.BubbleCloseBtn', function (e) {
  1944 + $('#speechBubble').on('click', '.BubbleCloseBtn', function (evt) {
1367 1945 $('#speechBubble').css('display', 'none');
1368 1946 });
1369 1947  
... ... @@ -1374,6 +1952,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1374 1952  
1375 1953  
1376 1954 $scope.createTransparencyBox = function () {
  1955 +
1377 1956 // debugger
1378 1957 // alert('transparency clcked')
1379 1958  
... ... @@ -1471,6 +2050,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1471 2050 // $selection.remove();
1472 2051 // debugger;
1473 2052  
  2053 + $scope.currentLayerNumber = parseInt($('#txtlayerNumber').val());
1474 2054 $('.rectangle').remove();
1475 2055  
1476 2056 var currentMousePosition = $scope.getMousePos(e);
... ... @@ -1608,6 +2188,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1608 2188 $('#btnTranparency').removeClass('btn-black');
1609 2189  
1610 2190 $('#btnTranparency').addClass('tButtonActive');
  2191 + //debugger;
  2192 + $('#txtlayerNumber').val((parseInt($scope.currentLayerNumber)) + 1);
1611 2193 }
1612 2194  
1613 2195 $scope.loadTransparencyImage = function (bodyRegionId, Height, Width, X, Y, IsMirror, TransparencyBoxStartX, TransparencyEndX, TransparencyBoxStartY, TransparencyBoxEndY, scope, isLayerChanged, isTransparencyChanged) {
... ... @@ -1751,7 +2333,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1751 2333 //do nothing
1752 2334 }
1753 2335 else if (isLayerChanged) {
  2336 + // debugger
1754 2337 $scope.layerNumber = parseInt($('#txtlayerNumber').val());
  2338 +
1755 2339 }
1756 2340 else {
1757 2341 var currentLayer = parseInt($('#txtlayerNumber').val());
... ... @@ -2004,7 +2588,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2004 2588 PreviousBodyRegionX = XforTransImage;
2005 2589 previousBodyRegionId = bodyRegionId;
2006 2590  
2007   - $scope.layerNumber = parseInt($scope.layerNumber - 1);
  2591 + // $scope.layerNumber = parseInt($scope.layerNumber - 1);
2008 2592  
2009 2593 }
2010 2594  
... ... @@ -2014,6 +2598,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2014 2598  
2015 2599  
2016 2600  
  2601 +
2017 2602 function resizeCanvas() {
2018 2603 //debugger;
2019 2604 // alert('reload')
... ... @@ -2227,10 +2812,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2227 2812  
2228 2813 var clickedCanvasMaskId = 'imageCanvas' + clickedBodyRegion + '_mci';
2229 2814 var maskCanvas = document.getElementById(clickedCanvasMaskId);
2230   - var canvasContextForRGB = maskCanvas.getContext("2d");
  2815 + var maskCanvasContext = maskCanvas.getContext("2d");
2231 2816 var imgX = Math.round(actulalX - parseInt(x.replace('px', '')));
2232 2817 var imgY = Math.round(actualY - parseInt(y.replace('px', '')));
2233   - pixelData = canvasContextForRGB.getImageData(imgX, imgY, 1, 1);
  2818 + pixelData = maskCanvasContext.getImageData(imgX, imgY, 1, 1);
2234 2819  
2235 2820  
2236 2821 //trans layer image data
... ... @@ -2262,14 +2847,14 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2262 2847  
2263 2848 var clickedCanvasMaskId = 'imageCanvas' + clickedBodyRegion + '_mci';
2264 2849 var maskCanvas = document.getElementById(clickedCanvasMaskId);
2265   - var canvasContextForRGB = maskCanvas.getContext("2d");
  2850 + var maskCanvasContext = maskCanvas.getContext("2d");
2266 2851  
2267 2852 //transparecncy canvas
2268 2853 var maskCanvasTransId = 'transparencyTempCanvasMask_' + clickedBodyRegion + '_mci';
2269 2854 var maskCanvastrans = document.getElementById(maskCanvasTransId);
2270 2855 var maskCanvasContexttrans = maskCanvastrans.getContext("2d");
2271 2856  
2272   - pixelData = canvasContextForRGB.getImageData(Math.round(actulalX - x), Math.round(actualY - y), 1, 1);
  2857 + pixelData = maskCanvasContext.getImageData(Math.round(actulalX - x), Math.round(actualY - y), 1, 1);
2273 2858  
2274 2859 pixelDataTrans = maskCanvasContexttrans.getImageData(Math.round(actulalX - x), Math.round(actualY - y), 1, 1);
2275 2860 var annotations = $scope.getAnnotationForTransparencyBox(pixelData, pixelDataTrans, $scope);
... ... @@ -2442,11 +3027,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2442 3027  
2443 3028 $scope.CloseTransparencyBox = function () {
2444 3029 var tBox = document.getElementById('transparencyCanvas');
2445   -<<<<<<< HEAD
2446 3030 // debugger;
2447   -=======
2448   - // debugger;
2449   ->>>>>>> f02adb91be9d04918a612b7ac16241017c20e360
2450 3031 // alert('mouseDown is called');
2451 3032 if (tBox != null) {
2452 3033 tBox.parentNode.removeChild(tBox)
... ... @@ -2457,10 +3038,11 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2457 3038 //var txtTransparencyChange = document.getElementById("txtTransparencyChange");
2458 3039 //txtTransparencyChange.value = 0;
2459 3040 // document.getElementById('txtLayerNumber').value = 0;
2460   - $("#txtlayerNumber").val(parseInt($scope.layerNumber));
  3041 + // debugger;
2461 3042  
2462 3043  
2463   - $('#layerChangeSlider').slider("option", "value", parseInt($scope.totalLayers) - parseInt($scope.layerNumber));
  3044 + $('#layerChangeSlider').slider("option", "value", parseInt($scope.totalLayers) - parseInt($scope.currentLayerNumber));
  3045 + $("#txtlayerNumber").val(parseInt($scope.currentLayerNumber));
2464 3046  
2465 3047  
2466 3048 if (document.getElementById('tempCanvas') != null) {
... ... @@ -2485,6 +3067,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2485 3067  
2486 3068 //$("canvas[name*='transparencyTempCanvas']").nextUntil($("canvas[name*='transparencyTempCanvas']"))
2487 3069 //.remove();
  3070 + $scope.layerNumber = $scope.currentLayerNumber;
  3071 + $scope.transNumber = 50;
  3072 + $('.slider').value = 50;
2488 3073 }
2489 3074 $('#transparencyScale').css('visibility', 'hidden');
2490 3075  
... ... @@ -2562,20 +3147,28 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2562 3147 }
2563 3148  
2564 3149 }
2565   -
  3150 +
2566 3151 $scope.Zoom = function () {
2567 3152 $scope.flushCanvas();
2568 3153  
2569 3154 if ($scope.zoomInOut == 25) {
2570 3155 $scope.zoomInOut = 75;
2571   -
  3156 +
2572 3157 }
2573 3158 else {
2574 3159 $scope.zoomInOut = 25;
2575 3160 }
2576 3161  
2577 3162 $scope.CalculateImageCordinates($scope.viewOrientationId);
  3163 + if ($scope.zoomInOut == 25)
  3164 + $('#canvasDiv').scrollLeft(0)
  3165 + else
  3166 + $('#canvasDiv').scrollLeft($('#canvasDiv').width() / 2)
2578 3167  
  3168 + //remove annotation speech bubble
  3169 + if ($('#speechBubble').length > 0) {
  3170 + $('#speechBubble').remove();
  3171 + }
2579 3172 }
2580 3173  
2581 3174 $scope.flushCanvas = function () {
... ... @@ -2583,86 +3176,227 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2583 3176  
2584 3177  
2585 3178 var id;
  3179 + var maskId;
2586 3180 if (value.haveMirror == 'true') {
2587 3181 id = 'imageCanvas' + value.bodyRegionId + '_MR';
  3182 + maskId = 'imageCanvas' + value.bodyRegionId + '_MR_mci'
2588 3183 }
2589 3184 else {
2590 3185 id = 'imageCanvas' + value.bodyRegionId;
  3186 + maskId = 'imageCanvas' + value.bodyRegionId + '_mci';
2591 3187 }
2592 3188  
2593 3189 var canvas = document.getElementById(id);
2594 3190 document.getElementById('canvasDiv').removeChild(canvas);
  3191 +
  3192 + var maskcanvas = document.getElementById(maskId);
  3193 + document.getElementById('canvasDiv').removeChild(maskcanvas);
  3194 +
  3195 + var modestyCanvases = $("canvas[id*='imageCanvasmodestyImg']");
  3196 + for (var i = 0; i < modestyCanvases.length; i++) {
  3197 + modestyCanvases[i].remove();
  3198 + }
2595 3199 });
2596 3200 }
2597 3201  
2598 3202 $scope.enableHighlight = function () {
2599   - $scope.isHighLight = true;
  3203 + $rootScope.isHighLight = true;
2600 3204  
2601 3205 // alert('enableHighlight is called');
2602 3206  
2603 3207 $scope.highLightBody();
2604 3208 }
2605 3209  
  3210 +
2606 3211 $scope.highLightBody = function () {
2607 3212  
2608   - // alert('highlight body is called');
2609   - angular.forEach($scope.ColoredImageSRC, function (value, key) {
2610 3213  
  3214 + if ($rootScope.isHighLight == true) {
2611 3215  
2612   - var id;
2613   - if (value.haveMirror == 'true') {
2614   - id = 'imageCanvas' + value.bodyRegionId + '_MR';
2615   - }
2616   - else {
2617   - id = 'imageCanvas' + value.bodyRegionId;
2618   - }
  3216 + angular.forEach($scope.ColoredImageSRC, function (value, key) {
  3217 + var id;
  3218 + if (value.haveMirror == 'true') {
  3219 + id = 'imageCanvas' + value.bodyRegionId + '_MR';
  3220 + }
  3221 + else {
  3222 + id = 'imageCanvas' + value.bodyRegionId;
  3223 + }
  3224 +
  3225 + var imageCanvas = document.getElementById(id);
  3226 +
  3227 + //var coloredCanvasID = 'imageCanvas' + bodyRegionId;
  3228 + //var coloredCanvas = document.getElementById(coloredCanvasID);
  3229 +
  3230 + var width = value.Width;
  3231 + var ht = value.Height;
2619 3232  
2620   - var imageCanvas = document.getElementById(id);
  3233 + var coloredCanvasContext = imageCanvas.getContext("2d");
  3234 + var coloredImageData = coloredCanvasContext.getImageData(0, 0, width, ht);
  3235 + var coloredImageDataVar = coloredImageData.data;
2621 3236  
2622   - var context_gray = imageCanvas.getContext('2d');
2623 3237  
2624   - var dataURL = imageCanvas.toDataURL();
  3238 + if (value.haveMirror == 'true') {
  3239 + $rootScope.coloredImageMRCanvasList[parseInt(value.bodyRegionId)] = coloredImageDataVar;
  3240 + }
  3241 + else {
  3242 + //$rootScope.coloredImageMRCanvasList[parseInt(value.bodyRegionId - 1)] = 1;
2625 3243  
  3244 + $rootScope.coloredImageCanvasList[parseInt(value.bodyRegionId - 1)] = coloredImageDataVar;
  3245 + }
2626 3246  
2627   - var img = new Image();
2628 3247  
2629   - img.src = dataURL;
  3248 + //$rootScope.coloredImageCanvasList.push(parts);
2630 3249  
2631 3250  
2632   - var DAData = new BitmapData(img.width, img.height);
2633   - DAData.draw(img);
2634   - var RED = 0.3086; // luminance contrast value for red
2635   - var GREEN = 0.694; // luminance contrast value for green
2636   - var BLUE = 0.0820; // luminance contrast value for blue
2637 3251  
2638   - var RGB = [RED, GREEN, BLUE, 0, 0];
2639   - var RGB2 = [RED, GREEN, BLUE, 0, 0];
2640   - var RGB3 = [RED, GREEN, BLUE, 0, 0];
2641   - var ALPHA = [0, 0, 0, 1, 0];
  3252 + var context_gray = imageCanvas.getContext('2d');
2642 3253  
2643   - var rgbPx = RGB.concat(RGB2);
2644   - var rgbPx2 = rgbPx.concat(RGB3);
2645   - var matrix = rgbPx2.concat(ALPHA);
2646 3254  
2647   - var zeroPoint = new Point();
2648   - var grayScale = new ColorMatrixFilter(matrix);
2649   - DAData.applyFilter(DAData, DAData.rect, zeroPoint, grayScale);
  3255 + var dataURL = imageCanvas.toDataURL();
2650 3256  
2651   - context_gray.putImageData(DAData.data, 0, 0)
2652 3257  
2653   - });
  3258 + var img = new Image();
  3259 + img.src = dataURL;
  3260 +
  3261 +
  3262 +<<<<<<< HEAD
  3263 + img.onload = function () {
  3264 + console.log(Math.max(img.width) + ', ' + Math.max(img.height))
  3265 +
  3266 + var DAData = new BitmapData(Math.max(img.width), Math.max(img.height));
  3267 + DAData.draw(img);
  3268 + var RED = 0.3086; // luminance contrast value for red
  3269 + var GREEN = 0.694; // luminance contrast value for green
  3270 + var BLUE = 0.0820; // luminance contrast value for blue
  3271 +
  3272 + var RGB = [RED, GREEN, BLUE, 0, 0];
  3273 + var RGB2 = [RED, GREEN, BLUE, 0, 0];
  3274 + var RGB3 = [RED, GREEN, BLUE, 0, 0];
  3275 + var ALPHA = [0, 0, 0, 1, 0];
  3276 +
  3277 + var rgbPx = RGB.concat(RGB2);
  3278 + var rgbPx2 = rgbPx.concat(RGB3);
  3279 + var matrix = rgbPx2.concat(ALPHA);
  3280 +
  3281 + var zeroPoint = new Point();
  3282 + var grayScale = new ColorMatrixFilter(matrix);
  3283 + DAData.applyFilter(DAData, DAData.rect, zeroPoint, grayScale);
  3284 +
  3285 + context_gray.putImageData(DAData.data, 0, 0)
  3286 +
  3287 +=======
  3288 +
  3289 + img.onload = function () {
  3290 + console.log(Math.max(img.width) + ', ' + Math.max(img.height))
2654 3291  
  3292 + var DAData = new BitmapData(Math.max(img.width), Math.max(img.height));
  3293 + DAData.draw(img);
  3294 + var RED = 0.3086; // luminance contrast value for red
  3295 + var GREEN = 0.694; // luminance contrast value for green
  3296 + var BLUE = 0.0820; // luminance contrast value for blue
  3297 +
  3298 + var RGB = [RED, GREEN, BLUE, 0, 0];
  3299 + var RGB2 = [RED, GREEN, BLUE, 0, 0];
  3300 + var RGB3 = [RED, GREEN, BLUE, 0, 0];
  3301 + var ALPHA = [0, 0, 0, 1, 0];
  3302 +
  3303 + var rgbPx = RGB.concat(RGB2);
  3304 + var rgbPx2 = rgbPx.concat(RGB3);
  3305 + var matrix = rgbPx2.concat(ALPHA);
  3306 +
  3307 + var zeroPoint = new Point();
  3308 + var grayScale = new ColorMatrixFilter(matrix);
  3309 + DAData.applyFilter(DAData, DAData.rect, zeroPoint, grayScale);
  3310 +
  3311 + context_gray.putImageData(DAData.data, 0, 0)
  3312 +
  3313 +>>>>>>> 06cddfd0f16578a9c42e80367bb28ee0cede2c3e
  3314 + var grayImageData = context_gray.getImageData(0, 0, width, ht);
  3315 + var grayImageImageDataVar = grayImageData.data;
  3316 +
  3317 + if (value.haveMirror == 'true') {
  3318 + $rootScope.grayImageMRDataList[parseInt(value.bodyRegionId)] = grayImageData;
  3319 + }
  3320 + else {
  3321 + //$rootScope.coloredImageMRCanvasList[parseInt(value.bodyRegionId - 1)] = 1;
  3322 +<<<<<<< HEAD
  3323 +=======
  3324 +
  3325 + $rootScope.grayImageDataList[parseInt(value.bodyRegionId - 1)] = grayImageData;
  3326 + }
  3327 + }
  3328 +>>>>>>> 06cddfd0f16578a9c42e80367bb28ee0cede2c3e
  3329 +
  3330 + $rootScope.grayImageDataList[parseInt(value.bodyRegionId - 1)] = grayImageData;
  3331 + }
  3332 + }
  3333 +
  3334 + });
  3335 +
  3336 + // alert('length: '+ $scope.coloredImageCanvasList.length);
  3337 +
  3338 + }
  3339 +
  3340 + if ($scope.previousSelectedTermList.length > 0) {
  3341 + for (var i = 0; i < $scope.previousSelectedTermList.length; i++) {
  3342 + $scope.highLightBodyBasedOnIcolor($scope.previousSelectedTermList[i]);
  3343 +
  3344 + }
  3345 + }
2655 3346 }
  3347 + $scope.applyGrayMatrix = function (img, context_gray) {
  3348 + var DAData = new BitmapData(img.width, img.height);
  3349 + DAData.draw(img);
  3350 + var RED = 0.3086; // luminance contrast value for red
  3351 + var GREEN = 0.694; // luminance contrast value for green
  3352 + var BLUE = 0.0820; // luminance contrast value for blue
  3353 +
  3354 + var RGB = [RED, GREEN, BLUE, 0, 0];
  3355 + var RGB2 = [RED, GREEN, BLUE, 0, 0];
  3356 + var RGB3 = [RED, GREEN, BLUE, 0, 0];
  3357 + var ALPHA = [0, 0, 0, 1, 0];
  3358 +
  3359 + var rgbPx = RGB.concat(RGB2);
  3360 + var rgbPx2 = rgbPx.concat(RGB3);
  3361 + var matrix = rgbPx2.concat(ALPHA);
  3362 +
  3363 + var zeroPoint = new Point();
  3364 + var grayScale = new ColorMatrixFilter(matrix);
  3365 + DAData.applyFilter(DAData, DAData.rect, zeroPoint, grayScale);
  3366 +
  3367 + context_gray.putImageData(DAData.data, 0, 0)
  3368 +
  3369 + var grayImageData = context_gray.getImageData(0, 0, width, ht);
  3370 + var grayImageImageDataVar = grayImageData.data;
  3371 +
  3372 + }
  3373 +
  3374 + $scope.getActualTermNumber = function (iColor) {
  3375 + $scope.actualTermNo = new jinqJs()
  3376 + .from($scope.TermNumberData.TermData.Term)
  3377 + .where('_TermNumber == ' + iColor)
  3378 + .select('_ActualTermNumber');
  3379 + return $scope.actualTermNo[0]._ActualTermNumber;
  3380 + }
  3381 +
  3382 + $scope.getTermNumberList = function (actualTermNo) {
  3383 + $scope.termList = new jinqJs()
  3384 + .from($scope.TermNumberData.TermData.Term)
  3385 + .where('_ActualTermNumber == ' + actualTermNo)
  3386 + .select();
  3387 + return $scope.termList;
  3388 + }
  3389 +
2656 3390  
2657 3391 $scope.OnGenderChange = function (event) {
2658   - // debugger;
  3392 +
2659 3393 //use $scope.correspondingBodyViewIds for getting correspnding viewid
2660 3394 // alert('gender changed= ' + event.currentTarget.attributes[1].value)
2661 3395  
2662 3396 // $(".enableGender li").removeClass("active");
2663 3397 // $(event.currentTarget.attributes[2].value).parent().addClass("active");
2664 3398  
2665   -
  3399 + var viewname = localStorage.getItem("currentViewTitle")
2666 3400 var currentBodyViewId = $scope.correspondingBodyViewIds[$scope.voId];
2667 3401  
2668 3402 if ((event.currentTarget.attributes[1].value == 'Male') && (localStorage.getItem("genderId") == 'Female')) {
... ... @@ -2672,6 +3406,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2672 3406  
2673 3407 $scope.loadSelectedBodyView(currentBodyViewId);
2674 3408  
  3409 + $('#daImagePanel')[0].childNodes[0].childNodes[0].innerHTML = localStorage.getItem("currentViewTitle").replace('Female', 'Male');
  3410 + $rootScope.isLoading = true;
  3411 +
2675 3412 }
2676 3413  
2677 3414 else if ((event.currentTarget.attributes[1].value == 'Female') && (localStorage.getItem("genderId") == 'Male')) {
... ... @@ -2680,7 +3417,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2680 3417  
2681 3418  
2682 3419 $scope.loadSelectedBodyView(currentBodyViewId)
  3420 + $('#daImagePanel')[0].childNodes[0].childNodes[0].innerHTML = localStorage.getItem("currentViewTitle").replace('Male', 'Female');
2683 3421  
  3422 + $rootScope.isLoading = true;
2684 3423  
2685 3424 }
2686 3425  
... ... @@ -2690,6 +3429,13 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2690 3429  
2691 3430 $scope.loadSelectedBodyView = function (currentBodyViewId) {
2692 3431  
  3432 + //remove transaprency scale
  3433 + if ($('#transparencyScale') != null) {
  3434 +
  3435 + $('#transparencyScale').css('visibility', 'hidden');
  3436 + }
  3437 +
  3438 +
2693 3439 $scope.voId = currentBodyViewId;
2694 3440  
2695 3441 var layerJsonPath = '~/../content/data/json/da/body-views/' + currentBodyViewId + '/da_dat_layer_' + currentBodyViewId + '.json';
... ... @@ -2732,7 +3478,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2732 3478 }
2733 3479  
2734 3480 $scope.OnViewChange = function (event) {
  3481 +
  3482 +
2735 3483 $scope.layerNumber = 0;
  3484 + // debugger;
2736 3485 var selectedViewId = $scope.bodyViews[event.currentTarget.attributes[1].value];
2737 3486 $scope.viewOrientationId = selectedViewId;
2738 3487 if (localStorage.getItem("genderId") == 'Male') {
... ... @@ -2745,10 +3494,15 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2745 3494 }
2746 3495 else
2747 3496 $scope.voId = selectedViewId;
  3497 + $rootScope.isLoading = true;
2748 3498  
2749   -<<<<<<< HEAD
2750 3499 $scope.loadSelectedBodyView($scope.voId);
2751 3500 };
  3501 +
  3502 +
  3503 + //set selected view name as the title of jspanel
  3504 + // $('#daImagePanel')[0].childNodes[0].childNodes[0].innerHTML = localStorage.getItem("genderId") +" "+ event.currentTarget.attributes[1].value;
  3505 +
2752 3506 }
2753 3507 else {
2754 3508 if (selectedViewId == 5) {
... ... @@ -2761,12 +3515,17 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2761 3515 selectedViewId = $scope.correspondingBodyViewIds[selectedViewId];;
2762 3516 if ($scope.voId != selectedViewId) {
2763 3517 $scope.voId = selectedViewId;
  3518 + $rootScope.isLoading = true;
  3519 +
2764 3520 $scope.loadSelectedBodyView($scope.voId);
2765 3521 };
2766   -=======
2767   ->>>>>>> f02adb91be9d04918a612b7ac16241017c20e360
2768   - }
2769 3522  
  3523 +
  3524 + // $('#daImagePanel')[0].childNodes[0].childNodes[0].innerHTML = localStorage.getItem("genderId") + " " + $scope.bodyViews[event.currentTarget.attributes[1].value;
  3525 +
  3526 + }
  3527 + $('#daImagePanel')[0].childNodes[0].childNodes[0].innerHTML = localStorage.getItem("genderId") + " " + event.currentTarget.attributes[1].value;
  3528 + localStorage.setItem("currentViewTitle", localStorage.getItem("genderId") + " " + event.currentTarget.attributes[1].value);
2770 3529 }
2771 3530  
2772 3531  
... ... @@ -2784,7 +3543,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2784 3543 paintCanvas.style.left = 0 + 'px';
2785 3544 paintCanvas.style.top = 0 + 'px';
2786 3545 // paintCanvas.className = 'col-lg-12';
2787   - paintCanvas.style.backgroundColor = 'yellow';
  3546 + paintCanvas.style.backgroundColor = 'yellow';
2788 3547 paintCanvas.style.zIndex = '1100'
2789 3548 //this is to get annoatation while annotation window is open
2790 3549 paintCanvas.addEventListener('click', OnPaintCanvasClick);
... ... @@ -2803,10 +3562,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2803 3562 // alert('show annotation')
2804 3563 }
2805 3564  
2806   -<<<<<<< HEAD
2807   -=======
2808   - var layerJsonPath = '~/../content/data/json/da/body-views/' + currentBodyViewId + '/da_dat_layer_' + currentBodyViewId + '.json';
2809   ->>>>>>> f02adb91be9d04918a612b7ac16241017c20e360
2810 3565  
2811 3566 }
2812 3567  
... ... @@ -2814,19 +3569,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2814 3569 $scope.lastX; $scope.lastY;
2815 3570 var ctx;
2816 3571  
2817   -<<<<<<< HEAD
2818 3572 function OnPaintCanvasMouseDown(event) {
2819   -
  3573 +
2820 3574 if ($rootScope.isDrawingToolSelected == true) {
2821   -=======
2822   - //load json for annotations
2823   - // $http({ method: 'GET', url: '~/../content/data/json/da_dat_tm_sg_1.json' }).success(function (data) {
2824   - var termJsonPath = '~/../content/data/json/da/body-views/' + currentBodyViewId + '/da_dat_tm_sg_' + currentBodyViewId + '.json' ;
2825   - DataService.getAnotherJson(termJsonPath)
2826   - .then(
2827   - function (result) {
2828   - $scope.TermNumberData = result;
2829   ->>>>>>> f02adb91be9d04918a612b7ac16241017c20e360
2830 3575  
2831 3576  
2832 3577 //var mousePos = $scope.getMousePos(event)
... ... @@ -2844,7 +3589,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2844 3589  
2845 3590 }
2846 3591 else
2847   - document.getElementById('paintCanvas').addEventListener('mousemove', OnPaintCanvasMouseMove, false)
  3592 + document.getElementById('paintCanvas').addEventListener('mousemove', OnPaintCanvasMouseMove, false)
2848 3593  
2849 3594 }
2850 3595 //ctx.moveTo(50, 50);
... ... @@ -2876,7 +3621,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2876 3621 if ($scope.mousePressed) {
2877 3622 var mousePos = $scope.getMousePos(event)
2878 3623  
2879   - $rootScope.Draw(mousePos.x, mousePos.y, true,$scope.paintCanvasContext);
  3624 + $rootScope.Draw(mousePos.x, mousePos.y, true, $scope.paintCanvasContext);
2880 3625 }
2881 3626 }
2882 3627 }
... ... @@ -2884,21 +3629,73 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2884 3629  
2885 3630  
2886 3631  
2887   -// $scope.Draw=function(x, y, isDown) {
2888   -// if (isDown) {
2889   -// $scope.paintCanvasContext.beginPath();
2890   -// $scope.paintCanvasContext.strokeStyle = '#000000';
2891   -// $scope.paintCanvasContext.lineWidth = 1//$('#selWidth').val();
2892   -// $scope.paintCanvasContext.lineJoin = "round";
2893   -// $scope.paintCanvasContext.moveTo($scope.lastX, $scope.lastY);
2894   -// $scope.paintCanvasContext.lineTo(x, y);
2895   -// $scope.paintCanvasContext.closePath();
2896   -// $scope.paintCanvasContext.stroke();
2897   -// }
2898   -// $scope.lastX = x; $scope.lastY = y;
2899   -//}
  3632 + // $scope.Draw=function(x, y, isDown) {
  3633 + // if (isDown) {
  3634 + // $scope.paintCanvasContext.beginPath();
  3635 + // $scope.paintCanvasContext.strokeStyle = '#000000';
  3636 + // $scope.paintCanvasContext.lineWidth = 1//$('#selWidth').val();
  3637 + // $scope.paintCanvasContext.lineJoin = "round";
  3638 + // $scope.paintCanvasContext.moveTo($scope.lastX, $scope.lastY);
  3639 + // $scope.paintCanvasContext.lineTo(x, y);
  3640 + // $scope.paintCanvasContext.closePath();
  3641 + // $scope.paintCanvasContext.stroke();
  3642 + // }
  3643 + // $scope.lastX = x; $scope.lastY = y;
  3644 + //}
  3645 +
  3646 + //body highlight options functinality
  3647 + $scope.LoadBodySystemList = function () {
  3648 +
  3649 + var currentBodyViewId = $scope.voId;
  3650 + var systemListHtml = '<ul class="dropdown-menu" aria-labelledby="dropdownMenu2"><li><a href="#" title="Current Structure">Current Structure</a></li> <li role="separator" class="divider"></li>'
  3651 + var systemList = $rootScope.CommonData.DACommonData.BodySystems.Item;
  3652 +
  3653 + angular.forEach(systemList, function (value, key) {
  3654 +
  3655 + systemListHtml = systemListHtml + '<li><a href="#" id="' + value._BodySystemId + '" title="' + value._Name + '">' + value._Name + '</a></li>'
  3656 + })
2900 3657  
  3658 + systemListHtml = systemListHtml + '</ul>';
  3659 + $('#bodySystem').append(systemListHtml);
2901 3660  
  3661 + var bodySystemDataPath = '~/../content/data/json/da/body-views/' + currentBodyViewId + '/da_dat_body_system_term_' + currentBodyViewId + '.json';
  3662 + DataService.getJson(bodySystemDataPath)
  3663 + .then(
  3664 + function (result) {
  3665 +
  3666 + $rootScope.BodySystemData = result;
  3667 +
  3668 + },
  3669 + function (error) {
  3670 + console.log(error.statusText)
  3671 + }
  3672 + )
  3673 +
  3674 + }
  3675 +
  3676 + $scope.HighlightBodysystem = function (event) {
  3677 + var systemMatchedTermList = new jinqJs()
  3678 + .from($rootScope.BodySystemData.BodySystem.BodySystemTerm)
  3679 + .where('_SystemNumber == ' + event.currentTarget.id)
  3680 + .select();
  3681 +
  3682 + //color the body gray
  3683 + $rootScope.isHighLight =true
  3684 + $scope.highLightBody();
  3685 + //now highlight the selected body system in whole body
  3686 +
  3687 + var termNumber = parseInt(systemMatchedTermList[0]._TermNumber);
  3688 +
  3689 + //Match Term No List in each bodyRegion
  3690 + $scope.getLocationsForMatchedTermsInWholeBody(termNumber, 0, 0);
  3691 + //for (var i = 0; i < systemMatchedTermList.length; i++) {
  3692 +
  3693 + // var termNumber = parseInt(systemMatchedTermList[i]._TermNumber);
  3694 +
  3695 + // //Match Term No List in each bodyRegion
  3696 + // $scope.getLocationsForMatchedTermsInWholeBody(termNumber, 0, 0);
  3697 + //}
  3698 + }
2902 3699  
2903 3700 }]
2904 3701  
... ...