Commit eb840ab672f85e44c513d0a70ceb4a809d1a6a8c

Authored by unknown
2 parents a2b89c82 71c35d32

Merge branch 'Develop' of http://52.6.196.163/ADAM/AIAHTML5 into AAZoom5

Conflicts:
	400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js
400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
@@ -46,6 +46,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -46,6 +46,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
46 $rootScope.coloredImageMRCanvasList = []; 46 $rootScope.coloredImageMRCanvasList = [];
47 $rootScope.ColoredCanvasData = []; 47 $rootScope.ColoredCanvasData = [];
48 $rootScope.grayImageDataList = []; 48 $rootScope.grayImageDataList = [];
  49 +
  50 + $rootScope.rawGrayImageDataList = [];
  51 +
49 $rootScope.grayImageMRDataList = []; 52 $rootScope.grayImageMRDataList = [];
50 $rootScope.updatedGrayDataList = []; 53 $rootScope.updatedGrayDataList = [];
51 $rootScope.updatedGrayMRDataList = []; 54 $rootScope.updatedGrayMRDataList = [];
@@ -2646,71 +2649,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -2646,71 +2649,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2646 2649
2647 if ($scope.layerNumber == 224) 2650 if ($scope.layerNumber == 224)
2648 { 2651 {
2649 - //debugger;  
2650 -  
2651 - //var matchedTermListPath = '~/../content/data/json/da/body-views/1/bodyLayers-CardioVascular.json';  
2652 -  
2653 - //DataService.getJson(matchedTermListPath)  
2654 - //.then(  
2655 - // function (result)  
2656 - // {  
2657 - // $rootScope.macthedTermList = result;  
2658 - // var termNo=0;  
2659 - // var pixcelLocation = 0;  
2660 -  
2661 - // if ($rootScope.macthedTermList.length > 0) {  
2662 - // angular.forEach($rootScope.macthedTermList, function (value, key) {  
2663 -  
2664 - // debugger;  
2665 -  
2666 - // var TermExistInBodyRegionId = value.bodyRegionId;  
2667 - // var grayImageDataVar = $rootScope.grayImageDataList[TermExistInBodyRegionId - 1];  
2668 - // var coloredImageDataVar = $rootScope.coloredImageCanvasList[TermExistInBodyRegionId - 1];  
2669 -  
2670 - // var grayImageDataValue = grayImageDataVar.data;  
2671 - // var coloredImageDataValue = coloredImageDataVar.data;  
2672 -  
2673 - // $rootScope.termListWithLocation = value.terms;  
2674 -  
2675 - // angular.forEach($rootScope.termListWithLocation[0].PixelLocations, function (value1, key1)  
2676 - // {  
2677 - // //debugger;  
2678 -  
2679 - // var coloredImageData = coloredImageDataValue[value1];  
2680 - // grayImageDataValue[value1] = coloredImageData;  
2681 -  
2682 -  
2683 - // })  
2684 -  
2685 - // var grayCanvasID = 'imageCanvas' + TermExistInBodyRegionId;  
2686 - // var grayCanvas = document.getElementById(grayCanvasID);  
2687 - // if (grayCanvas != null)  
2688 - // {  
2689 - // debugger;  
2690 - // var grayCanvasContext = grayCanvas.getContext("2d");  
2691 -  
2692 - // var canvasHeight = grayCanvas.height + 'px';  
2693 - // var canvasWidth = grayCanvas.width + 'px';  
2694 - // grayCanvasContext.clearRect(0, 0, canvasHeight, canvasWidth)  
2695 -  
2696 - // grayCanvasContext.putImageData(grayImageDataVar, 0, 0);  
2697 -  
2698 -  
2699 - // }  
2700 - // $('#spinner').css('visibility', 'hidden')  
2701 - // $rootScope.isLoading = false;  
2702 -  
2703 - // })  
2704 - // }  
2705 -  
2706 -  
2707 -  
2708 - // },  
2709 - // function (error) {  
2710 - // console.log(' Error in getting term data = ' + error.statusText);  
2711 -  
2712 - // });  
2713 -  
2714 } 2652 }
2715 else { 2653 else {
2716 2654
@@ -2846,74 +2784,224 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -2846,74 +2784,224 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2846 } 2784 }
2847 }, 100) 2785 }, 100)
2848 2786
  2787 +
  2788 + }
  2789 +
  2790 +
  2791 +
  2792 + $scope.HighlightBodyByTermListForBodySystem = function (TermList) {
  2793 +
  2794 + $("#btnTranparency").attr('disabled', 'disabled');
  2795 + $scope.currentLayerNumber = $scope.layerNumber;
  2796 +
  2797 + $scope.layerNumber = $('#txtlayerNumber').val();
  2798 +
  2799 + $rootScope.isLoading = true;
  2800 + $('#spinner').css('visibility', 'visible');
  2801 +
  2802 +
  2803 + if ($rootScope.isHighLight == true) {
  2804 + false;
  2805 + }
  2806 +
  2807 + console.log('HighlightBodyByTermListForBodySystem is called');
  2808 +
  2809 + $scope.highlightedBR = [];
  2810 +
2849 if ($scope.layerNumber == 224) { 2811 if ($scope.layerNumber == 224) {
2850 - // debugger;  
2851 2812
2852 var matchedTermListPath = '~/../content/data/json/da/body-views/1/BodySystem_' + $rootScope.systemNumber + '.json'; 2813 var matchedTermListPath = '~/../content/data/json/da/body-views/1/BodySystem_' + $rootScope.systemNumber + '.json';
2853 - 2814 + var grayImageDataVar = null;
  2815 +
2854 DataService.getJson(matchedTermListPath) 2816 DataService.getJson(matchedTermListPath)
2855 .then( 2817 .then(
2856 function (result) { 2818 function (result) {
  2819 + console.log('1. HighlightBodyByTermListForBodySystem is called');
2857 $rootScope.macthedTermList = result; 2820 $rootScope.macthedTermList = result;
2858 var termNo = 0; 2821 var termNo = 0;
2859 var pixcelLocation = 0; 2822 var pixcelLocation = 0;
2860 - 2823 + var prevBRID = 0;
2861 if ($rootScope.macthedTermList.length > 0) { 2824 if ($rootScope.macthedTermList.length > 0) {
  2825 + console.log('2. HighlightBodyByTermListForBodySystem is called');
  2826 + //remove existing data and draw fresh data
  2827 + for(var i=0; i<$rootScope.grayImageDataList.length;i++){
  2828 + var grayCanvasID = 'imageCanvas' + parseInt(i+1);
  2829 + var grayCanvas = document.getElementById(grayCanvasID);
  2830 +
  2831 + if (grayCanvas != null) {
  2832 + var grayCanvasContext = grayCanvas.getContext("2d");
2862 2833
2863 - 2834 + var canvasHeight = grayCanvas.height;
  2835 + var canvasWidth = grayCanvas.width;
  2836 + grayCanvasContext.clearRect(0, 0, canvasHeight, canvasWidth)
  2837 + grayCanvasContext.putImageData($rootScope.grayImageDataList[parseInt(i)], 0, 0);
  2838 + }
  2839 + }
  2840 + for (var i = 4; i <= $rootScope.grayImageMRDataList.length; i++) {
  2841 + var grayCanvasMRID = 'imageCanvas' + i+'_MR';
  2842 + var grayCanvasMR = document.getElementById(grayCanvasMRID);
  2843 +
  2844 + if (grayCanvasMR != null) {
  2845 + var grayCanvasContextMR = grayCanvasMR.getContext("2d");
  2846 +
  2847 + var canvasHeight = grayCanvasMR.height;
  2848 + var canvasWidth = grayCanvasMR.width;
  2849 + grayCanvasContextMR.clearRect(0, 0, canvasHeight, canvasWidth)
  2850 + grayCanvasContextMR.putImageData($rootScope.grayImageMRDataList[parseInt(i)], 0, 0);
  2851 + }
  2852 + }
2864 2853
2865 angular.forEach($rootScope.macthedTermList, function (value, key) { 2854 angular.forEach($rootScope.macthedTermList, function (value, key) {
2866 - // debugger;  
2867 - var TermExistInBodyRegionId = value.bodyRegionId;  
2868 2855
2869 -  
2870 - var grayImageDataVar = $rootScope.grayImageDataList[parseInt(TermExistInBodyRegionId) - 1];  
2871 -  
2872 - var coloredImageDataVar = $rootScope.coloredImageCanvasList[parseInt(TermExistInBodyRegionId) - 1];  
2873 2856
2874 - var grayImageDataValue = grayImageDataVar.data;  
2875 - var coloredImageDataValue = coloredImageDataVar.data; 2857 + var TermExistInBodyRegionId = value.bodyRegionId;
  2858 + console.log('3. HighlightBodyByTermListForBodySystem is called TermExistInBodyRegionId=' + TermExistInBodyRegionId);
  2859 + if (TermExistInBodyRegionId != undefined) {
  2860 + if (prevBRID != TermExistInBodyRegionId) {
2876 2861
2877 - $rootScope.termListWithLocation = value.terms;  
2878 2862
2879 - angular.forEach($rootScope.termListWithLocation.PixelLocations, function (value1, key1) {  
2880 - //debugger; 2863 + var grayCanvasID = 'imageCanvas' + TermExistInBodyRegionId;
  2864 + var grayCanvas = document.getElementById(grayCanvasID);
2881 2865
2882 - var RED = coloredImageDataValue[value1];  
2883 - var GREEN = coloredImageDataValue[value1 + 1];  
2884 - var BLUE = coloredImageDataValue[value1 + 2]; 2866 + if (grayCanvas != null) {
2885 2867
2886 - grayImageDataValue[value1] = RED;  
2887 - grayImageDataValue[value1+1] = GREEN;  
2888 - grayImageDataValue[value1+2] = BLUE;  
2889 - }) 2868 + var grayCanvasContext = grayCanvas.getContext("2d");
2890 2869
2891 - var grayCanvasID = 'imageCanvas' + TermExistInBodyRegionId;  
2892 - var grayCanvas = document.getElementById(grayCanvasID);  
2893 - if (grayCanvas != null) {  
2894 - debugger;  
2895 - var grayCanvasContext = grayCanvas.getContext("2d"); 2870 + var canvasHeight = grayCanvas.height;
  2871 + var canvasWidth = grayCanvas.width;
  2872 + var canvasX = grayCanvas.style.left;
  2873 + var canvasY = grayCanvas.style.top;
2896 2874
2897 - //var canvasHeight = grayCanvas.height + 'px';  
2898 - //var canvasWidth = grayCanvas.width + 'px';  
2899 2875
  2876 + grayCanvasContext.clearRect(0, 0, canvasHeight, canvasWidth)
  2877 + grayCanvasContext.putImageData($rootScope.grayImageDataList[parseInt(TermExistInBodyRegionId) - 1], 0, 0);
2900 2878
2901 - var canvasHeight = grayCanvas.height;  
2902 - var canvasWidth = grayCanvas.width; 2879 + var gData = grayCanvasContext.getImageData(0, 0, canvasWidth, canvasHeight);
2903 2880
2904 - grayCanvasContext.clearRect(0, 0, canvasHeight, canvasWidth) 2881 + //for mirror images
  2882 + var grayCanvasMRID = 'imageCanvas' + TermExistInBodyRegionId + '_MR';
  2883 + var grayCanvasMR = document.getElementById(grayCanvasMRID);
  2884 + var grayCanvasMRX;
  2885 + var grayCanvasMRY;
  2886 +
  2887 + //draw a canvas for same bodyregion wich will be flipped after coloring the body system
  2888 + if (TermExistInBodyRegionId == 4 || TermExistInBodyRegionId == 5 || TermExistInBodyRegionId == 6) {
  2889 +
  2890 +
  2891 + var grayCanvasMRID = 'imageCanvas' + TermExistInBodyRegionId + '_MR';
  2892 + var grayCanvasMR = document.getElementById(grayCanvasMRID);
  2893 + grayCanvasMRX = grayCanvasMR.style.left;
  2894 + grayCanvasMRY = grayCanvasMR.style.top;
  2895 +
  2896 + var FlipedImgCanvas = document.createElement('canvas');
  2897 + FlipedImgCanvas.height = canvasHeight;
  2898 + FlipedImgCanvas.width = canvasWidth;
  2899 + FlipedImgCanvas.setAttribute("data-IsMirrored", "Y")
  2900 + FlipedImgCanvas.style.position = "absolute";
  2901 + FlipedImgCanvas.style.left = canvasX + "px";
  2902 + FlipedImgCanvas.style.top = canvasY + "px";
  2903 + FlipedImgCanvas.style.visibility = 'hidden';
  2904 + FlipedImgCanvas.id = 'imageCanvas' + TermExistInBodyRegionId + '_MR';
  2905 +
  2906 + //remove previous canavs
  2907 + $('#' + grayCanvasMRID).remove();
  2908 +
  2909 + //add new canvas on same location and after flipping it will be added to mirrored position
  2910 + document.getElementById('canvasDiv').appendChild(FlipedImgCanvas);
  2911 + //put grayData
  2912 +
  2913 + var filppedCanvasContx = FlipedImgCanvas.getContext("2d");
  2914 + filppedCanvasContx.putImageData(gData, 0, 0);
  2915 +
  2916 + }
  2917 +
  2918 + grayImageDataVar = null;
  2919 + var macthedData = new jinqJs()
  2920 + .from($rootScope.macthedTermList)
  2921 + .where('bodyRegionId == ' + TermExistInBodyRegionId)
  2922 + .select();
  2923 +
  2924 +
  2925 +
  2926 + var coloredImageDataVar = $rootScope.coloredImageCanvasList[parseInt(TermExistInBodyRegionId) - 1];
  2927 +
  2928 + var grayImageDataValue = gData.data;
  2929 + var coloredImageDataValue = coloredImageDataVar.data;
  2930 +
  2931 +
  2932 + angular.forEach(macthedData, function (value2, key) {
  2933 +
  2934 + $rootScope.termListWithLocation = value2.terms;
2905 2935
2906 - grayCanvasContext.putImageData(grayImageDataVar, 0, 0); 2936 + //pick the color from coloredImage data and put on gray imagedata
  2937 + angular.forEach($rootScope.termListWithLocation.PixelLocations, function (value1, key1) {
2907 2938
  2939 + var RED = coloredImageDataValue[value1];
  2940 + var GREEN = coloredImageDataValue[value1 + 1];
  2941 + var BLUE = coloredImageDataValue[value1 + 2];
2908 2942
  2943 + grayImageDataValue[value1] = RED;
  2944 + grayImageDataValue[value1 + 1] = GREEN;
  2945 + grayImageDataValue[value1 + 2] = BLUE;
  2946 + })
  2947 +
  2948 + //for non mirrored bpdy regions
  2949 + var grayCanvasID = 'imageCanvas' + TermExistInBodyRegionId;
  2950 + var grayCanvas = document.getElementById(grayCanvasID);
  2951 +
  2952 + if (grayCanvas != null) {
  2953 +
  2954 + var grayCanvasContext = grayCanvas.getContext("2d");
  2955 +
  2956 + grayCanvasContext.putImageData(gData, 0, 0);
  2957 +
  2958 + }
  2959 +
  2960 + //for mirror body regions
  2961 + if (TermExistInBodyRegionId == 4 || TermExistInBodyRegionId == 5 || TermExistInBodyRegionId == 6) {
  2962 +
  2963 + var grayCanvasMRID = 'imageCanvas' + TermExistInBodyRegionId + '_MR';
  2964 +
  2965 + var grayCanvasMR = document.getElementById(grayCanvasMRID);
  2966 +
  2967 + if (grayCanvasMR != null) {
  2968 +
  2969 + var grayCanvasMRContext = grayCanvasMR.getContext("2d");
  2970 +
  2971 + grayCanvasMRContext.save();
  2972 + grayCanvasMRContext.translate(canvasWidth, 0);
  2973 + grayCanvasMRContext.scale(-1, 1);
  2974 + //flip does not work with putImageData, that is why we used drawImage
  2975 + grayCanvasMRContext.drawImage(grayCanvas, 0, 0, canvasWidth, canvasHeight, 0, 0, canvasWidth, canvasHeight);
  2976 + grayCanvasMRContext.restore();
  2977 +
  2978 + //set this canavs on the actual posution of mirror image
  2979 + grayCanvasMR.style.left = grayCanvasMRX;
  2980 + grayCanvasMR.style.top = grayCanvasMRY;
  2981 + grayCanvasMR.style.visibility = 'visible';
  2982 +
  2983 +
  2984 + }
  2985 + }
  2986 +
  2987 + $('#spinner').css('visibility', 'hidden')
  2988 + $rootScope.isLoading = false;
  2989 +
  2990 + prevBRID = TermExistInBodyRegionId;
  2991 + })
  2992 + }
  2993 + }
  2994 + }
  2995 + else {
  2996 + $('#spinner').css('visibility', 'hidden')
  2997 + $rootScope.isLoading = false;
2909 } 2998 }
2910 - $('#spinner').css('visibility', 'hidden')  
2911 - $rootScope.isLoading = false;  
2912 2999
2913 }) 3000 })
2914 - }  
2915 3001
  3002 + }
2916 3003
  3004 +
2917 3005
2918 }, 3006 },
2919 function (error) { 3007 function (error) {
@@ -2925,7 +3013,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -2925,7 +3013,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2925 } 3013 }
2926 3014
2927 3015
2928 -  
2929 $scope.createTermListByPreviousTermsAndHighlight = function () { 3016 $scope.createTermListByPreviousTermsAndHighlight = function () {
2930 3017
2931 3018
@@ -6922,7 +7009,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -6922,7 +7009,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
6922 $scope.isLoading = true; 7009 $scope.isLoading = true;
6923 7010
6924 $('#spinner').css('visibility', 'visible'); 7011 $('#spinner').css('visibility', 'visible');
6925 - $timeout(function () { $scope.HighlightBodyByTermList($scope.systemMatchedTermList) }, 100); 7012 + $timeout(function () { $scope.HighlightBodyByTermListForBodySystem($scope.systemMatchedTermList) }, 100);
6926 } 7013 }
6927 else if (($rootScope.isListManagerSelected == true) || ($rootScope.previousHighlightList != null && $rootScope.previousHighlightList.length > 0) && ($rootScope.isGenderChnage == true || $rootScope.isViewChange == true) || $rootScope.isListManagerAlreadySelected == true) { 7014 else if (($rootScope.isListManagerSelected == true) || ($rootScope.previousHighlightList != null && $rootScope.previousHighlightList.length > 0) && ($rootScope.isGenderChnage == true || $rootScope.isViewChange == true) || $rootScope.isListManagerAlreadySelected == true) {
6928 7015
@@ -7808,7 +7895,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -7808,7 +7895,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
7808 $scope.isLoading = true; 7895 $scope.isLoading = true;
7809 7896
7810 $('#spinner').css('visibility', 'visible'); 7897 $('#spinner').css('visibility', 'visible');
7811 - $timeout(function () { $scope.HighlightBodyByTermList($scope.systemMatchedTermList) }, 100); 7898 + $timeout(function () { $scope.HighlightBodyByTermListForBodySystem($scope.systemMatchedTermList) }, 100);
7812 } 7899 }
7813 } 7900 }
7814 } 7901 }
@@ -8872,7 +8959,10 @@ function OnViewChange(event) { @@ -8872,7 +8959,10 @@ function OnViewChange(event) {
8872 function OnBodySystemSelection(event) { 8959 function OnBodySystemSelection(event) {
8873 console.log('OnBodySystem chnaged is called outside '); 8960 console.log('OnBodySystem chnaged is called outside ');
8874 var scope = angular.element(document.getElementById("daView")).scope(); 8961 var scope = angular.element(document.getElementById("daView")).scope();
8875 - scope.$apply(function () { 8962 +
  8963 +
  8964 + scope.$apply(function ()
  8965 + {
8876 scope.HighlightBodyByBodySystem(event); 8966 scope.HighlightBodyByBodySystem(event);
8877 }); 8967 });
8878 } 8968 }
400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js
@@ -916,7 +916,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -916,7 +916,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
916 916
917 917
918 $scope.drawStaticPinsOnImage = function (canvasId, PinId, offsetX1, offsetY1, x, y) { 918 $scope.drawStaticPinsOnImage = function (canvasId, PinId, offsetX1, offsetY1, x, y) {
919 - console.log('drawStaticPinsOnImage') 919 + $scope.clickedPins = [];
920 // if ($scope.isSliderChange == true) { 920 // if ($scope.isSliderChange == true) {
921 console.log('isSliderrChange') 921 console.log('isSliderrChange')
922 var radial = $('#' + canvasId).createGradient({ 922 var radial = $('#' + canvasId).createGradient({
@@ -1302,6 +1302,22 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -1302,6 +1302,22 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1302 .where('_PinId != ' + value.id) 1302 .where('_PinId != ' + value.id)
1303 .select(); 1303 .select();
1304 }) 1304 })
  1305 + angular.forEach($scope.clickedPins, function (value1, key1) {
  1306 +
  1307 + // if (aaPinDataValue._PinId != value.id) {
  1308 + var pinName = 'Pin_' + value1.id;
  1309 + var pinArcName = 'PinArc_' + value1.id;
  1310 +
  1311 + $('#aaDetailViewCanvas').setLayer(pinName, {
  1312 + visible: true // set to true instead to show the layer again
  1313 + }).drawLayers();
  1314 +
  1315 + $('#aaDetailViewCanvas').setLayer(pinArcName, {
  1316 + visible: true // set to true instead to show the layer again
  1317 + }).drawLayers();
  1318 + // }
  1319 + })
  1320 +
1305 angular.forEach(seletedSystemPinData, function (aaPinDataValue, aaPinDataKey) { 1321 angular.forEach(seletedSystemPinData, function (aaPinDataValue, aaPinDataKey) {
1306 1322
1307 // if (aaPinDataValue._PinId != value.id) { 1323 // if (aaPinDataValue._PinId != value.id) {
@@ -1319,8 +1335,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -1319,8 +1335,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1319 }) 1335 })
1320 1336
1321 // }) 1337 // })
1322 - alert($scope.clickedPins.length);  
1323 - $scope.clickedPins = []; 1338 + // $scope.clickedPins = [];
1324 } 1339 }
1325 1340
1326 else { 1341 else {