15#ifndef O2_MCH_CONTOUR_SVGWRITER_H
16#define O2_MCH_CONTOUR_SVGWRITER_H
24#include <boost/format.hpp>
43 mViewingBox{viewingBox}
56 mSVGBuffer << R
"(<g class=")" << classname << R"(">)"
62 void box(
double x,
double y,
double w,
double h)
64 mSVGBuffer << boost::format(R
"(<rect x="%f" y="%f" width="%f" height="%f"/>)") % x % y % w % h << "\n";
69 mSVGBuffer << boost::format(R
"(<text x="%f" y="%f">%s</text>)") % x % y % text.c_str() << "\n";
75 mSVGBuffer << R
"(<polygon points=")";
77 for (
auto j = 0;
j < vertices.size(); ++
j) {
79 mSVGBuffer <<
v.x <<
"," <<
v.y <<
' ';
81 mSVGBuffer << R
"("/>)"
88 for (
auto& p :
c.getPolygons()) {
97 mSVGBuffer << R
"(<polygon fill=")" << fillColor << R"(" points=")";
99 for (
auto j = 0;
j < vertices.size(); ++
j) {
100 auto v = vertices[
j];
101 mSVGBuffer <<
v.x <<
"," <<
v.y <<
' ';
103 mSVGBuffer << R
"("/>)"
107 template <
typename T>
111 for (
auto& p :
c.getPolygons()) {
116 void points(
const std::vector<std::pair<double, double>>& pts,
double radius = 0.05)
118 for (
auto& p : pts) {
119 mSVGBuffer << boost::format(R
"(<circle cx="%f" cy="%f" r="%f"/>)") % p.first % p.second % radius << "\n";
123 void addStyle(
const std::string& style) { mStyleBuffer << style <<
"\n"; }
126 << mStyleBuffer.str() <<
"</style>\n"; }
130 os << boost::format(R
"(<svg width="%d" height="%d" viewBox="%f %f %f %f">)") % mWidth %
131 mHeight % mViewingBox.xmin() % mViewingBox.ymin() % mViewingBox.width() % mViewingBox.height();
133 os << mSVGBuffer.str();
149 std::stringstream mSVGBuffer;
150 std::stringstream mStyleBuffer;
Class for time synchronization of RawReader instances.
void points(const std::vector< std::pair< double, double > > &pts, double radius=0.05)
void polygon(const o2::mch::contour::Polygon< T > &p)
SVGWriter & operator<<(T a)
void box(double x, double y, double w, double h)
void addStyle(const std::string &style)
void polygon(const o2::mch::contour::Polygon< T > &p, const std::string &fillColor)
SVGWriter(o2::mch::contour::BBox< double > viewingBox, int size=1024)
void contour(const o2::mch::contour::Contour< T > &c, const std::string &color)
void writeStyle(std::ostream &os)
void contour(const o2::mch::contour::Contour< T > &c)
void svgGroupStart(const std::string &classname)
void writeSVG(std::ostream &os)
void writeHTML(std::ostream &os)
void text(const std::string &text, double x, double y)
GLint GLsizei GLsizei height
GLboolean GLboolean GLboolean GLboolean a
GLubyte GLubyte GLubyte GLubyte w
std::vector< o2::mch::contour::Vertex< T > > getVertices(const std::vector< o2::mch::contour::Polygon< T > > &polygons)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
Defining DataPointCompositeObject explicitly as copiable.