Aimsun Next Scripting
22
|
Public Types | |
enum | MatchMode { eExactlyThisClass , eThisAndSubclasses } |
Public Member Functions | |
GKSelection () | |
virtual | ~GKSelection () |
GKModel * | getModel () const |
virtual void | clear () |
void | select (GKObject *) |
virtual void | selectMultiple (GKObject *) |
virtual void | endSelectMultiple () |
void | deselect (GKObject *) |
virtual void | deselectMultiple (GKObject *) |
virtual void | deselectAll () |
void | remove () |
uint | size () const |
uint | size (GKType *, MatchMode) const |
bool | anySelected (GKType *, MatchMode mm) const |
GKObject * | getAny (GKType *, MatchMode mm) const |
bool | atLeast (uint, GKType *, MatchMode mm) const |
bool | canBeDeleted () const |
bool | canBeModified () const |
const QList< GKObject * > & | getObjects () const |
GKType * | getSelectionType () const |
bool | isSelected (GKObject *) const |
This class reepresents a generic collection of selected objects from the model. Objects are selected or unselected through select and deselect calls or using the selectMultiple/endSelectMultiple and deselectMultiple/endSelectMultiple.
The firts calls are used to select (or deselect) a single object. The second set of calls are used when more than one object will be seleced (or unselected). The difference is when they emit the selectionChanged signal.
Selection can also be removed, that is, all the selected objects are destroyed. Destroyed means objects removed from the model and the model and inserted in a delete command. This operation, then, can be undoed. After undoed all the objects are unselected.
Selection in this class is handled internally, so the objects are not selected at model level. GKGeoSelection, which is derived from this class, takes care of if at geoModel level (and thus it handles 'selected' flag in GKGeoObjects).
GKSelection::GKSelection | ( | ) |
|
virtual |
Returns true if the type of any of the selected objects is "byType" (or a subclass of "byType" if mm is eThisAndSubclasses) Equivalent to call GKSelection::atLeast with a minimum of 1.
Returns true if at least "minimum" number of object of type "byType" are selected (or a subclass of "byType" if mm is eThisAndSubclasses).
This method is faster than GKSelection::size as it stops when the minimum is reached.
bool GKSelection::canBeDeleted | ( | ) | const |
Selection can be deleted?
bool GKSelection::canBeModified | ( | ) | const |
Selection can be modified?
|
virtual |
Clears the selection internally, without throwing out the selectionChanged() signal.
Reimplemented in GKGeoSelection.
void GKSelection::deselect | ( | GKObject * | ) |
Deselects a single object (remove it from the selection list) and emits a selectionChanged signal
|
virtual |
Deselect all the selected objects.
|
virtual |
As deselect but without emiting the signal.
Reimplemented in GKGeoSelection.
|
virtual |
Emits the singnal since all the objects that will be selected have been selected now.
Get any selected object of type "byType" (or a subclass of "byType" if mm is eThisAndSubclasses)
GKModel * GKSelection::getModel | ( | ) | const |
The model in where this selection is
const QList< GKObject * > & GKSelection::getObjects | ( | ) | const |
Iter over the selection.
GKType * GKSelection::getSelectionType | ( | ) | const |
Returns the type of the selection. That is the common type of all the selected objects going down in the hierarchy. If the selection is empty or there is not a common base class it returns None.
If dontConsiderNodesIfSelectedTurnings is true then it will not consider nodes as part of the selection if the selection includes turns. When a turn is selected, its node is always selected to the common selection will be a GKGeoObject and never a GKTurning. This option solves the problem but note that nodes can be part of the selection.
bool GKSelection::isSelected | ( | GKObject * | ) | const |
Is object selected in this selection?
void GKSelection::remove | ( | ) |
Remove (delete) all the selected objects.
void GKSelection::select | ( | GKObject * | ) |
Selects a single object (add it to the selection list) and emits a selectionChanged signal
|
virtual |
As select but without emiting the signal.
Reimplemented in GKGeoSelection.
uint GKSelection::size | ( | ) | const |
Number of selected objects.