A directed acyclic graph to manage data hierarchy and relationships between hierarchy nodes. More...
#include <vtkSubsetInclusionLattice.h>
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... | |
![]() | |
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) |
vtkCommand * | GetCommand (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) |
vtkCommand * | GetCommand (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) |
![]() | |
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 vtkSubsetInclusionLattice * | New () |
static int | IsTypeOf (const char *type) |
static vtkSubsetInclusionLattice * | SafeDownCast (vtkObject *o) |
static vtkSmartPointer< vtkSubsetInclusionLattice > | Clone (const vtkSubsetInclusionLattice *other) |
Creates a new clone of other . More... | |
![]() | |
static vtkObject * | New () |
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 vtkTypeBool | IsTypeOf (const char *name) |
static vtkObjectBase * | New () |
static vtkObjectBase * | New () |
Protected Member Functions | |
vtkSubsetInclusionLattice () | |
~vtkSubsetInclusionLattice () | |
![]() | |
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 () |
![]() | |
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 vtkInformationObjectBaseKey * | SUBSET_INCLUSION_LATTICE () |
Key used to provide an instance of vtkSubsetInclusionLattice in the output information during vtkAlgorithm 's RequestInformation pass. More... | |
static vtkSubsetInclusionLattice * | GetSIL (vtkInformation *info) |
Retrieve an instance of this class from an information object. More... | |
static vtkSubsetInclusionLattice * | GetSIL (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< int > | GetChildren (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 | |
![]() | |
bool | Debug |
vtkTimeStamp | MTime |
vtkSubjectHelper * | SubjectHelper |
![]() | |
vtkAtomicInt32 | ReferenceCount |
vtkWeakPointerBase ** | WeakPointers |
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.
vtkSubsetInclusionLattice fires the following events
vtkCommand::ModifiedEvent
is fired whenever the structure is modified e.g. new nodes or links are added, or state is restored using Deserialize
. vtkCommand::StateChangedEvent
is fired whenever the selection state for any node changes. The calldata points to the int
which is the node's id.Definition at line 76 of file vtkSubsetInclusionLattice.h.
Definition at line 80 of file vtkSubsetInclusionLattice.h.
using vtkSubsetInclusionLattice::SelectionType = std::map<std::string, bool> |
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.
Enumerator | |
---|---|
NotSelected | |
Selected | |
PartiallySelected |
Definition at line 164 of file vtkSubsetInclusionLattice.h.
|
protected |
|
protected |
|
static |
|
virtual |
Reimplemented from vtkObjectBase.
|
static |
|
overridevirtual |
Reimplemented from vtkObject.
void vtkSubsetInclusionLattice::Initialize | ( | ) |
Initializes the SIL.
std::string vtkSubsetInclusionLattice::Serialize | ( | ) | const |
Saves the SIL state to a string.
bool vtkSubsetInclusionLattice::Deserialize | ( | const std::string & | data | ) |
Deserializes the SIL state from a string.
bool vtkSubsetInclusionLattice::Deserialize | ( | const char * | data | ) |
Deserializes the SIL state from a string.
void vtkSubsetInclusionLattice::DeepCopy | ( | const vtkSubsetInclusionLattice * | other | ) |
Copies the contents from other
.
void vtkSubsetInclusionLattice::Merge | ( | const std::string & | state | ) |
Merges with state from another instance.
void vtkSubsetInclusionLattice::Merge | ( | const vtkSubsetInclusionLattice * | other | ) |
Merges with another instance of vtkSubsetInclusionLattice.
Add a node to the SIL.
[in] | name | name for the node. There is no requirement that names are unique. |
[in] | parent | the id for the parent node. Default is the root of the SIL. |
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 //
.
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.
[in] | src | id for the source node. |
[out] | dst | id for the destination node. |
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
/
or a //
.[in] | path | path for the node to find. |
SelectionStates vtkSubsetInclusionLattice::GetSelectionState | ( | int | node | ) | const |
Get the current state for a specific node.
[in] | node | the id for the node of interest. |
SelectionStates::NotSelected
if the node is invalid.
|
inline |
Get the current state for a node given its path.
[in] | path | the path for the node of interest (see FindNode ). |
SelectionStates::NotSelected
if the node is invalid. Definition at line 187 of file vtkSubsetInclusionLattice.h.
bool vtkSubsetInclusionLattice::Select | ( | const char * | path | ) |
Select a node.
A new node will be added at the path indicated if none exists.
bool vtkSubsetInclusionLattice::Deselect | ( | const char * | path | ) |
Deselect a node.
A new node will be added at the path indicated if none exists.
bool vtkSubsetInclusionLattice::Select | ( | int | node | ) |
Select/deselect nodes using their node id's.
Returns true if the selection state for the node was changed.
bool vtkSubsetInclusionLattice::Deselect | ( | int | node | ) |
Select/deselect nodes using their node id's.
Returns true if the selection state for the node was changed.
void vtkSubsetInclusionLattice::ClearSelections | ( | ) |
Clears all selection statuses.
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.
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).
|
virtual |
Returns the time stamp for the most recent selection state change.
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.
Returns the id for the parent of a node.
-1 is returned for the parent of the root node.
Returns a node's name.
nullptr if not valid.
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
.
void vtkSubsetInclusionLattice::SetSelection | ( | const SelectionType & | selection | ) |
Set the paths for nodes to select.
It will create current selection state
|
overridevirtual |
Overridden to modify SelectionChangeTime, since any time the SIL structure is modified, it's akin to selection states being modified.
Reimplemented from vtkObject.
|
static |
Retrieve an instance of this class from an information object.
|
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).
|
static |
Creates a new clone of other
.
bool vtkSubsetInclusionLattice::IsMaxedOut | ( | ) |
|
friend |
Definition at line 310 of file vtkSubsetInclusionLattice.h.