From: vsr Date: Tue, 12 Feb 2008 15:57:45 +0000 (+0000) Subject: Merge from branch BR_Dev_For_4_0 (from tag mergeto_BR_QT4_Dev_12Feb08) X-Git-Tag: V5_0_0a1~24 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ab9aa28a64dc44b3f27355c95f84aee45c82df91;p=modules%2Fgeom.git Merge from branch BR_Dev_For_4_0 (from tag mergeto_BR_QT4_Dev_12Feb08) --- diff --git a/doc/salome/gui/GEOM/images/extrusion1.png b/doc/salome/gui/GEOM/images/extrusion1.png index 673e86325..44a182225 100755 Binary files a/doc/salome/gui/GEOM/images/extrusion1.png and b/doc/salome/gui/GEOM/images/extrusion1.png differ diff --git a/doc/salome/gui/GEOM/images/extrusion2.png b/doc/salome/gui/GEOM/images/extrusion2.png index b56dc5d49..53dbe7d72 100755 Binary files a/doc/salome/gui/GEOM/images/extrusion2.png and b/doc/salome/gui/GEOM/images/extrusion2.png differ diff --git a/doc/salome/gui/GEOM/images/filling.png b/doc/salome/gui/GEOM/images/filling.png index 418c22431..1fb29455c 100755 Binary files a/doc/salome/gui/GEOM/images/filling.png and b/doc/salome/gui/GEOM/images/filling.png differ diff --git a/doc/salome/gui/GEOM/images/line.png b/doc/salome/gui/GEOM/images/line.png deleted file mode 100755 index 3c931a1e9..000000000 Binary files a/doc/salome/gui/GEOM/images/line.png and /dev/null differ diff --git a/doc/salome/gui/GEOM/images/line1.png b/doc/salome/gui/GEOM/images/line1.png new file mode 100755 index 000000000..139809a00 Binary files /dev/null and b/doc/salome/gui/GEOM/images/line1.png differ diff --git a/doc/salome/gui/GEOM/images/line2.png b/doc/salome/gui/GEOM/images/line2.png new file mode 100755 index 000000000..f5d68da42 Binary files /dev/null and b/doc/salome/gui/GEOM/images/line2.png differ diff --git a/doc/salome/gui/GEOM/images/point1.png b/doc/salome/gui/GEOM/images/point1.png index 39bca25f4..e359819c5 100755 Binary files a/doc/salome/gui/GEOM/images/point1.png and b/doc/salome/gui/GEOM/images/point1.png differ diff --git a/doc/salome/gui/GEOM/images/point2.png b/doc/salome/gui/GEOM/images/point2.png new file mode 100755 index 000000000..df151abfa Binary files /dev/null and b/doc/salome/gui/GEOM/images/point2.png differ diff --git a/doc/salome/gui/GEOM/images/point3.png b/doc/salome/gui/GEOM/images/point3.png index 0a2e325c6..14e9827c7 100755 Binary files a/doc/salome/gui/GEOM/images/point3.png and b/doc/salome/gui/GEOM/images/point3.png differ diff --git a/doc/salome/gui/GEOM/images/point4.png b/doc/salome/gui/GEOM/images/point4.png new file mode 100755 index 000000000..b29de102c Binary files /dev/null and b/doc/salome/gui/GEOM/images/point4.png differ diff --git a/doc/salome/gui/GEOM/images/revolution.png b/doc/salome/gui/GEOM/images/revolution.png index c02c859b1..68761025a 100755 Binary files a/doc/salome/gui/GEOM/images/revolution.png and b/doc/salome/gui/GEOM/images/revolution.png differ diff --git a/doc/salome/gui/GEOM/input/creating_complex_obj.doc b/doc/salome/gui/GEOM/input/creating_complex_obj.doc index 23927a4a9..6edbfd9c5 100644 --- a/doc/salome/gui/GEOM/input/creating_complex_obj.doc +++ b/doc/salome/gui/GEOM/input/creating_complex_obj.doc @@ -5,8 +5,8 @@ -*/ \ No newline at end of file +*/ diff --git a/doc/salome/gui/GEOM/input/creating_extrusion.doc b/doc/salome/gui/GEOM/input/creating_extrusion.doc index 4b2c0ac0c..3f3435ca6 100644 --- a/doc/salome/gui/GEOM/input/creating_extrusion.doc +++ b/doc/salome/gui/GEOM/input/creating_extrusion.doc @@ -12,7 +12,11 @@ solid or compsolid). \n Firstly, you can define the Base Shape (a basis of the extrusion), the \b Vector (a direction of the extrusion) and the \b Height of extrusion. -\b TUI Command: geompy.MakePrismVecH(Base, Vector, Height) +\n The \b Result of the operation will be a GEOM_Object (edge, face, +shell, solid or compsolid). +\n Both Directions checkbox allows extruiding the source +object both forward and backward. +\n TUI Command: geompy.MakePrismVecH(Base, Vector, Height) \n Arguments: Name + 1 shape (vertex, edge, planar wire, face or shell) serving as base object + 1 vector (for direction of the extrusion) + 1 value (dimension). @@ -22,6 +26,8 @@ extrusion) + 1 value (dimension). \n Secondly, you can define the \b Extrusion by the Base Shape and the \b Start and End Point of the \b Vector (in this way you don't need to create it in advance). +\n Both Directions checkbox allows extruiding the source +object both forward and backward. \n TUI Command: geompy.MakePrism(Base, Point1, Point2) \n Arguments: Name + 1 shape (vertex, edge, planar wire, face or shell) serving as base object + 2 vertices. diff --git a/doc/salome/gui/GEOM/input/creating_filling.doc b/doc/salome/gui/GEOM/input/creating_filling.doc index 25c99395a..82d446f2c 100644 --- a/doc/salome/gui/GEOM/input/creating_filling.doc +++ b/doc/salome/gui/GEOM/input/creating_filling.doc @@ -1,18 +1,20 @@ /*! -\page creaet_filling_page Filling Surface with Edges +\page create_filling_page Filling Surface with Edges To generate a \b Filling in the Main Menu select New Entity - > Generation - > Filling \n To create a curving face using several edges you need to define the Edges Compound, \b Minimum and Maximum Degree, \b -Tolerance for \b 2D and for \b 3D and the Number of Iterations. +Tolerance for \b 2D and for \b 3D , the Number of Iterations +and Approximation. \n The \b Result of the operation will be a GEOM_Object (face). -\n TUI Command: geompy.MakeFilling(Edges, MinDegree, MaxDegree, Tol2D, Tol3D, NbIter) -\n Arguments: Name + 1 List of edges + 5 Parameters +\n TUI Command: geompy.MakeFilling(Edges, MinDegree, +MaxDegree, Tol2D, Tol3D, NbIter, isApprox) +\n Arguments: Name + 1 List of edges + 6 Parameters (Min. degree, Max. degree, Number of iterations, 2D tolerance, 3D -tolerance, Number of iterations). +tolerance, Number of iterations, Approximation). \image html filling.png diff --git a/doc/salome/gui/GEOM/input/creating_geom_objects.doc b/doc/salome/gui/GEOM/input/creating_geom_objects.doc index bc66bed97..1c804ae71 100644 --- a/doc/salome/gui/GEOM/input/creating_geom_objects.doc +++ b/doc/salome/gui/GEOM/input/creating_geom_objects.doc @@ -28,7 +28,7 @@
  • \subpage work_with_groups_page
  • @@ -46,4 +46,4 @@ -*/ \ No newline at end of file +*/ diff --git a/doc/salome/gui/GEOM/input/creating_line.doc b/doc/salome/gui/GEOM/input/creating_line.doc index befde32ed..fafdfcea9 100644 --- a/doc/salome/gui/GEOM/input/creating_line.doc +++ b/doc/salome/gui/GEOM/input/creating_line.doc @@ -4,14 +4,24 @@ To create a \b Line in the Main Menu select New Entity - >Basic - > Line -\n To create a \b Line you should define \b Point1 and \b Point2, -which are the points through which the \b Line passes. -\n The \b Result of the operation will be a GEOM_Object (edge). +There are 2 algorithms to create a \b Line in the 3D space. +The Result of each operation will be a GEOM_Object (edge). + +\n Firstly you can define a \b Line through \b Point1 and \b Point2, +which are the points through which the \b Line passes. \n TUI Command: geompy.MakeLineTwoPnt(Point1, Point2) \n Arguments: Name + 2 vertices. -\image html line.png +\image html line1.png + +\n Secondly you can define a \b Line as intersection of \b Plane1 and +\b Plane2. +\n TUI Command: geompy.MakeLineTwoFaces(myFace1, myFace2) +\n Arguments: Name + 2 faces. + +\image html line2.png + Example: diff --git a/doc/salome/gui/GEOM/input/creating_point.doc b/doc/salome/gui/GEOM/input/creating_point.doc index 0f91a0f05..5e1703270 100644 --- a/doc/salome/gui/GEOM/input/creating_point.doc +++ b/doc/salome/gui/GEOM/input/creating_point.doc @@ -5,7 +5,7 @@ To create a \b Point in the Main Menu select New Entity - > Basic - > Point -\n There are three algorithms to create a \b Point in the 3D space. +\n There are four algorithms to create a \b Point in the 3D space. \n Each time the \b Result of the operation will be a GEOM_Object (vertex). @@ -23,9 +23,9 @@ coordinates of the old one. \n Arguments: Name + 1 reference point + 3 coordinates defining the position of this point regarding the reference one. -\image html neo-point2.png +\image html point2.png -\n Finally, we can define a point by an \b Edge and a \b Parameter +\n Thirdly, we can define a point by an \b Edge and a \b Parameter indicating its position on the Edge, ranging from 0.0 to 1.0. For example, 0.5 means that the point is located in the middle of the edge. \n TUI Command: geompy.MakeVertexOnCurve(Edge,Parameter). @@ -34,6 +34,11 @@ position of the point on the given edge. \image html point3.png +\n Finally, we can define a point by intersection of two \b Lines. +\n TUI Command: geompy.MakePointOnLinesIntersection(myLine1,myLine2). +\n Arguments: Name + 2 lines + +\image html point4.png Example: \image html points.png diff --git a/doc/salome/gui/GEOM/input/creating_revolution.doc b/doc/salome/gui/GEOM/input/creating_revolution.doc index dfe8c7ca5..b9d2d7086 100644 --- a/doc/salome/gui/GEOM/input/creating_revolution.doc +++ b/doc/salome/gui/GEOM/input/creating_revolution.doc @@ -8,6 +8,8 @@ select New Entity - > Generation - > Revolution \n To create an extruded shape by \b Revolution you need to define the source \b Object to rotate, the \b Axis of revolution and the \b Angle by which the \b Shape has to be rotated around the \b Axis (in degrees). +\n Both Directions checkbox allows extruding the source +object both forward and backward. \n The \b Result of the operation will be a GEOM_Object (edge, face, shell, solid or compsolid). diff --git a/doc/salome/gui/GEOM/input/index.doc b/doc/salome/gui/GEOM/input/index.doc index 3d2d5d102..45eb2ac65 100644 --- a/doc/salome/gui/GEOM/input/index.doc +++ b/doc/salome/gui/GEOM/input/index.doc @@ -32,7 +32,7 @@
  • \ref work_with_groups_page
  • @@ -134,4 +134,4 @@ -*/ \ No newline at end of file +*/ diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index ff1d4044a..de4600e27 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -902,7 +902,7 @@ module GEOM GEOM_Object MakeFilling (in GEOM_Object theShape, in long theMinDeg, in long theMaxDeg, in double theTol2D, in double theTol3D, - in long theNbIter); + in long theNbIter, in boolean theApprox); /*! * Create a shell or solid passing through set of sections.Sections should be wires,edges or vertices. diff --git a/idl/GEOM_Superv.idl b/idl/GEOM_Superv.idl index dcaecd95f..98d819daf 100644 --- a/idl/GEOM_Superv.idl +++ b/idl/GEOM_Superv.idl @@ -176,7 +176,7 @@ module GEOM GEOM_Object MakeFilling (in GEOM_Object theShape, in long theMinDeg, in long theMaxDeg, in double theTol2D, in double theTol3D, - in long theNbIter) ; + in long theNbIter, in boolean theApprox) ; GEOM_Object MakeThruSections(in ListOfGO theSeqSections, in boolean theModeSolid, in double thePreci, diff --git a/resources/GEOMCatalog.xml.in b/resources/GEOMCatalog.xml.in index 2a3f4aa09..2739da315 100644 --- a/resources/GEOMCatalog.xml.in +++ b/resources/GEOMCatalog.xml.in @@ -8,6 +8,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/BooleanGUI/BooleanGUI_Dialog.cxx b/src/BooleanGUI/BooleanGUI_Dialog.cxx index ad3c7195b..216809e30 100644 --- a/src/BooleanGUI/BooleanGUI_Dialog.cxx +++ b/src/BooleanGUI/BooleanGUI_Dialog.cxx @@ -147,6 +147,12 @@ void BooleanGUI_Dialog::Init() initName( mainFrame()->GroupConstructors->title() ); + setTabOrder( mainFrame()->GroupConstructors, mainFrame()->GroupBoxName ); + setTabOrder( mainFrame()->GroupBoxName, mainFrame()->GroupMedium ); + setTabOrder( mainFrame()->GroupMedium, mainFrame()->GroupButtons ); + + mainFrame()->RadioButton1->setFocus(); + globalSelection( GEOM_ALLSHAPES ); } diff --git a/src/DlgRef/DlgRef.cxx b/src/DlgRef/DlgRef.cxx index eea049df6..8acd7cc9e 100644 --- a/src/DlgRef/DlgRef.cxx +++ b/src/DlgRef/DlgRef.cxx @@ -191,6 +191,20 @@ DlgRef_1Sel4Spin::~DlgRef_1Sel4Spin() { } +////////////////////////////////////////// +// DlgRef_1Sel5Spin1Check +////////////////////////////////////////// + +DlgRef_1Sel5Spin1Check::DlgRef_1Sel5Spin1Check( QWidget* parent, Qt::WindowFlags f ) +: QWidget( parent, f ) +{ + setupUi( this ); +} + +DlgRef_1Sel5Spin1Check::~DlgRef_1Sel5Spin1Check() +{ +} + ////////////////////////////////////////// // DlgRef_1Sel5Spin ////////////////////////////////////////// diff --git a/src/DlgRef/DlgRef.h b/src/DlgRef/DlgRef.h index 91266adfe..f3f42a6cf 100644 --- a/src/DlgRef/DlgRef.h +++ b/src/DlgRef/DlgRef.h @@ -226,6 +226,22 @@ public: ~DlgRef_1Sel4Spin(); }; +////////////////////////////////////////// +// DlgRef_1Sel5Spin1Check +////////////////////////////////////////// + +#include "ui_DlgRef_1Sel5Spin1Check_QTD.h" + +class DLGREF_EXPORT DlgRef_1Sel5Spin1Check : public QWidget, + public Ui::DlgRef_1Sel5Spin1Check_QTD +{ + Q_OBJECT + +public: + DlgRef_1Sel5Spin1Check( QWidget* = 0, Qt::WindowFlags = 0 ); + ~DlgRef_1Sel5Spin1Check(); +}; + ////////////////////////////////////////// // DlgRef_1Sel5Spin ////////////////////////////////////////// diff --git a/src/DlgRef/DlgRef_1Sel1Spin_QTD.ui b/src/DlgRef/DlgRef_1Sel1Spin_QTD.ui index 09c6d0baf..7c8dc2145 100644 --- a/src/DlgRef/DlgRef_1Sel1Spin_QTD.ui +++ b/src/DlgRef/DlgRef_1Sel1Spin_QTD.ui @@ -13,10 +13,22 @@ - + 0 - + + 0 + + + 0 + + + 0 + + + 0 + + 0 @@ -25,18 +37,28 @@ - + 9 - + + 9 + + + 9 + + + 9 + + + 6 + + 6 - - 0 - 0 + 0 0 @@ -55,9 +77,7 @@ - - 0 - 0 + 0 0 @@ -70,9 +90,7 @@ - - 0 - 0 + 0 0 @@ -95,6 +113,11 @@ qPixmapFromMimeSource + + PushButton1 + LineEdit1 + SpinBox_DX + diff --git a/src/DlgRef/DlgRef_1Sel3Spin_QTD.ui b/src/DlgRef/DlgRef_1Sel3Spin_QTD.ui index b24ce527e..43a348546 100644 --- a/src/DlgRef/DlgRef_1Sel3Spin_QTD.ui +++ b/src/DlgRef/DlgRef_1Sel3Spin_QTD.ui @@ -13,10 +13,22 @@ - + 0 - + + 0 + + + 0 + + + 0 + + + 6 + + 6 @@ -25,10 +37,22 @@ - + 9 - + + 9 + + + 9 + + + 9 + + + 6 + + 6 @@ -43,9 +67,7 @@ - - 0 - 0 + 0 0 @@ -61,9 +83,7 @@ - - 0 - 0 + 0 0 @@ -79,9 +99,7 @@ - - 0 - 0 + 0 0 @@ -100,9 +118,7 @@ - - 0 - 0 + 0 0 @@ -118,9 +134,7 @@ - - 0 - 0 + 0 0 @@ -137,6 +151,13 @@ qPixmapFromMimeSource + + PushButton1 + LineEdit1 + SpinBox_DX + SpinBox_DY + SpinBox_DZ + diff --git a/src/DlgRef/DlgRef_1Sel4Spin_QTD.ui b/src/DlgRef/DlgRef_1Sel4Spin_QTD.ui index 95a35fc01..dc922e69b 100644 --- a/src/DlgRef/DlgRef_1Sel4Spin_QTD.ui +++ b/src/DlgRef/DlgRef_1Sel4Spin_QTD.ui @@ -13,10 +13,22 @@ - + 0 - + + 0 + + + 0 + + + 0 + + + 6 + + 6 @@ -25,18 +37,28 @@ - + + 9 + + + 9 + + + 9 + + 9 - + + 6 + + 6 - - 0 - 0 + 0 0 @@ -58,18 +80,25 @@ - - 9 - 6 + + 9 + + + 9 + + + 9 + + + 9 + - - 0 - 0 + 0 0 @@ -88,9 +117,7 @@ - - 0 - 0 + 0 0 @@ -109,9 +136,7 @@ - - 0 - 0 + 0 0 @@ -136,9 +161,7 @@ - - 0 - 0 + 0 0 @@ -151,9 +174,7 @@ - - 0 - 0 + 0 0 @@ -173,6 +194,14 @@ qPixmapFromMimeSource + + PushButton1 + LineEdit1 + SpinBox_DX + SpinBox_DY + SpinBox_DZ + SpinBox_S + diff --git a/src/DlgRef/DlgRef_1Sel5Spin1Check_QTD.ui b/src/DlgRef/DlgRef_1Sel5Spin1Check_QTD.ui new file mode 100644 index 000000000..f6bd86ae1 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel5Spin1Check_QTD.ui @@ -0,0 +1,189 @@ + + DlgRef_1Sel5Spin1Check_QTD + + + + 0 + 0 + 165 + 125 + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + + + + + 0 + 0 + + + + TL1 + + + false + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + + + 0 + 0 + + + + TL2 + + + false + + + + + + + + + + + 0 + 0 + + + + TL3 + + + false + + + + + + + + + + + 0 + 0 + + + + TL5 + + + false + + + + + + + + + + + 0 + 0 + + + + TL6 + + + false + + + + + + + + + + + 0 + 0 + + + + TL4 + + + false + + + + + + + + + + + + + + + + + + + + + + PushButton1 + LineEdit1 + SpinBox1 + SpinBox2 + SpinBox4 + SpinBox5 + SpinBox3 + CheckBox1 + + + + diff --git a/src/DlgRef/DlgRef_3Spin_QTD.ui b/src/DlgRef/DlgRef_3Spin_QTD.ui index 30bca472d..8eab2dbf2 100644 --- a/src/DlgRef/DlgRef_3Spin_QTD.ui +++ b/src/DlgRef/DlgRef_3Spin_QTD.ui @@ -13,10 +13,22 @@ - + 0 - + + 0 + + + 0 + + + 0 + + + 0 + + 0 @@ -25,10 +37,22 @@ - + 9 - + + 9 + + + 9 + + + 9 + + + 6 + + 6 @@ -43,9 +67,7 @@ - - 0 - 0 + 0 0 @@ -61,9 +83,7 @@ - - 0 - 0 + 0 0 @@ -79,9 +99,7 @@ - - 0 - 0 + 0 0 @@ -101,6 +119,11 @@ qPixmapFromMimeSource + + SpinBox_DX + SpinBox_DY + SpinBox_DZ + diff --git a/src/DlgRef/DlgRef_Skeleton_QTD.ui b/src/DlgRef/DlgRef_Skeleton_QTD.ui index a249ecde2..251a15235 100644 --- a/src/DlgRef/DlgRef_Skeleton_QTD.ui +++ b/src/DlgRef/DlgRef_Skeleton_QTD.ui @@ -13,18 +13,28 @@ - + 9 - + + 9 + + + 9 + + + 9 + + + 6 + + 6 - - 5 - 0 + 0 0 @@ -33,12 +43,21 @@ Result name - - 9 - 6 + + 9 + + + 9 + + + 9 + + + 9 + @@ -58,9 +77,7 @@ - - 5 - 0 + 0 0 @@ -69,12 +86,21 @@ - - 9 - 6 + + 9 + + + 9 + + + 9 + + + 9 + @@ -109,9 +135,7 @@ - - 7 - 0 + 0 0 @@ -120,12 +144,21 @@ - - 9 - 6 + + 9 + + + 9 + + + 9 + + + 9 + @@ -176,9 +209,7 @@ - - 7 - 7 + 0 0 @@ -187,6 +218,17 @@ + + RadioButton1 + RadioButton2 + RadioButton3 + RadioButton4 + ResultName + buttonOk + buttonApply + buttonCancel + buttonHelp + diff --git a/src/DlgRef/Makefile.am b/src/DlgRef/Makefile.am index a99e7bbcd..62716c8d8 100644 --- a/src/DlgRef/Makefile.am +++ b/src/DlgRef/Makefile.am @@ -50,6 +50,7 @@ UIC_FILES = \ ui_DlgRef_1Sel3Check_QTD.h \ ui_DlgRef_1Sel3Spin_QTD.h \ ui_DlgRef_1Sel4Spin_QTD.h \ + ui_DlgRef_1Sel5Spin1Check_QTD.h \ ui_DlgRef_1Sel5Spin_QTD.h \ ui_DlgRef_1Sel_QTD.h \ ui_DlgRef_1SelExt_QTD.h \ diff --git a/src/EntityGUI/EntityGUI_SubShapeDlg.cxx b/src/EntityGUI/EntityGUI_SubShapeDlg.cxx index 44927437b..d13fadff7 100644 --- a/src/EntityGUI/EntityGUI_SubShapeDlg.cxx +++ b/src/EntityGUI/EntityGUI_SubShapeDlg.cxx @@ -518,6 +518,13 @@ GEOM::GEOM_IOperations_ptr EntityGUI_SubShapeDlg::createOperation() bool EntityGUI_SubShapeDlg::isValid( QString& msg ) { bool isOk = false; + Handle(SALOME_InteractiveObject) IO = firstIObject(); + Standard_Boolean testResult; + myObject = GEOMBase::ConvertIOinGEOMObject( IO, testResult ); + if ( !testResult || myObject->_is_nil() ) { + updateButtonState(); + return isOk; + } if ( !myObject->_is_nil() ) { if ( isAllSubShapes() ) isOk = true; diff --git a/src/GEOM/GEOM_Engine.cxx b/src/GEOM/GEOM_Engine.cxx index 3ac30e5ab..ec1a8a660 100644 --- a/src/GEOM/GEOM_Engine.cxx +++ b/src/GEOM/GEOM_Engine.cxx @@ -116,6 +116,25 @@ GEOM_Engine::GEOM_Engine() _UndoLimit = 10; } +/*! + * Destructor + */ +GEOM_Engine::~GEOM_Engine() +{ + GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient It(_objects); + for(; It.More(); It.Next()) + { + RemoveObject(Handle(GEOM_Object)::DownCast(It.Value())); + } + + //Close all documents not closed + for(Interface_DataMapIteratorOfDataMapOfIntegerTransient anItr(_mapIDDocument); anItr.More(); anItr.Next()) + Close(anItr.Key()); + + _mapIDDocument.Clear(); + _objects.Clear(); +} + //============================================================================= /*! * GetDocument @@ -176,18 +195,33 @@ Handle(GEOM_Object) GEOM_Engine::GetObject(int theDocID, char* theEntry) //============================================================================= Handle(GEOM_Object) GEOM_Engine::AddObject(int theDocID, int theType) { - Handle(TDocStd_Document) aDoc = GetDocument(theDocID); - Handle(TDataStd_TreeNode) aRoot = TDataStd_TreeNode::Set(aDoc->Main()); + Handle(TDocStd_Document) aDoc = GetDocument(theDocID); + Handle(TDataStd_TreeNode) aRoot = TDataStd_TreeNode::Set(aDoc->Main()); - TDF_Label aChild = TDF_TagSource::NewChild(aDoc->Main()); - Handle(GEOM_Object) anObject = new GEOM_Object(aChild, theType); + // NPAL18604: use existing label to decrease memory usage, + // if this label has been freed (object deleted) + bool useExisting = false; + TDF_Label aChild; + if (!_lastCleared.IsNull()) { + if (_lastCleared.Root() == aDoc->Main().Root()) { + useExisting = true; + aChild = _lastCleared; + _lastCleared.Nullify(); + } + } + if (!useExisting) { + // create new label + aChild = TDF_TagSource::NewChild(aDoc->Main()); + } + + Handle(GEOM_Object) anObject = new GEOM_Object(aChild, theType); - //Put an object in the map of created objects - TCollection_AsciiString anID = BuildIDFromObject(anObject); - if(_objects.IsBound(anID)) _objects.UnBind(anID); - _objects.Bind(anID, anObject); + //Put an object in the map of created objects + TCollection_AsciiString anID = BuildIDFromObject(anObject); + if(_objects.IsBound(anID)) _objects.UnBind(anID); + _objects.Bind(anID, anObject); - return anObject; + return anObject; } //============================================================================= @@ -204,7 +238,21 @@ Handle(GEOM_Object) GEOM_Engine::AddSubShape(Handle(GEOM_Object) theMainShape, Handle(TDocStd_Document) aDoc = GetDocument(theMainShape->GetDocID()); Handle(TDataStd_TreeNode) aRoot = TDataStd_TreeNode::Set(aDoc->Main()); - TDF_Label aChild = TDF_TagSource::NewChild(aDoc->Main()); + // NPAL18604: use existing label to decrease memory usage, + // if this label has been freed (object deleted) + bool useExisting = false; + TDF_Label aChild; + if (!_lastCleared.IsNull()) { + if (_lastCleared.Root() == aDoc->Main().Root()) { + useExisting = true; + aChild = _lastCleared; + _lastCleared.Nullify(); + } + } + if (!useExisting) { + // create new label + aChild = TDF_TagSource::NewChild(aDoc->Main()); + } Handle(GEOM_Function) aMainShape = theMainShape->GetLastFunction(); Handle(GEOM_Object) anObject = new GEOM_Object(aChild, 28); //28 is SUBSHAPE type @@ -258,22 +306,23 @@ Handle(GEOM_Object) GEOM_Engine::AddSubShape(Handle(GEOM_Object) theMainShape, //============================================================================= bool GEOM_Engine::RemoveObject(Handle(GEOM_Object) theObject) { - if(!theObject) return false; + if (!theObject) return false; //Remove an object from the map of available objects TCollection_AsciiString anID = BuildIDFromObject(theObject); - if(_objects.IsBound(anID)) _objects.UnBind(anID); + if (_objects.IsBound(anID)) _objects.UnBind(anID); int nb = theObject->GetNbFunctions(); Handle(TDataStd_TreeNode) aNode; - for(int i = 1; i<=nb; i++) { + for (int i = 1; i<=nb; i++) { Handle(GEOM_Function) aFunction = theObject->GetFunction(i); - if(aFunction->GetEntry().FindAttribute(GEOM_Function::GetFunctionTreeID(), aNode)) + if (aFunction->GetEntry().FindAttribute(GEOM_Function::GetFunctionTreeID(), aNode)) aNode->Remove(); } TDF_Label aLabel = theObject->GetEntry(); aLabel.ForgetAllAttributes(Standard_True); + _lastCleared = aLabel; theObject.Nullify(); @@ -344,20 +393,22 @@ bool GEOM_Engine::Load(int theDocID, char* theFileName) //============================================================================= void GEOM_Engine::Close(int theDocID) { - if(_mapIDDocument.IsBound(theDocID)) { + if (_mapIDDocument.IsBound(theDocID)) { Handle(TDocStd_Document) aDoc = Handle(TDocStd_Document)::DownCast(_mapIDDocument(theDocID)); //Remove all GEOM Objects associated to the given document TColStd_SequenceOfAsciiString aSeq; - GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient It(_objects); - for(; It.More(); It.Next()) { - TCollection_AsciiString anObjID(It.Key()); + GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient It (_objects); + for (; It.More(); It.Next()) { + TCollection_AsciiString anObjID (It.Key()); Standard_Integer anID = ExtractDocID(anObjID); - if(theDocID == anID) aSeq.Append(It.Key()); + if (theDocID == anID) aSeq.Append(It.Key()); } - for(Standard_Integer i=1; i<=aSeq.Length(); i++) _objects.UnBind(aSeq.Value(i)); + for (Standard_Integer i=1; i<=aSeq.Length(); i++) _objects.UnBind(aSeq.Value(i)); + + _lastCleared.Nullify(); - _mapIDDocument.UnBind(theDocID); + _mapIDDocument.UnBind(theDocID); _OCAFApp->Close(aDoc); aDoc.Nullify(); } diff --git a/src/GEOM/GEOM_Engine.hxx b/src/GEOM/GEOM_Engine.hxx index 662bd242f..ab6b82821 100644 --- a/src/GEOM/GEOM_Engine.hxx +++ b/src/GEOM/GEOM_Engine.hxx @@ -30,12 +30,13 @@ #include #include #include +#include class GEOM_Engine { public: Standard_EXPORT GEOM_Engine(); - Standard_EXPORT ~GEOM_Engine() { _mapIDDocument.Clear(); _objects.Clear(); } + Standard_EXPORT virtual ~GEOM_Engine(); //Retuns the engine Standard_EXPORT static GEOM_Engine* GetEngine(); @@ -101,6 +102,8 @@ class GEOM_Engine GEOM_DataMapOfAsciiStringTransient _objects; Resource_DataMapOfAsciiStringAsciiString _studyEntry2NameMap; + + TDF_Label _lastCleared; }; #endif diff --git a/src/GEOM/GEOM_Gen_i.cc b/src/GEOM/GEOM_Gen_i.cc index 5e85a6195..f07429df9 100644 --- a/src/GEOM/GEOM_Gen_i.cc +++ b/src/GEOM/GEOM_Gen_i.cc @@ -3014,7 +3014,8 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeFilling(GEOM::GEOM_Shape_ptr myShape, CORBA::Short maxdeg, CORBA::Double tol3d, CORBA::Double tol2d, - CORBA::Short nbiter) + CORBA::Short nbiter, + CORBA::Boolean theApprox) throw (SALOME::SALOME_Exception) { Unexpect aCatch(SALOME_SalomeException); @@ -3053,7 +3054,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeFilling(GEOM::GEOM_Shape_ptr myShape, Handle(GeomFill_Line) Line = new GeomFill_Line(i) ; GeomFill_AppSurf App(mindeg, maxdeg, tol3d, tol2d, nbiter) ; /* user parameters */ - App.Perform(Line, Section) ; + App.Perform(Line, Section, theApprox) ; if (!App.IsDone()) { THROW_SALOME_CORBA_EXCEPTION("Filling aborted : non valid shape result", SALOME::BAD_PARAM); diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts index e2e290bc7..4986a79c2 100644 --- a/src/GEOMGUI/GEOM_msg_en.ts +++ b/src/GEOMGUI/GEOM_msg_en.ts @@ -3430,6 +3430,10 @@ GEOM_RESULT_NAME_LBL Name + + GEOM_FILLING_APPROX + Approximation + BasicGUI_MarkerDlg diff --git a/src/GEOMImpl/GEOMImpl_BoxDriver.cxx b/src/GEOMImpl/GEOMImpl_BoxDriver.cxx index 16e26a843..f35350788 100644 --- a/src/GEOMImpl/GEOMImpl_BoxDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_BoxDriver.cxx @@ -86,6 +86,12 @@ Standard_Integer GEOMImpl_BoxDriver::Execute(TFunction_Logbook& log) const aShape2.ShapeType() == TopAbs_VERTEX) { gp_Pnt P1 = BRep_Tool::Pnt(TopoDS::Vertex(aShape1)); gp_Pnt P2 = BRep_Tool::Pnt(TopoDS::Vertex(aShape2)); + + if (P1.X() == P2.X() || P1.Y() == P2.Y() || P1.Z() == P2.Z()) { + StdFail_NotDone::Raise("Box can not be created, the points belong to the same plane"); + return 0; + } + BRepPrimAPI_MakeBox MB (P1,P2); MB.Build(); diff --git a/src/GEOMImpl/GEOMImpl_FillingDriver.cxx b/src/GEOMImpl/GEOMImpl_FillingDriver.cxx index f37a2176a..d17febfd2 100644 --- a/src/GEOMImpl/GEOMImpl_FillingDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_FillingDriver.cxx @@ -88,6 +88,7 @@ Standard_Integer GEOMImpl_FillingDriver::Execute(TFunction_Logbook& log) const Standard_Real tol3d = IF.GetTol2D(); Standard_Real tol2d = IF.GetTol3D(); Standard_Integer nbiter = IF.GetNbIter(); + Standard_Boolean isApprox = IF.GetApprox(); if (mindeg > maxdeg) { Standard_RangeError::Raise("Minimal degree can not be more than maximal degree"); @@ -115,7 +116,7 @@ Standard_Integer GEOMImpl_FillingDriver::Execute(TFunction_Logbook& log) const Handle(GeomFill_Line) Line = new GeomFill_Line(i); GeomFill_AppSurf App (mindeg, maxdeg, tol3d, tol2d, nbiter); /* user parameters */ - App.Perform(Line, Section); + App.Perform(Line, Section, isApprox); if (!App.IsDone()) return 0; Standard_Integer UDegree, VDegree, NbUPoles, NbVPoles, NbUKnots, NbVKnots; diff --git a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx index 6eefda984..a1c554544 100644 --- a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx @@ -1110,7 +1110,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeSolidShell (Handle(GEOM_Obje //============================================================================= Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFilling (Handle(GEOM_Object) theShape, int theMinDeg, int theMaxDeg, - double theTol2D, double theTol3D, int theNbIter) + double theTol2D, double theTol3D, int theNbIter, bool isApprox) { SetErrorCode(KO); @@ -1138,6 +1138,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFilling aFI.SetTol2D(theTol2D); aFI.SetTol3D(theTol3D); aFI.SetNbIter(theNbIter); + aFI.SetApprox(isApprox); //Compute the Solid value try { @@ -1159,9 +1160,13 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFilling } //Make a Python command - GEOM::TPythonDump(aFunction) << aFilling << " = geompy.MakeFilling(" + GEOM::TPythonDump pd (aFunction); + pd << aFilling << " = geompy.MakeFilling(" << theShape << ", " << theMinDeg << ", " << theMaxDeg << ", " - << theTol2D << ", " << theTol3D << ", " << theNbIter << ")"; + << theTol2D << ", " << theTol3D << ", " << theNbIter; + if(isApprox) + pd << ", " << isApprox; + pd << ")"; SetErrorCode(OK); return aFilling; diff --git a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx index f87ddd5d5..5f1f52f36 100644 --- a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx @@ -83,7 +83,7 @@ class GEOMImpl_I3DPrimOperations : public GEOM_IOperations { Standard_EXPORT Handle(GEOM_Object) MakeSolidShell (Handle(GEOM_Object) theShell); - Standard_EXPORT Handle(GEOM_Object) MakeFilling (Handle(GEOM_Object) theShape, int theMinDeg, int theMaxDeg, double theTol2D, double theTol3D, int theNbIter); + Standard_EXPORT Handle(GEOM_Object) MakeFilling (Handle(GEOM_Object) theShape, int theMinDeg, int theMaxDeg, double theTol2D, double theTol3D, int theNbIter, bool isApprox); Standard_EXPORT Handle(GEOM_Object) MakeThruSections(const Handle(TColStd_HSequenceOfTransient)& theSeqSections, bool theModeSolid, diff --git a/src/GEOMImpl/GEOMImpl_IFilling.hxx b/src/GEOMImpl/GEOMImpl_IFilling.hxx index d4269bf19..f8fbae645 100644 --- a/src/GEOMImpl/GEOMImpl_IFilling.hxx +++ b/src/GEOMImpl/GEOMImpl_IFilling.hxx @@ -28,6 +28,7 @@ #define FILL_ARG_TOL3D 4 #define FILL_ARG_SHAPE 5 #define FILL_ARG_NBITER 6 +#define FILL_ARG_APPROX 7 class GEOMImpl_IFilling { @@ -47,6 +48,9 @@ class GEOMImpl_IFilling void SetNbIter(int theNbIter) { _func->SetInteger(FILL_ARG_NBITER, theNbIter); } int GetNbIter() { return _func->GetInteger(FILL_ARG_NBITER); } + void SetApprox(bool theApprox) { _func->SetInteger(FILL_ARG_APPROX, theApprox); } + bool GetApprox() { return _func->GetInteger(FILL_ARG_APPROX); } + void SetShape(Handle(GEOM_Function) theShape) { _func->SetReference(FILL_ARG_SHAPE, theShape); } Handle(GEOM_Function) GetShape() { return _func->GetReference(FILL_ARG_SHAPE); } diff --git a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx index 4f09b784d..b2b8dc364 100644 --- a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx @@ -638,7 +638,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetGlueFaces Handle(GEOM_Function) aFunction = theShape->GetLastFunction(); GEOM::TPythonDump pd (aFunction, /*append=*/true); pd << "[" << anAsciiList.ToCString(); - pd << "] = geompy.GetGlueFaces" << theShape << ", " << theTolerance << ")"; + pd << "] = geompy.GetGlueFaces(" << theShape << ", " << theTolerance << ")"; SetErrorCode(OK); diff --git a/src/GEOMImpl/GEOMImpl_RotateDriver.cxx b/src/GEOMImpl/GEOMImpl_RotateDriver.cxx index 94f949129..c6655fa58 100644 --- a/src/GEOMImpl/GEOMImpl_RotateDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_RotateDriver.cxx @@ -1,18 +1,18 @@ // 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 +// 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 +// +// 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 +// 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 @@ -49,48 +49,48 @@ //======================================================================= //function : GetID //purpose : -//======================================================================= +//======================================================================= const Standard_GUID& GEOMImpl_RotateDriver::GetID() { static Standard_GUID aRotateDriver("FF1BBB56-5D14-4df2-980B-3A668264EA16"); - return aRotateDriver; + return aRotateDriver; } //======================================================================= //function : GEOMImpl_RotateDriver -//purpose : +//purpose : //======================================================================= -GEOMImpl_RotateDriver::GEOMImpl_RotateDriver() +GEOMImpl_RotateDriver::GEOMImpl_RotateDriver() { } //======================================================================= //function : Execute //purpose : -//======================================================================= +//======================================================================= Standard_Integer GEOMImpl_RotateDriver::Execute(TFunction_Logbook& log) const { - if(Label().IsNull()) return 0; + if (Label().IsNull()) return 0; Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); - if(aFunction.IsNull()) return 0; + if (aFunction.IsNull()) return 0; GEOMImpl_IRotate RI(aFunction); gp_Trsf aTrsf; gp_Pnt aCP, aP1, aP2; Standard_Integer aType = aFunction->GetType(); Handle(GEOM_Function) anOriginalFunction = RI.GetOriginal(); - if(anOriginalFunction.IsNull()) return 0; + if (anOriginalFunction.IsNull()) return 0; TopoDS_Shape aShape, anOriginal = anOriginalFunction->GetValue(); - if(anOriginal.IsNull()) return 0; + if (anOriginal.IsNull()) return 0; - if(aType == ROTATE || aType == ROTATE_COPY) { + if (aType == ROTATE || aType == ROTATE_COPY) { Handle(GEOM_Function) anAxis = RI.GetAxis(); - if(anAxis.IsNull()) return 0; + if (anAxis.IsNull()) return 0; TopoDS_Shape A = anAxis->GetValue(); - if(A.IsNull() || A.ShapeType() != TopAbs_EDGE) return 0; + if (A.IsNull() || A.ShapeType() != TopAbs_EDGE) return 0; TopoDS_Edge anEdge = TopoDS::Edge(A); gp_Pnt aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge)); @@ -99,11 +99,17 @@ Standard_Integer GEOMImpl_RotateDriver::Execute(TFunction_Logbook& log) const gp_Ax1 anAx1(aP1, aDir); Standard_Real anAngle = RI.GetAngle(); aTrsf.SetRotation(anAx1, anAngle); - - BRepBuilderAPI_Transform aTransformation(anOriginal, aTrsf, Standard_False); - aShape = aTransformation.Shape(); + + //NPAL18620: performance problem: multiple locations are accumulated + // in shape and need a great time to process + //BRepBuilderAPI_Transform aTransformation(anOriginal, aTrsf, Standard_False); + //aShape = aTransformation.Shape(); + TopLoc_Location aLocOrig = anOriginal.Location(); + gp_Trsf aTrsfOrig = aLocOrig.Transformation(); + TopLoc_Location aLocRes (aTrsf * aTrsfOrig); + aShape = anOriginal.Located(aLocRes); } - else if(aType == ROTATE_THREE_POINTS || aType == ROTATE_THREE_POINTS_COPY) { + else if (aType == ROTATE_THREE_POINTS || aType == ROTATE_THREE_POINTS_COPY) { Handle(GEOM_Function) aCentPoint = RI.GetCentPoint(); Handle(GEOM_Function) aPoint1 = RI.GetPoint1(); Handle(GEOM_Function) aPoint2 = RI.GetPoint2(); @@ -125,10 +131,16 @@ Standard_Integer GEOMImpl_RotateDriver::Execute(TFunction_Logbook& log) const gp_Ax1 anAx1(aCP, aDir); Standard_Real anAngle = aVec1.Angle(aVec2); aTrsf.SetRotation(anAx1, anAngle); - BRepBuilderAPI_Transform aTransformation(anOriginal, aTrsf, Standard_False); - aShape = aTransformation.Shape(); + //NPAL18620: performance problem: multiple locations are accumulated + // in shape and need a great time to process + //BRepBuilderAPI_Transform aTransformation(anOriginal, aTrsf, Standard_False); + //aShape = aTransformation.Shape(); + TopLoc_Location aLocOrig = anOriginal.Location(); + gp_Trsf aTrsfOrig = aLocOrig.Transformation(); + TopLoc_Location aLocRes (aTrsf * aTrsfOrig); + aShape = anOriginal.Located(aLocRes); } - else if(aType == ROTATE_1D) { + else if (aType == ROTATE_1D) { //Get direction Handle(GEOM_Function) anAxis = RI.GetAxis(); if(anAxis.IsNull()) return 0; @@ -138,27 +150,34 @@ Standard_Integer GEOMImpl_RotateDriver::Execute(TFunction_Logbook& log) const gp_Pnt aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge)); gp_Pnt aP2 = BRep_Tool::Pnt(TopExp::LastVertex(anEdge)); - gp_Dir D(gp_Vec(aP1, aP2)) ; + gp_Dir D(gp_Vec(aP1, aP2)); - gp_Ax1 AX1(aP1, D) ; + gp_Ax1 AX1(aP1, D); Standard_Integer nbtimes = RI.GetNbIter1(); - Standard_Real angle = 360.0/nbtimes ; + Standard_Real angle = 360.0/nbtimes; TopoDS_Compound aCompound; BRep_Builder B; B.MakeCompound( aCompound ); - + + TopLoc_Location aLocOrig = anOriginal.Location(); + gp_Trsf aTrsfOrig = aLocOrig.Transformation(); + for (int i = 0; i < nbtimes; i++ ) { - aTrsf.SetRotation(AX1, i*angle*PI180) ; - BRepBuilderAPI_Transform myBRepTransformation(anOriginal, aTrsf, Standard_False) ; - B.Add( aCompound, myBRepTransformation.Shape() ); + aTrsf.SetRotation(AX1, i*angle*PI180); + //NPAL18620: performance problem: multiple locations are accumulated + // in shape and need a great time to process + //BRepBuilderAPI_Transform aBRepTransformation(anOriginal, aTrsf, Standard_False); + //B.Add(aCompound, aBRepTransformation.Shape()); + TopLoc_Location aLocRes (aTrsf * aTrsfOrig); + B.Add(aCompound, anOriginal.Located(aLocRes)); } - aShape = aCompound ; + aShape = aCompound; } - else if(aType == ROTATE_2D) { - Standard_Real DX, DY, DZ ; + else if (aType == ROTATE_2D) { + Standard_Real DX, DY, DZ; //Get direction Handle(GEOM_Function) anAxis = RI.GetAxis(); @@ -168,77 +187,81 @@ Standard_Integer GEOMImpl_RotateDriver::Execute(TFunction_Logbook& log) const TopoDS_Edge anEdge = TopoDS::Edge(A); gp_Pnt aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge)); gp_Pnt aP2 = BRep_Tool::Pnt(TopExp::LastVertex(anEdge)); - gp_Dir D(gp_Vec(aP1, aP2)) ; + gp_Dir D(gp_Vec(aP1, aP2)); + + gp_Ax1 AX1(aP1, D); - gp_Ax1 AX1(aP1, D) ; + gp_Trsf aTrsf1; + gp_Trsf aTrsf2; + gp_Pnt P1; + GProp_GProps System; - gp_Trsf theTransformation1 ; - gp_Trsf theTransformation2 ; - gp_Pnt P1 ; - GProp_GProps System ; - - if ( anOriginal.ShapeType() == TopAbs_VERTEX) { + if (anOriginal.ShapeType() == TopAbs_VERTEX) { P1 = BRep_Tool::Pnt(TopoDS::Vertex( anOriginal )); - } + } else if ( anOriginal.ShapeType() == TopAbs_EDGE || anOriginal.ShapeType() == TopAbs_WIRE ) { BRepGProp::LinearProperties(anOriginal, System); - P1 = System.CentreOfMass() ; + P1 = System.CentreOfMass(); } else if ( anOriginal.ShapeType() == TopAbs_FACE || anOriginal.ShapeType() == TopAbs_SHELL ) { BRepGProp::SurfaceProperties(anOriginal, System); - P1 = System.CentreOfMass() ; + P1 = System.CentreOfMass(); } else { BRepGProp::VolumeProperties(anOriginal, System); - P1 = System.CentreOfMass() ; + P1 = System.CentreOfMass(); } - + Handle(Geom_Line) Line = new Geom_Line(AX1); - GeomAPI_ProjectPointOnCurve aPrjTool( P1, Line ) ; + GeomAPI_ProjectPointOnCurve aPrjTool( P1, Line ); gp_Pnt P2 = aPrjTool.NearestPoint(); - + if ( P1.IsEqual(P2, Precision::Confusion() ) ) return 0; - - gp_Vec Vec(P1.X()-P2.X(), P1.Y()-P2.Y(), P1.Z()-P2.Z()) ; + + gp_Vec Vec(P1.X()-P2.X(), P1.Y()-P2.Y(), P1.Z()-P2.Z()); Vec.Normalize(); - + Standard_Integer nbtimes2 = RI.GetNbIter2(); Standard_Integer nbtimes1 = RI.GetNbIter1(); Standard_Real step = RI.GetStep(); Standard_Real ang = RI.GetAngle(); - gp_Vec myVec ; + TopLoc_Location aLocOrig = anOriginal.Location(); + gp_Trsf aTrsfOrig = aLocOrig.Transformation(); + + gp_Vec aVec; TopoDS_Compound aCompound; BRep_Builder B; B.MakeCompound( aCompound ); for (int i = 0; i < nbtimes2; i++ ) { for (int j = 0; j < nbtimes1; j++ ) { - DX = i * step * Vec.X() ; - DY = i * step * Vec.Y() ; - DZ = i * step * Vec.Z() ; - myVec.SetCoord( DX, DY, DZ ) ; - theTransformation1.SetTranslation(myVec) ; - theTransformation2.SetRotation(AX1, j*ang*PI180) ; - BRepBuilderAPI_Transform myBRepTransformation1(anOriginal, theTransformation1, Standard_False) ; - BRepBuilderAPI_Transform myBRepTransformation2(myBRepTransformation1.Shape(), theTransformation2, Standard_False) ; - B.Add( aCompound, myBRepTransformation2.Shape() ); + DX = i * step * Vec.X(); + DY = i * step * Vec.Y(); + DZ = i * step * Vec.Z(); + aVec.SetCoord( DX, DY, DZ ); + aTrsf1.SetTranslation(aVec); + aTrsf2.SetRotation(AX1, j*ang*PI180); + //NPAL18620: performance problem: multiple locations are accumulated + // in shape and need a great time to process + //BRepBuilderAPI_Transform aBRepTrsf1 (anOriginal, aTrsf1, Standard_False); + //BRepBuilderAPI_Transform aBRepTrsf2 (aBRepTrsf1.Shape(), aTrsf2, Standard_False); + //B.Add(aCompound, aBRepTrsf2.Shape()); + TopLoc_Location aLocRes (aTrsf2 * aTrsf1 * aTrsfOrig); + B.Add(aCompound, anOriginal.Located(aLocRes)); } } aShape = aCompound; - } else return 0; - - if (aShape.IsNull()) return 0; aFunction->SetValue(aShape); - log.SetTouched(Label()); + log.SetTouched(Label()); return 1; } @@ -247,17 +270,15 @@ Standard_Integer GEOMImpl_RotateDriver::Execute(TFunction_Logbook& log) const //======================================================================= //function : GEOMImpl_RotateDriver_Type_ //purpose : -//======================================================================= +//======================================================================= Standard_EXPORT Handle_Standard_Type& GEOMImpl_RotateDriver_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); + 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_RotateDriver", @@ -272,8 +293,7 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_RotateDriver_Type_() //======================================================================= //function : DownCast //purpose : -//======================================================================= - +//======================================================================= const Handle(GEOMImpl_RotateDriver) Handle(GEOMImpl_RotateDriver)::DownCast(const Handle(Standard_Transient)& AnObject) { Handle(GEOMImpl_RotateDriver) _anOtherObject; @@ -284,7 +304,5 @@ const Handle(GEOMImpl_RotateDriver) Handle(GEOMImpl_RotateDriver)::DownCast(cons } } - return _anOtherObject ; + return _anOtherObject; } - - diff --git a/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx b/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx index 4343903d5..349b59f09 100644 --- a/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx @@ -147,7 +147,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const aFW->Load(aWire); aFW->FixReorder(); - if (aFW->StatusReorder(ShapeExtend_FAIL1)) { + if (aFW->StatusReorder(ShapeExtend_FAIL1)) { Standard_ConstructionError::Raise("Wire construction failed: several loops detected"); } else if (aFW->StatusReorder(ShapeExtend_FAIL)) { Standard_ConstructionError::Raise("Wire construction failed"); @@ -155,6 +155,13 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const Standard_ConstructionError::Raise("Wire construction failed: some gaps detected"); } else { } + + aFW->ClosedWireMode() = Standard_False; + aFW->FixConnected(); + if (aFW->StatusConnected(ShapeExtend_FAIL)) { + Standard_ConstructionError::Raise("Wire construction failed: cannot build connected wire"); + } + aShape = aFW->WireAPIMake(); } } diff --git a/src/GEOMImpl/GEOMImpl_TranslateDriver.cxx b/src/GEOMImpl/GEOMImpl_TranslateDriver.cxx index 8bc498a2a..ad967865b 100644 --- a/src/GEOMImpl/GEOMImpl_TranslateDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_TranslateDriver.cxx @@ -1,18 +1,18 @@ // 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 +// 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 +// +// 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 +// 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 @@ -42,33 +42,33 @@ //======================================================================= //function : GetID //purpose : -//======================================================================= +//======================================================================= const Standard_GUID& GEOMImpl_TranslateDriver::GetID() { static Standard_GUID aTranslateDriver("FF1BBB03-5D14-4df2-980B-3A668264EA16"); - return aTranslateDriver; + return aTranslateDriver; } //======================================================================= //function : GEOMImpl_TranslateDriver -//purpose : +//purpose : //======================================================================= -GEOMImpl_TranslateDriver::GEOMImpl_TranslateDriver() +GEOMImpl_TranslateDriver::GEOMImpl_TranslateDriver() { } //======================================================================= //function : Execute //purpose : -//======================================================================= +//======================================================================= Standard_Integer GEOMImpl_TranslateDriver::Execute(TFunction_Logbook& log) const { - if(Label().IsNull()) return 0; + if (Label().IsNull()) return 0; Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); - if(aFunction.IsNull()) return 0; + if (aFunction.IsNull()) return 0; GEOMImpl_ITranslate TI(aFunction); gp_Trsf aTrsf; @@ -76,11 +76,11 @@ Standard_Integer GEOMImpl_TranslateDriver::Execute(TFunction_Logbook& log) const Standard_Integer aType = aFunction->GetType(); Handle(GEOM_Function) anOriginalFunction = TI.GetOriginal(); - if(anOriginalFunction.IsNull()) return 0; + if (anOriginalFunction.IsNull()) return 0; TopoDS_Shape aShape, anOriginal = anOriginalFunction->GetValue(); - if(anOriginal.IsNull()) return 0; + if (anOriginal.IsNull()) return 0; - if(aType == TRANSLATE_TWO_POINTS || aType == TRANSLATE_TWO_POINTS_COPY) { + if (aType == TRANSLATE_TWO_POINTS || aType == TRANSLATE_TWO_POINTS_COPY) { Handle(GEOM_Function) aPoint1 = TI.GetPoint1(); Handle(GEOM_Function) aPoint2 = TI.GetPoint2(); if(aPoint1.IsNull() || aPoint2.IsNull()) return 0; @@ -93,10 +93,16 @@ Standard_Integer GEOMImpl_TranslateDriver::Execute(TFunction_Logbook& log) const aP2 = BRep_Tool::Pnt(TopoDS::Vertex(aV2)); aTrsf.SetTranslation(aP1, aP2); - BRepBuilderAPI_Transform aTransformation(anOriginal, aTrsf, Standard_False); - aShape = aTransformation.Shape(); - - } else if(aType == TRANSLATE_VECTOR || aType == TRANSLATE_VECTOR_COPY) { + //NPAL18620: performance problem: multiple locations are accumulated + // in shape and need a great time to process + //BRepBuilderAPI_Transform aTransformation(anOriginal, aTrsf, Standard_False); + //aShape = aTransformation.Shape(); + TopLoc_Location aLocOrig = anOriginal.Location(); + gp_Trsf aTrsfOrig = aLocOrig.Transformation(); + TopLoc_Location aLocRes (aTrsf * aTrsfOrig); + aShape = anOriginal.Located(aLocRes); + } + else if (aType == TRANSLATE_VECTOR || aType == TRANSLATE_VECTOR_COPY) { Handle(GEOM_Function) aVector = TI.GetVector(); if(aVector.IsNull()) return 0; TopoDS_Shape aV = aVector->GetValue(); @@ -107,19 +113,31 @@ Standard_Integer GEOMImpl_TranslateDriver::Execute(TFunction_Logbook& log) const aP2 = BRep_Tool::Pnt(TopExp::LastVertex(anEdge)); aTrsf.SetTranslation(aP1, aP2); - BRepBuilderAPI_Transform aTransformation(anOriginal, aTrsf, Standard_False); - aShape = aTransformation.Shape(); + //NPAL18620: performance problem: multiple locations are accumulated + // in shape and need a great time to process + //BRepBuilderAPI_Transform aTransformation(anOriginal, aTrsf, Standard_False); + //aShape = aTransformation.Shape(); + TopLoc_Location aLocOrig = anOriginal.Location(); + gp_Trsf aTrsfOrig = aLocOrig.Transformation(); + TopLoc_Location aLocRes (aTrsf * aTrsfOrig); + aShape = anOriginal.Located(aLocRes); } - else if(aType == TRANSLATE_XYZ || aType == TRANSLATE_XYZ_COPY) { - gp_Vec aVec(TI.GetDX(), TI.GetDY(), TI.GetDZ()); + else if (aType == TRANSLATE_XYZ || aType == TRANSLATE_XYZ_COPY) { + gp_Vec aVec (TI.GetDX(), TI.GetDY(), TI.GetDZ()); aTrsf.SetTranslation(aVec); - BRepBuilderAPI_Transform aTransformation(anOriginal, aTrsf, Standard_False); - aShape = aTransformation.Shape(); + //NPAL18620: performance problem: multiple locations are accumulated + // in shape and need a great time to process + //BRepBuilderAPI_Transform aTransformation (anOriginal, aTrsf, Standard_False); + //aShape = aTransformation.Shape(); + TopLoc_Location aLocOrig = anOriginal.Location(); + gp_Trsf aTrsfOrig = aLocOrig.Transformation(); + TopLoc_Location aLocRes (aTrsf * aTrsfOrig); + aShape = anOriginal.Located(aLocRes); } - else if(aType == TRANSLATE_1D) { + else if (aType == TRANSLATE_1D) { Standard_Real DX, DY, DZ, step = TI.GetStep1(); Standard_Integer nbtimes = TI.GetNbIter1(); - gp_Vec myVec ; + gp_Vec aVec; TopoDS_Compound aCompound; BRep_Builder B; B.MakeCompound( aCompound ); @@ -133,21 +151,28 @@ Standard_Integer GEOMImpl_TranslateDriver::Execute(TFunction_Logbook& log) const gp_Vec Vec(BRep_Tool::Pnt(TopExp::FirstVertex(anEdge)), BRep_Tool::Pnt(TopExp::LastVertex(anEdge))); Vec.Normalize(); - for (int i = 0; i < nbtimes; i++ ) { - DX = i * step * Vec.X() ; - DY = i * step * Vec.Y() ; - DZ = i * step * Vec.Z() ; - myVec.SetCoord( DX, DY, DZ ) ; - aTrsf.SetTranslation(myVec) ; - BRepBuilderAPI_Transform aTransformation(anOriginal, aTrsf, Standard_False) ; - B.Add(aCompound , aTransformation.Shape() ); + TopLoc_Location aLocOrig = anOriginal.Location(); + gp_Trsf aTrsfOrig = aLocOrig.Transformation(); + + for (int i = 0; i < nbtimes; i++) { + DX = i * step * Vec.X(); + DY = i * step * Vec.Y(); + DZ = i * step * Vec.Z(); + aVec.SetCoord( DX, DY, DZ ); + aTrsf.SetTranslation(aVec); + //NPAL18620: performance problem: multiple locations are accumulated + // in shape and need a great time to process + //BRepBuilderAPI_Transform aTransformation(anOriginal, aTrsf, Standard_False); + //B.Add(aCompound, aTransformation.Shape()); + TopLoc_Location aLocRes (aTrsf * aTrsfOrig); + B.Add(aCompound, anOriginal.Located(aLocRes)); } - aShape = aCompound; + aShape = aCompound; } - else if(aType == TRANSLATE_2D) { + else if (aType == TRANSLATE_2D) { Standard_Integer nbtimes1 = TI.GetNbIter1(), nbtimes2 = TI.GetNbIter2(); Standard_Real DX, DY, DZ, step1 = TI.GetStep1(), step2 = TI.GetStep2(); - gp_Vec myVec ; + gp_Vec aVec; Handle(GEOM_Function) aVector = TI.GetVector(); if(aVector.IsNull()) return 0; TopoDS_Shape aV = aVector->GetValue(); @@ -169,29 +194,35 @@ Standard_Integer GEOMImpl_TranslateDriver::Execute(TFunction_Logbook& log) const TopoDS_Compound aCompound; BRep_Builder B; B.MakeCompound( aCompound ); - - for (int i = 0; i < nbtimes1; i++ ) { - for (int j = 0; j < nbtimes2; j++ ) { - DX = i * step1 * Vec1.X() + j * step2 * Vec2.X() ; - DY = i * step1 * Vec1.Y() + j * step2 * Vec2.Y() ; - DZ = i * step1 * Vec1.Z() + j * step2 * Vec2.Z() ; - myVec.SetCoord( DX, DY, DZ ) ; - aTrsf.SetTranslation(myVec) ; - BRepBuilderAPI_Transform myBRepTransformation(anOriginal, aTrsf, Standard_False) ; - B.Add(aCompound , myBRepTransformation.Shape() ); + + TopLoc_Location aLocOrig = anOriginal.Location(); + gp_Trsf aTrsfOrig = aLocOrig.Transformation(); + + for (int i = 0; i < nbtimes1; i++) { + for (int j = 0; j < nbtimes2; j++) { + DX = i * step1 * Vec1.X() + j * step2 * Vec2.X(); + DY = i * step1 * Vec1.Y() + j * step2 * Vec2.Y(); + DZ = i * step1 * Vec1.Z() + j * step2 * Vec2.Z(); + aVec.SetCoord( DX, DY, DZ ); + aTrsf.SetTranslation(aVec); + //NPAL18620: performance problem: multiple locations are accumulated + // in shape and need a great time to process + //BRepBuilderAPI_Transform aBRepTransformation(anOriginal, aTrsf, Standard_False); + //B.Add(aCompound, aBRepTransformation.Shape()); + TopLoc_Location aLocRes (aTrsf * aTrsfOrig); + B.Add(aCompound, anOriginal.Located(aLocRes)); } } - aShape = aCompound; + aShape = aCompound; } else return 0; - if (aShape.IsNull()) return 0; aFunction->SetValue(aShape); - log.SetTouched(Label()); + log.SetTouched(Label()); return 1; } @@ -200,17 +231,16 @@ Standard_Integer GEOMImpl_TranslateDriver::Execute(TFunction_Logbook& log) const //======================================================================= //function : GEOMImpl_TranslateDriver_Type_ //purpose : -//======================================================================= +//======================================================================= Standard_EXPORT Handle_Standard_Type& GEOMImpl_TranslateDriver_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); + 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_TranslateDriver", @@ -225,8 +255,7 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_TranslateDriver_Type_() //======================================================================= //function : DownCast //purpose : -//======================================================================= - +//======================================================================= const Handle(GEOMImpl_TranslateDriver) Handle(GEOMImpl_TranslateDriver)::DownCast(const Handle(Standard_Transient)& AnObject) { Handle(GEOMImpl_TranslateDriver) _anOtherObject; @@ -237,7 +266,5 @@ const Handle(GEOMImpl_TranslateDriver) Handle(GEOMImpl_TranslateDriver)::DownCas } } - return _anOtherObject ; + return _anOtherObject; } - - diff --git a/src/GEOM_I/GEOM_Gen_i.cc b/src/GEOM_I/GEOM_Gen_i.cc index 0ba246973..106ee9ef6 100644 --- a/src/GEOM_I/GEOM_Gen_i.cc +++ b/src/GEOM_I/GEOM_Gen_i.cc @@ -565,8 +565,8 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::AddInStudy(SALOMEDS::Study_ptr theStudy, GEOM: //============================================================================ void GEOM_Gen_i::register_name(char * name) { - GEOM::GEOM_Gen_ptr g = GEOM::GEOM_Gen::_narrow(_this()); - name_service->Register(g, CORBA::string_dup(name)); + GEOM::GEOM_Gen_var g = _this(); + name_service->Register(g, name); } //============================================================================ @@ -599,6 +599,7 @@ GEOM::GEOM_IBasicOperations_ptr GEOM_Gen_i::GetIBasicOperations(CORBA::Long theS GEOM::GEOM_Gen_ptr engine = _this(); + //transfer reference on engine GEOM_IBasicOperations_i* aServant = new GEOM_IBasicOperations_i(_poa, engine, _impl->GetIBasicOperations(theStudyID)); @@ -928,7 +929,8 @@ GEOM_I_EXPORT const char * interfaceName) { GEOM_Gen_i * myGEOM_Gen_i = new GEOM_Gen_i(orb, poa, contId, instanceName, interfaceName); - myGEOM_Gen_i->register_name("/myGEOM_Gen"); // NRI : 11/07/2002 : Add for Supervision example + // Don't understand the reason of this register ???? +// myGEOM_Gen_i->register_name("/myGEOM_Gen"); // NRI : 11/07/2002 : Add for Supervision example return myGEOM_Gen_i->getId(); } } diff --git a/src/GEOM_I/GEOM_I3DPrimOperations_i.cc b/src/GEOM_I/GEOM_I3DPrimOperations_i.cc index 276a9d556..55160f0fb 100644 --- a/src/GEOM_I/GEOM_I3DPrimOperations_i.cc +++ b/src/GEOM_I/GEOM_I3DPrimOperations_i.cc @@ -247,8 +247,9 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeSpherePntR if (thePnt == NULL) return aGEOMObject._retn(); //Get the reference point + CORBA::String_var entry=thePnt->GetEntry(); Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject - (thePnt->GetStudyID(), thePnt->GetEntry()); + (thePnt->GetStudyID(), entry); if (aPnt.IsNull()) return aGEOMObject._retn(); @@ -566,7 +567,8 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFilling(GEOM::GEOM_Object_pt CORBA::Long theMaxDeg, CORBA::Double theTol2D, CORBA::Double theTol3D, - CORBA::Long theNbIter) + CORBA::Long theNbIter, + CORBA::Boolean theApprox) { GEOM::GEOM_Object_var aGEOMObject; @@ -582,7 +584,7 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFilling(GEOM::GEOM_Object_pt if (aShape.IsNull()) return aGEOMObject._retn(); //Create the Solid - Handle(GEOM_Object) anObject = GetOperations()->MakeFilling(aShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter); + Handle(GEOM_Object) anObject = GetOperations()->MakeFilling(aShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter, theApprox); if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); diff --git a/src/GEOM_I/GEOM_I3DPrimOperations_i.hh b/src/GEOM_I/GEOM_I3DPrimOperations_i.hh index f0397e5e9..330f4974b 100644 --- a/src/GEOM_I/GEOM_I3DPrimOperations_i.hh +++ b/src/GEOM_I/GEOM_I3DPrimOperations_i.hh @@ -105,7 +105,7 @@ class GEOM_I_EXPORT GEOM_I3DPrimOperations_i : GEOM::GEOM_Object_ptr theAxis, CORBA::Double theAngle); - GEOM::GEOM_Object_ptr MakeFilling(GEOM::GEOM_Object_ptr theShape, CORBA::Long theMinDeg, CORBA::Long theMaxDeg, CORBA::Double theTol2D, CORBA::Double theTol3D, CORBA::Long theNbIter); + GEOM::GEOM_Object_ptr MakeFilling(GEOM::GEOM_Object_ptr theShape, CORBA::Long theMinDeg, CORBA::Long theMaxDeg, CORBA::Double theTol2D, CORBA::Double theTol3D, CORBA::Long theNbIter, CORBA::Boolean theApprox); GEOM::GEOM_Object_ptr MakeThruSections(const GEOM::ListOfGO& theSeqSections, CORBA::Boolean theModeSolid, diff --git a/src/GEOM_I/GEOM_IBooleanOperations_i.cc b/src/GEOM_I/GEOM_IBooleanOperations_i.cc index 836451282..57dabf6a6 100644 --- a/src/GEOM_I/GEOM_IBooleanOperations_i.cc +++ b/src/GEOM_I/GEOM_IBooleanOperations_i.cc @@ -72,10 +72,12 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeBoolean if (theShape1 == NULL || theShape2 == NULL) return aGEOMObject._retn(); //Get the reference shapes + CORBA::String_var entry=theShape1->GetEntry(); Handle(GEOM_Object) aSh1 = GetOperations()->GetEngine()->GetObject - (theShape1->GetStudyID(), theShape1->GetEntry()); + (theShape1->GetStudyID(), entry); + entry=theShape2->GetEntry(); Handle(GEOM_Object) aSh2 = GetOperations()->GetEngine()->GetObject - (theShape2->GetStudyID(), theShape2->GetEntry()); + (theShape2->GetStudyID(), entry); if (aSh1.IsNull() || aSh2.IsNull()) return aGEOMObject._retn(); diff --git a/src/GEOM_I/GEOM_IOperations_i.cc b/src/GEOM_I/GEOM_IOperations_i.cc index 89b7fc5f8..3d5c87c46 100644 --- a/src/GEOM_I/GEOM_IOperations_i.cc +++ b/src/GEOM_I/GEOM_IOperations_i.cc @@ -114,7 +114,7 @@ void GEOM_IOperations_i::FinishOperation() //============================================================================= /*! - * AboutOperation + * AbortOperation */ //============================================================================= void GEOM_IOperations_i::AbortOperation() @@ -132,6 +132,6 @@ GEOM::GEOM_Object_ptr GEOM_IOperations_i::GetObject(Handle(GEOM_Object) theObjec if(theObject.IsNull()) return NULL; TCollection_AsciiString anEntry; TDF_Tool::Entry(theObject->GetEntry(), anEntry); - GEOM::GEOM_Object_var GO = GEOM::GEOM_Object::_duplicate(_engine->GetObject(theObject->GetDocID(), anEntry.ToCString())); + GEOM::GEOM_Object_var GO = _engine->GetObject(theObject->GetDocID(), anEntry.ToCString()); return GO._retn(); } diff --git a/src/GEOM_I/GEOM_IOperations_i.hh b/src/GEOM_I/GEOM_IOperations_i.hh index 9ad5fca9a..c425449dc 100644 --- a/src/GEOM_I/GEOM_IOperations_i.hh +++ b/src/GEOM_I/GEOM_IOperations_i.hh @@ -59,7 +59,7 @@ class GEOM_I_EXPORT GEOM_IOperations_i : public virtual POA_GEOM::GEOM_IOperatio private: ::GEOM_IOperations* _impl; - GEOM::GEOM_Gen_ptr _engine; + GEOM::GEOM_Gen_var _engine; }; #endif diff --git a/src/GEOM_I/GEOM_Object_i.cc b/src/GEOM_I/GEOM_Object_i.cc index d8794d7b9..4a86443b6 100644 --- a/src/GEOM_I/GEOM_Object_i.cc +++ b/src/GEOM_I/GEOM_Object_i.cc @@ -61,7 +61,9 @@ GEOM_Object_i::GEOM_Object_i (PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr //============================================================================= GEOM_Object_i::~GEOM_Object_i() -{} +{ + GEOM_Engine::GetEngine()->RemoveObject(_impl); +} //============================================================================= diff --git a/src/GEOM_I/GEOM_Object_i.hh b/src/GEOM_I/GEOM_Object_i.hh index 43711eacd..56631b7f0 100644 --- a/src/GEOM_I/GEOM_Object_i.hh +++ b/src/GEOM_I/GEOM_Object_i.hh @@ -85,7 +85,7 @@ class GEOM_I_EXPORT GEOM_Object_i : public virtual POA_GEOM::GEOM_Object, public private: - GEOM::GEOM_Gen_ptr _engine; + GEOM::GEOM_Gen_var _engine; Handle(GEOM_Object) _impl; TopoDS_Shape _geom; }; diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.cc b/src/GEOM_I_Superv/GEOM_Superv_i.cc index 666ec0861..520fbc2fe 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.cc +++ b/src/GEOM_I_Superv/GEOM_Superv_i.cc @@ -70,6 +70,12 @@ GEOM_Superv_i::GEOM_Superv_i(CORBA::ORB_ptr orb, GEOM_Superv_i::~GEOM_Superv_i() { MESSAGE("GEOM_Superv_i::~GEOM_Superv_i"); + if (!CORBA::is_nil(myBasicOp)) + myBasicOp->Destroy(); + if (!CORBA::is_nil(myBoolOp)) + myBoolOp->Destroy(); + if (!CORBA::is_nil(my3DPrimOp)) + my3DPrimOp->Destroy(); delete name_service; } @@ -79,8 +85,8 @@ GEOM_Superv_i::~GEOM_Superv_i() //============================================================================ void GEOM_Superv_i::register_name(char * name) { - GEOM::GEOM_Superv_ptr g = GEOM::GEOM_Superv::_narrow(POA_GEOM::GEOM_Superv::_this()); - name_service->Register(g, strdup(name)); + GEOM::GEOM_Superv_var g = _this(); + name_service->Register(g, name); } //============================================================================= @@ -88,9 +94,17 @@ void GEOM_Superv_i::register_name(char * name) //============================================================================= void GEOM_Superv_i::setGeomEngine() { + if ( !CORBA::is_nil(myGeomEngine) ) + return; // get GEOM_Gen engine + /* SALOME_LifeCycleCORBA* lcc = new SALOME_LifeCycleCORBA( name_service ); Engines::Component_var comp = lcc->FindOrLoad_Component( "FactoryServer", "GEOM" ); + */ + + Engines::Container_var cont=GetContainerRef(); + cont->load_component_Library("GEOM"); + Engines::Component_var comp=cont->create_component_instance("GEOM",0); myGeomEngine = GEOM::GEOM_Gen::_narrow(comp); } @@ -799,7 +813,9 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeSphere (CORBA::Double theX, MESSAGE("GEOM_Superv_i::MakeSphepe"); getBasicOp(); get3DPrimOp(); - GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakeSpherePntR(myBasicOp->MakePointXYZ(theX, theY, theZ), theRadius); + GEOM::GEOM_Object_var o = myBasicOp->MakePointXYZ(theX, theY, theZ); + GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakeSpherePntR(o, theRadius); + o->Destroy(); endService( " GEOM_Superv_i::MakeSphepe" ); return anObj; } @@ -1003,12 +1019,12 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeRevolutionAxisAngle2Ways (GEOM::GEOM_Ob GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFilling (GEOM::GEOM_Object_ptr theShape, CORBA::Long theMinDeg, CORBA::Long theMaxDeg, CORBA::Double theTol2D, CORBA::Double theTol3D, - CORBA::Long theNbIter) + CORBA::Long theNbIter, CORBA::Boolean theApprox) { beginService( " GEOM_Superv_i::MakeFilling" ); MESSAGE("GEOM_Superv_i::MakeFilling"); get3DPrimOp(); - GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakeFilling(theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter); + GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakeFilling(theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter, theApprox); endService( " GEOM_Superv_i::MakeFilling" ); return anObj; } @@ -2737,7 +2753,8 @@ extern "C" const char * interfaceName) { GEOM_Superv_i * myGEOM_Superv_i = new GEOM_Superv_i(orb, poa, contId, instanceName, interfaceName); - myGEOM_Superv_i->register_name("/myGEOM_Superv"); + //Don't understand the reason why this component is registered ??? +// myGEOM_Superv_i->register_name("/myGEOM_Superv"); return myGEOM_Superv_i->getId() ; } } diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.hh b/src/GEOM_I_Superv/GEOM_Superv_i.hh index 0d3039704..3cb1ffd25 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.hh +++ b/src/GEOM_I_Superv/GEOM_Superv_i.hh @@ -237,7 +237,7 @@ public: GEOM::GEOM_Object_ptr MakeFilling (GEOM::GEOM_Object_ptr theShape, CORBA::Long theMinDeg, CORBA::Long theMaxDeg, CORBA::Double theTol2D, CORBA::Double theTol3D, - CORBA::Long theNbIter); + CORBA::Long theNbIter, CORBA::Boolean theApprox); GEOM::GEOM_Object_ptr MakeThruSections(const GEOM::ListOfGO& theSeqSections, CORBA::Boolean theModeSolid, @@ -566,21 +566,21 @@ public: private: SALOME_NamingService * name_service; - GEOM::GEOM_Gen_ptr myGeomEngine; + GEOM::GEOM_Gen_var myGeomEngine; CORBA::Long myStudyID; CORBA::Long myLastStudyID; // mkr : PAL10770 PortableServer::POA_var myPOA; - GEOM::GEOM_IBasicOperations_ptr myBasicOp; - GEOM::GEOM_I3DPrimOperations_ptr my3DPrimOp; - GEOM::GEOM_IBooleanOperations_ptr myBoolOp; - GEOM::GEOM_IInsertOperations_ptr myInsOp; - GEOM::GEOM_ITransformOperations_ptr myTransfOp; - GEOM::GEOM_IShapesOperations_ptr myShapesOp; - GEOM::GEOM_IBlocksOperations_ptr myBlocksOp; - GEOM::GEOM_ICurvesOperations_ptr myCurvesOp; - GEOM::GEOM_ILocalOperations_ptr myLocalOp; - GEOM::GEOM_IGroupOperations_ptr myGroupOp; + GEOM::GEOM_IBasicOperations_var myBasicOp; + GEOM::GEOM_I3DPrimOperations_var my3DPrimOp; + GEOM::GEOM_IBooleanOperations_var myBoolOp; + GEOM::GEOM_IInsertOperations_var myInsOp; + GEOM::GEOM_ITransformOperations_var myTransfOp; + GEOM::GEOM_IShapesOperations_var myShapesOp; + GEOM::GEOM_IBlocksOperations_var myBlocksOp; + GEOM::GEOM_ICurvesOperations_var myCurvesOp; + GEOM::GEOM_ILocalOperations_var myLocalOp; + GEOM::GEOM_IGroupOperations_var myGroupOp; }; diff --git a/src/GEOM_SWIG/batchmode_geompy.py b/src/GEOM_SWIG/batchmode_geompy.py index 6485368cf..3ca8d022f 100644 --- a/src/GEOM_SWIG/batchmode_geompy.py +++ b/src/GEOM_SWIG/batchmode_geompy.py @@ -700,8 +700,8 @@ def MakeCopy(aShape): print "MakeCopy : ", InsertOp.GetErrorCode() return anObj -def MakeFilling(aShape,mindeg,maxdeg,tol2d,tol3d,nbiter): - anObj = PrimOp.MakeFilling(aShape,mindeg,maxdeg,tol2d,tol3d,nbiter) +def MakeFilling(aShape,mindeg,maxdeg,tol2d,tol3d,nbiter,isApprox=0): + anObj = PrimOp.MakeFilling(aShape,mindeg,maxdeg,tol2d,tol3d,nbiter,isApprox) if PrimOp.IsDone() == 0: print "MakeFilling : ", PrimOp.GetErrorCode() return anObj diff --git a/src/GEOM_SWIG/geompyDC.py b/src/GEOM_SWIG/geompyDC.py index 415ff983b..2f37c4e86 100644 --- a/src/GEOM_SWIG/geompyDC.py +++ b/src/GEOM_SWIG/geompyDC.py @@ -1379,8 +1379,8 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @return New GEOM_Object, containing the created filling surface. # # Example: see GEOM_TestAll.py - def MakeFilling(self,theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter): - anObj = self.PrimOp.MakeFilling(theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter) + def MakeFilling(self,theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter, isApprox=0): + anObj = self.PrimOp.MakeFilling(theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter, isApprox) RaiseIfFailed("MakeFilling", self.PrimOp) return anObj diff --git a/src/GenerationGUI/GenerationGUI_FillingDlg.cxx b/src/GenerationGUI/GenerationGUI_FillingDlg.cxx index 8371188a6..31882eb9e 100644 --- a/src/GenerationGUI/GenerationGUI_FillingDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_FillingDlg.cxx @@ -61,7 +61,7 @@ GenerationGUI_FillingDlg::GenerationGUI_FillingDlg( GeometryGUI* theGeometryGUI, mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); mainFrame()->RadioButton3->close(); - GroupPoints = new DlgRef_1Sel5Spin( centralWidget() ); + GroupPoints = new DlgRef_1Sel5Spin1Check( centralWidget() ); GroupPoints->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) ); GroupPoints->TextLabel1->setText( tr( "GEOM_FILLING_COMPOUND" ) ); GroupPoints->TextLabel2->setText( tr( "GEOM_FILLING_MIN_DEG" ) ); @@ -69,6 +69,7 @@ GenerationGUI_FillingDlg::GenerationGUI_FillingDlg( GeometryGUI* theGeometryGUI, GroupPoints->TextLabel4->setText( tr( "GEOM_FILLING_NB_ITER" ) ); GroupPoints->TextLabel5->setText( tr( "GEOM_FILLING_MAX_DEG" ) ); GroupPoints->TextLabel6->setText( tr( "GEOM_FILLING_TOL_3D" ) ); + GroupPoints->CheckBox1->setText( tr( "GEOM_FILLING_APPROX" ) ); GroupPoints->PushButton1->setIcon( image1 ); GroupPoints->LineEdit1->setReadOnly( true ); @@ -77,7 +78,7 @@ GenerationGUI_FillingDlg::GenerationGUI_FillingDlg( GeometryGUI* theGeometryGUI, layout->addWidget( GroupPoints ); /***************************************************************/ - setHelpFileName( "creaet_filling_page.html" ); + setHelpFileName( "create_filling_page.html" ); /* Initialisations */ Init(); @@ -107,6 +108,7 @@ void GenerationGUI_FillingDlg::Init() myTol3D = 0.0001; myTol2D = 0.0001; myNbIter = 5; + myIsApprox = false; myOkCompound = false; globalSelection( GEOM_COMPOUND ); @@ -139,6 +141,8 @@ void GenerationGUI_FillingDlg::Init() connect( GroupPoints->SpinBox4, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); connect( GroupPoints->SpinBox5, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( GroupPoints->CheckBox1, SIGNAL( stateChanged( int ) ), this, SLOT( ApproxChanged() ) ); + // VSR: TODO ->> connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox1, SLOT( SetStep( double ) ) ); connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox2, SLOT( SetStep( double ) ) ); @@ -300,6 +304,16 @@ void GenerationGUI_FillingDlg::ValueChangedInSpinBox( double newValue ) displayPreview(); } +//================================================================================= +// function : ApproxChanged() +// purpose : +//================================================================================= +void GenerationGUI_FillingDlg::ApproxChanged() +{ + myIsApprox = GroupPoints->CheckBox1->isChecked(); + displayPreview(); +} + //================================================================================= // function : createOperation // purpose : @@ -327,7 +341,7 @@ bool GenerationGUI_FillingDlg::execute( ObjectList& objects ) GEOM::GEOM_Object_var anObj; anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation() )->MakeFilling( - myCompound, myMinDeg, myMaxDeg, myTol2D, myTol3D, myNbIter ); + myCompound, myMinDeg, myMaxDeg, myTol2D, myTol3D, myNbIter, myIsApprox ); if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); diff --git a/src/GenerationGUI/GenerationGUI_FillingDlg.h b/src/GenerationGUI/GenerationGUI_FillingDlg.h index 23be3e400..03d602cd9 100644 --- a/src/GenerationGUI/GenerationGUI_FillingDlg.h +++ b/src/GenerationGUI/GenerationGUI_FillingDlg.h @@ -28,7 +28,7 @@ #include -class DlgRef_1Sel5Spin; +class DlgRef_1Sel5Spin1Check; //================================================================================= // class : GenerationGUI_FillingDlg @@ -59,9 +59,10 @@ private: Standard_Real myTol3D; Standard_Real myTol2D; Standard_Integer myNbIter; + bool myIsApprox; bool myOkCompound; /* to check when curv. compound is defined */ - DlgRef_1Sel5Spin* GroupPoints; + DlgRef_1Sel5Spin1Check* GroupPoints; private slots: void ClickOnOk(); @@ -71,6 +72,7 @@ private slots: void SelectionIntoArgument(); void SetEditCurrentArgument(); void ValueChangedInSpinBox( double ); + void ApproxChanged(); }; #endif // GENERATIONGUI_FILLINGDLG_H diff --git a/src/RepairGUI/RepairGUI_GlueDlg.cxx b/src/RepairGUI/RepairGUI_GlueDlg.cxx index 5b1feaced..207a02905 100644 --- a/src/RepairGUI/RepairGUI_GlueDlg.cxx +++ b/src/RepairGUI/RepairGUI_GlueDlg.cxx @@ -279,8 +279,10 @@ bool RepairGUI_GlueDlg::ClickOnApply() //================================================================================= void RepairGUI_GlueDlg::SelectionIntoArgument() { - if ( mySubShapesChk->isChecked() && getConstructorId() == 1 ) + if ( mySubShapesChk->isChecked() && getConstructorId() == 1 ) { + updateButtonState(); return; + } erasePreview(); myEditCurrentArgument->setText( "" ); @@ -603,6 +605,8 @@ void RepairGUI_GlueDlg::onDetect() msg = tr( "THERE_ARE_NO_FACES_FOR_GLUING" ); } + connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()) ) ; SUIT_MessageBox::information( this, tr( "GEOM_FREE_BOUNDS_TLT" ), msg, tr( "Close" ) ); updateButtonState(); activateSelection(); @@ -635,10 +639,13 @@ void RepairGUI_GlueDlg::activateSelection() globalSelection( GEOM_ALLSHAPES ); else { displayPreview( true, false, false, 2/*line width*/, 1/*display mode*/, Quantity_NOC_RED ); + disconnect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ) ; globalSelection( GEOM_PREVIEW ); - } + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ) ; + } } - updateViewer(); } @@ -656,9 +663,13 @@ void RepairGUI_GlueDlg::updateButtonState() } else { + bool wasSelected = false; + SALOME_ListIteratorOfListIO it ( selectedIO() ); + if (it.More() > 0) + wasSelected = true; bool wasDetected = myTmpObjs.size() ? true : false; - buttonOk()->setEnabled( hasMainObj && wasDetected ); - buttonApply()->setEnabled( hasMainObj && wasDetected ); + buttonOk()->setEnabled( hasMainObj && wasDetected && wasSelected ); + buttonApply()->setEnabled( hasMainObj && wasDetected && wasSelected ); mySubShapesChk->setEnabled( hasMainObj && wasDetected ); myDetectBtn->setEnabled( hasMainObj ); if ( !hasMainObj || !wasDetected )