@@ -26,7 +26,7 @@ class SpecMeas;
2626class PeakModel ;
2727class InterSpec ;
2828struct ColorTheme ;
29- class RefLineKinetic ;
29+ class RefLineDynamic ;
3030
3131namespace Wt
3232{
@@ -78,9 +78,9 @@ class D3SpectrumDisplayDiv : public Wt::WContainerWidget
7878 void setCompactAxis ( const bool compact );
7979 bool isAxisCompacted () const ;
8080
81- Wt::Signal<double /* keV*/ ,double /* counts*/ ,int /* pageX*/ ,int /* pageY*/ > &chartClicked ();
82- Wt::Signal<double /* kev*/ ,double /* counts*/ ,int /* pageX*/ ,int /* pageY*/ > &rightClicked ();
83- Wt::Signal<double /* keV*/ ,double /* counts*/ ,std::string/* ref-line number */ > &doubleLeftClick ();
81+ Wt::Signal<double /* keV*/ ,double /* counts*/ ,int /* pageX*/ ,int /* pageY*/ ,std::string /* ref-line name */ > &chartClicked ();
82+ Wt::Signal<double /* kev*/ ,double /* counts*/ ,int /* pageX*/ ,int /* pageY*/ ,std::string /* ref-line name */ > &rightClicked ();
83+ Wt::Signal<double /* keV*/ ,double /* counts*/ ,std::string/* ref-line name */ > &doubleLeftClick ();
8484 Wt::Signal<double /* keV start*/ ,double /* keV end*/ > &shiftKeyDragged ();
8585
8686 /* * When a previously existing ROI gets dragged by its edge, this signal will be emitted as it
@@ -283,6 +283,23 @@ class D3SpectrumDisplayDiv : public Wt::WContainerWidget
283283 /* * Fills just the y-range of the chart, below the data. */
284284 BelowData
285285 };// enum class HighlightRegionFill
286+
287+ /* * Reference line thickness options. */
288+ enum class RefLineThickness : int
289+ {
290+ Light = 0 , // /< Light Lines: width=0.5, hover=1.0
291+ Normal = 1 , // /< Normal Lines: width=1.0, hover=2.0 (default)
292+ Thick = 2 , // /< Thick Lines: width=2.0, hover=3.0
293+ Thicker = 3 // /< Thicker Lines: width=3.0, hover=5.0
294+ };// enum class RefLineThickness
295+
296+ /* * Reference line verbosity options for extension lines. */
297+ enum class RefLineVerbosity : int
298+ {
299+ None = 0 , // /< No extension lines shown
300+ OnHover = 1 , // /< Extension lines shown only on hover
301+ MajorAlways = 2 // /< Major lines always show extensions, all lines show on hover
302+ };// enum class RefLineVerbosity
286303
287304 size_t addDecorativeHighlightRegion ( const float lowerx,
288305 const float upperx,
@@ -359,19 +376,37 @@ class D3SpectrumDisplayDiv : public Wt::WContainerWidget
359376 // should be shown for the line that the mouse is currently over. Default is
360377 // to show the information.
361378 void setShowRefLineInfoForMouseOver ( const bool show );
379+
380+ /* * Sets the width of reference lines. Default is 1 for normal width, 2 for hover width. */
381+ void setRefLineWidths ( const double width, const double hoverWidth );
382+
383+ /* * Sets reference line thickness from RefLineThickness enum. */
384+ void setRefLineThickness ( const RefLineThickness thickness );
385+
386+ /* * Gets the line widths for a given RefLineThickness enum value. */
387+ static std::pair<double ,double > getRefLineWidths ( const RefLineThickness thickness );
388+
389+ /* * Callback for RefLineThickness preference changes (takes int parameter). */
390+ void handleRefLineThicknessPreferenceChangeCallback ( int thickness );
391+
392+ /* * Sets reference line verbosity from RefLineVerbosity enum. */
393+ void setRefLineVerbosity ( const RefLineVerbosity verbosity );
394+
395+ /* * Callback for RefLineVerbosity preference changes (takes int parameter). */
396+ void handleRefLineVerbosityPreferenceChangeCallback ( int verbosity );
362397
363- /* * To avoid duplicate calculations of kinetic reference lines, the `RefLineKinetic ` class will notify this class
364- that it has updates, by calling the `scheduleRenderKineticRefLine ()` function; this will also trigger a render
365- update for this class. Then in the render function for this class, it will call back into RefLineKinetic , to have it do the
366- calculations and give the results to this class (see #m_kineticRefLines and #m_kineticRefLinesJsFwhmFcn ), to then be
398+ /* * To avoid duplicate calculations of dynamic reference lines, the `RefLineDynamic ` class will notify this class
399+ that it has updates, by calling the `scheduleRenderDynamicRefLine ()` function; this will also trigger a render
400+ update for this class. Then in the render function for this class, it will call back into RefLineDynamic , to have it do the
401+ calculations and give the results to this class (see #m_dynamicRefLines and #m_dynamicRefLinesJsFwhmFcn ), to then be
367402 sent to the client.
368403 */
369- void setKineticRefLineController ( RefLineKinetic *kinetic );
404+ void setDynamicRefLineController ( RefLineDynamic *dynamic );
370405
371- /* * Marks it so this class will call the `RefLineKinetic ` instance to give this class the updated lines, on the next render cycle,
406+ /* * Marks it so this class will call the `RefLineDynamic ` instance to give this class the updated lines, on the next render cycle,
372407 and mark that this instance needs to be rendered.
373408 */
374- void scheduleRenderKineticRefLine ();
409+ void scheduleRenderDynamicRefLine ();
375410
376411 /* * Set the reference lines that update as you move the mouse.
377412
@@ -382,7 +417,7 @@ class D3SpectrumDisplayDiv : public Wt::WContainerWidget
382417 If this widget is rendered, then lines are also put to `doJavaScript(...)` immediately during this call; if not rendered, then will wait until
383418 the render cycle to do this.
384419 */
385- void setKineticRefernceLines ( std::vector<std::pair<double ,ReferenceLineInfo>> &&ref_lines,
420+ void setDynamicRefernceLines ( std::vector<std::pair<double ,ReferenceLineInfo>> &&ref_lines,
386421 std::string &&js_fwhm_fcnt );
387422
388423 /* * Highlights a peak, at the specified energy, as if you had moused over it.
@@ -429,7 +464,7 @@ class D3SpectrumDisplayDiv : public Wt::WContainerWidget
429464
430465 void setReferenceLinesToClient ();
431466
432- void setKineticRefLinesToClient ();
467+ void setDynamicRefLinesToClient ();
433468
434469 virtual void render ( Wt::WFlags<Wt::RenderFlag> flags );
435470
@@ -448,7 +483,7 @@ class D3SpectrumDisplayDiv : public Wt::WContainerWidget
448483
449484 UpdateRefLines = 0x40 ,
450485
451- UpdateKineticRefLines = 0x80
486+ UpdateDynamicRefLines = 0x80
452487 // ToDo: maybe add a few other things to this mechanism.
453488 };// enum D3RenderActions
454489
@@ -510,10 +545,15 @@ class D3SpectrumDisplayDiv : public Wt::WContainerWidget
510545 std::unique_ptr<Wt::JSignal<double , double > > m_shiftKeyDraggJS;
511546 std::unique_ptr<Wt::JSignal<double , double > > m_shiftAltKeyDraggJS;
512547 std::unique_ptr<Wt::JSignal<double , double > > m_rightMouseDraggJS;
513- /* * The double left-click std::string is the ReferenceLine name (including for kinetic ref lines) cooresponding to what the mouse is over at click time. */
548+ /* * The rel-line name std::string below is the ReferenceLine (including for dynamic ref lines) cooresponding to what the mouse is over at click time.
549+ It will be empty if no line was actively showing its info, or else it will be the line cooresponding to the JS `SpectrumChartD3.mousedOverRefLine` variable.
550+
551+ The name of the reference lines (e.g., "U238", "H(n,g)") _may_ be followed by a semicolon, then information about the specific line.
552+ E.x. "Th232;S.E. of 2614.5 keV"
553+ */
514554 std::unique_ptr<Wt::JSignal<double , double , std::string> > m_doubleLeftClickJS;
515- std::unique_ptr<Wt::JSignal<double ,double ,double /* pageX*/ ,double /* pageY*/ > > m_leftClickJS;
516- std::unique_ptr<Wt::JSignal<double ,double ,double /* pageX*/ ,double /* pageY*/ > > m_rightClickJS;
555+ std::unique_ptr<Wt::JSignal<double ,double ,double /* pageX*/ ,double /* pageY*/ ,std::string /* ref-line name */ > > m_leftClickJS;
556+ std::unique_ptr<Wt::JSignal<double ,double ,double /* pageX*/ ,double /* pageY*/ ,std::string /* ref-line name */ > > m_rightClickJS;
517557 /* * Currently including chart area in pixels in xRange changed from JS; this
518558 size in pixels is only approximate, since chart may not have been totally layed out
519559 and rendered when this signal was emmitted.
@@ -539,9 +579,9 @@ class D3SpectrumDisplayDiv : public Wt::WContainerWidget
539579 Wt::Signal<double ,double > m_shiftKeyDragg;
540580 Wt::Signal<double ,double > m_shiftAltKeyDragg;
541581 Wt::Signal<double ,double > m_rightMouseDragg;
542- Wt::Signal<double ,double ,int /* pageX*/ ,int /* pageY*/ > m_leftClick;
582+ Wt::Signal<double ,double ,int /* pageX*/ ,int /* pageY*/ ,std::string /* ref-line name */ > m_leftClick;
543583 Wt::Signal<double ,double ,std::string /* ref-line name*/ > m_doubleLeftClick;
544- Wt::Signal<double ,double ,int /* pageX*/ ,int /* pageY*/ > m_rightClick;
584+ Wt::Signal<double ,double ,int /* pageX*/ ,int /* pageY*/ ,std::string /* ref-line name */ > m_rightClick;
545585
546586 Wt::Signal<double /* new roi lower energy*/ ,
547587 double /* new roi upper energy*/ ,
@@ -568,10 +608,9 @@ class D3SpectrumDisplayDiv : public Wt::WContainerWidget
568608 void chartShiftKeyDragCallback ( double x0, double x1 );
569609 void chartShiftAltKeyDragCallback ( double x0, double x1 );
570610 void chartRightMouseDragCallback ( double x0, double x1 );
571- void chartLeftClickCallback ( double x, double y, double pageX, double pageY );
611+ void chartLeftClickCallback ( double x, double y, double pageX, double pageY, const std::string &ref_line_name );
572612 void chartDoubleLeftClickCallback ( double x, double y, const std::string &ref_line_name );
573- void chartRightClickCallback ( double x, double y, double pageX,
574- double pageY );
613+ void chartRightClickCallback ( double x, double y, double pageX, double pageY, const std::string &ref_line_name );
575614
576615 void existingRoiEdgeDragCallback ( double new_lower_energy, double new_upper_energy,
577616 double new_lower_px, double new_upper_px,
@@ -616,10 +655,14 @@ class D3SpectrumDisplayDiv : public Wt::WContainerWidget
616655 std::vector<ReferenceLineInfo> m_persistedPhotoPeakLines;
617656
618657 bool m_showRefLineInfoForMouseOver;
658+ double m_refLineWidth;
659+ double m_refLineWidthHover;
660+
661+ RefLineVerbosity m_refLineVerbosity;
619662
620- RefLineKinetic *m_kinetic ;
621- std::vector<std::pair<double ,ReferenceLineInfo>> m_kineticRefLines ;
622- std::string m_kineticRefLinesJsFwhmFcn ;
663+ RefLineDynamic *m_dynamic ;
664+ std::vector<std::pair<double ,ReferenceLineInfo>> m_dynamicRefLines ;
665+ std::string m_dynamicRefLinesJsFwhmFcn ;
623666
624667 bool m_showFeatureMarker[static_cast <int >(FeatureMarkerType::NumFeatureMarkers)];
625668
0 commit comments