Compare commits

...

2 Commits

Author SHA1 Message Date
yang.yongquan 9e1ec3f848 merge 2023-02-02 17:06:32 +08:00
yang.yongquan e6ff316d0e 修改了项目结构 2023-02-02 17:04:34 +08:00
10 changed files with 57 additions and 51 deletions

View File

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

View File

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

View File

@ -1,6 +1,6 @@
#include "SvgFileLoader.h"
#include <QFile>
#include "../qquick/qquicksvgparser_p.h"
#include "../ThirdPartyLib/qquick/qquicksvgparser_p.h"
#include <QPolygonF>
@ -151,7 +151,7 @@ void SvgFileLoader::handleLabelCircle(QPainterPath& painterPath) {
}
}
qDebug() << labelStyle;
painterPath.addEllipse(cx, cy, r, r);
addEllipse(cx, cy, r, r, painterPath);
}
void SvgFileLoader::handleLabelEllipse(QPainterPath& painterPath) {
@ -174,7 +174,7 @@ void SvgFileLoader::handleLabelEllipse(QPainterPath& painterPath) {
}
}
qDebug() << labelStyle;
painterPath.addEllipse(cx, cy, rx, ry);
addEllipse(cx, cy, rx, ry, painterPath);
}
void SvgFileLoader::handleLabelPolyline(QPainterPath& painterPath) {
@ -199,8 +199,9 @@ void SvgFileLoader::handleLabelPolygon(QPainterPath & painterPath) {
for (auto& attr : xmlReader->attributes()) {
if (attr.name().toString() == QLatin1String("points")) {
QPolygonF points = transformPoints(attr.value().toLatin1());
points.push_back(*points.begin());
//points.push_back(*points.begin());
painterPath.addPolygon(points);
painterPath.closeSubpath();
}
else if (attr.name().toString() == QLatin1String("style")) {
labelStyle = transformStyle(attr.value().toLatin1());
@ -210,4 +211,12 @@ void SvgFileLoader::handleLabelPolygon(QPainterPath & painterPath) {
}
}
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,6 +15,7 @@ private:
std::shared_ptr<QXmlStreamReader> xmlReader;
QPolygonF transformPoints(QString points);
QMap<QString, QString> transformStyle(QString style);
void addEllipse(double cx, double cy, double h, double w, QPainterPath& painterPath);
void handleLabelG(QPainterPath& painterPath);
void handleLabelPath(QPainterPath& painterPath);
void handleLabelRect(QPainterPath& painterPath);