10#include "qwt_plot_spectrocurve.h"
11#include "qwt_color_map.h"
12#include "qwt_scale_map.h"
13#include "qwt_painter.h"
18class QwtPlotSpectroCurve::PrivateData
22 : colorRange( 0.0, 1000.0 )
70void QwtPlotSpectroCurve::init()
75 m_data =
new PrivateData;
97 m_data->paintAttributes |= attribute;
99 m_data->paintAttributes &= ~attribute;
108 return ( m_data->paintAttributes & attribute );
151 delete m_data->colorMap;
165 return m_data->colorMap;
178 if ( interval != m_data->colorRange )
180 m_data->colorRange = interval;
193 return m_data->colorRange;
222 return m_data->penWidth;
240 const QRectF& canvasRect,
int from,
int to )
const
254 drawDots( painter, xMap, yMap, canvasRect, from, to );
272 const QRectF& canvasRect,
int from,
int to )
const
274 if ( !m_data->colorRange.
isValid() )
285 for (
int i = from; i <= to; i++ )
299 if ( !canvasRect.contains( xi, yi ) )
305 const QRgb rgb = m_data->colorMap->
rgb(
306 m_data->colorRange,
sample.
z() );
308 painter->setPen( QPen( QColor::fromRgba( rgb ), m_data->penWidth ) );
312 const unsigned char index = m_data->colorMap->
colorIndex(
313 256, m_data->colorRange,
sample.
z() );
315 painter->setPen( QPen( QColor::fromRgba( m_data->colorTable[index] ),
316 m_data->penWidth ) );
322 m_data->colorTable.clear();
Template class for data, that is organized as QVector.
QwtColorMap is used to map values into colors.
virtual uint colorIndex(int numColors, const QwtInterval &interval, double value) const
Map a value of a given interval into a color index.
@ RGB
The map is intended to map into RGB values.
virtual QVector< QRgb > colorTable256() const
virtual QRgb rgb(const QwtInterval &interval, double value) const =0
A class representing an interval.
QwtLinearColorMap builds a color map from color stops.
static void drawPoint(QPainter *, const QPoint &)
Wrapper for QPainter::drawPoint()
static bool roundingAlignment()
virtual void legendChanged()
void setZ(double z)
Set the z value.
void setItemAttribute(ItemAttribute, bool on=true)
@ Rtti_PlotSpectroCurve
For QwtPlotSpectroCurve.
virtual void itemChanged()
@ Legend
The item is represented on the legend.
Base class for plot items representing a series of samples.
Curve that displays 3D points as dots, where the z coordinate is mapped to a color.
void setColorRange(const QwtInterval &)
virtual void drawSeries(QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const override
const QwtColorMap * colorMap() const
void setPaintAttribute(PaintAttribute, bool on=true)
void setSamples(const QVector< QwtPoint3D > &)
void setColorMap(QwtColorMap *)
virtual ~QwtPlotSpectroCurve()
Destructor.
virtual void drawDots(QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const
QwtInterval & colorRange() const
QwtPlotSpectroCurve(const QString &title=QString())
virtual int rtti() const override
bool testPaintAttribute(PaintAttribute) const
PaintAttribute
Paint attributes.
@ ClipPoints
Clip points outside the canvas rectangle.
QFlags< PaintAttribute > PaintAttributes
QwtPoint3D class defines a 3D point in double coordinates.
double transform(double s) const
virtual T sample(size_t i) const =0
QwtPoint3D sample(int index) const
virtual size_t dataSize() const override
QwtSeriesData< QwtPoint3D > * data()
void setData(QwtSeriesData< QwtPoint3D > *series)
A class representing a text.