diff --git a/400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj b/400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj index 123ad82..fea8783 100644 --- a/400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj +++ b/400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj @@ -19,6 +19,7 @@ + true @@ -109,11 +110,13 @@ + Global.asax + diff --git a/400-SOURCECODE/AIAHTML5.API/Controllers/PixelLocationsController.cs b/400-SOURCECODE/AIAHTML5.API/Controllers/PixelLocationsController.cs new file mode 100644 index 0000000..d127aca --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.API/Controllers/PixelLocationsController.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Web.Http; +using AIAHTML5.API.Models; + +namespace AIAHTML5.API.Controllers +{ + public class PixelLocationsController : ApiController + { + // GET: api/PixelLocations + public IEnumerable Get() + { + return new string[] { "value1", "value2" }; + } + + // GET: api/PixelLocations/5 + public HttpResponseMessage Get(string layerNumber, string bodyViewIndex, string systemNumber, string zoomLevel) + { + dynamic bodyRegions = PixelLocator.GetBodyRegionsPixelData(layerNumber, bodyViewIndex, systemNumber, zoomLevel); + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(bodyRegions) }; + } + + // POST: api/PixelLocations + public void Post([FromBody]string value) + { + } + + // PUT: api/PixelLocations/5 + public void Put(int id, [FromBody]string value) + { + } + + // DELETE: api/PixelLocations/5 + public void Delete(int id) + { + } + } +} diff --git a/400-SOURCECODE/AIAHTML5.API/Models/PixelLocator.cs b/400-SOURCECODE/AIAHTML5.API/Models/PixelLocator.cs new file mode 100644 index 0000000..c50d4b9 --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.API/Models/PixelLocator.cs @@ -0,0 +1,51 @@ +using MongoDB.Bson; +using MongoDB.Driver; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace AIAHTML5.API.Models +{ + public class PixelLocator + { + + internal static dynamic GetBodyRegionsPixelData(string layerNumber, string bodyViewIndex, string systemNumber, string zoom) + { + try + { + var client = new MongoClient("localhost:27017"); + var db = client.GetDatabase("AIAHTML5"); + + var col = db.GetCollection("DAImages"); + + var pipeline = new BsonDocument[] + { + new BsonDocument{ {"$match", new BsonDocument("terms.SystemNumbers", Convert.ToInt32(systemNumber)) }}, + new BsonDocument{{"$unwind", "$terms"}}, + new BsonDocument{ { "$match", new BsonDocument("terms.SystemNumbers", Convert.ToInt32(systemNumber)) }}, + new BsonDocument{ { "$match", new BsonDocument("bodyViewIndex", Convert.ToInt32(bodyViewIndex)) }}, + new BsonDocument{ { "$match", new BsonDocument("layerNumber", Convert.ToInt32(layerNumber)) }}, + new BsonDocument{ { "$match", new BsonDocument("zoom", Convert.ToInt32(zoom)) }}, + + new BsonDocument { {"$project", new BsonDocument() + .Add("_id", 0) + .Add("terms", 1) + .Add("bodyRegionId", 1) + .Add("layerNumber", 1) + .Add("bodyViewIndex", 1) + } } + }; + + + var pixelData = col.Aggregate(pipeline).ToList(); + + return pixelData.ToJson(); + } + catch (Exception e) + { + return "error"; + } + } +} +} diff --git a/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll b/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll index 3a0f416..2cdb446 100644 --- a/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll +++ b/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll diff --git a/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.pdb b/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.pdb index f6b437f..4379e65 100644 --- a/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.pdb +++ b/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.pdb diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index 30e501c..510b42f 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -1,8 +1,8 @@  'use strict'; -AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$log", "$location", "$timeout", "DA", "Modules", "$routeParams", "DataService", -function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Modules, $routeParam, DataService) { +AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$log", "$location", "$timeout", "DA", "Modules", "$routeParams", "DataService","TermService", + function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Modules, $routeParam, DataService, TermService) { $scope.genderId = ""; @@ -594,7 +594,11 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } angular.element(document).ready(function (e) { - + $(document).on("click", "#daImagePanel .jsPanel-hdr .jsPanel-hdr-r .jsPanel-btn-close .jsglyph-remove", function () { + $rootScope.selectedBodySystemName = 'All'; + $rootScope.selectedBodySystemId = 0; + $rootScope.searchSelectedText = ''; + }); $("#layerChangeSlider").slider({ orientation: "vertical", range: "max", @@ -2831,12 +2835,14 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.highlightedBR = []; - if ($scope.layerNumber == 224) { + // if ($scope.layerNumber == 224) { var matchedTermListPath = '~/../content/data/json/da/body-views/1/BodySystem_' + $rootScope.systemNumber + '.json'; var grayImageDataVar = null; - DataService.getJson(matchedTermListPath) + // DataService.getJson(matchedTermListPath) + TermService.getTermData($scope.layerNumber, $rootScope.voId, $rootScope.systemNumber, $rootScope.zoomInOut) + .then( function (result) { console.log('1. HighlightBodyByTermListForBodySystem is called'); @@ -3032,7 +3038,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo }); - } + // } } @@ -8256,7 +8262,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //list manager $scope.$on('listManagerEvent', function (event, data) { - + if ($rootScope.islistManagerEventAlredayDispachted == true) { $('#spinner').css('visibility', 'visible'); @@ -8267,7 +8273,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo console.log('optionsLength= ' + optionsLength) if (optionsLength > 0) $('#bodySystems').empty(); - + $("#bodySystems").css("display", "block"); + $("#AABodySystems").css("display", "none"); var $all = $('').appendTo('#bodySystems'); $compile($all)($scope); @@ -8309,7 +8316,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo }); - + $scope.loadListManger = function () { diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js index d287a84..c80cb4d 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js @@ -3148,7 +3148,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic $rootScope.disableAnnotationtoolOnListManager = false; $rootScope.ShowListManager = function () { - + $rootScope.switchCanvas(); $("#annotationpaintbrushsize").attr("href", "#"); $("#annotationpainteraser").attr("href", "#"); @@ -3168,30 +3168,58 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic $('#listManager').draggable(); $rootScope.islistManagerEventAlredayDispachted = true; - + $rootScope.$broadcast('listManagerEvent', true); - + if ($rootScope.selectedBodySystemName == undefined && $rootScope.slectedActualTermNumber == undefined) { - $('#termList option[selected="selected"]').prop("selected", false); - $('#termList option[value="' + $rootScope.searchSelectedText + '"]').prop("selected", true); - $("#termList").find("option").css({ "background-color": "#ffffff", "color": "#000000" }); - $('#termList option[value="' + $rootScope.searchSelectedText + '"]').css({ "background-color": "#3399FF", "color": "#ffffff" }); - } + if ($location.path() == "/module-item-view") { + $timeout(function () { + $('#termList option[selected="selected"]').prop("selected", false); + $('#termList option[value="' + $rootScope.searchSelectedText + '"]').prop("selected", true); + $("#termList").find("option").css({ "background-color": "#ffffff", "color": "#000000" }); + $('#termList option[value="' + $rootScope.searchSelectedText + '"]').css({ "background-color": "#3399FF", "color": "#ffffff" }); + }, 1000); + } + else { + $('#termList option[selected="selected"]').prop("selected", false); + $('#termList option[value="' + $rootScope.searchSelectedText + '"]').prop("selected", true); + $("#termList").find("option").css({ "background-color": "#ffffff", "color": "#000000" }); + $('#termList option[value="' + $rootScope.searchSelectedText + '"]').css({ "background-color": "#3399FF", "color": "#ffffff" }); + } + } else { if ($rootScope.selectedBodySystemId == undefined) { $rootScope.selectedBodySystemId = 0; - $rootScope.refreshTermListOnSystemSelection($rootScope.selectedBodySystemId); + if ($location.path() == "/module-item-view") { + $rootScope.refreshTermListOnAASystemSelection($rootScope.selectedBodySystemId); + } + else { + if ($location.path() == "/module-item-view") { + $rootScope.refreshTermListOnAASystemSelection($rootScope.selectedBodySystemId); + } + else { + $rootScope.refreshTermListOnSystemSelection($rootScope.selectedBodySystemId); + } + + } } else { - $rootScope.refreshTermListOnSystemSelection($rootScope.selectedBodySystemId); + if ($location.path() == "/module-item-view") { + $rootScope.refreshTermListOnAASystemSelection($rootScope.selectedBodySystemId); + } + else { + $rootScope.refreshTermListOnSystemSelection($rootScope.selectedBodySystemId); + } + } - + + $timeout(function () { $('#bodySystems option[selected="selected"]').prop("selected", false); $('#bodySystems option[value="' + $rootScope.selectedBodySystemName + '"]').prop("selected", true); $("#termList").find("option").css({ "background-color": "#ffffff", "color": "#000000" }); $('#termList option[value="' + $rootScope.searchSelectedText + '"]').css({ "background-color": "#3399FF", "color": "#ffffff" }); - + }, 1000); } $("#optionsListManagerTab").addClass("active"); var viewNameAftrSplit = $("#viewName").val().split(" "); @@ -3201,7 +3229,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic } $rootScope.CloseListManager = function () { - + $("#btnTranparency").removeAttr('disabled', 'disabled'); $("#optionsListManagerTab").removeClass("active"); console.log('close'); @@ -3219,6 +3247,10 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic $rootScope.switchCanvasToPaintCanvas(); } } + if ($location.path() == "/module-item-view") { + $rootScope.selectedBodySystemName = $("#AABodySystems").val(); + $rootScope.selectedBodySystemId = $('#AABodySystems option[value="' + $rootScope.selectedBodySystemName + '"]').attr("id"); + } $('#listManager').css('display', 'none'); $("#listManager").css("visibility", "hidden"); @@ -3505,6 +3537,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic }; $rootScope.ShowPrintPreviewWindow = function (event) { // Print Preview + $(".tools").css("z-index", "1029"); $rootScope.CloseListManager(); $rootScope.CloseAnnotationTool(); $("#annotationButton").parent().addClass("disableMenuannotation"); diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js index 73a5216..5861d37 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js @@ -316,11 +316,11 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou }); $(document).on("click", "#ImagePanel .jsPanel-hdr .jsPanel-hdr-r .jsPanel-btn-close .jsglyph-remove", function () { $scope.setActiveTab(parseInt(localStorage.getItem("activeTab"))); - //if (localStorage.getItem("activeTab") != null) { - - // $rootScope.isListViewRowClicked = true; - - //} + $(".tools").css("z-index", "15000"); + $rootScope.selectedBodySystemName = 'All'; + $rootScope.selectedBodySystemId = 0; + $rootScope.searchSelectedText = ''; + }); }) @@ -1170,10 +1170,10 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou $rootScope.onDrawingCanvasClick(); $rootScope.FreeStylePaint(); }); - + $rootScope.loadSearchData = function () { - - + + //$("#termList").find("option").css({ "background-color": "#ffffff", "color": "#000000" }); var imageId = $rootScope.imageId; var promise = ModuleService.getTermTextDataForAAImage(imageId) .then( @@ -1190,32 +1190,49 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou .from($scope.AAPinTermData) .where('_LanguageId == ' + primaryLexicon) .select(); - + var sortedTermTextArray = []; for (var i = 0; i < $scope.matchedLanguageTermData.length; i++) { - $scope.pinTermData.push({ "LanguageId": $scope.matchedLanguageTermData[i]._LanguageId, "TermNumber": $scope.matchedLanguageTermData[i]._TermNumber, "TermTxt": $scope.matchedLanguageTermData[i]._TermText}); + sortedTermTextArray.push($scope.matchedLanguageTermData[i]._TermText); + sortedTermTextArray.sort(); } + + for (var i = 0; i <= sortedTermTextArray.length - 1; i++) { + for (var j = 0; j <= $scope.matchedLanguageTermData.length - 1; j++) { + if ($scope.matchedLanguageTermData[j]._TermText == sortedTermTextArray[i]) { + $scope.pinTermData.push({ "LanguageId": $scope.matchedLanguageTermData[j]._LanguageId, "TermNumber": $scope.matchedLanguageTermData[j]._TermNumber, "TermTxt": $scope.matchedLanguageTermData[j]._TermText }); + break; + } + } + } + + $scope.$watch('$scope.pinTermData', function (newValue, oldValue, scope) { - if ($('#termlistfilter').html() != "") - $('#termList').empty(); - $('#termlistfilter').empty() + + if (($('#termlistfilter').html() != "")) + + $('#termlistfilter').empty(); if ($scope.pinTermData.length > 0) { $timeout(function () { console.log('pinTermData= ' + $scope.pinTermData.length); + $('#termList').empty(); for (var j = 0; j < $scope.pinTermData.length; j++) { var $el = $('
  • ' + $scope.pinTermData[j].TermTxt + '
  • ').appendTo('#termlistfilter') $compile($el)($scope); - var $selectedOptions = $('').appendTo("#termList") + var $selectedOptions = $('').appendTo("#termList") + $compile($selectedOptions)($scope); - $("#bodySystems").empty(); + + $("#AABodySystems").empty(); + $("#bodySystems").css("display","none"); + $("#AABodySystems").css("display","block"); $("#bodySystemList li a").each(function (key, value) { - var $systemOptions = $('').appendTo("#bodySystems") + var $systemOptions = $('').appendTo("#AABodySystems") $compile($systemOptions)($scope); }); } }, 500); } }) - }, function (error) { // handle errors here @@ -1228,30 +1245,47 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou $scope.$on('listManagerEvent', function (event, data) { + $("#viewName").empty(); $("#viewName").append(""); - $rootScope.isLoading = false; $('#spinner').css('visibility', 'hidden'); - + + if ($rootScope.bodySystemSeletedId == null) { + + $rootScope.loadSearchData(); + } + else + { + + $rootScope.refreshTermListOnAASystemSelection($rootScope.bodySystemSeletedId); + } + $timeout(function () { + $("#totalTerms").empty(); + $("#totalTerms").html("" + $("#termList option").length + " Structures"); + }, 1000); }); - $scope.refreshTermListOnSystemSelection = function (bodySystemId) { - var bodySystemName = $("#bodySystems #" + bodySystemId).val(); - + $rootScope.refreshTermListOnAASystemSelection = function (bodySystemId) { + + $rootScope.bodySystemSeletedId = bodySystemId; + $('#termList').empty(); + var bodySystemName = $("#AABodySystems #" + bodySystemId).val(); if (bodySystemName == "All") { for (var j = 0; j <= $scope.pinTermData.length - 1; j++) { - var $selectedOptions = $('').appendTo("#termList") + var $selectedOptions = $('').appendTo("#termList") $compile($selectedOptions)($scope); } + $("#totalTerms").empty(); + $("#totalTerms").html("" + $("#termList option").length + " Structures"); } else { var imageId = $rootScope.imageId; $scope.pinDataUrl = "aa_dat_pinterm_" + imageId; $rootScope.bodySystemTermArray = []; - $('#termList').empty(); + $.ajax({ url: '~/../content/data/json/aa/aa_pinterm/' + $scope.pinDataUrl + '.json', type: 'GET', @@ -1267,7 +1301,7 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou if ($scope.aaPinData[i]._TermId == $rootScope.bodySystemTermArray[j].termNumbr) { if ($rootScope.bodySystemTermArray[j].language == "1") { console.log($rootScope.bodySystemTermArray[j].text); - var $selectedOptions = $('').appendTo("#termList") + var $selectedOptions = $('').appendTo("#termList") $compile($selectedOptions)($scope); } } @@ -1275,8 +1309,9 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou } } } - }); + $("#totalTerms").empty(); + $("#totalTerms").html("" + $("#termList option").length + " Structures"); } } $scope.GetAnnotationBasedOnActualTermNo = function (actualTermNo) { @@ -1496,31 +1531,19 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou $scope.highlightPinBasedOnSerachItem = function (event) { - if ($scope.isTermListOptionClicked == true) { - $scope.searchItemId = event; - $scope.searchItemText = event.innerHTML; - $('#termList option[selected="selected"]').prop("selected", false); - $('#termList option[value="' + $rootScope.searchSelectedText + '"]').prop("selected", true); - $("#termList").find("option").css({ "background-color": "#ffffff", "color": "#000000" }); - $('#termList option[value="' + $rootScope.searchSelectedText + '"]').css({ "background-color": "#3399FF", "color": "#ffffff" }); - $scope.searchFilter = event.innerHTML; - selectedTermName.placeholder = event.innerHTML; - $scope.isTermListOptionClicked = false; - } - else - { $scope.searchItemId = event.currentTarget.id; $scope.searchItemText = event.currentTarget.innerHTML; + $rootScope.searchSelectedText = $("#" + event.currentTarget.id).text(); $('#termList option[selected="selected"]').prop("selected", false); $('#termList option[value="' + $rootScope.searchSelectedText + '"]').prop("selected", true); $("#termList").find("option").css({ "background-color": "#ffffff", "color": "#000000" }); $('#termList option[value="' + $rootScope.searchSelectedText + '"]').css({ "background-color": "#3399FF", "color": "#ffffff" }); + $("#termlistfilter li a").css({ "background-color": "#ffffff", "color": "#000000" }); + $("#termlistfilter li #" + $scope.searchItemId).css({ "background-color": "#3399FF", "color": "#ffffff" }); $scope.searchFilter = event.currentTarget.innerHTML; selectedTermName.placeholder = event.currentTarget.innerHTML; - } - //get data from pindata for this trem @@ -1566,20 +1589,19 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou } } } - - - + }]); -function refreshTermListOnSystem(bodySystemId) { - // alert('refreshTermListOnSystem is called outside'); - var scope = angular.element(document.getElementById("aaDetailPageDiv")).scope(); - scope.$apply(function () { - scope.refreshTermListOnSystemSelection(bodySystemId); +function refreshTermListOnSystemSel(bodySystemId) { + + var rootScope = angular.element(document.getElementById("aaDetailPageDiv")).scope(); + rootScope.$apply(function () { + rootScope.refreshTermListOnAASystemSelection(bodySystemId); }); } + function showSelectedSystemPins(event) { console.log('OnBodySystem chnaged is called outside '); var scope = angular.element(document.getElementById("aaDetailPageDiv")).scope(); @@ -1628,14 +1650,14 @@ function onSearchItemSelection(event) { }); } -function onListManagerTermSelection(event) { - var scope = angular.element(document.getElementById("aaDetailPageDiv")).scope(); - scope.isTermListOptionClicked = true; - scope.$apply(function () { - scope.highlightPinBasedOnSerachItem(event); - }); +//function onListManagerTermSelection(event) { +// var scope = angular.element(document.getElementById("aaDetailPageDiv")).scope(); +// scope.isTermListOptionClicked = true; +// scope.$apply(function () { +// scope.highlightPinBasedOnSerachItem1(event); +// }); -} +//} function showHideAnnotation(event) { diff --git a/400-SOURCECODE/AIAHTML5.Web/app/services/TermService.js b/400-SOURCECODE/AIAHTML5.Web/app/services/TermService.js new file mode 100644 index 0000000..714090c --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.Web/app/services/TermService.js @@ -0,0 +1,28 @@ +AIA.factory('TermService', function ($http, $q) { + return { + getTermData: function (layerNo, BodyViewId, systemNo, zoomLevel) { + + var deferred = $q.defer(); + //var URL = 'http://localhost:86/api/PixelLocations?layerNumber=' + layerNo + '&bodyViewIndex=' + BodyViewId + '&systemNumber=' + systemNo + '&zoomLevel=' + zoomLevel + '' + var URL = '/API/api/PixelLocations?layerNumber=' + layerNo + '&bodyViewIndex=' + BodyViewId + '&systemNumber=' + systemNo + '&zoomLevel=' + zoomLevel + '' + + $http({ + method: 'get', + url: URL, + headers: { + 'Content-Type': 'application/json', + } + + }) + .success(function (data, status, headers, config) { + + console.log('success') + deferred.resolve(data); + }).error(function (data, status, headers, config) { + console.log('error status= ' + status) + deferred.reject(status); + }); + return deferred.promise; + }, + } +}) \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.Web/index.html b/400-SOURCECODE/AIAHTML5.Web/index.html index 6f6a657..1d46045 100644 --- a/400-SOURCECODE/AIAHTML5.Web/index.html +++ b/400-SOURCECODE/AIAHTML5.Web/index.html @@ -597,7 +597,7 @@ +