2016-05-20 21:57:56 +00:00
|
|
|
//============================================================================
|
|
|
|
// Copyright (c) Kitware, Inc.
|
|
|
|
// All rights reserved.
|
|
|
|
// See LICENSE.txt for details.
|
2019-04-15 23:24:21 +00:00
|
|
|
//
|
2016-05-20 21:57:56 +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_TextAnnotation_h
|
|
|
|
#define vtk_m_rendering_TextAnnotation_h
|
|
|
|
|
2016-09-01 15:46:37 +00:00
|
|
|
#include <vtkm/rendering/vtkm_rendering_export.h>
|
|
|
|
|
2016-06-02 19:04:01 +00:00
|
|
|
#include <vtkm/rendering/Camera.h>
|
2016-06-02 22:02:17 +00:00
|
|
|
#include <vtkm/rendering/Canvas.h>
|
2016-06-01 20:56:30 +00:00
|
|
|
#include <vtkm/rendering/WorldAnnotator.h>
|
2016-09-01 15:46:37 +00:00
|
|
|
|
2017-05-18 14:29:41 +00:00
|
|
|
namespace vtkm
|
|
|
|
{
|
|
|
|
namespace rendering
|
|
|
|
{
|
2016-05-20 21:57:56 +00:00
|
|
|
|
2016-10-19 18:09:15 +00:00
|
|
|
class VTKM_RENDERING_EXPORT TextAnnotation
|
2016-05-20 21:57:56 +00:00
|
|
|
{
|
2016-05-23 17:52:47 +00:00
|
|
|
public:
|
|
|
|
enum HorizontalAlignment
|
2017-05-18 14:29:41 +00:00
|
|
|
{
|
|
|
|
Left,
|
|
|
|
HCenter,
|
|
|
|
Right
|
|
|
|
};
|
2016-05-23 17:52:47 +00:00
|
|
|
enum VerticalAlignment
|
2017-05-18 14:29:41 +00:00
|
|
|
{
|
|
|
|
Bottom,
|
|
|
|
VCenter,
|
|
|
|
Top
|
|
|
|
};
|
2016-05-20 21:57:56 +00:00
|
|
|
|
2016-05-23 17:52:47 +00:00
|
|
|
protected:
|
2017-05-18 14:29:41 +00:00
|
|
|
std::string Text;
|
|
|
|
Color TextColor;
|
|
|
|
vtkm::Float32 Scale;
|
2019-07-31 16:20:38 +00:00
|
|
|
vtkm::Vec2f_32 Anchor;
|
2016-05-20 21:57:56 +00:00
|
|
|
|
2016-05-23 17:52:47 +00:00
|
|
|
public:
|
2017-05-26 17:53:28 +00:00
|
|
|
TextAnnotation(const std::string& text,
|
|
|
|
const vtkm::rendering::Color& color,
|
2016-09-01 15:46:37 +00:00
|
|
|
vtkm::Float32 scalar);
|
2016-05-20 21:57:56 +00:00
|
|
|
|
2016-09-01 15:46:37 +00:00
|
|
|
virtual ~TextAnnotation();
|
2016-05-23 17:52:47 +00:00
|
|
|
|
2017-05-18 14:29:41 +00:00
|
|
|
void SetText(const std::string& text);
|
2016-05-23 17:52:47 +00:00
|
|
|
|
2017-05-18 14:29:41 +00:00
|
|
|
const std::string& GetText() const;
|
2016-05-23 17:52:47 +00:00
|
|
|
|
2016-09-01 15:46:37 +00:00
|
|
|
/// Set the anchor point relative to the box containing the text. The anchor
|
|
|
|
/// is scaled in both directions to the range [-1,1] with -1 at the lower
|
|
|
|
/// left and 1 at the upper right.
|
|
|
|
///
|
2019-07-31 16:20:38 +00:00
|
|
|
void SetRawAnchor(const vtkm::Vec2f_32& anchor);
|
2016-05-23 17:52:47 +00:00
|
|
|
|
2016-09-01 15:46:37 +00:00
|
|
|
void SetRawAnchor(vtkm::Float32 h, vtkm::Float32 v);
|
2016-05-23 17:52:47 +00:00
|
|
|
|
2016-09-01 15:46:37 +00:00
|
|
|
void SetAlignment(HorizontalAlignment h, VerticalAlignment v);
|
2016-05-23 17:52:47 +00:00
|
|
|
|
2016-09-01 15:46:37 +00:00
|
|
|
void SetScale(vtkm::Float32 scale);
|
2016-05-23 17:52:47 +00:00
|
|
|
|
2017-05-18 14:29:41 +00:00
|
|
|
virtual void Render(const vtkm::rendering::Camera& camera,
|
|
|
|
const vtkm::rendering::WorldAnnotator& worldAnnotator,
|
|
|
|
vtkm::rendering::Canvas& canvas) const = 0;
|
2016-05-20 21:57:56 +00:00
|
|
|
};
|
2016-09-01 15:46:37 +00:00
|
|
|
}
|
|
|
|
} //namespace vtkm::rendering
|
|
|
|
|
2016-05-20 21:57:56 +00:00
|
|
|
#endif //vtk_m_rendering_TextAnnotation_h
|