'
@@ -176,45 +199,43 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
$rootScope.ClearIframe();
-<<<<<<< HEAD
- //load body-views data
-=======
- //load body-view data
->>>>>>> f02adb91be9d04918a612b7ac16241017c20e360
- $http({ method: 'GET', url: '~/../content/data/json/da/da_dat_contentlist.json' }).success(function (data) {
+ //load common data
+ var commondataJsonPath = '~/../content/data/json/da/da_dat_common.json';
- $scope.BodyViewData = data;
- //load default body view list for male
- $scope.getDAViewList();
+ DataService.getAnotherJson(commondataJsonPath)
+ .then(
+ function (result) {
- })
+ $rootScope.CommonData = result;
+ $http({ method: 'GET', url: '~/../content/data/json/da/da_dat_contentlist.json' }).success(function (data) {
+
+ $scope.BodyViewData = data;
+ //load default body view list for male
+ $scope.getDAViewList();
+
+ })
.error(function (data, status, headers, config) {
console.log(data);
});
+ },
+ function (error) {
+ console.log(error.statusText)
+ }
+ )
+ //load body-views data
+
+
// $('#daLoaderLabel').css('visibility', 'hidden')
$rootScope.isLoading = false;
- $http({ method: 'GET', url: '~/../content/data/json/da_dat_tm_sg_1.json' }).success(function (data) {
- $scope.TermNumberData = data;
-
- })
- .error(function (data, status, headers, config) {
- console.log(data);
- });
- //load vocabterm data
- $http({ method: 'GET', url: '~/../content/data/json/cm_dat_vocabterm_1.json' }).success(function (data) {
- $scope.VocabTermData = data;
- })
- .error(function (data, status, headers, config) {
- console.log(data);
- });
-
//push the details of open module in array $rootScope.openModules
$rootScope.openModules.push({ "ModuleId": 1 });
+
+
}
@@ -310,7 +331,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
selector: '.daBodyView',
theme: 'success',
currentController: 'DAController',
- parentSlug:'da-view-list',
+ parentSlug: 'da-view-list',
ajax: {
url: 'app/views/da/da-view.html'
},
@@ -327,7 +348,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
// $rootScope.openViewsDA.push({ "ViewId": 1 });
- $rootScope.currentSlug = 'da-body-views';
+ $rootScope.currentSlug = 'da-body-view';
//hide scrollbar
@@ -377,9 +398,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
})
-
-
-
$scope.LoadDefaultLayerImage = function () {
// debugger;
@@ -622,7 +640,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
//multiple conditions are not working in where clause of JinQ so need multiple filtered variables
if (dtlOfSktn.length > 0) {
- if ((parseInt(dtlOfSktn[0]._lns) <= parseInt($scope.layerNumber)) && (parseInt(dtlOfSktn[0]._lne) >= parseInt($scope.layerNumber)) && (dtlOfSktn[0]._isfr == 'Y')) {
+ if ((parseInt(dtlOfSktn[0]._lns) <= parseInt($scope.layerNumber)) && (parseInt(dtlOfSktn[0]._lne) > parseInt($scope.layerNumber)) && (dtlOfSktn[0]._isfr == 'Y')) {
$scope.figLaefImageName = dtlOfSktn[0]._ImageId;
//$scope.figLaefX = filtereddata[0]._X;
//$scope.figLaefY = filtereddata[0]._Y;
@@ -630,11 +648,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
var rectangle = scaleRectangle(value._X, value._Y, value._Height, value._Width, value._MirrorValue);
-<<<<<<< HEAD
- var src = "content/images/DA/body-views/" + $scope.voId + "/layers/0/" + value._BodyRegionId + "/" + $scope.figLaefImageName;
-=======
- var src = "content/images/da/body-views/" + $scope.voId + "/layers/0/" + value._BodyRegionId + "/" + $scope.figLaefImageName;
->>>>>>> f02adb91be9d04918a612b7ac16241017c20e360
+ var src = "content/images/DA/" + $scope.zoomInOut + "/body-views/" + $scope.voId + "/layers/0/" + value._BodyRegionId + "/" + $scope.figLaefImageName;
$scope.DrawImage(rectangle.scaledHeight, rectangle.scaledWidth, rectangle.scaledX, rectangle.scaledY, src, 'modestyImg' + value._BodyRegionId, 'N')
@@ -673,11 +687,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
// $('#canvasDiv').scrollLeft($scope.imageHorizontlScrollPosition)
$('#canvasDiv').scrollTop(50)
var abc = $scope.BodyRegionCordinatesData;
-<<<<<<< HEAD
//debugger;
-=======
- // debugger;
->>>>>>> f02adb91be9d04918a612b7ac16241017c20e360
$('#layerChangeSlider').slider("option", "value", parseInt($scope.totalLayers) - parseInt($scope.layerNumber));
// $('#spinner').css('visibility', 'hidden');
$rootScope.isLoading = false;
@@ -740,11 +750,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
//set max for LayerNumber input
$scope.totalLayers = dataLength - 1;
-<<<<<<< HEAD
// debugger
-=======
- // debugger
->>>>>>> f02adb91be9d04918a612b7ac16241017c20e360
$('#txtLayerNumber').attr('max', $scope.totalLayers);
$('#layerChangeSlider').slider("option", "max", $scope.totalLayers);
// $('#layerChangeSlider').slider("option", "value",parseInt($scope.totalLayers)-parseInt($scope.layerNumber));
@@ -764,7 +770,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
if (bodyRegion == bodyRegionId && bodyRegionSkinTone == $scope.skinTone) {
- return "content/images/DA/"+$scope.zoomInOut +"/body-views/" + $scope.voId + "/layers/" + $scope.layerNumber + "/" + bodyRegionId + "/" + $scope.skinTone + "/" + SelectedLayerData.BodyRegion[z].Image._ImageName;
+ return "content/images/DA/" + $scope.zoomInOut + "/body-views/" + $scope.voId + "/layers/" + $scope.layerNumber + "/" + bodyRegionId + "/" + $scope.skinTone + "/" + SelectedLayerData.BodyRegion[z].Image._ImageName;
}
}
}
@@ -786,7 +792,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
if (bodyRegion == bodyRegionId) {
return "content/images/DA/" + $scope.zoomInOut + "/body-views/" + $scope.voId + "/layers/" + $scope.layerNumber + "/" + bodyRegionId + "/" + SelectedLayerData.BodyRegion[z].Image._ImageName;
-
+
}
}
@@ -822,7 +828,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
for (var z = 0; z <= $scope.bagartDetailsOnSktn.length; z++) {
var gender = $scope.bagartDetailsOnSktn[z]._Gender;
if (gender == selectedGender) {
- return "content/images/DA/"+$scope.zoomInOut+"/body-views/" + $scope.voId + "/layers/0/" + bodyRegionId + "/" + $scope.skinTone + "/" + $scope.bagartDetailsOnSktn[z]._ImageId;
+ return "content/images/DA/" + $scope.zoomInOut + "/body-views/" + $scope.voId + "/layers/0/" + bodyRegionId + "/" + $scope.skinTone + "/" + $scope.bagartDetailsOnSktn[z]._ImageId;
}
}
}
@@ -843,6 +849,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
FlipedImgCanvas.style.left = x + "px";
FlipedImgCanvas.style.top = y + "px";
+
+
if (isMaskImage == 'Y') {
FlipedImgCanvas.id = 'imageCanvas' + bodyRegionId + '_MR_mci';
FlipedImgCanvas.style.visibility = 'hidden'
@@ -853,21 +861,35 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
FlipedImgCanvas.style.visibility = 'visible'
}
+
+
+
FlipedImgCanvas.addEventListener('click', function (evt) {
+<<<<<<< HEAD
+
+=======
+ if (evt.ctrlKey) {
+ $scope.multiAnnotationIsON = true;
+ }
+ else {
+ $scope.multiAnnotationIsON = false;
+ }
+
+>>>>>>> 06cddfd0f16578a9c42e80367bb28ee0cede2c3e
//get mouse coordinate of mirror image click
var mousePos = $scope.getMousePos(evt);
- //alert(mousePos.x + ',' + mousePos.y);
var context = FlipedImgCanvas.getContext("2d");
var canvasId = context.canvas.getAttribute('id');
+
var mirrorCanvasX = context.canvas.offsetLeft;
var mirrorCanvasWidth = context.canvas.clientWidth;
var maskCanvasId = (canvasId.replace('_MR', '')) + '_mci';
var maskCanvas = document.getElementById(maskCanvasId);
- var canvasContextForRGB = maskCanvas.getContext("2d");
+ var maskCanvasContext = maskCanvas.getContext("2d");
var canvasDiv = document.getElementById('canvasDiv');
@@ -876,15 +898,13 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
var distanceXOnMirrorImage = (parseInt(mirrorCanvasX) + parseInt(mirrorCanvasWidth)) - (parseInt(mousePos.x) + horizontlScrollPosition);// - 135);
- var mirrorXOnNormalImage = parseInt(canvasContextForRGB.canvas.offsetLeft) + parseInt(distanceXOnMirrorImage);
+ var mirrorXOnNormalImage = parseInt(maskCanvasContext.canvas.offsetLeft) + parseInt(distanceXOnMirrorImage);
var actulalX = mirrorXOnNormalImage
var actualY = mousePos.y + verticalScrollPosition
-
-
- var pixelData = canvasContextForRGB.getImageData(Math.round(actulalX - parseInt(canvasContextForRGB.canvas.offsetLeft)), Math.round(actualY - y), 1, 1);
+ var pixelData = maskCanvasContext.getImageData(Math.round(actulalX - parseInt(maskCanvasContext.canvas.offsetLeft)), Math.round(actualY - y), 1, 1);
pixelData.data[0] = pixelData.data[0] - 9;
pixelData.data[1] = pixelData.data[1] - 9;
@@ -917,23 +937,90 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
}
var RGBColor = (Red + Green + Blue);
+ if ($rootScope.isHighLight) {
+ ////2. Find Actul Term No Based on Icolor.
+ //var ActualTermNo = $scope.getActualTermNumber(RGBColor);
+ ////alert('actual term no: ' + ActualTermNo);
+
+ ////3. Find Term No List Based on ActualTermNo
+ //var TermList = $scope.getTermNumberList(ActualTermNo);
+ //// alert('termList.count: ' + TermList.length);
+
+ ////4.
+
+ //$scope.machedTermNoLocation = [];
+ //for (var i = 0; i < TermList.length; i++) {
+
+ // var termNumber = parseInt(TermList[i]._TermNumber);
+
+ // //Match Term No List in each bodyRegion
+ // $scope.getLocationsForMatchedTermsInWholeBody(termNumber);
+ //}
+
+ if ($scope.machedIcolorInBodyRegion.length > 0) {
+ if ($scope.multiAnnotationIsON == false) {
+ for (var i = 0; i < $scope.machedIcolorInBodyRegion.length; i++) {
+ var bodyRegionId = $scope.machedIcolorInBodyRegion[i];
+
+ var grayCanvasID = 'imageCanvas' + bodyRegionId;
+ var grayCanvas = document.getElementById(grayCanvasID);
+
+ var grayCanvasContext = grayCanvas.getContext("2d");
+
+ var grayImageData = $rootScope.grayImageDataList[bodyRegionId - 1];
+
+ grayCanvasContext.putImageData(grayImageData, 0, 0)
+
+ // for mirrored canvas
+
+ if (bodyRegionId == 4 || bodyRegionId == 5 || bodyRegionId == 6) {
+ var grayCanvasID = 'imageCanvas' + bodyRegionId + '_MR';
+ var grayCanvasMR = document.getElementById(grayCanvasID);
+
+ var grayCanvasContextMR = grayCanvasMR.getContext("2d");
+
+ var grayImageDataMR = $rootScope.grayImageMRDataList[bodyRegionId];
+
+ grayCanvasContextMR.putImageData(grayImageDataMR, 0, 0)
+ }
+
+ }
+ }
+ }
+
+ $scope.highLightBodyBasedOnIcolor(RGBColor);
+ }
+
var annotationText = $scope.GetAnnotationText(parseInt(RGBColor));
if ($('#speechBubbleTrns').length > 0)
$('#speechBubbleTrns').remove();
- if ($('#speechBubble').length > 0) {
- $('#speechBubble').remove();
+ if ($scope.multiAnnotationIsON == true) {
- $scope.createSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50)
+ $scope.createDynamicSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top);
}
- else
- $scope.createSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50)
+ else {
+
+ if ($('#dot').length > 0) {
+ $('#dot').remove();
+ }
+
+ if ($('#sppeachBubble').length > 0) {
+ $('#sppeachBubble').remove();
+
+ $scope.createDynamicSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top);
+ }
+ else {
+
+ $scope.createDynamicSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top);
+ }
+ }
}, false);
FlipedImgCanvas.addEventListener('mousedown', function (evt) {
@@ -983,7 +1070,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
$scope.DrawImage = function (h, w, x, y, src, bodyRegionId, isMaskImage) {
- // debugger;
var imgCanvas = document.createElement('canvas');
// imgCanvas.style.backgroundColor = 'red';
imgCanvas.height = h;
@@ -1015,14 +1101,21 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
//set z index to make leaf canvas on top of hip canavs
imgCanvas.style.zIndex = "200";
}
- if ($scope.voId == 11 && bodyRegionId == 6) {
+ if (($scope.voId == 11 || $scope.voId == 9) && bodyRegionId == 6) {
imgCanvas.style.zIndex = "500";
}
}
- imgCanvas.addEventListener('click', function (evt) {
+ imgCanvas.addEventListener('click', function (evt) {
+ if (evt.ctrlKey) {
+ $scope.multiAnnotationIsON = true;
+ }
+ else {
+ $scope.multiAnnotationIsON = false;
+ }
+ var annotationText;
var context = imgCanvas.getContext("2d");
@@ -1036,9 +1129,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
maskCanvasId = canvasId + '_mci';
}
var maskCanvas = document.getElementById(maskCanvasId);
- var canvasContextForRGB = maskCanvas.getContext("2d");
-
+ var maskCanvasContext = maskCanvas.getContext("2d");
+ //if ($scope.zoomInOut == 25) {
+ // var mousePos = $scope.getMousePos1(evt);
+ //}
+ //else
var mousePos = $scope.getMousePos(evt);
// alert(mousePos.x + ',' + mousePos.y);
@@ -1051,14 +1147,123 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
var actulalX = mousePos.x + horizontlScrollPosition;
var actualY = mousePos.y + verticalScrollPosition;
- //debugger;
- var RGBColor = $scope.GetRGBColor(canvasContextForRGB, actulalX, actualY, x, y);
- var annotationText;
+
+ var RGBColor = $scope.GetRGBColor(maskCanvasContext, actulalX, actualY, x, y);
+
+<<<<<<< HEAD
+ if ($rootScope.isHighLight) {
+ if ($scope.machedBodyRegion.length > 0) {
+ if ($scope.multiAnnotationIsON == false) {
+ for (var i = 0; i < $scope.machedBodyRegion.length; i++) {
+ var bodyRegionId = $scope.machedBodyRegion[i];
+=======
+ if ($rootScope.isHighLight)
+ {
+ if ($scope.machedIcolorInBodyRegion.length > 0)
+ {
+ if ($scope.multiAnnotationIsON == false)
+ {
+ for (var i = 0; i < $scope.machedIcolorInBodyRegion.length; i++)
+ {
+ var bodyRegionId = $scope.machedIcolorInBodyRegion[i];
+>>>>>>> 06cddfd0f16578a9c42e80367bb28ee0cede2c3e
+
+ var grayCanvasID = 'imageCanvas' + bodyRegionId;
+ var grayCanvas = document.getElementById(grayCanvasID);
+
+ var grayCanvasContext = grayCanvas.getContext("2d");
+
+ var grayImageData = $rootScope.grayImageDataList[bodyRegionId - 1];
+
+ grayCanvasContext.putImageData(grayImageData, 0, 0)
+
+ // for unhighlight the mirrored body region
+ if (bodyRegionId == 4 || bodyRegionId == 5 || bodyRegionId == 6) {
+ var grayCanvasID = 'imageCanvas' + bodyRegionId + '_MR';
+ var grayCanvasMR = document.getElementById(grayCanvasID);
+
+ var grayCanvasContextMR = grayCanvasMR.getContext("2d");
+
+ var grayImageDataMR = $rootScope.grayImageMRDataList[bodyRegionId];
+
+ grayCanvasContextMR.putImageData(grayImageDataMR, 0, 0)
+ }
+
+ }
+ }
+ }
+
+ // var IcolorWithCordinate = new Object;
+ var previousIcolor = RGBColor;
+ //var previousX;
+ // var previousY;
+
+ //IcolorWithCordinate.previousIcolor= RGBColor;
+ // IcolorWithCordinate.previousX = x;
+ // IcolorWithCordinate.previousY = y;
+
+ $scope.previousSelectedTermList.push(previousIcolor);
+
+ $scope.highLightBodyBasedOnIcolor(RGBColor);
+
+ //var ActualTermNo = $scope.getActualTermNumber(RGBColor);
+ ////3. Find Term No List Based on ActualTermNo
+ //var TermList = $scope.getTermNumberList(ActualTermNo);
+ //// alert('termList.count: ' + TermList.length);
+
+ ////4.
+
+ //$scope.machedTermNoLocation = [];
+ //for (var i = 0; i < TermList.length; i++) {
+
+ // var termNumber = parseInt(TermList[i]._TermNumber);
+
+ // //Match Term No List in each bodyRegion
+ // $scope.getLocationsForMatchedTermsInWholeBody(termNumber, x, y);
+ //}
+
+ }
+
+ else {
+ $scope.highLightBodyBasedOnIcolor(RGBColor);
+
+<<<<<<< HEAD
+ ////2. Find Actul Term No Based on Icolor.
+ //var ActualTermNo = $scope.getActualTermNumber(RGBColor);
+=======
+ else
+ {
+ // $scope.highLightBodyBasedOnIcolor(RGBColor);
+>>>>>>> 06cddfd0f16578a9c42e80367bb28ee0cede2c3e
+
+ ////3. Find Term No List Based on ActualTermNo
+ //var TermList = $scope.getTermNumberList(ActualTermNo);
+
+
+ ////4.
+
+ //$scope.machedTermNoLocation = [];
+ //for (var i = 0; i < TermList.length; i++) {
+
+ // var termNumber = parseInt(TermList[i]._TermNumber);
+
+ // //Match Term No List in each bodyRegion
+ // $scope.getLocationsForMatchedTermsInWholeBody(termNumber, x, y);
+ //}
+ }
+
+
+
+
+ //Modesty ON
if (maskCanvasId.match('modestyImg') && RGBColor != '000000') {
RGBColor = DA[0].figLeafTermId;
annotationText = $scope.GetAnnotationBasedOnActualTermNo(RGBColor);
}
+ //Modesty On but clicked somewhre else, we did modesty check because the modesty image covers whole body region so if user will click to
+ //see the annotation apart from leaf then the actual click will be on modesty canvas, but for annotation er
+ //
else if (maskCanvasId.match('modestyImg') && RGBColor == '000000') {
//if ($scope.voId == 11) {
// maskCanvasId = 'imageCanvas6_mci';
@@ -1070,66 +1275,263 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
maskCanvasId = 'imageCanvas' + bodyRegionId + '_mci';
// }
var maskCanvas = document.getElementById(maskCanvasId);
- var canvasContextForRGB = maskCanvas.getContext("2d");
- RGBColor = $scope.GetRGBColor(canvasContextForRGB, actulalX, actualY, x, y);
+ var maskCanvasContext = maskCanvas.getContext("2d");
+ RGBColor = $scope.GetRGBColor(maskCanvasContext, actulalX, actualY, x, y);
annotationText = $scope.GetAnnotationText(parseInt(RGBColor));
}
else {
- RGBColor = $scope.GetRGBColor(canvasContextForRGB, actulalX, actualY, x, y);
+ RGBColor = $scope.GetRGBColor(maskCanvasContext, actulalX, actualY, x, y);
annotationText = $scope.GetAnnotationText(parseInt(RGBColor));
}
+
if ($('#speechBubbleTrns').length > 0)
$('#speechBubbleTrns').remove();
- if ($('#speechBubble').length > 0) {
- $('#speechBubble').remove();
+ if ($scope.multiAnnotationIsON == true) {
- $scope.createSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50)
+ $scope.createDynamicSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top);
}
- else
- $scope.createSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50)
+ else {
+ if ($('#dot').length > 0) {
+ $('#dot').remove();
+ if ($('#sppeachBubble').length > 0) {
+ $('#sppeachBubble').remove();
+ }
+
- }, false);
+ $scope.createDynamicSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top);
+ }
+ else {
+ $scope.createDynamicSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top);
+ }
+ }
+ }, false);
+
var PI = Math.PI;
var PI2 = PI * 2;
var cw, ch, imgW, imgH, mouseX, mouseY;
var scaleFactor = 1.00;
- //$scaler = $("#scaler");
- //$scaler.val(scaleFactor);
- //$scaler.hide();
-
var context = imgCanvas.getContext('2d');
var img = new Image();
img.onload = start;
img.src = src;
- // img.src = img.src = "~/../content/images/" + src;
-
function start() {
// debugger;
context.drawImage(img, 0, 0);
};
- // $('#daLoaderLabel').css('visibility', 'visible')
-
- // $rootScope.isLoading = true;
document.getElementById('canvasDiv').appendChild(imgCanvas);
}
- $scope.GetRGBColor = function (canvasContextForRGB, actulalX, actualY, x, y) {
+ $scope.highLightBodyBasedOnIcolor = function (RGBColor) {
+
+ //2. Find Actul Term No Based on Icolor.
+ var ActualTermNo = $scope.getActualTermNumber(RGBColor);
+
+ //3. Find Term No List Based on ActualTermNo
+ var TermList = $scope.getTermNumberList(ActualTermNo);
+
+
+ //4.
+
+ $scope.machedTermNoLocation = [];
+ for (var i = 0; i < TermList.length; i++) {
+
+ var termNumber = parseInt(TermList[i]._TermNumber);
+
+ //Match Term No List in each bodyRegion
+ $scope.getLocationsForMatchedTermsInWholeBody(termNumber);
+ }
+ }
+
+ $scope.getLocationsForMatchedTermsInWholeBody = function (termNo) {
+
+ for (var x = 0; x < $scope.ColoredImageSRC.length; x++) {
+ // alert('called for bodyRegionId: ' + $scope.MaskImageSRC[x].bodyRegionId);
+ var bodyRegionId = $scope.ColoredImageSRC[x].bodyRegionId;
+
+ {
+ var scaledWidth = $scope.ColoredImageSRC[x].Width;
+ var scaledHeight = $scope.ColoredImageSRC[x].Height;
+ //var maskImg = $scope.ColoredImageSRC[x].SRC;
+
+
+ var coloredImg = $scope.ColoredImageSRC[x].SRC;
+
+ var maskImg = $scope.GetMaskImageSource(coloredImg);
+
+
+ var scledX = $scope.ColoredImageSRC[x].x;
+ var scledY = $scope.ColoredImageSRC[x].y;
+
+
+ // 1. get mask canvas for this body region.
+ var maskCanvasID;
+ if ($scope.ColoredImageSRC[x].haveMirror == 'true') {
+ maskCanvasID = 'imageCanvas' + bodyRegionId + '_MR_mci';
+ }
+ else {
+ maskCanvasID = 'imageCanvas' + bodyRegionId + '_mci';
+
+ }
+ var maskCanvas = document.getElementById(maskCanvasID);
+ var maskCanvasContext = maskCanvas.getContext("2d");
+ debugger;
+ var maskImgData = maskCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight);
+
+ // 2. get coloured canvas for this body region.
+
+
+ var coloredImageDataVar;
+ var coloredImageDataMRVar
+
+ if ($scope.ColoredImageSRC[x].haveMirror == 'true') {
+
+ coloredImageDataVar = $rootScope.coloredImageMRCanvasList[parseInt(bodyRegionId)];
+ }
+ else {
+ coloredImageDataVar = $rootScope.coloredImageCanvasList[parseInt(bodyRegionId - 1)];
+ }
+ var grayImageDataVar;
+ var grayCanvas;
+ if ($scope.ColoredImageSRC[x].haveMirror == 'true') {
+
+ //// 3. get mask canvas for this body region._MR
+ var grayCanvasID = 'imageCanvas' + bodyRegionId + '_MR';
+ grayCanvas = document.getElementById(grayCanvasID);
+ var grayCanvasContext = grayCanvas.getContext("2d");
+ var grayImageData = grayCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight);
+ grayImageDataVar = grayImageData.data;
+ }
+
+ else {
+ var grayCanvasID = 'imageCanvas' + bodyRegionId;
+ grayCanvas = document.getElementById(grayCanvasID);
+ var grayCanvasContext = grayCanvas.getContext("2d");
+ var grayImageData = grayCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight);
+ grayImageDataVar = grayImageData.data;
+ }
+
+ var coloredImageDataVarMR;
+ var coloredImageDataMR
+
+
+ var counter = 0;
+
+ var imageDataVar = maskImgData.data;
+
+ // var previousBRID;
+
+ var counter = 0;
+
+
+ var n = maskImgData.data.length;
+
+ for (var i = 0; i < n; i += 4) {
+
+
+ var RED = imageDataVar[i] - 9;
+ var GREEN = imageDataVar[i + 1] - 9;
+ var BLUE = imageDataVar[i + 2] - 9;
+
+ var Red;
+ var Green;
+ var Blue;
+ var zero = "0";
+
+ if ((RED).toString().length != 2) {
+ Red = zero.concat((RED).toString())
+ }
+ else {
+ Red = (RED).toString()
+ }
+ if ((GREEN).toString().length != 2) {
+ Green = zero.concat((GREEN).toString())
+ }
+ else {
+ Green = (GREEN).toString()
+
+ }
+ if ((BLUE).toString().length != 2) {
+ Blue = zero.concat((BLUE).toString())
+ }
+ else {
+ Blue = (BLUE).toString()
+
+ }
+
+ var Icolor = (Red + Green + Blue);
+ // alert('Icolor: ' + Icolor)
+
+ if (parseInt(termNo) == parseInt(Icolor)) {
+
+ counter++;
+ var have = $scope.machedIcolorInBodyRegion.indexOf(bodyRegionId);
+
+
+<<<<<<< HEAD
+ if (have == -1) {
+ $scope.machedBodyRegion.push(bodyRegionId);
+=======
+ if (have == -1)
+ {
+ $scope.machedIcolorInBodyRegion.push(bodyRegionId);
+>>>>>>> 06cddfd0f16578a9c42e80367bb28ee0cede2c3e
+ }
+ else {
+
+ }
+
+
+ //previousGrayColoredData = i;
+ if (coloredImageDataVar != null) {
+
+
+ var RED_coloredImage = coloredImageDataVar[i];
+
+ grayImageDataVar[i] = RED_coloredImage;
+
+
+ var GREEN_coloredImage = coloredImageDataVar[i + 1];
+ grayImageDataVar[i + 1] = GREEN_coloredImage;
+
+ var BLUE_coloredImage = coloredImageDataVar[i + 2];
+ grayImageDataVar[i + 2] = BLUE_coloredImage;
+
+
+ var ALPHA_coloredImage = coloredImageDataVar[i + 3];
+ grayImageDataVar[i + 3] = ALPHA_coloredImage;
+
+
+ }
+
+ }
+
+
+ }
+
+ grayCanvasContext.putImageData(grayImageData, 0, 0);
+ }
+ }
+
+
+ }
+
+ $scope.GetRGBColor = function (maskCanvasContext, actulalX, actualY, x, y) {
- var pixelData = canvasContextForRGB.getImageData(Math.round(actulalX - x), Math.round(actualY - y), 1, 1);
+ var pixelData = maskCanvasContext.getImageData(Math.round(actulalX - x), Math.round(actualY - y), 1, 1);
pixelData.data[0] = pixelData.data[0] - 9;
pixelData.data[1] = pixelData.data[1] - 9;
@@ -1218,6 +1620,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
//layer change function
$scope.LayerChange = function () {
+ // alert('layer chnage')
+
var canvasDiv = document.getElementById('canvasDiv');
$scope.imageVerticalScrollPosition = canvasDiv.scrollTop;
$scope.imageHorizontlScrollPosition = canvasDiv.scrollLeft;
@@ -1228,6 +1632,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
if ($scope.isTransparencyActivated) {
+
//crete temp canavs to store the original data which will be used to chnange the transparency
if (document.getElementById('tempCanvas') != null) {
$('#tempCanvas').remove();
@@ -1281,6 +1686,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
// alert(' $.each(BodyRegionDictionary3. bodyRegionRight: ' + bodyRegionRight + ', bodyRegionBottom: ' + bodyRegionBottom)
if (TransparencyBoxStartX <= bodyRegionRight && value.X <= transparencyBoxRight && TransparencyBoxStartY <= bodyRegionBottom && value.Y <= transparencyBoxBottom) {
//var transNumber = parseInt(document.getElementById("txtTransparencyChange").value);
+ // debugger;
$scope.layerNumber = parseInt(txtlayerNumber.value);
@@ -1292,6 +1698,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
}
else {
+ $scope.currentLayerNumber = parseInt($('#txtlayerNumber').val());
$rootScope.isLoading = true;
$('#spinner').css('visibility', 'visible');
@@ -1317,6 +1724,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
$timeout(function () { $scope.highLightBody() }, 350);
+
+
}
}
@@ -1330,7 +1739,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
//alert('Disabled wait cursor is done.See val :' + $rootScope.isLoading);
}
-
+
$scope.changeLayer = function () {
console.log('changeLayer');
// alert('slide')
@@ -1353,6 +1762,175 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
}
}
+ $scope.createDynamicSpeechBubble = function (event, text, x, y) {
+
+ if (event.ctrlKey) {
+
+ $scope.multiAnnotationIsON = true;
+
+ $scope.i = $scope.i + 1;
+ // var a = $("#sppeachBubble").find('span').html();
+ // alert(a);
+ var sub_id = "black" + $scope.i;
+ $("#canvasDiv").append("
");
+
+
+ $scope.speachBubbleArray.push({ xaxis: x, yaxis: y, ids: sub_id });
+
+ $('.appendDragg').draggable({
+ drag: function (evt) {
+ $(this).prev('div').css("display", "none");
+ var bor_id = $(this).next('div').attr('id');
+ var sub_id1 = $(this).attr('id');
+ var verticalScrollPosition = canvasDiv.scrollTop;
+ var horizontlScrollPosition = canvasDiv.scrollLeft;
+ for (var m = 0; m <= $scope.speachBubbleArray.length - 1; m++) {
+ if ($scope.speachBubbleArray[m].ids == sub_id1) {
+
+ $scope.angle1($scope.speachBubbleArray[m].xaxis, $scope.speachBubbleArray[m].yaxis, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, bor_id);
+ break;
+
+ }
+ }
+
+ },
+ });
+
+
+
+ $('.dynCross').on('click', function (evt) {
+ $(this).parent().parent().parent().css('display', 'none');
+
+ // $("#bord").css("display", "none");
+ // $("#dot").css("display", "none");
+
+
+ });
+
+
+ }
+
+
+ else {
+ $scope.multiAnnotationIsON = false;
+
+ $(".com").css("display", "none");
+ $("#bord").css({ "width": "0px", "display": "none" });
+<<<<<<< HEAD
+ $('
'
+ + '
' + text + ''
+=======
+
+ $('
'
+ + '
'+text+''
+>>>>>>> 06cddfd0f16578a9c42e80367bb28ee0cede2c3e
+ + '
'
+ + '
'
+
+ + '
'
+ + '
').appendTo('#canvasDiv');
+ var Globe = [];
+ Globe.push({ currentX: x, currentY: y });
+
+ document.getElementById('dot').style.display = 'block';
+ document.getElementById('dot').style.left = ((Globe[0].currentX) - 10) + 'px';
+ document.getElementById('dot').style.top = ((Globe[0].currentY) + 10) + 'px';
+ document.getElementById('sppeachBubble').style.display = 'block';
+ document.getElementById('sppeachBubble').style.left = (Globe[0].currentX) + 'px';
+ document.getElementById('sppeachBubble').style.top = (Globe[0].currentY) + 'px';
+
+ $('#sppeachBubble').draggable(
+ {
+ drag: function (evt) {
+
+ $("#dot").css("display", "none");
+ var verticalScrollPosition = canvasDiv.scrollTop;
+ var horizontlScrollPosition = canvasDiv.scrollLeft;
+ $scope.angle(x, y, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top);
+
+
+ },
+ });
+
+
+ $('.crossDiv_temp').on('click', function (evt) {
+ $('#sppeachBubble').css('display', 'none');
+
+ $("#bord").css("display", "none");
+ $("#dot").css("display", "none");
+
+
+ });
+
+ }
+
+
+ }
+
+ $scope.angle1 = function (cx1, cy1, ex1, ey1, id, id2) {
+
+ console.log(cx1 + " " + cy1);
+ var dy = ey1 - cy1;
+ var dx = ex1 - cx1;
+ var theta = 0;
+ if (dx < 0) {
+ theta = Math.atan(dy / dx) * (180 / Math.PI);
+ theta = theta + 180;
+
+ }
+ else if (dy < 0) {
+ theta = Math.atan(dy / dx) * (180 / Math.PI);
+ theta = theta + 360;
+
+ }
+ else {
+ theta = Math.atan(dy / dx) * (180 / Math.PI);
+ }
+
+ var g = Math.sqrt((cx1 - ex1) * (cx1 - ex1) + (cy1 - ey1) * (cy1 - ey1));
+ var e = cy1 - 19;
+ var f = cx1;
+
+ $('#' + id).css({ 'display': 'block', 'width': g + 'px', 'top': e + 'px', 'left': f + 'px', 'transform': 'rotate(' + theta + 'deg)', '-moz-transform': 'rotate(' + theta + 'deg)', '-webkit-transform': 'rotate(' + theta + 'deg)', 'transform-origin': '0% 0%' });
+
+ }
+
+ function myFunction(crossId) {
+ alert(crossId);
+ $('#' + crossId).parent().parent().parent().css("display", "none");
+
+ }
+
+
+ $scope.angle = function (cx, cy, ex, ey) {
+
+
+ var dy = ey - cy;
+ var dx = ex - cx;
+ var theta = 0;
+ if (dx < 0) {
+ theta = Math.atan(dy / dx) * (180 / Math.PI);
+ theta = theta + 180;
+
+ }
+ else if (dy < 0) {
+ theta = Math.atan(dy / dx) * (180 / Math.PI);
+ theta = theta + 360;
+
+ }
+ else {
+ theta = Math.atan(dy / dx) * (180 / Math.PI);
+ }
+
+ var d = Math.sqrt((cx - ex) * (cx - ex) + (cy - ey) * (cy - ey));
+ var e = cy;
+ var f = cx;
+
+ $("#bord").css({ 'display': 'block', 'width': d + 'px', 'top': e + 'px', 'left': f + 'px', 'transform': 'rotate(' + theta + 'deg)', '-moz-transform': 'rotate(' + theta + 'deg)', '-webkit-transform': 'rotate(' + theta + 'deg)', 'transform-origin': '0% 0%' });
+
+
+ }
+
$scope.createSpeechBubble = function (event, text, x, y) {
//set z index to make annoation speech buble on top others
@@ -1363,7 +1941,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
//+'
+ '