Compare commits

..

No commits in common. "9e1ec3f84825d2e502319b044628f4c70eafc617" and "e5a22bd02afe3c41fe32813ffb5795aefab452f5" have entirely different histories.

10 changed files with 51 additions and 57 deletions

View File

@ -108,9 +108,8 @@
<ClCompile Include="src\Editor\PreviewWindow.cpp" /> <ClCompile Include="src\Editor\PreviewWindow.cpp" />
<ClCompile Include="src\Editor\RightBar\InfoDisplayWidget.cpp" /> <ClCompile Include="src\Editor\RightBar\InfoDisplayWidget.cpp" />
<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\third-party modules\qquick\qquicksvgparser.cpp" />
<ClCompile Include="src\Editor\ThirdPartyLib\SvgHelper.cpp" /> <ClCompile Include="src\Editor\third-party modules\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" />
<ClCompile Include="src\MainWindow.cpp" /> <ClCompile Include="src\MainWindow.cpp" />
@ -139,6 +138,7 @@
<ClCompile Include="src\Renderer\Painting\StraightLine.cpp" /> <ClCompile Include="src\Renderer\Painting\StraightLine.cpp" />
<ClCompile Include="src\SvgParser.cpp" /> <ClCompile Include="src\SvgParser.cpp" />
<ClCompile Include="src\TitleWidget.cpp" /> <ClCompile Include="src\TitleWidget.cpp" />
<ClCompile Include="src\Editor\third-party modules\SvgHelper.cpp" />
<QtRcc Include="MainWindow.qrc" /> <QtRcc Include="MainWindow.qrc" />
<QtUic Include="EditorWidget.ui" /> <QtUic Include="EditorWidget.ui" />
<QtUic Include="FramelessWindow.ui" /> <QtUic Include="FramelessWindow.ui" />
@ -170,17 +170,19 @@
<ItemGroup> <ItemGroup>
<QtMoc Include="src\Editor\RightBar\LayerTreeWidget.h" /> <QtMoc Include="src\Editor\RightBar\LayerTreeWidget.h" />
<QtMoc Include="src\Editor\RightBar\InfoDisplayWidget.h" /> <QtMoc Include="src\Editor\RightBar\InfoDisplayWidget.h" />
<ClInclude Include="src\Editor\third-party modules\qquick\qtquickglobal.h" />
<ClInclude Include="src\Editor\third-party modules\qquick\qtquickglobal_p.h" />
<ClInclude Include="src\Editor\third-party modules\qquick\qquicksvgparser_p.h" />
<ClInclude Include="src\Editor\third-party modules\SvgHelper.h" />
<QtMoc Include="src\MainWindow.h" /> <QtMoc Include="src\MainWindow.h" />
<ClInclude Include="src\Editor\ElementManager.h" /> <ClInclude Include="src\Editor\ElementManager.h" />
<ClInclude Include="src\Editor\GraphicElement.h" /> <ClInclude Include="src\Editor\GraphicElement.h" />
<ClInclude Include="src\Editor\LayerManager.h" /> <ClInclude Include="src\Editor\LayerManager.h" />
<ClInclude Include="src\Editor\LayerStyle.h" /> <ClInclude Include="src\Editor\LayerStyle.h" />
<ClInclude Include="src\Editor\LayerWrapper.h" />
<QtMoc Include="src\Editor\PreviewWindow.h" /> <QtMoc Include="src\Editor\PreviewWindow.h" />
<ClInclude Include="src\Editor\ThirdPartyLib\qquick\qquicksvgparser_p.h" /> <ClInclude Include="src\Editor\third-party modules\util\SvgFileLoader.h" />
<ClInclude Include="src\Editor\ThirdPartyLib\qquick\qtquickglobal.h" /> <ClInclude Include="src\Renderer\Painting\BaseStyle.h" />
<ClInclude Include="src\Editor\ThirdPartyLib\qquick\qtquickglobal_p.h" />
<ClInclude Include="src\Editor\ThirdPartyLib\SvgHelper.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" />
<ClInclude Include="src\Renderer\Painting\ElementStyle.h" /> <ClInclude Include="src\Renderer\Painting\ElementStyle.h" />

View File

