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

ENH: Merge precision fixes from Marcus.

parent 8d7011be
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "math.h" #include "math.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
vtkCxxRevisionMacro(vtkAxis, "1.20.2.3"); vtkCxxRevisionMacro(vtkAxis, "1.20.2.4");
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
vtkStandardNewMacro(vtkAxis); vtkStandardNewMacro(vtkAxis);
...@@ -62,7 +62,7 @@ vtkAxis::vtkAxis() ...@@ -62,7 +62,7 @@ vtkAxis::vtkAxis()
this->GridVisible = true; this->GridVisible = true;
this->LabelsVisible = true; this->LabelsVisible = true;
this->Precision = 2; this->Precision = 2;
this->Notation = 2; // Fixed - do the right thing... this->Notation = 0; // Mixed - do the right thing...
this->Behavior = 0; this->Behavior = 0;
this->Pen = vtkPen::New(); this->Pen = vtkPen::New();
this->Pen->SetColor(0, 0, 0); this->Pen->SetColor(0, 0, 0);
...@@ -118,6 +118,7 @@ void vtkAxis::Update() ...@@ -118,6 +118,7 @@ void vtkAxis::Update()
} }
} }
// Figure out the scaling and origin for the scene
double scaling = 0.0; double scaling = 0.0;
double origin = 0.0; double origin = 0.0;
if (this->Point1[0] == this->Point2[0]) // x1 == x2, therefore vertical if (this->Point1[0] == this->Point2[0]) // x1 == x2, therefore vertical
...@@ -332,6 +333,30 @@ void vtkAxis::SetRange(double minimum, double maximum) ...@@ -332,6 +333,30 @@ void vtkAxis::SetRange(double minimum, double maximum)
this->SetMaximum(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() void vtkAxis::AutoScale()
{ {
...@@ -462,6 +487,12 @@ double vtkAxis::CalculateNiceMinMax(double &min, double &max) ...@@ -462,6 +487,12 @@ double vtkAxis::CalculateNiceMinMax(double &min, double &max)
this->Minimum *= 0.95; this->Minimum *= 0.95;
this->Maximum *= 1.05; 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; double range = this->Maximum - this->Minimum;
bool isNegative = false; bool isNegative = false;
if (range < 0.0f) if (range < 0.0f)
......
...@@ -136,12 +136,12 @@ public: ...@@ -136,12 +136,12 @@ public:
// Description: // Description:
// Get/set the numerical precision to use, default is 2. // Get/set the numerical precision to use, default is 2.
vtkSetMacro(Precision, int); virtual void SetPrecision(int precision);
vtkGetMacro(Precision, int); vtkGetMacro(Precision, int);
// Description: // Description:
// Get/set the numerical notation, standard, scientific or mixed (0, 1, 2). // Get/set the numerical notation, standard, scientific or mixed (0, 1, 2).
vtkSetMacro(Notation, int); virtual void SetNotation(int notation);
vtkGetMacro(Notation, int); vtkGetMacro(Notation, int);
// Description: // 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