Changeset 3479


Ignore:
Timestamp:
Mar 9, 2013, 4:26:48 PM (11 years ago)
Author:
ldelgass
Message:

Update custom axes to VTK 6 versions, use local customized classes instead of
patched VTK runtime versions.

Location:
trunk/packages/vizservers/vtkvis
Files:
2 added
2 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/vizservers/vtkvis/Doxyfile.in

    r3436 r3479  
    598598# subdirectory from a directory tree whose root is specified with the INPUT tag.
    599599
    600 EXCLUDE                =
     600EXCLUDE                = @srcdir@/vtkRpAxisActor.h @srcdir@/vtkRpAxisActor.cpp @srcdir@/vtkRpAxisFollower.h @srcdir@/vtkRpAxisFollower.cpp
    601601
    602602# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
  • trunk/packages/vizservers/vtkvis/Makefile.in

    r3471 r3479  
    11DEBUG                   = #yes
    22TRACE                   = #yes
    3 USE_CUSTOM_AXES         = #yes
     3USE_CUSTOM_AXES         = yes
    44USE_GPU_RAYCASTING      = yes
    55USE_OFFSCREEN_RENDERING = yes
     
    130130ifdef USE_VTK6
    131131VTK_MOD_DEFS    = -DvtkRenderingCore_AUTOINIT="4(vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingFreeTypeOpenGL,vtkRenderingOpenGL)" -DvtkRenderingVolume_AUTOINIT"1(vtkRenderingVolumeOpenGL)"
    132 DEFINES         += -DUSE_VTK6 -DVTK_HYBRID_EXPORT="" -DVTK_RENDERING_EXPORT="" $(VTK_MOD_DEFS)
     132DEFINES         += -DUSE_VTK6 $(VTK_MOD_DEFS)
    133133endif
    134134
     
    176176SERVER_SRCS+= \
    177177        vtkRpAxisActor.cpp \
    178         vtkRpAxisActor2D.cpp \
     178        vtkRpAxisFollower.cpp \
    179179        vtkRpCubeAxesActor.cpp
    180180endif
     
    246246RpVtkDataSet.o: RpVtkDataSet.h Trace.h
    247247RpVtkGraphicsObject.o: RpVtkGraphicsObject.h RpVtkRenderer.h RpVtkDataSet.h ColorMap.h Trace.h
    248 RpVtkRenderer.o: RpVtkRenderer.h RpVtkRendererGraphicsObjs.h vtkRpCubeAxesActor.h vtkRpAxisActor.h vtkRpAxisActor2D.h RpMath.h RpVtkDataSet.h RpArc.h RpArrow.h RpBox.h RpCone.h RpContour2D.h RpContour3D.h RpCutplane.h RpCylinder.h RpDisk.h RpGlyphs.h RpGroup.h RpHeightMap.h RpLIC.h RpLine.h RpMolecule.h RpPolyData.h RpPolygon.h RpPseudoColor.h RpSphere.h RpStreamlines.h RpVolume.h ColorMap.h Trace.h
    249 RpVtkRendererCmd.o: RpVtkRenderer.h RpVtkRendererGraphicsObjs.h vtkRpCubeAxesActor.h vtkRpAxisActor.h vtkRpAxisActor2D.h RpVtkDataSet.h RpArc.h RpArrow.h RpBox.h RpCone.h RpContour2D.h RpContour3D.h RpCutplane.h RpCylinder.h RpDisk.h RpGlyphs.h RpGroup.h RpHeightMap.h RpLIC.h RpLine.h RpMolecule.h RpPolyData.h RpPolygon.h RpPseudoColor.h RpSphere.h RpStreamlines.h RpVolume.h ColorMap.h ReadBuffer.h ResponseQueue.h Trace.h CmdProc.h PPMWriter.h TGAWriter.h
     248RpVtkRenderer.o: RpVtkRenderer.h RpVtkRendererGraphicsObjs.h vtkRpCubeAxesActor.h vtkRpAxisFollower.h vtkRpAxisActor.h RpMath.h RpVtkDataSet.h RpArc.h RpArrow.h RpBox.h RpCone.h RpContour2D.h RpContour3D.h RpCutplane.h RpCylinder.h RpDisk.h RpGlyphs.h RpGroup.h RpHeightMap.h RpLIC.h RpLine.h RpMolecule.h RpPolyData.h RpPolygon.h RpPseudoColor.h RpSphere.h RpStreamlines.h RpVolume.h ColorMap.h Trace.h
     249RpVtkRendererCmd.o: RpVtkRenderer.h RpVtkRendererGraphicsObjs.h vtkRpCubeAxesActor.h vtkRpAxisFollower.h vtkRpAxisActor.h RpVtkDataSet.h RpArc.h RpArrow.h RpBox.h RpCone.h RpContour2D.h RpContour3D.h RpCutplane.h RpCylinder.h RpDisk.h RpGlyphs.h RpGroup.h RpHeightMap.h RpLIC.h RpLine.h RpMolecule.h RpPolyData.h RpPolygon.h RpPseudoColor.h RpSphere.h RpStreamlines.h RpVolume.h ColorMap.h ReadBuffer.h ResponseQueue.h Trace.h CmdProc.h PPMWriter.h TGAWriter.h
    250250RpVtkRendererGraphicsObjs.o: RpVtkRenderer.h RpVtkRendererGraphicsObjs.h RpVtkDataSet.h RpArc.h RpArrow.h RpBox.h RpCone.h RpContour2D.h RpContour3D.h RpCutplane.h RpCylinder.h RpDisk.h RpGlyphs.h RpGroup.h RpHeightMap.h RpLIC.h RpLine.h RpMolecule.h RpPolyData.h RpPolygon.h RpPseudoColor.h RpSphere.h RpStreamlines.h RpVolume.h ColorMap.h Trace.h
    251 RpVtkRenderServer.o: RpVtkRenderServer.h RpVtkRendererCmd.h RpVtkRenderer.h vtkRpCubeAxesActor.h vtkRpAxisActor.h vtkRpAxisActor2D.h ReadBuffer.h ResponseQueue.h Trace.h PPMWriter.h TGAWriter.h
     251RpVtkRenderServer.o: RpVtkRenderServer.h RpVtkRendererCmd.h RpVtkRenderer.h vtkRpCubeAxesActor.h vtkRpAxisFollower.h vtkRpAxisActor.h ReadBuffer.h ResponseQueue.h Trace.h PPMWriter.h TGAWriter.h
    252252RpWarp.o: RpWarp.h RpVtkGraphicsObject.h RpVtkDataSet.h RpVtkRenderer.h ColorMap.h Trace.h
    253253Trace.o: Trace.h
    254254TGAWriter.o: TGAWriter.h ResponseQueue.h Trace.h
    255255vtkRpAxisActor.o: vtkRpAxisActor.h
    256 vtkRpAxisActor2D.o: vtkRpAxisActor2D.h
    257 vtkRpCubeAxesActor.o: vtkRpCubeAxesActor.h vtkRpAxisActor.h vtkRpAxisActor2D.h
     256vtkRpAxisFollower.o: vtkRpAxisFollower.h vtkRpAxisActor.h
     257vtkRpCubeAxesActor.o: vtkRpCubeAxesActor.h vtkRpAxisFollower.h vtkRpAxisActor.h
    258258md5.o: md5.h
  • trunk/packages/vizservers/vtkvis/RpVtkRenderer.cpp

    r3455 r3479  
    2323#include <vtkTransform.h>
    2424#include <vtkCharArray.h>
    25 #include <vtkAxisActor2D.h>
    2625#ifdef USE_CUSTOM_AXES
    2726#include "vtkRpCubeAxesActor.h"
     
    15121511        if (axis == X_AXIS) {
    15131512            _cubeAxesActor->SetXLabelFormat(format);
     1513            _cubeAxesActor->XAutoLabelFormatOff();
    15141514        } else if (axis == Y_AXIS) {
    15151515            _cubeAxesActor->SetYLabelFormat(format);
     1516            _cubeAxesActor->YAutoLabelFormatOff();
    15161517        } else if (axis == Z_AXIS) {
    15171518            _cubeAxesActor->SetZLabelFormat(format);
     1519            _cubeAxesActor->ZAutoLabelFormatOff();
    15181520        }
    15191521        _needsRedraw = true;
  • trunk/packages/vizservers/vtkvis/RpVtkRendererGraphicsObjs.h

    r3330 r3479  
    313313 * \brief Set the prop scaling based on a 2D aspect ratio
    314314 *
    315  * \param aspectRatio The aspect ratio (width/height), zero means native aspect
     315 * \param id The name of the DataSet
     316 * \param aspect The aspect ratio (width/height), zero means native aspect
    316317 */
    317318template<class GraphicsObject>
  • trunk/packages/vizservers/vtkvis/protocol.txt

    r3330 r3479  
    753753nv>dataset vector world <x> <y> <z> <valueX> <valueY> <valueZ> <dataSetName>
    754754nv>dataset vector pixel <x> <y> <valueX> <valueY> <valueZ> <dataSetName>
    755 
     755nv>ok -token <seqnum>
     756   Reply indicated commands through <seqnum> (numbered beginning at 1) have been
     757   processed, but no new image was rendered
    756758================================================================================
    757759Error Replies:
  • trunk/packages/vizservers/vtkvis/vtkRpAxisActor.cpp

    r3330 r3479  
    1414=========================================================================*/
    1515#include "vtkRpAxisActor.h"
     16
     17#include "vtkRpAxisFollower.h"
    1618#include "vtkCamera.h"
    1719#include "vtkCellArray.h"
    1820#include "vtkCoordinate.h"
    1921#include "vtkFollower.h"
     22#include "vtkTextRenderer.h"
     23#include "vtkMath.h"
    2024#include "vtkObjectFactory.h"
    2125#include "vtkPolyData.h"
    2226#include "vtkPolyDataMapper.h"
    2327#include "vtkProperty.h"
     28#include "vtkProperty2D.h"
    2429#include "vtkStringArray.h"
     30#include "vtkTextActor.h"
     31#include "vtkTextProperty.h"
    2532#include "vtkVectorText.h"
    2633#include "vtkViewport.h"
    2734
    28 // ****************************************************************
    29 // Modifications:
    30 //   Kathleen Bonnell, Wed Mar  6 13:48:48 PST 2002
    31 //   Replace 'New' method with macro to match VTK 4.0 API.
    32 // ****************************************************************
    33 
    3435vtkStandardNewMacro(vtkRpAxisActor);
    3536vtkCxxSetObjectMacro(vtkRpAxisActor, Camera, vtkCamera);
     37vtkCxxSetObjectMacro(vtkRpAxisActor,LabelTextProperty,vtkTextProperty);
     38vtkCxxSetObjectMacro(vtkRpAxisActor,TitleTextProperty,vtkTextProperty);
    3639
    3740// ****************************************************************
    3841// Instantiate this object.
    39 //
    40 // Modifications:
    41 //   Kathleen Bonnell, Wed Oct 31 07:57:49 PST 2001
    42 //   Initialize new members mustAdjustValue and valueScaleFactor.
    43 //
    44 //   Kathleen Bonnell, Wed Nov  7 16:19:16 PST 2001
    45 //   No longer allocate large amounts of memory for labels, instead
    46 //   allocate dynamically.  Initialize new members:
    47 //   LastLabelStart; LastAxisPosition; LastTickLocation; LastTickVisibility;
    48 //   LastDrawGridlines; LastMinorTicksVisible; LastRange; MinorTickPts;
    49 //   MajorTickPts; GridlinePts.
    50 //
    51 //   Kathleen Bonnell, Thu May 16 10:13:56 PDT 2002
    52 //   Initialize new member AxisHasZeroLength.
    53 //
    54 //   Kathleen Bonnell, Thu Aug  1 13:44:02 PDT 2002
    55 //   Initialize new member ForceLabelReset.
    56 //
    57 //   Kathleen Bonnell, Fri Jul 25 14:37:32 PDT 2003
    58 //   Removed mustAdjustValue, valueScaleFator, ForceLabelReset.
    59 //
    60 //   Kathleen Bonnell, Thu Apr 29 17:02:10 PDT 2004
    61 //   Initialize MinorStart, MajorStart, DeltaMinor, DeltaMajor.
    62 //
    6342// ****************************************************************
    6443
     
    8867  sprintf(this->LabelFormat, "%s", "%-#6.3g");
    8968
     69  this->TitleTextProperty = vtkTextProperty::New();
     70  this->TitleTextProperty->SetColor(0.,0.,0.);
     71  this->TitleTextProperty->SetFontFamilyToArial();
     72  this->TitleTextProperty->SetFontSize(14);
     73
    9074  this->TitleVector = vtkVectorText::New();
    9175  this->TitleMapper = vtkPolyDataMapper::New();
    92 #ifdef USE_VTK6
    93   this->TitleMapper->SetInputData(this->TitleVector->GetOutput());
    94 #else
    95   this->TitleMapper->SetInput(this->TitleVector->GetOutput());
    96 #endif
    97   this->TitleActor = vtkFollower::New();
     76  this->TitleMapper->SetInputConnection(
     77    this->TitleVector->GetOutputPort());
     78  this->TitleActor = vtkRpAxisFollower::New();
    9879  this->TitleActor->SetMapper(this->TitleMapper);
    99 
    100   // to avoid deleting/rebuilding create once up front
     80  this->TitleActor->SetEnableDistanceLOD(0);
     81  this->TitleActor2D = vtkTextActor::New();
     82
    10183  this->NumberOfLabelsBuilt = 0;
    10284  this->LabelVectors = NULL;
    10385  this->LabelMappers = NULL;
    10486  this->LabelActors = NULL;
    105 
    106   this->Axis = vtkPolyData::New();
    107   this->AxisMapper = vtkPolyDataMapper::New();
    108 #ifdef USE_VTK6
    109   this->AxisMapper->SetInputData(this->Axis);
    110 #else
    111   this->AxisMapper->SetInput(this->Axis);
    112 #endif
    113   this->AxisActor = vtkActor::New();
    114   this->AxisActor->SetMapper(this->AxisMapper);
     87  this->LabelActors2D = NULL;
     88
     89  this->LabelTextProperty = vtkTextProperty::New();
     90  this->LabelTextProperty->SetColor(0.,0.,0.);
     91  this->LabelTextProperty->SetFontFamilyToArial();
     92  this->LabelTextProperty->SetFontSize(12);
     93
     94  this->AxisLines = vtkPolyData::New();
     95  this->AxisLinesMapper = vtkPolyDataMapper::New();
     96  this->AxisLinesMapper->SetInputData(this->AxisLines);
     97  this->AxisLinesActor = vtkActor::New();
     98  this->AxisLinesActor->SetMapper(this->AxisLinesMapper);
     99  this->Gridlines = vtkPolyData::New();
     100  this->GridlinesMapper = vtkPolyDataMapper::New();
     101  this->GridlinesMapper->SetInputData(this->Gridlines);
     102  this->GridlinesActor = vtkActor::New();
     103  this->GridlinesActor->SetMapper(this->GridlinesMapper);
     104  this->InnerGridlines = vtkPolyData::New();
     105  this->InnerGridlinesMapper = vtkPolyDataMapper::New();
     106  this->InnerGridlinesMapper->SetInputData(this->InnerGridlines);
     107  this->InnerGridlinesActor = vtkActor::New();
     108  this->InnerGridlinesActor->SetMapper(this->InnerGridlinesMapper);
     109  this->Gridpolys = vtkPolyData::New();
     110  this->GridpolysMapper = vtkPolyDataMapper::New();
     111  this->GridpolysMapper->SetInputData(this->Gridpolys);
     112  this->GridpolysActor = vtkActor::New();
     113  this->GridpolysActor->SetMapper(this->GridpolysMapper);
    115114
    116115  this->AxisVisibility = 1;
     
    120119
    121120  this->DrawGridlines = 0;
     121  this->DrawGridlinesOnly = 0;
    122122  this->GridlineXLength = 1.;
    123123  this->GridlineYLength = 1.;
    124124  this->GridlineZLength = 1.;
     125
     126  this->DrawInnerGridlines = 0;
     127
     128  this->DrawGridpolys = 0;
    125129
    126130  this->AxisType = VTK_AXIS_TYPE_X;
     
    138142  this->LastTickVisibility = -1;
    139143  this->LastDrawGridlines = -1;
     144  this->LastDrawInnerGridlines = -1;
     145  this->LastDrawGridpolys = -1;
    140146  this->LastMinorTicksVisible = -1;
    141147  this->LastRange[0] = -1.0;
     
    145151  this->MajorTickPts = vtkPoints::New();
    146152  this->GridlinePts  = vtkPoints::New();
     153  this->InnerGridlinePts  = vtkPoints::New();
     154  this->GridpolyPts  = vtkPoints::New();
    147155
    148156  this->AxisHasZeroLength = false;
    149157
    150158  this->MinorStart = 0.;
    151   this->MajorStart = 0.;
     159  //this->MajorStart = 0.;
     160  for(int i=0;i<3;i++)
     161    {
     162    this->MajorStart[i] = 0.;
     163    }
    152164  this->DeltaMinor = 1.;
    153   this->DeltaMajor = 1.;
     165  //this->DeltaMajor = 1.;
     166  for(int i=0;i<3;i++)
     167    {
     168    this->DeltaMajor[i] = 1.;
     169    }
     170
    154171  this->MinorRangeStart = 0.;
    155172  this->MajorRangeStart = 0.;
    156173  this->DeltaRangeMinor = 1.;
    157174  this->DeltaRangeMajor = 1.;
     175
     176  this->CalculateTitleOffset = 1;
     177  this->CalculateLabelOffset = 1;
     178
     179  // Instance variables specific to 2D mode
     180  this->Use2DMode = 0;
     181  this->SaveTitlePosition = 0;
     182  this->TitleConstantPosition[0] = this->TitleConstantPosition[1] = 0.;
     183  this->VerticalOffsetXTitle2D = -40.;
     184  this->HorizontalOffsetYTitle2D = -50.;
     185  this->LastMinDisplayCoordinate[0] = 0;
     186  this->LastMinDisplayCoordinate[1] = 0;
     187  this->LastMinDisplayCoordinate[2] = 0;
     188  this->LastMaxDisplayCoordinate[0] = 0;
     189  this->LastMaxDisplayCoordinate[1] = 0;
     190  this->LastMaxDisplayCoordinate[2] = 0;
     191
     192   // 0: All locations
     193  this->DrawGridlinesLocation = this->LastDrawGridlinesLocation = 0;
     194
     195  // reset the base
     196  for(int i=0;i<3;i++)
     197    {
     198    this->AxisBaseForX[i] = this->AxisBaseForY[i] = this->AxisBaseForZ[i] = 0.0;
     199    }
     200  this->AxisBaseForX[0] = this->AxisBaseForY[1] = this->AxisBaseForZ[2] = 1.0;
     201  this->AxisOnOrigin = 0;
    158202}
    159203
    160204// ****************************************************************
    161 // Modifications:
    162 //   Kathleen Bonnell, Wed Mar  6 13:48:48 PST 2002
    163 //   Added call to set camera to null.
    164 // ****************************************************************
    165 
    166205vtkRpAxisActor::~vtkRpAxisActor()
    167206{
     
    201240    this->TitleActor = NULL;
    202241    }
     242  if (this->TitleActor2D)
     243    {
     244    this->TitleActor2D->Delete();
     245    this->TitleActor2D = NULL;
     246    }
    203247
    204248  if (this->Title)
     
    206250    delete [] this->Title;
    207251    this->Title = NULL;
     252    }
     253
     254  if (this->TitleTextProperty)
     255    {
     256    this->TitleTextProperty->Delete();
     257    this->TitleTextProperty = NULL;
    208258    }
    209259
     
    215265      this->LabelMappers[i]->Delete();
    216266      this->LabelActors[i]->Delete();
     267      this->LabelActors2D[i]->Delete();
    217268      }
    218269    this->NumberOfLabelsBuilt = 0;
     
    220271    delete [] this->LabelMappers;
    221272    delete [] this->LabelActors;
     273    delete [] this->LabelActors2D;
    222274    this->LabelVectors = NULL;
    223275    this->LabelMappers = NULL;
    224276    this->LabelActors = NULL;
    225     }
    226 
    227   if (this->Axis)
    228     {
    229     this->Axis->Delete();
    230     this->Axis = NULL;
    231     }
    232   if (this->AxisMapper)
    233     {
    234     this->AxisMapper->Delete();
    235     this->AxisMapper = NULL;
    236     }
    237   if (this->AxisActor)
    238     {
    239     this->AxisActor->Delete();
    240     this->AxisActor = NULL;
     277    this->LabelActors2D = NULL;
     278    }
     279  if (this->LabelTextProperty)
     280    {
     281    this->LabelTextProperty->Delete();
     282    this->LabelTextProperty = NULL;
     283    }
     284
     285  if (this->AxisLines)
     286    {
     287    this->AxisLines->Delete();
     288    this->AxisLines = NULL;
     289    }
     290  if (this->AxisLinesMapper)
     291    {
     292    this->AxisLinesMapper->Delete();
     293    this->AxisLinesMapper = NULL;
     294    }
     295  if (this->AxisLinesActor)
     296    {
     297    this->AxisLinesActor->Delete();
     298    this->AxisLinesActor = NULL;
     299    }
     300
     301  if (this->Gridlines)
     302    {
     303    this->Gridlines->Delete();
     304    this->Gridlines = NULL;
     305    }
     306  if (this->GridlinesMapper)
     307    {
     308    this->GridlinesMapper->Delete();
     309    this->GridlinesMapper = NULL;
     310    }
     311  if (this->GridlinesActor)
     312    {
     313    this->GridlinesActor->Delete();
     314    this->GridlinesActor = NULL;
     315    }
     316
     317  if (this->InnerGridlines)
     318    {
     319    this->InnerGridlines->Delete();
     320    this->InnerGridlines = NULL;
     321    }
     322  if (this->InnerGridlinesMapper)
     323    {
     324    this->InnerGridlinesMapper->Delete();
     325    this->InnerGridlinesMapper = NULL;
     326    }
     327  if (this->InnerGridlinesActor)
     328    {
     329    this->InnerGridlinesActor->Delete();
     330    this->InnerGridlinesActor = NULL;
     331    }
     332
     333  if (this->Gridpolys)
     334    {
     335    this->Gridpolys->Delete();
     336    this->Gridpolys = NULL;
     337    }
     338  if (this->GridpolysMapper)
     339    {
     340    this->GridpolysMapper->Delete();
     341    this->GridpolysMapper = NULL;
     342    }
     343  if (this->GridpolysActor)
     344    {
     345    this->GridpolysActor->Delete();
     346    this->GridpolysActor = NULL;
    241347    }
    242348
     
    256362    this->GridlinePts = NULL;
    257363    }
    258 }
    259 
    260 // Release any graphics resources that are being consumed by this actor.
    261 // The parameter window could be used to determine which graphic
    262 // resources to release.
     364  if (this->InnerGridlinePts)
     365    {
     366    this->InnerGridlinePts->Delete();
     367    this->InnerGridlinePts = NULL;
     368    }
     369  if (this->GridpolyPts)
     370    {
     371    this->GridpolyPts->Delete();
     372    this->GridpolyPts = NULL;
     373    }
     374}
     375
     376// ****************************************************************
    263377void vtkRpAxisActor::ReleaseGraphicsResources(vtkWindow *win)
    264378{
    265379  this->TitleActor->ReleaseGraphicsResources(win);
     380  this->TitleActor2D->ReleaseGraphicsResources(win);
    266381  for (int i=0; i < this->NumberOfLabelsBuilt; i++)
    267382    {
    268383    this->LabelActors[i]->ReleaseGraphicsResources(win);
    269     }
    270   this->AxisActor->ReleaseGraphicsResources(win);
     384    this->LabelActors2D[i]->ReleaseGraphicsResources(win);
     385    }
     386  this->AxisLinesActor->ReleaseGraphicsResources(win);
     387  this->GridlinesActor->ReleaseGraphicsResources(win);
     388  this->InnerGridlinesActor->ReleaseGraphicsResources(win);
     389  this->GridpolysActor->ReleaseGraphicsResources(win);
    271390}
    272391
    273392// ****************************************************************
    274 //
    275 // Modifications:
    276 //   Kathleen Bonnell, Wed Oct 31 07:57:49 PST 2001
    277 //   Copy over mustAdjustValue and valueScaleFactor.
    278 //
    279 //   Kathleen Bonnell, Wed Mar  6 13:48:48 PST 2002
    280 //   Call superclass's method in new VTK 4.0 way.
    281 //
    282 //   Kathleen Bonnell, Fri Jul 25 14:37:32 PDT 2003
    283 //   Removed mustAdjustValue, valueScaleFator.
    284 //
    285 // ****************************************************************
    286 
    287 void vtkRpAxisActor::ShallowCopy(vtkProp *prop)
    288 {
    289   vtkRpAxisActor *a = vtkRpAxisActor::SafeDownCast(prop);
    290   if (a != NULL)
    291     {
    292     this->SetPoint1(a->GetPoint1());
    293     this->SetPoint2(a->GetPoint2());
    294     this->SetCamera(a->GetCamera());
    295     this->SetRange(a->GetRange());
    296     this->SetLabelFormat(a->GetLabelFormat());
    297     this->SetTitle(a->GetTitle());
    298     this->SetAxisVisibility(a->GetAxisVisibility());
    299     this->SetTickVisibility(a->GetTickVisibility());
    300     this->SetLabelVisibility(a->GetLabelVisibility());
    301     this->SetTitleVisibility(a->GetTitleVisibility());
    302     }
    303 
    304   // Now do superclass
    305   this->Superclass::ShallowCopy(prop);
    306 }
    307 
    308 // ****************************************************************
    309 // Build the axis, ticks, title, and labels and render.
    310 //
    311 // Modifications:
    312 //   Kathleen Bonnell, Thu May 16 10:13:56 PDT 2002
    313 //   Don't render a zero-length axis.
    314 //
    315 //   Kathleen Bonnell, Fri Jul 25 14:37:32 PDT 2003
    316 //   Added bool argument to BuildAxis.
    317 //
    318 // ****************************************************************
    319 
    320393int vtkRpAxisActor::RenderOpaqueGeometry(vtkViewport *viewport)
    321394{
     
    328401  if (!this->AxisHasZeroLength)
    329402    {
     403    if(this->DrawGridlinesOnly && this->DrawGridlines)
     404      {
     405      // Exit !!!!
     406      return this->GridlinesActor->RenderOpaqueGeometry(viewport);
     407      }
    330408    if (this->Title != NULL && this->Title[0] != 0 && this->TitleVisibility)
    331409      {
    332       renderedSomething += this->TitleActor->RenderOpaqueGeometry(viewport);
    333       }
    334 
     410      if (this->Use2DMode == 0)
     411        {
     412        renderedSomething += this->TitleActor->RenderOpaqueGeometry(viewport);
     413        }
     414      else
     415        {
     416        renderedSomething += this->TitleActor2D->RenderOpaqueGeometry(viewport);
     417        }
     418      }
    335419    if (this->AxisVisibility || this->TickVisibility)
    336420      {
    337       renderedSomething += this->AxisActor->RenderOpaqueGeometry(viewport);
    338       }
    339 
     421      renderedSomething += this->AxisLinesActor->RenderOpaqueGeometry(viewport);
     422      }
     423    if(this->DrawGridlines)
     424      {
     425      renderedSomething += this->GridlinesActor->RenderOpaqueGeometry(viewport);
     426      }
     427    if(this->DrawInnerGridlines)
     428      {
     429      renderedSomething += this->InnerGridlinesActor->RenderOpaqueGeometry(viewport);
     430      }
    340431    if (this->LabelVisibility)
    341432      {
    342433      for (i=0; i<this->NumberOfLabelsBuilt; i++)
    343434        {
    344         renderedSomething +=
    345           this->LabelActors[i]->RenderOpaqueGeometry(viewport);
     435        if (this->Use2DMode == 0)
     436          {
     437          renderedSomething +=
     438            this->LabelActors[i]->RenderOpaqueGeometry(viewport);
     439          }
     440        else
     441          {
     442          renderedSomething +=
     443            this->LabelActors2D[i]->RenderOpaqueGeometry(viewport);
     444          }
    346445        }
    347446      }
     
    349448
    350449  return renderedSomething;
     450}
     451
     452// ****************************************************************
     453// Build the translucent poly actors and render.
     454// ****************************************************************
     455int vtkRpAxisActor::RenderTranslucentGeometry(vtkViewport *viewport)
     456{
     457  return this->RenderTranslucentPolygonalGeometry(viewport);
     458}
     459
     460// ****************************************************************
     461// Build the translucent poly actors and render.
     462// ****************************************************************
     463int vtkRpAxisActor::RenderTranslucentPolygonalGeometry(vtkViewport *viewport)
     464{
     465
     466  int renderedSomething=0;
     467
     468  this->BuildAxis(viewport, false);
     469
     470  // Everything is built, just have to render
     471
     472  if (!this->AxisHasZeroLength && !this->DrawGridlinesOnly)
     473    {
     474    if(this->DrawGridpolys)
     475      {
     476      renderedSomething += this->GridpolysActor->RenderTranslucentPolygonalGeometry(viewport);
     477      }
     478    }
     479
     480  return renderedSomething;
     481}
     482
     483// ****************************************************************
     484// Render the 2d annotations.
     485// ****************************************************************
     486int vtkRpAxisActor::RenderOverlay(vtkViewport *viewport)
     487{
     488  int i, renderedSomething=0;
     489
     490  // Everything is built, just have to render
     491  if (!this->AxisHasZeroLength && !this->DrawGridlinesOnly)
     492    {
     493    if( this->Use2DMode == 1 )
     494      {
     495      renderedSomething += this->TitleActor2D->RenderOverlay(viewport);
     496      }
     497    if (this->LabelVisibility)
     498      {
     499      for (i=0; i<this->NumberOfLabelsBuilt; i++)
     500        {
     501        if (this->Use2DMode == 1)
     502          {
     503          renderedSomething += this->LabelActors2D[i]->RenderOverlay(viewport);
     504          }
     505        }
     506      }
     507    }
     508
     509  return renderedSomething;
     510}
     511
     512// **************************************************************************
     513int vtkRpAxisActor::HasTranslucentPolygonalGeometry()
     514{
     515  if (this->Visibility && !this->AxisHasZeroLength)
     516    {
     517
     518    if (this->TitleVisibility)
     519      {
     520      if (this->Use2DMode)
     521        {
     522        if (this->TitleActor2D->HasTranslucentPolygonalGeometry())
     523          {
     524          return 1;
     525          }
     526        }
     527      else
     528        {
     529        if (this->TitleActor->HasTranslucentPolygonalGeometry())
     530          {
     531          return 1;
     532          }
     533        }
     534      }
     535
     536    if (this->LabelVisibility)
     537      {
     538      if (this->Use2DMode)
     539        {
     540        for (int i = 0; i < this->NumberOfLabelsBuilt; ++i)
     541          {
     542          if (this->LabelActors2D[i]->HasTranslucentPolygonalGeometry())
     543            {
     544            return 1;
     545            } // end if
     546          } // end for
     547        } // end 2D
     548      else
     549        {
     550        for (int i = 0; i < this->NumberOfLabelsBuilt; ++i)
     551          {
     552          if (this->LabelActors[i]->HasTranslucentPolygonalGeometry())
     553            {
     554            return 1;
     555            } // end if
     556          } // end for
     557        } // end 3D
     558      } // end label vis
     559
     560    if (this->AxisLinesActor->HasTranslucentPolygonalGeometry())
     561      {
     562      return 1;
     563      }
     564
     565    if (this->DrawGridlines &&
     566        this->GridlinesActor->HasTranslucentPolygonalGeometry())
     567      {
     568      return 1;
     569      }
     570
     571    if (this->DrawInnerGridlines &&
     572        this->InnerGridlinesActor->HasTranslucentPolygonalGeometry())
     573      {
     574      return 1;
     575      }
     576
     577    if (this->DrawGridpolys &&
     578        this-GridpolysActor->HasTranslucentPolygonalGeometry())
     579      {
     580      return 1;
     581      }
     582
     583    return this->Superclass::HasTranslucentPolygonalGeometry();
     584
     585    } // end this vis
     586
     587  return 0;
    351588}
    352589
    353590// **************************************************************************
    354591// Perform some initialization, determine which Axis type we are
    355 // and call the appropriate build method.
    356 //
    357 // Modifications:
    358 //   Kathleen Bonnell, Wed Nov  7 17:45:20 PST 2001
    359 //   Added logic to only rebuild sub-parts if necessary.
    360 //
    361 //   Kathleen Bonnell, Fri Nov 30 17:02:41 PST 2001
    362 //   Moved setting values for LastRange to end of method, so they
    363 //   can be used in comparisons elsewhere.
    364 //
    365 //   Kathleen Bonnell, Mon Dec  3 16:49:01 PST 2001
    366 //   Compare vtkTimeStamps correctly.
    367 //
    368 //   Kathleen Bonnell, Thu May 16 10:13:56 PDT 2002
    369 //   Test for zero length axis.
    370 //
    371 //   Kathleen Bonnell,  Fri Jul 25 14:37:32 PDT 2003
    372 //   Added bool argument that will allow all axis components to be built
    373 //   if set to true.  Removed call to AdjustTicksComputeRange (handled by
    374 //   vtkCubeAxesActor.  Remvoed call to Build?TypeAxis, added calls
    375 //   to BuildLabels, SetAxisPointsAndLines and BuildTitle, (which used to
    376 //   be handled in Build?TypeAxis). .
    377 //
    378592// **************************************************************************
    379 
    380593void vtkRpAxisActor::BuildAxis(vtkViewport *viewport, bool force)
    381594{
     
    409622  if (force || this->GetProperty()->GetMTime() > this->BuildTime.GetMTime())
    410623    {
    411     this->AxisActor->SetProperty(this->GetProperty());
     624      //this->AxisLinesActor->SetProperty(this->GetProperty());
    412625    this->TitleActor->SetProperty(this->GetProperty());
     626    this->TitleActor->GetProperty()->SetColor(this->TitleTextProperty->GetColor());
    413627    }
    414628
     
    417631  //
    418632  bool ticksRebuilt;
    419   if (this->AxisType == VTK_AXIS_TYPE_X)
    420     {
    421     ticksRebuilt = this->BuildTickPointsForXType(p1, p2, force);
    422     }
    423   else if (this->AxisType == VTK_AXIS_TYPE_Y)
    424     {
    425     ticksRebuilt = this->BuildTickPointsForYType(p1, p2, force);
    426     }
    427   else
    428     {
    429     ticksRebuilt = this->BuildTickPointsForZType(p1, p2, force);
    430     }
     633  ticksRebuilt = this->BuildTickPoints(p1, p2, force);
    431634
    432635  bool tickVisChanged = this->TickVisibilityChanged();
    433636
    434   if (force || ticksRebuilt || tickVisChanged)
    435    {
    436    this->SetAxisPointsAndLines();
    437    }
    438 
    439   this->BuildLabels(viewport, force);
     637  if (force || ticksRebuilt || tickVisChanged || this->LastDrawGridlinesLocation != this->DrawGridlinesLocation)
     638    {
     639    this->LastDrawGridlinesLocation = this->DrawGridlinesLocation;
     640    this->SetAxisPointsAndLines();
     641    }
     642
     643  // If the ticks have been rebuilt it is more than likely
     644  // that the labels should follow...
     645  this->BuildLabels(viewport, force || ticksRebuilt);
     646  if (this->Use2DMode == 1)
     647    {
     648    this->BuildLabels2D(viewport, force || ticksRebuilt);
     649    }
    440650
    441651  if (this->Title != NULL && this->Title[0] != 0)
    442652    {
    443     this->BuildTitle(force);
     653    this->BuildTitle(force || ticksRebuilt);
     654    if( this->Use2DMode == 1 )
     655      {
     656      this->BuildTitle2D(viewport, force || ticksRebuilt);
     657      }
    444658    }
    445659
    446660  this->LastAxisPosition = this->AxisPosition;
    447   this->LastTickLocation = this->TickLocation;
    448661
    449662  this->LastRange[0] = this->Range[0];
     
    453666
    454667// ****************************************************************
    455 //
    456668//  Set label values and properties.
    457 //
    458 // Modifications:
    459 //   Kathleen Bonnell, Wed Oct 31 07:57:49 PST 2001
    460 //   Use valueScaleFactor to scale value if necessary.
    461 //
    462 //   Kathleen Bonnell, Wed Nov  7 17:45:20 PST 2001
    463 //   Added code for early termination.  Added call to SetNumberOfLabels
    464 //   for dynamic memory allocation. Number of labels limited to 200.
    465 //
    466 //   Kathleen Bonnell, Fri Nov 30 17:02:41 PST 2001
    467 //   Added test for modified range to determine if labels really need to
    468 //   be built.
    469 //
    470 //   Kathleen Bonnell, Thu May 16 10:13:56 PDT 2002
    471 //   Use defined constant to limit number of labels.
    472 //
    473 //   Kathleen Bonnell, Fri Jul 25 14:37:32 PDT 2003
    474 //   Remvoed determination of label text, added call to
    475 //   SetLabelPositions.
    476 //
    477669// ****************************************************************
    478 
    479670void
    480671vtkRpAxisActor::BuildLabels(vtkViewport *viewport, bool force)
     
    489680    this->LabelActors[i]->SetCamera(this->Camera);
    490681    this->LabelActors[i]->SetProperty(this->GetProperty());
     682    this->LabelActors[i]->GetProperty()->SetColor(this->LabelTextProperty->GetColor());
     683    this->LabelActors[i]->SetOrientation(0., 0., this->LabelTextProperty->GetOrientation());
     684
     685    if(!this->GetCalculateLabelOffset())
     686      {
     687      this->LabelActors[i]->SetAutoCenter(1);
     688      }
    491689    }
    492690
     
    505703// *******************************************************************
    506704// Determine and set scale factor and position for labels.
    507 //
    508 // Modifications:
    509 //   Kathleen Bonnell, Fri Nov 30 17:02:41 PST 2001
    510 //   Reset labels scale to 1. before testing length, in order to
    511 //   ensure proper scaling.  Use Bounds[1] and Bounds[0] for bWidth
    512 //   instead of Bounds[5] and Bounds[4].
    513 //
    514 //   Kathleen Bonnell, Tue Dec  4 09:55:03 PST 2001
    515 //   Ensure that scale does not go below MinScale.
    516 //
    517 //   Kathleen Bonnell, Tue Apr  9 14:41:08 PDT 2002
    518 //   Removed MinScale as it allowed axes with very small ranges
    519 //   to have labels scaled too large for the dataset.
    520 //
    521 //   Kathleen Bonnell, Fri Jul 18 09:09:31 PDT 2003
    522 //   Renamed to SetLabelPosition.  Removed calculation of label
    523 //   scale factor, added check for no labels to early return test.
    524 //
    525 //   Eric Brugger, Tue Jul 29 14:42:44 PDT 2003
    526 //   Corrected the test that causes the routine to exit early when
    527 //   no work needs to be done.
    528 //
    529 //   David Gobbi, Fri Apr 8 16:50:00 MST 2011
    530 //   Use mapper bounds, not actor bounds.
    531 //
    532705// *******************************************************************
    533 
    534706void vtkRpAxisActor::SetLabelPositions(vtkViewport *viewport, bool force)
    535707{
     
    580752    this->LabelActors[i]->GetScale(scale);
    581753
    582     double halfWidth  = (bounds[1] - bounds[0]) * 0.5 * scale[0];
    583     double halfHeight = (bounds[3] - bounds[2]) * 0.5 * scale[1];
    584 
    585     center[0] = tick[0] + xmult * (halfWidth  + this->MinorTickSize);
    586     center[1] = tick[1] + ymult * (halfHeight + this->MinorTickSize);
    587     pos[0] = (center[0] - xadjust *halfWidth);
    588     pos[1] = (center[1] - yadjust *halfHeight);
    589     pos[2] = tick[2];
     754    if(this->CalculateLabelOffset)
     755      {
     756      double halfWidth  = (bounds[1] - bounds[0]) * 0.5 * scale[0];
     757      double halfHeight = (bounds[3] - bounds[2]) * 0.5 * scale[1];
     758
     759      center[0] = tick[0] + xmult * (halfWidth  + this->MinorTickSize);
     760      center[1] = tick[1] + ymult * (halfHeight + this->MinorTickSize);
     761      center[2] = tick[2];
     762
     763      pos[0] = (center[0] - xadjust *halfWidth);
     764      pos[1] = (center[1] - yadjust *halfHeight);
     765      pos[2] =  center[2];
     766      }
     767    else
     768      {
     769      center[0] = tick[0] ;
     770      center[1] = tick[1];
     771      center[2] = tick[2];
     772
     773      pos[0] = center[0];
     774      pos[1] = center[1];
     775      pos[2] = center[2];
     776      }
     777
    590778    this->LabelActors[i]->SetPosition(pos[0], pos[1], pos[2]);
    591779    }
    592780}
     781
     782// *******************************************************************
     783//  Set 2D label values and properties.
     784// *******************************************************************
     785void
     786vtkRpAxisActor::BuildLabels2D(vtkViewport *viewport, bool force)
     787{
     788  if (!force && (!this->LabelVisibility || this->NumberOfLabelsBuilt == 0))
     789    return;
     790
     791  for (int i = 0; i < this->NumberOfLabelsBuilt; i++)
     792    {
     793    this->LabelActors2D[i]->GetProperty()->SetColor(this->LabelTextProperty->GetColor());
     794    this->LabelActors2D[i]->GetProperty()->SetOpacity(1);
     795    this->LabelActors2D[i]->GetTextProperty()->SetFontSize(this->LabelTextProperty->GetFontSize());
     796    this->LabelActors2D[i]->GetTextProperty()->SetVerticalJustificationToBottom();
     797    this->LabelActors2D[i]->GetTextProperty()->SetJustificationToLeft();
     798    }
     799
     800  this->NeedBuild2D = this->BoundsDisplayCoordinateChanged(viewport);
     801  if (force || this->NeedBuild2D)
     802    {
     803    this->SetLabelPositions2D(viewport, force);
     804    }
     805}
     806
     807
     808// *******************************************************************
     809// Determine and set scale factor and position for 2D labels.
     810// *******************************************************************
     811void
     812vtkRpAxisActor::SetLabelPositions2D(vtkViewport *viewport, bool force)
     813{
     814  if (!force && (!this->LabelVisibility || this->NumberOfLabelsBuilt == 0) )
     815    return;
     816
     817  int xmult = 0;
     818  int ymult = 0;
     819  double xcoeff = 0.;
     820  double ycoeff = 0.;
     821
     822  // we are in 2D mode, so no Z axis
     823  switch (this->AxisType)
     824    {
     825    case VTK_AXIS_TYPE_X :
     826      xmult = 0;
     827      ymult = vtkRpAxisActorMultiplierTable1[this->AxisPosition];
     828      xcoeff = 0.5;
     829      ycoeff = 1.0;
     830      break;
     831    case VTK_AXIS_TYPE_Y :
     832      xmult = vtkRpAxisActorMultiplierTable1[this->AxisPosition];
     833      ymult = 0;
     834      xcoeff = 1.0;
     835      ycoeff = 0.5;
     836      break;
     837    }
     838
     839
     840  int ptIdx;
     841  //
     842  // xadjust & yadjust are used for positioning the label correctly
     843  // depending upon the 'orientation' of the axis as determined
     844  // by its position in view space (via transformed bounds).
     845  //
     846  double displayBounds[6] = { 0., 0., 0., 0., 0., 0.};
     847  this->TransformBounds(viewport, displayBounds);
     848  double xadjust = (displayBounds[0] > displayBounds[1] ? -1 : 1);
     849  double yadjust = (displayBounds[2] > displayBounds[3] ? -1 : 1);
     850  double transpos[3] = {0., 0., 0.};
     851  double center[3], tick[3], pos[2];
     852
     853  vtkTextRenderer *tren = vtkTextRenderer::GetInstance();
     854  if (!tren)
     855    {
     856    vtkErrorMacro(<< "Unable to obtain the vtkTextRenderer instance!");
     857    return;
     858    }
     859
     860  for (int i = 0; i < this->NumberOfLabelsBuilt; i++)
     861    {
     862    ptIdx = 4*i + 1;
     863
     864    this->MajorTickPts->GetPoint(ptIdx, tick);
     865
     866    center[0] = tick[0] + xmult * this->MinorTickSize;
     867    center[1] = tick[1] + ymult * this->MinorTickSize;
     868    center[2] = tick[2];
     869
     870    viewport->SetWorldPoint(center[0], center[1], center[2], 1.0);
     871    viewport->WorldToDisplay();
     872    viewport->GetDisplayPoint(transpos);
     873
     874    int bbox[4];
     875    if (!tren->GetBoundingBox(this->LabelActors2D[i]->GetTextProperty(),
     876                              this->LabelActors2D[i]->GetInput(), bbox))
     877      {
     878      vtkErrorMacro(<< "Unable to calculate bounding box for label "
     879                    << this->LabelActors2D[i]->GetInput());
     880      continue;
     881      }
     882
     883    double width  = (bbox[1]-bbox[0]);
     884    double height = (bbox[3]-bbox[2]);
     885
     886    pos[0] = (transpos[0] - xadjust*width*xcoeff);
     887    pos[1] = (transpos[1] - yadjust*height*ycoeff);
     888    this->LabelActors2D[i]->SetPosition( pos[0], pos[1] );
     889    }
     890}
     891
    593892
    594893// **********************************************************************
    595894//  Determines scale and position for the Title.  Currently,
    596895//  title can only be centered with respect to its axis.
    597 //
    598 //  Modifications:
    599 //    Kathleen Bonnell, Wed Nov  7 17:45:20 PST 2001
    600 //    Added logic for early-termination.
    601 //
    602 //    Kathleen Bonnell, Mon Dec  3 16:49:01 PST 2001
    603 //    Test for modified bounds before early termination, use
    604 //    MinScale, modified target so title size is a bit more reasonable.
    605 //
    606 //    Kathleen Bonnell, Tue Apr  9 14:41:08 PDT 2002
    607 //    Removed MinScale as it allowed axes with very small ranges
    608 //    to have labels scaled too large for the dataset.
    609 //
    610 //    Kathleen Bonnell, Fri Jul 25 14:37:32 PDT 2003
    611 //    Added bool argument that allow the build to be forced, even if
    612 //    the title won't be visible.
    613 //
    614 //    Kathleen Bonnell, Tue Aug 31 16:17:43 PDT 2004
    615 //    Added TitleTime test so that the title can be rebuilt when its
    616 //    text has changed.
    617 //
    618 //    Hank Childs, Sun May 13 11:06:12 PDT 2007
    619 //    Fix bug with positioning of titles (the titles were being placed
    620 //    far away from the bounding box in some cases).
    621 //
    622 //    David Gobbi, Fri Apr 8 16:50:00 MST 2011
    623 //    Use mapper bounds, not actor bounds.
    624 //
    625896// **********************************************************************
    626 
    627897void vtkRpAxisActor::BuildTitle(bool force)
    628898{
     899  this->NeedBuild2D = false;
    629900  if (!force && !this->TitleVisibility)
    630901    {
     
    648919    }
    649920
     921  this->NeedBuild2D = true;
    650922  switch (this->AxisType)
    651923    {
     
    676948    maxHeight = (labHeight > maxHeight ? labHeight : maxHeight);
    677949    }
     950
    678951  this->TitleVector->SetText(this->Title);
     952
     953  this->TitleActor->GetProperty()->SetColor(this->TitleTextProperty->GetColor());
    679954  this->TitleActor->SetCamera(this->Camera);
    680955  this->TitleActor->SetPosition(p2[0], p2[1], p2[2]);
    681956  this->TitleActor->GetMapper()->GetBounds(titleBounds);
    682957  this->TitleActor->GetScale(scale);
    683   halfTitleWidth  = (titleBounds[1] - titleBounds[0]) * 0.5 * scale[0];
    684   halfTitleHeight = (titleBounds[3] - titleBounds[2]) * 0.5 * scale[1];
     958  if(!this->GetCalculateTitleOffset())
     959    {
     960    this->TitleActor->SetAutoCenter(1);
     961    }
    685962
    686963  center[0] = p1[0] + (p2[0] - p1[0]) / 2.0;
     
    688965  center[2] = p1[2] + (p2[2] - p1[2]) / 2.0;
    689966
    690   center[0] += xmult * (halfTitleWidth + maxWidth);
    691   center[1] += ymult * (halfTitleHeight + 2*maxHeight);
    692 
    693   pos[0] = center[0] - xmult*halfTitleWidth;
    694   pos[1] = center[1] - ymult*halfTitleHeight;
     967  if(this->CalculateTitleOffset)
     968    {
     969    halfTitleWidth  = (titleBounds[1] - titleBounds[0]) * 0.5 * scale[0];
     970    halfTitleHeight = (titleBounds[3] - titleBounds[2]) * 0.5 * scale[1];
     971    center[0] += xmult * (halfTitleWidth + maxWidth);
     972    center[1] += ymult * (halfTitleHeight + 2*maxHeight);
     973    }
     974
     975  pos[0] = center[0];
     976  pos[1] = center[1];
    695977  pos[2] = center[2];
     978
    696979  this->TitleActor->SetPosition(pos[0], pos[1], pos[2]);
     980}
     981
     982// **********************************************************************
     983//  Determines scale and position for the 2D Title.  Currently,
     984//  title can only be centered with respect to its axis.
     985// **********************************************************************
     986void
     987vtkRpAxisActor::BuildTitle2D(vtkViewport *viewport, bool force)
     988{
     989  if (!this->NeedBuild2D && !force && !this->TitleVisibility)
     990    {
     991    return;
     992    }
     993
     994  // for textactor instead of follower
     995  this->TitleActor2D->SetInput( this->TitleVector->GetText() );
     996  this->TitleActor2D->GetProperty()->SetColor( this->TitleTextProperty->GetColor() );
     997  this->TitleActor2D->GetProperty()->SetOpacity(1);
     998  this->TitleActor2D->GetTextProperty()->SetFontSize( this->TitleTextProperty->GetFontSize() );
     999  this->TitleActor2D->GetTextProperty()->SetVerticalJustificationToCentered();
     1000  this->TitleActor2D->GetTextProperty()->SetJustificationToCentered();
     1001
     1002  if (this->AxisType == VTK_AXIS_TYPE_Y)
     1003    {
     1004    if (strlen(this->TitleActor2D->GetInput()) > 2)
     1005      {
     1006      // warning : orientation have to be set on vtkTextActor and not on the vtkTextActor's vtkTextProperty
     1007      // otherwise there is a strange effect (first letter is not align with the others)
     1008      this->TitleActor2D->SetOrientation(90);
     1009      }
     1010    else
     1011      {
     1012      // if in the previous rendering, the orientation was set.
     1013      this->TitleActor2D->SetOrientation(0);
     1014      }
     1015    }
     1016
     1017  // stuff for 2D axis with TextActor
     1018  double transpos[3];
     1019  double* pos = this->TitleActor->GetPosition();
     1020  viewport->SetWorldPoint(pos[0], pos[1],  pos[2], 1.0);
     1021  viewport->WorldToDisplay();
     1022  viewport->GetDisplayPoint(transpos);
     1023  if (this->AxisType == VTK_AXIS_TYPE_X)
     1024    {
     1025    transpos[1] += this->VerticalOffsetXTitle2D;
     1026    }
     1027  else if (this->AxisType == VTK_AXIS_TYPE_Y)
     1028    {
     1029    transpos[0] += this->HorizontalOffsetYTitle2D;
     1030    }
     1031  if (transpos[1] < 10.) transpos[1] = 10.;
     1032  if (transpos[0] < 10.) transpos[0] = 10.;
     1033  if (this->SaveTitlePosition == 0)
     1034    {
     1035    this->TitleActor2D->SetPosition(transpos[0], transpos[1]);
     1036    }
     1037  else
     1038    {
     1039    if (this->SaveTitlePosition == 1)
     1040      {
     1041      TitleConstantPosition[0] = transpos[0];
     1042      TitleConstantPosition[1] = transpos[1];
     1043      this->SaveTitlePosition = 2;
     1044      }
     1045    this->TitleActor2D->SetPosition(TitleConstantPosition[0], TitleConstantPosition[1]);
     1046    }
    6971047}
    6981048
     
    7431093
    7441094// ****************************************************************
    745 // Modifications:
    746 //   Kathleen Bonnell, Wed Mar  6 13:48:48 PST 2002
    747 //   Call superclass's method in new VTK 4.0 way.
    748 // ****************************************************************
    749 
    7501095void vtkRpAxisActor::PrintSelf(ostream& os, vtkIndent indent)
    7511096{
     
    7551100  os << indent << "Number Of Labels Built: "
    7561101     << this->NumberOfLabelsBuilt << "\n";
    757   os << indent << "Range: (" << this->Range[0]
    758      << ", " << this->Range[1] << ")\n";
     1102  os << indent << "Range: ("
     1103     << this->Range[0] << ", "
     1104     << this->Range[1] << ")\n";
    7591105
    7601106  os << indent << "Label Format: " << this->LabelFormat << "\n";
     
    7951141    }
    7961142
    797   os << indent << "DeltaMajor: " << this->DeltaMajor << endl;
     1143  os << indent << "DeltaMajor: "
     1144     << this->DeltaMajor[0] << ","
     1145     << this->DeltaMajor[1] << ","
     1146     << this->DeltaMajor[2] << endl;
    7981147  os << indent << "DeltaMinor: " << this->DeltaMinor << endl;
    7991148  os << indent << "DeltaRangeMajor: " << this->DeltaRangeMajor << endl;
     
    8041153  os << indent << "MinorTicksVisible: " << this->MinorTicksVisible << endl;
    8051154
     1155  os << indent << "TitleActor: ";
     1156  if(this->TitleActor)
     1157    {
     1158    os << indent << "TitleActor: (" << this->TitleActor << ")\n";
     1159    }
     1160  else
     1161    {
     1162    os << "(none)" << endl;
     1163    }
     1164
    8061165  os << indent << "Camera: ";
    8071166  if (this->Camera)
     
    8191178  os << indent << "DrawGridlines: " << this->DrawGridlines << endl;
    8201179
    821   os << indent << "MajorStart: " << this->MajorStart << endl;
    822   os << indent << "MinorStart: " << this->MinorStart << endl;
     1180  os << indent << "MajorStart: "
     1181     << this->MajorStart[0] << ","
     1182     << this->MajorStart[1] << ","
     1183     << this->MajorStart[2] << endl;
    8231184
    8241185  os << indent << "AxisPosition: " << this->AxisPosition << endl;
     
    8281189  os << indent << "GridlineZLength: " << this->GridlineZLength << endl;
    8291190
     1191  os << indent << "DrawInnerGridpolys: " << this->DrawGridpolys << endl;
     1192  os << indent << "DrawInnerGridlines: " << this->DrawInnerGridlines << endl;
     1193
    8301194  os << indent << "TickLocation: " << this->TickLocation << endl;
    831 }
     1195
     1196  os << indent << "CalculateLabelOffset: " << this->CalculateLabelOffset << std::endl;
     1197  os << indent << "CalculateTitleOffset: " << this->CalculateTitleOffset << std::endl;
     1198
     1199  os << indent << "LabelTextProperty: " << this->LabelTextProperty << endl;
     1200  os << indent << "TitleTextProperty: " << this->TitleTextProperty << endl;
     1201
     1202  os << indent << "Use2DMode: " << this->Use2DMode << endl;
     1203  os << indent << "SaveTitlePosition: " << this->SaveTitlePosition << endl;
     1204  os << indent << "VerticalOffsetXTitle2D" << this->VerticalOffsetXTitle2D << endl;
     1205  os << indent << "HorizontalOffsetYTitle2D" << this->HorizontalOffsetYTitle2D << endl;
     1206  os << indent << "LastMinDisplayCoordinates: ("
     1207     << this->LastMinDisplayCoordinate[0] << ", "
     1208     << this->LastMinDisplayCoordinate[1] << ", "
     1209     << this->LastMinDisplayCoordinate[2] << ")" << endl;
     1210  os << indent << "LastMaxDisplayCoordinates: ("
     1211     << this->LastMaxDisplayCoordinate[0] << ", "
     1212     << this->LastMaxDisplayCoordinate[1] << ", "
     1213     << this->LastMaxDisplayCoordinate[2] << ")" << endl;
     1214  }
    8321215
    8331216// **************************************************************************
    8341217// Sets text string for label vectors.  Allocates memory if necessary.
    835 //
    836 // Programmer:  Kathleen Bonnell
    837 // Creation:    July 18, 2003
    8381218// **************************************************************************
    8391219void vtkRpAxisActor::SetLabels(vtkStringArray *labels)
     
    8531233        this->LabelMappers[i]->Delete();
    8541234        this->LabelActors[i]->Delete();
     1235        this->LabelActors2D[i]->Delete();
    8551236        }
    8561237      delete [] this->LabelVectors;
    8571238      delete [] this->LabelMappers;
    8581239      delete [] this->LabelActors;
     1240      delete [] this->LabelActors2D;
    8591241      }
    8601242
    8611243    this->LabelVectors = new vtkVectorText * [numLabels];
    8621244    this->LabelMappers = new vtkPolyDataMapper * [numLabels];
    863     this->LabelActors = new vtkFollower * [numLabels];
     1245    this->LabelActors  = new vtkRpAxisFollower * [numLabels];
     1246    this->LabelActors2D = new vtkTextActor * [numLabels];
    8641247
    8651248    for (i = 0; i < numLabels; i++)
     
    8671250      this->LabelVectors[i] = vtkVectorText::New();
    8681251      this->LabelMappers[i] = vtkPolyDataMapper::New();
    869 #ifdef USE_VTK6
    870       this->LabelMappers[i]->SetInputData(this->LabelVectors[i]->GetOutput());
    871 #else
    872       this->LabelMappers[i]->SetInput(this->LabelVectors[i]->GetOutput());
    873 #endif
    874       this->LabelActors[i] = vtkFollower::New();
     1252      this->LabelMappers[i]->SetInputConnection(
     1253        this->LabelVectors[i]->GetOutputPort());
     1254      this->LabelActors[i] = vtkRpAxisFollower::New();
    8751255      this->LabelActors[i]->SetMapper(this->LabelMappers[i]);
     1256      this->LabelActors[i]->SetEnableDistanceLOD(0);
     1257      this->LabelActors[i]->GetProperty()->SetAmbient(1.);
     1258      this->LabelActors[i]->GetProperty()->SetDiffuse(0.);
     1259      this->LabelActors[i]->GetProperty()->SetColor(this->LabelTextProperty->GetColor());
     1260      this->LabelActors2D[i] = vtkTextActor::New();
    8761261      }
    8771262    }
     
    8831268    {
    8841269    this->LabelVectors[i]->SetText(labels->GetValue(i).c_str());
     1270    this->LabelActors2D[i]->SetInput(this->LabelVectors[i]->GetText());
    8851271    }
    8861272  this->NumberOfLabelsBuilt = numLabels;
     
    8891275
    8901276// **************************************************************************
    891 // Creates points for ticks (minor, major, gridlines) in correct position
    892 // for X-type axsis.
    893 //
    894 // Programmer:  Kathleen Bonnell
    895 // Creation:    November 7, 2001
    896 //
    897 // Modifications:
    898 //   Kathleen Bonnell, Mon Dec  3 16:49:01 PST 2001
    899 //   Compare vtkTimeStamps correctly.
    900 //
    901 //   Kathleen Bonnell, Thu May 16 10:13:56 PDT 2002
    902 //   Use defined constant VTK_MAX_TICKS to prevent infinite loops.
    903 //
    904 //   Kathleen Bonnell, Fri Jul 25 14:37:32 PDT 2003
    905 //   Allow a forced build, despite previous build time.
    906 //
    907 // **************************************************************************
    908 bool vtkRpAxisActor::BuildTickPointsForXType(double p1[3], double p2[3],
    909                                            bool force)
    910 {
    911   if (!force && (this->AxisPosition == this->LastAxisPosition) &&
    912       (this->TickLocation == this->LastTickLocation ) &&
    913       (this->BoundsTime.GetMTime() < this->BuildTime.GetMTime()))
    914     {
    915     return false;
    916     }
    917 
    918   double xPoint1[3], xPoint2[3], yPoint[3], zPoint[3], x;
    919   int numTicks;
    920 
    921   this->MinorTickPts->Reset();
    922   this->MajorTickPts->Reset();
    923   this->GridlinePts->Reset();
    924 
    925   //
    926   // Ymult & Zmult control adjustments to tick position based
    927   // upon "where" this axis is located in relation to the underlying
    928   // assumed bounding box.
    929   //
    930   int yMult = vtkRpAxisActorMultiplierTable1[this->AxisPosition];
    931   int zMult = vtkRpAxisActorMultiplierTable2[this->AxisPosition];
    932 
    933   //
    934   // Build Minor Ticks
    935   //
    936   if (this->TickLocation == VTK_TICKS_OUTSIDE)
    937     {
    938     xPoint1[1] = xPoint2[1] = zPoint[1] = p1[1];
    939     xPoint1[2] = xPoint2[2] = yPoint[2] = p1[2];
    940     yPoint[1] = p1[1] + yMult * this->MinorTickSize;
    941     zPoint[2] = p1[2] + zMult * this->MinorTickSize;
    942     }
    943   else if (this->TickLocation == VTK_TICKS_INSIDE)
    944     {
    945     yPoint[1] = xPoint2[1] = zPoint[1] = p1[1];
    946     xPoint1[2] = yPoint[2] = zPoint[2] = p1[2];
    947     xPoint1[1] = p1[1] - yMult * this->MinorTickSize;
    948     xPoint2[2] = p1[2] - zMult * this->MinorTickSize;
    949     }
    950   else // both sides
    951     {
    952     xPoint2[1] = zPoint[1] = p1[1];
    953     xPoint1[2] = yPoint[2] = p1[2];
    954     yPoint[1] = p1[1] + yMult * this->MinorTickSize;
    955     zPoint[2] = p1[2] + zMult * this->MinorTickSize;
    956     xPoint1[1] = p1[1] - yMult * this->MinorTickSize;
    957     xPoint2[2] = p1[2] - zMult * this->MinorTickSize;
    958     }
    959   x = this->MinorStart;
    960   numTicks = 0;
    961   while (x <= p2[0] && numTicks < VTK_MAX_TICKS)
    962     {
    963     xPoint1[0] = xPoint2[0] = yPoint[0] = zPoint[0] = x;
    964     // xy-portion
    965     this->MinorTickPts->InsertNextPoint(xPoint1);
    966     this->MinorTickPts->InsertNextPoint(yPoint);
    967     // xz-portion
    968     this->MinorTickPts->InsertNextPoint(xPoint2);
    969     this->MinorTickPts->InsertNextPoint(zPoint);
    970     x+= this->DeltaMinor;
    971     numTicks++;
    972     }
    973 
    974   //
    975   // Gridline points
    976   //
    977   yPoint[1] = xPoint2[1] = zPoint[1] = p1[1];
    978   xPoint1[1] = p1[1] - yMult * this->GridlineYLength;
    979   xPoint1[2] = yPoint[2] = zPoint[2] = p1[2];
    980   xPoint2[2] = p1[2] - zMult * this->GridlineZLength;
    981 
    982   x = this->MajorStart;
    983   numTicks = 0;
    984   while (x <= p2[0] && numTicks < VTK_MAX_TICKS)
    985     {
    986     xPoint1[0] = xPoint2[0] = yPoint[0] = zPoint[0] = x;
    987     // xy-portion
    988     this->GridlinePts->InsertNextPoint(xPoint1);
    989     this->GridlinePts->InsertNextPoint(yPoint);
    990     // xz-portion
    991     this->GridlinePts->InsertNextPoint(xPoint2);
    992     this->GridlinePts->InsertNextPoint(zPoint);
    993     x += this->DeltaMajor;
    994     numTicks++;
    995     }
    996 
    997   //
    998   // Major ticks
    999   //
    1000   if (this->TickLocation == VTK_TICKS_OUTSIDE)
    1001     {
    1002     xPoint1[1] = xPoint2[1] = zPoint[1] = p1[1];
    1003     xPoint1[2] = xPoint2[2] = yPoint[2] = p1[2];
    1004     yPoint[1] = p1[1] + yMult * this->MajorTickSize;
    1005     zPoint[2] = p1[2] + zMult * this->MajorTickSize;
    1006     }
    1007   else if (this->TickLocation == VTK_TICKS_INSIDE)
    1008     {
    1009     yPoint[1] = xPoint2[1] = zPoint[1] = p1[1];
    1010     xPoint1[2] = yPoint[2] = zPoint[2] = p1[2];
    1011     xPoint1[1] = p1[1] - yMult * this->MajorTickSize;
    1012     xPoint2[2] = p1[2] - zMult * this->MajorTickSize;
    1013     }
    1014   else // both sides
    1015     {
    1016     xPoint2[1] = zPoint[1] = p1[1];
    1017     xPoint1[2] = yPoint[2] = p1[2];
    1018     yPoint[1] = p1[1] + yMult * this->MajorTickSize;
    1019     zPoint[2] = p1[2] + zMult * this->MajorTickSize;
    1020     xPoint1[1] = p1[1] - yMult * this->MajorTickSize;
    1021     xPoint2[2] = p1[2] - zMult * this->MajorTickSize;
    1022     }
    1023   x = this->MajorStart;
    1024   numTicks = 0;
    1025   while (x <= p2[0] && numTicks < VTK_MAX_TICKS)
    1026     {
    1027     xPoint1[0] = xPoint2[0] = yPoint[0] = zPoint[0] = x;
    1028     // xy-portion
    1029     this->MajorTickPts->InsertNextPoint(xPoint1);
    1030     this->MajorTickPts->InsertNextPoint(yPoint);
    1031     // xz-portion
    1032     this->MajorTickPts->InsertNextPoint(xPoint2);
    1033     this->MajorTickPts->InsertNextPoint(zPoint);
    1034     x += this->DeltaMajor;
    1035     numTicks++;
    1036     }
    1037 
    1038   return true;
    1039 }
    1040 
    1041 // **************************************************************************
    1042 // Creates points for ticks (minor, major, gridlines) in correct position
    1043 // for Y-type axis.
    1044 //
    1045 // Programmer:  Kathleen Bonnell
    1046 // Creation:    November 7, 2001
    1047 //
    1048 // Modifications:
    1049 //   Kathleen Bonnell, Mon Dec  3 16:49:01 PST 2001
    1050 //   Compare vtkTimeStamps correctly.
    1051 //
    1052 //   Kathleen Bonnell, Thu May 16 10:13:56 PDT 2002
    1053 //   Use defined constant VTK_MAX_TICKS to prevent infinite loops.
    1054 //
    1055 //   Kathleen Bonnell, Fri Jul 25 14:37:32 PDT 2003
    1056 //   Allow a forced build, despite previous build time.
    1057 //
    1058 // **************************************************************************
    1059 bool vtkRpAxisActor::BuildTickPointsForYType(double p1[3], double p2[3],
    1060                                            bool force)
    1061 {
    1062   if (!force && (this->AxisPosition  == this->LastAxisPosition) &&
    1063       (this->TickLocation == this->LastTickLocation) &&
    1064       (this->BoundsTime.GetMTime() < this->BuildTime.GetMTime()))
    1065     {
    1066     return false;
    1067     }
    1068 
    1069   double yPoint1[3], yPoint2[3], xPoint[3], zPoint[3], y;
    1070   int numTicks;
    1071 
    1072   this->MinorTickPts->Reset();
    1073   this->MajorTickPts->Reset();
    1074   this->GridlinePts->Reset();
    1075   //
    1076   // xMult & zMult control adjustments to tick position based
    1077   // upon "where" this axis is located in relation to the underlying
    1078   // assumed bounding box.
    1079   //
    1080 
    1081   int xMult = vtkRpAxisActorMultiplierTable1[this->AxisPosition];
    1082   int zMult = vtkRpAxisActorMultiplierTable2[this->AxisPosition];
    1083 
    1084   //
    1085   // The ordering of the tick endpoints is important because
    1086   // label position is defined by them.
    1087   //
    1088 
    1089   //
    1090   // minor ticks
    1091   //
    1092   if (this->TickLocation == VTK_TICKS_INSIDE)
    1093     {
    1094     yPoint1[2] = xPoint[2] = zPoint[2] = p1[2];
    1095     yPoint2[0] = xPoint[0] = zPoint[0] = p1[0];
    1096     yPoint1[0] = p1[0] - xMult * this->MinorTickSize;
    1097     yPoint2[2] = p1[2] - zMult * this->MinorTickSize;
    1098     }
    1099   else if (this->TickLocation == VTK_TICKS_OUTSIDE)
    1100     {
    1101     yPoint1[0] = yPoint2[0] = zPoint[0] = p1[0];
    1102     yPoint1[2] = yPoint2[2] = xPoint[2] = p1[2];
    1103     xPoint[0] = p1[0] + xMult * this->MinorTickSize;
    1104     zPoint[2] = p1[2] + zMult * this->MinorTickSize;
    1105     }
    1106   else                              // both sides
    1107     {
    1108     yPoint1[2] = xPoint[2] = p1[2];
    1109     yPoint2[0] = zPoint[0] = p1[0];
    1110     yPoint1[0] = p1[0] - xMult * this->MinorTickSize;
    1111     yPoint2[2] = p1[2] + zMult * this->MinorTickSize;
    1112     xPoint[0]  = p1[0] + xMult * this->MinorTickSize;
    1113     zPoint[2]  = p1[2] - zMult * this->MinorTickSize;
    1114     }
    1115   y = this->MinorStart;
    1116   numTicks = 0;
    1117   while (y < p2[1] && numTicks < VTK_MAX_TICKS)
    1118     {
    1119     yPoint1[1] = xPoint[1] = yPoint2[1] = zPoint[1] = y;
    1120     // yx portion
    1121     this->MinorTickPts->InsertNextPoint(yPoint1);
    1122     this->MinorTickPts->InsertNextPoint(xPoint);
    1123     // yz portion
    1124     this->MinorTickPts->InsertNextPoint(yPoint2);
    1125     this->MinorTickPts->InsertNextPoint(zPoint);
    1126     y += this->DeltaMinor;
    1127     numTicks++;
    1128     }
    1129 
    1130   //
    1131   // gridlines
    1132   //
    1133   yPoint1[0] = p1[0] - xMult * this->GridlineXLength;
    1134   yPoint2[2] = p1[2] - zMult * this->GridlineZLength;
    1135   yPoint2[0] = xPoint[0] = zPoint[0]  = p1[0];
    1136   yPoint1[2] = xPoint[2] = zPoint[2]  = p1[2];
    1137 
    1138   y = this->MajorStart;
    1139   numTicks = 0;
    1140   while (y <= p2[1] && numTicks < VTK_MAX_TICKS)
    1141     {
    1142     yPoint1[1] = xPoint[1] = yPoint2[1] = zPoint[1] = y;
    1143     // yx portion
    1144     this->GridlinePts->InsertNextPoint(yPoint1);
    1145     this->GridlinePts->InsertNextPoint(xPoint);
    1146     // yz portion
    1147     this->GridlinePts->InsertNextPoint(yPoint2);
    1148     this->GridlinePts->InsertNextPoint(zPoint);
    1149     y += this->DeltaMajor;
    1150     numTicks++;
    1151     }
    1152 
    1153   //
    1154   // major ticks
    1155   //
    1156   if (this->TickLocation == VTK_TICKS_INSIDE)
    1157     {
    1158     yPoint1[2] = xPoint[2] = zPoint[2] = p1[2];
    1159     yPoint2[0] = xPoint[0] = zPoint[0] = p1[0];
    1160     yPoint1[0] = p1[0] - xMult * this->MajorTickSize;
    1161     yPoint2[2] = p1[2] - zMult * this->MajorTickSize;
    1162     }
    1163   else if (this->TickLocation == VTK_TICKS_OUTSIDE)
    1164     {
    1165     yPoint1[0] = yPoint2[0] = zPoint[0] = p1[0];
    1166     yPoint1[2] = yPoint2[2] = xPoint[2] = p1[2];
    1167     xPoint[0] = p1[0] + xMult * this->MajorTickSize;
    1168     zPoint[2] = p1[2] + zMult * this->MajorTickSize;
    1169     }
    1170   else                              // both sides
    1171     {
    1172     yPoint1[2] = xPoint[2] = p1[2];
    1173     yPoint2[0] = zPoint[0] = p1[0];
    1174     yPoint1[0] = p1[0] - xMult * this->MajorTickSize;
    1175     yPoint2[2] = p1[2] + zMult * this->MajorTickSize;
    1176     xPoint[0]  = p1[0] + xMult * this->MajorTickSize;
    1177     zPoint[2]  = p1[2] - zMult * this->MajorTickSize;
    1178     }
    1179   y = this->MajorStart;
    1180   numTicks = 0;
    1181   while (y <= p2[1] && numTicks < VTK_MAX_TICKS)
    1182     {
    1183     yPoint1[1] = xPoint[1] = yPoint2[1] = zPoint[1] = y;
    1184     // yx portion
    1185     this->MajorTickPts->InsertNextPoint(yPoint1);
    1186     this->MajorTickPts->InsertNextPoint(xPoint);
    1187     // yz portion
    1188     this->MajorTickPts->InsertNextPoint(yPoint2);
    1189     this->MajorTickPts->InsertNextPoint(zPoint);
    1190     y += this->DeltaMajor;
    1191     numTicks++;
    1192     }
    1193   return true;
    1194 }
    1195 
    1196 // **************************************************************************
    1197 // Creates points for ticks (minor, major, gridlines) in correct position
    1198 // for Z-type axis.
    1199 //
    1200 // Programmer:  Kathleen Bonnell
    1201 // Creation:    November 7, 2001
    1202 //
    1203 // Modifications:
    1204 //   Kathleen Bonnell, Mon Dec  3 16:49:01 PST 2001
    1205 //   Compare vtkTimeStamps correctly.
    1206 //
    1207 //   Kathleen Bonnell, Thu May 16 10:13:56 PDT 2002
    1208 //   Use defined constant VTK_MAX_TICKS to prevent infinite loops.
    1209 //
    1210 //   Kathleen Bonnell, Fri Jul 25 14:37:32 PDT 2003
    1211 //   Allow a forced build, despite previous build time.
    1212 //
    1213 // **************************************************************************
    1214 
    1215 bool vtkRpAxisActor::BuildTickPointsForZType(double p1[3], double p2[3],
    1216                                            bool force)
    1217 {
    1218   if (!force && (this->AxisPosition  == this->LastAxisPosition) &&
    1219       (this->TickLocation == this->LastTickLocation) &&
    1220       (this->BoundsTime.GetMTime() < this->BuildTime.GetMTime()))
    1221     {
    1222     return false;
    1223     }
    1224 
    1225   this->MinorTickPts->Reset();
    1226   this->MajorTickPts->Reset();
    1227   this->GridlinePts->Reset();
    1228 
    1229   //
    1230   // xMult & yMult control adjustments to tick position based
    1231   // upon "where" this axis is located in relation to the underlying
    1232   // assumed bounding box.
    1233   //
    1234   int xMult = vtkRpAxisActorMultiplierTable1[this->AxisPosition];
    1235   int yMult = vtkRpAxisActorMultiplierTable2[this->AxisPosition];
    1236 
    1237   double zPoint1[3], zPoint2[3], xPoint[3], yPoint[3], z;
    1238   int numTicks;
    1239 
    1240   //
    1241   // The ordering of the tick endpoints is important because
    1242   // label position is defined by them.
    1243   //
    1244 
    1245   //
    1246   // minor ticks
    1247   //
    1248   if (this->TickLocation == VTK_TICKS_INSIDE)
    1249     {
    1250     zPoint1[0] = p1[0] - xMult * this->MinorTickSize;
    1251     zPoint2[1] = p1[1] - yMult * this->MinorTickSize;
    1252     zPoint2[0] = xPoint[0] = yPoint[0]  = p1[0];
    1253     zPoint1[1] = xPoint[1] = yPoint[1]  = p1[1];
    1254     }
    1255   else if (this->TickLocation == VTK_TICKS_OUTSIDE)
    1256     {
    1257     xPoint[0]  = p1[0] + xMult * this->MinorTickSize;
    1258     yPoint[1]  = p1[1] +yMult * this->MinorTickSize;
    1259     zPoint1[0] = zPoint2[0] = yPoint[0] = p1[0];
    1260     zPoint1[1] = zPoint2[1] = xPoint[1] = p1[1];
    1261     }
    1262   else                              // both sides
    1263     {
    1264     zPoint1[0] = p1[0] - xMult * this->MinorTickSize;
    1265     xPoint[0]  = p1[0] + xMult * this->MinorTickSize;
    1266     zPoint2[1] = p1[1] - yMult * this->MinorTickSize;
    1267     yPoint[1]  = p1[1] + yMult * this->MinorTickSize;
    1268     zPoint1[1] = xPoint[1] = p1[1];
    1269     zPoint2[0] = yPoint[0] = p1[0];
    1270     }
    1271   z = this->MinorStart;
    1272   numTicks = 0;
    1273   while (z < p2[2] && numTicks < VTK_MAX_TICKS)
    1274     {
    1275     zPoint1[2] = zPoint2[2] = xPoint[2] = yPoint[2] = z;
    1276     // zx-portion
    1277     this->MinorTickPts->InsertNextPoint(zPoint1);
    1278     this->MinorTickPts->InsertNextPoint(xPoint);
    1279     // zy-portion
    1280     this->MinorTickPts->InsertNextPoint(zPoint2);
    1281     this->MinorTickPts->InsertNextPoint(yPoint);
    1282     z += this->DeltaMinor;
    1283     numTicks++;
    1284     }
    1285 
    1286   //
    1287   // gridlines
    1288   //
    1289   zPoint1[0] = p1[0] - xMult * this->GridlineXLength;
    1290   zPoint2[1] = p1[1] - yMult * this->GridlineYLength;
    1291   zPoint1[1] = xPoint[1] = yPoint[1] = p1[1];
    1292   zPoint2[0] = xPoint[0] = yPoint[0] = p1[0];
    1293 
    1294   z = this->MajorStart;
    1295   numTicks = 0;
    1296   while (z <= p2[2] && numTicks < VTK_MAX_TICKS)
    1297     {
    1298     zPoint1[2] = zPoint2[2] = xPoint[2] = yPoint[2] = z;
    1299     // zx-portion
    1300     this->GridlinePts->InsertNextPoint(zPoint1);
    1301     this->GridlinePts->InsertNextPoint(xPoint);
    1302     // zy-portion
    1303     this->GridlinePts->InsertNextPoint(zPoint2);
    1304     this->GridlinePts->InsertNextPoint(yPoint);
    1305     z += this->DeltaMajor;
    1306     numTicks++;
    1307     }
    1308 
    1309   //
    1310   // major ticks
    1311   //
    1312 
    1313   if (this->TickLocation == VTK_TICKS_INSIDE)
    1314     {
    1315     zPoint1[0] = p1[0] - xMult * this->MajorTickSize;
    1316     zPoint2[1] = p1[1] - yMult * this->MajorTickSize;
    1317     zPoint2[0] = xPoint[0] = yPoint[0]  = p1[0];
    1318     zPoint1[1] = xPoint[1] = yPoint[1]  = p1[1];
    1319     }
    1320   else if (this->TickLocation == VTK_TICKS_OUTSIDE)
    1321     {
    1322     xPoint[0]  = p1[0] + xMult * this->MajorTickSize;
    1323     yPoint[2]  = p1[1] + yMult * this->MajorTickSize;
    1324     zPoint1[0] = zPoint2[0] = yPoint[0] = p1[0];
    1325     zPoint1[1] = zPoint2[1] = xPoint[1] = p1[1];
    1326     }
    1327   else                              // both sides
    1328     {
    1329     zPoint1[0] = p1[0] - xMult * this->MajorTickSize;
    1330     xPoint[0]  = p1[0] + xMult * this->MajorTickSize;
    1331     zPoint2[1] = p1[1] - yMult * this->MajorTickSize;
    1332     yPoint[1]  = p1[1] + yMult * this->MajorTickSize;
    1333     zPoint1[1] = xPoint[1] = p1[1];
    1334     zPoint2[0] = yPoint[0] = p1[0];
    1335     }
    1336   z = this->MajorStart;
    1337   numTicks = 0;
    1338   while (z <= p2[2] && numTicks < VTK_MAX_TICKS)
    1339     {
    1340     zPoint1[2] = zPoint2[2] = xPoint[2] = yPoint[2] = z;
    1341     // zx-portion
    1342     this->MajorTickPts->InsertNextPoint(zPoint1);
    1343     this->MajorTickPts->InsertNextPoint(xPoint);
    1344     // zy-portion
    1345     this->MajorTickPts->InsertNextPoint(zPoint2);
    1346     this->MajorTickPts->InsertNextPoint(yPoint);
    1347     z += this->DeltaMajor;
    1348     numTicks++;
    1349     }
    1350   return true;
    1351 }
    1352 
    1353 // **************************************************************************
    13541277// Creates Poly data (lines) from tickmarks (minor/major), gridlines, and axis.
    1355 //
    1356 // Programmer:  Kathleen Bonnell
    1357 // Creation:    November 7, 2001
    1358 //
    1359 // Modifications:
    1360 //   Kathleen Bonnell, Thu Nov 15 13:20:44 PST 2001
    1361 //   Make ptIds of type vtkIdType to match VTK 4.0 API.
    1362 //
    1363 //   Kathleen Bonnell, Thu Jul 18 13:24:03 PDT 2002
    1364 //   Allow gridlines to be drawn when enabled, even if ticks are disabled.
    1365 //
    1366 //   Kathleen Bonnell, Fri Jul 25 15:10:24 PDT 2003
    1367 //   Removed arguments.
    1368 //
    13691278// **************************************************************************
    13701279void vtkRpAxisActor::SetAxisPointsAndLines()
     
    13721281  vtkPoints *pts = vtkPoints::New();
    13731282  vtkCellArray *lines = vtkCellArray::New();
    1374   this->Axis->SetPoints(pts);
    1375   this->Axis->SetLines(lines);
     1283  vtkCellArray *gridlines = vtkCellArray::New();
     1284  vtkCellArray *innerGridlines = vtkCellArray::New();
     1285  vtkCellArray *polys = vtkCellArray::New();
     1286  this->AxisLines->SetPoints(pts);
     1287  this->AxisLines->SetLines(lines);
     1288  this->Gridlines->SetPoints(this->GridlinePts);
     1289  this->Gridlines->SetLines(gridlines);
     1290  this->InnerGridlines->SetPoints(this->InnerGridlinePts);
     1291  this->InnerGridlines->SetLines(innerGridlines);
     1292  this->Gridpolys->SetPoints(this->GridpolyPts);
     1293  this->Gridpolys->SetPolys(polys);
    13761294  pts->Delete();
    13771295  lines->Delete();
    1378   int i, numPts, numLines;
     1296  gridlines->Delete();
     1297  innerGridlines->Delete();
     1298  polys->Delete();
     1299  int i, numMinorTickPts, numGridlines, numInnerGridlines, numMajorTickPts, numGridpolys, numLines;
    13791300  vtkIdType ptIds[2];
     1301  vtkIdType polyPtIds[4];
    13801302
    13811303  if (this->TickVisibility)
     
    13831305    if (this->MinorTicksVisible)
    13841306      {
    1385       numPts = this->MinorTickPts->GetNumberOfPoints();
    1386       for (i = 0; i < numPts; i++)
     1307      // In 2D mode, the minorTickPts for yz portion or xz portion have been removed.
     1308      numMinorTickPts = this->MinorTickPts->GetNumberOfPoints();
     1309      for (i = 0; i < numMinorTickPts; i++)
    13871310        {
    13881311        pts->InsertNextPoint(this->MinorTickPts->GetPoint(i));
    13891312        }
    13901313      }
    1391 
    1392     if (this->DrawGridlines)
    1393       {
    1394       numPts = this->GridlinePts->GetNumberOfPoints();
    1395       for (i = 0; i < numPts; i++)
    1396         {
    1397         pts->InsertNextPoint(this->GridlinePts->GetPoint(i));
    1398         }
    1399       }
    1400     else  // major tick points
    1401       {
    1402       numPts = this->MajorTickPts->GetNumberOfPoints();
    1403       for (i = 0; i < numPts; i++)
     1314    numMajorTickPts = this->MajorTickPts->GetNumberOfPoints();
     1315    if (this->Use2DMode == 0)
     1316      {
     1317      for (i = 0; i < numMajorTickPts; i++)
    14041318        {
    14051319        pts->InsertNextPoint(this->MajorTickPts->GetPoint(i));
    14061320        }
    14071321      }
    1408     }
    1409   else if (this->DrawGridlines) // grids are enabled but ticks are off
    1410     {
    1411     numPts = this->GridlinePts->GetNumberOfPoints();
    1412     for (i = 0; i < numPts; i++)
    1413       {
    1414       pts->InsertNextPoint(this->GridlinePts->GetPoint(i));
     1322    else
     1323      {
     1324      // In 2D mode, we don't need the pts for the xz portion or yz portion of the major tickmarks
     1325      // majorTickPts not modified because all points are used for labels' positions.
     1326      for (i = 0; i < numMajorTickPts; i+=4)
     1327        {
     1328        pts->InsertNextPoint(this->MajorTickPts->GetPoint(i));
     1329        pts->InsertNextPoint(this->MajorTickPts->GetPoint(i+1));
     1330        }
    14151331      }
    14161332    }
     
    14331349    lines->InsertNextCell(2, ptIds);
    14341350    }
     1351  // create grid lines
     1352  if (this->DrawGridlines && this->AxisOnOrigin == 0)
     1353    {
     1354    numGridlines = this->GridlinePts->GetNumberOfPoints()/2;
     1355    int start =
     1356        (this->DrawGridlinesLocation == 0 || this->DrawGridlinesLocation == 1)
     1357        ? 0 : 1;
     1358    int increment = (this->DrawGridlinesLocation == 0) ? 1 : 2;
     1359    for (i = start; i < numGridlines; i+=increment)
     1360      {
     1361      ptIds[0] = 2*i;
     1362      ptIds[1] = 2*i + 1;
     1363      gridlines->InsertNextCell(2, ptIds);
     1364      }
     1365    }
     1366
     1367  // create inner grid lines
     1368  if (this->DrawInnerGridlines && this->AxisOnOrigin == 0)
     1369    {
     1370    numInnerGridlines = this->InnerGridlinePts->GetNumberOfPoints()/2;
     1371    for (i=0; i < numInnerGridlines; i++)
     1372      {
     1373      ptIds[0] = 2*i;
     1374      ptIds[1] = 2*i + 1;
     1375      innerGridlines->InsertNextCell(2, ptIds);
     1376      }
     1377    }
     1378
     1379  // create polys (grid polys)
     1380  if (this->DrawGridpolys && this->AxisOnOrigin == 0)
     1381    {
     1382    numGridpolys = this->GridpolyPts->GetNumberOfPoints()/4;
     1383    for (i = 0; i < numGridpolys; i++)
     1384      {
     1385      polyPtIds[0] = 4*i;
     1386      polyPtIds[1] = 4*i + 1;
     1387      polyPtIds[2] = 4*i + 2;
     1388      polyPtIds[3] = 4*i + 3;
     1389      polys->InsertNextCell(4,polyPtIds);
     1390      }
     1391    }
    14351392}
    14361393
    14371394// *********************************************************************
    14381395// Returns true if any tick vis attribute has changed since last check.
    1439 //
    1440 // Programmer:  Kathleen Bonnell
    1441 // Creation:    November 7, 2001
    14421396// *********************************************************************
    14431397bool vtkRpAxisActor::TickVisibilityChanged()
     
    14561410// *********************************************************************
    14571411// Set the bounds for this actor to use.  Sets timestamp BoundsModified.
    1458 //
    1459 // Programmer:  Kathleen Bonnell
    1460 // Creation:    November 7, 2001
    14611412// *********************************************************************
    14621413void
     
    14801431// *********************************************************************
    14811432// Retrieves the bounds of this actor.
    1482 // Set the bounds for this actor to use.  Sets timestamp BoundsModified.
    1483 //
    1484 // Programmer:  Will Schroeder
    1485 // Creation:    December 8, 2010
    14861433// *********************************************************************
    14871434void vtkRpAxisActor::
     
    15081455// *********************************************************************
    15091456// Retrieves the bounds of this actor.
    1510 //
    1511 // Programmer:  Kathleen Bonnell
    1512 // Creation:    November 7, 2001
    15131457// *********************************************************************
    15141458double* vtkRpAxisActor::GetBounds()
     
    15191463// *********************************************************************
    15201464// Retrieves the bounds of this actor.
    1521 //
    1522 // Programmer:  Kathleen Bonnell
    1523 // Creation:    November 7, 2001
    15241465// *********************************************************************
    15251466
     
    15341475// *********************************************************************
    15351476// Method:  vtkRpAxisActor::ComputeMaxLabelLength
    1536 //
    1537 // Purpose: Determines the maximum length that a label will occupy
    1538 //          if placed at point 'center' and with a scale of 1.
    1539 //
    1540 // Arguments:
    1541 //   center    The position to use for the label actor
    1542 //
    1543 // Returns:
    1544 //   the maximum length of all the labels, 0 if there are no labels.
    1545 //
    1546 // Programmer:  Kathleen Bonnell
    1547 // Creation:    July 18, 2003
    1548 //
    1549 // Modifications:
    1550 //   Kathleen Bonnell, Tue Dec 16 11:06:21 PST 2003
    1551 //   Reset the actor's position and scale.
    1552 //
    1553 // Modifications:
    1554 //   David Gobbi, Fri Apr 8 16:50:00 MST 2011
    1555 //   Use mapper bounds, not actor bounds, so centering is not necessary.
    1556 //
    15571477// *********************************************************************
    1558 
    15591478double vtkRpAxisActor::ComputeMaxLabelLength(const double vtkNotUsed(center)[3])
    15601479{
    1561   double length, maxLength = 0.;
    15621480  double bounds[6];
    15631481  double xsize, ysize;
     1482  vtkProperty *newProp = this->NewLabelProperty();
     1483  double maxXSize = 0;
     1484  double maxYSize = 0;
    15641485  for (int i = 0; i < this->NumberOfLabelsBuilt; i++)
    15651486    {
    15661487    this->LabelActors[i]->SetCamera(this->Camera);
    1567     this->LabelActors[i]->SetProperty(this->GetProperty());
     1488    this->LabelActors[i]->SetProperty(newProp);
    15681489    this->LabelActors[i]->GetMapper()->GetBounds(bounds);
     1490    this->LabelActors[i]->GetProperty()->SetColor(this->LabelTextProperty->GetColor());
    15691491    xsize = bounds[1] - bounds[0];
    15701492    ysize = bounds[3] - bounds[2];
    1571     length = sqrt(xsize*xsize + ysize*ysize);
    1572     maxLength = (length > maxLength ? length : maxLength);
    1573     }
    1574   return maxLength;
     1493    maxXSize = (xsize > maxXSize ? xsize : maxXSize);
     1494    maxYSize = (ysize > maxYSize ? ysize : maxYSize);
     1495    }
     1496  newProp->Delete();
     1497  return sqrt(maxXSize*maxXSize + maxYSize*maxYSize);
    15751498}
    15761499
    15771500// *********************************************************************
    15781501// Method:  vtkRpAxisActor::ComputeTitleLength
    1579 //
    1580 // Purpose: Determines the length that the title will occupy
    1581 //          if placed at point 'center' and with a scale of 1.
    1582 //
    1583 // Arguments:
    1584 //   center    The position to use for the title actor
    1585 //
    1586 // Returns:
    1587 //   the length of all the title,
    1588 //
    1589 // Programmer:  Kathleen Bonnell
    1590 // Creation:    July 25, 2003
    1591 //
    1592 // Modifications:
    1593 //   Kathleen Bonnell, Tue Dec 16 11:06:21 PST 2003
    1594 //   Reset the actor's position and scale.
    1595 //
    1596 // Modifications:
    1597 //   David Gobbi, Fri Apr 8 16:50:00 MST 2011
    1598 //   Use mapper bounds, not actor bounds, so centering is not necessary.
    1599 //
    16001502// *********************************************************************
    1601 
    16021503double vtkRpAxisActor::ComputeTitleLength(const double vtkNotUsed(center)[3])
    16031504{
     
    16081509  this->TitleVector->SetText(this->Title);
    16091510  this->TitleActor->SetCamera(this->Camera);
    1610   this->TitleActor->SetProperty(this->GetProperty());
     1511  vtkProperty * newProp = this->NewTitleProperty();
     1512  this->TitleActor->SetProperty(newProp);
     1513  newProp->Delete();
    16111514  this->TitleActor->GetMapper()->GetBounds(bounds);
     1515  this->TitleActor->GetProperty()->SetColor(this->TitleTextProperty->GetColor());
    16121516  xsize = bounds[1] - bounds[0];
    16131517  ysize = bounds[3] - bounds[2];
    16141518  length = sqrt(xsize*xsize + ysize*ysize);
     1519
    16151520  return length;
    16161521}
    16171522
    16181523// *********************************************************************
    1619 // Method:  vtkRpAxisActor::SetLabelScale
    1620 //
    1621 // Purpose: Sets the scaling factor for label actors.
    1622 //
    1623 // Arguments:
    1624 //   s      The scale factor to use.
    1625 //
    1626 // Programmer:  Kathleen Bonnell
    1627 // Creation:    July 18, 2003
    1628 //
     1524void vtkRpAxisActor::SetLabelScale(const double s)
     1525{
     1526  for (int i=0; i < this->NumberOfLabelsBuilt; i++)
     1527    {
     1528    this->LabelActors[i]->SetScale(s);
     1529    }
     1530}
     1531
    16291532// *********************************************************************
    1630 
    1631 void vtkRpAxisActor::SetLabelScale(const double s)
    1632 {
    1633   for (int i=0; i < this->NumberOfLabelsBuilt; i++)
    1634     {
    1635     this->LabelActors[i]->SetScale(s);
    1636     }
     1533void vtkRpAxisActor::SetTitleScale(const double s)
     1534{
     1535  this->TitleActor->SetScale(s);
    16371536}
    16381537
    16391538// *********************************************************************
    1640 // Method:  vtkRpAxisActor::SetTitleScale
    1641 //
    1642 // Purpose: Sets the scaling factor for the title actor.
    1643 //
    1644 // Arguments:
    1645 //   s      The scale factor to use.
    1646 //
    1647 // Programmer:  Kathleen Bonnell
    1648 // Creation:    July 18, 2003
    1649 //
    1650 // *********************************************************************
    1651 
    1652 void vtkRpAxisActor::SetTitleScale(const double s)
    1653 {
    1654   this->TitleActor->SetScale(s);
    1655 }
    1656 
    1657 // *********************************************************************
    1658 // Method:  vtkRpAxisActor::SetTitle
    1659 //
    1660 // Purpose: Sets the text for the title.
    1661 //
    1662 // Notes:   Not using vtkSetStringMacro so that the modification time of
    1663 //          the text can be kept (so the title will be updated as
    1664 //          appropriate when the text changes.)
    1665 //
    1666 // Arguments:
    1667 //   t          The text to use.
    1668 //
    1669 // Programmer:  Kathleen Bonnell
    1670 // Creation:    August 31, 2004
    1671 //
    1672 // *********************************************************************
    1673 
    16741539void vtkRpAxisActor::SetTitle(const char *t)
    16751540{
     
    16991564}
    17001565
     1566// ****************************************************************************
     1567void vtkRpAxisActor::SetAxisLinesProperty(vtkProperty *prop)
     1568{
     1569  this->AxisLinesActor->SetProperty(prop);
     1570  this->Modified();
     1571}
     1572
     1573// ****************************************************************************
     1574vtkProperty* vtkRpAxisActor::GetAxisLinesProperty()
     1575{
     1576  return this->AxisLinesActor->GetProperty();
     1577}
     1578
     1579// ****************************************************************************
     1580void vtkRpAxisActor::SetGridlinesProperty(vtkProperty *prop)
     1581{
     1582  this->GridlinesActor->SetProperty(prop);
     1583  this->Modified();
     1584}
     1585
     1586// ****************************************************************************
     1587vtkProperty* vtkRpAxisActor::GetGridlinesProperty()
     1588{
     1589  return this->GridlinesActor->GetProperty();
     1590}
     1591
     1592// ****************************************************************************
     1593void vtkRpAxisActor::SetInnerGridlinesProperty(vtkProperty *prop)
     1594{
     1595  this->InnerGridlinesActor->SetProperty(prop);
     1596  this->Modified();
     1597}
     1598
     1599// ****************************************************************************
     1600vtkProperty* vtkRpAxisActor::GetInnerGridlinesProperty()
     1601{
     1602  return this->InnerGridlinesActor->GetProperty();
     1603}
     1604
     1605// ****************************************************************************
     1606void vtkRpAxisActor::SetGridpolysProperty(vtkProperty *prop)
     1607{
     1608  this->GridpolysActor->SetProperty(prop);
     1609  this->Modified();
     1610}
     1611
     1612// ****************************************************************************
     1613vtkProperty* vtkRpAxisActor::GetGridpolysProperty()
     1614{
     1615  return this->GridpolysActor->GetProperty();
     1616}
     1617
     1618// ****************************************************************************
     1619vtkProperty* vtkRpAxisActor::NewTitleProperty()
     1620{
     1621  vtkProperty *newProp = vtkProperty::New();
     1622  newProp->DeepCopy(this->GetProperty());
     1623  newProp->SetColor(this->TitleTextProperty->GetColor());
     1624  // We pass the opacity in the line offset.
     1625  //newProp->SetOpacity(this->TitleTextProperty->GetLineOffset());
     1626  return newProp;
     1627}
     1628
     1629// ****************************************************************************
     1630vtkProperty* vtkRpAxisActor::NewLabelProperty()
     1631{
     1632  vtkProperty *newProp = vtkProperty::New();
     1633  newProp->DeepCopy(this->GetProperty());
     1634  newProp->SetColor(this->LabelTextProperty->GetColor());
     1635  // We pass the opacity in the line offset.
     1636  //newProp->SetOpacity(this->LabelTextProperty->GetLineOffset());
     1637  return newProp;
     1638}
     1639
     1640
     1641// ****************************************************************************
     1642double vtkRpAxisActor::GetDeltaMajor(int axis){
     1643  if(axis>=0 && axis<=2)
     1644    {
     1645    return (this->DeltaMajor[axis]);
     1646    }
     1647  return 0;
     1648}
     1649
     1650void vtkRpAxisActor::SetDeltaMajor(int axis, double value){
     1651  if(axis>=0 && axis<=2)
     1652    {
     1653    this->DeltaMajor[axis] = value;
     1654    }
     1655}
     1656
     1657// ****************************************************************************
     1658double vtkRpAxisActor::GetMajorStart(int axis){
     1659  if(axis>=0 && axis<=2)
     1660    {
     1661    return (this->MajorStart[axis]);
     1662    }
     1663  return 0;
     1664}
     1665
     1666// ****************************************************************************
     1667void vtkRpAxisActor::SetMajorStart(int axis, double value){
     1668  if(axis>=0 && axis<=2)
     1669    {
     1670    this->MajorStart[axis] = value;
     1671    }
     1672}
     1673
     1674// ****************************************************************************
     1675bool vtkRpAxisActor::BoundsDisplayCoordinateChanged(vtkViewport *viewport)
     1676{
     1677  double transMinPt[3], transMaxPt[3];
     1678  viewport->SetWorldPoint(this->Bounds[0], this->Bounds[2], this->Bounds[4], 1.0);
     1679  viewport->WorldToDisplay();
     1680  viewport->GetDisplayPoint(transMinPt);
     1681  viewport->SetWorldPoint(this->Bounds[1], this->Bounds[3], this->Bounds[5], 1.0);
     1682  viewport->WorldToDisplay();
     1683  viewport->GetDisplayPoint(transMaxPt);
     1684
     1685  if( this->LastMinDisplayCoordinate[0] != transMinPt[0]
     1686      || this->LastMinDisplayCoordinate[1] != transMinPt[1]
     1687      || this->LastMinDisplayCoordinate[2] != transMinPt[2]
     1688      || this->LastMaxDisplayCoordinate[0] != transMaxPt[0]
     1689      || this->LastMaxDisplayCoordinate[1] != transMaxPt[1]
     1690      || this->LastMaxDisplayCoordinate[2] != transMaxPt[2] )
     1691    {
     1692    int i = 0;
     1693    for( i=0 ; i<3 ; ++i )
     1694      {
     1695      this->LastMinDisplayCoordinate[i] = transMinPt[i];
     1696      this->LastMaxDisplayCoordinate[i] = transMaxPt[i];
     1697      }
     1698    return true;
     1699    }
     1700
     1701  return false;
     1702}
    17011703//---------------------------------------------------------------------------
    17021704// endpoint-related methods
     
    17091711}
    17101712
     1713//---------------------------------------------------------------------------
    17111714vtkCoordinate* vtkRpAxisActor::GetPoint2Coordinate()
    17121715{
     
    17171720}
    17181721
     1722//---------------------------------------------------------------------------
    17191723void vtkRpAxisActor::SetPoint1(double x, double y, double z)
    17201724{
     
    17221726}
    17231727
     1728//---------------------------------------------------------------------------
    17241729void vtkRpAxisActor::SetPoint2(double x, double y, double z)
    17251730{
     
    17271732}
    17281733
     1734//---------------------------------------------------------------------------
    17291735double* vtkRpAxisActor::GetPoint1()
    17301736{
     
    17321738}
    17331739
     1740//---------------------------------------------------------------------------
    17341741double* vtkRpAxisActor::GetPoint2()
    17351742{
    17361743  return this->Point2Coordinate->GetValue();
    17371744}
     1745// **************************************************************************
     1746// Creates points for ticks (minor, major, gridlines) in correct position
     1747// for a generic axis.
     1748// **************************************************************************
     1749bool vtkRpAxisActor::BuildTickPoints(double p1[3], double p2[3], bool force)
     1750{
     1751  // Prevent any unwanted computation
     1752  if (!force && (this->AxisPosition == this->LastAxisPosition) &&
     1753      (this->TickLocation == this->LastTickLocation ) &&
     1754      (this->BoundsTime.GetMTime() < this->BuildTime.GetMTime()) &&
     1755      (this->Point1Coordinate->GetMTime() < this->BuildTickPointsTime.GetMTime()) &&
     1756      (this->Point2Coordinate->GetMTime() < this->BuildTickPointsTime.GetMTime()) &&
     1757      (this->Range[0] == this->LastRange[0]) &&
     1758      (this->Range[1] == this->LastRange[1]))
     1759    {
     1760    return false;
     1761    }
     1762
     1763  // Local tmp vars
     1764  double uPointInside[3], vPointInside[3], uPointOutside[3], vPointOutside[3];
     1765  double gridPointClosest[3], gridPointFarest[3], gridPointU[3], gridPointV[3];
     1766  double innerGridPointClosestU[3], innerGridPointClosestV[3];
     1767  double innerGridPointFarestU[3], innerGridPointFarestV[3];
     1768  double deltaVector[3];
     1769  double axisLength, axisShift, rangeScale, nbIterationAsDouble;
     1770  int nbTicks, i, nbIteration, uIndex, vIndex;
     1771  uIndex = vIndex = 0;
     1772  bool hasOrthogonalVectorBase =
     1773      (this->AxisBaseForX[0] == 1 && this->AxisBaseForX[1] == 0 && this->AxisBaseForX[2] == 0
     1774       && this->AxisBaseForY[0] == 0 && this->AxisBaseForY[1] == 1 && this->AxisBaseForY[2] == 0
     1775       && this->AxisBaseForZ[0] == 0 && this->AxisBaseForZ[1] == 0 && this->AxisBaseForZ[2] == 1);
     1776
     1777  // Reset previous objects
     1778  this->MinorTickPts->Reset();
     1779  this->MajorTickPts->Reset();
     1780  this->GridlinePts->Reset();
     1781  this->InnerGridlinePts->Reset();
     1782  this->GridpolyPts->Reset();
     1783
     1784  // As we assume that the Axis is not necessery alined to the absolute X/Y/Z
     1785  // axis, we will convert the absolut XYZ information to relative one
     1786  // using a base composed as follow (axis, u, v)
     1787  double uGridLength, vGridLength;
     1788  uGridLength = vGridLength = 0;
     1789  double *axisVector, *uVector, *vVector;
     1790  axisVector = uVector = vVector = NULL;
     1791  int uMult = vtkRpAxisActorMultiplierTable1[this->AxisPosition];
     1792  int vMult = vtkRpAxisActorMultiplierTable2[this->AxisPosition];
     1793
     1794  switch(this->AxisType)
     1795    {
     1796  case VTK_AXIS_TYPE_X:
     1797    uGridLength = this->GridlineYLength;
     1798    vGridLength = this->GridlineZLength;
     1799    axisVector = this->AxisBaseForX;
     1800    uVector = this->AxisBaseForY;
     1801    vVector = this->AxisBaseForZ;
     1802    uIndex = 1; vIndex = 2;
     1803    break;
     1804  case VTK_AXIS_TYPE_Y:
     1805    uGridLength = this->GridlineXLength;
     1806    vGridLength = this->GridlineZLength;
     1807    uVector = this->AxisBaseForX;
     1808    axisVector = this->AxisBaseForY;
     1809    vVector = this->AxisBaseForZ;
     1810    uIndex = 0; vIndex = 2;
     1811    break;
     1812  case VTK_AXIS_TYPE_Z:
     1813    uGridLength = this->GridlineXLength;
     1814    vGridLength = this->GridlineYLength;
     1815    uVector = this->AxisBaseForX;
     1816    vVector = this->AxisBaseForY;
     1817    axisVector = this->AxisBaseForZ;
     1818    uIndex = 0; vIndex = 1;
     1819    break;
     1820    }
     1821
     1822  // **************************************************************************
     1823  // Build Minor Ticks
     1824  // **************************************************************************
     1825  {
     1826  // - Initialize all points to be on the axis
     1827  for(i=0;i<3;i++)
     1828    {
     1829    uPointInside[i] = vPointInside[i] = uPointOutside[i] = vPointOutside[i] = p1[i];
     1830    deltaVector[i] = (p2[i] - p1[i]);
     1831    }
     1832  axisLength = vtkMath::Norm(deltaVector);
     1833  rangeScale = axisLength/(this->Range[1] - this->Range[0]);
     1834
     1835  // - Reduce the deltaVector to correspond to a tick step
     1836  vtkMath::Normalize(deltaVector);
     1837  for(i=0;i<3;i++)
     1838    {
     1839    deltaVector[i] *= this->DeltaMinor;
     1840    }
     1841
     1842  // - Move outside points if needed (Axis -> Outside)
     1843  if (this->TickLocation == VTK_TICKS_OUTSIDE || this->TickLocation == VTK_TICKS_BOTH)
     1844    {
     1845    for(i=0;i<3;i++)
     1846      {
     1847      uPointOutside[i] += uVector[i] * uMult * this->MinorTickSize;
     1848      vPointOutside[i] += vVector[i] * vMult * this->MinorTickSize;
     1849      }
     1850    }
     1851
     1852  // - Move inside points if needed (Axis -> Inside)
     1853  if (this->TickLocation == VTK_TICKS_INSIDE || this->TickLocation == VTK_TICKS_BOTH)
     1854    {
     1855    for(i=0;i<3;i++)
     1856      {
     1857      uPointInside[i] -= uVector[i] * uMult * this->MinorTickSize;
     1858      vPointInside[i] -= vVector[i] * vMult * this->MinorTickSize;
     1859      }
     1860    }
     1861
     1862  // - Add the initial shift if any
     1863  axisShift = (this->MinorRangeStart - this->Range[0])*rangeScale;
     1864  for(i=0;i<3;i++)
     1865    {
     1866    uPointInside[i] += axisVector[i] * axisShift;
     1867    vPointInside[i] += axisVector[i] * axisShift;
     1868    uPointOutside[i] += axisVector[i] * axisShift;
     1869    vPointOutside[i] += axisVector[i] * axisShift;
     1870    }
     1871
     1872  // - Insert tick points along the axis using the deltaVector
     1873  nbIterationAsDouble = axisLength / vtkMath::Norm(deltaVector);
     1874  nbIteration = vtkMath::Floor(nbIterationAsDouble+2*DBL_EPSILON);
     1875  nbIteration = (nbIteration < VTK_MAX_TICKS) ? nbIteration : VTK_MAX_TICKS;
     1876  for (nbTicks = 0; nbTicks < nbIteration; nbTicks++)
     1877    {
     1878    // axis/u side
     1879    this->MinorTickPts->InsertNextPoint(uPointInside);
     1880    this->MinorTickPts->InsertNextPoint(uPointOutside);
     1881    vtkMath::Add(deltaVector, uPointInside, uPointInside);
     1882    vtkMath::Add(deltaVector, uPointOutside, uPointOutside);
     1883    if( this->Use2DMode == 0 )
     1884      {
     1885      // axis/v side
     1886      this->MinorTickPts->InsertNextPoint(vPointInside);
     1887      this->MinorTickPts->InsertNextPoint(vPointOutside);
     1888      vtkMath::Add(deltaVector, vPointInside, vPointInside);
     1889      vtkMath::Add(deltaVector, vPointOutside, vPointOutside);
     1890      }
     1891    }
     1892  }
     1893  // **************************************************************************
     1894  // Build Gridline + GridPoly points + InnerGrid (Only for Orthonormal base)
     1895  // **************************************************************************
     1896  {
     1897  // - Initialize all points to be on the axis
     1898  for(i=0;i<3;i++)
     1899    {
     1900    gridPointClosest[i] = gridPointFarest[i] = gridPointU[i] = gridPointV[i] = p1[i];
     1901    deltaVector[i] = (p2[i] - p1[i]);
     1902    }
     1903
     1904  // - Reduce the deltaVector to correspond to a major tick step
     1905  vtkMath::Normalize(deltaVector);
     1906  for(i=0;i<3;i++)
     1907    {
     1908    deltaVector[i] *= this->DeltaMajor[this->AxisType];
     1909    }
     1910
     1911  // - Move base points
     1912  for(i=0;i<3;i++)
     1913    {
     1914    gridPointU[i] -= uVector[i] * uMult * uGridLength;
     1915    gridPointV[i] -= vVector[i] * vMult * vGridLength;
     1916    gridPointFarest[i] -= uVector[i] * uMult * uGridLength + vVector[i] * vMult * vGridLength;
     1917    }
     1918
     1919  // - Add the initial shift if any
     1920  axisShift = (this->MajorRangeStart - this->Range[0])*rangeScale;
     1921  for(i=0;i<3;i++)
     1922    {
     1923    gridPointU[i] += axisVector[i] * axisShift;
     1924    gridPointV[i] += axisVector[i] * axisShift;
     1925    gridPointFarest[i] += axisVector[i] * axisShift;
     1926    gridPointClosest[i] += axisVector[i] * axisShift;
     1927    }
     1928
     1929  // - Insert Gridlines points along the axis using the DeltaMajor vector
     1930  nbIterationAsDouble = (axisLength - axisShift) / vtkMath::Norm(deltaVector);
     1931  nbIteration = vtkMath::Floor(nbIterationAsDouble+2*FLT_EPSILON) + 1;
     1932  nbIteration = (nbIteration < VTK_MAX_TICKS) ? nbIteration : VTK_MAX_TICKS;
     1933  for (nbTicks = 0; nbTicks < nbIteration; nbTicks++)
     1934    {
     1935    // Closest U
     1936    this->GridlinePts->InsertNextPoint(gridPointClosest);
     1937    this->GridlinePts->InsertNextPoint(gridPointU);
     1938
     1939    // Farest U
     1940    this->GridlinePts->InsertNextPoint(gridPointFarest);
     1941    this->GridlinePts->InsertNextPoint(gridPointU);
     1942
     1943    // Closest V
     1944    this->GridlinePts->InsertNextPoint(gridPointClosest);
     1945    this->GridlinePts->InsertNextPoint(gridPointV);
     1946
     1947    // Farest V
     1948    this->GridlinePts->InsertNextPoint(gridPointFarest);
     1949    this->GridlinePts->InsertNextPoint(gridPointV);
     1950
     1951    // PolyPoints
     1952    this->GridpolyPts->InsertNextPoint(gridPointClosest);
     1953    this->GridpolyPts->InsertNextPoint(gridPointU);
     1954    this->GridpolyPts->InsertNextPoint(gridPointFarest);
     1955    this->GridpolyPts->InsertNextPoint(gridPointV);
     1956
     1957    // Move forward along the axis
     1958    for(i=0;i<3;i++)
     1959      {
     1960      gridPointClosest[i] += deltaVector[i];
     1961      gridPointU[i] += deltaVector[i];
     1962      gridPointFarest[i] += deltaVector[i];
     1963      gridPointV[i] += deltaVector[i];
     1964      }
     1965    }
     1966
     1967  // - Insert InnerGridLines points
     1968
     1969  // We can only handle inner grid line with orthonormal base, otherwise
     1970  // we would need to change the API of AxisActor which we don't want for
     1971  // backward compatibility.
     1972  if(hasOrthogonalVectorBase)
     1973    {
     1974    double axis, u, v;
     1975    axis = this->MajorStart[this->AxisType];
     1976    innerGridPointClosestU[vIndex] = this->GetBounds()[vIndex*2];
     1977    innerGridPointFarestU[vIndex] = this->GetBounds()[vIndex*2+1];
     1978    innerGridPointClosestV[uIndex] = this->GetBounds()[uIndex*2];
     1979    innerGridPointFarestV[uIndex] = this->GetBounds()[uIndex*2+1];
     1980    while (axis <= p2[this->AxisType])
     1981        {
     1982        innerGridPointClosestU[this->AxisType]
     1983            = innerGridPointClosestV[this->AxisType]
     1984            = innerGridPointFarestU[this->AxisType]
     1985            = innerGridPointFarestV[this->AxisType]
     1986            = axis;
     1987
     1988        // u lines
     1989        u = this->MajorStart[uIndex];
     1990        while (u <= p2[uIndex] && this->DeltaMajor[uIndex] > 0)
     1991          {
     1992          innerGridPointClosestU[uIndex]
     1993              = innerGridPointFarestU[uIndex]
     1994              = u;
     1995          this->InnerGridlinePts->InsertNextPoint(innerGridPointClosestU);
     1996          this->InnerGridlinePts->InsertNextPoint(innerGridPointFarestU);
     1997          u += this->DeltaMajor[uIndex];
     1998          }
     1999
     2000        // v lines
     2001        v = this->MajorStart[vIndex];
     2002        while (v <= p2[vIndex] && this->DeltaMajor[vIndex] > 0)
     2003          {
     2004          innerGridPointClosestV[vIndex]
     2005              = innerGridPointFarestV[vIndex]
     2006              = v;
     2007          this->InnerGridlinePts->InsertNextPoint(innerGridPointClosestV);
     2008          this->InnerGridlinePts->InsertNextPoint(innerGridPointFarestV);
     2009          v += this->DeltaMajor[vIndex];
     2010          }
     2011
     2012        axis += this->DeltaMajor[this->AxisType];
     2013        }
     2014    }
     2015  }
     2016  // **************************************************************************
     2017  // Build Major ticks
     2018  // **************************************************************************
     2019  {
     2020  // Delta vector is already initialized with the Major tick scale
     2021  // - Initialize all points to be on the axis
     2022  for(i=0;i<3;i++)
     2023    {
     2024    uPointInside[i] = vPointInside[i] = uPointOutside[i] = vPointOutside[i] = p1[i];
     2025    }
     2026
     2027  // - Move outside points if needed (Axis -> Outside)
     2028  if (this->TickLocation == VTK_TICKS_OUTSIDE || this->TickLocation == VTK_TICKS_BOTH)
     2029    {
     2030    for(i=0;i<3;i++)
     2031      {
     2032      uPointOutside[i] += uVector[i] * uMult * this->MajorTickSize;
     2033      vPointOutside[i] += vVector[i] * vMult * this->MajorTickSize;
     2034      }
     2035    }
     2036
     2037  // - Move inside points if needed (Axis -> Inside)
     2038  if (this->TickLocation == VTK_TICKS_INSIDE || this->TickLocation == VTK_TICKS_BOTH)
     2039    {
     2040    for(i=0;i<3;i++)
     2041      {
     2042      uPointInside[i] -= uVector[i] * uMult * this->MajorTickSize;
     2043      vPointInside[i] -= vVector[i] * vMult * this->MajorTickSize;
     2044      }
     2045    }
     2046
     2047  // - Add the initial shift if any
     2048  for(i=0;i<3;i++)
     2049    {
     2050    uPointInside[i] += axisVector[i] * axisShift;
     2051    vPointInside[i] += axisVector[i] * axisShift;
     2052    uPointOutside[i] += axisVector[i] * axisShift;
     2053    vPointOutside[i] += axisVector[i] * axisShift;
     2054    }
     2055
     2056  // - Insert tick points along the axis using the deltaVector
     2057  for (nbTicks = 0; nbTicks < nbIteration; nbTicks++)
     2058    {
     2059    // axis/u side
     2060    this->MajorTickPts->InsertNextPoint(uPointInside);
     2061    this->MajorTickPts->InsertNextPoint(uPointOutside);
     2062    vtkMath::Add(deltaVector, uPointInside, uPointInside);
     2063    vtkMath::Add(deltaVector, uPointOutside, uPointOutside);
     2064
     2065    // axis/v side
     2066    this->MajorTickPts->InsertNextPoint(vPointInside);
     2067    this->MajorTickPts->InsertNextPoint(vPointOutside);
     2068    vtkMath::Add(deltaVector, vPointInside, vPointInside);
     2069    vtkMath::Add(deltaVector, vPointOutside, vPointOutside);
     2070    }
     2071  }
     2072
     2073  this->BuildTickPointsTime.Modified();
     2074  this->LastTickLocation = this->TickLocation;
     2075  return true;
     2076}
  • trunk/packages/vizservers/vtkvis/vtkRpAxisActor.h

    r2864 r3479  
    11/*=========================================================================
    22
    3   Program:   Visualization Toolkit
    4   Module:    vtkRpAxisActor.h
    5   Language:  C++
    6   Date:      $Date$
    7   Version:   $Revision$
    8   Thanks:    Kathleen Bonnell, B Division, Lawrence Livermore Nat'l Laboratory
     3Program:   Visualization Toolkit
     4Module:    vtkRpAxisActor.h
     5Language:  C++
     6Date:      $Date$
     7Version:   $Revision$
     8Thanks:    Kathleen Bonnell, B Division, Lawrence Livermore Nat'l Laboratory
    99
    1010Copyright (c) 1993-2000 Ken Martin, Will Schroeder, Bill Lorensen
    1111All rights reserved.
    12      This software is distributed WITHOUT ANY WARRANTY; without even
    13      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
    14      PURPOSE.  See the above copyright notice for more information.
     12This software is distributed WITHOUT ANY WARRANTY; without even
     13the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     14PURPOSE.  See the above copyright notice for more information.
    1515=========================================================================*/
    1616// .NAME vtkRpAxisActor - Create an axis with tick marks and labels
     
    3737// All calculations and references are in World Coordinates.
    3838//
    39 // .SECTION Notes
    40 // This class was adapted from a 2D version created by Hank Childs called
    41 // vtkHankAxisActor2D.
     39// .SECTION Thanks
     40// This class was written by:
     41// Hank Childs, Kathleen Bonnell, Amy Squillacote, Brad Whitlock,
     42// Eric Brugger, Claire Guilbaud, Nicolas Dolegieviez, Will Schroeder,
     43// Karthik Krishnan, Aashish Chaudhary, Philippe Pebay, David Gobbi,
     44// David Partyka, Utkarsh Ayachit David Cole, Francois Bertel, and Mark Olesen
     45// Part of this work was supported by CEA/DIF - Commissariat a l'Energie Atomique,
     46// Centre DAM Ile-De-France, BP12, F-91297 Arpajon, France.
    4247//
    4348// .SECTION See Also
     
    4752#define __vtkRpAxisActor_h
    4853
     54#include "vtkRenderingAnnotationModule.h" // For export macro
    4955#include "vtkActor.h"
    5056
     
    6571#define VTK_AXIS_POS_MAXMIN 3
    6672
    67 // ****************************************************************************
    68 //  Modifications:
    69 //    Kathleen Bonnell, Tue Aug 31 16:17:43 PDT 2004
    70 //    Added TitleTextTime timestamp, so that title can be updated appropriately
    71 //    when its text changes.  Changed Titles Set macro for a user-defined
    72 //    set so TitleTextTime can be updated.
    73 //
    74 // ****************************************************************************
    75 
     73class vtkRpAxisFollower;
    7674class vtkCamera;
    7775class vtkCoordinate;
     
    8078class vtkPolyData;
    8179class vtkPolyDataMapper;
     80class vtkProperty2D;
    8281class vtkStringArray;
     82class vtkTextActor;
     83class vtkTextProperty;
    8384class vtkVectorText;
    8485
    85 class VTK_HYBRID_EXPORT vtkRpAxisActor : public vtkActor
     86class VTKRENDERINGANNOTATION_EXPORT vtkRpAxisActor : public vtkActor
    8687{
    87 public:
     88 public:
    8889  vtkTypeMacro(vtkRpAxisActor,vtkActor);
    8990  void PrintSelf(ostream& os, vtkIndent indent);
     
    9798  virtual vtkCoordinate *GetPoint1Coordinate();
    9899  virtual void SetPoint1(double x[3])
    99     { this->SetPoint1(x[0], x[1], x[2]); }
     100  { this->SetPoint1(x[0], x[1], x[2]); }
    100101  virtual void SetPoint1(double x, double y, double z);
    101102  virtual double *GetPoint1();
     
    105106  virtual vtkCoordinate *GetPoint2Coordinate();
    106107  virtual void SetPoint2(double x[3])
    107     { this->SetPoint2(x[0], x[1], x[2]); }
     108  { this->SetPoint2(x[0], x[1], x[2]); }
    108109  virtual void SetPoint2(double x, double y, double z);
    109110  virtual double *GetPoint2();
     
    155156
    156157  void SetTickLocationToInside(void)
    157     { this->SetTickLocation(VTK_TICKS_INSIDE); };
     158  { this->SetTickLocation(VTK_TICKS_INSIDE); };
    158159  void SetTickLocationToOutside(void)
    159     { this->SetTickLocation(VTK_TICKS_OUTSIDE); };
     160  { this->SetTickLocation(VTK_TICKS_OUTSIDE); };
    160161  void SetTickLocationToBoth(void)
    161     { this->SetTickLocation(VTK_TICKS_BOTH); };
     162  { this->SetTickLocation(VTK_TICKS_BOTH); };
    162163
    163164  // Description:
     
    186187
    187188  // Description:
     189  // Set/Get the axis title text property.
     190  virtual void SetTitleTextProperty(vtkTextProperty *p);
     191  vtkGetObjectMacro(TitleTextProperty,vtkTextProperty);
     192
     193  // Description:
     194  // Set/Get the axis labels text property.
     195  virtual void SetLabelTextProperty(vtkTextProperty *p);
     196  vtkGetObjectMacro(LabelTextProperty,vtkTextProperty);
     197
     198  // Description:
     199  // Get/Set axis actor property (axis and its ticks)
     200  void SetAxisLinesProperty(vtkProperty *);
     201  vtkProperty* GetAxisLinesProperty();
     202
     203  // Description:
     204  // Get/Set gridlines actor property (outer grid lines)
     205  void SetGridlinesProperty(vtkProperty *);
     206  vtkProperty* GetGridlinesProperty();
     207
     208  // Description:
     209  // Get/Set inner gridlines actor property
     210  void SetInnerGridlinesProperty(vtkProperty *);
     211  vtkProperty* GetInnerGridlinesProperty();
     212
     213  // Description:
     214  // Get/Set gridPolys actor property (grid quads)
     215  void SetGridpolysProperty(vtkProperty *);
     216  vtkProperty* GetGridpolysProperty();
     217
     218  // Description:
    188219  // Set/Get whether gridlines should be drawn.
    189220  vtkSetMacro(DrawGridlines, int);
    190221  vtkGetMacro(DrawGridlines, int);
    191222  vtkBooleanMacro(DrawGridlines, int);
     223
     224  // Description:
     225  // Set/Get whether ONLY the gridlines should be drawn.
     226  // This will only draw GridLines and will skip any other part of the rendering
     227  // such as Axis/Tick/Title/...
     228  vtkSetMacro(DrawGridlinesOnly, int);
     229  vtkGetMacro(DrawGridlinesOnly, int);
     230  vtkBooleanMacro(DrawGridlinesOnly, int);
     231
     232  vtkSetMacro(DrawGridlinesLocation, int);
     233  vtkGetMacro(DrawGridlinesLocation, int);
     234
     235  // Description:
     236  // Set/Get whether inner gridlines should be drawn.
     237  vtkSetMacro(DrawInnerGridlines, int);
     238  vtkGetMacro(DrawInnerGridlines, int);
     239  vtkBooleanMacro(DrawInnerGridlines, int);
    192240
    193241  // Description:
     
    199247  vtkSetMacro(GridlineZLength, double);
    200248  vtkGetMacro(GridlineZLength, double);
     249
     250  // Description:
     251  // Set/Get whether gridpolys should be drawn.
     252  vtkSetMacro(DrawGridpolys, int);
     253  vtkGetMacro(DrawGridpolys, int);
     254  vtkBooleanMacro(DrawGridpolys, int);
    201255
    202256  // Description:
     
    219273
    220274  void SetAxisPositionToMinMin(void)
    221       { this->SetAxisPosition(VTK_AXIS_POS_MINMIN); };
     275  { this->SetAxisPosition(VTK_AXIS_POS_MINMIN); };
    222276  void SetAxisPositionToMinMax(void)
    223       { this->SetAxisPosition(VTK_AXIS_POS_MINMAX); };
     277  { this->SetAxisPosition(VTK_AXIS_POS_MINMAX); };
    224278  void SetAxisPositionToMaxMax(void)
    225       { this->SetAxisPosition(VTK_AXIS_POS_MAXMAX); };
     279  { this->SetAxisPosition(VTK_AXIS_POS_MAXMAX); };
    226280  void SetAxisPositionToMaxMin(void)
    227       { this->SetAxisPosition(VTK_AXIS_POS_MAXMIN); };
     281  { this->SetAxisPosition(VTK_AXIS_POS_MAXMIN); };
    228282
    229283  // Description:
     
    236290  // Draw the axis.
    237291  virtual int RenderOpaqueGeometry(vtkViewport* viewport);
    238   virtual int RenderTranslucentGeometry(vtkViewport *) {return 0;}
     292  virtual int RenderTranslucentGeometry(vtkViewport* viewport);
     293  virtual int RenderTranslucentPolygonalGeometry(vtkViewport* viewport);
     294  virtual int RenderOverlay(vtkViewport* viewport);
     295  int HasTranslucentPolygonalGeometry();
    239296
    240297  // Description:
     
    243300  // resources to release.
    244301  void ReleaseGraphicsResources(vtkWindow *);
    245 
    246   // Description:
    247   // Shallow copy of an axis actor. Overloads the virtual vtkProp method.
    248   void ShallowCopy(vtkProp *prop);
    249302
    250303//BTX
     
    255308  void SetTitleScale(const double);
    256309
    257 
    258310  // Description:
    259311  // Set/Get the starting position for minor and major tick points,
     
    261313  vtkSetMacro(MinorStart, double);
    262314  vtkGetMacro(MinorStart, double);
    263   vtkSetMacro(MajorStart, double);
    264   vtkGetMacro(MajorStart, double);
     315  double GetMajorStart(int axis);
     316  void SetMajorStart(int axis,double value);
     317  //vtkSetMacro(MajorStart, double);
     318  //vtkGetMacro(MajorStart, double);
    265319  vtkSetMacro(DeltaMinor, double);
    266320  vtkGetMacro(DeltaMinor, double);
    267   vtkSetMacro(DeltaMajor, double);
    268   vtkGetMacro(DeltaMajor, double);
     321  double GetDeltaMajor(int axis);
     322  void SetDeltaMajor(int axis,double value);
     323  //vtkSetMacro(DeltaMajor, double);
     324  //vtkGetMacro(DeltaMajor, double);
    269325
    270326  // Description:
     
    288344  void BuildAxis(vtkViewport *viewport, bool);
    289345
    290 protected:
     346//BTX
     347  // Description:
     348  // Get title actor and it is responsible for drawing
     349  // title text.
     350  vtkGetObjectMacro(TitleActor,  vtkRpAxisFollower);
     351
     352  // Description:
     353  // Get label actors responsigle for drawing label text.
     354  inline vtkRpAxisFollower** GetLabelActors()
     355    {
     356    return this->LabelActors;
     357    }
     358//ETX
     359
     360  // Description:
     361  // Get total number of labels built. Once built
     362  // this count does not change.
     363  vtkGetMacro(NumberOfLabelsBuilt, int);
     364
     365  // Description:
     366  // Set/Get flag whether to calculate title offset.
     367  // Default is true.
     368  vtkSetMacro(CalculateTitleOffset, int);
     369  vtkGetMacro(CalculateTitleOffset, int);
     370  vtkBooleanMacro(CalculateTitleOffset, int);
     371
     372  // Description:
     373  // Set/Get flag whether to calculate label offset.
     374  // Default is true.
     375  vtkSetMacro(CalculateLabelOffset, int);
     376  vtkGetMacro(CalculateLabelOffset, int);
     377  vtkBooleanMacro(CalculateLabelOffset, int);
     378
     379  // Description:
     380  // Set/Get the 2D mode
     381  vtkSetMacro(Use2DMode, int);
     382  vtkGetMacro(Use2DMode, int);
     383
     384  // Description:
     385  // Set/Get the 2D mode the vertical offset for X title in 2D mode
     386  vtkSetMacro(VerticalOffsetXTitle2D, double);
     387  vtkGetMacro(VerticalOffsetXTitle2D, double);
     388
     389  // Description:
     390  // Set/Get the 2D mode the horizontal offset for Y title in 2D mode
     391  vtkSetMacro(HorizontalOffsetYTitle2D, double);
     392  vtkGetMacro(HorizontalOffsetYTitle2D, double);
     393
     394  // Description:
     395  // Set/Get whether title position must be saved in 2D mode
     396  vtkSetMacro(SaveTitlePosition, int);
     397  vtkGetMacro(SaveTitlePosition, int);
     398
     399  // Description:
     400  // Provide real vector for non aligned axis
     401  vtkSetVector3Macro(AxisBaseForX, double);
     402  vtkGetVector3Macro(AxisBaseForX, double);
     403
     404  // Description:
     405  // Provide real vector for non aligned axis
     406  vtkSetVector3Macro(AxisBaseForY, double);
     407  vtkGetVector3Macro(AxisBaseForY, double);
     408
     409  // Description:
     410  // Provide real vector for non aligned axis
     411  vtkSetVector3Macro(AxisBaseForZ, double);
     412  vtkGetVector3Macro(AxisBaseForZ, double);
     413
     414  // Description:
     415  // Notify the axes that is not part of a cube anymore
     416  vtkSetMacro(AxisOnOrigin,int);
     417  vtkGetMacro(AxisOnOrigin,int);
     418
     419
     420 protected:
    291421  vtkRpAxisActor();
    292422  ~vtkRpAxisActor();
     
    302432
    303433  int    DrawGridlines;
     434  int    DrawGridlinesOnly;
    304435  int    LastDrawGridlines;
    305   double  GridlineXLength;
    306   double  GridlineYLength;
    307   double  GridlineZLength;
     436  int    DrawGridlinesLocation; // 0: all | 1: closest | 2: farest
     437  int    LastDrawGridlinesLocation; // 0: all | 1: closest | 2: farest
     438  double GridlineXLength;
     439  double GridlineYLength;
     440  double GridlineZLength;
     441
     442  int    DrawInnerGridlines;
     443  int    LastDrawInnerGridlines;
     444
     445  int    DrawGridpolys;
     446  int    LastDrawGridpolys;
    308447
    309448  int    AxisVisibility;
     
    317456  double  Bounds[6];
    318457
    319 private:
     458  double AxisBaseForX[3];
     459  double AxisBaseForY[3];
     460  double AxisBaseForZ[3];
     461
     462 private:
    320463  vtkRpAxisActor(const vtkRpAxisActor&); // Not implemented
    321464  void operator=(const vtkRpAxisActor&); // Not implemented
     
    324467
    325468  void BuildLabels(vtkViewport *, bool);
     469  void BuildLabels2D(vtkViewport *, bool);
    326470  void SetLabelPositions(vtkViewport *, bool);
     471  void SetLabelPositions2D(vtkViewport *, bool);
    327472
    328473  void BuildTitle(bool);
     474  void BuildTitle2D(vtkViewport *viewport, bool);
    329475
    330476  void SetAxisPointsAndLines(void);
    331   bool BuildTickPointsForXType(double p1[3], double p2[3], bool);
    332   bool BuildTickPointsForYType(double p1[3], double p2[3], bool);
    333   bool BuildTickPointsForZType(double p1[3], double p2[3], bool);
     477  bool BuildTickPoints(double p1[3], double p2[3], bool force);
    334478
    335479  bool TickVisibilityChanged(void);
     480  vtkProperty *NewTitleProperty();
     481  vtkProperty2D *NewTitleProperty2D();
     482  vtkProperty *NewLabelProperty();
     483
     484  bool BoundsDisplayCoordinateChanged(vtkViewport *viewport);
    336485
    337486  vtkCoordinate *Point1Coordinate;
     
    341490  double  MinorTickSize;
    342491
    343   // for the positions
    344   double  MajorStart;
     492  // For each axis (for the inner gridline generation)
     493  double  MajorStart[3];
     494  double  DeltaMajor[3];
    345495  double  MinorStart;
    346 
    347496  double  DeltaMinor;
    348   double  DeltaMajor;
    349497
    350498  // For the ticks, w.r.t to the set range
     
    357505  int    LastAxisType;
    358506  int    LastTickLocation;
    359   double  LastLabelStart;
     507  double LastLabelStart;
    360508
    361509  vtkPoints         *MinorTickPts;
    362510  vtkPoints         *MajorTickPts;
    363511  vtkPoints         *GridlinePts;
     512  vtkPoints         *InnerGridlinePts;
     513  vtkPoints         *GridpolyPts;
    364514
    365515  vtkVectorText     *TitleVector;
    366516  vtkPolyDataMapper *TitleMapper;
    367   vtkFollower       *TitleActor;
     517  vtkRpAxisFollower *TitleActor;
     518  vtkTextActor      *TitleActor2D;
     519  vtkTextProperty   *TitleTextProperty;
    368520
    369521  vtkVectorText     **LabelVectors;
    370522  vtkPolyDataMapper **LabelMappers;
    371   vtkFollower       **LabelActors;
    372 
    373   vtkPolyData        *Axis;
    374   vtkPolyDataMapper  *AxisMapper;
    375   vtkActor           *AxisActor;
     523  vtkRpAxisFollower **LabelActors;
     524  vtkTextActor      **LabelActors2D;
     525  vtkTextProperty    *LabelTextProperty;
     526
     527  vtkPolyData        *AxisLines;
     528  vtkPolyDataMapper  *AxisLinesMapper;
     529  vtkActor           *AxisLinesActor;
     530  vtkPolyData        *Gridlines;
     531  vtkPolyDataMapper  *GridlinesMapper;
     532  vtkActor           *GridlinesActor;
     533  vtkPolyData        *InnerGridlines;
     534  vtkPolyDataMapper  *InnerGridlinesMapper;
     535  vtkActor           *InnerGridlinesActor;
     536  vtkPolyData        *Gridpolys;
     537  vtkPolyDataMapper  *GridpolysMapper;
     538  vtkActor           *GridpolysActor;
    376539
    377540  vtkCamera          *Camera;
    378541  vtkTimeStamp        BuildTime;
     542  vtkTimeStamp        BuildTickPointsTime;
    379543  vtkTimeStamp        BoundsTime;
    380544  vtkTimeStamp        LabelBuildTime;
    381545  vtkTimeStamp        TitleTextTime;
    382546
     547  int                 AxisOnOrigin;
     548
    383549  int                 AxisHasZeroLength;
     550
     551  int                 CalculateTitleOffset;
     552  int                 CalculateLabelOffset;
     553
     554  // Description:
     555  // Use xy-axis only when Use2DMode=1:
     556  int                 Use2DMode;
     557
     558  // Description:
     559  // Vertical offset in display coordinates for X axis title (used in 2D mode only)
     560  // Default: -40
     561  double              VerticalOffsetXTitle2D;
     562
     563  // Description:
     564  // Vertical offset in display coordinates for X axis title (used in 2D mode only)
     565  // Default: -50
     566  double              HorizontalOffsetYTitle2D;
     567
     568  // Description:
     569  // Save title position (used in 2D mode only):
     570  // val = 0 : no need to save position (doesn't stick actors in a position)
     571  // val = 1 : positions have to be saved during the next render pass
     572  // val = 2 : positions are saved; use them
     573  int                 SaveTitlePosition;
     574
     575  // Description:
     576  // Constant position for the title (used in 2D mode only)
     577  double              TitleConstantPosition[2];
     578
     579  // Description:
     580  // True if the 2D title has to be built, false otherwise
     581  bool                NeedBuild2D;
     582
     583  double              LastMinDisplayCoordinate[3];
     584  double              LastMaxDisplayCoordinate[3];
    384585};
    385586
  • trunk/packages/vizservers/vtkvis/vtkRpCubeAxesActor.cpp

    r2864 r3479  
    1616#include "vtkRpCubeAxesActor.h"
    1717
     18#include "vtkRpAxisActor.h"
     19#include "vtkRpAxisFollower.h"
     20#include "vtkBoundingBox.h"
    1821#include "vtkCamera.h"
    1922#include "vtkCoordinate.h"
    20 #include "vtkRpAxisActor.h"
     23#include "vtkFollower.h"
    2124#include "vtkMath.h"
    2225#include "vtkObjectFactory.h"
    2326#include "vtkProperty.h"
    2427#include "vtkStringArray.h"
     28#include "vtkTextProperty.h"
    2529#include "vtkViewport.h"
    2630
    27 // *************************************************************************
    28 // Modifications:
    29 //   Kathleen Bonnell, Wed Mar  6 13:48:48 PST 2002
    30 //   Replace 'New' method with Macro to match VTK 4.0 API.
    31 //
    32 // *************************************************************************
    3331
    3432vtkStandardNewMacro(vtkRpCubeAxesActor);
    3533vtkCxxSetObjectMacro(vtkRpCubeAxesActor, Camera,vtkCamera);
    36 
    3734// *************************************************************************
    3835// Instantiate this object.
    39 //
    40 // Modifications:
    41 //   Kathleen Bonnell, Wed Oct 31 07:57:49 PST 2001
    42 //   Intialize new members lastPow, last*AxisDigits.
    43 //
    44 //   Kathleen Bonnell, Wed Nov  7 16:19:16 PST 2001
    45 //   Intialize new members:  Last*Extent, LastFlyMode,
    46 //   renderAxes*, numAxes*.
    47 //
    48 //   Hank Childs, Fri Sep 27 17:15:07 PDT 2002
    49 //   Initialize new members for units.
    50 //
    51 //   Kathleen Bonnell, Fri Jul 25 14:37:32 PDT 2003
    52 //   Remove 'Input' and 'Prop' members, initialize new members
    53 //   valueScaleFactor, mustAdjustValue, ForceLabelReset.
    54 //
    55 //   Kathleen Bonnell, Wed Aug  6 13:59:15 PDT 2003
    56 //   Remove valueScaleFactor, replace mustAdjustValue and ForceLabelReset
    57 //   with one for each axis type.
    58 //
    59 //   Kathleen Bonnell, Tue Dec 16 11:27:30 PST 2003
    60 //   Replace Last*Extent with Last*Range.  (* = X, Y, Z)
    61 //   Add AutoLabelScaling, UserXPow, UserYPow, UserZPow.
    62 //
    63 //   Brad Whitlock, Fri Jul 23 18:18:41 PST 2004
    64 //   Added ActualXLabel et al so we can keep title separate from what's
    65 //   actually displayed so information is not lost.
    66 //
    6736// *************************************************************************
    68 
    69 vtkRpCubeAxesActor::vtkRpCubeAxesActor()
     37vtkRpCubeAxesActor::vtkRpCubeAxesActor() : vtkActor()
    7038{
    7139  this->Bounds[0] = -1.0; this->Bounds[1] = 1.0;
    7240  this->Bounds[2] = -1.0; this->Bounds[3] = 1.0;
    7341  this->Bounds[4] = -1.0; this->Bounds[5] = 1.0;
    74 
    75   this->TickLocation = VTK_TICKS_INSIDE;
     42  for(int i=0; i < 6; ++i)
     43    {
     44    this->RenderedBounds[i] = this->Bounds[i];
     45    }
     46
     47  this->OrientedBounds[0] = -1.0; this->OrientedBounds[1] = 1.0;
     48  this->OrientedBounds[2] = -1.0; this->OrientedBounds[3] = 1.0;
     49  this->OrientedBounds[4] = -1.0; this->OrientedBounds[5] = 1.0;
     50
     51  // Disable oriented bounds and Axis origin
     52  this->UseOrientedBounds = this->UseAxisOrigin = 0;
     53
     54  // Init default axis origin
     55  this->AxisOrigin[0] = this->AxisOrigin[1] = this->AxisOrigin[2] = 0.0;
     56
     57  // Init default axis base
     58  this->AxisBaseForX[0] = this->AxisBaseForX[1] = this->AxisBaseForX[2] = 0;
     59  this->AxisBaseForY[0] = this->AxisBaseForY[1] = this->AxisBaseForY[2] = 0;
     60  this->AxisBaseForZ[0] = this->AxisBaseForZ[1] = this->AxisBaseForZ[2] = 0;
     61  this->AxisBaseForX[0] = this->AxisBaseForY[1] = this->AxisBaseForZ[2] = 1.0;
     62
     63  this->RebuildAxes = false;
     64
    7665  this->Camera = NULL;
     66
    7767  this->FlyMode = VTK_FLY_CLOSEST_TRIAD;
    78   int i;
    79   for (i = 0; i < 4; i++)
     68  this->GridLineLocation = VTK_GRID_LINES_ALL;
     69
     70  // By default enable distance based LOD
     71  this->EnableDistanceLOD = 1;
     72  this->DistanceLODThreshold = .8;
     73
     74  // By default enable view angle based LOD
     75  this->EnableViewAngleLOD = 1;
     76  this->ViewAngleLODThreshold = .2;
     77
     78  // Title and label text properties
     79  for (int i = 0; i < 3; i++)
     80    {
     81    this->TitleTextProperty[i] = vtkTextProperty::New();
     82    this->TitleTextProperty[i]->SetColor(1.,1.,1.);
     83    this->TitleTextProperty[i]->SetFontFamilyToArial();
     84    this->TitleTextProperty[i]->SetFontSize(14);
     85
     86    this->LabelTextProperty[i] = vtkTextProperty::New();
     87    this->LabelTextProperty[i]->SetColor(1.,1.,1.);
     88    this->LabelTextProperty[i]->SetFontFamilyToArial();
     89    this->LabelTextProperty[i]->SetFontSize(12);
     90    }
     91
     92  // Axis lines
     93  this->XAxesLinesProperty = vtkProperty::New();
     94  this->YAxesLinesProperty = vtkProperty::New();
     95  this->ZAxesLinesProperty = vtkProperty::New();
     96
     97  // Outer grid lines
     98  this->XAxesGridlinesProperty = vtkProperty::New();
     99  this->YAxesGridlinesProperty = vtkProperty::New();
     100  this->ZAxesGridlinesProperty = vtkProperty::New();
     101
     102  // Inner grid lines
     103  this->XAxesInnerGridlinesProperty = vtkProperty::New();
     104  this->YAxesInnerGridlinesProperty = vtkProperty::New();
     105  this->ZAxesInnerGridlinesProperty = vtkProperty::New();
     106  this->XAxesInnerGridlinesProperty->SetColor(.3,.6,.1);
     107  this->YAxesInnerGridlinesProperty->SetColor(.3,.6,.1);
     108  this->ZAxesInnerGridlinesProperty->SetColor(.3,.6,.1);
     109
     110  this->XAxesGridpolysProperty = vtkProperty::New();
     111  this->YAxesGridpolysProperty = vtkProperty::New();
     112  this->ZAxesGridpolysProperty = vtkProperty::New();
     113  this->XAxesGridpolysProperty->SetOpacity(.6);     // Default grid polys opacity
     114  this->YAxesGridpolysProperty->SetOpacity(.6);     // Default grid polys opacity
     115  this->ZAxesGridpolysProperty->SetOpacity(.6);     // Default grid polys opacity
     116  //this->XAxesGridpolysProperty->LightingOff();       // To be able to see the polys from high camera angles
     117  //this->YAxesGridpolysProperty->LightingOff();       // To be able to see the polys from high camera angles
     118  //this->ZAxesGridpolysProperty->LightingOff();       // To be able to see the polys from high camera angles
     119
     120  for (int i = 0; i < NUMBER_OF_ALIGNED_AXIS; i++)
    80121    {
    81122    this->XAxes[i] = vtkRpAxisActor::New();
     
    86127    this->XAxes[i]->SetAxisTypeToX();
    87128    this->XAxes[i]->SetAxisPosition(i);
     129    this->XAxes[i]->SetAxisLinesProperty(this->XAxesLinesProperty);
     130    this->XAxes[i]->SetGridlinesProperty(this->XAxesGridlinesProperty);
     131    this->XAxes[i]->SetInnerGridlinesProperty(this->XAxesInnerGridlinesProperty);
     132    this->XAxes[i]->SetGridpolysProperty(this->XAxesGridpolysProperty);
     133    this->XAxes[i]->SetCalculateTitleOffset(0);
     134    this->XAxes[i]->SetCalculateLabelOffset(0);
    88135
    89136    this->YAxes[i] = vtkRpAxisActor::New();
     
    94141    this->YAxes[i]->SetAxisTypeToY();
    95142    this->YAxes[i]->SetAxisPosition(i);
     143    this->YAxes[i]->SetAxisLinesProperty(this->YAxesLinesProperty);
     144    this->YAxes[i]->SetGridlinesProperty(this->YAxesGridlinesProperty);
     145    this->YAxes[i]->SetInnerGridlinesProperty(this->YAxesInnerGridlinesProperty);
     146    this->YAxes[i]->SetGridpolysProperty(this->YAxesGridpolysProperty);
     147    this->YAxes[i]->SetCalculateTitleOffset(0);
     148    this->YAxes[i]->SetCalculateLabelOffset(0);
    96149
    97150    this->ZAxes[i] = vtkRpAxisActor::New();
     
    102155    this->ZAxes[i]->SetAxisTypeToZ();
    103156    this->ZAxes[i]->SetAxisPosition(i);
    104     }
    105 
    106   this->XLabelFormat = new char[8];
    107   sprintf(this->XLabelFormat, "%s", "%-#6.3g");
    108   this->YLabelFormat = new char[8];
    109   sprintf(this->YLabelFormat, "%s", "%-#6.3g");
    110   this->ZLabelFormat = new char[8];
    111   sprintf(this->ZLabelFormat, "%s", "%-#6.3g");
    112   this->CornerOffset = 0.0;
    113   this->Inertia = 1;
    114   this->RenderCount = 0;
    115 
    116   this->XAxisVisibility = 1;
    117   this->YAxisVisibility = 1;
    118   this->ZAxisVisibility = 1;
    119 
    120   this->XAxisTickVisibility = 1;
    121   this->YAxisTickVisibility = 1;
    122   this->ZAxisTickVisibility = 1;
    123 
    124   this->XAxisMinorTickVisibility = 1;
    125   this->YAxisMinorTickVisibility = 1;
    126   this->ZAxisMinorTickVisibility = 1;
    127 
    128   this->XAxisLabelVisibility = 1;
    129   this->YAxisLabelVisibility = 1;
    130   this->ZAxisLabelVisibility = 1;
    131 
    132   this->DrawXGridlines = 0;
    133   this->DrawYGridlines = 0;
    134   this->DrawZGridlines = 0;
     157    this->ZAxes[i]->SetAxisLinesProperty(this->ZAxesLinesProperty);
     158    this->ZAxes[i]->SetGridlinesProperty(this->ZAxesGridlinesProperty);
     159    this->ZAxes[i]->SetInnerGridlinesProperty(this->ZAxesInnerGridlinesProperty);
     160    this->ZAxes[i]->SetGridpolysProperty(this->ZAxesGridpolysProperty);
     161    this->ZAxes[i]->SetCalculateTitleOffset(0);
     162    this->ZAxes[i]->SetCalculateLabelOffset(0);
     163
     164    this->ScreenSize = 10.0;
     165
     166    this->LabelScreenOffset = 20.0 + this->ScreenSize * 0.5;
     167    this->TitleScreenOffset =
     168      this->LabelScreenOffset * 2.0 + this->ScreenSize * 0.5;
     169
     170    // Pass information to axes followers.
     171    vtkRpAxisFollower* follower = this->XAxes[i]->GetTitleActor();
     172    follower->SetAxis(this->XAxes[i]);
     173    follower->SetScreenOffset(this->TitleScreenOffset);
     174    follower->SetEnableDistanceLOD( this->EnableDistanceLOD );
     175    follower->SetDistanceLODThreshold( this->DistanceLODThreshold );
     176    follower->SetEnableViewAngleLOD( this->EnableViewAngleLOD );
     177    follower->SetViewAngleLODThreshold( this->ViewAngleLODThreshold );
     178
     179    follower = this->YAxes[i]->GetTitleActor();
     180    follower->SetAxis(this->YAxes[i]);
     181    follower->SetScreenOffset(this->TitleScreenOffset);
     182    follower->SetEnableDistanceLOD( this->EnableDistanceLOD );
     183    follower->SetDistanceLODThreshold( this->DistanceLODThreshold );
     184    follower->SetEnableViewAngleLOD( this->EnableViewAngleLOD );
     185    follower->SetViewAngleLODThreshold( this->ViewAngleLODThreshold );
     186
     187    follower = this->ZAxes[i]->GetTitleActor();
     188    follower->SetAxis(this->ZAxes[i]);
     189    follower->SetScreenOffset(this->TitleScreenOffset);
     190    follower->SetEnableDistanceLOD( this->EnableDistanceLOD );
     191    follower->SetDistanceLODThreshold( this->DistanceLODThreshold );
     192    follower->SetEnableViewAngleLOD( this->EnableViewAngleLOD );
     193    follower->SetViewAngleLODThreshold( this->ViewAngleLODThreshold );
     194    }
    135195
    136196  this->XTitle = new char[7];
     
    148208  this->ActualZLabel = 0;
    149209
     210  this->TickLocation = VTK_TICKS_INSIDE;
     211
     212  this->XAxisVisibility = 1;
     213  this->YAxisVisibility = 1;
     214  this->ZAxisVisibility = 1;
     215
     216  this->XAxisTickVisibility = 1;
     217  this->YAxisTickVisibility = 1;
     218  this->ZAxisTickVisibility = 1;
     219
     220  this->XAxisMinorTickVisibility = 1;
     221  this->YAxisMinorTickVisibility = 1;
     222  this->ZAxisMinorTickVisibility = 1;
     223
     224  this->XAxisLabelVisibility = 1;
     225  this->YAxisLabelVisibility = 1;
     226  this->ZAxisLabelVisibility = 1;
     227
     228  this->DrawXGridlines = 0;
     229  this->DrawYGridlines = 0;
     230  this->DrawZGridlines = 0;
     231
     232  this->DrawXInnerGridlines = 0;
     233  this->DrawYInnerGridlines = 0;
     234  this->DrawZInnerGridlines = 0;
     235
     236  this->DrawXGridpolys = 0;
     237  this->DrawYGridpolys = 0;
     238  this->DrawZGridpolys = 0;
     239
     240  this->XLabelFormat = new char[8];
     241  sprintf(this->XLabelFormat, "%s", "%-#6.3g");
     242  this->YLabelFormat = new char[8];
     243  sprintf(this->YLabelFormat, "%s", "%-#6.3g");
     244  this->ZLabelFormat = new char[8];
     245  sprintf(this->ZLabelFormat, "%s", "%-#6.3g");
     246
     247  this->XAutoLabelFormat = 1;
     248  this->YAutoLabelFormat = 1;
     249  this->ZAutoLabelFormat = 1;
     250
     251  this->CornerOffset = 0.0;
     252
     253  this->Inertia = 1;
     254
     255  this->RenderCount = 0;
     256
     257  this->InertiaLocs[0] = this->InertiaLocs[1] = this->InertiaLocs[2] = -1;
     258
     259  this->RenderSomething = 0;
     260
     261  this->LastUseOrientedBounds = 0;
     262
    150263  this->LastXPow = 0;
    151264  this->LastYPow = 0;
    152265  this->LastZPow = 0;
     266
     267  this->UserXPow = 0;
     268  this->UserYPow = 0;
     269  this->UserZPow = 0;
     270
     271  this->AutoLabelScaling = true;
     272
    153273  this->LastXAxisDigits = 3;
    154274  this->LastYAxisDigits = 3;
     
    162282  this->LastZRange[1] = VTK_FLOAT_MAX;
    163283
     284  this->LastBounds[0] = VTK_DOUBLE_MAX;
     285  this->LastBounds[1] = VTK_DOUBLE_MAX;
     286  this->LastBounds[2] = VTK_DOUBLE_MAX;
     287  this->LastBounds[3] = VTK_DOUBLE_MAX;
     288  this->LastBounds[4] = VTK_DOUBLE_MAX;
     289  this->LastBounds[5] = VTK_DOUBLE_MAX;
     290
    164291  this->LastFlyMode = -1;
    165   for (i = 0; i < 4; i++)
     292
     293  for (int i = 0; i < NUMBER_OF_ALIGNED_AXIS; i++)
    166294    {
    167295    this->RenderAxesX[i] = i;
     
    178306  this->ForceYLabelReset = false;
    179307  this->ForceZLabelReset = false;
    180 
    181   this->AutoLabelScaling = true;
    182   this->UserXPow = 0;
    183   this->UserYPow = 0;
    184   this->UserZPow = 0;
    185308
    186309  this->XAxisRange[0] = VTK_DOUBLE_MAX;
     
    190313  this->ZAxisRange[0] = VTK_DOUBLE_MAX;
    191314  this->ZAxisRange[1] = VTK_DOUBLE_MAX;
     315
     316  for (int i = 0; i < 3; ++i)
     317    {
     318    this->AxisLabels[i] = NULL;
     319    }
     320  this->LabelScale = -1.0;
     321  this->TitleScale = -1.0;
     322}
     323
     324void vtkRpCubeAxesActor::SetUse2DMode( int val )
     325{
     326  for( int i = 0 ; i < NUMBER_OF_ALIGNED_AXIS ; ++ i )
     327    {
     328    this->XAxes[i]->SetUse2DMode( val );
     329    this->YAxes[i]->SetUse2DMode( val );
     330    this->ZAxes[i]->SetUse2DMode( val );
     331    }
     332  if( ! val )
     333    {
     334    this->SetZAxisVisibility( 1 );
     335    }
     336  else
     337    {
     338    this->SetZAxisVisibility( 0 );
     339    }
     340}
     341
     342int vtkRpCubeAxesActor::GetUse2DMode()
     343{
     344  // It is assumed that all axes have the same value
     345  return this->XAxes[0]->GetUse2DMode();
     346}
     347
     348void vtkRpCubeAxesActor::SetSaveTitlePosition( int val )
     349{
     350  // For 2D mode only :
     351  //   val = 0: no need to save position (3D axis)
     352  //   val = 1: positions have to be saved during the next render pass
     353  //   val = 2: positions are saved -> use them
     354  for( int i = 0 ; i < NUMBER_OF_ALIGNED_AXIS ; ++ i )
     355    {
     356    this->XAxes[i]->SetSaveTitlePosition( val );
     357    this->YAxes[i]->SetSaveTitlePosition( val );
     358    }
    192359}
    193360
    194361// ****************************************************************************
    195 // Shallow copy of an actor.
    196 //
    197 // Modifications:
    198 //   Kathleen Bonnell, Wed Mar  6 13:48:48 PST 2002
    199 //   Call superclass method the new VTK 4.0 way.
    200 //
    201 //   Kathleen Bonnell, Fri Jul 25 14:37:32 PDT 2003
    202 //   Remove 'Input' and 'Prop' members, added new members
    203 //   valueScaleFactor, mustAdjustValue, ForceLabelReset.
    204 //
    205 //   Kathleen Bonnell, Wed Aug  6 13:59:15 PDT 2003
    206 //   Remove valueScaleFactor, replace mustAdjustValue and ForceLabelReset
    207 //   with one for each axis type.
    208 //
    209 // ****************************************************************************
    210 
    211 void vtkRpCubeAxesActor::ShallowCopy(vtkRpCubeAxesActor *actor)
    212 {
    213   this->Superclass::ShallowCopy(actor);
    214   this->SetXLabelFormat(actor->GetXLabelFormat());
    215   this->SetYLabelFormat(actor->GetYLabelFormat());
    216   this->SetZLabelFormat(actor->GetZLabelFormat());
    217   this->SetCornerOffset(actor->GetCornerOffset());
    218   this->SetInertia(actor->GetInertia());
    219   this->SetXTitle(actor->GetXTitle());
    220   this->SetYTitle(actor->GetYTitle());
    221   this->SetZTitle(actor->GetZTitle());
    222   this->SetFlyMode(actor->GetFlyMode());
    223   this->SetCamera(actor->GetCamera());
    224   this->SetBounds(actor->GetBounds());
    225   this->MustAdjustXValue = actor->MustAdjustXValue;
    226   this->MustAdjustYValue = actor->MustAdjustYValue;
    227   this->MustAdjustZValue = actor->MustAdjustZValue;
    228   this->ForceXLabelReset = actor->ForceXLabelReset;
    229   this->ForceYLabelReset = actor->ForceYLabelReset;
    230   this->ForceZLabelReset = actor->ForceZLabelReset;
    231 }
    232 
    233 // ****************************************************************************
    234 //  Modifications:
    235 //
    236 //    Hank Childs, Fri Sep 27 17:15:07 PDT 2002
    237 //    Destruct new data members for units.
    238 //
    239 //    Brad Whitlock, Fri Jul 23 18:21:16 PST 2004
    240 //    Added more items and fixed a small memory leak.
    241 //
    242 // ****************************************************************************
    243 
    244362vtkRpCubeAxesActor::~vtkRpCubeAxesActor()
    245363{
    246364  this->SetCamera(NULL);
    247365
    248   for (int i = 0; i < 4; i++)
     366  for (int i = 0; i < NUMBER_OF_ALIGNED_AXIS; i++)
    249367    {
    250368    if (this->XAxes[i])
     
    263381      this->ZAxes[i] = NULL;
    264382      }
     383    }
     384
     385  if (this->XAxesLinesProperty)
     386    {
     387    this->XAxesLinesProperty->Delete();
     388    }
     389  if (this->XAxesGridlinesProperty)
     390    {
     391    this->XAxesGridlinesProperty->Delete();
     392    }
     393  if (this->XAxesInnerGridlinesProperty)
     394    {
     395    this->XAxesInnerGridlinesProperty->Delete();
     396    }
     397  if (this->XAxesGridpolysProperty)
     398    {
     399    this->XAxesGridpolysProperty->Delete();
     400    }
     401  if (this->YAxesLinesProperty)
     402    {
     403    this->YAxesLinesProperty->Delete();
     404    }
     405  if (this->YAxesGridlinesProperty)
     406    {
     407    this->YAxesGridlinesProperty->Delete();
     408    }
     409  if (this->YAxesInnerGridlinesProperty)
     410    {
     411    this->YAxesInnerGridlinesProperty->Delete();
     412    }
     413  if (this->YAxesGridpolysProperty)
     414    {
     415    this->YAxesGridpolysProperty->Delete();
     416    }
     417  if (this->ZAxesLinesProperty)
     418    {
     419    this->ZAxesLinesProperty->Delete();
     420    }
     421  if (this->ZAxesGridlinesProperty)
     422    {
     423    this->ZAxesGridlinesProperty->Delete();
     424    }
     425  if (this->ZAxesInnerGridlinesProperty)
     426    {
     427    this->ZAxesInnerGridlinesProperty->Delete();
     428    }
     429  if (this->ZAxesGridpolysProperty)
     430    {
     431    this->ZAxesGridpolysProperty->Delete();
     432    }
     433
     434  for (int i = 0; i < 3; i++)
     435    {
     436    if(this->TitleTextProperty[i] != NULL)
     437      {
     438      this->TitleTextProperty[i]->Delete();
     439      }
     440    this->TitleTextProperty[i] = NULL;
     441
     442    if(this->LabelTextProperty[i] != NULL)
     443      {
     444      this->LabelTextProperty[i]->Delete();
     445      }
     446    this->LabelTextProperty[i] = NULL;
    265447    }
    266448
     
    336518// cube. Determine which parts of the edges are visible via intersection
    337519// with the boundary of the viewport (minus borders).
    338 //
    339 //  Modifications:
    340 //    Kathleen Bonnell, Wed Oct 31 07:57:49 PST 2001
    341 //    Added calls to AdjustValues, AdjustRange.
    342 //
    343 //   Kathleen Bonnell, Wed Nov  7 16:19:16 PST 2001
    344 //   Only render those axes needed for current FlyMode.
    345 //   Moved bulk of 'build' code to BuildAxes method, added calls to
    346 //   BuildAxes and DetermineRenderAxes methods.
    347 //
    348 //   Kathleen Bonnell, Fri Jul 25 14:37:32 PDT 2003
    349 //   Added initial build of each axis.
    350520// *************************************************************************
    351 
    352521int vtkRpCubeAxesActor::RenderOpaqueGeometry(vtkViewport *viewport)
    353522{
    354   int i, renderedSomething=0;
    355523  static bool initialRender = true;
    356   // Initialization
    357   if (!this->Camera)
    358     {
    359     vtkErrorMacro(<<"No camera!");
    360     this->RenderSomething = 0;
    361     return 0;
    362     }
    363 
    364   this->BuildAxes(viewport);
    365 
    366   if (initialRender)
    367     {
    368     for (i = 0; i < 4; i++)
    369       {
    370       this->XAxes[i]->BuildAxis(viewport, true);
    371       this->YAxes[i]->BuildAxis(viewport, true);
    372       this->ZAxes[i]->BuildAxis(viewport, true);
    373       }
    374     }
    375   initialRender = false;
    376 
    377   this->DetermineRenderAxes(viewport);
    378 
    379   //Render the axes
    380   if (this->XAxisVisibility)
    381     {
    382     for (i = 0; i < this->NumberOfAxesX; i++)
    383       {
    384       renderedSomething +=
    385         this->XAxes[this->RenderAxesX[i]]->RenderOpaqueGeometry(viewport);
    386       }
    387     }
    388 
    389   if (this->YAxisVisibility)
    390     {
    391     for (i = 0; i < this->NumberOfAxesY; i++)
    392       {
    393       renderedSomething +=
    394         this->YAxes[this->RenderAxesY[i]]->RenderOpaqueGeometry(viewport);
    395       }
    396     }
    397 
    398   if (this->ZAxisVisibility)
    399     {
    400     for (i = 0; i < this->NumberOfAxesZ; i++)
    401       {
    402       renderedSomething +=
    403         this->ZAxes[this->RenderAxesZ[i]]->RenderOpaqueGeometry(viewport);
    404       }
    405     }
    406   return renderedSomething;
    407 }
    408 
     524  return this->RenderGeometry(
     525        initialRender, viewport, true,
     526        &vtkRpAxisActor::RenderOpaqueGeometry);
     527}
     528
     529// *************************************************************************
     530// Project the bounding box and compute edges on the border of the bounding
     531// cube. Determine which parts of the edges are visible via intersection
     532// with the boundary of the viewport (minus borders).
     533// *************************************************************************
     534int vtkRpCubeAxesActor::RenderTranslucentGeometry(vtkViewport *viewport)
     535{
     536  static bool initialRender = true;
     537  return this->RenderGeometry(
     538        initialRender, viewport, true,
     539        &vtkRpAxisActor::RenderTranslucentGeometry);
     540}
     541
     542// *************************************************************************
     543// Project the bounding box and compute edges on the border of the bounding
     544// cube. Determine which parts of the edges are visible via intersection
     545// with the boundary of the viewport (minus borders).
     546// *************************************************************************
     547int vtkRpCubeAxesActor::RenderTranslucentPolygonalGeometry(vtkViewport *viewport)
     548{
     549  static bool initialRender = true;
     550  return this->RenderGeometry(
     551        initialRender, viewport, true,
     552        &vtkRpAxisActor::RenderTranslucentPolygonalGeometry);
     553}
     554
     555// *************************************************************************
     556// RenderOverlay : render 2D annotations.
     557// *************************************************************************
     558int vtkRpCubeAxesActor::RenderOverlay(vtkViewport *viewport)
     559{
     560  static bool initialRender = true;
     561  return this->RenderGeometry(
     562        initialRender, viewport, false,
     563        &vtkRpAxisActor::RenderOverlay);
     564}
     565
     566// --------------------------------------------------------------------------
     567int vtkRpCubeAxesActor::HasTranslucentPolygonalGeometry()
     568{
     569  if ((this->NumberOfAxesX > 0 &&
     570       this->XAxes[0]->HasTranslucentPolygonalGeometry()) ||
     571      (this->NumberOfAxesY > 0 &&
     572       this->YAxes[0]->HasTranslucentPolygonalGeometry()) ||
     573      (this->NumberOfAxesZ > 0 &&
     574       this->ZAxes[0]->HasTranslucentPolygonalGeometry()))
     575    {
     576    return 1;
     577    }
     578
     579  return 0;
     580}
     581
     582// --------------------------------------------------------------------------
    409583// Do final adjustment of axes to control offset, etc.
    410 void vtkRpCubeAxesActor::AdjustAxes(double bounds[6], double xCoords[4][6],
    411                                   double yCoords[4][6], double zCoords[4][6],
     584void vtkRpCubeAxesActor::AdjustAxes(double bounds[6],
     585                                  double xCoords[NUMBER_OF_ALIGNED_AXIS][6],
     586                                  double yCoords[NUMBER_OF_ALIGNED_AXIS][6],
     587                                  double zCoords[NUMBER_OF_ALIGNED_AXIS][6],
    412588                                  double xRange[2], double yRange[2],
    413589                                  double zRange[2])
     
    433609  if (this->CornerOffset > 0.0)
    434610    {
    435     for (int i = 0; i < 4; i++)
     611    for (int i = 0; i < NUMBER_OF_ALIGNED_AXIS; i++)
    436612      {
    437613      double ave;
     
    491667}
    492668
     669// *************************************************************************
     670// Screen size affects the screen offset as well.
     671// *************************************************************************
     672void vtkRpCubeAxesActor::SetScreenSize(double screenSize)
     673{
     674  this->ScreenSize = screenSize;
     675// Considering pivot point at center of the geometry hence (this->ScreenSize * 0.5).
     676  this->LabelScreenOffset = 20.0 + this->ScreenSize * 0.5;
     677  this->TitleScreenOffset = this->LabelScreenOffset * 2.0 +
     678    this->ScreenSize * 0.5;
     679
     680  for (int i = 0; i < NUMBER_OF_ALIGNED_AXIS; i++)
     681    {
     682    this->XAxes[i]->GetTitleActor()->SetScreenOffset(this->TitleScreenOffset);
     683    this->YAxes[i]->GetTitleActor()->SetScreenOffset(this->TitleScreenOffset);
     684    this->ZAxes[i]->GetTitleActor()->SetScreenOffset(this->TitleScreenOffset);
     685
     686    int numberOfLabelsBuild = this->XAxes[i]->GetNumberOfLabelsBuilt();
     687    vtkRpAxisFollower **labelActors = this->XAxes[i]->GetLabelActors();
     688    for(int k=0; k < numberOfLabelsBuild; ++k)
     689      {
     690      labelActors[k]->SetScreenOffset(this->LabelScreenOffset);
     691      }
     692
     693    numberOfLabelsBuild = this->YAxes[i]->GetNumberOfLabelsBuilt();
     694    labelActors = this->YAxes[i]->GetLabelActors();
     695    for(int k=0; k < numberOfLabelsBuild; ++k)
     696      {
     697      labelActors[k]->SetScreenOffset(this->LabelScreenOffset);
     698      }
     699
     700    numberOfLabelsBuild = this->ZAxes[i]->GetNumberOfLabelsBuilt();
     701    labelActors = this->ZAxes[i]->GetLabelActors();
     702    for(int k=0; k < numberOfLabelsBuild; ++k)
     703      {
     704      labelActors[k]->SetScreenOffset(this->LabelScreenOffset);
     705      }
     706    }
     707
     708  this->Modified();
     709}
     710
     711// *************************************************************************
    493712// Release any graphics resources that are being consumed by this actor.
    494713// The parameter window could be used to determine which graphic
    495714// resources to release.
     715// *************************************************************************
    496716void vtkRpCubeAxesActor::ReleaseGraphicsResources(vtkWindow *win)
    497717{
    498   for (int i = 0; i < 4; i++)
     718  for (int i = 0; i < NUMBER_OF_ALIGNED_AXIS; i++)
    499719    {
    500720    this->XAxes[i]->ReleaseGraphicsResources(win);
     
    504724}
    505725
    506 // *************************************************************************
    507 // Compute the bounds
    508 //
    509 // Modifications:
    510 //   Kathleen Bonnell, Fri Jul 25 14:37:32 PDT 2003
    511 //   Removed support for Prop and Input.
    512 // *************************************************************************
    513 void vtkRpCubeAxesActor::GetBounds(double bounds[6])
    514 {
    515   for (int i=0; i< 6; i++)
    516     {
    517     bounds[i] = this->Bounds[i];
    518     }
    519 }
    520 
    521 // Compute the bounds
    522 void vtkRpCubeAxesActor::GetBounds(double& xmin, double& xmax,
    523                                  double& ymin, double& ymax,
    524                                  double& zmin, double& zmax)
    525 {
    526   xmin = this->Bounds[0];
    527   xmax = this->Bounds[1];
    528   ymin = this->Bounds[2];
    529   ymax = this->Bounds[3];
    530   zmin = this->Bounds[4];
    531   zmax = this->Bounds[5];
    532 }
    533 
    534 // Compute the bounds
    535 double *vtkRpCubeAxesActor::GetBounds()
    536 {
    537   return this->Bounds;
    538 }
    539 
    540726// ******************************************************************
    541 // Modifications:
    542 //   Kathleen Bonnell, Wed Mar  6 13:48:48 PST 2002
    543 //   Call superclass method the new VTK 4.0 way.
    544 //
    545 //   Kathleen Bonnell, Fri Jul 25 14:37:32 PDT 2003
    546 //   Removed Input and Prop.
    547 //
    548 // ******************************************************************
    549 
    550727void vtkRpCubeAxesActor::PrintSelf(ostream& os, vtkIndent indent)
    551728{
     
    554731  os << indent << "Bounds: \n";
    555732  os << indent << "  Xmin,Xmax: (" << this->Bounds[0] << ", "
    556      << this->Bounds[1] << ")\n";
     733     << this->Bounds[1] << ")" << endl;
    557734  os << indent << "  Ymin,Ymax: (" << this->Bounds[2] << ", "
    558      << this->Bounds[3] << ")\n";
     735     << this->Bounds[3] << ")" << endl;
    559736  os << indent << "  Zmin,Zmax: (" << this->Bounds[4] << ", "
    560      << this->Bounds[5] << ")\n";
     737     << this->Bounds[5] << ")" << endl;
    561738
    562739
     
    568745    << this->ZAxisRange[1] << "] " << endl;
    569746
     747  os << indent << "ScreenSize: (" << this->ScreenSize << ")" << endl;
     748
    570749  if (this->Camera)
    571750    {
     
    578757    }
    579758
     759  os << indent << "RebuildAxes: " << this->RebuildAxes << endl;
     760
    580761  if (this->FlyMode == VTK_FLY_CLOSEST_TRIAD)
    581762    {
    582     os << indent << "Fly Mode: CLOSEST_TRIAD\n";
     763    os << indent << "Fly Mode: CLOSEST_TRIAD"<< endl;
    583764    }
    584765  else if (this->FlyMode == VTK_FLY_FURTHEST_TRIAD)
    585766    {
    586     os << indent << "Fly Mode: FURTHEST_TRIAD\n";
     767    os << indent << "Fly Mode: FURTHEST_TRIAD"<< endl;
    587768    }
    588769  else if (this->FlyMode == VTK_FLY_STATIC_TRIAD)
    589770    {
    590     os << indent << "Fly Mode: STATIC_TRIAD\n";
     771    os << indent << "Fly Mode: STATIC_TRIAD"<< endl;
    591772    }
    592773  else if (this->FlyMode == VTK_FLY_STATIC_EDGES)
    593774    {
    594     os << indent << "Fly Mode: STATIC_EDGES\n";
     775    os << indent << "Fly Mode: STATIC_EDGES"<< endl;
    595776    }
    596777  else
    597778    {
    598     os << indent << "Fly Mode: OUTER_EDGES\n";
    599     }
    600 
    601   os << indent << "X Axis Title: " << this->XTitle << "\n";
    602   os << indent << "Y Axis Title: " << this->YTitle << "\n";
    603   os << indent << "Z Axis Title: " << this->ZTitle << "\n";
     779    os << indent << "Fly Mode: OUTER_EDGES"<< endl;
     780    }
     781
     782  os << indent << "EnableDistanceLOD: "
     783     << ( this->EnableDistanceLOD ? "On" : "Off" ) << endl;
     784  os << indent << "DistanceLODThreshold: "   << this->DistanceLODThreshold << endl;
     785
     786  os << indent << "EnableViewAngleLOD: "
     787     << ( this->EnableViewAngleLOD ? "On" : "Off" ) << endl;
     788  os << indent << "ViewAngleLODThreshold: "   << this->ViewAngleLODThreshold << endl;
     789
     790  os << indent << "X Axis Title: " << this->XTitle << endl;
     791  os << indent << "Y Axis Title: " << this->YTitle << endl;
     792  os << indent << "Z Axis Title: " << this->ZTitle << endl;
    604793
    605794  os << indent << "X Axis Visibility: "
     
    610799     << (this->ZAxisVisibility ? "On\n" : "Off\n");
    611800
    612   os << indent << "X Axis Label Format: " << this->XLabelFormat << "\n";
    613   os << indent << "Y Axis Label Format: " << this->YLabelFormat << "\n";
    614   os << indent << "Z Axis Label Format: " << this->ZLabelFormat << "\n";
    615   os << indent << "Inertia: " << this->Inertia << "\n";
    616   os << indent << "Corner Offset: " << this->CornerOffset << "\n";
     801  os << indent << "X Axis Label Format: " << this->XLabelFormat << endl;
     802  os << indent << "Y Axis Label Format: " << this->YLabelFormat << endl;
     803  os << indent << "Z Axis Label Format: " << this->ZLabelFormat << endl;
     804
     805  os << indent << "XAutoLabelFormat: "
     806     << (this->XAutoLabelFormat ? "On" : "Off") << endl;
     807  os << indent << "YAutoLabelFormat: "
     808     << (this->YAutoLabelFormat ? "On" : "Off") << endl;
     809  os << indent << "ZAutoLabelFormat: "
     810     << (this->ZAutoLabelFormat ? "On" : "Off") << endl;
     811
     812  os << indent << "Inertia: " << this->Inertia << endl;
     813  os << indent << "Corner Offset: " << this->CornerOffset << endl;
    617814
    618815  os << indent << "XAxisTickVisibility: "
     
    649846  os << indent << "DrawYGridlines: " << this->DrawYGridlines << endl;
    650847  os << indent << "DrawZGridlines: " << this->DrawZGridlines << endl;
    651 }
    652 
     848
     849  switch(this->GridLineLocation)
     850    {
     851  case VTK_GRID_LINES_ALL:
     852    os << indent << "GridLineLocation: VTK_GRID_LINES_ALL (0)" << endl;
     853    break;
     854  case VTK_GRID_LINES_CLOSEST:
     855    os << indent << "GridLineLocation: VTK_GRID_LINES_CLOSEST (1)" << endl;
     856    break;
     857  case VTK_GRID_LINES_FURTHEST:
     858    os << indent << "GridLineLocation: VTK_GRID_LINES_FURTHEST (2)" << endl;
     859    break;
     860    }
     861
     862  os << indent << "DrawXInnerGridlines: " << this->DrawXInnerGridlines << endl;
     863  os << indent << "DrawYInnerGridlines: " << this->DrawYInnerGridlines << endl;
     864  os << indent << "DrawZInnerGridlines: " << this->DrawZInnerGridlines << endl;
     865
     866  os << indent << "DrawXGridpolys: " << this->DrawXGridpolys << endl;
     867  os << indent << "DrawYGridpolys: " << this->DrawYGridpolys << endl;
     868  os << indent << "DrawZGridpolys: " << this->DrawZGridpolys << endl;
     869
     870
     871  os << indent << "UseOrientedBounds: " << this->UseOrientedBounds << endl;
     872  if(this->UseOrientedBounds)
     873    {
     874    os << indent << "OrientedBounds: \n";
     875    os << indent << "  Xmin,Xmax: (" << this->OrientedBounds[0] << ", "
     876       << this->OrientedBounds[1] << ")" << endl;
     877    os << indent << "  Ymin,Ymax: (" << this->OrientedBounds[2] << ", "
     878       << this->OrientedBounds[3] << ")" << endl;
     879    os << indent << "  Zmin,Zmax: (" << this->OrientedBounds[4] << ", "
     880       << this->OrientedBounds[5] << ")" << endl;
     881    }
     882
     883  os << indent << "Base: \n";
     884  os << indent << "  For X: (" << this->AxisBaseForX[0] << ", "
     885     << this->AxisBaseForX[1] << ", " << this->AxisBaseForX[2] << ")" << endl;
     886  os << indent << "  For Y: (" << this->AxisBaseForY[0] << ", "
     887     << this->AxisBaseForY[1] << ", " << this->AxisBaseForY[2] << ")" << endl;
     888  os << indent << "  For Z: (" << this->AxisBaseForZ[0] << ", "
     889     << this->AxisBaseForZ[1] << ", " << this->AxisBaseForZ[2] << ")" << endl;
     890
     891  os << indent << "UseAxisOrigin: " << this->UseAxisOrigin << endl;
     892  if(this->UseAxisOrigin)
     893    {
     894    os << indent << "AxisOrigin: (" << this->AxisOrigin[0] << ", "
     895       << this->AxisOrigin[1] << ", " << this->AxisOrigin[2] << ")" << endl;
     896    }
     897}
     898
     899// --------------------------------------------------------------------------
    653900void vtkRpCubeAxesActor::TransformBounds(vtkViewport *viewport,
    654901                                       const double bounds[6],
    655902                                       double pts[8][3])
    656903{
    657   int i, j, k, idx;
    658904  double x[3];
    659905
    660906  //loop over verts of bounding box
    661   for (k=0; k<2; k++)
    662     {
    663     x[2] = bounds[4+k];
    664     for (j=0; j<2; j++)
    665       {
    666       x[1] = bounds[2+j];
    667       for (i=0; i<2; i++)
     907  for ( int k = 0; k < 2; ++ k )
     908    {
     909    x[2] = bounds[4 + k];
     910    for ( int j = 0; j < 2; ++ j )
     911      {
     912      x[1] = bounds[2 + j];
     913      for ( int i = 0; i < 2; ++ i )
    668914        {
    669         idx = i + 2*j + 4*k;
     915        int idx = i + 2 * j + 4 * k;
    670916        x[0] = bounds[i];
    671         viewport->SetWorldPoint(x[0],x[1],x[2],1.0);
     917        viewport->SetWorldPoint( x[0], x[1], x[2], 1. );
    672918        viewport->WorldToDisplay();
    673         viewport->GetDisplayPoint(pts[idx]);
     919        viewport->GetDisplayPoint( pts[idx] );
    674920        }
    675921      }
     
    678924
    679925// ***********************************************************************
    680 //
    681926//  Calculate the size (length) of major and minor ticks,
    682927//  based on an average of the coordinate direction ranges.
     
    684929//
    685930//  Returns:  false if tick size not recomputed, true otherwise.
    686 //
    687 //  Modifications:
    688 //    Kathleen Bonnell, Wed Nov  7 16:19:16 PST 2001
    689 //    Added logic for early-termination.
    690 //
    691 //    Kathleen Bonnell, Fri Jul 18 09:09:31 PDT 2003
    692 //    Added return value, added calls to AdjustTicksComputeRange and
    693 //    BuildLabels.
    694 //
    695 //    Kathleen Bonnell, Mon Dec 15 14:59:26 PST 2003
    696 //    Use the actual range values instead of range-extents to determine
    697 //    if tick size needs to be recomputed.
    698 //
    699931// ***********************************************************************
    700 
    701932bool vtkRpCubeAxesActor::ComputeTickSize(double bounds[6])
    702933{
    703   bool xRangeChanged = this->LastXRange[0] != bounds[0] ||
    704                        this->LastXRange[1] != bounds[1];
    705 
    706   bool yRangeChanged = this->LastYRange[0] != bounds[2] ||
    707                        this->LastYRange[1] != bounds[3];
    708 
    709   bool zRangeChanged = this->LastZRange[0] != bounds[4] ||
    710                        this->LastZRange[1] != bounds[5];
    711 
    712   if (!(xRangeChanged || yRangeChanged || zRangeChanged))
     934  bool xPropsChanged = this->LabelTextProperty[0]->GetMTime() > this->BuildTime.GetMTime();
     935  bool yPropsChanged = this->LabelTextProperty[1]->GetMTime() > this->BuildTime.GetMTime();
     936  bool zPropsChanged = this->LabelTextProperty[2]->GetMTime() > this->BuildTime.GetMTime();
     937
     938  bool xRangeChanged = this->LastXRange[0] != this->XAxisRange[0] ||
     939                       this->LastXRange[1] != this->XAxisRange[1];
     940
     941  bool yRangeChanged = this->LastYRange[0] != this->YAxisRange[0] ||
     942                       this->LastYRange[1] != this->YAxisRange[1];
     943
     944  bool zRangeChanged = this->LastZRange[0] != this->ZAxisRange[0] ||
     945                       this->LastZRange[1] != this->ZAxisRange[1];
     946
     947  bool boundsChanged = this->LastBounds[0] != bounds[0] ||
     948                       this->LastBounds[1] != bounds[1] ||
     949                       this->LastBounds[2] != bounds[2] ||
     950                       this->LastBounds[3] != bounds[3] ||
     951                       this->LastBounds[4] != bounds[4] ||
     952                       this->LastBounds[5] != bounds[5];
     953
     954  if (!(xRangeChanged || yRangeChanged || zRangeChanged) &&
     955      !(xPropsChanged || yPropsChanged || zPropsChanged || boundsChanged))
    713956    {
    714957    // no need to re-compute ticksize.
     
    716959    }
    717960
    718   int i;
    719961  double xExt = bounds[1] - bounds[0];
    720962  double yExt = bounds[3] - bounds[2];
    721963  double zExt = bounds[5] - bounds[4];
    722964
    723   if (xRangeChanged)
     965  if (xRangeChanged || boundsChanged)
    724966    {
    725967    this->AdjustTicksComputeRange(this->XAxes, bounds[0], bounds[1]);
    726968    this->BuildLabels(this->XAxes);
    727     }
    728   if (yRangeChanged)
     969    this->UpdateLabels(this->XAxes, 0);
     970    }
     971  if (yRangeChanged || boundsChanged)
    729972    {
    730973    this->AdjustTicksComputeRange(this->YAxes, bounds[2], bounds[3]);
    731974    this->BuildLabels(this->YAxes);
    732     }
    733   if (zRangeChanged)
     975    this->UpdateLabels(this->YAxes, 1);
     976    }
     977  if (zRangeChanged || boundsChanged)
    734978    {
    735979    this->AdjustTicksComputeRange(this->ZAxes, bounds[4], bounds[5]);
    736980    this->BuildLabels(this->ZAxes);
     981    this->UpdateLabels(this->ZAxes, 2);
     982    }
     983
     984  // We give information on deltas for the inner grid lines generation
     985  for(int i = 0 ; i < NUMBER_OF_ALIGNED_AXIS ; i++)
     986    {
     987    for(int j = 0 ; j < 3 ; j++)
     988      {
     989      this->XAxes[i]->SetMajorStart(j,this->MajorStart[j]);
     990      this->XAxes[i]->SetDeltaMajor(j,this->DeltaMajor[j]);
     991      this->YAxes[i]->SetMajorStart(j,this->MajorStart[j]);
     992      this->YAxes[i]->SetDeltaMajor(j,this->DeltaMajor[j]);
     993      this->ZAxes[i]->SetMajorStart(j,this->MajorStart[j]);
     994      this->ZAxes[i]->SetDeltaMajor(j,this->DeltaMajor[j]);
     995      }
    737996    }
    738997
     
    7491008  this->LastZRange[1] = (this->ZAxisRange[1] == VTK_DOUBLE_MAX ?
    7501009                                  bounds[5] : this->ZAxisRange[1]);
     1010  for(int i=0; i < 6; i++)
     1011    {
     1012    this->LastBounds[i] = bounds[i];
     1013    }
    7511014
    7521015  double major = 0.02 * (xExt + yExt + zExt) / 3.;
    7531016  double minor = 0.5 * major;
    754   for (i = 0; i < 4; i++)
     1017  for (int i = 0; i < NUMBER_OF_ALIGNED_AXIS; i++)
    7551018    {
    7561019    this->XAxes[i]->SetMajorTickSize(major);
     
    7921055//              /meshtvx/toolkit/plotgrid.c, axlab[x|y].
    7931056//
    794 //  Programmer: Hank Childs
    795 //  Creation:   July 11, 2000
    796 //
    797 //  Modifications:
    798 //    Kathleen Bonnell, Wed Oct 31 07:57:49 PST 2001
    799 //    Regardless of individual ranges, if any coord direction has too
    800 //    small/large a range, all will have a scale factor set for scaling their
    801 //    label values, and their titles adjusted accordingly.
    802 //
    803 //    Kathleen Bonnell, Thu Sep  5 17:32:16 PDT 2002
    804 //    Only use dimensions with range > 0 for determining scale factor.
    805 //
    806 //    Hank Childs, Fri Sep 27 17:15:07 PDT 2002
    807 //    Account for units.
    808 //
    809 //    Kathleen Bonnell, Wed Aug  6 13:59:15 PDT 2003
    810 //    Each axis type now has its own 'mustAdjustValue' and 'lastPow'.
    811 //
    812 //    Kathleen Bonnell, Tue Dec 16 11:23:31 PST 2003
    813 //    Allow the LabelExponent to be user-settable (autLabelScaling is off).
    814 //    For title use '10e' instead of just 'e' to designate that exponent
    815 //    has been used.
    816 //
    817 //    Kathleen Bonnell, Tue Jul 20 11:41:45 PDT 2004
    818 //    For title use 'x10^' instead of '10e' to designate that exponent.
    819 //
    820 //    Brad Whitlock, Fri Jul 23 18:27:30 PST 2004
    821 //    Added support for using user-defined titles for axes.
    822 //
    8231057// ****************************************************************************
    824 
    8251058void vtkRpCubeAxesActor::AdjustValues(const double xRange[2],
    8261059                                    const double yRange[2],
     
    8331066  if (AutoLabelScaling)
    8341067    {
    835     xPow = this->LabelExponent(xRange[0], xRange[1]);
    836     yPow = this->LabelExponent(yRange[0], yRange[1]);
    837     zPow = this->LabelExponent(zRange[0], zRange[1]);
     1068    if (this->AxisLabels[0] == NULL)
     1069      {
     1070      xPow = this->LabelExponent(xRange[0], xRange[1]);
     1071      }
     1072    else
     1073      {
     1074      xPow = 0;
     1075      }
     1076    if (this->AxisLabels[1] == NULL)
     1077      {
     1078      yPow = this->LabelExponent(yRange[0], yRange[1]);
     1079      }
     1080    else
     1081      {
     1082      yPow = 0;
     1083      }
     1084    if (this->AxisLabels[2] == NULL)
     1085      {
     1086      zPow = this->LabelExponent(zRange[0], zRange[1]);
     1087      }
     1088    else
     1089      {
     1090      zPow = 0;
     1091      }
    8381092    }
    8391093  else
     
    9941248//    bnds    The minimum and maximum values in each coordinate direction
    9951249//            (min_x, max_x, min_y, max_y, min_z, max_z).
    996 //
    997 //  Programmer: Hank Childs
    998 //  Creation:   July 11, 2000
    999 //
    1000 //  Modifications:
    1001 //    Kathleen Bonnell, Wed Oct 31 07:57:49 PST 2001
    1002 //    Moved from VisWinAxes3D.
    1003 //
    1004 //    Kathleen Bonnell, Thu Aug  1 14:05:05 PDT 2002
    1005 //    Send lastPos as argument to Digits.
    1006 //
    1007 //    Kathleen Bonnell, Wed Aug  6 13:59:15 PDT 2003
    1008 //    Adjust the range values using LastXPow, LastYPow, LastZPow.
    1009 //
    10101250// ****************************************************************************
    1011 
    10121251void vtkRpCubeAxesActor::AdjustRange(const double bnds[6])
    10131252{
    1014   double xrange[2], yrange[2], zrange[2];
    1015 
    1016   xrange[0] = (this->XAxisRange[0] == VTK_DOUBLE_MAX ?
    1017                                   bnds[0] : this->XAxisRange[0]);
    1018   xrange[1] = (this->XAxisRange[1] == VTK_DOUBLE_MAX ?
    1019                                   bnds[1] : this->XAxisRange[1]);
    1020   yrange[0] = (this->YAxisRange[0] == VTK_DOUBLE_MAX ?
    1021                                   bnds[2] : this->YAxisRange[0]);
    1022   yrange[1] = (this->YAxisRange[1] == VTK_DOUBLE_MAX ?
    1023                                   bnds[3] : this->YAxisRange[1]);
    1024   zrange[0] = (this->ZAxisRange[0] == VTK_DOUBLE_MAX ?
    1025                                   bnds[4] : this->ZAxisRange[0]);
    1026   zrange[1] = (this->ZAxisRange[1] == VTK_DOUBLE_MAX ?
    1027                                   bnds[5] : this->ZAxisRange[1]);
    1028 
    1029   if (this->LastXPow != 0)
    1030     {
    1031     xrange[0] /= pow(10., this->LastXPow);
    1032     xrange[1] /= pow(10., this->LastXPow);
    1033     }
    1034   if (this->LastYPow != 0)
    1035     {
    1036     yrange[0] /= pow(10., this->LastYPow);
    1037     yrange[1] /= pow(10., this->LastYPow);
    1038     }
    1039   if (this->LastZPow != 0)
    1040     {
    1041     zrange[0] /= pow(10., this->LastZPow);
    1042     zrange[1] /= pow(10., this->LastZPow);
    1043     }
    1044 
    1045   int xAxisDigits = this->Digits(xrange[0], xrange[1]);
    1046   if (xAxisDigits != this->LastXAxisDigits)
    1047     {
    1048     char  format[16];
    1049     sprintf(format, "%%.%df", xAxisDigits);
    1050     this->SetXLabelFormat(format);
    1051     this->LastXAxisDigits = xAxisDigits;
    1052     }
    1053 
    1054   int yAxisDigits = this->Digits(yrange[0], yrange[1]);
    1055   if (yAxisDigits != this->LastYAxisDigits)
    1056     {
    1057     char  format[16];
    1058     sprintf(format, "%%.%df", yAxisDigits);
    1059     this->SetYLabelFormat(format);
    1060     this->LastYAxisDigits = yAxisDigits;
    1061     }
    1062 
    1063   int zAxisDigits = this->Digits(zrange[0], zrange[1]);
    1064   if (zAxisDigits != this->LastZAxisDigits)
    1065     {
    1066     char  format[16];
    1067     sprintf(format, "%%.%df", zAxisDigits);
    1068     this->SetZLabelFormat(format);
    1069     this->LastZAxisDigits = zAxisDigits;
     1253  if (this->XAutoLabelFormat)
     1254    {
     1255    double xrange[2];
     1256
     1257    xrange[0] = (this->XAxisRange[0] == VTK_DOUBLE_MAX ?
     1258                                    bnds[0] : this->XAxisRange[0]);
     1259    xrange[1] = (this->XAxisRange[1] == VTK_DOUBLE_MAX ?
     1260                                    bnds[1] : this->XAxisRange[1]);
     1261    if (this->LastXPow != 0)
     1262      {
     1263      xrange[0] /= pow(10., this->LastXPow);
     1264      xrange[1] /= pow(10., this->LastXPow);
     1265      }
     1266
     1267    int xAxisDigits = this->Digits(xrange[0], xrange[1]);
     1268    if (xAxisDigits != this->LastXAxisDigits)
     1269      {
     1270      char  format[16];
     1271      sprintf(format, "%%.%df", xAxisDigits);
     1272      this->SetXLabelFormat(format);
     1273      this->LastXAxisDigits = xAxisDigits;
     1274      }
     1275    }
     1276  if (this->YAutoLabelFormat)
     1277    {
     1278    double yrange[2];
     1279
     1280    yrange[0] = (this->YAxisRange[0] == VTK_DOUBLE_MAX ?
     1281                                    bnds[2] : this->YAxisRange[0]);
     1282    yrange[1] = (this->YAxisRange[1] == VTK_DOUBLE_MAX ?
     1283                                    bnds[3] : this->YAxisRange[1]);
     1284
     1285    if (this->LastYPow != 0)
     1286      {
     1287      yrange[0] /= pow(10., this->LastYPow);
     1288      yrange[1] /= pow(10., this->LastYPow);
     1289      }
     1290
     1291    int yAxisDigits = this->Digits(yrange[0], yrange[1]);
     1292    if (yAxisDigits != this->LastYAxisDigits)
     1293      {
     1294      char  format[16];
     1295      sprintf(format, "%%.%df", yAxisDigits);
     1296      this->SetYLabelFormat(format);
     1297      this->LastYAxisDigits = yAxisDigits;
     1298      }
     1299    }
     1300  if (this->ZAutoLabelFormat)
     1301    {
     1302    double zrange[2];
     1303
     1304    zrange[0] = (this->ZAxisRange[0] == VTK_DOUBLE_MAX ?
     1305                                    bnds[4] : this->ZAxisRange[0]);
     1306    zrange[1] = (this->ZAxisRange[1] == VTK_DOUBLE_MAX ?
     1307                                    bnds[5] : this->ZAxisRange[1]);
     1308
     1309    if (this->LastZPow != 0)
     1310      {
     1311      zrange[0] /= pow(10., this->LastZPow);
     1312      zrange[1] /= pow(10., this->LastZPow);
     1313      }
     1314 
     1315    int zAxisDigits = this->Digits(zrange[0], zrange[1]);
     1316    if (zAxisDigits != this->LastZAxisDigits)
     1317      {
     1318      char  format[16];
     1319      sprintf(format, "%%.%df", zAxisDigits);
     1320      this->SetZLabelFormat(format);
     1321      this->LastZAxisDigits = zAxisDigits;
     1322      }
    10701323    }
    10711324}
     
    10821335//
    10831336//  Returns:   The appropriate number of digits.
    1084 //
    1085 //  Programmer: Hank Childs
    1086 //  Creation:   July 11, 2000
    1087 //
    1088 //  Modifications:
    1089 //
    1090 //    Hank Childs, Tue Sep 18 11:58:33 PDT 2001
    1091 //    Cast ipow10 to get rid of compiler warning.
    1092 //
    1093 //    Kathleen Bonnell, Wed Oct 31 07:57:49 PST 2001
    1094 //    Moved from VisWinAxes3D.
    1095 //
    1096 //    Kathleen Bonnell, Thu Aug  1 13:44:02 PDT 2002
    1097 //    Added lastPow argument, it specifies whether or not scientific notation
    1098 //    is being used on the labels.
    1099 //
    1100 //    Kathleen Bonnell, Wed Aug  6 13:59:15 PDT 2003
    1101 //    Removed lastPow argment, as the adjustment necessary is now taking
    1102 //    place in AdjustRange.
    1103 //
    11041337// ****************************************************************************
    1105 
    11061338int vtkRpCubeAxesActor::Digits(double min, double max )
    11071339{
     
    11521384//  Note:       This code is mostly stolen from old MeshTV code,
    11531385//              /meshtvx/toolkit/plotgrid.c, axlab_format.
    1154 //
    1155 //  Programmer: Hank Childs
    1156 //  Creation:   July 11, 2000
    1157 //
    1158 //  Modifications:
    1159 //    Eric Brugger, Tue Sep 18 09:18:17 PDT 2001
    1160 //    Change a few static local variables to be non-static to get around a
    1161 //    compiler bug with the MIPSpro 7.2.1.3 compiler.
    1162 //
    1163 //    Hank Childs, Tue Sep 18 11:58:33 PDT 2001
    1164 //    Cast return value to get rid of compiler warning.
    1165 //
    1166 //    Kathleen Bonnell, Wed Oct 31 07:57:49 PST 2001
    1167 //    Moved from VisWinAxes3D.
    1168 //
    1169 //    Kathleen Bonnell, Wed Aug  6 13:59:15 PDT 2003
    1170 //    Added test for min==max.
    1171 //
    11721386// ****************************************************************************
    11731387
     
    12131427// *************************************************************************
    12141428//  Build the axes. Determine coordinates, position, etc.
    1215 //
    1216 //  Note:  Bulk of code moved here from RenderOpaqueGeomtry.
    1217 //         Early-termination test added.
    1218 //
    1219 //  Programmer:  Kathleen Bonnell
    1220 //  Creation:    November 7, 2001
    1221 //
    1222 //  Modifications:
    1223 //    Kathleen Bonnell, Mon Dec  3 16:49:01 PST 2001
    1224 //    Compare vtkTimeStamps correctly.
    1225 //
    1226 //    Kathleen Bonnell, Fri Jul 25 14:37:32 PDT 2003
    1227 //    Added logic to compute and set for each axis the labels and title
    1228 //    scale size.
    1229 //
    1230 //    Kathleen Bonnell, Wed Aug  6 13:59:15 PDT 2003
    1231 //    Indivdual axes now have their own ForceLabelReset.
    1232 //
    12331429// *************************************************************************
    1234 
    12351430void vtkRpCubeAxesActor::BuildAxes(vtkViewport *viewport)
    12361431{
     1432  if ((this->GetMTime() < this->BuildTime.GetMTime()))
     1433    {
     1434    this->AutoScale(viewport);
     1435    return;
     1436    }
     1437
     1438  this->SetNonDependentAttributes();
     1439
     1440  // Reset range in case of bounds type changed
     1441  if(this->LastUseOrientedBounds != this->UseOrientedBounds)
     1442    {
     1443    this->XAxisRange[0] = this->XAxisRange[1] = VTK_DOUBLE_MAX;
     1444    this->YAxisRange[0] = this->YAxisRange[1] = VTK_DOUBLE_MAX;
     1445    this->ZAxisRange[0] = this->ZAxisRange[1] = VTK_DOUBLE_MAX;
     1446    this->LastUseOrientedBounds = this->UseOrientedBounds;
     1447    }
     1448
     1449  // determine the bounds to use (input, prop, or user-defined)
    12371450  double bounds[6];
    1238   double pts[8][3];
    1239   int i;
    1240 
    1241   if ((this->GetMTime() < this->BuildTime.GetMTime()))
    1242     {
    1243     return;
    1244     }
    1245 
    1246   this->SetNonDependentAttributes();
    1247   // determine the bounds to use (input, prop, or user-defined)
    1248   this->GetBounds(bounds);
    1249 
    1250   // Build the axes (almost always needed so we don't check mtime)
    1251   // Transform all points into display coordinates (to determine which closest
    1252   // to camera).
    1253   this->TransformBounds(viewport, bounds, pts);
     1451  if(this->UseOrientedBounds != 0)
     1452    {
     1453    this->GetOrientedBounds(bounds);
     1454    }
     1455  else
     1456    {
     1457    this->GetBounds(bounds);
     1458    }
    12541459
    12551460  // Setup the axes for plotting
    1256   double xCoords[4][6], yCoords[4][6], zCoords[4][6];
     1461  double xCoords[NUMBER_OF_ALIGNED_AXIS][6];
     1462  double yCoords[NUMBER_OF_ALIGNED_AXIS][6];
     1463  double zCoords[NUMBER_OF_ALIGNED_AXIS][6];
    12571464
    12581465  // these arrays are accessed by 'location':  mm, mX, XX, or Xm.
     
    12601467  int mm2[4] = { 0, 1, 1, 0 };
    12611468
    1262   for (i = 0; i < 4; i++)
    1263     {
    1264     this->XAxes[i]->SetAxisPosition(i);
    1265     xCoords[i][0] = bounds[0];
    1266     xCoords[i][3] = bounds[1];
    1267     xCoords[i][1] = xCoords[i][4] = bounds[2+mm1[i]];
    1268     xCoords[i][2] = xCoords[i][5] = bounds[4+mm2[i]];
    1269 
    1270     this->YAxes[i]->SetAxisPosition(i);
    1271     yCoords[i][0] = yCoords[i][3] = bounds[0+mm1[i]];
    1272     yCoords[i][1] = bounds[2];
    1273     yCoords[i][4] = bounds[3];
    1274     yCoords[i][2] = yCoords[i][5] = bounds[4+mm2[i]];
    1275 
    1276     this->ZAxes[i]->SetAxisPosition(i);
    1277     zCoords[i][0] = zCoords[i][3] = bounds[0+mm1[i]];
    1278     zCoords[i][1] = zCoords[i][4] = bounds[2+mm2[i]];
    1279     zCoords[i][2] = bounds[4];
    1280     zCoords[i][5] = bounds[5];
     1469  // Compute axes end-points
     1470  int i;
     1471  for (i = 0; i < NUMBER_OF_ALIGNED_AXIS; i++)
     1472    {
     1473    if(this->UseAxisOrigin == 0)
     1474      {
     1475      xCoords[i][0] = bounds[0]*this->AxisBaseForX[0] + bounds[2+mm1[i]]*this->AxisBaseForY[0] + bounds[4+mm2[i]]*this->AxisBaseForZ[0];
     1476      xCoords[i][1] = bounds[0]*this->AxisBaseForX[1] + bounds[2+mm1[i]]*this->AxisBaseForY[1] + bounds[4+mm2[i]]*this->AxisBaseForZ[1];
     1477      xCoords[i][2] = bounds[0]*this->AxisBaseForX[2] + bounds[2+mm1[i]]*this->AxisBaseForY[2] + bounds[4+mm2[i]]*this->AxisBaseForZ[2];
     1478      xCoords[i][3] = bounds[1]*this->AxisBaseForX[0] + bounds[2+mm1[i]]*this->AxisBaseForY[0] + bounds[4+mm2[i]]*this->AxisBaseForZ[0];
     1479      xCoords[i][4] = bounds[1]*this->AxisBaseForX[1] + bounds[2+mm1[i]]*this->AxisBaseForY[1] + bounds[4+mm2[i]]*this->AxisBaseForZ[1];
     1480      xCoords[i][5] = bounds[1]*this->AxisBaseForX[2] + bounds[2+mm1[i]]*this->AxisBaseForY[2] + bounds[4+mm2[i]]*this->AxisBaseForZ[2];
     1481      }
     1482    else
     1483      {
     1484      xCoords[i][0] = bounds[0]*this->AxisBaseForX[0] + this->AxisOrigin[1]*this->AxisBaseForY[0] + this->AxisOrigin[2]*this->AxisBaseForZ[0];
     1485      xCoords[i][1] = bounds[0]*this->AxisBaseForX[1] + this->AxisOrigin[1]*this->AxisBaseForY[1] + this->AxisOrigin[2]*this->AxisBaseForZ[1];
     1486      xCoords[i][2] = bounds[0]*this->AxisBaseForX[2] + this->AxisOrigin[1]*this->AxisBaseForY[2] + this->AxisOrigin[2]*this->AxisBaseForZ[2];
     1487      xCoords[i][3] = bounds[1]*this->AxisBaseForX[0] + this->AxisOrigin[1]*this->AxisBaseForY[0] + this->AxisOrigin[2]*this->AxisBaseForZ[0];
     1488      xCoords[i][4] = bounds[1]*this->AxisBaseForX[1] + this->AxisOrigin[1]*this->AxisBaseForY[1] + this->AxisOrigin[2]*this->AxisBaseForZ[1];
     1489      xCoords[i][5] = bounds[1]*this->AxisBaseForX[2] + this->AxisOrigin[1]*this->AxisBaseForY[2] + this->AxisOrigin[2]*this->AxisBaseForZ[2];
     1490      }
     1491
     1492    if(this->UseAxisOrigin == 0)
     1493      {
     1494      yCoords[i][0] = bounds[2]*this->AxisBaseForY[0] + bounds[0+mm1[i]]*this->AxisBaseForX[0] + bounds[4+mm2[i]]*this->AxisBaseForZ[0];
     1495      yCoords[i][1] = bounds[2]*this->AxisBaseForY[1] + bounds[0+mm1[i]]*this->AxisBaseForX[1] + bounds[4+mm2[i]]*this->AxisBaseForZ[1];
     1496      yCoords[i][2] = bounds[2]*this->AxisBaseForY[2] + bounds[0+mm1[i]]*this->AxisBaseForX[2] + bounds[4+mm2[i]]*this->AxisBaseForZ[2];
     1497      yCoords[i][3] = bounds[3]*this->AxisBaseForY[0] + bounds[0+mm1[i]]*this->AxisBaseForX[0] + bounds[4+mm2[i]]*this->AxisBaseForZ[0];
     1498      yCoords[i][4] = bounds[3]*this->AxisBaseForY[1] + bounds[0+mm1[i]]*this->AxisBaseForX[1] + bounds[4+mm2[i]]*this->AxisBaseForZ[1];
     1499      yCoords[i][5] = bounds[3]*this->AxisBaseForY[2] + bounds[0+mm1[i]]*this->AxisBaseForX[2] + bounds[4+mm2[i]]*this->AxisBaseForZ[2];
     1500      }
     1501    else
     1502      {
     1503      yCoords[i][0] = bounds[2]*this->AxisBaseForY[0] + this->AxisOrigin[0]*this->AxisBaseForX[0] + this->AxisOrigin[2]*this->AxisBaseForZ[0];
     1504      yCoords[i][1] = bounds[2]*this->AxisBaseForY[1] + this->AxisOrigin[0]*this->AxisBaseForX[1] + this->AxisOrigin[2]*this->AxisBaseForZ[1];
     1505      yCoords[i][2] = bounds[2]*this->AxisBaseForY[2] + this->AxisOrigin[0]*this->AxisBaseForX[2] + this->AxisOrigin[2]*this->AxisBaseForZ[2];
     1506      yCoords[i][3] = bounds[3]*this->AxisBaseForY[0] + this->AxisOrigin[0]*this->AxisBaseForX[0] + this->AxisOrigin[2]*this->AxisBaseForZ[0];
     1507      yCoords[i][4] = bounds[3]*this->AxisBaseForY[1] + this->AxisOrigin[0]*this->AxisBaseForX[1] + this->AxisOrigin[2]*this->AxisBaseForZ[1];
     1508      yCoords[i][5] = bounds[3]*this->AxisBaseForY[2] + this->AxisOrigin[0]*this->AxisBaseForX[2] + this->AxisOrigin[2]*this->AxisBaseForZ[2];
     1509      }
     1510
     1511    if(this->UseAxisOrigin == 0)
     1512      {
     1513      zCoords[i][0] = bounds[4]*this->AxisBaseForZ[0] + bounds[0+mm1[i]]*this->AxisBaseForX[0] + bounds[2+mm2[i]]*this->AxisBaseForY[0];
     1514      zCoords[i][1] = bounds[4]*this->AxisBaseForZ[1] + bounds[0+mm1[i]]*this->AxisBaseForX[1] + bounds[2+mm2[i]]*this->AxisBaseForY[1];
     1515      zCoords[i][2] = bounds[4]*this->AxisBaseForZ[2] + bounds[0+mm1[i]]*this->AxisBaseForX[2] + bounds[2+mm2[i]]*this->AxisBaseForY[2];
     1516      zCoords[i][3] = bounds[5]*this->AxisBaseForZ[0] + bounds[0+mm1[i]]*this->AxisBaseForX[0] + bounds[2+mm2[i]]*this->AxisBaseForY[0];
     1517      zCoords[i][4] = bounds[5]*this->AxisBaseForZ[1] + bounds[0+mm1[i]]*this->AxisBaseForX[1] + bounds[2+mm2[i]]*this->AxisBaseForY[1];
     1518      zCoords[i][5] = bounds[5]*this->AxisBaseForZ[2] + bounds[0+mm1[i]]*this->AxisBaseForX[2] + bounds[2+mm2[i]]*this->AxisBaseForY[2];
     1519      }
     1520    else
     1521      {
     1522      zCoords[i][0] = bounds[4]*this->AxisBaseForZ[0] + this->AxisOrigin[0]*this->AxisBaseForX[0] + this->AxisOrigin[1]*this->AxisBaseForY[0];
     1523      zCoords[i][1] = bounds[4]*this->AxisBaseForZ[1] + this->AxisOrigin[0]*this->AxisBaseForX[1] + this->AxisOrigin[1]*this->AxisBaseForY[1];
     1524      zCoords[i][2] = bounds[4]*this->AxisBaseForZ[2] + this->AxisOrigin[0]*this->AxisBaseForX[2] + this->AxisOrigin[1]*this->AxisBaseForY[2];
     1525      zCoords[i][3] = bounds[5]*this->AxisBaseForZ[0] + this->AxisOrigin[0]*this->AxisBaseForX[0] + this->AxisOrigin[1]*this->AxisBaseForY[0];
     1526      zCoords[i][4] = bounds[5]*this->AxisBaseForZ[1] + this->AxisOrigin[0]*this->AxisBaseForX[1] + this->AxisOrigin[1]*this->AxisBaseForY[1];
     1527      zCoords[i][5] = bounds[5]*this->AxisBaseForZ[2] + this->AxisOrigin[0]*this->AxisBaseForX[2] + this->AxisOrigin[1]*this->AxisBaseForY[2];
     1528      }
    12811529    }
    12821530
     
    12901538  // be scaled, may change title of each axis, may change label format.
    12911539  this->AdjustValues(xRange, yRange, zRange);
    1292   this->AdjustRange(this->Bounds);
     1540  this->AdjustRange(bounds);
    12931541
    12941542  // Prepare axes for rendering with user-definable options
    1295   for (i = 0; i < 4; i++)
    1296     {
     1543  for (i = 0; i < NUMBER_OF_ALIGNED_AXIS; i++)
     1544    {
     1545    this->XAxes[i]->SetAxisOnOrigin(this->UseAxisOrigin);
    12971546    this->XAxes[i]->GetPoint1Coordinate()->SetValue(xCoords[i][0],
    12981547                                                    xCoords[i][1],
     
    13011550                                                    xCoords[i][4],
    13021551                                                    xCoords[i][5]);
     1552    this->YAxes[i]->SetAxisOnOrigin(this->UseAxisOrigin);
    13031553    this->YAxes[i]->GetPoint1Coordinate()->SetValue(yCoords[i][0],
    13041554                                                    yCoords[i][1],
     
    13071557                                                    yCoords[i][4],
    13081558                                                    yCoords[i][5]);
     1559    this->ZAxes[i]->SetAxisOnOrigin(this->UseAxisOrigin);
    13091560    this->ZAxes[i]->GetPoint1Coordinate()->SetValue(zCoords[i][0],
    13101561                                                    zCoords[i][1],
     
    13351586      {
    13361587      this->BuildLabels(this->XAxes);
     1588      this->UpdateLabels(this->XAxes, 0);
    13371589      }
    13381590    if (this->ForceYLabelReset)
    13391591      {
    13401592      this->BuildLabels(this->YAxes);
     1593      this->UpdateLabels(this->YAxes, 1);
    13411594      }
    13421595    if (this->ForceZLabelReset)
    13431596      {
    13441597      this->BuildLabels(this->ZAxes);
     1598      this->UpdateLabels(this->ZAxes, 2);
    13451599      }
    13461600    }
     
    13701624
    13711625    double target = bLength *0.04;
    1372     double labelscale = 1.;
     1626    this->LabelScale = 1.;
    13731627    if (maxLabelLength != 0.)
    13741628      {
    1375       labelscale = target / maxLabelLength;
     1629      this->LabelScale = target / maxLabelLength;
    13761630      }
    13771631    target = bLength *0.10;
    1378     double titlescale = 1.;
     1632    this->TitleScale = 1.;
    13791633    if (maxTitleLength != 0.)
    13801634      {
    1381       titlescale = target / maxTitleLength;
     1635      this->TitleScale = target / maxTitleLength;
    13821636      }
    13831637
     
    13881642    if (XUnits != NULL && XUnits[0] != '\0')
    13891643      {
    1390       titlescale *= 2;
    1391       }
    1392 
    1393     for (i = 0; i < 4; i++)
    1394       {
    1395       this->XAxes[i]->SetLabelScale(labelscale);
    1396       this->YAxes[i]->SetLabelScale(labelscale);
    1397       this->ZAxes[i]->SetLabelScale(labelscale);
    1398       this->XAxes[i]->SetTitleScale(titlescale);
    1399       this->YAxes[i]->SetTitleScale(titlescale);
    1400       this->ZAxes[i]->SetTitleScale(titlescale);
    1401       }
    1402     }
     1644      this->TitleScale *= 2;
     1645      }
     1646
     1647    for (i = 0; i < NUMBER_OF_ALIGNED_AXIS; i++)
     1648      {
     1649      this->XAxes[i]->SetLabelScale(this->LabelScale);
     1650      this->YAxes[i]->SetLabelScale(this->LabelScale);
     1651      this->ZAxes[i]->SetLabelScale(this->LabelScale);
     1652      this->XAxes[i]->SetTitleScale(this->TitleScale);
     1653      this->YAxes[i]->SetTitleScale(this->TitleScale);
     1654      this->ZAxes[i]->SetTitleScale(this->TitleScale);
     1655      }
     1656    }
     1657
     1658  // Scale appropriately.
     1659  this->AutoScale(viewport);
     1660
    14031661  this->RenderSomething = 1;
    14041662  this->BuildTime.Modified();
     
    14101668//  not dependent upon viewport changes, and thus do not need to be set
    14111669//  very often.
    1412 //
    1413 //  Programmer:  Kathleen Bonnell
    1414 //  Creation:    November 7, 2001
    1415 //
    1416 //  Modifications:
    1417 //    Kathleen Bonnell, Thu Oct  3 14:33:15 PDT 2002
    1418 //    Disable lighting for the axes by setting the ambient coefficient to 1
    1419 //    and the diffuse coeeficient to 0.
    14201670// *************************************************************************
    1421 
    14221671void vtkRpCubeAxesActor::SetNonDependentAttributes()
    14231672{
     
    14251674  prop->SetAmbient(1.0);
    14261675  prop->SetDiffuse(0.0);
    1427   for (int i = 0; i < 4; i++)
    1428     {
     1676
     1677  // Make sure our Axis Base is normalized
     1678  vtkMath::Normalize(this->AxisBaseForX);
     1679  vtkMath::Normalize(this->AxisBaseForY);
     1680  vtkMath::Normalize(this->AxisBaseForZ);
     1681
     1682  // Manage custome grid visibility location if FLY and STATIC axis
     1683  int gridLocationBasedOnAxis = (this->GridLineLocation == VTK_GRID_LINES_ALL)
     1684      ? VTK_GRID_LINES_ALL : VTK_GRID_LINES_CLOSEST;
     1685
     1686  for (int i = 0; i < NUMBER_OF_ALIGNED_AXIS; i++)
     1687    {
     1688    this->XAxes[i]->SetAxisPosition(i);
     1689    this->XAxes[i]->SetAxisBaseForX(this->AxisBaseForX);
     1690    this->XAxes[i]->SetAxisBaseForY(this->AxisBaseForY);
     1691    this->XAxes[i]->SetAxisBaseForZ(this->AxisBaseForZ);
    14291692    this->XAxes[i]->SetCamera(this->Camera);
    14301693    this->XAxes[i]->SetProperty(prop);
     1694    this->XAxes[i]->SetTitleTextProperty(this->TitleTextProperty[0]);
     1695    this->XAxes[i]->SetLabelTextProperty(this->LabelTextProperty[0]);
     1696    this->XAxes[i]->SetAxisLinesProperty(this->XAxesLinesProperty);
     1697    this->XAxes[i]->SetGridlinesProperty(this->XAxesGridlinesProperty);
     1698    this->XAxes[i]->SetGridpolysProperty(this->XAxesGridpolysProperty);
    14311699    this->XAxes[i]->SetTickLocation(this->TickLocation);
    14321700    this->XAxes[i]->SetDrawGridlines(this->DrawXGridlines);
     1701    this->XAxes[i]->SetDrawGridlinesLocation(gridLocationBasedOnAxis);
     1702    this->XAxes[i]->SetDrawInnerGridlines(this->DrawXInnerGridlines);
     1703    this->XAxes[i]->SetDrawGridpolys(this->DrawXGridpolys);
    14331704    this->XAxes[i]->SetBounds(this->Bounds);
    1434     this->XAxes[i]->AxisVisibilityOn();
     1705    this->XAxes[i]->SetAxisVisibility(this->XAxisVisibility);
    14351706    this->XAxes[i]->SetLabelVisibility(this->XAxisLabelVisibility);
    14361707    this->XAxes[i]->SetTitleVisibility(this->XAxisLabelVisibility);
     
    14381709    this->XAxes[i]->SetMinorTicksVisible(this->XAxisMinorTickVisibility);
    14391710
     1711    this->YAxes[i]->SetAxisPosition(i);
     1712    this->YAxes[i]->SetAxisBaseForX(this->AxisBaseForX);
     1713    this->YAxes[i]->SetAxisBaseForY(this->AxisBaseForY);
     1714    this->YAxes[i]->SetAxisBaseForZ(this->AxisBaseForZ);
    14401715    this->YAxes[i]->SetCamera(this->Camera);
    14411716    this->YAxes[i]->SetProperty(prop);
     1717    this->YAxes[i]->SetTitleTextProperty(this->TitleTextProperty[1]);
     1718    this->YAxes[i]->SetLabelTextProperty(this->LabelTextProperty[1]);
     1719    this->YAxes[i]->SetAxisLinesProperty(this->YAxesLinesProperty);
     1720    this->YAxes[i]->SetGridlinesProperty(this->YAxesGridlinesProperty);
     1721    this->YAxes[i]->SetGridpolysProperty(this->YAxesGridpolysProperty);
    14421722    this->YAxes[i]->SetTickLocation(this->TickLocation);
    14431723    this->YAxes[i]->SetDrawGridlines(this->DrawYGridlines);
     1724    this->YAxes[i]->SetDrawGridlinesLocation(gridLocationBasedOnAxis);
     1725    this->YAxes[i]->SetDrawInnerGridlines(this->DrawYInnerGridlines);
     1726    this->YAxes[i]->SetDrawGridpolys(this->DrawYGridpolys);
    14441727    this->YAxes[i]->SetBounds(this->Bounds);
    1445     this->YAxes[i]->AxisVisibilityOn();
     1728    this->YAxes[i]->SetAxisVisibility(this->YAxisVisibility);
    14461729    this->YAxes[i]->SetLabelVisibility(this->YAxisLabelVisibility);
    14471730    this->YAxes[i]->SetTitleVisibility(this->YAxisLabelVisibility);
     
    14491732    this->YAxes[i]->SetMinorTicksVisible(this->YAxisMinorTickVisibility);
    14501733
     1734    this->ZAxes[i]->SetAxisPosition(i);
     1735    this->ZAxes[i]->SetAxisBaseForX(this->AxisBaseForX);
     1736    this->ZAxes[i]->SetAxisBaseForY(this->AxisBaseForY);
     1737    this->ZAxes[i]->SetAxisBaseForZ(this->AxisBaseForZ);
    14511738    this->ZAxes[i]->SetCamera(this->Camera);
    14521739    this->ZAxes[i]->SetProperty(prop);
     1740    this->ZAxes[i]->SetTitleTextProperty(this->TitleTextProperty[2]);
     1741    this->ZAxes[i]->SetLabelTextProperty(this->LabelTextProperty[2]);
     1742    this->ZAxes[i]->SetAxisLinesProperty(this->ZAxesLinesProperty);
     1743    this->ZAxes[i]->SetGridlinesProperty(this->ZAxesGridlinesProperty);
     1744    this->ZAxes[i]->SetGridpolysProperty(this->ZAxesGridpolysProperty);
    14531745    this->ZAxes[i]->SetTickLocation(this->TickLocation);
    14541746    this->ZAxes[i]->SetDrawGridlines(this->DrawZGridlines);
     1747    this->ZAxes[i]->SetDrawGridlinesLocation(gridLocationBasedOnAxis);
     1748    this->ZAxes[i]->SetDrawInnerGridlines(this->DrawZInnerGridlines);
     1749    this->ZAxes[i]->SetDrawGridpolys(this->DrawZGridpolys);
    14551750    this->ZAxes[i]->SetBounds(this->Bounds);
    1456     this->ZAxes[i]->AxisVisibilityOn();
     1751    this->ZAxes[i]->SetAxisVisibility(this->ZAxisVisibility);
    14571752    this->ZAxes[i]->SetLabelVisibility(this->ZAxisLabelVisibility);
    14581753    this->ZAxes[i]->SetTitleVisibility(this->ZAxisLabelVisibility);
     
    14811776// be rendered.  For STATIC FlyMode, all axes are rendered.  For other
    14821777// FlyModes, either 1 or 2 per coordinate direction are rendered.
    1483 //
    1484 // Programmer:  Kathleen Bonnell
    1485 // Creation:    November 7, 2001
    1486 //
    1487 // Modifications:
    1488 //   Kathleen Bonnell, Thu Jul 18 10:33:07 PDT 2002
    1489 //   Ensure that primary axes visibility flags are set properly, and
    1490 //   that secondary axes visibility flags are turned off.
    14911778// *************************************************************************
    14921779void vtkRpCubeAxesActor::DetermineRenderAxes(vtkViewport *viewport)
    14931780{
    1494   double bounds[6], slope = 0.0, minSlope, num, den;
    1495   double pts[8][3], d2, d2Min, min, max;
    1496   int i = 0, idx = 0;
    1497   int xIdx = 0, yIdx = 0, zIdx = 0, zIdx2 = 0;
    1498   int xAxes = 0, yAxes = 0, zAxes = 0, xloc = 0, yloc = 0, zloc = 0;
    1499 
    1500   if (this->FlyMode == VTK_FLY_STATIC_EDGES)
    1501     {
    1502     for (i = 0; i < 4; i++)
    1503       {
    1504       this->RenderAxesX[i] = i;
    1505       this->RenderAxesY[i] = i;
    1506       this->RenderAxesZ[i] = i;
    1507       }
    1508     this->NumberOfAxesX = this->NumberOfAxesY = this->NumberOfAxesZ = 4;
     1781  double bounds[6];
     1782  double pts[8][3];
     1783  int i = 0, closestIdx = -1, furtherstIdx = -1;
     1784  int xloc = 0, yloc = 0, zloc = 0;
     1785
     1786  // Make sure we start with only one axis by default, then we might extend it
     1787  this->NumberOfAxesX = this->NumberOfAxesY = this->NumberOfAxesZ = 1;
     1788
     1789  // Compute relevant axis points only if a axis/grid visibility change based
     1790  // on the viewpoint
     1791  if( !( this->GridLineLocation == VTK_GRID_LINES_ALL
     1792         && ( this->FlyMode == VTK_FLY_STATIC_EDGES
     1793              || this->FlyMode == VTK_FLY_STATIC_TRIAD)))
     1794    {
     1795    // determine the bounds to use (input, prop, or user-defined)
     1796    this->GetBounds(bounds);
     1797    this->TransformBounds(viewport, bounds, pts);
     1798    }
     1799
     1800  // Check closest point if needed
     1801  if( this->GridLineLocation == VTK_GRID_LINES_CLOSEST
     1802      || this->FlyMode == VTK_FLY_CLOSEST_TRIAD )
     1803    {
     1804    closestIdx = this->FindClosestAxisIndex(pts);
     1805    }
     1806
     1807  // Check furtherst point if needed
     1808  if( this->GridLineLocation == VTK_GRID_LINES_FURTHEST
     1809      || this->FlyMode == VTK_FLY_FURTHEST_TRIAD )
     1810    {
     1811    furtherstIdx = this->FindFurtherstAxisIndex(pts);
     1812    }
     1813
     1814  // Manage fast static axis visibility
     1815  if (this->FlyMode == VTK_FLY_STATIC_EDGES || this->FlyMode == VTK_FLY_STATIC_TRIAD)
     1816    {
     1817    if(this->FlyMode == VTK_FLY_STATIC_EDGES)
     1818      {
     1819      this->NumberOfAxesX = this->NumberOfAxesY = this->NumberOfAxesZ
     1820          = NUMBER_OF_ALIGNED_AXIS;
     1821      }
     1822
     1823    for (i = 0; i < this->NumberOfAxesX; i++)
     1824      {
     1825      this->RenderAxesX[i] = this->RenderAxesY[i] = this->RenderAxesZ[i] = i;
     1826      }
     1827
     1828    this->UpdateGridLineVisibility(
     1829          (this->GridLineLocation == VTK_GRID_LINES_CLOSEST)
     1830          ? closestIdx : furtherstIdx);
    15091831    return;
    15101832    }
    1511   if (this->FlyMode == VTK_FLY_STATIC_TRIAD)
    1512     {
    1513     this->RenderAxesX[0] = 0;
    1514     this->RenderAxesY[0] = 0;
    1515     this->RenderAxesZ[0] = 0;
    1516     if (this->DrawXGridlines && 0)
    1517       {
    1518       this->RenderAxesX[1] = 2;
    1519       this->NumberOfAxesX = 2;
    1520       this->XAxes[RenderAxesX[1]]->SetTickVisibility(0);
    1521       this->XAxes[RenderAxesX[1]]->SetLabelVisibility(0);
    1522       this->XAxes[RenderAxesX[1]]->SetTitleVisibility(0);
    1523       this->XAxes[RenderAxesX[1]]->SetMinorTicksVisible(0);
    1524       }
    1525     else
    1526       {
    1527       this->NumberOfAxesX = 1;
    1528       }
    1529     if (this->DrawYGridlines && 0)
    1530       {
    1531       this->RenderAxesY[1] = 2;
    1532       this->NumberOfAxesY = 2;
    1533       this->YAxes[RenderAxesY[1]]->SetTickVisibility(0);
    1534       this->YAxes[RenderAxesY[1]]->SetLabelVisibility(0);
    1535       this->YAxes[RenderAxesY[1]]->SetTitleVisibility(0);
    1536       this->YAxes[RenderAxesY[1]]->SetMinorTicksVisible(0);
    1537       }
    1538     else
    1539       {
    1540       this->NumberOfAxesY = 1;
    1541       }
    1542     if (this->DrawZGridlines && 0)
    1543       {
    1544       this->RenderAxesZ[1] = 2;
    1545       this->NumberOfAxesZ = 2;
    1546       this->ZAxes[RenderAxesZ[1]]->SetTickVisibility(0);
    1547       this->ZAxes[RenderAxesZ[1]]->SetLabelVisibility(0);
    1548       this->ZAxes[RenderAxesZ[1]]->SetTitleVisibility(0);
    1549       this->ZAxes[RenderAxesZ[1]]->SetMinorTicksVisible(0);
    1550       }
    1551     else
    1552       {
    1553       this->NumberOfAxesZ = 1;
    1554       }
    1555     return;
    1556     }
    1557 
    1558   // determine the bounds to use (input, prop, or user-defined)
    1559   this->GetBounds(bounds);
    1560   this->TransformBounds(viewport, bounds, pts);
     1833
    15611834
    15621835  // Take into account the inertia. Process only so often.
     
    15651838    if (this->FlyMode == VTK_FLY_CLOSEST_TRIAD)
    15661839      {
    1567       // Loop over points and find the closest point to the camera
    1568       min = VTK_LARGE_FLOAT;
    1569       for (i=0; i < 8; i++)
    1570         {
    1571         if (pts[i][2] < min)
    1572           {
    1573           idx = i;
    1574           min = pts[i][2];
    1575           }
    1576         }
    1577       xloc = vtkRpCubeAxesActorTriads[idx][0];
    1578       yloc = vtkRpCubeAxesActorTriads[idx][1];
    1579       zloc = vtkRpCubeAxesActorTriads[idx][2];
    1580 
    1581       } // closest-triad
     1840      xloc = vtkRpCubeAxesActorTriads[closestIdx][0];
     1841      yloc = vtkRpCubeAxesActorTriads[closestIdx][1];
     1842      zloc = vtkRpCubeAxesActorTriads[closestIdx][2];
     1843      }
    15821844    else if (this->FlyMode == VTK_FLY_FURTHEST_TRIAD)
    15831845      {
    1584       // Loop over points and find the furthest point from the camera
    1585       max = -VTK_LARGE_FLOAT;
    1586       for (i=0; i < 8; i++)
    1587         {
    1588         if (pts[i][2] > max)
    1589           {
    1590           idx = i;
    1591           max = pts[i][2];
    1592           }
    1593         }
    1594       xloc = vtkRpCubeAxesActorTriads[idx][0];
    1595       yloc = vtkRpCubeAxesActorTriads[idx][1];
    1596       zloc = vtkRpCubeAxesActorTriads[idx][2];
    1597 
    1598       } // furthest-triad
    1599     else
    1600       {
    1601       double e1[3], e2[3], e3[3];
    1602 
    1603       // Find distance to origin
    1604       d2Min = VTK_LARGE_FLOAT;
    1605       for (i=0; i < 8; i++)
    1606         {
    1607         d2 = pts[i][0]*pts[i][0] + pts[i][1]*pts[i][1];
    1608         if (d2 < d2Min)
    1609           {
    1610           d2Min = d2;
    1611           idx = i;
    1612           }
    1613         }
    1614 
    1615       // find minimum slope point connected to closest point and on
    1616       // right side (in projected coordinates). This is the first edge.
    1617       minSlope = VTK_LARGE_FLOAT;
    1618       for (xIdx=0, i=0; i<3; i++)
    1619         {
    1620         num = (pts[vtkRpCubeAxesActorConn[idx][i]][1] - pts[idx][1]);
    1621         den = (pts[vtkRpCubeAxesActorConn[idx][i]][0] - pts[idx][0]);
    1622         if (den != 0.0)
    1623           {
    1624           slope = num / den;
    1625           }
    1626         if (slope < minSlope && den > 0)
    1627           {
    1628           xIdx = vtkRpCubeAxesActorConn[idx][i];
    1629           yIdx = vtkRpCubeAxesActorConn[idx][(i+1)%3];
    1630           zIdx = vtkRpCubeAxesActorConn[idx][(i+2)%3];
    1631           xAxes = i;
    1632           minSlope = slope;
    1633           }
    1634         }
    1635 
    1636       // find edge (connected to closest point) on opposite side
    1637       for ( i=0; i<3; i++)
    1638         {
    1639         e1[i] = (pts[xIdx][i] - pts[idx][i]);
    1640         e2[i] = (pts[yIdx][i] - pts[idx][i]);
    1641         e3[i] = (pts[zIdx][i] - pts[idx][i]);
    1642         }
    1643       vtkMath::Normalize(e1);
    1644       vtkMath::Normalize(e2);
    1645       vtkMath::Normalize(e3);
    1646 
    1647       if (vtkMath::Dot(e1,e2) < vtkMath::Dot(e1,e3))
    1648         {
    1649         yAxes = (xAxes + 1) % 3;
    1650         }
    1651       else
    1652         {
    1653         yIdx = zIdx;
    1654         yAxes = (xAxes + 2) % 3;
    1655         }
    1656 
    1657       // Find the final point by determining which global x-y-z axes have not
    1658       // been represented, and then determine the point closest to the viewer.
    1659       zAxes = (xAxes != 0 && yAxes != 0 ? 0 :
    1660               (xAxes != 1 && yAxes != 1 ? 1 : 2));
    1661       if (pts[vtkRpCubeAxesActorConn[xIdx][zAxes]][2] <
    1662           pts[vtkRpCubeAxesActorConn[yIdx][zAxes]][2])
    1663         {
    1664         zIdx = xIdx;
    1665         zIdx2 = vtkRpCubeAxesActorConn[xIdx][zAxes];
    1666         }
    1667       else
    1668         {
    1669         zIdx = yIdx;
    1670         zIdx2 = vtkRpCubeAxesActorConn[yIdx][zAxes];
    1671         }
    1672 
    1673       int mini = (idx < xIdx ? idx : xIdx);
    1674       switch (xAxes)
    1675         {
    1676         case 0:
    1677           xloc = vtkRpCubeAxesActorTriads[mini][0];
    1678           break;
    1679         case 1:
    1680           yloc = vtkRpCubeAxesActorTriads[mini][1];
    1681           break;
    1682         case 2:
    1683           zloc = vtkRpCubeAxesActorTriads[mini][2];
    1684           break;
    1685         }
    1686       mini = (idx < yIdx ? idx : yIdx);
    1687       switch (yAxes)
    1688         {
    1689         case 0:
    1690           xloc = vtkRpCubeAxesActorTriads[mini][0];
    1691           break;
    1692         case 1:
    1693           yloc =vtkRpCubeAxesActorTriads[mini][1];
    1694           break;
    1695         case 2:
    1696           zloc = vtkRpCubeAxesActorTriads[mini][2];
    1697           break;
    1698         }
    1699       mini = (zIdx < zIdx2 ? zIdx : zIdx2);
    1700       switch (zAxes)
    1701         {
    1702         case 0:
    1703           xloc = vtkRpCubeAxesActorTriads[mini][0];
    1704           break;
    1705         case 1:
    1706           yloc = vtkRpCubeAxesActorTriads[mini][1];
    1707           break;
    1708         case 2:
    1709           zloc = vtkRpCubeAxesActorTriads[mini][2];
    1710           break;
    1711         }
    1712 
    1713       }//else boundary edges fly mode
     1846      xloc = vtkRpCubeAxesActorTriads[furtherstIdx][0];
     1847      yloc = vtkRpCubeAxesActorTriads[furtherstIdx][1];
     1848      zloc = vtkRpCubeAxesActorTriads[furtherstIdx][2];
     1849      }
     1850    else // else boundary edges fly mode
     1851      {
     1852      this->FindBoundaryEdge(xloc, yloc, zloc, pts);
     1853      }
    17141854
    17151855    this->InertiaLocs[0] = xloc;
    17161856    this->InertiaLocs[1] = yloc;
    17171857    this->InertiaLocs[2] = zloc;
    1718     } //inertia
     1858    } // inertia
    17191859  else
    17201860    {
    1721     // don't change anything, use locations from last render
     1861    // Do not change anything, use locations from last render
    17221862    xloc = this->InertiaLocs[0];
    17231863    yloc = this->InertiaLocs[1];
     
    17251865    }
    17261866
    1727   this->RenderAxesX[0] = xloc % 4;
    1728   if (this->DrawXGridlines && 0)
    1729     {
    1730     this->RenderAxesX[1] = (xloc + 2) % 4;
    1731     this->NumberOfAxesX = 2;
    1732     this->XAxes[RenderAxesX[1]]->SetTickVisibility(0);
    1733     this->XAxes[RenderAxesX[1]]->SetLabelVisibility(0);
    1734     this->XAxes[RenderAxesX[1]]->SetTitleVisibility(0);
    1735     this->XAxes[RenderAxesX[1]]->SetMinorTicksVisible(0);
    1736     }
    1737   else
    1738     {
    1739     this->NumberOfAxesX = 1;
    1740     }
    1741 
    1742   this->RenderAxesY[0] = yloc % 4;
    1743   if (this->DrawYGridlines && 0)
    1744     {
    1745     this->RenderAxesY[1] = (yloc + 2) % 4;
    1746     this->NumberOfAxesY = 2;
    1747     this->YAxes[RenderAxesY[1]]->SetTickVisibility(0);
    1748     this->YAxes[RenderAxesY[1]]->SetLabelVisibility(0);
    1749     this->YAxes[RenderAxesY[1]]->SetTitleVisibility(0);
    1750     this->YAxes[RenderAxesY[1]]->SetMinorTicksVisible(0);
    1751     }
    1752   else
    1753     {
    1754     this->NumberOfAxesY = 1;
    1755     }
    1756 
    1757   this->RenderAxesZ[0] = zloc % 4;
    1758   if (this->DrawZGridlines && 0)
    1759     {
    1760     this->RenderAxesZ[1] = (zloc + 2) % 4;
    1761     this->NumberOfAxesZ = 2;
    1762     this->ZAxes[RenderAxesZ[1]]->SetTickVisibility(0);
    1763     this->ZAxes[RenderAxesZ[1]]->SetLabelVisibility(0);
    1764     this->ZAxes[RenderAxesZ[1]]->SetTitleVisibility(0);
    1765     this->ZAxes[RenderAxesZ[1]]->SetMinorTicksVisible(0);
    1766     }
    1767   else
    1768     {
    1769     this->NumberOfAxesZ = 1;
    1770     }
    1771   //
    1772   //  Make sure that the primary axis visibility flags are set correctly.
    1773   //
    1774   this->XAxes[RenderAxesX[0]]->SetLabelVisibility(this->XAxisLabelVisibility);
    1775   this->XAxes[RenderAxesX[0]]->SetTitleVisibility(this->XAxisLabelVisibility);
    1776   this->XAxes[RenderAxesX[0]]->SetTickVisibility(this->XAxisTickVisibility);
    1777   this->XAxes[RenderAxesX[0]]->SetMinorTicksVisible(
    1778     this->XAxisMinorTickVisibility);
    1779   this->XAxes[RenderAxesX[0]]->SetDrawGridlines(this->DrawXGridlines);
    1780 
    1781   this->YAxes[RenderAxesY[0]]->SetLabelVisibility(this->YAxisLabelVisibility);
    1782   this->YAxes[RenderAxesY[0]]->SetTitleVisibility(this->YAxisLabelVisibility);
    1783   this->YAxes[RenderAxesY[0]]->SetTickVisibility(this->YAxisTickVisibility);
    1784   this->YAxes[RenderAxesY[0]]->SetMinorTicksVisible(
    1785     this->YAxisMinorTickVisibility);
    1786   this->YAxes[RenderAxesY[0]]->SetDrawGridlines(this->DrawYGridlines);
    1787 
    1788   this->ZAxes[RenderAxesZ[0]]->SetLabelVisibility(this->ZAxisLabelVisibility);
    1789   this->ZAxes[RenderAxesZ[0]]->SetTitleVisibility(this->ZAxisLabelVisibility);
    1790   this->ZAxes[RenderAxesZ[0]]->SetTickVisibility(this->ZAxisTickVisibility);
    1791   this->ZAxes[RenderAxesZ[0]]->SetMinorTicksVisible(
    1792     this->ZAxisMinorTickVisibility);
    1793   this->ZAxes[RenderAxesZ[0]]->SetDrawGridlines(this->DrawZGridlines);
    1794 }
    1795 
     1867  // Set axes to be rendered
     1868  this->RenderAxesX[0] = xloc % NUMBER_OF_ALIGNED_AXIS;
     1869  this->RenderAxesY[0] = yloc % NUMBER_OF_ALIGNED_AXIS;
     1870  this->RenderAxesZ[0] = zloc % NUMBER_OF_ALIGNED_AXIS;
     1871
     1872  // Manage grid visibility (can increase the number of axis to render)
     1873  this->UpdateGridLineVisibility(
     1874        (this->GridLineLocation == VTK_GRID_LINES_CLOSEST)
     1875        ? closestIdx : furtherstIdx);
     1876}
     1877
     1878// --------------------------------------------------------------------------
    17961879double vtkRpCubeAxesActor::MaxOf(double a, double b)
    17971880{
     
    17991882}
    18001883
     1884// --------------------------------------------------------------------------
    18011885double vtkRpCubeAxesActor::MaxOf(double a, double b, double c, double d)
    18021886{
     
    18041888}
    18051889
     1890// --------------------------------------------------------------------------
    18061891inline double vtkRpCubeAxesActor::FFix(double value)
    18071892{
     
    18101895}
    18111896
     1897inline int vtkRpCubeAxesActor::FRound(double value)
     1898{
     1899  return value <= 0.5 ? static_cast<int>(this->FFix(value)) : static_cast<int>(this->FFix(value) + 1);
     1900}
     1901
     1902inline int vtkRpCubeAxesActor::GetNumTicks(double range, double fxt)
     1903{
     1904  // Find the number of integral points in the interval.
     1905  double fnt  = range/fxt;
     1906  fnt  = this->FFix(fnt);
     1907  return this->FRound(fnt);
     1908}
     1909
     1910// --------------------------------------------------------------------------
    18121911inline double vtkRpCubeAxesActor::FSign(double value, double sign)
    18131912{
     
    18281927// Arguments:
    18291928//   inRange   The range for this axis.
    1830 //
    1831 // Note:    The bulk of this method was taken from vtkHankAxisActor.C
    1832 //          The original method was reduced to serve the purposes
    1833 //          of this class.
    1834 //
    1835 // Programmer: Kathleen Bonnell
    1836 // Creation:   29 August, 2001
    1837 //
    1838 // Modifications:
    1839 //   Kathleen Bonnell, Fri Jul 25 14:37:32 PDT 2003
    1840 //   Moved from vtkRpAxisActor. Added calls to set inividual axis'
    1841 //   MajorStart, MinorStart, deltaMajor, deltaMinor.
    1842 //
    18431929// *******************************************************************
    18441930
    1845 void vtkRpCubeAxesActor::AdjustTicksComputeRange(vtkRpAxisActor *axes[4],
     1931void vtkRpCubeAxesActor::AdjustTicksComputeRange(vtkRpAxisActor *axes[NUMBER_OF_ALIGNED_AXIS],
    18461932    double boundsMin, double boundsMax)
    18471933{
    18481934  double sortedRange[2], range;
    1849   double fxt, fnt, frac;
     1935  double fxt;
    18501936  double div, major, minor;
    18511937  double majorStart, minorStart;
    18521938  int numTicks;
    18531939  double *inRange = axes[0]->GetRange();
     1940  vtkStringArray* customizedLabels = NULL;
    18541941
    18551942  sortedRange[0] = inRange[0] < inRange[1] ? inRange[0] : inRange[1];
     
    18761963  fxt = pow(10., this->FFix(pow10));
    18771964
    1878   // Find the number of integral points in the interval.
    1879   fnt  = range/fxt;
    1880   fnt  = this->FFix(fnt);
    1881   frac = fnt;
    1882   numTicks = frac <= 0.5 ? static_cast<int>(this->FFix(fnt)) : static_cast<int>(this->FFix(fnt) + 1);
     1965  numTicks = this->GetNumTicks(range, fxt);
    18831966
    18841967  div = 1.;
     
    18991982    major /= div;
    19001983    }
    1901   minor = (fxt/div) / 10.;
    1902 
    1903   // Figure out the first major and minor tick locations, relative to the
     1984
     1985  int axis = 0;
     1986  switch(axes[0]->GetAxisType())
     1987  {
     1988  case VTK_AXIS_TYPE_X:
     1989    axis = 0;
     1990    break;
     1991  case VTK_AXIS_TYPE_Y:
     1992    axis = 1;
     1993    break;
     1994  case VTK_AXIS_TYPE_Z:
     1995    axis = 2;
     1996    break;
     1997  }
     1998  customizedLabels = this->AxisLabels[axis];
     1999
     2000  if (customizedLabels == NULL)
     2001    {
     2002    // Figure out the first major tick locations, relative to the
     2003    // start of the axis.
     2004    if (sortedRange[0] <= 0.)
     2005      {
     2006      majorStart = major*(this->FFix(sortedRange[0]*(1./major)) + 0.);
     2007      }
     2008    else
     2009      {
     2010      majorStart = major*(this->FFix(sortedRange[0]*(1./major)) + 1.);
     2011      }
     2012    }
     2013  else
     2014    {
     2015      // If we have custom labels, they are supposed to be uniformly distributed
     2016      // inside the values range.
     2017      majorStart = sortedRange[0];
     2018      numTicks = this->GetNumTicks(range, major);
     2019      int labelsCount = customizedLabels->GetNumberOfValues();
     2020      if (numTicks > labelsCount)
     2021        {
     2022        major = range / (labelsCount - 1.);
     2023        }
     2024    }
     2025
     2026  minor = major / 10.;
     2027  // Figure out the first minor tick locations, relative to the
    19042028  // start of the axis.
    19052029  if (sortedRange[0] <= 0.)
    19062030    {
    1907     majorStart = major*(this->FFix(sortedRange[0]*(1./major)) + 0.);
    19082031    minorStart = minor*(this->FFix(sortedRange[0]*(1./minor)) + 0.);
    19092032    }
    19102033  else
    19112034    {
    1912     majorStart = major*(this->FFix(sortedRange[0]*(1./major)) + 1.);
    19132035    minorStart = minor*(this->FFix(sortedRange[0]*(1./minor)) + 1.);
    19142036    }
    19152037
    1916   for (int i = 0; i < 4; i++)
     2038  for (int i = 0; i < NUMBER_OF_ALIGNED_AXIS; i++)
    19172039    {
    19182040    axes[i]->SetMinorRangeStart(minorStart);
     
    19312053  major *= scale;
    19322054
    1933   for (int i = 0; i < 4; i++)
     2055  // Set major start and delta for the corresponding cube axis
     2056  switch(axes[0]->GetAxisType())
     2057    {
     2058    case VTK_AXIS_TYPE_X:
     2059      this->MajorStart[0] = majorStart;
     2060      this->DeltaMajor[0] = major;
     2061      break;
     2062    case VTK_AXIS_TYPE_Y:
     2063      this->MajorStart[1] = majorStart;
     2064      this->DeltaMajor[1] = major;
     2065      break;
     2066    case VTK_AXIS_TYPE_Z:
     2067      this->MajorStart[2] = majorStart;
     2068      this->DeltaMajor[2] = major;
     2069      break;
     2070    }
     2071
     2072  // Set major and minor starts and deltas for all underlying axes
     2073  for (int i = 0; i < NUMBER_OF_ALIGNED_AXIS; i++)
    19342074    {
    19352075    axes[i]->SetMinorStart(minorStart);
    1936     axes[i]->SetMajorStart(majorStart);
     2076    axes[i]->SetMajorStart(axes[0]->GetAxisType(), majorStart);
    19372077
    19382078    axes[i]->SetDeltaMinor(minor);
    1939     axes[i]->SetDeltaMajor(major);
    1940     }
     2079    axes[i]->SetDeltaMajor(axes[0]->GetAxisType(), major);
     2080    }
     2081}
     2082
     2083// ****************************************************************
     2084void vtkRpCubeAxesActor::AutoScale(vtkViewport *viewport)
     2085{
     2086  // Current implementation only for perspective projections.
     2087  this->AutoScale(viewport, this->XAxes);
     2088  this->AutoScale(viewport, this->YAxes);
     2089  this->AutoScale(viewport, this->ZAxes);
     2090}
     2091
     2092// ****************************************************************
     2093void vtkRpCubeAxesActor::AutoScale(vtkViewport *viewport, vtkRpAxisActor *axis[NUMBER_OF_ALIGNED_AXIS])
     2094{
     2095  for (int i = 0; i < NUMBER_OF_ALIGNED_AXIS; ++i)
     2096    {
     2097    double newTitleScale
     2098      = this->AutoScale(viewport,
     2099                        this->ScreenSize,
     2100                        axis[i]->GetTitleActor()->GetPosition());
     2101
     2102    axis[i]->SetTitleScale(newTitleScale);
     2103
     2104    // Now labels.
     2105    vtkRpAxisFollower** labelActors = axis[i]->GetLabelActors();
     2106
     2107    for(int j = 0; j < axis[i]->GetNumberOfLabelsBuilt(); ++j)
     2108      {
     2109      double newLabelScale
     2110        = this->AutoScale(viewport,
     2111                          this->ScreenSize,
     2112                          labelActors[j]->GetPosition());
     2113
     2114      labelActors[j]->SetScale(newLabelScale);
     2115      }
     2116    }
     2117}
     2118
     2119// ****************************************************************
     2120double vtkRpCubeAxesActor::AutoScale(vtkViewport *viewport, double screenSize,
     2121                                   double position[3])
     2122{
     2123  double factor = 1;
     2124  if (viewport->GetSize()[1] > 0)
     2125    {
     2126    factor = 2.0 * screenSize
     2127      * tan(vtkMath::RadiansFromDegrees(this->Camera->GetViewAngle()/2.0))
     2128      / viewport->GetSize()[1];
     2129    }
     2130
     2131    double dist = sqrt(
     2132          vtkMath::Distance2BetweenPoints(position,
     2133                                          this->Camera->GetPosition()));
     2134    double newScale = factor * dist;
     2135
     2136    return newScale;
    19412137}
    19422138
    19432139// ****************************************************************
    19442140//  Determine what the labels should be and set them in each axis.
    1945 //
    1946 //  Modification:
    1947 //    Kathleen Bonnell, Wed Aug  6 13:59:15 PDT 2003
    1948 //    Each axis type now has it's own 'mustAdjustValue' and 'pow'.
    1949 //
    1950 //    Kathleen Bonnell, Tue Jul 20 14:29:10 PDT 2004
    1951 //    Ensure that '-0.0' is never used as a label.
    1952 //
    1953 //    Eric Brugger, Mon Jul 26 16:09:26 PDT 2004
    1954 //    Correct a bug with a misplaced closing parenthesis.
    1955 //
    19562141// ****************************************************************
    1957 
    1958 void vtkRpCubeAxesActor::BuildLabels(vtkRpAxisActor *axes[4])
     2142void vtkRpCubeAxesActor::BuildLabels(vtkRpAxisActor *axes[NUMBER_OF_ALIGNED_AXIS])
    19592143{
    19602144  char label[64];
    1961   int i, labelCount = 0;
    1962   double deltaMajor = axes[0]->GetDeltaMajor();
    1963   const double *p2  = axes[0]->GetPoint2Coordinate()->GetValue();
    1964   double *range     = axes[0]->GetRange();
    1965   double lastVal = 0, val = axes[0]->GetMajorStart();
     2145  int labelCount = 0;
     2146  double deltaMajor = axes[0]->GetDeltaMajor(axes[0]->GetAxisType());
     2147  double val = axes[0]->GetMajorRangeStart();
     2148  double p2[3], p1[3];
     2149  axes[0]->GetPoint1Coordinate()->GetValue(p1);
     2150  axes[0]->GetPoint2Coordinate()->GetValue(p2);
     2151  double *range = axes[0]->GetRange();
     2152  double axis[3] = { p2[0]-p1[0], p2[1]-p1[1], p2[2]-p1[2] };
     2153  double axisLength = vtkMath::Norm(axis);
    19662154  double extents = range[1] - range[0];
     2155  double rangeScale = axisLength / extents;
     2156  double labelCountAsDouble = (axisLength - (val-range[0])*rangeScale) / deltaMajor;
    19672157  bool mustAdjustValue = 0;
    19682158  int lastPow = 0;
     2159  int axisIndex = 0;
     2160  vtkStringArray* customizedLabels = NULL;
    19692161
    19702162  vtkStringArray *labels = vtkStringArray::New();
     
    19732165    {
    19742166    case VTK_AXIS_TYPE_X:
    1975       lastVal = p2[0];
     2167      axisIndex = 0;
    19762168      format = this->XLabelFormat;
    19772169      mustAdjustValue = this->MustAdjustXValue;
     
    19792171      break;
    19802172    case VTK_AXIS_TYPE_Y:
    1981       lastVal = p2[1];
     2173      axisIndex = 1;
    19822174      format = this->YLabelFormat;
    19832175      mustAdjustValue = this->MustAdjustYValue;
     
    19852177      break;
    19862178    case VTK_AXIS_TYPE_Z:
    1987       lastVal = p2[2];
     2179      axisIndex = 2;
    19882180      format = this->ZLabelFormat;
    19892181      mustAdjustValue = this->MustAdjustZValue;
     
    19912183      break;
    19922184    }
    1993 
     2185  customizedLabels = this->AxisLabels[axisIndex];
    19942186  // figure out how many labels we need:
    1995   while (val <= lastVal && labelCount < VTK_MAX_LABELS)
    1996     {
    1997     labelCount++;
    1998     val += deltaMajor;
     2187  if(extents == 0 || vtkMath::IsNan(labelCountAsDouble))
     2188    {
     2189    labelCount = 0;
     2190    }
     2191  else
     2192    {
     2193    labelCount = vtkMath::Floor(labelCountAsDouble+2*FLT_EPSILON) + 1;
    19992194    }
    20002195
    20012196  labels->SetNumberOfValues(labelCount);
    20022197
    2003   val = axes[0]->GetMajorRangeStart();
    2004   deltaMajor = axes[0]->GetDeltaRangeMajor();
    2005 
    2006   double scaleFactor = 1.;
    2007   if (lastPow != 0)
    2008     {
    2009     scaleFactor = 1.0/pow(10., lastPow);
    2010     }
    2011 
    2012   for (i = 0; i < labelCount; i++)
    2013     {
    2014     if (fabs(val) < 0.01 && extents > 1)
    2015       {
    2016       // We just happened to fall at something near zero and the range is
    2017       // large, so set it to zero to avoid ugliness.
    2018       val = 0.;
    2019       }
    2020     if (mustAdjustValue)
    2021       {
    2022       sprintf(label, format, val*scaleFactor);
    2023       }
    2024     else
    2025       {
    2026       sprintf(label, format, val);
    2027       }
    2028     if (fabs(val) < 0.01)
    2029       {
    2030       //
    2031       // Ensure that -0.0 is never a label
    2032       // The maximum number of digits that we allow past the decimal is 5.
    2033       //
    2034       if (strcmp(label, "-0") == 0)
     2198  if (customizedLabels == NULL)
     2199    {
     2200    // Convert deltaMajor from world coord to range scale
     2201    deltaMajor = extents * deltaMajor/axisLength;
     2202
     2203    double scaleFactor = 1.;
     2204    if (lastPow != 0)
     2205      {
     2206      scaleFactor = 1.0/pow(10., lastPow);
     2207      }
     2208
     2209    for (int i = 0; i < labelCount; i++)
     2210      {
     2211      if (fabs(val) < 0.01 && extents > 1)
    20352212        {
    2036         sprintf(label, "0");
     2213        // We just happened to fall at something near zero and the range is
     2214        // large, so set it to zero to avoid ugliness.
     2215        val = 0.;
    20372216        }
    2038       else if (strcmp(label, "-0.0") == 0)
     2217      if (mustAdjustValue)
    20392218        {
    2040         sprintf(label, "0.0");
     2219        sprintf(label, format, val*scaleFactor);
    20412220        }
    2042       else if (strcmp(label, "-0.00") == 0)
     2221      else
    20432222        {
    2044         sprintf(label, "0.00");
     2223        sprintf(label, format, val);
    20452224        }
    2046       else if (strcmp(label, "-0.000") == 0)
     2225      if (fabs(val) < 0.01)
    20472226        {
    2048         sprintf(label, "0.000");
     2227        //
     2228        // Ensure that -0.0 is never a label
     2229        // The maximum number of digits that we allow past the decimal is 5.
     2230        //
     2231        if (strcmp(label, "-0") == 0)
     2232          {
     2233          sprintf(label, "0");
     2234          }
     2235        else if (strcmp(label, "-0.0") == 0)
     2236          {
     2237          sprintf(label, "0.0");
     2238          }
     2239        else if (strcmp(label, "-0.00") == 0)
     2240          {
     2241          sprintf(label, "0.00");
     2242          }
     2243        else if (strcmp(label, "-0.000") == 0)
     2244          {
     2245          sprintf(label, "0.000");
     2246          }
     2247        else if (strcmp(label, "-0.0000") == 0)
     2248          {
     2249          sprintf(label, "0.0000");
     2250          }
     2251        else if (strcmp(label, "-0.00000") == 0)
     2252          {
     2253          sprintf(label, "0.00000");
     2254          }
    20492255        }
    2050       else if (strcmp(label, "-0.0000") == 0)
     2256      labels->SetValue(i, label);
     2257      val += deltaMajor;
     2258      }
     2259    }
     2260  else
     2261    {
     2262    if (labelCount > 0)
     2263      {
     2264      double delta = customizedLabels->GetNumberOfValues() / labelCount;
     2265      for (int i = 0; i < labelCount; ++i)
    20512266        {
    2052         sprintf(label, "0.0000");
     2267        labels->SetValue(i, customizedLabels->GetValue(i * delta));
    20532268        }
    2054       else if (strcmp(label, "-0.00000") == 0)
    2055         {
    2056         sprintf(label, "0.00000");
    2057         }
    2058       }
    2059     labels->SetValue(i, label);
    2060     val += deltaMajor;
    2061     }
    2062   for (i = 0; i < 4; i++)
     2269      }
     2270    }
     2271  for (int i = 0; i < NUMBER_OF_ALIGNED_AXIS; i++)
    20632272    {
    20642273    axes[i]->SetLabels(labels);
    20652274    }
    20662275  labels->Delete();
     2276}
     2277
     2278vtkStringArray* vtkRpCubeAxesActor::GetAxisLabels(int axis)
     2279{
     2280  return (axis >= 0 && axis < 3) ? this->AxisLabels[axis] : NULL;
     2281}
     2282
     2283void vtkRpCubeAxesActor::SetAxisLabels(int axis, vtkStringArray* value)
     2284{
     2285  if (axis >= 0 && axis < 3 && value != this->AxisLabels[axis])
     2286    {
     2287    vtkStringArray* previous = this->AxisLabels[axis];
     2288    if (value != NULL)
     2289      {
     2290      value->Register(this);
     2291      }
     2292    this->AxisLabels[axis] = value;
     2293    if (previous != NULL)
     2294      {
     2295      previous->UnRegister(this);
     2296      }
     2297    this->Modified();
     2298    }
    20672299}
    20682300
    20692301// ****************************************************************************
    20702302//  Set automatic label scaling mode, set exponents for each axis type.
    2071 //
    20722303// ****************************************************************************
    20732304void vtkRpCubeAxesActor::SetLabelScaling(bool autoscale, int upowX, int upowY,
     
    20842315    }
    20852316}
     2317
     2318// ****************************************************************************
     2319// Set the i-th title text property.
     2320// ****************************************************************************
     2321
     2322vtkTextProperty* vtkRpCubeAxesActor::GetTitleTextProperty(int axis)
     2323{
     2324  return (axis >= 0 && axis < 3) ? this->TitleTextProperty[axis] : NULL;
     2325}
     2326
     2327// ****************************************************************************
     2328// Get the i-th label text property.
     2329// ****************************************************************************
     2330
     2331vtkTextProperty* vtkRpCubeAxesActor::GetLabelTextProperty(int axis)
     2332{
     2333  return (axis >= 0 && axis < 3) ? this->LabelTextProperty[axis] : NULL;
     2334}
     2335
     2336// ****************************************************************************
     2337//  Set axes and screen size of the labels.
     2338// ****************************************************************************
     2339void vtkRpCubeAxesActor::UpdateLabels(vtkRpAxisActor **axis, int index)
     2340  {
     2341  for (int i = 0; i < NUMBER_OF_ALIGNED_AXIS; i++)
     2342    {
     2343    int numberOfLabelsBuild = axis[i]->GetNumberOfLabelsBuilt();
     2344    vtkRpAxisFollower **labelActors = axis[i]->GetLabelActors();
     2345    for(int k=0; k < numberOfLabelsBuild; ++k)
     2346      {
     2347      if(index == 0)
     2348        {
     2349        labelActors[k]->SetAxis(this->XAxes[i]);
     2350        }
     2351      else if(index == 1)
     2352        {
     2353        labelActors[k]->SetAxis(this->YAxes[i]);
     2354        }
     2355      else if(index == 2)
     2356        {
     2357        labelActors[k]->SetAxis(this->ZAxes[i]);
     2358        }
     2359      else
     2360        {
     2361        // Do nothing.
     2362        }
     2363
     2364      labelActors[k]->SetScreenOffset(this->LabelScreenOffset);
     2365      labelActors[k]->SetEnableDistanceLOD( this->EnableDistanceLOD );
     2366      labelActors[k]->SetDistanceLODThreshold( this->DistanceLODThreshold );
     2367      labelActors[k]->SetEnableViewAngleLOD( this->EnableViewAngleLOD );
     2368      labelActors[k]->SetViewAngleLODThreshold( this->ViewAngleLODThreshold );
     2369      }
     2370    }
     2371  }
     2372// ****************************************************************************
     2373void vtkRpCubeAxesActor::SetXAxesLinesProperty(vtkProperty *prop)
     2374{
     2375  this->XAxesLinesProperty->DeepCopy(prop);
     2376  this->Modified();
     2377}
     2378void vtkRpCubeAxesActor::SetYAxesLinesProperty(vtkProperty *prop)
     2379{
     2380  this->YAxesLinesProperty->DeepCopy(prop);
     2381  this->Modified();
     2382}
     2383void vtkRpCubeAxesActor::SetZAxesLinesProperty(vtkProperty *prop)
     2384{
     2385  this->ZAxesLinesProperty->DeepCopy(prop);
     2386  this->Modified();
     2387}
     2388
     2389// ****************************************************************************
     2390vtkProperty* vtkRpCubeAxesActor::GetXAxesLinesProperty()
     2391{
     2392  return this->XAxesLinesProperty;
     2393}
     2394vtkProperty* vtkRpCubeAxesActor::GetYAxesLinesProperty()
     2395{
     2396  return this->YAxesLinesProperty;
     2397}
     2398vtkProperty* vtkRpCubeAxesActor::GetZAxesLinesProperty()
     2399{
     2400  return this->ZAxesLinesProperty;
     2401}
     2402
     2403// ****************************************************************************
     2404void vtkRpCubeAxesActor::SetXAxesGridlinesProperty(vtkProperty *prop)
     2405{
     2406  this->XAxesGridlinesProperty->DeepCopy(prop);
     2407  this->Modified();
     2408}
     2409void vtkRpCubeAxesActor::SetYAxesGridlinesProperty(vtkProperty *prop)
     2410{
     2411  this->YAxesGridlinesProperty->DeepCopy(prop);
     2412  this->Modified();
     2413}
     2414void vtkRpCubeAxesActor::SetZAxesGridlinesProperty(vtkProperty *prop)
     2415{
     2416  this->ZAxesGridlinesProperty->DeepCopy(prop);
     2417  this->Modified();
     2418}
     2419
     2420// ****************************************************************************
     2421vtkProperty* vtkRpCubeAxesActor::GetXAxesGridlinesProperty()
     2422{
     2423  return this->XAxesGridlinesProperty;
     2424}
     2425vtkProperty* vtkRpCubeAxesActor::GetYAxesGridlinesProperty()
     2426{
     2427  return this->YAxesGridlinesProperty;
     2428}
     2429vtkProperty* vtkRpCubeAxesActor::GetZAxesGridlinesProperty()
     2430{
     2431  return this->ZAxesGridlinesProperty;
     2432}
     2433
     2434// ****************************************************************************
     2435void vtkRpCubeAxesActor::SetXAxesInnerGridlinesProperty(vtkProperty *prop)
     2436{
     2437  this->XAxesInnerGridlinesProperty->DeepCopy(prop);
     2438  this->Modified();
     2439}
     2440void vtkRpCubeAxesActor::SetYAxesInnerGridlinesProperty(vtkProperty *prop)
     2441{
     2442  this->YAxesInnerGridlinesProperty->DeepCopy(prop);
     2443  this->Modified();
     2444}
     2445void vtkRpCubeAxesActor::SetZAxesInnerGridlinesProperty(vtkProperty *prop)
     2446{
     2447  this->ZAxesInnerGridlinesProperty->DeepCopy(prop);
     2448  this->Modified();
     2449}
     2450
     2451// ****************************************************************************
     2452vtkProperty* vtkRpCubeAxesActor::GetXAxesInnerGridlinesProperty()
     2453{
     2454  return this->XAxesInnerGridlinesProperty;
     2455}
     2456vtkProperty* vtkRpCubeAxesActor::GetYAxesInnerGridlinesProperty()
     2457{
     2458  return this->YAxesInnerGridlinesProperty;
     2459}
     2460vtkProperty* vtkRpCubeAxesActor::GetZAxesInnerGridlinesProperty()
     2461{
     2462  return this->ZAxesInnerGridlinesProperty;
     2463}
     2464
     2465// ****************************************************************************
     2466void vtkRpCubeAxesActor::SetXAxesGridpolysProperty(vtkProperty *prop)
     2467{
     2468  this->XAxesGridpolysProperty->DeepCopy(prop);
     2469  this->Modified();
     2470}
     2471void vtkRpCubeAxesActor::SetYAxesGridpolysProperty(vtkProperty *prop)
     2472{
     2473  this->YAxesGridpolysProperty->DeepCopy(prop);
     2474  this->Modified();
     2475}
     2476void vtkRpCubeAxesActor::SetZAxesGridpolysProperty(vtkProperty *prop)
     2477{
     2478  this->ZAxesGridpolysProperty->DeepCopy(prop);
     2479  this->Modified();
     2480}
     2481
     2482// ****************************************************************************
     2483vtkProperty* vtkRpCubeAxesActor::GetXAxesGridpolysProperty()
     2484{
     2485  return this->XAxesGridpolysProperty;
     2486}
     2487vtkProperty* vtkRpCubeAxesActor::GetYAxesGridpolysProperty()
     2488{
     2489  return this->YAxesGridpolysProperty;
     2490}
     2491vtkProperty* vtkRpCubeAxesActor::GetZAxesGridpolysProperty()
     2492{
     2493  return this->ZAxesGridpolysProperty;
     2494}
     2495// --------------------------------------------------------------------------
     2496void vtkRpCubeAxesActor::UpdateGridLineVisibility(int idx)
     2497{
     2498  if( this->GridLineLocation != VTK_GRID_LINES_ALL &&
     2499      (this->DrawXGridlines || this->DrawYGridlines || this->DrawZGridlines) )
     2500    {
     2501    for(int i=0; i < NUMBER_OF_ALIGNED_AXIS; ++i)
     2502      {
     2503      this->XAxes[i]->SetDrawGridlines(0);
     2504      this->YAxes[i]->SetDrawGridlines(0);
     2505      this->ZAxes[i]->SetDrawGridlines(0);
     2506      this->XAxes[i]->SetDrawGridlinesOnly(0);
     2507      this->YAxes[i]->SetDrawGridlinesOnly(0);
     2508      this->ZAxes[i]->SetDrawGridlinesOnly(0);
     2509      }
     2510
     2511    this->XAxes[vtkRpCubeAxesActorTriads[idx][0]]->SetDrawGridlines(this->DrawXGridlines);
     2512    this->YAxes[vtkRpCubeAxesActorTriads[idx][1]]->SetDrawGridlines(this->DrawYGridlines);
     2513    this->ZAxes[vtkRpCubeAxesActorTriads[idx][2]]->SetDrawGridlines(this->DrawZGridlines);
     2514
     2515    // Update axis render list
     2516    int id = 0;
     2517    if(this->NumberOfAxesX == 1)
     2518      {
     2519      id = this->RenderAxesX[this->NumberOfAxesX] = vtkRpCubeAxesActorTriads[idx][0];
     2520      this->XAxes[id]->SetDrawGridlinesOnly((this->RenderAxesX[0] != id) ? 1 : 0);
     2521      this->NumberOfAxesX += (this->RenderAxesX[0] != id) ? 1 : 0;
     2522      }
     2523    if(this->NumberOfAxesY == 1)
     2524      {
     2525      id = this->RenderAxesY[this->NumberOfAxesY] = vtkRpCubeAxesActorTriads[idx][1];
     2526      this->YAxes[id]->SetDrawGridlinesOnly((this->RenderAxesY[0] != id) ? 1 : 0);
     2527      this->NumberOfAxesY += (this->RenderAxesY[0] != id) ? 1 : 0;
     2528      }
     2529    if(this->NumberOfAxesZ == 1)
     2530      {
     2531      id = this->RenderAxesZ[this->NumberOfAxesZ] = vtkRpCubeAxesActorTriads[idx][2];
     2532      this->ZAxes[id]->SetDrawGridlinesOnly((this->RenderAxesZ[0] != id) ? 1 : 0);
     2533      this->NumberOfAxesZ += (this->RenderAxesZ[0] != id) ? 1 : 0;
     2534      }
     2535    }
     2536}
     2537// --------------------------------------------------------------------------
     2538int vtkRpCubeAxesActor::FindClosestAxisIndex(double pts[8][3])
     2539{
     2540  // Loop over points and find the closest point to the camera
     2541  double min = VTK_LARGE_FLOAT;
     2542  int idx = 0;
     2543  for (int i=0; i < 8; i++)
     2544    {
     2545    if (pts[i][2] < min)
     2546      {
     2547      idx = i;
     2548      min = pts[i][2];
     2549      }
     2550    }
     2551  return idx;
     2552}
     2553
     2554// --------------------------------------------------------------------------
     2555int vtkRpCubeAxesActor::FindFurtherstAxisIndex(double pts[8][3])
     2556{
     2557  // Loop over points and find the furthest point from the camera
     2558  double max = -VTK_LARGE_FLOAT;
     2559  int idx = 0;
     2560  for (int i=0; i < 8; i++)
     2561    {
     2562    if (pts[i][2] > max)
     2563      {
     2564      idx = i;
     2565      max = pts[i][2];
     2566      }
     2567    }
     2568  return idx;
     2569}
     2570// --------------------------------------------------------------------------
     2571 void vtkRpCubeAxesActor::FindBoundaryEdge( int &xloc, int &yloc,
     2572                                          int &zloc, double pts[8][3])
     2573 {
     2574   // boundary edges fly mode
     2575   xloc = yloc = zloc = 1;
     2576   int i, xIdx = 0, yIdx = 0, zIdx = 0, zIdx2 = 0;
     2577   int xAxes = 0, yAxes = 0, zAxes = 0;
     2578   double slope = 0.0, minSlope, num, den, d2;
     2579   double e1[3], e2[3], e3[3];
     2580   int idx = 0;
     2581
     2582   // Find distance to origin
     2583   double d2Min = VTK_LARGE_FLOAT;
     2584   for (i=0; i < 8; i++)
     2585     {
     2586     d2 = pts[i][0]*pts[i][0] + pts[i][1]*pts[i][1];
     2587     if (d2 < d2Min)
     2588       {
     2589       d2Min = d2;
     2590       idx = i;
     2591       }
     2592     }
     2593
     2594   // find minimum slope point connected to closest point and on
     2595   // right side (in projected coordinates). This is the first edge.
     2596   minSlope = VTK_LARGE_FLOAT;
     2597   for (xIdx=0, i=0; i<3; i++)
     2598     {
     2599     num = (pts[vtkRpCubeAxesActorConn[idx][i]][1] - pts[idx][1]);
     2600     den = (pts[vtkRpCubeAxesActorConn[idx][i]][0] - pts[idx][0]);
     2601     if (den != 0.0)
     2602       {
     2603       slope = num / den;
     2604       }
     2605     if (slope < minSlope && den > 0)
     2606       {
     2607       xIdx = vtkRpCubeAxesActorConn[idx][i];
     2608       yIdx = vtkRpCubeAxesActorConn[idx][(i+1)%3];
     2609       zIdx = vtkRpCubeAxesActorConn[idx][(i+2)%3];
     2610       xAxes = i;
     2611       minSlope = slope;
     2612       }
     2613     }
     2614
     2615   // find edge (connected to closest point) on opposite side
     2616   for ( i=0; i<3; i++)
     2617     {
     2618     e1[i] = (pts[xIdx][i] - pts[idx][i]);
     2619     e2[i] = (pts[yIdx][i] - pts[idx][i]);
     2620     e3[i] = (pts[zIdx][i] - pts[idx][i]);
     2621     }
     2622   vtkMath::Normalize(e1);
     2623   vtkMath::Normalize(e2);
     2624   vtkMath::Normalize(e3);
     2625
     2626   if (vtkMath::Dot(e1,e2) < vtkMath::Dot(e1,e3))
     2627     {
     2628     yAxes = (xAxes + 1) % 3;
     2629     }
     2630   else
     2631     {
     2632     yIdx = zIdx;
     2633     yAxes = (xAxes + 2) % 3;
     2634     }
     2635
     2636   // Find the final point by determining which global x-y-z axes have not
     2637   // been represented, and then determine the point closest to the viewer.
     2638   zAxes = (xAxes != 0 && yAxes != 0 ? 0 :
     2639           (xAxes != 1 && yAxes != 1 ? 1 : 2));
     2640   if (pts[vtkRpCubeAxesActorConn[xIdx][zAxes]][2] <
     2641       pts[vtkRpCubeAxesActorConn[yIdx][zAxes]][2])
     2642     {
     2643     zIdx = xIdx;
     2644     zIdx2 = vtkRpCubeAxesActorConn[xIdx][zAxes];
     2645     }
     2646   else
     2647     {
     2648     zIdx = yIdx;
     2649     zIdx2 = vtkRpCubeAxesActorConn[yIdx][zAxes];
     2650     }
     2651
     2652   int mini = (idx < xIdx ? idx : xIdx);
     2653   switch (xAxes)
     2654     {
     2655     case 0:
     2656       xloc = vtkRpCubeAxesActorTriads[mini][0];
     2657       break;
     2658     case 1:
     2659       yloc = vtkRpCubeAxesActorTriads[mini][1];
     2660       break;
     2661     case 2:
     2662       zloc = vtkRpCubeAxesActorTriads[mini][2];
     2663       break;
     2664     }
     2665   mini = (idx < yIdx ? idx : yIdx);
     2666   switch (yAxes)
     2667     {
     2668     case 0:
     2669       xloc = vtkRpCubeAxesActorTriads[mini][0];
     2670       break;
     2671     case 1:
     2672       yloc =vtkRpCubeAxesActorTriads[mini][1];
     2673       break;
     2674     case 2:
     2675       zloc = vtkRpCubeAxesActorTriads[mini][2];
     2676       break;
     2677     }
     2678   mini = (zIdx < zIdx2 ? zIdx : zIdx2);
     2679   switch (zAxes)
     2680     {
     2681     case 0:
     2682       xloc = vtkRpCubeAxesActorTriads[mini][0];
     2683       break;
     2684     case 1:
     2685       yloc = vtkRpCubeAxesActorTriads[mini][1];
     2686       break;
     2687     case 2:
     2688       zloc = vtkRpCubeAxesActorTriads[mini][2];
     2689       break;
     2690     }
     2691 }
     2692
     2693// --------------------------------------------------------------------------
     2694int vtkRpCubeAxesActor::RenderGeometry(
     2695    bool &initialRender, vtkViewport *viewport, bool checkAxisVisibility,
     2696    int (vtkRpAxisActor::*renderMethod)(vtkViewport*))
     2697{
     2698  int i, renderedSomething = 0;
     2699
     2700  // Make sure axes are initialized and visibility is properly set
     2701  if(checkAxisVisibility)
     2702    {
     2703    // Initialization
     2704    if (!this->Camera)
     2705      {
     2706      vtkErrorMacro(<<"No camera!");
     2707      this->RenderSomething = 0;
     2708      return 0;
     2709      }
     2710
     2711    this->BuildAxes(viewport);
     2712
     2713    if (initialRender)
     2714      {
     2715      for (i = 0; i < NUMBER_OF_ALIGNED_AXIS; i++)
     2716        {
     2717        this->XAxes[i]->BuildAxis(viewport, true);
     2718        this->YAxes[i]->BuildAxis(viewport, true);
     2719        this->ZAxes[i]->BuildAxis(viewport, true);
     2720        }
     2721      }
     2722    initialRender = false;
     2723
     2724    this->DetermineRenderAxes(viewport);
     2725    }
     2726
     2727  // Render the axes
     2728  for (i = 0; i < this->NumberOfAxesX; i++)
     2729    {
     2730    renderedSomething +=
     2731        (this->XAxes[this->RenderAxesX[i]]->*renderMethod)(viewport);
     2732    }
     2733
     2734  for (i = 0; i < this->NumberOfAxesY; i++)
     2735    {
     2736    renderedSomething +=
     2737        (this->YAxes[this->RenderAxesY[i]]->*renderMethod)(viewport);
     2738    }
     2739
     2740  for (i = 0; i < this->NumberOfAxesZ; i++)
     2741    {
     2742    renderedSomething +=
     2743        (this->ZAxes[this->RenderAxesZ[i]]->*renderMethod)(viewport);
     2744    }
     2745  return renderedSomething;
     2746}
     2747
     2748// --------------------------------------------------------------------------
     2749void vtkRpCubeAxesActor::GetRenderedBounds(double *b)
     2750{
     2751  vtkBoundingBox bbox(this->GetBounds()); // Data bounds
     2752
     2753  // Make a heuristic on the final bounds that embed test labels
     2754  // Just inflate the box based on its max length
     2755  bbox.Inflate(bbox.GetMaxLength());
     2756
     2757  bbox.GetBounds(b);
     2758}
     2759
     2760// --------------------------------------------------------------------------
     2761double* vtkRpCubeAxesActor::GetRenderedBounds()
     2762{
     2763  this->GetRenderedBounds(this->RenderedBounds);
     2764  // Return our data holder
     2765  return this->RenderedBounds;
     2766}
  • trunk/packages/vizservers/vtkvis/vtkRpCubeAxesActor.h

    r2864 r3479  
    4242// the bounding box.
    4343//
    44 // .SECTION See Also
    45 // vtkActor vtkRpAxisActor vtkRpCubeAxesActor2D
     44// .SECTION Thanks
     45// This class was written by:
     46// Hank Childs, Kathleen Bonnell, Amy Squillacote, Brad Whitlock, Will Schroeder,
     47// Eric Brugger, Daniel Aguilera, Claire Guilbaud, Nicolas Dolegieviez,
     48// Aashish Chaudhary, Philippe Pebay, David Gobbi, David Partyka, Utkarsh Ayachit
     49// David Cole, Francois Bertel, and Mark Olesen
     50// Part of this work was supported by CEA/DIF - Commissariat a l'Energie Atomique,
     51// Centre DAM Ile-De-France, BP12, F-91297 Arpajon, France.
     52//
     53// .section See Also
     54// vtkActor vtkAxisActor vtkCubeAxesActor2D
    4655
    4756#ifndef __vtkRpCubeAxesActor_h
     
    5867#define VTK_TICKS_BOTH          2
    5968
     69#define VTK_GRID_LINES_ALL      0
     70#define VTK_GRID_LINES_CLOSEST  1
     71#define VTK_GRID_LINES_FURTHEST 2
     72
     73#define NUMBER_OF_ALIGNED_AXIS 4
     74
     75#include "vtkRenderingAnnotationModule.h" // For export macro
    6076#include "vtkActor.h"
    6177
    6278class vtkRpAxisActor;
    6379class vtkCamera;
    64 
    65 class VTK_HYBRID_EXPORT vtkRpCubeAxesActor : public vtkActor
     80class vtkTextProperty;
     81class vtkStringArray;
     82
     83class VTKRENDERINGANNOTATION_EXPORT vtkRpCubeAxesActor : public vtkActor
    6684{
    6785public:
     
    7795  // Draw the axes as per the vtkProp superclass' API.
    7896  virtual int RenderOpaqueGeometry(vtkViewport*);
    79   virtual int RenderTranslucentGeometry(vtkViewport *) {return 0;}
     97  virtual int RenderTranslucentGeometry(vtkViewport*);
     98  virtual int RenderTranslucentPolygonalGeometry(vtkViewport*);
     99  virtual int RenderOverlay(vtkViewport*);
     100  int HasTranslucentPolygonalGeometry();
     101
     102  // Description:
     103  // Gets/Sets the RebuildAxes flag
     104  vtkSetMacro( RebuildAxes, bool );
     105  vtkGetMacro( RebuildAxes, bool );
    80106
    81107  // Description:
     
    85111  // sure that the min's are less than the max's.
    86112  vtkSetVector6Macro(Bounds,double);
    87   double *GetBounds();
    88   void GetBounds(double& xmin, double& xmax, double& ymin, double& ymax,
    89                  double& zmin, double& zmax);
    90   void GetBounds(double bounds[6]);
     113  vtkGetVector6Macro(Bounds,double);
     114
     115  // Description:
     116  // Method used to properly return the bounds of the cube axis itself with all
     117  // its labels.
     118  virtual void GetRenderedBounds(double rBounds[6]);
     119  virtual double* GetRenderedBounds();
    91120
    92121  // Description:
     
    102131  vtkGetVector2Macro( XAxisRange, double );
    103132  vtkGetVector2Macro( YAxisRange, double );
     133  // Description
     134  // Explicitly specify the axis labels along an axis as an array of strings
     135  // instead of using the values.
     136  vtkStringArray* GetAxisLabels(int axis);
     137  void SetAxisLabels(int axis, vtkStringArray* value);
     138
    104139  vtkGetVector2Macro( ZAxisRange, double );
     140
     141  // Description:
     142  // Explicitly specify the screen size of title and label text.
     143  // ScreenSize detemines the size of the text in terms of screen
     144  // pixels. Default is 10.0.
     145  void SetScreenSize(double screenSize);
     146  vtkGetMacro(ScreenSize, double);
    105147
    106148  // Description:
     
    174216
    175217  // Description:
     218  // Enable and disable the use of distance based LOD for titles and labels.
     219  vtkSetMacro( EnableDistanceLOD, int );
     220  vtkGetMacro( EnableDistanceLOD, int );
     221
     222  // Description:a
     223  // Set distance LOD threshold [0.0 - 1.0] for titles and labels.
     224  vtkSetClampMacro( DistanceLODThreshold, double, 0.0, 1.0 );
     225  vtkGetMacro( DistanceLODThreshold, double);
     226
     227  // Description:
     228  // Enable and disable the use of view angle based LOD for titles and labels.
     229  vtkSetMacro( EnableViewAngleLOD, int );
     230  vtkGetMacro( EnableViewAngleLOD, int );
     231
     232  // Description:
     233  // Set view angle LOD threshold [0.0 - 1.0] for titles and labels.
     234  vtkSetClampMacro( ViewAngleLODThreshold, double, 0., 1. );
     235  vtkGetMacro( ViewAngleLODThreshold, double );
     236
     237  // Description:
    176238  // Turn on and off the visibility of each axis.
    177239  vtkSetMacro(XAxisVisibility,int);
     
    239301  vtkBooleanMacro(DrawZGridlines,int);
    240302
     303  vtkSetMacro(DrawXInnerGridlines,int);
     304  vtkGetMacro(DrawXInnerGridlines,int);
     305  vtkBooleanMacro(DrawXInnerGridlines,int);
     306
     307  vtkSetMacro(DrawYInnerGridlines,int);
     308  vtkGetMacro(DrawYInnerGridlines,int);
     309  vtkBooleanMacro(DrawYInnerGridlines,int);
     310
     311  vtkSetMacro(DrawZInnerGridlines,int);
     312  vtkGetMacro(DrawZInnerGridlines,int);
     313  vtkBooleanMacro(DrawZInnerGridlines,int);
     314
     315  vtkSetMacro(DrawXGridpolys,int);
     316  vtkGetMacro(DrawXGridpolys,int);
     317  vtkBooleanMacro(DrawXGridpolys,int);
     318
     319  vtkSetMacro(DrawYGridpolys,int);
     320  vtkGetMacro(DrawYGridpolys,int);
     321  vtkBooleanMacro(DrawYGridpolys,int);
     322
     323  vtkSetMacro(DrawZGridpolys,int);
     324  vtkGetMacro(DrawZGridpolys,int);
     325  vtkBooleanMacro(DrawZGridpolys,int);
     326
     327  // Description:
     328  // Returns the text property for the title on an axis.
     329  vtkTextProperty *GetTitleTextProperty(int);
     330
     331  // Description:
     332  // Returns the text property for the labels on an axis.
     333  vtkTextProperty *GetLabelTextProperty(int);
     334
     335  // Description:
     336  // Get/Set axes actors properties.
     337  void SetXAxesLinesProperty(vtkProperty *);
     338  vtkProperty* GetXAxesLinesProperty();
     339  void SetYAxesLinesProperty(vtkProperty *);
     340  vtkProperty* GetYAxesLinesProperty();
     341  void SetZAxesLinesProperty(vtkProperty *);
     342  vtkProperty* GetZAxesLinesProperty();
     343
     344  // Description:
     345  // Get/Set axes (outer) gridlines actors properties.
     346  void SetXAxesGridlinesProperty(vtkProperty *);
     347  vtkProperty* GetXAxesGridlinesProperty();
     348  void SetYAxesGridlinesProperty(vtkProperty *);
     349  vtkProperty* GetYAxesGridlinesProperty();
     350  void SetZAxesGridlinesProperty(vtkProperty *);
     351  vtkProperty* GetZAxesGridlinesProperty();
     352
     353  // Description:
     354  // Get/Set axes inner gridlines actors properties.
     355  void SetXAxesInnerGridlinesProperty(vtkProperty *);
     356  vtkProperty* GetXAxesInnerGridlinesProperty();
     357  void SetYAxesInnerGridlinesProperty(vtkProperty *);
     358  vtkProperty* GetYAxesInnerGridlinesProperty();
     359  void SetZAxesInnerGridlinesProperty(vtkProperty *);
     360  vtkProperty* GetZAxesInnerGridlinesProperty();
     361
     362  // Description:
     363  // Get/Set axes gridPolys actors properties.
     364  void SetXAxesGridpolysProperty(vtkProperty *);
     365  vtkProperty* GetXAxesGridpolysProperty();
     366  void SetYAxesGridpolysProperty(vtkProperty *);
     367  vtkProperty* GetYAxesGridpolysProperty();
     368  void SetZAxesGridpolysProperty(vtkProperty *);
     369  vtkProperty* GetZAxesGridpolysProperty();
     370
    241371  // Description:
    242372  // Set/Get the location of ticks marks.
     
    252382
    253383  void SetLabelScaling(bool, int, int, int);
    254   // Description:
    255   // Shallow copy of a KatCubeAxesActor.
    256   void ShallowCopy(vtkRpCubeAxesActor *actor);
     384
     385  // Description:
     386  // Get/Set 2D mode
     387  // NB: Use vtkTextActor for titles in 2D instead of vtkRpAxisFollower
     388  void SetUse2DMode( int val );
     389  int GetUse2DMode();
     390
     391  // Description:
     392  // For 2D mode only: save axis title positions for later use
     393  void SetSaveTitlePosition( int val );
     394
     395  // Description:
     396  // Provide an oriented bounded box when using AxisBaseFor.
     397  vtkSetVector6Macro(OrientedBounds,double);
     398  vtkGetVector6Macro(OrientedBounds, double);
     399
     400  // Description:
     401  // Enable/Disable the usage of the OrientedBounds
     402  vtkSetMacro(UseOrientedBounds, int);
     403  vtkGetMacro(UseOrientedBounds, int);
     404
     405  // Description:
     406  // Vector that should be use as the base for X
     407  vtkSetVector3Macro(AxisBaseForX,double);
     408  vtkGetVector3Macro(AxisBaseForX, double);
     409
     410  // Description:
     411  // Vector that should be use as the base for Y
     412  vtkSetVector3Macro(AxisBaseForY,double);
     413  vtkGetVector3Macro(AxisBaseForY, double);
     414
     415  // Description:
     416  // Vector that should be use as the base for Z
     417  vtkSetVector3Macro(AxisBaseForZ,double);
     418  vtkGetVector3Macro(AxisBaseForZ, double);
     419
     420  // Description:
     421  // Provide a custom AxisOrigin. This point must be inside the bouding box and
     422  // will represent the point where the 3 axes will interesect
     423  vtkSetVector3Macro(AxisOrigin,double);
     424  vtkGetVector3Macro(AxisOrigin, double);
     425
     426  // Description:
     427  // Enable/Disable the usage of the AxisOrigin
     428  vtkSetMacro(UseAxisOrigin, int);
     429  vtkGetMacro(UseAxisOrigin, int);
     430
     431  // Description:
     432  // Specify the mode in which the cube axes should render its gridLines
     433  vtkSetMacro(GridLineLocation,int);
     434  vtkGetMacro(GridLineLocation,int);
     435
     436  vtkSetMacro(XAutoLabelFormat,int);
     437  vtkGetMacro(XAutoLabelFormat,int);
     438  vtkBooleanMacro(XAutoLabelFormat,int);
     439  vtkSetMacro(YAutoLabelFormat,int);
     440  vtkGetMacro(YAutoLabelFormat,int);
     441  vtkBooleanMacro(YAutoLabelFormat,int);
     442  vtkSetMacro(ZAutoLabelFormat,int);
     443  vtkGetMacro(ZAutoLabelFormat,int);
     444  vtkBooleanMacro(ZAutoLabelFormat,int);
    257445
    258446protected:
     
    261449
    262450  int LabelExponent(double min, double max);
     451
    263452  int Digits(double min, double max);
     453
    264454  double MaxOf(double, double);
    265455  double MaxOf(double, double, double, double);
     456
    266457  double FFix(double);
    267458  double FSign(double, double);
    268 
    269   double       Bounds[6]; //Define bounds explicitly
     459  int FRound( double fnt );
     460  int GetNumTicks( double range, double fxt);
     461
     462  void UpdateLabels(vtkRpAxisActor **axis, int index);
     463
     464  double Bounds[6]; //Define bounds explicitly
    270465
    271466  vtkCamera *Camera;
     467
    272468  int FlyMode;
    273469
    274   // to control all axes
    275   // [0] always for 'Major' axis during non-static fly modes.
    276   vtkRpAxisActor *XAxes[4];
    277   vtkRpAxisActor *YAxes[4];
    278   vtkRpAxisActor *ZAxes[4];
     470  // Expose internally closest axis index computation
     471  int FindClosestAxisIndex(double pts[8][3]);
     472
     473  // Expose internally furthest axis index computation
     474  int FindFurtherstAxisIndex(double pts[8][3]);
     475
     476  // Expose internally the boundary edge fly mode axis index computation
     477  void FindBoundaryEdge(int &indexOfAxisX, int &indexOfAxisY, int &indexOfAxisZ,
     478                        double pts[8][3]);
     479
     480  // Description:
     481  // This will Update AxisActors with GridVisibility when those should be
     482  // dynamaic regarding the viewport.
     483  // GridLineLocation = [VTK_CLOSEST_GRID_LINES, VTK_FURTHEST_GRID_LINES]
     484  void UpdateGridLineVisibility(int axisIndex);
     485
     486  // VTK_ALL_GRID_LINES      0
     487  // VTK_CLOSEST_GRID_LINES  1
     488  // VTK_FURTHEST_GRID_LINES 2
     489  int GridLineLocation;
     490
     491  // Description:
     492  // If enabled the actor will not be visible at a certain distance from the camera.
     493  // Default is true
     494  int EnableDistanceLOD;
     495
     496  // Description:
     497  // Default is 0.80
     498  // This determines at what fraction of camera far clip range, actor is not visible.
     499  double DistanceLODThreshold;
     500
     501  // Description:
     502  // If enabled the actor will not be visible at a certain view angle.
     503  // Default is true.
     504  int EnableViewAngleLOD;
     505
     506  // Description:
     507  // This determines at what view angle to geometry will make the geometry not visibile.
     508  // Default is 0.3.
     509  double ViewAngleLODThreshold;
     510
     511  // Description:
     512  // Control variables for all axes
     513  // NB: [0] always for 'Major' axis during non-static fly modes.
     514  vtkRpAxisActor *XAxes[NUMBER_OF_ALIGNED_AXIS];
     515  vtkRpAxisActor *YAxes[NUMBER_OF_ALIGNED_AXIS];
     516  vtkRpAxisActor *ZAxes[NUMBER_OF_ALIGNED_AXIS];
     517
     518  bool RebuildAxes;
    279519
    280520  char *XTitle;
     
    311551  int DrawZGridlines;
    312552
     553  int DrawXInnerGridlines;
     554  int DrawYInnerGridlines;
     555  int DrawZInnerGridlines;
     556
     557  int DrawXGridpolys;
     558  int DrawYGridpolys;
     559  int DrawZGridpolys;
     560
    313561  char  *XLabelFormat;
    314562  char  *YLabelFormat;
    315563  char  *ZLabelFormat;
     564
    316565  double CornerOffset;
     566
    317567  int   Inertia;
     568
    318569  int   RenderCount;
     570
    319571  int   InertiaLocs[3];
    320572
    321573  int RenderSomething;
     574
     575  double LabelScreenOffset;
     576  double TitleScreenOffset;
     577
     578  vtkTextProperty* TitleTextProperty[3];
     579  vtkStringArray* AxisLabels[3];
     580
     581  vtkTextProperty* LabelTextProperty[3];
     582
     583  vtkProperty  *XAxesLinesProperty;
     584  vtkProperty  *YAxesLinesProperty;
     585  vtkProperty  *ZAxesLinesProperty;
     586  vtkProperty  *XAxesGridlinesProperty;
     587  vtkProperty  *YAxesGridlinesProperty;
     588  vtkProperty  *ZAxesGridlinesProperty;
     589  vtkProperty  *XAxesInnerGridlinesProperty;
     590  vtkProperty  *YAxesInnerGridlinesProperty;
     591  vtkProperty  *ZAxesInnerGridlinesProperty;
     592  vtkProperty  *XAxesGridpolysProperty;
     593  vtkProperty  *YAxesGridpolysProperty;
     594  vtkProperty  *ZAxesGridpolysProperty;
     595
     596  double RenderedBounds[6];
     597  double OrientedBounds[6];
     598  int UseOrientedBounds;
     599
     600  double AxisOrigin[3];
     601  int UseAxisOrigin;
     602
     603  double AxisBaseForX[3];
     604  double AxisBaseForY[3];
     605  double AxisBaseForZ[3];
    322606
    323607private:
     
    330614
    331615  vtkTimeStamp BuildTime;
     616  int LastUseOrientedBounds;
    332617  int LastXPow;
    333618  int LastYPow;
    334619  int LastZPow;
     620
    335621  int UserXPow;
    336622  int UserYPow;
    337623  int UserZPow;
     624
    338625  bool AutoLabelScaling;
     626  int XAutoLabelFormat;
     627  int YAutoLabelFormat;
     628  int ZAutoLabelFormat;
     629
    339630  int LastXAxisDigits;
    340631  int LastYAxisDigits;
    341632  int LastZAxisDigits;
     633
    342634  double LastXRange[2];
    343635  double LastYRange[2];
    344636  double LastZRange[2];
    345   int   LastFlyMode;
    346 
    347   int   RenderAxesX[4];
    348   int   RenderAxesY[4];
    349   int   RenderAxesZ[4];
     637  double LastBounds[6];
     638
     639  int    LastFlyMode;
     640
     641  int   RenderAxesX[NUMBER_OF_ALIGNED_AXIS];
     642  int   RenderAxesY[NUMBER_OF_ALIGNED_AXIS];
     643  int   RenderAxesZ[NUMBER_OF_ALIGNED_AXIS];
     644
    350645  int   NumberOfAxesX;
    351646  int   NumberOfAxesY;
     
    355650  bool MustAdjustYValue;
    356651  bool MustAdjustZValue;
     652
    357653  bool ForceXLabelReset;
    358654  bool ForceYLabelReset;
     
    363659  double ZAxisRange[2];
    364660
    365   // various helper methods
     661  double LabelScale;
     662  double TitleScale;
     663
     664  double ScreenSize;
     665
     666  // Description:
     667  // Major start and delta values, in each direction.
     668  // These values are needed for inner grid lines generation
     669  double MajorStart[3];
     670  double DeltaMajor[3];
     671
     672  int RenderGeometry(bool &initialRender, vtkViewport *viewport, bool checkAxisVisibility,int (vtkRpAxisActor::*renderMethod)(vtkViewport*));
     673
    366674  void  TransformBounds(vtkViewport *viewport, const double bounds[6],
    367675                        double pts[8][3]);
    368676  void  AdjustAxes(double bounds[6],
    369                    double xCoords[4][6], double yCoords[4][6],
    370                    double zCoords[4][6],
     677                   double xCoords[NUMBER_OF_ALIGNED_AXIS][6],
     678                   double yCoords[NUMBER_OF_ALIGNED_AXIS][6],
     679                   double zCoords[NUMBER_OF_ALIGNED_AXIS][6],
    371680                   double xRange[2], double yRange[2], double zRange[2]);
    372681
     
    379688  void  DetermineRenderAxes(vtkViewport *);
    380689  void  SetNonDependentAttributes(void);
    381   void  BuildLabels(vtkRpAxisActor *axes[4]);
    382   void  AdjustTicksComputeRange(vtkRpAxisActor *axes[4],
     690  void  BuildLabels(vtkRpAxisActor *axes[NUMBER_OF_ALIGNED_AXIS]);
     691  void  AdjustTicksComputeRange(vtkRpAxisActor *axes[NUMBER_OF_ALIGNED_AXIS],
    383692      double rangeMin, double rangeMax);
    384693
    385   // hide the superclass' ShallowCopy() from the user and the compiler.
    386   void ShallowCopy(vtkProp *prop) { this->vtkProp::ShallowCopy( prop ); };
     694  void    AutoScale(vtkViewport *viewport);
     695  void    AutoScale(vtkViewport *viewport, vtkRpAxisActor *axes[NUMBER_OF_ALIGNED_AXIS]);
     696  double  AutoScale(vtkViewport *viewport, double screenSize, double position[3]);
    387697};
    388698
Note: See TracChangeset for help on using the changeset viewer.