-// 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
CANRECPluginEngine_IOperations_i::MakeCanonicalRecognition( GEOM::GEOM_Object_ptr theObject,
CORBA::Boolean theMergeSurf,
CORBA::Boolean theMergeCurves,
- CORBA::Double theTolerance )
+ CORBA::Double theTolerance,
+ CANRECPlugin::ListOfLong_out theStat )
{
+ theStat = new CANRECPlugin::ListOfLong();
+
// Set a not done flag
GetOperations()->SetNotDone();
// Get the reference points
Handle(GEOM_Object) anInitObject = GetObjectImpl( theObject );
- if ( anInitObject.IsNull() ) return GEOM::GEOM_Object::_nil();
+ if ( anInitObject.IsNull() ) {
+ return GEOM::GEOM_Object::_nil();
+ }
// Make Canonical Recognition
- Handle(GEOM_Object) anObject = GetOperations()->MakeCanonicalRecognition( anInitObject,
- theMergeSurf,
- theMergeCurves,
- theTolerance );
- if ( !GetOperations()->IsDone() || anObject.IsNull() )
+ Handle(TColStd_HSequenceOfInteger) aStat = new TColStd_HSequenceOfInteger;
+ Handle(GEOM_Object) anObject =
+ GetOperations()->MakeCanonicalRecognition(anInitObject,
+ theMergeSurf,
+ theMergeCurves,
+ theTolerance,
+ aStat);
+
+ if (!GetOperations()->IsDone() || anObject.IsNull()) {
return GEOM::GEOM_Object::_nil();
+ }
+
+ // Copy statistics.
+ int nbInts = aStat->Length();
+ int i;
+
+ theStat->length(nbInts);
+
+ for (i = 0; i < nbInts; i++) {
+ theStat[i] = aStat->Value(i + 1);
+ }
return GetObject( anObject );
}
+//=============================================================================
+/*!
+ * \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.
+ */
+//=============================================================================
+CORBA::Long CANRECPluginEngine_IOperations_i::GetNbCanonicalFaces
+ (GEOM::GEOM_Object_ptr theObject)
+{
+ // Set a not done flag
+ GetOperations()->SetNotDone();
+
+ // Get the reference points
+ Handle(GEOM_Object) anInitObject = GetObjectImpl(theObject);
+
+ if (anInitObject.IsNull()) {
+ return -1;
+ }
+
+ // Get the number of canonical faces.
+ CORBA::Long aResult = GetOperations()->GetNbCanonicalFaces(anInitObject);
+
+ if (!GetOperations()->IsDone()) {
+ return -1;
+ }
+
+ return aResult;
+}
+
::CANRECPluginImpl_IOperations* CANRECPluginEngine_IOperations_i::GetOperations()
{
return (::CANRECPluginImpl_IOperations*)GetImpl();