ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
vtkplot3dwidget.cpp
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #include "vtkplot3dwidget.h"
9 
10 #include <vtkChartXYZ.h>
11 #include <vtkContextScene.h>
12 #include <vtkContextView.h>
13 
14 #include "vtkutils.h"
15 
16 namespace VtkUtils {
17 class VtkPlot3DWidgetPrivate {
18 public:
20 };
21 
22 VtkPlot3DWidget::VtkPlot3DWidget(QWidget* parent) : VtkPlotWidget(parent) {
23  d_ptr = new VtkPlot3DWidgetPrivate;
24 }
25 
27 
28 vtkContextItem* VtkPlot3DWidget::chart() const {
29  vtkInitOnce(d_ptr->chart);
30  static const int Spacing = 100;
31  d_ptr->chart->SetGeometry(
32  vtkRectf(Spacing, Spacing, width() - Spacing, height() - Spacing));
33  contextView()->GetScene()->AddItem(d_ptr->chart);
34  return d_ptr->chart;
35 }
36 
37 } // namespace VtkUtils
int width
int height
VtkPlot3DWidget(QWidget *parent=nullptr)
vtkContextItem * chart() const
vtkContextView * contextView() const
void vtkInitOnce(T **obj)
Definition: vtkutils.h:44