Back to index

salome-geom  6.5.0
GEOM_IShapesOperations_i.cc
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 #include <Standard_Stream.hxx>
00024 
00025 #include "GEOM_IShapesOperations_i.hh"
00026 
00027 #include "utilities.h"
00028 #include "OpUtil.hxx"
00029 #include "Utils_ExceptHandlers.hxx"
00030 
00031 #include "GEOM_Engine.hxx"
00032 #include "GEOM_Object.hxx"
00033 
00034 #include <TopAbs.hxx>
00035 #include <TColStd_HSequenceOfTransient.hxx>
00036 #include <TColStd_HArray1OfInteger.hxx>
00037 
00038 //=============================================================================
00042 //=============================================================================
00043 GEOM_IShapesOperations_i::GEOM_IShapesOperations_i (PortableServer::POA_ptr thePOA,
00044                                                     GEOM::GEOM_Gen_ptr theEngine,
00045                                                     ::GEOMImpl_IShapesOperations* theImpl)
00046 :GEOM_IOperations_i(thePOA, theEngine, theImpl)
00047 {
00048   MESSAGE("GEOM_IShapesOperations_i::GEOM_IShapesOperations_i");
00049 }
00050 
00051 //=============================================================================
00055 //=============================================================================
00056 GEOM_IShapesOperations_i::~GEOM_IShapesOperations_i()
00057 {
00058   MESSAGE("GEOM_IShapesOperations_i::~GEOM_IShapesOperations_i");
00059 }
00060 
00061 
00062 //=============================================================================
00066 //=============================================================================
00067 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeEdge
00068                       (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2)
00069 {
00070   GEOM::GEOM_Object_var aGEOMObject;
00071 
00072   //Set a not done flag
00073   GetOperations()->SetNotDone();
00074 
00075   //Get the reference points
00076   Handle(GEOM_Object) aPnt1 = GetObjectImpl(thePnt1);
00077   Handle(GEOM_Object) aPnt2 = GetObjectImpl(thePnt2);
00078 
00079   if (aPnt1.IsNull() || aPnt2.IsNull()) return aGEOMObject._retn();
00080 
00081   //Create the Edge
00082   Handle(GEOM_Object) anObject = GetOperations()->MakeEdge(aPnt1, aPnt2);
00083   if (!GetOperations()->IsDone() || anObject.IsNull())
00084     return aGEOMObject._retn();
00085 
00086   return GetObject(anObject);
00087 }
00088 
00089 //=============================================================================
00093 //=============================================================================
00094 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeEdgeOnCurveByLength
00095                   (GEOM::GEOM_Object_ptr theCurve,
00096                    CORBA::Double         theLength,
00097                    GEOM::GEOM_Object_ptr theStartPoint)
00098 {
00099   GEOM::GEOM_Object_var aGEOMObject;
00100 
00101   //Set a not done flag
00102   GetOperations()->SetNotDone();
00103 
00104   //Get the reference curve
00105   Handle(GEOM_Object) aRefCurve = GetObjectImpl(theCurve);
00106   if (aRefCurve.IsNull()) return aGEOMObject._retn();
00107 
00108   //Get the reference point (can be NULL)
00109   Handle(GEOM_Object) aRefPoint;
00110   if (!CORBA::is_nil(theStartPoint)) {
00111     aRefPoint = GetObjectImpl(theStartPoint);
00112   }
00113 
00114   //Create the point
00115   Handle(GEOM_Object) anObject =
00116     GetOperations()->MakeEdgeOnCurveByLength(aRefCurve, theLength, aRefPoint);
00117   if (!GetOperations()->IsDone() || anObject.IsNull())
00118     return aGEOMObject._retn();
00119 
00120   return GetObject(anObject);
00121 }
00122 
00123 //=============================================================================
00127 //=============================================================================
00128 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeEdgeWire
00129                       (GEOM::GEOM_Object_ptr theWire,
00130                        const CORBA::Double theLinearTolerance,
00131                        const CORBA::Double theAngularTolerance)
00132 {
00133   GEOM::GEOM_Object_var aGEOMObject;
00134 
00135   //Set a not done flag
00136   GetOperations()->SetNotDone();
00137 
00138   //Get the source wire
00139   Handle(GEOM_Object) aWire = GetObjectImpl(theWire);
00140 
00141   if (aWire.IsNull()) return aGEOMObject._retn();
00142 
00143   //Create the Edge
00144   Handle(GEOM_Object) anObject = GetOperations()->MakeEdgeWire(aWire, theLinearTolerance, theAngularTolerance);
00145   if (!GetOperations()->IsDone() || anObject.IsNull())
00146     return aGEOMObject._retn();
00147 
00148   return GetObject(anObject);
00149 }
00150 
00151 //=============================================================================
00155 //=============================================================================
00156 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeWire
00157                            (const GEOM::ListOfGO& theEdgesAndWires,
00158                             const CORBA::Double   theTolerance)
00159 {
00160   GEOM::GEOM_Object_var aGEOMObject;
00161 
00162   //Set a not done flag
00163   GetOperations()->SetNotDone();
00164 
00165   int ind, aLen;
00166   std::list<Handle(GEOM_Object)> aShapes;
00167 
00168   //Get the shapes
00169   aLen = theEdgesAndWires.length();
00170   for (ind = 0; ind < aLen; ind++) {
00171     Handle(GEOM_Object) aSh = GetObjectImpl(theEdgesAndWires[ind]);
00172     if (aSh.IsNull()) return aGEOMObject._retn();
00173     aShapes.push_back(aSh);
00174   }
00175 
00176   // Make Solid
00177   Handle(GEOM_Object) anObject =
00178     GetOperations()->MakeWire(aShapes, theTolerance);
00179   if (!GetOperations()->IsDone() || anObject.IsNull())
00180     return aGEOMObject._retn();
00181 
00182   return GetObject(anObject);
00183 }
00184 
00185 //=============================================================================
00189 //=============================================================================
00190 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeFace
00191                       (GEOM::GEOM_Object_ptr theWire,
00192                        const CORBA::Boolean  isPlanarWanted)
00193 {
00194   GEOM::GEOM_Object_var aGEOMObject;
00195 
00196   //Set a not done flag
00197   GetOperations()->SetNotDone();
00198 
00199   //Get the reference wire
00200   Handle(GEOM_Object) aWire = GetObjectImpl(theWire);
00201   if (aWire.IsNull()) return aGEOMObject._retn();
00202 
00203   //Create the Face
00204   Handle(GEOM_Object) anObject = GetOperations()->MakeFace(aWire, isPlanarWanted);
00205   //if (!GetOperations()->IsDone() || anObject.IsNull())
00206   // enable warning status
00207   if (anObject.IsNull())
00208     return aGEOMObject._retn();
00209 
00210   return GetObject(anObject);
00211 }
00212 
00213 //=============================================================================
00217 //=============================================================================
00218 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeFaceWires
00219                                          (const GEOM::ListOfGO& theWires,
00220                                           const CORBA::Boolean  isPlanarWanted)
00221 {
00222   GEOM::GEOM_Object_var aGEOMObject;
00223 
00224   //Set a not done flag
00225   GetOperations()->SetNotDone();
00226 
00227   int ind, aLen;
00228   std::list<Handle(GEOM_Object)> aShapes;
00229 
00230   //Get the shapes
00231   aLen = theWires.length();
00232   for (ind = 0; ind < aLen; ind++) {
00233     Handle(GEOM_Object) aSh = GetObjectImpl(theWires[ind]);
00234     if (aSh.IsNull()) return aGEOMObject._retn();
00235     aShapes.push_back(aSh);
00236   }
00237 
00238   // Make Face
00239   Handle(GEOM_Object) anObject =
00240     GetOperations()->MakeFaceWires(aShapes, isPlanarWanted);
00241   //if (!GetOperations()->IsDone() || anObject.IsNull())
00242   // enable warning status
00243   if (anObject.IsNull())
00244     return aGEOMObject._retn();
00245 
00246   return GetObject(anObject);
00247 }
00248 
00249 //=============================================================================
00253 //=============================================================================
00254 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeShell
00255                                       (const GEOM::ListOfGO& theFacesAndShells)
00256 {
00257   GEOM::GEOM_Object_var aGEOMObject;
00258 
00259   //Set a not done flag
00260   GetOperations()->SetNotDone();
00261 
00262   int ind, aLen;
00263   std::list<Handle(GEOM_Object)> aShapes;
00264 
00265   //Get the shapes
00266   aLen = theFacesAndShells.length();
00267   for (ind = 0; ind < aLen; ind++) {
00268     Handle(GEOM_Object) aSh = GetObjectImpl(theFacesAndShells[ind]);
00269     if (aSh.IsNull()) return aGEOMObject._retn();
00270     aShapes.push_back(aSh);
00271   }
00272 
00273   // Make Solid
00274   Handle(GEOM_Object) anObject =
00275     GetOperations()->MakeShell(aShapes);
00276   if (!GetOperations()->IsDone() || anObject.IsNull())
00277     return aGEOMObject._retn();
00278 
00279   return GetObject(anObject);
00280 }
00281 
00282 //=============================================================================
00286 //=============================================================================
00287 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeSolidShell
00288                                                 (GEOM::GEOM_Object_ptr theShell)
00289 {
00290   GEOM::GEOM_Object_var aGEOMObject;
00291 
00292   //Set a not done flag
00293   GetOperations()->SetNotDone();
00294 
00295   //Get the reference objects
00296   Handle(GEOM_Object) aShell = GetObjectImpl(theShell);
00297   if (aShell.IsNull()) return aGEOMObject._retn();
00298 
00299   std::list<Handle(GEOM_Object)> aShapes;
00300   aShapes.push_back(aShell);
00301 
00302   //Create the Solid
00303   Handle(GEOM_Object) anObject = GetOperations()->MakeSolidShells(aShapes);
00304   if (!GetOperations()->IsDone() || anObject.IsNull())
00305     return aGEOMObject._retn();
00306 
00307   return GetObject(anObject);
00308 }
00309 
00310 //=============================================================================
00314 //=============================================================================
00315 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeSolidShells
00316                                       (const GEOM::ListOfGO& theShells)
00317 {
00318   GEOM::GEOM_Object_var aGEOMObject;
00319 
00320   //Set a not done flag
00321   GetOperations()->SetNotDone();
00322 
00323   int ind, aLen;
00324   std::list<Handle(GEOM_Object)> aShapes;
00325 
00326   //Get the shapes
00327   aLen = theShells.length();
00328   for (ind = 0; ind < aLen; ind++) {
00329     Handle(GEOM_Object) aSh = GetObjectImpl(theShells[ind]);
00330     if (aSh.IsNull()) return aGEOMObject._retn();
00331     aShapes.push_back(aSh);
00332   }
00333 
00334   // Make Solid
00335   Handle(GEOM_Object) anObject =
00336     GetOperations()->MakeSolidShells(aShapes);
00337   if (!GetOperations()->IsDone() || anObject.IsNull())
00338     return aGEOMObject._retn();
00339 
00340   return GetObject(anObject);
00341 }
00342 
00343 //=============================================================================
00347 //=============================================================================
00348 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeCompound
00349                                       (const GEOM::ListOfGO& theShapes)
00350 {
00351   GEOM::GEOM_Object_var aGEOMObject;
00352 
00353   //Set a not done flag
00354   GetOperations()->SetNotDone();
00355 
00356   int ind, aLen;
00357   std::list<Handle(GEOM_Object)> aShapes;
00358 
00359   //Get the shapes
00360   aLen = theShapes.length();
00361   for (ind = 0; ind < aLen; ind++) {
00362     Handle(GEOM_Object) aSh = GetObjectImpl(theShapes[ind]);
00363     if (aSh.IsNull()) return aGEOMObject._retn();
00364     aShapes.push_back(aSh);
00365   }
00366 
00367   // Make Solid
00368   Handle(GEOM_Object) anObject =
00369     GetOperations()->MakeCompound(aShapes);
00370   if (!GetOperations()->IsDone() || anObject.IsNull())
00371     return aGEOMObject._retn();
00372 
00373   return GetObject(anObject);
00374 }
00375 
00376 //=============================================================================
00380 //=============================================================================
00381 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFaces
00382                                            (GEOM::GEOM_Object_ptr theShape,
00383                                             CORBA::Double   theTolerance,
00384                                             CORBA::Boolean  doKeepNonSolids)
00385 {
00386   GEOM::GEOM_Object_var aGEOMObject;
00387 
00388   //Set a not done flag
00389   GetOperations()->SetNotDone();
00390 
00391   //Get the reference objects
00392   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
00393   if (aShape.IsNull()) return aGEOMObject._retn();
00394 
00395   //Perform the gluing
00396   Handle(GEOM_Object) anObject =
00397     GetOperations()->MakeGlueFaces(aShape, theTolerance, doKeepNonSolids);
00398   //if (!GetOperations()->IsDone() || anObject.IsNull())
00399   // to allow warning
00400   if (anObject.IsNull())
00401     return aGEOMObject._retn();
00402 
00403   return GetObject(anObject);
00404 }
00405 
00406 //=============================================================================
00410 //=============================================================================
00411 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetGlueFaces
00412                                            (GEOM::GEOM_Object_ptr theShape,
00413                                             const CORBA::Double   theTolerance)
00414 {
00415   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
00416 
00417   //Set a not done flag
00418   GetOperations()->SetNotDone();
00419 
00420   //Get the reference objects
00421   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
00422   if (aShape.IsNull()) return aSeq._retn();
00423 
00424   Handle(TColStd_HSequenceOfTransient) aHSeq =
00425     //GetOperations()->GetGlueFaces(aShape, theTolerance);
00426     GetOperations()->GetGlueShapes(aShape, theTolerance, TopAbs_FACE);
00427 
00428   //if (!GetOperations()->IsDone() || aHSeq.IsNull())
00429   // to allow warning
00430   if(aHSeq.IsNull())
00431     return aSeq._retn();
00432 
00433   Standard_Integer aLength = aHSeq->Length();
00434   aSeq->length(aLength);
00435   for (Standard_Integer i = 1; i <= aLength; i++)
00436     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
00437 
00438   return aSeq._retn();
00439 }
00440 
00441 //=============================================================================
00445 //=============================================================================
00446 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFacesByList
00447                                            (GEOM::GEOM_Object_ptr theShape,
00448                                             CORBA::Double   theTolerance,
00449                                             const GEOM::ListOfGO& theFaces,
00450                                             CORBA::Boolean doKeepNonSolids,
00451                                             CORBA::Boolean doGlueAllEdges)
00452 {
00453   GEOM::GEOM_Object_var aGEOMObject;
00454 
00455   //Set a not done flag
00456   GetOperations()->SetNotDone();
00457 
00458   //Get the reference objects
00459   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
00460   if (aShape.IsNull()) return aGEOMObject._retn();
00461 
00462   int ind, aLen;
00463   std::list<Handle(GEOM_Object)> aFaces;
00464   //Get the shapes
00465   aLen = theFaces.length();
00466   for (ind = 0; ind < aLen; ind++) {
00467     Handle(GEOM_Object) aSh = GetObjectImpl(theFaces[ind]);
00468     if (aSh.IsNull()) return aGEOMObject._retn();
00469     aFaces.push_back(aSh);
00470   }
00471 
00472   //Perform the gluing
00473   Handle(GEOM_Object) anObject =
00474     GetOperations()->MakeGlueFacesByList(aShape, theTolerance, aFaces, doKeepNonSolids, doGlueAllEdges);
00475   //if (!GetOperations()->IsDone() || anObject.IsNull())
00476   // to allow warning
00477   if (anObject.IsNull())
00478     return aGEOMObject._retn();
00479 
00480   return GetObject(anObject);
00481 }
00482 
00483 //=============================================================================
00487 //=============================================================================
00488 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueEdges
00489                                            (GEOM::GEOM_Object_ptr theShape,
00490                                             CORBA::Double   theTolerance)
00491 {
00492   GEOM::GEOM_Object_var aGEOMObject;
00493 
00494   //Set a not done flag
00495   GetOperations()->SetNotDone();
00496 
00497   //Get the reference objects
00498   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
00499   if (aShape.IsNull()) return aGEOMObject._retn();
00500 
00501   //Perform the gluing
00502   Handle(GEOM_Object) anObject =
00503     GetOperations()->MakeGlueEdges(aShape, theTolerance);
00504   //if (!GetOperations()->IsDone() || anObject.IsNull())
00505   // to allow warning
00506   if (anObject.IsNull())
00507     return aGEOMObject._retn();
00508 
00509   return GetObject(anObject);
00510 }
00511 
00512 //=============================================================================
00516 //=============================================================================
00517 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetGlueEdges
00518                                            (GEOM::GEOM_Object_ptr theShape,
00519                                             const CORBA::Double   theTolerance)
00520 {
00521   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
00522 
00523   //Set a not done flag
00524   GetOperations()->SetNotDone();
00525 
00526   //Get the reference objects
00527   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
00528   if (aShape.IsNull()) return aSeq._retn();
00529 
00530   Handle(TColStd_HSequenceOfTransient) aHSeq =
00531     GetOperations()->GetGlueShapes(aShape, theTolerance, TopAbs_EDGE);
00532 
00533   //if (!GetOperations()->IsDone() || aHSeq.IsNull())
00534   // to allow warning
00535   if (aHSeq.IsNull())
00536     return aSeq._retn();
00537 
00538   Standard_Integer aLength = aHSeq->Length();
00539   aSeq->length(aLength);
00540   for (Standard_Integer i = 1; i <= aLength; i++)
00541     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
00542 
00543   return aSeq._retn();
00544 }
00545 
00546 //=============================================================================
00550 //=============================================================================
00551 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueEdgesByList
00552                                            (GEOM::GEOM_Object_ptr theShape,
00553                                             CORBA::Double   theTolerance,
00554                                             const GEOM::ListOfGO& theEdges)
00555 {
00556   GEOM::GEOM_Object_var aGEOMObject;
00557 
00558   //Set a not done flag
00559   GetOperations()->SetNotDone();
00560 
00561   //Get the reference objects
00562   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
00563   if (aShape.IsNull()) return aGEOMObject._retn();
00564 
00565   int ind, aLen;
00566   std::list<Handle(GEOM_Object)> anEdges;
00567   //Get the shapes
00568   aLen = theEdges.length();
00569   for (ind = 0; ind < aLen; ind++) {
00570     Handle(GEOM_Object) aSh = GetObjectImpl(theEdges[ind]);
00571     if (aSh.IsNull()) return aGEOMObject._retn();
00572     anEdges.push_back(aSh);
00573   }
00574 
00575   //Perform the gluing
00576   Handle(GEOM_Object) anObject =
00577     GetOperations()->MakeGlueEdgesByList(aShape, theTolerance, anEdges);
00578   //if (!GetOperations()->IsDone() || anObject.IsNull())
00579   // to allow warning
00580   if (anObject.IsNull())
00581     return aGEOMObject._retn();
00582 
00583   return GetObject(anObject);
00584 }
00585 
00586 //=============================================================================
00590 //=============================================================================
00591 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetExistingSubObjects (GEOM::GEOM_Object_ptr theShape,
00592                                                                  CORBA::Boolean        theGroupsOnly)
00593 {
00594   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
00595 
00596   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
00597   if (aShape.IsNull()) return aSeq._retn();
00598 
00599   Handle(TColStd_HSequenceOfTransient) aHSeq =
00600     GetOperations()->GetExistingSubObjects(aShape, theGroupsOnly);
00601   if (!GetOperations()->IsDone() || aHSeq.IsNull())
00602     return aSeq._retn();
00603 
00604   Standard_Integer aLength = aHSeq->Length();
00605   aSeq->length(aLength);
00606   for (Standard_Integer i = 1; i <= aLength; i++)
00607     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
00608 
00609   return aSeq._retn();
00610 }
00611 
00612 //=============================================================================
00616 //=============================================================================
00617 GEOM::ListOfGO* GEOM_IShapesOperations_i::MakeExplode (GEOM::GEOM_Object_ptr theShape,
00618                                                        const CORBA::Long     theShapeType,
00619                                                        const CORBA::Boolean  isSorted)
00620 {
00621   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
00622 
00623   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
00624   if (aShape.IsNull()) return aSeq._retn();
00625 
00626   Handle(TColStd_HSequenceOfTransient) aHSeq =
00627     GetOperations()->MakeExplode(aShape, theShapeType, isSorted,
00628                                  GEOMImpl_IShapesOperations::EXPLODE_OLD_INCLUDE_MAIN);
00629   if (!GetOperations()->IsDone() || aHSeq.IsNull())
00630     return aSeq._retn();
00631 
00632   Standard_Integer aLength = aHSeq->Length();
00633   aSeq->length(aLength);
00634   for (Standard_Integer i = 1; i <= aLength; i++)
00635     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
00636 
00637   return aSeq._retn();
00638 }
00639 
00640 //=============================================================================
00644 //=============================================================================
00645 GEOM::ListOfGO* GEOM_IShapesOperations_i::MakeAllSubShapes (GEOM::GEOM_Object_ptr theShape,
00646                                                             const CORBA::Long     theShapeType,
00647                                                             const CORBA::Boolean  isSorted)
00648 {
00649   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
00650 
00651   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
00652   if (aShape.IsNull()) return aSeq._retn();
00653 
00654   Handle(TColStd_HSequenceOfTransient) aHSeq =
00655     GetOperations()->MakeExplode(aShape, theShapeType, isSorted,
00656                                  GEOMImpl_IShapesOperations::EXPLODE_NEW_INCLUDE_MAIN);
00657   if (!GetOperations()->IsDone() || aHSeq.IsNull())
00658     return aSeq._retn();
00659 
00660   Standard_Integer aLength = aHSeq->Length();
00661   aSeq->length(aLength);
00662   for (Standard_Integer i = 1; i <= aLength; i++)
00663     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
00664 
00665   return aSeq._retn();
00666 }
00667 
00668 //=============================================================================
00672 //=============================================================================
00673 GEOM::ListOfGO* GEOM_IShapesOperations_i::ExtractSubShapes (GEOM::GEOM_Object_ptr theShape,
00674                                                             const CORBA::Long     theShapeType,
00675                                                             const CORBA::Boolean  isSorted)
00676 {
00677   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
00678 
00679   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
00680   if (aShape.IsNull()) return aSeq._retn();
00681 
00682   Handle(TColStd_HSequenceOfTransient) aHSeq =
00683     // TODO: enum instead of bool for the last argument
00684     GetOperations()->MakeExplode(aShape, theShapeType, isSorted,
00685                                  GEOMImpl_IShapesOperations::EXPLODE_NEW_EXCLUDE_MAIN);
00686   if (!GetOperations()->IsDone() || aHSeq.IsNull())
00687     return aSeq._retn();
00688 
00689   Standard_Integer aLength = aHSeq->Length();
00690   aSeq->length(aLength);
00691   for (Standard_Integer i = 1; i <= aLength; i++)
00692     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
00693 
00694   return aSeq._retn();
00695 }
00696 
00697 //=============================================================================
00701 //=============================================================================
00702 GEOM::ListOfLong* GEOM_IShapesOperations_i::SubShapeAllIDs (GEOM::GEOM_Object_ptr theShape,
00703                                                             const CORBA::Long     theShapeType,
00704                                                             const CORBA::Boolean  isSorted)
00705 {
00706   GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
00707 
00708   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
00709   if (aShape.IsNull()) return aSeq._retn();
00710 
00711   Handle(TColStd_HSequenceOfInteger) aHSeq =
00712     GetOperations()->SubShapeAllIDs(aShape, theShapeType, isSorted,
00713                                     GEOMImpl_IShapesOperations::EXPLODE_OLD_INCLUDE_MAIN);
00714   if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
00715 
00716   Standard_Integer aLength = aHSeq->Length();
00717   aSeq->length(aLength);
00718   for (Standard_Integer i = 1; i <= aLength; i++)
00719     aSeq[i-1] = aHSeq->Value(i);
00720 
00721   return aSeq._retn();
00722 }
00723 
00724 //=============================================================================
00728 //=============================================================================
00729 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetAllSubShapesIDs (GEOM::GEOM_Object_ptr theShape,
00730                                                                 const CORBA::Long     theShapeType,
00731                                                                 const CORBA::Boolean  isSorted)
00732 {
00733   GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
00734 
00735   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
00736   if (aShape.IsNull()) return aSeq._retn();
00737 
00738   Handle(TColStd_HSequenceOfInteger) aHSeq =
00739     GetOperations()->SubShapeAllIDs(aShape, theShapeType, isSorted,
00740                                     GEOMImpl_IShapesOperations::EXPLODE_NEW_INCLUDE_MAIN);
00741   if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
00742 
00743   Standard_Integer aLength = aHSeq->Length();
00744   aSeq->length(aLength);
00745   for (Standard_Integer i = 1; i <= aLength; i++)
00746     aSeq[i-1] = aHSeq->Value(i);
00747 
00748   return aSeq._retn();
00749 }
00750 
00751 //=============================================================================
00755 //=============================================================================
00756 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetSubShape
00757                                            (GEOM::GEOM_Object_ptr theMainShape,
00758                                             const CORBA::Long     theID)
00759 {
00760   GEOM::GEOM_Object_var aGEOMObject;
00761 
00762   //Set a not done flag
00763   GetOperations()->SetNotDone();
00764 
00765   //Get the reference objects
00766   Handle(GEOM_Object) aShape = GetObjectImpl(theMainShape);
00767   if (aShape.IsNull()) return aGEOMObject._retn();
00768 
00769   Handle(GEOM_Object) anObject = GetOperations()->GetSubShape(aShape, theID);
00770   if (!GetOperations()->IsDone() || anObject.IsNull())
00771     return aGEOMObject._retn();
00772 
00773   return GetObject(anObject);
00774 }
00775 
00776 //=============================================================================
00780 //=============================================================================
00781 GEOM::ListOfGO* GEOM_IShapesOperations_i::MakeSubShapes (GEOM::GEOM_Object_ptr theMainShape,
00782                                                          const GEOM::ListOfLong& theIndices)
00783 {
00784   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
00785   Standard_Integer i;
00786 
00787   //Set a not done flag
00788   GetOperations()->SetNotDone();
00789 
00790   if (theIndices.length() < 1)
00791     return aSeq._retn();
00792 
00793   Handle(GEOM_Object) aShape = GetObjectImpl(theMainShape);
00794   if (aShape.IsNull()) return aSeq._retn();
00795 
00796   Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger (1, theIndices.length());
00797   for (i = 0; i < theIndices.length(); i++)
00798     anArray->SetValue(i+1, theIndices[i]);
00799 
00800   Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakeSubShapes(aShape, anArray);
00801   if (!GetOperations()->IsDone() || aHSeq.IsNull())
00802     return aSeq._retn();
00803 
00804   Standard_Integer aLength = aHSeq->Length();
00805   aSeq->length(aLength);
00806   for (i = 0; i < aLength; i++)
00807     aSeq[i] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i+1)));
00808 
00809   return aSeq._retn();
00810 }
00811 
00812 //=============================================================================
00816 //=============================================================================
00817 CORBA::Long GEOM_IShapesOperations_i::GetSubShapeIndex
00818   (GEOM::GEOM_Object_ptr theMainShape, GEOM::GEOM_Object_ptr theSubShape)
00819 {
00820   //Get the reference shapes
00821   Handle(GEOM_Object) aMainShapeRef = GetObjectImpl(theMainShape);
00822   Handle(GEOM_Object) aSubShapeRef = GetObjectImpl(theSubShape);
00823 
00824   if (aMainShapeRef.IsNull() || aSubShapeRef.IsNull()) return -1;
00825 
00826   //Get the unique ID of <theSubShape> inside <theMainShape>
00827   CORBA::Long anID = GetOperations()->GetSubShapeIndex(aMainShapeRef, aSubShapeRef);
00828   if (!GetOperations()->IsDone())
00829     return -1;
00830 
00831   return anID;
00832 }
00833 
00834 //=============================================================================
00838 //=============================================================================
00839 CORBA::Long GEOM_IShapesOperations_i::GetTopologyIndex
00840   (GEOM::GEOM_Object_ptr theMainShape, GEOM::GEOM_Object_ptr theSubShape)
00841 {
00842   //Get the reference shapes
00843   Handle(GEOM_Object) aMainShapeRef = GetObjectImpl(theMainShape);
00844   Handle(GEOM_Object) aSubShapeRef = GetObjectImpl(theSubShape);
00845 
00846   if (aMainShapeRef.IsNull() || aSubShapeRef.IsNull()) return -1;
00847 
00848   //Get an ID of <theSubShape>, unique among all sub-shapes of <theMainShape> of the same type
00849   CORBA::Long anID = GetOperations()->GetTopologyIndex(aMainShapeRef, aSubShapeRef);
00850   if (!GetOperations()->IsDone())
00851     return -1;
00852 
00853   return anID;
00854 }
00855 
00856 //=============================================================================
00860 //=============================================================================
00861 char* GEOM_IShapesOperations_i::GetShapeTypeString (GEOM::GEOM_Object_ptr theShape)
00862 {
00863   //Get the reference shape
00864   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
00865   if (aShape.IsNull()) return NULL;
00866 
00867   // Get shape parameters
00868   TCollection_AsciiString aDescription = GetOperations()->GetShapeTypeString(aShape);
00869   return CORBA::string_dup(aDescription.ToCString());
00870 }
00871 
00872 //=============================================================================
00876 //=============================================================================
00877 CORBA::Long GEOM_IShapesOperations_i::NumberOfFaces (GEOM::GEOM_Object_ptr theShape)
00878 {
00879   return NumberOfSubShapes(theShape, Standard_Integer(TopAbs_FACE));
00880 }
00881 
00882 //=============================================================================
00886 //=============================================================================
00887 CORBA::Long GEOM_IShapesOperations_i::NumberOfEdges (GEOM::GEOM_Object_ptr theShape)
00888 {
00889   return NumberOfSubShapes(theShape, Standard_Integer(TopAbs_EDGE));
00890 }
00891 
00892 //=============================================================================
00896 //=============================================================================
00897 CORBA::Long GEOM_IShapesOperations_i::NumberOfSubShapes (GEOM::GEOM_Object_ptr theShape,
00898                                                          const CORBA::Long     theShapeType)
00899 {
00900   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
00901   if (aShape.IsNull()) return -1;
00902 
00903   CORBA::Long aNb = GetOperations()->NumberOfSubShapes(aShape, theShapeType);
00904   if (!GetOperations()->IsDone()) return -1;
00905 
00906   return aNb;
00907 }
00908 
00909 //=============================================================================
00913 //=============================================================================
00914 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::ChangeOrientation
00915                                                 (GEOM::GEOM_Object_ptr theShape)
00916 {
00917   GEOM::GEOM_Object_var aGEOMObject;
00918 
00919   //Set a not done flag
00920   GetOperations()->SetNotDone();
00921 
00922   //Get the reference objects
00923   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
00924   if (aShape.IsNull()) return aGEOMObject._retn();
00925 
00926   //Create the Solid
00927   Handle(GEOM_Object) anObject = GetOperations()->ReverseShape(aShape);
00928   if (!GetOperations()->IsDone() || anObject.IsNull())
00929     return aGEOMObject._retn();
00930 
00931   return GetObject(anObject);
00932 }
00933 
00934 //=============================================================================
00938 //=============================================================================
00939 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetFreeFacesIDs (GEOM::GEOM_Object_ptr theShape)
00940 {
00941   //Set a not done flag
00942   GetOperations()->SetNotDone();
00943 
00944   GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
00945 
00946   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
00947   if (aShape.IsNull()) return aSeq._retn();
00948 
00949   Handle(TColStd_HSequenceOfInteger) aHSeq =
00950     GetOperations()->GetFreeFacesIDs(aShape);
00951   if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
00952 
00953   Standard_Integer aLength = aHSeq->Length();
00954   aSeq->length(aLength);
00955   for (Standard_Integer i = 1; i <= aLength; i++)
00956     aSeq[i-1] = aHSeq->Value(i);
00957 
00958   return aSeq._retn();
00959 }
00960 
00961 //=============================================================================
00965 //=============================================================================
00966 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSharedShapes
00967                                           (GEOM::GEOM_Object_ptr theShape1,
00968                                            GEOM::GEOM_Object_ptr theShape2,
00969                                            const CORBA::Long     theShapeType)
00970 {
00971   //Set a not done flag
00972   GetOperations()->SetNotDone();
00973 
00974   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
00975 
00976   Handle(GEOM_Object) aShape1 = GetObjectImpl(theShape1);
00977   Handle(GEOM_Object) aShape2 = GetObjectImpl(theShape2);
00978 
00979   if (aShape1.IsNull() || aShape2.IsNull()) return aSeq._retn();
00980 
00981   Handle(TColStd_HSequenceOfTransient) aHSeq =
00982     GetOperations()->GetSharedShapes(aShape1, aShape2, theShapeType);
00983   if (!GetOperations()->IsDone() || aHSeq.IsNull())
00984     return aSeq._retn();
00985 
00986   Standard_Integer aLength = aHSeq->Length();
00987   aSeq->length(aLength);
00988   for (Standard_Integer i = 1; i <= aLength; i++)
00989     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
00990 
00991   return aSeq._retn();
00992 }
00993 
00994 //=============================================================================
00998 //=============================================================================
00999 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSharedShapesMulti
01000                                           (const GEOM::ListOfGO& theShapes,
01001                                            const CORBA::Long     theShapeType)
01002 {
01003   //Set a not done flag
01004   GetOperations()->SetNotDone();
01005 
01006   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
01007 
01008   //Get the shapes
01009   std::list<Handle(GEOM_Object)> aShapes;
01010   int aLen = theShapes.length();
01011   for (int ind = 0; ind < aLen; ind++) {
01012     Handle(GEOM_Object) aSh = GetObjectImpl(theShapes[ind]);
01013     if (aSh.IsNull()) return aSeq._retn();
01014     aShapes.push_back(aSh);
01015   }
01016 
01017   Handle(TColStd_HSequenceOfTransient) aHSeq =
01018     GetOperations()->GetSharedShapes(aShapes, theShapeType);
01019   if (!GetOperations()->IsDone() || aHSeq.IsNull())
01020     return aSeq._retn();
01021 
01022   Standard_Integer aLength = aHSeq->Length();
01023   aSeq->length(aLength);
01024   for (Standard_Integer i = 1; i <= aLength; i++)
01025     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
01026 
01027   return aSeq._retn();
01028 }
01029 
01030 static GEOMAlgo_State ShapeState (const GEOM::shape_state theState)
01031 {
01032   GEOMAlgo_State aState = GEOMAlgo_ST_UNKNOWN;
01033 
01034   switch (theState) {
01035   case GEOM::ST_ON:
01036     aState = GEOMAlgo_ST_ON;
01037     break;
01038   case GEOM::ST_OUT:
01039     aState = GEOMAlgo_ST_OUT;
01040     break;
01041   case GEOM::ST_ONOUT:
01042     aState = GEOMAlgo_ST_ONOUT;
01043     break;
01044   case GEOM::ST_IN:
01045     aState = GEOMAlgo_ST_IN;
01046     break;
01047   case GEOM::ST_ONIN:
01048     aState = GEOMAlgo_ST_ONIN;
01049     break;
01050   default:
01051     break;
01052   }
01053 
01054   return aState;
01055 }
01056 
01057 //=============================================================================
01061 //=============================================================================
01062 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnPlane
01063                                                 (GEOM::GEOM_Object_ptr   theShape,
01064                                                  const CORBA::Long       theShapeType,
01065                                                  GEOM::GEOM_Object_ptr   theAx1,
01066                                                  const GEOM::shape_state theState)
01067 {
01068   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
01069 
01070   //Set a not done flag
01071   GetOperations()->SetNotDone();
01072 
01073   //Get the reference objects
01074   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
01075   Handle(GEOM_Object) anAx1 = GetObjectImpl(theAx1);
01076 
01077   if (aShape.IsNull() || anAx1.IsNull()) return aSeq._retn();
01078 
01079   //Get Shapes On Plane
01080   Handle(TColStd_HSequenceOfTransient) aHSeq =
01081     GetOperations()->GetShapesOnPlane(aShape, theShapeType, anAx1, ShapeState(theState));
01082   if (!GetOperations()->IsDone() || aHSeq.IsNull())
01083     return aSeq._retn();
01084 
01085   Standard_Integer aLength = aHSeq->Length();
01086   aSeq->length(aLength);
01087   for (Standard_Integer i = 1; i <= aLength; i++)
01088     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
01089 
01090   return aSeq._retn();
01091 }
01092 
01093 //=============================================================================
01097 //=============================================================================
01098 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnPlaneWithLocation
01099                                                 (GEOM::GEOM_Object_ptr   theShape,
01100                                                  const CORBA::Long       theShapeType,
01101                                                  GEOM::GEOM_Object_ptr   theAx1,
01102                                                  GEOM::GEOM_Object_ptr   thePnt,
01103                                                  const GEOM::shape_state theState)
01104 {
01105   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
01106 
01107   //Set a not done flag
01108   GetOperations()->SetNotDone();
01109 
01110   //Get the reference objects
01111   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
01112   Handle(GEOM_Object) anAx1 = GetObjectImpl(theAx1);
01113   Handle(GEOM_Object) anPnt = GetObjectImpl(thePnt);
01114 
01115   if (aShape.IsNull() || anAx1.IsNull() || anPnt.IsNull()) return aSeq._retn();
01116 
01117   //Get Shapes On Plane
01118   Handle(TColStd_HSequenceOfTransient) aHSeq =
01119     GetOperations()->GetShapesOnPlaneWithLocation(aShape, theShapeType, anAx1, anPnt, ShapeState(theState));
01120   if (!GetOperations()->IsDone() || aHSeq.IsNull())
01121     return aSeq._retn();
01122 
01123   Standard_Integer aLength = aHSeq->Length();
01124   aSeq->length(aLength);
01125   for (Standard_Integer i = 1; i <= aLength; i++)
01126     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
01127 
01128   return aSeq._retn();
01129 }
01130 
01131 //=============================================================================
01135 //=============================================================================
01136 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnCylinder
01137                                                 (GEOM::GEOM_Object_ptr   theShape,
01138                                                  const CORBA::Long       theShapeType,
01139                                                  GEOM::GEOM_Object_ptr   theAxis,
01140                                                  const CORBA::Double     theRadius,
01141                                                  const GEOM::shape_state theState)
01142 {
01143   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
01144 
01145   //Set a not done flag
01146   GetOperations()->SetNotDone();
01147 
01148   //Get the reference objects
01149   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
01150   Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
01151 
01152   if (aShape.IsNull() || anAxis.IsNull()) return aSeq._retn();
01153 
01154   //Get Shapes On Cylinder
01155   Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnCylinder
01156     (aShape, theShapeType, anAxis, theRadius, ShapeState(theState));
01157   if (!GetOperations()->IsDone() || aHSeq.IsNull())
01158     return aSeq._retn();
01159 
01160   Standard_Integer aLength = aHSeq->Length();
01161   aSeq->length(aLength);
01162   for (Standard_Integer i = 1; i <= aLength; i++)
01163     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
01164 
01165   return aSeq._retn();
01166 }
01167 
01168 //=============================================================================
01172 //=============================================================================
01173 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnCylinderWithLocation
01174                                                 (GEOM::GEOM_Object_ptr   theShape,
01175                                                  const CORBA::Long       theShapeType,
01176                                                  GEOM::GEOM_Object_ptr   theAxis,
01177                                                  GEOM::GEOM_Object_ptr   thePnt,
01178                                                  const CORBA::Double     theRadius,
01179                                                  const GEOM::shape_state theState)
01180 {
01181   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
01182 
01183   //Set a not done flag
01184   GetOperations()->SetNotDone();
01185 
01186   //Get the reference objects
01187   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
01188   Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
01189   Handle(GEOM_Object) aPnt   = GetObjectImpl(thePnt);
01190 
01191   if (aShape.IsNull() || anAxis.IsNull() || aPnt.IsNull()) return aSeq._retn();
01192 
01193   //Get Shapes On Cylinder
01194   Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnCylinderWithLocation
01195     (aShape, theShapeType, anAxis, aPnt, theRadius, ShapeState(theState));
01196   if (!GetOperations()->IsDone() || aHSeq.IsNull())
01197     return aSeq._retn();
01198 
01199   Standard_Integer aLength = aHSeq->Length();
01200   aSeq->length(aLength);
01201   for (Standard_Integer i = 1; i <= aLength; i++)
01202     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
01203 
01204   return aSeq._retn();
01205 }
01206 
01207 //=============================================================================
01211 //=============================================================================
01212 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnSphere
01213                                                 (GEOM::GEOM_Object_ptr   theShape,
01214                                                  const CORBA::Long       theShapeType,
01215                                                  GEOM::GEOM_Object_ptr   theCenter,
01216                                                  const CORBA::Double     theRadius,
01217                                                  const GEOM::shape_state theState)
01218 {
01219   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
01220 
01221   //Set a not done flag
01222   GetOperations()->SetNotDone();
01223 
01224   //Get the reference objects
01225   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
01226   Handle(GEOM_Object) aCenter = GetObjectImpl(theCenter);
01227 
01228   if (aShape.IsNull() || aCenter.IsNull()) return aSeq._retn();
01229 
01230   //Get Shapes On Sphere
01231   Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnSphere
01232     (aShape, theShapeType, aCenter, theRadius, ShapeState(theState));
01233   if (!GetOperations()->IsDone() || aHSeq.IsNull())
01234     return aSeq._retn();
01235 
01236   Standard_Integer aLength = aHSeq->Length();
01237   aSeq->length(aLength);
01238   for (Standard_Integer i = 1; i <= aLength; i++)
01239     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
01240 
01241   return aSeq._retn();
01242 }
01243 
01244 //=============================================================================
01248 //=============================================================================
01249 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnQuadrangle
01250                                                 (GEOM::GEOM_Object_ptr theShape,
01251                                                  CORBA::Long           theShapeType,
01252                                                  GEOM::GEOM_Object_ptr theTopLeftPoint,
01253                                                  GEOM::GEOM_Object_ptr theTopRigthPoint,
01254                                                  GEOM::GEOM_Object_ptr theBottomLeftPoint,
01255                                                  GEOM::GEOM_Object_ptr theBottomRigthPoint,
01256                                                  GEOM::shape_state     theState)
01257 {
01258   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
01259 
01260   //Set a not done flag
01261   GetOperations()->SetNotDone();
01262 
01263   //Get the reference objects
01264   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
01265   Handle(GEOM_Object) aTopLeftPoint = GetObjectImpl(theTopLeftPoint);
01266   Handle(GEOM_Object) aTopRigthPoint = GetObjectImpl(theTopRigthPoint);
01267   Handle(GEOM_Object) aBottomLeftPoint = GetObjectImpl(theBottomLeftPoint);
01268   Handle(GEOM_Object) aBottomRigthPoint = GetObjectImpl(theBottomRigthPoint);
01269 
01270   if (aShape.IsNull() ||
01271       aTopLeftPoint.IsNull() ||
01272       aTopRigthPoint.IsNull() ||
01273       aBottomLeftPoint.IsNull() ||
01274       aBottomRigthPoint.IsNull())
01275     return aSeq._retn();
01276 
01277   //Get Shapes On Quadrangle
01278   Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnQuadrangle
01279     (aShape, theShapeType,
01280      aTopLeftPoint, aTopRigthPoint, aBottomLeftPoint, aBottomRigthPoint,
01281      ShapeState(theState));
01282   if (!GetOperations()->IsDone() || aHSeq.IsNull())
01283     return aSeq._retn();
01284 
01285   Standard_Integer aLength = aHSeq->Length();
01286   aSeq->length(aLength);
01287   for (Standard_Integer i = 1; i <= aLength; i++)
01288     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
01289 
01290   return aSeq._retn();
01291 }
01292 
01293 //=============================================================================
01297 //=============================================================================
01298 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnPlaneIDs
01299                                                 (GEOM::GEOM_Object_ptr   theShape,
01300                                                  const CORBA::Long       theShapeType,
01301                                                  GEOM::GEOM_Object_ptr   theAx1,
01302                                                  const GEOM::shape_state theState)
01303 {
01304   GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
01305 
01306   //Set a not done flag
01307   GetOperations()->SetNotDone();
01308 
01309   //Get the reference objects
01310   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
01311   Handle(GEOM_Object) anAx1 = GetObjectImpl(theAx1);
01312 
01313   if (aShape.IsNull() || anAx1.IsNull()) return aSeq._retn();
01314 
01315   //Get Shapes On Plane
01316   Handle(TColStd_HSequenceOfInteger) aHSeq =
01317     GetOperations()->GetShapesOnPlaneIDs(aShape, theShapeType, anAx1, ShapeState(theState));
01318   if (!GetOperations()->IsDone() || aHSeq.IsNull())
01319     return aSeq._retn();
01320 
01321   Standard_Integer aLength = aHSeq->Length();
01322   aSeq->length(aLength);
01323   for (Standard_Integer i = 1; i <= aLength; i++)
01324     aSeq[i-1] = aHSeq->Value(i);
01325 
01326   return aSeq._retn();
01327 }
01328 
01329 //=============================================================================
01333 //=============================================================================
01334 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnPlaneWithLocationIDs
01335                                                 (GEOM::GEOM_Object_ptr   theShape,
01336                                                  const CORBA::Long       theShapeType,
01337                                                  GEOM::GEOM_Object_ptr   theAx1,
01338                                                  GEOM::GEOM_Object_ptr   thePnt,
01339                                                  const GEOM::shape_state theState)
01340 {
01341   GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
01342 
01343   //Set a not done flag
01344   GetOperations()->SetNotDone();
01345 
01346   //Get the reference objects
01347   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
01348   Handle(GEOM_Object) anAx1 = GetObjectImpl(theAx1);
01349   Handle(GEOM_Object) anPnt = GetObjectImpl(thePnt);
01350 
01351   if (aShape.IsNull() || anAx1.IsNull() || anPnt.IsNull()) return aSeq._retn();
01352 
01353   //Get Shapes On Plane
01354   Handle(TColStd_HSequenceOfInteger) aHSeq =
01355     GetOperations()->GetShapesOnPlaneWithLocationIDs(aShape, theShapeType,
01356                                                      anAx1, anPnt, ShapeState(theState));
01357   if (!GetOperations()->IsDone() || aHSeq.IsNull())
01358     return aSeq._retn();
01359 
01360   Standard_Integer aLength = aHSeq->Length();
01361   aSeq->length(aLength);
01362   for (Standard_Integer i = 1; i <= aLength; i++)
01363     aSeq[i-1] = aHSeq->Value(i);
01364 
01365   return aSeq._retn();
01366 }
01367 
01368 //=============================================================================
01372 //=============================================================================
01373 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnCylinderIDs
01374                                                 (GEOM::GEOM_Object_ptr   theShape,
01375                                                  const CORBA::Long       theShapeType,
01376                                                  GEOM::GEOM_Object_ptr   theAxis,
01377                                                  const CORBA::Double     theRadius,
01378                                                  const GEOM::shape_state theState)
01379 {
01380   GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
01381 
01382   //Set a not done flag
01383   GetOperations()->SetNotDone();
01384 
01385   //Get the reference objects
01386   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
01387   Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
01388 
01389   if (aShape.IsNull() || anAxis.IsNull()) return aSeq._retn();
01390 
01391   //Get Shapes On Cylinder
01392   Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnCylinderIDs
01393     (aShape, theShapeType, anAxis, theRadius, ShapeState(theState));
01394   if (!GetOperations()->IsDone() || aHSeq.IsNull())
01395     return aSeq._retn();
01396 
01397   Standard_Integer aLength = aHSeq->Length();
01398   aSeq->length(aLength);
01399   for (Standard_Integer i = 1; i <= aLength; i++)
01400     aSeq[i-1] = aHSeq->Value(i);
01401 
01402   return aSeq._retn();
01403 }
01404 
01405 //=============================================================================
01409 //=============================================================================
01410 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnCylinderWithLocationIDs
01411                                                 (GEOM::GEOM_Object_ptr   theShape,
01412                                                  const CORBA::Long       theShapeType,
01413                                                  GEOM::GEOM_Object_ptr   theAxis,
01414                                                  GEOM::GEOM_Object_ptr   thePnt,
01415                                                  const CORBA::Double     theRadius,
01416                                                  const GEOM::shape_state theState)
01417 {
01418   GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
01419 
01420   //Set a not done flag
01421   GetOperations()->SetNotDone();
01422 
01423   //Get the reference objects
01424   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
01425   Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
01426   Handle(GEOM_Object) aPnt   = GetObjectImpl(thePnt);
01427 
01428   if (aShape.IsNull() || anAxis.IsNull() || aPnt.IsNull()) return aSeq._retn();
01429 
01430   //Get Shapes On Cylinder
01431   Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnCylinderWithLocationIDs
01432     (aShape, theShapeType, anAxis, aPnt, theRadius, ShapeState(theState));
01433   if (!GetOperations()->IsDone() || aHSeq.IsNull())
01434     return aSeq._retn();
01435 
01436   Standard_Integer aLength = aHSeq->Length();
01437   aSeq->length(aLength);
01438   for (Standard_Integer i = 1; i <= aLength; i++)
01439     aSeq[i-1] = aHSeq->Value(i);
01440 
01441   return aSeq._retn();
01442 }
01443 
01444 //=============================================================================
01448 //=============================================================================
01449 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnSphereIDs
01450                                                 (GEOM::GEOM_Object_ptr   theShape,
01451                                                  const CORBA::Long       theShapeType,
01452                                                  GEOM::GEOM_Object_ptr   theCenter,
01453                                                  const CORBA::Double     theRadius,
01454                                                  const GEOM::shape_state theState)
01455 {
01456   GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
01457 
01458   //Set a not done flag
01459   GetOperations()->SetNotDone();
01460 
01461   //Get the reference objects
01462   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
01463   Handle(GEOM_Object) aCenter = GetObjectImpl(theCenter);
01464 
01465   if (aShape.IsNull() || aCenter.IsNull()) return aSeq._retn();
01466 
01467   //Get Shapes On Sphere
01468   Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnSphereIDs
01469     (aShape, theShapeType, aCenter, theRadius, ShapeState(theState));
01470   if (!GetOperations()->IsDone() || aHSeq.IsNull())
01471     return aSeq._retn();
01472 
01473   Standard_Integer aLength = aHSeq->Length();
01474   aSeq->length(aLength);
01475   for (Standard_Integer i = 1; i <= aLength; i++)
01476     aSeq[i-1] = aHSeq->Value(i);
01477 
01478   return aSeq._retn();
01479 }
01480 
01481 //=============================================================================
01485 //=============================================================================
01486 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnQuadrangleIDs
01487                                                 (GEOM::GEOM_Object_ptr theShape,
01488                                                  CORBA::Long           theShapeType,
01489                                                  GEOM::GEOM_Object_ptr theTopLeftPoint,
01490                                                  GEOM::GEOM_Object_ptr theTopRigthPoint,
01491                                                  GEOM::GEOM_Object_ptr theBottomLeftPoint,
01492                                                  GEOM::GEOM_Object_ptr theBottomRigthPoint,
01493                                                  GEOM::shape_state     theState)
01494 {
01495   GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
01496 
01497   //Set a not done flag
01498   GetOperations()->SetNotDone();
01499 
01500   //Get the reference objects
01501   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
01502   Handle(GEOM_Object) aTopLeftPoint = GetObjectImpl(theTopLeftPoint);
01503   Handle(GEOM_Object) aTopRigthPoint = GetObjectImpl(theTopRigthPoint);
01504   Handle(GEOM_Object) aBottomLeftPoint = GetObjectImpl(theBottomLeftPoint);
01505   Handle(GEOM_Object) aBottomRigthPoint = GetObjectImpl(theBottomRigthPoint);
01506 
01507   if (aShape.IsNull() ||
01508       aTopLeftPoint.IsNull() ||
01509       aTopRigthPoint.IsNull() ||
01510       aBottomLeftPoint.IsNull() ||
01511       aBottomRigthPoint.IsNull() )
01512     return aSeq._retn();
01513 
01514   //Get Shapes On Quadrangle
01515   Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnQuadrangleIDs
01516     (aShape, theShapeType,
01517      aTopLeftPoint, aTopRigthPoint, aBottomLeftPoint, aBottomRigthPoint,
01518      ShapeState(theState));
01519   if (!GetOperations()->IsDone() || aHSeq.IsNull())
01520     return aSeq._retn();
01521 
01522   Standard_Integer aLength = aHSeq->Length();
01523   aSeq->length(aLength);
01524   for (Standard_Integer i = 1; i <= aLength; i++)
01525     aSeq[i-1] = aHSeq->Value(i);
01526 
01527   return aSeq._retn();
01528 }
01529 
01530 //=============================================================================
01534 //=============================================================================
01535 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnBox
01536                                                 (GEOM::GEOM_Object_ptr theBox,
01537                                                  GEOM::GEOM_Object_ptr theShape,
01538                                                  CORBA::Long           theShapeType,
01539                                                  GEOM::shape_state     theState)
01540 {
01541   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
01542 
01543   //Set a not done flag
01544   GetOperations()->SetNotDone();
01545 
01546   //Get the reference objects
01547   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
01548   Handle(GEOM_Object) aBox = GetObjectImpl(theBox);
01549 
01550   if (aShape.IsNull() || aBox.IsNull() )
01551     return aSeq._retn();
01552 
01553   //Get Shapes On Box
01554   Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnBox
01555     (aBox,aShape, theShapeType,ShapeState(theState));
01556   if (!GetOperations()->IsDone() || aHSeq.IsNull())
01557     return aSeq._retn();
01558 
01559   Standard_Integer aLength = aHSeq->Length();
01560   aSeq->length(aLength);
01561   for (Standard_Integer i = 1; i <= aLength; i++)
01562     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
01563 
01564   return aSeq._retn();
01565 }
01566 
01567 //=============================================================================
01571 //=============================================================================
01572 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnBoxIDs
01573                                                 (GEOM::GEOM_Object_ptr theBox,
01574                                                  GEOM::GEOM_Object_ptr theShape,
01575                                                  CORBA::Long           theShapeType,
01576                                                  GEOM::shape_state     theState)
01577 {
01578   GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
01579 
01580   //Set a not done flag
01581   GetOperations()->SetNotDone();
01582 
01583   //Get the reference objects
01584   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
01585   Handle(GEOM_Object) aBox = GetObjectImpl(theBox);
01586 
01587   if (aShape.IsNull() || aBox.IsNull() )
01588     return aSeq._retn();
01589 
01590   //Get Shapes On Box
01591   Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnBoxIDs
01592     (aBox,aShape, theShapeType,ShapeState(theState));
01593   if (!GetOperations()->IsDone() || aHSeq.IsNull())
01594     return aSeq._retn();
01595 
01596   Standard_Integer aLength = aHSeq->Length();
01597   aSeq->length(aLength);
01598   for (Standard_Integer i = 1; i <= aLength; i++)
01599     aSeq[i-1] = aHSeq->Value(i);
01600 
01601   return aSeq._retn();
01602 }
01603 
01604 
01605 //=============================================================================
01609 //=============================================================================
01610 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnShape
01611                                            (GEOM::GEOM_Object_ptr theCheckShape,
01612                                             GEOM::GEOM_Object_ptr theShape,
01613                                             CORBA::Short          theShapeType,
01614                                             GEOM::shape_state     theState)
01615 {
01616   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
01617 
01618   //Set a not done flag
01619   GetOperations()->SetNotDone();
01620 
01621   //Get the reference objects
01622   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
01623   Handle(GEOM_Object) aCheckShape = GetObjectImpl(theCheckShape);
01624 
01625   if (aShape.IsNull() || aCheckShape.IsNull() )
01626     return aSeq._retn();
01627 
01628   //Get Shapes On Shape
01629   Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnShape
01630     (aCheckShape,aShape, theShapeType,ShapeState(theState));
01631 
01632   if (!GetOperations()->IsDone() || aHSeq.IsNull())
01633     return aSeq._retn();
01634 
01635   Standard_Integer aLength = aHSeq->Length();
01636   aSeq->length(aLength);
01637   for (Standard_Integer i = 1; i <= aLength; i++)
01638     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
01639 
01640   return aSeq._retn();
01641 }
01642 
01643 
01644 //=============================================================================
01648 //=============================================================================
01649 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetShapesOnShapeAsCompound
01650                                            (GEOM::GEOM_Object_ptr theCheckShape,
01651                                             GEOM::GEOM_Object_ptr theShape,
01652                                             CORBA::Short          theShapeType,
01653                                             GEOM::shape_state     theState)
01654 {
01655   GEOM::GEOM_Object_var aGEOMObject;
01656 
01657   //Set a not done flag
01658   GetOperations()->SetNotDone();
01659 
01660   //Get the reference objects
01661   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
01662   Handle(GEOM_Object) aCheckShape = GetObjectImpl(theCheckShape);
01663 
01664   if (aShape.IsNull() || aCheckShape.IsNull() )
01665     return aGEOMObject._retn();
01666 
01667   //Get Shapes On Shape
01668   Handle(GEOM_Object) anObject = GetOperations()->GetShapesOnShapeAsCompound
01669     (aCheckShape,aShape, theShapeType,ShapeState(theState));
01670 
01671   if (anObject.IsNull())
01672     return aGEOMObject._retn();
01673 
01674   return GetObject(anObject);
01675 }
01676 
01677 
01678 //=============================================================================
01682 //=============================================================================
01683 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnShapeIDs
01684                                            (GEOM::GEOM_Object_ptr theCheckShape,
01685                                             GEOM::GEOM_Object_ptr theShape,
01686                                             CORBA::Short          theShapeType,
01687                                             GEOM::shape_state     theState)
01688 {
01689   GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
01690 
01691   //Set a not done flag
01692   GetOperations()->SetNotDone();
01693 
01694   //Get the reference objects
01695   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
01696   Handle(GEOM_Object) aCheckShape = GetObjectImpl(theCheckShape);
01697 
01698   if (aShape.IsNull() || aCheckShape.IsNull() )
01699     return aSeq._retn();
01700 
01701   //Get Shapes On Shape
01702   Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnShapeIDs
01703     (aCheckShape,aShape, theShapeType,ShapeState(theState));
01704   if (!GetOperations()->IsDone() || aHSeq.IsNull())
01705     return aSeq._retn();
01706 
01707   Standard_Integer aLength = aHSeq->Length();
01708   aSeq->length(aLength);
01709   for (Standard_Integer i = 1; i <= aLength; i++)
01710     aSeq[i-1] = aHSeq->Value(i);
01711 
01712   return aSeq._retn();
01713 }
01714 
01715 
01716 //=============================================================================
01720 //=============================================================================
01721 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlace
01722                                           (GEOM::GEOM_Object_ptr theShapeWhere,
01723                                            GEOM::GEOM_Object_ptr theShapeWhat)
01724 {
01725   GEOM::GEOM_Object_var aGEOMObject;
01726 
01727   //Set a not done flag
01728   GetOperations()->SetNotDone();
01729 
01730   //Get the reference objects
01731   Handle(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
01732   Handle(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
01733 
01734   if (aShapeWhere.IsNull() ||
01735       aShapeWhat.IsNull()) return aGEOMObject._retn();
01736 
01737   //Get Shapes in place of aShapeWhat
01738   Handle(GEOM_Object) anObject =
01739     GetOperations()->GetInPlace(aShapeWhere, aShapeWhat);
01740   if (!GetOperations()->IsDone() || anObject.IsNull())
01741     return aGEOMObject._retn();
01742 
01743   return GetObject(anObject);
01744 }
01745 
01746 //=============================================================================
01750 //=============================================================================
01751 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlaceOld
01752                                           (GEOM::GEOM_Object_ptr theShapeWhere,
01753                                            GEOM::GEOM_Object_ptr theShapeWhat)
01754 {
01755   GEOM::GEOM_Object_var aGEOMObject;
01756 
01757   //Set a not done flag
01758   GetOperations()->SetNotDone();
01759 
01760   //Get the reference objects
01761   Handle(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
01762   Handle(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
01763 
01764   if (aShapeWhere.IsNull() ||
01765       aShapeWhat.IsNull()) return aGEOMObject._retn();
01766 
01767   //Get Shapes in place of aShapeWhat
01768   Handle(GEOM_Object) anObject =
01769     GetOperations()->GetInPlaceOld(aShapeWhere, aShapeWhat);
01770   if (!GetOperations()->IsDone() || anObject.IsNull())
01771     return aGEOMObject._retn();
01772 
01773   return GetObject(anObject);
01774 }
01775 
01776 //=============================================================================
01780 //=============================================================================
01781 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlaceByHistory
01782                                           (GEOM::GEOM_Object_ptr theShapeWhere,
01783                                            GEOM::GEOM_Object_ptr theShapeWhat)
01784 {
01785   GEOM::GEOM_Object_var aGEOMObject;
01786 
01787   //Set a not done flag
01788   GetOperations()->SetNotDone();
01789 
01790   //Get the reference objects
01791   Handle(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
01792   Handle(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
01793 
01794   if (aShapeWhere.IsNull() ||
01795       aShapeWhat.IsNull()) return aGEOMObject._retn();
01796 
01797   //Get Shapes in place of aShapeWhat
01798   Handle(GEOM_Object) anObject =
01799     GetOperations()->GetInPlaceByHistory(aShapeWhere, aShapeWhat);
01800   if (!GetOperations()->IsDone() || anObject.IsNull())
01801     return aGEOMObject._retn();
01802 
01803   return GetObject(anObject);
01804 }
01805 
01806 //=============================================================================
01810 //=============================================================================
01811 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetSame
01812                                           (GEOM::GEOM_Object_ptr theShapeWhere,
01813                                            GEOM::GEOM_Object_ptr theShapeWhat)
01814 {
01815   GEOM::GEOM_Object_var aGEOMObject;
01816 
01817   //Set a not done flag
01818   GetOperations()->SetNotDone();
01819 
01820   //Get the reference objects
01821   Handle(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
01822   Handle(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
01823 
01824   if (aShapeWhere.IsNull() ||
01825       aShapeWhat.IsNull()) return aGEOMObject._retn();
01826 
01827   //Get Shapes in place of aShapeWhat
01828   Handle(GEOM_Object) anObject =
01829     GetOperations()->GetSame(aShapeWhere, aShapeWhat);
01830   if (!GetOperations()->IsDone() || anObject.IsNull())
01831     return aGEOMObject._retn();
01832 
01833   return GetObject(anObject);
01834 }
01835 
01836 //=============================================================================
01840 //=============================================================================
01841 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetSameIDs
01842                                           (GEOM::GEOM_Object_ptr theShapeWhere,
01843                                            GEOM::GEOM_Object_ptr theShapeWhat) {
01844   GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
01845 
01846   //Get the reference objects
01847   Handle(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
01848   Handle(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
01849 
01850   if (aShapeWhere.IsNull() ||
01851       aShapeWhat.IsNull()) return aSeq._retn();
01852 
01853 
01854   Handle(TColStd_HSequenceOfInteger) aHSeq =
01855     GetOperations()->GetSameIDs(aShapeWhere, aShapeWhat);
01856 
01857   if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
01858 
01859   Standard_Integer aLength = aHSeq->Length();
01860   aSeq->length(aLength);
01861   for (Standard_Integer i = 1; i <= aLength; i++)
01862     aSeq[i-1] = aHSeq->Value(i);
01863 
01864   return aSeq._retn();
01865 }