Commit 41bb855900b0452a97c5d71f664a8bacf7015b40

Authored by Amrita Vishnoi
1 parent 19fdb975

Multi annotation

400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
... ... @@ -32,6 +32,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
32 32  
33 33 $scope.zoomInOut = 75;
34 34  
  35 + $scope.multiAnnotationIsON = true;
  36 +
35 37 //array for bodyviewid correspoing to male female(used for gender change)
36 38 $scope.correspondingBodyViewIds = {
37 39 '1': '5',
... ... @@ -362,7 +364,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
362 364 })
363 365  
364 366  
365   -
366 367 $scope.LoadDefaultLayerImage = function () {
367 368 // debugger;
368 369  
... ... @@ -852,7 +853,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
852 853 var actulalX = mirrorXOnNormalImage
853 854 var actualY = mousePos.y + verticalScrollPosition
854 855  
855   -
  856 +
856 857 var pixelData = maskCanvasContext.getImageData(Math.round(actulalX - parseInt(maskCanvasContext.canvas.offsetLeft)), Math.round(actualY - y), 1, 1);
857 858  
858 859 pixelData.data[0] = pixelData.data[0] - 9;
... ... @@ -912,18 +913,24 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
912 913  
913 914 if ($('#speechBubbleTrns').length > 0)
914 915 $('#speechBubbleTrns').remove();
915   -
916   - if ($('#speechBubble').length > 0) {
917   - $('#speechBubble').remove();
918   -
  916 +
  917 + if ($scope.multiAnnotationIsON == true)
  918 + {
919 919 $scope.createSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50)
920   -
921 920 }
922   - else
923   - $scope.createSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50)
  921 + else {
  922 + if ($('#speechBubble').length > 0) {
  923 + $('#speechBubble').remove();
  924 +
  925 + $scope.createSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50)
924 926  
  927 + }
  928 + else {
  929 + $scope.createSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50)
  930 + }
925 931  
926 932  
  933 + }
927 934 }, false);
928 935  
929 936 FlipedImgCanvas.addEventListener('mousedown', function (evt) {
... ... @@ -1120,26 +1127,17 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1120 1127 var cw, ch, imgW, imgH, mouseX, mouseY;
1121 1128 var scaleFactor = 1.00;
1122 1129  
1123   - //$scaler = $("#scaler");
1124   - //$scaler.val(scaleFactor);
1125   - //$scaler.hide();
1126   -
1127 1130 var context = imgCanvas.getContext('2d');
1128 1131 var img = new Image();
1129 1132 img.onload = start;
1130 1133  
1131 1134 img.src = src;
1132   - // img.src = img.src = "~/../content/images/" + src;
1133   -
1134   -
  1135 +
1135 1136 function start() {
1136 1137 // debugger;
1137 1138 context.drawImage(img, 0, 0);
1138 1139 };
1139   - // $('#daLoaderLabel').css('visibility', 'visible')
1140   -
1141   - // $rootScope.isLoading = true;
1142   -
  1140 +
1143 1141 document.getElementById('canvasDiv').appendChild(imgCanvas);
1144 1142  
1145 1143 }
... ... @@ -1211,45 +1209,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1211 1209 grayImageDataVar = grayImageData.data;
1212 1210 }
1213 1211  
1214   -
1215   - //var grayImageDataVarMR;
1216   - // var grayImageDataMR;
1217 1212 var coloredImageDataVarMR;
1218 1213 var coloredImageDataMR
1219 1214  
1220   - //if ($scope.ColoredImageSRC[x].haveMirror) {
1221   -
1222   -
1223   - // var coloredCanvasMRID = 'imageCanvas' + bodyRegionId + '_MR';
1224   - // var coloredCanvasMR = document.getElementById(coloredCanvasMRID);
1225   - // var coloredCanvasContextMR = coloredCanvasMR.getContext("2d");
1226   - // coloredImageDataMR = coloredCanvasContextMR.getImageData(0, 0, scaledWidth, scaledHeight);
1227   - // coloredImageDataVarMR = coloredImageDataMR.data;
1228   - //}
1229   -
1230   - //else
1231   - //{
1232   - // var coloredCanvas = 'imageCanvas' + bodyRegionId;
1233   - // var coloredCanvas = document.getElementById(coloredCanvas);
1234   - // var coloredCanvasContext = coloredCanvas.getContext("2d");
1235   - // coloredImageData = coloredCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight);
1236   - // coloredImageDataVar = coloredImageData.data;
1237   - //}
1238   -
1239   - //if (bodyRegionId == 6 || bodyRegionId == 5 || bodyRegionId == 4) {
1240   - // //var grayCanvasMRID = 'GrayImageCanvas' + bodyRegionId + '_MR';
1241   - // //var grayCanvasMR = document.getElementById(grayCanvasMRID);
1242   - // //var grayCanvasContextMR = grayCanvasMR.getContext("2d");
1243   - // //grayImageDataMR = grayCanvasContextMR.getImageData(0, 0, scaledWidth, scaledHeight);
1244   - // //grayImageDataVarMR = grayImageDataMR.data;
1245   -
1246   - // var coloredCanvasMRID = 'imageCanvas' + bodyRegionId + '_MR';
1247   - // var coloredCanvasMR = document.getElementById(coloredCanvasMRID);
1248   - // var coloredCanvasContextMR = coloredCanvasMR.getContext("2d");
1249   - // coloredImageDataMR = coloredCanvasContextMR.getImageData(0, 0, scaledWidth, scaledHeight);
1250   - // coloredImageDataVarMR = coloredImageDataMR.data;
1251   - //}
1252   -
  1215 +
1253 1216 var counter = 0;
1254 1217  
1255 1218 var imageDataVar = maskImgData.data;
... ... @@ -1298,34 +1261,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1298 1261 if (parseInt(termNo) == parseInt(Icolor)) {
1299 1262 counter++;
1300 1263  
1301   -
1302   - // var DAData = new BitmapData($scope.MaskImageSRC[x].Width, $scope.MaskImageSRC[x].Height);
1303   - // DAData.draw($scope.grayCanvasList[x].SRC);
1304   - // var RED = 0.3086; // luminance contrast value for red
1305   - // var GREEN = 0.694; // luminance contrast value for green
1306   - // var BLUE = 0.0820; // luminance contrast value for blue
1307   -
1308   - // var RGB = [RED, GREEN, BLUE, 0, 0];
1309   - // var RGB2 = [RED, GREEN, BLUE, 0, 0];
1310   - // var RGB3 = [RED, GREEN, BLUE, 0, 0];
1311   - // var ALPHA = [0, 0, 0, 1, 0];
1312   -
1313   - // var rgbPx = RGB.concat(RGB2);
1314   - // var rgbPx2 = rgbPx.concat(RGB3);
1315   - // var matrix = rgbPx2.concat(ALPHA);
1316   -
1317   - // var zeroPoint = new Point();
1318   - // var grayScale = new ColorMatrixFilter(matrix);
1319   - // DAData.applyFilter(DAData, DAData.rect, zeroPoint, grayScale);
1320   -
1321   - // grayCanvasContext.putImageData(DAData.data, 0, 0)
1322   - // }
1323   - //}
1324   -
1325   -
1326   - //if (!isHighLighted) {
1327   - //alert('icolor matched with term no ' +termNo);
1328   -
1329 1264 if (coloredImageDataVar!= null) {
1330 1265 var RED_coloredImage = coloredImageDataVar[i];
1331 1266  
... ... @@ -1345,137 +1280,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1345 1280  
1346 1281 }
1347 1282  
1348   - //}
1349 1283 }
1350 1284  
1351 1285  
1352 1286 }
1353 1287  
1354 1288 grayCanvasContext.putImageData(grayImageData, 0, 0);
1355   -
1356   - //if (!isHighLighted) {
1357   - // grayImageData.data = grayImageDataVar;
1358   -
1359   - // grayCanvasContext.putImageData(grayImageData, 0, 0);
1360   - // isHighLighted = true;
1361   - //}
1362   - //else {
1363   - //grayImageData.data = grayImageDataVar;
1364   - //grayCanvasContext.putImageData(grayImageData, 0, 0);
1365   - //}
1366   -
1367   - //if (bodyRegionId == 6 || bodyRegionId == 5 || bodyRegionId == 4) {
1368   -
1369   - // var grayCanvasMRID = 'imageCanvas' + bodyRegionId + '_MR';
1370   - // var grayCanvasMR = document.getElementById(grayCanvasMRID);
1371   - // // document.getElementById('canvasDiv').removeChild(grayCanvasMR);
1372   -
1373   - // var tempCanvasMR = document.createElement('canvas');
1374   - // tempCanvasMR.id = 'imageCanvas' + bodyRegionId + '_MR';
1375   - // tempCanvasMR.style.position = "absolute";
1376   - // tempCanvasMR.style.left = scledX + 'px';
1377   - // tempCanvasMR.style.top = scledY + 'px';
1378   - // //tempCanvas.style.border = 'black 1px solid';
1379   - // tempCanvasMR.height = scaledHeight;
1380   - // tempCanvasMR.width = scaledWidth;
1381   -
1382   -
1383   - // var tempCtx = tempCanvasMR.getContext('2d');
1384   - // tempCtx.save();
1385   - // tempCtx.translate(scaledWidth, 0);
1386   - // tempCtx.scale(-1, 1);
1387   - // tempCtx.drawImage(grayCanvas, 0, 0);
1388   -
1389   - // document.getElementById('canvasDiv').appendChild(tempCanvasMR);
1390   -
1391   - // //cleaned up the old canvas
1392   -
1393   -
1394   - // //tempCanvas.addEventListener()
1395   -
1396   - // tempCanvasMR.addEventListener('click', function (evt) {
1397   -
1398   - // //get mouse coordinate of mirror image click
1399   - // var mousePos = getMousePos(evt);
1400   - // //alert(mousePos.x + ',' + mousePos.y);
1401   -
1402   - // var tempCanvasMR_context = tempCanvasMR.getContext("2d");
1403   - // var canvasId = tempCanvasMR_context.canvas.getAttribute('id');
1404   -
1405   - // var mirrorCanvasX = tempCanvasMR_context.canvas.offsetLeft;
1406   - // var mirrorCanvasWidth = tempCanvasMR_context.canvas.clientWidth;
1407   -
1408   - // // get mask canvas for it.
1409   - // //var maskCanvasID = 'imageCanvas' + bodyRegionId + '_mci';
1410   - // //var maskCanvas = document.getElementById(maskCanvasID);
1411   - // //var maskCanvasContext = maskCanvas.getContext("2d");
1412   -
1413   -
1414   - // // var canvasDiv = document.getElementById('canvasDiv');
1415   - // var verticalScrollPosition = canvasDiv.scrollTop;
1416   - // var horizontlScrollPosition = canvasDiv.scrollLeft;
1417   -
1418   - // var distanceXOnMirrorImage = (parseInt(mirrorCanvasX) + parseInt(mirrorCanvasWidth)) - (parseInt(mousePos.x) + horizontlScrollPosition);// - 135);
1419   -
1420   - // var mirrorXOnNormalImage = parseInt(maskCanvasContext.canvas.offsetLeft) + parseInt(distanceXOnMirrorImage);
1421   -
1422   - // var actulalX = mirrorXOnNormalImage
1423   - // var actualY = mousePos.y + verticalScrollPosition
1424   -
1425   -
1426   -
1427   - // var Icolor = $scope.getIcolorOnUserClick(maskCanvasContext, Math.round(actulalX - parseInt(maskCanvasContext.canvas.offsetLeft)), Math.round(actualY - y));
1428   -
1429   - // //2. Find Actul Term No Based on Icolor.
1430   - // var ActualTermNo = $scope.getActualTermNumber(Icolor);
1431   - // //alert('actual term no: ' + ActualTermNo);
1432   -
1433   - // //3. Find Term No List Based on ActualTermNo
1434   - // var TermList = $scope.getTermNumberList(ActualTermNo);
1435   - // // alert('termList.count: ' + TermList.length);
1436   -
1437   - // //4.
1438   -
1439   - // $scope.machedTermNoLocation = [];
1440   - // for (var i = 0; i < TermList.length; i++) {
1441   -
1442   - // var termNumber = parseInt(TermList[i]._TermNumber);
1443   -
1444   - // //Match Term No List in each bodyRegion
1445   - // //$scope.getLocationsForMatchedTermsInWholeBody(termNumber, 'Y');
1446   -
1447   - // $scope.getLocationsForMatchedTermsInWholeBody(termNumber, x, y);
1448   - // }
1449   -
1450   - // var annotationText = $scope.GetAnnotationText(parseInt(Icolor));
1451   -
1452   - // if ($('#speechBubble').length > 0) {
1453   - // $('#speechBubble').remove();
1454   -
1455   - // createSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50)
1456   -
1457   - // }
1458   - // else
1459   - // createSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50)
1460   -
1461   -
1462   -
1463   - // }, false);
1464   -
1465   - // tempCanvasMR.addEventListener('mousedown', function (evt) {
1466   -
1467   - // //alert('mousedown')
1468   - // }, false);
1469   -
1470   -
1471   - // tempCanvasMR.addEventListener('mouseup', function (evt) {
1472   - // //alert('mouseup')
1473   -
1474   -
1475   - // }, false);
1476   -
1477   -
1478   - //}
1479 1289 }
1480 1290 }
1481 1291  
... ...