From 110596005f7994cf088b68accec7f5f781727519 Mon Sep 17 00:00:00 2001 From: ova Date: Tue, 14 Oct 2014 12:22:46 +0400 Subject: [PATCH] 0022761: [EDF] Improvement of Explode dialog box --- doc/salome/gui/GEOM/images/flat_contents.png | Bin 0 -> 12018 bytes .../gui/GEOM/input/creating_explode.doc | 96 +++--- idl/GEOM_Gen.idl | 13 +- src/EntityGUI/EntityGUI_SubShapeDlg.cxx | 284 +++++++----------- src/EntityGUI/EntityGUI_SubShapeDlg.h | 5 - src/GEOMImpl/GEOMImpl_IShapesOperations.cxx | 205 +++++++------ src/GEOMImpl/GEOMImpl_Types.hxx | 11 +- src/GEOM_SWIG/geomBuilder.py | 2 +- 8 files changed, 308 insertions(+), 308 deletions(-) create mode 100644 doc/salome/gui/GEOM/images/flat_contents.png diff --git a/doc/salome/gui/GEOM/images/flat_contents.png b/doc/salome/gui/GEOM/images/flat_contents.png new file mode 100644 index 0000000000000000000000000000000000000000..7b5d3859ddd7941216b34f92a213fda5090a4723 GIT binary patch literal 12018 zcmcJVbx@o^(5IIW+=5$xKp?pL;uav-;ts(HPH-m#32woIy9aj&782ZLac6N`T<*Ac*!y(GDSmXnVNst0U(s?LNG;xf*JgfcSmbhWsUE9@_{t73a&dIo`l zg7VEP)nin6qkIkT_IF5d{Q-D3@r1Kzcbw2q5b(-bkPvq%ols6C52Vx-6^vZqGd+h z#@~_b#LjAKwe&uTuSB`HEWH-M!&+3NB?@q(E?`c|ZwPS8 z$234u6Vl5XZ7H1 z_5vS8*mQYo8pZ0cGE>+K!S26`b`@+E;E*31*5qr!+FYip`O^o4_;sNFx0NQ-uFHJW zZJ04esTd+-iQ4}Z>abLGhPTS_FR%2v`uLUQRmq^ne@ib@+Zd!WsQeJ==$W>vVLUR! zJLybjy(45i^Ctmz1G2y9#?N|1L&W!8tXYkWSTiGY3G!oXqx6%zGbhDGOQV^XW$zH{ z^nv~~v8AXHcVq6BU@k*UvS|OtjJa@?a+|TM;QXLtL(-~^q@1SSLw@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iv6Jt!zTGk?H!* zLry1gdS-q^m+YZ1btWS&;@4|OfO1LvfowmyF9aBZxWjVMmb~++(g7NJU>G(AgBHuP z_`}!eLy59UxV-KW195;E8wlL+bhg&4?{?>0D~IHlWX+F%P!*cIPAO5nIr=dXC{)k&A;ikE4EGZ^Jewi7m0@h!X(@9 z0W_t$=N2Gn?a;v{2M9~aNM&W5GgDwJp!BqS?3v|?(*Ujo6^=l|FdZHdjmC!vlXQdso;+gif`qxb}HJQhg}3UJ<3a|q;k3Y3)r zZOFQ7r)Sd4eADF{&SWP?YmZ-auXFaiqbOIV<|1JPr>a0Nc8@EvHFvnq52tr(I{E{y zuX2!7q?WyUMain Menu -select New Entity > Explode. +To \b Explode an object into sub-shapes, in the Main Menu +select New Entity > Explode. This operation opens the +Sub Shapes Selection dialog box. -\n To create a list of sub-shapes (vertices, edges, wires etc.) of the +\image html neo-obj1.png + +To create a list of sub-shapes (vertices, edges, wires etc.) of the given shape using the \b Explode operation, you need to define the Main Object, which will be exploded and the Type of Sub-shapes you wish to obtain from it. -\n The \b Result of the operation will be a List of \b GEOM_Objects + +The \b Result of the operation will be a List of \b GEOM_Objects (vertexes, edges, wires, faces, shells or solids). -\n Using TUI Commands you can perform this operation in a +Available choices in the Sub Shapes Type combo box depend on the type +of selected Main Object: +- \b Compound: to extract compounds; +- \b Compsolid: to extract compsolids; +- \b Solid: to extract solids; +- \b Shell: to extract shells; +- \b Face: to extract faces; +- \b Wire: to extract wires; +- \b Edge: to extract edges; +- \b Vertex: to extract vertices; +- \b Shape: to extract top-level contents of the compound shape; +- \b Flat: to extract "flat" contents of the compound shape. + +Note: "flat" contents means top-level simple-type sub-shapes extracted from +the compound object recursively (i.e. there is no compounds in the result). +For example, if a compound C1 contains a solid S1 and another compound C2 that +contains solids S2 and S3 (see picture below): +- Explode operation with \b Shape type given as parameter will return S1 and C2; +- Explode operation with \b Flat type given as parameter will return S1, S2 and S3. + +\image html flat_contents.png + +Switching on Select Sub-shapes check box allows manual selection of sub-shapes +to be extracted from the main object. In this mode the user can select sub-shapes +directly in 3D viewer. + +Using TUI Commands you can perform this operation in a variety of ways: -
    -
  • geompy.ExtractShapes(Shape, Type, isSorted) explodes a -Shape into sub-shapes of a given Type and returns a List of sub-shapes. -This method does not return the Shape itself if it matches the -Type.
  • -
  • geompy.SubShapeAll(Shape, Type) explodes a Shape on -sub-shapes of a given Type and returns a List of sub-shapes.
  • -
  • geompy.SubShapeAllIDs(Shape, Type) explodes a Shape on -sub-shapes of a given Type and returns a List of IDs of -sub-shapes.
  • -
  • geompy.SubShapeAllSortedCentres(Shape, Type) explodes a -shape on sub-shapes of a given type and sorts them taking into account -their gravity centers, to provide stable order of sub-shapes. -It returns a list of sub-shapes.
  • -
  • geompy.SubShapeAllSortedCentresIDs(Shape, Type) explodes -a shape on sub-shapes of a given type and sorts them taking into -account their gravity centers, to provide stable order of sub-shapes. -It returns a List of IDs of sub-shapes.
  • -
  • geompy.SubShape(Shape, Type, ListOfInd) allows to obtain -a compound of sub-shapes of the Shape, selected by they indices in a -list of all sub-shapes of the given Type. Each index is in the range -[1, Nb_Sub-Shapes_Of_Given_Type].
  • -
  • geompy.SubShapeSortedCentres(Shape, Type, ListOfInd) -allows to obtain a compound of sub-shapes of the Shape, selected by -they indices in sorted list of all sub-shapes of the given Type. Each -index is in the range [1, Nb_Sub-Shapes_Of_Given_Type]
  • -
- -\n Arguments: 1 SHAPE + 1 type of SubShape. +- geompy.ExtractShapes(Shape, Type, isSorted) explodes a + Shape into sub-shapes of a given Type and returns a List of sub-shapes. + This method does not return the Shape itself if it matches the + Type. +- geompy.SubShapeAll(Shape, Type) explodes a Shape on + sub-shapes of a given Type and returns a List of sub-shapes. +- geompy.SubShapeAllIDs(Shape, Type) explodes a Shape on + sub-shapes of a given Type and returns a List of IDs of + sub-shapes. +- geompy.SubShapeAllSortedCentres(Shape, Type) explodes a + shape on sub-shapes of a given type and sorts them taking into account + their gravity centers, to provide stable order of sub-shapes. + It returns a list of sub-shapes. +- geompy.SubShapeAllSortedCentresIDs(Shape, Type) explodes + a shape on sub-shapes of a given type and sorts them taking into + account their gravity centers, to provide stable order of sub-shapes. + It returns a List of IDs of sub-shapes. +- geompy.SubShape(Shape, Type, ListOfInd) allows to obtain + a compound of sub-shapes of the Shape, selected by they indices in a + list of all sub-shapes of the given Type. Each index is in the range + [1, Nb_Sub-Shapes_Of_Given_Type]. +- geompy.SubShapeSortedCentres(Shape, Type, ListOfInd) + allows to obtain a compound of sub-shapes of the Shape, selected by + they indices in sorted list of all sub-shapes of the given Type. Each + index is in the range [1, Nb_Sub-Shapes_Of_Given_Type] -\image html neo-obj1.png +Arguments: 1 SHAPE + 1 type of SubShape. Example: diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index 924550b10..aebe5357e 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -39,7 +39,7 @@ module GEOM */ enum shape_type { - /*! */ + /*! A collection of arbitrary shapes */ COMPOUND, /*! A collection of solids */ COMPSOLID, @@ -47,16 +47,19 @@ module GEOM SOLID, /*! A collection of faces connected by some edges of their wire boundaries */ SHELL, - /*! Part of a plane (in 2D geometry) or a surface (in 3D geometry) bounded by a close wire */ + /*! Part of a plane (in 2D geometry) or a surface (in 3D geometry) bounded by a closed wire */ FACE, - /*! A sequence of edges connected by their vertices */ + /*! A sequence of edges connected by their vertices */ WIRE, /*! Edge, a shape corresponding to a curve, and bound by a vertex at each extremity */ EDGE, /*! A zero-dimensional shape corresponding to a point in geometry */ VERTEX, - /*! */ - SHAPE }; + /*! Arbitrary shape in a Compound (used for processing of Compounds in some operations) */ + SHAPE, + /*! Flat (top-level) contents of a Compound (used for processing of Compounds in some operations) */ + FLAT + }; /*! * \brief Marker type diff --git a/src/EntityGUI/EntityGUI_SubShapeDlg.cxx b/src/EntityGUI/EntityGUI_SubShapeDlg.cxx index 1b2060f3f..d17b41504 100644 --- a/src/EntityGUI/EntityGUI_SubShapeDlg.cxx +++ b/src/EntityGUI/EntityGUI_SubShapeDlg.cxx @@ -55,6 +55,62 @@ #include +namespace +{ + const char* const ShapeTypes [] = { + "Compound", + "Compsolid", + "Solid", + "Shell", + "Face", + "Wire", + "Edge", + "Vertex", + "Shape", + "Flat" + }; + + unsigned int NumberOfSubShapes(const TopoDS_Shape& S, const int shapeType, TopTools_MapOfShape& M) + { + unsigned int index = 0; + + if (!S.IsNull()) { + if (S.ShapeType() == TopAbs_COMPOUND && + (shapeType == TopAbs_SHAPE || shapeType == TopAbs_FLAT || shapeType == TopAbs_COMPOUND)) { + TopoDS_Iterator It(S, Standard_True, Standard_True); + for (; It.More(); It.Next()) { + TopoDS_Shape SS = It.Value(); + if (M.Add(SS)) { + if (shapeType == TopAbs_FLAT) { + if (SS.ShapeType() != TopAbs_COMPOUND) + index++; + else + index += NumberOfSubShapes(SS, shapeType, M); + } + else if (shapeType == TopAbs_SHAPE || shapeType == SS.ShapeType()) { + index++; + } + } + } + } + else { + TopExp_Explorer Exp (S, TopAbs_ShapeEnum(shapeType)); + for (; Exp.More(); Exp.Next()) { + if (M.Add(Exp.Current())) { + index++; + } + } + } + } + return index; + } + unsigned int NumberOfSubShapes(const TopoDS_Shape& S, const int shapeType) + { + TopTools_MapOfShape M; + return NumberOfSubShapes(S, shapeType, M); + } +} + //================================================================================= // class : EntityGUI_SubShapeDlg // purpose : Constructs a EntityGUI_SubShapeDlg which is a child of 'parent', with the @@ -66,7 +122,6 @@ EntityGUI_SubShapeDlg::EntityGUI_SubShapeDlg(GeometryGUI* theGeometryGUI, QWidge bool modal, Qt::WindowFlags fl) : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl), myDmMode( -1 ), - myWithShape(true), myIsHiddenMain(false) { QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_SUBSHAPE"))); @@ -133,18 +188,9 @@ void EntityGUI_SubShapeDlg::Init() myEditCurrentArgument = GroupPoints->LineEdit1; myObject = GEOM::GEOM_Object::_nil(); - myWithShape = true; - /* type for sub-shape selection */ - GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Compound"); - GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Compsolid"); - GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Solid"); - GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Shell"); - GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Face"); - GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Wire"); - GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Edge"); - GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Vertex"); - GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Shape"); + for ( int i = 0; i <= (int)GEOM::FLAT; i++ ) + GroupPoints->ComboBox1->addItem(ShapeTypes[i], i); if (SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() != OCCViewer_Viewer::Type()) @@ -172,6 +218,7 @@ void EntityGUI_SubShapeDlg::Init() updateButtonState(); resize(100,100); SelectionIntoArgument(); + SubShapeToggled(); } //================================================================================= @@ -282,6 +329,8 @@ void EntityGUI_SubShapeDlg::SelectionIntoArgument() if (!isAllSubShapes()) return; + int currentType = GroupPoints->ComboBox1->itemData( GroupPoints->ComboBox1->currentIndex() ).toInt(); + ResetStateOfDialog(); QString aString = ""; /* name of selection */ @@ -291,87 +340,47 @@ void EntityGUI_SubShapeDlg::SelectionIntoArgument() aSelMgr->selectedObjects(aSelList); int nbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aString, true); - if (nbSel != 1) - return; - - Handle(SALOME_InteractiveObject) IO = aSelList.First(); - if (!IO->hasEntry()) { - SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); - updateButtonState(); - return; - } - - if (myIsHiddenMain) { - GEOM_Displayer* aDisplayer = getDisplayer(); - aDisplayer->Display(myObject); - myIsHiddenMain = false; - } - - TopoDS_Shape S = GEOMBase::GetTopoFromSelection(aSelList); - if (S.IsNull() || S.ShapeType() == TopAbs_VERTEX) { - myObject = GEOM::GEOM_Object::_nil(); - updateButtonState(); - return; - } - - myObject = GEOMBase::ConvertIOinGEOMObject(IO); - if (myObject->_is_nil()) { - updateButtonState(); - return; - } - - myShape = S; - GroupPoints->LineEdit1->setText(aString); - - int SelectedShapeType = GroupPoints->ComboBox1->currentIndex(); - int count = GroupPoints->ComboBox1->count(); - - if (myWithShape) - count = count - 1; - - int i = 0; - // Solving PAL5590 - if (myShape.ShapeType() == TopAbs_COMPOUND) { - unsigned int nb = NumberOfSubShapes(myShape, TopAbs_COMPOUND); - if (nb > 0) - i++; - } - while (i <= myShape.ShapeType()) { - GroupPoints->ComboBox1->removeItem(0); - i++; - } - - if (myShape.ShapeType() == TopAbs_COMPOUND) { - if (myWithShape == false) { - GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Shape"); - myWithShape = true; - } - } - else { - if (myWithShape == true) { - GroupPoints->ComboBox1->removeItem(GroupPoints->ComboBox1->count() - 1); - myWithShape = false; + if (nbSel == 1) { + Handle(SALOME_InteractiveObject) IO = aSelList.First(); + if (!IO->hasEntry()) { + SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); } - } - - int count1 = GroupPoints->ComboBox1->count(); - if (myWithShape) - count1 = count1 - 1; - - if (SelectedShapeType > myShape.ShapeType()) { - if (SelectedShapeType == 8) { - if (myShape.ShapeType() != TopAbs_COMPOUND) { - GroupPoints->ComboBox1->setCurrentIndex(0); - ComboTextChanged(); + else { + TopoDS_Shape S = GEOMBase::GetTopoFromSelection(aSelList); + if (S.IsNull() || S.ShapeType() == TopAbs_VERTEX) { + myObject = GEOM::GEOM_Object::_nil(); } - } - else - GroupPoints->ComboBox1->setCurrentIndex(count1 - count + SelectedShapeType); - } - else { - GroupPoints->ComboBox1->setCurrentIndex(0); - ComboTextChanged(); - } + else { + myObject = GEOMBase::ConvertIOinGEOMObject(IO); + if (!CORBA::is_nil(myObject)) { + myShape = S; + GroupPoints->LineEdit1->setText(aString); + int i = 0; + // Solving PAL5590 + if (myShape.ShapeType() == TopAbs_COMPOUND) { + unsigned int nb = NumberOfSubShapes(myShape, TopAbs_COMPOUND); + if (nb > 0) + i++; + } + while (i <= myShape.ShapeType()) { + GroupPoints->ComboBox1->removeItem(0); + i++; + } + // remove Shape and Flat types for non-compound shapes + if (myShape.ShapeType() != TopAbs_COMPOUND) { + int idx = GroupPoints->ComboBox1->findData( (int)GEOM::SHAPE ); + if ( idx != -1 ) GroupPoints->ComboBox1->removeItem( idx ); + idx = GroupPoints->ComboBox1->findData( (int)GEOM::FLAT ); + if ( idx != -1 ) GroupPoints->ComboBox1->removeItem( idx ); + } // if (myShape.ShapeType() != TopAbs_COMPOUND) + } // if (!CORBA::is_nil(myObject)) + } // if (S.IsNull() || S.ShapeType() == TopAbs_VERTEX) + } // if (!IO->hasEntry()) ... else + } // if (nbSel == 1) + + int idx = GroupPoints->ComboBox1->findData( currentType ); + if ( idx != -1 ) + GroupPoints->ComboBox1->setCurrentIndex( idx ); updateButtonState(); } @@ -420,29 +429,10 @@ void EntityGUI_SubShapeDlg::ResetStateOfDialog() myShape.Nullify(); myEditCurrentArgument->setText(""); - int SelectedShapeType = GroupPoints->ComboBox1->currentIndex(); - int count = GroupPoints->ComboBox1->count(); - if (myWithShape) - count = count - 1; - /* type for sub-shape selection */ GroupPoints->ComboBox1->clear(); - GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Compound"); - GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Compsolid"); - GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Solid"); - GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Shell"); - GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Face"); - GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Wire"); - GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Edge"); - GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Vertex"); - GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Shape"); - - myWithShape = true; - - GroupPoints->ComboBox1->setCurrentIndex(8 - count + SelectedShapeType); - - // to avoid recursion: SelectionIntoArgument->ResetStateOfDialog->ComboTextChanged->SubShapeToggled->activateSelection->(currentSelectionChanged)->SelectionIntoArgument - //ComboTextChanged(); + for ( int i = 0; i <= (int)GEOM::FLAT; i++ ) + GroupPoints->ComboBox1->addItem(ShapeTypes[i], i); updateButtonState(); } @@ -473,58 +463,22 @@ void EntityGUI_SubShapeDlg::ComboTextChanged() } //================================================================================= -// function : NumberOfSubShapes() +// function : updateButtonState // purpose : //================================================================================= -unsigned int EntityGUI_SubShapeDlg::NumberOfSubShapes(const TopoDS_Shape& S, - const int shapeType) const +void EntityGUI_SubShapeDlg::updateButtonState() { - if (S.IsNull()) - return 0; + bool viewOk = SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() == OCCViewer_Viewer::Type(); + bool shapeTypeOk = shapeType() != TopAbs_SHAPE && shapeType() != TopAbs_FLAT && shapeType() != TopAbs_COMPOUND; + bool objectOK = !CORBA::is_nil( myObject ); - unsigned int index = 0; - TopTools_MapOfShape M; - - if (S.ShapeType() == TopAbs_COMPOUND && - (TopAbs_ShapeEnum(shapeType) == TopAbs_SHAPE || - TopAbs_ShapeEnum(shapeType) == TopAbs_COMPSOLID || - TopAbs_ShapeEnum(shapeType) == TopAbs_COMPOUND)) { - TopoDS_Iterator It(S, Standard_True, Standard_True); - for (; It.More(); It.Next()) { - if (M.Add(It.Value())) { - if (TopAbs_ShapeEnum(shapeType) == TopAbs_SHAPE || - TopAbs_ShapeEnum(shapeType) == It.Value().ShapeType()) { - index++; - } - } - } + if ( viewOk && objectOK && shapeTypeOk ) { + GroupPoints->CheckButton1->setEnabled( true ); } else { - TopExp_Explorer Exp (S, TopAbs_ShapeEnum(shapeType)); - for (; Exp.More(); Exp.Next()) { - if (M.Add(Exp.Current())) { - index++; - } - } + GroupPoints->CheckButton1->setChecked( false ); + GroupPoints->CheckButton1->setEnabled( false ); } - - M.Clear(); - return index; -} - -//================================================================================= -// function : updateButtonState -// purpose : -//================================================================================= -void EntityGUI_SubShapeDlg::updateButtonState() -{ - if (SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() != OCCViewer_Viewer::Type() || - myObject->_is_nil() || shapeType() == TopAbs_SHAPE || shapeType() == TopAbs_COMPOUND) { - GroupPoints->CheckButton1->setChecked(false); - GroupPoints->CheckButton1->setEnabled(false); - } - else - GroupPoints->CheckButton1->setEnabled(true); } //================================================================================= @@ -533,7 +487,7 @@ void EntityGUI_SubShapeDlg::updateButtonState() //================================================================================= bool EntityGUI_SubShapeDlg::isAllSubShapes() const { - return !GroupPoints->CheckButton1->isChecked() || !GroupPoints->CheckButton1->isEnabled(); + return !GroupPoints->CheckButton1->isEnabled() || !GroupPoints->CheckButton1->isChecked(); } //================================================================================= @@ -542,19 +496,7 @@ bool EntityGUI_SubShapeDlg::isAllSubShapes() const //================================================================================= int EntityGUI_SubShapeDlg::shapeType() const { - int type = GroupPoints->ComboBox1->currentIndex(); - - if (myObject->_is_nil()) - return type; - - // Solving PAL5590 - type += myShape.ShapeType() + 1; - if (myShape.ShapeType() == TopAbs_COMPOUND && - NumberOfSubShapes(myShape, TopAbs_COMPOUND) > 0) { - type--; - } - - return type; + return GroupPoints->ComboBox1->itemData(GroupPoints->ComboBox1->currentIndex()).toInt(); } //================================================================================= diff --git a/src/EntityGUI/EntityGUI_SubShapeDlg.h b/src/EntityGUI/EntityGUI_SubShapeDlg.h index 14275c83e..56bb3311d 100644 --- a/src/EntityGUI/EntityGUI_SubShapeDlg.h +++ b/src/EntityGUI/EntityGUI_SubShapeDlg.h @@ -73,9 +73,6 @@ private: void ResetStateOfDialog(); - unsigned int NumberOfSubShapes (const TopoDS_Shape&, - const int) const; - void activateSelection(); int getSelectedSubshapes (TColStd_IndexedMapOfInteger& theMapIndex); void updateButtonState(); @@ -87,8 +84,6 @@ private: GEOM::GEOM_Object_var myObject; int myDmMode; - bool myWithShape; - bool myIsHiddenMain; DlgRef_1Sel1List1Check3Btn* GroupPoints; diff --git a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx index 732d938e8..8dbb78b8b 100644 --- a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx @@ -135,6 +135,63 @@ #include #include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC +namespace { + + //================================================================================ + /*! + * \brief Return normal to face at extrema point + */ + //================================================================================ + + gp_Vec GetNormal (const TopoDS_Face& face, const BRepExtrema_DistShapeShape& extrema) + { + gp_Vec defaultNorm(1,0,0); // to have same normals on different faces + try { + // get UV at extrema point + Standard_Real u,v, f,l; + switch ( extrema.SupportTypeShape2(1) ) { + case BRepExtrema_IsInFace: { + extrema.ParOnFaceS2(1, u, v ); + break; + } + case BRepExtrema_IsOnEdge: { + TopoDS_Edge edge = TopoDS::Edge( extrema.SupportOnShape2(1)); + Handle(Geom2d_Curve) pcurve = BRep_Tool::CurveOnSurface( edge, face, f,l ); + extrema.ParOnEdgeS2( 1, u ); + gp_Pnt2d uv = pcurve->Value( u ); + u = uv.Coord(1); + v = uv.Coord(2); + break; + } + case BRepExtrema_IsVertex: return defaultNorm; + } + // get derivatives + BRepAdaptor_Surface surface( face, false ); + gp_Vec du, dv; gp_Pnt p; + surface.D1( u, v, p, du, dv ); + + return du ^ dv; + + } catch (Standard_Failure ) { + } + return defaultNorm; + } + + void AddFlatSubShapes(const TopoDS_Shape& S, TopTools_ListOfShape& L, TopTools_MapOfShape& M) + { + if (S.ShapeType() != TopAbs_COMPOUND) { + L.Append(S); + } + else { + TopoDS_Iterator It(S, Standard_True, Standard_True); + for (; It.More(); It.Next()) { + TopoDS_Shape SS = It.Value(); + if (M.Add(SS)) + AddFlatSubShapes(SS, L, M); + } + } + } +} //============================================================================= /*! @@ -1298,17 +1355,20 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::MakeExplode TopTools_ListOfShape listShape; if (aShape.ShapeType() == TopAbs_COMPOUND && - (TopAbs_ShapeEnum(theShapeType) == TopAbs_SHAPE || - TopAbs_ShapeEnum(theShapeType) == TopAbs_COMPSOLID || - TopAbs_ShapeEnum(theShapeType) == TopAbs_COMPOUND)) + (theShapeType == TopAbs_SHAPE || theShapeType == TopAbs_FLAT || theShapeType == TopAbs_COMPOUND)) { TopoDS_Iterator It (aShape, Standard_True, Standard_True); for (; It.More(); It.Next()) { - if (mapShape.Add(It.Value())) { - if (TopAbs_ShapeEnum(theShapeType) == TopAbs_SHAPE || - TopAbs_ShapeEnum(theShapeType) == It.Value().ShapeType()) { - listShape.Append(It.Value()); + TopoDS_Shape SS = It.Value(); + if (mapShape.Add(SS)) { + if (theShapeType == TopAbs_FLAT) { + AddFlatSubShapes(SS, listShape, mapShape); + } + else if (theShapeType == TopAbs_SHAPE || theShapeType == SS.ShapeType()) { + listShape.Append(SS); } + // VSR: for EXPLODE_NEW_INCLUDE_MAIN and EXPLODE_OLD_INCLUDE_MAIN: + // it seems it is necessary to add top-level shape if theShapeType == TopAbs_COMPOUND } } } @@ -1320,7 +1380,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::MakeExplode listShape.Append(exp.Current()); } - if (listShape.IsEmpty()) { + if (listShape.IsEmpty()){ //SetErrorCode("The given shape has no sub-shapes of the requested type"); SetErrorCode(NOT_FOUND_ANY); // NPAL18017 return aSeq; @@ -1364,16 +1424,15 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::MakeExplode // Put this subshape in the list of sub-shapes of theMainShape aMainShape->AddSubShapeReference(aFunction); } - if (!anObj.IsNull()) { - aSeq->Append(anObj); + aSeq->Append(anObj); - // for python command - TDF_Tool::Entry(anObj->GetEntry(), anEntry); - anAsciiList += anEntry; - anAsciiList += ","; - } - } + // for python command + TDF_Tool::Entry(anObj->GetEntry(), anEntry); + anAsciiList += anEntry; + anAsciiList += ","; + } + } //Make a Python command anAsciiList.Trunc(anAsciiList.Length() - 1); @@ -1422,16 +1481,17 @@ Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::SubShapeAllIDs TopTools_ListOfShape listShape; if (aShape.ShapeType() == TopAbs_COMPOUND && - (TopAbs_ShapeEnum(theShapeType) == TopAbs_SHAPE || - TopAbs_ShapeEnum(theShapeType) == TopAbs_COMPSOLID || - TopAbs_ShapeEnum(theShapeType) == TopAbs_COMPOUND)) + (theShapeType == TopAbs_SHAPE || theShapeType == TopAbs_FLAT || theShapeType == TopAbs_COMPOUND)) { TopoDS_Iterator It (aShape, Standard_True, Standard_True); for (; It.More(); It.Next()) { - if (mapShape.Add(It.Value())) { - if (TopAbs_ShapeEnum(theShapeType) == TopAbs_SHAPE || - TopAbs_ShapeEnum(theShapeType) == It.Value().ShapeType()) { - listShape.Append(It.Value()); + TopoDS_Shape SS = It.Value(); + if (mapShape.Add(SS)) { + if (theShapeType == TopAbs_FLAT) { + AddFlatSubShapes(SS, listShape, mapShape); + } + else if (theShapeType == TopAbs_SHAPE || theShapeType == SS.ShapeType()) { + listShape.Append(SS); } } } @@ -1850,33 +1910,41 @@ Standard_Integer GEOMImpl_IShapesOperations::NumberOfSubShapes */ try { - OCC_CATCH_SIGNALS; - int iType, nbTypes [TopAbs_SHAPE]; - for (iType = 0; iType < TopAbs_SHAPE; ++iType) - nbTypes[iType] = 0; - nbTypes[aShape.ShapeType()]++; - - TopTools_MapOfShape aMapOfShape; - aMapOfShape.Add(aShape); - TopTools_ListOfShape aListOfShape; - aListOfShape.Append(aShape); - - TopTools_ListIteratorOfListOfShape itL (aListOfShape); - for (; itL.More(); itL.Next()) { - TopoDS_Iterator it (itL.Value()); - for (; it.More(); it.Next()) { - TopoDS_Shape s = it.Value(); - if (aMapOfShape.Add(s)) { - aListOfShape.Append(s); - nbTypes[s.ShapeType()]++; + if (theShapeType == TopAbs_FLAT) { + TopTools_MapOfShape aMapOfShape; + TopTools_ListOfShape aListOfShape; + AddFlatSubShapes(aShape, aListOfShape, aMapOfShape); + nbShapes = aListOfShape.Extent(); + } + else { + OCC_CATCH_SIGNALS; + int iType, nbTypes [TopAbs_SHAPE]; + for (iType = 0; iType < TopAbs_SHAPE; ++iType) + nbTypes[iType] = 0; + nbTypes[aShape.ShapeType()]++; + + TopTools_MapOfShape aMapOfShape; + aMapOfShape.Add(aShape); + TopTools_ListOfShape aListOfShape; + aListOfShape.Append(aShape); + + TopTools_ListIteratorOfListOfShape itL (aListOfShape); + for (; itL.More(); itL.Next()) { + TopoDS_Iterator it (itL.Value()); + for (; it.More(); it.Next()) { + TopoDS_Shape s = it.Value(); + if (aMapOfShape.Add(s)) { + aListOfShape.Append(s); + nbTypes[s.ShapeType()]++; + } } } + + if (TopAbs_ShapeEnum(theShapeType) == TopAbs_SHAPE) + nbShapes = aMapOfShape.Extent(); + else + nbShapes = nbTypes[theShapeType]; } - - if (TopAbs_ShapeEnum(theShapeType) == TopAbs_SHAPE) - nbShapes = aMapOfShape.Extent(); - else - nbShapes = nbTypes[theShapeType]; } catch (Standard_Failure) { Handle(Standard_Failure) aFail = Standard_Failure::Caught(); @@ -3850,49 +3918,6 @@ void GEOMImpl_IShapesOperations::GetShapeProperties( const TopoDS_Shape aShape, return; } -namespace { - - //================================================================================ - /*! - * \brief Return normal to face at extrema point - */ - //================================================================================ - - gp_Vec GetNormal (const TopoDS_Face& face, const BRepExtrema_DistShapeShape& extrema) - { - gp_Vec defaultNorm(1,0,0); // to have same normals on different faces - try { - // get UV at extrema point - Standard_Real u,v, f,l; - switch ( extrema.SupportTypeShape2(1) ) { - case BRepExtrema_IsInFace: { - extrema.ParOnFaceS2(1, u, v ); - break; - } - case BRepExtrema_IsOnEdge: { - TopoDS_Edge edge = TopoDS::Edge( extrema.SupportOnShape2(1)); - Handle(Geom2d_Curve) pcurve = BRep_Tool::CurveOnSurface( edge, face, f,l ); - extrema.ParOnEdgeS2( 1, u ); - gp_Pnt2d uv = pcurve->Value( u ); - u = uv.Coord(1); - v = uv.Coord(2); - break; - } - case BRepExtrema_IsVertex: return defaultNorm; - } - // get derivatives - BRepAdaptor_Surface surface( face, false ); - gp_Vec du, dv; gp_Pnt p; - surface.D1( u, v, p, du, dv ); - - return du ^ dv; - - } catch (Standard_Failure ) { - } - return defaultNorm; - } -} - //============================================================================= /*! * case GetInPlace: diff --git a/src/GEOMImpl/GEOMImpl_Types.hxx b/src/GEOMImpl/GEOMImpl_Types.hxx index 273ac2193..0281f6b00 100644 --- a/src/GEOMImpl/GEOMImpl_Types.hxx +++ b/src/GEOMImpl/GEOMImpl_Types.hxx @@ -20,6 +20,10 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +#ifndef GEOMImpl_Types_HXX +#define GEOMImpl_Types_HXX + +#include // GEOM_Object types @@ -371,5 +375,10 @@ #define USER_TYPE_EX 1000 // Base type for GEOM plugins -//Plugins specified constants +// Plugins specified constants #define PLUGIN_NAME "Plugin Name" + +// Flat type for TopAbs +enum { TopAbs_FLAT = TopAbs_SHAPE+1 }; + +#endif // GEOMImpl_Types_HXX diff --git a/src/GEOM_SWIG/geomBuilder.py b/src/GEOM_SWIG/geomBuilder.py index f1968ee10..1fcdd3354 100644 --- a/src/GEOM_SWIG/geomBuilder.py +++ b/src/GEOM_SWIG/geomBuilder.py @@ -559,7 +559,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): ## Enumeration ShapeType as a dictionary. \n ## Topological types of shapes (like Open Cascade types). See GEOM::shape_type for details. # @ingroup l1_geomBuilder_auxiliary - ShapeType = {"AUTO":-1, "COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8} + ShapeType = {"AUTO":-1, "COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8, "FLAT":9} ## Kinds of shape in terms of GEOM.GEOM_IKindOfShape.shape_kind enumeration # and a list of parameters, describing the shape. -- 2.39.2