pqColorOpacityEditorWidget.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 pqColorOpacityEditorWidget_h
5 #define pqColorOpacityEditorWidget_h
6 
8 #include "pqPropertyWidget.h"
9 #include "pqSMProxy.h"
10 #include <QList>
11 #include <QVariant>
12 
13 class pqColorMapModel;
14 class vtkImageData;
16 class vtkSMPropertyGroup;
18 
51 {
52  Q_OBJECT
53  Q_PROPERTY(QList<QVariant> xrgbPoints READ xrgbPoints WRITE setXrgbPoints)
54  Q_PROPERTY(QList<QVariant> xvmsPoints READ xvmsPoints WRITE setXvmsPoints)
55  Q_PROPERTY(bool showDataHistogram READ showDataHistogram WRITE setShowDataHistogram)
56  Q_PROPERTY(bool automaticDataHistogramComputation READ automaticDataHistogramComputation WRITE
57  setAutomaticDataHistogramComputation)
58  Q_PROPERTY(
59  int dataHistogramNumberOfBins READ dataHistogramNumberOfBins WRITE setDataHistogramNumberOfBins)
60  Q_PROPERTY(bool useLogScale READ useLogScale WRITE setUseLogScale)
61  Q_PROPERTY(bool useLogScaleOpacity READ useLogScaleOpacity WRITE setUseLogScaleOpacity)
62  Q_PROPERTY(bool useOpacityControlPointsFreehandDrawing READ useOpacityControlPointsFreehandDrawing
63  WRITE setUseOpacityControlPointsFreehandDrawing)
64  Q_PROPERTY(pqSMProxy scalarOpacityFunctionProxy READ scalarOpacityFunctionProxy WRITE
65  setScalarOpacityFunctionProxy)
66  Q_PROPERTY(
67  pqSMProxy transferFunction2DProxy READ transferFunction2DProxy WRITE setTransferFunction2DProxy)
68  Q_PROPERTY(QList<QVariant> transfer2DBoxes READ transfer2DBoxes WRITE setTransfer2DBoxes)
69 
71 
72 public:
74  vtkSMProxy* proxy, vtkSMPropertyGroup* smgroup, QWidget* parent = nullptr);
75  ~pqColorOpacityEditorWidget() override;
76 
80  void updateWidget(bool showing_advanced_properties) override;
81 
86  QList<QVariant> xrgbPoints() const;
87 
92  QList<QVariant> xvmsPoints() const;
93 
97  bool useLogScale() const;
98 
102  bool useLogScaleOpacity() const;
103 
107  bool useOpacityControlPointsFreehandDrawing() const;
108 
112  bool showDataHistogram() const;
113 
117  bool automaticDataHistogramComputation() const;
118 
122  int dataHistogramNumberOfBins() const;
123 
128  pqSMProxy scalarOpacityFunctionProxy() const;
129 
133  pqSMProxy transferFunction2DProxy() const;
134 
138  bool using2DTransferFunction() const;
139 
144  QList<QVariant> transfer2DBoxes() const;
145 
146 public Q_SLOTS: // NOLINT(readability-redundant-access-specifiers)
150  void setXvmsPoints(const QList<QVariant>&);
151 
155  void setXrgbPoints(const QList<QVariant>&);
156 
160  void setUseLogScale(bool value);
161 
165  void setUseLogScaleOpacity(bool value);
166 
170  void setUseOpacityControlPointsFreehandDrawing(bool value);
171 
175  void setShowDataHistogram(bool value);
176 
180  void setAutomaticDataHistogramComputation(bool value);
181 
185  void setDataHistogramNumberOfBins(int value);
186 
190  void setScalarOpacityFunctionProxy(pqSMProxy sofProxy);
191 
195  void setTransferFunction2DProxy(pqSMProxy t2dProxy);
196 
200  void resetRangeToData();
201 
205  void resetRangeToCustom();
206 
211  void resetRangeToDataOverTime();
212 
217  void resetRangeToVisibleData();
218 
222  void invertTransferFunctions();
223 
227  void choosePreset(const char* presetName = nullptr);
228 
232  void saveAsPreset();
233 
238  void computeDataHistogram();
239 
240  void onRangeHandlesRangeChanged(double rangeMin, double rangeMax);
241 
246  void resetColorMapComboBox();
247 
251  void setTransfer2DBoxes(const QList<QVariant>&);
252 
256  void chooseBoxColorAlpha();
257 
258 Q_SIGNALS:
262  void xrgbPointsChanged();
263 
267  void xvmsPointsChanged();
268 
272  void useLogScaleChanged();
273 
277  void useLogScaleOpacityChanged();
278 
282  void useOpacityControlPointsFreehandDrawingChanged();
283 
287  void showDataHistogramChanged();
288 
292  void automaticDataHistogramComputationChanged();
293 
297  void dataHistogramNumberOfBinsEdited();
298 
304  void scalarOpacityFunctionProxyChanged();
305 
309  void transferFunction2DProxyChanged();
310 
314  void transfer2DBoxesChanged();
315 
316 protected Q_SLOTS:
321  void opacityCurrentChanged(vtkIdType);
322  void colorCurrentChanged(vtkIdType);
323 
327  void updateCurrentData();
328 
332  void currentDataEdited();
333 
337  void presetApplied();
338 
342  void updateDefaultPresetsList();
343 
347  void multiComponentsMappingChanged(vtkObject*, unsigned long, void*, void*);
348 
353  void useLogScaleClicked(bool);
354 
359  void useLogScaleOpacityClicked(bool);
360 
365  void useOpacityControlPointsFreehandDrawingClicked(bool);
366 
373  void showDataHistogramClicked(bool show = true);
374 
378  void show2DHistogram(bool show = true);
379 
384  void automaticDataHistogramComputationClicked(bool val);
385 
390  void dataHistogramNumberOfBinsEdited(int val);
391 
395  void updateDataHistogramEnableState();
396 
403  void representationOrViewChanged();
404 
414  void setHistogramOutdated();
415 
421  void realShowDataHistogram();
422 
427  void realShow2DHistogram();
428 
433  void transfer2DChanged();
434 
439  void opacityFunctionModified();
440 
444  void updateTransferFunction2DProxy();
445 
446 protected: // NOLINT(readability-redundant-access-specifiers)
450  void prepareRangeForLogScaling();
451 
455  void initializeOpacityEditor(vtkPiecewiseFunction* pwf);
456 
460  void initializeTransfer2DEditor(vtkPVTransferFunction2D* tf2d);
461 
465  void observeRepresentationModified(vtkSMProxy* reprProxy, vtkPiecewiseFunction* pwf);
466 
467 private:
468  Q_DISABLE_COPY(pqColorOpacityEditorWidget)
469 
470  class pqInternals;
471  pqInternals* Internals;
472 };
473 
474 #endif
pqPropertyWidget represents a widget created for each property of a proxy on the pqPropertiesPanel (f...
pqColorOpacityEditorWidget provides an in-line editor widget for editing the color and opacity transf...
#define PQAPPLICATIONCOMPONENTS_EXPORT
int vtkIdType
Defines a 2D transfer function for mapping to RGBA values for volume rendering.
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:140
#define const
Definition: zconf.h:238