ParaView
vtkSMProperty.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: vtkSMProperty.h
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 =========================================================================*/
129 #ifndef vtkSMProperty_h
130 #define vtkSMProperty_h
131 
132 #include "vtkPVServerManagerCoreModule.h" //needed for exports
133 #include "vtkSMMessageMinimal.h" // needed for vtkSMMessage
134 #include "vtkSMObject.h"
135 #include "vtkWeakPointer.h" // needed for vtkweakPointer
136 
138 class vtkPVXMLElement;
139 class vtkSMDocumentation;
140 class vtkSMDomain;
141 class vtkSMDomainIterator;
142 class vtkSMInformationHelper;
143 class vtkSMPropertyLink;
144 class vtkSMProxy;
145 class vtkSMProxyLocator;
146 
148 
149 class VTKPVSERVERMANAGERCORE_EXPORT vtkSMProperty : public vtkSMObject
150 {
151 public:
152  static vtkSMProperty* New();
153  vtkTypeMacro(vtkSMProperty, vtkSMObject);
154  void PrintSelf(ostream& os, vtkIndent indent);
155 
157 
161  vtkSetStringMacro(Command);
162  vtkGetStringMacro(Command);
164 
166 
171  vtkSetMacro(ImmediateUpdate, int);
172  vtkGetMacro(ImmediateUpdate, int);
174 
180  int IsInDomains();
181 
187  int IsInDomains(vtkSMDomain** domain);
188 
193  virtual void UnRegister(vtkObjectBase* obj);
194 
199  vtkSMDomainIterator* NewDomainIterator();
200 
204  vtkSMDomain* GetDomain(const char* name);
205 
209  vtkSMDomain* FindDomain(const char* classname);
210 
215  unsigned int GetNumberOfDomains();
216 
232  VTK_LEGACY(void UpdateDependentDomains());
233 
235 
239  vtkGetMacro(InformationOnly, int);
241 
243 
248  vtkGetMacro(IgnoreSynchronization, int);
250 
252 
257  vtkGetObjectMacro(InformationProperty, vtkSMProperty);
259 
265  void AddDomain(const char* name, vtkSMDomain* dom);
266 
271  virtual void AddLinkedProperty(vtkSMProperty* targetProperty);
272 
276  virtual void RemoveLinkedProperty(vtkSMProperty* targetProperty);
277 
286  virtual void RemoveFromSourceLink();
287 
289 
293  vtkSetMacro(Animateable, int);
294  vtkGetMacro(Animateable, int);
296 
298 
303  vtkSetMacro(IsInternal, int);
304  vtkGetMacro(IsInternal, int);
306 
308 
311  vtkSetMacro(NoCustomDefault, int);
313 
315 
318  vtkGetMacro(NoCustomDefault, int);
320 
322 
331  vtkSetStringMacro(PanelVisibility)
333 
335 
338  vtkGetStringMacro(PanelVisibility)
340 
342 
346  vtkSetStringMacro(PanelVisibilityDefaultForRepresentation)
348 
350 
354  vtkGetStringMacro(PanelVisibilityDefaultForRepresentation)
356 
358 
361  vtkSetStringMacro(PanelWidget)
363 
365 
368  vtkGetStringMacro(PanelWidget)
370 
375  virtual void Copy(vtkSMProperty* src);
376 
378 
383  vtkGetObjectMacro(Documentation, vtkSMDocumentation);
385 
390  void ResetToDefault();
391 
397  virtual void ResetToXMLDefaults() {}
398 
407  virtual bool ResetToDomainDefaults(bool use_unchecked_values = false);
408 
410 
413  vtkGetStringMacro(XMLLabel);
415 
417 
423  vtkGetStringMacro(XMLName);
425 
427 
432  vtkGetMacro(Repeatable, int);
434 
436 
444  vtkGetObjectMacro(Hints, vtkPVXMLElement);
445  void SetHints(vtkPVXMLElement* hints);
447 
449 
452  virtual void Modified()
453  {
454  if (this->BlockModifiedEvents)
455  {
456  this->PendingModifiedEvents = true;
457  }
458  else
459  {
460  this->Superclass::Modified();
461  this->PendingModifiedEvents = false;
462  }
463  }
465 
471  vtkSMProxy* GetParent();
472 
473  // Flag used to ignore property when building Proxy state for Undo/Redo state.
474  // The default value is false.
475  virtual bool IsStateIgnored() { return this->StateIgnored; }
476 
482  virtual bool IsValueDefault() { return false; }
483 
489  bool HasDomainsWithRequiredProperties();
490 
494  virtual void ClearUncheckedElements() {}
495 
496 protected:
497  vtkSMProperty();
498  ~vtkSMProperty();
499 
501  friend class vtkSMProxy;
502  friend class vtkSMSubPropertyIterator;
503  friend class vtkSMDomainIterator;
504  friend class vtkSMSourceProxy;
505  friend class vtkSMDomain;
507 
511  virtual void WriteTo(vtkSMMessage* msg);
512 
516  virtual void ReadFrom(const vtkSMMessage*, int vtkNotUsed(message_offset), vtkSMProxyLocator*){};
517 
522  virtual int ReadXMLAttributes(vtkSMProxy* parent, vtkPVXMLElement* element);
523 
528  virtual void UpdateAllInputs(){};
529 
531 
537  vtkSetStringMacro(XMLName);
539 
544  vtkSMProperty* NewProperty(const char* name);
545 
550  void AddDependent(vtkSMDomain* dom);
551 
555  void RemoveAllDependents();
556 
568  void UpdateDomains();
569 
575  virtual void SaveState(
576  vtkPVXMLElement* parent, const char* property_name, const char* uid, int saveDomains = 1);
581  virtual void SaveStateValues(vtkPVXMLElement* propertyElement);
582 
586  virtual void SaveDomainState(vtkPVXMLElement* propertyElement, const char* uid);
587 
591  virtual int LoadState(vtkPVXMLElement* element, vtkSMProxyLocator* loader);
592 
594 
595  char* Command;
596 
598 
603 
604  char* XMLName;
605  char* XMLLabel;
606  vtkSetStringMacro(XMLLabel);
607 
608  char* PanelVisibility;
610  char* PanelWidget;
611 
613 
614  vtkSetMacro(InformationOnly, int);
615  int InformationOnly;
616 
617  vtkSetMacro(IgnoreSynchronization, int);
619 
620  vtkSMInformationHelper* InformationHelper;
621 
622  void SetInformationProperty(vtkSMProperty* ip);
624 
626  void SetDocumentation(vtkSMDocumentation*);
627 
629 
631 
634  bool SetBlockModifiedEvents(bool block)
635  {
636  bool prev = this->BlockModifiedEvents;
637  this->BlockModifiedEvents = block;
638  return prev;
639  }
641 
643 
647  vtkGetMacro(PendingModifiedEvents, bool);
649 
650  // Proxy is not reference-counted to avoid reference loops.
651  void SetParent(vtkSMProxy* proxy);
652 
653  vtkWeakPointer<vtkSMProxy> Proxy;
654 
655  // Flag used to ignore property when building Proxy state for Undo/Redo state.
656  // The default value is false.
658  vtkSetMacro(StateIgnored, bool);
659  vtkBooleanMacro(StateIgnored, bool);
660 
661  // Links for properties that "subscribe" to changes to this property.
663 
664 private:
665  vtkSMProperty(const vtkSMProperty&) VTK_DELETE_FUNCTION;
666  void operator=(const vtkSMProperty&) VTK_DELETE_FUNCTION;
667 
668  // Callback to fire vtkCommand::DomainModifiedEvent every time any of the
669  // domains change.
670  void InvokeDomainModifiedEvent();
671 
676  void CreatePrettyLabel(const char* name);
677 
678  bool PendingModifiedEvents;
679  bool BlockModifiedEvents;
680 };
681 
682 #define vtkSMPropertyTemplateMacroCase(typeSMProperty, type, prop, call) \
683  if (typeSMProperty* SM_PROPERTY = typeSMProperty::SafeDownCast(prop)) \
684  { \
685  (void)SM_PROPERTY; \
686  typedef type SM_TT; \
687  call; \
688  }
689 #define vtkSMVectorPropertyTemplateMacro(prop, call) \
690  vtkSMPropertyTemplateMacroCase(vtkSMDoubleVectorProperty, double, prop, call) \
691  vtkSMPropertyTemplateMacroCase(vtkSMIntVectorProperty, int, prop, call) \
692  vtkSMPropertyTemplateMacroCase(vtkSMIdTypeVectorProperty, vtkIdType, prop, call) \
693  vtkSMPropertyTemplateMacroCase(vtkSMStringVectorProperty, vtkStdString, prop, call)
694 
695 #endif
vtkSMProperty * InformationProperty
virtual void Modified()
Overridden to support blocking of modified events.
iterates over domains of a property
vtkSMDomainIterator * DomainIterator
vtkSMPropertyLink * Links
void PrintSelf(ostream &os, vtkIndent indent)
superclass for all SM properties
Store messages for the interpreter.
vtkSMInformationHelper * InformationHelper
Header class that setup every thing in order to use Protobuf messages in a transparent manner...
represents the possible values a property can have
Definition: vtkSMDomain.h:48
virtual bool IsStateIgnored()
superclass for most server manager classes
Definition: vtkSMObject.h:31
proxy for a VTK source on a server
int IgnoreSynchronization
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:152
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.
virtual void UpdateAllInputs()
Update all proxies referred by this property (if any).