From 062ee1e352a911991a120c5bf95ba836a6b0871b Mon Sep 17 00:00:00 2001 From: corredor <> Date: Tue, 27 Apr 2010 12:54:21 +0000 Subject: [PATCH] Ports updated when connected and the properties panel will be changed ... --- .../GConnectorModel.cxx | 6 ++- .../bbsKernelEditorGraphic/GPortModel.cxx | 13 ++++++ .../bbsKernelEditorGraphic/GPortModel.h | 3 ++ .../bbsVtkGUIEditorGraphic/vtkGPortView.cxx | 42 +++++++++++++++++-- .../bbsVtkGUIEditorGraphic/vtkGPortView.h | 1 + .../bbtkwxGUIEditorGraphicBBS.cxx | 2 +- 6 files changed, 61 insertions(+), 6 deletions(-) diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GConnectorModel.cxx b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GConnectorModel.cxx index eed5e18..95f1b15 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GConnectorModel.cxx +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GConnectorModel.cxx @@ -43,8 +43,8 @@ namespace bbtk GConnectorModel::GConnectorModel() { - //_startPort = NULL; - //_endPort = NULL; + _startPort = NULL; + _endPort = NULL; } //========================================================================= @@ -58,6 +58,7 @@ namespace bbtk void GConnectorModel::setStartPort(GPortModel* startPort) { _startPort = startPort; + startPort->setConnected(true); double xCenter,yCenter,zCenter; startPort->getCenter(xCenter,yCenter,zCenter); @@ -72,6 +73,7 @@ namespace bbtk void GConnectorModel::setEndPort(GPortModel* endPort) { _endPort = endPort; + endPort->setConnected(true); double xCenter,yCenter,zCenter; endPort->getCenter(xCenter,yCenter,zCenter); diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.cxx b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.cxx index 5a31568..161efa7 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.cxx +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.cxx @@ -46,6 +46,7 @@ namespace bbtk _parentBox = NULL; _portType=-1; _posInBox=0; + _isConnected=false; } //========================================================================= @@ -133,6 +134,18 @@ namespace bbtk //========================================================================= + bool GPortModel::isConnected() + { + return _isConnected; + } + + //========================================================================= + + void GPortModel::setConnected(bool value) + { + _isConnected=value; + } + } // EO namespace bbtk // EOF diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.h b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.h index fd45571..0ee17f1 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.h +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.h @@ -74,6 +74,8 @@ namespace bbtk int getPortType(); GBlackBoxModel* getParentBox(); virtual std::string getStatusText(); + bool isConnected(); + void setConnected(bool value); private: @@ -83,6 +85,7 @@ namespace bbtk int _portType; int _posInBox; + bool _isConnected; //Private Methods diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.cxx index a21ba84..97a8958 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.cxx @@ -69,6 +69,7 @@ namespace bbtk _pts->SetPoint(2, xFin, yInic, zFin ); _borderObjectActor->Modified(); + _fillPolyMapper->Modified(); setRefreshWaiting(); } @@ -109,7 +110,31 @@ namespace bbtk _borderPolyMapper->SetInput(_pd); _borderObjectActor->SetMapper(_borderPolyMapper); - _borderObjectActor->Modified(); + _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(3); + strip->InsertCellPoint(0); + strip->InsertCellPoint(1); + strip->InsertCellPoint(2); + + pdFill->SetPoints( _pts ); + pdFill->SetStrips( strip ); + + _fillPolyMapper->SetInput(pdFill); + _fillObjectActor->SetMapper(_fillPolyMapper); + _fillPolyMapper->Modified(); + + ///************************* FILL ************************* updateColors(); @@ -121,14 +146,25 @@ namespace bbtk void vtkGPortView::updateColors() { _borderObjectActor->GetProperty()->SetColor(BOXBORDER_NH_R,BOXBORDER_NH_G,BOXBORDER_NH_B); + _fillObjectActor->GetProperty()->SetColor(0.6,0.6,0.6); if(_state==HIGHLIGHTED) { - _borderObjectActor->GetProperty()->SetColor(0.8,0.2,0.5); + _borderObjectActor->GetProperty()->SetColor(0.35,0.15,0.1); + _fillObjectActor->GetProperty()->SetColor(0.8,0.8,0.8); } else { - _borderObjectActor->GetProperty()->SetColor(0.3,0.2,0.2); + GPortModel* portm = (GPortModel*)_model; + _borderObjectActor->GetProperty()->SetColor(0.15,0.15,0.15); + if(portm->isConnected()) + { + _fillObjectActor->GetProperty()->SetColor(0.2,0.2,0.2); + } + else + { + _fillObjectActor->GetProperty()->SetColor(0.6,0.6,0.6); + } } } diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.h b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.h index 7f94560..2c854c6 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.h +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.h @@ -46,6 +46,7 @@ Version: $Revision$ //Includes same project #include "GlobalConstants.h" #include "vtkGObjectView.h" +#include "GPortModel.h" //Includes creaMaracasVisu #include "vtkInteractorStyleBaseView.h" diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx index 9c63350..bea7df0 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx @@ -156,7 +156,7 @@ namespace bbtk void wxGUIEditorGraphicBBS::initPropertiesPanel() { _propertiesPanel = new wxPropertiesPanel(this); - _frameAUIMgr->AddPane(_propertiesPanel,wxAuiPaneInfo().Right().MinSize(200,200).CloseButton(false).Floatable(false)); + //_frameAUIMgr->AddPane(_propertiesPanel,wxAuiPaneInfo().Right().MinSize(200,200).CloseButton(false).Floatable(false)); } //================================================================ -- 2.47.1