ImFusion SDK 4.3
AnnotationModel Class Reference

#include <ImFusion/GUI/AnnotationModel.h>

Container class for annotations Each annotation is always related to exactly one dataset. More...

+ Inheritance diagram for AnnotationModel:

Detailed Description

Container class for annotations Each annotation is always related to exactly one dataset.

The model provides several methods to create annotations and move them between datasets.

Public Slots

QModelIndex add (QString annotType, Data *dataset, const Properties *p=0, int frameIndex=-1)
 Creates an annotation with the given type and attaches it to dataset.
 
QModelIndex add (InteractiveObject *annotation, Data *dataset, int frameIndex=-1)
 Adds annotation to the model and attaches it to dataset.
 
QModelIndex move (InteractiveObject *annotation, Data *dataset)
 Moves the annotation from anywhere in the model to dataset The method will remove annotation from its previous attachment, add it to dataset and return the index to the new location.
 
void moveToFrame (InteractiveObject *annotation, int frameIndex, Data *parentDataset=nullptr)
 Moves the annotation to a specific frame. The parent data is inferred if not given.
 
void showOnAllFrames (InteractiveObject *annotation)
 Shows the annotation on all frames.
 
void remove (InteractiveObject *annotation, bool deleteData=true)
 Removes and deletes annotation.
 
void removeAll (Data *dataset)
 Removes and deletes all annotations that are attached to dataset (see also remove)
 
void clear ()
 Removes and deletes all annotations (see also remove)
 
void updateAnnotationVisibility ()
 Updates the visibility of each annotation depending on the visible datasets Annotations are added to views that show the parent dataset and remove from views that don't show the parent dataset.
 

Signals

void annotationAboutToBeRemoved (InteractiveObject *annotation)
 Emitted just before annotation will be deleted.
 
void annotationAdded (InteractiveObject *annotation)
 Emitted after an annotation has been added.
 
void annotationMoved (InteractiveObject *annotation)
 Emitted after an annotation has been moved (from a parent dataset to another)
 
void annotationsVisibilityUpdated ()
 Per-frame annotations visibility updated.
 

Public Member Functions

 AnnotationModel (MainWindowBase *mw)
 Creates an empty model.
 
 ~AnnotationModel () override
 Deletes all annotations and removes them from any views.
 
InteractiveObjectconvertToAnnotation (const QModelIndex &index) const
 Returns the annotation with the given index or nullptr if the index is not an InteractiveObject.
 
DataconvertToData (const QModelIndex &index) const
 Returns the dataset with the given index. Returns nullptr if the index is not a dataset or if it is the global item.
 
QVector< InteractiveObject * > getAll () const
 Returns a list of all annotations.
 
QVector< InteractiveObject * > getAnnotations (const Data *dataset, bool onlyDirectAnnotations=true) const
 Returns a list of all annotations that are attached to the given dataset.
 
InteractiveObjectgetAnnotation (const Data *dataset, const std::string &name) const
 Return the annotation with the specified name (with the provided dataset as direct parent or global), and zero pointer if it does not exist.
 
InteractiveObjectgetDataAnnotation (const Data *data) const
 Returns the annotation (GlMesh, GlPointCloud, GlTree) which has the underlying data (Mesh, PointCloud, Tree) specified in the input.
 
DatagetParentDataset (InteractiveObject *annotation) const
 Returns the dataset the given annotation is attached to or 0 if it is attached globally.
 
int getAttachedFrame (const InteractiveObject *interactiveObject) const
 Returns the frame the given annotation is attached to or -1 if it is not applicable for the data or not set.
 
void linkPoseWithParent (InteractiveObject *interactiveObject)
 Links the annotation points with the pose of its parent dataset.
 
void unlinkPoseWithParent (InteractiveObject *interactiveObject)
 Unlinks the annotation points with the pose of its parent dataset (if it is linked)
 
bool isPoseLinkedWithParent (const InteractiveObject *annotation) const
 Returns whether the annotation points are linked with the pose of its parent dataset.
 
ManipulatorcreateDefaultManipulator (GlObject *object) const
 Creates a default manipulator for object This method creates manipulators for any kind of GlPointBasedAnnotation (PointBasedAnnotationManipulator), GlSmartSpline (SmartSplineManipulator) and GlMesh (MeshManipulator).
 
QStringList types () const
 Returns a list of all supported types.
 
QString name (QString annotType) const
 Returns the default basename for the given type.
 
QIcon icon (QString annotType) const
 Returns the default icon for the given type.
 
int columnCount (const QModelIndex &parent=QModelIndex()) const override
 Returns 1.
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 Returns the number of children for parent.
 
Qt::ItemFlags flags (const QModelIndex &index) const override
 All items are selectable and enabled, annotation are also editable and checkable.
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
 Returns data for the given index DisplayRole and EditRole: name of the annotation.
 
bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
 Sets a value to the data at index EditRole: sets the name of the annotation CheckStateRole: enables/disables an annotation.
 
QModelIndex index (Data *dataset) const
 Creates an index to the specified dataset.
 
QModelIndex index (InteractiveObject *annotation) const
 Creates an index to the specified annotation.
 
QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const override
 Creates an index to the specified item.
 
QModelIndex parent (const QModelIndex &index) const override
 Returns the parent of index.
 
void configuration (Properties *p) const override
 Serialize the current object configuration into the given Properties object.
 
void configure (const Properties *p) override
 Configure this object instance by de-serializing the given Properties.
 
void onTransformationChanged (const Data *data)
 
void setMoveWithData (bool flag)
 Specify whether annotations should be moved with the parent data transformation.
 
bool moveWithData () const
 Return whether annotations are moved together with the parent data.
 
void setShowPointsAsCrosses (bool flag)
 Show points as crosses in point-based annotations.
 
void onDataDeleted (const Data *data)
 
std::unique_ptr< InteractiveObjectrelease (InteractiveObject *annotation, bool deleteData=true)
 Releases and deletes annotation.
 
- Public Member Functions inherited from Configurable
virtual void configureDefaults ()
 Retrieve the properties of this object, replaces values with their defaults and sets it again.
 
void registerParameter (ParameterBase *param)
 Register the given Parameter or SubProperty, so that it will be configured during configure()/configuration().
 
void unregisterParameter (const ParameterBase *param)
 Remove the given Parameter or SubProperty from the list of registered parameters.
 
 Configurable (const Configurable &rhs)
 
 Configurable (Configurable &&rhs) noexcept
 
Configurableoperator= (const Configurable &)
 
Configurableoperator= (Configurable &&) noexcept
 
- Public Member Functions inherited from SignalReceiver
 SignalReceiver ()=default
 Default constructor.
 
 SignalReceiver (const SignalReceiver &other)
 Copy constructor, does not copy any existing signal connections from other.
 
SignalReceiveroperator= (SignalReceiver rhs)
 Assignment operator, disconnects all existing connections, does not copy any existing signal connections from rhs.
 
virtual ~SignalReceiver ()
 Virtual destructor disconnects from all connected signals.
 

Static Public Member Functions

static DatagetAnnotationData (InteractiveObject *annotation)
 Returns the data corresponding to the annotation. If the annotation is not a data type returns null.
 

Additional Inherited Members

- Public Attributes inherited from Configurable
Signal signalParametersChanged
 Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted.
 
- Protected Member Functions inherited from SignalReceiver
void disconnectAll ()
 Disconnects all existing connections.
 
- Protected Attributes inherited from Configurable
std::vector< Paramm_params
 List of all registered Parameter and SubProperty instances.
 

Member Function Documentation

◆ getAnnotations()

QVector< InteractiveObject * > getAnnotations ( const Data * dataset,
bool onlyDirectAnnotations = true ) const

Returns a list of all annotations that are attached to the given dataset.

If onlyDirectAnnotations is true, only annotations that are directly attached to dataset are returned. Otherwise, also annotations that belong to any parent group get included in the result.

◆ linkPoseWithParent()

void linkPoseWithParent ( InteractiveObject * interactiveObject)

Links the annotation points with the pose of its parent dataset.

Only works with a GlPointBasedAnnotation that has a parent. Does nothing otherwise.

◆ createDefaultManipulator()

Manipulator * createDefaultManipulator ( GlObject * object) const

Creates a default manipulator for object This method creates manipulators for any kind of GlPointBasedAnnotation (PointBasedAnnotationManipulator), GlSmartSpline (SmartSplineManipulator) and GlMesh (MeshManipulator).

In the case of PointBasedAnnotationManipulator and SmartSplineManipulator the interaction mode is set to None and interactions are allowed.

◆ configuration()

void configuration ( Properties * p) const
overridevirtual

Serialize the current object configuration into the given Properties object.

The default implementation will do so automatically for all registered Parameter and SubProperty instances.

See also
configure() for the inverse functionality

Reimplemented from Configurable.

◆ configure()

void configure ( const Properties * p)
overridevirtual

Configure this object instance by de-serializing the given Properties.

The default implementation will do so automatically for all registered Parameter and SubProperty instances.

See also
configuration() for the inverse functionality

Reimplemented from Configurable.

◆ release()

std::unique_ptr< InteractiveObject > release ( InteractiveObject * annotation,
bool deleteData = true )

Releases and deletes annotation.

The caller takes ownership of the released annotation. In the case of CurvedViewPrimitive, the CurvedView will be deleted, too. Also manipulators that are GlObjects and have been added to any views are removed from the display before deletion. If deleteData is true the data associated with this annotation is deleted, too.

◆ add [1/2]

QModelIndex add ( QString annotType,
Data * dataset,
const Properties * p = 0,
int frameIndex = -1 )
slot

Creates an annotation with the given type and attaches it to dataset.

The returned index will refer to the created annotation or is invalid in the case the annotation could not be created. In the case of CurvedViewPrimitive a corresponding view will be created and added to the display. When the properties are set they are used to configure the annotation.

◆ add [2/2]

QModelIndex add ( InteractiveObject * annotation,
Data * dataset,
int frameIndex = -1 )
slot

Adds annotation to the model and attaches it to dataset.

The model will take ownership of annotation. The returned index will refer to the created annotation or is invalid in the case the annotation could not be added. Each annotation can only occur once in the model. If dataset is 0, the annotation will be attached globally (i.e. will be visible in all datasets). For the attachment to dataset, see move. If annotation has no name, a name will be generated depending on the type. Otherwise the name might be changed if there is already an annotation with the same name (usually a number will be appended to the name). In the case of a GlMesh annotation, computeBoundingBox(), computeNormals() and uniteIndices() will be called if necessary in order to assure that GlMesh can display the mesh correctly.

◆ move

QModelIndex move ( InteractiveObject * annotation,
Data * dataset )
slot

Moves the annotation from anywhere in the model to dataset The method will remove annotation from its previous attachment, add it to dataset and return the index to the new location.

The annotation is also removed from all views showing the old attachment and added to the views for the new attachment. It will also remove/add any manipulators (such as the MeshManipulator) that are GlObjects from/to the views. For CurvedViewPrimitive annotations, the CurvedView will be updated with the new dataset.

◆ remove

void remove ( InteractiveObject * annotation,
bool deleteData = true )
slot

Removes and deletes annotation.

In the case of CurvedViewPrimitive, the CurvedView will be deleted, too. Also manipulators that are GlObjects and have been added to any views are removed from the display before deletion. If deleteData is true the data associated with this annotation is deleted, too.

◆ updateAnnotationVisibility

void updateAnnotationVisibility ( )
slot

Updates the visibility of each annotation depending on the visible datasets Annotations are added to views that show the parent dataset and remove from views that don't show the parent dataset.

Global annotations are added to all views.


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