Index: trunk/packages/vizservers/nanovis/Axis.h
===================================================================
--- trunk/packages/vizservers/nanovis/Axis.h	(revision 2952)
+++ trunk/packages/vizservers/nanovis/Axis.h	(revision 2953)
@@ -2,4 +2,6 @@
 #ifndef AXIS_H
 #define AXIS_H
+
+#include <stdlib.h>
 
 #include <cmath>
@@ -45,13 +47,7 @@
 };
 
-/*
- * ----------------------------------------------------------------------
- *
- * Ticks --
- *
- *         Structure containing information where the ticks (major or
- *        minor) will be displayed on the graph.
- *
- * ----------------------------------------------------------------------
+/**
+ * Class containing information where the ticks (major or
+ * minor) will be displayed on the graph.
  */
 class Ticks
@@ -182,5 +178,5 @@
 
 /**
- * Structure contains options controlling how the axis will be
+ * Class contains options controlling how the axis will be
  * displayed.
  */
@@ -212,4 +208,14 @@
     }
 
+    bool firstMajor(TickIter& iter)
+    {
+        return _major.firstTick(iter);
+    }
+
+    bool firstMinor(TickIter& iter)
+    {
+        return _minor.firstTick(iter);
+    }
+
     void resetRange();
 
@@ -218,27 +224,47 @@
     void setScale(double min, double max);
 
-    double scale()
+    double scale() const
     {
         return _scale;
     }
 
-    double range()
+    double range() const
     {
         return _range;
     }
 
-    bool firstMajor(TickIter& iter)
-    {
-        return _major.firstTick(iter);
-    }
-
-    bool firstMinor(TickIter& iter)
-    {
-        return _minor.firstTick(iter);
-    }
-
     void getDataLimits(double& min, double& max)
     {
         min = _valueMin, max = _valueMax;
+    }
+
+    double min() const
+    {
+        return _min;
+    }
+
+    void min(double min)
+    {
+        _reqMin = min;
+    }
+
+    double max() const
+    {
+        return _max;
+    }
+
+    void max(double max)
+    {
+        _reqMax = max;
+    }
+
+    void setLimits(double min, double max)
+    {
+        _reqMin = min, _reqMax = max;
+    }
+
+    void unsetLimits()
+    {
+        min(NAN), max(NAN);
     }
 
@@ -284,34 +310,4 @@
         }
         _title = strdup(title);
-    }
-
-    double min()
-    {
-        return _min;
-    }
-
-    void min(double min)
-    {
-        _reqMin = min;
-    }
-
-    double max()
-    {
-        return _max;
-    }
-
-    void max(double max)
-    {
-        _reqMax = max;
-    }
-
-    void setLimits(double min, double max)
-    {
-        _reqMin = min, _reqMax = max;
-    }
-
-    void unsetLimits()
-    {
-        min(NAN), max(NAN);
     }
 
Index: trunk/packages/vizservers/nanovis/Command.cpp
===================================================================
--- trunk/packages/vizservers/nanovis/Command.cpp	(revision 2952)
+++ trunk/packages/vizservers/nanovis/Command.cpp	(revision 2953)
@@ -78,20 +78,18 @@
   1.0  1 0 1\n\
 } {\n\
-  0.00  1.0\n\
-  0.05  0.0\n\
-  0.15  0.0\n\
-  0.20  1.0\n\
-  0.25  0.0\n\
-  0.35  0.0\n\
-  0.40  1.0\n\
-  0.45  0.0\n\
-  0.55  0.0\n\
-  0.60  1.0\n\
-  0.65  0.0\n\
-  0.75  0.0\n\
-  0.80  1.0\n\
-  0.85  0.0\n\
-  0.95  0.0\n\
-  1.00  1.0\n\
+  0.00000  0.0\n\
+  0.19999  0.0\n\
+  0.20000  1.0\n\
+  0.20001  0.0\n\
+  0.39999  0.0\n\
+  0.40000  1.0\n\
+  0.40001  0.0\n\
+  0.59999  0.0\n\
+  0.60000  1.0\n\
+  0.60001  0.0\n\
+  0.79999  0.0\n\
+  0.80000  1.0\n\
+  0.80001  0.0\n\
+  1.00000  0.0\n\
 }";
 
@@ -651,5 +649,5 @@
     NanoVis::readScreen();
 
-    NanoVis::ppmWrite("nv>image -bytes %d -type print");
+    NanoVis::ppmWrite("nv>image -type print -bytes %d");
     NanoVis::resizeOffscreenBuffer(w, h);
 
Index: trunk/packages/vizservers/nanovis/FlowCmd.cpp
===================================================================
--- trunk/packages/vizservers/nanovis/FlowCmd.cpp	(revision 2952)
+++ trunk/packages/vizservers/nanovis/FlowCmd.cpp	(revision 2953)
@@ -561,8 +561,4 @@
 
     Vector3 loc = _volPtr->location();
-    /*This is wrong. Need to compute origin. */
-    NanoVis::xOrigin = loc.x;
-    NanoVis::yOrigin = loc.y;
-    NanoVis::zOrigin = loc.z;
 
     _fieldPtr->setVectorField(_volPtr, loc, 
@@ -657,6 +653,9 @@
     Volume *volPtr;
 
-    volPtr = NanoVis::loadVolume(_name, _dataPtr->xNum(), _dataPtr->yNum(), 
-                                 _dataPtr->zNum(), 4, data, 
+    volPtr = NanoVis::loadVolume(_name,
+                                 _dataPtr->xNum(),
+                                 _dataPtr->yNum(), 
+                                 _dataPtr->zNum(),
+                                 4, data, 
                                  NanoVis::magMin, NanoVis::magMax, 0);
     volPtr->xAxis.setRange(_dataPtr->xMin(), _dataPtr->xMax());
@@ -672,10 +671,4 @@
           NanoVis::magMin, NanoVis::magMax);
     volPtr->setPhysicalBBox(physicalMin, physicalMax);
-    //volPtr->numSlices(256 - _volIndex);
-    //volPtr->numSlices(512 - _volIndex);
-    //volPtr->numSlices(256 - n);
-    // TBD..
-    /* Don't set the slice number until we're are about to render the
-       volume. */
     volPtr->disableCutplane(0);
     volPtr->disableCutplane(1);
@@ -689,5 +682,4 @@
     volPtr->specular(_sv.specular);
     volPtr->diffuse(_sv.diffuse);
-    TRACE("volume is now %d %d\n", _sv.showVolume, volPtr->visible());
     volPtr->visible(_sv.showVolume);
     float dx0 = -0.5;
@@ -1018,6 +1010,5 @@
             continue;
         }
-        Rappture::Unirect3d *dataPtr;
-        dataPtr = flowPtr->data();
+        Rappture::Unirect3d *dataPtr = flowPtr->data();
         min = dataPtr->magMin();
         max = dataPtr->magMax();
@@ -1065,5 +1056,5 @@
         // FIXME: This doesn't work when there is more than one flow.
         licRenderer->setOffset(flowPtr->GetRelativePosition());
-        NanoVis::velocityArrowsSlice->slicePos(flowPtr->GetRelativePosition());
+        velocityArrowsSlice->slicePos(flowPtr->GetRelativePosition());
     }
     AdvectFlows();
Index: trunk/packages/vizservers/nanovis/Grid.cpp
===================================================================
--- trunk/packages/vizservers/nanovis/Grid.cpp	(revision 2952)
+++ trunk/packages/vizservers/nanovis/Grid.cpp	(revision 2953)
@@ -18,6 +18,10 @@
     _majorColor(1.0f, 1.0f, 1.0f, 1.0f), 
     _minorColor(0.5f, 0.5f, 0.5f, 1.0f), 
-    _font(0), 
+    _font(NULL), 
     _visible(false)
+{
+}
+
+Grid::~Grid()
 {
 }
Index: trunk/packages/vizservers/nanovis/Grid.h
===================================================================
--- trunk/packages/vizservers/nanovis/Grid.h	(revision 2952)
+++ trunk/packages/vizservers/nanovis/Grid.h	(revision 2953)
@@ -33,4 +33,5 @@
 public:
     Grid();
+    virtual ~Grid();
 
     bool isVisible() const
Index: trunk/packages/vizservers/nanovis/HeightMap.cpp
===================================================================
--- trunk/packages/vizservers/nanovis/HeightMap.cpp	(revision 2952)
+++ trunk/packages/vizservers/nanovis/HeightMap.cpp	(revision 2953)
@@ -1,10 +1,3 @@
  /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
-#include <memory.h>
-#include <stdlib.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdlib.h>
 
 #include <GL/glew.h>
@@ -15,6 +8,4 @@
 #include "ContourLineFilter.h"
 #include "Texture1D.h"
-#include "R2/R2FilePath.h"
-#include "RpField1D.h"
 #include "RenderContext.h"
 
@@ -57,5 +48,5 @@
     }
     if (_heights != NULL) {
-	free(_heights);
+	delete [] _heights;
     }
 }
Index: trunk/packages/vizservers/nanovis/HeightMap.h
===================================================================
--- trunk/packages/vizservers/nanovis/HeightMap.h	(revision 2952)
+++ trunk/packages/vizservers/nanovis/HeightMap.h	(revision 2953)
@@ -36,8 +36,8 @@
     /**
      *@brief Create a height map with heigh values
-     *@param startX a x position of the first height value
-     *@param startY a y position of the first height value
-     *@param endX a x position of the last height value
-     *@param endY a y position of the last height value
+     *@param startX x position of the first height value
+     *@param startY y position of the first height value
+     *@param endX x position of the last height value
+     *@param endY y position of the last height value
      *@param xCount the number of columns of height values
      *@param yCount the number of rows of height values
@@ -126,8 +126,8 @@
 
 private:
-    void createIndexBuffer(int xCount, int zCount, float* heights);
+    void createIndexBuffer(int xCount, int zCount, float *heights);
     Vector3 *createHeightVertices(float startX, float startY,
                                   float endX, float endY,
-                                  int xCount, int yCount, float  *height);
+                                  int xCount, int yCount, float *height);
     void reset();
 
@@ -145,9 +145,9 @@
     int _indexCount;
     Vector3 _contourColor;
-    
+
     bool _contourVisible;
     bool _topContourVisible;
     bool _visible;
-    
+
     Vector3 _scale;
     Vector3 _centerPoint;
Index: trunk/packages/vizservers/nanovis/NvColorTableShader.cpp
===================================================================
--- trunk/packages/vizservers/nanovis/NvColorTableShader.cpp	(revision 2952)
+++ trunk/packages/vizservers/nanovis/NvColorTableShader.cpp	(revision 2953)
@@ -1,4 +1,3 @@
 /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
-#include <R2/R2FilePath.h>
 
 #include <GL/glew.h>
Index: trunk/packages/vizservers/nanovis/NvFlowVisRenderer.cpp
===================================================================
--- trunk/packages/vizservers/nanovis/NvFlowVisRenderer.cpp	(revision 2952)
+++ trunk/packages/vizservers/nanovis/NvFlowVisRenderer.cpp	(revision 2953)
@@ -15,14 +15,5 @@
  */
 
-#include <stdio.h>
-#include <assert.h>
-#include <malloc.h>
-#include <string.h>
-
-#include <R2/R2FilePath.h>
-
 #include "NvFlowVisRenderer.h"
-#include "NvVectorField.h"
-#include "Trace.h"
 
 #define NV_32
Index: trunk/packages/vizservers/nanovis/NvFlowVisRenderer.h
===================================================================
--- trunk/packages/vizservers/nanovis/NvFlowVisRenderer.h	(revision 2952)
+++ trunk/packages/vizservers/nanovis/NvFlowVisRenderer.h	(revision 2953)
@@ -3,17 +3,8 @@
 #define NVFLOWVISRENDERER_H
 
-#include <vector>
 #include <map>
 #include <string>
 
-#include <GL/glew.h>
-#include <Cg/cgGL.h>
-
-#include "config.h"
-
-#include "Renderable.h"
-#include "RenderVertexArray.h"
 #include "Vector3.h"
-#include "NvParticleAdvectionShader.h"
 #include "NvVectorField.h"
 
Index: trunk/packages/vizservers/nanovis/NvLIC.h
===================================================================
--- trunk/packages/vizservers/nanovis/NvLIC.h	(revision 2952)
+++ trunk/packages/vizservers/nanovis/NvLIC.h	(revision 2953)
@@ -31,6 +31,5 @@
 { 
 public:
-    NvLIC(int size, int width, int height, int axis, 
-	  float offset);
+    NvLIC(int size, int width, int height, int axis, float offset);
     ~NvLIC();
 
@@ -49,5 +48,5 @@
     void getSlice();
 
-    void setOffset(float v);
+    void setOffset(float offset);
 
     /** 
Index: trunk/packages/vizservers/nanovis/NvParticleAdvectionShader.cpp
===================================================================
--- trunk/packages/vizservers/nanovis/NvParticleAdvectionShader.cpp	(revision 2952)
+++ trunk/packages/vizservers/nanovis/NvParticleAdvectionShader.cpp	(revision 2953)
@@ -1,4 +1,3 @@
 /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
-#include <R2/R2FilePath.h>
 
 #include <GL/glew.h>
Index: trunk/packages/vizservers/nanovis/NvParticleAdvectionShader.h
===================================================================
--- trunk/packages/vizservers/nanovis/NvParticleAdvectionShader.h	(revision 2952)
+++ trunk/packages/vizservers/nanovis/NvParticleAdvectionShader.h	(revision 2953)
@@ -8,5 +8,5 @@
 class NvParticleAdvectionShader : public NvShader
 {
-public: 
+public:
     NvParticleAdvectionShader();
 
Index: trunk/packages/vizservers/nanovis/NvParticleRenderer.cpp
===================================================================
--- trunk/packages/vizservers/nanovis/NvParticleRenderer.cpp	(revision 2952)
+++ trunk/packages/vizservers/nanovis/NvParticleRenderer.cpp	(revision 2953)
@@ -15,11 +15,7 @@
  */
 
-#include <stdio.h>
 #include <assert.h>
-#include <malloc.h>
 #include <string.h>
 #include <stdlib.h>
-
-#include <R2/R2FilePath.h>
 
 #include "NvParticleRenderer.h"
@@ -300,5 +296,5 @@
     if (_psysFrame == _maxLife) {
         _psysFrame = 0;
-        //        _reborn = true;
+        // _reborn = true;
     }
     glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboOrig);
Index: trunk/packages/vizservers/nanovis/NvParticleRenderer.h
===================================================================
--- trunk/packages/vizservers/nanovis/NvParticleRenderer.h	(revision 2952)
+++ trunk/packages/vizservers/nanovis/NvParticleRenderer.h	(revision 2953)
@@ -22,10 +22,9 @@
 #include <Cg/cgGL.h>
 
-#include "config.h"
-
 #include "Renderable.h"
+#include "NvParticleAdvectionShader.h"
 #include "RenderVertexArray.h"
 #include "Vector3.h"
-#include "NvParticleAdvectionShader.h"
+#include "Vector4.h"
 
 struct Particle {
Index: trunk/packages/vizservers/nanovis/NvStdVertexShader.cpp
===================================================================
--- trunk/packages/vizservers/nanovis/NvStdVertexShader.cpp	(revision 2952)
+++ trunk/packages/vizservers/nanovis/NvStdVertexShader.cpp	(revision 2953)
@@ -1,4 +1,3 @@
 /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
-#include <stdio.h>
 
 #include <GL/glew.h>
Index: trunk/packages/vizservers/nanovis/NvZincBlendeVolumeShader.cpp
===================================================================
--- trunk/packages/vizservers/nanovis/NvZincBlendeVolumeShader.cpp	(revision 2952)
+++ trunk/packages/vizservers/nanovis/NvZincBlendeVolumeShader.cpp	(revision 2953)
@@ -1,5 +1,3 @@
 /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
-
-#include <string.h>
 
 #include <GL/glew.h>
Index: trunk/packages/vizservers/nanovis/PlaneRenderer.cpp
===================================================================
--- trunk/packages/vizservers/nanovis/PlaneRenderer.cpp	(revision 2952)
+++ trunk/packages/vizservers/nanovis/PlaneRenderer.cpp	(revision 2953)
@@ -14,4 +14,6 @@
  * ======================================================================
  */
+
+#include <GL/glew.h>
 
 #include "PlaneRenderer.h"
Index: trunk/packages/vizservers/nanovis/PlaneRenderer.h
===================================================================
--- trunk/packages/vizservers/nanovis/PlaneRenderer.h	(revision 2952)
+++ trunk/packages/vizservers/nanovis/PlaneRenderer.h	(revision 2953)
@@ -17,13 +17,5 @@
 #define PLANE_RENDERER_H
 
-#include <math.h>
-#include <stdio.h>
-#include <assert.h>
-#include <float.h>
-
 #include <vector>
-
-#include <GL/glew.h>
-#include <Cg/cgGL.h>
 
 #include "NvColorTableShader.h"
Index: trunk/packages/vizservers/nanovis/PointSetRenderer.cpp
===================================================================
--- trunk/packages/vizservers/nanovis/PointSetRenderer.cpp	(revision 2952)
+++ trunk/packages/vizservers/nanovis/PointSetRenderer.cpp	(revision 2953)
@@ -77,5 +77,5 @@
     glBegin(GL_POINTS);
 
-    PCA::ClusterList* p;
+    PCA::ClusterList *p;
     for (int i = size - 1; i >= 0; --i) {
         p = bucket[i];
Index: trunk/packages/vizservers/nanovis/PointSetRenderer.h
===================================================================
--- trunk/packages/vizservers/nanovis/PointSetRenderer.h	(revision 2952)
+++ trunk/packages/vizservers/nanovis/PointSetRenderer.h	(revision 2953)
@@ -11,5 +11,5 @@
 class PointSetRenderer
 {
- public: 
+public:
     PointSetRenderer();
     ~PointSetRenderer();
Index: trunk/packages/vizservers/nanovis/PointShader.cpp
===================================================================
--- trunk/packages/vizservers/nanovis/PointShader.cpp	(revision 2952)
+++ trunk/packages/vizservers/nanovis/PointShader.cpp	(revision 2953)
@@ -1,14 +1,12 @@
 /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
 
-#include <R2/R2FilePath.h>
-#include <R2/R2string.h>
+#include <GL/glew.h>
+#include <Cg/cgGL.h>
 
 #include "PointShader.h"
 
 PointShader::PointShader() : 
-    NvShader(), 
+    NvShader(),
+    _scale(1.0f),
     _normal(NULL)
 {
@@ -27,5 +25,5 @@
 }
 
-void PointShader::setParameters()
+void PointShader::bind()
 {
     cgGLSetStateMatrixParameter(_modelviewVP, CG_GL_MODELVIEW_MATRIX, CG_GL_MATRIX_IDENTITY);
@@ -35,12 +33,16 @@
     cgGLSetParameter4f(_posoffsetVP, 1.0f, 1.0f, 1.0f, 1.0f);
     cgGLSetParameter4f(_baseposVP, 1.0f, 1.0f, 1.0f, 1.0f);
-    cgGLSetParameter4f(_scaleVP, 1.0f, 1.0f, 1.0f, 1.0f);
+    cgGLSetParameter4f(_scaleVP, _scale, 1.0f, 1.0f, 1.0f);
 
-    //cgGLSetTextureParameter(_normalParam,_normal->getGraphicsObjectID());
+    //cgGLSetTextureParameter(_normalParam, _normal->getGraphicsObjectID());
     //cgGLEnableTextureParameter(_normalParam);
+
+    NvShader::bind();
 }
 
-void PointShader::resetParameters()
+void PointShader::unbind()
 {
     //cgGLDisableTextureParameter(_normalParam);
+
+    NvShader::unbind();
 }
Index: trunk/packages/vizservers/nanovis/PointShader.h
===================================================================
--- trunk/packages/vizservers/nanovis/PointShader.h	(revision 2952)
+++ trunk/packages/vizservers/nanovis/PointShader.h	(revision 2953)
@@ -15,29 +15,15 @@
     void setScale(float scale)
     {
-        cgGLSetParameter4f(_scaleVP, scale, 1.0f, 1.0f, 1.0f);
+        _scale = scale;
     }
 
-    void setNormalTexture(Texture3D *n)
+    void setNormalTexture(Texture3D *normal)
     {
-        _normal = n;
+        _normal = normal;
     }
 
-    virtual void bind()
-    {
-        setParameters();
+    virtual void bind();
 
-        NvShader::bind();
-    }
-
-    virtual  void unbind()
-    {
-        resetParameters();
-
-        NvShader::unbind();
-    }
-
-protected:
-    virtual void setParameters();
-    virtual void resetParameters();
+    virtual  void unbind();
 
 private:
@@ -51,4 +37,5 @@
     CGparameter _normalParam;
 
+    float _scale;
     Texture3D *_normal;
 };
Index: trunk/packages/vizservers/nanovis/R2/src/R2Fonts.cpp
===================================================================
--- trunk/packages/vizservers/nanovis/R2/src/R2Fonts.cpp	(revision 2952)
+++ trunk/packages/vizservers/nanovis/R2/src/R2Fonts.cpp	(revision 2953)
@@ -73,19 +73,18 @@
 R2Fonts::begin()
 {
+    glPushAttrib(GL_TRANSFORM_BIT | GL_ENABLE_BIT);
     glEnable(GL_TEXTURE_2D);
-    glBindTexture(GL_TEXTURE_2D, _fonts[_fontIndex]. _fontTextureID);
-
-    glPushAttrib(GL_TRANSFORM_BIT | GL_ENABLE_BIT);
+    glBindTexture(GL_TEXTURE_2D, _fonts[_fontIndex]._fontTextureID);
+
     glMatrixMode(GL_PROJECTION);
     glPushMatrix();
-
-    glLoadIdentity( );
+    glLoadIdentity();
+
     gluOrtho2D(0.0f, _screenWidth, _screenHeight, 0.0f);
 
     glMatrixMode(GL_MODELVIEW);
-    glPushMatrix( );
-    glLoadIdentity( );
-
-    glEnable(GL_TEXTURE_2D);
+    glPushMatrix();
+    glLoadIdentity();
+
     glEnable(GL_BLEND);
     glDisable(GL_DEPTH_TEST);
@@ -98,10 +97,10 @@
 
     glMatrixMode(GL_PROJECTION);
-    glPopMatrix( );
+    glPopMatrix();
 
     glMatrixMode(GL_MODELVIEW);
-    glPopMatrix( );
-
-    glPopAttrib( );
+    glPopMatrix();
+
+    glPopAttrib();
 }
 
@@ -229,5 +228,5 @@
         }
 
-        fsInput.close( );
+        fsInput.close();
     }
     delete [] path;
Index: trunk/packages/vizservers/nanovis/RenderVertexArray.cpp
===================================================================
--- trunk/packages/vizservers/nanovis/RenderVertexArray.cpp	(revision 2952)
+++ trunk/packages/vizservers/nanovis/RenderVertexArray.cpp	(revision 2953)
@@ -51,7 +51,9 @@
     switch (_type) {
     case GL_HALF_FLOAT_NV:
-        _bytesPerComponent = 2; break;
+        _bytesPerComponent = 2;
+        break;
     case GL_FLOAT:
-        _bytesPerComponent = sizeof(float); break;
+        _bytesPerComponent = sizeof(float);
+        break;
     default:
         ERROR("unsupported RenderVertexArray type\n");
@@ -70,9 +72,12 @@
     switch(_size) {
     case 1:
-        _format = GL_LUMINANCE; break;
+        _format = GL_LUMINANCE;
+        break;
     case 3:
-        _format = GL_RGB; break;
+        _format = GL_RGB;
+        break;
     case 4:
-        _format = GL_RGBA; break;
+        _format = GL_RGBA;
+        break;
     default:
         ERROR("unsupported RenderVertexArray size\n");
Index: trunk/packages/vizservers/nanovis/Unirect.cpp
===================================================================
--- trunk/packages/vizservers/nanovis/Unirect.cpp	(revision 2952)
+++ trunk/packages/vizservers/nanovis/Unirect.cpp	(revision 2953)
@@ -734,5 +734,5 @@
         }
     }
-    TRACE("GetVectorRange %g %g\n", _magMin, _magMax);
+    TRACE("getVectorRange: %g %g\n", _magMin, _magMax);
 }
 
Index: trunk/packages/vizservers/nanovis/VelocityArrowsSlice.h
===================================================================
--- trunk/packages/vizservers/nanovis/VelocityArrowsSlice.h	(revision 2952)
+++ trunk/packages/vizservers/nanovis/VelocityArrowsSlice.h	(revision 2953)
@@ -84,4 +84,8 @@
 
 private:
+    void createRenderTarget();
+
+    void computeSamplingTicks();
+
     unsigned int _vectorFieldGraphicsID;
     float _vfXscale;
@@ -134,8 +138,4 @@
 
     RenderMode _renderMode;
-
-    void createRenderTarget();
-
-    void computeSamplingTicks();
 };
 
Index: trunk/packages/vizservers/nanovis/VolumeInterpolator.cpp
===================================================================
--- trunk/packages/vizservers/nanovis/VolumeInterpolator.cpp	(revision 2952)
+++ trunk/packages/vizservers/nanovis/VolumeInterpolator.cpp	(revision 2953)
@@ -18,6 +18,5 @@
     _numBytes(0), 
     _dataCount(0), 
-    _numComponents(0), 
-    _referenceOfVolume(0)
+    _numComponents(0)
 {
 }
@@ -133,5 +132,5 @@
         _numComponents = refPtr->numComponents();
         _numBytes = _dataCount * _numComponents * sizeof(float);
-	Vector3 loc = refPtr->location();
+        Vector3 loc = refPtr->location();
         _volume = new Volume(loc.x, loc.y, loc.z,
                              refPtr->width, refPtr->height, refPtr->depth, 
@@ -141,8 +140,5 @@
                              refPtr->wAxis.min(), 
                              refPtr->wAxis.max(), 
-			     refPtr->nonZeroMin());
-	/*
-        _referenceOfVolume = refPtr->dataID();
-	*/
+                             refPtr->nonZeroMin());
         _volume->numSlices(256-1);
         _volume->disableCutplane(0);
@@ -156,5 +152,5 @@
         _volume->isosurface(0);
         TRACE("VOL : location %f %f %f\n\tid : %s\n", loc.x, loc.y, loc.z, 
-	       refPtr->name());
+               refPtr->name());
     }
     _volumes.push_back(_volume);
Index: trunk/packages/vizservers/nanovis/VolumeInterpolator.h
===================================================================
--- trunk/packages/vizservers/nanovis/VolumeInterpolator.h	(revision 2952)
+++ trunk/packages/vizservers/nanovis/VolumeInterpolator.h	(revision 2953)
@@ -30,6 +30,4 @@
     double getStartTime() const;
 
-    unsigned int getReferenceVolumeID() const;
-
     Volume *getVolume();
 
@@ -44,5 +42,4 @@
     unsigned int _dataCount;
     unsigned int _numComponents;
-    unsigned int _referenceOfVolume;
     double _startTime;
 };
@@ -63,9 +60,4 @@
 }
 
-inline unsigned int VolumeInterpolator::getReferenceVolumeID() const
-{
-    return _referenceOfVolume;
-}
-
 #endif
 
Index: trunk/packages/vizservers/nanovis/dxReader.cpp
===================================================================
--- trunk/packages/vizservers/nanovis/dxReader.cpp	(revision 2952)
+++ trunk/packages/vizservers/nanovis/dxReader.cpp	(revision 2953)
@@ -213,6 +213,6 @@
     }
 
-    TRACE("found nx=%d ny=%d nz=%d\ndx=%f dy=%f dz=%f\nx0=%f y0=%f z0=%f\n", 
-          nx, ny, nz, dx, dy, dz, x0, y0, z0);
+    TRACE("found nx=%d ny=%d nxy=%d nz=%d\ndx=%f dy=%f dz=%f\nx0=%f y0=%f z0=%f\n", 
+          nx, ny, nxy, nz, dx, dy, dz, x0, y0, z0);
 
     lx = (nx - 1) * dx;
@@ -296,18 +296,17 @@
 #if ISO_TEST
         double dv = vmax - vmin;
-        int count = nx*ny*nz;
-        int ngen = 0;
-        double v;
         if (dv == 0.0) {
             dv = 1.0;
         }
 
-        for (int i = 0; i < count; ++i) {
-            v = data[ngen];
+        int ngen = 0;
+        const int step = 4;
+        for (int i = 0; i < nx*ny*nz; ++i) {
+            double v = data[ngen];
             // scale all values [0-1], -1 => out of bounds
             v = (isnan(v)) ? -1.0 : (v - vmin)/dv;
 
             data[ngen] = v;
-            ngen += 4;
+            ngen += step;
         }
 
@@ -429,6 +428,4 @@
         }
 
-        // figure out a good mesh spacing
-        int nsample = 30;
         x0 = field.rangeMin(Rappture::xaxis);
         lx = field.rangeMax(Rappture::xaxis) - field.rangeMin(Rappture::xaxis);
@@ -437,4 +434,7 @@
         z0 = field.rangeMin(Rappture::zaxis);
         lz = field.rangeMax(Rappture::zaxis) - field.rangeMin(Rappture::zaxis);
+
+        // figure out a good mesh spacing
+        int nsample = 30;
         double dmin = pow((lx*ly*lz)/((nsample-1)*(nsample-1)*(nsample-1)), 0.333);
 
@@ -453,6 +453,4 @@
         dz = lz /(double)(nz - 1);
 
-        data = new float[4*nx*ny*nz];
-
         vmin = field.valueMin();
         vmax = field.valueMax();
@@ -463,4 +461,5 @@
         }
 
+        data = new float[4*nx*ny*nz];
         // generate the uniformly sampled data that we need for a volume
         int ngen = 0;
@@ -490,7 +489,8 @@
 
     TRACE("nx = %i ny = %i nz = %i\n", nx, ny, nz);
+    TRACE("x0 = %lg y0 = %lg z0 = %lg\n", x0, y0, z0);
     TRACE("lx = %lg ly = %lg lz = %lg\n", lx, ly, lz);
     TRACE("dx = %lg dy = %lg dz = %lg\n", dx, dy, dz);
-    TRACE("dataMin = %lg\tdataMax = %lg\tnzero_min = %lg\n",
+    TRACE("dataMin = %lg dataMax = %lg nzero_min = %lg\n",
           vmin, vmax, nzero_min);
 
@@ -502,5 +502,5 @@
     volPtr->updatePending = true;
 
-        // TBD..
+    // TBD..
 #if 0 && defined(USE_POINTSET_RENDERER)
     PointSet *pset = new PointSet();
Index: trunk/packages/vizservers/nanovis/nanovis.cpp
===================================================================
--- trunk/packages/vizservers/nanovis/nanovis.cpp	(revision 2952)
+++ trunk/packages/vizservers/nanovis/nanovis.cpp	(revision 2953)
@@ -173,7 +173,4 @@
 float NanoVis::wMin = FLT_MAX;
 float NanoVis::wMax = -FLT_MAX;
-float NanoVis::xOrigin;
-float NanoVis::yOrigin;
-float NanoVis::zOrigin;
 
 /* FIXME: This variable is always true. */
@@ -362,5 +359,5 @@
 doExit(int code)
 {
-    TRACE("in doExit\n");
+    TRACE("in doExit: %d\n", code);
     NanoVis::removeAllData();
 
@@ -513,5 +510,5 @@
 int
 NanoVis::renderLegend(TransferFunction *tf, double min, double max,
-                      int width, int height, const char* volArg)
+                      int width, int height, const char *volArg)
 {
     TRACE("in renderLegend\n");
@@ -544,5 +541,5 @@
         ssize_t nWritten;
 
-        TRACE("ppm legend image");
+        TRACE("Sending ppm legend image %s min:%g max:%g", volArg, min, max);
         sprintf(prefix, "nv>legend %s %g %g", volArg, min, max);
         ppmWrite(prefix);
Index: trunk/packages/vizservers/nanovis/nanovis.h
===================================================================
--- trunk/packages/vizservers/nanovis/nanovis.h	(revision 2952)
+++ trunk/packages/vizservers/nanovis/nanovis.h	(revision 2953)
@@ -171,5 +171,4 @@
     static double magMin, magMax;
     static float xMin, xMax, yMin, yMax, zMin, zMax, wMin, wMax;
-    static float xOrigin, yOrigin, zOrigin;
 
     static NvColorTableRenderer *colorTableRenderer;
Index: trunk/packages/vizservers/nanovis/protocol-nanovis.txt
===================================================================
--- trunk/packages/vizservers/nanovis/protocol-nanovis.txt	(revision 2952)
+++ trunk/packages/vizservers/nanovis/protocol-nanovis.txt	(revision 2953)
@@ -186,4 +186,8 @@
   (followed by bytes)
 
+nv>data tag <dataobj-tag> min <val> max <val> vmin <val> vmax <val>
+   The min,max data values for the data object and the cumulative volume data
+   min,max over all volumes
+
 ================================================================================
 Error Replies:
