Commit 8c989e9c authored by Marcus D. Hanwell's avatar Marcus D. Hanwell
Browse files

BUG: Only assume four axes for vtkChartXY

This was causing segfaults when displaying parallel coordinates charts.
The vtkChart derived classes can have zero to many axes, only vtkChartXY
has a fixed size. We should generalize the proxy to handle this.

Change-Id: Iece3abfef704c8f5a9ae83a7eb5b66af84deeaae
parent acdee51d
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
=========================================================================*/ =========================================================================*/
#include "vtkSMContextViewProxy.h" #include "vtkSMContextViewProxy.h"
#include "vtkChart.h" #include "vtkChartXY.h"
#include "vtkContextView.h" #include "vtkContextView.h"
#include "vtkErrorCode.h" #include "vtkErrorCode.h"
#include "vtkObjectFactory.h" #include "vtkObjectFactory.h"
...@@ -65,7 +65,8 @@ public: ...@@ -65,7 +65,8 @@ public:
{ {
for(int i=0; i < 4; i++) for(int i=0; i < 4; i++)
{ {
vtkChart *chart = vtkChart::SafeDownCast(this->Proxy->GetContextItem()); // FIXME: Generalize to support charts with zero to many axes.
vtkChartXY *chart = vtkChartXY::SafeDownCast(this->Proxy->GetContextItem());
if (chart) if (chart)
{ {
chart->GetAxis(i)->GetRange(&this->ViewBounds[i*2]); chart->GetAxis(i)->GetRange(&this->ViewBounds[i*2]);
...@@ -149,7 +150,8 @@ vtkAbstractContextItem* vtkSMContextViewProxy::GetContextItem() ...@@ -149,7 +150,8 @@ vtkAbstractContextItem* vtkSMContextViewProxy::GetContextItem()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void vtkSMContextViewProxy::ResetDisplay() void vtkSMContextViewProxy::ResetDisplay()
{ {
vtkChart *chart = vtkChart::SafeDownCast(this->GetContextItem()); // FIXME: We should generalize this to support all charts (zero to many axes).
vtkChartXY *chart = vtkChartXY::SafeDownCast(this->GetContextItem());
if (chart) if (chart)
{ {
int previousBehaviour[4]; int previousBehaviour[4];
...@@ -222,7 +224,8 @@ void vtkSMContextViewProxy::SetViewBounds(double* bounds) ...@@ -222,7 +224,8 @@ void vtkSMContextViewProxy::SetViewBounds(double* bounds)
{ {
// Disable notification... // Disable notification...
this->Storage->Forwarder->SetTarget(NULL); this->Storage->Forwarder->SetTarget(NULL);
vtkChart *chart = vtkChart::SafeDownCast(this->GetContextItem()); // FIXME: This also needs generalizing to support all chart types.
vtkChartXY *chart = vtkChartXY::SafeDownCast(this->GetContextItem());
if (chart) if (chart)
{ {
......
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