File: vtkSMViewProxyInteractorHelper.h

package info (click to toggle)
paraview 5.1.2%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 221,108 kB
  • ctags: 236,092
  • sloc: cpp: 2,416,026; ansic: 190,891; python: 99,856; xml: 81,001; tcl: 46,915; yacc: 5,039; java: 4,413; perl: 3,108; sh: 1,974; lex: 1,926; f90: 748; asm: 471; pascal: 228; makefile: 198; objc: 83; fortran: 31
file content (99 lines) | stat: -rw-r--r-- 4,036 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*=========================================================================

  Program:   ParaView
  Module:    vtkSMViewProxyInteractorHelper.h

  Copyright (c) Kitware, Inc.
  All rights reserved.
  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
// .NAME vtkSMViewProxyInteractorHelper - helper class that make it easier to
// hook vtkRenderWindowInteractor and vtkSMViewProxy.
// .SECTION Description
// vtkSMViewProxyInteractorHelper is a helper class designed to make it easier
// to hook up vtkRenderWindowInteractor to call methods on a vtkSMViewProxy (or
// subclass). It's primarily designed to work with vtkSMRenderViewProxy (and
// subclasses), but it should work with other types of views too.
//
// To use this helper, the view typically creates a instance for itself as register
// itself (using vtkSMViewProxyInteractorHelper::SetViewProxy) and then calls
// vtkSMViewProxyInteractorHelper::SetupInteractor(). This method will initialize
// the interactor (potentially changing some ivars on the interactor to avoid
// automatic rendering, using vtkRenderWindowInteractor::EnableRenderOff(), etc.)
// and setup event observer to monitor interaction.
//
// vtkSMViewProxyInteractorHelper only using vtkSMViewProxy::StillRender() and
// vtkSMViewProxy::InteractiveRender() APIs directly. However several properties can
// be optionally present on the view proxy to dictate this class' behaviour. These
// are as follows:
//
// \li \c NonInteractiveRenderDelay :- when present provides time in seconds to
// delay the StillRender() call after user interaction has ended i.e.
// vtkRenderWindowInteractor fires the vtkCommand::EndInteractionEvent. If
// missing, or less than 0.01, the view will immediately render.
//
// \li \c EnableRenderOnInteraction :- when present provides a flag whether the interactor
// should trigger the render calls (either StillRender or InteractiveRender) as
// a consequence of interaction. If missing, we treat EnableRender as ON.
#ifndef vtkSMViewProxyInteractorHelper_h
#define vtkSMViewProxyInteractorHelper_h

#include "vtkPVServerManagerRenderingModule.h" //needed for exports
#include "vtkWeakPointer.h" //needed for vtkWeakPointer
#include "vtkObject.h"

class vtkCommand;
class vtkRenderWindowInteractor;
class vtkSMViewProxy;

class VTKPVSERVERMANAGERRENDERING_EXPORT vtkSMViewProxyInteractorHelper : public vtkObject
{
public:
  static vtkSMViewProxyInteractorHelper* New();
  vtkTypeMacro(vtkSMViewProxyInteractorHelper, vtkObject);
  void PrintSelf(ostream& os, vtkIndent indent);

  // Description:
  // Set the view proxy.
  // This is a weak reference i.e. the view proxy's
  // reference count will be unchanged by this call.
  void SetViewProxy(vtkSMViewProxy* proxy);
  vtkSMViewProxy* GetViewProxy();

  // Description:
  // Set the interactor to "help" the view with.
  // This is a weak reference i.e. the interactor's
  // reference count will be unchanged by this call.
  void SetupInteractor(vtkRenderWindowInteractor* iren);
  vtkRenderWindowInteractor* GetInteractor();
  void CleanupInteractor() { this->SetupInteractor(NULL); }

protected:
  vtkSMViewProxyInteractorHelper();
  ~vtkSMViewProxyInteractorHelper();

  // Description:
  // Handle event.
  void Execute(vtkObject* caller, unsigned long event, void* calldata);
  void Render();
  void CleanupTimer();

  vtkCommand* Observer;
  vtkWeakPointer<vtkSMViewProxy> ViewProxy;
  vtkWeakPointer<vtkRenderWindowInteractor> Interactor;
  int DelayedRenderTimerId;
  bool Interacting;
  bool Interacted;

private:
  vtkSMViewProxyInteractorHelper(const vtkSMViewProxyInteractorHelper&); // Not implemented
  void operator=(const vtkSMViewProxyInteractorHelper&); // Not implemented

};

#endif