diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index 2edf433..5bb94d1 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -1,5 +1,4 @@ - -'use strict'; +'use strict'; AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$log", "$location", "$timeout", "DA", "Modules", "$routeParams", "DataService", function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Modules, $routeParam, DataService) { @@ -91,6 +90,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.navigatorImage; $scope.NavigatorData; $scope.navimgsrc; + $scope.isCanvasImageLoaded; $scope.dragdivleft = 0; $scope.dragdivtop = 0; @@ -369,7 +369,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo if ($rootScope.openViews.length > 0) { openViews = new jinqJs() .from($rootScope.openViews) - .where("BodyViewId == " + currentBodyViewId) + .where("BodyViewId==" + currentBodyViewId) .select(); } } @@ -381,7 +381,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo if (openViews != null && openViews != undefined) { angular.forEach(openViews, function (value, key) { - if (value.body-views == tittle) { + if (value.body - views == tittle) { tittle = localStorage.getItem("currentViewTitleFromJson") + counter++; $rootScope.currentActiveViewTitle = tittle; localStorage.setItem("currentViewTitle", tittle); @@ -718,8 +718,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.ColoredImageSRC = []; } - if ($scope.bodyRegionCoordinates != null || $scope.bodyRegionCoordinates != undefined) { - angular.forEach($scope.bodyRegionCoordinates, function (value, key) { + if ($scope.bodyRegionCoordinates != null || $scope.bodyRegionCoordinates != undefined) + { + angular.forEach($scope.bodyRegionCoordinates, function (value, key) + { if (value._HaveMirrorImage == 'Y') { @@ -732,7 +734,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo var src = $scope.GetImageSource(value._BodyRegionId); $scope.imageSource = src; - + //2.Draw mirror image $scope.DrawMirroredImage(Math.round(rectangle.scaledHeight), Math.round(rectangle.scaledWidth), Math.round(rectangle.scaledX), Math.round(rectangle.scaledY), src, value._BodyRegionId, 'N'); // debugger; @@ -755,7 +757,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //0. Scaling as per default zoom var rectangle = scaleRectangle(value._X, value._Y, value._Height, value._Width, 0); - + //1.Draw body region which have mirror image $scope.DrawImage(Math.round(rectangle.scaledHeight), Math.round(rectangle.scaledWidth), Math.round(rectangle.scaledX), Math.round(rectangle.scaledY), src, value._BodyRegionId, 'N'); $scope.BodyRegionCordinatesData.push( @@ -771,7 +773,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } else { - + //0.Scaling as per default zoom var rectangle = scaleRectangle(value._X, value._Y, value._Height, value._Width, value._MirrorValue); @@ -785,6 +787,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.imageSource = src; } + //2.Draw body region which don't have mirror image $scope.DrawImage(Math.round(rectangle.scaledHeight), Math.round(rectangle.scaledWidth), Math.round(rectangle.scaledX), Math.round(rectangle.scaledY), src, value._BodyRegionId, 'N'); @@ -810,7 +813,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo var gender; if (localStorage.getItem("genderId") == 'Female') { gender = 'F'; - } else { gender = 'M'; @@ -991,7 +993,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } - $scope.GetImageSource = function (bodyRegionId) { // debugger; var dataLength = $rootScope.BodyLayerData.Layers.DataLayer.length; @@ -1146,7 +1147,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo FlipedImgCanvas.addEventListener('click', function (evt) { //to get correct data on multihighlight highlight - if ($scope.isLayerChange == true) { + if($scope.isLayerChange == true) + { $scope.isLayerChange = false; } @@ -1427,7 +1429,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.DrawImage = function (h, w, x, y, src, bodyRegionId, isMaskImage) { var imgCanvas = document.createElement('canvas'); - + imgCanvas.height = h; imgCanvas.width = w; imgCanvas.setAttribute("data-IsMirrored", "N") @@ -1813,7 +1815,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo else if (($rootScope.viewOrientationId == '6') && ($scope.ColoredImageSRC.length == 1)) { loopLength = 1; } - + if (loopLength !== 0) { for (var x = 0; x < loopLength; x++) { if ($rootScope.MaskCanvasData[x] != null || $rootScope.MaskCanvasData[x] != undefined) { @@ -1917,7 +1919,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo grayCanvasContext.putImageData(imgData, 0, 0); } - + if ($rootScope.multiAnnotationIsON == true) { //debugger; if (canvasId.match('_MR')) @@ -1960,14 +1962,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.HighlightBodyByTermList = function (TermList) { - //if (($rootScope.updatedGrayMRDataList != null || $rootScope.updatedGrayMRDataList != undefined) && $rootScope.updatedGrayMRDataList.length > 0) { - // $rootScope.updatedGrayMRDataList = null; - // $rootScope.updatedGrayMRDataList = []; - //} - //if (($rootScope.updatedGrayDataList != null || $rootScope.updatedGrayDataList != undefined) && $rootScope.updatedGrayDataList.length > 0) { - // $rootScope.updatedGrayDataList = null; - // $rootScope.updatedGrayDataList = []; - //} console.log('HighlightBodyByTermList is called'); @@ -2058,7 +2052,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo if ($scope.isLayerChange == true) { if ($rootScope.grayImageDataList[bodyRegionId - 1] != null || $rootScope.grayImageDataList[bodyRegionId - 1] != undefined) { grayImageDataVar = $rootScope.grayImageDataList[bodyRegionId - 1]; - + } } else { @@ -2142,15 +2136,11 @@ 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) if ($scope.highlightedBR != null || $scope.highlightedBR != undefined) { @@ -2195,6 +2185,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo + + $scope.createTermListByPreviousTermsAndHighlight = function () { @@ -2218,13 +2210,14 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo console.log('createTermListByPreviousTermsAndHighlight is called'); - if ((multiTermList != undefined || multiTermList != null) && multiTermList.length > 0) { + if ((multiTermList != undefined || multiTermList!=null) && multiTermList.length>0) { $timeout(function () { $scope.HighlightBodyByTermList(multiTermList); }, 50); } } + $scope.GetRGBColor = function (maskCanvasContext, actulalX, actualY, x, y) { var pixelData = maskCanvasContext.getImageData(Math.round(actulalX - x), Math.round(actualY - y), 1, 1); @@ -2328,11 +2321,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //layer change function $scope.LayerChange = function () { - //remove annotation - - - - $scope.isLayerChange = true; $rootScope.isLoading = true; $('#spinner').css('visibility', 'visible'); @@ -2588,7 +2576,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo else { console.log('MultiLanguageAnnationArray.length is :' + $scope.MultiLanguageAnnationArray.length) } - if($scope.longestAnnotation!=null || $scope.longestAnnotation!=undefined){ + if ($scope.longestAnnotation.length <= 10) { @@ -2647,8 +2635,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } - - } var Globe = []; Globe.push({ currentX: x, currentY: y }); @@ -3782,20 +3768,41 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } - //check if transparency is activated + // niki 3june + //var txtTransparencyChange = document.getElementById("txtTransparencyChange"); + ////for first time, the transparency should be 50% + //if ($scope.isTboxDrwan) { + + // if (txtTransparencyChange != null) + // txtTransparencyChange.value = 50; + + // $scope.isTboxDrwan = false; + + //} + + //check if transparency is activated var transNumber = $scope.transNumber;//txtTransparencyChange.value; // debugger; - //this changes the transparency when transparency is already activated and user resizes or chage the layer + //this changes the transparency when transparency is already activated(on scale the value is >0) and user resizes or chage the layer var imageD = tempCtx.getImageData(0, 0, Width, Height); - + if (transNumber > 0) { + // debugger; + + + // tempCanvasID = 'transparencyTempCanvas_' + bodyRegionId; var tempCtx = document.getElementById(tempCanvasID).getContext('2d'); + // var image = ctx.getImageData(0, 0, scope.transparencyCanvasWidth, scope.transparencyCanvasHeight); + + //keep the original image on temp canavs to use it in changing transparency - + // if (scope.isResized == true || scope.isLayerChanged) { + //debugger; + if (document.getElementById('tempCanvas') != null) { var contx = document.getElementById('tempCanvas').getContext('2d'); var tbTempCanvas = document.getElementById(tempCanvasID) @@ -3830,7 +3837,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo tempCtx.putImageData(imageD, 0, 0); - + } + var ctx = transparencyCanvas.getContext('2d'); @@ -4487,11 +4495,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.enableZoom = function () { - //remove speech bubble - $('#sppeachBubble').css('display', 'none'); - - $("#dot").css("display", "none"); - $scope.terminateCurrentlyRunningWPs(); if ($scope.isTransparencyActivated) { @@ -4540,30 +4543,54 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.flushCanvas = function () { - //if ($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined) { - // angular.forEach($scope.ColoredImageSRC, function (value, key) { + if ($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined) { + angular.forEach($scope.ColoredImageSRC, function (value, key) { - // var id; - // var maskId; - // if (value.haveMirror == 'true') { - // id = 'imageCanvas' + value.bodyRegionId + '_MR'; - // maskId = 'imageCanvas' + value.bodyRegionId + '_MR_mci' - // } - // else { - // id = 'imageCanvas' + value.bodyRegionId; - // maskId = 'imageCanvas' + value.bodyRegionId + '_mci'; - // } + var id; + var maskId; + if (value.haveMirror == 'true') { + id = 'imageCanvas' + value.bodyRegionId + '_MR'; + maskId = 'imageCanvas' + value.bodyRegionId + '_MR_mci' + } + else { + id = 'imageCanvas' + value.bodyRegionId; + maskId = 'imageCanvas' + value.bodyRegionId + '_mci'; + } - // var canvas = document.getElementById(id); - // if (canvas != null || canvas != undefined) { - // document.getElementById('canvasDiv').removeChild(canvas); - // } + var canvas = document.getElementById(id); + if (canvas != null || canvas != undefined) { + document.getElementById('canvasDiv').removeChild(canvas); + } - // var maskcanvas = document.getElementById(maskId); - // if (maskcanvas != null || maskcanvas != undefined) { - // document.getElementById('canvasDiv').removeChild(maskcanvas); + var maskcanvas = document.getElementById(maskId); + if (maskcanvas != null || maskcanvas != undefined) { + document.getElementById('canvasDiv').removeChild(maskcanvas); + + } + + var modestyCanvases = $("canvas[id*='imageCanvasmodestyImg']"); + for (var i = 0; i < modestyCanvases.length; i++) { + modestyCanvases[i].remove(); + } + }); + } + + //for (var i = 1; i < 7; i++) { + + // var id; + // var maskId; + + // id = 'imageCanvas' + i; + // maskId = 'imageCanvas' + i + '_mci'; + + // var canvas = document.getElementById(id); + // if (canvas != null || canvas != undefined) + // document.getElementById('canvasDiv').removeChild(canvas); + + // var maskcanvas = document.getElementById(maskId); + // if (maskcanvas != null || maskcanvas != undefined) + // document.getElementById('canvasDiv').removeChild(maskcanvas); - // } // if (i == 4 || i == 5 || i == 6) { // id = 'imageCanvas' + i + '_MR'; // maskId = 'imageCanvas' + i + '_MR_mci'; @@ -4577,11 +4604,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo // document.getElementById('canvasDiv').removeChild(maskcanvas); // } - // var modestyCanvases = $("canvas[id*='imageCanvasmodestyImg']"); - // for (var i = 0; i < modestyCanvases.length; i++) { - // modestyCanvases[i].remove(); - // } - // }); // //remove modesty canavs // var modestyCanvases = $("canvas[id*='imageCanvasmodestyImg']"); // if (modestyCanvases != null || modestyCanvases != undefined && modestyCanvases.length > 0) { @@ -4590,44 +4612,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo // } // } //} - - for (var i = 1; i < 7; i++) { - - var id; - var maskId; - - id = 'imageCanvas' + i; - maskId = 'imageCanvas' + i + '_mci'; - - var canvas = document.getElementById(id); - if (canvas != null || canvas != undefined) - document.getElementById('canvasDiv').removeChild(canvas); - - var maskcanvas = document.getElementById(maskId); - if (maskcanvas != null || maskcanvas != undefined) - document.getElementById('canvasDiv').removeChild(maskcanvas); - - if (i == 4 || i == 5 || i == 6) { - id = 'imageCanvas' + i + '_MR'; - maskId = 'imageCanvas' + i + '_MR_mci'; - - var canvas = document.getElementById(id); - if (canvas != null || canvas != undefined) - document.getElementById('canvasDiv').removeChild(canvas); - - var maskcanvas = document.getElementById(maskId); - if (maskcanvas != null || maskcanvas != undefined) - document.getElementById('canvasDiv').removeChild(maskcanvas); - } - - //remove modesty canavs - var modestyCanvases = $("canvas[id*='imageCanvasmodestyImg']"); - if (modestyCanvases != null || modestyCanvases != undefined && modestyCanvases.length > 0) { - for (var j = 0; j < modestyCanvases.length; j++) { - modestyCanvases[j].remove(); - } - } - } } $scope.terminateCurrentlyRunningWPs = function () { @@ -4767,7 +4751,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.highLightBody = function () { - console.log('highLightBody is called and ColoredImageSRC length: ' + $scope.ColoredImageSRC.length); + // console.log('highLightBody is called and ColoredImageSRC length: ' + $scope.ColoredImageSRC.length + ' and $rootScope.viewOrientationId= ' + $rootScope.viewOrientationId); $scope.terminateCurrentlyRunningWPs(); @@ -4790,14 +4774,13 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.doHighlightOrExtract = false; } - + console.log('$scope.doHighlightOrExtract= ' + $scope.doHighlightOrExtract) if ($scope.doHighlightOrExtract == true) { if ($rootScope.isHighLight == true) { $scope.grayedBR = []; angular.forEach($scope.ColoredImageSRC, function (value, key) { - console.log('$scope.ColoredImageSRC length before gray= ' + $scope.ColoredImageSRC.length) var id; if (value.haveMirror == 'true') { id = 'imageCanvas' + value.bodyRegionId + '_MR'; @@ -4837,8 +4820,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo img.src = dataURL; img.onload = function () { - console.log('Before BitmapData call, width: ' + Math.max(img.width) + ', height: ' + Math.max(img.height) + ' value.bodyRegionId= ' - + value.bodyRegionId) + var DAData = new BitmapData(Math.max(img.width), Math.max(img.height)); DAData.draw(img); @@ -4856,25 +4838,26 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo DAData.applyFilter(DAData, DAData.rect, zeroPoint, colorMode); - + context_gray.putImageData(DAData.data, 0, 0) + + // to resolve lateral arm black issue in highlight mode - //NIKI- to resolve lateral arm black issue in highlight mode - - if ($rootScope.viewOrientationId == 5 && (value.bodyRegionId == 6 || value.bodyRegionId == 4)) { - + if ($rootScope.viewOrientationId == 5 && (value.bodyRegionId == 6 ||value.bodyRegionId==4)) { + var imgData = context_gray.getImageData(0, 0, width, ht); var data = imgData.data; - var c = 0; + var c=0; for (var i = 0; i < data.length; i += 4) { if (data[i] == data[i + 1] && data[i + 1] == data[i + 2] && data[i + 2] === 0) { data[i + 3] = 0; } - + } context_gray.putImageData(imgData, 0, 0); } - + + // //push BRID into array $scope.grayedBR.push({ 'BRID': value.bodyRegionId }); @@ -4926,22 +4909,18 @@ 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) { + if ($rootScope.isGenderChnage == true || $rootScope.isViewChange == true) { $scope.isLoading = false; $('#spinner').css('visibility', 'hidden'); - //} + } if (($scope.isHighlightBodysystem == true) && ($scope.systemMatchedTermList != null || $scope.systemMatchedTermList != undefined)) { - $scope.isLoading = true; - - $('#spinner').css('visibility', 'visible'); $timeout(function () { $scope.HighlightBodyByTermList($scope.systemMatchedTermList) }, 100); } - else if ($rootScope.isListManagerSelected == true) { + else if ($scope.isHighlightByListManager == true) { - // console.log('$scope.grayedBR.length is ' + $scope.grayedBR.length); $timeout(function () { $scope.HighlightBodyByTermList($scope.AllTerms) @@ -4951,6 +4930,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo else if (($rootScope.previousHighlightList != null || $rootScope.previousHighlightList != undefined) && $rootScope.previousHighlightList.length > 0) { $scope.createTermListByPreviousTermsAndHighlight(); } + } @@ -4963,11 +4943,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo if ($rootScope.isExtract == true) { if (($rootScope.previousHighlightList != null || $rootScope.previousHighlightList != undefined) && $rootScope.previousHighlightList.length > 0) { - + console.log('HighlightBodyOnExtract') $timeout(function () { $scope.HighlightBodyOnExtract() }, 50); } } //else { + // console.log('INSIDE ELSE. $scope.grayedBR.length= ' + $scope.grayedBR.length) // // this code is for the case where user first clcik on normal mode then extract then again highlight then we need to call highlight body in gray mode // //and then highlight the previously selected body regions at the time of normal mode. // if ($scope.grayedBR != null || $scope.grayedBR != undefined) { @@ -4986,12 +4967,14 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo // } - + // console.log('INSIDE ELSE $scope.isEligibleForHighlightBodyByTermList = ' + $scope.isEligibleForHighlightBodyByTermList) // // //} }) - + //if ($scope.isEligibleForHighlightBodyByTermList == true) { + // console.log('CREATE multiTermList') + // if (($rootScope.previousHighlightList != null || $rootScope.previousHighlightList != undefined) && $rootScope.previousHighlightList.length > 0) { // var multiTermList = []; @@ -5034,8 +5017,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo var imageCanvas = document.getElementById(id); - //var coloredCanvasID = 'imageCanvas' + bodyRegionId; - //var coloredCanvas = document.getElementById(coloredCanvasID); var width = value.Width; var ht = value.Height; @@ -5212,17 +5193,16 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //1. localStorage.setItem("genderId", 'Male'); + $('#daImagePanel')[0].childNodes[0].childNodes[0].innerHTML = localStorage.getItem("currentViewTitle").replace('Female', 'Male'); + + localStorage.setItem("currentViewTitle", localStorage.getItem("currentViewTitle").replace('Female', 'Male')); + //2. $scope.loadSelectedBodyView(currentBodyViewId); //3. $scope.loadSelectedBodyViewNavigator(currentBodyViewId); - - - $('#daImagePanel')[0].childNodes[0].childNodes[0].innerHTML = localStorage.getItem("currentViewTitle").replace('Female', 'Male'); - - localStorage.setItem("currentViewTitle", localStorage.getItem("currentViewTitle").replace('Female', 'Male')); - + $rootScope.isLoading = true; @@ -5230,22 +5210,21 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo else if ((event.currentTarget.attributes[1].value == 'Female') && (localStorage.getItem("genderId") == 'Male')) { - localStorage.setItem("genderId", 'Female'); - //1. - $scope.loadSelectedBodyView(currentBodyViewId); + localStorage.setItem("genderId", 'Female'); + $('#daImagePanel')[0].childNodes[0].childNodes[0].innerHTML = localStorage.getItem("currentViewTitle").replace('Male', 'Female'); + localStorage.setItem("currentViewTitle", localStorage.getItem("currentViewTitle").replace('Male', 'Female')); //2. - $scope.loadSelectedBodyViewNavigator(currentBodyViewId); + $scope.loadSelectedBodyView(currentBodyViewId); //3. - $('#daImagePanel')[0].childNodes[0].childNodes[0].innerHTML = localStorage.getItem("currentViewTitle").replace('Male', 'Female'); - - localStorage.setItem("currentViewTitle", localStorage.getItem("currentViewTitle").replace('Male', 'Female')); + $scope.loadSelectedBodyViewNavigator(currentBodyViewId); $rootScope.isLoading = true; + } $rootScope.openViews.push( @@ -5346,11 +5325,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $rootScope.isLoading = true; $('#spinner').css('visibility', 'visible'); - - if ($rootScope.openViews.length > 0) { - $rootScope.openViews.splice($rootScope.openViews.length - 1); - } - $rootScope.isViewChange = true; $scope.layerNumber = 0; // debugger; @@ -5368,15 +5342,16 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $rootScope.voId = selectedViewId; $rootScope.isLoading = true; - //1. Load selected body view - $scope.loadSelectedBodyView($rootScope.voId); + //1.Change the popup title next to search + $scope.currentTitleFromJson = localStorage.getItem("currentViewTitle"); + + //2. Load selected body view + $scope.loadSelectedBodyView($rootScope.voId); + // $scope.loadSelectedBodyView($rootScope.voId); //2. load corresponding navigator man $scope.loadSelectedBodyViewNavigator($rootScope.voId); - //3.Change the popup title next to search - $scope.currentTitleFromJson = localStorage.getItem("currentViewTitle"); - }; @@ -5397,11 +5372,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $rootScope.voId = selectedViewId; $rootScope.isLoading = true; - //1. + //1. Load selected body view $scope.loadSelectedBodyView($rootScope.voId); - //2. + //2. load corresponding navigator man $scope.loadSelectedBodyViewNavigator($rootScope.voId); + }; @@ -5477,6 +5453,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.LateralArmView = ""; $scope.MedialArmView = "active"; } + + $rootScope.isLoading = false; + $('#spinner').css('visibility', 'hidden'); } //Reload DA controller event listener after setting change @@ -5489,21 +5468,18 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //Reload DA controller Body View after setting Change $scope.$on('reloadDABodyViewEvent', function (event, data) { - //console.log('reloadDABodyViewEvent'); - $scope.layerNumber = parseInt($('#txtlayerNumber').val()); - $scope.ReloadBodyViewId = data.reloadDABodyViewId; - // $scope.layerNumber = 0; - // debugger; - - console.log('reloadDABodyViewEvent ' + $scope.ReloadBodyViewId); + console.log('reloadDABodyViewEvent'); if ($rootScope.isSettingEventAlredayDispachted == true) { - $scope.loadSelectedBodyView($scope.ReloadBodyViewId); + //1. first change the go button popup + $scope.currentTitleFromJson = localStorage.getItem("currentViewTitle"); - $scope.loadSelectedBodyViewNavigator($scope.ReloadBodyViewId); + //2. then load Canvas image + $scope.loadSelectedBodyView(data.reloadDABodyViewId); - $scope.currentTitleFromJson = localStorage.getItem("currentViewTitle"); + //3. + $scope.loadSelectedBodyViewNavigator(data.reloadDABodyViewId); $rootScope.isSettingEventAlredayDispachted = false; } @@ -5512,48 +5488,46 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.loadSelectedBodyViewNavigator = function (currentBodyViewId) { - $rootScope.voId = currentBodyViewId; + // $rootScope.voId = currentBodyViewId; - $scope.skinTone = $rootScope.globalSetting.ethnicity; - - if ($scope.NavigatorData != null || $scope.NavigatorData != undefined) { - var navdtlOrient = new jinqJs() - .from($scope.NavigatorData.Navigtor.ViewOrientation) - .where("_ViewOrientationId == " + $scope.voId) - .select(); + // $scope.skinTone = $rootScope.globalSetting.ethnicity; + console.log('NavBodyView: ' + currentBodyViewId); + console.log('Skintone: ' + $rootScope.globalSetting.ethnicity); + console.log('Modesty: ' + $rootScope.globalSetting.modesty); + var navdtlOrient = new jinqJs() + .from($scope.NavigatorData.Navigtor.ViewOrientation) + .where("_ViewOrientationId == " + currentBodyViewId) + .select(); + if (navdtlOrient != null || navdtlOrient != undefined) { - if (navdtlOrient != null || navdtlOrient != undefined) { + var navOrientationdata = new jinqJs() + .from(navdtlOrient[0].ImageInfo) + .where("_Ethnicity == " + $rootScope.globalSetting.ethnicity) + .select(); - var navOrientationdata = new jinqJs() - .from(navdtlOrient[0].ImageInfo) - .where("_Ethnicity == " + $scope.skinTone) - .select(); + if (navOrientationdata != null || navOrientationdata != undefined) { - if (navOrientationdata != null || navOrientationdata != undefined) { + $scope.navigatorImage = navOrientationdata; - $scope.navigatorImage = navOrientationdata; + var navImageModesty; - var navImageModesty; + angular.forEach($scope.navigatorImage, function (value, key) { + if (value._HaveModesty === $rootScope.globalSetting.modesty) { + navImageModesty = value._ImageName; + } + }) + if (typeof (navImageModesty) === "undefined" || navImageModesty === null) { - angular.forEach($scope.navigatorImage, function (value, key) { - if (value._HaveModesty === $rootScope.globalSetting.modesty) { - navImageModesty = value._ImageName; - } - }) - if (typeof (navImageModesty) === "undefined" || navImageModesty === null) { + navImageModesty = $scope.navigatorImage[0]._ImageName; - navImageModesty = $scope.navigatorImage[0]._ImageName; + } - } + $scope.navimgsrc = "~/../content/images/DA/ethnicity/body-views/" + currentBodyViewId + '/' + $rootScope.globalSetting.ethnicity + '/navigator_images/' + navImageModesty; - $scope.navimgsrc = "~/../content/images/DA/ethnicity/body-views/" + $scope.voId + '/' + $scope.skinTone + '/navigator_images/' + navImageModesty; - } } - } - } //Annotation tool event lsitener @@ -5681,8 +5655,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo layer: true, type: 'line', draggable: true, - strokeStyle: $rootScope.shapestyleborderColor, - strokeWidth: $rootScope.shapestyleborderWidth, + strokeStyle: 'black', + strokeWidth: 2, rounded: true, x1: $scope.offsetX1, y1: $scope.offsetY1, x2: $scope.x, y2: $scope.y, @@ -5743,12 +5717,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $('#canvas').addLayer({ layer: true, name: 'Rect_' + $rootScope.resetRect, - fillStyle: $rootScope.shapestyleFillColor, + fillStyle: '#fff', type: 'rectangle', draggable: true, - strokeStyle: $rootScope.shapestyleborderColor, + strokeStyle: 'black', opacity: $rootScope.shapestyleOpacity, - strokeWidth: $rootScope.shapestyleborderWidth, + strokeWidth: 2, x: $scope.offsetX1, y: $scope.offsetY1, width: $scope.x - $scope.offsetX1, height: $scope.y - $scope.offsetY1, @@ -5812,7 +5786,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo break; case "Circle": - // alert($rootScope.shapestyleFillColor); + $rootScope.resetCircle = $rootScope.ObjectIndex++; $('#canvas').addLayer({ layer: true, @@ -5820,9 +5794,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo type: 'ellipse', opacity: $rootScope.shapestyleOpacity, draggable: true, - strokeStyle: $rootScope.shapestyleborderColor, - strokeWidth: $rootScope.shapestyleborderWidth, - fillStyle: $rootScope.shapestyleFillColor, + strokeStyle: '#000', + strokeWidth: 2, + fillStyle: '#FFF', x: $scope.offsetX1, y: $scope.offsetY1, width: ($scope.x - $scope.offsetX1) * 2, height: ($scope.y - $scope.offsetY1) * 2, // Place a handle at each side and each corner @@ -5886,8 +5860,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo layer: true, name: 'Arrow_' + $rootScope.resetArrow, draggable: true, - strokeStyle: $rootScope.shapestyleborderColor, - strokeWidth: $rootScope.shapestyleborderWidth, + strokeStyle: '#000', + strokeWidth: 2, rounded: true, startArrow: true, arrowRadius: 7, @@ -6089,9 +6063,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo name: "TextRect_" + $rootScope.resetTextRect, dragGroups: ['shapes'], opacity: $rootScope.shapestyleOpacity, - strokeStyle: $rootScope.shapestyleborderColor, - strokeWidth: $rootScope.shapestyleborderWidth, - fillStyle: $rootScope.shapestyleFillColor, + strokeStyle: 'black', + strokeWidth: 2, x: $scope.offsetX1, y: $scope.offsetY1, width: $scope.x - $scope.offsetX1, height: $scope.y - $scope.offsetY1, @@ -6158,7 +6131,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } - //-- TextArea functionality of Annotation toolbar + //-- TextArea functionality of Annotation toolbar $rootScope.fontSizes; $rootScope.fontWeight; @@ -6169,8 +6142,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $rootScope.textArea; $rootScope.fontFamily; $rootScope.saveText = function () { - - $rootScope.fontSizes = $("#text_area").css("font-size"); + + $rootScope.fontSizes = $("#text_area").css("font-size"); $rootScope.fontWeight = $("#text_area").css("font-weight"); $rootScope.fontStyle = $("#text_area").css("font-style"); $rootScope.textAlignmt = $("#text_area").css("text-align"); @@ -6180,11 +6153,11 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $rootScope.textArea = $("#text_area").val(); $("#canvas").removeLayer('TextArea_' + $rootScope.resetText).drawLayers(); $("#canvas").removeLayer("TextRect_" + $rootScope.resetTextRect).drawLayers(); - // alert($rootScope.fontColor); + $('#canvas').drawText({ layer: true, draggable: true, - name: 'TextArea_' + $rootScope.resetText, + name:'TextArea_'+ $rootScope.resetText, groups: ['TextArea_' + $rootScope.resetText], dragGroups: ['TextArea_' + $rootScope.resetText], fillStyle: $rootScope.fontColor, @@ -6197,16 +6170,16 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo x: $scope.offsetX1, y: $scope.offsetY1, maxWidth: $scope.x - $scope.offsetX1, maxHeight: $scope.y - $scope.offsetY1, - + click: function (layer) { + - - + }, change: function (layer, props) { } - + }) // Draw rect as wide as the text .drawRect({ @@ -6216,30 +6189,27 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo groups: ['TextArea_' + $rootScope.resetText], dragGroups: ['TextArea_' + $rootScope.resetText], opacity: $rootScope.shapestyleOpacity, - // strokeStyle: 'black', - // strokeWidth: 2, - strokeStyle: $rootScope.shapestyleborderColor, - strokeWidth: $rootScope.shapestyleborderWidth, - // fillStyle: $rootScope.shapestyleFillColor, + strokeStyle: 'black', + strokeWidth: 2, x: $scope.offsetX1, y: $scope.offsetY1, width: $scope.x - $scope.offsetX1, height: $scope.y - $scope.offsetY1, click: function (layer) { $rootScope.shapeTypeText = "textAreaRect"; - + var layerNameSplit = layer.name; - + var splitedName = layerNameSplit.split("_"); - + var textValName = "TextArea_"; - + var concatinateResult = textValName.concat(splitedName[1]); - + $rootScope.canvasLayerNameCollection = []; $rootScope.canvasLayerNameCollection.push({ textareaRectangle: layer.name, textareaString: concatinateResult }); - - + + $('#canvas').setLayer(layer.name, { handle: { @@ -6254,7 +6224,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo }, mouseout: function (layer) { - + $rootScope.canvasLayerNameCollection = []; $('#canvas').setLayer(layer.name, { handle: { @@ -6270,7 +6240,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo }, mouseover: function (layer) { - + $('#canvas').setLayer(layer.name, { handle: { type: 'rectangle', @@ -6285,16 +6255,16 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } }); $("#text_area").val(''); - - $("#text_area").css({ " font-family": "'Verdana, sans-serif'", "font-size": "14px", "font-weight": "normal", "font-style": "normal", "color": "#000", "text-align": "left", "text-decoration": "none" }); - + + $("#text_area").css({" font-family":"'Verdana, sans-serif'","font-size":"14px","font-weight":"normal","font-style":"normal","color":"#000","text-align":"left","text-decoration":"none"}); + } function OnPaintCanvasMouseMove(event) { - + } $rootScope.FreeStylePaint = function (e) { @@ -6668,7 +6638,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo if (($scope.isHighlightBodysystem == true) && ($scope.systemMatchedTermList != null || $scope.systemMatchedTermList != undefined)) { $timeout(function () { $scope.HighlightBodyByTermList(systemMatchedTermList) }, 100); - } + } } @@ -6682,7 +6652,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo var systemList = $rootScope.CommonData.DACommonData.BodySystems.Item; - $('#bodySystems').empty(); + //var systemListHtml = '' var $all = $('').appendTo('#bodySystems'); $compile($all)($scope); @@ -6691,9 +6661,11 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo var $elem = $('').appendTo('#bodySystems'); $compile($elem)($scope); + // systemListHtml = systemListHtml + '<' }) + // $('#bodySystems').append(systemListHtml); var currentView = localStorage.getItem("currentViewTitle"); @@ -6708,8 +6680,15 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $rootScope.viewOrientationId = currentOpenViewId; //confirm that this is DA module which is last open if (currentOpenModuleId == 1) { - - $('#termList').empty(); + //$http({ method: 'GET', url: '~/../content/data/json/da/body-views/' + currentOpenViewId + '/da_dat_tm_sg_' + currentOpenViewId + '.json' }).success(function (data) { + // $rootScope.TermNumberData = data; + // var actualtermList = new jinqJs() + // .from($rootScope.TermNumberData.TermData.Term) + // .select('_ActualTermNumber'); + + // var TermTextList = []; + // var TermTextList = []; + $scope.loadListManger(); @@ -6771,7 +6750,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo }) - $scope.VocabTermTxt = new jinqJs() .from(vocabTermTxt) .distinct('_TermText', '_ActualTermNumber') @@ -6795,7 +6773,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } // }) - + //.error(function (data, status, headers, config) { // console.log(data); @@ -6899,22 +6877,60 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //8.remove current layer canavses $scope.flushCanvas(); - + //for (var i = 1; i < 7; i++) { + + // var id; + // var maskId; + + // id = 'imageCanvas' + i; + // maskId = 'imageCanvas' + i + '_mci'; + + // var canvas = document.getElementById(id); + // document.getElementById('canvasDiv').removeChild(canvas); + + // var maskcanvas = document.getElementById(maskId); + // document.getElementById('canvasDiv').removeChild(maskcanvas); + + // if (i == 4 || i == 5 || i == 6) { + // id = 'imageCanvas' + i + '_MR'; + // maskId = 'imageCanvas' + i + '_MR_mci'; + + // var canvas = document.getElementById(id); + // document.getElementById('canvasDiv').removeChild(canvas); + + // var maskcanvas = document.getElementById(maskId); + // document.getElementById('canvasDiv').removeChild(maskcanvas); + // } + + // //remove modesty canavs + // var modestyCanvases = $("canvas[id*='imageCanvasmodestyImg']"); + // for (var j = 0; j < modestyCanvases.length; j++) { + // modestyCanvases[j].remove(); + // } + //} //9. $timeout(function () { $rootScope.isHighLight = false; - - //removing speechbubble - $('#sppeachBubble').css('display', 'none'); - $("#dot").css("display", "none"); - - //redraw body of respective layer $scope.CalculateImageCordinates($rootScope.viewOrientationId) }, 500); + $scope.isHighlightByListManager = true; + + //10. + //$timeout(function () { + // $rootScope.isHighLight = true; + // $scope.highLightBody() + //}, 500); + //$timeout(function () { + + // // $rootScope.isHighLight = false; + + // $scope.HighlightBodyByTermList($scope.TermList) + //}, 2000); + + //4.get scroll position - } $scope.getChildTermList = function (termNo) { diff --git a/400-SOURCECODE/AIAHTML5.Web/app/views/da/da-view.html b/400-SOURCECODE/AIAHTML5.Web/app/views/da/da-view.html index f6d8909..dd6c5e7 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/views/da/da-view.html +++ b/400-SOURCECODE/AIAHTML5.Web/app/views/da/da-view.html @@ -238,7 +238,7 @@