Commit ef5afbec authored by Purves, Murray's avatar Purves, Murray
Browse files

Initial barebones VTKChartWidget complete

parent d5654767
Pipeline #14669 failed with stages
in 6 minutes and 54 seconds
#include <vtkAutoInit.h>
VTK_MODULE_INIT(vtkRenderingContextOpenGL2)
VTK_MODULE_INIT(vtkRenderingOpenGL2)
VTK_MODULE_INIT(vtkInteractionStyle)
VTK_MODULE_INIT(vtkRenderingFreeType)
#include "radixwidgets/vtkchartwidget.hh"
namespace radix
{
// Deine static variables
double VTKChartWidget::mDefaultBackground[3] = {1.0, 1.0, 1.0};
VTKChartWidget::VTKChartWidget(QWidget *parent)
: QVTKOpenGLWidget(parent)
{
mChartXY = vtkSmartPointer<vtkChartXY>::New();
mContextView = vtkSmartPointer<vtkContextView>::New();
mContextView->GetRenderer()->SetBackground(mDefaultBackground);
mContextView->GetScene()->AddItem(mChartXY);
vtkNew<vtkGenericOpenGLRenderWindow> renderWindow;
SetRenderWindow(renderWindow.Get());
setEnableHiDPI(true);
mContextView->SetRenderWindow(renderWindow.Get());
mContextView->SetInteractor(GetInteractor());
}
vtkSmartPointer<vtkChartXY> VTKChartWidget::chartXY() { return mChartXY; }
vtkSmartPointer<vtkContextView> VTKChartWidget::contextView()
{
return mContextView;
}
} // namespace radix
#ifndef RADIX_RADIXWIDGETS_VTKCHARTWIDGET_HH_
#define RADIX_RADIXWIDGETS_VTKCHARTWIDGET_HH_
#include <vector>
#include <QVTKOpenGLWidget.h>
#include <QVTKWidget.h>
#include <vtkAxis.h>
#include <vtkChartXY.h>
#include <vtkContextScene.h>
#include <vtkContextView.h>
#include <vtkEventQtSlotConnect.h>
#include <vtkFloatArray.h>
#include <vtkGenericOpenGLRenderWindow.h>
#include <vtkIdTypeArray.h>
#include <vtkPlot.h>
#include <vtkRenderWindow.h>
#include <vtkRenderer.h>
#include <vtkSmartPointer.h>
#include <vtkTable.h>
namespace radix
{
......@@ -12,6 +28,20 @@ class VTKChartWidget : public QVTKOpenGLWidget
public:
VTKChartWidget(QWidget* parent = 0);
vtkSmartPointer<vtkChartXY> chartXY();
vtkSmartPointer<vtkContextView> contextView();
private:
// Member objects
vtkSmartPointer<vtkChartXY> mChartXY;
vtkSmartPointer<vtkContextView> mContextView;
// Default values
static double mDefaultBackground[3];
signals:
void selectionChanged(std::vector<vtkIdTypeArray> selections);
}; // class VTKChartWidget
} // namespace radix
......
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