Controller Class Reference

A class to execute Operations, maintain the execution history and initialize Scene and MemoryXController. More...

#include <MemoryX/gui-plugins/SceneEditor/controller/Controller.h>

+ Inheritance diagram for Controller:

Signals

void minimapClicked ()
 A signal which gets triggered, after a click was performed on the minimap. More...
 
void objectClassSelected (const std::string &objectClass, const std::string &collection)
 A signal which gets triggered, after a class gets selected. More...
 
void objectsChanged (controller::vector_string objectIds)
 A signal which gets triggered, if objects are moved or rotated. More...
 
void operationExecuted (controller::vector_string objectIds)
 A signal which gets triggered, after a vector of operations is executed. More...
 
void reloadScene ()
 A signal which gets triggered, after the scene is reloaded. More...
 
void sceneObjectSelected (scene3D::SceneObjectPtr object)
 A signal which gets triggered, after a object gets selected. More...
 

Public Member Functions

void clearScene ()
 Deletes all objects in local scene and in WorkingMemory and deletes all groups. More...
 
void execute (int flags, const OperationPtrListPtr &operations, bool blocking=true)
 Executes multiple operations. More...
 
void executeQueuedOperations (bool blocking=true)
 Executes the Operations, which are queued because the object, which would be affected by this was busy. More...
 
const std::shared_ptr< memoryxcontroller::MemoryXControllergetMemoryXController () const
 Returns the MemoryXController. More...
 
const std::shared_ptr< scene3D::ScenegetScene () const
 Returns the Scene. More...
 
const std::shared_ptr< gui::ShortcutControllergetShortcutController () const
 Returns the ShortcutController. More...
 
void redo ()
 Goes one step forward in the history and redoes the corresponding Operations. More...
 
void reloadLocalScene ()
 Deletes all objects in the local Scene and loads the current objects from the WorkingMemory in the Scene. More...
 
void saveSnapshotAsJSON (std::string const &snapshotName)
 
void triggerMinimapClicked ()
 Triggers signal controller:Controller::minimapClicked. More...
 
void triggerObjectClassSelected (const std::string &objectClass, const std::string &collection)
 Triggers signal controller:Controller::objectClassSelected with given parameter. More...
 
void triggerObjectsChanged (controller::vector_string objectIds)
 Triggers signal controller:Controller::objectsChanged with given parameter. More...
 
void triggerSceneObjectSelected (scene3D::SceneObjectPtr object)
 Triggers signal controller:Controller::sceneObjectSelected with given parameter. More...
 
void undo ()
 Goes one step back in the history and undoes the corresponding Operations. More...
 
 ~Controller () override
 A destructor. More...
 

Static Public Member Functions

static ControllerPtr create ()
 Creates a new instance of the Controller, initializes the Scene and the MemoryXController and returns the new Controller. More...
 

Static Public Attributes

static const int EXECUTE_ON_SCENE = 1 << 1
 A flag to execute operations on the Scene. More...
 
static const int EXECUTE_ON_WM = 1 << 0
 A Flag to execute operations on the WorkingMemory. More...
 
static const int UNDOABLE = 1 << 2
 A flag to save the executed operations to the history. More...
 

Detailed Description

A class to execute Operations, maintain the execution history and initialize Scene and MemoryXController.

See also
memoryxcontroller::MemoryXController
scene3D::scene

Definition at line 55 of file Controller.h.

Constructor & Destructor Documentation

◆ ~Controller()

~Controller ( )
override

A destructor.

Deletes all initialized references.

Definition at line 66 of file Controller.cpp.

Member Function Documentation

◆ clearScene()

void clearScene ( )

Deletes all objects in local scene and in WorkingMemory and deletes all groups.

The operations are performed using undoable operations.

Definition at line 315 of file Controller.cpp.

◆ create()

controller::ControllerPtr create ( )
static

Creates a new instance of the Controller, initializes the Scene and the MemoryXController and returns the new Controller.

Returns
the newly created Controller
See also
scene3D::Scene
memoryxcontroller::MemoryXController

Definition at line 54 of file Controller.cpp.

+ Here is the call graph for this function:

◆ execute()

void execute ( int  flags,
const OperationPtrListPtr operations,
bool  blocking = true 
)

Executes multiple operations.

The Operations will be run depending on the flags: flags & EXECUTE_ON_WM == 1 => The Operations will be run at the WorkingMemory. flags & EXECUTE_ON_SCENE == 1 => The Operations will be run at the Scene. flags & UNDOABLE == 1 => The Operations will be saved to the history.

Parameters
flagsThe flags for the execution.
operationsThe operations to execute.
blockingIf true, wait for ending of execution.
See also
controller::Controller::EXECUTE_ON_WM
controller::Controller::EXECUTE_ON_SCENE
controller::Controller::UNDOABLE
scene3D::Scene
memoryxcontroller::WorkingMemoryController

