Changeset 5838 for vtkvis/branches
- Timestamp:
- Aug 22, 2015, 2:55:58 PM (9 years ago)
- Location:
- vtkvis/branches/1.8
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
vtkvis/branches/1.8
- Property svn:mergeinfo changed
/vtkvis/trunk merged: 5802
- Property svn:mergeinfo changed
-
vtkvis/branches/1.8/vtkRpAxisActor.cpp
r3549 r5838 2 2 3 3 Program: Visualization Toolkit 4 Module: vtkRpAxisActor.c pp4 Module: vtkRpAxisActor.cxx 5 5 Thanks: Kathleen Bonnell, B Division, Lawrence Livermore Nat'l Laboratory 6 6 … … 32 32 #include "vtkVectorText.h" 33 33 #include "vtkViewport.h" 34 #include "vtkVersion.h" 35 #include "vtkWindow.h" 34 36 35 37 vtkStandardNewMacro(vtkRpAxisActor); … … 60 62 this->Range[0] = 0.0; 61 63 this->Range[1] = 1.0; 64 this->ScreenSize = 10.; 65 this->LabelOffset = 20.; 66 this->TitleOffset = 20.; 62 67 63 68 this->Bounds[0] = this->Bounds[2] = this->Bounds[4] = -1; … … 70 75 this->TitleTextProperty->SetColor(0.,0.,0.); 71 76 this->TitleTextProperty->SetFontFamilyToArial(); 72 this->TitleTextProperty->SetFontSize(14); 77 this->TitleTextProperty->SetFontSize(18); 78 this->TitleTextProperty->SetVerticalJustificationToCentered(); 79 this->TitleTextProperty->SetJustificationToCentered(); 73 80 74 81 this->TitleVector = vtkVectorText::New(); … … 77 84 this->TitleVector->GetOutputPort()); 78 85 this->TitleActor = vtkRpAxisFollower::New(); 86 this->TitleActor->SetAxis(this); 79 87 this->TitleActor->SetMapper(this->TitleMapper); 80 88 this->TitleActor->SetEnableDistanceLOD(0); … … 90 98 this->LabelTextProperty->SetColor(0.,0.,0.); 91 99 this->LabelTextProperty->SetFontFamilyToArial(); 92 this->LabelTextProperty->SetFontSize(12); 100 this->LabelTextProperty->SetFontSize(14); 101 this->LabelTextProperty->SetVerticalJustificationToBottom(); 102 this->LabelTextProperty->SetJustificationToLeft(); 93 103 94 104 this->AxisLines = vtkPolyData::New(); … … 177 187 this->CalculateLabelOffset = 1; 178 188 179 this->ScreenSize = 10.;180 181 189 // Instance variables specific to 2D mode 182 190 this->Use2DMode = 0; … … 221 229 } 222 230 223 if (this->LabelFormat) 224 { 225 delete [] this->LabelFormat; 226 this->LabelFormat = NULL; 227 } 231 delete [] this->LabelFormat; 232 this->LabelFormat = NULL; 228 233 229 234 if (this->TitleVector) … … 248 253 } 249 254 250 if (this->Title) 251 { 252 delete [] this->Title; 253 this->Title = NULL; 254 } 255 delete [] this->Title; 256 this->Title = NULL; 255 257 256 258 if (this->TitleTextProperty) … … 410 412 if (this->Title != NULL && this->Title[0] != 0 && this->TitleVisibility) 411 413 { 412 if (this->Use2DMode == 0) 414 if (this->Use2DMode) 415 { 416 renderedSomething += this->TitleActor2D->RenderOpaqueGeometry(viewport); 417 } 418 else 413 419 { 414 420 renderedSomething += this->TitleActor->RenderOpaqueGeometry(viewport); 415 421 } 416 else417 {418 renderedSomething += this->TitleActor2D->RenderOpaqueGeometry(viewport);419 }420 422 } 421 423 if (this->AxisVisibility || this->TickVisibility) … … 435 437 for (i=0; i<this->NumberOfLabelsBuilt; i++) 436 438 { 437 if (this->Use2DMode == 0) 439 if (this->Use2DMode) 440 { 441 renderedSomething += 442 this->LabelActors2D[i]->RenderOpaqueGeometry(viewport); 443 } 444 else 438 445 { 439 446 renderedSomething += 440 447 this->LabelActors[i]->RenderOpaqueGeometry(viewport); 441 448 } 442 else443 {444 renderedSomething +=445 this->LabelActors2D[i]->RenderOpaqueGeometry(viewport);446 }447 449 } 448 450 } … … 478 480 renderedSomething += this->GridpolysActor->RenderTranslucentPolygonalGeometry(viewport); 479 481 } 480 } 481 482 if (this->Title != NULL && this->Title[0] != 0 && this->TitleVisibility) 483 { 484 if (this->Use2DMode) 485 { 486 renderedSomething += this->TitleActor2D->RenderTranslucentPolygonalGeometry(viewport); 487 } 488 else 489 { 490 renderedSomething += this->TitleActor->RenderTranslucentPolygonalGeometry(viewport); 491 } 492 } 493 if (this->LabelVisibility) 494 { 495 for (int i=0; i<this->NumberOfLabelsBuilt; i++) 496 { 497 if (this->Use2DMode) 498 { 499 renderedSomething += 500 this->LabelActors2D[i]->RenderTranslucentPolygonalGeometry(viewport); 501 } 502 else 503 { 504 renderedSomething += 505 this->LabelActors[i]->RenderTranslucentPolygonalGeometry(viewport); 506 } 507 } 508 } 509 } 482 510 return renderedSomething; 483 511 } … … 493 521 if (!this->AxisHasZeroLength && !this->DrawGridlinesOnly) 494 522 { 495 if ( this->Use2DMode == 1)523 if (this->Use2DMode) 496 524 { 497 525 renderedSomething += this->TitleActor2D->RenderOverlay(viewport); 526 } 527 else 528 { 529 renderedSomething += this->TitleActor->RenderOverlay(viewport); 498 530 } 499 531 if (this->LabelVisibility) … … 501 533 for (i=0; i<this->NumberOfLabelsBuilt; i++) 502 534 { 503 if (this->Use2DMode == 1)535 if (this->Use2DMode) 504 536 { 505 537 renderedSomething += this->LabelActors2D[i]->RenderOverlay(viewport); 538 } 539 else 540 { 541 renderedSomething += this->LabelActors[i]->RenderOverlay(viewport); 506 542 } 507 543 } … … 578 614 579 615 if (this->DrawGridpolys && 580 this- GridpolysActor->HasTranslucentPolygonalGeometry())616 this->GridpolysActor->HasTranslucentPolygonalGeometry()) 581 617 { 582 618 return 1; … … 627 663 this->TitleActor->SetProperty(this->GetProperty()); 628 664 this->TitleActor->GetProperty()->SetColor(this->TitleTextProperty->GetColor()); 665 this->TitleActor->GetProperty()->SetOpacity(this->TitleTextProperty->GetOpacity()); 629 666 } 630 667 … … 660 697 } 661 698 662 // If label positions changed, need to rescale663 this->AutoScale(viewport);664 665 699 this->LastAxisPosition = this->AxisPosition; 666 700 … … 686 720 this->LabelActors[i]->SetProperty(this->GetProperty()); 687 721 this->LabelActors[i]->GetProperty()->SetColor(this->LabelTextProperty->GetColor()); 722 this->LabelActors[i]->GetProperty()->SetOpacity(this->LabelTextProperty->GetOpacity()); 688 723 this->LabelActors[i]->SetOrientation(0., 0., this->LabelTextProperty->GetOrientation()); 689 724 … … 703 738 } 704 739 705 int vtkRpAxisActorMultiplierTable1[4] = { -1, -1, 1, 1};706 int vtkRpAxisActorMultiplierTable2[4] = { -1, 1, 1, -1};740 static const int vtkRpAxisActorMultiplierTable1[4] = { -1, -1, 1, 1}; 741 static const int vtkRpAxisActorMultiplierTable2[4] = { -1, 1, 1, -1}; 707 742 708 743 // ******************************************************************* … … 716 751 } 717 752 718 double bounds[6], center[3], tick[3], pos[3] , scale[3];753 double bounds[6], center[3], tick[3], pos[3]; 719 754 int i = 0; 720 755 int xmult = 0; 721 756 int ymult = 0; 757 double labelAngle = vtkMath::RadiansFromDegrees(this->LabelTextProperty->GetOrientation()); 758 double labelCos = fabs(cos(labelAngle)); 759 double labelSin = fabs(sin(labelAngle)); 760 722 761 723 762 switch (this->AxisType) … … 755 794 756 795 this->LabelActors[i]->GetMapper()->GetBounds(bounds); 757 this->LabelActors[i]->GetScale(scale);758 796 759 797 if(this->CalculateLabelOffset) 760 798 { 761 double halfWidth = (bounds[1] - bounds[0]) * 0.5 * scale[0];762 double halfHeight = (bounds[3] - bounds[2]) * 0.5 * scale[1];799 double halfWidth = 0.5 * ((bounds[1] - bounds[0]) * labelCos + (bounds[3] - bounds[2]) * labelSin); 800 double halfHeight = 0.5 * ((bounds[1] - bounds[0]) * labelSin + (bounds[3] - bounds[2]) * labelCos); 763 801 764 802 center[0] = tick[0] + xmult * (halfWidth + this->MinorTickSize); … … 772 810 else 773 811 { 774 center[0] = tick[0] ; 775 center[1] = tick[1]; 776 center[2] = tick[2]; 777 778 pos[0] = center[0]; 779 pos[1] = center[1]; 780 pos[2] = center[2]; 812 pos[0] = tick[0]; 813 pos[1] = tick[1]; 814 pos[2] = tick[2]; 815 816 double delta = 0.5 * ((bounds[1] - bounds[0]) * labelSin + (bounds[3] - bounds[2]) * labelCos); 817 this->LabelActors[i]->SetScreenOffset(this->LabelOffset + (delta) * this->ScreenSize); 781 818 } 782 819 783 820 this->LabelActors[i]->SetPosition(pos[0], pos[1], pos[2]); 784 821 } 785 }786 787 void788 vtkRpAxisActor::AutoScale(vtkViewport *viewport)789 {790 double newTitleScale791 = this->AutoScale(viewport,792 this->ScreenSize,793 this->GetTitleActor()->GetPosition());794 795 this->SetTitleScale(newTitleScale);796 797 // Now labels.798 vtkRpAxisFollower** labelActors = this->GetLabelActors();799 800 for(int j = 0; j < this->GetNumberOfLabelsBuilt(); ++j)801 {802 double newLabelScale803 = this->AutoScale(viewport,804 this->ScreenSize,805 labelActors[j]->GetPosition());806 807 labelActors[j]->SetScale(newLabelScale);808 }809 }810 811 double812 vtkRpAxisActor::AutoScale(vtkViewport *viewport, double screenSize,813 double position[3])814 {815 double factor = 1;816 if (viewport->GetSize()[1] > 0)817 {818 factor = 2.0 * screenSize819 * tan(vtkMath::RadiansFromDegrees(this->Camera->GetViewAngle()/2.0))820 / viewport->GetSize()[1];821 }822 823 double dist = sqrt(824 vtkMath::Distance2BetweenPoints(position,825 this->Camera->GetPosition()));826 double newScale = factor * dist;827 828 return newScale;829 822 } 830 823 … … 841 834 { 842 835 this->LabelActors2D[i]->GetProperty()->SetColor(this->LabelTextProperty->GetColor()); 843 this->LabelActors2D[i]->GetProperty()->SetOpacity(1); 844 this->LabelActors2D[i]->GetTextProperty()->SetFontSize(this->LabelTextProperty->GetFontSize()); 845 this->LabelActors2D[i]->GetTextProperty()->SetVerticalJustificationToBottom(); 846 this->LabelActors2D[i]->GetTextProperty()->SetJustificationToLeft(); 836 this->LabelActors2D[i]->GetProperty()->SetOpacity(this->LabelTextProperty->GetOpacity()); 837 this->LabelActors2D[i]->GetTextProperty()->ShallowCopy(this->LabelTextProperty); 847 838 } 848 839 … … 906 897 return; 907 898 } 908 899 #if VTK_MAJOR_VERSION == 6 && VTK_MINOR_VERSION >= 3 900 vtkWindow *win = viewport->GetVTKWindow(); 901 if (!win) 902 { 903 vtkErrorMacro(<<"No render window available: cannot determine DPI."); 904 return; 905 } 906 907 #endif 909 908 for (int i = 0; i < this->NumberOfLabelsBuilt; i++) 910 909 { … … 923 922 int bbox[4]; 924 923 if (!tren->GetBoundingBox(this->LabelActors2D[i]->GetTextProperty(), 924 #if VTK_MAJOR_VERSION == 6 && VTK_MINOR_VERSION >= 3 925 this->LabelActors2D[i]->GetInput(), bbox, 926 win->GetDPI())) 927 #else 925 928 this->LabelActors2D[i]->GetInput(), bbox)) 929 #endif 926 930 { 927 931 vtkErrorMacro(<< "Unable to calculate bounding box for label " … … 951 955 return; 952 956 } 953 double labBounds[6], titleBounds[6], center[3], pos[3] , scale[3];957 double labBounds[6], titleBounds[6], center[3], pos[3]; 954 958 double labHeight, maxHeight = 0, labWidth, maxWidth = 0; 955 959 double halfTitleWidth, halfTitleHeight; 960 double labelAngle = vtkMath::RadiansFromDegrees(this->LabelTextProperty->GetOrientation()); 961 double labelCos = fabs(cos(labelAngle)); 962 double labelSin = fabs(sin(labelAngle)); 956 963 957 964 double *p1 = this->Point1Coordinate->GetValue(); … … 991 998 { 992 999 this->LabelActors[i]->GetMapper()->GetBounds(labBounds); 993 this->LabelActors[i]->GetScale(scale); 994 labWidth = (labBounds[1] - labBounds[0])*scale[0]; 1000 labWidth = (labBounds[1] - labBounds[0]) * labelCos + (labBounds[3] - labBounds[2]) * labelSin; 995 1001 maxWidth = (labWidth > maxWidth ? labWidth : maxWidth); 996 labHeight = (labBounds[ 3] - labBounds[2])*scale[1];1002 labHeight = (labBounds[1] - labBounds[0]) * labelSin + (labBounds[3] - labBounds[2]) * labelCos; 997 1003 maxHeight = (labHeight > maxHeight ? labHeight : maxHeight); 998 1004 } … … 1002 1008 this->TitleActor->GetProperty()->SetColor(this->TitleTextProperty->GetColor()); 1003 1009 this->TitleActor->SetCamera(this->Camera); 1004 this->TitleActor->SetPosition(p2[0], p2[1], p2[2]);1005 1010 this->TitleActor->GetMapper()->GetBounds(titleBounds); 1006 this->TitleActor->GetScale(scale); 1011 1007 1012 if(!this->GetCalculateTitleOffset()) 1008 1013 { … … 1014 1019 center[2] = p1[2] + (p2[2] - p1[2]) / 2.0; 1015 1020 1021 halfTitleHeight = (titleBounds[3] - titleBounds[2]) * 0.5; 1016 1022 if(this->CalculateTitleOffset) 1017 1023 { 1018 halfTitleWidth = (titleBounds[1] - titleBounds[0]) * 0.5 * scale[0]; 1019 halfTitleHeight = (titleBounds[3] - titleBounds[2]) * 0.5 * scale[1]; 1024 halfTitleWidth = (titleBounds[1] - titleBounds[0]) * 0.5; 1020 1025 center[0] += xmult * (halfTitleWidth + maxWidth); 1021 1026 center[1] += ymult * (halfTitleHeight + 2*maxHeight); 1027 } 1028 else 1029 { 1030 this->TitleActor->SetScreenOffset(this->TitleOffset + 1031 this->LabelOffset + this->ScreenSize * (maxHeight + halfTitleHeight)); 1022 1032 } 1023 1033 … … 1044 1054 this->TitleActor2D->SetInput( this->TitleVector->GetText() ); 1045 1055 this->TitleActor2D->GetProperty()->SetColor( this->TitleTextProperty->GetColor() ); 1046 this->TitleActor2D->GetProperty()->SetOpacity(1); 1047 this->TitleActor2D->GetTextProperty()->SetFontSize( this->TitleTextProperty->GetFontSize() ); 1048 this->TitleActor2D->GetTextProperty()->SetVerticalJustificationToCentered(); 1049 this->TitleActor2D->GetTextProperty()->SetJustificationToCentered(); 1056 this->TitleActor2D->GetProperty()->SetOpacity( this->TitleTextProperty->GetOpacity() ); 1057 this->TitleActor2D->GetTextProperty()->ShallowCopy(this->TitleTextProperty); 1050 1058 1051 1059 if (this->AxisType == VTK_AXIS_TYPE_Y) … … 1273 1281 // 1274 1282 int i, numLabels = labels->GetNumberOfValues(); 1283 if (numLabels < 0) 1284 { 1285 vtkErrorMacro(<< "Number of labels " << numLabels << " is invalid"); 1286 return; 1287 } 1275 1288 if (this->NumberOfLabelsBuilt != numLabels) 1276 1289 { … … 1302 1315 this->LabelVectors[i]->GetOutputPort()); 1303 1316 this->LabelActors[i] = vtkRpAxisFollower::New(); 1317 this->LabelActors[i]->SetAxis(this); 1304 1318 this->LabelActors[i]->SetMapper(this->LabelMappers[i]); 1305 1319 this->LabelActors[i]->SetEnableDistanceLOD(0); … … 1307 1321 this->LabelActors[i]->GetProperty()->SetDiffuse(0.); 1308 1322 this->LabelActors[i]->GetProperty()->SetColor(this->LabelTextProperty->GetColor()); 1323 this->LabelActors[i]->GetProperty()->SetOpacity(this->LabelTextProperty->GetOpacity()); 1309 1324 this->LabelActors2D[i] = vtkTextActor::New(); 1310 1325 } … … 1461 1476 // ********************************************************************* 1462 1477 void 1463 vtkRpAxisActor::SetBounds( double b[6])1478 vtkRpAxisActor::SetBounds(const double b[6]) 1464 1479 { 1465 1480 if ((this->Bounds[0] != b[0]) || … … 1537 1552 this->LabelActors[i]->SetProperty(newProp); 1538 1553 this->LabelActors[i]->GetMapper()->GetBounds(bounds); 1539 this->LabelActors[i]->GetProperty()->SetColor(this->LabelTextProperty->GetColor());1540 1554 xsize = bounds[1] - bounds[0]; 1541 1555 ysize = bounds[3] - bounds[2]; … … 1562 1576 newProp->Delete(); 1563 1577 this->TitleActor->GetMapper()->GetBounds(bounds); 1564 this->TitleActor->GetProperty()->SetColor(this->TitleTextProperty->GetColor());1565 1578 xsize = bounds[1] - bounds[0]; 1566 1579 ysize = bounds[3] - bounds[2]; … … 1575 1588 for (int i=0; i < this->NumberOfLabelsBuilt; i++) 1576 1589 { 1577 this->LabelActors[i]->SetScale(s); 1578 } 1590 this->SetLabelScale(i, s); 1591 } 1592 } 1593 1594 // ********************************************************************* 1595 void vtkRpAxisActor::SetLabelScale(int label, const double s) 1596 { 1597 this->LabelActors[label]->SetScale(s); 1579 1598 } 1580 1599 … … 1596 1615 return; 1597 1616 } 1598 if (this->Title) 1599 { 1600 delete [] this->Title; 1601 } 1617 delete [] this->Title; 1602 1618 if (t) 1603 1619 { -
vtkvis/branches/1.8/vtkRpAxisActor.h
r3549 r5838 49 49 // vtkActor vtkVectorText vtkPolyDataMapper vtkRpAxisActor2D vtkCoordinate 50 50 51 #ifndef __vtkRpAxisActor_h52 #define __vtkRpAxisActor_h51 #ifndef vtkRpAxisActor_h 52 #define vtkRpAxisActor_h 53 53 54 54 #include "vtkRenderingAnnotationModule.h" // For export macro … … 118 118 // Description: 119 119 // Set or get the bounds for this Actor as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax). 120 void SetBounds( double bounds[6]);120 void SetBounds(const double bounds[6]); 121 121 void SetBounds(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax); 122 122 double *GetBounds(void); 123 123 void GetBounds(double bounds[6]); 124 125 vtkSetMacro(ScreenSize, double);126 vtkGetMacro(ScreenSize, double);127 124 128 125 // Description: … … 136 133 vtkGetMacro(MinorTicksVisible, int); 137 134 vtkBooleanMacro(MinorTicksVisible, int); 138 139 135 140 136 // Description: … … 308 304 double ComputeTitleLength(const double [3]); 309 305 //ETX 310 void SetLabelScale(const double); 311 void SetTitleScale(const double); 306 void SetLabelScale(const double scale); 307 void SetLabelScale(int labelIndex, const double scale); 308 void SetTitleScale(const double scale); 312 309 313 310 // Description: … … 420 417 vtkGetMacro(AxisOnOrigin,int); 421 418 419 // Description: 420 // Set/Get the offsets used to position texts. 421 vtkSetMacro(LabelOffset, double); 422 vtkGetMacro(LabelOffset, double); 423 vtkSetMacro(TitleOffset, double); 424 vtkGetMacro(TitleOffset, double); 425 vtkSetMacro(ScreenSize, double); 426 vtkGetMacro(ScreenSize, double); 422 427 423 428 protected: … … 468 473 469 474 void TransformBounds(vtkViewport *, double bnds[6]); 470 471 void AutoScale(vtkViewport *viewport);472 double AutoScale(vtkViewport *viewport, double screenSize,473 double position[3]);474 475 475 476 void BuildLabels(vtkViewport *, bool); … … 559 560 int CalculateLabelOffset; 560 561 561 double ScreenSize;562 563 562 // Description: 564 563 // Use xy-axis only when Use2DMode=1: … … 592 591 double LastMinDisplayCoordinate[3]; 593 592 double LastMaxDisplayCoordinate[3]; 593 594 // Description: 595 // Offsets used to position text. 596 double ScreenSize; 597 double LabelOffset; 598 double TitleOffset; 594 599 }; 595 600 596 597 601 #endif -
vtkvis/branches/1.8/vtkRpAxisFollower.cpp
r3479 r5838 585 585 this->Device->SetUserMatrix(this->Matrix); 586 586 587 this->SetVisibility(this->VisibleAtCurrentViewAngle); 587 588 if(this->VisibleAtCurrentViewAngle) 588 589 { 589 590 this->Device->Render(ren,this->Mapper); 590 }591 else592 {593 this->SetVisibility(this->VisibleAtCurrentViewAngle);594 591 } 595 592 } -
vtkvis/branches/1.8/vtkRpAxisFollower.h
r3479 r5838 25 25 26 26 27 #ifndef __vtkRpAxisFollower_h28 #define __vtkRpAxisFollower_h27 #ifndef vtkRpAxisFollower_h 28 #define vtkRpAxisFollower_h 29 29 30 30 #include "vtkRenderingAnnotationModule.h" // For export macro … … 161 161 162 162 // hide the two parameter Render() method from the user and the compiler. 163 virtual void Render(vtkRenderer *, vtkMapper *) {} ;163 virtual void Render(vtkRenderer *, vtkMapper *) {} 164 164 165 165 //Internal matrices to avoid New/Delete for performance reasons … … 168 168 }; 169 169 170 #endif // __vtkRpAxisFollower_h170 #endif // vtkRpAxisFollower_h -
vtkvis/branches/1.8/vtkRpCubeAxesActor.cpp
r3615 r5838 2 2 3 3 Program: Visualization Toolkit 4 Module: vtkRpCubeAxesActor.c pp4 Module: vtkRpCubeAxesActor.cxx 5 5 Thanks: Kathleen Bonnell, B Division, Lawrence Livermore National Lab 6 6 … … 29 29 #include "vtkViewport.h" 30 30 31 #include "Trace.h" 31 #include <algorithm> 32 #include <sstream> 33 #include <string> 32 34 33 35 vtkStandardNewMacro(vtkRpCubeAxesActor); … … 62 64 this->AxisBaseForX[0] = this->AxisBaseForY[1] = this->AxisBaseForZ[2] = 1.0; 63 65 64 this->RebuildAxes = false;66 this->RebuildAxes = true; 65 67 66 68 this->Camera = NULL; … … 83 85 this->TitleTextProperty[i]->SetColor(1.,1.,1.); 84 86 this->TitleTextProperty[i]->SetFontFamilyToArial(); 85 this->TitleTextProperty[i]->SetFontSize(14); 87 this->TitleTextProperty[i]->SetFontSize(18); 88 this->TitleTextProperty[i]->SetVerticalJustificationToCentered(); 89 this->TitleTextProperty[i]->SetJustificationToCentered(); 86 90 87 91 this->LabelTextProperty[i] = vtkTextProperty::New(); 88 92 this->LabelTextProperty[i]->SetColor(1.,1.,1.); 89 93 this->LabelTextProperty[i]->SetFontFamilyToArial(); 90 this->LabelTextProperty[i]->SetFontSize(12); 94 this->LabelTextProperty[i]->SetFontSize(14); 95 this->LabelTextProperty[i]->SetVerticalJustificationToBottom(); 96 this->LabelTextProperty[i]->SetJustificationToLeft(); 91 97 } 92 98 … … 119 125 //this->ZAxesGridpolysProperty->LightingOff(); // To be able to see the polys from high camera angles 120 126 121 this->ScreenSize = 10.0; 122 123 this->LabelScreenOffset = 20.0 + this->ScreenSize * 0.5; 124 this->TitleScreenOffset = 125 this->LabelScreenOffset * 2.0 + this->ScreenSize * 0.5; 127 this->ScreenSize = 10.; 128 this->LabelOffset = 20.; 129 this->TitleOffset = 20.; 126 130 127 131 for (int i = 0; i < NUMBER_OF_ALIGNED_AXIS; i++) … … 138 142 this->XAxes[i]->SetInnerGridlinesProperty(this->XAxesInnerGridlinesProperty); 139 143 this->XAxes[i]->SetGridpolysProperty(this->XAxesGridpolysProperty); 144 this->XAxes[i]->SetLabelOffset(this->LabelOffset); 145 this->XAxes[i]->SetTitleOffset(this->TitleOffset); 146 this->XAxes[i]->SetScreenSize(this->ScreenSize); 140 147 this->XAxes[i]->SetCalculateTitleOffset(0); 141 148 this->XAxes[i]->SetCalculateLabelOffset(0); 142 this->XAxes[i]->SetScreenSize(this->ScreenSize);143 149 144 150 this->YAxes[i] = vtkRpAxisActor::New(); … … 153 159 this->YAxes[i]->SetInnerGridlinesProperty(this->YAxesInnerGridlinesProperty); 154 160 this->YAxes[i]->SetGridpolysProperty(this->YAxesGridpolysProperty); 161 this->YAxes[i]->SetLabelOffset(this->LabelOffset); 162 this->YAxes[i]->SetTitleOffset(this->TitleOffset); 163 this->YAxes[i]->SetScreenSize(this->ScreenSize); 155 164 this->YAxes[i]->SetCalculateTitleOffset(0); 156 165 this->YAxes[i]->SetCalculateLabelOffset(0); 157 this->YAxes[i]->SetScreenSize(this->ScreenSize);158 166 159 167 this->ZAxes[i] = vtkRpAxisActor::New(); … … 168 176 this->ZAxes[i]->SetInnerGridlinesProperty(this->ZAxesInnerGridlinesProperty); 169 177 this->ZAxes[i]->SetGridpolysProperty(this->ZAxesGridpolysProperty); 178 this->ZAxes[i]->SetLabelOffset(this->LabelOffset); 179 this->ZAxes[i]->SetTitleOffset(this->TitleOffset); 180 this->ZAxes[i]->SetScreenSize(this->ScreenSize); 170 181 this->ZAxes[i]->SetCalculateTitleOffset(0); 171 182 this->ZAxes[i]->SetCalculateLabelOffset(0); 172 this->ZAxes[i]->SetScreenSize(this->ScreenSize);173 183 174 184 // Pass information to axes followers. 175 185 vtkRpAxisFollower* follower = this->XAxes[i]->GetTitleActor(); 176 follower->SetAxis(this->XAxes[i]);177 follower->SetScreenOffset(this->TitleScreenOffset);178 186 follower->SetEnableDistanceLOD( this->EnableDistanceLOD ); 179 187 follower->SetDistanceLODThreshold( this->DistanceLODThreshold ); … … 182 190 183 191 follower = this->YAxes[i]->GetTitleActor(); 184 follower->SetAxis(this->YAxes[i]);185 follower->SetScreenOffset(this->TitleScreenOffset);186 192 follower->SetEnableDistanceLOD( this->EnableDistanceLOD ); 187 193 follower->SetDistanceLODThreshold( this->DistanceLODThreshold ); … … 190 196 191 197 follower = this->ZAxes[i]->GetTitleActor(); 192 follower->SetAxis(this->ZAxes[i]);193 follower->SetScreenOffset(this->TitleScreenOffset);194 198 follower->SetEnableDistanceLOD( this->EnableDistanceLOD ); 195 199 follower->SetDistanceLODThreshold( this->DistanceLODThreshold ); … … 451 455 } 452 456 453 if (this->XLabelFormat) 454 { 455 delete [] this->XLabelFormat; 456 this->XLabelFormat = NULL; 457 } 458 459 if (this->YLabelFormat) 460 { 461 delete [] this->YLabelFormat; 462 this->YLabelFormat = NULL; 463 } 464 465 if (this->ZLabelFormat) 466 { 467 delete [] this->ZLabelFormat; 468 this->ZLabelFormat = NULL; 469 } 470 471 if (this->XTitle) 472 { 473 delete [] this->XTitle; 474 this->XTitle = NULL; 475 } 476 if (this->YTitle) 477 { 478 delete [] this->YTitle; 479 this->YTitle = NULL; 480 } 481 if (this->ZTitle) 482 { 483 delete [] this->ZTitle; 484 this->ZTitle = NULL; 485 } 486 487 if (this->XUnits) 488 { 489 delete [] this->XUnits; 490 this->XUnits = NULL; 491 } 492 if (this->YUnits) 493 { 494 delete [] this->YUnits; 495 this->YUnits = NULL; 496 } 497 if (this->ZUnits) 498 { 499 delete [] this->ZUnits; 500 this->ZUnits = NULL; 501 } 502 503 if (this->ActualXLabel) 504 { 505 delete [] this->ActualXLabel; 506 this->ActualXLabel = NULL; 507 } 508 if (this->ActualYLabel) 509 { 510 delete [] this->ActualYLabel; 511 this->ActualYLabel = NULL; 512 } 513 if (this->ActualZLabel) 514 { 515 delete [] this->ActualZLabel; 516 this->ActualZLabel = NULL; 517 } 457 delete [] this->XLabelFormat; 458 this->XLabelFormat = NULL; 459 460 delete [] this->YLabelFormat; 461 this->YLabelFormat = NULL; 462 463 delete [] this->ZLabelFormat; 464 this->ZLabelFormat = NULL; 465 466 delete [] this->XTitle; 467 this->XTitle = NULL; 468 469 delete [] this->YTitle; 470 this->YTitle = NULL; 471 472 delete [] this->ZTitle; 473 this->ZTitle = NULL; 474 475 delete [] this->XUnits; 476 this->XUnits = NULL; 477 478 delete [] this->YUnits; 479 this->YUnits = NULL; 480 481 delete [] this->ZUnits; 482 this->ZUnits = NULL; 483 484 delete [] this->ActualXLabel; 485 this->ActualXLabel = NULL; 486 487 delete [] this->ActualYLabel; 488 this->ActualYLabel = NULL; 489 490 delete [] this->ActualZLabel; 491 this->ActualZLabel = NULL; 518 492 } 519 493 … … 677 651 { 678 652 this->ScreenSize = screenSize; 679 // Considering pivot point at center of the geometry hence (this->ScreenSize * 0.5).680 this->LabelScreenOffset = 20.0 + this->ScreenSize * 0.5;681 this->TitleScreenOffset = this->LabelScreenOffset * 2.0 +682 this->ScreenSize * 0.5;683 684 653 for (int i = 0; i < NUMBER_OF_ALIGNED_AXIS; i++) 685 654 { 686 this->XAxes[i]->SetScreenSize(this->ScreenSize); 687 this->YAxes[i]->SetScreenSize(this->ScreenSize); 688 this->ZAxes[i]->SetScreenSize(this->ScreenSize); 689 690 this->XAxes[i]->GetTitleActor()->SetScreenOffset(this->TitleScreenOffset); 691 this->YAxes[i]->GetTitleActor()->SetScreenOffset(this->TitleScreenOffset); 692 this->ZAxes[i]->GetTitleActor()->SetScreenOffset(this->TitleScreenOffset); 693 694 int numberOfLabelsBuild = this->XAxes[i]->GetNumberOfLabelsBuilt(); 695 vtkRpAxisFollower **labelActors = this->XAxes[i]->GetLabelActors(); 696 for(int k=0; k < numberOfLabelsBuild; ++k) 697 { 698 labelActors[k]->SetScreenOffset(this->LabelScreenOffset); 699 } 700 701 numberOfLabelsBuild = this->YAxes[i]->GetNumberOfLabelsBuilt(); 702 labelActors = this->YAxes[i]->GetLabelActors(); 703 for(int k=0; k < numberOfLabelsBuild; ++k) 704 { 705 labelActors[k]->SetScreenOffset(this->LabelScreenOffset); 706 } 707 708 numberOfLabelsBuild = this->ZAxes[i]->GetNumberOfLabelsBuilt(); 709 labelActors = this->ZAxes[i]->GetLabelActors(); 710 for(int k=0; k < numberOfLabelsBuild; ++k) 711 { 712 labelActors[k]->SetScreenOffset(this->LabelScreenOffset); 713 } 655 this->XAxes[i]->SetScreenSize(screenSize); 656 this->YAxes[i]->SetScreenSize(screenSize); 657 this->ZAxes[i]->SetScreenSize(screenSize); 658 } 659 660 this->Modified(); 661 } 662 663 // ************************************************************************* 664 // Offset between labels and axis. 665 // ************************************************************************* 666 void vtkRpCubeAxesActor::SetLabelOffset(double offset) 667 { 668 this->LabelOffset = offset; 669 for (int i = 0; i < NUMBER_OF_ALIGNED_AXIS; i++) 670 { 671 this->XAxes[i]->SetLabelOffset(offset); 672 this->YAxes[i]->SetLabelOffset(offset); 673 this->ZAxes[i]->SetLabelOffset(offset); 674 } 675 676 this->Modified(); 677 } 678 679 // ************************************************************************* 680 // Offset between title and labels. 681 // ************************************************************************* 682 void vtkRpCubeAxesActor::SetTitleOffset(double offset) 683 { 684 this->TitleOffset = offset; 685 for (int i = 0; i < NUMBER_OF_ALIGNED_AXIS; i++) 686 { 687 this->XAxes[i]->SetTitleOffset(offset); 688 this->YAxes[i]->SetTitleOffset(offset); 689 this->ZAxes[i]->SetTitleOffset(offset); 714 690 } 715 691 … … 739 715 os << indent << "Bounds: \n"; 740 716 os << indent << " Xmin,Xmax: (" << this->Bounds[0] << ", " 741 << this->Bounds[1] << ") " << endl;717 << this->Bounds[1] << ")\n"; 742 718 os << indent << " Ymin,Ymax: (" << this->Bounds[2] << ", " 743 << this->Bounds[3] << ") " << endl;719 << this->Bounds[3] << ")\n"; 744 720 os << indent << " Zmin,Zmax: (" << this->Bounds[4] << ", " 745 << this->Bounds[5] << ") " << endl;721 << this->Bounds[5] << ")\n"; 746 722 747 723 … … 753 729 << this->ZAxisRange[1] << "] " << endl; 754 730 755 os << indent << "ScreenSize: (" << this->ScreenSize << ") " << endl;731 os << indent << "ScreenSize: (" << this->ScreenSize << ")\n"; 756 732 757 733 if (this->Camera) … … 769 745 if (this->FlyMode == VTK_FLY_CLOSEST_TRIAD) 770 746 { 771 os << indent << "Fly Mode: CLOSEST_TRIAD "<< endl;747 os << indent << "Fly Mode: CLOSEST_TRIAD\n"; 772 748 } 773 749 else if (this->FlyMode == VTK_FLY_FURTHEST_TRIAD) 774 750 { 775 os << indent << "Fly Mode: FURTHEST_TRIAD "<< endl;751 os << indent << "Fly Mode: FURTHEST_TRIAD\n"; 776 752 } 777 753 else if (this->FlyMode == VTK_FLY_STATIC_TRIAD) 778 754 { 779 os << indent << "Fly Mode: STATIC_TRIAD "<< endl;755 os << indent << "Fly Mode: STATIC_TRIAD\n"; 780 756 } 781 757 else if (this->FlyMode == VTK_FLY_STATIC_EDGES) 782 758 { 783 os << indent << "Fly Mode: STATIC_EDGES "<< endl;759 os << indent << "Fly Mode: STATIC_EDGES\n"; 784 760 } 785 761 else 786 762 { 787 os << indent << "Fly Mode: OUTER_EDGES "<< endl;763 os << indent << "Fly Mode: OUTER_EDGES\n"; 788 764 } 789 765 790 766 os << indent << "EnableDistanceLOD: " 791 767 << ( this->EnableDistanceLOD ? "On" : "Off" ) << endl; 792 os << indent << "DistanceLODThreshold: " << this->DistanceLODThreshold << endl;768 os << indent << "DistanceLODThreshold: " << this->DistanceLODThreshold << "\n"; 793 769 794 770 os << indent << "EnableViewAngleLOD: " 795 771 << ( this->EnableViewAngleLOD ? "On" : "Off" ) << endl; 796 os << indent << "ViewAngleLODThreshold: " << this->ViewAngleLODThreshold << endl;797 798 os << indent << "X Axis Title: " << this->XTitle << endl;799 os << indent << "Y Axis Title: " << this->YTitle << endl;800 os << indent << "Z Axis Title: " << this->ZTitle << endl;772 os << indent << "ViewAngleLODThreshold: " << this->ViewAngleLODThreshold << "\n"; 773 774 os << indent << "X Axis Title: " << this->XTitle << "\n"; 775 os << indent << "Y Axis Title: " << this->YTitle << "\n"; 776 os << indent << "Z Axis Title: " << this->ZTitle << "\n"; 801 777 802 778 os << indent << "X Axis Visibility: " … … 807 783 << (this->ZAxisVisibility ? "On\n" : "Off\n"); 808 784 809 os << indent << "X Axis Label Format: " << this->XLabelFormat << endl;810 os << indent << "Y Axis Label Format: " << this->YLabelFormat << endl;811 os << indent << "Z Axis Label Format: " << this->ZLabelFormat << endl;785 os << indent << "X Axis Label Format: " << this->XLabelFormat << "\n"; 786 os << indent << "Y Axis Label Format: " << this->YLabelFormat << "\n"; 787 os << indent << "Z Axis Label Format: " << this->ZLabelFormat << "\n"; 812 788 813 789 os << indent << "XAutoLabelFormat: " … … 818 794 << (this->ZAutoLabelFormat ? "On" : "Off") << endl; 819 795 820 os << indent << "Inertia: " << this->Inertia << endl;821 os << indent << "Corner Offset: " << this->CornerOffset << endl;796 os << indent << "Inertia: " << this->Inertia << "\n"; 797 os << indent << "Corner Offset: " << this->CornerOffset << "\n"; 822 798 823 799 os << indent << "XAxisTickVisibility: " … … 882 858 os << indent << "OrientedBounds: \n"; 883 859 os << indent << " Xmin,Xmax: (" << this->OrientedBounds[0] << ", " 884 << this->OrientedBounds[1] << ") " << endl;860 << this->OrientedBounds[1] << ")\n"; 885 861 os << indent << " Ymin,Ymax: (" << this->OrientedBounds[2] << ", " 886 << this->OrientedBounds[3] << ") " << endl;862 << this->OrientedBounds[3] << ")\n"; 887 863 os << indent << " Zmin,Zmax: (" << this->OrientedBounds[4] << ", " 888 << this->OrientedBounds[5] << ") " << endl;864 << this->OrientedBounds[5] << ")\n"; 889 865 } 890 866 891 867 os << indent << "Base: \n"; 892 868 os << indent << " For X: (" << this->AxisBaseForX[0] << ", " 893 << this->AxisBaseForX[1] << ", " << this->AxisBaseForX[2] << ") " << endl;869 << this->AxisBaseForX[1] << ", " << this->AxisBaseForX[2] << ") \n"; 894 870 os << indent << " For Y: (" << this->AxisBaseForY[0] << ", " 895 << this->AxisBaseForY[1] << ", " << this->AxisBaseForY[2] << ") " << endl;871 << this->AxisBaseForY[1] << ", " << this->AxisBaseForY[2] << ") \n"; 896 872 os << indent << " For Z: (" << this->AxisBaseForZ[0] << ", " 897 << this->AxisBaseForZ[1] << ", " << this->AxisBaseForZ[2] << ") " << endl;873 << this->AxisBaseForZ[1] << ", " << this->AxisBaseForZ[2] << ") \n"; 898 874 899 875 os << indent << "UseAxisOrigin: " << this->UseAxisOrigin << endl; … … 1068 1044 const double zRange[2]) 1069 1045 { 1070 char xTitle[64];1071 1072 1046 int xPow, yPow, zPow; 1073 1047 … … 1106 1080 } 1107 1081 1082 std::string xTitle; 1108 1083 if (xPow != 0) 1109 1084 { … … 1118 1093 this->MustAdjustXValue = true; 1119 1094 1095 std::ostringstream sstream; 1120 1096 if (XUnits == NULL || XUnits[0] == '\0') 1121 1097 { 1122 s printf(xTitle, "%s (x10^%d)", this->XTitle, xPow);1098 sstream << this->XTitle << " (x10^" << xPow << ")"; 1123 1099 } 1124 1100 else 1125 1101 { 1126 sprintf(xTitle, "%s (x10^%d %s)", this->XTitle, xPow, XUnits); 1127 } 1102 sstream << this->XTitle << " (x10^" << xPow << " " << XUnits << ")"; 1103 } 1104 xTitle = sstream.str(); 1128 1105 } 1129 1106 else … … 1142 1119 if (XUnits == NULL || XUnits[0] == '\0') 1143 1120 { 1144 sprintf(xTitle,"%s",this->XTitle);1121 xTitle = this->XTitle; 1145 1122 } 1146 1123 else 1147 1124 { 1148 sprintf(xTitle, "%s (%s)", this->XTitle, XUnits);1149 } 1150 } 1151 1152 char yTitle[64];1125 xTitle = std::string(this->XTitle) + " (" + XUnits + ")"; 1126 } 1127 } 1128 1129 std::string yTitle; 1153 1130 if (yPow != 0) 1154 1131 { … … 1162 1139 } 1163 1140 this->MustAdjustYValue = true; 1141 1142 std::ostringstream sstream; 1164 1143 if (YUnits == NULL || YUnits[0] == '\0') 1165 1144 { 1166 s printf(yTitle, "%s (x10^%d)", this->YTitle, yPow);1145 sstream << this->YTitle << " (x10^" << yPow << ")"; 1167 1146 } 1168 1147 else 1169 1148 { 1170 sprintf(yTitle, "%s (x10^%d %s)", this->YTitle, yPow, YUnits); 1171 } 1149 sstream << this->YTitle << " (x10^" << yPow << " " << YUnits << ")"; 1150 } 1151 yTitle = sstream.str(); 1172 1152 } 1173 1153 else … … 1185 1165 if (YUnits == NULL || YUnits[0] == '\0') 1186 1166 { 1187 sprintf(yTitle,"%s",this->YTitle);1167 yTitle = this->YTitle; 1188 1168 } 1189 1169 else 1190 1170 { 1191 sprintf(yTitle, "%s (%s)", this->YTitle, YUnits);1192 } 1193 } 1194 1195 char zTitle[64];1171 yTitle = std::string(this->YTitle) + " (" + YUnits + ")"; 1172 } 1173 } 1174 1175 std::string zTitle; 1196 1176 if (zPow != 0) 1197 1177 { … … 1206 1186 this->MustAdjustZValue = true; 1207 1187 1188 std::ostringstream sstream; 1208 1189 if (ZUnits == NULL || ZUnits[0] == '\0') 1209 1190 { 1210 s printf(zTitle, "%s (x10^%d)", this->ZTitle, zPow);1191 sstream << this->ZTitle << " (x10^" << zPow << ")"; 1211 1192 } 1212 1193 else 1213 1194 { 1214 sprintf(zTitle, "%s (x10^%d %s)", this->ZTitle, zPow, ZUnits); 1215 } 1195 sstream << this->ZTitle << " (x10^" << zPow << " " << ZUnits << ")"; 1196 } 1197 zTitle = sstream.str(); 1216 1198 } 1217 1199 else … … 1230 1212 if (ZUnits == NULL || ZUnits[0] == '\0') 1231 1213 { 1232 sprintf(zTitle,"%s",this->ZTitle);1214 zTitle = this->ZTitle; 1233 1215 } 1234 1216 else 1235 1217 { 1236 sprintf(zTitle, "%s (%s)", this->ZTitle, ZUnits);1218 zTitle = std::string(this->ZTitle) + " (" + ZUnits + ")"; 1237 1219 } 1238 1220 } … … 1242 1224 this->LastZPow = zPow; 1243 1225 1244 this->SetActualXLabel(xTitle );1245 this->SetActualYLabel(yTitle );1246 this->SetActualZLabel(zTitle );1226 this->SetActualXLabel(xTitle.c_str()); 1227 this->SetActualYLabel(yTitle.c_str()); 1228 this->SetActualZLabel(zTitle.c_str()); 1247 1229 } 1248 1230 … … 1346 1328 int vtkRpCubeAxesActor::Digits(double min, double max ) 1347 1329 { 1348 double range = max - min; 1349 double pow10 = log10(range); 1350 int ipow10 = static_cast<int>(floor(pow10)); 1351 int digitsPastDecimal = -ipow10; 1352 1353 if (digitsPastDecimal < 0) 1354 { 1355 // 1356 // The range is more than 10, but not so big we need scientific 1357 // notation, we don't need to worry about decimals. 1358 // 1330 long digitsPastDecimal; 1331 1332 double range = max - min; 1333 double pow10 = log10(range); 1334 if (!vtkMath::IsFinite(pow10)) 1335 { 1359 1336 digitsPastDecimal = 0; 1360 1337 } 1361 1338 else 1362 1339 { 1363 // 1364 // We want one more than the range since there is more than one 1365 // tick per decade. 1366 // 1367 digitsPastDecimal++; 1368 1369 // 1370 // Anything more than 5 is just noise. (and probably 5 is noise with 1371 // doubleing point if the part before the decimal is big). 1372 // 1373 if (digitsPastDecimal > 5) 1374 { 1375 digitsPastDecimal = 5; 1376 } 1377 } 1378 1379 return digitsPastDecimal; 1340 long ipow10 = static_cast<long>(floor(pow10)); 1341 digitsPastDecimal = -ipow10; 1342 1343 if (digitsPastDecimal < 0) 1344 { 1345 // 1346 // The range is more than 10, but not so big we need scientific 1347 // notation, we don't need to worry about decimals. 1348 // 1349 digitsPastDecimal = 0; 1350 } 1351 else 1352 { 1353 // 1354 // We want one more than the range since there is more than one 1355 // tick per decade. 1356 // 1357 digitsPastDecimal++; 1358 1359 // 1360 // Anything more than 5 is just noise. (and probably 5 is noise with 1361 // doubling point if the part before the decimal is big). 1362 // 1363 if (digitsPastDecimal > 5) 1364 { 1365 digitsPastDecimal = 5; 1366 } 1367 } 1368 } 1369 1370 return (int)digitsPastDecimal; 1380 1371 } 1381 1372 … … 1539 1530 double xRange[2], yRange[2], zRange[2]; 1540 1531 1541 // this method sets the Coords, and offsets if necessary.1532 // this method sets the coords, offsets, and ranges if necessary. 1542 1533 this->AdjustAxes(bounds, xCoords, yCoords, zCoords, xRange, yRange, zRange); 1543 1534 … … 1661 1652 this->YAxes[i]->SetTitleScale(this->TitleScale); 1662 1653 this->ZAxes[i]->SetTitleScale(this->TitleScale); 1654 1655 // Need to build the axis again prior to calling AutoScale so 1656 // that labels are positioned accordingly. 1657 this->XAxes[i]->BuildAxis(viewport, true); 1658 this->YAxes[i]->BuildAxis(viewport, true); 1659 this->ZAxes[i]->BuildAxis(viewport, true); 1663 1660 } 1664 1661 } … … 1938 1935 1939 1936 void vtkRpCubeAxesActor::AdjustTicksComputeRange(vtkRpAxisActor *axes[NUMBER_OF_ALIGNED_AXIS], 1940 1937 double boundsMin, double boundsMax) 1941 1938 { 1942 1939 double sortedRange[2], range; … … 2006 2003 customizedLabels = this->AxisLabels[axis]; 2007 2004 2008 //TRACE("sortedRange[0]: %g %g", sortedRange[0], this->FFix(sortedRange[0]*(1./major)) - sortedRange[0]*(1./major));2009 2010 2005 if (customizedLabels == NULL) 2011 2006 { … … 2062 2057 } 2063 2058 2064 //TRACE("range majorStart: %g major: %g", majorStart, major);2065 2066 2059 double t; 2067 2060 t = (minorStart - sortedRange[0])/range; … … 2072 2065 minor *= scale; 2073 2066 major *= scale; 2074 2075 //TRACE("bounds majorStart: %g major: %g", majorStart, major);2076 2067 2077 2068 // Set major start and delta for the corresponding cube axis … … 2134 2125 labelActors[j]->GetPosition()); 2135 2126 2136 labelActors[j]->SetScale(newLabelScale);2127 axis[i]->SetLabelScale(j, newLabelScale); 2137 2128 } 2138 2129 } … … 2287 2278 for (int i = 0; i < labelCount; ++i) 2288 2279 { 2289 labels->SetValue(i, customizedLabels->GetValue( (vtkIdType)(i * delta)));2280 labels->SetValue(i, customizedLabels->GetValue(static_cast<vtkIdType>(i * delta))); 2290 2281 } 2291 2282 } … … 2359 2350 // Set axes and screen size of the labels. 2360 2351 // **************************************************************************** 2361 void vtkRpCubeAxesActor::UpdateLabels(vtkRpAxisActor **axis, int index)2352 void vtkRpCubeAxesActor::UpdateLabels(vtkRpAxisActor **axis, int vtkNotUsed(index)) 2362 2353 { 2363 2354 for (int i = 0; i < NUMBER_OF_ALIGNED_AXIS; i++) … … 2367 2358 for(int k=0; k < numberOfLabelsBuild; ++k) 2368 2359 { 2369 if(index == 0)2370 {2371 labelActors[k]->SetAxis(this->XAxes[i]);2372 }2373 else if(index == 1)2374 {2375 labelActors[k]->SetAxis(this->YAxes[i]);2376 }2377 else if(index == 2)2378 {2379 labelActors[k]->SetAxis(this->ZAxes[i]);2380 }2381 else2382 {2383 // Do nothing.2384 }2385 2386 labelActors[k]->SetScreenOffset(this->LabelScreenOffset);2387 2360 labelActors[k]->SetEnableDistanceLOD( this->EnableDistanceLOD ); 2388 2361 labelActors[k]->SetDistanceLODThreshold( this->DistanceLODThreshold ); -
vtkvis/branches/1.8/vtkRpCubeAxesActor.h
r3583 r5838 54 54 // vtkActor vtkAxisActor vtkCubeAxesActor2D 55 55 56 #ifndef __vtkRpCubeAxesActor_h57 #define __vtkRpCubeAxesActor_h56 #ifndef vtkRpCubeAxesActor_h 57 #define vtkRpCubeAxesActor_h 58 58 59 59 #define VTK_FLY_OUTER_EDGES 0 … … 141 141 // Description: 142 142 // Explicitly specify the screen size of title and label text. 143 // ScreenSize dete mines the size of the text in terms of screen143 // ScreenSize determines the size of the text in terms of screen 144 144 // pixels. Default is 10.0. 145 145 void SetScreenSize(double screenSize); 146 146 vtkGetMacro(ScreenSize, double); 147 148 // Description: 149 // Explicitly specify the distance between labels and the axis. 150 // Default is 20.0. 151 void SetLabelOffset(double offset); 152 vtkGetMacro(LabelOffset, double); 153 154 // Description: 155 // Explicitly specify the distance between title and labels. 156 // Default is 20.0. 157 void SetTitleOffset(double offset); 158 vtkGetMacro(TitleOffset, double); 147 159 148 160 // Description: … … 385 397 // Description: 386 398 // Get/Set 2D mode 387 // NB: Use vtkTextActor for titles in 2D instead of vtk RpAxisFollower399 // NB: Use vtkTextActor for titles in 2D instead of vtkAxisFollower 388 400 void SetUse2DMode( int val ); 389 401 int GetUse2DMode(); … … 572 584 573 585 int RenderSomething; 574 575 double LabelScreenOffset;576 double TitleScreenOffset;577 586 578 587 vtkTextProperty* TitleTextProperty[3]; … … 663 672 664 673 double ScreenSize; 674 double LabelOffset; 675 double TitleOffset; 665 676 666 677 // Description:
Note: See TracChangeset
for help on using the changeset viewer.