SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
Classes | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes | Friends | List of all members
pqSMTKBehavior Class Reference

Create and synchronize smtk manager instances on the client and server. More...

#include <pqSMTKBehavior.h>

Inheritance diagram for pqSMTKBehavior:
[legend]
Collaboration diagram for pqSMTKBehavior:
[legend]

Classes

class  Internal
 

Public Slots

virtual bool setPostProcessingMode (bool inPost)
 Set whether post-processing mode is enabled (true) or disabled (false; default). More...
 

Signals

void addedManagerOnServer (vtkSMSMTKWrapperProxy *mgr, pqServer *server)
 Called from within addManagerOnServer (in response to server becoming ready)
 
void addedManagerOnServer (pqSMTKWrapper *mgr, pqServer *server)
 
void removingManagerFromServer (vtkSMSMTKWrapperProxy *mgr, pqServer *server)
 Called from within removeManagerFromServer (in response to server disconnect prep)
 
void removingManagerFromServer (pqSMTKWrapper *mgr, pqServer *server)
 
void postProcessingModeChanged (bool isPostProcessing)
 Called from within setPostProcessingMode.
 
void pipelineSourceCreated (smtk::resource::ResourcePtr smtkResource, pqSMTKResource *pipelineSource)
 Connected in pqSMTKAppComponentsAutoStart::startup()
 
void aboutToDestroyPipelineSource (smtk::resource::ResourcePtr smtkResource, pqSMTKResource *pipelineSource)
 Connected in pqSMTKAppComponentsAutoStart::startup()
 

Public Member Functions

virtual void addPQProxy (pqSMTKWrapper *rsrcMgr)
 
pqSMTKWrapper * getPVResourceManager (smtk::resource::ManagerPtr rsrcMgr)
 Return the pqSMTKWrapper for a given smtk::resource::ManagerPtr.
 
QPointer< pqSMTKResourcegetPVResource (const smtk::resource::ResourcePtr &rsrc) const
 Return the pqSMTKResource for a given smtk::resource::ResourcePtr. More...
 
vtkSMProxy * getPVResourceProxy (const smtk::resource::ResourcePtr &rsrc) const
 Return the vtkSMProxy for a given smtk::resource::ResourcePtr.
 
virtual void visitResourceManagersOnServers (const std::function< bool(pqSMTKWrapper *, pqServer *)> &fn) const
 Call a visitor function fn on each existing resource manager/server pair. More...
 
bool createRepresentation (pqSMTKResource *pvr, pqView *view)
 Create a pqDataRepresentation and set its default visibility value.
 
pqSMTKWrapper * builtinOrActiveWrapper () const
 Return the SMTK wrapper serving the client process, or, failing that, the active server's wrapper (or null if none can be located).
 
bool postProcessingMode () const
 Return whether SMTK is in "post-processing" mode or not.
 
void updateWrapperMap ()
 Update the map from servers to SMTK wrappers. More...
 
bool showObjects (bool show, const std::set< smtk::resource::PersistentObject * > &objects, pqView *view=nullptr)
 Show (or hide) the given objects. More...
 
bool showObjects (bool show, const smtk::view::ResourceMap &visibilityMap, pqView *view=nullptr)
 This version of showObjects accepts a visibilityMap. More...
 
bool showObjects (bool show, const smtk::view::SharedResourceMap &visibilityMap, pqView *view=nullptr)
 
vtkSMSMTKWrapperProxy * wrapperProxy (pqServer *server=nullptr) const
 Return the server-side container of counterparts for the managers above. More...
 
pqSMTKWrapper * resourceManagerForServer (pqServer *server=nullptr) const
 Return the server-side container of counterparts for the managers above. More...
 

Static Public Member Functions

static pqSMTKBehaviorinstance (QObject *parent=nullptr)
 
static void processEvents ()
 process non-user QT events
 
static void importPythonOperationsForModule (const std::string &moduleName, const std::string &operationName)
 Register operations from the named module after the event loop starts. More...
 

Protected Slots

virtual void addManagerOnServer (pqServer *)
 Called whenever a PV server becomes ready.
 
virtual void removeManagerFromServer (pqServer *)
 Called whenever a PV server is about to be disconnected.
 
virtual void handleNewSMTKProxies (pqProxy *pxy)
 Track when SMTK proxies are added (not all pxy may cast to SMTK objects but some may)
 
virtual void handleOldSMTKProxies (pqPipelineSource *pxy)
 Track when resources are removed (not all pxy may cast to SMTK objects but some may)
 
virtual void updateResourceProxyMap (const std::shared_ptr< smtk::resource::Resource > &resource)
 Track when SMTK proxy resources are changed.
 

