From: eduardo.davila@creatis.insa-lyon.fr Date: Fri, 12 Dec 2025 13:52:36 +0000 (+0100) Subject: #3263 Show principal connections X-Git-Url: http://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=6200797121060828681f3043b38f738e5edb441a;p=bbtkGEditor.git #3263 Show principal connections --- diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBoxModel.cxx b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBoxModel.cxx index b8c4e4e..762c89b 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBoxModel.cxx +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBoxModel.cxx @@ -114,19 +114,18 @@ namespace bbtk for(i=0;i<(int)_inputs.size();i++) { _inputs[i]->updatePortPosition(); - } + } // for i //Refresh outputs position for(i=0;i<(int)_outputs.size();i++) { _outputs[i]->updatePortPosition(); - } + }// for i } //========================================================================= std::string GBoxModel::getStatusText() { std::string temp = ""; - return temp; } @@ -196,7 +195,6 @@ namespace bbtk _inputs[i]->updatePortPosition(); _inputs[i]->notifyObservers(_objectId); } - for(int i = 0; i<_outputs.size();i++) { _outputs[i]->updatePortPosition(); @@ -235,10 +233,6 @@ namespace bbtk } } - //========================================================================= - - } // EO namespace bbtk - // EOF diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.h b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.h index ed995fc..e445670 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.h +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.h @@ -124,14 +124,14 @@ namespace bbtk private: //Private Attributes - GBoxModel *_parentBox; + GBoxModel *_parentBox; // Port type (INPUT/OUTPUT) - int _portType; + int _portType; // The position of the port in the box - int _posInBox; - bool _isConnected; + int _posInBox; + bool _isConnected; std::string _value; - bool _isValueSet; + bool _isValueSet; //Private Methods protected: //Protected methods diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h index 42228af..fa3823a 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h @@ -106,14 +106,20 @@ namespace bbtk { const double COMPLEXPORT_WIDTH = 3.3; // BOX_HEIGHT + PORT_HEIGHT // Commands - const int NO_COMMAND = 201; - const int INIT_CREATION_CONTOUR = 202; - const int FIN_CREATION_CONTOUR = 203; - const int ADD_TO_SELECTED = 204; - const int DRAG_OBJECTS = 205; - const int EDIT_BLACKBOX = 206; - const int REMOVE_FROM_SELECTED = 207; - const int SELECTING_BOXES = 208; + const int NO_COMMAND = 201; + const int INIT_CREATION_CONTOUR = 202; + const int FIN_CREATION_CONTOUR = 203; + const int ADD_TO_SELECTED = 204; + const int DRAG_OBJECTS = 205; + const int EDIT_BLACKBOX = 206; + const int REMOVE_FROM_SELECTED = 207; + const int SELECTING_BOXES = 208; + + const int COMMAND_CONNECTION_HIGHLIGHTED = 220; + const int STATE_CONNECTION_HIGHLIGHTED = 221; + const int STATE_CONNECTION_NORMAL = 222; + const double CONNECTION_HIGHLIGHTED = 1; + const double CONNECTION_NORMAL = 0.1; //// COLORS (object_state_(R|G|B)) @@ -171,10 +177,7 @@ namespace bbtk { const double BOXFILL_SELECTED_G = 0.65; const double BOXFILL_SELECTED_B = 0.05; - //Object Text colors - - const double PORTFILL_NH_R = 0.0; const double PORTFILL_NH_G = 0.0; const double PORTFILL_NH_B = 0.0; @@ -222,7 +225,7 @@ namespace bbtk { const int wxID_NOTEBOOK = 1018; // EED updated - const int ID_bbEditor_Tool_Menu_CreatePackage = 1019; // EED + const int ID_bbEditor_Tool_Menu_CreatePackage = 1019; // EED const int ID_bbEditor_Tool_Menu_CreateBlackBox = 1020; // EED const int ID_bbEditor_Tool_Menu_PlugPackage = 1021; // EED const int ID_bbEditor_Tool_Menu_EditConfig = 1022; // EED @@ -233,14 +236,12 @@ namespace bbtk { const int ID_REDO = 1026; // FCY const int ID_CHANGENAME = 1027; - const int ID_EDITPROPERTIES = 1028; // RaC 2nd HackFest - const int ID_SHOWTREE = 1029; // CFT + const int ID_EDITPROPERTIES = 1028; // RaC 2nd HackFest + const int ID_SHOWTREE = 1029; // CFT //EED 2022-10-28 - const int ID_BTNSELETBOXES = 1032; - + const int ID_BTNSELETBOXES = 1032; -} -// namespace bbtk +}// namespace bbtk #endif diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx index 55f011c..08837b0 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx @@ -58,40 +58,36 @@ Version: $Revision$ * \brief Class bbtk::GObjectController */ - #include "GObjectController.h" - #ifdef _DEBUG #define new DEBUG_NEW #endif namespace bbtk { //========================================================================= - - GObjectController::GObjectController( ) { - + GObjectController::GObjectController( ) + { } //========================================================================= - - GObjectController::~GObjectController( ) { + GObjectController::~GObjectController( ) + { } //========================================================================= - - void GObjectController::setModelAndView( GObjectModel* model , vtkGObjectView* view ) { + void GObjectController::setModelAndView( GObjectModel* model , vtkGObjectView* view ) + { _model = model ; _view = view ; } //========================================================================= - bool GObjectController::OnMouseMove( ) { int X , Y ; crea::wxVTKRenderWindowInteractor *_wxVTKiren ; - _wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView( )->GetWxVTKRenderWindowInteractor( ) ; + _wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView( )->GetWxVTKRenderWindowInteractor( ); _wxVTKiren->GetEventPosition( X , Y ) ; int state = _view->getState( ) ; @@ -132,17 +128,13 @@ namespace bbtk // EO JGRR & CM WH _model->notifyObservers( getId( ) ) ; - - return true ; } //========================================================================= - bool GObjectController::OnLeftButtonDown( )//virtual { int state = _view->getState( ) ; - //Evaluate new state if ( state == HIGHLIGHTED ) { _isLeftClickDown = true ; @@ -152,17 +144,14 @@ namespace bbtk } //========================================================================= - bool GObjectController::OnLeftButtonUp( )//virtual { return true ; } //========================================================================= - bool GObjectController::OnLeftDClick( )//virtual { - return true ; } @@ -174,56 +163,53 @@ namespace bbtk } //========================================================================= - - void GObjectController::moveObject( int X , int Y ) { + void GObjectController::moveObject( int X , int Y ) + { _view->moveObject( X , Y ) ; } //========================================================================= - - int GObjectController::getGObjectType( ) { + int GObjectController::getGObjectType( ) + { return _model->getGObjectType( ) ; } //========================================================================= - - GObjectModel* GObjectController::getModel( ) { + GObjectModel* GObjectController::getModel( ) + { return _model ; } //========================================================================= - - vtkGObjectView* GObjectController::getView( ) { + vtkGObjectView* GObjectController::getView( ) + { return _view ; } //========================================================================= - - int GObjectController::getId( ) { + int GObjectController::getId( ) + { return _model->getObjectId( ) ; } //========================================================================= - - void GObjectController::setId( int id ) { + void GObjectController::setId( int id ) + { _model->setObjectId( id ) ; } //========================================================================= - - std::string GObjectController::getStatusText( ) { + std::string GObjectController::getStatusText( ) + { return _model->getStatusText( ) ; } //========================================================================= - - void GObjectController::removeFromScene( ) { + void GObjectController::removeFromScene( ) + { _view->removeFromScene( ) ; } - //========================================================================= - } // EO namespace bbtk - // EOF diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.h b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.h index ff37a2f..1403bc1 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.h +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.h @@ -104,7 +104,7 @@ namespace bbtk { //Protected Attributes GObjectModel *_model; vtkGObjectView *_view; - bool _isLeftClickDown; + bool _isLeftClickDown; //Protected Methods // Methods from InteractorStyleMaracas virtual bool OnMouseMove( ); diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/manualConnectorContourController.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/manualConnectorContourController.cxx index 361c899..1f7e9c0 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/manualConnectorContourController.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/manualConnectorContourController.cxx @@ -71,18 +71,14 @@ namespace bbtk } //========================================================================= - manualConnectorContourController::~manualConnectorContourController() { } //========================================================================= - void manualConnectorContourController::MouseMove(int x, int y) // virtual { - int z=GetZ(); - GetManualViewBaseContour()->SelectPossiblePoint(x,y,z); GetManualViewBaseContour()->SelectPossibleContour(x,y,z); if (GetState()==1){ SetPoint( _bakIdPoint , x , y ,z); } @@ -101,33 +97,25 @@ namespace bbtk GetManualViewBaseContour()->Refresh(); this->_vtkInteractorStyleBaseView->SetRefresh_waiting(); } - } //========================================================================= - void manualConnectorContourController::MouseClickRight(int x, int y) { SetCompleteCreation( true ); SetKeyBoardMoving( false ); GetManualContourModel()->SetCloseContour(false); - SetEditable( false ); SetPossibleToMove( false ); SetState(0); - } //========================================================================= - void manualConnectorContourController::MouseClickLeft(int x, int y) { - - bool ok = false; - int z=GetZ(); - int size= GetManualViewBaseContour()->GetNumberOfPoints(); - - + bool ok = false; + int z = GetZ(); + int size = GetManualViewBaseContour()->GetNumberOfPoints(); // Insert a Control Point with shift+ClickLeft vtkRenderWindowInteractor *vtkrenderwindowinteractor = _vtkInteractorStyleBaseView->GetInteractor(); if( IsEditable() ) @@ -204,26 +192,19 @@ namespace bbtk { GetManualViewBaseContour()->Refresh(); }// ok - } //========================================================================= - void manualConnectorContourController::endContourCreation() { SetCompleteCreation( true ); SetKeyBoardMoving( false ); GetManualContourModel()->SetCloseContour(false); - SetEditable( false ); SetPossibleToMove( false ); SetState(0); } - - //========================================================================= - } // EO namespace bbtk - // EOF diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/manualConnectorContourView.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/manualConnectorContourView.cxx index e88a5d7..9e071ed 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/manualConnectorContourView.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/manualConnectorContourView.cxx @@ -58,27 +58,22 @@ Version: $Revision$ * \brief Class bbtk::manualConnectorContourView */ - #include "manualConnectorContourView.h" namespace bbtk { - //========================================================================= - manualConnectorContourView::manualConnectorContourView() { } //========================================================================= - manualConnectorContourView::~manualConnectorContourView() { } //========================================================================= - void manualConnectorContourView::TransfromCoordViewWorld(double &X, double &Y, double &Z, int type) { // Make the conversion using the system of creaMaracasVisu @@ -86,7 +81,6 @@ namespace bbtk } //========================================================================= - void manualConnectorContourView::updateStartAndEnd(double* start , double* end) { // Update contour first and last point @@ -97,7 +91,6 @@ namespace bbtk } //========================================================================= - void manualConnectorContourView::AddControlPoints() { vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer(); @@ -115,14 +108,11 @@ namespace bbtk } //========================================================================= - void manualConnectorContourView::RefreshText() // virtual { // The text that goes with the contour is not shown } - } // EO namespace bbtk - // EOF diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.cxx index 36800fb..ab79bfd 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.cxx @@ -170,7 +170,6 @@ namespace bbtk // _borderObjectActor->SetMapper(_borderPolyMapper); // _borderPolyMapper->Modified(); - ///************************* FILL ************************* vtkCellArray *strip = vtkCellArray::New(); vtkPolyData *pdFill = vtkPolyData::New(); @@ -185,28 +184,17 @@ namespace bbtk strip->InsertCellPoint(3); pdFill->SetPoints( _pts ); pdFill->SetStrips( strip ); - - //EED 2017-01-01 Migration VTK7 #if VTK_MAJOR_VERSION <= 5 _fillPolyMapper->SetInput(pdFill); #else _fillPolyMapper->SetInputData(pdFill); #endif - - _fillObjectActor->SetMapper(_fillPolyMapper); _fillPolyMapper->Modified(); ///************************* FILL ************************* - - - createVtkInputOutputPorts(); - - - //------------ - // _boxTextActor = vtkTextActor::New(); // for actor 2D _boxTextActor = vtkTextActor3D::New(); vtkTextProperty *prop = vtkTextProperty::New(); @@ -219,23 +207,18 @@ namespace bbtk prop->SetFontSize(40); _boxTextActor->SetTextProperty(prop); //------------ - updatePositionTextActor( xInic, yInic, zInic); } //===============BoundaryEdgesOn========================================================== - void vtkGBlackBoxView::addVtkActors()//virtual { - // _baseView->GetRenderer()->AddActor(_borderObjectActor); vtkGBoxView::addVtkActors(); _baseView->GetRenderer()->AddActor(_boxTextActor); - } //========================================================================= - void vtkGBlackBoxView::removeVtkActors()//virtual { _baseView->GetRenderer()->RemoveActor(_boxTextActor); @@ -244,7 +227,6 @@ namespace bbtk } //========================================================================= - void vtkGBlackBoxView::updatePositionTextActor(double xInic, double yInic, double zInic) { std::string temp = _model->getBBTKType(); @@ -259,25 +241,21 @@ namespace bbtk } //========================================================================= - void vtkGBlackBoxView::updateColors() { _fillObjectActor->GetProperty()->SetAmbient(0.6); - if(_state==NOTHING_HAPPENS) { // _borderObjectActor->GetProperty()->SetLineWidth(1); /// _borderObjectActor->GetProperty()->SetColor(BOXBORDER_NH_R,BOXBORDER_NH_G,BOXBORDER_NH_B); _fillObjectActor->GetProperty()->SetColor(BOXFILL_NH_R,BOXFILL_NH_G,BOXFILL_NH_B); _boxTextActor->GetTextProperty()->SetColor(BOXTEXT_NH_R,BOXTEXT_NH_G,BOXTEXT_NH_B); - GBlackBoxModel *bbmodel = (GBlackBoxModel*)_model; if(bbmodel->isExecutable()) { // _borderObjectActor->GetProperty()->SetColor(BOXBORDER_NH_R,0.9,BOXBORDER_HIGHLIGHTED_B); _fillObjectActor->GetProperty()->SetColor(BOXFILL_NH_R,0.9,BOXFILL_HIGHLIGHTED_B); } - } else if(_state==HIGHLIGHTED) { @@ -300,14 +278,9 @@ namespace bbtk _fillObjectActor->GetProperty()->SetColor(BOXFILL_SELECTED_R,BOXFILL_SELECTED_G,BOXFILL_SELECTED_B); _boxTextActor->GetTextProperty()->SetColor(BOXTEXT_SELECTED_R,BOXTEXT_SELECTED_G,BOXTEXT_SELECTED_B); } - updateColorsPorts(); - } - //========================================================================= - - } // EO namespace bbtk // EOF diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBoxView.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBoxView.cxx index 4c6c7ee..1bd0fe1 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBoxView.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBoxView.cxx @@ -58,15 +58,12 @@ Version: $Revision$ * \brief Class bbtk::vtkGBoxView */ - #include "vtkGBoxView.h" #include "vtkUnsignedCharArray.h" #include "vtkCellData.h" namespace bbtk { - - //========================================================================= vtkGBoxView::vtkGBoxView() { @@ -80,7 +77,7 @@ namespace bbtk //========================================================================= void vtkGBoxView::update(int idController,int command) { - updateColors(); + updateColors(); double xInic, yInic,zInic,xFin, yFin,zFin; _model->getInicPoint(xInic,yInic,zInic); _model->getFinalPoint(xFin, yFin,zFin); @@ -96,7 +93,6 @@ namespace bbtk setRefreshWaiting(); } - //========================================================================= //EED2017 void vtkGBoxView::createVtkInputOutputPorts() @@ -147,7 +143,6 @@ namespace bbtk _TrianglesInputsActor->SetMapper(_TrianglesInputsPolyMapper); _TrianglesInputsPolyMapper->Modified(); - ///************************* Inputs Fill (triangles) ************************* ///************************* Outputs Fill (triangles) ************************* @@ -194,9 +189,7 @@ namespace bbtk ///************************* Inputs Fill (triangles) ************************* } - //========================================================================= - void vtkGBoxView::createVtkObjects() //virtual { //------------ @@ -205,9 +198,7 @@ namespace bbtk // 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); @@ -237,7 +228,6 @@ namespace bbtk // _borderObjectActor->SetMapper(_borderPolyMapper); // _borderPolyMapper->Modified(); - ///************************* FILL ************************* vtkCellArray *strip = vtkCellArray::New(); @@ -270,7 +260,6 @@ namespace bbtk } //========================================================================= - void vtkGBoxView::addVtkActors()//virtual { // _baseView->GetRenderer()->AddActor(_borderObjectActor); @@ -280,7 +269,6 @@ namespace bbtk } //========================================================================= - void vtkGBoxView::removeVtkActors()//virtual { // _baseView->GetRenderer()->RemoveActor(_borderObjectActor); @@ -290,42 +278,31 @@ namespace bbtk } //========================================================================= - void vtkGBoxView::updateColors() { printf("EED vtkGBoxView::updateColors\n"); _fillObjectActor->GetProperty()->SetAmbient(0.6); - if(_state==NOTHING_HAPPENS) { // _borderObjectActor->GetProperty()->SetLineWidth(1); // _borderObjectActor->GetProperty()->SetColor(BOXBORDER_NH_R,BOXBORDER_NH_G,BOXBORDER_NH_B); _fillObjectActor->GetProperty()->SetColor(BOXFILL_NH_R,BOXFILL_NH_G,BOXFILL_NH_B); - - } - else if(_state==HIGHLIGHTED) - { -// _borderObjectActor->GetProperty()->SetLineWidth(2); + } 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) - { + } 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) - { + } 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); } // if state box - updateColorsPorts(); } - //========================================================================= void vtkGBoxView::updateColorsPorts() { @@ -356,15 +333,12 @@ namespace bbtk } // for } - //========================================================================= void vtkGBoxView::updatePorts() { double xInic, yInic,zInic,xFin, yFin,zFin; - GBoxModel* boxModel = (GBoxModel*)_model; boxModel->updatePorts(); - // update position for one Actor that represents all InputPorts GPortModel *portModel; int numberOfTriangles = boxModel->getNumInputPorts(); @@ -376,7 +350,7 @@ namespace bbtk // RaC In the actual version, zInic=zFin=GPOSITION_Z _TrianglesInputsPts->SetPoint(i*3+0, xInic , yInic , zInic ); _TrianglesInputsPts->SetPoint(i*3+1, ( xInic + xFin ) / 2 , yFin , zInic ); - _TrianglesInputsPts->SetPoint(i*3+2, xFin , yInic , zFin ); + _TrianglesInputsPts->SetPoint(i*3+2, xFin , yInic , zFin ); } _TrianglesInputsPts->Modified(); _TrianglesInputsPolyMapper->Modified( ) ; @@ -391,13 +365,10 @@ namespace bbtk // RaC In the actual version, zInic=zFin=GPOSITION_Z _TrianglesOutputsPts->SetPoint(i*3+0, xInic , yInic , zInic ); _TrianglesOutputsPts->SetPoint(i*3+1, ( xInic + xFin ) / 2 , yFin , zInic ); - _TrianglesOutputsPts->SetPoint(i*3+2, xFin , yInic , zFin ); + _TrianglesOutputsPts->SetPoint(i*3+2, xFin , yInic , zFin ); } _TrianglesOutputsPts->Modified(); _TrianglesOutputsPolyMapper->Modified( ) ; - - - } //========================================================================= @@ -412,8 +383,6 @@ namespace bbtk _outputsG.push_back(outputport); } - } // EO namespace bbtk - // EOF diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGConnectorView.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGConnectorView.cxx index 44ef0b6..1de29a8 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGConnectorView.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGConnectorView.cxx @@ -64,45 +64,54 @@ Version: $Revision$ namespace bbtk { - - //========================================================================= - vtkGConnectorView::vtkGConnectorView() { } //========================================================================= - vtkGConnectorView::~vtkGConnectorView() { } //========================================================================= - void vtkGConnectorView::setManualContourView(manualViewContour *viewContour) { manViewContour = viewContour; } //========================================================================= - manualViewContour* vtkGConnectorView::getManualContourView() { return manViewContour; } //========================================================================= - void vtkGConnectorView::updateStartEndPoints() { GConnectorModel* mod=(GConnectorModel*)_model; mod->updateStartEndPoints(); manViewContour->RefreshContour(); } - -} // EO namespace bbtk +//========================================================================= +void vtkGConnectorView::update(int idController,int command) +{ + if ( command == COMMAND_CONNECTION_HIGHLIGHTED ) + { + if (_state==STATE_CONNECTION_HIGHLIGHTED ) + { + getManualContourView()->SetOpacity( CONNECTION_HIGHLIGHTED ); + } + if (_state==STATE_CONNECTION_NORMAL ) + { + getManualContourView()->SetOpacity( CONNECTION_NORMAL ); + } + } // if command + getManualContourView()->UpdateColorActor(); +} + +} // EO namespace bbtk // EOF diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGConnectorView.h b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGConnectorView.h index 7a86b3d..5461887 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGConnectorView.h +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGConnectorView.h @@ -92,6 +92,7 @@ namespace bbtk void setManualContourView(manualViewContour* viewContour); manualViewContour* getManualContourView(); void updateStartEndPoints(); + void update(int idController,int command); private: //Attributes manualViewContour* manViewContour; diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGObjectView.h b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGObjectView.h index 0ad4976..32229b3 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGObjectView.h +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGObjectView.h @@ -129,9 +129,9 @@ namespace bbtk vtkActor * _fillObjectActor; vtkPolyDataMapper * _fillPolyMapper; // vtkPolyDataMapper * _borderPolyMapper; - vtkPoints *_pts; + vtkPoints * _pts; // State of the object (See GlobalConstants.h) - int _state; + int _state; //Protected Methods virtual void removeVtkActors(); virtual void updateColors(); diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.cxx index 9376a67..962b760 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.cxx @@ -67,18 +67,20 @@ namespace bbtk { //========================================================================= - vtkGPortView::vtkGPortView( ) { + vtkGPortView::vtkGPortView( ) + { } //========================================================================= - vtkGPortView::~vtkGPortView( ) { + vtkGPortView::~vtkGPortView( ) + { } //========================================================================= void vtkGPortView::update( int idController , int command ) -{ + { updateColors( ) ; double xInic , yInic , zInic , xFin , yFin , zFin ; @@ -149,10 +151,8 @@ namespace bbtk { _fillPolyMapper->Modified( ) ; ///************************* FILL ************************* - + /// updateColors( ) ; - - } //========================================================================= @@ -190,6 +190,5 @@ namespace bbtk { } } // EO namespace bbtk - // EOF diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.h b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.h index f24c8a5..ed1b9a9 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.h +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.h @@ -99,7 +99,7 @@ namespace bbtk ~vtkGPortView(); //Public methods virtual void update(int idController,int command); - void getColors(float* rgb); + void getColors(float* rgb); private: //Private Attributes diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx index 468c1be..fd3bc0e 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx @@ -1597,7 +1597,6 @@ bool wxGUIEditorGraphicBBS::TryToOpenScript(std::string packageName ,std::string k = GetBBTKFactory()->GetPackage(packageName); mapDesc = k->GetDescriptorMap(); descriptor = mapDesc[boxType]; - bool result=false; descriptor->IsTypeOfScript_Application(); if (descriptor!=NULL) @@ -1614,11 +1613,9 @@ bool wxGUIEditorGraphicBBS::TryToOpenScript(std::string packageName ,std::string } else { printf("EED ERROR wxGUIEditorGraphicBBS::TryToOpenScript >> The descriptor of this box not exists (packageName:%s boxType:%s) this is not normal\n",packageName.c_str(), boxType.c_str() ); } // if descriptor NULL - return result; } } // EO namespace bbtk - // EOF diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx index ee1aec3..8d3ba3b 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx @@ -58,13 +58,11 @@ Version: $Revision$ * \brief Class bbtk::wxGEditorTabPanel . */ - #include "wxGEditorTabPanel.h" #include "creaWx.h" namespace bbtk { - //========================================================================= wxGEditorTabPanel::wxGEditorTabPanel() { @@ -88,7 +86,6 @@ namespace bbtk wxGEditorTabPanel::~wxGEditorTabPanel() { //ED02JUIN2010 _sceneManager->disconnectDrop(); - _panelsManager->VerifyLastTabPanel(); //FCY memory leaks delete _panelAUIMgr; @@ -120,7 +117,6 @@ namespace bbtk bool wxGEditorTabPanel::OnDropText(wxCoord x, wxCoord y, const wxString& data) { - /* * DFGO * To handle bbs and bbg: @@ -130,11 +126,7 @@ namespace bbtk * For a drag and drop tutorial read: * http://zetcode.com/gui/wxwidgets/dragdrop/ */ - //wxMessageBox(data); - - - int posEndEED=data.find(""); wxString data2( data.substr(0,posEndEED) ); std::string stdData = crea::wx2std(data2); @@ -615,7 +607,6 @@ printf("EED wxGEditorTabPanel::getUndoState This mecanisme is not working ????? { return( this->_fileName ); } - //========================================================================= // EED 2022-10-28 void wxGEditorTabPanel::SelectBoxWithPossibleName(std::string nameFilter ) @@ -623,9 +614,6 @@ printf("EED wxGEditorTabPanel::getUndoState This mecanisme is not working ????? getSceneManager()->SelectBoxWithPossibleName( nameFilter ); } - - - } // EO namespace bbtk // EOF diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h index 8d2bbf5..372abfa 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h @@ -53,8 +53,6 @@ Version: $Revision$ * knowledge of the CeCILL-B license and that you accept its terms. * ------------------------------------------------------------------------ */ - - /** * \file * \brief Class bbtk::BlackBox : abstract black-box interface. @@ -137,7 +135,7 @@ namespace bbtk void saveStringAction(const std::string &action); // Load temporary diagram as BBG - void loadTempDiagram(unsigned short un); + void loadTempDiagram(unsigned short un); // evaluate the position in the undo actions list unsigned short getUndoState(std::string &); @@ -161,7 +159,7 @@ namespace bbtk void displayBlackBoxInfo(std::string packageName, std::string boxName); void updateStatusBar(std::string textStatus); - int getPanelId(); + int getPanelId(); bool isComplexBox(); void setComplexBox(bool val); @@ -169,7 +167,7 @@ namespace bbtk std::map getSelectedObjects(); void addObjects(std::map objectsMap); - int getNumSelectedObjects(); + int getNumSelectedObjects(); // Receives the string from a drag and drop source as for example the BBTK Package Browser virtual bool OnDropText(wxCoord x, wxCoord y, const wxString& data); @@ -192,7 +190,7 @@ namespace bbtk std::string GetCbName(); std::string GetCbPackageName(); std::string GetAuthor(); - int GetExportFormat(); + int GetExportFormat(); std::string GetDescription(); std::string GetCategory(); std::string GetMessageKind(); @@ -215,11 +213,8 @@ namespace bbtk std::string _fileName; protected: Factory::Pointer _bbtkfactory; - }; - -} -// namespace bbtk +}// namespace bbtk #endif diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx index 6618b14..17f6174 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx @@ -63,8 +63,6 @@ Version: $Revision$ namespace bbtk { - - //========================================================================= wxTabPanelsManager::wxTabPanelsManager(wxGUIEditorGraphicBBS *parent) { @@ -74,7 +72,6 @@ namespace bbtk addNewTab(); _notebook->Connect(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED,wxAuiNotebookEventHandler(wxTabPanelsManager::OnTabChanged),0,this); _notebook->Connect(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE,wxAuiNotebookEventHandler(wxTabPanelsManager::OnTabClose),0,this); - } //========================================================================= @@ -102,10 +99,6 @@ namespace bbtk _notebook->AddPage(newPanel, tabName ,true); } - - - - //========================================================================= wxAuiNotebook* wxTabPanelsManager::getAuiNotebook() { diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx index d472336..6f8e949 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx @@ -240,11 +240,9 @@ void wxVtkSceneManager::configureBaseView() _fillObjectActor->GetProperty()->SetOpacity(0); _aPolygonMapper->Modified(); _baseView->GetRenderer()->AddActor(_fillObjectActor); - } //========================================================================= - std::string wxVtkSceneManager::generateANewNameForABox() { std::stringstream boxname; if (_numBoxes < 10) { @@ -257,7 +255,6 @@ std::string wxVtkSceneManager::generateANewNameForABox() { } //========================================================================= - std::string wxVtkSceneManager::findANewNameForABox() { std::string boxname = generateANewNameForABox(); @@ -296,7 +293,6 @@ int wxVtkSceneManager::createGBlackBox(int x, int y, std::string packageName,std //EED 15 oct 2012 BlackBoxDescriptor::Pointer descriptor = GObjectsMVCFactory::getInstance()->getBlackBoxDescriptor(packageName, boxType); - Package::Pointer k; std::map< std::string, BlackBoxDescriptor::Pointer> mapDesc; try{ @@ -676,11 +672,9 @@ vtkRenderWindow* wxVtkSceneManager::getRenderWindow() { return _baseView->GetRenWin(); } -//========================================================================= - //========================================================================= -int wxVtkSceneManager::GetIndexInSelected(int idControler) +int wxVtkSceneManager::GetIndexInSelected(int idControler) { int index = -1; for (int i = 0; i < (int) _selectedObjects.size(); i++) @@ -693,10 +687,10 @@ int wxVtkSceneManager::GetIndexInSelected(int idControler) } return index; } -//========================================================================= - -void wxVtkSceneManager::update(int idController, int command) { +//========================================================================= +void wxVtkSceneManager::update(int idController, int command) +{ if (command != NO_COMMAND) { if (command == ADD_TO_SELECTED) @@ -826,13 +820,10 @@ void wxVtkSceneManager::update(int idController, int command) { } connView->Refresh(); } - } - } //========================================================================= - bool wxVtkSceneManager::OnMouseMove() { int X, Y; @@ -841,7 +832,6 @@ bool wxVtkSceneManager::OnMouseMove() crea::wxVTKRenderWindowInteractor *wxVTKiren; wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); wxVTKiren->GetEventPosition(X, Y); - if (_worldState == DRAG_OBJECTS) { for (int i = 0; i < (int) _selectedObjects.size(); i++) @@ -928,8 +918,6 @@ bool wxVtkSceneManager::OnMouseMove() } // if state } // for controllers it } else if (_worldState == SELECTING_BOXES ) { - - int sX1,sX2,sY1,sY2; if (Xsecond; type = desc->getGObjectType(); state = desc->getView()->getState(); - if ( (type==GBLACKBOX) || (type==GCOMPLEXINPUTPORT) || (type==GCOMPLEXOUTPUTPORT) ) { if ( desc->getView()->isBoxInsideRectangle( sX1 , sY1,sX2 , sY2 ) ) @@ -965,10 +952,23 @@ bool wxVtkSceneManager::OnMouseMove() desc->getView()->setState(SELECTED); id = desc->getModel()->getObjectId(); desc->getModel()->notifyObservers( id , ADD_TO_SELECTED ); + +//EED 2025-11-29 + // Aqui toca seleccionar los connector input y output de esta caja + } } // if type == 1 - } // for + } // for it +//EED 2025-11-29 + for (int i = 0; i < (int) _selectedObjects.size(); i++) + { + int id = _selectedObjects[i]; + GObjectController* cont = _controllers[id]; + std::string name = cont->getModel()->getBBTKName(); + printf("EED wxVtkSceneManager::OnMouseMove %d %s\n", id, name.c_str() ); + } + } // if _worldState @@ -1051,14 +1051,14 @@ bool wxVtkSceneManager::OnLeftButtonDown() { for (int i = 0; i < (int) _selectedObjects.size(); i++) { - int id = _selectedObjects[i]; - GObjectController *cont = _controllers[id]; + int id = _selectedObjects[i]; + GObjectController *cont = _controllers[id]; cont->getView()->setState(DRAG); cont->getModel()->notifyObservers(_idManager); } // for } // if _worldState DRAG_OBJECTS - } // if _selectedObjects.size + } // if NOT INIT_CREATION_CONTOUR return true; } @@ -3184,7 +3184,6 @@ void wxVtkSceneManager::printAll(int com , int sta ) if ( command == REMOVE_FROM_SELECTED ) { std::cout << "COMMAND ----> REMOVE_FROM_SELECTED \n" ; } - } //========================================================================= @@ -3193,44 +3192,79 @@ void wxVtkSceneManager::SelectBoxWithPossibleName( std::string possibleName ) { UnSelectBlackBoxes(); std::map::iterator it; - GObjectController *desc; - int type; int id; - int pos; - std::string possibleNameAA = possibleName; - std::string boxNameBB; - int i,size; - size = possibleNameAA.length(); - for (i=0;i='A')&&(possibleNameAA[i]<='Z')) { possibleNameAA[i]=possibleNameAA[i]+32; } - } //for i + int type; + GObjectController *desc; + std::string boxNameBB; + std::string possibleNameAA = possibleName; + // + bool ok; + GBoxModel *modelBoxStart; + GBoxModel *modelBoxEnd; + std:string boxNameStart; + std::string boxNameEnd; + std::transform( possibleNameAA.begin(),possibleNameAA.end(),possibleNameAA.begin(), ::toupper ); + for (it = _controllers.begin(); it != _controllers.end(); ++it) { desc = it->second; type = desc->getGObjectType(); + // Select Box if ( type==GBLACKBOX) { boxNameBB = desc->getModel()->getBBTKType() +":"+ desc->getModel()->getBBTKName(); - size=boxNameBB.length(); - for (i=0;i='A')&&(boxNameBB[i]<='Z')) { boxNameBB[i]=boxNameBB[i]+32; } - } // for i - - pos=boxNameBB.find( possibleNameAA ); - if (pos>=0) + std::transform( boxNameBB.begin(),boxNameBB.end(),boxNameBB.begin(),::toupper); + if ( (int)(boxNameBB.find(possibleNameAA)) >= 0 ) { desc->getView()->setState(SELECTED); id = desc->getModel()->getObjectId(); desc->getModel()->notifyObservers( id , ADD_TO_SELECTED ); } // if pos - } // if type == 1 + } // if type == 1 GBLACKBOX // GlobalConstants.h + +//EED 2025-11-29 + // Select Connector + if ( type==GCONNECTOR) + { + ok = false; + GConnectorModel *connectorModel = (GConnectorModel*) (desc->getModel()); + vtkGConnectorView *connectorView = (vtkGConnectorView*) (desc->getView()); + +// id = desc->getModel()->getObjectId(); +// desc->getModel()->notifyObservers( id , COMMAND_CONNECTION_NORMAL ); +//connectorView->getManualContourView()->SetOpacity(0.1); + desc->getView()->setState(STATE_CONNECTION_NORMAL); + + //start + modelBoxStart = connectorModel->getStartPort()->getParentBox(); + boxNameStart = modelBoxStart->getBBTKType() +":"+ modelBoxStart->getBBTKName(); + std::transform( boxNameStart.begin(),boxNameStart.end(),boxNameStart.begin(),::toupper); + if ( (int)(boxNameStart.find(possibleNameAA)) >= 0 ) { ok= true;} + //end + modelBoxEnd = connectorModel->getEndPort()->getParentBox(); + boxNameEnd = modelBoxEnd->getBBTKType() +":"+ modelBoxEnd->getBBTKName(); + std::transform( boxNameEnd.begin(),boxNameEnd.end(),boxNameEnd.begin(),::toupper); + if ( (int)(boxNameEnd.find(possibleNameAA)) >= 0 ) { ok= true; } + // + if (ok==true) + { +// id = desc->getModel()->getObjectId(); +// desc->getModel()->notifyObservers( id , COMMAND_CONNECTION_HIGHLIGHTED ); + desc->getView()->setState(STATE_CONNECTION_HIGHLIGHTED); +// connectorView->getManualContourView()->SetOpacity(1); +// connectorView->getManualContourView()->UpdateColorActor(); + } // if ok + + id = desc->getModel()->getObjectId(); + desc->getModel()->notifyObservers( id , COMMAND_CONNECTION_HIGHLIGHTED ); + +// connectorView->getManualContourView()->UpdateColorActor(); + } //if type== 2 GCONNECTOR // GlobalConstants.h + } // for it refresh(); } } // EO namespace bbtk - // EOF diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.h index 0df261d..cbd2138 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.h +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.h @@ -53,8 +53,6 @@ Version: $Revision$ * knowledge of the CeCILL-B license and that you accept its terms. * ------------------------------------------------------------------------ */ - - /** * \file * \brief Class bbtk::BlackBox : abstract black-box interface. @@ -102,8 +100,7 @@ Version: $Revision$ #include #include #include - #include - +#include //Includes std #include @@ -308,7 +305,6 @@ namespace bbtk protected: }; - } // namespace bbtk #endif