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 unsigned long int vtkPVAxesActor::GetMTime()
434 unsigned long mTime=this->Superclass::GetMTime();
440 //-----------------------------------------------------------------------------
441 unsigned long int vtkPVAxesActor::GetRedrawMTime()
443 unsigned long mTime=this->GetMTime();
448 //-----------------------------------------------------------------------------
449 vtkProperty *vtkPVAxesActor::GetXAxisTipProperty()
451 return this->XAxisTip->GetProperty();
454 //-----------------------------------------------------------------------------
455 vtkProperty *vtkPVAxesActor::GetYAxisTipProperty()
457 return this->YAxisTip->GetProperty();
460 //-----------------------------------------------------------------------------
461 vtkProperty *vtkPVAxesActor::GetZAxisTipProperty()
463 return this->ZAxisTip->GetProperty();
466 //-----------------------------------------------------------------------------
467 vtkProperty *vtkPVAxesActor::GetXAxisShaftProperty()
469 return this->XAxisShaft->GetProperty();
472 //-----------------------------------------------------------------------------
473 vtkProperty *vtkPVAxesActor::GetYAxisShaftProperty()
475 return this->YAxisShaft->GetProperty();
478 //-----------------------------------------------------------------------------
479 vtkProperty *vtkPVAxesActor::GetZAxisShaftProperty()
481 return this->ZAxisShaft->GetProperty();
484 //-----------------------------------------------------------------------------
485 vtkProperty *vtkPVAxesActor::GetXAxisLabelProperty()
487 return this->XAxisLabel->GetProperty();
490 //-----------------------------------------------------------------------------
491 vtkProperty *vtkPVAxesActor::GetYAxisLabelProperty()
493 return this->YAxisLabel->GetProperty();
496 //-----------------------------------------------------------------------------
497 vtkProperty *vtkPVAxesActor::GetZAxisLabelProperty()
499 return this->ZAxisLabel->GetProperty();
502 //-----------------------------------------------------------------------------
503 void vtkPVAxesActor::SetTotalLength( float x, float y, float z )
505 if ( this->TotalLength[0] != x ||
506 this->TotalLength[1] != y ||
507 this->TotalLength[2] != z )
509 this->TotalLength[0] = x;
510 this->TotalLength[1] = y;
511 this->TotalLength[2] = z;
519 //-----------------------------------------------------------------------------
520 void vtkPVAxesActor::SetNormalizedShaftLength( float x, float y, float z )
522 if ( this->NormalizedShaftLength[0] != x ||
523 this->NormalizedShaftLength[1] != y ||
524 this->NormalizedShaftLength[2] != z )
526 this->NormalizedShaftLength[0] = x;
527 this->NormalizedShaftLength[1] = y;
528 this->NormalizedShaftLength[2] = z;
536 //-----------------------------------------------------------------------------
537 void vtkPVAxesActor::SetNormalizedTipLength( float x, float y, float z )
539 if ( this->NormalizedTipLength[0] != x ||
540 this->NormalizedTipLength[1] != y ||
541 this->NormalizedTipLength[2] != z )
543 this->NormalizedTipLength[0] = x;
544 this->NormalizedTipLength[1] = y;
545 this->NormalizedTipLength[2] = z;
553 //-----------------------------------------------------------------------------
554 void vtkPVAxesActor::SetShaftType( int type )
556 if ( this->ShaftType != type )
558 this->ShaftType = type;
566 //-----------------------------------------------------------------------------
567 void vtkPVAxesActor::SetTipType( int type )
569 if ( this->TipType != type )
571 this->TipType = type;
579 //-----------------------------------------------------------------------------
580 void vtkPVAxesActor::UpdateProps()
582 this->CylinderSource->SetRadius(this->CylinderRadius);
583 this->CylinderSource->SetResolution(this->CylinderResolution);
586 this->ConeSource->SetResolution(this->ConeResolution);
587 this->ConeSource->SetRadius(this->ConeRadius);
589 this->SphereSource->SetThetaResolution( this->SphereResolution );
590 this->SphereSource->SetPhiResolution( this->SphereResolution );
591 this->SphereSource->SetRadius(this->SphereRadius);
593 switch ( this->ShaftType )
595 case vtkPVAxesActor::CYLINDER_SHAFT:
596 (vtkPolyDataMapper::SafeDownCast(this->XAxisShaft->GetMapper()))->
597 SetInputConnection( this->CylinderSource->GetOutputPort() );
599 case vtkPVAxesActor::LINE_SHAFT:
600 (vtkPolyDataMapper::SafeDownCast(this->XAxisShaft->GetMapper()))->
601 SetInputConnection( this->LineSource->GetOutputPort() );
603 case vtkPVAxesActor::USER_DEFINED_SHAFT:
604 (vtkPolyDataMapper::SafeDownCast(this->XAxisShaft->GetMapper()))->
605 SetInputData( this->UserDefinedShaft );
608 switch ( this->TipType )
610 case vtkPVAxesActor::CONE_TIP:
611 (vtkPolyDataMapper::SafeDownCast(this->XAxisTip->GetMapper()))->
612 SetInputConnection( this->ConeSource->GetOutputPort() );
614 case vtkPVAxesActor::SPHERE_TIP:
615 (vtkPolyDataMapper::SafeDownCast(this->XAxisTip->GetMapper()))->
616 SetInputConnection( this->SphereSource->GetOutputPort() );
618 case vtkPVAxesActor::USER_DEFINED_TIP:
619 (vtkPolyDataMapper::SafeDownCast(this->XAxisTip->GetMapper()))->
620 SetInputData( this->UserDefinedTip );
623 (vtkPolyDataMapper::SafeDownCast(this->XAxisTip->GetMapper()))->Update();
624 (vtkPolyDataMapper::SafeDownCast(this->XAxisShaft->GetMapper()))->Update();
631 (vtkPolyDataMapper::SafeDownCast(this->XAxisShaft->GetMapper()))->
632 GetInput()->GetBounds( bounds );
635 for ( i = 0; i < 3; i++ )
638 this->NormalizedShaftLength[i]*this->TotalLength[i] /
639 (bounds[3] - bounds[2]);
642 vtkTransform *xTransform = vtkTransform::New();
643 vtkTransform *yTransform = vtkTransform::New();
644 vtkTransform *zTransform = vtkTransform::New();
646 xTransform->RotateZ( -90 );
647 zTransform->RotateX( 90 );
649 xTransform->Scale( scale[0], scale[0], scale[0] );
650 yTransform->Scale( scale[1], scale[1], scale[1] );
651 zTransform->Scale( scale[2], scale[2], scale[2] );
653 xTransform->Translate( -(bounds[0]+bounds[1])/2,
655 -(bounds[4]+bounds[5])/2 );
656 yTransform->Translate( -(bounds[0]+bounds[1])/2,
658 -(bounds[4]+bounds[5])/2 );
659 zTransform->Translate( -(bounds[0]+bounds[1])/2,
661 -(bounds[4]+bounds[5])/2 );
665 this->XAxisShaft->SetUserTransform( xTransform );
666 this->YAxisShaft->SetUserTransform( yTransform );
667 this->ZAxisShaft->SetUserTransform( zTransform );
669 xTransform->Delete();
670 yTransform->Delete();
671 zTransform->Delete();
673 (vtkPolyDataMapper::SafeDownCast(this->XAxisTip->GetMapper()))->
674 GetInput()->GetBounds( bounds );
676 xTransform = vtkTransform::New();
677 yTransform = vtkTransform::New();
678 zTransform = vtkTransform::New();
680 xTransform->RotateZ( -90 );
681 zTransform->RotateX( 90 );
683 xTransform->Scale( this->TotalLength[0], this->TotalLength[0], this->TotalLength[0] );
684 yTransform->Scale( this->TotalLength[1], this->TotalLength[1], this->TotalLength[1] );
685 zTransform->Scale( this->TotalLength[2], this->TotalLength[2], this->TotalLength[2] );
687 xTransform->Translate( 0, (1.0 - this->NormalizedTipLength[0]), 0 );
688 yTransform->Translate( 0, (1.0 - this->NormalizedTipLength[1]), 0 );
689 zTransform->Translate( 0, (1.0 - this->NormalizedTipLength[2]), 0 );
691 xTransform->Scale( this->NormalizedTipLength[0],
692 this->NormalizedTipLength[0],
693 this->NormalizedTipLength[0] );
695 yTransform->Scale( this->NormalizedTipLength[1],
696 this->NormalizedTipLength[1],
697 this->NormalizedTipLength[1] );
699 zTransform->Scale( this->NormalizedTipLength[2],
700 this->NormalizedTipLength[2],
701 this->NormalizedTipLength[2] );
703 xTransform->Translate( -(bounds[0]+bounds[1])/2,
705 -(bounds[4]+bounds[5])/2 );
706 yTransform->Translate( -(bounds[0]+bounds[1])/2,
708 -(bounds[4]+bounds[5])/2 );
709 zTransform->Translate( -(bounds[0]+bounds[1])/2,
711 -(bounds[4]+bounds[5])/2 );
714 this->XAxisTip->SetUserTransform( xTransform );
715 this->YAxisTip->SetUserTransform( yTransform );
716 this->ZAxisTip->SetUserTransform( zTransform );
718 xTransform->Delete();
719 yTransform->Delete();
720 zTransform->Delete();
722 this->XAxisVectorText->SetText( this->XAxisLabelText );
723 this->YAxisVectorText->SetText( this->YAxisLabelText );
724 this->ZAxisVectorText->SetText( this->ZAxisLabelText );
728 (this->TotalLength[0] + this->TotalLength[1] + this->TotalLength[2])/15;
730 this->XAxisShaft->GetBounds(bounds);
731 this->XAxisLabel->SetScale( avgScale, avgScale, avgScale );
732 this->XAxisLabel->SetPosition( bounds[0] + this->XAxisLabelPosition *
733 (bounds[1]-bounds[0]),
734 bounds[2] - (bounds[3]-bounds[2])*2.0,
735 bounds[5] + (bounds[5]-bounds[4])/2.0 );
737 this->YAxisShaft->GetBounds(bounds);
738 this->YAxisLabel->SetScale( avgScale, avgScale, avgScale );
739 this->YAxisLabel->SetPosition( (bounds[0]+bounds[1])/2,
740 bounds[2] + this->YAxisLabelPosition *
741 (bounds[3]-bounds[2]),
742 bounds[5] + (bounds[5]-bounds[4])/2.0 );
744 this->ZAxisShaft->GetBounds(bounds);
745 this->ZAxisLabel->SetScale( avgScale, avgScale, avgScale );
746 this->ZAxisLabel->SetPosition( bounds[0],
747 bounds[2] - (bounds[3]-bounds[2])*2.0,
748 bounds[4] + this->ZAxisLabelPosition *
749 (bounds[5]-bounds[4]) );
752 //-----------------------------------------------------------------------------
753 void vtkPVAxesActor::PrintSelf(ostream& os, vtkIndent indent)
755 this->Superclass::PrintSelf(os,indent);
757 os << indent << "UserDefinedShaft: ";
758 if (this->UserDefinedShaft)
760 os << this->UserDefinedShaft << endl;
764 os << "(none)" << endl;
767 os << indent << "UserDefinedTip: ";
768 if (this->UserDefinedTip)
770 os << this->UserDefinedTip << endl;
774 os << "(none)" << endl;
777 os << indent << "XAxisLabelText: " << (this->XAxisLabelText ?
778 this->XAxisLabelText : "(none)")
780 os << indent << "YAxisLabelText: " << (this->YAxisLabelText ?
781 this->YAxisLabelText : "(none)")
783 os << indent << "ZAxisLabelText: " << (this->ZAxisLabelText ?
784 this->ZAxisLabelText : "(none)")
786 os << indent << "XAxisLabelPosition: " << this->XAxisLabelPosition << endl;
787 os << indent << "YAxisLabelPosition: " << this->YAxisLabelPosition << endl;
788 os << indent << "ZAxisLabelPosition: " << this->ZAxisLabelPosition << endl;
790 os << indent << "SphereRadius: " << this->SphereRadius << endl;
791 os << indent << "SphereResolution: " << this->SphereResolution << endl;
792 os << indent << "CylinderRadius: " << this->CylinderRadius << endl;
793 os << indent << "CylinderResolution: " << this->CylinderResolution << endl;
794 os << indent << "ConeRadius: " << this->ConeRadius << endl;
795 os << indent << "ConeResolution: " << this->ConeResolution << endl;
797 os << indent << "NormalizedShaftLength: "
798 << this->NormalizedShaftLength[0] << ","
799 << this->NormalizedShaftLength[1] << ","
800 << this->NormalizedShaftLength[2] << endl;
801 os << indent << "NormalizedTipLength: "
802 << this->NormalizedTipLength[0] << ","
803 << this->NormalizedTipLength[1] << ","
804 << this->NormalizedTipLength[2] << endl;
805 os << indent << "TotalLength: "
806 << this->TotalLength[0] << ","
807 << this->TotalLength[1] << ","
808 << this->TotalLength[2] << endl;
811 //-----------------------------------------------------------------------------
812 // porting to VTK 5.0.x
813 void vtkPVAxesActor::AddToRender( vtkRenderer* theRenderer )
815 theRenderer->AddActor(this->XAxisLabel);
816 theRenderer->AddActor(this->YAxisLabel);
817 theRenderer->AddActor(this->ZAxisLabel);
820 } // end of salomevtk namespace