2016-05-09 20:32:27 +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_AxisAnnotation2D_h
|
|
|
|
#define vtk_m_rendering_AxisAnnotation2D_h
|
|
|
|
|
2016-08-25 23:54:32 +00:00
|
|
|
#include <vtkm/rendering/vtkm_rendering_export.h>
|
|
|
|
|
|
|
|
#include <vtkm/Range.h>
|
2016-05-09 20:32:27 +00:00
|
|
|
#include <vtkm/cont/DataSet.h>
|
2016-08-26 18:58:28 +00:00
|
|
|
#include <vtkm/rendering/AxisAnnotation.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-08-26 18:58:28 +00:00
|
|
|
#include <vtkm/rendering/Color.h>
|
2016-05-09 20:32:27 +00:00
|
|
|
#include <vtkm/rendering/WorldAnnotator.h>
|
2016-05-20 21:57:56 +00:00
|
|
|
#include <vtkm/rendering/TextAnnotation.h>
|
2016-05-09 20:32:27 +00:00
|
|
|
|
|
|
|
namespace vtkm {
|
|
|
|
namespace rendering {
|
|
|
|
|
|
|
|
class AxisAnnotation2D : public AxisAnnotation
|
|
|
|
{
|
|
|
|
protected:
|
2016-08-25 23:54:32 +00:00
|
|
|
vtkm::Float64 MajorTickSizeX, MajorTickSizeY, MajorTickOffset;
|
|
|
|
vtkm::Float64 MinorTickSizeX, MinorTickSizeY, MinorTickOffset;
|
|
|
|
vtkm::Float64 PosX0, PosY0, PosX1, PosY1;
|
|
|
|
vtkm::Range TickRange;
|
|
|
|
vtkm::Float32 FontScale;
|
|
|
|
vtkm::Float32 LineWidth;
|
|
|
|
vtkm::rendering::Color Color;
|
|
|
|
bool Logarithmic;
|
2016-05-20 21:57:56 +00:00
|
|
|
|
2016-08-25 23:54:32 +00:00
|
|
|
TextAnnotation::HorizontalAlignment AlignH;
|
|
|
|
TextAnnotation::VerticalAlignment AlignV;
|
|
|
|
std::vector<TextAnnotation*> Labels;
|
2016-05-20 21:57:56 +00:00
|
|
|
|
2016-05-09 20:32:27 +00:00
|
|
|
|
2016-08-25 23:54:32 +00:00
|
|
|
std::vector<vtkm::Float64> PositionsMajor;
|
|
|
|
std::vector<vtkm::Float64> ProportionsMajor;
|
2016-05-09 20:32:27 +00:00
|
|
|
|
2016-08-25 23:54:32 +00:00
|
|
|
std::vector<vtkm::Float64> PositionsMinor;
|
|
|
|
std::vector<vtkm::Float64> ProportionsMinor;
|
2016-05-09 20:32:27 +00:00
|
|
|
|
2016-08-25 23:54:32 +00:00
|
|
|
int MoreOrLessTickAdjustment;
|
2016-05-09 20:32:27 +00:00
|
|
|
public:
|
2016-08-25 23:54:32 +00:00
|
|
|
VTKM_RENDERING_EXPORT
|
|
|
|
AxisAnnotation2D();
|
|
|
|
|
|
|
|
VTKM_RENDERING_EXPORT
|
2016-09-08 23:08:17 +00:00
|
|
|
~AxisAnnotation2D();
|
2016-08-25 23:54:32 +00:00
|
|
|
|
2016-05-09 20:32:27 +00:00
|
|
|
#if 0
|
2016-08-25 23:54:32 +00:00
|
|
|
VTKM_RENDERING_EXPORT
|
2016-05-09 20:32:27 +00:00
|
|
|
void SetLogarithmic(bool l)
|
|
|
|
{
|
2016-08-25 23:54:32 +00:00
|
|
|
this->Logarithmic = l;
|
2016-05-09 20:32:27 +00:00
|
|
|
}
|
|
|
|
#endif
|
2016-08-25 23:54:32 +00:00
|
|
|
|
|
|
|
VTKM_RENDERING_EXPORT
|
2016-05-09 20:32:27 +00:00
|
|
|
void SetMoreOrLessTickAdjustment(int offset)
|
|
|
|
{
|
2016-08-25 23:54:32 +00:00
|
|
|
this->MoreOrLessTickAdjustment = offset;
|
2016-05-09 20:32:27 +00:00
|
|
|
}
|
2016-08-25 23:54:32 +00:00
|
|
|
|
|
|
|
VTKM_RENDERING_EXPORT
|
2016-05-19 16:49:45 +00:00
|
|
|
void SetColor(vtkm::rendering::Color c)
|
2016-05-09 20:32:27 +00:00
|
|
|
{
|
2016-08-25 23:54:32 +00:00
|
|
|
this->Color = c;
|
2016-05-09 20:32:27 +00:00
|
|
|
}
|
2016-08-25 23:54:32 +00:00
|
|
|
|
|
|
|
VTKM_RENDERING_EXPORT
|
2016-05-19 16:49:45 +00:00
|
|
|
void SetLineWidth(vtkm::Float32 lw)
|
2016-05-09 20:32:27 +00:00
|
|
|
{
|
2016-08-25 23:54:32 +00:00
|
|
|
this->LineWidth = lw;
|
2016-05-09 20:32:27 +00:00
|
|
|
}
|
2016-08-25 23:54:32 +00:00
|
|
|
|
|
|
|
VTKM_RENDERING_EXPORT
|
2016-05-19 16:49:45 +00:00
|
|
|
void SetMajorTickSize(vtkm::Float64 xlen, vtkm::Float64 ylen, vtkm::Float64 offset)
|
2016-05-09 20:32:27 +00:00
|
|
|
{
|
|
|
|
/// 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
|
2016-08-25 23:54:32 +00:00
|
|
|
this->MajorTickSizeX=xlen;
|
|
|
|
this->MajorTickSizeY=ylen;
|
|
|
|
this->MajorTickOffset = offset;
|
2016-05-09 20:32:27 +00:00
|
|
|
}
|
2016-08-25 23:54:32 +00:00
|
|
|
|
|
|
|
VTKM_RENDERING_EXPORT
|
2016-05-19 16:49:45 +00:00
|
|
|
void SetMinorTickSize(vtkm::Float64 xlen, vtkm::Float64 ylen, vtkm::Float64 offset)
|
2016-05-09 20:32:27 +00:00
|
|
|
{
|
2016-08-25 23:54:32 +00:00
|
|
|
this->MinorTickSizeX=xlen;
|
|
|
|
this->MinorTickSizeY=ylen;
|
|
|
|
this->MinorTickOffset = offset;
|
2016-05-09 20:32:27 +00:00
|
|
|
}
|
2016-08-25 23:54:32 +00:00
|
|
|
|
2016-05-09 20:32:27 +00:00
|
|
|
///\todo: rename, since it might be screen OR world position?
|
2016-08-25 23:54:32 +00:00
|
|
|
VTKM_RENDERING_EXPORT
|
|
|
|
void SetScreenPosition(vtkm::Float64 x0, vtkm::Float64 y0,
|
|
|
|
vtkm::Float64 x1, vtkm::Float64 y1)
|
2016-05-09 20:32:27 +00:00
|
|
|
{
|
2016-08-25 23:54:32 +00:00
|
|
|
this->PosX0 = x0;
|
|
|
|
this->PosY0 = y0;
|
2016-05-09 20:32:27 +00:00
|
|
|
|
2016-08-25 23:54:32 +00:00
|
|
|
this->PosX1 = x1;
|
|
|
|
this->PosY1 = y1;
|
2016-05-09 20:32:27 +00:00
|
|
|
}
|
2016-08-25 23:54:32 +00:00
|
|
|
|
|
|
|
VTKM_RENDERING_EXPORT
|
2016-05-20 21:57:56 +00:00
|
|
|
void SetLabelAlignment(TextAnnotation::HorizontalAlignment h,
|
|
|
|
TextAnnotation::VerticalAlignment v)
|
2016-05-09 20:32:27 +00:00
|
|
|
{
|
2016-08-25 23:54:32 +00:00
|
|
|
this->AlignH = h;
|
|
|
|
this->AlignV = v;
|
2016-05-09 20:32:27 +00:00
|
|
|
}
|
2016-08-25 23:54:32 +00:00
|
|
|
|
|
|
|
VTKM_RENDERING_EXPORT
|
2016-05-20 21:57:56 +00:00
|
|
|
void SetLabelFontScale(vtkm::Float32 s)
|
2016-05-09 20:32:27 +00:00
|
|
|
{
|
2016-08-25 23:54:32 +00:00
|
|
|
this->FontScale = s;
|
|
|
|
for (unsigned int i=0; i<this->Labels.size(); i++)
|
|
|
|
this->Labels[i]->SetScale(s);
|
2016-05-09 20:32:27 +00:00
|
|
|
}
|
|
|
|
|
2016-08-25 23:54:32 +00:00
|
|
|
VTKM_RENDERING_EXPORT
|
|
|
|
void SetRangeForAutoTicks(const vtkm::Range &range);
|
|
|
|
VTKM_RENDERING_EXPORT
|
|
|
|
void SetRangeForAutoTicks(vtkm::Float64 lower, vtkm::Float64 upper)
|
2016-05-09 20:32:27 +00:00
|
|
|
{
|
2016-08-25 23:54:32 +00:00
|
|
|
this->SetRangeForAutoTicks(vtkm::Range(lower, upper));
|
2016-05-09 20:32:27 +00:00
|
|
|
}
|
|
|
|
|
2016-08-25 23:54:32 +00:00
|
|
|
VTKM_RENDERING_EXPORT
|
2016-08-27 02:32:15 +00:00
|
|
|
void SetMajorTicks(const std::vector<vtkm::Float64> &positions,
|
|
|
|
const std::vector<vtkm::Float64> &proportions);
|
2016-08-25 23:54:32 +00:00
|
|
|
|
|
|
|
VTKM_RENDERING_EXPORT
|
2016-08-27 02:32:15 +00:00
|
|
|
void SetMinorTicks(const std::vector<vtkm::Float64> &positions,
|
|
|
|
const std::vector<vtkm::Float64> &proportions);
|
2016-08-25 23:54:32 +00:00
|
|
|
|
|
|
|
VTKM_RENDERING_EXPORT
|
2016-08-26 18:58:28 +00:00
|
|
|
void Render(const vtkm::rendering::Camera &camera,
|
|
|
|
const vtkm::rendering::WorldAnnotator &worldAnnotator,
|
|
|
|
vtkm::rendering::Canvas &canvas) VTKM_OVERRIDE;
|
2016-05-09 20:32:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}} //namespace vtkm::rendering
|
|
|
|
|
|
|
|
#endif // vtk_m_rendering_AxisAnnotation2D_h
|