vtkPVComparativeView.h 5.43 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
/*=========================================================================

  Program:   ParaView
  Module:    vtkPVComparativeView.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.

=========================================================================*/
15 16 17 18 19 20 21 22
/**
 * @class   vtkPVComparativeView
 * @brief   view for comparative visualization/
 * film-strips.
 *
 * vtkPVComparativeView is the view used to generate/view comparative
 * visualizations/film-strips. This is not a proxy
*/
23

24 25
#ifndef vtkPVComparativeView_h
#define vtkPVComparativeView_h
26 27

#include "vtkObject.h"
28
#include "vtkPVServerManagerRenderingModule.h" //needed for exports
29 30

class vtkCollection;
31
class vtkImageData;
32
class vtkSMComparativeAnimationCueProxy;
33
class vtkSMProxy;
34 35
class vtkSMViewProxy;

36
class VTKPVSERVERMANAGERRENDERING_EXPORT vtkPVComparativeView : public vtkObject
37 38 39 40
{
public:
  static vtkPVComparativeView* New();
  vtkTypeMacro(vtkPVComparativeView, vtkObject);
41
  void PrintSelf(ostream& os, vtkIndent indent) override;
42

43 44 45
  /**
   * Provides empty handlers to simulate the vtkPVView API.
   */
Kitware Robot's avatar
Kitware Robot committed
46
  void Initialize(unsigned int){};
47

48 49 50
  /**
   * Call StillRender() on the root view.
   */
51 52
  void StillRender();

53 54 55
  /**
   * Call InteractiveRender() on the root view.
   */
56 57
  void InteractiveRender();

58 59 60 61
  /**
   * Initialize the vtkPVComparativeView giving the root view proxy to be used
   * to create the comparative views.
   */
62 63
  void Initialize(vtkSMViewProxy* rootView);

64 65 66 67 68 69 70 71
  /**
   * Builds the MxN views. This method simply creates the MxN internal view modules.
   * It does not generate the visualization i.e. play the animation scene(s).
   * This method does nothing unless the dimensions have changed, in which case
   * it creates new internal view modules (or destroys extra ones). Note that
   * the it's the responsibility of the application to lay the views out so that
   * they form a MxN grid.
   */
72 73
  void Build(int dx, int dy);

74 75 76 77 78
  //@{
  /**
   * When set to true, all comparisons are shown in the same view. Otherwise,
   * they are tiled in separate views.
   */
79 80
  void SetOverlayAllComparisons(bool);
  vtkGetMacro(OverlayAllComparisons, bool);
81
  //@}
82

83 84 85 86
  //@{
  /**
   * Returns the dimensions used by the most recent Build() request.
   */
87
  vtkGetVector2Macro(Dimensions, int);
88
  //@}
89

90 91 92
  /**
   * Adds a representation proxy to this view.
   */
93
  void AddRepresentation(vtkSMProxy*);
94

95 96 97
  /**
   * Removes a representation proxy from this view.
   */
98
  void RemoveRepresentation(vtkSMProxy*);
99

100 101 102
  /**
   * Updates the data pipelines for all visible representations.
   */
103 104
  void Update();

105
  /**
luz paz's avatar
luz paz committed
106
   * Get all the internal views. The views should only be used to be laid out
107 108 109
   * by the GUI. It's not recommended to directly change the properties of the
   * views.
   */
110 111
  void GetViews(vtkCollection* collection);

112 113 114 115
  //@{
  /**
   * Returns the root view proxy.
   */
116
  vtkGetObjectMacro(RootView, vtkSMViewProxy);
117
  //@}
118

119 120 121 122 123
  //@{
  /**
   * ViewSize, ViewPosition need to split up among all the component
   * views correctly.
   */
124
  void SetViewSize(int x, int y)
Kitware Robot's avatar
Kitware Robot committed
125
  {
126 127 128
    this->ViewSize[0] = x;
    this->ViewSize[1] = y;
    this->UpdateViewLayout();
Kitware Robot's avatar
Kitware Robot committed
129
  }
130
  //@}
131

132 133 134 135 136
  //@{
  /**
   * ViewSize, ViewPosition need to split up among all the component
   * views correctly.
   */
137
  void SetViewPosition(int x, int y)
Kitware Robot's avatar
Kitware Robot committed
138
  {
139 140 141
    this->ViewPosition[0] = x;
    this->ViewPosition[1] = y;
    this->UpdateViewLayout();
Kitware Robot's avatar
Kitware Robot committed
142
  }
143
  //@}
144

Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
145 146 147 148 149 150
  /**
   * Satisfying vtkPVView API. We don't need to do anything here since the
   * subviews have their own PPI settings.
   */
  void SetPPI(int) {}

151 152 153 154
  //@{
  /**
   * Set spacing between views.
   */
155 156
  vtkSetVector2Macro(Spacing, int);
  vtkGetVector2Macro(Spacing, int);
157
  //@}
158

159 160 161 162
  //@{
  /**
   * Add/Remove parameter cues.
   */
163 164
  void AddCue(vtkSMComparativeAnimationCueProxy*);
  void RemoveCue(vtkSMComparativeAnimationCueProxy*);
165
  //@}
166

167 168 169 170
  //@{
  /**
   * Get/Set the view time.
   */
171
  vtkGetMacro(ViewTime, double);
Kitware Robot's avatar
Kitware Robot committed
172
  void SetViewTime(double time)
173 174
  {
    if (this->ViewTime != time)
Kitware Robot's avatar
Kitware Robot committed
175
    {
176 177 178
      this->ViewTime = time;
      this->Modified();
      this->MarkOutdated();
Kitware Robot's avatar
Kitware Robot committed
179
    }
180
  }
181
  //@}
182

183 184 185 186
  /**
   * Marks the view dirty i.e. on next Update() it needs to regenerate the
   * comparative vis by replaying the animation(s).
   */
Kitware Robot's avatar
Kitware Robot committed
187
  void MarkOutdated() { this->Outdated = true; }
188

189 190 191 192 193
  /**
   * These methods mimic the vtkPVView API. They do nothing here since each view
   * internal view will call PrepareForScreenshot and CleanupAfterScreenshot
   * explicitly when we capture the images from each of them as needed.
   */
194 195
  void PrepareForScreenshot() {}
  void CleanupAfterScreenshot() {}
196
  vtkImageData* CaptureWindow(int magX, int magY);
197

198 199
protected:
  vtkPVComparativeView();
200
  ~vtkPVComparativeView() override;
201

202 203 204
  /**
   * Update layout for internal views.
   */
205 206 207 208 209 210 211 212 213 214 215 216
  void UpdateViewLayout();

  int Dimensions[2];
  int ViewSize[2];
  int ViewPosition[2];
  int Spacing[2];
  double ViewTime;
  bool OverlayAllComparisons;
  bool Outdated;

  void SetRootView(vtkSMViewProxy*);
  vtkSMViewProxy* RootView;
Kitware Robot's avatar
Kitware Robot committed
217

218
private:
219 220
  vtkPVComparativeView(const vtkPVComparativeView&) = delete;
  void operator=(const vtkPVComparativeView&) = delete;
221 222 223 224 225 226 227

  class vtkInternal;
  vtkInternal* Internal;
  vtkCommand* MarkOutdatedObserver;
};

#endif