Documentation of individual methods - Part 3
Display methods

alphabetic index / program documentation / database / internals / general methods / project methods
spec_display, spec_display_chain
strip_check, strip_check_chd

draw_object - draw_peak, ...

draw_obj_type type
one of enum draw_obj_type { DRAW_SHAPE, DRAW_PEAK, DRAW_BOX, DRAW_LINE };
int color
draw object with drc->set_color(color)
int origin
exact meaning depends on type.
pal_list * pl points to the suorce of the peak, origin contains the index in pl. char p_x, p_y are the dimensions in pl.
has strip_spec_3D * tool, and calls tool->shift_notify(cw, origin) / kill_notify(cw, origin) at the end of shift/kill_notify. kill_notify returns false (do not delete draw_object) because all peaks are build up from scratch. Everything else is identical to draw_peak.
virtual void draw(cursor_window * cw) = 0
draw the object to cw
virtual float distance(int xw, int yw, cursor_window * cw) = 0
distance measure from window coordinates - square of window coordinates
virtual void shift_notify(cursor_window * w, int x1, int y1, int x2, int y2) {}
action to perform when object was shifted in w from window coordinates x1,y1 to x2,y2. activated by dragging with midle mouse button.
virtual void query(void) {}
should display (print) information about the object. Activated for selected object with "q".
void draw_peak::assign_interactive(void) in
show assignment window for the peak. If you change the peaklist with other command before you close the window (deleting peaks, re-calculating ...) the information may be incorrect and changes or even confirmation may have ill effects. Activated with "a".


ls_window : public cursor_window
A window to draw lineshapes, it is connected to a spec_group only in x-dimension. In / spec_display.h
tool_ls_window : public ls_window
An ls_window that can send messages back to an ls_tool - see ls_tool::show_peak. ( / spec_display.h)
check_ls_window : public tool_ls_window
NOAH_ls_window : public tool_ls_window
specific tool_ls_windows, connected with check_tool and NOAH_tool. see NOAH_tool. ( / spec_display.h)


zoom_in / zoom_out

(Leave_CB, KeyPress_CB see interface - cursor window)

Base class for all windows that are calibrated in ppm (in at least one dimension), have a crosshair, and belong to a spec_group.

void cursor_window::get_ch_xy(void)
Set chx/chy according to group->ppm_ch. Call only if !ch_on, or make a redraw afterwards.
void cursor_window::put_ch(void)
Update crosshair coordinates from group and display crosshair. The function removes the old crosshair before.
void cursor_window::clear_ch(void)
Remove crosshair and restore area below.
void cursor_window::set_ch_xy(int x, int y)
Store new crosshair x/y ppm in group. This does not change chx/chy. The new position takes effect after an update.
void cursor_window::set_group_automatic(void)
If an active_group exists, the cursor_window is added. inames that do not match are added at the end.
Otherwise a new group is created.
Pitfalls:If set_group_automatic does not work, two common problems should be checked
void cursor_window::set_group_interactive(void)
Popups allow to select all possibilities.
void cursor_window::update(void)
Adapt crosshair and indirect dimensions according to the data in group. Called from spec_group::update.
virtual void cursor_window::zoom_in(float x1, float y1, float x2, float y2)
Sorts the arguments such that the display is not inverted and calls define_coord(). The necessary redraw is done by the deletion of the box, which is called from KeyPress_CB. In spec_window the zoom commands also call show() with the new borders.
virtual void cursor_window::zoom_out(float x1, float y1, float x2, float y2)
The contents of the window is put into the box, and the surrounding is added.
void cursor_window::set_standard(void)
Put current ppm coordianates into "original" coordinates. On CTRL-Z the window will zoom back to these coordinates.



