Fixed issue #493. Error in seam allowance drawing.
--HG-- branch : release
This commit is contained in:
parent
b3bef6655d
commit
780700829b
|
@ -4,6 +4,7 @@
|
||||||
- [#485] Error when drawing a curved path.
|
- [#485] Error when drawing a curved path.
|
||||||
- [#491] Valentina doesn't update fractional separator.
|
- [#491] Valentina doesn't update fractional separator.
|
||||||
- [#492] Valentina crashes when add an increment.
|
- [#492] Valentina crashes when add an increment.
|
||||||
|
- [#493] Error in seam allowance drawing.
|
||||||
|
|
||||||
# Version 0.4.4 April 12, 2016
|
# Version 0.4.4 April 12, 2016
|
||||||
- Updated measurement templates with all measurements. Added new template Aldrich/Women measurements.
|
- Updated measurement templates with all measurements. Added new template Aldrich/Women measurements.
|
||||||
|
|
100
src/app/share/collection/bugs/Issue_#493.val
Normal file
100
src/app/share/collection/bugs/Issue_#493.val
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<pattern>
|
||||||
|
<!--Pattern created with Valentina (http://www.valentina-project.org/).-->
|
||||||
|
<version>0.2.4</version>
|
||||||
|
<unit>mm</unit>
|
||||||
|
<author/>
|
||||||
|
<description/>
|
||||||
|
<notes/>
|
||||||
|
<measurements>Issue_#493.vit</measurements>
|
||||||
|
<increments>
|
||||||
|
<increment name="#Прибавка_1" description="П рибавка на свободное облега н и е по л и н и и груди 0,6 см, для
пол н ы х фи гур - \ ,3 см." formula="12"/>
|
||||||
|
</increments>
|
||||||
|
<draw name="Юбка">
|
||||||
|
<calculation>
|
||||||
|
<point type="single" x="7.9375" y="494.2" id="153" name="A2" mx="1.32292" my="2.64583"/>
|
||||||
|
<point type="endLine" typeLine="hair" id="154" name="B2" basePoint="153" mx="1.32292" lineColor="black" angle="270" my="2.64583" length="@Длина_юбки"/>
|
||||||
|
<point type="endLine" typeLine="hair" id="155" name="C2" basePoint="153" mx="-12.7033" lineColor="black" angle="270" my="1.44359" length="@М_25_f"/>
|
||||||
|
<point type="endLine" typeLine="hair" id="156" name="D2" basePoint="153" mx="-7.47813" lineColor="black" angle="180" my="-14.9562" length="@М_23_b+@P_3"/>
|
||||||
|
<point type="endLine" typeLine="hair" id="157" name="E2" basePoint="155" mx="1.32292" lineColor="black" angle="180" my="2.64583" length="Line_A2_D2"/>
|
||||||
|
<point type="endLine" typeLine="hair" id="158" name="F2" basePoint="154" mx="1.32292" lineColor="black" angle="180" my="2.64583" length="Line_A2_D2"/>
|
||||||
|
<line typeLine="hair" id="159" firstPoint="156" secondPoint="158" lineColor="black"/>
|
||||||
|
<point type="endLine" typeLine="hair" id="160" name="H2" basePoint="153" mx="-1.08157" lineColor="black" angle="0" my="-13.7848" length="@М_23_f+@P_3"/>
|
||||||
|
<point type="endLine" typeLine="hair" id="161" name="I2" basePoint="155" mx="1.32292" lineColor="black" angle="0" my="2.64583" length="Line_A2_H2"/>
|
||||||
|
<point type="endLine" typeLine="hair" id="162" name="J2" basePoint="154" mx="1.32292" lineColor="black" angle="0" my="2.64583" length="Line_A2_H2"/>
|
||||||
|
<line typeLine="hair" id="163" firstPoint="162" secondPoint="160" lineColor="black"/>
|
||||||
|
<point type="endLine" typeLine="hair" id="164" name="K2" basePoint="156" mx="-18.2007" lineColor="black" angle="0" my="5.76961" length="@М_19_b+@P_4+@V_4*2"/>
|
||||||
|
<point type="endLine" typeLine="hair" id="165" name="L2" basePoint="156" mx="-17.9251" lineColor="black" angle="0" my="-12.258" length="@М_20_b"/>
|
||||||
|
<point type="endLine" typeLine="hair" id="166" name="L22" basePoint="165" mx="-9.71167" lineColor="black" angle="0" my="-15.5309" length="@V_4/2"/>
|
||||||
|
<point type="endLine" typeLine="hair" id="167" name="L23" basePoint="166" mx="2.49639" lineColor="black" angle="0" my="-14.3494" length="@V_4/2"/>
|
||||||
|
<point type="endLine" typeLine="hair" id="168" name="L24" basePoint="167" mx="-9.61661" lineColor="black" angle="0" my="-14.5764" length="@V_5"/>
|
||||||
|
<point type="normal" typeLine="hair" id="169" name="K2_" firstPoint="164" secondPoint="156" mx="1.32292" lineColor="black" angle="0" my="2.64583" length="20"/>
|
||||||
|
<point type="normal" typeLine="hair" id="170" name="K2__" firstPoint="164" secondPoint="153" mx="-4.94107" lineColor="black" angle="0" my="-13.7622" length="20"/>
|
||||||
|
<point type="endLine" typeLine="hair" id="171" name="M2" basePoint="160" mx="6.00859" lineColor="black" angle="180" my="6.55055" length="@М_19_f+@P_4+@V_3*2"/>
|
||||||
|
<point type="endLine" typeLine="hair" id="172" name="N2" basePoint="160" mx="3.08313" lineColor="blue" angle="180" my="3.23257" length="@М_20_f"/>
|
||||||
|
<point type="endLine" typeLine="hair" id="173" name="N22" basePoint="172" mx="-5.90801" lineColor="black" angle="180" my="-18.4356" length="@V_3/2"/>
|
||||||
|
<point type="endLine" typeLine="hair" id="174" name="N23" basePoint="173" mx="-17.4526" lineColor="black" angle="180" my="2.0591" length="@V_3/2"/>
|
||||||
|
<point type="endLine" typeLine="hair" id="175" name="N24" basePoint="174" mx="2.3104" lineColor="blue" angle="180" my="-16.6754" length="@V_5"/>
|
||||||
|
<point type="normal" typeLine="hair" id="176" name="M2_" firstPoint="171" secondPoint="153" mx="-3.36275" lineColor="black" angle="0" my="6.55055" length="20"/>
|
||||||
|
<point type="normal" typeLine="hair" id="177" name="M2__" firstPoint="171" secondPoint="153" mx="-7.86649" lineColor="black" angle="180" my="-15.3077" length="20"/>
|
||||||
|
<point type="endLine" typeLine="hair" id="178" name="Q2" basePoint="171" mx="7.19027" lineColor="black" angle="90" my="-13.7828" length="@P_5"/>
|
||||||
|
<point type="endLine" typeLine="hair" id="179" name="P2" basePoint="164" mx="-15.1057" lineColor="black" angle="90" my="-12.6093" length="@P_5"/>
|
||||||
|
<point type="endLine" typeLine="hair" id="180" name="G2" basePoint="156" mx="-16.2791" lineColor="black" angle="270" my="-3.80826" length="@P_5"/>
|
||||||
|
<point type="endLine" typeLine="hair" id="181" name="L25" basePoint="168" mx="-8.11194" lineColor="black" angle="0" my="4.81139" length="@V_4/2"/>
|
||||||
|
<point type="endLine" typeLine="hair" id="182" name="L26" basePoint="181" mx="3.3101" lineColor="black" angle="0" my="-13.5828" length="@V_4/2"/>
|
||||||
|
<point type="endLine" typeLine="dotLine" id="183" name="L27" basePoint="166" mx="-20.27" lineColor="black" angle="270" my="0.795005" length="@V_7"/>
|
||||||
|
<point type="endLine" typeLine="dotLine" id="184" name="L28" basePoint="181" mx="1.32292" lineColor="black" angle="270" my="2.64583" length="@V_7"/>
|
||||||
|
<point type="endLine" typeLine="hair" id="185" name="N25" basePoint="175" mx="-14.519" lineColor="black" angle="180" my="-19.0634" length="@V_3/2"/>
|
||||||
|
<point type="endLine" typeLine="hair" id="186" name="N26" basePoint="185" mx="-25.0802" lineColor="black" angle="180" my="3.23257" length="@V_3/2"/>
|
||||||
|
<point type="endLine" typeLine="dotLine" id="187" name="N27" basePoint="185" mx="1.32292" lineColor="black" angle="270" my="2.64583" length="@V_6"/>
|
||||||
|
<point type="endLine" typeLine="dotLine" id="188" name="N28" basePoint="173" mx="1.32292" lineColor="black" angle="270" my="2.64583" length="@V_6"/>
|
||||||
|
<line typeLine="hair" id="189" firstPoint="165" secondPoint="183" lineColor="black"/>
|
||||||
|
<line typeLine="hair" id="190" firstPoint="167" secondPoint="183" lineColor="black"/>
|
||||||
|
<line typeLine="hair" id="191" firstPoint="168" secondPoint="184" lineColor="blue"/>
|
||||||
|
<line typeLine="hair" id="192" firstPoint="182" secondPoint="184" lineColor="blue"/>
|
||||||
|
<line typeLine="hair" id="193" firstPoint="186" secondPoint="187" lineColor="blue"/>
|
||||||
|
<line typeLine="hair" id="194" firstPoint="175" secondPoint="187" lineColor="blue"/>
|
||||||
|
<line typeLine="hair" id="195" firstPoint="174" secondPoint="188" lineColor="blue"/>
|
||||||
|
<line typeLine="hair" id="196" firstPoint="188" secondPoint="172" lineColor="blue"/>
|
||||||
|
<spline point4="186" type="simple" kAsm1="1.23136" kAsm2="1.01111" angle1="351.775" angle2="179.264" id="197" kCurve="1" color="blue" point1="178"/>
|
||||||
|
<point type="pointOfContact" id="198" name="C2_" radius="@М_26" center="179" firstPoint="153" secondPoint="155" mx="3.72744" my="-9.37662"/>
|
||||||
|
<spline point4="198" type="simple" kAsm1="0.855702" kAsm2="1.0005" angle1="279.038" angle2="92.5636" id="199" kCurve="1" color="blue" point1="179"/>
|
||||||
|
<spline point4="178" type="simple" kAsm1="0.974179" kAsm2="0.819183" angle1="86.9349" angle2="257.215" id="200" kCurve="1" color="blue" point1="198"/>
|
||||||
|
<spline point4="179" type="simple" kAsm1="1.13769" kAsm2="0.265028" angle1="359.194" angle2="194.757" id="201" kCurve="1" color="black" point1="180"/>
|
||||||
|
<point type="curveIntersectAxis" typeLine="hair" id="202" name="L29" curve="201" basePoint="165" mx="-19.6531" lineColor="black" angle="275.993" my="3.67407"/>
|
||||||
|
<point type="curveIntersectAxis" typeLine="hair" id="203" name="L21" curve="201" basePoint="167" mx="-16.3627" lineColor="black" angle="263.976" my="1.2063"/>
|
||||||
|
<arc type="simple" angle1="270" angle2="290" id="204" radius="Line_L2_L27" center="202" color="black"/>
|
||||||
|
<arc type="simple" angle1="260" angle2="280" id="205" radius="Line_L2_L27" center="203" color="black"/>
|
||||||
|
<point type="pointOfIntersectionArcs" crossPoint="1" firstArc="204" id="206" name="S2" secondArc="205" mx="1.32292" my="2.64583"/>
|
||||||
|
<line typeLine="hair" id="207" firstPoint="202" secondPoint="206" lineColor="blue"/>
|
||||||
|
<line typeLine="hair" id="208" firstPoint="206" secondPoint="203" lineColor="blue"/>
|
||||||
|
<point type="curveIntersectAxis" typeLine="hair" id="209" name="R2" curve="201" basePoint="168" mx="-16.9797" lineColor="black" angle="275.774" my="4.70231"/>
|
||||||
|
<point type="curveIntersectAxis" typeLine="hair" id="210" name="T2" curve="201" basePoint="182" mx="5.64151" lineColor="black" angle="264.116" my="2.85148"/>
|
||||||
|
<spline point4="202" type="simple" kAsm1="1" kAsm2="1" angle1="0" angle2="180" id="211" kCurve="1" color="blue" point1="180"/>
|
||||||
|
<spline point4="209" type="simple" kAsm1="1" kAsm2="1" angle1="2" angle2="182" id="212" kCurve="1" color="blue" point1="203"/>
|
||||||
|
<spline point4="179" type="simple" kAsm1="1.03156" kAsm2="0.960515" angle1="2.61019" angle2="190.587" id="213" kCurve="1" color="blue" point1="210"/>
|
||||||
|
</calculation>
|
||||||
|
<modeling>
|
||||||
|
<point type="modeling" inUse="true" id="257" idObject="178" mx="7.19027" my="-13.7828"/>
|
||||||
|
<spline type="modelingSpline" inUse="true" id="258" idObject="197"/>
|
||||||
|
<point type="modeling" inUse="true" id="262" idObject="174" mx="-17.4526" my="2.0591"/>
|
||||||
|
<point type="modeling" inUse="true" id="263" idObject="188" mx="1.32292" my="2.64583"/>
|
||||||
|
<point type="modeling" inUse="true" id="264" idObject="172" mx="3.08313" my="3.23257"/>
|
||||||
|
<point type="modeling" inUse="true" id="265" idObject="160" mx="-1.08157" my="-13.7848"/>
|
||||||
|
<point type="modeling" inUse="true" id="266" idObject="161" mx="1.32292" my="2.64583"/>
|
||||||
|
<point type="modeling" inUse="true" id="267" idObject="155" mx="-12.7033" my="1.44359"/>
|
||||||
|
</modeling>
|
||||||
|
<details>
|
||||||
|
<detail closed="1" id="268" name="Деталь" supplement="1" mx="-35.0407" width="12" my="103.099">
|
||||||
|
<node type="NodePoint" nodeType="Contour" idObject="257" mx="0" my="0"/>
|
||||||
|
<node type="NodeSpline" reverse="0" nodeType="Contour" idObject="258" mx="0" my="0"/>
|
||||||
|
<node type="NodePoint" nodeType="Contour" idObject="262" mx="0" my="0"/>
|
||||||
|
<node type="NodePoint" nodeType="Contour" idObject="263" mx="0" my="0"/>
|
||||||
|
<node type="NodePoint" nodeType="Contour" idObject="264" mx="0" my="0"/>
|
||||||
|
<node type="NodePoint" nodeType="Contour" idObject="265" mx="0" my="0"/>
|
||||||
|
<node type="NodePoint" nodeType="Contour" idObject="266" mx="0" my="0"/>
|
||||||
|
<node type="NodePoint" nodeType="Contour" idObject="267" mx="0" my="0"/>
|
||||||
|
</detail>
|
||||||
|
</details>
|
||||||
|
</draw>
|
||||||
|
</pattern>
|
73
src/app/share/collection/bugs/Issue_#493.vit
Normal file
73
src/app/share/collection/bugs/Issue_#493.vit
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<vit>
|
||||||
|
<!--Measurements created with Valentina (http://www.valentina-project.org/).-->
|
||||||
|
<version>0.3.3</version>
|
||||||
|
<read-only>false</read-only>
|
||||||
|
<notes/>
|
||||||
|
<unit>mm</unit>
|
||||||
|
<pm_system>998</pm_system>
|
||||||
|
<personal>
|
||||||
|
<family-name/>
|
||||||
|
<given-name/>
|
||||||
|
<birth-date>1800-01-01</birth-date>
|
||||||
|
<gender>female</gender>
|
||||||
|
<email/>
|
||||||
|
</personal>
|
||||||
|
<body-measurements>
|
||||||
|
<m full_name="Обхват груди" value="92" name="@М_1"/>
|
||||||
|
<m full_name="Обхват талии" value="70" name="@М_2"/>
|
||||||
|
<m full_name="Обхват бедер на уровне выпуклости живота" value="87" name="@М_3"/>
|
||||||
|
<m full_name="Обхват бедер" value="96" name="@М_4"/>
|
||||||
|
<m full_name="Длина_посередине_до_талии (Перед)" value="371" name="@М_5_f"/>
|
||||||
|
<m full_name="Длина_посередине_до_талии (Спина)" value="425" name="@М_5_b"/>
|
||||||
|
<m full_name="Длина_до_талии (перед)" value="448 " name="@М_6_f"/>
|
||||||
|
<m full_name="Длина_до_талии (спина)" value="444" name="@М_6_b"/>
|
||||||
|
<m full_name="Высота плеча косая " value="450" name="@М_7_f"/>
|
||||||
|
<m full_name="Высота плеча косая " value="431" name="@М_7_b"/>
|
||||||
|
<m full_name="Длина от точк и основания шеи до талии" value="451" name="@М_8"/>
|
||||||
|
<m full_name="Высота груди" value="241" name="@М_9"/>
|
||||||
|
<m full_name="Радиус грудной железы" value="76" description="Радиус грудной железы B- 76" name="@М_9_R"/>
|
||||||
|
<m full_name="Расстояние между точками центра груди" value="98" name="@М_10"/>
|
||||||
|
<m full_name="Длина боковой линии до талии" value="213" name="@М_11"/>
|
||||||
|
<m full_name="Ширина шеи сзади" value="76" name="@М_12"/>
|
||||||
|
<m full_name="Ширина плечевого ската" value="134" name="@М_13"/>
|
||||||
|
<m full_name="Ширина плеча" value="197" name="@М_14_f"/>
|
||||||
|
<m full_name="Ширина плеча" value="203" name="@М_14_b"/>
|
||||||
|
<m full_name="Ширина груди" value="171" name="@М_15"/>
|
||||||
|
<m full_name="Ширина спины" value="177" name="@М_16"/>
|
||||||
|
<m full_name="Ширина груди с учетом выпуклости грудных желез" value="254" name="@М_17"/>
|
||||||
|
<m full_name="Ширина спины на уровне глубины проймы" value="219" name="@М_18"/>
|
||||||
|
<m full_name="Ширина талии" value="178" name="@М_19_f"/>
|
||||||
|
<m full_name="Ширина талии" value="169" name="@М_19_b"/>
|
||||||
|
<m full_name="Месторасположение вытачки " value="83" name="@М_20_f"/>
|
||||||
|
<m full_name="Месторасположение вытачки " value="83" name="@М_20_b"/>
|
||||||
|
<m full_name="номер не используется" value="0" name="@М_21"/>
|
||||||
|
<m full_name="Ширина бедер на уровне выпуклости живота" value="209" name="@М_22_f"/>
|
||||||
|
<m full_name="Ширина бедер на уровне выпуклости живота" value="216" name="@М_22_b"/>
|
||||||
|
<m full_name="Ширина бедер" value="232" name="@М_23_f"/>
|
||||||
|
<m full_name="Ширина бедер" value="245" name="@М_23_b"/>
|
||||||
|
<m full_name="Высота сидения" value="254" name="@М_24"/>
|
||||||
|
<m full_name="Высота бедер:
По средней линии переда" value="203" name="@М_25_f"/>
|
||||||
|
<m full_name="Высота бедер:
По средней линии спины" value="200" name="@М_25_b"/>
|
||||||
|
<m full_name="Высота бедер сбоку" value="206" name="@М_26"/>
|
||||||
|
<m full_name="Длина сбоку от линии талии до колена" value="584" name="@М_27"/>
|
||||||
|
<m full_name="Дуга через паховую область" value="660" name="@М_28"/>
|
||||||
|
<m full_name="Обхват верхней части бедра" value="546" name="@М_29"/>
|
||||||
|
<m full_name="Обхват колена" value="356" name="@М_30"/>
|
||||||
|
<m full_name="Обхват и кры" value="330" name="@М_31"/>
|
||||||
|
<m full_name="Обхват щи колотки" value="228" name="@М_32"/>
|
||||||
|
<m full_name="Прибавка на свободное облегание по линии груди " value="6" description="Прибавка на свободное облегание по линии груди 0,6 см, для полных фигур - 1 ,3 см.
Можно сделать как функцию от полноты - ширины груди
Используется и на спине по линии талии... Может надо разделить" name="@P_1"/>
|
||||||
|
<m full_name="Прибавка (спины) на свободное облегание по линии проймы" value="19" name="@P_2"/>
|
||||||
|
<m full_name="Прибавка (в юбке )на свободное облегание по линии бедер" value="13" name="@P_3"/>
|
||||||
|
<m full_name="Прибавка (в юбке )на свободное облегание по линии талии" value="6" name="@P_4"/>
|
||||||
|
<m full_name="Неровность линии талии на юбке" value="5" description="превышение боковых точкек и занижение передней точки" name="@P_5"/>
|
||||||
|
<m full_name="Раствор вытачки по талии на спине" value="38" description="Раствор вытачки по талии на спине - 38 , для дестких размеров 25" name="@V_1"/>
|
||||||
|
<m full_name="Раствор вытачки плечевой" value="12" description="Раствор вытачки плечевой - видимо на выпуклость лопатки -12" name="@V_2"/>
|
||||||
|
<m full_name="Раствор одной вытачки (из двух) переда юбки (ПП) по талии " value="16" name="@V_3"/>
|
||||||
|
<m full_name="Раствор одной вытачки (из двух) зада юбки (ЗП) по талии " value="29" name="@V_4"/>
|
||||||
|
<m full_name="Расстояние между парой вытачек" value="32" name="@V_5"/>
|
||||||
|
<m full_name="Длина вытачки переда юбки (ПП) по талии" value="90" name="@V_6"/>
|
||||||
|
<m full_name="Длина вытачки зада юбки (ЗП) по талии" value="140" name="@V_7"/>
|
||||||
|
<m full_name="Длина юбки" value="@М_27" description="Длина юбки - наприимер до колена" name="@Длина_юбки"/>
|
||||||
|
</body-measurements>
|
||||||
|
</vit>
|
|
@ -505,7 +505,7 @@ double VGObject::GetEpsilon(const QPointF &p1, const QPointF &p2)
|
||||||
{
|
{
|
||||||
const double dx1 = p2.x() - p1.x();
|
const double dx1 = p2.x() - p1.x();
|
||||||
const double dy1 = p2.y() - p1.y();
|
const double dy1 = p2.y() - p1.y();
|
||||||
const double epsilon = 0.03 * (dx1 * dx1 + dy1 * dy1); //-V636
|
const double epsilon = 0.06 * (dx1 * dx1 + dy1 * dy1); //-V636
|
||||||
return epsilon;
|
return epsilon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,13 +85,13 @@ public:
|
||||||
static QPointF addVector (const QPointF &p, const QPointF &p1, const QPointF &p2, qreal k);
|
static QPointF addVector (const QPointF &p, const QPointF &p1, const QPointF &p2, qreal k);
|
||||||
static void LineCoefficients(const QLineF &line, qreal *a, qreal *b, qreal *c);
|
static void LineCoefficients(const QLineF &line, qreal *a, qreal *b, qreal *c);
|
||||||
static bool IsPointOnLineSegment (const QPointF &t, const QPointF &p1, const QPointF &p2);
|
static bool IsPointOnLineSegment (const QPointF &t, const QPointF &p1, const QPointF &p2);
|
||||||
|
static bool IsPointOnLineviaPDP(const QPointF &t, const QPointF &p1, const QPointF &p2);
|
||||||
|
|
||||||
static QVector<QPointF> GetReversePoints(const QVector<QPointF> &points);
|
static QVector<QPointF> GetReversePoints(const QVector<QPointF> &points);
|
||||||
static int GetLengthContour(const QVector<QPointF> &contour, const QVector<QPointF> &newPoints);
|
static int GetLengthContour(const QVector<QPointF> &contour, const QVector<QPointF> &newPoints);
|
||||||
private:
|
private:
|
||||||
QSharedDataPointer<VGObjectData> d;
|
QSharedDataPointer<VGObjectData> d;
|
||||||
|
|
||||||
static bool IsPointOnLineviaPDP(const QPointF &t, const QPointF &p1, const QPointF &p2);
|
|
||||||
static double PerpDotProduct(const QPointF &p1, const QPointF &p2, const QPointF &t);
|
static double PerpDotProduct(const QPointF &p1, const QPointF &p2, const QPointF &t);
|
||||||
static double GetEpsilon(const QPointF &p1, const QPointF &p2);
|
static double GetEpsilon(const QPointF &p1, const QPointF &p2);
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
#include "vabstractdetail.h"
|
#include "vabstractdetail.h"
|
||||||
#include "vabstractdetail_p.h"
|
#include "vabstractdetail_p.h"
|
||||||
|
|
||||||
|
#include "../vgeometry/vgobject.h"
|
||||||
|
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QPointF>
|
#include <QPointF>
|
||||||
#include <QLineF>
|
#include <QLineF>
|
||||||
|
@ -327,37 +329,83 @@ QVector<QPointF> VAbstractDetail::CheckLoops(const QVector<QPointF> &points)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum LoopIntersectType { NoIntersection, BoundedIntersection, ParallelIntersection };
|
||||||
|
|
||||||
QPointF crosPoint;
|
QPointF crosPoint;
|
||||||
QLineF::IntersectType intersect = QLineF::NoIntersection;
|
LoopIntersectType status = NoIntersection;
|
||||||
const QLineF line1(points.at(i), points.at(i+1));
|
const QLineF line1(points.at(i), points.at(i+1));
|
||||||
// Because a path can contains several loops we will seek the last and only then remove the loop(s)
|
// Because a path can contains several loops we will seek the last and only then remove the loop(s)
|
||||||
// That's why we parse from the end
|
// That's why we parse from the end
|
||||||
for (j = count-2; j >= i+2; --j)
|
for (j = count-2; j >= i+2; --j)
|
||||||
{
|
{
|
||||||
const QLineF line2(points.at(j), points.at(j+1));
|
const QLineF line2(points.at(j), points.at(j+1));
|
||||||
intersect = line1.intersect(line2, &crosPoint);
|
const QLineF::IntersectType intersect = line1.intersect(line2, &crosPoint);
|
||||||
if (intersect == QLineF::BoundedIntersection && not (i == 0 && j+1 == count-1 && closed))
|
if (intersect == QLineF::NoIntersection)
|
||||||
|
{ // According to the documentation QLineF::NoIntersection indicates that the lines do not intersect;
|
||||||
|
// i.e. they are parallel. But parallel also mean they can be on the same line.
|
||||||
|
// Method IsPointOnLineviaPDP will check it.
|
||||||
|
if (VGObject::IsPointOnLineviaPDP(points.at(j), points.at(i), points.at(i+1))
|
||||||
|
// Next cases are valid for us.
|
||||||
|
&& line1.p2() != line2.p2()
|
||||||
|
&& line1.p1() != line2.p1()
|
||||||
|
&& line1.p2() != line2.p1()
|
||||||
|
&& line1.p1() != line2.p2())
|
||||||
|
{
|
||||||
|
// Left to catch case where segments are on the same line, but do not have real intersections.
|
||||||
|
QLineF tmpLine1 = line1;
|
||||||
|
QLineF tmpLine2 = line2;
|
||||||
|
|
||||||
|
tmpLine1.setAngle(tmpLine1.angle()+90);
|
||||||
|
|
||||||
|
QPointF tmpCrosPoint;
|
||||||
|
const QLineF::IntersectType tmpIntrs1 = tmpLine1.intersect(tmpLine2, &tmpCrosPoint);
|
||||||
|
|
||||||
|
tmpLine1 = line1;
|
||||||
|
tmpLine2.setAngle(tmpLine2.angle()+90);
|
||||||
|
|
||||||
|
const QLineF::IntersectType tmpIntrs2 = tmpLine1.intersect(tmpLine2, &tmpCrosPoint);
|
||||||
|
|
||||||
|
if (tmpIntrs1 == QLineF::BoundedIntersection || tmpIntrs2 == QLineF::BoundedIntersection)
|
||||||
|
{ // Now we really sure that lines are on the same lines and have real intersections.
|
||||||
|
status = ParallelIntersection;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (intersect == QLineF::BoundedIntersection && not (i == 0 && j+1 == count-1 && closed))
|
||||||
{ // Break, but not if intersects the first edge and the last edge in closed path
|
{ // Break, but not if intersects the first edge and the last edge in closed path
|
||||||
if (line1.p1() != crosPoint && line1.p2() != crosPoint &&
|
if (line1.p1() != crosPoint && line1.p2() != crosPoint &&
|
||||||
line2.p1() != crosPoint && line2.p2() != crosPoint)
|
line2.p1() != crosPoint && line2.p2() != crosPoint)
|
||||||
{ // Break, but not if loop creates crosPoint when it is first or last point of lines
|
{ // Break, but not if loop creates crosPoint when it is first or last point of lines
|
||||||
|
status = BoundedIntersection;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
intersect = QLineF::NoIntersection;
|
status = NoIntersection;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (intersect == QLineF::BoundedIntersection)
|
switch (status)
|
||||||
{
|
{
|
||||||
/*We have found loop.*/
|
case ParallelIntersection:
|
||||||
ekvPoints.append(points.at(i));
|
/*We have found a loop.*/
|
||||||
ekvPoints.append(crosPoint);
|
// Theoretically there is no big difference which point j or j+1 to select.
|
||||||
i = j;
|
// In the end we will draw a line in any case.
|
||||||
}
|
ekvPoints.append(points.at(i));
|
||||||
else
|
ekvPoints.append(points.at(j+1));
|
||||||
{
|
i = j;
|
||||||
/*We have not found loop.*/
|
break;
|
||||||
ekvPoints.append(points.at(i));
|
case BoundedIntersection:
|
||||||
|
/*We have found a loop.*/
|
||||||
|
ekvPoints.append(points.at(i));
|
||||||
|
ekvPoints.append(crosPoint);
|
||||||
|
i = j;
|
||||||
|
break;
|
||||||
|
case NoIntersection:
|
||||||
|
/*We have not found loop.*/
|
||||||
|
ekvPoints.append(points.at(i));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ekvPoints;
|
return ekvPoints;
|
||||||
|
|
|
@ -199,6 +199,44 @@ void TST_VAbstractDetail::PathRemoveLoop_data() const
|
||||||
|
|
||||||
path.removeLast();
|
path.removeLast();
|
||||||
QTest::newRow("Corect unclosed a path, point on line (six unique points)") << path << path;
|
QTest::newRow("Corect unclosed a path, point on line (six unique points)") << path << path;
|
||||||
|
|
||||||
|
path.clear();
|
||||||
|
path << QPointF(100.96979100571033, 1797.6153764073072);
|
||||||
|
path << QPointF(168.3888427659865, 1807.2395034187866);
|
||||||
|
path << QPointF(206.78076137364403, 1812.2910842036706);
|
||||||
|
path << QPointF(239.1630793382262, 1815.951361623424);
|
||||||
|
path << QPointF(267.5320085054171, 1818.4827543754482);
|
||||||
|
path << QPointF(293.9502505847841, 1820.144031725603);
|
||||||
|
path << QPointF(320.48133946750147, 1821.175819320443);
|
||||||
|
path << QPointF(364.5960626489172, 1822.0507669842166);
|
||||||
|
path << QPointF(400.66867742260206, 1822.488188976378);
|
||||||
|
path << QPointF(623.3126833308274, 1822.488188976378);
|
||||||
|
path << QPointF(653.5489038032683, 2162.6456692913384);
|
||||||
|
path << QPointF(570.545584385708, 2162.6456692913384);
|
||||||
|
path << QPointF(600.7818048581489, 1822.488188976378);
|
||||||
|
path << QPointF(1001.3385826771654, 1822.488188976378);
|
||||||
|
path << QPointF(1001.3385826771654, 2680.44094488189);
|
||||||
|
path << QPointF(-22.11646613738226, 2680.44094488189);
|
||||||
|
path << QPointF(100.96979100571033, 1797.6153764073072);
|
||||||
|
|
||||||
|
res.clear();
|
||||||
|
res << QPointF(100.96979100571033, 1797.6153764073072);
|
||||||
|
res << QPointF(168.3888427659865, 1807.2395034187866);
|
||||||
|
res << QPointF(206.78076137364403, 1812.2910842036706);
|
||||||
|
res << QPointF(239.1630793382262, 1815.951361623424);
|
||||||
|
res << QPointF(267.5320085054171, 1818.4827543754482);
|
||||||
|
res << QPointF(293.9502505847841, 1820.144031725603);
|
||||||
|
res << QPointF(320.48133946750147, 1821.175819320443);
|
||||||
|
res << QPointF(364.5960626489172, 1822.0507669842166);
|
||||||
|
res << QPointF(400.66867742260206, 1822.488188976378);
|
||||||
|
res << QPointF(1001.3385826771654, 1822.488188976378);
|
||||||
|
res << QPointF(1001.3385826771654, 1822.488188976378);
|
||||||
|
res << QPointF(1001.3385826771654, 2680.44094488189);
|
||||||
|
res << QPointF(-22.11646613738226, 2680.44094488189);
|
||||||
|
res << QPointF(100.96979100571033, 1797.6153764073072);
|
||||||
|
|
||||||
|
// See the file "collection/bugs/Issue_#493.val"
|
||||||
|
QTest::newRow("Test case issue #493") << path << res;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue
Block a user