Slicer 4.2
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Public Types | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Attributes
qMRMLNodeFactory Class Reference

#include <Libs/MRML/Widgets/qMRMLNodeFactory.h>

List of all members.

Public Types

typedef QHash< QString, QString > AttributeType
 Convenient typedef.
typedef QObject Superclass
 Constructors.

Public Slots

void setMRMLScene (vtkMRMLScene *mrmlScene)

Signals

void nodeAdded (vtkMRMLNode *node)
void nodeInitialized (vtkMRMLNode *node)
void nodeInstantiated (vtkMRMLNode *node)

Public Member Functions

Q_INVOKABLE void addAttribute (const QString &attributeName, const QString &attributeValue)
Q_INVOKABLE QString attribute (const QString &attributeName) const
Q_INVOKABLE QString baseName (const QString &className) const
Q_INVOKABLE vtkMRMLNodecreateNode (const QString &className)
vtkMRMLScenemrmlScene () const
 qMRMLNodeFactory (QObject *parent=0)
Q_INVOKABLE void removeAttribute (const QString &attributeName)
Q_INVOKABLE void setBaseName (const QString &className, const QString &baseName)
 Base name used to generate a name for create node.
virtual ~qMRMLNodeFactory ()

Static Public Member Functions

static vtkMRMLNodecreateNode (vtkMRMLScene *scene, const QString &className, const AttributeType &attributes=AttributeType())

Protected Attributes

QScopedPointer
< qMRMLNodeFactoryPrivate > 
d_ptr

Detailed Description

Node factory that can be used by qMRML widgets to easily create nodes If you want more control over the node creation, you can add attributes, specify a base node name or connect to signals to customize the node

Definition at line 40 of file qMRMLNodeFactory.h.


Member Typedef Documentation

typedef QHash<QString,QString> qMRMLNodeFactory::AttributeType

Convenient typedef.

Definition at line 46 of file qMRMLNodeFactory.h.

Constructors.

Definition at line 49 of file qMRMLNodeFactory.h.


Constructor & Destructor Documentation

qMRMLNodeFactory::qMRMLNodeFactory ( QObject *  parent = 0) [explicit]
virtual qMRMLNodeFactory::~qMRMLNodeFactory ( ) [virtual]

Member Function Documentation

Q_INVOKABLE void qMRMLNodeFactory::addAttribute ( const QString &  attributeName,
const QString &  attributeValue 
)

Add attribute that will be passed to any new created node. TODO: Support attributes for more than 1 node class Note: If an attribute already exist, it's value will be overwritten.

Q_INVOKABLE QString qMRMLNodeFactory::attribute ( const QString &  attributeName) const
Q_INVOKABLE QString qMRMLNodeFactory::baseName ( const QString &  className) const
Q_INVOKABLE vtkMRMLNode* qMRMLNodeFactory::createNode ( const QString &  className)

Create and add a node given its className to the scene associated with the factory. The function will fire the signals: nodeInstantiated(vtkMRMLNode*), nodeInitialized(vtkMRMLNode*), nodeAdded(vtkMRMLNode*) on that order. It allows the user to add custom steps by connecting slots to the emitted signals. No-op if the scene is 0 or if className is empty/null. However, if className is not empty but invalid (not an existing node), an assert throws an exception. Note: The attributes will be applied to the node before being added into the scene. The scene takes the ownership of the node and is responsible to delete it If the node is a singleton that already exists in the scene, the existing node is returned.

See also:
vtkMRMLScene::AddNode
static vtkMRMLNode* qMRMLNodeFactory::createNode ( vtkMRMLScene scene,
const QString &  className,
const AttributeType attributes = AttributeType() 
) [static]

Convenient method allowing to create a new node and add it to the scene

vtkMRMLScene* qMRMLNodeFactory::mrmlScene ( ) const

Get MRML scene. By default, there is no scene.

void qMRMLNodeFactory::nodeAdded ( vtkMRMLNode node) [signal]

Fired at the end when the node is added into the scene. It is emitted even if the node has been added to the scene by a custom slot connected to nodeInitialized(vtkMRMLNode*)

void qMRMLNodeFactory::nodeInitialized ( vtkMRMLNode node) [signal]

Eventually fired by the function createNode You can add the node into the scene directly here. If no slot adds the node into the scene(node->GetScene() == 0), then the node factory takes care of adding the node into the scene (default behavior).

void qMRMLNodeFactory::nodeInstantiated ( vtkMRMLNode node) [signal]

Fired right after the instantiation of the node (before any initialization) Connecting to the following signal allows a custom node creation

Q_INVOKABLE void qMRMLNodeFactory::removeAttribute ( const QString &  attributeName)
Q_INVOKABLE void qMRMLNodeFactory::setBaseName ( const QString &  className,
const QString &  baseName 
)

Base name used to generate a name for create node.

void qMRMLNodeFactory::setMRMLScene ( vtkMRMLScene mrmlScene) [slot]

Set MRML scene


Member Data Documentation

QScopedPointer<qMRMLNodeFactoryPrivate> qMRMLNodeFactory::d_ptr [protected]

Definition at line 114 of file qMRMLNodeFactory.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines