diff --git a/api/index.php b/api/index.php index ace25a44c..6d18071ea 100644 --- a/api/index.php +++ b/api/index.php @@ -71,7 +71,8 @@ function setupApplication($mode): Slim $facility_courier_countries, $facility_courier_countries_nde, $facility_courier_countries_link, $dhl_enable, $scale_grid, $scale_grid_end_date, $preset_proposal, $timezone, $valid_components, $enabled_container_types, $ifsummary, $synchweb_version, $redirects, - $shipping_service_app_url, $use_shipping_service_redirect, $use_shipping_service_redirect_incoming_shipments; + $shipping_service_app_url, $use_shipping_service_redirect, $use_shipping_service_redirect_incoming_shipments, + $dials_rest_url; $app->contentType('application/json'); $options = $app->container['options']; $app->response()->body(json_encode(array( @@ -95,6 +96,7 @@ function setupApplication($mode): Slim 'synchweb_version' => $synchweb_version, 'shipping_service_app_url' => $use_shipping_service_redirect || $use_shipping_service_redirect_incoming_shipments ? $shipping_service_app_url : null, 'shipping_service_app_url_incoming' => $use_shipping_service_redirect_incoming_shipments ? $shipping_service_app_url : null, + 'dials_rest_url' => $dials_rest_url, 'redirects' => $redirects ))); }); diff --git a/client/src/js/modules/dc/views/imageviewer.js b/client/src/js/modules/dc/views/imageviewer.js index f28f488d1..cefd08ec9 100644 --- a/client/src/js/modules/dc/views/imageviewer.js +++ b/client/src/js/modules/dc/views/imageviewer.js @@ -79,10 +79,10 @@ define(['jquery', 'marionette', 'slidechange @ui.zoom': 'slideChangeZoom', 'keypress @ui.num': 'keyPressNum', - 'click @ui.res': 'doThreshold', - 'click @ui.ice': 'doThreshold', + 'click @ui.res': 'doIceOrRes', + 'click @ui.ice': 'doIceOrRes', 'click @ui.invert': 'doInvert', - 'click @ui.threshold': 'doThreshold', + 'click @ui.threshold': 'reloadImage', 'click button[name=next]': 'next', 'click button[name=prev]': 'prev', @@ -407,6 +407,11 @@ define(['jquery', 'marionette', this.ctx.setTransform(this.scalef,0,0,this.scalef,this.offsetx,this.offsety) var r = this.detectVerticalSquash(this.img) this.ctx.drawImage(this.img, 0, 0, this.width, this.height/r) + + if (!app.options.get("dials_rest_url")) { + if (this.ui.res.is(':checked')) this._draw_res_rings() + if (this.ui.ice.is(':checked')) this._draw_ice_rings() + } }, @@ -441,9 +446,9 @@ define(['jquery', 'marionette', // Apply image adjustments adjust: function() { if (this.brightness == 0 && this.contrast == 0 && !(this.invert_change || this.ui.invert.is(':checked'))) return - + this.c.revert() - if (this.ui.invert.is(':checked')) { + if (this.invert_change) { this.c.invert() //_plot_profiles(lastx, lasty) } @@ -469,7 +474,36 @@ define(['jquery', 'marionette', this.c.reloadCanvasData() this.c.resetOriginalPixelData() }, - + + + + // Draw ice rings + _draw_ice_rings: function() { + var rings = [3.897, 3.669,3.441,2.671,2.249,2.07,1.95,1.92,1.88,1.72] + + this.ctx.strokeStyle='blue'; + for (var i = 0; i < rings.length; i++) { + this.ctx.beginPath(); + var rad = this._res_to_dist(rings[i])/this.ps*this.imscale + this.ctx.arc(this.model.get('XBEAM')/this.ps*this.imscale,this.model.get('YBEAM')/this.ps*this.imscale,rad,0,2*Math.PI); + this.ctx.stroke(); + } + }, + + // Draw resolution rings + _draw_res_rings: function() { + this.ctx.strokeStyle = 'black'; + this.ctx.font = this.imscale < 1 ? '10px Arial' : '30px Arial'; + + for (var i = 0; i < 5; i++) { + var rad = (((this.height-10)/2)/5)*(i+1) + this.ctx.beginPath(); + this.ctx.arc(this.model.get('XBEAM')/this.ps*this.imscale,this.model.get('YBEAM')/this.ps*this.imscale,rad,0,2*Math.PI); + this.ctx.stroke(); + this.ctx.fillText(this._dist_to_res(rad*this.ps/this.imscale).toFixed(2) + 'A',this.model.get('XBEAM')/this.ps*this.imscale-(this.low ? 10 : 40 ),this.model.get('YBEAM')/this.ps*this.imscale-rad+(this.low ? 10 : 40)); + } + }, + // Plot spot profile _plot_profiles: function(xp, yp) { @@ -760,7 +794,15 @@ define(['jquery', 'marionette', this._dra() }, - doThreshold: function() { + doIceOrRes: function() { + if (app.options.get("dials_rest_url")) { + this.reloadImage() + } else { + this._dra() + } + }, + + reloadImage: function() { this.load(this.n) }