diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index 5115f84..ab08209 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -8,16 +8,16 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.BodyViewData; $scope.selectedGenderBodyViewData; $scope.imagePath = ""; - $scope.BodyRegionData; - $scope.BodyRegionCordinatesData; + $rootScope.BodyRegionData; + $rootScope.BodyRegionCordinatesData; $scope.isTransparencyActivated; - $scope.BodyLayerData; + $rootScope.BodyLayerData; $scope.VocabTermData; $scope.CommonData $scope.TermNumberData; $rootScope.BodySystemData $scope.bodyViewId = 0; - $scope.bgartData; + $rootScope.bgartData; //view specific constants $scope.voId; $scope.layerNumber; @@ -260,7 +260,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo brViewdata.then( function (result) { // debugger; - $scope.BodyRegionData = result; + $rootScope.BodyRegionData = result; $scope.isBodyRegionDataLoaded = true; // alert('da_dat_brview= ' + result) @@ -278,7 +278,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo function (result) { //debugger; - $scope.BodyLayerData = result; + $rootScope.BodyLayerData = result; $scope.isBodylayerdataLoaded = true; //load json for annotations @@ -385,13 +385,13 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo }, function (error) { // handle errors here - console.log(' $scope.BodyLayerData= ' + error.statusText); + console.log(' $rootScope.BodyLayerData= ' + error.statusText); } ); }, function (error) { // handle errors here - console.log(' $scope.BodyRegionData = ' + error.statusText); + console.log(' $rootScope.BodyRegionData = ' + error.statusText); } ); @@ -448,7 +448,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo bgartdata.then( function (result) { //debugger; - $scope.bgartData = result; + $rootScope.bgartData = result; $scope.CalculateImageCordinates($scope.viewOrientationId); }, @@ -462,7 +462,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //calculate coordinates for body region images $scope.CalculateImageCordinates = function (viewOrientationId) { - // debugger; + //remove the previous layer mask data from array var n = $scope.MaskCanvasData.length @@ -478,7 +478,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } //set height of canvas div and left tool bar as per window size - $scope.BodyRegionCordinatesData = []; // create an empty array + $rootScope.BodyRegionCordinatesData = []; // create an empty array $('#daBodyview').css('width', '100%'); $('#canvasDiv').css('height', $('#daImagePanel').outerHeight() - 104) @@ -488,7 +488,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //calculate image coordinates and draw image - var bodyRegionCoordinates = $scope.BodyRegionData.BodyRegionViews; + var bodyRegionCoordinates = $rootScope.BodyRegionData.BodyRegionViews; // var viewOrientationId = String($scope.voId); @@ -500,7 +500,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo // if ($scope.voId == 9 || $scope.voId == 11) { $scope.bagartDetails = new jinqJs() - .from($scope.bgartData.BackgroundArts.BackgroundArtDetail) + .from($scope.bgartData.BackgroundArts.BackgroundArtDetail) .where('_ViewOrientationId == ' + viewOrientationId) .select(); //} @@ -510,7 +510,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo angular.forEach($scope.bodyRegionCoordinates, function (value, key) { - if (value._HaveMirrorImage == 'Y') { //DrawMirroredImage @@ -538,7 +537,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //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; - $scope.BodyRegionCordinatesData.push( + $rootScope.BodyRegionCordinatesData.push( { "bodyRegionId": value._BodyRegionId, "Height": Math.round(rectangle.scaledHeight), "Width": Math.round(rectangle.scaledWidth), "X": Math.round(rectangle.scaledX), "Y": Math.round(rectangle.scaledY), "IsMirror": 'Yes' @@ -571,7 +570,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //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( + $rootScope.BodyRegionCordinatesData.push( { "bodyRegionId": value._BodyRegionId, "Height": Math.round(rectangle.scaledHeight), "Width": Math.round(rectangle.scaledWidth), "X": Math.round(rectangle.scaledX), "Y": Math.round(rectangle.scaledY), "IsMirror": 'No' @@ -614,7 +613,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //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'); - $scope.BodyRegionCordinatesData.push( + $rootScope.BodyRegionCordinatesData.push( { "bodyRegionId": value._BodyRegionId, "Height": Math.round(rectangle.scaledHeight), "Width": Math.round(rectangle.scaledWidth), "X": Math.round(rectangle.scaledX), "Y": Math.round(rectangle.scaledY), "IsMirror": 'No' @@ -768,7 +767,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.GetImageSource = function (bodyRegionId) { // debugger; - var dataLength = $scope.BodyLayerData.Layers.DataLayer.length; + var dataLength = $rootScope.BodyLayerData.Layers.DataLayer.length; //set max for LayerNumber input $scope.totalLayers = dataLength - 1; @@ -783,7 +782,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo var SelectedLayerData = []; - SelectedLayerData = $scope.BodyLayerData.Layers.DataLayer[dataLength - $scope.userInput - 1]; + SelectedLayerData = $rootScope.BodyLayerData.Layers.DataLayer[dataLength - $scope.userInput - 1]; if ($scope.layerNumber == 0) { for (var z = 0; z <= SelectedLayerData.BodyRegion.length; z++) { @@ -1402,7 +1401,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.HighlightBodyByTermList = function (TermList) { - + // debugger //terminate previous running workers to create space for new workers var workerCount = $scope.runningWorkers.length; if (workerCount > 0) { @@ -3172,6 +3171,25 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo }; + //clsoe worker process + $scope.$on('jsPanelCloseEvent', function (event, data) { + + console.log('terminate worker process') + //terminate previous running workers to create space for new workers + if ($scope.runningWorkers != null) { + var workerCount = $scope.runningWorkers.length; + if (workerCount > 0) { + for (var i = workerCount - 1; i >= 0; i--) { + var runningWorker = $scope.runningWorkers[i].workerName; + runningWorker.terminate(); + $scope.runningWorkers.splice(i, 1); + // workerCount--; + } + } + } + + }) + $scope.OnIdentityClick = function () { // $('#btnIdentity').addClass('btn-primary'); @@ -3220,19 +3238,39 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } $scope.flushCanvas = function () { - angular.forEach($scope.ColoredImageSRC, function (value, key) { - + console.log('$scope.flushCanvas ') + //angular.forEach($rootScope.ColoredImageSRC, function (value, key) { + // debugger; + // 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); + // document.getElementById('canvasDiv').removeChild(canvas); + + // var maskcanvas = document.getElementById(maskId); + // 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; - 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'; - } + + id = 'imageCanvas' + i; + maskId = 'imageCanvas' + i + '_mci'; var canvas = document.getElementById(id); document.getElementById('canvasDiv').removeChild(canvas); @@ -3240,11 +3278,23 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo 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 i = 0; i < modestyCanvases.length; i++) { modestyCanvases[i].remove(); } - }); + } } $scope.enableHighlight = function () { @@ -3263,7 +3313,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.highLightBody = function () { - + //debugger if ($rootScope.isHighLight == true) { angular.forEach($scope.ColoredImageSRC, function (value, key) { @@ -3468,7 +3518,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo function (result) { //debugger; - $scope.BodyLayerData = result; + $rootScope.BodyLayerData = result; $scope.isBodylayerdataLoaded = true; //load json for annotations @@ -3495,7 +3545,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo function (error) { // handle errors here - console.log(' $scope.BodyLayerData= ' + error.statusText); + console.log(' $rootScope.BodyLayerData= ' + error.statusText); } ); } @@ -3652,20 +3702,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo - // $scope.Draw=function(x, y, isDown) { - // if (isDown) { - // $scope.paintCanvasContext.beginPath(); - // $scope.paintCanvasContext.strokeStyle = '#000000'; - // $scope.paintCanvasContext.lineWidth = 1//$('#selWidth').val(); - // $scope.paintCanvasContext.lineJoin = "round"; - // $scope.paintCanvasContext.moveTo($scope.lastX, $scope.lastY); - // $scope.paintCanvasContext.lineTo(x, y); - // $scope.paintCanvasContext.closePath(); - // $scope.paintCanvasContext.stroke(); - // } - // $scope.lastX = x; $scope.lastY = y; - //} - //body highlight options functinality $scope.LoadBodySystemData = function () { @@ -3718,7 +3754,175 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $timeout(function () { $scope.HighlightBodyByTermList(systemMatchedTermList) }, 100); - } + } + + + + + + //list manager + $scope.$on('listManagerEvent', function (event, data) { + // debugger; + + if ($rootScope.islistManagerEventAlredayDispachted == true) { + + var len = $rootScope.openModules.length; + var openViewLen = $rootScope.openViews.length; + + var currentOpenModuleId = $rootScope.openModules[len - 1].ModuleId; + var currentOpenViewId = $rootScope.openViews[openViewLen - 1].BodyViewId; + $scope.viewOrientationId = currentOpenViewId; + //confirm that this is DA module which is last open + if (currentOpenModuleId == 1) { + $http({ method: 'GET', url: '~/../content/data/json/da/body-views/' + currentOpenViewId + '/da_dat_tm_sg_' + currentOpenViewId + '.json' }).success(function (data) { + $scope.TermNumberData = data; + var actualtermList = new jinqJs() + .from($scope.TermNumberData.TermData.Term) + .select('_ActualTermNumber'); + + var TermTextList = []; + var path = '~/../content/data/json/da/vocab/english/cm_dat_vocabterm_1.json' + + $http({ method: 'GET', url: '~/../content/data/json/da/vocab/english/cm_dat_vocabterm_1.json' }).success(function (data) { + + var VocabTermData = data; + + var vocabTermTxt = []; + + angular.forEach($scope.TermNumberData.TermData.Term, function (value1, key1) { + + angular.forEach(VocabTermData.VocabTerms.Term, function (value2, key2) { + + + if (value1._ActualTermNumber === value2._ActualTermNumber) { + vocabTermTxt.push( + + { + + "_ActualTermNumber": value2._ActualTermNumber, + + "_TermText": value2._TermText, + + "_cdId": value2._cdId + + } + + ); + + } + + }) + + + + }) + + + + $scope.VocabTermTxt = new jinqJs() + + .from(vocabTermTxt) + + .distinct('_TermText', '_ActualTermNumber') + + .orderBy([{ field: '_TermText', sort: 'asc' }]) + + .select('_ActualTermNumber', '_TermText', '_cdId'); + + + for (var j = 0; j < $scope.VocabTermTxt.length; j++) { + var $el = $('').appendTo('#termList') + $compile($el)($scope); + } + + $rootScope.isLoading = false; + $('#spinner').css('visibility', 'hidden'); + + }) + + .error(function (data, status, headers, config) { + + console.log(data); + + }); + + + + }) + .error(function (data, status, headers, config) { + + console.log(data); + + }); + + + + $rootScope.islistManagerEventAlredayDispachted = false; + var jj; + } + } + + }); + + $scope.HighlightBodyOnListManagerSelection = function (event) { + + alert('hi: ' + event.currentTarget.attributes[0].value); + debugger; + var actualTermNumber = event.currentTarget.attributes[0].value; + var TermList = $scope.getTermNumberList(actualTermNumber); + var layerNumberList = []; + for (var i = 0; i < TermList.length; i++) { + var layerNumber = TermList[i]._InternalLayerNumber + + layerNumberList[i] = layerNumber; + } + // debugger; + //4. + layerNumberList.sort(); + var lNum = layerNumberList[0].replace('00', ''); + $scope.layerNumber = parseInt(lNum) - 1; + + + //remove current layer canavses + for (var i = 1; i < 7; i++) { + debugger; + 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(); + } + } + + + $timeout(function () { $scope.CalculateImageCordinates($scope.viewOrientationId) }, 100); + + $rootScope.isHighLight = true; + $timeout(function () { $scope.highLightBody() }, 100); + $timeout(function () { $scope.HighlightBodyByTermList(TermList) }, 100); + } }] diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js index e0bcb48..d1a379a 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js @@ -29,7 +29,9 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $rootScope.lastX; $rootScope.lastY; $rootScope.CommonData; + //jspanel functionality.. + $rootScope.openParent = function (slug) { // debugger; var openViews = $rootScope.openViews; @@ -41,6 +43,8 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", } $('#daImagePanel').remove(); $location.url('/' + slug); + + $rootScope.$broadcast('jsPanelCloseEvent', true); } //called on jsanel minimize @@ -203,5 +207,31 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", } + //list manager function + + $rootScope.ShowListManager = function () { + + $('#listManager').css('display', 'block'); + + $rootScope.isLoading = true; + $('#spinner').css('visibility', 'visible'); + $rootScope.islistManagerEventAlredayDispachted = true; + + $rootScope.$broadcast('listManagerEvent', true); + } + + + function fillListManagerTerms() { + + var len = $rootScope.openModules.length; + var openViewLen = $rootScope.openViews.length; + + var currentOpenModuleId = $rootScope.openModules[len - 1].ModuleId; + var currentOpenViewId = $rootScope.openViews[openViewLen - 1].BodyViewId; + if (currentOpenModuleId == 1) { + + } + + } }] ); \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.Web/app/widget/TopMenu.html b/400-SOURCECODE/AIAHTML5.Web/app/widget/TopMenu.html index 8bb200d..fe7ee2d 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/widget/TopMenu.html +++ b/400-SOURCECODE/AIAHTML5.Web/app/widget/TopMenu.html @@ -26,7 +26,9 @@