ImFusion SDK 4.3
DataGroup Class Reference

#include <ImFusion/Base/DataGroup.h>

Data element that groups multiple Data instances together in a hierarchical fashion. More...

+ Inheritance diagram for DataGroup:

Detailed Description

Data element that groups multiple Data instances together in a hierarchical fashion.

A DataGroup consists of a mutable set of other Data instances forming its children that can be added, removed or moved around at any time after construction. Furthermore, you can define an optional proxy child, which is one item of the list of children that may serve as representative dataset for the group. Clients may use or refer to the proxy child instead of the entire DataGroup in some situations. For instance, if a proxy child is defined the DataWidget may show the dataset in the place of the DataGroup instead of listing it as a child.

Note
This class serves mainly as hierarchical container type to be used by DataModel. It is discouraged to derive from DataGroup in order to create your own hierarchical Data type. Use the CompoundData interface instead which gives you more flexibility, for instance wrt. to ownership semantics.

Public Member Functions

 DataGroup (OwningDataList &&children={}, const std::string &name="")
 Creates a new empty DataGroup with optional children and the given name.
 
 DataGroup (std::unique_ptr< Data > proxyChild, OwningDataList &&children, const std::string &name="")
 Convenience constructor to create a new DataGroup with a proxy child and a list of children Due to ownership semantics, children must not contain proxyChild during construction, however after construction this will be the case (proxyChild will be the first element in children()).
 
- Public Member Functions inherited from Data
 Data (const std::string &name="")
 
 Data (const Data &other)
 
Dataoperator= (const Data &other)
 
virtual ~Data ()
 Mandatory virtual destructor.
 
virtual Modality modality () const
 Return the modality of this data.
 
const std::stringname () const
 Return the name of this data.
 
void setName (const std::string &name)
 Sets the name of this data.
 
virtual bool isAnnotationType () const
 Return whether this data type is visualized through an annotation (e.g. mesh)
 
const DataComponentListcomponents () const
 Returns the list of DataComponents for this data.
 
DataComponentListcomponents ()
 
virtual std::string describe () const
 Human readable description of the data for showing in the info bar.
 
virtual void setMatrixFromWorld (const mat4 &m)
 Set matrix mapping from the world coordinate system to the data coordinate system.
 
virtual void setMatrixToWorld (const mat4 &m)
 Set matrix mapping from the data coordinate system to the world coordinate system.
 
virtual mat4 matrixFromWorld () const
 Get matrix mapping from the world coordinate system to the data coordinate system.
 
virtual mat4 matrixToWorld () const
 Get matrix mapping from the data coordinate system to the world coordinate system.
 
virtual mat4 matrix () const
 Return the transformation matrix.
 

Protected Attributes

OwningDataList m_children
 contains all sub-data in this group including other groups
 
Datam_proxyChild = nullptr
 Optional pointer to child that should act as representative element for this group.
 
- Protected Attributes inherited from Data
mat4 m_matrix
 Transformation matrix.
 
std::recursive_mutexm_matrixMutex
 Used to internally synchronize access to the matrix of data.
 
DataComponentList m_dataComponentList
 The list of DataComponents for this data.
 

Access to the list of direct children

Signal signalProxyChildChanged
 < Signal emitted when a Data instance has changed its position in children()
 
Signal< Data * > signalChildAboutToBeRemoved
 Signal emitted when a Data instance is about to be removed or taken from children()
 
Signal< Data * > signalChildAdded
 < Signal emitted when a Data instance is about to be removed or taken from children()
 
Signal< Data * > signalChildMoved
 < Signal emitted when a new Data instance has been added to children()
 
void add (std::unique_ptr< Data > data, int position=-1)
 Inserts the given Data instance into the list of children at the given position or at the end if position is negative.
 
bool move (Data *data, int position)
 Moves data within the list of children to the given position.
 
std::unique_ptr< Dataremove (Data *data)
 Removes data from the list of children and returns its ownership to the caller.
 
void clear ()
 Removes all children from this group.
 
DataList children () const override
 Returns the list of direct children of this group.
 
DataList childrenRecursive () const
 Returns the flat list of children of this group and of all recursive subgroups in a depth-first order.
 
DataproxyChild () const
 Returns an optional item from children() that shall act as representative Data instance for this group.
 
bool setProxyChild (Data *data)
 Sets an optional item from children() that shall act as representative Data instance for this group.
 

Implementation of Data interface

Kind kind () const override
 Return the kind of this data.
 
Geometry::AlignedBox bounds () const override
 Returns the axis-aligned bounding box of this data in world space.
 
Pose::TransformationConvention matrixConvention () const override
 Defines whether the internally stored matrices in derived classes map from or to the world coordinate system.
 
void setMatrix (const mat4 &m) override
 Set the transformation matrix and updates all child matrices with the relative matrix between the old and new one.
 

Additional Inherited Members

- Public Types inherited from Data
enum  Kind {
  UNKNOWN = 0 , IMAGE = 1 , VOLUME = 2 , IMAGESET = 3 ,
  VOLUMESET = 4 , IMAGESTREAM = 5 , VOLUMESTREAM = 6 , POINTSET = 7 ,
  SURFACE = 8 , TRACKINGSTREAM = 9 , LIVETRACKINGSTREAM = TRACKINGSTREAM , TRACKINGDATA = 10 ,
  TREE = 11 , TENSOR = 12 , POLYDATASTREAM = 13 , STEREOIMAGESET = 14 ,
  STEREOIMAGESTREAM = 15 , VOLUMETRICMESH = 16
}
 Kind of data. More...
 
enum  Modality {
  NA = 0 , XRAY = 1 , CT = 2 , MRI = 3 ,
  ULTRASOUND = 4 , VIDEO = 5 , NM = 6 , OCT = 7 ,
  LABEL = 8 , DISTANCE = 9
}
 Image modality of the data. More...
 
- Static Public Member Functions inherited from Data
static std::string modalityString (Data::Modality m)
 Return the name of an image modality.
 
static Data::Modality stringToModality (const std::string &s)
 Returns the modality corresponding to a modality string or NA if nothing matches.
 
- Public Attributes inherited from Data
Signal< const Data * > signalDeleted
 Signal emitted when this instance is deleted.
 
Signal< const Data * > signalMatrixChanged
 Signal emitted when the transformation of this Data has changed.
 
Signal< std::stringsignalNameChanged
 Signal emitted when the name changed.
 
- Public Attributes inherited from CompoundData
Signal< Data * > signalChildAdded
 Signal emitted when a new Data instance has been added to children()
 
Signal< Data * > signalChildMoved
 Signal emitted when a Data instance has changed its position in children()
 
Signal< Data * > signalChildAboutToBeRemoved
 Signal emitted when a Data instance is about to be removed or taken from children()
 
- Protected Member Functions inherited from Data
void swapWith (Data &other)
 Swaps the data and emits a matrix and name changed signal for both.
 

Member Function Documentation

◆ remove()

std::unique_ptr< Data > remove ( Data * data)

Removes data from the list of children and returns its ownership to the caller.

If data is the same as proxyChild() the proxy child will be set to nullptr. Returns a nullptr in case of failure.

◆ children()

DataList children ( ) const
overridevirtual

Returns the list of direct children of this group.

Implements CompoundData.

◆ setProxyChild()

bool setProxyChild ( Data * data)

Sets an optional item from children() that shall act as representative Data instance for this group.

The proxy child must be a single dataset/must not be a DataGroup.

◆ kind()

Kind kind ( ) const
inlineoverridevirtual

Return the kind of this data.

Implements Data.

◆ bounds()

Geometry::AlignedBox bounds ( ) const
overridevirtual

Returns the axis-aligned bounding box of this data in world space.

Warning
Depending on the underlying data type this calling function may be computationally expensive! Do not call this method more often than needed, unless it is known that the caching behavior is implemented.

Implements Data.

◆ matrixConvention()

Pose::TransformationConvention matrixConvention ( ) const
inlineoverridevirtual

Defines whether the internally stored matrices in derived classes map from or to the world coordinate system.

Changes the behavior of the default implementations of matrixToWorld and matrixFromWorld.

Implements Data.

◆ setMatrix()

void setMatrix ( const mat4 & m)
overridevirtual

Set the transformation matrix and updates all child matrices with the relative matrix between the old and new one.

Reimplemented from Data.

Member Data Documentation

◆ signalProxyChildChanged

Signal signalProxyChildChanged

< Signal emitted when a Data instance has changed its position in children()

Signal emitted when the proxyChild() has changed


The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close