X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FEditorGraphicBBS%2FbbsWxGUIEditorGraphic%2FwxVtkSceneManager.h;h=c5cb8cbf591157234be8279bbd8e3e8c3614883e;hb=a45d2dc35562aad94f11ce0c82dfe5f53155462e;hp=14f53f02a716ba91caff3689afb66d938663d5a5;hpb=6a326b219e8d69c186f8cff4e82c64b622fc9288;p=bbtkGEditor.git diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.h index 14f53f0..c5cb8cb 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.h +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.h @@ -1,4 +1,29 @@ -/*========================================================================= +/* +# --------------------------------------------------------------------- +# +# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image +# pour la Santé) +# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton +# +# This software is governed by the CeCILL-B license under French law and +# abiding by the rules of distribution of free software. You can use, +# modify and/ or redistribute the software under the terms of the CeCILL-B +# license as circulated by CEA, CNRS and INRIA at the following URL +# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +# or in the file LICENSE.txt. +# +# As a counterpart to the access to the source code and rights to copy, +# modify and redistribute granted by the license, users are provided only +# with a limited warranty and the software's author, the holder of the +# economic rights, and the successive licensors have only limited +# liability. +# +# The fact that you are presently reading this means that you have had +# knowledge of the CeCILL-B license and that you accept its terms. +# ------------------------------------------------------------------------ +*/ + +/*========================================================================= Program: bbtk Module: $RCSfile$ Language: C++ @@ -11,28 +36,28 @@ Version: $Revision$ * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux * -* This software is governed by the CeCILL-B license under French law and -* abiding by the rules of distribution of free software. You can use, -* modify and/ or redistribute the software under the terms of the CeCILL-B -* license as circulated by CEA, CNRS and INRIA at the following URL -* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +* This software is governed by the CeCILL-B license under French law and +* abiding by the rules of distribution of free software. You can use, +* modify and/ or redistribute the software under the terms of the CeCILL-B +* license as circulated by CEA, CNRS and INRIA at the following URL +* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html * or in the file LICENSE.txt. * * As a counterpart to the access to the source code and rights to copy, * modify and redistribute granted by the license, users are provided only * with a limited warranty and the software's author, the holder of the * economic rights, and the successive licensors have only limited -* liability. +* liability. * * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-B license and that you accept its terms. -* ------------------------------------------------------------------------ */ +* ------------------------------------------------------------------------ */ /** -* \file -* \brief Class bbtk::BlackBox : abstract black-box interface. +* \file +* \brief Class bbtk::BlackBox : abstract black-box interface. */ /**** @@ -74,22 +99,29 @@ Version: $Revision$ #include #include #include +#include +#include +#include + #include //Includes std #include +#include +#include #include - namespace bbtk { class wxGEditorTabPanel; class wxVtkSceneManager : public InteractorStyleMaracas , public Observer { - public: - - wxVtkSceneManager(wxGEditorTabPanel *parent, wxVtk3DBaseView *baseView, int idManager); + public: + +//EED 15 oct 2012 wxVtkSceneManager(wxGEditorTabPanel *parent, wxVtk3DBaseView *baseView, int idManager); + wxVtkSceneManager(wxGEditorTabPanel *parent, wxVtk3DBaseView *baseView, int idManager,Factory::Pointer bbtkfactory); + ~wxVtkSceneManager(); void disconnectDrop(); @@ -100,25 +132,40 @@ namespace bbtk virtual bool OnChar(); virtual bool OnMouseMove(); - virtual bool OnLeftButtonDown(); - virtual bool OnLeftButtonUp(); + virtual bool OnLeftButtonDown(); + virtual bool OnLeftButtonUp(); virtual bool OnRightButtonUp(); virtual bool OnLeftDClick(); + virtual bool OnMiddleButtonDown(); ///JLGR 21-05-2012 + virtual bool OnMiddleButtonUp(); ///JLGR 21-05-2012 //------- - int createGBlackBox(int x, int y,std::string packageName, std::string boxType); + 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); + GPortController* createGPort(int portType, std::string bbtkName, std::string bbtkType, std::string bbtkDescription, int posinBox,GBoxModel *blackBox); + +//EED2017-04-07 +// int createGInputPort(int portType, int posinBox,GBoxModel *blackBox, BlackBoxInputDescriptor *desc); +// int createGOutputPort(int portType, int posinBox,GBoxModel *blackBox, BlackBoxOutputDescriptor *desc); + int createGInputPort(int portType, int posinBox,GObjectController *gBoxControler, BlackBoxInputDescriptor *desc); + int createGOutputPort(int portType, int posinBox,GObjectController *gBoxControler, BlackBoxOutputDescriptor *desc); + int createGConnector(GPortModel* startPort); + void configGBlackBox(int idBox, double xIn, double yIn, double zIn, std::string name, bool boxExecutable,double xEn,double yEn,double zEn); + int configGConnetion( std::string nameStartBox, std::string nameStartPort, std::string nameEndBox, std::string nameEndPort); + void configGComBoxInputOutputPort(bool inputoutput, std::string inputPortName, double xIn, double yIn,double zIn); + GBoxModel* findGBox(std::string boxname); + + + vtkRenderWindow* getRenderWindow(); - vtkRenderer* getRenderer(); + vtkRenderer* getRenderer(); virtual void update(int idController,int command); + void refresh(); void refreshScene(); void displayBlackBoxInfo(std::string packageName, std::string boxName); void updateStatusBar(std::string textStatus); @@ -147,19 +194,23 @@ namespace bbtk //Add a map of object controllers void addObjects(std::map objectsMap); + /// Duplicates Objects to current a diagram + void DuplicateObjects(std::map objectsMap);///JLGR 21-05-2012 + //------- + // Makes a BlackBox Executable + bool MakeBoxExecutable();//DFCH //------- //Returns a string with the BBS script of the current diagram. - std::string getDiagramBBS(); + std::string getDiagramBBS(bool wln=false); //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=""); + std::string saveComplexBoxBBS(); //Delete the object in the list of controllers with the id given by parameter. - void deleteObject(int id); - - void AddControlerToBeRemove(std::vector *controllersToRemove, int id); + bool deleteObject(int id); + void AddControlerToBeRemove(std::vector *controllersToRemove, int id); //Clear list of controllers and refresh void deleteAllBoxes(); @@ -167,50 +218,81 @@ namespace bbtk //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); + //Load the diagram + void loadDiagram(std::stringstream &inputStream); //Center the view of the camera in the initial position void centerView(); + bool boxExist(std::string boxname); + std::string generateANewNameForABox(); + std::string findANewNameForABox(); //------- - + void SetCbName(std::string cbNane); + void SetCbPackageName(std::string packagename); + void SetAuthor(std::string author); + void SetCategory(std::string category); + void SetDescription(std::string description); + void SetMessageKind(std::string kind); + void SetMessageLevel(std::string Level); + std::string GetCbName(); + std::string GetCbPackageName(); + std::string GetAuthor(); + std::string GetCategory(); + std::string GetDescription(); + std::string GetMessageKind(); + std::string GetMessageLevel(); + + // RaC2012 2nd HackFest + // External Inputs was the complex inputs in previous versions + // Get names of all external inputs + std::vector< std::string> GetExternalInputsNames(); + void getCleanLine(std::stringstream &inputStream, std::string &line); + // JGRR & CM + void printAll( int com, int sta ); + std::vector boxesDiagram;//CFT private: - + std::string _cbName; + std::string _cbPackageName; + std::string _Author; + std::string _Category; + std::string _Description; + std::string _MessageKind; + std::string _MessageLevel; //wxPanel that uses the manager - wxGEditorTabPanel *_parent; - + wxGEditorTabPanel *_parent; // Id of the manager, the same of the panel - int _idManager; - + int _idManager; // Boxes number in the scene - int _numBoxes; - + int _numBoxes; // StartDragging - bool _startDragging; - + bool _startDragging; // creaMaracasVisu viewer - wxVtk3DBaseView *_baseView; - + wxVtk3DBaseView *_baseView; // State of the 3D Scene or the virtual world int _worldState; - //Map of id - objectController - std::map _controllers; - + 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; - + std::vector _selectedObjects; + //Is the diagram in state complex box + bool _isComplexBox; + int _idConnectionInCreation; int _contLastId; - + vtkTextActor3D *_textActor; + std::string _bugTextActor_text; + int _bugTextActor_status; + vtkPoints *_pts; + vtkActor *_fillObjectActor; + vtkDataSetMapper *_aPolygonMapper; + Factory::Pointer _bbtkfactory; + std::string LineNumber(bool withLineNumber, int &value); + int GetIndexInSelected(int idControler); + void UnSelectBlackBoxes(); + GObjectController *GetGBlackBoxControlerPointedByMouse(); + void CancelConnection(); protected: - };