From ac165cb02f835b803e07466a0e336abb40d2447e Mon Sep 17 00:00:00 2001 From: nikita Date: Thu, 9 Jun 2016 15:31:59 +0530 Subject: [PATCH] gender change functionality is implemented in DA. --- 400-SOURCECODE/AIAHTML5.Web/AIAHTML5.Web.csproj | 2 +- 400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------ 2 files changed, 60 insertions(+), 31 deletions(-) diff --git a/400-SOURCECODE/AIAHTML5.Web/AIAHTML5.Web.csproj b/400-SOURCECODE/AIAHTML5.Web/AIAHTML5.Web.csproj index 68af0de..41d01af 100644 --- a/400-SOURCECODE/AIAHTML5.Web/AIAHTML5.Web.csproj +++ b/400-SOURCECODE/AIAHTML5.Web/AIAHTML5.Web.csproj @@ -21339,8 +21339,8 @@ + - diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index f6e1f2c..fbf7a84 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -2487,45 +2487,74 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.OnGenderChange = function (event) { - debugger; + // debugger; //use $scope.correspondingBodyViewIds for getting correspnding viewid - alert('gender changed= ' + event.currentTarget.attributes[1].value) - if (event.currentTarget.attributes[1].value == 'Male') { - if (localStorage.getItem("genderId") == 'Male') { + // alert('gender changed= ' + event.currentTarget.attributes[1].value) + if ((event.currentTarget.attributes[1].value == 'Male') && (localStorage.getItem("genderId") == 'Female')) { + + localStorage.setItem("genderId", 'Male'); - } - else { - switch ($scope.voId) { - case 1: - $scope.voId = 5; - break; - } + $scope.changeGender() - $scope.CalculateImageCordinates($scope.viewOrientationId) - } } - else if (event.currentTarget.attributes[1].value == 'Female') { - if (localStorage.getItem("genderId") == 'Male') { - switch ($scope.voId) { - case "1": - $scope.voId = "5"; - break; - } + + else if ((event.currentTarget.attributes[1].value == 'Female') && (localStorage.getItem("genderId") == 'Male')) { + + localStorage.setItem("genderId", 'Female'); - var canDiv = document.getElementById('canvasDiv'); - var canDivChildCount = canDiv.childElementCount; - if (canDivChildCount > 0) { - canDiv.innerHTML = ''; - } - //load corresponding json files - $scope.CalculateImageCordinates($scope.viewOrientationId) + $scope.changeGender() + - } - else { - } } + + } + + + +$scope.changeGender = function(){ + + var currentBodyViewId = $scope.correspondingBodyViewIds[$scope.voId]; + $scope.voId = currentBodyViewId; + + var layerJsonPath = '~/../content/data/json/da/bodyView/' + currentBodyViewId + '/da_dat_layer_' + currentBodyViewId + '.json'; + + DataService.getJson(layerJsonPath) + .then( + function (result) { + //debugger; + + $scope.BodyLayerData = result; + $scope.isBodylayerdataLoaded = true; + + //load json for annotations + // $http({ method: 'GET', url: '~/../content/data/json/da_dat_tm_sg_1.json' }).success(function (data) { + var termJsonPath = '~/../content/data/json/da/bodyView/' + currentBodyViewId + '/da_dat_tm_sg_' + currentBodyViewId + '.json' ; + DataService.getAnotherJson(termJsonPath) + .then( + function (result) { + $scope.TermNumberData = result; + + var canDiv = document.getElementById('canvasDiv'); + var canDivChildCount = canDiv.childElementCount; + if (canDivChildCount > 0) { + canDiv.innerHTML = ''; + } + $scope.CalculateImageCordinates($scope.viewOrientationId); + }, + function (error) { + // handle errors here + console.log(' $scope.TermNumberData= ' + error.statusText); + } + ) + }, + + function (error) { + // handle errors here + console.log(' $scope.BodyLayerData= ' + error.statusText); } +); +} }] -- libgit2 0.21.4