From 04a3a47a3c1e4cd57b3810a4a6a2ceda551688a4 Mon Sep 17 00:00:00 2001 From: dmv Date: Mon, 4 Aug 2008 11:10:28 +0000 Subject: [PATCH] 0016757: EDF 546 GEOM : Add Face and Disc in geom primitives --- idl/GEOM_Gen.idl | 36 ++ idl/GEOM_Superv.idl | 11 + resources/GEOM_en.xml | 4 + resources/GEOM_fr.xml | 4 + resources/Makefile.am | 5 + resources/disk.png | Bin 0 -> 744 bytes resources/disk3points.png | Bin 0 -> 856 bytes resources/disk_pntvecr.png | Bin 0 -> 811 bytes resources/face_hw.png | Bin 0 -> 734 bytes resources/face_planehw.png | Bin 0 -> 712 bytes src/GEOMGUI/GEOM_images.ts | 24 + src/GEOMGUI/GEOM_msg_en.ts | 22 +- src/GEOMGUI/GeometryGUI.cxx | 10 +- src/GEOMImpl/GEOMImpl_DiskDriver.cxx | 185 +++++++ src/GEOMImpl/GEOMImpl_DiskDriver.hxx | 158 ++++++ src/GEOMImpl/GEOMImpl_FaceDriver.cxx | 148 ++++++ src/GEOMImpl/GEOMImpl_FaceDriver.hxx | 158 ++++++ src/GEOMImpl/GEOMImpl_Gen.cxx | 4 + src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx | 228 +++++++++ src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx | 12 +- src/GEOMImpl/GEOMImpl_IDisk.hxx | 60 +++ src/GEOMImpl/GEOMImpl_IFace.hxx | 57 +++ src/GEOMImpl/GEOMImpl_Types.hxx | 6 + src/GEOMImpl/Makefile.am | 2 + src/GEOM_I/GEOM_I3DPrimOperations_i.cc | 125 +++++ src/GEOM_I/GEOM_I3DPrimOperations_i.hh | 15 + src/GEOM_I_Superv/GEOM_Superv_i.cc | 59 +++ src/GEOM_I_Superv/GEOM_Superv_i.hh | 11 + src/GEOM_SWIG/GEOM_TestAll.py | 8 + src/GEOM_SWIG/geompyDC.py | 51 ++ src/PrimitiveGUI/Makefile.am | 10 +- src/PrimitiveGUI/PrimitiveGUI.cxx | 8 + src/PrimitiveGUI/PrimitiveGUI_DiskDlg.cxx | 510 ++++++++++++++++++++ src/PrimitiveGUI/PrimitiveGUI_DiskDlg.h | 81 ++++ src/PrimitiveGUI/PrimitiveGUI_FaceDlg.cxx | 422 ++++++++++++++++ src/PrimitiveGUI/PrimitiveGUI_FaceDlg.h | 81 ++++ 36 files changed, 2509 insertions(+), 6 deletions(-) create mode 100644 resources/disk.png create mode 100644 resources/disk3points.png create mode 100644 resources/disk_pntvecr.png create mode 100644 resources/face_hw.png create mode 100644 resources/face_planehw.png create mode 100755 src/GEOMImpl/GEOMImpl_DiskDriver.cxx create mode 100755 src/GEOMImpl/GEOMImpl_DiskDriver.hxx create mode 100755 src/GEOMImpl/GEOMImpl_FaceDriver.cxx create mode 100755 src/GEOMImpl/GEOMImpl_FaceDriver.hxx create mode 100755 src/GEOMImpl/GEOMImpl_IDisk.hxx create mode 100755 src/GEOMImpl/GEOMImpl_IFace.hxx create mode 100755 src/PrimitiveGUI/PrimitiveGUI_DiskDlg.cxx create mode 100755 src/PrimitiveGUI/PrimitiveGUI_DiskDlg.h create mode 100755 src/PrimitiveGUI/PrimitiveGUI_FaceDlg.cxx create mode 100755 src/PrimitiveGUI/PrimitiveGUI_FaceDlg.h diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index 311f9ea63..6f48f8d5a 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -821,6 +821,42 @@ module GEOM */ GEOM_Object MakeBoxTwoPnt (in GEOM_Object thePnt1, in GEOM_Object thePnt2); + /*! + * Create a face specified dimensions along OX-OY coordinate axes, + * with edges parallel to the coordinate axes. + * Center of the face will be at point (0, 0, 0). + * \param theH length of Face edge, parallel to OX axis. + * \param theW lenght of Face edge, patallel to OY axis. + * \return New GEOM_Object, containing the created face. + */ + GEOM_Object MakeFaceHW (in double theH, in double theW); + /*! + * Create a face by another plane and two specified sizes, + * vertical (H) and horisontal (W). + * \param theFace defines plane. + * \param theH vertical size (height). + * \param theW horisontal size (width). + * \return New GEOM_Object, containing the created face. + */ + GEOM_Object MakeFacePlaneHW (in GEOM_Object theFace, in double theH, in double theW); + /*! + * Create a Disk (circular face) with given center, normal vector and radius. + * \param thePnt disk center. + * \param theVec Vector, normal to the plane of the disk. + * \param theR Disk radius. + * \return New GEOM_Object, containing the created disk. + */ + GEOM_Object MakeDiskPntVecR (in GEOM_Object thePnt, + in GEOM_Object theVec, + in double theR); + /*! + * Create a disk (circular face), passing through three given points + * \param thePnt1, thePnt2, thePnt3 Points, defining the disk. + * \return New GEOM_Object, containing the created disk. + */ + GEOM_Object MakeDiskThreePnt (in GEOM_Object thePnt1, + in GEOM_Object thePnt2, + in GEOM_Object thePnt3); /*! * Create a cylinder with given radius and height at * the origin of coordinate system. Axis of the cylinder diff --git a/idl/GEOM_Superv.idl b/idl/GEOM_Superv.idl index d0f2f4034..2b9cde49f 100644 --- a/idl/GEOM_Superv.idl +++ b/idl/GEOM_Superv.idl @@ -126,6 +126,17 @@ module GEOM in double theDZ) ; GEOM_Object MakeBoxTwoPnt (in GEOM_Object thePnt1, in GEOM_Object thePnt2) ; + GEOM_Object MakeFaceHW (in double theH, + in double theW) ; + GEOM_Object MakeFacePlaneHW (in GEOM_Object theFace, + in double theH, + in double theW) ; + GEOM_Object MakeDiskPntVecR (in GEOM_Object thePnt, + in GEOM_Object theVec, + in double theR) ; + GEOM_Object MakeDiskThreePnt (in GEOM_Object thePnt1, + in GEOM_Object thePnt2, + in GEOM_Object thePnt3) ; GEOM_Object MakeCylinderPntVecRH (in GEOM_Object thePnt, in GEOM_Object theAxis, in double theRadius, diff --git a/resources/GEOM_en.xml b/resources/GEOM_en.xml index 01c72eecd..175c2fb98 100644 --- a/resources/GEOM_en.xml +++ b/resources/GEOM_en.xml @@ -52,6 +52,8 @@ + + @@ -229,6 +231,8 @@ + + diff --git a/resources/GEOM_fr.xml b/resources/GEOM_fr.xml index 8c925b61f..1a551988e 100644 --- a/resources/GEOM_fr.xml +++ b/resources/GEOM_fr.xml @@ -58,6 +58,8 @@ + + @@ -203,6 +205,8 @@ + + diff --git a/resources/Makefile.am b/resources/Makefile.am index bff974dee..18259d174 100644 --- a/resources/Makefile.am +++ b/resources/Makefile.am @@ -72,11 +72,16 @@ cylinder.png \ cylinderdxyz.png \ cylinderpointvector.png \ delete.png \ +disk.png \ +disk3points.png \ +disk_pntvecr.png \ display.png \ displayonly.png \ displayall.png \ erase.png \ eraseall.png \ +face_hw.png \ +face_planehw.png \ fillet.png \ filletall.png \ filletedge.png \ diff --git a/resources/disk.png b/resources/disk.png new file mode 100644 index 0000000000000000000000000000000000000000..8aad056b9ddf5113adc44bb5d6977a1a79754570 GIT binary patch literal 744 zcmVP)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ;UP(kjRCwBA{Qv(y12q9a05LI882|(j)eQs)AgUV( z5I|Hn5FmgUu?dERg#7>a?;pe8zkk8__wU~fpvVKUfBpIe#wSmn#Htq{fLM?@K|w*_ zC|CC_XZZW?Kf|BD|H1S>5dM##fB*T%@cDDb|DQj9GTgm;7sX(J0D^P;{QUmw1l58y z`~hnC{TF25KQJF=C@6)2<^Mqp{q^TB!-2kVhIjAYaRQC_0Wt?5fWQViI5_+_iS7U@ zW`Md3r1&40{tGtfKUfZC;9rnD2>*r{y0_gMWDM9)fB<4NG&KBgkvtjfN|5HiK$n3O zgIxIs<}wC^>;6H50%XwNKff9N{r<)9@9%GhBa@@Sh5`f-%g2u&89si61Ukq?Ft7dw zc^4XHkjw<6ff4opKTsTG(4Sur{P!17{4Xrz6aWH<1?YdEfj_~n0f*V&KVbYH7^5J~ z|Nlc3Lk$CI1{wJG&rhHlpus?OKtY&+ng9XB2sV|4<-T>^3aCN9Av8!4$N;e8{(*h) zA0+mdAp3|BX_f|67-Q00Aq00J2(0mPO-L)V$6%mga}g$cyK|0rGsyAEU_ z(1l=&f&3d=dSHfuV);5i0D%nT0J#!~4Vjslmw_B)5Y-8>9UOj8mx3_ZMSsCQxUsbt z5|IeQ?gR08fB=G}L%5+ptOzu?l~5Lg8pMEX7!W@I2q5HC4l`5}h$Vqo04jzHfDHNo z#Lq!q1sMhs0|+4W{Kx?{2o$c0P&O{`0qU|BP&PQH00a;t4#gZKxbO$EAV2^yQo9NO a2rvL#F1}pK6nP)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ;&PhZ;RCwBA{Qv(y12q9a05LI882|(j)eQs)AgUV( z5I|TB{P#PG?0^LbAnYz=|m;Ffrx{Qe-F!&9_-`|Pvfg%j< z?(PhK{`_HJW@ZMf`TO@T!_S{T8IBw|!U*R7w*Ak{dYBPr20#Fz80hQ&987QCD8f)O zFOA_ZFiEKeFff3U79&*4-+%uZe*gK$pslU_|HqFX47aWef_(#&`TO0XJU2MRIJhq|e0Zz){`YT4 zU;zXWBS^8Hp5A}+0D+UuhYueV_jUR*{QmX{h(9v?`t|_{e`J^#SHwAV@U*0kN`urBi2GUwh!c*xCzAMj*p}fD8lC00G1ZNfO`$tN_G@K&%K1lU9)8 zO&i33k;A|c6!MB;>0%KuJ3jFZvOx?`!|ns|c_4lO5I~Hu;tR=8O(2#8Vo=%w=akhe zC2B*%Uo@j-3Ye=viT66lFi<)K2q1Vm1aW|dK7cBc0J#)uC<6}z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ;p-DtRRCwBA{Qv(y12q9a05K3_;9h%sqHP5TASPlI zF*1Rb2>>w%A+-PjM3jNd9AI-4poZcF00BhMz@s4{{~1|W7!J6)o+rkI00Bfy7;+p5 z3IZt#1Y!e1h5`f-F<$0iVrPeip&%gx0Ro5^1Ajon@BKw=>L>(?)at5>fwV$%x{Kqv2vZlJTX^M6&JN{AnS z{RJBcGVBk~gnvMdzyADX_y>#{uq8mOn=lh7_K)FphwuMCfBta7f&w6bz+q@$VDMix zppoIrk3S5bzW-+U^zApp$8W!Y^e=|bKz8Wy<6yZjK)KIQ`7hsoGW_`VmBBK5G02GT zu*d=kAg~L+eEGug@#`<33;r|w{ReRw$aaux_ICJyUA?j1o#Ej#TZUi1fpS0pG5i4H z-@kxrfB$E&o5BnVTTsG(01!Z61K+=Y&+q|gAjm7AK>zpWHxU0~`2Y7egJtG?hU3!{ z8O+mWGlbUv1B?Cp^M~R8KM?*4O~+?I#%O|40zd#Uf&_pOp}@kza^Et02~hD*uwnmz z8i7#_)Bw@+9~hQk13(5s4Fkpz!_^I~AV)L<4Z9D-`vC$7W}pO+W68|SybffQVN4I) zK%h>bflv&x0BG1hpkX(*^nil`Y8WU&t^@ILfB=FS$N|m#hCr+cG`N*eYKI!c05uHc zI#6DJ01!Yh0~w&PqyP;INg|4?AJE+M9O}9UATfXdLN*X)D99jC5GWETu0B9r_5#WV pr$c}MLN^fIU}9W|lD7c@3;-^NYQLS&RZ#!{002ovPDHLkV1g0$SKR;r literal 0 HcmV?d00001 diff --git a/resources/face_hw.png b/resources/face_hw.png new file mode 100644 index 0000000000000000000000000000000000000000..23ae0c2dc22c85d52a3c78251b4e6805accdccca GIT binary patch literal 734 zcmV<40wMj0P)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ;R7pfZRCwBA{Qv(y12q9a05K3_;1fqDqHP5TASU8e zft85^F*hNl00BhMz-PXG{~1|XL9ToO@c+*r24iF61%LnkWdLE2*w3Fo;rQFPZ(tgzo)I8`uo~#(-Rr~A3#mtfBj*YxT}TX|BoLa7cl$*s{aY3LHHMt{TGCxdRc+y z00a<<3xVGHuNu_C@bT+!hHpRrfbonSwG7d=WeorR`~L!bdXf z0>~h!@C$$dg1Hcs`VFob8XW-!?w0LZ+CHAwt{xziKB0!~Kr-+PKmftQ5S02Qz5@e# zzmBetgwJ30t}yTz+@44<9ZI%<`;Neh>_3% z0th|X=mT*G)Wt`j_$4XjD?k7-;jr}!xdk>r0HM2(8>vM3LQLL82LJ&E07h3bNZF70 Q_W%F@07*qoM6N<$g8vseg8%>k literal 0 HcmV?d00001 diff --git a/resources/face_planehw.png b/resources/face_planehw.png new file mode 100644 index 0000000000000000000000000000000000000000..86cefba39a3d1da1d307077f4b183567482d079f GIT binary patch literal 712 zcmV;(0yq7MP)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ;K1oDDRCwBA{Qv(y12q9a05LI882|(j)eQs)AgUV( z5I|Hn5Fmh9a7ozN+5Kl`W@cbyWMqIv+`oVS82n)3;+RyVW5kP%m2N5 z_ks*koG@X+F_@SC{{0K~-j^?57`}b`2Btw?T)ld=BFuF_Yy}WN7zTpE1L{?VuV241 ze3Eo!`1AK4!;fEo89w~|#qg2+7sJ>8zZw28erDi)wh*N32M~XNYJU$9K#a&aMPFb4 z|D{Wpz^*GTEj{)@#*g9mpMMNLfB$9p^5Zwdmv289e*gHw@b~982Ch3R7=S)W0;+uh z#M_|3qX-Z{*uoI(I*|81eFMfG(6Dbm{xJOf{)OT9_s@DpkcqheFPfzjp5(lKMY(?cQYJ1d9oR5*gB9N zsNwGc0tjy4yLa#4w!D7*n&JPG2@H%se=-1_0`%ffhJPRz0fPsW6Mh0C3L19Lq1s_7 z;R8Sbfx}QrO6vdf=g%dfHob=`HUwf#Jjn(Wc2kjE2gDBm0*D0`UNF}og$c3?a2bf= zI-uiz00a;)nSmThcA1FcI*@??0mK3%Kv_%!D*1wdtFWdBnCn0cfB<5FI++tm0V!Dx u7A&w}VgLvrMyLU#8iZ^h+;t!T5MTiGR17PPIz#*b0000ICON_DLG_BUILD_COMPOUND build_compound.png + + ICON_DLG_DISK + disk.png + + + ICON_DLG_DISK_PNT_VEC_R + disk_pntvecr.png + + + ICON_DLG_DISK_THREE_POINTS + disk3points.png + ICON_DLG_BUILD_EDGE build_edge.png @@ -70,6 +82,14 @@ ICON_DLG_BUILD_FACE build_face.png + + ICON_DLG_FACE_HW + face_hw.png + + + ICON_DLG_FACE_PLANE_HW + face_planehw.png + ICON_DLG_BUILD_SHELL build_shell.png @@ -642,6 +662,10 @@ ICO_DELETE delete.png + + ICO_DISK + disk.png + ICO_DISPLAY display.png diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts index 5dd707700..8188a2b31 100644 --- a/src/GEOMGUI/GEOM_msg_en.ts +++ b/src/GEOMGUI/GEOM_msg_en.ts @@ -416,6 +416,10 @@ Please, select face, shell or solid and try again GEOM_DIAGONAL_POINTS Diagonal Points + + GEOM_DISK + Disk + GEOM_DIMENSIONS Dimensions @@ -1748,6 +1752,10 @@ Please, select face, shell or solid and try again GEOM_WEIGHT Weight : + + GEOM_WIDTH + Width : + GEOM_WHATIS Whatis @@ -1972,6 +1980,10 @@ Please, select face, shell or solid and try again MEN_DISPLAY Show + + MEN_DISK + Disk + MEN_DISPLAY_ALL Show all @@ -2516,6 +2528,10 @@ Please, select face, shell or solid and try again STB_DELETE Delete object + + STB_DISK + Create a disk + STB_DISPLAY Show object(s) @@ -2566,7 +2582,7 @@ Please, select face, shell or solid and try again STB_FACE - Build a face from wires and/or edges + Build a face STB_FACE_SEL_ONLY @@ -2988,6 +3004,10 @@ Please, select face, shell or solid and try again TOP_DELETE Delete object + + TOP_DISK + Build a Disk + TOP_DISPLAY Show diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index f94d3902d..3cc82bb0f 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -403,7 +403,9 @@ void GeometryGUI::OnGUIEvent( int id ) id == 4022 || // MENU PRIMITIVE - CYLINDER id == 4023 || // MENU PRIMITIVE - SPHERE id == 4024 || // MENU PRIMITIVE - TORUS - id == 4025 ) { // MENU PRIMITIVE - CONE + id == 4025 || // MENU PRIMITIVE - CONE + id == 4026 || // MENU PRIMITIVE - FACE + id == 4027 ) { // MENU PRIMITIVE - DISK #ifndef WNT library = getLibrary( "libPrimitiveGUI.so" ); #else @@ -759,6 +761,8 @@ void GeometryGUI::initialize( CAM_Application* app ) createGeomAction( 4023, "SPHERE" ); createGeomAction( 4024, "TORUS" ); createGeomAction( 4025, "CONE" ); + createGeomAction( 4026, "FACE" ); + createGeomAction( 4027, "DISK" ); createGeomAction( 4031, "EXTRUSION" ); createGeomAction( 4032, "REVOLUTION" ); @@ -899,6 +903,8 @@ void GeometryGUI::initialize( CAM_Application* app ) createMenu( 4023, primId, -1 ); createMenu( 4024, primId, -1 ); createMenu( 4025, primId, -1 ); + createMenu( 4026, primId, -1 ); + createMenu( 4027, primId, -1 ); int genId = createMenu( tr( "MEN_GENERATION" ), newEntId, -1 ); createMenu( 4031, genId, -1 ); @@ -1053,6 +1059,8 @@ void GeometryGUI::initialize( CAM_Application* app ) createTool( 4023, primTbId ); createTool( 4024, primTbId ); createTool( 4025, primTbId ); + createTool( 4026, primTbId ); + createTool( 4027, primTbId ); int boolTbId = createTool( tr( "TOOL_BOOLEAN" ) ); createTool( 5011, boolTbId ); diff --git a/src/GEOMImpl/GEOMImpl_DiskDriver.cxx b/src/GEOMImpl/GEOMImpl_DiskDriver.cxx new file mode 100755 index 000000000..da1ac16c5 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_DiskDriver.cxx @@ -0,0 +1,185 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library 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 +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_DiskDriver::GetID() +{ + static Standard_GUID aDiskDriver("C1FEEF9D-1C6D-41ce-9507-F10D75430CE1"); + return aDiskDriver; +} + + +//======================================================================= +//function : GEOMImpl_DiskDriver +//purpose : +//======================================================================= +GEOMImpl_DiskDriver::GEOMImpl_DiskDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_DiskDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IDisk aCI (aFunction); + Standard_Integer aType = aFunction->GetType(); + + TopoDS_Shape aShape; + + if (aType == DISK_PNT_VEC_R) { + Handle(GEOM_Function) aRefPoint = aCI.GetCenter(); + Handle(GEOM_Function) aRefVector = aCI.GetVector(); + TopoDS_Shape aShapePnt = aRefPoint->GetValue(); + TopoDS_Shape aShapeVec = aRefVector->GetValue(); + if (aShapePnt.ShapeType() == TopAbs_VERTEX && + aShapeVec.ShapeType() == TopAbs_EDGE) { + gp_Pnt aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt)); + TopoDS_Edge anE = TopoDS::Edge(aShapeVec); + TopoDS_Vertex V1, V2; + TopExp::Vertices(anE, V1, V2, Standard_True); + if (!V1.IsNull() && !V2.IsNull()) { + gp_Vec aV (BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2)); + gp_Ax2 anAxes (aP, aV); + gp_Circ aCirc (anAxes, aCI.GetRadius()); + TopoDS_Shape aCircle = BRepBuilderAPI_MakeEdge(aCirc).Edge(); + BRepBuilderAPI_MakeWire MW; + MW.Add(TopoDS::Edge(aCircle)); + BRepBuilderAPI_MakeFace MF (MW, Standard_False); + aShape = MF.Shape(); + } + } + } + else if (aType == DISK_THREE_PNT) { + Handle(GEOM_Function) aRefPoint1 = aCI.GetPoint1(); + Handle(GEOM_Function) aRefPoint2 = aCI.GetPoint2(); + Handle(GEOM_Function) aRefPoint3 = aCI.GetPoint3(); + TopoDS_Shape aShapePnt1 = aRefPoint1->GetValue(); + TopoDS_Shape aShapePnt2 = aRefPoint2->GetValue(); + TopoDS_Shape aShapePnt3 = aRefPoint3->GetValue(); + if (aShapePnt1.ShapeType() == TopAbs_VERTEX && + aShapePnt2.ShapeType() == TopAbs_VERTEX && + aShapePnt3.ShapeType() == TopAbs_VERTEX) { + gp_Pnt aP1 = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt1)); + gp_Pnt aP2 = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt2)); + gp_Pnt aP3 = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt3)); + if (aP1.Distance(aP2) < gp::Resolution() || + aP1.Distance(aP3) < gp::Resolution() || + aP2.Distance(aP3) < gp::Resolution()) + Standard_ConstructionError::Raise("Disk creation aborted: coincident points given"); + if (gp_Vec(aP1, aP2).IsParallel(gp_Vec(aP1, aP3), Precision::Angular())) + Standard_ConstructionError::Raise("Disk creation aborted: points lay on one line"); + Handle(Geom_Circle) aCirc = GC_MakeCircle(aP1, aP2, aP3).Value(); + TopoDS_Shape aCircle = BRepBuilderAPI_MakeEdge(aCirc).Edge(); + BRepBuilderAPI_MakeWire MW; + MW.Add(TopoDS::Edge(aCircle)); + BRepBuilderAPI_MakeFace MF (MW, Standard_False); + aShape = MF.Shape(); + } + } + else { + } + + if (aShape.IsNull()) return 0; + + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + return 1; +} + + +//======================================================================= +//function : GEOMImpl_DiskDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_DiskDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_DiskDriver", + sizeof(GEOMImpl_DiskDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_DiskDriver) Handle(GEOMImpl_DiskDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_DiskDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_DiskDriver))) { + _anOtherObject = Handle(GEOMImpl_DiskDriver)((Handle(GEOMImpl_DiskDriver)&)AnObject); + } + } + + return _anOtherObject ; +} diff --git a/src/GEOMImpl/GEOMImpl_DiskDriver.hxx b/src/GEOMImpl/GEOMImpl_DiskDriver.hxx new file mode 100755 index 000000000..fb2dd052d --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_DiskDriver.hxx @@ -0,0 +1,158 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library 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 +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : GEOMImpl_DiskDriver.ixx +// Module : GEOMImpl + +#ifndef _GEOMImpl_DiskDriver_HeaderFile +#define _GEOMImpl_DiskDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_DiskDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_DiskDriver); + +class Handle(GEOMImpl_DiskDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_DiskDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_DiskDriver)(const Handle(GEOMImpl_DiskDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_DiskDriver)(const GEOMImpl_DiskDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_DiskDriver)& operator=(const Handle(GEOMImpl_DiskDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_DiskDriver)& operator=(const GEOMImpl_DiskDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_DiskDriver* operator->() + { + return (GEOMImpl_DiskDriver *)ControlAccess(); + } + + GEOMImpl_DiskDriver* operator->() const + { + return (GEOMImpl_DiskDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_DiskDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_DiskDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_DiskDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_DiskDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_DiskDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_DiskDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_DiskDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_DiskDriver) == AType || TFunction_Driver::IsKind(AType)); } + + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_FaceDriver.cxx b/src/GEOMImpl/GEOMImpl_FaceDriver.cxx new file mode 100755 index 000000000..f4af15da2 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_FaceDriver.cxx @@ -0,0 +1,148 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library 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 +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_FaceDriver::GetID() +{ + static Standard_GUID aFaceDriver("F7953CC1-FF8B-4628-BF5E-9D3510DE4629"); + return aFaceDriver; +} + + +//======================================================================= +//function : GEOMImpl_FaceDriver +//purpose : +//======================================================================= +GEOMImpl_FaceDriver::GEOMImpl_FaceDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_FaceDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IFace aFI (aFunction); + Standard_Integer aType = aFunction->GetType(); + + TopoDS_Shape aShape; + + if (aType == FACE_PLANE_H_W) { + Handle(GEOM_Function) aRefPlane = aFI.GetRef1(); + TopoDS_Shape aShapePlane = aRefPlane->GetValue(); + double aH = aFI.GetH() / 2.0; + double aW = aFI.GetW() / 2.0; + gp_Ax3 anAx = GEOMImpl_IMeasureOperations::GetPosition(aShapePlane); + gp_Pln aPln (anAx); + aShape = BRepBuilderAPI_MakeFace(aPln, -aH, +aH, -aW, +aW).Shape(); + } + else if (aType == FACE_H_W) { + double aH = aFI.GetH() / 2.0; + double aW = aFI.GetW() / 2.0; + TopoDS_Vertex V1, V2; + gp_Pnt aP = gp::Origin(); + gp_Vec aV = gp::DZ(); + gp_Pln aPlane (aP, aV); + aShape = BRepBuilderAPI_MakeFace(aPlane, -aH, +aH, -aW, +aW).Shape(); + } + else { + } + + if (aShape.IsNull()) return 0; + + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + return 1; +} + + +//======================================================================= +//function : GEOMImpl_FaceDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_FaceDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_FaceDriver", + sizeof(GEOMImpl_FaceDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_FaceDriver) Handle(GEOMImpl_FaceDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_FaceDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_FaceDriver))) { + _anOtherObject = Handle(GEOMImpl_FaceDriver)((Handle(GEOMImpl_FaceDriver)&)AnObject); + } + } + + return _anOtherObject ; +} diff --git a/src/GEOMImpl/GEOMImpl_FaceDriver.hxx b/src/GEOMImpl/GEOMImpl_FaceDriver.hxx new file mode 100755 index 000000000..048d88ddb --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_FaceDriver.hxx @@ -0,0 +1,158 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library 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 +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : GEOMImpl_FaceDriver.ixx +// Module : GEOMImpl + +#ifndef _GEOMImpl_FaceDriver_HeaderFile +#define _GEOMImpl_FaceDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_FaceDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_FaceDriver); + +class Handle(GEOMImpl_FaceDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_FaceDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_FaceDriver)(const Handle(GEOMImpl_FaceDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_FaceDriver)(const GEOMImpl_FaceDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_FaceDriver)& operator=(const Handle(GEOMImpl_FaceDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_FaceDriver)& operator=(const GEOMImpl_FaceDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_FaceDriver* operator->() + { + return (GEOMImpl_FaceDriver *)ControlAccess(); + } + + GEOMImpl_FaceDriver* operator->() const + { + return (GEOMImpl_FaceDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_FaceDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_FaceDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_FaceDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_FaceDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_FaceDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_FaceDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_FaceDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_FaceDriver) == AType || TFunction_Driver::IsKind(AType)); } + + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_Gen.cxx b/src/GEOMImpl/GEOMImpl_Gen.cxx index ff5d2a26a..16e512673 100644 --- a/src/GEOMImpl/GEOMImpl_Gen.cxx +++ b/src/GEOMImpl/GEOMImpl_Gen.cxx @@ -44,6 +44,8 @@ #include #include #include +#include +#include #include #include #include @@ -101,6 +103,8 @@ GEOMImpl_Gen::GEOMImpl_Gen() // 3D Primitives TFunction_DriverTable::Get()->AddDriver(GEOMImpl_BoxDriver::GetID(), new GEOMImpl_BoxDriver()); + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_FaceDriver::GetID(), new GEOMImpl_FaceDriver()); + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_DiskDriver::GetID(), new GEOMImpl_DiskDriver()); TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ConeDriver::GetID(), new GEOMImpl_ConeDriver()); TFunction_DriverTable::Get()->AddDriver(GEOMImpl_CylinderDriver::GetID(), new GEOMImpl_CylinderDriver()); TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PrismDriver::GetID(), new GEOMImpl_PrismDriver()); diff --git a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx index e834e35bc..8b8e2bf4e 100644 --- a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx @@ -36,6 +36,8 @@ #include #include +#include +#include #include #include #include @@ -48,6 +50,8 @@ #include #include +#include +#include #include #include #include @@ -192,6 +196,230 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeBoxTwoPnt (Handle(GEOM_Objec return aBox; } +//============================================================================= +/*! + * MakeFaceHW + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFaceHW (double theH, double theW) +{ + SetErrorCode(KO); + + if (theH == 0 || theW == 0) return NULL; + + //Add a new Face object + Handle(GEOM_Object) aFace = GetEngine()->AddObject(GetDocID(), GEOM_FACE); + + //Add a new Box function for creation a box relatively to two points + Handle(GEOM_Function) aFunction = aFace->AddFunction(GEOMImpl_FaceDriver::GetID(), FACE_H_W); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_FaceDriver::GetID()) return aFace; + + GEOMImpl_IFace aFI (aFunction); + + aFI.SetH(theH); + aFI.SetW(theW); + + //Compute the Face + try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Face driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aFace << " = geompy.MakeFaceHW(" + << theH << ", " << theW << ")"; + + SetErrorCode(OK); + return aFace; +} + +//============================================================================= +/*! + * MakeFacePlaneHW + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFacePlaneHW (Handle(GEOM_Object) theFace, + double theH, double theW) +{ + SetErrorCode(KO); + + if (theFace.IsNull()) return NULL; + + //Add a new Face object + Handle(GEOM_Object) aFace = GetEngine()->AddObject(GetDocID(), GEOM_FACE); + + //Add a new Box function for creation a box relatively to two points + Handle(GEOM_Function) aFunction = aFace->AddFunction(GEOMImpl_FaceDriver::GetID(), FACE_PLANE_H_W); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_FaceDriver::GetID()) return aFace; + + GEOMImpl_IFace aFI (aFunction); + + Handle(GEOM_Function) aRefFunction1 = theFace->GetLastFunction(); + + if (aRefFunction1.IsNull()) + return aFace; + + aFI.SetRef1(aRefFunction1); + aFI.SetH(theH); + aFI.SetW(theW); + + //Compute the Face + try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Face driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aFace << " = geompy.MakeFacePlaneHW(" + << theFace << ", " << theH << ", " << theW << ")"; + + SetErrorCode(OK); + return aFace; +} + +//============================================================================= +/*! + * MakeDiskPntVecR + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeDiskPntVecR + (Handle(GEOM_Object) thePnt, Handle(GEOM_Object) theVec, double theR) +{ + SetErrorCode(KO); + + if (thePnt.IsNull() || theVec.IsNull()) return NULL; + + //Add a new Disk object + Handle(GEOM_Object) aDisk = GetEngine()->AddObject(GetDocID(), GEOM_FACE); + + //Add a new Disk function for creation a disk relatively to point and vector + Handle(GEOM_Function) aFunction = + aDisk->AddFunction(GEOMImpl_DiskDriver::GetID(), DISK_PNT_VEC_R); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_DiskDriver::GetID()) return NULL; + + GEOMImpl_IDisk aCI (aFunction); + + Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction(); + Handle(GEOM_Function) aRefVec = theVec->GetLastFunction(); + + if (aRefPnt.IsNull() || aRefVec.IsNull()) return NULL; + + aCI.SetCenter(aRefPnt); + aCI.SetVector(aRefVec); + aCI.SetRadius(theR); + + //Compute the Disk value + try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Disk driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aDisk << " = geompy.MakeDiskPntVecR(" + << thePnt << ", " << theVec << ", " << theR << ")"; + + SetErrorCode(OK); + return aDisk; +} + +//============================================================================= +/*! + * MakeDiskThreePnt + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeDiskThreePnt (Handle(GEOM_Object) thePnt1, + Handle(GEOM_Object) thePnt2, + Handle(GEOM_Object) thePnt3) +{ + SetErrorCode(KO); + + if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL; + + //Add a new Disk object + Handle(GEOM_Object) aDisk = GetEngine()->AddObject(GetDocID(), GEOM_FACE); + + //Add a new Disk function for creation a disk relatively to three points + Handle(GEOM_Function) aFunction = + aDisk->AddFunction(GEOMImpl_DiskDriver::GetID(), DISK_THREE_PNT); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_DiskDriver::GetID()) return NULL; + + GEOMImpl_IDisk aCI (aFunction); + + Handle(GEOM_Function) aRefPnt1 = thePnt1->GetLastFunction(); + Handle(GEOM_Function) aRefPnt2 = thePnt2->GetLastFunction(); + Handle(GEOM_Function) aRefPnt3 = thePnt3->GetLastFunction(); + + if (aRefPnt1.IsNull() || aRefPnt2.IsNull() || aRefPnt3.IsNull()) return NULL; + + aCI.SetPoint1(aRefPnt1); + aCI.SetPoint2(aRefPnt2); + aCI.SetPoint3(aRefPnt3); + + //Compute the Disk value + try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Disk driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aDisk << " = geompy.MakeDiskThreePnt(" + << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ")"; + + SetErrorCode(OK); + return aDisk; +} //============================================================================= /*! diff --git a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx index 707a0ca4e..522fd9b87 100644 --- a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx @@ -35,8 +35,16 @@ class GEOMImpl_I3DPrimOperations : public GEOM_IOperations { Standard_EXPORT Handle(GEOM_Object) MakeBoxDXDYDZ (double theDX, double theDY, double theDZ); Standard_EXPORT Handle(GEOM_Object) MakeBoxTwoPnt (Handle(GEOM_Object) thePnt1, - Handle(GEOM_Object) thePnt2); - + Handle(GEOM_Object) thePnt2); + Standard_EXPORT Handle(GEOM_Object) MakeFaceHW (double theH, double theW); + Standard_EXPORT Handle(GEOM_Object) MakeFacePlaneHW (Handle(GEOM_Object) theFace, + double theH, double theW); + Standard_EXPORT Handle(GEOM_Object) MakeDiskThreePnt (Handle(GEOM_Object) thePnt1, + Handle(GEOM_Object) thePnt2, + Handle(GEOM_Object) thePnt3); + Standard_EXPORT Handle(GEOM_Object) MakeDiskPntVecR (Handle(GEOM_Object) thePnt1, + Handle(GEOM_Object) theVec, + double theR); Standard_EXPORT Handle(GEOM_Object) MakeCylinderRH (double theR, double theH); Standard_EXPORT Handle(GEOM_Object) MakeCylinderPntVecRH (Handle(GEOM_Object) thePnt, Handle(GEOM_Object) theVec, diff --git a/src/GEOMImpl/GEOMImpl_IDisk.hxx b/src/GEOMImpl/GEOMImpl_IDisk.hxx new file mode 100755 index 000000000..79651b593 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IDisk.hxx @@ -0,0 +1,60 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library 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 +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +//NOTE: This is an intreface to a function for the Disk creation. + + +#include "GEOM_Function.hxx" + +#define DISK_ARG_P1 1 +#define DISK_ARG_P2 2 +#define DISK_ARG_P3 3 + +#define DISK_ARG_CC 4 +#define DISK_ARG_VV 5 +#define DISK_ARG_RR 6 + +class GEOMImpl_IDisk +{ + public: + + GEOMImpl_IDisk(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetPoint1(Handle(GEOM_Function) theP) { _func->SetReference(DISK_ARG_P1, theP); } + void SetPoint2(Handle(GEOM_Function) theP) { _func->SetReference(DISK_ARG_P2, theP); } + void SetPoint3(Handle(GEOM_Function) theP) { _func->SetReference(DISK_ARG_P3, theP); } + + void SetCenter(Handle(GEOM_Function) theP) { _func->SetReference(DISK_ARG_CC, theP); } + void SetVector(Handle(GEOM_Function) theV) { _func->SetReference(DISK_ARG_VV, theV); } + + void SetRadius(double theR) { _func->SetReal(DISK_ARG_RR, theR); } + + Handle(GEOM_Function) GetPoint1() { return _func->GetReference(DISK_ARG_P1); } + Handle(GEOM_Function) GetPoint2() { return _func->GetReference(DISK_ARG_P2); } + Handle(GEOM_Function) GetPoint3() { return _func->GetReference(DISK_ARG_P3); } + + Handle(GEOM_Function) GetCenter() { return _func->GetReference(DISK_ARG_CC); } + Handle(GEOM_Function) GetVector() { return _func->GetReference(DISK_ARG_VV); } + + double GetRadius() { return _func->GetReal(DISK_ARG_RR); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_IFace.hxx b/src/GEOMImpl/GEOMImpl_IFace.hxx new file mode 100755 index 000000000..55fe2eec9 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IFace.hxx @@ -0,0 +1,57 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library 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 +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +//NOTE: This is an intreface to a function for the Face creation. + + +#include "GEOM_Function.hxx" + +#define FACE_ARG_REF1 1 +#define FACE_ARG_REF2 2 +#define FACE_ARG_REF3 3 + +#define FACE_ARG_PLANE 4 +#define FACE_ARG_H 5 +#define FACE_ARG_W 6 + +class GEOMImpl_IFace +{ + public: + + GEOMImpl_IFace(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetRef1(Handle(GEOM_Function) theRefPoint1) { _func->SetReference(FACE_ARG_REF1, theRefPoint1); } + Handle(GEOM_Function) GetRef1() { return _func->GetReference(FACE_ARG_REF1); } + + void SetRef2(Handle(GEOM_Function) theRefPoint2) { _func->SetReference(FACE_ARG_REF2, theRefPoint2); } + Handle(GEOM_Function) GetRef2() { return _func->GetReference(FACE_ARG_REF2); } + + void SetRef3(Handle(GEOM_Function) theRefVec) { _func->SetReference(FACE_ARG_REF3, theRefVec); } + Handle(GEOM_Function) GetRef3() { return _func->GetReference(FACE_ARG_REF3); } + + void SetH(double theH) { _func->SetReal(FACE_ARG_H, theH); } + void SetW(double theW) { _func->SetReal(FACE_ARG_W, theW); } + + double GetH() { return _func->GetReal(FACE_ARG_H); } + double GetW() { return _func->GetReal(FACE_ARG_W); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_Types.hxx b/src/GEOMImpl/GEOMImpl_Types.hxx index 1a6ec8907..2747a1e34 100755 --- a/src/GEOMImpl/GEOMImpl_Types.hxx +++ b/src/GEOMImpl/GEOMImpl_Types.hxx @@ -158,6 +158,12 @@ #define BOX_DX_DY_DZ 1 #define BOX_TWO_PNT 2 +#define FACE_PLANE_H_W 1 +#define FACE_H_W 2 + +#define DISK_PNT_VEC_R 1 +#define DISK_THREE_PNT 2 + #define CYLINDER_R_H 1 #define CYLINDER_PNT_VEC_R_H 2 diff --git a/src/GEOMImpl/Makefile.am b/src/GEOMImpl/Makefile.am index 0c025b8b7..1df11ecab 100644 --- a/src/GEOMImpl/Makefile.am +++ b/src/GEOMImpl/Makefile.am @@ -75,6 +75,8 @@ dist_libGEOMimpl_la_SOURCES = \ GEOMImpl_ScaleDriver.cxx \ GEOMImpl_PositionDriver.cxx \ GEOMImpl_BoxDriver.cxx \ + GEOMImpl_FaceDriver.cxx \ + GEOMImpl_DiskDriver.cxx \ GEOMImpl_ConeDriver.cxx \ GEOMImpl_CylinderDriver.cxx \ GEOMImpl_SphereDriver.cxx \ diff --git a/src/GEOM_I/GEOM_I3DPrimOperations_i.cc b/src/GEOM_I/GEOM_I3DPrimOperations_i.cc index 6689cf345..fbf4829f7 100644 --- a/src/GEOM_I/GEOM_I3DPrimOperations_i.cc +++ b/src/GEOM_I/GEOM_I3DPrimOperations_i.cc @@ -103,6 +103,131 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeBoxTwoPnt return GetObject(anObject); } +//============================================================================= +/*! + * MakeFaceHW + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFaceHW (CORBA::Double theH, + CORBA::Double theW) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theH == 0 || theW == 0) + return aGEOMObject._retn(); + + //Create the Face + Handle(GEOM_Object) anObject = GetOperations()->MakeFaceHW(theH, theW); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeFacePlaneHW + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFacePlaneHW + (GEOM::GEOM_Object_ptr theFace, + CORBA::Double theH, + CORBA::Double theW) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theFace == NULL || theH == 0 || theW == 0) + return aGEOMObject._retn(); + + //Get the reference points + Handle(GEOM_Object) aFace = GetOperations()->GetEngine()->GetObject + (theFace->GetStudyID(), theFace->GetEntry()); + + if (aFace.IsNull()) + return aGEOMObject._retn(); + + //Create the Face + Handle(GEOM_Object) anObject = GetOperations()->MakeFacePlaneHW(aFace, theH, theW); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeDiskPntVecR + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskPntVecR + (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec, + CORBA::Double theR) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn(); + + //Get the reference points + Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject + (thePnt->GetStudyID(), thePnt->GetEntry()); + Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject + (theVec->GetStudyID(), theVec->GetEntry()); + + if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn(); + + // Make Disk + Handle(GEOM_Object) anObject = + GetOperations()->MakeDiskPntVecR(aPnt, aVec, theR); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeDiskThreePnt + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskThreePnt + (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (thePnt1 == NULL || thePnt2 == NULL || thePnt3 == NULL) return aGEOMObject._retn(); + + //Get the reference points + Handle(GEOM_Object) aPnt1 = GetOperations()->GetEngine()->GetObject + (thePnt1->GetStudyID(), thePnt1->GetEntry()); + Handle(GEOM_Object) aPnt2 = GetOperations()->GetEngine()->GetObject + (thePnt2->GetStudyID(), thePnt2->GetEntry()); + Handle(GEOM_Object) aPnt3 = GetOperations()->GetEngine()->GetObject + (thePnt3->GetStudyID(), thePnt3->GetEntry()); + + if (aPnt1.IsNull() || aPnt2.IsNull() || aPnt3.IsNull()) return aGEOMObject._retn(); + + // Make Disk + Handle(GEOM_Object) anObject = + GetOperations()->MakeDiskThreePnt(aPnt1, aPnt2, aPnt3); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + //============================================================================= /*! * MakeCylinderRH diff --git a/src/GEOM_I/GEOM_I3DPrimOperations_i.hh b/src/GEOM_I/GEOM_I3DPrimOperations_i.hh index d661684bd..e4edeb0cf 100644 --- a/src/GEOM_I/GEOM_I3DPrimOperations_i.hh +++ b/src/GEOM_I/GEOM_I3DPrimOperations_i.hh @@ -46,6 +46,21 @@ class GEOM_I_EXPORT GEOM_I3DPrimOperations_i : GEOM::GEOM_Object_ptr MakeBoxTwoPnt (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2); + + GEOM::GEOM_Object_ptr MakeFaceHW (CORBA::Double theH, + CORBA::Double theW); + + GEOM::GEOM_Object_ptr MakeFacePlaneHW (GEOM::GEOM_Object_ptr theFace, + CORBA::Double theH, + CORBA::Double theW); + + GEOM::GEOM_Object_ptr MakeDiskPntVecR (GEOM::GEOM_Object_ptr theCenter, + GEOM::GEOM_Object_ptr theVector, + double theR); + + GEOM::GEOM_Object_ptr MakeDiskThreePnt (GEOM::GEOM_Object_ptr thePnt1, + GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3); GEOM::GEOM_Object_ptr MakeCylinderRH (CORBA::Double theR, CORBA::Double theH); diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.cc b/src/GEOM_I_Superv/GEOM_Superv_i.cc index 3df6f396f..3a37d3102 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.cc +++ b/src/GEOM_I_Superv/GEOM_Superv_i.cc @@ -771,6 +771,65 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeBoxTwoPnt (GEOM::GEOM_Object_ptr thePnt return anObj; } +//============================================================================= +// MakeFaceHW: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFaceHW (CORBA::Double theH, + CORBA::Double theW) +{ + beginService( " GEOM_Superv_i::MakeFaceHW" ); + MESSAGE("GEOM_Superv_i::MakeFaceHW"); + get3DPrimOp(); + GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakeFaceHW(theH, theW); + endService( " GEOM_Superv_i::MakeFaceHW" ); + return anObj; +} + +//============================================================================= +// MakeFaceTwoPlaneHW: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFacePlaneHW (GEOM::GEOM_Object_ptr theFace, + CORBA::Double theH, + CORBA::Double theW) +{ + beginService( " GEOM_Superv_i::MakeFacePlaneHW" ); + MESSAGE("GEOM_Superv_i::MakeFacePlaneHW"); + get3DPrimOp(); + GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakeFacePlaneHW(theFace, theH, theW); + endService( " GEOM_Superv_i::MakeFacePlaneHW" ); + return anObj; +} + +//============================================================================= +// MakeDiskPntVecR: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeDiskPntVecR (GEOM::GEOM_Object_ptr theCenter, + GEOM::GEOM_Object_ptr theVector, + CORBA::Double theR) +{ + beginService( " GEOM_Superv_i::MakeDiskPntVecR" ); + MESSAGE("GEOM_Superv_i::MakeDiskPntVecR"); + get3DPrimOp(); + GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakeDiskPntVecR(theCenter, theVector, theR); + endService( " GEOM_Superv_i::MakeDiskPntVecR" ); + return anObj; +} + +//============================================================================= +// MakeDiskThreePnt: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeDiskThreePnt (GEOM::GEOM_Object_ptr thePnt1, + GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3) +{ + beginService( " GEOM_Superv_i::MakeDiskThreePnt" ); + MESSAGE("GEOM_Superv_i::MakeDiskThreePnt"); + get3DPrimOp(); + GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakeDiskThreePnt(thePnt1, thePnt2, thePnt3); + endService( " GEOM_Superv_i::MakeDiskThreePnt" ); + return anObj; +} + //============================================================================= // MakeCylinderPntVecRH: //============================================================================= diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.hh b/src/GEOM_I_Superv/GEOM_Superv_i.hh index d5e03edee..deea12244 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.hh +++ b/src/GEOM_I_Superv/GEOM_Superv_i.hh @@ -187,6 +187,17 @@ public: CORBA::Double theDZ); GEOM::GEOM_Object_ptr MakeBoxTwoPnt (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2); + GEOM::GEOM_Object_ptr MakeFaceHW (CORBA::Double theH, + CORBA::Double theW); + GEOM::GEOM_Object_ptr MakeFacePlaneHW (GEOM::GEOM_Object_ptr theFace, + CORBA::Double theH, + CORBA::Double theW); + GEOM::GEOM_Object_ptr MakeDiskPntVecR (GEOM::GEOM_Object_ptr theCenter, + GEOM::GEOM_Object_ptr theVector, + CORBA::Double theR); + GEOM::GEOM_Object_ptr MakeDiskThreePnt (GEOM::GEOM_Object_ptr thePnt1, + GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3); GEOM::GEOM_Object_ptr MakeCylinderPntVecRH (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theAxis, CORBA::Double theRadius, diff --git a/src/GEOM_SWIG/GEOM_TestAll.py b/src/GEOM_SWIG/GEOM_TestAll.py index 17057005c..9760f4fff 100644 --- a/src/GEOM_SWIG/GEOM_TestAll.py +++ b/src/GEOM_SWIG/GEOM_TestAll.py @@ -138,6 +138,10 @@ def TestAll (geompy, math): Face1 = geompy.MakeFaceWires([Wire, Sketcher], WantPlanarFace) #(List of GEOM_Object_ptr, Boolean)->GEOM_Object_ptr Face2 = geompy.MakeFace(Sketcher, WantPlanarFace) + Face3 = geompy.MakeFaceHW (100., 200.) #(2 Doubles)->GEOM_Object_ptr + Face4 = geompy.MakeFacePlaneHW (Face, 200., 200.)#(1 GEOM_Object_ptr, 2 Doubles)->GEOM_Object_ptr + Disk = geompy.MakeDiskPntVecR (p0, vz, radius) #(2 GEOM_Object_ptr, 1 Double)->GEOM_Object_ptr + Disk2 = geompy.MakeDiskThreePnt(p0, p200, pz) #(3 GEOM_Object_ptr)->GEOM_Object_ptr Shell = geompy.MakeShell([Face, Face1]) #(List of GEOM_Object_ptr)->GEOM_Object_ptr Prism1 = geompy.MakePrism(Face2, p0, pxyz) #(3 GEOM_Object_ptr)->GEOM_Object_ptr @@ -324,6 +328,10 @@ def TestAll (geompy, math): id_Face = geompy.addToStudy(Face, "Face") id_Face1 = geompy.addToStudy(Face1, "Face from two wires") id_Face2 = geompy.addToStudy(Face2, "Face from Sketcher") + id_Face3 = geompy.addToStudy(Face3, "Face Height Width") + id_Face4 = geompy.addToStudy(Face4, "Face Plane_HW") + id_Disk = geompy.addToStudy(Disk, "Disk PntVecR") + id_Disk2 = geompy.addToStudy(Disk2, "Disk Three Points") id_Shell = geompy.addToStudy(Shell, "Shell") id_p_on_face = geompy.addToStudy(p_on_face, "Vertex on Face (0.1, 0.8)") diff --git a/src/GEOM_SWIG/geompyDC.py b/src/GEOM_SWIG/geompyDC.py index fcc2d4028..8b1db20ef 100644 --- a/src/GEOM_SWIG/geompyDC.py +++ b/src/GEOM_SWIG/geompyDC.py @@ -679,6 +679,57 @@ class geompyDC(GEOM._objref_GEOM_Gen): anObj = self.PrimOp.MakeBoxTwoPnt(thePnt1, thePnt2) RaiseIfFailed("MakeBoxTwoPnt", self.PrimOp) return anObj + + ## Create a face with specified dimensions along OX-OY coordinate axes, + # with edges, parallel to this coordinate axes. + # @param theH length of Face edge, parallel to OX axis. + # @param theW length of Face edge, parallel to OY axis. + # @return New GEOM_Object, containing the created face. + # + # @ref tui_creation_face "Example" + def MakeFaceHW(self,theH, theW): + # Example: see GEOM_TestAll.py + anObj = self.PrimOp.MakeFaceHW(theH, theW) + RaiseIfFailed("MakeFaceHW", self.PrimOp) + return anObj + + ## Create a face from another plane and two sizes, + # vertical size and horisontal size. + # @param thePlane Plane in that axis will be create new face. + # @param theH Height (vertical size). + # @param theW Width (horisontal size). + # @return New GEOM_Object, containing the created face. + # + # @ref tui_creation_face "Example" + def MakeFacePlaneHW(self, theFace, theH, theW): + # Example: see GEOM_TestAll.py + anObj = self.PrimOp.MakeFacePlaneHW(theFace, theH, theW) + RaiseIfFailed("MakeFacePlaneHW", self.PrimOp) + return anObj + + ## Create a disk with given center, normal vector and radius. + # @param thePnt Disk center. + # @param theVec Vector, normal to the plane of the disk. + # @param theR Disk radius. + # @return New GEOM_Object, containing the created disk. + # + # @ref tui_creation_disk "Example" + def MakeDiskPntVecR(self,thePnt, theVec, theR): + # Example: see GEOM_TestAll.py + anObj = self.PrimOp.MakeDiskPntVecR(thePnt, theVec, theR) + RaiseIfFailed("MakeDiskPntVecR", self.PrimOp) + return anObj + + ## Create a disk, passing through three given points + # @param thePnt1,thePnt2,thePnt3 Points, defining the disk. + # @return New GEOM_Object, containing the created disk. + # + # @ref tui_creation_disk "Example" + def MakeDiskThreePnt(self,thePnt1, thePnt2, thePnt3): + # Example: see GEOM_TestAll.py + anObj = self.PrimOp.MakeDiskThreePnt(thePnt1, thePnt2, thePnt3) + RaiseIfFailed("MakeDiskThreePnt", self.PrimOp) + return anObj ## Create a cylinder with given base point, axis, radius and height. # @param thePnt Central point of cylinder base. diff --git a/src/PrimitiveGUI/Makefile.am b/src/PrimitiveGUI/Makefile.am index 896585a6a..f919d9c2a 100644 --- a/src/PrimitiveGUI/Makefile.am +++ b/src/PrimitiveGUI/Makefile.am @@ -37,20 +37,26 @@ dist_libPrimitiveGUI_la_SOURCES = \ PrimitiveGUI_CylinderDlg.h \ PrimitiveGUI_SphereDlg.h \ PrimitiveGUI_TorusDlg.h \ + PrimitiveGUI_FaceDlg.h \ + PrimitiveGUI_DiskDlg.h \ \ PrimitiveGUI.cxx \ PrimitiveGUI_BoxDlg.cxx \ PrimitiveGUI_CylinderDlg.cxx \ PrimitiveGUI_SphereDlg.cxx \ PrimitiveGUI_TorusDlg.cxx \ - PrimitiveGUI_ConeDlg.cxx + PrimitiveGUI_ConeDlg.cxx \ + PrimitiveGUI_FaceDlg.cxx \ + PrimitiveGUI_DiskDlg.cxx MOC_FILES = \ PrimitiveGUI_BoxDlg_moc.cxx \ PrimitiveGUI_CylinderDlg_moc.cxx \ PrimitiveGUI_SphereDlg_moc.cxx \ PrimitiveGUI_TorusDlg_moc.cxx \ - PrimitiveGUI_ConeDlg_moc.cxx + PrimitiveGUI_ConeDlg_moc.cxx \ + PrimitiveGUI_FaceDlg_moc.cxx \ + PrimitiveGUI_DiskDlg_moc.cxx nodist_libPrimitiveGUI_la_SOURCES = \ $(MOC_FILES) diff --git a/src/PrimitiveGUI/PrimitiveGUI.cxx b/src/PrimitiveGUI/PrimitiveGUI.cxx index dafd9339f..c3bd4f2ee 100644 --- a/src/PrimitiveGUI/PrimitiveGUI.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI.cxx @@ -35,6 +35,8 @@ #include "PrimitiveGUI_SphereDlg.h" // Method SPHERE #include "PrimitiveGUI_TorusDlg.h" // Method TORUS #include "PrimitiveGUI_ConeDlg.h" // Method CONE +#include "PrimitiveGUI_FaceDlg.h" // Method FACE +#include "PrimitiveGUI_DiskDlg.h" // Method DISK //======================================================================= // function : PrimitiveGUI() @@ -81,6 +83,12 @@ bool PrimitiveGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) case 4025: // CONE aDlg = new PrimitiveGUI_ConeDlg( getGeometryGUI(), parent); break; + case 4026: // FACE + aDlg = new PrimitiveGUI_FaceDlg( getGeometryGUI(), parent); + break; + case 4027: // DISK + aDlg = new PrimitiveGUI_DiskDlg( getGeometryGUI(), parent); + break; default: app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); break; diff --git a/src/PrimitiveGUI/PrimitiveGUI_DiskDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_DiskDlg.cxx new file mode 100755 index 000000000..72463078f --- /dev/null +++ b/src/PrimitiveGUI/PrimitiveGUI_DiskDlg.cxx @@ -0,0 +1,510 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library 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 +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : PrimitiveGUI_DiskDlg.cxx +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. +// + +#include "PrimitiveGUI_DiskDlg.h" + +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +//================================================================================= +// class : PrimitiveGUI_DiskDlg() +// purpose : Constructs a PrimitiveGUI_DiskDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +PrimitiveGUI_DiskDlg::PrimitiveGUI_DiskDlg( GeometryGUI* theGeometryGUI, QWidget* parent, + bool modal, Qt::WindowFlags fl ) + : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) +{ + QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_DISK_PNT_VEC_R" ) ) ); + QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); + QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_DISK_THREE_POINTS" ) ) ); + + setWindowTitle( tr( "GEOM_DISK_TITLE" ) ); + + /***************************************************************/ + mainFrame()->GroupConstructors->setTitle( tr( "GEOM_DISK" ) ); + mainFrame()->RadioButton1->setIcon( image0 ); + mainFrame()->RadioButton2->setIcon( image2 ); + mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->RadioButton3->close(); + + GroupPntVecR = new DlgRef_2Sel1Spin( centralWidget() ); + + GroupPntVecR->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) ); + GroupPntVecR->TextLabel1->setText( tr( "GEOM_CENTER_POINT" ) ); + GroupPntVecR->TextLabel2->setText( tr( "GEOM_VECTOR" ) ); + GroupPntVecR->TextLabel3->setText( tr( "GEOM_RADIUS" ) ); + GroupPntVecR->PushButton1->setIcon( image1 ); + GroupPntVecR->PushButton2->setIcon( image1 ); + + GroupPntVecR->LineEdit1->setReadOnly( true ); + GroupPntVecR->LineEdit2->setReadOnly( true ); + + Group3Pnts = new DlgRef_3Sel( centralWidget() ); + + Group3Pnts->GroupBox1->setTitle( tr( "GEOM_3_POINTS" ) ); + Group3Pnts->TextLabel1->setText( tr( "GEOM_POINT1" ) ); + Group3Pnts->TextLabel2->setText( tr( "GEOM_POINT2" ) ); + Group3Pnts->TextLabel3->setText( tr( "GEOM_POINT3" ) ); + Group3Pnts->PushButton1->setIcon( image1 ); + Group3Pnts->PushButton2->setIcon( image1 ); + Group3Pnts->PushButton3->setIcon( image1 ); + + Group3Pnts->LineEdit1->setReadOnly( true ); + Group3Pnts->LineEdit2->setReadOnly( true ); + Group3Pnts->LineEdit3->setReadOnly( true ); + + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); + layout->setMargin( 0 ); layout->setSpacing( 6 ); + layout->addWidget( GroupPntVecR ); + layout->addWidget( Group3Pnts ); + /***************************************************************/ + + setHelpFileName( "create_disk_page.html" ); + + Init(); +} + + +//================================================================================= +// function : ~PrimitiveGUI_DiskDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +PrimitiveGUI_DiskDlg::~PrimitiveGUI_DiskDlg() +{ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void PrimitiveGUI_DiskDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPntVecR->LineEdit1; + + myPoint = myDir = myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil(); + + /* Get setting of step value from file configuration */ + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double aStep = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 ); + + /* min, max, step and decimals for spin boxes & initial values */ + initSpinBox( GroupPntVecR->SpinBox_DX, 0.001, COORD_MAX, aStep, 3 ); // VSR:TODO : DBL_DIGITS_DISPLAY + GroupPntVecR->SpinBox_DX->setValue( 100 ); + + /* signals and slots connections */ + connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ); + connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ); + + connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); + + connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); + + connect( GroupPntVecR->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( GroupPntVecR->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( GroupPntVecR->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( GroupPntVecR->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + + connect( Group3Pnts->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( Group3Pnts->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( Group3Pnts->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( Group3Pnts->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( Group3Pnts->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( Group3Pnts->LineEdit3, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + + connect( GroupPntVecR->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT(ValueChangedInSpinBox() ) ); + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) ); + + connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), + this, SLOT( SelectionIntoArgument() ) ); + + initName( tr( "GEOM_DISK" ) ); + + ConstructorsClicked( 0 ); +} + +//================================================================================= +// function : SetDoubleSpinBoxStep() +// purpose : Double spin box management +//================================================================================= +void PrimitiveGUI_DiskDlg::SetDoubleSpinBoxStep( double step ) +{ + GroupPntVecR->SpinBox_DX->setSingleStep(step); +} + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void PrimitiveGUI_DiskDlg::ConstructorsClicked( int constructorId ) +{ + disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0); + + myPoint = myDir = myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil(); + + switch ( constructorId ) { + case 0: + { + Group3Pnts->hide(); + GroupPntVecR->show(); + + myEditCurrentArgument = GroupPntVecR->LineEdit1; + GroupPntVecR->LineEdit1->setText( "" ); + GroupPntVecR->LineEdit2->setText( "" ); + break; + } + case 1: + { + GroupPntVecR->hide(); + Group3Pnts->show(); + + myEditCurrentArgument = Group3Pnts->LineEdit1; + Group3Pnts->LineEdit1->setText( "" ); + Group3Pnts->LineEdit2->setText( "" ); + Group3Pnts->LineEdit3->setText( "" ); + break; + } + } + + qApp->processEvents(); + updateGeometry(); + resize( minimumSize() ); + + myEditCurrentArgument->setFocus(); + globalSelection(); // close local contexts, if any + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + + connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged() ), + this, SLOT( SelectionIntoArgument() ) ); +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void PrimitiveGUI_DiskDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool PrimitiveGUI_DiskDlg::ClickOnApply() +{ + if ( !onAccept() ) + return false; + + initName(); + ConstructorsClicked( getConstructorId() ); + return true; +} + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void PrimitiveGUI_DiskDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText( "" ); + + LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); + SALOME_ListIO aList; + aSelMgr->selectedObjects( aList ); + + if ( aList.Extent() != 1 ) { + if ( myEditCurrentArgument == GroupPntVecR->LineEdit1 ) myPoint = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) myDir = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = GEOM::GEOM_Object::_nil(); + return; + } + + // nbSel == 1 + Handle(SALOME_InteractiveObject) anIO = aList.First(); + + Standard_Boolean aRes = Standard_False; + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(anIO, aRes); + if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { + QString aName = GEOMBase::GetName( aSelectedObject ); + + // If selected Vertex or Edge on the some Shape Get selection Subshape + TopoDS_Shape aShape; + if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { + TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX; + if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) + aNeedType = TopAbs_EDGE; + + TColStd_IndexedMapOfInteger aMap; + aSelMgr->GetIndexes(anIO, aMap); + if ( aMap.Extent() == 1 ) { // Local Selection + int anIndex = aMap(1); + if ( aNeedType == TopAbs_EDGE ) + aName += QString( ":edge_%1" ).arg( anIndex ); + else + aName += QString( ":vertex_%1" ).arg( anIndex ); + + //Find SubShape Object in Father + GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather( aSelectedObject, aName ); + + if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study + GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() ); + aSelectedObject = aShapesOp->GetSubShape( aSelectedObject, anIndex ); + } + else { + aSelectedObject = aFindedObject; // get Object from study + } + } + else { // Global Selection + if ( aShape.ShapeType() != aNeedType ) { + aSelectedObject = GEOM::GEOM_Object::_nil(); + aName = ""; + } + } + } + + myEditCurrentArgument->setText( aName ); + + if ( myEditCurrentArgument == GroupPntVecR->LineEdit1 ) myPoint = aSelectedObject; + else if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) myDir = aSelectedObject; + else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = aSelectedObject; + else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = aSelectedObject; + else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = aSelectedObject; + } + + displayPreview(); +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void PrimitiveGUI_DiskDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if ( send == GroupPntVecR->PushButton1 ) myEditCurrentArgument = GroupPntVecR->LineEdit1; + else if ( send == GroupPntVecR->PushButton2 ) myEditCurrentArgument = GroupPntVecR->LineEdit2; + else if ( send == Group3Pnts->PushButton1 ) myEditCurrentArgument = Group3Pnts->LineEdit1; + else if ( send == Group3Pnts->PushButton2 ) myEditCurrentArgument = Group3Pnts->LineEdit2; + else if ( send == Group3Pnts->PushButton3 ) myEditCurrentArgument = Group3Pnts->LineEdit3; + + myEditCurrentArgument->setFocus(); + + if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) { + globalSelection(); // close local contexts, if any + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); + } + else { + globalSelection(); // close local contexts, if any + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + } + + SelectionIntoArgument(); +} + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void PrimitiveGUI_DiskDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if ( send == GroupPntVecR->LineEdit1 || + send == GroupPntVecR->LineEdit2 || + send == Group3Pnts->LineEdit1 || + send == Group3Pnts->LineEdit2 || + send == Group3Pnts->LineEdit3 ) { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void PrimitiveGUI_DiskDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + + connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), + this, SLOT( SelectionIntoArgument() ) ); + + ConstructorsClicked( getConstructorId() ); +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void PrimitiveGUI_DiskDlg::enterEvent( QEvent* ) +{ + if ( !mainFrame()->GroupConstructors->isEnabled() ) + ActivateThisDialog(); +} + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : public slot to deactivate if active +//================================================================================= +void PrimitiveGUI_DiskDlg::DeactivateActiveDialog() +{ + // myGeomGUI->SetState( -1 ); + GEOMBase_Skeleton::DeactivateActiveDialog(); +} + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void PrimitiveGUI_DiskDlg::ValueChangedInSpinBox() +{ + displayPreview(); +} + +//================================================================================= +// function : getRadius() +// purpose : +//================================================================================= +double PrimitiveGUI_DiskDlg::getRadius() const +{ + double r = 0.; + switch ( getConstructorId() ) { + case 0: + r = GroupPntVecR->SpinBox_DX->value(); break; + } + return r; +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr PrimitiveGUI_DiskDlg::createOperation() +{ + return myGeomGUI->GetGeomGen()->GetI3DPrimOperations( getStudyId() ); +} + +//================================================================================= +// function : isEqual +// purpose : it may also be needed to check for min distance between gp_Pnt-s... +//================================================================================= +static bool isEqual( const GEOM::GEOM_Object_var& thePnt1, const GEOM::GEOM_Object_var& thePnt2 ) +{ + return thePnt1->_is_equivalent( thePnt2 ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool PrimitiveGUI_DiskDlg::isValid( QString& msg ) +{ + const int id = getConstructorId(); + if ( id == 0 ) + return !myPoint->_is_nil() && !myDir->_is_nil() && getRadius() > 0; + else if ( id == 1 ) + return !myPoint1->_is_nil() && !myPoint2->_is_nil() && !myPoint3->_is_nil() && + !isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 ); + return false; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool PrimitiveGUI_DiskDlg::execute( ObjectList& objects ) +{ + bool res = false; + + GEOM::GEOM_Object_var anObj; + + switch ( getConstructorId() ) { + case 0 : + anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeDiskPntVecR( myPoint, myDir, getRadius() ); + res = true; + break; + case 1 : + anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeDiskThreePnt( myPoint1, myPoint2, myPoint3 ); + res = true; + break; + } + + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + else { + MESSAGE( "Execute Object is NULL!" ); + } + + return res; +} + +//================================================================================= +// function : addSubshapeToStudy +// purpose : virtual method to add new SubObjects if local selection +//================================================================================= +void PrimitiveGUI_DiskDlg::addSubshapesToStudy() +{ + QMap objMap; + + switch ( getConstructorId() ) { + case 0: + objMap[GroupPntVecR->LineEdit1->text()] = myPoint; + objMap[GroupPntVecR->LineEdit2->text()] = myDir; + break; + case 1: + objMap[Group3Pnts->LineEdit1->text()] = myPoint1; + objMap[Group3Pnts->LineEdit2->text()] = myPoint2; + objMap[Group3Pnts->LineEdit3->text()] = myPoint3; + break; + } + addSubshapesToFather( objMap ); +} diff --git a/src/PrimitiveGUI/PrimitiveGUI_DiskDlg.h b/src/PrimitiveGUI/PrimitiveGUI_DiskDlg.h new file mode 100755 index 000000000..34752589e --- /dev/null +++ b/src/PrimitiveGUI/PrimitiveGUI_DiskDlg.h @@ -0,0 +1,81 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library 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 +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : PrimitiveGUI_DiskDlg.h +// Author : Dmitry Matveitchev, OCN +// + +#ifndef BASICGUI_DISKDLG_H +#define BASICGUI_DISKDLG_H + +#include + +class DlgRef_3Sel; +class DlgRef_2Sel1Spin; + +//================================================================================= +// class : PrimitiveGUI_DiskDlg +// purpose : +//================================================================================= +class PrimitiveGUI_DiskDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + PrimitiveGUI_DiskDlg( GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0 ); + ~PrimitiveGUI_DiskDlg(); + +protected: + // redefined from GEOMBase_Helper + virtual GEOM::GEOM_IOperations_ptr createOperation(); + virtual bool isValid( QString& ); + virtual bool execute( ObjectList& ); + + virtual void addSubshapesToStudy(); + +private: + void Init(); + void enterEvent( QEvent* ); + double getRadius() const; + +private: + GEOM::GEOM_Object_var myPoint, myDir, myPoint1, myPoint2, myPoint3; + + DlgRef_2Sel1Spin* GroupPntVecR; + DlgRef_3Sel* Group3Pnts; + +private slots: + void ClickOnOk(); + bool ClickOnApply(); + + void ActivateThisDialog(); + void DeactivateActiveDialog(); + + void SelectionIntoArgument(); + + void ConstructorsClicked( int ); + void LineEditReturnPressed(); + void SetEditCurrentArgument(); + void ValueChangedInSpinBox(); + void SetDoubleSpinBoxStep( double ); +}; + +#endif // BASICGUI_DISKDLG_H diff --git a/src/PrimitiveGUI/PrimitiveGUI_FaceDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_FaceDlg.cxx new file mode 100755 index 000000000..a3f2b0c60 --- /dev/null +++ b/src/PrimitiveGUI/PrimitiveGUI_FaceDlg.cxx @@ -0,0 +1,422 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library 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 +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : PrimitiveGUI_FaceDlg.cxx +// Author : Dmitry Matveitchev, OCN. +// + +#include "PrimitiveGUI_FaceDlg.h" + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +//================================================================================= +// class : PrimitiveGUI_FaceDlg() +// purpose : Constructs a PrimitiveGUI_FaceDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +PrimitiveGUI_FaceDlg::PrimitiveGUI_FaceDlg( GeometryGUI* theGeometryGUI, QWidget* parent, + bool modal, Qt::WindowFlags fl ) + : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) +{ + QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_FACE_PLANE_HW" ) ) ); + QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); + QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_FACE_HW" ) ) ); + + setWindowTitle( tr( "GEOM_FACE_TITLE" ) ); + + /***************************************************************/ + mainFrame()->GroupConstructors->setTitle( tr( "GEOM_FACE" ) ); + mainFrame()->RadioButton1->setIcon( image0 ); + mainFrame()->RadioButton2->setIcon( image2 ); + mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->RadioButton3->close(); + + GroupPlane = new DlgRef_1Sel2Spin( centralWidget() ); + GroupPlane->GroupBox1->setTitle( tr( "GEOM_FACES" ) ); + GroupPlane->TextLabel1->setText( tr( "GEOM_FACE" ) ); + GroupPlane->TextLabel2->setText( tr( "GEOM_HEIGHT" ) ); + GroupPlane->TextLabel3->setText( tr( "GEOM_WIDTH" ) ); + GroupPlane->PushButton1->setIcon( image1 ); + GroupPlane->LineEdit1->setReadOnly( true ); + + GroupDimensions = new DlgRef_2Spin( centralWidget() ); + GroupDimensions->GroupBox1->setTitle( tr( "GEOM_BOX_OBJ" ) ); + GroupDimensions->TextLabel1->setText( tr( "GEOM_HEIGHT" ) ); + GroupDimensions->TextLabel2->setText( tr( "GEOM_WIDTH" ) ); + + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); + layout->setMargin( 0 ); layout->setSpacing( 6 ); + layout->addWidget( GroupPlane ); + layout->addWidget( GroupDimensions ); + + /***************************************************************/ + + setHelpFileName( "create_face_page.html" ); + + Init(); +} + + +//================================================================================= +// function : ~PrimitiveGUI_FaceDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +PrimitiveGUI_FaceDlg::~PrimitiveGUI_FaceDlg() +{ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void PrimitiveGUI_FaceDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPlane->LineEdit1; + myFace = GEOM::GEOM_Object::_nil(); + globalSelection(); // close local contexts, if any + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE ); + + /* Get setting of step value from file configuration */ + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double aStep = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 ); + + double aDefaultSize = 100.0; + /* min, max, step and decimals for spin boxes */ + initSpinBox( GroupPlane->SpinBox_DX, 0.001, COORD_MAX, aStep, 3 ); // VSR:TODO : DBL_DIGITS_DISPLAY + GroupPlane->SpinBox_DX->setValue( aDefaultSize ); + initSpinBox( GroupPlane->SpinBox_DY, 0.001, COORD_MAX, aStep, 3 ); // VSR:TODO : DBL_DIGITS_DISPLAY + GroupPlane->SpinBox_DY->setValue( aDefaultSize ); + + initSpinBox( GroupDimensions->SpinBox_DX, 0.001, COORD_MAX, aStep, 3 ); // VSR:TODO : DBL_DIGITS_DISPLAY + GroupDimensions->SpinBox_DX->setValue( aDefaultSize ); + initSpinBox( GroupDimensions->SpinBox_DY, 0.001, COORD_MAX, aStep, 3 ); // VSR:TODO : DBL_DIGITS_DISPLAY + GroupDimensions->SpinBox_DY->setValue( aDefaultSize ); + + + /* signals and slots connections */ + connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ); + connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ); + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) ); + + connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); + + connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); + + connect( GroupPlane->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( GroupPlane->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( GroupPlane->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( GroupPlane->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + + connect( GroupDimensions->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( GroupDimensions->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + + connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), + this, SLOT( SelectionIntoArgument() ) ); + + initName( tr( "GEOM_FACE" ) ); + + ConstructorsClicked( 0 ); +} + +//================================================================================= +// function : SetDoubleSpinBoxStep() +// purpose : Double spin box management +//================================================================================= +void PrimitiveGUI_FaceDlg::SetDoubleSpinBoxStep( double step ) +{ + GroupPlane->SpinBox_DX->setSingleStep(step); + GroupPlane->SpinBox_DY->setSingleStep(step); +} + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void PrimitiveGUI_FaceDlg::ValueChangedInSpinBox( double newValue ) +{ + displayPreview(); +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void PrimitiveGUI_FaceDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool PrimitiveGUI_FaceDlg::ClickOnApply() +{ + if ( !onAccept() ) + return false; + + initName(); + + myEditCurrentArgument->setText( "" ); + ConstructorsClicked( getConstructorId() ); + + return true; +} + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void PrimitiveGUI_FaceDlg::ConstructorsClicked( int constructorId ) +{ + switch ( constructorId ) { + case 0: + { + globalSelection(); // close local contexts, if any + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE ); + + myEditCurrentArgument = GroupPlane->LineEdit1; + myEditCurrentArgument->setText(""); + myFace = GEOM::GEOM_Object::_nil(); + GroupDimensions->hide(); + GroupPlane->show(); + break; + } + case 1: + { + globalSelection(); // close local contexts, if any + GroupPlane->hide(); + GroupDimensions->show(); + break; + } + } + + qApp->processEvents(); + updateGeometry(); + resize( minimumSize() ); + SelectionIntoArgument(); +} + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void PrimitiveGUI_FaceDlg::SelectionIntoArgument() +{ + if (getConstructorId() != 0) { + displayPreview(); + return; + } + + myEditCurrentArgument->setText( "" ); + + if ( IObjectCount() != 1 ) { + if ( myEditCurrentArgument == GroupPlane->LineEdit1 ) myFace = GEOM::GEOM_Object::_nil(); + return; + } + + // nbSel == 1 + Standard_Boolean aRes = Standard_False; + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes ); + if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { + QString aName = GEOMBase::GetName( aSelectedObject ); + + TopoDS_Shape aShape; + if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { + LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); + TColStd_IndexedMapOfInteger aMap; + aSelMgr->GetIndexes( firstIObject(), aMap ); + if ( aMap.Extent() == 1 ) { // Local Selection + int anIndex = aMap( 1 ); + aName += QString( ":face_%1" ).arg( anIndex ); + + //Find SubShape Object in Father + GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather( aSelectedObject, aName ); + + if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study + GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() ); + aSelectedObject = aShapesOp->GetSubShape( aSelectedObject, anIndex ); + } + else + aSelectedObject = aFindedObject; // get Object from study + } + else { // Global Selection + if ( aShape.ShapeType() != TopAbs_FACE ) { + aSelectedObject = GEOM::GEOM_Object::_nil(); + aName = ""; + } + } + } + + myEditCurrentArgument->setText( aName ); + if ( myEditCurrentArgument == GroupPlane->LineEdit1 ) myFace = aSelectedObject; + } + displayPreview(); +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void PrimitiveGUI_FaceDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + globalSelection(); // close previous local contexts + if ( send == GroupPlane->PushButton1 ) { + myEditCurrentArgument = GroupPlane->LineEdit1; + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE ); + } + + myEditCurrentArgument->setFocus(); + SelectionIntoArgument(); +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void PrimitiveGUI_FaceDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if ( send == GroupPlane->LineEdit1 ) myEditCurrentArgument = GroupPlane->LineEdit1; + else return; + GEOMBase_Skeleton::LineEditReturnPressed(); +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void PrimitiveGUI_FaceDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), + this, SLOT( SelectionIntoArgument() ) ); + + ConstructorsClicked( getConstructorId() ); +} + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : public slot to deactivate if active +//================================================================================= +void PrimitiveGUI_FaceDlg::DeactivateActiveDialog() +{ + GEOMBase_Skeleton::DeactivateActiveDialog(); +} + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void PrimitiveGUI_FaceDlg::enterEvent( QEvent* ) +{ + if ( !mainFrame()->GroupConstructors->isEnabled() ) + ActivateThisDialog(); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr PrimitiveGUI_FaceDlg::createOperation() +{ + return myGeomGUI->GetGeomGen()->GetI3DPrimOperations( getStudyId() ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool PrimitiveGUI_FaceDlg::isValid( QString& msg ) +{ + const int id = getConstructorId(); + if ( id == 0 ) + return !myFace->_is_nil(); + else if ( id == 1 ) + return true; + return false; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool PrimitiveGUI_FaceDlg::execute( ObjectList& objects ) +{ + bool res = false; + GEOM::GEOM_Object_var anObj; + switch ( getConstructorId() ) { + case 0 : + anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeFacePlaneHW( myFace, GroupPlane->SpinBox_DX->value(), GroupPlane->SpinBox_DY->value() ); + res = true; + break; + case 1 : + anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeFaceHW( GroupDimensions->SpinBox_DX->value(), GroupDimensions->SpinBox_DY->value() ); + res = true; + break; + } + + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + + return res; +} + +//================================================================================= +// function : addSubshapeToStudy +// purpose : virtual method to add new SubObjects if local selection +//================================================================================= +void PrimitiveGUI_FaceDlg::addSubshapesToStudy() +{ + QMap objMap; + switch ( getConstructorId() ) { + case 0 : + objMap[GroupPlane->LineEdit1->text()] = myFace; + break; + } + addSubshapesToFather( objMap ); +} diff --git a/src/PrimitiveGUI/PrimitiveGUI_FaceDlg.h b/src/PrimitiveGUI/PrimitiveGUI_FaceDlg.h new file mode 100755 index 000000000..741afd22e --- /dev/null +++ b/src/PrimitiveGUI/PrimitiveGUI_FaceDlg.h @@ -0,0 +1,81 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library 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 +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : BasicGUI_FaceDlg.h +// Author : Dmitry Matveithev, OCN. +// + +#ifndef BASICGUI_FACEDLG_H +#define BASICGUI_FACEDLG_H + +#include + +class DlgRef_2Spin; +class DlgRef_1Sel2Spin; + +//================================================================================= +// class : PrimitiveGUI_FaceDlg +// purpose : +//================================================================================= +class PrimitiveGUI_FaceDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + PrimitiveGUI_FaceDlg( GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0 ); + ~PrimitiveGUI_FaceDlg(); + +protected: + // redefined from GEOMBase_Helper + virtual GEOM::GEOM_IOperations_ptr createOperation(); + virtual bool isValid( QString& ); + virtual bool execute( ObjectList& ); + virtual void addSubshapesToStudy(); + +private: + void Init(); + void enterEvent( QEvent* ); + +private: + GEOM::GEOM_Object_var myPoint1; + GEOM::GEOM_Object_var myPoint2; + GEOM::GEOM_Object_var myVector; + GEOM::GEOM_Object_var myFace; + + DlgRef_2Spin* GroupDimensions; + DlgRef_1Sel2Spin* GroupPlane; + +private slots: + void ClickOnOk(); + bool ClickOnApply(); + + void ActivateThisDialog(); + void DeactivateActiveDialog(); + void ConstructorsClicked( int ); + + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ValueChangedInSpinBox( double ); + void SetDoubleSpinBoxStep( double ); +}; + +#endif // BASICGUI_FACEDLG_H -- 2.39.2