Definition at line 70 of file Controller.cpp.

◆ executeQueuedOperations()

void executeQueuedOperations ( bool  blocking = true)

Executes the Operations, which are queued because the object, which would be affected by this was busy.

Parameters
blockingIf true, wait for ending of execution.

Definition at line 230 of file Controller.cpp.

◆ getMemoryXController()

const std::shared_ptr< memoryxcontroller::MemoryXController > getMemoryXController ( ) const

Returns the MemoryXController.

Returns
the MemoryXController

Definition at line 274 of file Controller.cpp.

◆ getScene()

const std::shared_ptr< scene3D::Scene > getScene ( ) const

Returns the Scene.

Returns
the Scene

Definition at line 269 of file Controller.cpp.

◆ getShortcutController()

const std::shared_ptr< gui::ShortcutController > getShortcutController ( ) const

Returns the ShortcutController.

Returns
the ShortcutController

Definition at line 279 of file Controller.cpp.

◆ minimapClicked

void minimapClicked ( )
signal

A signal which gets triggered, after a click was performed on the minimap.

◆ objectClassSelected

void objectClassSelected ( const std::string &  objectClass,
const std::string &  collection 
)
signal

A signal which gets triggered, after a class gets selected.

Parameters
objectClassThe class of the selected class.
collectionThe collection of the selected class.

◆ objectsChanged

void objectsChanged ( controller::vector_string  objectIds)
signal

A signal which gets triggered, if objects are moved or rotated.

Parameters
objectIdsThe IDs of the changed objects.

◆ operationExecuted

void operationExecuted ( controller::vector_string  objectIds)
signal

A signal which gets triggered, after a vector of operations is executed.

Parameters
objectIdsThe IDs of the objects affected by the executed operations.

◆ redo()

void redo ( )

Goes one step forward in the history and redoes the corresponding Operations.

See also
controller::UndoRedoStack::redo

Definition at line 289 of file Controller.cpp.

◆ reloadLocalScene()

void reloadLocalScene ( )

Deletes all objects in the local Scene and loads the current objects from the WorkingMemory in the Scene.

Definition at line 246 of file Controller.cpp.

◆ reloadScene

void reloadScene ( )
signal

A signal which gets triggered, after the scene is reloaded.

See also
controller::Controller::reloadLocalScene

◆ saveSnapshotAsJSON()

void saveSnapshotAsJSON ( std::string const &  snapshotName)

Definition at line 352 of file Controller.cpp.

◆ sceneObjectSelected

void sceneObjectSelected ( scene3D::SceneObjectPtr  object)
signal

A signal which gets triggered, after a object gets selected.

Parameters
objectThe object which was selected.

◆ triggerMinimapClicked()

void triggerMinimapClicked ( )

Triggers signal controller:Controller::minimapClicked.

Definition at line 305 of file Controller.cpp.

◆ triggerObjectClassSelected()

void triggerObjectClassSelected ( const std::string &  objectClass,
const std::string &  collection 
)

Triggers signal controller:Controller::objectClassSelected with given parameter.

Parameters
objectClassThe class of the selected class.
collectionThe collection of the selected class.

Definition at line 295 of file Controller.cpp.

◆ triggerObjectsChanged()

void triggerObjectsChanged ( controller::vector_string  objectIds)

Triggers signal controller:Controller::objectsChanged with given parameter.

Parameters
objectIdsThe IDs of the changed objects.

Definition at line 310 of file Controller.cpp.

◆ triggerSceneObjectSelected()

void triggerSceneObjectSelected ( scene3D::SceneObjectPtr  object)

Triggers signal controller:Controller::sceneObjectSelected with given parameter.

Parameters
objectThe object which was selected.

Definition at line 300 of file Controller.cpp.

◆ undo()

void undo ( )

Goes one step back in the history and undoes the corresponding Operations.

See also
controller::UndoRedoStack::undo

Definition at line 284 of file Controller.cpp.

Member Data Documentation

◆ EXECUTE_ON_SCENE

const int EXECUTE_ON_SCENE = 1 << 1
static

A flag to execute operations on the Scene.

See also
scene3D::Scene
controller::Controller::execute()

Definition at line 73 of file Controller.h.

◆ EXECUTE_ON_WM

const int EXECUTE_ON_WM = 1 << 0
static

A Flag to execute operations on the WorkingMemory.

See also
memoryxcontroller::WorkingMemoryController
controller::Controller::execute()

Definition at line 66 of file Controller.h.

◆ UNDOABLE

const int UNDOABLE = 1 << 2
static

A flag to save the executed operations to the history.

See also
controller::UndoRedoStack
controller::Controller::execute()

Definition at line 80 of file Controller.h.


The documentation for this class was generated from the following files: