diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
index dcf29f2..122fab9 100644
--- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
+++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
@@ -310,197 +310,244 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
//da-body-views functions
$scope.openBodyView = function () {
- //debugger;
+
+ //1.
$rootScope.isLoading = true;
$rootScope.voId = localStorage.getItem("currentBodyViewId");;
- //load bodyRegion data
- var brViewdata = DataService.getJson('~/../content/data/json/da/da_dat_brview.json')
+ //2. load bodyRegion data
+ var bodyRegionjsonPath = '~/../content/data/json/da/da_dat_brview.json';
+
+ var brViewdata = DataService.getJson(bodyRegionjsonPath)
+
+ var layerJsonPath = null;
+
brViewdata.then(
function (result) {
- // debugger;
+
$rootScope.BodyRegionData = result;
$scope.isBodyRegionDataLoaded = true;
- // alert('da_dat_brview= ' + result)
+
+ //3.
+ $scope.loadLayerDataForCurrentBodyView();
- var currentBodyViewId = localStorage.getItem("currentBodyViewId");
- var layerJsonPath = '';
- var bgArtJsonPath = '';
- var CommonViewId = 0;
+ },
+ function (error) {
- layerJsonPath = '~/../content/data/json/da/body-views/' + currentBodyViewId + '/da_dat_layer_' + currentBodyViewId + '.json';
+ //1.
+ console.log('DATA.NOT.LOADED FOR: ' + bodyRegionjsonPath + ' , ERROR:' + error.statusText);
+ //2.
+ $scope.openBodyView();
+ }
+ );
- DataService.getAnotherJson(layerJsonPath)
- .then(
- function (result) {
- //debugger;
+ // debugger
+ $('#daBodyview').css("height", $(window).outerHeight());
- $rootScope.BodyLayerData = result;
- $scope.isBodylayerdataLoaded = true;
+ $('#daBodyview').css("width", $(window).outerWidth());
+ }
- //load json for annotations
- // $http({ method: 'GET', url: '~/../content/data/json/da_dat_tm_sg_1.json' }).success(function (data) {
- $http({ method: 'GET', url: '~/../content/data/json/da/body-views/' + currentBodyViewId + '/da_dat_tm_sg_' + currentBodyViewId + '.json' }).success(function (data) {
- $scope.TermNumberData = data;
+ angular.element(document).ready(function () {
- var path = '~/../content/data/json/da/vocab/english/cm_dat_vocabterm_1.json';
- $http({ method: 'GET', url: path }).success(function (data) {
- $scope.VocabTermData = data;
+ })
- var vocabTermTxt = [];
- angular.forEach($scope.TermNumberData.TermData.Term, function (value1, key1) {
- angular.forEach($scope.VocabTermData.VocabTerms.Term, function (value2, key2) {
- //debugger;
- if (value1._ActualTermNumber === value2._ActualTermNumber) {
- vocabTermTxt.push(
- {
- "_ActualTermNumber": value2._ActualTermNumber,
- "_TermText": value2._TermText,
- "_cdId": value2._cdId
- }
- );
- }
- })
+ $scope.loadLayerDataForCurrentBodyView = function () {
+ //1.
+ var bgArtJsonPath = '';
+ var CommonViewId = 0;
+ var currentBodyViewId = localStorage.getItem("currentBodyViewId");
- })
- $scope.VocabTermTxt = new jinqJs()
- .from(vocabTermTxt)
- .distinct('_TermText', '_ActualTermNumber')
- .orderBy([{ field: '_TermText', sort: 'asc' }])
- .select('_ActualTermNumber', '_TermText', '_cdId');
+ //2.
+ var layerJsonPath = '~/../content/data/json/da/body-views/' + currentBodyViewId + '/da_dat_layer_' + currentBodyViewId + '.json';
+ DataService.getAnotherJson(layerJsonPath)
+ .then(
+ function (result) {
-
- $scope.currentTitleFromJson = localStorage.getItem("currentViewTitleFromJson");
+ $rootScope.BodyLayerData = result;
+ $scope.isBodylayerdataLoaded = true;
- })
- .error(function (data, status, headers, config) {
- console.log(data);
- });
- })
- .error(function (data, status, headers, config) {
- console.log(data);
- });
+ //3. load Json for annotation
+ $scope.loadTermData();
-
- var openViews;
-
-
- // debugger;
- if ($rootScope.openViews.length > 0)
- {
- openViews = new jinqJs()
- .from($rootScope.openViews)
- .where("BodyViewId==" + currentBodyViewId)
- .select();
- }
- var counter = 1;
-
- // var tittle = $rootScope.ViewTitle;
- var tittle = localStorage.getItem("currentViewTitleFromJson");
-
- if (openViews != null && openViews!=undefined) {
- angular.forEach(openViews, function (value, key) {
-
- if (value.body - views == tittle) {
- tittle = localStorage.getItem("currentViewTitleFromJson") + counter++;
- $rootScope.currentActiveViewTitle = tittle;
- localStorage.setItem("currentViewTitle", tittle);
- }
-
- });
- }
- else {
- localStorage.setItem("currentViewTitle", tittle);
- }
-
-
- $.jsPanel({
- id: 'daImagePanel',
- selector: '.daBodyView',
- theme: 'success',
- currentController: 'DAController',
- parentSlug: 'da-view-list',
- ajax: {
- url: 'app/views/da/da-view.html'
- },
- title: localStorage.getItem("currentViewTitle"),
- position: {
- top: 70,
- left: 1,
- },
-
- size: { width: $(window).outerWidth() - 10, height: $(window).outerHeight() - 110 },
+ var openViews;
- });
+ if ($rootScope.openViews != null || $rootScope.openViews != undefined) {
+ if ($rootScope.openViews.length > 0) {
+ openViews = new jinqJs()
+ .from($rootScope.openViews)
+ .where("BodyViewId==" + currentBodyViewId)
+ .select();
+ }
+ }
+ var counter = 1;
+ //4. getting corresponding body view title
+ var tittle = localStorage.getItem("currentViewTitleFromJson");
- // $rootScope.openViewsDA.push({ "ViewId": 1 });
- $rootScope.currentSlug = 'da-body-view';
+ if (openViews != null && openViews != undefined) {
+ angular.forEach(openViews, function (value, key) {
- //hide scrollbar
+ if (value.body - views == tittle)
+ {
+ tittle = localStorage.getItem("currentViewTitleFromJson") + counter++;
+ $rootScope.currentActiveViewTitle = tittle;
+ localStorage.setItem("currentViewTitle", tittle);
+ }
+ });
+ }
+ else {
+ localStorage.setItem("currentViewTitle", tittle);
+ }
- $rootScope.openViews.push(
- {
- "module": $rootScope.currentActiveModuleTitle, "body-views": tittle, "state": 'max', "BodyViewId": $rootScope.currentBodyViewId,
- "slug": $rootScope.currentSlug
- }
- );
- // debugger;
+ //5. adding jsPannel on daBodyviewElement.
+ $.jsPanel({
+ id: 'daImagePanel',
+ selector: '.daBodyView',
+ theme: 'success',
+ currentController: 'DAController',
+ parentSlug: 'da-view-list',
+ ajax: {
+ url: 'app/views/da/da-view.html'
+ },
+ title: localStorage.getItem("currentViewTitle"),
+ position: {
+ top: 70,
+ left: 1,
+ },
+
+ size: { width: $(window).outerWidth() - 10, height: $(window).outerHeight() - 110 },
- var e1 = angular.element(document.getElementById("daBodyview"));
- $timeout(function () { $compile(e1.contents())($scope) }, 250);
- // $compile(e1.contents())($scope);
+ });
- $('#daBodyview').css("height", $(window).outerHeight());
+ //5.1
+ $rootScope.currentSlug = 'da-body-view';
- $('#daBodyview').css("width", $(window).outerWidth());
+ //5.2
+ $rootScope.openViews.push(
+ {
+ "module": $rootScope.currentActiveModuleTitle, "body-views": tittle, "state": 'max', "BodyViewId": $rootScope.currentBodyViewId,
+ "slug": $rootScope.currentSlug
+ }
+ );
+
+ //5.3
+ var daBodyviewElement = angular.element(document.getElementById("daBodyview"));
- // debugger
- if ($scope.isBodylayerdataLoaded) {
- $timeout(function () {
+ $timeout(function () { $compile(daBodyviewElement.contents())($scope) }, 250);
- //1.this is for showing termlist on da-view
- $scope.isVisibleTermddl = false;
+
+ //5.4 added some stylesheets
+ $('#daBodyview').css("height", $(window).outerHeight());
- //2. Load Canvas Image
- $scope.LoadDefaultLayerImage();
+ $('#daBodyview').css("width", $(window).outerWidth());
- //3. Load Navigator Image
- $scope.LoadBodyViewNavigatorImage();
+
+ if ($scope.isBodylayerdataLoaded == true) {
+ $timeout(function () {
- }, 350);
- }
- },
- function (error) {
- // handle errors here
- console.log(' $rootScope.BodyLayerData= ' + error.statusText);
- }
- );
- },
- function (error) {
- // handle errors here
- console.log(' $rootScope.BodyRegionData = ' + error.statusText);
- }
- );
+ //1.this is for showing termlist on da-view
+ $scope.isVisibleTermddl = false;
- // debugger
- $('#daBodyview').css("height", $(window).outerHeight());
+ //2. Load Canvas Image
+ $scope.LoadDefaultLayerImage();
+
+ //3. Load Navigator Image
+ $scope.LoadBodyViewNavigatorImage();
+
+ }, 350);
+ }
+ },
+ function (error) {
+
+ //1.
+ console.log('DATA.NOT.LOADED FOR: ' + layerJsonPath +' , ERROR:' + error.statusText);
+
+ //2.
+ $scope.loadLayerDataForCurrentBodyView();
+
+
+ }
+ );
- $('#daBodyview').css("width", $(window).outerWidth());
}
- angular.element(document).ready(function () {
- })
+ $scope.loadTermData = function () {
+ var currentBodyViewId = localStorage.getItem("currentBodyViewId");
+
+ var termNoJsonPath = '~/../content/data/json/da/body-views/' + currentBodyViewId + '/da_dat_tm_sg_' + currentBodyViewId + '.json';
+ $http({ method: 'GET', url: termNoJsonPath })
+ .success(function (data) {
+ $scope.TermNumberData = data;
+
+ //5.
+ $scope.loadTermTextData();
+
+ })
+ .error(function (data, status, headers, config) {
+
+ //1.
+ console.log('DATA.NOT.LOADED FOR: ' + termNoJsonPath + ' , ERROR:' + data);
+
+ //2.
+ $scope.loadTermData();
+
+ });
+
+ }
+
+ $scope.loadTermTextData =function()
+ {
+ var termTextJsonPath = '~/../content/data/json/da/vocab/english/cm_dat_vocabterm_1.json';
+ $http({ method: 'GET', url: termTextJsonPath })
+ .success(function (data) {
+ $scope.VocabTermData = data;
+
+ var vocabTermTxt = [];
+ angular.forEach($scope.TermNumberData.TermData.Term, function (value1, key1) {
+ angular.forEach($scope.VocabTermData.VocabTerms.Term, function (value2, key2) {
+ //debugger;
+ if (value1._ActualTermNumber === value2._ActualTermNumber) {
+ vocabTermTxt.push(
+ {
+ "_ActualTermNumber": value2._ActualTermNumber,
+ "_TermText": value2._TermText,
+ "_cdId": value2._cdId
+ }
+ );
+ }
+ })
+
+ })
+
+ $scope.VocabTermTxt = new jinqJs()
+ .from(vocabTermTxt)
+ .distinct('_TermText', '_ActualTermNumber')
+ .orderBy([{ field: '_TermText', sort: 'asc' }])
+ .select('_ActualTermNumber', '_TermText', '_cdId');
+
+
+ $scope.currentTitleFromJson = localStorage.getItem("currentViewTitleFromJson");
+
+ })
+ .error(function (data, status, headers, config) {
+
+ //1.
+ console.log('DATA.NOT.LOADED FOR:' +termTextJsonPath);
+
+ //2.
+ $scope.loadTermTextData();
+ });
+ }
//Code for displaying NavigatorImage for BodyView
$scope.LoadBodyViewNavigatorImage = function () {
@@ -605,7 +652,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
//calculate coordinates for body region images
- $scope.CalculateImageCordinates = function (viewOrientationId) {
+ $scope.CalculateImageCordinates = function (viewOrientationId)
+ {
+ var drawnBodyRegionCount = [];
if ($rootScope.MaskCanvasData != null || $rootScope.MaskCanvasData != undefined) {
var n = $rootScope.MaskCanvasData.length;
@@ -4320,7 +4369,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
//2.
$scope.CalculateImageCordinates($scope.viewOrientationId);
-
+
}
//3.