Commit e8674218d0c26e38eee8eba92d9bfec46d7b9164

Authored by Amrita Vishnoi
2 parents 9339a58c ce06658e

Merge branch 'zIndexIssueinModestyTB' into Develop

400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
@@ -772,7 +772,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -772,7 +772,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
772 772
773 $rootScope.isLoading = true; 773 $rootScope.isLoading = true;
774 $('#spinner').css('visibility', 'visible'); 774 $('#spinner').css('visibility', 'visible');
775 - 775 + $scope.modestyImageInfo = [];
776 // annotation toolbar canvas 776 // annotation toolbar canvas
777 if ($("#canvasDiv").find("canvas[id='canvasPaint']").length == 0) { 777 if ($("#canvasDiv").find("canvas[id='canvasPaint']").length == 0) {
778 778
@@ -1865,7 +1865,18 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -1865,7 +1865,18 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1865 1865
1866 if (isMaskImage == 'N') { 1866 if (isMaskImage == 'N') {
1867 if (bodyRegionId == 'modestyImg3' || bodyRegionId == 'modestyImg2') { 1867 if (bodyRegionId == 'modestyImg3' || bodyRegionId == 'modestyImg2') {
1868 - //do nothing 1868 + $scope.modestyImageInfo.push(
  1869 +
  1870 + {
  1871 + "bodyRegionId": bodyRegionId, "SRC": src,
  1872 + "Height": h,
  1873 + "Width": w,
  1874 + "x": x,
  1875 + "y": y,
  1876 + "haveMirror": 'false'
  1877 + }
  1878 +
  1879 + );
1869 } 1880 }
1870 else { 1881 else {
1871 1882
@@ -3858,7 +3869,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -3858,7 +3869,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
3858 if (document.getElementById('tempCanvas') != null) { 3869 if (document.getElementById('tempCanvas') != null) {
3859 $('#tempCanvas').remove(); 3870 $('#tempCanvas').remove();
3860 } 3871 }
3861 - if (document.getElementById('tempCanvas') == null) { 3872 + if (document.getElementById('tempCanvas') == null || document.getElementById('tempCanvas') == undefined) {
3862 var tempCanvas = document.createElement('canvas'); 3873 var tempCanvas = document.createElement('canvas');
3863 tempCanvas.id = 'tempCanvas'; 3874 tempCanvas.id = 'tempCanvas';
3864 // $scope.tempCanvas = transparencyCanvas.id; 3875 // $scope.tempCanvas = transparencyCanvas.id;
@@ -3873,6 +3884,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -3873,6 +3884,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
3873 document.getElementById('canvasDiv').appendChild(tempCanvas); 3884 document.getElementById('canvasDiv').appendChild(tempCanvas);
3874 } 3885 }
3875 3886
  3887 +
3876 $scope.isTransparencyActivated = true; 3888 $scope.isTransparencyActivated = true;
3877 3889
3878 var BodyRegionDictionary = $rootScope.BodyRegionCordinatesData; 3890 var BodyRegionDictionary = $rootScope.BodyRegionCordinatesData;
@@ -3904,6 +3916,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -3904,6 +3916,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
3904 transparencyCanvas.style.top = $scope.startY + "px"//y + "px"; 3916 transparencyCanvas.style.top = $scope.startY + "px"//y + "px";
3905 transparencyCanvas.style.border = "black 1px solid"; 3917 transparencyCanvas.style.border = "black 1px solid";
3906 transparencyCanvas.style.backgroundColor = "transparent"; 3918 transparencyCanvas.style.backgroundColor = "transparent";
  3919 + transparencyCanvas.style.zIndex = 200;
3907 // transparencyCanvas.style.visibility = 'hidden'; 3920 // transparencyCanvas.style.visibility = 'hidden';
3908 document.getElementById('canvasDiv').appendChild(transparencyCanvas); 3921 document.getElementById('canvasDiv').appendChild(transparencyCanvas);
3909 $scope.transparencyChangeCounter = 0; 3922 $scope.transparencyChangeCounter = 0;
@@ -3918,27 +3931,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -3918,27 +3931,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
3918 3931
3919 $(".ui-wrapper").css("z-index", "600"); 3932 $(".ui-wrapper").css("z-index", "600");
3920 3933
3921 - // $('#transparencyScale').modal('show');  
3922 -  
3923 - //canvasDiv.removeEventListener('mouseup', arguments.callee);  
3924 - //canvasDiv.removeEventListener('mousedown', arguments.callee);  
3925 - //canvasDiv.removeEventListener('mousemove', arguments.callee);  
3926 } 3934 }
3927 if ($scope.TransparencyBoxStartX <= bodyRegionRight && value.X <= transparencyBoxRight && $scope.TransparencyBoxStartY <= bodyRegionBottom && value.Y <= transparencyBoxBottom) { 3935 if ($scope.TransparencyBoxStartX <= bodyRegionRight && value.X <= transparencyBoxRight && $scope.TransparencyBoxStartY <= bodyRegionBottom && value.Y <= transparencyBoxBottom) {
3928 3936
3929 - //if ($rootScope.voId != "9") {  
3930 - // if ($rootScope.voId != "11") {  
3931 - // $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false);  
3932 3937
3933 - // }  
3934 -  
3935 - //}  
3936 -  
3937 - //else {  
3938 - // if (value.bodyRegionId == "6") {  
3939 - // $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false);  
3940 - // }  
3941 - //}  
3942 if (($rootScope.voId == "9" || $rootScope.voId == "11")) { 3938 if (($rootScope.voId == "9" || $rootScope.voId == "11")) {
3943 if (value.bodyRegionId == "6") { 3939 if (value.bodyRegionId == "6") {
3944 $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false); 3940 $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false);
@@ -3954,6 +3950,29 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -3954,6 +3950,29 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
3954 } 3950 }
3955 }) 3951 })
3956 3952
  3953 + //for modesty
  3954 + if ($rootScope.isModestyOn == true && $scope.modestyImageInfo.length > 0) {
  3955 + $.each($scope.modestyImageInfo, function (index, value) {
  3956 + // alert(' $.each(BodyRegionDictionary1')
  3957 + var transparencyBoxHeight = parseInt(TransparencyBoxEndY) - parseInt($scope.TransparencyBoxStartY);
  3958 + var transparencyBoxWidth = parseInt(TransparencyEndX) - parseInt($scope.TransparencyBoxStartX);
  3959 + var transparencyBoxBottom = parseInt($scope.TransparencyBoxStartY) + parseInt(transparencyBoxHeight);
  3960 + var transparencyBoxRight = parseInt($scope.TransparencyBoxStartX) + parseInt(transparencyBoxWidth);
  3961 + // alert(' $.each(BodyRegionDictionary2. transparencyBoxHeight: ' + transparencyBoxHeight + ',transparencyBoxBottom: ' + transparencyBoxBottom+', transparencyBoxRight: '+transparencyBoxRight)
  3962 + var bodyRegionRight = parseInt(value.x) + parseInt(value.Width);
  3963 + var bodyRegionBottom = parseInt(value.y) + parseInt(value.Height);
  3964 +
  3965 + if ($scope.TransparencyBoxStartX <= bodyRegionRight && value.x <= transparencyBoxRight && $scope.TransparencyBoxStartY <= bodyRegionBottom && value.y <= transparencyBoxBottom) {
  3966 +
  3967 + $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.x, value.y, value.IsMirror, $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false);
  3968 +
  3969 + }
  3970 + })
  3971 + }
  3972 +
  3973 +
  3974 + //
  3975 +
3957 // $('#transparencyScale').modal('show'); 3976 // $('#transparencyScale').modal('show');
3958 $('#transparencyScale').css('position', 'fixed') 3977 $('#transparencyScale').css('position', 'fixed')
3959 $('#transparencyScale').css('top', $scope.TBDrawStartY - 10) 3978 $('#transparencyScale').css('top', $scope.TBDrawStartY - 10)
@@ -3963,8 +3982,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -3963,8 +3982,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
3963 3982
3964 3983
3965 3984
3966 - document.getElementById('canvasDiv').removeEventListener("mousedown", mouseUpListener);  
3967 - document.getElementById('canvasDiv').removeEventListener("mousemove", mouseUpListener); 3985 + document.getElementById('canvasDiv').removeEventListener("mousedown", mouseDownListener);
  3986 + document.getElementById('canvasDiv').removeEventListener("mousemove", mouseMoveListener);
