#include <XCAFDoc_DimTolTool.hxx>
+#include <Bnd_Box.hxx>
+#include <BRepBndLib.hxx>
#include <Precision.hxx>
#include <Standard_GUID.hxx>
#include <Standard_Type.hxx>
return Standard_True;
}
+//=======================================================================
+//function : GetNumberOfPlaces
+//purpose :
+//=======================================================================
+Standard_Integer XCAFDoc_DimTolTool::GetNumberOfPlaces(const TDF_Label& theLabel)
+{
+ TDF_LabelSequence aFirstShapes, aSecondShapes;
+ GetRefShapeLabel(theLabel, aFirstShapes, aSecondShapes);
+
+ NCollection_Sequence<Bnd_Box> aBoxes;
+ for (Standard_Integer anI = 1; anI <= aFirstShapes.Size(); anI++)
+ {
+ Bnd_Box aBox;
+ BRepBndLib::Add(ShapeTool()->GetShape(aFirstShapes(anI)), aBox, Standard_True);
+ aBoxes.Append(aBox);
+ }
+
+ // Fill bounded boxes of number of places - this will exclude duplications
+ NCollection_Sequence<Bnd_Box> aPlaces;
+ for (Standard_Integer anI = 1; anI <= aBoxes.Size(); anI++)
+ {
+ Standard_Boolean toAddPlace = Standard_True;
+ Standard_Integer aBoxesIndex = 1;
+ for (Standard_Integer aJ = 1; aJ <= aPlaces.Size(); aJ++)
+ {
+ if (!aPlaces(aJ).IsOut(aBoxes(anI)))
+ {
+ toAddPlace = Standard_False;
+ aBoxesIndex = aJ;
+ break;
+ }
+ }
+
+ if (toAddPlace)
+ {
+ aPlaces.Append(aBoxes(anI));
+ }
+ else
+ {
+ aPlaces.ChangeValue(aBoxesIndex).Add(aBoxes(anI));
+ }
+ }
+ return aPlaces.Size();
+}
+
//=======================================================================
//function : GetDimTol
//purpose :
Standard_EXPORT Standard_Boolean GetRefDatumLabel (const TDF_Label& theShapeL,
TDF_LabelSequence& theDatum) const;
+ //! @param theLabel [in] geometrical tolerance TDF label.
+ //! @return Number Of Places corresponding to the Geometrical Tolerance or Dimensional Tolerance TDF label.
+ Standard_EXPORT Standard_Integer GetNumberOfPlaces (const TDF_Label& theLabel);
+
//! Returns true if the given GDT is marked as locked.
Standard_EXPORT Standard_Boolean IsLocked(const TDF_Label& theViewL) const;