Aimsun Next Scripting  22
Public Types | Public Member Functions | List of all members
GKSelection Class Reference
Inheritance diagram for GKSelection:
GKGeoSelection

Public Types

enum  MatchMode { eExactlyThisClass , eThisAndSubclasses }
 

Public Member Functions

 GKSelection ()
 
virtual ~GKSelection ()
 
GKModelgetModel () 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
 
GKObjectgetAny (GKType *, MatchMode mm) const
 
bool atLeast (uint, GKType *, MatchMode mm) const
 
bool canBeDeleted () const
 
bool canBeModified () const
 
const QList< GKObject * > & getObjects () const
 
GKTypegetSelectionType () const
 
bool isSelected (GKObject *) const
 

Detailed Description

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).

Member Enumeration Documentation

◆ MatchMode

Enumerator
eExactlyThisClass 
eThisAndSubclasses 

Constructor & Destructor Documentation

◆ GKSelection()

GKSelection::GKSelection ( )

◆ ~GKSelection()

virtual GKSelection::~GKSelection ( )
virtual

Member Function Documentation

◆ anySelected()

bool GKSelection::anySelected ( GKType ,
MatchMode  mm 
) const

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.

◆ atLeast()

bool GKSelection::atLeast ( uint  ,
GKType ,
MatchMode  mm 
) const

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.

◆ canBeDeleted()

bool GKSelection::canBeDeleted ( ) const

Selection can be deleted?

◆ canBeModified()

bool GKSelection::canBeModified ( ) const

Selection can be modified?

◆ clear()

virtual void GKSelection::clear ( )
virtual

Clears the selection internally, without throwing out the selectionChanged() signal.

Reimplemented in GKGeoSelection.

◆ deselect()

void GKSelection::deselect ( GKObject )

Deselects a single object (remove it from the selection list) and emits a selectionChanged signal

◆ deselectAll()

virtual void GKSelection::deselectAll ( )
virtual

Deselect all the selected objects.

◆ deselectMultiple()

virtual void GKSelection::deselectMultiple ( GKObject )
virtual

As deselect but without emiting the signal.

Reimplemented in GKGeoSelection.

◆ endSelectMultiple()

virtual void GKSelection::endSelectMultiple ( )
virtual

Emits the singnal since all the objects that will be selected have been selected now.

◆ getAny()

GKObject * GKSelection::getAny ( GKType ,
MatchMode  mm 
) const

Get any selected object of type "byType" (or a subclass of "byType" if mm is eThisAndSubclasses)

◆ getModel()

GKModel * GKSelection::getModel ( ) const

The model in where this selection is

◆ getObjects()

const QList< GKObject * > & GKSelection::getObjects ( ) const

Iter over the selection.

◆ getSelectionType()

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.

◆ isSelected()

bool GKSelection::isSelected ( GKObject ) const

Is object selected in this selection?

◆ remove()

void GKSelection::remove ( )

Remove (delete) all the selected objects.

◆ select()

void GKSelection::select ( GKObject )

Selects a single object (add it to the selection list) and emits a selectionChanged signal

◆ selectMultiple()

virtual void GKSelection::selectMultiple ( GKObject )
virtual

As select but without emiting the signal.

Reimplemented in GKGeoSelection.

◆ size() [1/2]

uint GKSelection::size ( ) const

Number of selected objects.

◆ size() [2/2]

uint GKSelection::size ( GKType ,
MatchMode   
) const

Number of selected objects of type "byType" (or a subclass of "byType" if mm is eThisAndSubclasses)

© Aimsun SLU
Aimsun ®