ParaView
pqDisplayColorWidget.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: pqDisplayColorWidget.h
5 
6  Copyright (c) 2005-2008 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 _pqDisplayColorWidget_h
33 #define _pqDisplayColorWidget_h
34 
35 #include "pqComponentsModule.h"
36 
37 #include <QPair>
38 #include <QPointer>
39 #include <QWidget>
40 
42 class pqScalarsToColors;
43 class QComboBox;
44 class vtkEventQtSlotConnect;
45 class vtkSMViewProxy;
46 
53 class PQCOMPONENTS_EXPORT pqDisplayColorWidget : public QWidget
54 {
55  Q_OBJECT
56  typedef QWidget Superclass;
57 public:
58  typedef QPair<int, QString> ValueType;
59 public:
60  pqDisplayColorWidget(QWidget *parent=0);
62 
64  ValueType arraySelection() const;
65  QString getCurrentText() const
66  {
67  return this->arraySelection().second;
68  }
69 
71  int componentNumber() const;
72 
74  vtkSMViewProxy* viewProxy() const;
75 
76 signals:
78  void arraySelectionChanged();
79 
80 public slots:
82  void setRepresentation(pqDataRepresentation* display);
83 
84 private slots:
87  void refreshColorArrayNames();
88 
90  void renderActiveView();
91 
93  void refreshComponents();
94 
98  void updateColorTransferFunction();
99 
102  void componentNumberChanged();
103 
107  void pruneOutOfDomainEntries();
108 
109 protected:
111  void setArraySelection(const ValueType&);
113  void setComponentNumber(int);
114 
115 private:
116  QVariant itemData(int association, const QString& arrayName) const;
117  QIcon* itemIcon(int association, const QString& arrayName) const;
118 
119 
120 
127  int addOutOfDomainEntry(int association, const QString& arrayName);
128 
129 private:
130  QIcon* CellDataIcon;
131  QIcon* PointDataIcon;
132  QIcon* FieldDataIcon;
133  QIcon* SolidColorIcon;
134  QComboBox* Variables;
135  QComboBox* Components;
136  QPointer<pqDataRepresentation> Representation;
137  QPointer<pqScalarsToColors> ColorTransferFunction;
138 
139  // This is maintained to detect when the representation has changed.
140  void* CachedRepresentation;
141 
142  class pqInternals;
143  pqInternals* Internals;
144 
145  class PropertyLinksConnection;
146  friend class PropertyLinksConnection;
147 };
148 #endif
pqDataRepresentation is the superclass for a display for a pqPipelineSource i.e.
pqScalarsToColors is a represents a vtkScalarsToColors proxy.
pqDisplayColorWidget is a widget that can be used to select the array to with for representations (al...
QString getCurrentText() const
QPair< int, QString > ValueType