@ -41,23 +41,23 @@
<Filter Include="Header Files\Renderer\Painting"> <Filter Include="Header Files\Renderer\Painting">
<UniqueIdentifier>{22909273-2b23-49fa-84ab-444cefb09656}</UniqueIdentifier> <UniqueIdentifier>{22909273-2b23-49fa-84ab-444cefb09656}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Header Files\Editor\ThirdPartyLib">
<UniqueIdentifier>{11f273e9-b41f-4982-b4ca-12851a03aaae}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\Editor\util"> <Filter Include="Header Files\Editor\util">
<UniqueIdentifier>{727fd876-d2b0-4928-80a7-2da7cafe1519}</UniqueIdentifier> <UniqueIdentifier>{e3c323ec-d150-4876-8618-5800c87a4941}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Header Files\Editor\ThirdPartyLib\qquick"> <Filter Include="Header Files\Editor\third-party modules">
<UniqueIdentifier>{169687a8-6807-4571-802c-c4a95858db3a}</UniqueIdentifier> <UniqueIdentifier>{30b46cf2-d980-47be-94c4-d2ec1dcc54ed}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Source Files\Editor\ThirdPartyLib"> <Filter Include="Header Files\Editor\third-party modules\qquick">
<UniqueIdentifier>{0567e730-5508-4380-8304-86ded8ea3b2f}</UniqueIdentifier> <UniqueIdentifier>{5028c879-8b07-4033-81ac-e538a873a837}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Source Files\Editor\ThirdPartyLib\qquick"> <Filter Include="Source Files\Editor\third-party modules">
<UniqueIdentifier>{cfa316d0-97e0-49b0-9911-baebfea49236}</UniqueIdentifier> <UniqueIdentifier>{555d169f-4fa2-4501-b67c-695197b9e6ae}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Editor\third-party modules\qquick">
<UniqueIdentifier>{0b29331b-03b9-44fe-916f-28f5061b4147}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Source Files\Editor\util"> <Filter Include="Source Files\Editor\util">
<UniqueIdentifier>{96f98afe-4250-44cb-a505-682a1d5932c3}</UniqueIdentifier> <UniqueIdentifier>{d7c7ab61-0d05-4e67-9e89-852f3e56fa2f}</UniqueIdentifier>
</Filter> </Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -165,6 +165,16 @@
<ClCompile Include="src\Renderer\Painting\CubicBezierSignedDistance.cpp"> <ClCompile Include="src\Renderer\Painting\CubicBezierSignedDistance.cpp">
<Filter>Source Files\Renderer\Painting</Filter> <Filter>Source Files\Renderer\Painting</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\Editor\third-party modules\qquick\qquicksvgparser.cpp">
<Filter>Source Files\Editor\third-party modules\qquick</Filter>
</ClCompile>
<ClCompile Include="src\Editor\third-party modules\util\SvgFileLoader.cpp">
<Filter>Source Files\Editor\util</Filter>
</ClCompile>
<ClCompile Include="src\Editor\third-party modules\SvgHelper.cpp">
<Filter>Source Files\Editor\third-party modules</Filter>
<Filter>Source Files\Editor\third-party modules</Filter>
</ClCompile>
<ClCompile Include="src\Editor\RightBar\LayerTreeWidget.cpp"> <ClCompile Include="src\Editor\RightBar\LayerTreeWidget.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
@ -183,15 +193,6 @@
<ClCompile Include="src\Renderer\Painting\MaterialStyleStroke.cpp"> <ClCompile Include="src\Renderer\Painting\MaterialStyleStroke.cpp">
<Filter>Source Files\Renderer\Painting</Filter> <Filter>Source Files\Renderer\Painting</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\Editor\ThirdPartyLib\qquick\qquicksvgparser.cpp">
<Filter>Source Files\Editor\ThirdPartyLib\qquick</Filter>
</ClCompile>
<ClCompile Include="src\Editor\ThirdPartyLib\SvgHelper.cpp">
<Filter>Source Files\Editor\ThirdPartyLib</Filter>
</ClCompile>
<ClCompile Include="src\Editor\util\SvgFileLoader.cpp">
<Filter>Source Files\Editor\util</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<QtMoc Include="src\Renderer\RendererGLWidget.h"> <QtMoc Include="src\Renderer\RendererGLWidget.h">
@ -360,25 +361,26 @@
<ClInclude Include="src\Renderer\Painting\CubicBezierSignedDistance.h"> <ClInclude Include="src\Renderer\Painting\CubicBezierSignedDistance.h">
<Filter>Header Files\Renderer\Painting</Filter> <Filter>Header Files\Renderer\Painting</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\Editor\third-party modules\SvgHelper.h">
<Filter>Header Files\Editor\third-party modules</Filter>
</ClInclude>
<ClInclude Include="src\Editor\third-party modules\qquick\qquicksvgparser_p.h">
<Filter>Header Files\Editor\third-party modules\qquick</Filter>
</ClInclude>
<ClInclude Include="src\Editor\third-party modules\qquick\qtquickglobal.h">
<Filter>Header Files\Editor\third-party modules\qquick</Filter>
</ClInclude>
<ClInclude Include="src\Editor\third-party modules\qquick\qtquickglobal_p.h">
<Filter>Header Files\Editor\third-party modules\qquick</Filter>
</ClInclude>
<ClInclude Include="src\Editor\third-party modules\util\SvgFileLoader.h"> <ClInclude Include="src\Editor\third-party modules\util\SvgFileLoader.h">
<Filter>Header Files\Editor\util</Filter> <Filter>Header Files\Editor\util</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\Renderer\Painting\ElementStyle.h"> <ClInclude Include="src\Editor\LayerWrapper.h">
<Filter>Header Files\Renderer\Painting</Filter> <Filter>Header Files\Editor</Filter>
<Filter>Header Files\Editor\third-party modules\qquick</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\Editor\ThirdPartyLib\qquick\qquicksvgparser_p.h"> <ClInclude Include="src\Editor\third-party modules\util\SvgFileLoader.h">
<Filter>Header Files\Editor\ThirdPartyLib\qquick</Filter>
</ClInclude>
<ClInclude Include="src\Editor\ThirdPartyLib\qquick\qtquickglobal.h">
<Filter>Header Files\Editor\ThirdPartyLib\qquick</Filter>
</ClInclude>
<ClInclude Include="src\Editor\ThirdPartyLib\qquick\qtquickglobal_p.h">
<Filter>Header Files\Editor\ThirdPartyLib\qquick</Filter>
</ClInclude>
<ClInclude Include="src\Editor\ThirdPartyLib\SvgHelper.h">
<Filter>Header Files\Editor\ThirdPartyLib</Filter>
</ClInclude>
<ClInclude Include="src\Editor\util\SvgFileLoader.h">
<Filter>Header Files\Editor\util</Filter> <Filter>Header Files\Editor\util</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\Renderer\Painting\ElementStyle.h"> <ClInclude Include="src\Renderer\Painting\ElementStyle.h">

