Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
vtkSubsetInclusionLattice Class Reference

A directed acyclic graph to manage data hierarchy and relationships between hierarchy nodes. More...

#include <vtkSubsetInclusionLattice.h>

Inheritance diagram for vtkSubsetInclusionLattice:
Inheritance graph
[legend]
Collaboration diagram for vtkSubsetInclusionLattice:
Collaboration graph
[legend]

Public Types

enum  SelectionStates { NotSelected = 0, Selected, PartiallySelected }
 
typedef vtkObject Superclass
 

Public Member Functions

virtual const char * GetClassName ()
 
virtual int IsA (const char *type)
 
void PrintSelf (ostream &os, vtkIndent indent) override
 
void Initialize ()
 Initializes the SIL. More...
 
std::string Serialize () const
 Saves the SIL state to a string. More...
 
void DeepCopy (const vtkSubsetInclusionLattice *other)
 Copies the contents from other. More...
 
void Merge (const std::string &state)
 Merges with state from another instance. More...
 
void Merge (const vtkSubsetInclusionLattice *other)
 Merges with another instance of vtkSubsetInclusionLattice. More...
 
int AddNode (const char *name, int parent=0)
 Add a node to the SIL. More...
 
int AddNodeAtPath (const char *path)
 Add a node to the SIL at the given path. More...
 
bool AddCrossLink (int src, int dst)
 A cross link is directed link between nodes in two sub-trees. More...
 
int FindNode (const char *path) const
 Find the id for a node given a path expression to locate it. More...
 
SelectionStates GetSelectionState (int node) const
 Get the current state for a specific node. More...
 
SelectionStates GetSelectionState (const char *path) const
 Get the current state for a node given its path. More...
 
bool Select (const char *path)
 Select a node. More...
 
bool Deselect (const char *path)
 Deselect a node. More...
 
void ClearSelections ()
 Clears all selection statuses. More...
 
bool IsMaxedOut ()
 
bool Deserialize (const std::string &data)
 Deserializes the SIL state from a string. More...
 
bool Deserialize (const char *data)
 Deserializes the SIL state from a string. More...
 
bool Select (int node)
 Select/deselect nodes using their node id's. More...
 
bool Deselect (int node)
 Select/deselect nodes using their node id's. More...
 
- Public Member Functions inherited from vtkObject
 vtkBaseTypeMacro (vtkObject, vtkObjectBase)
 
virtual void DebugOn ()
 
virtual void DebugOff ()
 
bool GetDebug ()
 
void SetDebug (bool debugFlag)
 
virtual vtkMTimeType GetMTime ()
 
void RemoveObserver (unsigned long tag)
 
void RemoveObservers (unsigned long event)
 
void RemoveObservers (const char *event)
 
void RemoveAllObservers ()
 
int HasObserver (unsigned long event)
 
int HasObserver (const char *event)
 
int InvokeEvent (unsigned long event)
 
int InvokeEvent (const char *event)
 
unsigned long AddObserver (unsigned long event, vtkCommand *, float priority=0.0f)
 
unsigned long AddObserver (const char *event, vtkCommand *, float priority=0.0f)
 
vtkCommandGetCommand (unsigned long tag)
 
void RemoveObserver (vtkCommand *)
 
void RemoveObservers (unsigned long event, vtkCommand *)
 
void RemoveObservers (const char *event, vtkCommand *)
 
int HasObserver (unsigned long event, vtkCommand *)
 
int HasObserver (const char *event, vtkCommand *)
 
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f)
 
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 
unsigned long AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 
int InvokeEvent (unsigned long event, void *callData)
 
int InvokeEvent (const char *event, void *callData)
 
unsigned long AddObserver (unsigned long event, vtkCommand *, float priority=0.0f)
 
unsigned long AddObserver (const char *event, vtkCommand *, float priority=0.0f)
 
vtkCommandGetCommand (unsigned long tag)
 
void RemoveObserver (vtkCommand *)
 
void RemoveObservers (unsigned long event, vtkCommand *)
 
void RemoveObservers (const char *event, vtkCommand *)
 
int HasObserver (unsigned long event, vtkCommand *)
 
int HasObserver (const char *event, vtkCommand *)
 
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f)
 
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 
unsigned long AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 
int InvokeEvent (unsigned long event, void *callData)
 
int InvokeEvent (const char *event, void *callData)
 
- Public Member Functions inherited from vtkObjectBase
const char * GetClassName () const
 
virtual void Delete ()
 
virtual void FastDelete ()
 
void Print (ostream &os)
 
virtual void Register (vtkObjectBase *o)
 
virtual void UnRegister (vtkObjectBase *o)
 
void SetReferenceCount (int)
 
virtual void PrintHeader (ostream &os, vtkIndent indent)
 
virtual void PrintTrailer (ostream &os, vtkIndent indent)
 
int GetReferenceCount ()
 
void PrintRevisions (ostream &)
 
virtual void PrintHeader (ostream &os, vtkIndent indent)
 
virtual void PrintTrailer (ostream &os, vtkIndent indent)
 
int GetReferenceCount ()
 
void PrintRevisions (ostream &)
 

Static Public Member Functions

static vtkSubsetInclusionLatticeNew ()
 
static int IsTypeOf (const char *type)
 
static vtkSubsetInclusionLatticeSafeDownCast (vtkObject *o)
 
static vtkSmartPointer< vtkSubsetInclusionLatticeClone (const vtkSubsetInclusionLattice *other)
 Creates a new clone of other. More...
 
- Static Public Member Functions inherited from vtkObject
static vtkObjectNew ()
 
static void BreakOnError ()
 
static void SetGlobalWarningDisplay (int val)
 
static void GlobalWarningDisplayOn ()
 
static void GlobalWarningDisplayOff ()
 
static int GetGlobalWarningDisplay ()
 
static void SetGlobalWarningDisplay (int val)
 
static void GlobalWarningDisplayOn ()
 
static void GlobalWarningDisplayOff ()
 
static int GetGlobalWarningDisplay ()
 
- Static Public Member Functions inherited from vtkObjectBase
static vtkTypeBool IsTypeOf (const char *name)
 
static vtkObjectBaseNew ()
 
static vtkObjectBaseNew ()
 

Protected Member Functions

 vtkSubsetInclusionLattice ()
 
 ~vtkSubsetInclusionLattice ()
 
- Protected Member Functions inherited from vtkObject
 vtkObject ()
 
virtual ~vtkObject ()
 
void RegisterInternal (vtkObjectBase *, vtkTypeBool check) VTK_OVERRIDE
 
void UnRegisterInternal (vtkObjectBase *, vtkTypeBool check) VTK_OVERRIDE
 
void InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=NULL)
 
void InternalReleaseFocus ()
 
void InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=NULL)
 
void InternalReleaseFocus ()
 
- Protected Member Functions inherited from vtkObjectBase
 vtkObjectBase ()
 
virtual ~vtkObjectBase ()
 
virtual void CollectRevisions (ostream &)
 
virtual void ReportReferences (vtkGarbageCollector *)
 
 vtkObjectBase (const vtkObjectBase &)
 
void operator= (const vtkObjectBase &)
 

Friends

class vtkInternals
 
using SelectionType = std::map< std::string, bool >
 This defines the type for selection states for nodes exposed by API. More...
 
static vtkInformationObjectBaseKeySUBSET_INCLUSION_LATTICE ()
 Key used to provide an instance of vtkSubsetInclusionLattice in the output information during vtkAlgorithm's RequestInformation pass. More...
 
static vtkSubsetInclusionLatticeGetSIL (vtkInformation *info)
 Retrieve an instance of this class from an information object. More...
 
static vtkSubsetInclusionLatticeGetSIL (vtkInformationVector *v, int i=0)
 This defines the type for selection states for nodes exposed by API. More...
 
