manpagez: man pages & more
info mathgl_en
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.1 mglWindow class

This class is derived from mglGraph class (see section MathGL core). It provide methods for handling window with MathGL graphics.

Constructor on mglWindow: mglWindow (const char *title="MathGL")
Constructor on mglWindow: mglWindow (int (*draw)(HMGL gr, void *p), const char *title="MathGL", void *par=NULL, int kind=0, void (*reload)(HMGL gr, void *p)=0)
Constructor on mglWindow: mglWindow (int (*draw)(mglGraph *gr), const char *title="MathGL", int kind=0)
Constructor on mglWindow: mglWindow (mglDraw *draw, const char *title="MathGL", int kind=0)
C function: HMGL mgl_create_graph_qt (int (*draw)(HMGL gr, void *p), const char *title, void *par, void (*reload)(HMGL gr, void *p))
C function: HMGL mgl_create_graph_fltk (int (*draw)(HMGL gr, void *p), const char *title, void *par, void (*reload)(HMGL gr, void *p))
C function: HMGL mgl_create_graph_glut (int (*draw)(HMGL gr, void *p), const char *title, void *par, void (*reload)(HMGL gr, void *p))

Creates a window for plotting. Parameter draw sets a pointer to drawing function (this is the name of function) or instance of mglDraw class. There is support of a list of plots (frames). So as one can prepare a set of frames at first and redraw it fast later (but it requires more memory). Function should return positive number of frames for the list or zero if it will plot directly. Note, that draw can be NULL for displaying static bitmaps only (no animation or slides). Parameter title sets the title of the window. Parameter par contains pointer to data for the plotting function draw. Parameter kind may have following values: ‘0’ – use FLTK window, ‘1’ – use Qt window.

There are some keys handles for manipulating by the plot: ’a’, ’d’, ’w’, ’s’ for the rotating; ’,’, ’.’ for viewing of the previous or next frames in the list; ’r’ for the switching of transparency; ’f’ for the switching of lightning; ’x’ for hiding (closing) the window.

Method on mglWindow: int RunThr ()
C function: int mgl_fltk_thr ()

Run main loop for event handling in separate thread. Note, right now it work for FLTK windows only.

Method on mglWindow: int Run ()
C function: int mgl_qt_run ()
C function: int mgl_fltk_run ()

Run main loop for event handling. Usually it should be called in a separate thread or as last function call in main().

Method on mglWindow: void SetClickFunc (void (*func)(HMGL gr, void *p))
C function: void mgl_set_click_func (void (*func)(HMGL gr, void *p))

Set callback function func which will be called on mouse click.

Method on mglWindow: void ToggleAlpha ()
C function: int mgl_wnd_toggle_alpha (HMGL gr)

Switch on/off transparency but do not overwrite switches in user drawing function.

Method on mglWindow: void ToggleLight ()
C function: int mgl_wnd_toggle_light (HMGL gr)

Switch on/off lighting but do not overwrite switches in user drawing function.

Method on mglWindow: void ToggleRotate ()
C function: int mgl_wnd_toggle_rotate (HMGL gr)

Switch on/off rotation by mouse. Usually, left button is used for rotation, middle button for shift, right button for zoom/perspective.

Method on mglWindow: void ToggleZoom ()
C function: int mgl_wnd_toggle_zoom (HMGL gr)

Switch on/off zooming by mouse. Just select rectangular region by mouse and it will be zoomed in.

Method on mglWindow: void ToggleNo ()
C function: int mgl_wnd_toggle_no (HMGL gr)

Switch off all zooming and rotation and restore initial state.

Method on mglWindow: void Update ()
C function: int mgl_wnd_update (HMGL gr)

Update window contents. This is very useful function for manual updating the plot while long calculation was running in parallel thread.

Method on mglWindow: void ReLoad ()
C function: int mgl_wnd_reload (HMGL gr)

Reload user data and update picture. This function also update number of frames which drawing function can create.

Method on mglWindow: void Adjust ()
C function: int mgl_wnd_adjust (HMGL gr)

Adjust size of bitmap to window size.

Method on mglWindow: void NextFrame ()
C function: int mgl_wnd_next_frame (HMGL gr)

Show next frame if one.

Method on mglWindow: void PrevFrame ()
C function: int mgl_wnd_prev_frame (HMGL gr)

Show previous frame if one.

Method on mglWindow: void Animation ()
C function: int mgl_wnd_animation (HMGL gr)

Run/stop slideshow (animation) of frames.

Method on mglWindow: void SetDelay (float dt)
C function: int mgl_wnd_set_delay (HMGL gr, int dt)

Sets delay for animation in seconds. Default value is 1 sec.

Method on mglWindow: void Setup (bool clfupd=true, bool showpos=false)
C function: int mgl_setup_window (HMGL gr, bool clfupd, bool showpos)

Enable/disable flags for:

  • clearing plot before Update();
  • showing the last mouse click position in the widget.
Method on mglWindow: mglPoint LastMousePos ()
C function: int mgl_get_last_mouse_pos (HMGL gr, float *x, float *y, float *z)

Gets last position of mouse click.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on April 13, 2012 using texi2html 5.0.

© manpagez.com 2000-2025
Individual documents may contain additional copyright information.