From 796fde3cfc5d0e2bd3d5543c47dcf4ae800494d3 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Fri, 22 Jan 2016 18:18:24 +0200 Subject: [PATCH 01/11] Icons for tool Intersection curves. --HG-- branch : feature --- src/app/valentina/share/resources/cursor.qrc | 70 ++++++++------- .../cursor/intersection_curves_cursor.png | Bin 0 -> 644 bytes .../cursor/intersection_curves_cursor@2x.png | Bin 0 -> 1442 bytes .../valentina/share/resources/toolicon.qrc | 56 ++++++------ .../toolicon/32x32/intersection_curves.png | Bin 0 -> 961 bytes .../toolicon/32x32/intersection_curves@2x.png | Bin 0 -> 1859 bytes .../toolicon/32x32/splinePath_cut_point 2.png | Bin 1031 -> 0 bytes .../32x32/splinePath_cut_point copy.png | Bin 1020 -> 0 bytes .../toolicon/svg/intersection_curves.svg | 85 ++++++++++++++++++ 9 files changed, 148 insertions(+), 63 deletions(-) create mode 100644 src/app/valentina/share/resources/cursor/intersection_curves_cursor.png create mode 100644 src/app/valentina/share/resources/cursor/intersection_curves_cursor@2x.png create mode 100644 src/app/valentina/share/resources/toolicon/32x32/intersection_curves.png create mode 100644 src/app/valentina/share/resources/toolicon/32x32/intersection_curves@2x.png delete mode 100644 src/app/valentina/share/resources/toolicon/32x32/splinePath_cut_point 2.png delete mode 100644 src/app/valentina/share/resources/toolicon/32x32/splinePath_cut_point copy.png create mode 100644 src/app/valentina/share/resources/toolicon/svg/intersection_curves.svg diff --git a/src/app/valentina/share/resources/cursor.qrc b/src/app/valentina/share/resources/cursor.qrc index 45d4c9edd..ce825ea6a 100644 --- a/src/app/valentina/share/resources/cursor.qrc +++ b/src/app/valentina/share/resources/cursor.qrc @@ -1,62 +1,64 @@ cursor/endline_cursor.png + cursor/endline_cursor@2x.png cursor/line_cursor.png + cursor/line_cursor@2x.png cursor/alongline_cursor.png + cursor/alongline_cursor@2x.png cursor/shoulder_cursor.png + cursor/shoulder_cursor@2x.png cursor/normal_cursor.png + cursor/normal_cursor@2x.png cursor/bisector_cursor.png + cursor/bisector_cursor@2x.png cursor/intersect_cursor.png + cursor/intersect_cursor@2x.png cursor/spline_cursor.png + cursor/spline_cursor@2x.png cursor/arc_cursor.png + cursor/arc_cursor@2x.png cursor/splinepath_cursor.png + cursor/splinepath_cursor@2x.png cursor/pointcontact_cursor.png + cursor/pointcontact_cursor@2x.png cursor/new_detail_cursor.png + cursor/new_detail_cursor@2x.png cursor/height_cursor.png + cursor/height_cursor@2x.png cursor/triangle_cursor.png + cursor/triangle_cursor@2x.png cursor/pointofintersect_cursor.png + cursor/pointofintersect_cursor@2x.png cursor/spline_cut_point_cursor.png + cursor/spline_cut_point_cursor@2x.png cursor/splinepath_cut_point_cursor.png + cursor/splinepath_cut_point_cursor@2x.png cursor/union_cursor.png + cursor/union_cursor@2x.png cursor/arc_cut_cursor.png + cursor/arc_cut_cursor@2x.png cursor/cursor-arrow-closehand.png cursor/cursor-arrow-openhand.png cursor/line_intersect_axis_cursor.png - cursor/arc_intersect_axis_cursor.png - cursor/curve_intersect_axis_cursor.png - cursor/point_of_intersection_arcs.png - cursor/point_of_intersection_circles.png - cursor/point_from_circle_and_tangent_cursor.png - cursor/point_from_arc_and_tangent_cursor.png - cursor/arc_with_length_cursor.png - cursor/true_darts_cursor.png - cursor/alongline_cursor@2x.png - cursor/arc_cursor@2x.png - cursor/arc_cut_cursor@2x.png - cursor/arc_intersect_axis_cursor@2x.png - cursor/arc_with_length_cursor@2x.png - cursor/bisector_cursor@2x.png - cursor/curve_intersect_axis_cursor@2x.png - cursor/endline_cursor@2x.png - cursor/height_cursor@2x.png - cursor/intersect_cursor@2x.png - cursor/line_cursor@2x.png cursor/line_intersect_axis_cursor@2x.png - cursor/new_detail_cursor@2x.png - cursor/normal_cursor@2x.png - cursor/point_from_arc_and_tangent_cursor@2x.png - cursor/point_from_circle_and_tangent_cursor@2x.png - cursor/point_of_intersection_circles@2x.png - cursor/pointcontact_cursor@2x.png - cursor/pointofintersect_cursor@2x.png - cursor/shoulder_cursor@2x.png - cursor/spline_cursor@2x.png - cursor/spline_cut_point_cursor@2x.png - cursor/splinepath_cursor@2x.png - cursor/splinepath_cut_point_cursor@2x.png - cursor/true_darts_cursor@2x.png - cursor/union_cursor@2x.png - cursor/triangle_cursor@2x.png + cursor/arc_intersect_axis_cursor.png + cursor/arc_intersect_axis_cursor@2x.png + cursor/curve_intersect_axis_cursor.png + cursor/curve_intersect_axis_cursor@2x.png + cursor/point_of_intersection_arcs.png cursor/point_of_intersection_arcs@2x.png + cursor/point_of_intersection_circles.png + cursor/point_of_intersection_circles@2x.png + cursor/point_from_circle_and_tangent_cursor.png + cursor/point_from_circle_and_tangent_cursor@2x.png + cursor/point_from_arc_and_tangent_cursor.png + cursor/point_from_arc_and_tangent_cursor@2x.png + cursor/arc_with_length_cursor.png + cursor/arc_with_length_cursor@2x.png + cursor/true_darts_cursor.png + cursor/true_darts_cursor@2x.png + cursor/intersection_curves_cursor.png + cursor/intersection_curves_cursor@2x.png diff --git a/src/app/valentina/share/resources/cursor/intersection_curves_cursor.png b/src/app/valentina/share/resources/cursor/intersection_curves_cursor.png new file mode 100644 index 0000000000000000000000000000000000000000..99fd092c85c5b0dfea8e0ccf5958b95ec1c8a68b GIT binary patch literal 644 zcmV-~0(rX2Rzx&MK-m!a0Lp^M7f^Dk8~=0VnVf%Ng!Bpc`F?pc!v*qf`Kr z|B`9UVmhp5?300}MM0#;pJY|ZMjT>pV5I4(J^d8cPaQ*EFn#Kuj7=0~$ss!2Oeq!qt|!-W=y zv9Q+97cI^|F!geu+FYJlN^MuEkE@v}WWTW}qV_=4wJjqmzuYn+c`A#1cF+_n~M`6xDMZJ}1H<$)GRLo^Tx zeh@>Vz8OJZj4>L0z!;-wun#I~VvI2{CZxXjfSOpNhM=Yog4h!L07|Jy0V!>%+iuHl zySp>v!`a1c8SG9wyF0tve{$38?94g${N{d~d+!z&w4enoXu3LqBS2-kE0Qjm(efKP z3c-vkr+}*TRwwl`m<}Q5T7u4W06EtZtN`Q`gb3CEat1<}>jTIM2(tmmdI%wA2awee zrbrAx)t<_93-AvggbqajS-41kP< zFphHoG7^H*05T4OALjvN6ofI710Z7{BojbJKo}*t09+5jNAdx<8bYc7xE8`cqz-^9 zA&ih(0Iq|O4ghI`pjceH4BVLNibT~5+yh*6z*YfJ26%x|;0B-^@BoK^!RtLZOnO>C ztn>l((Fzx1{gSMt0n31Gz#d>fa1&gLB}8Y88Jt01puHT zW5E;1fo%=Y0Ib=-qPyxSSrWVPc1mfd>A)6#dGaE`3&aJOh!Z!f2KWg06W9mr0=7TH zEiZV{0`WI`(L%4%Fo2EV!5V;DT0l&zfY0MTPqc9=a)eP&tfFIt%@^rud7AF^PBx5IATCNsyymTYM`tNA- zHZiDZ3U8!%!Jnn|0}zR(2u|d z(j5HB9b6voWYmnvXCnaPopg1-hVF#@b6EHJb|f!Pw>-e>NOrX+- zBu(>HKi3BT7Vb%#Tagu_57>&V_di2sq`gi!hzBqQJnn>1hok{tBEi0k)Bgs}TP#br>5cm`U^Wc1)>;p~$P4hM6uspzrNUMC5Yp3uv$adbh z$QD@EX&G=FI0h`W_`VqEKsG<>6E*6Vfh`f00V@#*BNpEWkbm_l1L_hrnn?gAkv+Wz zWZ%y!5sEFwic?joR4SkUmcb{0#}@CPx<%)?bvp0gd4i|3GJZl1cilFAIi|(P?$9JE zQ!C%&bc;@;MaO6k5~+F_9T_N#5;bUh^^|4>kxh^Do<-DFzrm`!3N%1bG}MA>Lc<^P zwHcuZ84F5~^Mz6*VT%0-^s3x=E)bI%EeewGR3fX?Mqr((<27fj`-~uYW|-a4XH=xS zM52Ggz)q&`FS-^$74SSVnpYr4bzbC+mI3JF1btudhxZOvn~(?iQF+JIIS*7L(`Gr+ z9SRX3XJ$HbD}Z|BZIvQTHiV?Qy~uLB3xmVHqnuk|(u&5-Ds&l*9E#o>lZM3TL0ZL? wnT{M;Qzt=1z(!=`A3{d toolicon/32x32/along_line.png + toolicon/32x32/along_line@2x.png toolicon/32x32/arc.png + toolicon/32x32/arc@2x.png toolicon/32x32/arc_cut.png + toolicon/32x32/arc_cut@2x.png toolicon/32x32/arc_intersect_axis.png + toolicon/32x32/arc_intersect_axis@2x.png toolicon/32x32/bisector.png + toolicon/32x32/bisector@2x.png toolicon/32x32/curve_intersect_axis.png + toolicon/32x32/curve_intersect_axis@2x.png toolicon/32x32/height.png + toolicon/32x32/height@2x.png toolicon/32x32/intersect.png + toolicon/32x32/intersect@2x.png toolicon/32x32/line.png + toolicon/32x32/line@2x.png toolicon/32x32/line_intersect_axis.png + toolicon/32x32/line_intersect_axis@2x.png toolicon/32x32/normal.png + toolicon/32x32/normal@2x.png toolicon/32x32/point_from_arc_and_tangent.png + toolicon/32x32/point_from_arc_and_tangent@2x.png toolicon/32x32/point_from_circle_and_tangent.png + toolicon/32x32/point_from_circle_and_tangent@2x.png toolicon/32x32/point_of_contact.png + toolicon/32x32/point_of_contact@2x.png toolicon/32x32/point_of_intersection.png + toolicon/32x32/point_of_intersection@2x.png toolicon/32x32/point_of_intersection_arcs.png + toolicon/32x32/point_of_intersection_arcs@2x.png toolicon/32x32/point_of_intersection_circles.png + toolicon/32x32/point_of_intersection_circles@2x.png toolicon/32x32/segment.png + toolicon/32x32/segment@2x.png toolicon/32x32/shoulder.png + toolicon/32x32/shoulder@2x.png toolicon/32x32/spline.png + toolicon/32x32/spline@2x.png toolicon/32x32/spline_cut_point.png + toolicon/32x32/spline_cut_point@2x.png toolicon/32x32/splinePath.png + toolicon/32x32/splinePath@2x.png toolicon/32x32/splinePath_cut_point.png + toolicon/32x32/splinePath_cut_point@2x.png toolicon/32x32/triangle.png + toolicon/32x32/triangle@2x.png toolicon/32x32/union.png + toolicon/32x32/union@2x.png toolicon/32x32/new_detail.png + toolicon/32x32/new_detail@2x.png toolicon/32x32/arc_with_length.png + toolicon/32x32/arc_with_length@2x.png toolicon/32x32/true_darts.png - toolicon/32x32/along_line@2x.png - toolicon/32x32/arc_cut@2x.png - toolicon/32x32/arc_intersect_axis@2x.png - toolicon/32x32/arc_with_length@2x.png - toolicon/32x32/arc@2x.png - toolicon/32x32/bisector@2x.png - toolicon/32x32/curve_intersect_axis@2x.png - toolicon/32x32/height@2x.png - toolicon/32x32/intersect@2x.png - toolicon/32x32/line_intersect_axis@2x.png - toolicon/32x32/line@2x.png - toolicon/32x32/new_detail@2x.png - toolicon/32x32/normal@2x.png - toolicon/32x32/point_from_arc_and_tangent@2x.png - toolicon/32x32/point_from_circle_and_tangent@2x.png - toolicon/32x32/point_of_contact@2x.png - toolicon/32x32/point_of_intersection_arcs@2x.png - toolicon/32x32/point_of_intersection_circles@2x.png - toolicon/32x32/point_of_intersection@2x.png - toolicon/32x32/segment@2x.png - toolicon/32x32/shoulder@2x.png - toolicon/32x32/spline_cut_point@2x.png - toolicon/32x32/spline@2x.png - toolicon/32x32/splinePath_cut_point 2.png - toolicon/32x32/splinePath_cut_point copy.png - toolicon/32x32/splinePath_cut_point@2x.png - toolicon/32x32/splinePath@2x.png toolicon/32x32/true_darts@2x.png - toolicon/32x32/union@2x.png - toolicon/32x32/triangle@2x.png diff --git a/src/app/valentina/share/resources/toolicon/32x32/intersection_curves.png b/src/app/valentina/share/resources/toolicon/32x32/intersection_curves.png new file mode 100644 index 0000000000000000000000000000000000000000..c1142c02b09f680e40c17f0bb2d8dbd937305ad5 GIT binary patch literal 961 zcmV;y13vtTP)yvTCzvLdl zn^no86))rRJb^zkgwyy91L((iP9UlkSQn5wrb2x2YcpXob#hmKNp6-t@^iN9H&zG}X=%R8+pM^{+{ zFg0%#5sC9~sVM6fbO(mV4w#tT2spjh59R187cT`>qJ}37wjc6F-R(kgRMstp@lBW! z7ZsUg?|tz#e7(}f1ALhndm(SX1?LlD*H)6iLy7Sr^Pg_$O3o_!9`qze9xHIRL7a*w zEG)k+2{tCiM^Lkf%;$;B&SI68at%9^`8`Z8BJ)8q-(3j;xv-wQh|G~>URwzQxsvTE zaphYGtCP840s4Ot;2rTd&SGEFE;}+8e38jI-*MKV+EydU`J>@N{o3r3G94l_ylT6agZMdq zfj`rGx9AJ1u?o}+h8QUrnh>%=xuNtqM!R@r-tupdYrSsI{mvokXvw4rcGoaF_fLd?G`BspCFGvGh!2R()hy zQ{+=!92Odw9HS68IbIC|9(1TvvE<)B~c~r$uwy3)8f9qJdLHc*~`pkt(uW z2EnXDTIz~;5QfZW@*mi_#AD~SULU8y0?dds)ZJ)BDVcs_x%scgXGAGm1N3iqoANxo zcc#sy3z-@q%4sT7^xdfvi6K)1;Cz+kE*qH|pr*!O$`Z_#DOUw#YJk_-+}dnUuY&EK zNuNzXwnHFi%8uKO$sa5(a^O2`s88P!awU+%D~M``i<%x6&1}{&w_P-+Rr}PnqG5~v zy9?am3hYtR#tMad{Rp3*6&XErmdV0rw0K!2KEbST6V54Y;I9%gPbSKby1dWeR~3Gv zuyLpGu7pe@&Lrd>$&h1eSfYE^UtUD^p@iIN8F+@%L>;y%Y}6XXKaUL-f-kO{WAOtD z8Uh1q&)H#fSDRN8=LxhPe-k9%~QE#a3uCe=4;+QIu?yr-|k0tnaqVAh%5KI#_ z*rTu!->9JeXx;Y(bE?WPWh_=m{;a~tvvTl4LdR3pB$zgyR!IJ*eb8}dLdP}rjbMX9 z@_q5}4AOlVWacQj9OQ&py*Tl*1E~^NlhCuI3j7L?#&I~pfLOj=SPuJwrebiGF zY545jr4^prME-DTnKJOcQiYWmpr7E)ohdAF4V`HO zniTH;d&RzodGCu#O~W1eW9|{$V-p3#PU!qQM)+n>-^*hz;Af=-Dp>_q;ob`5OW_}Q ze%gAiL*`kj`!@M>6#44Lx?cSV16{fyI#lRs{e>43VI%eyt*tTxY{ktL$j5O2e-dtv ztr0ur&5w+YI@}ZGg6>>oTWyVJ*XNWT{Z&FG26z--FHwG6aA6-3_Wf@PSLSx;9wvL$ xpb`V*gr#e=u2)^@S#?Ea7R@gI*E5$G++J~jXV002ovPDHLkV1j8+eop`Z literal 0 HcmV?d00001 diff --git a/src/app/valentina/share/resources/toolicon/32x32/splinePath_cut_point 2.png b/src/app/valentina/share/resources/toolicon/32x32/splinePath_cut_point 2.png deleted file mode 100644 index f9ed997fa0911f761ae1749e54741dd65db96830..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1031 zcmV+i1o-=jP)?5%a*2bFB*3_Ez=A%d%HZFXNl&TvkqLm7Y;0vW)_#`eA8*8=D+O)-{X__YY zxR?{0hI`JrjSCU{;4qgv-}&a7|IB~pfB2VC_fKAqh?cVHe8zs`&`dN6GaY;b4_A0B zrXHt;*gD9!iRKshex};FDAN@2XD4wJ@oM6=#Lj$np)*gbI1>Xua(9Kf$1sB9XkZM_ z;${4fULg|gGZ`ZbcOmW~?q*^+ahb7R-kQQ`#`{7f-mOWslal<1oP#06^LezF9T9sX zwnZ$S#$AMCs9<&Gz`eW@akQ5M8@M;az%|0GKFOOp@zM(puq} z4U|*(9ZCB`jRtlm?dDVi=ozE97keqh%!-Lp_(MtCTBCt4leSw*$`@mPX&_#Nw!oUe zV2a>mZeNxrI1PueA9Jy+Dx;6Kh_A~`l!@2yS&sP6!n&r0bs9cR_*bMdIw`f$-xP@3 za|9nr1b5VEU|Yh!EsxkPq|9;5$>7b$aKc?xgMp_K15Z@zoSOIhh2ygcS7itu!5hLd z-Cu)&$^CR;4O|ZiZnx&}R${!bxj6P+SLuP#sBw7)_fn_thFq*j$cNF8MSN*l!@!C4 zjdAjvJh8rUQwnuqqItAh=k%lZCwwEU^Yv+i$DK;IEUa5O<*#}ndetz5KhUDe#Z>L= ze=TY6Of#UQp)e&?|$10QF;Jt5+jXH-)hyc1?%vEuz{;$0edds4zwI+Nr{b(oXm3Eg;N;ENrwhyje(>5)*}xo|&k_dxGm>^w)87nbD=mOcoROFj~&vE5%;kjyTc7$%vtd zzFO||5}w2DlH6Y_tj#{O6Sr`9g!X|DiB#M~-9E01Sse4>ZU)ch!=#KGac(=U?Ocia zV({|dZeBPGt-mqjFQbigROl`+uqzzl|Kq=jzW|W^>WYzflp_ED002ovPDHLkV1hen B?%4nU diff --git a/src/app/valentina/share/resources/toolicon/32x32/splinePath_cut_point copy.png b/src/app/valentina/share/resources/toolicon/32x32/splinePath_cut_point copy.png deleted file mode 100644 index a1288bf5941c798c029ba2bbe4a813aac5150780..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1020 zcmVA>uNY}dqK<&iBk86bVs}OC3u%DjT(;MEWPsV{SWx4&9=b9} zo1?#yL%`S3KaeT_Yep%azzGV0=0G)rv@iPZ90CqS-<~QUaJ-2yUvj&m9m^oy7yUN% z>qtM&VL^PZwYynZ<%cy~?jo$R>~c$yMYT4e0v?zry{Pm zj#$_ov0HP9^>GA0SqC>AzeenqI@mWO?)j?16N9UEoLvu@yW#HCJBCtP?0QfO3xGxJd+*x^fxU&+5J1gNrN2NB@ zQF$;0dQ0S+vRzMAdcTc+L)zw{RoS>REfo|7$No8z$@ZHh73Z0d>FEN#iatHX%9&5y zete{({Kn=v#jAxWt?RW)F82^_$|K<6NO&-(-~$oglY#kiCgD!{s~oQKQro|c?HZeo zvpGmfYQXOiyDSYfm$mKGRuS$XtYM^w9ccr|Fy4;uub5P5*0Qw9-YTb8b7VR<;|PwX z30TgYX^b7mPZ*-P#>T7(=yeQAdijKbqQXGAX;$p!v%tncv5;KIEqT5Rw&8u_O7klG zC2968gxQ?EL`xr|SwveY^|L9kD6sDk$MSxdESAiQccIe4NDKF)shDVa?hx + + + + + + + + + image/svg+xml + + + + + + + + + + + + + From ea0000fea6a1a2cf61dc350771ce256068d33b7e Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sun, 24 Jan 2016 18:15:08 +0200 Subject: [PATCH 02/11] First successful build. Tool working was not tested! --HG-- branch : feature --- .../core/vtooloptionspropertybrowser.cpp | 169 ++++++-- .../core/vtooloptionspropertybrowser.h | 18 + src/app/valentina/mainwindow.cpp | 19 + src/app/valentina/mainwindow.h | 1 + src/app/valentina/mainwindow.ui | 40 +- .../valentina/share/resources/toolicon.qrc | 56 +-- src/app/valentina/xml/vpattern.cpp | 37 +- src/app/valentina/xml/vpattern.h | 4 +- src/libs/ifc/ifcdef.cpp | 4 + src/libs/ifc/ifcdef.h | 4 + src/libs/ifc/schema/pattern/v0.2.5.xsd | 12 +- src/libs/ifc/xml/vabstractpattern.h | 6 +- src/libs/vgeometry/vabstractcurve.cpp | 29 +- src/libs/vgeometry/vabstractcurve.h | 2 + src/libs/vmisc/def.h | 2 + src/libs/vtools/dialogs/dialogs.pri | 9 +- src/libs/vtools/dialogs/tooldialogs.h | 1 + .../vtools/dialogs/tools/dialogalongline.cpp | 10 +- src/libs/vtools/dialogs/tools/dialogarc.cpp | 4 +- .../dialogs/tools/dialogarcwithlength.cpp | 4 +- .../vtools/dialogs/tools/dialogbisector.cpp | 16 +- .../tools/dialogcurveintersectaxis.cpp | 4 +- .../vtools/dialogs/tools/dialogcutarc.cpp | 4 +- .../vtools/dialogs/tools/dialogcutspline.cpp | 4 +- .../dialogs/tools/dialogcutsplinepath.cpp | 4 +- .../vtools/dialogs/tools/dialogendline.cpp | 4 +- .../vtools/dialogs/tools/dialogheight.cpp | 4 +- src/libs/vtools/dialogs/tools/dialogline.cpp | 4 +- .../dialogs/tools/dialoglineintersect.cpp | 4 +- .../dialogs/tools/dialoglineintersectaxis.cpp | 4 +- .../vtools/dialogs/tools/dialognormal.cpp | 10 +- .../tools/dialogpointfromarcandtangent.cpp | 6 +- .../tools/dialogpointfromcircleandtangent.cpp | 12 +- .../dialogs/tools/dialogpointofcontact.cpp | 4 +- .../tools/dialogpointofintersection.cpp | 6 +- .../tools/dialogpointofintersectionarcs.cpp | 2 +- .../dialogpointofintersectioncircles.cpp | 12 +- .../tools/dialogpointofintersectioncurves.cpp | 204 +++++++++ .../tools/dialogpointofintersectioncurves.h | 77 ++++ .../tools/dialogpointofintersectioncurves.ui | 162 ++++++++ .../dialogs/tools/dialogshoulderpoint.cpp | 4 +- .../vtools/dialogs/tools/dialogspline.cpp | 10 +- src/libs/vtools/dialogs/tools/dialogtool.cpp | 47 +-- src/libs/vtools/dialogs/tools/dialogtool.h | 38 +- .../vtools/dialogs/tools/dialogtriangle.cpp | 10 +- .../vtools/dialogs/tools/dialogtruedarts.cpp | 10 +- src/libs/vtools/tools/drawTools/drawtools.h | 1 + .../tools/drawTools/toolcurve/vtoolarc.cpp | 2 +- .../toolcurve/vtoolarcwithlength.cpp | 2 +- .../tools/drawTools/toolcurve/vtoolspline.cpp | 4 +- .../tooldoublepoint/vtooltruedarts.cpp | 4 +- .../toolsinglepoint/toolcut/vtoolcutarc.cpp | 2 +- .../toolcut/vtoolcutspline.cpp | 2 +- .../toolcut/vtoolcutsplinepath.cpp | 2 +- .../toollinepoint/vtoolalongline.cpp | 4 +- .../toollinepoint/vtoolbisector.cpp | 6 +- .../toollinepoint/vtoolcurveintersectaxis.cpp | 2 +- .../toollinepoint/vtoolendline.cpp | 2 +- .../toollinepoint/vtoolheight.cpp | 2 +- .../toollinepoint/vtoollineintersectaxis.cpp | 2 +- .../toollinepoint/vtoolnormal.cpp | 4 +- .../toollinepoint/vtoolshoulderpoint.cpp | 2 +- .../toolsinglepoint/vtoollineintersect.cpp | 2 +- .../vtoolpointfromarcandtangent.cpp | 2 +- .../vtoolpointfromcircleandtangent.cpp | 4 +- .../toolsinglepoint/vtoolpointofcontact.cpp | 2 +- .../vtoolpointofintersection.cpp | 2 +- .../vtoolpointofintersectioncircles.cpp | 4 +- .../vtoolpointofintersectioncurves.cpp | 388 ++++++++++++++++++ .../vtoolpointofintersectioncurves.h | 87 ++++ .../toolsinglepoint/vtooltriangle.cpp | 4 +- src/libs/vtools/tools/drawTools/vtoolline.cpp | 2 +- src/libs/vtools/tools/tools.pri | 6 +- .../vtools/visualization/vistoolalongline.cpp | 14 +- .../vtools/visualization/vistoolalongline.h | 4 +- src/libs/vtools/visualization/vistoolarc.cpp | 4 +- .../visualization/vistoolarcwithlength.cpp | 4 +- .../vtools/visualization/vistoolbisector.cpp | 22 +- .../vtools/visualization/vistoolbisector.h | 8 +- .../vistoolcurveintersectaxis.cpp | 4 +- .../vtools/visualization/vistoolcutarc.cpp | 4 +- .../vtools/visualization/vistoolcutspline.cpp | 4 +- .../visualization/vistoolcutsplinepath.cpp | 4 +- .../vtools/visualization/vistoolendline.cpp | 2 +- .../vtools/visualization/vistoolheight.cpp | 4 +- src/libs/vtools/visualization/vistoolline.cpp | 2 +- .../visualization/vistoollineintersect.cpp | 4 +- .../vistoollineintersectaxis.cpp | 4 +- .../vtools/visualization/vistoolnormal.cpp | 14 +- src/libs/vtools/visualization/vistoolnormal.h | 4 +- .../vistoolpointfromarcandtangent.cpp | 4 +- .../vistoolpointfromcircleandtangent.cpp | 14 +- .../vistoolpointfromcircleandtangent.h | 4 +- .../visualization/vistoolpointofcontact.cpp | 4 +- .../vistoolpointofintersection.cpp | 4 +- .../vistoolpointofintersectioncircles.cpp | 16 +- .../vistoolpointofintersectioncircles.h | 4 +- .../vistoolpointofintersectioncurves.cpp | 94 +++++ .../vistoolpointofintersectioncurves.h | 62 +++ .../visualization/vistoolshoulderpoint.cpp | 4 +- .../vtools/visualization/vistoolspline.cpp | 14 +- src/libs/vtools/visualization/vistoolspline.h | 4 +- .../vtools/visualization/vistooltriangle.cpp | 14 +- .../vtools/visualization/vistooltriangle.h | 4 +- .../vtools/visualization/vistooltruedarts.cpp | 6 +- .../vtools/visualization/vistooltruedarts.h | 2 +- .../vtools/visualization/visualization.cpp | 8 +- src/libs/vtools/visualization/visualization.h | 4 +- .../vtools/visualization/visualization.pri | 6 +- 109 files changed, 1688 insertions(+), 333 deletions(-) create mode 100644 src/libs/vtools/dialogs/tools/dialogpointofintersectioncurves.cpp create mode 100644 src/libs/vtools/dialogs/tools/dialogpointofintersectioncurves.h create mode 100644 src/libs/vtools/dialogs/tools/dialogpointofintersectioncurves.ui create mode 100644 src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp create mode 100644 src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.h create mode 100644 src/libs/vtools/visualization/vistoolpointofintersectioncurves.cpp create mode 100644 src/libs/vtools/visualization/vistoolpointofintersectioncurves.h diff --git a/src/app/valentina/core/vtooloptionspropertybrowser.cpp b/src/app/valentina/core/vtooloptionspropertybrowser.cpp index 04b8d253e..c865db382 100644 --- a/src/app/valentina/core/vtooloptionspropertybrowser.cpp +++ b/src/app/valentina/core/vtooloptionspropertybrowser.cpp @@ -126,6 +126,9 @@ void VToolOptionsPropertyBrowser::ShowItemOptions(QGraphicsItem *item) case VToolPointOfIntersectionCircles::Type: ShowOptionsToolPointOfIntersectionCircles(item); break; + case VToolPointOfIntersectionCurves::Type: + ShowOptionsToolPointOfIntersectionCurves(item); + break; case VToolShoulderPoint::Type: ShowOptionsToolShoulderPoint(item); break; @@ -231,6 +234,9 @@ void VToolOptionsPropertyBrowser::UpdateOptions() case VToolPointOfIntersectionCircles::Type: UpdateOptionsToolPointOfIntersectionCircles(); break; + case VToolPointOfIntersectionCurves::Type: + UpdateOptionsToolPointOfIntersectionCurves(); + break; case VToolShoulderPoint::Type: UpdateOptionsToolShoulderPoint(); break; @@ -351,6 +357,9 @@ void VToolOptionsPropertyBrowser::userChangedData(VProperty *property) case VToolPointOfIntersectionCircles::Type: ChangeDataToolPointOfIntersectionCircles(prop); break; + case VToolPointOfIntersectionCurves::Type: + ChangeDataToolPointOfIntersectionCurves(prop); + break; case VToolShoulderPoint::Type: ChangeDataToolShoulderPoint(prop); break; @@ -471,10 +480,30 @@ void VToolOptionsPropertyBrowser::AddPropertyCrossPoint(Tool *i, const QString & { VEnumProperty* itemProperty = new VEnumProperty(propertyName); itemProperty->setLiterals(QStringList()<< tr("First point") << tr("Second point")); - itemProperty->setValue(static_cast(i->GetCrossCirclesPoint())-1); + itemProperty->setValue(static_cast(i->GetCrossCirclesPoint())); AddProperty(itemProperty, AttrCrossPoint); } +//--------------------------------------------------------------------------------------------------------------------- +template +void VToolOptionsPropertyBrowser::AddPropertyVCrossPoint(Tool *i, const QString &propertyName) +{ + auto itemProperty = new VEnumProperty(propertyName); + itemProperty->setLiterals(QStringList()<< tr("Highest point") << tr("Lowest point")); + itemProperty->setValue(static_cast(i->GetVCrossPoint())); + AddProperty(itemProperty, AttrVCrossPoint); +} + +//--------------------------------------------------------------------------------------------------------------------- +template +void VToolOptionsPropertyBrowser::AddPropertyHCrossPoint(Tool *i, const QString &propertyName) +{ + auto itemProperty = new VEnumProperty(propertyName); + itemProperty->setLiterals(QStringList()<< tr("Leftmost point") << tr("Rightmost point")); + itemProperty->setValue(static_cast(i->GetHCrossPoint())); + AddProperty(itemProperty, AttrHCrossPoint); +} + //--------------------------------------------------------------------------------------------------------------------- template void VToolOptionsPropertyBrowser::AddPropertyLineType(Tool *i, const QString &propertyName, @@ -588,32 +617,65 @@ void VToolOptionsPropertyBrowser::SetPointName2(const QString &name) } } +//--------------------------------------------------------------------------------------------------------------------- +template +Type VToolOptionsPropertyBrowser::GetCrossPoint(const QVariant &value) +{ + bool ok = false; + const int val = value.toInt(&ok); + + auto cross = static_cast(1); + if (ok) + { + switch(val) + { + case 1: + case 2: + cross = static_cast(val); + break; + default: + break; + } + } + + return cross; +} + //--------------------------------------------------------------------------------------------------------------------- template void VToolOptionsPropertyBrowser::SetCrossCirclesPoint(const QVariant &value) { if (Tool *i = qgraphicsitem_cast(currentItem)) { - bool ok = false; - const int val = value.toInt(&ok); + i->SetCrossCirclesPoint(GetCrossPoint(value)); + } + else + { + qWarning()<<"Can't cast item"; + } +} - CrossCirclesPoint cross = CrossCirclesPoint::FirstPoint; - if (ok) - { - switch(val) - { - case 0: - cross = CrossCirclesPoint::FirstPoint; - break; - case 1: - cross = CrossCirclesPoint::SecondPoint; - break; - default: - cross = CrossCirclesPoint::FirstPoint; - break; - } - } - i->SetCrossCirclesPoint(cross); +//--------------------------------------------------------------------------------------------------------------------- +template +void VToolOptionsPropertyBrowser::SetVCrossCurvesPoint(const QVariant &value) +{ + if (auto i = qgraphicsitem_cast(currentItem)) + { + i->SetVCrossPoint(GetCrossPoint(value)); + } + else + { + qWarning()<<"Can't cast item"; + } +} + +//--------------------------------------------------------------------------------------------------------------------- +template +void VToolOptionsPropertyBrowser::SetHCrossCurvesPoint(const QVariant &value) +{ + if (auto i = qgraphicsitem_cast(currentItem)) + { + i->SetHCrossPoint(GetCrossPoint(value)); } else { @@ -1111,6 +1173,39 @@ void VToolOptionsPropertyBrowser::ChangeDataToolPointOfIntersectionCircles(VProp } } +//--------------------------------------------------------------------------------------------------------------------- +void VToolOptionsPropertyBrowser::ChangeDataToolPointOfIntersectionCurves(VProperty *property) +{ + SCASSERT(property != nullptr) + + const QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole); + const QString id = propertyToId[property]; + + auto i = qgraphicsitem_cast(currentItem); + SCASSERT(i != nullptr); + switch (PropertiesList().indexOf(id)) + { + case 0: // AttrName + SetPointName(value.toString()); + break; + case 34: // AttrVCrossPoint + { + const QVariant value = property->data(VProperty::DPC_Data, Qt::EditRole); + SetVCrossCurvesPoint(value); + break; + } + case 35: // AttrHCrossPoint + { + const QVariant value = property->data(VProperty::DPC_Data, Qt::EditRole); + SetHCrossCurvesPoint(value); + break; + } + default: + qWarning()<<"Unknown property type. id = "<(item); + i->ShowVisualization(true); + formView->setTitle(tr("Tool to make point from intersection two curves")); + + AddPropertyPointName(i, tr("Point label")); + AddPropertyVCrossPoint(i, tr("Vertical correction")); + AddPropertyHCrossPoint(i, tr("Horizontal correction")); +} + //--------------------------------------------------------------------------------------------------------------------- void VToolOptionsPropertyBrowser::ShowOptionsToolPointFromCircleAndTangent(QGraphicsItem *item) { @@ -1930,7 +2037,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolPointOfIntersectionArcs() VToolPointOfIntersectionArcs *i = qgraphicsitem_cast(currentItem); idToProperty[AttrName]->setValue(i->name()); - idToProperty[AttrCrossPoint]->setValue(static_cast(i->GetCrossCirclesPoint())-1); + idToProperty[AttrCrossPoint]->setValue(static_cast(i->GetCrossCirclesPoint())); } //--------------------------------------------------------------------------------------------------------------------- @@ -1939,7 +2046,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolPointOfIntersectionCircles() VToolPointOfIntersectionCircles *i = qgraphicsitem_cast(currentItem); idToProperty[AttrName]->setValue(i->name()); - idToProperty[AttrCrossPoint]->setValue(static_cast(i->GetCrossCirclesPoint())-1); + idToProperty[AttrCrossPoint]->setValue(static_cast(i->GetCrossCirclesPoint())); QVariant c1Radius; c1Radius.setValue(i->GetFirstCircleRadius()); @@ -1950,13 +2057,23 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolPointOfIntersectionCircles() idToProperty[AttrC2Radius]->setValue(c2Radius); } +//--------------------------------------------------------------------------------------------------------------------- +void VToolOptionsPropertyBrowser::UpdateOptionsToolPointOfIntersectionCurves() +{ + auto i = qgraphicsitem_cast(currentItem); + + idToProperty[AttrName]->setValue(i->name()); + idToProperty[AttrVCrossPoint]->setValue(static_cast(i->GetVCrossPoint())); + idToProperty[AttrHCrossPoint]->setValue(static_cast(i->GetHCrossPoint())); +} + //--------------------------------------------------------------------------------------------------------------------- void VToolOptionsPropertyBrowser::UpdateOptionsToolPointFromCircleAndTangent() { VToolPointFromCircleAndTangent *i = qgraphicsitem_cast(currentItem); idToProperty[AttrName]->setValue(i->name()); - idToProperty[AttrCrossPoint]->setValue(static_cast(i->GetCrossCirclesPoint())-1); + idToProperty[AttrCrossPoint]->setValue(static_cast(i->GetCrossCirclesPoint())); QVariant cRadius; cRadius.setValue(i->GetCircleRadius()); @@ -1969,7 +2086,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolPointFromArcAndTangent() VToolPointFromArcAndTangent *i = qgraphicsitem_cast(currentItem); idToProperty[AttrName]->setValue(i->name()); - idToProperty[AttrCrossPoint]->setValue(static_cast(i->GetCrossCirclesPoint())-1); + idToProperty[AttrCrossPoint]->setValue(static_cast(i->GetCrossCirclesPoint())); } //--------------------------------------------------------------------------------------------------------------------- @@ -2104,6 +2221,8 @@ QStringList VToolOptionsPropertyBrowser::PropertiesList() const << AttrC2Radius /* 30 */ << AttrCRadius /* 31 */ << AttrName1 /* 32 */ - << AttrName2; /* 33 */ + << AttrName2 /* 33 */ + << AttrVCrossPoint /* 34 */ + << AttrHCrossPoint; /* 35 */ return attr; } diff --git a/src/app/valentina/core/vtooloptionspropertybrowser.h b/src/app/valentina/core/vtooloptionspropertybrowser.h index 211522e3d..6dabcd7e8 100644 --- a/src/app/valentina/core/vtooloptionspropertybrowser.h +++ b/src/app/valentina/core/vtooloptionspropertybrowser.h @@ -74,9 +74,18 @@ private: template void SetPointName2(const QString &name); + template + Type GetCrossPoint(const QVariant &value); + template void SetCrossCirclesPoint(const QVariant &value); + template + void SetVCrossCurvesPoint(const QVariant &value); + + template + void SetHCrossCurvesPoint(const QVariant &value); + template void AddPropertyPointName(Tool *i, const QString &propertyName); @@ -89,6 +98,12 @@ private: template void AddPropertyCrossPoint(Tool *i, const QString &propertyName); + template + void AddPropertyVCrossPoint(Tool *i, const QString &propertyName); + + template + void AddPropertyHCrossPoint(Tool *i, const QString &propertyName); + template void AddPropertyLineType(Tool *i, const QString &propertyName, const QMap &styles); @@ -118,6 +133,7 @@ private: void ChangeDataToolPointOfIntersection(VPE::VProperty *property); void ChangeDataToolPointOfIntersectionArcs(VPE::VProperty *property); void ChangeDataToolPointOfIntersectionCircles(VPE::VProperty *property); + void ChangeDataToolPointOfIntersectionCurves(VPE::VProperty *property); void ChangeDataToolPointFromCircleAndTangent(VPE::VProperty *property); void ChangeDataToolPointFromArcAndTangent(VPE::VProperty *property); void ChangeDataToolShoulderPoint(VPE::VProperty *property); @@ -145,6 +161,7 @@ private: void ShowOptionsToolPointOfIntersection(QGraphicsItem *item); void ShowOptionsToolPointOfIntersectionArcs(QGraphicsItem *item); void ShowOptionsToolPointOfIntersectionCircles(QGraphicsItem *item); + void ShowOptionsToolPointOfIntersectionCurves(QGraphicsItem *item); void ShowOptionsToolPointFromCircleAndTangent(QGraphicsItem *item); void ShowOptionsToolPointFromArcAndTangent(QGraphicsItem *item); void ShowOptionsToolShoulderPoint(QGraphicsItem *item); @@ -172,6 +189,7 @@ private: void UpdateOptionsToolPointOfIntersection(); void UpdateOptionsToolPointOfIntersectionArcs(); void UpdateOptionsToolPointOfIntersectionCircles(); + void UpdateOptionsToolPointOfIntersectionCurves(); void UpdateOptionsToolPointFromCircleAndTangent(); void UpdateOptionsToolPointFromArcAndTangent(); void UpdateOptionsToolShoulderPoint(); diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index 1e4a56c72..1498f2826 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -995,6 +995,16 @@ void MainWindow::ToolPointOfIntersectionCircles(bool checked) &MainWindow::ApplyDialog); } +//--------------------------------------------------------------------------------------------------------------------- +void MainWindow::ToolPointOfIntersectionCurves(bool checked) +{ + SetToolButtonWithApply(checked, Tool::PointOfIntersectionCurves, + "://cursor/intersection_curves_cursor.png", + tr("Select first curve"), + &MainWindow::ClosedDialogWithApply, + &MainWindow::ApplyDialog); +} + //--------------------------------------------------------------------------------------------------------------------- void MainWindow::ToolPointFromCircleAndTangent(bool checked) { @@ -1585,6 +1595,7 @@ void MainWindow::InitToolButtons() &MainWindow::ToolPointOfIntersectionArcs); connect(ui->toolButtonPointOfIntersectionCircles, &QToolButton::clicked, this, &MainWindow::ToolPointOfIntersectionCircles); + connect(ui->toolButtonIntersectionCurves, &QToolButton::clicked, this, &MainWindow::ToolPointOfIntersectionCurves); connect(ui->toolButtonPointFromCircleAndTangent, &QToolButton::clicked, this, &MainWindow::ToolPointFromCircleAndTangent); connect(ui->toolButtonPointFromArcAndTangent, &QToolButton::clicked, this, &MainWindow::ToolPointFromArcAndTangent); @@ -1714,6 +1725,9 @@ void MainWindow::CancelTool() case Tool::PointOfIntersectionCircles: ui->toolButtonPointOfIntersectionCircles->setChecked(false); break; + case Tool::PointOfIntersectionCurves: + ui->toolButtonIntersectionCurves->setChecked(false); + break; case Tool::PointFromCircleAndTangent: ui->toolButtonPointFromCircleAndTangent->setChecked(false); break; @@ -2892,6 +2906,7 @@ void MainWindow::SetEnableTool(bool enable) ui->toolButtonCurveIntersectAxis->setEnabled(drawTools); ui->toolButtonArcIntersectAxis->setEnabled(drawTools); ui->toolButtonPointOfIntersectionArcs->setEnabled(drawTools); + ui->toolButtonIntersectionCurves->setEnabled(drawTools); ui->toolButtonPointOfIntersectionCircles->setEnabled(drawTools); ui->toolButtonPointFromCircleAndTangent->setEnabled(drawTools); ui->toolButtonPointFromArcAndTangent->setEnabled(drawTools); @@ -3272,6 +3287,10 @@ void MainWindow::LastUsedTool() ui->toolButtonPointOfIntersectionCircles->setChecked(true); ToolPointOfIntersectionCircles(true); break; + case Tool::PointOfIntersectionCurves: + ui->toolButtonIntersectionCurves->setChecked(true); + ToolPointOfIntersectionCurves(true); + break; case Tool::PointFromCircleAndTangent: ui->toolButtonPointFromCircleAndTangent->setChecked(true); ToolPointFromCircleAndTangent(true); diff --git a/src/app/valentina/mainwindow.h b/src/app/valentina/mainwindow.h index 34eea7aa2..a77d9ce62 100644 --- a/src/app/valentina/mainwindow.h +++ b/src/app/valentina/mainwindow.h @@ -125,6 +125,7 @@ public slots: void ToolArcIntersectAxis(bool checked); void ToolPointOfIntersectionArcs(bool checked); void ToolPointOfIntersectionCircles(bool checked); + void ToolPointOfIntersectionCurves(bool checked); void ToolPointFromCircleAndTangent(bool checked); void ToolPointFromArcAndTangent(bool checked); void ToolArcWithLength(bool checked); diff --git a/src/app/valentina/mainwindow.ui b/src/app/valentina/mainwindow.ui index 60cc169c3..6477697ae 100644 --- a/src/app/valentina/mainwindow.ui +++ b/src/app/valentina/mainwindow.ui @@ -48,7 +48,7 @@ Tools - 0 + 2 @@ -375,7 +375,7 @@ 0 0 - 100 + 130 58 @@ -461,7 +461,7 @@ 0 0 - 100 + 130 156 @@ -618,6 +618,32 @@ + + + + false + + + Point intersection curves + + + ... + + + + :/toolicon/32x32/intersection_curves.png:/toolicon/32x32/intersection_curves.png + + + + 32 + 32 + + + + true + + + @@ -625,7 +651,7 @@ 0 0 - 100 + 130 196 @@ -867,7 +893,7 @@ 0 0 - 100 + 130 58 @@ -953,8 +979,8 @@ 0 0 - 98 - 58 + 130 + 386 diff --git a/src/app/valentina/share/resources/toolicon.qrc b/src/app/valentina/share/resources/toolicon.qrc index 7b378f67d..ad4724430 100644 --- a/src/app/valentina/share/resources/toolicon.qrc +++ b/src/app/valentina/share/resources/toolicon.qrc @@ -1,60 +1,62 @@ toolicon/32x32/along_line.png - toolicon/32x32/along_line@2x.png + toolicon/32x32/along_line@2x.png toolicon/32x32/arc.png - toolicon/32x32/arc@2x.png + toolicon/32x32/arc@2x.png toolicon/32x32/arc_cut.png - toolicon/32x32/arc_cut@2x.png + toolicon/32x32/arc_cut@2x.png toolicon/32x32/arc_intersect_axis.png - toolicon/32x32/arc_intersect_axis@2x.png + toolicon/32x32/arc_intersect_axis@2x.png toolicon/32x32/bisector.png - toolicon/32x32/bisector@2x.png + toolicon/32x32/bisector@2x.png toolicon/32x32/curve_intersect_axis.png - toolicon/32x32/curve_intersect_axis@2x.png + toolicon/32x32/curve_intersect_axis@2x.png toolicon/32x32/height.png - toolicon/32x32/height@2x.png + toolicon/32x32/height@2x.png toolicon/32x32/intersect.png - toolicon/32x32/intersect@2x.png + toolicon/32x32/intersect@2x.png toolicon/32x32/line.png - toolicon/32x32/line@2x.png + toolicon/32x32/line@2x.png toolicon/32x32/line_intersect_axis.png - toolicon/32x32/line_intersect_axis@2x.png + toolicon/32x32/line_intersect_axis@2x.png toolicon/32x32/normal.png - toolicon/32x32/normal@2x.png + toolicon/32x32/normal@2x.png toolicon/32x32/point_from_arc_and_tangent.png - toolicon/32x32/point_from_arc_and_tangent@2x.png + toolicon/32x32/point_from_arc_and_tangent@2x.png toolicon/32x32/point_from_circle_and_tangent.png - toolicon/32x32/point_from_circle_and_tangent@2x.png + toolicon/32x32/point_from_circle_and_tangent@2x.png toolicon/32x32/point_of_contact.png - toolicon/32x32/point_of_contact@2x.png + toolicon/32x32/point_of_contact@2x.png toolicon/32x32/point_of_intersection.png - toolicon/32x32/point_of_intersection@2x.png + toolicon/32x32/point_of_intersection@2x.png toolicon/32x32/point_of_intersection_arcs.png - toolicon/32x32/point_of_intersection_arcs@2x.png + toolicon/32x32/point_of_intersection_arcs@2x.png toolicon/32x32/point_of_intersection_circles.png - toolicon/32x32/point_of_intersection_circles@2x.png + toolicon/32x32/point_of_intersection_circles@2x.png toolicon/32x32/segment.png - toolicon/32x32/segment@2x.png + toolicon/32x32/segment@2x.png toolicon/32x32/shoulder.png - toolicon/32x32/shoulder@2x.png + toolicon/32x32/shoulder@2x.png toolicon/32x32/spline.png - toolicon/32x32/spline@2x.png + toolicon/32x32/spline@2x.png toolicon/32x32/spline_cut_point.png - toolicon/32x32/spline_cut_point@2x.png + toolicon/32x32/spline_cut_point@2x.png toolicon/32x32/splinePath.png - toolicon/32x32/splinePath@2x.png + toolicon/32x32/splinePath@2x.png toolicon/32x32/splinePath_cut_point.png - toolicon/32x32/splinePath_cut_point@2x.png + toolicon/32x32/splinePath_cut_point@2x.png toolicon/32x32/triangle.png - toolicon/32x32/triangle@2x.png + toolicon/32x32/triangle@2x.png toolicon/32x32/union.png - toolicon/32x32/union@2x.png + toolicon/32x32/union@2x.png toolicon/32x32/new_detail.png - toolicon/32x32/new_detail@2x.png + toolicon/32x32/new_detail@2x.png toolicon/32x32/arc_with_length.png - toolicon/32x32/arc_with_length@2x.png + toolicon/32x32/arc_with_length@2x.png toolicon/32x32/true_darts.png toolicon/32x32/true_darts@2x.png + toolicon/32x32/intersection_curves.png + toolicon/32x32/intersection_curves@2x.png diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index 49b4f7656..65380a32c 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -714,7 +714,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem << VToolPointOfIntersectionCircles::ToolType /*18*/ << VToolPointFromCircleAndTangent::ToolType /*19*/ << VToolPointFromArcAndTangent::ToolType /*20*/ - << VToolTrueDarts::ToolType; /*21*/ + << VToolTrueDarts::ToolType /*21*/ + << VToolPointOfIntersectionCurves::ToolType; /*22*/ switch (points.indexOf(type)) { case 0: //VToolBasePoint::ToolType @@ -783,6 +784,9 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem case 21: //VToolTrueDarts::ToolType ParseToolTrueDarts(scene, domElement, parse); break; + case 22: //VToolPointOfIntersectionCurves::ToolType + ParseToolPointOfIntersectionCurves(scene, domElement, parse); + break; default: VException e(tr("Unknown point type '%1'.").arg(type)); throw e; @@ -1690,6 +1694,37 @@ void VPattern::ParseToolPointOfIntersectionCircles(VMainGraphicsScene *scene, QD } } +//--------------------------------------------------------------------------------------------------------------------- +void VPattern::ParseToolPointOfIntersectionCurves(VMainGraphicsScene *scene, QDomElement &domElement, + const Document &parse) +{ + SCASSERT(scene != nullptr); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); + + try + { + quint32 id = 0; + QString name; + qreal mx = 0; + qreal my = 0; + + PointsCommonAttributes(domElement, id, name, mx, my); + const auto curve1Id = GetParametrUInt(domElement, AttrCurve1, NULL_ID_STR); + const auto curve2Id = GetParametrUInt(domElement, AttrCurve2, NULL_ID_STR); + const auto vCrossPoint = static_cast(GetParametrUInt(domElement, AttrVCrossPoint, "1")); + const auto hCrossPoint = static_cast(GetParametrUInt(domElement, AttrHCrossPoint, "1")); + + VToolPointOfIntersectionCurves::Create(id, name, curve1Id, curve2Id, vCrossPoint, hCrossPoint, mx, my, + scene, this, data, parse, Source::FromFile); + } + catch (const VExceptionBadId &e) + { + VExceptionObjectError excep(tr("Error creating or updating point of intersection curves"), domElement); + excep.AddMoreInformation(e.ErrorMessage()); + throw excep; + } +} + //--------------------------------------------------------------------------------------------------------------------- void VPattern::ParseToolPointFromCircleAndTangent(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse) diff --git a/src/app/valentina/xml/vpattern.h b/src/app/valentina/xml/vpattern.h index bd71a8190..108fd5e46 100644 --- a/src/app/valentina/xml/vpattern.h +++ b/src/app/valentina/xml/vpattern.h @@ -159,8 +159,8 @@ private: void ParseToolCurveIntersectAxis(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse); void ParseToolPointOfIntersectionArcs(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse); - void ParseToolPointOfIntersectionCircles(VMainGraphicsScene *scene, QDomElement &domElement, - const Document &parse); + void ParseToolPointOfIntersectionCircles(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse); + void ParseToolPointOfIntersectionCurves(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse); void ParseToolPointFromCircleAndTangent(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse); void ParseToolPointFromArcAndTangent(VMainGraphicsScene *scene, const QDomElement &domElement, diff --git a/src/libs/ifc/ifcdef.cpp b/src/libs/ifc/ifcdef.cpp index fda9f7e77..58566ee35 100644 --- a/src/libs/ifc/ifcdef.cpp +++ b/src/libs/ifc/ifcdef.cpp @@ -107,11 +107,15 @@ const QString AttrPSpline = QStringLiteral("pSpline"); const QString AttrAxisP1 = QStringLiteral("axisP1"); const QString AttrAxisP2 = QStringLiteral("axisP2"); const QString AttrCurve = QStringLiteral("curve"); +const QString AttrCurve1 = QStringLiteral("curve1"); +const QString AttrCurve2 = QStringLiteral("curve2"); const QString AttrLineColor = QStringLiteral("lineColor"); const QString AttrColor = QStringLiteral("color"); const QString AttrFirstArc = QStringLiteral("firstArc"); const QString AttrSecondArc = QStringLiteral("secondArc"); const QString AttrCrossPoint = QStringLiteral("crossPoint"); +const QString AttrVCrossPoint = QStringLiteral("vCrossPoint"); +const QString AttrHCrossPoint = QStringLiteral("hCrossPoint"); const QString AttrC1Center = QStringLiteral("c1Center"); const QString AttrC2Center = QStringLiteral("c2Center"); const QString AttrC1Radius = QStringLiteral("c1Radius"); diff --git a/src/libs/ifc/ifcdef.h b/src/libs/ifc/ifcdef.h index 7d6793598..f630b509d 100644 --- a/src/libs/ifc/ifcdef.h +++ b/src/libs/ifc/ifcdef.h @@ -109,11 +109,15 @@ extern const QString AttrPSpline; extern const QString AttrAxisP1; extern const QString AttrAxisP2; extern const QString AttrCurve; +extern const QString AttrCurve1; +extern const QString AttrCurve2; extern const QString AttrLineColor; extern const QString AttrColor; extern const QString AttrFirstArc; extern const QString AttrSecondArc; extern const QString AttrCrossPoint; +extern const QString AttrVCrossPoint; +extern const QString AttrHCrossPoint; extern const QString AttrC1Center; extern const QString AttrC2Center; extern const QString AttrC1Radius; diff --git a/src/libs/ifc/schema/pattern/v0.2.5.xsd b/src/libs/ifc/schema/pattern/v0.2.5.xsd index 76d366e5f..8e938b7ee 100644 --- a/src/libs/ifc/schema/pattern/v0.2.5.xsd +++ b/src/libs/ifc/schema/pattern/v0.2.5.xsd @@ -120,11 +120,15 @@ + + - + + + @@ -421,4 +425,10 @@ + + + + + + diff --git a/src/libs/ifc/xml/vabstractpattern.h b/src/libs/ifc/xml/vabstractpattern.h index 30acc67c5..caad6afcd 100644 --- a/src/libs/ifc/xml/vabstractpattern.h +++ b/src/libs/ifc/xml/vabstractpattern.h @@ -35,9 +35,13 @@ #include enum class Document : char { LiteParse, LitePPParse, FullParse }; -enum class CrossCirclesPoint : char {FirstPoint = 1, SecondPoint = 2}; enum class LabelType : char {NewPatternPiece, NewLabel}; +// Don't touch values!!!. Same values stored in xml. +enum class CrossCirclesPoint : char {FirstPoint = 1, SecondPoint = 2}; +enum class VCrossCurvesPoint : char {HighestPoint = 1, LowestPoint = 2}; +enum class HCrossCurvesPoint : char {LeftPoint = 1, RightPoint = 2}; + class VDataTool; class VContainer; diff --git a/src/libs/vgeometry/vabstractcurve.cpp b/src/libs/vgeometry/vabstractcurve.cpp index 8a4cd9468..704de469b 100644 --- a/src/libs/vgeometry/vabstractcurve.cpp +++ b/src/libs/vgeometry/vabstractcurve.cpp @@ -155,18 +155,7 @@ QPainterPath VAbstractCurve::GetPath(PathDirection direction) const */ QVector VAbstractCurve::IntersectLine(const QLineF &line) const { - QVector points = this->GetPoints(); - QVector intersections; - for ( qint32 i = 0; i < points.count()-1; ++i ) - { - QPointF crosPoint; - QLineF::IntersectType type = line.intersect(QLineF ( points.at(i), points.at(i+1)), &crosPoint); - if ( type == QLineF::BoundedIntersection ) - { - intersections.append(crosPoint); - } - } - return intersections; + return CurveIntersectLine(this->GetPoints(), line); } //--------------------------------------------------------------------------------------------------------------------- @@ -176,6 +165,22 @@ bool VAbstractCurve::IsIntersectLine(const QLineF &line) const return not points.isEmpty(); } +//--------------------------------------------------------------------------------------------------------------------- +QVector VAbstractCurve::CurveIntersectLine(const QVector &points, const QLineF &line) +{ + QVector intersections; + for ( auto i = 0; i < points.count()-1; ++i ) + { + QPointF crosPoint; + const auto type = line.intersect(QLineF(points.at(i), points.at(i+1)), &crosPoint); + if ( type == QLineF::BoundedIntersection ) + { + intersections.append(crosPoint); + } + } + return intersections; +} + //--------------------------------------------------------------------------------------------------------------------- QPainterPath VAbstractCurve::ShowDirection(const QVector &points) const { diff --git a/src/libs/vgeometry/vabstractcurve.h b/src/libs/vgeometry/vabstractcurve.h index ea44f5f7b..adeee8942 100644 --- a/src/libs/vgeometry/vabstractcurve.h +++ b/src/libs/vgeometry/vabstractcurve.h @@ -56,6 +56,8 @@ public: virtual qreal GetStartAngle () const=0; virtual qreal GetEndAngle () const=0; + + static QVector CurveIntersectLine(const QVector &points, const QLineF &line); protected: QPainterPath ShowDirection(const QVector &points) const; private: diff --git a/src/libs/vmisc/def.h b/src/libs/vmisc/def.h index d99a40f0b..9dabf32c7 100644 --- a/src/libs/vmisc/def.h +++ b/src/libs/vmisc/def.h @@ -91,6 +91,7 @@ enum class Tool : ToolVisHolderType LineIntersectAxis, PointOfIntersectionArcs, PointOfIntersectionCircles, + PointOfIntersectionCurves, CurveIntersectAxis, PointOfIntersection, PointFromCircleAndTangent, @@ -121,6 +122,7 @@ enum class Vis : ToolVisHolderType ToolPointOfIntersection, ToolPointOfIntersectionArcs, ToolPointOfIntersectionCircles, + ToolPointOfIntersectionCurves, ToolPointFromCircleAndTangent, ToolPointFromArcAndTangent, ToolShoulderPoint, diff --git a/src/libs/vtools/dialogs/dialogs.pri b/src/libs/vtools/dialogs/dialogs.pri index 97b92e0d5..4116ae451 100644 --- a/src/libs/vtools/dialogs/dialogs.pri +++ b/src/libs/vtools/dialogs/dialogs.pri @@ -33,7 +33,8 @@ HEADERS += \ $$PWD/tools/dialoguniondetails.h \ $$PWD/support/dialogeditwrongformula.h \ $$PWD/support/dialogundo.h \ - $$PWD/tools/dialogtruedarts.h + $$PWD/tools/dialogtruedarts.h \ + $$PWD/tools/dialogpointofintersectioncurves.h SOURCES += \ $$PWD/tools/dialogalongline.cpp \ @@ -66,7 +67,8 @@ SOURCES += \ $$PWD/tools/dialoguniondetails.cpp \ $$PWD/support/dialogeditwrongformula.cpp \ $$PWD/support/dialogundo.cpp \ - $$PWD/tools/dialogtruedarts.cpp + $$PWD/tools/dialogtruedarts.cpp \ + $$PWD/tools/dialogpointofintersectioncurves.cpp FORMS += \ $$PWD/tools/dialogalongline.ui \ @@ -98,4 +100,5 @@ FORMS += \ $$PWD/tools/dialoguniondetails.ui \ $$PWD/support/dialogeditwrongformula.ui \ $$PWD/support/dialogundo.ui \ - $$PWD/tools/dialogtruedarts.ui + $$PWD/tools/dialogtruedarts.ui \ + $$PWD/tools/dialogpointofintersectioncurves.ui diff --git a/src/libs/vtools/dialogs/tooldialogs.h b/src/libs/vtools/dialogs/tooldialogs.h index c87b33155..9a8c4fa68 100644 --- a/src/libs/vtools/dialogs/tooldialogs.h +++ b/src/libs/vtools/dialogs/tooldialogs.h @@ -54,6 +54,7 @@ #include "dialogs/tools/dialogcurveintersectaxis.h" #include "dialogs/tools/dialogpointofintersectionarcs.h" #include "dialogs/tools/dialogpointofintersectioncircles.h" +#include "dialogs/tools/dialogpointofintersectioncurves.h" #include "dialogs/tools/dialogpointfromcircleandtangent.h" #include "dialogs/tools/dialogpointfromarcandtangent.h" #include "dialogs/tools/dialogtruedarts.h" diff --git a/src/libs/vtools/dialogs/tools/dialogalongline.cpp b/src/libs/vtools/dialogs/tools/dialogalongline.cpp index a78a27a58..6d7484818 100644 --- a/src/libs/vtools/dialogs/tools/dialogalongline.cpp +++ b/src/libs/vtools/dialogs/tools/dialogalongline.cpp @@ -171,7 +171,7 @@ void DialogAlongLine::ChosenObject(quint32 id, const SceneObject &type) { if (flagError) { - line->setPoint2Id(id); + line->setObject2Id(id); line->RefreshGeometry(); prepare = true; this->setModal(true); @@ -201,8 +201,8 @@ void DialogAlongLine::SaveData() VisToolAlongLine *line = qobject_cast(vis); SCASSERT(line != nullptr); - line->setPoint1Id(GetFirstPointId()); - line->setPoint2Id(GetSecondPointId()); + line->setObject1Id(GetFirstPointId()); + line->setObject2Id(GetSecondPointId()); line->setLength(formula); line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine())); line->RefreshGeometry(); @@ -226,7 +226,7 @@ void DialogAlongLine::SetSecondPointId(const quint32 &value) VisToolAlongLine *line = qobject_cast(vis); SCASSERT(line != nullptr); - line->setPoint2Id(value); + line->setObject2Id(value); } //--------------------------------------------------------------------------------------------------------------------- @@ -240,7 +240,7 @@ void DialogAlongLine::SetFirstPointId(const quint32 &value) VisToolAlongLine *line = qobject_cast(vis); SCASSERT(line != nullptr); - line->setPoint1Id(value); + line->setObject1Id(value); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/dialogs/tools/dialogarc.cpp b/src/libs/vtools/dialogs/tools/dialogarc.cpp index c3b38859f..58a520b8b 100644 --- a/src/libs/vtools/dialogs/tools/dialogarc.cpp +++ b/src/libs/vtools/dialogs/tools/dialogarc.cpp @@ -125,7 +125,7 @@ DialogArc::~DialogArc() void DialogArc::SetCenter(const quint32 &value) { ChangeCurrentData(ui->comboBoxBasePoint, value); - vis->setPoint1Id(value); + vis->setObject1Id(value); } //--------------------------------------------------------------------------------------------------------------------- @@ -248,7 +248,7 @@ void DialogArc::SaveData() VisToolArc *path = qobject_cast(vis); SCASSERT(path != nullptr); - path->setPoint1Id(GetCenter()); + path->setObject1Id(GetCenter()); path->setRadius(radius); path->setF1(f1); path->setF2(f2); diff --git a/src/libs/vtools/dialogs/tools/dialogarcwithlength.cpp b/src/libs/vtools/dialogs/tools/dialogarcwithlength.cpp index e79923182..cd8cd700e 100644 --- a/src/libs/vtools/dialogs/tools/dialogarcwithlength.cpp +++ b/src/libs/vtools/dialogs/tools/dialogarcwithlength.cpp @@ -104,7 +104,7 @@ quint32 DialogArcWithLength::GetCenter() const void DialogArcWithLength::SetCenter(const quint32 &value) { ChangeCurrentData(ui->comboBoxCenter, value); - vis->setPoint1Id(value); + vis->setObject1Id(value); } //--------------------------------------------------------------------------------------------------------------------- @@ -325,7 +325,7 @@ void DialogArcWithLength::SaveData() VisToolArcWithLength *path = qobject_cast(vis); SCASSERT(path != nullptr); - path->setPoint1Id(GetCenter()); + path->setObject1Id(GetCenter()); path->setRadius(radius); path->setF1(f1); path->setLength(length); diff --git a/src/libs/vtools/dialogs/tools/dialogbisector.cpp b/src/libs/vtools/dialogs/tools/dialogbisector.cpp index 245322ff2..515443f58 100644 --- a/src/libs/vtools/dialogs/tools/dialogbisector.cpp +++ b/src/libs/vtools/dialogs/tools/dialogbisector.cpp @@ -176,7 +176,7 @@ void DialogBisector::ChosenObject(quint32 id, const SceneObject &type) if (SetObject(id, ui->comboBoxSecondPoint, tr("Select third point of angle"))) { number++; - line->setPoint2Id(id); + line->setObject2Id(id); line->RefreshGeometry(); } } @@ -192,7 +192,7 @@ void DialogBisector::ChosenObject(quint32 id, const SceneObject &type) { if (SetObject(id, ui->comboBoxThirdPoint, "")) { - line->setPoint3Id(id); + line->setObject3Id(id); line->RefreshGeometry(); prepare = true; this->setModal(true); @@ -263,7 +263,7 @@ void DialogBisector::SetFirstPointId(const quint32 &value) VisToolBisector *line = qobject_cast(vis); SCASSERT(line != nullptr); - line->setPoint1Id(value); + line->setObject1Id(value); } //--------------------------------------------------------------------------------------------------------------------- @@ -277,7 +277,7 @@ void DialogBisector::SetSecondPointId(const quint32 &value) VisToolBisector *line = qobject_cast(vis); SCASSERT(line != nullptr); - line->setPoint2Id(value); + line->setObject2Id(value); } //--------------------------------------------------------------------------------------------------------------------- @@ -291,7 +291,7 @@ void DialogBisector::SetThirdPointId(const quint32 &value) VisToolBisector *line = qobject_cast(vis); SCASSERT(line != nullptr); - line->setPoint3Id(value); + line->setObject3Id(value); } //--------------------------------------------------------------------------------------------------------------------- @@ -317,9 +317,9 @@ void DialogBisector::SaveData() VisToolBisector *line = qobject_cast(vis); SCASSERT(line != nullptr); - line->setPoint1Id(GetFirstPointId()); - line->setPoint2Id(GetSecondPointId()); - line->setPoint3Id(GetThirdPointId()); + line->setObject1Id(GetFirstPointId()); + line->setObject2Id(GetSecondPointId()); + line->setObject3Id(GetThirdPointId()); line->setLength(formula); line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine())); line->RefreshGeometry(); diff --git a/src/libs/vtools/dialogs/tools/dialogcurveintersectaxis.cpp b/src/libs/vtools/dialogs/tools/dialogcurveintersectaxis.cpp index 2fd9aaec4..f0d690266 100644 --- a/src/libs/vtools/dialogs/tools/dialogcurveintersectaxis.cpp +++ b/src/libs/vtools/dialogs/tools/dialogcurveintersectaxis.cpp @@ -155,7 +155,7 @@ void DialogCurveIntersectAxis::setCurveId(const quint32 &value) VisToolCurveIntersectAxis *line = qobject_cast(vis); SCASSERT(line != nullptr); - line->setPoint1Id(value); + line->setObject1Id(value); } //--------------------------------------------------------------------------------------------------------------------- @@ -288,7 +288,7 @@ void DialogCurveIntersectAxis::SaveData() VisToolCurveIntersectAxis *line = qobject_cast(vis); SCASSERT(line != nullptr); - line->setPoint1Id(getCurveId()); + line->setObject1Id(getCurveId()); line->setAxisPointId(GetBasePointId()); line->SetAngle(formulaAngle); line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine())); diff --git a/src/libs/vtools/dialogs/tools/dialogcutarc.cpp b/src/libs/vtools/dialogs/tools/dialogcutarc.cpp index 6afba27f1..59274be51 100644 --- a/src/libs/vtools/dialogs/tools/dialogcutarc.cpp +++ b/src/libs/vtools/dialogs/tools/dialogcutarc.cpp @@ -145,7 +145,7 @@ void DialogCutArc::SaveData() VisToolCutArc *path = qobject_cast(vis); SCASSERT(path != nullptr); - path->setPoint1Id(getArcId()); + path->setObject1Id(getArcId()); path->setLength(formula); path->RefreshGeometry(); } @@ -168,7 +168,7 @@ void DialogCutArc::setArcId(const quint32 &value) VisToolCutArc *path = qobject_cast(vis); SCASSERT(path != nullptr); - path->setPoint1Id(value); + path->setObject1Id(value); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/dialogs/tools/dialogcutspline.cpp b/src/libs/vtools/dialogs/tools/dialogcutspline.cpp index 85bf03225..7e13d2a08 100644 --- a/src/libs/vtools/dialogs/tools/dialogcutspline.cpp +++ b/src/libs/vtools/dialogs/tools/dialogcutspline.cpp @@ -124,7 +124,7 @@ void DialogCutSpline::setSplineId(const quint32 &value) VisToolCutSpline *path = qobject_cast(vis); SCASSERT(path != nullptr); - path->setPoint1Id(value); + path->setObject1Id(value); } //--------------------------------------------------------------------------------------------------------------------- @@ -180,7 +180,7 @@ void DialogCutSpline::SaveData() VisToolCutSpline *path = qobject_cast(vis); SCASSERT(path != nullptr); - path->setPoint1Id(getSplineId()); + path->setObject1Id(getSplineId()); path->setLength(formula); path->RefreshGeometry(); } diff --git a/src/libs/vtools/dialogs/tools/dialogcutsplinepath.cpp b/src/libs/vtools/dialogs/tools/dialogcutsplinepath.cpp index 7e2e2a737..abb2abaf9 100644 --- a/src/libs/vtools/dialogs/tools/dialogcutsplinepath.cpp +++ b/src/libs/vtools/dialogs/tools/dialogcutsplinepath.cpp @@ -124,7 +124,7 @@ void DialogCutSplinePath::setSplinePathId(const quint32 &value) VisToolCutSplinePath *path = qobject_cast(vis); SCASSERT(path != nullptr); - path->setPoint1Id(value); + path->setObject1Id(value); } //--------------------------------------------------------------------------------------------------------------------- @@ -180,7 +180,7 @@ void DialogCutSplinePath::SaveData() VisToolCutSplinePath *path = qobject_cast(vis); SCASSERT(path != nullptr); - path->setPoint1Id(getSplinePathId()); + path->setObject1Id(getSplinePathId()); path->setLength(formula); path->RefreshGeometry(); } diff --git a/src/libs/vtools/dialogs/tools/dialogendline.cpp b/src/libs/vtools/dialogs/tools/dialogendline.cpp index 479701454..668fc5a92 100644 --- a/src/libs/vtools/dialogs/tools/dialogendline.cpp +++ b/src/libs/vtools/dialogs/tools/dialogendline.cpp @@ -253,7 +253,7 @@ void DialogEndLine::SetBasePointId(const quint32 &value) VisToolEndLine *line = qobject_cast(vis); SCASSERT(line != nullptr); - line->setPoint1Id(value); + line->setObject1Id(value); } //--------------------------------------------------------------------------------------------------------------------- @@ -324,7 +324,7 @@ void DialogEndLine::SaveData() VisToolEndLine *line = qobject_cast(vis); SCASSERT(line != nullptr); - line->setPoint1Id(GetBasePointId()); + line->setObject1Id(GetBasePointId()); line->setLength(formulaLength); line->SetAngle(formulaAngle); line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine())); diff --git a/src/libs/vtools/dialogs/tools/dialogheight.cpp b/src/libs/vtools/dialogs/tools/dialogheight.cpp index 56475eb4c..f90b44d92 100644 --- a/src/libs/vtools/dialogs/tools/dialogheight.cpp +++ b/src/libs/vtools/dialogs/tools/dialogheight.cpp @@ -112,7 +112,7 @@ void DialogHeight::SetBasePointId(const quint32 &value) VisToolHeight *line = qobject_cast(vis); SCASSERT(line != nullptr); - line->setPoint1Id(value); + line->setObject1Id(value); } //--------------------------------------------------------------------------------------------------------------------- @@ -224,7 +224,7 @@ void DialogHeight::SaveData() VisToolHeight *line = qobject_cast(vis); SCASSERT(line != nullptr); - line->setPoint1Id(GetBasePointId()); + line->setObject1Id(GetBasePointId()); line->setLineP1Id(GetP1LineId()); line->setLineP2Id(GetP2LineId()); line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine())); diff --git a/src/libs/vtools/dialogs/tools/dialogline.cpp b/src/libs/vtools/dialogs/tools/dialogline.cpp index 04545ebf2..8c7cf6737 100644 --- a/src/libs/vtools/dialogs/tools/dialogline.cpp +++ b/src/libs/vtools/dialogs/tools/dialogline.cpp @@ -120,7 +120,7 @@ void DialogLine::SetFirstPoint(const quint32 &value) VisToolLine *line = qobject_cast(vis); SCASSERT(line != nullptr); - line->setPoint1Id(value); + line->setObject1Id(value); } //--------------------------------------------------------------------------------------------------------------------- @@ -154,7 +154,7 @@ void DialogLine::SaveData() VisToolLine *line = qobject_cast(vis); SCASSERT(line != nullptr); - line->setPoint1Id(GetFirstPoint()); + line->setObject1Id(GetFirstPoint()); line->setPoint2Id(GetSecondPoint()); line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine())); line->RefreshGeometry(); diff --git a/src/libs/vtools/dialogs/tools/dialoglineintersect.cpp b/src/libs/vtools/dialogs/tools/dialoglineintersect.cpp index cd67c5760..6896c5acf 100644 --- a/src/libs/vtools/dialogs/tools/dialoglineintersect.cpp +++ b/src/libs/vtools/dialogs/tools/dialoglineintersect.cpp @@ -179,7 +179,7 @@ void DialogLineIntersect::SaveData() VisToolLineIntersect *line = qobject_cast(vis); SCASSERT(line != nullptr); - line->setPoint1Id(GetP1Line1()); + line->setObject1Id(GetP1Line1()); line->setLine1P2Id(GetP2Line1()); line->setLine2P1Id(GetP1Line2()); line->setLine2P2Id(GetP2Line2()); @@ -333,7 +333,7 @@ void DialogLineIntersect::SetP1Line1(const quint32 &value) VisToolLineIntersect *line = qobject_cast(vis); SCASSERT(line != nullptr); - line->setPoint1Id(value); + line->setObject1Id(value); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/dialogs/tools/dialoglineintersectaxis.cpp b/src/libs/vtools/dialogs/tools/dialoglineintersectaxis.cpp index 98662d6a7..95600550e 100644 --- a/src/libs/vtools/dialogs/tools/dialoglineintersectaxis.cpp +++ b/src/libs/vtools/dialogs/tools/dialoglineintersectaxis.cpp @@ -164,7 +164,7 @@ void DialogLineIntersectAxis::SetFirstPointId(const quint32 &value) VisToolLineIntersectAxis *line = qobject_cast(vis); SCASSERT(line != nullptr); - line->setPoint1Id(value); + line->setObject1Id(value); } //--------------------------------------------------------------------------------------------------------------------- @@ -356,7 +356,7 @@ void DialogLineIntersectAxis::SaveData() VisToolLineIntersectAxis *line = qobject_cast(vis); SCASSERT(line != nullptr); - line->setPoint1Id(GetFirstPointId()); + line->setObject1Id(GetFirstPointId()); line->setPoint2Id(GetSecondPointId()); line->setAxisPointId(GetBasePointId()); line->SetAngle(formulaAngle); diff --git a/src/libs/vtools/dialogs/tools/dialognormal.cpp b/src/libs/vtools/dialogs/tools/dialognormal.cpp index 1c6940534..ad4de0ce6 100644 --- a/src/libs/vtools/dialogs/tools/dialognormal.cpp +++ b/src/libs/vtools/dialogs/tools/dialognormal.cpp @@ -165,7 +165,7 @@ void DialogNormal::ChosenObject(quint32 id, const SceneObject &type) { if (SetObject(id, ui->comboBoxSecondPoint, "")) { - line->setPoint2Id(id); + line->setObject2Id(id); line->RefreshGeometry(); prepare = true; this->setModal(true); @@ -191,8 +191,8 @@ void DialogNormal::SaveData() VisToolNormal *line = qobject_cast(vis); SCASSERT(line != nullptr); - line->setPoint1Id(GetFirstPointId()); - line->setPoint2Id(GetSecondPointId()); + line->setObject1Id(GetFirstPointId()); + line->setObject2Id(GetSecondPointId()); line->setLength(formula); line->SetAngle(angle); line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine())); @@ -217,7 +217,7 @@ void DialogNormal::SetSecondPointId(const quint32 &value) VisToolNormal *line = qobject_cast(vis); SCASSERT(line != nullptr); - line->setPoint2Id(value); + line->setObject2Id(value); } //--------------------------------------------------------------------------------------------------------------------- @@ -243,7 +243,7 @@ void DialogNormal::SetFirstPointId(const quint32 &value) VisToolNormal *line = qobject_cast(vis); SCASSERT(line != nullptr); - line->setPoint1Id(value); + line->setObject1Id(value); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/dialogs/tools/dialogpointfromarcandtangent.cpp b/src/libs/vtools/dialogs/tools/dialogpointfromarcandtangent.cpp index 5f2b35c31..137a9389d 100644 --- a/src/libs/vtools/dialogs/tools/dialogpointfromarcandtangent.cpp +++ b/src/libs/vtools/dialogs/tools/dialogpointfromarcandtangent.cpp @@ -103,13 +103,13 @@ void DialogPointFromArcAndTangent::SetTangentPointId(const quint32 &value) VisToolPointFromArcAndTangent *point = qobject_cast(vis); SCASSERT(point != nullptr); - point->setPoint1Id(value); + point->setObject1Id(value); } //--------------------------------------------------------------------------------------------------------------------- CrossCirclesPoint DialogPointFromArcAndTangent::GetCrossCirclesPoint() const { - return getCurrentCrossPoint(ui->comboBoxResult); + return getCurrentCrossPoint(ui->comboBoxResult); } //--------------------------------------------------------------------------------------------------------------------- @@ -182,7 +182,7 @@ void DialogPointFromArcAndTangent::SaveData() VisToolPointFromArcAndTangent *point = qobject_cast(vis); SCASSERT(point != nullptr); - point->setPoint1Id(GetTangentPointId()); + point->setObject1Id(GetTangentPointId()); point->setArcId(GetArcId()); point->setCrossPoint(GetCrossCirclesPoint()); point->RefreshGeometry(); diff --git a/src/libs/vtools/dialogs/tools/dialogpointfromcircleandtangent.cpp b/src/libs/vtools/dialogs/tools/dialogpointfromcircleandtangent.cpp index 22605555d..7a7925867 100644 --- a/src/libs/vtools/dialogs/tools/dialogpointfromcircleandtangent.cpp +++ b/src/libs/vtools/dialogs/tools/dialogpointfromcircleandtangent.cpp @@ -112,7 +112,7 @@ void DialogPointFromCircleAndTangent::SetCircleCenterId(const quint32 &value) VisToolPointFromCircleAndTangent *point = qobject_cast(vis); SCASSERT(point != nullptr); - point->setPoint2Id(value); + point->setObject2Id(value); } //--------------------------------------------------------------------------------------------------------------------- @@ -153,13 +153,13 @@ void DialogPointFromCircleAndTangent::SetTangentPointId(const quint32 &value) VisToolPointFromCircleAndTangent *point = qobject_cast(vis); SCASSERT(point != nullptr); - point->setPoint1Id(value); + point->setObject1Id(value); } //--------------------------------------------------------------------------------------------------------------------- CrossCirclesPoint DialogPointFromCircleAndTangent::GetCrossCirclesPoint() const { - return getCurrentCrossPoint(ui->comboBoxResult); + return getCurrentCrossPoint(ui->comboBoxResult); } //--------------------------------------------------------------------------------------------------------------------- @@ -201,7 +201,7 @@ void DialogPointFromCircleAndTangent::ChosenObject(quint32 id, const SceneObject if (SetObject(id, ui->comboBoxCircleCenter, "")) { number = 0; - point->setPoint2Id(id); + point->setObject2Id(id); point->RefreshGeometry(); prepare = true; this->setModal(true); @@ -299,8 +299,8 @@ void DialogPointFromCircleAndTangent::SaveData() VisToolPointFromCircleAndTangent *point = qobject_cast(vis); SCASSERT(point != nullptr); - point->setPoint1Id(GetTangentPointId()); - point->setPoint2Id(GetCircleCenterId()); + point->setObject1Id(GetTangentPointId()); + point->setObject2Id(GetCircleCenterId()); point->setCRadius(radius); point->setCrossPoint(GetCrossCirclesPoint()); point->RefreshGeometry(); diff --git a/src/libs/vtools/dialogs/tools/dialogpointofcontact.cpp b/src/libs/vtools/dialogs/tools/dialogpointofcontact.cpp index 24ba8f55f..7c7ae3cd0 100644 --- a/src/libs/vtools/dialogs/tools/dialogpointofcontact.cpp +++ b/src/libs/vtools/dialogs/tools/dialogpointofcontact.cpp @@ -214,7 +214,7 @@ void DialogPointOfContact::SaveData() VisToolPointOfContact *line = qobject_cast(vis); SCASSERT(line != nullptr); - line->setPoint1Id(GetFirstPoint()); + line->setObject1Id(GetFirstPoint()); line->setLineP2Id(GetSecondPoint()); line->setRadiusId(getCenter()); line->setRadius(radius); @@ -253,7 +253,7 @@ void DialogPointOfContact::SetFirstPoint(const quint32 &value) VisToolPointOfContact *line = qobject_cast(vis); SCASSERT(line != nullptr); - line->setPoint1Id(value); + line->setObject1Id(value); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/dialogs/tools/dialogpointofintersection.cpp b/src/libs/vtools/dialogs/tools/dialogpointofintersection.cpp index cf350c8b4..2e954801c 100644 --- a/src/libs/vtools/dialogs/tools/dialogpointofintersection.cpp +++ b/src/libs/vtools/dialogs/tools/dialogpointofintersection.cpp @@ -110,7 +110,7 @@ void DialogPointOfIntersection::ChosenObject(quint32 id, const SceneObject &type if (SetObject(id, ui->comboBoxFirstPoint, tr("Select point for Y value (horizontal)"))) { number++; - line->setPoint1Id(id); + line->setObject1Id(id); line->RefreshGeometry(); } break; @@ -141,7 +141,7 @@ void DialogPointOfIntersection::SaveData() VisToolPointOfIntersection *line = qobject_cast(vis); SCASSERT(line != nullptr); - line->setPoint1Id(GetFirstPointId()); + line->setObject1Id(GetFirstPointId()); line->setPoint2Id(GetSecondPointId()); line->RefreshGeometry(); } @@ -182,7 +182,7 @@ void DialogPointOfIntersection::SetFirstPointId(const quint32 &value) VisToolPointOfIntersection *line = qobject_cast(vis); SCASSERT(line != nullptr); - line->setPoint1Id(value); + line->setObject1Id(value); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/dialogs/tools/dialogpointofintersectionarcs.cpp b/src/libs/vtools/dialogs/tools/dialogpointofintersectionarcs.cpp index ac04334a2..483951e19 100644 --- a/src/libs/vtools/dialogs/tools/dialogpointofintersectionarcs.cpp +++ b/src/libs/vtools/dialogs/tools/dialogpointofintersectionarcs.cpp @@ -113,7 +113,7 @@ void DialogPointOfIntersectionArcs::SetSecondArcId(const quint32 &value) //--------------------------------------------------------------------------------------------------------------------- CrossCirclesPoint DialogPointOfIntersectionArcs::GetCrossArcPoint() const { - return getCurrentCrossPoint(ui->comboBoxResult); + return getCurrentCrossPoint(ui->comboBoxResult); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/dialogs/tools/dialogpointofintersectioncircles.cpp b/src/libs/vtools/dialogs/tools/dialogpointofintersectioncircles.cpp index c2d00a8f6..053040b43 100644 --- a/src/libs/vtools/dialogs/tools/dialogpointofintersectioncircles.cpp +++ b/src/libs/vtools/dialogs/tools/dialogpointofintersectioncircles.cpp @@ -128,7 +128,7 @@ void DialogPointOfIntersectionCircles::SetFirstCircleCenterId(const quint32 &val VisToolPointOfIntersectionCircles *point = qobject_cast(vis); SCASSERT(point != nullptr); - point->setPoint1Id(value); + point->setObject1Id(value); } //--------------------------------------------------------------------------------------------------------------------- @@ -144,7 +144,7 @@ void DialogPointOfIntersectionCircles::SetSecondCircleCenterId(const quint32 &va VisToolPointOfIntersectionCircles *point = qobject_cast(vis); SCASSERT(point != nullptr); - point->setPoint2Id(value); + point->setObject2Id(value); } //--------------------------------------------------------------------------------------------------------------------- @@ -200,7 +200,7 @@ void DialogPointOfIntersectionCircles::SetSecondCircleRadius(const QString &valu //--------------------------------------------------------------------------------------------------------------------- CrossCirclesPoint DialogPointOfIntersectionCircles::GetCrossCirclesPoint() const { - return getCurrentCrossPoint(ui->comboBoxResult); + return getCurrentCrossPoint(ui->comboBoxResult); } //--------------------------------------------------------------------------------------------------------------------- @@ -242,7 +242,7 @@ void DialogPointOfIntersectionCircles::ChosenObject(quint32 id, const SceneObjec if (SetObject(id, ui->comboBoxCircle2Center, "")) { number = 0; - point->setPoint2Id(id); + point->setObject2Id(id); point->RefreshGeometry(); prepare = true; DialogAccepted(); @@ -389,8 +389,8 @@ void DialogPointOfIntersectionCircles::SaveData() VisToolPointOfIntersectionCircles *point = qobject_cast(vis); SCASSERT(point != nullptr); - point->setPoint1Id(GetFirstCircleCenterId()); - point->setPoint2Id(GetSecondCircleCenterId()); + point->setObject1Id(GetFirstCircleCenterId()); + point->setObject2Id(GetSecondCircleCenterId()); point->setC1Radius(c1Radius); point->setC2Radius(c2Radius); point->setCrossPoint(GetCrossCirclesPoint()); diff --git a/src/libs/vtools/dialogs/tools/dialogpointofintersectioncurves.cpp b/src/libs/vtools/dialogs/tools/dialogpointofintersectioncurves.cpp new file mode 100644 index 000000000..9598a0bac --- /dev/null +++ b/src/libs/vtools/dialogs/tools/dialogpointofintersectioncurves.cpp @@ -0,0 +1,204 @@ +/************************************************************************ + ** + ** @file dialogpointofintersectioncurves.cpp + ** @author Roman Telezhynskyi + ** @date 23 1, 2016 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2016 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ + +#include "dialogpointofintersectioncurves.h" +#include "ui_dialogpointofintersectioncurves.h" +#include "../../visualization/vistoolpointofintersectioncurves.h" + +//--------------------------------------------------------------------------------------------------------------------- +DialogPointOfIntersectionCurves::DialogPointOfIntersectionCurves(const VContainer *data, const quint32 &toolId, + QWidget *parent) + :DialogTool(data, toolId, parent), + ui(new Ui::DialogPointOfIntersectionCurves) +{ + ui->setupUi(this); + +#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0) + ui->lineEditNamePoint->setClearButtonEnabled(true); +#endif + + ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel)); + labelEditNamePoint = ui->labelEditNamePoint; + + InitOkCancelApply(ui); + + FillComboBoxCurves(ui->comboBoxCurve1); + FillComboBoxCurves(ui->comboBoxCurve2); + FillComboBoxVCrossCurvesPoint(ui->comboBoxVCorrection); + FillComboBoxHCrossCurvesPoint(ui->comboBoxHCorrection); + + connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogPointOfIntersectionCurves::NamePointChanged); + + vis = new VisToolPointOfIntersectionCurves(data); +} + +//--------------------------------------------------------------------------------------------------------------------- +DialogPointOfIntersectionCurves::~DialogPointOfIntersectionCurves() +{ + DeleteVisualization(); + delete ui; +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogPointOfIntersectionCurves::SetPointName(const QString &value) +{ + pointName = value; + ui->lineEditNamePoint->setText(pointName); +} + +//--------------------------------------------------------------------------------------------------------------------- +quint32 DialogPointOfIntersectionCurves::GetFirstCurveId() const +{ + return getCurrentObjectId(ui->comboBoxCurve1); +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogPointOfIntersectionCurves::SetFirstCurveId(const quint32 &value) +{ + setCurrentPointId(ui->comboBoxCurve1, value); + + auto point = qobject_cast(vis); + SCASSERT(point != nullptr); + point->setObject1Id(value); +} + +//--------------------------------------------------------------------------------------------------------------------- +quint32 DialogPointOfIntersectionCurves::GetSecondCurveId() const +{ + return getCurrentObjectId(ui->comboBoxCurve2); +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogPointOfIntersectionCurves::SetSecondCurveId(const quint32 &value) +{ + setCurrentPointId(ui->comboBoxCurve2, value); + + auto point = qobject_cast(vis); + SCASSERT(point != nullptr); + point->setObject2Id(value); +} + +//--------------------------------------------------------------------------------------------------------------------- +VCrossCurvesPoint DialogPointOfIntersectionCurves::GetVCrossPoint() const +{ + return getCurrentCrossPoint(ui->comboBoxVCorrection); +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogPointOfIntersectionCurves::SetVCrossPoint(const VCrossCurvesPoint &vP) +{ + auto index = ui->comboBoxVCorrection->findData(static_cast(vP)); + if (index != -1) + { + ui->comboBoxVCorrection->setCurrentIndex(index); + + auto point = qobject_cast(vis); + SCASSERT(point != nullptr); + point->setVCrossPoint(vP); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +HCrossCurvesPoint DialogPointOfIntersectionCurves::GetHCrossPoint() const +{ + return getCurrentCrossPoint(ui->comboBoxHCorrection); +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogPointOfIntersectionCurves::SetHCrossPoint(const HCrossCurvesPoint &hP) +{ + auto index = ui->comboBoxHCorrection->findData(static_cast(hP)); + if (index != -1) + { + ui->comboBoxHCorrection->setCurrentIndex(index); + + auto point = qobject_cast(vis); + SCASSERT(point != nullptr); + point->setHCrossPoint(hP); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogPointOfIntersectionCurves::ChosenObject(quint32 id, const SceneObject &type) +{ + if (prepare == false)// After first choose we ignore all objects + { + if (type == SceneObject::Spline || type == SceneObject::Arc || type == SceneObject::SplinePath) + { + auto point = qobject_cast(vis); + SCASSERT(point != nullptr); + + switch (number) + { + case 0: + if (SetObject(id, ui->comboBoxCurve1, tr("Select second curve"))) + { + number++; + point->VisualMode(id); + } + break; + case 1: + if (getCurrentObjectId(ui->comboBoxCurve1) != id) + { + if (SetObject(id, ui->comboBoxCurve2, "")) + { + number = 0; + point->setObject2Id(id); + point->RefreshGeometry(); + prepare = true; + DialogAccepted(); + } + } + break; + default: + break; + } + } + } +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogPointOfIntersectionCurves::ShowVisualization() +{ + AddVisualization(); +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogPointOfIntersectionCurves::SaveData() +{ + pointName = ui->lineEditNamePoint->text(); + + auto point = qobject_cast(vis); + SCASSERT(point != nullptr); + + point->setObject1Id(GetFirstCurveId()); + point->setObject2Id(GetSecondCurveId()); + point->setVCrossPoint(GetVCrossPoint()); + point->setHCrossPoint(GetHCrossPoint()); + point->RefreshGeometry(); +} diff --git a/src/libs/vtools/dialogs/tools/dialogpointofintersectioncurves.h b/src/libs/vtools/dialogs/tools/dialogpointofintersectioncurves.h new file mode 100644 index 000000000..d70b1bc34 --- /dev/null +++ b/src/libs/vtools/dialogs/tools/dialogpointofintersectioncurves.h @@ -0,0 +1,77 @@ +/************************************************************************ + ** + ** @file dialogpointofintersectioncurves.h + ** @author Roman Telezhynskyi + ** @date 23 1, 2016 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2016 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ + +#ifndef DIALOGPOINTOFINTERSECTIONCURVES_H +#define DIALOGPOINTOFINTERSECTIONCURVES_H + +#include "dialogtool.h" + +namespace Ui { +class DialogPointOfIntersectionCurves; +} + +class DialogPointOfIntersectionCurves : public DialogTool +{ + Q_OBJECT + +public: + explicit DialogPointOfIntersectionCurves(const VContainer *data, const quint32 &toolId, QWidget *parent = 0); + virtual ~DialogPointOfIntersectionCurves() Q_DECL_OVERRIDE; + + void SetPointName(const QString &value); + + quint32 GetFirstCurveId() const; + void SetFirstCurveId(const quint32 &value); + + quint32 GetSecondCurveId() const; + void SetSecondCurveId(const quint32 &value); + + VCrossCurvesPoint GetVCrossPoint() const; + void SetVCrossPoint(const VCrossCurvesPoint &vP); + + HCrossCurvesPoint GetHCrossPoint() const; + void SetHCrossPoint(const HCrossCurvesPoint &hP); + +public slots: + virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE; + +protected: + virtual void ShowVisualization() Q_DECL_OVERRIDE; + + /** + * @brief SaveData Put dialog data in local variables + */ + virtual void SaveData() Q_DECL_OVERRIDE; + +private: + Q_DISABLE_COPY(DialogPointOfIntersectionCurves) + + Ui::DialogPointOfIntersectionCurves *ui; +}; + +#endif // DIALOGPOINTOFINTERSECTIONCURVES_H diff --git a/src/libs/vtools/dialogs/tools/dialogpointofintersectioncurves.ui b/src/libs/vtools/dialogs/tools/dialogpointofintersectioncurves.ui new file mode 100644 index 000000000..2ce932e5d --- /dev/null +++ b/src/libs/vtools/dialogs/tools/dialogpointofintersectioncurves.ui @@ -0,0 +1,162 @@ + + + DialogPointOfIntersectionCurves + + + + 0 + 0 + 285 + 212 + + + + Tool point of intersection curves + + + + :/icon/64x64/icon64x64.png:/icon/64x64/icon64x64.png + + + + + + QFormLayout::ExpandingFieldsGrow + + + + + + 0 + 0 + + + + First curve: + + + + + + + + + + + + + + + 0 + 0 + + + + Second curve: + + + + + + + + + + + 0 + 0 + + + + Point label: + + + + + + + + 0 + 0 + + + + Unique label + + + Choose unique label. + + + + + + + Vertical correction: + + + + + + + + + + Horizontal correction: + + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + + + buttonBox + accepted() + DialogPointOfIntersectionCurves + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DialogPointOfIntersectionCurves + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/src/libs/vtools/dialogs/tools/dialogshoulderpoint.cpp b/src/libs/vtools/dialogs/tools/dialogshoulderpoint.cpp index dd7154bce..2854291af 100644 --- a/src/libs/vtools/dialogs/tools/dialogshoulderpoint.cpp +++ b/src/libs/vtools/dialogs/tools/dialogshoulderpoint.cpp @@ -219,7 +219,7 @@ void DialogShoulderPoint::SaveData() VisToolShoulderPoint *line = qobject_cast(vis); SCASSERT(line != nullptr); - line->setPoint1Id(GetP3()); + line->setObject1Id(GetP3()); line->setLineP1Id(GetP1Line()); line->setLineP2Id(GetP2Line()); line->setLength(formula); @@ -245,7 +245,7 @@ void DialogShoulderPoint::SetP3(const quint32 &value) VisToolShoulderPoint *line = qobject_cast(vis); SCASSERT(line != nullptr); - line->setPoint1Id(value); + line->setObject1Id(value); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/dialogs/tools/dialogspline.cpp b/src/libs/vtools/dialogs/tools/dialogspline.cpp index 9a12ee58c..0af494282 100644 --- a/src/libs/vtools/dialogs/tools/dialogspline.cpp +++ b/src/libs/vtools/dialogs/tools/dialogspline.cpp @@ -119,7 +119,7 @@ void DialogSpline::ChosenObject(quint32 id, const SceneObject &type) ui->spinBoxAngle1->setValue(static_cast(QLineF(p1, p4).angle())); ui->spinBoxAngle2->setValue(static_cast(QLineF(p4, p1).angle())); - path->setPoint4Id(id); + path->setObject4Id(id); path->RefreshGeometry(); prepare = true; DialogAccepted(); @@ -150,8 +150,8 @@ void DialogSpline::SaveData() VisToolSpline *path = qobject_cast(vis); SCASSERT(path != nullptr); - path->setPoint1Id(GetP1()); - path->setPoint4Id(GetP4()); + path->setObject1Id(GetP1()); + path->setObject4Id(GetP4()); path->SetAngle1(angle1); path->SetAngle2(angle2); path->SetKAsm1(kAsm1); @@ -287,7 +287,7 @@ void DialogSpline::SetP4(const quint32 &value) VisToolSpline *path = qobject_cast(vis); SCASSERT(path != nullptr); - path->setPoint4Id(value); + path->setObject4Id(value); } //--------------------------------------------------------------------------------------------------------------------- @@ -301,7 +301,7 @@ void DialogSpline::SetP1(const quint32 &value) VisToolSpline *path = qobject_cast(vis); SCASSERT(path != nullptr); - path->setPoint1Id(value); + path->setObject1Id(value); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/dialogs/tools/dialogtool.cpp b/src/libs/vtools/dialogs/tools/dialogtool.cpp index 4fd22ed37..7e3b768a7 100644 --- a/src/libs/vtools/dialogs/tools/dialogtool.cpp +++ b/src/libs/vtools/dialogs/tools/dialogtool.cpp @@ -227,6 +227,24 @@ void DialogTool::FillComboBoxCrossCirclesPoints(QComboBox *box) const box->addItem(tr("Second point"), QVariant(static_cast(CrossCirclesPoint::SecondPoint))); } +//--------------------------------------------------------------------------------------------------------------------- +void DialogTool::FillComboBoxVCrossCurvesPoint(QComboBox *box) const +{ + SCASSERT(box != nullptr); + + box->addItem(tr("Highest point"), QVariant(static_cast(VCrossCurvesPoint::HighestPoint))); + box->addItem(tr("Lowest point"), QVariant(static_cast(VCrossCurvesPoint::LowestPoint))); +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogTool::FillComboBoxHCrossCurvesPoint(QComboBox *box) const +{ + SCASSERT(box != nullptr); + + box->addItem(tr("Leftmost point"), QVariant(static_cast(HCrossCurvesPoint::LeftPoint))); + box->addItem(tr("Rightmost point"), QVariant(static_cast(HCrossCurvesPoint::RightPoint))); +} + //--------------------------------------------------------------------------------------------------------------------- QString DialogTool::GetComboBoxCurrentData(const QComboBox *box) const { @@ -488,35 +506,6 @@ quint32 DialogTool::getCurrentObjectId(QComboBox *box) const } } -//--------------------------------------------------------------------------------------------------------------------- -CrossCirclesPoint DialogTool::getCurrentCrossPoint(QComboBox *box) const -{ - int value; - bool ok = false; -#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) - value = box->itemData(box->currentIndex()).toInt(&ok); -#else - value = box->currentData().toInt(&ok); -#endif - if (not ok) - { - return CrossCirclesPoint::FirstPoint; - } - - switch(value) - { - case 1: - return CrossCirclesPoint::FirstPoint; - break; - case 2: - return CrossCirclesPoint::SecondPoint; - break; - default: - return CrossCirclesPoint::FirstPoint; - break; - } -} - //--------------------------------------------------------------------------------------------------------------------- bool DialogTool::SetObject(const quint32 &id, QComboBox *box, const QString &toolTip) { diff --git a/src/libs/vtools/dialogs/tools/dialogtool.h b/src/libs/vtools/dialogs/tools/dialogtool.h index a12c8ad6f..5a20405d0 100644 --- a/src/libs/vtools/dialogs/tools/dialogtool.h +++ b/src/libs/vtools/dialogs/tools/dialogtool.h @@ -42,12 +42,12 @@ #include #include #include +#include Q_DECLARE_LOGGING_CATEGORY(vDialog) class QDoubleSpinBox; class QLabel; -class QComboBox; class QListWidgetItem; class VContainer; class QPlainTextEdit; @@ -196,6 +196,8 @@ protected: void FillComboBoxTypeLine(QComboBox *box, const QMap &stylesPics) const; void FillComboBoxLineColors(QComboBox *box)const; void FillComboBoxCrossCirclesPoints(QComboBox *box) const; + void FillComboBoxVCrossCurvesPoint(QComboBox *box) const; + void FillComboBoxHCrossCurvesPoint(QComboBox *box) const; virtual void CheckState(); QString GetComboBoxCurrentData(const QComboBox *box)const; @@ -219,8 +221,10 @@ protected: const quint32 &ch1 = NULL_ID, const quint32 &ch2 = NULL_ID) const; void setCurrentCurveId(QComboBox *box, const quint32 &value) const; - quint32 getCurrentObjectId(QComboBox *box) const; - CrossCirclesPoint getCurrentCrossPoint(QComboBox *box) const; + quint32 getCurrentObjectId(QComboBox *box) const; + + template + T getCurrentCrossPoint(QComboBox *box) const; bool SetObject(const quint32 &id, QComboBox *box, const QString &toolTip); void DeployFormula(QPlainTextEdit *formula, QPushButton *buttonGrowLength, int formulaBaseHeight); @@ -362,4 +366,32 @@ inline void DialogTool::DeleteVisualization() } } +//--------------------------------------------------------------------------------------------------------------------- +template +inline T DialogTool::getCurrentCrossPoint(QComboBox *box) const +{ + int value; + bool ok = false; +#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) + value = box->itemData(box->currentIndex()).toInt(&ok); +#else + value = box->currentData().toInt(&ok); +#endif + if (not ok) + { + return static_cast(1); + } + + switch(value) + { + case 1: + case 2: + return static_cast(value); + break; + default: + return static_cast(1); + break; + } +} + #endif // DIALOGTOOL_H diff --git a/src/libs/vtools/dialogs/tools/dialogtriangle.cpp b/src/libs/vtools/dialogs/tools/dialogtriangle.cpp index c11db6b9e..99bb0941a 100644 --- a/src/libs/vtools/dialogs/tools/dialogtriangle.cpp +++ b/src/libs/vtools/dialogs/tools/dialogtriangle.cpp @@ -109,7 +109,7 @@ void DialogTriangle::ChosenObject(quint32 id, const SceneObject &type) if (SetObject(id, ui->comboBoxAxisP2, tr("Select first point"))) { number++; - line->setPoint2Id(id); + line->setObject2Id(id); line->RefreshGeometry(); } } @@ -167,8 +167,8 @@ void DialogTriangle::SaveData() VisToolTriangle *line = qobject_cast(vis); SCASSERT(line != nullptr); - line->setPoint1Id(GetAxisP1Id()); - line->setPoint2Id(GetAxisP2Id()); + line->setObject1Id(GetAxisP1Id()); + line->setObject2Id(GetAxisP2Id()); line->setHypotenuseP1Id(GetFirstPointId()); line->setHypotenuseP2Id(GetSecondPointId()); line->RefreshGeometry(); @@ -257,7 +257,7 @@ void DialogTriangle::SetAxisP2Id(const quint32 &value) VisToolTriangle *line = qobject_cast(vis); SCASSERT(line != nullptr); - line->setPoint2Id(value); + line->setObject2Id(value); } //--------------------------------------------------------------------------------------------------------------------- @@ -271,7 +271,7 @@ void DialogTriangle::SetAxisP1Id(const quint32 &value) VisToolTriangle *line = qobject_cast(vis); SCASSERT(line != nullptr); - line->setPoint1Id(value); + line->setObject1Id(value); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/dialogs/tools/dialogtruedarts.cpp b/src/libs/vtools/dialogs/tools/dialogtruedarts.cpp index ed9b1318a..259043ff5 100644 --- a/src/libs/vtools/dialogs/tools/dialogtruedarts.cpp +++ b/src/libs/vtools/dialogs/tools/dialogtruedarts.cpp @@ -130,7 +130,7 @@ void DialogTrueDarts::SetFirstBasePointId(const quint32 &value) VisToolTrueDarts *points = qobject_cast(vis); SCASSERT(points != nullptr); - points->setPoint1Id(value); + points->setObject1Id(value); } //--------------------------------------------------------------------------------------------------------------------- @@ -146,7 +146,7 @@ void DialogTrueDarts::SetSecondBasePointId(const quint32 &value) VisToolTrueDarts *points = qobject_cast(vis); SCASSERT(points != nullptr); - points->setPoint2Id(value); + points->setObject2Id(value); } //--------------------------------------------------------------------------------------------------------------------- @@ -230,7 +230,7 @@ void DialogTrueDarts::ChosenObject(quint32 id, const SceneObject &type) if (SetObject(id, ui->comboBoxSecondBasePoint, tr("Select the first dart point"))) { number++; - points->setPoint2Id(id); + points->setObject2Id(id); points->RefreshGeometry(); } } @@ -356,8 +356,8 @@ void DialogTrueDarts::SaveData() VisToolTrueDarts *points = qobject_cast(vis); SCASSERT(points != nullptr); - points->setPoint1Id(GetFirstBasePointId()); - points->setPoint2Id(GetSecondBasePointId()); + points->setObject1Id(GetFirstBasePointId()); + points->setObject2Id(GetSecondBasePointId()); points->setD1PointId(GetFirstDartPointId()); points->setD2PointId(GetSecondDartPointId()); points->setD3PointId(GetThirdDartPointId()); diff --git a/src/libs/vtools/tools/drawTools/drawtools.h b/src/libs/vtools/tools/drawTools/drawtools.h index a81794070..58ba95ad7 100644 --- a/src/libs/vtools/tools/drawTools/drawtools.h +++ b/src/libs/vtools/tools/drawTools/drawtools.h @@ -52,6 +52,7 @@ #include "toolpoint/toolsinglepoint/vtoolpointofintersection.h" #include "toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.h" #include "toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.h" +#include "toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.h" #include "toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.h" #include "toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.h" #include "toolpoint/tooldoublepoint/vtooltruedarts.h" diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp index f4b82d6e6..eb535d26b 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp @@ -355,7 +355,7 @@ void VToolArc::SetVisualization() SCASSERT(visual != nullptr); const VTranslateVars *trVars = qApp->TrVars(); - visual->setPoint1Id(arc->GetCenter().id()); + visual->setObject1Id(arc->GetCenter().id()); visual->setRadius(trVars->FormulaToUser(arc->GetFormulaRadius())); visual->setF1(trVars->FormulaToUser(arc->GetFormulaF1())); visual->setF2(trVars->FormulaToUser(arc->GetFormulaF2())); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp index 3dbfa983a..27c61e84d 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp @@ -311,7 +311,7 @@ void VToolArcWithLength::SetVisualization() SCASSERT(visual != nullptr); const VTranslateVars *trVars = qApp->TrVars(); - visual->setPoint1Id(arc->GetCenter().id()); + visual->setObject1Id(arc->GetCenter().id()); visual->setRadius(trVars->FormulaToUser(arc->GetFormulaRadius())); visual->setF1(trVars->FormulaToUser(arc->GetFormulaF1())); visual->setLength(trVars->FormulaToUser(arc->GetFormulaLength())); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp index 6af2977e2..fa98bcdeb 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp @@ -481,8 +481,8 @@ void VToolSpline::SetVisualization() SCASSERT(visual != nullptr); const QSharedPointer spl = VAbstractTool::data.GeometricObject(id); - visual->setPoint1Id(spl->GetP1().id()); - visual->setPoint4Id(spl->GetP4().id()); + visual->setObject1Id(spl->GetP1().id()); + visual->setObject4Id(spl->GetP4().id()); visual->SetAngle1(spl->GetStartAngle()); visual->SetAngle2(spl->GetEndAngle()); visual->SetKAsm1(spl->GetKasm1()); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.cpp b/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.cpp index abc78d74d..078c57454 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.cpp @@ -360,8 +360,8 @@ void VToolTrueDarts::SetVisualization() VisToolTrueDarts *visual = qobject_cast(vis); SCASSERT(visual != nullptr); - visual->setPoint1Id(baseLineP1Id); - visual->setPoint2Id(baseLineP2Id); + visual->setObject1Id(baseLineP1Id); + visual->setObject2Id(baseLineP2Id); visual->setD1PointId(dartP1Id); visual->setD2PointId(dartP2Id); visual->setD3PointId(dartP3Id); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp index fda07b74b..45d0914c1 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp @@ -241,7 +241,7 @@ void VToolCutArc::SetVisualization() VisToolCutArc *visual = qobject_cast(vis); SCASSERT(visual != nullptr); - visual->setPoint1Id(curveCutId); + visual->setObject1Id(curveCutId); visual->setLength(qApp->TrVars()->FormulaToUser(formula)); visual->RefreshGeometry(); } diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp index fcded45df..63630608b 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp @@ -249,7 +249,7 @@ void VToolCutSpline::SetVisualization() VisToolCutSpline *visual = qobject_cast(vis); SCASSERT(visual != nullptr); - visual->setPoint1Id(curveCutId); + visual->setObject1Id(curveCutId); visual->setLength(qApp->TrVars()->FormulaToUser(formula)); visual->RefreshGeometry(); } diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp index 3b659e0c4..57b631393 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp @@ -293,7 +293,7 @@ void VToolCutSplinePath::SetVisualization() VisToolCutSplinePath *visual = qobject_cast(vis); SCASSERT(visual != nullptr); - visual->setPoint1Id(curveCutId); + visual->setObject1Id(curveCutId); visual->setLength(qApp->TrVars()->FormulaToUser(formula)); visual->RefreshGeometry(); } diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp index 04aadefcf..46bc56705 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp @@ -143,8 +143,8 @@ void VToolAlongLine::SetVisualization() { VisToolAlongLine *visual = qobject_cast(vis); SCASSERT(visual != nullptr) - visual->setPoint1Id(basePointId); - visual->setPoint2Id(secondPointId); + visual->setObject1Id(basePointId); + visual->setObject2Id(secondPointId); visual->setLength(qApp->TrVars()->FormulaToUser(formulaLength)); visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine)); visual->RefreshGeometry(); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.cpp index 04522ac5c..a48ee267a 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.cpp @@ -302,9 +302,9 @@ void VToolBisector::SetVisualization() VisToolBisector *visual = qobject_cast(vis); SCASSERT(visual != nullptr); - visual->setPoint1Id(firstPointId); - visual->setPoint2Id(basePointId); - visual->setPoint3Id(thirdPointId); + visual->setObject1Id(firstPointId); + visual->setObject2Id(basePointId); + visual->setObject3Id(thirdPointId); visual->setLength(qApp->TrVars()->FormulaToUser(formulaLength)); visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine)); visual->RefreshGeometry(); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp index 708f53cc4..42ce90295 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp @@ -278,7 +278,7 @@ void VToolCurveIntersectAxis::SetVisualization() VisToolCurveIntersectAxis *visual = qobject_cast(vis); SCASSERT(visual != nullptr); - visual->setPoint1Id(curveId); + visual->setObject1Id(curveId); visual->setAxisPointId(basePointId); visual->SetAngle(qApp->TrVars()->FormulaToUser(formulaAngle)); visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine)); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.cpp index 55b6546ea..9304fbfd4 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.cpp @@ -240,7 +240,7 @@ void VToolEndLine::SetVisualization() VisToolEndLine *visual = qobject_cast(vis); SCASSERT(visual != nullptr); - visual->setPoint1Id(basePointId); + visual->setObject1Id(basePointId); visual->setLength(qApp->TrVars()->FormulaToUser(formulaLength)); visual->SetAngle(qApp->TrVars()->FormulaToUser(formulaAngle)); visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine)); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp index 4cddc1b2c..d35042c31 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp @@ -246,7 +246,7 @@ void VToolHeight::SetVisualization() VisToolHeight *visual = qobject_cast(vis); SCASSERT(visual != nullptr); - visual->setPoint1Id(basePointId); + visual->setObject1Id(basePointId); visual->setLineP1Id(p1LineId); visual->setLineP2Id(p2LineId); visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine)); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp index 983c748a9..87ceeb2c7 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp @@ -292,7 +292,7 @@ void VToolLineIntersectAxis::SetVisualization() VisToolLineIntersectAxis *visual = qobject_cast(vis); SCASSERT(visual != nullptr); - visual->setPoint1Id(firstPointId); + visual->setObject1Id(firstPointId); visual->setPoint2Id(secondPointId); visual->setAxisPointId(basePointId); visual->SetAngle(qApp->TrVars()->FormulaToUser(formulaAngle)); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.cpp index 63573b65f..8d4d4a929 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.cpp @@ -279,8 +279,8 @@ void VToolNormal::SetVisualization() VisToolNormal *visual = qobject_cast(vis); SCASSERT(visual != nullptr); - visual->setPoint1Id(basePointId); - visual->setPoint2Id(secondPointId); + visual->setObject1Id(basePointId); + visual->setObject2Id(secondPointId); visual->setLength(qApp->TrVars()->FormulaToUser(formulaLength)); visual->SetAngle(angle); visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine)); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp index 984850531..1a6518a92 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp @@ -306,7 +306,7 @@ void VToolShoulderPoint::SetVisualization() VisToolShoulderPoint *visual = qobject_cast(vis); SCASSERT(visual != nullptr); - visual->setPoint1Id(pShoulder); + visual->setObject1Id(pShoulder); visual->setLineP1Id(basePointId); visual->setLineP2Id(p2Line); visual->setLength(qApp->TrVars()->FormulaToUser(formulaLength)); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp index af65be768..83561f1b0 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp @@ -265,7 +265,7 @@ void VToolLineIntersect::SetVisualization() VisToolLineIntersect *visual = qobject_cast(vis); SCASSERT(visual != nullptr); - visual->setPoint1Id(p1Line1); + visual->setObject1Id(p1Line1); visual->setLine1P2Id(p2Line1); visual->setLine2P1Id(p1Line2); visual->setLine2P2Id(p2Line2); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp index 7b8250272..085663357 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp @@ -318,7 +318,7 @@ void VToolPointFromArcAndTangent::SetVisualization() VisToolPointFromArcAndTangent *visual = qobject_cast(vis); SCASSERT(visual != nullptr); - visual->setPoint1Id(tangentPointId); + visual->setObject1Id(tangentPointId); visual->setArcId(arcId); visual->setCrossPoint(crossPoint); visual->RefreshGeometry(); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp index 5f33471e2..ab5ebd65f 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp @@ -305,8 +305,8 @@ void VToolPointFromCircleAndTangent::SetVisualization() VisToolPointFromCircleAndTangent *visual = qobject_cast(vis); SCASSERT(visual != nullptr); - visual->setPoint1Id(tangentPointId); - visual->setPoint2Id(circleCenterId); + visual->setObject1Id(tangentPointId); + visual->setObject2Id(circleCenterId); visual->setCRadius(circleRadius); visual->setCrossPoint(crossPoint); visual->RefreshGeometry(); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp index c4153c436..c8243c27b 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp @@ -318,7 +318,7 @@ void VToolPointOfContact::SetVisualization() VisToolPointOfContact *visual = qobject_cast(vis); SCASSERT(visual != nullptr); - visual->setPoint1Id(firstPointId); + visual->setObject1Id(firstPointId); visual->setLineP2Id(secondPointId); visual->setRadiusId(center); visual->setRadius(qApp->TrVars()->FormulaToUser(arcRadius)); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.cpp index 3350ecc8e..005dda787 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.cpp @@ -220,7 +220,7 @@ void VToolPointOfIntersection::SetVisualization() VisToolPointOfIntersection *visual = qobject_cast(vis); SCASSERT(visual != nullptr); - visual->setPoint1Id(firstPointId); + visual->setObject1Id(firstPointId); visual->setPoint2Id(secondPointId); visual->RefreshGeometry(); } diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp index 950ee3fa1..3307fb002 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp @@ -344,8 +344,8 @@ void VToolPointOfIntersectionCircles::SetVisualization() VisToolPointOfIntersectionCircles *visual = qobject_cast(vis); SCASSERT(visual != nullptr); - visual->setPoint1Id(firstCircleCenterId); - visual->setPoint2Id(secondCircleCenterId); + visual->setObject1Id(firstCircleCenterId); + visual->setObject2Id(secondCircleCenterId); visual->setC1Radius(firstCircleRadius); visual->setC2Radius(secondCircleRadius); visual->setCrossPoint(crossPoint); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp new file mode 100644 index 000000000..bcf1e17ae --- /dev/null +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp @@ -0,0 +1,388 @@ +/************************************************************************ + ** + ** @file vtoolpointofintersectioncurves.cpp + ** @author Roman Telezhynskyi + ** @date 22 1, 2016 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2016 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ + +#include "vtoolpointofintersectioncurves.h" +#include "../../../../dialogs/tools/dialogpointofintersectioncurves.h" +#include "../../../../visualization/vistoolpointofintersectioncurves.h" + +const QString VToolPointOfIntersectionCurves::ToolType = QStringLiteral("pointOfIntersectionCurves"); + +//--------------------------------------------------------------------------------------------------------------------- +VToolPointOfIntersectionCurves::VToolPointOfIntersectionCurves(VAbstractPattern *doc, VContainer *data, + const quint32 &id, const quint32 firstCurveId, + quint32 secondCurveId, VCrossCurvesPoint vCrossPoint, + HCrossCurvesPoint hCrossPoint, const Source &typeCreation, + QGraphicsItem *parent) + :VToolSinglePoint(doc, data, id, parent), + firstCurveId(firstCurveId), + secondCurveId(secondCurveId), + vCrossPoint(vCrossPoint), + hCrossPoint(hCrossPoint) +{ + ToolCreation(typeCreation); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolPointOfIntersectionCurves::setDialog() +{ + SCASSERT(dialog != nullptr); + auto dialogTool = qobject_cast(dialog); + SCASSERT(dialogTool != nullptr); + auto p = VAbstractTool::data.GeometricObject(id); + dialogTool->SetFirstCurveId(firstCurveId); + dialogTool->SetSecondCurveId(secondCurveId); + dialogTool->SetVCrossPoint(vCrossPoint); + dialogTool->SetHCrossPoint(hCrossPoint); + dialogTool->SetPointName(p->name()); +} + +//--------------------------------------------------------------------------------------------------------------------- +VToolPointOfIntersectionCurves *VToolPointOfIntersectionCurves::Create(DialogTool *dialog, VMainGraphicsScene *scene, + VAbstractPattern *doc, VContainer *data) +{ + SCASSERT(dialog != nullptr); + auto dialogTool = qobject_cast(dialog); + SCASSERT(dialogTool != nullptr); + const quint32 firstCurveId = dialogTool->GetFirstCurveId(); + const quint32 secondCurveId = dialogTool->GetSecondCurveId(); + const VCrossCurvesPoint vCrossPoint = dialogTool->GetVCrossPoint(); + const HCrossCurvesPoint hCrossPoint = dialogTool->GetHCrossPoint(); + const QString pointName = dialogTool->getPointName(); + VToolPointOfIntersectionCurves *point = Create(0, pointName, firstCurveId, secondCurveId, vCrossPoint, hCrossPoint, + 5, 10, scene, doc, data, Document::FullParse, Source::FromGui); + if (point != nullptr) + { + point->dialog=dialogTool; + } + return point; +} + +//--------------------------------------------------------------------------------------------------------------------- +VToolPointOfIntersectionCurves *VToolPointOfIntersectionCurves::Create(const quint32 _id, const QString &pointName, + quint32 firstCurveId, quint32 secondCurveId, + VCrossCurvesPoint vCrossPoint, + HCrossCurvesPoint hCrossPoint, const qreal &mx, + const qreal &my, VMainGraphicsScene *scene, + VAbstractPattern *doc, VContainer *data, + const Document &parse, + const Source &typeCreation) +{ + auto curve1 = data->GeometricObject(firstCurveId); + auto curve2 = data->GeometricObject(secondCurveId); + + const QPointF point = VToolPointOfIntersectionCurves::FindPoint(curve1->GetPoints(), curve2->GetPoints(), + vCrossPoint, hCrossPoint); + quint32 id = _id; + if (typeCreation == Source::FromGui) + { + id = data->AddGObject(new VPointF(point, pointName, mx, my)); + } + else + { + data->UpdateGObject(id, new VPointF(point, pointName, mx, my)); + if (parse != Document::FullParse) + { + doc->UpdateToolData(id, data); + } + } + VDrawTool::AddRecord(id, Tool::PointOfIntersectionCurves, doc); + if (parse == Document::FullParse) + { + auto point = new VToolPointOfIntersectionCurves(doc, data, id, firstCurveId, secondCurveId, vCrossPoint, + hCrossPoint, typeCreation); + scene->addItem(point); + connect(point, &VToolPointOfIntersectionCurves::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); + connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolPointOfIntersectionCurves::SetFactor); + connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolPointOfIntersectionCurves::Disable); + connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VToolPointOfIntersectionCurves::EnableToolMove); + doc->AddTool(id, point); + doc->IncrementReferens(firstCurveId); + doc->IncrementReferens(secondCurveId); + return point; + } + return nullptr; +} + +//--------------------------------------------------------------------------------------------------------------------- +QPointF VToolPointOfIntersectionCurves::FindPoint(const QVector &curve1Points, + const QVector &curve2Points, + VCrossCurvesPoint vCrossPoint, HCrossCurvesPoint hCrossPoint) +{ + QVector intersections; + for ( auto i = 0; i < curve1Points.count()-1; ++i ) + { + intersections << VAbstractCurve::CurveIntersectLine(curve2Points, + QLineF(curve1Points.at(i), curve1Points.at(i+1))); + } + + if (intersections.isEmpty()) + { + return QPointF(); + } + + if (intersections.size() == 1) + { + return intersections.at(0); + } + + QVector vIntersections; + if (vCrossPoint == VCrossCurvesPoint::HighestPoint) + { + qreal minY = intersections.at(0).y(); + vIntersections.append(intersections.at(0)); + + for ( auto i = 1; i < intersections.count(); ++i ) + { + const QPointF p = intersections.at(i); + if (p.y() > minY) + { + continue; + } + else if (p.y() < minY) + { + minY = p.y(); + vIntersections.clear(); + vIntersections.append(p); + } + else + { + vIntersections.append(p); + } + } + } + else + { + qreal maxY = intersections.at(0).y(); + vIntersections.append(intersections.at(0)); + + for ( auto i = 1; i < intersections.count(); ++i ) + { + const QPointF p = intersections.at(i); + if (p.y() > maxY) + { + maxY = p.y(); + vIntersections.clear(); + vIntersections.append(p); + } + else if (p.y() < maxY) + { + continue; + } + else + { + vIntersections.append(p); + } + } + } + + if (vIntersections.isEmpty()) + { + return QPointF(); + } + + if (vIntersections.size() == 1) + { + return vIntersections.at(0); + } + + QPointF crossPoint = vIntersections.at(0); + + if (hCrossPoint == HCrossCurvesPoint::RightPoint) + { + qreal maxX = vIntersections.at(0).x(); + + for ( auto i = 1; i < vIntersections.count(); ++i ) + { + const QPointF p = vIntersections.at(i); + if (p.x() > maxX) + { + maxX = p.x(); + crossPoint = p; + } + } + } + else + { + qreal minX = vIntersections.at(0).x(); + + for ( auto i = 1; i < vIntersections.count(); ++i ) + { + const QPointF p = vIntersections.at(i); + if (p.x() < minX) + { + minX = p.x(); + crossPoint = p; + } + } + } + + return crossPoint; +} + +//--------------------------------------------------------------------------------------------------------------------- +quint32 VToolPointOfIntersectionCurves::GetFirstCurveId() const +{ + return firstCurveId; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolPointOfIntersectionCurves::SetFirstCurveId(const quint32 &value) +{ + if (value != NULL_ID) + { + firstCurveId = value; + + auto obj = VAbstractTool::data.GetGObject(id); + SaveOption(obj); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +quint32 VToolPointOfIntersectionCurves::GetSecondCurveId() const +{ + return secondCurveId; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolPointOfIntersectionCurves::SetSecondCurveId(const quint32 &value) +{ + if (value != NULL_ID) + { + secondCurveId = value; + + auto obj = VAbstractTool::data.GetGObject(id); + SaveOption(obj); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +VCrossCurvesPoint VToolPointOfIntersectionCurves::GetVCrossPoint() const +{ + return vCrossPoint; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolPointOfIntersectionCurves::SetVCrossPoint(const VCrossCurvesPoint &value) +{ + vCrossPoint = value; + + auto obj = VAbstractTool::data.GetGObject(id); + SaveOption(obj); +} + +//--------------------------------------------------------------------------------------------------------------------- +HCrossCurvesPoint VToolPointOfIntersectionCurves::GetHCrossPoint() const +{ + return hCrossPoint; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolPointOfIntersectionCurves::SetHCrossPoint(const HCrossCurvesPoint &value) +{ + hCrossPoint = value; + + auto obj = VAbstractTool::data.GetGObject(id); + SaveOption(obj); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolPointOfIntersectionCurves::ShowVisualization(bool show) +{ + ShowToolVisualization(show); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolPointOfIntersectionCurves::RemoveReferens() +{ + doc->DecrementReferens(firstCurveId); + doc->DecrementReferens(secondCurveId); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolPointOfIntersectionCurves::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) +{ + try + { + ContextMenu(this, event); + } + catch(const VExceptionToolWasDeleted &e) + { + Q_UNUSED(e); + return;//Leave this method immediately!!! + } +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolPointOfIntersectionCurves::SaveDialog(QDomElement &domElement) +{ + SCASSERT(dialog != nullptr); + auto dialogTool = qobject_cast(dialog); + SCASSERT(dialogTool != nullptr); + doc->SetAttribute(domElement, AttrName, dialogTool->getPointName()); + doc->SetAttribute(domElement, AttrCurve1, QString().setNum(dialogTool->GetFirstCurveId())); + doc->SetAttribute(domElement, AttrCurve2, QString().setNum(dialogTool->GetSecondCurveId())); + doc->SetAttribute(domElement, AttrVCrossPoint, QString().setNum(static_cast(dialogTool->GetVCrossPoint()))); + doc->SetAttribute(domElement, AttrHCrossPoint, QString().setNum(static_cast(dialogTool->GetHCrossPoint()))); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolPointOfIntersectionCurves::SaveOptions(QDomElement &tag, QSharedPointer &obj) +{ + VToolSinglePoint::SaveOptions(tag, obj); + + doc->SetAttribute(tag, AttrType, ToolType); + doc->SetAttribute(tag, AttrCurve1, firstCurveId); + doc->SetAttribute(tag, AttrCurve2, secondCurveId); + doc->SetAttribute(tag, AttrVCrossPoint, static_cast(vCrossPoint)); + doc->SetAttribute(tag, AttrHCrossPoint, static_cast(hCrossPoint)); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolPointOfIntersectionCurves::ReadToolAttributes(const QDomElement &domElement) +{ + firstCurveId = doc->GetParametrUInt(domElement, AttrCurve1, NULL_ID_STR); + secondCurveId = doc->GetParametrUInt(domElement, AttrCurve2, NULL_ID_STR); + vCrossPoint = static_cast(doc->GetParametrUInt(domElement, AttrVCrossPoint, "1")); + hCrossPoint = static_cast(doc->GetParametrUInt(domElement, AttrHCrossPoint, "1")); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolPointOfIntersectionCurves::SetVisualization() +{ + if (vis != nullptr) + { + auto visual = qobject_cast(vis); + SCASSERT(visual != nullptr); + + visual->setObject1Id(firstCurveId); + visual->setObject2Id(secondCurveId); + visual->setVCrossPoint(vCrossPoint); + visual->setHCrossPoint(hCrossPoint); + visual->RefreshGeometry(); + } +} diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.h new file mode 100644 index 000000000..891ba17a6 --- /dev/null +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.h @@ -0,0 +1,87 @@ +/************************************************************************ + ** + ** @file vtoolpointofintersectioncurves.h + ** @author Roman Telezhynskyi + ** @date 22 1, 2016 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2016 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ + +#ifndef VTOOLPOINTOFINTERSECTIONCURVES_H +#define VTOOLPOINTOFINTERSECTIONCURVES_H + +#include "vtoolsinglepoint.h" + +class VToolPointOfIntersectionCurves : public VToolSinglePoint +{ + Q_OBJECT +public: + explicit VToolPointOfIntersectionCurves(VAbstractPattern *doc, VContainer *data, const quint32 &id, const + quint32 firstCurveId, quint32 secondCurveId, + VCrossCurvesPoint vCrossPoint, HCrossCurvesPoint hCrossPoint, + const Source &typeCreation, QGraphicsItem * parent = nullptr); + virtual void setDialog() Q_DECL_OVERRIDE; + static VToolPointOfIntersectionCurves *Create(DialogTool *dialog, VMainGraphicsScene *scene, + VAbstractPattern *doc, VContainer *data); + static VToolPointOfIntersectionCurves *Create(const quint32 _id, const QString &pointName, + quint32 firstCurveId, quint32 secondCurveId, + VCrossCurvesPoint vCrossPoint, HCrossCurvesPoint hCrossPoint, + const qreal &mx, const qreal &my, VMainGraphicsScene *scene, + VAbstractPattern *doc, VContainer *data, const Document &parse, + const Source &typeCreation); + static QPointF FindPoint(const QVector &curve1Points, const QVector &curve2Points, + VCrossCurvesPoint vCrossPoint, HCrossCurvesPoint hCrossPoint); + static const QString ToolType; + virtual int type() const Q_DECL_OVERRIDE {return Type;} + enum { Type = UserType + static_cast(Tool::PointOfIntersectionCurves) }; + + quint32 GetFirstCurveId() const; + void SetFirstCurveId(const quint32 &value); + + quint32 GetSecondCurveId() const; + void SetSecondCurveId(const quint32 &value); + + VCrossCurvesPoint GetVCrossPoint() const; + void SetVCrossPoint(const VCrossCurvesPoint &value); + + HCrossCurvesPoint GetHCrossPoint() const; + void SetHCrossPoint(const HCrossCurvesPoint &value); + + virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; +protected: + virtual void RemoveReferens() Q_DECL_OVERRIDE; + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; + virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE; + virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_DECL_OVERRIDE; + virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE; + virtual void SetVisualization() Q_DECL_OVERRIDE; +private: + Q_DISABLE_COPY(VToolPointOfIntersectionCurves) + + quint32 firstCurveId; + quint32 secondCurveId; + + VCrossCurvesPoint vCrossPoint; + HCrossCurvesPoint hCrossPoint; +}; + +#endif // VTOOLPOINTOFINTERSECTIONCURVES_H diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp index c210f2265..b35cf5aaa 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp @@ -282,8 +282,8 @@ void VToolTriangle::SetVisualization() VisToolTriangle * visual = qobject_cast(vis); SCASSERT(visual != nullptr); - visual->setPoint1Id(axisP1Id); - visual->setPoint2Id(axisP2Id); + visual->setObject1Id(axisP1Id); + visual->setObject2Id(axisP2Id); visual->setHypotenuseP1Id(firstPointId); visual->setHypotenuseP2Id(secondPointId); visual->RefreshGeometry(); diff --git a/src/libs/vtools/tools/drawTools/vtoolline.cpp b/src/libs/vtools/tools/drawTools/vtoolline.cpp index 59502a302..e853121b2 100644 --- a/src/libs/vtools/tools/drawTools/vtoolline.cpp +++ b/src/libs/vtools/tools/drawTools/vtoolline.cpp @@ -405,7 +405,7 @@ void VToolLine::SetVisualization() VisToolLine *visual = qobject_cast(vis); SCASSERT(visual != nullptr); - visual->setPoint1Id(firstPoint); + visual->setObject1Id(firstPoint); visual->setPoint2Id(secondPoint); visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine)); visual->RefreshGeometry(); diff --git a/src/libs/vtools/tools/tools.pri b/src/libs/vtools/tools/tools.pri index 37d9559d0..67eb8061e 100644 --- a/src/libs/vtools/tools/tools.pri +++ b/src/libs/vtools/tools/tools.pri @@ -46,7 +46,8 @@ HEADERS += \ $$PWD/drawTools/toolcurve/vtoolarcwithlength.h \ $$PWD/drawTools/toolpoint/vabstractpoint.h \ $$PWD/drawTools/toolpoint/tooldoublepoint/vtooldoublepoint.h \ - $$PWD/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.h + $$PWD/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.h SOURCES += \ $$PWD/vtooldetail.cpp \ @@ -90,4 +91,5 @@ SOURCES += \ $$PWD/drawTools/toolcurve/vtoolarcwithlength.cpp \ $$PWD/drawTools/toolpoint/vabstractpoint.cpp \ $$PWD/drawTools/toolpoint/tooldoublepoint/vtooldoublepoint.cpp \ - $$PWD/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.cpp + $$PWD/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp diff --git a/src/libs/vtools/visualization/vistoolalongline.cpp b/src/libs/vtools/visualization/vistoolalongline.cpp index 2085bebb3..4d710b00b 100644 --- a/src/libs/vtools/visualization/vistoolalongline.cpp +++ b/src/libs/vtools/visualization/vistoolalongline.cpp @@ -32,7 +32,7 @@ //--------------------------------------------------------------------------------------------------------------------- VisToolAlongLine::VisToolAlongLine(const VContainer *data, QGraphicsItem *parent) - : VisLine(data, parent), point2Id(NULL_ID), point(nullptr), lineP1(nullptr), lineP2(nullptr), line(nullptr), + : VisLine(data, parent), object2Id(NULL_ID), point(nullptr), lineP1(nullptr), lineP2(nullptr), line(nullptr), length(0) { this->mainColor = Qt::red; @@ -49,9 +49,9 @@ VisToolAlongLine::~VisToolAlongLine() {} //--------------------------------------------------------------------------------------------------------------------- -void VisToolAlongLine::setPoint2Id(const quint32 &value) +void VisToolAlongLine::setObject2Id(const quint32 &value) { - point2Id = value; + object2Id = value; } //--------------------------------------------------------------------------------------------------------------------- @@ -63,18 +63,18 @@ void VisToolAlongLine::setLength(const QString &expression) //--------------------------------------------------------------------------------------------------------------------- void VisToolAlongLine::RefreshGeometry() { - if (point1Id > NULL_ID) + if (object1Id > NULL_ID) { - const QSharedPointer first = Visualization::data->GeometricObject(point1Id); + const QSharedPointer first = Visualization::data->GeometricObject(object1Id); DrawPoint(lineP1, first->toQPointF(), supportColor); - if (point2Id <= NULL_ID) + if (object2Id <= NULL_ID) { DrawLine(line, QLineF(first->toQPointF(), Visualization::scenePos), supportColor); } else { - const QSharedPointer second = Visualization::data->GeometricObject(point2Id); + const QSharedPointer second = Visualization::data->GeometricObject(object2Id); DrawPoint(lineP2, second->toQPointF(), supportColor); DrawLine(line, QLineF(first->toQPointF(), second->toQPointF()), supportColor); diff --git a/src/libs/vtools/visualization/vistoolalongline.h b/src/libs/vtools/visualization/vistoolalongline.h index 2cf6466d1..8bf6129f6 100644 --- a/src/libs/vtools/visualization/vistoolalongline.h +++ b/src/libs/vtools/visualization/vistoolalongline.h @@ -41,13 +41,13 @@ public: virtual ~VisToolAlongLine() Q_DECL_OVERRIDE; virtual void RefreshGeometry() Q_DECL_OVERRIDE; - void setPoint2Id(const quint32 &value); + void setObject2Id(const quint32 &value); void setLength(const QString &expression); virtual int type() const Q_DECL_OVERRIDE {return Type;} enum { Type = UserType + static_cast(Vis::ToolAlongLine)}; private: Q_DISABLE_COPY(VisToolAlongLine) - quint32 point2Id; + quint32 object2Id; QGraphicsEllipseItem *point; QGraphicsEllipseItem *lineP1; QGraphicsEllipseItem *lineP2; diff --git a/src/libs/vtools/visualization/vistoolarc.cpp b/src/libs/vtools/visualization/vistoolarc.cpp index 4b319af2d..6f93aeec8 100644 --- a/src/libs/vtools/visualization/vistoolarc.cpp +++ b/src/libs/vtools/visualization/vistoolarc.cpp @@ -45,9 +45,9 @@ VisToolArc::~VisToolArc() //--------------------------------------------------------------------------------------------------------------------- void VisToolArc::RefreshGeometry() { - if (point1Id > NULL_ID) + if (object1Id > NULL_ID) { - const QSharedPointer first = Visualization::data->GeometricObject(point1Id); + const QSharedPointer first = Visualization::data->GeometricObject(object1Id); DrawPoint(arcCenter, first->toQPointF(), supportColor); if (qFuzzyCompare(1 + radius, 1 + 0) == false && f1 >= 0 && f2 >= 0 && qFuzzyCompare(1 + f1, 1 + f2) == false) diff --git a/src/libs/vtools/visualization/vistoolarcwithlength.cpp b/src/libs/vtools/visualization/vistoolarcwithlength.cpp index a86b5ce5a..caeb445d4 100644 --- a/src/libs/vtools/visualization/vistoolarcwithlength.cpp +++ b/src/libs/vtools/visualization/vistoolarcwithlength.cpp @@ -45,9 +45,9 @@ VisToolArcWithLength::~VisToolArcWithLength() //--------------------------------------------------------------------------------------------------------------------- void VisToolArcWithLength::RefreshGeometry() { - if (point1Id > NULL_ID) + if (object1Id > NULL_ID) { - const QSharedPointer first = Visualization::data->GeometricObject(point1Id); + const QSharedPointer first = Visualization::data->GeometricObject(object1Id); DrawPoint(arcCenter, first->toQPointF(), supportColor); if (qFuzzyCompare(1 + radius, 1 + 0) == false && f1 >= 0 && qFuzzyCompare(1 + length, 1 + 0) == false) diff --git a/src/libs/vtools/visualization/vistoolbisector.cpp b/src/libs/vtools/visualization/vistoolbisector.cpp index 09aecac6f..be0d80e91 100644 --- a/src/libs/vtools/visualization/vistoolbisector.cpp +++ b/src/libs/vtools/visualization/vistoolbisector.cpp @@ -33,7 +33,7 @@ //--------------------------------------------------------------------------------------------------------------------- VisToolBisector::VisToolBisector(const VContainer *data, QGraphicsItem *parent) - :VisLine(data, parent), point2Id(NULL_ID), point3Id(NULL_ID), point(nullptr), line1P1(nullptr), line1P2(nullptr), + :VisLine(data, parent), object2Id(NULL_ID), object3Id(NULL_ID), point(nullptr), line1P1(nullptr), line1P2(nullptr), line1(nullptr), line2P2(nullptr), line2(nullptr), length(0) { line1P1 = InitPoint(supportColor, this); @@ -47,15 +47,15 @@ VisToolBisector::VisToolBisector(const VContainer *data, QGraphicsItem *parent) } //--------------------------------------------------------------------------------------------------------------------- -void VisToolBisector::setPoint2Id(const quint32 &value) +void VisToolBisector::setObject2Id(const quint32 &value) { - point2Id = value; + object2Id = value; } //--------------------------------------------------------------------------------------------------------------------- -void VisToolBisector::setPoint3Id(const quint32 &value) +void VisToolBisector::setObject3Id(const quint32 &value) { - point3Id = value; + object3Id = value; } //--------------------------------------------------------------------------------------------------------------------- @@ -71,29 +71,29 @@ VisToolBisector::~VisToolBisector() //--------------------------------------------------------------------------------------------------------------------- void VisToolBisector::RefreshGeometry() { - if (point1Id > NULL_ID) + if (object1Id > NULL_ID) { - const QSharedPointer first = Visualization::data->GeometricObject(point1Id); + const QSharedPointer first = Visualization::data->GeometricObject(object1Id); DrawPoint(line1P1, first->toQPointF(), supportColor); - if (point2Id <= NULL_ID) + if (object2Id <= NULL_ID) { DrawLine(line1, QLineF(first->toQPointF(), Visualization::scenePos), supportColor); } else { - const QSharedPointer second = Visualization::data->GeometricObject(point2Id); + const QSharedPointer second = Visualization::data->GeometricObject(object2Id); DrawPoint(line1P2, second->toQPointF(), supportColor); DrawLine(line1, QLineF(first->toQPointF(), second->toQPointF()), supportColor); - if (point3Id <= NULL_ID) + if (object3Id <= NULL_ID) { DrawLine(line2, QLineF(second->toQPointF(), Visualization::scenePos), supportColor); } else { - const QSharedPointer third = Visualization::data->GeometricObject(point3Id); + const QSharedPointer third = Visualization::data->GeometricObject(object3Id); DrawPoint(line2P2, third->toQPointF(), supportColor); DrawLine(line2, QLineF(second->toQPointF(), third->toQPointF()), supportColor); diff --git a/src/libs/vtools/visualization/vistoolbisector.h b/src/libs/vtools/visualization/vistoolbisector.h index 0549566cc..429b28de2 100644 --- a/src/libs/vtools/visualization/vistoolbisector.h +++ b/src/libs/vtools/visualization/vistoolbisector.h @@ -39,15 +39,15 @@ public: virtual ~VisToolBisector() Q_DECL_OVERRIDE; virtual void RefreshGeometry() Q_DECL_OVERRIDE; - void setPoint2Id(const quint32 &value); - void setPoint3Id(const quint32 &value); + void setObject2Id(const quint32 &value); + void setObject3Id(const quint32 &value); void setLength(const QString &expression); virtual int type() const Q_DECL_OVERRIDE {return Type;} enum { Type = UserType + static_cast(Vis::ToolBisector)}; private: Q_DISABLE_COPY(VisToolBisector) - quint32 point2Id; - quint32 point3Id; + quint32 object2Id; + quint32 object3Id; QGraphicsEllipseItem *point; QGraphicsEllipseItem *line1P1; QGraphicsEllipseItem *line1P2; diff --git a/src/libs/vtools/visualization/vistoolcurveintersectaxis.cpp b/src/libs/vtools/visualization/vistoolcurveintersectaxis.cpp index a1ff39d48..db7a87bbc 100644 --- a/src/libs/vtools/visualization/vistoolcurveintersectaxis.cpp +++ b/src/libs/vtools/visualization/vistoolcurveintersectaxis.cpp @@ -52,9 +52,9 @@ VisToolCurveIntersectAxis::~VisToolCurveIntersectAxis() //--------------------------------------------------------------------------------------------------------------------- void VisToolCurveIntersectAxis::RefreshGeometry() { - if (point1Id > NULL_ID) + if (object1Id > NULL_ID) { - const QSharedPointer curve = Visualization::data->GeometricObject(point1Id); + const QSharedPointer curve = Visualization::data->GeometricObject(object1Id); DrawPath(visCurve, curve->GetPath(PathDirection::Show), supportColor, Qt::SolidLine, Qt::RoundCap); if (axisPointId > NULL_ID) diff --git a/src/libs/vtools/visualization/vistoolcutarc.cpp b/src/libs/vtools/visualization/vistoolcutarc.cpp index 59e5bc50f..53c023dfe 100644 --- a/src/libs/vtools/visualization/vistoolcutarc.cpp +++ b/src/libs/vtools/visualization/vistoolcutarc.cpp @@ -51,9 +51,9 @@ VisToolCutArc::~VisToolCutArc() //--------------------------------------------------------------------------------------------------------------------- void VisToolCutArc::RefreshGeometry() { - if (point1Id > NULL_ID) + if (object1Id > NULL_ID) { - const QSharedPointer arc = Visualization::data->GeometricObject(point1Id); + const QSharedPointer arc = Visualization::data->GeometricObject(object1Id); DrawPath(this, arc->GetPath(PathDirection::Show), supportColor, Qt::SolidLine, Qt::RoundCap); if (qFuzzyCompare(1 + length, 1 + 0) == false) diff --git a/src/libs/vtools/visualization/vistoolcutspline.cpp b/src/libs/vtools/visualization/vistoolcutspline.cpp index 36cb6709b..a5ac3bb20 100644 --- a/src/libs/vtools/visualization/vistoolcutspline.cpp +++ b/src/libs/vtools/visualization/vistoolcutspline.cpp @@ -51,9 +51,9 @@ VisToolCutSpline::~VisToolCutSpline() //--------------------------------------------------------------------------------------------------------------------- void VisToolCutSpline::RefreshGeometry() { - if (point1Id > NULL_ID) + if (object1Id > NULL_ID) { - const QSharedPointer spl = Visualization::data->GeometricObject(point1Id); + const QSharedPointer spl = Visualization::data->GeometricObject(object1Id); DrawPath(this, spl->GetPath(PathDirection::Show), supportColor, Qt::SolidLine, Qt::RoundCap); if (qFuzzyCompare(1 + length, 1 + 0) == false) diff --git a/src/libs/vtools/visualization/vistoolcutsplinepath.cpp b/src/libs/vtools/visualization/vistoolcutsplinepath.cpp index 2f37f64ac..622c2927f 100644 --- a/src/libs/vtools/visualization/vistoolcutsplinepath.cpp +++ b/src/libs/vtools/visualization/vistoolcutsplinepath.cpp @@ -51,9 +51,9 @@ VisToolCutSplinePath::~VisToolCutSplinePath() //--------------------------------------------------------------------------------------------------------------------- void VisToolCutSplinePath::RefreshGeometry() { - if (point1Id > NULL_ID) + if (object1Id > NULL_ID) { - const QSharedPointer splPath = Visualization::data->GeometricObject(point1Id); + const QSharedPointer splPath = Visualization::data->GeometricObject(object1Id); DrawPath(this, splPath->GetPath(PathDirection::Show), supportColor, Qt::SolidLine, Qt::RoundCap); if (qFuzzyCompare(1 + length, 1 + 0) == false) diff --git a/src/libs/vtools/visualization/vistoolendline.cpp b/src/libs/vtools/visualization/vistoolendline.cpp index a6afe5e21..779bf342e 100644 --- a/src/libs/vtools/visualization/vistoolendline.cpp +++ b/src/libs/vtools/visualization/vistoolendline.cpp @@ -49,7 +49,7 @@ VisToolEndLine::~VisToolEndLine() //--------------------------------------------------------------------------------------------------------------------- void VisToolEndLine::RefreshGeometry() { - const QSharedPointer first = Visualization::data->GeometricObject(point1Id); + const QSharedPointer first = Visualization::data->GeometricObject(object1Id); QLineF line; if (qFuzzyCompare(1 + length, 1 + 0)) { diff --git a/src/libs/vtools/visualization/vistoolheight.cpp b/src/libs/vtools/visualization/vistoolheight.cpp index 100a80beb..aeb9da892 100644 --- a/src/libs/vtools/visualization/vistoolheight.cpp +++ b/src/libs/vtools/visualization/vistoolheight.cpp @@ -51,9 +51,9 @@ VisToolHeight::~VisToolHeight() //--------------------------------------------------------------------------------------------------------------------- void VisToolHeight::RefreshGeometry() { - if (point1Id > NULL_ID) + if (object1Id > NULL_ID) { - const QSharedPointer first = Visualization::data->GeometricObject(point1Id); + const QSharedPointer first = Visualization::data->GeometricObject(object1Id); DrawPoint(base_point, first->toQPointF(), supportColor); if (lineP1Id <= NULL_ID) diff --git a/src/libs/vtools/visualization/vistoolline.cpp b/src/libs/vtools/visualization/vistoolline.cpp index a0975fd47..9a5264087 100644 --- a/src/libs/vtools/visualization/vistoolline.cpp +++ b/src/libs/vtools/visualization/vistoolline.cpp @@ -46,7 +46,7 @@ VisToolLine::~VisToolLine() void VisToolLine::RefreshGeometry() { QLineF line; - const QSharedPointer first = Visualization::data->GeometricObject(point1Id); + const QSharedPointer first = Visualization::data->GeometricObject(object1Id); if (point2Id == NULL_ID) { line = QLineF(first->toQPointF(), Visualization::scenePos); diff --git a/src/libs/vtools/visualization/vistoollineintersect.cpp b/src/libs/vtools/visualization/vistoollineintersect.cpp index 2cc7ded59..251455191 100644 --- a/src/libs/vtools/visualization/vistoollineintersect.cpp +++ b/src/libs/vtools/visualization/vistoollineintersect.cpp @@ -52,9 +52,9 @@ VisToolLineIntersect::~VisToolLineIntersect() //--------------------------------------------------------------------------------------------------------------------- void VisToolLineIntersect::RefreshGeometry() { - if (point1Id > NULL_ID) + if (object1Id > NULL_ID) { - const QSharedPointer first = Visualization::data->GeometricObject(point1Id); + const QSharedPointer first = Visualization::data->GeometricObject(object1Id); DrawPoint(line1P1, first->toQPointF(), supportColor); if (line1P2Id <= NULL_ID) diff --git a/src/libs/vtools/visualization/vistoollineintersectaxis.cpp b/src/libs/vtools/visualization/vistoollineintersectaxis.cpp index 50e592af2..3ba5ccc25 100644 --- a/src/libs/vtools/visualization/vistoollineintersectaxis.cpp +++ b/src/libs/vtools/visualization/vistoollineintersectaxis.cpp @@ -54,9 +54,9 @@ VisToolLineIntersectAxis::~VisToolLineIntersectAxis() //--------------------------------------------------------------------------------------------------------------------- void VisToolLineIntersectAxis::RefreshGeometry() { - if (point1Id > NULL_ID) + if (object1Id > NULL_ID) { - const QSharedPointer first = Visualization::data->GeometricObject(point1Id); + const QSharedPointer first = Visualization::data->GeometricObject(object1Id); DrawPoint(lineP1, first->toQPointF(), supportColor); if (point2Id <= NULL_ID) diff --git a/src/libs/vtools/visualization/vistoolnormal.cpp b/src/libs/vtools/visualization/vistoolnormal.cpp index ed3acae8e..c5c29f8c1 100644 --- a/src/libs/vtools/visualization/vistoolnormal.cpp +++ b/src/libs/vtools/visualization/vistoolnormal.cpp @@ -32,7 +32,7 @@ //--------------------------------------------------------------------------------------------------------------------- VisToolNormal::VisToolNormal(const VContainer *data, QGraphicsItem *parent) - : VisLine(data, parent), point2Id(NULL_ID), point(nullptr), lineP1(nullptr), lineP2(nullptr), line(nullptr), + : VisLine(data, parent), object2Id(NULL_ID), point(nullptr), lineP1(nullptr), lineP2(nullptr), line(nullptr), length(0), angle(0) { this->mainColor = Qt::red; @@ -51,12 +51,12 @@ VisToolNormal::~VisToolNormal() //--------------------------------------------------------------------------------------------------------------------- void VisToolNormal::RefreshGeometry() { - if (point1Id > NULL_ID) + if (object1Id > NULL_ID) { - const QSharedPointer first = Visualization::data->GeometricObject(point1Id); + const QSharedPointer first = Visualization::data->GeometricObject(object1Id); DrawPoint(lineP1, first->toQPointF(), supportColor); - if (point2Id <= NULL_ID) + if (object2Id <= NULL_ID) { QLineF line_mouse(first->toQPointF(), Visualization::scenePos); DrawLine(line, line_mouse, supportColor); @@ -67,7 +67,7 @@ void VisToolNormal::RefreshGeometry() } else { - const QSharedPointer second = Visualization::data->GeometricObject(point2Id); + const QSharedPointer second = Visualization::data->GeometricObject(object2Id); DrawPoint(lineP2, second->toQPointF(), supportColor); QLineF line_mouse(first->toQPointF(), second->toQPointF()); @@ -92,9 +92,9 @@ void VisToolNormal::RefreshGeometry() } //--------------------------------------------------------------------------------------------------------------------- -void VisToolNormal::setPoint2Id(const quint32 &value) +void VisToolNormal::setObject2Id(const quint32 &value) { - point2Id = value; + object2Id = value; } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/visualization/vistoolnormal.h b/src/libs/vtools/visualization/vistoolnormal.h index 5fdf27677..bb2a4e67e 100644 --- a/src/libs/vtools/visualization/vistoolnormal.h +++ b/src/libs/vtools/visualization/vistoolnormal.h @@ -40,7 +40,7 @@ public: virtual void RefreshGeometry() Q_DECL_OVERRIDE; - void setPoint2Id(const quint32 &value); + void setObject2Id(const quint32 &value); void setLength(const QString &expression); qreal GetAngle() const; void SetAngle(const qreal &value); @@ -48,7 +48,7 @@ public: enum { Type = UserType + static_cast(Vis::ToolNormal)}; private: Q_DISABLE_COPY(VisToolNormal) - quint32 point2Id; + quint32 object2Id; QGraphicsEllipseItem *point; QGraphicsEllipseItem *lineP1; QGraphicsEllipseItem *lineP2; diff --git a/src/libs/vtools/visualization/vistoolpointfromarcandtangent.cpp b/src/libs/vtools/visualization/vistoolpointfromarcandtangent.cpp index 2421a5454..162b672e5 100644 --- a/src/libs/vtools/visualization/vistoolpointfromarcandtangent.cpp +++ b/src/libs/vtools/visualization/vistoolpointfromarcandtangent.cpp @@ -50,9 +50,9 @@ VisToolPointFromArcAndTangent::~VisToolPointFromArcAndTangent() //--------------------------------------------------------------------------------------------------------------------- void VisToolPointFromArcAndTangent::RefreshGeometry() { - if (point1Id > NULL_ID)// tangent point + if (object1Id > NULL_ID)// tangent point { - const QSharedPointer tan = Visualization::data->GeometricObject(point1Id); + const QSharedPointer tan = Visualization::data->GeometricObject(object1Id); DrawPoint(tangent, tan->toQPointF(), supportColor); if (arcId > NULL_ID)// circle center diff --git a/src/libs/vtools/visualization/vistoolpointfromcircleandtangent.cpp b/src/libs/vtools/visualization/vistoolpointfromcircleandtangent.cpp index 0206c67f8..9a702d7bd 100644 --- a/src/libs/vtools/visualization/vistoolpointfromcircleandtangent.cpp +++ b/src/libs/vtools/visualization/vistoolpointfromcircleandtangent.cpp @@ -33,7 +33,7 @@ //--------------------------------------------------------------------------------------------------------------------- VisToolPointFromCircleAndTangent::VisToolPointFromCircleAndTangent(const VContainer *data, QGraphicsItem *parent) - : VisLine(data, parent), point2Id(NULL_ID), cRadius(0), crossPoint(CrossCirclesPoint::FirstPoint), + : VisLine(data, parent), object2Id(NULL_ID), cRadius(0), crossPoint(CrossCirclesPoint::FirstPoint), point(nullptr), tangent(nullptr), cCenter(nullptr), cPath(nullptr), tangent2(nullptr) { cPath = InitItem(Qt::darkGreen, this); @@ -50,14 +50,14 @@ VisToolPointFromCircleAndTangent::~VisToolPointFromCircleAndTangent() //--------------------------------------------------------------------------------------------------------------------- void VisToolPointFromCircleAndTangent::RefreshGeometry() { - if (point1Id > NULL_ID)// tangent point + if (object1Id > NULL_ID)// tangent point { - const QSharedPointer tan = Visualization::data->GeometricObject(point1Id); + const QSharedPointer tan = Visualization::data->GeometricObject(object1Id); DrawPoint(tangent, tan->toQPointF(), supportColor); - if (point2Id > NULL_ID)// circle center + if (object2Id > NULL_ID)// circle center { - const QSharedPointer center = Visualization::data->GeometricObject(point2Id); + const QSharedPointer center = Visualization::data->GeometricObject(object2Id); DrawPoint(cCenter, center->toQPointF(), supportColor); if (cRadius > 0) @@ -76,9 +76,9 @@ void VisToolPointFromCircleAndTangent::RefreshGeometry() } //--------------------------------------------------------------------------------------------------------------------- -void VisToolPointFromCircleAndTangent::setPoint2Id(const quint32 &value) +void VisToolPointFromCircleAndTangent::setObject2Id(const quint32 &value) { - point2Id = value; + object2Id = value; } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/visualization/vistoolpointfromcircleandtangent.h b/src/libs/vtools/visualization/vistoolpointfromcircleandtangent.h index 63aecf094..b4ea5f11b 100644 --- a/src/libs/vtools/visualization/vistoolpointfromcircleandtangent.h +++ b/src/libs/vtools/visualization/vistoolpointfromcircleandtangent.h @@ -41,7 +41,7 @@ public: virtual void RefreshGeometry() Q_DECL_OVERRIDE; - void setPoint2Id(const quint32 &value); + void setObject2Id(const quint32 &value); void setCRadius(const QString &value); void setCrossPoint(const CrossCirclesPoint &value); @@ -49,7 +49,7 @@ public: enum { Type = UserType + static_cast(Vis::ToolPointFromCircleAndTangent)}; private: Q_DISABLE_COPY(VisToolPointFromCircleAndTangent) - quint32 point2Id; + quint32 object2Id; qreal cRadius; CrossCirclesPoint crossPoint; QGraphicsEllipseItem *point; diff --git a/src/libs/vtools/visualization/vistoolpointofcontact.cpp b/src/libs/vtools/visualization/vistoolpointofcontact.cpp index 648c0be13..6fb471c4f 100644 --- a/src/libs/vtools/visualization/vistoolpointofcontact.cpp +++ b/src/libs/vtools/visualization/vistoolpointofcontact.cpp @@ -50,9 +50,9 @@ VisToolPointOfContact::~VisToolPointOfContact() //--------------------------------------------------------------------------------------------------------------------- void VisToolPointOfContact::RefreshGeometry() { - if (point1Id > NULL_ID) + if (object1Id > NULL_ID) { - const QSharedPointer first = Visualization::data->GeometricObject(point1Id); + const QSharedPointer first = Visualization::data->GeometricObject(object1Id); DrawPoint(lineP1, first->toQPointF(), supportColor); if (lineP2Id <= NULL_ID) diff --git a/src/libs/vtools/visualization/vistoolpointofintersection.cpp b/src/libs/vtools/visualization/vistoolpointofintersection.cpp index 3c8b26f88..565919b9b 100644 --- a/src/libs/vtools/visualization/vistoolpointofintersection.cpp +++ b/src/libs/vtools/visualization/vistoolpointofintersection.cpp @@ -49,14 +49,14 @@ VisToolPointOfIntersection::~VisToolPointOfIntersection() void VisToolPointOfIntersection::RefreshGeometry() { QLineF axisL1; - if (point1Id <= NULL_ID) + if (object1Id <= NULL_ID) { axisL1 = Axis(Visualization::scenePos, 90); DrawLine(this, axisL1, supportColor, Qt::DashLine); } else { - const QSharedPointer first = Visualization::data->GeometricObject(point1Id); + const QSharedPointer first = Visualization::data->GeometricObject(object1Id); DrawPoint(axisP1, first->toQPointF(), supportColor); axisL1 = Axis(first->toQPointF(), 90); diff --git a/src/libs/vtools/visualization/vistoolpointofintersectioncircles.cpp b/src/libs/vtools/visualization/vistoolpointofintersectioncircles.cpp index 8c4857355..1a624ef6b 100644 --- a/src/libs/vtools/visualization/vistoolpointofintersectioncircles.cpp +++ b/src/libs/vtools/visualization/vistoolpointofintersectioncircles.cpp @@ -33,7 +33,7 @@ //--------------------------------------------------------------------------------------------------------------------- VisToolPointOfIntersectionCircles::VisToolPointOfIntersectionCircles(const VContainer *data, QGraphicsItem *parent) - : VisLine(data, parent), point2Id(NULL_ID), c1Radius(0), c2Radius(0), + : VisLine(data, parent), object2Id(NULL_ID), c1Radius(0), c2Radius(0), crossPoint(CrossCirclesPoint::FirstPoint), point(nullptr), c1Center(nullptr), c2Center(nullptr), c1Path(nullptr), c2Path(nullptr) { @@ -51,14 +51,14 @@ VisToolPointOfIntersectionCircles::~VisToolPointOfIntersectionCircles() //--------------------------------------------------------------------------------------------------------------------- void VisToolPointOfIntersectionCircles::RefreshGeometry() { - if (point1Id > NULL_ID) + if (object1Id > NULL_ID) { - const QSharedPointer first = Visualization::data->GeometricObject(point1Id); + const QSharedPointer first = Visualization::data->GeometricObject(object1Id); DrawPoint(c1Center, first->toQPointF(), supportColor); - if (point2Id > NULL_ID) + if (object2Id > NULL_ID) { - const QSharedPointer second = Visualization::data->GeometricObject(point2Id); + const QSharedPointer second = Visualization::data->GeometricObject(object2Id); DrawPoint(c2Center, second->toQPointF(), supportColor); if (c1Radius > 0 && c2Radius > 0) @@ -84,7 +84,7 @@ void VisToolPointOfIntersectionCircles::VisualMode(const quint32 &id) VMainGraphicsScene *scene = qobject_cast(qApp->getCurrentScene()); SCASSERT(scene != nullptr); - this->point1Id = id; + this->object1Id = id; Visualization::scenePos = scene->getScenePos(); RefreshGeometry(); @@ -92,9 +92,9 @@ void VisToolPointOfIntersectionCircles::VisualMode(const quint32 &id) } //--------------------------------------------------------------------------------------------------------------------- -void VisToolPointOfIntersectionCircles::setPoint2Id(const quint32 &value) +void VisToolPointOfIntersectionCircles::setObject2Id(const quint32 &value) { - point2Id = value; + object2Id = value; } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/visualization/vistoolpointofintersectioncircles.h b/src/libs/vtools/visualization/vistoolpointofintersectioncircles.h index 46a72da98..73d97a0ad 100644 --- a/src/libs/vtools/visualization/vistoolpointofintersectioncircles.h +++ b/src/libs/vtools/visualization/vistoolpointofintersectioncircles.h @@ -42,7 +42,7 @@ public: virtual void RefreshGeometry() Q_DECL_OVERRIDE; virtual void VisualMode(const quint32 &id) Q_DECL_OVERRIDE; - void setPoint2Id(const quint32 &value); + void setObject2Id(const quint32 &value); void setC1Radius(const QString &value); void setC2Radius(const QString &value); void setCrossPoint(const CrossCirclesPoint &value); @@ -51,7 +51,7 @@ public: enum { Type = UserType + static_cast(Vis::ToolPointOfIntersectionCircles)}; private: Q_DISABLE_COPY(VisToolPointOfIntersectionCircles) - quint32 point2Id; + quint32 object2Id; qreal c1Radius; qreal c2Radius; CrossCirclesPoint crossPoint; diff --git a/src/libs/vtools/visualization/vistoolpointofintersectioncurves.cpp b/src/libs/vtools/visualization/vistoolpointofintersectioncurves.cpp new file mode 100644 index 000000000..7dc7f293f --- /dev/null +++ b/src/libs/vtools/visualization/vistoolpointofintersectioncurves.cpp @@ -0,0 +1,94 @@ +/************************************************************************ + ** + ** @file vistoolpointofintersectioncurves.cpp + ** @author Roman Telezhynskyi + ** @date 24 1, 2016 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2016 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ + +#include "vistoolpointofintersectioncurves.h" +#include "../tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.h" + +//--------------------------------------------------------------------------------------------------------------------- +VisToolPointOfIntersectionCurves::VisToolPointOfIntersectionCurves(const VContainer *data, QGraphicsItem *parent) + :VisPath(data, parent), + object2Id(NULL_ID), + vCrossPoint(VCrossCurvesPoint::HighestPoint), + hCrossPoint(HCrossCurvesPoint::LeftPoint), + point(nullptr), + visCurve2(nullptr) +{ + visCurve2 = InitItem(supportColor, this); + point = InitPoint(mainColor, this); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VisToolPointOfIntersectionCurves::RefreshGeometry() +{ + if (object1Id > NULL_ID) + { + auto curve1 = Visualization::data->GeometricObject(object1Id); + DrawPath(this, curve1->GetPath(PathDirection::Show), supportColor, Qt::SolidLine, Qt::RoundCap); + + if (object2Id > NULL_ID) + { + auto curve2 = Visualization::data->GeometricObject(object2Id); + DrawPath(visCurve2, curve2->GetPath(PathDirection::Show), supportColor, Qt::SolidLine, Qt::RoundCap); + + auto p = VToolPointOfIntersectionCurves::FindPoint(curve1->GetPoints(), curve2->GetPoints(), vCrossPoint, + hCrossPoint); + DrawPoint(point, p, mainColor); + } + } +} + +//--------------------------------------------------------------------------------------------------------------------- +void VisToolPointOfIntersectionCurves::VisualMode(const quint32 &id) +{ + auto scene = qobject_cast(qApp->getCurrentScene()); + SCASSERT(scene != nullptr); + + this->object1Id = id; + Visualization::scenePos = scene->getScenePos(); + RefreshGeometry(); + + AddOnScene(); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VisToolPointOfIntersectionCurves::setObject2Id(const quint32 &value) +{ + object2Id = value; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VisToolPointOfIntersectionCurves::setVCrossPoint(const VCrossCurvesPoint &value) +{ + vCrossPoint = value; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VisToolPointOfIntersectionCurves::setHCrossPoint(const HCrossCurvesPoint &value) +{ + hCrossPoint = value; +} diff --git a/src/libs/vtools/visualization/vistoolpointofintersectioncurves.h b/src/libs/vtools/visualization/vistoolpointofintersectioncurves.h new file mode 100644 index 000000000..c97fc550a --- /dev/null +++ b/src/libs/vtools/visualization/vistoolpointofintersectioncurves.h @@ -0,0 +1,62 @@ +/************************************************************************ + ** + ** @file vistoolpointofintersectioncurves.h + ** @author Roman Telezhynskyi + ** @date 24 1, 2016 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2016 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ + +#ifndef VISTOOLPOINTOFINTERSECTIONCURVES_H +#define VISTOOLPOINTOFINTERSECTIONCURVES_H + +#include "vispath.h" +#include "../ifc/xml/vabstractpattern.h" + +class VisToolPointOfIntersectionCurves : public VisPath +{ + Q_OBJECT +public: + explicit VisToolPointOfIntersectionCurves(const VContainer *data, QGraphicsItem *parent = 0); + virtual ~VisToolPointOfIntersectionCurves() Q_DECL_OVERRIDE {} + + virtual void RefreshGeometry() Q_DECL_OVERRIDE; + virtual void VisualMode(const quint32 &id) Q_DECL_OVERRIDE; + + void setObject2Id(const quint32 &value); + void setVCrossPoint(const VCrossCurvesPoint &value); + void setHCrossPoint(const HCrossCurvesPoint &value); + + virtual int type() const Q_DECL_OVERRIDE {return Type;} + enum { Type = UserType + static_cast(Vis::ToolPointOfIntersectionCurves)}; +private: + Q_DISABLE_COPY(VisToolPointOfIntersectionCurves) + quint32 object2Id; + VCrossCurvesPoint vCrossPoint; + HCrossCurvesPoint hCrossPoint; + + QGraphicsEllipseItem *point; + QGraphicsPathItem *visCurve2; + +}; + +#endif // VISTOOLPOINTOFINTERSECTIONCURVES_H diff --git a/src/libs/vtools/visualization/vistoolshoulderpoint.cpp b/src/libs/vtools/visualization/vistoolshoulderpoint.cpp index 2444c3ba0..bdee934e3 100644 --- a/src/libs/vtools/visualization/vistoolshoulderpoint.cpp +++ b/src/libs/vtools/visualization/vistoolshoulderpoint.cpp @@ -53,9 +53,9 @@ VisToolShoulderPoint::~VisToolShoulderPoint() //--------------------------------------------------------------------------------------------------------------------- void VisToolShoulderPoint::RefreshGeometry() { - if (point1Id > NULL_ID) + if (object1Id > NULL_ID) { - const QSharedPointer first = Visualization::data->GeometricObject(point1Id); + const QSharedPointer first = Visualization::data->GeometricObject(object1Id); DrawPoint(line1P1, first->toQPointF(), supportColor); if (lineP1Id <= NULL_ID) diff --git a/src/libs/vtools/visualization/vistoolspline.cpp b/src/libs/vtools/visualization/vistoolspline.cpp index 5c80ffeaf..229c959ed 100644 --- a/src/libs/vtools/visualization/vistoolspline.cpp +++ b/src/libs/vtools/visualization/vistoolspline.cpp @@ -35,7 +35,7 @@ const int EMPTY_ANGLE = -1; //--------------------------------------------------------------------------------------------------------------------- VisToolSpline::VisToolSpline(const VContainer *data, QGraphicsItem *parent) - : VisPath(data, parent), point4Id(NULL_ID), lineP1(nullptr), lineP4(nullptr), line(nullptr), angle1(EMPTY_ANGLE), + : VisPath(data, parent), object4Id(NULL_ID), lineP1(nullptr), lineP4(nullptr), line(nullptr), angle1(EMPTY_ANGLE), angle2(EMPTY_ANGLE), kAsm1(1), kAsm2(1), kCurve(1) { lineP1 = InitPoint(supportColor, this); @@ -50,18 +50,18 @@ VisToolSpline::~VisToolSpline() //--------------------------------------------------------------------------------------------------------------------- void VisToolSpline::RefreshGeometry() { - if (point1Id > NULL_ID) + if (object1Id > NULL_ID) { - const QSharedPointer first = Visualization::data->GeometricObject(point1Id); + const QSharedPointer first = Visualization::data->GeometricObject(object1Id); DrawPoint(lineP1, first->toQPointF(), supportColor); - if (point4Id <= NULL_ID) + if (object4Id <= NULL_ID) { DrawLine(line, QLineF(first->toQPointF(), Visualization::scenePos), mainColor); } else { - const QSharedPointer second = Visualization::data->GeometricObject(point4Id); + const QSharedPointer second = Visualization::data->GeometricObject(object4Id); DrawPoint(lineP4, second->toQPointF(), supportColor); if (qFuzzyCompare(angle1, EMPTY_ANGLE) || qFuzzyCompare(angle2, EMPTY_ANGLE)) @@ -78,9 +78,9 @@ void VisToolSpline::RefreshGeometry() } //--------------------------------------------------------------------------------------------------------------------- -void VisToolSpline::setPoint4Id(const quint32 &value) +void VisToolSpline::setObject4Id(const quint32 &value) { - point4Id = value; + object4Id = value; } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/visualization/vistoolspline.h b/src/libs/vtools/visualization/vistoolspline.h index 4255f5fa6..fb6f780d3 100644 --- a/src/libs/vtools/visualization/vistoolspline.h +++ b/src/libs/vtools/visualization/vistoolspline.h @@ -40,7 +40,7 @@ public: virtual void RefreshGeometry() Q_DECL_OVERRIDE; - void setPoint4Id(const quint32 &value); + void setObject4Id(const quint32 &value); void SetAngle1(const qreal &value); void SetAngle2(const qreal &value); void SetKAsm1(const qreal &value); @@ -51,7 +51,7 @@ public: enum { Type = UserType + static_cast(Vis::ToolSpline)}; protected: Q_DISABLE_COPY(VisToolSpline) - quint32 point4Id; + quint32 object4Id; QGraphicsEllipseItem *lineP1; QGraphicsEllipseItem *lineP4; QGraphicsLineItem *line; diff --git a/src/libs/vtools/visualization/vistooltriangle.cpp b/src/libs/vtools/visualization/vistooltriangle.cpp index 7de51bd49..7f84f8e41 100644 --- a/src/libs/vtools/visualization/vistooltriangle.cpp +++ b/src/libs/vtools/visualization/vistooltriangle.cpp @@ -34,7 +34,7 @@ //--------------------------------------------------------------------------------------------------------------------- VisToolTriangle::VisToolTriangle(const VContainer *data, QGraphicsItem *parent) - :VisLine(data, parent), point2Id(NULL_ID), hypotenuseP1Id(NULL_ID), hypotenuseP2Id(NULL_ID), point(nullptr), + :VisLine(data, parent), object2Id(NULL_ID), hypotenuseP1Id(NULL_ID), hypotenuseP2Id(NULL_ID), point(nullptr), axisP1(nullptr), axisP2(nullptr), axis(nullptr), hypotenuseP1(nullptr), hypotenuseP2(nullptr), foot1(nullptr), foot2(nullptr) { @@ -56,18 +56,18 @@ VisToolTriangle::~VisToolTriangle() //--------------------------------------------------------------------------------------------------------------------- void VisToolTriangle::RefreshGeometry() { - if (point1Id > NULL_ID) + if (object1Id > NULL_ID) { - const QSharedPointer first = Visualization::data->GeometricObject(point1Id); + const QSharedPointer first = Visualization::data->GeometricObject(object1Id); DrawPoint(axisP1, first->toQPointF(), supportColor); - if (point2Id <= NULL_ID) + if (object2Id <= NULL_ID) { DrawAimedAxis(axis, QLineF(first->toQPointF(), Visualization::scenePos), supportColor); } else { - const QSharedPointer second = Visualization::data->GeometricObject(point2Id); + const QSharedPointer second = Visualization::data->GeometricObject(object2Id); DrawPoint(axisP2, second->toQPointF(), supportColor); DrawAimedAxis(axis, QLineF(first->toQPointF(), second->toQPointF()), supportColor); @@ -112,9 +112,9 @@ void VisToolTriangle::RefreshGeometry() } //--------------------------------------------------------------------------------------------------------------------- -void VisToolTriangle::setPoint2Id(const quint32 &value) +void VisToolTriangle::setObject2Id(const quint32 &value) { - point2Id = value; + object2Id = value; } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/visualization/vistooltriangle.h b/src/libs/vtools/visualization/vistooltriangle.h index a97d891a2..8e0e4de45 100644 --- a/src/libs/vtools/visualization/vistooltriangle.h +++ b/src/libs/vtools/visualization/vistooltriangle.h @@ -40,7 +40,7 @@ public: virtual void RefreshGeometry() Q_DECL_OVERRIDE; - void setPoint2Id(const quint32 &value); + void setObject2Id(const quint32 &value); void setHypotenuseP1Id(const quint32 &value); void setHypotenuseP2Id(const quint32 &value); @@ -48,7 +48,7 @@ public: enum { Type = UserType + static_cast(Vis::ToolTriangle)}; private: Q_DISABLE_COPY(VisToolTriangle) - quint32 point2Id;//axis second point + quint32 object2Id;//axis second point quint32 hypotenuseP1Id; quint32 hypotenuseP2Id; QGraphicsEllipseItem *point; diff --git a/src/libs/vtools/visualization/vistooltruedarts.cpp b/src/libs/vtools/visualization/vistooltruedarts.cpp index ea52dd767..f0072ad3c 100644 --- a/src/libs/vtools/visualization/vistooltruedarts.cpp +++ b/src/libs/vtools/visualization/vistooltruedarts.cpp @@ -72,9 +72,9 @@ VisToolTrueDarts::~VisToolTrueDarts() //--------------------------------------------------------------------------------------------------------------------- void VisToolTrueDarts::RefreshGeometry() { - if (point1Id > NULL_ID) + if (object1Id > NULL_ID) { - const QSharedPointer blP1 = Visualization::data->GeometricObject(point1Id); + const QSharedPointer blP1 = Visualization::data->GeometricObject(object1Id); DrawPoint(baseLineP1, blP1->toQPointF(), supportColor); if (baseLineP2Id <= NULL_ID) @@ -135,7 +135,7 @@ void VisToolTrueDarts::RefreshGeometry() } //--------------------------------------------------------------------------------------------------------------------- -void VisToolTrueDarts::setPoint2Id(const quint32 &value) +void VisToolTrueDarts::setObject2Id(const quint32 &value) { baseLineP2Id = value; } diff --git a/src/libs/vtools/visualization/vistooltruedarts.h b/src/libs/vtools/visualization/vistooltruedarts.h index 4eaaba3da..4843472ce 100644 --- a/src/libs/vtools/visualization/vistooltruedarts.h +++ b/src/libs/vtools/visualization/vistooltruedarts.h @@ -40,7 +40,7 @@ public: virtual void RefreshGeometry() Q_DECL_OVERRIDE; - void setPoint2Id(const quint32 &value); + void setObject2Id(const quint32 &value); void setD1PointId(const quint32 &value); void setD2PointId(const quint32 &value); void setD3PointId(const quint32 &value); diff --git a/src/libs/vtools/visualization/visualization.cpp b/src/libs/vtools/visualization/visualization.cpp index 18203df56..021fe639a 100644 --- a/src/libs/vtools/visualization/visualization.cpp +++ b/src/libs/vtools/visualization/visualization.cpp @@ -38,7 +38,7 @@ Q_LOGGING_CATEGORY(vVis, "v.visualization") //--------------------------------------------------------------------------------------------------------------------- Visualization::Visualization(const VContainer *data) :QObject(), data(data), factor(VDrawTool::factor), scenePos(QPointF()), - mainColor(Qt::red), supportColor(Qt::magenta), lineStyle(Qt::SolidLine), point1Id(NULL_ID), toolTip(QString()) + mainColor(Qt::red), supportColor(Qt::magenta), lineStyle(Qt::SolidLine), object1Id(NULL_ID), toolTip(QString()) {} //--------------------------------------------------------------------------------------------------------------------- @@ -46,9 +46,9 @@ Visualization::~Visualization() {} //--------------------------------------------------------------------------------------------------------------------- -void Visualization::setPoint1Id(const quint32 &value) +void Visualization::setObject1Id(const quint32 &value) { - point1Id = value; + object1Id = value; } //--------------------------------------------------------------------------------------------------------------------- @@ -71,7 +71,7 @@ void Visualization::VisualMode(const quint32 &pointId) VMainGraphicsScene *scene = qobject_cast(qApp->getCurrentScene()); SCASSERT(scene != nullptr); - this->point1Id = pointId; + this->object1Id = pointId; this->scenePos = scene->getScenePos(); RefreshGeometry(); diff --git a/src/libs/vtools/visualization/visualization.h b/src/libs/vtools/visualization/visualization.h index ad3dc7b5e..a43f0bd36 100644 --- a/src/libs/vtools/visualization/visualization.h +++ b/src/libs/vtools/visualization/visualization.h @@ -48,7 +48,7 @@ public: virtual void RefreshGeometry()=0; - void setPoint1Id(const quint32 &value); + void setObject1Id(const quint32 &value); void setLineStyle(const Qt::PenStyle &value); void setScenePos(const QPointF &value); virtual void VisualMode(const quint32 &pointId); @@ -65,7 +65,7 @@ protected: QColor mainColor; QColor supportColor; Qt::PenStyle lineStyle; - quint32 point1Id; + quint32 object1Id; QString toolTip; virtual void InitPen()=0; diff --git a/src/libs/vtools/visualization/visualization.pri b/src/libs/vtools/visualization/visualization.pri index 23105fd73..bfb09ba0c 100644 --- a/src/libs/vtools/visualization/visualization.pri +++ b/src/libs/vtools/visualization/visualization.pri @@ -29,7 +29,8 @@ HEADERS += \ $$PWD/vistoolpointfromcircleandtangent.h \ $$PWD/vistoolpointfromarcandtangent.h \ $$PWD/vistoolarcwithlength.h \ - visualization/vistooltruedarts.h + $$PWD/vistooltruedarts.h \ + $$PWD/vistoolpointofintersectioncurves.h SOURCES += \ $$PWD/visline.cpp \ @@ -59,4 +60,5 @@ SOURCES += \ $$PWD/vistoolpointfromcircleandtangent.cpp \ $$PWD/vistoolpointfromarcandtangent.cpp \ $$PWD/vistoolarcwithlength.cpp \ - visualization/vistooltruedarts.cpp + $$PWD/vistooltruedarts.cpp \ + $$PWD/vistoolpointofintersectioncurves.cpp From 4bb612e20e5bfa8afcb38b546eaa614c4a2646fd Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sun, 24 Jan 2016 19:04:22 +0200 Subject: [PATCH 03/11] Show origins when add first pattern piece. --HG-- branch : feature --- src/app/valentina/mainwindow.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index 1498f2826..e79809838 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -217,6 +217,13 @@ void MainWindow::AddPP(const QString &PPName) qCDebug(vMainWindow, "Error creating pattern piece with the name %s.", qUtf8Printable(PPName)); return; } + + if (comboBoxDraws->count() == 0) + { + sceneDraw->InitOrigins(); + sceneDetails->InitOrigins(); + } + comboBoxDraws->blockSignals(true); comboBoxDraws->addItem(PPName); From 1f624ec69b67531a59d5687f52abdfae06e64745 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 25 Jan 2016 11:04:42 +0200 Subject: [PATCH 04/11] Enable actionSave even file was not saved before. --HG-- branch : feature --- src/app/valentina/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index e79809838..a7f3f7165 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -2524,7 +2524,7 @@ void MainWindow::SetEnableWidgets(bool enable) { comboBoxDraws->setEnabled(enable); ui->actionOptionDraw->setEnabled(enable); - if (enable && not curFile.isEmpty() && not patternReadOnly) + if (enable && not patternReadOnly) { ui->actionSave->setEnabled(enable); } From 11aae952cb4c3e713f31a2de95803ce378366027 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 25 Jan 2016 11:13:41 +0200 Subject: [PATCH 05/11] Show 'read only' in title of window if a pattern file in read only state. --HG-- branch : feature --- src/app/valentina/mainwindow.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index a7f3f7165..643bf4511 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -4164,7 +4164,7 @@ QString MainWindow::GetPatternFileName() { shownName = StrippedName(curFile); } - shownName += "[*]"; + shownName += QLatin1Literal("[*]"); return shownName; } @@ -4177,15 +4177,15 @@ QString MainWindow::GetMeasurementFileName() } else { - QString shownName = " ["; + QString shownName(" ["); shownName += StrippedName(AbsoluteMPath(curFile, doc->MPath())); if(mChanges) { - shownName += "*"; + shownName += QLatin1Literal("*"); } - shownName += "]"; + shownName += QLatin1Literal("]"); return shownName; } } @@ -4193,7 +4193,14 @@ QString MainWindow::GetMeasurementFileName() //--------------------------------------------------------------------------------------------------------------------- void MainWindow::UpdateWindowTitle() { - setWindowTitle(GetPatternFileName()+GetMeasurementFileName()); + if (not patternReadOnly) + { + setWindowTitle(GetPatternFileName()+GetMeasurementFileName()); + } + else + { + setWindowTitle(GetPatternFileName()+GetMeasurementFileName() + " " + tr("(read only)")); + } setWindowFilePath(curFile); #if defined(Q_OS_MAC) From 387c33e9e049d6d4d0130d11dbe1836cbdf6eb16 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 25 Jan 2016 15:49:37 +0200 Subject: [PATCH 06/11] Refactoring. Smooth scrolling. --HG-- branch : feature --- src/libs/vwidgets/vmaingraphicsview.cpp | 35 ++++++++++++++++--------- src/libs/vwidgets/vmaingraphicsview.h | 5 +++- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/src/libs/vwidgets/vmaingraphicsview.cpp b/src/libs/vwidgets/vmaingraphicsview.cpp index da457277c..084fef809 100644 --- a/src/libs/vwidgets/vmaingraphicsview.cpp +++ b/src/libs/vwidgets/vmaingraphicsview.cpp @@ -39,15 +39,18 @@ #include #include +const int GraphicsViewZoom::duration = 300; +const int GraphicsViewZoom::updateInterval = 40; + //--------------------------------------------------------------------------------------------------------------------- GraphicsViewZoom::GraphicsViewZoom(QGraphicsView* view) : QObject(view), _view(view), _modifiers(Qt::ControlModifier), _zoom_factor_base(1.0015), - target_scene_pos(QPointF()), target_viewport_pos(QPointF()), anim(nullptr), _numScheduledScalings(0) + target_scene_pos(QPointF()), target_viewport_pos(QPointF()), anim(nullptr), _numScheduledScrollings(0) { _view->viewport()->installEventFilter(this); _view->setMouseTracking(true); - anim = new QTimeLine(300, this); - anim->setUpdateInterval(20); + anim = new QTimeLine(duration, this); + anim->setUpdateInterval(updateInterval); connect(anim, &QTimeLine::valueChanged, this, &GraphicsViewZoom::scrollingTime, Qt::UniqueConnection); connect(anim, &QTimeLine::finished, this, &GraphicsViewZoom::animFinished, Qt::UniqueConnection); } @@ -91,9 +94,17 @@ void GraphicsViewZoom::set_zoom_factor_base(double value) void GraphicsViewZoom::scrollingTime(qreal x) { Q_UNUSED(x); + // Try to adapt scrolling to speed of rotating mouse wheel and scale factor + // Value of _numScheduledScrollings is too short, so we scale the value - qreal scroll = _view->verticalScrollBar()->pageStep()/60; - if (_numScheduledScalings > 0) + qreal scroll = (qAbs(_numScheduledScrollings)*(10 + 10/_view->transform().m22()))/(duration/updateInterval); + + if (qAbs(scroll) < 1) + { + scroll = 1; + } + + if (_numScheduledScrollings > 0) { scroll = scroll * -1; } @@ -103,7 +114,7 @@ void GraphicsViewZoom::scrollingTime(qreal x) //--------------------------------------------------------------------------------------------------------------------- void GraphicsViewZoom::animFinished() { - _numScheduledScalings > 0 ? _numScheduledScalings-- : _numScheduledScalings++; + _numScheduledScrollings = 0; anim->stop(); /* @@ -147,8 +158,8 @@ bool GraphicsViewZoom::eventFilter(QObject *object, QEvent *event) { if (wheel_event->orientation() == Qt::Vertical) { - double angle = wheel_event->angleDelta().y(); - double factor = qPow(_zoom_factor_base, angle); + const double angle = wheel_event->angleDelta().y(); + const double factor = qPow(_zoom_factor_base, angle); gentle_zoom(factor); return true; } @@ -172,10 +183,10 @@ bool GraphicsViewZoom::eventFilter(QObject *object, QEvent *event) return true;//Just ignore } - _numScheduledScalings += numSteps; - if (_numScheduledScalings * numSteps < 0) - { // if user moved the wheel in another direction, we reset - _numScheduledScalings = numSteps; // previously scheduled scalings + _numScheduledScrollings += numSteps; + if (_numScheduledScrollings * numSteps < 0) + { // if user moved the wheel in another direction, we reset previously scheduled scalings + _numScheduledScrollings = numSteps; } if (anim->state() != QTimeLine::Running) diff --git a/src/libs/vwidgets/vmaingraphicsview.h b/src/libs/vwidgets/vmaingraphicsview.h index f73883be9..45c313551 100644 --- a/src/libs/vwidgets/vmaingraphicsview.h +++ b/src/libs/vwidgets/vmaingraphicsview.h @@ -84,7 +84,10 @@ private: QPointF target_viewport_pos; QTimeLine *anim; /** @brief _numScheduledScalings keep number scheduled scalings. */ - qint32 _numScheduledScalings; + qint32 _numScheduledScrollings; + + static const int duration; + static const int updateInterval; void FictiveSceneRect(QGraphicsScene *sc, QGraphicsView *view); }; From 74b84740eb5b5928594f9f683619b09fa48512ab Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 25 Jan 2016 15:52:27 +0200 Subject: [PATCH 07/11] Updated ignore list. --HG-- branch : feature --- .hgignore | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.hgignore b/.hgignore index 9f23187a9..166ab3143 100644 --- a/.hgignore +++ b/.hgignore @@ -8,6 +8,11 @@ syntax: glob # Valentina lock files *.lock +# Valentina and Tape makes reserve copy of each pattern file before conversion to higher version. +*(v*).val +*(v*).vit +*(v*).vst + # KDE directory preferences .directory From 2069713ff6bd0f97272e1d62d681cc1ec63e2329 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 25 Jan 2016 16:46:24 +0200 Subject: [PATCH 08/11] Fixed bugs. --HG-- branch : feature --- .../core/vtooloptionspropertybrowser.cpp | 22 +++++----- .../tools/dialogpointofintersectioncurves.cpp | 40 ++++++++++++++++++- .../tools/dialogpointofintersectioncurves.h | 4 ++ .../tools/dialogpointofintersectioncurves.ui | 4 +- 4 files changed, 55 insertions(+), 15 deletions(-) diff --git a/src/app/valentina/core/vtooloptionspropertybrowser.cpp b/src/app/valentina/core/vtooloptionspropertybrowser.cpp index c865db382..936e61574 100644 --- a/src/app/valentina/core/vtooloptionspropertybrowser.cpp +++ b/src/app/valentina/core/vtooloptionspropertybrowser.cpp @@ -480,7 +480,7 @@ void VToolOptionsPropertyBrowser::AddPropertyCrossPoint(Tool *i, const QString & { VEnumProperty* itemProperty = new VEnumProperty(propertyName); itemProperty->setLiterals(QStringList()<< tr("First point") << tr("Second point")); - itemProperty->setValue(static_cast(i->GetCrossCirclesPoint())); + itemProperty->setValue(static_cast(i->GetCrossCirclesPoint())-1); AddProperty(itemProperty, AttrCrossPoint); } @@ -490,7 +490,7 @@ void VToolOptionsPropertyBrowser::AddPropertyVCrossPoint(Tool *i, const QString { auto itemProperty = new VEnumProperty(propertyName); itemProperty->setLiterals(QStringList()<< tr("Highest point") << tr("Lowest point")); - itemProperty->setValue(static_cast(i->GetVCrossPoint())); + itemProperty->setValue(static_cast(i->GetVCrossPoint())-1); AddProperty(itemProperty, AttrVCrossPoint); } @@ -500,7 +500,7 @@ void VToolOptionsPropertyBrowser::AddPropertyHCrossPoint(Tool *i, const QString { auto itemProperty = new VEnumProperty(propertyName); itemProperty->setLiterals(QStringList()<< tr("Leftmost point") << tr("Rightmost point")); - itemProperty->setValue(static_cast(i->GetHCrossPoint())); + itemProperty->setValue(static_cast(i->GetHCrossPoint())-1); AddProperty(itemProperty, AttrHCrossPoint); } @@ -629,9 +629,9 @@ Type VToolOptionsPropertyBrowser::GetCrossPoint(const QVariant &value) { switch(val) { + case 0: case 1: - case 2: - cross = static_cast(val); + cross = static_cast(val+1); break; default: break; @@ -2037,7 +2037,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolPointOfIntersectionArcs() VToolPointOfIntersectionArcs *i = qgraphicsitem_cast(currentItem); idToProperty[AttrName]->setValue(i->name()); - idToProperty[AttrCrossPoint]->setValue(static_cast(i->GetCrossCirclesPoint())); + idToProperty[AttrCrossPoint]->setValue(static_cast(i->GetCrossCirclesPoint())-1); } //--------------------------------------------------------------------------------------------------------------------- @@ -2046,7 +2046,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolPointOfIntersectionCircles() VToolPointOfIntersectionCircles *i = qgraphicsitem_cast(currentItem); idToProperty[AttrName]->setValue(i->name()); - idToProperty[AttrCrossPoint]->setValue(static_cast(i->GetCrossCirclesPoint())); + idToProperty[AttrCrossPoint]->setValue(static_cast(i->GetCrossCirclesPoint())-1); QVariant c1Radius; c1Radius.setValue(i->GetFirstCircleRadius()); @@ -2063,8 +2063,8 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolPointOfIntersectionCurves() auto i = qgraphicsitem_cast(currentItem); idToProperty[AttrName]->setValue(i->name()); - idToProperty[AttrVCrossPoint]->setValue(static_cast(i->GetVCrossPoint())); - idToProperty[AttrHCrossPoint]->setValue(static_cast(i->GetHCrossPoint())); + idToProperty[AttrVCrossPoint]->setValue(static_cast(i->GetVCrossPoint())-1); + idToProperty[AttrHCrossPoint]->setValue(static_cast(i->GetHCrossPoint())-1); } //--------------------------------------------------------------------------------------------------------------------- @@ -2073,7 +2073,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolPointFromCircleAndTangent() VToolPointFromCircleAndTangent *i = qgraphicsitem_cast(currentItem); idToProperty[AttrName]->setValue(i->name()); - idToProperty[AttrCrossPoint]->setValue(static_cast(i->GetCrossCirclesPoint())); + idToProperty[AttrCrossPoint]->setValue(static_cast(i->GetCrossCirclesPoint())-1); QVariant cRadius; cRadius.setValue(i->GetCircleRadius()); @@ -2086,7 +2086,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolPointFromArcAndTangent() VToolPointFromArcAndTangent *i = qgraphicsitem_cast(currentItem); idToProperty[AttrName]->setValue(i->name()); - idToProperty[AttrCrossPoint]->setValue(static_cast(i->GetCrossCirclesPoint())); + idToProperty[AttrCrossPoint]->setValue(static_cast(i->GetCrossCirclesPoint())-1); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/dialogs/tools/dialogpointofintersectioncurves.cpp b/src/libs/vtools/dialogs/tools/dialogpointofintersectioncurves.cpp index 9598a0bac..63fca7842 100644 --- a/src/libs/vtools/dialogs/tools/dialogpointofintersectioncurves.cpp +++ b/src/libs/vtools/dialogs/tools/dialogpointofintersectioncurves.cpp @@ -46,6 +46,7 @@ DialogPointOfIntersectionCurves::DialogPointOfIntersectionCurves(const VContaine labelEditNamePoint = ui->labelEditNamePoint; InitOkCancelApply(ui); + CheckState(); FillComboBoxCurves(ui->comboBoxCurve1); FillComboBoxCurves(ui->comboBoxCurve2); @@ -53,6 +54,10 @@ DialogPointOfIntersectionCurves::DialogPointOfIntersectionCurves(const VContaine FillComboBoxHCrossCurvesPoint(ui->comboBoxHCorrection); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogPointOfIntersectionCurves::NamePointChanged); + connect(ui->comboBoxCurve1, static_cast(&QComboBox::currentIndexChanged), + this, &DialogPointOfIntersectionCurves::CurveChanged); + connect(ui->comboBoxCurve2, static_cast(&QComboBox::currentIndexChanged), + this, &DialogPointOfIntersectionCurves::CurveChanged); vis = new VisToolPointOfIntersectionCurves(data); } @@ -80,7 +85,7 @@ quint32 DialogPointOfIntersectionCurves::GetFirstCurveId() const //--------------------------------------------------------------------------------------------------------------------- void DialogPointOfIntersectionCurves::SetFirstCurveId(const quint32 &value) { - setCurrentPointId(ui->comboBoxCurve1, value); + setCurrentCurveId(ui->comboBoxCurve1, value); auto point = qobject_cast(vis); SCASSERT(point != nullptr); @@ -96,7 +101,7 @@ quint32 DialogPointOfIntersectionCurves::GetSecondCurveId() const //--------------------------------------------------------------------------------------------------------------------- void DialogPointOfIntersectionCurves::SetSecondCurveId(const quint32 &value) { - setCurrentPointId(ui->comboBoxCurve2, value); + setCurrentCurveId(ui->comboBoxCurve2, value); auto point = qobject_cast(vis); SCASSERT(point != nullptr); @@ -202,3 +207,34 @@ void DialogPointOfIntersectionCurves::SaveData() point->setHCrossPoint(GetHCrossPoint()); point->RefreshGeometry(); } + +//--------------------------------------------------------------------------------------------------------------------- +void DialogPointOfIntersectionCurves::CheckState() +{ + SCASSERT(bOk != nullptr); + bOk->setEnabled(flagName && flagError); + // In case dialog hasn't apply button + if ( bApply != nullptr) + { + bApply->setEnabled(bOk->isEnabled()); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogPointOfIntersectionCurves::CurveChanged() +{ + QColor color = okColor; + if (getCurrentObjectId(ui->comboBoxCurve1) == getCurrentObjectId(ui->comboBoxCurve2)) + { + flagError = false; + color = errorColor; + } + else + { + flagError = true; + color = okColor; + } + ChangeColor(ui->labelCurve1, color); + ChangeColor(ui->labelCurve2, color); + CheckState(); +} diff --git a/src/libs/vtools/dialogs/tools/dialogpointofintersectioncurves.h b/src/libs/vtools/dialogs/tools/dialogpointofintersectioncurves.h index d70b1bc34..7b6aea822 100644 --- a/src/libs/vtools/dialogs/tools/dialogpointofintersectioncurves.h +++ b/src/libs/vtools/dialogs/tools/dialogpointofintersectioncurves.h @@ -67,6 +67,10 @@ protected: * @brief SaveData Put dialog data in local variables */ virtual void SaveData() Q_DECL_OVERRIDE; + virtual void CheckState() Q_DECL_OVERRIDE; + +private slots: + void CurveChanged(); private: Q_DISABLE_COPY(DialogPointOfIntersectionCurves) diff --git a/src/libs/vtools/dialogs/tools/dialogpointofintersectioncurves.ui b/src/libs/vtools/dialogs/tools/dialogpointofintersectioncurves.ui index 2ce932e5d..4fb60acd9 100644 --- a/src/libs/vtools/dialogs/tools/dialogpointofintersectioncurves.ui +++ b/src/libs/vtools/dialogs/tools/dialogpointofintersectioncurves.ui @@ -24,7 +24,7 @@ QFormLayout::ExpandingFieldsGrow - + 0 @@ -44,7 +44,7 @@ - + 0 From d86c79f29032b3fad96e34a88dadbc4a250b4b7b Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 25 Jan 2016 19:06:36 +0200 Subject: [PATCH 09/11] Unit test. Check VToolPointOfIntersectionCurves::FindPoint() method. --HG-- branch : feature --- src/libs/vtools/dialogs/tools/dialogtool.h | 2 +- .../vtoolpointofintersectioncurves.cpp | 5 + src/libs/vtools/tools/vabstracttool.h | 2 +- src/test/ValentinaTest/ValentinaTest.pro | 24 ++- src/test/ValentinaTest/qttestmainlambda.cpp | 2 + src/test/ValentinaTest/tst_findpoint.cpp | 167 ++++++++++++++++++ src/test/ValentinaTest/tst_findpoint.h | 46 +++++ 7 files changed, 244 insertions(+), 4 deletions(-) create mode 100644 src/test/ValentinaTest/tst_findpoint.cpp create mode 100644 src/test/ValentinaTest/tst_findpoint.h diff --git a/src/libs/vtools/dialogs/tools/dialogtool.h b/src/libs/vtools/dialogs/tools/dialogtool.h index 5a20405d0..c2cdec515 100644 --- a/src/libs/vtools/dialogs/tools/dialogtool.h +++ b/src/libs/vtools/dialogs/tools/dialogtool.h @@ -32,7 +32,7 @@ #include "../vmisc/vabstractapplication.h" #include "../vmisc/logging.h" #include "../vwidgets/vmaingraphicsscene.h" -#include "visualization/visualization.h" +#include "../../visualization/visualization.h" #include "../ifc/xml/vabstractpattern.h" #include diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp index bcf1e17ae..04f1716bd 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp @@ -133,6 +133,11 @@ QPointF VToolPointOfIntersectionCurves::FindPoint(const QVector &curve1 const QVector &curve2Points, VCrossCurvesPoint vCrossPoint, HCrossCurvesPoint hCrossPoint) { + if (curve1Points.isEmpty() || curve2Points.isEmpty()) + { + return QPointF(); + } + QVector intersections; for ( auto i = 0; i < curve1Points.count()-1; ++i ) { diff --git a/src/libs/vtools/tools/vabstracttool.h b/src/libs/vtools/tools/vabstracttool.h index 4c1513c87..19be562c6 100644 --- a/src/libs/vtools/tools/vabstracttool.h +++ b/src/libs/vtools/tools/vabstracttool.h @@ -33,7 +33,7 @@ #include "../ifc/xml/vabstractpattern.h" #include "../vmisc/vabstractapplication.h" #include "../vwidgets/vmaingraphicsscene.h" -#include "visualization/visualization.h" +#include "../visualization/visualization.h" class QDomElement; class QLineF; diff --git a/src/test/ValentinaTest/ValentinaTest.pro b/src/test/ValentinaTest/ValentinaTest.pro index a11102d45..a9c6f8ff8 100644 --- a/src/test/ValentinaTest/ValentinaTest.pro +++ b/src/test/ValentinaTest/ValentinaTest.pro @@ -53,7 +53,8 @@ SOURCES += \ tst_misc.cpp \ tst_vcommandline.cpp \ tst_tstranslation.cpp \ - tst_vdetail.cpp + tst_vdetail.cpp \ + tst_findpoint.cpp HEADERS += \ tst_vposter.h \ @@ -74,7 +75,8 @@ HEADERS += \ tst_misc.h \ tst_vcommandline.h \ tst_tstranslation.h \ - tst_vdetail.h + tst_vdetail.h \ + tst_findpoint.h # Set using ccache. Function enable_ccache() defined in common.pri. $$enable_ccache() @@ -145,6 +147,24 @@ CONFIG(debug, debug|release){ } } +#VTools static library (depend on VWidgets, VMisc, VPatternDB) +unix|win32: LIBS += -L$$OUT_PWD/../../libs/vtools/$${DESTDIR}/ -lvtools + +INCLUDEPATH += $$PWD/../../libs/vtools +DEPENDPATH += $$PWD/../../libs/vtools + +win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vtools/$${DESTDIR}/vtools.lib +else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vtools/$${DESTDIR}/libvtools.a + +#VWidgets static library +unix|win32: LIBS += -L$$OUT_PWD/../../libs/vwidgets/$${DESTDIR}/ -lvwidgets + +INCLUDEPATH += $$PWD/../../libs/vwidgets +DEPENDPATH += $$PWD/../../libs/vwidgets + +win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vwidgets/$${DESTDIR}/vwidgets.lib +else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vwidgets/$${DESTDIR}/libvwidgets.a + # VFormat static library (depend on VPatternDB, IFC) unix|win32: LIBS += -L$$OUT_PWD/../../libs/vformat/$${DESTDIR}/ -lvformat diff --git a/src/test/ValentinaTest/qttestmainlambda.cpp b/src/test/ValentinaTest/qttestmainlambda.cpp index 703998357..bad3060f0 100644 --- a/src/test/ValentinaTest/qttestmainlambda.cpp +++ b/src/test/ValentinaTest/qttestmainlambda.cpp @@ -45,6 +45,7 @@ #include "tst_vcommandline.h" #include "tst_tstranslation.h" #include "tst_vdetail.h" +#include "tst_findpoint.h" int main(int argc, char** argv) { @@ -59,6 +60,7 @@ int main(int argc, char** argv) delete obj; }; + ASSERT_TEST(new TST_FindPoint()); ASSERT_TEST(new TST_VDetail()); ASSERT_TEST(new TST_VPoster()); ASSERT_TEST(new TST_VAbstractDetail()); diff --git a/src/test/ValentinaTest/tst_findpoint.cpp b/src/test/ValentinaTest/tst_findpoint.cpp new file mode 100644 index 000000000..31f10b20d --- /dev/null +++ b/src/test/ValentinaTest/tst_findpoint.cpp @@ -0,0 +1,167 @@ +/************************************************************************ + ** + ** @file tst_findpoint.cpp + ** @author Roman Telezhynskyi + ** @date 25 1, 2016 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2016 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ + +#include "tst_findpoint.h" +#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.h" + +#include + +//--------------------------------------------------------------------------------------------------------------------- +TST_FindPoint::TST_FindPoint(QObject *parent) : + QObject(parent) +{ +} + +//--------------------------------------------------------------------------------------------------------------------- +void TST_FindPoint::TestPointOfIntersectionCurves_data() +{ + QTest::addColumn>("curve1Points"); + QTest::addColumn>("curve2Points"); + QTest::addColumn("vCross"); + QTest::addColumn("hCross"); + QTest::addColumn("expect"); + + QVector points1; + QVector points2; + + VCrossCurvesPoint v = VCrossCurvesPoint::HighestPoint; + HCrossCurvesPoint h = HCrossCurvesPoint::LeftPoint; + QPointF p; + + QTest::newRow("Empty lists of points") << points1 << points2 << static_cast(v) << static_cast(h) << p; + + points1.clear(); + points1.append(QPointF(10, 10)); + points1.append(QPointF(15, 20)); + points1.append(QPointF(10, 30)); + + points2.clear(); + points2.append(QPointF(30, 10)); + points2.append(QPointF(25, 20)); + points2.append(QPointF(30, 30)); + QTest::newRow("No intersections") << points1 << points2 << static_cast(v) << static_cast(h) << p; + + points1.clear(); + points1.append(QPointF(10, 10)); + points1.append(QPointF(20, 20)); + points1.append(QPointF(10, 30)); + + points2.clear(); + points2.append(QPointF(30, 10)); + points2.append(QPointF(20, 20)); + points2.append(QPointF(30, 30)); + + p = QPointF(20, 20); + QTest::newRow("One intersection point") << points1 << points2 << static_cast(v) << static_cast(h) << p; + + points1.clear(); + points1.append(QPointF(10, 10)); + points1.append(QPointF(25, 20)); + points1.append(QPointF(10, 30)); + + points2.clear(); + points2.append(QPointF(25, 10)); + points2.append(QPointF(15, 20)); + points2.append(QPointF(25, 30)); + + p = QPointF(19, 16); + + h = HCrossCurvesPoint::LeftPoint; + QTest::newRow("Two intersection points (highest point, leftmost point)") << points1 << points2 + << static_cast(v) + << static_cast(h) << p; + + h = HCrossCurvesPoint::RightPoint; + QTest::newRow("Two intersection points (highest point, rightmost point)") << points1 << points2 + << static_cast(v) + << static_cast(h) << p; + + v = VCrossCurvesPoint::LowestPoint; + p = QPointF(19, 24); + + h = HCrossCurvesPoint::LeftPoint; + QTest::newRow("Two intersection points (lowest point, leftmost point)") << points1 << points2 + << static_cast(v) + << static_cast(h) << p; + + h = HCrossCurvesPoint::RightPoint; + QTest::newRow("Two intersection points (lowest point, rightmost point)") << points1 << points2 + << static_cast(v) + << static_cast(h) << p; + + points1.clear(); + points1.append(QPointF(10, 10)); + points1.append(QPointF(20, 25)); + points1.append(QPointF(30, 10)); + + points2.clear(); + points2.append(QPointF(10, 30)); + points2.append(QPointF(20, 15)); + points2.append(QPointF(30, 30)); + + h = HCrossCurvesPoint::LeftPoint; + p = QPointF(16.6667, 20); + + v = VCrossCurvesPoint::HighestPoint; + QTest::newRow("Two intersection points (leftmost point, highest point)") << points1 << points2 + << static_cast(v) + << static_cast(h) << p; + + v = VCrossCurvesPoint::LowestPoint; + QTest::newRow("Two intersection points (leftmost point, lowest point)") << points1 << points2 + << static_cast(v) + << static_cast(h) << p; + + h = HCrossCurvesPoint::RightPoint; + p = QPointF(23.3333, 20); + + v = VCrossCurvesPoint::HighestPoint; + QTest::newRow("Two intersection points (rightmost point, highest point)") << points1 << points2 + << static_cast(v) + << static_cast(h) << p; + + v = VCrossCurvesPoint::LowestPoint; + QTest::newRow("Two intersection points (rightmost point, lowest point)") << points1 << points2 + << static_cast(v) + << static_cast(h) << p; +} + +//--------------------------------------------------------------------------------------------------------------------- +void TST_FindPoint::TestPointOfIntersectionCurves() +{ + QFETCH(QVector, curve1Points); + QFETCH(QVector, curve2Points); + QFETCH(int, vCross); + QFETCH(int, hCross); + QFETCH(QPointF, expect); + + const QPointF result = VToolPointOfIntersectionCurves::FindPoint(curve1Points, curve2Points, + static_cast(vCross), + static_cast(hCross)); + QCOMPARE(result.toPoint(), expect.toPoint()); +} diff --git a/src/test/ValentinaTest/tst_findpoint.h b/src/test/ValentinaTest/tst_findpoint.h new file mode 100644 index 000000000..08d26676e --- /dev/null +++ b/src/test/ValentinaTest/tst_findpoint.h @@ -0,0 +1,46 @@ +/************************************************************************ + ** + ** @file tst_findpoint.h + ** @author Roman Telezhynskyi + ** @date 25 1, 2016 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2016 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ + +#ifndef TST_FINDPOINT_H +#define TST_FINDPOINT_H + +#include + +class TST_FindPoint : public QObject +{ + Q_OBJECT +public: + explicit TST_FindPoint(QObject *parent = nullptr); + +private slots: + void TestPointOfIntersectionCurves_data(); + void TestPointOfIntersectionCurves(); + +}; + +#endif // TST_FINDPOINT_H From c1fecafda926cf6d759182a69d4a24c42243ffa4 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 25 Jan 2016 19:10:39 +0200 Subject: [PATCH 10/11] Refactoring. --HG-- branch : feature --- src/libs/ifc/xml/vabstractpattern.h | 2 +- src/libs/vtools/dialogs/tools/dialogtool.cpp | 4 ++-- .../vtoolpointofintersectioncurves.cpp | 2 +- .../vistoolpointofintersectioncurves.cpp | 2 +- src/test/ValentinaTest/tst_findpoint.cpp | 14 +++++++------- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/libs/ifc/xml/vabstractpattern.h b/src/libs/ifc/xml/vabstractpattern.h index caad6afcd..c77fe9e32 100644 --- a/src/libs/ifc/xml/vabstractpattern.h +++ b/src/libs/ifc/xml/vabstractpattern.h @@ -40,7 +40,7 @@ enum class LabelType : char {NewPatternPiece, NewLabel}; // Don't touch values!!!. Same values stored in xml. enum class CrossCirclesPoint : char {FirstPoint = 1, SecondPoint = 2}; enum class VCrossCurvesPoint : char {HighestPoint = 1, LowestPoint = 2}; -enum class HCrossCurvesPoint : char {LeftPoint = 1, RightPoint = 2}; +enum class HCrossCurvesPoint : char {LeftmostPoint = 1, RightmostPoint = 2}; class VDataTool; class VContainer; diff --git a/src/libs/vtools/dialogs/tools/dialogtool.cpp b/src/libs/vtools/dialogs/tools/dialogtool.cpp index 7e3b768a7..5cff1eb04 100644 --- a/src/libs/vtools/dialogs/tools/dialogtool.cpp +++ b/src/libs/vtools/dialogs/tools/dialogtool.cpp @@ -241,8 +241,8 @@ void DialogTool::FillComboBoxHCrossCurvesPoint(QComboBox *box) const { SCASSERT(box != nullptr); - box->addItem(tr("Leftmost point"), QVariant(static_cast(HCrossCurvesPoint::LeftPoint))); - box->addItem(tr("Rightmost point"), QVariant(static_cast(HCrossCurvesPoint::RightPoint))); + box->addItem(tr("Leftmost point"), QVariant(static_cast(HCrossCurvesPoint::LeftmostPoint))); + box->addItem(tr("Rightmost point"), QVariant(static_cast(HCrossCurvesPoint::RightmostPoint))); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp index 04f1716bd..a077d58d8 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp @@ -217,7 +217,7 @@ QPointF VToolPointOfIntersectionCurves::FindPoint(const QVector &curve1 QPointF crossPoint = vIntersections.at(0); - if (hCrossPoint == HCrossCurvesPoint::RightPoint) + if (hCrossPoint == HCrossCurvesPoint::RightmostPoint) { qreal maxX = vIntersections.at(0).x(); diff --git a/src/libs/vtools/visualization/vistoolpointofintersectioncurves.cpp b/src/libs/vtools/visualization/vistoolpointofintersectioncurves.cpp index 7dc7f293f..cb62b75bd 100644 --- a/src/libs/vtools/visualization/vistoolpointofintersectioncurves.cpp +++ b/src/libs/vtools/visualization/vistoolpointofintersectioncurves.cpp @@ -34,7 +34,7 @@ VisToolPointOfIntersectionCurves::VisToolPointOfIntersectionCurves(const VContai :VisPath(data, parent), object2Id(NULL_ID), vCrossPoint(VCrossCurvesPoint::HighestPoint), - hCrossPoint(HCrossCurvesPoint::LeftPoint), + hCrossPoint(HCrossCurvesPoint::LeftmostPoint), point(nullptr), visCurve2(nullptr) { diff --git a/src/test/ValentinaTest/tst_findpoint.cpp b/src/test/ValentinaTest/tst_findpoint.cpp index 31f10b20d..ab7c76923 100644 --- a/src/test/ValentinaTest/tst_findpoint.cpp +++ b/src/test/ValentinaTest/tst_findpoint.cpp @@ -50,7 +50,7 @@ void TST_FindPoint::TestPointOfIntersectionCurves_data() QVector points2; VCrossCurvesPoint v = VCrossCurvesPoint::HighestPoint; - HCrossCurvesPoint h = HCrossCurvesPoint::LeftPoint; + HCrossCurvesPoint h = HCrossCurvesPoint::LeftmostPoint; QPointF p; QTest::newRow("Empty lists of points") << points1 << points2 << static_cast(v) << static_cast(h) << p; @@ -91,12 +91,12 @@ void TST_FindPoint::TestPointOfIntersectionCurves_data() p = QPointF(19, 16); - h = HCrossCurvesPoint::LeftPoint; + h = HCrossCurvesPoint::LeftmostPoint; QTest::newRow("Two intersection points (highest point, leftmost point)") << points1 << points2 << static_cast(v) << static_cast(h) << p; - h = HCrossCurvesPoint::RightPoint; + h = HCrossCurvesPoint::RightmostPoint; QTest::newRow("Two intersection points (highest point, rightmost point)") << points1 << points2 << static_cast(v) << static_cast(h) << p; @@ -104,12 +104,12 @@ void TST_FindPoint::TestPointOfIntersectionCurves_data() v = VCrossCurvesPoint::LowestPoint; p = QPointF(19, 24); - h = HCrossCurvesPoint::LeftPoint; + h = HCrossCurvesPoint::LeftmostPoint; QTest::newRow("Two intersection points (lowest point, leftmost point)") << points1 << points2 << static_cast(v) << static_cast(h) << p; - h = HCrossCurvesPoint::RightPoint; + h = HCrossCurvesPoint::RightmostPoint; QTest::newRow("Two intersection points (lowest point, rightmost point)") << points1 << points2 << static_cast(v) << static_cast(h) << p; @@ -124,7 +124,7 @@ void TST_FindPoint::TestPointOfIntersectionCurves_data() points2.append(QPointF(20, 15)); points2.append(QPointF(30, 30)); - h = HCrossCurvesPoint::LeftPoint; + h = HCrossCurvesPoint::LeftmostPoint; p = QPointF(16.6667, 20); v = VCrossCurvesPoint::HighestPoint; @@ -137,7 +137,7 @@ void TST_FindPoint::TestPointOfIntersectionCurves_data() << static_cast(v) << static_cast(h) << p; - h = HCrossCurvesPoint::RightPoint; + h = HCrossCurvesPoint::RightmostPoint; p = QPointF(23.3333, 20); v = VCrossCurvesPoint::HighestPoint; From 641c7c31093a606675e8bd13ff402d9378ff6d62 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 25 Jan 2016 19:15:30 +0200 Subject: [PATCH 11/11] Updated changelog. --HG-- branch : feature --- ChangeLog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index 553bf87c9..4af806c98 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,4 +1,5 @@ # Version 0.5.0 +- [#132] Intersect Curves. - Added language Chinese (China). - New icon for VAL file. Updated Tape logo. Updated ico for standard measurements. - [#325] Check pattern for inverse compatibility.