pqColorOpacityEditorWidget.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: $RCSfile$
5 
6  Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc.
7  All rights reserved.
8 
9  ParaView is a free software; you can redistribute it and/or modify it
10  under the terms of the ParaView license version 1.2.
11 
12  See License_v1.2.txt for the full ParaView license.
13  A copy of this license can be obtained by contacting
14  Kitware Inc.
15  28 Corporate Drive
16  Clifton Park, NY 12065
17  USA
18 
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
23 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 ========================================================================*/
32 #ifndef pqColorOpacityEditorWidget_h
33 #define pqColorOpacityEditorWidget_h
34 
36 #include "pqPropertyWidget.h"
37 #include "pqSMProxy.h"
38 #include <QList>
39 #include <QVariant>
40 
41 class pqColorMapModel;
42 class vtkImageData;
44 class vtkSMPropertyGroup;
46 
79 {
80  Q_OBJECT
81  Q_PROPERTY(QList<QVariant> xrgbPoints READ xrgbPoints WRITE setXrgbPoints)
82  Q_PROPERTY(QList<QVariant> xvmsPoints READ xvmsPoints WRITE setXvmsPoints)
83  Q_PROPERTY(bool showDataHistogram READ showDataHistogram WRITE setShowDataHistogram)
84  Q_PROPERTY(bool automaticDataHistogramComputation READ automaticDataHistogramComputation WRITE
85  setAutomaticDataHistogramComputation)
86  Q_PROPERTY(
87  int dataHistogramNumberOfBins READ dataHistogramNumberOfBins WRITE setDataHistogramNumberOfBins)
88  Q_PROPERTY(bool useLogScale READ useLogScale WRITE setUseLogScale)
89  Q_PROPERTY(bool useLogScaleOpacity READ useLogScaleOpacity WRITE setUseLogScaleOpacity)
90  Q_PROPERTY(bool useOpacityControlPointsFreehandDrawing READ useOpacityControlPointsFreehandDrawing
91  WRITE setUseOpacityControlPointsFreehandDrawing)
92  Q_PROPERTY(pqSMProxy scalarOpacityFunctionProxy READ scalarOpacityFunctionProxy WRITE
93  setScalarOpacityFunctionProxy)
94  Q_PROPERTY(
95  pqSMProxy transferFunction2DProxy READ transferFunction2DProxy WRITE setTransferFunction2DProxy)
96  Q_PROPERTY(bool use2DTransferFunction READ use2DTransferFunction WRITE setUse2DTransferFunction)
97  Q_PROPERTY(QList<QVariant> transfer2DBoxes READ transfer2DBoxes WRITE setTransfer2DBoxes)
98 
100 
101 public:
103  vtkSMProxy* proxy, vtkSMPropertyGroup* smgroup, QWidget* parent = nullptr);
104  ~pqColorOpacityEditorWidget() override;
105 
110  QList<QVariant> xrgbPoints() const;
111 
116  QList<QVariant> xvmsPoints() const;
117 
121  bool useLogScale() const;
122 
126  bool useLogScaleOpacity() const;
127 
131  bool useOpacityControlPointsFreehandDrawing() const;
132 
136  bool showDataHistogram() const;
137 
141  bool automaticDataHistogramComputation() const;
142 
146  int dataHistogramNumberOfBins() const;
147 
152  pqSMProxy scalarOpacityFunctionProxy() const;
153 
157  pqSMProxy transferFunction2DProxy() const;
158 
162  bool use2DTransferFunction() const;
163 
168  QList<QVariant> transfer2DBoxes() const;
169 
170 public Q_SLOTS: // NOLINT(readability-redundant-access-specifiers)
174  void setXvmsPoints(const QList<QVariant>&);
175 
179  void setXrgbPoints(const QList<QVariant>&);
180 
184  void setUseLogScale(bool value);
185 
189  void setUseLogScaleOpacity(bool value);
190 
194  void setUseOpacityControlPointsFreehandDrawing(bool value);
195 
199  void setShowDataHistogram(bool value);
200 
204  void setAutomaticDataHistogramComputation(bool value);
205 
209  void setDataHistogramNumberOfBins(int value);
210 
214  void setScalarOpacityFunctionProxy(pqSMProxy sofProxy);
215 
219  void setTransferFunction2DProxy(pqSMProxy t2dProxy);
220 
224  void resetRangeToData();
225 
229  void resetRangeToCustom();
230 
235  void resetRangeToDataOverTime();
236 
241  void resetRangeToVisibleData();
242 
246  void invertTransferFunctions();
247 
251  void choosePreset(const char* presetName = nullptr);
252 
256  void saveAsPreset();
257 
258  void onRangeHandlesRangeChanged(double rangeMin, double rangeMax);
259 
264  void resetColorMapComboBox();
265 
269  void setUse2DTransferFunction(bool value);
270 
274  void setTransfer2DBoxes(const QList<QVariant>&);
275 
279  void chooseBoxColorAlpha();
280 
281 Q_SIGNALS:
285  void xrgbPointsChanged();
286 
290  void xvmsPointsChanged();
291 
295  void useLogScaleChanged();
296 
300  void useLogScaleOpacityChanged();
301 
305  void useOpacityControlPointsFreehandDrawingChanged();
306 
310  void showDataHistogramChanged();
311 
315  void automaticDataHistogramComputationChanged();
316 
320  void dataHistogramNumberOfBinsEdited();
321 
327  void scalarOpacityFunctionProxyChanged();
328 
332  void transferFunction2DProxyChanged();
333 
337  void use2DTransferFunctionChanged();
338 
342  void transfer2DBoxesChanged();
343 
344 protected Q_SLOTS:
349  void opacityCurrentChanged(vtkIdType);
350  void colorCurrentChanged(vtkIdType);
351 
355  void updatePanel();
356 
360  void updateCurrentData();
361 
365  void currentDataEdited();
366 
370  void presetApplied();
371 
375  void updateDefaultPresetsList();
376 
381  void updateIndexedLookupState();
382 
386  void multiComponentsMappingChanged(vtkObject*, unsigned long, void*, void*);
387 
392  void useLogScaleClicked(bool);
393 
398  void useLogScaleOpacityClicked(bool);
399 
404  void useOpacityControlPointsFreehandDrawingClicked(bool);
405 
412  void showDataHistogramClicked(bool show = true);
413 
417  void show2DHistogram(bool show = true);
418 
423  void automaticDataHistogramComputationClicked(bool val);
424 
429  void dataHistogramNumberOfBinsEdited(int val);
430 
434  void updateDataHistogramEnableState();
435 
442  void representationOrViewChanged();
443 
453  void setHistogramOutdated();
454 
460  void realShowDataHistogram();
461 
466  void realShow2DHistogram();
467 
472  void transfer2DChanged();
473 
477  void updateTransferFunction2DProxy();
478 
479 protected: // NOLINT(readability-redundant-access-specifiers)
483  void prepareRangeForLogScaling();
484 
488  void initializeOpacityEditor(vtkPiecewiseFunction* pwf);
489 
493  void initializeTransfer2DEditor(vtkPVTransferFunction2D* tf2d);
494 
495 private:
496  Q_DISABLE_COPY(pqColorOpacityEditorWidget)
497 
498  class pqInternals;
499  pqInternals* Internals;
500 };
501 
502 #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:152
#define const
Definition: zconf.h:238