diff --git a/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj b/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj
index b85acdd..e6bb481 100644
--- a/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj
+++ b/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj
@@ -110,6 +110,7 @@
+
@@ -184,6 +185,7 @@
+
diff --git a/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj.filters b/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj.filters
index 68a6fe6..2bc7372 100644
--- a/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj.filters
+++ b/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj.filters
@@ -198,6 +198,9 @@
Source Files\Editor\util
+
+ Source Files\Editor\util
+
Source Files\Renderer\Preview
@@ -399,6 +402,11 @@
Header Files\Renderer\Painting
+
+ Header Files\Editor\util
+
+ Header Files\Renderer\Painting
+
Header Files\Renderer\Preview
diff --git a/ArchitectureColoredPainting/src/Editor/util/PainterPathUtil.cpp b/ArchitectureColoredPainting/src/Editor/util/PainterPathUtil.cpp
new file mode 100644
index 0000000..148906e
--- /dev/null
+++ b/ArchitectureColoredPainting/src/Editor/util/PainterPathUtil.cpp
@@ -0,0 +1,41 @@
+#include "PainterPathUtil.h"
+#include
+
+using Renderer::Point;
+using std::vector;
+
+vector > PainterPathUtil::transformToLines(QPainterPath& painterPath) {
+ vector line; line.clear();
+ vector > lines; lines.clear();
+ QPointF startPoint(0, 0);
+ Point point(0, 0);
+ for (int elementIndex = 0; elementIndex < painterPath.elementCount(); elementIndex++) {
+ auto element = painterPath.elementAt(elementIndex);
+ point = element;
+ qDebug() << element;
+ if (element.isMoveTo()) {
+ if (line.size() >= 2) {
+ lines.push_back(line);
+ }
+ line.clear();
+ line.push_back(point);
+ }
+ else {
+ line.push_back(point);
+ if (element.isLineTo()) {
+ lines.push_back(line);
+ }
+ if (element.isCurveTo()) {
+ point = painterPath.elementAt(++elementIndex);
+ line.push_back(point);
+ point = painterPath.elementAt(++elementIndex);
+ line.push_back(point);
+ lines.push_back(line);
+ }
+ line.clear();
+ line.push_back(point);
+ }
+ }
+ line.clear();
+ return lines;
+}
diff --git a/ArchitectureColoredPainting/src/Editor/util/PainterPathUtil.h b/ArchitectureColoredPainting/src/Editor/util/PainterPathUtil.h
new file mode 100644
index 0000000..3e1fd13
--- /dev/null
+++ b/ArchitectureColoredPainting/src/Editor/util/PainterPathUtil.h
@@ -0,0 +1,13 @@
+#pragma once
+#include
+#include
+#include "../Renderer/Painting/Line.h"
+
+using Renderer::Point;
+
+class PainterPathUtil
+{
+public:
+ static std::vector > transformToLines(QPainterPath& painterPath);
+};
+
diff --git a/ArchitectureColoredPainting/src/Editor/util/SvgFileLoader.cpp b/ArchitectureColoredPainting/src/Editor/util/SvgFileLoader.cpp
index da7dbe4..30f0ae6 100644
--- a/ArchitectureColoredPainting/src/Editor/util/SvgFileLoader.cpp
+++ b/ArchitectureColoredPainting/src/Editor/util/SvgFileLoader.cpp
@@ -151,7 +151,8 @@ void SvgFileLoader::handleLabelCircle(QPainterPath& painterPath) {
}
}
qDebug() << labelStyle;
- addEllipse(cx, cy, r, r, painterPath);
+ //addEllipse(cx, cy, r, r, painterPath);
+ painterPath.addEllipse(cx, cy, r, r);
}
void SvgFileLoader::handleLabelEllipse(QPainterPath& painterPath) {
@@ -174,7 +175,8 @@ void SvgFileLoader::handleLabelEllipse(QPainterPath& painterPath) {
}
}
qDebug() << labelStyle;
- addEllipse(cx, cy, rx, ry, painterPath);
+ //addEllipse(cx, cy, rx, ry, painterPath);
+ painterPath.addEllipse(cx, cy, rx, ry);
}
void SvgFileLoader::handleLabelPolyline(QPainterPath& painterPath) {
diff --git a/ArchitectureColoredPainting/src/Editor/util/SvgFileLoader.h b/ArchitectureColoredPainting/src/Editor/util/SvgFileLoader.h
index 93c2751..352b9b0 100644
--- a/ArchitectureColoredPainting/src/Editor/util/SvgFileLoader.h
+++ b/ArchitectureColoredPainting/src/Editor/util/SvgFileLoader.h
@@ -23,4 +23,5 @@ private:
void handleLabelEllipse(QPainterPath& painterPath);
void handleLabelPolyline(QPainterPath& painterPath);
void handleLabelPolygon(QPainterPath& painterPath);
+
};
diff --git a/ArchitectureColoredPainting/src/Renderer/Painting/Line.h b/ArchitectureColoredPainting/src/Renderer/Painting/Line.h
index 7730fa6..b1caf2b 100644
--- a/ArchitectureColoredPainting/src/Renderer/Painting/Line.h
+++ b/ArchitectureColoredPainting/src/Renderer/Painting/Line.h
@@ -25,6 +25,11 @@ namespace Renderer
bool operator< (const Point& a) const {
return fabs(x - a.x) <= eps ? y < a.y : x < a.x;
}
+ Point& operator= (const QPointF p){
+ x = p.x();
+ y = p.y();
+ return *this;
+ }
operator glm::dvec2() {
return glm::dvec2(x, y);
}