1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #include <Standard_Stream.hxx>
24 #include "GEOM_IShapesOperations_i.hh"
26 #include "utilities.h"
28 #include "Utils_ExceptHandlers.hxx"
30 #include "GEOM_Engine.hxx"
31 #include "GEOM_Object.hxx"
33 #include <TColStd_HSequenceOfTransient.hxx>
34 #include <TColStd_HArray1OfInteger.hxx>
36 //=============================================================================
40 //=============================================================================
41 GEOM_IShapesOperations_i::GEOM_IShapesOperations_i (PortableServer::POA_ptr thePOA,
42 GEOM::GEOM_Gen_ptr theEngine,
43 ::GEOMImpl_IShapesOperations* theImpl)
44 :GEOM_IOperations_i(thePOA, theEngine, theImpl)
46 MESSAGE("GEOM_IShapesOperations_i::GEOM_IShapesOperations_i");
49 //=============================================================================
53 //=============================================================================
54 GEOM_IShapesOperations_i::~GEOM_IShapesOperations_i()
56 MESSAGE("GEOM_IShapesOperations_i::~GEOM_IShapesOperations_i");
60 //=============================================================================
64 //=============================================================================
65 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeEdge
66 (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2)
68 GEOM::GEOM_Object_var aGEOMObject;
71 GetOperations()->SetNotDone();
73 if (thePnt1 == NULL || thePnt2 == NULL) return aGEOMObject._retn();
75 //Get the reference points
76 Handle(GEOM_Object) aPnt1 = GetOperations()->GetEngine()->GetObject
77 (thePnt1->GetStudyID(), thePnt1->GetEntry());
78 Handle(GEOM_Object) aPnt2 = GetOperations()->GetEngine()->GetObject
79 (thePnt2->GetStudyID(), thePnt2->GetEntry());
81 if (aPnt1.IsNull() || aPnt2.IsNull()) return aGEOMObject._retn();
84 Handle(GEOM_Object) anObject = GetOperations()->MakeEdge(aPnt1, aPnt2);
85 if (!GetOperations()->IsDone() || anObject.IsNull())
86 return aGEOMObject._retn();
88 return GetObject(anObject);
91 //=============================================================================
95 //=============================================================================
96 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeWire
97 (const GEOM::ListOfGO& theEdgesAndWires)
99 GEOM::GEOM_Object_var aGEOMObject;
101 //Set a not done flag
102 GetOperations()->SetNotDone();
105 list<Handle(GEOM_Object)> aShapes;
108 aLen = theEdgesAndWires.length();
109 for (ind = 0; ind < aLen; ind++) {
110 if (theEdgesAndWires[ind] == NULL) return aGEOMObject._retn();
111 Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject
112 (theEdgesAndWires[ind]->GetStudyID(), theEdgesAndWires[ind]->GetEntry());
113 if (aSh.IsNull()) return aGEOMObject._retn();
114 aShapes.push_back(aSh);
118 Handle(GEOM_Object) anObject =
119 GetOperations()->MakeWire(aShapes);
120 if (!GetOperations()->IsDone() || anObject.IsNull())
121 return aGEOMObject._retn();
123 return GetObject(anObject);
126 //=============================================================================
130 //=============================================================================
131 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeFace
132 (GEOM::GEOM_Object_ptr theWire,
133 const CORBA::Boolean isPlanarWanted)
135 GEOM::GEOM_Object_var aGEOMObject;
137 //Set a not done flag
138 GetOperations()->SetNotDone();
140 if (theWire == NULL) return aGEOMObject._retn();
142 //Get the reference wire
143 Handle(GEOM_Object) aWire = GetOperations()->GetEngine()->GetObject
144 (theWire->GetStudyID(), theWire->GetEntry());
146 if (aWire.IsNull()) return aGEOMObject._retn();
149 Handle(GEOM_Object) anObject = GetOperations()->MakeFace(aWire, isPlanarWanted);
150 if (!GetOperations()->IsDone() || anObject.IsNull())
151 return aGEOMObject._retn();
153 return GetObject(anObject);
156 //=============================================================================
160 //=============================================================================
161 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeFaceWires
162 (const GEOM::ListOfGO& theWires,
163 const CORBA::Boolean isPlanarWanted)
165 GEOM::GEOM_Object_var aGEOMObject;
167 //Set a not done flag
168 GetOperations()->SetNotDone();
171 list<Handle(GEOM_Object)> aShapes;
174 aLen = theWires.length();
175 for (ind = 0; ind < aLen; ind++) {
176 if (theWires[ind] == NULL) return aGEOMObject._retn();
177 Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject
178 (theWires[ind]->GetStudyID(), theWires[ind]->GetEntry());
179 if (aSh.IsNull()) return aGEOMObject._retn();
180 aShapes.push_back(aSh);
184 Handle(GEOM_Object) anObject =
185 GetOperations()->MakeFaceWires(aShapes, isPlanarWanted);
186 if (!GetOperations()->IsDone() || anObject.IsNull())
187 return aGEOMObject._retn();
189 return GetObject(anObject);
192 //=============================================================================
196 //=============================================================================
197 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeShell
198 (const GEOM::ListOfGO& theFacesAndShells)
200 GEOM::GEOM_Object_var aGEOMObject;
202 //Set a not done flag
203 GetOperations()->SetNotDone();
206 list<Handle(GEOM_Object)> aShapes;
209 aLen = theFacesAndShells.length();
210 for (ind = 0; ind < aLen; ind++) {
211 if (theFacesAndShells[ind] == NULL) return aGEOMObject._retn();
212 Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject
213 (theFacesAndShells[ind]->GetStudyID(), theFacesAndShells[ind]->GetEntry());
214 if (aSh.IsNull()) return aGEOMObject._retn();
215 aShapes.push_back(aSh);
219 Handle(GEOM_Object) anObject =
220 GetOperations()->MakeShell(aShapes);
221 if (!GetOperations()->IsDone() || anObject.IsNull())
222 return aGEOMObject._retn();
224 return GetObject(anObject);
227 //=============================================================================
231 //=============================================================================
232 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeSolidShell
233 (GEOM::GEOM_Object_ptr theShell)
235 GEOM::GEOM_Object_var aGEOMObject;
237 //Set a not done flag
238 GetOperations()->SetNotDone();
240 if (theShell == NULL) return aGEOMObject._retn();
242 //Get the reference objects
243 Handle(GEOM_Object) aShell = GetOperations()->GetEngine()->GetObject
244 (theShell->GetStudyID(), theShell->GetEntry());
246 if (aShell.IsNull()) return aGEOMObject._retn();
249 Handle(GEOM_Object) anObject = GetOperations()->MakeSolidShell(aShell);
250 if (!GetOperations()->IsDone() || anObject.IsNull())
251 return aGEOMObject._retn();
253 return GetObject(anObject);
256 //=============================================================================
260 //=============================================================================
261 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeSolidShells
262 (const GEOM::ListOfGO& theShells)
264 GEOM::GEOM_Object_var aGEOMObject;
266 //Set a not done flag
267 GetOperations()->SetNotDone();
270 list<Handle(GEOM_Object)> aShapes;
273 aLen = theShells.length();
274 for (ind = 0; ind < aLen; ind++) {
275 if (theShells[ind] == NULL) return aGEOMObject._retn();
276 Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject
277 (theShells[ind]->GetStudyID(), theShells[ind]->GetEntry());
278 if (aSh.IsNull()) return aGEOMObject._retn();
279 aShapes.push_back(aSh);
283 Handle(GEOM_Object) anObject =
284 GetOperations()->MakeSolidShells(aShapes);
285 if (!GetOperations()->IsDone() || anObject.IsNull())
286 return aGEOMObject._retn();
288 return GetObject(anObject);
291 //=============================================================================
295 //=============================================================================
296 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeCompound
297 (const GEOM::ListOfGO& theShapes)
299 GEOM::GEOM_Object_var aGEOMObject;
301 //Set a not done flag
302 GetOperations()->SetNotDone();
305 list<Handle(GEOM_Object)> aShapes;
308 aLen = theShapes.length();
309 for (ind = 0; ind < aLen; ind++) {
310 if (theShapes[ind] == NULL) return aGEOMObject._retn();
311 Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject
312 (theShapes[ind]->GetStudyID(), theShapes[ind]->GetEntry());
313 if (aSh.IsNull()) return aGEOMObject._retn();
314 aShapes.push_back(aSh);
318 Handle(GEOM_Object) anObject =
319 GetOperations()->MakeCompound(aShapes);
320 if (!GetOperations()->IsDone() || anObject.IsNull())
321 return aGEOMObject._retn();
323 return GetObject(anObject);
326 //=============================================================================
330 //=============================================================================
331 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFaces
332 (GEOM::GEOM_Object_ptr theShape,
333 CORBA::Double theTolerance,
334 CORBA::Boolean doKeepNonSolids)
336 GEOM::GEOM_Object_var aGEOMObject;
338 //Set a not done flag
339 GetOperations()->SetNotDone();
341 if (theShape == NULL) return aGEOMObject._retn();
343 //Get the reference objects
344 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
345 (theShape->GetStudyID(), theShape->GetEntry());
347 if (aShape.IsNull()) return aGEOMObject._retn();
350 Handle(GEOM_Object) anObject =
351 GetOperations()->MakeGlueFaces(aShape, theTolerance, doKeepNonSolids);
352 //if (!GetOperations()->IsDone() || anObject.IsNull())
354 if (anObject.IsNull())
355 return aGEOMObject._retn();
357 return GetObject(anObject);
361 //=============================================================================
365 //=============================================================================
366 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetGlueFaces
367 (GEOM::GEOM_Object_ptr theShape,
368 const CORBA::Double theTolerance)
370 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
372 //Set a not done flag
373 GetOperations()->SetNotDone();
375 if (theShape == NULL) return aSeq._retn();
377 //Get the reference objects
378 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
379 (theShape->GetStudyID(), theShape->GetEntry());
380 if (aShape.IsNull()) return aSeq._retn();
382 Handle(TColStd_HSequenceOfTransient) aHSeq =
383 GetOperations()->GetGlueFaces(aShape, theTolerance);
385 //if (!GetOperations()->IsDone() || aHSeq.IsNull())
390 Standard_Integer aLength = aHSeq->Length();
391 aSeq->length(aLength);
392 for (Standard_Integer i = 1; i <= aLength; i++)
393 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
399 //=============================================================================
401 * MakeGlueFacesByList
403 //=============================================================================
404 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFacesByList
405 (GEOM::GEOM_Object_ptr theShape,
406 CORBA::Double theTolerance,
407 const GEOM::ListOfGO& theFaces,
408 CORBA::Boolean doKeepNonSolids)
410 GEOM::GEOM_Object_var aGEOMObject;
412 //Set a not done flag
413 GetOperations()->SetNotDone();
415 if (theShape == NULL) return aGEOMObject._retn();
417 //Get the reference objects
418 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
419 (theShape->GetStudyID(), theShape->GetEntry());
421 if (aShape.IsNull()) return aGEOMObject._retn();
424 list<Handle(GEOM_Object)> aFaces;
426 aLen = theFaces.length();
427 for (ind = 0; ind < aLen; ind++) {
428 if (theFaces[ind] == NULL) return aGEOMObject._retn();
429 Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject
430 (theFaces[ind]->GetStudyID(), theFaces[ind]->GetEntry());
431 if (aSh.IsNull()) return aGEOMObject._retn();
432 aFaces.push_back(aSh);
436 Handle(GEOM_Object) anObject =
437 GetOperations()->MakeGlueFacesByList(aShape, theTolerance, aFaces, doKeepNonSolids);
438 //if (!GetOperations()->IsDone() || anObject.IsNull())
440 if (anObject.IsNull())
441 return aGEOMObject._retn();
443 return GetObject(anObject);
447 //=============================================================================
451 //=============================================================================
452 GEOM::ListOfGO* GEOM_IShapesOperations_i::MakeExplode (GEOM::GEOM_Object_ptr theShape,
453 const CORBA::Long theShapeType,
454 const CORBA::Boolean isSorted)
456 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
457 if (theShape == NULL) return aSeq._retn();
459 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
460 (theShape->GetStudyID(), theShape->GetEntry());
462 Handle(TColStd_HSequenceOfTransient) aHSeq =
463 GetOperations()->MakeExplode(aShape, theShapeType, isSorted);
464 if (!GetOperations()->IsDone() || aHSeq.IsNull())
467 Standard_Integer aLength = aHSeq->Length();
468 aSeq->length(aLength);
469 for (Standard_Integer i = 1; i <= aLength; i++)
470 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
475 //=============================================================================
479 //=============================================================================
480 GEOM::ListOfLong* GEOM_IShapesOperations_i::SubShapeAllIDs (GEOM::GEOM_Object_ptr theShape,
481 const CORBA::Long theShapeType,
482 const CORBA::Boolean isSorted)
484 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
485 if (theShape == NULL) return aSeq._retn();
487 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
488 (theShape->GetStudyID(), theShape->GetEntry());
490 Handle(TColStd_HSequenceOfInteger) aHSeq =
491 GetOperations()->SubShapeAllIDs(aShape, theShapeType, isSorted);
492 if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
494 Standard_Integer aLength = aHSeq->Length();
495 aSeq->length(aLength);
496 for (Standard_Integer i = 1; i <= aLength; i++)
497 aSeq[i-1] = aHSeq->Value(i);
502 //=============================================================================
506 //=============================================================================
507 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetSubShape
508 (GEOM::GEOM_Object_ptr theMainShape,
509 const CORBA::Long theID)
511 GEOM::GEOM_Object_var aGEOMObject;
513 //Set a not done flag
514 GetOperations()->SetNotDone();
516 if (theMainShape == NULL) return aGEOMObject._retn();
518 //Get the reference objects
519 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
520 (theMainShape->GetStudyID(), theMainShape->GetEntry());
522 if (aShape.IsNull()) return aGEOMObject._retn();
524 Handle(GEOM_Object) anObject = GetOperations()->GetSubShape(aShape, theID);
525 if (!GetOperations()->IsDone() || anObject.IsNull())
526 return aGEOMObject._retn();
528 return GetObject(anObject);
531 //=============================================================================
535 //=============================================================================
536 CORBA::Long GEOM_IShapesOperations_i::GetSubShapeIndex
537 (GEOM::GEOM_Object_ptr theMainShape, GEOM::GEOM_Object_ptr theSubShape)
539 if (theMainShape == NULL || theSubShape == NULL) return -1;
541 //Get the reference shapes
542 Handle(GEOM_Object) aMainShapeRef = GetOperations()->GetEngine()->GetObject
543 (theMainShape->GetStudyID(), theMainShape->GetEntry());
544 Handle(GEOM_Object) aSubShapeRef = GetOperations()->GetEngine()->GetObject
545 (theSubShape->GetStudyID(), theSubShape->GetEntry());
546 if (aMainShapeRef.IsNull() || aSubShapeRef.IsNull()) return -1;
548 //Get the unique ID of <theSubShape> inside <theMainShape>
549 CORBA::Long anID = GetOperations()->GetSubShapeIndex(aMainShapeRef, aSubShapeRef);
550 if (!GetOperations()->IsDone())
556 //=============================================================================
560 //=============================================================================
561 CORBA::Long GEOM_IShapesOperations_i::GetTopologyIndex
562 (GEOM::GEOM_Object_ptr theMainShape, GEOM::GEOM_Object_ptr theSubShape)
564 if (theMainShape == NULL || theSubShape == NULL) return -1;
566 //Get the reference shapes
567 Handle(GEOM_Object) aMainShapeRef = GetOperations()->GetEngine()->GetObject
568 (theMainShape->GetStudyID(), theMainShape->GetEntry());
569 Handle(GEOM_Object) aSubShapeRef = GetOperations()->GetEngine()->GetObject
570 (theSubShape->GetStudyID(), theSubShape->GetEntry());
571 if (aMainShapeRef.IsNull() || aSubShapeRef.IsNull()) return -1;
573 //Get an ID of <theSubShape>, unique among all sub-shapes of <theMainShape> of the same type
574 CORBA::Long anID = GetOperations()->GetTopologyIndex(aMainShapeRef, aSubShapeRef);
575 if (!GetOperations()->IsDone())
581 //=============================================================================
585 //=============================================================================
586 char* GEOM_IShapesOperations_i::GetShapeTypeString (GEOM::GEOM_Object_ptr theShape)
588 if (theShape == NULL) return NULL;
590 //Get the reference shape
591 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
592 (theShape->GetStudyID(), theShape->GetEntry());
594 if (aShape.IsNull()) return NULL;
596 // Get shape parameters
597 TCollection_AsciiString aDescription = GetOperations()->GetShapeTypeString(aShape);
598 return CORBA::string_dup(aDescription.ToCString());
601 //=============================================================================
605 //=============================================================================
606 CORBA::Long GEOM_IShapesOperations_i::NumberOfFaces (GEOM::GEOM_Object_ptr theShape)
608 if (theShape == NULL) return -1;
610 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
611 (theShape->GetStudyID(), theShape->GetEntry());
613 CORBA::Long aNb = GetOperations()->NumberOfFaces(aShape);
614 if (!GetOperations()->IsDone()) return -1;
619 //=============================================================================
623 //=============================================================================
624 CORBA::Long GEOM_IShapesOperations_i::NumberOfEdges (GEOM::GEOM_Object_ptr theShape)
626 if (theShape == NULL) return -1;
628 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
629 (theShape->GetStudyID(), theShape->GetEntry());
631 CORBA::Long aNb = GetOperations()->NumberOfEdges(aShape);
632 if (!GetOperations()->IsDone()) return -1;
637 //=============================================================================
641 //=============================================================================
642 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::ChangeOrientation
643 (GEOM::GEOM_Object_ptr theShape)
645 GEOM::GEOM_Object_var aGEOMObject;
647 //Set a not done flag
648 GetOperations()->SetNotDone();
650 if (theShape == NULL) return aGEOMObject._retn();
652 //Get the reference objects
653 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
654 (theShape->GetStudyID(), theShape->GetEntry());
656 if (aShape.IsNull()) return aGEOMObject._retn();
659 Handle(GEOM_Object) anObject = GetOperations()->ReverseShape(aShape);
660 if (!GetOperations()->IsDone() || anObject.IsNull())
661 return aGEOMObject._retn();
663 return GetObject(anObject);
666 //=============================================================================
670 //=============================================================================
671 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetFreeFacesIDs (GEOM::GEOM_Object_ptr theShape)
673 //Set a not done flag
674 GetOperations()->SetNotDone();
676 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
677 if (theShape == NULL) return aSeq._retn();
679 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
680 (theShape->GetStudyID(), theShape->GetEntry());
682 Handle(TColStd_HSequenceOfInteger) aHSeq =
683 GetOperations()->GetFreeFacesIDs(aShape);
684 if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
686 Standard_Integer aLength = aHSeq->Length();
687 aSeq->length(aLength);
688 for (Standard_Integer i = 1; i <= aLength; i++)
689 aSeq[i-1] = aHSeq->Value(i);
694 //=============================================================================
698 //=============================================================================
699 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSharedShapes
700 (GEOM::GEOM_Object_ptr theShape1,
701 GEOM::GEOM_Object_ptr theShape2,
702 const CORBA::Long theShapeType)
704 //Set a not done flag
705 GetOperations()->SetNotDone();
707 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
708 if (theShape1 == NULL ||
709 theShape2 == NULL) return aSeq._retn();
711 Handle(GEOM_Object) aShape1 = GetOperations()->GetEngine()->GetObject
712 (theShape1->GetStudyID(), theShape1->GetEntry());
713 Handle(GEOM_Object) aShape2 = GetOperations()->GetEngine()->GetObject
714 (theShape2->GetStudyID(), theShape2->GetEntry());
716 if (aShape1.IsNull() ||
717 aShape2.IsNull()) return aSeq._retn();
719 Handle(TColStd_HSequenceOfTransient) aHSeq =
720 GetOperations()->GetSharedShapes(aShape1, aShape2, theShapeType);
721 if (!GetOperations()->IsDone() || aHSeq.IsNull())
724 Standard_Integer aLength = aHSeq->Length();
725 aSeq->length(aLength);
726 for (Standard_Integer i = 1; i <= aLength; i++)
727 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
732 static GEOMAlgo_State ShapeState (const GEOM::shape_state theState)
734 GEOMAlgo_State aState = GEOMAlgo_ST_UNKNOWN;
738 aState = GEOMAlgo_ST_ON;
741 aState = GEOMAlgo_ST_OUT;
744 aState = GEOMAlgo_ST_ONOUT;
747 aState = GEOMAlgo_ST_IN;
750 aState = GEOMAlgo_ST_ONIN;
759 //=============================================================================
763 //=============================================================================
764 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnPlane
765 (GEOM::GEOM_Object_ptr theShape,
766 const CORBA::Long theShapeType,
767 GEOM::GEOM_Object_ptr theAx1,
768 const GEOM::shape_state theState)
770 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
772 //Set a not done flag
773 GetOperations()->SetNotDone();
775 if (theShape == NULL || theAx1 == NULL) return aSeq._retn();
777 //Get the reference objects
778 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
779 (theShape->GetStudyID(), theShape->GetEntry());
780 Handle(GEOM_Object) anAx1 = GetOperations()->GetEngine()->GetObject
781 (theAx1->GetStudyID(), theAx1->GetEntry());
783 if (aShape.IsNull() || anAx1.IsNull()) return aSeq._retn();
785 //Get Shapes On Plane
786 Handle(TColStd_HSequenceOfTransient) aHSeq =
787 GetOperations()->GetShapesOnPlane(aShape, theShapeType, anAx1, ShapeState(theState));
788 if (!GetOperations()->IsDone() || aHSeq.IsNull())
791 Standard_Integer aLength = aHSeq->Length();
792 aSeq->length(aLength);
793 for (Standard_Integer i = 1; i <= aLength; i++)
794 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
799 //=============================================================================
801 * GetShapesOnPlaneWithLocation
803 //=============================================================================
804 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnPlaneWithLocation
805 (GEOM::GEOM_Object_ptr theShape,
806 const CORBA::Long theShapeType,
807 GEOM::GEOM_Object_ptr theAx1,
808 GEOM::GEOM_Object_ptr thePnt,
809 const GEOM::shape_state theState)
811 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
813 //Set a not done flag
814 GetOperations()->SetNotDone();
816 if (theShape == NULL || theAx1 == NULL || thePnt == NULL) return aSeq._retn();
818 //Get the reference objects
819 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
820 (theShape->GetStudyID(), theShape->GetEntry());
821 Handle(GEOM_Object) anAx1 = GetOperations()->GetEngine()->GetObject
822 (theAx1->GetStudyID(), theAx1->GetEntry());
823 Handle(GEOM_Object) anPnt = GetOperations()->GetEngine()->GetObject
824 (thePnt->GetStudyID(), thePnt->GetEntry());
826 if (aShape.IsNull() || anAx1.IsNull() || anPnt.IsNull()) return aSeq._retn();
828 //Get Shapes On Plane
829 Handle(TColStd_HSequenceOfTransient) aHSeq =
830 GetOperations()->GetShapesOnPlaneWithLocation(aShape, theShapeType, anAx1, anPnt, ShapeState(theState));
831 if (!GetOperations()->IsDone() || aHSeq.IsNull())
834 Standard_Integer aLength = aHSeq->Length();
835 aSeq->length(aLength);
836 for (Standard_Integer i = 1; i <= aLength; i++)
837 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
842 //=============================================================================
844 * GetShapesOnCylinder
846 //=============================================================================
847 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnCylinder
848 (GEOM::GEOM_Object_ptr theShape,
849 const CORBA::Long theShapeType,
850 GEOM::GEOM_Object_ptr theAxis,
851 const CORBA::Double theRadius,
852 const GEOM::shape_state theState)
854 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
856 //Set a not done flag
857 GetOperations()->SetNotDone();
859 if (theShape == NULL || theAxis == NULL) return aSeq._retn();
861 //Get the reference objects
862 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
863 (theShape->GetStudyID(), theShape->GetEntry());
864 Handle(GEOM_Object) anAxis = GetOperations()->GetEngine()->GetObject
865 (theAxis->GetStudyID(), theAxis->GetEntry());
867 if (aShape.IsNull() || anAxis.IsNull()) return aSeq._retn();
869 //Get Shapes On Cylinder
870 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnCylinder
871 (aShape, theShapeType, anAxis, theRadius, ShapeState(theState));
872 if (!GetOperations()->IsDone() || aHSeq.IsNull())
875 Standard_Integer aLength = aHSeq->Length();
876 aSeq->length(aLength);
877 for (Standard_Integer i = 1; i <= aLength; i++)
878 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
883 //=============================================================================
887 //=============================================================================
888 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnSphere
889 (GEOM::GEOM_Object_ptr theShape,
890 const CORBA::Long theShapeType,
891 GEOM::GEOM_Object_ptr theCenter,
892 const CORBA::Double theRadius,
893 const GEOM::shape_state theState)
895 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
897 //Set a not done flag
898 GetOperations()->SetNotDone();
900 if (theShape == NULL || theCenter == NULL) return aSeq._retn();
902 //Get the reference objects
903 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
904 (theShape->GetStudyID(), theShape->GetEntry());
905 Handle(GEOM_Object) aCenter = GetOperations()->GetEngine()->GetObject
906 (theCenter->GetStudyID(), theCenter->GetEntry());
908 if (aShape.IsNull() || aCenter.IsNull()) return aSeq._retn();
910 //Get Shapes On Sphere
911 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnSphere
912 (aShape, theShapeType, aCenter, theRadius, ShapeState(theState));
913 if (!GetOperations()->IsDone() || aHSeq.IsNull())
916 Standard_Integer aLength = aHSeq->Length();
917 aSeq->length(aLength);
918 for (Standard_Integer i = 1; i <= aLength; i++)
919 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
924 //=============================================================================
926 * GetShapesOnQuadrangle
928 //=============================================================================
929 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnQuadrangle
930 (GEOM::GEOM_Object_ptr theShape,
931 CORBA::Long theShapeType,
932 GEOM::GEOM_Object_ptr theTopLeftPoint,
933 GEOM::GEOM_Object_ptr theTopRigthPoint,
934 GEOM::GEOM_Object_ptr theBottomLeftPoint,
935 GEOM::GEOM_Object_ptr theBottomRigthPoint,
936 GEOM::shape_state theState)
938 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
940 //Set a not done flag
941 GetOperations()->SetNotDone();
943 if (theShape == NULL ||
944 theTopLeftPoint == NULL ||
945 theTopRigthPoint == NULL ||
946 theBottomLeftPoint == NULL ||
947 theBottomRigthPoint == NULL )
950 //Get the reference objects
951 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
952 (theShape->GetStudyID(), theShape->GetEntry());
953 Handle(GEOM_Object) aTopLeftPoint = GetOperations()->GetEngine()->GetObject
954 (theShape->GetStudyID(), theTopLeftPoint->GetEntry());
955 Handle(GEOM_Object) aTopRigthPoint = GetOperations()->GetEngine()->GetObject
956 (theShape->GetStudyID(), theTopRigthPoint->GetEntry());
957 Handle(GEOM_Object) aBottomLeftPoint = GetOperations()->GetEngine()->GetObject
958 (theShape->GetStudyID(), theBottomLeftPoint->GetEntry());
959 Handle(GEOM_Object) aBottomRigthPoint = GetOperations()->GetEngine()->GetObject
960 (theShape->GetStudyID(), theBottomRigthPoint->GetEntry());
962 if (aShape.IsNull() ||
963 aTopLeftPoint.IsNull() ||
964 aTopRigthPoint.IsNull() ||
965 aBottomLeftPoint.IsNull() ||
966 aBottomRigthPoint.IsNull() )
969 //Get Shapes On Quadrangle
970 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnQuadrangle
971 (aShape, theShapeType,
972 aTopLeftPoint, aTopRigthPoint, aBottomLeftPoint, aBottomRigthPoint,
973 ShapeState(theState));
974 if (!GetOperations()->IsDone() || aHSeq.IsNull())
977 Standard_Integer aLength = aHSeq->Length();
978 aSeq->length(aLength);
979 for (Standard_Integer i = 1; i <= aLength; i++)
980 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
985 //=============================================================================
987 * GetShapesOnPlaneIDs
989 //=============================================================================
990 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnPlaneIDs
991 (GEOM::GEOM_Object_ptr theShape,
992 const CORBA::Long theShapeType,
993 GEOM::GEOM_Object_ptr theAx1,
994 const GEOM::shape_state theState)
996 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
998 //Set a not done flag
999 GetOperations()->SetNotDone();
1001 if (theShape == NULL || theAx1 == NULL) return aSeq._retn();
1003 //Get the reference objects
1004 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
1005 (theShape->GetStudyID(), theShape->GetEntry());
1006 Handle(GEOM_Object) anAx1 = GetOperations()->GetEngine()->GetObject
1007 (theAx1->GetStudyID(), theAx1->GetEntry());
1009 if (aShape.IsNull() || anAx1.IsNull()) return aSeq._retn();
1011 //Get Shapes On Plane
1012 Handle(TColStd_HSequenceOfInteger) aHSeq =
1013 GetOperations()->GetShapesOnPlaneIDs(aShape, theShapeType, anAx1, ShapeState(theState));
1014 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1015 return aSeq._retn();
1017 Standard_Integer aLength = aHSeq->Length();
1018 aSeq->length(aLength);
1019 for (Standard_Integer i = 1; i <= aLength; i++)
1020 aSeq[i-1] = aHSeq->Value(i);
1022 return aSeq._retn();
1025 //=============================================================================
1027 * GetShapesOnPlaneWithLocationIDs
1029 //=============================================================================
1030 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnPlaneWithLocationIDs
1031 (GEOM::GEOM_Object_ptr theShape,
1032 const CORBA::Long theShapeType,
1033 GEOM::GEOM_Object_ptr theAx1,
1034 GEOM::GEOM_Object_ptr thePnt,
1035 const GEOM::shape_state theState)
1037 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1039 //Set a not done flag
1040 GetOperations()->SetNotDone();
1042 if (theShape == NULL || theAx1 == NULL || thePnt == NULL) return aSeq._retn();
1044 //Get the reference objects
1045 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
1046 (theShape->GetStudyID(), theShape->GetEntry());
1047 Handle(GEOM_Object) anAx1 = GetOperations()->GetEngine()->GetObject
1048 (theAx1->GetStudyID(), theAx1->GetEntry());
1049 Handle(GEOM_Object) anPnt = GetOperations()->GetEngine()->GetObject
1050 (thePnt->GetStudyID(), thePnt->GetEntry());
1052 if (aShape.IsNull() || anAx1.IsNull() || anPnt.IsNull()) return aSeq._retn();
1054 //Get Shapes On Plane
1055 Handle(TColStd_HSequenceOfInteger) aHSeq =
1056 GetOperations()->GetShapesOnPlaneWithLocationIDs(aShape, theShapeType, anAx1, anPnt, ShapeState(theState));
1057 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1058 return aSeq._retn();
1060 Standard_Integer aLength = aHSeq->Length();
1061 aSeq->length(aLength);
1062 for (Standard_Integer i = 1; i <= aLength; i++)
1063 aSeq[i-1] = aHSeq->Value(i);
1065 return aSeq._retn();
1068 //=============================================================================
1070 * GetShapesOnCylinderIDs
1072 //=============================================================================
1073 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnCylinderIDs
1074 (GEOM::GEOM_Object_ptr theShape,
1075 const CORBA::Long theShapeType,
1076 GEOM::GEOM_Object_ptr theAxis,
1077 const CORBA::Double theRadius,
1078 const GEOM::shape_state theState)
1080 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1082 //Set a not done flag
1083 GetOperations()->SetNotDone();
1085 if (theShape == NULL || theAxis == NULL) return aSeq._retn();
1087 //Get the reference objects
1088 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
1089 (theShape->GetStudyID(), theShape->GetEntry());
1090 Handle(GEOM_Object) anAxis = GetOperations()->GetEngine()->GetObject
1091 (theAxis->GetStudyID(), theAxis->GetEntry());
1093 if (aShape.IsNull() || anAxis.IsNull()) return aSeq._retn();
1095 //Get Shapes On Cylinder
1096 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnCylinderIDs
1097 (aShape, theShapeType, anAxis, theRadius, ShapeState(theState));
1098 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1099 return aSeq._retn();
1101 Standard_Integer aLength = aHSeq->Length();
1102 aSeq->length(aLength);
1103 for (Standard_Integer i = 1; i <= aLength; i++)
1104 aSeq[i-1] = aHSeq->Value(i);
1106 return aSeq._retn();
1109 //=============================================================================
1111 * GetShapesOnSphereIDs
1113 //=============================================================================
1114 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnSphereIDs
1115 (GEOM::GEOM_Object_ptr theShape,
1116 const CORBA::Long theShapeType,
1117 GEOM::GEOM_Object_ptr theCenter,
1118 const CORBA::Double theRadius,
1119 const GEOM::shape_state theState)
1121 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1123 //Set a not done flag
1124 GetOperations()->SetNotDone();
1126 if (theShape == NULL || theCenter == NULL) return aSeq._retn();
1128 //Get the reference objects
1129 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
1130 (theShape->GetStudyID(), theShape->GetEntry());
1131 Handle(GEOM_Object) aCenter = GetOperations()->GetEngine()->GetObject
1132 (theCenter->GetStudyID(), theCenter->GetEntry());
1134 if (aShape.IsNull() || aCenter.IsNull()) return aSeq._retn();
1136 //Get Shapes On Sphere
1137 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnSphereIDs
1138 (aShape, theShapeType, aCenter, theRadius, ShapeState(theState));
1139 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1140 return aSeq._retn();
1142 Standard_Integer aLength = aHSeq->Length();
1143 aSeq->length(aLength);
1144 for (Standard_Integer i = 1; i <= aLength; i++)
1145 aSeq[i-1] = aHSeq->Value(i);
1147 return aSeq._retn();
1150 //=============================================================================
1152 * GetShapesOnQuadrangleIDs
1154 //=============================================================================
1155 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnQuadrangleIDs
1156 (GEOM::GEOM_Object_ptr theShape,
1157 CORBA::Long theShapeType,
1158 GEOM::GEOM_Object_ptr theTopLeftPoint,
1159 GEOM::GEOM_Object_ptr theTopRigthPoint,
1160 GEOM::GEOM_Object_ptr theBottomLeftPoint,
1161 GEOM::GEOM_Object_ptr theBottomRigthPoint,
1162 GEOM::shape_state theState)
1164 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1166 //Set a not done flag
1167 GetOperations()->SetNotDone();
1169 if (theShape == NULL ||
1170 theTopLeftPoint == NULL ||
1171 theTopRigthPoint == NULL ||
1172 theBottomLeftPoint == NULL ||
1173 theBottomRigthPoint == NULL )
1174 return aSeq._retn();
1176 //Get the reference objects
1177 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
1178 (theShape->GetStudyID(), theShape->GetEntry());
1179 Handle(GEOM_Object) aTopLeftPoint = GetOperations()->GetEngine()->GetObject
1180 (theShape->GetStudyID(), theTopLeftPoint->GetEntry());
1181 Handle(GEOM_Object) aTopRigthPoint = GetOperations()->GetEngine()->GetObject
1182 (theShape->GetStudyID(), theTopRigthPoint->GetEntry());
1183 Handle(GEOM_Object) aBottomLeftPoint = GetOperations()->GetEngine()->GetObject
1184 (theShape->GetStudyID(), theBottomLeftPoint->GetEntry());
1185 Handle(GEOM_Object) aBottomRigthPoint = GetOperations()->GetEngine()->GetObject
1186 (theShape->GetStudyID(), theBottomRigthPoint->GetEntry());
1188 if (aShape.IsNull() ||
1189 aTopLeftPoint.IsNull() ||
1190 aTopRigthPoint.IsNull() ||
1191 aBottomLeftPoint.IsNull() ||
1192 aBottomRigthPoint.IsNull() )
1193 return aSeq._retn();
1195 //Get Shapes On Quadrangle
1196 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnQuadrangleIDs
1197 (aShape, theShapeType,
1198 aTopLeftPoint, aTopRigthPoint, aBottomLeftPoint, aBottomRigthPoint,
1199 ShapeState(theState));
1200 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1201 return aSeq._retn();
1203 Standard_Integer aLength = aHSeq->Length();
1204 aSeq->length(aLength);
1205 for (Standard_Integer i = 1; i <= aLength; i++)
1206 aSeq[i-1] = aHSeq->Value(i);
1208 return aSeq._retn();
1211 //=============================================================================
1215 //=============================================================================
1216 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnBox
1217 (GEOM::GEOM_Object_ptr theBox,
1218 GEOM::GEOM_Object_ptr theShape,
1219 CORBA::Long theShapeType,
1220 GEOM::shape_state theState)
1222 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1224 //Set a not done flag
1225 GetOperations()->SetNotDone();
1227 if ( theShape == NULL || theBox == NULL )
1228 return aSeq._retn();
1230 //Get the reference objects
1231 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
1232 (theShape->GetStudyID(), theShape->GetEntry());
1233 Handle(GEOM_Object) aBox = GetOperations()->GetEngine()->GetObject
1234 (theShape->GetStudyID(), theBox->GetEntry());
1236 if (aShape.IsNull() || aBox.IsNull() )
1237 return aSeq._retn();
1240 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnBox
1241 (aBox,aShape, theShapeType,ShapeState(theState));
1242 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1243 return aSeq._retn();
1245 Standard_Integer aLength = aHSeq->Length();
1246 aSeq->length(aLength);
1247 for (Standard_Integer i = 1; i <= aLength; i++)
1248 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1250 return aSeq._retn();
1253 //=============================================================================
1255 * GetShapesOnQuadrangleIDs
1257 //=============================================================================
1258 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnBoxIDs
1259 (GEOM::GEOM_Object_ptr theBox,
1260 GEOM::GEOM_Object_ptr theShape,
1261 CORBA::Long theShapeType,
1262 GEOM::shape_state theState)
1264 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1266 //Set a not done flag
1267 GetOperations()->SetNotDone();
1269 if ( theShape == NULL || theBox == NULL )
1270 return aSeq._retn();
1272 //Get the reference objects
1273 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
1274 (theShape->GetStudyID(), theShape->GetEntry());
1275 Handle(GEOM_Object) aBox = GetOperations()->GetEngine()->GetObject
1276 (theShape->GetStudyID(), theBox->GetEntry());
1278 if (aShape.IsNull() || aBox.IsNull() )
1279 return aSeq._retn();
1282 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnBoxIDs
1283 (aBox,aShape, theShapeType,ShapeState(theState));
1284 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1285 return aSeq._retn();
1287 Standard_Integer aLength = aHSeq->Length();
1288 aSeq->length(aLength);
1289 for (Standard_Integer i = 1; i <= aLength; i++)
1290 aSeq[i-1] = aHSeq->Value(i);
1292 return aSeq._retn();
1296 //=============================================================================
1300 //=============================================================================
1301 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnShape
1302 (GEOM::GEOM_Object_ptr theCheckShape,
1303 GEOM::GEOM_Object_ptr theShape,
1304 CORBA::Short theShapeType,
1305 GEOM::shape_state theState)
1307 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1309 //Set a not done flag
1310 GetOperations()->SetNotDone();
1312 if ( theShape == NULL || theCheckShape == NULL )
1313 return aSeq._retn();
1315 //Get the reference objects
1316 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
1317 (theShape->GetStudyID(), theShape->GetEntry());
1318 Handle(GEOM_Object) aCheckShape = GetOperations()->GetEngine()->GetObject
1319 (theShape->GetStudyID(), theCheckShape->GetEntry());
1321 if (aShape.IsNull() || aCheckShape.IsNull() )
1322 return aSeq._retn();
1324 //Get Shapes On Shape
1325 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnShape
1326 (aCheckShape,aShape, theShapeType,ShapeState(theState));
1328 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1329 return aSeq._retn();
1331 Standard_Integer aLength = aHSeq->Length();
1332 aSeq->length(aLength);
1333 for (Standard_Integer i = 1; i <= aLength; i++)
1334 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1336 return aSeq._retn();
1340 //=============================================================================
1342 * GetShapesOnShapeAsCompound
1344 //=============================================================================
1345 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetShapesOnShapeAsCompound
1346 (GEOM::GEOM_Object_ptr theCheckShape,
1347 GEOM::GEOM_Object_ptr theShape,
1348 CORBA::Short theShapeType,
1349 GEOM::shape_state theState)
1351 GEOM::GEOM_Object_var aGEOMObject;
1353 //Set a not done flag
1354 GetOperations()->SetNotDone();
1356 if ( theShape == NULL || theCheckShape == NULL )
1357 return aGEOMObject._retn();
1359 //Get the reference objects
1360 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
1361 (theShape->GetStudyID(), theShape->GetEntry());
1362 Handle(GEOM_Object) aCheckShape = GetOperations()->GetEngine()->GetObject
1363 (theShape->GetStudyID(), theCheckShape->GetEntry());
1365 if (aShape.IsNull() || aCheckShape.IsNull() )
1366 return aGEOMObject._retn();
1368 //Get Shapes On Shape
1369 Handle(GEOM_Object) anObject = GetOperations()->GetShapesOnShapeAsCompound
1370 (aCheckShape,aShape, theShapeType,ShapeState(theState));
1372 if (anObject.IsNull())
1373 return aGEOMObject._retn();
1375 return GetObject(anObject);
1379 //=============================================================================
1381 * GetShapesOnShapeIDs
1383 //=============================================================================
1384 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnShapeIDs
1385 (GEOM::GEOM_Object_ptr theCheckShape,
1386 GEOM::GEOM_Object_ptr theShape,
1387 CORBA::Short theShapeType,
1388 GEOM::shape_state theState)
1390 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1392 //Set a not done flag
1393 GetOperations()->SetNotDone();
1395 if ( theShape == NULL || theCheckShape == NULL )
1396 return aSeq._retn();
1398 //Get the reference objects
1399 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
1400 (theShape->GetStudyID(), theShape->GetEntry());
1401 Handle(GEOM_Object) aCheckShape = GetOperations()->GetEngine()->GetObject
1402 (theShape->GetStudyID(), theCheckShape->GetEntry());
1404 if (aShape.IsNull() || aCheckShape.IsNull() )
1405 return aSeq._retn();
1407 //Get Shapes On Shape
1408 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnShapeIDs
1409 (aCheckShape,aShape, theShapeType,ShapeState(theState));
1410 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1411 return aSeq._retn();
1413 Standard_Integer aLength = aHSeq->Length();
1414 aSeq->length(aLength);
1415 for (Standard_Integer i = 1; i <= aLength; i++)
1416 aSeq[i-1] = aHSeq->Value(i);
1418 return aSeq._retn();
1422 //=============================================================================
1426 //=============================================================================
1427 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlace
1428 (GEOM::GEOM_Object_ptr theShapeWhere,
1429 GEOM::GEOM_Object_ptr theShapeWhat)
1431 GEOM::GEOM_Object_var aGEOMObject;
1433 //Set a not done flag
1434 GetOperations()->SetNotDone();
1436 if (theShapeWhere == NULL ||
1437 theShapeWhat == NULL) return aGEOMObject._retn();
1439 //Get the reference objects
1440 Handle(GEOM_Object) aShapeWhere = GetOperations()->GetEngine()->GetObject
1441 (theShapeWhere->GetStudyID(), theShapeWhere->GetEntry());
1442 Handle(GEOM_Object) aShapeWhat = GetOperations()->GetEngine()->GetObject
1443 (theShapeWhat->GetStudyID(), theShapeWhat->GetEntry());
1445 if (aShapeWhere.IsNull() ||
1446 aShapeWhat.IsNull()) return aGEOMObject._retn();
1448 //Get Shapes in place of aShapeWhat
1449 Handle(GEOM_Object) anObject =
1450 GetOperations()->GetInPlace(aShapeWhere, aShapeWhat);
1451 if (!GetOperations()->IsDone() || anObject.IsNull())
1452 return aGEOMObject._retn();
1454 return GetObject(anObject);
1457 //=============================================================================
1459 * GetInPlaceByHistory
1461 //=============================================================================
1462 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlaceByHistory
1463 (GEOM::GEOM_Object_ptr theShapeWhere,
1464 GEOM::GEOM_Object_ptr theShapeWhat)
1466 GEOM::GEOM_Object_var aGEOMObject;
1468 //Set a not done flag
1469 GetOperations()->SetNotDone();
1471 if (theShapeWhere == NULL ||
1472 theShapeWhat == NULL) return aGEOMObject._retn();
1474 //Get the reference objects
1475 Handle(GEOM_Object) aShapeWhere = GetOperations()->GetEngine()->GetObject
1476 (theShapeWhere->GetStudyID(), theShapeWhere->GetEntry());
1477 Handle(GEOM_Object) aShapeWhat = GetOperations()->GetEngine()->GetObject
1478 (theShapeWhat->GetStudyID(), theShapeWhat->GetEntry());
1480 if (aShapeWhere.IsNull() ||
1481 aShapeWhat.IsNull()) return aGEOMObject._retn();
1483 //Get Shapes in place of aShapeWhat
1484 Handle(GEOM_Object) anObject =
1485 GetOperations()->GetInPlaceByHistory(aShapeWhere, aShapeWhat);
1486 if (!GetOperations()->IsDone() || anObject.IsNull())
1487 return aGEOMObject._retn();
1489 return GetObject(anObject);
1492 //=============================================================================
1496 //=============================================================================
1497 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetSame
1498 (GEOM::GEOM_Object_ptr theShapeWhere,
1499 GEOM::GEOM_Object_ptr theShapeWhat)
1501 GEOM::GEOM_Object_var aGEOMObject;
1503 //Set a not done flag
1504 GetOperations()->SetNotDone();
1506 if (theShapeWhere == NULL ||
1507 theShapeWhat == NULL) return aGEOMObject._retn();
1509 //Get the reference objects
1510 Handle(GEOM_Object) aShapeWhere = GetOperations()->GetEngine()->GetObject
1511 (theShapeWhere->GetStudyID(), theShapeWhere->GetEntry());
1512 Handle(GEOM_Object) aShapeWhat = GetOperations()->GetEngine()->GetObject
1513 (theShapeWhat->GetStudyID(), theShapeWhat->GetEntry());
1515 if (aShapeWhere.IsNull() ||
1516 aShapeWhat.IsNull()) return aGEOMObject._retn();
1518 //Get Shapes in place of aShapeWhat
1519 Handle(GEOM_Object) anObject =
1520 GetOperations()->GetSame(aShapeWhere, aShapeWhat);
1521 if (!GetOperations()->IsDone() || anObject.IsNull())
1522 return aGEOMObject._retn();
1524 return GetObject(anObject);