bool SelectAll (const char *path)
 Select/Deselect all nodes that match the path. More...
 
bool DeselectAll (const char *path)
 This defines the type for selection states for nodes exposed by API. More...
 
virtual vtkMTimeType GetSelectionChangeTime ()
 Returns the time stamp for the most recent selection state change. More...
 
std::vector< intGetChildren (int node) const
 Returns a vector of node ids for child nodes of a node. More...
 
int GetParent (int node, int *childIndex=nullptr) const
 Returns the id for the parent of a node. More...
 
const char * GetNodeName (int node) const
 Returns a node's name. More...
 
SelectionType GetSelection () const
 Get the paths for currently selected/deselected nodes. More...
 
void SetSelection (const SelectionType &selection)
 Set the paths for nodes to select. More...
 
void Modified () override
 Overridden to modify SelectionChangeTime, since any time the SIL structure is modified, it's akin to selection states being modified. More...
 

Additional Inherited Members

- Protected Attributes inherited from vtkObject
bool Debug
 
vtkTimeStamp MTime
 
vtkSubjectHelper * SubjectHelper
 
- Protected Attributes inherited from vtkObjectBase
vtkAtomicInt32 ReferenceCount
 
vtkWeakPointerBase ** WeakPointers
 

Detailed Description

A directed acyclic graph to manage data hierarchy and relationships between hierarchy nodes.

vtkSubsetInclusionLattice is designed to help readers to describe hierarchical relationships in data-blocks in the file as well as offer the user ability to select data-blocks to read (or not read).

vtkSubsetInclusionLattice provides API to build a hierarchical description of the data-blocks. It internally uses XML to store a directed-acyclic graph of relations between blocks using nodes the XML. Parent-child links are directly stored in XML as such. However, that is not sufficient for readers with different ways of selecting blocks e.g. CGNS reader supports selecting block using block names or families. To support such cases, the approach used is to have a subtree for each "class" of control and then support cross links between subtrees. The construction API, which includes AddNode, and AddCrossLink allows building of such subtrees with cross links.

The selection API allows selecting nodes. The selection API provided by vtkSubsetInclusionLattice is fairly basic and not most intuitive for the users. Readers are expected to subclass vtkSubsetInclusionLattice to provide selection API relevant to the file format using the terminology natural to the file format users.

Typically, an instance of vtkSubsetInclusionLattice is constructed by the reader using information in the file in Reader::RequestInformation. Then, users can query the vtkSubsetInclusionLattice (or subclass) for information about various classifications and then select blocks. In an ideal world, Reader::RequestInformation will be called before user makes selection requests i.e. the vtkSubsetInclusionLattice will be constructed using construction API before using any of the selection API. However, that may not always be the case. Hence, when Select or Deselect methods are called with a path string as the argument, they add new nodes to the tree.

Events

vtkSubsetInclusionLattice fires the following events

See also
vtkCGNSSubsetInclusionLattice

Definition at line 76 of file vtkSubsetInclusionLattice.h.

Member Typedef Documentation

◆ Superclass

Definition at line 80 of file vtkSubsetInclusionLattice.h.

◆ SelectionType

This defines the type for selection states for nodes exposed by API.

The key is the path to a node and value is the status (true if selected, false if not).

Definition at line 257 of file vtkSubsetInclusionLattice.h.

Member Enumeration Documentation

◆ SelectionStates

Enumerator
NotSelected 
Selected 
PartiallySelected 

Definition at line 164 of file vtkSubsetInclusionLattice.h.

Constructor & Destructor Documentation

◆ vtkSubsetInclusionLattice()

vtkSubsetInclusionLattice::vtkSubsetInclusionLattice ( )
protected

◆ ~vtkSubsetInclusionLattice()

vtkSubsetInclusionLattice::~vtkSubsetInclusionLattice ( )
protected

Member Function Documentation

◆ New()

