merge
commit
e8ba774370
|
@ -110,6 +110,7 @@
|
||||||
<ClCompile Include="src\Editor\RightBar\LayerTreeWidget.cpp" />
|
<ClCompile Include="src\Editor\RightBar\LayerTreeWidget.cpp" />
|
||||||
<ClCompile Include="src\Editor\ThirdPartyLib\qquick\qquicksvgparser.cpp" />
|
<ClCompile Include="src\Editor\ThirdPartyLib\qquick\qquicksvgparser.cpp" />
|
||||||
<ClCompile Include="src\Editor\ThirdPartyLib\SvgHelper.cpp" />
|
<ClCompile Include="src\Editor\ThirdPartyLib\SvgHelper.cpp" />
|
||||||
|
<ClCompile Include="src\Editor\util\PainterPathUtil.cpp" />
|
||||||
<ClCompile Include="src\Editor\util\SvgFileLoader.cpp" />
|
<ClCompile Include="src\Editor\util\SvgFileLoader.cpp" />
|
||||||
<ClCompile Include="src\IconWidget.cpp" />
|
<ClCompile Include="src\IconWidget.cpp" />
|
||||||
<ClCompile Include="src\main.cpp" />
|
<ClCompile Include="src\main.cpp" />
|
||||||
|
@ -184,6 +185,7 @@
|
||||||
<ClInclude Include="src\Editor\ThirdPartyLib\qquick\qtquickglobal.h" />
|
<ClInclude Include="src\Editor\ThirdPartyLib\qquick\qtquickglobal.h" />
|
||||||
<ClInclude Include="src\Editor\ThirdPartyLib\qquick\qtquickglobal_p.h" />
|
<ClInclude Include="src\Editor\ThirdPartyLib\qquick\qtquickglobal_p.h" />
|
||||||
<ClInclude Include="src\Editor\ThirdPartyLib\SvgHelper.h" />
|
<ClInclude Include="src\Editor\ThirdPartyLib\SvgHelper.h" />
|
||||||
|
<ClInclude Include="src\Editor\util\PainterPathUtil.h" />
|
||||||
<ClInclude Include="src\Editor\util\SvgFileLoader.h" />
|
<ClInclude Include="src\Editor\util\SvgFileLoader.h" />
|
||||||
<ClInclude Include="src\Renderer\Painting\CubicBezierSignedDistance.h" />
|
<ClInclude Include="src\Renderer\Painting\CubicBezierSignedDistance.h" />
|
||||||
<ClInclude Include="src\Renderer\Painting\Element.h" />
|
<ClInclude Include="src\Renderer\Painting\Element.h" />
|
||||||
|
|
|
@ -198,6 +198,9 @@
|
||||||
<ClCompile Include="src\Editor\util\SvgFileLoader.cpp">
|
<ClCompile Include="src\Editor\util\SvgFileLoader.cpp">
|
||||||
<Filter>Source Files\Editor\util</Filter>
|
<Filter>Source Files\Editor\util</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="src\Editor\util\PainterPathUtil.cpp">
|
||||||
|
<Filter>Source Files\Editor\util</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="src\Renderer\Preview\ElementRenderer.cpp">
|
<ClCompile Include="src\Renderer\Preview\ElementRenderer.cpp">
|
||||||
<Filter>Source Files\Renderer\Preview</Filter>
|
<Filter>Source Files\Renderer\Preview</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -399,6 +402,11 @@
|
||||||
<ClInclude Include="src\Renderer\Painting\MaterialStyleStroke.h">
|
<ClInclude Include="src\Renderer\Painting\MaterialStyleStroke.h">
|
||||||
<Filter>Header Files\Renderer\Painting</Filter>
|
<Filter>Header Files\Renderer\Painting</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="src\Editor\util\PainterPathUtil.h">
|
||||||
|
<Filter>Header Files\Editor\util</Filter>
|
||||||
|
<ClInclude Include="src\Renderer\Painting\MaterialStyleStroke.h">
|
||||||
|
<Filter>Header Files\Renderer\Painting</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="src\Renderer\Preview\ElementRenderer.h">
|
<ClInclude Include="src\Renderer\Preview\ElementRenderer.h">
|
||||||
<Filter>Header Files\Renderer\Preview</Filter>
|
<Filter>Header Files\Renderer\Preview</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
#include "PainterPathUtil.h"
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
using Renderer::Point;
|
||||||
|
using std::vector;
|
||||||
|
|
||||||
|
vector<vector<Point> > PainterPathUtil::transformToLines(QPainterPath& painterPath) {
|
||||||
|
vector<Point> line; line.clear();
|
||||||
|
vector<vector<Point> > 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;
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
#pragma once
|
||||||
|
#include <vector>
|
||||||
|
#include <QPainterPath>
|
||||||
|
#include "../Renderer/Painting/Line.h"
|
||||||
|
|
||||||
|
using Renderer::Point;
|
||||||
|
|
||||||
|
class PainterPathUtil
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static std::vector<std::vector<Point> > transformToLines(QPainterPath& painterPath);
|
||||||
|
};
|
||||||
|
|
|
@ -151,7 +151,8 @@ void SvgFileLoader::handleLabelCircle(QPainterPath& painterPath) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
qDebug() << labelStyle;
|
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) {
|
void SvgFileLoader::handleLabelEllipse(QPainterPath& painterPath) {
|
||||||
|
@ -174,7 +175,8 @@ void SvgFileLoader::handleLabelEllipse(QPainterPath& painterPath) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
qDebug() << labelStyle;
|
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) {
|
void SvgFileLoader::handleLabelPolyline(QPainterPath& painterPath) {
|
||||||
|
|
|
@ -23,4 +23,5 @@ private:
|
||||||
void handleLabelEllipse(QPainterPath& painterPath);
|
void handleLabelEllipse(QPainterPath& painterPath);
|
||||||
void handleLabelPolyline(QPainterPath& painterPath);
|
void handleLabelPolyline(QPainterPath& painterPath);
|
||||||
void handleLabelPolygon(QPainterPath& painterPath);
|
void handleLabelPolygon(QPainterPath& painterPath);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -25,6 +25,11 @@ namespace Renderer
|
||||||
bool operator< (const Point& a) const {
|
bool operator< (const Point& a) const {
|
||||||
return fabs(x - a.x) <= eps ? y < a.y : x < a.x;
|
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() {
|
operator glm::dvec2() {
|
||||||
return glm::dvec2(x, y);
|
return glm::dvec2(x, y);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue