Commit 40f57f51f5c2fa49f042040130dc64c7d7add4ff

Authored by Amrita Vishnoi
2 parents 5bc4a80b aa477e2a

tem changes

400-SOURCECODE/AIAHTML5.Web/AIAHTML5.Web.csproj
... ... @@ -43034,6 +43034,7 @@
43034 43034 <Content Include="libs\angular-ui\js\slider.js" />
43035 43035 <Content Include="libs\angular\1.4.9\angular-route.min.js" />
43036 43036 <Content Include="libs\angular\1.4.9\ngStorage.js" />
  43037 + <Content Include="libs\colorpicker\jquery.minicolors.min.js" />
43037 43038 <Content Include="libs\jcanvas\jcanvas.handle.min.js" />
43038 43039 <Content Include="libs\jcanvas\jcanvas.min.js" />
43039 43040 <Content Include="libs\jinqJs.js" />
... ...
400-SOURCECODE/AIAHTML5.Web/AIAHTML5.Web.csproj.user
1 1 <?xml version="1.0" encoding="utf-8"?>
2 2 <Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 3 <PropertyGroup>
4   - <ProjectView>ProjectFiles</ProjectView>
  4 + <ProjectView>ShowAllFiles</ProjectView>
5 5 </PropertyGroup>
6 6 <ProjectExtensions>
7 7 <VisualStudio>
... ...
400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
... ... @@ -165,7 +165,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
165 165 //get the DA body view list based on selected gender
166 166 $scope.getDAViewList = function ($event) {
167 167  
168   - // debugger;
  168 +
169 169 if ($('#MainImage') != null) {
170 170 $('#MainImage').remove();
171 171 }
... ... @@ -244,7 +244,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
244 244 }
245 245  
246 246 $scope.imagePath = "~/../content/images/DA/" + $scope.zoomInOut + "/body-views/" + value._id + '/skintone/' + userEthnicity + '/' + thumbnailImage;
247   - // debugger;
  247 +
248 248  
249 249 var $el = $('<div id=' + value._id + ' class="col-sm-3 col-lg-2" title = ' + value._title + ' data-ng-click="openView($event)"><div class="thumbnail" >'
250 250 + '<img class= "daImg" id="' + value._title + '" src="' + $scope.imagePath + '" alt="" title="" >'
... ... @@ -265,7 +265,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
265 265  
266 266  
267 267 $scope.openView = function ($event) {
268   - // debugger;
  268 +
269 269 $rootScope.isLoading = true;
270 270 $('#spinner').css('visibility', 'visible');
271 271  
... ... @@ -682,8 +682,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
682 682  
683 683  
684 684 $scope.LoadDefaultLayerImage = function () {
685   - // debugger;
686   -
  685 +
687 686 $rootScope.isNormalMode = true;
688 687  
689 688 $scope.layerNumber = 0;
... ... @@ -5916,7 +5915,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
5916 5915 $rootScope.Object1Index = 0;
5917 5916 $rootScope.Object2Index = 0;
5918 5917 $rootScope.resetText = 0;
5919   -
  5918 + $rootScope.resetTextSave = 0;
  5919 + $rootScope.ObjectIndexSave = 0;
5920 5920 var arrayRect = {};
5921 5921  
5922 5922  
... ... @@ -6045,6 +6045,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
6045 6045  
6046 6046 resizeFromCenter: false,
6047 6047  
  6048 + dblclick: function () {
  6049 + $rootScope.backOpacity();
  6050 +
  6051 + },
6048 6052  
6049 6053 click: function (layer) {
6050 6054 $rootScope.canvasLayerNameCollection = [];
... ... @@ -6121,6 +6125,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
6121 6125  
6122 6126  
6123 6127 click: function (layer) {
  6128 + // alert(layer.name);
6124 6129 $rootScope.canvasLayerNameCollection = [];
6125 6130 $rootScope.canvasLayerNameCollection.push(layer.name);
6126 6131 $('#canvas').setLayer(layer.name, {
... ... @@ -6136,6 +6141,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
6136 6141 },
6137 6142 mouseout: function (layer) {
6138 6143 $rootScope.canvasLayerNameCollection = [];
  6144 +
6139 6145 $('#canvas').setLayer(layer.name, {
6140 6146 handle: {
6141 6147 type: 'arc',
... ... @@ -6262,7 +6268,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
6262 6268 x2: $scope.x, y2: $scope.y,
6263 6269  
6264 6270 click: function (layer) {
6265   - // debugger;
  6271 +
6266 6272 $rootScope.shapeTypePin = "Pin";
6267 6273 $rootScope.canvasLayerNameCollection = [];
6268 6274 var pinLine_layer = layer.name;
... ... @@ -6286,9 +6292,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
6286 6292  
6287 6293 },
6288 6294 mouseout: function (layer) {
6289   - // $rootScope.resetPinArc = "";
6290   - // ax = "";
6291   -
  6295 +
6292 6296 $rootScope.canvasLayerNameCollection = [];
6293 6297 $('#canvas').setLayer(layer.name, {
6294 6298 handle: {
... ... @@ -6351,7 +6355,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
6351 6355 $('.btnCursor').addClass('activebtncolor');
6352 6356 break;
6353 6357 case "TextArea":
6354   -
  6358 + $rootScope.IsTextAlreadySave = false;
  6359 + $("#text_area").val('');
6355 6360 // Draw text
6356 6361 $rootScope.resetTextRect = $rootScope.ObjectIndex++;
6357 6362 $rootScope.resetText = $rootScope.ObjectIndex++;
... ... @@ -6369,9 +6374,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
6369 6374 align: "left",
6370 6375 fontFamily: 'Verdana, sans-serif',
6371 6376 text: ''
6372   -
6373   -
6374   -
  6377 +
6375 6378 })
6376 6379 // Draw rect as wide as the text
6377 6380 .drawRect({
... ... @@ -6435,6 +6438,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
6435 6438  
6436 6439 $("#annotationTextModal").modal("toggle");
6437 6440 $('.btnCursor').trigger('click');
  6441 + $("#text_area").val('');
  6442 + $("#text_area").css({ " font-family": 'Verdana, sans-serif', "font-size": "14px", "font-weight": "normal", "font-style": "normal", "color": "#000", "text-align": "left", "text-decoration": "none" });
6438 6443 $(".btn-annotation").removeClass("activebtncolor");
6439 6444 $('.btnCursor').addClass('activebtncolor');
6440 6445 break;
... ... @@ -6458,129 +6463,275 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
6458 6463 $rootScope.underlineText;
6459 6464 $rootScope.textArea;
6460 6465 $rootScope.fontFamily;
6461   - $rootScope.saveText = function () {
6462   -
6463   - $rootScope.fontSizes = $("#text_area").css("font-size");
6464   - $rootScope.fontWeight = $("#text_area").css("font-weight");
6465   - $rootScope.fontStyle = $("#text_area").css("font-style");
6466   - $rootScope.textAlignmt = $("#text_area").css("text-align");
6467   - $rootScope.fontColor = $("#text_area").css("color");
6468   - $rootScope.fontFamily = $("#text_area").css("font-family");
6469   - $rootScope.underlineText = $("#text_area").css("text-decoration");
6470   - $rootScope.textArea = $("#text_area").val();
6471   - $("#canvas").removeLayer('TextArea_' + $rootScope.resetText).drawLayers();
6472   - $("#canvas").removeLayer("TextRect_" + $rootScope.resetTextRect).drawLayers();
6473   -
6474   - $('#canvas').drawText({
6475   - layer: true,
6476   - draggable: true,
6477   - name: 'TextArea_' + $rootScope.resetText,
6478   - groups: ['TextArea_' + $rootScope.resetText],
6479   - dragGroups: ['TextArea_' + $rootScope.resetText],
6480   - fillStyle: $rootScope.fontColor,
6481   - fontStyle: $rootScope.fontStyle,
6482   - fontSize: $rootScope.fontSizes,
6483   - fontFamily: $rootScope.fontFamily,
6484   - align: $rootScope.textAlignmt,
6485   - strokeWidth: 0,
6486   - text: $rootScope.textArea,
6487   - x: $scope.offsetX1, y: $scope.offsetY1,
6488   - maxWidth: $scope.x - $scope.offsetX1,
6489   - maxHeight: $scope.y - $scope.offsetY1,
6490   -
6491   -
6492   - click: function (layer) {
6493   -
6494   -
6495   -
6496   - },
6497   - change: function (layer, props) {
6498   -
6499   - }
  6466 + $rootScope.TextPropertyArray = [];
  6467 + $rootScope.modifySavedText = [];
  6468 + $rootScope.TextRectangleArr = [];
  6469 + $rootScope.rectDimension = [];
  6470 +
6500 6471  
6501   - })
6502   - // Draw rect as wide as the text
6503   - .drawRect({
6504   - name: 'TextArea1_' + $rootScope.resetText,
6505   - layer: true,
6506   - draggable: true,
6507   - groups: ['TextArea_' + $rootScope.resetText],
6508   - dragGroups: ['TextArea_' + $rootScope.resetText],
6509   - opacity: $rootScope.shapestyleOpacity,
6510   - // strokeStyle: 'black',
6511   - // strokeWidth: 2,
6512   - strokeStyle: $rootScope.shapestyleborderColor,
6513   - strokeWidth: $rootScope.shapestyleborderWidth,
6514   - // fillStyle: $rootScope.shapestyleFillColor,
6515   - x: $scope.offsetX1, y: $scope.offsetY1,
6516   - width: $scope.x - $scope.offsetX1,
6517   - height: $scope.y - $scope.offsetY1,
6518   -
6519   - click: function (layer) {
6520   - $rootScope.shapeTypeText = "textAreaRect";
6521   -
6522   - var layerNameSplit = layer.name;
6523   -
6524   - var splitedName = layerNameSplit.split("_");
6525   -
6526   - var textValName = "TextArea_";
6527   -
6528   - var concatinateResult = textValName.concat(splitedName[1]);
6529   -
6530   - $rootScope.canvasLayerNameCollection = [];
6531   - $rootScope.canvasLayerNameCollection.push({ textareaRectangle: layer.name, textareaString: concatinateResult });
6532   -
6533   -
6534   -
6535   - $('#canvas').setLayer(layer.name, {
6536   - handle: {
6537   - type: 'rectangle',
6538   - fillStyle: '#fff',
6539   - strokeStyle: '#c33',
6540   - strokeWidth: 2,
6541   - width: 5, height: 5,
6542   - cornerRadius: 3
6543   - }
6544   - }).drawLayers();
6545   -
6546   - },
6547   - mouseout: function (layer) {
6548   -
6549   - $rootScope.canvasLayerNameCollection = [];
6550   - $('#canvas').setLayer(layer.name, {
6551   - handle: {
6552   - type: 'rectangle',
6553   - fillStyle: 'pink',
6554   - strokeStyle: 'yellow',
6555   - strokeWidth: 0,
6556   - width: 0, height: 0,
6557   - cornerRadius: 0
6558   - }
6559   -
6560   - }).drawLayers();
6561   -
6562   - },
6563   - mouseover: function (layer) {
6564   -
6565   - $('#canvas').setLayer(layer.name, {
6566   - handle: {
6567   - type: 'rectangle',
6568   - fillStyle: '#fff',
6569   - strokeStyle: '#c33',
6570   - strokeWidth: 2,
6571   - width: 5, height: 5,
6572   - cornerRadius: 3
6573   - }
6574   - }).drawLayers();
6575   -
6576   - }
6577   - });
6578   - $("#text_area").val('');
6579   -
6580   - $("#text_area").css({ " font-family": "'Verdana, sans-serif'", "font-size": "14px", "font-weight": "normal", "font-style": "normal", "color": "#000", "text-align": "left", "text-decoration": "none" });
  6472 + // will refactor this code later
6581 6473  
  6474 +
  6475 + $rootScope.saveText = function () {
  6476 + // this part will work first time when save button will be clicked
  6477 + if ($rootScope.IsTextAlreadySave == false) {
  6478 + // getting textarea style properties
  6479 + $rootScope.fontSizes = $("#text_area").css("font-size");
  6480 + $rootScope.fontWeight = $("#text_area").css("font-weight");
  6481 + $rootScope.fontStyle = $("#text_area").css("font-style");
  6482 + $rootScope.textAlignmt = $("#text_area").css("text-align");
  6483 + $rootScope.fontColor = $("#text_area").css("color");
  6484 + $rootScope.fontFamily = $("#text_area").css("font-family");
  6485 + $rootScope.underlineText = $("#text_area").css("text-decoration");
  6486 + $rootScope.textArea = $("#text_area").val();
  6487 +
  6488 + // deleting previous text area
  6489 +
  6490 + $("#canvas").removeLayer('TextArea_' + $rootScope.resetText).drawLayers();
  6491 + $("#canvas").removeLayer("TextRect_" + $rootScope.resetTextRect).drawLayers();
  6492 +
  6493 + // Text After Saving in Rectangle
  6494 + $('#canvas').drawText({
  6495 + layer: true,
  6496 + draggable: true,
  6497 + name: 'TextArea_' + $rootScope.resetText,
  6498 + groups: ['TextArea_' + $rootScope.resetText],
  6499 + dragGroups: ['TextArea_' + $rootScope.resetText],
  6500 + fillStyle: $rootScope.fontColor,
  6501 + fontStyle: $rootScope.fontStyle,
  6502 + fontSize: $rootScope.fontSizes,
  6503 + fontFamily: $rootScope.fontFamily,
  6504 + align: $rootScope.textAlignmt,
  6505 + strokeWidth: 0,
  6506 + text: $rootScope.textArea,
  6507 + x: $scope.offsetX1, y: $scope.offsetY1,
  6508 + maxWidth: $scope.x - $scope.offsetX1,
  6509 + maxHeight: $scope.y - $scope.offsetY1,
  6510 + add: function (layer) {
  6511 + $rootScope.TextPropertyArray.push({ Text1: '', Align: '', FontColor: '', FontSize: '', FontStyle: '', FontFamily: '' });
  6512 + $rootScope.TextPropertyArray.push({ Text1: layer.text, Align: layer.align, FontColor: layer.fillStyle, FontSize: layer.fontSize, FontStyle: layer.fontStyle, FontFamily: layer.fontFamily });
  6513 + }
  6514 + })
  6515 + // Draw rectangle
  6516 + .drawRect({
  6517 + name: 'TextArea1_' + $rootScope.resetText,
  6518 + layer: true,
  6519 + draggable: true,
  6520 + groups: ['TextArea_' + $rootScope.resetText],
  6521 + dragGroups: ['TextArea_' + $rootScope.resetText],
  6522 + opacity: $rootScope.shapestyleOpacity,
  6523 + strokeStyle: $rootScope.shapestyleborderColor,
  6524 + strokeWidth: $rootScope.shapestyleborderWidth,
  6525 + x: $scope.offsetX1, y: $scope.offsetY1,
  6526 + width: $scope.x - $scope.offsetX1,
  6527 + height: $scope.y - $scope.offsetY1,
  6528 + click: function (layer) {
  6529 + $rootScope.shapeTypeText = "textAreaRect";
  6530 +
  6531 + var layerNameSplit = layer.name;
  6532 + var splitedName = layerNameSplit.split("_");
  6533 + var textValName = "TextArea_";
  6534 + var concatinateResult = textValName.concat(splitedName[1]);
  6535 + $rootScope.canvasLayerNameCollection = [];
  6536 + $rootScope.canvasLayerNameCollection.push({ textareaRectangle: layer.name, textareaString: concatinateResult });
  6537 + $('#canvas').setLayer(layer.name, {
  6538 + handle: {
  6539 + type: 'rectangle',
  6540 + fillStyle: '#fff',
  6541 + strokeStyle: '#c33',
  6542 + strokeWidth: 2,
  6543 + width: 5, height: 5,
  6544 + cornerRadius: 3
  6545 + }
  6546 + }).drawLayers();
  6547 + },
  6548 + dblclick: function (layer) {
  6549 + $rootScope.IsTextAlreadySave = true;
  6550 +
  6551 + var _rectLayerOnSave = layer.name;
  6552 + var _rectLayerOnSaveSplit = _rectLayerOnSave.split("_");
  6553 + var TextAreaRectName = "TextArea_";
  6554 + var TextAreaRectNameConcatenated = TextAreaRectName.concat(_rectLayerOnSaveSplit[1]);
  6555 + $rootScope.modifySavedText.push({ TextName: layer.name, RectText: TextAreaRectNameConcatenated });
  6556 + $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y });
  6557 + var _rectLayerOnSaveSplitInt;
  6558 + if (_rectLayerOnSaveSplit[1] >= 3)
  6559 + _rectLayerOnSaveSplitInt = parseInt(_rectLayerOnSaveSplit[1] - 2);
  6560 + else
  6561 + _rectLayerOnSaveSplitInt = parseInt(_rectLayerOnSaveSplit[1]);
  6562 + var b = $rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].Text1;
  6563 + $("#text_area").val(b);
  6564 + $("#text_area").css("font-size", $rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].FontSize);
  6565 + $("#text_area").css("font-weight", $rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].FontStyle);
  6566 + $("#text_area").css("font-style", $rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].FontStyle);
  6567 + $("#text_area").css("text-align", $rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].Align);
  6568 + $("#text_area").css("color", $rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].FontColor);
  6569 + $("#text_area").css("font-family", $rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].FontFamily);
  6570 + $("#text_area").css("text-decoration", $rootScope.underlineText);
  6571 + _rectLayerOnSaveSplitInt = ''; b = '';
  6572 + $("#annotationTextModal").modal("toggle");
  6573 + },
  6574 + mouseout: function (layer) {
  6575 + $rootScope.canvasLayerNameCollection = [];
  6576 + $('#canvas').setLayer(layer.name, {
  6577 + handle: {
  6578 + type: 'rectangle',
  6579 + fillStyle: 'pink',
  6580 + strokeStyle: 'yellow',
  6581 + strokeWidth: 0,
  6582 + width: 0, height: 0,
  6583 + cornerRadius: 0
  6584 + }
  6585 + }).drawLayers();
  6586 + },
  6587 + mouseover: function (layer) {
  6588 + $('#canvas').setLayer(layer.name, {
  6589 + handle: {
  6590 + type: 'rectangle',
  6591 + fillStyle: '#fff',
  6592 + strokeStyle: '#c33',
  6593 + strokeWidth: 2,
  6594 + width: 5, height: 5,
  6595 + cornerRadius: 3
  6596 + }
  6597 + }).drawLayers();
  6598 +
  6599 + }
  6600 + });
  6601 + $("#text_area").val('');
  6602 + $("#text_area").css({ " font-family": "'Verdana, sans-serif'", "font-size": "14px", "font-weight": "normal", "font-style": "normal", "color": "#000", "text-align": "left", "text-decoration": "none" });
  6603 +
  6604 + }
  6605 +
  6606 +// this part will work second time when save button will be clicked
  6607 + else {
  6608 + // getting textarea style properties
  6609 + var _modifiedText = $("#text_area").val();
  6610 + var _modifiedFontSize = $("#text_area").css("font-size");
  6611 + var _modifiedFontWeight = $("#text_area").css("font-weight");
  6612 + var _modifiedFontStyle = $("#text_area").css("font-style");
  6613 + var _modifiedTextAlign = $("#text_area").css("text-align");
  6614 + var _modifiedFontColor = $("#text_area").css("color");
  6615 + var _modifiedFontFamily = $("#text_area").css("font-family");
  6616 + var _modifiedFontDecoration = $("#text_area").css("text-decoration");
  6617 +
  6618 + // deleting previous textarea
  6619 + $("#canvas").removeLayer($rootScope.modifySavedText[0].RectText).drawLayers();
  6620 + $("#canvas").removeLayer($rootScope.modifySavedText[0].TextName).drawLayers();
  6621 + $rootScope.resetTextRectSave = $rootScope.ObjectIndexSave++;
  6622 + $rootScope.resetTextSave = $rootScope.ObjectIndexSave++;
  6623 +
  6624 + // generating new text area
  6625 + $('#canvas').drawText({
  6626 + layer: true,
  6627 + draggable: true,
  6628 + name: 'TextAreaAfterEdit_' + $rootScope.resetTextSave,
  6629 + groups: ['TextAreaAfterEdit_' + $rootScope.resetTextSave],
  6630 + dragGroups: ['TextAreaAfterEdit_' + $rootScope.resetTextSave],
  6631 + fillStyle: _modifiedFontColor,
  6632 + fontStyle: _modifiedFontStyle,
  6633 + fontSize: _modifiedFontSize,
  6634 + fontFamily: _modifiedFontFamily,
  6635 + align: _modifiedTextAlign,
  6636 + strokeWidth: 0,
  6637 + text: _modifiedText,
  6638 + x: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].x, y: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].y,
  6639 + maxWidth: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].width,
  6640 + maxHeight: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].height
  6641 +
  6642 + })
  6643 + // Draw rect as wide as the text
  6644 + .drawRect({
  6645 + name: 'TextAreaAfterEditRect_' + $rootScope.resetTextSave,
  6646 + layer: true,
  6647 + draggable: true,
  6648 + groups: ['TextAreaAfterEdit_' + $rootScope.resetTextSave],
  6649 + dragGroups: ['TextAreaAfterEdit_' + $rootScope.resetTextSave],
  6650 + opacity: $rootScope.shapestyleOpacity,
  6651 + strokeStyle: $rootScope.shapestyleborderColor,
  6652 + strokeWidth: $rootScope.shapestyleborderWidth,
  6653 + x: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].x, y: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].y,
  6654 + width: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].width,
  6655 + height: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].height,
  6656 + click: function (layer) {
  6657 + $rootScope.shapeTypeText = "textAreaRect";
  6658 + var layerNameSplit = layer.name;
  6659 + var splitedName = layerNameSplit.split("_");
  6660 + var textValName = "TextAreaAfterEdit_";
  6661 + var concatinateResult = textValName.concat(splitedName[1]);
  6662 + $rootScope.canvasLayerNameCollection = [];
  6663 + $rootScope.canvasLayerNameCollection.push({ textareaRectangle: layer.name, textareaString: concatinateResult });
  6664 +
  6665 + $('#canvas').setLayer(layer.name, {
  6666 + handle: {
  6667 + type: 'rectangle',
  6668 + fillStyle: '#fff',
  6669 + strokeStyle: '#c33',
  6670 + strokeWidth: 2,
  6671 + width: 5, height: 5,
  6672 + cornerRadius: 3
  6673 + }
  6674 + }).drawLayers();
  6675 +
  6676 + },
  6677 + dblclick: function (layer) {
  6678 +
  6679 + $rootScope.IsTextAlreadySave = true;
  6680 + var _rectLayerOnSave = layer.name;
  6681 + var _rectLayerOnSaveSplit = _rectLayerOnSave.split("_");
  6682 + var RectNameAfterEdit = "TextAreaAfterEdit_";
  6683 + var RectNameAfterEditResult = RectNameAfterEdit.concat(_rectLayerOnSaveSplit[1]);
  6684 + $rootScope.modifySavedText.push({ TextName: layer.name, RectText: RectNameAfterEditResult });
  6685 + $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y });
  6686 + $("#text_area").val(_modifiedText);
  6687 + $("#text_area").css("font-size", _modifiedFontSize);
  6688 + $("#text_area").css("font-weight", _modifiedFontWeight);
  6689 + $("#text_area").css("font-style", _modifiedFontStyle);
  6690 + $("#text_area").css("text-align", _modifiedTextAlign);
  6691 + $("#text_area").css("color", _modifiedFontColor);
  6692 + $("#text_area").css("font-family", _modifiedFontFamily);
  6693 + $("#text_area").css("text-decoration", _modifiedFontDecoration);
  6694 + $("#annotationTextModal").modal("toggle");
  6695 + },
  6696 + mouseout: function (layer) {
  6697 + $rootScope.canvasLayerNameCollection = [];
  6698 + $('#canvas').setLayer(layer.name, {
  6699 + handle: {
  6700 + type: 'rectangle',
  6701 + fillStyle: 'pink',
  6702 + strokeStyle: 'yellow',
  6703 + strokeWidth: 0,
  6704 + width: 0, height: 0,
  6705 + cornerRadius: 0
  6706 + }
  6707 + }).drawLayers();
  6708 + },
  6709 + mouseover: function (layer) {
  6710 + $('#canvas').setLayer(layer.name, {
  6711 + handle: {
  6712 + type: 'rectangle',
  6713 + fillStyle: '#fff',
  6714 + strokeStyle: '#c33',
  6715 + strokeWidth: 2,
  6716 + width: 5, height: 5,
  6717 + cornerRadius: 3
  6718 + }
  6719 + }).drawLayers();
  6720 +
  6721 + }
  6722 + });
  6723 + $rootScope.modifySavedText = [];
  6724 +
  6725 + }
6582 6726 }
  6727 +
  6728 + // deleting text area on close button
  6729 + $rootScope.closeModal = function () {
6583 6730  
  6731 + $("#canvas").removeLayer('TextArea_' + $rootScope.resetText).drawLayers();
  6732 + $("#canvas").removeLayer("TextRect_" + $rootScope.resetTextRect).drawLayers();
  6733 +
  6734 + }
6584 6735  
6585 6736  
6586 6737 function OnPaintCanvasMouseMove(event) {
... ... @@ -6589,13 +6740,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
6589 6740 }
6590 6741  
6591 6742 $rootScope.FreeStylePaint = function (e) {
6592   - // debugger;
6593   -
6594   -
6595   - // $rootScope.shapeType = "FreeStylePaint";
6596   - canvasPaint.addEventListener('mouseup', $scope.OnPaintBrushCanvasMouseUp, false);
6597   - canvasPaint.addEventListener('mousedown', $scope.OnPaintBrushCanvasMouseDown, false);
6598   -
  6743 +
6599 6744  
6600 6745 }
6601 6746 $scope.OnPaintBrushCanvasMouseDown = function (event) {
... ... @@ -6603,19 +6748,22 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
6603 6748  
6604 6749 case "FreeStylePaint":
6605 6750  
6606   - debugger;
6607   - $('#canvasPaint').sketch({ defaultSize: 1 });
6608   - //if ($("#amount-2").val() == '') {
6609   - // $('#canvasPaint').sketch({ defaultSize: $scope.shapesize });
6610   - //}
6611   - //else {
  6751 +
6612 6752  
6613   - // var a = $("#amount-2").val();
6614   - // $scope.shapesize = parseInt(a);
6615   - // // alert(JSON.stringify({ defaultSize: $scope.shapesize }));
6616   - // $('#canvasPaint').sketch({ defaultSize: $scope.shapesize });
  6753 + // $('#canvasPaint').sketch();
  6754 + // $('#canvasPaint').sketch({ defaultSize: 1 });
  6755 + // if ($("#amount-2").val() == '') {
  6756 + // //$('#canvasPaint').sketch({ defaultSize: $scope.shapesize });
  6757 + // $('#canvasPaint').sketch();
  6758 + // }
  6759 + // else {
6617 6760  
6618   - //}
  6761 + // // var a = $("#amount-2").val();
  6762 + //// $scope.shapesize = parseInt(a);
  6763 + // // $('#canvasPaint').sketch({ defaultSize: $rootScope.shapeSize });
  6764 + // // $('#canvasPaint').sketch({ defaultSize: $scope.shapesize });
  6765 +
  6766 + // }
6619 6767  
6620 6768  
6621 6769 break;
... ... @@ -6633,8 +6781,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
6633 6781  
6634 6782 // case "FreeStylePaint":
6635 6783  
6636   - // debugger;
6637   -
  6784 +
6638 6785 // if ($("#amount-2").val() == '')
6639 6786 // {
6640 6787 // $('#canvasPaint').sketch({ defaultSize: $scope.shapesize });
... ... @@ -6662,7 +6809,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
6662 6809  
6663 6810  
6664 6811 if (event.which == 46) {
6665   - //debugger;
  6812 +
6666 6813 if ($rootScope.shapeTypePin == "Pin") {
6667 6814  
6668 6815  
... ... @@ -7052,7 +7199,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
7052 7199  
7053 7200 //list manager
7054 7201 $scope.$on('listManagerEvent', function (event, data) {
7055   - // debugger;
  7202 +
7056 7203 $('#spinner').css('visibility', 'visible');
7057 7204 console.log('listManagerEvent')
7058 7205 if ($rootScope.islistManagerEventAlredayDispachted == true) {
... ...
400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js.orig 0 → 100644
Changes suppressed. Click to show
  1 +
  2 +'use strict';
  3 +
  4 +AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$log", "$location", "$timeout", "DA", "Modules", "$routeParams", "DataService",
  5 +function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Modules, $routeParam, DataService) {
  6 +
  7 +
  8 + $scope.genderId = "";
  9 + $scope.BodyViewData;
  10 + $scope.selectedGenderBodyViewData;
  11 + $scope.imagePath = "";
  12 + $rootScope.BodyRegionData;
  13 + $rootScope.BodyRegionCordinatesData;
  14 + $scope.isTransparencyActivated;
  15 + $rootScope.BodyLayerData;
  16 + $rootScope.VocabTermData;
  17 +
  18 + $scope.VocabTermTxt;
  19 + $scope.CommonData
  20 + $rootScope.TermNumberData;
  21 + $rootScope.BodySystemData
  22 + $scope.bodyViewId = 0;
  23 + $rootScope.bgartData;
  24 + $scope.drawnBodyRegions;
  25 + //view specific constants
  26 + $rootScope.voId;
  27 + $scope.layerNumber;
  28 + $scope.daCounter = 1;
  29 + $scope.bagartDetails;
  30 + $scope.transNumber = 50;
  31 +
  32 + //for transarency scale
  33 + $scope.TBDrawStartX;
  34 + $scope.TBDrawStartY;
  35 + $rootScope.path = "~/../content/images/speeachBubbleClose.png";
  36 + $rootScope.isHighLight = false;
  37 + $rootScope.coloredImageCanvasList = [];
  38 + $rootScope.coloredImageMRCanvasList = [];
  39 + $rootScope.ColoredCanvasData = [];
  40 + $rootScope.grayImageDataList = [];
  41 + $rootScope.grayImageMRDataList = [];
  42 + $rootScope.updatedGrayDataList = [];
  43 + $rootScope.updatedGrayMRDataList = [];
  44 + $scope.isEligibleForHighlight = false;
  45 + $scope.doHighlightOrExtract = false;
  46 + $scope.isEligibleForHighlightBodyByTermList = false;
  47 +
  48 + $scope.AnteriorView = "active";
  49 +
  50 + $scope.zoomInOut = 75;
  51 + $scope.speechBubbleCounter = 0;
  52 + $scope.j = 0;
  53 + $scope.speechbubbleList = [];
  54 + $scope.speachBubbleArrayAnnotation = [];
  55 + $rootScope.multiAnnotationIsON = false;
  56 + $scope.previousGrayImageDataVar;
  57 + $scope.previousGrayCanvas;
  58 + $rootScope.updatedImageDataList = [];
  59 + $rootScope.updatedImageMRDataList = [];
  60 +
  61 + $scope.previousSelectedTermList = [];
  62 + $scope.runningWorkers = [];
  63 + $scope.runningSearchWorkers = [];
  64 + $scope.runningBodyViewWorkers = [];
  65 +
  66 + // This variable is used for unhighlight previously highlighted body portion, if multiAnnotation is false.
  67 + $scope.machedIcolorInBodyRegion = [];
  68 +
  69 + $rootScope.MaskCanvasData = [];
  70 +
  71 + //extract
  72 + $rootScope.isExtract = false;
  73 +
  74 +
  75 + $rootScope.whiteImageDataList = [];
  76 + $rootScope.whiteImageMRDataList = [];
  77 + $rootScope.previousHighlightList = [];
  78 +
  79 + $rootScope.isViewChange = false;
  80 + $rootScope.isGenderChnage = false;
  81 +
  82 + // to do it is setting but not using. need to check
  83 + $rootScope.updatedWhiteImageDataList = [];
  84 + $rootScope.updatedWhiteImageMRDataList = [];
  85 +
  86 + //normal mode
  87 + $rootScope.isNormalMode = false;
  88 + $rootScope.isZoomed = false;
  89 +
  90 + //navigator man functionality
  91 + $scope.navigatorImage;
  92 + $scope.NavigatorData;
  93 + $scope.navimgsrc;
  94 +
  95 + $scope.dragdivleft = 0;
  96 + $scope.dragdivtop = 0;
  97 +
  98 + $scope.IsSearchVisible = false;
  99 + $scope.shapesize = 1;
  100 + $scope.dragdivposition = {
  101 + "left": $scope.dragdivleft,
  102 + "top": $scope.dragdivtop
  103 + };
  104 +
  105 +
  106 + //array for bodyviewid correspoing to male female(used for gender change)
  107 + $scope.correspondingBodyViewIds = {
  108 + '1': '5',
  109 + '2': '6',
  110 + '3': '7',
  111 + '4': '8',
  112 + '9': '11',
  113 + '10': '12',
  114 +
  115 + '5': '1',
  116 + '6': '2',
  117 + '7': '3',
  118 + '8': '4',
  119 + '11': '9',
  120 + '12': '10',
  121 +
  122 + }
  123 +
  124 + $scope.bodyViews = {
  125 + 'Anterior': '1',
  126 + 'Lateral': '2',
  127 + 'Medial': '3',
  128 + 'Posterior': '4',
  129 + 'Lateral Arm': '5',
  130 + 'Medial Arm': '6'
  131 + }
  132 +
  133 + $scope.isBodylayerdataLoaded = false;
  134 + $scope.isBodyRegionDataLoaded = false;
  135 + //currentTitleFromJson shows the current BodyView Title
  136 + $scope.currentTitleFromJson;
  137 + $scope.showme = false;
  138 + $scope.IsVisible = function () {
  139 + $scope.scroll();
  140 +
  141 + }
  142 +
  143 + $scope.scroll = function () {
  144 + // $window.scrollTo(0, 0);
  145 + $("html,body").scrollTop(0);
  146 + //alert("scroll");
  147 + }
  148 +
  149 +
  150 + $scope.switchGender = function () {
  151 +
  152 + var retrievedObject = localStorage.getItem('currentViewTitle');
  153 +
  154 + if (retrievedObject == "Male Anterior") {
  155 + $scope.male = "active";
  156 + $scope.female = "";
  157 + }
  158 + else if (retrievedObject == "Female Anterior") {
  159 + $scope.male = "";
  160 + $scope.female = "active";
  161 + }
  162 + }
  163 +
  164 + //get the DA body view list based on selected gender
  165 + //get the DA body view list based on selected gender
  166 + $scope.getDAViewList = function ($event) {
  167 +
  168 + // debugger;
  169 + if ($('#MainImage') != null) {
  170 + $('#MainImage').remove();
  171 + }
  172 + $rootScope.currentActiveModuleTitle = Modules[0].Name;
  173 + $("#bodyViewList").empty();
  174 + //for default load
  175 + if ($event == null || $event == undefined) {
  176 + //if ((localStorage.getItem("genderId") != "")||(localStorage.getItem("genderId")!="null")) {
  177 + // $scope.genderId = localStorage.getItem("genderId");
  178 + //}
  179 + var selectedGender = localStorage.getItem("genderId");
  180 + if ((selectedGender == null)) {
  181 + $scope.genderId = "Male";
  182 + }
  183 + else
  184 + $scope.genderId = localStorage.getItem("genderId");
  185 +
  186 + }
  187 + else {
  188 + $scope.genderId = $event.currentTarget.id;
  189 + }
  190 +
  191 + localStorage.setItem("genderId", $scope.genderId);
  192 +
  193 + var selectedGender = localStorage.getItem("genderId");
  194 +
  195 + if (selectedGender != null) {
  196 + if (selectedGender == "Male") {
  197 + $('#Male').addClass('active');
  198 + $('#Female').removeClass("active");
  199 + }
  200 + else {
  201 + $('#Female').addClass('active');
  202 + $('#Male').removeClass("active");
  203 + }
  204 +
  205 + }
  206 +
  207 + $scope.selectedGenderBodyViewData = new jinqJs()
  208 + .from($scope.BodyViewData.BodyViews.view)
  209 + .where('_gender == ' + $scope.genderId)
  210 + .select();
  211 +
  212 + if ($scope.selectedGenderBodyViewData != null || $scope.selectedGenderBodyViewData != undefined) {
  213 + angular.forEach($scope.selectedGenderBodyViewData, function (value, key) {
  214 +
  215 +
  216 + var userEthnicity;
  217 + var userModestysettings;
  218 + var curentEthnicity = localStorage.getItem("globalEthnicity");
  219 + if (typeof (curentEthnicity) !== "undefined" && curentEthnicity !== null) {
  220 + userEthnicity = curentEthnicity;
  221 + }
  222 + else {
  223 + userEthnicity = $rootScope.globalSetting.ethnicity;
  224 + }
  225 +
  226 + var curentmodesty = localStorage.getItem("globalModesty");
  227 + if (typeof (curentmodesty) !== "undefined" && curentmodesty !== null) {
  228 + userModestysettings = curentmodesty;
  229 + }
  230 + else {
  231 + userModestysettings = $rootScope.globalSetting.modesty;
  232 + }
  233 +
  234 +
  235 +
  236 + //var userSelectedSkintone = 'W';
  237 + //$scope.userModestySetting = 'Y'
  238 + var thumbnailImage;
  239 + if ((value._id == 1) || (value._id == 3) || (value._id == 5) || (value._id == 6) || (value._id == 7) || (value._id == 11))
  240 + thumbnailImage = ((value._thumbnailImage).replace('.jpg', '_' + userEthnicity + userModestysettings)) + '.jpg';
  241 + else {
  242 + thumbnailImage = ((value._thumbnailImage).replace('.jpg', '_' + userEthnicity)) + '.jpg';
  243 +
  244 + }
  245 +
  246 + $scope.imagePath = "~/../content/images/DA/" + $scope.zoomInOut + "/body-views/" + value._id + '/skintone/' + userEthnicity + '/' + thumbnailImage;
  247 + // debugger;
  248 +
  249 + var $el = $('<div id=' + value._id + ' class="col-sm-3 col-lg-2" title = ' + value._title + ' data-ng-click="openView($event)"><div class="thumbnail" >'
  250 + + '<img class= "daImg" id="' + value._title + '" src="' + $scope.imagePath + '" alt="" title="" >'
  251 + + '<div class="caption"><p>' + value._title + '</p></div></a></div></div>').appendTo('#bodyViewList');
  252 +
  253 +
  254 + $compile($el)($scope);
  255 + $(".sidebar").mCustomScrollbar({
  256 + autoHideScrollbar: true,
  257 + //theme:"rounded"
  258 + });
  259 +
  260 + });
  261 + }
  262 +
  263 + };
  264 +
  265 +
  266 +
  267 + $scope.openView = function ($event) {
  268 + // debugger;
  269 + $rootScope.isLoading = true;
  270 + $('#spinner').css('visibility', 'visible');
  271 +
  272 + $rootScope.currentBodyViewId = $event.currentTarget.id;
  273 + $rootScope.ViewTitle = $event.currentTarget.textContent;
  274 +
  275 + localStorage.setItem("currentViewTitleFromJson", $event.currentTarget.textContent);
  276 + localStorage.setItem("currentBodyViewId", $event.currentTarget.id);
  277 +
  278 + var u = $location.url();
  279 + $location.url('/da-body-view');
  280 +
  281 + var view_list = angular.element($event.currentTarget);
  282 + var view_list_male_female = view_list.attr('title');
  283 +
  284 + //$rootScope.Normal = "LeftButtonsDefaultState";
  285 +
  286 + if (view_list_male_female == "Male") {
  287 +
  288 + $rootScope.male = "active";
  289 + $rootScope.female = "";
  290 + }
  291 + else {
  292 +
  293 + $rootScope.male = "";
  294 + $rootScope.female = "active";
  295 + }
  296 +
  297 +
  298 + }
  299 +
  300 +
  301 + //load json data for body view
  302 + $scope.loadDissectibleAnatomyData = function () {
  303 +
  304 + $rootScope.ClearIframe();
  305 +
  306 + //load common data
  307 + var commondataJsonPath = '~/../content/data/json/da/da_dat_common.json';
  308 +
  309 + DataService.getAnotherJson(commondataJsonPath)
  310 + .then(
  311 + function (result) {
  312 +
  313 + $rootScope.CommonData = result;
  314 + $http({ method: 'GET', url: '~/../content/data/json/da/da_dat_contentlist.json' }).success(function (data) {
  315 +
  316 + $scope.BodyViewData = data;
  317 +
  318 + $scope.getDAViewList();
  319 +
  320 + })
  321 + .error(function (data, status, headers, config) {
  322 + console.log(data);
  323 + });
  324 +
  325 +
  326 + },
  327 + function (error) {
  328 + console.log(error.statusText)
  329 + }
  330 + )
  331 + //load body-views data
  332 +
  333 +
  334 + // $('#daLoaderLabel').css('visibility', 'hidden')
  335 + $rootScope.isLoading = false;
  336 +
  337 +
  338 +
  339 + //push the details of open module in array $rootScope.openModules
  340 + $rootScope.openModules.push({ "ModuleId": 1 });
  341 +
  342 +
  343 + }
  344 +
  345 +
  346 + //da-body-views functions
  347 +
  348 + $scope.openBodyView = function () {
  349 +
  350 + //0. we will initially append container to load body
  351 +
  352 + //check if localstorage has any settings
  353 + var curentEthnicity = localStorage.getItem("globalEthnicity");
  354 + if (typeof (curentEthnicity) !== "undefined" && curentEthnicity !== null) {
  355 + $rootScope.globalSetting.ethnicity = curentEthnicity;
  356 + }
  357 +
  358 + var curentmodesty = localStorage.getItem("globalModesty");
  359 + if (typeof (curentmodesty) !== "undefined" && curentmodesty !== null) {
  360 + $rootScope.globalSetting.modesty = curentmodesty
  361 + }
  362 +
  363 + //0.1
  364 + var currentBodyViewId = localStorage.getItem("currentBodyViewId");
  365 +
  366 + console.log('currentBodyViewId pickjed from localStorage: ' + currentBodyViewId);
  367 +
  368 + var openViews;
  369 + if ($rootScope.openViews != null || $rootScope.openViews != undefined) {
  370 + if ($rootScope.openViews.length > 0) {
  371 + openViews = new jinqJs()
  372 + .from($rootScope.openViews)
  373 + .where("BodyViewId == " + currentBodyViewId)
  374 + .select();
  375 + }
  376 + }
  377 +
  378 + // 0.2 getting corresponding body view title
  379 + var counter = 1;
  380 + var tittle = localStorage.getItem("currentViewTitleFromJson");
  381 +
  382 + if (openViews != null && openViews != undefined) {
  383 + angular.forEach(openViews, function (value, key) {
  384 +
  385 + if (value.body - views == tittle) {
  386 + tittle = localStorage.getItem("currentViewTitleFromJson") + counter++;
  387 + $rootScope.currentActiveViewTitle = tittle;
  388 + localStorage.setItem("currentViewTitle", tittle);
  389 + }
  390 +
  391 + });
  392 + }
  393 + else {
  394 + localStorage.setItem("currentViewTitle", tittle);
  395 + }
  396 +
  397 + //0.3
  398 +
  399 + $.jsPanel({
  400 + id: 'daImagePanel',
  401 + selector: '.daBodyView',
  402 + theme: 'success',
  403 + currentController: 'DAController',
  404 + parentSlug: 'da-view-list',
  405 + ajax: {
  406 + url: 'app/views/da/da-view.html'
  407 + },
  408 + title: localStorage.getItem("currentViewTitle"),
  409 + position: {
  410 + top: 70,
  411 + left: 1,
  412 + },
  413 +
  414 + size: { width: $(window).outerWidth() - 10, height: $(window).outerHeight() - 110 },
  415 +
  416 + });
  417 +
  418 + //0.1
  419 + $rootScope.currentSlug = 'da-body-view';
  420 +
  421 + //0.2
  422 + $rootScope.openViews.push(
  423 + {
  424 + "module": $rootScope.currentActiveModuleTitle, "body-views": tittle, "state": 'max', "BodyViewId": $rootScope.currentBodyViewId,
  425 + "slug": $rootScope.currentSlug
  426 + }
  427 + );
  428 +
  429 + //0.3
  430 + var daBodyviewElement = angular.element(document.getElementById("daBodyview"));
  431 +
  432 + $timeout(function () { $compile(daBodyviewElement.contents())($scope) }, 250);
  433 +
  434 +
  435 + //0.4 added some stylesheets
  436 + $('#daBodyview').css("height", $(window).outerHeight());
  437 +
  438 + $('#daBodyview').css("width", $(window).outerWidth());
  439 +
  440 + //1. load navigator man first
  441 + $scope.LoadBodyViewNavigatorImage();
  442 +
  443 + $scope.loadSearchDataForBodyView();
  444 +
  445 + $scope.currentTitleFromJson = localStorage.getItem("currentViewTitle");
  446 +
  447 + $scope.layerNumber = 0;
  448 +
  449 + //2.
  450 +
  451 + console.log('currentBodyViewId just before sending: ' + currentBodyViewId);
  452 + $scope.loadBodyViewData(currentBodyViewId);
  453 +
  454 + //2. load bodyRegion data
  455 + $rootScope.isLoading = true;
  456 + $rootScope.voId = localStorage.getItem("currentBodyViewId");
  457 +
  458 + $('#daBodyview').css("height", $(window).outerHeight());
  459 +
  460 + $('#daBodyview').css("width", $(window).outerWidth());
  461 + }
  462 +
  463 + angular.element(document).ready(function () {
  464 +
  465 + })
  466 +
  467 +
  468 + $scope.loadSearchDataForBodyView = function () {
  469 +
  470 + console.log('loadSearchDataForBodyView');
  471 +
  472 + var currentBodyViewId = localStorage.getItem("currentBodyViewId");
  473 +
  474 +
  475 + var searchWorker = new Worker('search-wp.js');
  476 +
  477 + //push workers in array to further used the refernece to delete the workers
  478 + $scope.runningSearchWorkers.push({ 'workerName': searchWorker })
  479 +
  480 + //console.log('for bodyRegionId = ' + bodyRegionId + ', time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"))
  481 +
  482 + searchWorker.postMessage({
  483 + 'currentBodyViewId': currentBodyViewId,
  484 + })
  485 +
  486 + searchWorker.onmessage = function (e) {
  487 + //console.log('callback searchWorker , time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"));
  488 +
  489 +
  490 +
  491 + $rootScope.TermNumberData = e.data.TermNumberData,
  492 + $rootScope.VocabTermData = e.data.VocabTermData,
  493 + $scope.vocabTermTxt = e.data.vocabTermTxt
  494 +
  495 +
  496 + $scope.VocabTermTxt = new jinqJs()
  497 + .from($scope.vocabTermTxt)
  498 + .distinct('_TermText', '_ActualTermNumber')
  499 + .orderBy([{ field: '_TermText', sort: 'asc' }])
  500 + .select('_ActualTermNumber', '_TermText', '_cdId');
  501 +
  502 +
  503 + console.log('JlinqActivity , time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"));
  504 +
  505 + if ($scope.runningSearchWorkers != null || $scope.runningSearchWorkers != undefined) {
  506 +
  507 + var workerCount = $scope.runningSearchWorkers.length;
  508 + if (workerCount > 0) {
  509 + for (var i = workerCount - 1; i >= 0; i--) {
  510 +
  511 +
  512 +
  513 + var runningWorker = $scope.runningSearchWorkers[i].workerName;
  514 + runningWorker.terminate();
  515 + $scope.runningSearchWorkers.splice(i, 1);
  516 + // workerCount--;
  517 + }
  518 + }
  519 + }
  520 + }
  521 +
  522 + }
  523 +
  524 + $scope.loadBodyViewData = function (currentVoid) {
  525 + console.log('caller of worker sending currentVoid: ' + currentVoid);
  526 +
  527 + var bodyViewWorker = new Worker('body-view-wp.js');
  528 +
  529 + //push workers in array to further used the refernece to delete the workers
  530 + $scope.runningBodyViewWorkers.push({ 'workerName': bodyViewWorker })
  531 +
  532 + bodyViewWorker.postMessage({
  533 +
  534 + 'currentViewId': currentVoid
  535 +
  536 + });
  537 +
  538 + bodyViewWorker.onmessage = function (e) {
  539 + //console.log('callback in extr');
  540 +
  541 + $rootScope.BodyRegionData = e.data.bodyRegionData;
  542 + $rootScope.bgartData = e.data.bodyArtData;
  543 + $rootScope.BodyLayerData = e.data.bodyLayerData;
  544 +
  545 + $scope.isBodylayerdataLoaded = true;
  546 +
  547 + $scope.LoadDefaultLayerImage();
  548 +
  549 +
  550 +
  551 + }
  552 + bodyViewWorker.onerror = function (e) {
  553 + alert('Error: Line ' + e.lineno + ' in ' + e.filename + ': ' + e.message);
  554 + };
  555 + }
  556 +
  557 +
  558 + //Code for displaying NavigatorImage for BodyView
  559 + $scope.LoadBodyViewNavigatorImage = function () {
  560 + var NavigatorManJsonPath = '~/../content/data/json/da/da_dat_orient_image.json';
  561 +
  562 + $http({ method: 'GET', url: NavigatorManJsonPath })
  563 + .success(function (data) {
  564 + $scope.NavigatorData = data;
  565 +
  566 + $scope.skinTone = $rootScope.globalSetting.ethnicity;
  567 +
  568 + var navigatorManData = new jinqJs()
  569 + .from($scope.NavigatorData.Navigtor.ViewOrientation)
  570 + .where("_ViewOrientationId == " + $rootScope.currentBodyViewId)
  571 + .select();
  572 +
  573 + if ((navigatorManData != null || navigatorManData != undefined) && (navigatorManData.length > 0)) {
  574 +
  575 +
  576 + var imageInfoForNavigator = new jinqJs()
  577 + .from(navigatorManData[0].ImageInfo)
  578 + .where("_Ethnicity == " + $scope.skinTone)
  579 + .select();
  580 + }
  581 + else {
  582 + console.log('NAVIGATOR.DATA.NOT.FOUND FOR BODY VIEW: ' + $rootScope.currentBodyViewId);
  583 + }
  584 +
  585 + if (imageInfoForNavigator != null || imageInfoForNavigator != undefined) {
  586 + $scope.navigatorImage = imageInfoForNavigator;
  587 +
  588 +
  589 + var navImageModesty;
  590 +
  591 + if (($scope.navigatorImage != null || $scope.navigatorImage != undefined) && ($scope.navigatorImage.length > 0)) {
  592 + angular.forEach($scope.navigatorImage, function (value, key) {
  593 +
  594 + if (value._HaveModesty === $rootScope.globalSetting.modesty) {
  595 + navImageModesty = value._ImageName;
  596 + }
  597 + })
  598 + }
  599 + if (typeof (navImageModesty) === "undefined" || navImageModesty === null) {
  600 +
  601 + navImageModesty = $scope.navigatorImage[0]._ImageName;
  602 + }
  603 +
  604 + $scope.navimgsrc = "~/../content/images/DA/ethnicity/body-views/" + $scope.voId + '/' + $scope.skinTone + '/navigator_images/' + navImageModesty;
  605 +
  606 + $('#navigatorDiv').css('visibility', 'visible');
  607 +
  608 + $('#containment - wrapper').css('visibility', 'visible');
  609 + }
  610 +
  611 + else {
  612 + console.log('NAVIGATOR.IMAGE.NOT.FOUND FOR BODY VIEW: ' + $rootScope.currentBodyViewId);
  613 + }
  614 + })
  615 +
  616 + .error(function (data, status, headers, config) {
  617 + //1.
  618 + console.log('DATA.NOT.LOADED FOR:' + NavigatorManJsonPath + ', ERROR: ' + data);
  619 + //2.
  620 + // $scope.LoadBodyViewNavigatorImage()
  621 + });
  622 + }
  623 +
  624 +
  625 + $scope.LoadDefaultLayerImage = function () {
  626 + // debugger;
  627 +
  628 + $rootScope.isNormalMode = true;
  629 +
  630 + $scope.layerNumber = 0;
  631 + $scope.skinTone = $rootScope.globalSetting.ethnicity;
  632 +
  633 + $rootScope.viewOrientationId = $rootScope.voId;
  634 + if ($rootScope.voId == 5) {
  635 + $rootScope.viewOrientationId = 1;
  636 + }
  637 + else if ($rootScope.voId == 6) {
  638 + $rootScope.viewOrientationId = 2;
  639 + }
  640 + else if ($rootScope.voId == 7) {
  641 + $rootScope.viewOrientationId = 3;
  642 + }
  643 + else if ($rootScope.voId == 8) {
  644 + $rootScope.viewOrientationId = 4;
  645 + }
  646 + else if ($rootScope.voId == 9) {
  647 + $rootScope.viewOrientationId = 5;
  648 + }
  649 + else if ($rootScope.voId == 10) {
  650 + $rootScope.viewOrientationId = 6;
  651 + }
  652 + else if ($rootScope.voId == 11) {
  653 + $rootScope.viewOrientationId = 5;
  654 + }
  655 + else if ($rootScope.voId == 12) {
  656 + $rootScope.viewOrientationId = 6;
  657 + }
  658 +
  659 + $scope.CalculateImageCordinates($rootScope.viewOrientationId);
  660 +
  661 +
  662 + };
  663 +
  664 +
  665 + //calculate coordinates for body region images
  666 + $scope.CalculateImageCordinates = function (viewOrientationId) {
  667 +
  668 + $scope.terminateCurrentlyRunningWPs();
  669 +
  670 + var drawnBodyRegionCount = [];
  671 +
  672 + if ($rootScope.MaskCanvasData != null || $rootScope.MaskCanvasData != undefined) {
  673 + var n = $rootScope.MaskCanvasData.length;
  674 +
  675 + if (n > 0) {
  676 + for (var i = n - 1; i >= 0; i--) {
  677 +
  678 + $rootScope.MaskCanvasData.splice(i, 1);
  679 + // workerCount--;
  680 + }
  681 +
  682 + $rootScope.MaskCanvasData = null;
  683 + $rootScope.MaskCanvasData = [];
  684 + }
  685 + }
  686 +
  687 + //set height of canvas div and left tool bar as per window size
  688 + $rootScope.BodyRegionCordinatesData = []; // create an empty array
  689 +
  690 + $('#daBodyview').css('width', '100%');
  691 + $('#canvasDiv').css('height', $('#daImagePanel').outerHeight() - 104)
  692 + //$('#canvasDiv').css('width', $('#daImagePanel').outerWidth() - 100)
  693 + $('#leftToolBar').css('height', $('#daImagePanel').outerHeight())
  694 +
  695 +
  696 +
  697 + //calculate image coordinates and draw image
  698 + var bodyRegionCoordinates = $rootScope.BodyRegionData.BodyRegionViews;
  699 + // var viewOrientationId = String($rootScope.voId);
  700 +
  701 +
  702 + $scope.bodyRegionCoordinates = new jinqJs()
  703 + .from($rootScope.BodyRegionData.BodyRegionViews.BodyRegionCordinates)
  704 + .where('_ViewOrientationId == ' + viewOrientationId)
  705 + .select();
  706 +
  707 + console.log('viewOrientationId= ' + viewOrientationId + ', $scope.bodyRegionCoordinates length= ' + $scope.bodyRegionCoordinates.length)
  708 + // if ($rootScope.voId == 9 || $rootScope.voId == 11) {
  709 +
  710 + $scope.bagartDetails = new jinqJs()
  711 + .from($rootScope.bgartData.BackgroundArts.BackgroundArtDetail)
  712 + .where('_ViewOrientationId == ' + viewOrientationId)
  713 + .select();
  714 +
  715 + if ($scope.ColoredImageSRC != null && $scope.ColoredImageSRC.length > 0) {
  716 + $scope.ColoredImageSRC = null;
  717 + $scope.ColoredImageSRC = [];
  718 + $scope.flushCanvas();
  719 + }
  720 + else {
  721 + $scope.ColoredImageSRC = [];
  722 + }
  723 +
  724 + if ($scope.bodyRegionCoordinates != null || $scope.bodyRegionCoordinates != undefined) {
  725 + angular.forEach($scope.bodyRegionCoordinates, function (value, key) {
  726 +
  727 + if (value._HaveMirrorImage == 'Y') {
  728 +
  729 + //DrawMirroredImage
  730 +
  731 + //0. Scaling as per default zoom
  732 + var rectangle = scaleRectangle(value._X, value._Y, value._Height, value._Width, value._MirrorValue);
  733 +
  734 + //1.Get image source
  735 + var src = $scope.GetImageSource(value._BodyRegionId);
  736 +
  737 + $scope.imageSource = src;
  738 +
  739 + //2.Draw mirror image
  740 + $scope.DrawMirroredImage(Math.round(rectangle.scaledHeight), Math.round(rectangle.scaledWidth), Math.round(rectangle.scaledX), Math.round(rectangle.scaledY), src, value._BodyRegionId, 'N');
  741 + // debugger;
  742 + $rootScope.BodyRegionCordinatesData.push(
  743 + {
  744 + "bodyRegionId": value._BodyRegionId, "Height": Math.round(rectangle.scaledHeight), "Width": Math.round(rectangle.scaledWidth),
  745 + "X": Math.round(rectangle.scaledX), "Y": Math.round(rectangle.scaledY), "IsMirror": 'Yes'
  746 + }
  747 + );
  748 +
  749 + //3.GetMaskImageSource
  750 + var maskImageSrc = $scope.GetMaskImageSource($scope.imageSource);
  751 + // debugger;
  752 + //4 Draw Mask Mirror Image
  753 + $scope.DrawMirroredImage(Math.round(rectangle.scaledHeight), Math.round(rectangle.scaledWidth), Math.round(rectangle.scaledX), Math.round(rectangle.scaledY), maskImageSrc, value._BodyRegionId, 'Y');
  754 +
  755 +
  756 + //Draw Normal Image
  757 +
  758 + //0. Scaling as per default zoom
  759 + var rectangle = scaleRectangle(value._X, value._Y, value._Height, value._Width, 0);
  760 +
  761 +
  762 + //1.Draw body region which have mirror image
  763 + $scope.DrawImage(Math.round(rectangle.scaledHeight), Math.round(rectangle.scaledWidth), Math.round(rectangle.scaledX), Math.round(rectangle.scaledY), src, value._BodyRegionId, 'N');
  764 + $scope.BodyRegionCordinatesData.push(
  765 + {
  766 + "bodyRegionId": value._BodyRegionId, "Height": Math.round(rectangle.scaledHeight), "Width": Math.round(rectangle.scaledWidth),
  767 + "X": Math.round(rectangle.scaledX), "Y": Math.round(rectangle.scaledY), "IsMirror": 'No'
  768 + }
  769 + );
  770 +
  771 + //2.Draw body region for mask image
  772 + $scope.DrawImage(Math.round(rectangle.scaledHeight), Math.round(rectangle.scaledWidth), Math.round(rectangle.scaledX), Math.round(rectangle.scaledY), maskImageSrc, value._BodyRegionId, 'Y');
  773 +
  774 +
  775 + }
  776 + else {
  777 +
  778 + //0.Scaling as per default zoom
  779 + var rectangle = scaleRectangle(value._X, value._Y, value._Height, value._Width, value._MirrorValue);
  780 +
  781 + //1.Get image source
  782 + if (value._IsPrimary == 'N') {
  783 + var src = $scope.GetBackgroundImgSource(value._BodyRegionId);
  784 + $scope.imageSource = src;
  785 + }
  786 + else {
  787 + var src = $scope.GetImageSource(value._BodyRegionId);
  788 + $scope.imageSource = src;
  789 + }
  790 +
  791 + //2.Draw body region which don't have mirror image
  792 + $scope.DrawImage(Math.round(rectangle.scaledHeight), Math.round(rectangle.scaledWidth), Math.round(rectangle.scaledX), Math.round(rectangle.scaledY), src, value._BodyRegionId, 'N');
  793 +
  794 + $scope.BodyRegionCordinatesData.push(
  795 + {
  796 + "bodyRegionId": value._BodyRegionId, "Height": Math.round(rectangle.scaledHeight), "Width": Math.round(rectangle.scaledWidth),
  797 + "X": Math.round(rectangle.scaledX), "Y": Math.round(rectangle.scaledY), "IsMirror": 'No'
  798 + }
  799 + );
  800 +
  801 + //3.GetMaskImageSource
  802 + var maskSRC = $scope.GetMaskImageSource($scope.imageSource);
  803 +
  804 + //4.Draw body region for mask image
  805 + $scope.DrawImage(Math.round(rectangle.scaledHeight), Math.round(rectangle.scaledWidth), Math.round(rectangle.scaledX), Math.round(rectangle.scaledY), maskSRC, value._BodyRegionId, 'Y');
  806 +
  807 +
  808 + //draw figLeaf for modesty
  809 +
  810 + $scope.figLaefImageName;
  811 + $scope.figLaefX;
  812 + $scope.figLaefY;
  813 + var gender;
  814 + if (localStorage.getItem("genderId") == 'Female') {
  815 + gender = 'F';
  816 +
  817 + }
  818 + else {
  819 + gender = 'M';
  820 + }
  821 + if (((localStorage.getItem("genderId") == 'Female') && (value._BodyRegionId == 2)) || (value._BodyRegionId == 3)) {
  822 +
  823 + if ($scope.bagartDetails != null || $scope.bagartDetails != undefined) {
  824 + var dtlOfBr = new jinqJs()
  825 + .from($scope.bagartDetails)
  826 + .where('_BodyRegionId == ' + value._BodyRegionId)
  827 + .select();
  828 + if (dtlOfBr != null || dtlOfBr != undefined) {
  829 +
  830 + var dtlOfGender = new jinqJs()
  831 + .from(dtlOfBr)
  832 + .where('_Gender == ' + gender)
  833 + .select();
  834 + if (dtlOfGender != null || dtlOfGender != undefined) {
  835 +
  836 + var dtlOfSktn = new jinqJs()
  837 + .from(dtlOfGender)
  838 + .where('_Skintone == +')
  839 + .select();
  840 +
  841 + //multiple conditions are not working in where clause of JinQ so need multiple filtered variables
  842 +
  843 +
  844 + if ((dtlOfSktn != null || dtlOfSktn != undefined) && (dtlOfSktn.length > 0)) {
  845 +
  846 + if ((parseInt(dtlOfSktn[0]._lns) <= parseInt($scope.layerNumber)) && (parseInt(dtlOfSktn[0]._lne) > parseInt($scope.layerNumber)) && (dtlOfSktn[0]._isfr == 'Y')) {
  847 + $scope.figLaefImageName = dtlOfSktn[0]._ImageId;
  848 + //$scope.figLaefX = filtereddata[0]._X;
  849 + //$scope.figLaefY = filtereddata[0]._Y;
  850 +
  851 + var rectangle = scaleRectangle(value._X, value._Y, value._Height, value._Width, value._MirrorValue);
  852 +
  853 +
  854 + var src = "content/images/DA/" + $scope.zoomInOut + "/body-views/" + $rootScope.voId + "/layers/0/" + value._BodyRegionId + "/" + $scope.figLaefImageName;
  855 +
  856 + $scope.DrawImage(rectangle.scaledHeight, rectangle.scaledWidth, rectangle.scaledX, rectangle.scaledY, src, 'modestyImg' + value._BodyRegionId, 'N')
  857 +
  858 + }
  859 + }
  860 + }
  861 + }
  862 +
  863 + }
  864 +
  865 +
  866 + }
  867 + }
  868 +
  869 +
  870 + });
  871 +
  872 + $rootScope.isLoading = false;
  873 + $('#spinner').css('visibility', 'hidden');
  874 + }
  875 +
  876 + if (($rootScope.globalSetting.modesty == 'Y')) {
  877 + if ($('.modestyImg') != null) {
  878 + $('.modestyImg').css('visibility', 'visible');
  879 + }
  880 + }
  881 + //set scrollbars on canvas and hide loading label
  882 + // debugger;
  883 + // var isiOSSafari = (navigator.userAgent.match(/like Mac OS X/i)) ? true : false;
  884 + var isiOSSafari = (navigator.userAgent.match(/iPad/i)) ? true : false;
  885 +
  886 + //set scrollbars on canvas and hide loading label
  887 + // $('#daLoaderLabel').css('visibility', 'hidden')
  888 +
  889 + $('#canvasDiv').css('overflow', 'scroll')
  890 + if (isiOSSafari) {
  891 + $('#canvasDiv').scrollLeft($('#canvasDiv').width() + 150)
  892 +
  893 + }
  894 + else {
  895 + $('#canvasDiv').scrollLeft($('#canvasDiv').width() / 2)
  896 + }
  897 + // $('#canvasDiv').scrollLeft($scope.imageHorizontlScrollPosition)
  898 + $('#canvasDiv').scrollTop(50)
  899 + var abc = $rootScope.BodyRegionCordinatesData;
  900 + //debugger;
  901 + $('#layerChangeSlider').slider("option", "value", parseInt($scope.totalLayers) - parseInt($scope.layerNumber));
  902 + // $('#spinner').css('visibility', 'hidden');
  903 + $rootScope.isLoading = false;
  904 + //Dated:16-07-2016 Issue #4957 :While selecting the Zoom-in\Zoom-out button scroll should be go on top.
  905 + // #4976 :While changing gender male to female scroll bar is going on top.
  906 + var canvasDiv = document.getElementById('canvasDiv');
  907 + canvasDiv.scrollTop = 0;
  908 +
  909 + //Navigator Code for dynamically calculating the height and width of Dragable Div on Navigator Image
  910 +
  911 + var dragdivh = Math.floor(($('#canvasDiv').height() / $('#canvasDiv')[0].scrollHeight) * 119) //119px is the height of the image
  912 +
  913 + if ($('#canvasDiv')[0].scrollWidth > $('#canvasDiv')[0].clientWidth) {
  914 +
  915 + var dragdivw = 42
  916 + $scope.dragdivleft = 21;
  917 + $scope.dragdivtop = 0;
  918 +
  919 + $scope.dragdivposition = {
  920 + "left": 21,
  921 + "top": 0
  922 + };
  923 + }
  924 + else {
  925 + var dragdivw = 83;
  926 +
  927 + $scope.dragdivleft = 0;
  928 + $scope.dragdivtop = 0;
  929 +
  930 + $scope.dragdivposition = {
  931 + "left": 0,
  932 + "top": 0
  933 +
  934 + };
  935 + }
  936 +
  937 + $('#draggable').css('width', dragdivw);
  938 + $('#draggable').css('height', dragdivh)
  939 + }
  940 +
  941 + function scaleRectangle(x, y, height, width, mirrorValue) {
  942 + var nzoom = $scope.zoomInOut;
  943 + var existingZoon = 100;
  944 +
  945 + var X = 0;
  946 + var scaledY = 0;
  947 + var scaledHeight = 0;
  948 + var scaledWidth = 0;
  949 +
  950 + if (mirrorValue != 0) {
  951 + var mirroredX = parseInt(mirrorValue) + parseInt(x);
  952 + var newX = (mirroredX * nzoom);
  953 + mirroredX = (newX / existingZoon);
  954 + X = mirroredX;
  955 + }
  956 + else {
  957 + var newX = (x * nzoom);
  958 + X = (newX / existingZoon);
  959 + }
  960 +
  961 + var newY = (y * nzoom);
  962 + var Y = (newY / existingZoon);
  963 +
  964 + var newHeight = (height * nzoom);
  965 + var ht = (newHeight / existingZoon);
  966 +
  967 + var newWidth = (width * nzoom);
  968 + var wt = (newWidth / existingZoon);
  969 +
  970 + return {
  971 + scaledX: X,
  972 + scaledY: Y,
  973 + scaledHeight: ht,
  974 + scaledWidth: wt
  975 + }
  976 + }
  977 +
  978 + $scope.GetMaskImageSource = function (src) {
  979 +
  980 + if (src != null || src != undefined) {
  981 + if (src.match('.png')) {
  982 + var mciImage = src.replace('.png', '_mci.png')
  983 + }
  984 + else {
  985 + var mciImage = src.replace('.jpg', '_mci.png')
  986 + }
  987 + return mciImage;
  988 +
  989 + }
  990 + else {
  991 + console.log('IMAGE.SOURCE.NOLT.FOUND');
  992 + }
  993 + }
  994 +
  995 +
  996 +
  997 + $scope.GetImageSource = function (bodyRegionId) {
  998 + // debugger;
  999 + var dataLength = $rootScope.BodyLayerData.Layers.DataLayer.length;
  1000 +
  1001 + //set max for LayerNumber input
  1002 + $scope.totalLayers = dataLength - 1;
  1003 + // debugger
  1004 + $('#txtLayerNumber').attr('max', $scope.totalLayers);
  1005 + $('#layerChangeSlider').slider("option", "max", $scope.totalLayers);
  1006 + // $('#layerChangeSlider').slider("option", "value",parseInt($scope.totalLayers)-parseInt($scope.layerNumber));
  1007 +
  1008 + $scope.one = 1;
  1009 +
  1010 + if ($rootScope.isListManagerSelected == true) {
  1011 + $scope.layerNumber = $('#txtlayerNumber').val();
  1012 + }
  1013 +
  1014 + $scope.userInput = parseInt($scope.layerNumber);
  1015 +
  1016 +
  1017 + $scope.skinTone = $rootScope.globalSetting.ethnicity;
  1018 +
  1019 + var SelectedLayerData = [];
  1020 + SelectedLayerData = $rootScope.BodyLayerData.Layers.DataLayer[dataLength - $scope.userInput - 1];
  1021 + if ((SelectedLayerData != null || SelectedLayerData != undefined))
  1022 +
  1023 + if ($scope.layerNumber == 0) {
  1024 + console.log('lNo: ' + $scope.layerNumber + ' and BodyRegion.length: ' + SelectedLayerData.BodyRegion.length);
  1025 +
  1026 + if (SelectedLayerData.BodyRegion.length > 0) {
  1027 + for (var z = 0; z < SelectedLayerData.BodyRegion.length; z++) {
  1028 +
  1029 + var bodyRegion = SelectedLayerData.BodyRegion[z]._BodyRegionId;
  1030 + var bodyRegionSkinTone = SelectedLayerData.BodyRegion[z].Image._SkintTone;
  1031 +
  1032 + if ($rootScope.viewOrientationId == 3 && bodyRegionId == 1) {
  1033 + console.log('$rootScope.voId: ' + $rootScope.voId);
  1034 + if (bodyRegion == bodyRegionId && bodyRegionSkinTone == 'W') {
  1035 + return "content/images/DA/" + $scope.zoomInOut + "/body-views/" + $rootScope.voId + "/layers/" + $scope.layerNumber + "/" + bodyRegionId + "/W/" + SelectedLayerData.BodyRegion[z].Image._ImageName;
  1036 + }
  1037 + }
  1038 +
  1039 + else {
  1040 +
  1041 + if (bodyRegion == bodyRegionId && bodyRegionSkinTone == $scope.skinTone) {
  1042 +
  1043 + return "content/images/DA/" + $scope.zoomInOut + "/body-views/" + $rootScope.voId + "/layers/" + $scope.layerNumber + "/" + bodyRegionId + "/" + $scope.skinTone + "/" + SelectedLayerData.BodyRegion[z].Image._ImageName;
  1044 + }
  1045 + }
  1046 + }
  1047 + }
  1048 + }
  1049 + else {
  1050 + // debugger;
  1051 + //below 4 bodyviews have only single body region
  1052 + if (($rootScope.voId == '9') || ($rootScope.voId == '11') || ($rootScope.voId == '10') || ($rootScope.voId == '12')) {
  1053 + var bodyRegion = SelectedLayerData.BodyRegion._BodyRegionId;
  1054 +
  1055 + return "content/images/DA/" + $scope.zoomInOut + "/body-views/" + $rootScope.voId + "/layers/" + $scope.layerNumber + "/" + bodyRegionId + "/" + SelectedLayerData.BodyRegion.Image._ImageName;
  1056 +
  1057 + }
  1058 + else // it is for other body view which have multiple body regions and layer no > 0
  1059 + {
  1060 + // debugger;
  1061 + if (SelectedLayerData.BodyRegion.length > 0) {
  1062 + for (var z = 0; z <= SelectedLayerData.BodyRegion.length; z++) {
  1063 + var bodyRegion = SelectedLayerData.BodyRegion[z]._BodyRegionId;
  1064 + if (bodyRegion == bodyRegionId) {
  1065 +
  1066 + return "content/images/DA/" + $scope.zoomInOut + "/body-views/" + $rootScope.voId + "/layers/" + $scope.layerNumber + "/" + bodyRegionId + "/" + SelectedLayerData.BodyRegion[z].Image._ImageName;
  1067 +
  1068 +
  1069 + }
  1070 + }
  1071 + }
  1072 + }
  1073 + }
  1074 +
  1075 + }
  1076 +
  1077 + $scope.GetBackgroundImgSource = function (bodyRegionId) {
  1078 + // debugger;
  1079 +
  1080 + var selectedGender;
  1081 + if (localStorage.getItem("genderId") == "Male") {
  1082 + selectedGender = 'M';
  1083 + }
  1084 + else {
  1085 + selectedGender = 'F';
  1086 +
  1087 + }
  1088 + //filter data based on bodyRegion
  1089 + $scope.bagartBodyRegionDetails = new jinqJs()
  1090 + .from($scope.bagartDetails)
  1091 + .where('_BodyRegionId == ' + bodyRegionId)
  1092 + .select();
  1093 + if ($scope.bagartBodyRegionDetails != null || $scope.bagartBodyRegionDetails != undefined) {
  1094 +
  1095 + //filter bodyRegion data basd on skintone
  1096 + $scope.bagartDetailsOnSktn = new jinqJs()
  1097 + .from($scope.bagartBodyRegionDetails)
  1098 + .where('_Skintone == ' + $scope.skinTone)
  1099 + .select();
  1100 +
  1101 + if ($scope.bagartDetailsOnSktn != null || $scope.bagartDetailsOnSktn != undefined) {
  1102 + //only brid=2 is having different male,female image, other bodr region have common images for male, female
  1103 + if (bodyRegionId == 2) {
  1104 + for (var z = 0; z <= $scope.bagartDetailsOnSktn.length; z++) {
  1105 + var gender = $scope.bagartDetailsOnSktn[z]._Gender;
  1106 + if (gender == selectedGender) {
  1107 + return "content/images/DA/" + $scope.zoomInOut + "/body-views/" + $rootScope.voId + "/layers/0/" + bodyRegionId + "/" + $scope.skinTone + "/" + $scope.bagartDetailsOnSktn[z]._ImageId;
  1108 + }
  1109 + }
  1110 + }
  1111 +
  1112 + else {
  1113 + return "content/images/DA/" + $scope.zoomInOut + "/body-views/" + $rootScope.voId + "/layers/0/" + bodyRegionId + "/" + $scope.skinTone + "/" + $scope.bagartDetailsOnSktn[0]._ImageId;
  1114 +
  1115 + }
  1116 + }
  1117 + }
  1118 + }
  1119 +
  1120 +
  1121 + $scope.DrawMirroredImage = function (h, w, x, y, src, bodyRegionId, isMaskImage) {
  1122 +
  1123 + var FlipedImgCanvas = document.createElement('canvas');
  1124 + FlipedImgCanvas.height = h;
  1125 + FlipedImgCanvas.width = w;
  1126 + FlipedImgCanvas.setAttribute("data-IsMirrored", "Y")
  1127 + FlipedImgCanvas.style.position = "absolute";
  1128 + FlipedImgCanvas.style.left = x + "px";
  1129 + FlipedImgCanvas.style.top = y + "px";
  1130 +
  1131 +
  1132 +
  1133 + if (isMaskImage == 'Y') {
  1134 + FlipedImgCanvas.id = 'imageCanvas' + bodyRegionId + '_MR_mci';
  1135 + FlipedImgCanvas.style.visibility = 'hidden'
  1136 +
  1137 + }
  1138 + else {
  1139 + FlipedImgCanvas.id = 'imageCanvas' + bodyRegionId + '_MR';
  1140 +
  1141 +
  1142 + if ($rootScope.isExtract == true) {
  1143 + FlipedImgCanvas.style.visibility = 'visible'
  1144 + }
  1145 + else {
  1146 + if ($rootScope.isHighLight == true && $rootScope.isZoomed == false) {
  1147 + FlipedImgCanvas.style.visibility = 'hidden';
  1148 + }
  1149 + }
  1150 + }
  1151 +
  1152 +
  1153 +
  1154 + FlipedImgCanvas.addEventListener('click', function (evt) {
  1155 +
  1156 + //to get correct data on multihighlight highlight
  1157 + if ($scope.isLayerChange == true) {
  1158 + $scope.isLayerChange = false;
  1159 + }
  1160 +
  1161 + if (evt.ctrlKey) {
  1162 + $rootScope.multiAnnotationIsON = true;
  1163 + }
  1164 + else {
  1165 + if (($rootScope.previousHighlightList != null || $rootScope.previousHighlightList != undefined) && ($rootScope.previousHighlightList.length > 0)) {
  1166 + $rootScope.previousHighlightList = [];
  1167 + }
  1168 +
  1169 + $rootScope.multiAnnotationIsON = false;
  1170 + }
  1171 +
  1172 + //get mouse coordinate of mirror image click
  1173 + var mousePos = $scope.getMousePos(evt);
  1174 +
  1175 + var context = FlipedImgCanvas.getContext("2d");
  1176 + var canvasId = context.canvas.getAttribute('id');
  1177 +
  1178 +
  1179 + var mirrorCanvasX = context.canvas.offsetLeft;
  1180 + var mirrorCanvasWidth = context.canvas.clientWidth;
  1181 +
  1182 + var maskCanvasId = (canvasId.replace('_MR', '')) + '_mci';
  1183 + var maskCanvas = document.getElementById(maskCanvasId);
  1184 + var maskCanvasContext = maskCanvas.getContext("2d");
  1185 +
  1186 +
  1187 + var canvasDiv = document.getElementById('canvasDiv');
  1188 + var verticalScrollPosition = canvasDiv.scrollTop;
  1189 + var horizontlScrollPosition = canvasDiv.scrollLeft;
  1190 +
  1191 + var distanceXOnMirrorImage = (parseInt(mirrorCanvasX) + parseInt(mirrorCanvasWidth)) - (parseInt(mousePos.x) + horizontlScrollPosition);// - 135);
  1192 +
  1193 + var mirrorXOnNormalImage = parseInt(maskCanvasContext.canvas.offsetLeft) + parseInt(distanceXOnMirrorImage);
  1194 +
  1195 + var actulalX = mirrorXOnNormalImage
  1196 + var actualY = mousePos.y + verticalScrollPosition
  1197 +
  1198 +
  1199 + var pixelData = maskCanvasContext.getImageData(Math.round(actulalX - parseInt(maskCanvasContext.canvas.offsetLeft)), Math.round(actualY - y), 1, 1);
  1200 +
  1201 + pixelData.data[0] = pixelData.data[0] - 9;
  1202 + pixelData.data[1] = pixelData.data[1] - 9;
  1203 + pixelData.data[2] = pixelData.data[2] - 9
  1204 +
  1205 + var Red;
  1206 + var Green;
  1207 + var Blue;
  1208 + var zero = "0";
  1209 +
  1210 + if ((pixelData.data[0]).toString().length != 2) {
  1211 + Red = zero.concat((pixelData.data[0]).toString())
  1212 + }
  1213 + else {
  1214 + Red = (pixelData.data[0]).toString()
  1215 + }
  1216 + if ((pixelData.data[1]).toString().length != 2) {
  1217 + Green = zero.concat((pixelData.data[1]).toString())
  1218 + }
  1219 + else {
  1220 + Green = (pixelData.data[1]).toString()
  1221 +
  1222 + }
  1223 + if ((pixelData.data[2]).toString().length != 2) {
  1224 + Blue = zero.concat((pixelData.data[2]).toString())
  1225 + }
  1226 + else {
  1227 + Blue = (pixelData.data[2]).toString()
  1228 +
  1229 + }
  1230 + var RGBColor = (Red + Green + Blue);
  1231 +
  1232 + if ($rootScope.isHighLight) {
  1233 +
  1234 + if ($scope.machedIcolorInBodyRegion != null || $scope.machedIcolorInBodyRegion != undefined) {
  1235 + if ($scope.machedIcolorInBodyRegion.length > 0) {
  1236 + if ($rootScope.multiAnnotationIsON == false) {
  1237 + for (var i = 0; i < $scope.machedIcolorInBodyRegion.length; i++) {
  1238 + var bodyRegionId = $scope.machedIcolorInBodyRegion[i];
  1239 +
  1240 + var grayCanvasID = 'imageCanvas' + bodyRegionId;
  1241 + var grayCanvas = document.getElementById(grayCanvasID);
  1242 +
  1243 + var grayCanvasContext = grayCanvas.getContext("2d");
  1244 +
  1245 + if ($rootScope.grayImageDataList[bodyRegionId - 1] != null || $rootScope.grayImageDataList[bodyRegionId - 1] != undefined) {
  1246 + var grayImageData = $rootScope.grayImageDataList[bodyRegionId - 1];
  1247 + grayCanvasContext.putImageData(grayImageData, 0, 0);
  1248 + }
  1249 +
  1250 + // for mirrored canvas
  1251 +
  1252 + if (bodyRegionId == 4 || bodyRegionId == 5 || bodyRegionId == 6) {
  1253 + var grayCanvasID = 'imageCanvas' + bodyRegionId + '_MR';
  1254 + var grayCanvasMR = document.getElementById(grayCanvasID);
  1255 +
  1256 + var grayCanvasContextMR = grayCanvasMR.getContext("2d");
  1257 + if ($rootScope.grayImageMRDataList[bodyRegionId] != null || grayImageMRDataList[bodyRegionId] != undefined) {
  1258 + var grayImageDataMR = $rootScope.grayImageMRDataList[bodyRegionId];
  1259 +
  1260 + grayCanvasContextMR.putImageData(grayImageDataMR, 0, 0);
  1261 + }
  1262 + }
  1263 +
  1264 + }
  1265 + }
  1266 + }
  1267 + }
  1268 +
  1269 + $rootScope.previousHighlightList.push(RGBColor);
  1270 +
  1271 + $scope.highLightBodyBasedOnIcolor(RGBColor);
  1272 + }
  1273 +
  1274 + if ($rootScope.isNormalMode == true) {
  1275 +
  1276 +
  1277 + $rootScope.previousHighlightList.push(RGBColor);
  1278 + }
  1279 +
  1280 + var annotationText = $scope.GetAnnotationText(parseInt(RGBColor));
  1281 +
  1282 + if ($('#speechBubbleTrns').length > 0)
  1283 + $('#speechBubbleTrns').remove();
  1284 +
  1285 + if ($rootScope.multiAnnotationIsON == true) {
  1286 +
  1287 + // $scope.createDynamicSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top);
  1288 + $scope.MultiLanguageAnnationArray = [];
  1289 + $scope.MultiLanguageAnnationArray.push(annotationText);
  1290 + $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, true);
  1291 + }
  1292 + else {
  1293 +
  1294 + if ($('#dot').length > 0) {
  1295 + $('#dot').remove();
  1296 + }
  1297 +
  1298 + if ($('#sppeachBubble').length > 0) {
  1299 + $('#sppeachBubble').remove();
  1300 +
  1301 +
  1302 + // $scope.createDynamicSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top);
  1303 + $scope.MultiLanguageAnnationArray = [];
  1304 + $scope.MultiLanguageAnnationArray.push(annotationText);
  1305 + $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, true);
  1306 + }
  1307 + else {
  1308 +
  1309 + // $scope.createDynamicSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top);
  1310 + $scope.MultiLanguageAnnationArray = [];
  1311 + $scope.MultiLanguageAnnationArray.push(annotationText);
  1312 + $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, true);
  1313 + }
  1314 +
  1315 +
  1316 + }
  1317 + }, false);
  1318 +
  1319 + FlipedImgCanvas.addEventListener('mousedown', function (evt) {
  1320 +
  1321 + //alert('mousedown')
  1322 + }, false);
  1323 +
  1324 +
  1325 + FlipedImgCanvas.addEventListener('mouseup', function (evt) {
  1326 + //alert('mouseup')
  1327 +
  1328 +
  1329 + }, false);
  1330 +
  1331 + var context = FlipedImgCanvas.getContext("2d");
  1332 +
  1333 + var PI = Math.PI;
  1334 + var PI2 = PI * 2;
  1335 + var cw, ch, imgW, imgH, mouseX, mouseY;
  1336 + var scaleFactor = 1.00;
  1337 +
  1338 + //$scaler = $("#scaler");
  1339 + //$scaler.val(scaleFactor);
  1340 + //$scaler.hide();
  1341 +
  1342 + var img = new Image();
  1343 + img.onload = start;
  1344 +
  1345 + // img.src = "~/../content/images/" + src;;
  1346 + img.src = src;
  1347 +
  1348 +
  1349 + function start() {
  1350 + context.save();
  1351 + context.translate(w, 0);
  1352 + context.scale(-1, 1);
  1353 + context.drawImage(img, 0, 0);
  1354 + context.restore();
  1355 +
  1356 +
  1357 + if (isMaskImage == 'N') {
  1358 + $scope.ColoredImageSRC.push(
  1359 + {
  1360 + "bodyRegionId": bodyRegionId, "SRC": src,
  1361 + "Height": h,
  1362 + "Width": w,
  1363 + "x": x,
  1364 + "y": y,
  1365 + "haveMirror": 'true'
  1366 + }
  1367 + );
  1368 +
  1369 + // console.log('$rootScope.isListManagerSelected= ' + $rootScope.isListManagerSelected + ' length= ' + $scope.ColoredImageSRC.length)
  1370 +
  1371 +
  1372 + if (($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined)) {
  1373 +
  1374 + if ((($rootScope.viewOrientationId == '1') || ($rootScope.viewOrientationId == '4')) && ($scope.ColoredImageSRC.length == 9)) {
  1375 + $scope.isEligibleForHighlight = true;
  1376 + }
  1377 + else if ((($rootScope.viewOrientationId == '2') || ($rootScope.viewOrientationId == '3')) && ($scope.ColoredImageSRC.length == 5)) {
  1378 + $scope.isEligibleForHighlight = true;
  1379 + }
  1380 + else if (($rootScope.viewOrientationId == '5') && ($scope.ColoredImageSRC.length == 4)) {
  1381 + $scope.isEligibleForHighlight = true;
  1382 + }
  1383 + else if (($rootScope.viewOrientationId == '6') && ($scope.ColoredImageSRC.length == 1)) {
  1384 + $scope.isEligibleForHighlight = true;
  1385 + }
  1386 + else {
  1387 + $scope.isEligibleForHighlight = false;
  1388 + }
  1389 +
  1390 + if ($scope.isEligibleForHighlight == true) {
  1391 + if ($rootScope.isHighLight == true || ($rootScope.isListManagerSelected == true) || (($rootScope.isGenderChnage == true) && ($rootScope.isHighLight == true)) || (($rootScope.isViewChange == true) && ($rootScope.isHighLight == true))) {
  1392 +
  1393 + $rootScope.isLoading = false;
  1394 + $('#spinner').css('visibility', 'hidden');
  1395 +
  1396 +
  1397 + $rootScope.isLoading = true;
  1398 + $('#spinner').css('visibility', 'visible');
  1399 + //$timeout(function () {
  1400 + console.log('inside start of flipped. $scope.ColoredImageSRC.length= ' + $scope.ColoredImageSRC.length)
  1401 + $rootScope.isHighLight = true;
  1402 + console.log('just before highLightBody call');
  1403 + $scope.highLightBody();
  1404 + console.log('just after highLightBody call');
  1405 + //}, 500);
  1406 + }
  1407 + }
  1408 + }
  1409 +
  1410 + // console.log('ColoredImageSRC. pushed and length: ' + $scope.ColoredImageSRC.length);
  1411 + }
  1412 +
  1413 + if (FlipedImgCanvas.id.match('_mci')) {
  1414 +
  1415 + var maskImgData = context.getImageData(0, 0, w, h);
  1416 +
  1417 + $rootScope.MaskCanvasData.push(
  1418 + {
  1419 + "bodyRegionId": bodyRegionId,
  1420 + "canvasId": FlipedImgCanvas.id,
  1421 + "maskData": maskImgData,
  1422 +
  1423 + }
  1424 + );
  1425 + }
  1426 + };
  1427 +
  1428 + if (document.getElementById('canvasDiv') != null)
  1429 + document.getElementById('canvasDiv').appendChild(FlipedImgCanvas);
  1430 +
  1431 +
  1432 +
  1433 + }
  1434 +
  1435 + $scope.DrawImage = function (h, w, x, y, src, bodyRegionId, isMaskImage) {
  1436 +
  1437 + var imgCanvas = document.createElement('canvas');
  1438 +
  1439 + imgCanvas.height = h;
  1440 + imgCanvas.width = w;
  1441 + imgCanvas.setAttribute("data-IsMirrored", "N")
  1442 + imgCanvas.style.position = "absolute";
  1443 + imgCanvas.style.left = x + "px";
  1444 + imgCanvas.style.top = y + "px";
  1445 +
  1446 + if (isMaskImage == 'Y') {
  1447 + imgCanvas.style.visibility = 'hidden'
  1448 + imgCanvas.id = 'imageCanvas' + bodyRegionId + '_mci';
  1449 +
  1450 + }
  1451 + else {
  1452 + imgCanvas.id = 'imageCanvas' + bodyRegionId;
  1453 +
  1454 + if (bodyRegionId == 3) {
  1455 + //set z index of hip canavs to fix the issue caused by overlapping of arm canavs on hip canavs.
  1456 + imgCanvas.style.zIndex = "100";
  1457 + }
  1458 + if (bodyRegionId.match('modestyImg')) {
  1459 + //added class to further access this canavs to show and hide leaf as per modesty seting
  1460 + imgCanvas.className = 'modestyImg'
  1461 + imgCanvas.style.visibility = 'hidden'
  1462 + //set z index to make leaf canvas on top of hip canavs
  1463 + imgCanvas.style.zIndex = "200";
  1464 + }
  1465 + if (($rootScope.voId == 11 || $rootScope.voId == 9) && bodyRegionId == 6) {
  1466 + imgCanvas.style.zIndex = "500";
  1467 + }
  1468 +
  1469 + if ($rootScope.isExtract == true) {
  1470 + imgCanvas.style.visibility = 'visible'
  1471 + }
  1472 + else {
  1473 +
  1474 + if ($rootScope.isHighLight == true && $rootScope.isZoomed == false) {
  1475 + imgCanvas.style.visibility = 'hidden';
  1476 + }
  1477 + }
  1478 +
  1479 + }
  1480 +
  1481 + imgCanvas.addEventListener('click', function (evt) {
  1482 +
  1483 +
  1484 + if ($scope.isLayerChange == true) {
  1485 + $scope.isLayerChange = false;
  1486 + }
  1487 +
  1488 + if (evt.ctrlKey) {
  1489 + $rootScope.multiAnnotationIsON = true;
  1490 + }
  1491 + else {
  1492 + if (($rootScope.previousHighlightList != null || $rootScope.previousHighlightList != undefined) && ($rootScope.previousHighlightList.length > 0)) {
  1493 + $rootScope.previousHighlightList = [];
  1494 + }
  1495 + $rootScope.multiAnnotationIsON = false;
  1496 + }
  1497 +
  1498 + var annotationText;
  1499 + var context = imgCanvas.getContext("2d");
  1500 +
  1501 +
  1502 + var canvasId = context.canvas.getAttribute('id');
  1503 + var maskCanvasId;
  1504 + //for leaf canvas
  1505 + if (canvasId.match('modestyImg')) {
  1506 + maskCanvasId = canvasId;
  1507 + }
  1508 + else {
  1509 + maskCanvasId = canvasId + '_mci';
  1510 + }
  1511 + var maskCanvas = document.getElementById(maskCanvasId);
  1512 + var maskCanvasContext = maskCanvas.getContext("2d");
  1513 +
  1514 + var mousePos = $scope.getMousePos(evt);
  1515 + // alert(mousePos.x + ',' + mousePos.y);
  1516 +
  1517 + var canvasDiv = document.getElementById('canvasDiv');
  1518 + var verticalScrollPosition = canvasDiv.scrollTop;
  1519 + var horizontlScrollPosition = canvasDiv.scrollLeft;
  1520 +
  1521 +
  1522 + //We substracted 135, as the difference between flex and html coordinates for same organ is 135
  1523 + var actulalX = mousePos.x + horizontlScrollPosition;
  1524 + var actualY = mousePos.y + verticalScrollPosition;
  1525 + var RGBColor = $scope.GetRGBColor(maskCanvasContext, actulalX, actualY, x, y);
  1526 +
  1527 +
  1528 + //Modesty ON
  1529 + if (maskCanvasId.match('modestyImg') && RGBColor != '000000') {
  1530 + RGBColor = DA[0].figLeafTermId;
  1531 + annotationText = $scope.GetAnnotationBasedOnActualTermNo(RGBColor);
  1532 + }
  1533 + //Modesty On but clicked somewhre else, we did modesty check because the modesty image covers whole body region so if user will click to
  1534 + //see the annotation apart from leaf then the actual click will be on modesty canvas, but for annotation er
  1535 + //
  1536 + else if (maskCanvasId.match('modestyImg') && RGBColor == '000000') {
  1537 + //if ($rootScope.voId == 11) {
  1538 + // maskCanvasId = 'imageCanvas6_mci';
  1539 + // x = $('#imageCanvas6_mci').left;
  1540 + // y = $('#imageCanvas6_mci').top;
  1541 + //}
  1542 + //else {
  1543 + bodyRegionId = maskCanvasId.slice(-1);
  1544 + maskCanvasId = 'imageCanvas' + bodyRegionId + '_mci';
  1545 + // }
  1546 + var maskCanvas = document.getElementById(maskCanvasId);
  1547 + var maskCanvasContext = maskCanvas.getContext("2d");
  1548 + RGBColor = $scope.GetRGBColor(maskCanvasContext, actulalX, actualY, x, y);
  1549 + annotationText = $scope.GetAnnotationText(parseInt(RGBColor));
  1550 + }
  1551 + else {
  1552 + RGBColor = $scope.GetRGBColor(maskCanvasContext, actulalX, actualY, x, y);
  1553 + annotationText = $scope.GetAnnotationText(parseInt(RGBColor));
  1554 +
  1555 + }
  1556 +
  1557 +
  1558 + if ($rootScope.isHighLight == true) {
  1559 + if ($scope.machedIcolorInBodyRegion != null || $scope.machedIcolorInBodyRegion != undefined) {
  1560 + if ($scope.machedIcolorInBodyRegion.length > 0) {
  1561 + if ($rootScope.multiAnnotationIsON == false) {
  1562 + for (var i = 0; i < $scope.machedIcolorInBodyRegion.length; i++) {
  1563 + var bodyRegionId = $scope.machedIcolorInBodyRegion[i];
  1564 +
  1565 + var grayCanvasID = 'imageCanvas' + bodyRegionId;
  1566 + var grayCanvas = document.getElementById(grayCanvasID);
  1567 +
  1568 + var grayCanvasContext = grayCanvas.getContext("2d");
  1569 + if ($rootScope.grayImageDataList[bodyRegionId - 1] != null || $rootScope.grayImageDataList[bodyRegionId - 1] != undefined) {
  1570 + var grayImageData = $rootScope.grayImageDataList[bodyRegionId - 1];
  1571 + grayCanvasContext.putImageData(grayImageData, 0, 0);
  1572 + }
  1573 +
  1574 + // for unhighlight the mirrored body region
  1575 + if (bodyRegionId == 4 || bodyRegionId == 5 || bodyRegionId == 6) {
  1576 + var grayCanvasID = 'imageCanvas' + bodyRegionId + '_MR';
  1577 + var grayCanvasMR = document.getElementById(grayCanvasID);
  1578 +
  1579 + var grayCanvasContextMR = grayCanvasMR.getContext("2d");
  1580 +
  1581 + if ($rootScope.grayImageMRDataList[bodyRegionId] != null || $rootScope.grayImageMRDataList[bodyRegionId] != undefined) {
  1582 +
  1583 + var grayImageDataMR = $rootScope.grayImageMRDataList[bodyRegionId];
  1584 +
  1585 + grayCanvasContextMR.putImageData(grayImageDataMR, 0, 0);
  1586 +
  1587 + }
  1588 + }
  1589 +
  1590 + }
  1591 + }
  1592 + }
  1593 + }
  1594 +
  1595 + $rootScope.previousHighlightList.push(RGBColor);
  1596 +
  1597 +
  1598 + if (maskCanvasId.match('modestyImg') && RGBColor != '000000') { }
  1599 + else
  1600 + {
  1601 + $scope.highLightBodyBasedOnIcolor(RGBColor);
  1602 + }
  1603 +
  1604 + }
  1605 +
  1606 + if ($rootScope.isNormalMode == true) {
  1607 + $rootScope.previousHighlightList.push(RGBColor);
  1608 + }
  1609 +
  1610 + if ($('#speechBubbleTrns').length > 0)
  1611 + $('#speechBubbleTrns').remove();
  1612 +
  1613 + if ($rootScope.multiAnnotationIsON == true) {
  1614 +
  1615 + // $scope.createDynamicSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top);
  1616 + $scope.MultiLanguageAnnationArray = [];
  1617 + $scope.MultiLanguageAnnationArray.push(annotationText);
  1618 + $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, true);
  1619 + }
  1620 + else {
  1621 +
  1622 + $scope.MultiLanguageAnnationArray = [];
  1623 +
  1624 + console.log('1. annotationText: ' + annotationText);
  1625 +
  1626 + if ($('#dot').length > 0) {
  1627 + $('#dot').remove();
  1628 +
  1629 + if ($('#sppeachBubble').length > 0) {
  1630 + $('#sppeachBubble').remove();
  1631 + }
  1632 +
  1633 +
  1634 +
  1635 + // $scope.createDynamicSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top);
  1636 +
  1637 +
  1638 + $scope.MultiLanguageAnnationArray.push(annotationText);
  1639 +
  1640 + console.log('2. annotationText: ' + annotationText + ' , length: ' + $scope.MultiLanguageAnnationArray.length);
  1641 +
  1642 + $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, true);
  1643 +
  1644 + }
  1645 + else {
  1646 +
  1647 +
  1648 +
  1649 + $scope.MultiLanguageAnnationArray = [];
  1650 + $scope.MultiLanguageAnnationArray.push(annotationText);
  1651 +
  1652 + console.log('3. annotationText: ' + annotationText + ' , length: ' + $scope.MultiLanguageAnnationArray.length);
  1653 + $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, true);
  1654 + }
  1655 +
  1656 +
  1657 + }
  1658 + }, false);
  1659 +
  1660 + var PI = Math.PI;
  1661 + var PI2 = PI * 2;
  1662 + var cw, ch, imgW, imgH, mouseX, mouseY;
  1663 + var scaleFactor = 1.00;
  1664 +
  1665 + var context = imgCanvas.getContext('2d');
  1666 + var img = new Image();
  1667 + img.onload = start;
  1668 +
  1669 + img.src = src;
  1670 +
  1671 + function start() {
  1672 + //debugger;
  1673 + context.drawImage(img, 0, 0);
  1674 +
  1675 + if (isMaskImage == 'N') {
  1676 + if (bodyRegionId == 'modestyImg3' || bodyRegionId == 'modestyImg2') {
  1677 + //do nothing
  1678 + }
  1679 + else {
  1680 + $scope.ColoredImageSRC.push(
  1681 + {
  1682 + "bodyRegionId": bodyRegionId, "SRC": src,
  1683 + "Height": h,
  1684 + "Width": w,
  1685 + "x": x,
  1686 + "y": y,
  1687 + "haveMirror": 'false'
  1688 + }
  1689 +
  1690 + );
  1691 +
  1692 + if (($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined)) {
  1693 +
  1694 + if ((($rootScope.viewOrientationId == '1') || ($rootScope.viewOrientationId == '4')) && ($scope.ColoredImageSRC.length == 9)) {
  1695 + $scope.isEligibleForHighlight = true;
  1696 + }
  1697 + else if ((($rootScope.viewOrientationId == '2') || ($rootScope.viewOrientationId == '3')) && ($scope.ColoredImageSRC.length == 5)) {
  1698 + $scope.isEligibleForHighlight = true;
  1699 + }
  1700 + else if (($rootScope.viewOrientationId == '5') && ($scope.ColoredImageSRC.length == 4)) {
  1701 + $scope.isEligibleForHighlight = true;
  1702 + }
  1703 + else if (($rootScope.viewOrientationId == '6') && ($scope.ColoredImageSRC.length == 1)) {
  1704 + $scope.isEligibleForHighlight = true;
  1705 + }
  1706 + else {
  1707 + $scope.isEligibleForHighlight = false;
  1708 + }
  1709 +
  1710 + if ($scope.isEligibleForHighlight == true) {
  1711 + if ($rootScope.isHighLight == true || ($rootScope.isListManagerSelected == true) || (($rootScope.isGenderChnage == true) && ($rootScope.isHighLight == true)) || (($rootScope.isViewChange == true) && ($rootScope.isHighLight == true))) {
  1712 +
  1713 + $rootScope.isLoading = false;
  1714 + $('#spinner').css('visibility', 'hidden');
  1715 +
  1716 +
  1717 + $rootScope.isLoading = true;
  1718 + $('#spinner').css('visibility', 'visible');
  1719 + //$timeout(function () {
  1720 + console.log('inside start of non flipped. $scope.ColoredImageSRC.length= ' + $scope.ColoredImageSRC.length)
  1721 + $rootScope.isHighLight = true;
  1722 + console.log('just before highLightBody call');
  1723 + $scope.highLightBody();
  1724 + console.log('just after highLightBody call');
  1725 + //}, 500);
  1726 + }
  1727 + }
  1728 + }
  1729 +
  1730 + console.log('ColoredImageSRC. pushed and length: ' + $scope.ColoredImageSRC.length);
  1731 + }
  1732 + }
  1733 +
  1734 + if (imgCanvas.id.match('_mci')) {
  1735 + var maskImgData = context.getImageData(0, 0, w, h);
  1736 + $rootScope.MaskCanvasData.push(
  1737 + {
  1738 + "bodyRegionId": bodyRegionId,
  1739 + "canvasId": imgCanvas.id,
  1740 + "maskData": maskImgData,
  1741 +
  1742 + }
  1743 + );
  1744 + }
  1745 +
  1746 + };
  1747 +
  1748 + if (document.getElementById('canvasDiv') != null)
  1749 + document.getElementById('canvasDiv').appendChild(imgCanvas);
  1750 + }
  1751 +
  1752 +
  1753 +
  1754 + $scope.highLightBodyBasedOnIcolor = function (RGBColor) {
  1755 +
  1756 +
  1757 + //2. Find Actul Term No Based on Icolor.
  1758 + var ActualTermNo = $scope.getActualTermNumber(RGBColor);
  1759 +
  1760 + if (ActualTermNo != null) {
  1761 +
  1762 + //3. Find Term No List Based on ActualTermNo
  1763 + var TermList = $scope.getTermNumberList(ActualTermNo);
  1764 + if (TermList != null) {
  1765 +
  1766 + //4.
  1767 + $scope.HighlightBodyByTermList(TermList);
  1768 + }
  1769 + }
  1770 +
  1771 +
  1772 + }
  1773 +
  1774 +
  1775 + $scope.HighlightBodyOnExtract = function () {
  1776 +
  1777 +
  1778 + var multiTermList = [];
  1779 + var CallBackBodyRegion = [];
  1780 +
  1781 + if ($rootScope.isListManagerSelected) {
  1782 +
  1783 + multiTermList = $scope.AllTerms;
  1784 +
  1785 + }
  1786 + else if (($rootScope.previousHighlightList != null || $rootScope.previousHighlightList != undefined) && ($rootScope.previousHighlightList.length > 0)) {
  1787 + angular.forEach($rootScope.previousHighlightList, function (value, key) {
  1788 +
  1789 + var ActualTermNo = $scope.getActualTermNumber(value);
  1790 + if (ActualTermNo != null) {
  1791 + var TermList = $scope.getTermNumberList(ActualTermNo);
  1792 + if (TermList != null) {
  1793 + for (var i = 0; i < TermList.length; i++) {
  1794 + multiTermList.push(TermList[i]);
  1795 + }
  1796 + }
  1797 + }
  1798 +
  1799 + // to do
  1800 + });
  1801 + }
  1802 +
  1803 + //2. Find Actul Term No Based on Icolor.
  1804 + //var ActualTermNo = $scope.getActualTermNumber(RGBColor);
  1805 +
  1806 + ////3. Find Term No List Based on ActualTermNo
  1807 + //var TermList = $scope.getTermNumberList(ActualTermNo);
  1808 +
  1809 +
  1810 + //terminate previous running workers to create space for new workers
  1811 +
  1812 + $scope.terminateCurrentlyRunningWPs();
  1813 +
  1814 + $timeout(function () {
  1815 +
  1816 + var loopLength = 0;
  1817 + if ((($rootScope.viewOrientationId == '1') || ($rootScope.viewOrientationId == '4')) && ($scope.ColoredImageSRC.length == 9)) {
  1818 + loopLength = 9;
  1819 + }
  1820 + else if ((($rootScope.viewOrientationId == '2') || ($rootScope.viewOrientationId == '3')) && ($scope.ColoredImageSRC.length == 5)) {
  1821 + loopLength = 5;
  1822 + }
  1823 + else if (($rootScope.viewOrientationId == '5') && ($scope.ColoredImageSRC.length == 4)) {
  1824 + loopLength = 4;
  1825 + }
  1826 + else if (($rootScope.viewOrientationId == '6') && ($scope.ColoredImageSRC.length == 1)) {
  1827 + loopLength = 1;
  1828 + }
  1829 +
  1830 + if (loopLength !== 0) {
  1831 + for (var x = 0; x < loopLength; x++) {
  1832 + if ($rootScope.MaskCanvasData[x] != null || $rootScope.MaskCanvasData[x] != undefined) {
  1833 + var bodyRegionId = $rootScope.MaskCanvasData[x].bodyRegionId;
  1834 + var canvasId = $rootScope.MaskCanvasData[x].canvasId;
  1835 + var maskData = null;
  1836 + maskData = $rootScope.MaskCanvasData[x].maskData;
  1837 +
  1838 + var coloredImageDataVar = null;
  1839 + var grayImageDataVar = null;
  1840 +
  1841 + var white = null;
  1842 + if (canvasId.match('_MR')) {
  1843 + if ($rootScope.coloredImageMRCanvasList[bodyRegionId] != null || $rootScope.coloredImageMRCanvasList[bodyRegionId] != undefined) {
  1844 +
  1845 + coloredImageDataVar = $rootScope.coloredImageMRCanvasList[bodyRegionId];
  1846 +
  1847 + }
  1848 +
  1849 + if ($rootScope.whiteImageMRDataList[bodyRegionId] != null || $rootScope.whiteImageMRDataList[bodyRegionId] != undefined) {
  1850 + white = $rootScope.whiteImageMRDataList[bodyRegionId];
  1851 + }
  1852 +
  1853 + }
  1854 +
  1855 + else {
  1856 +
  1857 + if ($rootScope.coloredImageCanvasList[bodyRegionId - 1] != null || $rootScope.coloredImageCanvasList[bodyRegionId - 1] != undefined) {
  1858 + coloredImageDataVar = $rootScope.coloredImageCanvasList[bodyRegionId - 1];
  1859 + }
  1860 + if ($rootScope.whiteImageDataList[bodyRegionId - 1] != null || $rootScope.whiteImageDataList[bodyRegionId - 1] != undefined) {
  1861 + white = $rootScope.whiteImageDataList[bodyRegionId - 1];
  1862 +
  1863 + }
  1864 + }
  1865 +
  1866 +
  1867 + var worker = new Worker('extract-wp.js');
  1868 +
  1869 + //push workers in array to further used the refernece to delete the workers
  1870 + $scope.runningWorkers.push({ 'workerName': worker })
  1871 +
  1872 + console.log('for BRID = ' + bodyRegionId + ', coloredImageDataVar: ' + coloredImageDataVar + ', maskData= ' + maskData + ', white= ' + white)
  1873 +
  1874 + if (coloredImageDataVar != null && maskData != null && white != null) {
  1875 + worker.postMessage({
  1876 +
  1877 + 'termList': multiTermList,
  1878 + 'maskCanvasData': maskData,
  1879 + 'coloredImageData': coloredImageDataVar,
  1880 + 'grayImageData': white,
  1881 + 'bodyRegionId': bodyRegionId,
  1882 + 'canvasId': canvasId
  1883 +
  1884 + });
  1885 + }
  1886 +
  1887 + //}
  1888 +
  1889 + worker.onmessage = function (e) {
  1890 + console.log('callback in extract for e.data.bodyRegionId: ' + e.data.bodyRegionId + ', time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"));
  1891 +
  1892 +
  1893 + var updatedData = e.data.value;
  1894 +
  1895 + var bodyRegionId = e.data.bodyRegionId;
  1896 +
  1897 +
  1898 + var canvasId = (e.data.canvasId).replace('_mci', '');
  1899 + //debugger;
  1900 + //for (var i = 1; i <= updatedData.length; i++) {
  1901 + var grayCanvasID = canvasId;
  1902 +
  1903 + // var grayCanvasID = 'imageCanvas' + bodyRegionId;
  1904 + var grayCanvas = document.getElementById(grayCanvasID);
  1905 + var grayCanvasContext = grayCanvas.getContext("2d");
  1906 +
  1907 +
  1908 +
  1909 + grayCanvasContext.putImageData(updatedData, 0, 0);
  1910 +
  1911 +
  1912 + //to resolve lateral arm black issue in highlight mode
  1913 +
  1914 + if ($rootScope.viewOrientationId == 5 && (bodyRegionId == 6 || bodyRegionId == 4)) {
  1915 +
  1916 + var canavsWidth = parseInt(grayCanvas.width);
  1917 + var canavsHeight = parseInt(grayCanvas.height);
  1918 +
  1919 + console.log('canavsWidth= ' + canavsWidth + ', canavsHeight= ' + canavsHeight)
  1920 +
  1921 + var imgData = grayCanvasContext.getImageData(0, 0, canavsWidth, canavsHeight);
  1922 + var data = imgData.data;
  1923 + var c = 0;
  1924 + for (var i = 0; i < data.length; i += 4) {
  1925 + if (data[i] == data[i + 1] && data[i + 1] == data[i + 2] && data[i + 2] === 0) {
  1926 + data[i + 3] = 0;
  1927 + }
  1928 +
  1929 + }
  1930 + grayCanvasContext.putImageData(imgData, 0, 0);
  1931 + }
  1932 +
  1933 +
  1934 + if ($rootScope.multiAnnotationIsON == true) {
  1935 + //debugger;
  1936 + if (canvasId.match('_MR'))
  1937 + $rootScope.updatedWhiteImageMRDataList[bodyRegionId] = updatedData;
  1938 + else
  1939 + $rootScope.updatedWhiteImageDataList[bodyRegionId - 1] = updatedData;
  1940 +
  1941 +
  1942 + }
  1943 + else {
  1944 +
  1945 + if (canvasId.match('_MR'))
  1946 + $rootScope.whiteImageMRDataList[bodyRegionId] = e.data.value;
  1947 + else {
  1948 + if ($rootScope.whiteImageDataList[bodyRegionId - 1] != null || $rootScope.whiteImageDataList[bodyRegionId - 1] != undefined)
  1949 + $rootScope.whiteImageDataList[bodyRegionId - 1] = e.data.value;
  1950 + }
  1951 + }
  1952 +
  1953 + //if ((CallBackBodyRegion != null || CallBackBodyRegion[i] != undefined) && (CallBackBodyRegion.length > 0)) {
  1954 + // if (CallBackBodyRegion.length == 6) {
  1955 + // $rootScope.isLoading = false;
  1956 + // $('#spinner').css('visibility', 'hidden');
  1957 + // }
  1958 + //}
  1959 +
  1960 +
  1961 + $timeout(function () { $scope.DisableProgressBar() }, 1000);
  1962 +
  1963 + };
  1964 + worker.onerror = function (e) {
  1965 + alert('Error: Line ' + e.lineno + ' in ' + e.filename + ': ' + e.message);
  1966 + };
  1967 + }
  1968 + }
  1969 + }
  1970 + }, 500)
  1971 +
  1972 + }
  1973 +
  1974 + $scope.HighlightBodyByTermList = function (TermList) {
  1975 +
  1976 + //if (($rootScope.updatedGrayMRDataList != null || $rootScope.updatedGrayMRDataList != undefined) && $rootScope.updatedGrayMRDataList.length > 0) {
  1977 + // $rootScope.updatedGrayMRDataList = null;
  1978 + // $rootScope.updatedGrayMRDataList = [];
  1979 + //}
  1980 + //if (($rootScope.updatedGrayDataList != null || $rootScope.updatedGrayDataList != undefined) && $rootScope.updatedGrayDataList.length > 0) {
  1981 + // $rootScope.updatedGrayDataList = null;
  1982 + // $rootScope.updatedGrayDataList = [];
  1983 + //}
  1984 +
  1985 + if ($rootScope.isHighLight == true) {
  1986 + false;
  1987 + }
  1988 +
  1989 + console.log('HighlightBodyByTermList is called');
  1990 +
  1991 + // $scope.highlightedBR = null;
  1992 + $scope.highlightedBR = [];
  1993 +
  1994 + $scope.terminateCurrentlyRunningWPs();
  1995 +
  1996 +
  1997 +
  1998 + $timeout(function () {
  1999 + var loopLength = 0;
  2000 + if ((($rootScope.viewOrientationId == '1') || ($rootScope.viewOrientationId == '4')) && ($scope.ColoredImageSRC.length == 9)) {
  2001 + loopLength = 9;
  2002 + }
  2003 + else if ((($rootScope.viewOrientationId == '2') || ($rootScope.viewOrientationId == '3')) && ($scope.ColoredImageSRC.length == 5)) {
  2004 + loopLength = 5;
  2005 + }
  2006 + else if (($rootScope.viewOrientationId == '5') && ($scope.ColoredImageSRC.length == 4)) {
  2007 + loopLength = 4;
  2008 + }
  2009 + else if (($rootScope.viewOrientationId == '6') && ($scope.ColoredImageSRC.length == 1)) {
  2010 + loopLength = 1;
  2011 + }
  2012 +
  2013 + for (var x = 0; x < loopLength; x++) {
  2014 + if ($rootScope.MaskCanvasData[x] != null || $rootScope.MaskCanvasData[x] != undefined) {
  2015 +
  2016 + var bodyRegionId = $rootScope.MaskCanvasData[x].bodyRegionId;
  2017 + var canvasId = $rootScope.MaskCanvasData[x].canvasId;
  2018 + var maskData = null;
  2019 + maskData = $rootScope.MaskCanvasData[x].maskData;
  2020 +
  2021 + var coloredImageDataVar = null;
  2022 + var grayImageDataVar = null;
  2023 +
  2024 + var white;
  2025 + if (canvasId.match('_MR')) {
  2026 + if ($rootScope.coloredImageMRCanvasList[bodyRegionId] != null || $rootScope.coloredImageMRCanvasList[bodyRegionId] != undefined) {
  2027 + coloredImageDataVar = $rootScope.coloredImageMRCanvasList[bodyRegionId];
  2028 + }
  2029 +
  2030 +
  2031 + if ($rootScope.multiAnnotationIsON == true) {
  2032 + //on layer change we need the fresh data not the updated one
  2033 + if ($scope.isLayerChange == true) {
  2034 + if ($rootScope.grayImageMRDataList[bodyRegionId] != null || $rootScope.grayImageMRDataList[bodyRegionId] != undefined) {
  2035 + grayImageDataVar = $rootScope.grayImageMRDataList[bodyRegionId];
  2036 + }
  2037 + }
  2038 + else {
  2039 + if ($rootScope.updatedGrayDataList[bodyRegionId - 1] == null || $rootScope.updatedGrayDataList[bodyRegionId - 1] == undefined) {
  2040 +
  2041 + if ($rootScope.grayImageMRDataList[bodyRegionId] != null || $rootScope.grayImageMRDataList[bodyRegionId] != undefined) {
  2042 + grayImageDataVar = $rootScope.grayImageMRDataList[bodyRegionId];
  2043 + }
  2044 + }
  2045 + else {
  2046 + if ($rootScope.updatedGrayMRDataList[bodyRegionId] != null || $rootScope.updatedGrayMRDataList[bodyRegionId] != undefined) {
  2047 + grayImageDataVar = $rootScope.updatedGrayMRDataList[bodyRegionId]
  2048 + }
  2049 + }
  2050 + }
  2051 + }
  2052 + else {
  2053 + if ($rootScope.grayImageMRDataList[bodyRegionId] != null || $rootScope.grayImageMRDataList[bodyRegionId] != undefined) {
  2054 + grayImageDataVar = $rootScope.grayImageMRDataList[bodyRegionId];
  2055 + }
  2056 + }
  2057 +
  2058 +
  2059 + }
  2060 +
  2061 + else {
  2062 +
  2063 + if ($rootScope.coloredImageCanvasList[bodyRegionId - 1] != null || $rootScope.coloredImageCanvasList[bodyRegionId - 1] != undefined) {
  2064 + coloredImageDataVar = $rootScope.coloredImageCanvasList[bodyRegionId - 1];
  2065 + }
  2066 +
  2067 +
  2068 +
  2069 + if ($rootScope.multiAnnotationIsON == true) {
  2070 +
  2071 + //on layer change we need the fresh data not the updated one
  2072 + if ($scope.isLayerChange == true) {
  2073 + if ($rootScope.grayImageDataList[bodyRegionId - 1] != null || $rootScope.grayImageDataList[bodyRegionId - 1] != undefined) {
  2074 + grayImageDataVar = $rootScope.grayImageDataList[bodyRegionId - 1];
  2075 +
  2076 + }
  2077 +
  2078 + } else {
  2079 + // this code is for the case where user first click on normal mode then extract then again highlight then we need to call highlight body in gray mode
  2080 + //and then highlight the previously selected body regions at the time of normal mode.
  2081 + if ($rootScope.updatedGrayDataList[bodyRegionId - 1] == null || $rootScope.updatedGrayDataList[bodyRegionId - 1] == undefined) {
  2082 +
  2083 + if ($rootScope.grayImageDataList[bodyRegionId - 1] != null || $rootScope.grayImageDataList[bodyRegionId - 1] != undefined) {
  2084 + grayImageDataVar = $rootScope.grayImageDataList[bodyRegionId - 1];
  2085 + }
  2086 +
  2087 + }
  2088 + else {
  2089 + if ($rootScope.updatedGrayDataList[bodyRegionId - 1] != null || $rootScope.updatedGrayDataList[bodyRegionId - 1] != undefined) {
  2090 + // for normal case means without interdepency button case.
  2091 + grayImageDataVar = $rootScope.updatedGrayDataList[bodyRegionId - 1];
  2092 + }
  2093 + }
  2094 + }
  2095 + }
  2096 + else
  2097 + if ($rootScope.grayImageDataList[bodyRegionId - 1] != null || $rootScope.grayImageDataList[bodyRegionId - 1] != undefined) {
  2098 + grayImageDataVar = $rootScope.grayImageDataList[bodyRegionId - 1];
  2099 + }
  2100 +
  2101 +
  2102 + }
  2103 +
  2104 + var worker = new Worker('term-number-wp.js');
  2105 +
  2106 + //push workers in array to further used the refernece to delete the workers
  2107 + $scope.runningWorkers.push({ 'workerName': worker })
  2108 +
  2109 + // console.log('for bodyRegionId = ' + bodyRegionId+ ', time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"))
  2110 + console.log('before worker call BRID: ' + bodyRegionId)
  2111 +
  2112 + if (grayImageDataVar != null && coloredImageDataVar != null && maskData != null) {
  2113 + worker.postMessage({
  2114 +
  2115 + 'termList': TermList,
  2116 + 'maskCanvasData': maskData,
  2117 + 'coloredImageData': coloredImageDataVar,
  2118 + 'grayImageData': grayImageDataVar,
  2119 + 'bodyRegionId': bodyRegionId,
  2120 + 'canvasId': canvasId
  2121 +
  2122 + });
  2123 + }
  2124 +
  2125 +
  2126 +
  2127 + worker.onmessage = function (e) {
  2128 + console.log('callback for e.data.bodyRegionId: ' + e.data.bodyRegionId + ', time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"));
  2129 +
  2130 + var updatedData = e.data.value;
  2131 +
  2132 + var bodyRegionId = e.data.bodyRegionId;
  2133 + var canvasId = (e.data.canvasId).replace('_mci', '');
  2134 + //debugger;
  2135 + //for (var i = 1; i <= updatedData.length; i++) {
  2136 + var grayCanvasID = canvasId;
  2137 +
  2138 + //to do
  2139 + var grayCanvas = document.getElementById(grayCanvasID);
  2140 + if (grayCanvas != null) {
  2141 + var grayCanvasContext = grayCanvas.getContext("2d");
  2142 +
  2143 + //Niki remove previous data from canvas
  2144 + var canvasHeight = grayCanvas.height + 'px';
  2145 + var canvasWidth = grayCanvas.width + 'px';
  2146 + //alert('height= ' + canvasHeight + ', width= ' + canvasWidth)
  2147 + grayCanvasContext.clearRect(0, 0, canvasHeight, canvasWidth)
  2148 +
  2149 + grayCanvasContext.putImageData(updatedData, 0, 0);
  2150 + $scope.highlightedBR.push({ 'bodyRegionId': bodyRegionId });
  2151 +
  2152 + }
  2153 +
  2154 + //debugger;
  2155 +
  2156 + if (canvasId.match('_MR')) {
  2157 + $rootScope.updatedGrayMRDataList[bodyRegionId] = updatedData;
  2158 +
  2159 + //alert('HighlightBodyByTermList, is mutiAnnotation on= ' + $rootScope.multiAnnotationIsON);
  2160 +
  2161 + //$rootScope.updatedWhiteImageMRDataList[bodyRegionId] = updatedData;
  2162 + }
  2163 + else
  2164 + $rootScope.updatedGrayDataList[bodyRegionId - 1] = updatedData;
  2165 +
  2166 + //$scope.highlightedBR.push({ 'bodyRegionId': bodyRegionId });
  2167 +
  2168 + console.log('$scope.highlightedBR.length= ' + $scope.highlightedBR.length)
  2169 +
  2170 + if ($scope.highlightedBR != null || $scope.highlightedBR != undefined) {
  2171 +
  2172 + if ((($rootScope.viewOrientationId == '1') || ($rootScope.viewOrientationId == '4')) && ($scope.highlightedBR.length == 9)) {
  2173 + $scope.doAligneCanvasWithTerm = true;
  2174 + }
  2175 + else if ((($rootScope.viewOrientationId == '2') || ($rootScope.viewOrientationId == '3')) && ($scope.highlightedBR.length == 5)) {
  2176 + $scope.doAligneCanvasWithTerm = true;
  2177 + }
  2178 + else if ((($rootScope.viewOrientationId == '5')) && ($scope.highlightedBR.length == 4)) {
  2179 + $scope.doAligneCanvasWithTerm = true;
  2180 + }
  2181 + else if ((($rootScope.viewOrientationId == '6')) && ($scope.highlightedBR.length == 1)) {
  2182 + $scope.doAligneCanvasWithTerm = true;
  2183 + }
  2184 +
  2185 + if ($scope.doAligneCanvasWithTerm == true) {
  2186 + //debugger;
  2187 + if ($scope.isHighlightBodyByBodySystem == true || $rootScope.isListManagerSelected == true)
  2188 +
  2189 + $rootScope.isLoading = false;
  2190 +
  2191 + $('#spinner').css('visibility', 'hidden');
  2192 +
  2193 + $scope.isHighlightBodyByBodySystem = false;
  2194 +
  2195 + if ($rootScope.isListManagerSelected == true)
  2196 + $scope.aligneCanvasWithTerm();
  2197 + }
  2198 + }
  2199 + //
  2200 +
  2201 + };
  2202 + worker.onerror = function (e) {
  2203 + alert('Error: Line ' + e.lineno + ' in ' + e.filename + ': ' + e.message);
  2204 + };
  2205 + }
  2206 + }
  2207 + }, 100)
  2208 + }
  2209 +
  2210 +
  2211 +
  2212 + $scope.createTermListByPreviousTermsAndHighlight = function () {
  2213 +
  2214 +
  2215 + var multiTermList = [];
  2216 + angular.forEach($rootScope.previousHighlightList, function (value, key) {
  2217 +
  2218 + //debugger;
  2219 +
  2220 + var ActualTermNo = $scope.getActualTermNumber(value);
  2221 + if (ActualTermNo != null) {
  2222 + var TermList = $scope.getTermNumberList(ActualTermNo);
  2223 + if (TermList != null) {
  2224 + for (var i = 0; i < TermList.length; i++) {
  2225 +
  2226 + multiTermList.push(TermList[i]);
  2227 + }
  2228 + }
  2229 + }
  2230 +
  2231 + });
  2232 +
  2233 + console.log('createTermListByPreviousTermsAndHighlight is called');
  2234 +
  2235 + if ((multiTermList != undefined || multiTermList != null) && multiTermList.length > 0) {
  2236 +
  2237 + $timeout(function () { $scope.HighlightBodyByTermList(multiTermList); }, 50);
  2238 + }
  2239 + }
  2240 +
  2241 +
  2242 + $scope.GetRGBColor = function (maskCanvasContext, actulalX, actualY, x, y) {
  2243 + var pixelData = maskCanvasContext.getImageData(Math.round(actulalX - x), Math.round(actualY - y), 1, 1);
  2244 +
  2245 + pixelData.data[0] = pixelData.data[0] - 9;
  2246 + pixelData.data[1] = pixelData.data[1] - 9;
  2247 + pixelData.data[2] = pixelData.data[2] - 9;
  2248 + var Red;
  2249 + var Green;
  2250 + var Blue;
  2251 + var zero = "0";
  2252 +
  2253 + if ((pixelData.data[0]).toString().length != 2) {
  2254 + Red = zero.concat((pixelData.data[0]).toString())
  2255 + }
  2256 + else {
  2257 + Red = (pixelData.data[0]).toString()
  2258 + }
  2259 + if ((pixelData.data[1]).toString().length != 2) {
  2260 + Green = zero.concat((pixelData.data[1]).toString())
  2261 + }
  2262 + else {
  2263 + Green = (pixelData.data[1]).toString()
  2264 +
  2265 + }
  2266 + if ((pixelData.data[2]).toString().length != 2) {
  2267 + Blue = zero.concat((pixelData.data[2]).toString())
  2268 + }
  2269 + else {
  2270 + Blue = (pixelData.data[2]).toString()
  2271 +
  2272 + }
  2273 + var RGBColor = (Red + Green + Blue);
  2274 + return RGBColor;
  2275 + }
  2276 +
  2277 +
  2278 + //get annotation from term number
  2279 + $scope.GetAnnotationText = function (termNumber) {
  2280 + //debugger;
  2281 +
  2282 + var annotationText;
  2283 + //0
  2284 + var figLeafTermNo = 5868; // to do declare constant for this
  2285 +
  2286 + if (parseInt(termNumber) != parseInt(figLeafTermNo)) {
  2287 + $scope.TermNumber = termNumber;
  2288 + if ($rootScope.TermNumberData != null || $rootScope.TermNumberData != undefined) {
  2289 + $scope.matchedTermNoData = new jinqJs()
  2290 + .from($rootScope.TermNumberData.TermData.Term)
  2291 + .where('_TermNumber == ' + termNumber)
  2292 + .select();
  2293 +
  2294 + if ($scope.matchedTermNoData != null || $scope.matchedTermNoData != undefined) {
  2295 + //1.
  2296 + var actualTermNo = 0;
  2297 + for (var z = 0; z < $scope.matchedTermNoData.length; z++) {
  2298 + //send actual term no to get the term text.
  2299 + actualTermNo = $scope.matchedTermNoData[0]._ActualTermNumber;
  2300 + annotationText = $scope.GetAnnotationBasedOnActualTermNo(actualTermNo);
  2301 + break;
  2302 + };
  2303 +
  2304 + //2.
  2305 +
  2306 + }
  2307 + else {
  2308 + // send term no to vocab json data to get the text
  2309 + }
  2310 + }
  2311 + }
  2312 + return annotationText;
  2313 + }
  2314 +
  2315 + $scope.GetAnnotationBasedOnActualTermNo = function (actualTermNo) {
  2316 + // debugger;
  2317 +
  2318 + var Annotation;
  2319 + $scope.ActualTermNo = actualTermNo;
  2320 + if ($rootScope.VocabTermData != null || $rootScope.VocabTermData != undefined) {
  2321 + $scope.matchedActualTermData = new jinqJs()
  2322 + .from($rootScope.VocabTermData.VocabTerms.Term)
  2323 + .where('_ActualTermNumber == ' + actualTermNo)
  2324 + .select();
  2325 +
  2326 + if ($scope.matchedActualTermData != null || $scope.matchedActualTermData != undefined) {
  2327 + for (var z = 0; z <= $scope.matchedActualTermData.length; z++) {
  2328 + //send actual term no to get the term text.
  2329 + Annotation = $scope.matchedActualTermData[0]._TermText;
  2330 + // alert("Annotation : " + Annotation);
  2331 + break;
  2332 + };
  2333 + }
  2334 + return Annotation;
  2335 + }
  2336 + else {
  2337 + return null;
  2338 + }
  2339 + }
  2340 +
  2341 +
  2342 + //layer change function
  2343 + $scope.LayerChange = function () {
  2344 +
  2345 +
  2346 + //if listanager is visisble then close it
  2347 + $rootScope.isListManagerSelected = false;
  2348 +
  2349 + $rootScope.CloseListManager();
  2350 +
  2351 +
  2352 +
  2353 + $scope.isLayerChange = true;
  2354 + $rootScope.isLoading = true;
  2355 + $('#spinner').css('visibility', 'visible');
  2356 +
  2357 + //1.
  2358 + $scope.terminateCurrentlyRunningWPs();
  2359 +
  2360 + var canvasDiv = document.getElementById('canvasDiv');
  2361 + $scope.imageVerticalScrollPosition = canvasDiv.scrollTop;
  2362 + $scope.imageHorizontlScrollPosition = canvasDiv.scrollLeft;
  2363 +
  2364 + // debugger;
  2365 + // $('#daLoaderLabel').css('visibility', 'visible');
  2366 +
  2367 +
  2368 +
  2369 + if ($scope.isTransparencyActivated) {
  2370 +
  2371 + //crete temp canavs to store the original data which will be used to chnange the transparency
  2372 + if (document.getElementById('tempCanvas') != null) {
  2373 + $('#tempCanvas').remove();
  2374 + }
  2375 +
  2376 + if ($('#speechBubbleTrns').length > 0) {
  2377 + $('#speechBubbleTrns').remove();
  2378 + }
  2379 + var tempCanvas = document.createElement('canvas');
  2380 + tempCanvas.id = 'tempCanvas';
  2381 + $scope.tempCanvas = tempCanvas.id;
  2382 + tempCanvas.height = $scope.transparencyCanvasHeight;
  2383 + tempCanvas.width = $scope.transparencyCanvasWidth;
  2384 + tempCanvas.style.position = "absolute";
  2385 + tempCanvas.style.left = 200 + 'px';
  2386 + tempCanvas.style.backgroundColor = "transparent";
  2387 + tempCanvas.style.visibility = 'hidden';
  2388 +
  2389 + if (document.getElementById('canvasDiv') != null)
  2390 + document.getElementById('canvasDiv').appendChild(tempCanvas);
  2391 +
  2392 + // //debugger;
  2393 +
  2394 + var tCanvas = document.getElementById('transparencyCanvas');
  2395 + var tCanvasContext = tCanvas.getContext('2d');
  2396 +
  2397 + var tCanvasHeight = parseInt((tCanvas.style.height).replace('px', ''));
  2398 +
  2399 + var tCanvasWidth = parseInt((tCanvas.style.width).replace('px', ''));
  2400 +
  2401 +
  2402 + // var tCanvas = document.getElementById('transparencyCanvas');
  2403 + if (tCanvas != null) {
  2404 + clearTransCanvas();
  2405 + }
  2406 + var TransparencyBoxStartX = parseInt((tCanvas.style.left).replace('px', ''));
  2407 + var TransparencyEndX = parseInt((tCanvas.style.left).replace('px', '')) + parseInt((tCanvas.style.width.replace('px', '')));
  2408 + var TransparencyBoxStartY = parseInt((tCanvas.style.top).replace('px', ''));
  2409 + var TransparencyBoxEndY = parseInt((tCanvas.style.top).replace('px', '')) + parseInt((tCanvas.style.height).replace('px', ''));
  2410 + var transparencyBoxBottom = parseInt(TransparencyBoxStartY) + parseInt(tCanvasHeight);
  2411 + var transparencyBoxRight = parseInt(TransparencyBoxStartX) + parseInt(tCanvasWidth);
  2412 +
  2413 + var BodyRegionDictionary = $rootScope.BodyRegionCordinatesData;
  2414 +
  2415 + $.each(BodyRegionDictionary, function (index, value) {
  2416 + //debugger;
  2417 + // alert(' $.each(BodyRegionDictionary1')
  2418 +
  2419 + var bodyRegionRight = parseInt(value.X) + parseInt(value.Width);
  2420 + var bodyRegionBottom = parseInt(value.Y) + parseInt(value.Height);
  2421 +
  2422 +
  2423 + // alert(' $.each(BodyRegionDictionary3. bodyRegionRight: ' + bodyRegionRight + ', bodyRegionBottom: ' + bodyRegionBottom)
  2424 + if (TransparencyBoxStartX <= bodyRegionRight && value.X <= transparencyBoxRight && TransparencyBoxStartY <= bodyRegionBottom && value.Y <= transparencyBoxBottom) {
  2425 + //var transNumber = parseInt(document.getElementById("txtTransparencyChange").value);
  2426 + // debugger;
  2427 + $scope.layerNumber = parseInt(txtlayerNumber.value);
  2428 +
  2429 +
  2430 + $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, TransparencyBoxStartX, transparencyBoxRight, TransparencyBoxStartY, transparencyBoxBottom, $scope, true, false);
  2431 + }
  2432 +
  2433 +
  2434 + })
  2435 + }
  2436 +
  2437 + else {
  2438 + //1. Dated:13-07-2016 Issue #4965 : The layer number should not extend beyond its level through layer text box.
  2439 + var dataLength = $rootScope.BodyLayerData.Layers.DataLayer.length;
  2440 + if (parseInt($('#txtlayerNumber').val()) > (dataLength - 1)) {
  2441 + $('#txtlayerNumber').val(dataLength - 1);
  2442 + $scope.currentLayerNumber = parseInt(dataLength - 1);
  2443 + $scope.layerNumber = parseInt(dataLength - 1);
  2444 + }
  2445 + else
  2446 + $scope.currentLayerNumber = parseInt($('#txtlayerNumber').val());
  2447 +
  2448 + $rootScope.isLoading = true;
  2449 + $('#spinner').css('visibility', 'visible');
  2450 + var canDiv = document.getElementById('canvasDiv');
  2451 + var canDivChildCount = canDiv.childElementCount;
  2452 + if (canDivChildCount > 0) {
  2453 + canDiv.innerHTML = '';
  2454 + }
  2455 +
  2456 + //2.
  2457 + $scope.CalculateImageCordinates($rootScope.viewOrientationId);
  2458 +
  2459 + //3.
  2460 + $('#canvasDiv').scrollLeft($scope.imageHorizontlScrollPosition)
  2461 + $('#canvasDiv').scrollTop($scope.imageVerticalScrollPosition)
  2462 +
  2463 + if ($scope.isHighlightBodyByBodySystem) {
  2464 + $timeout(function () { $scope.DisableProgressBar() }, 20000);
  2465 + }
  2466 + else
  2467 + {
  2468 + $timeout(function () { $scope.DisableProgressBar() }, 2000);
  2469 + }
  2470 + }
  2471 +
  2472 + $('#layerChangeSlider').slider("option", "value", parseInt($scope.totalLayers) - parseInt($scope.layerNumber));
  2473 + }
  2474 +
  2475 + $scope.DisableProgressBar = function () {
  2476 +
  2477 + // alert('Disabled wait cursor is called');
  2478 +
  2479 +
  2480 + if ($rootScope.isHighLight) {
  2481 + //alert('isHighlight: ' + $scope.isHighLight);
  2482 +
  2483 + //$('#btnHighLight').removeClass('btn btn-black');
  2484 + //$('#btnHighLight').addClass('btn-primary');
  2485 +
  2486 + $("#btnHighLight").addClass("btn-primary");
  2487 + $("#btnHighLight").removeClass("btn-black");
  2488 +
  2489 + if (!$("#btnNormalMode").hasClass("btn-black")) {
  2490 + $("#btnNormalMode").addClass("btn-black");
  2491 + }
  2492 +
  2493 + if (!$("#btnExtract").hasClass("btn-black")) {
  2494 + $("#btnExtract").addClass("btn-black");
  2495 + }
  2496 +
  2497 + if ($("#btnExtract").hasClass("btn-primary")) {
  2498 + $("#btnExtract").removeClass("btn-primary");
  2499 + }
  2500 +
  2501 +
  2502 + if ($("#btnNormalMode").hasClass("btn-primary")) {
  2503 + $("#btnNormalMode").removeClass("btn-primary");
  2504 + }
  2505 +
  2506 + console.log('highLightBody call from DisableProgressBar')
  2507 + // $scope.highLightBody();
  2508 +
  2509 +
  2510 +
  2511 + }
  2512 +
  2513 + $rootScope.isLoading = false;
  2514 + $('#spinner').css('visibility', 'hidden');
  2515 +
  2516 + //alert('Disabled wait cursor is done.See val :' + $rootScope.isLoading);
  2517 + }
  2518 +
  2519 +
  2520 + $scope.changeLayer = function () {
  2521 + //console.log('changeLayer');
  2522 + // alert('slide')
  2523 + }
  2524 +
  2525 + $('layerChangeSlider').slider().on('slideStop', function (ev) {
  2526 +
  2527 + var newVal = $('.span2').data('slider').getValue();
  2528 + if (originalVal != newVal) {
  2529 +
  2530 + }
  2531 + });
  2532 +
  2533 +
  2534 + $scope.getMousePos = function (evt) {
  2535 +
  2536 + return {
  2537 + x: Math.round(evt.pageX - $('#canvasDiv').offset().left),
  2538 + y: Math.round(evt.pageY - $('#canvasDiv').offset().top)
  2539 + }
  2540 + }
  2541 +
  2542 +
  2543 +
  2544 + $scope.createDynamicSpeechBubble = function (event, x, y, isAnnotationForTBox) {
  2545 +
  2546 + if (isAnnotationForTBox == true) {
  2547 + //1. In transparency box we shows two annotation at a time, so we need to decide the max length of annotation in btween two annotation because based on that
  2548 + // we decide the size of speech bubble
  2549 + $scope.longestAnnotation = $scope.MultiLanguageAnnationArray.reduce(function (firstAnnotation, seconAnnotation) { return firstAnnotation.length > seconAnnotation.length ? firstAnnotation : seconAnnotation; });
  2550 +
  2551 + //2.
  2552 + if (event.ctrlKey) {
  2553 +
  2554 + console.log('ctrl pressed');
  2555 +
  2556 + $scope.multiAnnotationIsON = true;
  2557 +
  2558 + //2.1 create unique speech bubbles
  2559 + $scope.speechBubbleCounter = $scope.speechBubbleCounter + 1;
  2560 + var id = "speechBubble" + $scope.speechBubbleCounter;
  2561 +
  2562 + //2.2 Get clicked locationa and find if it is already clicked earlier too on same location
  2563 + var pointClicked = parseInt(x) + parseInt(y);
  2564 +
  2565 + var isClickedOnSamePoint = $("#canvasDiv").find("div[id=" + pointClicked + "]").length;
  2566 +
  2567 + console.log('isClickedOnSamePoint: ' + isClickedOnSamePoint);
  2568 +
  2569 + // if user has not clciked on smae point then create speech bubble otherwise not
  2570 + if (isClickedOnSamePoint == 0) {
  2571 + console.log('not clicked on same point')
  2572 + $scope.createSpeechBubbleBasedOnAnnotationLength(pointClicked, x, y, id);
  2573 +
  2574 + $scope.speechbubbleList.push({ xaxis: x, yaxis: y, ids: id });
  2575 +
  2576 + }
  2577 +
  2578 +
  2579 + $('.appendDragg').draggable({
  2580 + drag: function (evt) {
  2581 + $(this).prev('div').css("display", "none");
  2582 + var bor_id = $(this).next('div').attr('id');
  2583 + var sub_id1 = $(this).attr('id');
  2584 + var verticalScrollPosition = canvasDiv.scrollTop;
  2585 + var horizontlScrollPosition = canvasDiv.scrollLeft;
  2586 +
  2587 + if ($scope.speechbubbleList != null || $scope.speechbubbleList != undefined) {
  2588 + for (var m = 0; m <= $scope.speechbubbleList.length - 1; m++) {
  2589 + if ($scope.speechbubbleList[m].ids == sub_id1) {
  2590 +
  2591 + $scope.angle1($scope.speechbubbleList[m].xaxis, $scope.speechbubbleList[m].yaxis, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, bor_id);
  2592 + break;
  2593 +
  2594 + }
  2595 + }
  2596 + }
  2597 +
  2598 + },
  2599 + });
  2600 +
  2601 +
  2602 +
  2603 + $('.dynCross').on('click', function (evt) {
  2604 + $(this).parent().parent().parent().css('display', 'none');
  2605 +
  2606 + });
  2607 +
  2608 + }
  2609 +
  2610 +
  2611 + else {
  2612 + $scope.multiAnnotationIsON = false;
  2613 +
  2614 + $(".com").css("display", "none");
  2615 + $("#bord").css({ "width": "0px", "display": "none" });
  2616 + var sppechBubbleDotHTML = '<div id="dot" style="position:absolute;height:15px;width:35px;display:none;z-index:10000;border-top:2px solid #000;transform:rotate(40deg);-moz-transform:rotate(40deg);-o-transform:rotate(40deg);-ms-transform:rotate(40deg);-webkit-transform:rotate(40deg);"></div>'
  2617 + + '<div id="sppeachBubble" style="height:auto!important;z-index:10000;margin-left:25px;border:1px solid #000;display:none;padding:5px 10px;position:absolute;color:#000;text-align:left;font-size:12px;background-color:#fff;font-weight:bold;">'
  2618 + + '<span style="position:absolute;right:-4px;top:-4px;color:#ffffff;cursor:pointer;">'
  2619 + + '<img class="crossDiv_temp" src=' + $rootScope.path + '></span></div>'
  2620 +
  2621 + + '<div style="position:absolute;border:1px solid #000;display:none;z-index:9000;" id="bord">'
  2622 + + '</div>';
  2623 + $('#canvasDiv').append(sppechBubbleDotHTML);
  2624 +
  2625 + if ($scope.MultiLanguageAnnationArray.length > 0) {
  2626 + for (var i = 0; i <= $scope.MultiLanguageAnnationArray.length - 1; i++) {
  2627 + var MultipleLanguage = $scope.MultiLanguageAnnationArray[i];
  2628 + $("#sppeachBubble").append("<p style='margin-bottom:2px;'>" + MultipleLanguage + "</p>");
  2629 + }
  2630 + }
  2631 + else {
  2632 + console.log('MultiLanguageAnnationArray.length is :' + $scope.MultiLanguageAnnationArray.length)
  2633 + }
  2634 + if ($scope.longestAnnotation != null || $scope.longestAnnotation != undefined) {
  2635 + if ($scope.longestAnnotation.length <= 10) {
  2636 +
  2637 +
  2638 + $("#sppeachBubble").css("width", "100px");
  2639 +
  2640 + }
  2641 +
  2642 + else if ($scope.longestAnnotation.length > 10 && $scope.longestAnnotation.length <= 17) {
  2643 +
  2644 +
  2645 +
  2646 + $("#sppeachBubble").css("width", "140px");
  2647 +
  2648 + }
  2649 + else if ($scope.longestAnnotation.length > 17 && $scope.longestAnnotation.length <= 26) {
  2650 +
  2651 +
  2652 + $("#sppeachBubble").css("width", "195px");
  2653 +
  2654 + }
  2655 + else if ($scope.longestAnnotation.length > 26 && $scope.longestAnnotation.length <= 34) {
  2656 +
  2657 + $("#sppeachBubble").css("width", "248px");
  2658 +
  2659 + }
  2660 + else if ($scope.longestAnnotation.length > 34 && $scope.longestAnnotation.length <= 44) {
  2661 +
  2662 +
  2663 + $("#sppeachBubble").css("width", "300px");
  2664 + }
  2665 +
  2666 + else if ($scope.longestAnnotation.length > 44 && $scope.longestAnnotation.length <= 54) {
  2667 +
  2668 + $("#sppeachBubble").css("width", "370px");
  2669 +
  2670 + }
  2671 +
  2672 + else if ($scope.longestAnnotation.length > 54 && $scope.longestAnnotation.length <= 69) {
  2673 +
  2674 +
  2675 + $("#sppeachBubble").css("width", "450px");
  2676 +
  2677 + }
  2678 +
  2679 + else if ($scope.longestAnnotation.length > 69 && $scope.longestAnnotation.length <= 75) {
  2680 +
  2681 +
  2682 + $("#sppeachBubble").css("width", "510px");
  2683 +
  2684 + }
  2685 +
  2686 + else {
  2687 +
  2688 +
  2689 + $("#sppeachBubble").css("width", ($scope.longestAnnotation.length) + "%");
  2690 +
  2691 +
  2692 + }
  2693 +
  2694 + }
  2695 + var Globe = [];
  2696 + Globe.push({ currentX: x, currentY: y });
  2697 +
  2698 + document.getElementById('dot').style.display = 'block';
  2699 + document.getElementById('dot').style.left = ((Globe[0].currentX) - 10) + 'px';
  2700 + document.getElementById('dot').style.top = ((Globe[0].currentY) + 10) + 'px';
  2701 + document.getElementById('sppeachBubble').style.display = 'block';
  2702 + document.getElementById('sppeachBubble').style.left = (Globe[0].currentX) + 'px';
  2703 + document.getElementById('sppeachBubble').style.top = (Globe[0].currentY) + 'px';
  2704 +
  2705 + $('#sppeachBubble').draggable(
  2706 + {
  2707 + drag: function (evt) {
  2708 +
  2709 + $("#dot").css("display", "none");
  2710 + var verticalScrollPosition = canvasDiv.scrollTop;
  2711 + var horizontlScrollPosition = canvasDiv.scrollLeft;
  2712 + $scope.angle(x, y, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, true);
  2713 +
  2714 +
  2715 + },
  2716 + });
  2717 +
  2718 +
  2719 + $('.crossDiv_temp').on('click', function (evt) {
  2720 + $('#sppeachBubble').css('display', 'none');
  2721 +
  2722 + $("#bord").css("display", "none");
  2723 + $("#dot").css("display", "none");
  2724 +
  2725 +
  2726 + });
  2727 +
  2728 + }
  2729 + }
  2730 +
  2731 + else {
  2732 +
  2733 + // alert("false");
  2734 + $scope.longest_annotationT1 = $scope.annotationTextArrayT1.reduce(function (a, b) { return a.length > b.length ? a : b; });
  2735 + $scope.longest_annotationT2 = $scope.annotationTextArrayT2.reduce(function (a, b) { return a.length > b.length ? a : b; });
  2736 +
  2737 + if (event.ctrlKey) {
  2738 +
  2739 + // $scope.multiAnnotationIsON = true;
  2740 +
  2741 + $scope.j = $scope.j + 1;
  2742 +
  2743 + var sub_id_annotation = "black_annotation" + $scope.j;
  2744 + // alert(sub_id_annotation);
  2745 + var pointClicked_annotation = parseInt(x) + parseInt(y);
  2746 + var Exists_annotation = $("#canvasDiv").find("div[id=" + pointClicked_annotation + "]").length;
  2747 + // alert(Exists_annotation);
  2748 + // alert(pointClicked_annotation);
  2749 + var sppechBubbleHTML_annotation = "<div id ='" + pointClicked_annotation + "' class='com_anno'><div style='z-index:10000;position:absolute;border-top:2px solid #000;transform:rotate(40deg);-moz-transform:rotate(40deg);-o-transform:rotate(40deg);-ms-transform:rotate(40deg);-webkit-transform:rotate(40deg);height:15px;width:35px;left:" + (x - 10) + "px;top:" + (y + 10) + "px;'' id='bubble" + $scope.j + "'></div><div data=" + $scope.j + " id=" + sub_id_annotation + " class='appendDragg_annotation' style='z-index:10000;margin-left:25px;border:1px solid #000;padding:5px 10px;position:absolute;color:#000;text-align:left;font-size: 12px;background-color:#fff;font-weight:bold;left:" + x + "px;top:" + y + "px;'><div style='z-index:7000;position:absolute;right:-4px;top:-4px;color:#ffffff;cursor:pointer;'><img id=" + $scope.j + " class='dynCross_anno' src=" + $rootScope.path + "></div></div><div style='position:absolute;border:1px solid #000;display:none;z-index:9000;' id='bord_annotation" + $scope.j + "'></div></div>";
  2750 + if ($scope.longest_annotationT1.length > $scope.longest_annotationT2.length) {
  2751 + if (Exists_annotation == 0) {
  2752 + $("#canvasDiv").append(sppechBubbleHTML_annotation);
  2753 +
  2754 + for (var l = 0; l <= $scope.annotationTextArrayT1.length - 1; l++) {
  2755 + var MultipleLang_annotation_T1 = $scope.annotationTextArrayT1[l];
  2756 + // alert(MultipleLang_annotation_T1);
  2757 + // alert(sub_id_annotation);
  2758 + $("#" + sub_id_annotation).append("<p style='margin-bottom:2px;'>" + MultipleLang_annotation_T1 + "</p>");
  2759 + }
  2760 +
  2761 + $("#" + sub_id_annotation).append("<p style='border-bottom:1px solid black;margin-bottom:0;'></p>");
  2762 +
  2763 + for (var k = 0; k <= $scope.annotationTextArrayT2.length - 1; k++) {
  2764 + // alert(MultipleLang_annotation_T2);
  2765 + var MultipleLang_annotation_T2 = $scope.annotationTextArrayT2[k];
  2766 + $("#" + sub_id_annotation).append("<p style='margin-bottom:2px;'>" + MultipleLang_annotation_T2 + "</p>");
  2767 + }
  2768 +
  2769 +
  2770 +
  2771 + if ($scope.longest_annotationT1.length <= 10) {
  2772 +
  2773 +
  2774 + $("#" + sub_id_annotation).css("width", "100px");
  2775 +
  2776 +
  2777 + }
  2778 +
  2779 + else if ($scope.longest_annotationT1.length > 10 && $scope.longest_annotationT1.length <= 17) {
  2780 +
  2781 +
  2782 + $("#" + sub_id_annotation).css("width", "140px");
  2783 +
  2784 +
  2785 + }
  2786 +
  2787 + else if ($scope.longest_annotationT1.length > 17 && $scope.longest_annotationT1.length <= 26) {
  2788 +
  2789 +
  2790 +
  2791 + $("#" + sub_id_annotation).css("width", "195px");
  2792 +
  2793 + }
  2794 + else if ($scope.longest_annotationT1.length > 26 && $scope.longest_annotationT1.length <= 34) {
  2795 +
  2796 +
  2797 +
  2798 + $("#" + sub_id_annotation).css("width", "248px");
  2799 + }
  2800 + else if ($scope.longest_annotationT1.length > 34 && $scope.longest_annotationT1.length <= 44) {
  2801 +
  2802 +
  2803 +
  2804 + $("#" + sub_id_annotation).css("width", "300px");
  2805 + }
  2806 +
  2807 + else if ($scope.longest_annotationT1.length > 44 && $scope.longest_annotationT1.length <= 54) {
  2808 +
  2809 +
  2810 +
  2811 + $("#" + sub_id_annotation).css("width", "370px");
  2812 + }
  2813 + else if ($scope.longest_annotationT1.length > 54 && $scope.longest_annotationT1.length <= 69) {
  2814 +
  2815 +
  2816 +
  2817 + $("#" + sub_id_annotation).css("width", "450px");
  2818 + }
  2819 + else if ($scope.longest_annotationT1.length > 69 && $scope.longest_annotationT1.length <= 75) {
  2820 +
  2821 +
  2822 + $("#" + sub_id_annotation).css("width", "510px");
  2823 +
  2824 + }
  2825 + else {
  2826 +
  2827 +
  2828 + $("#" + sub_id_annotation).css("width", ($scope.longest_annotationT1.length) + "%");
  2829 + }
  2830 + }
  2831 + else {
  2832 +
  2833 + $("#canvasDiv").find("div[id=" + pointClicked_annotation + "]").css("display", "block");
  2834 +
  2835 + }
  2836 +
  2837 + }
  2838 + else {
  2839 +
  2840 + if (Exists_annotation == 0) {
  2841 +
  2842 +
  2843 +
  2844 + $("#canvasDiv").append(sppechBubbleHTML_annotation);
  2845 +
  2846 + for (var l = 0; l <= $scope.annotationTextArrayT1.length - 1; l++) {
  2847 + var MultipleLang_annotation_T1 = $scope.annotationTextArrayT1[l];
  2848 + // alert(MultipleLang_annotation_T1);
  2849 + $("#" + sub_id_annotation).append("<p style='margin-bottom:2px;'>" + MultipleLang_annotation_T1 + "</p>");
  2850 + }
  2851 +
  2852 + $("#" + sub_id_annotation).append("<p style='border-bottom:1px solid black;margin-bottom:0;'></p>");
  2853 +
  2854 + for (var k = 0; k <= $scope.annotationTextArrayT2.length - 1; k++) {
  2855 + var MultipleLang_annotation_T2 = $scope.annotationTextArrayT2[k];
  2856 + // alert(MultipleLang_annotation_T2);
  2857 + $("#" + sub_id_annotation).append("<p style='margin-bottom:2px;'>" + MultipleLang_annotation_T2 + "</p>");
  2858 + }
  2859 +
  2860 + if ($scope.longest_annotationT2.length <= 10) {
  2861 +
  2862 +
  2863 + $("#" + sub_id_annotation).css("width", "100px");
  2864 +
  2865 +
  2866 + }
  2867 +
  2868 + else if ($scope.longest_annotationT2.length > 10 && $scope.longest_annotationT2.length <= 17) {
  2869 +
  2870 +
  2871 + $("#" + sub_id_annotation).css("width", "140px");
  2872 +
  2873 +
  2874 + }
  2875 +
  2876 + else if ($scope.longest_annotationT2.length > 17 && $scope.longest_annotationT2.length <= 26) {
  2877 +
  2878 +
  2879 +
  2880 + $("#" + sub_id_annotation).css("width", "195px");
  2881 +
  2882 + }
  2883 + else if ($scope.longest_annotationT2.length > 26 && $scope.longest_annotationT2.length <= 34) {
  2884 +
  2885 +
  2886 +
  2887 + $("#" + sub_id_annotation).css("width", "248px");
  2888 + }
  2889 + else if ($scope.longest_annotationT2.length > 34 && $scope.longest_annotationT2.length <= 44) {
  2890 +
  2891 +
  2892 +
  2893 + $("#" + sub_id_annotation).css("width", "300px");
  2894 + }
  2895 +
  2896 + else if ($scope.longest_annotationT2.length > 44 && $scope.longest_annotationT2.length <= 54) {
  2897 +
  2898 +
  2899 +
  2900 + $("#" + sub_id_annotation).css("width", "370px");
  2901 + }
  2902 + else if ($scope.longest_annotationT2.length > 54 && $scope.longest_annotationT2.length <= 69) {
  2903 +
  2904 +
  2905 +
  2906 + $("#" + sub_id_annotation).css("width", "450px");
  2907 + }
  2908 + else if ($scope.longest_annotationT2.length > 69 && $scope.longest_annotationT2.length <= 75) {
  2909 +
  2910 +
  2911 + $("#" + sub_id_annotation).css("width", "510px");
  2912 +
  2913 + }
  2914 + else {
  2915 +
  2916 +
  2917 + $("#" + sub_id_annotation).css("width", ($scope.longest_annotationT2.length) + "%");
  2918 + }
  2919 + }
  2920 + else {
  2921 +
  2922 + $("#canvasDiv").find("div[id=" + pointClicked_annotation + "]").css("display", "block");
  2923 +
  2924 + }
  2925 +
  2926 + }
  2927 +
  2928 + $scope.speachBubbleArrayAnnotation.push({ xaxis: x, yaxis: y, ids: sub_id_annotation });
  2929 +
  2930 + $('.appendDragg_annotation').draggable({
  2931 + drag: function (evt) {
  2932 + $(this).prev('div').css("display", "none");
  2933 + var bor_id_anno = $(this).next('div').attr('id');
  2934 + var sub_id1_anno = $(this).attr('id');
  2935 + var verticalScrollPosition = canvasDiv.scrollTop;
  2936 + var horizontlScrollPosition = canvasDiv.scrollLeft;
  2937 +
  2938 + if ($scope.speachBubbleArrayAnnotation != null || $scope.speachBubbleArrayAnnotation != undefined) {
  2939 + for (var m = 0; m <= $scope.speachBubbleArrayAnnotation.length - 1; m++) {
  2940 + if ($scope.speachBubbleArrayAnnotation[m].ids == sub_id1_anno) {
  2941 +
  2942 + $scope.angle1($scope.speachBubbleArrayAnnotation[m].xaxis, $scope.speachBubbleArrayAnnotation[m].yaxis, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, bor_id_anno);
  2943 + break;
  2944 +
  2945 + }
  2946 + }
  2947 + }
  2948 +
  2949 + },
  2950 + });
  2951 +
  2952 +
  2953 +
  2954 + $('.dynCross_anno').on('click', function (evt) {
  2955 + $(this).parent().parent().parent().css('display', 'none');
  2956 +
  2957 + // $("#bord").css("display", "none");
  2958 + // $("#dot").css("display", "none");
  2959 +
  2960 +
  2961 + });
  2962 +
  2963 +
  2964 +
  2965 + }
  2966 +
  2967 + else {
  2968 +
  2969 + $scope.multiAnnotationIsON = false;
  2970 +
  2971 + $(".com_annotation").css("display", "none");
  2972 + $("#bord_annotation").css({ "width": "0px", "display": "none" });
  2973 +
  2974 + var sppechBubbleDotHTML_annotation = '<div id="dot_annotation" style="position:absolute;height:15px;width:35px;display:none;z-index:10000;border-top:2px solid #000;transform:rotate(40deg);-moz-transform:rotate(40deg);-o-transform:rotate(40deg);-ms-transform:rotate(40deg);-webkit-transform:rotate(40deg);"></div>'
  2975 + + '<div id="sppeachBubble_annotation" style="height:auto!important;z-index:10000;margin-left:25px;border:1px solid #000;display:none;padding:5px 10px;position:absolute;color:#000;text-align:left;font-size:12px;background-color:#fff;font-weight:bold;">'
  2976 + + '<span style="position:absolute;right:-4px;top:-4px;color:#ffffff;cursor:pointer;">'
  2977 + + '<img class="crossDiv_temp_annotation" src=' + $rootScope.path + '></span></div>'
  2978 +
  2979 + + '<div style="position:absolute;border:1px solid #000;display:none;z-index:9000;" id="bord_annotation">'
  2980 + + '</div>';
  2981 +
  2982 +
  2983 +
  2984 + if ($scope.longest_annotationT1.length > $scope.longest_annotationT2.length) {
  2985 +
  2986 + $("#sppeachBubble_annotation p").remove();
  2987 + $('#canvasDiv').append(sppechBubbleDotHTML_annotation);
  2988 + for (var l = 0; l <= $scope.annotationTextArrayT1.length - 1; l++) {
  2989 + var MultipleLang_annotation_T1 = $scope.annotationTextArrayT1[l];
  2990 + $("#sppeachBubble_annotation").append("<p style='margin-bottom:2px;'>" + MultipleLang_annotation_T1 + "</p>");
  2991 + }
  2992 +
  2993 + $("#sppeachBubble_annotation").append("<p style='border-bottom:1px solid black;margin-bottom:0;'></p>");
  2994 +
  2995 + for (var k = 0; k <= $scope.annotationTextArrayT2.length - 1; k++) {
  2996 + var MultipleLang_annotation_T2 = $scope.annotationTextArrayT2[k];
  2997 + $("#sppeachBubble_annotation").append("<p style='margin-bottom:2px;'>" + MultipleLang_annotation_T2 + "</p>");
  2998 + }
  2999 +
  3000 + if ($scope.longest_annotationT1.length <= 10) {
  3001 +
  3002 +
  3003 + $("#sppeachBubble_annotation").css("width", "100px");
  3004 +
  3005 +
  3006 + }
  3007 +
  3008 + else if ($scope.longest_annotationT1.length > 10 && $scope.longest_annotationT1.length <= 17) {
  3009 +
  3010 +
  3011 + $("#sppeachBubble_annotation").css("width", "140px");
  3012 +
  3013 +
  3014 + }
  3015 +
  3016 + else if ($scope.longest_annotationT1.length > 17 && $scope.longest_annotationT1.length <= 26) {
  3017 +
  3018 +
  3019 +
  3020 + $("#sppeachBubble_annotation").css("width", "195px");
  3021 +
  3022 + }
  3023 + else if ($scope.longest_annotationT1.length > 26 && $scope.longest_annotationT1.length <= 34) {
  3024 +
  3025 +
  3026 +
  3027 + $("#sppeachBubble_annotation").css("width", "248px");
  3028 + }
  3029 + else if ($scope.longest_annotationT1.length > 34 && $scope.longest_annotationT1.length <= 44) {
  3030 +
  3031 +
  3032 +
  3033 + $("#sppeachBubble_annotation").css("width", "300px");
  3034 + }
  3035 +
  3036 + else if ($scope.longest_annotationT1.length > 44 && $scope.longest_annotationT1.length <= 54) {
  3037 +
  3038 +
  3039 +
  3040 + $("#sppeachBubble_annotation").css("width", "370px");
  3041 + }
  3042 + else if ($scope.longest_annotationT1.length > 54 && $scope.longest_annotationT1.length <= 69) {
  3043 +
  3044 +
  3045 +
  3046 + $("#sppeachBubble_annotation").css("width", "450px");
  3047 + }
  3048 + else if ($scope.longest_annotationT1.length > 69 && $scope.longest_annotationT1.length <= 75) {
  3049 +
  3050 +
  3051 + $("#sppeachBubble_annotation").css("width", "510px");
  3052 +
  3053 + }
  3054 + else {
  3055 +
  3056 +
  3057 + $("#sppeachBubble_annotation").css("width", ($scope.longest_annotationT1.length) + "%");
  3058 + }
  3059 + }
  3060 +
  3061 +
  3062 + else {
  3063 + $("#sppeachBubble_annotation p").remove();
  3064 + $('#canvasDiv').append(sppechBubbleDotHTML_annotation);
  3065 + for (var l = 0; l <= $scope.annotationTextArrayT1.length - 1; l++) {
  3066 + var MultipleLang_annotation_T1 = $scope.annotationTextArrayT1[l];
  3067 + $("#sppeachBubble_annotation").append("<p style='margin-bottom:2px;'>" + MultipleLang_annotation_T1 + "</p>");
  3068 + }
  3069 +
  3070 + $("#sppeachBubble_annotation").append("<p style='border-bottom:1px solid black;margin-bottom:0;'></p>");
  3071 +
  3072 + for (var k = 0; k <= $scope.annotationTextArrayT2.length - 1; k++) {
  3073 + var MultipleLang_annotation_T2 = $scope.annotationTextArrayT2[k];
  3074 + $("#sppeachBubble_annotation").append("<p style='margin-bottom:2px;'>" + MultipleLang_annotation_T2 + "</p>");
  3075 + }
  3076 +
  3077 + if ($scope.longest_annotationT2.length <= 10) {
  3078 +
  3079 +
  3080 + $("#sppeachBubble_annotation").css("width", "100px");
  3081 +
  3082 +
  3083 + }
  3084 +
  3085 + else if ($scope.longest_annotationT2.length > 10 && $scope.longest_annotationT2.length <= 17) {
  3086 +
  3087 +
  3088 + $("#sppeachBubble_annotation").css("width", "140px");
  3089 +
  3090 +
  3091 + }
  3092 +
  3093 + else if ($scope.longest_annotationT2.length > 17 && $scope.longest_annotationT2.length <= 26) {
  3094 +
  3095 +
  3096 +
  3097 + $("#sppeachBubble_annotation").css("width", "195px");
  3098 +
  3099 + }
  3100 + else if ($scope.longest_annotationT2.length > 26 && $scope.longest_annotationT2.length <= 34) {
  3101 +
  3102 +
  3103 +
  3104 + $("#sppeachBubble_annotation").css("width", "248px");
  3105 + }
  3106 + else if ($scope.longest_annotationT2.length > 34 && $scope.longest_annotationT2.length <= 44) {
  3107 +
  3108 +
  3109 +
  3110 + $("#sppeachBubble_annotation").css("width", "300px");
  3111 + }
  3112 +
  3113 + else if ($scope.longest_annotationT2.length > 44 && $scope.longest_annotationT2.length <= 54) {
  3114 +
  3115 +
  3116 +
  3117 + $("#sppeachBubble_annotation").css("width", "370px");
  3118 + }
  3119 + else if ($scope.longest_annotationT2.length > 54 && $scope.longest_annotationT2.length <= 69) {
  3120 +
  3121 +
  3122 +
  3123 + $("#sppeachBubble_annotation").css("width", "450px");
  3124 + }
  3125 + else if ($scope.longest_annotationT2.length > 69 && $scope.longest_annotationT2.length <= 75) {
  3126 +
  3127 +
  3128 + $("#sppeachBubble_annotation").css("width", "510px");
  3129 +
  3130 + }
  3131 + else {
  3132 +
  3133 +
  3134 + $("#sppeachBubble_annotation").css("width", ($scope.longest_annotationT2.length) + "%");
  3135 + }
  3136 + var Globe = [];
  3137 + Globe.push({ currentX: x, currentY: y });
  3138 +
  3139 + document.getElementById('dot_annotation').style.display = 'block';
  3140 + document.getElementById('dot_annotation').style.left = ((Globe[0].currentX) - 10) + 'px';
  3141 + document.getElementById('dot_annotation').style.top = ((Globe[0].currentY) + 10) + 'px';
  3142 + document.getElementById('sppeachBubble_annotation').style.display = 'block';
  3143 + document.getElementById('sppeachBubble_annotation').style.left = (Globe[0].currentX) + 'px';
  3144 + document.getElementById('sppeachBubble_annotation').style.top = (Globe[0].currentY) + 'px';
  3145 +
  3146 + $('#sppeachBubble_annotation').draggable(
  3147 + {
  3148 + drag: function (evt) {
  3149 +
  3150 + $("#dot_annotation").css("display", "none");
  3151 + var verticalScrollPosition = canvasDiv.scrollTop;
  3152 + var horizontlScrollPosition = canvasDiv.scrollLeft;
  3153 + $scope.angle(x, y, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, false);
  3154 +
  3155 +
  3156 + },
  3157 + });
  3158 +
  3159 +
  3160 + $('.crossDiv_temp_annotation').on('click', function (evt) {
  3161 + $('#sppeachBubble_annotation').css('display', 'none');
  3162 +
  3163 + $("#bord_annotation").css("display", "none");
  3164 + $("#dot_annotation").css("display", "none");
  3165 +
  3166 +
  3167 + });
  3168 + }
  3169 +
  3170 +
  3171 +
  3172 + }
  3173 +
  3174 +
  3175 + }
  3176 +
  3177 + }
  3178 +
  3179 + $scope.createSpeechBubbleBasedOnAnnotationLength = function (pointClicked, x, y, id) {
  3180 + var sppechBubbleHTML = "<div id ='" + pointClicked + "' class='com'><div style='z-index:10000;position:absolute;border-top:2px solid #000;transform:rotate(40deg);-moz-transform:rotate(40deg);-o-transform:rotate(40deg);-ms-transform:rotate(40deg);-webkit-transform:rotate(40deg);height:15px;width:35px;left:" + (x - 10) + "px;top:" + (y + 10) + "px;'' id='bubble" + $scope.speechBubbleCounter + "'></div><div data=" + $scope.speechBubbleCounter + " id=" + id + " class='appendDragg' style='z-index:10000;margin-left:25px;border:1px solid #000;padding:5px 10px;position:absolute;color:#000;text-align:left;font-size: 12px;background-color:#fff;font-weight:bold;left:" + x + "px;top:" + y + "px;'><div style='z-index:7000;position:absolute;right:-4px;top:-4px;color:#ffffff;cursor:pointer;'><img id=" + $scope.speechBubbleCounter + " class='dynCross' src=" + $rootScope.path + "></div></div><div style='position:absolute;border:1px solid #000;display:none;z-index:9000;' id='bord" + $scope.speechBubbleCounter + "'></div></div>";
  3181 + $("#canvasDiv").append(sppechBubbleHTML);
  3182 +
  3183 + for (var i = 0; i <= $scope.MultiLanguageAnnationArray.length - 1; i++) {
  3184 + var annotation = $scope.MultiLanguageAnnationArray[i];
  3185 +
  3186 + $("#" + id).append("<p style='margin-bottom:2px;'>" + annotation + "</p>");
  3187 + }
  3188 +
  3189 + if ($scope.longestAnnotation.length <= 10) {
  3190 + $("#" + id).css("width", "100px");
  3191 + }
  3192 +
  3193 + else if ($scope.longestAnnotation.length > 10 && $scope.longestAnnotation.length <= 17) {
  3194 + $("#" + id).css("width", "140px");
  3195 + }
  3196 + else if ($scope.longestAnnotation.length > 17 && $scope.longestAnnotation.length <= 26) {
  3197 + $("#" + id).css("width", "195px");
  3198 +
  3199 + }
  3200 + else if ($scope.longestAnnotation.length > 26 && $scope.longestAnnotation.length <= 34) {
  3201 + $("#" + id).css("width", "248px");
  3202 + }
  3203 + else if ($scope.longestAnnotation.length > 34 && $scope.longestAnnotation.length <= 44) {
  3204 + $("#" + id).css("width", "300px");
  3205 + }
  3206 +
  3207 + else if ($scope.longestAnnotation.length > 44 && $scope.longestAnnotation.length <= 54) {
  3208 + $("#" + id).css("width", "370px");
  3209 + }
  3210 + else if ($scope.longestAnnotation.length > 54 && $scope.longestAnnotation.length <= 69) {
  3211 + $("#" + id).css("width", "450px");
  3212 + }
  3213 + else if ($scope.longestAnnotation.length > 69 && $scope.longestAnnotation.length <= 75) {
  3214 + $("#" + id).css("width", "510px");
  3215 +
  3216 + }
  3217 + else {
  3218 + $("#" + id).css("width", ($scope.longestAnnotation.length) + "%");
  3219 + }
  3220 + }
  3221 +
  3222 + $scope.angle1 = function (cx1, cy1, ex1, ey1, id, id2) {
  3223 +
  3224 + // console.log(cx1 + " " + cy1);
  3225 + var dy = ey1 - cy1;
  3226 + var dx = ex1 - cx1;
  3227 + var theta = 0;
  3228 + if (dx < 0) {
  3229 + theta = Math.atan(dy / dx) * (180 / Math.PI);
  3230 + theta = theta + 180;
  3231 +
  3232 + }
  3233 + else if (dy < 0) {
  3234 + theta = Math.atan(dy / dx) * (180 / Math.PI);
  3235 + theta = theta + 360;
  3236 +
  3237 + }
  3238 + else {
  3239 + theta = Math.atan(dy / dx) * (180 / Math.PI);
  3240 + }
  3241 +
  3242 + var g = Math.sqrt((cx1 - ex1) * (cx1 - ex1) + (cy1 - ey1) * (cy1 - ey1));
  3243 + var e = cy1;
  3244 + var f = cx1;
  3245 +
  3246 + $('#' + id).css({ 'display': 'block', 'width': g + 'px', 'top': e + 'px', 'left': f + 'px', 'transform': 'rotate(' + theta + 'deg)', '-moz-transform': 'rotate(' + theta + 'deg)', '-webkit-transform': 'rotate(' + theta + 'deg)', 'transform-origin': '0% 0%' });
  3247 +
  3248 + }
  3249 +
  3250 + function myFunction(crossId) {
  3251 + // alert(crossId);
  3252 + $('#' + crossId).parent().parent().parent().css("display", "none");
  3253 +
  3254 + }
  3255 +
  3256 +
  3257 + $scope.angle = function (cx, cy, ex, ey, BoolValues) {
  3258 +
  3259 +
  3260 + var dy = ey - cy;
  3261 + var dx = ex - cx;
  3262 + var theta = 0;
  3263 + if (dx < 0) {
  3264 + theta = Math.atan(dy / dx) * (180 / Math.PI);
  3265 + theta = theta + 180;
  3266 +
  3267 + }
  3268 + else if (dy < 0) {
  3269 + theta = Math.atan(dy / dx) * (180 / Math.PI);
  3270 + theta = theta + 360;
  3271 +
  3272 + }
  3273 + else {
  3274 + theta = Math.atan(dy / dx) * (180 / Math.PI);
  3275 + }
  3276 +
  3277 + var d = Math.sqrt((cx - ex) * (cx - ex) + (cy - ey) * (cy - ey));
  3278 + var e = cy;
  3279 + var f = cx;
  3280 +
  3281 + if (BoolValues == true) {
  3282 + $("#bord").css({ 'display': 'block', 'width': d + 'px', 'top': e + 'px', 'left': f + 'px', 'transform': 'rotate(' + theta + 'deg)', '-moz-transform': 'rotate(' + theta + 'deg)', '-webkit-transform': 'rotate(' + theta + 'deg)', 'transform-origin': '0% 0%' });
  3283 +
  3284 + }
  3285 + else {
  3286 + $("#bord_annotation").css({ 'display': 'block', 'width': d + 'px', 'top': e + 'px', 'left': f + 'px', 'transform': 'rotate(' + theta + 'deg)', '-moz-transform': 'rotate(' + theta + 'deg)', '-webkit-transform': 'rotate(' + theta + 'deg)', 'transform-origin': '0% 0%' });
  3287 + }
  3288 +
  3289 +
  3290 +
  3291 + }
  3292 +
  3293 +
  3294 + $scope.createSpeechBubble = function (event, text, x, y) {
  3295 + //set z index to make annoation speech buble on top others
  3296 + $('#canvasDiv').css('cursor', 'pointer');
  3297 + $('<div id="speechBubble" class="BubbleDiv" style="display:visible; top:' + y + 'px; left:' + x + 'px; z-index:700"> <div class="">'
  3298 + + '<div class="Bubble">'
  3299 + + '<div class="BubbleCloseBtn"></div><div class="BubbleContent">' + text + '</div><div class="bottomLeftArrow"></div>'
  3300 + //+'<div class="bottomRightArrow"></div><div class="topLeftArrow"></div><div class="topRightArrow"></div>
  3301 + + '</div></div></div>').appendTo('#canvasDiv');
  3302 +
  3303 + $('#speechBubble').on('click', '.BubbleCloseBtn', function (evt) {
  3304 + $('#speechBubble').css('display', 'none');
  3305 + });
  3306 +
  3307 + $('#canvasDiv').attr("data-bubbleid", "speechBubble")
  3308 +
  3309 +
  3310 + };
  3311 +
  3312 +
  3313 + $scope.createTransparencyBox = function () {
  3314 +
  3315 +
  3316 + //if listanager is visisble then close it
  3317 +
  3318 + $rootScope.isListManagerSelected = false;
  3319 + $rootScope.CloseListManager();
  3320 +
  3321 +
  3322 + $scope.isTransparencyActivated = true;
  3323 + // alert('transparencyClicked' + $scope.isTransparencyActivated)
  3324 + $('#btnTranparency').addClass('tButtonActive');
  3325 + $('#btnIdentity').removeClass(' btn-primary');
  3326 + $('#btnIdentity').addClass('btn-black');
  3327 +
  3328 + var canvasDiv = document.getElementById('canvasDiv');
  3329 + $scope.verticalScrollPosition = canvasDiv.scrollTop;
  3330 + $scope.horizontlScrollPosition = canvasDiv.scrollLeft;
  3331 +
  3332 + var canvasDiv = document.getElementById('canvasDiv');
  3333 + canvasDiv.addEventListener("mousedown", mouseDownListener);
  3334 +
  3335 + canvasDiv.addEventListener("mousemove", mouseMoveListener);
  3336 +
  3337 + canvasDiv.addEventListener("mouseup", mouseUpListener)
  3338 +
  3339 + }
  3340 +
  3341 + function mouseDownListener(e) {
  3342 + //Dated:18-07-2016 Issue#4975: Transparency box should not be clickable if it is already selected.
  3343 + var tCanvas = document.getElementById('transparencyCanvas');
  3344 + if ($('#transparencyScale').css("visibility") == 'visible') {
  3345 + $('#transparencyScale').css('visibility', 'hidden');
  3346 + $('#transparencyCanvas').remove();
  3347 + }
  3348 + var $container = document.getElementById('canvasDiv');
  3349 + var $selection = $('<div>').addClass('rectangle');
  3350 + document.getElementById("DAView")
  3351 + $selection.css({
  3352 + 'position': 'absolute',
  3353 + //'background': 'transparent',
  3354 + 'border': '1px dotted #000'
  3355 + });
  3356 +
  3357 + var currentMousePosition = $scope.getMousePos(e);
  3358 +
  3359 + $scope.TBDrawStartX = currentMousePosition.x;
  3360 + $scope.TBDrawStartY = currentMousePosition.y;
  3361 +
  3362 +
  3363 + var actulalX = currentMousePosition.x + $scope.horizontlScrollPosition
  3364 + var actualY = currentMousePosition.y + $scope.verticalScrollPosition
  3365 +
  3366 + //alert('$scope.TransparencyBoxStartX in mouseDown: ' + $scope.TransparencyBoxStartX + ' & Y= ' + $scope.TransparencyBoxStartY);
  3367 + $scope.TransparencyBoxStartX = actulalX;
  3368 + $scope.TransparencyBoxStartY = actualY
  3369 + $scope.startX = actulalX;
  3370 + $scope.startY = actualY;
  3371 + var tBox = document.getElementById('transparencyCanvas');
  3372 +
  3373 + if (tBox == null) {
  3374 + //// canvasDiv.style.cursor = "crosshair";
  3375 + $selection.css({
  3376 + 'top': actualY,
  3377 + 'left': actulalX,
  3378 + 'width': 0,
  3379 + 'height': 0,
  3380 + 'z-index': 1000
  3381 + //'background': 'transparent',
  3382 + });
  3383 + $selection.appendTo($container);
  3384 + }
  3385 +
  3386 + document.getElementById('canvasDiv').removeEventListener("mousedown", mouseDownListener);
  3387 + //Dated:19-07-2016 Issue#4975: Transparency box should not be clickable if it is already selected.
  3388 + if ($("#txtlayerNumber").val() != 0) {
  3389 + $('#layerChangeSlider').slider("option", "value", parseInt($scope.totalLayers) - parseInt($scope.currentLayerNumber));
  3390 + $("#txtlayerNumber").val(parseInt($scope.currentLayerNumber));
  3391 + }
  3392 + }
  3393 +
  3394 + function mouseMoveListener(e) {
  3395 +
  3396 + var currentMousePosition = $scope.getMousePos(e);
  3397 + var move_x = currentMousePosition.x + $scope.horizontlScrollPosition,
  3398 + move_y = currentMousePosition.y + $scope.verticalScrollPosition,
  3399 +
  3400 + width = move_x - $scope.TransparencyBoxStartX,
  3401 + height = move_y - $scope.TransparencyBoxStartY,
  3402 + new_x, new_y;
  3403 +
  3404 + new_x = (move_x < $scope.TransparencyBoxStartX) ? ($scope.TransparencyBoxStartX - width) : $scope.TransparencyBoxStartX;
  3405 + new_y = (move_y < $scope.TransparencyBoxStartY) ? ($scope.TransparencyBoxStartY - height) : $scope.TransparencyBoxStartY;
  3406 +
  3407 + $('.rectangle').css({
  3408 + 'width': width,
  3409 + 'height': height,
  3410 + //'background': 'transparent'
  3411 +
  3412 + });
  3413 +
  3414 +
  3415 +
  3416 + }
  3417 +
  3418 +
  3419 + function mouseUpListener(e) {
  3420 + // $selection.remove();
  3421 + // debugger;
  3422 +
  3423 + $scope.currentLayerNumber = parseInt($('#txtlayerNumber').val());
  3424 + $('.rectangle').remove();
  3425 +
  3426 + var currentMousePosition = $scope.getMousePos(e);
  3427 +
  3428 +
  3429 + var canvasDiv = document.getElementById('canvasDiv');
  3430 + var verticalScrollPosition = canvasDiv.scrollTop;
  3431 + var horizontlScrollPosition = canvasDiv.scrollLeft;
  3432 +
  3433 + var TransparencyEndX = currentMousePosition.x + horizontlScrollPosition
  3434 + var TransparencyBoxEndY = currentMousePosition.y + verticalScrollPosition
  3435 +
  3436 +
  3437 + $scope.isTboxDrwan = true;
  3438 + $scope.TbEndX = TransparencyEndX;
  3439 + $scope.TbEndY = TransparencyBoxEndY;
  3440 + $scope.TransparencyEndX = TransparencyEndX;
  3441 + $scope.TransparencyBoxEndY = TransparencyBoxEndY;
  3442 +
  3443 +
  3444 +
  3445 + //draw temp box to store the canvas data with original transparecy
  3446 + if (document.getElementById('tempCanvas') != null) {
  3447 + $('#tempCanvas').remove();
  3448 + }
  3449 + if (document.getElementById('tempCanvas') == null) {
  3450 + var tempCanvas = document.createElement('canvas');
  3451 + tempCanvas.id = 'tempCanvas';
  3452 + // $scope.tempCanvas = transparencyCanvas.id;
  3453 + tempCanvas.height = TransparencyBoxEndY - $scope.startY;
  3454 + tempCanvas.width = TransparencyEndX - $scope.startX;
  3455 + tempCanvas.style.position = "absolute";
  3456 + tempCanvas.style.left = 200 + 'px';
  3457 + tempCanvas.style.top = 200 + 'px';
  3458 + tempCanvas.style.backgroundColor = "transparent";
  3459 + tempCanvas.style.visibility = 'hidden';
  3460 + tempCanvas.style.border = "black 1px solid";
  3461 + document.getElementById('canvasDiv').appendChild(tempCanvas);
  3462 + }
  3463 +
  3464 +
  3465 + var BodyRegionDictionary = $rootScope.BodyRegionCordinatesData;
  3466 +
  3467 + $scope.IncludedBodyRegions = [];
  3468 + ////debugger;
  3469 + $.each(BodyRegionDictionary, function (index, value) {
  3470 + // alert(' $.each(BodyRegionDictionary1')
  3471 + var transparencyBoxHeight = parseInt(TransparencyBoxEndY) - parseInt($scope.TransparencyBoxStartY);
  3472 + var transparencyBoxWidth = parseInt(TransparencyEndX) - parseInt($scope.TransparencyBoxStartX);
  3473 + var transparencyBoxBottom = parseInt($scope.TransparencyBoxStartY) + parseInt(transparencyBoxHeight);
  3474 + var transparencyBoxRight = parseInt($scope.TransparencyBoxStartX) + parseInt(transparencyBoxWidth);
  3475 + // alert(' $.each(BodyRegionDictionary2. transparencyBoxHeight: ' + transparencyBoxHeight + ',transparencyBoxBottom: ' + transparencyBoxBottom+', transparencyBoxRight: '+transparencyBoxRight)
  3476 + var bodyRegionRight = parseInt(value.X) + parseInt(value.Width);
  3477 + var bodyRegionBottom = parseInt(value.Y) + parseInt(value.Height);
  3478 +
  3479 +
  3480 +
  3481 + var transparencyCanvas = document.createElement('canvas');
  3482 + var tBox = document.getElementById('transparencyCanvas');
  3483 + if (tBox == null) {
  3484 +
  3485 + transparencyCanvas.id = 'transparencyCanvas';
  3486 + $scope.transparencyCanvasId = transparencyCanvas.id;
  3487 + transparencyCanvas.height = TransparencyBoxEndY - $scope.startY;
  3488 + transparencyCanvas.width = TransparencyEndX - $scope.startX;
  3489 + transparencyCanvas.style.position = "absolute";
  3490 + transparencyCanvas.style.left = $scope.startX + 'px' // x + "px";
  3491 + transparencyCanvas.style.top = $scope.startY + "px"//y + "px";
  3492 + transparencyCanvas.style.border = "black 1px solid";
  3493 + transparencyCanvas.style.backgroundColor = "transparent";
  3494 + // transparencyCanvas.style.visibility = 'hidden';
  3495 + document.getElementById('canvasDiv').appendChild(transparencyCanvas);
  3496 + $scope.transparencyChangeCounter = 0;
  3497 +
  3498 + $('#transparencyCanvas').resizable({ handles: "e,s,se,w,n,ne,nw,sw", stop: function (event, ui) { resizeCanvas(); }, start: function (event, ui) { clearTransCanvas(); } });
  3499 +
  3500 + $scope.transparencyCanvasHeight = transparencyCanvas.height;
  3501 + $scope.transparencyCanvasWidth = transparencyCanvas.width;
  3502 +
  3503 + //bind click listener
  3504 + transparencyCanvas.addEventListener('click', TransparencyCanvasClickListener);
  3505 +
  3506 + $(".ui-wrapper").css("z-index", "600");
  3507 +
  3508 + // $('#transparencyScale').modal('show');
  3509 +
  3510 + //canvasDiv.removeEventListener('mouseup', arguments.callee);
  3511 + //canvasDiv.removeEventListener('mousedown', arguments.callee);
  3512 + //canvasDiv.removeEventListener('mousemove', arguments.callee);
  3513 + }
  3514 + if ($scope.TransparencyBoxStartX <= bodyRegionRight && value.X <= transparencyBoxRight && $scope.TransparencyBoxStartY <= bodyRegionBottom && value.Y <= transparencyBoxBottom) {
  3515 +
  3516 + //if ($rootScope.voId != "9") {
  3517 + // if ($rootScope.voId != "11") {
  3518 + // $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false);
  3519 +
  3520 + // }
  3521 +
  3522 + //}
  3523 +
  3524 + //else {
  3525 + // if (value.bodyRegionId == "6") {
  3526 + // $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false);
  3527 + // }
  3528 + //}
  3529 + if (($rootScope.voId == "9" || $rootScope.voId == "11")) {
  3530 + if (value.bodyRegionId == "6") {
  3531 + $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false);
  3532 + }
  3533 + else {
  3534 +
  3535 + }
  3536 + }
  3537 + else {
  3538 + $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false);
  3539 +
  3540 + }
  3541 + }
  3542 + })
  3543 +
  3544 + // $('#transparencyScale').modal('show');
  3545 + $('#transparencyScale').css('position', 'fixed')
  3546 + $('#transparencyScale').css('top', $scope.TBDrawStartY - 10)
  3547 + $('#transparencyScale').css('left', $scope.TBDrawStartX + 130)
  3548 + $('#transparencyScale').css('visibility', 'visible')
  3549 + $('#transparencyScale').css("z-index", "100000") //Dated:16-07-2016 Issue#4962:Transparency box should be on top.
  3550 +
  3551 +
  3552 +
  3553 + document.getElementById('canvasDiv').removeEventListener("mousedown", mouseUpListener);
  3554 + document.getElementById('canvasDiv').removeEventListener("mousemove", mouseUpListener);
  3555 +
  3556 + document.getElementById('canvasDiv').removeEventListener("mouseup", mouseUpListener);
  3557 + // document.getElementById('canvasDiv').removeEventListener("mousemove", mouseMoveListener);
  3558 + $('#btnTranparency').removeClass('btn-black');
  3559 +
  3560 + $('#btnTranparency').addClass('tButtonActive');
  3561 + //debugger;
  3562 + $('#txtlayerNumber').val((parseInt($scope.currentLayerNumber)) + 1);
  3563 + //Dated:18-07-2016 Issue#4975: Transparency box should not be clickable if it is already selected.
  3564 + $('#btnTranparency').removeClass('tButtonActive');
  3565 + $('#btnTranparency').addClass('btn-black');
  3566 + $('#btnIdentity').removeClass('btn-black');
  3567 + $('#btnIdentity').addClass('btn-primary');
  3568 + }
  3569 +
  3570 + $scope.loadTransparencyImage = function (bodyRegionId, Height, Width, X, Y, IsMirror, TransparencyBoxStartX, TransparencyEndX, TransparencyBoxStartY, TransparencyBoxEndY, scope, isLayerChanged, isTransparencyChanged) {
  3571 + // debugger;
  3572 + var scope1 = angular.element(document.getElementById("DAView")).scope();
  3573 + var transparencyCanvas = document.getElementById('transparencyCanvas');
  3574 +
  3575 + TransparencyBoxStartX = parseInt((transparencyCanvas.style.left).replace('px', ''));
  3576 + TransparencyBoxStartY = parseInt((transparencyCanvas.style.top).replace('px', ''));
  3577 + TransparencyEndX = parseInt(transparencyCanvas.width) + parseInt(TransparencyBoxStartX);
  3578 + TransparencyBoxEndY = parseInt(transparencyCanvas.height) + parseInt(TransparencyBoxStartY);
  3579 +
  3580 +
  3581 + var XforCopyImage = 0;
  3582 + var YforCopyImage = 0;
  3583 + var WidthforCopyImage = 0;
  3584 + var HeightforCopyImage = 0;
  3585 + var XforTransImage = 0;
  3586 + var WidthforTransImage = 0;
  3587 + var HeightforTransImage = 0;
  3588 + var YforTransImage = 0;
  3589 + var PreviousBodyRegionHeight = 0;
  3590 + var PreviousBodyRegionY;
  3591 + var PreviousBodyRegionWidth;
  3592 + var PreviousBodyRegionX;
  3593 + var previousBodyRegionId;
  3594 + var transparencyTempCanvas;
  3595 +
  3596 +
  3597 + //X ends outside and start outside of bodyregion
  3598 + if (TransparencyBoxStartX < X && TransparencyEndX > parseInt(X) + parseInt(Width)) {
  3599 + XforCopyImage = 0;
  3600 + WidthforCopyImage = Width;
  3601 + WidthforTransImage = Width;
  3602 + XforTransImage = parseInt(X) - (parseInt(TransparencyBoxStartX));
  3603 + // alert('1')
  3604 + }
  3605 + else if (TransparencyBoxStartX < X && TransparencyEndX < parseInt(X) + parseInt(Width)) {
  3606 +
  3607 + XforCopyImage = 0;
  3608 +
  3609 + WidthforCopyImage = parseInt(TransparencyEndX) - parseInt(X);
  3610 +
  3611 + WidthforTransImage = parseInt(TransparencyEndX) - parseInt(X);
  3612 +
  3613 + // alert(' scope.WidthforCopyImage: ' + scope.WidthforCopyImage)
  3614 + XforTransImage = parseInt(X) - (parseInt(TransparencyBoxStartX));
  3615 +
  3616 + // alert('2')
  3617 + }
  3618 + else if (TransparencyBoxStartX > X && TransparencyEndX > parseInt(X) + parseInt(Width)) {
  3619 + // alert('TransparencyEndX: ' + TransparencyEndX + ', X: ' + X + ', Width: ' + Width + 'scope.TransparencyBoxStartX: ' + scope.TransparencyBoxStartX)
  3620 +
  3621 + XforCopyImage = parseInt(TransparencyBoxStartX) - parseInt(X);
  3622 + WidthforCopyImage = parseInt(X) + parseInt(Width) - parseInt(TransparencyBoxStartX);
  3623 + WidthforTransImage = parseInt(X) + parseInt(Width) - parseInt(TransparencyBoxStartX);
  3624 + XforTransImage = 0;
  3625 + // alert('3')
  3626 + }
  3627 + else if (TransparencyBoxStartX > X && TransparencyEndX < parseInt(X) + parseInt(Width)) {
  3628 + // alert('startX inside & endX inside')
  3629 + XforCopyImage = parseInt(TransparencyBoxStartX) - parseInt(X);//parseInt(X) + parseInt(Width) - parseInt(scope.TransparencyBoxStartX)// scope.TransparencyBoxStartX ;
  3630 + WidthforCopyImage = parseInt(TransparencyEndX) - parseInt(TransparencyBoxStartX);
  3631 + WidthforTransImage = parseInt(TransparencyEndX) - parseInt(TransparencyBoxStartX);
  3632 + XforTransImage = 0
  3633 + // alert('4. TransparencyBoxStartX: ' + TransparencyBoxStartX + ',X: ' + parseInt(X) + ',TransparencyEndX: ' + TransparencyEndX + ',XforCopyImage: ' + XforCopyImage)
  3634 + }
  3635 +
  3636 + //calculate Y and height for tempTranparency box from where to cut the image
  3637 +
  3638 +
  3639 + if (TransparencyBoxStartY < Y && TransparencyBoxEndY > parseInt(Y) + parseInt(Height)) {
  3640 +
  3641 + // alert('start Y outside and end Y outside');
  3642 +
  3643 + YforCopyImage = 0;
  3644 + HeightforCopyImage = Height;
  3645 +
  3646 + HeightforTransImage = Height;
  3647 + //alert('Y ' + Y)
  3648 + YforTransImage = parseFloat(Y) - parseInt(TransparencyBoxStartY)//parseFloat(Y) - (24.4);
  3649 + // alert('5')
  3650 + }
  3651 + else if (TransparencyBoxStartY < Y && TransparencyBoxEndY < (parseInt(Y) + parseInt(Height))) {
  3652 +
  3653 + YforCopyImage = 0;
  3654 + HeightforCopyImage = (parseInt(TransparencyBoxEndY)) - parseInt(Y)//(parseInt(Height) + parseInt(Y)) - (parseInt(TransparencyBoxEndY) - parseInt(scope.TransparencyBoxStartY));
  3655 +
  3656 + HeightforTransImage = (parseInt(TransparencyBoxEndY)) - parseInt(Y)// - parseInt(scope.TransparencyBoxStartY));
  3657 +
  3658 + YforTransImage = parseFloat(Y) - parseInt(TransparencyBoxStartY);// - (24.4);
  3659 +
  3660 + }
  3661 + else if (TransparencyBoxStartY > Y && TransparencyBoxEndY > parseInt(Y) + parseInt(Height)) {
  3662 +
  3663 + YforCopyImage = parseInt(TransparencyBoxStartY) - parseInt(Y);
  3664 + HeightforCopyImage = parseInt(Y) + parseInt(Height) - parseInt(TransparencyBoxStartY);
  3665 + HeightforTransImage = parseInt(Y) + parseInt(Height) - parseInt(TransparencyBoxStartY);
  3666 + YforTransImage = 0;
  3667 +
  3668 + }
  3669 + else if (TransparencyBoxStartY > Y && TransparencyBoxEndY < parseInt(Y) + parseInt(Height)) {
  3670 +
  3671 + YforCopyImage = parseInt(TransparencyBoxStartY) - parseInt(Y);
  3672 + HeightforCopyImage = parseInt(TransparencyBoxEndY) - parseInt(TransparencyBoxStartY);
  3673 + HeightforTransImage = parseInt(TransparencyBoxEndY) - parseInt(TransparencyBoxStartY);
  3674 + YforTransImage = 0;
  3675 + }
  3676 +
  3677 +
  3678 + //this changes the transparency when user click on transparency scale(we have already set the original
  3679 + //data on tras canvas irrespective of the trans number, so we can chnage the transparnecy of original data not the manipulated)
  3680 + if (isTransparencyChanged == true) {
  3681 +
  3682 + // var txtTransparencyChange = document.getElementById("txtTransparencyChange");
  3683 +
  3684 + var transNumber = $scope.transNumber;
  3685 +
  3686 + var ctx = document.getElementById('transparencyCanvas').getContext('2d');
  3687 +
  3688 + var imageDa = ctx.getImageData(XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage);
  3689 +
  3690 + // get the image data values
  3691 + var imageData = imageDa.data;
  3692 + var length = imageData.length;
  3693 + // set every fourth value to 50
  3694 + for (var i = 3; i < length; i += 4) {
  3695 + //NIKITA
  3696 + if ($scope.voId == "9" || $scope.voId == "11") {
  3697 +
  3698 + if (imageData[i] == 0) {
  3699 +
  3700 + }
  3701 + else {
  3702 + imageData[i] = ((255) * (parseInt(transNumber))) / 100;
  3703 + }
  3704 + }
  3705 + else {
  3706 + imageData[i] = ((255) * (parseInt(transNumber))) / 100;
  3707 + }
  3708 +
  3709 + // imageData[i] = ((255) * (parseInt(transNumber))) / 100;
  3710 + }
  3711 + // after the manipulation, reset the data
  3712 + // imageDa.data = imageData;
  3713 + // and put the imagedata back to the canvas
  3714 + ctx.putImageData(imageDa, XforTransImage, YforTransImage);
  3715 +
  3716 +
  3717 + }
  3718 + else {
  3719 +
  3720 + //0. get current layer number
  3721 + if ($scope.isResized) {
  3722 + //do nothing
  3723 + }
  3724 + else if (isLayerChanged) {
  3725 + // debugger
  3726 + $scope.layerNumber = parseInt($('#txtlayerNumber').val());
  3727 +
  3728 + }
  3729 + else {
  3730 + var currentLayer = parseInt($('#txtlayerNumber').val());
  3731 +
  3732 + var tranparencyLayer = currentLayer + 1;
  3733 + $scope.layerNumber = tranparencyLayer;
  3734 + }
  3735 +
  3736 + //dedebugger;
  3737 + //1. get the image source
  3738 + var tranparencyImgSrc;
  3739 +
  3740 + tranparencyImgSrc = $scope.GetImageSource(bodyRegionId);
  3741 + var tranparencyMaskImgSrc = $scope.GetMaskImageSource(tranparencyImgSrc);
  3742 + // debugger;
  3743 + var oldCanvas;
  3744 +
  3745 + if (IsMirror == 'Yes') {
  3746 + oldCanvas = document.getElementById('transparencyTempCanvas_MR_' + bodyRegionId)
  3747 + }
  3748 + else {
  3749 + oldCanvas = document.getElementById('transparencyTempCanvas_' + bodyRegionId)
  3750 +
  3751 + }
  3752 +
  3753 + if (oldCanvas != null) {
  3754 + document.getElementById('canvasDiv').removeChild(oldCanvas);
  3755 + }
  3756 +
  3757 + //remove tempmask canvas
  3758 + var oldtempTransCanvasMask;
  3759 + if (IsMirror == 'Yes') {
  3760 + oldtempTransCanvasMask = document.getElementById('transparencyTempCanvasMask_MR_' + bodyRegionId + '_mci');
  3761 + }
  3762 + else {
  3763 + oldtempTransCanvasMask = document.getElementById('transparencyTempCanvasMask_' + bodyRegionId + '_mci');
  3764 +
  3765 + }
  3766 + if (oldtempTransCanvasMask != null) {
  3767 + document.getElementById('canvasDiv').removeChild(oldtempTransCanvasMask);
  3768 + }
  3769 +
  3770 + transparencyTempCanvas = document.createElement('canvas');
  3771 + var transparencyTempcanavsMask = document.createElement('canvas');
  3772 + //if mirror then draw mask image for non mirrored body region for annotation
  3773 + if (IsMirror == 'Yes') {
  3774 + transparencyTempCanvas.id = 'transparencyTempCanvas_MR_' + bodyRegionId;
  3775 + transparencyTempcanavsMask.id = 'transparencyTempCanvasMask_MR' + bodyRegionId + '_mci';
  3776 + }
  3777 + else {
  3778 + transparencyTempCanvas.id = 'transparencyTempCanvas_' + bodyRegionId;
  3779 + transparencyTempcanavsMask.id = 'transparencyTempCanvasMask_' + bodyRegionId + '_mci';
  3780 +
  3781 + }
  3782 + transparencyTempCanvas.height = Height;
  3783 + transparencyTempCanvas.width = Width;
  3784 + transparencyTempCanvas.style.position = "absolute";
  3785 + transparencyTempCanvas.style.left = X + 'px' // x + "px";
  3786 + transparencyTempCanvas.style.top = Y + "px"//y + "px";
  3787 + transparencyTempCanvas.style.visibility = 'hidden';
  3788 + //transparencyTempCanvas.style.visibility = 'visible';
  3789 + // transparencyCanvas.style.zIndex = 4000;
  3790 + document.getElementById('canvasDiv').appendChild(transparencyTempCanvas);
  3791 +
  3792 + //create temp mask canvas
  3793 + transparencyTempcanavsMask.height = Height;
  3794 + transparencyTempcanavsMask.width = Width;
  3795 + transparencyTempcanavsMask.style.position = "absolute";
  3796 + transparencyTempcanavsMask.style.left = X + 'px' // x + "px";
  3797 + transparencyTempcanavsMask.style.top = Y + "px"//y + "px";
  3798 + transparencyTempcanavsMask.style.visibility = 'hidden';
  3799 + //transparencyTempCanvas.style.visibility = 'visible';
  3800 + // transparencyCanvas.style.border = "black 1px solid";
  3801 + document.getElementById('canvasDiv').appendChild(transparencyTempcanavsMask);
  3802 +
  3803 +
  3804 + var tempImg = new Image();
  3805 + tempImg.src = tranparencyImgSrc;//"http://localhost/AIA/" + tranparencyImgSrc;
  3806 +
  3807 +
  3808 + tempImg.onload = function () {
  3809 + // debugger;
  3810 + var tempCtx = transparencyTempCanvas.getContext('2d');
  3811 +
  3812 + if (IsMirror == 'Yes') {
  3813 + //debugger;
  3814 + tempCtx.save();
  3815 + tempCtx.translate(Width, 0);
  3816 + tempCtx.scale(-1, 1);
  3817 + tempCtx.drawImage(tempImg, 0, 0);
  3818 + }
  3819 + else {
  3820 + tempCtx.drawImage(tempImg, 0, 0);
  3821 +
  3822 + }
  3823 + // debugger;
  3824 + var tempCanvasID;
  3825 +
  3826 + if (IsMirror == 'Yes') {
  3827 + tempCanvasID = 'transparencyTempCanvas_MR_' + bodyRegionId;
  3828 + }
  3829 + else {
  3830 + tempCanvasID = 'transparencyTempCanvas_' + bodyRegionId;
  3831 + }
  3832 +
  3833 +
  3834 + //check if transparency is activated
  3835 +
  3836 +
  3837 + var transNumber = $scope.transNumber;//txtTransparencyChange.value;
  3838 + // debugger;
  3839 + //this changes the transparency when transparency is already activated and user resizes or chage the layer
  3840 +
  3841 + var imageD = tempCtx.getImageData(0, 0, Width, Height);
  3842 +
  3843 +
  3844 + var tempCtx = document.getElementById(tempCanvasID).getContext('2d');
  3845 +
  3846 + //keep the original image on temp canavs to use it in changing transparency
  3847 +
  3848 + if (document.getElementById('tempCanvas') != null) {
  3849 + var contx = document.getElementById('tempCanvas').getContext('2d');
  3850 + var tbTempCanvas = document.getElementById(tempCanvasID)
  3851 + contx.drawImage(tbTempCanvas, XforCopyImage, YforCopyImage, WidthforCopyImage, HeightforCopyImage, XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage);
  3852 +
  3853 + }
  3854 +
  3855 + // get the image data values
  3856 +
  3857 + var imageData = imageD.data;
  3858 + var length = imageData.length;
  3859 +
  3860 + //change background of image from transparent to white
  3861 +
  3862 + // set every fourth value to 50
  3863 + for (var i = 3; i < length; i += 4) {
  3864 + //NIKITA
  3865 + if ($scope.voId == "9" || $scope.voId == "11") {
  3866 +
  3867 + if (imageData[i] == 0) {
  3868 +
  3869 + }
  3870 + else {
  3871 + imageData[i] = ((255) * (parseInt(transNumber))) / 100;
  3872 + }
  3873 + }
  3874 + else {
  3875 + imageData[i] = ((255) * (parseInt(transNumber))) / 100;
  3876 + }
  3877 + }
  3878 +
  3879 +
  3880 + tempCtx.putImageData(imageD, 0, 0);
  3881 +
  3882 +
  3883 + var ctx = transparencyCanvas.getContext('2d');
  3884 +
  3885 +
  3886 + var TrtempCanvasID
  3887 + if (IsMirror == 'Yes') {
  3888 + TrtempCanvasID = 'transparencyTempCanvas_MR_' + bodyRegionId;
  3889 + }
  3890 + else {
  3891 + TrtempCanvasID = 'transparencyTempCanvas_' + bodyRegionId;
  3892 + }
  3893 +
  3894 + var tmpCanvasContext = document.getElementById(TrtempCanvasID);//.getContext('2d');
  3895 +
  3896 + ctx.drawImage(tmpCanvasContext, XforCopyImage, YforCopyImage, WidthforCopyImage, HeightforCopyImage, XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage)
  3897 +
  3898 +
  3899 + XforCopyImage = 0;
  3900 + YforCopyImage = 0;
  3901 + WidthforCopyImage = 0;
  3902 + HeightforCopyImage = 0;
  3903 + XforTransImage = 0;
  3904 + WidthforTransImage = 0;
  3905 + HeightforTransImage = 0;
  3906 + YforTransImage = 0;
  3907 + PreviousBodyRegionHeight = 0;
  3908 +
  3909 + }
  3910 +
  3911 +
  3912 + //mask image code
  3913 + //draw mask for annotation
  3914 + var tempMaskImg = new Image();
  3915 + var tranparencyMaskImgSrc = $scope.GetMaskImageSource(tranparencyImgSrc);
  3916 + tempMaskImg.src = tranparencyMaskImgSrc;//"http://localhost/AIA/" + tranparencyMaskImgSrc;
  3917 + tempMaskImg.onload = function () {
  3918 + // debugger;
  3919 + var tempmaskCtx = transparencyTempcanavsMask.getContext('2d');
  3920 +
  3921 + if (IsMirror == 'Yes') {
  3922 + //debugger;
  3923 + tempmaskCtx.save();
  3924 + tempmaskCtx.translate(Width, 0);
  3925 + tempmaskCtx.scale(-1, 1);
  3926 + tempmaskCtx.drawImage(tempMaskImg, 0, 0);
  3927 + }
  3928 + else {
  3929 + tempmaskCtx.drawImage(tempMaskImg, 0, 0);
  3930 +
  3931 + }
  3932 +
  3933 +
  3934 + }
  3935 +
  3936 +
  3937 + PreviousBodyRegionHeight = HeightforTransImage;
  3938 + PreviousBodyRegionY = YforTransImage;
  3939 + PreviousBodyRegionWidth = WidthforTransImage;
  3940 + PreviousBodyRegionX = XforTransImage;
  3941 + previousBodyRegionId = bodyRegionId;
  3942 +
  3943 + // $scope.layerNumber = parseInt($scope.layerNumber - 1);
  3944 +
  3945 + }
  3946 +
  3947 + }
  3948 +
  3949 +
  3950 +
  3951 +
  3952 +
  3953 +
  3954 + function resizeCanvas() {
  3955 + //debugger;
  3956 + // alert('reload')
  3957 + clearTransCanvas();
  3958 + if ($('#speechBubbleTrns').length > 0) {
  3959 + $('#speechBubbleTrns').remove();
  3960 + }
  3961 + var tCanvas = document.getElementById('transparencyCanvas');
  3962 + var tCanvasContext = tCanvas.getContext('2d');
  3963 +
  3964 + var tCanvasHeight = parseInt((tCanvas.style.height).replace('px', ''));
  3965 +
  3966 + var tCanvasWidth = parseInt((tCanvas.style.width).replace('px', ''));
  3967 +
  3968 + var tBoxStartX = parseInt((tCanvas.style.left).replace('px', ''));
  3969 + var tBoxEndX = parseInt((tCanvas.style.left).replace('px', '')) + parseInt((tCanvas.style.width.replace('px', '')));
  3970 + var tBoxStartY = parseInt((tCanvas.style.top).replace('px', ''));
  3971 + var tBoxEndY = parseInt((tCanvas.style.top).replace('px', '')) + parseInt((tCanvas.style.height).replace('px', ''));
  3972 + var transparencyBoxBottom = parseInt(tBoxStartY) + parseInt(tCanvasHeight);
  3973 + var transparencyBoxRight = parseInt(tBoxStartX) + parseInt(tCanvasWidth);
  3974 +
  3975 + if (tCanvas != null) {
  3976 + $('#transparencyCanvas').remove();
  3977 + }
  3978 +
  3979 +
  3980 + $scope.isResized = true;
  3981 +
  3982 +
  3983 + if (tCanvasHeight != $scope.transparencyCanvasHeight || tCanvasWidth != $scope.transparencyCanvasWidth) {
  3984 +
  3985 +
  3986 + var transparencyCanvas = document.createElement('canvas');
  3987 + transparencyCanvas.id = 'transparencyCanvas';
  3988 + $scope.transparencyCanvas = tCanvas.id;
  3989 + transparencyCanvas.height = tCanvasHeight;
  3990 + transparencyCanvas.width = tCanvasWidth;
  3991 + transparencyCanvas.style.position = "absolute";
  3992 + transparencyCanvas.style.left = tCanvas.style.left; // x + "px";
  3993 + transparencyCanvas.style.top = tCanvas.style.top//y + "px";
  3994 + transparencyCanvas.style.border = "black 1px solid";
  3995 + document.getElementById('canvasDiv').appendChild(transparencyCanvas);
  3996 +
  3997 + $('#transparencyCanvas').resizable({ handles: "e,s,se,w,n,ne,nw,sw", stop: function (event, ui) { resizeCanvas(); }, start: function (event, ui) { clearTransCanvas(); } });
  3998 +
  3999 + }
  4000 + $scope.transparencyCanvasHeight = tCanvasHeight;
  4001 + $scope.transparencyCanvasWidth = tCanvasWidth;
  4002 +
  4003 + // debugger;
  4004 + //create temp cavas to retain the original anavs data for use in transparency change as
  4005 + //if u use original canvas data for transprency change then at 0 transparency all data will become transparent and if u increase transparency with this data then the canavs will be blank
  4006 + if (document.getElementById('tempCanvas') != null) {
  4007 + $('#tempCanvas').remove();
  4008 + }
  4009 + var tempCanvas = document.createElement('canvas');
  4010 + tempCanvas.id = 'tempCanvas';
  4011 + $scope.tempCanvas = tempCanvas.id;
  4012 + tempCanvas.height = $scope.transparencyCanvasHeight;
  4013 + tempCanvas.width = $scope.transparencyCanvasWidth;
  4014 + tempCanvas.style.position = "absolute";
  4015 + tempCanvas.style.left = 200 + 'px';
  4016 + tempCanvas.style.backgroundColor = "transparent";
  4017 + tempCanvas.style.visibility = 'hidden';
  4018 + // tempCanvas.style.border = "black 1px solid";
  4019 +
  4020 + document.getElementById('canvasDiv').appendChild(tempCanvas);
  4021 +
  4022 +
  4023 + var BodyRegionDictionary = $rootScope.BodyRegionCordinatesData;
  4024 +
  4025 + $scope.IncludedBodyRegions = [];
  4026 + // $scope.layerNo = parseInt(document.getElementById(''))
  4027 + var counter = 0;
  4028 + $.each(BodyRegionDictionary, function (index, value) {
  4029 +
  4030 + var bodyRegionRight = parseInt(value.X) + parseInt(value.Width);
  4031 + var bodyRegionBottom = parseInt(value.Y) + parseInt(value.Height);
  4032 + var TBRight = parseInt((document.getElementById('transparencyCanvas').style.left).replace('px', '')) + parseInt((document.getElementById('transparencyCanvas').style.width).replace('px', ''));
  4033 + var TBBottom = parseInt((document.getElementById('transparencyCanvas').style.top).replace('px', '')) + parseInt((document.getElementById('transparencyCanvas').style.height).replace('px', ''));
  4034 + var TBStartX = parseInt((document.getElementById('transparencyCanvas').style.left).replace('px', ''));
  4035 + var TBStartY = parseInt((document.getElementById('transparencyCanvas').style.top).replace('px', ''));
  4036 +
  4037 +
  4038 +
  4039 +
  4040 + if (TBStartX <= bodyRegionRight && value.X <= TBRight && TBStartY <= bodyRegionBottom && value.Y <= TBBottom) {
  4041 +
  4042 +
  4043 + $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, $scope.TransparencyBoxStartX, $scope.TransparencyEndX, $scope.TransparencyBoxStartY, $scope.TransparencyBoxEndY, $scope, false, false);
  4044 +
  4045 + }
  4046 +
  4047 +
  4048 + })
  4049 + //bind click listener
  4050 + //bind click listener
  4051 + transparencyCanvas.addEventListener('click', TransparencyCanvasClickListener);
  4052 +
  4053 +
  4054 +
  4055 + // });
  4056 + $(".ui-wrapper").css("z-index", "600");
  4057 + $scope.isResized = false;
  4058 + }
  4059 +
  4060 + function TransparencyCanvasClickListener(evt) {
  4061 + //alert('tb clicked')
  4062 + // debugger;
  4063 + var pixelData;
  4064 + var pixelDataTrans;
  4065 + var mousePos = $scope.getMousePos(evt);
  4066 + // alert(mousePos.x + ',' + mousePos.y);
  4067 +
  4068 + var canvasDiv = document.getElementById('canvasDiv');
  4069 + var verticalScrollPosition = canvasDiv.scrollTop;
  4070 + var horizontlScrollPosition = canvasDiv.scrollLeft;
  4071 +
  4072 +
  4073 + //We substracted 135, as the difference between flex and html coordinates for same organ is 135
  4074 + var actulalX = mousePos.x + horizontlScrollPosition;
  4075 + var actualY = mousePos.y + verticalScrollPosition //- 135; //+ tomenuBarheight + titleBarheight + searchComboheight;
  4076 + var clickedBodyRegion;
  4077 + var x;
  4078 + var y;
  4079 + var isMirror;
  4080 + var width;
  4081 + var BodyRegionDictionary = $rootScope.BodyRegionCordinatesData;
  4082 + $.each(BodyRegionDictionary, function (index, value) {
  4083 +
  4084 + var bodyRegionRight = parseInt(value.X) + parseInt(value.Width);
  4085 + var bodyRegionBottom = parseInt(value.Y) + parseInt(value.Height);
  4086 + if (actulalX <= bodyRegionRight && value.X <= actulalX && actualY <= bodyRegionBottom && value.Y <= actualY) {
  4087 +
  4088 + clickedBodyRegion = value.bodyRegionId;
  4089 + x = value.X;
  4090 + y = value.Y;
  4091 + width = value.Width;
  4092 + isMirror = value.IsMirror;
  4093 + return false;
  4094 + }
  4095 + })
  4096 +
  4097 + if (isMirror == "Yes") {
  4098 +
  4099 + var mirrorCanvasX = x;
  4100 + var mirrorCanvasWidth = width;
  4101 +
  4102 + var clickedCanvasMaskId = 'imageCanvas' + clickedBodyRegion + '_mci';
  4103 + var clickedCanavs = document.getElementById(clickedCanvasMaskId);
  4104 +
  4105 + //if non mirrored canvas does not exist for this irror Body region then draw non mirrored image to get annotation
  4106 + var clickedBodyRegionData = new jinqJs()
  4107 + .from(BodyRegionDictionary)
  4108 + .where('bodyRegionId == ' + clickedBodyRegion)
  4109 + .select();
  4110 + if (clickedBodyRegionData != null || clickedBodyRegionData != undefined) {
  4111 +
  4112 + var nomMirroredBodyRegion = new jinqJs()
  4113 + .from(clickedBodyRegionData)
  4114 + .where('IsMirror == No')
  4115 + .select();
  4116 +
  4117 +
  4118 + //debugger;
  4119 + var oldMirrorMaskId = 'transparencyTempCanvasMask_' + clickedBodyRegion + '_mci';
  4120 + var oldMirrorMask = document.getElementById(oldMirrorMaskId);
  4121 + if (oldMirrorMask != null) {
  4122 + document.getElementById('canvasDiv').removeChild(oldMirrorMask);
  4123 + }
  4124 + var transparencyTempcanavsMask = document.createElement('canvas');
  4125 + transparencyTempcanavsMask.id = 'transparencyTempCanvasMask_' + clickedBodyRegion + '_mci';
  4126 + transparencyTempcanavsMask.height = nomMirroredBodyRegion[0].Height;
  4127 + transparencyTempcanavsMask.width = nomMirroredBodyRegion[0].Width;
  4128 + transparencyTempcanavsMask.style.position = "absolute";
  4129 + transparencyTempcanavsMask.style.left = nomMirroredBodyRegion[0].X + 'px' // x + "px";
  4130 + transparencyTempcanavsMask.style.top = nomMirroredBodyRegion[0].Y + "px"//y + "px";
  4131 + transparencyTempcanavsMask.style.visibility = 'hidden';
  4132 +
  4133 + document.getElementById('canvasDiv').appendChild(transparencyTempcanavsMask);
  4134 +
  4135 + var tranparencyImgSrc = $scope.GetImageSource(clickedBodyRegion);
  4136 + var tempMaskImg = new Image();
  4137 + var tranparencyMaskImgSrc = $scope.GetMaskImageSource(tranparencyImgSrc);
  4138 + tempMaskImg.onload = function () {
  4139 + var tempmaskCtx = transparencyTempcanavsMask.getContext('2d');
  4140 + tempmaskCtx.drawImage(tempMaskImg, 0, 0);
  4141 +
  4142 + //get x,y of non mirrored canvas for this body region
  4143 + x = transparencyTempcanavsMask.style.left;
  4144 + y = transparencyTempcanavsMask.style.top;
  4145 +
  4146 + var maskCanvasTransId = 'transparencyTempCanvasMask_' + clickedBodyRegion + '_mci';
  4147 + var maskCanvastrans = document.getElementById(maskCanvasTransId);
  4148 + var maskCanvasContexttrans = maskCanvastrans.getContext("2d");
  4149 +
  4150 +
  4151 +
  4152 +
  4153 + var canvasDiv = document.getElementById('canvasDiv');
  4154 + var verticalScrollPosition = canvasDiv.scrollTop;
  4155 + var horizontlScrollPosition = canvasDiv.scrollLeft;
  4156 +
  4157 + var distanceXOnMirrorImage = (parseInt(mirrorCanvasX) + parseInt(mirrorCanvasWidth)) - (parseInt(mousePos.x) + horizontlScrollPosition);// - 135);
  4158 +
  4159 + var mirrorXOnNormalImage = parseInt(maskCanvasContexttrans.canvas.offsetLeft) + parseInt(distanceXOnMirrorImage);
  4160 +
  4161 + var actulalX = mirrorXOnNormalImage
  4162 + var actualY = mousePos.y + verticalScrollPosition
  4163 +
  4164 +
  4165 +
  4166 + var clickedCanvasMaskId = 'imageCanvas' + clickedBodyRegion + '_mci';
  4167 + var maskCanvas = document.getElementById(clickedCanvasMaskId);
  4168 + var maskCanvasContext = maskCanvas.getContext("2d");
  4169 + var imgX = Math.round(actulalX - parseInt(x.replace('px', '')));
  4170 + var imgY = Math.round(actualY - parseInt(y.replace('px', '')));
  4171 + pixelData = maskCanvasContext.getImageData(imgX, imgY, 1, 1);
  4172 +
  4173 +
  4174 + //trans layer image data
  4175 + pixelDataTrans = maskCanvasContexttrans.getImageData(imgX, imgY, 1, 1);
  4176 + // console.log('at the time' + pixelData.data[0])
  4177 + // debugger;
  4178 + var annotations = $scope.getAnnotationForTransparencyBox(pixelData, pixelDataTrans, $scope);
  4179 + if ($('#speechBubble').length > 0)
  4180 + $('#speechBubble').remove();
  4181 +
  4182 +
  4183 + if ($('#speechBubbleTrns').length > 0) {
  4184 + $('#speechBubbleTrns').remove();
  4185 +
  4186 + // createSpeechBubbleOnTransparencyBox(evt, annotations.annotationT1, annotations.annotationT2, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50)
  4187 +
  4188 + $scope.annotationTextArrayT1 = [];
  4189 + $scope.annotationTextArrayT2 = [];
  4190 + $scope.annotationTextArrayT1.push(annotations.annotationT1);
  4191 + $scope.annotationTextArrayT2.push(annotations.annotationT2);
  4192 +
  4193 + $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, false);
  4194 + }
  4195 + else
  4196 + // createSpeechBubbleOnTransparencyBox(evt, annotations.annotationT1, annotations.annotationT2, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50)
  4197 +
  4198 + $scope.annotationTextArrayT1 = [];
  4199 + $scope.annotationTextArrayT2 = [];
  4200 + $scope.annotationTextArrayT1.push(annotations.annotationT1);
  4201 + $scope.annotationTextArrayT2.push(annotations.annotationT2);
  4202 +
  4203 + $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, false);
  4204 + }
  4205 + tempMaskImg.src = "http://localhost/AIAHtml/" + tranparencyMaskImgSrc;
  4206 +
  4207 +
  4208 + }
  4209 +
  4210 + }
  4211 + else {
  4212 +
  4213 + var clickedCanvasMaskId = 'imageCanvas' + clickedBodyRegion + '_mci';
  4214 + var maskCanvas = document.getElementById(clickedCanvasMaskId);
  4215 + var maskCanvasContext = maskCanvas.getContext("2d");
  4216 +
  4217 + //transparecncy canvas
  4218 + var maskCanvasTransId = 'transparencyTempCanvasMask_' + clickedBodyRegion + '_mci';
  4219 + var maskCanvastrans = document.getElementById(maskCanvasTransId);
  4220 + var maskCanvasContexttrans = maskCanvastrans.getContext("2d");
  4221 +
  4222 + pixelData = maskCanvasContext.getImageData(Math.round(actulalX - x), Math.round(actualY - y), 1, 1);
  4223 +
  4224 + pixelDataTrans = maskCanvasContexttrans.getImageData(Math.round(actulalX - x), Math.round(actualY - y), 1, 1);
  4225 + var annotations = $scope.getAnnotationForTransparencyBox(pixelData, pixelDataTrans, $scope);
  4226 + //var annotations = $scope.getAnnotationForTransparencyBox(pixelData, pixelDataTrans, $scope);
  4227 +
  4228 + if ($('#speechBubble').length > 0)
  4229 + $('#speechBubble').remove();
  4230 +
  4231 + if ($('#speechBubbleTrns').length > 0) {
  4232 + $('#speechBubbleTrns').remove();
  4233 +
  4234 + // $scope.createSpeechBubbleOnTransparencyBox(evt, annotations.annotationT1, annotations.annotationT2, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50)
  4235 + $scope.annotationTextArrayT1 = [];
  4236 + $scope.annotationTextArrayT2 = [];
  4237 + $scope.annotationTextArrayT1.push(annotations.annotationT1);
  4238 + $scope.annotationTextArrayT2.push(annotations.annotationT2);
  4239 +
  4240 + $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, false);
  4241 + }
  4242 + else
  4243 + // $scope.createSpeechBubbleOnTransparencyBox(evt, annotations.annotationT1, annotations.annotationT2, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50)
  4244 +
  4245 +
  4246 + $scope.annotationTextArrayT1 = [];
  4247 + $scope.annotationTextArrayT2 = [];
  4248 + $scope.annotationTextArrayT1.push(annotations.annotationT1);
  4249 + $scope.annotationTextArrayT2.push(annotations.annotationT2);
  4250 +
  4251 + $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, false);
  4252 +
  4253 +
  4254 + }
  4255 + //debugger;
  4256 + }
  4257 + function clearTransCanvas() {
  4258 +
  4259 + var tCanvas = document.getElementById('transparencyCanvas');
  4260 + if (tCanvas != null) {
  4261 + var tCanvasContext = tCanvas.getContext('2d');
  4262 + tCanvasContext.clearRect(0, 0, parseInt(tCanvas.style.width), parseInt(tCanvas.style.height));
  4263 + }
  4264 +
  4265 + }
  4266 +
  4267 +
  4268 + $scope.getAnnotationForTransparencyBox = function (pixelData, pixelDataTrans, scope) {
  4269 +
  4270 +
  4271 +
  4272 + pixelData.data[0] = pixelData.data[0] - 9;
  4273 + pixelData.data[1] = pixelData.data[1] - 9;
  4274 + pixelData.data[2] = pixelData.data[2] - 9;
  4275 +
  4276 + //trans pixel data
  4277 + pixelDataTrans.data[0] = pixelDataTrans.data[0] - 9;
  4278 + pixelDataTrans.data[1] = pixelDataTrans.data[1] - 9;
  4279 + pixelDataTrans.data[2] = pixelDataTrans.data[2] - 9;
  4280 +
  4281 + var Red;
  4282 + var Green;
  4283 + var Blue;
  4284 + var zero = "0";
  4285 +
  4286 + if ((pixelData.data[0]).toString().length != 2) {
  4287 + Red = zero.concat((pixelData.data[0]).toString())
  4288 + }
  4289 + else {
  4290 + Red = (pixelData.data[0]).toString()
  4291 + }
  4292 + if ((pixelData.data[1]).toString().length != 2) {
  4293 + Green = zero.concat((pixelData.data[1]).toString())
  4294 + }
  4295 + else {
  4296 + Green = (pixelData.data[1]).toString()
  4297 +
  4298 + }
  4299 + if ((pixelData.data[2]).toString().length != 2) {
  4300 + Blue = zero.concat((pixelData.data[2]).toString())
  4301 + }
  4302 + else {
  4303 + Blue = (pixelData.data[2]).toString()
  4304 +
  4305 + }
  4306 + var RGBColor = (Red + Green + Blue);
  4307 +
  4308 +
  4309 + var annotationText1 = $scope.GetAnnotationText(parseInt(RGBColor));
  4310 +
  4311 + //get annotation for trans canavs
  4312 + var RedTrans;
  4313 + var GreenTrans;
  4314 + var BlueTrans;
  4315 + var zero = "0";
  4316 +
  4317 + if ((pixelDataTrans.data[0]).toString().length != 2) {
  4318 + RedTrans = zero.concat((pixelDataTrans.data[0]).toString())
  4319 + }
  4320 + else {
  4321 + RedTrans = (pixelDataTrans.data[0]).toString()
  4322 + }
  4323 + if ((pixelDataTrans.data[1]).toString().length != 2) {
  4324 + GreenTrans = zero.concat((pixelDataTrans.data[1]).toString())
  4325 + }
  4326 + else {
  4327 + GreenTrans = (pixelDataTrans.data[1]).toString()
  4328 +
  4329 + }
  4330 + if ((pixelDataTrans.data[2]).toString().length != 2) {
  4331 + BlueTrans = zero.concat((pixelDataTrans.data[2]).toString())
  4332 + }
  4333 + else {
  4334 + BlueTrans = (pixelDataTrans.data[2]).toString()
  4335 +
  4336 + }
  4337 + var RGBColorTrans = (RedTrans + GreenTrans + BlueTrans);
  4338 +
  4339 +
  4340 + var annotationText2 = $scope.GetAnnotationText(parseInt(RGBColorTrans));
  4341 +
  4342 + return {
  4343 + annotationT1: annotationText1,
  4344 + annotationT2: annotationText2
  4345 + }
  4346 + }
  4347 +
  4348 +
  4349 + $scope.onTransparencyChange = function (ev, ui) {
  4350 + //debugger;
  4351 + // alert('t change')
  4352 + $scope.transNumber = ui.value;
  4353 +
  4354 + var tCanvas = document.getElementById('transparencyCanvas');
  4355 + var tCanvasContext = tCanvas.getContext('2d');
  4356 +
  4357 + var tCanvasHeight = parseInt((tCanvas.style.height).replace('px', ''));
  4358 +
  4359 + var tCanvasWidth = parseInt((tCanvas.style.width).replace('px', ''));
  4360 +
  4361 + var tBoxStartX = parseInt((tCanvas.style.left).replace('px', ''));
  4362 + var tBoxEndX = parseInt((tCanvas.style.left).replace('px', '')) + parseInt((tCanvas.style.width.replace('px', '')));
  4363 + var tBoxStartY = parseInt((tCanvas.style.top).replace('px', ''));
  4364 + var tBoxEndY = parseInt((tCanvas.style.top).replace('px', '')) + parseInt((tCanvas.style.height).replace('px', ''));
  4365 + var transparencyBoxBottom = parseInt(tBoxStartY) + parseInt(tCanvasHeight);
  4366 + var transparencyBoxRight = parseInt(tBoxStartX) + parseInt(tCanvasWidth);
  4367 +
  4368 + //var scope = angular.element(document.getElementById("DAView")).scope();
  4369 + //scope.$apply(function () {
  4370 + var arr = [];
  4371 + $scope.transparencyChangeCounter++;
  4372 + //before changing the transparency of first canvas, hold the orignal canvas data on temp canvas
  4373 +
  4374 + //put original data on transcanvas so that it can be used to change transparency properly
  4375 + var tempCanavs = document.getElementById('tempCanvas');
  4376 + var tempCanvasContext = tempCanavs.getContext('2d');
  4377 +
  4378 + var originalTransparencyData = tempCanvasContext.getImageData(0, 0, $scope.transparencyCanvasWidth, $scope.transparencyCanvasHeight);
  4379 + var ctx = document.getElementById('transparencyCanvas').getContext('2d');
  4380 + ctx.putImageData(originalTransparencyData, 0, 0);
  4381 +
  4382 +
  4383 + var BodyRegionDictionary = $rootScope.BodyRegionCordinatesData;
  4384 +
  4385 + $scope.IncludedBodyRegions = [];
  4386 + var counter = 0;
  4387 + $.each(BodyRegionDictionary, function (index, value) {
  4388 +
  4389 + var bodyRegionRight = parseInt(value.X) + parseInt(value.Width);
  4390 + var bodyRegionBottom = parseInt(value.Y) + parseInt(value.Height);
  4391 +
  4392 +
  4393 +
  4394 + if (tBoxStartX <= bodyRegionRight && value.X <= transparencyBoxRight && tBoxStartY <= bodyRegionBottom && value.Y <= transparencyBoxBottom) {
  4395 +
  4396 + $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, $scope.TransparencyBoxStartX, $scope.TransparencyEndX, $scope.TransparencyBoxStartY, $scope.TransparencyBoxEndY, $scope, false, true);
  4397 +
  4398 + }
  4399 +
  4400 + });
  4401 +
  4402 +
  4403 +
  4404 + // });
  4405 + }
  4406 +
  4407 + $scope.CloseTransparencyBox = function () {
  4408 +
  4409 + $('.com_anno').css('display', 'none');
  4410 +
  4411 + $('#sppeachBubble_annotation').css('display', 'none');
  4412 + $('#dot_annotation').css('display', 'none');
  4413 + $('#bord_annotation').css('display', 'none');
  4414 +
  4415 + var tBox = document.getElementById('transparencyCanvas');
  4416 +
  4417 +
  4418 + if (tBox != null) {
  4419 + tBox.parentNode.removeChild(tBox)
  4420 + var elements = document.getElementsByClassName('ui-icon ui-icon-gripsmall-diagonal-se');
  4421 + while (elements.length > 0) {
  4422 + elements[0].parentNode.removeChild(elements[0]);
  4423 + }
  4424 + //var txtTransparencyChange = document.getElementById("txtTransparencyChange");
  4425 + //txtTransparencyChange.value = 0;
  4426 + // document.getElementById('txtLayerNumber').value = 0;
  4427 + // debugger;
  4428 +
  4429 +
  4430 + $('#layerChangeSlider').slider("option", "value", parseInt($scope.totalLayers) - parseInt($scope.currentLayerNumber));
  4431 + $("#txtlayerNumber").val(parseInt($scope.currentLayerNumber));
  4432 +
  4433 +
  4434 + if (document.getElementById('tempCanvas') != null) {
  4435 + $('#tempCanvas').remove();
  4436 + }
  4437 + if ($('#speechBubbleTrns').length > 0) {
  4438 + $('#speechBubbleTrns').remove();
  4439 + }
  4440 + //var scope = angular.element(document.getElementById("DAView")).scope();
  4441 + //scope.$apply(function () {
  4442 + // $scope.layerNumber = 0;
  4443 + $scope.isTransparencyActivated = false;
  4444 + //})
  4445 +
  4446 +
  4447 + var tempCanvases = $("canvas[id*='transparencyTempCanvas']");
  4448 + for (var i = 0; i < tempCanvases.length; i++) {
  4449 + tempCanvases[i].remove();
  4450 + }
  4451 +
  4452 + $('.ui-wrapper').remove();
  4453 +
  4454 + //$("canvas[name*='transparencyTempCanvas']").nextUntil($("canvas[name*='transparencyTempCanvas']"))
  4455 + //.remove();
  4456 + $scope.layerNumber = $scope.currentLayerNumber;
  4457 + $scope.transNumber = 50;
  4458 + $(".slider").slider({ value: 50 })
  4459 + }
  4460 + $('#transparencyScale').css('visibility', 'hidden');
  4461 +
  4462 + $scope.isTransparencyActivated = false;
  4463 + // document.getElementById('btnTranparency').className = 't-transparency'
  4464 + $('#btnTranparency').removeClass('tButtonActive');
  4465 + $('#btnTranparency').addClass('btn-black');
  4466 + $('#btnIdentity').removeClass('btn-black');
  4467 +
  4468 + $('#btnIdentity').addClass('btn-primary');
  4469 +
  4470 + document.getElementById('btnTranparency').removeEventListener("click", $scope.createTransparencyBox);
  4471 +
  4472 + }
  4473 +
  4474 + $scope.createSpeechBubbleOnTransparencyBox = function (event, text1, text2, x, y) {
  4475 +
  4476 + $('#canvasDiv').css('cursor', 'pointer');
  4477 + $('<div id="speechBubbleTrns" class="BubbleDiv" style="display:visible; top:' + y + 'px; left:' + x + 'px;z-index:700"> <div class="">'
  4478 + + '<div class="Bubble">'
  4479 + + '<div class="BubbleCloseBtn"></div><div class="BubbleContent">' + text1 + '</div><div class="BubbleContent">' + text2 + '</div><div class="bottomLeftArrow"></div>'
  4480 + //+'<div class="bottomRightArrow"></div><div class="topLeftArrow"></div><div class="topRightArrow"></div>
  4481 + + '</div></div></div>').appendTo('#canvasDiv');
  4482 +
  4483 + $('#speechBubbleTrns').on('click', '.BubbleCloseBtn', function (e) {
  4484 + $('#speechBubbleTrns').css('display', 'none');
  4485 + });
  4486 +
  4487 + $('#canvasDiv').attr("data-bubbleid", "speechBubble")
  4488 +
  4489 +
  4490 + };
  4491 +
  4492 +
  4493 + function positionTooltip(event, x, y) {
  4494 + // alert('positionTooltip')
  4495 + x = 100,
  4496 + y = 200,
  4497 +
  4498 + $('div.speech-bubble').css({
  4499 + 'position': 'absolute', 'top': x, 'left': y, 'background-color': '#f8f8f8',
  4500 + 'border': '2px solid #c8c8c8', 'width': '150px', 'height': '50px'
  4501 + });
  4502 +
  4503 +
  4504 + $('.arrow').css({
  4505 + 'border-style': 'solid',
  4506 + 'position': 'absolute'
  4507 + });
  4508 +
  4509 + $('.bottom').css({
  4510 + 'border-color': '#c8c8c8 transparent transparent transparent',
  4511 + 'border-width': ' 8px 8px 0px 8px',
  4512 + 'bottom': -'8px'
  4513 + })
  4514 + };
  4515 +
  4516 +
  4517 + $scope.OnIdentityClick = function () {
  4518 +
  4519 +
  4520 + //if listanager is visisble then close it
  4521 +
  4522 + $rootScope.isListManagerSelected = false;
  4523 + $rootScope.CloseListManager();
  4524 + // $('#btnIdentity').addClass('btn-primary');
  4525 +
  4526 + if ($scope.isTransparencyActivated == true) {
  4527 +
  4528 + $scope.isTransparencyActivated = false;
  4529 +
  4530 + var canvasDiv = document.getElementById('canvasDiv');
  4531 + canvasDiv.removeEventListener("mousedown", mouseDownListener);
  4532 +
  4533 + canvasDiv.removeEventListener("mousemove", mouseMoveListener);
  4534 +
  4535 + canvasDiv.removeEventListener("mouseup", mouseUpListener)
  4536 + $('#btnTranparency').removeClass('tButtonActive');
  4537 + $('#btnTranparency').addClass('btn-black');
  4538 + }
  4539 +
  4540 + }
  4541 +
  4542 + $scope.enableZoom = function () {
  4543 +
  4544 +
  4545 + //if listanager is visisble then close it
  4546 +
  4547 + $rootScope.isListManagerSelected = false;
  4548 + $rootScope.CloseListManager();
  4549 +
  4550 + $('#sppeachBubble').css('display', 'none');
  4551 +
  4552 + $("#dot").css("display", "none");
  4553 +
  4554 + $scope.terminateCurrentlyRunningWPs();
  4555 +
  4556 + if ($scope.isTransparencyActivated) {
  4557 +
  4558 + $scope.CloseTransparencyBox();
  4559 +
  4560 + }
  4561 +
  4562 + $rootScope.isZoomed = true;
  4563 + //1.
  4564 +
  4565 + $scope.flushCanvas();
  4566 +
  4567 + if ($scope.zoomInOut == 25) {
  4568 + $scope.zoomInOut = 75;
  4569 +
  4570 + }
  4571 + else {
  4572 + $scope.zoomInOut = 25;
  4573 + }
  4574 +
  4575 + //2.
  4576 + $scope.CalculateImageCordinates($rootScope.viewOrientationId);
  4577 +
  4578 + //3.
  4579 + if ($scope.zoomInOut == 25)
  4580 + $('#canvasDiv').scrollLeft(0)
  4581 + else
  4582 + $('#canvasDiv').scrollLeft($('#canvasDiv').width() / 2)
  4583 +
  4584 + //remove annotation speech bubble
  4585 + if ($('#dot').length > 0) {
  4586 + $('#dot').remove();
  4587 + }
  4588 +
  4589 + if ($('#sppeachBubble').length > 0) {
  4590 + $('#sppeachBubble').remove();
  4591 + }
  4592 +
  4593 + //4.
  4594 + if ($rootScope.isHighLight == true) {
  4595 +
  4596 + $timeout(function () { $scope.highLightBody() }, 50);
  4597 + }
  4598 + }
  4599 +
  4600 +
  4601 + $scope.flushCanvas = function () {
  4602 +
  4603 + //if ($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined) {
  4604 + // angular.forEach($scope.ColoredImageSRC, function (value, key) {
  4605 +
  4606 + // var id;
  4607 + // var maskId;
  4608 + // if (value.haveMirror == 'true') {
  4609 + // id = 'imageCanvas' + value.bodyRegionId + '_MR';
  4610 + // maskId = 'imageCanvas' + value.bodyRegionId + '_MR_mci'
  4611 + // }
  4612 + // else {
  4613 + // id = 'imageCanvas' + value.bodyRegionId;
  4614 + // maskId = 'imageCanvas' + value.bodyRegionId + '_mci';
  4615 + // }
  4616 +
  4617 + // var canvas = document.getElementById(id);
  4618 + // if (canvas != null || canvas != undefined) {
  4619 + // document.getElementById('canvasDiv').removeChild(canvas);
  4620 + // }
  4621 +
  4622 + // var maskcanvas = document.getElementById(maskId);
  4623 + // if (maskcanvas != null || maskcanvas != undefined) {
  4624 + // document.getElementById('canvasDiv').removeChild(maskcanvas);
  4625 +
  4626 + // }
  4627 + // if (i == 4 || i == 5 || i == 6) {
  4628 + // id = 'imageCanvas' + i + '_MR';
  4629 + // maskId = 'imageCanvas' + i + '_MR_mci';
  4630 +
  4631 + // var canvas = document.getElementById(id);
  4632 + // if (canvas != null || canvas != undefined)
  4633 + // document.getElementById('canvasDiv').removeChild(canvas);
  4634 +
  4635 + // var maskcanvas = document.getElementById(maskId);
  4636 + // if (maskcanvas != null || maskcanvas != undefined)
  4637 + // document.getElementById('canvasDiv').removeChild(maskcanvas);
  4638 + // }
  4639 +
  4640 + // var modestyCanvases = $("canvas[id*='imageCanvasmodestyImg']");
  4641 + // for (var i = 0; i < modestyCanvases.length; i++) {
  4642 + // modestyCanvases[i].remove();
  4643 + // }
  4644 + // });
  4645 + // //remove modesty canavs
  4646 + // var modestyCanvases = $("canvas[id*='imageCanvasmodestyImg']");
  4647 + // if (modestyCanvases != null || modestyCanvases != undefined && modestyCanvases.length > 0) {
  4648 + // for (var j = 0; j < modestyCanvases.length; j++) {
  4649 + // modestyCanvases[j].remove();
  4650 + // }
  4651 + // }
  4652 + //}
  4653 +
  4654 + for (var i = 1; i < 7; i++) {
  4655 +
  4656 + var id;
  4657 + var maskId;
  4658 +
  4659 + id = 'imageCanvas' + i;
  4660 + maskId = 'imageCanvas' + i + '_mci';
  4661 +
  4662 + var canvas = document.getElementById(id);
  4663 + if (canvas != null || canvas != undefined)
  4664 + document.getElementById('canvasDiv').removeChild(canvas);
  4665 +
  4666 + var maskcanvas = document.getElementById(maskId);
  4667 + if (maskcanvas != null || maskcanvas != undefined)
  4668 + document.getElementById('canvasDiv').removeChild(maskcanvas);
  4669 +
  4670 + if (i == 4 || i == 5 || i == 6) {
  4671 + id = 'imageCanvas' + i + '_MR';
  4672 + maskId = 'imageCanvas' + i + '_MR_mci';
  4673 +
  4674 + var canvas = document.getElementById(id);
  4675 + if (canvas != null || canvas != undefined)
  4676 + document.getElementById('canvasDiv').removeChild(canvas);
  4677 +
  4678 + var maskcanvas = document.getElementById(maskId);
  4679 + if (maskcanvas != null || maskcanvas != undefined)
  4680 + document.getElementById('canvasDiv').removeChild(maskcanvas);
  4681 + }
  4682 +
  4683 + //remove modesty canavs
  4684 + var modestyCanvases = $("canvas[id*='imageCanvasmodestyImg']");
  4685 + if (modestyCanvases != null || modestyCanvases != undefined && modestyCanvases.length > 0) {
  4686 + for (var j = 0; j < modestyCanvases.length; j++) {
  4687 + modestyCanvases[j].remove();
  4688 + }
  4689 + }
  4690 + }
  4691 + }
  4692 +
  4693 + $scope.terminateCurrentlyRunningWPs = function () {
  4694 + if ($scope.runningWorkers != null || $scope.runningWorkers != undefined) {
  4695 + var workerCount = $scope.runningWorkers.length;
  4696 + if (workerCount > 0) {
  4697 + for (var i = workerCount - 1; i >= 0; i--) {
  4698 + var runningWorker = $scope.runningWorkers[i].workerName;
  4699 + runningWorker.terminate();
  4700 + $scope.runningWorkers.splice(i, 1);
  4701 + // workerCount--;
  4702 + }
  4703 + }
  4704 + }
  4705 + }
  4706 +
  4707 +
  4708 + $scope.enableHighlight = function () {
  4709 +
  4710 +
  4711 +
  4712 +
  4713 + //if listanager is visisble then close it
  4714 +
  4715 + // $rootScope.isListManagerSelected = false;
  4716 + $rootScope.CloseListManager();
  4717 +
  4718 + if ($rootScope.isHighLight == true) {
  4719 +
  4720 + }
  4721 + else {
  4722 + $rootScope.isHighLight = true;
  4723 + $rootScope.isNormalMode = false;
  4724 + $rootScope.isZoomed = false;
  4725 +
  4726 + if ($rootScope.isExtract == true) {
  4727 + //1.
  4728 + $rootScope.isExtract = false;
  4729 +
  4730 + //2.
  4731 + $scope.flushCanvas();
  4732 +
  4733 + //3.
  4734 + $scope.CalculateImageCordinates($rootScope.viewOrientationId);
  4735 +
  4736 +
  4737 + }
  4738 + else {
  4739 + console.log('highLightBody from enableHighlight')
  4740 + $timeout(function () { $scope.highLightBody() }, 50);
  4741 + }
  4742 +
  4743 + }
  4744 +
  4745 + // unhighlight other
  4746 +
  4747 + //$scope.Normal = "";
  4748 + //$scope.Extract = "";
  4749 + //$scope.Highlight = "LeftButtonsDefaultState";
  4750 +
  4751 + $("#btnHighLight").addClass("btn-primary");
  4752 + $("#btnHighLight").removeClass("btn-black");
  4753 +
  4754 + if (!$("#btnNormalMode").hasClass("btn-black")) {
  4755 + $("#btnNormalMode").addClass("btn-black");
  4756 + }
  4757 +
  4758 + if (!$("#btnExtract").hasClass("btn-black")) {
  4759 + $("#btnExtract").addClass("btn-black");
  4760 + }
  4761 +
  4762 + if ($("#btnExtract").hasClass("btn-primary")) {
  4763 + $("#btnExtract").removeClass("btn-primary");
  4764 + }
  4765 +
  4766 + if ($("#btnNormalMode").hasClass("btn-primary")) {
  4767 + $("#btnNormalMode").removeClass("btn-primary");
  4768 + }
  4769 + }
  4770 +
  4771 + $scope.enableNormalMode = function () {
  4772 +
  4773 +
  4774 + //if listanager is visisble then close it
  4775 +
  4776 + // $rootScope.isListManagerSelected = false;
  4777 + $rootScope.CloseListManager();
  4778 +
  4779 + if ($rootScope.isNormalMode == true) {
  4780 +
  4781 + }
  4782 + else {
  4783 +
  4784 + //1.
  4785 + $scope.flushCanvas();
  4786 +
  4787 + //2.
  4788 + $rootScope.isNormalMode = true;
  4789 +
  4790 + //3.
  4791 + $rootScope.isHighLight = false;
  4792 +
  4793 + //4.
  4794 + $rootScope.isExtract = false;
  4795 +
  4796 + //5.
  4797 + $rootScope.isZoomed = false;
  4798 +
  4799 + //6.
  4800 + $scope.CalculateImageCordinates($rootScope.viewOrientationId);
  4801 +
  4802 +
  4803 + }
  4804 +
  4805 + //$scope.Normal = "LeftButtonsDefaultState";
  4806 + //$scope.Extract = "";
  4807 + //$scope.Highlight = "";
  4808 + $("#btnNormalMode").addClass("btn-primary");
  4809 + $("#btnNormalMode").removeClass("btn-black");
  4810 +
  4811 + if (!$("#btnExtract").hasClass("btn-black")) {
  4812 + $("#btnExtract").addClass("btn-black");
  4813 + }
  4814 +
  4815 + if (!$("#btnHighLight").hasClass("btn-black")) {
  4816 + $("#btnHighLight").addClass("btn-black");
  4817 + }
  4818 +
  4819 + if ($("#btnExtract").hasClass("btn-primary")) {
  4820 + $("#btnExtract").removeClass("btn-primary");
  4821 + }
  4822 +
  4823 + if ($("#btnHighLight").hasClass("btn-primary")) {
  4824 + $("#btnHighLight").removeClass("btn-primary");
  4825 + }
  4826 + }
  4827 +
  4828 + $scope.enableExtract = function () {
  4829 +
  4830 +
  4831 +
  4832 + //if listanager is visisble then close it
  4833 +
  4834 + // $rootScope.isListManagerSelected = false;
  4835 + $rootScope.CloseListManager();
  4836 + //1.
  4837 + $rootScope.isLoading = true;
  4838 + $('#spinner').css('visibility', 'visible');
  4839 +
  4840 + //2.
  4841 + $scope.terminateCurrentlyRunningWPs();
  4842 +
  4843 + //3.
  4844 + if ($rootScope.isExtract == true) {
  4845 +
  4846 + }
  4847 + else {
  4848 + $rootScope.isExtract = true;
  4849 +
  4850 +
  4851 + if ($rootScope.isNormalMode == true) {
  4852 +
  4853 + $rootScope.isHighLight = false;
  4854 + $rootScope.isNormalMode = false;
  4855 + }
  4856 + else {
  4857 + $rootScope.isNormalMode = false;
  4858 + $rootScope.isHighLight = false;
  4859 + }
  4860 +
  4861 + //4.
  4862 + console.log('highLightBody from enableExtract')
  4863 + $scope.highLightBody();
  4864 +
  4865 +
  4866 + }
  4867 +
  4868 + //5. unhighlight other
  4869 + //$scope.Normal = "";
  4870 + //$scope.Extract = "LeftButtonsDefaultState";
  4871 + //$scope.Highlight = "";
  4872 +
  4873 + $("#btnExtract").addClass("btn-primary");
  4874 + $("#btnExtract").removeClass("btn-black");
  4875 +
  4876 + if (!$("#btnNormalMode").hasClass("btn-black")) {
  4877 + $("#btnNormalMode").addClass("btn-black");
  4878 + }
  4879 +
  4880 + if (!$("#btnHighLight").hasClass("btn-black")) {
  4881 + $("#btnHighLight").addClass("btn-black");
  4882 + }
  4883 +
  4884 + if ($("#btnNormalMode").hasClass("btn-primary")) {
  4885 + $("#btnNormalMode").removeClass("btn-primary");
  4886 + }
  4887 +
  4888 + if ($("#btnHighLight").hasClass("btn-primary")) {
  4889 + $("#btnHighLight").removeClass("btn-primary");
  4890 + }
  4891 + }
  4892 +
  4893 + $scope.enableShowHideStructureBox = function () {
  4894 +
  4895 +
  4896 + //if listanager is visisble then close it
  4897 +
  4898 + $rootScope.isListManagerSelected = false;
  4899 + $rootScope.CloseListManager();
  4900 +
  4901 + $(".com").toggle();
  4902 + $('#dot').toggle();
  4903 + $('#sppeachBubble').toggle()
  4904 + }
  4905 +
  4906 +
  4907 +
  4908 + $scope.highLightBody = function () {
  4909 +
  4910 + $scope.Normal = "";
  4911 + $scope.Extract = "";
  4912 + $scope.Highlight = "LeftButtonsDefaultState";
  4913 +
  4914 + console.log('highLightBody is called and ColoredImageSRC length: ' + $scope.ColoredImageSRC.length);
  4915 +
  4916 + $scope.terminateCurrentlyRunningWPs();
  4917 +
  4918 + //different body views have different count of bodyegions so the length of ColoredImageSRC will be different
  4919 + if (($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined)) {
  4920 +
  4921 + if ((($rootScope.viewOrientationId == '1') || ($rootScope.viewOrientationId == '4')) && ($scope.ColoredImageSRC.length == 9)) {
  4922 + $scope.doHighlightOrExtract = true;
  4923 + }
  4924 + else if ((($rootScope.viewOrientationId == '2') || ($rootScope.viewOrientationId == '3')) && ($scope.ColoredImageSRC.length == 5)) {
  4925 + $scope.doHighlightOrExtract = true;
  4926 + }
  4927 + else if ((($rootScope.viewOrientationId == '5')) && ($scope.ColoredImageSRC.length == 4)) {
  4928 + $scope.doHighlightOrExtract = true;
  4929 + }
  4930 + else if ((($rootScope.viewOrientationId == '6')) && ($scope.ColoredImageSRC.length == 1)) {
  4931 + $scope.doHighlightOrExtract = true;
  4932 + }
  4933 + else {
  4934 + $scope.doHighlightOrExtract = false;
  4935 + }
  4936 +
  4937 +
  4938 + if ($scope.doHighlightOrExtract == true) {
  4939 + if ($rootScope.isHighLight == true) {
  4940 +
  4941 + $scope.grayedBR = [];
  4942 +
  4943 + angular.forEach($scope.ColoredImageSRC, function (value, key) {
  4944 + console.log('$scope.ColoredImageSRC length before gray= ' + $scope.ColoredImageSRC.length)
  4945 + var id;
  4946 + if (value.haveMirror == 'true') {
  4947 + id = 'imageCanvas' + value.bodyRegionId + '_MR';
  4948 + }
  4949 + else {
  4950 + id = 'imageCanvas' + value.bodyRegionId;
  4951 + }
  4952 +
  4953 + var imageCanvas = document.getElementById(id);
  4954 +
  4955 + var width = value.Width;
  4956 + var ht = value.Height;
  4957 +
  4958 + var coloredCanvasContext = imageCanvas.getContext("2d");
  4959 + var coloredImageData = coloredCanvasContext.getImageData(0, 0, width, ht);
  4960 + var coloredImageDataVar = coloredImageData;
  4961 +
  4962 +
  4963 + if (value.haveMirror == 'true') {
  4964 + $rootScope.coloredImageMRCanvasList[parseInt(value.bodyRegionId)] = coloredImageDataVar;
  4965 + }
  4966 + else {
  4967 +
  4968 +
  4969 + $rootScope.coloredImageCanvasList[parseInt(value.bodyRegionId - 1)] = coloredImageDataVar;
  4970 +
  4971 + }
  4972 +
  4973 +
  4974 + var context_gray = imageCanvas.getContext('2d');
  4975 +
  4976 + var dataURL = imageCanvas.toDataURL();
  4977 +
  4978 +
  4979 + var img = new Image();
  4980 +
  4981 + img.src = dataURL;
  4982 +
  4983 + img.onload = function () {
  4984 + console.log('Before BitmapData call, width: ' + Math.max(img.width) + ', height: ' + Math.max(img.height) + ' value.bodyRegionId= '
  4985 + + value.bodyRegionId)
  4986 +
  4987 + var DAData = new BitmapData(Math.max(img.width), Math.max(img.height));
  4988 + DAData.draw(img);
  4989 +
  4990 + var colorMode;
  4991 +
  4992 + if ($scope.isExtract == true) {
  4993 + colorMode = $scope.applyWhiteMatrix(img, context_gray);
  4994 + }
  4995 + else {
  4996 + colorMode = $scope.applyGrayMatrix(img, context_gray);
  4997 + }
  4998 +
  4999 + var zeroPoint = new Point();
  5000 +
  5001 + DAData.applyFilter(DAData, DAData.rect, zeroPoint, colorMode);
  5002 +
  5003 +
  5004 + context_gray.putImageData(DAData.data, 0, 0)
  5005 +
  5006 + //NIKI- to resolve lateral arm black issue in highlight mode
  5007 +
  5008 + if ($rootScope.viewOrientationId == 5 && (value.bodyRegionId == 6 || value.bodyRegionId == 4)) {
  5009 +
  5010 + var imgData = context_gray.getImageData(0, 0, width, ht);
  5011 + var data = imgData.data;
  5012 + var c = 0;
  5013 + for (var i = 0; i < data.length; i += 4) {
  5014 + if (data[i] == data[i + 1] && data[i + 1] == data[i + 2] && data[i + 2] === 0) {
  5015 + data[i + 3] = 0;
  5016 + }
  5017 +
  5018 + }
  5019 + context_gray.putImageData(imgData, 0, 0);
  5020 + }
  5021 +
  5022 + //push BRID into array
  5023 + $scope.grayedBR.push({ 'BRID': value.bodyRegionId });
  5024 +
  5025 + var grayImageData = context_gray.getImageData(0, 0, width, ht);
  5026 + var grayImageImageDataVar = grayImageData.data;
  5027 +
  5028 + if ($scope.isExtract == true) {
  5029 + if (value.haveMirror == 'true') {
  5030 + $rootScope.whiteImageMRDataList[parseInt(value.bodyRegionId)] = grayImageData;
  5031 + }
  5032 + else {
  5033 +
  5034 + $rootScope.whiteImageDataList[parseInt(value.bodyRegionId - 1)] = grayImageData;
  5035 + }
  5036 + }
  5037 + else {
  5038 +
  5039 + if (value.haveMirror == 'true') {
  5040 + $rootScope.grayImageMRDataList[parseInt(value.bodyRegionId)] = grayImageData;
  5041 + }
  5042 + else {
  5043 +
  5044 + $rootScope.grayImageDataList[parseInt(value.bodyRegionId - 1)] = grayImageData;
  5045 + }
  5046 + }
  5047 +
  5048 +
  5049 + if ($scope.grayedBR != null || $scope.grayedBR != undefined) {
  5050 + if ((($rootScope.viewOrientationId == '1') || ($rootScope.viewOrientationId == '4')) && ($scope.grayedBR.length == 9)) {
  5051 + $scope.isEligibleForHighlightBodyByTermList = true;
  5052 + $scope.doHighlightOrExtract = false;
  5053 + }
  5054 + else if ((($rootScope.viewOrientationId == '2') || ($rootScope.viewOrientationId == '3')) && ($scope.grayedBR.length == 5)) {
  5055 + $scope.isEligibleForHighlightBodyByTermList = true;
  5056 + $scope.doHighlightOrExtract = false;
  5057 + }
  5058 + else if ((($rootScope.viewOrientationId == '5')) && ($scope.grayedBR.length == 4)) {
  5059 + $scope.isEligibleForHighlightBodyByTermList = true;
  5060 + $scope.doHighlightOrExtract = false;
  5061 + }
  5062 + else if ((($rootScope.viewOrientationId == '6')) && ($scope.grayedBR.length == 1)) {
  5063 + $scope.isEligibleForHighlightBodyByTermList = true;
  5064 + $scope.doHighlightOrExtract = false;
  5065 + }
  5066 + else {
  5067 +
  5068 + $scope.isEligibleForHighlightBodyByTermList = false;
  5069 + }
  5070 +
  5071 + if ($scope.isEligibleForHighlightBodyByTermList == true) {
  5072 + //DISABLE PROGERSS BAR FOR GENDER OR VIEW CHANGE
  5073 + // if ($rootScope.isGenderChnage == true || $rootScope.isViewChange == true) {
  5074 + $scope.isLoading = false;
  5075 +
  5076 + $('#spinner').css('visibility', 'hidden');
  5077 + //}
  5078 +
  5079 +
  5080 + if (($scope.isHighlightBodyByBodySystem == true) && ($scope.systemMatchedTermList != null || $scope.systemMatchedTermList != undefined)) {
  5081 +
  5082 +
  5083 + $scope.isLoading = true;
  5084 +
  5085 + $('#spinner').css('visibility', 'visible');
  5086 + $timeout(function () { $scope.HighlightBodyByTermList($scope.systemMatchedTermList) }, 100);
  5087 + }
  5088 + else if ($rootScope.isListManagerSelected == true) {
  5089 +
  5090 + // console.log('$scope.grayedBR.length is ' + $scope.grayedBR.length);
  5091 + $timeout(function () {
  5092 +
  5093 + $scope.HighlightBodyByTermList($scope.AllTerms)
  5094 + }, 800);
  5095 +
  5096 + }
  5097 + else if (($rootScope.previousHighlightList != null || $rootScope.previousHighlightList != undefined) && $rootScope.previousHighlightList.length > 0) {
  5098 + $scope.createTermListByPreviousTermsAndHighlight();
  5099 + }
  5100 +
  5101 + }
  5102 +
  5103 + }
  5104 +
  5105 + }
  5106 +
  5107 + $timeout(function () { imageCanvas.style.visibility = 'visible' }, 50);
  5108 +
  5109 +
  5110 + if ($rootScope.isExtract == true) {
  5111 + if (($rootScope.previousHighlightList != null || $rootScope.previousHighlightList != undefined) && $rootScope.previousHighlightList.length > 0) {
  5112 + console.log('1. $rootScope.isExtract=true and $rootScope.previousHighlightList != null')
  5113 +
  5114 + $timeout(function () { $scope.HighlightBodyOnExtract() }, 50);
  5115 + }
  5116 + else if ($rootScope.isListManagerSelected == true) {
  5117 + console.log('1. $rootScope.isExtract=true and $rootScope.isListManagerSelected == true')
  5118 +
  5119 + $timeout(function () { $scope.HighlightBodyOnExtract() }, 50);
  5120 +
  5121 + }
  5122 + }
  5123 + //else {
  5124 + // // 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
  5125 + // //and then highlight the previously selected body regions at the time of normal mode.
  5126 + // if ($scope.grayedBR != null || $scope.grayedBR != undefined) {
  5127 + // if ((($rootScope.viewOrientationId == '1') || ($rootScope.viewOrientationId == '4')) && ($scope.grayedBR.length == 9)) {
  5128 + // $scope.isEligibleForHighlightBodyByTermList = true;
  5129 + // }
  5130 + // else if ((($rootScope.viewOrientationId == '2') || ($rootScope.viewOrientationId == '3')) && ($scope.grayedBR.length == 5)) {
  5131 + // $scope.isEligibleForHighlightBodyByTermList = true;
  5132 + // }
  5133 + // else if ((($rootScope.viewOrientationId == '5')) && ($scope.grayedBR.length == 4)) {
  5134 + // $scope.isEligibleForHighlightBodyByTermList = true;
  5135 + // }
  5136 + // else if ((($rootScope.viewOrientationId == '6')) && ($scope.grayedBR.length == 1)) {
  5137 + // $scope.isEligibleForHighlightBodyByTermList = true;
  5138 + // }
  5139 +
  5140 +
  5141 + // }
  5142 +
  5143 + // //
  5144 + //}
  5145 + })
  5146 +
  5147 + //if ($scope.isEligibleForHighlightBodyByTermList == true) {
  5148 + // if (($rootScope.previousHighlightList != null || $rootScope.previousHighlightList != undefined) && $rootScope.previousHighlightList.length > 0) {
  5149 +
  5150 + // var multiTermList = [];
  5151 + // angular.forEach($rootScope.previousHighlightList, function (value, key) {
  5152 +
  5153 + // //debugger;
  5154 +
  5155 + // var ActualTermNo = $scope.getActualTermNumber(value);
  5156 + // if (ActualTermNo != null) {
  5157 + // var TermList = $scope.getTermNumberList(ActualTermNo);
  5158 + // if (TermList != null) {
  5159 + // for (var i = 0; i < TermList.length; i++) {
  5160 +
  5161 + // multiTermList.push(TermList[i]);
  5162 + // }
  5163 + // }
  5164 + // }
  5165 +
  5166 + // });
  5167 + // console.log('HighlightBodyByTermList call with multiTermList')
  5168 +
  5169 + // $timeout(function () { $scope.HighlightBodyByTermList(multiTermList) }, 80);
  5170 + // }
  5171 + //}
  5172 +
  5173 + }
  5174 +
  5175 +
  5176 + else {
  5177 + // This code will execute when user will select normal Mode but this time isHighlight will be false
  5178 +
  5179 + angular.forEach($scope.ColoredImageSRC, function (value, key) {
  5180 + var id;
  5181 + if (value.haveMirror == 'true') {
  5182 + id = 'imageCanvas' + value.bodyRegionId + '_MR';
  5183 + }
  5184 + else {
  5185 + id = 'imageCanvas' + value.bodyRegionId;
  5186 + }
  5187 +
  5188 + var imageCanvas = document.getElementById(id);
  5189 +
  5190 + //var coloredCanvasID = 'imageCanvas' + bodyRegionId;
  5191 + //var coloredCanvas = document.getElementById(coloredCanvasID);
  5192 +
  5193 + var width = value.Width;
  5194 + var ht = value.Height;
  5195 +
  5196 + var coloredCanvasContext = imageCanvas.getContext("2d");
  5197 + var coloredImageData = coloredCanvasContext.getImageData(0, 0, width, ht);
  5198 + var coloredImageDataVar = coloredImageData;
  5199 +
  5200 +
  5201 + if (value.haveMirror == 'true') {
  5202 + $rootScope.coloredImageMRCanvasList[parseInt(value.bodyRegionId)] = coloredImageDataVar;
  5203 + }
  5204 + else {
  5205 +
  5206 + $rootScope.coloredImageCanvasList[parseInt(value.bodyRegionId - 1)] = coloredImageDataVar;
  5207 +
  5208 + }
  5209 +
  5210 +
  5211 + var context = imageCanvas.getContext('2d');
  5212 +
  5213 +
  5214 + var dataURL = imageCanvas.toDataURL();
  5215 +
  5216 +
  5217 + var img = new Image();
  5218 +
  5219 + img.src = dataURL;
  5220 +
  5221 +
  5222 +
  5223 + img.onload = function () {
  5224 + //console.log(Math.max(img.width) + ', ' + Math.max(img.height))
  5225 +
  5226 + var DAData = new BitmapData(Math.max(img.width), Math.max(img.height));
  5227 + DAData.draw(img);
  5228 +
  5229 + var colorMode;
  5230 +
  5231 + if ($scope.isExtract == true) {
  5232 + colorMode = $scope.applyWhiteMatrix(img, context);
  5233 + }
  5234 +
  5235 + var zeroPoint = new Point();
  5236 +
  5237 + DAData.applyFilter(DAData, DAData.rect, zeroPoint, colorMode);
  5238 +
  5239 + context.putImageData(DAData.data, 0, 0)
  5240 +
  5241 + var grayImageData = context.getImageData(0, 0, width, ht);
  5242 + var grayImageImageDataVar = grayImageData.data;
  5243 +
  5244 + if ($scope.isExtract == true) {
  5245 + if (value.haveMirror == 'true') {
  5246 + $rootScope.whiteImageMRDataList[parseInt(value.bodyRegionId)] = grayImageData;
  5247 + }
  5248 + else {
  5249 +
  5250 + $rootScope.whiteImageDataList[parseInt(value.bodyRegionId - 1)] = grayImageData;
  5251 + }
  5252 + }
  5253 + else {
  5254 +
  5255 + if (value.haveMirror == 'true') {
  5256 + $rootScope.grayImageMRDataList[parseInt(value.bodyRegionId)] = grayImageData;
  5257 + }
  5258 + else {
  5259 +
  5260 + $rootScope.grayImageDataList[parseInt(value.bodyRegionId - 1)] = grayImageData;
  5261 + }
  5262 + }
  5263 + }
  5264 +
  5265 + $timeout(function () { imageCanvas.style.visibility = 'visible' }, 50);
  5266 + })
  5267 +
  5268 + if ($rootScope.isExtract == true) {
  5269 + if (($rootScope.previousHighlightList != null || $rootScope.previousHighlightList != undefined) && $rootScope.previousHighlightList.length > 0) {
  5270 + console.log('2. $rootScope.isExtract=true and $rootScope.previousHighlightList != null, $rootScope.previousHighlightList.length= ' + $rootScope.previousHighlightList.length)
  5271 +
  5272 +
  5273 + $timeout(function () { $scope.HighlightBodyOnExtract() }, 50);
  5274 +
  5275 + // to do
  5276 +
  5277 + }
  5278 + else if ($rootScope.isListManagerSelected == true) {
  5279 + console.log('2. $rootScope.isExtract=true and $rootScope.isListManagerSelected == true')
  5280 + $timeout(function () { $scope.HighlightBodyOnExtract() }, 50);
  5281 +
  5282 + }
  5283 + }
  5284 +
  5285 + }
  5286 + }
  5287 + }
  5288 + }
  5289 +
  5290 +
  5291 + $scope.applyGrayMatrix = function (img, context_gray) {
  5292 + var RED = 0.3086; // luminance contrast value for red
  5293 + var GREEN = 0.694; // luminance contrast value for green
  5294 + var BLUE = 0.0820; // luminance contrast value for blue
  5295 +
  5296 + var RGB = [RED, GREEN, BLUE, 0, 0];
  5297 + var RGB2 = [RED, GREEN, BLUE, 0, 0];
  5298 + var RGB3 = [RED, GREEN, BLUE, 0, 0];
  5299 + var ALPHA = [0, 0, 0, 1, 0];
  5300 +
  5301 + var rgbPx = RGB.concat(RGB2);
  5302 + var rgbPx2 = rgbPx.concat(RGB3);
  5303 + var matrix = rgbPx2.concat(ALPHA);
  5304 +
  5305 +
  5306 + var grayScale = new ColorMatrixFilter(matrix);
  5307 +
  5308 + return grayScale;
  5309 + }
  5310 +
  5311 + $scope.applyWhiteMatrix = function (img, context_gray) {
  5312 + var RED = 255; // white color value for red
  5313 + var GREEN = 255; // white color value for green
  5314 + var BLUE = 255; // white color value for blue
  5315 +
  5316 + var RGB = [RED, GREEN, BLUE, 0, 0];
  5317 + var RGB2 = [RED, GREEN, BLUE, 0, 0];
  5318 + var RGB3 = [RED, GREEN, BLUE, 0, 0];
  5319 + var ALPHA = [0, 0, 0, 1, 0];
  5320 +
  5321 + var rgbPx = RGB.concat(RGB2);
  5322 + var rgbPx2 = rgbPx.concat(RGB3);
  5323 + var matrix = rgbPx2.concat(ALPHA);
  5324 +
  5325 +
  5326 + var grayScale = new ColorMatrixFilter(matrix);
  5327 +
  5328 + return grayScale;
  5329 + }
  5330 +
  5331 + $scope.getActualTermNumber = function (iColor) {
  5332 + $scope.actualTermNo = new jinqJs()
  5333 + .from($rootScope.TermNumberData.TermData.Term)
  5334 + .where('_TermNumber == ' + iColor)
  5335 + .select('_ActualTermNumber');
  5336 + if ($scope.actualTermNo != null || actualTermNo != undefined) {
  5337 +
  5338 + return $scope.actualTermNo[0]._ActualTermNumber;
  5339 + }
  5340 + else {
  5341 + return null;
  5342 + }
  5343 + }
  5344 +
  5345 + $scope.getTermNumberList = function (actualTermNo) {
  5346 + $scope.termList = new jinqJs()
  5347 + .from($rootScope.TermNumberData.TermData.Term)
  5348 + .where('_ActualTermNumber == ' + actualTermNo)
  5349 + .select();
  5350 + if ($scope.termList != null || $scope.termList != undefined) {
  5351 + return $scope.termList;
  5352 + }
  5353 + else {
  5354 + return null;
  5355 + }
  5356 +
  5357 + }
  5358 +
  5359 +
  5360 + $scope.OnGenderChange = function (event) {
  5361 +
  5362 + //if listanager is visisble then close it
  5363 +
  5364 + $rootScope.isListManagerSelected = false;
  5365 + $rootScope.CloseListManager();
  5366 +
  5367 + $rootScope.isLoading = true;
  5368 + $('#spinner').css('visibility', 'visible');
  5369 +
  5370 + $rootScope.isGenderChnage = true;
  5371 +
  5372 + var viewname = localStorage.getItem("currentViewTitle")
  5373 + var currentBodyViewId = $scope.correspondingBodyViewIds[$rootScope.voId];
  5374 +
  5375 + if ((event.currentTarget.attributes[1].value == 'Male') && (localStorage.getItem("genderId") == 'Female')) {
  5376 +
  5377 + //1.
  5378 + localStorage.setItem("genderId", 'Male');
  5379 +
  5380 + //2 first update the currentbodyviewid in local storage
  5381 + localStorage.setItem("currentBodyViewId", currentBodyViewId);
  5382 +
  5383 + //3.
  5384 + $scope.loadSelectedBodyView(currentBodyViewId);
  5385 +
  5386 + //4.
  5387 + $scope.loadSelectedBodyViewNavigator(currentBodyViewId);
  5388 +
  5389 + //5. change the search terms as per the selected bodyview
  5390 + $scope.loadSearchDataForBodyView();
  5391 +
  5392 + //6.
  5393 + $('#daImagePanel')[0].childNodes[0].childNodes[0].innerHTML = localStorage.getItem("currentViewTitle").replace('Female', 'Male');
  5394 +
  5395 + localStorage.setItem("currentViewTitle", localStorage.getItem("currentViewTitle").replace('Female', 'Male'));
  5396 +
  5397 +
  5398 + $rootScope.isLoading = true;
  5399 +
  5400 + }
  5401 +
  5402 + else if ((event.currentTarget.attributes[1].value == 'Female') && (localStorage.getItem("genderId") == 'Male')) {
  5403 +
  5404 + //1.
  5405 + localStorage.setItem("genderId", 'Female');
  5406 +
  5407 + //2. first update the currentbodyviewid in local storage
  5408 + localStorage.setItem("currentBodyViewId", currentBodyViewId);
  5409 +
  5410 + //3.
  5411 + $scope.loadSelectedBodyView(currentBodyViewId);
  5412 +
  5413 + //4.
  5414 + $scope.loadSelectedBodyViewNavigator(currentBodyViewId);
  5415 +
  5416 + //5. change the search terms as per the selected bodyview
  5417 + $scope.loadSearchDataForBodyView();
  5418 +
  5419 + //6.
  5420 + $('#daImagePanel')[0].childNodes[0].childNodes[0].innerHTML = localStorage.getItem("currentViewTitle").replace('Male', 'Female');
  5421 +
  5422 + localStorage.setItem("currentViewTitle", localStorage.getItem("currentViewTitle").replace('Male', 'Female'));
  5423 +
  5424 +
  5425 + $rootScope.isLoading = true;
  5426 +
  5427 + }
  5428 +
  5429 + $rootScope.openViews.push(
  5430 + {
  5431 + "module": $rootScope.currentActiveModuleTitle, "body-views": localStorage.getItem("currentViewTitle"), "state": 'max', "BodyViewId": currentBodyViewId,
  5432 + "slug": $rootScope.currentSlug
  5433 + }
  5434 + );
  5435 +
  5436 + var target = angular.element(event.currentTarget);
  5437 + var title_male_female = target.attr('title');
  5438 +
  5439 + if (title_male_female == "Male") {
  5440 +
  5441 + $scope.male = "active";
  5442 + $scope.female = "";
  5443 + }
  5444 + else {
  5445 + $scope.male = "";
  5446 + $scope.female = "active";
  5447 + }
  5448 +
  5449 + }
  5450 +
  5451 +
  5452 + //clsoe worker process
  5453 + $scope.$on('jsPanelCloseEvent', function (event, data) {
  5454 +
  5455 +
  5456 +
  5457 + console.log('terminate worker process')
  5458 + //terminate previous running workers to create space for new workers
  5459 + $scope.terminateCurrentlyRunningWPs();
  5460 +
  5461 + $rootScope.isLoading = false;
  5462 + $('#spinner').css('visibility', 'hidden');
  5463 +
  5464 + //To fix issue of gray maintained in after closing jspanel after listmanager selection
  5465 + $rootScope.isListManagerSelected = false;
  5466 + $rootScope.isHighLight = false;
  5467 + $rootScope.isNormalMode = false;
  5468 + $rootScope.CloseListManager();
  5469 + })
  5470 +
  5471 + $scope.loadSelectedBodyView = function (currentBodyViewId) {
  5472 +
  5473 + //remove transaprency scale
  5474 + if ($('#transparencyScale') != null) {
  5475 +
  5476 + $('#transparencyScale').css('visibility', 'hidden');
  5477 + }
  5478 +
  5479 +
  5480 + $rootScope.voId = currentBodyViewId;
  5481 +
  5482 + var layerJsonPath = '~/../content/data/json/da/body-views/' + currentBodyViewId + '/da_dat_layer_' + currentBodyViewId + '.json';
  5483 +
  5484 + DataService.getJson(layerJsonPath)
  5485 + .then(
  5486 + function (result) {
  5487 + //debugger;
  5488 +
  5489 + $rootScope.BodyLayerData = result;
  5490 + $scope.isBodylayerdataLoaded = true;
  5491 +
  5492 + //load json for annotations
  5493 + // $http({ method: 'GET', url: '~/../content/data/json/da_dat_tm_sg_1.json' }).success(function (data) {
  5494 + var termJsonPath = '~/../content/data/json/da/body-views/' + currentBodyViewId + '/da_dat_tm_sg_' + currentBodyViewId + '.json';
  5495 + DataService.getAnotherJson(termJsonPath)
  5496 + .then(
  5497 + function (result) {
  5498 + $rootScope.TermNumberData = result;
  5499 +
  5500 + var canDiv = document.getElementById('canvasDiv');
  5501 + var canDivChildCount = canDiv.childElementCount;
  5502 + if (canDivChildCount > 0) {
  5503 + canDiv.innerHTML = '';
  5504 + }
  5505 + $scope.CalculateImageCordinates($rootScope.viewOrientationId);
  5506 + $scope.currentTitleFromJson = localStorage.getItem("currentViewTitle");
  5507 + },
  5508 + function (error) {
  5509 + // handle errors here
  5510 + console.log(' $rootScope.TermNumberData= ' + error.statusText);
  5511 + }
  5512 + )
  5513 + },
  5514 +
  5515 + function (error) {
  5516 + // handle errors here
  5517 + console.log(' $rootScope.BodyLayerData= ' + error.statusText);
  5518 + }
  5519 + );
  5520 + }
  5521 +
  5522 + $scope.OnViewChange = function (event) {
  5523 +
  5524 + //if listanager is visisble then close it
  5525 +
  5526 + $rootScope.isListManagerSelected = false;
  5527 + $rootScope.CloseListManager();
  5528 +
  5529 +
  5530 + $rootScope.isLoading = true;
  5531 + $('#spinner').css('visibility', 'visible');
  5532 +
  5533 +
  5534 + if ($rootScope.openViews.length > 0) {
  5535 + $rootScope.openViews.splice($rootScope.openViews.length - 1);
  5536 + }
  5537 +
  5538 + $rootScope.isViewChange = true;
  5539 + $scope.layerNumber = 0;
  5540 + // debugger;
  5541 + var selectedViewId = $scope.bodyViews[event.currentTarget.attributes[1].value];
  5542 + $rootScope.viewOrientationId = selectedViewId;
  5543 + if (localStorage.getItem("genderId") == 'Male') {
  5544 + if ($rootScope.voId != selectedViewId) {
  5545 + if (selectedViewId == 5) {
  5546 + $rootScope.voId = 9;
  5547 + }
  5548 + else if (selectedViewId == 6) {
  5549 + $rootScope.voId = 10;
  5550 + }
  5551 + else
  5552 + $rootScope.voId = selectedViewId;
  5553 + $rootScope.isLoading = true;
  5554 +
  5555 + //1. first update the currentbodyviewid in local storage
  5556 + localStorage.setItem("currentBodyViewId", $rootScope.voId);
  5557 +
  5558 + //2. Load selected body view
  5559 + $scope.loadSelectedBodyView($rootScope.voId);
  5560 +
  5561 + //3. load corresponding navigator man
  5562 + $scope.loadSelectedBodyViewNavigator($rootScope.voId);
  5563 +
  5564 + //4. change the search terms as per the selected bodyview
  5565 + $scope.loadSearchDataForBodyView();
  5566 +
  5567 + //5.Change the popup title next to search
  5568 + $scope.currentTitleFromJson = localStorage.getItem("currentViewTitle");
  5569 +
  5570 + };
  5571 +
  5572 +
  5573 + //set selected view name as the title of jspanel
  5574 + // $('#daImagePanel')[0].childNodes[0].childNodes[0].innerHTML = localStorage.getItem("genderId") +" "+ event.currentTarget.attributes[1].value;
  5575 +
  5576 + }
  5577 + else {
  5578 + if (selectedViewId == 5) {
  5579 + selectedViewId = 11;
  5580 + }
  5581 + else if (selectedViewId == 6) {
  5582 + selectedViewId = 12;
  5583 + }
  5584 + else
  5585 + selectedViewId = $scope.correspondingBodyViewIds[selectedViewId];;
  5586 + if ($rootScope.voId != selectedViewId) {
  5587 + $rootScope.voId = selectedViewId;
  5588 + $rootScope.isLoading = true;
  5589 +
  5590 + //1.
  5591 + $scope.loadSelectedBodyView($rootScope.voId);
  5592 +
  5593 + //2.
  5594 + $scope.loadSelectedBodyViewNavigator($rootScope.voId);
  5595 + };
  5596 +
  5597 +
  5598 + // $('#daImagePanel')[0].childNodes[0].childNodes[0].innerHTML = localStorage.getItem("genderId") + " " + $scope.bodyViews[event.currentTarget.attributes[1].value;
  5599 +
  5600 + }
  5601 + $('#daImagePanel')[0].childNodes[0].childNodes[0].innerHTML = localStorage.getItem("genderId") + " " + event.currentTarget.attributes[1].value;
  5602 + localStorage.setItem("currentViewTitle", localStorage.getItem("genderId") + " " + event.currentTarget.attributes[1].value);
  5603 +
  5604 +
  5605 + $rootScope.openViews.push(
  5606 + {
  5607 + "module": $rootScope.currentActiveModuleTitle, "body-views": localStorage.getItem("currentViewTitle"), "state": 'max', "BodyViewId": $rootScope.voId,
  5608 + "slug": $rootScope.currentSlug
  5609 + }
  5610 + );
  5611 +
  5612 + var viewtarget = angular.element(event.currentTarget);
  5613 + var title_drop_view = viewtarget.attr('title');
  5614 +
  5615 + if (title_drop_view == "Anterior") {
  5616 +
  5617 + $scope.AnteriorView = "active";
  5618 + $scope.LateralView = "";
  5619 + $scope.MedialView = "";
  5620 + $scope.PosteriorView = "";
  5621 + $scope.LateralArmView = "";
  5622 + $scope.MedialArmView = "";
  5623 +
  5624 + }
  5625 + else if (title_drop_view == "Lateral") {
  5626 +
  5627 + $scope.AnteriorView = "";
  5628 + $scope.LateralView = "active";
  5629 + $scope.MedialView = "";
  5630 + $scope.PosteriorView = "";
  5631 + $scope.LateralArmView = "";
  5632 + $scope.MedialArmView = "";
  5633 + }
  5634 + else if (title_drop_view == "Medial") {
  5635 +
  5636 + $scope.AnteriorView = "";
  5637 + $scope.LateralView = "";
  5638 + $scope.MedialView = "active";
  5639 + $scope.PosteriorView = "";
  5640 + $scope.LateralArmView = "";
  5641 + $scope.MedialArmView = "";
  5642 + }
  5643 + else if (title_drop_view == "Posterior") {
  5644 +
  5645 + $scope.AnteriorView = "";
  5646 + $scope.LateralView = "";
  5647 + $scope.MedialView = "";
  5648 + $scope.PosteriorView = "active";
  5649 + $scope.LateralArmView = "";
  5650 + $scope.MedialArmView = "";
  5651 + }
  5652 + else if (title_drop_view == "Lateral Arm") {
  5653 +
  5654 + $scope.AnteriorView = "";
  5655 + $scope.LateralView = "";
  5656 + $scope.MedialView = "";
  5657 + $scope.PosteriorView = "";
  5658 + $scope.LateralArmView = "active";
  5659 + $scope.MedialArmView = "";
  5660 + }
  5661 + else if (title_drop_view == "Medial Arm") {
  5662 +
  5663 + $scope.AnteriorView = "";
  5664 + $scope.LateralView = "";
  5665 + $scope.MedialView = "";
  5666 + $scope.PosteriorView = "";
  5667 + $scope.LateralArmView = "";
  5668 + $scope.MedialArmView = "active";
  5669 + }
  5670 + }
  5671 +
  5672 + //Reload DA controller event listener after setting change
  5673 + $scope.$on('reloadDAControllerEvent', function (event, data) {
  5674 + console.log('reloadDAControllerEvent');
  5675 +
  5676 + $scope.loadDissectibleAnatomyData();
  5677 +
  5678 + })
  5679 +
  5680 + //Reload DA controller Body View after setting Change
  5681 + $scope.$on('reloadDABodyViewEvent', function (event, data) {
  5682 + //console.log('reloadDABodyViewEvent');
  5683 + $scope.layerNumber = parseInt($('#txtlayerNumber').val());
  5684 + //$scope.ReloadBodyViewId = data.reloadDABodyViewId;
  5685 + // $scope.layerNumber = 0;
  5686 + // debugger;
  5687 +
  5688 + //console.log('reloadDABodyViewEvent ' + $scope.ReloadBodyViewId);
  5689 +
  5690 + //if ($rootScope.isSettingEventAlredayDispachted == true) {
  5691 +
  5692 + $scope.loadSelectedBodyView(data.reloadDABodyViewId);
  5693 +
  5694 + $scope.loadSelectedBodyViewNavigator(data.reloadDABodyViewId);
  5695 +
  5696 + $scope.currentTitleFromJson = localStorage.getItem("currentViewTitle");
  5697 +
  5698 + //$rootScope.isSettingEventAlredayDispachted = false;
  5699 + //}
  5700 +
  5701 + })
  5702 +
  5703 + $scope.loadSelectedBodyViewNavigator = function (currentBodyViewId) {
  5704 +
  5705 + //$rootScope.voId = currentBodyViewId;
  5706 +
  5707 + //$scope.skinTone = $rootScope.globalSetting.ethnicity;
  5708 +
  5709 + if ($scope.NavigatorData != null || $scope.NavigatorData != undefined) {
  5710 + var navdtlOrient = new jinqJs()
  5711 + .from($scope.NavigatorData.Navigtor.ViewOrientation)
  5712 + .where("_ViewOrientationId == " + currentBodyViewId)
  5713 + .select();
  5714 +
  5715 +
  5716 + if (navdtlOrient != null || navdtlOrient != undefined) {
  5717 +
  5718 + var navOrientationdata = new jinqJs()
  5719 + .from(navdtlOrient[0].ImageInfo)
  5720 + .where("_Ethnicity == " + $rootScope.globalSetting.ethnicity)
  5721 + .select();
  5722 +
  5723 + if (navOrientationdata != null || navOrientationdata != undefined) {
  5724 +
  5725 + $scope.navigatorImage = navOrientationdata;
  5726 +
  5727 +
  5728 + var navImageModesty;
  5729 +
  5730 + angular.forEach($scope.navigatorImage, function (value, key) {
  5731 + if (value._HaveModesty === $rootScope.globalSetting.modesty) {
  5732 + navImageModesty = value._ImageName;
  5733 + }
  5734 + })
  5735 + if (typeof (navImageModesty) === "undefined" || navImageModesty === null) {
  5736 +
  5737 + navImageModesty = $scope.navigatorImage[0]._ImageName;
  5738 +
  5739 + }
  5740 +
  5741 + $scope.navimgsrc = "~/../content/images/DA/ethnicity/body-views/" + $scope.voId + '/' + $rootScope.globalSetting.ethnicity + '/navigator_images/' + navImageModesty;
  5742 + }
  5743 + }
  5744 +
  5745 + }
  5746 +
  5747 + }
  5748 +
  5749 + //Annotation tool event lsitener
  5750 +
  5751 + // $scope.drawing = drawing;
  5752 + // $scope.lastX = lastX;
  5753 + // $scope.lastY = lastY;
  5754 + // $scope.currentX;
  5755 + // $scope.currentY;
  5756 + //----Annotation Toolbar: Jcanvas---
  5757 +
  5758 + $scope.$on('annotationToolEvent', function (event, data) {
  5759 + $("#canvas").css("display", "block");
  5760 + $("#canvasPaint").css("display", "block");
  5761 +
  5762 + $scope.doClick();
  5763 + $rootScope.FreeStylePaint();
  5764 + });
  5765 + $scope.mousePs;
  5766 + function OnPaintCanvasClick(event) {
  5767 +
  5768 +
  5769 +
  5770 + }
  5771 +
  5772 +
  5773 + $scope.clicked = true;
  5774 + $scope.offsetX1 = 0;
  5775 + $scope.offsetY1 = 0;
  5776 + $scope.x = 0;
  5777 + $scope.y = 0;
  5778 + $scope.doClick = function (event) {
  5779 +
  5780 + $scope.clicked = true;
  5781 + // OnPaintCanvasMouseDown(event);
  5782 + canvas.addEventListener('mousedown', $scope.OnPaintCanvasMouseDown, false);
  5783 + canvas.addEventListener('mouseup', $scope.OnPaintCanvasMouseUp, false);
  5784 + // alert("doclick");
  5785 + };
  5786 +
  5787 +
  5788 +
  5789 +
  5790 + $scope.mousePressed = false;
  5791 + $scope.lastX; $scope.lastY;
  5792 + var ctx;
  5793 +
  5794 + $scope.OnPaintCanvasMouseDown = function (event) {
  5795 +
  5796 + var canvasElement = document.getElementById("canvas");
  5797 + var ctx = canvasElement.getContext("2d");
  5798 +
  5799 + // var x = event.clientX;
  5800 + // var y = event.clientY;
  5801 + $scope.offsetX1 = 0;
  5802 + $scope.offsetY1 = 0;
  5803 + $scope.offsetX1 = event.offsetX;
  5804 + $scope.offsetY1 = event.offsetY;
  5805 +
  5806 + ctx.clearRect(0, 0, 2277, 3248);
  5807 + $scope.clicked = true;
  5808 + }
  5809 +
  5810 +
  5811 + $rootScope.resetRect = 0;
  5812 + $rootScope.resetLine = 0;
  5813 + $rootScope.resetCircle = 0;
  5814 + $rootScope.resetArrow = 0;
  5815 + $rootScope.resetPin = 0;
  5816 + $rootScope.resetPinArc = 0;
  5817 + $rootScope.ObjectIndex = 0;
  5818 + $rootScope.Object1Index = 0;
  5819 + $rootScope.Object2Index = 0;
  5820 + $rootScope.resetText = 0;
  5821 + $rootScope.resetTextSave = 0;
  5822 + $rootScope.ObjectIndexSave = 0;
  5823 + var arrayRect = {};
  5824 +
  5825 +
  5826 + var storeLine = '';
  5827 + $rootScope.canvasLayerNameCollection1 = [];
  5828 + $scope.OnPaintCanvasMouseUp = function (event) {
  5829 +
  5830 + if (!$scope.clicked) {
  5831 + return;
  5832 + }
  5833 + $scope.clicked = false;
  5834 + $scope.x = 0;
  5835 + $scope.y = 0;
  5836 + $scope.x = parseInt(event.clientX - ($("#canvas").offset().left));
  5837 + $scope.y = parseInt(event.clientY - ($("#canvas").offset().top));
  5838 +
  5839 + var canvasElement = document.getElementById("canvas");
  5840 + var ctx = canvasElement.getContext("2d");
  5841 +
  5842 + var canvasElement1 = document.getElementById("canvasPaint");
  5843 + var ctx1 = canvasElement1.getContext("2d");
  5844 +
  5845 + /* if ($rootScope.shapeType == "FreeStylePaint") {
  5846 + var canvasPaint_zIndex = $('#canvasPaint').css("z-index");
  5847 + var canvas_zIndex = $('#canvas').css("z-index");
  5848 + if (canvas_zIndex > canvasPaint_zIndex) {
  5849 + canvasPaint_zIndex = parseInt(canvas_zIndex) + 1;
  5850 +
  5851 + }
  5852 + else {
  5853 + canvasPaint_zIndex = parseInt(canvasPaint_zIndex) + 1;
  5854 + }
  5855 + $('#canvasPaint').css("z-index", canvasPaint_zIndex);
  5856 + $('#canvasPaint').sketch({ defaultColor: "#000", defaultSize: 1 });
  5857 + }
  5858 + else {*/
  5859 + switch ($rootScope.shapeType) {
  5860 +
  5861 + case "cursor":
  5862 + // ctx.clearRect(0, 0, 2277, 3248);
  5863 + ctx.beginPath();
  5864 + ctx1.beginPath();
  5865 +
  5866 +
  5867 + break;
  5868 +
  5869 + case "Line":
  5870 +
  5871 + $rootScope.resetLine = $rootScope.ObjectIndex++;
  5872 + $('#canvas').addLayer({
  5873 + name: 'Line_' + $rootScope.resetLine,
  5874 + layer: true,
  5875 + type: 'line',
  5876 + draggable: true,
  5877 + strokeStyle: $rootScope.shapestyleborderColor,
  5878 + strokeWidth: $rootScope.shapestyleborderWidth,
  5879 + rounded: true,
  5880 + x1: $scope.offsetX1, y1: $scope.offsetY1,
  5881 + x2: $scope.x, y2: $scope.y,
  5882 +
  5883 + click: function (layer) {
  5884 + $rootScope.canvasLayerNameCollection = [];
  5885 + $rootScope.canvasLayerNameCollection.push(layer.name);
  5886 + $('#canvas').setLayer(layer.name, {
  5887 + handle: {
  5888 + type: 'arc',
  5889 + fillStyle: '#fff',
  5890 + strokeStyle: '#c33',
  5891 + strokeWidth: 2,
  5892 + radius: 3
  5893 + }
  5894 + }).drawLayers();
  5895 +
  5896 +
  5897 + },
  5898 + mouseout: function (layer) {
  5899 + $rootScope.canvasLayerNameCollection = [];
  5900 + $('#canvas').setLayer(layer.name, {
  5901 + handle: {
  5902 + type: 'arc',
  5903 + fillStyle: '#fff',
  5904 + strokeStyle: '#c33',
  5905 + strokeWidth: 0,
  5906 + radius: 0
  5907 + }
  5908 +
  5909 + }).drawLayers();
  5910 +
  5911 + },
  5912 + mouseover: function (layer) {
  5913 +
  5914 +
  5915 + $('#canvas').setLayer(layer.name, {
  5916 + handle: {
  5917 + type: 'arc',
  5918 + fillStyle: '#fff',
  5919 + strokeStyle: '#c33',
  5920 + strokeWidth: 2,
  5921 + radius: 3
  5922 + }
  5923 + }).drawLayers();
  5924 +
  5925 +<<<<<<< HEAD
  5926 + case "Rectangle":
  5927 + $rootScope.resetRect = $rootScope.ObjectIndex++;
  5928 +
  5929 + $('#canvas').addLayer({
  5930 + layer: true,
  5931 + name: 'Rect_' + $rootScope.resetRect,
  5932 + fillStyle: $rootScope.shapestyleFillColor,
  5933 + type: 'rectangle',
  5934 + draggable: true,
  5935 + strokeStyle: $rootScope.shapestyleborderColor,
  5936 + opacity: $rootScope.shapestyleOpacity,
  5937 + strokeWidth: $rootScope.shapestyleborderWidth,
  5938 + x: $scope.offsetX1, y: $scope.offsetY1,
  5939 + width: $scope.x - $scope.offsetX1,
  5940 + height: $scope.y - $scope.offsetY1,
  5941 +
  5942 + resizeFromCenter: false,
  5943 +
  5944 + dblclick: function () {
  5945 + $rootScope.backOpacity();
  5946 +
  5947 + },
  5948 +
  5949 + click: function (layer) {
  5950 + $rootScope.canvasLayerNameCollection = [];
  5951 + $rootScope.canvasLayerNameCollection.push(layer.name);
  5952 + $('#canvas').setLayer(layer.name, {
  5953 + handle: {
  5954 + type: 'rectangle',
  5955 + fillStyle: '#fff',
  5956 + strokeStyle: '#c33',
  5957 + strokeWidth: 2,
  5958 + width: 5, height: 5,
  5959 + cornerRadius: 3
  5960 + }
  5961 + }).drawLayers();
  5962 +
  5963 + },
  5964 + mouseout: function (layer) {
  5965 + $rootScope.canvasLayerNameCollection = [];
  5966 + $('#canvas').setLayer(layer.name, {
  5967 + handle: {
  5968 + type: 'rectangle',
  5969 + fillStyle: 'pink',
  5970 + strokeStyle: 'yellow',
  5971 + strokeWidth: 0,
  5972 + width: 0, height: 0,
  5973 + cornerRadius: 0
  5974 + }
  5975 +=======
  5976 + }
  5977 +>>>>>>> db0b2ac40dc61ee08fb471800773516967978732
  5978 +
  5979 + }).drawLayers();
  5980 + $('.btnCursor').trigger('click');
  5981 + $(".btn-annotation").removeClass("activebtncolor");
  5982 + $('.btnCursor').addClass('activebtncolor');
  5983 + break;
  5984 +
  5985 + case "Rectangle":
  5986 + $rootScope.resetRect = $rootScope.ObjectIndex++;
  5987 +
  5988 + $('#canvas').addLayer({
  5989 + layer: true,
  5990 + name: 'Rect_' + $rootScope.resetRect,
  5991 + fillStyle: $rootScope.shapestyleFillColor,
  5992 + type: 'rectangle',
  5993 + draggable: true,
  5994 + strokeStyle: $rootScope.shapestyleborderColor,
  5995 + opacity: $rootScope.shapestyleOpacity,
  5996 + strokeWidth: $rootScope.shapestyleborderWidth,
  5997 + x: $scope.offsetX1, y: $scope.offsetY1,
  5998 + width: $scope.x - $scope.offsetX1,
  5999 + height: $scope.y - $scope.offsetY1,
  6000 +
  6001 + resizeFromCenter: false,
  6002 +
  6003 +
  6004 + click: function (layer) {
  6005 + $rootScope.canvasLayerNameCollection = [];
  6006 + $rootScope.canvasLayerNameCollection.push(layer.name);
  6007 + $('#canvas').setLayer(layer.name, {
  6008 + handle: {
  6009 + type: 'rectangle',
  6010 + fillStyle: '#fff',
  6011 + strokeStyle: '#c33',
  6012 + strokeWidth: 2,
  6013 + width: 5, height: 5,
  6014 + cornerRadius: 3
  6015 + }
  6016 + }).drawLayers();
  6017 +
  6018 + },
  6019 + mouseout: function (layer) {
  6020 + $rootScope.canvasLayerNameCollection = [];
  6021 + $('#canvas').setLayer(layer.name, {
  6022 + handle: {
  6023 + type: 'rectangle',
  6024 + fillStyle: 'pink',
  6025 + strokeStyle: 'yellow',
  6026 + strokeWidth: 0,
  6027 + width: 0, height: 0,
  6028 + cornerRadius: 0
  6029 + }
  6030 +
  6031 + }).drawLayers();
  6032 +
  6033 + },
  6034 + mouseover: function (layer) {
  6035 +
  6036 +
  6037 + $('#canvas').setLayer(layer.name, {
  6038 + handle: {
  6039 + type: 'rectangle',
  6040 + fillStyle: '#fff',
  6041 + strokeStyle: '#c33',
  6042 + strokeWidth: 2,
  6043 + width: 5, height: 5,
  6044 + cornerRadius: 3
  6045 + }
  6046 + }).drawLayers();
  6047 +
  6048 + }
  6049 + }).drawLayers();
  6050 +
  6051 +
  6052 +<<<<<<< HEAD
  6053 + case "Circle":
  6054 + // alert($rootScope.shapestyleborderWidth);
  6055 + $rootScope.resetCircle = $rootScope.ObjectIndex++;
  6056 + $('#canvas').addLayer({
  6057 + layer: true,
  6058 + name: 'Circle_' + $rootScope.resetCircle,
  6059 + type: 'ellipse',
  6060 + opacity: $rootScope.shapestyleOpacity,
  6061 + draggable: true,
  6062 + strokeStyle: $rootScope.shapestyleborderColor,
  6063 + strokeWidth: $rootScope.shapestyleborderWidth,
  6064 + fillStyle: $rootScope.shapestyleFillColor,
  6065 + x: $scope.offsetX1, y: $scope.offsetY1,
  6066 + width: ($scope.x - $scope.offsetX1) * 2, height: ($scope.y - $scope.offsetY1) * 2,
  6067 + // Place a handle at each side and each corner
  6068 + handlePlacement: 'both',
  6069 +
  6070 +
  6071 +
  6072 + click: function (layer) {
  6073 + // alert(layer.name);
  6074 + $rootScope.canvasLayerNameCollection = [];
  6075 + $rootScope.canvasLayerNameCollection.push(layer.name);
  6076 + $('#canvas').setLayer(layer.name, {
  6077 + handle: {
  6078 + type: 'arc',
  6079 + fillStyle: '#fff',
  6080 + strokeStyle: '#c33',
  6081 + strokeWidth: 2,
  6082 + radius: 3
  6083 + }
  6084 + }).drawLayers();
  6085 +
  6086 + },
  6087 + mouseout: function (layer) {
  6088 + $rootScope.canvasLayerNameCollection = [];
  6089 +
  6090 + $('#canvas').setLayer(layer.name, {
  6091 + handle: {
  6092 + type: 'arc',
  6093 + fillStyle: '#fff',
  6094 + strokeStyle: '#c33',
  6095 + strokeWidth: 0,
  6096 + // width: 0, height: 0,
  6097 + radius: 0
  6098 + }
  6099 +=======
  6100 +>>>>>>> db0b2ac40dc61ee08fb471800773516967978732
  6101 +
  6102 + $('.btnCursor').trigger('click');
  6103 + $(".btn-annotation").removeClass("activebtncolor");
  6104 + $('.btnCursor').addClass('activebtncolor');
  6105 +
  6106 + break;
  6107 +
  6108 + case "Circle":
  6109 + // alert($rootScope.shapestyleborderWidth);
  6110 + $rootScope.resetCircle = $rootScope.ObjectIndex++;
  6111 + $('#canvas').addLayer({
  6112 + layer: true,
  6113 + name: 'Circle_' + $rootScope.resetCircle,
  6114 + type: 'ellipse',
  6115 + opacity: $rootScope.shapestyleOpacity,
  6116 + draggable: true,
  6117 + strokeStyle: $rootScope.shapestyleborderColor,
  6118 + strokeWidth: $rootScope.shapestyleborderWidth,
  6119 + fillStyle: $rootScope.shapestyleFillColor,
  6120 + x: $scope.offsetX1, y: $scope.offsetY1,
  6121 + width: ($scope.x - $scope.offsetX1) * 2, height: ($scope.y - $scope.offsetY1) * 2,
  6122 + // Place a handle at each side and each corner
  6123 + handlePlacement: 'both',
  6124 +
  6125 +
  6126 +
  6127 + click: function (layer) {
  6128 + $rootScope.canvasLayerNameCollection = [];
  6129 + $rootScope.canvasLayerNameCollection.push(layer.name);
  6130 + $('#canvas').setLayer(layer.name, {
  6131 + handle: {
  6132 + type: 'arc',
  6133 + fillStyle: '#fff',
  6134 + strokeStyle: '#c33',
  6135 + strokeWidth: 2,
  6136 + radius: 3
  6137 + }
  6138 + }).drawLayers();
  6139 +
  6140 + },
  6141 + mouseout: function (layer) {
  6142 + $rootScope.canvasLayerNameCollection = [];
  6143 + $('#canvas').setLayer(layer.name, {
  6144 + handle: {
  6145 + type: 'arc',
  6146 + fillStyle: '#fff',
  6147 + strokeStyle: '#c33',
  6148 + strokeWidth: 0,
  6149 + // width: 0, height: 0,
  6150 + radius: 0
  6151 + }
  6152 +
  6153 + }).drawLayers();
  6154 +
  6155 + },
  6156 + mouseover: function (layer) {
  6157 +
  6158 +
  6159 + $('#canvas').setLayer(layer.name, {
  6160 + handle: {
  6161 + type: 'arc',
  6162 + fillStyle: '#fff',
  6163 + strokeStyle: '#c33',
  6164 + strokeWidth: 2,
  6165 + // width: 5, height: 5,
  6166 + radius: 3
  6167 + }
  6168 + }).drawLayers();
  6169 +
  6170 + }
  6171 + }).drawLayers();
  6172 + $('.btnCursor').trigger('click');
  6173 + $(".btn-annotation").removeClass("activebtncolor");
  6174 + $('.btnCursor').addClass('activebtncolor');
  6175 + break;
  6176 + case "Arrow":
  6177 + $rootScope.resetArrow = $rootScope.ObjectIndex++;
  6178 +
  6179 + $('#canvas').drawLine({
  6180 + layer: true,
  6181 + name: 'Arrow_' + $rootScope.resetArrow,
  6182 + draggable: true,
  6183 + strokeStyle: $rootScope.shapestyleborderColor,
  6184 + strokeWidth: $rootScope.shapestyleborderWidth,
  6185 + rounded: true,
  6186 + startArrow: true,
  6187 + arrowRadius: 7,
  6188 + arrowAngle: 90,
  6189 + x1: $scope.offsetX1, y1: $scope.offsetY1,
  6190 + x2: $scope.x, y2: $scope.y,
  6191 +
  6192 + click: function (layer) {
  6193 + $rootScope.canvasLayerNameCollection = [];
  6194 + $rootScope.canvasLayerNameCollection.push(layer.name);
  6195 + $('#canvas').setLayer(layer.name, {
  6196 + handle: {
  6197 + type: 'arc',
  6198 + fillStyle: '#fff',
  6199 + strokeStyle: '#c33',
  6200 + strokeWidth: 2,
  6201 + // width: 5, height: 5,
  6202 + radius: 3
  6203 + }
  6204 + }).drawLayers();
  6205 + // $("#canvas").removeLayer(layer.name).drawLayers();
  6206 +
  6207 + },
  6208 + mouseout: function (layer) {
  6209 + $rootScope.canvasLayerNameCollection = [];
  6210 + $('#canvas').setLayer(layer.name, {
  6211 + handle: {
  6212 + type: 'arc',
  6213 + fillStyle: '#fff',
  6214 + strokeStyle: '#c33',
  6215 + strokeWidth: 0,
  6216 + // width: 0, height: 0,
  6217 + radius: 0
  6218 + }
  6219 +
  6220 + }).drawLayers();
  6221 +
  6222 + },
  6223 + mouseover: function (layer) {
  6224 +
  6225 +
  6226 + $('#canvas').setLayer(layer.name, {
  6227 + handle: {
  6228 + type: 'arc',
  6229 + fillStyle: '#fff',
  6230 + strokeStyle: '#c33',
  6231 + strokeWidth: 2,
  6232 + // width: 5, height: 5,
  6233 + radius: 3
  6234 + }
  6235 + }).drawLayers();
  6236 +
  6237 + }
  6238 +
  6239 + });
  6240 + $('.btnCursor').trigger('click');
  6241 + $(".btn-annotation").removeClass("activebtncolor");
  6242 + $('.btnCursor').addClass('activebtncolor');
  6243 +
  6244 +<<<<<<< HEAD
  6245 + }
  6246 + }).drawArc({
  6247 + draggable: true,
  6248 + name: "ArcPin_" + $rootScope.resetPinArc,
  6249 + // name: "Pin_" + $rootScope.resetPin,
  6250 + layer: true,
  6251 + groups: ["Pin_" + $rootScope.resetPin],
  6252 + dragGroups: ["Pin_" + $rootScope.resetPin],
  6253 + strokeStyle: 'grey',
  6254 + strokeWidth: 2,
  6255 + fillStyle: radial,
  6256 + x: $scope.offsetX1, y: $scope.offsetY1,
  6257 + radius: 5,
  6258 + //handle: {
  6259 + // type: 'arc',
  6260 + // fillStyle: '#fff',
  6261 + // strokeStyle: '#c33',
  6262 + // strokeWidth: 2,
  6263 + // radius: 3
  6264 + //},
  6265 + add: function (layer) {
  6266 +
  6267 + $rootScope.resetPinArc = layer.name;
  6268 + // $scope.arr = [];
  6269 +
  6270 +
  6271 + },
  6272 +
  6273 + }).drawLayers();
  6274 + $('.btnCursor').trigger('click');
  6275 + $(".btn-annotation").removeClass("activebtncolor");
  6276 + $('.btnCursor').addClass('activebtncolor');
  6277 + break;
  6278 + case "TextArea":
  6279 + $rootScope.isTrue = false;
  6280 + $("#text_area").val('');
  6281 + // Draw text
  6282 + $rootScope.resetTextRect = $rootScope.ObjectIndex++;
  6283 + $rootScope.resetText = $rootScope.ObjectIndex++;
  6284 + $('#canvas').drawText({
  6285 + layer: true,
  6286 + draggable: true,
  6287 + // opacity: $rootScope.shapestyleOpacity,
  6288 + name: 'TextArea_' + $rootScope.resetText,
  6289 + groups: ['TextArea_' + $rootScope.resetText],
  6290 + dragGroups: ['TextArea_' + $rootScope.resetText],
  6291 + fillStyle: '#36c',
  6292 + strokeWidth: 0,
  6293 + x: $scope.offsetX1, y: $scope.offsetY1,
  6294 + fontSize: '14pt',
  6295 + align: "left",
  6296 + fontFamily: 'Verdana, sans-serif',
  6297 + text: ''
  6298 +
  6299 + })
  6300 + // Draw rect as wide as the text
  6301 + .drawRect({
  6302 + layer: true,
  6303 + name: "TextRect_" + $rootScope.resetTextRect,
  6304 + dragGroups: ['shapes'],
  6305 + opacity: $rootScope.shapestyleOpacity,
  6306 + strokeStyle: $rootScope.shapestyleborderColor,
  6307 + strokeWidth: $rootScope.shapestyleborderWidth,
  6308 + fillStyle: $rootScope.shapestyleFillColor,
  6309 + x: $scope.offsetX1, y: $scope.offsetY1,
  6310 + width: $scope.x - $scope.offsetX1,
  6311 + height: $scope.y - $scope.offsetY1,
  6312 + click: function (layer) {
  6313 +
  6314 + $rootScope.canvasLayerNameCollection = [];
  6315 + $rootScope.canvasLayerNameCollection.push(layer.name);
  6316 + $('#canvas').setLayer(layer.name, {
  6317 + handle: {
  6318 + type: 'rectangle',
  6319 + fillStyle: '#fff',
  6320 + strokeStyle: '#c33',
  6321 + strokeWidth: 2,
  6322 + width: 5, height: 5,
  6323 + cornerRadius: 3
  6324 + }
  6325 + }).drawLayers();
  6326 +
  6327 + },
  6328 + mouseout: function (layer) {
  6329 + $rootScope.canvasLayerNameCollection = [];
  6330 + $('#canvas').setLayer(layer.name, {
  6331 + handle: {
  6332 + type: 'rectangle',
  6333 + fillStyle: 'pink',
  6334 + strokeStyle: 'yellow',
  6335 + strokeWidth: 0,
  6336 + width: 0, height: 0,
  6337 + cornerRadius: 0
  6338 + }
  6339 +=======
  6340 + // $scope.resetRect += 1;
  6341 + break;
  6342 + case "Pin":
  6343 +
  6344 + $rootScope.resetPin = $rootScope.Object2Index++;
  6345 + $rootScope.resetPinArc = $rootScope.Object1Index++;
  6346 + var radial = $('canvas').createGradient({
  6347 + x1: 50, y1: 50,
  6348 + x2: 50, y2: 50,
  6349 + r1: 10, r2: 30,
  6350 + c1: 'rgba(100, 50, 0,0)',
  6351 + c2: 'grey'
  6352 + });
  6353 + $('#canvas').drawLine({
  6354 + draggable: true,
  6355 + layer: true,
  6356 + name: "Pin_" + $rootScope.resetPin,
  6357 + groups: ["Pin_" + $rootScope.resetPin],
  6358 + dragGroups: ["Pin_" + $rootScope.resetPin],
  6359 + strokeStyle: 'black',
  6360 + strokeWidth: 2,
  6361 + x1: $scope.offsetX1, y1: $scope.offsetY1,
  6362 + x2: $scope.x, y2: $scope.y,
  6363 +
  6364 + click: function (layer) {
  6365 + // debugger;
  6366 + $rootScope.shapeTypePin = "Pin";
  6367 + $rootScope.canvasLayerNameCollection = [];
  6368 + var pinLine_layer = layer.name;
  6369 + var pinLine_layer_split = pinLine_layer.split("_");
  6370 + var pinArcName = "ArcPin_";
  6371 + var pinResult = pinArcName.concat(pinLine_layer_split[1]);
  6372 +
  6373 + $rootScope.canvasLayerNameCollection.push({ pinName: layer.name, ArcName: pinResult });
  6374 +
  6375 + $('#canvas').setLayer(layer.name, {
  6376 + handle: {
  6377 + type: 'arc',
  6378 + fillStyle: '#fff',
  6379 + strokeStyle: '#c33',
  6380 + strokeWidth: 2,
  6381 + // width: 5, height: 5,
  6382 + radius: 3
  6383 + }
  6384 + }).drawLayers();
  6385 +
  6386 +
  6387 + },
  6388 + mouseout: function (layer) {
  6389 + // $rootScope.resetPinArc = "";
  6390 + // ax = "";
  6391 +
  6392 + $rootScope.canvasLayerNameCollection = [];
  6393 + $('#canvas').setLayer(layer.name, {
  6394 + handle: {
  6395 + type: 'arc',
  6396 + fillStyle: '#fff',
  6397 + strokeStyle: '#c33',
  6398 + strokeWidth: 0,
  6399 + // width: 0, height: 0,
  6400 + radius: 0
  6401 + }
  6402 +
  6403 + }).drawLayers();
  6404 +>>>>>>> db0b2ac40dc61ee08fb471800773516967978732
  6405 +
  6406 + },
  6407 + mouseover: function (layer) {
  6408 +
  6409 +
  6410 + $('#canvas').setLayer(layer.name, {
  6411 + handle: {
  6412 + type: 'arc',
  6413 + fillStyle: '#fff',
  6414 + strokeStyle: '#c33',
  6415 + strokeWidth: 2,
  6416 + // width: 5, height: 5,
  6417 + radius: 3
  6418 + }
  6419 + }).drawLayers();
  6420 +
  6421 + }
  6422 + }).drawArc({
  6423 + draggable: true,
  6424 + name: "ArcPin_" + $rootScope.resetPinArc,
  6425 + // name: "Pin_" + $rootScope.resetPin,
  6426 + layer: true,
  6427 + groups: ["Pin_" + $rootScope.resetPin],
  6428 + dragGroups: ["Pin_" + $rootScope.resetPin],
  6429 + strokeStyle: 'grey',
  6430 + strokeWidth: 2,
  6431 + fillStyle: radial,
  6432 + x: $scope.offsetX1, y: $scope.offsetY1,
  6433 + radius: 5,
  6434 + //handle: {
  6435 + // type: 'arc',
  6436 + // fillStyle: '#fff',
  6437 + // strokeStyle: '#c33',
  6438 + // strokeWidth: 2,
  6439 + // radius: 3
  6440 + //},
  6441 + add: function (layer) {
  6442 +
  6443 + $rootScope.resetPinArc = layer.name;
  6444 + // $scope.arr = [];
  6445 +
  6446 +
  6447 + },
  6448 +
  6449 + }).drawLayers();
  6450 + $('.btnCursor').trigger('click');
  6451 + $(".btn-annotation").removeClass("activebtncolor");
  6452 + $('.btnCursor').addClass('activebtncolor');
  6453 + break;
  6454 + case "TextArea":
  6455 +
  6456 + // Draw text
  6457 + $rootScope.resetTextRect = $rootScope.ObjectIndex++;
  6458 + $rootScope.resetText = $rootScope.ObjectIndex++;
  6459 + $('#canvas').drawText({
  6460 + layer: true,
  6461 + draggable: true,
  6462 + // opacity: $rootScope.shapestyleOpacity,
  6463 + name: 'TextArea_' + $rootScope.resetText,
  6464 + groups: ['TextArea_' + $rootScope.resetText],
  6465 + dragGroups: ['TextArea_' + $rootScope.resetText],
  6466 + fillStyle: '#36c',
  6467 + strokeWidth: 0,
  6468 + x: $scope.offsetX1, y: $scope.offsetY1,
  6469 + fontSize: '14pt',
  6470 + align: "left",
  6471 + fontFamily: 'Verdana, sans-serif',
  6472 + text: ''
  6473 +
  6474 +
  6475 +
  6476 + })
  6477 + // Draw rect as wide as the text
  6478 + .drawRect({
  6479 + layer: true,
  6480 + name: "TextRect_" + $rootScope.resetTextRect,
  6481 + dragGroups: ['shapes'],
  6482 + opacity: $rootScope.shapestyleOpacity,
  6483 + strokeStyle: $rootScope.shapestyleborderColor,
  6484 + strokeWidth: $rootScope.shapestyleborderWidth,
  6485 + fillStyle: $rootScope.shapestyleFillColor,
  6486 + x: $scope.offsetX1, y: $scope.offsetY1,
  6487 + width: $scope.x - $scope.offsetX1,
  6488 + height: $scope.y - $scope.offsetY1,
  6489 + click: function (layer) {
  6490 +
  6491 + $rootScope.canvasLayerNameCollection = [];
  6492 + $rootScope.canvasLayerNameCollection.push(layer.name);
  6493 + $('#canvas').setLayer(layer.name, {
  6494 + handle: {
  6495 + type: 'rectangle',
  6496 + fillStyle: '#fff',
  6497 + strokeStyle: '#c33',
  6498 + strokeWidth: 2,
  6499 + width: 5, height: 5,
  6500 + cornerRadius: 3
  6501 + }
  6502 + }).drawLayers();
  6503 +
  6504 + },
  6505 + mouseout: function (layer) {
  6506 + $rootScope.canvasLayerNameCollection = [];
  6507 + $('#canvas').setLayer(layer.name, {
  6508 + handle: {
  6509 + type: 'rectangle',
  6510 + fillStyle: 'pink',
  6511 + strokeStyle: 'yellow',
  6512 + strokeWidth: 0,
  6513 + width: 0, height: 0,
  6514 + cornerRadius: 0
  6515 + }
  6516 +
  6517 + }).drawLayers();
  6518 +
  6519 + },
  6520 + mouseover: function (layer) {
  6521 +
  6522 + $('#canvas').setLayer(layer.name, {
  6523 + handle: {
  6524 + type: 'rectangle',
  6525 + fillStyle: '#fff',
  6526 + strokeStyle: '#c33',
  6527 + strokeWidth: 2,
  6528 + width: 5, height: 5,
  6529 + cornerRadius: 3
  6530 + }
  6531 + }).drawLayers();
  6532 +
  6533 + }
  6534 + });
  6535 +
  6536 +
  6537 + $("#annotationTextModal").modal("toggle");
  6538 + $('.btnCursor').trigger('click');
  6539 + $(".btn-annotation").removeClass("activebtncolor");
  6540 + $('.btnCursor').addClass('activebtncolor');
  6541 + break;
  6542 +
  6543 + case "DrawPolygon":
  6544 +
  6545 + break;
  6546 +
  6547 + }
  6548 + //}
  6549 +
  6550 + }
  6551 +
  6552 + //-- TextArea functionality of Annotation toolbar
  6553 +
  6554 + $rootScope.fontSizes;
  6555 + $rootScope.fontWeight;
  6556 + $rootScope.fontStyle;
  6557 + $rootScope.textAlignmt;
  6558 + $rootScope.fontColor;
  6559 + $rootScope.underlineText;
  6560 + $rootScope.textArea;
  6561 + $rootScope.fontFamily;
  6562 + $rootScope.TextAreaStyleProp = [];
  6563 + $rootScope.modifySavedText = [];
  6564 + $rootScope.TextRectangleArr = [];
  6565 + $rootScope.rectDimension = [];
  6566 +
  6567 + $rootScope.saveText = function () {
  6568 + debugger;
  6569 + if ($rootScope.isTrue == false) {
  6570 + $rootScope.fontSizes = $("#text_area").css("font-size");
  6571 + $rootScope.fontWeight = $("#text_area").css("font-weight");
  6572 + $rootScope.fontStyle = $("#text_area").css("font-style");
  6573 + $rootScope.textAlignmt = $("#text_area").css("text-align");
  6574 + $rootScope.fontColor = $("#text_area").css("color");
  6575 + $rootScope.fontFamily = $("#text_area").css("font-family");
  6576 + $rootScope.underlineText = $("#text_area").css("text-decoration");
  6577 + $rootScope.textArea = $("#text_area").val();
  6578 +
  6579 + $("#canvas").removeLayer('TextArea_' + $rootScope.resetText).drawLayers();
  6580 + $("#canvas").removeLayer("TextRect_" + $rootScope.resetTextRect).drawLayers();
  6581 +
  6582 + $('#canvas').drawText({
  6583 + layer: true,
  6584 + draggable: true,
  6585 + name: 'TextArea_' + $rootScope.resetText,
  6586 + groups: ['TextArea_' + $rootScope.resetText],
  6587 + dragGroups: ['TextArea_' + $rootScope.resetText],
  6588 + fillStyle: $rootScope.fontColor,
  6589 + fontStyle: $rootScope.fontStyle,
  6590 + fontSize: $rootScope.fontSizes,
  6591 + fontFamily: $rootScope.fontFamily,
  6592 + align: $rootScope.textAlignmt,
  6593 + strokeWidth: 0,
  6594 + text: $rootScope.textArea,
  6595 + x: $scope.offsetX1, y: $scope.offsetY1,
  6596 + maxWidth: $scope.x - $scope.offsetX1,
  6597 + maxHeight: $scope.y - $scope.offsetY1,
  6598 +
  6599 + add: function (layer) {
  6600 +
  6601 + $rootScope.TextAreaStyleProp.push({ Text1: '', Align: '', FontColor: '', FontSize: '', FontStyle: '', FontFamily: '' });
  6602 + $rootScope.TextAreaStyleProp.push({ Text1: layer.text, Align: layer.align, FontColor: layer.fillStyle, FontSize: layer.fontSize, FontStyle: layer.fontStyle, FontFamily: layer.fontFamily });
  6603 +
  6604 + // $rootScope.TextAreaStyleProp.push({ Text: '', Align: '', FontColor: '', FontSize: '', FontStyle: '', FontFamily: '' });
  6605 + // $rootScope.TextAreaStyleProp.push({ Text: layer.text, Align: layer.align, FontColor: layer.fillStyle, FontSize: layer.fontSize, FontStyle: layer.fontStyle, FontFamily: layer.fontFamily });
  6606 +
  6607 +
  6608 + },
  6609 +
  6610 + change: function (layer, props) {
  6611 +
  6612 + }
  6613 +
  6614 + })
  6615 + // Draw rect as wide as the text
  6616 + .drawRect({
  6617 + name: 'TextArea1_' + $rootScope.resetText,
  6618 + layer: true,
  6619 + draggable: true,
  6620 + groups: ['TextArea_' + $rootScope.resetText],
  6621 + dragGroups: ['TextArea_' + $rootScope.resetText],
  6622 + opacity: $rootScope.shapestyleOpacity,
  6623 + strokeStyle: $rootScope.shapestyleborderColor,
  6624 + strokeWidth: $rootScope.shapestyleborderWidth,
  6625 +
  6626 + x: $scope.offsetX1, y: $scope.offsetY1,
  6627 + width: $scope.x - $scope.offsetX1,
  6628 + height: $scope.y - $scope.offsetY1,
  6629 + add: function (layer) {
  6630 +
  6631 + },
  6632 + click: function (layer) {
  6633 + $rootScope.shapeTypeText = "textAreaRect";
  6634 +
  6635 + var layerNameSplit = layer.name;
  6636 +
  6637 + var splitedName = layerNameSplit.split("_");
  6638 +
  6639 + var textValName = "TextArea_";
  6640 +
  6641 + var concatinateResult = textValName.concat(splitedName[1]);
  6642 +
  6643 + $rootScope.canvasLayerNameCollection = [];
  6644 + $rootScope.canvasLayerNameCollection.push({ textareaRectangle: layer.name, textareaString: concatinateResult });
  6645 +
  6646 +
  6647 +
  6648 + $('#canvas').setLayer(layer.name, {
  6649 + handle: {
  6650 + type: 'rectangle',
  6651 + fillStyle: '#fff',
  6652 + strokeStyle: '#c33',
  6653 + strokeWidth: 2,
  6654 + width: 5, height: 5,
  6655 + cornerRadius: 3
  6656 + }
  6657 + }).drawLayers();
  6658 +
  6659 + },
  6660 + dblclick: function (layer) {
  6661 + // debugger;
  6662 + $rootScope.isTrue = true;
  6663 +
  6664 + var _rectLayerOnSave = layer.name;
  6665 + var _rectLayerOnSaveSplit = _rectLayerOnSave.split("_");
  6666 + var str1 = "TextArea_";
  6667 + var res = str1.concat(_rectLayerOnSaveSplit[1]);
  6668 +
  6669 + $rootScope.modifySavedText.push({ TextName: layer.name, RectText: res});
  6670 + $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y });
  6671 +
  6672 + var _rectLayerOnSaveSplitInt;
  6673 + if (_rectLayerOnSaveSplit[1] >= 3)
  6674 + _rectLayerOnSaveSplitInt = parseInt(_rectLayerOnSaveSplit[1] - 2);
  6675 + else
  6676 + _rectLayerOnSaveSplitInt = parseInt(_rectLayerOnSaveSplit[1]);
  6677 +
  6678 + var b = $rootScope.TextAreaStyleProp[_rectLayerOnSaveSplitInt].Text1;
  6679 + $("#text_area").val(b);
  6680 + // alert($rootScope.TextAreaStyleProp[_rectLayerOnSaveSplitInt].FontSize);
  6681 +
  6682 + $("#text_area").css("font-size", $rootScope.TextAreaStyleProp[_rectLayerOnSaveSplitInt].FontSize);
  6683 + $("#text_area").css("font-weight", $rootScope.TextAreaStyleProp[_rectLayerOnSaveSplitInt].FontStyle);
  6684 + $("#text_area").css("font-style", $rootScope.TextAreaStyleProp[_rectLayerOnSaveSplitInt].FontStyle);
  6685 + $("#text_area").css("text-align", $rootScope.TextAreaStyleProp[_rectLayerOnSaveSplitInt].Align);
  6686 + $("#text_area").css("color", $rootScope.TextAreaStyleProp[_rectLayerOnSaveSplitInt].FontColor);
  6687 + $("#text_area").css("font-family", $rootScope.TextAreaStyleProp[_rectLayerOnSaveSplitInt].FontFamily);
  6688 + $("#text_area").css("text-decoration", $rootScope.underlineText);
  6689 +
  6690 +
  6691 + _rectLayerOnSaveSplitInt = ''; b = '';
  6692 + $("#annotationTextModal").modal("toggle");
  6693 +
  6694 + },
  6695 + mouseout: function (layer) {
  6696 +
  6697 + $rootScope.canvasLayerNameCollection = [];
  6698 + $('#canvas').setLayer(layer.name, {
  6699 + handle: {
  6700 + type: 'rectangle',
  6701 + fillStyle: 'pink',
  6702 + strokeStyle: 'yellow',
  6703 + strokeWidth: 0,
  6704 + width: 0, height: 0,
  6705 + cornerRadius: 0
  6706 + }
  6707 +
  6708 + }).drawLayers();
  6709 + // $rootScope.textss = '';
  6710 +
  6711 + },
  6712 + mouseover: function (layer) {
  6713 +
  6714 + $('#canvas').setLayer(layer.name, {
  6715 + handle: {
  6716 + type: 'rectangle',
  6717 + fillStyle: '#fff',
  6718 + strokeStyle: '#c33',
  6719 + strokeWidth: 2,
  6720 + width: 5, height: 5,
  6721 + cornerRadius: 3
  6722 + }
  6723 + }).drawLayers();
  6724 +
  6725 +<<<<<<< HEAD
  6726 + }
  6727 + });
  6728 + $("#text_area").val('');
  6729 + $("#text_area").css({ " font-family": "'Verdana, sans-serif'", "font-size": "14px", "font-weight": "normal", "font-style": "normal", "color": "#000", "text-align": "left", "text-decoration": "none" });
  6730 +=======
  6731 + $rootScope.fontSizes = $("#text_area").css("font-size");
  6732 + $rootScope.fontWeight = $("#text_area").css("font-weight");
  6733 + $rootScope.fontStyle = $("#text_area").css("font-style");
  6734 + $rootScope.textAlignmt = $("#text_area").css("text-align");
  6735 + $rootScope.fontColor = $("#text_area").css("color");
  6736 + $rootScope.fontFamily = $("#text_area").css("font-family");
  6737 + $rootScope.underlineText = $("#text_area").css("text-decoration");
  6738 + $rootScope.textArea = $("#text_area").val();
  6739 + $("#canvas").removeLayer('TextArea_' + $rootScope.resetText).drawLayers();
  6740 + $("#canvas").removeLayer("TextRect_" + $rootScope.resetTextRect).drawLayers();
  6741 +
  6742 + $('#canvas').drawText({
  6743 + layer: true,
  6744 + draggable: true,
  6745 + name: 'TextArea_' + $rootScope.resetText,
  6746 + groups: ['TextArea_' + $rootScope.resetText],
  6747 + dragGroups: ['TextArea_' + $rootScope.resetText],
  6748 + fillStyle: $rootScope.fontColor,
  6749 + fontStyle: $rootScope.fontStyle,
  6750 + fontSize: $rootScope.fontSizes,
  6751 + fontFamily: $rootScope.fontFamily,
  6752 + align: $rootScope.textAlignmt,
  6753 + strokeWidth: 0,
  6754 + text: $rootScope.textArea,
  6755 + x: $scope.offsetX1, y: $scope.offsetY1,
  6756 + maxWidth: $scope.x - $scope.offsetX1,
  6757 + maxHeight: $scope.y - $scope.offsetY1,
  6758 +
  6759 +
  6760 + click: function (layer) {
  6761 +>>>>>>> db0b2ac40dc61ee08fb471800773516967978732
  6762 +
  6763 + }
  6764 + else {
  6765 + // debugger;
  6766 +
  6767 +
  6768 + var _modifiedText = $("#text_area").val();
  6769 + var _modifiedFontSize = $("#text_area").css("font-size");
  6770 + var _modifiedFontWeight = $("#text_area").css("font-weight");
  6771 + var _modifiedFontStyle = $("#text_area").css("font-style");
  6772 + var _modifiedTextAlign = $("#text_area").css("text-align");
  6773 + var _modifiedFontColor = $("#text_area").css("color");
  6774 + var _modifiedFontFamily = $("#text_area").css("font-family");
  6775 + var _modifiedFontDecoration = $("#text_area").css("text-decoration");
  6776 +
  6777 + $("#canvas").removeLayer($rootScope.modifySavedText[0].RectText).drawLayers();
  6778 + $("#canvas").removeLayer($rootScope.modifySavedText[0].TextName).drawLayers();
  6779 +
  6780 + $rootScope.resetTextRectSave = $rootScope.ObjectIndexSave++;
  6781 + $rootScope.resetTextSave = $rootScope.ObjectIndexSave++;
  6782 + // alert($rootScope.resetText);
  6783 + // alert('TextArea12_' + $rootScope.resetTextSave);
  6784 + $('#canvas').drawText({
  6785 + layer: true,
  6786 + draggable: true,
  6787 + name: 'TextArea12_' + $rootScope.resetTextSave,
  6788 + groups: ['TextArea12_' + $rootScope.resetTextSave],
  6789 + dragGroups: ['TextArea12_' + $rootScope.resetTextSave],
  6790 + fillStyle: _modifiedFontColor,
  6791 + fontStyle: _modifiedFontStyle,
  6792 + fontSize: _modifiedFontSize,
  6793 + fontFamily: _modifiedFontFamily,
  6794 + align: _modifiedTextAlign,
  6795 + strokeWidth: 0,
  6796 + text: _modifiedText,
  6797 + x: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].x, y: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].y,
  6798 + maxWidth: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].width,
  6799 + maxHeight: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].height,
  6800 +
  6801 + add: function (layer) {
  6802 +
  6803 +
  6804 +
  6805 + },
  6806 +
  6807 + change: function (layer, props) {
  6808 +
  6809 + }
  6810 +
  6811 + })
  6812 + // Draw rect as wide as the text
  6813 + .drawRect({
  6814 + name: 'TextArea13_' + $rootScope.resetTextSave,
  6815 + layer: true,
  6816 + draggable: true,
  6817 + groups: ['TextArea12_' + $rootScope.resetTextSave],
  6818 + dragGroups: ['TextArea12_' + $rootScope.resetTextSave],
  6819 + opacity: $rootScope.shapestyleOpacity,
  6820 + strokeStyle: $rootScope.shapestyleborderColor,
  6821 + strokeWidth: $rootScope.shapestyleborderWidth,
  6822 + x: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].x, y: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].y,
  6823 + width: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].width,
  6824 + height: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].height,
  6825 +
  6826 + click: function (layer) {
  6827 + $rootScope.shapeTypeText = "textAreaRect";
  6828 +
  6829 + var layerNameSplit = layer.name;
  6830 +
  6831 + var splitedName = layerNameSplit.split("_");
  6832 +
  6833 + var textValName = "TextArea12_";
  6834 +
  6835 + var concatinateResult = textValName.concat(splitedName[1]);
  6836 +
  6837 + $rootScope.canvasLayerNameCollection = [];
  6838 + $rootScope.canvasLayerNameCollection.push({ textareaRectangle: layer.name, textareaString: concatinateResult });
  6839 +
  6840 +
  6841 +
  6842 + $('#canvas').setLayer(layer.name, {
  6843 + handle: {
  6844 + type: 'rectangle',
  6845 + fillStyle: '#fff',
  6846 + strokeStyle: '#c33',
  6847 + strokeWidth: 2,
  6848 + width: 5, height: 5,
  6849 + cornerRadius: 3
  6850 + }
  6851 + }).drawLayers();
  6852 +
  6853 + },
  6854 + dblclick: function (layer) {
  6855 +
  6856 + $rootScope.isTrue = true;
  6857 +
  6858 + var _rectLayerOnSave = layer.name;
  6859 + var _rectLayerOnSaveSplit = _rectLayerOnSave.split("_");
  6860 + var str1 = "TextArea12_";
  6861 + var res = str1.concat(_rectLayerOnSaveSplit[1]);
  6862 +
  6863 + $rootScope.modifySavedText.push({ TextName: layer.name, RectText: res });
  6864 + $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y });
  6865 +
  6866 + $("#text_area").val(_modifiedText);
  6867 + $("#text_area").css("font-size", _modifiedFontSize);
  6868 + $("#text_area").css("font-weight", _modifiedFontWeight);
  6869 + $("#text_area").css("font-style", _modifiedFontStyle);
  6870 + $("#text_area").css("text-align", _modifiedTextAlign);
  6871 + $("#text_area").css("color", _modifiedFontColor);
  6872 + $("#text_area").css("font-family", _modifiedFontFamily);
  6873 + $("#text_area").css("text-decoration", _modifiedFontDecoration);
  6874 +
  6875 +
  6876 + $("#annotationTextModal").modal("toggle");
  6877 +
  6878 + },
  6879 + mouseout: function (layer) {
  6880 +
  6881 + $rootScope.canvasLayerNameCollection = [];
  6882 + $('#canvas').setLayer(layer.name, {
  6883 + handle: {
  6884 + type: 'rectangle',
  6885 + fillStyle: 'pink',
  6886 + strokeStyle: 'yellow',
  6887 + strokeWidth: 0,
  6888 + width: 0, height: 0,
  6889 + cornerRadius: 0
  6890 + }
  6891 +
  6892 + }).drawLayers();
  6893 +
  6894 + },
  6895 + mouseover: function (layer) {
  6896 +
  6897 + $('#canvas').setLayer(layer.name, {
  6898 + handle: {
  6899 + type: 'rectangle',
  6900 + fillStyle: '#fff',
  6901 + strokeStyle: '#c33',
  6902 + strokeWidth: 2,
  6903 + width: 5, height: 5,
  6904 + cornerRadius: 3
  6905 + }
  6906 + }).drawLayers();
  6907 +
  6908 +<<<<<<< HEAD
  6909 + }
  6910 + });
  6911 + $rootScope.modifySavedText = [];
  6912 +=======
  6913 + })
  6914 + // Draw rect as wide as the text
  6915 + .drawRect({
  6916 + name: 'TextArea1_' + $rootScope.resetText,
  6917 + layer: true,
  6918 + draggable: true,
  6919 + groups: ['TextArea_' + $rootScope.resetText],
  6920 + dragGroups: ['TextArea_' + $rootScope.resetText],
  6921 + opacity: $rootScope.shapestyleOpacity,
  6922 + // strokeStyle: 'black',
  6923 + // strokeWidth: 2,
  6924 + strokeStyle: $rootScope.shapestyleborderColor,
  6925 + strokeWidth: $rootScope.shapestyleborderWidth,
  6926 + // fillStyle: $rootScope.shapestyleFillColor,
  6927 + x: $scope.offsetX1, y: $scope.offsetY1,
  6928 + width: $scope.x - $scope.offsetX1,
  6929 + height: $scope.y - $scope.offsetY1,
  6930 +
  6931 + click: function (layer) {
  6932 + $rootScope.shapeTypeText = "textAreaRect";
  6933 +
  6934 + var layerNameSplit = layer.name;
  6935 +
  6936 + var splitedName = layerNameSplit.split("_");
  6937 +
  6938 + var textValName = "TextArea_";
  6939 +
  6940 + var concatinateResult = textValName.concat(splitedName[1]);
  6941 +
  6942 + $rootScope.canvasLayerNameCollection = [];
  6943 + $rootScope.canvasLayerNameCollection.push({ textareaRectangle: layer.name, textareaString: concatinateResult });
  6944 +
  6945 +
  6946 +
  6947 + $('#canvas').setLayer(layer.name, {
  6948 + handle: {
  6949 + type: 'rectangle',
  6950 + fillStyle: '#fff',
  6951 + strokeStyle: '#c33',
  6952 + strokeWidth: 2,
  6953 + width: 5, height: 5,
  6954 + cornerRadius: 3
  6955 + }
  6956 + }).drawLayers();
  6957 +
  6958 + },
  6959 + mouseout: function (layer) {
  6960 +
  6961 + $rootScope.canvasLayerNameCollection = [];
  6962 + $('#canvas').setLayer(layer.name, {
  6963 + handle: {
  6964 + type: 'rectangle',
  6965 + fillStyle: 'pink',
  6966 + strokeStyle: 'yellow',
  6967 + strokeWidth: 0,
  6968 + width: 0, height: 0,
  6969 + cornerRadius: 0
  6970 + }
  6971 +
  6972 + }).drawLayers();
  6973 +
  6974 + },
  6975 + mouseover: function (layer) {
  6976 +
  6977 + $('#canvas').setLayer(layer.name, {
  6978 + handle: {
  6979 + type: 'rectangle',
  6980 + fillStyle: '#fff',
  6981 + strokeStyle: '#c33',
  6982 + strokeWidth: 2,
  6983 + width: 5, height: 5,
  6984 + cornerRadius: 3
  6985 + }
  6986 + }).drawLayers();
  6987 +>>>>>>> db0b2ac40dc61ee08fb471800773516967978732
  6988 +
  6989 + }
  6990 + }
  6991 +
  6992 + $rootScope.closeModal = function () {
  6993 + debugger;
  6994 +
  6995 +
  6996 +
  6997 + $("#canvas").removeLayer('TextArea_' + $rootScope.resetText).drawLayers();
  6998 + $("#canvas").removeLayer("TextRect_" + $rootScope.resetTextRect).drawLayers();
  6999 +
  7000 +
  7001 + }
  7002 +
  7003 +
  7004 + function OnPaintCanvasMouseMove(event) {
  7005 +
  7006 +
  7007 + }
  7008 +
  7009 + $rootScope.FreeStylePaint = function (e) {
  7010 + // debugger;
  7011 +
  7012 +<<<<<<< HEAD
  7013 +
  7014 + // $rootScope.shapeType = "FreeStylePaint";
  7015 + // canvasPaint.addEventListener('mouseup', $scope.OnPaintBrushCanvasMouseUp, false);
  7016 + // canvasPaint.addEventListener('mousedown', $scope.OnPaintBrushCanvasMouseDown, false);
  7017 +
  7018 +
  7019 +=======
  7020 +
  7021 + // $rootScope.shapeType = "FreeStylePaint";
  7022 + canvasPaint.addEventListener('mouseup', $scope.OnPaintBrushCanvasMouseUp, false);
  7023 + canvasPaint.addEventListener('mousedown', $scope.OnPaintBrushCanvasMouseDown, false);
  7024 +
  7025 +
  7026 +>>>>>>> db0b2ac40dc61ee08fb471800773516967978732
  7027 + }
  7028 + $scope.OnPaintBrushCanvasMouseDown = function (event) {
  7029 + switch ($rootScope.shapeType) {
  7030 +
  7031 + case "FreeStylePaint":
  7032 +
  7033 + debugger;
  7034 +
  7035 + // $('#canvasPaint').sketch();
  7036 + // $('#canvasPaint').sketch({ defaultSize: 1 });
  7037 + // if ($("#amount-2").val() == '') {
  7038 + // //$('#canvasPaint').sketch({ defaultSize: $scope.shapesize });
  7039 + // $('#canvasPaint').sketch();
  7040 + // }
  7041 + // else {
  7042 +
  7043 + // // var a = $("#amount-2").val();
  7044 + //// $scope.shapesize = parseInt(a);
  7045 + // // $('#canvasPaint').sketch({ defaultSize: $rootScope.shapeSize });
  7046 + // // $('#canvasPaint').sketch({ defaultSize: $scope.shapesize });
  7047 +
  7048 + // }
  7049 +
  7050 +
  7051 + break;
  7052 +
  7053 + }
  7054 + }
  7055 + $scope.OnPaintBrushCanvasMouseUp = function (event) {
  7056 +
  7057 +
  7058 + // var canvasElement1 = document.getElementById("canvasPaint");
  7059 + // var ctx1 = canvasElement1.getContext("2d");
  7060 +
  7061 + //switch($rootScope.shapeType)
  7062 + //{
  7063 +
  7064 + // case "FreeStylePaint":
  7065 +
  7066 + // debugger;
  7067 +
  7068 + // if ($("#amount-2").val() == '')
  7069 + // {
  7070 + // $('#canvasPaint').sketch({ defaultSize: $scope.shapesize });
  7071 + // }
  7072 + // else
  7073 + // {
  7074 +
  7075 + // var a = $("#amount-2").val();
  7076 + // $scope.shapesize = parseInt(a);
  7077 + // alert(JSON.stringify({ defaultSize: $scope.shapesize }));
  7078 + // $('#canvasPaint').sketch({ defaultSize: $scope.shapesize });
  7079 +
  7080 + // }
  7081 +
  7082 +
  7083 + // break;
  7084 +
  7085 + //}
  7086 +
  7087 + }
  7088 +
  7089 +
  7090 +
  7091 + $(document).keydown(function (event) {
  7092 +
  7093 +
  7094 + if (event.which == 46) {
  7095 + //debugger;
  7096 + if ($rootScope.shapeTypePin == "Pin") {
  7097 +
  7098 +
  7099 + $("#canvas").removeLayer($rootScope.canvasLayerNameCollection[0].pinName).drawLayers();
  7100 + $("#canvas").removeLayer($rootScope.canvasLayerNameCollection[0].ArcName).drawLayers();
  7101 + $rootScope.shapeTypePin = "";
  7102 +
  7103 + }
  7104 + else if ($rootScope.shapeTypeText == "textAreaRect") {
  7105 +
  7106 +
  7107 +
  7108 + $("#canvas").removeLayer($rootScope.canvasLayerNameCollection[0].textareaRectangle).drawLayers();
  7109 + $("#canvas").removeLayer($rootScope.canvasLayerNameCollection[0].textareaString).drawLayers();
  7110 + $rootScope.shapeTypeText = "";
  7111 +
  7112 + }
  7113 + else {
  7114 +
  7115 + // alert($rootScope.canvasLayerNameCollection);
  7116 + $("#canvas").removeLayer($rootScope.canvasLayerNameCollection).drawLayers();
  7117 + }
  7118 +
  7119 +
  7120 + }
  7121 +
  7122 + });
  7123 +
  7124 + //body highlight options functinality
  7125 + $scope.LoadBodySystemData = function () {
  7126 +
  7127 + var currentBodyViewId = $rootScope.voId;
  7128 + var systemListHtml = '<ul class="dropdown-menu" aria-labelledby="dropdownMenu2"><li><a href="#" title="Current Structure">Current Structure</a></li> <li role="separator" class="divider"></li>'
  7129 + var systemList = $rootScope.CommonData.DACommonData.BodySystems.Item;
  7130 +
  7131 + angular.forEach(systemList, function (value, key) {
  7132 +
  7133 + systemListHtml = systemListHtml + '<li><a href="#" id="' + value._BodySystemId + '" title="' + value._Name + '">' + value._Name + '</a></li>'
  7134 + })
  7135 +
  7136 + systemListHtml = systemListHtml + '</ul>';
  7137 + $('#bodySystem').append(systemListHtml);
  7138 +
  7139 + var bodySystemDataPath = '~/../content/data/json/da/body-views/' + currentBodyViewId + '/da_dat_body_system_term_' + currentBodyViewId + '.json';
  7140 + DataService.getJson(bodySystemDataPath)
  7141 + .then(
  7142 + function (result) {
  7143 +
  7144 + $rootScope.BodySystemData = result;
  7145 +
  7146 + },
  7147 + function (error) {
  7148 + console.log(error.statusText)
  7149 + }
  7150 + )
  7151 +
  7152 + }
  7153 +
  7154 + $scope.HighlightBodyByBodySystem = function (event) {
  7155 +
  7156 + //if listanager is visisble then close it
  7157 +
  7158 + $rootScope.isListManagerSelected = false;
  7159 + $rootScope.CloseListManager();
  7160 +
  7161 +
  7162 + //NIKITA
  7163 + $scope.isHighlightBodyByBodySystem = true;
  7164 + $scope.systemMatchedTermList = new jinqJs()
  7165 + .from($rootScope.BodySystemData.BodySystem.BodySystemTerm)
  7166 + .where('_SystemNumber == ' + event.currentTarget.id)
  7167 + .select();
  7168 +
  7169 + if ($rootScope.isHighLight == false) {
  7170 + //color the body gray
  7171 + $rootScope.isHighLight = true
  7172 + console.log('highLightBody from HighlightBodyByBodySystem')
  7173 + $scope.highLightBody();
  7174 + }
  7175 + //now highlight the selected body system in whole body
  7176 +
  7177 +
  7178 + //$rootScope.isLoading = true;
  7179 + $('#spinner').css('visibility', 'visible');
  7180 +
  7181 + //NIKITA
  7182 + // $scope.isHighlightBodyByBodySystem = true;
  7183 +
  7184 + //if (systemMatchedTermList != null || systemMatchedTermList != undefined) {
  7185 +
  7186 + // $timeout(function () { $scope.HighlightBodyByTermList(systemMatchedTermList) }, 100);
  7187 + //}
  7188 +
  7189 +
  7190 + var viewtarget_highlightbody = angular.element(event.currentTarget);
  7191 + var title_highlightbody = viewtarget_highlightbody.attr('title');
  7192 +
  7193 + if (title_highlightbody == "Cardiovascular") {
  7194 + $scope.CurrentStructure = "";
  7195 + $scope.Cardiovascular = "active";
  7196 + $scope.Digestive = "";
  7197 + $scope.Endocrine = "";
  7198 + $scope.Immune = "";
  7199 + $scope.Integumentary = "";
  7200 + $scope.Lymphatic = "";
  7201 + $scope.Muscular = "";
  7202 + $scope.Nervous = "";
  7203 + $scope.Reproductive = "";
  7204 + $scope.Respiratory = "";
  7205 + $scope.Skeletal = "";
  7206 + $scope.Urinary = "";
  7207 + }
  7208 +
  7209 + if (title_highlightbody == "Digestive") {
  7210 + $scope.CurrentStructure = "";
  7211 + $scope.Cardiovascular = "";
  7212 + $scope.Digestive = "active";
  7213 + $scope.Endocrine = "";
  7214 + $scope.Immune = "";
  7215 + $scope.Integumentary = "";
  7216 + $scope.Lymphatic = "";
  7217 + $scope.Muscular = "";
  7218 + $scope.Nervous = "";
  7219 + $scope.Reproductive = "";
  7220 + $scope.Respiratory = "";
  7221 + $scope.Skeletal = "";
  7222 + $scope.Urinary = "";
  7223 + }
  7224 +
  7225 + if (title_highlightbody == "Endocrine") {
  7226 + $scope.CurrentStructure = "";
  7227 + $scope.Cardiovascular = "";
  7228 + $scope.Digestive = "";
  7229 + $scope.Endocrine = "active";
  7230 + $scope.Immune = "";
  7231 + $scope.Integumentary = "";
  7232 + $scope.Lymphatic = "";
  7233 + $scope.Muscular = "";
  7234 + $scope.Nervous = "";
  7235 + $scope.Reproductive = "";
  7236 + $scope.Respiratory = "";
  7237 + $scope.Skeletal = "";
  7238 + $scope.Urinary = "";
  7239 + }
  7240 + if (title_highlightbody == "Immune") {
  7241 +
  7242 + $scope.CurrentStructure = "";
  7243 + $scope.Cardiovascular = "";
  7244 + $scope.Digestive = "";
  7245 + $scope.Endocrine = "";
  7246 + $scope.Immune = "active";
  7247 + $scope.Integumentary = "";
  7248 + $scope.Lymphatic = "";
  7249 + $scope.Muscular = "";
  7250 + $scope.Nervous = "";
  7251 + $scope.Reproductive = "";
  7252 + $scope.Respiratory = "";
  7253 + $scope.Skeletal = "";
  7254 + $scope.Urinary = "";
  7255 + }
  7256 + if (title_highlightbody == "Integumentary") {
  7257 + $scope.CurrentStructure = "";
  7258 + $scope.Cardiovascular = "";
  7259 + $scope.Digestive = "";
  7260 + $scope.Endocrine = "";
  7261 + $scope.Immune = "";
  7262 + $scope.Integumentary = "active";
  7263 + $scope.Lymphatic = "";
  7264 + $scope.Muscular = "";
  7265 + $scope.Nervous = "";
  7266 + $scope.Reproductive = "";
  7267 + $scope.Respiratory = "";
  7268 + $scope.Skeletal = "";
  7269 + $scope.Urinary = "";
  7270 + }
  7271 + if (title_highlightbody == "Lymphatic") {
  7272 + $scope.CurrentStructure = "";
  7273 + $scope.Cardiovascular = "";
  7274 + $scope.Digestive = "";
  7275 + $scope.Endocrine = "";
  7276 + $scope.Immune = "";
  7277 + $scope.Integumentary = "";
  7278 + $scope.Lymphatic = "active";
  7279 + $scope.Muscular = "";
  7280 + $scope.Nervous = "";
  7281 + $scope.Reproductive = "";
  7282 + $scope.Respiratory = "";
  7283 + $scope.Skeletal = "";
  7284 + $scope.Urinary = "";
  7285 + }
  7286 + if (title_highlightbody == "Muscular") {
  7287 + $scope.CurrentStructure = "";
  7288 + $scope.Cardiovascular = "";
  7289 + $scope.Digestive = "";
  7290 + $scope.Endocrine = "";
  7291 + $scope.Immune = "";
  7292 + $scope.Integumentary = "";
  7293 + $scope.Lymphatic = "";
  7294 + $scope.Muscular = "active";
  7295 + $scope.Nervous = "";
  7296 + $scope.Reproductive = "";
  7297 + $scope.Respiratory = "";
  7298 + $scope.Skeletal = "";
  7299 + $scope.Urinary = "";
  7300 + }
  7301 + if (title_highlightbody == "Nervous") {
  7302 + $scope.CurrentStructure = "";
  7303 + $scope.Cardiovascular = "";
  7304 + $scope.Digestive = "";
  7305 + $scope.Endocrine = "";
  7306 + $scope.Immune = "";
  7307 + $scope.Integumentary = "";
  7308 + $scope.Lymphatic = "";
  7309 + $scope.Muscular = "";
  7310 + $scope.Nervous = "active";
  7311 + $scope.Reproductive = "";
  7312 + $scope.Respiratory = "";
  7313 + $scope.Skeletal = "";
  7314 + $scope.Urinary = "";
  7315 + }
  7316 + if (title_highlightbody == "Reproductive") {
  7317 + $scope.CurrentStructure = "";
  7318 + $scope.Cardiovascular = "";
  7319 + $scope.Digestive = "";
  7320 + $scope.Endocrine = "";
  7321 + $scope.Immune = "";
  7322 + $scope.Integumentary = "";
  7323 + $scope.Lymphatic = "";
  7324 + $scope.Muscular = "";
  7325 + $scope.Nervous = "";
  7326 + $scope.Reproductive = "active";
  7327 + $scope.Respiratory = "";
  7328 + $scope.Skeletal = "";
  7329 + $scope.Urinary = "";
  7330 + }
  7331 + if (title_highlightbody == "Respiratory") {
  7332 + $scope.CurrentStructure = "";
  7333 + $scope.Cardiovascular = "";
  7334 + $scope.Digestive = "";
  7335 + $scope.Endocrine = "";
  7336 + $scope.Immune = "";
  7337 + $scope.Integumentary = "";
  7338 + $scope.Lymphatic = "";
  7339 + $scope.Muscular = "";
  7340 + $scope.Nervous = "";
  7341 + $scope.Reproductive = "";
  7342 + $scope.Respiratory = "active";
  7343 + $scope.Skeletal = "";
  7344 + $scope.Urinary = "";
  7345 + }
  7346 + if (title_highlightbody == "Skeletal") {
  7347 + $scope.CurrentStructure = "";
  7348 + $scope.Cardiovascular = "";
  7349 + $scope.Digestive = "";
  7350 + $scope.Endocrine = "";
  7351 + $scope.Immune = "";
  7352 + $scope.Integumentary = "";
  7353 + $scope.Lymphatic = "";
  7354 + $scope.Muscular = "";
  7355 + $scope.Nervous = "";
  7356 + $scope.Reproductive = "";
  7357 + $scope.Respiratory = "";
  7358 + $scope.Skeletal = "active";
  7359 + $scope.Urinary = "";
  7360 + }
  7361 + if (title_highlightbody == "Urinary") {
  7362 + $scope.CurrentStructure = "";
  7363 + $scope.Cardiovascular = "";
  7364 + $scope.Digestive = "";
  7365 + $scope.Endocrine = "";
  7366 + $scope.Immune = "";
  7367 + $scope.Integumentary = "";
  7368 + $scope.Lymphatic = "";
  7369 + $scope.Muscular = "";
  7370 + $scope.Nervous = "";
  7371 + $scope.Reproductive = "";
  7372 + $scope.Respiratory = "";
  7373 + $scope.Skeletal = "";
  7374 + $scope.Urinary = "active";
  7375 + }
  7376 +
  7377 + //Highlight button should be active
  7378 + $("#btnHighLight").addClass("btn-primary");
  7379 + $("#btnHighLight").removeClass("btn-black");
  7380 +
  7381 + if (!$("#btnNormalMode").hasClass("btn-black")) {
  7382 + $("#btnNormalMode").addClass("btn-black");
  7383 + }
  7384 +
  7385 + if (!$("#btnExtract").hasClass("btn-black")) {
  7386 + $("#btnExtract").addClass("btn-black");
  7387 + }
  7388 +
  7389 + if ($("#btnExtract").hasClass("btn-primary")) {
  7390 + $("#btnExtract").removeClass("btn-primary");
  7391 + }
  7392 +
  7393 + if ($("#btnNormalMode").hasClass("btn-primary")) {
  7394 + $("#btnNormalMode").removeClass("btn-primary");
  7395 + }
  7396 +
  7397 + }
  7398 +
  7399 + $scope.ShowSearch = function () {
  7400 +
  7401 + console.log('ShowSearch is called');
  7402 +
  7403 + $timeout(function () {
  7404 + $scope.IsSearchVisible = true;
  7405 +
  7406 + document.getElementById("termlistfilter").style.display = "block";
  7407 + }, 1000);
  7408 +
  7409 + //$scope.IsSearchVisible = true;
  7410 +
  7411 + //document.getElementById("termlistfilter").style.display = "block";
  7412 + }
  7413 +
  7414 + $scope.HideSearch = function () {
  7415 + if ($("#backdrop").is(":hover") || $("#termlistfilter").is(":hover") || $("#typedtermname").is(":focus")) {
  7416 + $scope.IsSearchVisible = true;
  7417 + document.getElementById("termlistfilter").style.display = "block";
  7418 + }
  7419 + else {
  7420 + $scope.IsSearchVisible = false;
  7421 + document.getElementById("termlistfilter").style.display = "none";
  7422 + $scope.searchFilter = "";
  7423 + }
  7424 +
  7425 + }
  7426 +
  7427 + $scope.jumpToTerm = function (event) {
  7428 + $scope.searchFilter = event.currentTarget.innerHTML;
  7429 + $scope.HighlightBodyOnListManagerSelection(event);
  7430 +
  7431 + $scope.IsSearchVisible = false;
  7432 +
  7433 + //Highlight only Highlight button
  7434 +
  7435 + $("#btnHighLight").addClass("btn-primary");
  7436 + $("#btnHighLight").removeClass("btn-black");
  7437 +
  7438 + if (!$("#btnNormalMode").hasClass("btn-black")) {
  7439 + $("#btnNormalMode").addClass("btn-black");
  7440 + }
  7441 +
  7442 + if (!$("#btnExtract").hasClass("btn-black")) {
  7443 + $("#btnExtract").addClass("btn-black");
  7444 + }
  7445 +
  7446 + if ($("#btnExtract").hasClass("btn-primary")) {
  7447 + $("#btnExtract").removeClass("btn-primary");
  7448 + }
  7449 +
  7450 + if ($("#btnNormalMode").hasClass("btn-primary")) {
  7451 + $("#btnNormalMode").removeClass("btn-primary");
  7452 + }
  7453 +
  7454 + }
  7455 +
  7456 + //Function to set the vertical and horizontal scroll position of CanvasDiv as per the Navigator
  7457 + $scope.ScrollCanvasDiv = function () {
  7458 +
  7459 + var x = $("#draggable").position();
  7460 + var can = $('#canvasDiv');
  7461 + var canheight = can[0].scrollHeight;
  7462 + var canwidth = can[0].scrollWidth;
  7463 +
  7464 + var scrolly = (x.top / ($('#containment-wrapper').height())) * (canheight);
  7465 +
  7466 + var scrollx = (x.left / $('#containment-wrapper').width()) * (canwidth);
  7467 +
  7468 + $("#canvasDiv").scrollTop(scrolly);
  7469 + $("#canvasDiv").scrollLeft(scrollx);
  7470 +
  7471 + if (($scope.isHighlightBodyByBodySystem == true) && ($scope.systemMatchedTermList != null || $scope.systemMatchedTermList != undefined)) {
  7472 + $timeout(function () { $scope.HighlightBodyByTermList(systemMatchedTermList) }, 100);
  7473 + }
  7474 +
  7475 + }
  7476 +
  7477 + //list manager
  7478 + $scope.$on('listManagerEvent', function (event, data) {
  7479 + // debugger;
  7480 + $('#spinner').css('visibility', 'visible');
  7481 + console.log('listManagerEvent')
  7482 + if ($rootScope.islistManagerEventAlredayDispachted == true) {
  7483 +
  7484 +
  7485 + var systemList = $rootScope.CommonData.DACommonData.BodySystems.Item;
  7486 +
  7487 + $('#bodySystems').empty();
  7488 +
  7489 +
  7490 + var $all = $('<option ng-click=refreshTermListOnSystemSelection($event) id="0" selected="">All</option>').appendTo('#bodySystems');
  7491 + $compile($all)($scope);
  7492 +
  7493 + angular.forEach(systemList, function (value, key) {
  7494 +
  7495 + var $elem = $('<option ng-click=refreshTermListOnSystemSelection($event) id="' + value._BodySystemId + '" title="' + value._Name + '" >' + value._Name + '</option>').appendTo('#bodySystems');
  7496 + $compile($elem)($scope);
  7497 + })
  7498 +
  7499 +
  7500 +
  7501 +
  7502 + var currentView = localStorage.getItem("currentViewTitle");
  7503 + var viewNmeHtml = '<option>' + currentView + '</option>'
  7504 + $('#viewName').append(viewNmeHtml);
  7505 +
  7506 + var len = $rootScope.openModules.length;
  7507 + var openViewLen = $rootScope.openViews.length;
  7508 +
  7509 + var currentOpenModuleId = $rootScope.openModules[len - 1].ModuleId;
  7510 + var currentOpenViewId = $rootScope.openViews[openViewLen - 1].BodyViewId;
  7511 + $rootScope.viewOrientationId = currentOpenViewId;
  7512 + //confirm that this is DA module which is last open
  7513 + if (currentOpenModuleId == 1) {
  7514 +
  7515 +
  7516 + $('#termList').empty();
  7517 + $scope.loadListManger();
  7518 +
  7519 +
  7520 + //})
  7521 + // .error(function (data, status, headers, config) {
  7522 +
  7523 + // console.log(data);
  7524 +
  7525 + // });
  7526 +
  7527 +
  7528 +
  7529 + $rootScope.islistManagerEventAlredayDispachted = false;
  7530 + var jj;
  7531 + }
  7532 +
  7533 + }
  7534 +
  7535 +
  7536 +
  7537 + });
  7538 +
  7539 + $scope.loadListManger = function () {
  7540 +
  7541 +
  7542 +
  7543 + //var path = '~/../content/data/json/da/vocab/english/cm_dat_vocabterm_1.json'
  7544 +
  7545 + //$http({ method: 'GET', url: '~/../content/data/json/da/vocab/english/cm_dat_vocabterm_1.json' }).success(function (data) {
  7546 +
  7547 + //var VocabTermData = data;
  7548 +
  7549 + var vocabTermTxt = [];
  7550 +
  7551 + angular.forEach($rootScope.TermNumberData.TermData.Term, function (value1, key1) {
  7552 +
  7553 + angular.forEach($rootScope.VocabTermData.VocabTerms.Term, function (value2, key2) {
  7554 +
  7555 +
  7556 + if (value1._ActualTermNumber === value2._ActualTermNumber) {
  7557 + vocabTermTxt.push(
  7558 +
  7559 + {
  7560 +
  7561 + "_ActualTermNumber": value2._ActualTermNumber,
  7562 + "_TermText": value2._TermText,
  7563 + "_cdId": value2._cdId
  7564 +
  7565 + }
  7566 +
  7567 + );
  7568 +
  7569 + }
  7570 +
  7571 + })
  7572 +
  7573 +
  7574 +
  7575 + })
  7576 +
  7577 +
  7578 +
  7579 + $scope.VocabTermTxt = new jinqJs()
  7580 + .from(vocabTermTxt)
  7581 + .distinct('_TermText', '_ActualTermNumber')
  7582 + .orderBy([{ field: '_TermText', sort: 'asc' }])
  7583 + .select('_ActualTermNumber', '_TermText', '_cdId');
  7584 +
  7585 + if ($scope.VocabTermTxt != null || $scope.VocabTermTxt != undefined) {
  7586 +
  7587 +
  7588 + for (var j = 0; j < $scope.VocabTermTxt.length; j++) {
  7589 + var $el = $('<option ng-click=HighlightBodyOnListManagerSelection($event) id=' + $scope.VocabTermTxt[j]._ActualTermNumber + '>' + $scope.VocabTermTxt[j]._TermText + '</option>').appendTo('#termList')
  7590 + $compile($el)($scope);
  7591 + $rootScope.isLoading = false;
  7592 + $('#spinner').css('visibility', 'hidden');
  7593 + }
  7594 + var termsTotal = '<span class="pull-left marginTop5">' + $scope.VocabTermTxt.length + ' Structures</span>';
  7595 + $("#totalTerms").empty();
  7596 + $('#totalTerms').append(termsTotal);
  7597 +
  7598 +
  7599 + }
  7600 + // })
  7601 +
  7602 +
  7603 + //.error(function (data, status, headers, config) {
  7604 +
  7605 + // console.log(data);
  7606 +
  7607 + //});
  7608 + }
  7609 +
  7610 +
  7611 + $scope.HighlightBodyOnListManagerSelection = function (event) {
  7612 +
  7613 + $scope.terminateCurrentlyRunningWPs();
  7614 + //debugger
  7615 + $rootScope.isListManagerSelected = true;
  7616 + $rootScope.isLoading = true;
  7617 +
  7618 + $('#spinner').css('visibility', 'visible');
  7619 + //1.
  7620 + var actualTermNumber = event.currentTarget.id;//attributes[0].value;
  7621 + $scope.TermList = $scope.getTermNumberList(actualTermNumber);
  7622 +
  7623 + //2.
  7624 + var internalLayerNumberList = [];
  7625 + for (var i = 0; i < $scope.TermList.length; i++) {
  7626 + var layerNumber = $scope.TermList[i]._InternalLayerNumber
  7627 +
  7628 + internalLayerNumberList[i] = parseInt(layerNumber);
  7629 + }
  7630 +
  7631 + internalLayerNumberList.sort(function (a, b) { return a - b })
  7632 + var internalLayerNumber = internalLayerNumberList[0]//.replace('00', '');
  7633 +
  7634 + //3. get layer number
  7635 + if (internalLayerNumber >= DA[0].SKIN_START_INTERNAL_LAYER && internalLayerNumber <= DA[0].SKIN_END_INTERNAL_LAYER) {
  7636 +
  7637 + internalLayerNumber = DA[0].SKIN_DEFAULT_INTERNAL_LAYER;
  7638 + }
  7639 +
  7640 + var layerNumber;
  7641 + var matchedLayerNumber = new jinqJs()
  7642 + .from($rootScope.BodyLayerData.Layers.DataLayer)
  7643 + .where("_lni == " + internalLayerNumber)
  7644 + .select('_LayerNumber');
  7645 +
  7646 + if (matchedLayerNumber == null || matchedLayerNumber.length == 0) {
  7647 + layerNumber = 0;
  7648 + }
  7649 + else {
  7650 + layerNumber = matchedLayerNumber[0]._LayerNumber
  7651 + }
  7652 +
  7653 + if (layerNumber == 0) {
  7654 + layerNumber = $scope.totalLayers;
  7655 + }
  7656 + else {
  7657 + layerNumber = parseInt(layerNumber) - 1;
  7658 + }
  7659 +
  7660 + $scope.layerNumber = layerNumber;
  7661 +
  7662 + //4.get scroll position
  7663 + if (actualTermNumber != DA[0].SKIN_TERM_ID) {
  7664 +
  7665 + $scope.termCoordinate = $scope.getTermCoordinate(actualTermNumber);
  7666 +
  7667 + }
  7668 +
  7669 + //5.
  7670 + $scope.matchdedDataOnLayer = new jinqJs()
  7671 + .from($rootScope.TermNumberData.TermData.Term)
  7672 + .where('_InternalLayerNumber == ' + internalLayerNumber)
  7673 + .select();
  7674 +
  7675 + if ($scope.matchdedDataOnLayer != null || $scope.matchdedDataOnLayer != undefined) {
  7676 +
  7677 + //6.
  7678 + var matchedDataonActualTerm = new jinqJs()
  7679 + .from($scope.matchdedDataOnLayer)
  7680 + .where('_ActualTermNumber == ' + actualTermNumber)
  7681 + .select('_TermNumber');
  7682 +
  7683 + if (matchedDataonActualTerm != null || matchedDataonActualTerm != undefined) {
  7684 +
  7685 + var termNo = matchedDataonActualTerm[0]._TermNumber.toString();
  7686 +
  7687 + //7.get termList
  7688 + $scope.fullTermlist = [];
  7689 + $scope.AllTerms = [];
  7690 +
  7691 + if (termNo != DA[0].figLeafTermId) {
  7692 +
  7693 + $scope.getChildTermList(termNo);
  7694 + // $timeout(function () { $scope.getSiblings(termNo) }, 50);
  7695 + $scope.getSiblings(termNo)
  7696 + }
  7697 +
  7698 + }
  7699 + }
  7700 +
  7701 + $('#txtlayerNumber').val((parseInt($scope.layerNumber)));
  7702 + $('#layerChangeSlider').slider("option", "value", parseInt($scope.totalLayers) - parseInt($scope.layerNumber));
  7703 +
  7704 + //8.remove current layer canavses
  7705 + $scope.flushCanvas();
  7706 +
  7707 +
  7708 +
  7709 + //9.
  7710 + $timeout(function () {
  7711 + $rootScope.isHighLight = false;
  7712 + $('#sppeachBubble').css('display', 'none');
  7713 + $("#dot").css("display", "none");
  7714 +
  7715 + //redraw body of respective layer
  7716 + $scope.CalculateImageCordinates($rootScope.viewOrientationId)
  7717 + }, 500);
  7718 +
  7719 +
  7720 +
  7721 + }
  7722 +
  7723 + $scope.getChildTermList = function (termNo) {
  7724 +
  7725 +
  7726 + var data = new jinqJs()
  7727 + .from($scope.matchdedDataOnLayer)
  7728 + .where("_ParentTermNumber == " + termNo)
  7729 + .select();
  7730 +
  7731 + if (data != null || data != undefined) {
  7732 +
  7733 +
  7734 + var data2 = new jinqJs()
  7735 + .from(data)
  7736 + .where("_TermNumber != " + termNo)
  7737 + .select();
  7738 +
  7739 +
  7740 + var k;
  7741 + if ((data2 != null || data2 != undefined) && (data2.length > 0)) {
  7742 + for (var i = 0; i < data2.length; i++) {
  7743 +
  7744 + var serachTerm = data2[i]._TermNumber;
  7745 + var isFound = jQuery.inArray(serachTerm, $scope.fullTermlist)
  7746 + if (isFound == -1) {
  7747 + $scope.fullTermlist.push(serachTerm);
  7748 + $scope.AllTerms.push({ '_TermNumber': serachTerm })
  7749 + $scope.getChildTermList(serachTerm);
  7750 + }
  7751 + }
  7752 + }
  7753 + }
  7754 + }
  7755 +
  7756 + $scope.getSiblings = function (termNo) {
  7757 +
  7758 + var data = new jinqJs()
  7759 + .from($scope.matchdedDataOnLayer)
  7760 + .where("_TermNumber == " + termNo)
  7761 + .select();
  7762 +
  7763 + if (data != null || data != undefined) {
  7764 +
  7765 + var termNo = data[0]._ActualTermNumber;
  7766 +
  7767 + var data2 = new jinqJs()
  7768 + .from($scope.matchdedDataOnLayer)
  7769 + .where("_ActualTermNumber == " + termNo)
  7770 + .select();
  7771 +
  7772 + if ((data2 != null || data2 != undefined) && (data2.length > 0)) {
  7773 + for (var i = 0; i < data2.length; i++) {
  7774 + $scope.fullTermlist.push(data2[i]._TermNumber);
  7775 + $scope.AllTerms.push({ '_TermNumber': data2[i]._TermNumber })
  7776 + $scope.getChildTermList(data2[i]._TermNumber);
  7777 + }
  7778 + }
  7779 + }
  7780 + }
  7781 +
  7782 + $scope.getTermCoordinate = function (actualTermNumber) {
  7783 +
  7784 + return {
  7785 + x: $scope.TermList[0]._CenterX,
  7786 + y: $scope.TermList[0]._CenterY
  7787 + }
  7788 + }
  7789 +
  7790 + $scope.aligneCanvasWithTerm = function () {
  7791 + console.log('aligneCanvasWithTerm')
  7792 + var newX = parseInt($scope.scaleValue($scope.termCoordinate.x, $scope.zoomInOut, DA[0].ZOOM_TERM_DATA));
  7793 + var newY = parseInt($scope.scaleValue($scope.termCoordinate.y, $scope.zoomInOut, DA[0].ZOOM_TERM_DATA));
  7794 +
  7795 + var canvasX = parseInt($('#canvasDiv').css('left'));
  7796 + var canvasY = parseInt($('#canvasDiv').css('top'));
  7797 + var canvasWidth = parseInt($('#canvasDiv').css('width'));
  7798 + var canvasHeight = parseInt($('#canvasDiv').css('height'));
  7799 + var canvasBottom = canvasY + canvasHeight;
  7800 + var canvasRight = canvasX + canvasWidth
  7801 +
  7802 +
  7803 + if (newX >= canvasX && newX <= canvasRight && newY >= canvasY && newY <= canvasBottom) {
  7804 +
  7805 + }
  7806 + else {
  7807 + newX = newX - canvasWidth / 2;
  7808 + newY = newY - canvasHeight / 2;
  7809 +
  7810 + }
  7811 +
  7812 +
  7813 +
  7814 + console.log('newX =' + newX + ',newY= ' + newY)
  7815 + $('#canvasDiv').scrollLeft(newX);
  7816 + $('#canvasDiv').scrollTop(newY);
  7817 +
  7818 +
  7819 + }
  7820 +
  7821 + $scope.scaleValue = function (nValue, nNewZoom, nExistingZoom) {
  7822 +
  7823 + var iReturnValue = nValue * nNewZoom;
  7824 + return Math.round(iReturnValue / nExistingZoom);
  7825 + }
  7826 +
  7827 + $scope.refreshTermListOnSystemSelection = function (event) {
  7828 +
  7829 + $('#termList').empty();
  7830 + // $('#termList').innerHTML = '';
  7831 +
  7832 + if (event.currentTarget.id == 0) {
  7833 + $scope.loadListManger();
  7834 + }
  7835 + else {
  7836 + var bodySystemDataPath = '~/../content/data/json/da/body-views/' + localStorage.getItem("currentBodyViewId") + '/da_dat_body_system_term_' + localStorage.getItem("currentBodyViewId") + '.json';
  7837 + DataService.getJson(bodySystemDataPath)
  7838 + .then(
  7839 + function (result) {
  7840 +
  7841 + $rootScope.BodySystemData = result;
  7842 + var systemMatchedTermList = new jinqJs()
  7843 + .from($rootScope.BodySystemData.BodySystem.BodySystemTerm)
  7844 + .where('_SystemNumber == ' + event.currentTarget.id)
  7845 + .select();
  7846 + if (systemMatchedTermList != null || systemMatchedTermList != undefined) {
  7847 +
  7848 + $scope.refreshTerms(systemMatchedTermList);
  7849 + }
  7850 + },
  7851 + function (error) {
  7852 + console.log(error.statusText)
  7853 + }
  7854 + )
  7855 +
  7856 + }
  7857 + }
  7858 +
  7859 + $scope.refreshTerms = function (termList) {
  7860 +
  7861 + var path = '~/../content/data/json/da/vocab/english/cm_dat_vocabterm_1.json'
  7862 +
  7863 + $http({ method: 'GET', url: '~/../content/data/json/da/vocab/english/cm_dat_vocabterm_1.json' }).success(function (data) {
  7864 +
  7865 + var VocabTermData = data;
  7866 +
  7867 + var vocabTermTxt = [];
  7868 +
  7869 + for (var i = 0; i < termList.length; i++) {
  7870 +
  7871 + var actulaTermNumber = new jinqJs()
  7872 + .from($rootScope.TermNumberData.TermData.Term)
  7873 + .where('_TermNumber == ' + termList[i]._TermNumber)
  7874 + .select('_ActualTermNumber');
  7875 +
  7876 + if (actulaTermNumber != null || actulaTermNumber != undefined) {
  7877 +
  7878 +
  7879 + angular.forEach(VocabTermData.VocabTerms.Term, function (value2, key2) {
  7880 +
  7881 +
  7882 + if (actulaTermNumber[0]._ActualTermNumber == value2._ActualTermNumber) {
  7883 + vocabTermTxt.push(
  7884 +
  7885 + {
  7886 +
  7887 + "_ActualTermNumber": value2._ActualTermNumber,
  7888 +
  7889 + "_TermText": value2._TermText,
  7890 +
  7891 + "_cdId": value2._cdId
  7892 +
  7893 + }
  7894 +
  7895 + );
  7896 +
  7897 + }
  7898 +
  7899 + })
  7900 +
  7901 + }
  7902 + }
  7903 +
  7904 + $scope.VocabTermTxt = new jinqJs()
  7905 + .from(vocabTermTxt)
  7906 + .distinct('_TermText', '_ActualTermNumber')
  7907 + .orderBy([{ field: '_TermText', sort: 'asc' }])
  7908 + .select('_ActualTermNumber', '_TermText', '_cdId');
  7909 +
  7910 + if ($scope.VocabTermTxt != null || $scope.VocabTermTxt != undefined) {
  7911 +
  7912 +
  7913 + for (var j = 0; j < $scope.VocabTermTxt.length; j++) {
  7914 + var $el = $('<option ng-click=HighlightBodyOnListManagerSelection($event) id=' + $scope.VocabTermTxt[j]._ActualTermNumber + '>' + $scope.VocabTermTxt[j]._TermText + '</option>').appendTo('#termList')
  7915 + $compile($el)($scope);
  7916 + }
  7917 +
  7918 + var termsTotal = '<span class="pull-left marginTop5">' + $scope.VocabTermTxt.length + ' Structures</span>';
  7919 + $("#totalTerms").empty();
  7920 + //$('#totalTerms').innerHTML = '';
  7921 +
  7922 + $('#totalTerms').append(termsTotal);
  7923 + $rootScope.isLoading = false;
  7924 + $('#spinner').css('visibility', 'hidden');
  7925 + }
  7926 + })
  7927 +
  7928 + .error(function (data, status, headers, config) {
  7929 + console.log(data);
  7930 +
  7931 + });
  7932 +
  7933 + }
  7934 +
  7935 +
  7936 +}]
  7937 +
  7938 +);
0 7939 \ No newline at end of file
... ...
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
... ... @@ -130,10 +130,30 @@ AIA.controller(&quot;HomeController&quot;, [&quot;$rootScope&quot;, &quot;Modules&quot;, &quot;$log&quot;, &quot;$location&quot;,
130 130 }
131 131  
132 132 $rootScope.OnIdentifyClick = function () {
133   - $rootScope.isIdetifyClicked = true;
134   - $rootScope.isDrawingToolSelected = false;
  133 + // $rootScope.isIdetifyClicked = true;
  134 + // $rootScope.isDrawingToolSelected = false;
  135 + $("#canvasPaint").css("display", "none");
  136 + $("#canvas").css("display", "none");
  137 +
  138 + // $("#canvasPaint").css("z-index", "0");
  139 + // $("#canvas").css("z-index", "0");
  140 + $('.btnCursor').removeClass('activebtncolor');
  141 +
135 142 }
136 143  
  144 +
  145 +
  146 + $rootScope.DrawingMode = function () {
  147 +
  148 + $('.btnCursor').addClass('activebtncolor');
  149 + $rootScope.switchCanvas();
  150 + $("#canvasPaint").css("display", "block");
  151 + $("#canvas").css("display", "block");
  152 +
  153 + }
  154 +
  155 +
  156 +
137 157 //----Annotation Toolbar: Jcanvas-----
138 158  
139 159 $rootScope.DrawLine = function (e) {
... ... @@ -175,13 +195,27 @@ AIA.controller(&quot;HomeController&quot;, [&quot;$rootScope&quot;, &quot;Modules&quot;, &quot;$log&quot;, &quot;$location&quot;,
175 195 $(".btn-annotation-rectangle").addClass("activebtncolor");
176 196 }
177 197 $rootScope.paintBrush = function () {
178   -
179   - $('.btnCursor').addClass('activebtncolor');
  198 + // debugger;
  199 + // $('.btnCursor').addClass('activebtncolor');
180 200 $rootScope.switchCanvasToPaintCanvas();
181   -
182 201 $rootScope.shapeType = "FreeStylePaint";
183   - //alert($rootScope.shapeType);
  202 + var a = $("#amount-2").val();
  203 + $rootScope.shapeSize = parseInt(a);
  204 + if ($rootScope.shapeSize == '')
  205 + {
  206 + $('#canvasPaint').sketch({ defaultSize: 1 });
  207 + }
  208 + else
  209 + {
  210 + $('#canvasPaint').sketch({ defaultSize: $rootScope.shapeSize });
  211 +
  212 + }
  213 +
184 214  
  215 + // $('#canvasPaint').sketch();
  216 +
  217 +
  218 +
185 219 }
186 220  
187 221 $rootScope.switchCanvasToPaintCanvas = function (e) {
... ... @@ -219,7 +253,8 @@ AIA.controller(&quot;HomeController&quot;, [&quot;$rootScope&quot;, &quot;Modules&quot;, &quot;$log&quot;, &quot;$location&quot;,
219 253 $('.btnCursor').removeClass('activebtncolor');
220 254 $(".btn-annotation").removeClass("activebtncolor");
221 255 $(".btn-annotation-Text").addClass("activebtncolor");
222   -
  256 + // $("#text_area").val('');
  257 + // $("#text_area").css({ " font-family": 'Verdana, sans-serif', "font-size": "14px", "font-weight": "normal", "font-style": "normal", "color": "#000", "text-align": "left", "text-decoration": "none" });
223 258 }
224 259  
225 260 $rootScope.DrawPolygon = function () {
... ... @@ -276,7 +311,18 @@ AIA.controller(&quot;HomeController&quot;, [&quot;$rootScope&quot;, &quot;Modules&quot;, &quot;$log&quot;, &quot;$location&quot;,
276 311 $rootScope.shapestyleborderWidth = intPart[0];
277 312 $rootScope.shapestyleborderStyles = "solid";
278 313  
  314 +<<<<<<< HEAD
279 315 // $('#editshapestyle').modal('hide');
  316 +=======
  317 +
  318 + $('#editshapestyle').modal('hide');
  319 + // name: 'Circle_' + $rootScope.resetCircle,
  320 +
  321 +
  322 + // $("#canvas").removeLayer("TextRect_" + $rootScope.resetTextRect).drawLayers();
  323 +
  324 +
  325 +>>>>>>> Textarea_Text_Alignment
280 326 }
281 327  
282 328 $rootScope.enableAnnotationToolBar = function () {
... ...
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js.orig 0 → 100644
  1 +'use strict';
  2 +
  3 +AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", "$timeout",
  4 + function ($rootScope, Modules, $log, $location, $timeout) {
  5 +
  6 + //$scope.pageToOpen = {
  7 + // name: 'MainMenu'
  8 + //};
  9 + $rootScope.pageToOpen = 'app/widget/MainMenu.html';
  10 + $rootScope.currentBodyViewId;
  11 + $rootScope.currentActiveModuleTitle = 'Welcome to A.D.A.M. Interactive Anatomy';//Modules[0].Name;
  12 + $rootScope.currentActiveViewTitle;
  13 + $rootScope.cuurentActiveModuleId;
  14 + $rootScope.openModules = [];
  15 + $rootScope.openViews = [];
  16 + $rootScope.currentSlug;
  17 + $rootScope.jsPanelTitle;
  18 + $rootScope.ViewTitle;
  19 + $rootScope.isLoading = false;
  20 + $rootScope.isAnnotationWindowOpen = false;
  21 + $rootScope.isDrawingToolSelected = false;
  22 + $rootScope.isIdetifyClicked = true;
  23 + $rootScope.paint = false;
  24 + $rootScope.clickX = new Array();
  25 + $rootScope.clickY = new Array();
  26 + $rootScope.clickDrag = new Array();
  27 + $rootScope.isLineDrawSelecyed = false;
  28 + $rootScope.isAnnotationWindowClose = false;
  29 + $rootScope.lastX;
  30 + $rootScope.lastY;
  31 + $rootScope.CommonData;
  32 + $rootScope.shapeType;
  33 + $rootScope.globalSetting = {
  34 + ethnicity: 'W',
  35 + modesty: 'Y',
  36 + };
  37 + $rootScope.formsetting = {
  38 + ethnicity: null,
  39 + modesty: null
  40 + };
  41 +
  42 + $rootScope.isModestyOn;
  43 + $rootScope.isModestyOff;
  44 + $rootScope.SetSettingActiveTab;
  45 +
  46 + //jspanel functionality..
  47 +
  48 + $rootScope.openParent = function (slug) {
  49 + // debugger;
  50 + var openViews = $rootScope.openViews;
  51 + if (openViews.length > 0) {
  52 + $rootScope.openViews.splice(openViews.length - 1);
  53 + }
  54 + if (openViews.length > 0) {
  55 + var lastOpenMoudle = $rootScope.openViews[openViews.length - 1];
  56 + }
  57 + $('#daImagePanel').remove();
  58 + $location.url('/' + slug);
  59 +
  60 + $rootScope.$broadcast('jsPanelCloseEvent', true);
  61 + }
  62 +
  63 + //called on jsanel minimize
  64 + $rootScope.setState = function (state, title) {
  65 +
  66 +
  67 + var alreadyOpenThisView = new jinqJs()
  68 + .from($rootScope.openViews)
  69 + .where("body-views == " + title)
  70 + .select();
  71 + var k = 0;
  72 + if (alreadyOpenThisView != null) {
  73 + for (var i = 0; i < $rootScope.openViews.length; i++) {
  74 + k++;
  75 + if ($rootScope.openViews[i].body-views == title) {
  76 + $rootScope.openViews.splice((k - 1), 1);
  77 +
  78 + $rootScope.openViews.push(
  79 + {
  80 + "module": $rootScope.currentActiveModuleTitle, "body-views": title, "state": state, "BodyViewId": $rootScope.currentBodyViewId,
  81 + "slug": $rootScope.currentSlug
  82 + }
  83 + );
  84 + }
  85 + }
  86 + }
  87 + if (state == 'max') {
  88 + $('#daBodyview').css('width', '100%')
  89 + }
  90 + }
  91 +
  92 + $rootScope.DrawLine = function () {
  93 + //$rootScope.isIdetifyClicked = false;
  94 + //$rootScope.isDrawingToolSelected = true;
  95 + //$rootScope.isLineDrawSelecyed = true;
  96 + $rootScope.shapeType = "Line";
  97 + // alert($rootScope.shapeType);
  98 +
  99 +
  100 + }
  101 +
  102 + $rootScope.ClearIframe = function () {
  103 + if ($('#daImagePanel') != null)
  104 + $('#daImagePanel').remove();
  105 +
  106 + $rootScope.hideScrollbar();
  107 + }
  108 +
  109 + //ends
  110 +
  111 + $rootScope.hideScrollbar = function () {
  112 + $(".sidebar").mCustomScrollbar({
  113 + autoHideScrollbar: true,
  114 + //theme:"rounded"
  115 + });
  116 + }
  117 +
  118 + //annotation tool custom events
  119 + $rootScope.ShowAnnotationWindow = function () {
  120 + $rootScope.isAnnotationWindowOpen = true;
  121 + $(".annotationTollbar").css("display", "block");
  122 + $rootScope.$broadcast('annotationToolEvent', true);
  123 +
  124 + }
  125 +
  126 + $rootScope.CloseAnnotationTool = function () {
  127 + console.log('close')
  128 + $(".annotationTollbar").css("display", "none");
  129 + $rootScope.isAnnotationWindowClose = true;
  130 + }
  131 +
  132 + $rootScope.OnIdentifyClick = function () {
  133 + // $rootScope.isIdetifyClicked = true;
  134 + // $rootScope.isDrawingToolSelected = false;
  135 + $("#canvasPaint").css("display", "none");
  136 + $("#canvas").css("display", "none");
  137 +
  138 + // $("#canvasPaint").css("z-index", "0");
  139 + // $("#canvas").css("z-index", "0");
  140 + $('.btnCursor').removeClass('activebtncolor');
  141 +
  142 + }
  143 +
  144 +
  145 +
  146 + $rootScope.DrawingMode = function () {
  147 +
  148 + $('.btnCursor').addClass('activebtncolor');
  149 + $rootScope.switchCanvas();
  150 + $("#canvasPaint").css("display", "block");
  151 + $("#canvas").css("display", "block");
  152 +
  153 + }
  154 +
  155 +
  156 +
  157 + //----Annotation Toolbar: Jcanvas-----
  158 +
  159 + $rootScope.DrawLine = function (e) {
  160 + $rootScope.switchCanvas();
  161 + $rootScope.shapeType = "Line";
  162 +
  163 +
  164 + $('.btnCursor').removeClass('activebtncolor');
  165 + $(".btn-annotation").removeClass("activebtncolor");
  166 + $(".btn-annotation-line").addClass("activebtncolor");
  167 +
  168 +
  169 + }
  170 +
  171 +
  172 + $rootScope.DrawPin = function (e) {
  173 + $rootScope.switchCanvas();
  174 + $rootScope.shapeType = "Pin";
  175 +
  176 + $('.btnCursor').removeClass('activebtncolor');
  177 + $(".btn-annotation").removeClass("activebtncolor");
  178 + $(".btn-annotation-pin").addClass("activebtncolor");
  179 + }
  180 +
  181 + $rootScope.Cursor = function () {
  182 + $rootScope.switchCanvas();
  183 + $rootScope.shapeType = "cursor";
  184 +
  185 + $(".btn-annotation").removeClass("activebtncolor");
  186 + // $("#" + e.currentTarget.id).removeClass("activebtncolor");
  187 + $('.btnCursor').addClass('activebtncolor');
  188 + }
  189 +
  190 + $rootScope.DrawRectangle = function (e) {
  191 + $rootScope.switchCanvas();
  192 + $rootScope.shapeType = "Rectangle";
  193 + $('.btnCursor').removeClass('activebtncolor');
  194 + $(".btn-annotation").removeClass("activebtncolor");
  195 + $(".btn-annotation-rectangle").addClass("activebtncolor");
  196 + }
  197 + $rootScope.paintBrush = function () {
  198 +<<<<<<< HEAD
  199 + // debugger;
  200 + // $('.btnCursor').addClass('activebtncolor');
  201 +=======
  202 +
  203 + $('.btnCursor').addClass('activebtncolor');
  204 +>>>>>>> db0b2ac40dc61ee08fb471800773516967978732
  205 + $rootScope.switchCanvasToPaintCanvas();
  206 + $rootScope.shapeType = "FreeStylePaint";
  207 + var a = $("#amount-2").val();
  208 + $rootScope.shapeSize = parseInt(a);
  209 + if ($rootScope.shapeSize == '')
  210 + {
  211 + $('#canvasPaint').sketch({ defaultSize: 1 });
  212 + }
  213 + else
  214 + {
  215 + $('#canvasPaint').sketch({ defaultSize: $rootScope.shapeSize });
  216 +
  217 + }
  218 +
  219 +
  220 + // $('#canvasPaint').sketch();
  221 +
  222 +
  223 +
  224 + }
  225 +
  226 + $rootScope.switchCanvasToPaintCanvas = function (e) {
  227 + var canvasPaint_zIndex = $('#canvasPaint').css("z-index");
  228 + var canvas_zIndex = $('#canvas').css("z-index");
  229 + if (canvas_zIndex > canvasPaint_zIndex) {
  230 + canvasPaint_zIndex = parseInt(canvas_zIndex) + 1;
  231 +
  232 + }
  233 + else {
  234 + canvasPaint_zIndex = parseInt(canvasPaint_zIndex) + 1;
  235 + }
  236 + $('#canvasPaint').css("z-index", canvasPaint_zIndex);
  237 + }
  238 +
  239 + $rootScope.DrawCircle = function (e) {
  240 + $rootScope.switchCanvas();
  241 + $rootScope.shapeType = "Circle";
  242 + $('.btnCursor').removeClass('activebtncolor');
  243 + $(".btn-annotation").removeClass("activebtncolor");
  244 + $(".btn-annotation-circle").addClass("activebtncolor");
  245 + }
  246 +
  247 + $rootScope.DrawArrow = function (e) {
  248 + $rootScope.switchCanvas();
  249 + $rootScope.shapeType = "Arrow";
  250 + $('.btnCursor').removeClass('activebtncolor');
  251 + $(".btn-annotation").removeClass("activebtncolor");
  252 + $(".btn-annotation-arrow").addClass("activebtncolor");
  253 + }
  254 + $rootScope.DrawText = function () {
  255 + $rootScope.switchCanvas();
  256 +
  257 + $rootScope.shapeType = "TextArea";
  258 + $('.btnCursor').removeClass('activebtncolor');
  259 + $(".btn-annotation").removeClass("activebtncolor");
  260 + $(".btn-annotation-Text").addClass("activebtncolor");
  261 + // $("#text_area").val('');
  262 + // $("#text_area").css({ " font-family": 'Verdana, sans-serif', "font-size": "14px", "font-weight": "normal", "font-style": "normal", "color": "#000", "text-align": "left", "text-decoration": "none" });
  263 + }
  264 +
  265 + $rootScope.DrawPolygon = function () {
  266 + $rootScope.shapeType = "DrawPolygon";
  267 +
  268 + }
  269 +
  270 +
  271 + $rootScope.OpacityModal = function () {
  272 +
  273 +
  274 + }
  275 + $rootScope.switchCanvas = function () {
  276 + var x = $('#canvasPaint').css("z-index");
  277 +
  278 + var y = $('#canvas').css("z-index");
  279 + if (x > y) {
  280 + y = parseInt(x) + 1;
  281 + } else {
  282 + y = parseInt(y) + 1;
  283 + }
  284 + $('#canvas').css("z-index", y);
  285 + }
  286 + $rootScope.EraseDrawing = function () {
  287 + $rootScope.switchCanvasToPaintCanvas();
  288 + // $('#canvasPaint').sketch({ defaultColor: "yellow", defaultSize: 1 });
  289 + var sktch = $('#canvasPaint').sketch();
  290 + $('#canvasPaint').sketch().actions = []; // this line empties the actions.
  291 + var myCanvas = document.getElementById("canvasPaint");
  292 + var ctx = myCanvas.getContext('2d');
  293 + ctx.clearRect(0, 0, myCanvas.width, myCanvas.height);
  294 + $rootScope.switchCanvas();
  295 +
  296 + }
  297 +
  298 + //opacity code
  299 + $rootScope.shapestyleOpacity = 1;
  300 + $rootScope.shapestyleFillColor = "#fff";
  301 + $rootScope.shapestyleFillBorderColor = "black";
  302 + $rootScope.shapestyleborderWidth = 2;
  303 + $rootScope.shapestyleborderStyles = "solid";
  304 + $rootScope.shapestyle = function (id) {
  305 +
  306 + document.getElementById('modelbackground').style.display = "none";
  307 +
  308 + $rootScope.shapestyleOpacity = $("#" + id).css('opacity');
  309 + $rootScope.shapestyleFillColor = $("#" + id).parent().css('background-color');
  310 + $rootScope.shapestyleborderColor = $("#" + id).parent().css("border-top-color");
  311 + $rootScope.shapestyleborderWidthSeparatingPixel = $("#" + id).parent().css("border-top-width");
  312 + var pixelSeparation = $rootScope.shapestyleborderWidthSeparatingPixel;
  313 + var intPart = pixelSeparation.split("p");
  314 +
  315 + $rootScope.shapestyleborderWidth = intPart[0];
  316 + $rootScope.shapestyleborderStyles = "solid";
  317 +
  318 +<<<<<<< HEAD
  319 +
  320 + $('#editshapestyle').modal('hide');
  321 + // name: 'Circle_' + $rootScope.resetCircle,
  322 +
  323 +
  324 + // $("#canvas").removeLayer("TextRect_" + $rootScope.resetTextRect).drawLayers();
  325 +
  326 +
  327 +=======
  328 + $('#editshapestyle').modal('hide');
  329 +>>>>>>> db0b2ac40dc61ee08fb471800773516967978732
  330 + }
  331 +
  332 + $rootScope.enableAnnotationToolBar = function () {
  333 +
  334 + document.getElementById('modelbackground').style.display = "block";
  335 + $("#editshapestyle").modal('show');
  336 +
  337 + }
  338 +
  339 + $rootScope.disableAnnotationToolBar = function () {
  340 +
  341 + document.getElementById('modelbackground').style.display = "none";
  342 +
  343 + }
  344 +
  345 +
  346 + //----End-------------
  347 +
  348 + $rootScope.AddClick = function (x, y, dragging) {
  349 + $rootScope.clickX.push(x);
  350 + $rootScope.clickY.push(y);
  351 + $rootScope.clickDrag.push(dragging);
  352 + }
  353 +
  354 + $rootScope.Redraw = function () {
  355 + var context = document.getElementById('paintCanvas').getContext('2d');
  356 +
  357 + context.clearRect(0, 0, context.canvas.width, context.canvas.height); // Clears the canvas
  358 +
  359 + context.strokeStyle = "#FFFFFF";
  360 + context.lineJoin = "round";
  361 + context.lineWidth = 5;
  362 +
  363 +
  364 + for (var i = 0; i < $rootScope.clickX.length; i++) {
  365 + context.beginPath();
  366 + if ($rootScope.clickDrag[i] && i) {
  367 + context.moveTo($rootScope.clickX[i - 1], $rootScope.clickY[i - 1]);
  368 + } else {
  369 + context.moveTo($rootScope.clickX[i] - 1, $rootScope.clickY[i]);
  370 + }
  371 + context.lineTo($rootScope.clickX[i], $rootScope.clickY[i]);
  372 + context.closePath();
  373 + context.stroke();
  374 + }
  375 + }
  376 +
  377 + $rootScope.PaintCanvasMousedownListener = function (canvasContext, x, y) {
  378 + if ($rootScope.isLineDrawSelecyed == true) {
  379 +
  380 + canvasContext.lineWidth = 0.1;
  381 + //$scope.paintCanvasContext.lineJoin = 'round';
  382 + //$scope.paintCanvasContext.lineCap = 'round';
  383 + canvasContext.strokeStyle = 'red';
  384 +
  385 +
  386 + canvasContext.beginPath();
  387 +
  388 + //var canvasOffset = $("#myCanvas").offset();
  389 + //var offsetX = canvasOffset.left;
  390 + //var offsetY = canvasOffset.top;
  391 + canvasContext.moveTo(x, y);
  392 + }
  393 +
  394 + }
  395 +
  396 + $rootScope.PaintCanvasMouseupListener = function (canvasContext) {
  397 + if ($scope.isLineDrawSelecyed == true) {
  398 +
  399 + }
  400 + }
  401 +
  402 + $rootScope.PaintCanvasMousemoveListener = function (canvasContext, x, y) {
  403 + if ($rootScope.isLineDrawSelecyed == true) {
  404 + console.log('hm moving')
  405 + canvasContext.lineTo(x, y);
  406 + canvasContext.stroke();
  407 + }
  408 + }
  409 +
  410 + $rootScope.Draw = function (x, y, isDown, context) {
  411 + if (isDown) {
  412 + context.beginPath();
  413 + context.strokeStyle = '#000000';
  414 + context.lineWidth = 1//$('#selWidth').val();
  415 + context.lineJoin = "round";
  416 + context.moveTo($rootScope.lastX, $rootScope.lastY);
  417 + context.lineTo(x, y);
  418 + context.closePath();
  419 + context.stroke();
  420 + }
  421 + $rootScope.lastX = x; $rootScope.lastY = y;
  422 + }
  423 +
  424 +
  425 +
  426 +
  427 + //list manager function
  428 +
  429 + //list manager function
  430 +
  431 + $rootScope.ShowListManager = function () {
  432 + console.log('ShowListManager')
  433 +
  434 + $rootScope.isLoading = true;
  435 + $('#spinner').css('visibility', 'visible');
  436 +
  437 + $('#listManager').css('display', 'block');
  438 + $("#listManager").css("visibility", "visible");
  439 + $('#listManager').draggable();
  440 +
  441 +
  442 + $rootScope.islistManagerEventAlredayDispachted = true;
  443 +
  444 + $rootScope.$broadcast('listManagerEvent', true);
  445 + }
  446 +
  447 + $rootScope.CloseListManager = function () {
  448 + console.log('close')
  449 + //$rootScope.isListManagerSelected = false;
  450 + $('#listManager').css('display', 'none');
  451 + $("#listManager").css("visibility", "hidden");
  452 + // $rootScope.isAnnotationWindowClose = true;
  453 + // if('#termList')
  454 + if ($('#termList option').length > 0) {
  455 + //$('#termList option') = null;
  456 + //$('#termList').innerHTML='';
  457 + $('#termList')
  458 + .find('option')
  459 + .remove()
  460 + .end()
  461 + if ($('#termList option').length > 0) {
  462 +
  463 + }
  464 + }
  465 +
  466 +
  467 + }
  468 +
  469 + function fillListManagerTerms() {
  470 +
  471 + var len = $rootScope.openModules.length;
  472 + var openViewLen = $rootScope.openViews.length;
  473 +
  474 + var currentOpenModuleId = $rootScope.openModules[len - 1].ModuleId;
  475 + var currentOpenViewId = $rootScope.openViews[openViewLen - 1].BodyViewId;
  476 + if (currentOpenModuleId == 1) {
  477 +
  478 + }
  479 +
  480 + }
  481 +
  482 + //setrtings
  483 + $rootScope.SetSettingActiveTab = function (tabToSet) {
  484 + $rootScope.SettingsTab = tabToSet;
  485 + };
  486 +
  487 + $rootScope.loadsettings = function () {
  488 +
  489 + //1. For now we are by default opening DA settings tab
  490 + $rootScope.SettingsTab = 3;
  491 +
  492 + //2.
  493 + var curentEthnicity = localStorage.getItem("globalEthnicity");
  494 + if (typeof (curentEthnicity) !== "undefined" && curentEthnicity !== null) {
  495 + $rootScope.globalSetting.ethnicity = curentEthnicity;
  496 + }
  497 + else {
  498 + localStorage.setItem("globalEthnicity", $rootScope.globalSetting.ethnicity);
  499 + }
  500 +
  501 + var curentmodesty = localStorage.getItem("globalModesty");
  502 + if (typeof (curentmodesty) !== "undefined" && curentmodesty !== null) {
  503 + $rootScope.globalSetting.modesty = curentmodesty
  504 + }
  505 + else {
  506 + localStorage.setItem("globalModesty", $rootScope.globalSetting.modesty);
  507 + }
  508 +
  509 + //3.
  510 + $rootScope.setModestySettings($rootScope.globalSetting.modesty);
  511 +
  512 + //4.
  513 + $rootScope.setEthncitySettings($rootScope.globalSetting.ethnicity);
  514 +
  515 +
  516 + };
  517 +
  518 + $rootScope.setModestySettings = function (currentmodsetting) {
  519 +
  520 + if (currentmodsetting == 'Y') {
  521 + $rootScope.isModestyOn = true;
  522 + $rootScope.isModestyOff = false;
  523 + }
  524 + else {
  525 + $rootScope.isModestyOn = false;
  526 + $rootScope.isModestyOff = true;
  527 + }
  528 + }
  529 +
  530 + $rootScope.setEthncitySettings = function (currentEthncitysetting) {
  531 +
  532 + // this code is used for maintaing the currently selected Ethencity.
  533 + if (currentEthncitysetting == 'L') {
  534 + $("#btnEthnicA").addClass("skindefault");
  535 + if ($("#btnEthnicB").hasClass("skindefault")) { $("#btnEthnicB").removeClass("skindefault"); }
  536 + if ($("#btnEthnicL").hasClass("skindefault")) { $("#btnEthnicL").removeClass("skindefault"); }
  537 + if ($("#btnEthnicW").hasClass("skindefault")) { $("#btnEthnicW").removeClass("skindefault"); }
  538 + }
  539 + if (currentEthncitysetting == 'B') {
  540 + $("#btnEthnicB").addClass("skindefault");
  541 + if ($("#btnEthnicL").hasClass("skindefault")) { $("#btnEthnicL").removeClass("skindefault"); }
  542 + if ($("#btnEthnicW").hasClass("skindefault")) { $("#btnEthnicW").removeClass("skindefault"); }
  543 + if ($("#btnEthnicA").hasClass("skindefault")) { $("#btnEthnicA").removeClass("skindefault"); }
  544 + }
  545 + if (currentEthncitysetting == 'A') {
  546 + $("#btnEthnicL").addClass("skindefault");
  547 + if ($("#btnEthnicB").hasClass("skindefault")) { $("#btnEthnicB").removeClass("skindefault"); }
  548 + if ($("#btnEthnicW").hasClass("skindefault")) { $("#btnEthnicW").removeClass("skindefault"); }
  549 + if ($("#btnEthnicA").hasClass("skindefault")) { $("#btnEthnicA").removeClass("skindefault"); }
  550 + }
  551 + if (currentEthncitysetting == 'W') {
  552 + $("#btnEthnicW").addClass("skindefault");
  553 + if ($("#btnEthnicB").hasClass("skindefault")) { $("#btnEthnicB").removeClass("skindefault"); }
  554 + if ($("#btnEthnicL").hasClass("skindefault")) { $("#btnEthnicL").removeClass("skindefault"); }
  555 + if ($("#btnEthnicA").hasClass("skindefault")) { $("#btnEthnicA").removeClass("skindefault"); }
  556 + }
  557 + }
  558 +
  559 + $rootScope.ChangeEthnicity = function (formsetting, skintone) {
  560 + formsetting.ethnicity = skintone;
  561 + $rootScope.setEthncitySettings(formsetting.ethnicity);
  562 +
  563 + }
  564 +
  565 + $rootScope.ChangeModesty = function (formsetting, modestyValue) {
  566 + formsetting.modesty = modestyValue;
  567 + $rootScope.setModestySettings(formsetting.modesty);
  568 +
  569 + }
  570 +
  571 + $rootScope.CloseSetting = function () {
  572 +
  573 + $rootScope.setEthncitySettings($rootScope.globalSetting.ethnicity);
  574 + $rootScope.setModestySettings($rootScope.globalSetting.modesty);
  575 + $('#modal-settings').modal('hide');
  576 + }
  577 +
  578 + $rootScope.UpdateAndCloseSetting = function (setting) {
  579 +
  580 + $rootScope.UpdateSetting(setting);
  581 + $('#modal-settings').modal('hide');
  582 +
  583 + };
  584 +
  585 + $rootScope.UpdateSetting = function (setting) {
  586 +
  587 + //1.
  588 + if (typeof (setting.ethnicity) !== "undefined" && setting.ethnicity !== null) {
  589 + $rootScope.ChangeEthnicity(setting, setting.ethnicity);
  590 + $rootScope.globalSetting.ethnicity = setting.ethnicity;
  591 + localStorage.setItem("globalEthnicity", $rootScope.globalSetting.ethnicity);
  592 + $rootScope.setEthncitySettings($rootScope.globalSetting.ethnicity);
  593 + }
  594 + if (typeof (setting.modesty) !== "undefined" && setting.modesty !== null) {
  595 + $rootScope.ChangeModesty(setting, setting.modesty);
  596 + $rootScope.globalSetting.modesty = setting.modesty;
  597 + localStorage.setItem("globalModesty", $rootScope.globalSetting.modesty);
  598 + $rootScope.setModestySettings($rootScope.globalSetting.modesty);
  599 + }
  600 +
  601 + //2.
  602 + //localStorage.setItem("globalEthnicity", $rootScope.globalSetting.ethnicity);
  603 +
  604 + //3.
  605 + //localStorage.setItem("globalModesty", $rootScope.globalSetting.modesty);
  606 +
  607 + //4.
  608 + $rootScope.reloadChildController();
  609 +
  610 + };
  611 +
  612 + $rootScope.reloadChildController = function () {
  613 +
  614 + var len = $rootScope.openModules.length;
  615 +
  616 + var currentOpenModuleId = $rootScope.openModules[len - 1].ModuleId;
  617 +
  618 + //checking is DA module is opend.
  619 + if (currentOpenModuleId == 1) {
  620 +
  621 + //Check that what current bodyview is open
  622 + if ($rootScope.openViews.length > 0) {
  623 + var openViewLen = $rootScope.openViews.length;
  624 + var currentOpenViewId = $rootScope.openViews[openViewLen - 1].BodyViewId;
  625 + //$rootScope.isSettingEventAlredayDispachted = true;
  626 + $rootScope.$broadcast('reloadDABodyViewEvent', { reloadDABodyViewId: currentOpenViewId }, true);
  627 + }
  628 + else {
  629 + $rootScope.$broadcast('reloadDAControllerEvent', true);
  630 +
  631 + }
  632 + }
  633 + };
  634 +
  635 +
  636 + }]
  637 +);
0 638 \ No newline at end of file
... ...
400-SOURCECODE/AIAHTML5.Web/index.html
... ... @@ -391,7 +391,7 @@
391 391 </div>
392 392 <div class="modal-body">
393 393 <div class="row">
394   - <div class="col-sm-12">
  394 + <div class="col-sm-12">
395 395 <h5>Mode</h5>
396 396  
397 397 <div class="btn-group btn-group-justified" role="group" aria-label="...">
... ... @@ -399,7 +399,7 @@
399 399 <button type="button" class="btn btn-sm btn-success" ng-click="OnIdentifyClick()">Identify</button>
400 400 </div>
401 401 <div class="btn-group" role="group">
402   - <button type="button" class="btn btn-sm btn-success">Draw</button>
  402 + <button type="button" class="btn btn-sm btn-success" ng-click="DrawingMode()">Draw</button>
403 403 </div>
404 404 </div>
405 405  
... ... @@ -428,7 +428,7 @@
428 428 <div class="well well-popup">
429 429 <div class="" role="group" aria-label="...">
430 430 <div>
431   - <button type="button" class="btn btn-primary btn-xs pull-left btn-annotation" data-toggle="tooltip" data-placement="top" title="Paint" style="margin-right:1%;" ng-click="paintBrush()"><i class="fa fa-paint-brush"></i></button>
  431 + <button type="button" class="btn btn-primary btn-xs pull-left btn-annotation" id="paintLine" data-toggle="tooltip" data-placement="top" title="Paint" style="margin-right:1%;" ng-click="paintBrush()"><i class="fa fa-paint-brush"></i></button>
432 432 <button type="button" class="btn btn-primary btn-xs pull-left btn-annotation" data-toggle="tooltip" data-placement="top" title="Erase" ng-click="EraseDrawing()"><i class="fa fa-eraser"></i></button>&nbsp;
433 433 <div class="marginL2 pull-left"><input type="number" id="amount-2" value="25" step="1" style="width:60px;"></div>&nbsp;
434 434 <div class="pull-left" style="width:45%; margin-left:2%;">
... ... @@ -474,36 +474,36 @@
474 474 <option>Arial Narrow</option>
475 475 <option>Arial Rounded</option>
476 476 <option>Arial TUR</option>
477   -
  477 +
478 478 </select>
479   - <select class="form-control" id="selected-font-size">
480   - <option>14</option>
481   - <option>16</option>
482   - <option>18</option>
483   - <option>20</option>
484   - <option>22</option>
485   - <option>24</option>
486   - <option>26</option>
487   - <option>28</option>
488   - <option>36</option>
489   - <option>48</option>
490   - <option>72</option>
491   - </select>
492   - <span style="vertical-align:middle;">
  479 + <select class="form-control" id="selected-font-size">
  480 + <option>14</option>
  481 + <option>16</option>
  482 + <option>18</option>
  483 + <option>20</option>
  484 + <option>22</option>
  485 + <option>24</option>
  486 + <option>26</option>
  487 + <option>28</option>
  488 + <option>36</option>
  489 + <option>48</option>
  490 + <option>72</option>
  491 + </select>
  492 + <span style="vertical-align:middle;">
493 493 <span id="text-bold" style="background: #4B4B4B;padding:4px;cursor:pointer;margin-right:2px;">
494   - <i aria-hidden="true" class="fa fa-bold" style="color: #fff"></i>
495   - </span>
496   - <span id="text-italic" style="background: #4B4B4B; padding: 4px; cursor: pointer; margin-right: 2px;">
497   - <i class="fa fa-italic" aria-hidden="true" style="color: #fff"></i>
  494 + <i aria-hidden="true" class="fa fa-bold" style="color: #fff"></i>
  495 + </span>
  496 + <span id="text-italic" style="background: #4B4B4B; padding: 4px; cursor: pointer; margin-right: 2px;">
  497 + <i class="fa fa-italic" aria-hidden="true" style="color: #fff"></i>
498 498  
499   - </span>
500   - <span id="text-underline" style="background: #4B4B4B; padding: 4px; cursor: pointer; margin-right: 5px;">
501   - <i class="fa fa-underline" aria-hidden="true" style="color: #fff"></i>
502   - </span>
  499 + </span>
  500 + <span id="text-underline" style="background: #4B4B4B; padding: 4px; cursor: pointer; margin-right: 5px;">
  501 + <i class="fa fa-underline" aria-hidden="true" style="color: #fff"></i>
  502 + </span>
503 503 </span>
504 504  
505 505 <div class="form-group" id="font-color" style="display:inline-flex;vertical-align:top;cursor:pointer;margin-right:36px;">
506   -
  506 +
507 507 <input type="text" id="saturation-demo" class="form-control demo" data-control="saturation" style="display:none;" value="#0088cc">
508 508 </div>
509 509  
... ... @@ -522,30 +522,24 @@
522 522  
523 523 </span>
524 524 </span>
525   -
526 525  
527   -</div>
  526 +
  527 + </div>
528 528 </div>
529 529 <textarea class="form-control" id="text_area" rows="3" style="font-family: 'Verdana, sans-serif';font-size:14px; font-weight: normal; font-style: normal; color: #000; text-align: left; text-decoration: none;"></textarea>
530 530 </div>
531 531 <div class="modal-footer">
532   - <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
  532 + <button type="button" class="btn btn-default" ng-click="closeModal()" data-dismiss="modal">Close</button>
533 533 <button type="button" id="saveBtn" class="btn btn-primary" data-dismiss="modal" ng-click="saveText()">Save</button>
534 534 </div>
535 535 </div>
536 536 </div>
537 537 </div>
538 538  
539   -
540   -
541   -
542 539  
543 540  
544 541  
545 542 <!--List manager-->
546   -
547   -
548   -
549 543 <!--List manager-->
550 544 <style>
551 545 #listManager {
... ... @@ -657,7 +651,7 @@
657 651 </div>
658 652  
659 653 <!--background disable div-->
660   -
  654 +
661 655 <div id="modelbackground"></div>
662 656  
663 657  
... ... @@ -1055,26 +1049,29 @@
1055 1049 max: 60,
1056 1050 value: 10,
1057 1051 slide: function (event, ui) {
1058   -
  1052 +
1059 1053 $("#amount-2").val(ui.value);
1060   -
1061   -
1062   -
  1054 +
  1055 +
1063 1056 },
  1057 + stop: function (event, ui) {
  1058 +
  1059 + $("#paintLine").attr("data-size", ui.value);
  1060 +
  1061 + }
1064 1062  
1065   -
1066 1063 });
1067   - $("#slider-range-min-2").on("slidestart", function (event, ui) {
  1064 + //$("#slider-range-min-2").on("slidestart", function (event, ui) {
1068 1065  
1069   - $('.btnCursor').trigger('click');
1070   - $(".btn-annotation").removeClass("activebtncolor");
1071   - $('.btnCursor').addClass('activebtncolor');
1072   - // ctx.clearRect(0, 0, canvasPaint.width, canvasPaint.height);
  1066 + // $('.btnCursor').trigger('click');
  1067 + // $(".btn-annotation").removeClass("activebtncolor");
  1068 + // $('.btnCursor').addClass('activebtncolor');
  1069 + // // ctx.clearRect(0, 0, canvasPaint.width, canvasPaint.height);
1073 1070  
1074 1071  
1075   - });
  1072 + //});
1076 1073 // $("#slider-range-min-2").on("slidechange", function (event, ui) { alert("ssasa"); });
1077   -
  1074 +
1078 1075 $("#amount-2").val($("#slider-vertical-2").slider("value"));
1079 1076  
1080 1077 $(function () {
... ... @@ -1129,7 +1126,7 @@
1129 1126 theme: 'bootstrap',
1130 1127 change: function (hex) {
1131 1128 if (!hex) return;
1132   -
  1129 +
1133 1130 $inlinehex.html(hex);
1134 1131 }
1135 1132 });
... ... @@ -1182,20 +1179,20 @@
1182 1179  
1183 1180 $("#selected-font-size").change(function () {
1184 1181  
1185   - $("#text_area").css("font-size", $(this).val()+"px");
  1182 + $("#text_area").css("font-size", $(this).val() + "px");
1186 1183 });
1187 1184  
1188 1185 $("#selected-font-family").change(function () {
1189   -
  1186 +
1190 1187 $("#text_area").css("font-family", $(this).val());
1191 1188  
1192 1189 });
1193 1190  
1194   -
  1191 +
1195 1192 });
1196   -
1197   -
1198   -
  1193 +
  1194 +
  1195 +
1199 1196 </script>
1200 1197  
1201 1198  
... ... @@ -1206,19 +1203,19 @@
1206 1203 $("#borderWidthCanvasElement").change(function () {
1207 1204  
1208 1205 borderWidth = $(this).val();
1209   -
  1206 +
1210 1207 if (borderColor != null) {
1211   -
  1208 +
1212 1209 $("#imgOpacity").parent().css("border", borderWidth + "px" + " " + "solid" + borderColor);
1213 1210 } else {
1214   -
1215   - $("#imgOpacity").parent().css("border", borderWidth + "px" + " " + "solid");
  1211 +
  1212 + $("#imgOpacity").parent().css("border", borderWidth + "px" + " " + "solid");
1216 1213 }
1217 1214 });
1218   -
  1215 +
1219 1216  
1220 1217 $('.borderColorCanvasPreview').each(function () {
1221   -
  1218 +
1222 1219 $(this).minicolors({
1223 1220 control: $(this).attr('data-control') || 'hue',
1224 1221 defaultValue: $(this).attr('data-defaultValue') || '',
... ... @@ -1234,11 +1231,11 @@
1234 1231 if (opacity) value += ', ' + opacity;
1235 1232 if (typeof console === 'object') {
1236 1233 console.log(value);
1237   -
  1234 +
1238 1235 borderColor = value;
1239 1236 $("#imgOpacity").parent().css("border", borderWidth + "px" + " " + "solid" + borderColor);
1240   -
1241   -
  1237 +
  1238 +
1242 1239 }
1243 1240 },
1244 1241 theme: 'bootstrap'
... ... @@ -1266,7 +1263,7 @@
1266 1263 if (typeof console === 'object') {
1267 1264 console.log(value);
1268 1265 $("#imgOpacity").parent().css("background-color", value);
1269   -
  1266 +
1270 1267 }
1271 1268 },
1272 1269 theme: 'bootstrap'
... ... @@ -1312,7 +1309,7 @@
1312 1309 slide: function (event, ui) {
1313 1310  
1314 1311 $(".marginTopBtm10 img.imgopacity").css("opacity", ui.value);
1315   - // $("#slider-value").html(ui.value);
  1312 + // $("#slider-value").html(ui.value);
1316 1313  
1317 1314 }
1318 1315  
... ... @@ -1332,5 +1329,5 @@
1332 1329  
1333 1330  
1334 1331  
1335   - </body>
  1332 +</body>
1336 1333 </html>
1337 1334 \ No newline at end of file
... ...
400-SOURCECODE/AIAHTML5.Web/index.html.orig
... ... @@ -34,12 +34,8 @@
34 34 <link href="libs/jquery/jquery_plugin/jsPanel/jspanel/jquery.jspanel.css" rel="stylesheet" />
35 35 <link href="libs/jquery/jquery_plugin/SpeechBubble/css/bubble.css" rel="stylesheet" />
36 36 <link href="libs/jquery/jquery_plugin/slider-pips/jquery-ui-slider-pips.css" rel="stylesheet" />
37   -<<<<<<< HEAD
38 37 <link href="themes/default/css/bootstrap/3.3.6/jquery.minicolors.css" rel="stylesheet" />
39   -
40   -=======
41 38  
42   ->>>>>>> 914a4ac836533cab3ea430e240a2036b112c6482
43 39 <!--Annotation Toolbar: Jcanvas-->
44 40 <style>
45 41 .activebtncolor {
... ... @@ -395,7 +391,7 @@
395 391 </div>
396 392 <div class="modal-body">
397 393 <div class="row">
398   - <div class="col-sm-12">
  394 + <div class="col-sm-12">
399 395 <h5>Mode</h5>
400 396  
401 397 <div class="btn-group btn-group-justified" role="group" aria-label="...">
... ... @@ -403,7 +399,7 @@
403 399 <button type="button" class="btn btn-sm btn-success" ng-click="OnIdentifyClick()">Identify</button>
404 400 </div>
405 401 <div class="btn-group" role="group">
406   - <button type="button" class="btn btn-sm btn-success">Draw</button>
  402 + <button type="button" class="btn btn-sm btn-success" ng-click="DrawingMode()">Draw</button>
407 403 </div>
408 404 </div>
409 405  
... ... @@ -427,12 +423,12 @@
427 423 </div>
428 424 </div>
429 425 <div class="well-popup well">
430   - <img src="content/images/blank-shape.jpg" alt="..." class="img-rounded img-responsive"/>
  426 + <img src="content/images/blank-shape.jpg" alt="..." class="img-rounded img-responsive" ng-click="enableAnnotationToolBar()">
431 427 </div>
432 428 <div class="well well-popup">
433 429 <div class="" role="group" aria-label="...">
434 430 <div>
435   - <button type="button" class="btn btn-primary btn-xs pull-left btn-annotation" data-toggle="tooltip" data-placement="top" title="Paint" style="margin-right:1%;" ng-click="FreeStylePaint()"><i class="fa fa-paint-brush"></i></button>
  431 + <button type="button" class="btn btn-primary btn-xs pull-left btn-annotation" id="paintLine" data-toggle="tooltip" data-placement="top" title="Paint" style="margin-right:1%;" ng-click="paintBrush()"><i class="fa fa-paint-brush"></i></button>
436 432 <button type="button" class="btn btn-primary btn-xs pull-left btn-annotation" data-toggle="tooltip" data-placement="top" title="Erase" ng-click="EraseDrawing()"><i class="fa fa-eraser"></i></button>&nbsp;
437 433 <div class="marginL2 pull-left"><input type="number" id="amount-2" value="25" step="1" style="width:60px;"></div>&nbsp;
438 434 <div class="pull-left" style="width:45%; margin-left:2%;">
... ... @@ -441,7 +437,6 @@
441 437 <div class="clearfix"></div>
442 438 </div>
443 439  
444   -
445 440 </div>
446 441  
447 442  
... ... @@ -455,7 +450,6 @@
455 450 </div>
456 451 </div>
457 452  
458   -<<<<<<< HEAD
459 453 <!--Modal For Annotation Text Box-->
460 454 <div class="modal fade" id="annotationTextModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" style="z-index: 1200000!important;">
461 455 <div class="modal-dialog" role="document">
... ... @@ -480,36 +474,36 @@
480 474 <option>Arial Narrow</option>
481 475 <option>Arial Rounded</option>
482 476 <option>Arial TUR</option>
483   -
  477 +
484 478 </select>
485   - <select class="form-control" id="selected-font-size">
486   - <option>14</option>
487   - <option>16</option>
488   - <option>18</option>
489   - <option>20</option>
490   - <option>22</option>
491   - <option>24</option>
492   - <option>26</option>
493   - <option>28</option>
494   - <option>36</option>
495   - <option>48</option>
496   - <option>72</option>
497   - </select>
498   - <span style="vertical-align:middle;">
  479 + <select class="form-control" id="selected-font-size">
  480 + <option>14</option>
  481 + <option>16</option>
  482 + <option>18</option>
  483 + <option>20</option>
  484 + <option>22</option>
  485 + <option>24</option>
  486 + <option>26</option>
  487 + <option>28</option>
  488 + <option>36</option>
  489 + <option>48</option>
  490 + <option>72</option>
  491 + </select>
  492 + <span style="vertical-align:middle;">
499 493 <span id="text-bold" style="background: #4B4B4B;padding:4px;cursor:pointer;margin-right:2px;">
500   - <i aria-hidden="true" class="fa fa-bold" style="color: #fff"></i>
501   - </span>
502   - <span id="text-italic" style="background: #4B4B4B; padding: 4px; cursor: pointer; margin-right: 2px;">
503   - <i class="fa fa-italic" aria-hidden="true" style="color: #fff"></i>
  494 + <i aria-hidden="true" class="fa fa-bold" style="color: #fff"></i>
  495 + </span>
  496 + <span id="text-italic" style="background: #4B4B4B; padding: 4px; cursor: pointer; margin-right: 2px;">
  497 + <i class="fa fa-italic" aria-hidden="true" style="color: #fff"></i>
504 498  
505   - </span>
506   - <span id="text-underline" style="background: #4B4B4B; padding: 4px; cursor: pointer; margin-right: 5px;">
507   - <i class="fa fa-underline" aria-hidden="true" style="color: #fff"></i>
508   - </span>
  499 + </span>
  500 + <span id="text-underline" style="background: #4B4B4B; padding: 4px; cursor: pointer; margin-right: 5px;">
  501 + <i class="fa fa-underline" aria-hidden="true" style="color: #fff"></i>
  502 + </span>
509 503 </span>
510 504  
511 505 <div class="form-group" id="font-color" style="display:inline-flex;vertical-align:top;cursor:pointer;margin-right:36px;">
512   -
  506 +
513 507 <input type="text" id="saturation-demo" class="form-control demo" data-control="saturation" style="display:none;" value="#0088cc">
514 508 </div>
515 509  
... ... @@ -528,46 +522,24 @@
528 522  
529 523 </span>
530 524 </span>
531   -
532 525  
533   -</div>
  526 +
  527 + </div>
534 528 </div>
535 529 <textarea class="form-control" id="text_area" rows="3" style="font-family: 'Verdana, sans-serif';font-size:14px; font-weight: normal; font-style: normal; color: #000; text-align: left; text-decoration: none;"></textarea>
536 530 </div>
537 531 <div class="modal-footer">
538   - <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
  532 + <button type="button" class="btn btn-default" ng-click="closeModal()" data-dismiss="modal">Close</button>
539 533 <button type="button" id="saveBtn" class="btn btn-primary" data-dismiss="modal" ng-click="saveText()">Save</button>
540 534 </div>
541 535 </div>
542 536 </div>
543 537 </div>
544 538  
545   -
546   -
547   -
548 539  
549 540  
550 541  
551 542 <!--List manager-->
552   -
553   -
554   -
555   - <!--List manager-->
556   - <style>
557   - #listManager {
558   - background: #fff;
559   - border-radius: 3px;
560   - border: 1px solid #ededed;
561   - -webkit-box-shadow: 0px 0px 2px 1px rgba(173,173,173,1);
562   - -moz-box-shadow: 0px 0px 2px 1px rgba(173,173,173,1);
563   - box-shadow: 0px 0px 2px 1px rgba(173,173,173,1);
564   - width: 350px;
565   - position: absolute;
566   - top: 170px;
567   - left: 140px;
568   - display: none;
569   - z-index: 1100;
570   -=======
571 543 <!--List manager-->
572 544 <style>
573 545 #listManager {
... ... @@ -588,7 +560,6 @@
588 560 #listManager .annotation-modal-header {
589 561 background: #818f44;
590 562 padding: 2px 10px;
591   ->>>>>>> 914a4ac836533cab3ea430e240a2036b112c6482
592 563 }
593 564  
594 565 #listManager .annotation-modal-header h4 {
... ... @@ -619,7 +590,7 @@
619 590  
620 591 <div class="form-group">
621 592 <label for="sel1">Window</label>
622   - <select class="form-control" id="viewName">
  593 + <select class="form-control" id="viewName" disabled>
623 594 <!--<option>Male Lateral</option>-->
624 595  
625 596 </select>
... ... @@ -646,7 +617,7 @@
646 617 <div class="form-group">
647 618 <label class="col-sm-4 control-label" for="inputPassword3">Area</label>
648 619 <div class="col-sm-8">
649   - <select class="form-control">
  620 + <select class="form-control" disabled>
650 621 <option value="1" selected="">Entire View</option>
651 622 </select>
652 623 </div>
... ... @@ -673,11 +644,219 @@
673 644 </div>
674 645  
675 646 </div>
  647 + <div class="modal-footer" id="totalTerms">
  648 + <!--<span class="pull-left marginTop5">424 Structures</span>-->
  649 + <button data-dismiss="modal" class="btn btn-primary" type="button"><i class="fa fa-arrow-circle-right"></i></button>
  650 + </div>
  651 + </div>
  652 +
  653 + <!--background disable div-->
  654 +
  655 + <div id="modelbackground"></div>
  656 +
  657 +
  658 + <!--Edit Shape Modal-->
  659 + <div class="modal fade" id="editshapestyle" tabindex="-1" role="dialog" aria-labelledby="myModalLabel33" style="z-index:1000000000;width:302px;margin-left:auto;margin-right:auto;overflow:hidden;height:460px;">
  660 + <div class="modal-dialog modal-sm" role="document">
  661 + <div class="modal-content">
  662 + <div class="modal-header annotation-modal-header">
  663 + <h4 class="modal-title" id="myModalLabel33">Edit Shape Style</h4>
  664 + </div>
  665 + <div class="modal-body">
  666 + <div class="marginTopBtm10">
  667 + <div class="well well-sm no-margin-btm">
  668 + <div class="row">
  669 + <div class="col-sm-12">
  670 + <div class="checkbox no-margin">
  671 + <label>
  672 + <input id="fill-option" type="checkbox" checked onclick="enableDisableFillOption()"> Fill Option
  673 + </label>
  674 + </div>
  675 + </div>
  676 + <div class="col-sm-6 enableDisableOpacity">
  677 + <div class="radio">
  678 + <label>
  679 + <input type="radio" name="filloption" id="filloption1" value="filloption1">
  680 + <span class="">Texture</span>
676 681 <<<<<<< HEAD
  682 + <img src="~/../content/images/common/annotation-tool-bar/pattern-picker.png" alt="" class="pattern-picker" data-toggle="modal" data-target="#pattern">
  683 +=======
  684 + <img id="editstyleTexture" src="~/../content/images/common/annotation-tool-bar/pattern-picker.png" alt="" class="pattern-picker" data-toggle="modal" data-target="#pattern">
  685 +>>>>>>> db0b2ac40dc61ee08fb471800773516967978732
  686 + </label>
  687 + </div>
  688 + <div class="radio">
  689 + <label>
  690 + <input type="radio" name="filloption" id="filloption2" value="filloption2" checked style="margin-top:8px;">
  691 +
  692 +
  693 +<<<<<<< HEAD
  694 + <div class="form-group" style="display:inline-flex;vertical-align:top;cursor:pointer;margin-right:36px;">
  695 +=======
  696 + <div id="editstylebackgroundcolor" class="form-group" style="display:inline-flex;vertical-align:top;cursor:pointer;margin-right:36px;">
  697 +>>>>>>> db0b2ac40dc61ee08fb471800773516967978732
  698 + <span style="font-weight: normal; float: left; padding-top: 5px; padding-right: 5px;">Color</span>
  699 + <input type="text" class="form-control outerBackgroundColor" data-control="saturation" style="display:none;" value="#0088cc">
  700 + </div>
  701 +
677 702  
  703 + <!--<span class="">Color</span> <img src="img/color-picker.png" alt="" class="color-picker">-->
  704 + <!--<span class="demo2" data-control="hue" style="font-weight:normal;">Color</span>-->
  705 + <!--<img src="img/color-picker.png" alt="" class="color-picker">-->
  706 + </label>
  707 + </div>
  708 + </div>
  709 + <div class="col-sm-6 no-padding marginTop10 enableDisableOpacity">
  710 + <div class="row">
  711 + <label class="pull-left" style="font-weight:normal;">Scale</label>
  712 + <div id="edit-slider-3" class="pull-left" style="width:62%; margin-left:3%; margin-top:2%;">
  713 + <div id="slider-range-min-3"></div>
  714 + <!--<p>Your slider has a value of <span id="slider-value"></span></p>-->
  715 + </div>
  716 + </div>
  717 +
  718 + <div class="row">
  719 + <label class="pull-left" style="font-weight:normal;">Opacity</label>
  720 + <div id="edit-slider-4" class="pull-left" style="width:53%; margin-left:3%; margin-top:2%;">
  721 + <div id="slider-range-min-4"></div>
  722 + </div>
  723 + </div>
678 724  
  725 + <div class="clearfix"></div>
679 726  
680 727  
  728 + </div>
  729 + </div>
  730 +
  731 + </div>
  732 + </div>
  733 + <div class="marginTopBtm10">
  734 + <div class="well well-sm no-margin-btm">
  735 + <div class="row">
  736 + <div class="col-sm-12">
  737 + <div class="checkbox no-margin">
  738 + <label>
  739 + <input id="Outline-Option" onclick="enableDisableOutline()" type="checkbox" checked> Outline Option
  740 + </label>
  741 + </div>
  742 + </div>
  743 + <div class="col-sm-6 setEnableDisableForEditShapeStyle">
  744 + <label class="marginTop5">
  745 + <span style="font-weight: normal; float: left; padding-top: 5px; padding-right: 5px;">Color</span>
  746 + <!--<span class="demo " data-control="hue" style="float:left;">&nbsp;</span>-->
  747 +<<<<<<< HEAD
  748 +
  749 +
  750 + <div class="form-group" style="display:inline-flex;vertical-align:top;cursor:pointer;margin-right:36px;">
  751 +=======
  752 + <div class="form-group" id="outlineColor" style="display:inline-flex;vertical-align:top;cursor:pointer;margin-right:36px;">
  753 +>>>>>>> db0b2ac40dc61ee08fb471800773516967978732
  754 +
  755 + <input type="text" class="form-control borderColorCanvasPreview" data-control="saturation" style="display:none;" value="#0088cc">
  756 + </div>
  757 +
  758 +
  759 + <!--<img src="img/color-picker.png" alt="" class="color-picker">-->
  760 + </label>
  761 + </div>
  762 +
  763 + <div class="col-sm-6 setEnableDisableForEditShapeStyle">
  764 + <div class="form-horizontal">
  765 + <div class="form-group">
  766 + <label class="col-sm-3 control-label" style=" font-weight:normal; padding-top:9px;">Size</label>
  767 + <div class="col-sm-9 marginTop5">
  768 + <select id="borderWidthCanvasElement" class="form-control input-sm">
  769 + <option value="1">1</option>
  770 + <option value="2">2</option>
  771 + <option value="3">3</option>
  772 + <option value="4">4</option>
  773 + <option value="5">5</option>
  774 + </select>
  775 + </div>
  776 + </div>
  777 + </div>
  778 + </div>
  779 +
  780 + </div>
  781 + </div>
  782 + </div>
  783 +
  784 + <div class="marginTopBtm10">
  785 + <div class="well well-sm no-margin-btm">
  786 + <img id="imgOpacity" class="img-rounded img-responsive imgopacity" alt="..." src="content/images/blank-shape.jpg">
  787 + </div>
  788 + </div>
  789 + </div>
  790 + <div class="modal-footer">
  791 + <button type="button" class="btn btn-primary btn-sm" ng-click="shapestyle('imgOpacity')">
  792 + OK
  793 + </button>
  794 + <button type="button" class="btn btn-primary btn-sm" data-dismiss="modal" ng-click="disableAnnotationToolBar()">Cancel</button>
  795 + </div>
  796 + </div>
  797 + </div>
  798 + </div>
  799 +
  800 + <script>
  801 + function enableDisableFillOption()
  802 + {
  803 +
  804 + if (document.getElementById('fill-option').checked)
  805 + {
  806 +
  807 + //$("#filloption1").css({ "pointer-events": "auto" });
  808 + //$("#filloption12").css({ "pointer-events": "auto" });
  809 + $("#edit-slider-3").css({ "pointer-events": "auto" });
  810 + $("#edit-slider-4").css({ "pointer-events": "auto" });
  811 + $("#editstylebackgroundcolor").css({ "pointer-events": "auto" });
  812 + $("#editstyleTexture").css({ "pointer-events": "auto" });
  813 + $(".enableDisableOpacity label").css({ "cursor": "pointer" });
  814 + $(".enableDisableOpacity").css({ "opacity": "1" })
  815 + document.getElementById("filloption1").disabled = false;
  816 + document.getElementById("filloption2").disabled = false;
  817 + document.getElementById("filloption1").style.cursor = "default";
  818 + document.getElementById("filloption2").style.cursor = "default";
  819 +
  820 +
  821 +
  822 + }
  823 + else
  824 + {
  825 +
  826 + //$("#filloption1").css({ "pointer-events": "none" });
  827 + //$("#filloption2").css({ "pointer-events": "none" });
  828 + $("#edit-slider-3").css({ "pointer-events": "none"});
  829 + $("#edit-slider-4").css({ "pointer-events": "none"});
  830 + $("#editstylebackgroundcolor").css({ "pointer-events": "none"});
  831 + $("#editstyleTexture").css({ "pointer-events": "none" });
  832 + $(".enableDisableOpacity label").css({ "cursor": "default" });
  833 + $(".enableDisableOpacity").css({ "opacity": ".5" })
  834 + document.getElementById("filloption1").disabled = true;
  835 + document.getElementById("filloption2").disabled = true;
  836 + document.getElementById("filloption1").style.cursor = "default";
  837 + document.getElementById("filloption2").style.cursor = "default";
  838 +
  839 +
  840 +
  841 + }
  842 +
  843 + }
  844 + function enableDisableOutline() {
  845 +
  846 + if (document.getElementById('Outline-Option').checked) {
  847 +
  848 + $("#borderWidthCanvasElement").css({ "pointer-events": "auto" });
  849 + $("#outlineColor").css({ "pointer-events": "auto" });
  850 + $(".setEnableDisableForEditShapeStyle").css({ "opacity": "1" })
  851 + }
  852 + else {
  853 + $("#borderWidthCanvasElement").css({ "pointer-events": "none" });
  854 + $("#outlineColor").css({ "pointer-events": "none" });
  855 + $(".setEnableDisableForEditShapeStyle").css({ "opacity": ".5" })
  856 + }
  857 + }
  858 +
  859 + </script>
681 860  
682 861 <script>
683 862 function mytoggle() {
... ... @@ -687,30 +866,10 @@
687 866 return;
688 867 }
689 868 div.style.display = 'block';
690   -=======
691   - <div class="modal-footer" id="totalTerms">
692   - <!--<span class="pull-left marginTop5">424 Structures</span>-->
693   - <button data-dismiss="modal" class="btn btn-primary" type="button"><i class="fa fa-arrow-circle-right"></i></button>
694   - </div>
695   - </div>
696   - <script>
697   - function mytoggle() {
698   - var div = document.getElementById("divSection");
699   - if (div.style.display == 'block') {
700   - div.style.display = 'none';
701   - return;
702   ->>>>>>> 914a4ac836533cab3ea430e240a2036b112c6482
703 869 }
704   - div.style.display = 'block';
705   - }
706 870 </script>
707 871  
708 872  
709   -
710   -
711   -
712   -
713   -
714 873 <script>
715 874 function mytoggle() {
716 875 var div = document.getElementById("divSection");
... ... @@ -738,58 +897,6 @@
738 897 <script src="libs/jcanvas/jcanvas.min.js"></script>
739 898 <script src="libs/jcanvas/jcanvas.handle.min.js"></script>
740 899  
741   -<<<<<<< HEAD
742   - <script src="libs/jinqJs.js"></script>
743   - <script src="libs/jquery/jquery_plugin/jsPanel/jspanel/jquery.jspanel.js"></script>
744   - <script src="libs/jquery/jquery_plugin/SpeechBubble/bubble.js"></script>
745   - <script src="libs/jquery/jquery_plugin/slider-pips/jquery-ui-slider-pips.js"></script>
746   - <!--<script src="libs/jquery/jquery_plugin/jsPanel/jspanel/jquery.jspanel.min.js"></script>-->
747   - <script src="app/main/AIA.js"></script>
748   - <script src="app/main/Link.js"></script>
749   - <script src="content/scripts/js/custom/custom.js"></script>
750   - <script src="app/filters/ColorMatrixFilter.js"></script>
751   - <script src="app/utility/Matrix.js"></script>
752   - <script src="app/utility/Point.js"></script>
753   - <script src="app/utility/Rectangle.js"></script>
754   - <script src="app/utility/BitmapData.js"></script>
755   - <script src="app/utility/Paint.js"></script>
756   - <script src="app/controllers/DAController.js"></script>
757   - <script src="app/controllers/CIController.js"></script>
758   - <script src="app/controllers/CAController.js"></script>
759   - <script src="app/controllers/3dAController.js"></script>
760   - <script src="app/controllers/CurrBuildController.js"></script>
761   - <script src="app/controllers/AnatTestController.js"></script>
762   - <script src="app/controllers/LabExercController.js"></script>
763   - <script src="app/controllers/ADAMImgController.js"></script>
764   - <script src="app/controllers/AODController.js"></script>
765   - <script src="app/controllers/HomeController.js"></script>
766   - <script src="app/controllers/LinkController.js"></script>
767   - <script src="app/services/DataService.js"></script>
768   - <script src="libs/jquery/jquery_plugin/jqueryui.js"></script>
769   - <script src="libs/colorpicker/jquery.minicolors.min.js"></script>
770   - <script src="libs/sketch.js"></script>
771   - <!--<script type="text/javascript">
772   - $(function () {
773   - $('#canvas').sketch();
774   - });
775   - </script>-->
776   - <script>
777   - $(function () {
778   - $("#slider-range-min-2").slider({
779   - range: "min",
780   - min: 1,
781   - max: 60,
782   - value: 10,
783   - slide: function (event, ui) {
784   - $("#amount-2").val(ui.value);
785   - }
786   - });
787   - $("#amount-2").val($("#slider-vertical-2").slider("value"));
788   -
789   - $(function () {
790   - $('[data-toggle="tooltip"]').tooltip();
791   - })
792   -=======
793 900 <script src="libs/jinqJs.js"></script>
794 901 <script src="libs/jquery/jquery_plugin/jsPanel/jspanel/jquery.jspanel.js"></script>
795 902 <script src="libs/jquery/jquery_plugin/SpeechBubble/bubble.js"></script>
... ... @@ -817,8 +924,17 @@
817 924 <script src="app/controllers/LinkController.js"></script>
818 925 <script src="app/services/DataService.js"></script>
819 926 <script src="libs/jquery/jquery_plugin/jqueryui.js"></script>
  927 +
  928 + <script src="libs/jquery/jquery_plugin/color-picker/jquery.minicolors.min.js"></script>
  929 + <!--<script src="libs/colorpicker/jquery.minicolors.min.js"></script>-->
  930 + <script src="libs/color-picker/jquery.minicolors.min.js"></script>
820 931  
821   -
  932 + <script src="libs/sketch.js"></script>
  933 + <!--<script type="text/javascript">
  934 + $(function () {
  935 + $('#canvas').sketch();
  936 + });
  937 + </script>-->
822 938 <script>
823 939 $(function () {
824 940 $("#slider-range-min-2").slider({
... ... @@ -827,10 +943,29 @@
827 943 max: 60,
828 944 value: 10,
829 945 slide: function (event, ui) {
  946 +
830 947 $("#amount-2").val(ui.value);
  948 +
  949 +
  950 + },
  951 + stop: function (event, ui) {
  952 +
  953 + $("#paintLine").attr("data-size", ui.value);
  954 +
831 955 }
832   ->>>>>>> 914a4ac836533cab3ea430e240a2036b112c6482
  956 +
833 957 });
  958 + //$("#slider-range-min-2").on("slidestart", function (event, ui) {
  959 +
  960 + // $('.btnCursor').trigger('click');
  961 + // $(".btn-annotation").removeClass("activebtncolor");
  962 + // $('.btnCursor').addClass('activebtncolor');
  963 + // // ctx.clearRect(0, 0, canvasPaint.width, canvasPaint.height);
  964 +
  965 +
  966 + //});
  967 + // $("#slider-range-min-2").on("slidechange", function (event, ui) { alert("ssasa"); });
  968 +
834 969 $("#amount-2").val($("#slider-vertical-2").slider("value"));
835 970  
836 971 $(function () {
... ... @@ -847,8 +982,14 @@
847 982 });
848 983  
849 984 });
850   -<<<<<<< HEAD
851   - </script>
  985 + })(jQuery);
  986 + </script>
  987 + <script>
  988 + $(function () {
  989 + $(".modal").draggable();
  990 + $(".annotationTollbar").draggable();
  991 + });
  992 + </script>
852 993  
853 994 <script type="text/javascript">
854 995 $(function () {
... ... @@ -878,7 +1019,7 @@
878 1019 theme: 'bootstrap',
879 1020 change: function (hex) {
880 1021 if (!hex) return;
881   -
  1022 +
882 1023 $inlinehex.html(hex);
883 1024 }
884 1025 });
... ... @@ -931,32 +1072,155 @@
931 1072  
932 1073 $("#selected-font-size").change(function () {
933 1074  
934   - $("#text_area").css("font-size", $(this).val()+"px");
  1075 + $("#text_area").css("font-size", $(this).val() + "px");
935 1076 });
936 1077  
937 1078 $("#selected-font-family").change(function () {
938   -
  1079 +
939 1080 $("#text_area").css("font-family", $(this).val());
940 1081  
941 1082 });
942 1083  
943   -
  1084 +
944 1085 });
945   -
946   -
947   -
  1086 +
  1087 +
  1088 +
948 1089 </script>
949 1090  
950   - </body>
951   -=======
952   - })(jQuery);
  1091 +
  1092 + <script>
  1093 + $(document).ready(function () {
  1094 + var borderWidth = 1;
  1095 + var borderColor = "#000";
  1096 + $("#borderWidthCanvasElement").change(function () {
  1097 +
  1098 + borderWidth = $(this).val();
  1099 +
  1100 + if (borderColor != null) {
  1101 +
  1102 + $("#imgOpacity").parent().css("border", borderWidth + "px" + " " + "solid" + borderColor);
  1103 + } else {
  1104 +
  1105 + $("#imgOpacity").parent().css("border", borderWidth + "px" + " " + "solid");
  1106 + }
  1107 + });
  1108 +
  1109 +
  1110 + $('.borderColorCanvasPreview').each(function () {
  1111 +
  1112 + $(this).minicolors({
  1113 + control: $(this).attr('data-control') || 'hue',
  1114 + defaultValue: $(this).attr('data-defaultValue') || '',
  1115 + format: $(this).attr('data-format') || 'hex',
  1116 + keywords: $(this).attr('data-keywords') || '',
  1117 + inline: $(this).attr('data-inline') === 'true',
  1118 + letterCase: $(this).attr('data-letterCase') || 'lowercase',
  1119 + opacity: $(this).attr('data-opacity'),
  1120 + position: $(this).attr('data-position') || 'bottom left',
  1121 + swatches: $(this).attr('data-swatches') ? $(this).attr('data-swatches').split('|') : [],
  1122 + change: function (value, opacity) {
  1123 + if (!value) return;
  1124 + if (opacity) value += ', ' + opacity;
  1125 + if (typeof console === 'object') {
  1126 + console.log(value);
  1127 +
  1128 + borderColor = value;
  1129 + $("#imgOpacity").parent().css("border", borderWidth + "px" + " " + "solid" + borderColor);
  1130 +
  1131 +
  1132 + }
  1133 + },
  1134 + theme: 'bootstrap'
  1135 + });
  1136 +
  1137 + });
  1138 +
  1139 +
  1140 +
  1141 + $('.outerBackgroundColor').each(function () {
  1142 +
  1143 + $(this).minicolors({
  1144 + control: $(this).attr('data-control') || 'hue',
  1145 + defaultValue: $(this).attr('data-defaultValue') || '',
  1146 + format: $(this).attr('data-format') || 'hex',
  1147 + keywords: $(this).attr('data-keywords') || '',
  1148 + inline: $(this).attr('data-inline') === 'true',
  1149 + letterCase: $(this).attr('data-letterCase') || 'lowercase',
  1150 + opacity: $(this).attr('data-opacity'),
  1151 + position: $(this).attr('data-position') || 'bottom left',
  1152 + swatches: $(this).attr('data-swatches') ? $(this).attr('data-swatches').split('|') : [],
  1153 + change: function (value, opacity) {
  1154 + if (!value) return;
  1155 + if (opacity) value += ', ' + opacity;
  1156 + if (typeof console === 'object') {
  1157 + console.log(value);
  1158 + $("#imgOpacity").parent().css("background-color", value);
  1159 +
  1160 + }
  1161 + },
  1162 + theme: 'bootstrap'
  1163 + });
  1164 +
  1165 + });
  1166 +
  1167 +
  1168 + });
953 1169 </script>
  1170 +
  1171 +
954 1172 <script>
955 1173 $(function () {
956   - $(".modal").draggable();
957   - $(".annotationTollbar").draggable();
  1174 + $("#slider-range-min-3").slider({
  1175 + range: "min",
  1176 + min: 0,
  1177 + max: 100,
  1178 + value: 20,
  1179 + change: function (event, ui) {
  1180 +
  1181 +
  1182 + }
  1183 + });
  1184 +
  1185 +
  1186 +
958 1187 });
959 1188 </script>
  1189 +
  1190 + <script>
  1191 + $(function () {
  1192 +
  1193 +
  1194 +
  1195 + $("#slider-range-min-4").slider(
  1196 + {
  1197 + range: "min",
  1198 + value: .5,
  1199 + min: 0,
  1200 + max: 1,
  1201 + step: .1,
  1202 + slide: function (event, ui) {
  1203 +
  1204 + $(".marginTopBtm10 img.imgopacity").css("opacity", ui.value);
  1205 + // $("#slider-value").html(ui.value);
  1206 +
  1207 + }
  1208 +
  1209 + }
  1210 +
  1211 +);
  1212 +
  1213 + });
  1214 +
  1215 +
  1216 +
  1217 + </script>
  1218 +
  1219 +
  1220 +
  1221 +
  1222 +
  1223 +
  1224 +
960 1225 </body>
961   ->>>>>>> 914a4ac836533cab3ea430e240a2036b112c6482
962 1226 </html>
963 1227 \ No newline at end of file
... ...