3968 3987
3969 document.getElementById('canvasDiv').removeEventListener("mouseup", mouseUpListener); 3988 document.getElementById('canvasDiv').removeEventListener("mouseup", mouseUpListener);
3970 // document.getElementById('canvasDiv').removeEventListener("mousemove", mouseMoveListener); 3989 // document.getElementById('canvasDiv').removeEventListener("mousemove", mouseMoveListener);
@@ -3982,6 +4001,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -3982,6 +4001,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
3982 4001
3983 $scope.loadTransparencyImage = function (bodyRegionId, Height, Width, X, Y, IsMirror, TransparencyBoxStartX, TransparencyEndX, TransparencyBoxStartY, TransparencyBoxEndY, scope, isLayerChanged, isTransparencyChanged) { 4002 $scope.loadTransparencyImage = function (bodyRegionId, Height, Width, X, Y, IsMirror, TransparencyBoxStartX, TransparencyEndX, TransparencyBoxStartY, TransparencyBoxEndY, scope, isLayerChanged, isTransparencyChanged) {
3984 // debugger; 4003 // debugger;
  4004 +
  4005 + // else {
  4006 +
3985 var scope1 = angular.element(document.getElementById("DAView")).scope(); 4007 var scope1 = angular.element(document.getElementById("DAView")).scope();
3986 var transparencyCanvas = document.getElementById('transparencyCanvas'); 4008 var transparencyCanvas = document.getElementById('transparencyCanvas');
3987 4009
@@ -4007,11 +4029,16 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4007,11 +4029,16 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4007 var transparencyTempCanvas; 4029 var transparencyTempCanvas;
4008 4030
4009 4031
  4032 +
4010 //X ends outside and start outside of bodyregion 4033 //X ends outside and start outside of bodyregion
4011 if (TransparencyBoxStartX < X && TransparencyEndX > parseInt(X) + parseInt(Width)) { 4034 if (TransparencyBoxStartX < X && TransparencyEndX > parseInt(X) + parseInt(Width)) {
4012 XforCopyImage = 0; 4035 XforCopyImage = 0;
4013 WidthforCopyImage = Width; 4036 WidthforCopyImage = Width;
4014 WidthforTransImage = Width; 4037 WidthforTransImage = Width;
  4038 + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {
  4039 + XforTransImage = 0;
  4040 + }
  4041 + else
4015 XforTransImage = parseInt(X) - (parseInt(TransparencyBoxStartX)); 4042 XforTransImage = parseInt(X) - (parseInt(TransparencyBoxStartX));
4016 // alert('1') 4043 // alert('1')
4017 } 4044 }
@@ -4024,6 +4051,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4024,6 +4051,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4024 WidthforTransImage = parseInt(TransparencyEndX) - parseInt(X); 4051 WidthforTransImage = parseInt(TransparencyEndX) - parseInt(X);
4025 4052
4026 // alert(' scope.WidthforCopyImage: ' + scope.WidthforCopyImage) 4053 // alert(' scope.WidthforCopyImage: ' + scope.WidthforCopyImage)
  4054 + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {
  4055 + XforTransImage = 0;
  4056 + }
  4057 + else
4027 XforTransImage = parseInt(X) - (parseInt(TransparencyBoxStartX)); 4058 XforTransImage = parseInt(X) - (parseInt(TransparencyBoxStartX));
4028 4059
4029 // alert('2') 4060 // alert('2')
@@ -4034,6 +4065,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4034,6 +4065,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4034 XforCopyImage = parseInt(TransparencyBoxStartX) - parseInt(X); 4065 XforCopyImage = parseInt(TransparencyBoxStartX) - parseInt(X);
4035 WidthforCopyImage = parseInt(X) + parseInt(Width) - parseInt(TransparencyBoxStartX); 4066 WidthforCopyImage = parseInt(X) + parseInt(Width) - parseInt(TransparencyBoxStartX);
4036 WidthforTransImage = parseInt(X) + parseInt(Width) - parseInt(TransparencyBoxStartX); 4067 WidthforTransImage = parseInt(X) + parseInt(Width) - parseInt(TransparencyBoxStartX);
  4068 +
  4069 + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {
  4070 +
  4071 + XforTransImage = parseInt(TransparencyBoxStartX) - parseInt(X);
  4072 + }
  4073 + else
4037 XforTransImage = 0; 4074 XforTransImage = 0;
4038 // alert('3') 4075 // alert('3')
4039 } 4076 }
@@ -4042,7 +4079,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4042,7 +4079,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4042 XforCopyImage = parseInt(TransparencyBoxStartX) - parseInt(X);//parseInt(X) + parseInt(Width) - parseInt(scope.TransparencyBoxStartX)// scope.TransparencyBoxStartX ; 4079 XforCopyImage = parseInt(TransparencyBoxStartX) - parseInt(X);//parseInt(X) + parseInt(Width) - parseInt(scope.TransparencyBoxStartX)// scope.TransparencyBoxStartX ;
4043 WidthforCopyImage = parseInt(TransparencyEndX) - parseInt(TransparencyBoxStartX); 4080 WidthforCopyImage = parseInt(TransparencyEndX) - parseInt(TransparencyBoxStartX);
4044 WidthforTransImage = parseInt(TransparencyEndX) - parseInt(TransparencyBoxStartX); 4081 WidthforTransImage = parseInt(TransparencyEndX) - parseInt(TransparencyBoxStartX);
4045 - XforTransImage = 0 4082 + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {
  4083 +
  4084 + XforTransImage = parseInt(TransparencyBoxStartX) - parseInt(X);
  4085 + }
  4086 + else
  4087 + XforTransImage = 0;
4046 // alert('4. TransparencyBoxStartX: ' + TransparencyBoxStartX + ',X: ' + parseInt(X) + ',TransparencyEndX: ' + TransparencyEndX + ',XforCopyImage: ' + XforCopyImage) 4088 // alert('4. TransparencyBoxStartX: ' + TransparencyBoxStartX + ',X: ' + parseInt(X) + ',TransparencyEndX: ' + TransparencyEndX + ',XforCopyImage: ' + XforCopyImage)
4047 } 4089 }
4048 4090
@@ -4058,7 +4100,11 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4058,7 +4100,11 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4058 4100
4059 HeightforTransImage = Height; 4101 HeightforTransImage = Height;
4060 //alert('Y ' + Y) 4102 //alert('Y ' + Y)
4061 - YforTransImage = parseFloat(Y) - parseInt(TransparencyBoxStartY)//parseFloat(Y) - (24.4); 4103 + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {
  4104 + YforTransImage = 0;
  4105 + }
  4106 + else
  4107 + YforTransImage = parseFloat(Y) - parseInt(TransparencyBoxStartY)//parseFloat(Y) - (24.4);
4062 // alert('5') 4108 // alert('5')
4063 } 4109 }
4064 else if (TransparencyBoxStartY < Y && TransparencyBoxEndY < (parseInt(Y) + parseInt(Height))) { 4110 else if (TransparencyBoxStartY < Y && TransparencyBoxEndY < (parseInt(Y) + parseInt(Height))) {
@@ -4068,6 +4114,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4068,6 +4114,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4068 4114
4069 HeightforTransImage = (parseInt(TransparencyBoxEndY)) - parseInt(Y)// - parseInt(scope.TransparencyBoxStartY)); 4115 HeightforTransImage = (parseInt(TransparencyBoxEndY)) - parseInt(Y)// - parseInt(scope.TransparencyBoxStartY));
4070 4116
  4117 + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {
  4118 + YforTransImage = 0;
  4119 + }
  4120 + else
4071 YforTransImage = parseFloat(Y) - parseInt(TransparencyBoxStartY);// - (24.4); 4121 YforTransImage = parseFloat(Y) - parseInt(TransparencyBoxStartY);// - (24.4);
4072 4122
4073 } 4123 }
@@ -4076,7 +4126,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4076,7 +4126,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4076 YforCopyImage = parseInt(TransparencyBoxStartY) - parseInt(Y); 4126 YforCopyImage = parseInt(TransparencyBoxStartY) - parseInt(Y);
4077 HeightforCopyImage = parseInt(Y) + parseInt(Height) - parseInt(TransparencyBoxStartY); 4127 HeightforCopyImage = parseInt(Y) + parseInt(Height) - parseInt(TransparencyBoxStartY);
4078 HeightforTransImage = parseInt(Y) + parseInt(Height) - parseInt(TransparencyBoxStartY); 4128 HeightforTransImage = parseInt(Y) + parseInt(Height) - parseInt(TransparencyBoxStartY);
4079 - YforTransImage = 0; 4129 + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {
  4130 + YforTransImage = parseInt(TransparencyBoxStartY) - parseInt(Y);
  4131 +
  4132 + }
  4133 + else
  4134 + YforTransImage = 0;
4080 4135
4081 } 4136 }
4082 else if (TransparencyBoxStartY > Y && TransparencyBoxEndY < parseInt(Y) + parseInt(Height)) { 4137 else if (TransparencyBoxStartY > Y && TransparencyBoxEndY < parseInt(Y) + parseInt(Height)) {
@@ -4084,149 +4139,139 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4084,149 +4139,139 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4084 YforCopyImage = parseInt(TransparencyBoxStartY) - parseInt(Y); 4139 YforCopyImage = parseInt(TransparencyBoxStartY) - parseInt(Y);
4085 HeightforCopyImage = parseInt(TransparencyBoxEndY) - parseInt(TransparencyBoxStartY); 4140 HeightforCopyImage = parseInt(TransparencyBoxEndY) - parseInt(TransparencyBoxStartY);
4086 HeightforTransImage = parseInt(TransparencyBoxEndY) - parseInt(TransparencyBoxStartY); 4141 HeightforTransImage = parseInt(TransparencyBoxEndY) - parseInt(TransparencyBoxStartY);
4087 - YforTransImage = 0;  
4088 - }  
4089 -  
4090 -  
4091 - //this changes the transparency when user click on transparency scale(we have already set the original  
4092 - //data on tras canvas irrespective of the trans number, so we can chnage the transparnecy of original data not the manipulated)  
4093 - if (isTransparencyChanged == true) {  
4094 -  
4095 - // var txtTransparencyChange = document.getElementById("txtTransparencyChange");  
4096 -  
4097 - var transNumber = $scope.transNumber;  
4098 -  
4099 - var ctx = document.getElementById('transparencyCanvas').getContext('2d');  
4100 -  
4101 - var imageDa = ctx.getImageData(XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage);  
4102 -  
4103 - // get the image data values  
4104 - var imageData = imageDa.data;  
4105 - var length = imageData.length;  
4106 - // set every fourth value to 50  
4107 - for (var i = 3; i < length; i += 4) {  
4108 - //NIKITA  
4109 - if ($scope.voId == "9" || $scope.voId == "11") {  
4110 -  
4111 - if (imageData[i] == 0) {  
4112 -  
4113 - }  
4114 - else {  
4115 - imageData[i] = ((255) * (parseInt(transNumber))) / 100;  
4116 - }  
4117 - }  
4118 - else {  
4119 - imageData[i] = ((255) * (parseInt(transNumber))) / 100;  
4120 - } 4142 + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {
  4143 + YforTransImage = parseInt(TransparencyBoxStartY) - parseInt(Y);
4121 4144
4122 - // imageData[i] = ((255) * (parseInt(transNumber))) / 100;  
4123 } 4145 }
4124 - // after the manipulation, reset the data  
4125 - // imageDa.data = imageData;  
4126 - // and put the imagedata back to the canvas  
4127 - ctx.putImageData(imageDa, XforTransImage, YforTransImage); 4146 + else
  4147 + YforTransImage = 0;
  4148 + }
4128 4149
4129 4150
  4151 + //0. get current layer number
  4152 + if ($scope.isResized) {
  4153 + //do nothing
4130 } 4154 }
4131 - else { 4155 + else if (isLayerChanged) {
4132 4156
4133 - //0. get current layer number  
4134 - if ($scope.isResized) {  
4135 - //do nothing  
4136 - }  
4137 - else if (isLayerChanged) {  
4138 4157
4139 - // alert('isMousUp on isLayerChanged'); 4158 + }
  4159 + else {
4140 4160
4141 - //$scope.layerNumber = parseInt($('#txtlayerNumber').val());  
4142 4161
4143 - }  
4144 - else {  
4145 - //var currentLayer = parseInt($('#txtlayerNumber').val()); 4162 + var tranparencyLayer;
4146 4163
4147 - //var tranparencyLayer = currentLayer + 1;  
4148 - //$scope.layerNumber = tranparencyLayer; 4164 + var currentLayer = $scope.layerNumberBeforeTrans;
4149 4165
4150 - var tranparencyLayer; 4166 + if (currentLayer == $rootScope.totalLayers) {
4151 4167
4152 - //var currentLayer = parseInt($('#txtlayerNumber').val());  
4153 - var currentLayer = $scope.layerNumberBeforeTrans; 4168 + tranparencyLayer = currentLayer;
4154 4169
4155 - if (currentLayer == $rootScope.totalLayers) { 4170 + }
4156 4171
4157 - tranparencyLayer = currentLayer; 4172 + else {
4158 4173
4159 - } 4174 + tranparencyLayer = currentLayer + 1;
4160 4175
4161 - else { 4176 + }
4162 4177
4163 - tranparencyLayer = currentLayer + 1; 4178 + $scope.layerNumber = tranparencyLayer;
4164 4179
4165 - } 4180 + }
4166 4181
4167 - $scope.layerNumber = tranparencyLayer; 4182 + $('#txtlayerNumber').val($scope.layerNumber);
4168 4183
4169 - } 4184 + //dedebugger;
  4185 + var tranparencyImgSrc;
  4186 + var tranparencyMaskImgSrc;
  4187 + //for modesty image
  4188 + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg')))// == "2" || bodyRegionId == "3")) {
  4189 + {
  4190 + var modestyBodyRegionData = new jinqJs()
  4191 + .from($scope.modestyImageInfo)
  4192 + .where('bodyRegionId == ' + bodyRegionId)
  4193 + .select();
  4194 + tranparencyImgSrc = modestyBodyRegionData[0].SRC;
  4195 + }
4170 4196
4171 - $('#txtlayerNumber').val($scope.layerNumber); 4197 + //modesty end
4172 4198
4173 - //dedebugger;  
4174 //1. get the image source 4199 //1. get the image source
4175 - var tranparencyImgSrc;  
4176 4200
  4201 + else {
4177 tranparencyImgSrc = $scope.GetImageSource(bodyRegionId); 4202 tranparencyImgSrc = $scope.GetImageSource(bodyRegionId);
4178 - var tranparencyMaskImgSrc = $scope.GetMaskImageSource(tranparencyImgSrc);  
4179 - // debugger;  
4180 - var oldCanvas;  
4181 -  
4182 - if (IsMirror == 'Yes') {  
4183 - oldCanvas = document.getElementById('transparencyTempCanvas_MR_' + bodyRegionId)  
4184 - }  
4185 - else {  
4186 - oldCanvas = document.getElementById('transparencyTempCanvas_' + bodyRegionId) 4203 + tranparencyMaskImgSrc = $scope.GetMaskImageSource(tranparencyImgSrc);
  4204 + }
  4205 + // var tranparencyMaskImgSrc = $scope.GetMaskImageSource(tranparencyImgSrc);
  4206 + // debugger;
  4207 + var oldCanvas;
4187 4208
4188 - } 4209 + if (IsMirror == 'Yes') {
  4210 + oldCanvas = document.getElementById('transparencyTempCanvas_MR_' + bodyRegionId)
  4211 + }
  4212 + else {
  4213 + //if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {
  4214 + // oldCanvas = document.getElementById('modestyTransparencyTempCanvas_' + bodyRegionId);
  4215 + //}
  4216 + //else {
  4217 + oldCanvas = document.getElementById('transparencyTempCanvas_' + bodyRegionId)
  4218 + //}
  4219 + }
4189 4220
4190 - if (oldCanvas != null) {  
4191 - document.getElementById('canvasDiv').removeChild(oldCanvas);  
4192 - } 4221 + if (oldCanvas != null) {
  4222 + document.getElementById('canvasDiv').removeChild(oldCanvas);
  4223 + }
4193 4224
4194 - //remove tempmask canvas  
4195 - var oldtempTransCanvasMask;  
4196 - if (IsMirror == 'Yes') {  
4197 - oldtempTransCanvasMask = document.getElementById('transparencyTempCanvasMask_MR_' + bodyRegionId + '_mci');  
4198 - }  
4199 - else {  
4200 - oldtempTransCanvasMask = document.getElementById('transparencyTempCanvasMask_' + bodyRegionId + '_mci'); 4225 + //remove tempmask canvas
  4226 + var oldtempTransCanvasMask;
  4227 + if (IsMirror == 'Yes') {
  4228 + oldtempTransCanvasMask = document.getElementById('transparencyTempCanvasMask_MR_' + bodyRegionId + '_mci');
  4229 + }
  4230 + else {
  4231 + oldtempTransCanvasMask = document.getElementById('transparencyTempCanvasMask_' + bodyRegionId + '_mci');
4201 4232
4202 - }  
4203 - if (oldtempTransCanvasMask != null) {  
4204 - document.getElementById('canvasDiv').removeChild(oldtempTransCanvasMask);  
4205 - } 4233 + }
  4234 + if (oldtempTransCanvasMask != null) {
  4235 + document.getElementById('canvasDiv').removeChild(oldtempTransCanvasMask);
  4236 + }
4206 4237
4207 - transparencyTempCanvas = document.createElement('canvas');  
4208 - var transparencyTempcanavsMask = document.createElement('canvas');  
4209 - //if mirror then draw mask image for non mirrored body region for annotation  
4210 - if (IsMirror == 'Yes') {  
4211 - transparencyTempCanvas.id = 'transparencyTempCanvas_MR_' + bodyRegionId;  
4212 - transparencyTempcanavsMask.id = 'transparencyTempCanvasMask_MR' + bodyRegionId + '_mci'; 4238 + transparencyTempCanvas = document.createElement('canvas');
  4239 + var transparencyTempcanavsMask = document.createElement('canvas');
  4240 + //if mirror then draw mask image for non mirrored body region for annotation
  4241 + if (IsMirror == 'Yes') {
  4242 + transparencyTempCanvas.id = 'transparencyTempCanvas_MR_' + bodyRegionId;
  4243 + transparencyTempcanavsMask.id = 'transparencyTempCanvasMask_MR' + bodyRegionId + '_mci';
  4244 + }
  4245 + else {
  4246 + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {
  4247 + transparencyTempCanvas.id = 'transparencyTempCanvas_' + bodyRegionId;
  4248 + // transparencyTempCanvas.style.visibility = 'visible';
  4249 + //transparencyTempCanvas.style.zIndex = '1000'
4213 } 4250 }
4214 else { 4251 else {
4215 transparencyTempCanvas.id = 'transparencyTempCanvas_' + bodyRegionId; 4252 transparencyTempCanvas.id = 'transparencyTempCanvas_' + bodyRegionId;
4216 transparencyTempcanavsMask.id = 'transparencyTempCanvasMask_' + bodyRegionId + '_mci'; 4253 transparencyTempcanavsMask.id = 'transparencyTempCanvasMask_' + bodyRegionId + '_mci';
4217 -  
4218 } 4254 }
4219 - transparencyTempCanvas.height = Height;  
4220 - transparencyTempCanvas.width = Width;  
4221 - transparencyTempCanvas.style.position = "absolute";  
4222 - transparencyTempCanvas.style.left = X + 'px' // x + "px";  
4223 - transparencyTempCanvas.style.top = Y + "px"//y + "px";  
4224 - transparencyTempCanvas.style.visibility = 'hidden';  
4225 - //transparencyTempCanvas.style.visibility = 'visible';  
4226 - // transparencyCanvas.style.zIndex = 4000;  
4227 - document.getElementById('canvasDiv').appendChild(transparencyTempCanvas);  
4228 4255
4229 - //create temp mask canvas 4256 + }
  4257 + transparencyTempCanvas.height = Height;
  4258 + transparencyTempCanvas.width = Width;
  4259 + transparencyTempCanvas.style.position = "absolute";
  4260 + transparencyTempCanvas.style.left = X + 'px' // x + "px";
  4261 + transparencyTempCanvas.style.top = Y + "px"//y + "px";
  4262 + //if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {
  4263 + // transparencyTempCanvas.style.visibility = 'visible';
  4264 + //}
  4265 + //else {
  4266 + transparencyTempCanvas.style.visibility = 'hidden';
  4267 + // }
  4268 + //transparencyTempCanvas.style.visibility = 'visible';
  4269 + // transparencyCanvas.style.zIndex = 4000;
  4270 + document.getElementById('canvasDiv').appendChild(transparencyTempCanvas);
  4271 +
  4272 + //create temp mask canvas
  4273 + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) { }
  4274 + else {
4230 transparencyTempcanavsMask.height = Height; 4275 transparencyTempcanavsMask.height = Height;
4231 transparencyTempcanavsMask.width = Width; 4276 transparencyTempcanavsMask.width = Width;
4232 transparencyTempcanavsMask.style.position = "absolute"; 4277 transparencyTempcanavsMask.style.position = "absolute";
@@ -4236,14 +4281,57 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4236,14 +4281,57 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4236 //transparencyTempCanvas.style.visibility = 'visible'; 4281 //transparencyTempCanvas.style.visibility = 'visible';
4237 // transparencyCanvas.style.border = "black 1px solid"; 4282 // transparencyCanvas.style.border = "black 1px solid";
4238 document.getElementById('canvasDiv').appendChild(transparencyTempcanavsMask); 4283 document.getElementById('canvasDiv').appendChild(transparencyTempcanavsMask);
  4284 + }
  4285 +
  4286 + //for modesty canvas
  4287 + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {
  4288 +
  4289 + var modestyTransTempCanvasId = 'tempCanvasModesty_' + bodyRegionId;
  4290 + var modestyTransCanvasId = 'modestyTransCanavs_' + bodyRegionId;
  4291 + if (document.getElementById(modestyTransTempCanvasId) != null) {
  4292 + document.getElementById(modestyTransTempCanvasId).parentNode.removeChild(document.getElementById(modestyTransTempCanvasId));
  4293 + }
4239 4294
  4295 + if (document.getElementById(modestyTransTempCanvasId) == null || document.getElementById(modestyTransTempCanvasId) == undefined) {
  4296 + var tempCanvasModesty = document.createElement('canvas');
  4297 + tempCanvasModesty.id = modestyTransTempCanvasId;
  4298 + // $scope.tempCanvas = transparencyCanvas.id;
  4299 + tempCanvasModesty.height = Height;
  4300 + tempCanvasModesty.width = Width;
  4301 + tempCanvasModesty.style.position = "absolute";
  4302 + tempCanvasModesty.style.left = 10 + 'px';
  4303 + tempCanvasModesty.style.top = 10 + 'px';
  4304 + tempCanvasModesty.style.backgroundColor = "transparent";
  4305 + tempCanvasModesty.style.visibility = 'hidden';
  4306 + tempCanvasModesty.style.border = "black 1px solid";
  4307 + document.getElementById('canvasDiv').appendChild(tempCanvasModesty);
  4308 + }
  4309 + if (document.getElementById(modestyTransCanvasId) != null) {
  4310 + document.getElementById(modestyTransCanvasId).parentNode.removeChild(document.getElementById(modestyTransCanvasId));
  4311 + }
  4312 +
  4313 + if (document.getElementById(modestyTransCanvasId) == null || document.getElementById(modestyTransCanvasId) == undefined) {
  4314 + var canvasModesty = document.createElement('canvas');
  4315 + canvasModesty.id = modestyTransCanvasId;
  4316 + // $scope.tempCanvas = transparencyCanvas.id;
  4317 + canvasModesty.height = Height;
  4318 + canvasModesty.width = Width;
  4319 + canvasModesty.style.position = "absolute";
  4320 + canvasModesty.style.left = X + 'px';
  4321 + canvasModesty.style.top = Y + 'px';
  4322 + //canvasModesty.style.backgroundColor = "transparent";
  4323 + canvasModesty.style.visibility = 'visible';
  4324 + canvasModesty.style.zIndex = '2000'
  4325 + // tempcanvasModestyCanvasModesty.style.border = "black 1px solid";
  4326 + document.getElementById('canvasDiv').appendChild(canvasModesty);
  4327 + }
  4328 + }
4240 4329
  4330 + if (tranparencyImgSrc != undefined) {
4241 var tempImg = new Image(); 4331 var tempImg = new Image();
4242 - tempImg.src = tranparencyImgSrc;//"http://localhost/AIA/" + tranparencyImgSrc;  
4243 4332
4244 4333
4245 tempImg.onload = function () { 4334 tempImg.onload = function () {
4246 - // debugger;  
4247 var tempCtx = transparencyTempCanvas.getContext('2d'); 4335 var tempCtx = transparencyTempCanvas.getContext('2d');
4248 4336
4249 if (IsMirror == 'Yes') { 4337 if (IsMirror == 'Yes') {
@@ -4264,7 +4352,11 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4264,7 +4352,11 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4264 tempCanvasID = 'transparencyTempCanvas_MR_' + bodyRegionId; 4352 tempCanvasID = 'transparencyTempCanvas_MR_' + bodyRegionId;
4265 } 4353 }
4266 else { 4354 else {
4267 - tempCanvasID = 'transparencyTempCanvas_' + bodyRegionId; 4355 + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {
  4356 + tempCanvasID = 'transparencyTempCanvas_' + bodyRegionId;//bodyRegionId;
  4357 + }
  4358 + else
  4359 + tempCanvasID = 'transparencyTempCanvas_' + bodyRegionId;
4268 } 4360 }
4269 4361
4270 4362
@@ -4282,11 +4374,31 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4282,11 +4374,31 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4282 4374
4283 //keep the original image on temp canavs to use it in changing transparency 4375 //keep the original image on temp canavs to use it in changing transparency
4284 4376
4285 - if (document.getElementById('tempCanvas') != null) {  
4286 - var contx = document.getElementById('tempCanvas').getContext('2d');  
4287 - var tbTempCanvas = document.getElementById(tempCanvasID)  
4288 - contx.drawImage(tbTempCanvas, XforCopyImage, YforCopyImage, WidthforCopyImage, HeightforCopyImage, XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage);  
4289 4377
  4378 +
  4379 + //if (document.getElementById(modestyTransTempCanvasId) != undefined || document.getElementById(modestyTransTempCanvasId) != null) {
  4380 + // var contxModesty = document.getElementById(modestyTransTempCanvasId).getContext('2d');
  4381 + // var tbTempCanvas = document.getElementById(tempCanvasID)
  4382 + // contx.drawImage(tbTempCanvas, XforCopyImage, YforCopyImage, WidthforCopyImage, HeightforCopyImage, XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage);
  4383 +
  4384 + //}
  4385 + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {
  4386 + var modestyTempCanvasId = 'tempCanvasModesty_' + bodyRegionId;
  4387 + if (document.getElementById(modestyTempCanvasId) != undefined || document.getElementById(modestyTempCanvasId) != null) {
  4388 + var contxModesty = document.getElementById(modestyTempCanvasId).getContext('2d');
  4389 + var tbTempCanvas = document.getElementById(tempCanvasID)
  4390 + contxModesty.drawImage(tbTempCanvas, XforCopyImage, YforCopyImage, WidthforCopyImage, HeightforCopyImage, XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage);
  4391 +
  4392 + }
  4393 + }
  4394 + else {
  4395 +
  4396 + if (document.getElementById('tempCanvas') != null && document.getElementById('tempCanvas') != undefined) {
  4397 + var contx = document.getElementById('tempCanvas').getContext('2d');
  4398 + var tbTempCanvas = document.getElementById(tempCanvasID)
  4399 + contx.drawImage(tbTempCanvas, XforCopyImage, YforCopyImage, WidthforCopyImage, HeightforCopyImage, XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage);
  4400 +
  4401 + }
4290 } 4402 }
4291 4403
4292 // get the image data values 4404 // get the image data values
@@ -4309,15 +4421,24 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4309,15 +4421,24 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4309 } 4421 }
4310 } 4422 }
4311 else { 4423 else {
4312 - imageData[i] = ((255) * (parseInt(transNumber))) / 100; 4424 + if (imageData[i] == 0) {
  4425 +
  4426 + }
  4427 + else {
  4428 + imageData[i] = ((255) * (parseInt(transNumber))) / 100;
  4429 + }
4313 } 4430 }
4314 } 4431 }
4315 4432
4316 4433
4317 tempCtx.putImageData(imageD, 0, 0); 4434 tempCtx.putImageData(imageD, 0, 0);
4318 4435
4319 -  
4320 - var ctx = transparencyCanvas.getContext('2d'); 4436 + var ctx;
  4437 + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {
  4438 + ctx = document.getElementById(modestyTransCanvasId).getContext('2d');
  4439 + }
  4440 + else
  4441 + ctx = transparencyCanvas.getContext('2d');
