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

5. Widget classes

There are set of “window” classes for making a window with MathGL graphics: mglGraphFLTK, mglGraphQT, mglGraphGLUT. All these classes allow user to show, rotate, export, and change view of the plot using keyboard. Most of them (except mglGraphGLUT) also have toolbar and menu for simplifying plot manipulation. Usually these classes (except mglGraphGLUT) are derived from mglGraphZB class and have a “connected” class for widget in corresponding window library. All window classes have the same set of functions (see section mglGraphAB class). Below the full list of classes with short comments.

Class: mglGraphFLTK

Class mglGraphFLTK adds the possibility to create plotting window with the help of FLTK library. It allows one to show, rotate, export, and change view of the plot by keyboard, menu and toolbar. “Corresponding” widget class is Fl_MathGL. Class is defined in #include <mgl/mgl_fltk.h>.

Class: Fl_MathGL

Class is FLTK widget for displaying the MathGL output. Class is defined in #include <mgl/mgl_fltk.h>.

fltk

Example of FLTK window with MathGL plot.

Class: mglGraphQT

Class mglGraphQT adds the possibility to create plotting window with the help of QT library. It allows one to show, rotate, export, and change view of the plot by keyboard, menu and toolbar. “Corresponding” widget class is QMathGL. Class is defined in #include <mgl/mgl_qt.h>.

Class: QMathGL

Class is Qt widget for dysplaying the MathGL output. Class is defined in #include <mgl/mgl_qt.h>.

qt

Example of Qt window with MathGL plot.

Class: mglGraphGLUT

Class mglGraphGLUT adds the possibility to create plotting window with the help of GLUT library. It allows one to show, rotate, export, and change view of the plot only by keyboard. Class is defined in #include <mgl/mgl_glut.h>.

glut

Example of GLUT window with MathGL plot.


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

5.1 Fl_MathGL class

Class is FLTK widget which display MathGL graphics (defined in #include <mgl/mgl_fltk.h>).

Method on Fl_MathGL: void set_draw (mglDraw *dr)

Sets drawing function from a class inherited from mglDraw.

Method on Fl_MathGL: void update (mglGraph *gr=NULL)

Update (redraw) plot using grapher gr (built-in by default).

Method on Fl_MathGL: void set_angle (float t, float p)

Set angles for additional plot rotation

Method on Fl_MathGL: void set_state (int f)

Set bitwise flags for general state (1-Alpha, 2-Light)

Method on Fl_MathGL: void set_state (bool z, bool r)

Set flags for handling mouse: z=true allow zooming, r=true allow rotation/shifting/perspective and so on.

Method on Fl_MathGL: void set_zoom (float X1, float Y1, float X2, float Y2)

Set zoom in/out region

Method on Fl_MathGL: void get_zoom (float *X1, float *Y1, float *X2, float *Y2)

Get zoom in/out region

Method on Fl_MathGL: void set_popup (const Fl_Menu_Item *pmenu, Fl_Widget *w, void *v)

Set popup menu pointer

Method on Fl_MathGL: mglGraph * get_graph ()

Get pointer to grapher

Widget option of Fl_MathGL: Fl_Valuator * tet_val

Pointer to external tet-angle validator.

Widget option of Fl_MathGL: Fl_Valuator * phi_val

Pointer to external phi-angle validator.

Widget option of Fl_MathGL: mglGraphAB * graph

Pointer to grapher

Widget option of Fl_MathGL: void * draw_par

Parameters for drawing function mglGraph::DrawFunc.

Widget option of Fl_MathGL: int (* draw_func )(mglGraph *gr, void *par)

Drawing function for window procedure. It should return the number of frames.


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

5.2 QMathGL class

Class is Qt widget which display MathGL graphics (defined in #include <mgl/mgl_qt.h>).

Method on QMathGL: void setDraw (mglDraw *dr)

Sets drawing functions from a class inherited from mglDraw.

Method on QMathGL: void setDraw (int (*draw)(mglGraph *gr, void *p), void *par=NULL)

Sets the drawing function draw. 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. Parameter par contains pointer to data for the plotting function draw.

Method on QMathGL: void setGraph (mglGraphAB *gr)

Set pointer to external grapher (instead of built-in mglGraphZB). Note that QMathGL will automatically delete this object at destruction or at new setGraph() call.

Method on QMathGL: void setPopup (QMenu *p)

Set popup menu pointer.

Method on QMathGL: void setSize (int w, int h)

Set widget/picture sizes

Method on QMathGL: double getRatio ()

Return aspect ratio of the picture.

Method on QMathGL: int getPer ()

Get perspective value in percents.

Method on QMathGL: int getPhi ()

Get Phi-angle value in degrees.

Method on QMathGL: int getTet ()

Get Theta-angle value in degrees.

Method on QMathGL: bool getAlpha ()

Get transparency state.

Method on QMathGL: bool getLight ()

Get lightning state.

Method on QMathGL: bool getZoom ()

Get mouse zooming state.

Method on QMathGL: bool getRotate ()

Get mouse rotation state.

Slot on QMathGL: void refresh ()

Redraw saved bitmap without executing drawing function.

Slot on QMathGL: void update (mglGraph *gr=NULL)

Update picture by executing drawing function.

Slot on QMathGL: void copy ()

Copy graphics to clipboard.

Slot on QMathGL: void setPer (int val)

Set perspective value.

Slot on QMathGL: void setPhi (int val)

Set Phi-angle value.

Slot on QMathGL: void setTet (int val)

Set Theta-angle value.

Slot on QMathGL: void setAlpha (bool val)

Switch on/off transparency.

Slot on QMathGL: void setLight (bool val)

Switch on/off lightning.

Slot on QMathGL: void setZoom (bool val)

Switch on/off mouse zooming.

Slot on QMathGL: void setRotate (bool val)

Switch on/off mouse rotation.

Slot on QMathGL: void zoomIn ()

Zoom in graphics.

Slot on QMathGL: void zoomOut ()

Zoom out graphics.

Slot on QMathGL: void restore ()

Restore zoom and rotation to default values.

Slot on QMathGL: void reload ()

Reload data and redraw graphics.

Slot on QMathGL: void shiftLeft ()

Shift graphics to left direction.

Slot on QMathGL: void shiftRight ()

Shift graphics to right direction.

Slot on QMathGL: voidshiftUp ()

Shift graphics to up direction.

Slot on QMathGL: void shiftDown ()

Shift graphics to down direction.

Slot on QMathGL: void exportPNG (QString fname="")

Export current picture to PNG file.

Slot on QMathGL: void exportPNGs (QString fname="")

Export current picture to PNG file (no transparency).

Slot on QMathGL: void exportJPG (QString fname="")

Export current picture to JPEG file.

Slot on QMathGL: void exportBPS (QString fname="")

Export current picture to bitmap EPS file.

Slot on QMathGL: void exportEPS (QString fname="")

Export current picture to vector EPS file.

Slot on QMathGL: void exportSVG (QString fname="")

Export current picture to SVG file.

Slot on QMathGL: void exportIDTF (QString fname="")

Export current picture to IDTF file.

Slot on QMathGL: void setMGLFont (QString path)

Restore (path="") or load font for graphics.

Slot on QMathGL: void print ()

Print current picture

Slot on QMathGL: void adjust ()

Adjust plot size to fill entire window. This function is executed only if graph is mglGraphQT instance.

Slot on QMathGL: void nextSlide ()

Show next slide. This function is executed only if graph is mglGraphQT instance.

Slot on QMathGL: void prevSlide ()

Show previous slide. This function is executed only if graph is mglGraphQT instance.

Slot on QMathGL: void animation (bool st=true)

Start animation. This function is executed only if graph is mglGraphQT instance.

Slot on QMathGL: void about ()

Show about information.

Slot on QMathGL: void aboutQt ()

Show information about Qt version.

Signal on QMathGL: void phiChanged (int val)

Phi angle changed (by mouse or by toolbar).

Signal on QMathGL: void tetChanged (int val)

Tet angle changed (by mouse or by toolbar).

Signal on QMathGL: void perChanged (int val)

Perspective changed (by mouse or by toolbar).

Signal on QMathGL: void alphaChanged (bool val)

Transparency changed (by toolbar).

Signal on QMathGL: void lightChanged (bool val)

Lighting changed (by toolbar).

Signal on QMathGL: void zoomChanged (bool val)

Zooming changed (by toolbar).

Signal on QMathGL: void rotateChanged (bool val)

Rotation changed (by toolbar).

Widget option of QMathGL: QString appName

Application name for message boxes.

Widget option of QMathGL: bool autoResize

Allow auto resizing (default is false).

Widget option of QMathGL: int animDelay

Animation delay in ms.


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

This document was generated by Alexey Balakin on May 2, 2013 using texi2html 1.82.