diff --git a/400-SOURCECODE/AIAHTML5.Web/AIAHTML5.Web.csproj b/400-SOURCECODE/AIAHTML5.Web/AIAHTML5.Web.csproj index e121857..de2feb3 100644 --- a/400-SOURCECODE/AIAHTML5.Web/AIAHTML5.Web.csproj +++ b/400-SOURCECODE/AIAHTML5.Web/AIAHTML5.Web.csproj @@ -44581,7 +44581,6 @@ - diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js index 401355d..2065605 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js @@ -22,6 +22,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.AllBodySystem = []; $scope.AllOrientation = []; $scope.AllImageType = []; + $rootScope.Globe1 = []; + $scope.query = { selectedbodyregion: '', selectedbodysystem: '', @@ -188,6 +190,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.imageHeight = this.height; } + + + angular.element(document).ready(function (e) { $("#ImagePanel").resize(function () { $("#imageDiv").scrollLeft($rootScope.CanvasDivLeftPosition); @@ -204,28 +209,14 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo function (result) { $scope.aaPinData = result.data.Root.Item; angular.forEach($scope.aaPinData, function (value, key) { - - $scope.context.beginPath(); - $scope.context.moveTo(value._PinX, value._PinY); - $scope.context.lineTo(value._HeadX, value._HeadY); - $scope.context.stroke(); - - var headX = (parseInt(value._HeadX)) - 20; - var headY = (parseInt(value._HeadY)) - 15; - - var img = new Image(); - img.src = "~/../../../content/images/noraml-pin.png"; - img.onload = function () { - $scope.context.drawImage(img, headX, headY); - } + $scope.DrawStaticPinsOnImage('aaDetailViewCanvas', value._PinId, value._PinX, value._PinY, value._HeadX, value._HeadY) }) - console.log(JSON.stringify(result, null, 4)); }, function (error) { - // handle errors here - console.log(' error: ' + error.statusText); + + console.log(' error in showAllPins: ' + error.statusText); } ) } @@ -345,7 +336,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo if (selectimg === true && count >= filtercount) { - + $scope.imagePath = "../content/images/aa/thumbnails/" + value._TileImageName; var $el = $('
' @@ -434,23 +425,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //1.Remove all the pins first $scope.ClearAllPins(); - - //clear speech bubble - var speechBubbles = $("div[id*='sppeachBubble']"); - if (speechBubbles != null || speechBubbles != undefined && speechBubbles.length > 0) { - for (var j = 0; j < speechBubbles.length; j++) { - - speechBubbles[j].parentNode.removeChild(speechBubbles[j]); - } - } - var speechBubbleLines = $("div[id*='sppeachBubbleLine']"); - if (speechBubbleLines != null || speechBubbleLines != undefined && speechBubbleLines.length > 0) { - for (var j = 0; j < speechBubbleLines.length; j++) { - - speechBubbleLines[j].parentNode.removeChild(speechBubbleLines[j]); - } - } - var selectedSystemName = event.currentTarget.title; //2. get pinData @@ -467,39 +441,27 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.TermInfo = response.data.Terms.Term; - //on gettng all required data, draw pins - var selectedSystemPinData = new jinqJs() - .from($scope.aaPinData) - .where("_BodySystemName == " + selectedSystemName) - .select(); - angular.forEach(selectedSystemPinData, function (value, key) { - - $scope.context.beginPath(); - $scope.context.moveTo(value._PinX, value._PinY); - $scope.context.lineTo(value._HeadX, value._HeadY); - $scope.context.stroke(); - - var headX = (parseInt(value._HeadX)) - 20; - var headY = (parseInt(value._HeadY)) - 15; - - var img = new Image(); - img.src = "~/../../../content/images/noraml-pin.png"; - img.onload = function () { - $scope.context.drawImage(img, headX, headY); - - - } - }) + //on gettng all required data, draw pins + var selectedSystemPinData = new jinqJs() + .from($scope.aaPinData) + .where("_BodySystemName == " + selectedSystemName) + .select(); + angular.forEach(selectedSystemPinData, function (value, key) { + + + $scope.DrawStaticPinsOnImage('aaDetailViewCanvas', value._PinId, value._PinX, value._PinY, value._HeadX, value._HeadY) + + }) //show annotation on first pin of the sysyem - $scope.showAnnotation(selectedSystemPinData); - }, + $scope.showAnnotation(selectedSystemPinData, false, false); + }, function (error) { // handle errors here console.log(' error: ' + error.statusText); } ) - + console.log(JSON.stringify(result, null, 4)); }, @@ -510,9 +472,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo ) } - $scope.showAnnotation = function (selectedSystemPinData) - { + $scope.showAnnotation = function (selectedSystemPinData, isCtrlPressed, isPinClicked) { + $scope.selectedPin = []; + var isSameTermWithMultiPin = false; var firstPinId = selectedSystemPinData[0]._PinId; var pinTermNumber = selectedSystemPinData[0]._TermId; @@ -521,38 +484,119 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo .from($scope.aaPinData) .where("_TermId == " + pinTermNumber) .select(); - var termTextdata = new jinqJs() - .from($scope.TermInfo) - .where("__ActualTermNumber == " + pinTermNumber) - .select(); - var termText = termTextdata[0].__TermText; - $scope.MultiLanguageAnnationArray = []; - $scope.MultiLanguageAnnationArray.push(termText); - angular.forEach(pinDataWithFirstTermNumber, function (value, key) { - - var headX = (parseInt(value._HeadX)); - var headY = (parseInt(value._HeadY)); - $scope.createSpeechBubble(headX, parseInt(headY),value._PinId); - // alert('headX: ' + headX + ', headY: ' + headY + ',termText: ' + termText); - }) + + + + //3. get termText info + var promise = ModuleService.getTermTextForPin($scope.moduleName) + .then( + function (response) { + + $scope.TermInfo = response.data.Terms.Term; + + + var termTextdata = new jinqJs() + .from($scope.TermInfo) + .where("__ActualTermNumber == " + pinTermNumber) + .select(); + + var termText = termTextdata[0].__TermText; + $scope.MultiLanguageAnnationArray = []; + $scope.MultiLanguageAnnationArray.push(termText); + + if (isCtrlPressed) { + + } + else { + if (isPinClicked) { + var existingSpeechBubble = $("div[id*='sppeachBubble']"); + for (var i = 0; i < existingSpeechBubble.length; i++) { + existingSpeechBubble[i].parentNode.removeChild(existingSpeechBubble[i]); + + //make all pin heads grey + var radial = $('#aaDetailViewCanvas').createGradient({ + x1: 50, y1: 50, + x2: 50, y2: 50, + r1: 10, r2: 30, + c1: 'rgba(100, 50, 0,0)', + c2: 'rgb(216, 216, 216)' + }); + + + $('#aaDetailViewCanvas').setLayers({ + fillStyle: radial, + }).drawLayers(); + } + + var existingSpeechBubbleLine = $("div[id*='speechBubbleLine']"); + for (var i = 0; i < existingSpeechBubbleLine.length; i++) { + existingSpeechBubbleLine[i].parentNode.removeChild(existingSpeechBubbleLine[i]); + } + var speechBubbleDraggedLine = $("div[id*='speechBubbleDraggedLine']"); + for (var i = 0; i < speechBubbleDraggedLine.length; i++) { + speechBubbleDraggedLine[i].parentNode.removeChild(speechBubbleDraggedLine[i]); + } + } + } + if (pinDataWithFirstTermNumber.length > 1) { + isSameTermWithMultiPin = true; + } + + angular.forEach(pinDataWithFirstTermNumber, function (value, key) { + $scope.selectedPin.push(value._PinId); + var headX = (parseInt(value._HeadX)); + var headY = (parseInt(value._HeadY)); + $scope.createSpeechBubble(parseInt(headX) + 10, parseInt(headY) + 10, value._PinId, isCtrlPressed, isPinClicked, isSameTermWithMultiPin); + }) + + }, + function (error) { }) } $scope.ClearAllPins = function () { - var canvasHeight = document.getElementById('aaDetailViewCanvas').height; - var canvasWidth = document.getElementById('aaDetailViewCanvas').width; + //var canvasHeight = document.getElementById('aaDetailViewCanvas').height; + //var canvasWidth = document.getElementById('aaDetailViewCanvas').width; + + //$scope.context.clearRect(0, 0, canvasWidth, canvasHeight); + + $('#aaDetailViewCanvas').clearCanvas(); + + //clear speech bubbles + var speechBubbles = $("div[id*='sppeachBubble']"); + if (speechBubbles != null || speechBubbles != undefined && speechBubbles.length > 0) { + for (var j = 0; j < speechBubbles.length; j++) { + + speechBubbles[j].parentNode.removeChild(speechBubbles[j]); + } + } + var speechBubbleLines = $("div[id*='sppeachBubbleLine']"); + if (speechBubbleLines != null || speechBubbleLines != undefined && speechBubbleLines.length > 0) { + for (var j = 0; j < speechBubbleLines.length; j++) { - $scope.context.clearRect(0, 0, canvasWidth, canvasHeight); + speechBubbleLines[j].parentNode.removeChild(speechBubbleLines[j]); + } + } }; - $scope.createSpeechBubble = function (x, y, PinId) { - //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 - // we decide the size of speech bubble + + $scope.createSpeechBubble = function (x, y, PinId, isCtrlPressed, isPinClicked, isSameTermWithMultiPin) { + $scope.longestAnnotation = $scope.MultiLanguageAnnationArray.reduce(function (firstAnnotation, seconAnnotation) { return firstAnnotation.length > seconAnnotation.length ? firstAnnotation : seconAnnotation; }); - $scope.createSpeechBubbleBasedOnAnnotationLengthwithoutCtrl(x, y,PinId); - - + + $scope.createSpeechBubbleBasedOnAnnotationLength(x, y, PinId); + + $('#sppeachBubble').draggable( + { + drag: function (evt) { + $("#dot").css("visibility", "hidden"); + var verticalScrollPosition = canvasDiv.scrollTop; + var horizontlScrollPosition = canvasDiv.scrollLeft; + $scope.angle(x, y, evt.pageX + horizontlScrollPosition - $('#imageDiv').offset().left, evt.pageY + verticalScrollPosition - $('#imageDiv').offset().top, true); + }, + }); + } $scope.GetAnnotationBasedOnActualTermNo = function (actualTermNo, language) { @@ -632,64 +676,13 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } - $scope.createSpeechBubbleBasedOnAnnotationLength = function (pointClicked, x, y, id) { - var sppechBubbleHTML = "
"; - //Issue #7286 :Undefined annotation should not appear - for (var i = 0; i <= $scope.MultiLanguageAnnationArray.length - 1; i++) { - var annotation = $scope.MultiLanguageAnnationArray[i]; - } - - if (annotation == undefined) { - console.log("No text found"); - } else { - - $("#canvasDiv").append(sppechBubbleHTML); - - for (var i = 0; i <= $scope.MultiLanguageAnnationArray.length - 1; i++) { - var annotation = $scope.MultiLanguageAnnationArray[i]; - - $("#" + id).append("

" + annotation + "

"); - } - - if ($scope.longestAnnotation.length <= 10) { - $("#" + id).css("width", "100px"); - } - - else if ($scope.longestAnnotation.length > 10 && $scope.longestAnnotation.length <= 17) { - $("#" + id).css("width", "140px"); - } - else if ($scope.longestAnnotation.length > 17 && $scope.longestAnnotation.length <= 26) { - $("#" + id).css("width", "195px"); - - } - else if ($scope.longestAnnotation.length > 26 && $scope.longestAnnotation.length <= 34) { - $("#" + id).css("width", "248px"); - } - else if ($scope.longestAnnotation.length > 34 && $scope.longestAnnotation.length <= 44) { - $("#" + id).css("width", "300px"); - } - else if ($scope.longestAnnotation.length > 44 && $scope.longestAnnotation.length <= 54) { - $("#" + id).css("width", "370px"); - } - else if ($scope.longestAnnotation.length > 54 && $scope.longestAnnotation.length <= 69) { - $("#" + id).css("width", "450px"); - } - else if ($scope.longestAnnotation.length > 69 && $scope.longestAnnotation.length <= 75) { - $("#" + id).css("width", "510px"); + $scope.createSpeechBubbleBasedOnAnnotationLength = function (x, y, PinId) { - } - else { - $("#" + id).css("width", ($scope.longestAnnotation.length) + "%"); - } - } - } - $rootScope.Globe1 = []; - $scope.createSpeechBubbleBasedOnAnnotationLengthwithoutCtrl = function (x, y, PinId) { - var sppechBubbleDotHTML = '' + var speechBubbleHTML = '' + '
' + '' - + '
' + + '
' + ''; @@ -702,12 +695,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo if (MultipleLanguage == undefined) { console.log("No text is found"); } else { - $('#imageDiv').append(sppechBubbleDotHTML); + $('#imageDiv').append(speechBubbleHTML); if ($scope.MultiLanguageAnnationArray.length > 0) { for (var i = 0; i <= $scope.MultiLanguageAnnationArray.length - 1; i++) { var MultipleLanguage = $scope.MultiLanguageAnnationArray[i]; - $("#sppeachBubble"+PinId).append("

" + MultipleLanguage + "

"); + $("#sppeachBubble" + PinId).append("

" + MultipleLanguage + "

"); } } else { @@ -762,89 +755,191 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } } var Globe = []; - + $rootScope.Globe1.push({ "currentX": x, "currentY": y, "id": PinId }); - Globe.push({ currentX: x, currentY: y}); + Globe.push({ currentX: x, currentY: y }); document.getElementById('speechBubbleLine' + PinId + '').style.display = 'block'; document.getElementById('speechBubbleLine' + PinId + '').style.left = ((Globe[0].currentX - 45)) + 'px'; document.getElementById('speechBubbleLine' + PinId + '').style.top = ((Globe[0].currentY) - 20) + 'px'; document.getElementById('sppeachBubble' + PinId + '').style.display = 'block'; document.getElementById('sppeachBubble' + PinId + '').style.left = (Globe[0].currentX - 70) + 'px'; document.getElementById('sppeachBubble' + PinId + '').style.top = (Globe[0].currentY - 58) + 'px'; - + $('.common-drag').draggable( { drag: function (evt) { - // $("#dot").css("visibility", "hidden"); + var verticalScrollPosition = document.getElementById('imageDiv').scrollTop; var horizontlScrollPosition = document.getElementById('imageDiv').scrollLeft; var a = $(this).attr("id"); - + var res = a.substring(13, a.length); $("#speechBubbleLine" + res).css("visibility", "hidden"); - - // var c = ($("#sppeachBubble" + res).css("left")).toString().replace("px", ""); - // alert(c); - //var d = ($("#sppeachBubble" + res).css("top")).toString().replace("px", ""); - // alert(d); - console.log("res= " + res + "x= " + x + ",y= " + y + ",evt.pageY= " + evt.page + ",evt.pageX= " + evt.pageX + ",horizontlScrollPosition= " + horizontlScrollPosition + ",verticalScrollPosition= " + verticalScrollPosition); - - // alert(evt.pageX + "X" + evt.pageY + "horizontlScrollPosition" + horizontlScrollPosition + "verticalScrollPosition" + verticalScrollPosition); - for (var i = 0; i <= $rootScope.Globe1.length - 1; i++) { - if ($rootScope.Globe1[i].id == res) { - // alert($rootScope.Globe1[i].currentX); - $scope.angle(res, $rootScope.Globe1[i].currentX, $rootScope.Globe1[i].currentY, evt.pageX + horizontlScrollPosition - $('#imageDiv').offset().left, evt.pageY + verticalScrollPosition - $('#imageDiv').offset().top, true); - } - } + + + console.log("res= " + res + "x= " + x + ",y= " + y + ",evt.pageY= " + evt.page + ",evt.pageX= " + evt.pageX + ",horizontlScrollPosition= " + horizontlScrollPosition + ",verticalScrollPosition= " + verticalScrollPosition); + + for (var i = 0; i <= $rootScope.Globe1.length - 1; i++) { + if ($rootScope.Globe1[i].id == res) { + + $scope.angle(res, $rootScope.Globe1[i].currentX, $rootScope.Globe1[i].currentY, evt.pageX + horizontlScrollPosition - $('#imageDiv').offset().left, evt.pageY + verticalScrollPosition - $('#imageDiv').offset().top, true); + } + } + }, }); $('.crossDiv_temp').on('click', function (evt) { + var imgId = $(this).attr("id"); var pinId = imgId.substring(8, imgId.length); $('#sppeachBubble' + pinId).remove(); $("#speechBubbleDraggedLine" + pinId).remove(); $("#speechBubbleLine" + pinId).remove(); + + //make all pin heads grey + var pinHeadName = 'PinArc_' + pinId; + var radial = $('#aaDetailViewCanvas').createGradient({ + x1: 50, y1: 50, + x2: 50, y2: 50, + r1: 10, r2: 30, + c1: 'rgba(100, 50, 0,0)', + c2: 'rgb(216, 216, 216)' + }); + + + $('#aaDetailViewCanvas').setLayer(pinHeadName, { + fillStyle: radial, + }).drawLayers(); }); + + //make the head green + var radialAfterClick = $('#aaDetailViewCanvas').createGradient({ + x1: 50, y1: 50, + x2: 50, y2: 50, + r1: 10, r2: 30, + c1: 'rgba(100, 50, 0,0)', + c2: 'rgb(126, 187, 83)' + }); + var pinHeadName = 'PinArc_' + PinId; + var pin = $('#aaDetailViewCanvas').getLayer(pinHeadName); + // pin.fillStyle = radialAfterClick; + + $('#aaDetailViewCanvas').setLayer(pinHeadName, { + fillStyle: radialAfterClick, + }).drawLayers(); } + + + $scope.angle = function (id, cx, cy, ex, ey, BoolValues) { + var dy = ey - cy; + var dx = ex - cx; + var theta = 0; + if (dx < 0) { + theta = Math.atan(dy / dx) * (180 / Math.PI); + theta = theta + 180; + + } + else if (dy < 0) { + theta = Math.atan(dy / dx) * (180 / Math.PI); + theta = theta + 360; + + } + else { + theta = Math.atan(dy / dx) * (180 / Math.PI); + } + + var d = Math.sqrt((cx - ex) * (cx - ex) + (cy - ey) * (cy - ey)); + var e = cy; + var f = cx; - $scope.angle = function (id, cx, cy, ex, ey, BoolValues) { - // debugger; - // alert(ex + " " + ey); - var dy = ey - cy; - var dx = ex - cx; - var theta = 0; - if (dx < 0) { - theta = Math.atan(dy / dx) * (180 / Math.PI); - theta = theta + 180; + if (BoolValues == true) { + $("#speechBubbleDraggedLine" + id).css({ 'display': 'block', 'width': d + 'px', 'top': (e - 10) + 'px', 'left': (f - 5) + 'px', 'transform': 'rotate(' + theta + 'deg)', '-moz-transform': 'rotate(' + theta + 'deg)', '-webkit-transform': 'rotate(' + theta + 'deg)', 'transform-origin': '0% 0%' }); + } + else { + $("#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%' }); + } - } - else if (dy < 0) { - theta = Math.atan(dy / dx) * (180 / Math.PI); - theta = theta + 360; - } - else { - theta = Math.atan(dy / dx) * (180 / Math.PI); - } - var d = Math.sqrt((cx - ex) * (cx - ex) + (cy - ey) * (cy - ey)); - var e = cy; - var f = cx; - // alert(d); - if (BoolValues == true) { - $("#speechBubbleDraggedLine"+id).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%' }); - } - else { - $("#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%' }); + } + + + $scope.DrawStaticPinsOnImage = function (canvasId, PinId, offsetX1, offsetY1, x, y) { + + var radial = $('#' + canvasId).createGradient({ + x1: 50, y1: 50, + x2: 50, y2: 50, + r1: 10, r2: 30, + c1: 'rgba(100, 50, 0,0)', + c2: 'rgb(216, 216, 216)' + }); + $('#' + canvasId).drawLine({ + + layer: true, + name: "Pin_" + PinId, + groups: ["Pin_" + PinId], + strokeStyle: 'black', + strokeWidth: 2, + x1: offsetX1, y1: offsetY1, + x2: x, y2: y, + + }).drawArc({ + name: "PinArc_" + PinId, + layer: true, + groups: ["Pin_" + PinId], + strokeStyle: 'grey', + strokeWidth: 2, + fillStyle: radial, + x: x, y: y, + radius: 5, + + click: function (clickedPin) { + + //change the head color to green + var radialAfterClick = $('#aaDetailViewCanvas').createGradient({ + x1: 50, y1: 50, + x2: 50, y2: 50, + r1: 10, r2: 30, + c1: 'rgba(100, 50, 0,0)', + c2: 'rgb(126, 187, 83)' + }); + + clickedPin.fillStyle = radialAfterClick; + + var pinID = (clickedPin.name).substring(7, (clickedPin.name).length); + // alert('pinId: ' + pinID); + //showAnnotation(); + var pinID = (clickedPin.name).substring(7, (clickedPin.name).length); + var selectedPinData = new jinqJs() + .from($scope.aaPinData) + .where("_PinId == " + pinID) + .select(); + if (clickedPin.event.ctrlKey == true) { + $scope.showAnnotation(selectedPinData, true, true); + + } + else { + $scope.showAnnotation(selectedPinData, false, true); + + } + + } + }).drawLayers(); + } - } - + $scope.onCloseBtnClick = function (event) { + alert('closed') + } + + $("#closeBtn").click(function () { + alert('closed') + }); }]); function showSelectedSystemPins(event) { @@ -853,4 +948,7 @@ function showSelectedSystemPins(event) { scope.$apply(function () { scope.showSelectedSystemPins(event); }); +} +onCloseBtnClick = function (event) { + alert('closed') } \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.Web/app/views/aa/atlas-anatomy-detail.html b/400-SOURCECODE/AIAHTML5.Web/app/views/aa/atlas-anatomy-detail.html index a544d71..1e5859a 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/views/aa/atlas-anatomy-detail.html +++ b/400-SOURCECODE/AIAHTML5.Web/app/views/aa/atlas-anatomy-detail.html @@ -11,7 +11,7 @@
-
+