Skip to content

Commit 7414f4e

Browse files
committed
Implement TAnnotation::SavePrimitive
Was stored before as TLatex object with Z coordinate
1 parent 4ee5e77 commit 7414f4e

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

graf2d/gpad/inc/TAnnotation.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class TAnnotation : public TLatex {
3030
void Paint(Option_t *option="") override;
3131
void PaintAnnotation(Double_t x, Double_t y, Double_t z, Double_t angle, Double_t size, const Char_t *text);
3232
void Print(Option_t *option="") const override;
33+
void SavePrimitive(std::ostream &out, Option_t *option = "") override;
3334

3435
void SetZ(double z) { fZ = z; } // *MENU*
3536
double GetZ() const { return fZ; }

graf2d/gpad/src/TAnnotation.cxx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,21 @@ void TAnnotation::Print(Option_t *) const
131131
if (GetTextAngle() != 0 ) printf(" Angle=%f",GetTextAngle());
132132
printf("\n");
133133
}
134+
135+
////////////////////////////////////////////////////////////////////////////////
136+
/// Save primitives in this pad on the C++ source file out.
137+
138+
void TAnnotation::SavePrimitive(std::ostream &out, Option_t *option)
139+
{
140+
SavePrimitiveConstructor(
141+
out, Class(), "annotation",
142+
TString::Format("%g, %g, %g, \"%s\"", fX, fY, fZ, TString(GetTitle()).ReplaceSpecialCppChars().Data()), kFALSE);
143+
144+
SaveTextAttributes(out, "annotation", 11, 0, 1, 62, 0.05);
145+
SaveLineAttributes(out, "annotation", 1, 1, 1);
146+
147+
if (TestBit(kTextNDC))
148+
out << " annotation->SetNDC();\n";
149+
150+
SavePrimitiveDraw(out, "annotation", option);
151+
}

0 commit comments

Comments
 (0)