pqDisplayColorWidget.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-FileCopyrightText: Copyright (c) Sandia Corporation
3 // SPDX-License-Identifier: BSD-3-Clause
4 #ifndef pqDisplayColorWidget_h
5 #define pqDisplayColorWidget_h
6 
7 #include "pqComponentsModule.h"
8 
9 #include <QIcon>
10 #include <QPair>
11 #include <QPointer>
12 #include <QScopedPointer>
13 #include <QWidget>
14 
15 #include <vector>
16 
17 class QComboBox;
19 class pqScalarsToColors;
20 class vtkSMProxy;
21 class vtkSMViewProxy;
22 
32 {
33  Q_OBJECT
34  Q_PROPERTY(QString representationText READ representationText WRITE setRepresentationText);
35  typedef QWidget Superclass;
36 
37 public:
38  typedef QPair<int, QString> ValueType;
39 
40  pqDisplayColorWidget(QWidget* parent = nullptr);
41  ~pqDisplayColorWidget() override;
42 
46  ValueType arraySelection() const;
47  QString getCurrentText() const { return this->arraySelection().second; }
48 
52  int componentNumber() const;
53 
57  vtkSMViewProxy* viewProxy() const;
58 
62  static void hideScalarBarsIfNotNeeded(vtkSMViewProxy* view, std::vector<vtkSMProxy*> luts);
63 
68  static void updateScalarBarVisibility(
69  vtkSMViewProxy* view, vtkSMProxy* reprProxy, int selectedPropertiesType = 0 /*Representation*/);
70 
74  QString representationText() const { return this->RepresentationText; }
75 
76 Q_SIGNALS:
80  void arraySelectionChanged();
81 
85  void representationTextChanged(const QString& text);
86 
87 public Q_SLOTS:
89 
92  void setRepresentation(pqDataRepresentation* display, int selectedPropertiesType);
94  {
95  this->setRepresentation(display, 0 /*Representation*/);
96  }
98 
102  void setRepresentationText(const QString& text);
103 
107  void queryCurrentSelectedArray();
108 
109 private Q_SLOTS:
114  void refreshColorArrayNames();
115 
119  void renderActiveView();
120 
124  void refreshComponents();
125 
131  void updateColorTransferFunction();
132 
137  void componentNumberChanged();
138 
144  void pruneOutOfDomainEntries();
145 
146 protected:
150  void setArraySelection(const ValueType&);
154  void setComponentNumber(int);
155 
156 private:
157  QVariant itemData(int association, const QString& arrayName) const;
158  QIcon* itemIcon(int association, const QString& arrayName) const;
159 
168  int addOutOfDomainEntry(int association, const QString& arrayName);
169 
170  QScopedPointer<QIcon> CellDataIcon;
171  QScopedPointer<QIcon> PointDataIcon;
172  QScopedPointer<QIcon> FieldDataIcon;
173  QScopedPointer<QIcon> SolidColorIcon;
174  QComboBox* Variables;
175  QComboBox* Components;
176  QPointer<pqDataRepresentation> Representation;
177  QPointer<pqScalarsToColors> ColorTransferFunction;
178  QString RepresentationText;
179 
180  class pqInternals;
181  QScopedPointer<pqInternals> Internals;
182 
183  class PropertyLinksConnection;
184  friend class PropertyLinksConnection;
185 };
186 #endif
pqDataRepresentation is the superclass for a display for a pqPipelineSource i.e.
#define PQCOMPONENTS_EXPORT
pqScalarsToColors is a represents a vtkScalarsToColors proxy.
Superclass for all view proxies.
pqDisplayColorWidget is a widget that can be used to select the array to with for representations (al...
QString getCurrentText() const
QString representationText() const
Returns the selected representation type as a string.
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:140
QPair< int, QString > ValueType
void setRepresentation(pqDataRepresentation *display)
Set the representation to control the scalar coloring properties on.