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 =========================================================================*/
32 #include "vtkPVAxesActor.h"
33 #include "vtkObject.h"
34 #include "vtkObjectFactory.h"
37 #include "vtkPropCollection.h"
38 #include "vtkProperty.h"
39 #include "vtkRenderWindow.h"
40 #include "vtkTransform.h"
41 #include "vtkCylinderSource.h"
42 #include "vtkPolyDataMapper.h"
43 #include "vtkLineSource.h"
44 #include "vtkPolyData.h"
45 #include "vtkConeSource.h"
46 #include "vtkSphereSource.h"
47 #include "vtkVectorText.h"
48 #include "vtkFollower.h"
49 #include "vtkRenderer.h"
53 vtkCxxRevisionMacro(vtkPVAxesActor, "$Revision$");
54 vtkStandardNewMacro(vtkPVAxesActor);
56 vtkCxxSetObjectMacro( vtkPVAxesActor, UserDefinedTip, vtkPolyData );
57 vtkCxxSetObjectMacro( vtkPVAxesActor, UserDefinedShaft, vtkPolyData );
59 //-----------------------------------------------------------------------------
60 vtkPVAxesActor::vtkPVAxesActor()
62 this->XAxisLabelText = NULL;
63 this->YAxisLabelText = NULL;
64 this->ZAxisLabelText = NULL;
66 this->SetXAxisLabelText("X");
67 this->SetYAxisLabelText("Y");
68 this->SetZAxisLabelText("Z");
70 //colors chosen to match the output of vtkAxes.cxx's LUT.
71 this->XAxisShaft = vtkActor::New();
72 this->XAxisShaft->GetProperty()->SetColor(1, 0, 0);
73 this->YAxisShaft = vtkActor::New();
74 this->YAxisShaft->GetProperty()->SetColor(1, 1, 0);
75 this->ZAxisShaft = vtkActor::New();
76 this->ZAxisShaft->GetProperty()->SetColor(0, 1, 0);
78 this->XAxisTip = vtkActor::New();
79 this->XAxisTip->GetProperty()->SetColor(1, 0, 0);
80 this->YAxisTip = vtkActor::New();
81 this->YAxisTip->GetProperty()->SetColor(1, 1, 0);
82 this->ZAxisTip = vtkActor::New();
83 this->ZAxisTip->GetProperty()->SetColor(0, 1, 0);
85 this->CylinderSource = vtkCylinderSource::New();
86 this->CylinderSource->SetHeight(1.0);
88 this->LineSource = vtkLineSource::New();
89 this->LineSource->SetPoint1( 0.0, 0.0, 0.0 );
90 this->LineSource->SetPoint2( 0.0, 1.0, 0.0 );
92 this->ConeSource = vtkConeSource::New();
93 this->ConeSource->SetDirection( 0, 1, 0 );
94 this->ConeSource->SetHeight( 1.0 );
96 this->SphereSource = vtkSphereSource::New();
98 vtkPolyDataMapper *shaftMapper = vtkPolyDataMapper::New();
100 this->XAxisShaft->SetMapper( shaftMapper );
101 this->YAxisShaft->SetMapper( shaftMapper );
102 this->ZAxisShaft->SetMapper( shaftMapper );
104 shaftMapper->Delete();
106 vtkPolyDataMapper *tipMapper = vtkPolyDataMapper::New();
108 this->XAxisTip->SetMapper( tipMapper );
109 this->YAxisTip->SetMapper( tipMapper );
110 this->ZAxisTip->SetMapper( tipMapper );
114 this->TotalLength[0] = 1.0;
115 this->TotalLength[1] = 1.0;
116 this->TotalLength[2] = 1.0;
118 this->NormalizedShaftLength[0] = 0.8;
119 this->NormalizedShaftLength[1] = 0.8;
120 this->NormalizedShaftLength[2] = 0.8;
122 this->NormalizedTipLength[0] = 0.2;
123 this->NormalizedTipLength[1] = 0.2;
124 this->NormalizedTipLength[2] = 0.2;
126 this->ConeResolution = 16;
127 this->SphereResolution = 16;
128 this->CylinderResolution = 16;
130 this->ConeRadius = 0.4;
131 this->SphereRadius = 0.5;
132 this->CylinderRadius = 0.05;
134 this->XAxisLabelPosition = 1;
135 this->YAxisLabelPosition = 1;
136 this->ZAxisLabelPosition = 1;
138 this->ShaftType = vtkPVAxesActor::LINE_SHAFT;
139 this->TipType = vtkPVAxesActor::CONE_TIP;
141 this->UserDefinedTip = NULL;
142 this->UserDefinedShaft = NULL;
144 this->XAxisVectorText = vtkVectorText::New();
145 this->YAxisVectorText = vtkVectorText::New();
146 this->ZAxisVectorText = vtkVectorText::New();
148 this->XAxisLabel = vtkFollower::New();
149 this->YAxisLabel = vtkFollower::New();
150 this->ZAxisLabel = vtkFollower::New();
152 vtkPolyDataMapper *xmapper = vtkPolyDataMapper::New();
153 vtkPolyDataMapper *ymapper = vtkPolyDataMapper::New();
154 vtkPolyDataMapper *zmapper = vtkPolyDataMapper::New();
156 xmapper->SetInput( this->XAxisVectorText->GetOutput() );
157 ymapper->SetInput( this->YAxisVectorText->GetOutput() );
158 zmapper->SetInput( this->ZAxisVectorText->GetOutput() );
160 this->XAxisLabel->SetMapper( xmapper );
161 this->YAxisLabel->SetMapper( ymapper );
162 this->ZAxisLabel->SetMapper( zmapper );
171 //-----------------------------------------------------------------------------
172 vtkPVAxesActor::~vtkPVAxesActor()
174 this->CylinderSource->Delete();
175 this->LineSource->Delete();
176 this->ConeSource->Delete();
177 this->SphereSource->Delete();
179 this->XAxisShaft->Delete();
180 this->YAxisShaft->Delete();
181 this->ZAxisShaft->Delete();
183 this->XAxisTip->Delete();
184 this->YAxisTip->Delete();
185 this->ZAxisTip->Delete();
187 this->SetUserDefinedTip( NULL );
188 this->SetUserDefinedShaft( NULL );
190 this->SetXAxisLabelText( NULL );
191 this->SetYAxisLabelText( NULL );
192 this->SetZAxisLabelText( NULL );
194 this->XAxisVectorText->Delete();
195 this->YAxisVectorText->Delete();
196 this->ZAxisVectorText->Delete();
198 this->XAxisLabel->Delete();
199 this->YAxisLabel->Delete();
200 this->ZAxisLabel->Delete();
203 //-----------------------------------------------------------------------------
204 // Shallow copy of an actor.
205 void vtkPVAxesActor::ShallowCopy(vtkProp *prop)
207 vtkPVAxesActor *a = vtkPVAxesActor::SafeDownCast(prop);
213 this->vtkProp3D::ShallowCopy(prop);
216 //-----------------------------------------------------------------------------
217 void vtkPVAxesActor::GetActors(vtkPropCollection *ac)
219 ac->AddItem(this->XAxisShaft);
220 ac->AddItem(this->YAxisShaft);
221 ac->AddItem(this->ZAxisShaft);
222 ac->AddItem(this->XAxisTip);
223 ac->AddItem(this->YAxisTip);
224 ac->AddItem(this->ZAxisTip);
225 ac->AddItem(this->XAxisLabel);
226 ac->AddItem(this->YAxisLabel);
227 ac->AddItem(this->ZAxisLabel);
231 //-----------------------------------------------------------------------------
232 int vtkPVAxesActor::RenderOpaqueGeometry(vtkViewport *vp)
234 int renderedSomething = 0;
236 vtkRenderer *ren = vtkRenderer::SafeDownCast( vp );
240 this->XAxisLabel->SetCamera( ren->GetActiveCamera() );
241 this->YAxisLabel->SetCamera( ren->GetActiveCamera() );
242 this->ZAxisLabel->SetCamera( ren->GetActiveCamera() );
244 this->XAxisShaft->RenderOpaqueGeometry(vp);
245 this->YAxisShaft->RenderOpaqueGeometry(vp);
246 this->ZAxisShaft->RenderOpaqueGeometry(vp);
248 this->XAxisTip->RenderOpaqueGeometry(vp);
249 this->YAxisTip->RenderOpaqueGeometry(vp);
250 this->ZAxisTip->RenderOpaqueGeometry(vp);
252 this->XAxisLabel->RenderOpaqueGeometry(vp);
253 this->YAxisLabel->RenderOpaqueGeometry(vp);
254 this->ZAxisLabel->RenderOpaqueGeometry(vp);
256 return renderedSomething;
259 //-----------------------------------------------------------------------------
260 #if (VTK_MINOR_VERSION>=2)
261 // porting to VTK 5.0.x
262 int vtkPVAxesActor::RenderTranslucentPolygonalGeometry(vtkViewport *vp)
264 int renderedSomething=0;
268 renderedSomething += this->XAxisShaft->RenderTranslucentPolygonalGeometry(vp);
269 renderedSomething += this->YAxisShaft->RenderTranslucentPolygonalGeometry(vp);
270 renderedSomething += this->ZAxisShaft->RenderTranslucentPolygonalGeometry(vp);
272 renderedSomething += this->XAxisTip->RenderTranslucentPolygonalGeometry(vp);
273 renderedSomething += this->YAxisTip->RenderTranslucentPolygonalGeometry(vp);
274 renderedSomething += this->ZAxisTip->RenderTranslucentPolygonalGeometry(vp);
276 renderedSomething += this->XAxisLabel->RenderTranslucentPolygonalGeometry(vp);
277 renderedSomething += this->YAxisLabel->RenderTranslucentPolygonalGeometry(vp);
278 renderedSomething += this->ZAxisLabel->RenderTranslucentPolygonalGeometry(vp);
280 return renderedSomething;
283 //-----------------------------------------------------------------------------
284 // porting to VTK 5.0.x
285 int vtkPVAxesActor::HasTranslucentPolygonalGeometry()
291 result |= this->XAxisShaft->HasTranslucentPolygonalGeometry();
292 result |= this->YAxisShaft->HasTranslucentPolygonalGeometry();
293 result |= this->ZAxisShaft->HasTranslucentPolygonalGeometry();
295 result |= this->XAxisTip->HasTranslucentPolygonalGeometry();
296 result |= this->YAxisTip->HasTranslucentPolygonalGeometry();
297 result |= this->ZAxisTip->HasTranslucentPolygonalGeometry();
299 result |= this->XAxisLabel->HasTranslucentPolygonalGeometry();
300 result |= this->YAxisLabel->HasTranslucentPolygonalGeometry();
301 result |= this->ZAxisLabel->HasTranslucentPolygonalGeometry();
307 //-----------------------------------------------------------------------------
308 // porting to VTK 5.0.x
309 int vtkPVAxesActor::RenderTranslucentGeometry(vtkViewport *vp)
311 int renderedSomething=0;
315 renderedSomething += this->XAxisShaft->RenderTranslucentGeometry(vp);
316 renderedSomething += this->YAxisShaft->RenderTranslucentGeometry(vp);
317 renderedSomething += this->ZAxisShaft->RenderTranslucentGeometry(vp);
319 renderedSomething += this->XAxisTip->RenderTranslucentGeometry(vp);
320 renderedSomething += this->YAxisTip->RenderTranslucentGeometry(vp);
321 renderedSomething += this->ZAxisTip->RenderTranslucentGeometry(vp);
323 renderedSomething += this->XAxisLabel->RenderTranslucentGeometry(vp);
324 renderedSomething += this->YAxisLabel->RenderTranslucentGeometry(vp);
325 renderedSomething += this->ZAxisLabel->RenderTranslucentGeometry(vp);
327 return renderedSomething;
331 //-----------------------------------------------------------------------------
332 void vtkPVAxesActor::ReleaseGraphicsResources(vtkWindow *win)
334 this->XAxisShaft->ReleaseGraphicsResources( win );
335 this->YAxisShaft->ReleaseGraphicsResources( win );
336 this->ZAxisShaft->ReleaseGraphicsResources( win );
338 this->XAxisTip->ReleaseGraphicsResources( win );
339 this->YAxisTip->ReleaseGraphicsResources( win );
340 this->ZAxisTip->ReleaseGraphicsResources( win );
342 this->XAxisLabel->ReleaseGraphicsResources( win );
343 this->YAxisLabel->ReleaseGraphicsResources( win );
344 this->ZAxisLabel->ReleaseGraphicsResources( win );
347 //-----------------------------------------------------------------------------
348 void vtkPVAxesActor::GetBounds(double bounds[6])
350 double *bds = this->GetBounds();
359 //-----------------------------------------------------------------------------
360 // Get the bounds for this Actor as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
361 double *vtkPVAxesActor::GetBounds()
366 this->XAxisShaft->GetBounds(this->Bounds);
368 this->YAxisShaft->GetBounds(bounds);
371 this->Bounds[2*i+1] =
372 (bounds[2*i+1]>this->Bounds[2*i+1])?(bounds[2*i+1]):(this->Bounds[2*i+1]);
375 this->ZAxisShaft->GetBounds(bounds);
378 this->Bounds[2*i+1] =
379 (bounds[2*i+1]>this->Bounds[2*i+1])?(bounds[2*i+1]):(this->Bounds[2*i+1]);
382 this->XAxisTip->GetBounds(bounds);
385 this->Bounds[2*i+1] =
386 (bounds[2*i+1]>this->Bounds[2*i+1])?(bounds[2*i+1]):(this->Bounds[2*i+1]);
389 this->YAxisTip->GetBounds(bounds);
392 this->Bounds[2*i+1] =
393 (bounds[2*i+1]>this->Bounds[2*i+1])?(bounds[2*i+1]):(this->Bounds[2*i+1]);
396 this->ZAxisTip->GetBounds(bounds);
399 this->Bounds[2*i+1] =
400 (bounds[2*i+1]>this->Bounds[2*i+1])?(bounds[2*i+1]):(this->Bounds[2*i+1]);
404 (vtkPolyDataMapper::SafeDownCast(this->YAxisShaft->GetMapper()))->
405 GetInput()->GetBounds( dbounds );
409 this->Bounds[2*i+1] =
410 (dbounds[2*i+1]>this->Bounds[2*i+1])?(dbounds[2*i+1]):(this->Bounds[2*i+1]);
413 // We want this actor to rotate / re-center about the origin, so give it
414 // the bounds it would have if the axes were symmetrical.
415 for (i = 0; i < 3; i++)
417 this->Bounds[2*i] = -this->Bounds[2*i+1];
423 //-----------------------------------------------------------------------------
424 unsigned long int vtkPVAxesActor::GetMTime()
426 unsigned long mTime=this->Superclass::GetMTime();
432 //-----------------------------------------------------------------------------
433 unsigned long int vtkPVAxesActor::GetRedrawMTime()
435 unsigned long mTime=this->GetMTime();
440 //-----------------------------------------------------------------------------
441 vtkProperty *vtkPVAxesActor::GetXAxisTipProperty()
443 return this->XAxisTip->GetProperty();
446 //-----------------------------------------------------------------------------
447 vtkProperty *vtkPVAxesActor::GetYAxisTipProperty()
449 return this->YAxisTip->GetProperty();
452 //-----------------------------------------------------------------------------
453 vtkProperty *vtkPVAxesActor::GetZAxisTipProperty()
455 return this->ZAxisTip->GetProperty();
458 //-----------------------------------------------------------------------------
459 vtkProperty *vtkPVAxesActor::GetXAxisShaftProperty()
461 return this->XAxisShaft->GetProperty();
464 //-----------------------------------------------------------------------------
465 vtkProperty *vtkPVAxesActor::GetYAxisShaftProperty()
467 return this->YAxisShaft->GetProperty();
470 //-----------------------------------------------------------------------------
471 vtkProperty *vtkPVAxesActor::GetZAxisShaftProperty()
473 return this->ZAxisShaft->GetProperty();
476 //-----------------------------------------------------------------------------
477 vtkProperty *vtkPVAxesActor::GetXAxisLabelProperty()
479 return this->XAxisLabel->GetProperty();
482 //-----------------------------------------------------------------------------
483 vtkProperty *vtkPVAxesActor::GetYAxisLabelProperty()
485 return this->YAxisLabel->GetProperty();
488 //-----------------------------------------------------------------------------
489 vtkProperty *vtkPVAxesActor::GetZAxisLabelProperty()
491 return this->ZAxisLabel->GetProperty();
494 //-----------------------------------------------------------------------------
495 void vtkPVAxesActor::SetTotalLength( float x, float y, float z )
497 if ( this->TotalLength[0] != x ||
498 this->TotalLength[1] != y ||
499 this->TotalLength[2] != z )
501 this->TotalLength[0] = x;
502 this->TotalLength[1] = y;
503 this->TotalLength[2] = z;
511 //-----------------------------------------------------------------------------
512 void vtkPVAxesActor::SetNormalizedShaftLength( float x, float y, float z )
514 if ( this->NormalizedShaftLength[0] != x ||
515 this->NormalizedShaftLength[1] != y ||
516 this->NormalizedShaftLength[2] != z )
518 this->NormalizedShaftLength[0] = x;
519 this->NormalizedShaftLength[1] = y;
520 this->NormalizedShaftLength[2] = z;
528 //-----------------------------------------------------------------------------
529 void vtkPVAxesActor::SetNormalizedTipLength( float x, float y, float z )
531 if ( this->NormalizedTipLength[0] != x ||
532 this->NormalizedTipLength[1] != y ||
533 this->NormalizedTipLength[2] != z )
535 this->NormalizedTipLength[0] = x;
536 this->NormalizedTipLength[1] = y;
537 this->NormalizedTipLength[2] = z;
545 //-----------------------------------------------------------------------------
546 void vtkPVAxesActor::SetShaftType( int type )
548 if ( this->ShaftType != type )
550 this->ShaftType = type;
558 //-----------------------------------------------------------------------------
559 void vtkPVAxesActor::SetTipType( int type )
561 if ( this->TipType != type )
563 this->TipType = type;
571 //-----------------------------------------------------------------------------
572 void vtkPVAxesActor::UpdateProps()
574 this->CylinderSource->SetRadius(this->CylinderRadius);
575 this->CylinderSource->SetResolution(this->CylinderResolution);
578 this->ConeSource->SetResolution(this->ConeResolution);
579 this->ConeSource->SetRadius(this->ConeRadius);
581 this->SphereSource->SetThetaResolution( this->SphereResolution );
582 this->SphereSource->SetPhiResolution( this->SphereResolution );
583 this->SphereSource->SetRadius(this->SphereRadius);
585 switch ( this->ShaftType )
587 case vtkPVAxesActor::CYLINDER_SHAFT:
588 (vtkPolyDataMapper::SafeDownCast(this->XAxisShaft->GetMapper()))->
589 SetInput( this->CylinderSource->GetOutput() );
591 case vtkPVAxesActor::LINE_SHAFT:
592 (vtkPolyDataMapper::SafeDownCast(this->XAxisShaft->GetMapper()))->
593 SetInput( this->LineSource->GetOutput() );
595 case vtkPVAxesActor::USER_DEFINED_SHAFT:
596 (vtkPolyDataMapper::SafeDownCast(this->XAxisShaft->GetMapper()))->
597 SetInput( this->UserDefinedShaft );
600 switch ( this->TipType )
602 case vtkPVAxesActor::CONE_TIP:
603 (vtkPolyDataMapper::SafeDownCast(this->XAxisTip->GetMapper()))->
604 SetInput( this->ConeSource->GetOutput() );
606 case vtkPVAxesActor::SPHERE_TIP:
607 (vtkPolyDataMapper::SafeDownCast(this->XAxisTip->GetMapper()))->
608 SetInput( this->SphereSource->GetOutput() );
610 case vtkPVAxesActor::USER_DEFINED_TIP:
611 (vtkPolyDataMapper::SafeDownCast(this->XAxisTip->GetMapper()))->
612 SetInput( this->UserDefinedTip );
615 (vtkPolyDataMapper::SafeDownCast(this->XAxisTip->GetMapper()))->
616 GetInput()->Update();
617 (vtkPolyDataMapper::SafeDownCast(this->XAxisShaft->GetMapper()))->
618 GetInput()->Update();
625 (vtkPolyDataMapper::SafeDownCast(this->XAxisShaft->GetMapper()))->
626 GetInput()->GetBounds( bounds );
629 for ( i = 0; i < 3; i++ )
632 this->NormalizedShaftLength[i]*this->TotalLength[i] /
633 (bounds[3] - bounds[2]);
636 vtkTransform *xTransform = vtkTransform::New();
637 vtkTransform *yTransform = vtkTransform::New();
638 vtkTransform *zTransform = vtkTransform::New();
640 xTransform->RotateZ( -90 );
641 zTransform->RotateX( 90 );
643 xTransform->Scale( scale[0], scale[0], scale[0] );
644 yTransform->Scale( scale[1], scale[1], scale[1] );
645 zTransform->Scale( scale[2], scale[2], scale[2] );
647 xTransform->Translate( -(bounds[0]+bounds[1])/2,
649 -(bounds[4]+bounds[5])/2 );
650 yTransform->Translate( -(bounds[0]+bounds[1])/2,
652 -(bounds[4]+bounds[5])/2 );
653 zTransform->Translate( -(bounds[0]+bounds[1])/2,
655 -(bounds[4]+bounds[5])/2 );
659 this->XAxisShaft->SetUserTransform( xTransform );
660 this->YAxisShaft->SetUserTransform( yTransform );
661 this->ZAxisShaft->SetUserTransform( zTransform );
663 xTransform->Delete();
664 yTransform->Delete();
665 zTransform->Delete();
667 (vtkPolyDataMapper::SafeDownCast(this->XAxisTip->GetMapper()))->
668 GetInput()->GetBounds( bounds );
670 xTransform = vtkTransform::New();
671 yTransform = vtkTransform::New();
672 zTransform = vtkTransform::New();
674 xTransform->RotateZ( -90 );
675 zTransform->RotateX( 90 );
677 xTransform->Scale( this->TotalLength[0], this->TotalLength[0], this->TotalLength[0] );
678 yTransform->Scale( this->TotalLength[1], this->TotalLength[1], this->TotalLength[1] );
679 zTransform->Scale( this->TotalLength[2], this->TotalLength[2], this->TotalLength[2] );
681 xTransform->Translate( 0, (1.0 - this->NormalizedTipLength[0]), 0 );
682 yTransform->Translate( 0, (1.0 - this->NormalizedTipLength[1]), 0 );
683 zTransform->Translate( 0, (1.0 - this->NormalizedTipLength[2]), 0 );
685 xTransform->Scale( this->NormalizedTipLength[0],
686 this->NormalizedTipLength[0],
687 this->NormalizedTipLength[0] );
689 yTransform->Scale( this->NormalizedTipLength[1],
690 this->NormalizedTipLength[1],
691 this->NormalizedTipLength[1] );
693 zTransform->Scale( this->NormalizedTipLength[2],
694 this->NormalizedTipLength[2],
695 this->NormalizedTipLength[2] );
697 xTransform->Translate( -(bounds[0]+bounds[1])/2,
699 -(bounds[4]+bounds[5])/2 );
700 yTransform->Translate( -(bounds[0]+bounds[1])/2,
702 -(bounds[4]+bounds[5])/2 );
703 zTransform->Translate( -(bounds[0]+bounds[1])/2,
705 -(bounds[4]+bounds[5])/2 );
708 this->XAxisTip->SetUserTransform( xTransform );
709 this->YAxisTip->SetUserTransform( yTransform );
710 this->ZAxisTip->SetUserTransform( zTransform );
712 xTransform->Delete();
713 yTransform->Delete();
714 zTransform->Delete();
716 this->XAxisVectorText->SetText( this->XAxisLabelText );
717 this->YAxisVectorText->SetText( this->YAxisLabelText );
718 this->ZAxisVectorText->SetText( this->ZAxisLabelText );
722 (this->TotalLength[0] + this->TotalLength[1] + this->TotalLength[2])/15;
724 this->XAxisShaft->GetBounds(bounds);
725 this->XAxisLabel->SetScale( avgScale, avgScale, avgScale );
726 this->XAxisLabel->SetPosition( bounds[0] + this->XAxisLabelPosition *
727 (bounds[1]-bounds[0]),
728 bounds[2] - (bounds[3]-bounds[2])*2.0,
729 bounds[5] + (bounds[5]-bounds[4])/2.0 );
731 this->YAxisShaft->GetBounds(bounds);
732 this->YAxisLabel->SetScale( avgScale, avgScale, avgScale );
733 this->YAxisLabel->SetPosition( (bounds[0]+bounds[1])/2,
734 bounds[2] + this->YAxisLabelPosition *
735 (bounds[3]-bounds[2]),
736 bounds[5] + (bounds[5]-bounds[4])/2.0 );
738 this->ZAxisShaft->GetBounds(bounds);
739 this->ZAxisLabel->SetScale( avgScale, avgScale, avgScale );
740 this->ZAxisLabel->SetPosition( bounds[0],
741 bounds[2] - (bounds[3]-bounds[2])*2.0,
742 bounds[4] + this->ZAxisLabelPosition *
743 (bounds[5]-bounds[4]) );
746 //-----------------------------------------------------------------------------
747 void vtkPVAxesActor::PrintSelf(ostream& os, vtkIndent indent)
749 this->Superclass::PrintSelf(os,indent);
751 os << indent << "UserDefinedShaft: ";
752 if (this->UserDefinedShaft)
754 os << this->UserDefinedShaft << endl;
758 os << "(none)" << endl;
761 os << indent << "UserDefinedTip: ";
762 if (this->UserDefinedTip)
764 os << this->UserDefinedTip << endl;
768 os << "(none)" << endl;
771 os << indent << "XAxisLabelText: " << (this->XAxisLabelText ?
772 this->XAxisLabelText : "(none)")
774 os << indent << "YAxisLabelText: " << (this->YAxisLabelText ?
775 this->YAxisLabelText : "(none)")
777 os << indent << "ZAxisLabelText: " << (this->ZAxisLabelText ?
778 this->ZAxisLabelText : "(none)")
780 os << indent << "XAxisLabelPosition: " << this->XAxisLabelPosition << endl;
781 os << indent << "YAxisLabelPosition: " << this->YAxisLabelPosition << endl;
782 os << indent << "ZAxisLabelPosition: " << this->ZAxisLabelPosition << endl;
784 os << indent << "SphereRadius: " << this->SphereRadius << endl;
785 os << indent << "SphereResolution: " << this->SphereResolution << endl;
786 os << indent << "CylinderRadius: " << this->CylinderRadius << endl;
787 os << indent << "CylinderResolution: " << this->CylinderResolution << endl;
788 os << indent << "ConeRadius: " << this->ConeRadius << endl;
789 os << indent << "ConeResolution: " << this->ConeResolution << endl;
791 os << indent << "NormalizedShaftLength: "
792 << this->NormalizedShaftLength[0] << ","
793 << this->NormalizedShaftLength[1] << ","
794 << this->NormalizedShaftLength[2] << endl;
795 os << indent << "NormalizedTipLength: "
796 << this->NormalizedTipLength[0] << ","
797 << this->NormalizedTipLength[1] << ","
798 << this->NormalizedTipLength[2] << endl;
799 os << indent << "TotalLength: "
800 << this->TotalLength[0] << ","
801 << this->TotalLength[1] << ","
802 << this->TotalLength[2] << endl;
805 //-----------------------------------------------------------------------------
806 // porting to VTK 5.0.x
807 void vtkPVAxesActor::AddToRender( vtkRenderer* theRenderer )
809 theRenderer->AddActor(this->XAxisLabel);
810 theRenderer->AddActor(this->YAxisLabel);
811 theRenderer->AddActor(this->ZAxisLabel);