-// Copyright (C) 2014-2015 OPEN CASCADE
+// Copyright (C) 2014-2016 OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
* \param theMergeCurves set merging curves
* \param theTolerance set tolerance
* \param theObject is initial object
+ * \param theStat is the statistics. A set of integers. For details please
+ * see CANRECPlugin.idl
* \return New GEOM_Object, containing the created shape.
*/
//=============================================================================
Handle(GEOM_Object)
-CANRECPluginImpl_IOperations::MakeCanonicalRecognition ( Handle(GEOM_Object) theObject,
- bool theMergeSurf,
- bool theMergeCurves,
- double theTolerance )
+CANRECPluginImpl_IOperations::MakeCanonicalRecognition
+ (Handle(GEOM_Object) theObject,
+ bool theMergeSurf,
+ bool theMergeCurves,
+ double theTolerance,
+ Handle_TColStd_HSequenceOfInteger &theStat)
{
SetErrorCode( KO );
+ if (theStat.IsNull()) {
+ theStat = new TColStd_HSequenceOfInteger;
+ } else {
+ theStat->Clear();
+ }
+
if ( theObject.IsNull() ) return NULL;
// Add a new object
SetErrorCode( aFail->GetMessageString() );
return NULL;
}
+
+ Handle(TColStd_HArray1OfInteger) anArray = aData.GetStatistics();
+
+ if (anArray.IsNull() == Standard_False) {
+ Standard_Integer i = anArray->Lower();
+ const Standard_Integer iUp = anArray->Upper();
+
+ for (; i <= iUp; ++i) {
+ theStat->Append(anArray->Value(i));
+ }
+ }
// Make a Python command
GEOM::TPythonDump(aFunction) << aShape << " = " << "geompy.MakeCanonicalRecognition(" <<
return aShape;
}
+
+//=============================================================================
+/*!
+ * \brief Get the number of canonical faces in the shape.
+ *
+ * \param theObject the input object (solid, compound, compsolid).
+ *
+ * \return the number of canonical faces in the object.
+ */
+//=============================================================================
+Standard_Integer CANRECPluginImpl_IOperations::GetNbCanonicalFaces
+ (const Handle(GEOM_Object) &theObject)
+{
+ SetErrorCode(KO);
+
+ TopoDS_Shape aShape = theObject->GetValue();
+
+ if (aShape.IsNull()) {
+ return -1;
+ }
+
+ const Standard_Integer aResult =
+ CANRECPluginImpl_Driver::GetNbCanonicalFaces(aShape);
+
+ if (aResult >= 0) {
+ SetErrorCode(OK);
+
+ return aResult;
+ }
+
+ return -1;
+}