4321 4442
4322 4443
4323 var TrtempCanvasID 4444 var TrtempCanvasID
@@ -4325,6 +4446,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4325,6 +4446,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4325 TrtempCanvasID = 'transparencyTempCanvas_MR_' + bodyRegionId; 4446 TrtempCanvasID = 'transparencyTempCanvas_MR_' + bodyRegionId;
4326 } 4447 }
4327 else { 4448 else {
  4449 + //if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {
  4450 + // TrtempCanvasID = 'modestyTransparencyTempCanvas_' + bodyRegionId;
  4451 + //}
  4452 + //else
4328 TrtempCanvasID = 'transparencyTempCanvas_' + bodyRegionId; 4453 TrtempCanvasID = 'transparencyTempCanvas_' + bodyRegionId;
4329 } 4454 }
4330 4455
@@ -4344,47 +4469,138 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4344,47 +4469,138 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4344 PreviousBodyRegionHeight = 0; 4469 PreviousBodyRegionHeight = 0;
4345 4470
4346 } 4471 }
  4472 + tempImg.src = tranparencyImgSrc;//"http://localhost/AIA/" + tranparencyImgSrc;
4347 4473
  4474 + }
4348 4475
4349 - //mask image code  
4350 - //draw mask for annotation  
4351 - var tempMaskImg = new Image();  
4352 - var tranparencyMaskImgSrc = $scope.GetMaskImageSource(tranparencyImgSrc);  
4353 - tempMaskImg.src = tranparencyMaskImgSrc;//"http://localhost/AIA/" + tranparencyMaskImgSrc;  
4354 - tempMaskImg.onload = function () {  
4355 - // debugger;  
4356 - var tempmaskCtx = transparencyTempcanavsMask.getContext('2d');  
4357 -  
4358 - if (IsMirror == 'Yes') {  
4359 - //debugger;  
4360 - tempmaskCtx.save();  
4361 - tempmaskCtx.translate(Width, 0);  
4362 - tempmaskCtx.scale(-1, 1);  
4363 - tempmaskCtx.drawImage(tempMaskImg, 0, 0);  
4364 - }  
4365 - else {  
4366 - tempmaskCtx.drawImage(tempMaskImg, 0, 0);  
4367 4476
4368 - } 4477 + //mask image code
  4478 + //draw mask for annotation
  4479 + var tempMaskImg = new Image();
  4480 + var tranparencyMaskImgSrc = $scope.GetMaskImageSource(tranparencyImgSrc);
  4481 + tempMaskImg.src = tranparencyMaskImgSrc;//"http://localhost/AIA/" + tranparencyMaskImgSrc;
  4482 + tempMaskImg.onload = function () {
  4483 + // debugger;
  4484 + var tempmaskCtx = transparencyTempcanavsMask.getContext('2d');
4369 4485
  4486 + if (IsMirror == 'Yes') {
  4487 + //debugger;
  4488 + tempmaskCtx.save();
  4489 + tempmaskCtx.translate(Width, 0);
  4490 + tempmaskCtx.scale(-1, 1);
  4491 + tempmaskCtx.drawImage(tempMaskImg, 0, 0);
  4492 + }
  4493 + else {
  4494 + tempmaskCtx.drawImage(tempMaskImg, 0, 0);
4370 4495
4371 } 4496 }
4372 4497
4373 4498
4374 - PreviousBodyRegionHeight = HeightforTransImage;  
4375 - PreviousBodyRegionY = YforTransImage;  
4376 - PreviousBodyRegionWidth = WidthforTransImage;  
4377 - PreviousBodyRegionX = XforTransImage;  
4378 - previousBodyRegionId = bodyRegionId; 4499 + }
4379 4500
4380 - // $scope.layerNumber = parseInt($scope.layerNumber - 1);  
4381 4501
4382 - } 4502 + PreviousBodyRegionHeight = HeightforTransImage;
  4503 + PreviousBodyRegionY = YforTransImage;
  4504 + PreviousBodyRegionWidth = WidthforTransImage;
  4505 + PreviousBodyRegionX = XforTransImage;
  4506 + previousBodyRegionId = bodyRegionId;
  4507 +
  4508 + // $scope.layerNumber = parseInt($scope.layerNumber - 1);
  4509 +
  4510 + //}
4383 4511
4384 } 4512 }
4385 4513
  4514 + $scope.changeTransparency = function () {
  4515 + //this changes the transparency when user click on transparency scale(we have already set the original
  4516 + //data on tras canvas irrespective of the trans number, so we can chnage the transparnecy of original data not the manipulated)
  4517 + // if (isTransparencyChanged == true) {
4386 4518
  4519 + // var txtTransparencyChange = document.getElementById("txtTransparencyChange");
4387 4520
  4521 + var transNumber = $scope.transNumber;
  4522 +
  4523 + var modestyTransCanvases = $("canvas[id*='modestyTransCanavs']");
  4524 + var modestyTemCanvas = $("canvas[id*='tempCanvasModesty_']");
  4525 + if (modestyTransCanvases != null || modestyTransCanvases != undefined && modestyTransCanvases.length > 0) {
  4526 +
  4527 + for (var j = 0; j < modestyTransCanvases.length; j++) {
  4528 + var ctx = document.getElementById(modestyTransCanvases[j].id).getContext('2d');
  4529 + var imageDa = ctx.getImageData(0, 0, modestyTransCanvases[j].width, modestyTransCanvases[j].height);
  4530 + //modestyTransCanvases[j].parentNode.removeChild(modestyTransCanvases[j]);
  4531 +
  4532 + var imageData = imageDa.data;
  4533 + var length = imageData.length;
  4534 + // set every fourth value to 50
  4535 + for (var i = 3; i < length; i += 4) {
  4536 + //NIKITA
  4537 + if ($scope.voId == "9" || $scope.voId == "11") {
  4538 +
  4539 + if (imageData[i] == 0) {
  4540 +
  4541 + }
  4542 + else {
  4543 + imageData[i] = ((255) * (parseInt(transNumber))) / 100;
  4544 + }
  4545 + }
  4546 + else {
  4547 + if (imageData[i] == 0) {
  4548 +
  4549 + }
  4550 + else
  4551 + imageData[i] = ((255) * (parseInt(transNumber))) / 100;
  4552 + }
  4553 +
  4554 + // imageData[i] = ((255) * (parseInt(transNumber))) / 100;
  4555 + }
  4556 + // after the manipulation, reset the data
  4557 + // imageDa.data = imageData;
  4558 + // and put the imagedata back to the canvas
  4559 + //ctx.putImageData(imageDa, XforTransImage, YforTransImage);
  4560 + ctx.putImageData(imageDa, 0, 0);
  4561 + }
  4562 + }
  4563 +
  4564 +
  4565 + var ctx = document.getElementById('transparencyCanvas').getContext('2d');
  4566 +
  4567 + // var imageDa = ctx.getImageData(XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage);
  4568 + var imageDa = ctx.getImageData(0, 0, $scope.transparencyCanvasWidth, $scope.transparencyCanvasHeight);
  4569 +
  4570 + // get the image data values
  4571 + var imageData = imageDa.data;
  4572 + var length = imageData.length;
  4573 + // set every fourth value to 50
  4574 + for (var i = 3; i < length; i += 4) {
  4575 + //NIKITA
  4576 + if ($scope.voId == "9" || $scope.voId == "11") {
  4577 +
  4578 + if (imageData[i] == 0) {
  4579 +
  4580 + }
  4581 + else {
  4582 + imageData[i] = ((255) * (parseInt(transNumber))) / 100;
  4583 + }
  4584 + }
  4585 + else {
  4586 + if (imageData[i] == 0) {
  4587 +
  4588 + }
  4589 + else
  4590 + imageData[i] = ((255) * (parseInt(transNumber))) / 100;
  4591 + }
  4592 +
  4593 + // imageData[i] = ((255) * (parseInt(transNumber))) / 100;
  4594 + }
  4595 + // after the manipulation, reset the data
  4596 + // imageDa.data = imageData;
  4597 + // and put the imagedata back to the canvas
  4598 + //ctx.putImageData(imageDa, XforTransImage, YforTransImage);
  4599 + ctx.putImageData(imageDa, 0, 0);
  4600 +
  4601 +
  4602 + //}
  4603 + }
4388 4604
4389 4605
4390 4606
@@ -4414,6 +4630,22 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4414,6 +4630,22 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4414 } 4630 }
4415 4631
4416 4632
  4633 + var modestyTransCanvases = $("canvas[id*='modestyTransCanavs']");
  4634 + if (modestyTransCanvases != null || modestyTransCanvases != undefined && modestyTransCanvases.length > 0) {
  4635 + for (var j = 0; j < modestyTransCanvases.length; j++) {
  4636 +
  4637 + modestyTransCanvases[j].parentNode.removeChild(modestyTransCanvases[j]);
  4638 + }
  4639 + }
  4640 +
  4641 + var modestyTempCanvases = $("canvas[id*='tempCanvasModesty_']");
  4642 + if (modestyTempCanvases != null || modestyTransCanvases != undefined && modestyTransCanvases.length > 0) {
  4643 + for (var j = 0; j < modestyTempCanvases.length; j++) {
  4644 +
  4645 + modestyTempCanvases[j].parentNode.removeChild(modestyTempCanvases[j]);
  4646 + }
  4647 + }
  4648 +
4417 $scope.isResized = true; 4649 $scope.isResized = true;
4418 4650
4419 4651
@@ -4429,10 +4661,16 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4429,10 +4661,16 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4429 transparencyCanvas.style.left = tCanvas.style.left; // x + "px"; 4661 transparencyCanvas.style.left = tCanvas.style.left; // x + "px";
4430 transparencyCanvas.style.top = tCanvas.style.top//y + "px"; 4662 transparencyCanvas.style.top = tCanvas.style.top//y + "px";
4431 transparencyCanvas.style.border = "black 1px solid"; 4663 transparencyCanvas.style.border = "black 1px solid";
  4664 + transparencyCanvas.style.zIndex = 200;
  4665 +
  4666 +
4432 document.getElementById('canvasDiv').appendChild(transparencyCanvas); 4667 document.getElementById('canvasDiv').appendChild(transparencyCanvas);
4433 4668
4434 $('#transparencyCanvas').resizable({ handles: "e,s,se,w,n,ne,nw,sw", stop: function (event, ui) { resizeCanvas(); }, start: function (event, ui) { clearTransCanvas(); } }); 4669 $('#transparencyCanvas').resizable({ handles: "e,s,se,w,n,ne,nw,sw", stop: function (event, ui) { resizeCanvas(); }, start: function (event, ui) { clearTransCanvas(); } });
  4670 + $(".ui-wrapper").css("z-index", "600");
4435 4671
  4672 + //bind click listener
  4673 + transparencyCanvas.addEventListener('click', TransparencyCanvasClickListener);
4436 } 4674 }
4437 $scope.transparencyCanvasHeight = tCanvasHeight; 4675 $scope.transparencyCanvasHeight = tCanvasHeight;
4438 $scope.transparencyCanvasWidth = tCanvasWidth; 4676 $scope.transparencyCanvasWidth = tCanvasWidth;
@@ -4483,17 +4721,39 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4483,17 +4721,39 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4483 4721
4484 4722
4485 }) 4723 })
4486 - //bind click listener  
4487 - //bind click listener  
4488 - transparencyCanvas.addEventListener('click', TransparencyCanvasClickListener);  
4489 4724
4490 4725
  4726 + //for modesty
  4727 + if ($rootScope.isModestyOn == true && $scope.modestyImageInfo.length > 0) {
  4728 + $.each($scope.modestyImageInfo, function (index, value) {
  4729 + // alert(' $.each(BodyRegionDictionary1')
  4730 +
  4731 +
  4732 + var bodyRegionRight = parseInt(value.x) + parseInt(value.Width);
  4733 + var bodyRegionBottom = parseInt(value.y) + parseInt(value.Height);
  4734 + var TBRight = parseInt((document.getElementById('transparencyCanvas').style.left).replace('px', '')) + parseInt((document.getElementById('transparencyCanvas').style.width).replace('px', ''));
  4735 + var TBBottom = parseInt((document.getElementById('transparencyCanvas').style.top).replace('px', '')) + parseInt((document.getElementById('transparencyCanvas').style.height).replace('px', ''));
  4736 + var TBStartX = parseInt((document.getElementById('transparencyCanvas').style.left).replace('px', ''));
  4737 + var TBStartY = parseInt((document.getElementById('transparencyCanvas').style.top).replace('px', ''));
  4738 +
  4739 +
  4740 +
  4741 +
  4742 + if (TBStartX <= bodyRegionRight && value.x <= TBRight && TBStartY <= bodyRegionBottom && value.y <= TBBottom) {
  4743 +
  4744 +
  4745 + $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.x, value.y, value.IsMirror, $scope.TransparencyBoxStartX, $scope.TransparencyEndX, $scope.TransparencyBoxStartY, $scope.TransparencyBoxEndY, $scope, false, false);
  4746 +
  4747 + }
  4748 + })
  4749 + }
4491 4750
4492 // }); 4751 // });
4493 - $(".ui-wrapper").css("z-index", "600"); 4752 + //$(".ui-wrapper").css("z-index", "600");
4494 $scope.isResized = false; 4753 $scope.isResized = false;
4495 } 4754 }
4496 4755
  4756 +
4497 function TransparencyCanvasClickListener(evt) { 4757 function TransparencyCanvasClickListener(evt) {
4498 //alert('tb clicked') 4758 //alert('tb clicked')
4499 // debugger; 4759 // debugger;
@@ -4583,33 +4843,41 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4583,33 +4843,41 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4583 4843
4584 4844
4585 //debugger; 4845 //debugger;
4586 - var oldMirrorMaskId = 'transparencyTempCanvasMask_' + clickedBodyRegion + '_mci';  
4587 - var oldMirrorMask = document.getElementById(oldMirrorMaskId);  
4588 - if (oldMirrorMask != null) {  
4589 - document.getElementById('canvasDiv').removeChild(oldMirrorMask); 4846 + var maskCanvasId = 'transparencyTempCanvasMask_' + clickedBodyRegion + '_mci';
  4847 + var maskCanvas = document.getElementById(maskCanvasId);
  4848 + //if (oldMirrorMask != null) {
  4849 + // document.getElementById('canvasDiv').removeChild(oldMirrorMask);
  4850 + //}
  4851 + if (maskCanvas != null) {
  4852 + x = maskCanvas.style.left;
  4853 + y = maskCanvas.style.top;
  4854 + }
  4855 + if (maskCanvas == null) {
  4856 + var transparencyTempcanavsMask = document.createElement('canvas');
  4857 + transparencyTempcanavsMask.id = 'transparencyTempCanvasMask_' + clickedBodyRegion + '_mci';
  4858 + transparencyTempcanavsMask.height = nomMirroredBodyRegion[0].Height;
  4859 + transparencyTempcanavsMask.width = nomMirroredBodyRegion[0].Width;
  4860 + transparencyTempcanavsMask.style.position = "absolute";
  4861 + transparencyTempcanavsMask.style.left = nomMirroredBodyRegion[0].X + 'px' // x + "px";
  4862 + transparencyTempcanavsMask.style.top = nomMirroredBodyRegion[0].Y + "px"//y + "px";
  4863 + transparencyTempcanavsMask.style.visibility = 'hidden';
  4864 +
  4865 + document.getElementById('canvasDiv').appendChild(transparencyTempcanavsMask);
  4866 +
  4867 + var tranparencyImgSrc = $scope.GetImageSource(clickedBodyRegion);
  4868 + var tempMaskImg = new Image();
  4869 + var tranparencyMaskImgSrc = $scope.GetMaskImageSource(tranparencyImgSrc);
  4870 + tempMaskImg.onload = function () {
  4871 + var transparencyTempcanavsMask = document.getElementById(maskCanvasId);
  4872 + var tempmaskCtx = transparencyTempcanavsMask.getContext('2d');
  4873 + tempmaskCtx.drawImage(tempMaskImg, 0, 0);
  4874 +
  4875 + //get x,y of non mirrored canvas for this body region
  4876 + x = transparencyTempcanavsMask.style.left;
  4877 + y = transparencyTempcanavsMask.style.top;
  4878 + }
  4879 + tempMaskImg.src = "http://localhost/AIAHtml/" + tranparencyMaskImgSrc;
4590 } 4880 }
4591 - var transparencyTempcanavsMask = document.createElement('canvas');  
4592 - transparencyTempcanavsMask.id = 'transparencyTempCanvasMask_' + clickedBodyRegion + '_mci';  
4593 - transparencyTempcanavsMask.height = nomMirroredBodyRegion[0].Height;  
4594 - transparencyTempcanavsMask.width = nomMirroredBodyRegion[0].Width;  
4595 - transparencyTempcanavsMask.style.position = "absolute";  
4596 - transparencyTempcanavsMask.style.left = nomMirroredBodyRegion[0].X + 'px' // x + "px";  
4597 - transparencyTempcanavsMask.style.top = nomMirroredBodyRegion[0].Y + "px"//y + "px";  
4598 - transparencyTempcanavsMask.style.visibility = 'hidden';  
4599 -  
4600 - document.getElementById('canvasDiv').appendChild(transparencyTempcanavsMask);  
4601 -  
4602 - var tranparencyImgSrc = $scope.GetImageSource(clickedBodyRegion);  
4603 - var tempMaskImg = new Image();  
4604 - var tranparencyMaskImgSrc = $scope.GetMaskImageSource(tranparencyImgSrc);  
4605 - tempMaskImg.onload = function () {  
4606 - var tempmaskCtx = transparencyTempcanavsMask.getContext('2d');  
4607 - tempmaskCtx.drawImage(tempMaskImg, 0, 0);  
4608 -  
4609 - //get x,y of non mirrored canvas for this body region  
4610 - x = transparencyTempcanavsMask.style.left;  
4611 - y = transparencyTempcanavsMask.style.top;  
4612 -  
4613 var maskCanvasTransId = 'transparencyTempCanvasMask_' + clickedBodyRegion + '_mci'; 4881 var maskCanvasTransId = 'transparencyTempCanvasMask_' + clickedBodyRegion + '_mci';
4614 var maskCanvastrans = document.getElementById(maskCanvasTransId); 4882 var maskCanvastrans = document.getElementById(maskCanvasTransId);
4615 var maskCanvasContexttrans = maskCanvastrans.getContext("2d"); 4883 var maskCanvasContexttrans = maskCanvastrans.getContext("2d");
@@ -4633,8 +4901,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4633,8 +4901,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4633 var clickedCanvasMaskId = 'imageCanvas' + clickedBodyRegion + '_mci'; 4901 var clickedCanvasMaskId = 'imageCanvas' + clickedBodyRegion + '_mci';
4634 var maskCanvas = document.getElementById(clickedCanvasMaskId); 4902 var maskCanvas = document.getElementById(clickedCanvasMaskId);
4635 var maskCanvasContext = maskCanvas.getContext("2d"); 4903 var maskCanvasContext = maskCanvas.getContext("2d");
4636 - var imgX = Math.round(actulalX - parseInt(x.replace('px', '')));  
4637 - var imgY = Math.round(actualY - parseInt(y.replace('px', ''))); 4904 + var imgX = Math.round(actulalX - parseInt(x));//.replace('px', '')));
  4905 + var imgY = Math.round(actualY - parseInt(y));//.replace('px', '')));
4638 pixelData = maskCanvasContext.getImageData(imgX, imgY, 1, 1); 4906 pixelData = maskCanvasContext.getImageData(imgX, imgY, 1, 1);
4639 4907
4640 4908
@@ -4668,9 +4936,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4668,9 +4936,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4668 $scope.annotationTextArrayT2.push(annotations.annotationT2); 4936 $scope.annotationTextArrayT2.push(annotations.annotationT2);
4669 4937
4670 $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, false); 4938 $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, false);
4671 - }  
4672 - tempMaskImg.src = "http://localhost/AIAHtml/" + tranparencyMaskImgSrc;  
4673 - 4939 +
4674 4940
4675 } 4941 }
4676 4942
@@ -4849,25 +5115,24 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4849,25 +5115,24 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4849 ctx.putImageData(originalTransparencyData, 0, 0); 5115 ctx.putImageData(originalTransparencyData, 0, 0);
4850 5116
4851 5117
4852 - var BodyRegionDictionary = $rootScope.BodyRegionCordinatesData;  
4853 -  
4854 - $scope.IncludedBodyRegions = [];  
4855 - var counter = 0;  
4856 - $.each(BodyRegionDictionary, function (index, value) {  
4857 -  
4858 - var bodyRegionRight = parseInt(value.X) + parseInt(value.Width);  
4859 - var bodyRegionBottom = parseInt(value.Y) + parseInt(value.Height);  
4860 -  
4861 - 5118 + //for modesty
4862 5119
4863 - if (tBoxStartX <= bodyRegionRight && value.X <= transparencyBoxRight && tBoxStartY <= bodyRegionBottom && value.Y <= transparencyBoxBottom) { 5120 + //for modesty
  5121 + if ($rootScope.isModestyOn == true && $scope.modestyImageInfo.length > 0) {
  5122 + $.each($scope.modestyImageInfo, function (index, value) {
4864 5123
4865 - $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, $scope.TransparencyBoxStartX, $scope.TransparencyEndX, $scope.TransparencyBoxStartY, $scope.TransparencyBoxEndY, $scope, false, true); 5124 + var brId = value.bodyRegionId;
4866 5125
4867 - }  
4868 -  
4869 - }); 5126 + var modestyTransTempCanvasId = 'tempCanvasModesty_' + brId;
  5127 + var modestyTransCanvasId = 'modestyTransCanavs_' + brId;
  5128 + var tempCanvasContext = document.getElementById(modestyTransTempCanvasId).getContext('2d');
  5129 + var originalTransparencyData = tempCanvasContext.getImageData(0, 0, value.Width, value.Height);
  5130 + var ctx = document.getElementById(modestyTransCanvasId).getContext('2d');
  5131 + ctx.putImageData(originalTransparencyData, 0, 0);
  5132 + })
  5133 + }
