pqChooseColorPresetReaction.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 pqChooseColorPresetReaction_h
5 #define pqChooseColorPresetReaction_h
6 
7 #include "pqReaction.h"
8 
9 #include "vtkNew.h" // needed for vtkNew.
10 #include "vtkWeakPointer.h" // needed for vtkWeakPointer.
11 
12 #include <QPointer> // needed for QPointer
13 #include <QRegularExpression> // needed for QRegularExpression.
14 
15 #include <vector> // needed for std::vector.
16 
18 class pqPresetDialog;
20 class vtkSMProxy;
21 
50 {
51  Q_OBJECT
52  typedef pqReaction Superclass;
53 
54 public:
55  pqChooseColorPresetReaction(QAction* parent, bool track_active_objects = true);
56  ~pqChooseColorPresetReaction() override;
57 
58 public Q_SLOTS: // NOLINT(readability-redundant-access-specifiers)
64  bool choosePreset(const char* presetName = nullptr);
65 
67 
70  void setRepresentation(pqDataRepresentation* repr, int selectedPropertiesType);
72  {
73  this->setRepresentation(repr, 0 /*Representation*/);
74  }
75  void setActiveRepresentation();
77 
79 
84  void setTransferFunctions(std::vector<vtkSMProxy*> lut);
86  {
87  this->setTransferFunctions(std::vector<vtkSMProxy*>{ lut });
88  }
90 
94  void updateEnableState() override;
95 
101  void setAllowsRegexpMatching(bool allow) { this->AllowsRegexpMatching = allow; }
102 
106  QRegularExpression regularExpression();
107 
111  bool loadAnnotations();
112 
113 Q_SIGNALS:
117  void presetApplied(const QString&);
118 
119 private Q_SLOTS:
120  void applyCurrentPreset();
121 
126  void updateTransferFunction();
127 
128 protected:
132  void onTriggered() override;
133 
134 private:
135  Q_DISABLE_COPY(pqChooseColorPresetReaction)
136  QPointer<pqDataRepresentation> Representation;
137  std::vector<vtkWeakPointer<vtkSMProxy>> TransferFunctionProxies;
138  static QPointer<pqPresetDialog> PresetDialog;
139  bool AllowsRegexpMatching;
140  vtkNew<vtkSMColorMapEditorHelper> ColorMapEditorHelper;
141 };
142 
143 #endif
pqDataRepresentation is the superclass for a display for a pqPipelineSource i.e.
void setTransferFunction(vtkSMProxy *lut)
Set the transfer function proxy.
pqPresetDialog is the dialog used by to show the user with a choice of color maps/opacity maps/preset...
virtual void updateEnableState()
Definition: pqReaction.h:48
#define PQAPPLICATIONCOMPONENTS_EXPORT
This is a superclass just to make it easier to collect all such reactions.
Definition: pqReaction.h:25
void setRepresentation(pqDataRepresentation *repr)
Set the data representation explicitly when track_active_objects is false.
Reaction to pop up a color palette chooser dialog.
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:140
virtual void onTriggered()
Called when the action is triggered.
Definition: pqReaction.h:46
void setAllowsRegexpMatching(bool allow)
Show/hide widget in the dialog.
helper for color map editor handling