From: corredor <> Date: Fri, 26 Mar 2010 15:46:17 +0000 (+0000) Subject: It works !! Basic D&D and creation of VTK rectangle... Good work X-Git-Tag: v1_0_0~119 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=64fc9f949ff91d6e9d448ca0567e6205ee4d5be4;p=bbtkGEditor.git It works !! Basic D&D and creation of VTK rectangle... Good work --- diff --git a/appli/bbEditor/bbEditor.cxx b/appli/bbEditor/bbEditor.cxx index 57bd80c..3629d9b 100644 --- a/appli/bbEditor/bbEditor.cxx +++ b/appli/bbEditor/bbEditor.cxx @@ -5,17 +5,17 @@ //========================================================================== #include "bbtkwxGUIEditorGraphicBBS.h" - + #include #include - + class wxBBEditorApp : public wxApp { public: bool OnInit( ); int OnExit() { return true; } - + }; IMPLEMENT_APP(wxBBEditorApp); diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBlackBoxModel.cxx b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBlackBoxModel.cxx new file mode 100644 index 0000000..aa3675e --- /dev/null +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBlackBoxModel.cxx @@ -0,0 +1,60 @@ +/*========================================================================= +Program: bbtk +Module: $RCSfile$ +Language: C++ +Date: $Date$ +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 +* 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. +* ------------------------------------------------------------------------ */ + +/** +* \file +* \brief Class bbtk::GBlackBox +*/ + + +#include "GBlackBoxModel.h" + +namespace bbtk +{ + + + //========================================================================= + GBlackBoxModel::GBlackBoxModel() + { + + + } + + //========================================================================= + GBlackBoxModel::~GBlackBoxModel() + { + } + //========================================================================= + + +} // EO namespace bbtk + +// EOF + diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBlackBoxModel.h b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBlackBoxModel.h new file mode 100644 index 0000000..4c10551 --- /dev/null +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBlackBoxModel.h @@ -0,0 +1,86 @@ +/*========================================================================= +Program: bbtk +Module: $RCSfile$ +Language: C++ +Date: $Date$ +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 +* 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. +* ------------------------------------------------------------------------ */ + + + +/** +* \file +* \brief Class bbtk::GBlackBox : abstract black-box interface. +*/ + +/** +* \class bbtk::GBlackBox +* \brief +*/ + +#ifndef __GBlackBoxModel_h__ +#define __GBlackBoxModel_h__ + +//Includes same project +#include "GlobalConstants.h" +#include "GObjectModel.h" + +//Includes creaMaracasVisu + +//Includes std +#include + +namespace bbtk +{ + + class GBlackBoxModel : public GObjectModel + { + + public: + + //Constructors + GBlackBoxModel(); + ~GBlackBoxModel(); + + //Public methods + + + private: + + //Attributes + + + //Private Methods + + protected: + //Protected methods + + }; + + +} +// namespace bbtk +#endif + diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.cxx b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.cxx new file mode 100644 index 0000000..d871e06 --- /dev/null +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.cxx @@ -0,0 +1,99 @@ +/*========================================================================= +Program: bbtk +Module: $RCSfile$ +Language: C++ +Date: $Date$ +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 +* 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. +* ------------------------------------------------------------------------ */ + +/** +* \file +* \brief Class bbtk::GObjectModel +*/ + + +#include "GObjectModel.h" + +namespace bbtk +{ + + + //========================================================================= + GObjectModel::GObjectModel() + { + + _xInic = 0; + _yInic = 0; + _zInic = 900; + _xFin = 0; + _yFin = 0; + _zFin = 900; + } + + //========================================================================= + GObjectModel::~GObjectModel() + { + } + //========================================================================= + + void GObjectModel::getInicPoint(double& x, double& y, double& z) + { + x = _xInic; + y = _yInic; + z = _zInic; + } + //========================================================================= + + void GObjectModel::getFinalPoint(double& x, double& y, double& z) + { + x = _xInic+BOX_SIDE; + y = _yInic+BOX_SIDE; + z = _zFin; + } + //========================================================================= + + void GObjectModel::setInicPoint(double& x, double& y, double& z) + { + _xInic = x; + _yInic = y; + _zInic = z; + + } + //========================================================================= + + void GObjectModel::setFinalPoint(double& x, double& y, double& z) + { + _xFin = x; + _yFin = y; + _zFin = z; + } + //========================================================================= + + + +} // EO namespace bbtk + +// EOF + diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.h b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.h new file mode 100644 index 0000000..9f7a265 --- /dev/null +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.h @@ -0,0 +1,98 @@ +/*========================================================================= +Program: bbtk +Module: $RCSfile$ +Language: C++ +Date: $Date$ +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 +* 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. +* ------------------------------------------------------------------------ */ + + + +/** +* \file +* \brief Class bbtk::GObjectModel : abstract black-box interface. +*/ + +/** +* \class bbtk::GObjectModel +* \brief +*/ + +#ifndef __GObjectModel_h__ +#define __GObjectModel_h__ + +//Includes same project +#include "GlobalConstants.h" + +//Includes creaMaracasVisu + +//Includes std +#include + +namespace bbtk +{ + + class GObjectModel + { + + public: + + //Constructors + GObjectModel(); + ~GObjectModel(); + + //Public methods + + void getInicPoint(double& x, double& y, double& z); + void getFinalPoint(double& x, double& y, double& z); + void setInicPoint(double& x, double& y, double& z); + void setFinalPoint(double& x, double& y, double& z); + + private: + + //Private Attributes + + //Private Methods + + protected: + + //Protected Attributes + + double _xInic; + double _yInic; + double _zInic; + double _xFin; + double _yFin; + double _zFin; + + //Protected methods + + }; + + +} +// namespace bbtk +#endif + diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h new file mode 100644 index 0000000..bdc66c1 --- /dev/null +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h @@ -0,0 +1,63 @@ +/*========================================================================= +Program: bbtk +Module: $RCSfile$ +Language: C++ +Date: $Date$ +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 +* 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. +* ------------------------------------------------------------------------ */ + + + +/** +* \file +* \brief bbtk::GlobalConstants +*/ + + + +#ifndef __GlobalConstants_h__ +#define __GlobalConstants_h__ + +namespace bbtk +{ + + // Object types + const int GBLACKBOX = 1; + const int GCONNECTOR = 2; + const int GPORT = 3; + + // Object states + static const int NOTHING_HAPPENS = 101; + const int HIGHLIGHTED=102; + const int CLICKED=103; + const int DRAG=104; + const int SELECTED=105; + + // Object dimensions + const double BOX_SIDE=1.0; +} +// namespace bbtk +#endif + diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx index 1b87e2c..e476c03 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx @@ -35,12 +35,6 @@ Version: $Revision$ #include "wxVtkSceneManager.h" -#include - -#include "vtkConeSource.h" -#include "vtkPolyDataMapper.h" -#include "vtkActor.h" -#include "vtkRenderer.h" namespace bbtk { @@ -55,14 +49,13 @@ namespace bbtk { _baseView->GetWxVTKRenderWindowInteractor()->SetDropTarget(parent); + registerController(this); - registerController(this); configureBaseView(); - vtkRenderer *ren1 =_baseView->GetRenderer(); vtkConeSource *cone = vtkConeSource::New(); - cone->SetResolution(8); + cone->SetResolution(10); vtkPolyDataMapper *map = vtkPolyDataMapper::New(); map->SetInput(cone->GetOutput()); @@ -71,31 +64,103 @@ namespace bbtk act->SetMapper(map); - ren1->AddActor(act); + ///////////////////// + + + vtkPoints *_pts = vtkPoints::New(); + _pts->SetNumberOfPoints(4); + + _pts->SetPoint(0, -1 , -1 , 0 ); + _pts->SetPoint(1, 1 , -1 , 0 ); + _pts->SetPoint(2, 1 , 1 , 0 ); + _pts->SetPoint(3, -1 , 1 , 0 ); + + vtkCellArray *lines = vtkCellArray::New(); + lines->InsertNextCell(5); + lines->InsertCellPoint(0); + lines->InsertCellPoint(1); + lines->InsertCellPoint(2); + lines->InsertCellPoint(3); + lines->InsertCellPoint(0); + + vtkPolyData *_pd = vtkPolyData::New(); + _pd->SetPoints( _pts ); + _pd->SetLines( lines ); + + vtkActor *_pointVtkActor = vtkActor::New(); + vtkPolyDataMapper* _bboxMapper = vtkPolyDataMapper::New(); + + _bboxMapper->SetInput(_pd); + _pointVtkActor->SetMapper(_bboxMapper); + + getRenderer()->AddActor(_pointVtkActor); + + + + ///////////////////// + + //getRenderer()->AddActor(act); - ren1->Render(); + //getRenderer()->Render(); + + } } + //========================================================================= + void wxVtkSceneManager::disconnectDrop() + { + _baseView->GetWxVTKRenderWindowInteractor()->SetDropTarget(NULL); + } //========================================================================= wxVtkSceneManager::~wxVtkSceneManager() { - //_baseView->GetWxVTKRenderWindowInteractor()->SetDropTarget(NULL); } //========================================================================= void wxVtkSceneManager::configureBaseView() { - vtkInteractorStyleBaseView2D *temp = new vtkInteractorStyleBaseView2D(); - _baseView->SetInteractorStyleBaseView(temp); + vtkInteractorStyleImage *temp = vtkInteractorStyleImage::New(); + _baseView->GetWxVTKRenderWindowInteractor()->SetInteractorStyle(temp); + _baseView->GetRenderer()->SetActiveCamera(_baseView->GetCamera()); + _baseView->GetRenderer()->ResetCamera (); + _baseView->GetCamera()->SetParallelProjection(true); + _baseView->Refresh(); + } //========================================================================= - void wxVtkSceneManager::createGBlackBox() + void wxVtkSceneManager::createGBlackBox(int x, int y, std::string packageName, std::string boxName) { - InteractorStyleMaracas *toAdd = VTKGObjectsFactory::getInstance()->createGBlackBox(_baseView); - registerController(toAdd); + int type = GBLACKBOX; + + //Create the MVC Objects + GObjectModel *model = GObjectsMVCFactory::getInstance()->createGObjectModel(type); + vtkGObjectView *view = GObjectsMVCFactory::getInstance()->createGObjectView(type); + GObjectController* controller = GObjectsMVCFactory::getInstance()->createGObjectController(type); + + //Prepares the initial model + double xx = x; + double yy = y; + double zz = 900; + + _baseView->TransCoordScreenToWorld(xx,yy,zz); + + //Associates the view with the correspondent renderer and the model. + //(NOTE: Refresh is only made by the view) + model->setInicPoint(xx,yy,zz); + view->setModel(model); + view->setRenderer(_baseView->GetRenderer()); + view->initVtkObjects(); + + //Refresh renderwindow with new objects + refreshRenderWindow(); + + //Associates the controller with the correspondent model and view + controller->setModelAndView(model,view); + + registerController((InteractorStyleMaracas*) controller); } //========================================================================= @@ -120,7 +185,12 @@ namespace bbtk return _baseView->GetRenWin(); } //========================================================================= - + + void wxVtkSceneManager::refreshRenderWindow() + { + _baseView->GetRenWin()->Render(); + } + //========================================================================= //========================================================================= } // EO namespace bbtk diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.h b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.h index f3383ed..92f4a60 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.h +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.h @@ -43,8 +43,8 @@ Version: $Revision$ #ifndef __wxVtkSceneManager_h__ #define __wxVtkSceneManager_h__ -//Includes Same project -#include "VTKGObjectsFactory.h" +//Includes same project +#include "GObjectsMVCFactory.h" //Includes creaMaracasVisu #include @@ -54,6 +54,7 @@ Version: $Revision$ #include #include #include +#include //Includes std #include @@ -68,17 +69,20 @@ namespace bbtk ~wxVtkSceneManager(); void configureBaseView(); - void createGBlackBox(); + void createGBlackBox(int x, int y,std::string packageName, std::string boxName); void registerController(InteractorStyleMaracas *param); vtkRenderWindow* getRenderWindow(); vtkRenderer* getRenderer(); + void disconnectDrop(); + private: int _id; wxVtk3DBaseView *_baseView; + void refreshRenderWindow(); protected: }; diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/CMakeLists.txt b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/CMakeLists.txt index 18d6e90..654574c 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/CMakeLists.txt +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/CMakeLists.txt @@ -9,4 +9,5 @@ INCLUDE_DIRECTORIES(../bbsKernelEditorGraphic) ADD_LIBRARY(bbsVtkGUIEditorGraphic ${bbsVtkGUIEditorGraphic_CXX_SOURCES} ${bbsVtkGUIEditorGraphic_H_SOURCES} ) + diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBlackBoxController.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBlackBoxController.cxx new file mode 100644 index 0000000..7cdf253 --- /dev/null +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBlackBoxController.cxx @@ -0,0 +1,61 @@ +/*========================================================================= +Program: bbtk +Module: $RCSfile$ +Language: C++ +Date: $Date$ +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 +* 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. +* ------------------------------------------------------------------------ */ + +/** +* \file +* \brief Class bbtk::GBlackBoxController +*/ + + +#include "GBlackBoxController.h" + +namespace bbtk +{ + + + //========================================================================= + GBlackBoxController::GBlackBoxController() + { + + } + + //========================================================================= + GBlackBoxController::~GBlackBoxController() + { + } + //========================================================================= + + + //========================================================================= + +} // EO namespace bbtk + +// EOF + diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBlackBoxController.h b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBlackBoxController.h new file mode 100644 index 0000000..a908f10 --- /dev/null +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBlackBoxController.h @@ -0,0 +1,85 @@ +/*========================================================================= +Program: bbtk +Module: $RCSfile$ +Language: C++ +Date: $Date$ +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 +* 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. +* ------------------------------------------------------------------------ */ + + + +/** +* \file +* \brief Class bbtk::GBlackBoxController : +*/ + +/** +* \class bbtk::GBlackBoxController +* \brief +*/ + +#ifndef __GBlackBoxController_h__ +#define __GBlackBoxController_h__ + +//Includes same project +#include "GlobalConstants.h" +#include "GObjectController.h" + +//Includes creaMaracasVisu + +//Includes std +#include + + +namespace bbtk +{ + + class GBlackBoxController : public GObjectController + { + + public: + + //Constructors + GBlackBoxController(); + ~GBlackBoxController(); + + //Public methods + + + private: + + //Attributes + + //Private Methods + + protected: + + }; + + +} +// namespace bbtk +#endif + diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx new file mode 100644 index 0000000..f00541c --- /dev/null +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx @@ -0,0 +1,65 @@ +/*========================================================================= +Program: bbtk +Module: $RCSfile$ +Language: C++ +Date: $Date$ +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 +* 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. +* ------------------------------------------------------------------------ */ + +/** +* \file +* \brief Class bbtk::GObjectController +*/ + + +#include "GObjectController.h" + +namespace bbtk +{ + + + //========================================================================= + GObjectController::GObjectController() + { + + } + + //========================================================================= + GObjectController::~GObjectController() + { + } + //========================================================================= + + void GObjectController::setModelAndView(GObjectModel* model, vtkGObjectView* view) + { + _model = model; + _view = view; + } + //========================================================================= + +} // EO namespace bbtk + +// EOF + diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.h b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.h new file mode 100644 index 0000000..aea9ab9 --- /dev/null +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.h @@ -0,0 +1,90 @@ +/*========================================================================= +Program: bbtk +Module: $RCSfile$ +Language: C++ +Date: $Date$ +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 +* 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. +* ------------------------------------------------------------------------ */ + + + +/** +* \file +* \brief Class bbtk::GObjectController : +*/ + +/** +* \class bbtk::GObjectController +* \brief +*/ + +#ifndef __GObjectController_h__ +#define __GObjectController_h__ + +//Includes same project +#include "GlobalConstants.h" +#include "GObjectModel.h" +#include "vtkGObjectView.h" + +//Includes creaMaracasVisu +#include + +//Includes std +#include + +namespace bbtk +{ + + class GObjectController : public InteractorStyleMaracas + { + + public: + + //Constructors + GObjectController(); + ~GObjectController(); + + //Public methods + + void setModelAndView(GObjectModel* model, vtkGObjectView* view); + + private: + + //Attributes + GObjectModel* _model; + vtkGObjectView* _view; + + + //Private Methods + + protected: + + }; + + +} +// namespace bbtk +#endif + diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectsMVCFactory.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectsMVCFactory.cxx new file mode 100644 index 0000000..a03ae69 --- /dev/null +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectsMVCFactory.cxx @@ -0,0 +1,116 @@ +/*========================================================================= +Program: bbtk +Module: $RCSfile$ +Language: C++ +Date: $Date$ +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 +* 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. +* ------------------------------------------------------------------------ */ + +/** +* \file +* \brief Class bbtk::GObjectsMVCFactory +*/ + + +#include "GObjectsMVCFactory.h" + +namespace bbtk +{ + + + //========================================================================= + + GObjectsMVCFactory* GObjectsMVCFactory:: instance = NULL; + GObjectsMVCFactory::GObjectsMVCFactory() + { + + } + + //========================================================================= + GObjectsMVCFactory::~GObjectsMVCFactory() + { + GObjectsMVCFactory::destroyInstance(); + } + //========================================================================= + + + GObjectsMVCFactory* GObjectsMVCFactory :: getInstance() + { + if(instance == NULL){ + instance = new GObjectsMVCFactory(); + } + return instance; + } + + //========================================================================= + + void GObjectsMVCFactory :: destroyInstance() + { + instance=NULL; + } + + //========================================================================= + + vtkGObjectView* GObjectsMVCFactory :: createGObjectView(int type) + { + vtkGObjectView* view = NULL; + if (type == GBLACKBOX) + { + view = new vtkGBlackBoxView(); + } + return view; + } + + //========================================================================= + + GObjectController* GObjectsMVCFactory :: createGObjectController(int type) + { + GObjectController *controller = NULL; + if (type == GBLACKBOX) + { + controller = new GBlackBoxController(); + } + return controller; + } + + //========================================================================= + + GObjectModel* GObjectsMVCFactory :: createGObjectModel(int type) + { + GObjectModel *model = NULL; + if (type == GBLACKBOX) + { + model = new GBlackBoxModel(); + } + return model; + } + + //========================================================================= + + +} // EO namespace bbtk + +// EOF + diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectsMVCFactory.h b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectsMVCFactory.h new file mode 100644 index 0000000..d02e18b --- /dev/null +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectsMVCFactory.h @@ -0,0 +1,96 @@ +/*========================================================================= +Program: bbtk +Module: $RCSfile$ +Language: C++ +Date: $Date$ +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 +* 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. +* ------------------------------------------------------------------------ */ + + + +/** +* \file +* \brief Class bbtk::GObjectsMVCFactory : abstract black-box interface. +*/ + +/** +* \class bbtk::GObjectsMVCFactory +* \brief +*/ + +#ifndef __GObjectsMVCFactory_h__ +#define __GObjectsMVCFactory_h__ + +//Includes same project +#include "GlobalConstants.h" +#include "GObjectController.h" +#include "GObjectModel.h" +#include "vtkGObjectView.h" + +#include "GBlackBoxController.h" +#include "vtkGBlackBoxView.h" +#include "GBlackBoxModel.h" + +//Includes creaMaracasVisu + +//Includes std +#include + +namespace bbtk +{ + + class GObjectsMVCFactory + { + + public: + + //Constructors + GObjectsMVCFactory(); + ~GObjectsMVCFactory(); + + //Public methods + static GObjectsMVCFactory* getInstance(); + static void destroyInstance(); + vtkGObjectView* createGObjectView(int type); + GObjectController* createGObjectController(int type); + GObjectModel* createGObjectModel(int type); + + private: + + //Attributes + static GObjectsMVCFactory* instance; + + //Private Methods + + + protected: + + }; + + +} +// namespace bbtk +#endif + diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.cxx new file mode 100644 index 0000000..1dc1d76 --- /dev/null +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.cxx @@ -0,0 +1,104 @@ +/*========================================================================= +Program: bbtk +Module: $RCSfile$ +Language: C++ +Date: $Date$ +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 +* 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. +* ------------------------------------------------------------------------ */ + +/** +* \file +* \brief Class bbtk::vtkGBlackBoxView +*/ + + +#include "vtkGBlackBoxView.h" + +namespace bbtk +{ + + + //========================================================================= + vtkGBlackBoxView::vtkGBlackBoxView() + { + } + + //========================================================================= + vtkGBlackBoxView::~vtkGBlackBoxView() + { + } + + //========================================================================= + void vtkGBlackBoxView::refresh() + { + //paint(); + } + + //========================================================================= + + void vtkGBlackBoxView::createVtkObjects() //virtual + { + vtkPoints *_pts = vtkPoints::New(); + vtkCellArray *lines = vtkCellArray::New(); + vtkPolyData *_pd = vtkPolyData::New(); + vtkPolyDataMapper* _bboxMapper=vtkPolyDataMapper::New(); + _objectActor=vtkActor::New(); + + _pts->SetNumberOfPoints(4); + + double xInic, yInic,zInic,xFin, yFin,zFin; + _model->getInicPoint(xInic,yInic,zInic); + _model->getFinalPoint(xFin, yFin,zFin); + cout<<"RaC ----------"<SetPoint(0, xInic, yInic, 0 ); + _pts->SetPoint(1, xInic, yFin, 0 ); + _pts->SetPoint(2, xFin, yFin, 0 ); + _pts->SetPoint(3, xFin, yInic, 0 ); + + lines->InsertNextCell(5); + lines->InsertCellPoint(0); + lines->InsertCellPoint(1); + lines->InsertCellPoint(2); + lines->InsertCellPoint(3); + lines->InsertCellPoint(0); + + _pd->SetPoints( _pts ); + _pd->SetLines( lines ); + + _bboxMapper->SetInput(_pd); + _objectActor->SetMapper(_bboxMapper); + + } + + //========================================================================= + + +} // EO namespace bbtk + +// EOF + diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.h b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.h new file mode 100644 index 0000000..35a8c51 --- /dev/null +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.h @@ -0,0 +1,100 @@ +/*========================================================================= +Program: bbtk +Module: $RCSfile$ +Language: C++ +Date: $Date$ +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 +* 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. +* ------------------------------------------------------------------------ */ + + + +/** +* \file +* \brief Class bbtk::vtkGBlackBoxView : abstract black-box interface. +*/ + +/** +* \class bbtk::vtkGBlackBoxView +* \brief +*/ + +#ifndef __vtkGBlackBoxView_h__ +#define __vtkGBlackBoxView_h__ + +//Includes same project +#include "GlobalConstants.h" +#include "vtkGObjectView.h" + +//Includes creaMaracasVisu +#include + +//Includes vtk +#include + +#include "vtkPolyDataMapper.h" +#include "vtkActor.h" + +#include "vtkRenderer.h" +#include "vtkCellArray.h" + + +//Includes std +#include + + +namespace bbtk +{ + + class vtkGBlackBoxView : public vtkGObjectView + { + + public: + + //Constructors + vtkGBlackBoxView(); + ~vtkGBlackBoxView(); + + //Public methods + + private: + + //Private Attributes + + //Private Methods + + protected: + + //Protected Attributes + + //Protected Methods + virtual void createVtkObjects(); + virtual void refresh(); + }; + + +} +// namespace bbtk +#endif + diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGObjectView.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGObjectView.cxx new file mode 100644 index 0000000..0f748b8 --- /dev/null +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGObjectView.cxx @@ -0,0 +1,103 @@ +/*========================================================================= +Program: bbtk +Module: $RCSfile$ +Language: C++ +Date: $Date$ +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 +* 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. +* ------------------------------------------------------------------------ */ + +/** +* \file +* \brief Class bbtk::vtkGObjectView +*/ + + +#include "vtkGObjectView.h" + +namespace bbtk +{ + + + //========================================================================= + vtkGObjectView::vtkGObjectView() + { + _renderer=NULL; + _objectActor=NULL; + } + + //========================================================================= + vtkGObjectView::~vtkGObjectView() + { + } + //========================================================================= + + void vtkGObjectView::refresh() + { + //paint(); + } + + //========================================================================= + + void vtkGObjectView::setModel(GObjectModel *model) + { + _model=model; + } + + //========================================================================= + + void vtkGObjectView::setRenderer(vtkRenderer* renderer) + { + _renderer=renderer; + } + + //========================================================================= + + void vtkGObjectView::initVtkObjects() + { + createVtkObjects(); + addVtkActors(); + } + + //========================================================================= + + void vtkGObjectView::createVtkObjects() //virtual + { + //virtual + } + + //========================================================================= + + void vtkGObjectView::addVtkActors()//virtual + { + _renderer->AddActor(_objectActor); + _renderer->Render(); + } + + //========================================================================= + +} // EO namespace bbtk + +// EOF + diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGObjectView.h b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGObjectView.h new file mode 100644 index 0000000..d314081 --- /dev/null +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGObjectView.h @@ -0,0 +1,106 @@ +/*========================================================================= +Program: bbtk +Module: $RCSfile$ +Language: C++ +Date: $Date$ +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 +* 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. +* ------------------------------------------------------------------------ */ + + + +/** +* \file +* \brief Class bbtk::vtkGObjectView : abstract black-box interface. +*/ + +/** +* \class bbtk::vtkGObjectView +* \brief +*/ + +#ifndef __vtkGObjectView_h__ +#define __vtkGObjectView_h__ + +//Includes same project +#include "GlobalConstants.h" +#include "GObjectModel.h" + +//Includes creaMaracasVisu +#include + +//Includes vtk +#include + +#include "vtkConeSource.h" +#include "vtkPolyDataMapper.h" +#include "vtkActor.h" + + +//Includes std +#include + + +namespace bbtk +{ + + class vtkGObjectView + { + + public: + + //Constructors + vtkGObjectView(); + ~vtkGObjectView(); + + //Public methods + void setModel(GObjectModel *model); + void setRenderer(vtkRenderer* renderer); + void initVtkObjects(); + + virtual void refresh(); + + private: + + //Private Attributes + + //Private Methods + + protected: + + //Protected Attributes + vtkRenderer *_renderer; + GObjectModel *_model; + vtkActor *_objectActor; + + //Protected Methods + virtual void createVtkObjects(); + virtual void addVtkActors(); + }; + + +} +// namespace bbtk +#endif + diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx index e5c437b..d6adae8 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx @@ -57,7 +57,7 @@ namespace bbtk //========================================================================= wxGEditorTabPanel::~wxGEditorTabPanel() { - delete _sceneManager; + _sceneManager->disconnectDrop(); } //========================================================================= @@ -76,10 +76,12 @@ namespace bbtk bool wxGEditorTabPanel::OnDropText(wxCoord x, wxCoord y, const wxString& data) { - _sceneManager->createGBlackBox(); + std::string packageName=""; + std::string boxName=""; + _sceneManager->createGBlackBox(x,y,packageName, boxName); cout<<"RaC DyD:"< #include #include +//Includes creaMaracasVisu #include +//Includes std #include -#include "wxVtkSceneManager.h" -#include "VTKGObjectsFactory.h" + namespace bbtk {