X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/d30c9cf675ad7141d1c8e31d2e72315267d45cf2..cf93fd850a8b6e9a6f40faed9f796a0e2fb0cedb:/GroupScene.h diff --git a/GroupScene.h b/GroupScene.h index 3078305..a691a6d 100644 --- a/GroupScene.h +++ b/GroupScene.h @@ -11,6 +11,7 @@ class AbstractBlock; class GroupWidget; class GroupItem; class BoxItem; +class SourceItem; class AbstractBoxItem; class ConnectionItem; class InterfaceItem; @@ -41,17 +42,19 @@ public: - AddGroup: while a new group (empty or from selected blocks) is created - ItemEdtion: can move/resize blocks/interfaces, remove blocks/interface/group, ... */ - enum EditMode { InitState, AddBlock, AddConnection, AddGroup, ItemEdition }; + enum EditMode { InitState, AddConnection, ItemEdition }; GroupScene(GroupScene* _parentScene, GroupWidget* _window, Dispatcher* _dispatcher, Parameters* _params, bool topScene = false, QObject *parent = 0); ~GroupScene(); // attributes getters inline GroupItem* getGroupItem() {return groupItem;} - inline QList getBlockItems() { return blockItems; } + inline QList getBoxItems() { return boxItems; } + inline QList getSourceItems() { return sourceItems; } inline QList getConnectionItems() { return connectionItems; } inline QList getChildrenScene() { return childrenScene; } - inline GroupWidget* getGroupWindow() { return window; } + inline GroupScene* getParentScene() { return parentScene; } + inline GroupWidget* getGroupWidget() { return window; } inline int getId() { return id; } inline EditMode getEditionMode() { return editMode; } InterfaceItem* getSelectedInterface(int id); @@ -66,23 +69,34 @@ public: // attributes testers inline bool isTopScene() { return topScene; } - // others - BoxItem* createBlockItem(AbstractBlock* block); - void addBlockItem(BoxItem* item); - void removeBlockItem(BoxItem* item); + + // BoxItem related + BoxItem* createBoxItem(AbstractBlock* block); //! create a new BoxItem and place it at the center of the scene + void addBoxItem(BoxItem* item); //! add an already configured BoxItem in the scene. + void removeBoxItem(BoxItem* item); + + // ConnectionItem related void createConnectionItem(InterfaceItem* iface1, InterfaceItem* iface2); ConnectionItem* searchConnectionItem(InterfaceItem* iface1, InterfaceItem* iface2); void addConnectionItem(ConnectionItem* item); void removeConnectionItem(ConnectionItem* item); + + // GroupItem related void removeGroupItem(); + + // SourceItem related + SourceItem* createSourceItem(AbstractBlock* block); //! create a new SourceItem and place it around the group item + void addSourceItem(SourceItem* item); //! add an already configured SourceItem in the scene. + void removeSourceItem(SourceItem* item); + + // child scenes related inline void addChildScene(GroupScene* child) { childrenScene.append(child); } + inline void removeChildScene(GroupScene* child) { childrenScene.removeAll(child); } + inline int getNbChildScene() { return childrenScene.size(); } void unselecteInterfaces(); - - QList getGroupAndBlocks(); - QList getSelectedBlocks(); - - QList getInterfaceConnections(InterfaceItem *item); + + QList getSelectedBlocks(); int setItemsId(int countInit=1); int setInterfacesId(int countInit=1); @@ -94,13 +108,14 @@ public: private: Dispatcher *dispatcher; Parameters *params; - GroupScene* parentScene; // the parnet scene, =NULL for top scene + GroupScene* parentScene; // the parent scene, =NULL for top scene GroupWidget* window; // the GroupWindow that contains that scene int id; - GroupItem *groupItem; // mandatory to be an instance of GroupItem. - QList connectionItems; - QList blockItems; - QList childrenScene; + GroupItem *groupItem; //! for convenience, the group item is directly accessible via this attribute + QList connectionItems; //! for convenience, connections are directly accessible via this attribute + QList boxItems; //! for convenience, box items are directly accessible via this attribute + QList sourceItems; //! for convenience, box items are directly accessible via this attribute. Only usefull for top scene + QList childrenScene;//! for convenience, children scenes are directly accessible via this attribute bool topScene; EditMode editMode; InterfaceItem* selectedInterfaces[2]; // selected iface 1 in AddConnection mode