From 41bb855900b0452a97c5d71f664a8bacf7015b40 Mon Sep 17 00:00:00 2001 From: amrita.vishnoi Date: Wed, 22 Jun 2016 14:31:20 +0530 Subject: [PATCH] Multi annotation --- 400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js | 228 +++++++++++++++++++----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1 file changed, 19 insertions(+), 209 deletions(-) diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index 6e3de35..65df3bc 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -32,6 +32,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.zoomInOut = 75; + $scope.multiAnnotationIsON = true; + //array for bodyviewid correspoing to male female(used for gender change) $scope.correspondingBodyViewIds = { '1': '5', @@ -362,7 +364,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo }) - $scope.LoadDefaultLayerImage = function () { // debugger; @@ -852,7 +853,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo var actulalX = mirrorXOnNormalImage var actualY = mousePos.y + verticalScrollPosition - + var pixelData = maskCanvasContext.getImageData(Math.round(actulalX - parseInt(maskCanvasContext.canvas.offsetLeft)), Math.round(actualY - y), 1, 1); pixelData.data[0] = pixelData.data[0] - 9; @@ -912,18 +913,24 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo if ($('#speechBubbleTrns').length > 0) $('#speechBubbleTrns').remove(); - - if ($('#speechBubble').length > 0) { - $('#speechBubble').remove(); - + + if ($scope.multiAnnotationIsON == true) + { $scope.createSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50) - } - else - $scope.createSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50) + else { + if ($('#speechBubble').length > 0) { + $('#speechBubble').remove(); + + $scope.createSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50) + } + else { + $scope.createSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50) + } + } }, false); FlipedImgCanvas.addEventListener('mousedown', function (evt) { @@ -1120,26 +1127,17 @@ 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 context = imgCanvas.getContext('2d'); var img = new Image(); img.onload = start; img.src = src; - // img.src = img.src = "~/../content/images/" + src; - - + function start() { // debugger; context.drawImage(img, 0, 0); }; - // $('#daLoaderLabel').css('visibility', 'visible') - - // $rootScope.isLoading = true; - + document.getElementById('canvasDiv').appendChild(imgCanvas); } @@ -1211,45 +1209,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo grayImageDataVar = grayImageData.data; } - - //var grayImageDataVarMR; - // var grayImageDataMR; var coloredImageDataVarMR; var coloredImageDataMR - //if ($scope.ColoredImageSRC[x].haveMirror) { - - - // var coloredCanvasMRID = 'imageCanvas' + bodyRegionId + '_MR'; - // var coloredCanvasMR = document.getElementById(coloredCanvasMRID); - // var coloredCanvasContextMR = coloredCanvasMR.getContext("2d"); - // coloredImageDataMR = coloredCanvasContextMR.getImageData(0, 0, scaledWidth, scaledHeight); - // coloredImageDataVarMR = coloredImageDataMR.data; - //} - - //else - //{ - // var coloredCanvas = 'imageCanvas' + bodyRegionId; - // var coloredCanvas = document.getElementById(coloredCanvas); - // var coloredCanvasContext = coloredCanvas.getContext("2d"); - // coloredImageData = coloredCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight); - // coloredImageDataVar = coloredImageData.data; - //} - - //if (bodyRegionId == 6 || bodyRegionId == 5 || bodyRegionId == 4) { - // //var grayCanvasMRID = 'GrayImageCanvas' + bodyRegionId + '_MR'; - // //var grayCanvasMR = document.getElementById(grayCanvasMRID); - // //var grayCanvasContextMR = grayCanvasMR.getContext("2d"); - // //grayImageDataMR = grayCanvasContextMR.getImageData(0, 0, scaledWidth, scaledHeight); - // //grayImageDataVarMR = grayImageDataMR.data; - - // var coloredCanvasMRID = 'imageCanvas' + bodyRegionId + '_MR'; - // var coloredCanvasMR = document.getElementById(coloredCanvasMRID); - // var coloredCanvasContextMR = coloredCanvasMR.getContext("2d"); - // coloredImageDataMR = coloredCanvasContextMR.getImageData(0, 0, scaledWidth, scaledHeight); - // coloredImageDataVarMR = coloredImageDataMR.data; - //} - + var counter = 0; var imageDataVar = maskImgData.data; @@ -1298,34 +1261,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo if (parseInt(termNo) == parseInt(Icolor)) { counter++; - - // var DAData = new BitmapData($scope.MaskImageSRC[x].Width, $scope.MaskImageSRC[x].Height); - // DAData.draw($scope.grayCanvasList[x].SRC); - // var RED = 0.3086; // luminance contrast value for red - // var GREEN = 0.694; // luminance contrast value for green - // var BLUE = 0.0820; // luminance contrast value for blue - - // var RGB = [RED, GREEN, BLUE, 0, 0]; - // var RGB2 = [RED, GREEN, BLUE, 0, 0]; - // var RGB3 = [RED, GREEN, BLUE, 0, 0]; - // var ALPHA = [0, 0, 0, 1, 0]; - - // var rgbPx = RGB.concat(RGB2); - // var rgbPx2 = rgbPx.concat(RGB3); - // var matrix = rgbPx2.concat(ALPHA); - - // var zeroPoint = new Point(); - // var grayScale = new ColorMatrixFilter(matrix); - // DAData.applyFilter(DAData, DAData.rect, zeroPoint, grayScale); - - // grayCanvasContext.putImageData(DAData.data, 0, 0) - // } - //} - - - //if (!isHighLighted) { - //alert('icolor matched with term no ' +termNo); - if (coloredImageDataVar!= null) { var RED_coloredImage = coloredImageDataVar[i]; @@ -1345,137 +1280,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } - //} } } grayCanvasContext.putImageData(grayImageData, 0, 0); - - //if (!isHighLighted) { - // grayImageData.data = grayImageDataVar; - - // grayCanvasContext.putImageData(grayImageData, 0, 0); - // isHighLighted = true; - //} - //else { - //grayImageData.data = grayImageDataVar; - //grayCanvasContext.putImageData(grayImageData, 0, 0); - //} - - //if (bodyRegionId == 6 || bodyRegionId == 5 || bodyRegionId == 4) { - - // var grayCanvasMRID = 'imageCanvas' + bodyRegionId + '_MR'; - // var grayCanvasMR = document.getElementById(grayCanvasMRID); - // // document.getElementById('canvasDiv').removeChild(grayCanvasMR); - - // var tempCanvasMR = document.createElement('canvas'); - // tempCanvasMR.id = 'imageCanvas' + bodyRegionId + '_MR'; - // tempCanvasMR.style.position = "absolute"; - // tempCanvasMR.style.left = scledX + 'px'; - // tempCanvasMR.style.top = scledY + 'px'; - // //tempCanvas.style.border = 'black 1px solid'; - // tempCanvasMR.height = scaledHeight; - // tempCanvasMR.width = scaledWidth; - - - // var tempCtx = tempCanvasMR.getContext('2d'); - // tempCtx.save(); - // tempCtx.translate(scaledWidth, 0); - // tempCtx.scale(-1, 1); - // tempCtx.drawImage(grayCanvas, 0, 0); - - // document.getElementById('canvasDiv').appendChild(tempCanvasMR); - - // //cleaned up the old canvas - - - // //tempCanvas.addEventListener() - - // tempCanvasMR.addEventListener('click', function (evt) { - - // //get mouse coordinate of mirror image click - // var mousePos = getMousePos(evt); - // //alert(mousePos.x + ',' + mousePos.y); - - // var tempCanvasMR_context = tempCanvasMR.getContext("2d"); - // var canvasId = tempCanvasMR_context.canvas.getAttribute('id'); - - // var mirrorCanvasX = tempCanvasMR_context.canvas.offsetLeft; - // var mirrorCanvasWidth = tempCanvasMR_context.canvas.clientWidth; - - // // get mask canvas for it. - // //var maskCanvasID = 'imageCanvas' + bodyRegionId + '_mci'; - // //var maskCanvas = document.getElementById(maskCanvasID); - // //var maskCanvasContext = maskCanvas.getContext("2d"); - - - // // var canvasDiv = document.getElementById('canvasDiv'); - // var verticalScrollPosition = canvasDiv.scrollTop; - // var horizontlScrollPosition = canvasDiv.scrollLeft; - - // var distanceXOnMirrorImage = (parseInt(mirrorCanvasX) + parseInt(mirrorCanvasWidth)) - (parseInt(mousePos.x) + horizontlScrollPosition);// - 135); - - // var mirrorXOnNormalImage = parseInt(maskCanvasContext.canvas.offsetLeft) + parseInt(distanceXOnMirrorImage); - - // var actulalX = mirrorXOnNormalImage - // var actualY = mousePos.y + verticalScrollPosition - - - - // var Icolor = $scope.getIcolorOnUserClick(maskCanvasContext, Math.round(actulalX - parseInt(maskCanvasContext.canvas.offsetLeft)), Math.round(actualY - y)); - - // //2. Find Actul Term No Based on Icolor. - // var ActualTermNo = $scope.getActualTermNumber(Icolor); - // //alert('actual term no: ' + ActualTermNo); - - // //3. Find Term No List Based on ActualTermNo - // var TermList = $scope.getTermNumberList(ActualTermNo); - // // alert('termList.count: ' + TermList.length); - - // //4. - - // $scope.machedTermNoLocation = []; - // for (var i = 0; i < TermList.length; i++) { - - // var termNumber = parseInt(TermList[i]._TermNumber); - - // //Match Term No List in each bodyRegion - // //$scope.getLocationsForMatchedTermsInWholeBody(termNumber, 'Y'); - - // $scope.getLocationsForMatchedTermsInWholeBody(termNumber, x, y); - // } - - // var annotationText = $scope.GetAnnotationText(parseInt(Icolor)); - - // if ($('#speechBubble').length > 0) { - // $('#speechBubble').remove(); - - // createSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50) - - // } - // else - // createSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50) - - - - // }, false); - - // tempCanvasMR.addEventListener('mousedown', function (evt) { - - // //alert('mousedown') - // }, false); - - - // tempCanvasMR.addEventListener('mouseup', function (evt) { - // //alert('mouseup') - - - // }, false); - - - //} } } -- libgit2 0.21.4