Merge topic 'rendering-label-leak'
a79b4c2f Removing move command to remove warnings. e19e61f1 Merge branch 'rendering-label-leak' of https://gitlab.kitware.com/jameskress/vtk-m into rendering-label-leak 02a67d64 Merge remote-tracking branch 'upstream/master' into rendering-label-leak 3bab4087 Adding delete and assignment oeprators to annotations. e3ccd7f8 Adding previous cmake fix. 9f32bbe0 Merge branch 'rendering-label-leak' of https://gitlab.kitware.com/jameskress/vtk-m into rendering-label-leak 7906e89e Updating leak fix to use uniq_ptr. b92c4801 Update CMakeLists.txt ... Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Robert Maynard <robert.maynard@kitware.com> Merge-request: !1131
This commit is contained in:
commit
e28b274d6f
@ -99,8 +99,9 @@ void AxisAnnotation2D::Render(const vtkm::rendering::Camera& camera,
|
||||
unsigned int nmajor = (unsigned int)this->ProportionsMajor.size();
|
||||
while (this->Labels.size() < nmajor)
|
||||
{
|
||||
this->Labels.push_back(new vtkm::rendering::TextAnnotationScreen(
|
||||
"test", this->Color, this->FontScale, vtkm::Vec<vtkm::Float32, 2>(0, 0), 0));
|
||||
this->Labels.push_back(
|
||||
std::unique_ptr<TextAnnotation>(new vtkm::rendering::TextAnnotationScreen(
|
||||
"test", this->Color, this->FontScale, vtkm::Vec<vtkm::Float32, 2>(0, 0), 0)));
|
||||
}
|
||||
|
||||
std::stringstream numberToString;
|
||||
@ -127,7 +128,9 @@ void AxisAnnotation2D::Render(const vtkm::rendering::Camera& camera,
|
||||
this->Labels[i]->SetText(numberToString.str());
|
||||
//if (fabs(this->PositionsMajor[i]) < 1e-10)
|
||||
// this->Labels[i]->SetText("0");
|
||||
((TextAnnotationScreen*)(this->Labels[i]))->SetPosition(vtkm::Float32(xs), vtkm::Float32(ys));
|
||||
TextAnnotation* tempBase = this->Labels[i].get();
|
||||
TextAnnotationScreen* tempDerived = static_cast<TextAnnotationScreen*>(tempBase);
|
||||
tempDerived->SetPosition(vtkm::Float32(xs), vtkm::Float32(ys));
|
||||
|
||||
this->Labels[i]->SetAlignment(this->AlignH, this->AlignV);
|
||||
}
|
||||
|
@ -50,7 +50,8 @@ protected:
|
||||
|
||||
TextAnnotation::HorizontalAlignment AlignH;
|
||||
TextAnnotation::VerticalAlignment AlignV;
|
||||
std::vector<TextAnnotation*> Labels;
|
||||
std::vector<std::unique_ptr<TextAnnotation>> Labels;
|
||||
// std::vector<TextAnnotation*> Labels;
|
||||
|
||||
std::vector<vtkm::Float64> PositionsMajor;
|
||||
std::vector<vtkm::Float64> ProportionsMajor;
|
||||
@ -65,6 +66,10 @@ public:
|
||||
|
||||
~AxisAnnotation2D();
|
||||
|
||||
AxisAnnotation2D(const AxisAnnotation2D&) = delete;
|
||||
|
||||
AxisAnnotation2D& operator=(const AxisAnnotation2D&) = delete;
|
||||
|
||||
void SetLogarithmic(bool l) { this->Logarithmic = l; }
|
||||
|
||||
void SetMoreOrLessTickAdjustment(int offset) { this->MoreOrLessTickAdjustment = offset; }
|
||||
|
@ -80,11 +80,12 @@ void AxisAnnotation3D::Render(const Camera& camera,
|
||||
unsigned int nmajor = (unsigned int)proportions.size();
|
||||
while (this->Labels.size() < nmajor)
|
||||
{
|
||||
this->Labels.push_back(new TextAnnotationBillboard("test",
|
||||
this->Color,
|
||||
vtkm::Float32(this->FontScale),
|
||||
vtkm::Vec<vtkm::Float32, 3>(0, 0, 0),
|
||||
0));
|
||||
this->Labels.push_back(std::unique_ptr<TextAnnotationBillboard>(
|
||||
new vtkm::rendering::TextAnnotationBillboard("test",
|
||||
this->Color,
|
||||
vtkm::Float32(this->FontScale),
|
||||
vtkm::Vec<vtkm::Float32, 3>(0, 0, 0),
|
||||
0)));
|
||||
}
|
||||
|
||||
std::stringstream numberToString;
|
||||
|
@ -53,7 +53,7 @@ protected:
|
||||
vtkm::Float32 FontOffset;
|
||||
vtkm::Float32 LineWidth;
|
||||
vtkm::rendering::Color Color;
|
||||
std::vector<TextAnnotationBillboard*> Labels;
|
||||
std::vector<std::unique_ptr<TextAnnotationBillboard>> Labels;
|
||||
int MoreOrLessTickAdjustment;
|
||||
|
||||
public:
|
||||
@ -61,6 +61,10 @@ public:
|
||||
|
||||
~AxisAnnotation3D();
|
||||
|
||||
AxisAnnotation3D(const AxisAnnotation3D&) = delete;
|
||||
|
||||
AxisAnnotation3D& operator=(const AxisAnnotation3D&) = delete;
|
||||
|
||||
VTKM_CONT
|
||||
void SetMoreOrLessTickAdjustment(int offset) { this->MoreOrLessTickAdjustment = offset; }
|
||||
|
||||
|
@ -69,13 +69,14 @@ void ColorLegendAnnotation::Render(const vtkm::rendering::Camera& camera,
|
||||
|
||||
while (this->Annot.size() < this->Labels.size())
|
||||
{
|
||||
this->Annot.push_back(new vtkm::rendering::TextAnnotationScreen(
|
||||
"test", this->LabelColor, this->FontScale, vtkm::Vec<vtkm::Float32, 2>(0, 0), 0));
|
||||
this->Annot.push_back(
|
||||
std::unique_ptr<TextAnnotationScreen>(new vtkm::rendering::TextAnnotationScreen(
|
||||
"test", this->LabelColor, this->FontScale, vtkm::Vec<vtkm::Float32, 2>(0, 0), 0)));
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < this->Annot.size(); ++i)
|
||||
{
|
||||
TextAnnotationScreen* txt = Annot[i];
|
||||
TextAnnotationScreen* txt = Annot[i].get();
|
||||
txt->SetText(Labels[i]);
|
||||
txt->SetPosition(r + .02f, (b + t) / 2.f);
|
||||
txt->SetAlignment(TextAnnotationScreen::Left, TextAnnotationScreen::VCenter);
|
||||
|
@ -39,12 +39,14 @@ private:
|
||||
vtkm::Float32 FontScale;
|
||||
vtkm::rendering::Color LabelColor;
|
||||
std::vector<std::string> Labels;
|
||||
std::vector<TextAnnotationScreen*> Annot;
|
||||
std::vector<std::unique_ptr<TextAnnotationScreen>> Annot;
|
||||
std::vector<vtkm::rendering::Color> ColorSwatchList;
|
||||
|
||||
public:
|
||||
ColorLegendAnnotation();
|
||||
~ColorLegendAnnotation();
|
||||
ColorLegendAnnotation(const ColorLegendAnnotation&) = delete;
|
||||
ColorLegendAnnotation& operator=(const ColorLegendAnnotation&) = delete;
|
||||
|
||||
void Clear();
|
||||
void AddItem(const std::string& label, vtkm::rendering::Color color);
|
||||
|
Loading…
Reference in New Issue
Block a user