Commit ac165cb02f835b803e07466a0e336abb40d2447e
1 parent
9223e6d0
gender change functionality is implemented in DA.
Showing
2 changed files
with
60 additions
and
31 deletions
400-SOURCECODE/AIAHTML5.Web/AIAHTML5.Web.csproj
... | ... | @@ -21339,8 +21339,8 @@ |
21339 | 21339 | </ItemGroup> |
21340 | 21340 | <ItemGroup> |
21341 | 21341 | <Folder Include="app\filters\directives\" /> |
21342 | + <Folder Include="content\data\json\da\bodyView\NewFolder1\" /> | |
21342 | 21343 | <Folder Include="content\images\DA\BodyViews\4\layers\329\6\" /> |
21343 | - <Folder Include="content\images\DA\BodyViews\NewFolder1\" /> | |
21344 | 21344 | <Folder Include="content\js\script\" /> |
21345 | 21345 | <Folder Include="Properties\" /> |
21346 | 21346 | </ItemGroup> | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
... | ... | @@ -2487,45 +2487,74 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
2487 | 2487 | |
2488 | 2488 | |
2489 | 2489 | $scope.OnGenderChange = function (event) { |
2490 | - debugger; | |
2490 | + // debugger; | |
2491 | 2491 | //use $scope.correspondingBodyViewIds for getting correspnding viewid |
2492 | - alert('gender changed= ' + event.currentTarget.attributes[1].value) | |
2493 | - if (event.currentTarget.attributes[1].value == 'Male') { | |
2494 | - if (localStorage.getItem("genderId") == 'Male') { | |
2492 | + // alert('gender changed= ' + event.currentTarget.attributes[1].value) | |
2493 | + if ((event.currentTarget.attributes[1].value == 'Male') && (localStorage.getItem("genderId") == 'Female')) { | |
2494 | + | |
2495 | + localStorage.setItem("genderId", 'Male'); | |
2495 | 2496 | |
2496 | - } | |
2497 | - else { | |
2498 | - switch ($scope.voId) { | |
2499 | - case 1: | |
2500 | - $scope.voId = 5; | |
2501 | - break; | |
2502 | - } | |
2497 | + $scope.changeGender() | |
2503 | 2498 | |
2504 | - $scope.CalculateImageCordinates($scope.viewOrientationId) | |
2505 | - } | |
2506 | 2499 | } |
2507 | - else if (event.currentTarget.attributes[1].value == 'Female') { | |
2508 | - if (localStorage.getItem("genderId") == 'Male') { | |
2509 | - switch ($scope.voId) { | |
2510 | - case "1": | |
2511 | - $scope.voId = "5"; | |
2512 | - break; | |
2513 | - } | |
2500 | + | |
2501 | + else if ((event.currentTarget.attributes[1].value == 'Female') && (localStorage.getItem("genderId") == 'Male')) { | |
2502 | + | |
2503 | + localStorage.setItem("genderId", 'Female'); | |
2514 | 2504 | |
2515 | - var canDiv = document.getElementById('canvasDiv'); | |
2516 | - var canDivChildCount = canDiv.childElementCount; | |
2517 | - if (canDivChildCount > 0) { | |
2518 | - canDiv.innerHTML = ''; | |
2519 | - } | |
2520 | - //load corresponding json files | |
2521 | 2505 | |
2522 | - $scope.CalculateImageCordinates($scope.viewOrientationId) | |
2506 | + $scope.changeGender() | |
2507 | + | |
2523 | 2508 | |
2524 | - } | |
2525 | - else { | |
2526 | - } | |
2527 | 2509 | } |
2510 | + | |
2511 | + } | |
2512 | + | |
2513 | + | |
2514 | + | |
2515 | +$scope.changeGender = function(){ | |
2516 | + | |
2517 | + var currentBodyViewId = $scope.correspondingBodyViewIds[$scope.voId]; | |
2518 | + $scope.voId = currentBodyViewId; | |
2519 | + | |
2520 | + var layerJsonPath = '~/../content/data/json/da/bodyView/' + currentBodyViewId + '/da_dat_layer_' + currentBodyViewId + '.json'; | |
2521 | + | |
2522 | + DataService.getJson(layerJsonPath) | |
2523 | + .then( | |
2524 | + function (result) { | |
2525 | + //debugger; | |
2526 | + | |
2527 | + $scope.BodyLayerData = result; | |
2528 | + $scope.isBodylayerdataLoaded = true; | |
2529 | + | |
2530 | + //load json for annotations | |
2531 | + // $http({ method: 'GET', url: '~/../content/data/json/da_dat_tm_sg_1.json' }).success(function (data) { | |
2532 | + var termJsonPath = '~/../content/data/json/da/bodyView/' + currentBodyViewId + '/da_dat_tm_sg_' + currentBodyViewId + '.json' ; | |
2533 | + DataService.getAnotherJson(termJsonPath) | |
2534 | + .then( | |
2535 | + function (result) { | |
2536 | + $scope.TermNumberData = result; | |
2537 | + | |
2538 | + var canDiv = document.getElementById('canvasDiv'); | |
2539 | + var canDivChildCount = canDiv.childElementCount; | |
2540 | + if (canDivChildCount > 0) { | |
2541 | + canDiv.innerHTML = ''; | |
2542 | + } | |
2543 | + $scope.CalculateImageCordinates($scope.viewOrientationId); | |
2544 | + }, | |
2545 | + function (error) { | |
2546 | + // handle errors here | |
2547 | + console.log(' $scope.TermNumberData= ' + error.statusText); | |
2548 | + } | |
2549 | + ) | |
2550 | + }, | |
2551 | + | |
2552 | + function (error) { | |
2553 | + // handle errors here | |
2554 | + console.log(' $scope.BodyLayerData= ' + error.statusText); | |
2528 | 2555 | } |
2556 | +); | |
2557 | +} | |
2529 | 2558 | |
2530 | 2559 | }] |
2531 | 2560 | ... | ... |