X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=lib%2FEditorGraphicBBS%2FbbsWxGUIEditorGraphic%2FwxVtkSceneManager.h;h=14e1a1dc00663e52b70fe6aa0d5c75af6468053b;hb=7b751cdb5f4ee2fd8c86a4f257f30f401de0f78c;hp=86f24fdfab050a282ee3d0191117a56fd71c92da;hpb=62f479996c001d53a10c45e3ad6a3651b8007668;p=bbtkGEditor.git diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.h index 86f24fd..14e1a1d 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.h +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.h @@ -35,10 +35,11 @@ Version: $Revision$ * \brief Class bbtk::BlackBox : abstract black-box interface. */ -/** -* \class bbtk::wxVtkSceneManager -* \brief -*/ +/**** +* Design and Developpement of BBTK GEditor +* Ricardo A Corredor J +* RaC - 2010 +****/ #ifndef __wxVtkSceneManager_h__ #define __wxVtkSceneManager_h__ @@ -87,26 +88,16 @@ namespace bbtk class wxVtkSceneManager : public InteractorStyleMaracas , public Observer { public: + wxVtkSceneManager(wxGEditorTabPanel *parent, wxVtk3DBaseView *baseView, int idManager); ~wxVtkSceneManager(); + void disconnectDrop(); + //------- void configureBaseView(); - int createGBlackBox(int x, int y,std::string packageName, std::string boxType); - int createGComplexBoxInputPort(std::string inputName); - int createGComplexBoxOutputPort(std::string outputName); - GPortController* createGPort(int portType, std::string bbtkName, std::string bbtkType, int posinBox,GBoxModel *blackBox); - int createGInputPort(int portType, int posinBox,GBoxModel *blackBox, BlackBoxInputDescriptor *desc); - int createGOutputPort(int portType, int posinBox,GBoxModel *blackBox, BlackBoxOutputDescriptor *desc); - int createGConnector(GPortModel* startPort); - void registerController(InteractorStyleMaracas *param); void unregisterController(InteractorStyleMaracas *param); - vtkRenderWindow* getRenderWindow(); - vtkRenderer* getRenderer(); - - void disconnectDrop(); - virtual bool OnChar(); virtual bool OnMouseMove(); virtual bool OnLeftButtonDown(); @@ -114,36 +105,77 @@ namespace bbtk virtual bool OnRightButtonUp(); virtual bool OnLeftDClick(); + //------- + int createGBlackBox(int x, int y,std::string packageName, std::string boxType); + int createGComplexBoxInputPort(std::string inputName); + int createGComplexBoxOutputPort(std::string outputName); + GPortController* createGPort(int portType, std::string bbtkName, std::string bbtkType, int posinBox,GBoxModel *blackBox); + int createGInputPort(int portType, int posinBox,GBoxModel *blackBox, BlackBoxInputDescriptor *desc); + int createGOutputPort(int portType, int posinBox,GBoxModel *blackBox, BlackBoxOutputDescriptor *desc); + int createGConnector(GPortModel* startPort); + + vtkRenderWindow* getRenderWindow(); + vtkRenderer* getRenderer(); + virtual void update(int idController,int command); + void refreshScene(); void displayBlackBoxInfo(std::string packageName, std::string boxName); void updateStatusBar(std::string textStatus); - std::string getDiagramBBS(); - std::string saveComplexBoxBBS(std::string cbName,std::string cbAuthor="",std::string cbCategory="",std::string cbDescription=""); - void deleteObject(int id); - void deleteAllBoxes(); - void saveDiagram(std::string &content); - void loadDiagram(ifstream &inputStream); - void centerView(); - void refreshScene(); + //------- + //Get a collection of object ids std::vector getBlackBoxes(); std::vector getConnections(); std::vector getComplexInputPorts(); std::vector getComplexOutputPorts(); + //Get the map of selected objects (id, controller) std::map getSelectedObjects(); + + //Get size of selected objects map int getNumSelectedObjects(); + //Complex box edition mode bool isComplexBox(); void setComplexBox(bool val); + //------- + //Add an object to the list of controllers int addObjectController(GObjectController* objController); + + //Add a map of object controllers void addObjects(std::map objectsMap); + + //------- + //Returns a string with the BBS script of the current diagram. + std::string getDiagramBBS(); + + //Returns a string with the BBS script of the complex box. + std::string saveComplexBoxBBS(std::string cbName,std::string cbAuthor="",std::string cbCategory="",std::string cbDescription=""); + + //Delete the object in the list of controllers with the id given by parameter. + void deleteObject(int id); + + //Clear list of controllers and refresh + void deleteAllBoxes(); + + //Save the diagram in the BBG format, in the string given by param. + void saveDiagram(std::string &content); + + //Load the diagram + void loadDiagram(ifstream &inputStream); + + //Center the view of the camera in the initial position + void centerView(); + + //------- + private: + //wxPanel that uses the manager wxGEditorTabPanel *_parent; // Id of the manager, the same of the panel @@ -155,17 +187,25 @@ namespace bbtk // StartDragging bool _startDragging; + // creaMaracasVisu viewer wxVtk3DBaseView *_baseView; + // State of the 3D Scene or the virtual world int _worldState; + //Map of id - objectController std::map _controllers; //Saves the id's of the selected objects in the controllers map std::vector _selectedObjects; + //Is the diagram in state complex box bool _isComplexBox; + int _idConnectionInCreation; + + int _contLastId; + protected: };