- Standard_Integer i;
- theDump.Clear();
- theDump += " -- The Shape has problems :\n";
- theDump += " Check Count\n";
- theDump += " ------------------------------------------------\n";
-
- Standard_Integer last_stat = (Standard_Integer)BRepCheck_CheckFail;
- Handle(TColStd_HArray1OfInteger) NbProblems =
- new TColStd_HArray1OfInteger(1, last_stat);
- for (i = 1; i <= last_stat; i++)
- NbProblems->SetValue(i,0);
-
- Handle(TopTools_HSequenceOfShape) sl;
- sl = new TopTools_HSequenceOfShape();
- TopTools_DataMapOfShapeListOfShape theMap;
- theMap.Clear();
- GetProblemShapes(theAna, theShape, sl, NbProblems, theMap);
- theMap.Clear();
-
- Standard_Integer count = 0;
- count = NbProblems->Value((Standard_Integer)BRepCheck_InvalidPointOnCurve);
- if (count > 0) {
- theDump += " Invalid Point on Curve ................... ";
- theDump += TCollection_AsciiString(count) + "\n";
- }
- count = NbProblems->Value((Standard_Integer)BRepCheck_InvalidPointOnCurveOnSurface);
- if (count > 0) {
- theDump += " Invalid Point on CurveOnSurface .......... ";
- theDump += TCollection_AsciiString(count) + "\n";
- }
- count = NbProblems->Value((Standard_Integer)BRepCheck_InvalidPointOnSurface);
- if (count > 0) {
- theDump += " Invalid Point on Surface ................. ";
- theDump += TCollection_AsciiString(count) + "\n";
- }
- count = NbProblems->Value((Standard_Integer)BRepCheck_No3DCurve);
- if (count > 0) {
- theDump += " No 3D Curve .............................. ";
- theDump += TCollection_AsciiString(count) + "\n";
- }
- count = NbProblems->Value((Standard_Integer)BRepCheck_Multiple3DCurve);
- if (count > 0) {
- theDump += " Multiple 3D Curve ........................ ";
- theDump += TCollection_AsciiString(count) + "\n";
- }
- count = NbProblems->Value((Standard_Integer)BRepCheck_Invalid3DCurve);
- if (count > 0) {
- theDump += " Invalid 3D Curve ......................... ";
- theDump += TCollection_AsciiString(count) + "\n";
- }
- count = NbProblems->Value((Standard_Integer)BRepCheck_NoCurveOnSurface);
- if (count > 0) {
- theDump += " No Curve on Surface ...................... ";
- theDump += TCollection_AsciiString(count) + "\n";
- }
- count = NbProblems->Value((Standard_Integer)BRepCheck_InvalidCurveOnSurface);
- if (count > 0) {
- theDump += " Invalid Curve on Surface ................. ";
- theDump += TCollection_AsciiString(count) + "\n";
- }
- count = NbProblems->Value((Standard_Integer)BRepCheck_InvalidCurveOnClosedSurface);
- if (count > 0) {
- theDump += " Invalid Curve on closed Surface .......... ";
- theDump += TCollection_AsciiString(count) + "\n";
- }
- count = NbProblems->Value((Standard_Integer)BRepCheck_InvalidSameRangeFlag);
- if (count > 0) {
- theDump += " Invalid SameRange Flag ................... ";
- theDump += TCollection_AsciiString(count) + "\n";
- }
- count = NbProblems->Value((Standard_Integer)BRepCheck_InvalidSameParameterFlag);
- if (count > 0) {
- theDump += " Invalid SameParameter Flag ............... ";
- theDump += TCollection_AsciiString(count) + "\n";
- }
- count = NbProblems->Value((Standard_Integer)BRepCheck_InvalidDegeneratedFlag);
- if (count > 0) {
- theDump += " Invalid Degenerated Flag ................. ";
- theDump += TCollection_AsciiString(count) + "\n";
- }
- count = NbProblems->Value((Standard_Integer)BRepCheck_FreeEdge);
- if (count > 0) {
- theDump += " Free Edge ................................ ";
- theDump += TCollection_AsciiString(count) + "\n";
- }
- count = NbProblems->Value((Standard_Integer)BRepCheck_InvalidMultiConnexity);
- if (count > 0) {
- theDump += " Invalid MultiConnexity ................... ";
- theDump += TCollection_AsciiString(count) + "\n";
- }
- count = NbProblems->Value((Standard_Integer)BRepCheck_InvalidRange);
- if (count > 0) {
- theDump += " Invalid Range ............................ ";
- theDump += TCollection_AsciiString(count) + "\n";
- }
- count = NbProblems->Value((Standard_Integer)BRepCheck_EmptyWire);
- if (count > 0) {
- theDump += " Empty Wire ............................... ";
- theDump += TCollection_AsciiString(count) + "\n";
- }
- count = NbProblems->Value((Standard_Integer)BRepCheck_RedundantEdge);
- if (count > 0) {
- theDump += " Redundant Edge ........................... ";
- theDump += TCollection_AsciiString(count) + "\n";
- }
- count = NbProblems->Value((Standard_Integer)BRepCheck_SelfIntersectingWire);
- if (count > 0) {
- theDump += " Self Intersecting Wire ................... ";
- theDump += TCollection_AsciiString(count) + "\n";
- }
- count = NbProblems->Value((Standard_Integer)BRepCheck_NoSurface);
- if (count > 0) {
- theDump += " No Surface ............................... ";
- theDump += TCollection_AsciiString(count) + "\n";
- }
- count = NbProblems->Value((Standard_Integer)BRepCheck_InvalidWire);
- if (count > 0) {
- theDump += " Invalid Wire ............................. ";
- theDump += TCollection_AsciiString(count) + "\n";
- }
- count = NbProblems->Value((Standard_Integer)BRepCheck_RedundantWire);
- if (count > 0) {
- theDump += " Redundant Wire ........................... ";
- theDump += TCollection_AsciiString(count) + "\n";
- }
- count = NbProblems->Value((Standard_Integer)BRepCheck_IntersectingWires);
- if (count > 0) {
- theDump += " Intersecting Wires ....................... ";
- theDump += TCollection_AsciiString(count) + "\n";
- }
- count = NbProblems->Value((Standard_Integer)BRepCheck_InvalidImbricationOfWires);
- if (count > 0) {
- theDump += " Invalid Imbrication of Wires ............. ";
- theDump += TCollection_AsciiString(count) + "\n";
- }
- count = NbProblems->Value((Standard_Integer)BRepCheck_EmptyShell);
- if (count > 0) {
- theDump += " Empty Shell .............................. ";
- theDump += TCollection_AsciiString(count) + "\n";
- }
- count = NbProblems->Value((Standard_Integer)BRepCheck_RedundantFace);
- if (count > 0) {
- theDump += " Redundant Face ........................... ";
- theDump += TCollection_AsciiString(count) + "\n";
- }
- count = NbProblems->Value((Standard_Integer)BRepCheck_UnorientableShape);
- if (count > 0) {
- theDump += " Unorientable Shape ....................... ";
- theDump += TCollection_AsciiString(count) + "\n";
- }
- count = NbProblems->Value((Standard_Integer)BRepCheck_NotClosed);
- if (count > 0) {
- theDump += " Not Closed ............................... ";
- theDump += TCollection_AsciiString(count) + "\n";
- }
- count = NbProblems->Value((Standard_Integer)BRepCheck_NotConnected);
- if (count > 0) {
- theDump += " Not Connected ............................ ";
- theDump += TCollection_AsciiString(count) + "\n";
- }
- count = NbProblems->Value((Standard_Integer)BRepCheck_SubshapeNotInShape);
- if (count > 0) {
- theDump += " Sub-shape not in Shape .................... ";
- theDump += TCollection_AsciiString(count) + "\n";
- }
- count = NbProblems->Value((Standard_Integer)BRepCheck_BadOrientation);
- if (count > 0) {
- theDump += " Bad Orientation .......................... ";
- theDump += TCollection_AsciiString(count) + "\n";
- }
- count = NbProblems->Value((Standard_Integer)BRepCheck_BadOrientationOfSubshape);
- if (count > 0) {
- theDump += " Bad Orientation of Sub-shape .............. ";
- theDump += TCollection_AsciiString(count) + "\n";
- }
- count = NbProblems->Value((Standard_Integer)BRepCheck_CheckFail);
- if (count > 0) {
- theDump += " checkshape failure ....................... ";
- theDump += TCollection_AsciiString(count) + "\n";
- }
-
- theDump += " ------------------------------------------------\n";
- theDump += "*** Shapes with problems : ";
- theDump += TCollection_AsciiString(sl->Length()) + "\n";
-
- Standard_Integer nbv, nbe, nbw, nbf, nbs, nbo;
- nbv = nbe = nbw = nbf = nbs = nbo = 0;
-
- for (i = 1; i <= sl->Length(); i++) {
- TopoDS_Shape shi = sl->Value(i);
- TopAbs_ShapeEnum sti = shi.ShapeType();
- switch (sti) {
- case TopAbs_VERTEX : nbv++; break;
- case TopAbs_EDGE : nbe++; break;
- case TopAbs_WIRE : nbw++; break;
- case TopAbs_FACE : nbf++; break;
- case TopAbs_SHELL : nbs++; break;
- case TopAbs_SOLID : nbo++; break;
- default : break;
+ static bool checkTypes(const GEOMImpl_IMeasureOperations::CoupleOfObjects& theShapes,
+ const int theShapeType1,
+ const int theShapeType2)
+ {
+ if (theShapeType1 == -1 && theShapeType2 == -1)
+ return true;
+
+ TopAbs_ShapeEnum aShapeType1 = theShapes.first.IsNull()
+ ? TopAbs_SHAPE
+ : theShapes.first->GetValue().ShapeType();
+ TopAbs_ShapeEnum aShapeType2 = theShapes.second.IsNull()
+ ? TopAbs_SHAPE
+ : theShapes.second->GetValue().ShapeType();
+
+ if (theShapeType1 == -1)
+ return aShapeType1 == theShapeType2 || aShapeType2 == theShapeType2;
+ else if (theShapeType2 == -1)
+ return aShapeType1 == theShapeType1 || aShapeType2 == theShapeType1;
+ return (aShapeType1 == theShapeType1 && aShapeType2 == theShapeType2) ||
+ (aShapeType1 == theShapeType2 && aShapeType2 == theShapeType1);
+ }
+} // namespace
+
+//=============================================================================
+/*!
+ * InterferingSubshapes
+ * Find pairs of interfering sub-shapes, by default all pairs of interfering shapes are returned.
+ * \param theChecks list of failed checks, contains type of check and failed shapes
+ * \param theShapeType1 Type of shape.
+ * \param theShapeType2 Type of shape.
+ */
+ //=============================================================================
+std::list<GEOMImpl_IMeasureOperations::CoupleOfObjects>
+ GEOMImpl_IMeasureOperations::InterferingSubshapes
+ (const std::list<FailedChecks>& theChecks,
+ const int theShapeType1,
+ const int theShapeType2)
+{
+ SetErrorCode(KO);
+ MESSAGE("GEOMImpl_IMeasureOperations::interferingSubshapes");
+
+ std::list<GEOMImpl_IMeasureOperations::CoupleOfObjects> anInterfer;
+ try
+ {
+ OCC_CATCH_SIGNALS;
+ for (std::list<FailedChecks>::const_iterator anIter(theChecks.begin());
+ anIter != theChecks.end(); ++anIter)
+ {
+ if (anIter->TypeOfCheck == BOPAlgo_CheckStatus::BOPAlgo_SelfIntersect &&
+ checkTypes(anIter->FailedShapes, theShapeType1, theShapeType2))
+ anInterfer.push_back(anIter->FailedShapes);