QWT API (English) 7.3.0
Qt Widget Library for Technical Applications - English API Documentation
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
Qwt3DPlotItem Class Referenceabstract

Base class for all 3D plot items. More...

#include <qwt3d_plotitem.h>

Inheritance diagram for Qwt3DPlotItem:
Qwt3DBar Qwt3DLine Qwt3DSurface

Classes

class  PrivateData
 

Public Member Functions

 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.
 
virtual void draw ()=0
 Draw the item using the current GL context.
 
virtual ParallelEpiped hull () const =0
 Get the bounding hull of the item in 3D space.
 
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 int rtti () const
 Runtime type information.
 
virtual void itemChanged ()
 Notify the plot that the item has changed.
 
virtual void populateLegendColors (ColorVector &colors) const
 Populate the legend color vector from the item's color functor.
 

Detailed Description

Base class for all 3D plot items.

A Qwt3DPlotItem is "something", that can be drawn within the GL context of a Qwt3DPlot widget. Items are not widgets themselves; they are pure data + drawing logic objects that are attached to a Qwt3DPlot via attach() and rendered during Qwt3DPlot::paintGL().

The rendering pipeline calls draw() for each attached item in order of ascending z-value. Items manage their own data, geometry caching (VBO/VAO), and color/style. The view transformation, projection, and lighting are set up by Qwt3DPlot before draw() is called.

To implement a custom 3D plot item, derive from Qwt3DPlotItem and implement the pure virtual draw() and hull() methods:

class MyItem : public Qwt3DPlotItem
{
public:
void draw() override
{
// Issue GL drawing calls using the current GL context
}
ParallelEpiped hull() const override
{
return m_hull;
}
private:
};
// Usage:
auto plot = new Qwt3DPlot(parent);
auto item = new MyItem();
item->attach(plot);
Base class for all 3D plot items.
Definition qwt3d_plotitem.h:55
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
Parallelepiped spanned by 2 Triples.
Definition qwt3d_types.h:334
See also
Qwt3DPlot, QwtPlotItem (2D counterpart)

Constructor & Destructor Documentation

◆ Qwt3DPlotItem()

Qwt3DPlotItem::Qwt3DPlotItem ( )

Default constructor.

Constructs a Qwt3DPlotItem with default settings.

Destructor

Destroys the Qwt3DPlotItem and detaches it from any plot.

Member Function Documentation

◆ attach()

void Qwt3DPlotItem::attach ( Qwt3DPlot plot)

Attach the item to a plot.

Parameters
[in]plotPlot widget to attach to

This method attaches a Qwt3DPlotItem to the Qwt3DPlot argument. It will first detach the Qwt3DPlotItem from any plot from a previous call to attach (if necessary). If a nullptr argument is passed, it will detach from any Qwt3DPlot it was attached to.

◆ detach()

void Qwt3DPlotItem::detach ( )

Detach the item from its plot.

Detach the item from the plot.

This method detaches a Qwt3DPlotItem from any Qwt3DPlot it has been associated with. detach() is equivalent to calling attach(nullptr).

◆ draw()

virtual void Qwt3DPlotItem::draw ( )
pure virtual

Draw the item using the current GL context.

Implemented in Qwt3DBar, Qwt3DLine, and Qwt3DSurface.

◆ hull()

virtual ParallelEpiped Qwt3DPlotItem::hull ( ) const
pure virtual

Get the bounding hull of the item in 3D space.

Implemented in Qwt3DBar, Qwt3DLine, and Qwt3DSurface.

◆ isVisible()

bool Qwt3DPlotItem::isVisible ( ) const

Check if the item is visible.

Returns
true if visible, false otherwise
See also
setVisible()

◆ itemChanged()

void Qwt3DPlotItem::itemChanged ( )
virtual

Notify the plot that the item has changed.

Triggers a plot update so the item is redrawn.

◆ plot()

Qwt3DPlot * Qwt3DPlotItem::plot ( ) const

Get the plot this item is attached to.

Get the plot the item is attached to.

Returns
Attached plot, or nullptr if not attached

◆ populateLegendColors()

void Qwt3DPlotItem::populateLegendColors ( ColorVector &  colors) const
virtual

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

Reimplemented in Qwt3DBar, Qwt3DLine, and Qwt3DSurface.

◆ rtti()

int Qwt3DPlotItem::rtti ( ) const
virtual

Runtime type information.

运行时类型信息

Returns
返回 Rtti_Plot3DItem (= 0),子类应 override 此方法返回各自的 RTTI 值

用于运行时类型识别,支持安全向下转型、设置面板工厂路由和序列化分发。 设计与 2D QwtPlotItem::rtti() 完全对齐。

See also
Rtti3DValues, QwtPlotItem::rtti()

Reimplemented in Qwt3DBar, Qwt3DLine, and Qwt3DSurface.

◆ setTitle()

void Qwt3DPlotItem::setTitle ( const QString &  title)

Set the item title.

Parameters
[in]titleTitle text
See also
title()

◆ setVisible()

void Qwt3DPlotItem::setVisible ( bool  on)

Set item visibility.

Parameters
[in]onShow if true, otherwise hide
See also
isVisible()

◆ setZ()

void Qwt3DPlotItem::setZ ( double  z)

Set the z-order value (controls draw sequence)

Set the z-order value.

Parameters
[in]zZ-value for the item

Plot items are drawn in increasing z-order.

See also
z()

◆ title()

QString Qwt3DPlotItem::title ( ) const

Get the item title.

Get the title of the item.

Returns
Title of the item
See also
setTitle()

◆ z()

double Qwt3DPlotItem::z ( ) const

Get the z-order value.

Returns
Z-value of the item

Plot items are drawn in increasing z-order.

See also
setZ()

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