Browse Source

feat: constructor of SvgRect

master
Dnomd343 2 years ago
parent
commit
2d793b22ff
  1. 44
      src/graph/graph.cc
  2. 4
      src/graph/svg/svg.h

44
src/graph/graph.cc

@ -8,50 +8,6 @@
void Graph::svg_demo(Analyse::track_data_t track_data) {
auto s = new SvgRect();
s->left = 50;
s->top = 80;
s->width = 100;
s->height = 200;
s->radius = 20;
s->opacity = 0.8;
s->line_opacity = 0.5;
s->color = "blue";
s->line_color = "green";
// printf(R"(<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="%d" height="%d">)", 1000, 1000);
// printf("\n");
//
// std::cout << " " << s.dump() << std::endl;
//
// printf("</svg>\n");
auto l = new SvgLine();
l->start_x = 100;
l->start_y = 200;
l->end_x = 300;
l->end_y = 400;
auto sg = SvgGraph(1000, 2000);
// sg.insert(&s);
// sg.insert(&l);
sg.insert(s);
sg.insert(l);
std::cout << sg.dump() << std::endl;
return;
//
// for (uint32_t i = 0; i < track_data.size(); ++i) {
//

4
src/graph/svg/svg.h

@ -32,9 +32,12 @@ public:
uint64_t end_x;
uint64_t end_y;
// TODO: more options for svg-line
~SvgLine() override = default;
std::string dump() const override;
// TODO: SvgLine(...)
};
class SvgRect : public SvgObject {
@ -55,4 +58,5 @@ public:
~SvgRect() override = default;
std::string dump() const override;
SvgRect(uint64_t t, uint64_t l, uint64_t w, uint64_t h) : top(t), left(l), width(w), height(h) {}
};

Loading…
Cancel
Save