From 98d24e4f8be70b65e021fb40b1828f9c34ced933 Mon Sep 17 00:00:00 2001 From: nikita Date: Mon, 16 Jan 2017 17:13:05 +0530 Subject: [PATCH] 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 | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 54 insertions(+), 28 deletions(-) diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index 00e0c38..8c77396 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -15,6 +15,11 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $rootScope.BodyLayerData; $rootScope.VocabTermData; + //for modesty image layers + $scope.lowerlayerNumberForModesty; + $scope.HigherlayerNumberForModesty; + $scope.layerInfoForModesty; + $scope.VocabTermTxt; $scope.CommonData $rootScope.TermNumberData; @@ -771,7 +776,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //calculate coordinates for body region images $scope.CalculateImageCordinates = function (viewOrientationId) { - + $scope.layerInfoForModesty = []; $rootScope.isLoading = true; $('#spinner').css('visibility', 'visible'); $scope.modestyImageInfo = []; @@ -787,17 +792,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } - //duplicate code - //if ($("#canvasDiv").find("canvas[id='canvasPaint']").length == 0) { - - // var $layerChange = $("#canvasDiv").append(''); - // $compile($layerChange)($scope); - // $scope.onDrawingCanvasClick(); - // // $rootScope.FreeStylePaint(); - - //} - - $scope.terminateCurrentlyRunningWPs(); @@ -978,9 +972,13 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo if ((dtlOfSktn != null || dtlOfSktn != undefined) && (dtlOfSktn.length > 0)) { if ((parseInt(dtlOfSktn[0]._lns) <= parseInt($scope.layerNumber)) && (parseInt(dtlOfSktn[0]._lne) > parseInt($scope.layerNumber)) && (dtlOfSktn[0]._isfr == 'Y')) { + $scope.figLaefImageName = dtlOfSktn[0]._ImageId; - //$scope.figLaefX = filtereddata[0]._X; - //$scope.figLaefY = filtereddata[0]._Y; + + + $scope.lowerlayerNumberForModesty = dtlOfSktn[0]._lns; + $scope.HigherlayerNumberForModesty = dtlOfSktn[0]._lne; + $scope.layerInfoForModesty.push({ "bodyRegionId": value._BodyRegionId, "lowerlayerNumberForModesty": $scope.lowerlayerNumberForModesty, "HigherlayerNumberForModesty": $scope.HigherlayerNumberForModesty }) var rectangle = scaleRectangle(value._X, value._Y, value._Height, value._Width, value._MirrorValue); @@ -4445,13 +4443,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //keep the original image on temp canavs to use it in changing transparency - - //if (document.getElementById(modestyTransTempCanvasId) != undefined || document.getElementById(modestyTransTempCanvasId) != null) { - // var contxModesty = document.getElementById(modestyTransTempCanvasId).getContext('2d'); - // var tbTempCanvas = document.getElementById(tempCanvasID) - // contx.drawImage(tbTempCanvas, XforCopyImage, YforCopyImage, WidthforCopyImage, HeightforCopyImage, XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage); - - //} if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) { var modestyTempCanvasId = 'tempCanvasModesty_' + bodyRegionId; if (document.getElementById(modestyTempCanvasId) != undefined || document.getElementById(modestyTempCanvasId) != null) { @@ -4541,6 +4532,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } tempImg.src = tranparencyImgSrc;//"http://localhost/AIA/" + tranparencyImgSrc; + } @@ -4575,9 +4567,41 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo PreviousBodyRegionX = XforTransImage; previousBodyRegionId = bodyRegionId; - // $scope.layerNumber = parseInt($scope.layerNumber - 1); - //} + //set modesty image visiblility true/false as per layer + + + var layerInfo = new jinqJs() + .from($scope.layerInfoForModesty) + .where('bodyRegionId == ' + bodyRegionId) + .select(); + if (layerInfo != undefined && layerInfo.length>0){ + var lowerlayerNumberForModesty = layerInfo[0].lowerlayerNumberForModesty; + var HigherlayerNumberForModesty = layerInfo[0].HigherlayerNumberForModesty; + + var modestyTransCanvases = $("canvas[id*='modestyTransCanavs']"); + + if (modestyTransCanvases != null || modestyTransCanvases != undefined && modestyTransCanvases.length > 0) { + for (var j = 0; j < modestyTransCanvases.length; j++) { + + if (modestyTransCanvases[j].id.match(bodyRegionId)) { + + var modestyCanavs = document.getElementById(modestyTransCanvases[j].id); + + if ((parseInt(lowerlayerNumberForModesty) <= parseInt($scope.layerNumber)) && (HigherlayerNumberForModesty) > parseInt($scope.layerNumber)) { + + modestyCanavs.style.visibility = 'visible'; + } + else { + + modestyCanavs.style.visibility = 'hidden'; + + } + } + + } + } + } } @@ -5385,7 +5409,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo ctx.putImageData(originalTransparencyData, 0, 0); - //for modesty //for modesty if ($rootScope.isModestyOn == true && $scope.modestyImageInfo.length > 0) { @@ -5395,10 +5418,13 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo var modestyTransTempCanvasId = 'tempCanvasModesty_' + brId; var modestyTransCanvasId = 'modestyTransCanavs_' + brId; - var tempCanvasContext = document.getElementById(modestyTransTempCanvasId).getContext('2d'); - var originalTransparencyData = tempCanvasContext.getImageData(0, 0, value.Width, value.Height); - var ctx = document.getElementById(modestyTransCanvasId).getContext('2d'); - ctx.putImageData(originalTransparencyData, 0, 0); + if (document.getElementById(modestyTransTempCanvasId) != null) { + + var tempCanvasContext = document.getElementById(modestyTransTempCanvasId).getContext('2d'); + var originalTransparencyData = tempCanvasContext.getImageData(0, 0, value.Width, value.Height); + var ctx = document.getElementById(modestyTransCanvasId).getContext('2d'); + ctx.putImageData(originalTransparencyData, 0, 0); + } }) } -- libgit2 0.21.4