1 // Copyright (C) 2014-2016 OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "CANRECPluginEngine_IOperations_i.hh"
21 #include "CANRECPluginImpl_IOperations.hxx"
23 #include <utilities.h>
25 CANRECPluginEngine_IOperations_i::CANRECPluginEngine_IOperations_i( PortableServer::POA_ptr thePOA,
26 GEOM::GEOM_Gen_ptr theEngine,
27 CANRECPluginImpl_IOperations* theImpl )
28 : GEOM_IOperations_i( thePOA, theEngine, theImpl )
30 MESSAGE( "CANRECPluginEngine_IOperations_i::CANRECPluginEngine_IOperations_i()" );
33 CANRECPluginEngine_IOperations_i::~CANRECPluginEngine_IOperations_i()
35 MESSAGE( "CANRECPluginEngine_IOperations_i::~CANRECPluginEngine_IOperations_i()" );
38 //=============================================================================
40 * Create a canonical recognition for the object
41 * \param theMergeSurf set merging surfaces
42 * \param theMergeCurves set merging curves
43 * \param theTolerance set tolerance
44 * \param theObject is initial object
45 * \return New GEOM_Object, containing the created shape.
47 //=============================================================================
49 CANRECPluginEngine_IOperations_i::MakeCanonicalRecognition( GEOM::GEOM_Object_ptr theObject,
50 CORBA::Boolean theMergeSurf,
51 CORBA::Boolean theMergeCurves,
52 CORBA::Double theTolerance,
53 CANRECPlugin::ListOfLong_out theStat )
55 theStat = new CANRECPlugin::ListOfLong();
57 // Set a not done flag
58 GetOperations()->SetNotDone();
60 // Get the reference points
61 Handle(::GEOM_Object) anInitObject = GetObjectImpl( theObject );
63 if ( anInitObject.IsNull() ) {
64 return GEOM::GEOM_Object::_nil();
67 // Make Canonical Recognition
68 Handle(TColStd_HSequenceOfInteger) aStat = new TColStd_HSequenceOfInteger;
69 Handle(::GEOM_Object) anObject =
70 GetOperations()->MakeCanonicalRecognition(anInitObject,
76 if (!GetOperations()->IsDone() || anObject.IsNull()) {
77 return GEOM::GEOM_Object::_nil();
81 int nbInts = aStat->Length();
84 theStat->length(nbInts);
86 for (i = 0; i < nbInts; i++) {
87 theStat[i] = aStat->Value(i + 1);
90 return GetObject( anObject );
93 //=============================================================================
95 * \brief Get the number of canonical faces in the shape.
97 * \param theObject the input object (solid, compound, compsolid).
99 * \return the number of canonical faces in the object.
101 //=============================================================================
102 CORBA::Long CANRECPluginEngine_IOperations_i::GetNbCanonicalFaces
103 (GEOM::GEOM_Object_ptr theObject)
105 // Set a not done flag
106 GetOperations()->SetNotDone();
108 // Get the reference points
109 Handle(::GEOM_Object) anInitObject = GetObjectImpl(theObject);
111 if (anInitObject.IsNull()) {
115 // Get the number of canonical faces.
116 CORBA::Long aResult = GetOperations()->GetNbCanonicalFaces(anInitObject);
118 if (!GetOperations()->IsDone()) {
125 ::CANRECPluginImpl_IOperations* CANRECPluginEngine_IOperations_i::GetOperations()
127 return (::CANRECPluginImpl_IOperations*)GetImpl();