QWT API (English) 7.3.0
Qt Widget Library for Technical Applications - English API Documentation
Loading...
Searching...
No Matches
Classes | Public Slots | Signals | Public Member Functions | Protected Types | Protected Member Functions | List of all members
Qwt3D::Plot3D Class Referenceabstract

Base class for all plotting widgets. More...

#include <qwt3d_plot.h>

Inheritance diagram for Qwt3D::Plot3D:
Qwt3D::GraphPlot Qwt3D::MultiPlot Qwt3D::SurfacePlot Qwt3D::VolumePlot

Classes

class  PrivateData
 

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)
 Sets up orthogonal or perspective mode and updates widget.
 
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)
 Saves the framebuffer to an image file.
 
virtual bool saveVector (QString const &fileName, QString const &format, VectorWriter::TEXTMODE text, VectorWriter::SORTMODE sortmode)
 Writes vector data supported by gl2ps.
 
virtual bool save (QString const &fileName, QString const &format)
 Saves content in one of the registered output formats.
 

Signals

void rotationChanged (double xAngle, double yAngle, double zAngle)
 Signal emitted when the rotation is changed.
 
void shiftChanged (double xShift, double yShift, double zShift)
 Signal emitted when the shift is changed.
 
void vieportShiftChanged (double xShift, double yShift)
 Signal emitted when the viewport shift is changed.
 
void scaleChanged (double xScale, double yScale, double zScale)
 Signal emitted when the scaling is changed.
 
void zoomChanged (double)
 Signal emitted when the zoom is changed.
 
void projectionChanged (bool)
 Signal emitted when the projection mode is changed.
 

Public Member Functions

 Plot3D (QWidget *parent=nullptr)
 Constructs a Plot3D widget.
 
QPixmap renderPixmap (int w=0, int h=0, bool useContext=false)
 
void updateData ()
 Updates OpenGL data representation.
 
void createCoordinateSystem (Qwt3D::Triple beg, Qwt3D::Triple end)
 Creates a coordinate system with generating corners beg and 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)
 Sets plot style for the standard plotting types.
 
Qwt3D::EnrichmentsetPlotStyle (Qwt3D::Enrichment const &val)
 Sets plot style to Qwt3D::USER with an associated enrichment object.
 
Qwt3D::PLOTSTYLE plotStyle () const
 
Qwt3D::EnrichmentuserStyle () const
 
void setShading (Qwt3D::SHADINGSTYLE val)
 Sets shading style.
 
Qwt3D::SHADINGSTYLE shading () const
 
void setIsolines (int isolines)
 Sets number of isolines.
 
int isolines () const
 
void setSmoothMesh (bool val)
 
bool smoothDataMesh () const
 
void setBackgroundColor (Qwt3D::RGBA rgba)
 Sets the background color.
 
Qwt3D::RGBA backgroundRGBAColor () const
 
void setMeshColor (Qwt3D::RGBA rgba)
 Sets the mesh color.
 
Qwt3D::RGBA meshColor () const
 
void setMeshLineWidth (double lw)
 Sets the mesh line width.
 
double meshLineWidth () const
 
void setDataColor (Color *col)
 Assigns a new coloring object for the data.
 
const ColordataColor () const
 
virtual Qwt3D::EnrichmentaddEnrichment (Qwt3D::Enrichment const &)
 Adds an enrichment object to the plot.
 
virtual bool degrade (Qwt3D::Enrichment *)
 Removes an enrichment object from the plot.
 
Qwt3D::ParallelEpiped hull () const
 
void showColorLegend (bool)
 Shows or hides the color legend.
 
void setCoordinateStyle (Qwt3D::COORDSTYLE st)
 Sets style of coordinate system.
 
void setPolygonOffset (double d)
 Sets polygon offset.
 
double polygonOffset () const
 
void setTitlePosition (double rely, double relx=0.5, Qwt3D::ANCHOR=Qwt3D::TopCenter)
 Sets relative caption position.
 
void setTitleFont (const QString &family, int pointSize, int weight=QFont::Normal, bool italic=false)
 Sets the caption font.
 
void setTitleColor (Qwt3D::RGBA col)
 
void setTitle (const QString &title)
 
void setTheme (const Qwt3DTheme &theme)
 
Qwt3DTheme theme () const
 
void applyTheme (Qwt3DTheme::Preset preset)
 
void applyTheme (const QString &presetName)
 
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 }
 
using EnrichmentList = std::list< Qwt3D::Enrichment * >
 
using ELIT = EnrichmentList::iterator
 

Protected Member Functions

void initializeGL () override
 Sets up the OpenGL rendering state.
 
void paintGL () override
 Paints the widget's content.
 
void resizeGL (int w, int h) override
 Sets up the OpenGL view port.
 
void mousePressEvent (QMouseEvent *e) override
 
void mouseReleaseEvent (QMouseEvent *e) override
 
void mouseMoveEvent (QMouseEvent *e) override
 
void wheelEvent (QWheelEvent *e) override
 
void keyPressEvent (QKeyEvent *e) override
 
std::vector< GLuint > & displayLists ()
 
Qwt3D::DataactualData () const
 
void setActualData (Qwt3D::Data *data)
 
virtual void calculateHull ()=0
 
virtual void createData ()=0
 
virtual void createEnrichment (Qwt3D::Enrichment &)
 
virtual void createEnrichments ()
 
void createCoordinateSystem ()
 Creates a coordinate system from data.
 
void setHull (Qwt3D::ParallelEpiped p)
 
bool initializedGL () const
 

Detailed Description

Base class for all plotting widgets.

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()

Plot3D::Plot3D ( QWidget *  parent = nullptr)

Constructs a Plot3D widget.

Parameters
parentParent widget

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

Destructor - releases allocated resources

Member Function Documentation

◆ addEnrichment()

Enrichment * Plot3D::addEnrichment ( Qwt3D::Enrichment const &  e)
virtual

Adds an enrichment object to the plot.

Parameters
eReference to an Enrichment object
Returns
Pointer to the cloned enrichment object added to the list

◆ assignKeyboard()

void Plot3D::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]

◆ assignMouse()

void Plot3D::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\n\n
 default behaviour:\n

 @verbatim
 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
 @endverbatim

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

limited

◆ blowout()

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

◆ calculateHull()

virtual void Qwt3D::Plot3D::calculateHull ( )
protectedpure virtual

Implemented in Qwt3D::SurfacePlot.

◆ createCoordinateSystem() [1/2]

void Plot3D::createCoordinateSystem ( )
protected

Creates a coordinate system from data.

Calculates the hull first, then creates the coordinate system from hull boundaries.

◆ createCoordinateSystem() [2/2]

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

Creates a coordinate system with generating corners beg and end.

Parameters
begMinimum vertex of the coordinate system
endMaximum vertex of the coordinate system

◆ degrade()

bool Plot3D::degrade ( Qwt3D::Enrichment e)
virtual

Removes an enrichment object from the plot.

Parameters
ePointer to the Enrichment object to remove
Returns
True if the enrichment was found and removed, false otherwise

◆ disableKeyboard

void Plot3D::disableKeyboard ( bool  val = true)
slot

◆ disableMouse

void Plot3D::disableMouse ( bool  val = true)
slot
See also
enableMouse()

◆ enableKeyboard

void Plot3D::enableKeyboard ( bool  val = true)
slot

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().

◆ enableMouse

void Plot3D::enableMouse ( bool  val = true)
slot

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().

◆ illuminate()

void Plot3D::illuminate ( unsigned  light = 0)
Parameters
lightlight number [0..7]
See also
setLight

◆ mouseMoveEvent()

void Plot3D::mouseMoveEvent ( QMouseEvent *  e)
overrideprotected

Standard mouse button Function

See also
assignMouse()

◆ mousePressEvent()

void Plot3D::mousePressEvent ( QMouseEvent *  e)
overrideprotected

Standard mouse button Function. Prepares the call to mouseMoveEvent

See also
mouseMoveEvent()

◆ mouseReleaseEvent()

void Plot3D::mouseReleaseEvent ( QMouseEvent *  e)
overrideprotected

Standard mouse button Function. Completes the call to mouseMoveEvent

See also
mouseMoveEvent()

◆ projectionChanged

void Qwt3D::Plot3D::projectionChanged ( bool  )
signal

Signal emitted when the projection mode is changed.

Parameters
orthoTrue for orthogonal, false for perspective

◆ resizeGL()

void Plot3D::resizeGL ( int  w,
int  h 
)
overrideprotected

Sets up the OpenGL view port.

Parameters
wNew width
hNew height

◆ rotationChanged

void Qwt3D::Plot3D::rotationChanged ( double  xAngle,
double  yAngle,
double  zAngle 
)
signal

Signal emitted when the rotation is changed.

Parameters
xAngleX axis rotation angle
yAngleY axis rotation angle
zAngleZ axis rotation angle

◆ save

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

Saves content in one of the registered output formats.

Parameters
fileNameOutput file name
formatOutput format string
Returns
True on success

To modify the behaviour for more complex output handling use IO::outputHandler.

◆ savePixmap

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

Saves the framebuffer to an image file.

Parameters
fileNameOutput file name
formatImage file format supported by Qt
Returns
True on success
Deprecated:
Use Plot3D::save or IO::save instead.

◆ saveVector

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

Writes vector data supported by gl2ps.

Parameters
fileNameOutput file name
formatOutput format ("EPS", "PS", "PDF", "SVG", or "PGF")
textText handling mode
sortmodeSort mode for polygon ordering
Returns
True on success
Deprecated:
Use Plot3D::save or IO::save instead.

If zlib has been configured, format types will be extended by "EPS_GZ" and "PS_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.

◆ scaleChanged

void Qwt3D::Plot3D::scaleChanged ( double  xScale,
double  yScale,
double  zScale 
)
signal

Signal emitted when the scaling is changed.

Parameters
xScaleX axis scale factor
yScaleY axis scale factor
zScaleZ axis scale factor

◆ setBackgroundColor()

void Plot3D::setBackgroundColor ( Qwt3D::RGBA  rgba)

Sets the background color.

Parameters
rgbaBackground color as RGBA value

◆ setCoordinateStyle()

void Plot3D::setCoordinateStyle ( Qwt3D::COORDSTYLE  st)

Sets style of coordinate system.

Parameters
stCoordinate system style (NOCOORD, BOX, or FRAME)

◆ setDataColor()

void Plot3D::setDataColor ( Color col)

Assigns a new coloring object for the data.

Parameters
colPointer to a new Color object

◆ setIsolines()

void Plot3D::setIsolines ( int  steps)

Sets number of isolines.

Parameters
stepsNumber of isolines. The lines are equidistant between minimal and maximal Z value.

◆ setKeySpeed()

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

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

◆ setLightComponent() [1/2]

void Plot3D::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

◆ setLightComponent() [2/2]

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

Sets GL light properties for light 'light'

◆ setLightRotation

void Plot3D::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

◆ setLightShift

void Plot3D::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()

◆ setMaterialComponent() [1/2]

void Plot3D::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

◆ setMaterialComponent() [2/2]

void Plot3D::setMaterialComponent ( GLenum  property,
double  r,
double  g,
double  b,
double  a = 1.0 
)

Sets GL material properties

◆ setMeshColor()

void Plot3D::setMeshColor ( Qwt3D::RGBA  rgba)

Sets the mesh color.

Parameters
rgbaMesh color as RGBA value

◆ setMeshLineWidth()

void Plot3D::setMeshLineWidth ( double  val)

Sets the mesh line width.

Parameters
valLine width value (must be >= 0)

◆ setOrtho

void Plot3D::setOrtho ( bool  val)
slot

Sets up orthogonal or perspective mode and updates widget.

Parameters
valTrue for orthogonal projection, false for perspective

◆ setPlotStyle() [1/2]

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

Sets plot style to Qwt3D::USER with an associated enrichment object.

Parameters
objReference to an Enrichment object
Returns
Pointer to the cloned enrichment object

◆ setPlotStyle() [2/2]

void Plot3D::setPlotStyle ( Qwt3D::PLOTSTYLE  val)

Sets plot style for the standard plotting types.

Parameters
valPlot style value. An argument of value Qwt3D::USER is ignored.

◆ setPolygonOffset()

void Plot3D::setPolygonOffset ( double  val)

Sets polygon offset.

Parameters
valPolygon offset value

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

◆ setRotation

void Plot3D::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

◆ setScale

void Plot3D::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;

◆ setShading()

void Plot3D::setShading ( Qwt3D::SHADINGSTYLE  val)

Sets shading style.

Parameters
valShading style (FLAT or GOURAUD)

◆ setShift

void Plot3D::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()

◆ setShininess()

void Plot3D::setShininess ( double  exponent)

Sets GL shininess

◆ setTitleFont()

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

Sets the caption font.

Parameters
familyFont family name
pointSizeFont point size
weightFont weight
italicWhether font is italic

◆ setTitlePosition()

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

Sets relative caption position.

Parameters
relyRelative Y position (0-1). (0.5,0.5) means the anchor point lies in the center of the screen.
relxRelative X position (0-1)
anchorAnchor type for title alignment

◆ setViewportShift

void Plot3D::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()

◆ setZoom

void Plot3D::setZoom ( double  val)
slot

Set the (zoom in addition to scale).

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

◆ shiftChanged

void Qwt3D::Plot3D::shiftChanged ( double  xShift,
double  yShift,
double  zShift 
)
signal

Signal emitted when the shift is changed.

Parameters
xShiftX axis shift value
yShiftY axis shift value
zShiftZ axis shift value

◆ showColorLegend()

void Plot3D::showColorLegend ( bool  show)

Shows or hides the color legend.

Parameters
showTrue to show, false to hide

◆ vieportShiftChanged

void Qwt3D::Plot3D::vieportShiftChanged ( double  xShift,
double  yShift 
)
signal

Signal emitted when the viewport shift is changed.

Parameters
xShiftX viewport shift value
yShiftY viewport shift value

◆ wheelEvent()

void Plot3D::wheelEvent ( QWheelEvent *  e)
overrideprotected

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

◆ zoomChanged

void Qwt3D::Plot3D::zoomChanged ( double  )
signal

Signal emitted when the zoom is changed.

Parameters
zoomZoom factor

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