4870 5134
  5135 + $scope.changeTransparency();
4871 5136
4872 5137
4873 // }); 5138 // });
@@ -4875,9 +5140,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4875,9 +5140,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4875 5140
4876 $scope.CloseTransparencyBox = function () { 5141 $scope.CloseTransparencyBox = function () {
4877 5142
4878 - 5143 +
4879 //To enable extract button 5144 //To enable extract button
4880 - $scope.isTransparencyActivated = false; 5145 + $scope.isTransparencyActivated = false;
4881 $("#btnExtract").removeClass("disabled"); 5146 $("#btnExtract").removeClass("disabled");
4882 5147
4883 //$('.com_anno').css('display', 'none'); 5148 //$('.com_anno').css('display', 'none');
@@ -4921,7 +5186,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4921,7 +5186,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4921 //var scope = angular.element(document.getElementById("DAView")).scope(); 5186 //var scope = angular.element(document.getElementById("DAView")).scope();
4922 //scope.$apply(function () { 5187 //scope.$apply(function () {
4923 // $scope.layerNumber = 0; 5188 // $scope.layerNumber = 0;
4924 - // $scope.isTransparencyActivated = false; 5189 + // $scope.isTransparencyActivated = false;
4925 //}) 5190 //})
4926 5191
4927 5192
@@ -4938,6 +5203,16 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4938,6 +5203,16 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4938 $scope.transNumber = 50; 5203 $scope.transNumber = 50;
4939 $(".slider").slider({ value: 50 }) 5204 $(".slider").slider({ value: 50 })
4940 } 5205 }
  5206 +
  5207 +
  5208 + var modestyTransCanvases = $("canvas[id*='modestyTransCanavs']");
  5209 + if (modestyTransCanvases != null || modestyTransCanvases != undefined && modestyTransCanvases.length > 0) {
  5210 + for (var j = 0; j < modestyTransCanvases.length; j++) {
  5211 +
  5212 + modestyTransCanvases[j].parentNode.removeChild(modestyTransCanvases[j]);
  5213 + }
  5214 + }
  5215 +
4941 $('#transparencyScale').css('visibility', 'hidden'); 5216 $('#transparencyScale').css('visibility', 'hidden');
4942 5217
4943 //$scope.isTransparencyActivated = false; 5218 //$scope.isTransparencyActivated = false;
@@ -4994,6 +5269,48 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4994,6 +5269,48 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4994 }) 5269 })
4995 }; 5270 };
4996 5271
  5272 + $scope.createSpeechBubbleOnTransparencyBox = function (event, text1, text2, x, y) {
  5273 +
  5274 + $('#canvasDiv').css('cursor', 'pointer');
  5275 + $('<div id="speechBubbleTrns" class="BubbleDiv" style="display:visible; top:' + y + 'px; left:' + x + 'px;z-index:700"> <div class="">'
  5276 + + '<div class="Bubble">'
  5277 + + '<div class="BubbleCloseBtn"></div><div class="BubbleContent">' + text1 + '</div><div class="BubbleContent">' + text2 + '</div><div class="bottomLeftArrow"></div>'
  5278 + //+'<div class="bottomRightArrow"></div><div class="topLeftArrow"></div><div class="topRightArrow"></div>
  5279 + + '</div></div></div>').appendTo('#canvasDiv');
  5280 +
  5281 + $('#speechBubbleTrns').on('click', '.BubbleCloseBtn', function (e) {
  5282 + $('#speechBubbleTrns').css('display', 'none');
  5283 + });
  5284 +
  5285 + $('#canvasDiv').attr("data-bubbleid", "speechBubble")
  5286 +
  5287 +
  5288 + };
  5289 +
  5290 +
  5291 + function positionTooltip(event, x, y) {
  5292 + // alert('positionTooltip')
  5293 + x = 100,
  5294 + y = 200,
  5295 +
  5296 + $('div.speech-bubble').css({
  5297 + 'position': 'absolute', 'top': x, 'left': y, 'background-color': '#f8f8f8',
  5298 + 'border': '2px solid #c8c8c8', 'width': '150px', 'height': '50px'
  5299 + });
  5300 +
  5301 +
  5302 + $('.arrow').css({
  5303 + 'border-style': 'solid',
  5304 + 'position': 'absolute'
  5305 + });
  5306 +
  5307 + $('.bottom').css({
  5308 + 'border-color': '#c8c8c8 transparent transparent transparent',
  5309 + 'border-width': ' 8px 8px 0px 8px',
  5310 + 'bottom': -'8px'
  5311 + })
  5312 + };
  5313 +
4997 5314
4998 $scope.IdentityClick = function () { 5315 $scope.IdentityClick = function () {
4999 5316