Commit 21836e5dfe4a0baa36d34d58a02b42cf4529d805

Authored by Nikita Kulshreshtha
1 parent 6bd69f86

annotations implemented with leaf (modesty).

400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
@@ -259,16 +259,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -259,16 +259,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
259 console.log(data); 259 console.log(data);
260 }); 260 });
261 261
262 - ////load vocabterm data  
263 - //$http({ method: 'GET', url: '~/../content/data/json/cm_dat_vocabterm_1.json' }).success(function (data) {  
264 - // $scope.VocabTermData = data;  
265 - //})  
266 - // .error(function (data, status, headers, config) {  
267 - // console.log(data);  
268 - // });  
269 -  
270 -  
271 -  
272 var openViews; 262 var openViews;
273 263
274 264
@@ -376,9 +366,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -376,9 +366,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
376 366
377 367
378 368
379 -  
380 -  
381 -  
382 $scope.LoadDefaultLayerImage = function () { 369 $scope.LoadDefaultLayerImage = function () {
383 // debugger; 370 // debugger;
384 371
@@ -604,48 +591,25 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -604,48 +591,25 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
604 $scope.figLaefX = filtereddata[0]._X; 591 $scope.figLaefX = filtereddata[0]._X;
605 $scope.figLaefY = filtereddata[0]._Y; 592 $scope.figLaefY = filtereddata[0]._Y;
606 593
  594 + var rectangle = scaleRectangle(value._X, value._Y, value._Height, value._Width, value._MirrorValue);
  595 +
  596 +
607 var src = "content/images/DA/BodyViews/" + $scope.voId + "/layers/0/" + value._BodyRegionId + "/" + $scope.figLaefImageName; 597 var src = "content/images/DA/BodyViews/" + $scope.voId + "/layers/0/" + value._BodyRegionId + "/" + $scope.figLaefImageName;
608 598
609 - var leafImg = new Image();  
610 - leafImg.id = 'modestyImg'  
611 - leafImg.src = src; 599 + $scope.DrawImage(rectangle.scaledHeight, rectangle.scaledWidth, rectangle.scaledX, rectangle.scaledY, src, 'modestyImg' + value._BodyRegionId, 'N')
612 600
613 - var rectangle = scaleRectangle(value._X, value._Y, value._Height, value._Width, value._MirrorValue);  
614 - var rectangle1 = scaleRectangle($scope.figLaefX, $scope.figLaefY, leafImg.height, leafImg.width, value._MirrorValue);  
615 - var abc;  
616 - //if ($scope.viewOrientationId == 5) {  
617 - // leafImg.style.position = 'absolute';  
618 - // leafImg.style.left = '800px'; //+parseInt(rectangle1.scaledX) + 'px';//'780px';  
619 - // leafImg.style.top = '800px';  
620 - //}  
621 - //else {  
622 - leafImg.style.position = 'absolute';  
623 - leafImg.style.left = parseInt(rectangle.scaledX) + 'px'; //+parseInt(rectangle1.scaledX) + 'px';//'780px';  
624 - leafImg.style.top = parseInt(rectangle.scaledY) + 'px';// +parseInt(rectangle1.scaledY) + 'px';//'1200px';  
625 - leafImg.style.visibility = 'hidden';  
626 -  
627 - document.getElementById('canvasDiv').appendChild(leafImg);  
628 } 601 }
629 - //$scope.DrawImage(Math.round(rectangle1.scaledHeight), Math.round(rectangle1.scaledWidth), Math.round(parseInt(rectangle.scaledX) + parseInt(rectangle1.scaledX)), Math.round(parseInt(rectangle.scaledY) + parseInt(rectangle1.scaledY)), src, value._BodyRegionId + '_fig', 'N');  
630 - //  
631 - // var xlData:XMLList = _xmlBackgroundArtViewList[XMLConst.ITEM].((@voId == String(iViewOrientationId)) && (@gr == strGenderId)  
632 - //&& (@brId == bodyRegionId) && ( @lns <= iLayerNumber && @lne >= iLayerNumber ) && (@isfr == DADataConst.YES));  
633 - // var strImageId:String = xlData[XMLConst.IMAGE_TYPE_ID];  
634 - // if(strImageId != null && strImageId != "")  
635 - // {  
636 - // return strImageId;  
637 - // }  
638 - // 602 +
639 } 603 }
640 604
641 } 605 }
642 606
643 607
644 }); 608 });
645 - debugger; 609 +
646 if ((DA[0].modesty == 'Y')) { 610 if ((DA[0].modesty == 'Y')) {
647 - if ($('#modestyImg') != null) {  
648 - $('#modestyImg').css('visibility', 'visible'); 611 + if ($('.modestyImg') != null) {
  612 + $('.modestyImg').css('visibility', 'visible');
649 } 613 }
650 } 614 }
651 //set scrollbars on canvas and hide loading label 615 //set scrollbars on canvas and hide loading label
@@ -986,20 +950,34 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -986,20 +950,34 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
986 950
987 } 951 }
988 else { 952 else {
  953 +
  954 +
989 imgCanvas.id = 'imageCanvas' + bodyRegionId; 955 imgCanvas.id = 'imageCanvas' + bodyRegionId;
990 imgCanvas.style.visibility = 'visible' 956 imgCanvas.style.visibility = 'visible'
991 957
  958 + if (bodyRegionId.match('modestyImg')) {
  959 + //added class to further access this canavs to show and hide leaf as per modesty seting
  960 + imgCanvas.className = 'modestyImg'
  961 + imgCanvas.style.visibility = 'hidden'
  962 + }
992 } 963 }
993 imgCanvas.addEventListener('click', function (evt) { 964 imgCanvas.addEventListener('click', function (evt) {
994 965
995 966
996 - // debugger; 967 +
997 var context = imgCanvas.getContext("2d"); 968 var context = imgCanvas.getContext("2d");
998 969
999 970
1000 var canvasId = context.canvas.getAttribute('id'); 971 var canvasId = context.canvas.getAttribute('id');
1001 -  
1002 - var maskCanvasId = canvasId + '_mci'; 972 + var maskCanvasId;
  973 + //for leaf canvas
  974 + if (canvasId.match('modestyImg')) {
  975 + maskCanvasId = canvasId;
  976 + }
  977 + else
  978 + {
  979 + maskCanvasId = canvasId + '_mci';
  980 + }
1003 var maskCanvas = document.getElementById(maskCanvasId); 981 var maskCanvas = document.getElementById(maskCanvasId);
1004 var canvasContextForRGB = maskCanvas.getContext("2d"); 982 var canvasContextForRGB = maskCanvas.getContext("2d");
1005 983
@@ -1013,46 +991,31 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -1013,46 +991,31 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1013 991
1014 992
1015 //We substracted 135, as the difference between flex and html coordinates for same organ is 135 993 //We substracted 135, as the difference between flex and html coordinates for same organ is 135
1016 - var actulalX = mousePos.x + horizontlScrollPosition// - 135;// + leftToolBarWidth;  
1017 - var actualY = mousePos.y + verticalScrollPosition //- 135; //+ tomenuBarheight + titleBarheight + searchComboheight;  
1018 -  
1019 -  
1020 -  
1021 - var pixelData = canvasContextForRGB.getImageData(Math.round(actulalX - x), Math.round(actualY - y), 1, 1); 994 + var actulalX = mousePos.x + horizontlScrollPosition;
  995 + var actualY = mousePos.y + verticalScrollPosition ;
1022 996
1023 - pixelData.data[0] = pixelData.data[0] - 9;  
1024 - pixelData.data[1] = pixelData.data[1] - 9;  
1025 - pixelData.data[2] = pixelData.data[2] - 9;  
1026 - var Red;  
1027 - var Green;  
1028 - var Blue;  
1029 - var zero = "0"; 997 + //debugger;
  998 + var RGBColor = $scope.GetRGBColor(canvasContextForRGB, actulalX, actualY,x,y);
  999 + var annotationText;
1030 1000
1031 - if ((pixelData.data[0]).toString().length != 2) {  
1032 - Red = zero.concat((pixelData.data[0]).toString()) 1001 + if (maskCanvasId.match('modestyImg') && RGBColor != '000000') {
  1002 + RGBColor = DA[0].figLeafTermId;
  1003 + annotationText = $scope.GetAnnotationBasedOnActualTermNo(RGBColor);
1033 } 1004 }
1034 - else {  
1035 - Red = (pixelData.data[0]).toString()  
1036 - }  
1037 - if ((pixelData.data[1]).toString().length != 2) {  
1038 - Green = zero.concat((pixelData.data[1]).toString())  
1039 - }  
1040 - else {  
1041 - Green = (pixelData.data[1]).toString()  
1042 -  
1043 - }  
1044 - if ((pixelData.data[2]).toString().length != 2) {  
1045 - Blue = zero.concat((pixelData.data[2]).toString()) 1005 + else if (maskCanvasId.match('modestyImg') && RGBColor == '000000') {
  1006 + bodyRegionId = maskCanvasId.slice(-1);
  1007 + maskCanvasId = 'imageCanvas' + bodyRegionId + '_mci';
  1008 + var maskCanvas = document.getElementById(maskCanvasId);
  1009 + var canvasContextForRGB = maskCanvas.getContext("2d");
  1010 + RGBColor = $scope.GetRGBColor(canvasContextForRGB, actulalX, actualY,x,y);
  1011 + annotationText = $scope.GetAnnotationText(parseInt(RGBColor));
1046 } 1012 }
1047 else { 1013 else {
1048 - Blue = (pixelData.data[2]).toString() 1014 + RGBColor = $scope.GetRGBColor(canvasContextForRGB, actulalX, actualY,x,y);
  1015 + annotationText = $scope.GetAnnotationText(parseInt(RGBColor));
1049 1016
1050 } 1017 }
1051 - var RGBColor = (Red + Green + Blue);  
1052 -  
1053 -  
1054 - var annotationText = $scope.GetAnnotationText(parseInt(RGBColor));  
1055 - 1018 +
1056 if ($('#speechBubble').length > 0) { 1019 if ($('#speechBubble').length > 0) {
1057 $('#speechBubble').remove(); 1020 $('#speechBubble').remove();
1058 1021
@@ -1100,6 +1063,43 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -1100,6 +1063,43 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1100 1063
1101 } 1064 }
1102 1065
  1066 + $scope.GetRGBColor = function (canvasContextForRGB, actulalX, actualY,x,y) {
  1067 +
  1068 + var pixelData = canvasContextForRGB.getImageData(Math.round(actulalX - x), Math.round(actualY - y), 1, 1);
  1069 +
  1070 + pixelData.data[0] = pixelData.data[0] - 9;
  1071 + pixelData.data[1] = pixelData.data[1] - 9;
  1072 + pixelData.data[2] = pixelData.data[2] - 9;
  1073 + var Red;
  1074 + var Green;
  1075 + var Blue;
  1076 + var zero = "0";
  1077 +
  1078 + if ((pixelData.data[0]).toString().length != 2) {
  1079 + Red = zero.concat((pixelData.data[0]).toString())
  1080 + }
  1081 + else {
  1082 + Red = (pixelData.data[0]).toString()
  1083 + }
  1084 + if ((pixelData.data[1]).toString().length != 2) {
  1085 + Green = zero.concat((pixelData.data[1]).toString())
  1086 + }
  1087 + else {
  1088 + Green = (pixelData.data[1]).toString()
  1089 +
  1090 + }
  1091 + if ((pixelData.data[2]).toString().length != 2) {
  1092 + Blue = zero.concat((pixelData.data[2]).toString())
  1093 + }
  1094 + else {
  1095 + Blue = (pixelData.data[2]).toString()
  1096 +
  1097 + }
  1098 + var RGBColor = (Red + Green + Blue);
  1099 + return RGBColor;
  1100 + }
  1101 +
  1102 +
1103 //get annotation from term number 1103 //get annotation from term number
1104 $scope.GetAnnotationText = function (termNumber) { 1104 $scope.GetAnnotationText = function (termNumber) {
1105 //debugger; 1105 //debugger;
400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js
@@ -141,7 +141,7 @@ AIA.constant(&#39;DA&#39;, [ @@ -141,7 +141,7 @@ AIA.constant(&#39;DA&#39;, [
141 { 141 {
142 ethnicity: 'W', 142 ethnicity: 'W',
143 modesty: 'Y', 143 modesty: 'Y',
144 - 144 + figLeafTermId: '5868',
145 }, 145 },
146 ]); 146 ]);
147 147