View File

@ -1,6 +1,6 @@
#include "SvgFileLoader.h" #include "SvgFileLoader.h"
#include <QFile> #include <QFile>
#include "../ThirdPartyLib/qquick/qquicksvgparser_p.h" #include "../qquick/qquicksvgparser_p.h"
#include <QPolygonF> #include <QPolygonF>
@ -151,7 +151,7 @@ void SvgFileLoader::handleLabelCircle(QPainterPath& painterPath) {
} }
} }
qDebug() << labelStyle; qDebug() << labelStyle;
addEllipse(cx, cy, r, r, painterPath); painterPath.addEllipse(cx, cy, r, r);
} }
void SvgFileLoader::handleLabelEllipse(QPainterPath& painterPath) { void SvgFileLoader::handleLabelEllipse(QPainterPath& painterPath) {
@ -174,7 +174,7 @@ void SvgFileLoader::handleLabelEllipse(QPainterPath& painterPath) {
} }
} }
qDebug() << labelStyle; qDebug() << labelStyle;
addEllipse(cx, cy, rx, ry, painterPath); painterPath.addEllipse(cx, cy, rx, ry);
} }
void SvgFileLoader::handleLabelPolyline(QPainterPath& painterPath) { void SvgFileLoader::handleLabelPolyline(QPainterPath& painterPath) {
@ -199,9 +199,8 @@ void SvgFileLoader::handleLabelPolygon(QPainterPath & painterPath) {
for (auto& attr : xmlReader->attributes()) { for (auto& attr : xmlReader->attributes()) {
if (attr.name().toString() == QLatin1String("points")) { if (attr.name().toString() == QLatin1String("points")) {
QPolygonF points = transformPoints(attr.value().toLatin1()); QPolygonF points = transformPoints(attr.value().toLatin1());
//points.push_back(*points.begin()); points.push_back(*points.begin());
painterPath.addPolygon(points); painterPath.addPolygon(points);
painterPath.closeSubpath();
} }
else if (attr.name().toString() == QLatin1String("style")) { else if (attr.name().toString() == QLatin1String("style")) {
labelStyle = transformStyle(attr.value().toLatin1()); labelStyle = transformStyle(attr.value().toLatin1());
@ -212,11 +211,3 @@ void SvgFileLoader::handleLabelPolygon(QPainterPath & painterPath) {
} }
qDebug() << labelStyle; qDebug() << labelStyle;
} }
void SvgFileLoader::addEllipse(double x, double y, double w, double h, QPainterPath& painterPath) {
double k = w / 0.75;
painterPath.moveTo(x, y - h);
painterPath.cubicTo(QPointF(x + k, y - h), QPointF(x + k, y + h), QPointF(x, y + h));
painterPath.cubicTo(QPointF(x - k, y + h), QPointF(x - k, y - h), QPointF(x, y - h));
painterPath.closeSubpath();
}

View File

@ -15,7 +15,6 @@ private:
std::shared_ptr<QXmlStreamReader> xmlReader; std::shared_ptr<QXmlStreamReader> xmlReader;
QPolygonF transformPoints(QString points); QPolygonF transformPoints(QString points);
QMap<QString, QString> transformStyle(QString style); QMap<QString, QString> transformStyle(QString style);
void addEllipse(double cx, double cy, double h, double w, QPainterPath& painterPath);
void handleLabelG(QPainterPath& painterPath); void handleLabelG(QPainterPath& painterPath);
void handleLabelPath(QPainterPath& painterPath); void handleLabelPath(QPainterPath& painterPath);
void handleLabelRect(QPainterPath& painterPath); void handleLabelRect(QPainterPath& painterPath);