#ifndef BASEINTERACTIVE_H #define BASEINTERACTIVE_H #include "GammaAnalyALG.h" class BaseInteractive { public: BaseInteractive(); ~BaseInteractive(); /* add a control point in current cursor position * * get current cursor position. Check if that channel is within analysis * range and there is no other control point at that channel. If true, * adds a control point at (channel, baseline at channel) and pushes the * new baseline to the baseline stack * * @syntax lAddCP(hfig) * @param hfig main GUI figure handle */ void AddCtrlPoint(int x); /* remove control point nearest to cursor from baseline * * Finds the nearest control point to the current cursor position. * Unless it is the first or last control point, it is removed and the * new baseline pushed to the stack. * * @syntax lRemoveCP(hfig) */ void RemoveCtrlPoint(double x); /* modify control point position * * Lets the user grab and drag a baseline control point with the * main GUI WindowButtonDownFcn baseModify: * * disables control-points tools and sets the WindowButtonDownFcn to * baseModify('down') and cursor to hand. * waits until uiresume is called on hfig (by baseModify), gets the * changed baseline control points, pushs them to the stack and reverts * buttons, WindowButtonDownFcn and cursor. * * @syntax lModifyCP(hfig) * @param hfig main GUI figure handle */ void ModifyCtrlPoint(int x, double y); void EditSlope(double x, double dy); /* plot a second baseline for showing temporary modifications * * @syntax [hb, hc, hs] = lPlotBaseline(cpd) * @param cpd control point data struct * @return hb baseline handle * @return hc control-points handle * @return hs control point slope marker handle */ void UpdateBaseline(); /* push new baseline on temporary stack * * adds a new baseline on a temporary stack and updates plot and all relevant * variables in application data 'ControlPointData' * Normally signals that the baseline has been modified, but lUndoLast may * set the modification flag to 0 * * @syntax lPushStack(hfig, cx, cy, cdy) * @syntax lPushStack(hfig, cx, cy, cdy, modified) * @param hfig main GUI figure handle * @param cx control points channels * @param cy control points counts * @param cdy control points slope * @param modified flag (0|1) used by lUndoLast * @constraint only lUndoLast may use modified flag */ void PushStack(stdvec cx, stdvec cy, stdvec cdy, bool modified = true); private: BaseControls baseCtrl; stdvec m_para; }; #endif // BASEINTERACTIVE_H