bbtk::vtkGBlackBoxView Class Reference

#include <vtkGBlackBoxView.h>

Inheritance diagram for bbtk::vtkGBlackBoxView:

Inheritance graph
[legend]
Collaboration diagram for bbtk::vtkGBlackBoxView:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 vtkGBlackBoxView ()
 ~vtkGBlackBoxView ()
void setModel (GObjectModel *model)
void setBaseView (wxVtkBaseView *baseView)
void initVtkObjects ()
void setStartDragging (bool param)
void setState (int state)
int getState ()
void setRefreshWaiting ()
virtual bool isPointInside (int X, int Y)
virtual void moveObject (int X, int Y)
virtual void removeFromScene ()

Protected Member Functions

virtual void addVtkActors ()
virtual void removeVtkActors ()
virtual void createVtkObjects ()
virtual void update (int idController, int command)
virtual void updateColors ()
virtual void update_X_Fin ()
void updatePorts ()

Protected Attributes

wxVtkBaseView * _baseView
GObjectModel_model
vtkActor * _borderObjectActor
vtkActor * _fillObjectActor
vtkPolyDataMapper * _fillPolyMapper
vtkPolyDataMapper * _borderPolyMapper
vtkPoints * _pts
int _state

Private Member Functions

void updatePositionTextActor (double xInic, double yInic, double zInic)

Private Attributes

vtkTextActor3D * _boxTextActor


Detailed Description

Definition at line 75 of file vtkGBlackBoxView.h.


Constructor & Destructor Documentation

bbtk::vtkGBlackBoxView::vtkGBlackBoxView (  ) 

Definition at line 44 of file vtkGBlackBoxView.cxx.

00045         {
00046         }

bbtk::vtkGBlackBoxView::~vtkGBlackBoxView (  ) 

Definition at line 49 of file vtkGBlackBoxView.cxx.

00050         {
00051         }


Member Function Documentation

void bbtk::vtkGBlackBoxView::addVtkActors (  )  [protected, virtual]

Reimplemented from bbtk::vtkGBoxView.

Definition at line 210 of file vtkGBlackBoxView.cxx.

References bbtk::vtkGObjectView::_baseView, bbtk::vtkGObjectView::_borderObjectActor, and _boxTextActor.

00211         {
00212                 
00213                 _baseView->GetRenderer()->AddActor(_borderObjectActor);
00214                 vtkGObjectView::addVtkActors();
00215                 _baseView->GetRenderer()->AddActor(_boxTextActor);
00216         }

void bbtk::vtkGBlackBoxView::createVtkObjects (  )  [protected, virtual]

************************* FILL *************************

************************* FILL *************************

Reimplemented from bbtk::vtkGBoxView.

Definition at line 120 of file vtkGBlackBoxView.cxx.

References bbtk::vtkGObjectView::_borderObjectActor, bbtk::vtkGObjectView::_borderPolyMapper, _boxTextActor, bbtk::vtkGObjectView::_fillObjectActor, bbtk::vtkGObjectView::_fillPolyMapper, bbtk::vtkGObjectView::_model, bbtk::vtkGObjectView::_pts, bbtk::GObjectModel::getFinalPoint(), bbtk::GObjectModel::getInicPoint(), and updatePositionTextActor().

00121         {
00122 
00123                 //------------
00124                 _pts                            = vtkPoints::New();
00125                 vtkCellArray *lines = vtkCellArray::New();
00126                 vtkPolyData *_pd        = vtkPolyData::New();
00127                 _borderPolyMapper       = vtkPolyDataMapper::New();
00128                 _borderObjectActor      = vtkActor::New();
00129 
00130                 _pts->SetNumberOfPoints(4);
00131 
00132                 double xInic, yInic,zInic,xFin, yFin,zFin;
00133                 _model->getInicPoint(xInic,yInic,zInic);
00134                 _model->getFinalPoint(xFin, yFin,zFin);
00135 
00136                 // RaC In the actual version, zInic=zFin=900
00137 
00138 //EED           _pts->SetPoint(0, xInic, yInic, zInic );
00139 //EED           _pts->SetPoint(1, xInic, yFin, zInic );
00140 //EED           _pts->SetPoint(2, xFin, yFin, zFin );
00141 //EED           _pts->SetPoint(3, xFin, yInic, zFin );
00142 
00143                 _pts->SetPoint(0, -1000, -1000, -1000 );
00144                 _pts->SetPoint(1, xInic, yFin, zInic );
00145                 _pts->SetPoint(2, 1000, 1000, 1000 );
00146                 _pts->SetPoint(3, xFin, yInic, zFin );
00147 
00148 
00149 
00150                 lines->InsertNextCell(5);
00151                 lines->InsertCellPoint(0);
00152                 lines->InsertCellPoint(1);
00153                 lines->InsertCellPoint(2);
00154                 lines->InsertCellPoint(3);
00155                 lines->InsertCellPoint(0);
00156 
00157                 _pd->SetPoints( _pts );
00158                 _pd->SetLines( lines );
00159 
00160                 _borderPolyMapper->SetInput(_pd);
00161                 _borderObjectActor->SetMapper(_borderPolyMapper);
00162                 _borderPolyMapper->Modified();
00163 
00164 
00166 
00167                 vtkCellArray *strip = vtkCellArray::New();
00168                 vtkPolyData *pdFill = vtkPolyData::New();
00169                 _fillPolyMapper         = vtkPolyDataMapper::New();
00170                 _fillObjectActor        = vtkActor::New();
00171 
00172                 // RaC In the actual version, zInic=zFin=900
00173 
00174                 strip->InsertNextCell(5);
00175                 strip->InsertCellPoint(0);
00176                 strip->InsertCellPoint(1);
00177                 strip->InsertCellPoint(2);
00178                 strip->InsertCellPoint(0);
00179                 strip->InsertCellPoint(3);
00180 
00181                 pdFill->SetPoints( _pts );
00182                 pdFill->SetStrips( strip );
00183 
00184                 _fillPolyMapper->SetInput(pdFill);
00185                 _fillObjectActor->SetMapper(_fillPolyMapper);
00186                 _fillPolyMapper->Modified();
00187 
00189 
00190                 //------------
00191 
00192                 _boxTextActor           = vtkTextActor3D::New();
00193                 vtkTextProperty *prop =  vtkTextProperty::New();
00194                 prop->BoldOn();
00195                 prop->SetFontFamilyToArial();
00196                 _boxTextActor->GetTextProperty()->BoldOn();
00197                 prop->SetFontSize(80);
00198                 _boxTextActor->SetTextProperty(prop);
00199         
00200         //      _boxTextActor->GetTextProperty()->SetFontSize(80);
00201                 
00202 
00203                 //------------
00204 
00205                 updatePositionTextActor( xInic,  yInic,  zInic);
00206         }

Here is the call graph for this function:

int bbtk::vtkGObjectView::getState (  )  [inherited]

void bbtk::vtkGObjectView::initVtkObjects (  )  [inherited]

bool bbtk::vtkGObjectView::isPointInside ( int  X,
int  Y 
) [virtual, inherited]

Definition at line 119 of file vtkGObjectView.cxx.

References bbtk::vtkGObjectView::_baseView, bbtk::vtkGObjectView::_model, and bbtk::GObjectModel::isPointInside().

Referenced by bbtk::wxVtkSceneManager::GetGBlackBoxControlerPointedByMouse(), bbtk::GBlackBoxController::OnLeftButtonDown(), bbtk::GBoxController::OnLeftButtonUp(), bbtk::GBlackBoxController::OnMiddleButtonDown(), bbtk::GObjectController::OnMouseMove(), bbtk::GBoxController::OnMouseMove(), and bbtk::GBlackBoxController::OnMouseMove().

00120         {
00121                 // RaC In the actual version, always z=900
00122                 double xx=X,yy=Y,zz=900;
00123                 _baseView->TransCoordScreenToWorld(xx,yy,zz);
00124                 return _model->isPointInside(xx,yy,zz);
00125         }

Here is the call graph for this function:

Here is the caller graph for this function:

void bbtk::vtkGObjectView::moveObject ( int  X,
int  Y 
) [virtual, inherited]

Definition at line 129 of file vtkGObjectView.cxx.

References bbtk::vtkGObjectView::_baseView, bbtk::vtkGObjectView::_isStartDragging, bbtk::vtkGObjectView::_model, bbtk::vtkGObjectView::dragDifX, bbtk::vtkGObjectView::dragDifY, bbtk::GObjectModel::getInicPoint(), and bbtk::GObjectModel::move().

Referenced by bbtk::GObjectController::moveObject(), and bbtk::wxVtkSceneManager::OnMouseMove().

00130         {               
00131                 // RaC In the actual version, always z=900
00132                 double xx=X,yy=Y,zz=900;
00133                 _baseView->TransCoordScreenToWorld(xx,yy,zz);
00134 
00135                 if(_isStartDragging)
00136                 {
00137                         _isStartDragging=false;
00138                         
00139                         double xInic,yInic,zInic;
00140                         _model->getInicPoint(xInic,yInic,zInic);                        
00141                         dragDifX=xx-xInic;
00142                         dragDifY=yy-yInic;      
00143                 }
00144                 _model->move(xx-dragDifX,yy-dragDifY,zz);
00145 
00146         }

Here is the call graph for this function:

Here is the caller graph for this function:

void bbtk::vtkGObjectView::removeFromScene (  )  [virtual, inherited]

Definition at line 180 of file vtkGObjectView.cxx.

References bbtk::vtkGObjectView::removeVtkActors(), and bbtk::vtkGObjectView::setRefreshWaiting().

Referenced by bbtk::GObjectController::removeFromScene().

00181         {
00182                 removeVtkActors();
00183                 setRefreshWaiting();
00184         }

Here is the call graph for this function:

Here is the caller graph for this function:

void bbtk::vtkGBlackBoxView::removeVtkActors (  )  [protected, virtual]

Reimplemented from bbtk::vtkGBoxView.

Definition at line 220 of file vtkGBlackBoxView.cxx.

References bbtk::vtkGObjectView::_baseView, bbtk::vtkGObjectView::_borderObjectActor, and _boxTextActor.

00221         {
00222                 _baseView->GetRenderer()->RemoveActor(_borderObjectActor);
00223                 _baseView->GetRenderer()->RemoveActor(_boxTextActor);
00224                 vtkGObjectView::removeVtkActors();
00225         }

void bbtk::vtkGObjectView::setBaseView ( wxVtkBaseView *  baseView  )  [inherited]

void bbtk::vtkGObjectView::setModel ( GObjectModel model  )  [inherited]

void bbtk::vtkGObjectView::setRefreshWaiting (  )  [inherited]

Definition at line 173 of file vtkGObjectView.cxx.

References bbtk::vtkGObjectView::_baseView.

Referenced by bbtk::vtkGObjectView::removeFromScene(), bbtk::vtkGPortView::update(), bbtk::vtkGComplexBoxPortView::update(), bbtk::vtkGBoxView::update(), and update().

00174         {
00175                 ((vtkInteractorStyleBaseView*)_baseView->GetInteractorStyleBaseView())->SetRefresh_waiting();
00176         }

Here is the caller graph for this function:

void bbtk::vtkGObjectView::setStartDragging ( bool  param  )  [inherited]

Definition at line 150 of file vtkGObjectView.cxx.

References bbtk::vtkGObjectView::_isStartDragging, and bbtk::vtkGObjectView::dragDifX.

Referenced by bbtk::wxVtkSceneManager::OnMouseMove().

00151         {
00152                 _isStartDragging=param;
00153                 dragDifX=0;
00154                 dragDifX=0;
00155         }

Here is the caller graph for this function:

void bbtk::vtkGObjectView::setState ( int  state  )  [inherited]

void bbtk::vtkGBlackBoxView::update ( int  idController,
int  command 
) [protected, virtual]

Reimplemented from bbtk::vtkGBoxView.

Definition at line 90 of file vtkGBlackBoxView.cxx.

References bbtk::vtkGObjectView::_borderPolyMapper, bbtk::vtkGObjectView::_fillPolyMapper, bbtk::vtkGObjectView::_model, bbtk::vtkGObjectView::_pts, bbtk::GObjectModel::getFinalPoint(), bbtk::GObjectModel::getInicPoint(), bbtk::vtkGObjectView::setRefreshWaiting(), update_X_Fin(), updateColors(), bbtk::vtkGBoxView::updatePorts(), and updatePositionTextActor().

00091         {
00092                 updateColors();
00093 
00094                 double xInic, yInic,zInic,xFin, yFin,zFin;
00095                 _model->getInicPoint(xInic,yInic,zInic);
00096 
00097                 updatePositionTextActor(xInic, yInic,zInic);
00098         update_X_Fin();
00099                 _model->getFinalPoint(xFin, yFin,zFin);
00100 
00101                 // RaC In the actual version, zInic=zFin=900
00102 
00103                 _pts->SetPoint(0, xInic, yInic, zInic );
00104                 _pts->SetPoint(1, xInic, yFin, zInic );
00105                 _pts->SetPoint(2, xFin, yFin, zFin );
00106                 _pts->SetPoint(3, xFin, yInic, zFin );
00107 
00108                 updatePorts();
00109 
00110                 _borderPolyMapper->Modified();
00111                 _fillPolyMapper->Modified();
00112                 //-----------
00113 
00114                 //-----------
00115                 setRefreshWaiting();
00116         }

Here is the call graph for this function:

void bbtk::vtkGBlackBoxView::update_X_Fin (  )  [protected, virtual]

Definition at line 54 of file vtkGBlackBoxView.cxx.

References _boxTextActor, bbtk::vtkGObjectView::_model, bbtk::GObjectModel::getFinalPoint(), bbtk::GObjectModel::getInicPoint(), bbtk::GBoxModel::getInputPort(), bbtk::GBoxModel::getNumInputPorts(), bbtk::GBoxModel::getNumOutputPorts(), bbtk::GBoxModel::getOutputPort(), and bbtk::GObjectModel::setFinalPoint().

Referenced by update().

00055     {
00056                 double xInic, yInic,zInic,xFin, yFin,zFin;
00057                 _model->getInicPoint(xInic,yInic,zInic);
00058         double *bounds = _boxTextActor->GetBounds();
00059                 _model->getFinalPoint(xFin, yFin,zFin);
00060 
00061                 double xFin1,xFin2,xFin3;
00062                 // position referens from box name
00063                 xFin1 = xInic+(bounds[1]-bounds[0])/2 + 20;
00064         xFin2=xFin1;
00065         xFin3=xFin1;
00066         // position referens from input ports
00067         GBoxModel* gbm=(GBoxModel*)_model;
00068                 if ( gbm->getNumInputPorts()>0 )
00069                 {
00070             GPortModel* gpm = gbm->getInputPort( gbm->getNumInputPorts()-1 );
00071             double xpFin, ypFin, zpFin;
00072             gpm->getFinalPoint(xpFin, ypFin, zpFin);
00073             xFin2 = xpFin+1;
00074         }
00075         // position referens from output ports
00076                 if ( gbm->getNumOutputPorts()>0 )
00077                 {
00078             GPortModel* gpm = gbm->getOutputPort( gbm->getNumOutputPorts()-1 );
00079             double xpFin, ypFin, zpFin;
00080             gpm->getFinalPoint(xpFin, ypFin, zpFin);
00081             xFin3 = xpFin+2;
00082         }
00083         xFin=xFin1;
00084         if (xFin2>xFin) xFin=xFin2;
00085         if (xFin3>xFin) xFin=xFin3;
00086                 _model->setFinalPoint( xFin , yFin , zFin  );
00087     }

Here is the call graph for this function:

Here is the caller graph for this function:

void bbtk::vtkGBlackBoxView::updateColors (  )  [protected, virtual]

Reimplemented from bbtk::vtkGBoxView.

Definition at line 241 of file vtkGBlackBoxView.cxx.

References bbtk::vtkGObjectView::_borderObjectActor, _boxTextActor, bbtk::vtkGObjectView::_fillObjectActor, bbtk::vtkGObjectView::_model, bbtk::vtkGObjectView::_state, bbtk::BOXBORDER_DRAG_B, bbtk::BOXBORDER_DRAG_G, bbtk::BOXBORDER_DRAG_R, bbtk::BOXBORDER_HIGHLIGHTED_B, bbtk::BOXBORDER_HIGHLIGHTED_G, bbtk::BOXBORDER_HIGHLIGHTED_R, bbtk::BOXBORDER_NH_B, bbtk::BOXBORDER_NH_G, bbtk::BOXBORDER_NH_R, bbtk::BOXBORDER_SELECTED_B, bbtk::BOXBORDER_SELECTED_G, bbtk::BOXBORDER_SELECTED_R, bbtk::BOXFILL_DRAG_B, bbtk::BOXFILL_DRAG_G, bbtk::BOXFILL_DRAG_R, bbtk::BOXFILL_HIGHLIGHTED_B, bbtk::BOXFILL_HIGHLIGHTED_G, bbtk::BOXFILL_HIGHLIGHTED_R, bbtk::BOXFILL_NH_B, bbtk::BOXFILL_NH_G, bbtk::BOXFILL_NH_R, bbtk::BOXFILL_SELECTED_B, bbtk::BOXFILL_SELECTED_G, bbtk::BOXFILL_SELECTED_R, bbtk::BOXTEXT_DRAG_B, bbtk::BOXTEXT_DRAG_G, bbtk::BOXTEXT_DRAG_R, bbtk::BOXTEXT_HIGHLIGHTED_B, bbtk::BOXTEXT_HIGHLIGHTED_G, bbtk::BOXTEXT_HIGHLIGHTED_R, bbtk::BOXTEXT_NH_B, bbtk::BOXTEXT_NH_G, bbtk::BOXTEXT_NH_R, bbtk::BOXTEXT_SELECTED_B, bbtk::BOXTEXT_SELECTED_G, bbtk::BOXTEXT_SELECTED_R, bbtk::DRAG, bbtk::HIGHLIGHTED, bbtk::GBlackBoxModel::isExecutable(), bbtk::NOTHING_HAPPENS, and bbtk::SELECTED.

Referenced by update().

00242         {
00243                 _fillObjectActor->GetProperty()->SetAmbient(0.6);
00244 
00245                 if(_state==NOTHING_HAPPENS)
00246                 {
00247                         _borderObjectActor->GetProperty()->SetLineWidth(1);
00248                         _borderObjectActor->GetProperty()->SetColor(BOXBORDER_NH_R,BOXBORDER_NH_G,BOXBORDER_NH_B);
00249                         _fillObjectActor->GetProperty()->SetColor(BOXFILL_NH_R,BOXFILL_NH_G,BOXFILL_NH_B);
00250                         _boxTextActor->GetTextProperty()->SetColor(BOXTEXT_NH_R,BOXTEXT_NH_G,BOXTEXT_NH_B);
00251 
00252                         GBlackBoxModel *bbmodel = (GBlackBoxModel*)_model;
00253                         if(bbmodel->isExecutable())
00254                         {
00255                                 _borderObjectActor->GetProperty()->SetColor(BOXBORDER_NH_R,0.9,BOXBORDER_HIGHLIGHTED_B);
00256                                 _fillObjectActor->GetProperty()->SetColor(BOXFILL_NH_R,0.9,BOXFILL_HIGHLIGHTED_B);
00257                         }
00258 
00259                 }
00260                 else if(_state==HIGHLIGHTED)
00261                 {
00262                         _borderObjectActor->GetProperty()->SetLineWidth(2);
00263 
00264                         _borderObjectActor->GetProperty()->SetColor(BOXBORDER_HIGHLIGHTED_R,BOXBORDER_HIGHLIGHTED_G,BOXBORDER_HIGHLIGHTED_B);
00265                         _fillObjectActor->GetProperty()->SetColor(BOXFILL_HIGHLIGHTED_R,BOXFILL_HIGHLIGHTED_G,BOXFILL_HIGHLIGHTED_B);
00266                         _boxTextActor->GetTextProperty()->SetColor(BOXTEXT_HIGHLIGHTED_R,BOXTEXT_HIGHLIGHTED_G,BOXTEXT_HIGHLIGHTED_B);
00267                 }
00268                 else if(_state==DRAG)
00269                 {
00270                         _borderObjectActor->GetProperty()->SetLineWidth(1.2);
00271                         _borderObjectActor->GetProperty()->SetColor(BOXBORDER_DRAG_R,BOXBORDER_DRAG_G,BOXBORDER_DRAG_B);
00272                         _fillObjectActor->GetProperty()->SetColor(BOXFILL_DRAG_R,BOXFILL_DRAG_G,BOXFILL_DRAG_B);
00273                         _boxTextActor->GetTextProperty()->SetColor(BOXTEXT_DRAG_R,BOXTEXT_DRAG_G,BOXTEXT_DRAG_B);
00274                 }
00275                 else if(_state==SELECTED)
00276                 {
00277                         _borderObjectActor->GetProperty()->SetLineWidth(2);
00278                         _borderObjectActor->GetProperty()->SetColor(BOXBORDER_SELECTED_R,BOXBORDER_SELECTED_G,BOXBORDER_SELECTED_B);
00279                         _fillObjectActor->GetProperty()->SetColor(BOXFILL_SELECTED_R,BOXFILL_SELECTED_G,BOXFILL_SELECTED_B);
00280                         _boxTextActor->GetTextProperty()->SetColor(BOXTEXT_SELECTED_R,BOXTEXT_SELECTED_G,BOXTEXT_SELECTED_B);
00281                 }
00282         }

Here is the call graph for this function:

Here is the caller graph for this function:

void bbtk::vtkGBoxView::updatePorts (  )  [protected, inherited]

Definition at line 205 of file vtkGBoxView.cxx.

References bbtk::vtkGObjectView::_model, and bbtk::GBoxModel::updatePorts().

Referenced by bbtk::vtkGComplexBoxPortView::update(), bbtk::vtkGBoxView::update(), and update().

00206         {
00207                 GBoxModel* bmod =(GBoxModel*)_model;
00208                 bmod->updatePorts();
00209         }

Here is the call graph for this function:

Here is the caller graph for this function:

void bbtk::vtkGBlackBoxView::updatePositionTextActor ( double  xInic,
double  yInic,
double  zInic 
) [private]

Definition at line 229 of file vtkGBlackBoxView.cxx.

References _boxTextActor, bbtk::vtkGObjectView::_model, bbtk::GObjectModel::getBBTKName(), and bbtk::GObjectModel::getBBTKType().

Referenced by createVtkObjects(), and update().

00230         {
00231                 std::string temp        = _model->getBBTKType();
00232                 temp+=":";
00233                 temp+=_model->getBBTKName();
00234                 _boxTextActor->SetInput(temp.c_str());
00235                 _boxTextActor->SetPosition(xInic+4,yInic-7,zInic+1);
00236                 _boxTextActor->SetScale(0.05,0.05,1);
00237         }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

wxVtkBaseView* bbtk::vtkGObjectView::_baseView [protected, inherited]

vtkActor* bbtk::vtkGObjectView::_borderObjectActor [protected, inherited]

vtkPolyDataMapper* bbtk::vtkGObjectView::_borderPolyMapper [protected, inherited]

vtkTextActor3D* bbtk::vtkGBlackBoxView::_boxTextActor [private]

vtkActor* bbtk::vtkGObjectView::_fillObjectActor [protected, inherited]

vtkPolyDataMapper* bbtk::vtkGObjectView::_fillPolyMapper [protected, inherited]

GObjectModel* bbtk::vtkGObjectView::_model [protected, inherited]

vtkPoints* bbtk::vtkGObjectView::_pts [protected, inherited]

int bbtk::vtkGObjectView::_state [protected, inherited]


The documentation for this class was generated from the following files:

Generated on Thu May 31 15:13:46 2012 for bbtkGEditor by  doxygen 1.5.7.1