Proxy And Property Links

From ParaQ Wiki
Jump to navigationJump to search

This page describes the the Proxy and Property Links in ServerManager. Linking is a means of binding two (or more) proxies (or properties) together so that when one of the input proxy (or property) is changed, all the output proxies (or properties) also reflect the change.

vtkSMLink

This is the abstract superclass class for links.

vtkSMProxyLink

This class facilitates linking between two proxies. Proxies can be added to the link using void AddLinkedProxy(vtkSMProxy* proxy, int updateDir). Every link can contain more than one proxy. Every proxy added to the link has a direction in the link (either INPUT or OUTPUT). It's an MxN linking, hence there can be more than one proxy for each direction. However a proxy can be added to the link only in one direction i.e. a proxy cannot be both the INPUT and OUTPUT in the same link. The link adds observers to listen to the PropertyModifiedEvent and UpdateEvent on the INPUT proxy. Whenever a property on a input proxy is modified, the link iterates over all OUTPUT proxies that have a property with the same name as the property on the input that was modified, and copies the values from the input property to the corresponding property on the output proxy. Likewise, when UpdateVTKObjects() is called on a proxy in the INPUT direction, every proxy in the OUTPUT direction is updated.

vtkSMPropertyLink

Proxy links bind proxies together, while property links bind individual properties. void AddLinkedProperty(vtkSMProxy* proxy, const char* propertyname, int updateDir) is used to add a property to the link. Like proxy links, property links and MxN.

Registeration with Proxy Manager and State

Links can registred with proxy manager using void RegisterLink(const char* linkname, vtkSMLink* link). Name must be unique otherwise the link previously registered with the given name is replaced. All registered links get saved when the Proxy Manager state is saved. vtkSMStateLoader can load link states from the server manager state XML and set up links appropriately while loading the state. All links are saved under the <Links> element in the state XML. eg state

 <Links>
   <PropertyLink name="link">
     <Property id="4" name="Center" direction="output"/>
     <Property id="4" name="Radius" direction="input"/>
   </PropertyLink>
   <ProxyLink name="proxylink">
     <Proxy id="4" direction="output" />
     <Proxy id="6" direction="output" />
     <Proxy id="5" direction="input" />
   </ProxyLink>
 </Links>