From 0dfaa8eefbfad1092161af92ba548f1172ed6652 Mon Sep 17 00:00:00 2001 From: riveros <> Date: Wed, 23 May 2012 15:57:13 +0000 Subject: [PATCH] Feature #1366 Increased the line width of bbEditor connections. --- .../bbsKernelEditorGraphic/GObjectModel.h | 175 ++++---- .../bbsKernelEditorGraphic/GPortModel.cxx | 302 +++++++------- .../bbsKernelEditorGraphic/GlobalConstants.h | 55 +-- .../GObjectController.cxx | 262 ++++++------ .../GObjectController.h | 123 +++--- .../vtkGComplexBoxPortView.cxx | 390 +++++++++--------- .../bbsVtkGUIEditorGraphic/vtkGPortView.cxx | 219 +++++----- .../bbsVtkGUIEditorGraphic/vtkGPortView.h | 8 +- .../bbtkwxGUIEditorGraphicBBS.h | 3 +- .../wxBlackBoxEditionDialog.cxx | 173 ++++++-- .../wxBlackBoxEditionDialog.h | 78 ++-- .../wxVtkSceneManager.cxx | 31 +- .../bbsWxGUIEditorGraphic/wxVtkSceneManager.h | 252 +++++++---- 13 files changed, 1133 insertions(+), 938 deletions(-) diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.h b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.h index bfebe6b..a5efed1 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.h +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.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::GObjectModel : abstract black-box interface. -*/ + * \file + * \brief Class bbtk::GObjectModel : 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 __GObjectModel_h__ #define __GObjectModel_h__ @@ -56,89 +56,86 @@ Version: $Revision$ //Includes bbtk #include -namespace bbtk -{ +namespace bbtk { - class GObjectModel : public Observable - { + class GObjectModel : public Observable { + public: - public: + //Constructors + GObjectModel( ); + ~ GObjectModel( ); - //Constructors - GObjectModel(); - ~GObjectModel(); - - //Public methods - - // Method to get the values of Inic or Final point passed as references in the parameters - void getInicPoint(double& x, double& y, double& z); - void getFinalPoint(double& x, double& y, double& z); + //Public methods - // Returns the center of the enclosing rectangle - void getCenter(double& x, double& y, double& z); + // Method to get the values of Inic or Final point passed as references in the parameters + void getInicPoint( double& x, double& y, double& z ); + void getFinalPoint( double& x, double& y, double& z ); - // Method to set the values of Inic or Final point - virtual void setInicPoint(double& x, double& y, double& z); - virtual void setFinalPoint(double& x, double& y, double& z); - - // Changes the inic(top-left point) point of the rectangle - virtual void move(double xx,double yy,double zz); + // Returns the center of the enclosing rectangle + void getCenter( double& x, double& y, double& z ); - // Returns true if (x,y,z) is inside the rectangle - virtual bool isPointInside(double x,double y, double z); + // Method to set the values of Inic or Final point + virtual void setInicPoint( double& x, double& y, double& z ); + virtual void setFinalPoint( double& x, double& y, double& z ); - // Get the type of the graphical objects (See the GlobalConstants.h file) - int getGObjectType(); - void setGObjectType(int obtype); + // Changes the inic(top-left point) point of the rectangle + virtual void move( double xx, double yy, double zz ); - // The type in BBTK, for boxes for example in a BBS line like (new LoadHola abcd), LoadHola is the type - std::string getBBTKType(); - void setBBTKType(std::string obtype); + // Returns true if (x,y,z) is inside the rectangle + virtual bool isPointInside( double x, double y, double z ); - // The name in BBTK, for boxes for example in a BBS line like (new LoadHola abcd), abcd is the name - std::string getBBTKName(); - void setBBTKName(std::string obname); + // Get the type of the graphical objects (See the GlobalConstants.h file) + int getGObjectType( ); + void setGObjectType( int obtype ); - // Object ID - int getObjectId(); - void setObjectId(int id); + // The type in BBTK, for boxes for example in a BBS line like (new LoadHola abcd), LoadHola is the type + std::string getBBTKType( ); + void setBBTKType( std::string obtype ); - // Status bar message - virtual std::string getStatusText(); + // The name in BBTK, for boxes for example in a BBS line like (new LoadHola abcd), abcd is the name + std::string getBBTKName( ); + void setBBTKName( std::string obname ); - virtual void save(std::string &content); - - private: + // Object ID + int getObjectId( ); + void setObjectId( int id ); - //Private Attributes + // Status bar message + virtual std::string getStatusText( ); - //Private Methods + virtual void save( std::string &content ); - protected: - - //Protected Attributes - - double _xInic; - double _yInic; - double _zInic; - double _xFin; - double _yFin; - double _zFin; + private: - int _objectId; + //Private Attributes - // The type of the graphical objects (See the GlobalConstants.h file) - int _gObjectType; + //Private Methods - // The type in BBTK, for boxes for example in a BBS line like (new LoadHola abcd), LoadHola is the type - std::string _bbtkType; + protected: - // The name in BBTK, for boxes for example in a BBS line like (new LoadHola abcd), abcd is the name - std::string _bbtkName; + //Protected Attributes - //Protected methods - - }; + double _xInic; + double _yInic; + double _zInic; + double _xFin; + double _yFin; + double _zFin; + + int _objectId; + + // The type of the graphical objects (See the GlobalConstants.h file) + int _gObjectType; + + // The type in BBTK, for boxes for example in a BBS line like (new LoadHola abcd), LoadHola is the type + std::string _bbtkType; + + // The name in BBTK, for boxes for example in a BBS line like (new LoadHola abcd), abcd is the name + std::string _bbtkName; + + //Protected methods + + }; } diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.cxx b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.cxx index eebe523..def04b1 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.cxx +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.cxx @@ -8,200 +8,180 @@ 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::GPortModel -*/ + * \file + * \brief Class bbtk::GPortModel + */ /**** -* Design and Developpement of BBTK GEditor -* Ricardo A Corredor J -* RaC - 2010 -****/ + * Design and Developpement of BBTK GEditor + * Ricardo A Corredor J + * RaC - 2010 + ****/ #include "GPortModel.h" -namespace bbtk -{ +namespace bbtk { - //========================================================================= - GPortModel::GPortModel() - { - _parentBox = NULL; - _portType=-1; - _posInBox=0; - _isConnected=false; - _value=""; - _isValueSet=false; - } + //========================================================================= - //========================================================================= - GPortModel::~GPortModel() - { - } - //========================================================================= + GPortModel::GPortModel( ) { + _parentBox = NULL ; + _portType = -1 ; + _posInBox = 0 ; + _isConnected = false ; + _value = "" ; + _isValueSet = false ; + } - void GPortModel::registerInBox(GBoxModel *blackBox,int portType, int pos) - { - _parentBox = blackBox; - _portType = portType; - _posInBox = pos; - - updatePortPosition(); - - } - - //========================================================================= - - void GPortModel::updatePortPosition() - { - double xInic, yInic,zInic,xFin,yFin,zFin; - _parentBox->getInicPoint(xInic,yInic,zInic); - _parentBox->getFinalPoint(xFin, yFin,zFin); - - double posX=xInic,posY=yInic,posZ=zInic; - if(_portType==GOUTPUTPORT) - { - posY = yFin; - } - else if(_portType==GINPUTPORT) - { - posY = yInic+PORT_HEIGHT; - } + //========================================================================= - //Attribute '_posInBox' starts with value 0 and it represents the position of the port in the box from left to right - posX = xInic + (PORT_WIDTH/2) + _posInBox*1.1*PORT_WIDTH; + GPortModel::~GPortModel( ) { + } + //========================================================================= - setInicPoint(posX,posY,posZ); + void GPortModel::registerInBox( GBoxModel *blackBox , int portType , int pos ) { + _parentBox = blackBox ; + _portType = portType ; + _posInBox = pos ; - posX=posX+PORT_WIDTH; - posY=posY-PORT_HEIGHT; - - setFinalPoint(posX,posY,posZ); - - } + updatePortPosition( ) ; - //========================================================================= + } - int GPortModel::getPortType() - { - return _portType; - } + //========================================================================= - //========================================================================= + void GPortModel::updatePortPosition( ) { + double xInic , yInic , zInic , xFin , yFin , zFin ; + _parentBox->getInicPoint( xInic , yInic , zInic ) ; + _parentBox->getFinalPoint( xFin , yFin , zFin ) ; - int GPortModel::getPosInBox() - { - return _posInBox; - } + double posX = xInic , posY = yInic , posZ = zInic ; + if ( _portType == GOUTPUTPORT ) { + posY = yFin ; + } else if ( _portType == GINPUTPORT ) { + posY = yInic + PORT_HEIGHT ; + } - //========================================================================= + //Attribute '_posInBox' starts with value 0 and it represents the position of the port in the box from left to right + posX = xInic + ( PORT_WIDTH / 2 ) + _posInBox * 1.1 * PORT_WIDTH ; - std::string GPortModel::getStatusText() - { - std::string temp = ""; + setInicPoint( posX , posY , posZ ) ; - temp+=_bbtkName; - if(isValueSet()) - { - temp+="("; - temp+=_value; - temp+=")"; - } - temp+=" "; - temp+=_bbtkType; + posX = posX + PORT_WIDTH ; + posY = posY - PORT_HEIGHT ; - return temp; - } + setFinalPoint( posX , posY , posZ ) ; - //========================================================================= + } - GBoxModel* GPortModel::getParentBox() - { - return _parentBox; - } - - //========================================================================= - - bool GPortModel::isConnected() - { - return _isConnected; - } - - //========================================================================= - - void GPortModel::setConnected(bool value) - { - _isConnected=value; - notifyObservers(_objectId); - } + //========================================================================= - //========================================================================= + int GPortModel::getPortType( ) { + return _portType ; + } - void GPortModel::setValue(std::string value) - { - _value = value; - if(_value=="") - { - _isValueSet=false; - } - else - { - _isValueSet=true; - } - notifyObservers(_objectId); - } + //========================================================================= - //========================================================================= - - std::string GPortModel::getValue() - { - return _value; - } + int GPortModel::getPosInBox( ) { + return _posInBox ; + } - //========================================================================= + //========================================================================= - bool GPortModel::isValueSet() - { - return _isValueSet; - } + std::string GPortModel::getStatusText( ) { + std::string temp = "" ; - //========================================================================= + temp += _bbtkName ; + if ( isValueSet( ) ) { + temp += "(" ; + temp += _value ; + temp += ")" ; + } + temp += " " ; + temp += _bbtkType ; - void GPortModel::save(std::string &content) - { - content+="PORT\n"; + return temp ; + } - // Port value info - content+=_bbtkName; - content+=":"; - content+=_value; - content+="\n"; - } + //========================================================================= - //========================================================================= + GBoxModel* GPortModel::getParentBox( ) { + return _parentBox ; + } -} // EO namespace bbtk + //========================================================================= + + bool GPortModel::isConnected( ) { + return _isConnected ; + } + + //========================================================================= + + void GPortModel::setConnected( bool value ) { + _isConnected = value ; + notifyObservers( _objectId ) ; + } + + //========================================================================= + + void GPortModel::setValue( std::string value ) { + _value = value ; + if ( _value == "" ) { + _isValueSet = false ; + } else { + _isValueSet = true ; + } + notifyObservers( _objectId ) ; + } + + //========================================================================= + + std::string GPortModel::getValue( ) { + return _value ; + } + + //========================================================================= + + bool GPortModel::isValueSet( ) { + return _isValueSet ; + } + + //========================================================================= + + void GPortModel::save( std::string &content ) { + content += "PORT\n" ; + + // Port value info + content += _bbtkName ; + content += ":" ; + content += _value ; + content += "\n" ; + } + + //========================================================================= + +} // EO namespace bbtk // EOF diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h index 4fc8597..d9c3742 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h @@ -8,38 +8,37 @@ 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. + * ------------------------------------------------------------------------ */ /**** -* 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 __GlobalConstants_h__ #define __GlobalConstants_h__ -namespace bbtk -{ +namespace bbtk { // Object types const int GBLACKBOX = 1; @@ -51,6 +50,12 @@ namespace bbtk const int GCOMPLEXOUTPUTPORT = 7; // Object states + + // JGRR + const int POSSIBLE_CONNECTION = 107; + const int SELECTED_POSSIBLE_CONNECTION = 108; + // EO JGRR + const int NOTHING_HAPPENS = 101; const int HIGHLIGHTED = 102; const int CLICKED = 103; diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx index 745cbf2..06958b6 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx @@ -8,189 +8,189 @@ 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::GObjectController -*/ + * \file + * \brief Class bbtk::GObjectController + */ #include "GObjectController.h" + #ifdef _DEBUG #define new DEBUG_NEW #endif namespace bbtk { + //========================================================================= + + GObjectController::GObjectController( ) { + + } + + //========================================================================= + + GObjectController::~GObjectController( ) { + } + //========================================================================= - //========================================================================= - GObjectController::GObjectController() - { + void GObjectController::setModelAndView( GObjectModel* model , vtkGObjectView* view ) { + _model = model ; + _view = view ; + } - } + //========================================================================= - //========================================================================= + bool GObjectController::OnMouseMove( ) { + int X , Y ; + wxVTKRenderWindowInteractor *_wxVTKiren ; + _wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView( )->GetWxVTKRenderWindowInteractor( ) ; + _wxVTKiren->GetEventPosition( X , Y ) ; + int state = _view->getState( ) ; - GObjectController::~GObjectController() - { - } - //========================================================================= + //Evaluate new state + if ( state == NOTHING_HAPPENS ) { + if ( _view->isPointInside( X , Y ) ) { + _view->setState( HIGHLIGHTED ) ; + } + } + if ( state == HIGHLIGHTED ) { + if ( !_view->isPointInside( X , Y ) ) { + _view->setState( NOTHING_HAPPENS ) ; + } + } - void GObjectController::setModelAndView(GObjectModel* model, vtkGObjectView* view) - { - _model = model; - _view = view; - } + // JGRR & CM WH - //========================================================================= + if ( state == POSSIBLE_CONNECTION ) { + if ( _view->isPointInside( X , Y ) ) { + _view->setState( SELECTED_POSSIBLE_CONNECTION ) ; + } + } - bool GObjectController::OnMouseMove() - { - int X,Y; - wxVTKRenderWindowInteractor *_wxVTKiren; - _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); - _wxVTKiren->GetEventPosition( X , Y ); - int state = _view->getState(); + if ( state == SELECTED_POSSIBLE_CONNECTION ) { + if ( !_view->isPointInside( X , Y ) ) { + _view->setState( POSSIBLE_CONNECTION ) ; + } + } - //Evaluate new state - if( state == NOTHING_HAPPENS) - { - if(_view->isPointInside(X,Y)) - { - _view->setState(HIGHLIGHTED); - } - } - if( state==HIGHLIGHTED) - { - if(!_view->isPointInside(X,Y)) - { - _view->setState(NOTHING_HAPPENS); - } - } + // EO JGRR & CM WH - //_model->notifyObservers(getId()); + _model->notifyObservers( getId( ) ) ; - return true; - } + return true ; + } - //========================================================================= + //========================================================================= - bool GObjectController::OnLeftButtonDown()//virtual - { - int state = _view->getState(); + bool GObjectController::OnLeftButtonDown( )//virtual + { + int state = _view->getState( ) ; - //Evaluate new state - if(state == HIGHLIGHTED) - { - _isLeftClickDown=true; - _view->setState(SELECTED); - } - return true; - } + //Evaluate new state + if ( state == HIGHLIGHTED ) { + _isLeftClickDown = true ; + _view->setState( SELECTED ) ; + } + return true ; + } - //========================================================================= + //========================================================================= - bool GObjectController::OnLeftButtonUp()//virtual - { - return true; - } + bool GObjectController::OnLeftButtonUp( )//virtual + { + return true ; + } - //========================================================================= + //========================================================================= - bool GObjectController::OnLeftDClick()//virtual - { + bool GObjectController::OnLeftDClick( )//virtual + { - return true; - } + return true ; + } - //========================================================================= + //========================================================================= - bool GObjectController::OnMiddleButtonDown()//virtual - { - return true; - } + bool GObjectController::OnMiddleButtonDown( )//virtual + { + return true ; + } - //========================================================================= + //========================================================================= - void GObjectController::moveObject(int X,int Y) - { - _view->moveObject(X,Y); - } + void GObjectController::moveObject( int X , int Y ) { + _view->moveObject( X , Y ) ; + } - //========================================================================= + //========================================================================= - int GObjectController::getGObjectType() - { - return _model->getGObjectType(); - } + int GObjectController::getGObjectType( ) { + return _model->getGObjectType( ) ; + } - //========================================================================= + //========================================================================= - GObjectModel* GObjectController::getModel() - { - return _model; - } + GObjectModel* GObjectController::getModel( ) { + return _model ; + } - //========================================================================= + //========================================================================= - vtkGObjectView* GObjectController::getView() - { - return _view; - } + vtkGObjectView* GObjectController::getView( ) { + return _view ; + } - //========================================================================= + //========================================================================= - int GObjectController::getId() - { - return _model->getObjectId(); - } + int GObjectController::getId( ) { + return _model->getObjectId( ) ; + } - //========================================================================= + //========================================================================= - void GObjectController::setId(int id) - { - _model->setObjectId(id); - } + void GObjectController::setId( int id ) { + _model->setObjectId( id ) ; + } - //========================================================================= + //========================================================================= - std::string GObjectController::getStatusText() - { - return _model->getStatusText(); - } + std::string GObjectController::getStatusText( ) { + return _model->getStatusText( ) ; + } - //========================================================================= + //========================================================================= - void GObjectController::removeFromScene() - { - _view->removeFromScene(); - } + void GObjectController::removeFromScene( ) { + _view->removeFromScene( ) ; + } - //========================================================================= + //========================================================================= -} // EO namespace bbtk +} // EO namespace bbtk // EOF diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.h b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.h index deaa7d8..2c60de9 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.h +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.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::GObjectController : -*/ + * \file + * \brief Class bbtk::GObjectController : + */ /**** -* 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 __GObjectController_h__ #define __GObjectController_h__ @@ -55,65 +55,62 @@ Version: $Revision$ //Includes std #include -namespace bbtk -{ +namespace bbtk { - class GObjectController : public InteractorStyleMaracas - { + class GObjectController : public InteractorStyleMaracas { + public: - public: + //Constructors + GObjectController( ); + ~ GObjectController( ); - //Constructors - GObjectController(); - ~GObjectController(); + //Public methods - //Public methods + void setModelAndView( GObjectModel* model, vtkGObjectView* view ); - void setModelAndView(GObjectModel* model, vtkGObjectView* view); + // Same type of the saved in the model of the graphical objects + int getGObjectType( ); - // Same type of the saved in the model of the graphical objects - int getGObjectType(); + GObjectModel* getModel( ); + vtkGObjectView* getView( ); - GObjectModel* getModel(); - vtkGObjectView* getView(); + std::string getStatusText( ); - std::string getStatusText(); + // Same ObjectID from the model + int getId( ); + void setId( int id ); - // Same ObjectID from the model - int getId(); - void setId(int id); + virtual void removeFromScene( ); - virtual void removeFromScene(); + private: - private: + //Attributes - //Attributes + //Private Methods - //Private Methods + protected: - protected: + //Protected Attributes - //Protected Attributes + GObjectModel *_model; + vtkGObjectView *_view; - GObjectModel *_model; - vtkGObjectView *_view; + bool _isLeftClickDown; - bool _isLeftClickDown; + //Protected Methods - //Protected Methods + // Methods from InteractorStyleMaracas + virtual bool OnMouseMove( ); + virtual bool OnLeftButtonDown( ); + virtual bool OnLeftButtonUp( ); + virtual bool OnLeftDClick( ); + virtual bool OnMiddleButtonDown( ); - // Methods from InteractorStyleMaracas - virtual bool OnMouseMove(); - virtual bool OnLeftButtonDown(); - virtual bool OnLeftButtonUp(); - virtual bool OnLeftDClick(); - virtual bool OnMiddleButtonDown(); + virtual void moveObject( int X, int Y ); - virtual void moveObject(int X,int Y); - - }; + }; } diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGComplexBoxPortView.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGComplexBoxPortView.cxx index 35dc1a8..d9fd457 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGComplexBoxPortView.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGComplexBoxPortView.cxx @@ -8,213 +8,201 @@ 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::vtkGComplexBoxPortView -*/ + * \file + * \brief Class bbtk::vtkGComplexBoxPortView + */ #include "vtkGComplexBoxPortView.h" -namespace bbtk -{ - - - //========================================================================= - vtkGComplexBoxPortView::vtkGComplexBoxPortView() - { - } - - //========================================================================= - vtkGComplexBoxPortView::~vtkGComplexBoxPortView() - { - } - - //========================================================================= - void vtkGComplexBoxPortView::update(int idController,int command) - { - updateColors(); - - double xInic, yInic,zInic,xFin, yFin,zFin; - _model->getInicPoint(xInic,yInic,zInic); - _model->getFinalPoint(xFin, yFin,zFin); - - // RaC In the actual version, zInic=zFin=900 - - _pts->SetPoint(0, xInic, yInic, zInic ); - _pts->SetPoint(1, xInic, yFin, zInic ); - _pts->SetPoint(2, xFin, yFin, zFin ); - _pts->SetPoint(3, xFin, yInic, zFin ); - - updatePorts(); - - _borderPolyMapper->Modified(); - _fillPolyMapper->Modified(); - //----------- - - //----------- - setRefreshWaiting(); - } - - //========================================================================= - - void vtkGComplexBoxPortView::createVtkObjects() //virtual - { - - //------------ - _pts = vtkPoints::New(); - vtkCellArray *lines = vtkCellArray::New(); - vtkPolyData *_pd = vtkPolyData::New(); - _borderPolyMapper=vtkPolyDataMapper::New(); - _borderObjectActor=vtkActor::New(); - - _pts->SetNumberOfPoints(4); - - double xInic, yInic,zInic,xFin, yFin,zFin; - _model->getInicPoint(xInic,yInic,zInic); - _model->getFinalPoint(xFin, yFin,zFin); - - // RaC In the actual version, zInic=zFin=900 - -//EED _pts->SetPoint(0, xInic, yInic, zInic ); -//EED _pts->SetPoint(1, xInic, yFin, zInic ); -//EED _pts->SetPoint(2, xFin, yFin, zFin ); -//EED _pts->SetPoint(3, xFin, yInic, zFin ); - - - _pts->SetPoint(0, -1000, -1000, -1000 ); - _pts->SetPoint(1, xInic, yFin, zInic ); - _pts->SetPoint(2, 1000, 1000, 1000 ); - _pts->SetPoint(3, xFin, yInic, zFin ); - - - lines->InsertNextCell(5); - lines->InsertCellPoint(0); - lines->InsertCellPoint(1); - lines->InsertCellPoint(2); - lines->InsertCellPoint(3); - lines->InsertCellPoint(0); - - _pd->SetPoints( _pts ); - _pd->SetLines( lines ); - - _borderPolyMapper->SetInput(_pd); - _borderObjectActor->SetMapper(_borderPolyMapper); - _borderPolyMapper->Modified(); - - - ///************************* FILL ************************* - - vtkCellArray *strip = vtkCellArray::New(); - vtkPolyData *pdFill = vtkPolyData::New(); - _fillPolyMapper=vtkPolyDataMapper::New(); - _fillObjectActor=vtkActor::New(); - - // RaC In the actual version, zInic=zFin=900 - - strip->InsertNextCell(5); - strip->InsertCellPoint(0); - strip->InsertCellPoint(1); - strip->InsertCellPoint(2); - strip->InsertCellPoint(0); - strip->InsertCellPoint(3); - - pdFill->SetPoints( _pts ); - pdFill->SetStrips( strip ); - - _fillPolyMapper->SetInput(pdFill); - _fillObjectActor->SetMapper(_fillPolyMapper); - _fillPolyMapper->Modified(); - - ///************************* FILL ************************* - - } - - //========================================================================= - - void vtkGComplexBoxPortView::addVtkActors()//virtual - { - _baseView->GetRenderer()->AddActor(_borderObjectActor); - vtkGObjectView::addVtkActors(); - } - - //========================================================================= - - void vtkGComplexBoxPortView::removeVtkActors()//virtual - { - _baseView->GetRenderer()->RemoveActor(_borderObjectActor); - vtkGObjectView::removeVtkActors(); - } - - //========================================================================= - - void vtkGComplexBoxPortView::updateColors() - { - _fillObjectActor->GetProperty()->SetAmbient(0.6); - - if(_state==NOTHING_HAPPENS) - { - _borderObjectActor->GetProperty()->SetLineWidth(1); - - - GComplexBoxPortModel *portModel = (GComplexBoxPortModel*)_model; - if(portModel->getComplexPortType() == GCOMPLEXINPUTPORT) - { - _fillObjectActor->GetProperty()->SetColor(COMPLEXINPUTPORTFILL_NH_R,COMPLEXINPUTPORTFILL_NH_G,COMPLEXINPUTPORTFILL_NH_B); - _borderObjectActor->GetProperty()->SetColor(COMPLEXINPUTPORTBORDER_NH_R,COMPLEXINPUTPORTBORDER_NH_G,COMPLEXINPUTPORTBORDER_NH_B); - } - else if (portModel->getComplexPortType() == GCOMPLEXOUTPUTPORT) - { - _fillObjectActor->GetProperty()->SetColor(COMPLEXOUTPUTPORTFILL_NH_R,COMPLEXOUTPUTPORTFILL_NH_G,COMPLEXOUTPUTPORTFILL_NH_B); - _borderObjectActor->GetProperty()->SetColor(COMPLEXOUTPUTPORTBORDER_NH_R,COMPLEXOUTPUTPORTBORDER_NH_G,COMPLEXOUTPUTPORTBORDER_NH_B); - } - - } - else if(_state==HIGHLIGHTED) - { - _borderObjectActor->GetProperty()->SetLineWidth(2); - - _borderObjectActor->GetProperty()->SetColor(BOXBORDER_HIGHLIGHTED_R,BOXBORDER_HIGHLIGHTED_G,BOXBORDER_HIGHLIGHTED_B); - _fillObjectActor->GetProperty()->SetColor(BOXFILL_HIGHLIGHTED_R,BOXFILL_HIGHLIGHTED_G,BOXFILL_HIGHLIGHTED_B); - } - else if(_state==DRAG) - { - _borderObjectActor->GetProperty()->SetLineWidth(1.2); - _borderObjectActor->GetProperty()->SetColor(BOXBORDER_DRAG_R,BOXBORDER_DRAG_G,BOXBORDER_DRAG_B); - _fillObjectActor->GetProperty()->SetColor(BOXFILL_DRAG_R,BOXFILL_DRAG_G,BOXFILL_DRAG_B); - } - else if(_state==SELECTED) - { - _borderObjectActor->GetProperty()->SetLineWidth(2); - _borderObjectActor->GetProperty()->SetColor(BOXBORDER_SELECTED_R,BOXBORDER_SELECTED_G,BOXBORDER_SELECTED_B); - _fillObjectActor->GetProperty()->SetColor(BOXFILL_SELECTED_R,BOXFILL_SELECTED_G,BOXFILL_SELECTED_B); - } - } - - //========================================================================= - - -} // EO namespace bbtk +namespace bbtk { + + + //========================================================================= + + vtkGComplexBoxPortView::vtkGComplexBoxPortView( ) { + } + + //========================================================================= + + vtkGComplexBoxPortView::~vtkGComplexBoxPortView( ) { + } + + //========================================================================= + + void vtkGComplexBoxPortView::update( int idController , int command ) { + updateColors( ) ; + + double xInic , yInic , zInic , xFin , yFin , zFin ; + _model->getInicPoint( xInic , yInic , zInic ) ; + _model->getFinalPoint( xFin , yFin , zFin ) ; + + // RaC In the actual version, zInic=zFin=900 + + _pts->SetPoint( 0 , xInic , yInic , zInic ) ; + _pts->SetPoint( 1 , xInic , yFin , zInic ) ; + _pts->SetPoint( 2 , xFin , yFin , zFin ) ; + _pts->SetPoint( 3 , xFin , yInic , zFin ) ; + + updatePorts( ) ; + + _borderPolyMapper->Modified( ) ; + _fillPolyMapper->Modified( ) ; + //----------- + + //----------- + setRefreshWaiting( ) ; + } + + //========================================================================= + + void vtkGComplexBoxPortView::createVtkObjects( ) //virtual + { + + //------------ + _pts = vtkPoints::New( ) ; + vtkCellArray *lines = vtkCellArray::New( ) ; + vtkPolyData *_pd = vtkPolyData::New( ) ; + _borderPolyMapper = vtkPolyDataMapper::New( ) ; + _borderObjectActor = vtkActor::New( ) ; + + _pts->SetNumberOfPoints( 4 ) ; + + double xInic , yInic , zInic , xFin , yFin , zFin ; + _model->getInicPoint( xInic , yInic , zInic ) ; + _model->getFinalPoint( xFin , yFin , zFin ) ; + + // RaC In the actual version, zInic=zFin=900 + + //EED _pts->SetPoint(0, xInic, yInic, zInic ); + //EED _pts->SetPoint(1, xInic, yFin, zInic ); + //EED _pts->SetPoint(2, xFin, yFin, zFin ); + //EED _pts->SetPoint(3, xFin, yInic, zFin ); + + + _pts->SetPoint( 0 , -1000 , -1000 , -1000 ) ; + _pts->SetPoint( 1 , xInic , yFin , zInic ) ; + _pts->SetPoint( 2 , 1000 , 1000 , 1000 ) ; + _pts->SetPoint( 3 , xFin , yInic , zFin ) ; + + + lines->InsertNextCell( 5 ) ; + lines->InsertCellPoint( 0 ) ; + lines->InsertCellPoint( 1 ) ; + lines->InsertCellPoint( 2 ) ; + lines->InsertCellPoint( 3 ) ; + lines->InsertCellPoint( 0 ) ; + + _pd->SetPoints( _pts ) ; + _pd->SetLines( lines ) ; + + _borderPolyMapper->SetInput( _pd ) ; + _borderObjectActor->SetMapper( _borderPolyMapper ) ; + _borderPolyMapper->Modified( ) ; + + + ///************************* FILL ************************* + + vtkCellArray *strip = vtkCellArray::New( ) ; + vtkPolyData *pdFill = vtkPolyData::New( ) ; + _fillPolyMapper = vtkPolyDataMapper::New( ) ; + _fillObjectActor = vtkActor::New( ) ; + + // RaC In the actual version, zInic=zFin=900 + + strip->InsertNextCell( 5 ) ; + strip->InsertCellPoint( 0 ) ; + strip->InsertCellPoint( 1 ) ; + strip->InsertCellPoint( 2 ) ; + strip->InsertCellPoint( 0 ) ; + strip->InsertCellPoint( 3 ) ; + + pdFill->SetPoints( _pts ) ; + pdFill->SetStrips( strip ) ; + + _fillPolyMapper->SetInput( pdFill ) ; + _fillObjectActor->SetMapper( _fillPolyMapper ) ; + _fillPolyMapper->Modified( ) ; + + ///************************* FILL ************************* + + } + + //========================================================================= + + void vtkGComplexBoxPortView::addVtkActors( )//virtual + { + _baseView->GetRenderer( )->AddActor( _borderObjectActor ) ; + vtkGObjectView::addVtkActors( ) ; + } + + //========================================================================= + + void vtkGComplexBoxPortView::removeVtkActors( )//virtual + { + _baseView->GetRenderer( )->RemoveActor( _borderObjectActor ) ; + vtkGObjectView::removeVtkActors( ) ; + } + + //========================================================================= + + void vtkGComplexBoxPortView::updateColors( ) { + _fillObjectActor->GetProperty( )->SetAmbient( 0.6 ) ; + + if ( _state == NOTHING_HAPPENS ) { + _borderObjectActor->GetProperty( )->SetLineWidth( 1 ) ; + + + GComplexBoxPortModel *portModel = ( GComplexBoxPortModel* ) _model ; + if ( portModel->getComplexPortType( ) == GCOMPLEXINPUTPORT ) { + _fillObjectActor->GetProperty( )->SetColor( COMPLEXINPUTPORTFILL_NH_R , COMPLEXINPUTPORTFILL_NH_G , COMPLEXINPUTPORTFILL_NH_B ) ; + _borderObjectActor->GetProperty( )->SetColor( COMPLEXINPUTPORTBORDER_NH_R , COMPLEXINPUTPORTBORDER_NH_G , COMPLEXINPUTPORTBORDER_NH_B ) ; + } else if ( portModel->getComplexPortType( ) == GCOMPLEXOUTPUTPORT ) { + _fillObjectActor->GetProperty( )->SetColor( COMPLEXOUTPUTPORTFILL_NH_R , COMPLEXOUTPUTPORTFILL_NH_G , COMPLEXOUTPUTPORTFILL_NH_B ) ; + _borderObjectActor->GetProperty( )->SetColor( COMPLEXOUTPUTPORTBORDER_NH_R , COMPLEXOUTPUTPORTBORDER_NH_G , COMPLEXOUTPUTPORTBORDER_NH_B ) ; + } + + } else if ( _state == HIGHLIGHTED ) { + _borderObjectActor->GetProperty( )->SetLineWidth( 2 ) ; + + _borderObjectActor->GetProperty( )->SetColor( BOXBORDER_HIGHLIGHTED_R , BOXBORDER_HIGHLIGHTED_G , BOXBORDER_HIGHLIGHTED_B ) ; + _fillObjectActor->GetProperty( )->SetColor( BOXFILL_HIGHLIGHTED_R , BOXFILL_HIGHLIGHTED_G , BOXFILL_HIGHLIGHTED_B ) ; + } else if ( _state == DRAG ) { + _borderObjectActor->GetProperty( )->SetLineWidth( 1.2 ) ; + _borderObjectActor->GetProperty( )->SetColor( BOXBORDER_DRAG_R , BOXBORDER_DRAG_G , BOXBORDER_DRAG_B ) ; + _fillObjectActor->GetProperty( )->SetColor( BOXFILL_DRAG_R , BOXFILL_DRAG_G , BOXFILL_DRAG_B ) ; + } else if ( _state == SELECTED ) { + _borderObjectActor->GetProperty( )->SetLineWidth( 2 ) ; + _borderObjectActor->GetProperty( )->SetColor( BOXBORDER_SELECTED_R , BOXBORDER_SELECTED_G , BOXBORDER_SELECTED_B ) ; + _fillObjectActor->GetProperty( )->SetColor( BOXFILL_SELECTED_R , BOXFILL_SELECTED_G , BOXFILL_SELECTED_B ) ; + } + } + + //========================================================================= + + +} // EO namespace bbtk // EOF diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.cxx index 40e9478..ba9a3d2 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.cxx @@ -8,153 +8,152 @@ 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::vtkGPortView -*/ + * \file + * \brief Class bbtk::vtkGPortView + */ #include "vtkGPortView.h" -namespace bbtk -{ +namespace bbtk { - //========================================================================= - vtkGPortView::vtkGPortView() - { - } + //========================================================================= - //========================================================================= - vtkGPortView::~vtkGPortView() - { - } + vtkGPortView::vtkGPortView( ) { + } - //========================================================================= - void vtkGPortView::update(int idController,int command) - { - updateColors(); - - double xInic, yInic,zInic,xFin, yFin,zFin; + //========================================================================= - _model->getInicPoint(xInic,yInic,zInic); - _model->getFinalPoint(xFin, yFin,zFin); + vtkGPortView::~vtkGPortView( ) { + } - // RaC In the actual version, zInic=zFin=900 + //========================================================================= - double mid = (xInic+xFin)/2; + void vtkGPortView::update( int idController , int command ) { - _pts->SetPoint(0, xInic, yInic, zInic ); - _pts->SetPoint(1, mid, yFin, zInic ); - _pts->SetPoint(2, xFin, yInic, zFin ); + updateColors( ) ; - _fillPolyMapper->Modified(); - - //----------- - setRefreshWaiting(); - } + double xInic , yInic , zInic , xFin , yFin , zFin ; - //========================================================================= + _model->getInicPoint( xInic , yInic , zInic ) ; + _model->getFinalPoint( xFin , yFin , zFin ) ; - void vtkGPortView::createVtkObjects() //virtual - { - _pts = vtkPoints::New(); - _pts->SetNumberOfPoints(3); + // RaC In the actual version, zInic=zFin=900 - double xInic, yInic,zInic,xFin, yFin,zFin; + double mid = ( xInic + xFin ) / 2 ; - _model->getInicPoint(xInic,yInic,zInic); - _model->getFinalPoint(xFin, yFin,zFin); + _pts->SetPoint( 0 , xInic , yInic , zInic ) ; + _pts->SetPoint( 1 , mid , yFin , zInic ) ; + _pts->SetPoint( 2 , xFin , yInic , zFin ) ; - // RaC In the actual version, zInic=zFin=900 + _fillPolyMapper->Modified( ) ; - double mid = (xInic+xFin)/2; + //----------- + setRefreshWaiting( ) ; + } -//EED _pts->SetPoint(0, xInic, yInic, zInic ); -//EED _pts->SetPoint(1, mid, yFin, zInic ); -//EED _pts->SetPoint(2, xFin, yInic, zFin ); + //========================================================================= - _pts->SetPoint(0, -1000, -1000, -1000 ); - _pts->SetPoint(1, mid, yFin, zInic ); - _pts->SetPoint(2, 1000, 1000, 1000 ); - - - ///************************* FILL ************************* + void vtkGPortView::createVtkObjects( ) //virtual + { + _pts = vtkPoints::New( ) ; + _pts->SetNumberOfPoints( 3 ) ; - vtkCellArray *strip = vtkCellArray::New(); - vtkPolyData *pdFill = vtkPolyData::New(); - _fillPolyMapper=vtkPolyDataMapper::New(); - _fillObjectActor=vtkActor::New(); + double xInic , yInic , zInic , xFin , yFin , zFin ; - // RaC In the actual version, zInic=zFin=900 + _model->getInicPoint( xInic , yInic , zInic ) ; + _model->getFinalPoint( xFin , yFin , zFin ) ; - strip->InsertNextCell(3); - strip->InsertCellPoint(0); - strip->InsertCellPoint(1); - strip->InsertCellPoint(2); - - pdFill->SetPoints( _pts ); - pdFill->SetStrips( strip ); + // RaC In the actual version, zInic=zFin=900 - _fillPolyMapper->SetInput(pdFill); - _fillObjectActor->SetMapper(_fillPolyMapper); - _fillPolyMapper->Modified(); + double mid = ( xInic + xFin ) / 2 ; - ///************************* FILL ************************* + //EED _pts->SetPoint(0, xInic, yInic, zInic ); + //EED _pts->SetPoint(1, mid, yFin, zInic ); + //EED _pts->SetPoint(2, xFin, yInic, zFin ); - updateColors(); + _pts->SetPoint( 0 , -1000 , -1000 , -1000 ) ; + _pts->SetPoint( 1 , mid , yFin , zInic ) ; + _pts->SetPoint( 2 , 1000 , 1000 , 1000 ) ; - } + ///************************* FILL ************************* - //========================================================================= + vtkCellArray *strip = vtkCellArray::New( ) ; + vtkPolyData *pdFill = vtkPolyData::New( ) ; + _fillPolyMapper = vtkPolyDataMapper::New( ) ; + _fillObjectActor = vtkActor::New( ) ; - void vtkGPortView::updateColors() - { - _fillObjectActor->GetProperty()->SetColor(0.45,0.45,0.45); + // RaC In the actual version, zInic=zFin=900 - if(_state==HIGHLIGHTED) - { - _fillObjectActor->GetProperty()->SetColor( 0 , 0 , 1 ); - } else { - GPortModel* portm = (GPortModel*)_model; - if(portm->isConnected()) - { - _fillObjectActor->GetProperty()->SetColor(0.15,0.15,0.15); - } - else if(portm->isValueSet()) - { - _fillObjectActor->GetProperty()->SetColor(0.55,0.25,0.25); - } else { - _fillObjectActor->GetProperty()->SetColor(0.45,0.45,0.45); - } - } - } + strip->InsertNextCell( 3 ) ; + strip->InsertCellPoint( 0 ) ; + strip->InsertCellPoint( 1 ) ; + strip->InsertCellPoint( 2 ) ; - //========================================================================= + pdFill->SetPoints( _pts ) ; + pdFill->SetStrips( strip ) ; + _fillPolyMapper->SetInput( pdFill ) ; + _fillObjectActor->SetMapper( _fillPolyMapper ) ; + _fillPolyMapper->Modified( ) ; -} // EO namespace bbtk + ///************************* FILL ************************* + + updateColors( ) ; + + + } + + //========================================================================= + + void vtkGPortView::updateColors( ) { + _fillObjectActor->GetProperty( )->SetColor( 0.45 , 0.45 , 0.45 ) ; + + if ( _state == POSSIBLE_CONNECTION ) { + _fillObjectActor->GetProperty( )->SetColor( 1 , 1 , 0 ) ; + } else if ( _state == SELECTED_POSSIBLE_CONNECTION ) { + _fillObjectActor->GetProperty( )->SetColor( 0 , 1 , 0 ) ; + } else if ( _state == HIGHLIGHTED ) { + _fillObjectActor->GetProperty( )->SetColor( 0 , 0 , 1 ) ; + } else { + GPortModel* portm = ( GPortModel* ) _model ; + if ( portm->isConnected( ) ) { + _fillObjectActor->GetProperty( )->SetColor( 0.15 , 0.15 , 0.15 ) ; + } else if ( portm->isValueSet( ) ) { + _fillObjectActor->GetProperty( )->SetColor( 0.55 , 0.25 , 0.25 ) ; + } else { + _fillObjectActor->GetProperty( )->SetColor( 0.45 , 0.45 , 0.45 ) ; + } + } + } + + //========================================================================= + + +} // EO namespace bbtk // EOF diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.h b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.h index cb1734a..618099c 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.h +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.h @@ -72,25 +72,19 @@ namespace bbtk { public: - //Constructors vtkGPortView(); ~vtkGPortView(); //Public methods virtual void update(int idController,int command); - private: - //Private Attributes - //Private Methods protected: - - //Protected Attributes - + //Protected Attributes //Protected Methods virtual void createVtkObjects(); virtual void updateColors(); diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h index 6fb6fdf..de6021f 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h @@ -165,7 +165,8 @@ namespace bbtk void OnChangeName(wxCommandEvent& event); // Edit menu events - void OnCopySelectedToComplexDiagram(wxCommandEvent& event); + void OnCopySelectedToComplexDiagram(wxCommandEvent& event); + // Tool menu events void OnCreatePackage(wxCommandEvent& event); diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxBlackBoxEditionDialog.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxBlackBoxEditionDialog.cxx index d4663da..053d0a6 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxBlackBoxEditionDialog.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxBlackBoxEditionDialog.cxx @@ -8,34 +8,35 @@ 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 { //========================================================================= @@ -179,13 +180,135 @@ printf("EED wxBlackBoxEditionDialog::onClickClose\n"); Close(true); } - //========================================================================= -} // EO namespace bbtk + 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 // 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);*/ \ No newline at end of file + _tabsMgr->SetNameTabPanel(name);*/ diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxBlackBoxEditionDialog.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxBlackBoxEditionDialog.h index be859b6..77801df 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,7 +90,29 @@ 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 ab0ef4e..543f88a 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx @@ -35,11 +35,14 @@ #include "wxVtkSceneManager.h" + #include #include + namespace bbtk { +cvs //========================================================================= wxVtkSceneManager::wxVtkSceneManager(wxGEditorTabPanel *parent, wxVtk3DBaseView *baseView, int idManager) { @@ -59,11 +62,13 @@ 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; @@ -530,7 +535,17 @@ int wxVtkSceneManager::createGConnector(GPortModel* startPort) { manContourView->SetColorNormalContour(0, 0, 1); manContourView->SetColorEditContour(0.5, 0.5, 0.5); manContourView->SetColorSelectContour(1, 0.8, 0); - manContourView->SetWidthLine(1); + + + /** + * JGRR AND CM + * Width increased from 2 to 5, it simplifies line handling and spline control :P + * @param WidthLine + */ + + manContourView->SetWidthLine( 5 ) ; + + manContourView->SetShowText(false); manContourControl->SetModelView(manContourModel, manContourView); @@ -1946,7 +1961,6 @@ 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 @@ -2556,6 +2570,7 @@ void wxVtkSceneManager::SetCbPackageName(std::string packagename) { } } + //========================================================================= std::string wxVtkSceneManager::GetCbPackageName() { return _cbPackageName; @@ -2595,6 +2610,7 @@ void wxVtkSceneManager::SetDescription(std::string description) { } } + //========================================================================= std::string wxVtkSceneManager::GetDescription() { return _Description; @@ -2605,5 +2621,4 @@ std::string wxVtkSceneManager::GetDescription() { } // EO namespace bbtk -// EOF - +// EOF diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.h index fe5889c..fadb8ba 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,6 +86,7 @@ Version: $Revision$ #include #include + namespace bbtk { class wxGEditorTabPanel; @@ -127,6 +128,78 @@ 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(); @@ -173,96 +246,97 @@ 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(); - //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 ); + + //Clear list of controllers and refresh + void deleteAllBoxes( ); - void AddControlerToBeRemove(std::vector *controllersToRemove, int id); + //Save the diagram in the BBG format, in the string given by param. + void saveDiagram( std::string &content ); - //Clear list of controllers and refresh - void deleteAllBoxes(); + //Load the diagram + void loadDiagram( ifstream &inputStream ); - //Save the diagram in the BBG format, in the string given by param. - void saveDiagram(std::string &content); + //Center the view of the camera in the initial position + void centerView( ); //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 ); + + std::string GetCbName( ); + std::string GetCbPackageName( ); + std::string GetAuthor( ); + std::string GetCategory( ); + std::string GetDescription( ); + + - 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); + // JGRR & CM + void printAll( int com, int sta ); - 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: - }; + }; } -- 2.47.1