From: abd Date: Wed, 18 Apr 2007 15:44:19 +0000 (+0000) Subject: Merging from V3_2_6pre4 X-Git-Tag: V4_0rc1~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a283b389c811dd9e363f9505e943456b1cbb253a;p=modules%2Fgeom.git Merging from V3_2_6pre4 --- diff --git a/configure.ac b/configure.ac index c5b8a5b74..90b44741a 100644 --- a/configure.ac +++ b/configure.ac @@ -350,7 +350,6 @@ echo AC_OUTPUT_COMMANDS([ \ chmod +x ./bin/*; \ - chmod +x ./bin/salome/*; \ ]) # This list is initiated using autoscan and must be updated manually diff --git a/doc/salome/gui/GEOM/arc.htm b/doc/salome/gui/GEOM/arc.htm index 3b8691125..cdf4570ad 100755 --- a/doc/salome/gui/GEOM/arc.htm +++ b/doc/salome/gui/GEOM/arc.htm @@ -16,14 +16,53 @@ if (navigator.appName !="Netscape") - + - - - - - - - - - - -

OCC 3D Viewer

- -

OCC (Open CasCade) 3D viewer - has been developed on the basis of Open CASCADE Technology. This is the - default viewer for Geometry Module, providing good representation of construction - and transformation of geometrical objects. Only this viewer allows to - work with groups and sub-shapes. This viewer can also work in Mesh module, - however, it doesn't allow to visualize meshes.

- -

 

- -

The functions of OCC viewer are available via its Viewer Toolbar. Buttons - marked with small downward triangles have extended functionality which - can be accessed by locking on them with left mouse button.  

- -

 

- -

- -

 

- - - - - -

- -

 

- -

By default the rotation point is located - in the Center of the bounding box of an object.

- -

 

- -

- -

 

- -

Unchecking Use - Bounding Box Center box allows you to define the coordinates of - the rotation point manually.

- -

 

- -

Set to Origin - button restores the default rotation point coordinates.

- -

Select Point - from View button allows to select the rotation point in the 3D - Viewer

- -

 

- - - -

 

- -

- -

 

- - - -

 

- - - - diff --git a/doc/salome/gui/GEOM/pics/arc2.png b/doc/salome/gui/GEOM/pics/arc2.png new file mode 100644 index 000000000..2bced2ae0 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/arc2.png differ diff --git a/doc/salome/gui/GEOM/pics/arcsn1.png b/doc/salome/gui/GEOM/pics/arcsn1.png new file mode 100644 index 000000000..564f12edf Binary files /dev/null and b/doc/salome/gui/GEOM/pics/arcsn1.png differ diff --git a/doc/salome/gui/GEOM/pics/arcsn2.png b/doc/salome/gui/GEOM/pics/arcsn2.png new file mode 100644 index 000000000..f2bec5d29 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/arcsn2.png differ diff --git a/doc/salome/gui/GEOM/pics/clipping.png b/doc/salome/gui/GEOM/pics/clipping.png deleted file mode 100755 index 6d738558e..000000000 Binary files a/doc/salome/gui/GEOM/pics/clipping.png and /dev/null differ diff --git a/doc/salome/gui/GEOM/pics/image100.gif b/doc/salome/gui/GEOM/pics/image100.gif deleted file mode 100755 index c44d68ffc..000000000 Binary files a/doc/salome/gui/GEOM/pics/image100.gif and /dev/null differ diff --git a/doc/salome/gui/GEOM/pics/image102.gif b/doc/salome/gui/GEOM/pics/image102.gif deleted file mode 100755 index 3507814ba..000000000 Binary files a/doc/salome/gui/GEOM/pics/image102.gif and /dev/null differ diff --git a/doc/salome/gui/GEOM/pics/image103.gif b/doc/salome/gui/GEOM/pics/image103.gif deleted file mode 100755 index be534c39e..000000000 Binary files a/doc/salome/gui/GEOM/pics/image103.gif and /dev/null differ diff --git a/doc/salome/gui/GEOM/pics/image105.gif b/doc/salome/gui/GEOM/pics/image105.gif deleted file mode 100755 index 4f6173f82..000000000 Binary files a/doc/salome/gui/GEOM/pics/image105.gif and /dev/null differ diff --git a/doc/salome/gui/GEOM/pics/image106.gif b/doc/salome/gui/GEOM/pics/image106.gif deleted file mode 100755 index 2bbcb4d94..000000000 Binary files a/doc/salome/gui/GEOM/pics/image106.gif and /dev/null differ diff --git a/doc/salome/gui/GEOM/pics/image77.gif b/doc/salome/gui/GEOM/pics/image77.gif deleted file mode 100755 index ef7a62f32..000000000 Binary files a/doc/salome/gui/GEOM/pics/image77.gif and /dev/null differ diff --git a/doc/salome/gui/GEOM/pics/image86.gif b/doc/salome/gui/GEOM/pics/image86.gif deleted file mode 100755 index 339733193..000000000 Binary files a/doc/salome/gui/GEOM/pics/image86.gif and /dev/null differ diff --git a/doc/salome/gui/GEOM/pics/image88.gif b/doc/salome/gui/GEOM/pics/image88.gif deleted file mode 100755 index 9466aa6ce..000000000 Binary files a/doc/salome/gui/GEOM/pics/image88.gif and /dev/null differ diff --git a/doc/salome/gui/GEOM/pics/image89.gif b/doc/salome/gui/GEOM/pics/image89.gif deleted file mode 100755 index 373a6c026..000000000 Binary files a/doc/salome/gui/GEOM/pics/image89.gif and /dev/null differ diff --git a/doc/salome/gui/GEOM/pics/image91.gif b/doc/salome/gui/GEOM/pics/image91.gif deleted file mode 100755 index 9e93c1c72..000000000 Binary files a/doc/salome/gui/GEOM/pics/image91.gif and /dev/null differ diff --git a/doc/salome/gui/GEOM/pics/image95.gif b/doc/salome/gui/GEOM/pics/image95.gif deleted file mode 100755 index fb293e234..000000000 Binary files a/doc/salome/gui/GEOM/pics/image95.gif and /dev/null differ diff --git a/doc/salome/gui/GEOM/pics/image96.gif b/doc/salome/gui/GEOM/pics/image96.gif deleted file mode 100755 index 4580d5b5c..000000000 Binary files a/doc/salome/gui/GEOM/pics/image96.gif and /dev/null differ diff --git a/doc/salome/gui/GEOM/pics/image97.gif b/doc/salome/gui/GEOM/pics/image97.gif deleted file mode 100755 index 1d78de1bc..000000000 Binary files a/doc/salome/gui/GEOM/pics/image97.gif and /dev/null differ diff --git a/doc/salome/gui/GEOM/pics/image98.gif b/doc/salome/gui/GEOM/pics/image98.gif deleted file mode 100755 index 6519dbb67..000000000 Binary files a/doc/salome/gui/GEOM/pics/image98.gif and /dev/null differ diff --git a/doc/salome/gui/GEOM/pics/image99.gif b/doc/salome/gui/GEOM/pics/image99.gif deleted file mode 100755 index 3711be813..000000000 Binary files a/doc/salome/gui/GEOM/pics/image99.gif and /dev/null differ diff --git a/doc/salome/gui/GEOM/pics/set_rotation_point_dialog1.png b/doc/salome/gui/GEOM/pics/set_rotation_point_dialog1.png deleted file mode 100644 index bdab73b7d..000000000 Binary files a/doc/salome/gui/GEOM/pics/set_rotation_point_dialog1.png and /dev/null differ diff --git a/doc/salome/gui/GEOM/pics/set_rotation_point_dialog2.png b/doc/salome/gui/GEOM/pics/set_rotation_point_dialog2.png deleted file mode 100644 index 7f3696a56..000000000 Binary files a/doc/salome/gui/GEOM/pics/set_rotation_point_dialog2.png and /dev/null differ diff --git a/doc/salome/gui/GEOM/pics/view_rotation_point.png b/doc/salome/gui/GEOM/pics/view_rotation_point.png deleted file mode 100644 index 7fe8f8389..000000000 Binary files a/doc/salome/gui/GEOM/pics/view_rotation_point.png and /dev/null differ diff --git a/doc/salome/gui/GEOM/pics/workplane4.png b/doc/salome/gui/GEOM/pics/workplane4.png index 6e9ead8f9..00835eb54 100755 Binary files a/doc/salome/gui/GEOM/pics/workplane4.png and b/doc/salome/gui/GEOM/pics/workplane4.png differ diff --git a/doc/salome/gui/GEOM/pics/workplane5.png b/doc/salome/gui/GEOM/pics/workplane5.png index a20eb6021..925ac573b 100755 Binary files a/doc/salome/gui/GEOM/pics/workplane5.png and b/doc/salome/gui/GEOM/pics/workplane5.png differ diff --git a/doc/salome/gui/GEOM/pics/workplane6.png b/doc/salome/gui/GEOM/pics/workplane6.png index 5e5134821..1f65862f8 100755 Binary files a/doc/salome/gui/GEOM/pics/workplane6.png and b/doc/salome/gui/GEOM/pics/workplane6.png differ diff --git a/doc/salome/gui/GEOM/vector.htm b/doc/salome/gui/GEOM/vector.htm index e6ab39507..31fc7d1cd 100755 --- a/doc/salome/gui/GEOM/vector.htm +++ b/doc/salome/gui/GEOM/vector.htm @@ -21,7 +21,8 @@ p.whs4 { font-size:12pt; font-weight:bold; } p.whs5 { font-size:12pt; margin-left:40px; } img_whs6 { border:none; width:312px; height:324px; float:none; border-style:none; } img_whs7 { border:none; width:312px; height:358px; float:none; border-style:none; } -img_whs8 { border:none; width:298px; height:302px; float:none; border-style:none; } +p.whs8 { font-size:12pt; margin-left:40px; font-weight:bold; } +img_whs9 { border:none; width:156px; height:203px; } -->

Working Plane

+

Definition of a Working Plane + is necessary for work with Sketcher. +

+ +

 

+

To create a Working Plane in the Main Menu select New Entity - > Basic - > Working Plane

 

-

There are some algorithms to set the Working Plane and the Camera Position.

+

There is a number of algorithms to set the + Working Plane and the Camera Position.

 

@@ -98,12 +115,12 @@ if (window.writeIntopicBar) Face or a Local Coordinate System to be your Working Plane

-

Arguments: Name + 1 selection (face - or planar face),

+

Arguments: + Name + 1 selection (face or planar face),

 

-

+

 

@@ -112,9 +129,11 @@ if (window.writeIntopicBar)

Arguments: Name +  2 - vectors,

+ vectors.

+ +

 

-

+

 

@@ -124,9 +143,38 @@ if (window.writeIntopicBar)

 

-

+

-

 

+

 

+ +

Reverse the plane normal checkbox + allows changing the direction of the working plane.

+ +

 

+ +

Example: Working plane on the + upper face of a box.  

+ +

 

+ + +++ + + + + + + + +
+

Normal Direction

+

Reversed Direction

+

+

+ +

 

 

diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index 59f490e7f..05c9fe46f 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -147,7 +147,7 @@ module GEOM /*! * Get the TopoDS_Shape, for colocated case only. */ - long getShape(); + long long getShape(); /*! ###################################################################### @@ -888,6 +888,29 @@ module GEOM in boolean theWithContact , in boolean theWithCorrection ); + /*! + * Create a shape by extrusion of the profile shape along + * the path shape. The path shape can be a shell or a face. + * the several profiles can be specified in the several locations of path. + * \param theSeqBases - list of Bases shape to be extruded. + * \param theSeqSubBases - list of corresponding subshapes of section shapes. + * \param theLocations - list of locations on the path corresponding + * specified list of the Bases shapes. Number of locations + * should be equal to number of bases or list of locations can be empty. + * \param thePath - Path shape to extrude the base shape along it. + * \param theWithContact - the mode defining that the section is translated to be in + * contact with the spine. + * \param - WithCorrection - defining that the section is rotated to be + * orthogonal to the spine tangent in the correspondent point + * \return New GEOM_Object, containing the created pipe. + */ + GEOM_Object MakePipeWithShellSections (in ListOfGO theSeqBases, + in ListOfGO theSeqSubBases, + in ListOfGO theLocations, + in GEOM_Object thePath, + in boolean theWithContact , + in boolean theWithCorrection ); + }; /*! @@ -966,6 +989,25 @@ module GEOM */ GEOM_Object MakeGlueFaces (in GEOM_Object theShape, in double theTolerance); + /*! + * Find coincident faces in theShape for possible gluing. + * \param theShape Initial shape. + * \param theTolerance Maximum distance between faces, which can be considered as coincident. + * \return ListOfGO + */ + ListOfGO GetGlueFaces (in GEOM_Object theShape, in double theTolerance); + + /*! + * Replace coincident faces in theShape by one face + * in compliance with given list of faces + * \param theShape Initial shape. + * \param theTolerance Maximum distance between faces, which can be considered as coincident. + * \param theFaces List of faces for gluing. + * \return New GEOM_Object, containing a copy of theShape without some faces. + */ + GEOM_Object MakeGlueFacesByList (in GEOM_Object theShape, in double theTolerance, + in ListOfGO theFaces); + /*! * Explode a shape on subshapes of a given type. * \param theShape Shape to be exploded. @@ -1750,6 +1792,20 @@ module GEOM in GEOM_Object thePnt2, in GEOM_Object thePnt3); + /*! + * Create an arc of circle of center C from one point to another + * \param theCenter Center point of the arc. + * \param thePnt1 Start point of the arc. + * \param thePnt2 End point of the arc. + * \param theSense Orientation of the arc + * \return New GEOM_Object, containing the created arc. + */ + GEOM_Object MakeArcCenter (in GEOM_Object theCenter, + in GEOM_Object thePnt1, + in GEOM_Object thePnt2, + in boolean theSense); + + /*! * Create a polyline on the set of points. * \param thePoints Sequence of points for the polyline. @@ -2100,6 +2156,52 @@ module GEOM out string_array thePatterns); }; + /*! + * GEOM_IKindOfShape: namespace for shape_kind enumeration. + */ + interface GEOM_IKindOfShape + { + enum shape_kind { + NO_SHAPE, + // COMPOSITEs + COMPOUND, + COMPSOLID, + SHELL, + WIRE, + // SOLIDs + SPHERE, // full sphere + CYLINDER, // cylinder + BOX, // box with faces, parallel to global coordinate planes + ROTATED_BOX, // other box + TORUS, // full torus + CONE, // cone + POLYHEDRON, // solid, bounded by polygons + SOLID, // other solid + // FACEs + SPHERE2D, // spherical face (closed) + CYLINDER2D, // cylindrical face with defined height + TORUS2D, // toroidal face (closed) + CONE2D, // conical face with defined height + DISK_CIRCLE, // planar, bounded by circle + DISK_ELLIPSE, // planar, bounded by ellipse + POLYGON, // planar, bounded by segments + PLANE, // infinite planar + PLANAR, // other planar + FACE, // other face + // EDGEs + CIRCLE, // full circle + ARC_CIRCLE, // arc of circle + ELLIPSE, // full ellipse + ARC_ELLIPSE, // arc of ellipse + LINE, // infinite segment + SEGMENT, // segment + EDGE, // other edge + // VERTEX + VERTEX + }; + }; + + /*! * GEOM_IMeasureOperations: Interface for measurement (distance, whatis) and * properties calculation (like Centre of Mass, Inertia, etc.). @@ -2107,6 +2209,21 @@ module GEOM */ interface GEOM_IMeasureOperations : GEOM_IOperations { + /*! + * Get kind of theShape. + * \param theShape Shape to get a kind of. + * \param theIntegers Output. Integer and enumerated shape's parameters + * (kind of surface, closed/unclosed, number of edges, etc.) + * \param theDoubles Output. Double shape's parameters (coordinates, dimensions, etc.) + * \note Concrete meaning of each value, returned via \a theIntegers + * or \a theDoubles list depends on the kind of the shape. + * \return Returns a kind of shape in terms of GEOM_IKindOfShape.shape_kind enumeration. + */ + //short KindOfShape (in GEOM_Object theShape, + GEOM_IKindOfShape::shape_kind KindOfShape (in GEOM_Object theShape, + out ListOfLong theIntegers, + out ListOfDouble theDoubles); + /*! * Get position (LCS) of theShape. * \param theShape Shape to calculate position of. diff --git a/idl/GEOM_Superv.idl b/idl/GEOM_Superv.idl index 7c67d2826..92e6fc36d 100644 --- a/idl/GEOM_Superv.idl +++ b/idl/GEOM_Superv.idl @@ -177,6 +177,13 @@ module GEOM in boolean theWithContact , in boolean theWithCorrection ); + GEOM_Object MakePipeWithShellSections (in ListOfGO theSeqBases, + in ListOfGO theSeqSubBases, + in ListOfGO theLocations, + in GEOM_Object thePath, + in boolean theWithContact , + in boolean theWithCorrection ); + //-----------------------------------------------------------// // BooleanOperations // //-----------------------------------------------------------// @@ -305,7 +312,12 @@ module GEOM GEOM_Object MakeSolidShells (in GEOM_List theShells) ; GEOM_Object MakeCompound (in GEOM_List theShapes) ; GEOM_Object MakeGlueFaces (in GEOM_Object theShape, - in double theTolerance) ; + in double theTolerance); + GEOM_List GetGlueFaces (in GEOM_Object theShape, + in double theTolerance); + GEOM_Object MakeGlueFacesByList (in GEOM_Object theShape, + in double theTolerance, + in ListOfGO theFaces); GEOM_List MakeExplode (in GEOM_Object theShape, in long theShapeType, in boolean isSorted) ; @@ -403,6 +415,10 @@ module GEOM GEOM_Object MakeArc (in GEOM_Object thePnt1, in GEOM_Object thePnt2, in GEOM_Object thePnt3) ; + GEOM_Object MakeArcCenter (in GEOM_Object theCenter, + in GEOM_Object thePnt1, + in GEOM_Object thePnt2, + in boolean theSense) ; GEOM_Object MakePolyline (in GEOM_List thePoints) ; GEOM_Object MakeSplineBezier (in GEOM_List thePoints) ; GEOM_Object MakeSplineInterpolation (in GEOM_List thePoints) ; diff --git a/resources/GEOMCatalog.xml.in b/resources/GEOMCatalog.xml.in index 131c35263..4b05e9c22 100644 --- a/resources/GEOMCatalog.xml.in +++ b/resources/GEOMCatalog.xml.in @@ -3857,6 +3857,42 @@ + MakeArcCenter + ngr + 3.2.6 + unknown + 0 + + + theCenter + GEOM_Object + unknown + + + thePnt1 + GEOM_Object + unknown + + + thePnt2 + GEOM_Object + unknown + + + theSense + boolean + unknown + + + + + return + GEOM_Object + unknown + + + + MakePolyline mkr 2.1.0 diff --git a/resources/ImportExport b/resources/ImportExport index c79adbc1a..6f99dfe50 100644 --- a/resources/ImportExport +++ b/resources/ImportExport @@ -1,5 +1,5 @@ -Import: BREP|IGES|STEP -Export: BREP|IGES|IGES_5_3|STEP +Import: BREP|IGES|STEP|ACIS +Export: BREP|IGES|IGES_5_3|STEP|STL_Bin|STL_ASCII|ACIS BREP.Import: libBREPImport BREP.Export: libBREPExport @@ -16,3 +16,13 @@ IGES_5_3.Pattern: IGES 5.3 Files ( *.iges *.igs ) STEP.Import: libSTEPImport STEP.Export: libSTEPExport STEP.Pattern: STEP Files ( *.step *.stp ) + +STL_Bin.Export: libSTLExport.so +STL_Bin.Pattern: STL Binary Files ( *.stl ) + +STL_ASCII.Export: libSTLExport.so +STL_ASCII.Pattern: STL ASCII Files ( *.stl ) + +ACIS.Import: libACISImport.so +ACIS.Export: libACISExport.so +ACIS.Pattern: ACIS Files ( *.sat ) \ No newline at end of file diff --git a/resources/Makefile.am b/resources/Makefile.am index 0c78e8a53..30a1b92ae 100644 --- a/resources/Makefile.am +++ b/resources/Makefile.am @@ -188,6 +188,8 @@ check_blocks_compound.png \ free_faces.png \ propagate.png \ redo.png \ -undo.png +undo.png \ +arccenter.png \ +glue2.png nodist_salomeres_DATA = GEOMCatalog.xml diff --git a/resources/arccenter.png b/resources/arccenter.png new file mode 100644 index 000000000..88ead9a7b Binary files /dev/null and b/resources/arccenter.png differ diff --git a/resources/glue2.png b/resources/glue2.png new file mode 100644 index 000000000..f25141511 Binary files /dev/null and b/resources/glue2.png differ diff --git a/src/BasicGUI/BasicGUI_ArcDlg.cxx b/src/BasicGUI/BasicGUI_ArcDlg.cxx index 15815209d..fec43e01e 100644 --- a/src/BasicGUI/BasicGUI_ArcDlg.cxx +++ b/src/BasicGUI/BasicGUI_ArcDlg.cxx @@ -59,14 +59,15 @@ BasicGUI_ArcDlg::BasicGUI_ArcDlg(GeometryGUI* theGeometryGUI, QWidget* parent, WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_ARC"))); - QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_ARC_CENTER"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_ARC_TITLE")); /***************************************************************/ GroupConstructors->setTitle(tr("GEOM_ARC")); RadioButton1->setPixmap(image0); - RadioButton2->close(TRUE); + RadioButton2->setPixmap(image1); RadioButton3->close(TRUE); Group3Pnts = new DlgRef_3Sel_QTD(this, "Group3Pnts"); @@ -79,11 +80,29 @@ BasicGUI_ArcDlg::BasicGUI_ArcDlg(GeometryGUI* theGeometryGUI, QWidget* parent, Group3Pnts->LineEdit2->setReadOnly( true ); Group3Pnts->LineEdit3->setReadOnly( true ); - Group3Pnts->PushButton1->setPixmap(image1); - Group3Pnts->PushButton2->setPixmap(image1); - Group3Pnts->PushButton3->setPixmap(image1); + Group3Pnts->PushButton1->setPixmap(image2); + Group3Pnts->PushButton2->setPixmap(image2); + Group3Pnts->PushButton3->setPixmap(image2); + + + Group3Pnts2 = new DlgRef_3Sel1Check_QTD(this, "Group3Pnts2"); + Group3Pnts2->GroupBox1->setTitle(tr("GEOM_POINTS")); + Group3Pnts2->TextLabel1->setText(tr("GEOM_CENTER_POINT")); + Group3Pnts2->TextLabel2->setText(tr("GEOM_POINT_I").arg("Start")); + Group3Pnts2->TextLabel3->setText(tr("GEOM_POINT_I").arg("End")); + + Group3Pnts2->LineEdit1->setReadOnly( true ); + Group3Pnts2->LineEdit2->setReadOnly( true ); + Group3Pnts2->LineEdit3->setReadOnly( true ); + + Group3Pnts2->PushButton1->setPixmap(image2); + Group3Pnts2->PushButton2->setPixmap(image2); + Group3Pnts2->PushButton3->setPixmap(image2); + + Group3Pnts2->radioButton4->setText(tr("GEOM_REVERSE")); Layout1->addWidget( Group3Pnts, 2, 0 ); + Layout1->addWidget( Group3Pnts2, 2, 0 ); setHelpFileName("arc.htm"); @@ -109,17 +128,21 @@ void BasicGUI_ArcDlg::Init() /* init variables */ // myGeomGUI->SetState( 0 ); globalSelection( GEOM_POINT ); - + + myConstructorId = -1; myEditCurrentArgument = Group3Pnts->LineEdit1; myEditCurrentArgument->setFocus(); myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil(); + Group3Pnts2->radioButton4->setChecked(FALSE); /* signals and slots connections */ connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); - + + connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); @@ -130,11 +153,24 @@ void BasicGUI_ArcDlg::Init() 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(Group3Pnts2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group3Pnts2->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group3Pnts2->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(Group3Pnts2->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(Group3Pnts2->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(Group3Pnts2->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(Group3Pnts2->radioButton4, SIGNAL(stateChanged(int)), this, SLOT(ReverseSense(int))); connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - initName( tr( "GEOM_ARC" ) ); + initName( tr( "GEOM_ARC" )); + + + ConstructorsClicked( 0 ); } @@ -173,8 +209,13 @@ bool BasicGUI_ArcDlg::ClickOnApply() Group3Pnts->LineEdit1->setText( "" ); Group3Pnts->LineEdit2->setText( "" ); Group3Pnts->LineEdit3->setText( "" ); - myEditCurrentArgument = Group3Pnts->LineEdit1; + Group3Pnts2->LineEdit1->setText( "" ); + Group3Pnts2->LineEdit2->setText( "" ); + Group3Pnts2->LineEdit3->setText( "" ); + if (getConstructorId() == 0) myEditCurrentArgument = Group3Pnts->LineEdit1; + if (getConstructorId() == 1) myEditCurrentArgument = Group3Pnts2->LineEdit1; + ConstructorsClicked( getConstructorId() ); return true; } @@ -185,25 +226,55 @@ bool BasicGUI_ArcDlg::ClickOnApply() //================================================================================= void BasicGUI_ArcDlg::SelectionIntoArgument() { - myEditCurrentArgument->setText(""); - - if ( IObjectCount() != 1 ) - { - 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(); + if ((getConstructorId() != 0) && (getConstructorId() != 1)) return; - } - + + myEditCurrentArgument->setText(""); + if ( IObjectCount() != 1 ){ + switch (getConstructorId()) + { + case 0: + { + 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; + break; + } + case 1: + { + if ( myEditCurrentArgument == Group3Pnts2->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == Group3Pnts2->LineEdit2 ) myPoint2 = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == Group3Pnts2->LineEdit3 ) myPoint3 = GEOM::GEOM_Object::_nil(); + return; + break; + } + } + } // nbSel == 1 Standard_Boolean aRes = Standard_False; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes ); if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { - myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); - if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = aSelectedObject; - else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = aSelectedObject; - else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = aSelectedObject; + switch (getConstructorId()) + { + case 0: + { + myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = aSelectedObject; + else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = aSelectedObject; + else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = aSelectedObject; + break; + } + case 1: + { + myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + if ( myEditCurrentArgument == Group3Pnts2->LineEdit1 ) myPoint1 = aSelectedObject; + else if ( myEditCurrentArgument == Group3Pnts2->LineEdit2 ) myPoint2 = aSelectedObject; + else if ( myEditCurrentArgument == Group3Pnts2->LineEdit3 ) myPoint3 = aSelectedObject; + break; + } + } } displayPreview(); @@ -217,11 +288,23 @@ void BasicGUI_ArcDlg::SelectionIntoArgument() void BasicGUI_ArcDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - - if ( send == Group3Pnts->PushButton1 ) myEditCurrentArgument = Group3Pnts->LineEdit1; - else if ( send == Group3Pnts->PushButton2 ) myEditCurrentArgument = Group3Pnts->LineEdit2; - else if ( send == Group3Pnts->PushButton3 ) myEditCurrentArgument = Group3Pnts->LineEdit3; - + switch (getConstructorId()) + { + case 0: + { + if ( send == Group3Pnts->PushButton1 ) myEditCurrentArgument = Group3Pnts->LineEdit1; + else if ( send == Group3Pnts->PushButton2 ) myEditCurrentArgument = Group3Pnts->LineEdit2; + else if ( send == Group3Pnts->PushButton3 ) myEditCurrentArgument = Group3Pnts->LineEdit3; + break; + } + case 1: + { + if ( send == Group3Pnts2->PushButton1 ) myEditCurrentArgument = Group3Pnts2->LineEdit1; + else if ( send == Group3Pnts2->PushButton2 ) myEditCurrentArgument = Group3Pnts2->LineEdit2; + else if ( send == Group3Pnts2->PushButton3 ) myEditCurrentArgument = Group3Pnts2->LineEdit3; + break; + } + } myEditCurrentArgument->setFocus(); SelectionIntoArgument(); } @@ -234,9 +317,8 @@ void BasicGUI_ArcDlg::SetEditCurrentArgument() void BasicGUI_ArcDlg::LineEditReturnPressed() { QLineEdit* send = (QLineEdit*)sender(); - if ( send == Group3Pnts->LineEdit1 || - send == Group3Pnts->LineEdit2 || - send == Group3Pnts->LineEdit3 ) + if ( send == Group3Pnts->LineEdit1 || send == Group3Pnts->LineEdit2 || send == Group3Pnts->LineEdit3 || + send == Group3Pnts2->LineEdit1 || send == Group3Pnts2->LineEdit2 || send == Group3Pnts2->LineEdit3 ) { myEditCurrentArgument = send; GEOMBase_Skeleton::LineEditReturnPressed(); @@ -264,6 +346,9 @@ void BasicGUI_ArcDlg::ActivateThisDialog() Group3Pnts->LineEdit2->setText( "" ); Group3Pnts->LineEdit3->setText( "" ); myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil(); + + ConstructorsClicked( getConstructorId() ); + } //================================================================================= @@ -320,11 +405,34 @@ bool BasicGUI_ArcDlg::isValid( QString& msg ) //================================================================================= bool BasicGUI_ArcDlg::execute( ObjectList& objects ) { - GEOM::GEOM_Object_var anObj = - GEOM::GEOM_ICurvesOperations::_narrow(getOperation())->MakeArc(myPoint1, myPoint2, myPoint3); - if ( !anObj->_is_nil() ) + bool res = false; + GEOM::GEOM_Object_var anObj; + + switch (getConstructorId()) + { + case 0: + { + if ( !CORBA::is_nil(myPoint1) && !CORBA::is_nil(myPoint2) &&!CORBA::is_nil(myPoint3) ){ + anObj = GEOM::GEOM_ICurvesOperations::_narrow(getOperation())->MakeArc(myPoint1, myPoint2, myPoint3); + res = true; + } + break; + } + case 1: + { + bool Sense; + (Group3Pnts2->radioButton4->isChecked()) ? Sense=true : Sense = false; + if ( !CORBA::is_nil(myPoint1) && !CORBA::is_nil(myPoint2) &&!CORBA::is_nil(myPoint3) ){ + anObj = GEOM::GEOM_ICurvesOperations::_narrow(getOperation())->MakeArcCenter(myPoint1, myPoint2, myPoint3,Sense); + res = true; + } + break; + } + } + if ( !anObj->_is_nil() ){ objects.push_back( anObj._retn() ); - return true; + } + return res; } //================================================================================= @@ -335,3 +443,45 @@ void BasicGUI_ArcDlg::closeEvent( QCloseEvent* e ) { GEOMBase_Skeleton::closeEvent( e ); } + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void BasicGUI_ArcDlg::ConstructorsClicked( int constructorId ) +{ + + disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); + + switch (constructorId) + { + case 0: + { + Group3Pnts->show(); + resize(0, 0); + Group3Pnts2->hide(); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + break; + } + case 1: + { + Group3Pnts->hide(); + resize(0, 0); + Group3Pnts2->show(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + break; + } + } + displayPreview(); +} + +//================================================================================= +// function : ReverseSense() +// purpose : Orientation of the arc +//================================================================================= +void BasicGUI_ArcDlg::ReverseSense(int sense) +{ + displayPreview(); +} diff --git a/src/BasicGUI/BasicGUI_ArcDlg.h b/src/BasicGUI/BasicGUI_ArcDlg.h index 35038d452..6a5e73217 100644 --- a/src/BasicGUI/BasicGUI_ArcDlg.h +++ b/src/BasicGUI/BasicGUI_ArcDlg.h @@ -32,6 +32,7 @@ #include "GEOMBase_Skeleton.h" #include "DlgRef_3Sel_QTD.h" +#include "DlgRef_3Sel1Check_QTD.h" //================================================================================= // class : BasicGUI_ArcDlg @@ -57,10 +58,11 @@ protected: private : void Init(); void enterEvent(QEvent* e); - + int myConstructorId; GEOM::GEOM_Object_var myPoint1, myPoint2, myPoint3; DlgRef_3Sel_QTD* Group3Pnts; + DlgRef_3Sel1Check_QTD* Group3Pnts2; private slots: void ClickOnOk(); @@ -69,11 +71,11 @@ private slots: void ActivateThisDialog(); void DeactivateActiveDialog(); - + void ConstructorsClicked( int ); void LineEditReturnPressed(); void SelectionIntoArgument(); void SetEditCurrentArgument(); - + void ReverseSense(int); }; #endif // DIALOGBOX_ARC_H diff --git a/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx b/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx index 4522f191d..97a7421c2 100644 --- a/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx +++ b/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx @@ -102,6 +102,16 @@ BasicGUI_WorkingPlaneDlg::BasicGUI_WorkingPlaneDlg(GeometryGUI* theGeometryGUI, Layout1->addWidget(Group2, 1, 0); Layout1->addWidget(Group3, 1, 0); /***************************************************************/ + QGroupBox* aReverseGroupBox = new QGroupBox(this, "aReverseGroupBox"); + aReverseGroupBox->setTitle(tr("")); + aReverseGroupBox->setColumnLayout(1, Qt::Horizontal); + aReverseGroupBox->setInsideMargin(10); + + myReverseCB = new QCheckBox(aReverseGroupBox, "myReverseCB"); + myReverseCB->setText(tr("GEOM_REVERSE_PLANE")); + + Layout1->addWidget(aReverseGroupBox, 2, 0); + setHelpFileName("working_plane.htm"); @@ -156,6 +166,8 @@ void BasicGUI_WorkingPlaneDlg::Init() connect(Group3->GroupBox1, SIGNAL(clicked(int)), this, SLOT(GroupClicked(int))); + connect(myReverseCB, SIGNAL(clicked()), this, SLOT(onReverse())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); @@ -225,7 +237,8 @@ void BasicGUI_WorkingPlaneDlg::ConstructorsClicked(int constructorId) break; } } - displayPreview(); + + updateWPlane(); } //================================================================================= @@ -235,6 +248,7 @@ void BasicGUI_WorkingPlaneDlg::ConstructorsClicked(int constructorId) void BasicGUI_WorkingPlaneDlg::GroupClicked(int groupId) { aOriginType = groupId; + updateWPlane(); } //================================================================================= @@ -255,99 +269,12 @@ bool BasicGUI_WorkingPlaneDlg::ClickOnApply() { buttonApply->setFocus(); myGeomGUI->application()->putInfo(tr("")); - const int id = getConstructorId(); - - if (id == 0) { // by planar face selection - if (CORBA::is_nil(myFace)) { - showError( "Face has to be selected" ); - return false; - } - - // PAL12781: set center of WPL to face's center of mass - // like it is done for LCS creation - CORBA::Double Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz; - Ox = Oy = Oz = Zx = Zy = Xy = Xz = 0.; - Zz = Xx = 1.; - - GEOM::GEOM_IMeasureOperations_ptr aMeasureOp = - myGeomGUI->GetGeomGen()->GetIMeasureOperations(getStudyId()); - aMeasureOp->GetPosition(myFace, Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz); - - if (aMeasureOp->IsDone()) { - gp_Pnt aPnt (Ox,Oy,Oz); - gp_Dir aDirN (Zx,Zy,Zz); - gp_Dir aDirX (Xx,Xy,Xz); - myWPlane = gp_Ax3(aPnt, aDirN, aDirX); - } else { - showError( "Wrong shape selected (has to be a planar face)" ); - return false; - } - - } else if (id == 1) { // by two vectors (Ox & Oz) - if ( CORBA::is_nil( myVectX ) || CORBA::is_nil( myVectZ ) ) { - showError( "Two vectors have to be selected" ); - return false; - } - - TopoDS_Edge aVectX, aVectZ; - TopoDS_Vertex VX1, VX2, VZ1, VZ2; - gp_Vec aVX, aVZ; - - if (!GEOMBase::GetShape( myVectX, aVectX, TopAbs_EDGE ) || - !GEOMBase::GetShape( myVectZ, aVectZ, TopAbs_EDGE )) { - showError( "Wrong shape selected (two vectors(edges) have to be selected)" ); - return false; - } - - TopExp::Vertices(aVectX, VX1, VX2, Standard_True); - TopExp::Vertices(aVectZ, VZ1, VZ2, Standard_True); - - if (VX1.IsNull() || VX2.IsNull()) { - showError( "Bad OX vector" ); - return false; - } - if (VZ1.IsNull() || VZ2.IsNull()) { - showError( "Bad OZ vector" ); - return false; - } - - aVX = gp_Vec(BRep_Tool::Pnt(VX1), BRep_Tool::Pnt(VX2)); - aVZ = gp_Vec(BRep_Tool::Pnt(VZ1), BRep_Tool::Pnt(VZ2)); - - if (aVX.Magnitude() < Precision::Confusion()) { - showError( "Bad OX vector" ); - return false; - } - if (aVZ.Magnitude() < Precision::Confusion()) { - showError( "Bad OZ vector" ); - return false; - } - - gp_Dir aDirX = gp_Dir(aVX.X(), aVX.Y(), aVX.Z()); - gp_Dir aDirZ = gp_Dir(aVZ.X(), aVZ.Y(), aVZ.Z()); - - if (aDirX.IsParallel(aDirZ, Precision::Angular())) { - showError( "Parallel vectors selected" ); - return false; - } - - myWPlane = gp_Ax3(BRep_Tool::Pnt(VX1), aDirZ, aDirX); - - } else if (id == 2) { // by selection from standard (OXY or OYZ, or OZX) - gp_Ax2 anAx2; - - if (aOriginType == 1) anAx2 = gp::XOY(); - else if (aOriginType == 2) anAx2 = gp::YOZ(); - else if (aOriginType == 0) anAx2 = gp::ZOX(); - - myWPlane = gp_Ax3(anAx2); - - } else { - return false; + + if (updateWPlane(false)){ + myGeomGUI->SetWorkingPlane(myWPlane); + myGeomGUI->ActiveWorkingPlane(); } - - myGeomGUI->SetWorkingPlane(myWPlane); - myGeomGUI->ActiveWorkingPlane(); + return true; } @@ -387,6 +314,8 @@ void BasicGUI_WorkingPlaneDlg::SelectionIntoArgument() myVectZ = aSelectedObject; myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + + updateWPlane(); } @@ -430,6 +359,16 @@ void BasicGUI_WorkingPlaneDlg::LineEditReturnPressed() } +//================================================================================= +// function : onReverse() +// purpose : +//================================================================================= +void BasicGUI_WorkingPlaneDlg::onReverse() +{ + updateWPlane(); +} + + //================================================================================= // function : ActivateThisDialog() // purpose : @@ -481,3 +420,130 @@ void BasicGUI_WorkingPlaneDlg::closeEvent( QCloseEvent* e ) { GEOMBase_Skeleton::closeEvent( e ); } + + +//================================================================================= +// function : updateWPlane +// purpose : +//================================================================================= +bool BasicGUI_WorkingPlaneDlg::updateWPlane( const bool showPreview ) +{ + erasePreview(); + + const int id = getConstructorId(); + + if (id == 0) { // by planar face selection + if (CORBA::is_nil(myFace)) { + if(!showPreview) + showError( "Face has to be selected" ); + return false; + } + + // PAL12781: set center of WPL to face's center of mass + // like it is done for LCS creation + CORBA::Double Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz; + Ox = Oy = Oz = Zx = Zy = Xy = Xz = 0.; + Zz = Xx = 1.; + + GEOM::GEOM_IMeasureOperations_ptr aMeasureOp = + myGeomGUI->GetGeomGen()->GetIMeasureOperations(getStudyId()); + aMeasureOp->GetPosition(myFace, Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz); + + if (aMeasureOp->IsDone()) { + gp_Pnt aPnt (Ox,Oy,Oz); + gp_Dir aDirN (Zx,Zy,Zz); + gp_Dir aDirX (Xx,Xy,Xz); + myWPlane = gp_Ax3(aPnt, aDirN, aDirX); + } else { + if(!showPreview) + showError( "Wrong shape selected (has to be a planar face)" ); + return false; + } + + } else if (id == 1) { // by two vectors (Ox & Oz) + if ( CORBA::is_nil( myVectX ) || CORBA::is_nil( myVectZ ) ) { + if(!showPreview) + showError( "Two vectors have to be selected" ); + return false; + } + + TopoDS_Edge aVectX, aVectZ; + TopoDS_Vertex VX1, VX2, VZ1, VZ2; + gp_Vec aVX, aVZ; + + if (!GEOMBase::GetShape( myVectX, aVectX, TopAbs_EDGE ) || + !GEOMBase::GetShape( myVectZ, aVectZ, TopAbs_EDGE )) { + if(!showPreview) + showError( "Wrong shape selected (two vectors(edges) have to be selected)" ); + return false; + } + + TopExp::Vertices(aVectX, VX1, VX2, Standard_True); + TopExp::Vertices(aVectZ, VZ1, VZ2, Standard_True); + + if (VX1.IsNull() || VX2.IsNull()) { + if(!showPreview) + showError( "Bad OX vector" ); + return false; + } + if (VZ1.IsNull() || VZ2.IsNull()) { + if(!showPreview) + showError( "Bad OZ vector" ); + return false; + } + + aVX = gp_Vec(BRep_Tool::Pnt(VX1), BRep_Tool::Pnt(VX2)); + aVZ = gp_Vec(BRep_Tool::Pnt(VZ1), BRep_Tool::Pnt(VZ2)); + + if (aVX.Magnitude() < Precision::Confusion()) { + if(!showPreview) + showError( "Bad OX vector" ); + return false; + } + if (aVZ.Magnitude() < Precision::Confusion()) { + if(!showPreview) + showError( "Bad OZ vector" ); + return false; + } + + gp_Dir aDirX = gp_Dir(aVX.X(), aVX.Y(), aVX.Z()); + gp_Dir aDirZ = gp_Dir(aVZ.X(), aVZ.Y(), aVZ.Z()); + + if (aDirX.IsParallel(aDirZ, Precision::Angular())) { + if(!showPreview) + showError( "Parallel vectors selected" ); + return false; + } + + myWPlane = gp_Ax3(BRep_Tool::Pnt(VX1), aDirZ, aDirX); + + } else if (id == 2) { // by selection from standard (OXY or OYZ, or OZX) + gp_Ax2 anAx2; + + if (aOriginType == 1) anAx2 = gp::XOY(); + else if (aOriginType == 2) anAx2 = gp::YOZ(); + else if (aOriginType == 0) anAx2 = gp::ZOX(); + + myWPlane = gp_Ax3(anAx2); + + } else { + return false; + } + + if (myReverseCB->isChecked()) + { + myWPlane.YReverse(); + myWPlane.ZReverse(); + } + + if (showPreview) + { + GEOM::GEOM_IBasicOperations_var aBasicOp = getGeomEngine()->GetIBasicOperations( getStudyId() ); + GEOM::GEOM_Object_var anObj = aBasicOp->MakeMarker( myWPlane.Location().X(), myWPlane.Location().Y(), myWPlane.Location().Z(), + myWPlane.XDirection().X(), myWPlane.XDirection().Y(), myWPlane.XDirection().Z(), + myWPlane.YDirection().X(), myWPlane.YDirection().Y(), myWPlane.YDirection().Z() ); + displayPreview(anObj); + } + + return true; +} diff --git a/src/BasicGUI/BasicGUI_WorkingPlaneDlg.h b/src/BasicGUI/BasicGUI_WorkingPlaneDlg.h index 35561c741..40cddf743 100644 --- a/src/BasicGUI/BasicGUI_WorkingPlaneDlg.h +++ b/src/BasicGUI/BasicGUI_WorkingPlaneDlg.h @@ -35,6 +35,8 @@ #include "DlgRef_2Sel_QTD.h" #include "DlgRef_3Check_QTD.h" +class QCheckBox; + //================================================================================= // class : BasicGUI_WorkingPlaneDlg // purpose : @@ -53,6 +55,8 @@ private: void Init(); void enterEvent(QEvent* e); + bool updateWPlane(const bool showPreview = true); + GEOM::GEOM_Object_var myFace; GEOM::GEOM_Object_var myVectX; GEOM::GEOM_Object_var myVectZ; @@ -63,6 +67,8 @@ private: DlgRef_2Sel_QTD* Group2; DlgRef_3Check_QTD* Group3; + QCheckBox* myReverseCB; + gp_Ax3 myWPlane; private slots: @@ -75,6 +81,7 @@ private slots: void SetEditCurrentArgument(); void SelectionIntoArgument(); void LineEditReturnPressed(); + void onReverse(); void ActivateThisDialog(); void DeactivateActiveDialog(); diff --git a/src/DlgRef/DlgRef_3Sel1Check_QTD.cxx b/src/DlgRef/DlgRef_3Sel1Check_QTD.cxx new file mode 100644 index 000000000..a1442eab4 --- /dev/null +++ b/src/DlgRef/DlgRef_3Sel1Check_QTD.cxx @@ -0,0 +1,127 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'UIFiles/DlgRef_3Sel1Check_QTD.ui' +** +** Created: Wed Feb 21 10:49:18 2007 +** by: The User Interface Compiler ($Id$) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ + +#include "DlgRef_3Sel1Check_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_3Sel1Check_QTD as a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_3Sel1Check_QTD::DlgRef_3Sel1Check_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_3Sel1Check_QTD" ); + setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, sizePolicy().hasHeightForWidth() ) ); + DlgRef_3Sel1Check_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_3Sel1Check_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, GroupBox1->sizePolicy().hasHeightForWidth() ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + + GroupBox1Layout->addWidget( PushButton1, 0, 1 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + GroupBox1Layout->addWidget( LineEdit1, 0, 2 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + + GroupBox1Layout->addWidget( TextLabel1, 0, 0 ); + + PushButton2 = new QPushButton( GroupBox1, "PushButton2" ); + PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) ); + + GroupBox1Layout->addWidget( PushButton2, 1, 1 ); + + LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" ); + + GroupBox1Layout->addWidget( LineEdit2, 1, 2 ); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + + GroupBox1Layout->addWidget( TextLabel2, 1, 0 ); + + PushButton3 = new QPushButton( GroupBox1, "PushButton3" ); + PushButton3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton3->sizePolicy().hasHeightForWidth() ) ); + + GroupBox1Layout->addWidget( PushButton3, 2, 1 ); + + LineEdit3 = new QLineEdit( GroupBox1, "LineEdit3" ); + + GroupBox1Layout->addWidget( LineEdit3, 2, 2 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + + GroupBox1Layout->addWidget( TextLabel3, 2, 0 ); + + radioButton4 = new QRadioButton( GroupBox1, "radioButton4" ); + + GroupBox1Layout->addMultiCellWidget( radioButton4, 3, 3, 0, 1 ); + Spacer3 = new QSpacerItem( 16, 721, QSizePolicy::Minimum, QSizePolicy::Expanding ); + GroupBox1Layout->addItem( Spacer3, 4, 2 ); + + DlgRef_3Sel1Check_QTDLayout->addWidget( GroupBox1, 0, 0 ); + languageChange(); + resize( QSize(490, 878).expandedTo(minimumSizeHint()) ); + clearWState( WState_Polished ); + + // tab order + setTabOrder( PushButton1, LineEdit1 ); + setTabOrder( LineEdit1, PushButton2 ); + setTabOrder( PushButton2, LineEdit2 ); + setTabOrder( LineEdit2, PushButton3 ); + setTabOrder( PushButton3, LineEdit3 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_3Sel1Check_QTD::~DlgRef_3Sel1Check_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + +/* + * Sets the strings of the subwidgets using the current + * language. + */ +void DlgRef_3Sel1Check_QTD::languageChange() +{ + setCaption( tr( "DlgRef_3Sel3Spin1Check_QTD" ) ); + GroupBox1->setTitle( QString::null ); + PushButton1->setText( QString::null ); + TextLabel1->setText( tr( "TL1" ) ); + PushButton2->setText( QString::null ); + TextLabel2->setText( tr( "TL2" ) ); + PushButton3->setText( QString::null ); + TextLabel3->setText( tr( "TL3" ) ); + radioButton4->setText( tr( "radioButton4" ) ); +} + diff --git a/src/DlgRef/DlgRef_3Sel1Check_QTD.h b/src/DlgRef/DlgRef_3Sel1Check_QTD.h new file mode 100644 index 000000000..0498e7b29 --- /dev/null +++ b/src/DlgRef/DlgRef_3Sel1Check_QTD.h @@ -0,0 +1,56 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'UIFiles/DlgRef_3Sel1Check_QTD.ui' +** +** Created: Wed Feb 21 10:48:39 2007 +** by: The User Interface Compiler ($Id$) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ + +#ifndef DLGREF_3SEL1CHECK_QTD_H +#define DLGREF_3SEL1CHECK_QTD_H + +#include +#include + +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QSpacerItem; +class QGroupBox; +class QPushButton; +class QLineEdit; +class QLabel; +class QRadioButton; + +class DlgRef_3Sel1Check_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_3Sel1Check_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_3Sel1Check_QTD(); + + QGroupBox* GroupBox1; + QPushButton* PushButton1; + QLineEdit* LineEdit1; + QLabel* TextLabel1; + QPushButton* PushButton2; + QLineEdit* LineEdit2; + QLabel* TextLabel2; + QPushButton* PushButton3; + QLineEdit* LineEdit3; + QLabel* TextLabel3; + QRadioButton* radioButton4; + +protected: + QGridLayout* DlgRef_3Sel1Check_QTDLayout; + QGridLayout* GroupBox1Layout; + QSpacerItem* Spacer3; + +protected slots: + virtual void languageChange(); + +}; + +#endif // DLGREF_3SEL1CHECK_QTD_H diff --git a/src/DlgRef/Makefile.am b/src/DlgRef/Makefile.am index 2d893f870..efc180f90 100644 --- a/src/DlgRef/Makefile.am +++ b/src/DlgRef/Makefile.am @@ -86,7 +86,8 @@ dist_libDlgRef_la_SOURCES = \ DlgRef_3Sel1Spin.cxx \ DlgRef_3Check_QTD.cxx \ DlgRef_6Sel_QTD.cxx \ - DlgRef_4Sel1Spin2Check.cxx + DlgRef_4Sel1Spin2Check.cxx \ + DlgRef_3Sel1Check_QTD.cxx MOC_FILES = \ DlgRef_Skeleton_QTD_moc.cxx \ @@ -142,7 +143,8 @@ MOC_FILES = \ DlgRef_1Sel_Ext_moc.cxx \ DlgRef_3Check_QTD_moc.cxx \ DlgRef_6Sel_QTD_moc.cxx \ - DlgRef_4Sel1Spin2Check_moc.cxx + DlgRef_4Sel1Spin2Check_moc.cxx \ + DlgRef_3Sel1Check_QTD_moc.cxx # header files salomeinclude_HEADERS = \ @@ -200,6 +202,7 @@ salomeinclude_HEADERS = \ DlgRef_3Check_QTD.h \ DlgRef_6Sel_QTD.h \ DlgRef_4Sel1Spin2Check.h \ + DlgRef_3Sel1Check_QTD.h \ GEOM_DlgRef.hxx nodist_libDlgRef_la_SOURCES= \ diff --git a/src/DlgRef/UIFiles/DlgRef_3Sel1Check_QTD.ui b/src/DlgRef/UIFiles/DlgRef_3Sel1Check_QTD.ui new file mode 100644 index 000000000..6f9ef127c --- /dev/null +++ b/src/DlgRef/UIFiles/DlgRef_3Sel1Check_QTD.ui @@ -0,0 +1,210 @@ + +DlgRef_3Sel1Check_QTD + + + DlgRef_3Sel1Check_QTD + + + + 0 + 0 + 490 + 878 + + + + + 5 + 5 + 0 + 0 + + + + DlgRef_3Sel3Spin1Check_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + + 5 + 5 + 0 + 0 + + + + + + + + unnamed + + + 11 + + + 6 + + + + PushButton1 + + + + 0 + 0 + 0 + 0 + + + + + + + + + LineEdit1 + + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + PushButton2 + + + + 0 + 0 + 0 + 0 + + + + + + + + + LineEdit2 + + + + + TextLabel2 + + + + 0 + 0 + 0 + 0 + + + + TL2 + + + + + PushButton3 + + + + 0 + 0 + 0 + 0 + + + + + + + + + LineEdit3 + + + + + TextLabel3 + + + + 0 + 0 + 0 + 0 + + + + TL3 + + + + + radioButton4 + + + radioButton4 + + + + + Spacer3 + + + Vertical + + + Expanding + + + + 16 + 721 + + + + + + + + + PushButton1 + LineEdit1 + PushButton2 + LineEdit2 + PushButton3 + LineEdit3 + + + diff --git a/src/EntityGUI/EntityGUI_SketcherDlg.cxx b/src/EntityGUI/EntityGUI_SketcherDlg.cxx index dac57b966..5a3baf23f 100644 --- a/src/EntityGUI/EntityGUI_SketcherDlg.cxx +++ b/src/EntityGUI/EntityGUI_SketcherDlg.cxx @@ -64,12 +64,14 @@ using namespace std; // TRUE to construct a modal dialog. //================================================================================= EntityGUI_SketcherDlg::EntityGUI_SketcherDlg(GeometryGUI* GUI, QWidget* parent, - const char* name, bool modal, WFlags fl) + const char* name, bool modal, WFlags fl, + const double lineWidth) :EntityGUI_Skeleton_QTD(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose), myIsAllAdded( false ), GEOMBase_Helper( dynamic_cast( parent ) ), - myGeometryGUI( GUI ) + myGeometryGUI( GUI ), + myLineWidth( lineWidth ) { myGeometryGUI->SetActiveDialogBox(this); @@ -344,7 +346,7 @@ void EntityGUI_SketcherDlg::Init() resize( 0, 0 ); TypeClicked(0); - GEOMBase_Helper::displayPreview(); + GEOMBase_Helper::displayPreview(false, true, true, myLineWidth); } @@ -443,7 +445,7 @@ void EntityGUI_SketcherDlg::PointClicked(int constructorId) Group2Spin->show(); Group2Spin->buttonApply->setFocus(); - GEOMBase_Helper::displayPreview(); + GEOMBase_Helper::displayPreview(false, true, true, myLineWidth); } else if ( constructorId == 0 ) { // DXDY @@ -459,7 +461,7 @@ void EntityGUI_SketcherDlg::PointClicked(int constructorId) Group2Spin->show(); Group2Spin->buttonApply->setFocus(); - GEOMBase_Helper::displayPreview(); + GEOMBase_Helper::displayPreview(false, true, true, myLineWidth); } else if ( constructorId == 2 ) { // Selection @@ -693,7 +695,7 @@ void EntityGUI_SketcherDlg::Dir2Clicked(int constructorId) } } - GEOMBase_Helper::displayPreview(); + GEOMBase_Helper::displayPreview(false, true, true, myLineWidth); } @@ -764,7 +766,7 @@ bool EntityGUI_SketcherDlg::ClickOnApply() setEnabledUndo(true); setEnabledRedo(false); - GEOMBase_Helper::displayPreview(); + GEOMBase_Helper::displayPreview(false, true, true, myLineWidth); // Set focus to SpinBox_DX if (sender() == Group1Spin->buttonApply) { @@ -833,7 +835,7 @@ void EntityGUI_SketcherDlg::ClickOnUndo() setEnabledRedo(true); - GEOMBase_Helper::displayPreview(); + GEOMBase_Helper::displayPreview(false, true, true, myLineWidth); } //================================================================================= @@ -854,7 +856,7 @@ void EntityGUI_SketcherDlg::ClickOnRedo() if(myUndoCommand.count() == 1) setEnabledRedo(false); - GEOMBase_Helper::displayPreview(); + GEOMBase_Helper::displayPreview(false, true, true, myLineWidth); } //================================================================================= @@ -918,7 +920,7 @@ void EntityGUI_SketcherDlg::SelectionIntoArgument() } } - GEOMBase_Helper::displayPreview(); + GEOMBase_Helper::displayPreview(false, true, true, myLineWidth); } @@ -992,7 +994,7 @@ void EntityGUI_SketcherDlg::ActivateThisDialog() myEditCurrentArgument = Group1Sel->LineEdit1; myEditCurrentArgument->setFocus(); - GEOMBase_Helper::displayPreview(); + GEOMBase_Helper::displayPreview(false, true, true, myLineWidth); } @@ -1187,7 +1189,7 @@ void EntityGUI_SketcherDlg::ValueChangedInSpinBox(double newValue) } } - GEOMBase_Helper::displayPreview(); + GEOMBase_Helper::displayPreview(false, true, true, myLineWidth); } @@ -1450,7 +1452,7 @@ void EntityGUI_SketcherDlg::displayPreview( GEOM::GEOM_Object_ptr object, getDisplayer()->SetColor( Quantity_NOC_RED ); // set width of displayed shape - getDisplayer()->SetWidth( lineWidth ); + getDisplayer()->SetWidth( (lineWidth == -1)?myLineWidth:lineWidth ); // Disable activation of selection getDisplayer()->SetToActivate( activate ); diff --git a/src/EntityGUI/EntityGUI_SketcherDlg.h b/src/EntityGUI/EntityGUI_SketcherDlg.h index 4f930f9bc..64260b2ae 100644 --- a/src/EntityGUI/EntityGUI_SketcherDlg.h +++ b/src/EntityGUI/EntityGUI_SketcherDlg.h @@ -65,7 +65,8 @@ class GEOM_ENTITYGUI_EXPORT EntityGUI_SketcherDlg : public EntityGUI_Skeleton_QT public: EntityGUI_SketcherDlg(GeometryGUI* GUI, QWidget* parent = 0, - const char* name = 0, bool modal = FALSE, WFlags fl = 0); + const char* name = 0, bool modal = FALSE, WFlags fl = 0, + const double lineWidth = 2.); ~EntityGUI_SketcherDlg(); bool eventFilter (QObject* object, QEvent* event); @@ -127,6 +128,7 @@ private : DIR_TAN_LENGTH, DIR_TAN_X, DIR_TAN_Y, DIR_DXDY_LENGTH, DIR_DXDY_X, DIR_DXDY_Y}; + double myLineWidth; virtual void displayPreview ( GEOM::GEOM_Object_ptr obj, const bool append = false, const bool activate = false, diff --git a/src/EntityGUI/EntityGUI_SubShapeDlg.cxx b/src/EntityGUI/EntityGUI_SubShapeDlg.cxx index 6a3685b66..cb6483921 100644 --- a/src/EntityGUI/EntityGUI_SubShapeDlg.cxx +++ b/src/EntityGUI/EntityGUI_SubShapeDlg.cxx @@ -546,7 +546,7 @@ bool EntityGUI_SubShapeDlg::isValid( QString& msg ) bool EntityGUI_SubShapeDlg::execute( ObjectList& objects ) { GEOM::ListOfGO_var aList = GEOM::GEOM_IShapesOperations::_narrow( - getOperation() )->MakeExplode( myObject, shapeType(), false ); + getOperation() )->MakeExplode( myObject, shapeType(), true ); if ( !aList->length() ) return false; diff --git a/src/GEOMAlgo/GEOMAlgo.cdl b/src/GEOMAlgo/GEOMAlgo.cdl index f290d14d0..1e1e88f79 100755 --- a/src/GEOMAlgo/GEOMAlgo.cdl +++ b/src/GEOMAlgo/GEOMAlgo.cdl @@ -61,6 +61,55 @@ is ST_INOUT end State; -- + enumeration KindOfShape is + KS_UNKNOWN, + KS_SPHERE, + KS_CYLINDER, + KS_BOX, + KS_TORUS, + KS_CONE, + KS_ELLIPSE, + KS_PLANE, + KS_CIRCLE, + KS_LINE, + KS_DEGENERATED + end KindOfShape; + -- + enumeration KindOfName is + KN_UNKNOWN, + KN_SPHERE, + KN_CYLINDER, + KN_TORUS, + KN_CONE, + KN_ELLIPSE, + KN_CIRCLE, + KN_PLANE, + KN_LINE, + KN_BOX, + KN_SEGMENT, + KN_ARCCIRCLE, + KN_POLYGON, + KN_POLYHEDRON, + KN_DISKCIRCLE, + KN_DISKELLIPSE, + KN_RECTANGLE, + KN_TRIANGLE, + KN_QUADRANGLE, + KN_ARCELLIPSE + end KindOfName; + -- + enumeration KindOfBounds is + KB_UNKNOWN, + KB_TRIMMED, + KB_INFINITE + end KindOfBounds; + -- + enumeration KindOfClosed is + KC_UNKNOWN, + KC_CLOSED, + KC_NOTCLOSED + end KindOfClosed; + -- deferred class HAlgo; deferred class Clsf; class ClsfSurf; @@ -73,8 +122,12 @@ is deferred class Algo; deferred class ShapeAlgo; -- + class ShapeInfo; + class ShapeInfoFiller; + -- -- gluer class Gluer; + class Gluer1; class GlueAnalyser; class CoupleOfShapes; class PassKey; @@ -94,7 +147,16 @@ is -- class FinderShapeOn1; class StateCollector; - + -- adds + deferred class HAlgo; + deferred class Clsf; + class ClsfSurf; + class ClsfBox; + --modified by NIZNHY-PKV Mon Jan 29 10:27:44 2007f + class ClsfSolid; + --modified by NIZNHY-PKV Mon Jan 29 10:27:46 2007t + class FinderShapeOn2; + class PassKeyShapeMapHasher; -- -- Builder/Splitter deferred class BuilderShape; @@ -151,21 +213,47 @@ is instantiates List from TCollection (CoupleOfShapes from GEOMAlgo); - class IndexedDataMapOfShapeState + class IndexedDataMapOfShapeState instantiates IndexedDataMap from TCollection (Shape from TopoDS, State from TopAbs, ShapeMapHasher from TopTools); - class ListOfPnt + class ListOfPnt instantiates List from TCollection (Pnt from gp); - class DataMapOfPassKeyInteger + class DataMapOfPassKeyInteger instantiates DataMap from TCollection (PassKey from GEOMAlgo, Integer from Standard, PassKeyMapHasher from GEOMAlgo); - class IndexedDataMapOfPassKeyShapeListOfShape + class IndexedDataMapOfPassKeyShapeListOfShape instantiates IndexedDataMap from TCollection (PassKeyShape from GEOMAlgo, ListOfShape from TopTools, PassKeyShapeMapHasher from GEOMAlgo); + class IndexedDataMapOfShapeShapeInfo + instantiates IndexedDataMap from TCollection (Shape from TopoDS, + ShapeInfo from GEOMAlgo, + ShapeMapHasher from TopTools); + + class DataMapOfPassKeyShapeShape + instantiates DataMap from TCollection (PassKeyShape from GEOMAlgo, + Shape from TopoDS, + PassKeyShapeMapHasher from GEOMAlgo); + + class DataMapOfShapeShapeSet instantiates + DataMap from TCollection(Shape from TopoDS, + ShapeSet from GEOMAlgo, + ShapeMapHasher from TopTools); + + class DataMapOfShapeReal instantiates + DataMap from TCollection(Shape from TopoDS, + Real from Standard, + ShapeMapHasher from TopTools); + + + class DataMapOfRealListOfShape instantiates + DataMap from TCollection(Real from Standard, + ListOfShape from TopTools, + MapRealHasher from TColStd); + end GEOMAlgo; diff --git a/src/GEOMAlgo/GEOMAlgo_Builder.cdl b/src/GEOMAlgo/GEOMAlgo_Builder.cdl index 42eb89e86..967bc05f9 100755 --- a/src/GEOMAlgo/GEOMAlgo_Builder.cdl +++ b/src/GEOMAlgo/GEOMAlgo_Builder.cdl @@ -99,6 +99,13 @@ is -- -- protected methods -- + -- + PerformInternal(me:out; + theDSF: DSFiller from NMTTools) + ---Purpose: Performs calculations using prepared DSFiller + -- object theDSF + is protected; + -- PrepareHistory (me:out) ---Purpose: Prepare information for history support is redefined protected; @@ -241,7 +248,7 @@ fields mySameDomainShapes: IndexedDataMapOfShapeShape from TopTools is protected; -- solids myDraftSolids : IndexedDataMapOfShapeShape from TopTools is protected; - + myEntryPoint : Integer from Standard is protected; -- end Builder; diff --git a/src/GEOMAlgo/GEOMAlgo_Builder.cxx b/src/GEOMAlgo/GEOMAlgo_Builder.cxx index 0ab651cde..284cd7b10 100755 --- a/src/GEOMAlgo/GEOMAlgo_Builder.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Builder.cxx @@ -52,6 +52,7 @@ { myNbTypes=9; myDSFiller=NULL; + myEntryPoint=0; // Entry point through PerformWithFiller () } //======================================================================= //function : ~ @@ -59,6 +60,12 @@ //======================================================================= GEOMAlgo_Builder::~GEOMAlgo_Builder() { + if (myEntryPoint==1) { + if (myDSFiller) { + delete myDSFiller; + myDSFiller=NULL; + } + } } //======================================================================= //function : AddCompound @@ -253,18 +260,33 @@ aBB.Add(aCS, aS); } // + if (myDSFiller) { + delete myDSFiller; + myDSFiller=NULL; + } NMTTools_DSFiller* pDSF=new NMTTools_DSFiller; // pDSF->SetCompositeShape(aCS); pDSF->Perform(); // - PerformWithFiller(*pDSF); + myEntryPoint=1; + PerformInternal(*pDSF); } //======================================================================= //function : PerformWithFiller //purpose : //======================================================================= void GEOMAlgo_Builder::PerformWithFiller(const NMTTools_DSFiller& theDSF) +{ + myEntryPoint=0; + // + PerformInternal(theDSF); +} +//======================================================================= +//function : PerformInternal +//purpose : +//======================================================================= + void GEOMAlgo_Builder::PerformInternal(const NMTTools_DSFiller& theDSF) { myErrorStatus=0; // diff --git a/src/GEOMAlgo/GEOMAlgo_Builder.hxx b/src/GEOMAlgo/GEOMAlgo_Builder.hxx index b6bc2e9e1..2f38d77fb 100644 --- a/src/GEOMAlgo/GEOMAlgo_Builder.hxx +++ b/src/GEOMAlgo/GEOMAlgo_Builder.hxx @@ -137,6 +137,10 @@ protected: // Methods PROTECTED // +//! Performs calculations using prepared DSFiller
+//! object theDSF
+Standard_EXPORT void PerformInternal(const NMTTools_DSFiller& theDSF) ; + //! Prepare information for history support
Standard_EXPORT virtual void PrepareHistory() ; @@ -220,6 +224,7 @@ TopTools_IndexedDataMapOfShapeListOfShape myInParts; BRepAlgo_Image mySplitFaces; TopTools_IndexedDataMapOfShapeShape mySameDomainShapes; TopTools_IndexedDataMapOfShapeShape myDraftSolids; +Standard_Integer myEntryPoint; private: diff --git a/src/GEOMAlgo/GEOMAlgo_BuilderFace.cxx b/src/GEOMAlgo/GEOMAlgo_BuilderFace.cxx index a6661075f..724e9c77f 100755 --- a/src/GEOMAlgo/GEOMAlgo_BuilderFace.cxx +++ b/src/GEOMAlgo/GEOMAlgo_BuilderFace.cxx @@ -578,7 +578,6 @@ void MakeInternalWires(const TopTools_MapOfShape& theME, theWires.Append(aW); } } - //======================================================================= //function : IsInside //purpose : @@ -587,25 +586,39 @@ Standard_Boolean IsInside(const TopoDS_Shape& theHole, const TopoDS_Shape& theF2, IntTools_PContext& theContext) { + Standard_Boolean bRet; Standard_Real aT, aU, aV; + + TopAbs_State aState; TopExp_Explorer aExp; - TopAbs_State aState=TopAbs_UNKNOWN; + TopTools_IndexedMapOfShape aME2; gp_Pnt2d aP2D; // + bRet=Standard_False; + aState=TopAbs_UNKNOWN; const TopoDS_Face& aF2=TopoDS::Face(theF2); // + TopExp::MapShapes(aF2, TopAbs_EDGE, aME2); + // aExp.Init(theHole, TopAbs_EDGE); - if (aExp.More()){ + if (aExp.More()) { const TopoDS_Edge& aE = TopoDS::Edge(aExp.Current()); + if (aME2.Contains(aE)) { + return bRet; + } + // aT=BOPTools_Tools2D::IntermediatePoint(aE); BOPTools_Tools2D::PointOnSurface(aE, aF2, aT, aU, aV); aP2D.SetCoord(aU, aV); // IntTools_FClass2d& aClsf=theContext->FClass2d(aF2); aState=aClsf.Perform(aP2D); + bRet=(aState==TopAbs_IN); } - return (aState==TopAbs_IN); + // + return bRet; } + //======================================================================= //function : IsGrowthWire //purpose : @@ -628,49 +641,39 @@ Standard_Boolean IsGrowthWire(const TopoDS_Shape& theWire, } return bRet; } -//modified by NIZNHY-PKV Mon Sep 18 13:18:27 2006f -/* -static - Standard_Boolean IsHole(const TopoDS_Shape& , - const TopoDS_Face& , - IntTools_PContext& ); -*/ -//modified by NIZNHY-PKV Mon Sep 18 13:18:34 2006t -//modified by NIZNHY-PKV Mon Sep 18 13:18:13 2006f + +//BRepTools::Write(aFF, "ff"); +// +// ErrorStatus : +// 11 - Null Context +// 12 - Null face generix + /* //======================================================================= -//function : IsHole +//function : IsInside //purpose : //======================================================================= -Standard_Boolean IsHole(const TopoDS_Shape& theS2, - const TopoDS_Face& theFace, - IntTools_PContext& theContext) +Standard_Boolean IsInside(const TopoDS_Shape& theHole, + const TopoDS_Shape& theF2, + IntTools_PContext& theContext) { - Standard_Boolean bIsHole; - Standard_Real aTol; - Handle(Geom_Surface) aS; - TopLoc_Location aLoc; - TopoDS_Face aF; - BRep_Builder aBB; - // - aTol=BRep_Tool::Tolerance(theFace); - aS=BRep_Tool::Surface(theFace, aLoc); - aBB.MakeFace(aF, aS, aLoc, aTol); - aBB.Add (aF, theS2); - // - IntTools_FClass2d& aClsf=theContext->FClass2d(aF); - // - bIsHole=aClsf.IsHole(); + Standard_Real aT, aU, aV; + TopExp_Explorer aExp; + TopAbs_State aState=TopAbs_UNKNOWN; + gp_Pnt2d aP2D; // - return bIsHole; + const TopoDS_Face& aF2=TopoDS::Face(theF2); // + aExp.Init(theHole, TopAbs_EDGE); + if (aExp.More()){ + const TopoDS_Edge& aE = TopoDS::Edge(aExp.Current()); + aT=BOPTools_Tools2D::IntermediatePoint(aE); + BOPTools_Tools2D::PointOnSurface(aE, aF2, aT, aU, aV); + aP2D.SetCoord(aU, aV); + // + IntTools_FClass2d& aClsf=theContext->FClass2d(aF2); + aState=aClsf.Perform(aP2D); + } + return (aState==TopAbs_IN); } */ -//modified by NIZNHY-PKV Mon Sep 18 13:18:06 2006t - -//BRepTools::Write(aFF, "ff"); -// -// ErrorStatus : -// 11 - Null Context -// 12 - Null face generix - diff --git a/src/GEOMAlgo/GEOMAlgo_ClsfSolid.cdl b/src/GEOMAlgo/GEOMAlgo_ClsfSolid.cdl new file mode 100755 index 000000000..ed6093c58 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ClsfSolid.cdl @@ -0,0 +1,59 @@ +-- 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: GEOMAlgo_ClsfSolid.cdl +-- Created: Mon Jan 29 10:28:07 2007 +-- Author: Peter KURNEV +-- + + +class ClsfSolid from GEOMAlgo + inherits Clsf from GEOMAlgo + + ---Purpose: + +uses + Shape from TopoDS + +--raises + +is + Create + returns mutable ClsfSolid from GEOMAlgo; + ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_ClsfSolid();" + + SetShape(me:mutable; + aS:Shape from TopoDS); + + Shape(me) + returns Shape from TopoDS; + ---C++: return const & + + Perform(me:mutable) + is redefined; + + CheckData(me:mutable) + is redefined; + + +fields + myShape: Shape from TopoDS is protected; + myPClsf: Address from Standard is protected; + +end ClsfSolid; diff --git a/src/GEOMAlgo/GEOMAlgo_ClsfSolid.cxx b/src/GEOMAlgo/GEOMAlgo_ClsfSolid.cxx new file mode 100755 index 000000000..0e779c996 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ClsfSolid.cxx @@ -0,0 +1,139 @@ +// 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: GEOMAlgo_ClsfSolid.cxx +// Created: Mon Jan 29 10:35:46 2007 +// Author: Peter KURNEV +// + + +#include + +#include +#include +#include +#include +#include + +//======================================================================= +//function : +//purpose : +//======================================================================= + GEOMAlgo_ClsfSolid::GEOMAlgo_ClsfSolid() +: + GEOMAlgo_Clsf() +{ + myPClsf=NULL; +} +//======================================================================= +//function : ~ +//purpose : +//======================================================================= + GEOMAlgo_ClsfSolid::~GEOMAlgo_ClsfSolid() +{ + if (myPClsf) { + BRepClass3d_SolidClassifier* pSC; + // + pSC=(BRepClass3d_SolidClassifier*)myPClsf; + delete pSC; + } +} +//======================================================================= +//function : SetShape +//purpose : +//======================================================================= + void GEOMAlgo_ClsfSolid::SetShape(const TopoDS_Shape& aS) +{ + myShape=aS; +} +//======================================================================= +//function : Shape +//purpose : +//======================================================================= + const TopoDS_Shape& GEOMAlgo_ClsfSolid::Shape()const +{ + return myShape; +} +//======================================================================= +//function : CheckData +//purpose : +//======================================================================= + void GEOMAlgo_ClsfSolid::CheckData() +{ + myErrorStatus=0; + // + BRepClass3d_SolidClassifier* pSC; + TopAbs_ShapeEnum aType; + BRep_Builder aBB; + TopoDS_Solid aS; + // + if (myShape.IsNull()) { + myErrorStatus=10; // mySolid=NULL + return; + } + // + aType=myShape.ShapeType(); + if (!(aType==TopAbs_SOLID || aType==TopAbs_SHELL)) { + myErrorStatus=12; + return; + } + // + //=== + if (aType==TopAbs_SOLID) { + aS=TopoDS::Solid(myShape); + } + else { + aBB.MakeSolid(aS); + aBB.Add(aS, myShape); + } + // + if (myPClsf) { + pSC=(BRepClass3d_SolidClassifier*)myPClsf; + delete pSC; + } + // + pSC=new BRepClass3d_SolidClassifier(aS); + myPClsf=pSC; +} +//======================================================================= +//function : Perform +//purpose : +//======================================================================= + void GEOMAlgo_ClsfSolid::Perform() +{ + myErrorStatus=0; + // + if (!myPClsf) { + myErrorStatus=11; + return; + } + // + BRepClass3d_SolidClassifier* pSC; + // + pSC=(BRepClass3d_SolidClassifier*)myPClsf; + pSC->Perform(myPnt, myTolerance); + myState=pSC->State(); +} +// +// myErrorStatus : +// +// 10 - mySolid=NULL +// 11 - myPClsf=NULL +// 12 - unallowed type of myShape + diff --git a/src/GEOMAlgo/GEOMAlgo_ClsfSolid.hxx b/src/GEOMAlgo/GEOMAlgo_ClsfSolid.hxx new file mode 100644 index 000000000..8feb5337e --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ClsfSolid.hxx @@ -0,0 +1,106 @@ +// 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 + +#ifndef _GEOMAlgo_ClsfSolid_HeaderFile +#define _GEOMAlgo_ClsfSolid_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_GEOMAlgo_ClsfSolid_HeaderFile +#include +#endif + +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _Standard_Address_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_Clsf_HeaderFile +#include +#endif +class TopoDS_Shape; + + + +class GEOMAlgo_ClsfSolid : public GEOMAlgo_Clsf { + +public: + // Methods PUBLIC + // + + +Standard_EXPORT GEOMAlgo_ClsfSolid(); +Standard_EXPORT virtual ~GEOMAlgo_ClsfSolid(); + + +Standard_EXPORT void SetShape(const TopoDS_Shape& aS) ; + + +Standard_EXPORT const TopoDS_Shape& Shape() const; + + +Standard_EXPORT virtual void Perform() ; + + +Standard_EXPORT virtual void CheckData() ; +//Standard_EXPORT ~GEOMAlgo_ClsfSolid(); + + + + + // Type management + // + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // +TopoDS_Shape myShape; +Standard_Address myPClsf; + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_ClsfSolid.ixx b/src/GEOMAlgo/GEOMAlgo_ClsfSolid.ixx new file mode 100644 index 000000000..c3a9f9b2d --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ClsfSolid.ixx @@ -0,0 +1,74 @@ +// 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 + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +//GEOMAlgo_ClsfSolid::~GEOMAlgo_ClsfSolid() {} + + + +Standard_EXPORT Handle_Standard_Type& GEOMAlgo_ClsfSolid_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(GEOMAlgo_Clsf); + static Handle_Standard_Type aType2 = STANDARD_TYPE(GEOMAlgo_HAlgo); + static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMAlgo_ClsfSolid", + sizeof(GEOMAlgo_ClsfSolid), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(GEOMAlgo_ClsfSolid) Handle(GEOMAlgo_ClsfSolid)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMAlgo_ClsfSolid) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMAlgo_ClsfSolid))) { + _anOtherObject = Handle(GEOMAlgo_ClsfSolid)((Handle(GEOMAlgo_ClsfSolid)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& GEOMAlgo_ClsfSolid::DynamicType() const +{ + return STANDARD_TYPE(GEOMAlgo_ClsfSolid) ; +} +//Standard_Boolean GEOMAlgo_ClsfSolid::IsKind(const Handle(Standard_Type)& AType) const +//{ +// return (STANDARD_TYPE(GEOMAlgo_ClsfSolid) == AType || GEOMAlgo_Clsf::IsKind(AType)); +//} +//Handle_GEOMAlgo_ClsfSolid::~Handle_GEOMAlgo_ClsfSolid() {} + diff --git a/src/GEOMAlgo/GEOMAlgo_ClsfSolid.jxx b/src/GEOMAlgo/GEOMAlgo_ClsfSolid.jxx new file mode 100644 index 000000000..3d84d0210 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ClsfSolid.jxx @@ -0,0 +1,25 @@ +// 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 + +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_ClsfSolid_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape.hxx b/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape.hxx new file mode 100644 index 000000000..8c046bf60 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape.hxx @@ -0,0 +1,113 @@ +// 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 + +#ifndef _GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape_HeaderFile +#define _GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape_HeaderFile + +#ifndef _TCollection_BasicMapIterator_HeaderFile +#include +#endif +#ifndef _Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_HeaderFile +#include +#endif +class Standard_NoSuchObject; +class GEOMAlgo_PassKeyShape; +class TopoDS_Shape; +class GEOMAlgo_PassKeyShapeMapHasher; +class GEOMAlgo_DataMapOfPassKeyShapeShape; +class GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + + +class GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape : public TCollection_BasicMapIterator { + +public: + + void* operator new(size_t,void* anAddress) + { + return anAddress; + } + void* operator new(size_t size) + { + return Standard::Allocate(size); + } + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + // Methods PUBLIC + // + + +Standard_EXPORT GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape(); + + +Standard_EXPORT GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape(const GEOMAlgo_DataMapOfPassKeyShapeShape& aMap); + + +Standard_EXPORT void Initialize(const GEOMAlgo_DataMapOfPassKeyShapeShape& aMap) ; + + +Standard_EXPORT const GEOMAlgo_PassKeyShape& Key() const; + + +Standard_EXPORT const TopoDS_Shape& Value() const; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape_0.cxx b/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape_0.cxx new file mode 100644 index 000000000..36e1955f0 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape_0.cxx @@ -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 + +#include + +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_PassKeyShape_HeaderFile +#include +#endif +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_PassKeyShapeMapHasher_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_DataMapOfPassKeyShapeShape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_HeaderFile +#include +#endif + + +#define TheKey GEOMAlgo_PassKeyShape +#define TheKey_hxx +#define TheItem TopoDS_Shape +#define TheItem_hxx +#define Hasher GEOMAlgo_PassKeyShapeMapHasher +#define Hasher_hxx +#define TCollection_DataMapNode GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape +#define TCollection_DataMapNode_Type_() GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_Type_() +#define TCollection_DataMap GEOMAlgo_DataMapOfPassKeyShapeShape +#define TCollection_DataMap_hxx +#include + diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape.hxx b/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape.hxx new file mode 100644 index 000000000..856164622 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape.hxx @@ -0,0 +1,132 @@ +// 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 + +#ifndef _GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_HeaderFile +#define _GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_HeaderFile +#include +#endif + +#ifndef _GEOMAlgo_PassKeyShape_HeaderFile +#include +#endif +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _TCollection_MapNode_HeaderFile +#include +#endif +#ifndef _TCollection_MapNodePtr_HeaderFile +#include +#endif +class GEOMAlgo_PassKeyShape; +class TopoDS_Shape; +class GEOMAlgo_PassKeyShapeMapHasher; +class GEOMAlgo_DataMapOfPassKeyShapeShape; +class GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape; + + + +class GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape : public TCollection_MapNode { + +public: + // Methods PUBLIC + // + +GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape(const GEOMAlgo_PassKeyShape& K,const TopoDS_Shape& I,const TCollection_MapNodePtr& n); + + GEOMAlgo_PassKeyShape& Key() const; + + TopoDS_Shape& Value() const; +//Standard_EXPORT ~GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape(); + + + + + // Type management + // + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +GEOMAlgo_PassKeyShape myKey; +TopoDS_Shape myValue; + + +}; + +#define TheKey GEOMAlgo_PassKeyShape +#define TheKey_hxx +#define TheItem TopoDS_Shape +#define TheItem_hxx +#define Hasher GEOMAlgo_PassKeyShapeMapHasher +#define Hasher_hxx +#define TCollection_DataMapNode GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape +#define TCollection_DataMapNode_Type_() GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_Type_() +#define TCollection_DataMap GEOMAlgo_DataMapOfPassKeyShapeShape +#define TCollection_DataMap_hxx + +#include + +#undef TheKey +#undef TheKey_hxx +#undef TheItem +#undef TheItem_hxx +#undef Hasher +#undef Hasher_hxx +#undef TCollection_DataMapNode +#undef TCollection_DataMapNode_hxx +#undef TCollection_DataMapIterator +#undef TCollection_DataMapIterator_hxx +#undef Handle_TCollection_DataMapNode +#undef TCollection_DataMapNode_Type_ +#undef TCollection_DataMap +#undef TCollection_DataMap_hxx + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_0.cxx b/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_0.cxx new file mode 100644 index 000000000..424e74701 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_0.cxx @@ -0,0 +1,103 @@ +// 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 + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _GEOMAlgo_PassKeyShape_HeaderFile +#include +#endif +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_PassKeyShapeMapHasher_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_DataMapOfPassKeyShapeShape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape_HeaderFile +#include +#endif +//GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape::~GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape() {} + + + +Standard_EXPORT Handle_Standard_Type& GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape", + sizeof(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape) Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape))) { + _anOtherObject = Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape)((Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape::DynamicType() const +{ + return STANDARD_TYPE(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape) ; +} +//Standard_Boolean GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape::IsKind(const Handle(Standard_Type)& AType) const +//{ +// return (STANDARD_TYPE(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape) == AType || TCollection_MapNode::IsKind(AType)); +//} +//Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape::~Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape() {} +#define TheKey GEOMAlgo_PassKeyShape +#define TheKey_hxx +#define TheItem TopoDS_Shape +#define TheItem_hxx +#define Hasher GEOMAlgo_PassKeyShapeMapHasher +#define Hasher_hxx +#define TCollection_DataMapNode GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape +#define TCollection_DataMapNode_Type_() GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_Type_() +#define TCollection_DataMap GEOMAlgo_DataMapOfPassKeyShapeShape +#define TCollection_DataMap_hxx +#include + diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapOfPassKeyShapeShape.hxx b/src/GEOMAlgo/GEOMAlgo_DataMapOfPassKeyShapeShape.hxx new file mode 100644 index 000000000..4e209557f --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_DataMapOfPassKeyShapeShape.hxx @@ -0,0 +1,155 @@ +// 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 + +#ifndef _GEOMAlgo_DataMapOfPassKeyShapeShape_HeaderFile +#define _GEOMAlgo_DataMapOfPassKeyShapeShape_HeaderFile + +#ifndef _TCollection_BasicMap_HeaderFile +#include +#endif +#ifndef _Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_HeaderFile +#include +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class Standard_DomainError; +class Standard_NoSuchObject; +class GEOMAlgo_PassKeyShape; +class TopoDS_Shape; +class GEOMAlgo_PassKeyShapeMapHasher; +class GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape; +class GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + + +class GEOMAlgo_DataMapOfPassKeyShapeShape : public TCollection_BasicMap { + +public: + + void* operator new(size_t,void* anAddress) + { + return anAddress; + } + void* operator new(size_t size) + { + return Standard::Allocate(size); + } + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + // Methods PUBLIC + // + + +Standard_EXPORT GEOMAlgo_DataMapOfPassKeyShapeShape(const Standard_Integer NbBuckets = 1); + + +Standard_EXPORT GEOMAlgo_DataMapOfPassKeyShapeShape& Assign(const GEOMAlgo_DataMapOfPassKeyShapeShape& Other) ; + GEOMAlgo_DataMapOfPassKeyShapeShape& operator =(const GEOMAlgo_DataMapOfPassKeyShapeShape& Other) +{ + return Assign(Other); +} + + + +Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; + + +Standard_EXPORT void Clear() ; +~GEOMAlgo_DataMapOfPassKeyShapeShape() +{ + Clear(); +} + + + +Standard_EXPORT Standard_Boolean Bind(const GEOMAlgo_PassKeyShape& K,const TopoDS_Shape& I) ; + + +Standard_EXPORT Standard_Boolean IsBound(const GEOMAlgo_PassKeyShape& K) const; + + +Standard_EXPORT Standard_Boolean UnBind(const GEOMAlgo_PassKeyShape& K) ; + + +Standard_EXPORT const TopoDS_Shape& Find(const GEOMAlgo_PassKeyShape& K) const; + const TopoDS_Shape& operator()(const GEOMAlgo_PassKeyShape& K) const +{ + return Find(K); +} + + + +Standard_EXPORT TopoDS_Shape& ChangeFind(const GEOMAlgo_PassKeyShape& K) ; + TopoDS_Shape& operator()(const GEOMAlgo_PassKeyShape& K) +{ + return ChangeFind(K); +} + + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + +Standard_EXPORT GEOMAlgo_DataMapOfPassKeyShapeShape(const GEOMAlgo_DataMapOfPassKeyShapeShape& Other); + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapOfPassKeyShapeShape_0.cxx b/src/GEOMAlgo/GEOMAlgo_DataMapOfPassKeyShapeShape_0.cxx new file mode 100644 index 000000000..777551745 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_DataMapOfPassKeyShapeShape_0.cxx @@ -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 + +#include + +#ifndef _Standard_DomainError_HeaderFile +#include +#endif +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_PassKeyShape_HeaderFile +#include +#endif +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_PassKeyShapeMapHasher_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape_HeaderFile +#include +#endif + + +#define TheKey GEOMAlgo_PassKeyShape +#define TheKey_hxx +#define TheItem TopoDS_Shape +#define TheItem_hxx +#define Hasher GEOMAlgo_PassKeyShapeMapHasher +#define Hasher_hxx +#define TCollection_DataMapNode GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape +#define TCollection_DataMapNode_Type_() GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_Type_() +#define TCollection_DataMap GEOMAlgo_DataMapOfPassKeyShapeShape +#define TCollection_DataMap_hxx +#include + diff --git a/src/GEOMAlgo/GEOMAlgo_Gluer.cxx b/src/GEOMAlgo/GEOMAlgo_Gluer.cxx index cb2b0d424..9c27ede44 100755 --- a/src/GEOMAlgo/GEOMAlgo_Gluer.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Gluer.cxx @@ -25,6 +25,11 @@ #include +#include +#include + +#include +#include #include #include @@ -77,8 +82,8 @@ #include #include -#include //qft -#include //qft +#include +#include #include // @@ -179,11 +184,9 @@ void GEOMAlgo_Gluer::MakeVertices() { myErrorStatus=0; // - Standard_Integer j, i, aNbV, aIndex, aNbVSD; + Standard_Integer j, i, aNbV, aNbVSD; TColStd_ListIteratorOfListOfInteger aIt; - Handle(Bnd_HArray1OfBox) aHAB; - Bnd_BoundSortBox aBSB; - TopoDS_Shape aSTmp, aVF; + TopoDS_Shape aVF; TopoDS_Vertex aVnew; TopTools_IndexedMapOfShape aMV, aMVProcessed; TopTools_ListIteratorOfListOfShape aItS; @@ -192,6 +195,11 @@ void GEOMAlgo_Gluer::MakeVertices() GEOMAlgo_IndexedDataMapOfIntegerShape aMIS; GEOMAlgo_IndexedDataMapOfShapeBox aMSB; // + NMTDS_BoxBndTreeSelector aSelector; + NMTDS_BoxBndTree aBBTree; + NCollection_UBTreeFiller aTreeFiller(aBBTree); + // + // TopExp::MapShapes(myShape, TopAbs_VERTEX, aMV); aNbV=aMV.Extent(); if (!aNbV) { @@ -199,21 +207,23 @@ void GEOMAlgo_Gluer::MakeVertices() return; } // - aHAB=new Bnd_HArray1OfBox(1, aNbV); - // for (i=1; i<=aNbV; ++i) { const TopoDS_Shape& aV=aMV(i); Bnd_Box aBox; // aBox.SetGap(myTol); BRepBndLib::Add(aV, aBox); - aHAB->SetValue(i, aBox); + // + aTreeFiller.Add(i, aBox); + // aMIS.Add(i, aV); aMSB.Add(aV, aBox); } // - aBSB.Initialize(aHAB); + aTreeFiller.Fill(); // + //------------------------------ + // Chains for (i=1; i<=aNbV; ++i) { const TopoDS_Shape& aV=aMV(i); // @@ -221,31 +231,86 @@ void GEOMAlgo_Gluer::MakeVertices() continue; } // - const Bnd_Box& aBoxV=aMSB.FindFromKey(aV); - const TColStd_ListOfInteger& aLI=aBSB.Compare(aBoxV); - aNbVSD=aLI.Extent(); - if (!aNbVSD) { - myErrorStatus=3; // it must not be - return; - } + Standard_Integer aNbIP, aIP, aNbIP1, aIP1; + TopTools_ListOfShape aLVSD; + TColStd_MapOfInteger aMIP, aMIP1, aMIPC; + TColStd_MapIteratorOfMapOfInteger aIt1; // - // Images + aMIP.Add(i); + while(1) { + aNbIP=aMIP.Extent(); + aIt1.Initialize(aMIP); + for(; aIt1.More(); aIt1.Next()) { + aIP=aIt1.Key(); + if (aMIPC.Contains(aIP)) { + continue; + } + // + const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP); + const Bnd_Box& aBoxVP=aMSB.FindFromKey(aVP); + // + aSelector.Clear(); + aSelector.SetBox(aBoxVP); + // + aNbVSD=aBBTree.Select(aSelector); + if (!aNbVSD) { + continue; // it must not be + } + // + const TColStd_ListOfInteger& aLI=aSelector.Indices(); + aIt.Initialize(aLI); + for (; aIt.More(); aIt.Next()) { + aIP1=aIt.Value(); + if (aMIP.Contains(aIP1)) { + continue; + } + aMIP1.Add(aIP1); + } //for (; aIt.More(); aIt.Next()) { + }//for(; aIt1.More(); aIt1.Next()) { + // + aNbIP1=aMIP1.Extent(); + if (!aNbIP1) { + break; + } + // + aIt1.Initialize(aMIP); + for(; aIt1.More(); aIt1.Next()) { + aIP=aIt1.Key(); + aMIPC.Add(aIP); + } + // + aMIP.Clear(); + aIt1.Initialize(aMIP1); + for(; aIt1.More(); aIt1.Next()) { + aIP=aIt1.Key(); + aMIP.Add(aIP); + } + aMIP1.Clear(); + }// while(1) // - TopTools_ListOfShape aLVSD; + // Fill myImages + aNbIP=aMIPC.Extent(); // - aIt.Initialize(aLI); - for (j=0; aIt.More(); aIt.Next(), ++j) { - aIndex=aIt.Value(); - const TopoDS_Shape& aVx=aMIS.FindFromKey(aIndex); - if(!j) { - aVF=aVx; + if (!aNbIP) {// no SD vertices founded + aVF=aV; + aLVSD.Append(aV); + aMVProcessed.Add(aV); + } + else { // SD vertices founded [ aMIPC ] + aIt1.Initialize(aMIPC); + for(j=0; aIt1.More(); aIt1.Next(), ++j) { + aIP=aIt1.Key(); + const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP); + if (!j) { + aVF=aVP; + } + aLVSD.Append(aVP); + aMVProcessed.Add(aVP); } - aLVSD.Append(aVx); - aMVProcessed.Add(aVx); } - // myImages.Bind(aVF, aLVSD); - } + }// for (i=1; i<=aNbV; ++i) { + //------------------------------ // // Make new vertices aMV.Clear(); @@ -281,7 +346,6 @@ void GEOMAlgo_Gluer::MakeVertices() for (; aItIm.More(); aItIm.Next()) { const TopoDS_Shape& aV=aItIm.Key(); const TopTools_ListOfShape& aLVSD=aItIm.Value(); - // aItS.Initialize(aLVSD); for (; aItS.More(); aItS.Next()) { const TopoDS_Shape& aVSD=aItS.Value(); @@ -424,8 +488,8 @@ void GEOMAlgo_Gluer::MakeShapes(const TopAbs_ShapeEnum aType) TopoDS_Shape aNewShape; TopTools_IndexedMapOfShape aMF; TopTools_ListIteratorOfListOfShape aItS; - GEOMAlgo_PassKeyShape aPKF;//qft - GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape aMPKLF;//qft + GEOMAlgo_PassKeyShape aPKF; + GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape aMPKLF; // TopExp::MapShapes(myShape, aType, aMF); // @@ -433,7 +497,6 @@ void GEOMAlgo_Gluer::MakeShapes(const TopAbs_ShapeEnum aType) for (i=1; i<=aNbF; ++i) { const TopoDS_Shape& aS=aMF(i); // - //aPKF.Clear();//qft if (aType==TopAbs_FACE) { const TopoDS_Face& aF=TopoDS::Face(aS); FacePassKey(aF, aPKF); @@ -622,21 +685,12 @@ void GEOMAlgo_Gluer::InnerTolerance() void GEOMAlgo_Gluer::FacePassKey(const TopoDS_Face& aF, GEOMAlgo_PassKeyShape& aPK) { - Standard_Integer i, aNbE;//, aNbMax;//qft + Standard_Integer i, aNbE; TopTools_ListOfShape aLE; TopTools_IndexedMapOfShape aME; // TopExp::MapShapes(aF, TopAbs_EDGE, aME); aNbE=aME.Extent(); - //qf - /* - aNbMax=aPK.NbMax(); - if (!aNbE || aNbE>aNbMax) { - myErrorStatus=101; // temprorary - return; - } - */ - //qt // for (i=1; i<=aNbE; ++i) { const TopoDS_Shape& aE=aME(i); @@ -647,10 +701,7 @@ void GEOMAlgo_Gluer::FacePassKey(const TopoDS_Face& aF, const TopoDS_Shape& aER=myOrigins.Find(aE); aLE.Append(aER); } - //qf - //aPK.SetIds(aLE); aPK.SetShapes(aLE); - //qt } //======================================================================= //function : EdgePassKey @@ -669,10 +720,7 @@ void GEOMAlgo_Gluer::EdgePassKey(const TopoDS_Edge& aE, } const TopoDS_Shape& aVR1=myOrigins.Find(aV1); const TopoDS_Shape& aVR2=myOrigins.Find(aV2); - //qf - //aPK.SetIds(aVR1, aVR2); aPK.SetShapes(aVR1, aVR2); - //qt } //======================================================================= //function : MakeVertex @@ -774,7 +822,6 @@ void GEOMAlgo_Gluer::MakeEdge(const TopoDS_Edge& aE, BOPTools_Tools::MakeSplitEdge(aEx, aVR1, aT1, aVR2, aT2, aNewEdge); } } -// //======================================================================= //function : MakeFace //purpose : @@ -834,15 +881,13 @@ void GEOMAlgo_Gluer::MakeFace(const TopoDS_Face& aF, // aBB.Add(newWire, aER); } - //modified by NIZNHY-PKV Mon Jan 31 17:26:36 2005f - // + // xf TopTools_ListOfShape aLW; // aLW.Append(aW); myImages.Bind(newWire, aLW); myOrigins.Bind(aW, newWire); - // - //modified by NIZNHY-PKV Mon Jan 31 17:26:41 2005 t + // xt aBB.Add(newFace, newWire); } aNewFace=newFace; @@ -963,10 +1008,10 @@ const TopTools_ListOfShape& GEOMAlgo_Gluer::Modified (const TopoDS_Shape& aS) aType=aS.ShapeType(); if (aType==TopAbs_VERTEX || aType==TopAbs_EDGE || - aType==TopAbs_WIRE || //modified by NIZNHY-PKV Mon Jan 31 17:18:36 2005ft + aType==TopAbs_WIRE || aType==TopAbs_FACE || - aType==TopAbs_SHELL || //modified by NIZNHY-PKV Mon Jan 31 17:18:36 2005ft - aType==TopAbs_SOLID) { //modified by NIZNHY-PKV Mon Jan 31 17:18:36 2005ft + aType==TopAbs_SHELL || + aType==TopAbs_SOLID) { if(myOrigins.IsBound(aS)) { const TopoDS_Shape& aSnew=myOrigins.Find(aS); if (!aSnew.IsSame(aS)) { diff --git a/src/GEOMAlgo/GEOMAlgo_Gluer1.cdl b/src/GEOMAlgo/GEOMAlgo_Gluer1.cdl new file mode 100755 index 000000000..d226781a7 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_Gluer1.cdl @@ -0,0 +1,71 @@ +-- 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: GEOMAlgo_Gluer1.cdl +-- Created: Wed Jan 24 11:37:31 2007 +-- Author: Peter KURNEV +-- + + +class Gluer1 from GEOMAlgo + inherits Gluer from GEOMAlgo + + ---Purpose: + +uses + ListOfCoupleOfShapes from GEOMAlgo, + DataMapOfPassKeyShapeShape from GEOMAlgo + +--raises + +is + Create + returns Gluer1 from GEOMAlgo; + ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_Gluer1();" + + SetFacesToUnglue(me:out; + aLCS:ListOfCoupleOfShapes from GEOMAlgo); + + FacesToUnglue(me) + returns ListOfCoupleOfShapes from GEOMAlgo; + ---C++: return const& + + GluedFaces(me) + returns ListOfCoupleOfShapes from GEOMAlgo; + ---C++: return const& + + RejectedFaces(me) + returns ListOfCoupleOfShapes from GEOMAlgo; + ---C++: return const& + + Perform(me:out) + is redefined; + + UnglueFaces(me:out); + + FillGluedFaces(me:out) + is protected; + +fields + myGluedFaces :ListOfCoupleOfShapes from GEOMAlgo is protected; + myFacesToUnglue :ListOfCoupleOfShapes from GEOMAlgo is protected; + myRejectedFaces :ListOfCoupleOfShapes from GEOMAlgo is protected; + myMapGN :DataMapOfPassKeyShapeShape from GEOMAlgo is protected; + +end Gluer1; diff --git a/src/GEOMAlgo/GEOMAlgo_Gluer1.cxx b/src/GEOMAlgo/GEOMAlgo_Gluer1.cxx new file mode 100755 index 000000000..d1636fea5 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_Gluer1.cxx @@ -0,0 +1,542 @@ +// 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: GEOMAlgo_Gluer1.cxx +// Created: Wed Jan 24 11:52:27 2007 +// Author: Peter KURNEV +// + + +#include + +#include + +#include + +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +//======================================================================= +//class : GEOMAlgo_CoupleOfInteger +//purpose : +//======================================================================= +class GEOMAlgo_CoupleOfInteger { + // + public: + // + GEOMAlgo_CoupleOfInteger() { + myInt1=0; + myInt2=0; + } + // + ~GEOMAlgo_CoupleOfInteger() { + } + // + void SetValues(const Standard_Integer aI1, + const Standard_Integer aI2) { + myInt1=aI1; + myInt2=aI2; + } + // + void SetValue1(const Standard_Integer aI1) { + myInt1=aI1; + } + // + void SetValue2(const Standard_Integer aI1) { + myInt1=aI1; + } + // + void Values(Standard_Integer& aI1, + Standard_Integer& aI2) const { + aI1=myInt1; + aI2=myInt2; + } + // + Standard_Integer Value1()const { + return myInt1; + } + // + Standard_Integer Value2()const { + return myInt2; + } + // + protected: + Standard_Integer myInt1; + Standard_Integer myInt2; +}; +// +//======================================================================= +// +static + void SortShell(const Standard_Integer , + GEOMAlgo_CoupleOfInteger* ); +static + void RefineSolid(const TopoDS_Shape& , + const TopTools_DataMapOfShapeShape& , + TopTools_DataMapOfShapeShape& ); +static + void MakeFaceToReplace(const TopoDS_Face& , + TopoDS_Face& ); +// +//======================================================================= +//function : GEOMAlgo_Gluer1 +//purpose : +//======================================================================= + GEOMAlgo_Gluer1::GEOMAlgo_Gluer1() +: + GEOMAlgo_Gluer() +{ +} +//======================================================================= +//function : +//purpose : +//======================================================================= + GEOMAlgo_Gluer1::~GEOMAlgo_Gluer1() +{ +} +//======================================================================= +//function : SetFacesToUnglue +//purpose : +//======================================================================= + void GEOMAlgo_Gluer1::SetFacesToUnglue(const GEOMAlgo_ListOfCoupleOfShapes& aLCS) +{ + myFacesToUnglue=aLCS; +} +//======================================================================= +//function : FacesToUnglue +//purpose : +//======================================================================= + const GEOMAlgo_ListOfCoupleOfShapes& GEOMAlgo_Gluer1::FacesToUnglue()const +{ + return myFacesToUnglue; +} +//======================================================================= +//function : GluedFaces +//purpose : +//======================================================================= + const GEOMAlgo_ListOfCoupleOfShapes& GEOMAlgo_Gluer1::GluedFaces()const +{ + return myGluedFaces; +} +//======================================================================= +//function : RejectedFaces +//purpose : +//======================================================================= + const GEOMAlgo_ListOfCoupleOfShapes& GEOMAlgo_Gluer1::RejectedFaces()const +{ + return myRejectedFaces; +} +//======================================================================= +//function : Perform +//purpose : +//======================================================================= + void GEOMAlgo_Gluer1::Perform() +{ + // 1. + GEOMAlgo_Gluer::Perform(); + if (myErrorStatus) { + return; + } + // + FillGluedFaces(); + if (myErrorStatus) { + return; + } +} +//======================================================================= +//function : FillGluedFaces +//purpose : +//======================================================================= + void GEOMAlgo_Gluer1::FillGluedFaces() +{ + myErrorStatus=0; + // + Standard_Integer aNbIm, aNbS, i; + TopAbs_ShapeEnum aType; + TopTools_ListIteratorOfListOfShape aItLS; + TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm; + GEOMAlgo_CoupleOfShapes aCS; + GEOMAlgo_PassKeyShape aPKS; + // + myMapGN.Clear(); + myGluedFaces.Clear(); + // + aNbIm=myImages.Extent(); + aItIm.Initialize(myImages); + for (; aItIm.More(); aItIm.Next()) { + const TopoDS_Shape& aSnew=aItIm.Key(); + aType=aSnew.ShapeType(); + if (aType!=TopAbs_FACE) { + continue; + } + // + const TopTools_ListOfShape& aLS=aItIm.Value(); + aNbS=aLS.Extent(); + if (aNbS!=2) { + continue; + } + // + TopoDS_Shape aSold[2]; + aItLS.Initialize(aLS); + for (i=0; aItLS.More(); aItLS.Next(), ++i) { + const TopoDS_Shape& aSi=aItLS.Value(); + aSold[i]=aItLS.Value(); + } + // + aCS.SetShapes(aSold[0], aSold[1]); + myGluedFaces.Append(aCS); + // + aPKS.Clear(); + aPKS.SetShapes(aSold[0], aSold[1]); + myMapGN.Bind(aPKS, aSnew); + } +} +//======================================================================= +//function : UnglueFaces +//purpose : +//======================================================================= + void GEOMAlgo_Gluer1::UnglueFaces() +{ + if (myErrorStatus) { + return; + } + // + Standard_Boolean bFound; + Standard_Integer i, aNbUN, aNbS, aNbF, iX; + TopTools_IndexedDataMapOfShapeListOfShape aMFSR, aMFS, aMSF; + TopTools_ListIteratorOfListOfShape aItLS, aItLS1; + GEOMAlgo_PassKeyShape aPKS; + GEOMAlgo_ListIteratorOfListOfCoupleOfShapes aItCS; + GEOMAlgo_DataMapOfPassKeyShapeShape aMapUN; + GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape aItUN; + GEOMAlgo_CoupleOfInteger *pIx; + // + if (myResult.IsNull()) { + myErrorStatus=200; // no result + return; + } + myWarningStatus=0; + myRejectedFaces.Clear(); + // + // 0. Fill map [Face]/Solid for myResult: aMFSR + TopExp::MapShapesAndAncestors(myResult, TopAbs_FACE, TopAbs_SOLID, aMFSR); + // + // 1. Fill Faces to process: aMapUN : [Fold1, Fold2] / Fnew + aNbUN=myFacesToUnglue.Extent(); + if (!aNbUN) { + // all faces that can be unglued will be unglued + aMapUN=myMapGN; + myFacesToUnglue=myGluedFaces; + } + else { + aItCS.Initialize(myFacesToUnglue); + for (; aItCS.More(); aItCS.Next()) { + const GEOMAlgo_CoupleOfShapes& aCS=aItCS.Value(); + const TopoDS_Shape& aS1=aCS.Shape1(); + const TopoDS_Shape& aS2=aCS.Shape2(); + aPKS.Clear(); + aPKS.SetShapes(aS1, aS2); + if (!myMapGN.IsBound(aPKS)) { + //some faces, wanted to unglue, are not glued at all; + myWarningStatus=2; + myRejectedFaces.Append(aCS); + continue; + } + // + const TopoDS_Shape& aFN=myMapGN.Find(aPKS); + aMapUN.Bind(aPKS, aFN); + } + } + // + // 2 Fill map FN/Solids for myResult: aMFS + aNbUN=aMapUN.Extent(); + aItUN.Initialize(aMapUN); + for (; aItUN.More(); aItUN.Next()) { + const TopoDS_Shape& aFN=aItUN.Value(); + if (!aMFSR.Contains(aFN)) { + myWarningStatus=3; // how can it be + continue; + } + // + const TopTools_ListOfShape& aLS=aMFSR.FindFromKey(aFN); + aNbS=aLS.Extent(); + if (aNbS!=2) { + // wrong result: More than 2 solids shared one face + myWarningStatus=4; + continue; + } + aMFS.Add(aFN, aLS); + } + // + // 3 Fill map Solids/FN for myResult: aMSF + aNbUN=aMFS.Extent(); + for (i=1; i<=aNbUN; ++i) { + const TopoDS_Shape& aFN=aMFS.FindKey(i); + const TopTools_ListOfShape& aLS=aMFS(i); + aItLS.Initialize(aLS); + for (; aItLS.More(); aItLS.Next()) { + const TopoDS_Shape& aS=aItLS.Value(); + if (aMSF.Contains(aS)) { + TopTools_ListOfShape& aLF=aMSF.ChangeFromKey(aS); + aLF.Append(aFN); + } + else { + TopTools_ListOfShape aLF; + aLF.Append(aFN); + aMSF.Add(aS, aLF); + } + } + } + // + // 4 Sort indices of aMSF + aNbS=aMSF.Extent(); + if (aNbS<2) { + // wrong number of solids that have shared face + myWarningStatus=5; + } + // + pIx=new GEOMAlgo_CoupleOfInteger[aNbS]; + // + for (i=1; i<=aNbS; ++i) { + const TopTools_ListOfShape& aLF=aMSF(i); + aNbF=aLF.Extent(); + pIx[i-1].SetValues(aNbF, i); + } + SortShell(aNbS, pIx); + // + // 5 Refine solids + // + TopTools_DataMapOfShapeShape aMFNFN2, aMFNFD; + TopTools_DataMapIteratorOfDataMapOfShapeShape aItMSS; + TopTools_MapOfShape aMFNP; + TopTools_IndexedMapOfShape aMFD; + // + for (iX=aNbS-1; iX>=0; --iX) { + i=pIx[iX].Value2(); + // solid from myResult aSN + const TopoDS_Shape& aSN=aMSF.FindKey(i); + // + // candidates to be faces to replace for aSN + const TopTools_ListOfShape& aLFN=aMSF(i); + aNbF=aLFN.Extent(); + // + // original solid for aSN -> aSD + const TopTools_ListOfShape& aLSD=myImages.Find(aSN); + const TopoDS_Shape& aSD=aLSD.First(); + // + // faces of original solid -> aMFD + aMFD.Clear(); + TopExp::MapShapes(aSD, TopAbs_FACE, aMFD); + // + // faces to replace for aSN [FN]/FD -> aMFNFD + aMFNFD.Clear(); + aItLS.Initialize(aLFN); + for (; aItLS.More(); aItLS.Next()) { + const TopoDS_Shape& aFN=aItLS.Value(); + if (!aMFNP.Add(aFN)) { + continue; + } + // + // original face from original solid -> FD + TopoDS_Shape aFD; + // + bFound=Standard_False; + const TopTools_ListOfShape& aLFD=myImages.Find(aFN); + aItLS1.Initialize(aLFD); + for (; aItLS1.More(); aItLS1.Next()) { + const TopoDS_Shape& aFDx=aItLS1.Value(); + if (aMFD.Contains(aFDx)) { + aFD=aFDx; + bFound=Standard_True; + break; + } + } + //if (!bFound) {...} + aMFNFD.Bind(aFN, aFD); + } // for (; aItLS.More(); aItLS.Next()) { + // + aNbF=aMFNFD.Extent(); + if (!aNbF) { + // nothing to do here + continue; + } + // update solid SN (and its shells) + RefineSolid(aSN, aMFNFD, aMFNFN2); + // + // update myOrigins / myImages + aItMSS.Initialize(aMFNFD); + for (; aItMSS.More(); aItMSS.Next()) { + const TopoDS_Shape& aFN=aItMSS.Key(); // face removed from aSN + const TopoDS_Shape& aFD=aItMSS.Value(); // old face from aSD + const TopoDS_Shape& aFN2=aMFNFN2.Find(aFN);// face added to aSN + // + // myOrigins + myOrigins.ChangeFind(aFD)=aFN2; + // + // myImages + TopTools_ListOfShape aLFDx; + // + TopTools_ListOfShape& aLFD=myImages.ChangeFind(aFN); + aItLS.Initialize(aLFD); + for (; aItLS.More(); aItLS.Next()) { + const TopoDS_Shape& aFDx=aItLS.Value(); + if (!aFDx.IsSame(aFD)) { + aLFDx.Append(aFDx); + } + } + aLFD=aLFDx; + // + aLFDx.Clear(); + aLFDx.Append(aFD); + myImages.Bind(aFN2, aLFDx); + } // for (; aItMSS.More(); aItMSS.Next()) { + } // for (iX=aNbS-1; iX>=0; --iX) { + // + delete [] pIx; +} +//======================================================================= +// function: RefineSolid +// purpose : replace faces (aMFN) of solid aSd by new ones +//======================================================================= +void RefineSolid(const TopoDS_Shape& aSd, + const TopTools_DataMapOfShapeShape& aMFNFD, + TopTools_DataMapOfShapeShape& aMFNFN2) +{ + TopoDS_Shape *pSh; + TopoDS_Face aF2; + TopoDS_Iterator aItSd, aItSh; + BRep_Builder aBB; + TopTools_ListOfShape aLF; + TopTools_ListIteratorOfListOfShape aItLF; + // + aItSd.Initialize(aSd); + for (; aItSd.More(); aItSd.Next()) { + const TopoDS_Shape& aSh=aItSd.Value(); + pSh=(TopoDS_Shape *)&aSh; + pSh->Free(Standard_True); + aLF.Clear(); + aItSh.Initialize(*pSh); + for (; aItSh.More(); aItSh.Next()) { + const TopoDS_Shape& aF=aItSh.Value(); + if (aMFNFD.IsBound(aF)) { + aLF.Append(aF); + } + } + // + aItLF.Initialize(aLF); + for (; aItLF.More(); aItLF.Next()) { + const TopoDS_Face& aF=TopoDS::Face(aItLF.Value()); + // + MakeFaceToReplace(aF, aF2); + // + aMFNFN2.Bind(aF, aF2); + aBB.Remove(*pSh, aF); + aBB.Add(*pSh, aF2); + } + pSh->Free(Standard_False); + } +} +//======================================================================= +//function : MakeFaceToReplace +//purpose : +//======================================================================= +void MakeFaceToReplace(const TopoDS_Face& aF, + TopoDS_Face& aFR) +{ + Standard_Real aTol; + Handle(Geom_Surface) aS; + TopLoc_Location aLoc; + TopoDS_Face aFFWD, aFnew; + TopoDS_Iterator aItF; + BRep_Builder aBB; + // + aFFWD=aF; + aFFWD.Orientation(TopAbs_FORWARD); + aS=BRep_Tool::Surface(aFFWD, aLoc); + aTol=BRep_Tool::Tolerance(aFFWD); + // + aBB.MakeFace (aFnew, aS, aLoc, aTol); + aItF.Initialize(aFFWD); + for (; aItF.More(); aItF.Next()) { + const TopoDS_Shape& aW=aItF.Value(); + aBB.Add(aFnew, aW); + } + aFnew.Orientation(aF.Orientation()); + aFR=aFnew; +} +//======================================================================= +// function: SortShell +// purpose : +//======================================================================= +void SortShell(const Standard_Integer n, + GEOMAlgo_CoupleOfInteger* a) +{ + Standard_Integer nd, i, j, l, d=1; + GEOMAlgo_CoupleOfInteger x; + // + while(d<=n) { + d*=2; + } + // + while (d) { + d=(d-1)/2; + // + nd=n-d; + for (i=0; i -1) { + goto m30; + } + }//if (a[l] < a[j]){ + }//for (i=0; i +#endif +#ifndef _GEOMAlgo_DataMapOfPassKeyShapeShape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_Gluer_HeaderFile +#include +#endif +class GEOMAlgo_ListOfCoupleOfShapes; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + + +class GEOMAlgo_Gluer1 : public GEOMAlgo_Gluer { + +public: + + void* operator new(size_t,void* anAddress) + { + return anAddress; + } + void* operator new(size_t size) + { + return Standard::Allocate(size); + } + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + // Methods PUBLIC + // + + +Standard_EXPORT GEOMAlgo_Gluer1(); +Standard_EXPORT virtual ~GEOMAlgo_Gluer1(); + + +Standard_EXPORT void SetFacesToUnglue(const GEOMAlgo_ListOfCoupleOfShapes& aLCS) ; + + +Standard_EXPORT const GEOMAlgo_ListOfCoupleOfShapes& FacesToUnglue() const; + + +Standard_EXPORT const GEOMAlgo_ListOfCoupleOfShapes& GluedFaces() const; + + +Standard_EXPORT const GEOMAlgo_ListOfCoupleOfShapes& RejectedFaces() const; + + +Standard_EXPORT virtual void Perform() ; + + +Standard_EXPORT void UnglueFaces() ; + + + + + +protected: + + // Methods PROTECTED + // + + +Standard_EXPORT void FillGluedFaces() ; + + + // Fields PROTECTED + // +GEOMAlgo_ListOfCoupleOfShapes myGluedFaces; +GEOMAlgo_ListOfCoupleOfShapes myFacesToUnglue; +GEOMAlgo_ListOfCoupleOfShapes myRejectedFaces; +GEOMAlgo_DataMapOfPassKeyShapeShape myMapGN; + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_Gluer1.ixx b/src/GEOMAlgo/GEOMAlgo_Gluer1.ixx new file mode 100644 index 000000000..9198a8dbb --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_Gluer1.ixx @@ -0,0 +1,24 @@ +// 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 + + + + diff --git a/src/GEOMAlgo/GEOMAlgo_Gluer1.jxx b/src/GEOMAlgo/GEOMAlgo_Gluer1.jxx new file mode 100644 index 000000000..bb63320eb --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_Gluer1.jxx @@ -0,0 +1,25 @@ +// 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 + +#ifndef _GEOMAlgo_ListOfCoupleOfShapes_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_Gluer1_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo.hxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo.hxx new file mode 100644 index 000000000..2c37056e2 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo.hxx @@ -0,0 +1,139 @@ +// File generated by CPPExt (Transient) +// +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#ifndef _GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_HeaderFile +#define _GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_HeaderFile +#include +#endif + +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_ShapeInfo_HeaderFile +#include +#endif +#ifndef _TCollection_MapNodePtr_HeaderFile +#include +#endif +#ifndef _TCollection_MapNode_HeaderFile +#include +#endif +class TopoDS_Shape; +class GEOMAlgo_ShapeInfo; +class TopTools_ShapeMapHasher; +class GEOMAlgo_IndexedDataMapOfShapeShapeInfo; + + + +class GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo : public TCollection_MapNode { + +public: + // Methods PUBLIC + // + +GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo(const TopoDS_Shape& K1,const Standard_Integer K2,const GEOMAlgo_ShapeInfo& I,const TCollection_MapNodePtr& n1,const TCollection_MapNodePtr& n2); + + TopoDS_Shape& Key1() const; + + Standard_Integer& Key2() const; + + TCollection_MapNodePtr& Next2() const; + + GEOMAlgo_ShapeInfo& Value() const; +//Standard_EXPORT ~GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo(); + + + + + // Type management + // + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +TopoDS_Shape myKey1; +Standard_Integer myKey2; +GEOMAlgo_ShapeInfo myValue; +TCollection_MapNodePtr myNext2; + + +}; + +#define TheKey TopoDS_Shape +#define TheKey_hxx +#define TheItem GEOMAlgo_ShapeInfo +#define TheItem_hxx +#define Hasher TopTools_ShapeMapHasher +#define Hasher_hxx +#define TCollection_IndexedDataMapNode GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo +#define TCollection_IndexedDataMapNode_hxx +#define Handle_TCollection_IndexedDataMapNode Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo +#define TCollection_IndexedDataMapNode_Type_() GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_Type_() +#define TCollection_IndexedDataMap GEOMAlgo_IndexedDataMapOfShapeShapeInfo +#define TCollection_IndexedDataMap_hxx + +#include + +#undef TheKey +#undef TheKey_hxx +#undef TheItem +#undef TheItem_hxx +#undef Hasher +#undef Hasher_hxx +#undef TCollection_IndexedDataMapNode +#undef TCollection_IndexedDataMapNode_hxx +#undef Handle_TCollection_IndexedDataMapNode +#undef TCollection_IndexedDataMapNode_Type_ +#undef TCollection_IndexedDataMap +#undef TCollection_IndexedDataMap_hxx + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_0.cxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_0.cxx new file mode 100644 index 000000000..6afae1194 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_0.cxx @@ -0,0 +1,100 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#include + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_ShapeInfo_HeaderFile +#include +#endif +#ifndef _TopTools_ShapeMapHasher_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_IndexedDataMapOfShapeShapeInfo_HeaderFile +#include +#endif +//GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo::~GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo() {} + + + +Standard_EXPORT Handle_Standard_Type& GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo", + sizeof(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo) Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo))) { + _anOtherObject = Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo)((Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo::DynamicType() const +{ + return STANDARD_TYPE(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo) ; +} +//Standard_Boolean GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo::IsKind(const Handle(Standard_Type)& AType) const +//{ +// return (STANDARD_TYPE(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo) == AType || TCollection_MapNode::IsKind(AType)); +//} +//Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo::~Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo() {} +#define TheKey TopoDS_Shape +#define TheKey_hxx +#define TheItem GEOMAlgo_ShapeInfo +#define TheItem_hxx +#define Hasher TopTools_ShapeMapHasher +#define Hasher_hxx +#define TCollection_IndexedDataMapNode GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo +#define TCollection_IndexedDataMapNode_hxx +#define Handle_TCollection_IndexedDataMapNode Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo +#define TCollection_IndexedDataMapNode_Type_() GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_Type_() +#define TCollection_IndexedDataMap GEOMAlgo_IndexedDataMapOfShapeShapeInfo +#define TCollection_IndexedDataMap_hxx +#include + diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx new file mode 100644 index 000000000..ef912354e --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx @@ -0,0 +1,172 @@ +// File generated by CPPExt (Value) +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#ifndef _GEOMAlgo_IndexedDataMapOfShapeShapeInfo_HeaderFile +#define _GEOMAlgo_IndexedDataMapOfShapeShapeInfo_HeaderFile + +#ifndef _TCollection_BasicMap_HeaderFile +#include +#endif +#ifndef _Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_HeaderFile +#include +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class Standard_DomainError; +class Standard_OutOfRange; +class Standard_NoSuchObject; +class TopoDS_Shape; +class GEOMAlgo_ShapeInfo; +class TopTools_ShapeMapHasher; +class GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + + +class GEOMAlgo_IndexedDataMapOfShapeShapeInfo : public TCollection_BasicMap { + +public: + + void* operator new(size_t,void* anAddress) + { + return anAddress; + } + void* operator new(size_t size) + { + return Standard::Allocate(size); + } + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + // Methods PUBLIC + // + + +Standard_EXPORT GEOMAlgo_IndexedDataMapOfShapeShapeInfo(const Standard_Integer NbBuckets = 1); + + +Standard_EXPORT GEOMAlgo_IndexedDataMapOfShapeShapeInfo& Assign(const GEOMAlgo_IndexedDataMapOfShapeShapeInfo& Other) ; + GEOMAlgo_IndexedDataMapOfShapeShapeInfo& operator =(const GEOMAlgo_IndexedDataMapOfShapeShapeInfo& Other) +{ + return Assign(Other); +} + + + +Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; + + +Standard_EXPORT void Clear() ; +~GEOMAlgo_IndexedDataMapOfShapeShapeInfo() +{ + Clear(); +} + + + +Standard_EXPORT Standard_Integer Add(const TopoDS_Shape& K,const GEOMAlgo_ShapeInfo& I) ; + + +Standard_EXPORT void Substitute(const Standard_Integer I,const TopoDS_Shape& K,const GEOMAlgo_ShapeInfo& T) ; + + +Standard_EXPORT void RemoveLast() ; + + +Standard_EXPORT Standard_Boolean Contains(const TopoDS_Shape& K) const; + + +Standard_EXPORT const TopoDS_Shape& FindKey(const Standard_Integer I) const; + + +Standard_EXPORT const GEOMAlgo_ShapeInfo& FindFromIndex(const Standard_Integer I) const; + const GEOMAlgo_ShapeInfo& operator ()(const Standard_Integer I) const +{ + return FindFromIndex(I); +} + + + +Standard_EXPORT GEOMAlgo_ShapeInfo& ChangeFromIndex(const Standard_Integer I) ; + GEOMAlgo_ShapeInfo& operator ()(const Standard_Integer I) +{ + return ChangeFromIndex(I); +} + + + +Standard_EXPORT Standard_Integer FindIndex(const TopoDS_Shape& K) const; + + +Standard_EXPORT const GEOMAlgo_ShapeInfo& FindFromKey(const TopoDS_Shape& K) const; + + +Standard_EXPORT GEOMAlgo_ShapeInfo& ChangeFromKey(const TopoDS_Shape& K) ; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + +Standard_EXPORT GEOMAlgo_IndexedDataMapOfShapeShapeInfo(const GEOMAlgo_IndexedDataMapOfShapeShapeInfo& Other); + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeShapeInfo_0.cxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeShapeInfo_0.cxx new file mode 100644 index 000000000..96604846e --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeShapeInfo_0.cxx @@ -0,0 +1,60 @@ +// File generated by CPPExt (Value) +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#include + +#ifndef _Standard_DomainError_HeaderFile +#include +#endif +#ifndef _Standard_OutOfRange_HeaderFile +#include +#endif +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_ShapeInfo_HeaderFile +#include +#endif +#ifndef _TopTools_ShapeMapHasher_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_HeaderFile +#include +#endif + + +#define TheKey TopoDS_Shape +#define TheKey_hxx +#define TheItem GEOMAlgo_ShapeInfo +#define TheItem_hxx +#define Hasher TopTools_ShapeMapHasher +#define Hasher_hxx +#define TCollection_IndexedDataMapNode GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo +#define TCollection_IndexedDataMapNode_hxx +#define Handle_TCollection_IndexedDataMapNode Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo +#define TCollection_IndexedDataMapNode_Type_() GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_Type_() +#define TCollection_IndexedDataMap GEOMAlgo_IndexedDataMapOfShapeShapeInfo +#define TCollection_IndexedDataMap_hxx +#include + diff --git a/src/GEOMAlgo/GEOMAlgo_KindOfBounds.hxx b/src/GEOMAlgo/GEOMAlgo_KindOfBounds.hxx new file mode 100644 index 000000000..ba0043ebb --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_KindOfBounds.hxx @@ -0,0 +1,37 @@ +// File generated by CPPExt (Enum) +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#ifndef _GEOMAlgo_KindOfBounds_HeaderFile +#define _GEOMAlgo_KindOfBounds_HeaderFile + + +enum GEOMAlgo_KindOfBounds { + GEOMAlgo_KB_UNKNOWN, +GEOMAlgo_KB_TRIMMED, +GEOMAlgo_KB_INFINITE +}; + + +#ifndef _Standard_PrimitiveTypes_HeaderFile +#include +#endif + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_KindOfClosed.hxx b/src/GEOMAlgo/GEOMAlgo_KindOfClosed.hxx new file mode 100644 index 000000000..9854aed36 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_KindOfClosed.hxx @@ -0,0 +1,37 @@ +// File generated by CPPExt (Enum) +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#ifndef _GEOMAlgo_KindOfClosed_HeaderFile +#define _GEOMAlgo_KindOfClosed_HeaderFile + + +enum GEOMAlgo_KindOfClosed { + GEOMAlgo_KC_UNKNOWN, +GEOMAlgo_KC_CLOSED, +GEOMAlgo_KC_NOTCLOSED +}; + + +#ifndef _Standard_PrimitiveTypes_HeaderFile +#include +#endif + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_KindOfName.hxx b/src/GEOMAlgo/GEOMAlgo_KindOfName.hxx new file mode 100644 index 000000000..74c83eb78 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_KindOfName.hxx @@ -0,0 +1,54 @@ +// File generated by CPPExt (Enum) +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#ifndef _GEOMAlgo_KindOfName_HeaderFile +#define _GEOMAlgo_KindOfName_HeaderFile + + +enum GEOMAlgo_KindOfName { + GEOMAlgo_KN_UNKNOWN, +GEOMAlgo_KN_SPHERE, +GEOMAlgo_KN_CYLINDER, +GEOMAlgo_KN_TORUS, +GEOMAlgo_KN_CONE, +GEOMAlgo_KN_ELLIPSE, +GEOMAlgo_KN_CIRCLE, +GEOMAlgo_KN_PLANE, +GEOMAlgo_KN_LINE, +GEOMAlgo_KN_BOX, +GEOMAlgo_KN_SEGMENT, +GEOMAlgo_KN_ARCCIRCLE, +GEOMAlgo_KN_POLYGON, +GEOMAlgo_KN_POLYHEDRON, +GEOMAlgo_KN_DISKCIRCLE, +GEOMAlgo_KN_DISKELLIPSE, +GEOMAlgo_KN_RECTANGLE, +GEOMAlgo_KN_TRIANGLE, +GEOMAlgo_KN_QUADRANGLE, +GEOMAlgo_KN_ARCELLIPSE +}; + + +#ifndef _Standard_PrimitiveTypes_HeaderFile +#include +#endif + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_KindOfShape.hxx b/src/GEOMAlgo/GEOMAlgo_KindOfShape.hxx new file mode 100644 index 000000000..1b5ead9f9 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_KindOfShape.hxx @@ -0,0 +1,45 @@ +// File generated by CPPExt (Enum) +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#ifndef _GEOMAlgo_KindOfShape_HeaderFile +#define _GEOMAlgo_KindOfShape_HeaderFile + + +enum GEOMAlgo_KindOfShape { + GEOMAlgo_KS_UNKNOWN, +GEOMAlgo_KS_SPHERE, +GEOMAlgo_KS_CYLINDER, +GEOMAlgo_KS_BOX, +GEOMAlgo_KS_TORUS, +GEOMAlgo_KS_CONE, +GEOMAlgo_KS_ELLIPSE, +GEOMAlgo_KS_PLANE, +GEOMAlgo_KS_CIRCLE, +GEOMAlgo_KS_LINE, +GEOMAlgo_KS_DEGENERATED +}; + + +#ifndef _Standard_PrimitiveTypes_HeaderFile +#include +#endif + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeInfo.cdl b/src/GEOMAlgo/GEOMAlgo_ShapeInfo.cdl new file mode 100644 index 000000000..625638b67 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ShapeInfo.cdl @@ -0,0 +1,190 @@ +-- File: GEOMAlgo_ShapeInfo.cdl +-- Created: Mon Apr 2 14:04:24 2007 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2007 + + +class ShapeInfo from GEOMAlgo + + ---Purpose: + +uses + Pnt from gp, + Dir from gp, + Ax2 from gp, + Ax3 from gp, + + ShapeEnum from TopAbs, + Shape from TopoDS, + + KindOfShape from GEOMAlgo, + KindOfBounds from GEOMAlgo, + KindOfClosed from GEOMAlgo, + KindOfName from GEOMAlgo +--raises + +is + Create + returns ShapeInfo from GEOMAlgo; + ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_ShapeInfo();" + + Reset(me:out); + + SetType(me:out; + aType:ShapeEnum from TopAbs); + + Type(me) + returns ShapeEnum from TopAbs; + + SetNbSubShapes(me:out; + aType:ShapeEnum from TopAbs; + aNb :Integer from Standard); + + NbSubShapes(me; + aType:ShapeEnum from TopAbs) + returns Integer from Standard; + + SetKindOfShape (me:out; + aT:KindOfShape from GEOMAlgo); + + KindOfShape (me) + returns KindOfShape from GEOMAlgo; + + SetKindOfName (me:out; + aT: KindOfName from GEOMAlgo); + + KindOfName(me) + returns KindOfName from GEOMAlgo; + + SetKindOfBounds (me:out; + aT:KindOfBounds from GEOMAlgo); + + KindOfBounds (me) + returns KindOfBounds from GEOMAlgo; + + SetKindOfClosed (me:out; + aT:KindOfClosed from GEOMAlgo); + + KindOfClosed(me) + returns KindOfClosed from GEOMAlgo; + + SetLocation (me:out; + aP: Pnt from gp); + + Location (me) + returns Pnt from gp; + ---C++: return const& + + SetDirection (me:out; + aD:Dir from gp); + + Direction (me) + returns Dir from gp; + ---C++: return const& + + SetPosition (me:out; + aAx2 : Ax2 from gp); + + SetPosition (me:out; + aAx3 : Ax3 from gp); + + Position (me) + returns Ax3 from gp; + ---C++: return const& + + SetPnt1 (me:out; + aP: Pnt from gp); + + Pnt1 (me) + returns Pnt from gp; + ---C++: return const& + + SetPnt2 (me:out; + aP: Pnt from gp); + + Pnt2 (me) + returns Pnt from gp; + ---C++: return const& + + SetRadius1 (me:out; + aR: Real from Standard); + + Radius1(me) + returns Real from Standard; + + SetRadius2 (me:out; + aR: Real from Standard); + + Radius2(me) + returns Real from Standard; + + SetLength(me:out; + aL: Real from Standard); + + Length(me) + returns Real from Standard; + + SetWidth(me:out; + aW: Real from Standard); + + Width(me) + returns Real from Standard; + + SetHeight(me:out; + aH: Real from Standard); + + Height(me) + returns Real from Standard; + -- + -- Dump + -- + Dump(me); + + DumpVertex(me) + is protected; + + DumpEdge(me) + is protected; + + DumpWire(me) + is protected; + + DumpFace(me) + is protected; + + DumpShell(me) + is protected; + + DumpSolid(me) + is protected; + + DumpCompSolid(me) + is protected; + + DumpCompound(me) + is protected; + +fields + myType : ShapeEnum from TopAbs is protected; + myNbSubShapes : Integer from Standard[9] is protected; + myKindOfShape : KindOfShape from GEOMAlgo is protected; + myKindOfName : KindOfName from GEOMAlgo is protected; + myKindOfBounds : KindOfBounds from GEOMAlgo is protected; + myKindOfClosed : KindOfClosed from GEOMAlgo is protected; + -- + myLocation : Pnt from gp is protected; + myDirection : Dir from gp is protected; + myPosition : Ax3 from gp is protected; + -- + myRadius1 : Real from Standard is protected; + myRadius2 : Real from Standard is protected; + myLength : Real from Standard is protected; + myWidth : Real from Standard is protected; + myHeight : Real from Standard is protected; + -- + myPnt1 : Pnt from gp is protected; + myPnt2 : Pnt from gp is protected; + -- + myNbTypes : Integer from Standard is protected; +end ShapeInfo; diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeInfo.cxx b/src/GEOMAlgo/GEOMAlgo_ShapeInfo.cxx new file mode 100644 index 000000000..c12606236 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ShapeInfo.cxx @@ -0,0 +1,871 @@ +#include + + +static + Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType); +static + void DumpKindOfShape(const GEOMAlgo_KindOfShape aKS); +static + void DumpKindOfClosed(const GEOMAlgo_KindOfClosed aKC); +static + void DumpKindOfBounds(const GEOMAlgo_KindOfBounds aKB); +static + void DumpKindOfName(const GEOMAlgo_KindOfName aKS); +static + void DumpPosition(const gp_Ax3& aAx3); +static + void DumpLocation(const gp_Pnt& aP); +static + void DumpDirection(const gp_Dir& aD); +//======================================================================= +//function : +//purpose : +//======================================================================= + GEOMAlgo_ShapeInfo::GEOMAlgo_ShapeInfo() +{ + Reset(); +} +//======================================================================= +//function : ~ +//purpose : +//======================================================================= + GEOMAlgo_ShapeInfo::~GEOMAlgo_ShapeInfo() +{ +} +//======================================================================= +//function : Reset +//purpose : +//======================================================================= + void GEOMAlgo_ShapeInfo::Reset() +{ + Standard_Integer i; + // + myType=TopAbs_SHAPE; + // + myNbTypes=9; + for (i=0; i=0 && iN=0 && iN +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_KindOfShape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_KindOfName_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_KindOfBounds_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_KindOfClosed_HeaderFile +#include +#endif +#ifndef _gp_Pnt_HeaderFile +#include +#endif +#ifndef _gp_Dir_HeaderFile +#include +#endif +#ifndef _gp_Ax3_HeaderFile +#include +#endif +#ifndef _Standard_Real_HeaderFile +#include +#endif +class gp_Pnt; +class gp_Dir; +class gp_Ax2; +class gp_Ax3; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + + +class GEOMAlgo_ShapeInfo { + +public: + + void* operator new(size_t,void* anAddress) + { + return anAddress; + } + void* operator new(size_t size) + { + return Standard::Allocate(size); + } + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + // Methods PUBLIC + // + + +Standard_EXPORT GEOMAlgo_ShapeInfo(); +Standard_EXPORT virtual ~GEOMAlgo_ShapeInfo(); + + +Standard_EXPORT void Reset() ; + + +Standard_EXPORT void SetType(const TopAbs_ShapeEnum aType) ; + + +Standard_EXPORT TopAbs_ShapeEnum Type() const; + + +Standard_EXPORT void SetNbSubShapes(const TopAbs_ShapeEnum aType,const Standard_Integer aNb) ; + + +Standard_EXPORT Standard_Integer NbSubShapes(const TopAbs_ShapeEnum aType) const; + + +Standard_EXPORT void SetKindOfShape(const GEOMAlgo_KindOfShape aT) ; + + +Standard_EXPORT GEOMAlgo_KindOfShape KindOfShape() const; + + +Standard_EXPORT void SetKindOfName(const GEOMAlgo_KindOfName aT) ; + + +Standard_EXPORT GEOMAlgo_KindOfName KindOfName() const; + + +Standard_EXPORT void SetKindOfBounds(const GEOMAlgo_KindOfBounds aT) ; + + +Standard_EXPORT GEOMAlgo_KindOfBounds KindOfBounds() const; + + +Standard_EXPORT void SetKindOfClosed(const GEOMAlgo_KindOfClosed aT) ; + + +Standard_EXPORT GEOMAlgo_KindOfClosed KindOfClosed() const; + + +Standard_EXPORT void SetLocation(const gp_Pnt& aP) ; + + +Standard_EXPORT const gp_Pnt& Location() const; + + +Standard_EXPORT void SetDirection(const gp_Dir& aD) ; + + +Standard_EXPORT const gp_Dir& Direction() const; + + +Standard_EXPORT void SetPosition(const gp_Ax2& aAx2) ; + + +Standard_EXPORT void SetPosition(const gp_Ax3& aAx3) ; + + +Standard_EXPORT const gp_Ax3& Position() const; + + +Standard_EXPORT void SetPnt1(const gp_Pnt& aP) ; + + +Standard_EXPORT const gp_Pnt& Pnt1() const; + + +Standard_EXPORT void SetPnt2(const gp_Pnt& aP) ; + + +Standard_EXPORT const gp_Pnt& Pnt2() const; + + +Standard_EXPORT void SetRadius1(const Standard_Real aR) ; + + +Standard_EXPORT Standard_Real Radius1() const; + + +Standard_EXPORT void SetRadius2(const Standard_Real aR) ; + + +Standard_EXPORT Standard_Real Radius2() const; + + +Standard_EXPORT void SetLength(const Standard_Real aL) ; + + +Standard_EXPORT Standard_Real Length() const; + + +Standard_EXPORT void SetWidth(const Standard_Real aW) ; + + +Standard_EXPORT Standard_Real Width() const; + + +Standard_EXPORT void SetHeight(const Standard_Real aH) ; + + +Standard_EXPORT Standard_Real Height() const; + + +Standard_EXPORT void Dump() const; + + + + + +protected: + + // Methods PROTECTED + // + + +Standard_EXPORT void DumpVertex() const; + + +Standard_EXPORT void DumpEdge() const; + + +Standard_EXPORT void DumpWire() const; + + +Standard_EXPORT void DumpFace() const; + + +Standard_EXPORT void DumpShell() const; + + +Standard_EXPORT void DumpSolid() const; + + +Standard_EXPORT void DumpCompSolid() const; + + +Standard_EXPORT void DumpCompound() const; + + + // Fields PROTECTED + // +TopAbs_ShapeEnum myType; +Standard_Integer myNbSubShapes[9]; +GEOMAlgo_KindOfShape myKindOfShape; +GEOMAlgo_KindOfName myKindOfName; +GEOMAlgo_KindOfBounds myKindOfBounds; +GEOMAlgo_KindOfClosed myKindOfClosed; +gp_Pnt myLocation; +gp_Dir myDirection; +gp_Ax3 myPosition; +Standard_Real myRadius1; +Standard_Real myRadius2; +Standard_Real myLength; +Standard_Real myWidth; +Standard_Real myHeight; +gp_Pnt myPnt1; +gp_Pnt myPnt2; +Standard_Integer myNbTypes; + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeInfo.ixx b/src/GEOMAlgo/GEOMAlgo_ShapeInfo.ixx new file mode 100644 index 000000000..4d87536e8 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ShapeInfo.ixx @@ -0,0 +1,26 @@ +// File generated by CPPExt (Value) +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#include + + + + diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeInfo.jxx b/src/GEOMAlgo/GEOMAlgo_ShapeInfo.jxx new file mode 100644 index 000000000..493c1c8a7 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ShapeInfo.jxx @@ -0,0 +1,15 @@ +#ifndef _gp_Pnt_HeaderFile +#include +#endif +#ifndef _gp_Dir_HeaderFile +#include +#endif +#ifndef _gp_Ax2_HeaderFile +#include +#endif +#ifndef _gp_Ax3_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_ShapeInfo_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.cdl b/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.cdl new file mode 100644 index 000000000..599a77d85 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.cdl @@ -0,0 +1,132 @@ +-- File: GEOMAlgo_ShapeInfoFiller.cdl +-- Created: Mon Apr 2 15:05:34 2007 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2007 + + +class ShapeInfoFiller from GEOMAlgo + inherits Algo from GEOMAlgo + + ---Purpose: + +uses + Pln from gp, + Sphere from gp, + Cylinder from gp, + Cone from gp, + Torus from gp, + + Shape from TopoDS, + Face from TopoDS, + Solid from TopoDS, + + ShapeInfo from GEOMAlgo, + KindOfName from GEOMAlgo, + IndexedDataMapOfShapeShapeInfo from GEOMAlgo + +--raises + +is + + Create + returns ShapeInfoFiller from GEOMAlgo; + ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_ShapeInfoFiller();" + + SetShape(me:out; + aS:Shape from TopoDS); + + Shape(me) + returns Shape from TopoDS; + ---C++:return const & + + SetTolerance(me:out; + aT:Real from Standard); + + Tolerance(me) + returns Real from Standard; + + Info(me) + returns ShapeInfo from GEOMAlgo; + ---C++:return const & + + Info(me; + aS:Shape from TopoDS) + returns ShapeInfo from GEOMAlgo; + ---C++:return const & + + Perform(me:out) + is redefined; + + CheckData(me:out) + is redefined protected; + + FillNbSubShapes(me:out; + aS:Shape from TopoDS; + aInfo: out ShapeInfo from GEOMAlgo) + is protected; + + FillSubShapes(me:out; + aS:Shape from TopoDS) + is protected; + + FillShape(me:out; + aS:Shape from TopoDS) + is protected; + + FillVertex(me:out; + aS:Shape from TopoDS) + is protected; + + FillEdge(me:out; + aS:Shape from TopoDS) + is protected; + + FillFace(me:out; + aS:Shape from TopoDS) + is protected; + + FillSolid(me:out; + aS:Shape from TopoDS) + is protected; + + FillContainer(me:out; + aS:Shape from TopoDS) + is protected; + + + FillDetails(me:out; + aF:Face from TopoDS; + aPln:Pln from gp) + is protected; + + FillDetails(me:out; + aF:Face from TopoDS; + aSph:Sphere from gp) + is protected; + + FillDetails(me:out; + aF:Face from TopoDS; + aCyl:Cylinder from gp) + is protected; + + FillDetails(me:out; + aF:Face from TopoDS; + aCone:Cone from gp) + is protected; + + FillDetails(me:out; + aF:Face from TopoDS; + aTorus:Torus from gp) + is protected; + + FillDetails(me:out; + aS:Solid from TopoDS) + is protected; + +fields + myShape : Shape from TopoDS is protected; + myEmptyInfo : ShapeInfo from GEOMAlgo is protected; + myMapInfo : IndexedDataMapOfShapeShapeInfo from GEOMAlgo is protected; + myTolerance : Real from Standard is protected; +end ShapeInfoFiller; diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.cxx b/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.cxx new file mode 100644 index 000000000..0e53aa6e4 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.cxx @@ -0,0 +1,792 @@ +#include + +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + + +static + Standard_Boolean IsAllowedType(const GeomAbs_CurveType aCT); +static + Standard_Boolean IsAllowedType(const GeomAbs_SurfaceType aST); +static + Standard_Integer NbWires(const TopoDS_Face& aF); +static + Standard_Integer NbShells(const TopoDS_Solid& aS); + +//======================================================================= +//function : +//purpose : +//======================================================================= + GEOMAlgo_ShapeInfoFiller::GEOMAlgo_ShapeInfoFiller() +: + GEOMAlgo_Algo() +{ + myTolerance=0.0001; +} +//======================================================================= +//function : ~ +//purpose : +//======================================================================= + GEOMAlgo_ShapeInfoFiller::~GEOMAlgo_ShapeInfoFiller() +{ +} +//======================================================================= +//function : SetTolerance +//purpose : +//======================================================================= + void GEOMAlgo_ShapeInfoFiller::SetTolerance(const Standard_Real aT) +{ + myTolerance=aT; +} +//======================================================================= +//function : Tolerance +//purpose : +//======================================================================= + Standard_Real GEOMAlgo_ShapeInfoFiller::Tolerance()const +{ + return myTolerance; +} +//======================================================================= +//function : SetShape +//purpose : +//======================================================================= + void GEOMAlgo_ShapeInfoFiller::SetShape(const TopoDS_Shape& aS) +{ + myShape=aS; +} +//======================================================================= +//function : Shape +//purpose : +//======================================================================= + const TopoDS_Shape& GEOMAlgo_ShapeInfoFiller::Shape() const +{ + return myShape; +} +//======================================================================= +//function : Info +//purpose : +//======================================================================= + const GEOMAlgo_ShapeInfo& GEOMAlgo_ShapeInfoFiller::Info() const +{ + return Info(myShape); +} +//======================================================================= +//function : Info +//purpose : +//======================================================================= + const GEOMAlgo_ShapeInfo& GEOMAlgo_ShapeInfoFiller::Info(const TopoDS_Shape& aS) const +{ + if (!aS.IsNull()) { + if (myMapInfo.Contains(aS)) { + const GEOMAlgo_ShapeInfo& aInfo=myMapInfo.FindFromKey(aS); + return aInfo; + } + } + return myEmptyInfo; +} + +//======================================================================= +//function : CheckData +//purpose : +//======================================================================= + void GEOMAlgo_ShapeInfoFiller::CheckData() +{ + myErrorStatus=0; + // + if (myShape.IsNull()) { + myErrorStatus=10; + return; + } +} +//======================================================================= +//function : Perform +//purpose : +//======================================================================= + void GEOMAlgo_ShapeInfoFiller::Perform() +{ + myErrorStatus=0; + // + myMapInfo.Clear(); + // + CheckData(); + if (myErrorStatus) { + return; + } + // + FillShape(myShape); +} +//======================================================================= +//function :FillShape +//purpose : +//======================================================================= + void GEOMAlgo_ShapeInfoFiller::FillShape(const TopoDS_Shape& aS) +{ + TopAbs_ShapeEnum aType; + // + aType=aS.ShapeType(); + switch(aType) { + // + case TopAbs_VERTEX: + FillVertex(aS); + break; + // + case TopAbs_EDGE: + FillEdge(aS); + break; + // + case TopAbs_FACE: + FillFace(aS); + break; + // + case TopAbs_SOLID: + FillSolid(aS); + break; + // + case TopAbs_WIRE: + case TopAbs_SHELL: + case TopAbs_COMPSOLID: + case TopAbs_COMPOUND: + FillContainer(aS); + break; + // + default: + break; + } +} +//======================================================================= +//function :FillSubShapes +//purpose : +//======================================================================= + void GEOMAlgo_ShapeInfoFiller::FillSubShapes(const TopoDS_Shape& aS) +{ + TopoDS_Iterator aIt; + // + aIt.Initialize(aS); + for (; aIt.More(); aIt.Next()){ + const TopoDS_Shape& aSx=aIt.Value(); + FillShape(aSx); + } +} +//======================================================================= +//function : FillContainer +//purpose : +//======================================================================= + void GEOMAlgo_ShapeInfoFiller::FillContainer(const TopoDS_Shape& aS) +{ + myErrorStatus=0; + // + Standard_Boolean bIsClosed; + TopAbs_ShapeEnum aType; + GEOMAlgo_KindOfClosed aKC; + // + aType=aS.ShapeType(); + //---------------------------------------------------- + if (myMapInfo.Contains(aS)) { + return; + } + else { + GEOMAlgo_ShapeInfo aInfoX; + myMapInfo.Add(aS, aInfoX); + } + GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aS); + //---------------------------------------------------- + aInfo.SetType(aType); + FillNbSubShapes(aS, aInfo); + // + if (aType==TopAbs_SHELL) { + bIsClosed=BRep_Tool::IsClosed(aS); + aKC=(bIsClosed) ? GEOMAlgo_KC_CLOSED :GEOMAlgo_KC_NOTCLOSED; + aInfo.SetKindOfClosed(aKC); + } + else if (aType==TopAbs_WIRE) { + TopoDS_Wire aW; + TopoDS_Vertex aV1, aV2; + // + aW=TopoDS::Wire(aS); + TopExp::Vertices(aW, aV1, aV2); + // + bIsClosed=aV1.IsSame(aV2); + aKC=(bIsClosed) ? GEOMAlgo_KC_CLOSED :GEOMAlgo_KC_NOTCLOSED; + aInfo.SetKindOfClosed(aKC); + } + // + FillSubShapes(aS); +} +//======================================================================= +//function : FillSolid +//purpose : +//======================================================================= + void GEOMAlgo_ShapeInfoFiller::FillSolid(const TopoDS_Shape& aS) +{ + Standard_Integer aNbShells; + TopoDS_Solid aSd; + // + myErrorStatus=0; + //---------------------------------------------------- + if (myMapInfo.Contains(aS)) { + return; + } + else { + GEOMAlgo_ShapeInfo aInfoX; + myMapInfo.Add(aS, aInfoX); + } + GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aS); + //---------------------------------------------------- + aInfo.SetType(TopAbs_SOLID); + FillNbSubShapes(aS, aInfo); + FillSubShapes(aS); + // + aSd=TopoDS::Solid(aS); + // + aNbShells=NbShells(aSd); + if (aNbShells>1) { + return; + } + // + FillDetails(aSd); +} +//======================================================================= +//function :FillFace +//purpose : +//======================================================================= + void GEOMAlgo_ShapeInfoFiller::FillFace(const TopoDS_Shape& aS) +{ + myErrorStatus=0; + // + Standard_Boolean bIsAllowedType; + Standard_Integer aNbWires;//, iRet + Standard_Boolean bInf, bInfU1, bInfU2, bInfV1, bInfV2; + Standard_Real aUMin, aUMax, aVMin, aVMax, aR1, aR2; + gp_Pnt aP0; + gp_Dir aDN; + gp_Ax3 aAx3; + GeomAbs_SurfaceType aST; + Handle(Geom_Surface) aSurf; + TopoDS_Face aF; + //GEOMAlgo_KindOfName aKindOfName; + //---------------------------------------------------- + if (myMapInfo.Contains(aS)) { + return; + } + else { + GEOMAlgo_ShapeInfo aInfoX; + myMapInfo.Add(aS, aInfoX); + } + GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aS); + //---------------------------------------------------- + aInfo.SetType(TopAbs_FACE); + // + FillNbSubShapes(aS, aInfo); + // + FillSubShapes(aS); + // + aF=TopoDS::Face(aS); + // + aNbWires=NbWires(aF); + if (aNbWires>1) { + return; + } + // + aSurf=BRep_Tool::Surface(aF); + GeomAdaptor_Surface aGAS(aSurf); + aST=aGAS.GetType(); + bIsAllowedType=IsAllowedType(aST); + if (!bIsAllowedType) { + return; + } + // + // 1. Plane + if (aST==GeomAbs_Plane) { + gp_Pln aPln; + // + aPln=aGAS.Plane(); + aP0=aPln.Location(); + aAx3=aPln.Position(); + // + aInfo.SetKindOfShape(GEOMAlgo_KS_PLANE); + aInfo.SetKindOfClosed(GEOMAlgo_KC_NOTCLOSED); + aInfo.SetLocation(aP0); + aInfo.SetPosition(aAx3); + // + //aSurf->Bounds(aUMin, aUMax, aVMin, aVMax); + BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax); + bInfU1=Precision::IsNegativeInfinite(aUMin); + bInfU2=Precision::IsPositiveInfinite(aUMax); + bInfV1=Precision::IsNegativeInfinite(aVMin); + bInfV2=Precision::IsPositiveInfinite(aVMax); + // + bInf=(bInfU1 || bInfU2 || bInfV1 || bInfV2); + if (bInf) { + aInfo.SetKindOfBounds(GEOMAlgo_KB_INFINITE); + } + else { + aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED); + } + // + FillDetails(aF, aPln); + }// if (aCT==GeomAbs_Line) { + // + // 2. Sphere + else if (aST==GeomAbs_Sphere) { + gp_Sphere aSphere; + // + aSphere=aGAS.Sphere(); + aP0=aSphere.Location(); + aAx3=aSphere.Position(); + aR1=aSphere.Radius(); + // + aInfo.SetKindOfShape(GEOMAlgo_KS_SPHERE); + aInfo.SetLocation(aP0); + aInfo.SetPosition(aAx3); + aInfo.SetRadius1(aR1); + // + aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED); + aInfo.SetKindOfClosed(GEOMAlgo_KC_CLOSED); + // + FillDetails(aF, aSphere); + }// else if (aST==GeomAbs_Sphere) { + // + // 3. Cylinder + else if (aST==GeomAbs_Cylinder) { + gp_Cylinder aCyl; + // + aCyl=aGAS.Cylinder(); + aP0=aCyl.Location(); + aAx3=aCyl.Position(); + aR1=aCyl.Radius(); + // + aInfo.SetKindOfShape(GEOMAlgo_KS_CYLINDER); + aInfo.SetLocation(aP0); + aInfo.SetPosition(aAx3); + aInfo.SetRadius1(aR1); + // + BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax); + bInfU1=Precision::IsNegativeInfinite(aUMin); + bInfU2=Precision::IsPositiveInfinite(aUMax); + bInfV1=Precision::IsNegativeInfinite(aVMin); + bInfV2=Precision::IsPositiveInfinite(aVMax); + // + bInf=(bInfU1 || bInfU2 || bInfV1 || bInfV2); + if (bInf) { + aInfo.SetKindOfBounds(GEOMAlgo_KB_INFINITE); + } + else { + aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED); + } + FillDetails(aF, aCyl); + } + // + // 4. Cone + else if (aST==GeomAbs_Cone) { + gp_Cone aCone; + // + aCone=aGAS.Cone(); + aP0=aCone.Location(); + aAx3=aCone.Position(); + //aR1=aCyl.Radius(); + // + aInfo.SetKindOfShape(GEOMAlgo_KS_CONE); + aInfo.SetLocation(aP0); + aInfo.SetPosition(aAx3); + //aInfo.SetRadius1(aR1); + // + BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax); + bInfU1=Precision::IsNegativeInfinite(aUMin); + bInfU2=Precision::IsPositiveInfinite(aUMax); + bInfV1=Precision::IsNegativeInfinite(aVMin); + bInfV2=Precision::IsPositiveInfinite(aVMax); + // + bInf=(bInfU1 || bInfU2 || bInfV1 || bInfV2); + if (bInf) { + aInfo.SetKindOfBounds(GEOMAlgo_KB_INFINITE); + } + else { + aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED); + } + FillDetails(aF, aCone); + } + // + // 5. Torus + else if (aST==GeomAbs_Torus) { + gp_Torus aTorus; + // + aTorus=aGAS.Torus(); + aP0=aTorus.Location(); + aAx3=aTorus.Position(); + aR1=aTorus.MajorRadius(); + aR2=aTorus.MinorRadius(); + // + aInfo.SetKindOfShape(GEOMAlgo_KS_TORUS); + aInfo.SetLocation(aP0); + aInfo.SetPosition(aAx3); + aInfo.SetRadius1(aR1); + aInfo.SetRadius2(aR2); + // + aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED); + + FillDetails(aF, aTorus); + } +} +//======================================================================= +//function :FillEdge +//purpose : +//======================================================================= + void GEOMAlgo_ShapeInfoFiller::FillEdge(const TopoDS_Shape& aS) +{ + myErrorStatus=0; + // + Standard_Boolean bDegenerated, bIsAllowedType; + Standard_Integer aNbV; + Standard_Real aR1, aR2; + gp_Pnt aP, aP1, aP2, aPc; + gp_Dir aD; + gp_Ax2 aAx2; + Standard_Real aT1, aT2; + GeomAbs_CurveType aCT; + Handle(Geom_Curve) aC3D; + TopoDS_Edge aE; + //---------------------------------------------------- + if (myMapInfo.Contains(aS)) { + return; + } + else { + GEOMAlgo_ShapeInfo aInfoX; + myMapInfo.Add(aS, aInfoX); + } + GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aS); + //---------------------------------------------------- + aInfo.SetType(TopAbs_EDGE); + // + FillNbSubShapes(aS, aInfo); + // + aE=TopoDS::Edge(aS); + // + bDegenerated=BRep_Tool::Degenerated(aE); + if (bDegenerated) { + aInfo.SetKindOfShape(GEOMAlgo_KS_DEGENERATED); + FillSubShapes(aS); + return; + } + // + aC3D=BRep_Tool::Curve(aE, aT1, aT2); + GeomAdaptor_Curve aGAC(aC3D); + aCT=aGAC.GetType(); + bIsAllowedType=IsAllowedType(aCT); + if (!bIsAllowedType) { + FillSubShapes(aS); + return; + } + // Line + if (aCT==GeomAbs_Line) { + Standard_Boolean bInf1, bInf2; + Standard_Real aLength; + gp_Lin aLin; + gp_XYZ aXYZ1, aXYZ2, aXYZc; + // + aLin=aGAC.Line(); + aP=aLin.Location(); + aD=aLin.Direction(); + // + aInfo.SetKindOfShape(GEOMAlgo_KS_LINE); + aInfo.SetKindOfClosed(GEOMAlgo_KC_NOTCLOSED); + aInfo.SetLocation(aP); + aInfo.SetDirection(aD); + // + bInf1=Precision::IsNegativeInfinite(aT1); + bInf2=Precision::IsPositiveInfinite(aT2); + if (bInf1||bInf2) { + aInfo.SetKindOfBounds(GEOMAlgo_KB_INFINITE); + aInfo.SetKindOfName(GEOMAlgo_KN_LINE); + } + else { + aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED); + aInfo.SetKindOfName(GEOMAlgo_KN_SEGMENT); + aGAC.D0(aT1, aP1); + aGAC.D0(aT2, aP2); + aInfo.SetPnt1(aP1); + aInfo.SetPnt2(aP2); + // + aLength=aP1.Distance(aP2); + aXYZ1=aP1.XYZ(); + aXYZ2=aP2.XYZ(); + aXYZc=aXYZ1+aXYZ2; + aXYZc.Multiply(0.5); + // + aPc.SetXYZ(aXYZc); + gp_Vec aVec(aPc, aP2); + gp_Dir aDir(aVec); + // + aInfo.SetLocation(aPc); + aInfo.SetDirection(aDir); + aInfo.SetLength(aLength); + } + }// if (aCT==GeomAbs_Line) { + // + // Circle + else if (aCT==GeomAbs_Circle) { + gp_Circ aCirc; + // + aCirc=aGAC.Circle(); + aP=aCirc.Location(); + aAx2=aCirc.Position(); + aR1=aCirc.Radius(); + // + aInfo.SetKindOfShape(GEOMAlgo_KS_CIRCLE); + aInfo.SetLocation(aP); + aInfo.SetPosition(aAx2); + aInfo.SetRadius1(aR1); + // + aNbV=aInfo.NbSubShapes(TopAbs_VERTEX); + if (!aNbV) { + myErrorStatus=11; // circle edge without vertices + return; + } + aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED); + aGAC.D0(aT1, aP1); + aGAC.D0(aT2, aP2); + aInfo.SetPnt1(aP1); + aInfo.SetPnt2(aP2); + // + if (aNbV==1) { + aInfo.SetKindOfClosed(GEOMAlgo_KC_CLOSED); + aInfo.SetKindOfName(GEOMAlgo_KN_CIRCLE); + } + else { + aInfo.SetKindOfClosed(GEOMAlgo_KC_NOTCLOSED); + aInfo.SetKindOfName(GEOMAlgo_KN_ARCCIRCLE); + // + gp_Vec aVecX(aP, aP1); + gp_Dir aDirX(aVecX); + gp_Ax2 aAx2new(aP, aAx2.Direction(), aDirX); + aInfo.SetPosition(aAx2new); + } + }// else if (aCT==GeomAbs_Circle) { + // + // Ellipse + else if (aCT==GeomAbs_Ellipse) { + gp_Elips aElips; + // + aElips=aGAC.Ellipse(); + aP=aElips.Location(); + aAx2=aElips.Position(); + aR1=aElips.MajorRadius(); + aR2=aElips.MinorRadius(); + // + aInfo.SetKindOfShape(GEOMAlgo_KS_ELLIPSE); + aInfo.SetLocation(aP); + aInfo.SetPosition(aAx2); + aInfo.SetRadius1(aR1); + aInfo.SetRadius2(aR2); + // + aNbV=aInfo.NbSubShapes(TopAbs_VERTEX); + if (!aNbV) { + myErrorStatus=11; // ellipse edge without vertices + return; + } + aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED); + aGAC.D0(aT1, aP1); + aGAC.D0(aT2, aP2); + aInfo.SetPnt1(aP1); + aInfo.SetPnt2(aP2); + // + if (aNbV==1) { + aInfo.SetKindOfClosed(GEOMAlgo_KC_CLOSED); + aInfo.SetKindOfName(GEOMAlgo_KN_ELLIPSE); + } + else { + aInfo.SetKindOfClosed(GEOMAlgo_KC_NOTCLOSED); + aInfo.SetKindOfName(GEOMAlgo_KN_ARCELLIPSE); + // + gp_Vec aVecX(aP, aP1); + gp_Dir aDirX(aVecX); + gp_Ax2 aAx2new(aP, aAx2.Direction(), aDirX); + aInfo.SetPosition(aAx2new); + } + }// else if (aCT==GeomAbs_Ellipse) { + // + FillSubShapes(aS); +} +//======================================================================= +//function :FillVertex +//purpose : +//======================================================================= + void GEOMAlgo_ShapeInfoFiller::FillVertex(const TopoDS_Shape& aS) +{ + myErrorStatus=0; + // + gp_Pnt aP; + TopoDS_Vertex aV; + // + if (myMapInfo.Contains(aS)) { + return; + } + else { + GEOMAlgo_ShapeInfo aInfoX; + myMapInfo.Add(aS, aInfoX); + } + GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aS); + // + aV=TopoDS::Vertex(aS); + aP=BRep_Tool::Pnt(aV); + // + aInfo.SetType(TopAbs_VERTEX); + aInfo.SetLocation(aP); + myMapInfo.Add(aS, aInfo); +} +//======================================================================= +//function : FillNbSubshapes +//purpose : +//======================================================================= + void GEOMAlgo_ShapeInfoFiller::FillNbSubShapes(const TopoDS_Shape& aS, + GEOMAlgo_ShapeInfo& aInfo) +{ + myErrorStatus=0; + // + Standard_Integer i, aNb, aNbS; + TopTools_IndexedMapOfShape aM; + TopAbs_ShapeEnum aST; + TopAbs_ShapeEnum aTypes[]= { + //TopAbs_FACE, TopAbs_EDGE, TopAbs_VERTEX + TopAbs_COMPOUND, + TopAbs_COMPSOLID, + TopAbs_SOLID, + TopAbs_SHELL, + TopAbs_FACE, + TopAbs_WIRE, + TopAbs_EDGE, + TopAbs_VERTEX + }; + + // + aST=aS.ShapeType(); + aNb=sizeof(aTypes)/sizeof(aTypes[0]); + for (i=0; i +#endif +#ifndef _GEOMAlgo_ShapeInfo_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_IndexedDataMapOfShapeShapeInfo_HeaderFile +#include +#endif +#ifndef _Standard_Real_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_Algo_HeaderFile +#include +#endif +class TopoDS_Shape; +class GEOMAlgo_ShapeInfo; +class TopoDS_Face; +class gp_Pln; +class gp_Sphere; +class gp_Cylinder; +class gp_Cone; +class gp_Torus; +class TopoDS_Solid; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + + +class GEOMAlgo_ShapeInfoFiller : public GEOMAlgo_Algo { + +public: + + void* operator new(size_t,void* anAddress) + { + return anAddress; + } + void* operator new(size_t size) + { + return Standard::Allocate(size); + } + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + // Methods PUBLIC + // + + +Standard_EXPORT GEOMAlgo_ShapeInfoFiller(); +Standard_EXPORT virtual ~GEOMAlgo_ShapeInfoFiller(); + + +Standard_EXPORT void SetShape(const TopoDS_Shape& aS) ; + + +Standard_EXPORT const TopoDS_Shape& Shape() const; + + +Standard_EXPORT void SetTolerance(const Standard_Real aT) ; + + +Standard_EXPORT Standard_Real Tolerance() const; + + +Standard_EXPORT const GEOMAlgo_ShapeInfo& Info() const; + + +Standard_EXPORT const GEOMAlgo_ShapeInfo& Info(const TopoDS_Shape& aS) const; + + +Standard_EXPORT virtual void Perform() ; + + + + + +protected: + + // Methods PROTECTED + // + + +Standard_EXPORT virtual void CheckData() ; + + +Standard_EXPORT void FillNbSubShapes(const TopoDS_Shape& aS,GEOMAlgo_ShapeInfo& aInfo) ; + + +Standard_EXPORT void FillSubShapes(const TopoDS_Shape& aS) ; + + +Standard_EXPORT void FillShape(const TopoDS_Shape& aS) ; + + +Standard_EXPORT void FillVertex(const TopoDS_Shape& aS) ; + + +Standard_EXPORT void FillEdge(const TopoDS_Shape& aS) ; + + +Standard_EXPORT void FillFace(const TopoDS_Shape& aS) ; + + +Standard_EXPORT void FillSolid(const TopoDS_Shape& aS) ; + + +Standard_EXPORT void FillContainer(const TopoDS_Shape& aS) ; + + +Standard_EXPORT void FillDetails(const TopoDS_Face& aF,const gp_Pln& aPln) ; + + +Standard_EXPORT void FillDetails(const TopoDS_Face& aF,const gp_Sphere& aSph) ; + + +Standard_EXPORT void FillDetails(const TopoDS_Face& aF,const gp_Cylinder& aCyl) ; + + +Standard_EXPORT void FillDetails(const TopoDS_Face& aF,const gp_Cone& aCone) ; + + +Standard_EXPORT void FillDetails(const TopoDS_Face& aF,const gp_Torus& aTorus) ; + + +Standard_EXPORT void FillDetails(const TopoDS_Solid& aS) ; + + + // Fields PROTECTED + // +TopoDS_Shape myShape; +GEOMAlgo_ShapeInfo myEmptyInfo; +GEOMAlgo_IndexedDataMapOfShapeShapeInfo myMapInfo; +Standard_Real myTolerance; + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.ixx b/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.ixx new file mode 100644 index 000000000..a56973ba8 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.ixx @@ -0,0 +1,26 @@ +// File generated by CPPExt (Value) +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#include + + + + diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.jxx b/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.jxx new file mode 100644 index 000000000..f3d77a35b --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.jxx @@ -0,0 +1,30 @@ +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_ShapeInfo_HeaderFile +#include +#endif +#ifndef _TopoDS_Face_HeaderFile +#include +#endif +#ifndef _gp_Pln_HeaderFile +#include +#endif +#ifndef _gp_Sphere_HeaderFile +#include +#endif +#ifndef _gp_Cylinder_HeaderFile +#include +#endif +#ifndef _gp_Cone_HeaderFile +#include +#endif +#ifndef _gp_Torus_HeaderFile +#include +#endif +#ifndef _TopoDS_Solid_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_ShapeInfoFiller_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller_1.cxx b/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller_1.cxx new file mode 100644 index 000000000..891b9c772 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller_1.cxx @@ -0,0 +1,738 @@ +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include + +#include +#include +#include + +//======================================================================= +//function : FillDetails +//purpose : +//======================================================================= + void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Solid& aSd) +{ + Standard_Integer i, aNbF, aNbCyl, aNbCon, aNbPgn, aNbRct, aNbCrc, aNbX; + TopoDS_Shape aFCyl, aFCon; + TopTools_IndexedMapOfShape aMF; + GEOMAlgo_KindOfName aKNF; + // + GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aSd); + aInfo.SetKindOfName(GEOMAlgo_KN_UNKNOWN); + // + TopExp::MapShapes(aSd, TopAbs_FACE, aMF); + // + aNbF=aMF.Extent(); + if (!aNbF) { + return; + } + // + if (aNbF==1) { + const TopoDS_Shape& aF=aMF(1); + GEOMAlgo_ShapeInfo& aInfoF=myMapInfo.ChangeFromKey(aF); + aKNF=aInfoF.KindOfName(); // mb: sphere, torus + if (aKNF==GEOMAlgo_KN_SPHERE || + aKNF==GEOMAlgo_KN_TORUS) { + aInfo.SetKindOfName(aKNF); + aInfo.SetLocation(aInfoF.Location()); + aInfo.SetPosition(aInfoF.Position()); + aInfo.SetRadius1(aInfoF.Radius1()); + if(aKNF==GEOMAlgo_KN_TORUS) { + aInfo.SetRadius2(aInfoF.Radius2()); + } + return; + } + } + // + aNbCyl=0; + aNbCon=0; + aNbPgn=0; + aNbRct=0; + aNbCrc=0; + for (i=1; i<=aNbF; ++i) { + const TopoDS_Shape& aF=aMF(i); + GEOMAlgo_ShapeInfo& aInfoF=myMapInfo.ChangeFromKey(aF); + aKNF=aInfoF.KindOfName(); + if (aKNF==GEOMAlgo_KN_CYLINDER) { + aFCyl=aF; + ++aNbCyl; + } + else if (aKNF==GEOMAlgo_KN_CONE) { + aFCon=aF; + ++aNbCon; + } + else if (aKNF==GEOMAlgo_KN_DISKCIRCLE) { + ++aNbCrc; + } + else if (aKNF==GEOMAlgo_KN_POLYGON || + aKNF==GEOMAlgo_KN_TRIANGLE || + aKNF==GEOMAlgo_KN_QUADRANGLE) { + ++aNbPgn; + + } + else if (aKNF==GEOMAlgo_KN_RECTANGLE) { + ++aNbPgn; + ++aNbRct; + } + } + // + aNbX=aNbCyl+aNbCrc; + if (aNbCyl==1 && aNbCrc==2 && aNbX==aNbF) { + // cylinder (as they understand it) + GEOMAlgo_ShapeInfo& aInfoF=myMapInfo.ChangeFromKey(aFCyl); + aKNF=aInfoF.KindOfName(); + aInfo.SetKindOfName(aKNF); + aInfo.SetLocation(aInfoF.Location()); + aInfo.SetPosition(aInfoF.Position()); + aInfo.SetRadius1(aInfoF.Radius1()); + aInfo.SetHeight(aInfoF.Height()); + return; + } + // + aNbX=aNbCon+aNbCrc; + if (aNbCon==1 && (aNbCrc==1 || aNbCrc==2) && aNbX==aNbF) { + // cone + GEOMAlgo_ShapeInfo& aInfoF=myMapInfo.ChangeFromKey(aFCon); + aKNF=aInfoF.KindOfName(); + aInfo.SetKindOfName(aKNF); + aInfo.SetLocation(aInfoF.Location()); + aInfo.SetPosition(aInfoF.Position()); + aInfo.SetRadius1(aInfoF.Radius1()); + aInfo.SetRadius2(aInfoF.Radius2()); + aInfo.SetHeight(aInfoF.Height()); + return; + } + // + if (aNbPgn!=6) { + aInfo.SetKindOfName(GEOMAlgo_KN_POLYHEDRON); + return; + } + if (aNbPgn!=aNbRct) { + aInfo.SetKindOfName(GEOMAlgo_KN_POLYHEDRON); + return; + } + //=================================================== + // aNbRct=6; + // box + Standard_Integer j, aNbFi, aNbV, iMax, iMin, iMid; + Standard_Real aDot, aLength, aWidth, aHeight, aDist[3]; + Standard_Real aDistMin, aDistMax; + gp_Pnt aPi, aPc; + gp_Dir aDir[3]; + gp_XYZ aXYZc; + TColStd_IndexedMapOfInteger aMp; + TopTools_IndexedMapOfShape aMV, aMFi; + // + // barycenter aPc + TopExp::MapShapes(aSd, TopAbs_VERTEX, aMV); + aNbV=aMV.Extent(); + if (aNbV!=8) { + return; + } + // + aXYZc.SetCoord(0.,0.,0.); + for (i=1; i<=aNbV; ++i) { + const TopoDS_Vertex& aVi=TopoDS::Vertex(aMV(i)); + aPi=BRep_Tool::Pnt(aVi); + const gp_XYZ& aXYZ=aPi.XYZ(); + aXYZc=aXYZc+aXYZ; + } + // + aXYZc.Divide(aNbV); + aPc.SetXYZ(aXYZc); + // + // 3 faces + for (i=1; i<=aNbF; ++i) { + if (aMp.Contains(i)) { + continue; + } + // + const TopoDS_Shape& aFi=aMF(i); + const GEOMAlgo_ShapeInfo& aIFi=myMapInfo.FindFromKey(aFi); + const gp_Dir& aDNi=aIFi.Position().Direction(); + // + for (j=i+1; j<=aNbF; ++j) { + if (aMp.Contains(j)) { + continue; + } + // + const TopoDS_Shape& aFj=aMF(j); + const GEOMAlgo_ShapeInfo& aIFj=myMapInfo.FindFromKey(aFj); + const gp_Dir& aDNj=aIFj.Position().Direction(); + // + aDot=aDNi*aDNj; + if (fabs(1.-aDot)<0.0001) { + aMp.Add(i); + aMp.Add(j); + aMFi.Add(aFi); + break; + } + // + } + } + aNbFi=aMFi.Extent(); + if (aNbFi!=3) { + return; + } + // + aDistMin=1.e15; + aDistMax=-aDistMin; + for (i=0; iaDistMax) { + aDistMax=aDist[i]; + iMax=i; + } + if (aDist[i] myTolerance) { + aInfo.SetKindOfName(GEOMAlgo_KN_QUADRANGLE); + return; + } + } + // + // rectangle + aInfo.SetKindOfName(GEOMAlgo_KN_RECTANGLE); + // + // shift location to the center and calc. sizes + aXYZc.SetCoord(0.,0.,0.); + TopExp::MapShapes(aF, TopAbs_VERTEX, aMV); + for (i=1; i<=aNbV; ++i) { + const TopoDS_Vertex& aV=TopoDS::Vertex(aMV(i)); + aP=BRep_Tool::Pnt(aV); + const gp_XYZ& aXYZ=aP.XYZ(); + aXYZc=aXYZc+aXYZ; + } + // + // Location : aPc in center of rectangle + // Position : 0z is plane normal + // 0x is along length + // + aXYZc.Divide(4.); + aPc.SetXYZ(aXYZc); + // + gp_Lin aL0(aPx[0], aDx[0]); + gp_Lin aL1(aPx[1], aDx[1]); + // + aD0=aL0.Distance(aPc); + aD1=aL1.Distance(aPc); + // + aLength=aD0; + aWidth =aD1; + aDX=aL1.Direction(); + if (aD0aR[1]) { + aRmin=aR[1]; + aRmax=aR[0]; + aPc=aPC[0]; + gp_Vec aVz(aPC[0], aPC[1]); + gp_Vec aVx(aPC[0], aPX[0]); + gp_Dir aDz(aVz); + gp_Dir aDx(aVx); + gp_Ax2 aAx2(aPc, aDz, aDx); + aAx2new=aAx2; + } + else { + aRmin=aR[0]; + aRmax=aR[1]; + aPc=aPC[1]; + gp_Vec aVz(aPC[1], aPC[0]); + gp_Vec aVx(aPC[1], aPX[1]); + gp_Dir aDz(aVz); + gp_Dir aDx(aVx); + gp_Ax2 aAx2(aPc, aDz, aDx); + aAx2new=aAx2; + } + // + gp_Ax3 aAx3(aAx2new); + aInfo.SetLocation(aPc); + aInfo.SetPosition(aAx3); + aInfo.SetRadius1(aRmax); + aInfo.SetRadius2(aRmin); + aInfo.SetHeight(aHeight); + // + aInfo.SetKindOfName(GEOMAlgo_KN_CONE); +} +//======================================================================= +//function : FillDetails +//purpose : +//======================================================================= + void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF, + const gp_Cylinder& aCyl) +{ + Standard_Integer i, aNbV, aNbE, aNbCE, aNbSE; + Standard_Real aT0, aT1, aHeight; + gp_Pnt aPC[3], aPc; + TopoDS_Edge aE; + TopExp_Explorer aExp; + TopTools_MapOfShape aM; + GEOMAlgo_KindOfShape aKS; + GEOMAlgo_KindOfName aKN, aKNE; + GEOMAlgo_KindOfClosed aKCE; + // + GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aF); + aKN=GEOMAlgo_KN_UNKNOWN; + aInfo.SetKindOfName(aKN); + // + aKS=aInfo.KindOfShape(); + if (aKS!=GEOMAlgo_KS_CYLINDER) { + return; + } + // + if (aInfo.KindOfBounds()==GEOMAlgo_KB_INFINITE) { + return; + } + // + aNbV=aInfo.NbSubShapes(TopAbs_VERTEX); + aNbE=aInfo.NbSubShapes(TopAbs_EDGE); + if (!(aNbV==2 && aNbE==3)) { + return; + } + // + i=0; + aNbCE=0; + aNbSE=0; + aExp.Init(aF, TopAbs_EDGE); + for (; aExp.More(); aExp.Next()) { + aE=TopoDS::Edge(aExp.Current()); + if(aM.Add(aE)) { + const GEOMAlgo_ShapeInfo& aInfoE=myMapInfo.FindFromKey(aE); + aKNE=aInfoE.KindOfName(); + aKCE=aInfoE.KindOfClosed(); + if (aKNE==GEOMAlgo_KN_CIRCLE && aKCE==GEOMAlgo_KC_CLOSED) { + aPC[aNbCE]=aInfoE.Location(); + ++aNbCE; + } + else if (aKNE==GEOMAlgo_KN_SEGMENT) { + if (BRep_Tool::IsClosed(aE, aF)) { + ++aNbSE; + } + } + } + } + // + if (!(aNbCE==2 && aNbSE==1)) { + return; + } + // + const gp_Ax1& aAx1=aCyl.Axis(); + const gp_Dir& aDir=aAx1.Direction(); + const gp_Pnt& aPLoc=aAx1.Location(); + gp_Lin aLin(aPLoc, aDir); + // + aT0=ElCLib::Parameter(aLin, aPC[0]); + aT1=ElCLib::Parameter(aLin, aPC[1]); + // + aPc=aPC[0];; + if (aT0>aT1) { + aPc=aPC[1]; + } + aHeight=aPC[0].Distance(aPC[1]); + // + gp_Ax3 aAx3=aCyl.Position(); + aAx3.SetLocation(aPc); + // + aInfo.SetKindOfName(GEOMAlgo_KN_CYLINDER); + aInfo.SetPosition(aAx3); + aInfo.SetLocation(aPc); + aInfo.SetHeight(aHeight); +} + +//======================================================================= +//function : FillDetails +//purpose : +//======================================================================= + void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF, + const gp_Torus& ) +{ + Standard_Integer aNbV, aNbE, aNbSE; + TopoDS_Edge aE; + TopExp_Explorer aExp; + TopTools_MapOfShape aM; + GEOMAlgo_KindOfShape aKS; + // + GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aF); + aInfo.SetKindOfName(GEOMAlgo_KN_UNKNOWN); + // + aKS=aInfo.KindOfShape(); + if (aKS!=GEOMAlgo_KS_TORUS) { + return; + } + // + aNbV=aInfo.NbSubShapes(TopAbs_VERTEX); + aNbE=aInfo.NbSubShapes(TopAbs_EDGE); + if (!(aNbV==1 && aNbE==2)) { + return; + } + // + aNbSE=0; + aExp.Init(aF, TopAbs_EDGE); + for (; aExp.More(); aExp.Next()) { + aE=TopoDS::Edge(aExp.Current()); + if (aM.Add(aE)) { + //const GEOMAlgo_ShapeInfo& aInfoE=myMapInfo.FindFromKey(aE); + if (BRep_Tool::IsClosed(aE, aF)) { + ++aNbSE; + } + } + } + // + if (aNbSE!=2) { + return; + } + aInfo.SetKindOfName(GEOMAlgo_KN_TORUS); +} diff --git a/src/GEOMAlgo/GEOMAlgo_WESCorrector.cxx b/src/GEOMAlgo/GEOMAlgo_WESCorrector.cxx index 8cac72b9e..1b5a04035 100755 --- a/src/GEOMAlgo/GEOMAlgo_WESCorrector.cxx +++ b/src/GEOMAlgo/GEOMAlgo_WESCorrector.cxx @@ -115,7 +115,7 @@ static //======================================================================= void GEOMAlgo_WESCorrector::DoConnexityBlocks() { - Standard_Boolean bRegular; + Standard_Boolean bRegular, bClosed; Standard_Integer i, aNbV, j, aNbC, aNbVP, aNbVS; TopTools_ListIteratorOfListOfShape aIt; TopoDS_Iterator aItE; @@ -208,17 +208,17 @@ static aER=aMEC(j); // if (aMER.Contains(aER)) { - Standard_Boolean bClosed; - // aER.Orientation(TopAbs_FORWARD); aLEC.Append(aER); aER.Orientation(TopAbs_REVERSED); aLEC.Append(aER); // - bClosed=BRep_Tool::IsClosed(TopoDS::Edge(aER), myWES->Face()); - if (!bClosed) { + //modified by NIZNHY-PKV Tue Nov 28 12:02:29 2006f + //bClosed=BRep_Tool::IsClosed(TopoDS::Edge(aER), myWES->Face()); + //if (!bClosed) { bRegular=Standard_False; - } + //} + //modified by NIZNHY-PKV Tue Nov 28 12:02:33 2006t } else { aLEC.Append(aER); @@ -234,11 +234,12 @@ static // aNbVR=aMVER.Extent(); for (k=1; k<=aNbVR; ++k) { - const TopTools_ListOfShape& aLER=aMVER(k);//?? it was aMVE(k) + const TopTools_ListOfShape& aLER=aMVER(k); aNbER=aLER.Extent(); if (aNbER==1) { const TopoDS_Edge& aEx=TopoDS::Edge(aER); - if (!BRep_Tool::IsClosed(aEx, myWES->Face())) { + bClosed=BRep_Tool::IsClosed(aEx, myWES->Face()); + if (!bClosed) { bRegular=!bRegular; break; } diff --git a/src/GEOMAlgo/GEOMAlgo_WireSplitter.cxx b/src/GEOMAlgo/GEOMAlgo_WireSplitter.cxx index 3860f82fe..e4671d3a2 100755 --- a/src/GEOMAlgo/GEOMAlgo_WireSplitter.cxx +++ b/src/GEOMAlgo/GEOMAlgo_WireSplitter.cxx @@ -489,14 +489,6 @@ static aTol=2.*Tolerance2D(aVb, aGAS); aTol2=aTol*aTol; // - //modified by NIZNHY-PKV Tue Nov 14 16:56:19 2006f - /* - UVTolerance2D(aVb, aGAS, aTolUVb, aTolVVb); - aTolUVb = 2.*aTolUVb; - aTolVVb = 2.*aTolVVb; - */ - //modified by NIZNHY-PKV Tue Nov 14 16:56:26 2006t - // aNb=aLS.Length(); if (aNb>0) { // @@ -517,20 +509,6 @@ static // aD2=aPaPrev.SquareDistance(aPb); anIsSameV2d =aD2 aTolUVb) || (vdist > aTolVVb)) { - anIsSameV2d=!anIsSameV2d; - } - } - */ - //modified by NIZNHY-PKV Tue Nov 14 16:56:54 2006t }//if (anIsSameV) { // if (anIsSameV && anIsSameV2d) { @@ -685,7 +663,10 @@ static aTol2D=(aVr>anUr) ? aVr : anUr; // if (aType==GeomAbs_BSplineSurface|| - aType==GeomAbs_Sphere) { + aType==GeomAbs_Sphere|| + //modified by NIZNHY-PKV Wed Nov 29 10:18:50 2006f + GeomAbs_SurfaceOfRevolution) { + //modified by NIZNHY-PKV Wed Nov 29 10:18:55 2006t if (aTol2D < aTolV3D) { aTol2D=aTolV3D; } @@ -895,29 +876,3 @@ Standard_Integer NbWaysOut(const BOP_ListOfEdgeInfo& aLEInfo) } return iCnt; } -//modified by NIZNHY-PKV Tue Nov 14 16:55:31 2006f -/* -static - void UVTolerance2D (const TopoDS_Vertex& aV, - const GeomAdaptor_Surface& aGAS, - Standard_Real& aTolU, - Standard_Real& aTolV); -*/ -/* -//======================================================================= -//function : UVTolerance2D -//purpose : -//======================================================================= -void UVTolerance2D (const TopoDS_Vertex& aV, - const GeomAdaptor_Surface& aGAS, - Standard_Real& aTolU, - Standard_Real& aTolV) -{ - Standard_Real aTolV3D; - // - aTolV3D = BRep_Tool::Tolerance(aV); - aTolU=aGAS.UResolution(aTolV3D); - aTolV=aGAS.VResolution(aTolV3D); -} -*/ -//modified by NIZNHY-PKV Tue Nov 14 16:55:39 2006 diff --git a/src/GEOMAlgo/Handle_GEOMAlgo_ClsfSolid.hxx b/src/GEOMAlgo/Handle_GEOMAlgo_ClsfSolid.hxx new file mode 100644 index 000000000..8098ce527 --- /dev/null +++ b/src/GEOMAlgo/Handle_GEOMAlgo_ClsfSolid.hxx @@ -0,0 +1,72 @@ +// 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 + +#ifndef _Handle_GEOMAlgo_ClsfSolid_HeaderFile +#define _Handle_GEOMAlgo_ClsfSolid_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_GEOMAlgo_Clsf_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(GEOMAlgo_Clsf); +class GEOMAlgo_ClsfSolid; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMAlgo_ClsfSolid); + +class Handle(GEOMAlgo_ClsfSolid) : public Handle(GEOMAlgo_Clsf) { + public: + Handle(GEOMAlgo_ClsfSolid)():Handle(GEOMAlgo_Clsf)() {} + Handle(GEOMAlgo_ClsfSolid)(const Handle(GEOMAlgo_ClsfSolid)& aHandle) : Handle(GEOMAlgo_Clsf)(aHandle) + { + } + + Handle(GEOMAlgo_ClsfSolid)(const GEOMAlgo_ClsfSolid* anItem) : Handle(GEOMAlgo_Clsf)((GEOMAlgo_Clsf *)anItem) + { + } + + Handle(GEOMAlgo_ClsfSolid)& operator=(const Handle(GEOMAlgo_ClsfSolid)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMAlgo_ClsfSolid)& operator=(const GEOMAlgo_ClsfSolid* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMAlgo_ClsfSolid* operator->() const + { + return (GEOMAlgo_ClsfSolid *)ControlAccess(); + } + +// Standard_EXPORT ~Handle(GEOMAlgo_ClsfSolid)(); + + Standard_EXPORT static const Handle(GEOMAlgo_ClsfSolid) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/GEOMAlgo/Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape.hxx b/src/GEOMAlgo/Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape.hxx new file mode 100644 index 000000000..8360ec290 --- /dev/null +++ b/src/GEOMAlgo/Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape.hxx @@ -0,0 +1,72 @@ +// 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 + +#ifndef _Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_HeaderFile +#define _Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_TCollection_MapNode_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TCollection_MapNode); +class GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape); + +class Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape) : public Handle(TCollection_MapNode) { + public: + Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape)():Handle(TCollection_MapNode)() {} + Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape)(const Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape)& aHandle) : Handle(TCollection_MapNode)(aHandle) + { + } + + Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape)(const GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) + { + } + + Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape)& operator=(const Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape)& operator=(const GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape* operator->() const + { + return (GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape *)ControlAccess(); + } + +// Standard_EXPORT ~Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape)(); + + Standard_EXPORT static const Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/GEOMAlgo/Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo.hxx b/src/GEOMAlgo/Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo.hxx new file mode 100644 index 000000000..ef425b4c2 --- /dev/null +++ b/src/GEOMAlgo/Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo.hxx @@ -0,0 +1,74 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#ifndef _Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_HeaderFile +#define _Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_TCollection_MapNode_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TCollection_MapNode); +class GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo); + +class Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo) : public Handle(TCollection_MapNode) { + public: + Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo)():Handle(TCollection_MapNode)() {} + Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo)(const Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo)& aHandle) : Handle(TCollection_MapNode)(aHandle) + { + } + + Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo)(const GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) + { + } + + Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo)& operator=(const Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo)& operator=(const GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo* operator->() const + { + return (GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo *)ControlAccess(); + } + +// Standard_EXPORT ~Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo)(); + + Standard_EXPORT static const Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/GEOMAlgo/Makefile.am b/src/GEOMAlgo/Makefile.am index 99255ce32..ca32aed4b 100644 --- a/src/GEOMAlgo/Makefile.am +++ b/src/GEOMAlgo/Makefile.am @@ -109,10 +109,16 @@ dist_libGEOMAlgo_la_SOURCES = \ GEOMAlgo_WESCorrector.cxx \ GEOMAlgo_WireEdgeSet.cxx \ GEOMAlgo_WireSolid.cxx \ - GEOMAlgo_WireSplitter.cxx - -LIB_CLIENT_IDL = -LIB_SERVER_IDL = + GEOMAlgo_WireSplitter.cxx \ + GEOMAlgo_ClsfSolid.cxx \ + GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_0.cxx \ + GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape_0.cxx \ + GEOMAlgo_DataMapOfPassKeyShapeShape_0.cxx \ + GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_0.cxx \ + GEOMAlgo_ShapeInfoFiller_1.cxx \ + GEOMAlgo_IndexedDataMapOfShapeShapeInfo_0.cxx \ + GEOMAlgo_ShapeInfo.cxx \ + GEOMAlgo_ShapeInfoFiller.cxx # header files salomeinclude_HEADERS = \ @@ -202,6 +208,31 @@ salomeinclude_HEADERS = \ Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState.hxx \ Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx \ Handle_GEOMAlgo_ListNodeOfListOfPnt.hxx + GEOMAlgo_ClsfSolid.hxx \ + GEOMAlgo_ClsfSolid.ixx \ + GEOMAlgo_ClsfSolid.jxx \ + GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape.hxx \ + GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape.hxx \ + GEOMAlgo_DataMapOfPassKeyShapeShape.hxx \ + GEOMAlgo_Gluer1.cxx \ + GEOMAlgo_Gluer1.hxx \ + GEOMAlgo_Gluer1.ixx \ + GEOMAlgo_Gluer1.jxx \ + GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo.hxx \ + GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx \ + GEOMAlgo_KindOfBounds.hxx \ + GEOMAlgo_KindOfClosed.hxx \ + GEOMAlgo_KindOfName.hxx \ + GEOMAlgo_KindOfShape.hxx \ + GEOMAlgo_ShapeInfo.hxx \ + GEOMAlgo_ShapeInfo.ixx \ + GEOMAlgo_ShapeInfo.jxx \ + GEOMAlgo_ShapeInfoFiller.hxx \ + GEOMAlgo_ShapeInfoFiller.ixx \ + GEOMAlgo_ShapeInfoFiller.jxx \ + Handle_GEOMAlgo_ClsfSolid.hxx \ + Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape.hxx \ + Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo.hxx libGEOMAlgo_la_CPPFLAGS = \ $(CAS_CPPFLAGS) \ diff --git a/src/GEOMBase/GEOMBase_Helper.cxx b/src/GEOMBase/GEOMBase_Helper.cxx index fe51c488f..efa81ac91 100755 --- a/src/GEOMBase/GEOMBase_Helper.cxx +++ b/src/GEOMBase/GEOMBase_Helper.cxx @@ -44,9 +44,9 @@ #include #include #include +#include #include #include -#include #include #include @@ -106,9 +106,13 @@ GEOMBase_Helper::~GEOMBase_Helper() erasePreview(); if ( hasCommand() ) abortCommand(); - - globalSelection( GEOM_ALLOBJECTS, true ); - + SalomeApp_Application* app = (SalomeApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) { + GeometryGUI* aGeomGUI = dynamic_cast( app->module( "Geometry" ) ); + if(aGeomGUI) + globalSelection(aGeomGUI->getLocalSelectionMode() , true ); + } + if (myDisplayer) delete myDisplayer; } @@ -245,7 +249,9 @@ void GEOMBase_Helper::redisplay( GEOM::GEOM_Object_ptr object, void GEOMBase_Helper::displayPreview( const bool activate, const bool update, const bool toRemoveFromEngine, - const double lineWidth ) + const double lineWidth, + const int displayMode, + const int color ) { isPreview = true; QString msg; @@ -267,7 +273,7 @@ void GEOMBase_Helper::displayPreview( const bool activate, else { for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it ) { - displayPreview( *it, true, activate, false, lineWidth ); + displayPreview( *it, true, activate, false, lineWidth, displayMode, color ); if ( toRemoveFromEngine ) getGeomEngine()->RemoveObject( *it ); } @@ -291,13 +297,18 @@ void GEOMBase_Helper::displayPreview( GEOM::GEOM_Object_ptr object, const bool append, const bool activate, const bool update, - const double lineWidth ) + const double lineWidth, + const int displayMode, + const int color ) { // Set color for preview shape - getDisplayer()->SetColor( Quantity_NOC_VIOLET ); + getDisplayer()->SetColor( color == -1 ? Quantity_NOC_VIOLET : color ); // set width of displayed shape getDisplayer()->SetWidth( lineWidth ); + + // set display mode of displayed shape + int aPrevDispMode = getDisplayer()->SetDisplayMode( displayMode ); // Disable activation of selection getDisplayer()->SetToActivate( activate ); @@ -315,6 +326,8 @@ void GEOMBase_Helper::displayPreview( GEOM::GEOM_Object_ptr object, displayPreview( aPrs, append, update ); getDisplayer()->UnsetName(); + getDisplayer()->UnsetColor(); + getDisplayer()->SetDisplayMode( aPrevDispMode ); // Enable activation of displayed objects getDisplayer()->SetToActivate( true ); @@ -762,7 +775,6 @@ bool GEOMBase_Helper::onAccept( const bool publish, const bool useTransaction ) } else { const int nbObjs = objects.size(); - bool withChildren = false; int aNumber = 1; for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it ) { if ( publish ) { @@ -783,14 +795,15 @@ bool GEOMBase_Helper::onAccept( const bool publish, const bool useTransaction ) aName = GEOMBase::GetDefaultName( getPrefix( *it ) ); } addInStudy( *it, aName.latin1() ); - withChildren = false; + // updateView=false display( *it, false ); } - else { // asv : fix of PAL6454. If publish==false, then the original shape was modified, and need to be re-cached in GEOM_Client - // before redisplay + else { + // asv : fix of PAL6454. If publish==false, then the original shape + // was modified, and need to be re-cached in GEOM_Client before redisplay clearShapeBuffer( *it ); - withChildren = true; - redisplay( *it, withChildren, false ); + // withChildren=true, updateView=false + redisplay( *it, true, false ); } } @@ -909,22 +922,23 @@ QString GEOMBase_Helper::getPrefix( GEOM::GEOM_Object_ptr theObj ) const if ( !myPrefix.isEmpty() || theObj->_is_nil() ) return myPrefix; - TopoDS_Shape aShape; - if ( !GEOMBase::GetShape( theObj, aShape ) ) - return ""; - - long aType = aShape.ShapeType(); + //TopoDS_Shape aShape; + //if ( !GEOMBase::GetShape( theObj, aShape ) ) + // return ""; + // + //long aType = aShape.ShapeType(); + GEOM::shape_type aType = theObj->GetShapeType(); switch ( aType ) { - case TopAbs_VERTEX : return QObject::tr( "GEOM_VERTEX" ); - case TopAbs_EDGE : return QObject::tr( "GEOM_EDGE" ); - case TopAbs_WIRE : return QObject::tr( "GEOM_WIRE" ); - case TopAbs_FACE : return QObject::tr( "GEOM_FACE" ); - case TopAbs_SHELL : return QObject::tr( "GEOM_SHELL" ); - case TopAbs_SOLID : return QObject::tr( "GEOM_SOLID" ); - case TopAbs_COMPSOLID: return QObject::tr( "GEOM_COMPOUNDSOLID" ); - case TopAbs_COMPOUND : return QObject::tr( "GEOM_COMPOUND" ); + case GEOM::VERTEX : return QObject::tr( "GEOM_VERTEX" ); + case GEOM::EDGE : return QObject::tr( "GEOM_EDGE" ); + case GEOM::WIRE : return QObject::tr( "GEOM_WIRE" ); + case GEOM::FACE : return QObject::tr( "GEOM_FACE" ); + case GEOM::SHELL : return QObject::tr( "GEOM_SHELL" ); + case GEOM::SOLID : return QObject::tr( "GEOM_SOLID" ); + case GEOM::COMPSOLID: return QObject::tr( "GEOM_COMPOUNDSOLID" ); + case GEOM::COMPOUND : return QObject::tr( "GEOM_COMPOUND" ); default : return ""; } } @@ -985,3 +999,38 @@ SUIT_Desktop* GEOMBase_Helper::getDesktop() const return myDesktop; } +//================================================================ +// Function : selectObjects +// Purpose : Selects list of objects +//================================================================ +bool GEOMBase_Helper::selectObjects( ObjectList& objects ) +{ + SUIT_DataOwnerPtrList aList; + ObjectList::iterator anIter; + for ( anIter = objects.begin(); anIter != objects.end(); ++anIter ) + { + string entry = getEntry( *anIter ); + QString aEntry( entry.c_str() ); + LightApp_DataOwner* anOwher = new LightApp_DataOwner( aEntry ); + aList.append( anOwher ); + } + + SUIT_Session* session = SUIT_Session::session(); + SalomeApp_Application* app = dynamic_cast( session->activeApplication() ); + if ( !app ) + return false; + + LightApp_SelectionMgr* aMgr = app->selectionMgr(); + if ( !aMgr ) + return false; + + aMgr->setSelected( aList, false ); + + return true; +} + + + + + + \ No newline at end of file diff --git a/src/GEOMBase/GEOMBase_Helper.h b/src/GEOMBase/GEOMBase_Helper.h index 20bcdae79..e8c689864 100755 --- a/src/GEOMBase/GEOMBase_Helper.h +++ b/src/GEOMBase/GEOMBase_Helper.h @@ -76,7 +76,9 @@ protected: virtual void displayPreview ( const bool activate = false, const bool update = true, const bool toRemoveFromEngine = true, - const double lineWidth = -1 ); + const double lineWidth = -1, + const int displayMode = -1, + const int color = -1 ); // This is the easiest way to show preview. It is based on execute() method. // It removes temporary GEOM::GEOM_Objects automatically. @@ -84,7 +86,9 @@ protected: const bool append = false, const bool activate = false, const bool update = true, - const double lineWidth = -1 ); + const double lineWidth = -1, + const int displayMode = -1, + const int color = -1 ); void displayPreview ( const SALOME_Prs* prs, const bool append = false, const bool = true ); @@ -144,6 +148,9 @@ protected: Handle(SALOME_InteractiveObject) lastIObject() ; // Function returns the last selected object in the list // of selected objects + + bool selectObjects( ObjectList& objects ); + // Selects list of objects //////////////////////////////////////////////////////////////////////////// // Virtual methods, to be redefined in dialog classes diff --git a/src/GEOMBase/GEOMBase_Skeleton.h b/src/GEOMBase/GEOMBase_Skeleton.h index 251c29436..fdd00155b 100644 --- a/src/GEOMBase/GEOMBase_Skeleton.h +++ b/src/GEOMBase/GEOMBase_Skeleton.h @@ -79,7 +79,7 @@ protected: QString myHelpFileName; protected slots: - void ClickOnCancel(); + virtual void ClickOnCancel(); void LineEditReturnPressed(); void DeactivateActiveDialog(); void ActivateThisDialog(); diff --git a/src/GEOMGUI/GEOMGUI_OCCSelector.cxx b/src/GEOMGUI/GEOMGUI_OCCSelector.cxx index ed6056650..5b225bec1 100644 --- a/src/GEOMGUI/GEOMGUI_OCCSelector.cxx +++ b/src/GEOMGUI/GEOMGUI_OCCSelector.cxx @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -76,7 +77,7 @@ void GEOMGUI_OCCSelector::getSelection( SUIT_DataOwnerPtrList& aList ) const { for ( ic->InitSelected(); ic->MoreSelected(); ic->NextSelected() ) { - Handle(SelectMgr_EntityOwner) anOwner = ic->SelectedOwner(); + Handle(StdSelect_BRepOwner) anOwner = Handle(StdSelect_BRepOwner)::DownCast(ic->SelectedOwner()); if ( anOwner.IsNull() ) continue; @@ -128,7 +129,7 @@ void GEOMGUI_OCCSelector::getSelection( SUIT_DataOwnerPtrList& aList ) const } // add externally selected objects SUIT_DataOwnerPtrList::const_iterator anExtIter; - for(anExtIter = getSelectedExt().begin(); anExtIter != getSelectedExt().end(); anExtIter++) { + for(anExtIter = mySelectedExternals.begin(); anExtIter != mySelectedExternals.end(); anExtIter++) { aList.append(*anExtIter); } @@ -239,7 +240,9 @@ void GEOMGUI_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& aList ) for ( int i = 1, n = owners.Extent(); i <= n; i++ ) { - Handle(SelectMgr_EntityOwner) anOwner = owners( i ); + + Handle(StdSelect_BRepOwner) anOwner = Handle(StdSelect_BRepOwner)::DownCast(owners( i )); + if ( anOwner.IsNull() || !anOwner->HasShape() ) continue; @@ -294,7 +297,7 @@ void GEOMGUI_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& aList ) vw->update(); // fill extra selected - clearSelExtOwners(); + mySelectedExternals.clear(); for ( SUIT_DataOwnerPtrList::const_iterator itr2 = aList.begin(); itr2 != aList.end(); ++itr2 ) { const LightApp_DataSubOwner* subOwner = dynamic_cast( (*itr2).operator->() ); if ( !subOwner ) @@ -304,8 +307,7 @@ void GEOMGUI_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& aList ) { SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); QString anEntry = appStudy->referencedToEntry( owner->entry() ); - if (globalSelMap[anEntry] == 1) - appendSelExtOwner(*itr2); + if (globalSelMap[anEntry] == 1) mySelectedExternals.append(*itr2); } } } diff --git a/src/GEOMGUI/GEOMGUI_Selection.cxx b/src/GEOMGUI/GEOMGUI_Selection.cxx index f4a15ea35..7af013b20 100644 --- a/src/GEOMGUI/GEOMGUI_Selection.cxx +++ b/src/GEOMGUI/GEOMGUI_Selection.cxx @@ -23,6 +23,7 @@ #include "GEOM_Displayer.h" #include +#include #include #include @@ -66,7 +67,9 @@ GEOMGUI_Selection::~GEOMGUI_Selection() QtxValue GEOMGUI_Selection::globalParam( const QString& p ) const { if ( p == "isOCC" ) return QtxValue( activeViewType() == OCCViewer_Viewer::Type() ); - + if ( p == "selectionmode" ){ + return QtxValue(selectionMode()); + } return LightApp_Selection::globalParam( p ); } @@ -201,3 +204,24 @@ GEOM::GEOM_Object_ptr GEOMGUI_Selection::getObject( const int index ) const } return GEOM::GEOM_Object::_nil(); } + +QString GEOMGUI_Selection:: selectionMode() const +{ + SalomeApp_Application* app = (SalomeApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) { + GeometryGUI* aGeomGUI = dynamic_cast( app->module( "Geometry" ) ); + if(aGeomGUI) + switch(aGeomGUI->getLocalSelectionMode()) + { + case GEOM_POINT : return "VERTEX"; + case GEOM_EDGE : return "EDGE"; + case GEOM_WIRE : return "WIRE"; + case GEOM_FACE : return "FACE"; + case GEOM_SHELL : return "SHELL"; + case GEOM_SOLID : return "SOLID"; + case GEOM_COMPOUND : return "COMPOUND"; + case GEOM_ALLOBJECTS : return "ALL"; + default: return ""; + } + } +} diff --git a/src/GEOMGUI/GEOMGUI_Selection.h b/src/GEOMGUI/GEOMGUI_Selection.h index 5fb15727c..adca786b3 100644 --- a/src/GEOMGUI/GEOMGUI_Selection.h +++ b/src/GEOMGUI/GEOMGUI_Selection.h @@ -49,6 +49,7 @@ private: bool isVisible( const int ) const; QString typeName( const int ) const; QString displayMode( const int ) const; + QString selectionMode() const; bool isComponent( const int ) const; GEOM::GEOM_Object_ptr getObject( const int ) const; diff --git a/src/GEOMGUI/GEOM_Displayer.cxx b/src/GEOMGUI/GEOM_Displayer.cxx index 3ca1ebbab..d13170019 100644 --- a/src/GEOMGUI/GEOM_Displayer.cxx +++ b/src/GEOMGUI/GEOM_Displayer.cxx @@ -40,6 +40,7 @@ #include "GEOM_Actor.h" #include "GEOM_AssemblyBuilder.h" #include "GEOM_AISShape.hxx" +#include "GEOM_AISVector.hxx" #include "GEOM_AISTrihedron.hxx" #include "GEOM_VTKTrihedron.hxx" @@ -237,6 +238,13 @@ GEOM_Displayer::GEOM_Displayer( SalomeApp_Study* st ) myShadingColor = SalomeApp_Tools::color( col ); myDisplayMode = resMgr->integerValue("Geometry", "display_mode", 0); + myTypeOfMarker = (Aspect_TypeOfMarker)resMgr->integerValue("Geometry", "type_of_marker", Aspect_TOM_PLUS); + myScaleOfMarker = resMgr->doubleValue("Geometry", "marker_scale", 1.); + if(myScaleOfMarker < 1.0) + myScaleOfMarker = 1.0; + if(myScaleOfMarker > 7.) + myScaleOfMarker = 7.; + myColor = -1; // This color is used for shape displaying. If it is equal -1 then @@ -513,7 +521,12 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs ) { if ( !myShape.IsNull() ) { - Handle(GEOM_AISShape) AISShape = new GEOM_AISShape( myShape, "" ); + //Handle(GEOM_AISShape) AISShape = new GEOM_AISShape( myShape, "" ); + Handle(GEOM_AISShape) AISShape; + if (myType == GEOM_VECTOR) + AISShape = new GEOM_AISVector (myShape, ""); + else + AISShape = new GEOM_AISShape (myShape, ""); // Temporary staff: vertex must be infinite for correct visualization AISShape->SetInfiniteState( myShape.Infinite() || myShape.ShapeType() == TopAbs_VERTEX ); @@ -523,21 +536,22 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs ) // Set color and number for iso lines SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); - QColor col = aResMgr->colorValue( "Geometry", "isos_color", QColor(int(0.5*255), int(0.5*255), int(0.5*255)) ); + QColor col = aResMgr->colorValue( "Geometry", "isos_color", + QColor(int(0.5*255), int(0.5*255), int(0.5*255)) ); Quantity_Color aColor = SalomeApp_Tools::color( col ); int anUIsoNumber = aResMgr->integerValue("OCCViewer", "iso_number_u", 1); int aVIsoNumber = aResMgr->integerValue("OCCViewer", "iso_number_v", 1); - + Handle(Prs3d_IsoAspect) anAspect = AISShape->Attributes()->UIsoAspect(); anAspect->SetNumber( anUIsoNumber ); anAspect->SetColor( aColor ); AISShape->Attributes()->SetUIsoAspect( anAspect ); - + anAspect = AISShape->Attributes()->VIsoAspect(); anAspect->SetNumber( aVIsoNumber ); anAspect->SetColor( aColor ); AISShape->Attributes()->SetVIsoAspect( anAspect ); - + if ( HasColor() ) { AISShape->SetColor( (Quantity_NameOfColor)GetColor() ); @@ -545,6 +559,8 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs ) { Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect(); anAspect->SetColor( (Quantity_NameOfColor)GetColor() ); + anAspect->SetScale( myScaleOfMarker ); + anAspect->SetTypeOfMarker( myTypeOfMarker ); AISShape->Attributes()->SetPointAspect( anAspect ); } } @@ -554,17 +570,19 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs ) { col = aResMgr->colorValue( "Geometry", "point_color", QColor( 255, 255, 0 ) ); aColor = SalomeApp_Tools::color( col ); - + Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect(); anAspect->SetColor( aColor ); - AISShape->Attributes()->SetPointAspect( anAspect ); + anAspect->SetScale( myScaleOfMarker ); + anAspect->SetTypeOfMarker( myTypeOfMarker ); + AISShape->Attributes()->SetPointAspect( anAspect ); } else { // Set line aspect col = aResMgr->colorValue( "Geometry", "wireframe_color", QColor( 255, 255, 0 ) ); aColor = SalomeApp_Tools::color( col ); - + Handle(Prs3d_LineAspect) anAspect = AISShape->Attributes()->LineAspect(); anAspect->SetColor( aColor ); AISShape->Attributes()->SetLineAspect( anAspect ); @@ -577,15 +595,15 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs ) // Set free boundaries aspect col = aResMgr->colorValue( "Geometry", "free_bound_color", QColor( 0, 255, 0 ) ); aColor = SalomeApp_Tools::color( col ); - + anAspect = AISShape->Attributes()->FreeBoundaryAspect(); anAspect->SetColor( aColor ); AISShape->Attributes()->SetFreeBoundaryAspect( anAspect ); - + // Set wire aspect col = aResMgr->colorValue( "Geometry", "line_color", QColor( 255, 0, 0 ) ); aColor = SalomeApp_Tools::color( col ); - + anAspect = AISShape->Attributes()->WireAspect(); anAspect->SetColor( aColor ); AISShape->Attributes()->SetWireAspect( anAspect ); @@ -664,7 +682,7 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs ) vtkActorCollection* theActors = 0; - if ( myType == GEOM_MARKER && !myShape.IsNull() && myShape.ShapeType() == TopAbs_FACE ) + if ( myType == GEOM_MARKER && myShape.ShapeType() == TopAbs_FACE ) { myToActivate = false; GEOM_VTKTrihedron* aTrh = GEOM_VTKTrihedron::New(); @@ -692,7 +710,10 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs ) theActors->AddItem( aTrh ); } else - theActors = GEOM_AssemblyBuilder::BuildActors( myShape, 0, 0, Standard_True ); + { + bool isVector = (myType == GEOM_VECTOR); + theActors = GEOM_AssemblyBuilder::BuildActors( myShape, 0, 0, Standard_True, isVector ); + } theActors->InitTraversal(); @@ -1054,7 +1075,13 @@ void GEOM_Displayer::AfterDisplay( SALOME_View*, const SALOME_OCCViewType& ) //================================================================= void GEOM_Displayer::SetColor( const int color ) { - myColor = color; + if ( color == -1 ) + UnsetColor(); + else + { + myColor = color; + myShadingColor = Quantity_Color( (Quantity_NameOfColor)color ); + } } int GEOM_Displayer::GetColor() const @@ -1070,6 +1097,10 @@ bool GEOM_Displayer::HasColor() const void GEOM_Displayer::UnsetColor() { myColor = -1; + + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + QColor col = resMgr->colorValue( "Geometry", "shading_color", QColor( 255, 0, 0 ) ); + myShadingColor = SalomeApp_Tools::color( col ); } //================================================================= @@ -1162,3 +1193,27 @@ bool GEOM_Displayer::canBeDisplayed( const QString& /*entry*/, const QString& vi { return viewer_type==SOCC_Viewer::Type() || viewer_type==SVTK_Viewer::Type(); } + +int GEOM_Displayer::SetDisplayMode( const int theMode ) +{ + int aPrevMode = myDisplayMode; + if ( theMode != -1 ) + myDisplayMode = theMode; + else + { + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + myDisplayMode = resMgr->integerValue( "Geometry", "display_mode", 0 ); + } + return aPrevMode; +} + +int GEOM_Displayer::GetDisplayMode() const +{ + return myDisplayMode; +} + +int GEOM_Displayer::UnsetDisplayMode() +{ + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + myDisplayMode = resMgr->integerValue( "Geometry", "display_mode", 0 ); +} diff --git a/src/GEOMGUI/GEOM_Displayer.h b/src/GEOMGUI/GEOM_Displayer.h index 10c4d4ed4..878274ae4 100644 --- a/src/GEOMGUI/GEOM_Displayer.h +++ b/src/GEOMGUI/GEOM_Displayer.h @@ -1,22 +1,22 @@ // 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, +// 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 +// 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 -// +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // @@ -37,6 +37,7 @@ #include #include #include +#include #include @@ -59,7 +60,7 @@ class SUIT_SelectionFilter; class GEOMGUI_EXPORT GEOM_Displayer : public LightApp_Displayer { - + public: /* Constructor */ GEOM_Displayer( SalomeApp_Study* app ); @@ -75,9 +76,9 @@ public: // This overloaded Display() method can be useful for operations // not using dialog boxes. - void Display ( GEOM::GEOM_Object_ptr theObj, + void Display ( GEOM::GEOM_Object_ptr theObj, const bool updateViewer = true ); - + void Redisplay ( const Handle(SALOME_InteractiveObject)& theIO, const bool updateViewer = true ); @@ -88,17 +89,17 @@ public: void Erase ( GEOM::GEOM_Object_ptr theObj, const bool forced = false, - const bool updateViewer = true ); + const bool updateViewer = true ); /* Display/Erase list of objects methods */ - + void Display ( const SALOME_ListIO& theIOList, const bool updateViewer = true ); - + void Erase ( const SALOME_ListIO& theIOList, const bool forced = false, const bool updateViewer = true ); - + void Redisplay ( const SALOME_ListIO& theIOList, const bool updateViewer = true ); @@ -118,6 +119,11 @@ public: void UnsetWidth(); double GetWidth () const; bool HasWidth () const; + + /* Set display mode shape displaying. If it is equal -1 then display mode is used. */ + int SetDisplayMode( const int ); + int GetDisplayMode() const; + int UnsetDisplayMode(); /* Sets name - for temporary objects only */ @@ -146,20 +152,20 @@ protected: /* internal methods */ /* Builds presentation accordint to the current viewer type */ virtual SALOME_Prs* buildPresentation( const QString&, SALOME_View* = 0 ); - + /* Sets interactive object */ void setIO( const Handle(SALOME_InteractiveObject)& theIO ); - + /* Sets shape */ void setShape( const TopoDS_Shape& theShape ); - + /* Resets internal data */ void internalReset(); void clearTemporary( LightApp_SelectionMgr* theSelMgr ); SUIT_SelectionFilter* getFilter( const int theMode ); - + protected: Handle(SALOME_InteractiveObject) myIO; TopoDS_Shape myShape; @@ -173,6 +179,8 @@ protected: double myWidth; bool myToActivate; int myDisplayMode; + Aspect_TypeOfMarker myTypeOfMarker; + double myScaleOfMarker; private: SalomeApp_Application* myApp; diff --git a/src/GEOMGUI/GEOM_images.po b/src/GEOMGUI/GEOM_images.po index 130b32162..410405e9d 100644 --- a/src/GEOMGUI/GEOM_images.po +++ b/src/GEOMGUI/GEOM_images.po @@ -181,6 +181,10 @@ msgstr "pointonedge.png" msgid "ICON_DLG_ARC" msgstr "arc.png" +#ArcDlg +msgid "ICON_DLG_ARC_CENTER" +msgstr "arccenter.png" + #ArchimedeDlg msgid "ICON_DLG_ARCHIMEDE" msgstr "archimede.png" @@ -520,6 +524,9 @@ msgstr "block_face_4e.png" msgid "ICON_DLG_GLUE_FACES" msgstr "glue.png" +msgid "ICON_DLG_GLUE_FACES2" +msgstr "glue2.png" + msgid "ICON_DLG_FREE_FACES" msgstr "free_faces.png" @@ -762,3 +769,24 @@ msgstr "erase.png" msgid "ICO_POP_CREATE_GROUP" msgstr "group_new.png" + +msgid "ICO_VERTEX_SEL_ONLY" +msgstr "point2.png" + +msgid "ICO_EDGE_SEL_ONLY" +msgstr "build_edge.png" + +msgid "ICO_WIRE_SEL_ONLY" +msgstr "build_wire.png" + +msgid "ICO_FACE_SEL_ONLY" +msgstr "build_face.png" + +msgid "ICO_SHELL_SEL_ONLY" +msgstr "build_shell.png" + +msgid "ICO_SOLID_SEL_ONLY" +msgstr "build_solid.png" + +msgid "ICO_COMPOUND_SEL_ONLY" +msgstr "build_compound.png" \ No newline at end of file diff --git a/src/GEOMGUI/GEOM_msg_en.po b/src/GEOMGUI/GEOM_msg_en.po index 6d538e649..01825cc9d 100644 --- a/src/GEOMGUI/GEOM_msg_en.po +++ b/src/GEOMGUI/GEOM_msg_en.po @@ -1263,6 +1263,10 @@ msgstr "OZX" msgid "GEOM_WPLANE_OXY" msgstr "OXY" +#: GeometryGUI_WorkingPlaneDlg.cxx:107 +msgid "GEOM_REVERSE_PLANE" +msgstr "Reverse the plane normal" + #: GeometryGUI_multiTranslationDlg.cxx:107 msgid "GEOM_MULTITRANSLATION_TITLE" msgstr "Multi-Translation" @@ -1970,6 +1974,18 @@ msgstr "Glue faces" msgid "GEOM_GLUE" msgstr "Glue" +msgid "RepairGUI_GlueDlg::SELECT_FACES" +msgstr "Select Faces" + +msgid "RepairGUI_GlueDlg::FACES_FOR_GLUING_ARE_DETECTED" +msgstr "There are %1 face(s) that can be glued. They are coloured on the screen with red colour\nPlease close this message box and select faces for glueing" + +msgid "RepairGUI_GlueDlg::GLUE_FACES" +msgstr "Glue faces" + +msgid "RepairGUI_GlueDlg::THERE_ARE_NO_FACES_FOR_GLUING" +msgstr "There are no faces for gluing" + msgid "GEOM_FREE_FACES_TITLE" msgstr "Free faces" @@ -2932,6 +2948,9 @@ msgstr "OCC Viewer 3d" msgid "PREF_GROUP_GENERAL" msgstr "General" +msgid "PREF_GROUP_VERTEX" +msgstr "Marker of Points" + msgid "PREF_SHADING_COLOR" msgstr "Default shading color" @@ -2959,8 +2978,99 @@ msgstr "Default display mode" msgid "PREF_TAB_SETTINGS" msgstr "Settings" +msgid "PREF_TYPE_OF_MARKER" +msgstr "Type" + +msgid "PREF_MARKER_SCALE" +msgstr "Size" + +msgid "TOM_POINT" +msgstr "." + +msgid "TOM_PLUS" +msgstr "+" + +msgid "TOM_STAR" +msgstr "*" + +msgid "TOM_O" +msgstr "O" + +msgid "TOM_X" +msgstr "X" + +msgid "TOM_O_POINT" +msgstr ". in O" + +msgid "TOM_O_PLUS" +msgstr "+ in O" + +msgid "TOM_O_STAR" +msgstr "* in O" + +msgid "TOM_O_X" +msgstr "X in O" + msgid "ERROR_SHAPE_TYPE" msgstr "Object of incorrect type selected!\nPlease, select face, shell or solid and try again" msgid "DEP_OBJECT" msgstr "Selected object has been used to create another one\n It can't be deleted " + +msgid "MEN_SELECT_ONLY" +msgstr "Select Only" + +msgid "STB_VERTEX_SEL_ONLY" +msgstr "Select only a Points" + +msgid "STB_EDGE_SEL_ONLY" +msgstr "Select only a Edges" + +msgid "STB_WIRE_SEL_ONLY" +msgstr "Select only a Wires" + +msgid "STB_FACE_SEL_ONLY" +msgstr "Select only a Faces" + +msgid "STB_SHELL_SEL_ONLY" +msgstr "Select only a Shells" + +msgid "STB_SOLID_SEL_ONLY" +msgstr "Select only a Solids" + +msgid "STB_COMPOUND_SEL_ONLY" +msgstr "Select only a Compounds" + +msgid "STB_ALL_SEL_ONLY" +msgstr "Select all Objects" + +msgid "MEN_VERTEX_SEL_ONLY" +msgstr "Vertex" + +msgid "MEN_EDGE_SEL_ONLY" +msgstr "Edge" + +msgid "MEN_WIRE_SEL_ONLY" +msgstr "Wire" + +msgid "MEN_FACE_SEL_ONLY" +msgstr "Face" + +msgid "MEN_SHELL_SEL_ONLY" +msgstr "Shell" + +msgid "MEN_SOLID_SEL_ONLY" +msgstr "Solid" + +msgid "MEN_COMPOUND_SEL_ONLY" +msgstr "Compound" + +msgid "MEN_ALL_SEL_ONLY" +msgstr "Select All" + + + + + + + diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index 0ab1ed994..e7aa4ced1 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -61,6 +61,7 @@ #include #include +#include #include #include @@ -189,6 +190,7 @@ GeometryGUI::GeometryGUI() : myVTKSelectors.setAutoDelete( true ); myDisplayer = 0; + myLocalSelectionMode = GEOM_ALLOBJECTS; } //======================================================================= @@ -368,6 +370,14 @@ void GeometryGUI::OnGUIEvent( int id ) id == 121 || // MENU FILE - EXPORT BREP id == 122 || // MENU FILE - EXPORT IGES id == 123 || // MENU FILE - EXPORT STEP + id == 2171 || // POPUP VIEWER - SELECT ONLY - VERTEX + id == 2172 || // POPUP VIEWER - SELECT ONLY - EDGE + id == 2173 || // POPUP VIEWER - SELECT ONLY - WIRE + id == 2174 || // POPUP VIEWER - SELECT ONLY - FACE + id == 2175 || // POPUP VIEWER - SELECT ONLY - SHELL + id == 2176 || // POPUP VIEWER - SELECT ONLY - SOLID + id == 2177 || // POPUP VIEWER - SELECT ONLY - COMPOUND + id == 2178 || // POPUP VIEWER - SELECT ONLY - SELECT ALL id == 31 || // MENU EDIT - COPY id == 33 || // MENU EDIT - DELETE id == 411 || // MENU SETTINGS - ADD IN STUDY @@ -854,6 +864,14 @@ void GeometryGUI::initialize( CAM_Application* app ) createGeomAction( 212, "DISPLAY_ALL" ); createGeomAction( 214, "ERASE_ALL" ); createGeomAction( 216, "DISPLAY" ); + createGeomAction( 2171, "VERTEX_SEL_ONLY" ,"", 0, true ); + createGeomAction( 2172, "EDGE_SEL_ONLY", "", 0, true ); + createGeomAction( 2173, "WIRE_SEL_ONLY", "", 0, true ); + createGeomAction( 2174, "FACE_SEL_ONLY", "", 0, true ); + createGeomAction( 2175, "SHELL_SEL_ONLY", "", 0, true ); + createGeomAction( 2176, "SOLID_SEL_ONLY", "", 0, true ); + createGeomAction( 2177, "COMPOUND_SEL_ONLY", "", 0, true ); + createGeomAction( 2178, "ALL_SEL_ONLY", "", 0, true ); createGeomAction( 213, "DISPLAY_ONLY" ); createGeomAction( 215, "ERASE" ); @@ -1115,6 +1133,35 @@ void GeometryGUI::initialize( CAM_Application* app ) mgr->insert( action( 214 ), -1, -1 ); // erase All mgr->setRule( action( 214 ), clientOCCorVTK, true ); + QString selectOnly = "(client='OCCViewer' or client='VTKViewer') and (selcount=0)"; + + int selectolnyId = mgr->insert( tr("MEN_SELECT_ONLY"), -1, -1); //select only menu + mgr->insert( action(2171), selectolnyId, -1); //Vertex + mgr->setRule(action(2171), selectOnly, true); + mgr->setRule(action(2171), selectOnly + " and selectionmode='VERTEX'", false); + mgr->insert( action(2172), selectolnyId, -1); //Edge + mgr->setRule(action(2172), selectOnly, true); + mgr->setRule(action(2172), selectOnly + " and selectionmode='EDGE'", false); + mgr->insert( action(2173), selectolnyId, -1); //Wire + mgr->setRule(action(2173), selectOnly, true); + mgr->setRule(action(2173), selectOnly + " and selectionmode='WIRE'", false); + mgr->insert( action(2174), selectolnyId, -1); //Face + mgr->setRule(action(2174), selectOnly, true); + mgr->setRule(action(2174), selectOnly + " and selectionmode='FACE'", false); + mgr->insert( action(2175), selectolnyId, -1); //Shell + mgr->setRule(action(2175), selectOnly, true); + mgr->setRule(action(2175), selectOnly + " and selectionmode='SHELL'", false); + mgr->insert( action(2176), selectolnyId, -1); //Solid + mgr->setRule(action(2176), selectOnly, true); + mgr->setRule(action(2176), selectOnly + " and selectionmode='SOLID'", false); + mgr->insert( action(2177), selectolnyId, -1); //Compound + mgr->setRule(action(2177), selectOnly, true); + mgr->setRule(action(2177), selectOnly + " and selectionmode='COMPOUND'", false); + mgr->insert( separator(), selectolnyId, -1); + mgr->insert( action(2178), selectolnyId, -1); //Clear selection filter + mgr->setRule(action(2178), selectOnly, true); + mgr->setRule(action(2178), selectOnly + " and selectionmode='ALL'", false); + mgr->insert( action( 213 ), -1, -1 ); // display only mgr->setRule( action( 213 ), rule.arg( types ).arg( "true" ), true ); mgr->insert( separator(), -1, -1 ); @@ -1678,6 +1725,14 @@ void GeometryGUI::createPreferences() int step = addPreference( tr( "PREF_STEP_VALUE" ), genGroup, LightApp_Preferences::IntSpin, "Geometry", "SettingsGeomStep" ); + int VertexGroup = addPreference( tr( "PREF_GROUP_VERTEX" ), tabId ); + + int typeOfMarker = addPreference( tr( "PREF_TYPE_OF_MARKER" ), VertexGroup, + LightApp_Preferences::Selector, "Geometry", "type_of_marker" ); + + int markerScale = addPreference( tr( "PREF_MARKER_SCALE" ), VertexGroup, + LightApp_Preferences::DblSpin, "Geometry", "marker_scale" ); + // Set property for default display mode QStringList aModesList; aModesList.append( tr("MEN_WIREFRAME") ); @@ -1695,6 +1750,47 @@ void GeometryGUI::createPreferences() setPreferenceProperty( step, "max", 10000 ); setPreferenceProperty( step, "precision", 3 ); + // Set property for type of vertex marker + QStringList aTypeOfMarkerList; + QValueList anTypeOfMarkerIndexesList; + + aTypeOfMarkerList.append( tr("TOM_PLUS") ); + anTypeOfMarkerIndexesList.append(Aspect_TOM_PLUS); + + aTypeOfMarkerList.append( tr("TOM_POINT") ); + anTypeOfMarkerIndexesList.append(Aspect_TOM_POINT); + + aTypeOfMarkerList.append( tr("TOM_STAR") ); + anTypeOfMarkerIndexesList.append(Aspect_TOM_STAR); + + aTypeOfMarkerList.append( tr("TOM_O") ); + anTypeOfMarkerIndexesList.append(Aspect_TOM_O); + + aTypeOfMarkerList.append( tr("TOM_X") ); + anTypeOfMarkerIndexesList.append(Aspect_TOM_X); + + aTypeOfMarkerList.append( tr("TOM_O_POINT") ); + anTypeOfMarkerIndexesList.append(Aspect_TOM_O_POINT); + + aTypeOfMarkerList.append( tr("TOM_O_PLUS") ); + anTypeOfMarkerIndexesList.append(Aspect_TOM_O_PLUS); + + aTypeOfMarkerList.append( tr("TOM_O_STAR") ); + anTypeOfMarkerIndexesList.append(Aspect_TOM_O_STAR); + + aTypeOfMarkerList.append( tr("TOM_O_X") ); + anTypeOfMarkerIndexesList.append(Aspect_TOM_O_X); + + + setPreferenceProperty( typeOfMarker, "strings", aTypeOfMarkerList ); + setPreferenceProperty( typeOfMarker, "indexes", anTypeOfMarkerIndexesList ); + + // Set property for Vertex Marker scale + setPreferenceProperty( markerScale, "min", 1. ); + setPreferenceProperty( markerScale, "max", 7. ); + setPreferenceProperty( markerScale, "precision", 0.01 ); + setPreferenceProperty( markerScale, "step", 0.5 ); + } void GeometryGUI::preferencesChanged( const QString& section, const QString& param ) @@ -1714,3 +1810,12 @@ LightApp_Displayer* GeometryGUI::displayer() myDisplayer = new GEOM_Displayer( dynamic_cast( getApp()->activeStudy() ) ); return myDisplayer; } + +void GeometryGUI::setLocalSelectionMode(const int mode) +{ + myLocalSelectionMode = mode; +} +int GeometryGUI::getLocalSelectionMode() const +{ + return myLocalSelectionMode; +} diff --git a/src/GEOMGUI/GeometryGUI.h b/src/GEOMGUI/GeometryGUI.h index f6e93644a..484e3883f 100644 --- a/src/GEOMGUI/GeometryGUI.h +++ b/src/GEOMGUI/GeometryGUI.h @@ -120,7 +120,8 @@ public: virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& ); virtual void createPreferences(); virtual void preferencesChanged( const QString&, const QString& ); - + int getLocalSelectionMode() const; + void setLocalSelectionMode(const int mode); public slots: virtual bool deactivateModule( SUIT_Study* ); @@ -170,6 +171,7 @@ private: QPtrList myVTKSelectors; LightApp_Displayer* myDisplayer; + int myLocalSelectionMode; //Select Only friend class DisplayGUI; }; diff --git a/src/GEOMImpl/GEOMImpl_ArcDriver.cxx b/src/GEOMImpl/GEOMImpl_ArcDriver.cxx index ded4e8b69..d25eb2199 100644 --- a/src/GEOMImpl/GEOMImpl_ArcDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_ArcDriver.cxx @@ -35,12 +35,18 @@ #include #include - #include #include #include #include +#include +#include +#include +#include +#include + +#include "utilities.h" //======================================================================= //function : GetID //purpose : @@ -73,8 +79,7 @@ Standard_Integer GEOMImpl_ArcDriver::Execute(TFunction_Logbook& log) const Standard_Integer aType = aFunction->GetType(); TopoDS_Shape aShape; - - if (aType == CIRC_ARC_THREE_PNT) { + if ((aType == CIRC_ARC_THREE_PNT)||(aType == CIRC_ARC_CENTER)) { Handle(GEOM_Function) aRefPoint1 = aCI.GetPoint1(); Handle(GEOM_Function) aRefPoint2 = aCI.GetPoint2(); Handle(GEOM_Function) aRefPoint3 = aCI.GetPoint3(); @@ -93,8 +98,28 @@ Standard_Integer GEOMImpl_ArcDriver::Execute(TFunction_Logbook& log) const Standard_ConstructionError::Raise("Arc creation aborted: coincident points given"); if (gp_Vec(aP1, aP2).IsParallel(gp_Vec(aP1, aP3), Precision::Angular())) Standard_ConstructionError::Raise("Arc creation aborted: points lay on one line"); - GC_MakeArcOfCircle arc (aP1, aP2, aP3); - aShape = BRepBuilderAPI_MakeEdge(arc).Edge(); + if (aType == CIRC_ARC_THREE_PNT){ + GC_MakeArcOfCircle arc(aP1, aP2, aP3); + aShape = BRepBuilderAPI_MakeEdge(arc).Edge(); + + } + if (aType == CIRC_ARC_CENTER){ + Standard_Real Rad = aP1.Distance(aP2); + gce_MakeCirc MC(aP1,gce_MakePln(aP1, aP2, aP3).Value(),Rad); + Standard_Boolean sense = aCI.GetSense(); + if (MC.IsDone()) { + const gp_Circ& Circ = MC.Value(); + Standard_Real Alpha1 = ElCLib::Parameter(Circ,aP2); + Standard_Real Alpha2 = ElCLib::Parameter(Circ,aP3); + Handle(Geom_Circle) C = new Geom_Circle(Circ); + Handle(Geom_TrimmedCurve) TheArc; + if (!sense) + TheArc= new Geom_TrimmedCurve(C,Alpha1,Alpha2,false); + if (sense) + TheArc= new Geom_TrimmedCurve(C,Alpha2,Alpha1,false); + aShape = BRepBuilderAPI_MakeEdge(TheArc).Edge(); + } + } } } else { } @@ -104,7 +129,7 @@ Standard_Integer GEOMImpl_ArcDriver::Execute(TFunction_Logbook& log) const aFunction->SetValue(aShape); log.SetTouched(Label()); - + MESSAGE("Out of building step ..."); return 1; } diff --git a/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx b/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx index 2a7c71386..4bf020b61 100644 --- a/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -231,6 +232,81 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute(TFunction_Logbook& log) const // perform FUSE operation else if (aType == BOOLEAN_FUSE) { + // Check arguments + TopTools_ListOfShape listShape1, listShape2; + AddSimpleShapes(aShape1, listShape1); + AddSimpleShapes(aShape2, listShape2); + + Standard_Boolean isIntersect = Standard_False; + + if (listShape1.Extent() > 1 && !isIntersect) { + // check intersections inside the first compound + TopTools_ListIteratorOfListOfShape it1 (listShape1); + for (; it1.More() && !isIntersect; it1.Next()) { + TopoDS_Shape aValue1 = it1.Value(); + TopTools_ListIteratorOfListOfShape it2 (listShape1); + for (; it2.More() && !isIntersect; it2.Next()) { + TopoDS_Shape aValue2 = it2.Value(); + if (aValue2 != aValue1) { + BRepAlgoAPI_Section BO (aValue1, aValue2); + if (BO.IsDone()) { + TopoDS_Shape aSect = BO.Shape(); + TopExp_Explorer anExp (aSect, TopAbs_EDGE); + if (anExp.More()) { + isIntersect = Standard_True; + } + } + } + } + } + } + + if (listShape2.Extent() > 1 && !isIntersect) { + // check intersections inside the second compound + TopTools_ListIteratorOfListOfShape it1 (listShape2); + for (; it1.More() && !isIntersect; it1.Next()) { + TopoDS_Shape aValue1 = it1.Value(); + TopTools_ListIteratorOfListOfShape it2 (listShape2); + for (; it2.More() && !isIntersect; it2.Next()) { + TopoDS_Shape aValue2 = it2.Value(); + if (aValue2 != aValue1) { + BRepAlgoAPI_Section BO (aValue1, aValue2); + if (BO.IsDone()) { + TopoDS_Shape aSect = BO.Shape(); + TopExp_Explorer anExp (aSect, TopAbs_EDGE); + if (anExp.More()) { + isIntersect = Standard_True; + } + } + } + } + } + } + + if (isIntersect) { + // have intersections inside compounds + // check intersections between compounds + TopTools_ListIteratorOfListOfShape it1 (listShape1); + for (; it1.More(); it1.Next()) { + TopoDS_Shape aValue1 = it1.Value(); + TopTools_ListIteratorOfListOfShape it2 (listShape2); + for (; it2.More(); it2.Next()) { + TopoDS_Shape aValue2 = it2.Value(); + if (aValue2 != aValue1) { + BRepAlgoAPI_Section BO (aValue1, aValue2); + if (BO.IsDone()) { + TopoDS_Shape aSect = BO.Shape(); + TopExp_Explorer anExp (aSect, TopAbs_EDGE); + if (anExp.More()) { + StdFail_NotDone::Raise("Bad argument for Fuse: compound with intersecting sub-shapes"); + } + } + } + } + } + } + + // Perform BRepAlgoAPI_Fuse BO (aShape1, aShape2); if (!BO.IsDone()) { StdFail_NotDone::Raise("Fuse operation can not be performed on the given shapes"); diff --git a/src/GEOMImpl/GEOMImpl_GlueDriver.cxx b/src/GEOMImpl/GEOMImpl_GlueDriver.cxx index fd41180a9..e056bf7d8 100644 --- a/src/GEOMImpl/GEOMImpl_GlueDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_GlueDriver.cxx @@ -28,6 +28,10 @@ #include #include +#include "GEOMAlgo_Gluer1.hxx" +#include "GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx" +#include "GEOMAlgo_CoupleOfShapes.hxx" +#include "GEOMAlgo_ListOfCoupleOfShapes.hxx" #include "utilities.h" @@ -187,6 +191,7 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesWithWarnings (const TopoDS_Shape& the return aRes; } + //======================================================================= //function : GlueFaces //purpose : @@ -249,6 +254,56 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFaces (const TopoDS_Shape& theShape, return aRes; } + +//======================================================================= +//function : GlueFacesByList +//purpose : +//======================================================================= +TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesByList (const TopoDS_Shape& theShape, + const Standard_Real theTolerance, + const TopTools_MapOfShape& aFaces) +{ + TopoDS_Shape aRes; + + GEOMAlgo_Gluer1 aGluer; + GEOMAlgo_ListIteratorOfListOfCoupleOfShapes aItCS; + GEOMAlgo_CoupleOfShapes aCS; + GEOMAlgo_ListOfCoupleOfShapes aLCS; + + aGluer.SetShape(theShape); + aGluer.SetTolerance(theTolerance); + aGluer.Perform(); + Standard_Integer iErr = aGluer.ErrorStatus(); + if (iErr) return aRes; + + TopTools_ListOfShape listShape; + const GEOMAlgo_ListOfCoupleOfShapes& aLCSG = aGluer.GluedFaces(); + // Access to faces + aItCS.Initialize(aLCSG); + for (; aItCS.More(); aItCS.Next()) { + const GEOMAlgo_CoupleOfShapes& aCSG = aItCS.Value(); + const TopoDS_Shape& aF1 = aCSG.Shape1(); + const TopoDS_Shape& aF2 = aCSG.Shape2(); + if( aFaces.Contains(aF1) || aFaces.Contains(aF2) ) + continue; + aCS.SetShapes(aF1,aF2); + aLCS.Append(aCS); + } + + //cout<<"aLCS.Extent() = "<0) { + aGluer.SetFacesToUnglue(aLCS); + aGluer.UnglueFaces(); + iErr = aGluer.ErrorStatus(); + if (iErr) return aRes; + } + + aRes = aGluer.Result(); + + return aRes; +} + + //======================================================================= //function : Execute //purpose : @@ -264,16 +319,35 @@ Standard_Integer GEOMImpl_GlueDriver::Execute(TFunction_Logbook& log) const TopoDS_Shape aShape; TCollection_AsciiString aWrn; - if (aType == GLUE_FACES) { - Handle(GEOM_Function) aRefBase = aCI.GetBase(); - TopoDS_Shape aShapeBase = aRefBase->GetValue(); - if (aShapeBase.IsNull()) { - Standard_NullObject::Raise("Shape for gluing is null"); - } + Handle(GEOM_Function) aRefBase = aCI.GetBase(); + TopoDS_Shape aShapeBase = aRefBase->GetValue(); + if (aShapeBase.IsNull()) { + Standard_NullObject::Raise("Shape for gluing is null"); + } + + Standard_Real tol3d = aCI.GetTolerance(); - Standard_Real tol3d = aCI.GetTolerance(); + if (aType == GLUE_FACES) { aShape = GlueFacesWithWarnings(aShapeBase, tol3d, aWrn); - } else { + } + else { // aType == GLUE_FACES_BY_LIST + Handle(TColStd_HSequenceOfTransient) SF = aCI.GetFaces(); + TopTools_MapOfShape aFaces; + int i=1; + for( ; i <= SF->Length(); i++) { + Handle(Standard_Transient) anItem = SF->Value(i); + if(anItem.IsNull()) + continue; + Handle(GEOM_Function) aRefSh = Handle(GEOM_Function)::DownCast(anItem); + if(aRefSh.IsNull()) + continue; + TopoDS_Shape aFace = aRefSh->GetValue(); + if(aFace.IsNull()) + continue; + if(!aFaces.Contains(aFace)) + aFaces.Add(aFace); + } + aShape = GlueFacesByList(aShapeBase, tol3d, aFaces); } if (aShape.IsNull()) return 0; diff --git a/src/GEOMImpl/GEOMImpl_GlueDriver.hxx b/src/GEOMImpl/GEOMImpl_GlueDriver.hxx index 3c78c7bc8..eee00b868 100644 --- a/src/GEOMImpl/GEOMImpl_GlueDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_GlueDriver.hxx @@ -53,6 +53,8 @@ class Handle_Standard_Type; class Handle(TFunction_Driver); class GEOMImpl_GlueDriver; +#include + Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_GlueDriver); class Handle(GEOMImpl_GlueDriver) : public Handle(TFunction_Driver) { @@ -154,6 +156,11 @@ Standard_EXPORT TopoDS_Shape GlueFacesWithWarnings (const TopoDS_Shape& theShape const Standard_Real theTolerance, TCollection_AsciiString& theWarning) const; +Standard_EXPORT static TopoDS_Shape GlueFacesByList (const TopoDS_Shape& theShape, + const Standard_Real theTolerance, + const TopTools_MapOfShape& aFaces); + + // Type management // Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_GlueDriver_Type_(); diff --git a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx index a4ed0e79e..de70f1259 100644 --- a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx @@ -59,6 +59,7 @@ #include #include #include +#include #include #include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC @@ -1091,17 +1092,18 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeThruSections( } + //============================================================================= /*! * MakePipeWithDifferentSections */ //============================================================================= Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeWithDifferentSections( - const Handle(TColStd_HSequenceOfTransient)& theBases, - const Handle(TColStd_HSequenceOfTransient)& theLocations, - const Handle(GEOM_Object)& thePath, - bool theWithContact, - bool theWithCorrections) + const Handle(TColStd_HSequenceOfTransient)& theBases, + const Handle(TColStd_HSequenceOfTransient)& theLocations, + const Handle(GEOM_Object)& thePath, + bool theWithContact, + bool theWithCorrections) { Handle(GEOM_Object) anObj; SetErrorCode(KO); @@ -1232,3 +1234,165 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeWithDifferentSections( } + + +//============================================================================= +/*! + * MakePipeWithShellSections + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeWithShellSections( + const Handle(TColStd_HSequenceOfTransient)& theBases, + const Handle(TColStd_HSequenceOfTransient)& theSubBases, + const Handle(TColStd_HSequenceOfTransient)& theLocations, + const Handle(GEOM_Object)& thePath, + bool theWithContact, + bool theWithCorrections) +{ + Handle(GEOM_Object) anObj; + SetErrorCode(KO); + if(theBases.IsNull()) + return anObj; + + Standard_Integer nbBases = theBases->Length(); + + if (!nbBases) + return anObj; + + Standard_Integer nbSubBases = (theSubBases.IsNull() ? 0 :theSubBases->Length()); + + Standard_Integer nbLocs = (theLocations.IsNull() ? 0 :theLocations->Length()); + + //Add a new Pipe object + Handle(GEOM_Object) aPipeDS = GetEngine()->AddObject(GetDocID(), GEOM_PIPE); + + //Add a new Pipe function + + Handle(GEOM_Function) aFunction = + aPipeDS->AddFunction(GEOMImpl_PipeDriver::GetID(), PIPE_SHELL_SECTIONS); + if (aFunction.IsNull()) return anObj; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_PipeDriver::GetID()) return anObj; + + //GEOMImpl_IPipeDiffSect aCI (aFunction); + GEOMImpl_IPipeShellSect aCI (aFunction); + + Handle(GEOM_Function) aRefPath = thePath->GetLastFunction(); + if(aRefPath.IsNull()) + return anObj; + + Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient; + Handle(TColStd_HSequenceOfTransient) aSeqSubBases = new TColStd_HSequenceOfTransient; + Handle(TColStd_HSequenceOfTransient) aSeqLocs = new TColStd_HSequenceOfTransient; + + Standard_Integer i =1; + for( ; i <= nbBases; i++) { + + Handle(Standard_Transient) anItem = theBases->Value(i); + if(anItem.IsNull()) + continue; + Handle(GEOM_Object) aBase = Handle(GEOM_Object)::DownCast(anItem); + if(aBase.IsNull()) + continue; + Handle(GEOM_Function) aRefBase = aBase->GetLastFunction(); + if(aRefBase.IsNull()) + continue; + + if( nbSubBases >= nbBases ) { + Handle(Standard_Transient) aSubItem = theSubBases->Value(i); + if(aSubItem.IsNull()) + continue; + Handle(GEOM_Object) aSubBase = Handle(GEOM_Object)::DownCast(aSubItem); + if(aSubBase.IsNull()) + continue; + Handle(GEOM_Function) aRefSubBase = aSubBase->GetLastFunction(); + if(aRefSubBase.IsNull()) + continue; + aSeqSubBases->Append(aRefSubBase); + } + + if(nbLocs) { + Handle(Standard_Transient) anItemLoc = theLocations->Value(i); + if(anItemLoc.IsNull()) + continue; + Handle(GEOM_Object) aLoc = Handle(GEOM_Object)::DownCast(anItemLoc); + if(aLoc.IsNull()) + continue; + Handle(GEOM_Function) aRefLoc = aLoc->GetLastFunction(); + if(aRefLoc.IsNull()) + continue; + aSeqLocs->Append(aRefLoc); + } + + aSeqBases->Append(aRefBase); + } + + if(!aSeqBases->Length()) + return anObj; + + aCI.SetBases(aSeqBases); + aCI.SetSubBases(aSeqSubBases); + aCI.SetLocations(aSeqLocs); + aCI.SetPath(aRefPath); + aCI.SetWithContactMode(theWithContact); + aCI.SetWithCorrectionMode(theWithCorrections); + + //Compute the Pipe value + try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Pipe with shell sections driver failed"); + return anObj; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return anObj; + } + + //Make a Python command + GEOM::TPythonDump pyDump(aFunction); + pyDump << aPipeDS << " = geompy.MakePipeWithShellSections(["; + + for(i =1 ; i <= nbBases; i++) { + + Handle(Standard_Transient) anItem = theBases->Value(i); + if(anItem.IsNull()) + continue; + + Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(anItem); + if(!anObj.IsNull()) { + pyDump<< anObj; + if(i < nbBases) + pyDump<<", "; + } + + } + + pyDump<< "], ["; + + for(i =1 ; i <= nbLocs; i++) { + + Handle(Standard_Transient) anItem = theLocations->Value(i); + if(anItem.IsNull()) + continue; + + Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(anItem); + if(!anObj.IsNull()) { + pyDump<< anObj; + if(i < nbLocs) + pyDump<<", "; + } + } + + pyDump<< "], "<SetReference(ARC_ARG_PI, theP); } void SetPoint2(Handle(GEOM_Function) theP) { _func->SetReference(ARC_ARG_PC, theP); } void SetPoint3(Handle(GEOM_Function) theP) { _func->SetReference(ARC_ARG_PE, theP); } + void SetSense(bool theSense) { _func->SetInteger(ARC_ARG_SE, theSense); } Handle(GEOM_Function) GetPoint1() { return _func->GetReference(ARC_ARG_PI); } Handle(GEOM_Function) GetPoint2() { return _func->GetReference(ARC_ARG_PC); } Handle(GEOM_Function) GetPoint3() { return _func->GetReference(ARC_ARG_PE); } - + bool GetSense() { return _func->GetInteger(ARC_ARG_SE); } + private: Handle(GEOM_Function) _func; diff --git a/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx b/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx index a28543ca7..3643e6f39 100644 --- a/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx @@ -332,24 +332,25 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeArc (Handle(GEOM_Object) the //Add a new Circle Arc function Handle(GEOM_Function) aFunction = - anArc->AddFunction(GEOMImpl_ArcDriver::GetID(), CIRC_ARC_THREE_PNT); - if (aFunction.IsNull()) return NULL; + anArc->AddFunction(GEOMImpl_ArcDriver::GetID(), CIRC_ARC_THREE_PNT); + if (aFunction.IsNull()) return NULL; + //Check if the function is set correctly if (aFunction->GetDriverGUID() != GEOMImpl_ArcDriver::GetID()) return NULL; - GEOMImpl_IArc 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 Arc value try { #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 @@ -374,6 +375,66 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeArc (Handle(GEOM_Object) the return anArc; } +//============================================================================= +/*! + * MakeArcCenter + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeArcCenter (Handle(GEOM_Object) thePnt1, + Handle(GEOM_Object) thePnt2, + Handle(GEOM_Object) thePnt3, + bool theSense) +{ + SetErrorCode(KO); + if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL; + + //Add a new Circle Arc object + Handle(GEOM_Object) anArc = GetEngine()->AddObject(GetDocID(), GEOM_CIRC_ARC); + + //Add a new Circle Arc function + Handle(GEOM_Function) aFunction = + anArc->AddFunction(GEOMImpl_ArcDriver::GetID(), CIRC_ARC_CENTER); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_ArcDriver::GetID()) return NULL; + + GEOMImpl_IArc 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); + aCI.SetSense(theSense); + + //Compute the Arc value + try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Arc 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) << anArc << " = geompy.MakeArcCenter(" + << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << "," << theSense << ")"; + + SetErrorCode(OK); + return anArc; +} + //============================================================================= /*! * MakeSplineBezier diff --git a/src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx b/src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx index 0d6dbe97c..b0aa3cd39 100644 --- a/src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx @@ -51,6 +51,11 @@ class GEOMImpl_ICurvesOperations : public GEOM_IOperations { Standard_EXPORT Handle(GEOM_Object) MakeArc (Handle(GEOM_Object) thePnt1, Handle(GEOM_Object) thePnt2, Handle(GEOM_Object) thePnt3); + + Standard_EXPORT Handle(GEOM_Object) MakeArcCenter (Handle(GEOM_Object) thePnt1, + Handle(GEOM_Object) thePnt2, + Handle(GEOM_Object) thePnt3, + bool theSense); Standard_EXPORT Handle(GEOM_Object) MakeSplineBezier (list thePoints); Standard_EXPORT Handle(GEOM_Object) MakeSplineInterpolation (list thePoints); diff --git a/src/GEOMImpl/GEOMImpl_IGlue.hxx b/src/GEOMImpl/GEOMImpl_IGlue.hxx index 31d0cd2d4..7670ed70a 100644 --- a/src/GEOMImpl/GEOMImpl_IGlue.hxx +++ b/src/GEOMImpl/GEOMImpl_IGlue.hxx @@ -22,8 +22,11 @@ #include "GEOM_Function.hxx" +#include + #define GLUE_ARG_BASE 1 #define GLUE_ARG_TOLER 2 +#define GLUE_ARG_FACES 3 class GEOMImpl_IGlue { @@ -41,6 +44,12 @@ class GEOMImpl_IGlue Standard_Real GetTolerance() { return _func->GetReal(GLUE_ARG_TOLER); } + void SetFaces(const Handle(TColStd_HSequenceOfTransient)& theShapes) + { _func->SetReferenceList(GLUE_ARG_FACES, theShapes); } + + Handle(TColStd_HSequenceOfTransient) GetFaces() + { return _func->GetReferenceList(GLUE_ARG_FACES); } + private: Handle(GEOM_Function) _func; diff --git a/src/GEOMImpl/GEOMImpl_IInsertOperations.cxx b/src/GEOMImpl/GEOMImpl_IInsertOperations.cxx index 094e2fbb7..9339f4a47 100644 --- a/src/GEOMImpl/GEOMImpl_IInsertOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IInsertOperations.cxx @@ -260,7 +260,7 @@ Standard_Boolean GEOMImpl_IInsertOperations::ImportTranslators if (!InitResMgr()) return Standard_False; - // Read Import formats list + // Read Import formats list from install directory if (myResMgr->Find("Import")) { TCollection_AsciiString aFormats (myResMgr->Value("Import")); TCollection_AsciiString aToken = aFormats.Token("| \t", 1); @@ -270,6 +270,25 @@ Standard_Boolean GEOMImpl_IInsertOperations::ImportTranslators } } + // Read Import formats from user directory + if (myResMgrUser->Find("Import")) { + TCollection_AsciiString aFormats (myResMgrUser->Value("Import")); + TCollection_AsciiString aToken = aFormats.Token("| \t", 1); + int i = 1; + for (; !aToken.IsEmpty(); aToken = aFormats.Token("| \t", ++i)) { + int aLenFormats = theFormats->Length(); + bool isFound = false; + for(int aInd=1;aInd<=aLenFormats;aInd++){ + if( theFormats->Value(aInd) == aToken){ + isFound = true; + break; + } + } + if(!isFound) + theFormats->Append(aToken); + } + } + // Read Patterns for each supported format int j = 1, len = theFormats->Length(); for (; j <= len; j++) { @@ -277,10 +296,14 @@ Standard_Boolean GEOMImpl_IInsertOperations::ImportTranslators aKey = theFormats->Value(j) + ".ImportPattern"; if (myResMgr->Find(aKey.ToCString())) aPattern = myResMgr->Value(aKey.ToCString()); + else if(myResMgrUser->Find(aKey.ToCString())) + aPattern = myResMgrUser->Value(aKey.ToCString()); else { aKey = theFormats->Value(j) + ".Pattern"; if (myResMgr->Find(aKey.ToCString())) aPattern = myResMgr->Value(aKey.ToCString()); + else if(myResMgrUser->Find(aKey.ToCString())) + aPattern = myResMgrUser->Value(aKey.ToCString()); else { aPattern = theFormats->Value(j); aPattern += " Files ( *.* )"; @@ -313,7 +336,7 @@ Standard_Boolean GEOMImpl_IInsertOperations::ExportTranslators if (!InitResMgr()) return Standard_False; - // Read Export formats list + // Read Export formats list from install directory if (myResMgr->Find("Export")) { TCollection_AsciiString aFormats (myResMgr->Value("Export")); TCollection_AsciiString aToken = aFormats.Token("| \t", 1); @@ -323,6 +346,25 @@ Standard_Boolean GEOMImpl_IInsertOperations::ExportTranslators } } + // Read Export formats list from user directory + if (myResMgrUser->Find("Export")) { + TCollection_AsciiString aFormats (myResMgrUser->Value("Export")); + TCollection_AsciiString aToken = aFormats.Token("| \t", 1); + int i = 1; + for (; !aToken.IsEmpty(); aToken = aFormats.Token("| \t", ++i)) { + int aLenFormats = theFormats->Length(); + bool isFound = false; + for(int aInd=1;aInd<=aLenFormats;aInd++){ + if( theFormats->Value(aInd) == aToken){ + isFound = true; + break; + } + } + if(!isFound) + theFormats->Append(aToken); + } + } + // Read Patterns for each supported format int j = 1, len = theFormats->Length(); for (; j <= len; j++) { @@ -330,10 +372,14 @@ Standard_Boolean GEOMImpl_IInsertOperations::ExportTranslators aKey = theFormats->Value(j) + ".ExportPattern"; if (myResMgr->Find(aKey.ToCString())) aPattern = myResMgr->Value(aKey.ToCString()); + else if (myResMgrUser->Find(aKey.ToCString())) + aPattern = myResMgrUser->Value(aKey.ToCString()); else { aKey = theFormats->Value(j) + ".Pattern"; if (myResMgr->Find(aKey.ToCString())) aPattern = myResMgr->Value(aKey.ToCString()); + else if (myResMgrUser->Find(aKey.ToCString())) + aPattern = myResMgrUser->Value(aKey.ToCString()); else { aPattern = theFormats->Value(j); aPattern += " Files ( *.* )"; @@ -363,7 +409,8 @@ Standard_Boolean GEOMImpl_IInsertOperations::IsSupported if (isImport) aMode = "Import"; else aMode = "Export"; - // Read supported formats for the certain mode + + // Read supported formats for the certain mode from install directory if (myResMgr->Find(aMode.ToCString())) { TCollection_AsciiString aFormats (myResMgr->Value(aMode.ToCString())); if (aFormats.Search(theFormat) > -1) { @@ -383,7 +430,23 @@ Standard_Boolean GEOMImpl_IInsertOperations::IsSupported } } } - + + // Read supported formats for the certain mode from user directory + if (myResMgrUser->Find(aMode.ToCString())) { + TCollection_AsciiString aFormats (myResMgrUser->Value(aMode.ToCString())); + if (aFormats.Search(theFormat) > -1) { + // Read library name for the supported format + TCollection_AsciiString aKey (theFormat); + aKey += "."; + aKey += aMode; + if (myResMgrUser->Find(aKey.ToCString())) { + TCollection_AsciiString aLibName (myResMgrUser->Value(aKey.ToCString())); + theLibName = new TCollection_HAsciiString (aLibName); + return Standard_True; + } + } + } + return Standard_False; } @@ -394,16 +457,34 @@ Standard_Boolean GEOMImpl_IInsertOperations::IsSupported //============================================================================= Standard_Boolean GEOMImpl_IInsertOperations::InitResMgr() { + bool isResourceFound = false; + bool isResourceFoundUser = false; + TCollection_AsciiString aUserResDir,aResDir; + if (myResMgr.IsNull()) { // Initialize the Resource Manager - TCollection_AsciiString aResDir (getenv("GEOM_ROOT_DIR")); + TCollection_AsciiString aNull; + aResDir = TCollection_AsciiString(getenv("GEOM_ROOT_DIR")); #ifdef WNT aResDir += "\\share\\salome\\resources\\geom"; #else aResDir += "/share/salome/resources/geom"; #endif + + myResMgr = new Resource_Manager ("ImportExport", aResDir, aNull, Standard_False); + + isResourceFound = true; + if (!myResMgr->Find("Import") && !myResMgr->Find("Export")) { + // instead of complains in Resource_Manager + isResourceFound = false; + INFOS("No valid file \"ImportExport\" found in " << aResDir.ToCString()); + } + } else + isResourceFound = true; + + if (myResMgrUser.IsNull()) { char * dir = getenv("GEOM_ENGINE_RESOURCES_DIR"); - TCollection_AsciiString aUserResDir; + TCollection_AsciiString aNull; if ( dir ) { aUserResDir = dir; @@ -417,14 +498,24 @@ Standard_Boolean GEOMImpl_IInsertOperations::InitResMgr() aUserResDir += "/.salome/resources"; #endif } - myResMgr = new Resource_Manager ("ImportExport", aResDir, aUserResDir, Standard_False); - if (!myResMgr->Find("Import") && !myResMgr->Find("Export")) { + myResMgrUser = new Resource_Manager ("ImportExport", aNull, aUserResDir, Standard_False); + + isResourceFoundUser = true; + + if (!myResMgrUser->Find("Import") && !myResMgrUser->Find("Export")) { // instead of complains in Resource_Manager - INFOS("No valid file \"ImportExport\" found in " << aResDir.ToCString() << - " and in " << aUserResDir.ToCString() ); + isResourceFoundUser = false; } + + } else + isResourceFoundUser = true; + + if(!isResourceFound && !isResourceFoundUser){ + INFOS("No valid file \"ImportExport\" found in " << aResDir.ToCString()); + INFOS("No valid file \"ImportExport\" found in " << aUserResDir.ToCString() ); } - return ( myResMgr->Find("Import") || myResMgr->Find("Export") ); + return ( myResMgr->Find("Import") || myResMgr->Find("Export") || + myResMgrUser->Find("Import") || myResMgrUser->Find("Export")); } diff --git a/src/GEOMImpl/GEOMImpl_IInsertOperations.hxx b/src/GEOMImpl/GEOMImpl_IInsertOperations.hxx index 5a5148b1a..7660da21e 100644 --- a/src/GEOMImpl/GEOMImpl_IInsertOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_IInsertOperations.hxx @@ -60,6 +60,7 @@ class GEOMImpl_IInsertOperations : public GEOM_IOperations { private: Handle(Resource_Manager) myResMgr; + Handle(Resource_Manager) myResMgrUser; }; #endif diff --git a/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx b/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx index 33fc39a94..f04746716 100644 --- a/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx @@ -25,10 +25,13 @@ #include #include +#include +#include + #include #include -#include "utilities.h" +#include #include #include @@ -39,12 +42,14 @@ #include #include +#include +#include #include #include #include -#include -#include #include +#include +#include #include @@ -63,8 +68,20 @@ #include #include +#include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + #include #include @@ -91,6 +108,619 @@ GEOMImpl_IMeasureOperations::~GEOMImpl_IMeasureOperations() MESSAGE("GEOMImpl_IMeasureOperations::~GEOMImpl_IMeasureOperations"); } +//============================================================================= +/*! Get kind and parameters of the given shape. + */ +//============================================================================= +GEOMImpl_IMeasureOperations::ShapeKind GEOMImpl_IMeasureOperations::KindOfShape + (Handle(GEOM_Object) theShape, + Handle(TColStd_HSequenceOfInteger)& theIntegers, + Handle(TColStd_HSequenceOfReal)& theDoubles) +{ + SetErrorCode(KO); + ShapeKind aKind = SK_NO_SHAPE; + + if (theIntegers.IsNull()) theIntegers = new TColStd_HSequenceOfInteger; + else theIntegers->Clear(); + + if (theDoubles.IsNull()) theDoubles = new TColStd_HSequenceOfReal; + else theDoubles->Clear(); + + if (theShape.IsNull()) + return aKind; + + Handle(GEOM_Function) aRefShape = theShape->GetLastFunction(); + if (aRefShape.IsNull()) return aKind; + + TopoDS_Shape aShape = aRefShape->GetValue(); + if (aShape.IsNull()) return aKind; + + // Call algorithm + GEOMAlgo_ShapeInfoFiller aSF; + aSF.SetShape(aShape); + aSF.Perform(); + Standard_Integer iErr = aSF.ErrorStatus(); + if (iErr) { + SetErrorCode("Error in GEOMAlgo_ShapeInfoFiller"); + return SK_NO_SHAPE; + } + const GEOMAlgo_ShapeInfo& anInfo = aSF.Info(); + + // Interprete results + TopAbs_ShapeEnum aType = anInfo.Type(); + switch (aType) + { + case TopAbs_COMPOUND: + case TopAbs_COMPSOLID: + { + // (+) geompy.kind.COMPOUND nb_solids nb_faces nb_edges nb_vertices + // (+) geompy.kind.COMPSOLID nb_solids nb_faces nb_edges nb_vertices + // ??? "nb_faces" - all faces or only 'standalone' faces? + if (aType == TopAbs_COMPOUND) + aKind = SK_COMPOUND; + else + aKind = SK_COMPSOLID; + + //theIntegers->Append(anInfo.NbSubShapes(TopAbs_COMPOUND)); + //theIntegers->Append(anInfo.NbSubShapes(TopAbs_COMPSOLID)); + theIntegers->Append(anInfo.NbSubShapes(TopAbs_SOLID)); + theIntegers->Append(anInfo.NbSubShapes(TopAbs_FACE)); + theIntegers->Append(anInfo.NbSubShapes(TopAbs_EDGE)); + theIntegers->Append(anInfo.NbSubShapes(TopAbs_VERTEX)); + } + break; + + case TopAbs_SHELL: + { + // (+) geompy.kind.SHELL geompy.info.closed nb_faces nb_edges nb_vertices + // (+) geompy.kind.SHELL geompy.info.unclosed nb_faces nb_edges nb_vertices + aKind = SK_SHELL; + + theIntegers->Append((int)anInfo.KindOfClosed()); + + theIntegers->Append(anInfo.NbSubShapes(TopAbs_FACE)); + theIntegers->Append(anInfo.NbSubShapes(TopAbs_EDGE)); + theIntegers->Append(anInfo.NbSubShapes(TopAbs_VERTEX)); + } + break; + + case TopAbs_WIRE: + { + // (+) geompy.kind.WIRE geompy.info.closed nb_edges nb_vertices + // (+) geompy.kind.WIRE geompy.info.unclosed nb_edges nb_vertices + aKind = SK_WIRE; + + theIntegers->Append((int)anInfo.KindOfClosed()); + + theIntegers->Append(anInfo.NbSubShapes(TopAbs_EDGE)); + theIntegers->Append(anInfo.NbSubShapes(TopAbs_VERTEX)); + } + break; + + case TopAbs_SOLID: + { + aKind = SK_SOLID; + + GEOMAlgo_KindOfName aKN = anInfo.KindOfName(); + switch (aKN) + { + case GEOMAlgo_KN_SPHERE: + // (+) geompy.kind.SPHERE xc yc zc R + { + aKind = SK_SPHERE; + + gp_Pnt aC = anInfo.Location(); + theDoubles->Append(aC.X()); + theDoubles->Append(aC.Y()); + theDoubles->Append(aC.Z()); + + theDoubles->Append(anInfo.Radius1()); + } + break; + case GEOMAlgo_KN_CYLINDER: + // (+) geompy.kind.CYLINDER xb yb zb dx dy dz R H + { + aKind = SK_CYLINDER; + + gp_Pnt aC = anInfo.Location(); + theDoubles->Append(aC.X()); + theDoubles->Append(aC.Y()); + theDoubles->Append(aC.Z()); + + gp_Ax3 anAx3 = anInfo.Position(); + gp_Dir aD = anAx3.Direction(); + theDoubles->Append(aD.X()); + theDoubles->Append(aD.Y()); + theDoubles->Append(aD.Z()); + + theDoubles->Append(anInfo.Radius1()); + theDoubles->Append(anInfo.Height()); + } + break; + case GEOMAlgo_KN_BOX: + // (+) geompy.kind.BOX xc yc zc ax ay az + { + aKind = SK_BOX; + + gp_Pnt aC = anInfo.Location(); + theDoubles->Append(aC.X()); + theDoubles->Append(aC.Y()); + theDoubles->Append(aC.Z()); + + gp_Ax3 anAx3 = anInfo.Position(); + gp_Dir aD = anAx3.Direction(); + gp_Dir aX = anAx3.XDirection(); + + // ax ay az + if (aD.IsParallel(gp::DZ(), Precision::Angular()) && + aX.IsParallel(gp::DX(), Precision::Angular())) { + theDoubles->Append(anInfo.Length()); // ax' + theDoubles->Append(anInfo.Width()); // ay' + theDoubles->Append(anInfo.Height()); // az' + } + else if (aD.IsParallel(gp::DZ(), Precision::Angular()) && + aX.IsParallel(gp::DY(), Precision::Angular())) { + theDoubles->Append(anInfo.Width()); // ay' + theDoubles->Append(anInfo.Length()); // ax' + theDoubles->Append(anInfo.Height()); // az' + } + else if (aD.IsParallel(gp::DX(), Precision::Angular()) && + aX.IsParallel(gp::DZ(), Precision::Angular())) { + theDoubles->Append(anInfo.Height()); // az' + theDoubles->Append(anInfo.Width()); // ay' + theDoubles->Append(anInfo.Length()); // ax' + } + else if (aD.IsParallel(gp::DX(), Precision::Angular()) && + aX.IsParallel(gp::DY(), Precision::Angular())) { + theDoubles->Append(anInfo.Height()); // az' + theDoubles->Append(anInfo.Length()); // ax' + theDoubles->Append(anInfo.Width()); // ay' + } + else if (aD.IsParallel(gp::DY(), Precision::Angular()) && + aX.IsParallel(gp::DZ(), Precision::Angular())) { + theDoubles->Append(anInfo.Width()); // ay' + theDoubles->Append(anInfo.Height()); // az' + theDoubles->Append(anInfo.Length()); // ax' + } + else if (aD.IsParallel(gp::DY(), Precision::Angular()) && + aX.IsParallel(gp::DX(), Precision::Angular())) { + theDoubles->Append(anInfo.Length()); // ax' + theDoubles->Append(anInfo.Height()); // az' + theDoubles->Append(anInfo.Width()); // ay' + } + else { + // (+) geompy.kind.ROTATED_BOX xo yo zo zx zy zz xx xy xz ax ay az + aKind = SK_ROTATED_BOX; + + // Direction and XDirection + theDoubles->Append(aD.X()); + theDoubles->Append(aD.Y()); + theDoubles->Append(aD.Z()); + + theDoubles->Append(aX.X()); + theDoubles->Append(aX.Y()); + theDoubles->Append(aX.Z()); + + // ax ay az + theDoubles->Append(anInfo.Length()); + theDoubles->Append(anInfo.Width()); + theDoubles->Append(anInfo.Height()); + } + } + break; + case GEOMAlgo_KN_TORUS: + // (+) geompy.kind.TORUS xc yc zc dx dy dz R_1 R_2 + { + aKind = SK_TORUS; + + gp_Pnt aO = anInfo.Location(); + theDoubles->Append(aO.X()); + theDoubles->Append(aO.Y()); + theDoubles->Append(aO.Z()); + + gp_Ax3 anAx3 = anInfo.Position(); + gp_Dir aD = anAx3.Direction(); + theDoubles->Append(aD.X()); + theDoubles->Append(aD.Y()); + theDoubles->Append(aD.Z()); + + theDoubles->Append(anInfo.Radius1()); + theDoubles->Append(anInfo.Radius2()); + } + break; + case GEOMAlgo_KN_CONE: + // (+) geompy.kind.CONE xb yb zb dx dy dz R_1 R_2 H + { + aKind = SK_CONE; + + gp_Pnt aO = anInfo.Location(); + theDoubles->Append(aO.X()); + theDoubles->Append(aO.Y()); + theDoubles->Append(aO.Z()); + + gp_Ax3 anAx3 = anInfo.Position(); + gp_Dir aD = anAx3.Direction(); + theDoubles->Append(aD.X()); + theDoubles->Append(aD.Y()); + theDoubles->Append(aD.Z()); + + theDoubles->Append(anInfo.Radius1()); + theDoubles->Append(anInfo.Radius2()); + theDoubles->Append(anInfo.Height()); + } + break; + case GEOMAlgo_KN_POLYHEDRON: + // (+) geompy.kind.POLYHEDRON nb_faces nb_edges nb_vertices + { + aKind = SK_POLYHEDRON; + + theIntegers->Append(anInfo.NbSubShapes(TopAbs_FACE)); + theIntegers->Append(anInfo.NbSubShapes(TopAbs_EDGE)); + theIntegers->Append(anInfo.NbSubShapes(TopAbs_VERTEX)); + } + break; + default: + // (+) geompy.kind.SOLID nb_faces nb_edges nb_vertices + { + theIntegers->Append(anInfo.NbSubShapes(TopAbs_FACE)); + theIntegers->Append(anInfo.NbSubShapes(TopAbs_EDGE)); + theIntegers->Append(anInfo.NbSubShapes(TopAbs_VERTEX)); + } + } + } + break; + + case TopAbs_FACE: + { + aKind = SK_FACE; + + GEOMAlgo_KindOfName aKN = anInfo.KindOfName(); + switch (aKN) { + case GEOMAlgo_KN_SPHERE: + // (+) geompy.kind.SPHERE2D xc yc zc R + { + aKind = SK_SPHERE2D; + + gp_Pnt aC = anInfo.Location(); + theDoubles->Append(aC.X()); + theDoubles->Append(aC.Y()); + theDoubles->Append(aC.Z()); + + theDoubles->Append(anInfo.Radius1()); + } + break; + case GEOMAlgo_KN_CYLINDER: + // (+) geompy.kind.CYLINDER2D xb yb zb dx dy dz R H + { + aKind = SK_CYLINDER2D; + + gp_Pnt aO = anInfo.Location(); + theDoubles->Append(aO.X()); + theDoubles->Append(aO.Y()); + theDoubles->Append(aO.Z()); + + gp_Ax3 anAx3 = anInfo.Position(); + gp_Dir aD = anAx3.Direction(); + theDoubles->Append(aD.X()); + theDoubles->Append(aD.Y()); + theDoubles->Append(aD.Z()); + + theDoubles->Append(anInfo.Radius1()); + theDoubles->Append(anInfo.Height()); + } + break; + case GEOMAlgo_KN_TORUS: + // (+) geompy.kind.TORUS2D xc yc zc dx dy dz R_1 R_2 + { + aKind = SK_TORUS2D; + + gp_Pnt aO = anInfo.Location(); + theDoubles->Append(aO.X()); + theDoubles->Append(aO.Y()); + theDoubles->Append(aO.Z()); + + gp_Ax3 anAx3 = anInfo.Position(); + gp_Dir aD = anAx3.Direction(); + theDoubles->Append(aD.X()); + theDoubles->Append(aD.Y()); + theDoubles->Append(aD.Z()); + + theDoubles->Append(anInfo.Radius1()); + theDoubles->Append(anInfo.Radius2()); + } + break; + case GEOMAlgo_KN_CONE: + // (+) geompy.kind.CONE2D xc yc zc dx dy dz R_1 R_2 H + { + aKind = SK_CONE2D; + + gp_Pnt aO = anInfo.Location(); + theDoubles->Append(aO.X()); + theDoubles->Append(aO.Y()); + theDoubles->Append(aO.Z()); + + gp_Ax3 anAx3 = anInfo.Position(); + gp_Dir aD = anAx3.Direction(); + theDoubles->Append(aD.X()); + theDoubles->Append(aD.Y()); + theDoubles->Append(aD.Z()); + + theDoubles->Append(anInfo.Radius1()); + theDoubles->Append(anInfo.Radius2()); + theDoubles->Append(anInfo.Height()); + } + break; + case GEOMAlgo_KN_DISKCIRCLE: + // (+) geompy.kind.DISK_CIRCLE xc yc zc dx dy dz R + { + aKind = SK_DISK_CIRCLE; + + gp_Pnt aC = anInfo.Location(); + theDoubles->Append(aC.X()); + theDoubles->Append(aC.Y()); + theDoubles->Append(aC.Z()); + + gp_Ax3 anAx3 = anInfo.Position(); + gp_Dir aD = anAx3.Direction(); + theDoubles->Append(aD.X()); + theDoubles->Append(aD.Y()); + theDoubles->Append(aD.Z()); + + theDoubles->Append(anInfo.Radius1()); + } + break; + case GEOMAlgo_KN_DISKELLIPSE: + // (+) geompy.kind.DISK_ELLIPSE xc yc zc dx dy dz R_1 R_2 + { + aKind = SK_DISK_ELLIPSE; + + gp_Pnt aC = anInfo.Location(); + theDoubles->Append(aC.X()); + theDoubles->Append(aC.Y()); + theDoubles->Append(aC.Z()); + + gp_Ax3 anAx3 = anInfo.Position(); + gp_Dir aD = anAx3.Direction(); + theDoubles->Append(aD.X()); + theDoubles->Append(aD.Y()); + theDoubles->Append(aD.Z()); + + theDoubles->Append(anInfo.Radius1()); + theDoubles->Append(anInfo.Radius2()); + } + break; + case GEOMAlgo_KN_RECTANGLE: + case GEOMAlgo_KN_TRIANGLE: + case GEOMAlgo_KN_QUADRANGLE: + case GEOMAlgo_KN_POLYGON: + // (+) geompy.kind.POLYGON xo yo zo dx dy dz nb_edges nb_vertices + { + aKind = SK_POLYGON; + + gp_Pnt aO = anInfo.Location(); + theDoubles->Append(aO.X()); + theDoubles->Append(aO.Y()); + theDoubles->Append(aO.Z()); + + gp_Ax3 anAx3 = anInfo.Position(); + gp_Dir aD = anAx3.Direction(); + theDoubles->Append(aD.X()); + theDoubles->Append(aD.Y()); + theDoubles->Append(aD.Z()); + + theIntegers->Append(anInfo.NbSubShapes(TopAbs_EDGE)); + theIntegers->Append(anInfo.NbSubShapes(TopAbs_VERTEX)); + } + break; + case GEOMAlgo_KN_PLANE: // infinite + // (+) geompy.kind.PLANE xo yo zo dx dy dz + { + aKind = SK_PLANE; + + gp_Pnt aC = anInfo.Location(); + theDoubles->Append(aC.X()); + theDoubles->Append(aC.Y()); + theDoubles->Append(aC.Z()); + + gp_Ax3 anAx3 = anInfo.Position(); + gp_Dir aD = anAx3.Direction(); + theDoubles->Append(aD.X()); + theDoubles->Append(aD.Y()); + theDoubles->Append(aD.Z()); + } + break; + default: + if (anInfo.KindOfShape() == GEOMAlgo_KS_PLANE) { + // (+) geompy.kind.PLANAR xo yo zo dx dy dz nb_edges nb_vertices + + aKind = SK_PLANAR; + + gp_Pnt aC = anInfo.Location(); + theDoubles->Append(aC.X()); + theDoubles->Append(aC.Y()); + theDoubles->Append(aC.Z()); + + gp_Ax3 anAx3 = anInfo.Position(); + gp_Dir aD = anAx3.Direction(); + theDoubles->Append(aD.X()); + theDoubles->Append(aD.Y()); + theDoubles->Append(aD.Z()); + + theIntegers->Append(anInfo.NbSubShapes(TopAbs_EDGE)); + theIntegers->Append(anInfo.NbSubShapes(TopAbs_VERTEX)); + } + else { + // ??? geompy.kind.FACE nb_edges nb_vertices _surface_type_id_ + // (+) geompy.kind.FACE nb_edges nb_vertices + + theIntegers->Append(anInfo.NbSubShapes(TopAbs_EDGE)); + theIntegers->Append(anInfo.NbSubShapes(TopAbs_VERTEX)); + } + } + } + break; + + case TopAbs_EDGE: + { + aKind = SK_EDGE; + + GEOMAlgo_KindOfName aKN = anInfo.KindOfName(); + switch (aKN) { + case GEOMAlgo_KN_CIRCLE: + { + // (+) geompy.kind.CIRCLE xc yc zc dx dy dz R + aKind = SK_CIRCLE; + + gp_Pnt aC = anInfo.Location(); + theDoubles->Append(aC.X()); + theDoubles->Append(aC.Y()); + theDoubles->Append(aC.Z()); + + gp_Ax3 anAx3 = anInfo.Position(); + gp_Dir aD = anAx3.Direction(); + theDoubles->Append(aD.X()); + theDoubles->Append(aD.Y()); + theDoubles->Append(aD.Z()); + + theDoubles->Append(anInfo.Radius1()); + } + break; + case GEOMAlgo_KN_ARCCIRCLE: + { + // (+) geompy.kind.ARC_CIRCLE xc yc zc dx dy dz R x1 y1 z1 x2 y2 z2 + aKind = SK_ARC_CIRCLE; + + gp_Pnt aC = anInfo.Location(); + theDoubles->Append(aC.X()); + theDoubles->Append(aC.Y()); + theDoubles->Append(aC.Z()); + + gp_Ax3 anAx3 = anInfo.Position(); + gp_Dir aD = anAx3.Direction(); + theDoubles->Append(aD.X()); + theDoubles->Append(aD.Y()); + theDoubles->Append(aD.Z()); + + theDoubles->Append(anInfo.Radius1()); + + gp_Pnt aP1 = anInfo.Pnt1(); + theDoubles->Append(aP1.X()); + theDoubles->Append(aP1.Y()); + theDoubles->Append(aP1.Z()); + + gp_Pnt aP2 = anInfo.Pnt2(); + theDoubles->Append(aP2.X()); + theDoubles->Append(aP2.Y()); + theDoubles->Append(aP2.Z()); + } + break; + case GEOMAlgo_KN_ELLIPSE: + { + // (+) geompy.kind.ELLIPSE xc yc zc dx dy dz R_1 R_2 + aKind = SK_ELLIPSE; + + gp_Pnt aC = anInfo.Location(); + theDoubles->Append(aC.X()); + theDoubles->Append(aC.Y()); + theDoubles->Append(aC.Z()); + + gp_Ax3 anAx3 = anInfo.Position(); + gp_Dir aD = anAx3.Direction(); + theDoubles->Append(aD.X()); + theDoubles->Append(aD.Y()); + theDoubles->Append(aD.Z()); + + theDoubles->Append(anInfo.Radius1()); + theDoubles->Append(anInfo.Radius2()); + } + break; + case GEOMAlgo_KN_ARCELLIPSE: + { + // (+) geompy.kind.ARC_ELLIPSE xc yc zc dx dy dz R_1 R_2 x1 y1 z1 x2 y2 z2 + aKind = SK_ARC_ELLIPSE; + + gp_Pnt aC = anInfo.Location(); + theDoubles->Append(aC.X()); + theDoubles->Append(aC.Y()); + theDoubles->Append(aC.Z()); + + gp_Ax3 anAx3 = anInfo.Position(); + gp_Dir aD = anAx3.Direction(); + theDoubles->Append(aD.X()); + theDoubles->Append(aD.Y()); + theDoubles->Append(aD.Z()); + + theDoubles->Append(anInfo.Radius1()); + theDoubles->Append(anInfo.Radius2()); + + gp_Pnt aP1 = anInfo.Pnt1(); + theDoubles->Append(aP1.X()); + theDoubles->Append(aP1.Y()); + theDoubles->Append(aP1.Z()); + + gp_Pnt aP2 = anInfo.Pnt2(); + theDoubles->Append(aP2.X()); + theDoubles->Append(aP2.Y()); + theDoubles->Append(aP2.Z()); + } + break; + case GEOMAlgo_KN_LINE: + { + // ??? geompy.kind.LINE x1 y1 z1 x2 y2 z2 + // (+) geompy.kind.LINE x1 y1 z1 dx dy dz + aKind = SK_LINE; + + gp_Pnt aO = anInfo.Location(); + theDoubles->Append(aO.X()); + theDoubles->Append(aO.Y()); + theDoubles->Append(aO.Z()); + + gp_Dir aD = anInfo.Direction(); + theDoubles->Append(aD.X()); + theDoubles->Append(aD.Y()); + theDoubles->Append(aD.Z()); + } + break; + case GEOMAlgo_KN_SEGMENT: + { + // (+) geompy.kind.SEGMENT x1 y1 z1 x2 y2 z2 + aKind = SK_SEGMENT; + + gp_Pnt aP1 = anInfo.Pnt1(); + theDoubles->Append(aP1.X()); + theDoubles->Append(aP1.Y()); + theDoubles->Append(aP1.Z()); + + gp_Pnt aP2 = anInfo.Pnt2(); + theDoubles->Append(aP2.X()); + theDoubles->Append(aP2.Y()); + theDoubles->Append(aP2.Z()); + } + break; + default: + // ??? geompy.kind.EDGE nb_vertices _curve_type_id_ + // (+) geompy.kind.EDGE nb_vertices + theIntegers->Append(anInfo.NbSubShapes(TopAbs_VERTEX)); + } + } + break; + + case TopAbs_VERTEX: + { + // (+) geompy.kind.VERTEX x y z + aKind = SK_VERTEX; + + gp_Pnt aP = anInfo.Location(); + theDoubles->Append(aP.X()); + theDoubles->Append(aP.Y()); + theDoubles->Append(aP.Z()); + } + break; + } + + SetErrorCode(OK); + return aKind; +} //============================================================================= /*! Get LCS, corresponding to the given shape. diff --git a/src/GEOMImpl/GEOMImpl_IMeasureOperations.hxx b/src/GEOMImpl/GEOMImpl_IMeasureOperations.hxx index 4a0cc980b..b889d3872 100644 --- a/src/GEOMImpl/GEOMImpl_IMeasureOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_IMeasureOperations.hxx @@ -28,6 +28,8 @@ #include #include #include +#include +#include #include class GEOM_Engine; @@ -38,6 +40,49 @@ class GEOMImpl_IMeasureOperations : public GEOM_IOperations { Standard_EXPORT GEOMImpl_IMeasureOperations(GEOM_Engine* theEngine, int theDocID); Standard_EXPORT ~GEOMImpl_IMeasureOperations(); + enum ShapeKind { + SK_NO_SHAPE, + // COMPOSITEs + SK_COMPOUND, + SK_COMPSOLID, + SK_SHELL, + SK_WIRE, + // SOLIDs + SK_SPHERE, // full sphere + SK_CYLINDER, // cylinder + SK_BOX, // box with faces, parallel to global coordinate planes + SK_ROTATED_BOX, // other box + SK_TORUS, // full torus + SK_CONE, // cone + SK_POLYHEDRON, // solid, bounded by polygons + SK_SOLID, // other solid + // FACEs + SK_SPHERE2D, // spherical face (closed) + SK_CYLINDER2D, // cylindrical face with defined height + SK_TORUS2D, // toroidal face (closed) + SK_CONE2D, // conical face with defined height + SK_DISK_CIRCLE, // planar, bounded by circle + SK_DISK_ELLIPSE, // planar, bounded by ellipse + SK_POLYGON, // planar, bounded by segments + SK_PLANE, // infinite planar + SK_PLANAR, // other planar + SK_FACE, // other face + // EDGEs + SK_CIRCLE, // full circle + SK_ARC_CIRCLE, // arc of circle + SK_ELLIPSE, // full ellipse + SK_ARC_ELLIPSE, // arc of ellipse + SK_LINE, // infinite segment + SK_SEGMENT, // segment + SK_EDGE, // other edge + // VERTEX + SK_VERTEX + }; + + Standard_EXPORT ShapeKind KindOfShape (Handle(GEOM_Object) theShape, + Handle(TColStd_HSequenceOfInteger)& theIntegers, + Handle(TColStd_HSequenceOfReal)& theDoubles); + Standard_EXPORT void GetPosition (Handle(GEOM_Object) theShape, Standard_Real& Ox, Standard_Real& Oy, Standard_Real& Oz, Standard_Real& Zx, Standard_Real& Zy, Standard_Real& Zz, diff --git a/src/GEOMImpl/GEOMImpl_IPipeDiffSect.hxx b/src/GEOMImpl/GEOMImpl_IPipeDiffSect.hxx index 81458260b..711348b97 100644 --- a/src/GEOMImpl/GEOMImpl_IPipeDiffSect.hxx +++ b/src/GEOMImpl/GEOMImpl_IPipeDiffSect.hxx @@ -42,13 +42,15 @@ class GEOMImpl_IPipeDiffSect : public GEOMImpl_IPipe GEOMImpl_IPipeDiffSect(const Handle(GEOM_Function)& theFunction):GEOMImpl_IPipe(theFunction) {} void SetBases (const Handle(TColStd_HSequenceOfTransient)& theBases) - { _func->SetReferenceList(PIPEDS_LIST_BASES,theBases); } + { + _func->SetReferenceList(PIPEDS_LIST_BASES,theBases); + } Handle(TColStd_HSequenceOfTransient) GetBases () { Handle(TColStd_HSequenceOfTransient) aBases = _func->GetReferenceList(PIPEDS_LIST_BASES); return aBases; - } + } void SetLocations (const Handle(TColStd_HSequenceOfTransient)& theLocations) { _func->SetReferenceList(PIPEDS_LIST_LOCATIONS,theLocations); } diff --git a/src/GEOMImpl/GEOMImpl_IPipeShellSect.hxx b/src/GEOMImpl/GEOMImpl_IPipeShellSect.hxx new file mode 100644 index 000000000..590e83697 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IPipeShellSect.hxx @@ -0,0 +1,55 @@ +// 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 Pipe creation. + +#ifndef _GEOMImpl_IPIPESHELLSECT_HXX_ +#define _GEOMImpl_IPIPESHELLSECT_HXX_ + +#include "GEOM_Function.hxx" + +#ifndef _GEOMImpl_IPIPEDIFFSECT_HXX_ +#include "GEOMImpl_IPipeDiffSect.hxx" +#endif + +#define PIPEDS_LIST_SUBBASES 6 + + +class GEOMImpl_IPipeShellSect : public GEOMImpl_IPipeDiffSect +{ + public: + + GEOMImpl_IPipeShellSect(const Handle(GEOM_Function)& theFunction): + GEOMImpl_IPipeDiffSect(theFunction) {} + + void SetSubBases (const Handle(TColStd_HSequenceOfTransient)& theSubBases) + { + _func->SetReferenceList(PIPEDS_LIST_SUBBASES,theSubBases); + } + + Handle(TColStd_HSequenceOfTransient) GetSubBases () + { + Handle(TColStd_HSequenceOfTransient) aSubBases = + _func->GetReferenceList(PIPEDS_LIST_SUBBASES); + return aSubBases; + } + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx index 54d7d9aef..28cae6290 100644 --- a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx @@ -43,6 +43,10 @@ #include "GEOMAlgo_FinderShapeOn2.hxx" #include "GEOMAlgo_ClsfBox.hxx" //#include "GEOMAlgo_ClsfSurf.hxx" +#include "GEOMAlgo_Gluer1.hxx" +#include "GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx" +#include "GEOMAlgo_CoupleOfShapes.hxx" +#include "GEOMAlgo_ListOfCoupleOfShapes.hxx" #include "utilities.h" #include "OpUtil.hxx" @@ -548,6 +552,170 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFaces return aGlued; } +//============================================================================= +/*! + * GetGlueFaces + */ +//============================================================================= +Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetGlueFaces + (Handle(GEOM_Object) theShape, + const Standard_Real theTolerance) +{ + SetErrorCode(KO); + + if (theShape.IsNull()) return NULL; + TopoDS_Shape aShape = theShape->GetValue(); + if (aShape.IsNull()) return NULL; + + Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient; + + Standard_Integer iErr; + TopoDS_Shape aS; + GEOMAlgo_Gluer1 aGluer; + GEOMAlgo_ListIteratorOfListOfCoupleOfShapes aItCS; + GEOMAlgo_CoupleOfShapes aCS; + GEOMAlgo_ListOfCoupleOfShapes aLCS; + + //aGluer = new GEOMAlgo_Gluer1; + aGluer.SetShape(aShape); + aGluer.SetTolerance(theTolerance); + aGluer.Perform(); + iErr = aGluer.ErrorStatus(); + if (iErr) return NULL; + + TopTools_ListOfShape listShape; + const GEOMAlgo_ListOfCoupleOfShapes& aLCSG = aGluer.GluedFaces(); + // Access to faces + aItCS.Initialize(aLCSG); + for (; aItCS.More(); aItCS.Next()) { + const GEOMAlgo_CoupleOfShapes& aCSG = aItCS.Value(); + listShape.Append(aCSG.Shape1()); + } + + TopTools_ListIteratorOfListOfShape itSub (listShape); + TCollection_AsciiString anAsciiList, anEntry; + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aShape, anIndices); + Handle(TColStd_HArray1OfInteger) anArray; + Handle(GEOM_Object) anObj; + for (int index = 1; itSub.More(); itSub.Next(), ++index) { + TopoDS_Shape aValue = itSub.Value(); + anArray = new TColStd_HArray1OfInteger(1,1); + anArray->SetValue(1, anIndices.FindIndex(aValue)); + anObj = GetEngine()->AddSubShape(theShape, anArray); + if (!anObj.IsNull()) { + aSeq->Append(anObj); + + // for python command + TDF_Tool::Entry(anObj->GetEntry(), anEntry); + anAsciiList += anEntry; + anAsciiList += ","; + } + } + + //Make a Python command + if(anAsciiList.Length()>0) + anAsciiList.Trunc(anAsciiList.Length() - 1); + Handle(GEOM_Function) aFunction = theShape->GetLastFunction(); + GEOM::TPythonDump pd (aFunction, /*append=*/true); + pd << "[" << anAsciiList.ToCString(); + pd << "] = geompy.GetGlueFaces" << theShape << ", " << theTolerance << ")"; + + SetErrorCode(OK); + + return aSeq; +} + + +//============================================================================= +/*! + * MakeGlueFacesByList + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFacesByList + (Handle(GEOM_Object) theShape, + const Standard_Real theTolerance, + list theFaces) +{ + SetErrorCode(KO); + + if (theShape.IsNull()) return NULL; + + //Add a new Glued object + Handle(GEOM_Object) aGlued = GetEngine()->AddObject(GetDocID(), GEOM_GLUED); + + //Add a new Glue function + Handle(GEOM_Function) aFunction; + aFunction = aGlued->AddFunction(GEOMImpl_GlueDriver::GetID(), GLUE_FACES_BY_LIST); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_GlueDriver::GetID()) return NULL; + + GEOMImpl_IGlue aCI (aFunction); + + Handle(GEOM_Function) aRefShape = theShape->GetLastFunction(); + if (aRefShape.IsNull()) return NULL; + + aCI.SetBase(aRefShape); + aCI.SetTolerance(theTolerance); + Handle(TColStd_HSequenceOfTransient) aFaces = new TColStd_HSequenceOfTransient; + list::iterator it = theFaces.begin(); + for (; it != theFaces.end(); it++) { + Handle(GEOM_Function) aRefSh = (*it)->GetLastFunction(); + if (aRefSh.IsNull()) { + SetErrorCode("NULL argument shape for the shape construction"); + return NULL; + } + aFaces->Append(aRefSh); + } + aCI.SetFaces(aFaces); + + //Compute the sub-shape value + Standard_Boolean isWarning = Standard_False; + try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Shape driver failed to glue faces"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + // to provide warning + if (!aFunction->GetValue().IsNull()) { + isWarning = Standard_True; + } else { + return NULL; + } + } + + //Make a Python command + + GEOM::TPythonDump pd(aFunction); + pd << aGlued << " = geompy.MakeGlueFacesByList(" + << theShape << ", " << theTolerance << ", ["; + // Faces + it = theFaces.begin(); + if (it != theFaces.end()) { + pd << (*it++); + while (it != theFaces.end()) { + pd << ", " << (*it++); + } + } + pd << "])"; + + + // to provide warning + if (!isWarning) SetErrorCode(OK); + return aGlued; +} + + + //============================================================================= /*! * MakeExplode diff --git a/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx b/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx index 09468c75c..42d2ed991 100644 --- a/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx @@ -60,7 +60,14 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations { Standard_EXPORT Handle(GEOM_Object) MakeCompound (list theShapes); Standard_EXPORT Handle(GEOM_Object) MakeGlueFaces (Handle(GEOM_Object) theShape, - const Standard_Real theTolerance); + const Standard_Real theTolerance); + + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetGlueFaces (Handle(GEOM_Object) theShape, + const Standard_Real theTolerance); + + Standard_EXPORT Handle(GEOM_Object) MakeGlueFacesByList (Handle(GEOM_Object) theShape, + const Standard_Real theTolerance, + list theFaces); Standard_EXPORT Handle(TColStd_HSequenceOfTransient) MakeExplode (Handle(GEOM_Object) theShape, const Standard_Integer theShapeType, @@ -97,11 +104,12 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations { const Handle(GEOM_Object)& theAx1, const GEOMAlgo_State theState); - Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetShapesOnPlaneWithLocation (const Handle(GEOM_Object)& theShape, - const Standard_Integer theShapeType, - const Handle(GEOM_Object)& theAx1, - const Handle(GEOM_Object)& thePnt, - const GEOMAlgo_State theState); + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) + GetShapesOnPlaneWithLocation (const Handle(GEOM_Object)& theShape, + const Standard_Integer theShapeType, + const Handle(GEOM_Object)& theAx1, + const Handle(GEOM_Object)& thePnt, + const GEOMAlgo_State theState); Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetShapesOnCylinder (const Handle(GEOM_Object)& theShape, @@ -121,11 +129,12 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations { const Handle(GEOM_Object)& theAx1, const GEOMAlgo_State theState); - Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetShapesOnPlaneWithLocationIDs (const Handle(GEOM_Object)& theShape, - const Standard_Integer theShapeType, - const Handle(GEOM_Object)& theAx1, - const Handle(GEOM_Object)& thePnt, - const GEOMAlgo_State theState); + Standard_EXPORT Handle(TColStd_HSequenceOfInteger) + GetShapesOnPlaneWithLocationIDs (const Handle(GEOM_Object)& theShape, + const Standard_Integer theShapeType, + const Handle(GEOM_Object)& theAx1, + const Handle(GEOM_Object)& thePnt, + const GEOMAlgo_State theState); Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetShapesOnCylinderIDs (const Handle(GEOM_Object)& theShape, const Standard_Integer theShapeType, @@ -190,18 +199,18 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations { const Standard_Real theRadius); Standard_EXPORT Handle(GEOM_Object) GetInPlace (Handle(GEOM_Object) theShapeWhere, - Handle(GEOM_Object) theShapeWhat); + Handle(GEOM_Object) theShapeWhat); Standard_EXPORT static void SortShapes (TopTools_ListOfShape& SL); /*! * \brief Searches a shape equal to theWhat in the context of theWhere * \param theShapeWhere - a context shap - * \param theShapeWhat - a sample shape + * \param theShapeWhat - a sample shape * \retval Handle(GEOM_Object) - found shape */ - Standard_EXPORT Handle(GEOM_Object) GetSame(const Handle(GEOM_Object)& theShapeWhere, - const Handle(GEOM_Object)& theShapeWhat); + Standard_EXPORT Handle(GEOM_Object) GetSame(const Handle(GEOM_Object)& theShapeWhere, + const Handle(GEOM_Object)& theShapeWhat); /*! * \brief Find IDs of subshapes complying with given status about surface @@ -212,10 +221,10 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations { * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes */ Standard_EXPORT Handle(TColStd_HSequenceOfInteger) - GEOMImpl_IShapesOperations::GetShapesOnBoxIDs(const Handle(GEOM_Object)& theBox, - const Handle(GEOM_Object)& theShape, - const Standard_Integer theShapeType, - GEOMAlgo_State theState); + GetShapesOnBoxIDs(const Handle(GEOM_Object)& theBox, + const Handle(GEOM_Object)& theShape, + const Standard_Integer theShapeType, + GEOMAlgo_State theState); /*! * \brief Find subshapes complying with given status about surface @@ -226,11 +235,10 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations { * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes */ Standard_EXPORT Handle(TColStd_HSequenceOfTransient) - GEOMImpl_IShapesOperations::GetShapesOnBox(const Handle(GEOM_Object)& theBox, - const Handle(GEOM_Object)& theShape, - const Standard_Integer theShapeType, - GEOMAlgo_State theState); - + GetShapesOnBox(const Handle(GEOM_Object)& theBox, + const Handle(GEOM_Object)& theShape, + const Standard_Integer theShapeType, + GEOMAlgo_State theState); private: Handle(GEOM_Object) MakeShape (list theShapes, @@ -295,8 +303,7 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations { const Handle(GEOM_Object)& theShape, TopAbs_ShapeEnum theShapeType, GEOMAlgo_State theState, - TCollection_AsciiString & theShapeEntries - ); + TCollection_AsciiString & theShapeEntries); /*! * \brief Find IDs of subshapes complying with given status about quadrangle @@ -326,11 +333,10 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations { * \param theState - required state * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes */ - Handle(TColStd_HSequenceOfInteger) - GEOMImpl_IShapesOperations::getShapesOnBoxIDs(const Handle(GEOM_Object)& theBox, - const Handle(GEOM_Object)& theShape, - const Standard_Integer theShapeType, - GEOMAlgo_State theState); + Handle(TColStd_HSequenceOfInteger) getShapesOnBoxIDs(const Handle(GEOM_Object)& theBox, + const Handle(GEOM_Object)& theShape, + const Standard_Integer theShapeType, + GEOMAlgo_State theState); /*! * \brief Find shape objects and their entries by their ids diff --git a/src/GEOMImpl/GEOMImpl_PipeDriver.cxx b/src/GEOMImpl/GEOMImpl_PipeDriver.cxx index d0875f842..b14de152b 100644 --- a/src/GEOMImpl/GEOMImpl_PipeDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PipeDriver.cxx @@ -35,9 +35,13 @@ #include #include #include +#include +#include +#include #include #include #include +#include #include #include @@ -47,6 +51,20 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//#include + //======================================================================= //function : GetID @@ -67,6 +85,834 @@ GEOMImpl_PipeDriver::GEOMImpl_PipeDriver() { } + +//======================================================================= +//function : FillForOtherEdges +//purpose : auxilary for CreatePipeForShellSections() +//======================================================================= +static bool FillForOtherEdges(const TopoDS_Shape& F1, + const TopoDS_Shape& E1, + const TopoDS_Shape& V1, + TopTools_IndexedDataMapOfShapeShape& FF) +{ + //cout<<"FillForOtherEdges"<GetBases(); + Handle(TColStd_HSequenceOfTransient) aSubBasesObjs = aCIDS->GetSubBases(); + Handle(TColStd_HSequenceOfTransient) aLocObjs = aCIDS->GetLocations(); + Standard_Boolean aWithContact = (aCIDS->GetWithContactMode()); + Standard_Boolean aWithCorrect = (aCIDS->GetWithCorrectionMode()); + + Standard_Integer nbBases = aBasesObjs->Length(), + nbSubBases = (aSubBasesObjs.IsNull() ? 0 :aSubBasesObjs->Length()), + nbLocs = (aLocObjs.IsNull() ? 0 :aLocObjs->Length()); + + if( nbLocs != nbBases) { + if(aCI) delete aCI; + Standard_ConstructionError::Raise("Number of sections is not equal to number of locations "); + } + if( nbSubBases && nbSubBases != nbBases) { + if(aCI) delete aCI; + Standard_ConstructionError::Raise("Number of sections is not equal to number of subsections "); + } + + //BRepOffsetAPI_MakePipeShell aBuilder(aWirePath); + + TopTools_SequenceOfShape VLocs; + for(i=1; i<=nbBases; i++) { + Handle(Standard_Transient) anItemLoc = aLocObjs->Value(i); + if(anItemLoc.IsNull()) + continue; + Handle(GEOM_Function) aRefLoc = Handle(GEOM_Function)::DownCast(anItemLoc); + TopoDS_Shape aShapeLoc = aRefLoc->GetValue(); + if(aShapeLoc.IsNull() || aShapeLoc.ShapeType() != TopAbs_VERTEX) + continue; + VLocs.Append(aShapeLoc); + } + nbLocs = VLocs.Length(); + if( nbLocs != nbBases) { + if(aCI) delete aCI; + Standard_ConstructionError::Raise("One of location shapes is not a vertex"); + } + // split wire path by location points + TColgp_SequenceOfPnt PLocs; + for(i=1; i<=nbLocs; i++) { + TopoDS_Vertex V = TopoDS::Vertex(VLocs.Value(i)); + PLocs.Append(BRep_Tool::Pnt(V)); + } + TopTools_SequenceOfShape Edges; + TopTools_SequenceOfShape Wires; + TopExp_Explorer anExp; + for ( anExp.Init( aWirePath, TopAbs_EDGE ); anExp.More(); anExp.Next() ) { + Edges.Append(anExp.Current()); + } + ShapeAnalysis_Edge sae; + TopoDS_Edge edge = TopoDS::Edge(Edges.First()); + double tol = BRep_Tool::Tolerance(edge); + TopoDS_Vertex VF = sae.FirstVertex(edge); + gp_Pnt PF = BRep_Tool::Pnt(VF); + //cout<<"PF("< tol ) { + if(aCI) delete aCI; + Standard_ConstructionError::Raise + ("First location shapes is not coincided with first vertex of aWirePath"); + } + edge = TopoDS::Edge(Edges.Last()); + tol = BRep_Tool::Tolerance(edge); + TopoDS_Vertex VL = sae.LastVertex(edge); + gp_Pnt PL = BRep_Tool::Pnt(VL); + if( PL.Distance(PLocs.Last()) > tol ) { + if(aCI) delete aCI; + Standard_ConstructionError::Raise + ("Last location shapes is not coincided with last vertex of aWirePath"); + } + int jcurr = 2; + TopTools_SequenceOfShape tmpEdges; + for(i=1; i<=Edges.Length() && jcurr0 && + PLocs.Value(jcurr).Distance(PPC.Point(1)) < tol ) { + double param = PPC.Parameter(1); + gp_Pnt PC1; + C->D0(param,PC1); + // split current edge + Handle(Geom_TrimmedCurve) tc1 = new Geom_TrimmedCurve(C,fp,param); + Handle(Geom_TrimmedCurve) tc2 = new Geom_TrimmedCurve(C,param,lp); + TopoDS_Edge E1,E2; + if(PC1.Distance(P1)Value(i); + if(anItem1.IsNull()) + continue; + Handle(GEOM_Function) aRefBase1 = Handle(GEOM_Function)::DownCast(anItem1); + if(aRefBase1.IsNull()) + continue; + TopoDS_Shape aShBase1 = aRefBase1->GetValue(); + if(aShBase1.IsNull()) + continue; + TopAbs_ShapeEnum aType1 = aShBase1.ShapeType(); + // 2 section + Handle(Standard_Transient) anItem2 = aBasesObjs->Value(i+1); + if(anItem2.IsNull()) + continue; + Handle(GEOM_Function) aRefBase2 = Handle(GEOM_Function)::DownCast(anItem2); + if(aRefBase2.IsNull()) + continue; + TopoDS_Shape aShBase2 = aRefBase2->GetValue(); + if(aShBase2.IsNull()) + continue; + TopAbs_ShapeEnum aType2 = aShBase2.ShapeType(); + + //BRepTools::Write(aShBase1,"/dn02/users_Linux/skl/work/Bugs/14857/base1.brep"); + + bool OkSec = ( aType1==TopAbs_SHELL || aType1==TopAbs_FACE ) && + ( aType2==TopAbs_SHELL || aType2==TopAbs_FACE ); + if( !OkSec ) { + if(aCI) delete aCI; + Standard_ConstructionError::Raise("One of section shapes has invalid type"); + } + + bool CreateFewSolids = false; + // compare sections + TopExp_Explorer anExp; + Standard_Integer nbf1 = 0; + for ( anExp.Init( aShBase1, TopAbs_FACE ); anExp.More(); anExp.Next() ) { + nbf1++; + } + Standard_Integer nbf2 = 0; + for ( anExp.Init( aShBase2, TopAbs_FACE ); anExp.More(); anExp.Next() ) { + nbf2++; + } + if(nbf1==nbf2) { + CreateFewSolids = true; + } + + if(!CreateFewSolids) { + // we can create only one solid + TopoDS_Shape aWire1, aWire2; + // prepare aWire1 + if(aType1==TopAbs_SHELL) { + // create wire as boundary contour if shell is no closed + // get free boundary shapes + ShapeAnalysis_FreeBounds anAnalizer( aShBase1 ); + TopoDS_Compound aClosed = anAnalizer.GetClosedWires(); + //TopExp_Explorer anExp; + Standard_Integer NbWires = 0; + for ( anExp.Init( aClosed, TopAbs_WIRE ); anExp.More(); anExp.Next() ) { + NbWires++; + aWire1 = anExp.Current(); + } + if(NbWires!=1) { + // bad case + if(aCI) delete aCI; + Standard_ConstructionError::Raise("Bad shell is used as section "); + } + } + else { // aType1==TopAbs_FACE + TopExp_Explorer aExpW(aShBase1,TopAbs_WIRE); + aWire1 = aExpW.Current(); + } + // prepare aWire2 + if(aType2==TopAbs_SHELL) { + // create wire as boundary contour if shell is no closed + // get free boundary shapes + ShapeAnalysis_FreeBounds anAnalizer( aShBase2 ); + TopoDS_Compound aClosed = anAnalizer.GetClosedWires(); + //TopExp_Explorer anExp; + Standard_Integer NbWires = 0; + for ( anExp.Init( aClosed, TopAbs_WIRE ); anExp.More(); anExp.Next() ) { + NbWires++; + aWire2 = anExp.Current(); + } + if(NbWires!=1) { + // bad case + if(aCI) delete aCI; + Standard_ConstructionError::Raise("Bad shell is used as section "); + } + } + else { // aType2==TopAbs_FACE + TopExp_Explorer aExpW(aShBase2,TopAbs_WIRE); + aWire2 = aExpW.Current(); + } + // make pipe using aWire1 and aWire2 + if( !aWire1.IsNull() && !aWire2.IsNull() ) { + //BRepOffsetAPI_MakePipeShell aBuilder(aWirePath); + BRepOffsetAPI_MakePipeShell aBuilder(WPath); + aBuilder.Add(aWire1, TopoDS::Vertex(VLocs(i)), + aWithContact, aWithCorrect); + aBuilder.Add(aWire2, TopoDS::Vertex(VLocs(i+1)), + aWithContact, aWithCorrect); + if(!aBuilder.IsReady()) { + if(aCI) delete aCI; + Standard_ConstructionError::Raise("Invalid input data for building PIPE: bases are invalid"); + } + aBuilder.Build(); + TopoDS_Shape aShape = aBuilder.Shape(); + TopoDS_Shell aShell; + B.MakeShell(aShell); + for ( anExp.Init( aShape, TopAbs_FACE ); anExp.More(); anExp.Next() ) { + B.Add(aShell,anExp.Current()); + } + for ( anExp.Init( aShBase1, TopAbs_FACE ); anExp.More(); anExp.Next() ) { + B.Add(aShell,anExp.Current()); + } + for ( anExp.Init( aShBase2, TopAbs_FACE ); anExp.More(); anExp.Next() ) { + B.Add(aShell,anExp.Current()); + } + // make sewing for this shell + Handle(BRepBuilderAPI_Sewing) aSewing = new BRepBuilderAPI_Sewing; + aSewing->SetTolerance(Precision::Confusion()); + aSewing->SetFaceMode(Standard_True); + aSewing->SetFloatingEdgesMode(Standard_False); + aSewing->SetNonManifoldMode(Standard_False); + for ( anExp.Init( aShell, TopAbs_FACE ); anExp.More(); anExp.Next() ) { + aSewing->Add(anExp.Current()); + } + aSewing->Perform(); + const TopoDS_Shape aSewShape = aSewing->SewedShape(); + if( aSewShape.ShapeType() == TopAbs_SHELL ) { + aShell = TopoDS::Shell(aSewShape); + if(BRep_Tool::IsClosed(aShell)) { + TopoDS_Solid aSolid; + B.MakeSolid(aSolid); + B.Add(aSolid,aShell); + B.Add(aComp,aSolid); + } + else { + B.Add(aComp,aShell); + } + } + else { + B.Add(aComp,aShell); + } + } + } + else { + // main block - creation few solids (for each pair of faces) + TopTools_MapOfShape aFaces1,aFaces2; + for ( anExp.Init( aShBase1, TopAbs_FACE ); anExp.More(); anExp.Next() ) + aFaces1.Add(anExp.Current()); + for ( anExp.Init( aShBase2, TopAbs_FACE ); anExp.More(); anExp.Next() ) + aFaces2.Add(anExp.Current()); + // creating map of edge faces + TopTools_IndexedDataMapOfShapeListOfShape aMapEdgeFaces1; + TopExp::MapShapesAndAncestors(aShBase1, TopAbs_EDGE, TopAbs_FACE, aMapEdgeFaces1); + TopTools_IndexedDataMapOfShapeListOfShape aMapEdgeFaces2; + TopExp::MapShapesAndAncestors(aShBase2, TopAbs_EDGE, TopAbs_FACE, aMapEdgeFaces2); + + // constuct map face->face + TopTools_IndexedDataMapOfShapeShape FF; + TopoDS_Shape FS1,FS2; + if(nbSubBases==0) { + // find edge the most distant from location point + // (this edge is not shared by two faces) + double maxdist = 0.; + TopoDS_Shape E1; + TopoDS_Vertex V11,V21; + for(j=1; j<=aMapEdgeFaces1.Extent(); j++) { + TopoDS_Shape tmp = aMapEdgeFaces1.FindKey(j); + const TopTools_ListOfShape& aList = aMapEdgeFaces1.FindFromKey(tmp); + if(aList.Extent()>1) + continue; + TopExp_Explorer expv; + expv.Init( tmp, TopAbs_VERTEX ); + TopoDS_Vertex V1 = TopoDS::Vertex(expv.Current()); + expv.Next(); + TopoDS_Vertex V2 = TopoDS::Vertex(expv.Current()); + gp_Pnt P1 = BRep_Tool::Pnt(V1); + gp_Pnt P2 = BRep_Tool::Pnt(V2); + double dist = PLocs.Value(i).Distance(P1) + PLocs.Value(i).Distance(P2); + if(dist>maxdist) { + E1 = tmp; + V11 = V1; + V21 = V2; + TopTools_ListIteratorOfListOfShape anIter(aList); + FS1 = anIter.Value(); + maxdist = dist; + } + } + // main direction for comparing + gp_Vec VM(PLocs.Value(i),PLocs.Value(i+1)); + // find corresponding edge from next section + double minang = PI; + gp_Pnt P11 = BRep_Tool::Pnt(V11); + gp_Pnt P21 = BRep_Tool::Pnt(V21); + TopoDS_Shape E2; + TopoDS_Vertex V12,V22; + for(j=1; j<=aMapEdgeFaces2.Extent(); j++) { + TopoDS_Shape tmp = aMapEdgeFaces2.FindKey(j); + const TopTools_ListOfShape& aList = aMapEdgeFaces2.FindFromKey(tmp); + if(aList.Extent()>1) + continue; + TopExp_Explorer expv; + expv.Init( tmp, TopAbs_VERTEX ); + TopoDS_Vertex V1tmp = TopoDS::Vertex(expv.Current()); + expv.Next(); + TopoDS_Vertex V2tmp = TopoDS::Vertex(expv.Current()); + gp_Pnt P1tmp = BRep_Tool::Pnt(V1tmp); + gp_Pnt P2tmp = BRep_Tool::Pnt(V2tmp); + double d1 = P1tmp.Distance(P11) + P2tmp.Distance(P21); + double d2 = P1tmp.Distance(P21) + P2tmp.Distance(P11); + TopoDS_Vertex V1,V2; + gp_Pnt P1,P2; + if(d1>d2) { + V1 = V2tmp; P1 = P2tmp; + V2 = V1tmp; P2 = P1tmp; + } + else { + V1 = V1tmp; P1 = P1tmp; + V2 = V2tmp; P2 = P2tmp; + } + gp_Vec Vec1(P11,P1); + gp_Vec Vec2(P21,P2); + double ang = fabs(Vec1.Angle(VM)) + fabs(Vec2.Angle(VM)); + if(angValue(i); + if(anItem.IsNull()) { + if(aCI) delete aCI; + Standard_ConstructionError::Raise("Invalid subbase shape"); + } + Handle(GEOM_Function) aRefBase = Handle(GEOM_Function)::DownCast(anItem); + if(aRefBase.IsNull()) { + if(aCI) delete aCI; + Standard_ConstructionError::Raise("Invalid subbase shape"); + } + TopoDS_Shape aSh = aRefBase->GetValue(); + if(aSh.IsNull()) { + if(aCI) delete aCI; + Standard_ConstructionError::Raise("Invalid subbase shape"); + } + if(aSh.ShapeType()!=TopAbs_FACE) { + if(aCI) delete aCI; + Standard_ConstructionError::Raise("Invalid subbase shape"); + } + FS1 = aSh; + } + { // 2 section + Handle(Standard_Transient) anItem = aSubBasesObjs->Value(i+1); + if(anItem.IsNull()) { + if(aCI) delete aCI; + Standard_ConstructionError::Raise("Invalid subbase shape"); + } + Handle(GEOM_Function) aRefBase = Handle(GEOM_Function)::DownCast(anItem); + if(aRefBase.IsNull()) { + if(aCI) delete aCI; + Standard_ConstructionError::Raise("Invalid subbase shape"); + } + TopoDS_Shape aSh = aRefBase->GetValue(); + if(aSh.IsNull()) { + if(aCI) delete aCI; + Standard_ConstructionError::Raise("Invalid subbase shape"); + } + if(aSh.ShapeType()!=TopAbs_FACE) { + if(aCI) delete aCI; + Standard_ConstructionError::Raise("Invalid subbase shape"); + } + FS2 = aSh; + } + + if( !aFaces1.Contains(FS1) || !aFaces2.Contains(FS2) ) { + if(aCI) delete aCI; + Standard_ConstructionError::Raise("Invalid subbase shape"); + } + + FF.Add(FS1,FS2); + + // add pairs of edges to FF + bool stat = FillCorrespondingEdges(FS1, FS2, TopoDS::Vertex(VLocs(i)), + TopoDS::Vertex(VLocs(i+1)), WPath, FF); + if( !stat ) { + if(aCI) delete aCI; + Standard_ConstructionError::Raise("Can not create correct pipe"); + } + } + + FindNextPairOfFaces(FS1, aMapEdgeFaces1, aMapEdgeFaces2, FF, aCI); + + + // make pipe for each pair of faces + //BRepTools::Write(WPath,"/dn02/users_Linux/skl/work/Bugs/14857/wpath.brep"); + for(j=1; j<=FF.Extent(); j++) { + TopoDS_Shape F1 = FF.FindKey(j); + if( F1.ShapeType() != TopAbs_FACE ) + continue; + TopoDS_Shape F2 = FF.FindFromIndex(j); + TopExp_Explorer aExpW1(F1,TopAbs_WIRE); + TopoDS_Wire aWire1 = TopoDS::Wire(aExpW1.Current()); + TopExp_Explorer aExpW2(F2,TopAbs_WIRE); + TopoDS_Wire aWire2 = TopoDS::Wire(aExpW2.Current()); + // make pipe using aWire1 and aWire2 + if( !aWire1.IsNull() && !aWire2.IsNull() ) { + BRepOffsetAPI_MakePipeShell aBuilder(WPath); + aBuilder.Add(aWire1, TopoDS::Vertex(VLocs(i)), + aWithContact, aWithCorrect); + aBuilder.Add(aWire2, TopoDS::Vertex(VLocs(i+1)), + aWithContact, aWithCorrect); + if(!aBuilder.IsReady()) { + if(aCI) delete aCI; + Standard_ConstructionError::Raise("Invalid input data for building PIPE: bases are invalid"); + } + aBuilder.Build(); + TopoDS_Shape aShape = aBuilder.Shape(); + TopoDS_Shell aShell; + B.MakeShell(aShell); + //int nbf=0; + for ( anExp.Init( aShape, TopAbs_FACE ); anExp.More(); anExp.Next() ) { + //nbf++; + //cout<<"nbf="<SetTolerance(Precision::Confusion()); + aSewing->SetFaceMode(Standard_True); + aSewing->SetFloatingEdgesMode(Standard_False); + aSewing->SetNonManifoldMode(Standard_False); + for ( anExp.Init( aShell, TopAbs_FACE ); anExp.More(); anExp.Next() ) { + aSewing->Add(anExp.Current()); + } + aSewing->Perform(); + const TopoDS_Shape aSewShape = aSewing->SewedShape(); + if( aSewShape.ShapeType() == TopAbs_SHELL ) { + aShell = TopoDS::Shell(aSewShape); + if(BRep_Tool::IsClosed(aShell)) { + TopoDS_Solid aSolid; + B.MakeSolid(aSolid); + B.Add(aSolid,aShell); + B.Add(aComp,aSolid); + } + else { + B.Add(aComp,aShell); + } + } + else { + B.Add(aComp,aShell); + } + } + } + + } + } + + return aComp; +} + + //======================================================================= //function : Execute //purpose : @@ -81,6 +927,8 @@ Standard_Integer GEOMImpl_PipeDriver::Execute(TFunction_Logbook& log) const aCI = new GEOMImpl_IPipe(aFunction); else if(aType == PIPE_DIFFERENT_SECTIONS) aCI = new GEOMImpl_IPipeDiffSect(aFunction); + else if(aType == PIPE_SHELL_SECTIONS) + aCI = new GEOMImpl_IPipeShellSect(aFunction); else return 0; @@ -88,8 +936,7 @@ Standard_Integer GEOMImpl_PipeDriver::Execute(TFunction_Logbook& log) const TopoDS_Shape aShapePath = aRefPath->GetValue(); - if (aShapePath.IsNull()) - { + if (aShapePath.IsNull()) { cout<<"Driver : path is null"<GetBase(); @@ -167,8 +1012,31 @@ Standard_Integer GEOMImpl_PipeDriver::Execute(TFunction_Logbook& log) const //if for section was specified face with a few wires then a few // pipes were build and make solid - if(aTypeBase == TopAbs_FACE) + Standard_Boolean NeedCreateSolid = Standard_False; + if(aTypeBase == TopAbs_SHELL) { + // create wire as boundary contour if shell is no closed + // get free boundary shapes + ShapeAnalysis_FreeBounds anAnalizer( aShapeBase ); + TopoDS_Compound aClosed = anAnalizer.GetClosedWires(); + TopExp_Explorer anExp; + TopoDS_Shape aWire; + Standard_Integer NbWires = 0; + for ( anExp.Init( aClosed, TopAbs_WIRE ); anExp.More(); anExp.Next() ) { + NbWires++; + aWire = anExp.Current(); + } + if(NbWires!=1) { + // bad case + if(aCI) delete aCI; + Standard_ConstructionError::Raise("Bad shell is used as section "); + } + NeedCreateSolid = Standard_True; + aSeqFaces.Append(aShapeBase); + aSeqBases.Append(aWire); + } + else if(aTypeBase == TopAbs_FACE) { + NeedCreateSolid = Standard_True; //for case one path should be used other type function aSeqFaces.Append(aShapeBase); TopExp_Explorer aExpW(aShapeBase,TopAbs_WIRE); @@ -178,8 +1046,9 @@ Standard_Integer GEOMImpl_PipeDriver::Execute(TFunction_Logbook& log) const aSeqBases.Append(aWireProf); } } - else if(aTypeBase == TopAbs_WIRE || aTypeBase == TopAbs_VERTEX) + else if(aTypeBase == TopAbs_WIRE || aTypeBase == TopAbs_VERTEX) { aSeqBases.Append(aShapeBase); + } else if(aTypeBase == TopAbs_EDGE) { TopoDS_Edge anEdge = TopoDS::Edge(aShapeBase); @@ -252,6 +1121,12 @@ Standard_Integer GEOMImpl_PipeDriver::Execute(TFunction_Logbook& log) const aShape = aComp; } } + + //building pipe with shell sections + else if (aType == PIPE_SHELL_SECTIONS) { + aShape = CreatePipeForShellSections(aWirePath,aCI); + } + if (aShape.IsNull()) return 0; BRepCheck_Analyzer ana (aShape, Standard_False); @@ -309,3 +1184,4 @@ const Handle(GEOMImpl_PipeDriver) Handle(GEOMImpl_PipeDriver)::DownCast(const Ha return _anOtherObject ; } + diff --git a/src/GEOMImpl/GEOMImpl_PipeDriver.hxx b/src/GEOMImpl/GEOMImpl_PipeDriver.hxx index 888b2cd5d..b57defc89 100644 --- a/src/GEOMImpl/GEOMImpl_PipeDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_PipeDriver.hxx @@ -48,6 +48,7 @@ #include #endif + class Standard_Transient; class Handle_Standard_Type; class Handle(TFunction_Driver); @@ -136,22 +137,25 @@ public: if (anAddress) Standard::Free((Standard_Address&)anAddress); } - // Methods PUBLIC - // -Standard_EXPORT GEOMImpl_PipeDriver(); -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_PipeDriver() {}; - - - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_PipeDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_PipeDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_PipeDriver) == AType || TFunction_Driver::IsKind(AType)); } - + // Methods PUBLIC + // + Standard_EXPORT GEOMImpl_PipeDriver(); + 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_PipeDriver() {}; + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_PipeDriver_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const + { return STANDARD_TYPE(GEOMImpl_PipeDriver) ; } + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const + { return (STANDARD_TYPE(GEOMImpl_PipeDriver) == AType || + TFunction_Driver::IsKind(AType)); } }; diff --git a/src/GEOMImpl/GEOMImpl_Types.hxx b/src/GEOMImpl/GEOMImpl_Types.hxx index c1c516fb7..adf629917 100755 --- a/src/GEOMImpl/GEOMImpl_Types.hxx +++ b/src/GEOMImpl/GEOMImpl_Types.hxx @@ -162,6 +162,7 @@ #define PIPE_BASE_PATH 1 #define PIPE_DIFFERENT_SECTIONS 2 +#define PIPE_SHELL_SECTIONS 3 #define THRUSECTIONS_RULED 1 #define THRUSECTIONS_SMOOTHED 2 @@ -186,6 +187,7 @@ #define ELLIPSE_PNT_VEC_RR 1 #define CIRC_ARC_THREE_PNT 1 +#define CIRC_ARC_CENTER 2 #define FILLET_SHAPE_ALL 1 #define FILLET_SHAPE_EDGES 2 @@ -221,6 +223,7 @@ #define BASIC_FILLING 1 #define GLUE_FACES 1 +#define GLUE_FACES_BY_LIST 2 #define SKETCHER_NINE_DOUBLS 1 #define SKETCHER_PLANE 2 diff --git a/src/GEOMImpl/Makefile.am b/src/GEOMImpl/Makefile.am index fd4f9639d..6ffbd0ce8 100644 --- a/src/GEOMImpl/Makefile.am +++ b/src/GEOMImpl/Makefile.am @@ -36,15 +36,15 @@ salomeinclude_HEADERS = \ GEOMImpl_Gen.hxx \ GEOMImpl_IBasicOperations.hxx \ GEOMImpl_ITransformOperations.hxx \ - GEOMImpl_IHealingOperations.hxx \ + GEOMImpl_IHealingOperations.hxx \ GEOMImpl_I3DPrimOperations.hxx \ GEOMImpl_IShapesOperations.hxx \ GEOMImpl_IBlocksOperations.hxx \ GEOMImpl_IBooleanOperations.hxx \ GEOMImpl_ICurvesOperations.hxx \ GEOMImpl_ILocalOperations.hxx \ - GEOMImpl_IInsertOperations.hxx \ - GEOMImpl_IMeasureOperations.hxx \ + GEOMImpl_IInsertOperations.hxx \ + GEOMImpl_IMeasureOperations.hxx \ GEOMImpl_IGroupOperations.hxx \ GEOMImpl_CopyDriver.hxx \ GEOMImpl_Types.hxx \ diff --git a/src/GEOMToolsGUI/GEOMToolsGUI.cxx b/src/GEOMToolsGUI/GEOMToolsGUI.cxx index 1e9479c1c..4a3e34a71 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI.cxx @@ -46,6 +46,7 @@ #include #include #include +#include #include #include @@ -154,6 +155,46 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent) Export(); break; } + case 2171: // POPUP VIEWER - SELECT ONLY - VERTEX + { + OnSelectOnly( GEOM_POINT ); + break; + } + case 2172: // POPUP VIEWER - SELECT ONLY - EDGE + { + OnSelectOnly( GEOM_EDGE ); + break; + } + case 2173: // POPUP VIEWER - SELECT ONLY - WIRE + { + OnSelectOnly( GEOM_WIRE ); + break; + } + case 2174: // POPUP VIEWER - SELECT ONLY - FACE + { + OnSelectOnly( GEOM_FACE ); + break; + } + case 2175: // POPUP VIEWER - SELECT ONLY - SHELL + { + OnSelectOnly( GEOM_SHELL ); + break; + } + case 2176: // POPUP VIEWER - SELECT ONLY - SOLID + { + OnSelectOnly( GEOM_SOLID ); + break; + } + case 2177: // POPUP VIEWER - SELECT ONLY - COMPOUND + { + OnSelectOnly( GEOM_COMPOUND ); + break; + } + case 2178: // POPUP VIEWER - SELECT ONLY - SELECT ALL + { + OnSelectOnly( GEOM_ALLOBJECTS ); + break; + } case 411: // SETTINGS - ADD IN STUDY { // SAN -- TO BE REMOVED !!! @@ -459,7 +500,6 @@ bool GEOMToolsGUI::Import() anObj = aInsOp->Import(fileN, fileT); if ( !anObj->_is_nil() && aInsOp->IsDone() ) { - anObj->SetName(GEOMBase::GetDefaultName(QObject::tr("GEOM_IMPORT")).latin1()); QString aPublishObjName = GEOMBase::GetDefaultName(SUIT_Tools::file(fileName, /*withExten=*/true)); @@ -703,6 +743,21 @@ bool GEOMToolsGUI::CheckSubObjectInUse(_PTR(SObject) checkobj, return false; } +//================================================================================= +// function : deactivate() +// purpose : Called when GEOM component is deactivated +//================================================================================= +void GEOMToolsGUI::deactivate() +{ + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + if ( app ) { + SalomeApp_Study* appStudy = dynamic_cast( app->activeStudy() ); + GEOM_Displayer aDisp (appStudy); + aDisp.GlobalSelection(); + getGeometryGUI()->setLocalSelectionMode(GEOM_ALLOBJECTS); + } +} + //===================================================================================== // EXPORTED METHODS //===================================================================================== diff --git a/src/GEOMToolsGUI/GEOMToolsGUI.h b/src/GEOMToolsGUI/GEOMToolsGUI.h index c2c9344d5..07dec456e 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI.h +++ b/src/GEOMToolsGUI/GEOMToolsGUI.h @@ -54,6 +54,7 @@ public : ~GEOMToolsGUI(); bool OnGUIEvent( int theCommandID, SUIT_Desktop* parent ); + virtual void deactivate(); private: // Import and export topology methods @@ -74,7 +75,8 @@ private: void OnTransparency(); void OnNbIsos(); void OnOpen(); - + void OnSelectOnly(int mode); + // returns name of Module (Component) of given objects (usually selected objects) // if objects belong to different Components, a NULL string is returned. QString getParentComponent( _PTR( Study ), const SALOME_ListIO& ); diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx index 94c92abfc..2becab38d 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx @@ -202,6 +202,10 @@ void GEOMToolsGUI::OnRename() if ( !newName.isEmpty() ) { aName->SetValue( newName.latin1() ); // rename the SObject IObject->setName( newName.latin1() );// rename the InteractiveObject + // Rename the corresponding GEOM_Object + GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(obj)); + if (!CORBA::is_nil( anObj )) + anObj->SetName( newName.latin1() ); (dynamic_cast(app->activeModule()))->updateObjBrowser( false ); } } // if ( name attribute ) @@ -433,3 +437,14 @@ void GEOMToolsGUI::OnOpen() } */ } + +void GEOMToolsGUI::OnSelectOnly(int mode) +{ + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + if ( app ) { + SalomeApp_Study* appStudy = dynamic_cast( app->activeStudy() ); + GEOM_Displayer aDisp (appStudy); + aDisp.GlobalSelection(mode); + getGeometryGUI()->setLocalSelectionMode(mode); + } +} diff --git a/src/GEOMToolsGUI/Makefile.am b/src/GEOMToolsGUI/Makefile.am index 55acdfefd..45092979a 100644 --- a/src/GEOMToolsGUI/Makefile.am +++ b/src/GEOMToolsGUI/Makefile.am @@ -70,6 +70,7 @@ libGEOMToolsGUI_la_CPPFLAGS = \ -I$(srcdir)/../GEOMBase \ -I$(srcdir)/../GEOMGUI \ -I$(srcdir)/../GEOMClient \ + -I$(srcdir)/../GEOMImpl \ -I$(top_builddir)/idl \ -I$(top_builddir)/salome_adm/unix diff --git a/src/GEOM_I/GEOM_Gen_i.cc b/src/GEOM_I/GEOM_Gen_i.cc index 2ae6d0a59..0ba246973 100644 --- a/src/GEOM_I/GEOM_Gen_i.cc +++ b/src/GEOM_I/GEOM_Gen_i.cc @@ -272,6 +272,9 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy, anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributeName"); SALOMEDS::AttributeName_var aNameAttrib = SALOMEDS::AttributeName::_narrow(anAttr); aNameAttrib->SetValue(aShapeName.ToCString()); + + //Set a name of the GEOM object + aShape->SetName(theName); return aResultSO._retn(); } @@ -287,6 +290,17 @@ SALOMEDS::TMPFile* GEOM_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent, SALOMEDS::TMPFile_var aStreamFile; // Get a temporary directory to store a file std::string aTmpDir = (isMultiFile)?theURL:SALOMEDS_Tool::GetTmpDir(); + + // OCCT BUG: cannot save a document (in current folder) + // if directory name is empty + if (aTmpDir.size() == 0) { +#ifdef WNT + aTmpDir = ".\\"; +#else + aTmpDir = "./"; +#endif + } + // Create a list to store names of created files SALOMEDS::ListOfFileNames_var aSeq = new SALOMEDS::ListOfFileNames; aSeq->length(1); @@ -338,8 +352,20 @@ CORBA::Boolean GEOM_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent, // Get a temporary directory for a file std::string aTmpDir = isMultiFile?theURL:SALOMEDS_Tool::GetTmpDir(); + + // OCCT BUG: cannot load a document (from current folder) + // if directory name is empty + if (aTmpDir.size() == 0) { +#ifdef WNT + aTmpDir = ".\\"; +#else + aTmpDir = "./"; +#endif + } + // Conver the byte stream theStream to a file and place it in tmp directory - SALOMEDS::ListOfFileNames_var aSeq = SALOMEDS_Tool::PutStreamToFiles(theStream, aTmpDir.c_str(), isMultiFile); + SALOMEDS::ListOfFileNames_var aSeq = + SALOMEDS_Tool::PutStreamToFiles(theStream, aTmpDir.c_str(), isMultiFile); // Prepare a file name to open TCollection_AsciiString aNameWithExt(""); diff --git a/src/GEOM_I/GEOM_I3DPrimOperations_i.cc b/src/GEOM_I/GEOM_I3DPrimOperations_i.cc index 561d24512..83a98e3a4 100644 --- a/src/GEOM_I/GEOM_I3DPrimOperations_i.cc +++ b/src/GEOM_I/GEOM_I3DPrimOperations_i.cc @@ -582,3 +582,80 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithDifferentSections(co return GetObject(anObject); } + + +//============================================================================= +/*! + * MakePipeWithShellSections + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithShellSections + (const GEOM::ListOfGO& theBases, + const GEOM::ListOfGO& theSubBases, + const GEOM::ListOfGO& theLocations, + GEOM::GEOM_Object_ptr thePath, + CORBA::Boolean theWithContact, + CORBA::Boolean theWithCorrections) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient; + Handle(TColStd_HSequenceOfTransient) aSeqSubBases = new TColStd_HSequenceOfTransient; + Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient; + int ind=0, aNbBases=0, aNbSubBases=0, aNbLocs=0; + + //Get the shapes + aNbBases = theBases.length(); + aNbSubBases = theSubBases.length(); + aNbLocs = theLocations.length(); + + if( aNbLocs && aNbBases != aNbLocs) + return aGEOMObject._retn(); + + Handle(GEOM_Object) aPath = GetOperations()->GetEngine()->GetObject + (thePath->GetStudyID(), thePath->GetEntry()); + if(aPath.IsNull()) + return aGEOMObject._retn(); + + for (ind = 0; ind < aNbBases; ind++) { + if (theBases[ind] == NULL) continue; + Handle(GEOM_Object) aBase = GetOperations()->GetEngine()-> + GetObject(theBases[ind]->GetStudyID(), theBases[ind]->GetEntry()); + if(aBase.IsNull()) + continue; + if(aNbLocs) { + Handle(GEOM_Object) aLoc = GetOperations()->GetEngine()->GetObject + (theLocations[ind]->GetStudyID(), theLocations[ind]->GetEntry()); + if(aLoc.IsNull()) + continue; + aSeqLocations->Append(aLoc); + } + aSeqBases->Append(aBase); + + if(aNbSubBases>=aNbBases) { + Handle(GEOM_Object) aSubBase = GetOperations()->GetEngine()-> + GetObject(theSubBases[ind]->GetStudyID(), theSubBases[ind]->GetEntry()); + if(aSubBase.IsNull()) { + aSeqSubBases->Clear(); + aNbSubBases = 0; + continue; + } + aSeqSubBases->Append(aSubBase); + } + + } + if(!aSeqBases->Length()) + return aGEOMObject._retn(); + + // Make pipe + Handle(GEOM_Object) anObject = + GetOperations()->MakePipeWithShellSections(aSeqBases, aSeqSubBases, + aSeqLocations, aPath, + theWithContact, theWithCorrections); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} diff --git a/src/GEOM_I/GEOM_I3DPrimOperations_i.hh b/src/GEOM_I/GEOM_I3DPrimOperations_i.hh index 8ce0c55a4..fe86685a9 100644 --- a/src/GEOM_I/GEOM_I3DPrimOperations_i.hh +++ b/src/GEOM_I/GEOM_I3DPrimOperations_i.hh @@ -106,6 +106,13 @@ class GEOM_I_EXPORT GEOM_I3DPrimOperations_i : CORBA::Boolean theWithContact, CORBA::Boolean theWithCorrections); + GEOM::GEOM_Object_ptr MakePipeWithShellSections(const GEOM::ListOfGO& theBases, + const GEOM::ListOfGO& theSubBases, + const GEOM::ListOfGO& theLocations, + GEOM::GEOM_Object_ptr thePath, + CORBA::Boolean theWithContact, + CORBA::Boolean theWithCorrections); + ::GEOMImpl_I3DPrimOperations* GetOperations() { return (::GEOMImpl_I3DPrimOperations*)GetImpl(); } }; diff --git a/src/GEOM_I/GEOM_ICurvesOperations_i.cc b/src/GEOM_I/GEOM_ICurvesOperations_i.cc index d0c097ed4..ea89b3709 100644 --- a/src/GEOM_I/GEOM_ICurvesOperations_i.cc +++ b/src/GEOM_I/GEOM_ICurvesOperations_i.cc @@ -188,6 +188,43 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeArc return GetObject(anObject); } + +//============================================================================= +/*! + * MakeArcCenter + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeArcCenter + (GEOM::GEOM_Object_ptr thePnt1, + GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3, + CORBA::Boolean theSense) + +{ + 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 ArcCenter + Handle(GEOM_Object) anObject = + GetOperations()->MakeArcCenter(aPnt1, aPnt2, aPnt3,theSense); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} //============================================================================= /*! * MakePolyline diff --git a/src/GEOM_I/GEOM_ICurvesOperations_i.hh b/src/GEOM_I/GEOM_ICurvesOperations_i.hh index e5c0b0fc0..f316dab52 100644 --- a/src/GEOM_I/GEOM_ICurvesOperations_i.hh +++ b/src/GEOM_I/GEOM_ICurvesOperations_i.hh @@ -55,7 +55,12 @@ class GEOM_I_EXPORT GEOM_ICurvesOperations_i : GEOM::GEOM_Object_ptr MakeArc (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2, GEOM::GEOM_Object_ptr thePnt3); - + + GEOM::GEOM_Object_ptr MakeArcCenter (GEOM::GEOM_Object_ptr thePnt1, + GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3, + bool theSense); + GEOM::GEOM_Object_ptr MakePolyline (const GEOM::ListOfGO& thePoints); GEOM::GEOM_Object_ptr MakeSplineBezier (const GEOM::ListOfGO& thePoints); diff --git a/src/GEOM_I/GEOM_IMeasureOperations_i.cc b/src/GEOM_I/GEOM_IMeasureOperations_i.cc index 9b763dfaf..6167bf0e1 100644 --- a/src/GEOM_I/GEOM_IMeasureOperations_i.cc +++ b/src/GEOM_I/GEOM_IMeasureOperations_i.cc @@ -50,6 +50,52 @@ GEOM_IMeasureOperations_i::~GEOM_IMeasureOperations_i() MESSAGE("GEOM_IMeasureOperations_i::~GEOM_IMeasureOperations_i"); } +//============================================================================= +/*! + * KindOfShape + */ +//============================================================================= +GEOM::GEOM_IKindOfShape::shape_kind GEOM_IMeasureOperations_i::KindOfShape + (GEOM::GEOM_Object_ptr theShape, + GEOM::ListOfLong_out theIntegers, + GEOM::ListOfDouble_out theDoubles) +{ + GEOMImpl_IMeasureOperations::ShapeKind aKind = GEOMImpl_IMeasureOperations::SK_NO_SHAPE; + + // allocate the CORBA arrays + GEOM::ListOfLong_var anIntegersArray = new GEOM::ListOfLong(); + GEOM::ListOfDouble_var aDoublesArray = new GEOM::ListOfDouble(); + + //Get the reference shape + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + + if (!aShape.IsNull()) { + Handle(TColStd_HSequenceOfInteger) anIntegers = new TColStd_HSequenceOfInteger; + Handle(TColStd_HSequenceOfReal) aDoubles = new TColStd_HSequenceOfReal; + + // Detect kind of shape and parameters + aKind = GetOperations()->KindOfShape(aShape, anIntegers, aDoubles); + + int nbInts = anIntegers->Length(); + int nbDbls = aDoubles->Length(); + + anIntegersArray->length(nbInts); + aDoublesArray->length(nbDbls); + + for (int ii = 0; ii < nbInts; ii++) { + anIntegersArray[ii] = anIntegers->Value(ii + 1); + } + for (int id = 0; id < nbDbls; id++) { + aDoublesArray[id] = aDoubles->Value(id + 1); + } + } + + // initialize out-parameters with local arrays + theIntegers = anIntegersArray._retn(); + theDoubles = aDoublesArray._retn(); + return (GEOM::GEOM_IKindOfShape::shape_kind)aKind; +} //============================================================================= /*! diff --git a/src/GEOM_I/GEOM_IMeasureOperations_i.hh b/src/GEOM_I/GEOM_IMeasureOperations_i.hh index 39c495774..474563256 100644 --- a/src/GEOM_I/GEOM_IMeasureOperations_i.hh +++ b/src/GEOM_I/GEOM_IMeasureOperations_i.hh @@ -40,6 +40,10 @@ class GEOM_I_EXPORT GEOM_IMeasureOperations_i : ::GEOMImpl_IMeasureOperations* theImpl); ~GEOM_IMeasureOperations_i(); + GEOM::GEOM_IKindOfShape::shape_kind KindOfShape (GEOM::GEOM_Object_ptr theShape, + GEOM::ListOfLong_out theIntegers, + GEOM::ListOfDouble_out theDoubles); + void GetPosition (GEOM::GEOM_Object_ptr theShape, CORBA::Double& Ox, CORBA::Double& Oy, CORBA::Double& Oz, CORBA::Double& Zx, CORBA::Double& Zy, CORBA::Double& Zz, diff --git a/src/GEOM_I/GEOM_IShapesOperations_i.cc b/src/GEOM_I/GEOM_IShapesOperations_i.cc index b9893fd9c..b3edf98db 100644 --- a/src/GEOM_I/GEOM_IShapesOperations_i.cc +++ b/src/GEOM_I/GEOM_IShapesOperations_i.cc @@ -354,6 +354,92 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFaces return GetObject(anObject); } + +//============================================================================= +/*! + * GetGlueFaces + */ +//============================================================================= +GEOM::ListOfGO* GEOM_IShapesOperations_i::GetGlueFaces + (GEOM::GEOM_Object_ptr theShape, + const CORBA::Double theTolerance) +{ + GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL) return aSeq._retn(); + + //Get the reference objects + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + if (aShape.IsNull()) return aSeq._retn(); + + Handle(TColStd_HSequenceOfTransient) aHSeq = + GetOperations()->GetGlueFaces(aShape, theTolerance); + + //if (!GetOperations()->IsDone() || aHSeq.IsNull()) + // to allow warning + if(aHSeq.IsNull()) + return aSeq._retn(); + + Standard_Integer aLength = aHSeq->Length(); + aSeq->length(aLength); + for (Standard_Integer i = 1; i <= aLength; i++) + aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i))); + + return aSeq._retn(); +} + + +//============================================================================= +/*! + * MakeGlueFacesByList + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFacesByList + (GEOM::GEOM_Object_ptr theShape, + const CORBA::Double theTolerance, + const GEOM::ListOfGO& theFaces) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL) return aGEOMObject._retn(); + + //Get the reference objects + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + + if (aShape.IsNull()) return aGEOMObject._retn(); + + int ind, aLen; + list aFaces; + //Get the shapes + aLen = theFaces.length(); + for (ind = 0; ind < aLen; ind++) { + if (theFaces[ind] == NULL) return aGEOMObject._retn(); + Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject + (theFaces[ind]->GetStudyID(), theFaces[ind]->GetEntry()); + if (aSh.IsNull()) return aGEOMObject._retn(); + aFaces.push_back(aSh); + } + + //Perform the gluing + Handle(GEOM_Object) anObject = + GetOperations()->MakeGlueFacesByList(aShape, theTolerance, aFaces); + //if (!GetOperations()->IsDone() || anObject.IsNull()) + // to allow warning + if (anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + + //============================================================================= /*! * MakeExplode diff --git a/src/GEOM_I/GEOM_IShapesOperations_i.hh b/src/GEOM_I/GEOM_IShapesOperations_i.hh index b63eee1ca..84575a15d 100644 --- a/src/GEOM_I/GEOM_IShapesOperations_i.hh +++ b/src/GEOM_I/GEOM_IShapesOperations_i.hh @@ -63,6 +63,13 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i : GEOM::GEOM_Object_ptr MakeGlueFaces (GEOM::GEOM_Object_ptr theShape, CORBA::Double theTolerance); + GEOM::ListOfGO* GetGlueFaces (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theTolerance); + + GEOM::GEOM_Object_ptr MakeGlueFacesByList (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theTolerance, + const GEOM::ListOfGO& theFaces); + GEOM::ListOfGO* MakeExplode (GEOM::GEOM_Object_ptr theShape, CORBA::Long theShapeType, CORBA::Boolean isSorted); diff --git a/src/GEOM_I/GEOM_Object_i.cc b/src/GEOM_I/GEOM_Object_i.cc index dce4e328b..6edeb5dac 100644 --- a/src/GEOM_I/GEOM_Object_i.cc +++ b/src/GEOM_I/GEOM_Object_i.cc @@ -254,9 +254,9 @@ SALOMEDS::TMPFile* GEOM_Object_i::GetShapeStream() //function : getShape //purpose : return the TopoDS_Shape when client and servant are colocated, be careful //======================================================================= -CORBA::Long GEOM_Object_i::getShape() { +CORBA::LongLong GEOM_Object_i::getShape() { _geom = _impl->GetValue(); - return CORBA::Long(size_t(&_geom)); + return ((CORBA::LongLong)(&_geom)); } //============================================================================= diff --git a/src/GEOM_I/GEOM_Object_i.hh b/src/GEOM_I/GEOM_Object_i.hh index 660f0399c..fa670e45a 100644 --- a/src/GEOM_I/GEOM_Object_i.hh +++ b/src/GEOM_I/GEOM_Object_i.hh @@ -63,7 +63,7 @@ class GEOM_I_EXPORT GEOM_Object_i : public virtual POA_GEOM::GEOM_Object, public virtual SALOMEDS::TMPFile* GetShapeStream(); - virtual CORBA::Long getShape(); + virtual CORBA::LongLong getShape(); virtual bool IsMainShape() { return _impl->IsMainShape(); } diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.cc b/src/GEOM_I_Superv/GEOM_Superv_i.cc index 6d289ff68..299d9f550 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.cc +++ b/src/GEOM_I_Superv/GEOM_Superv_i.cc @@ -978,11 +978,12 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeThruSections(const GEOM::ListOfGO& theS //============================================================================= // MakePipe: //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePipeWithDifferentSections(const GEOM::ListOfGO& theBases, - const GEOM::ListOfGO& theLocations, - GEOM::GEOM_Object_ptr thePath, - CORBA::Boolean theWithContact, - CORBA::Boolean theWithCorrections) +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePipeWithDifferentSections + (const GEOM::ListOfGO& theBases, + const GEOM::ListOfGO& theLocations, + GEOM::GEOM_Object_ptr thePath, + CORBA::Boolean theWithContact, + CORBA::Boolean theWithCorrections) { beginService( " GEOM_Superv_i::MakePipeWithDifferentSections" ); MESSAGE("GEOM_Superv_i::MakePipeWithDifferentSections"); @@ -991,6 +992,31 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePipeWithDifferentSections(const GEOM::L endService( " GEOM_Superv_i::MakePipeWithDifferentSections" ); return anObj; } + + +//============================================================================= +// MakePipe: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePipeWithShellSections + (const GEOM::ListOfGO& theBases, + const GEOM::ListOfGO& theSubBases, + const GEOM::ListOfGO& theLocations, + GEOM::GEOM_Object_ptr thePath, + CORBA::Boolean theWithContact, + CORBA::Boolean theWithCorrections) +{ + beginService( " GEOM_Superv_i::MakePipeWithShellSections" ); + MESSAGE("GEOM_Superv_i::MakePipeWithShellSections"); + get3DPrimOp(); + GEOM::GEOM_Object_ptr anObj = + my3DPrimOp->MakePipeWithShellSections(theBases, theSubBases, + theLocations, thePath, + theWithContact, theWithCorrections); + endService( " GEOM_Superv_i::MakePipeWithShellSections" ); + return anObj; +} + + //============================================================================= // MakeFuse: //============================================================================= @@ -1652,7 +1678,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCompound (GEOM::GEOM_List_ptr theShapes // MakeGlueFaces: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeGlueFaces (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theTolerance) + CORBA::Double theTolerance) { beginService( " GEOM_Superv_i::MakeGlueFaces" ); MESSAGE("GEOM_Superv_i::MakeGlueFaces"); @@ -1662,6 +1688,37 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeGlueFaces (GEOM::GEOM_Object_ptr theSha return anObj; } +//============================================================================= +// GetGlueFaces: +//============================================================================= +GEOM::GEOM_List_ptr GEOM_Superv_i::GetGlueFaces (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theTolerance) +{ + beginService( " GEOM_Superv_i::GetGlueFaces" ); + MESSAGE("GEOM_Superv_i::GetGlueFaces"); + getShapesOp(); + GEOM::ListOfGO* aList = myShapesOp->GetGlueFaces(theShape, theTolerance); + GEOM_List_i* aListPtr = new GEOM_List_i(*(aList)); + MESSAGE(" List of "<GetList().length()<<" element(s)"); + endService( " GEOM_Superv_i::GetGlueFaces" ); + return aListPtr->_this(); +} + +//============================================================================= +// MakeGlueFacesByList: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeGlueFacesByList (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theTolerance, + const GEOM::ListOfGO& theFaces) +{ + beginService( " GEOM_Superv_i::MakeGlueFacesByList" ); + MESSAGE("GEOM_Superv_i::MakeGlueFacesByList"); + getShapesOp(); + GEOM::GEOM_Object_ptr anObj = myShapesOp->MakeGlueFacesByList(theShape, theTolerance, theFaces); + endService( " GEOM_Superv_i::MakeGlueFacesByList" ); + return anObj; +} + //============================================================================= // MakeExplode: //============================================================================= @@ -2134,6 +2191,22 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeArc (GEOM::GEOM_Object_ptr thePnt1, return anObj; } +//============================================================================= +// MakeArcCenter: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeArcCenter (GEOM::GEOM_Object_ptr theCenter, + GEOM::GEOM_Object_ptr thePnt1, + GEOM::GEOM_Object_ptr thePnt2, + CORBA::Boolean theSense) +{ + beginService( " GEOM_Superv_i::MakeArcCenter" ); + MESSAGE("GEOM_Superv_i::MakeArcCenter"); + getCurvesOp(); + GEOM::GEOM_Object_ptr anObj = myCurvesOp->MakeArcCenter(theCenter, thePnt1, thePnt2,theSense); + endService( " GEOM_Superv_i::MakeArcCenter" ); + return anObj; +} + //============================================================================= // MakePolyline: //============================================================================= diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.hh b/src/GEOM_I_Superv/GEOM_Superv_i.hh index 4dce89ebb..298a01ede 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.hh +++ b/src/GEOM_I_Superv/GEOM_Superv_i.hh @@ -237,6 +237,13 @@ public: CORBA::Boolean theWithContact, CORBA::Boolean theWithCorrections); + GEOM::GEOM_Object_ptr MakePipeWithShellSections(const GEOM::ListOfGO& theBases, + const GEOM::ListOfGO& theSubBases, + const GEOM::ListOfGO& theLocations, + GEOM::GEOM_Object_ptr thePath, + CORBA::Boolean theWithContact, + CORBA::Boolean theWithCorrections); + //-----------------------------------------------------------// // BooleanOperations // //-----------------------------------------------------------// @@ -371,7 +378,12 @@ public: GEOM::GEOM_Object_ptr MakeSolidShells (GEOM::GEOM_List_ptr theShells); GEOM::GEOM_Object_ptr MakeCompound (GEOM::GEOM_List_ptr theShapes); GEOM::GEOM_Object_ptr MakeGlueFaces (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theTolerance); + CORBA::Double theTolerance); + GEOM::GEOM_List_ptr GetGlueFaces (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theTolerance); + GEOM::GEOM_Object_ptr MakeGlueFacesByList (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theTolerance, + const GEOM::ListOfGO& theFaces); GEOM::GEOM_List_ptr MakeExplode (GEOM::GEOM_Object_ptr theShape, CORBA::Long theShapeType, CORBA::Boolean isSorted); @@ -468,6 +480,10 @@ public: GEOM::GEOM_Object_ptr MakeArc (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2, GEOM::GEOM_Object_ptr thePnt3); + GEOM::GEOM_Object_ptr MakeArcCenter (GEOM::GEOM_Object_ptr theCenter, + GEOM::GEOM_Object_ptr thePnt1, + GEOM::GEOM_Object_ptr thePnt2, + CORBA::Boolean theSense); GEOM::GEOM_Object_ptr MakePolyline (GEOM::GEOM_List_ptr thePoints); GEOM::GEOM_Object_ptr MakeSplineBezier (GEOM::GEOM_List_ptr thePoints); GEOM::GEOM_Object_ptr MakeSplineInterpolation (GEOM::GEOM_List_ptr thePoints); diff --git a/src/GEOM_SWIG/GEOM_TestAll.py b/src/GEOM_SWIG/GEOM_TestAll.py index ec0670186..a044befec 100644 --- a/src/GEOM_SWIG/GEOM_TestAll.py +++ b/src/GEOM_SWIG/GEOM_TestAll.py @@ -84,6 +84,7 @@ def TestAll (geompy, math): Plane1 = geompy.MakePlaneThreePnt(px, pz, p200, trimsize) #(4 Doubles)->GEOM_Object_ptr Arc = geompy.MakeArc(py, pz, px) #(3 GEOM_Object_ptr)->GEOM_Object_ptr + Arc2 = geompy.MakeArcCenter(py, pz, px,0) #(3 GEOM_Object_ptr,Boolean)->GEOM_Object_ptr Circle = geompy.MakeCircle(p0, vz, radius1) #(2 GEOM_Object_ptr, Double)->GEOM_Object_ptr Circle1 = geompy.MakeCircleThreePnt(p0, pxyz, px) #(3 GEOM_Object_ptr)->GEOM_Object_ptr Ellipse = geompy.MakeEllipse(p0, vy, radius2, radius1) #(2 GEOM_Object_ptr, 2 Doubles)->GEOM_Object_ptr diff --git a/src/GEOM_SWIG/GEOM_TestMeasures.py b/src/GEOM_SWIG/GEOM_TestMeasures.py index 740d1b2d8..c18c30648 100644 --- a/src/GEOM_SWIG/GEOM_TestMeasures.py +++ b/src/GEOM_SWIG/GEOM_TestMeasures.py @@ -128,4 +128,22 @@ def TestMeasureOperations (geompy, math): print "Z axis: (", Pos[3], ", ", Pos[4], ", ", Pos[5], ")" print "X axis: (", Pos[6], ", ", Pos[7], ", ", Pos[8], ")" + ####### KindOfShape ####### + + Kind = geompy.KindOfShape(box) + print "\nKindOfShape(box 10x30x70):", Kind + #if Kind[0] != geompy.kind.BOX: + # print "Error: returned type is", Kind[0], "while must be", geompy.kind.BOX + + Kind = geompy.KindOfShape(p137) + print "\nKindOfShape(p137):", Kind + if Kind[0] != geompy.kind.VERTEX: + print " Error: returned type is", Kind[0], "while must be", geompy.kind.VERTEX + else: + dx = math.fabs(Kind[1] - 10) + dy = math.fabs(Kind[2] - 30) + dz = math.fabs(Kind[3] - 70) + if (dx + dy + dz) > 1e-5: + print " Error: coordinates are (", Kind[1], ",", Kind[2], ",", Kind[3], ") while must be (10, 20, 30)" + pass diff --git a/src/GEOM_SWIG/GEOM_shared_modules.py b/src/GEOM_SWIG/GEOM_shared_modules.py index 67f962a2f..1c05517c4 100644 --- a/src/GEOM_SWIG/GEOM_shared_modules.py +++ b/src/GEOM_SWIG/GEOM_shared_modules.py @@ -25,7 +25,9 @@ # see salome_shared_modules.py # (avoids incomplete import at run time) -print "============== import GEOM =======================" +from launchConfigureParser import verbose + +if verbose(): print "============== import GEOM =======================" import GEOM diff --git a/src/GEOM_SWIG/geompy.py b/src/GEOM_SWIG/geompy.py index 428939deb..089a39c6b 100644 --- a/src/GEOM_SWIG/geompy.py +++ b/src/GEOM_SWIG/geompy.py @@ -143,6 +143,17 @@ def addToStudyInFather(aFather, aShape, aName): ShapeType = {"COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8} +# ----------------------------------------------------------------------------- +# enumeration shape_kind +# ----------------------------------------------------------------------------- + +kind = GEOM.GEOM_IKindOfShape + +class info: + UNKNOWN = 0 + CLOSED = 1 + UNCLOSED = 2 + # ----------------------------------------------------------------------------- # Basic primitives # ----------------------------------------------------------------------------- @@ -339,6 +350,19 @@ def MakeArc(thePnt1, thePnt2, thePnt3): print "MakeArc : ", CurvesOp.GetErrorCode() return anObj +## Create an arc of circle from a center and 2 points. +# @param thePnt1 Center of the arc +# @param thePnt2 Start point of the arc. (Gives also the radius of the arc) +# @param thePnt3 End point of the arc (Gives also a direction) +# @return New GEOM_Object, containing the created arc. +# +# Example: see GEOM_TestAll.py +def MakeArcCenter(thePnt1, thePnt2, thePnt3,theSense): + anObj = CurvesOp.MakeArcCenter(thePnt1, thePnt2, thePnt3,theSense) + if CurvesOp.IsDone() == 0: + print "MakeArcCenter : ", CurvesOp.GetErrorCode() + return anObj + ## Create a circle with given center, normal vector and radius. # @param thePnt Circle center. # @param theVec Vector, normal to the plane of the circle. @@ -716,6 +740,32 @@ def MakePipeWithDifferentSections(theSeqBases, theLocations,thePath,theWithConta print "MakePipeWithDifferentSections : ", PrimOp.GetErrorCode() return anObj +## Create a shape by extrusion of the profile shape along +# the path shape. The path shape can be a shell or a face. +# the several profiles can be specified in the several locations of path. +# @param theSeqBases - list of Bases shape to be extruded. +# @param theSeqSubBases - list of corresponding subshapes of section shapes. +# @param theLocations - list of locations on the path corresponding +# specified list of the Bases shapes. Number of locations +# should be equal to number of bases or list of locations can be empty. +# @param thePath - Path shape to extrude the base shape along it. +# @param theWithContact - the mode defining that the section is translated to be in +# contact with the spine. +# @param - WithCorrection - defining that the section is rotated to be +# orthogonal to the spine tangent in the correspondent point +# @return New GEOM_Object, containing the created solids. +# +# Example: see GEOM_TestAll.py +def MakePipeWithShellSections(theSeqBases, theSeqSubBases, + theLocations, thePath, + theWithContact, theWithCorrection): + anObj = PrimOp.MakePipeWithShellSections(theSeqBases, theSeqSubBases, + theLocations, thePath, + theWithContact, theWithCorrection) + if PrimOp.IsDone() == 0: + print "MakePipeWithShellSections : ", PrimOp.GetErrorCode() + return anObj + # ----------------------------------------------------------------------------- # Create base shapes # ----------------------------------------------------------------------------- @@ -1337,6 +1387,38 @@ def MakeGlueFaces(theShape, theTolerance): print "MakeGlueFaces : ", ShapesOp.GetErrorCode() return anObj + +## Find coincident faces in theShape for possible gluing. +# @param theShape Initial shape. +# @param theTolerance Maximum distance between faces, +# which can be considered as coincident. +# @return ListOfGO. +# +# Example: see GEOM_Spanner.py +def GetGlueFaces(theShape, theTolerance): + anObj = ShapesOp.GetGlueFaces(theShape, theTolerance) + if ShapesOp.IsDone() == 0: + print "GetGlueFaces : ", ShapesOp.GetErrorCode() + return anObj + + +## Replace coincident faces in theShape by one face +# in compliance with given list of faces +# @param theShape Initial shape. +# @param theTolerance Maximum distance between faces, +# which can be considered as coincident. +# @param theFaces List of faces for gluing. +# @return New GEOM_Object, containing a copy of theShape +# without some faces. +# +# Example: see GEOM_Spanner.py +def MakeGlueFacesByList(theShape, theTolerance, theFaces): + anObj = ShapesOp.MakeGlueFacesByList(theShape, theTolerance, theFaces) + if ShapesOp.IsDone() == 0: + print "MakeGlueFacesByList : ", ShapesOp.GetErrorCode() + return anObj + + # ----------------------------------------------------------------------------- # Boolean (Common, Cut, Fuse, Section) # ----------------------------------------------------------------------------- @@ -1951,6 +2033,76 @@ def GetPosition(theShape): print "GetPosition : ", MeasuOp.GetErrorCode() return aTuple +## Get kind of theShape. +# +# @param theShape Shape to get a kind of. +# @return Returns a kind of shape in terms of GEOM_IKindOfShape.shape_kind enumeration +# and a list of parameters, describing the shape. +# @note Concrete meaning of each value, returned via \a theIntegers +# or \a theDoubles list depends on the kind of the shape. +# The full list of possible outputs is: +# +# geompy.kind.COMPOUND nb_solids nb_faces nb_edges nb_vertices +# geompy.kind.COMPSOLID nb_solids nb_faces nb_edges nb_vertices +# +# geompy.kind.SHELL geompy.info.CLOSED nb_faces nb_edges nb_vertices +# geompy.kind.SHELL geompy.info.UNCLOSED nb_faces nb_edges nb_vertices +# +# geompy.kind.WIRE geompy.info.CLOSED nb_edges nb_vertices +# geompy.kind.WIRE geompy.info.UNCLOSED nb_edges nb_vertices +# +# geompy.kind.SPHERE xc yc zc R +# geompy.kind.CYLINDER xb yb zb dx dy dz R H +# geompy.kind.BOX xc yc zc ax ay az +# geompy.kind.ROTATED_BOX xc yc zc zx zy zz xx xy xz ax ay az +# geompy.kind.TORUS xc yc zc dx dy dz R_1 R_2 +# geompy.kind.CONE xb yb zb dx dy dz R_1 R_2 H +# geompy.kind.POLYHEDRON nb_faces nb_edges nb_vertices +# geompy.kind.SOLID nb_faces nb_edges nb_vertices +# +# geompy.kind.SPHERE2D xc yc zc R +# geompy.kind.CYLINDER2D xb yb zb dx dy dz R H +# geompy.kind.TORUS2D xc yc zc dx dy dz R_1 R_2 +# geompy.kind.CONE2D xc yc zc dx dy dz R_1 R_2 H +# geompy.kind.DISK_CIRCLE xc yc zc dx dy dz R +# geompy.kind.DISK_ELLIPSE xc yc zc dx dy dz R_1 R_2 +# geompy.kind.POLYGON xo yo zo dx dy dz nb_edges nb_vertices +# geompy.kind.PLANE xo yo zo dx dy dz +# geompy.kind.PLANAR xo yo zo dx dy dz nb_edges nb_vertices +# geompy.kind.FACE nb_edges nb_vertices +# +# geompy.kind.CIRCLE xc yc zc dx dy dz R +# geompy.kind.ARC_CIRCLE xc yc zc dx dy dz R x1 y1 z1 x2 y2 z2 +# geompy.kind.ELLIPSE xc yc zc dx dy dz R_1 R_2 +# geompy.kind.ARC_ELLIPSE xc yc zc dx dy dz R_1 R_2 x1 y1 z1 x2 y2 z2 +# geompy.kind.LINE xo yo zo dx dy dz +# geompy.kind.SEGMENT x1 y1 z1 x2 y2 z2 +# geompy.kind.EDGE nb_vertices +# +# geompy.kind.VERTEX x y z +# +# Example: see GEOM_TestMeasures.py +def KindOfShape(theShape): + aRoughTuple = MeasuOp.KindOfShape(theShape) + if MeasuOp.IsDone() == 0: + print "KindOfShape : ", MeasuOp.GetErrorCode() + return [] + + aKind = aRoughTuple[0] + anInts = aRoughTuple[1] + aDbls = aRoughTuple[2] + + # Now there is no exception from this rule: + aKindTuple = [aKind] + aDbls + anInts + + # If they are we will regroup parameters for such kind of shape. + # For example: + #if aKind == kind.SOME_KIND: + # # SOME_KIND int int double int double double + # aKindTuple = [aKind, anInts[0], anInts[1], aDbls[0], anInts[2], aDbls[1], aDbls[2]] + + return aKindTuple + # ----------------------------------------------------------------------------- # Import/Export objects # ----------------------------------------------------------------------------- diff --git a/src/NMTDS/NMTDS_ShapesDataStructure.cxx b/src/NMTDS/NMTDS_ShapesDataStructure.cxx index 229f3c543..c7355995b 100644 --- a/src/NMTDS/NMTDS_ShapesDataStructure.cxx +++ b/src/NMTDS/NMTDS_ShapesDataStructure.cxx @@ -24,17 +24,19 @@ #include + +#include + #include #include + +#include #include +#include + #include #include -#include #include -// -#include -#include -#include //=========================================================================== //function : NMTDS_ShapesDataStructure::NMTDS_ShapesDataStructure @@ -152,27 +154,29 @@ NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors aLx; NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors aLit; TopoDS_Iterator anIt; - // Modified Thu Sep 14 14:35:18 2006 - // Contribution of Samtech www.samcef.com BEGIN BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors aMSA; - // Contribution of Samtech www.samcef.com END // anIt.Initialize(myCompositeShape); - for (i=0; anIt.More(); anIt.Next(), ++i) { - // Modified Thu Sep 14 14:35:18 2006 - // Contribution of Samtech www.samcef.com BEGIN + for (; anIt.More(); anIt.Next()) { const TopoDS_Shape& aSx=anIt.Value(); BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors aMS; - FillMap(aSx, aMSA, aMS); - aLx.Append(aMS); - // Contribution of Samtech www.samcef.com END + //modified by NIZNHY-PKV Tue Feb 27 17:05:47 2007f + //FillMap(aSx, aMSA, aMS); + //aLx.Append(aMS); + // + if (!aMSA.Contains(aSx)) { + FillMap(aSx, aMSA, aMS); + aLx.Append(aMS); + } + //modified by NIZNHY-PKV Tue Feb 27 17:06:03 2007t } - // Modified Thu Sep 14 14:35:18 2006 - // Contribution of Samtech www.samcef.com BEGIN + // aNbS=aMSA.Extent(); - // Contribution of Samtech www.samcef.com END // // Fill myRanges + //modified by NIZNHY-PKV Tue Feb 27 17:10:07 2007f + i=aLx.Extent(); + //modified by NIZNHY-PKV Tue Feb 27 17:10:10 2007t myRanges.Resize(i); aLit.Initialize(aLx); for (i=1; aLit.More(); aLit.Next(), ++i) { @@ -210,8 +214,6 @@ // Contribution of Samtech www.samcef.com BEGIN // // Fill the table - //modified by NIZNHY-PKV Tue May 16 11:47:28 2006f - //aShift=0; //for (i=0; i<2; ++i) { // if (i) { @@ -224,7 +226,7 @@ // InsertShapeAndAncestorsSuccessors(aSx, aASx, aShift); // } //} - + aShift=0; for (j=1; j<=aNbS; ++j) { const TopoDS_Shape& aSx=aMSA.FindKey(j); diff --git a/src/NMTTools/NMTTools_DEProcessor.cxx b/src/NMTTools/NMTTools_DEProcessor.cxx index 0350ee38c..9c5f860f5 100644 --- a/src/NMTTools/NMTTools_DEProcessor.cxx +++ b/src/NMTTools/NMTTools_DEProcessor.cxx @@ -189,8 +189,9 @@ void NMTTools_DEProcessor::DoPaves() { - Standard_Integer i, aNbE, nED, nVD, nFD=0; + Standard_Integer i, aNbE, nED, nVD, nFD, aNbLPB; // + nFD=0; aNbE=myDEMap.Extent(); for (i=1; i<=aNbE; i++) { nED=myDEMap.FindKey(i); @@ -202,9 +203,16 @@ TColStd_ListIteratorOfListOfInteger anIt(nLF); for (; anIt.More(); anIt.Next()) { nFD=anIt.Value(); - + // BOPTools_ListOfPaveBlock aLPB; FindPaveBlocks(nED, nVD, nFD, aLPB); + //modified by NIZNHY-PKV Fri Mar 23 10:35:27 2007f + // + aNbLPB=aLPB.Extent(); + if (!aNbLPB) { + continue; + } + //modified by NIZNHY-PKV Fri Mar 23 10:35:33 2007t FillPaveSet (nED, nVD, nFD, aLPB); } // diff --git a/src/NMTTools/NMTTools_PaveFiller_4.cxx b/src/NMTTools/NMTTools_PaveFiller_4.cxx index af8d70fda..3a9a1c5c9 100644 --- a/src/NMTTools/NMTTools_PaveFiller_4.cxx +++ b/src/NMTTools/NMTTools_PaveFiller_4.cxx @@ -25,27 +25,11 @@ #include // -// Modified Thu Sep 14 14:35:18 2006 -// Contribution of Samtech www.samcef.com BEGIN -#include -#include -#include -#include -#include -// Contribution of Samtech www.samcef.com END - #include #include -#include - #include #include -#include -#include - -#include -#include #include #include @@ -53,17 +37,11 @@ #include #include -#include -#include -#include -#include -#include #include #include #include -#include #include #include @@ -97,15 +75,46 @@ #include #include -#include -#include -#include #include #include #include #include +// Modified Thu Sep 14 14:35:18 2006 +// Contribution of Samtech www.samcef.com BEGIN +#include +#include +#include +#include +#include +// Contribution of Samtech www.samcef.com END +// +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// +#include +#include +#include +#include + static void TreatNewVertices(const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI, @@ -117,7 +126,6 @@ static TopoDS_Vertex& aNewVertex); - static void VertexParameters(const IntTools_CommonPrt& aCPart, Standard_Real& aT1, @@ -137,6 +145,7 @@ static static void FindChains(const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB, NMTTools_ListOfCommonBlock& aLCB); + //======================================================================= // function: PerformEE // purpose: @@ -447,6 +456,9 @@ static }//for (; aIt.More(); aIt.Next()) { }// for (; aItIm.More(); aItIm.Next()) } +// +// case: use_02 +// completely rewritten //======================================================================= //function : TreatNewVertices //purpose : @@ -455,7 +467,7 @@ void TreatNewVertices(const BooleanOperations_IndexedDataMapOfShapeInteger& aMap TopTools_DataMapOfShapeListOfShape& myImages, TopTools_DataMapOfShapeShape& myOrigins) { - Standard_Integer j, i, aNbV, aIndex, aNbVSD; + Standard_Integer j, i, aNbV, aNbVSD; Standard_Real aTol; TColStd_ListIteratorOfListOfInteger aIt; TopoDS_Shape aSTmp, aVF; @@ -467,12 +479,10 @@ void TreatNewVertices(const BooleanOperations_IndexedDataMapOfShapeInteger& aMap NMTDS_IndexedDataMapOfIntegerShape aMIS; NMTDS_IndexedDataMapOfShapeBox aMSB; // - // NMTDS_BoxBndTreeSelector aSelector; NMTDS_BoxBndTree aBBTree; NCollection_UBTreeFiller aTreeFiller(aBBTree); // - // myImages.Clear(); myOrigins.Clear(); // @@ -498,6 +508,7 @@ void TreatNewVertices(const BooleanOperations_IndexedDataMapOfShapeInteger& aMap // aTreeFiller.Fill(); // + // Chains for (i=1; i<=aNbV; ++i) { const TopoDS_Shape& aV=aMV(i); // @@ -505,33 +516,84 @@ void TreatNewVertices(const BooleanOperations_IndexedDataMapOfShapeInteger& aMap continue; } // - const Bnd_Box& aBoxV=aMSB.FindFromKey(aV); - aSelector.Clear(); - aSelector.SetBox(aBoxV); - // - aNbVSD=aBBTree.Select(aSelector); - if (!aNbVSD) { - continue; // it must not be - } - // - // Images - // + Standard_Integer aNbIP, aIP, aNbIP1, aIP1; TopTools_ListOfShape aLVSD; + TColStd_MapOfInteger aMIP, aMIP1, aMIPC; + TColStd_MapIteratorOfMapOfInteger aIt1; // - const TColStd_ListOfInteger& aLI=aSelector.Indices(); - aIt.Initialize(aLI); - for (j=0; aIt.More(); aIt.Next(), ++j) { - aIndex=aIt.Value(); - const TopoDS_Shape& aVx=aMIS.FindFromKey(aIndex); - if(!j) { - aVF=aVx; + aMIP.Add(i); + while(1) { + aNbIP=aMIP.Extent(); + aIt1.Initialize(aMIP); + for(; aIt1.More(); aIt1.Next()) { + aIP=aIt1.Key(); + if (aMIPC.Contains(aIP)) { + continue; + } + // + const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP); + const Bnd_Box& aBoxVP=aMSB.FindFromKey(aVP); + // + aSelector.Clear(); + aSelector.SetBox(aBoxVP); + // + aNbVSD=aBBTree.Select(aSelector); + if (!aNbVSD) { + continue; // it must not be + } + // + const TColStd_ListOfInteger& aLI=aSelector.Indices(); + aIt.Initialize(aLI); + for (; aIt.More(); aIt.Next()) { + aIP1=aIt.Value(); + if (aMIP.Contains(aIP1)) { + continue; + } + aMIP1.Add(aIP1); + } //for (; aIt.More(); aIt.Next()) { + }//for(; aIt1.More(); aIt1.Next()) { + // + aNbIP1=aMIP1.Extent(); + if (!aNbIP1) { + break; // from while(1) + } + // + aIt1.Initialize(aMIP); + for(; aIt1.More(); aIt1.Next()) { + aIP=aIt1.Key(); + aMIPC.Add(aIP); + } + // + aMIP.Clear(); + aIt1.Initialize(aMIP1); + for(; aIt1.More(); aIt1.Next()) { + aIP=aIt1.Key(); + aMIP.Add(aIP); } - aLVSD.Append(aVx); - aMVProcessed.Add(aVx); + aMIP1.Clear(); + }// while(1) + //... + aNbIP=aMIPC.Extent(); + if (!aNbIP) { + //modified by NIZNHY-PKV Tue Jan 9 14:26:09 2007f + aMIPC.Add(i); + //continue; + //modified by NIZNHY-PKV Tue Jan 9 14:26:12 2007t } // + aIt1.Initialize(aMIPC); + for(j=0; aIt1.More(); aIt1.Next(), ++j) { + aIP=aIt1.Key(); + const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP); + if (!j) { + aVF=aVP; + } + aLVSD.Append(aVP); + aMVProcessed.Add(aVP); + } myImages.Bind(aVF, aLVSD); - } + }// for (i=1; i<=aNbV; ++i) { + //------------------------------ // // Make new vertices aMV.Clear(); @@ -577,6 +639,7 @@ void TreatNewVertices(const BooleanOperations_IndexedDataMapOfShapeInteger& aMap } } } +// //======================================================================= //function : MakeNewVertex //purpose : @@ -1364,3 +1427,213 @@ void ProcessBlock(const BOPTools_PaveBlock& aPB, } } // Contribution of Samtech www.samcef.com END +/* +//======================================================================= +// function:EENewVertices +// purpose: +//======================================================================= + void NMTTools_PaveFiller::EENewVertices (const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI) +{ + Standard_Integer aNb, i, j, aNewShape, aNbEdges, aNbIEE, aNbVV, aNbSimple; + Standard_Integer aWhat, aWith, i1, i2, nE1, nE2, nE, nV, aFlag; + Standard_Real aT; + TopoDS_Compound aCompound; + BRep_Builder aBB; + NMTTools_IndexedDataMapOfIndexedMapOfInteger aMNVE, aMNVIEE; + BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq; + BOPTools_Pave aPave; + TopoDS_Vertex aNewVertex; + TopTools_IndexedMapOfShape aMNVComplex, aMNVSimple; + // + BOPTools_CArray1OfEEInterference& aEEs=myIntrPool->EEInterferences(); + // + aNb=aMapVI.Extent(); + // + if (!aNb) { // no new vertices, no new problems + return; + } + // + // 0. + if (aNb==1) { + aNewVertex=TopoDS::Vertex(aMapVI.FindKey(1)); + EENewVertices(aNewVertex, aMapVI); + return; + } + // + // 1. Make compound from new vertices + aBB.MakeCompound(aCompound); + for (i=1; i<=aNb; ++i) { + const TopoDS_Shape& aV=aMapVI.FindKey(i); + aBB.Add(aCompound, aV); + } + // + // 2. VV intersection between these vertices + // using the auxiliary Filler + NMTDS_ShapesDataStructure tDS; + // + tDS.SetCompositeShape(aCompound); + tDS.Init(); + // + BOPTools_InterferencePool tInterfPool(tDS); + NMTTools_PaveFiller tPaveFiller(tInterfPool); + // + tPaveFiller.Init(); + // + tPaveFiller.PerformVV(); + tPaveFiller.PerformNewVertices(); + // + const BOPTools_CArray1OfVVInterference& aVVInterfs=tInterfPool.VVInterfs(); + // + // 3. Separate Comlex and Simple new vertices + aNbVV=aVVInterfs.Extent(); + for (i=1; i<=aNbVV; ++i) { + const BOPTools_VVInterference& aVV=aVVInterfs(i); + aVV.Indices(aWhat, aWith); + const TopoDS_Shape& aV1=tDS.Shape(aWhat); + const TopoDS_Shape& aV2=tDS.Shape(aWith); + aMNVComplex.Add(aV1); + aMNVComplex.Add(aV2); + } + // + for (i=1; i<=aNb; ++i) { + const TopoDS_Shape& aV=aMapVI.FindKey(i); + if (!aMNVComplex.Contains(aV)) { + aMNVSimple.Add(aV); + } + } + // + // 4. Treat Simple new Vertices + aNbSimple=aMNVSimple.Extent(); + for (i=1; i<=aNbSimple; ++i) { + const TopoDS_Vertex& aV=TopoDS::Vertex(aMNVSimple(i)); + EENewVertices(aV, aMapVI); + } + // + // 3. Fill Maps : NewVertex-edges (aMNVE) + // NewVertex-interferences (aMNVIEE) + for (i=1; i<=aNbVV; ++i) { + const BOPTools_VVInterference& aVV=aVVInterfs(i); + aNewShape=aVV.NewShape(); + if (!aNewShape) { + continue; + } + // + if (!aMNVE.Contains(aNewShape)) { + TColStd_IndexedMapOfInteger aMx; + aMNVE.Add(aNewShape, aMx); + } + if (!aMNVIEE.Contains(aNewShape)) { + TColStd_IndexedMapOfInteger aMx; + aMNVIEE.Add(aNewShape, aMx); + } + // + TColStd_IndexedMapOfInteger& aME=aMNVE.ChangeFromKey(aNewShape); + TColStd_IndexedMapOfInteger& aMIEE=aMNVIEE.ChangeFromKey(aNewShape); + // + aVV.Indices(aWhat, aWith); + //aWhat + const TopoDS_Shape& aV1=tDS.Shape(aWhat); + i1=aMapVI.FindFromKey(aV1); + const BOPTools_EEInterference& aEE1=aEEs(i1); + aEE1.Indices(nE1, nE2); + aME.Add(nE1); + aME.Add(nE2); + aMIEE.Add(i1); + //aWith + const TopoDS_Shape& aV2=tDS.Shape(aWith); + i2=aMapVI.FindFromKey(aV2); + const BOPTools_EEInterference& aEE2=aEEs(i2); + aEE2.Indices(nE1, nE2); + aME.Add(nE1); + aME.Add(nE2); + aMIEE.Add(i2); + // + //printf(" VV: (%d, %d) -> %d\n", aWhat, aWith, aNewShape); + } + // + // 4. Process new vertices + aNb=aMNVE.Extent(); + for (i=1; i<=aNb; ++i) { // xx + // + // new Vertex + nV=aMNVE.FindKey(i); + aNewVertex=TopoDS::Vertex(tDS.Shape(nV)); + // + // Insert New Vertex in DS; + myDS->InsertShapeAndAncestorsSuccessors(aNewVertex, anASSeq); + aNewShape=myDS->NumberOfInsertedShapes(); + myDS->SetState (aNewShape, BooleanOperations_ON); + // + // Update index of NewShape in EE interferences + const TColStd_IndexedMapOfInteger& aMIEE=aMNVIEE.FindFromKey(nV);//(i); + aNbIEE=aMIEE.Extent(); + for (j=1; j<=aNbIEE; ++j) { + i1=aMIEE(j); + BOPTools_EEInterference& aEE1=aEEs(i1); + aEE1.SetNewShape(aNewShape); + } + // + // Update Paves on edges + const TColStd_IndexedMapOfInteger& aME=aMNVE(i); + aNbEdges=aME.Extent(); + for (j=1; j<=aNbEdges; ++j) { + nE=aME(j); + const TopoDS_Edge aE=TopoDS::Edge(myDS->Shape(nE));//mpv + // + aFlag=myContext.ComputeVE (aNewVertex, aE, aT); + // + if (!aFlag) { + aPave.SetInterference(-1); + aPave.SetType (BooleanOperations_EdgeEdge); + aPave.SetIndex(aNewShape); + aPave.SetParam(aT); + // + BOPTools_PaveSet& aPaveSet=myPavePoolNew(myDS->RefEdge(nE)); + aPaveSet.Append(aPave); + } + } + }// for (i=1; i<=aNb; ++i) {// xx +} +//======================================================================= +// function:EENewVertices +// purpose: +//======================================================================= + void NMTTools_PaveFiller::EENewVertices (const TopoDS_Vertex& aNewVertex, + const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI) +{ + Standard_Integer i, aNewShape, nE1, nE2; + Standard_Real aT1, aT2; + BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq; + BOPTools_Pave aPave; + // + BOPTools_CArray1OfEEInterference& aEEs=myIntrPool->EEInterferences(); + // + // one new vertex case is treated in usual way + // + // Insert New Vertex in DS; + myDS->InsertShapeAndAncestorsSuccessors(aNewVertex, anASSeq); + aNewShape=myDS->NumberOfInsertedShapes(); + myDS->SetState (aNewShape, BooleanOperations_ON); + // Insert New Vertex in EE Interference + i=aMapVI.FindFromKey(aNewVertex); + BOPTools_EEInterference& aEEInterf= aEEs(i); + aEEInterf.SetNewShape(aNewShape); + // Extact interference info + aEEInterf.Indices(nE1, nE2); + const IntTools_CommonPrt& aCPart=aEEInterf.CommonPrt(); + VertexParameters(aCPart, aT1, aT2); + // + // Add Paves to the myPavePoolNew + aPave.SetInterference(i); + aPave.SetType (BooleanOperations_EdgeEdge); + aPave.SetIndex(aNewShape); + // Pave for edge nE1 + aPave.SetParam(aT1); + BOPTools_PaveSet& aPaveSet1=myPavePoolNew(myDS->RefEdge(nE1)); + aPaveSet1.Append(aPave); + // Pave for edge nE2 + aPave.SetParam(aT2); + BOPTools_PaveSet& aPaveSet2=myPavePoolNew(myDS->RefEdge(nE2)); + aPaveSet2.Append(aPave); +} +*/ diff --git a/src/NMTTools/NMTTools_PaveFiller_6.cxx b/src/NMTTools/NMTTools_PaveFiller_6.cxx index 27a62d3c3..298162362 100644 --- a/src/NMTTools/NMTTools_PaveFiller_6.cxx +++ b/src/NMTTools/NMTTools_PaveFiller_6.cxx @@ -107,6 +107,8 @@ #include #include #include +// +#include static Standard_Boolean IsPairFound(const Standard_Integer nF1, @@ -135,6 +137,10 @@ static TopTools_ListOfShape& aLS); // Contribution of Samtech www.samcef.com END +static + Standard_Boolean IsMicroEdge(const TopoDS_Edge& aE, + IntTools_Context& aCtx); + //======================================================================= // function: PerformFF // purpose: @@ -272,6 +278,7 @@ static Standard_Boolean bIsExistingPaveBlock, bIsValidIn2D, bIsCoincided; // Contribution of Samtech www.samcef.com END // + Standard_Boolean bIsMicroEdge; Standard_Integer i, aNbFFs, nF1, nF2, aBid=0; Standard_Integer nV1, nV2, j, aNbCurves; Standard_Real aTolR3D, aTol2D, aT1, aT2, aTolPPC=Precision::PConfusion(); @@ -510,33 +517,27 @@ static // BOPTools_Tools::MakeSectEdge (aIC, aV1, aT1, aV2, aT2, aES); // - //modified by NIZNHY-PKV Thu Nov 16 11:13:46 2006f SKL/PartC5 - { - Handle(Geom2d_Curve) aC2D1, aC2D2; - // - aC2D1=aIC.FirstCurve2d(); - aC2D2=aIC.SecondCurve2d(); - // - NMTTools_Tools::MakePCurve(aES, aF1, aC2D1); - NMTTools_Tools::MakePCurve(aES, aF2, aC2D2); - NMTTools_Tools::UpdateEdge (aES, aTolR3D); + // use_01 f + // + NMTTools_Tools::UpdateEdge (aES, aTolR3D); + bIsMicroEdge=IsMicroEdge(aES, myContext); + if (bIsMicroEdge) { + continue; } - // - /* + //use_01 t + // + // SKL/PartC5 f { - Standard_Real aTolR2D; Handle(Geom2d_Curve) aC2D1, aC2D2; // - aTolR2D=aFFi.TolR2D(); aC2D1=aIC.FirstCurve2d(); aC2D2=aIC.SecondCurve2d(); // - NMTTools_Tools::MakePCurve(aES, aF1, aC2D1, aTolR2D); - NMTTools_Tools::MakePCurve(aES, aF2, aC2D2, aTolR2D); + NMTTools_Tools::MakePCurve(aES, aF1, aC2D1); + NMTTools_Tools::MakePCurve(aES, aF2, aC2D2); + //SKL/PartC5 t } - */ - //modified by NIZNHY-PKV Thu Nov 16 11:17:34 2006t // aMEPB.Add(aES, aPBNew); aMapEI.Add(aES, i); @@ -742,13 +743,11 @@ static aF2FWD=aF2; aF2FWD.Orientation(TopAbs_FORWARD); // - //modified by NIZNHY-PKV Thu Nov 16 12:49:13 2006f SKL/PartC5 - //NMTTools_Tools::MakePCurve(aEx, aF1FWD, aC2D1, aTolEx); - //NMTTools_Tools::MakePCurve(aEx, aF2FWD, aC2D2, aTolEx); + // SKL/PartC5 f NMTTools_Tools::MakePCurve(aEx, aF1FWD, aC2D1); NMTTools_Tools::MakePCurve(aEx, aF2FWD, aC2D2); NMTTools_Tools::UpdateEdge (aEx, aTolEx); - //modified by NIZNHY-PKV Thu Nov 16 12:49:24 2006t + //SKL/PartC5 t } //if (aCBAPI.IsCommonBlock(aPB)) // // new SE @@ -816,8 +815,12 @@ static void NMTTools_PaveFiller::MakePCurves() { Standard_Integer i, aNb, nF1, nF2, nE; + Standard_Integer aNbCB, aNbF, nSp, nF; TopoDS_Face aF1FWD, aF2FWD; + TColStd_ListIteratorOfListOfInteger aItF; BOPTools_ListIteratorOfListOfPaveBlock anIt; + NMTTools_ListIteratorOfListOfCommonBlock aItCB; + TopAbs_ShapeEnum aType; // BOPTools_CArray1OfSSInterference& aFFs=myIntrPool->SSInterferences(); // @@ -846,7 +849,60 @@ static BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aE, aF1FWD); BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aE, aF2FWD); } - } + } + // + //modified by NIZNHY-PKV Fri Mar 23 10:35:02 2007f + // Check common blocks between edges and faces + // Build P-Curves if they were not built in previos block. + // + // The main case is :arguments for e.g aEdge, aFace -> no FFs, + // but p-curves are needed. + // + aNb=myDS->NumberOfShapesOfTheObject(); + for (i=1; i<=aNb; ++i) { + const TopoDS_Shape& aS=myDS->Shape(i); + aType=aS.ShapeType(); + // + if (aType!=TopAbs_EDGE) { + continue; + } + const TopoDS_Edge& aE=TopoDS::Edge(aS); + // + if (BRep_Tool::Degenerated(aE)) { + continue; + } + // + const NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(i)); + aNbCB=aLCB.Extent(); + if (!aNbCB) { + continue; + } + // + aItCB.Initialize(aLCB); + for (; aItCB.More(); aItCB.Next()) { + const NMTTools_CommonBlock& aCB=aItCB.Value(); + const BOPTools_PaveBlock &aPB1=aCB.PaveBlock1(); + // + const TColStd_ListOfInteger& aLF=aCB.Faces(); + aNbF=aLF.Extent(); + if (!aNbF) { + continue; + } + // + nSp=aPB1.Edge(); + const TopoDS_Edge aSp=TopoDS::Edge(myDS->Shape(nSp));//mpv + // + aItF.Initialize(aLF); + for (; aItF.More(); aItF.Next()) { + nF=aItF.Value(); + aF1FWD=TopoDS::Face(myDS->Shape(nF)); + aF1FWD.Orientation(TopAbs_FORWARD); + // + BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aSp, aF1FWD); + } // for (; aItCB.More(); aItCB.Next()) { + }//if (aS.ShapeType()==TopAbs_EDGE) { + } + //modified by NIZNHY-PKV Fri Mar 23 10:35:13 2007t } //======================================================================= // function: IsExistingPaveBlock @@ -1342,11 +1398,11 @@ void SharedEdges1(const TopoDS_Face& aF1, // V22 const BOPTools_Pave& aPave22=aPBR.Pave2(); nV22=aPave22.Index(); - //modified by NIZNHY-PKV Wed Nov 15 13:08:13 2006f + // if (nV11==nV21 || nV11==nV22 || nV12==nV21 || nV12==nV22) { continue; } - //modified by NIZNHY-PKV Wed Nov 15 13:08:15 2006t + // // E2 nE2=aPBR.Edge(); // @@ -1418,3 +1474,44 @@ void SharedEdges1(const TopoDS_Face& aF1, } // // Contribution of Samtech www.samcef.com END + +// use_01 f +//======================================================================= +//function : IsMicroEdge +//purpose : +//======================================================================= +Standard_Boolean IsMicroEdge(const TopoDS_Edge& aE, + IntTools_Context& aCtx) +{ + Standard_Boolean bRet; + Standard_Integer iErr; + Standard_Real aT1, aT2, aTmp; + Handle(Geom_Curve) aC3D; + TopoDS_Vertex aV1, aV2; + IntTools_Range aR; + // + bRet=(BRep_Tool::Degenerated(aE) || + !BRep_Tool::IsGeometric(aE)); + if (bRet) { + return bRet; + } + // + aC3D=BRep_Tool::Curve(aE, aT1, aT2); + TopExp::Vertices(aE, aV1, aV2); + aT1=BRep_Tool::Parameter(aV1, aE); + aT2=BRep_Tool::Parameter(aV2, aE); + if (aT2Shape(nEx)); + aTolEx=BRep_Tool::Tolerance(aEx); + if (aTolEx>aTolExMax) { + aTolExMax=aTolEx; + aLPBx.Prepend(aPBx); + } + else{ + aLPBx.Append(aPBx); + } + } + // + pLPB->Clear(); + *pLPB=aLPBx; + } + //modified by NIZNHY-PKV Wed Nov 8 15:59:50 2006t + // BOPTools_PaveBlock& aPB=aCB.PaveBlock1(nE); nSp=SplitIndex(aPB); aPB.SetEdge(nSp); diff --git a/src/OBJECT/GEOM_AISShape.cxx b/src/OBJECT/GEOM_AISShape.cxx index 7c89cd2fe..4a3f6e0e9 100644 --- a/src/OBJECT/GEOM_AISShape.cxx +++ b/src/OBJECT/GEOM_AISShape.cxx @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -100,7 +101,7 @@ static void indicesToOwners( const TColStd_IndexedMapOfInteger& aIndexMap, TopExp::MapShapes(aMainShape, aMapOfShapes); for ( Standard_Integer i = 1, n = anAllMap.Extent(); i <= n; i++ ) { - Handle(SelectMgr_EntityOwner) anOwner = anAllMap( i ); + Handle(StdSelect_BRepOwner) anOwner = Handle(StdSelect_BRepOwner)::DownCast(anAllMap( i )); if ( anOwner.IsNull() || !anOwner->HasShape() ) continue; @@ -115,11 +116,9 @@ static void indicesToOwners( const TColStd_IndexedMapOfInteger& aIndexMap, } GEOM_AISShape::GEOM_AISShape(const TopoDS_Shape& shape, - const Standard_CString aName): SALOME_AISShape(shape) + const Standard_CString aName) + : SALOME_AISShape(shape), myName(aName) { - myName = new char [strlen(aName)+1]; - strcpy( myName, aName); - myShadingColor = Quantity_Color( Quantity_NOC_GOLDENROD ); } @@ -140,8 +139,7 @@ Standard_Boolean GEOM_AISShape::hasIO(){ void GEOM_AISShape::setName(const Standard_CString aName) { - myName = new char [strlen(aName)+1]; - strcpy( myName, aName); + myName = aName; Handle(SALOME_InteractiveObject) IO = getIO(); if ( !IO.IsNull() ) @@ -149,7 +147,7 @@ void GEOM_AISShape::setName(const Standard_CString aName) } Standard_CString GEOM_AISShape::getName(){ - return myName; + return myName.ToCString(); } void GEOM_AISShape::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, diff --git a/src/OBJECT/GEOM_AISShape.hxx b/src/OBJECT/GEOM_AISShape.hxx index 1fa87d0a8..a90919622 100644 --- a/src/OBJECT/GEOM_AISShape.hxx +++ b/src/OBJECT/GEOM_AISShape.hxx @@ -55,6 +55,8 @@ #include #endif +#include + class PrsMgr_PresentationManager3d; class Prs3d_Presentation; class SALOME_InteractiveObject; @@ -102,34 +104,16 @@ public: // friend Handle_Standard_Type& GEOM_AISShape_Type_(); const Handle(Standard_Type)& DynamicType() const; - Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // + Standard_Boolean IsKind(const Handle(Standard_Type)&) const; +protected: + Quantity_Color myShadingColor; private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - Standard_CString myName; - Quantity_Color myShadingColor; + TCollection_AsciiString myName; }; - - - // other inline functions and methods (like "C++: function call" methods) // diff --git a/src/OBJECT/GEOM_AISVector.cxx b/src/OBJECT/GEOM_AISVector.cxx new file mode 100644 index 000000000..66e968da8 --- /dev/null +++ b/src/OBJECT/GEOM_AISVector.cxx @@ -0,0 +1,91 @@ +// GEOM OBJECT : interactive object for Geometry entities visualization +// +// 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 : GEOM_AISVector.cxx +// Author : Julia DOROVSKIKH +// $Header$ + + +#include + +// OCCT Includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +IMPLEMENT_STANDARD_HANDLE(GEOM_AISVector, GEOM_AISShape) +IMPLEMENT_STANDARD_RTTIEXT(GEOM_AISVector, GEOM_AISShape) + +//======================================================================= +//function : GEOM_AISVector +//purpose : Constructor +//======================================================================= +GEOM_AISVector::GEOM_AISVector (const TopoDS_Shape& theShape, const Standard_CString theName) + : GEOM_AISShape(theShape, theName) +{ +} + +//======================================================================= +//function : Compute +//purpose : Compute a presentation +//======================================================================= +void GEOM_AISVector::Compute (const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, + const Handle(Prs3d_Presentation)& thePrs, + const Standard_Integer theMode) +{ + GEOM_AISShape::Compute(thePresentationManager, thePrs, theMode); + + if (myshape.ShapeType() == TopAbs_EDGE) + { + TopoDS_Vertex aV1, aV2; + TopoDS_Edge anEdgeE = TopoDS::Edge(myshape); + TopExp::Vertices(anEdgeE, aV1, aV2); + gp_Pnt aP1 = BRep_Tool::Pnt(aV1); + gp_Pnt aP2 = BRep_Tool::Pnt(aV2); + + gp_Vec aVec (aP1, aP2); + Standard_Real aDist = aVec.Magnitude(); + if (aDist > gp::Resolution()) + { + gp_Dir aDir (aVec); + + Handle(Graphic3d_Group) aG = Prs3d_Root::CurrentGroup(thePrs); + + //thePrs->Color(myShadingColor.Name()); + //aG->BeginPrimitives(); + Prs3d_Arrow::Draw(thePrs, aP2, aDir, PI/180.*5., aDist/10.); + //aG->EndPrimitives(); + } + } + //thePrs->ReCompute(); // for hidden line recomputation if necessary... +} diff --git a/src/OBJECT/GEOM_AISVector.hxx b/src/OBJECT/GEOM_AISVector.hxx new file mode 100644 index 000000000..993e17c33 --- /dev/null +++ b/src/OBJECT/GEOM_AISVector.hxx @@ -0,0 +1,63 @@ +// GEOM OBJECT : interactive object for Geometry entities visualization +// +// 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 : GEOM_AISVector.hxx +// Author : Julia DOROVSKIKH +// Module : GEOM + +#ifndef GEOM_AISVector_HeaderFile +#define GEOM_AISVector_HeaderFile + +#include +#include + +/*! + * \class GEOM_AISVector + * \brief Interactive object, representing a vector with arrow on its end + */ + +class GEOM_AISVector : public GEOM_AISShape +{ +public: + /*! + * Constructor + * \param theShape A linear edge to be represented as a vector + * \param theName A name to be passed in constructor of \a GEOM_AISShape + */ + Standard_EXPORT GEOM_AISVector (const TopoDS_Shape& theShape, const Standard_CString theName); + +protected: + /*! + * Redefined from GEOM_AISShape + */ + virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, + const Handle(Prs3d_Presentation)& thePresentation, + const Standard_Integer theMode = 0); + +public: + DEFINE_STANDARD_RTTI (GEOM_AISVector) +}; + +DEFINE_STANDARD_HANDLE(GEOM_AISVector, GEOM_AISShape) + +#endif diff --git a/src/OBJECT/GEOM_Actor.cxx b/src/OBJECT/GEOM_Actor.cxx index 0e7f3ccba..e1ff41541 100644 --- a/src/OBJECT/GEOM_Actor.cxx +++ b/src/OBJECT/GEOM_Actor.cxx @@ -113,7 +113,7 @@ void GEOM_Actor::ShallowCopy(vtkProp *prop) GEOM_Actor *f = GEOM_Actor::SafeDownCast(prop); if ( f != NULL ) { - this->setInputShape(f->getTopo(),f->getDeflection(),f->getDisplayMode()); + this->setInputShape(f->getTopo(),f->getDeflection(),f->getDisplayMode(),f->isVector()); this->setName( f->getName() ); if ( f->hasIO() ) this->setIO( f->getIO() ); @@ -155,9 +155,12 @@ void GEOM_Actor::setDeflection(double adef) { deflection = adef; } -void GEOM_Actor::setInputShape(const TopoDS_Shape& aShape,double adef,int imode) { +void GEOM_Actor::setInputShape(const TopoDS_Shape& aShape, double adef, + int imode, bool isVector) +{ myShape = aShape; deflection = adef; + myIsVector = isVector; setDisplayMode(imode); } @@ -192,10 +195,10 @@ void GEOM_Actor::CreateMapper(int theMode) { this->SetPosition(aPnt.X(),aPnt.Y(),aPnt.Z()); } GEOM_OCCReader* aread = GEOM_OCCReader::New(); - aread->setTopo(myShape); + aread->setTopo(myShape, myIsVector); aread->setDisplayMode(theMode); aread->GetOutput()->ReleaseDataFlagOn(); - + vtkPolyDataMapper* aMapper = vtkPolyDataMapper::New(); if (theMode == 0) { aMapper->SetInput(aread->GetOutput()); diff --git a/src/OBJECT/GEOM_Actor.h b/src/OBJECT/GEOM_Actor.h index 9fb32dc83..ae4a08d10 100644 --- a/src/OBJECT/GEOM_Actor.h +++ b/src/OBJECT/GEOM_Actor.h @@ -58,11 +58,14 @@ class GEOM_OBJECT_EXPORT GEOM_Actor : public SALOME_Actor { void ReleaseGraphicsResources(vtkWindow *); const TopoDS_Shape& getTopo(); - void setInputShape(const TopoDS_Shape& ashape,double adef1,int imode); + void setInputShape(const TopoDS_Shape& ashape, double adef1, + int imode, bool isVector = false); double getDeflection(); void setDeflection(double adefl); + double isVector() { return myIsVector; } + // SubShape void SubShapeOn(); void SubShapeOff(); @@ -110,6 +113,7 @@ class GEOM_OBJECT_EXPORT GEOM_Actor : public SALOME_Actor { TopoDS_Shape myShape; double deflection; + bool myIsVector; vtkMapper* ShadingMapper; vtkMapper* WireframeMapper; diff --git a/src/OBJECT/GEOM_AssemblyBuilder.cxx b/src/OBJECT/GEOM_AssemblyBuilder.cxx index b4d94c841..cb1a8ba03 100644 --- a/src/OBJECT/GEOM_AssemblyBuilder.cxx +++ b/src/OBJECT/GEOM_AssemblyBuilder.cxx @@ -185,21 +185,23 @@ void GEOM_AssemblyBuilder::MeshShape(const TopoDS_Shape myShape, vtkActorCollection* GEOM_AssemblyBuilder::BuildActors(const TopoDS_Shape& myShape, - Standard_Real deflection, - Standard_Integer mode, - Standard_Boolean forced) { - + Standard_Real deflection, + Standard_Integer mode, + Standard_Boolean forced, + Standard_Boolean isVector) +{ vtkActorCollection* AISActors = vtkActorCollection::New(); if(myShape.ShapeType() == TopAbs_COMPOUND) { TopoDS_Iterator anItr(myShape); for(; anItr.More(); anItr.Next()) { - vtkActorCollection* theActors = GEOM_AssemblyBuilder::BuildActors(anItr.Value(), deflection, mode, forced); + vtkActorCollection* theActors = + GEOM_AssemblyBuilder::BuildActors(anItr.Value(), deflection, mode, forced); theActors->InitTraversal(); vtkActor* anActor = (vtkActor*)theActors->GetNextActor(); while(!(anActor==NULL)) { - AISActors->AddItem(anActor); - anActor = (vtkActor*)theActors->GetNextActor(); + AISActors->AddItem(anActor); + anActor = (vtkActor*)theActors->GetNextActor(); } } } @@ -301,7 +303,7 @@ vtkActorCollection* GEOM_AssemblyBuilder::BuildActors(const TopoDS_Shape& myShap } } else if ( myShape.ShapeType() == TopAbs_EDGE ) { // EDGE Actor GEOM_Actor* EdgeActor = GEOM_Actor::New(); - EdgeActor->setInputShape(myShape,deflection,mode); + EdgeActor->setInputShape(myShape,deflection,mode,isVector); EdgeActor->SetShadingProperty(EdgeIProp); EdgeActor->SetWireframeProperty(EdgeIProp); EdgeActor->SetPreviewProperty(EdgePVProp); diff --git a/src/OBJECT/GEOM_AssemblyBuilder.h b/src/OBJECT/GEOM_AssemblyBuilder.h index 36149732c..c74cc11d5 100644 --- a/src/OBJECT/GEOM_AssemblyBuilder.h +++ b/src/OBJECT/GEOM_AssemblyBuilder.h @@ -74,7 +74,8 @@ class GEOM_OBJECT_EXPORT GEOM_AssemblyBuilder { static vtkActorCollection* BuildActors(const TopoDS_Shape& myShape, Standard_Real deflection, Standard_Integer amode, - Standard_Boolean forced); + Standard_Boolean forced, + Standard_Boolean isVector = Standard_False); //------------------------------------------------------------------ diff --git a/src/OBJECT/GEOM_OCCReader.cxx b/src/OBJECT/GEOM_OCCReader.cxx index 2bd8dad5d..01400b67f 100644 --- a/src/OBJECT/GEOM_OCCReader.cxx +++ b/src/OBJECT/GEOM_OCCReader.cxx @@ -740,14 +740,19 @@ void GEOM_OCCReader::TransferEdgeWData(const TopoDS_Edge& aEdge, edgeTransf = aEdgeLoc.Transformation(); } + gp_Pnt aP1, aP2; + Standard_Integer nbnodes; if (aEdgePoly.IsNull()) { nbnodes = P->NbNodes(); const TColgp_Array1OfPnt& theNodesP = P->Nodes(); + aP1 = theNodesP(1); + aP2 = theNodesP(nbnodes); + float coord[3]; int pts[2]; - + for(int j=1;jNodes(); const TColgp_Array1OfPnt& theNodesPoly = T->Nodes(); + aP1 = theNodesPoly(1); + aP2 = theNodesPoly(nbnodes); + float coord[3]; int pts[2]; @@ -802,6 +810,91 @@ void GEOM_OCCReader::TransferEdgeWData(const TopoDS_Edge& aEdge, Cells->InsertNextCell(2,pts); } } + + // vector representation has an arrow on its end + if (myIsVector) + { + if (!isidtrsf) { + // apply edge transformation + aP1.Transform(edgeTransf); + aP2.Transform(edgeTransf); + } + + // draw an arrow + gp_Vec aDirVec (aP1, aP2); + Standard_Real aDist = aDirVec.Magnitude(); + if (aDist < gp::Resolution()) return; + gp_Dir aDirection (aDirVec); + + Standard_Real anAngle = PI/180.*5.; + Standard_Real aLength = aDist/10.; + + Standard_Real dx,dy,dz; + aDirection.Coord(dx,dy,dz); + + // Pointe de la fleche + Standard_Real xo,yo,zo; + aP2.Coord(xo,yo,zo); + + // Centre du cercle base de la fleche + gp_XYZ aPc = aP2.XYZ() - aDirection.XYZ() * aLength; + + // Construction d'un repere i,j pour le cercle + gp_Dir aDirN; + if (Abs(dx) <= Abs(dy) && Abs(dx) <= Abs(dz)) aDirN = gp::DX(); + else if (Abs(dy) <= Abs(dz) && Abs(dy) <= Abs(dx)) aDirN = gp::DY(); + else aDirN = gp::DZ(); + + gp_Dir aDirI = aDirection ^ aDirN; + gp_Dir aDirJ = aDirection ^ aDirI; + + // Add points and segments, composing the arrow + Standard_Real cosinus, sinus, Tg = tan(anAngle); + + float coord[3]; + coord[0] = xo; coord[1] = yo; coord[2] = zo; + + int ptLoc = Pts->InsertNextPoint(coord); + int ptFirst = 0; + int ptPrev = 0; + int ptCur = 0; + + int pts[2]; + + int NbPoints = 15; + for (int i = 1; i <= NbPoints; i++, ptPrev = ptCur) + { + cosinus = cos(2. * PI / NbPoints * (i-1)); + sinus = sin(2. * PI / NbPoints * (i-1)); + + gp_XYZ aP = aPc + (aDirI.XYZ() * cosinus + aDirJ.XYZ() * sinus) * aLength * Tg; + coord[0] = aP.X(); + coord[1] = aP.Y(); + coord[2] = aP.Z(); + + // insert pts + ptCur = Pts->InsertNextPoint(coord); + pts[0] = ptCur; + + if (i == 1) { + ptFirst = ptCur; + } + else { + // insert line (ptCur,ptPrev) + pts[1] = ptPrev; + Cells->InsertNextCell(2,pts); + } + + // insert line (ptCur,ptLoc) + pts[1] = ptLoc; + Cells->InsertNextCell(2,pts); + } + + // insert line (ptCur,ptFirst) + pts[0] = ptCur; + pts[1] = ptFirst; + Cells->InsertNextCell(2,pts); + } } /* Standard_Integer nbnodes = aEdgePoly->NbNodes(); @@ -972,8 +1065,9 @@ void GEOM_OCCReader::setDisplayMode(int thenewmode) { amode = thenewmode; } -void GEOM_OCCReader::setTopo(const TopoDS_Shape& aShape) { +void GEOM_OCCReader::setTopo(const TopoDS_Shape& aShape, bool isVector) { myShape = aShape; + myIsVector = isVector; } void GEOM_OCCReader::setForceUpdate(Standard_Boolean bol) { diff --git a/src/OBJECT/GEOM_OCCReader.h b/src/OBJECT/GEOM_OCCReader.h index d17f6d484..5c0288a75 100644 --- a/src/OBJECT/GEOM_OCCReader.h +++ b/src/OBJECT/GEOM_OCCReader.h @@ -59,7 +59,7 @@ class GEOM_OBJECT_EXPORT GEOM_OCCReader : public vtkPolyDataSource { const TopoDS_Shape& getTopo(); - void setTopo(const TopoDS_Shape& ashape); + void setTopo(const TopoDS_Shape& ashape, bool isVector = false); int getDisplayMode(); void setDisplayMode(int); @@ -133,6 +133,7 @@ class GEOM_OBJECT_EXPORT GEOM_OCCReader : public vtkPolyDataSource { int amode; int nbisos; TopoDS_Shape myShape; + bool myIsVector; }; diff --git a/src/OBJECT/Makefile.am b/src/OBJECT/Makefile.am index db262c7f0..3d3e0dacb 100644 --- a/src/OBJECT/Makefile.am +++ b/src/OBJECT/Makefile.am @@ -38,6 +38,7 @@ salomeinclude_HEADERS = \ Handle_GEOM_InteractiveObject.hxx \ GEOM_AISTrihedron.hxx \ GEOM_VTKTrihedron.hxx \ + GEOM_AISVector.hxx \ GEOM_OBJECT_defs.hxx # Libraries targets @@ -50,7 +51,8 @@ dist_libGEOMObject_la_SOURCES = \ GEOM_AISShape.cxx \ GEOM_InteractiveObject.cxx \ GEOM_AISTrihedron.cxx \ - GEOM_VTKTrihedron.cxx + GEOM_VTKTrihedron.cxx \ + GEOM_AISVector.cxx libGEOMObject_la_CPPFLAGS = \ diff --git a/src/RepairGUI/RepairGUI_GlueDlg.cxx b/src/RepairGUI/RepairGUI_GlueDlg.cxx index 1b2407c42..3c017c410 100644 --- a/src/RepairGUI/RepairGUI_GlueDlg.cxx +++ b/src/RepairGUI/RepairGUI_GlueDlg.cxx @@ -26,6 +26,8 @@ // Module : GEOM // $Header$ +#include "OCCViewer_ViewModel.h" + #include "RepairGUI_GlueDlg.h" #include "DlgRef_1Sel_Ext.h" #include "GEOMImpl_Types.hxx" @@ -46,6 +48,9 @@ #include #include +#include +#include +#include using namespace std; @@ -60,10 +65,12 @@ using namespace std; //================================================================================= RepairGUI_GlueDlg::RepairGUI_GlueDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) - :GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize | - WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +: GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize | + WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), + myCurrConstrId( -1 ) { QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_GLUE_FACES"))); + QPixmap image2 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_GLUE_FACES2"))); QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_GLUE_TITLE")); @@ -71,7 +78,8 @@ RepairGUI_GlueDlg::RepairGUI_GlueDlg(GeometryGUI* theGeometryGUI, QWidget* paren /***************************************************************/ GroupConstructors->setTitle(tr("GEOM_GLUE_TITLE")); RadioButton1->setPixmap(image0); - RadioButton2->close(TRUE); + RadioButton2->setPixmap(image2); + //RadioButton2->close(TRUE); RadioButton3->close(TRUE); GroupPoints = new DlgRef_1Sel_Ext(this, "GroupPoints"); @@ -79,22 +87,51 @@ RepairGUI_GlueDlg::RepairGUI_GlueDlg(GeometryGUI* theGeometryGUI, QWidget* paren GroupPoints->TextLabel1->setText(tr("GEOM_SELECTED_SHAPE")); GroupPoints->PushButton1->setPixmap(image1); GroupPoints->LineEdit1->setReadOnly( true ); + + int aWidth = GroupPoints->TextLabel1->sizeHint().width() + + GroupPoints->PushButton1->sizeHint().width() + + GroupPoints->getGroupBoxLayout()->spacing(); Layout1->addWidget(GroupPoints, 2, 0); - QGridLayout* aLay = new QGridLayout( 0, 2, 2, 0, 6, "aLay" ); - QLabel* aLbl1 = new QLabel( tr( "GEOM_TOLERANCE" ), GroupPoints->GroupBox1 ); - myTolEdt = new QtxDblSpinBox( 0, 100, 1e-7, GroupPoints->GroupBox1 ); + QHBox* aHBox = new QHBox( GroupPoints->GroupBox1 ); + aHBox->setSpacing( 5 ); + + (new QLabel( tr( "GEOM_TOLERANCE" ), aHBox ))->setFixedWidth( aWidth ); + myTolEdt = new QtxDblSpinBox( 0, 100, 1e-7, aHBox ); + myTolEdt->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); myTolEdt->setPrecision( 10 ); myTolEdt->setValue( DEFAULT_TOLERANCE_VALUE ); + GroupPoints->getGroupBoxLayout()->addWidget( aHBox, 3, 0 ); + /***************************************************************/ - aLay->addWidget( aLbl1, 0, 0 ); - aLay->addWidget( myTolEdt, 0, 1 ); - - GroupPoints->getGroupBoxLayout()->addLayout( aLay, 3, 0 ); + GroupPoints2 = new DlgRef_1Sel_Ext(this, "GroupPoints2"); + GroupPoints2->GroupBox1->setTitle(tr("GEOM_GLUE")); + GroupPoints2->TextLabel1->setText(tr("GEOM_SELECTED_SHAPE")); + GroupPoints2->PushButton1->setPixmap(image1); + GroupPoints2->LineEdit1->setReadOnly( true ); + Layout1->addWidget(GroupPoints2, 2, 0); + + QGrid* aGrid = new QGrid( 2, Qt::Horizontal, GroupPoints2->GroupBox1 ); + aGrid->setSpacing( 5 ); + (new QLabel( tr( "GEOM_TOLERANCE" ), aGrid ))->setFixedWidth( aWidth );; + myTolEdt2 = new QtxDblSpinBox( 0, 100, 1e-7, aGrid ); + myTolEdt2->setPrecision( 10 ); + myTolEdt2->setValue( DEFAULT_TOLERANCE_VALUE ); + myTolEdt2->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + (new QLabel( tr( "GLUE_FACES" ), aGrid ))->setFixedWidth( aWidth );; + myDetectBtn = new QPushButton( tr( "GEOM_DETECT" ), aGrid ); + myDetectBtn->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + mySubShapesChk = new QCheckBox( tr( "SELECT_FACES" ), aGrid ); + GroupPoints2->getGroupBoxLayout()->addWidget( aGrid, 3, 0 ); /***************************************************************/ setHelpFileName("glue_faces.htm"); + + // Disable second way of gluing if OCC viewer is not active one + if (SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() + != OCCViewer_Viewer::Type()) + RadioButton2->setEnabled(false); Init(); } @@ -121,19 +158,100 @@ void RepairGUI_GlueDlg::Init() myObject = GEOM::GEOM_Object::_nil(); //myGeomGUI->SetState( 0 ); - globalSelection( GEOM_COMPOUND ); + //globalSelection( GEOM_COMPOUND ); /* signals and slots connections */ connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(GroupPoints2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints2->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect( myTolEdt2, SIGNAL( valueChanged( double ) ), this, SLOT( onTolerChanged( double ) ) ); + connect( mySubShapesChk, SIGNAL( stateChanged( int ) ), this, SLOT( onSubShapesChk() ) ); + + connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()) ); + + connect(myDetectBtn, SIGNAL(clicked()), this, SLOT(onDetect())); initName( tr( "GLUE_NEW_OBJ_NAME" ) ); + + ConstructorsClicked(0); + + activateSelection(); + updateButtonState(); +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void RepairGUI_GlueDlg::ConstructorsClicked( int constructorId ) +{ + if ( myCurrConstrId == constructorId ) + return; + + disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); + + switch ( constructorId ) + { + case 0: + { + GroupPoints2->hide(); + resize( 0, 0 ); + GroupPoints->show(); + GroupPoints->LineEdit1->setText( "" ); + myEditCurrentArgument = GroupPoints->LineEdit1; + + if ( myCurrConstrId >= 0 ) // i.e. it is not initialisation + { + // copy tolerance from previous tolerance field + myTolEdt->setValue( myTolEdt2->value() ); + } + + break; + } + case 1: + { + GroupPoints->hide(); + resize(0, 0); + GroupPoints2->show(); + GroupPoints->LineEdit1->setText(""); + myEditCurrentArgument = GroupPoints2->LineEdit1; + + if ( myCurrConstrId >= 0 ) // i.e. it is not initialisation + { + // copy tolerance from previous tolerance field + myTolEdt2->setValue( myTolEdt->value() ); + mySubShapesChk->setChecked( false ); + clearTemporary(); + } + + break; + } + } + + myCurrConstrId = constructorId; + + myEditCurrentArgument->setFocus(); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + qApp->processEvents(); + updateGeometry(); + QSize aSize = minimumSizeHint(); + resize( width(), aSize.height() ); + + displayPreview(); + updateButtonState(); + activateSelection(); + SelectionIntoArgument(); } @@ -159,10 +277,12 @@ bool RepairGUI_GlueDlg::ClickOnApply() initName(); - GroupPoints->LineEdit1->setText(""); - myObject = GEOM::GEOM_Object::_nil(); + //GroupPoints->LineEdit1->setText(""); + //myObject = GEOM::GEOM_Object::_nil(); - globalSelection( GEOM_COMPOUND ); + //globalSelection( GEOM_COMPOUND ); + + ConstructorsClicked( getConstructorId() ); return true; } @@ -174,6 +294,9 @@ bool RepairGUI_GlueDlg::ClickOnApply() //================================================================================= void RepairGUI_GlueDlg::SelectionIntoArgument() { + if ( mySubShapesChk->isChecked() && getConstructorId() == 1 ) + return; + erasePreview(); myEditCurrentArgument->setText(""); myObject = GEOM::GEOM_Object::_nil(); @@ -185,6 +308,7 @@ void RepairGUI_GlueDlg::SelectionIntoArgument() if ( aRes ) myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) ); } + updateButtonState(); } //================================================================================= @@ -194,7 +318,7 @@ void RepairGUI_GlueDlg::SelectionIntoArgument() void RepairGUI_GlueDlg::SetEditCurrentArgument() { const QObject* send = sender(); - if ( send == GroupPoints->PushButton1 ) { + if ( send == GroupPoints->PushButton1 || send == GroupPoints2->PushButton1 ) { myEditCurrentArgument->setFocus(); SelectionIntoArgument(); } @@ -212,6 +336,10 @@ void RepairGUI_GlueDlg::LineEditReturnPressed() myEditCurrentArgument = GroupPoints->LineEdit1; GEOMBase_Skeleton::LineEditReturnPressed(); } + else if( send == GroupPoints2->LineEdit1 ) { + myEditCurrentArgument = GroupPoints2->LineEdit1; + GEOMBase_Skeleton::LineEditReturnPressed(); + } } @@ -225,11 +353,13 @@ void RepairGUI_GlueDlg::ActivateThisDialog() connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - GroupPoints->LineEdit1->setText(""); - myObject = GEOM::GEOM_Object::_nil(); + //GroupPoints->LineEdit1->setText(""); + //GroupPoints2->LineEdit1->setText(""); + //myObject = GEOM::GEOM_Object::_nil(); //myGeomGUI->SetState( 0 ); - globalSelection( GEOM_COMPOUND ); + //globalSelection( GEOM_COMPOUND ); + activateSelection(); } @@ -243,7 +373,6 @@ void RepairGUI_GlueDlg::enterEvent(QEvent* e) ActivateThisDialog(); } - //================================================================================= // function : closeEvent() // purpose : @@ -254,6 +383,7 @@ void RepairGUI_GlueDlg::closeEvent(QCloseEvent* e) GEOMBase_Skeleton::closeEvent( e ); } + //================================================================================= // function : createOperation // purpose : @@ -279,15 +409,74 @@ bool RepairGUI_GlueDlg::isValid( QString& msg ) bool RepairGUI_GlueDlg::execute( ObjectList& objects ) { bool aResult = false; - GEOM::GEOM_Object_var anObj = GEOM::GEOM_IShapesOperations::_narrow - ( getOperation() )->MakeGlueFaces( myObject, myTolEdt->value() ); - aResult = !anObj->_is_nil(); - if ( aResult ) - objects.push_back( anObj._retn() ); + objects.clear(); + + switch ( getConstructorId() ) + { + case 0 : + { + GEOM::GEOM_Object_var anObj = GEOM::GEOM_IShapesOperations::_narrow + ( getOperation() )->MakeGlueFaces( myObject, myTolEdt2->value() ); + aResult = !anObj->_is_nil(); + if ( aResult ) + objects.push_back( anObj._retn() ); + break; + } + case 1 : + if ( IsPreview() ) + { + // if this method is used for displaying preview then we must detect glue faces only + ObjectList::iterator anIter; + for (anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter) + objects.push_back( GEOM::GEOM_Object::_duplicate( *anIter ) ); + return myTmpObjs.size() ? true : false; + } // IsPreview + + // Make glue face by list. + // Iterate through myTmpObjs and verifies where each object is currently selected or not. + QMap selected; + + // Get names of selected objects + SALOME_ListIteratorOfListIO it ( selectedIO() ); + for (; it.More(); it.Next()) + selected.insert( it.Value()->getName(), 0 ); + + // Iterate through result and select objects with names from selection + // ObjectList toRemoveFromEnggine; + ObjectList toGlue; + ObjectList::iterator anIter; + for (anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter) + { + if ( selected.contains( myGeomGUI->getApp()->orb()->object_to_string(*anIter) ) ) + toGlue.push_back(*anIter); + } + + // make glue faces + GEOM::ListOfGO_var aListForGlue = new GEOM::ListOfGO(); + aListForGlue->length( toGlue.size() ); + ObjectList::iterator anIter3 = toGlue.begin(); + for ( int i = 0; anIter3 != toGlue.end(); ++anIter3, ++i ) + aListForGlue[ i ] = *anIter3; + GEOM::GEOM_Object_var anObj = GEOM::GEOM_IShapesOperations::_narrow + ( getOperation() )->MakeGlueFacesByList( myObject, myTolEdt2->value(), aListForGlue ); + + aResult = !anObj->_is_nil(); + + if ( aResult ) + objects.push_back( anObj._retn() ); + + // Remove from engine useless objects + clearTemporary(); + + updateButtonState(); + + break; + } // case return aResult; } + //================================================================ // Function : clearShapeBufferLocal // Purpose : @@ -326,7 +515,7 @@ void RepairGUI_GlueDlg::clearShapeBufferLocal( GEOM::GEOM_Object_ptr theObj ) // It perfroms user input validation, then it // performs a proper operation and manages transactions, etc. //================================================================ -bool RepairGUI_GlueDlg::onAcceptLocal( const bool publish, const bool useTransaction ) +bool RepairGUI_GlueDlg::onAcceptLocal() { if ( !getStudy() || !( getStudy()->studyDS() ) ) return false; @@ -334,76 +523,79 @@ bool RepairGUI_GlueDlg::onAcceptLocal( const bool publish, const bool useTransac _PTR(Study) aStudy = getStudy()->studyDS(); bool aLocked = aStudy->GetProperties()->IsLocked(); - if ( aLocked ) { + if ( aLocked ) + { MESSAGE("GEOMBase_Helper::onAccept - ActiveStudy is locked"); SUIT_MessageBox::warn1 ( (QWidget*)(SUIT_Session::session()->activeApplication()->desktop()), - QObject::tr("WRN_WARNING"), - QObject::tr("WRN_STUDY_LOCKED"), - QObject::tr("BUT_OK") ); + QObject::tr("WRN_WARNING"), QObject::tr("WRN_STUDY_LOCKED"), QObject::tr("BUT_OK") ); return false; } QString msg; - if ( !isValid( msg ) ) { + if ( !isValid( msg ) ) + { showError( msg ); return false; } erasePreview( false ); - try { - if ( ( !publish && !useTransaction ) || openCommand() ) { - + try + { + if ( openCommand() ) + { SUIT_OverrideCursor wc; SUIT_Session::session()->activeApplication()->putInfo( "" ); ObjectList objects; - // JFA 28.12.2004 if ( !execute( objects ) || !getOperation()->IsDone() ) { - if ( !execute( objects ) ) { // JFA 28.12.2004 // To enable warnings - wc.suspend(); + + if ( !execute( objects ) ) + { + wc.suspend(); abortCommand(); - showError(); + showError(); } - else { - const int nbObjs = objects.size(); - bool withChildren = false; - for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it ) { - if ( publish ) { - QString aName(""); - if ( nbObjs > 1 ) - aName = strlen( getNewObjectName() ) ? GEOMBase::GetDefaultName( getNewObjectName() ) : GEOMBase::GetDefaultName( getPrefix( *it ) ); - else { - aName = getNewObjectName(); - // PAL6521: use a prefix, if some dialog box doesn't reimplement getNewObjectName() - if ( aName.isEmpty() ) - aName = GEOMBase::GetDefaultName( getPrefix( *it ) ); - } - addInStudy( *it, aName.latin1() ); - withChildren = false; - display( *it, false ); - } - else { // asv : fix of PAL6454. If publish==false, then the original shape was modified, and need to be re-cached in GEOM_Client - // before redisplay - clearShapeBufferLocal( *it ); - withChildren = true; - redisplay( *it, withChildren, false ); + else + { + const int nbObjs = objects.size(); + bool withChildren = false; + for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it ) + { + QString aName(""); + if ( nbObjs > 1 ) + { + aName = strlen( getNewObjectName() ) ? GEOMBase::GetDefaultName( getNewObjectName() ) : GEOMBase::GetDefaultName( getPrefix( *it ) ); + } + else + { + aName = getNewObjectName(); + // PAL6521: use a prefix, if some dialog box doesn't reimplement getNewObjectName() + if ( aName.isEmpty() ) + aName = GEOMBase::GetDefaultName( getPrefix( *it ) ); } - } - - if ( nbObjs ) { - commitCommand(); - updateObjBrowser(); - SUIT_Session::session()->activeApplication()->putInfo( QObject::tr("GEOM_PRP_DONE") ); - } - else { - abortCommand(); + addInStudy( *it, aName.latin1() ); + withChildren = false; + display( *it, false ); + } + + if ( nbObjs ) + { + commitCommand(); + updateObjBrowser(); + SUIT_Session::session()->activeApplication()->putInfo( QObject::tr("GEOM_PRP_DONE") ); + } + else + { + abortCommand(); } // JFA 28.12.2004 BEGIN // To enable warnings - if ( !getOperation()->_is_nil() ) { - if ( !getOperation()->IsDone() ) { + if ( !getOperation()->_is_nil() ) + { + if ( !getOperation()->IsDone() ) + { wc.suspend(); - QString msgw = QObject::tr( getOperation()->GetErrorCode() ); + QString msgw = QObject::tr( getOperation()->GetErrorCode() ); SUIT_MessageBox::warn1((QWidget*)(SUIT_Session::session()->activeApplication()->desktop()), QObject::tr( "WRN_WARNING" ), msgw, @@ -414,12 +606,195 @@ bool RepairGUI_GlueDlg::onAcceptLocal( const bool publish, const bool useTransac } } } - catch( const SALOME::SALOME_Exception& e ) { + catch( const SALOME::SALOME_Exception& e ) + { SalomeApp_Tools::QtCatchCorbaException( e ); abortCommand(); } updateViewer(); + activateSelection(); + updateButtonState(); return true; } + + +//================================================================================= +// function : onDetect +// purpose : +//================================================================================= +void RepairGUI_GlueDlg::onDetect() +{ + clearTemporary(); + QString msg; + if ( !isValid( msg ) ) { + showError( msg ); + return; + } + + GEOM::ListOfGO_var aList = GEOM::GEOM_IShapesOperations::_narrow + ( getOperation() )->GetGlueFaces( myObject, myTolEdt2->value() ); + + for (int i = 0, n = aList->length(); i < n; i++) + myTmpObjs.push_back(GEOM::GEOM_Object::_duplicate(aList[i])); + + if ( myTmpObjs.size() > 0 ) + { + msg = tr( "FACES_FOR_GLUING_ARE_DETECTED" ).arg( myTmpObjs.size() ); + mySubShapesChk->setChecked( true ); + } + else + { + msg = tr( "THERE_ARE_NO_FACES_FOR_GLUING" ); + } + + SUIT_MessageBox::info1( this, tr( "GEOM_FREE_BOUNDS_TLT" ), msg, "Close" ); + updateButtonState(); + activateSelection(); +} + +//================================================================================= +// function : activateSelection +// purpose : Redisplay preview and Activate selection +//================================================================================= +void RepairGUI_GlueDlg::activateSelection() +{ + erasePreview(false); + + int anId = getConstructorId(); + if ( anId == 0 ) // Case of whole gluing + { + disconnect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()) ) ; + + globalSelection( GEOM_ALLSHAPES ); + if (myObject->_is_nil()) + SelectionIntoArgument(); + + connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()) ) ; + } + else // Second case of gluing + { + if ( !mySubShapesChk->isChecked() ) + globalSelection( GEOM_ALLSHAPES ); + else + { + displayPreview( true, false, false, 2/*line width*/, 1/*display mode*/, Quantity_NOC_RED ); + globalSelection( GEOM_PREVIEW ); + } + } + + updateViewer(); +} + +//================================================================================= +// function : updateButtonState +// purpose : Update button state +//================================================================================= +void RepairGUI_GlueDlg::updateButtonState() +{ + int anId = getConstructorId(); + bool hasMainObj = !myObject->_is_nil(); + if ( anId == 0 ) + { + buttonOk->setEnabled( hasMainObj ); + buttonApply->setEnabled( hasMainObj ); + } + else + { + bool wasDetected = myTmpObjs.size() ? true : false; + buttonOk->setEnabled( hasMainObj && wasDetected ); + buttonApply->setEnabled( hasMainObj && wasDetected ); + mySubShapesChk->setEnabled( hasMainObj && wasDetected ); + myDetectBtn->setEnabled( hasMainObj ); + if ( !hasMainObj || !wasDetected ) + mySubShapesChk->setChecked( false ); + } +} + +//================================================================================= +// function : clearTemporary +// purpose : Remove temporary objects from engine +//================================================================================= +void RepairGUI_GlueDlg::clearTemporary() +{ + ObjectList::iterator anIter; + for (anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter) + getGeomEngine()->RemoveObject(*anIter); + + myTmpObjs.clear(); +} + +//================================================================================= +// function : onTolerChanged +// purpose : Remove temporary objects from engine +//================================================================================= +void RepairGUI_GlueDlg::onTolerChanged( double /*theVal*/ ) +{ + clearTemporary(); + activateSelection(); + updateButtonState(); +} + +//================================================================================= +// function : onSubShapesChk +// purpose : Update selection mode +//================================================================================= +void RepairGUI_GlueDlg::onSubShapesChk() +{ + if ( !mySubShapesChk->isChecked() ) + clearTemporary(); + activateSelection(); + updateButtonState(); +} + +//================================================================================= +// function : ClickOnCancel +// purpose : Remove temporary objects from engine and call method of base class +//================================================================================= +void RepairGUI_GlueDlg::ClickOnCancel() +{ + clearTemporary(); + GEOMBase_Skeleton::ClickOnCancel(); +} + +//================================================================ +// Function : getEntry +// Purpose : +//================================================================ +static string getEntry( GEOM::GEOM_Object_ptr object ) +{ + SUIT_Session* session = SUIT_Session::session(); + SalomeApp_Application* app = dynamic_cast( session->activeApplication() ); + if ( app ) + { + string IOR = app->orb()->object_to_string( object ); + if ( IOR != "" ) + { + SalomeApp_Study* study = ( SalomeApp_Study* )app->activeStudy(); + _PTR(SObject) SO ( study->studyDS()->FindObjectIOR( IOR ) ); + if ( SO ) + return SO->GetID(); + } + } + return ""; +} + + + + + + + + + + + + + + + + + diff --git a/src/RepairGUI/RepairGUI_GlueDlg.h b/src/RepairGUI/RepairGUI_GlueDlg.h index e23ff3ff2..eef24c2ca 100644 --- a/src/RepairGUI/RepairGUI_GlueDlg.h +++ b/src/RepairGUI/RepairGUI_GlueDlg.h @@ -32,6 +32,7 @@ class QtxDblSpinBox; class DlgRef_1Sel_Ext; +class QCheckBox; //================================================================================= // class : RepairGUI_GlueDlg @@ -42,8 +43,8 @@ class RepairGUI_GlueDlg : public GEOMBase_Skeleton Q_OBJECT public: - RepairGUI_GlueDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, - const char* name = 0, bool modal = FALSE, WFlags fl = 0); + RepairGUI_GlueDlg( GeometryGUI* theGeometryGUI, QWidget* parent = 0, + const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); ~RepairGUI_GlueDlg(); protected: @@ -57,16 +58,34 @@ private: void enterEvent(QEvent* e); void closeEvent(QCloseEvent* e); void initSelection(); + + void clearTemporary(); - bool onAcceptLocal( const bool publish = true, const bool useTransaction = true ); + bool onAcceptLocal(); void clearShapeBufferLocal( GEOM::GEOM_Object_ptr ); // Reimplementation of onAccept for local case of this class. - + + void activateSelection(); + void updateButtonState(); + void selectTmpInViewer(); + +private: + GEOM::GEOM_Object_var myObject; - + ObjectList myTmpObjs; + DlgRef_1Sel_Ext* GroupPoints; + DlgRef_1Sel_Ext* GroupPoints2; QtxDblSpinBox* myTolEdt; + QtxDblSpinBox* myTolEdt2; + QPushButton* myDetectBtn; + QCheckBox* mySubShapesChk; + int myCurrConstrId; + +protected slots: + virtual void ClickOnCancel(); + private slots: void ClickOnOk(); bool ClickOnApply(); @@ -76,6 +95,13 @@ private slots: void LineEditReturnPressed(); void SelectionIntoArgument(); void SetEditCurrentArgument(); + + void ConstructorsClicked(int); + //void ValueChangedInSpinBox(); + + void onDetect(); + void onTolerChanged( double ); + void onSubShapesChk(); }; #endif // DIALOGBOX_Glue_H