diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index d2176f4..c1b235a 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -1376,20 +1376,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //4. $scope.machedTermNoLocation = []; - // console.log(' TermList.length= ' + TermList.length) - - - - //var dataForthisBR = new jinqJs() - // .from($scope.ColoredCanvasData) - // .where('bodyRegionId == ' + 1) - // .select(); - //var coloredImageData = dataForthisBR.coloredImageData; - + var worker = new Worker('term-number-wp.js'); - // console.log('Start time taken for term: ' + TermList[i]._TermNumber + 'in posting: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")); worker.postMessage({ 'termList': TermList, @@ -1404,12 +1394,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //} worker.onmessage = function (e) { - console.log('callback: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")); - - // alert(e.data.value + '....name= ' + e.data.name) + var updatedData = e.data.value; - // debugger; - for (var i = 1; i <= updatedData.length; i++) { + + for (var i = 1; i < updatedData.length; i++) { var grayCanvasID = 'imageCanvas' +i; var grayCanvas = document.getElementById(grayCanvasID); @@ -1419,13 +1407,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo grayCanvasContext.putImageData(updatedData[i], 0, 0); } - //var upadteddata = e.data.value; - //var bodyRegionId = e.data.bodyRegionId; - - - - - // $rootScope.grayImageDataList[bodyRegionId - 1] = upadteddata; + }; worker.onerror = function (e) { @@ -1433,201 +1415,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo }; } - - - //$scope.highLightBodyBasedOnIcolor = function (RGBColor) { - - // $scope.previousSelectedTermList.length = 0; - - // var RGBColor = $scope.previousSelectedTermList[i]; - - // //2. Find Actul Term No Based on Icolor. - // var ActualTermNo = $scope.getActualTermNumber(RGBColor); - - // //3. Find Term No List Based on ActualTermNo - // var TermList = $scope.getTermNumberList(ActualTermNo); - - // if ($scope.previousSelectedTermList.length > 0) { - - // var worker = new Worker('term-number-wp.js'); - - - // for (var i = 0; i < $scope.previousSelectedTermList.length; i++) { - // $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); - - // worker.postMessage({ - // 'cmd': 'abc', - // 'value': termNumber - // }); - // } - - // } - - // worker.onmessage = function (e) { - // var msg = e.data.msg1; - // }; - // worker.onerror = function (e) { - // alert('Error: Line ' + e.lineno + ' in ' + e.filename + ': ' + e.message); - // }; - // } - // else { - - // $scope.machedTermNoLocation = []; - // for (var i = 0; i < TermList.length; i++) { - - // var termNumber = parseInt(TermList[i]._TermNumber); - - // var worker = new Worker('term-number-wp.js'); - - // //start the worker - // worker.postMessage({ - // 'cmd': 'abc', - // 'value': termNumber - // }); - - // worker.onmessage = function (e) { - // var msg = e.data.msg; - // }; - // worker.onerror = function (e) { - // alert('Error: Line ' + e.lineno + ' in ' + e.filename + ': ' + e.message); - // }; - // //Match Term No List in each bodyRegion - // //$scope.getLocationsForMatchedTermsInWholeBody(termNumber); - // } - - - // } - //} - - - - $scope.fillMatchedTerm = function (grayImageDataVar, BrId) { - console.log('Start time taken in fillMatchedTerm: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")); - - //for (var x = 0; x < $scope.ColoredImageSRC.length; x++) { - // // alert('called for bodyRegionId: ' + $scope.MaskImageSRC[x].bodyRegionId); - // var bodyRegionId = $scope.ColoredImageSRC[x].bodyRegionId; - - // { - - // var scaledWidth = $scope.ColoredImageSRC[x].Width; - // var scaledHeight = $scope.ColoredImageSRC[x].Height; - // //var maskImg = $scope.ColoredImageSRC[x].SRC; - - - // var coloredImg = $scope.ColoredImageSRC[x].SRC; - - // var maskImg = $scope.GetMaskImageSource(coloredImg); - - - // var scledX = $scope.ColoredImageSRC[x].x; - // var scledY = $scope.ColoredImageSRC[x].y; - - - // // 1. get mask canvas for this body region. - // //var maskCanvasID; - // //if ($scope.ColoredImageSRC[x].haveMirror == 'true') { - // // maskCanvasID = 'imageCanvas' + bodyRegionId + '_MR_mci'; - // //} - // //else { - // // maskCanvasID = 'imageCanvas' + bodyRegionId + '_mci'; - - // //} - // //var maskCanvas = document.getElementById(maskCanvasID); - // //var maskCanvasContext = maskCanvas.getContext("2d"); - // //var maskImgData = maskCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight); - - // // 2. get coloured canvas for this body region. - - - // var coloredImageDataVar; - // var coloredImageDataMRVar - - // if ($scope.ColoredImageSRC[x].haveMirror == 'true') { - - // coloredImageDataVar = $rootScope.coloredImageMRCanvasList[parseInt(bodyRegionId)]; - // } - // else { - // coloredImageDataVar = $rootScope.coloredImageCanvasList[parseInt(bodyRegionId - 1)]; - // } - // var grayImageDataVar; - // var grayCanvas; - // if ($scope.ColoredImageSRC[x].haveMirror == 'true') { - - // //// 3. get mask canvas for this body region._MR - // var grayCanvasID = 'imageCanvas' + bodyRegionId + '_MR'; - // grayCanvas = document.getElementById(grayCanvasID); - // var grayCanvasContext = grayCanvas.getContext("2d"); - // var grayImageData = grayCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight); - // grayImageDataVar = grayImageData.data; - // } - - // else { - // var grayCanvasID = 'imageCanvas' + bodyRegionId; - // grayCanvas = document.getElementById(grayCanvasID); - // var grayCanvasContext = grayCanvas.getContext("2d"); - // var grayImageData = grayCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight); - // grayImageDataVar = grayImageData.data; - // } - - // var coloredImageDataVarMR; - // var coloredImageDataMR - - - // var counter = 0; - - - // var dataForthisBR = new jinqJs() - // .from(matchedLocationData) - // .where('BRId == ' + bodyRegionId) - // .select(); - - // for (var z = 0; z < dataForthisBR.length; z++) - // { - // var location = parseInt(dataForthisBR[z].location); - - - // var RED_coloredImage = coloredImageDataVar[location]; - - // grayImageDataVar[location] = RED_coloredImage; - - - // var GREEN_coloredImage = coloredImageDataVar[location + 1]; - // grayImageDataVar[location + 1] = GREEN_coloredImage; - - // var BLUE_coloredImage = coloredImageDataVar[location + 2]; - // grayImageDataVar[location + 2] = BLUE_coloredImage; - - - // var ALPHA_coloredImage = coloredImageDataVar[location + 3]; - // grayImageDataVar[location + 3] = ALPHA_coloredImage; - - // } - var grayCanvasID = 'imageCanvas' + BrId; - var grayCanvas = document.getElementById(grayCanvasID); - var grayCanvasContext = grayCanvas.getContext("2d"); - - - var garyDatalength = grayImageDataVar.length; - var pixelData = new Uint8ClampedArray(garyDatalength); - for (var i = 0; i < garyDatalength; i++) { - pixelData[i] = grayImageDataVar[i]; - } - var imgDta = grayCanvasContext.getImageData(0, 0, 348, 507); - imgDta.data.set - grayCanvasContext.putImageData(imgDta, 0, 0); - //} - - // } - - console.log('End time taken in fillMatchedTerm: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")); - } + $scope.GetRGBColor = function (maskCanvasContext, actulalX, actualY, x, y) { var pixelData = maskCanvasContext.getImageData(Math.round(actulalX - x), Math.round(actualY - y), 1, 1); diff --git a/400-SOURCECODE/AIAHTML5.Web/match-pixel-wp.js b/400-SOURCECODE/AIAHTML5.Web/match-pixel-wp.js index 5bcb60b..10ad35b 100644 --- a/400-SOURCECODE/AIAHTML5.Web/match-pixel-wp.js +++ b/400-SOURCECODE/AIAHTML5.Web/match-pixel-wp.js @@ -3,7 +3,6 @@ function updateGrayCanvasDataOnMatcghedLocation(termList, maskCanvasData, coloreImageData, grayImageData, grayImageMRDataList, bodyRegionId) { - console.log('updateGrayCanvasDataOnMatcghedLocation= ' + bodyRegionId) var n = maskCanvasData.data.length; @@ -51,17 +50,10 @@ function updateGrayCanvasDataOnMatcghedLocation(termList, maskCanvasData, colore } var Icolor = (Red + Green + Blue); - // alert('Icolor: ' + Icolor) if (parseInt(termList[z]._TermNumber) == parseInt(Icolor)) { - - - - // matchedRGBLocationInBodyRegion.push({ "BRId": bodyRegionId, "location": i }); - - - // matched = true; + var RED_coloredImage = coloredImageDataVar[i]; @@ -85,10 +77,7 @@ function updateGrayCanvasDataOnMatcghedLocation(termList, maskCanvasData, colore previousGrayImageDataList[parseInt(bodyRegionId - 1)] = grayImageData; - // if (matched == true) { - - // } - + } self.postMessage({ 'bodyRegionId': bodyRegionId,