|
QWT API (English) 7.3.0
Qt Widget Library for Technical Applications - English API Documentation
|
3D bar chart item with VBO/VAO rendering More...
#include <qwt3d_bar.h>
Classes | |
| class | PrivateData |
Public Types | |
| enum | BarStyle { Filled , FilledMesh , Wireframe } |
| Bar rendering style. More... | |
Public Member Functions | |
| Qwt3DBar () | |
| Constructs an empty bar chart item. | |
| ~Qwt3DBar () override | |
| Destructor — releases GL resources and data. | |
| void | setSamples (const QVector< QwtPoint3D > &samples) |
| Set bar positions and heights from 3D points (x,y = footprint center, z = height) | |
| void | setSamples (const QVector< double > &x, const QVector< double > &heights) |
| Set bar positions (x) and heights along the y = 0 row. | |
| void | setSamples (double **z, int columns, int rows, double minX, double maxX, double minY, double maxY) |
| Set a grid of bars from a z-value matrix with an explicit x/y domain. | |
| void | setSamples (const Qwt3DFunctionData &data) |
| Set a grid of bars from a Qwt3DFunctionData result (modern vector API) | |
| double | barWidth () const |
| Returns the bar footprint width (<= 0 means auto) | |
| void | setBarWidth (double w) |
| Sets the bar footprint width (<= 0 selects auto = 80% of spacing) | |
| double | barDepth () const |
| Returns the bar footprint depth (<= 0 means auto) | |
| void | setBarDepth (double d) |
| Sets the bar footprint depth (<= 0 selects auto = 80% of spacing) | |
| double | baseline () const |
| Returns the baseline z value (bottom of positive bars) | |
| void | setBaseline (double z) |
| Sets the baseline z value. | |
| BarStyle | barStyle () const |
| Returns the bar rendering style. | |
| void | setBarStyle (BarStyle style) |
| Sets the bar rendering style. | |
| void | setDataColor (Qwt3DColor *color) |
| Sets the data color functor (takes ownership) | |
| const Qwt3DColor * | dataColor () const |
| Returns the data color functor. | |
| void | invalidateColors () |
| Marks per-vertex colors as stale, triggering a VBO rebuild on the next draw. | |
| RGBA | meshColor () const |
| Returns the mesh line color. | |
| void | setMeshColor (RGBA color) |
| Sets the mesh line color. | |
| double | meshLineWidth () const |
| Returns the mesh line width. | |
| void | setMeshLineWidth (double width) |
| Sets the mesh line width. | |
| int | rtti () const override |
| 运行时类型信息 | |
| void | draw () override |
| Draw the item using the current GL context. | |
| ParallelEpiped | hull () const override |
| Get the bounding hull of the item in 3D space. | |
| void | populateLegendColors (ColorVector &colors) const override |
| Populate the legend color vector from the item's color functor. | |
| QVector< QwtPoint3D > | samples () const |
| Returns 1D bar samples (empty if 2D grid data was loaded) | |
| bool | isGridData () const |
| Returns true if 2D grid data was loaded. | |
| int | gridColumns () const |
| Returns grid columns (valid only if isGridData()) | |
| int | gridRows () const |
| Returns grid rows (valid only if isGridData()) | |
| double | gridMinX () const |
| Returns grid x minimum (valid only if isGridData()) | |
| double | gridMaxX () const |
| Returns grid x maximum (valid only if isGridData()) | |
| double | gridMinY () const |
| Returns grid y minimum (valid only if isGridData()) | |
| double | gridMaxY () const |
| Returns grid y maximum (valid only if isGridData()) | |
| std::vector< std::vector< double > > | gridZValues () const |
| Returns the raw z matrix (valid only if isGridData(), empty otherwise) | |
Public Member Functions inherited from Qwt3DPlotItem | |
| Qwt3DPlotItem () | |
| Default constructor. | |
| virtual | ~Qwt3DPlotItem () |
| Destructor — detaches from any plot. | |
| void | attach (Qwt3DPlot *plot) |
| Attach the item to a plot. | |
| void | detach () |
| Detach the item from its plot. | |
| Qwt3DPlot * | plot () const |
| Get the plot this item is attached to. | |
| void | setTitle (const QString &title) |
| Set the item title. | |
| QString | title () const |
| Get the item title. | |
| void | setZ (double z) |
| Set the z-order value (controls draw sequence) | |
| double | z () const |
| Get the z-order value. | |
| void | setVisible (bool on) |
| Set item visibility. | |
| bool | isVisible () const |
| Check if the item is visible. | |
| virtual void | itemChanged () |
| Notify the plot that the item has changed. | |
3D bar chart item with VBO/VAO rendering
Qwt3DBar is a Qwt3DPlotItem that renders 3D bar chart data using modern OpenGL (VBO/VAO + GLSL shaders). Each sample becomes an axis-aligned cuboid ("bar") whose height encodes the scalar value.
Two data shapes are supported:
The item manages its own bar specifications, color mapping, and GL resources (VBO, VAO, EBO, shader program). Geometry is uploaded to GPU memory when dirty and reused across frames until the data changes.
Bars reuse the lit surface shader (Blinn-Phong) with flat per-face normals, so they respond to Qwt3DPlot::enableLighting(). An optional edge mesh is drawn in a second pass for the FilledMesh / Wireframe styles.
| enum Qwt3DBar::BarStyle |
|
overridevirtual |
Draw the item using the current GL context.
Implements Qwt3DPlotItem.
|
overridevirtual |
Get the bounding hull of the item in 3D space.
Implements Qwt3DPlotItem.
|
overridevirtual |
Populate the legend color vector from the item's color functor.
Reimplemented from Qwt3DPlotItem.
|
overridevirtual |
| QVector< QwtPoint3D > Qwt3DBar::samples | ( | ) | const |
Returns 1D bar samples (empty if 2D grid data was loaded)
Reconstructs QVector<QwtPoint3D> from internal bar specs.