Changeset 5838 for vtkvis/branches/1.8


Ignore:
Timestamp:
Aug 22, 2015 2:55:58 PM (9 years ago)
Author:
ldelgass
Message:

merge r5802 from vtkvis trunk (update custom axes)

Location:
vtkvis/branches/1.8
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • vtkvis/branches/1.8

  • vtkvis/branches/1.8/vtkRpAxisActor.cpp

    r3549 r5838  
    22
    33  Program:   Visualization Toolkit
    4   Module:    vtkRpAxisActor.cpp
     4  Module:    vtkRpAxisActor.cxx
    55  Thanks:    Kathleen Bonnell, B Division, Lawrence Livermore Nat'l Laboratory
    66
     
    3232#include "vtkVectorText.h"
    3333#include "vtkViewport.h"
     34#include "vtkVersion.h"
     35#include "vtkWindow.h"
    3436
    3537vtkStandardNewMacro(vtkRpAxisActor);
     
    6062  this->Range[0] = 0.0;
    6163  this->Range[1] = 1.0;
     64  this->ScreenSize = 10.;
     65  this->LabelOffset = 20.;
     66  this->TitleOffset = 20.;
    6267
    6368  this->Bounds[0] = this->Bounds[2] = this->Bounds[4] = -1;
     
    7075  this->TitleTextProperty->SetColor(0.,0.,0.);
    7176  this->TitleTextProperty->SetFontFamilyToArial();
    72   this->TitleTextProperty->SetFontSize(14);
     77  this->TitleTextProperty->SetFontSize(18);
     78  this->TitleTextProperty->SetVerticalJustificationToCentered();
     79  this->TitleTextProperty->SetJustificationToCentered();
    7380
    7481  this->TitleVector = vtkVectorText::New();
     
    7784    this->TitleVector->GetOutputPort());
    7885  this->TitleActor = vtkRpAxisFollower::New();
     86  this->TitleActor->SetAxis(this);
    7987  this->TitleActor->SetMapper(this->TitleMapper);
    8088  this->TitleActor->SetEnableDistanceLOD(0);
     
    9098  this->LabelTextProperty->SetColor(0.,0.,0.);
    9199  this->LabelTextProperty->SetFontFamilyToArial();
    92   this->LabelTextProperty->SetFontSize(12);
     100  this->LabelTextProperty->SetFontSize(14);
     101  this->LabelTextProperty->SetVerticalJustificationToBottom();
     102  this->LabelTextProperty->SetJustificationToLeft();
    93103
    94104  this->AxisLines = vtkPolyData::New();
     
    177187  this->CalculateLabelOffset = 1;
    178188
    179   this->ScreenSize = 10.;
    180 
    181189  // Instance variables specific to 2D mode
    182190  this->Use2DMode = 0;
     
    221229    }
    222230
    223   if (this->LabelFormat)
    224     {
    225     delete [] this->LabelFormat;
    226     this->LabelFormat = NULL;
    227     }
     231  delete [] this->LabelFormat;
     232  this->LabelFormat = NULL;
    228233
    229234  if (this->TitleVector)
     
    248253    }
    249254
    250   if (this->Title)
    251     {
    252     delete [] this->Title;
    253     this->Title = NULL;
    254     }
     255  delete [] this->Title;
     256  this->Title = NULL;
    255257
    256258  if (this->TitleTextProperty)
     
    410412    if (this->Title != NULL && this->Title[0] != 0 && this->TitleVisibility)
    411413      {
    412       if (this->Use2DMode == 0)
     414      if (this->Use2DMode)
     415        {
     416        renderedSomething += this->TitleActor2D->RenderOpaqueGeometry(viewport);
     417        }
     418      else
    413419        {
    414420        renderedSomething += this->TitleActor->RenderOpaqueGeometry(viewport);
    415421        }
    416       else
    417         {
    418         renderedSomething += this->TitleActor2D->RenderOpaqueGeometry(viewport);
    419         }
    420422      }
    421423    if (this->AxisVisibility || this->TickVisibility)
     
    435437      for (i=0; i<this->NumberOfLabelsBuilt; i++)
    436438        {
    437         if (this->Use2DMode == 0)
     439        if (this->Use2DMode)
     440          {
     441          renderedSomething +=
     442            this->LabelActors2D[i]->RenderOpaqueGeometry(viewport);
     443          }
     444        else
    438445          {
    439446          renderedSomething +=
    440447            this->LabelActors[i]->RenderOpaqueGeometry(viewport);
    441448          }
    442         else
    443           {
    444           renderedSomething +=
    445             this->LabelActors2D[i]->RenderOpaqueGeometry(viewport);
    446           }
    447449        }
    448450      }
     
    478480      renderedSomething += this->GridpolysActor->RenderTranslucentPolygonalGeometry(viewport);
    479481      }
    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    }
    482510  return renderedSomething;
    483511}
     
    493521  if (!this->AxisHasZeroLength && !this->DrawGridlinesOnly)
    494522    {
    495     if( this->Use2DMode == 1 )
     523    if (this->Use2DMode)
    496524      {
    497525      renderedSomething += this->TitleActor2D->RenderOverlay(viewport);
     526      }
     527    else
     528      {
     529      renderedSomething += this->TitleActor->RenderOverlay(viewport);
    498530      }
    499531    if (this->LabelVisibility)
     
    501533      for (i=0; i<this->NumberOfLabelsBuilt; i++)
    502534        {
    503         if (this->Use2DMode == 1)
     535        if (this->Use2DMode)
    504536          {
    505537          renderedSomething += this->LabelActors2D[i]->RenderOverlay(viewport);
     538          }
     539        else
     540          {
     541          renderedSomething += this->LabelActors[i]->RenderOverlay(viewport);
    506542          }
    507543        }
     
    578614
    579615    if (this->DrawGridpolys &&
    580         this-GridpolysActor->HasTranslucentPolygonalGeometry())
     616        this->GridpolysActor->HasTranslucentPolygonalGeometry())
    581617      {
    582618      return 1;
     
    627663    this->TitleActor->SetProperty(this->GetProperty());
    628664    this->TitleActor->GetProperty()->SetColor(this->TitleTextProperty->GetColor());
     665    this->TitleActor->GetProperty()->SetOpacity(this->TitleTextProperty->GetOpacity());
    629666    }
    630667
     
    660697    }
    661698
    662   // If label positions changed, need to rescale
    663   this->AutoScale(viewport);
    664 
    665699  this->LastAxisPosition = this->AxisPosition;
    666700
     
    686720    this->LabelActors[i]->SetProperty(this->GetProperty());
    687721    this->LabelActors[i]->GetProperty()->SetColor(this->LabelTextProperty->GetColor());
     722    this->LabelActors[i]->GetProperty()->SetOpacity(this->LabelTextProperty->GetOpacity());
    688723    this->LabelActors[i]->SetOrientation(0., 0., this->LabelTextProperty->GetOrientation());
    689724
     
    703738}
    704739
    705 int vtkRpAxisActorMultiplierTable1[4] = { -1, -1, 1,  1};
    706 int vtkRpAxisActorMultiplierTable2[4] = { -1,  1, 1, -1};
     740static const int vtkRpAxisActorMultiplierTable1[4] = { -1, -1, 1,  1};
     741static const int vtkRpAxisActorMultiplierTable2[4] = { -1,  1, 1, -1};
    707742
    708743// *******************************************************************
     
    716751    }
    717752
    718   double bounds[6], center[3], tick[3], pos[3], scale[3];
     753  double bounds[6], center[3], tick[3], pos[3];
    719754  int i = 0;
    720755  int xmult = 0;
    721756  int ymult = 0;
     757  double labelAngle = vtkMath::RadiansFromDegrees(this->LabelTextProperty->GetOrientation());
     758  double labelCos = fabs(cos(labelAngle));
     759  double labelSin = fabs(sin(labelAngle));
     760
    722761
    723762  switch (this->AxisType)
     
    755794
    756795    this->LabelActors[i]->GetMapper()->GetBounds(bounds);
    757     this->LabelActors[i]->GetScale(scale);
    758796
    759797    if(this->CalculateLabelOffset)
    760798      {
    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);
    763801
    764802      center[0] = tick[0] + xmult * (halfWidth  + this->MinorTickSize);
     
    772810    else
    773811      {
    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);
    781818      }
    782819
    783820    this->LabelActors[i]->SetPosition(pos[0], pos[1], pos[2]);
    784821    }
    785 }
    786 
    787 void
    788 vtkRpAxisActor::AutoScale(vtkViewport *viewport)
    789 {
    790     double newTitleScale
    791         = 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 newLabelScale
    803         = this->AutoScale(viewport,
    804                           this->ScreenSize,
    805                           labelActors[j]->GetPosition());
    806 
    807       labelActors[j]->SetScale(newLabelScale);
    808       }
    809 }
    810 
    811 double
    812 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 * screenSize
    819       * 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;
    829822}
    830823
     
    841834    {
    842835    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);
    847838    }
    848839
     
    906897    return;
    907898    }
    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
    909908  for (int i = 0; i < this->NumberOfLabelsBuilt; i++)
    910909    {
     
    923922    int bbox[4];
    924923    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
    925928                              this->LabelActors2D[i]->GetInput(), bbox))
     929#endif
    926930      {
    927931      vtkErrorMacro(<< "Unable to calculate bounding box for label "
     
    951955    return;
    952956    }
    953   double labBounds[6], titleBounds[6], center[3], pos[3], scale[3];
     957  double labBounds[6], titleBounds[6], center[3], pos[3];
    954958  double labHeight, maxHeight = 0, labWidth, maxWidth = 0;
    955959  double halfTitleWidth, halfTitleHeight;
     960  double labelAngle = vtkMath::RadiansFromDegrees(this->LabelTextProperty->GetOrientation());
     961  double labelCos = fabs(cos(labelAngle));
     962  double labelSin = fabs(sin(labelAngle));
    956963
    957964  double *p1 = this->Point1Coordinate->GetValue();
     
    991998    {
    992999    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;
    9951001    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;
    9971003    maxHeight = (labHeight > maxHeight ? labHeight : maxHeight);
    9981004    }
     
    10021008  this->TitleActor->GetProperty()->SetColor(this->TitleTextProperty->GetColor());
    10031009  this->TitleActor->SetCamera(this->Camera);
    1004   this->TitleActor->SetPosition(p2[0], p2[1], p2[2]);
    10051010  this->TitleActor->GetMapper()->GetBounds(titleBounds);
    1006   this->TitleActor->GetScale(scale);
     1011
    10071012  if(!this->GetCalculateTitleOffset())
    10081013    {
     
    10141019  center[2] = p1[2] + (p2[2] - p1[2]) / 2.0;
    10151020
     1021  halfTitleHeight = (titleBounds[3] - titleBounds[2]) * 0.5;
    10161022  if(this->CalculateTitleOffset)
    10171023    {
    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;
    10201025    center[0] += xmult * (halfTitleWidth + maxWidth);
    10211026    center[1] += ymult * (halfTitleHeight + 2*maxHeight);
     1027    }
     1028  else
     1029    {
     1030    this->TitleActor->SetScreenOffset(this->TitleOffset +
     1031      this->LabelOffset + this->ScreenSize * (maxHeight + halfTitleHeight));
    10221032    }
    10231033
     
    10441054  this->TitleActor2D->SetInput( this->TitleVector->GetText() );
    10451055  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);
    10501058
    10511059  if (this->AxisType == VTK_AXIS_TYPE_Y)
     
    12731281  //
    12741282  int i, numLabels = labels->GetNumberOfValues();
     1283  if (numLabels < 0)
     1284    {
     1285    vtkErrorMacro(<< "Number of labels " << numLabels << " is invalid");
     1286    return;
     1287    }
    12751288  if (this->NumberOfLabelsBuilt != numLabels)
    12761289    {
     
    13021315        this->LabelVectors[i]->GetOutputPort());
    13031316      this->LabelActors[i] = vtkRpAxisFollower::New();
     1317      this->LabelActors[i]->SetAxis(this);
    13041318      this->LabelActors[i]->SetMapper(this->LabelMappers[i]);
    13051319      this->LabelActors[i]->SetEnableDistanceLOD(0);
     
    13071321      this->LabelActors[i]->GetProperty()->SetDiffuse(0.);
    13081322      this->LabelActors[i]->GetProperty()->SetColor(this->LabelTextProperty->GetColor());
     1323      this->LabelActors[i]->GetProperty()->SetOpacity(this->LabelTextProperty->GetOpacity());
    13091324      this->LabelActors2D[i] = vtkTextActor::New();
    13101325      }
     
    14611476// *********************************************************************
    14621477void
    1463 vtkRpAxisActor::SetBounds(double b[6])
     1478vtkRpAxisActor::SetBounds(const double b[6])
    14641479{
    14651480  if ((this->Bounds[0] != b[0]) ||
     
    15371552    this->LabelActors[i]->SetProperty(newProp);
    15381553    this->LabelActors[i]->GetMapper()->GetBounds(bounds);
    1539     this->LabelActors[i]->GetProperty()->SetColor(this->LabelTextProperty->GetColor());
    15401554    xsize = bounds[1] - bounds[0];
    15411555    ysize = bounds[3] - bounds[2];
     
    15621576  newProp->Delete();
    15631577  this->TitleActor->GetMapper()->GetBounds(bounds);
    1564   this->TitleActor->GetProperty()->SetColor(this->TitleTextProperty->GetColor());
    15651578  xsize = bounds[1] - bounds[0];
    15661579  ysize = bounds[3] - bounds[2];
     
    15751588  for (int i=0; i < this->NumberOfLabelsBuilt; i++)
    15761589    {
    1577     this->LabelActors[i]->SetScale(s);
    1578     }
     1590    this->SetLabelScale(i, s);
     1591    }
     1592}
     1593
     1594// *********************************************************************
     1595void vtkRpAxisActor::SetLabelScale(int label, const double s)
     1596{
     1597  this->LabelActors[label]->SetScale(s);
    15791598}
    15801599
     
    15961615    return;
    15971616    }
    1598   if (this->Title)
    1599     {
    1600     delete [] this->Title;
    1601     }
     1617  delete [] this->Title;
    16021618  if (t)
    16031619    {
  • vtkvis/branches/1.8/vtkRpAxisActor.h

    r3549 r5838  
    4949// vtkActor vtkVectorText vtkPolyDataMapper vtkRpAxisActor2D vtkCoordinate
    5050
    51 #ifndef __vtkRpAxisActor_h
    52 #define __vtkRpAxisActor_h
     51#ifndef vtkRpAxisActor_h
     52#define vtkRpAxisActor_h
    5353
    5454#include "vtkRenderingAnnotationModule.h" // For export macro
     
    118118  // Description:
    119119  // 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]);
    121121  void   SetBounds(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax);
    122122  double *GetBounds(void);
    123123  void   GetBounds(double bounds[6]);
    124 
    125   vtkSetMacro(ScreenSize, double);
    126   vtkGetMacro(ScreenSize, double);
    127124
    128125  // Description:
     
    136133  vtkGetMacro(MinorTicksVisible, int);
    137134  vtkBooleanMacro(MinorTicksVisible, int);
    138 
    139135
    140136  // Description:
     
    308304  double ComputeTitleLength(const double [3]);
    309305//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);
    312309
    313310  // Description:
     
    420417  vtkGetMacro(AxisOnOrigin,int);
    421418
     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);
    422427
    423428 protected:
     
    468473
    469474  void TransformBounds(vtkViewport *, double bnds[6]);
    470 
    471   void AutoScale(vtkViewport *viewport);
    472   double AutoScale(vtkViewport *viewport, double screenSize,
    473                    double position[3]);
    474475
    475476  void BuildLabels(vtkViewport *, bool);
     
    559560  int                 CalculateLabelOffset;
    560561
    561   double              ScreenSize;
    562 
    563562  // Description:
    564563  // Use xy-axis only when Use2DMode=1:
     
    592591  double              LastMinDisplayCoordinate[3];
    593592  double              LastMaxDisplayCoordinate[3];
     593
     594  // Description:
     595  // Offsets used to position text.
     596  double ScreenSize;
     597  double LabelOffset;
     598  double TitleOffset;
    594599};
    595600
    596 
    597601#endif
  • vtkvis/branches/1.8/vtkRpAxisFollower.cpp

    r3479 r5838  
    585585  this->Device->SetUserMatrix(this->Matrix);
    586586
     587  this->SetVisibility(this->VisibleAtCurrentViewAngle);
    587588  if(this->VisibleAtCurrentViewAngle)
    588589    {
    589590    this->Device->Render(ren,this->Mapper);
    590     }
    591   else
    592     {
    593     this->SetVisibility(this->VisibleAtCurrentViewAngle);
    594591    }
    595592}
  • vtkvis/branches/1.8/vtkRpAxisFollower.h

    r3479 r5838  
    2525
    2626
    27 #ifndef __vtkRpAxisFollower_h
    28 #define __vtkRpAxisFollower_h
     27#ifndef vtkRpAxisFollower_h
     28#define vtkRpAxisFollower_h
    2929
    3030#include "vtkRenderingAnnotationModule.h" // For export macro
     
    161161
    162162 // hide the two parameter Render() method from the user and the compiler.
    163  virtual void Render(vtkRenderer *, vtkMapper *) {};
     163 virtual void Render(vtkRenderer *, vtkMapper *) {}
    164164
    165165 //Internal matrices to avoid New/Delete for performance reasons
     
    168168};
    169169
    170 #endif // __vtkRpAxisFollower_h
     170#endif // vtkRpAxisFollower_h
  • vtkvis/branches/1.8/vtkRpCubeAxesActor.cpp

    r3615 r5838  
    22
    33  Program:   Visualization Toolkit
    4   Module:    vtkRpCubeAxesActor.cpp
     4  Module:    vtkRpCubeAxesActor.cxx
    55  Thanks:    Kathleen Bonnell, B Division, Lawrence Livermore National Lab
    66
     
    2929#include "vtkViewport.h"
    3030
    31 #include "Trace.h"
     31#include <algorithm>
     32#include <sstream>
     33#include <string>
    3234
    3335vtkStandardNewMacro(vtkRpCubeAxesActor);
     
    6264  this->AxisBaseForX[0] = this->AxisBaseForY[1] = this->AxisBaseForZ[2] = 1.0;
    6365
    64   this->RebuildAxes = false;
     66  this->RebuildAxes = true;
    6567
    6668  this->Camera = NULL;
     
    8385    this->TitleTextProperty[i]->SetColor(1.,1.,1.);
    8486    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();
    8690
    8791    this->LabelTextProperty[i] = vtkTextProperty::New();
    8892    this->LabelTextProperty[i]->SetColor(1.,1.,1.);
    8993    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();
    9197    }
    9298
     
    119125  //this->ZAxesGridpolysProperty->LightingOff();       // To be able to see the polys from high camera angles
    120126
    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.;
    126130
    127131  for (int i = 0; i < NUMBER_OF_ALIGNED_AXIS; i++)
     
    138142    this->XAxes[i]->SetInnerGridlinesProperty(this->XAxesInnerGridlinesProperty);
    139143    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);
    140147    this->XAxes[i]->SetCalculateTitleOffset(0);
    141148    this->XAxes[i]->SetCalculateLabelOffset(0);
    142     this->XAxes[i]->SetScreenSize(this->ScreenSize);
    143149
    144150    this->YAxes[i] = vtkRpAxisActor::New();
     
    153159    this->YAxes[i]->SetInnerGridlinesProperty(this->YAxesInnerGridlinesProperty);
    154160    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);
    155164    this->YAxes[i]->SetCalculateTitleOffset(0);
    156165    this->YAxes[i]->SetCalculateLabelOffset(0);
    157     this->YAxes[i]->SetScreenSize(this->ScreenSize);
    158166
    159167    this->ZAxes[i] = vtkRpAxisActor::New();
     
    168176    this->ZAxes[i]->SetInnerGridlinesProperty(this->ZAxesInnerGridlinesProperty);
    169177    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);
    170181    this->ZAxes[i]->SetCalculateTitleOffset(0);
    171182    this->ZAxes[i]->SetCalculateLabelOffset(0);
    172     this->ZAxes[i]->SetScreenSize(this->ScreenSize);
    173183
    174184    // Pass information to axes followers.
    175185    vtkRpAxisFollower* follower = this->XAxes[i]->GetTitleActor();
    176     follower->SetAxis(this->XAxes[i]);
    177     follower->SetScreenOffset(this->TitleScreenOffset);
    178186    follower->SetEnableDistanceLOD( this->EnableDistanceLOD );
    179187    follower->SetDistanceLODThreshold( this->DistanceLODThreshold );
     
    182190
    183191    follower = this->YAxes[i]->GetTitleActor();
    184     follower->SetAxis(this->YAxes[i]);
    185     follower->SetScreenOffset(this->TitleScreenOffset);
    186192    follower->SetEnableDistanceLOD( this->EnableDistanceLOD );
    187193    follower->SetDistanceLODThreshold( this->DistanceLODThreshold );
     
    190196
    191197    follower = this->ZAxes[i]->GetTitleActor();
    192     follower->SetAxis(this->ZAxes[i]);
    193     follower->SetScreenOffset(this->TitleScreenOffset);
    194198    follower->SetEnableDistanceLOD( this->EnableDistanceLOD );
    195199    follower->SetDistanceLODThreshold( this->DistanceLODThreshold );
     
    451455    }
    452456
    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;
    518492}
    519493
     
    677651{
    678652  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 
    684653  for (int i = 0; i < NUMBER_OF_ALIGNED_AXIS; i++)
    685654    {
    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// *************************************************************************
     666void 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// *************************************************************************
     682void 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);
    714690    }
    715691
     
    739715  os << indent << "Bounds: \n";
    740716  os << indent << "  Xmin,Xmax: (" << this->Bounds[0] << ", "
    741      << this->Bounds[1] << ")" << endl;
     717     << this->Bounds[1] << ")\n";
    742718  os << indent << "  Ymin,Ymax: (" << this->Bounds[2] << ", "
    743      << this->Bounds[3] << ")" << endl;
     719     << this->Bounds[3] << ")\n";
    744720  os << indent << "  Zmin,Zmax: (" << this->Bounds[4] << ", "
    745      << this->Bounds[5] << ")" << endl;
     721     << this->Bounds[5] << ")\n";
    746722
    747723
     
    753729    << this->ZAxisRange[1] << "] " << endl;
    754730
    755   os << indent << "ScreenSize: (" << this->ScreenSize << ")" << endl;
     731  os << indent << "ScreenSize: (" << this->ScreenSize << ")\n";
    756732
    757733  if (this->Camera)
     
    769745  if (this->FlyMode == VTK_FLY_CLOSEST_TRIAD)
    770746    {
    771     os << indent << "Fly Mode: CLOSEST_TRIAD"<< endl;
     747    os << indent << "Fly Mode: CLOSEST_TRIAD\n";
    772748    }
    773749  else if (this->FlyMode == VTK_FLY_FURTHEST_TRIAD)
    774750    {
    775     os << indent << "Fly Mode: FURTHEST_TRIAD"<< endl;
     751    os << indent << "Fly Mode: FURTHEST_TRIAD\n";
    776752    }
    777753  else if (this->FlyMode == VTK_FLY_STATIC_TRIAD)
    778754    {
    779     os << indent << "Fly Mode: STATIC_TRIAD"<< endl;
     755    os << indent << "Fly Mode: STATIC_TRIAD\n";
    780756    }
    781757  else if (this->FlyMode == VTK_FLY_STATIC_EDGES)
    782758    {
    783     os << indent << "Fly Mode: STATIC_EDGES"<< endl;
     759    os << indent << "Fly Mode: STATIC_EDGES\n";
    784760    }
    785761  else
    786762    {
    787     os << indent << "Fly Mode: OUTER_EDGES"<< endl;
     763    os << indent << "Fly Mode: OUTER_EDGES\n";
    788764    }
    789765
    790766  os << indent << "EnableDistanceLOD: "
    791767     << ( this->EnableDistanceLOD ? "On" : "Off" ) << endl;
    792   os << indent << "DistanceLODThreshold: "   << this->DistanceLODThreshold << endl;
     768  os << indent << "DistanceLODThreshold: "   << this->DistanceLODThreshold    << "\n";
    793769
    794770  os << indent << "EnableViewAngleLOD: "
    795771     << ( 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";
    801777
    802778  os << indent << "X Axis Visibility: "
     
    807783     << (this->ZAxisVisibility ? "On\n" : "Off\n");
    808784
    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";
    812788
    813789  os << indent << "XAutoLabelFormat: "
     
    818794     << (this->ZAutoLabelFormat ? "On" : "Off") << endl;
    819795
    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";
    822798
    823799  os << indent << "XAxisTickVisibility: "
     
    882858    os << indent << "OrientedBounds: \n";
    883859    os << indent << "  Xmin,Xmax: (" << this->OrientedBounds[0] << ", "
    884        << this->OrientedBounds[1] << ")" << endl;
     860       << this->OrientedBounds[1] << ")\n";
    885861    os << indent << "  Ymin,Ymax: (" << this->OrientedBounds[2] << ", "
    886        << this->OrientedBounds[3] << ")" << endl;
     862       << this->OrientedBounds[3] << ")\n";
    887863    os << indent << "  Zmin,Zmax: (" << this->OrientedBounds[4] << ", "
    888        << this->OrientedBounds[5] << ")" << endl;
     864       << this->OrientedBounds[5] << ")\n";
    889865    }
    890866
    891867  os << indent << "Base: \n";
    892868  os << indent << "  For X: (" << this->AxisBaseForX[0] << ", "
    893      << this->AxisBaseForX[1] << ", " << this->AxisBaseForX[2] << ")" << endl;
     869     << this->AxisBaseForX[1] << ", " << this->AxisBaseForX[2] << ") \n";
    894870  os << indent << "  For Y: (" << this->AxisBaseForY[0] << ", "
    895      << this->AxisBaseForY[1] << ", " << this->AxisBaseForY[2] << ")" << endl;
     871     << this->AxisBaseForY[1] << ", " << this->AxisBaseForY[2] << ") \n";
    896872  os << indent << "  For Z: (" << this->AxisBaseForZ[0] << ", "
    897      << this->AxisBaseForZ[1] << ", " << this->AxisBaseForZ[2] << ")" << endl;
     873     << this->AxisBaseForZ[1] << ", " << this->AxisBaseForZ[2] << ") \n";
    898874
    899875  os << indent << "UseAxisOrigin: " << this->UseAxisOrigin << endl;
     
    10681044                                    const double zRange[2])
    10691045{
    1070   char xTitle[64];
    1071 
    10721046  int xPow, yPow, zPow;
    10731047
     
    11061080    }
    11071081
     1082  std::string xTitle;
    11081083  if (xPow != 0)
    11091084    {
     
    11181093    this->MustAdjustXValue = true;
    11191094
     1095    std::ostringstream sstream;
    11201096    if (XUnits == NULL || XUnits[0] == '\0')
    11211097      {
    1122       sprintf(xTitle, "%s (x10^%d)", this->XTitle, xPow);
     1098      sstream << this->XTitle << " (x10^" << xPow << ")";
    11231099      }
    11241100    else
    11251101      {
    1126       sprintf(xTitle, "%s (x10^%d %s)", this->XTitle, xPow, XUnits);
    1127       }
     1102      sstream << this->XTitle << " (x10^" << xPow << " " << XUnits << ")";
     1103      }
     1104    xTitle = sstream.str();
    11281105    }
    11291106  else
     
    11421119    if (XUnits == NULL || XUnits[0] == '\0')
    11431120      {
    1144       sprintf(xTitle,"%s",this->XTitle);
     1121      xTitle = this->XTitle;
    11451122      }
    11461123    else
    11471124      {
    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;
    11531130  if (yPow != 0)
    11541131    {
     
    11621139      }
    11631140    this->MustAdjustYValue = true;
     1141
     1142    std::ostringstream sstream;
    11641143    if (YUnits == NULL || YUnits[0] == '\0')
    11651144      {
    1166       sprintf(yTitle, "%s (x10^%d)", this->YTitle, yPow);
     1145      sstream << this->YTitle << " (x10^" << yPow << ")";
    11671146      }
    11681147    else
    11691148      {
    1170       sprintf(yTitle, "%s (x10^%d %s)", this->YTitle, yPow, YUnits);
    1171       }
     1149      sstream << this->YTitle << " (x10^" << yPow << " " << YUnits << ")";
     1150      }
     1151    yTitle = sstream.str();
    11721152    }
    11731153  else
     
    11851165    if (YUnits == NULL || YUnits[0] == '\0')
    11861166      {
    1187       sprintf(yTitle,"%s",this->YTitle);
     1167      yTitle = this->YTitle;
    11881168      }
    11891169    else
    11901170      {
    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;
    11961176  if (zPow != 0)
    11971177    {
     
    12061186    this->MustAdjustZValue = true;
    12071187
     1188    std::ostringstream sstream;
    12081189    if (ZUnits == NULL || ZUnits[0] == '\0')
    12091190      {
    1210       sprintf(zTitle, "%s (x10^%d)", this->ZTitle, zPow);
     1191      sstream << this->ZTitle << " (x10^" << zPow << ")";
    12111192      }
    12121193    else
    12131194      {
    1214       sprintf(zTitle, "%s (x10^%d %s)", this->ZTitle, zPow, ZUnits);
    1215       }
     1195      sstream << this->ZTitle << " (x10^" << zPow << " " << ZUnits << ")";
     1196      }
     1197    zTitle = sstream.str();
    12161198    }
    12171199  else
     
    12301212    if (ZUnits == NULL || ZUnits[0] == '\0')
    12311213      {
    1232       sprintf(zTitle,"%s",this->ZTitle);
     1214      zTitle = this->ZTitle;
    12331215      }
    12341216    else
    12351217      {
    1236       sprintf(zTitle, "%s (%s)", this->ZTitle, ZUnits);
     1218      zTitle = std::string(this->ZTitle) + " (" + ZUnits + ")";
    12371219      }
    12381220    }
     
    12421224  this->LastZPow = zPow;
    12431225
    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());
    12471229}
    12481230
     
    13461328int vtkRpCubeAxesActor::Digits(double min, double max )
    13471329{
    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    {
    13591336    digitsPastDecimal = 0;
    13601337    }
    13611338  else
    13621339    {
    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;
    13801371}
    13811372
     
    15391530  double xRange[2], yRange[2], zRange[2];
    15401531
    1541   // this method sets the Coords, and offsets if necessary.
     1532  // this method sets the coords, offsets, and ranges if necessary.
    15421533  this->AdjustAxes(bounds, xCoords, yCoords, zCoords, xRange, yRange, zRange);
    15431534
     
    16611652      this->YAxes[i]->SetTitleScale(this->TitleScale);
    16621653      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);
    16631660      }
    16641661    }
     
    19381935
    19391936void vtkRpCubeAxesActor::AdjustTicksComputeRange(vtkRpAxisActor *axes[NUMBER_OF_ALIGNED_AXIS],
    1940                                                  double boundsMin, double boundsMax)
     1937    double boundsMin, double boundsMax)
    19411938{
    19421939  double sortedRange[2], range;
     
    20062003  customizedLabels = this->AxisLabels[axis];
    20072004
    2008   //TRACE("sortedRange[0]: %g %g", sortedRange[0], this->FFix(sortedRange[0]*(1./major)) - sortedRange[0]*(1./major));
    2009 
    20102005  if (customizedLabels == NULL)
    20112006    {
     
    20622057    }
    20632058
    2064   //TRACE("range majorStart: %g major: %g", majorStart, major);
    2065 
    20662059  double t;
    20672060  t = (minorStart - sortedRange[0])/range;
     
    20722065  minor *= scale;
    20732066  major *= scale;
    2074 
    2075   //TRACE("bounds majorStart: %g major: %g", majorStart, major);
    20762067
    20772068  // Set major start and delta for the corresponding cube axis
     
    21342125                          labelActors[j]->GetPosition());
    21352126
    2136       labelActors[j]->SetScale(newLabelScale);
     2127      axis[i]->SetLabelScale(j, newLabelScale);
    21372128      }
    21382129    }
     
    22872278      for (int i = 0; i < labelCount; ++i)
    22882279        {
    2289         labels->SetValue(i, customizedLabels->GetValue((vtkIdType)(i * delta)));
     2280        labels->SetValue(i, customizedLabels->GetValue(static_cast<vtkIdType>(i * delta)));
    22902281        }
    22912282      }
     
    23592350//  Set axes and screen size of the labels.
    23602351// ****************************************************************************
    2361 void vtkRpCubeAxesActor::UpdateLabels(vtkRpAxisActor **axis, int index)
     2352void vtkRpCubeAxesActor::UpdateLabels(vtkRpAxisActor **axis, int vtkNotUsed(index))
    23622353  {
    23632354  for (int i = 0; i < NUMBER_OF_ALIGNED_AXIS; i++)
     
    23672358    for(int k=0; k < numberOfLabelsBuild; ++k)
    23682359      {
    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       else
    2382         {
    2383         // Do nothing.
    2384         }
    2385 
    2386       labelActors[k]->SetScreenOffset(this->LabelScreenOffset);
    23872360      labelActors[k]->SetEnableDistanceLOD( this->EnableDistanceLOD );
    23882361      labelActors[k]->SetDistanceLODThreshold( this->DistanceLODThreshold );
  • vtkvis/branches/1.8/vtkRpCubeAxesActor.h

    r3583 r5838  
    5454// vtkActor vtkAxisActor vtkCubeAxesActor2D
    5555
    56 #ifndef __vtkRpCubeAxesActor_h
    57 #define __vtkRpCubeAxesActor_h
     56#ifndef vtkRpCubeAxesActor_h
     57#define vtkRpCubeAxesActor_h
    5858
    5959#define VTK_FLY_OUTER_EDGES     0
     
    141141  // Description:
    142142  // Explicitly specify the screen size of title and label text.
    143   // ScreenSize detemines the size of the text in terms of screen
     143  // ScreenSize determines the size of the text in terms of screen
    144144  // pixels. Default is 10.0.
    145145  void SetScreenSize(double screenSize);
    146146  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);
    147159
    148160  // Description:
     
    385397  // Description:
    386398  // Get/Set 2D mode
    387   // NB: Use vtkTextActor for titles in 2D instead of vtkRpAxisFollower
     399  // NB: Use vtkTextActor for titles in 2D instead of vtkAxisFollower
    388400  void SetUse2DMode( int val );
    389401  int GetUse2DMode();
     
    572584
    573585  int RenderSomething;
    574 
    575   double LabelScreenOffset;
    576   double TitleScreenOffset;
    577586
    578587  vtkTextProperty* TitleTextProperty[3];
     
    663672
    664673  double ScreenSize;
     674  double LabelOffset;
     675  double TitleOffset;
    665676
    666677  // Description:
Note: See TracChangeset for help on using the changeset viewer.