Protected Member Functions

 pqSMTKBehavior (QObject *parent=nullptr)
 
void setupSelectionManager ()
 
void setDefaultRepresentationVisibility (pqOutputPort *pqPort, pqView *view)
 Make a representation visible through a ControllerWithRendering instance.
 

Protected Attributes

Internalm_p
 
bool m_postProcessingMode { false }
 

Friends

class pqSMTKAppComponentsAutoStart
 

Detailed Description

Create and synchronize smtk manager instances on the client and server.

This instance will watch for server connection/disconnection events. When a new server is connected, it will have the server-manager instantiate an smtk::resource::Manager there. When a server is disconnected, it will remove information from the client about that server's resources.

At the moment, all this class does is create a resource manager and expose it. It should eventually deal with synchronization issues as stated above, but SMTK's resource manager doesn't deal with remote resources yet.

Member Function Documentation

◆ getPVResource()

QPointer< pqSMTKResource > pqSMTKBehavior::getPVResource ( const smtk::resource::ResourcePtr rsrc) const

Return the pqSMTKResource for a given smtk::resource::ResourcePtr.

Note that this is an O(N) operation (linear in the number of resources loaded across all servers).

◆ importPythonOperationsForModule()

void pqSMTKBehavior::importPythonOperationsForModule ( const std::string &  moduleName,
const std::string &  operationName 
)
static

Register operations from the named module after the event loop starts.

ParaView loads plugins (including python plugins) before a server connection is established. This method queues a function to run after the event loop starts to register Python operations to the active server's operation manager.

◆ resourceManagerForServer()

pqSMTKWrapper * pqSMTKBehavior::resourceManagerForServer ( pqServer *  server = nullptr) const

Return the server-side container of counterparts for the managers above.

If server is null, a random server's proxy is chosen. Since most apps connect to a single server, this is usually well-defined.

◆ setPostProcessingMode

bool pqSMTKBehavior::setPostProcessingMode ( bool  inPost)
virtualslot

Set whether post-processing mode is enabled (true) or disabled (false; default).

The return value indicates whether the value changed.

◆ showObjects() [1/2]

bool pqSMTKBehavior::showObjects ( bool  show,
const smtk::view::ResourceMap &  visibilityMap,
pqView view = nullptr 
)

This version of showObjects accepts a visibilityMap.

Because the visibilityMap segregates objects into resources and their components, it is efficient; the resource's visibility is only handled once and all of the block visibilities that require changing are handled at the same time.

◆ showObjects() [2/2]

bool pqSMTKBehavior::showObjects ( bool  show,
const std::set< smtk::resource::PersistentObject * > &  objects,
pqView view = nullptr 
)

Show (or hide) the given objects.

If show is true, every object in objects is made visible and a render is requested; otherwise, every object in objects is hidden and a render is requested.

If an entry in objects is a resource, any pqRepresentation corresponding to the pqPipeline is shown/hidden. If an entry in objects is a component, matching pqRepresentation objects for the component's resource are located. The representation's visibility is toggled id show is true; otherwise it is untouched. Then the per-block visibility of the component is toggled to match show.

Thus, hiding a component will never modify the resource's visibility while showing a component may toggle the resources's visibility (as well as the block matching the component).

This function returns true if a change was made (i.e., a render() has been requested).

◆ updateWrapperMap()

void pqSMTKBehavior::updateWrapperMap ( )

Update the map from servers to SMTK wrappers.

In the ModelBuilder application, if the Python Shell panel is started after the application has started, the builtin client will not have an entry in m_p->Remotes yet. This function will ensure the active server has an entry so that Python methods on the behavior (such as activeWrapperCommonManagers()) do not return a null object.

◆ visitResourceManagersOnServers()

void pqSMTKBehavior::visitResourceManagersOnServers ( const std::function< bool(pqSMTKWrapper *, pqServer *)> &  fn) const
virtual

Call a visitor function fn on each existing resource manager/server pair.

This method has the same signature as the addedManagerOnServer signal, so you can pass a simple lambda that invokes your class's slot to the signal. This way, you can attach signals to resource managers already in existence in addition to those created after your class's initialization.

If the function returns true, then iteration should terminate.

◆ wrapperProxy()

vtkSMSMTKWrapperProxy * pqSMTKBehavior::wrapperProxy ( pqServer *  server = nullptr) const

Return the server-side container of counterparts for the managers above.

If server is null, a random server's proxy is chosen. Since most apps connect to a single server, this is usually well-defined.


The documentation for this class was generated from the following files: