1 /*=========================================================================
6 Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc.
9 ParaView is a free software; you can redistribute it and/or modify it
10 under the terms of the ParaView license version 1.2.
12 See License_v1.2.txt for the full ParaView license.
13 A copy of this license can be obtained by contacting
16 Clifton Park, NY 12065
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
23 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 =========================================================================*/
33 // VSR 03/12/2014: the original file vtkPVAxesActor.cxx has been renamed to salomevtkPVAxesActor.cxx
34 // to avoid collisions with native VTK/ParaView classes
36 #include "salomevtkPVAxesActor.h" // changed by SALOME
37 #include "vtkObject.h"
38 #include "vtkObjectFactory.h"
41 #include "vtkPropCollection.h"
42 #include "vtkProperty.h"
43 #include "vtkRenderWindow.h"
44 #include "vtkTransform.h"
45 #include "vtkCylinderSource.h"
46 #include "vtkPolyDataMapper.h"
47 #include "vtkLineSource.h"
48 #include "vtkPolyData.h"
49 #include "vtkConeSource.h"
50 #include "vtkSphereSource.h"
51 #include "vtkVectorText.h"
52 #include "vtkFollower.h"
53 #include "vtkRenderer.h"
57 // VSR 03/12/2014: we put classes copied from VTK/ParaView to the specific namespace
58 // to avoid collisions with native VTK/ParaView classes
62 vtkStandardNewMacro(vtkPVAxesActor);
64 vtkCxxSetObjectMacro( vtkPVAxesActor, UserDefinedTip, vtkPolyData );
65 vtkCxxSetObjectMacro( vtkPVAxesActor, UserDefinedShaft, vtkPolyData );
67 //-----------------------------------------------------------------------------
68 vtkPVAxesActor::vtkPVAxesActor()
70 this->XAxisLabelText = NULL;
71 this->YAxisLabelText = NULL;
72 this->ZAxisLabelText = NULL;
74 this->SetXAxisLabelText("X");
75 this->SetYAxisLabelText("Y");
76 this->SetZAxisLabelText("Z");
78 //colors chosen to match the output of vtkAxes.cxx's LUT.
79 this->XAxisShaft = vtkActor::New();
80 this->XAxisShaft->GetProperty()->SetColor(1, 0, 0);
81 this->YAxisShaft = vtkActor::New();
82 this->YAxisShaft->GetProperty()->SetColor(1, 1, 0);
83 this->ZAxisShaft = vtkActor::New();
84 this->ZAxisShaft->GetProperty()->SetColor(0, 1, 0);
86 this->XAxisTip = vtkActor::New();
87 this->XAxisTip->GetProperty()->SetColor(1, 0, 0);
88 this->YAxisTip = vtkActor::New();
89 this->YAxisTip->GetProperty()->SetColor(1, 1, 0);
90 this->ZAxisTip = vtkActor::New();
91 this->ZAxisTip->GetProperty()->SetColor(0, 1, 0);
93 this->CylinderSource = vtkCylinderSource::New();
94 this->CylinderSource->SetHeight(1.0);
96 this->LineSource = vtkLineSource::New();
97 this->LineSource->SetPoint1( 0.0, 0.0, 0.0 );
98 this->LineSource->SetPoint2( 0.0, 1.0, 0.0 );
100 this->ConeSource = vtkConeSource::New();
101 this->ConeSource->SetDirection( 0, 1, 0 );
102 this->ConeSource->SetHeight( 1.0 );
104 this->SphereSource = vtkSphereSource::New();
106 vtkPolyDataMapper *shaftMapper = vtkPolyDataMapper::New();
108 this->XAxisShaft->SetMapper( shaftMapper );
109 this->YAxisShaft->SetMapper( shaftMapper );
110 this->ZAxisShaft->SetMapper( shaftMapper );
112 shaftMapper->Delete();
114 vtkPolyDataMapper *tipMapper = vtkPolyDataMapper::New();
116 this->XAxisTip->SetMapper( tipMapper );
117 this->YAxisTip->SetMapper( tipMapper );
118 this->ZAxisTip->SetMapper( tipMapper );
122 this->TotalLength[0] = 1.0;
123 this->TotalLength[1] = 1.0;
124 this->TotalLength[2] = 1.0;
126 this->NormalizedShaftLength[0] = 0.8;
127 this->NormalizedShaftLength[1] = 0.8;
128 this->NormalizedShaftLength[2] = 0.8;
130 this->NormalizedTipLength[0] = 0.2;
131 this->NormalizedTipLength[1] = 0.2;
132 this->NormalizedTipLength[2] = 0.2;
134 this->ConeResolution = 16;
135 this->SphereResolution = 16;
136 this->CylinderResolution = 16;
138 this->ConeRadius = 0.4;
139 this->SphereRadius = 0.5;
140 this->CylinderRadius = 0.05;
142 this->XAxisLabelPosition = 1;
143 this->YAxisLabelPosition = 1;
144 this->ZAxisLabelPosition = 1;
146 this->ShaftType = vtkPVAxesActor::LINE_SHAFT;
147 this->TipType = vtkPVAxesActor::CONE_TIP;
149 this->UserDefinedTip = NULL;
150 this->UserDefinedShaft = NULL;
152 this->XAxisVectorText = vtkVectorText::New();
153 this->YAxisVectorText = vtkVectorText::New();
154 this->ZAxisVectorText = vtkVectorText::New();
156 this->XAxisLabel = vtkFollower::New();
157 this->YAxisLabel = vtkFollower::New();
158 this->ZAxisLabel = vtkFollower::New();
160 vtkPolyDataMapper *xmapper = vtkPolyDataMapper::New();
161 vtkPolyDataMapper *ymapper = vtkPolyDataMapper::New();
162 vtkPolyDataMapper *zmapper = vtkPolyDataMapper::New();
164 xmapper->SetInputConnection( this->XAxisVectorText->GetOutputPort() );
165 ymapper->SetInputConnection( this->YAxisVectorText->GetOutputPort() );
166 zmapper->SetInputConnection( this->ZAxisVectorText->GetOutputPort() );
168 this->XAxisLabel->SetMapper( xmapper );
169 this->YAxisLabel->SetMapper( ymapper );
170 this->ZAxisLabel->SetMapper( zmapper );
179 //-----------------------------------------------------------------------------
180 vtkPVAxesActor::~vtkPVAxesActor()
182 this->CylinderSource->Delete();
183 this->LineSource->Delete();
184 this->ConeSource->Delete();
185 this->SphereSource->Delete();
187 this->XAxisShaft->Delete();
188 this->YAxisShaft->Delete();
189 this->ZAxisShaft->Delete();
191 this->XAxisTip->Delete();
192 this->YAxisTip->Delete();
193 this->ZAxisTip->Delete();
195 this->SetUserDefinedTip( NULL );
196 this->SetUserDefinedShaft( NULL );
198 this->SetXAxisLabelText( NULL );
199 this->SetYAxisLabelText( NULL );
200 this->SetZAxisLabelText( NULL );
202 this->XAxisVectorText->Delete();
203 this->YAxisVectorText->Delete();
204 this->ZAxisVectorText->Delete();
206 this->XAxisLabel->Delete();
207 this->YAxisLabel->Delete();
208 this->ZAxisLabel->Delete();
211 //-----------------------------------------------------------------------------
212 // Shallow copy of an actor.
213 void vtkPVAxesActor::ShallowCopy(vtkProp *prop)
215 vtkPVAxesActor *a = vtkPVAxesActor::SafeDownCast(prop);
221 this->vtkProp3D::ShallowCopy(prop);
224 //-----------------------------------------------------------------------------
225 void vtkPVAxesActor::GetActors(vtkPropCollection *ac)
227 ac->AddItem(this->XAxisShaft);
228 ac->AddItem(this->YAxisShaft);
229 ac->AddItem(this->ZAxisShaft);
230 ac->AddItem(this->XAxisTip);
231 ac->AddItem(this->YAxisTip);
232 ac->AddItem(this->ZAxisTip);
233 ac->AddItem(this->XAxisLabel);
234 ac->AddItem(this->YAxisLabel);
235 ac->AddItem(this->ZAxisLabel);
239 //-----------------------------------------------------------------------------
240 int vtkPVAxesActor::RenderOpaqueGeometry(vtkViewport *vp)
242 int renderedSomething = 0;
244 vtkRenderer *ren = vtkRenderer::SafeDownCast( vp );
248 this->XAxisLabel->SetCamera( ren->GetActiveCamera() );
249 this->YAxisLabel->SetCamera( ren->GetActiveCamera() );
250 this->ZAxisLabel->SetCamera( ren->GetActiveCamera() );
252 this->XAxisShaft->RenderOpaqueGeometry(vp);
253 this->YAxisShaft->RenderOpaqueGeometry(vp);
254 this->ZAxisShaft->RenderOpaqueGeometry(vp);
256 this->XAxisTip->RenderOpaqueGeometry(vp);
257 this->YAxisTip->RenderOpaqueGeometry(vp);
258 this->ZAxisTip->RenderOpaqueGeometry(vp);
260 this->XAxisLabel->RenderOpaqueGeometry(vp);
261 this->YAxisLabel->RenderOpaqueGeometry(vp);
262 this->ZAxisLabel->RenderOpaqueGeometry(vp);
264 return renderedSomething;
267 //-----------------------------------------------------------------------------
268 #if (VTK_MAJOR_VERSION>5 || VTK_MINOR_VERSION>=2)
269 // porting to VTK 5.0.x
270 int vtkPVAxesActor::RenderTranslucentPolygonalGeometry(vtkViewport *vp)
272 int renderedSomething=0;
276 renderedSomething += this->XAxisShaft->RenderTranslucentPolygonalGeometry(vp);
277 renderedSomething += this->YAxisShaft->RenderTranslucentPolygonalGeometry(vp);
278 renderedSomething += this->ZAxisShaft->RenderTranslucentPolygonalGeometry(vp);
280 renderedSomething += this->XAxisTip->RenderTranslucentPolygonalGeometry(vp);
281 renderedSomething += this->YAxisTip->RenderTranslucentPolygonalGeometry(vp);
282 renderedSomething += this->ZAxisTip->RenderTranslucentPolygonalGeometry(vp);
284 renderedSomething += this->XAxisLabel->RenderTranslucentPolygonalGeometry(vp);
285 renderedSomething += this->YAxisLabel->RenderTranslucentPolygonalGeometry(vp);
286 renderedSomething += this->ZAxisLabel->RenderTranslucentPolygonalGeometry(vp);
288 return renderedSomething;
291 //-----------------------------------------------------------------------------
292 // porting to VTK 5.0.x
293 int vtkPVAxesActor::HasTranslucentPolygonalGeometry()
299 result |= this->XAxisShaft->HasTranslucentPolygonalGeometry();
300 result |= this->YAxisShaft->HasTranslucentPolygonalGeometry();
301 result |= this->ZAxisShaft->HasTranslucentPolygonalGeometry();
303 result |= this->XAxisTip->HasTranslucentPolygonalGeometry();
304 result |= this->YAxisTip->HasTranslucentPolygonalGeometry();
305 result |= this->ZAxisTip->HasTranslucentPolygonalGeometry();
307 result |= this->XAxisLabel->HasTranslucentPolygonalGeometry();
308 result |= this->YAxisLabel->HasTranslucentPolygonalGeometry();
309 result |= this->ZAxisLabel->HasTranslucentPolygonalGeometry();
315 //-----------------------------------------------------------------------------
316 // porting to VTK 5.0.x
317 int vtkPVAxesActor::RenderTranslucentGeometry(vtkViewport *vp)
319 int renderedSomething=0;
323 renderedSomething += this->XAxisShaft->RenderTranslucentGeometry(vp);
324 renderedSomething += this->YAxisShaft->RenderTranslucentGeometry(vp);
325 renderedSomething += this->ZAxisShaft->RenderTranslucentGeometry(vp);
327 renderedSomething += this->XAxisTip->RenderTranslucentGeometry(vp);
328 renderedSomething += this->YAxisTip->RenderTranslucentGeometry(vp);
329 renderedSomething += this->ZAxisTip->RenderTranslucentGeometry(vp);
331 renderedSomething += this->XAxisLabel->RenderTranslucentGeometry(vp);
332 renderedSomething += this->YAxisLabel->RenderTranslucentGeometry(vp);
333 renderedSomething += this->ZAxisLabel->RenderTranslucentGeometry(vp);
335 return renderedSomething;
339 //-----------------------------------------------------------------------------
340 void vtkPVAxesActor::ReleaseGraphicsResources(vtkWindow *win)
342 this->XAxisShaft->ReleaseGraphicsResources( win );
343 this->YAxisShaft->ReleaseGraphicsResources( win );
344 this->ZAxisShaft->ReleaseGraphicsResources( win );
346 this->XAxisTip->ReleaseGraphicsResources( win );
347 this->YAxisTip->ReleaseGraphicsResources( win );
348 this->ZAxisTip->ReleaseGraphicsResources( win );
350 this->XAxisLabel->ReleaseGraphicsResources( win );
351 this->YAxisLabel->ReleaseGraphicsResources( win );
352 this->ZAxisLabel->ReleaseGraphicsResources( win );
355 //-----------------------------------------------------------------------------
356 void vtkPVAxesActor::GetBounds(double bounds[6])
358 double *bds = this->GetBounds();
367 //-----------------------------------------------------------------------------
368 // Get the bounds for this Actor as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
369 double *vtkPVAxesActor::GetBounds()
374 this->XAxisShaft->GetBounds(this->Bounds);
376 this->YAxisShaft->GetBounds(bounds);
379 this->Bounds[2*i+1] =
380 (bounds[2*i+1]>this->Bounds[2*i+1])?(bounds[2*i+1]):(this->Bounds[2*i+1]);
383 this->ZAxisShaft->GetBounds(bounds);
386 this->Bounds[2*i+1] =
387 (bounds[2*i+1]>this->Bounds[2*i+1])?(bounds[2*i+1]):(this->Bounds[2*i+1]);
390 this->XAxisTip->GetBounds(bounds);
393 this->Bounds[2*i+1] =
394 (bounds[2*i+1]>this->Bounds[2*i+1])?(bounds[2*i+1]):(this->Bounds[2*i+1]);
397 this->YAxisTip->GetBounds(bounds);
400 this->Bounds[2*i+1] =
401 (bounds[2*i+1]>this->Bounds[2*i+1])?(bounds[2*i+1]):(this->Bounds[2*i+1]);
404 this->ZAxisTip->GetBounds(bounds);
407 this->Bounds[2*i+1] =
408 (bounds[2*i+1]>this->Bounds[2*i+1])?(bounds[2*i+1]):(this->Bounds[2*i+1]);
412 (vtkPolyDataMapper::SafeDownCast(this->YAxisShaft->GetMapper()))->
413 GetInput()->GetBounds( dbounds );
417 this->Bounds[2*i+1] =
418 (dbounds[2*i+1]>this->Bounds[2*i+1])?(dbounds[2*i+1]):(this->Bounds[2*i+1]);
421 // We want this actor to rotate / re-center about the origin, so give it
422 // the bounds it would have if the axes were symmetrical.
423 for (i = 0; i < 3; i++)
425 this->Bounds[2*i] = -this->Bounds[2*i+1];
431 //-----------------------------------------------------------------------------
432 vtkMTimeType vtkPVAxesActor::GetMTime()
434 vtkMTimeType mTime=this->Superclass::GetMTime();
439 //-----------------------------------------------------------------------------
440 vtkMTimeType vtkPVAxesActor::GetRedrawMTime()
442 vtkMTimeType mTime =this->GetMTime();
447 //-----------------------------------------------------------------------------
448 vtkProperty *vtkPVAxesActor::GetXAxisTipProperty()
450 return this->XAxisTip->GetProperty();
453 //-----------------------------------------------------------------------------
454 vtkProperty *vtkPVAxesActor::GetYAxisTipProperty()
456 return this->YAxisTip->GetProperty();
459 //-----------------------------------------------------------------------------
460 vtkProperty *vtkPVAxesActor::GetZAxisTipProperty()
462 return this->ZAxisTip->GetProperty();
465 //-----------------------------------------------------------------------------
466 vtkProperty *vtkPVAxesActor::GetXAxisShaftProperty()
468 return this->XAxisShaft->GetProperty();
471 //-----------------------------------------------------------------------------
472 vtkProperty *vtkPVAxesActor::GetYAxisShaftProperty()
474 return this->YAxisShaft->GetProperty();
477 //-----------------------------------------------------------------------------
478 vtkProperty *vtkPVAxesActor::GetZAxisShaftProperty()
480 return this->ZAxisShaft->GetProperty();
483 //-----------------------------------------------------------------------------
484 vtkProperty *vtkPVAxesActor::GetXAxisLabelProperty()
486 return this->XAxisLabel->GetProperty();
489 //-----------------------------------------------------------------------------
490 vtkProperty *vtkPVAxesActor::GetYAxisLabelProperty()
492 return this->YAxisLabel->GetProperty();
495 //-----------------------------------------------------------------------------
496 vtkProperty *vtkPVAxesActor::GetZAxisLabelProperty()
498 return this->ZAxisLabel->GetProperty();
501 //-----------------------------------------------------------------------------
502 void vtkPVAxesActor::SetTotalLength( float x, float y, float z )
504 if ( this->TotalLength[0] != x ||
505 this->TotalLength[1] != y ||
506 this->TotalLength[2] != z )
508 this->TotalLength[0] = x;
509 this->TotalLength[1] = y;
510 this->TotalLength[2] = z;
518 //-----------------------------------------------------------------------------
519 void vtkPVAxesActor::SetNormalizedShaftLength( float x, float y, float z )
521 if ( this->NormalizedShaftLength[0] != x ||
522 this->NormalizedShaftLength[1] != y ||
523 this->NormalizedShaftLength[2] != z )
525 this->NormalizedShaftLength[0] = x;
526 this->NormalizedShaftLength[1] = y;
527 this->NormalizedShaftLength[2] = z;
535 //-----------------------------------------------------------------------------
536 void vtkPVAxesActor::SetNormalizedTipLength( float x, float y, float z )
538 if ( this->NormalizedTipLength[0] != x ||
539 this->NormalizedTipLength[1] != y ||
540 this->NormalizedTipLength[2] != z )
542 this->NormalizedTipLength[0] = x;
543 this->NormalizedTipLength[1] = y;
544 this->NormalizedTipLength[2] = z;
552 //-----------------------------------------------------------------------------
553 void vtkPVAxesActor::SetShaftType( int type )
555 if ( this->ShaftType != type )
557 this->ShaftType = type;
565 //-----------------------------------------------------------------------------
566 void vtkPVAxesActor::SetTipType( int type )
568 if ( this->TipType != type )
570 this->TipType = type;
578 //-----------------------------------------------------------------------------
579 void vtkPVAxesActor::UpdateProps()
581 this->CylinderSource->SetRadius(this->CylinderRadius);
582 this->CylinderSource->SetResolution(this->CylinderResolution);
585 this->ConeSource->SetResolution(this->ConeResolution);
586 this->ConeSource->SetRadius(this->ConeRadius);
588 this->SphereSource->SetThetaResolution( this->SphereResolution );
589 this->SphereSource->SetPhiResolution( this->SphereResolution );
590 this->SphereSource->SetRadius(this->SphereRadius);
592 switch ( this->ShaftType )
594 case vtkPVAxesActor::CYLINDER_SHAFT:
595 (vtkPolyDataMapper::SafeDownCast(this->XAxisShaft->GetMapper()))->
596 SetInputConnection( this->CylinderSource->GetOutputPort() );
598 case vtkPVAxesActor::LINE_SHAFT:
599 (vtkPolyDataMapper::SafeDownCast(this->XAxisShaft->GetMapper()))->
600 SetInputConnection( this->LineSource->GetOutputPort() );
602 case vtkPVAxesActor::USER_DEFINED_SHAFT:
603 (vtkPolyDataMapper::SafeDownCast(this->XAxisShaft->GetMapper()))->
604 SetInputData( this->UserDefinedShaft );
607 switch ( this->TipType )
609 case vtkPVAxesActor::CONE_TIP:
610 (vtkPolyDataMapper::SafeDownCast(this->XAxisTip->GetMapper()))->
611 SetInputConnection( this->ConeSource->GetOutputPort() );
613 case vtkPVAxesActor::SPHERE_TIP:
614 (vtkPolyDataMapper::SafeDownCast(this->XAxisTip->GetMapper()))->
615 SetInputConnection( this->SphereSource->GetOutputPort() );
617 case vtkPVAxesActor::USER_DEFINED_TIP:
618 (vtkPolyDataMapper::SafeDownCast(this->XAxisTip->GetMapper()))->
619 SetInputData( this->UserDefinedTip );
622 (vtkPolyDataMapper::SafeDownCast(this->XAxisTip->GetMapper()))->Update();
623 (vtkPolyDataMapper::SafeDownCast(this->XAxisShaft->GetMapper()))->Update();
630 (vtkPolyDataMapper::SafeDownCast(this->XAxisShaft->GetMapper()))->
631 GetInput()->GetBounds( bounds );
634 for ( i = 0; i < 3; i++ )
637 this->NormalizedShaftLength[i]*this->TotalLength[i] /
638 (bounds[3] - bounds[2]);
641 vtkTransform *xTransform = vtkTransform::New();
642 vtkTransform *yTransform = vtkTransform::New();
643 vtkTransform *zTransform = vtkTransform::New();
645 xTransform->RotateZ( -90 );
646 zTransform->RotateX( 90 );
648 xTransform->Scale( scale[0], scale[0], scale[0] );
649 yTransform->Scale( scale[1], scale[1], scale[1] );
650 zTransform->Scale( scale[2], scale[2], scale[2] );
652 xTransform->Translate( -(bounds[0]+bounds[1])/2,
654 -(bounds[4]+bounds[5])/2 );
655 yTransform->Translate( -(bounds[0]+bounds[1])/2,
657 -(bounds[4]+bounds[5])/2 );
658 zTransform->Translate( -(bounds[0]+bounds[1])/2,
660 -(bounds[4]+bounds[5])/2 );
664 this->XAxisShaft->SetUserTransform( xTransform );
665 this->YAxisShaft->SetUserTransform( yTransform );
666 this->ZAxisShaft->SetUserTransform( zTransform );
668 xTransform->Delete();
669 yTransform->Delete();
670 zTransform->Delete();
672 (vtkPolyDataMapper::SafeDownCast(this->XAxisTip->GetMapper()))->
673 GetInput()->GetBounds( bounds );
675 xTransform = vtkTransform::New();
676 yTransform = vtkTransform::New();
677 zTransform = vtkTransform::New();
679 xTransform->RotateZ( -90 );
680 zTransform->RotateX( 90 );
682 xTransform->Scale( this->TotalLength[0], this->TotalLength[0], this->TotalLength[0] );
683 yTransform->Scale( this->TotalLength[1], this->TotalLength[1], this->TotalLength[1] );
684 zTransform->Scale( this->TotalLength[2], this->TotalLength[2], this->TotalLength[2] );
686 xTransform->Translate( 0, (1.0 - this->NormalizedTipLength[0]), 0 );
687 yTransform->Translate( 0, (1.0 - this->NormalizedTipLength[1]), 0 );
688 zTransform->Translate( 0, (1.0 - this->NormalizedTipLength[2]), 0 );
690 xTransform->Scale( this->NormalizedTipLength[0],
691 this->NormalizedTipLength[0],
692 this->NormalizedTipLength[0] );
694 yTransform->Scale( this->NormalizedTipLength[1],
695 this->NormalizedTipLength[1],
696 this->NormalizedTipLength[1] );
698 zTransform->Scale( this->NormalizedTipLength[2],
699 this->NormalizedTipLength[2],
700 this->NormalizedTipLength[2] );
702 xTransform->Translate( -(bounds[0]+bounds[1])/2,
704 -(bounds[4]+bounds[5])/2 );
705 yTransform->Translate( -(bounds[0]+bounds[1])/2,
707 -(bounds[4]+bounds[5])/2 );
708 zTransform->Translate( -(bounds[0]+bounds[1])/2,
710 -(bounds[4]+bounds[5])/2 );
713 this->XAxisTip->SetUserTransform( xTransform );
714 this->YAxisTip->SetUserTransform( yTransform );
715 this->ZAxisTip->SetUserTransform( zTransform );
717 xTransform->Delete();
718 yTransform->Delete();
719 zTransform->Delete();
721 this->XAxisVectorText->SetText( this->XAxisLabelText );
722 this->YAxisVectorText->SetText( this->YAxisLabelText );
723 this->ZAxisVectorText->SetText( this->ZAxisLabelText );
727 (this->TotalLength[0] + this->TotalLength[1] + this->TotalLength[2])/15;
729 this->XAxisShaft->GetBounds(bounds);
730 this->XAxisLabel->SetScale( avgScale, avgScale, avgScale );
731 this->XAxisLabel->SetPosition( bounds[0] + this->XAxisLabelPosition *
732 (bounds[1]-bounds[0]),
733 bounds[2] - (bounds[3]-bounds[2])*2.0,
734 bounds[5] + (bounds[5]-bounds[4])/2.0 );
736 this->YAxisShaft->GetBounds(bounds);
737 this->YAxisLabel->SetScale( avgScale, avgScale, avgScale );
738 this->YAxisLabel->SetPosition( (bounds[0]+bounds[1])/2,
739 bounds[2] + this->YAxisLabelPosition *
740 (bounds[3]-bounds[2]),
741 bounds[5] + (bounds[5]-bounds[4])/2.0 );
743 this->ZAxisShaft->GetBounds(bounds);
744 this->ZAxisLabel->SetScale( avgScale, avgScale, avgScale );
745 this->ZAxisLabel->SetPosition( bounds[0],
746 bounds[2] - (bounds[3]-bounds[2])*2.0,
747 bounds[4] + this->ZAxisLabelPosition *
748 (bounds[5]-bounds[4]) );
751 //-----------------------------------------------------------------------------
752 void vtkPVAxesActor::PrintSelf(ostream& os, vtkIndent indent)
754 this->Superclass::PrintSelf(os,indent);
756 os << indent << "UserDefinedShaft: ";
757 if (this->UserDefinedShaft)
759 os << this->UserDefinedShaft << endl;
763 os << "(none)" << endl;
766 os << indent << "UserDefinedTip: ";
767 if (this->UserDefinedTip)
769 os << this->UserDefinedTip << endl;
773 os << "(none)" << endl;
776 os << indent << "XAxisLabelText: " << (this->XAxisLabelText ?
777 this->XAxisLabelText : "(none)")
779 os << indent << "YAxisLabelText: " << (this->YAxisLabelText ?
780 this->YAxisLabelText : "(none)")
782 os << indent << "ZAxisLabelText: " << (this->ZAxisLabelText ?
783 this->ZAxisLabelText : "(none)")
785 os << indent << "XAxisLabelPosition: " << this->XAxisLabelPosition << endl;
786 os << indent << "YAxisLabelPosition: " << this->YAxisLabelPosition << endl;
787 os << indent << "ZAxisLabelPosition: " << this->ZAxisLabelPosition << endl;
789 os << indent << "SphereRadius: " << this->SphereRadius << endl;
790 os << indent << "SphereResolution: " << this->SphereResolution << endl;
791 os << indent << "CylinderRadius: " << this->CylinderRadius << endl;
792 os << indent << "CylinderResolution: " << this->CylinderResolution << endl;
793 os << indent << "ConeRadius: " << this->ConeRadius << endl;
794 os << indent << "ConeResolution: " << this->ConeResolution << endl;
796 os << indent << "NormalizedShaftLength: "
797 << this->NormalizedShaftLength[0] << ","
798 << this->NormalizedShaftLength[1] << ","
799 << this->NormalizedShaftLength[2] << endl;
800 os << indent << "NormalizedTipLength: "
801 << this->NormalizedTipLength[0] << ","
802 << this->NormalizedTipLength[1] << ","
803 << this->NormalizedTipLength[2] << endl;
804 os << indent << "TotalLength: "
805 << this->TotalLength[0] << ","
806 << this->TotalLength[1] << ","
807 << this->TotalLength[2] << endl;
810 //-----------------------------------------------------------------------------
811 // porting to VTK 5.0.x
812 void vtkPVAxesActor::AddToRender( vtkRenderer* theRenderer )
814 theRenderer->AddActor(this->XAxisLabel);
815 theRenderer->AddActor(this->YAxisLabel);
816 theRenderer->AddActor(this->ZAxisLabel);
819 } // end of salomevtk namespace