![]() |
ImFusion SDK 4.3
|
#include <ImFusion/Base/DataGroup.h>
Data element that groups multiple Data instances together in a hierarchical fashion. More...
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.
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()). | |
![]() | |
Data (const std::string &name="") | |
Data (const Data &other) | |
Data & | operator= (const Data &other) |
virtual | ~Data () |
Mandatory virtual destructor. | |
virtual Modality | modality () const |
Return the modality of this data. | |
const std::string & | name () 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 DataComponentList & | components () const |
Returns the list of DataComponents for this data. | |
DataComponentList & | components () |
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 | |
Data * | m_proxyChild = nullptr |
Optional pointer to child that should act as representative element for this group. | |
![]() | |
mat4 | m_matrix |
Transformation matrix. | |
std::recursive_mutex * | m_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< Data > | remove (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. | |
Data * | proxyChild () 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 | |
![]() | |
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 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. | |
![]() | |
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::string > | signalNameChanged |
Signal emitted when the name changed. | |
![]() | |
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() | |
![]() | |
void | swapWith (Data &other) |
Swaps the data and emits a matrix and name changed signal for both. | |
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.
|
overridevirtual |
Returns the list of direct children of this group.
Implements CompoundData.
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.
|
overridevirtual |
Returns the axis-aligned bounding box of this data in world space.
Implements Data.
|
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.
|
overridevirtual |
Set the transformation matrix and updates all child matrices with the relative matrix between the old and new one.
Reimplemented from Data.
Signal signalProxyChildChanged |
< Signal emitted when a Data instance has changed its position in children()
Signal emitted when the proxyChild() has changed