vtk-m/vtkm/rendering/AxisAnnotation3D.h

132 lines
3.8 KiB
C
Raw Normal View History

2016-04-19 21:04:00 +00:00
//============================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
// 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.
//
// Copyright 2016 Sandia Corporation.
// Copyright 2016 UT-Battelle, LLC.
// Copyright 2016 Los Alamos National Security.
//
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
// the U.S. Government retains certain rights in this software.
//
// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
// Laboratory (LANL), the U.S. Government retains certain rights in
// this software.
//============================================================================
#ifndef vtk_m_rendering_AxisAnnotation3D_h
#define vtk_m_rendering_AxisAnnotation3D_h
#include <vtkm/rendering/vtkm_rendering_export.h>
#include <vtkm/Range.h>
#if defined(_MSC_VER) && _MSC_VER < 1900
#define snprintf _snprintf
#endif
2016-04-19 21:04:00 +00:00
#include <vtkm/cont/DataSet.h>
2017-05-18 14:51:24 +00:00
#include <vtkm/rendering/AxisAnnotation.h>
2016-06-02 19:04:01 +00:00
#include <vtkm/rendering/Camera.h>
2016-04-19 21:04:00 +00:00
#include <vtkm/rendering/Color.h>
#include <vtkm/rendering/Scene.h>
#include <vtkm/rendering/TextAnnotationBillboard.h>
2017-05-18 14:51:24 +00:00
#include <vtkm/rendering/WorldAnnotator.h>
2016-04-19 21:04:00 +00:00
#include <sstream>
2017-05-18 14:29:41 +00:00
namespace vtkm
{
namespace rendering
{
2016-04-19 21:04:00 +00:00
class VTKM_RENDERING_EXPORT AxisAnnotation3D : public AxisAnnotation
2016-04-19 21:04:00 +00:00
{
private:
protected:
vtkm::Float64 TickMajorSize, TickMajorOffset;
vtkm::Float64 TickMinorSize, TickMinorOffset;
2017-05-18 14:29:41 +00:00
int Axis;
vtkm::Vec<vtkm::Float32, 3> Invert;
vtkm::Vec<vtkm::Float64, 3> Point0, Point1;
vtkm::Range Range;
vtkm::Float64 FontScale;
vtkm::Float32 FontOffset;
vtkm::Float32 LineWidth;
vtkm::rendering::Color Color;
std::vector<TextAnnotationBillboard*> Labels;
int MoreOrLessTickAdjustment;
2017-05-18 14:29:41 +00:00
public:
AxisAnnotation3D();
~AxisAnnotation3D();
VTKM_CONT
2017-05-18 14:29:41 +00:00
void SetMoreOrLessTickAdjustment(int offset) { this->MoreOrLessTickAdjustment = offset; }
VTKM_CONT
2017-05-18 14:29:41 +00:00
void SetColor(vtkm::rendering::Color c) { this->Color = c; }
VTKM_CONT
2017-05-18 14:29:41 +00:00
void SetAxis(int a) { this->Axis = a; }
void SetTickInvert(bool x, bool y, bool z);
/// offset of 0 means the tick is inside the frame
/// offset of 1 means the tick is outside the frame
/// offset of 0.5 means the tick is centered on the frame
VTKM_CONT
void SetMajorTickSize(vtkm::Float64 size, vtkm::Float64 offset)
2016-04-19 21:04:00 +00:00
{
this->TickMajorSize = size;
this->TickMajorOffset = offset;
2016-04-19 21:04:00 +00:00
}
VTKM_CONT
void SetMinorTickSize(vtkm::Float64 size, vtkm::Float64 offset)
2016-04-19 21:04:00 +00:00
{
this->TickMinorSize = size;
this->TickMinorOffset = offset;
2016-04-19 21:04:00 +00:00
}
VTKM_CONT
2017-05-18 14:29:41 +00:00
void SetWorldPosition(const vtkm::Vec<vtkm::Float64, 3>& point0,
const vtkm::Vec<vtkm::Float64, 3>& point1)
{
this->Point0 = point0;
this->Point1 = point1;
2016-04-19 21:04:00 +00:00
}
VTKM_CONT
void SetWorldPosition(vtkm::Float64 x0,
vtkm::Float64 y0,
vtkm::Float64 z0,
vtkm::Float64 x1,
vtkm::Float64 y1,
vtkm::Float64 z1)
2016-04-19 21:04:00 +00:00
{
2017-05-18 14:29:41 +00:00
this->SetWorldPosition(vtkm::make_Vec(x0, y0, z0), vtkm::make_Vec(x1, y1, z1));
}
void SetLabelFontScale(vtkm::Float64 s);
2017-05-18 14:29:41 +00:00
void SetLabelFontOffset(vtkm::Float32 off) { this->FontOffset = off; }
2017-05-18 14:29:41 +00:00
void SetRange(const vtkm::Range& range) { this->Range = range; }
void SetRange(vtkm::Float64 lower, vtkm::Float64 upper)
2016-04-19 21:04:00 +00:00
{
this->SetRange(vtkm::Range(lower, upper));
2016-04-19 21:04:00 +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) VTKM_OVERRIDE;
2016-04-19 21:04:00 +00:00
};
2017-05-18 14:29:41 +00:00
}
} //namespace vtkm::rendering
2016-04-19 21:04:00 +00:00
#endif // vtk_m_rendering_AxisAnnotation3D_h