From: corredor <> Date: Thu, 24 May 2012 08:45:37 +0000 (+0000) Subject: Compilation problems corrections: X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=806f5f22eb6e0e3d33e9f5e63efc13bd16d616a7;p=bbtkGEditor.git Compilation problems corrections: - Classes wxBlackBoxEditionDialog and wxVtkSceneManager replaced with previous version (before riveros commit) - Addition of wxString parsing in setTabName (two lines) --- diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx index af24586..5b0be79 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx @@ -492,7 +492,7 @@ void wxGUIEditorGraphicBBS::OnUndo(wxCommandEvent& event) { { name =name.substr(0,name.length()-1); } - _tabsMgr->SetNameTabPanel(name); + _tabsMgr->SetNameTabPanel(wxString (name.c_str(), wxConvUTF8)); } GetToolBar()->EnableTool(ID_UNDO,disable); @@ -669,7 +669,7 @@ void wxGUIEditorGraphicBBS::SaveTempActualDiagram() std::string name = _tabsMgr->GetNameTabPanel(); if(name[name.length() - 1] != '*') name +="*"; - _tabsMgr->SetNameTabPanel(name); + _tabsMgr->SetNameTabPanel(wxString (name.c_str(), wxConvUTF8)); _tabsMgr->saveTempActualDiagram(); } diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxBlackBoxEditionDialog.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxBlackBoxEditionDialog.cxx index 053d0a6..d4663da 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxBlackBoxEditionDialog.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxBlackBoxEditionDialog.cxx @@ -8,35 +8,34 @@ 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. - * ------------------------------------------------------------------------ */ +* 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::wxBlackBoxEditionDialog . - */ +* \file +* \brief Class bbtk::wxBlackBoxEditionDialog . +*/ #include "wxBlackBoxEditionDialog.h" #include "creaWx.h" - namespace bbtk { //========================================================================= @@ -180,135 +179,13 @@ printf("EED wxBlackBoxEditionDialog::onClickClose\n"); Close(true); } + //========================================================================= - wxBlackBoxEditionDialog::wxBlackBoxEditionDialog( wxGUIEditorGraphicBBS *parent , GBlackBoxModel *model ) : wxDialog( parent , wxID_ANY , _T( "" ) , wxDefaultPosition , wxSize( 480 , 640 ) , wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ) { - _model = model ; - std::string title( "BlackBox Editing - " ) ; - title += _model->getBBTKPackage( ) ; - title += ":" ; - title += _model->getBBTKType( ) ; - title += ":" ; - title += _model->getBBTKName( ) ; - SetTitle( std2wx( title ) ) ; - - constructBlackBoxEditionDialog( ) ; - } - - //========================================================================= - - wxBlackBoxEditionDialog::~wxBlackBoxEditionDialog( ) { - - } - - //========================================================================= - - void wxBlackBoxEditionDialog::constructBlackBoxEditionDialog( ) { - wxBoxSizer *sizerDialog = new wxBoxSizer( wxVERTICAL ) ; - - wxScrolledWindow *scrollWin = new wxScrolledWindow( this , -1 , wxDefaultPosition , wxSize( 200 , 200 ) , wxVSCROLL ) ; - - wxStaticText *text = new wxStaticText( scrollWin , -1 , wxT( "Input Ports" ) ) ; - wxFont font( 11 , wxDEFAULT , wxNORMAL , wxBOLD ) ; - text->SetFont( font ) ; - - - - std::vector lstInputs = _model->getInputPorts( ) ; - wxFlexGridSizer *sizer = new wxFlexGridSizer( lstInputs.size( ) , 3 , 5 , 5 ) ; - for ( int i = 0 ; i < ( int ) lstInputs.size( ) ; i++ ) { - GPortModel* port = lstInputs[i] ; - std::string type = port->getBBTKType( ) ; - wxStaticText *lblName = new wxStaticText( scrollWin , -1 , std2wx( port->getBBTKName( ) ) , wxDefaultPosition , wxSize( 100 , 25 ) ) ; - wxStaticText *lblType = new wxStaticText( scrollWin , -1 , std2wx( type ) , wxDefaultPosition , wxSize( 250 , 25 ) ) ; - wxTextCtrl *txtValue = new wxTextCtrl( scrollWin , -1 , _T( "" ) , wxDefaultPosition , wxSize( 90 , 25 ) ) ; - - if ( port->getValue( ) != "" ) { - txtValue->SetValue( crea::std2wx( port->getValue( ) ) ) ; - } - - if ( port->isConnected( ) ) { - std::string connected( "--CAN'T TOUCH THIS--" ) ; - txtValue->SetValue( crea::std2wx( connected ) ) ; - txtValue->SetEditable( false ) ; - } - - char et = '*' ; - if ( type.find( et ) != -1 ) { - std::string noEditable( "--CAN'T TOUCH THIS--" ) ; - txtValue->SetValue( crea::std2wx( noEditable ) ) ; - txtValue->SetEditable( false ) ; - } - - _lstNames.push_back( lblName ) ; - _lstValues.push_back( txtValue ) ; - _lstTypes.push_back( lblType ) ; - - sizer->Add( lblName , 1 , wxEXPAND , 5 ) ; - sizer->Add( txtValue , 1 , wxEXPAND , 5 ) ; - sizer->Add( lblType , 1 , wxCENTRE | wxEXPAND , 5 ) ; - } - - - wxBoxSizer *buts = new wxBoxSizer( wxHORIZONTAL ) ; - wxButton *okButton = new wxButton( scrollWin , -1 , _T( "OK" ) , wxDefaultPosition , wxSize( 70 , 30 ) ) ; - wxButton *closeButton = new wxButton( scrollWin , -1 , _T( "CLOSE" ) , wxDefaultPosition , wxSize( 70 , 30 ) ) ; - - // connect command event handlers - Connect( okButton->GetId( ) , wxEVT_COMMAND_BUTTON_CLICKED , wxCommandEventHandler( wxBlackBoxEditionDialog::onClickOk ) ) ; - Connect( closeButton->GetId( ) , wxEVT_COMMAND_BUTTON_CLICKED , wxCommandEventHandler( wxBlackBoxEditionDialog::onClickClose ) ) ; - - buts->Add( okButton , 0 , wxCENTRE | wxEXPAND , 5 ) ; - buts->Add( closeButton , 0 , wxCENTRE | wxEXPAND , 5 ) ; - - sizerDialog->AddSpacer( 10 ) ; - sizerDialog->Add( text , 0 , wxALIGN_TOP | wxALIGN_CENTER ) ; - sizerDialog->AddSpacer( 15 ) ; - sizerDialog->Add( sizer , 0 , wxALIGN_CENTER ) ; - sizerDialog->AddSpacer( 15 ) ; - sizerDialog->Add( buts , 0 , wxALIGN_CENTER | wxTOP | wxBOTTOM ) ; - - scrollWin->SetSizer( sizerDialog ) ; - scrollWin->Centre( ) ; - - - scrollWin->SetVirtualSize( 400 , 400 ) ; - scrollWin->SetSize( 300 , 300 ) ; - scrollWin->SetScrollbars( 10 , 10 , 50 , 50 ) ; - // scrollWin->SetSizer(sizer); - - - ShowModal( ) ; - Destroy( ) ; - } - - //========================================================================= - - void wxBlackBoxEditionDialog::onClickOk( wxCommandEvent& event ) { - for ( int i = 0 ; i < ( int ) _lstValues.size( ) ; i++ ) { - std::string text = wx2std( _lstValues[i]->GetValue( ) ) ; - //TOFIX Search a better alternative - if ( text != "--No editable--" && text != "--Port Connected--" ) { - _model->setValueToInputPort( i , text ) ; - } - } - - Close( true ) ; - } - - //========================================================================= - - void wxBlackBoxEditionDialog::onClickClose( wxCommandEvent& event ) { - printf( "EED wxBlackBoxEditionDialog::onClickClose JGRR AND CM WERE HERE!!!\n" ) ; - Close( true ) ; - } - - //========================================================================= - -} // EO namespace bbtk +} // EO namespace bbtk // EOF /* // remove * from the name std::string name = _tabsMgr->GetNameTabPanel(); if(name[name.length() - 1] != '*') name = name.substr(0, name.length()-2); - _tabsMgr->SetNameTabPanel(name);*/ + _tabsMgr->SetNameTabPanel(name);*/ \ No newline at end of file diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxBlackBoxEditionDialog.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxBlackBoxEditionDialog.h index 77801df..be859b6 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxBlackBoxEditionDialog.h +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxBlackBoxEditionDialog.h @@ -8,38 +8,38 @@ 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. - * ------------------------------------------------------------------------ */ +* 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::wxBlackBoxEditionDialog : abstract black-box interface. - */ +* \file +* \brief Class bbtk::wxBlackBoxEditionDialog : abstract black-box interface. +*/ /**** - * Design and Developpement of BBTK GEditor - * Ricardo A Corredor J - * RaC - 2010 - ****/ +* Design and Developpement of BBTK GEditor +* Ricardo A Corredor J +* RaC - 2010 +****/ #ifndef __wxBlackBoxEditionDialog_h__ #define __wxBlackBoxEditionDialog_h__ @@ -59,9 +59,9 @@ Version: $Revision$ #include - namespace bbtk { + //RaC: It is important if it exists a double relation //e.g. wxBlackBoxEditionDialog includes wxGUIEditorGraphicBBS, and wxGUIEditorGraphicBBS includes wxBlackBoxEditionDialog class wxGUIEditorGraphicBBS; @@ -90,29 +90,7 @@ namespace bbtk protected: - class wxBlackBoxEditionDialog : public wxDialog { - public: - wxBlackBoxEditionDialog( wxGUIEditorGraphicBBS *parent, GBlackBoxModel *model ); - ~ wxBlackBoxEditionDialog( ); - - void constructBlackBoxEditionDialog( ); - - void onClickOk( wxCommandEvent& event ); - void onClickClose( wxCommandEvent& event ); - - private: - wxAuiManager *_dialogAUIMgr; - wxPanel *_panel; - - std::vector _lstValues; - std::vector _lstTypes; - std::vector _lstNames; - - GBlackBoxModel *_model; - - protected: - - }; + }; } diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx index b27c724..ab0ef4e 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx @@ -35,14 +35,11 @@ #include "wxVtkSceneManager.h" - #include #include - namespace bbtk { -cvs //========================================================================= wxVtkSceneManager::wxVtkSceneManager(wxGEditorTabPanel *parent, wxVtk3DBaseView *baseView, int idManager) { @@ -62,13 +59,11 @@ wxVtkSceneManager::wxVtkSceneManager(wxGEditorTabPanel *parent, if (_baseView != NULL) { //EED02JUIN2010 printf( - "RaC-EED 21-06-2010 %p wxVtkSceneManager::wxVtkSceneManager If you comment this line, the drag and drop functionnality is not initialized.\n", this); - - #ifdef __APPLE__ - + "RaC-EED 21-06-2010 %p wxVtkSceneManager::wxVtkSceneManager If you comment this line, the drag and drop functionnality is not initialized.\n", + this); +#ifdef __APPLE__ _baseView->GetWxVTKRenderWindowInteractor()->SetDropTarget((wxDropTarget*)parent); - - #endif +#endif configureBaseView(); _worldState = NOTHING_HAPPENS; @@ -535,17 +530,7 @@ int wxVtkSceneManager::createGConnector(GPortModel* startPort) { manContourView->SetColorNormalContour(0, 0, 1); manContourView->SetColorEditContour(0.5, 0.5, 0.5); manContourView->SetColorSelectContour(1, 0.8, 0); - - - /** - * JGRR AND CM - * Width increased from 2 to 5, it simplifies line handling and spline control :P - * @param WidthLine - */ - - manContourView->SetWidthLine( 5 ) ; - - + manContourView->SetWidthLine(1); manContourView->SetShowText(false); manContourControl->SetModelView(manContourModel, manContourView); @@ -663,41 +648,6 @@ void wxVtkSceneManager::update(int idController, int command) { _selectedObjects.erase(_selectedObjects.begin() + index); } } else if (command == INIT_CREATION_CONTOUR) { - - - // JGRR & CM WH - typedef std::map::iterator TIterator ; - TIterator iter ; - TIterator iter_end ; - // Find current item in the controller - iter = _controllers.find( idController ) ; - iter_end = _controllers.end( ) ; - // If item exist - if ( iter != iter_end ) { - GObjectController* gobjc = iter->second ; - - std::string bbtkType = gobjc->getModel( )->getBBTKType( ) ; - // And if the item is a port - if ( gobjc->getModel( )->getGObjectType( ) == GPORT ) { - TIterator c_it = _controllers.begin( ) ; - // Go through all componets - for ( c_it ; c_it != iter_end ; c_it++ ) { - GObjectController* obc = c_it->second ; - int obc_type = obc->getModel( )->getGObjectType( ) ; - std::string obc_bbtkType = obc->getModel( )->getBBTKType( ) ; - // if the component is a port and the type is the same of that selected - if ( ( obc_type == GPORT ) && ( obc_bbtkType == bbtkType ) ) { - // Highliht element - obc->getView( )->setState( POSSIBLE_CONNECTION ) ; - //obc->getView( )->setState( HIGHLIGHTED ) ; - } - } - } - } - - // EO JGRR & CM WH - - _worldState = INIT_CREATION_CONTOUR; GObjectController* cont = _controllers[idController]; GPortModel* startOutputPort = (GPortModel*) cont->getModel(); @@ -735,31 +685,6 @@ void wxVtkSceneManager::update(int idController, int command) { if (finPort->getGObjectType() == GPORT) { GPortModel* modelPort = (GPortModel*) finPort->getModel(); modelContour->setEndPort(modelPort); - - - // JGRR CM - typedef std::map::iterator TIterator ; - TIterator c_it = _controllers.begin( ) ; - TIterator iter_end = _controllers.end( ) ; - // Go through all componets - for ( c_it ; c_it != iter_end ; c_it++ ) { - GObjectController* obc = c_it->second ; - int obc_type = obc->getModel( )->getGObjectType( ) ; - int obc_state = obc->getView( )->getState( ) ; - // if the component is a port and the type is the same of that selected - if ( ( obc_type == GPORT ) && ( obc_state == POSSIBLE_CONNECTION )) { - // Return element to neutral state if not selected - obc->getView( )->setState( NOTHING_HAPPENS ) ; - } - if ( ( obc_type == GPORT ) && (obc_state == SELECTED_POSSIBLE_CONNECTION )) { - // Change element to connected state - obc->getView( )->setState( HIGHLIGHTED ) ; - - } - - } - // EO JGRR CM - _parent->saveTempDiagram(); } @@ -888,14 +813,6 @@ bool wxVtkSceneManager::OnLeftButtonDown() { && portView->getState() == HIGHLIGHTED) { isOverPort = true; } // if - - // JGRR & CM - if ( portmod->getPortType( ) == GINPUTPORT && portView->getState( ) == SELECTED_POSSIBLE_CONNECTION ) { - isOverPort = true ; - portView->setState( HIGHLIGHTED); - } - // EO JGRR & CM - } // if } // for @@ -2029,6 +1946,7 @@ void wxVtkSceneManager::loadDiagram(stringstream &inputStream) { std::string value(result); bbmod->setValueToInput(name, value); + getline(inputStream, line);//PORT o FIN_BOX port = line.substr(0, 4); } // while @@ -2638,7 +2556,6 @@ void wxVtkSceneManager::SetCbPackageName(std::string packagename) { } } - //========================================================================= std::string wxVtkSceneManager::GetCbPackageName() { return _cbPackageName; @@ -2678,67 +2595,15 @@ void wxVtkSceneManager::SetDescription(std::string description) { } } - //========================================================================= std::string wxVtkSceneManager::GetDescription() { return _Description; } //========================================================================= -// JGRR & CM -void wxVtkSceneManager::printAll(int com , int sta ){ - - int tmpState = sta ; - if ( tmpState == NOTHING_HAPPENS ) { - std::cout << "CONTROLER STATE---->NOTHING_HAPPENS\n" ; - } - if ( tmpState == HIGHLIGHTED ) { - std::cout << "CONTROLER STATE---->HIGHLIGHTED\n" ; - } - if ( tmpState == POSSIBLE_CONNECTION ) { - std::cout << "CONTROLER STATE---->POSSIBLE_CONNECTION\n" ; - } - if ( tmpState == SELECTED_POSSIBLE_CONNECTION ) { - std::cout << "CONTROLER STATE---->SELECTED_POSSIBLE_CONNECTION\n" ; - } - if ( tmpState == CLICKED ) { - std::cout << "CONTROLER STATE---->CLICKED\n" ; - } - if ( tmpState == DRAG ) { - std::cout << "CONTROLER STATE---->DRAG\n" ; - } - if ( tmpState == SELECTED ) { - std::cout << "CONTROLER STATE---->SELECTED\n" ; - } - if ( tmpState == CREATING_CONTOUR ) { - std::cout << "CONTROLER STATE---->CREATING_CONTOUR\n" ; - } - - // :P - - int command = com ; - if ( command == INIT_CREATION_CONTOUR ) { - std::cout << "COMMAND ----> INIT_CREATION_CONTOUR \n" ; - } - if ( command == FIN_CREATION_CONTOUR ) { - std::cout << "COMMAND ----> FIN_CREATION_CONTOUR \n" ; - } - if ( command == ADD_TO_SELECTED ) { - std::cout << "COMMAND ----> ADD_TO_SELECTED \n" ; - } - if ( command == DRAG_OBJECTS ) { - std::cout << "COMMAND ----> DRAG_OBJECTS \n" ; - } - if ( command == EDIT_BLACKBOX ) { - std::cout << "COMMAND ----> EDIT_BLACKBOX \n" ; - } - if ( command == REMOVE_FROM_SELECTED ) { - std::cout << "COMMAND ----> REMOVE_FROM_SELECTED \n" ; - } - - } } // EO namespace bbtk -// EOF +// EOF + diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.h index fadb8ba..fe5889c 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.h +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.h @@ -8,38 +8,38 @@ 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. - * ------------------------------------------------------------------------ */ +* 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::BlackBox : abstract black-box interface. - */ +* \file +* \brief Class bbtk::BlackBox : abstract black-box interface. +*/ /**** - * Design and Developpement of BBTK GEditor - * Ricardo A Corredor J - * RaC - 2010 - ****/ +* Design and Developpement of BBTK GEditor +* Ricardo A Corredor J +* RaC - 2010 +****/ #ifndef __wxVtkSceneManager_h__ #define __wxVtkSceneManager_h__ @@ -77,7 +77,7 @@ Version: $Revision$ #include #include #include -#include + #include //Includes std @@ -86,7 +86,6 @@ Version: $Revision$ #include #include - namespace bbtk { class wxGEditorTabPanel; @@ -128,78 +127,6 @@ namespace bbtk void configGComBoxInputOutputPort(bool inputoutput, std::string inputPortName, double xIn, double yIn,double zIn); GBoxModel* findGBox(std::string boxname); - class wxVtkSceneManager : public InteractorStyleMaracas, public Observer { - public: - - wxVtkSceneManager( wxGEditorTabPanel *parent, wxVtk3DBaseView *baseView, int idManager ); - ~ wxVtkSceneManager( ); - void disconnectDrop( ); - - //------- - void configureBaseView( ); - void registerController( InteractorStyleMaracas *param ); - void unregisterController( InteractorStyleMaracas *param ); - - virtual bool OnChar( ); - virtual bool OnMouseMove( ); - virtual bool OnLeftButtonDown( ); - virtual bool OnLeftButtonUp( ); - 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 ); - - 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( ); - - virtual void update( int idController, int command ); - - void refresh( ); - 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( bool wln = false ); vtkRenderWindow* getRenderWindow(); @@ -246,97 +173,96 @@ namespace bbtk //Returns a string with the BBS script of the current diagram. std::string getDiagramBBS(bool wln=false); + //Returns a string with the BBS script of the complex box. + std::string saveComplexBoxBBS(); - void AddControlerToBeRemove( std::vector *controllersToRemove, int id ); - - //Clear list of controllers and refresh - void deleteAllBoxes( ); + //Delete the object in the list of controllers with the id given by parameter. + void deleteObject(int id); - //Save the diagram in the BBG format, in the string given by param. - void saveDiagram( std::string &content ); + void AddControlerToBeRemove(std::vector *controllersToRemove, int id); - //Load the diagram - void loadDiagram( ifstream &inputStream ); + //Clear list of controllers and refresh + void deleteAllBoxes(); - //Center the view of the camera in the initial position - void centerView( ); + //Save the diagram in the BBG format, in the string given by param. + void saveDiagram(std::string &content); //Load the diagram void loadDiagram(std::stringstream &inputStream); + //Center the view of the camera in the initial position + void centerView(); - 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 ); - - std::string GetCbName( ); - std::string GetCbPackageName( ); - std::string GetAuthor( ); - std::string GetCategory( ); - std::string GetDescription( ); - - + bool boxExist(std::string boxname); + std::string generateANewNameForABox(); + std::string findANewNameForABox(); + //------- - // JGRR & CM - void printAll( int com, int sta ); + 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); - + std::string GetCbName(); + std::string GetCbPackageName(); + std::string GetAuthor(); + std::string GetCategory(); + std::string GetDescription(); - private: + private: - std::string _cbName; - std::string _cbPackageName; - std::string _Author; - std::string _Category; - std::string _Description; + std::string _cbName; + std::string _cbPackageName; + std::string _Author; + std::string _Category; + std::string _Description; - //wxPanel that uses the manager - wxGEditorTabPanel *_parent; + //wxPanel that uses the manager + wxGEditorTabPanel *_parent; - // Id of the manager, the same of the panel - int _idManager; + // Id of the manager, the same of the panel + int _idManager; - // Boxes number in the scene - int _numBoxes; + // Boxes number in the scene + int _numBoxes; - // StartDragging - bool _startDragging; + // StartDragging + bool _startDragging; - // creaMaracasVisu viewer - wxVtk3DBaseView *_baseView; + // creaMaracasVisu viewer + wxVtk3DBaseView *_baseView; - // State of the 3D Scene or the virtual world - int _worldState; + // State of the 3D Scene or the virtual world + int _worldState; - //Map of id - objectController - std::map _controllers; + //Map of id - objectController + std::map _controllers; - //Saves the id's of the selected objects in the controllers map - std::vector _selectedObjects; + //Saves the id's of the selected objects in the controllers map + std::vector _selectedObjects; - //Is the diagram in state complex box - bool _isComplexBox; + //Is the diagram in state complex box + bool _isComplexBox; - int _idConnectionInCreation; + int _idConnectionInCreation; - int _contLastId; + int _contLastId; - vtkTextActor3D *_textActor; - vtkPoints *_pts; - vtkActor *_fillObjectActor; - vtkDataSetMapper *_aPolygonMapper; + vtkTextActor3D *_textActor; + vtkPoints *_pts; + vtkActor *_fillObjectActor; + vtkDataSetMapper *_aPolygonMapper; - std::string LineNumber( bool withLineNumber, int &value ); - int GetIndexInSelected( int idControler ); - void UnSelectBlackBoxes( ); - GObjectController *GetGBlackBoxControlerPointedByMouse( ); - void CancelConnection( ); + std::string LineNumber(bool withLineNumber, int &value); + int GetIndexInSelected(int idControler); + void UnSelectBlackBoxes(); + GObjectController *GetGBlackBoxControlerPointedByMouse(); + void CancelConnection(); - protected: + protected: - }; + }; }