Commit 3be5ef73 authored by Marcus D. Hanwell's avatar Marcus D. Hanwell
Browse files

BUG: Fixed a couple of issues with bounds.

These were implicitly relying on zero initialization in order to
calculate box sizes for the axes etc.

Change-Id: If33a468d0f84e6b0a243a1522f623f291478b4ea
parent c4933daa
...@@ -657,7 +657,7 @@ vtkRectf vtkAxis::GetBoundingRect(vtkContext2D* painter) ...@@ -657,7 +657,7 @@ vtkRectf vtkAxis::GetBoundingRect(vtkContext2D* painter)
float widest = 0.0; float widest = 0.0;
// Second, calculate the tallest tick label // Second, calculate the tallest tick label
float tallest = 0.0; float tallest = 0.0;
vtkRectf bounds; vtkRectf bounds(0, 0, 0, 0);
for(vtkIdType i = 0; i < this->TickLabels->GetNumberOfTuples(); ++i) for(vtkIdType i = 0; i < this->TickLabels->GetNumberOfTuples(); ++i)
{ {
painter->ApplyTextProp(this->LabelProperties); painter->ApplyTextProp(this->LabelProperties);
...@@ -670,7 +670,7 @@ vtkRectf vtkAxis::GetBoundingRect(vtkContext2D* painter) ...@@ -670,7 +670,7 @@ vtkRectf vtkAxis::GetBoundingRect(vtkContext2D* painter)
this->MaxLabel[1] = tallest; this->MaxLabel[1] = tallest;
// Then, if there is an axis label, add that in. // Then, if there is an axis label, add that in.
vtkRectf titleBounds; vtkRectf titleBounds(0, 0, 0, 0);
if (this->Title && !this->Title.empty()) if (this->Title && !this->Title.empty())
{ {
painter->ApplyTextProp(this->TitleProperties); painter->ApplyTextProp(this->TitleProperties);
......
...@@ -51,6 +51,7 @@ vtkChart::vtkChart() ...@@ -51,6 +51,7 @@ vtkChart::vtkChart()
this->Point1[1] = 0; this->Point1[1] = 0;
this->Point2[0] = 0; this->Point2[0] = 0;
this->Point2[1] = 0; this->Point2[1] = 0;
this->Size.Set(0, 0, 0, 0);
this->ShowLegend = false; this->ShowLegend = false;
this->TitleProperties = vtkTextProperty::New(); this->TitleProperties = vtkTextProperty::New();
this->TitleProperties->SetJustificationToCentered(); this->TitleProperties->SetJustificationToCentered();
......
...@@ -58,6 +58,7 @@ vtkChartLegend::vtkChartLegend() ...@@ -58,6 +58,7 @@ vtkChartLegend::vtkChartLegend()
{ {
this->Storage = new vtkChartLegend::Private; this->Storage = new vtkChartLegend::Private;
this->Point = this->Storage->Point.GetData(); this->Point = this->Storage->Point.GetData();
this->Rect.Set(0, 0, 0, 0);
// Defaults to 12pt text, with top, right alignment to the specified point. // Defaults to 12pt text, with top, right alignment to the specified point.
this->LabelProperties->SetFontSize(12); this->LabelProperties->SetFontSize(12);
this->LabelProperties->SetColor(0.0, 0.0, 0.0); this->LabelProperties->SetColor(0.0, 0.0, 0.0);
......
...@@ -254,7 +254,7 @@ bool vtkChartPie::LocatePointInPlots(const vtkContextMouseEvent &mouse) ...@@ -254,7 +254,7 @@ bool vtkChartPie::LocatePointInPlots(const vtkContextMouseEvent &mouse)
int dimensions[4]; int dimensions[4];
vtkVector2f position(mouse.GetScreenPos().Cast<float>().GetData()); vtkVector2f position(mouse.GetScreenPos().Cast<float>().GetData());
vtkVector2f tolerance(5, 5); vtkVector2f tolerance(5, 5);
vtkVector2f plotPos; vtkVector2f plotPos(0, 0);
this->Private->Plot->GetDimensions(dimensions); this->Private->Plot->GetDimensions(dimensions);
vtkVector2i pos(mouse.GetScreenPos()); vtkVector2i pos(mouse.GetScreenPos());
......
Supports Markdown
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