]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
0022760: [EDF] Improvement of the What Is operation
authorvsr <vsr@opencascade.com>
Thu, 9 Oct 2014 10:49:07 +0000 (14:49 +0400)
committervsr <vsr@opencascade.com>
Thu, 13 Nov 2014 11:02:25 +0000 (14:02 +0300)
doc/salome/gui/GEOM/input/whatis.doc
src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx
src/MeasureGUI/MeasureGUI_WhatisDlg.cxx

index 5763a6fb4df2738e707623b08542b8823690ff44..040eea68635a9e5ffa2f6760bf5b79e55b45a3d6 100644 (file)
@@ -2,8 +2,11 @@
 
 \page whatis_page What Is ?
 
-This operation provides the list of types and quantities of all topological entities, composing
-the selected geometrical object.
+This operation provides the list of types and quantities of all topological
+entities, composing the selected geometrical object.
+
+For the COMPOUND or COMPSOLID shape, additionally the information about
+"flat" content is shown - a number of "simple" top-level shapes enclosed into the compound.
 
 \image html measures8.png
 
index 0cf9dd339f55ad7e1832c97600e10b5826e43e0c..0764495dcd426335f95dc57ab88f9977407d116b 100644 (file)
@@ -1654,9 +1654,11 @@ TCollection_AsciiString GEOMImpl_IMeasureOperations::WhatIs (Handle(GEOM_Object)
 
   try {
     OCC_CATCH_SIGNALS;
-    int iType, nbTypes [TopAbs_SHAPE];
-    for (iType = 0; iType < TopAbs_SHAPE; ++iType)
+    int iType, nbTypes [TopAbs_SHAPE], nbFlatType [TopAbs_SHAPE];
+    for (iType = 0; iType < TopAbs_SHAPE; ++iType) {
       nbTypes[iType] = 0;
+      nbFlatType[iType] = 0;
+    }
     nbTypes[aShape.ShapeType()]++;
 
     TopTools_MapOfShape aMapOfShape;
@@ -1666,12 +1668,16 @@ TCollection_AsciiString GEOMImpl_IMeasureOperations::WhatIs (Handle(GEOM_Object)
 
     TopTools_ListIteratorOfListOfShape itL (aListOfShape);
     for (; itL.More(); itL.Next()) {
-      TopoDS_Iterator it (itL.Value());
+      TopoDS_Shape sp = itL.Value();
+      TopoDS_Iterator it (sp);
       for (; it.More(); it.Next()) {
         TopoDS_Shape s = it.Value();
         if (aMapOfShape.Add(s)) {
           aListOfShape.Append(s);
           nbTypes[s.ShapeType()]++;
+          if ((sp.ShapeType() == TopAbs_COMPOUND) || (sp.ShapeType() == TopAbs_COMPSOLID)) {
+           nbFlatType[s.ShapeType()]++;
+          }
         }
       }
     }
@@ -1684,7 +1690,23 @@ TCollection_AsciiString GEOMImpl_IMeasureOperations::WhatIs (Handle(GEOM_Object)
     Astr = Astr + " SOLID : " + TCollection_AsciiString(nbTypes[TopAbs_SOLID]) + "\n";
     Astr = Astr + " COMPSOLID : " + TCollection_AsciiString(nbTypes[TopAbs_COMPSOLID]) + "\n";
     Astr = Astr + " COMPOUND : " + TCollection_AsciiString(nbTypes[TopAbs_COMPOUND]) + "\n";
-    Astr = Astr + " SHAPE : " + TCollection_AsciiString(aMapOfShape.Extent());
+    Astr = Astr + " SHAPE : " + TCollection_AsciiString(aMapOfShape.Extent()) + "\n";
+
+    if ((aShape.ShapeType() == TopAbs_COMPOUND) || (aShape.ShapeType() == TopAbs_COMPSOLID)){
+      Astr = Astr + " --------------------- \n Flat content : \n";
+      if (nbFlatType[TopAbs_VERTEX] > 0)
+       Astr = Astr + " VERTEX : " + TCollection_AsciiString(nbFlatType[TopAbs_VERTEX]) + "\n";
+      if (nbFlatType[TopAbs_EDGE] > 0)
+       Astr = Astr + " EDGE : " + TCollection_AsciiString(nbFlatType[TopAbs_EDGE]) + "\n";
+      if (nbFlatType[TopAbs_WIRE] > 0)
+       Astr = Astr + " WIRE : " + TCollection_AsciiString(nbFlatType[TopAbs_WIRE]) + "\n";
+      if (nbFlatType[TopAbs_FACE] > 0)
+       Astr = Astr + " FACE : " + TCollection_AsciiString(nbFlatType[TopAbs_FACE]) + "\n";
+      if (nbFlatType[TopAbs_SHELL] > 0)
+       Astr = Astr + " SHELL : " + TCollection_AsciiString(nbFlatType[TopAbs_SHELL]) + "\n";
+      if (nbFlatType[TopAbs_SOLID] > 0)
+       Astr = Astr + " SOLID : " + TCollection_AsciiString(nbFlatType[TopAbs_SOLID]) + "\n";
+    }
   }
   catch (Standard_Failure) {
     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
index 7d7fc2baa12a530455a6adb2e5a1ad730a87ed90..55acc91955246541744ad37c2429b9d529f498db 100644 (file)
@@ -121,13 +121,9 @@ MeasureGUI_WhatisDlg::MeasureGUI_WhatisDlg( GeometryGUI* GUI, QWidget* parent )
   myGrp->LineEdit1->setReadOnly( true );
 
   myGrp->TextEdit1->setReadOnly( true );
-  // fix height to fit all text
-  myGrp->TextEdit1->setLineWrapMode( QTextEdit::NoWrap );
-  // myGrp->TextEdit1->setTextFormat( Qt::PlainText ); // VSR : TODO
-  QString allLines ("\n\n\n\n\n\n\n\n\n"); // 10 lines
-  myGrp->TextEdit1->setText( allLines );
-  int sbHeight = myGrp->TextEdit1->horizontalScrollBar()->height();
-  myGrp->TextEdit1->setFixedHeight( myGrp->TextEdit1->document()->size().height() + sbHeight );
+  myGrp->TextEdit1->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
+  QFontMetrics fm( myGrp->TextEdit1->font() );
+  myGrp->TextEdit1->setMinimumHeight( fm.height()*20 );
 
   myGrp->TextLabel2->setText( tr( "GEOM_KIND_OF_SHAPE" ) );
   myGrp->LineEdit2->setReadOnly( true );