Commit ef69d7d61d4a50ffe5b3c5aaf46f1a4810060a4d

Authored by Nikita Kulshreshtha
1 parent 7e6d4d67

resolved 12263, 12159

400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
... ... @@ -1804,6 +1804,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1804 1804 if (maskCanvasId.match('modestyImg') && RGBColor != '000000') { }
1805 1805 else
1806 1806 {
  1807 + $scope.isClickedOnBodyForHighlight = true;
1807 1808 $scope.highLightBodyBasedOnIcolor(RGBColor);
1808 1809 }
1809 1810  
... ... @@ -2308,7 +2309,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2308 2309  
2309 2310 console.log('HighlightBodyByTermList is called');
2310 2311  
2311   - // $scope.highlightedBR = null;
2312 2312 $scope.highlightedBR = [];
2313 2313  
2314 2314 $scope.terminateCurrentlyRunningWPs();
... ... @@ -2426,10 +2426,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2426 2426 //push workers in array to further used the refernece to delete the workers
2427 2427 $scope.runningWorkers.push({ 'workerName': worker })
2428 2428  
2429   - // console.log('for bodyRegionId = ' + bodyRegionId+ ', time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"))
2430 2429 console.log('before worker call BRID: ' + bodyRegionId)
2431 2430  
2432   - if (grayImageDataVar != null && coloredImageDataVar != null && maskData != null) {
  2431 + if (grayImageDataVar != null && coloredImageDataVar != null && maskData != null && TermList != undefined && TermList.length > 0) {
2433 2432 worker.postMessage({
2434 2433  
2435 2434 'termList': TermList,
... ... @@ -2441,7 +2440,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2441 2440  
2442 2441 });
2443 2442 }
2444   -
  2443 + else {
  2444 + $('#spinner').css('visibility', 'hidden')
  2445 + $rootScope.isLoading = false;
  2446 + }
2445 2447  
2446 2448  
2447 2449 worker.onmessage = function (e) {
... ... @@ -2452,18 +2454,15 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2452 2454 var bodyRegionId = e.data.bodyRegionId;
2453 2455 var canvasId = (e.data.canvasId).replace('_mci', '');
2454 2456  
2455   - //for (var i = 1; i <= updatedData.length; i++) {
2456 2457 var grayCanvasID = canvasId;
2457 2458  
2458   - //to do
  2459 +
2459 2460 var grayCanvas = document.getElementById(grayCanvasID);
2460 2461 if (grayCanvas != null) {
2461 2462 var grayCanvasContext = grayCanvas.getContext("2d");
2462 2463  
2463   - //Niki remove previous data from canvas
2464 2464 var canvasHeight = grayCanvas.height + 'px';
2465 2465 var canvasWidth = grayCanvas.width + 'px';
2466   - //alert('height= ' + canvasHeight + ', width= ' + canvasWidth)
2467 2466 grayCanvasContext.clearRect(0, 0, canvasHeight, canvasWidth)
2468 2467  
2469 2468 grayCanvasContext.putImageData(updatedData, 0, 0);
... ... @@ -2476,14 +2475,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2476 2475 if (canvasId.match('_MR')) {
2477 2476 $rootScope.updatedGrayMRDataList[bodyRegionId] = updatedData;
2478 2477  
2479   - //alert('HighlightBodyByTermList, is mutiAnnotation on= ' + $rootScope.multiAnnotationIsON);
2480   -
2481   - //$rootScope.updatedWhiteImageMRDataList[bodyRegionId] = updatedData;
2482 2478 }
2483 2479 else
2484 2480 $rootScope.updatedGrayDataList[bodyRegionId - 1] = updatedData;
2485 2481  
2486   - //$scope.highlightedBR.push({ 'bodyRegionId': bodyRegionId });
2487 2482  
2488 2483 console.log('$scope.highlightedBR.length= ' + $scope.highlightedBR.length)
2489 2484  
... ... @@ -2503,34 +2498,48 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2503 2498 }
2504 2499 if ($scope.doAligneCanvasWithTerm == true) {
2505 2500  
2506   - if ($rootScope.isListManagerSelected == true)
  2501 + if ($rootScope.isListManagerSelected == true) {
2507 2502 $scope.aligneCanvasWithTerm();
  2503 + }
  2504 + else if ($rootScope.previousHighlightList != undefined && $rootScope.previousHighlightList.length > 0 && ($scope.isGenderChnage == true || $scope.isViewChange == true)) {
  2505 + var canvasDiv = document.getElementById('canvasDiv');
  2506 + if ($rootScope.viewOrientationId == '1' || $rootScope.viewOrientationId == '4') {
2508 2507  
2509   - else if ($rootScope.isHighlightBodyByBodySystem == true || $rootScope.isListManagerSelected == true) {
  2508 + $('#canvasDiv').scrollLeft($('#canvasDiv').width() / 2)
  2509 + var canvasDiv = document.getElementById('canvasDiv');
  2510 + $('#canvasDiv').scrollTop($scope.imageVerticalScrollPosition);
  2511 + }
  2512 + else {
  2513 + $('#canvasDiv').scrollTop($scope.imageVerticalScrollPosition);
  2514 + $('#canvasDiv').scrollLeft($scope.imageHorizontlScrollPosition);
  2515 + $rootScope.isLoading = false;
  2516 + }
  2517 + $('#spinner').css('visibility', 'hidden');
  2518 + }
  2519 + else if ($rootScope.isHighlightBodyByBodySystem == true || $rootScope.isListManagerSelected == true || $scope.isClickedOnBodyForHighlight
  2520 + ) {
2510 2521  
2511 2522 $rootScope.isLoading = false;
2512 2523  
2513 2524 $('#spinner').css('visibility', 'hidden');
2514 2525 }
  2526 +
2515 2527 else {
  2528 +
2516 2529 var canvasDiv = document.getElementById('canvasDiv');
2517 2530 $('#canvasDiv').scrollTop($scope.imageVerticalScrollPosition);
2518 2531 $('#canvasDiv').scrollLeft($scope.imageHorizontlScrollPosition);
  2532 + // }
2519 2533  
2520 2534 $rootScope.isLoading = false;
2521 2535  
2522 2536 $('#spinner').css('visibility', 'hidden');
2523   - //$('#canvasDiv').scrollLeft(newX);
2524   - //$('#canvasDiv').scrollTop(newY);
  2537 +
2525 2538 }
2526   -
2527   - // $rootScope.isHighlightBodyByBodySystem = false;
2528   -
2529   -
  2539 +
2530 2540 }
2531 2541 }
2532   - //
2533   -
  2542 +
2534 2543 };
2535 2544 worker.onerror = function (e) {
2536 2545 alert('Error: Line ' + e.lineno + ' in ' + e.filename + ': ' + e.message);
... ... @@ -6167,18 +6176,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
6167 6176 var coloredImageData = coloredCanvasContext.getImageData(0, 0, width, ht);
6168 6177 var coloredImageDataVar = coloredImageData;
6169 6178  
6170   -
6171   - //if (value.haveMirror == 'true') {
6172   - // $rootScope.coloredImageMRCanvasList[parseInt(value.bodyRegionId)] = coloredImageDataVar;
6173   - //}
6174   - //else {
6175   -
6176   -
6177   - // $rootScope.coloredImageCanvasList[parseInt(value.bodyRegionId - 1)] = coloredImageDataVar;
6178   -
6179   - //}
6180   -
6181   -
  6179 +
6182 6180 var context_gray = imageCanvas.getContext('2d');
6183 6181  
6184 6182 var dataURL = imageCanvas.toDataURL();
... ... @@ -6224,7 +6222,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
6224 6222  
6225 6223 context_gray.putImageData(DAData.data, 0, 0)
6226 6224  
6227   - //NIKI- to resolve lateral arm black issue in highlight mode
  6225 + //to resolve lateral arm black issue in highlight mode
6228 6226  
6229 6227 if ($rootScope.viewOrientationId == 5 && (value.bodyRegionId == 6 || value.bodyRegionId == 4)) {
6230 6228  
... ... @@ -6291,13 +6289,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
6291 6289 }
6292 6290  
6293 6291 if ($scope.isEligibleForHighlightBodyByTermList == true) {
6294   - //DISABLE PROGERSS BAR FOR GENDER OR VIEW CHANGE
6295   - // if ($rootScope.isGenderChnage == true || $rootScope.isViewChange == true) {
6296   - //$scope.isLoading = false;
6297   -
6298   - //$('#spinner').css('visibility', 'hidden');
6299   - //}
6300   -
  6292 +
6301 6293 if (($rootScope.isHighlightBodyByBodySystem == true) && ($scope.systemMatchedTermList != null || $scope.systemMatchedTermList != undefined)) {
6302 6294  
6303 6295  
... ... @@ -6321,6 +6313,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
6321 6313 else if (($rootScope.previousHighlightList != null || $rootScope.previousHighlightList != undefined) && $rootScope.previousHighlightList.length > 0) {
6322 6314 $scope.createTermListByPreviousTermsAndHighlight();
6323 6315 }
  6316 + else {
  6317 + $scope.isLoading = false;
  6318 + $('#spinner').css('visibility', 'hidden');
  6319 + }
6324 6320  
6325 6321 }
6326 6322  
... ... @@ -6713,7 +6709,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
6713 6709 })
6714 6710  
6715 6711 $scope.loadSelectedBodyView = function (currentBodyViewId) {
6716   -
  6712 +
6717 6713 //remove transaprency scale
6718 6714 if ($('#transparencyScale') != null) {
6719 6715  
... ... @@ -6753,18 +6749,22 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
6753 6749 function (result) {
6754 6750 $rootScope.TermNumberData = result;
6755 6751  
6756   - var canDiv = document.getElementById('canvasDiv');
6757   - var canDivChildCount = canDiv.childElementCount;
6758   - if (canDivChildCount > 0) {
6759   - canDiv.innerHTML = '';
6760   - }
6761 6752 //if user seelcted any term and serached before gender cnage then itshould be highlighted in chnaged gender
6762 6753  
6763   - if ((($rootScope.isListManagerSelected == true) || ($rootScope.isHighLight == true && $rootScope.previousHighlightList != null && $rootScope.previousHighlightList.length > 0)) && (($rootScope.isGenderChnage == true) || $rootScope.isViewChange == true)) {
  6754 + if ((($rootScope.isListManagerSelected == true) ||
  6755 + ($rootScope.isHighLight == true && $rootScope.previousHighlightList != null
  6756 + && $rootScope.previousHighlightList.length > 0))
  6757 + && (($rootScope.isGenderChnage == true) || $rootScope.isViewChange == true)) {
6764 6758  
6765 6759 $scope.setLayerNumberAndHighlightByTermList();
6766 6760  
6767 6761 }
  6762 + else if ($rootScope.previousHighlightList != null && $rootScope.previousHighlightList.length > 0 &&
  6763 + ($rootScope.isGenderChnage == true || $rootScope.isViewChange == true)) {
  6764 +
  6765 + $rootScope.isHighLight = true
  6766 + $scope.setLayerNumberAndHighlightByTermList();
  6767 + }
6768 6768  
6769 6769 else {
6770 6770  
... ... @@ -6827,11 +6827,14 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
6827 6827 }
6828 6828  
6829 6829 $scope.layerNumber = 0;
6830   - // debugger;
6831   - //var selectedViewId = $scope.bodyViews[event.currentTarget.attributes[1].value];
6832   - var selectedViewId = $scope.bodyViews[event.currentTarget.title];
6833 6830  
  6831 + //remove existing body view
  6832 + $scope.flushCanvas();
  6833 +
  6834 +
  6835 + var selectedViewId = $scope.bodyViews[event.currentTarget.title];
6834 6836 $rootScope.viewOrientationId = selectedViewId;
  6837 +
6835 6838 if (localStorage.getItem("genderId") == 'Male') {
6836 6839 if ($rootScope.voId != selectedViewId) {
6837 6840 if (selectedViewId == 5) {
... ... @@ -6850,6 +6853,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
6850 6853 //1. first update the currentbodyviewid in local storage
6851 6854 localStorage.setItem("currentBodyViewId", $rootScope.voId);
6852 6855  
  6856 +
6853 6857 //2. Load selected body view
6854 6858 $scope.loadSelectedBodyView($rootScope.voId);
6855 6859  
... ...