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.
 
void objectClassSelected (const std::string &objectClass, const std::string &collection)
 A signal which gets triggered, after a class gets selected.
 
void objectsChanged (controller::vector_string objectIds)
 A signal which gets triggered, if objects are moved or rotated.
 
void operationExecuted (controller::vector_string objectIds)
 A signal which gets triggered, after a vector of operations is executed.
 
void reloadScene ()
 A signal which gets triggered, after the scene is reloaded.
 
void sceneObjectSelected (scene3D::SceneObjectPtr object)
 A signal which gets triggered, after a object gets selected.
 

Public Member Functions

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

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.
 

Static Public Attributes

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

Detailed Description

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

See also
memoryxcontroller::MemoryXController
scene3D::scene

Constructor & Destructor Documentation

◆ ~Controller()

~Controller ( )
override

A destructor.

Deletes all initialized references.

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.

◆ 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

◆ 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

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

◆ getMemoryXController()

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

Returns the MemoryXController.

Returns
the MemoryXController

◆ getScene()

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

Returns the Scene.

Returns
the Scene

◆ getShortcutController()

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

Returns the ShortcutController.

Returns
the ShortcutController

◆ 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

◆ reloadLocalScene()

void reloadLocalScene ( )

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

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

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

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

◆ triggerObjectsChanged()

void triggerObjectsChanged ( controller::vector_string objectIds)

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

Parameters
objectIdsThe IDs of the changed objects.

◆ triggerSceneObjectSelected()

void triggerSceneObjectSelected ( scene3D::SceneObjectPtr object)

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

Parameters
objectThe object which was selected.

◆ undo()

void undo ( )

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

See also
controller::UndoRedoStack::undo

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

◆ 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()

◆ UNDOABLE

const int UNDOABLE = 1 << 2
static

A flag to save the executed operations to the history.

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

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