From 254bc264b6efd44aaf3e6bc1b43f8113bc3d6476 Mon Sep 17 00:00:00 2001 From: corredor <> Date: Fri, 18 Jun 2010 14:29:24 +0000 Subject: [PATCH] Cleaning code and documenting --- .../GObjectsMVCFactory.h | 10 ++- .../bbsWxGUIEditorGraphic/wxVtkSceneManager.h | 85 +++++++++++++++---- 2 files changed, 74 insertions(+), 21 deletions(-) diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/GObjectsMVCFactory.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/GObjectsMVCFactory.h index 606b095..3364bb4 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/GObjectsMVCFactory.h +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/GObjectsMVCFactory.h @@ -89,21 +89,23 @@ namespace bbtk //Public methods static GObjectsMVCFactory* getInstance(); static void destroyInstance(); + BlackBoxDescriptor::Pointer getBlackBoxDescriptor(std::string packageName, std::string boxName); + vtkGObjectView* createGObjectView(int type); GObjectController* createGObjectController(int type); GObjectModel* createGObjectModel(int type); + //Public attributes Interpreter::Pointer _interpreter; private: - //Attributes - static GObjectsMVCFactory* instance; - - //Private Methods + //Private Attributes + static GObjectsMVCFactory* instance; + protected: diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.h index 86f24fd..8e8a7aa 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.h +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.h @@ -87,26 +87,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 +104,93 @@ 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); + + //------- + //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(); - 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); - int addObjectController(GObjectController* objController); - void addObjects(std::map objectsMap); - + private: + //wxPanel that uses the manager wxGEditorTabPanel *_parent; // Id of the manager, the same of the panel @@ -155,15 +202,19 @@ 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; protected: -- 2.45.1