0022760: [EDF] Improvement of the What Is operation

This commit is contained in:
vsr 2014-10-09 14:49:07 +04:00
parent f4bb8ea64a
commit f00228b813
3 changed files with 34 additions and 13 deletions

View 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

View 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();

View 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 );