Commit ed7423f30d91fe5b44ac98ff78e3be84a37b2a93

Authored by Amrita Vishnoi
1 parent b51e9fdb

Refs: #4464

400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
... ... @@ -26,6 +26,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
26 26 $scope.TBDrawStartX;
27 27 $scope.TBDrawStartY;
28 28  
  29 + $scope.isHighLight = false;
  30 + $scope.coloredImageCanvasList = [];
29 31  
30 32 //array for bodyviewid correspoing to male female(used for gender change)
31 33 $scope.correspondingBodyViewIds = {
... ... @@ -445,6 +447,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
445 447 .select();
446 448 //}
447 449  
  450 + $scope.ColoredImageSRC = [];
  451 +
448 452 angular.forEach($scope.bodyRegionCoordinates, function (value, key) {
449 453  
450 454  
... ... @@ -460,6 +464,19 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
460 464 var src = $scope.GetImageSource(value._BodyRegionId);
461 465 $scope.imageSource = src;
462 466 // debugger;
  467 +
  468 + $scope.ColoredImageSRC.push(
  469 + {
  470 + "bodyRegionId": value._BodyRegionId, "SRC": src,
  471 + "Height": rectangle.scaledHeight,
  472 + "Width": rectangle.scaledWidth,
  473 + "x": rectangle.scaledX,
  474 + "y": rectangle.scaledY,
  475 + "haveMirror": 'true'
  476 + }
  477 + );
  478 +
  479 +
463 480 //2.Draw mirror image
464 481 $scope.DrawMirroredImage(Math.round(rectangle.scaledHeight), Math.round(rectangle.scaledWidth), Math.round(rectangle.scaledX), Math.round(rectangle.scaledY), src, value._BodyRegionId, 'N');
465 482 // debugger;
... ... @@ -482,6 +499,18 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
482 499 //0. Scaling as per default zoom
483 500 var rectangle = scaleRectangle(value._X, value._Y, value._Height, value._Width, 0);
484 501  
  502 + $scope.ColoredImageSRC.push(
  503 + {
  504 + "bodyRegionId": value._BodyRegionId, "SRC": src,
  505 + "Height": rectangle.scaledHeight,
  506 + "Width": rectangle.scaledWidth,
  507 + "x": rectangle.scaledX,
  508 + "y": rectangle.scaledY,
  509 + "haveMirror": 'false'
  510 + }
  511 + );
  512 +
  513 +
485 514 //1.Draw body region which have mirror image
486 515 $scope.DrawImage(Math.round(rectangle.scaledHeight), Math.round(rectangle.scaledWidth), Math.round(rectangle.scaledX), Math.round(rectangle.scaledY), src, value._BodyRegionId, 'N');
487 516 $scope.BodyRegionCordinatesData.push(
... ... @@ -512,6 +541,18 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
512 541 var src = $scope.GetImageSource(value._BodyRegionId);
513 542 $scope.imageSource = src;
514 543 }
  544 +
  545 + $scope.ColoredImageSRC.push(
  546 + {
  547 + "bodyRegionId": value._BodyRegionId, "SRC": src,
  548 + "Height": rectangle.scaledHeight,
  549 + "Width": rectangle.scaledWidth,
  550 + "x": rectangle.scaledX,
  551 + "y": rectangle.scaledY,
  552 + "haveMirror": 'false'
  553 + }
  554 + );
  555 +
515 556 //2.Draw body region which don't have mirror image
516 557 $scope.DrawImage(Math.round(rectangle.scaledHeight), Math.round(rectangle.scaledWidth), Math.round(rectangle.scaledX), Math.round(rectangle.scaledY), src, value._BodyRegionId, 'N');
517 558  
... ... @@ -1219,7 +1260,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1219 1260  
1220 1261  
1221 1262 })
1222   -
1223 1263 }
1224 1264  
1225 1265 else {
... ... @@ -1240,6 +1280,16 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1240 1280 $timeout(function () { $scope.DisableProgressBar() }, 1000);
1241 1281 }
1242 1282  
  1283 + if ($scope.isHighLight) {
  1284 + //alert('isHighlight: ' + $scope.isHighLight);
  1285 +
  1286 + $('#btnHighLight').removeClass('btn btn-black');
  1287 + $('#btnHighLight').addClass('btn-primary');
  1288 +
  1289 + $timeout(function () { $scope.highLightBody() }, 350);
  1290 +
  1291 + }
  1292 +
1243 1293 }
1244 1294  
1245 1295 $scope.DisableProgressBar = function () {
... ... @@ -2478,6 +2528,64 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2478 2528  
2479 2529 }
2480 2530  
  2531 + $scope.enableHighlight = function () {
  2532 + $scope.isHighLight = true;
  2533 +
  2534 + // alert('enableHighlight is called');
  2535 +
  2536 + $scope.highLightBody();
  2537 + }
  2538 +
  2539 + $scope.highLightBody = function () {
  2540 +
  2541 + // alert('highlight body is called');
  2542 + angular.forEach($scope.ColoredImageSRC, function (value, key) {
  2543 +
  2544 +
  2545 + var id;
  2546 + if (value.haveMirror == 'true') {
  2547 + id = 'imageCanvas' + value.bodyRegionId + '_MR';
  2548 + }
  2549 + else {
  2550 + id = 'imageCanvas' + value.bodyRegionId;
  2551 + }
  2552 +
  2553 + var imageCanvas = document.getElementById(id);
  2554 +
  2555 + var context_gray = imageCanvas.getContext('2d');
  2556 +
  2557 + var dataURL = imageCanvas.toDataURL();
  2558 +
  2559 +
  2560 + var img = new Image();
  2561 +
  2562 + img.src = dataURL;
  2563 +
  2564 +
  2565 + var DAData = new BitmapData(img.width, img.height);
  2566 + DAData.draw(img);
  2567 + var RED = 0.3086; // luminance contrast value for red
  2568 + var GREEN = 0.694; // luminance contrast value for green
  2569 + var BLUE = 0.0820; // luminance contrast value for blue
  2570 +
  2571 + var RGB = [RED, GREEN, BLUE, 0, 0];
  2572 + var RGB2 = [RED, GREEN, BLUE, 0, 0];
  2573 + var RGB3 = [RED, GREEN, BLUE, 0, 0];
  2574 + var ALPHA = [0, 0, 0, 1, 0];
  2575 +
  2576 + var rgbPx = RGB.concat(RGB2);
  2577 + var rgbPx2 = rgbPx.concat(RGB3);
  2578 + var matrix = rgbPx2.concat(ALPHA);
  2579 +
  2580 + var zeroPoint = new Point();
  2581 + var grayScale = new ColorMatrixFilter(matrix);
  2582 + DAData.applyFilter(DAData, DAData.rect, zeroPoint, grayScale);
  2583 +
  2584 + context_gray.putImageData(DAData.data, 0, 0)
  2585 +
  2586 + });
  2587 +
  2588 + }
2481 2589  
2482 2590 $scope.OnGenderChange = function (event) {
2483 2591 debugger;
... ... @@ -2522,6 +2630,4 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2522 2630  
2523 2631 }]
2524 2632  
2525   -
2526   -
2527 2633 );
... ...