diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index 19fc6a7..6312a3e 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -95,7 +95,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.dragdivleft = 0; $scope.dragdivtop = 0; - $scope.IsSearchVisible = false; $scope.shapesize = 1; $scope.dragdivposition = { @@ -663,8 +662,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //calculate coordinates for body region images $scope.CalculateImageCordinates = function (viewOrientationId) { - console.log('CalculateImageCordinates is called') - $scope.terminateCurrentlyRunningWPs(); var drawnBodyRegionCount = []; @@ -693,8 +690,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $('#leftToolBar').css('height', $('#daImagePanel').outerHeight()) - $scope.counter = 0; - $scope.MCounter = 0; + //calculate image coordinates and draw image var bodyRegionCoordinates = $rootScope.BodyRegionData.BodyRegionViews; // var viewOrientationId = String($rootScope.voId); @@ -713,20 +709,18 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo .where('_ViewOrientationId == ' + viewOrientationId) .select(); - if (($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined) && $scope.ColoredImageSRC.length > 0) { - $scope.ColoredImageSRC.length = 0; - // $scope.ColoredImageSRC = undefined; + if ($scope.ColoredImageSRC != null && $scope.ColoredImageSRC.length > 0) { + $scope.ColoredImageSRC = null; $scope.ColoredImageSRC = []; $scope.flushCanvas(); } else { $scope.ColoredImageSRC = []; } - var counter = 0; + if ($scope.bodyRegionCoordinates != null || $scope.bodyRegionCoordinates != undefined) { angular.forEach($scope.bodyRegionCoordinates, function (value, key) { - counter++; - //console.log('loop call=' + counter) + if (value._HaveMirrorImage == 'Y') { //DrawMirroredImage @@ -1011,7 +1005,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.one = 1; $scope.userInput = parseInt($scope.layerNumber); - $scope.skinTone = $rootScope.globalSetting.ethnicity; var SelectedLayerData = []; @@ -1019,7 +1012,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo if ((SelectedLayerData != null || SelectedLayerData != undefined)) if ($scope.layerNumber == 0) { - //console.log('lNo: ' + $scope.layerNumber + ' and BodyRegion.length: ' + SelectedLayerData.BodyRegion.length); + console.log('lNo: ' + $scope.layerNumber + ' and BodyRegion.length: ' + SelectedLayerData.BodyRegion.length); if (SelectedLayerData.BodyRegion.length > 0) { for (var z = 0; z < SelectedLayerData.BodyRegion.length; z++) { @@ -1118,11 +1111,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.DrawMirroredImage = function (h, w, x, y, src, bodyRegionId, isMaskImage) { - $scope.counterFlip++; - - //console.log('DrawMirroredImage called for bodyRegionId= ' + bodyRegionId + ' and counterFlip=: ' + $scope.counterFlip); - - var FlipedImgCanvas = document.createElement('canvas'); FlipedImgCanvas.height = h; FlipedImgCanvas.width = w; @@ -1338,31 +1326,18 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo var cw, ch, imgW, imgH, mouseX, mouseY; var scaleFactor = 1.00; + //$scaler = $("#scaler"); + //$scaler.val(scaleFactor); + //$scaler.hide(); + var img = new Image(); img.onload = start; + // img.src = "~/../content/images/" + src;; img.src = src; - //if (isMaskImage == 'N') { - // $scope.MCounter++; - - - // $scope.ColoredImageSRC.push( - // { - // "bodyRegionId": bodyRegionId, "SRC": src, - // "Height": h, - // "Width": w, - // "x": x, - // "y": y, - // "haveMirror": 'true' - // } - // ); - // console.log('$scope.ColoredImageSRC.length inside flipped = ' + $scope.ColoredImageSRC.length + ', for $scope.layerNumber= ' + $scope.layerNumber); - - //} function start() { - context.save(); context.translate(w, 0); context.scale(-1, 1); @@ -1371,9 +1346,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo if (isMaskImage == 'N') { - //$scope.MCounter++; - - $scope.ColoredImageSRC.push( { "bodyRegionId": bodyRegionId, "SRC": src, @@ -1384,7 +1356,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo "haveMirror": 'true' } ); - //console.log('$scope.ColoredImageSRC.length inside flipped = ' + $scope.ColoredImageSRC.length + ', for $scope.layerNumber= ' + $scope.layerNumber); // console.log('$rootScope.isListManagerSelected= ' + $rootScope.isListManagerSelected + ' length= ' + $scope.ColoredImageSRC.length) @@ -1408,23 +1379,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } if ($scope.isEligibleForHighlight == true) { - - //set scroll position - if ($scope.isLayerChange) { - console.log('$scope.imageHorizontlScrollPosition = ' + $scope.imageHorizontlScrollPosition + ' and $scope.imageVerticalScrollPosition = ' + $scope.imageVerticalScrollPosition) - - var isiOSSafari = (navigator.userAgent.match(/iPad/i)) ? true : false; - - if (isiOSSafari) { - $('#canvasDiv').scrollLeft($scope.imageHorizontlScrollPosition); - - } - else { - $('#canvasDiv').scrollLeft($scope.imageHorizontlScrollPosition) - } - // $('#canvasDiv').scrollLeft($scope.imageHorizontlScrollPosition) - $('#canvasDiv').scrollTop($scope.imageVerticalScrollPosition) - } if ($rootScope.isHighLight == true || ($rootScope.isListManagerSelected == true) || (($rootScope.isGenderChnage == true) && ($rootScope.isHighLight == true)) || (($rootScope.isViewChange == true) && ($rootScope.isHighLight == true))) { $rootScope.isLoading = false; @@ -1471,11 +1425,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.DrawImage = function (h, w, x, y, src, bodyRegionId, isMaskImage) { - $scope.counter++; - - //console.log('normal image called for bodyRegionId= ' + bodyRegionId+' and counter=: ' +$scope.counter); - - var imgCanvas = document.createElement('canvas'); imgCanvas.height = h; @@ -1663,7 +1612,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.MultiLanguageAnnationArray = []; - //console.log('1. annotationText: ' + annotationText); + console.log('1. annotationText: ' + annotationText); if ($('#dot').length > 0) { $('#dot').remove(); @@ -1710,32 +1659,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo img.src = src; - //if (isMaskImage == 'N') { - // if (bodyRegionId == 'modestyImg3' || bodyRegionId == 'modestyImg2') { - // //do nothing - // } - // else { - // $scope.counter++; - - - - // $scope.ColoredImageSRC.push( - // { - // "bodyRegionId": bodyRegionId, "SRC": src, - // "Height": h, - // "Width": w, - // "x": x, - // "y": y, - // "haveMirror": 'false' - // } - - // ); - // console.log('$scope.ColoredImageSRC.length inside normal = ' + $scope.ColoredImageSRC.length + ', for $scope.layerNumber= ' + $scope.layerNumber); - // } - //} - function start() { - + //debugger; context.drawImage(img, 0, 0); if (isMaskImage == 'N') { @@ -1743,10 +1668,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //do nothing } else { - $scope.counter++; - - - $scope.ColoredImageSRC.push( { "bodyRegionId": bodyRegionId, "SRC": src, @@ -1757,8 +1678,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo "haveMirror": 'false' } - ); - // console.log('$scope.ColoredImageSRC.length inside normal = ' + $scope.ColoredImageSRC.length + ', for $scope.layerNumber= ' + $scope.layerNumber); + ); if (($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined)) { @@ -1779,23 +1699,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } if ($scope.isEligibleForHighlight == true) { - - //set scroll position - if ($scope.isLayerChange) { - console.log('$scope.imageHorizontlScrollPosition = ' + $scope.imageHorizontlScrollPosition + ' and $scope.imageVerticalScrollPosition = ' + $scope.imageVerticalScrollPosition) - - var isiOSSafari = (navigator.userAgent.match(/iPad/i)) ? true : false; - - if (isiOSSafari) { - $('#canvasDiv').scrollLeft($scope.imageHorizontlScrollPosition); - - } - else { - $('#canvasDiv').scrollLeft($scope.imageHorizontlScrollPosition) - } - // $('#canvasDiv').scrollLeft($scope.imageHorizontlScrollPosition) - $('#canvasDiv').scrollTop($scope.imageVerticalScrollPosition) - } if ($rootScope.isHighLight == true || ($rootScope.isListManagerSelected == true) || (($rootScope.isGenderChnage == true) && ($rootScope.isHighLight == true)) || (($rootScope.isViewChange == true) && ($rootScope.isHighLight == true))) { $rootScope.isLoading = false; @@ -1815,11 +1718,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } } - + console.log('ColoredImageSRC. pushed and length: ' + $scope.ColoredImageSRC.length); } } - if (imgCanvas.id.match('_mci')) { var maskImgData = context.getImageData(0, 0, w, h); $rootScope.MaskCanvasData.push( @@ -1840,7 +1742,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo - $scope.highLightBodyBasedOnIcolor = function (RGBColor) { @@ -1864,14 +1765,11 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.HighlightBodyOnExtract = function () { + var multiTermList = []; var CallBackBodyRegion = []; - if ($rootScope.isListManagerSelected) { - multiTermList = $scope.AllTerms; - } - - else if (($rootScope.previousHighlightList != null || $rootScope.previousHighlightList != undefined) && ($rootScope.previousHighlightList.length > 0)) { + if (($rootScope.previousHighlightList != null || $rootScope.previousHighlightList != undefined) && ($rootScope.previousHighlightList.length > 0)) { angular.forEach($rootScope.previousHighlightList, function (value, key) { var ActualTermNo = $scope.getActualTermNumber(value); @@ -1975,7 +1873,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //} worker.onmessage = function (e) { - //console.log('callback in extract for e.data.bodyRegionId: ' + e.data.bodyRegionId + ', time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")); + console.log('callback in extract for e.data.bodyRegionId: ' + e.data.bodyRegionId + ', time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")); var updatedData = e.data.value; @@ -2070,7 +1968,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo // $rootScope.updatedGrayDataList = []; //} - //console.log('HighlightBodyByTermList is called'); + console.log('HighlightBodyByTermList is called'); // $scope.highlightedBR = null; $scope.highlightedBR = []; @@ -2191,7 +2089,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.runningWorkers.push({ 'workerName': worker }) // console.log('for bodyRegionId = ' + bodyRegionId+ ', time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")) - //console.log('before worker call BRID: ' + bodyRegionId) + console.log('before worker call BRID: ' + bodyRegionId) if (grayImageDataVar != null && coloredImageDataVar != null && maskData != null) { worker.postMessage({ @@ -2209,7 +2107,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo worker.onmessage = function (e) { - //console.log('callback for e.data.bodyRegionId: ' + e.data.bodyRegionId + ', time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")); + console.log('callback for e.data.bodyRegionId: ' + e.data.bodyRegionId + ', time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")); var updatedData = e.data.value; @@ -2249,7 +2147,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //$scope.highlightedBR.push({ 'bodyRegionId': bodyRegionId }); - //console.log('$scope.highlightedBR.length= ' + $scope.highlightedBR.length) + console.log('$scope.highlightedBR.length= ' + $scope.highlightedBR.length) if ($scope.highlightedBR != null || $scope.highlightedBR != undefined) { @@ -2314,7 +2212,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo }); - //console.log('createTermListByPreviousTermsAndHighlight is called'); + console.log('createTermListByPreviousTermsAndHighlight is called'); if ((multiTermList != undefined || multiTermList != null) && multiTermList.length > 0) { @@ -2426,24 +2324,11 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //layer change function $scope.LayerChange = function () { - //get current scroll postion to set it after layer change - var canvasDiv = document.getElementById('canvasDiv'); - $scope.imageVerticalScrollPosition = canvasDiv.scrollTop; - $scope.imageHorizontlScrollPosition = canvasDiv.scrollLeft; - console.log('LAYERCHANGE $scope.imageHorizontlScrollPosition = ' + $scope.imageHorizontlScrollPosition + ' and $scope.imageVerticalScrollPosition = ' + $scope.imageVerticalScrollPosition) - - - - - $scope.counter = 0; - $scope.counterFlip = 0; - - console.log('$scope.ColoredImageSRC.length OUTSIDE= ' + $scope.ColoredImageSRC.length) - - - //if listanager is visisble then close it - $rootScope.isListManagerSelected = false; - $rootScope.CloseListManager(); + + //if listanager is visisble then close it + $rootScope.isListManagerSelected = false; + + $rootScope.CloseListManager(); @@ -2454,6 +2339,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //1. $scope.terminateCurrentlyRunningWPs(); + var canvasDiv = document.getElementById('canvasDiv'); + $scope.imageVerticalScrollPosition = canvasDiv.scrollTop; + $scope.imageHorizontlScrollPosition = canvasDiv.scrollLeft; // debugger; // $('#daLoaderLabel').css('visibility', 'visible'); @@ -2517,7 +2405,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo // alert(' $.each(BodyRegionDictionary3. bodyRegionRight: ' + bodyRegionRight + ', bodyRegionBottom: ' + bodyRegionBottom) if (TransparencyBoxStartX <= bodyRegionRight && value.X <= transparencyBoxRight && TransparencyBoxStartY <= bodyRegionBottom && value.Y <= transparencyBoxBottom) { //var transNumber = parseInt(document.getElementById("txtTransparencyChange").value); - + // debugger; $scope.layerNumber = parseInt(txtlayerNumber.value); @@ -2529,14 +2417,11 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } else { - - //1. Dated:13-07-2016 Issue #4965 : The layer number should not extend beyond its level through layer text box. var dataLength = $rootScope.BodyLayerData.Layers.DataLayer.length; if (parseInt($('#txtlayerNumber').val()) > (dataLength - 1)) { $('#txtlayerNumber').val(dataLength - 1); $scope.currentLayerNumber = parseInt(dataLength - 1); - $scope.layerNumber = parseInt(dataLength - 1); } else @@ -2550,18 +2435,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo canDiv.innerHTML = ''; } - $scope.flushCanvas(); //2. - //existing data - if (($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined) && $scope.ColoredImageSRC.length > 0) { - $scope.ColoredImageSRC.length = 0; - // $scope.ColoredImageSRC = undefined; - $scope.ColoredImageSRC = []; - - } - - //console.log('layer changed is called'); - $scope.CalculateImageCordinates($rootScope.viewOrientationId); //3. @@ -2585,7 +2459,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $('#btnHighLight').removeClass('btn btn-black'); $('#btnHighLight').addClass('btn-primary'); - // console.log('highLightBody call from DisableProgressBar') + console.log('highLightBody call from DisableProgressBar') // $scope.highLightBody(); @@ -2633,7 +2507,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //2. if (event.ctrlKey) { - // console.log('ctrl pressed'); + console.log('ctrl pressed'); $scope.multiAnnotationIsON = true; @@ -2646,11 +2520,11 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo var isClickedOnSamePoint = $("#canvasDiv").find("div[id=" + pointClicked + "]").length; - // console.log('isClickedOnSamePoint: ' + isClickedOnSamePoint); + console.log('isClickedOnSamePoint: ' + isClickedOnSamePoint); // if user has not clciked on smae point then create speech bubble otherwise not if (isClickedOnSamePoint == 0) { - // console.log('not clicked on same point') + console.log('not clicked on same point') $scope.createSpeechBubbleBasedOnAnnotationLength(pointClicked, x, y, id); $scope.speechbubbleList.push({ xaxis: x, yaxis: y, ids: id }); @@ -2711,7 +2585,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } } else { - // console.log('MultiLanguageAnnationArray.length is :' + $scope.MultiLanguageAnnationArray.length) + console.log('MultiLanguageAnnationArray.length is :' + $scope.MultiLanguageAnnationArray.length) } if ($scope.longestAnnotation != null || $scope.longestAnnotation != undefined) { if ($scope.longestAnnotation.length <= 10) { @@ -3396,8 +3270,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //if listanager is visisble then close it - $rootScope.isListManagerSelected = false; - $rootScope.CloseListManager(); + + $rootScope.isListManagerSelected = false; + $rootScope.CloseListManager(); $scope.isTransparencyActivated = true; @@ -3803,7 +3678,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //do nothing } else if (isLayerChanged) { - + // debugger $scope.layerNumber = parseInt($('#txtlayerNumber').val()); } @@ -3811,7 +3686,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo var currentLayer = parseInt($('#txtlayerNumber').val()); var tranparencyLayer = currentLayer + 1; - $scope.layerNumber = tranparencyLayer; } @@ -4535,7 +4409,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //$("canvas[name*='transparencyTempCanvas']").nextUntil($("canvas[name*='transparencyTempCanvas']")) //.remove(); - $scope.layerNumber = $scope.currentLayerNumber; $scope.transNumber = 50; $(".slider").slider({ value: 50 }) @@ -4599,11 +4472,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.OnIdentityClick = function () { - // $('#btnIdentity').addClass('btn-primary'); + //if listanager is visisble then close it + $rootScope.isListManagerSelected = false; $rootScope.CloseListManager(); - + // $('#btnIdentity').addClass('btn-primary'); if ($scope.isTransparencyActivated == true) { @@ -4623,11 +4497,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.enableZoom = function () { + //if listanager is visisble then close it + $rootScope.isListManagerSelected = false; $rootScope.CloseListManager(); - //remove speech bubble $('#sppeachBubble').css('display', 'none'); $("#dot").css("display", "none"); @@ -4642,6 +4517,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $rootScope.isZoomed = true; //1. + $scope.flushCanvas(); if ($scope.zoomInOut == 25) { @@ -4680,73 +4556,30 @@ 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 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); - } - - 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) { - for (var j = 0; j < modestyCanvases.length; j++) { - modestyCanvases[j].remove(); - } - } - } - - //for (var i = 1; i < 7; i++) { - - // var id; - // var maskId; - - // id = 'imageCanvas' + i; - // maskId = 'imageCanvas' + i + '_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); + // } // if (i == 4 || i == 5 || i == 6) { // id = 'imageCanvas' + i + '_MR'; // maskId = 'imageCanvas' + i + '_MR_mci'; @@ -4760,6 +4593,11 @@ 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) { @@ -4768,6 +4606,44 @@ 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 () { @@ -4787,11 +4663,13 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.enableHighlight = function () { + console.log('enableHighlight is called') + + //if listanager is visisble then close it - // $rootScope.isListManagerSelected = false; - $rootScope.CloseListManager(); - // console.log('enableHighlight is called') + // $rootScope.isListManagerSelected = false; + $rootScope.CloseListManager(); if ($rootScope.isHighLight == true) { @@ -4814,7 +4692,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } else { - // console.log('highLightBody from enableHighlight') + console.log('highLightBody from enableHighlight') $timeout(function () { $scope.highLightBody() }, 50); } @@ -4829,8 +4707,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.enableNormalMode = function () { + //if listanager is visisble then close it - // $rootScope.isListManagerSelected = false; + + // $rootScope.isListManagerSelected = false; $rootScope.CloseListManager(); if ($rootScope.isNormalMode == true) { @@ -4866,10 +4746,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.enableExtract = function () { + + //if listanager is visisble then close it - // $rootScope.isListManagerSelected = false; - $rootScope.CloseListManager(); + // $rootScope.isListManagerSelected = false; + $rootScope.CloseListManager(); //1. $rootScope.isLoading = true; $('#spinner').css('visibility', 'visible'); @@ -4896,7 +4778,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } //4. - //console.log('highLightBody from enableExtract') + console.log('highLightBody from enableExtract') $scope.highLightBody(); @@ -4910,11 +4792,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.enableShowHideStructureBox = function () { + //if listanager is visisble then close it + $rootScope.isListManagerSelected = false; $rootScope.CloseListManager(); - $(".com").toggle(); $('#dot').toggle(); $('#sppeachBubble').toggle() @@ -4924,7 +4807,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); $scope.terminateCurrentlyRunningWPs(); @@ -4954,7 +4837,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.grayedBR = []; angular.forEach($scope.ColoredImageSRC, function (value, key) { - //console.log('$scope.ColoredImageSRC length before gray= ' + $scope.ColoredImageSRC.length) + console.log('$scope.ColoredImageSRC length before gray= ' + $scope.ColoredImageSRC.length) var id; if (value.haveMirror == 'true') { id = 'imageCanvas' + value.bodyRegionId + '_MR'; @@ -4994,8 +4877,8 @@ 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) + 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); @@ -5123,10 +5006,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $timeout(function () { $scope.HighlightBodyOnExtract() }, 50); } - else if ($rootScope.isListManagerSelected == true) { - $timeout(function () { $scope.HighlightBodyOnExtract() }, 50); - - } } //else { // // 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 @@ -5183,6 +5062,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo else { // This code will execute when user will select normal Mode but this time isHighlight will be false + angular.forEach($scope.ColoredImageSRC, function (value, key) { var id; if (value.haveMirror == 'true') { @@ -5277,9 +5157,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $timeout(function () { $scope.HighlightBodyOnExtract() }, 50); - } - else if ($rootScope.isListManagerSelected == true) { - $timeout(function () { $scope.HighlightBodyOnExtract() }, 50); + // to do } } @@ -5362,9 +5240,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.OnGenderChange = function (event) { //if listanager is visisble then close it - $rootScope.isListManagerSelected = false; - $rootScope.CloseListManager(); - + + $rootScope.isListManagerSelected = false; + $rootScope.CloseListManager(); $rootScope.isLoading = true; $('#spinner').css('visibility', 'visible'); @@ -5456,7 +5334,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo - // console.log('terminate worker process') + console.log('terminate worker process') //terminate previous running workers to create space for new workers $scope.terminateCurrentlyRunningWPs(); @@ -5523,11 +5401,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.OnViewChange = function (event) { - //if listanager is visisble then close it + $rootScope.isListManagerSelected = false; $rootScope.CloseListManager(); + $rootScope.isLoading = true; $('#spinner').css('visibility', 'visible'); @@ -5537,7 +5416,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } $rootScope.isViewChange = true; - $scope.layerNumber = 0; // debugger; var selectedViewId = $scope.bodyViews[event.currentTarget.attributes[1].value]; @@ -5673,7 +5551,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //Reload DA controller event listener after setting change $scope.$on('reloadDAControllerEvent', function (event, data) { - //console.log('reloadDAControllerEvent'); + console.log('reloadDAControllerEvent'); $scope.loadDissectibleAnatomyData(); @@ -5682,7 +5560,6 @@ 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; @@ -6632,13 +6509,13 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.HighlightBodysystem = function (event) { - - //if listanager is visisble then close it + $rootScope.isListManagerSelected = false; $rootScope.CloseListManager(); + //NIKITA $scope.isHighlightBodysystem = true; $scope.systemMatchedTermList = new jinqJs() .from($rootScope.BodySystemData.BodySystem.BodySystemTerm) @@ -6648,7 +6525,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo if ($rootScope.isHighLight == false) { //color the body gray $rootScope.isHighLight = true - //console.log('highLightBody from HighlightBodysystem') + console.log('highLightBody from HighlightBodysystem') $scope.highLightBody(); } //now highlight the selected body system in whole body @@ -6657,7 +6534,13 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //$rootScope.isLoading = true; $('#spinner').css('visibility', 'visible'); + //NIKITA + // $scope.isHighlightBodysystem = true; + //if (systemMatchedTermList != null || systemMatchedTermList != undefined) { + + // $timeout(function () { $scope.HighlightBodyByTermList(systemMatchedTermList) }, 100); + //} var viewtarget_highlightbody = angular.element(event.currentTarget); @@ -6851,7 +6734,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.ShowSearch = function () { - // console.log('ShowSearch is called'); + console.log('ShowSearch is called'); $timeout(function () { $scope.IsSearchVisible = true; @@ -7089,7 +6972,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo layerNumber = parseInt(layerNumber) - 1; } - $scope.layerNumber = layerNumber; //4.get scroll position @@ -7221,7 +7103,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } $scope.aligneCanvasWithTerm = function () { - // console.log('aligneCanvasWithTerm') + console.log('aligneCanvasWithTerm') var newX = parseInt($scope.scaleValue($scope.termCoordinate.x, $scope.zoomInOut, DA[0].ZOOM_TERM_DATA)); var newY = parseInt($scope.scaleValue($scope.termCoordinate.y, $scope.zoomInOut, DA[0].ZOOM_TERM_DATA)); @@ -7244,7 +7126,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo - // console.log('newX =' + newX + ',newY= ' + newY) + console.log('newX =' + newX + ',newY= ' + newY) $('#canvasDiv').scrollLeft(newX); $('#canvasDiv').scrollTop(newY);