vtkSMRepresentationProxy.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
64 #ifndef vtkSMRepresentationProxy_h
65 #define vtkSMRepresentationProxy_h
66 
67 #include "vtkRemotingViewsModule.h" //needed for exports
68 #include "vtkSMSourceProxy.h"
69 
70 #include <unordered_map> // needed for std::map
71 
74 {
75 class vtkCloningVectorOfRepresentations;
76 }
77 
79 {
80 public:
81  static vtkSMRepresentationProxy* New();
83  void PrintSelf(ostream& os, vtkIndent indent) override;
84 
89  virtual vtkPVDataInformation* GetRepresentedDataInformation();
90 
92 
107  virtual vtkPVProminentValuesInformation* GetProminentValuesInformation(std::string name,
108  int fieldAssoc, int numComponents, double uncertaintyAllowed = 1e-6, double fraction = 1e-3,
109  bool force = false);
110  virtual vtkPVProminentValuesInformation* GetBlockProminentValuesInformation(
111  std::string blockSelector, std::string assemblyName, std::string name, int fieldAssoc,
112  int numComponents, double uncertaintyAllowed = 1e-6, double fraction = 1e-3,
113  bool force = false);
115 
120  void UpdatePipeline() override;
121 
126  void UpdatePipeline(double time) override;
127 
131  void PostUpdateData(bool) override;
132 
136  virtual void ViewUpdated(vtkSMProxy* view);
137 
141  vtkTypeUInt32 GetGlobalID() override;
142 
144 
152  virtual bool SetRepresentationType(const char* type);
153  static bool SetRepresentationType(vtkSMProxy* repr, const char* type)
154  {
156  return self ? self->SetRepresentationType(type) : false;
157  }
158  const char* GetRepresentationType();
159  static const char* GetRepresentationType(vtkSMProxy* repr)
160  {
162  return self ? self->GetRepresentationType() : nullptr;
163  }
165 
167 
171  static bool IsVolumeRendering(vtkSMProxy* repr)
172  {
174  return self ? self->IsVolumeRendering() : false;
175  }
176  bool IsVolumeRendering();
178  {
180  return self ? self->GetUsing2DTransferFunction() : false;
181  }
182  bool GetUsing2DTransferFunction();
184 
185  void MarkDirty(vtkSMProxy* modifiedProxy) override;
186 
187 protected:
189  ~vtkSMRepresentationProxy() override;
190 
197  void MarkDirtyFromProducer(
198  vtkSMProxy* modifiedProxy, vtkSMProxy* producer, vtkSMProperty* property) override;
199 
200  // Unlike subproxies in regular proxies, subproxies in representations
201  // typically represent internal representations e.g. label representation,
202  // representation for selection etc. In that case, if the internal
203  // representation is modified, we need to ensure that any of our consumers is
204  // a consumer of all our subproxies as well.
205  void AddConsumer(vtkSMProperty* property, vtkSMProxy* proxy) override;
206  void RemoveConsumer(vtkSMProperty* property, vtkSMProxy* proxy) override;
207  void RemoveAllConsumers() override;
208 
209  void CreateVTKObjects() override;
210  void OnVTKRepresentationUpdated();
211  void OnVTKRepresentationUpdateSkipped();
212  void OnVTKRepresentationUpdateTimeChanged();
213 
214  virtual void UpdatePipelineInternal(double time, bool doTime);
215 
219  void InvalidateDataInformation() override;
220 
224  int LoadXMLState(vtkPVXMLElement* element, vtkSMProxyLocator* locator) override;
225 
226 private:
228  void operator=(const vtkSMRepresentationProxy&) = delete;
229 
230  bool RepresentedDataInformationValid;
231  vtkPVDataInformation* RepresentedDataInformation;
232 
233  bool ProminentValuesInformationValid;
234  vtkPVProminentValuesInformation* ProminentValuesInformation;
235  double ProminentValuesFraction;
236  double ProminentValuesUncertainty;
237 
238  std::unordered_map<std::string, bool> BlockProminentValuesInformationValid;
239  std::unordered_map<std::string, vtkPVProminentValuesInformation*> BlockProminentValuesInformation;
240  std::unordered_map<std::string, double> BlockProminentValuesFraction;
241  std::unordered_map<std::string, double> BlockProminentValuesUncertainty;
242 
243  friend class vtkPVComparativeViewNS::vtkCloningVectorOfRepresentations;
244  void ClearMarkedModified() { this->MarkedModified = false; }
245  bool MarkedModified;
246  bool VTKRepresentationUpdated;
247  bool VTKRepresentationUpdateSkipped;
248  bool VTKRepresentationUpdateTimeChanged;
249 
250  std::string DebugName;
251 };
252 
253 #endif
Proxy for a representations.
static vtkSMRepresentationProxy * SafeDownCast(vtkObject *o)
provides meta data about a vtkDataObject subclass.
#define VTKREMOTINGVIEWS_EXPORT
superclass for all SM properties
static const char * GetRepresentationType(vtkSMProxy *repr)
Set the representation type.
time
Prominent values a data array takes on.
proxy for a VTK source on a server
static bool SetRepresentationType(vtkSMProxy *repr, const char *type)
Set the representation type.
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:140
is used to locate proxies referred to in state xmls while loading state files.
static bool GetUsing2DTransferFunction(vtkSMProxy *repr)
Convenient method to check if this representation is currently rendering volumes, using 2D Transfer f...
static bool IsVolumeRendering(vtkSMProxy *repr)
Convenient method to check if this representation is currently rendering volumes, using 2D Transfer f...
This is used by vtkPVXMLParser to represent an XML document starting at the root element.