vtkSMProperty.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
121 #ifndef vtkSMProperty_h
122 #define vtkSMProperty_h
123 
124 #include "vtkParaViewDeprecation.h" // for PARAVIEW_DEPRECATED_IN_5_12_0
125 #include "vtkRemotingServerManagerModule.h" //needed for exports
126 #include "vtkSMDomainIterator.h" // needed for vtkSMDomainIterator
127 #include "vtkSMMessageMinimal.h" // needed for vtkSMMessage
128 #include "vtkSMObject.h"
129 #include "vtkSmartPointer.h" // needed for vtkSmartPointer
130 #include "vtkWeakPointer.h" // needed for vtkWeakPointer
131 
133 class vtkPVXMLElement;
134 class vtkSMDocumentation;
135 class vtkSMDomain;
136 class vtkSMDomainIterator;
137 class vtkSMInformationHelper;
138 class vtkSMPropertyLink;
139 class vtkSMProxy;
140 class vtkSMProxyLocator;
141 
143 
145 {
146 public:
147  static vtkSMProperty* New();
148  vtkTypeMacro(vtkSMProperty, vtkSMObject);
149  void PrintSelf(ostream& os, vtkIndent indent) override;
150 
152 
156  vtkSetStringMacro(Command);
157  vtkGetStringMacro(Command);
159 
161 
166  vtkSetMacro(ImmediateUpdate, int);
167  vtkGetMacro(ImmediateUpdate, int);
169 
178  int IsInDomains();
179 
188  int IsInDomains(vtkSMDomain** domain);
189 
194  void UnRegister(vtkObjectBase* obj) override;
195 
200  vtkSMDomainIterator* NewDomainIterator();
201 
206  vtkSMDomain* GetDomain(const char* name);
207 
211  vtkSMDomain* FindDomain(const char* classname);
212 
228  template <class DomainType>
229  inline DomainType* FindDomain();
230 
235  unsigned int GetNumberOfDomains();
236 
238 
242  vtkGetMacro(InformationOnly, int);
244 
246 
251  vtkGetMacro(IgnoreSynchronization, int);
253 
255 
260  vtkGetObjectMacro(InformationProperty, vtkSMProperty);
262 
268  void AddDomain(const char* name, vtkSMDomain* dom);
269 
274  virtual void AddLinkedProperty(vtkSMProperty* targetProperty);
275 
279  virtual void RemoveLinkedProperty(vtkSMProperty* targetProperty);
280 
289  virtual void RemoveFromSourceLink();
290 
292 
296  vtkSetMacro(Animateable, int);
297  vtkGetMacro(Animateable, int);
299 
301 
306  vtkSetMacro(IsInternal, int);
307  vtkGetMacro(IsInternal, int);
309 
311 
314  vtkSetMacro(NoCustomDefault, int);
316 
318 
321  vtkGetMacro(NoCustomDefault, int);
323 
325 
335  vtkSetStringMacro(PanelVisibility);
337 
339 
342  vtkGetStringMacro(PanelVisibility);
344 
346 
350  vtkSetStringMacro(PanelVisibilityDefaultForRepresentation);
352 
354 
358  vtkGetStringMacro(PanelVisibilityDefaultForRepresentation);
360 
362 
365  vtkSetStringMacro(PanelWidget);
367 
369 
372  vtkGetStringMacro(PanelWidget);
374 
376 
379  vtkSetStringMacro(DisableSubTrace);
381 
383 
386  vtkGetStringMacro(DisableSubTrace);
388 
393  virtual void Copy(vtkSMProperty* src);
394 
396 
401  vtkGetObjectMacro(Documentation, vtkSMDocumentation);
403 
408  void ResetToDefault();
409 
415  virtual void ResetToXMLDefaults() {}
416 
435  virtual bool ResetToDomainDefaults(bool use_unchecked_values = false);
436 
438 
441  vtkGetStringMacro(XMLLabel);
443 
445 
451  vtkGetStringMacro(XMLName);
453 
455 
460  vtkGetMacro(Repeatable, int);
462 
464 
472  vtkGetObjectMacro(Hints, vtkPVXMLElement);
473  void SetHints(vtkPVXMLElement* hints);
475 
477 
480  void Modified() override
481  {
482  if (this->BlockModifiedEvents)
483  {
484  this->PendingModifiedEvents = true;
485  }
486  else
487  {
488  this->Superclass::Modified();
489  this->PendingModifiedEvents = false;
490  }
491  }
493 
499  vtkSMProxy* GetParent();
500 
501  // Flag used to ignore property when building Proxy state for Undo/Redo state.
502  // The default value is false.
503  virtual bool IsStateIgnored() { return this->StateIgnored; }
504 
510  virtual bool IsValueDefault() { return false; }
511 
517  bool HasDomainsWithRequiredProperties();
518 
522  virtual void ClearUncheckedElements() {}
523 
532  "Use vtkSMObject::CreatePrettyLabel(const std::string& name) instead.")
533  static const char* CreateNewPrettyLabel(const char* name);
534 
535 protected:
536  vtkSMProperty();
537  ~vtkSMProperty() override;
538 
540  friend class vtkSMProxy;
541  friend class vtkSMSubPropertyIterator;
542  friend class vtkSMDomainIterator;
543  friend class vtkSMSourceProxy;
544  friend class vtkSMDomain;
546 
550  virtual void WriteTo(vtkSMMessage* msg);
551 
555  virtual void ReadFrom(const vtkSMMessage*, int vtkNotUsed(message_offset), vtkSMProxyLocator*){};
556 
561  virtual int ReadXMLAttributes(vtkSMProxy* parent, vtkPVXMLElement* element);
562 
567  virtual void UpdateAllInputs(){};
568 
570 
576  vtkSetStringMacro(XMLName);
578 
583  vtkSMProperty* NewProperty(const char* name);
584 
589  void AddDependent(vtkSMDomain* dom);
590 
594  void RemoveAllDependents();
595 
610  void UpdateDomains();
611 
617  virtual void SaveState(
618  vtkPVXMLElement* parent, const char* property_name, const char* uid, int saveDomains = 1);
623  virtual void SaveStateValues(vtkPVXMLElement* propertyElement);
624 
628  virtual void SaveDomainState(vtkPVXMLElement* propertyElement, const char* uid);
629 
633  virtual int LoadState(vtkPVXMLElement* element, vtkSMProxyLocator* loader);
634 
636 
637  char* Command;
638 
640 
645 
646  char* XMLName;
647  char* XMLLabel;
648  vtkSetStringMacro(XMLLabel);
649 
650  char* PanelVisibility;
652  char* PanelWidget;
654 
656 
657  vtkSetMacro(InformationOnly, int);
658  int InformationOnly;
659 
660  vtkSetMacro(IgnoreSynchronization, int);
662 
663  vtkSMInformationHelper* InformationHelper;
664 
665  void SetInformationProperty(vtkSMProperty* ip);
667 
669  void SetDocumentation(vtkSMDocumentation*);
670 
672 
674 
677  bool SetBlockModifiedEvents(bool block)
678  {
679  bool prev = this->BlockModifiedEvents;
680  this->BlockModifiedEvents = block;
681  return prev;
682  }
684 
686 
690  vtkGetMacro(PendingModifiedEvents, bool);
692 
693  // Proxy is not reference-counted to avoid reference loops.
694  void SetParent(vtkSMProxy* proxy);
695 
697 
698  // Flag used to ignore property when building Proxy state for Undo/Redo state.
699  // The default value is false.
701  vtkSetMacro(StateIgnored, bool);
702  vtkBooleanMacro(StateIgnored, bool);
703 
704  // Links for properties that "subscribe" to changes to this property.
706 
707 private:
708  vtkSMProperty(const vtkSMProperty&) = delete;
709  void operator=(const vtkSMProperty&) = delete;
710 
711  // Callback to fire vtkCommand::DomainModifiedEvent every time any of the
712  // domains change.
713  void InvokeDomainModifiedEvent();
714 
715  bool PendingModifiedEvents;
716  bool BlockModifiedEvents;
717 };
718 
719 #define vtkSMPropertyTemplateMacroCase(typeSMProperty, type, prop, call) \
720  if (typeSMProperty* SM_PROPERTY = typeSMProperty::SafeDownCast(prop)) \
721  { \
722  (void)SM_PROPERTY; \
723  typedef type SM_TT; \
724  call; \
725  }
726 /* clang-format off */
727 #define vtkSMVectorPropertyTemplateMacro(prop, call) \
728  vtkSMPropertyTemplateMacroCase(vtkSMDoubleVectorProperty, double, prop, call) \
729  vtkSMPropertyTemplateMacroCase(vtkSMIntVectorProperty, int, prop, call) \
730  vtkSMPropertyTemplateMacroCase(vtkSMIdTypeVectorProperty, vtkIdType, prop, call) \
731  vtkSMPropertyTemplateMacroCase(vtkSMStringVectorProperty, std::string, prop, call)
732 /* clang-format on */
733 
734 template <class DomainType>
736 {
737  auto iter = vtkSmartPointer<vtkSMDomainIterator>::Take(this->NewDomainIterator());
738  for (iter->Begin(); !iter->IsAtEnd(); iter->Next())
739  {
740  if (DomainType* domain = DomainType::SafeDownCast(iter->GetDomain()))
741  {
742  return domain;
743  }
744  }
745  return nullptr;
746 }
747 #endif
vtkSMProperty * InformationProperty
#define PARAVIEW_DEPRECATED_IN_5_12_0(reason)
static vtkSmartPointer< T > Take(T *t)
iterates over domains of a property
vtkSMDomainIterator * DomainIterator
vtkSMPropertyLink * Links
#define VTKREMOTINGSERVERMANAGER_EXPORT
superclass for all SM properties
void Modified() override
Overridden to support blocking of modified events.
Store messages for the interpreter.
name
DomainType * FindDomain()
Same as FindDomain(classname), except the classname is deduced from the type.
vtkSMInformationHelper * InformationHelper
Header class that setup every thing in order to use Protobuf messages in a transparent manner...
virtual void UnRegister(vtkObjectBase *o)
represents the possible values a property can have
Definition: vtkSMDomain.h:37
virtual bool IsStateIgnored()
superclass for most server manager classes
Definition: vtkSMObject.h:17
proxy for a VTK source on a server
int IgnoreSynchronization
virtual void Modified()
char * PanelWidget
char * PanelVisibility
The vtkSMSessionProxyManager is esponsible for creating and managing proxies for a given session...
vtkPVXMLElement * Hints
bool SetBlockModifiedEvents(bool block)
Block/unblock modified events, returns the current state of the block flag.
virtual void ReadFrom(const vtkSMMessage *, int vtkNotUsed(message_offset), vtkSMProxyLocator *)
Let the property read and set its content from the stream.
vtkSMDocumentation * Documentation
This is the concrete implementation for the Undo element for a property modification event...
static vtkSMObject * New()
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.
vtkWeakPointer< vtkSMProxy > Proxy
class providing access to the documentation for a vtkSMProxy.
vtkSMPropertyInternals * PInternals
virtual void ResetToXMLDefaults()
For properties that support specifying defaults in XML configuration, this method will reset the prop...
This is used by vtkPVXMLParser to represent an XML document starting at the root element.
char * PanelVisibilityDefaultForRepresentation
virtual bool IsValueDefault()
Returns true if the property&#39;s value is different from the default value.
virtual void ClearUncheckedElements()
Use this method to clear unchecked values set of this property.
char * DisableSubTrace
virtual void UpdateAllInputs()
Update all proxies referred by this property (if any).
void PrintSelf(ostream &os, vtkIndent indent) override