MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
CSOGroupRules.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2007, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13
15
16#pragma once
17
18#include "MLCSOIncludes.h"
19
20
22
23class CSO;
24class CSOGroup;
25
27
38
47
53};
55
58{
59
60public:
62 CSOGroupRules(unsigned int numMaxCSOs = 0);
65
67 void reset();
68
70 void setNumMaximumCSOs(unsigned int numMaxCSOs)
71 {
72 _numMaxCSOs = numMaxCSOs;
73 }
75 unsigned int getNumMaximumCSOs() const
76 {
77 return _numMaxCSOs;
78 }
81 {
82 _overflowHandling = handling;
83 }
86 {
87 return _overflowHandling;
88 }
92 {
93 _removeFromGroupHandling = handling;
94 }
97 {
98 return _removeFromGroupHandling;
99 }
102 {
103 _deleteGroupCSOHandling = handling;
104 }
107 {
108 return _deleteGroupCSOHandling;
109 }
112
119 bool addCSO(CSO& cso, CSOGroup& csoGroup, bool useUndoRedo = true);
121 void removeCSO(CSO& cso, CSOGroup& csoGroup, bool useUndoRedo = true);
126
128 static unsigned int getDefaultNumMaximumCSOs()
129 {
130 return 0;
131 }
147
148protected:
151
156
157private:
160 unsigned int _numMaxCSOs;
161
163 CSOGroupOverflowHandling _overflowHandling;
164
166 CSORemoveHandling _removeFromGroupHandling;
167
169 CSORemoveHandling _deleteGroupCSOHandling;
170};
171
173
MERGE_MODE_NONE
MERGE_MODE_BY_ID
#define MLCSO_EXPORT
Defines export symbols for classes, so they can be used in other DLLs.
Definition MLCSOSystem.h:23
This handles rules like the maximum number of CSOs in a CSOGroup and applies them.
static CSOGroupOverflowHandling getDefaultOverflowHandling()
Returns the default overflow handling for a CSOGroup.
CSOGroupRules(unsigned int numMaxCSOs=0)
Constructor.
void applyRemoveFromGroupRule(CSO &cso, bool useUndoRedo)
Applies the remove-from-group rule to the cso (is is executed any time a CSO is removed from the CSOG...
static CSORemoveHandling getDefaultDeleteGroupCSOHandling()
Returns the default handling for removal from CSOGroups.
CSORemoveHandling getDeleteGroupCSOHandling() const
Returns the _deleteGroupCSOHandling mode.
void applyDeletionRule(CSOGroup &csoGroup)
Applies the delete-group rules to the csoGroup.
unsigned int getNumMaximumCSOs() const
Returns the maximum number of CSOs.
void applyTo(CSOGroup &csoGroup)
Applies the rules to the csoGroup.
CSO * addNewCSO(CSOGroup &csoGroup, bool useUndoRedo=true)
Adds a new CSO to the csoGroup according to the rules.
CSORemoveHandling getRemoveFromGroupHandling() const
Returns the _removeFromGroupHandling mode.
static CSORemoveHandling getDefaultRemoveFromGroupHandling()
Returns the default handling for removal from CSOGroups.
void reset()
Sets default values to all members.
void setNumMaximumCSOs(unsigned int numMaxCSOs)
Sets the maximum number of CSOs allowed in the CSOGroup where the rules are applied to.
void setDeleteGroupCSOHandling(CSORemoveHandling handling)
Sets the handling mode for CSOs when this CSOGroup is deleted, i.e., should they also be removed from...
void _combineCSOAndGroup(CSO &cso, CSOGroup &csoGroup)
Establishes a bidirectional link between the specified CSO and the specified CSOGroup.
void removeCSO(CSO &cso, CSOGroup &csoGroup, bool useUndoRedo=true)
Removes a CSO from the csoGroup according to the rules.
bool mayAddCSO(CSOGroup &csoGroup) const
Checks whether one could add a CSO to the specified CSOGroup.
void _breakCSOandGroup(CSO &cso, CSOGroup &csoGroup)
Removes the bidirectional link between the specified CSO and the specified CSOGroup.
void _removeAllCSO(CSOGroup &csoGroup, bool useUndoRedo=true)
Removes all CSOs from the csoGroup according to the rules.
CSOGroupOverflowHandling getOverflowHandling() const
Returns the _overflowHandling mode.
bool addCSO(CSO &cso, CSOGroup &csoGroup, bool useUndoRedo=true)
Adds the specified cso to the specified csoGroup if the rules allow that.
static unsigned int getDefaultNumMaximumCSOs()
Returns the default value for the maximum amount of CSOs in a CSOGroup.
~CSOGroupRules()
Destructor.
void setOverflowHandling(CSOGroupOverflowHandling handling)
Sets the overflow handling, i.e., what has to be done when one wants to add CSO and _numMaxCSOs is re...
void setRemoveFromGroupHandling(CSORemoveHandling handling)
Sets the handling mode for CSOs that are removed from the CSOGroup, i.e., should they also be removed...
A CSOGroup comprises a number of CSOs, which themselves can be in a number of different CSOGroups.
Definition CSOGroup.h:38
The CSO represents a contour segmentation object.
Definition CSO.h:44
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
CSORemoveHandling
Enumeration for the removal handling of CSOs from CSOGroup and whether CSOGroup is deleted.
@ REMOVE_NEVER
If a CSO is removed from a CSOGroup, it is not deleted from the list.
@ REMOVE_ALWAYS
If a CSO is removed from a CSOGroup, it is also deleted from the list.
@ REMOVE_IF_IN_NO_GROUP
If a CSO is removed from a CSOGroup, it is only deleted from the list if it is in no CSOGroup anymore...
@ NUM_REMOVE_MODES
Number of modes.
CSOGroupOverflowHandling
Enumeration for the CSOGroup overflow handling modes.
@ OVERFLOW_DELETE_LAST
If a CSOGroup is full, the last CSO in the CSOGroup is replaced by the newly generated CSO.
@ OVERFLOW_DELETE_ALL
If a CSOGroup is full, all CSOs in the CSOGroup are deleted.
@ NUM_OVERFLOW_MODES
Number of modes.
@ OVERFLOW_IGNORE_NEW
If a CSOGroup is full, one cannot generate a new CSO.
@ OVERFLOW_DELETE_FIRST
If a CSOGroup is full, the first CSO in the CSOGroup is replaced by the newly generated CSO.