QwtPlot3D API  0.2.7
Classes | Public Slots | Signals | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
Plot3D Class Referenceabstract

#include <qwt3d_plot.h>

Inheritance diagram for Plot3D:
GraphPlot MultiPlot SurfacePlot VolumePlot

Public Slots

void setRotation (double xVal, double yVal, double zVal)
 
void setShift (double xVal, double yVal, double zVal)
 
void setViewportShift (double xVal, double yVal)
 
void setScale (double xVal, double yVal, double zVal)
 
void setZoom (double)
 
void setOrtho (bool)
 
void enableMouse (bool val=true)
 
void disableMouse (bool val=true)
 
void enableKeyboard (bool val=true)
 
void disableKeyboard (bool val=true)
 
void enableLighting (bool val=true)
 
void disableLighting (bool val=true)
 
void setLightRotation (double xVal, double yVal, double zVal, unsigned int idx=0)
 
void setLightShift (double xVal, double yVal, double zVal, unsigned int idx=0)
 
virtual bool savePixmap (QString const &fileName, QString const &format)
 
virtual bool saveVector (QString const &fileName, QString const &format, VectorWriter::TEXTMODE text, VectorWriter::SORTMODE sortmode)
 
virtual bool save (QString const &fileName, QString const &format)
 

Signals

void rotationChanged (double xAngle, double yAngle, double zAngle)
 
void shiftChanged (double xShift, double yShift, double zShift)
 
void vieportShiftChanged (double xShift, double yShift)
 
void scaleChanged (double xScale, double yScale, double zScale)
 
void zoomChanged (double)
 
void projectionChanged (bool)
 

Public Member Functions

 Plot3D (QWidget *parent=0, const QGLWidget *shareWidget=0)
 
virtual ~Plot3D ()
 
QPixmap renderPixmap (int w=0, int h=0, bool useContext=false)
 
void updateData ()
 
void createCoordinateSystem (Qwt3D::Triple beg, Qwt3D::Triple end)
 
Qwt3D::CoordinateSystemcoordinates ()
 
Qwt3D::ColorLegendlegend ()
 
double xRotation () const
 
double yRotation () const
 
double zRotation () const
 
double xShift () const
 
double yShift () const
 
double zShift () const
 
double xViewportShift () const
 
double yViewportShift () const
 
double xScale () const
 
double yScale () const
 
double zScale () const
 
double zoom () const
 
bool ortho () const
 
void setPlotStyle (Qwt3D::PLOTSTYLE val)
 
Qwt3D::EnrichmentsetPlotStyle (Qwt3D::Enrichment const &val)
 
Qwt3D::PLOTSTYLE plotStyle () const
 
Qwt3D::EnrichmentuserStyle () const
 
void setShading (Qwt3D::SHADINGSTYLE val)
 
Qwt3D::SHADINGSTYLE shading () const
 
void setIsolines (int isolines)
 
int isolines () const
 
void setSmoothMesh (bool val)
 
bool smoothDataMesh () const
 
void setBackgroundColor (Qwt3D::RGBA rgba)
 
Qwt3D::RGBA backgroundRGBAColor () const
 
void setMeshColor (Qwt3D::RGBA rgba)
 
Qwt3D::RGBA meshColor () const
 
void setMeshLineWidth (double lw)
 
double meshLineWidth () const
 
void setDataColor (Color *col)
 
const ColordataColor () const
 
virtual Qwt3D::EnrichmentaddEnrichment (Qwt3D::Enrichment const &)
 
virtual bool degrade (Qwt3D::Enrichment *)
 
Qwt3D::ParallelEpiped hull () const
 
void showColorLegend (bool)
 
void setCoordinateStyle (Qwt3D::COORDSTYLE st)
 
void setPolygonOffset (double d)
 
double polygonOffset () const
 
void setTitlePosition (double rely, double relx=0.5, Qwt3D::ANCHOR=Qwt3D::TopCenter)
 
void setTitleFont (const QString &family, int pointSize, int weight=QFont::Normal, bool italic=false)
 
void setTitleColor (Qwt3D::RGBA col)
 
void setTitle (const QString &title)
 
void assignMouse (MouseState xrot, MouseState yrot, MouseState zrot, MouseState xscale, MouseState yscale, MouseState zscale, MouseState zoom, MouseState xshift, MouseState yshift)
 
bool mouseEnabled () const
 
void assignKeyboard (KeyboardState xrot_n, KeyboardState xrot_p, KeyboardState yrot_n, KeyboardState yrot_p, KeyboardState zrot_n, KeyboardState zrot_p, KeyboardState xscale_n, KeyboardState xscale_p, KeyboardState yscale_n, KeyboardState yscale_p, KeyboardState zscale_n, KeyboardState zscale_p, KeyboardState zoom_n, KeyboardState zoom_p, KeyboardState xshift_n, KeyboardState xshift_p, KeyboardState yshift_n, KeyboardState yshift_p)
 
bool keyboardEnabled () const
 
void setKeySpeed (double rot, double scale, double shift)
 
void keySpeed (double &rot, double &scale, double &shift) const
 
bool lightingEnabled () const
 
void illuminate (unsigned light=0)
 
void blowout (unsigned light=0)
 
void setMaterialComponent (GLenum property, double r, double g, double b, double a=1.0)
 
void setMaterialComponent (GLenum property, double intensity)
 
void setShininess (double exponent)
 
void setLightComponent (GLenum property, double r, double g, double b, double a=1.0, unsigned light=0)
 
void setLightComponent (GLenum property, double intensity, unsigned light=0)
 
double xLightRotation (unsigned idx=0) const
 
double yLightRotation (unsigned idx=0) const
 
double zLightRotation (unsigned idx=0) const
 
double xLightShift (unsigned idx=0) const
 
double yLightShift (unsigned idx=0) const
 
double zLightShift (unsigned idx=0) const
 
bool hasData () const
 

Protected Types

enum  OBJECTS { DataObject, LegendObject, NormalObject, DisplayListSize }
 
typedef std::list
< Qwt3D::Enrichment * > 
EnrichmentList
 
typedef EnrichmentList::iterator ELIT
 

Protected Member Functions

void initializeGL ()
 
void paintGL ()
 
void resizeGL (int w, int h)
 
void mousePressEvent (QMouseEvent *e)
 
void mouseReleaseEvent (QMouseEvent *e)
 
void mouseMoveEvent (QMouseEvent *e)
 
void wheelEvent (QWheelEvent *e)
 
void keyPressEvent (QKeyEvent *e)
 
virtual void calculateHull ()=0
 
virtual void createData ()=0
 
virtual void createEnrichment (Qwt3D::Enrichment &)
 
virtual void createEnrichments ()
 
void createCoordinateSystem ()
 
void setHull (Qwt3D::ParallelEpiped p)
 
bool initializedGL () const
 

Protected Attributes

Qwt3D::CoordinateSystem coordinates_p
 
Qwt3D::Colordatacolor_p
 
Qwt3D::Enrichmentuserplotstyle_p
 
EnrichmentList elist_p
 
std::vector< GLuint > displaylists_p
 
Qwt3D::Data * actualData_p
 

Detailed Description

Plot3D handles all the common features for plotting widgets - coordinate system, transformations, mouse/keyboard handling, labeling etc.. It contains some pure virtual functions and is, in so far, an abstract base class. The class provides interfaces for data handling and implements basic data controlled color allocation.

Constructor & Destructor Documentation

Plot3D ( QWidget *  parent = 0,
const QGLWidget *  shareWidget = 0 
)

This should be the first call in your derived classes constructors.

References ColorLegend::BottomTop, Qwt3D::FILLEDMESH, Qwt3D::GOURAUD, ColorLegend::Left, and Qwt3D::NOFLOOR.

~Plot3D ( )
virtual

Release allocated resources

Member Function Documentation

QPixmap renderPixmap ( int  w = 0,
int  h = 0,
bool  useContext = false 
)

Reimplemented from QGLWidget

void updateData ( )

Recalculate data.

Update OpenGL data representation

Referenced by Plot3D::initializeGL().

void createCoordinateSystem ( Qwt3D::Triple  beg,
Qwt3D::Triple  end 
)

Create a coordinate system with generating corners beg and end

void setPlotStyle ( Qwt3D::PLOTSTYLE  val)

Set plotstyle for the standard plotting types. An argument of value Qwt3D::USER is ignored.

References Qwt3D::USER.

Qwt3D::Enrichment * setPlotStyle ( Qwt3D::Enrichment const &  obj)

Set plotstyle to Qwt3D::USER and an associated enrichment object.

References Enrichment::clone(), and Qwt3D::USER.

Qwt3D::PLOTSTYLE plotStyle ( ) const
inline

Returns plotting style

void setShading ( Qwt3D::SHADINGSTYLE  val)

Set shading style

References Qwt3D::FLAT, and Qwt3D::GOURAUD.

void setIsolines ( int  steps)

Set number of isolines. The lines are equidistant between minimal and maximal Z value

void setDataColor ( Color col)

Sets new data color object.

assign a new coloring object for the data.

void showColorLegend ( bool  show)

Show a color legend

References ColorLegend::colors, and Color::createVector().

void setCoordinateStyle ( Qwt3D::COORDSTYLE  st)

Sets style of coordinate system.

Set style of coordinate system

References CoordinateSystem::setStyle().

void setPolygonOffset ( double  val)

Set Polygon offset. The function affects the OpenGL rendering process. Try different values for surfaces with polygons only and with mesh and polygons

void setTitlePosition ( double  rely,
double  relx = 0.5,
Qwt3D::ANCHOR  anchor = Qwt3D::TopCenter 
)

Set relative caption position (0.5,0.5) means, the anchor point lies in the center of the screen

References Tuple::x.

void setTitleFont ( const QString &  family,
int  pointSize,
int  weight = QFont::Normal,
bool  italic = false 
)

Set caption font

References Label::setFont().

void assignMouse ( MouseState  xrot,
MouseState  yrot,
MouseState  zrot,
MouseState  xscale,
MouseState  yscale,
MouseState  zscale,
MouseState  zoom,
MouseState  xshift,
MouseState  yshift 
)

Sets the key/mousebutton combination for data/coordinatesystem moves inside the widget

default behaviour:

rotate around x axis: Qt::LeftButton 
rotate around y axis: Qt::LeftButton | Qt::ShiftButton
rotate around z axis: Qt::LeftButton 
scale x:              Qt::LeftButton | Qt::AltButton 
scale y:              Qt::LeftButton | Qt::AltButton 
scale z:              Qt::LeftButton | Qt::AltButton | Qt::ShiftButton
zoom:                 Qt::LeftButton | Qt::AltButton | Qt::ControlButton
shifting along x:     Qt::LeftButton | Qt::ControlButton 
shifting along y:     Qt::LeftButton | Qt::ControlButton

mouseMoveEvent() evaluates this function - if overridden, their usefulness becomes somehow limited

void assignKeyboard ( KeyboardState  xrot_n,
KeyboardState  xrot_p,
KeyboardState  yrot_n,
KeyboardState  yrot_p,
KeyboardState  zrot_n,
KeyboardState  zrot_p,
KeyboardState  xscale_n,
KeyboardState  xscale_p,
KeyboardState  yscale_n,
KeyboardState  yscale_p,
KeyboardState  zscale_n,
KeyboardState  zscale_p,
KeyboardState  zoom_n,
KeyboardState  zoom_p,
KeyboardState  xshift_n,
KeyboardState  xshift_p,
KeyboardState  yshift_n,
KeyboardState  yshift_p 
)

Sets the keybutton combination for data/coordinatesystem moves inside the widget

default behaviour:

rotate around x axis: [Key_Down, Key_Up] 
rotate around y axis: SHIFT+[Key_Right, Key_Left]
rotate around z axis: [Key_Right, Key_Left] 
scale x:              ALT+[Key_Right, Key_Left] 
scale y:              ALT+[Key_Up, Key_Down] 
scale z:              ALT+SHIFT[Key_Down, Key_Up] 
zoom:                 ALT+CTRL+[Key_Down, Key_Up]
shifting along x:     CTRL+[Key_Right, Key_Left] 
shifting along z:     CTRL+[Key_Down, Key_Up]
bool keyboardEnabled ( ) const

Returns true, if the widget accept keyboard input from the user

void setKeySpeed ( double  rot,
double  scale,
double  shift 
)

Sets speed for keyboard driven transformations.

Values < 0 are ignored. Default is (3,5,5)

bool lightingEnabled ( ) const

Returns true, if Lighting is enabled, false else

void illuminate ( unsigned  light = 0)

Turn light on.

Parameters
lightlight number [0..7]
See Also
setLight
void blowout ( unsigned  light = 0)

Turn light off.

Parameters
lightlight number [0..7]
See Also
setLight
void setMaterialComponent ( GLenum  property,
double  r,
double  g,
double  b,
double  a = 1.0 
)

Sets GL material properties

Referenced by Plot3D::initializeGL(), and Plot3D::setMaterialComponent().

void setMaterialComponent ( GLenum  property,
double  intensity 
)

This function is for convenience. It sets GL material properties with the equal r,g,b values and a blending alpha with value 1.0

References Plot3D::setMaterialComponent().

void setShininess ( double  exponent)

Sets GL shininess

void setLightComponent ( GLenum  property,
double  r,
double  g,
double  b,
double  a = 1.0,
unsigned  light = 0 
)

Sets GL light properties for light 'light'

Referenced by Plot3D::initializeGL(), and Plot3D::setLightComponent().

void setLightComponent ( GLenum  property,
double  intensity,
unsigned  light = 0 
)

This function is for convenience. It sets GL light properties with the equal r,g,b values and a blending alpha with value 1.0

References Plot3D::setLightComponent().

void setRotation ( double  xVal,
double  yVal,
double  zVal 
)
slot

Set the rotation angle of the object. If you look along the respective axis towards ascending values, the rotation is performed in mathematical negative sense

Parameters
xValangle in degree to rotate around the X axis
yValangle in degree to rotate around the Y axis
zValangle in degree to rotate around the Z axis

References Plot3D::rotationChanged().

void setShift ( double  xVal,
double  yVal,
double  zVal 
)
slot

Set the shift in object (world) coordinates.

Parameters
xValshift along (world) X axis
yValshift along (world) Y axis
zValshift along (world) Z axis
See Also
setViewportShift()

References Plot3D::shiftChanged().

void setViewportShift ( double  xVal,
double  yVal 
)
slot

Performs shifting along screen axes. The shift moves points inside a sphere, which encloses the unscaled and unzoomed data by multiples of the spheres diameter

Parameters
xValshift along (view) X axis
yValshift along (view) Y axis
See Also
setShift()

References Plot3D::vieportShiftChanged().

void setScale ( double  xVal,
double  yVal,
double  zVal 
)
slot

Set the scale in object (world) coordinates.

Parameters
xValscaling for X values
yValscaling for Y values
zValscaling for Z values

A respective value of 1 represents no scaling;

References Plot3D::scaleChanged().

void setZoom ( double  val)
slot

Set the (zoom in addition to scale).

Parameters
valzoom value (value == 1 indicates no zooming)

References Plot3D::zoomChanged().

void setOrtho ( bool  val)
slot

Set up ortogonal or perspective mode and updates widget

References Plot3D::projectionChanged().

void enableMouse ( bool  val = true)
slot

Enable mouse input.

The function has no effect if you derive from Plot3D and overrides the mouse Function too careless. In this case check first against mouseEnabled() in your version of mouseMoveEvent() and wheelEvent(). A more fine grained input control can be achieved by combining assignMouse() with enableMouse().

void disableMouse ( bool  val = true)
slot

Disable mouse input.

See Also
enableMouse()
void enableKeyboard ( bool  val = true)
slot

Enable keyboard input.

The function has no effect if you derive from Plot3D and overrides the keyboard Functions too careless. In this case check first against keyboardEnabled() in your version of keyPressEvent() A more fine grained input control can be achieved by combining assignKeyboard() with enableKeyboard().

void disableKeyboard ( bool  val = true)
slot

Disable keyboard input.

See Also
enableKeyboard()
void setLightRotation ( double  xVal,
double  yVal,
double  zVal,
unsigned int  idx = 0 
)
slot

Set the rotation angle of the light source. If you look along the respective axis towards ascending values, the rotation is performed in mathematical negative sense

Parameters
xValangle in degree to rotate around the X axis
yValangle in degree to rotate around the Y axis
zValangle in degree to rotate around the Z axis
lightlight number
void setLightShift ( double  xVal,
double  yVal,
double  zVal,
unsigned int  idx = 0 
)
slot

Set the shift in light source (world) coordinates.

Parameters
xValshift along (world) X axis
yValshift along (world) Y axis
zValshift along (world) Z axis
lightlight number
See Also
setViewportShift()

Referenced by Plot3D::initializeGL().

bool savePixmap ( QString const &  fileName,
QString const &  format 
)
virtualslot

Saves content to pixmap format

Deprecated:
Use Plot3D::save or IO::save instead.

Saves the framebuffer to the file fileName using one of the image file formats supported by Qt.

References IO::save().

bool saveVector ( QString const &  fileName,
QString const &  format,
VectorWriter::TEXTMODE  textmode,
VectorWriter::SORTMODE  sortmode 
)
virtualslot

Saves content to vector format.

Deprecated:
Use Plot3D::save or IO::save instead.

Writes vector data supported by gl2ps. The corresponding format types are "EPS","PS", "PDF", "SVG", or "PGF". If zlib has been configured this will be extended by "EPS_GZ", "PS_GZ" and "SVG_GZ". Beware: BSPSORT turns out to behave very slowly and memory consuming, especially in cases where many polygons appear. It is still more exact than SIMPLESORT.

References IO::outputHandler(), IO::save(), VectorWriter::setSortMode(), and VectorWriter::setTextMode().

bool save ( QString const &  fileName,
QString const &  format 
)
virtualslot

Saves content.

Saves content in one of the registered output formats. To modify the behaviour for more complex output handling use IO::outputHandler.

References IO::save().

void initializeGL ( )
protected
void paintGL ( )
protected

Paint the widgets content.

References ColorLegend::draw(), Label::draw(), Label::setRelPosition(), and Triple::x.

Referenced by Plot3D::resizeGL().

void resizeGL ( int  w,
int  h 
)
protected

Set up the OpenGL view port

References Plot3D::paintGL().

void mousePressEvent ( QMouseEvent *  e)
protected

Standard mouse button Function. Prepares the call to mouseMoveEvent

See Also
mouseMoveEvent()
void mouseReleaseEvent ( QMouseEvent *  e)
protected

Standard mouse button Function. Completes the call to mouseMoveEvent

See Also
mouseMoveEvent()
void mouseMoveEvent ( QMouseEvent *  e)
protected

Standard mouse button Function

See Also
assignMouse()
void wheelEvent ( QWheelEvent *  e)
protected

Standard wheel Function - zoom (wheel only) or z-scale (shift+wheel)

void createCoordinateSystem ( )
protected

Create a coordinate system from data

References Plot3D::hull().


The documentation for this class was generated from the following files: