Workspace 6.21.5
Public Types | Public Slots | Signals | Public Member Functions | Protected Member Functions | List of all members
WorkspaceScene Class Reference

#include <Workspace/Presentation/workspacescene.h>

Inherits QGraphicsScene.

Public Types

enum  WorkspaceItemTypes {
  OperationViewBoxT = QGraphicsItem::UserType + 1 , ConnectionViewT , ConnectionAnchorT , NoteItemT ,
  InputScalarPortT , InputArrayPortT , OutputPortT , ConnectionPortT ,
  InputRackT , OutputRackT , MiniOperationRackT , MiniOperationRackLabelT ,
  MiniOperationViewT , TargetRectT
}
 
enum  ZOrdering {
  ZMiniOperationRackDefault = 5 , ZConnectionDefault = 15 , ZOperationDefault = 20 , ZNote = 25 ,
  ZMiniOperationInExpandedRack = 30 , ZMiniOperationRackHover = 35 , ZMiniOperationInRackHover = 40 , ZConnectionHover = 45 ,
  ZConnectionAnchor = 50 , ZOperationSecondaryHover = 55 , ZOperationHover = 60 , ZOperationInRackHover = 66 ,
  ZMiniOperationRackMoving = 70 , ZMiniOperationInRackMoving = 75 , ZConnectionRack = 80
}
 

Public Slots

void createAnchor (const QPointF &pScene)
 
void createNote (const QPointF &pScene)
 
void nestedWorkspaceFromSelection ()
 
void replaceOperationRMB (DataExecution::Operation &findOp)
 
void resetSelectedOperations ()
 
void setConnectionArrowLocation (int loc)
 
void setContextMenuActive (bool b)
 
void setGridSpacing (int spacing)
 
void setProgressBarsCanUpdate (bool b)
 
void setProgressBarsVisible (bool b)
 
void setUsingGrid (bool b)
 
void updateDependencyVisibility ()
 
void updateMiniOperationVisibility ()
 

Signals

void aboutToDropNewItem (const QPointF &p)
 
void centerOnItemRequested (const QGraphicsItem *item)
 
void clearDragStateRequested ()
 
void connectionArrowLocationChanged (int loc)
 
void dependencyVisibilityChange ()
 
void displayNestedWorkspaceContentsRequested (DataExecution::Workspace *workspace)
 
void nestedWorkspaceFromSelectionRequested ()
 
void progressBarUpdateChange (bool canUpdate)
 
void progressBarVisibilityChange (bool visible)
 
void refreshLabelVisibilityRequested (bool)
 
void requestOpenWorkflow (const QString &filePath)
 
void requestShowOperationInWorkflowTree (CSIRO::DataExecution::Operation *op)
 
void statusBarMessageRequested (const QString &msg)
 
void toolTipRequested (const QString &msg)
 
void unpinAndHideRacks ()
 
void workspaceInputOutputVariableVisibilityChange ()
 

Public Member Functions

 WorkspaceScene (DataExecution::Workspace &workspace, WorkspaceController &workspaceController, const WorkspaceGraphicsEffectFactory &graphicsEffectFactory, WorkspaceTabWidget *parent=nullptr)
 
 ~WorkspaceScene () override
 
void clearAll ()
 
void collapseAllUnpinnedMiniOpRacks (const QList< MiniOperationRack * > &whiteListedRacks=QList< MiniOperationRack * >())
 
bool copyWorkspaceSelection ()
 
void cutSelection ()
 
void deleteSelection ()
 
void displayCompatibleMiniOperationDropTargets (MiniOperationView &viewUnderCursor, const QList< MiniOperationView * > &movingOpBoxes)
 
void dropMiniOperations (const QList< MiniOperationView * > &movedOpBoxes, const QPointF &mouseDelta)
 
ConnectionAnchorgetConnectionAnchor (const QUuid &id) const
 
ConnectionViewgetConnectionView (const DataExecution::Connection &conn) const
 
const WorkspaceGraphicsEffectFactorygetGraphicsEffectFactory () const
 
int getGridSpacing () const
 
MiniOperationRackgetLastMiniOperationRackHover ()
 
MiniOperationRackgetMiniOperationRack (const QUuid &id) const
 
MiniOperationViewgetMiniOperationView (const DataExecution::Operation &op) const
 
OperationViewBasegetOperationView (const DataExecution::Operation &op) const
 
bool getProgressBarsCanUpdate () const
 
bool getProgressBarsVisible () const
 
QList< OperationViewBase * > getSelectedOperations () const
 
QRectF getSelectionBoundingBox () const
 
DataExecution::WorkspacegetWorkspace ()
 
const DataExecution::WorkspacegetWorkspace () const
 
void hideAllUnpinnedPortRacks (const QList< OperationViewBase * > &whiteListedOpBoxes=QList< OperationViewBase * >())
 
bool isContextMenuActive () const
 
bool isReadOnly () const
 
bool isSuppressingConnectionWarnings ()
 
bool isUsingExtendedSelection ()
 
bool isUsingGrid () const
 
bool isUsingPlaceholderGraphics ()
 
void moveItems (const QList< QGraphicsItem * > &items, const QPointF &sceneDelta, bool skipFirst=true)
 
void moveSelection (const QPointF &sceneDelta, bool skipFirst=true)
 
void removeConnections (const QList< ConnectionView * > &connectionViews)
 
void requestCenterOnItem (const QGraphicsItem *item)
 
void requestClearDragState ()
 
void requestDisplayNestedWorkflowContents (DataExecution::Workspace &ws)
 
void requestRefreshLabelVisibility (bool visible)
 
void requestStatusBarMessage (const QString &msg)
 
void requestToolTip (const QString &msg)
 
void resetAllOperationsZOrder ()
 
void resetMiniOperationRackZOrder ()
 
void resetOperationGraphics ()
 
void saveViewExtras ()
 
void selectAll ()
 
QRectF selectionBoundingRect () const
 
QRectF selectionWorkspaceItemsRect () const
 
void setLastMiniOperationRackHover (MiniOperationRack *miniOpRack)
 
void setReadOnly (bool b)
 
void setSuppressConnectionWarnings (bool b) const
 
void setUsingExtendedSelection (bool b) const
 
void setUsingPlaceholderGraphics (bool b) const
 
void startHideTimerOnRacks (const QList< OperationViewBase * > &whiteListedOpBoxes=QList< OperationViewBase * >())
 
void updateControllerSelection (OperationViewBase *opBox)
 

Protected Member Functions

void dragEnterEvent (QGraphicsSceneDragDropEvent *event) override
 
void dragMoveEvent (QGraphicsSceneDragDropEvent *event) override
 
void dropEvent (QGraphicsSceneDragDropEvent *event) override
 

Member Enumeration Documentation

◆ WorkspaceItemTypes

Enumerator
OperationViewBoxT 
ConnectionViewT 
ConnectionAnchorT 
NoteItemT 
InputScalarPortT 
InputArrayPortT 
OutputPortT 
ConnectionPortT 
InputRackT 
OutputRackT 
MiniOperationRackT 
MiniOperationRackLabelT 
MiniOperationViewT 
TargetRectT 

◆ ZOrdering

enum ZOrdering

This controls the ordering of everything in the workspace scene from back to front (lower numbers are further behind). Intervals of 5 are used to allow each level to differentiate at an individual level (e.g. to differentiate between individual connection views).

Enumerator
ZMiniOperationRackDefault 
ZConnectionDefault 
ZOperationDefault 
ZNote 
ZMiniOperationInExpandedRack 
ZMiniOperationRackHover 
ZMiniOperationInRackHover 
ZConnectionHover 
ZConnectionAnchor 
ZOperationSecondaryHover 
ZOperationHover 
ZOperationInRackHover 
ZMiniOperationRackMoving 
ZMiniOperationInRackMoving 
ZConnectionRack 

Constructor & Destructor Documentation

◆ WorkspaceScene()

WorkspaceScene ( DataExecution::Workspace workspace,
WorkspaceController workspaceController,
const WorkspaceGraphicsEffectFactory graphicsEffectFactory,
WorkspaceTabWidget parent = nullptr 
)

◆ ~WorkspaceScene()

~WorkspaceScene ( )
override

Member Function Documentation

◆ aboutToDropNewItem

void aboutToDropNewItem ( const QPointF &  p)
signal

◆ centerOnItemRequested

void centerOnItemRequested ( const QGraphicsItem *  item)
signal

◆ clearAll()

void clearAll ( )

Clears the scene, removing all graphics items and widgets.

◆ clearDragStateRequested

void clearDragStateRequested ( )
signal

◆ collapseAllUnpinnedMiniOpRacks()

void collapseAllUnpinnedMiniOpRacks ( const QList< MiniOperationRack * > &  whiteListedRacks = QList<MiniOperationRack*>())

◆ connectionArrowLocationChanged

void connectionArrowLocationChanged ( int  loc)
signal

◆ copyWorkspaceSelection()

bool copyWorkspaceSelection ( )

We ignore connections that are not between two selected operations. The clipboard will automatically include connections that are between two selected operations, so we don't have to do any special handling of the connections in this function.

◆ createAnchor

void createAnchor ( const QPointF &  pScene)
slot

Creates a new anchor at the specified scene coordiantes.

◆ createNote

void createNote ( const QPointF &  pScene)
slot

Creates a new note with its top-left corner at the specified scene coordinates.

◆ cutSelection()

void cutSelection ( )

"Cuts" the selected graphics items, removing them but copying them to the clipboard first.

◆ deleteSelection()

void deleteSelection ( )

Deletes the selected graphics items.

◆ dependencyVisibilityChange

void dependencyVisibilityChange ( )
signal

◆ displayCompatibleMiniOperationDropTargets()

void displayCompatibleMiniOperationDropTargets ( MiniOperationView viewUnderCursor,
const QList< MiniOperationView * > &  movingOpBoxes 
)

Display compatible locations for dropping the specified mini operations in the scene,

Parameters
viewUnderCursorThe MiniOperation that is currently under the mouse cursor.
movingOpBoxesThe operations we are looking to drop.

◆ displayNestedWorkspaceContentsRequested

void displayNestedWorkspaceContentsRequested ( DataExecution::Workspace workspace)
signal

◆ dragEnterEvent()

void dragEnterEvent ( QGraphicsSceneDragDropEvent *  event)
overrideprotected

◆ dragMoveEvent()

void dragMoveEvent ( QGraphicsSceneDragDropEvent *  event)
overrideprotected

◆ dropEvent()

void dropEvent ( QGraphicsSceneDragDropEvent *  event)
overrideprotected

◆ dropMiniOperations()

void dropMiniOperations ( const QList< MiniOperationView * > &  movedOpBoxes,
const QPointF &  mouseDelta 
)

Drop the specified mini operations at the specified target delta from their current position.

Parameters
movedOpBoxesThe mini operations that are being dropped.
mouseDeltaThe displacement from the operations' current positions.

◆ getConnectionAnchor()

ConnectionAnchor * getConnectionAnchor ( const QUuid &  id) const
Parameters
idID of the anchor rack which is being sought.
Returns
The anchor that is identified by id.

◆ getConnectionView()

ConnectionView * getConnectionView ( const DataExecution::Connection conn) const
Parameters
connThe connection for which we wish to retrieve the connection view.
Returns
The connection view that corresponds to the specified connection conn.

◆ getGraphicsEffectFactory()

const WorkspaceGraphicsEffectFactory & getGraphicsEffectFactory ( ) const
Returns
the effect factory used to create the effects on items in the scene.

◆ getGridSpacing()

int getGridSpacing ( ) const
Returns
The spacing of the grid in the scene coordinate system.

◆ getLastMiniOperationRackHover()

MiniOperationRack * getLastMiniOperationRackHover ( )
Returns
The last mini operation that encountered a hover event.
See also
setLastMiniOperationRackHover

◆ getMiniOperationRack()

MiniOperationRack * getMiniOperationRack ( const QUuid &  id) const
Parameters
idID of the mini operation rack which is being sought.
Returns
The mini operation rack that is identified by id.

◆ getMiniOperationView()

MiniOperationView * getMiniOperationView ( const DataExecution::Operation op) const
Parameters
opThe operation for which the OperationViewBox is being sought.
Returns
The OperationViewBox that corresponds to the specified Operation op.

◆ getOperationView()

OperationViewBase * getOperationView ( const DataExecution::Operation op) const
Parameters
opThe operation for which the OperationView is being sought.
Returns
The OperationViewBox that corresponds to the specified Operation op.
Note
This function will also return any derived classes of OperationViewBase.

◆ getProgressBarsCanUpdate()

bool getProgressBarsCanUpdate ( ) const
Returns
True if progress bars are set to update in response to workflow progress events, false otherwise.

◆ getProgressBarsVisible()

bool getProgressBarsVisible ( ) const
Returns
true if operation progress bars are to be displayed in the scene, false otherwise.

◆ getSelectedOperations()

QList< OperationViewBase * > getSelectedOperations ( ) const
Returns
A list of selected operations.

◆ getSelectionBoundingBox()

QRectF getSelectionBoundingBox ( ) const

Returns the bounding box of the selected graphics items.

◆ getWorkspace() [1/2]

DataExecution::Workspace & getWorkspace ( )
Returns
The workspace that is being graphically represented by this scene. This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ getWorkspace() [2/2]

const DataExecution::Workspace & getWorkspace ( ) const
Returns
The workspace that is being graphically represented by this scene.

◆ hideAllUnpinnedPortRacks()

void hideAllUnpinnedPortRacks ( const QList< OperationViewBase * > &  whiteListedOpBoxes = QList<OperationViewBase*>())
Parameters
whiteListedOpBoxesPinned racks belonging to white listed Operations will not be hidden.

Hides all connection racks in the scene that have not been manually pinned by the user.

◆ isContextMenuActive()

bool isContextMenuActive ( ) const
Returns
true if the context menu is active, false otherwise.

◆ isReadOnly()

bool isReadOnly ( ) const

◆ isSuppressingConnectionWarnings()

bool isSuppressingConnectionWarnings ( )
Returns
true if the widget is being used by a tool rather than the workspace editor

◆ isUsingExtendedSelection()

bool isUsingExtendedSelection ( )
Returns
true if the widget is being used by a tool rather than the workspace editor

◆ isUsingGrid()

bool isUsingGrid ( ) const
Returns
True if all graphics items within the scene are aligned on a grid
See also
setGridSpacing
getGridSpacing

◆ isUsingPlaceholderGraphics()

bool isUsingPlaceholderGraphics ( )
Returns
true if placeholders are to be represented using the special 'transparent' imagery, false otherwise. If false, placeholders will be displayed as regular operations, but with no background color (grey).

◆ moveItems()

void moveItems ( const QList< QGraphicsItem * > &  items,
const QPointF &  sceneDelta,
bool  skipFirst = true 
)
Parameters
itemsThe items to move. Items are assumed to be in the scene.
sceneDeltaHow far to move the selection from the current positions.
skipFirstIf true, it is assumed that the caller has already applied the move and that they simply want the move to be undoable. To facilitate that, if skipFirst is true then the undoable command will not raise various Move...Event notifications. This prevents things like view widgets from applying the move a second time when the move is initiated by a user interacting with that widget.

◆ moveSelection()

void moveSelection ( const QPointF &  sceneDelta,
bool  skipFirst = true 
)
Parameters
sceneDeltaHow far to move the selection from the current positions.
skipFirstIf true, it is assumed that the caller has already applied the move and that they simply want the move to be undoable. To facilitate that, if skipFirst is true then the undoable command will not raise various Move...Event notifications. This prevents things like view widgets from applying the move a second time when the move is initiated by a user interacting with that widget.

◆ nestedWorkspaceFromSelection

void nestedWorkspaceFromSelection ( )
slot

Essentially cuts the selected operations and puts them into a nested workspace. Connections between the shifted operations are preserved and inputs and outputs are created for the nested workspace to preserve the overall effective connectivity as it was before the change. The entire set of changes will appear as a single undoable command.

◆ nestedWorkspaceFromSelectionRequested

void nestedWorkspaceFromSelectionRequested ( )
signal

◆ progressBarUpdateChange

void progressBarUpdateChange ( bool  canUpdate)
signal

◆ progressBarVisibilityChange

void progressBarVisibilityChange ( bool  visible)
signal

◆ refreshLabelVisibilityRequested

void refreshLabelVisibilityRequested ( bool  )
signal

◆ removeConnections()

void removeConnections ( const QList< ConnectionView * > &  connectionViews)

◆ replaceOperationRMB

void replaceOperationRMB ( DataExecution::Operation findOp)
slot

Replaces the selected operation. Connections are preserved

◆ requestCenterOnItem()

void requestCenterOnItem ( const QGraphicsItem *  item)
inline

◆ requestClearDragState()

void requestClearDragState ( )
inline

◆ requestDisplayNestedWorkflowContents()

void requestDisplayNestedWorkflowContents ( DataExecution::Workspace ws)
inline

◆ requestOpenWorkflow

void requestOpenWorkflow ( const QString &  filePath)
signal

◆ requestRefreshLabelVisibility()

void requestRefreshLabelVisibility ( bool  visible)
inline

◆ requestShowOperationInWorkflowTree

void requestShowOperationInWorkflowTree ( CSIRO::DataExecution::Operation op)
signal

◆ requestStatusBarMessage()

void requestStatusBarMessage ( const QString &  msg)
inline

◆ requestToolTip()

void requestToolTip ( const QString &  msg)
inline

◆ resetAllOperationsZOrder()

void resetAllOperationsZOrder ( )

Resets the Z-order of all OperationViews to their defaults.

◆ resetMiniOperationRackZOrder()

void resetMiniOperationRackZOrder ( )

Resets the Z-order of all OperationViews to their defaults.

◆ resetOperationGraphics()

void resetOperationGraphics ( )

◆ resetSelectedOperations

void resetSelectedOperations ( )
slot

Sets the up to date status of all selected operations to false. The workspace is allowed to be running at the time this function is called. The status modification will be performed in a safe manner and will change the status of the selected operations at the earliest opportunity (but not necessarily in the calling thread).

◆ saveViewExtras()

void saveViewExtras ( )

Saves the view extras information (generally position information)

◆ selectAll()

void selectAll ( )

Selects every graphics item in the scene so that it can be moved, edited or deleted.

◆ selectionBoundingRect()

QRectF selectionBoundingRect ( ) const
Returns
The bounding rect of all selected items in scene co-ordinates.

◆ selectionWorkspaceItemsRect()

QRectF selectionWorkspaceItemsRect ( ) const
Returns
The bounding rect of all selected opViewBoxes in scene co-ordinates.

◆ setConnectionArrowLocation

void setConnectionArrowLocation ( int  loc)
inlineslot

◆ setContextMenuActive

void setContextMenuActive ( bool  b)
slot
Parameters
bIndicate that the context menu is active.

◆ setGridSpacing

void setGridSpacing ( int  spacing)
slot
Parameters
spacingThe desired spacing of the underlying grid of the scene, specified in scene coordinates.

◆ setLastMiniOperationRackHover()

void setLastMiniOperationRackHover ( MiniOperationRack miniOpRack)
Parameters
miniOpRackThe last mini operation that encountered a hover event.
See also
getLastMiniOperationRackHover

◆ setProgressBarsCanUpdate

void setProgressBarsCanUpdate ( bool  b)
slot
Parameters
bSet to true to indicate that progress bars should update in response to progress events in the workflow.

◆ setProgressBarsVisible

void setProgressBarsVisible ( bool  b)
slot
Parameters
bSet to true if operation progress bars are to be displayed in the scene.

◆ setReadOnly()

void setReadOnly ( bool  b)

◆ setSuppressConnectionWarnings()

void setSuppressConnectionWarnings ( bool  b) const
Parameters
bSet to true if the widget is being used by a tool rather than the workspace editor

◆ setUsingExtendedSelection()

void setUsingExtendedSelection ( bool  b) const
Parameters
bSet to true if connection selection changes should be sent to the parent WorkspaceTabWidget

◆ setUsingGrid

void setUsingGrid ( bool  b)
slot
Parameters
bSet to true to indicate that the scene must align all graphics items to a grid.
See also
setGridSpacing
getGridSpacing

◆ setUsingPlaceholderGraphics()

void setUsingPlaceholderGraphics ( bool  b) const
Parameters
bSet to true if placeholders are to be represented using the special 'transparent' imagery. Set to false placeholders will be displayed as regular operations, but with no background color (grey).

◆ startHideTimerOnRacks()

void startHideTimerOnRacks ( const QList< OperationViewBase * > &  whiteListedOpBoxes = QList<OperationViewBase*>())
Parameters
whiteListedOpBoxesHide timer on these Operations' racks will not be started.

Starts hide timer on all connection racks in the scene.

◆ statusBarMessageRequested

void statusBarMessageRequested ( const QString &  msg)
signal

◆ toolTipRequested

void toolTipRequested ( const QString &  msg)
signal

◆ unpinAndHideRacks

void unpinAndHideRacks ( )
signal

◆ updateControllerSelection()

void updateControllerSelection ( OperationViewBase opBox)
Parameters
opBoxthe operation viewbox that we're indicating is selected (or deselected)

◆ updateDependencyVisibility

void updateDependencyVisibility ( )
slot

Updates the visibility of operation dependencies based on the current settings.

◆ updateMiniOperationVisibility

void updateMiniOperationVisibility ( )
slot

Updates the visibility of all mini operations present in the scene based on the current settings.

◆ workspaceInputOutputVariableVisibilityChange

void workspaceInputOutputVariableVisibilityChange ( )
signal