mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-10-05 01:49:02 +00:00
non-virtual color table annotations
This commit is contained in:
parent
40a30dbfe7
commit
10bcf618f6
@ -20,12 +20,9 @@ ColorBarAnnotation::ColorBarAnnotation()
|
||||
: ColorTable(vtkm::ColorSpace::Lab)
|
||||
, Position(vtkm::Range(-0.88, +0.88), vtkm::Range(+0.87, +0.92), vtkm::Range(0, 0))
|
||||
, Horizontal(true)
|
||||
, FieldName("")
|
||||
{
|
||||
}
|
||||
|
||||
ColorBarAnnotation::~ColorBarAnnotation() {}
|
||||
|
||||
void ColorBarAnnotation::SetFieldName(const std::string& fieldName)
|
||||
{
|
||||
FieldName = fieldName;
|
||||
@ -83,7 +80,7 @@ void ColorBarAnnotation::Render(const vtkm::rendering::Camera& camera,
|
||||
this->Axis.SetMinorTickSize(0, 0, 0); // no minor ticks
|
||||
this->Axis.Render(camera, worldAnnotator, canvas);
|
||||
|
||||
if (FieldName != "")
|
||||
if (!FieldName.empty())
|
||||
{
|
||||
vtkm::Vec2f_32 labelPos;
|
||||
if (Horizontal)
|
||||
|
@ -35,8 +35,6 @@ protected:
|
||||
public:
|
||||
ColorBarAnnotation();
|
||||
|
||||
virtual ~ColorBarAnnotation();
|
||||
|
||||
VTKM_CONT
|
||||
void SetColorTable(const vtkm::cont::ColorTable& colorTable) { this->ColorTable = colorTable; }
|
||||
|
||||
@ -56,9 +54,9 @@ public:
|
||||
VTKM_CONT
|
||||
void SetPosition(const vtkm::Bounds& position);
|
||||
|
||||
virtual void Render(const vtkm::rendering::Camera& camera,
|
||||
const vtkm::rendering::WorldAnnotator& worldAnnotator,
|
||||
vtkm::rendering::Canvas& canvas);
|
||||
void Render(const vtkm::rendering::Camera& camera,
|
||||
const vtkm::rendering::WorldAnnotator& worldAnnotator,
|
||||
vtkm::rendering::Canvas& canvas);
|
||||
};
|
||||
}
|
||||
} //namespace vtkm::rendering
|
||||
|
@ -21,8 +21,6 @@ ColorLegendAnnotation::ColorLegendAnnotation()
|
||||
this->LabelColor = vtkm::rendering::Color::white;
|
||||
}
|
||||
|
||||
ColorLegendAnnotation::~ColorLegendAnnotation() {}
|
||||
|
||||
void ColorLegendAnnotation::Clear()
|
||||
{
|
||||
this->Labels.clear();
|
||||
@ -42,9 +40,9 @@ void ColorLegendAnnotation::Render(const vtkm::rendering::Camera& camera,
|
||||
vtkm::Float32 l = -0.95f, r = -0.90f;
|
||||
vtkm::Float32 b = +0.90f, t = +0.95f;
|
||||
|
||||
for (unsigned int i = 0; i < this->ColorSwatchList.size(); ++i)
|
||||
for (auto& color : this->ColorSwatchList)
|
||||
{
|
||||
canvas.AddColorSwatch(l, b, l, t, r, t, r, b, this->ColorSwatchList[i]);
|
||||
canvas.AddColorSwatch(l, b, l, t, r, t, r, b, color);
|
||||
b -= 0.07f;
|
||||
t -= 0.07f;
|
||||
}
|
||||
@ -58,7 +56,7 @@ void ColorLegendAnnotation::Render(const vtkm::rendering::Camera& camera,
|
||||
while (this->Annot.size() < this->Labels.size())
|
||||
{
|
||||
this->Annot.push_back(
|
||||
std::unique_ptr<TextAnnotationScreen>(new vtkm::rendering::TextAnnotationScreen(
|
||||
std::make_unique<TextAnnotationScreen>(vtkm::rendering::TextAnnotationScreen(
|
||||
"test", this->LabelColor, this->FontScale, vtkm::Vec2f_32(0, 0), 0)));
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,6 @@ private:
|
||||
|
||||
public:
|
||||
ColorLegendAnnotation();
|
||||
~ColorLegendAnnotation();
|
||||
ColorLegendAnnotation(const ColorLegendAnnotation&) = delete;
|
||||
ColorLegendAnnotation& operator=(const ColorLegendAnnotation&) = delete;
|
||||
|
||||
@ -46,13 +45,13 @@ public:
|
||||
void SetLabelFontScale(vtkm::Float32 s)
|
||||
{
|
||||
this->FontScale = s;
|
||||
for (unsigned int i = 0; i < this->Annot.size(); i++)
|
||||
this->Annot[i]->SetScale(s);
|
||||
for (auto& annot : this->Annot)
|
||||
annot->SetScale(s);
|
||||
}
|
||||
|
||||
virtual void Render(const vtkm::rendering::Camera&,
|
||||
const vtkm::rendering::WorldAnnotator& annotator,
|
||||
vtkm::rendering::Canvas& canvas);
|
||||
void Render(const vtkm::rendering::Camera&,
|
||||
const vtkm::rendering::WorldAnnotator& annotator,
|
||||
vtkm::rendering::Canvas& canvas);
|
||||
};
|
||||
}
|
||||
} //namespace vtkm::rendering
|
||||
|
Loading…
Reference in New Issue
Block a user