QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
| Public 类型 | Public 成员函数 | 所有成员列表
Qwt3DBar类 参考

3D bar chart item with VBO/VAO rendering 更多...

#include <qwt3d_bar.h>

类 Qwt3DBar 继承关系图:
Qwt3DPlotItem

class  PrivateData
 

Public 类型

enum  BarStyle { Filled , FilledMesh , Wireframe }
 Bar rendering style 更多...
 

Public 成员函数

 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 Qwt3DColordataColor () 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< QwtPoint3Dsamples () 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 成员函数 继承自 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
 
Qwt3DPlotplot () 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.

auto plot = new Qwt3DPlot(parent);
auto bars = new Qwt3DBar();
bars->setSamples(zMatrix, columns, rows, minX, maxX, minY, maxY);
bars->setBarStyle(Qwt3DBar::FilledMesh);
bars->setDataColor(new Qwt3DColorMapColor("viridis"));
bars->attach(plot);
Qwt3DBar()
Constructs an empty bar chart item
Definition qwt3d_bar.cpp:187
@ FilledMesh
Filled bars with separately colored edge lines
Definition qwt3d_bar.h:56
Adapts a QwtColorMap (from qwt::core) for use as a Qwt3DColor.
Definition qwt3d_colormap_color.h:26
Qwt3DPlot * plot() const
Get the plot this item is attached to
Definition qwt3d_plotitem.cpp:84
Pure rendering window for 3D plots
Definition qwt3d_plot.h:36
参见
Qwt3DPlotItem, Qwt3DPlot, Qwt3DColor

成员枚举类型说明

◆ BarStyle

Bar rendering style

枚举值
Filled 

Filled bars, no edges

FilledMesh 

Filled bars with separately colored edge lines

Wireframe 

Edge lines only

成员函数说明

◆ draw()

void Qwt3DBar::draw ( )
overridevirtual

Draw the item using the current GL context

实现了 Qwt3DPlotItem.

◆ hull()

ParallelEpiped Qwt3DBar::hull ( ) const
overridevirtual

Get the bounding hull of the item in 3D space

实现了 Qwt3DPlotItem.

◆ populateLegendColors()

void Qwt3DBar::populateLegendColors ( ColorVector &  colors) const
overridevirtual

Populate the legend color vector from the item's color functor

重载 Qwt3DPlotItem .

◆ rtti()

int Qwt3DBar::rtti ( ) const
overridevirtual

运行时类型信息

返回
Rtti_Plot3DBar (= 1002)

重载 Qwt3DPlotItem .

◆ samples()

QVector< QwtPoint3D > Qwt3DBar::samples ( ) const

Returns 1D bar samples (empty if 2D grid data was loaded)

Reconstructs QVector<QwtPoint3D> from internal bar specs.


该类的文档由以下文件生成: