ParaView
pq3DWidget.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: pq3DWidget.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 pq3DWidget_h
33 #define pq3DWidget_h
34 
35 #include "pqDeprecatedModule.h"
36 #include "pqProxyPanel.h"
37 
38 class pq3DWidgetInternal;
39 class pqPipelineSource;
40 class pqProxy;
41 class pqRenderViewBase;
42 class QKeySequence;
43 class vtkObject;
44 class vtkPVXMLElement;
45 class vtkSMNewWidgetRepresentationProxy;
46 class vtkSMProperty;
47 
51 class PQDEPRECATED_EXPORT pq3DWidget : public pqProxyPanel
52 {
53  Q_OBJECT
54  typedef pqProxyPanel Superclass;
55 public:
56  pq3DWidget(vtkSMProxy* referenceProxy, vtkSMProxy* proxy, QWidget* parent=0);
57  virtual ~pq3DWidget();
58 
59  // This method creates widgets using the hints provided by
60  // the proxy. If a proxy needs more that one
61  // 3D widget, this method will create all the 3D widgets and
62  // return them. There is no parent associated with the newly
63  // created 3D widgets, it's the responsibility of the caller
64  // to do the memory management for the 3D widgets.
65  static QList<pq3DWidget*> createWidgets(vtkSMProxy* refProxy, vtkSMProxy* proxy);
66 
71  vtkSMProxy* getControlledProxy() const;
72 
73  vtkSMProxy* getReferenceProxy() const;
74 
79  void setHints(vtkPVXMLElement* element);
80  vtkPVXMLElement* getHints() const;
81 
83  vtkSMNewWidgetRepresentationProxy* getWidgetProxy() const;
84 
88  bool widgetVisible() const;
89 
91  bool widgetSelected() const;
92 
94  pqRenderViewBase* renderView() const;
95 
99  virtual void resetBounds(double bounds[6])=0;
100 
101 signals:
103  void widgetVisibilityChanged(bool);
104 
106  void widgetStartInteraction();
107 
109  void widgetEndInteraction();
110 
112  void widgetInteraction();
113 
114 public slots:
116  void setWidgetVisible(bool);
118  void showWidget();
120  void hideWidget();
121 
123  virtual void select();
124 
126  virtual void deselect();
127 
133  virtual void accept();
134 
140  virtual void reset();
141 
143  virtual void setView(pqView*);
144 
154  virtual void resetBounds();
155 
161  virtual void setUseSelectionDataBounds(bool use)
162  { this->UseSelectionDataBounds = use; }
164  {return this->UseSelectionDataBounds; }
165 
166 protected slots:
168  void render();
169 
170  // When set to true, instead of intersecting with the mesh surface for picking, it will only get a close point from the mesh
171  void setPickOnMeshPoint(bool);
172 
174  void pickPoint();
175 
177  virtual void pick(double, double, double) {};
178 
180  virtual void updateMasterEnableState(bool);
181 
183  void handleReferenceProxyUserEvent(vtkObject*, unsigned long, void*);
184 
185 protected:
186 
187  // Return true if picking is on mesh point only
188  bool pickOnMeshPoint() const;
189 
194  virtual void setControlledProperty(const char* function,
195  vtkSMProperty * controlled_property);
196 
200  void pickingSupported(const QKeySequence& key);
201 
202  void setControlledProperty(vtkSMProperty* widget_property, vtkSMProperty* controlled_property);
203 
204  // Subclasses must set the widget proxy.
205  void setWidgetProxy(vtkSMNewWidgetRepresentationProxy*);
206 
208  virtual void onControlledPropertyChanged();
209 
212  int getReferenceInputBounds(double bounds[6]) const;
213 
215  virtual void updateWidgetVisibility();
216 
218  virtual void updateWidgetState(bool visible, bool enable);
219 
221  virtual void updatePickShortcut();
222  virtual void updatePickShortcut(bool pickable);
223 
224 private:
225  void setControlledProxy(vtkSMProxy*);
226 
227  pq3DWidgetInternal* const Internal;
228 
229  bool UseSelectionDataBounds;
230 
231  class pqStandardWidgets;
232 };
233 
234 #endif
virtual void accept()
accept the changes made to the properties changes will be propogated down to the server manager subcl...
virtual void setUseSelectionDataBounds(bool use)
When set to true, instead of using the referenceProxy to obtain the default bounds to reset to...
Definition: pq3DWidget.h:161
******DEPRECATION WARNING******* pqProxyPanel and subclasses will soon be removed from ParaView...
Definition: pqProxyPanel.h:53
virtual void pick(double, double, double)
Called on each pick, default implementation does nothing.
Definition: pq3DWidget.h:177
pq3DWidget is the abstract superclass for all 3D widgets.
Definition: pq3DWidget.h:51
virtual void deselect()
Called when the panel becomes inactive.
This is a PQ abstraction of a generic view module.
Definition: pqView.h:55
bool useSelectionDataBounds()
Definition: pq3DWidget.h:163
virtual void select()
Called when the panel becomes active.
virtual void setView(pqView *)
Set the view that this panel works with.
This class represents any registered Server Manager proxy.
Definition: pqProxy.h:52
pqRenderViewBase is an abstract base class for all render-view based views.
PQ representation for a vtkSMProxy that can be involved in a pipeline.
virtual void reset()
reset the changes made editor will query properties from the server manager