diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index e95d411..3291621 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -49,6 +49,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $rootScope.updatedGrayMRDataList = []; $scope.isEligibleForHighlight = false; $scope.doHighlightOrExtract = false; + $scope.isClickedOnBodyForHighlight; $scope.isEligibleForHighlightBodyByTermList = false; // $scope.AnteriorView = "active"; @@ -1426,7 +1427,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } // $rootScope.previousHighlightList.push(RGBColor); - + $scope.isClickedOnBodyForHighlight = true; $scope.highLightBodyBasedOnIcolor(RGBColor); } @@ -1804,6 +1805,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo if (maskCanvasId.match('modestyImg') && RGBColor != '000000') { } else { + $scope.isClickedOnBodyForHighlight = true; $scope.highLightBodyBasedOnIcolor(RGBColor); } @@ -2308,7 +2310,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo console.log('HighlightBodyByTermList is called'); - // $scope.highlightedBR = null; $scope.highlightedBR = []; $scope.terminateCurrentlyRunningWPs(); @@ -2426,10 +2427,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //push workers in array to further used the refernece to delete the workers $scope.runningWorkers.push({ 'workerName': worker }) - // console.log('for bodyRegionId = ' + bodyRegionId+ ', time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")) console.log('before worker call BRID: ' + bodyRegionId) - if (grayImageDataVar != null && coloredImageDataVar != null && maskData != null) { + if (grayImageDataVar != null && coloredImageDataVar != null && maskData != null && TermList != undefined && TermList.length > 0) { worker.postMessage({ 'termList': TermList, @@ -2441,7 +2441,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo }); } - + else { + $('#spinner').css('visibility', 'hidden') + $rootScope.isLoading = false; + } worker.onmessage = function (e) { @@ -2452,18 +2455,15 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo var bodyRegionId = e.data.bodyRegionId; var canvasId = (e.data.canvasId).replace('_mci', ''); - //for (var i = 1; i <= updatedData.length; i++) { var grayCanvasID = canvasId; - //to do + var grayCanvas = document.getElementById(grayCanvasID); if (grayCanvas != null) { var grayCanvasContext = grayCanvas.getContext("2d"); - //Niki remove previous data from canvas var canvasHeight = grayCanvas.height + 'px'; var canvasWidth = grayCanvas.width + 'px'; - //alert('height= ' + canvasHeight + ', width= ' + canvasWidth) grayCanvasContext.clearRect(0, 0, canvasHeight, canvasWidth) grayCanvasContext.putImageData(updatedData, 0, 0); @@ -2476,14 +2476,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo if (canvasId.match('_MR')) { $rootScope.updatedGrayMRDataList[bodyRegionId] = updatedData; - //alert('HighlightBodyByTermList, is mutiAnnotation on= ' + $rootScope.multiAnnotationIsON); - - //$rootScope.updatedWhiteImageMRDataList[bodyRegionId] = updatedData; } else $rootScope.updatedGrayDataList[bodyRegionId - 1] = updatedData; - //$scope.highlightedBR.push({ 'bodyRegionId': bodyRegionId }); console.log('$scope.highlightedBR.length= ' + $scope.highlightedBR.length) @@ -2503,34 +2499,48 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } if ($scope.doAligneCanvasWithTerm == true) { - if ($rootScope.isListManagerSelected == true) + if ($rootScope.isListManagerSelected == true) { $scope.aligneCanvasWithTerm(); + } + else if ($rootScope.previousHighlightList != undefined && $rootScope.previousHighlightList.length > 0 && ($scope.isGenderChnage == true || $scope.isViewChange == true)) { + var canvasDiv = document.getElementById('canvasDiv'); + if ($rootScope.viewOrientationId == '1' || $rootScope.viewOrientationId == '4') { - else if ($rootScope.isHighlightBodyByBodySystem == true || $rootScope.isListManagerSelected == true) { + $('#canvasDiv').scrollLeft($('#canvasDiv').width() / 2) + var canvasDiv = document.getElementById('canvasDiv'); + $('#canvasDiv').scrollTop($scope.imageVerticalScrollPosition); + } + else { + $('#canvasDiv').scrollTop($scope.imageVerticalScrollPosition); + $('#canvasDiv').scrollLeft($scope.imageHorizontlScrollPosition); + $rootScope.isLoading = false; + } + $('#spinner').css('visibility', 'hidden'); + } + else if ($rootScope.isHighlightBodyByBodySystem == true || $rootScope.isListManagerSelected == true || $scope.isClickedOnBodyForHighlight + ) { $rootScope.isLoading = false; $('#spinner').css('visibility', 'hidden'); } + else { + var canvasDiv = document.getElementById('canvasDiv'); $('#canvasDiv').scrollTop($scope.imageVerticalScrollPosition); $('#canvasDiv').scrollLeft($scope.imageHorizontlScrollPosition); + // } $rootScope.isLoading = false; $('#spinner').css('visibility', 'hidden'); - //$('#canvasDiv').scrollLeft(newX); - //$('#canvasDiv').scrollTop(newY); + } - - // $rootScope.isHighlightBodyByBodySystem = false; - - + } } - // - + }; worker.onerror = function (e) { alert('Error: Line ' + e.lineno + ' in ' + e.filename + ': ' + e.message); @@ -6167,18 +6177,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo var coloredImageData = coloredCanvasContext.getImageData(0, 0, width, ht); var coloredImageDataVar = coloredImageData; - - //if (value.haveMirror == 'true') { - // $rootScope.coloredImageMRCanvasList[parseInt(value.bodyRegionId)] = coloredImageDataVar; - //} - //else { - - - // $rootScope.coloredImageCanvasList[parseInt(value.bodyRegionId - 1)] = coloredImageDataVar; - - //} - - + var context_gray = imageCanvas.getContext('2d'); var dataURL = imageCanvas.toDataURL(); @@ -6224,7 +6223,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo context_gray.putImageData(DAData.data, 0, 0) - //NIKI- to resolve lateral arm black issue in highlight mode + //to resolve lateral arm black issue in highlight mode if ($rootScope.viewOrientationId == 5 && (value.bodyRegionId == 6 || value.bodyRegionId == 4)) { @@ -6291,13 +6290,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } if ($scope.isEligibleForHighlightBodyByTermList == true) { - //DISABLE PROGERSS BAR FOR GENDER OR VIEW CHANGE - // if ($rootScope.isGenderChnage == true || $rootScope.isViewChange == true) { - //$scope.isLoading = false; - - //$('#spinner').css('visibility', 'hidden'); - //} - + if (($rootScope.isHighlightBodyByBodySystem == true) && ($scope.systemMatchedTermList != null || $scope.systemMatchedTermList != undefined)) { @@ -6321,6 +6314,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo else if (($rootScope.previousHighlightList != null || $rootScope.previousHighlightList != undefined) && $rootScope.previousHighlightList.length > 0) { $scope.createTermListByPreviousTermsAndHighlight(); } + else { + $scope.isLoading = false; + $('#spinner').css('visibility', 'hidden'); + } } @@ -6713,7 +6710,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo }) $scope.loadSelectedBodyView = function (currentBodyViewId) { - + //remove transaprency scale if ($('#transparencyScale') != null) { @@ -6753,18 +6750,22 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo function (result) { $rootScope.TermNumberData = result; - var canDiv = document.getElementById('canvasDiv'); - var canDivChildCount = canDiv.childElementCount; - if (canDivChildCount > 0) { - canDiv.innerHTML = ''; - } //if user seelcted any term and serached before gender cnage then itshould be highlighted in chnaged gender - if ((($rootScope.isListManagerSelected == true) || ($rootScope.isHighLight == true && $rootScope.previousHighlightList != null && $rootScope.previousHighlightList.length > 0)) && (($rootScope.isGenderChnage == true) || $rootScope.isViewChange == true)) { + if ((($rootScope.isListManagerSelected == true) || + ($rootScope.isHighLight == true && $rootScope.previousHighlightList != null + && $rootScope.previousHighlightList.length > 0)) + && (($rootScope.isGenderChnage == true) || $rootScope.isViewChange == true)) { $scope.setLayerNumberAndHighlightByTermList(); } + else if ($rootScope.previousHighlightList != null && $rootScope.previousHighlightList.length > 0 && + ($rootScope.isGenderChnage == true || $rootScope.isViewChange == true)) { + + $rootScope.isHighLight = true + $scope.setLayerNumberAndHighlightByTermList(); + } else { @@ -6827,11 +6828,14 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } $scope.layerNumber = 0; - // debugger; - //var selectedViewId = $scope.bodyViews[event.currentTarget.attributes[1].value]; - var selectedViewId = $scope.bodyViews[event.currentTarget.title]; + //remove existing body view + $scope.flushCanvas(); + + + var selectedViewId = $scope.bodyViews[event.currentTarget.title]; $rootScope.viewOrientationId = selectedViewId; + if (localStorage.getItem("genderId") == 'Male') { if ($rootScope.voId != selectedViewId) { if (selectedViewId == 5) { @@ -6850,6 +6854,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //1. first update the currentbodyviewid in local storage localStorage.setItem("currentBodyViewId", $rootScope.voId); + //2. Load selected body view $scope.loadSelectedBodyView($rootScope.voId); @@ -7912,7 +7917,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo else { newX = maxHScrollPos; } - //alert('newX= ' + newX + ',newY= ' + newY) $('#canvasDiv').scrollLeft(newX); $('#canvasDiv').scrollTop(newY); $scope.isLoading = false; @@ -7922,6 +7926,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $rootScope.CanvasDivTopPosition = $("#canvasDiv").scrollTop(); $rootScope.CanvasDivLeftPosition = $("#canvasDiv").scrollLeft(); + $scope.isLoading = false; + $('#spinner').css('visibility', 'hidden'); + }