Commit 98d24e4f8be70b65e021fb40b1828f9c34ced933

Authored by Nikita Kulshreshtha
1 parent 00a807c8

resolved the bug. now the modesty image in TB only shown if it exists on current layer.

400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
@@ -15,6 +15,11 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -15,6 +15,11 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
15 $rootScope.BodyLayerData; 15 $rootScope.BodyLayerData;
16 $rootScope.VocabTermData; 16 $rootScope.VocabTermData;
17 17
  18 + //for modesty image layers
  19 + $scope.lowerlayerNumberForModesty;
  20 + $scope.HigherlayerNumberForModesty;
  21 + $scope.layerInfoForModesty;
  22 +
18 $scope.VocabTermTxt; 23 $scope.VocabTermTxt;
19 $scope.CommonData 24 $scope.CommonData
20 $rootScope.TermNumberData; 25 $rootScope.TermNumberData;
@@ -771,7 +776,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -771,7 +776,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
771 776
772 //calculate coordinates for body region images 777 //calculate coordinates for body region images
773 $scope.CalculateImageCordinates = function (viewOrientationId) { 778 $scope.CalculateImageCordinates = function (viewOrientationId) {
774 - 779 + $scope.layerInfoForModesty = [];
775 $rootScope.isLoading = true; 780 $rootScope.isLoading = true;
776 $('#spinner').css('visibility', 'visible'); 781 $('#spinner').css('visibility', 'visible');
777 $scope.modestyImageInfo = []; 782 $scope.modestyImageInfo = [];
@@ -787,17 +792,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -787,17 +792,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
787 792
788 } 793 }
789 794
790 - //duplicate code  
791 - //if ($("#canvasDiv").find("canvas[id='canvasPaint']").length == 0) {  
792 -  
793 - // var $layerChange = $("#canvasDiv").append('<canvas id="canvasPaint" width="2277" ng-click="FreeStylePaint($event)" height="3248" class="canvas-annotationStyle1"></canvas><canvas id="canvas" width="2277" height="3248" class="canvas-annotationStyle"></canvas>');  
794 - // $compile($layerChange)($scope);  
795 - // $scope.onDrawingCanvasClick();  
796 - // // $rootScope.FreeStylePaint();  
797 -  
798 - //}  
799 -  
800 -  
801 795
802 $scope.terminateCurrentlyRunningWPs(); 796 $scope.terminateCurrentlyRunningWPs();
803 797
@@ -978,9 +972,13 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -978,9 +972,13 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
978 if ((dtlOfSktn != null || dtlOfSktn != undefined) && (dtlOfSktn.length > 0)) { 972 if ((dtlOfSktn != null || dtlOfSktn != undefined) && (dtlOfSktn.length > 0)) {
979 973
980 if ((parseInt(dtlOfSktn[0]._lns) <= parseInt($scope.layerNumber)) && (parseInt(dtlOfSktn[0]._lne) > parseInt($scope.layerNumber)) && (dtlOfSktn[0]._isfr == 'Y')) { 974 if ((parseInt(dtlOfSktn[0]._lns) <= parseInt($scope.layerNumber)) && (parseInt(dtlOfSktn[0]._lne) > parseInt($scope.layerNumber)) && (dtlOfSktn[0]._isfr == 'Y')) {
  975 +
981 $scope.figLaefImageName = dtlOfSktn[0]._ImageId; 976 $scope.figLaefImageName = dtlOfSktn[0]._ImageId;
982 - //$scope.figLaefX = filtereddata[0]._X;  
983 - //$scope.figLaefY = filtereddata[0]._Y; 977 +
  978 +
  979 + $scope.lowerlayerNumberForModesty = dtlOfSktn[0]._lns;
  980 + $scope.HigherlayerNumberForModesty = dtlOfSktn[0]._lne;
  981 + $scope.layerInfoForModesty.push({ "bodyRegionId": value._BodyRegionId, "lowerlayerNumberForModesty": $scope.lowerlayerNumberForModesty, "HigherlayerNumberForModesty": $scope.HigherlayerNumberForModesty })
984 982
985 var rectangle = scaleRectangle(value._X, value._Y, value._Height, value._Width, value._MirrorValue); 983 var rectangle = scaleRectangle(value._X, value._Y, value._Height, value._Width, value._MirrorValue);
986 984
@@ -4445,13 +4443,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4445,13 +4443,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4445 //keep the original image on temp canavs to use it in changing transparency 4443 //keep the original image on temp canavs to use it in changing transparency
4446 4444
4447 4445
4448 -  
4449 - //if (document.getElementById(modestyTransTempCanvasId) != undefined || document.getElementById(modestyTransTempCanvasId) != null) {  
4450 - // var contxModesty = document.getElementById(modestyTransTempCanvasId).getContext('2d');  
4451 - // var tbTempCanvas = document.getElementById(tempCanvasID)  
4452 - // contx.drawImage(tbTempCanvas, XforCopyImage, YforCopyImage, WidthforCopyImage, HeightforCopyImage, XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage);  
4453 -  
4454 - //}  
4455 if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) { 4446 if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {
4456 var modestyTempCanvasId = 'tempCanvasModesty_' + bodyRegionId; 4447 var modestyTempCanvasId = 'tempCanvasModesty_' + bodyRegionId;
4457 if (document.getElementById(modestyTempCanvasId) != undefined || document.getElementById(modestyTempCanvasId) != null) { 4448 if (document.getElementById(modestyTempCanvasId) != undefined || document.getElementById(modestyTempCanvasId) != null) {
@@ -4541,6 +4532,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4541,6 +4532,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4541 } 4532 }
4542 tempImg.src = tranparencyImgSrc;//"http://localhost/AIA/" + tranparencyImgSrc; 4533 tempImg.src = tranparencyImgSrc;//"http://localhost/AIA/" + tranparencyImgSrc;
4543 4534
  4535 +
4544 } 4536 }
4545 4537
4546 4538
@@ -4575,9 +4567,41 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4575,9 +4567,41 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4575 PreviousBodyRegionX = XforTransImage; 4567 PreviousBodyRegionX = XforTransImage;
4576 previousBodyRegionId = bodyRegionId; 4568 previousBodyRegionId = bodyRegionId;
4577 4569
4578 - // $scope.layerNumber = parseInt($scope.layerNumber - 1);  
4579 4570
4580 - //} 4571 + //set modesty image visiblility true/false as per layer
  4572 +
  4573 +
  4574 + var layerInfo = new jinqJs()
  4575 + .from($scope.layerInfoForModesty)
  4576 + .where('bodyRegionId == ' + bodyRegionId)
  4577 + .select();
  4578 + if (layerInfo != undefined && layerInfo.length>0){
  4579 + var lowerlayerNumberForModesty = layerInfo[0].lowerlayerNumberForModesty;
  4580 + var HigherlayerNumberForModesty = layerInfo[0].HigherlayerNumberForModesty;
  4581 +
  4582 + var modestyTransCanvases = $("canvas[id*='modestyTransCanavs']");
  4583 +
  4584 + if (modestyTransCanvases != null || modestyTransCanvases != undefined && modestyTransCanvases.length > 0) {
  4585 + for (var j = 0; j < modestyTransCanvases.length; j++) {
  4586 +
  4587 + if (modestyTransCanvases[j].id.match(bodyRegionId)) {
  4588 +
  4589 + var modestyCanavs = document.getElementById(modestyTransCanvases[j].id);
  4590 +
  4591 + if ((parseInt(lowerlayerNumberForModesty) <= parseInt($scope.layerNumber)) && (HigherlayerNumberForModesty) > parseInt($scope.layerNumber)) {
  4592 +
  4593 + modestyCanavs.style.visibility = 'visible';
  4594 + }
  4595 + else {
  4596 +
  4597 + modestyCanavs.style.visibility = 'hidden';
  4598 +
  4599 + }
  4600 + }
  4601 +
  4602 + }
  4603 + }
  4604 + }
4581 4605
4582 } 4606 }
4583 4607
@@ -5385,7 +5409,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -5385,7 +5409,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
5385 ctx.putImageData(originalTransparencyData, 0, 0); 5409 ctx.putImageData(originalTransparencyData, 0, 0);
5386 5410
5387 5411
5388 - //for modesty  
5389 5412
5390 //for modesty 5413 //for modesty
5391 if ($rootScope.isModestyOn == true && $scope.modestyImageInfo.length > 0) { 5414 if ($rootScope.isModestyOn == true && $scope.modestyImageInfo.length > 0) {
@@ -5395,10 +5418,13 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -5395,10 +5418,13 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
5395 5418
5396 var modestyTransTempCanvasId = 'tempCanvasModesty_' + brId; 5419 var modestyTransTempCanvasId = 'tempCanvasModesty_' + brId;
5397 var modestyTransCanvasId = 'modestyTransCanavs_' + brId; 5420 var modestyTransCanvasId = 'modestyTransCanavs_' + brId;
5398 - var tempCanvasContext = document.getElementById(modestyTransTempCanvasId).getContext('2d');  
5399 - var originalTransparencyData = tempCanvasContext.getImageData(0, 0, value.Width, value.Height);  
5400 - var ctx = document.getElementById(modestyTransCanvasId).getContext('2d');  
5401 - ctx.putImageData(originalTransparencyData, 0, 0); 5421 + if (document.getElementById(modestyTransTempCanvasId) != null) {
  5422 +
  5423 + var tempCanvasContext = document.getElementById(modestyTransTempCanvasId).getContext('2d');
  5424 + var originalTransparencyData = tempCanvasContext.getImageData(0, 0, value.Width, value.Height);
  5425 + var ctx = document.getElementById(modestyTransCanvasId).getContext('2d');
  5426 + ctx.putImageData(originalTransparencyData, 0, 0);
  5427 + }
5402 }) 5428 })
5403 } 5429 }
5404 5430