From e6ff316d0e26e094fa22d94908ec2cf2a708e772 Mon Sep 17 00:00:00 2001 From: "yang.yongquan" <3395816735@qq.com> Date: Thu, 2 Feb 2023 17:04:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ArchitectureColoredPainting.vcxproj | 17 ++--- ...rchitectureColoredPainting.vcxproj.filters | 75 +++++++++---------- .../SvgHelper.cpp | 0 .../SvgHelper.h | 0 .../qquick/qquicksvgparser.cpp | 0 .../qquick/qquicksvgparser_p.h | 0 .../qquick/qtquickglobal.h | 0 .../qquick/qtquickglobal_p.h | 0 .../util/SvgFileLoader.cpp | 17 ++++- .../util/SvgFileLoader.h | 1 + 10 files changed, 57 insertions(+), 53 deletions(-) rename ArchitectureColoredPainting/src/Editor/{third-party modules => ThirdPartyLib}/SvgHelper.cpp (100%) rename ArchitectureColoredPainting/src/Editor/{third-party modules => ThirdPartyLib}/SvgHelper.h (100%) rename ArchitectureColoredPainting/src/Editor/{third-party modules => ThirdPartyLib}/qquick/qquicksvgparser.cpp (100%) rename ArchitectureColoredPainting/src/Editor/{third-party modules => ThirdPartyLib}/qquick/qquicksvgparser_p.h (100%) rename ArchitectureColoredPainting/src/Editor/{third-party modules => ThirdPartyLib}/qquick/qtquickglobal.h (100%) rename ArchitectureColoredPainting/src/Editor/{third-party modules => ThirdPartyLib}/qquick/qtquickglobal_p.h (100%) rename ArchitectureColoredPainting/src/Editor/{third-party modules => }/util/SvgFileLoader.cpp (92%) rename ArchitectureColoredPainting/src/Editor/{third-party modules => }/util/SvgFileLoader.h (90%) diff --git a/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj b/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj index 79ab108..12bf848 100644 --- a/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj +++ b/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj @@ -108,8 +108,9 @@ - - + + + @@ -135,7 +136,6 @@ - @@ -167,18 +167,17 @@ - - - - - - + + + + + diff --git a/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj.filters b/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj.filters index 70e0c28..7c086ef 100644 --- a/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj.filters +++ b/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj.filters @@ -41,23 +41,23 @@ {22909273-2b23-49fa-84ab-444cefb09656} + + {11f273e9-b41f-4982-b4ca-12851a03aaae} + - {e3c323ec-d150-4876-8618-5800c87a4941} + {727fd876-d2b0-4928-80a7-2da7cafe1519} - - {30b46cf2-d980-47be-94c4-d2ec1dcc54ed} + + {169687a8-6807-4571-802c-c4a95858db3a} - - {5028c879-8b07-4033-81ac-e538a873a837} + + {0567e730-5508-4380-8304-86ded8ea3b2f} - - {555d169f-4fa2-4501-b67c-695197b9e6ae} - - - {0b29331b-03b9-44fe-916f-28f5061b4147} + + {cfa316d0-97e0-49b0-9911-baebfea49236} - {d7c7ab61-0d05-4e67-9e89-852f3e56fa2f} + {96f98afe-4250-44cb-a505-682a1d5932c3} @@ -165,16 +165,6 @@ Source Files\Renderer\Painting - - Source Files\Editor\third-party modules\qquick - - - Source Files\Editor\util - - - Source Files\Editor\third-party modules - Source Files\Editor\third-party modules - Source Files @@ -184,6 +174,15 @@ Source Files\Renderer\Painting + + Source Files\Editor\ThirdPartyLib\qquick + + + Source Files\Editor\ThirdPartyLib + + + Source Files\Editor\util + @@ -352,31 +351,27 @@ Header Files\Renderer\Painting - - Header Files\Editor\third-party modules - - - Header Files\Editor\third-party modules\qquick - - - Header Files\Editor\third-party modules\qquick - - - Header Files\Editor\third-party modules\qquick - - - Header Files\Editor\util - - - Header Files\Editor - Header Files\Editor\third-party modules\qquick - Header Files\Editor\util Header Files\Renderer\Painting + + Header Files\Editor\ThirdPartyLib\qquick + + + Header Files\Editor\ThirdPartyLib\qquick + + + Header Files\Editor\ThirdPartyLib\qquick + + + Header Files\Editor\ThirdPartyLib + + + Header Files\Editor\util + diff --git a/ArchitectureColoredPainting/src/Editor/third-party modules/SvgHelper.cpp b/ArchitectureColoredPainting/src/Editor/ThirdPartyLib/SvgHelper.cpp similarity index 100% rename from ArchitectureColoredPainting/src/Editor/third-party modules/SvgHelper.cpp rename to ArchitectureColoredPainting/src/Editor/ThirdPartyLib/SvgHelper.cpp diff --git a/ArchitectureColoredPainting/src/Editor/third-party modules/SvgHelper.h b/ArchitectureColoredPainting/src/Editor/ThirdPartyLib/SvgHelper.h similarity index 100% rename from ArchitectureColoredPainting/src/Editor/third-party modules/SvgHelper.h rename to ArchitectureColoredPainting/src/Editor/ThirdPartyLib/SvgHelper.h diff --git a/ArchitectureColoredPainting/src/Editor/third-party modules/qquick/qquicksvgparser.cpp b/ArchitectureColoredPainting/src/Editor/ThirdPartyLib/qquick/qquicksvgparser.cpp similarity index 100% rename from ArchitectureColoredPainting/src/Editor/third-party modules/qquick/qquicksvgparser.cpp rename to ArchitectureColoredPainting/src/Editor/ThirdPartyLib/qquick/qquicksvgparser.cpp diff --git a/ArchitectureColoredPainting/src/Editor/third-party modules/qquick/qquicksvgparser_p.h b/ArchitectureColoredPainting/src/Editor/ThirdPartyLib/qquick/qquicksvgparser_p.h similarity index 100% rename from ArchitectureColoredPainting/src/Editor/third-party modules/qquick/qquicksvgparser_p.h rename to ArchitectureColoredPainting/src/Editor/ThirdPartyLib/qquick/qquicksvgparser_p.h diff --git a/ArchitectureColoredPainting/src/Editor/third-party modules/qquick/qtquickglobal.h b/ArchitectureColoredPainting/src/Editor/ThirdPartyLib/qquick/qtquickglobal.h similarity index 100% rename from ArchitectureColoredPainting/src/Editor/third-party modules/qquick/qtquickglobal.h rename to ArchitectureColoredPainting/src/Editor/ThirdPartyLib/qquick/qtquickglobal.h diff --git a/ArchitectureColoredPainting/src/Editor/third-party modules/qquick/qtquickglobal_p.h b/ArchitectureColoredPainting/src/Editor/ThirdPartyLib/qquick/qtquickglobal_p.h similarity index 100% rename from ArchitectureColoredPainting/src/Editor/third-party modules/qquick/qtquickglobal_p.h rename to ArchitectureColoredPainting/src/Editor/ThirdPartyLib/qquick/qtquickglobal_p.h diff --git a/ArchitectureColoredPainting/src/Editor/third-party modules/util/SvgFileLoader.cpp b/ArchitectureColoredPainting/src/Editor/util/SvgFileLoader.cpp similarity index 92% rename from ArchitectureColoredPainting/src/Editor/third-party modules/util/SvgFileLoader.cpp rename to ArchitectureColoredPainting/src/Editor/util/SvgFileLoader.cpp index 6ccf71f..da7dbe4 100644 --- a/ArchitectureColoredPainting/src/Editor/third-party modules/util/SvgFileLoader.cpp +++ b/ArchitectureColoredPainting/src/Editor/util/SvgFileLoader.cpp @@ -1,6 +1,6 @@ #include "SvgFileLoader.h" #include -#include "../qquick/qquicksvgparser_p.h" +#include "../ThirdPartyLib/qquick/qquicksvgparser_p.h" #include @@ -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(); } \ No newline at end of file diff --git a/ArchitectureColoredPainting/src/Editor/third-party modules/util/SvgFileLoader.h b/ArchitectureColoredPainting/src/Editor/util/SvgFileLoader.h similarity index 90% rename from ArchitectureColoredPainting/src/Editor/third-party modules/util/SvgFileLoader.h rename to ArchitectureColoredPainting/src/Editor/util/SvgFileLoader.h index 7420c7c..93c2751 100644 --- a/ArchitectureColoredPainting/src/Editor/third-party modules/util/SvgFileLoader.h +++ b/ArchitectureColoredPainting/src/Editor/util/SvgFileLoader.h @@ -15,6 +15,7 @@ private: std::shared_ptr xmlReader; QPolygonF transformPoints(QString points); QMap 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);