ParaView
vtkSMViewLayoutProxy.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: $RCSfile$
5 
6  Copyright (c) Kitware, Inc.
7  All rights reserved.
8  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
40 #ifndef vtkSMViewLayoutProxy_h
41 #define vtkSMViewLayoutProxy_h
42 
43 #include "vtkPVServerManagerRenderingModule.h" //needed for exports
44 #include "vtkSMProxy.h"
45 
46 class vtkSMViewProxy;
47 class vtkImageData;
48 
49 class VTKPVSERVERMANAGERRENDERING_EXPORT vtkSMViewLayoutProxy : public vtkSMProxy
50 {
51 public:
52  static vtkSMViewLayoutProxy* New();
54  void PrintSelf(ostream& os, vtkIndent indent);
55 
56  enum Direction
57  {
60  HORIZONTAL
61  };
62 
72  int Split(int location, int direction, double fraction);
73  int SplitVertical(int location, double fraction)
74  {
75  return this->Split(location, VERTICAL, fraction);
76  }
77  int SplitHorizontal(int location, double fraction)
78  {
79  return this->Split(location, HORIZONTAL, fraction);
80  }
81 
86  bool AssignView(int location, vtkSMViewProxy* view);
87 
97  int AssignViewToAnyCell(vtkSMViewProxy* view, int location_hint);
98 
100 
104  int RemoveView(vtkSMViewProxy* view);
105  bool RemoveView(int index);
107 
114  bool Collapse(int location);
115 
120  bool SwapCells(int location1, int location2);
121 
126  bool SetSplitFraction(int location, double fraction);
127 
134  bool MaximizeCell(int location);
135 
139  void RestoreMaximizedState();
140 
142 
146  vtkGetMacro(MaximizedCell, int);
148 
152  bool IsSplitCell(int location);
153 
157  Direction GetSplitDirection(int location);
158 
162  double GetSplitFraction(int location);
163 
168  static int GetFirstChild(int location) { return 2 * location + 1; }
169 
174  static int GetSecondChild(int location) { return 2 * location + 2; }
175 
179  static int GetParent(int location) { return (location > 0 ? ((location - 1) / 2) : -1); }
180 
184  vtkSMViewProxy* GetView(int location);
185 
190  int GetViewLocation(vtkSMViewProxy*);
191 
197  void UpdateViewPositions();
198 
204  void ShowViewsOnTileDisplay();
205 
209  vtkImageData* CaptureWindow(int magnification);
210 
215  {
216  return this->Superclass::SaveXMLState(root);
217  }
219 
223  virtual int LoadXMLState(vtkPVXMLElement* element, vtkSMProxyLocator* locator);
224 
228  void Reset();
229 
234  static vtkSMViewLayoutProxy* FindLayout(vtkSMViewProxy*, const char* reggroup = "layouts");
235 
237 
240  static void SetMultiViewImageBorderColor(double r, double g, double b);
241  static void SetMultiViewImageBorderWidth(int width);
242  static const double* GetMultiViewImageBorderColor();
243  static void GetMultiViewImageBorderColor(unsigned char rgb[3]);
244  static void GetMultiViewImageBorderColor(double rgb[3]);
245  static int GetMultiViewImageBorderWidth();
247 
248 protected:
251 
255  virtual void LoadState(const vtkSMMessage* message, vtkSMProxyLocator* locator);
256 
262  virtual void UpdateState();
263 
269  int GetEmptyCell(int root);
270 
274  int GetSplittableCell(int root, Direction& suggested_direction);
275 
277 
278 private:
279  vtkSMViewLayoutProxy(const vtkSMViewLayoutProxy&) VTK_DELETE_FUNCTION;
280  void operator=(const vtkSMViewLayoutProxy&) VTK_DELETE_FUNCTION;
281 
282  class vtkInternals;
283  vtkInternals* Internals;
284 
285  bool SetBlockUpdate(bool new_value)
286  {
287  bool temp = this->BlockUpdate;
288  this->BlockUpdate = new_value;
289  return temp;
290  }
291 
292  bool BlockUpdate;
293 
294  static double MultiViewImageBorderColor[3];
295  static int MultiViewImageBorderWidth;
296 };
297 
298 #endif
static int GetParent(int location)
Returns the parent index.
static int GetFirstChild(int location)
Returns the index for the first child of the given location.
Superclass for all view proxies.
virtual vtkPVXMLElement * SaveXMLState(vtkPVXMLElement *root)
Overridden to save custom XML state.
Header class that setup every thing in order to use Protobuf messages in a transparent manner...
vtkSMViewLayoutProxy is used by ParaView to layout multiple views in a 2D KD-Tree layout...
void PrintSelf(ostream &os, vtkIndent indent)
static vtkSMProxy * New()
virtual int LoadXMLState(vtkPVXMLElement *element, vtkSMProxyLocator *locator)
Loads the proxy state from the XML element.
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:152
is used to locate proxies referred to in state xmls while loading state files.
int SplitVertical(int location, double fraction)
int SplitHorizontal(int location, double fraction)
virtual vtkPVXMLElement * SaveXMLState(vtkPVXMLElement *root)
Saves the state of the proxy.
This is used by vtkPVXMLParser to represent an XML document starting at the root element.
virtual void LoadState(const vtkSMMessage *msg, vtkSMProxyLocator *locator)
This method is used to initialise the object to the given state If the definitionOnly Flag is set to ...
static int GetSecondChild(int location)
Returns the index for the second child of the given location.
iterates over the properties of a proxy