From 21836e5dfe4a0baa36d34d58a02b42cf4529d805 Mon Sep 17 00:00:00 2001 From: nikita Date: Wed, 25 May 2016 12:50:08 +0530 Subject: [PATCH] annotations implemented with leaf (modesty). --- 400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js | 160 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------- 400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js | 2 +- 2 files changed, 81 insertions(+), 81 deletions(-) diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index c89c5de..5b98832 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -259,16 +259,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo console.log(data); }); - ////load vocabterm data - //$http({ method: 'GET', url: '~/../content/data/json/cm_dat_vocabterm_1.json' }).success(function (data) { - // $scope.VocabTermData = data; - //}) - // .error(function (data, status, headers, config) { - // console.log(data); - // }); - - - var openViews; @@ -376,9 +366,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo - - - $scope.LoadDefaultLayerImage = function () { // debugger; @@ -604,48 +591,25 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.figLaefX = filtereddata[0]._X; $scope.figLaefY = filtereddata[0]._Y; + var rectangle = scaleRectangle(value._X, value._Y, value._Height, value._Width, value._MirrorValue); + + var src = "content/images/DA/BodyViews/" + $scope.voId + "/layers/0/" + value._BodyRegionId + "/" + $scope.figLaefImageName; - var leafImg = new Image(); - leafImg.id = 'modestyImg' - leafImg.src = src; + $scope.DrawImage(rectangle.scaledHeight, rectangle.scaledWidth, rectangle.scaledX, rectangle.scaledY, src, 'modestyImg' + value._BodyRegionId, 'N') - var rectangle = scaleRectangle(value._X, value._Y, value._Height, value._Width, value._MirrorValue); - var rectangle1 = scaleRectangle($scope.figLaefX, $scope.figLaefY, leafImg.height, leafImg.width, value._MirrorValue); - var abc; - //if ($scope.viewOrientationId == 5) { - // leafImg.style.position = 'absolute'; - // leafImg.style.left = '800px'; //+parseInt(rectangle1.scaledX) + 'px';//'780px'; - // leafImg.style.top = '800px'; - //} - //else { - leafImg.style.position = 'absolute'; - leafImg.style.left = parseInt(rectangle.scaledX) + 'px'; //+parseInt(rectangle1.scaledX) + 'px';//'780px'; - leafImg.style.top = parseInt(rectangle.scaledY) + 'px';// +parseInt(rectangle1.scaledY) + 'px';//'1200px'; - leafImg.style.visibility = 'hidden'; - - document.getElementById('canvasDiv').appendChild(leafImg); } - //$scope.DrawImage(Math.round(rectangle1.scaledHeight), Math.round(rectangle1.scaledWidth), Math.round(parseInt(rectangle.scaledX) + parseInt(rectangle1.scaledX)), Math.round(parseInt(rectangle.scaledY) + parseInt(rectangle1.scaledY)), src, value._BodyRegionId + '_fig', 'N'); - // - // var xlData:XMLList = _xmlBackgroundArtViewList[XMLConst.ITEM].((@voId == String(iViewOrientationId)) && (@gr == strGenderId) - //&& (@brId == bodyRegionId) && ( @lns <= iLayerNumber && @lne >= iLayerNumber ) && (@isfr == DADataConst.YES)); - // var strImageId:String = xlData[XMLConst.IMAGE_TYPE_ID]; - // if(strImageId != null && strImageId != "") - // { - // return strImageId; - // } - // + } } }); - debugger; + if ((DA[0].modesty == 'Y')) { - if ($('#modestyImg') != null) { - $('#modestyImg').css('visibility', 'visible'); + if ($('.modestyImg') != null) { + $('.modestyImg').css('visibility', 'visible'); } } //set scrollbars on canvas and hide loading label @@ -986,20 +950,34 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } else { + + imgCanvas.id = 'imageCanvas' + bodyRegionId; imgCanvas.style.visibility = 'visible' + if (bodyRegionId.match('modestyImg')) { + //added class to further access this canavs to show and hide leaf as per modesty seting + imgCanvas.className = 'modestyImg' + imgCanvas.style.visibility = 'hidden' + } } imgCanvas.addEventListener('click', function (evt) { - // debugger; + var context = imgCanvas.getContext("2d"); var canvasId = context.canvas.getAttribute('id'); - - var maskCanvasId = canvasId + '_mci'; + var maskCanvasId; + //for leaf canvas + if (canvasId.match('modestyImg')) { + maskCanvasId = canvasId; + } + else + { + maskCanvasId = canvasId + '_mci'; + } var maskCanvas = document.getElementById(maskCanvasId); var canvasContextForRGB = maskCanvas.getContext("2d"); @@ -1013,46 +991,31 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //We substracted 135, as the difference between flex and html coordinates for same organ is 135 - var actulalX = mousePos.x + horizontlScrollPosition// - 135;// + leftToolBarWidth; - var actualY = mousePos.y + verticalScrollPosition //- 135; //+ tomenuBarheight + titleBarheight + searchComboheight; - - - - var pixelData = canvasContextForRGB.getImageData(Math.round(actulalX - x), Math.round(actualY - y), 1, 1); + var actulalX = mousePos.x + horizontlScrollPosition; + var actualY = mousePos.y + verticalScrollPosition ; - pixelData.data[0] = pixelData.data[0] - 9; - pixelData.data[1] = pixelData.data[1] - 9; - pixelData.data[2] = pixelData.data[2] - 9; - var Red; - var Green; - var Blue; - var zero = "0"; + //debugger; + var RGBColor = $scope.GetRGBColor(canvasContextForRGB, actulalX, actualY,x,y); + var annotationText; - if ((pixelData.data[0]).toString().length != 2) { - Red = zero.concat((pixelData.data[0]).toString()) + if (maskCanvasId.match('modestyImg') && RGBColor != '000000') { + RGBColor = DA[0].figLeafTermId; + annotationText = $scope.GetAnnotationBasedOnActualTermNo(RGBColor); } - else { - Red = (pixelData.data[0]).toString() - } - if ((pixelData.data[1]).toString().length != 2) { - Green = zero.concat((pixelData.data[1]).toString()) - } - else { - Green = (pixelData.data[1]).toString() - - } - if ((pixelData.data[2]).toString().length != 2) { - Blue = zero.concat((pixelData.data[2]).toString()) + else if (maskCanvasId.match('modestyImg') && RGBColor == '000000') { + bodyRegionId = maskCanvasId.slice(-1); + maskCanvasId = 'imageCanvas' + bodyRegionId + '_mci'; + var maskCanvas = document.getElementById(maskCanvasId); + var canvasContextForRGB = maskCanvas.getContext("2d"); + RGBColor = $scope.GetRGBColor(canvasContextForRGB, actulalX, actualY,x,y); + annotationText = $scope.GetAnnotationText(parseInt(RGBColor)); } else { - Blue = (pixelData.data[2]).toString() + RGBColor = $scope.GetRGBColor(canvasContextForRGB, actulalX, actualY,x,y); + annotationText = $scope.GetAnnotationText(parseInt(RGBColor)); } - var RGBColor = (Red + Green + Blue); - - - var annotationText = $scope.GetAnnotationText(parseInt(RGBColor)); - + if ($('#speechBubble').length > 0) { $('#speechBubble').remove(); @@ -1100,6 +1063,43 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } + $scope.GetRGBColor = function (canvasContextForRGB, actulalX, actualY,x,y) { + + var pixelData = canvasContextForRGB.getImageData(Math.round(actulalX - x), Math.round(actualY - y), 1, 1); + + pixelData.data[0] = pixelData.data[0] - 9; + pixelData.data[1] = pixelData.data[1] - 9; + pixelData.data[2] = pixelData.data[2] - 9; + var Red; + var Green; + var Blue; + var zero = "0"; + + if ((pixelData.data[0]).toString().length != 2) { + Red = zero.concat((pixelData.data[0]).toString()) + } + else { + Red = (pixelData.data[0]).toString() + } + if ((pixelData.data[1]).toString().length != 2) { + Green = zero.concat((pixelData.data[1]).toString()) + } + else { + Green = (pixelData.data[1]).toString() + + } + if ((pixelData.data[2]).toString().length != 2) { + Blue = zero.concat((pixelData.data[2]).toString()) + } + else { + Blue = (pixelData.data[2]).toString() + + } + var RGBColor = (Red + Green + Blue); + return RGBColor; + } + + //get annotation from term number $scope.GetAnnotationText = function (termNumber) { //debugger; diff --git a/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js b/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js index ad49c48..82dcee5 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js @@ -141,7 +141,7 @@ AIA.constant('DA', [ { ethnicity: 'W', modesty: 'Y', - + figLeafTermId: '5868', }, ]); -- libgit2 0.21.4