Defines how spec_win can display data from nSpec.
Stability problem: There is no way how spec_win is informed if the respective nSpec is deleted.
bool spec_access::is_ok(float * pal, float * psh)
Whether it is possible to get the displayed spectrum from inside spec. In x/y dim's psl and psh must be inside spec. planes can be folded.
bool spec_access::is_plane_ok(float ppm, int dim)
Wheter it is possible to get the plane at ppm in spec_win dimension dim from spec. Uses spec->folding_type[perm_sc[dim]].



spec_group is a list of spec_window* and a window that displays ppm positions of the crosshair and the pointer.
spec_group has a number of resonances for which it can hold a crosshair position and a pointer position. All dimensions of a spectrum in spec_window can be connected to one of these resonances (pg[]=0 .. NR_RES_GR-1) or not (pg[]=-1). Indirect dimensions can be connected as "active" (status_i[]&ChangePlane) or "passive". If active, cursor movements in another window of the same group to displaying a different plane, if the cursor is moved out of the current plane.
The pointer can only be in one spec_window at a time. The crosshair is displayed in all windows that satisfy the following conditions: This coordination of crosshair and displayed plane is organized by the update method. If a spec_window x or y-dimension has no corresponding resonance in a group, no crosshair can be displayed for this dimension. Each spec_window can be in a separate group, if no interaction between the crosshairs is intended.
void spec_group::update(void)
Update all members of the group.
void spec_group::position(int d, float ppmc)
set and display (depending on status) current position in d
void spec_group::toggle(void)
Display / hide window with cursor positions.


protected methods:

all in

spec_window has no facilities to handle display of peaks from peaklists etc. This has to be organized by ins main window. To get a "standard" spectral window, use spec_display.

(Motion_CB, Enter_CB, BPress_CB, BRelease_CB, KeyPress_CB see interface - spec_window)

spec_io * spio
a private spec_io to read from the file
spec_access * spa
how to get data from memory. One of those must be defined with use, if both are defined and suitable to get data, spa is used.
cSpec * wspec
a private 2D spectrum in x/y orientation, for redraw.
int shift, scale
parameters for color transformation, see color of spectra
static XColor spec_color[NR_SPEC_COLORS]
colormap for all spectra.
spec_window : public cursor_window
A window on which a spectrum is displayed. To display a spectrum, the following steps must be taken:
rd_spec_window : public spec_windo
A window to display strips of 4D -> 3D projected spectra (reduced dimensionality experiments), where the two projected dimensions both map to the y-axis of the strip. Supports cursors for 3 dimensions of the group.
tool_spec_window : public spec_window
spec_window that can send a message about a new position back to ls_tool. ( / spec_display.h)
spec_window::spec_window(window & parent, int w, int h, int x, int y)
as usual.
void spec_window::use(spec_io * src_spio, int * perm_wsn)
Make spio a copy of src_spio to take spectral data from. perm_wsn[0,1,2,...] is the w-dimension in spio that become x,y,indirect...
void spec_window::use(spec_io * src_spio, scan_param * scpa)
x: peak_dim[0]; y: scan_dim; indirect: peak_dim[1]. Call only while spio->perm_ws has not changed
void spec_window::show(float * psl, float * psh)
Load given range from spec or spio into wspec. In indirect dim's psl and psh should be equal, the higher of both is used.
Calls re_read to get the spectrum from spio. Calls define_coord().
void spec_window::show_ini(bool do_map=true)
show the first plane in full size.
void spec_window::show(peak_info2 * p2)
Show strip with ppm[0] +/- 3*lw[0] in x-dimension, full y, plane=ppm[1].
void spec_window::show_peaks(pal_list * pl, int * perm_cl=NULL, int disp_mode=0)
Show peaks from pl on the spectral window.
disp_mode: 0x01=show atom name of y-assignment, 0x02=show residue number of y-assignment
void spec_window::clear_peaks(pal_list * pl=NULL)
clear the peaks of a particular peaklist (NULL: all peaks) from the window.
private / protected methods:
void spec_window::set_perm_spio(int * perm_wsn)
Defines permutation of display with respect to spio. perm_wsn[0]=x-dimension, perm_wsn[1]=y-dim, perm_wsn[2...]=indirect planes
void spec_window::default_perm_spio(scan_param * scpa)
Strip display: x=scpa->peak_dim[0]; y=scpa->scan_dim; indirect=scpa->peak_dim[1]. Call only while spio==spio_src.
void spec_window::re_read(void)
Loads a temporary nSpec
if(spa && spa->ok) from spa, or
from spio (with the current off_sw/end_sw settings) and transforms it into cSpec * wspec with char_from_float().
signed char spec_window::col_from_float(float x)
Maps a float to a logarithmic 6 bit color scale, depending on shift (base of logarithm: 22-->sqrt(2) 21-->2, ...) and scale (0x3f800000-->1, +0x00800000-->/2).
void spec_window::switch_to_spio(void)
currently not implemented. should take size and plane from spa to spio (create spio if it does not exist)
int spec_window::current_plane(int d=2)
return the number of the current plane.
int spec_window::max_plane(int d=2)
return the number of the highest plane that can be displayed. If sps&spa->ok, return the highest plane of spa, even if spio may have more planes.
void spec_window::goto_plane(int pln, int d=2, bool do_re_read=true)
void spec_window::goto_plane(float to_ppm, int d=2, bool do_re_read=true)
Go to the plane. goto_plane(float to_ppm ...) calls goto_plane(int pln ...).
void spec_window::get_plane(void)
Go to the plane that is defined by the corresponding cursor position, if (status_i[d-2]&ChangePlane).
void spec_window::update(void)
Do what has to be done when the cursor position has changed.


A tool to display 3 spec_window of a strip, i.e. all 3 planes that go through a point on this strip. strip_spec_3D shows a strip of the spectrum that is currently used to integrate peaks. It provides a connection to the peaklist2 * scpa->pl. methods:
nSpec * spec
the 3D area of the spectrum which is displayed. orientation is the same as scpa->subspec, if called as use(tt->spio).
spec_io * lspio
the copy of spio that was used to load spec. local to this strip_spec_3D. lspio has the same orientation as spio in use(), i.e. normally the orientation of scpa->subspec.
peaklist2 * pls
a pointer to the peaklist that is displayed and changed.
int pn
pls->pp[pn] is the central peak of the strip-display
pal_list * pll
a local copy of those peaks in pls, that are displayed. The indices of pll, pls_2, and pls_3 match. pll has perm of pls , i.e. ppm[0]=peak_dim[0], 1=peak_dim[1], 2=scan_dim, and not perm_w1.
int * pls_2; sc_peak ** pls_3
arrays of indices (pls->pp[pls_2[i]]) and pointers to the entries in pls. Do not delete elements !


void strip_spec_3D::use(spec_io *spio)
creates a local copy of spio, and setnew_spio=true.
void strip_spec_3D::show(peaklist2 * pl, int peak_nr)
Folds the peak into the spectrum and displays a strip.
void strip_spec_3D::show(float * psl, float * psh)
show the area between psh and psl, which are in the orientation of spec
void strip_spec_3D::show_peaks(void)
Display all peaks from pls which are in the displayed area. update pll, pls_2 and pls_3.
void strip_spec_3D::show_original(proton_list * prot)
makes prot the new o_prot and shows lines from o_prot positions to the new peak positions in all spec_windows.
void strip_spec_3D::kill_notify(cursor_window * w, int n)
void strip_spec_3D::shift_notify(cursor_window * w, int n)
Mechanism by which pls is changed, when peaks are deleted or shifted on the display. n is the index in pll, pls_2 and pls_3 are used to find the corresponding entry in pls.

ls_tool, check_tool, NOAH_tool

show_peak in
pseudoatoms in

see also: NOAH tool

ls_tool : public main_window ( / spec_display.h)
NOAH_tool : public ls_tool ( / spec_display.h)
check_tool : public ls_tool ( / spec_display.h)
Tools to handle a peaklist and a spectrum, and display extracted lineshapes and peaks from the spectrum. see check and NOAH.
virtual void show_peak(tool_ls_window * ls)
Extracts the necessary information from ls and displays the peak corresponding to the selected lineshape +/- about 4*Lw_e.
void ls_tool::new_shape(tool_spec_window * wn)
Removes the lineshape that gave rise to the peak currently diplayed, and adds a new lineshape to the lineshape window, which is taken at the cursor position.
void check_tool::pseudoatoms(void)
Checks the proton list for atom names that begin with 'Q'. These are assumed to be pseudo-atoms, and they are examined whether they exist in a pseudoatom_lib * pslib, whether peaks in pl are assigned to them, and to the atoms they represent, and if both is the case, whether the average ppm value determined from pl is within ppm_tol for the pseudo-atom and one of the atoms that are represented.

strip_check, strip_check_chd

strip_check_chd * chd
table_handler(ctb) for commands. Has a strip_check * tool to its parent.
strip_spec_3D * s3D
display for single strip in 3D projections
proton_list * old_prot
the positions which are displayed in s3D as the start of lines. old_prot should be set to values where the assignment is correct by definition, e.g. from a NOESY peaklist.
main_t_window * tx
is more or less a marker for pointers to "global" variables. May be replaced later.
bool include_overlapping
whether recalculate() also recalculates overlapping strips.
void strip_check::initialize(void)
calls the command handler, which provides the following options:
void strip_check::recalculate(void)
void strip_check::select_id(void)
void strip_check::edit_prange(void)
void strip_check::reference_shift(void)

strip_comparison : public main_window

A tools to display groups of strips, in particular to confirm sequential connections. methods: parameters and pointers:
spec_window * sw[2][MAX_CON][MAX_SP]
the individual strips
int o, r, s
counter: o 0=prev 1=next, r residues (strips), s spectra
int fwd
0=display foreward connection | 1=display backward connection
char sp[2][MAX_SP][SNLN]
short names of the spectra
int nr_res[2], nr_sp[2]
number of residues and spectra in both directions
int nr_con
number of possible sequential neighbors to show
int swi
strip width
int res[2][MAX_CON]
the fragment numbers to display
float cow[MAX_CON]
probabilities of sequential connections
int tns
total number of strips

methods: all in

void strip_comparison::build_sw(void)
Connect the spectral windows with their respective spio's.
void strip_comparison::show_connection(int resc)
Show all spectra for resc and for the best 3 sequential connections (fwd or !fwd).
void strip_comparison::hide(void)
Unmap all spectral windows to prevent multiple redraws.
void strip_comparison::draw(void)
The final step to display the spectral windows.

class stc_commands : public table_handler(itb)

The command handler for strip_comparison * stc.

spec_display, spec_display_chain

spec_display_chain * sdcp is a hook to find all spec_display.


parameters and pointers:
class spec_display_chain : public chained {
  spec_display * sd;
  spec_display_chain(spec_display * xsd);
  void notify(nevent e, pal_list *pl, int nr) {

class spec_display : public main_window {
  pal_list_list *pll;
  spec_window *sw;
  spec_display(int w=500, int h=400);
  void notify(nevent e, pal_list *pl, int nr) {
  void shift_notify(pal_list *pl, int nr);
  void kill_notify(pal_list *pl, int nr);
  void display_peaklist(void);
  void update_peaks(pal_list * pl);
  void KeyPress_CB(XKeyEvent ev);

alphabetic index / program documentation / database / internals / general methods / project methods
Dr. Ralf W. Glaser
FSU Jena, Institut fuer Molekularbiologie
Winzerlaer Strasse 10
D-07745 Jena, Germany
Tel.: +49-3641-65-7573
Fax: +49-3641-65-7520

Last modified: updated every few days (October 1996)