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;
46 class vtkSMProperty;
47 
53 class PQDEPRECATED_EXPORT pq3DWidget : public pqProxyPanel
54 {
55  Q_OBJECT
56  typedef pqProxyPanel Superclass;
57 
58 public:
59  pq3DWidget(vtkSMProxy* referenceProxy, vtkSMProxy* proxy, QWidget* parent = 0);
60  virtual ~pq3DWidget();
61 
62  // This method creates widgets using the hints provided by
63  // the proxy. If a proxy needs more that one
64  // 3D widget, this method will create all the 3D widgets and
65  // return them. There is no parent associated with the newly
66  // created 3D widgets, it's the responsibility of the caller
67  // to do the memory management for the 3D widgets.
68  static QList<pq3DWidget*> createWidgets(vtkSMProxy* refProxy, vtkSMProxy* proxy);
69 
76  vtkSMProxy* getControlledProxy() const;
77 
78  vtkSMProxy* getReferenceProxy() const;
79 
86  void setHints(vtkPVXMLElement* element);
87  vtkPVXMLElement* getHints() const;
88 
92  vtkSMNewWidgetRepresentationProxy* getWidgetProxy() const;
93 
99  bool widgetVisible() const;
100 
104  bool widgetSelected() const;
105 
109  pqRenderViewBase* renderView() const;
110 
116  virtual void resetBounds(double bounds[6]) = 0;
117 
118 signals:
122  void widgetVisibilityChanged(bool);
123 
127  void widgetStartInteraction();
128 
132  void widgetEndInteraction();
133 
137  void widgetInteraction();
138 
139 public slots:
143  void setWidgetVisible(bool);
147  void showWidget();
151  void hideWidget();
152 
156  virtual void select();
157 
161  virtual void deselect();
162 
170  virtual void accept();
171 
179  virtual void reset();
180 
184  virtual void setView(pqView*);
185 
197  virtual void resetBounds();
198 
206  virtual void setUseSelectionDataBounds(bool use) { this->UseSelectionDataBounds = use; }
207  bool useSelectionDataBounds() { return this->UseSelectionDataBounds; }
208 
209 protected slots:
213  void render();
214 
215  // When set to true, instead of intersecting with the mesh surface for picking, it will only get a
216  // close point from the mesh
217  void setPickOnMeshPoint(bool);
218 
222  void pickPoint();
223 
227  virtual void pick(double, double, double){};
228 
232  virtual void updateMasterEnableState(bool);
233 
237  void handleReferenceProxyUserEvent(vtkObject*, unsigned long, void*);
238 
239 protected:
240  // Return true if picking is on mesh point only
241  bool pickOnMeshPoint() const;
242 
249  virtual void setControlledProperty(const char* function, vtkSMProperty* controlled_property);
250 
256  void pickingSupported(const QKeySequence& key);
257 
258  void setControlledProperty(vtkSMProperty* widget_property, vtkSMProperty* controlled_property);
259 
260  // Subclasses must set the widget proxy.
261  void setWidgetProxy(vtkSMNewWidgetRepresentationProxy*);
262 
266  virtual void onControlledPropertyChanged();
267 
272  int getReferenceInputBounds(double bounds[6]) const;
273 
277  virtual void updateWidgetVisibility();
278 
282  virtual void updateWidgetState(bool visible, bool enable);
283 
287  virtual void updatePickShortcut();
288  virtual void updatePickShortcut(bool pickable);
289 
290 private:
291  void setControlledProxy(vtkSMProxy*);
292 
293  pq3DWidgetInternal* const Internal;
294 
295  bool UseSelectionDataBounds;
296 
297  class pqStandardWidgets;
298 };
299 
300 #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:206
******DEPRECATION WARNING******* pqProxyPanel and subclasses will soon be removed from ParaView...
Definition: pqProxyPanel.h:55
virtual void pick(double, double, double)
Called on each pick, default implementation does nothing.
Definition: pq3DWidget.h:227
pq3DWidget is the abstract superclass for all 3D widgets.
Definition: pq3DWidget.h:53
superclass for all SM properties
virtual void deselect()
Called when the panel becomes inactive.
This is a PQ abstraction of a generic view module.
Definition: pqView.h:56
proxy for 3D widgets and their representations in ParaView.
bool useSelectionDataBounds()
Definition: pq3DWidget.h:207
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:56
pqRenderViewBase is an abstract base class for all render-view based views.
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:152
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
This is used by vtkPVXMLParser to represent an XML document starting at the root element.