5 #include <vtkArrowSource.h> 6 #include <vtkPolyDataMapper.h> 7 #include <vtkPolyDataNormals.h> 8 #include <vtkProperty.h> 12 Arrow::Arrow(
DAFFViz::SGNode* pParentNode,
double dTipLength,
double dTipRadius,
int iTipResolution,
double dShaftRadius,
int iShaftResolution )
19 m_pSource->SetTipLength( dTipLength );
20 m_pSource->SetTipRadius( dTipRadius );
21 m_pSource->SetTipResolution( iTipResolution );
22 m_pSource->SetShaftRadius( dShaftRadius );
23 m_pSource->SetShaftResolution( iShaftResolution );
34 m_pSource = vtkSmartPointer<vtkArrowSource>::New();
36 m_pMapper = vtkSmartPointer< vtkPolyDataMapper >::New();
37 m_pMapper->SetInputConnection( m_pSource->GetOutputPort() );
39 m_pActor = vtkSmartPointer< vtkActor >::New();
40 m_pActor->SetMapper( m_pMapper );
42 m_pActor->GetProperty()->SetInterpolationToGouraud();
43 m_pActor->GetProperty()->SetDiffuse( 0.9 );
44 m_pActor->GetProperty()->SetAmbient( 0.4 );
53 return m_pSource->GetTipLength();
57 m_pSource->SetTipLength( dLength );
61 return m_pSource->GetTipLength();
65 m_pSource->SetTipLength( dRadius );
69 m_pSource->SetTipResolution( iResolution );
73 return m_pSource->GetTipResolution();
77 return m_pSource->GetShaftRadius();
81 m_pSource->SetShaftRadius( dRadius );
85 return m_pSource->GetShaftResolution();
89 m_pSource->SetShaftResolution( iResolution );
97 m_pActor->GetProperty()->SetColor( r, g, b );
102 m_pActor->GetProperty()->GetColor( r, g, b );
106 return m_pActor->GetProperty()->GetOpacity();
111 m_pActor->GetProperty()->SetOpacity( a );
121 m_pActor->VisibilityOn();
123 m_pActor->VisibilityOff();
128 return m_pActor->GetVisibility() > 0 ?
true :
false;
void SetAlpha(double a)
Alpha setter.
bool IsVisible() const
Get visibility.
void AddActor(vtkSmartPointer< vtkActor > pActor)
Add a VTK actor to the node.
Arrow(DAFFViz::SGNode *pParentNode=NULL, double dTipLength=.15f, double dTipRadius=.06f, int iTipResolution=36, double dShaftRadius=.02f, int iShaftResolution=36)
Constructor.
double GetAlpha() const
Alpha getter.
void SetTipLength(double dLength)
Tip length setter.
void RemoveActor(vtkSmartPointer< vtkActor > pActor)
Remove a VTK actor from the assembly of the node.
double GetTipRadius() const
Tip radius getter.
int GetShaftResolution() const
Shaft resolution getter.
void SetVisible(bool bVisible)
Set visibility.
double GetShaftRadius() const
Shaft radius getter.
int GetTipResolution() const
Tip resolution getter.
virtual void SetVisible(bool bVisible)
Set visibility.
double GetTipLength() const
Tip length getter.
void SetColor(double r, double g, double b)
Color setter.
Base class for scene graph nodes.
void SetTipRadius(double dRadius)
Tip radius setter.
void GetColor(double &r, double &g, double &b)
Color getter.
void SetShaftRadius(double dRadius)
Shaft radius setter.
void SetShaftResolution(int iResolution)
Shaft resolution setter.
#define DAFFVIZ_UNLOCK_VTK
void SetTipResolution(int iResolution)
Tip resolution setter.