static vtkSubsetInclusionLattice* vtkSubsetInclusionLattice::New ( )
static

◆ GetClassName()

virtual const char* vtkSubsetInclusionLattice::GetClassName ( )
virtual

◆ IsTypeOf()

static int vtkSubsetInclusionLattice::IsTypeOf ( const char *  type)
static

◆ IsA()

virtual int vtkSubsetInclusionLattice::IsA ( const char *  type)
virtual

Reimplemented from vtkObjectBase.

◆ SafeDownCast()

static vtkSubsetInclusionLattice* vtkSubsetInclusionLattice::SafeDownCast ( vtkObject o)
static

◆ PrintSelf()

void vtkSubsetInclusionLattice::PrintSelf ( ostream &  os,
vtkIndent  indent 
)
overridevirtual

Reimplemented from vtkObject.

◆ Initialize()

void vtkSubsetInclusionLattice::Initialize ( )

Initializes the SIL.

◆ Serialize()

std::string vtkSubsetInclusionLattice::Serialize ( ) const

Saves the SIL state to a string.

◆ Deserialize() [1/2]

bool vtkSubsetInclusionLattice::Deserialize ( const std::string data)

Deserializes the SIL state from a string.

◆ Deserialize() [2/2]

bool vtkSubsetInclusionLattice::Deserialize ( const char *  data)

Deserializes the SIL state from a string.

◆ DeepCopy()

void vtkSubsetInclusionLattice::DeepCopy ( const vtkSubsetInclusionLattice other)

Copies the contents from other.

◆ Merge() [1/2]

void vtkSubsetInclusionLattice::Merge ( const std::string state)

Merges with state from another instance.

◆ Merge() [2/2]

void vtkSubsetInclusionLattice::Merge ( const vtkSubsetInclusionLattice other)

Merges with another instance of vtkSubsetInclusionLattice.

◆ AddNode()

int vtkSubsetInclusionLattice::AddNode ( const char *  name,
int  parent = 0 
)

Add a node to the SIL.

Parameters
[in]namename for the node. There is no requirement that names are unique.
[in]parentthe id for the parent node. Default is the root of the SIL.
Returns
the id for the newly added node on success, or -1 on failure.

◆ AddNodeAtPath()

int vtkSubsetInclusionLattice::AddNodeAtPath ( const char *  path)

Add a node to the SIL at the given path.

Unlike path for FindNode which can be incomplete, the path for here must be fully qualified i.e. start with / and cannot have a //.

◆ AddCrossLink()

bool vtkSubsetInclusionLattice::AddCrossLink ( int  src,
int  dst 
)

A cross link is directed link between nodes in two sub-trees.

Care must be taken to avoid cycles. The current implementation does not check for cycles although such a capability can be added in the future.

Parameters
[in]srcid for the source node.
[out]dstid for the destination node.
Returns
true on success, else false. May fail if either of the ids specified are invalid.

◆ FindNode()

int vtkSubsetInclusionLattice::FindNode ( const char *  path) const

Find the id for a node given a path expression to locate it.

Path can be specified as a fully or partially qualified, '/'-separated location of the node.

e.g.

  • /Block0
  • /Assembly/Component0/Block0
  • /Assembly//Block0
  • //Block0
Note
a valid patch must begin with / or a //.
Parameters
[in]pathpath for the node to find.
Returns
index of the node or -1 if not found.

◆ GetSelectionState() [1/2]

SelectionStates vtkSubsetInclusionLattice::GetSelectionState ( int  node) const

Get the current state for a specific node.

Parameters
[in]nodethe id for the node of interest.
Returns
the status of the node. Will return SelectionStates::NotSelected if the node is invalid.

◆ GetSelectionState() [2/2]

SelectionStates vtkSubsetInclusionLattice::GetSelectionState ( const char *  path) const
inline

Get the current state for a node given its path.

Parameters
[in]paththe path for the node of interest (see FindNode).
Returns
the status of the node. Will return SelectionStates::NotSelected if the node is invalid.

Definition at line 187 of file vtkSubsetInclusionLattice.h.

◆ Select() [1/2]

bool vtkSubsetInclusionLattice::Select ( const char *  path)

Select a node.

A new node will be added at the path indicated if none exists.

◆ Deselect() [1/2]

bool vtkSubsetInclusionLattice::Deselect ( const char *  path)

Deselect a node.

A new node will be added at the path indicated if none exists.

◆ Select() [2/2]

bool vtkSubsetInclusionLattice::Select ( int  node)

Select/deselect nodes using their node id's.

Returns true if the selection state for the node was changed.

◆ Deselect() [2/2]

bool vtkSubsetInclusionLattice::Deselect ( int  node)

Select/deselect nodes using their node id's.

Returns true if the selection state for the node was changed.

◆ ClearSelections()

void vtkSubsetInclusionLattice::ClearSelections ( )

Clears all selection statuses.

◆ SelectAll()

bool vtkSubsetInclusionLattice::SelectAll ( const char *  path)

Select/Deselect all nodes that match the path.

This is useful to bulk select/deselect nodes. Note, however, that this cannot be used to add new nodes to the structure, unlike Select and Deselect calls.

Returns
true if a matching node was found and its state was changed.

◆ DeselectAll()

bool vtkSubsetInclusionLattice::DeselectAll ( const char *  path)

This defines the type for selection states for nodes exposed by API.

The key is the path to a node and value is the status (true if selected, false if not).

◆ GetSelectionChangeTime()

virtual vtkMTimeType vtkSubsetInclusionLattice::GetSelectionChangeTime ( )
virtual

Returns the time stamp for the most recent selection state change.

◆ GetChildren()

std::vector<int> vtkSubsetInclusionLattice::GetChildren ( int  node) const

Returns a vector of node ids for child nodes of a node.

Note that cross-links are not treated same as parent child relationships and hence won't be returned here.

◆ GetParent()

int vtkSubsetInclusionLattice::GetParent ( int  node,
int childIndex = nullptr 
) const

Returns the id for the parent of a node.

-1 is returned for the parent of the root node.

◆ GetNodeName()

const char* vtkSubsetInclusionLattice::GetNodeName ( int  node) const

Returns a node's name.

nullptr if not valid.

◆ GetSelection()

SelectionType vtkSubsetInclusionLattice::GetSelection ( ) const

Get the paths for currently selected/deselected nodes.

The list comprises of a subset of paths for nodes on which Select or Deselect was called since the last Initialize.

◆ SetSelection()

void vtkSubsetInclusionLattice::SetSelection ( const SelectionType selection)

Set the paths for nodes to select.

It will create current selection state

◆ Modified()

void vtkSubsetInclusionLattice::Modified ( )
overridevirtual

Overridden to modify SelectionChangeTime, since any time the SIL structure is modified, it's akin to selection states being modified.

Reimplemented from vtkObject.

◆ GetSIL() [1/2]

static vtkSubsetInclusionLattice* vtkSubsetInclusionLattice::GetSIL ( vtkInformation info)
static

Retrieve an instance of this class from an information object.

◆ GetSIL() [2/2]

static vtkSubsetInclusionLattice* vtkSubsetInclusionLattice::GetSIL ( vtkInformationVector v,
int  i = 0 
)
static

This defines the type for selection states for nodes exposed by API.

The key is the path to a node and value is the status (true if selected, false if not).

◆ Clone()

static vtkSmartPointer<vtkSubsetInclusionLattice> vtkSubsetInclusionLattice::Clone ( const vtkSubsetInclusionLattice other)
static

Creates a new clone of other.

◆ IsMaxedOut()

bool vtkSubsetInclusionLattice::IsMaxedOut ( )

Friends And Related Function Documentation

◆ vtkInternals

friend class vtkInternals
friend

Definition at line 310 of file vtkSubsetInclusionLattice.h.


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