2016-04-15 19:24:23 +00:00
|
|
|
//============================================================================
|
|
|
|
// Copyright (c) Kitware, Inc.
|
|
|
|
// All rights reserved.
|
|
|
|
// See LICENSE.txt for details.
|
2019-04-15 23:24:21 +00:00
|
|
|
//
|
2016-04-15 19:24:23 +00:00
|
|
|
// This software is distributed WITHOUT ANY WARRANTY; without even
|
|
|
|
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
// PURPOSE. See the above copyright notice for more information.
|
|
|
|
//============================================================================
|
|
|
|
#ifndef vtk_m_rendering_WorldAnnotator_h
|
|
|
|
#define vtk_m_rendering_WorldAnnotator_h
|
|
|
|
|
2016-09-01 16:39:15 +00:00
|
|
|
#include <vtkm/rendering/vtkm_rendering_export.h>
|
|
|
|
|
|
|
|
#include <vtkm/Types.h>
|
2017-09-14 21:07:06 +00:00
|
|
|
#include <vtkm/rendering/Canvas.h>
|
2016-04-15 19:24:23 +00:00
|
|
|
#include <vtkm/rendering/Color.h>
|
2021-10-02 21:08:03 +00:00
|
|
|
#include <vtkm/rendering/LineRendererBatcher.h>
|
2016-04-15 19:24:23 +00:00
|
|
|
|
2017-05-18 14:29:41 +00:00
|
|
|
namespace vtkm
|
|
|
|
{
|
|
|
|
namespace rendering
|
|
|
|
{
|
2016-04-15 19:24:23 +00:00
|
|
|
|
2017-09-14 21:07:06 +00:00
|
|
|
class Canvas;
|
|
|
|
|
2016-10-19 18:09:15 +00:00
|
|
|
class VTKM_RENDERING_EXPORT WorldAnnotator
|
2016-04-15 19:24:23 +00:00
|
|
|
{
|
|
|
|
public:
|
2023-06-12 20:02:47 +00:00
|
|
|
explicit WorldAnnotator(const vtkm::rendering::Canvas* canvas);
|
2017-09-14 21:07:06 +00:00
|
|
|
|
2023-05-08 15:29:27 +00:00
|
|
|
void AddLine(const vtkm::Vec3f_64& point0,
|
|
|
|
const vtkm::Vec3f_64& point1,
|
|
|
|
vtkm::Float32 lineWidth,
|
|
|
|
const vtkm::rendering::Color& color,
|
|
|
|
bool inFront = false) const;
|
2016-06-08 20:53:32 +00:00
|
|
|
|
2016-10-19 22:42:58 +00:00
|
|
|
VTKM_CONT
|
2017-05-26 17:53:28 +00:00
|
|
|
void AddLine(vtkm::Float64 x0,
|
|
|
|
vtkm::Float64 y0,
|
|
|
|
vtkm::Float64 z0,
|
|
|
|
vtkm::Float64 x1,
|
|
|
|
vtkm::Float64 y1,
|
|
|
|
vtkm::Float64 z1,
|
|
|
|
vtkm::Float32 lineWidth,
|
|
|
|
const vtkm::rendering::Color& color,
|
|
|
|
bool inFront = false) const
|
2016-08-26 18:58:28 +00:00
|
|
|
{
|
2017-05-26 17:53:28 +00:00
|
|
|
this->AddLine(
|
|
|
|
vtkm::make_Vec(x0, y0, z0), vtkm::make_Vec(x1, y1, z1), lineWidth, color, inFront);
|
2016-08-26 18:58:28 +00:00
|
|
|
}
|
|
|
|
|
2021-10-02 21:08:03 +00:00
|
|
|
VTKM_CONT
|
|
|
|
void BeginLineRenderingBatch() const;
|
|
|
|
|
|
|
|
VTKM_CONT
|
|
|
|
void EndLineRenderingBatch() const;
|
|
|
|
|
2023-05-08 15:29:27 +00:00
|
|
|
void AddText(const vtkm::Vec3f_32& origin,
|
|
|
|
const vtkm::Vec3f_32& right,
|
|
|
|
const vtkm::Vec3f_32& up,
|
|
|
|
vtkm::Float32 scale,
|
|
|
|
const vtkm::Vec2f_32& anchor,
|
|
|
|
const vtkm::rendering::Color& color,
|
|
|
|
const std::string& text,
|
2023-06-12 20:02:47 +00:00
|
|
|
vtkm::Float32 depth = 0.f) const;
|
2016-09-01 16:39:15 +00:00
|
|
|
|
2016-10-19 22:42:58 +00:00
|
|
|
VTKM_CONT
|
2017-05-26 17:53:28 +00:00
|
|
|
void AddText(vtkm::Float32 originX,
|
|
|
|
vtkm::Float32 originY,
|
|
|
|
vtkm::Float32 originZ,
|
|
|
|
vtkm::Float32 rightX,
|
|
|
|
vtkm::Float32 rightY,
|
|
|
|
vtkm::Float32 rightZ,
|
|
|
|
vtkm::Float32 upX,
|
|
|
|
vtkm::Float32 upY,
|
|
|
|
vtkm::Float32 upZ,
|
|
|
|
vtkm::Float32 scale,
|
|
|
|
vtkm::Float32 anchorX,
|
|
|
|
vtkm::Float32 anchorY,
|
|
|
|
const vtkm::rendering::Color& color,
|
2017-05-18 14:29:41 +00:00
|
|
|
const std::string& text) const
|
2016-08-26 18:58:28 +00:00
|
|
|
{
|
2017-05-26 17:53:28 +00:00
|
|
|
this->AddText(vtkm::make_Vec(originX, originY, originZ),
|
|
|
|
vtkm::make_Vec(rightX, rightY, rightZ),
|
|
|
|
vtkm::make_Vec(upX, upY, upZ),
|
|
|
|
scale,
|
|
|
|
vtkm::make_Vec(anchorX, anchorY),
|
|
|
|
color,
|
2016-08-26 18:58:28 +00:00
|
|
|
text);
|
|
|
|
}
|
2017-09-14 21:07:06 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
const vtkm::rendering::Canvas* Canvas;
|
2023-05-08 15:29:27 +00:00
|
|
|
mutable vtkm::rendering::LineRendererBatcher LineBatcher;
|
2016-04-15 19:24:23 +00:00
|
|
|
};
|
2017-05-18 14:29:41 +00:00
|
|
|
}
|
|
|
|
} //namespace vtkm::rendering
|
2016-04-15 19:24:23 +00:00
|
|
|
|
|
|
|
#endif // vtk_m_rendering_WorldAnnotator_h
|