From: vsr Date: Thu, 9 Oct 2014 10:49:07 +0000 (+0400) Subject: 0022760: [EDF] Improvement of the What Is operation X-Git-Tag: V7_6_0a1~60^2~41 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=614060d67aab22e32b9db9c83420d8f72af94a86;p=modules%2Fgeom.git 0022760: [EDF] Improvement of the What Is operation --- diff --git a/doc/salome/gui/GEOM/input/whatis.doc b/doc/salome/gui/GEOM/input/whatis.doc index 5763a6fb4..040eea686 100644 --- a/doc/salome/gui/GEOM/input/whatis.doc +++ b/doc/salome/gui/GEOM/input/whatis.doc @@ -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 diff --git a/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx b/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx index 0cf9dd339..0764495dc 100644 --- a/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx @@ -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(); diff --git a/src/MeasureGUI/MeasureGUI_WhatisDlg.cxx b/src/MeasureGUI/MeasureGUI_WhatisDlg.cxx index 7d7fc2baa..55acc9195 100644 --- a/src/MeasureGUI/MeasureGUI_WhatisDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_WhatisDlg.cxx @@ -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 );