VAPOR3 3.9.4
TFIsoValueWidget.h
Go to the documentation of this file.
1#pragma once
2
3#include "TFMapWidget.h"
5#include <vapor/ParamsMgr.h>
6#include <vapor/VAssert.h>
7#include <glm/glm.hpp>
8
9// class TFIsoValueInfoWidget;
10
11class TFIsoValueMap : public TFMap {
12 Q_OBJECT
13
14public:
15 bool BottomPadding = false;
16
17 TFIsoValueMap(const std::string &variableNameTag, TFMapWidget *parent = nullptr);
18 void PopulateContextMenu(QMenu *menu, const glm::vec2 &p) override;
19
20 QSize minimumSizeHint() const override;
21 void LostFocus() override;
22
24 {
25 _equidistantIsoValues = b;
26 return this;
27 }
28
29protected:
30 void paramsUpdate() override;
32 void paintEvent(QPainter &p) override;
33 void drawControl(QPainter &p, const QPointF &pos, bool selected = false, bool invalid = false) const;
36 QRect GetControlPointArea(const QPoint &p) const;
37 void mousePressEvent(QMouseEvent *event) override;
38 void mouseReleaseEvent(QMouseEvent *event) override;
39 void mouseMoveEvent(QMouseEvent *event) override;
40 void mouseDoubleClickEvent(QMouseEvent *event) override;
41 QMargins GetPadding() const override;
42
43private:
44 bool _isDraggingControl = false;
45 int _draggingControlID;
46 int _selectedId = -1;
47 glm::vec2 _dragOffset;
48 glm::vec2 m;
49 std::vector<float> _isoValues;
50 std::vector<bool> _isoValuesInBounds;
51 bool _equidistantIsoValues = true;
52
53 bool controlPointContainsPixel(const glm::vec2 &cp, const glm::vec2 &pixel) const;
54
55 void saveToParams(VAPoR::RenderParams *rp) const;
56 void loadFromParams(VAPoR::RenderParams *rp);
57 void clampIsoValuesToMappingRange();
58 int addControlPoint(float value);
59 void deleteControlPoint(int i);
60 void moveControlPoint(int *index, float value);
61 void selectControlPoint(int index);
62 int findSelectedControlPoint(const glm::vec2 &mouse) const;
63 bool controlPointContainsPixel(float cp, const glm::vec2 &pixel) const;
64 QPoint controlQPositionForValue(float value) const;
65 glm::vec2 controlPositionForValue(float value) const;
66 float controlXForValue(float value) const;
67 float valueForControlX(float position) const;
68 float getMapRangeMin() const;
69 float getMapRangeMax() const;
70
71signals:
73 void UpdateInfo(float value);
74
75public slots:
77 void UpdateFromInfo(float value);
78
79private slots:
80 void menuDeleteControlPoint();
81 void menuAddControlPoint();
82};
83
85public:
86 TFIsoValueWidget(const std::string &variableNameTag) : TFMapWidget(new TFIsoValueMap(variableNameTag, this)) {}
87};
void drawControl(QPainter &p, const QPointF &pos, bool selected=false, bool invalid=false) const
void LostFocus() override
float GetControlPointTriangleHeight() const
void DeselectControlPoint()
QRect GetControlPointArea(const QPoint &p) const
void mouseMoveEvent(QMouseEvent *event) override
void mouseDoubleClickEvent(QMouseEvent *event) override
float GetControlPointSquareHeight() const
QMargins GetPadding() const override
void UpdateFromInfo(float value)
TFIsoValueMap(const std::string &variableNameTag, TFMapWidget *parent=nullptr)
TFInfoWidget * createInfoWidget() override
void UpdateInfo(float value)
void paintEvent(QPainter &p) override
These map to the QWidget counterparts.
void mousePressEvent(QMouseEvent *event) override
void mouseReleaseEvent(QMouseEvent *event) override
void paramsUpdate() override
QSize minimumSizeHint() const override
TFIsoValueMap * SetEquidistantIsoValues(bool b)
void ControlPointDeselected()
void PopulateContextMenu(QMenu *menu, const glm::vec2 &p) override
(Right-click menu)
TFIsoValueWidget(const std::string &variableNameTag)
A Params subclass for managing parameters used by Renderers.
Definition: RenderParams.h:43