##// END OF EJS Templates
improvements in execution time, colorbar ok, more work to do on axes,
improvements in execution time, colorbar ok, more work to do on axes,

File last commit:

r3:ab1c9ba54a31 default
r3:ab1c9ba54a31 default
Show More
colormapchart_p.h
127 lines | 3.3 KiB | text/x-c | CLexer
#ifndef COLORMAPCHART_H
#define COLORMAPCHART_H
#include "point3d.h"
#include <QtCharts/QChartGlobal>
#include <private/chartitem_p.h>
#include <QtCharts/QValueAxis>
#include <QtGui/QPen>
//#include <QtCharts/QColorBarAxis> TODO : fix this
#include "qcolorbaraxis.h"
QT_CHARTS_BEGIN_NAMESPACE
class ChartPresenter;
class QColorMapSeries;
class ColorMapChart : public ChartItem
{
Q_OBJECT
public:
enum GradientType
{
Rainbow,
CyclingRainbow,
BlackAndWhite,
ReverseBlackAndWhite
};
explicit ColorMapChart(QColorMapSeries *series,QGraphicsItem *item = 0);
~ColorMapChart() {}
bool isDirty() const { return m_dirty; }
void setDirty(bool dirty);
// from QGraphicsItem
QRectF boundingRect() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
public Q_SLOTS:
void handlePointAdded(int index);
void handlePointRemoved(int index);
void handlePointsRemoved(int index, int count);
void handlePointReplaced(int index);
void handlePointsReplaced();
void handleDomainUpdated();
private slots :
void populateColorTable();
Q_SIGNALS:
void clicked(const Point3D &point);
void hovered(const Point3D &point, bool state);
void pressed(const Point3D &point);
void released(const Point3D &point);
void doubleClicked(const Point3D &point);
void gradientTypeChanged();
private:
inline bool isEmpty();
void addColorBar(QRectF plotAreaRect);
QLinearGradient createColorMapGradient(GradientType gradientType);
void changeGradient(GradientType gradientType);
protected:
QColorMapSeries *m_series;
QVector<Point3D> m_points;
QRectF m_rect;
bool m_dirty;
QVector<QRgb> *m_colorTable;
GradientType m_gradientType;
bool m_isColorBarDrawn;
QColorBarAxis *m_colorbar;
};
//class PixmapMarker: public QGraphicsRectItem
//{
//public:
// PixmapMarker(qreal x, qreal y, qreal w, qreal h, ColorMapChart *parent)
// : QGraphicsRectItem(x, y, w, h, parent),
// m_parent(parent)
// {
// setAcceptHoverEvents(true);
// setFlag(QGraphicsItem::ItemIsSelectable);
// }
//protected:
// void mousePressEvent(QGraphicsSceneMouseEvent *event)
// {
// QGraphicsRectItem::mousePressEvent(event);
// m_parent->markerPressed(this);
// m_parent->setMousePressed();
// }
// void hoverEnterEvent(QGraphicsSceneHoverEvent *event)
// {
// QGraphicsRectItem::hoverEnterEvent(event);
// m_parent->markerHovered(this, true);
// }
// void hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
// {
// QGraphicsRectItem::hoverLeaveEvent(event);
// m_parent->markerHovered(this, false);
// }
// void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
// {
// QGraphicsRectItem::mouseReleaseEvent(event);
// m_parent->markerReleased(this);
// if (m_parent->mousePressed())
// m_parent->markerSelected(this);
// m_parent->setMousePressed(false);
// }
// void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
// {
// QGraphicsRectItem::mouseDoubleClickEvent(event);
// m_parent->markerDoubleClicked(this);
// }
//private:
// ColorMapChart *m_parent;
//};
QT_CHARTS_END_NAMESPACE
#endif // COLORMAPCHART_H