mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-10-05 01:49:02 +00:00
use unique_ptr for PIMPL for View
This commit is contained in:
parent
61f123be22
commit
b4f17b8518
@ -37,7 +37,7 @@ View::View(const vtkm::rendering::Scene& scene,
|
||||
const vtkm::rendering::Canvas& canvas,
|
||||
const vtkm::rendering::Color& backgroundColor,
|
||||
const vtkm::rendering::Color& foregroundColor)
|
||||
: Internal(std::make_shared<InternalData>())
|
||||
: Internal(std::make_unique<InternalData>())
|
||||
{
|
||||
this->Internal->Scene = scene;
|
||||
this->Internal->MapperPointer = mapper.NewCopy();
|
||||
@ -65,7 +65,7 @@ View::View(const vtkm::rendering::Scene& scene,
|
||||
const vtkm::rendering::Camera& camera,
|
||||
const vtkm::rendering::Color& backgroundColor,
|
||||
const vtkm::rendering::Color& foregroundColor)
|
||||
: Internal(std::make_shared<InternalData>())
|
||||
: Internal(std::make_unique<InternalData>())
|
||||
{
|
||||
this->Internal->Scene = scene;
|
||||
this->Internal->MapperPointer = mapper.NewCopy();
|
||||
@ -77,7 +77,7 @@ View::View(const vtkm::rendering::Scene& scene,
|
||||
this->AxisColor = foregroundColor;
|
||||
}
|
||||
|
||||
View::~View() {}
|
||||
View::~View() = default;
|
||||
|
||||
const vtkm::rendering::Scene& View::GetScene() const
|
||||
{
|
||||
|
@ -90,7 +90,7 @@ public:
|
||||
void SetWorldAnnotationsEnabled(bool val) { this->WorldAnnotationsEnabled = val; }
|
||||
|
||||
VTKM_CONT void SetRenderAnnotationsEnabled(bool val) { this->RenderAnnotationsEnabled = val; }
|
||||
VTKM_CONT bool GetRenderAnnotationsEnabled() { return this->RenderAnnotationsEnabled; }
|
||||
VTKM_CONT bool GetRenderAnnotationsEnabled() const { return this->RenderAnnotationsEnabled; }
|
||||
|
||||
virtual void Paint() = 0;
|
||||
virtual void RenderScreenAnnotations() = 0;
|
||||
@ -126,7 +126,7 @@ protected:
|
||||
bool RenderAnnotationsEnabled = true;
|
||||
|
||||
private:
|
||||
std::shared_ptr<InternalData> Internal;
|
||||
std::unique_ptr<InternalData> Internal;
|
||||
};
|
||||
|
||||
} // namespace vtkm::rendering
|
||||
|
@ -36,8 +36,6 @@ View1D::View1D(const vtkm::rendering::Scene& scene,
|
||||
{
|
||||
}
|
||||
|
||||
View1D::~View1D() {}
|
||||
|
||||
void View1D::Paint()
|
||||
{
|
||||
this->GetCanvas().Clear();
|
||||
@ -104,7 +102,7 @@ void View1D::RenderColorLegendAnnotations()
|
||||
this->GetCanvas().BeginTextRenderingBatch();
|
||||
for (int i = 0; i < this->GetScene().GetNumberOfActors(); ++i)
|
||||
{
|
||||
vtkm::rendering::Actor act = this->GetScene().GetActor(i);
|
||||
const auto& act = this->GetScene().GetActor(i);
|
||||
|
||||
vtkm::Vec<double, 4> colorData;
|
||||
act.GetColorTable().GetPoint(0, colorData);
|
||||
|
@ -35,8 +35,6 @@ public:
|
||||
const vtkm::rendering::Color& backgroundColor = vtkm::rendering::Color(0, 0, 0, 1),
|
||||
const vtkm::rendering::Color& foregroundColor = vtkm::rendering::Color(1, 1, 1, 1));
|
||||
|
||||
~View1D();
|
||||
|
||||
void Paint() override;
|
||||
void RenderScreenAnnotations() override;
|
||||
void RenderWorldAnnotations() override;
|
||||
|
@ -34,8 +34,6 @@ View2D::View2D(const vtkm::rendering::Scene& scene,
|
||||
{
|
||||
}
|
||||
|
||||
View2D::~View2D() {}
|
||||
|
||||
void View2D::Paint()
|
||||
{
|
||||
this->GetCanvas().Clear();
|
||||
|
@ -36,8 +36,6 @@ public:
|
||||
const vtkm::rendering::Color& backgroundColor = vtkm::rendering::Color(0, 0, 0, 1),
|
||||
const vtkm::rendering::Color& foregroundColor = vtkm::rendering::Color(1, 1, 1, 1));
|
||||
|
||||
~View2D();
|
||||
|
||||
void Paint() override;
|
||||
|
||||
void RenderScreenAnnotations() override;
|
||||
|
@ -34,8 +34,6 @@ View3D::View3D(const vtkm::rendering::Scene& scene,
|
||||
{
|
||||
}
|
||||
|
||||
View3D::~View3D() {}
|
||||
|
||||
void View3D::Paint()
|
||||
{
|
||||
this->GetCanvas().Clear();
|
||||
|
@ -37,8 +37,6 @@ public:
|
||||
const vtkm::rendering::Color& backgroundColor = vtkm::rendering::Color(0, 0, 0, 1),
|
||||
const vtkm::rendering::Color& foregroundColor = vtkm::rendering::Color(1, 1, 1, 1));
|
||||
|
||||
~View3D();
|
||||
|
||||
void Paint() override;
|
||||
|
||||
void RenderScreenAnnotations() override;
|
||||
|
Loading…
Reference in New Issue
Block a user