Commit 92df7f1c authored by Dave Partyka's avatar Dave Partyka
Browse files

ENH: Merge precision fixes from Marcus.

parent 8d7011be
......@@ -29,7 +29,7 @@
#include "math.h"
//-----------------------------------------------------------------------------
vtkCxxRevisionMacro(vtkAxis, "1.20.2.3");
vtkCxxRevisionMacro(vtkAxis, "1.20.2.4");
//-----------------------------------------------------------------------------
vtkStandardNewMacro(vtkAxis);
......@@ -62,7 +62,7 @@ vtkAxis::vtkAxis()
this->GridVisible = true;
this->LabelsVisible = true;
this->Precision = 2;
this->Notation = 2; // Fixed - do the right thing...
this->Notation = 0; // Mixed - do the right thing...
this->Behavior = 0;
this->Pen = vtkPen::New();
this->Pen->SetColor(0, 0, 0);
......@@ -118,6 +118,7 @@ void vtkAxis::Update()
}
}
// Figure out the scaling and origin for the scene
double scaling = 0.0;
double origin = 0.0;
if (this->Point1[0] == this->Point2[0]) // x1 == x2, therefore vertical
......@@ -332,6 +333,30 @@ void vtkAxis::SetRange(double minimum, double maximum)
this->SetMaximum(maximum);
}
//-----------------------------------------------------------------------------
void vtkAxis::SetPrecision(int precision)
{
if (this->Precision == precision)
{
return;
}
this->Precision = precision;
this->TickMarksDirty = true;
this->Modified();
}
//-----------------------------------------------------------------------------
void vtkAxis::SetNotation(int notation)
{
if (this->Notation == notation)
{
return;
}
this->Notation = notation;
this->TickMarksDirty = true;
this->Modified();
}
//-----------------------------------------------------------------------------
void vtkAxis::AutoScale()
{
......@@ -462,6 +487,12 @@ double vtkAxis::CalculateNiceMinMax(double &min, double &max)
this->Minimum *= 0.95;
this->Maximum *= 1.05;
}
else if ((this->Maximum - this->Minimum) < 1.0e-20)
{
this->Minimum *= 0.95;
this->Maximum *= 1.05;
}
double range = this->Maximum - this->Minimum;
bool isNegative = false;
if (range < 0.0f)
......
......@@ -136,12 +136,12 @@ public:
// Description:
// Get/set the numerical precision to use, default is 2.
vtkSetMacro(Precision, int);
virtual void SetPrecision(int precision);
vtkGetMacro(Precision, int);
// Description:
// Get/set the numerical notation, standard, scientific or mixed (0, 1, 2).
vtkSetMacro(Notation, int);
virtual void SetNotation(int notation);
vtkGetMacro(Notation, int);
// Description:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment