Skip to content
Snippets Groups Projects
Commit b2a1373a authored by Cory Quammen's avatar Cory Quammen Committed by Kitware Robot
Browse files

Merge topic 'distance_representation_scale_fix'


333cbec1 Invert the effect of the scale factor

Acked-by: default avatarKitware Robot <kwrobot@kitware.com>
Reviewed-by: default avatarUtkarsh Ayachit <utkarsh.ayachit@kitware.com>
Merge-request: !1990
parents 67be604f 333cbec1
No related branches found
No related tags found
No related merge requests found
......@@ -97,8 +97,8 @@ public:
// will be defined in terms of the scaled space. For example, if the VTK world
// coordinates are assumed to be in inches, but the desired distance units
// should be defined in terms of centimeters, the scale factor should be set
// to 0.3937. The ruler marks will then be spaced in terms of centimeters, and
// the label will contain the measurement in centimeters.
// to 2.54. The ruler marks will then be spaced in terms of centimeters, and
// the label will show the measurement in centimeters.
vtkSetMacro(Scale,double);
vtkGetMacro(Scale,double);
......
......@@ -183,16 +183,14 @@ void vtkDistanceRepresentation2D::BuildRepresentation()
this->AxisActor->GetPoint1Coordinate()->SetValue(p1);
this->AxisActor->GetPoint2Coordinate()->SetValue(p2);
this->AxisActor->SetRulerMode(this->RulerMode);
this->AxisActor->SetRulerDistance(this->RulerDistance * this->Scale);
this->AxisActor->SetNumberOfLabels(this->NumberOfRulerTicks);
double scaledDistance = this->Distance;
if (this->Scale != 0.0)
{
scaledDistance /= this->Scale;
this->AxisActor->SetRulerDistance(this->RulerDistance / this->Scale);
}
this->AxisActor->SetNumberOfLabels(this->NumberOfRulerTicks);
char string[512];
sprintf(string, this->LabelFormat, scaledDistance);
sprintf(string, this->LabelFormat, this->Distance * this->Scale);
this->AxisActor->SetTitle(string);
this->BuildTime.Modified();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment