Commit 6aa1ed7c56362f36906704b02cad57f78557c0e2

Authored by Amrita Vishnoi
2 parents 16bf21f7 8f04567a

Merge branch 'HighlightByBSOpt2' of http://52.6.196.163/ADAM/AIAHTML5 into 25%Zoom

400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj
... ... @@ -19,6 +19,7 @@
19 19 <IISExpressAnonymousAuthentication />
20 20 <IISExpressWindowsAuthentication />
21 21 <IISExpressUseClassicPipelineMode />
  22 + <UseGlobalApplicationHostFile />
22 23 </PropertyGroup>
23 24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
24 25 <DebugSymbols>true</DebugSymbols>
... ... @@ -109,11 +110,13 @@
109 110 <Compile Include="Controllers\AdminAccessController.cs" />
110 111 <Compile Include="Controllers\AuthenticateController.cs" />
111 112 <Compile Include="Controllers\ForgotUserController.cs" />
  113 + <Compile Include="Controllers\PixelLocationsController.cs" />
112 114 <Compile Include="Controllers\ResetPasswordController.cs" />
113 115 <Compile Include="Global.asax.cs">
114 116 <DependentUpon>Global.asax</DependentUpon>
115 117 </Compile>
116 118 <Compile Include="Models\DBModel.cs" />
  119 + <Compile Include="Models\PixelLocator.cs" />
117 120 <Compile Include="Models\User.cs" />
118 121 <Compile Include="Models\UserUtility.cs" />
119 122 <Compile Include="Models\Users.cs" />
... ...
400-SOURCECODE/AIAHTML5.API/Controllers/PixelLocationsController.cs 0 → 100644
  1 +using System;
  2 +using System.Collections.Generic;
  3 +using System.Linq;
  4 +using System.Net;
  5 +using System.Net.Http;
  6 +using System.Web.Http;
  7 +using AIAHTML5.API.Models;
  8 +
  9 +namespace AIAHTML5.API.Controllers
  10 +{
  11 + public class PixelLocationsController : ApiController
  12 + {
  13 + // GET: api/PixelLocations
  14 + public IEnumerable<string> Get()
  15 + {
  16 + return new string[] { "value1", "value2" };
  17 + }
  18 +
  19 + // GET: api/PixelLocations/5
  20 + public HttpResponseMessage Get(string layerNumber, string bodyViewIndex, string systemNumber, string zoomLevel)
  21 + {
  22 + dynamic bodyRegions = PixelLocator.GetBodyRegionsPixelData(layerNumber, bodyViewIndex, systemNumber, zoomLevel);
  23 + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(bodyRegions) };
  24 + }
  25 +
  26 + // POST: api/PixelLocations
  27 + public void Post([FromBody]string value)
  28 + {
  29 + }
  30 +
  31 + // PUT: api/PixelLocations/5
  32 + public void Put(int id, [FromBody]string value)
  33 + {
  34 + }
  35 +
  36 + // DELETE: api/PixelLocations/5
  37 + public void Delete(int id)
  38 + {
  39 + }
  40 + }
  41 +}
... ...
400-SOURCECODE/AIAHTML5.API/Models/PixelLocator.cs 0 → 100644
  1 +using MongoDB.Bson;
  2 +using MongoDB.Driver;
  3 +using System;
  4 +using System.Collections.Generic;
  5 +using System.Linq;
  6 +using System.Web;
  7 +
  8 +namespace AIAHTML5.API.Models
  9 +{
  10 + public class PixelLocator
  11 + {
  12 +
  13 + internal static dynamic GetBodyRegionsPixelData(string layerNumber, string bodyViewIndex, string systemNumber, string zoom)
  14 + {
  15 + try
  16 + {
  17 + var client = new MongoClient("localhost:27017");
  18 + var db = client.GetDatabase("AIAHTML5");
  19 +
  20 + var col = db.GetCollection<BsonDocument>("DAImages");
  21 +
  22 + var pipeline = new BsonDocument[]
  23 + {
  24 + new BsonDocument{ {"$match", new BsonDocument("terms.SystemNumbers", Convert.ToInt32(systemNumber)) }},
  25 + new BsonDocument{{"$unwind", "$terms"}},
  26 + new BsonDocument{ { "$match", new BsonDocument("terms.SystemNumbers", Convert.ToInt32(systemNumber)) }},
  27 + new BsonDocument{ { "$match", new BsonDocument("bodyViewIndex", Convert.ToInt32(bodyViewIndex)) }},
  28 + new BsonDocument{ { "$match", new BsonDocument("layerNumber", Convert.ToInt32(layerNumber)) }},
  29 + new BsonDocument{ { "$match", new BsonDocument("zoom", Convert.ToInt32(zoom)) }},
  30 +
  31 + new BsonDocument { {"$project", new BsonDocument()
  32 + .Add("_id", 0)
  33 + .Add("terms", 1)
  34 + .Add("bodyRegionId", 1)
  35 + .Add("layerNumber", 1)
  36 + .Add("bodyViewIndex", 1)
  37 + } }
  38 + };
  39 +
  40 +
  41 + var pixelData = col.Aggregate<BsonDocument>(pipeline).ToList();
  42 +
  43 + return pixelData.ToJson();
  44 + }
  45 + catch (Exception e)
  46 + {
  47 + return "error";
  48 + }
  49 + }
  50 +}
  51 +}
... ...
400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll
No preview for this file type
400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.pdb
No preview for this file type
400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
1 1 
2 2 'use strict';
3 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) {
  4 +AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$log", "$location", "$timeout", "DA", "Modules", "$routeParams", "DataService","TermService",
  5 + function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Modules, $routeParam, DataService, TermService) {
6 6  
7 7  
8 8 $scope.genderId = "";
... ... @@ -2835,12 +2835,14 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2835 2835  
2836 2836 $scope.highlightedBR = [];
2837 2837  
2838   - if ($scope.layerNumber == 224) {
  2838 + // if ($scope.layerNumber == 224) {
2839 2839  
2840 2840 var matchedTermListPath = '~/../content/data/json/da/body-views/1/BodySystem_' + $rootScope.systemNumber + '.json';
2841 2841 var grayImageDataVar = null;
2842 2842  
2843   - DataService.getJson(matchedTermListPath)
  2843 + // DataService.getJson(matchedTermListPath)
  2844 + TermService.getTermData($scope.layerNumber, $rootScope.voId, $rootScope.systemNumber, $rootScope.zoomInOut)
  2845 +
2844 2846 .then(
2845 2847 function (result) {
2846 2848 console.log('1. HighlightBodyByTermListForBodySystem is called');
... ... @@ -3036,7 +3038,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
3036 3038  
3037 3039 });
3038 3040  
3039   - }
  3041 + // }
3040 3042 }
3041 3043  
3042 3044  
... ...
400-SOURCECODE/AIAHTML5.Web/app/services/TermService.js 0 → 100644
  1 +AIA.factory('TermService', function ($http, $q) {
  2 + return {
  3 + getTermData: function (layerNo, BodyViewId, systemNo, zoomLevel) {
  4 +
  5 + var deferred = $q.defer();
  6 + //var URL = 'http://localhost:86/api/PixelLocations?layerNumber=' + layerNo + '&bodyViewIndex=' + BodyViewId + '&systemNumber=' + systemNo + '&zoomLevel=' + zoomLevel + ''
  7 + var URL = '/API/api/PixelLocations?layerNumber=' + layerNo + '&bodyViewIndex=' + BodyViewId + '&systemNumber=' + systemNo + '&zoomLevel=' + zoomLevel + ''
  8 +
  9 + $http({
  10 + method: 'get',
  11 + url: URL,
  12 + headers: {
  13 + 'Content-Type': 'application/json',
  14 + }
  15 +
  16 + })
  17 + .success(function (data, status, headers, config) {
  18 +
  19 + console.log('success')
  20 + deferred.resolve(data);
  21 + }).error(function (data, status, headers, config) {
  22 + console.log('error status= ' + status)
  23 + deferred.reject(status);
  24 + });
  25 + return deferred.promise;
  26 + },
  27 + }
  28 +})
0 29 \ No newline at end of file
... ...
400-SOURCECODE/AIAHTML5.Web/index.html
... ... @@ -1433,6 +1433,7 @@
1433 1433 <script src="app/services/ModuleService.js"></script>
1434 1434  
1435 1435 <script src="app/services/DataService.js"></script>
  1436 + <script src="app/services/TermService.js"></script>
1436 1437 <script src="libs/jquery/jquery_plugin/jqueryui.js"></script>
1437 1438  
1438 1439 <script src="libs/jquery/jquery_plugin/color-picker/jquery.minicolors.min.js"></script>
... ...