bbtk::vtkGPortView Class Reference

#include <vtkGPortView.h>

Inheritance diagram for bbtk::vtkGPortView:

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

Collaboration graph
[legend]

List of all members.

Public Member Functions

 vtkGPortView ()
 ~vtkGPortView ()
virtual void update (int idController, int command)
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 createVtkObjects ()
virtual void updateColors ()
virtual void addVtkActors ()
virtual void removeVtkActors ()

Protected Attributes

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


Detailed Description

Definition at line 71 of file vtkGPortView.h.


Constructor & Destructor Documentation

bbtk::vtkGPortView::vtkGPortView (  ) 

Definition at line 44 of file vtkGPortView.cxx.

00044                                 {
00045     }

bbtk::vtkGPortView::~vtkGPortView (  ) 

Definition at line 49 of file vtkGPortView.cxx.

00049                                  {
00050     }


Member Function Documentation

void bbtk::vtkGObjectView::addVtkActors (  )  [protected, virtual, inherited]

Reimplemented in bbtk::vtkGBlackBoxView, bbtk::vtkGBoxView, and bbtk::vtkGComplexBoxPortView.

Definition at line 103 of file vtkGObjectView.cxx.

References bbtk::vtkGObjectView::_baseView, and bbtk::vtkGObjectView::_fillObjectActor.

Referenced by bbtk::vtkGObjectView::initVtkObjects().

00104         {               
00105                 _baseView->GetRenderer()->AddActor(_fillObjectActor);
00106                 _baseView->GetRenderer()->Render();
00107         }

Here is the caller graph for this function:

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

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

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

Reimplemented from bbtk::vtkGObjectView.

Definition at line 79 of file vtkGPortView.cxx.

References bbtk::vtkGObjectView::_fillObjectActor, bbtk::vtkGObjectView::_fillPolyMapper, bbtk::vtkGObjectView::_model, bbtk::vtkGObjectView::_pts, bbtk::GObjectModel::getFinalPoint(), bbtk::GObjectModel::getInicPoint(), and updateColors().

00080     {
00081         _pts = vtkPoints::New( ) ;
00082         _pts->SetNumberOfPoints( 3 ) ;
00083 
00084         double xInic , yInic , zInic , xFin , yFin , zFin ;
00085 
00086         _model->getInicPoint( xInic , yInic , zInic ) ;
00087         _model->getFinalPoint( xFin , yFin , zFin ) ;
00088 
00089         // RaC In the actual version, zInic=zFin=900
00090 
00091         double mid = ( xInic + xFin ) / 2 ;
00092 
00093         //EED           _pts->SetPoint(0, xInic, yInic, zInic );
00094         //EED           _pts->SetPoint(1, mid, yFin, zInic );
00095         //EED           _pts->SetPoint(2, xFin, yInic, zFin );                          
00096 
00097         _pts->SetPoint( 0 , -1000 , -1000 , -1000 ) ;
00098         _pts->SetPoint( 1 , mid , yFin , zInic ) ;
00099         _pts->SetPoint( 2 , 1000 , 1000 , 1000 ) ;
00100 
00101 
00103 
00104         vtkCellArray *strip = vtkCellArray::New( ) ;
00105         vtkPolyData *pdFill = vtkPolyData::New( ) ;
00106         _fillPolyMapper = vtkPolyDataMapper::New( ) ;
00107         _fillObjectActor = vtkActor::New( ) ;
00108 
00109         // RaC In the actual version, zInic=zFin=900
00110 
00111         strip->InsertNextCell( 3 ) ;
00112         strip->InsertCellPoint( 0 ) ;
00113         strip->InsertCellPoint( 1 ) ;
00114         strip->InsertCellPoint( 2 ) ;
00115 
00116         pdFill->SetPoints( _pts ) ;
00117         pdFill->SetStrips( strip ) ;
00118 
00119         _fillPolyMapper->SetInput( pdFill ) ;
00120         _fillObjectActor->SetMapper( _fillPolyMapper ) ;
00121         _fillPolyMapper->Modified( ) ;
00122 
00124 
00125         updateColors( ) ;
00126 
00127 
00128     }

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::vtkGObjectView::removeVtkActors (  )  [protected, virtual, inherited]

Reimplemented in bbtk::vtkGBlackBoxView, bbtk::vtkGBoxView, and bbtk::vtkGComplexBoxPortView.

Definition at line 111 of file vtkGObjectView.cxx.

References bbtk::vtkGObjectView::_baseView, and bbtk::vtkGObjectView::_fillObjectActor.

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

00112         {
00113                 _baseView->GetRenderer()->RemoveActor(_fillObjectActor);
00114                 _baseView->GetRenderer()->Render();
00115         }

Here is the caller graph for this function:

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(), update(), bbtk::vtkGComplexBoxPortView::update(), bbtk::vtkGBoxView::update(), and bbtk::vtkGBlackBoxView::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::vtkGPortView::update ( int  idController,
int  command 
) [virtual]

Reimplemented from bbtk::vtkGObjectView.

Definition at line 54 of file vtkGPortView.cxx.

References bbtk::vtkGObjectView::_fillPolyMapper, bbtk::vtkGObjectView::_model, bbtk::vtkGObjectView::_pts, bbtk::GObjectModel::getFinalPoint(), bbtk::GObjectModel::getInicPoint(), bbtk::vtkGObjectView::setRefreshWaiting(), and updateColors().

00054                                                               {
00055 
00056         updateColors( ) ;
00057 
00058         double xInic , yInic , zInic , xFin , yFin , zFin ;
00059 
00060         _model->getInicPoint( xInic , yInic , zInic ) ;
00061         _model->getFinalPoint( xFin , yFin , zFin ) ;
00062 
00063         // RaC In the actual version, zInic=zFin=900
00064 
00065         double mid = ( xInic + xFin ) / 2 ;
00066 
00067         _pts->SetPoint( 0 , xInic , yInic , zInic ) ;
00068         _pts->SetPoint( 1 , mid , yFin , zInic ) ;
00069         _pts->SetPoint( 2 , xFin , yInic , zFin ) ;
00070 
00071         _fillPolyMapper->Modified( ) ;
00072 
00073         //-----------
00074         setRefreshWaiting( ) ;
00075     }

Here is the call graph for this function:

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

Reimplemented from bbtk::vtkGObjectView.

Definition at line 132 of file vtkGPortView.cxx.

References bbtk::vtkGObjectView::_fillObjectActor, bbtk::vtkGObjectView::_model, bbtk::vtkGObjectView::_state, bbtk::HIGHLIGHTED, bbtk::GPortModel::isConnected(), bbtk::GPortModel::isValueSet(), bbtk::POSSIBLE_CONNECTION, and bbtk::SELECTED_POSSIBLE_CONNECTION.

Referenced by createVtkObjects(), and update().

00132                                      {
00133         _fillObjectActor->GetProperty( )->SetColor( 0.45 , 0.45 , 0.45 ) ;
00134 
00135         if ( _state == POSSIBLE_CONNECTION ) {
00136             _fillObjectActor->GetProperty( )->SetColor( 1 , 1 , 0 ) ;
00137         } else if ( _state == SELECTED_POSSIBLE_CONNECTION ) {
00138             _fillObjectActor->GetProperty( )->SetColor( 0 , 1 , 0 ) ;
00139         } else if ( _state == HIGHLIGHTED ) {
00140             _fillObjectActor->GetProperty( )->SetColor( 0 , 0 , 1 ) ;
00141         } else {
00142             GPortModel* portm = ( GPortModel* ) _model ;
00143             if ( portm->isConnected( ) ) {
00144                 _fillObjectActor->GetProperty( )->SetColor( 0.15 , 0.15 , 0.15 ) ;
00145             } else if ( portm->isValueSet( ) ) {
00146                 _fillObjectActor->GetProperty( )->SetColor( 0.55 , 0.25 , 0.25 ) ;
00147             } else {
00148                 _fillObjectActor->GetProperty( )->SetColor( 0.45 , 0.45 , 0.45 ) ;
00149             }
00150         }
00151     }

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]

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:50 2012 for bbtkGEditor by  doxygen 1.5.7.1