File: vtkSMGlobalPropertiesProxy.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 (111 lines) | stat: -rw-r--r-- 4,233 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
100
101
102
103
104
105
106
107
108
109
110
111
/*=========================================================================

  Program:   ParaView
  Module:    vtkSMGlobalPropertiesProxy.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 vtkSMGlobalPropertiesProxy - proxy that adds support for linking
// properties with other proxies designed for use-cases like color-palettes.
// .SECTION Description
// vtkSMGlobalPropertiesProxy can be thought of as a proxy which provides API to
// link its properties with any arbitrary proxy unidirectionally, so that if the
// property value on this proxy changes, the linked property on every other
// proxy is updated. However if the linked property (or target property) is
// modified externally, then the link is automatically broken.
//
// This is suitable adding ability for color palettes. Using XML hints in the
// proxy definition, one can write application code that setups links with a
// proxy and the color palette proxy (as done in
// vtkSMParaViewPipelineController). Now as long as the user doesn't modify
// the linked properties, the color palette can be changed and it will reflect
// on all linked properties.
//
// vtkSMParaViewPipelineController uses the property level hint
// <GlobalPropertyLink /> to define such links e.g.
//    \code
//    <DoubleVectorProperty name="Background" ... >
//         ...
//      <Hints>
//        <GlobalPropertyLink type="ColorPalette" property="BackgroundColor" />
//      </Hints>
//    </DoubleVectorProperty>
//    \endcode
//
// While vtkSMParaViewPipelineController currently only respects
// hints on the property, we can in future add support for respecting hints at
// the proxy level if needed.

#ifndef vtkSMGlobalPropertiesProxy_h
#define vtkSMGlobalPropertiesProxy_h

#include "vtkSMProxy.h"
#include "vtkPVServerManagerCoreModule.h" //needed for exports

class VTKPVSERVERMANAGERCORE_EXPORT vtkSMGlobalPropertiesProxy : public vtkSMProxy
{
public:
  static vtkSMGlobalPropertiesProxy* New();
  vtkTypeMacro(vtkSMGlobalPropertiesProxy, vtkSMProxy);
  void PrintSelf(ostream& os, vtkIndent indent);

  // Description:
  // Set up a property link with the given property on the proxy with the
  // specified property on this proxy. The link is automatically broken if the
  // target property is modified outside by someone other than this
  // vtkSMGlobalPropertiesProxy instance or when the targetProxy is destroyed.
  bool Link(const char* propertyname,
    vtkSMProxy* targetProxy, const char* targetPropertyName);

  // Description:
  // Unlink a property link,
  bool Unlink(const char* propertyname,
    vtkSMProxy* targetProxy, const char* targetPropertyName);

  // Description:
  // Remove all links.
  void RemoveAllLinks();

  // Description:
  // If a link between the target and a property on this proxy exists, returns
  // the name of that property else NULL.
  const char* GetLinkedPropertyName(vtkSMProxy* targetProxy, const char* targetPropertyName);

  // Description:
  // Overridden to save link state.
  virtual vtkPVXMLElement* SaveXMLState(vtkPVXMLElement* root, vtkSMPropertyIterator* iter);
  using Superclass::SaveXMLState;

  // Description:
  // Overridden to load links state.
  virtual int LoadXMLState(vtkPVXMLElement* element, vtkSMProxyLocator* locator);

protected:
  vtkSMGlobalPropertiesProxy();
  ~vtkSMGlobalPropertiesProxy();

  // Description:
  // Overridden to propagate the modification to the linked properties.
  virtual void SetPropertyModifiedFlag(const char* name, int flag);

  // Description:
  // Called when a target properties is modified.
  void TargetPropertyModified(vtkObject*, unsigned long, void*);

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

  class vtkInternals;
  vtkInternals* Internals;

};

#endif