]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
0021107: EDF 1701 GEOM: deflection value of preferences not taken into account
authorvsr <vsr@opencascade.com>
Tue, 14 Dec 2010 07:13:38 +0000 (07:13 +0000)
committervsr <vsr@opencascade.com>
Tue, 14 Dec 2010 07:13:38 +0000 (07:13 +0000)
src/GEOMGUI/GEOMGUI_Selection.cxx
src/GEOMGUI/GEOM_Displayer.cxx

index f4aeb8ccfec76545ed58681fcbc389bf00cfee68..1730ce2009638972e33856d995835b1daf9ee4c8 100644 (file)
@@ -281,21 +281,8 @@ bool GEOMGUI_Selection::isCompoundOfVertices( GEOM::GEOM_Object_ptr obj )
   bool ret = false;
   SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>
     (SUIT_Session::session()->activeApplication()->activeStudy());
-  if ( appStudy && !CORBA::is_nil( obj ) && obj->GetShapeType() == GEOM::COMPOUND ) {
-    GEOM::GEOM_IMeasureOperations_var anOper = GeometryGUI::GetGeomGen()->GetIMeasureOperations( appStudy->id() );
-    QString whatIs = anOper->WhatIs( obj );
-    QStringList data = whatIs.split( "\n", QString::SkipEmptyParts );
-    int nbVertices = 0, nbCompounds = 0, nbOther = 0;
-    foreach ( QString s, data ) {
-      QString type = s.section( ":", 0, 0 ).trimmed().toLower();
-      int cnt = s.section( ":", 1, 1 ).trimmed().toInt();
-      if ( type == "vertex" ) nbVertices += cnt;
-      else if ( type == "compound" ) nbCompounds += cnt;
-      else if ( type != "shape" ) nbOther += cnt;
-    }
-    ret = nbVertices > 0 && nbCompounds == 1 && nbOther == 0;
-    anOper->Destroy();
-  }
+  if ( appStudy && !CORBA::is_nil( obj ) )
+    ret = obj->GetShapeType() == GEOM::COMPOUND && obj->GetMaxShapeType() == GEOM::VERTEX;
   return ret;
 }
 
index eb0cf2658045d72f652a3c4509ab34d0dac3afc4..5cd4b18d9bcb738dd4e10d4f58b1426d745c7b9b 100644 (file)
@@ -129,36 +129,35 @@ static inline int getTopAbsMode( const int implType )
   }
 }
 
-static bool isCompoundOfVertices( const TopoDS_Shape& theShape )
+static int getMinMaxShapeType( const TopoDS_Shape& shape, bool ismin )
 {
-  bool ret = false;
-  if ( !theShape.IsNull() ) {
-    int iType, nbTypes [TopAbs_SHAPE];
-    for (iType = 0; iType < TopAbs_SHAPE; ++iType)
-      nbTypes[iType] = 0;
-    nbTypes[theShape.ShapeType()]++;
-
-    TopTools_MapOfShape aMapOfShape;
-    aMapOfShape.Add(theShape);
-    TopTools_ListOfShape aListOfShape;
-    aListOfShape.Append(theShape);
-
-    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 ( shape.IsNull() )
+    return TopAbs_SHAPE;
+
+  int ret = shape.ShapeType();
+
+  if ( shape.ShapeType() == TopAbs_COMPOUND || shape.ShapeType() == TopAbs_COMPSOLID ) {
+    TopoDS_Iterator it(shape, Standard_True, Standard_False);
+    for (; it.More(); it.Next()) {
+      TopoDS_Shape sub_shape = it.Value();
+      if ( sub_shape.IsNull() ) continue;
+      int stype = getMinMaxShapeType( sub_shape, ismin );
+      if ( stype == TopAbs_SHAPE ) continue;
+      if ( ismin && stype > ret )
+       ret = stype;
+      else if ( !ismin && ( ret < TopAbs_SOLID || stype < ret ) )
+       ret = stype;
     }
-    ret = nbTypes[TopAbs_VERTEX] > 0 && nbTypes[TopAbs_COMPOUND] == 1;
   }
+
   return ret;
 }
 
+static bool isCompoundOfVertices( const TopoDS_Shape& theShape )
+{
+  return theShape.ShapeType() == TopAbs_COMPOUND && getMinMaxShapeType( theShape, false ) == TopAbs_VERTEX;
+}
+
 //================================================================
 // Function : getFilter
 // Purpose  : Get filter corresponding to the type of object