Skip to content

Commit

Permalink
Lymphocyte App - maintain location and zoom level between applications
Browse files Browse the repository at this point in the history
  • Loading branch information
ajasniew committed Aug 10, 2017
1 parent ab9c5c5 commit 0cddd73
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 1 deletion.
29 changes: 29 additions & 0 deletions js/annotationtools/ToolBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -450,10 +450,39 @@ ToolBar.prototype.createButtons = function () {
window.location.href = "/select.php";
});

/*
this.lymphbutton.on('click', function () {
var tissueId = this.iid;
window.location.href = "/camicroscope/osdCamicroscope_Lymph.php?tissueId=" + tissueId;
}.bind(this))
*/

this.lymphbutton.on('click', function () {
var tissueId = this.iid;
var x1 = annotool.imagingHelper._viewportOrigin['x'];
var y1 = annotool.imagingHelper._viewportOrigin['y'];
var x2 = x1 + annotool.imagingHelper._viewportWidth;
var y2 = y1 + annotool.imagingHelper._viewportHeight;
var zoom = viewer.viewport.getZoom();

var width, height;
//get image width and height
var url = 'api/Data/getImageInfoByCaseID.php?case_id=' + tissueId;
//console.log(url);
jQuery.get(url, function (data) {
//console.log(data);
try {
this_image = JSON.parse(data);
width = this_image[0].width;
height = this_image[0].height;
var x = parseInt(((x1 + x2) / 2.0) * width);
var y = parseInt(((y1 + y2) / 2.0) * height);
window.location.href = "/camicroscope/osdCamicroscope_Lymph.php?tissueId=" + tissueId + "&x=" + x + "&y=" + y + "&zoom=" + zoom;
} catch (error) {
window.location.href = "/camicroscope/osdCamicroscope_Lymph.php?tissueId=" + tissueId;
}
})
}.bind(this))

this.compositebutton.on('click', function () {
this.mode = 'composite';
Expand Down
31 changes: 30 additions & 1 deletion js/annotationtoolslymph/ToolBar_Lymph.js
Original file line number Diff line number Diff line change
Expand Up @@ -459,10 +459,39 @@ ToolBar.prototype.createButtons = function () {
window.location.href = "/select.php";
}.bind(this))

/*
this.micbutton.on('click', function(){
window.location.href = "/camicroscope/osdCamicroscope.php?tissueId=" + this.iid;
}.bind(this))

*/


this.micbutton.on('click', function () {
var tissueId = this.iid;
var x1 = annotool.imagingHelper._viewportOrigin['x'];
var y1 = annotool.imagingHelper._viewportOrigin['y'];
var x2 = x1 + annotool.imagingHelper._viewportWidth;
var y2 = y1 + annotool.imagingHelper._viewportHeight;
var zoom = viewer.viewport.getZoom();
var width,height;

//get image width and height
var url = 'api/Data/getImageInfoByCaseID.php?case_id=' + tissueId;
jQuery.get(url, function (data) {
//console.log(data);
try {
this_image = JSON.parse(data);
width = this_image[0].width;
height = this_image[0].height;
var x= parseInt(((x1+x2)/2.0)*width);
var y= parseInt(((y1+y2)/2.0)*height);
window.location.href = "/camicroscope/osdCamicroscope.php?tissueId=" + tissueId + "&x=" + x + "&y=" + y + "&zoom=" + zoom;
} catch (error){
window.location.href = "/camicroscope/osdCamicroscope.php?tissueId=" + tissueId;
}
})
}.bind(this))

this.hidebutton.on('click', function () {
this.annotools.toggleMarkups()
}.bind(this))
Expand Down
1 change: 1 addition & 0 deletions osdCamicroscope_Lymph.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ function addOverlays() {
var bound_x = <?php echo json_encode($_GET['x']); ?>;
var bound_y = <?php echo json_encode($_GET['y']); ?>;
var zoom = <?php echo json_encode($_GET['zoom']); ?> || viewer.viewport.getMaxZoom();
zoom =Number(zoom); //convert zoom to number if it is string

jQuery("#panel").hide();
jQuery("#weightpanel").hide();
Expand Down

0 comments on commit 0cddd73

Please sign in to comment.