mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0030268: Inspectors - improvements in VInspector plugin,
0029451: Information Message Alert to debug an algorithm or object functionality
This commit is contained in:
@@ -14,11 +14,19 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <inspector/ShapeView_Tools.hxx>
|
||||
#include <inspector/ShapeView_ItemShape.hxx>
|
||||
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
|
||||
#include <TopExp.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
|
||||
#include <AIS_Shape.hxx>
|
||||
// =======================================================================
|
||||
// function : ReadShape
|
||||
// purpose :
|
||||
@@ -31,3 +39,109 @@ TopoDS_Shape ShapeView_Tools::ReadShape (const TCollection_AsciiString& theFileN
|
||||
BRepTools::Read (aShape, theFileName.ToCString(), aBuilder);
|
||||
return aShape;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : IsPossibleToExplode
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean ShapeView_Tools::IsPossibleToExplode (const TopoDS_Shape& theShape,
|
||||
NCollection_List<TopAbs_ShapeEnum>& theExplodeTypes)
|
||||
{
|
||||
TopAbs_ShapeEnum aShapeType = theShape.ShapeType();
|
||||
|
||||
if (!theExplodeTypes.Contains (aShapeType))
|
||||
theExplodeTypes.Append(aShapeType);
|
||||
|
||||
if (theExplodeTypes.Extent() == TopAbs_SHAPE + 1) // all types are collected, stop
|
||||
return Standard_True;
|
||||
|
||||
TopoDS_Iterator aSubShapeIt (theShape);
|
||||
for (int aCurrentIndex = 0; aSubShapeIt.More(); aSubShapeIt.Next(), aCurrentIndex++)
|
||||
{
|
||||
if (IsPossibleToExplode (aSubShapeIt.Value(), theExplodeTypes))
|
||||
return Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetPropertyTableValues
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void ShapeView_Tools::GetPropertyTableValues (const TreeModel_ItemBasePtr& theItem,
|
||||
QList<ViewControl_TableModelValues*>& theTableValues)
|
||||
{
|
||||
TreeModel_ItemBasePtr anItem = theItem;
|
||||
ShapeView_ItemShapePtr aShapeItem = itemDynamicCast<ShapeView_ItemShape>(anItem);
|
||||
if (!aShapeItem)
|
||||
return;
|
||||
|
||||
Handle(TreeModel_ItemProperties) anItemProperties = aShapeItem->GetProperties();
|
||||
if (anItemProperties.IsNull())
|
||||
return;
|
||||
|
||||
ViewControl_TableModelValues* aTableValues = new ViewControl_TableModelValues();
|
||||
aTableValues->SetProperties (anItemProperties);
|
||||
theTableValues.append (aTableValues);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : ToString
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
QString ShapeView_Tools::ToString (const Standard_Boolean& theValue)
|
||||
{
|
||||
return theValue ? "1" : "0";
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : ToName
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
QString ShapeView_Tools::ToName (const GeomAbs_Shape& theType)
|
||||
{
|
||||
switch (theType)
|
||||
{
|
||||
case GeomAbs_C0: return "GeomAbs_C0";
|
||||
case GeomAbs_G1: return "GeomAbs_G1";
|
||||
case GeomAbs_C1: return "GeomAbs_C1";
|
||||
case GeomAbs_G2: return "GeomAbs_G2";
|
||||
case GeomAbs_C2: return "GeomAbs_C2";
|
||||
case GeomAbs_C3: return "GeomAbs_C3";
|
||||
case GeomAbs_CN: return "GeomAbs_CN";
|
||||
default: break;
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetShapeGlobalPropertiesCount
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
int ShapeView_Tools::GetShapeGlobalPropertiesCount()
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetShapeGlobalProperties
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
QVariant ShapeView_Tools::GetShapeGlobalProperties (const TopoDS_Shape& theShape,
|
||||
const int theRow,
|
||||
const int theColumn)
|
||||
{
|
||||
bool isFirstColumn = theColumn == 0;
|
||||
|
||||
switch (theRow)
|
||||
{
|
||||
case 0: return isFirstColumn ? "COMMON PROPERTIES" : "";
|
||||
case 1: return isFirstColumn ? "Checked" : ToString (theShape.Checked());
|
||||
case 2: return isFirstColumn ? "Closed" : ToString (theShape.Closed());
|
||||
case 3: return isFirstColumn ? "Infinite" : ToString (theShape.Infinite());
|
||||
case 4: return isFirstColumn ? "Locked" : ToString (theShape.Locked());
|
||||
case 5: return isFirstColumn ? "Modified" : ToString (theShape.Modified());
|
||||
case 6: return isFirstColumn ? "Orientable" : ToString (theShape.Orientable());
|
||||
}
|
||||
return QVariant();
|
||||
}
|
Reference in New Issue
Block a user