diff --git a/src/graph/graph.cc b/src/graph/graph.cc
index c02a572..afdcb9c 100644
--- a/src/graph/graph.cc
+++ b/src/graph/graph.cc
@@ -25,12 +25,28 @@ void Graph::svg_demo(Analyse::track_data_t track_data) {
s.color = "blue";
s.line_color = "green";
- printf(R"(\n");
+ l.end_x = 300;
+ l.end_y = 400;
+
+ auto sg = SvgGraph();
+// sg.insert(&s);
+// sg.insert(&l);
+
+ sg.insert(std::move(s));
+ sg.insert(std::move(l));
+
+ sg.dump();
return;
diff --git a/src/graph/svg/svg.cc b/src/graph/svg/svg.cc
index e7d6c7b..098fc8b 100644
--- a/src/graph/svg/svg.cc
+++ b/src/graph/svg/svg.cc
@@ -26,3 +26,45 @@ std::string SvgRect::dump() const {
}
return xml + "style=\"" + style + "\" />";
}
+
+
+SvgGraph::~SvgGraph() {
+ for (auto &object : objects) {
+ delete object;
+ }
+}
+
+//void SvgGraph::insert(SvgObject *obj) {
+// objects.emplace_back(obj);
+//}
+
+#include
+
+std::string SvgGraph::dump() const {
+
+ for (auto o : objects) {
+ std::cout << o->dump() << std::endl;
+ }
+
+ return "svg result";
+}
+
+void SvgGraph::insert(const SvgRect &rect) {
+//void SvgGraph::insert(SvgRect rect) {
+
+ auto s = new SvgRect(rect);
+ objects.emplace_back(s);
+}
+
+void SvgGraph::insert(const SvgLine &line) {
+
+ auto l = new SvgLine(line);
+ objects.emplace_back(l);
+
+}
+
+std::string SvgLine::dump() const {
+
+ return "";
+
+}
diff --git a/src/graph/svg/svg.h b/src/graph/svg/svg.h
index 6e75f39..be2651c 100644
--- a/src/graph/svg/svg.h
+++ b/src/graph/svg/svg.h
@@ -2,8 +2,28 @@
#include
#include
+#include
-class SvgRect {
+class SvgObject {
+public:
+ virtual ~SvgObject() = default;
+ virtual std::string dump() const = 0;
+};
+
+class SvgLine : public SvgObject {
+public:
+ uint64_t start_x;
+ uint64_t start_y;
+
+ uint64_t end_x;
+ uint64_t end_y;
+
+ ~SvgLine() override = default;
+ std::string dump() const override;
+
+};
+
+class SvgRect : public SvgObject {
public:
uint64_t top;
uint64_t left;
@@ -19,5 +39,26 @@ public:
float opacity = 0;
float line_opacity = 0;
+ ~SvgRect() override = default;
+ std::string dump() const override;
+};
+
+class SvgGraph {
+public:
+
+ std::vector objects;
+
+// void insert(SvgObject *obj);
+
+ void insert(const SvgRect &rect);
+ void insert(const SvgLine &line);
+
+// void insert(SvgRect rect);
+// void insert(SvgLine line);
+
+
std::string dump() const;
+
+ ~SvgGraph();
+
};