diff --git a/src/graph/graph.cc b/src/graph/graph.cc
index afdcb9c..64e2ae5 100644
--- a/src/graph/graph.cc
+++ b/src/graph/graph.cc
@@ -9,21 +9,21 @@
void Graph::svg_demo(Analyse::track_data_t track_data) {
- auto s = SvgRect();
+ auto s = new SvgRect();
- s.left = 50;
- s.top = 80;
+ s->left = 50;
+ s->top = 80;
- s.width = 100;
- s.height = 200;
+ s->width = 100;
+ s->height = 200;
- s.radius = 20;
+ s->radius = 20;
- s.opacity = 0.8;
- s.line_opacity = 0.5;
+ s->opacity = 0.8;
+ s->line_opacity = 0.5;
- s.color = "blue";
- s.line_color = "green";
+ s->color = "blue";
+ s->line_color = "green";
// printf(R"(\n");
- auto l = SvgLine();
- l.start_x = 100;
- l.start_y = 200;
+ auto l = new SvgLine();
+ l->start_x = 100;
+ l->start_y = 200;
- l.end_x = 300;
- l.end_y = 400;
+ l->end_x = 300;
+ l->end_y = 400;
- auto sg = SvgGraph();
+ auto sg = SvgGraph(1000, 2000);
// sg.insert(&s);
// sg.insert(&l);
- sg.insert(std::move(s));
- sg.insert(std::move(l));
+ sg.insert(s);
+ sg.insert(l);
- sg.dump();
+ std::cout << sg.dump() << std::endl;
return;
diff --git a/src/graph/svg/svg.cc b/src/graph/svg/svg.cc
index 098fc8b..90acabb 100644
--- a/src/graph/svg/svg.cc
+++ b/src/graph/svg/svg.cc
@@ -1,7 +1,27 @@
#include "svg.h"
+#include
+
+
+SvgGraph::~SvgGraph() {
+ for (auto *object : objects) {
+ delete object;
+ }
+}
+
+void SvgGraph::insert(SvgObject *obj) {
+ objects.emplace_back(obj);
+}
+
+std::string SvgLine::dump() const {
+ /// basic attributes of svg-line
+
+ return "";
+
+}
+
std::string SvgRect::dump() const {
- /// basic attribute of svg-rect
+ /// basic attributes of svg-rect
std::string xml = "";
}
-
-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;
+ std::string xml = R"(\n";
}
diff --git a/src/graph/svg/svg.h b/src/graph/svg/svg.h
index be2651c..7808a29 100644
--- a/src/graph/svg/svg.h
+++ b/src/graph/svg/svg.h
@@ -10,6 +10,20 @@ public:
virtual std::string dump() const = 0;
};
+class SvgGraph {
+public:
+ uint64_t width;
+ uint64_t height;
+
+ ~SvgGraph();
+ std::string dump() const;
+ void insert(SvgObject *obj);
+ SvgGraph(uint64_t w, uint64_t h) : width(w), height(h) {}
+
+private:
+ std::vector objects;
+};
+
class SvgLine : public SvgObject {
public:
uint64_t start_x;
@@ -42,23 +56,3 @@ public:
~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();
-
-};