1 // Copyright (C) 2007-2010 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"
34 #include <TColStd_HSequenceOfTransient.hxx>
35 #include <TColStd_HArray1OfInteger.hxx>
37 //=============================================================================
41 //=============================================================================
42 GEOM_IShapesOperations_i::GEOM_IShapesOperations_i (PortableServer::POA_ptr thePOA,
43 GEOM::GEOM_Gen_ptr theEngine,
44 ::GEOMImpl_IShapesOperations* theImpl)
45 :GEOM_IOperations_i(thePOA, theEngine, theImpl)
47 MESSAGE("GEOM_IShapesOperations_i::GEOM_IShapesOperations_i");
50 //=============================================================================
54 //=============================================================================
55 GEOM_IShapesOperations_i::~GEOM_IShapesOperations_i()
57 MESSAGE("GEOM_IShapesOperations_i::~GEOM_IShapesOperations_i");
61 //=============================================================================
65 //=============================================================================
66 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeEdge
67 (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2)
69 GEOM::GEOM_Object_var aGEOMObject;
72 GetOperations()->SetNotDone();
74 //Get the reference points
75 Handle(GEOM_Object) aPnt1 = GetObjectImpl(thePnt1);
76 Handle(GEOM_Object) aPnt2 = GetObjectImpl(thePnt2);
78 if (aPnt1.IsNull() || aPnt2.IsNull()) return aGEOMObject._retn();
81 Handle(GEOM_Object) anObject = GetOperations()->MakeEdge(aPnt1, aPnt2);
82 if (!GetOperations()->IsDone() || anObject.IsNull())
83 return aGEOMObject._retn();
85 return GetObject(anObject);
88 //=============================================================================
92 //=============================================================================
93 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeWire
94 (const GEOM::ListOfGO& theEdgesAndWires,
95 const CORBA::Double theTolerance)
97 GEOM::GEOM_Object_var aGEOMObject;
100 GetOperations()->SetNotDone();
103 std::list<Handle(GEOM_Object)> aShapes;
106 aLen = theEdgesAndWires.length();
107 for (ind = 0; ind < aLen; ind++) {
108 Handle(GEOM_Object) aSh = GetObjectImpl(theEdgesAndWires[ind]);
109 if (aSh.IsNull()) return aGEOMObject._retn();
110 aShapes.push_back(aSh);
114 Handle(GEOM_Object) anObject =
115 GetOperations()->MakeWire(aShapes, theTolerance);
116 if (!GetOperations()->IsDone() || anObject.IsNull())
117 return aGEOMObject._retn();
119 return GetObject(anObject);
122 //=============================================================================
126 //=============================================================================
127 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeFace
128 (GEOM::GEOM_Object_ptr theWire,
129 const CORBA::Boolean isPlanarWanted)
131 GEOM::GEOM_Object_var aGEOMObject;
133 //Set a not done flag
134 GetOperations()->SetNotDone();
136 //Get the reference wire
137 Handle(GEOM_Object) aWire = GetObjectImpl(theWire);
138 if (aWire.IsNull()) return aGEOMObject._retn();
141 Handle(GEOM_Object) anObject = GetOperations()->MakeFace(aWire, isPlanarWanted);
142 if (!GetOperations()->IsDone() || anObject.IsNull())
143 return aGEOMObject._retn();
145 return GetObject(anObject);
148 //=============================================================================
152 //=============================================================================
153 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeFaceWires
154 (const GEOM::ListOfGO& theWires,
155 const CORBA::Boolean isPlanarWanted)
157 GEOM::GEOM_Object_var aGEOMObject;
159 //Set a not done flag
160 GetOperations()->SetNotDone();
163 std::list<Handle(GEOM_Object)> aShapes;
166 aLen = theWires.length();
167 for (ind = 0; ind < aLen; ind++) {
168 Handle(GEOM_Object) aSh = GetObjectImpl(theWires[ind]);
169 if (aSh.IsNull()) return aGEOMObject._retn();
170 aShapes.push_back(aSh);
174 Handle(GEOM_Object) anObject =
175 GetOperations()->MakeFaceWires(aShapes, isPlanarWanted);
176 if (!GetOperations()->IsDone() || anObject.IsNull())
177 return aGEOMObject._retn();
179 return GetObject(anObject);
182 //=============================================================================
186 //=============================================================================
187 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeShell
188 (const GEOM::ListOfGO& theFacesAndShells)
190 GEOM::GEOM_Object_var aGEOMObject;
192 //Set a not done flag
193 GetOperations()->SetNotDone();
196 std::list<Handle(GEOM_Object)> aShapes;
199 aLen = theFacesAndShells.length();
200 for (ind = 0; ind < aLen; ind++) {
201 Handle(GEOM_Object) aSh = GetObjectImpl(theFacesAndShells[ind]);
202 if (aSh.IsNull()) return aGEOMObject._retn();
203 aShapes.push_back(aSh);
207 Handle(GEOM_Object) anObject =
208 GetOperations()->MakeShell(aShapes);
209 if (!GetOperations()->IsDone() || anObject.IsNull())
210 return aGEOMObject._retn();
212 return GetObject(anObject);
215 //=============================================================================
219 //=============================================================================
220 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeSolidShell
221 (GEOM::GEOM_Object_ptr theShell)
223 GEOM::GEOM_Object_var aGEOMObject;
225 //Set a not done flag
226 GetOperations()->SetNotDone();
228 //Get the reference objects
229 Handle(GEOM_Object) aShell = GetObjectImpl(theShell);
230 if (aShell.IsNull()) return aGEOMObject._retn();
233 Handle(GEOM_Object) anObject = GetOperations()->MakeSolidShell(aShell);
234 if (!GetOperations()->IsDone() || anObject.IsNull())
235 return aGEOMObject._retn();
237 return GetObject(anObject);
240 //=============================================================================
244 //=============================================================================
245 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeSolidShells
246 (const GEOM::ListOfGO& theShells)
248 GEOM::GEOM_Object_var aGEOMObject;
250 //Set a not done flag
251 GetOperations()->SetNotDone();
254 std::list<Handle(GEOM_Object)> aShapes;
257 aLen = theShells.length();
258 for (ind = 0; ind < aLen; ind++) {
259 Handle(GEOM_Object) aSh = GetObjectImpl(theShells[ind]);
260 if (aSh.IsNull()) return aGEOMObject._retn();
261 aShapes.push_back(aSh);
265 Handle(GEOM_Object) anObject =
266 GetOperations()->MakeSolidShells(aShapes);
267 if (!GetOperations()->IsDone() || anObject.IsNull())
268 return aGEOMObject._retn();
270 return GetObject(anObject);
273 //=============================================================================
277 //=============================================================================
278 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeCompound
279 (const GEOM::ListOfGO& theShapes)
281 GEOM::GEOM_Object_var aGEOMObject;
283 //Set a not done flag
284 GetOperations()->SetNotDone();
287 std::list<Handle(GEOM_Object)> aShapes;
290 aLen = theShapes.length();
291 for (ind = 0; ind < aLen; ind++) {
292 Handle(GEOM_Object) aSh = GetObjectImpl(theShapes[ind]);
293 if (aSh.IsNull()) return aGEOMObject._retn();
294 aShapes.push_back(aSh);
298 Handle(GEOM_Object) anObject =
299 GetOperations()->MakeCompound(aShapes);
300 if (!GetOperations()->IsDone() || anObject.IsNull())
301 return aGEOMObject._retn();
303 return GetObject(anObject);
306 //=============================================================================
310 //=============================================================================
311 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFaces
312 (GEOM::GEOM_Object_ptr theShape,
313 CORBA::Double theTolerance,
314 CORBA::Boolean doKeepNonSolids)
316 GEOM::GEOM_Object_var aGEOMObject;
318 //Set a not done flag
319 GetOperations()->SetNotDone();
321 //Get the reference objects
322 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
323 if (aShape.IsNull()) return aGEOMObject._retn();
326 Handle(GEOM_Object) anObject =
327 GetOperations()->MakeGlueFaces(aShape, theTolerance, doKeepNonSolids);
328 //if (!GetOperations()->IsDone() || anObject.IsNull())
330 if (anObject.IsNull())
331 return aGEOMObject._retn();
333 return GetObject(anObject);
337 //=============================================================================
341 //=============================================================================
342 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetGlueFaces
343 (GEOM::GEOM_Object_ptr theShape,
344 const CORBA::Double theTolerance)
346 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
348 //Set a not done flag
349 GetOperations()->SetNotDone();
351 //Get the reference objects
352 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
353 if (aShape.IsNull()) return aSeq._retn();
355 Handle(TColStd_HSequenceOfTransient) aHSeq =
356 GetOperations()->GetGlueFaces(aShape, theTolerance);
358 //if (!GetOperations()->IsDone() || aHSeq.IsNull())
363 Standard_Integer aLength = aHSeq->Length();
364 aSeq->length(aLength);
365 for (Standard_Integer i = 1; i <= aLength; i++)
366 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
372 //=============================================================================
374 * MakeGlueFacesByList
376 //=============================================================================
377 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFacesByList
378 (GEOM::GEOM_Object_ptr theShape,
379 CORBA::Double theTolerance,
380 const GEOM::ListOfGO& theFaces,
381 CORBA::Boolean doKeepNonSolids)
383 GEOM::GEOM_Object_var aGEOMObject;
385 //Set a not done flag
386 GetOperations()->SetNotDone();
388 //Get the reference objects
389 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
390 if (aShape.IsNull()) return aGEOMObject._retn();
393 std::list<Handle(GEOM_Object)> aFaces;
395 aLen = theFaces.length();
396 for (ind = 0; ind < aLen; ind++) {
397 Handle(GEOM_Object) aSh = GetObjectImpl(theFaces[ind]);
398 if (aSh.IsNull()) return aGEOMObject._retn();
399 aFaces.push_back(aSh);
403 Handle(GEOM_Object) anObject =
404 GetOperations()->MakeGlueFacesByList(aShape, theTolerance, aFaces, doKeepNonSolids);
405 //if (!GetOperations()->IsDone() || anObject.IsNull())
407 if (anObject.IsNull())
408 return aGEOMObject._retn();
410 return GetObject(anObject);
413 //=============================================================================
417 //=============================================================================
418 GEOM::ListOfGO* GEOM_IShapesOperations_i::MakeExplode (GEOM::GEOM_Object_ptr theShape,
419 const CORBA::Long theShapeType,
420 const CORBA::Boolean isSorted)
422 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
424 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
425 if (aShape.IsNull()) return aSeq._retn();
427 Handle(TColStd_HSequenceOfTransient) aHSeq =
428 GetOperations()->MakeExplode(aShape, theShapeType, isSorted, Standard_True);
429 if (!GetOperations()->IsDone() || aHSeq.IsNull())
432 Standard_Integer aLength = aHSeq->Length();
433 aSeq->length(aLength);
434 for (Standard_Integer i = 1; i <= aLength; i++)
435 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
440 //=============================================================================
444 //=============================================================================
445 GEOM::ListOfGO* GEOM_IShapesOperations_i::MakeAllSubShapes (GEOM::GEOM_Object_ptr theShape,
446 const CORBA::Long theShapeType,
447 const CORBA::Boolean isSorted)
449 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
451 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
452 if (aShape.IsNull()) return aSeq._retn();
454 Handle(TColStd_HSequenceOfTransient) aHSeq =
455 GetOperations()->MakeExplode(aShape, theShapeType, isSorted, Standard_False);
456 if (!GetOperations()->IsDone() || aHSeq.IsNull())
459 Standard_Integer aLength = aHSeq->Length();
460 aSeq->length(aLength);
461 for (Standard_Integer i = 1; i <= aLength; i++)
462 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
467 //=============================================================================
471 //=============================================================================
472 GEOM::ListOfLong* GEOM_IShapesOperations_i::SubShapeAllIDs (GEOM::GEOM_Object_ptr theShape,
473 const CORBA::Long theShapeType,
474 const CORBA::Boolean isSorted)
476 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
478 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
479 if (aShape.IsNull()) return aSeq._retn();
481 Handle(TColStd_HSequenceOfInteger) aHSeq =
482 GetOperations()->SubShapeAllIDs(aShape, theShapeType, isSorted, Standard_True);
483 if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
485 Standard_Integer aLength = aHSeq->Length();
486 aSeq->length(aLength);
487 for (Standard_Integer i = 1; i <= aLength; i++)
488 aSeq[i-1] = aHSeq->Value(i);
493 //=============================================================================
497 //=============================================================================
498 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetAllSubShapesIDs (GEOM::GEOM_Object_ptr theShape,
499 const CORBA::Long theShapeType,
500 const CORBA::Boolean isSorted)
502 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
504 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
505 if (aShape.IsNull()) return aSeq._retn();
507 Handle(TColStd_HSequenceOfInteger) aHSeq =
508 GetOperations()->SubShapeAllIDs(aShape, theShapeType, isSorted, Standard_False);
509 if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
511 Standard_Integer aLength = aHSeq->Length();
512 aSeq->length(aLength);
513 for (Standard_Integer i = 1; i <= aLength; i++)
514 aSeq[i-1] = aHSeq->Value(i);
519 //=============================================================================
523 //=============================================================================
524 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetSubShape
525 (GEOM::GEOM_Object_ptr theMainShape,
526 const CORBA::Long theID)
528 GEOM::GEOM_Object_var aGEOMObject;
530 //Set a not done flag
531 GetOperations()->SetNotDone();
533 //Get the reference objects
534 Handle(GEOM_Object) aShape = GetObjectImpl(theMainShape);
535 if (aShape.IsNull()) return aGEOMObject._retn();
537 Handle(GEOM_Object) anObject = GetOperations()->GetSubShape(aShape, theID);
538 if (!GetOperations()->IsDone() || anObject.IsNull())
539 return aGEOMObject._retn();
541 return GetObject(anObject);
544 //=============================================================================
548 //=============================================================================
549 CORBA::Long GEOM_IShapesOperations_i::GetSubShapeIndex
550 (GEOM::GEOM_Object_ptr theMainShape, GEOM::GEOM_Object_ptr theSubShape)
552 //Get the reference shapes
553 Handle(GEOM_Object) aMainShapeRef = GetObjectImpl(theMainShape);
554 Handle(GEOM_Object) aSubShapeRef = GetObjectImpl(theSubShape);
556 if (aMainShapeRef.IsNull() || aSubShapeRef.IsNull()) return -1;
558 //Get the unique ID of <theSubShape> inside <theMainShape>
559 CORBA::Long anID = GetOperations()->GetSubShapeIndex(aMainShapeRef, aSubShapeRef);
560 if (!GetOperations()->IsDone())
566 //=============================================================================
570 //=============================================================================
571 CORBA::Long GEOM_IShapesOperations_i::GetTopologyIndex
572 (GEOM::GEOM_Object_ptr theMainShape, GEOM::GEOM_Object_ptr theSubShape)
574 //Get the reference shapes
575 Handle(GEOM_Object) aMainShapeRef = GetObjectImpl(theMainShape);
576 Handle(GEOM_Object) aSubShapeRef = GetObjectImpl(theSubShape);
578 if (aMainShapeRef.IsNull() || aSubShapeRef.IsNull()) return -1;
580 //Get an ID of <theSubShape>, unique among all sub-shapes of <theMainShape> of the same type
581 CORBA::Long anID = GetOperations()->GetTopologyIndex(aMainShapeRef, aSubShapeRef);
582 if (!GetOperations()->IsDone())
588 //=============================================================================
592 //=============================================================================
593 char* GEOM_IShapesOperations_i::GetShapeTypeString (GEOM::GEOM_Object_ptr theShape)
595 //Get the reference shape
596 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
597 if (aShape.IsNull()) return NULL;
599 // Get shape parameters
600 TCollection_AsciiString aDescription = GetOperations()->GetShapeTypeString(aShape);
601 return CORBA::string_dup(aDescription.ToCString());
604 //=============================================================================
608 //=============================================================================
609 CORBA::Long GEOM_IShapesOperations_i::NumberOfFaces (GEOM::GEOM_Object_ptr theShape)
611 return NumberOfSubShapes(theShape, Standard_Integer(TopAbs_FACE));
614 //=============================================================================
618 //=============================================================================
619 CORBA::Long GEOM_IShapesOperations_i::NumberOfEdges (GEOM::GEOM_Object_ptr theShape)
621 return NumberOfSubShapes(theShape, Standard_Integer(TopAbs_EDGE));
624 //=============================================================================
628 //=============================================================================
629 CORBA::Long GEOM_IShapesOperations_i::NumberOfSubShapes (GEOM::GEOM_Object_ptr theShape,
630 const CORBA::Long theShapeType)
632 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
633 if (aShape.IsNull()) return -1;
635 CORBA::Long aNb = GetOperations()->NumberOfSubShapes(aShape, theShapeType);
636 if (!GetOperations()->IsDone()) return -1;
641 //=============================================================================
645 //=============================================================================
646 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::ChangeOrientation
647 (GEOM::GEOM_Object_ptr theShape)
649 GEOM::GEOM_Object_var aGEOMObject;
651 //Set a not done flag
652 GetOperations()->SetNotDone();
654 //Get the reference objects
655 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
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;
678 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
679 if (aShape.IsNull()) return aSeq._retn();
681 Handle(TColStd_HSequenceOfInteger) aHSeq =
682 GetOperations()->GetFreeFacesIDs(aShape);
683 if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
685 Standard_Integer aLength = aHSeq->Length();
686 aSeq->length(aLength);
687 for (Standard_Integer i = 1; i <= aLength; i++)
688 aSeq[i-1] = aHSeq->Value(i);
693 //=============================================================================
697 //=============================================================================
698 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSharedShapes
699 (GEOM::GEOM_Object_ptr theShape1,
700 GEOM::GEOM_Object_ptr theShape2,
701 const CORBA::Long theShapeType)
703 //Set a not done flag
704 GetOperations()->SetNotDone();
706 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
708 Handle(GEOM_Object) aShape1 = GetObjectImpl(theShape1);
709 Handle(GEOM_Object) aShape2 = GetObjectImpl(theShape2);
711 if (aShape1.IsNull() || aShape2.IsNull()) return aSeq._retn();
713 Handle(TColStd_HSequenceOfTransient) aHSeq =
714 GetOperations()->GetSharedShapes(aShape1, aShape2, theShapeType);
715 if (!GetOperations()->IsDone() || aHSeq.IsNull())
718 Standard_Integer aLength = aHSeq->Length();
719 aSeq->length(aLength);
720 for (Standard_Integer i = 1; i <= aLength; i++)
721 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
726 //=============================================================================
728 * GetSharedShapesMulti
730 //=============================================================================
731 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSharedShapesMulti
732 (const GEOM::ListOfGO& theShapes,
733 const CORBA::Long theShapeType)
735 //Set a not done flag
736 GetOperations()->SetNotDone();
738 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
741 std::list<Handle(GEOM_Object)> aShapes;
742 int aLen = theShapes.length();
743 for (int ind = 0; ind < aLen; ind++) {
744 Handle(GEOM_Object) aSh = GetObjectImpl(theShapes[ind]);
745 if (aSh.IsNull()) return aSeq._retn();
746 aShapes.push_back(aSh);
749 Handle(TColStd_HSequenceOfTransient) aHSeq =
750 GetOperations()->GetSharedShapes(aShapes, theShapeType);
751 if (!GetOperations()->IsDone() || aHSeq.IsNull())
754 Standard_Integer aLength = aHSeq->Length();
755 aSeq->length(aLength);
756 for (Standard_Integer i = 1; i <= aLength; i++)
757 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
762 static GEOMAlgo_State ShapeState (const GEOM::shape_state theState)
764 GEOMAlgo_State aState = GEOMAlgo_ST_UNKNOWN;
768 aState = GEOMAlgo_ST_ON;
771 aState = GEOMAlgo_ST_OUT;
774 aState = GEOMAlgo_ST_ONOUT;
777 aState = GEOMAlgo_ST_IN;
780 aState = GEOMAlgo_ST_ONIN;
789 //=============================================================================
793 //=============================================================================
794 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnPlane
795 (GEOM::GEOM_Object_ptr theShape,
796 const CORBA::Long theShapeType,
797 GEOM::GEOM_Object_ptr theAx1,
798 const GEOM::shape_state theState)
800 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
802 //Set a not done flag
803 GetOperations()->SetNotDone();
805 //Get the reference objects
806 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
807 Handle(GEOM_Object) anAx1 = GetObjectImpl(theAx1);
809 if (aShape.IsNull() || anAx1.IsNull()) return aSeq._retn();
811 //Get Shapes On Plane
812 Handle(TColStd_HSequenceOfTransient) aHSeq =
813 GetOperations()->GetShapesOnPlane(aShape, theShapeType, anAx1, ShapeState(theState));
814 if (!GetOperations()->IsDone() || aHSeq.IsNull())
817 Standard_Integer aLength = aHSeq->Length();
818 aSeq->length(aLength);
819 for (Standard_Integer i = 1; i <= aLength; i++)
820 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
825 //=============================================================================
827 * GetShapesOnPlaneWithLocation
829 //=============================================================================
830 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnPlaneWithLocation
831 (GEOM::GEOM_Object_ptr theShape,
832 const CORBA::Long theShapeType,
833 GEOM::GEOM_Object_ptr theAx1,
834 GEOM::GEOM_Object_ptr thePnt,
835 const GEOM::shape_state theState)
837 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
839 //Set a not done flag
840 GetOperations()->SetNotDone();
842 //Get the reference objects
843 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
844 Handle(GEOM_Object) anAx1 = GetObjectImpl(theAx1);
845 Handle(GEOM_Object) anPnt = GetObjectImpl(thePnt);
847 if (aShape.IsNull() || anAx1.IsNull() || anPnt.IsNull()) return aSeq._retn();
849 //Get Shapes On Plane
850 Handle(TColStd_HSequenceOfTransient) aHSeq =
851 GetOperations()->GetShapesOnPlaneWithLocation(aShape, theShapeType, anAx1, anPnt, ShapeState(theState));
852 if (!GetOperations()->IsDone() || aHSeq.IsNull())
855 Standard_Integer aLength = aHSeq->Length();
856 aSeq->length(aLength);
857 for (Standard_Integer i = 1; i <= aLength; i++)
858 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
863 //=============================================================================
865 * GetShapesOnCylinder
867 //=============================================================================
868 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnCylinder
869 (GEOM::GEOM_Object_ptr theShape,
870 const CORBA::Long theShapeType,
871 GEOM::GEOM_Object_ptr theAxis,
872 const CORBA::Double theRadius,
873 const GEOM::shape_state theState)
875 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
877 //Set a not done flag
878 GetOperations()->SetNotDone();
880 //Get the reference objects
881 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
882 Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
884 if (aShape.IsNull() || anAxis.IsNull()) return aSeq._retn();
886 //Get Shapes On Cylinder
887 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnCylinder
888 (aShape, theShapeType, anAxis, theRadius, ShapeState(theState));
889 if (!GetOperations()->IsDone() || aHSeq.IsNull())
892 Standard_Integer aLength = aHSeq->Length();
893 aSeq->length(aLength);
894 for (Standard_Integer i = 1; i <= aLength; i++)
895 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
900 //=============================================================================
902 * GetShapesOnCylinderWithLocation
904 //=============================================================================
905 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnCylinderWithLocation
906 (GEOM::GEOM_Object_ptr theShape,
907 const CORBA::Long theShapeType,
908 GEOM::GEOM_Object_ptr theAxis,
909 GEOM::GEOM_Object_ptr thePnt,
910 const CORBA::Double theRadius,
911 const GEOM::shape_state theState)
913 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
915 //Set a not done flag
916 GetOperations()->SetNotDone();
918 //Get the reference objects
919 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
920 Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
921 Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
923 if (aShape.IsNull() || anAxis.IsNull() || aPnt.IsNull()) return aSeq._retn();
925 //Get Shapes On Cylinder
926 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnCylinderWithLocation
927 (aShape, theShapeType, anAxis, aPnt, theRadius, ShapeState(theState));
928 if (!GetOperations()->IsDone() || aHSeq.IsNull())
931 Standard_Integer aLength = aHSeq->Length();
932 aSeq->length(aLength);
933 for (Standard_Integer i = 1; i <= aLength; i++)
934 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
939 //=============================================================================
943 //=============================================================================
944 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnSphere
945 (GEOM::GEOM_Object_ptr theShape,
946 const CORBA::Long theShapeType,
947 GEOM::GEOM_Object_ptr theCenter,
948 const CORBA::Double theRadius,
949 const GEOM::shape_state theState)
951 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
953 //Set a not done flag
954 GetOperations()->SetNotDone();
956 //Get the reference objects
957 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
958 Handle(GEOM_Object) aCenter = GetObjectImpl(theCenter);
960 if (aShape.IsNull() || aCenter.IsNull()) return aSeq._retn();
962 //Get Shapes On Sphere
963 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnSphere
964 (aShape, theShapeType, aCenter, theRadius, ShapeState(theState));
965 if (!GetOperations()->IsDone() || aHSeq.IsNull())
968 Standard_Integer aLength = aHSeq->Length();
969 aSeq->length(aLength);
970 for (Standard_Integer i = 1; i <= aLength; i++)
971 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
976 //=============================================================================
978 * GetShapesOnQuadrangle
980 //=============================================================================
981 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnQuadrangle
982 (GEOM::GEOM_Object_ptr theShape,
983 CORBA::Long theShapeType,
984 GEOM::GEOM_Object_ptr theTopLeftPoint,
985 GEOM::GEOM_Object_ptr theTopRigthPoint,
986 GEOM::GEOM_Object_ptr theBottomLeftPoint,
987 GEOM::GEOM_Object_ptr theBottomRigthPoint,
988 GEOM::shape_state theState)
990 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
992 //Set a not done flag
993 GetOperations()->SetNotDone();
995 //Get the reference objects
996 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
997 Handle(GEOM_Object) aTopLeftPoint = GetObjectImpl(theTopLeftPoint);
998 Handle(GEOM_Object) aTopRigthPoint = GetObjectImpl(theTopRigthPoint);
999 Handle(GEOM_Object) aBottomLeftPoint = GetObjectImpl(theBottomLeftPoint);
1000 Handle(GEOM_Object) aBottomRigthPoint = GetObjectImpl(theBottomRigthPoint);
1002 if (aShape.IsNull() ||
1003 aTopLeftPoint.IsNull() ||
1004 aTopRigthPoint.IsNull() ||
1005 aBottomLeftPoint.IsNull() ||
1006 aBottomRigthPoint.IsNull())
1007 return aSeq._retn();
1009 //Get Shapes On Quadrangle
1010 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnQuadrangle
1011 (aShape, theShapeType,
1012 aTopLeftPoint, aTopRigthPoint, aBottomLeftPoint, aBottomRigthPoint,
1013 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] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1022 return aSeq._retn();
1025 //=============================================================================
1027 * GetShapesOnPlaneIDs
1029 //=============================================================================
1030 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnPlaneIDs
1031 (GEOM::GEOM_Object_ptr theShape,
1032 const CORBA::Long theShapeType,
1033 GEOM::GEOM_Object_ptr theAx1,
1034 const GEOM::shape_state theState)
1036 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1038 //Set a not done flag
1039 GetOperations()->SetNotDone();
1041 //Get the reference objects
1042 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1043 Handle(GEOM_Object) anAx1 = GetObjectImpl(theAx1);
1045 if (aShape.IsNull() || anAx1.IsNull()) return aSeq._retn();
1047 //Get Shapes On Plane
1048 Handle(TColStd_HSequenceOfInteger) aHSeq =
1049 GetOperations()->GetShapesOnPlaneIDs(aShape, theShapeType, anAx1, ShapeState(theState));
1050 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1051 return aSeq._retn();
1053 Standard_Integer aLength = aHSeq->Length();
1054 aSeq->length(aLength);
1055 for (Standard_Integer i = 1; i <= aLength; i++)
1056 aSeq[i-1] = aHSeq->Value(i);
1058 return aSeq._retn();
1061 //=============================================================================
1063 * GetShapesOnPlaneWithLocationIDs
1065 //=============================================================================
1066 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnPlaneWithLocationIDs
1067 (GEOM::GEOM_Object_ptr theShape,
1068 const CORBA::Long theShapeType,
1069 GEOM::GEOM_Object_ptr theAx1,
1070 GEOM::GEOM_Object_ptr thePnt,
1071 const GEOM::shape_state theState)
1073 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1075 //Set a not done flag
1076 GetOperations()->SetNotDone();
1078 //Get the reference objects
1079 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1080 Handle(GEOM_Object) anAx1 = GetObjectImpl(theAx1);
1081 Handle(GEOM_Object) anPnt = GetObjectImpl(thePnt);
1083 if (aShape.IsNull() || anAx1.IsNull() || anPnt.IsNull()) return aSeq._retn();
1085 //Get Shapes On Plane
1086 Handle(TColStd_HSequenceOfInteger) aHSeq =
1087 GetOperations()->GetShapesOnPlaneWithLocationIDs(aShape, theShapeType,
1088 anAx1, anPnt, ShapeState(theState));
1089 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1090 return aSeq._retn();
1092 Standard_Integer aLength = aHSeq->Length();
1093 aSeq->length(aLength);
1094 for (Standard_Integer i = 1; i <= aLength; i++)
1095 aSeq[i-1] = aHSeq->Value(i);
1097 return aSeq._retn();
1100 //=============================================================================
1102 * GetShapesOnCylinderIDs
1104 //=============================================================================
1105 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnCylinderIDs
1106 (GEOM::GEOM_Object_ptr theShape,
1107 const CORBA::Long theShapeType,
1108 GEOM::GEOM_Object_ptr theAxis,
1109 const CORBA::Double theRadius,
1110 const GEOM::shape_state theState)
1112 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1114 //Set a not done flag
1115 GetOperations()->SetNotDone();
1117 //Get the reference objects
1118 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1119 Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
1121 if (aShape.IsNull() || anAxis.IsNull()) return aSeq._retn();
1123 //Get Shapes On Cylinder
1124 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnCylinderIDs
1125 (aShape, theShapeType, anAxis, theRadius, ShapeState(theState));
1126 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1127 return aSeq._retn();
1129 Standard_Integer aLength = aHSeq->Length();
1130 aSeq->length(aLength);
1131 for (Standard_Integer i = 1; i <= aLength; i++)
1132 aSeq[i-1] = aHSeq->Value(i);
1134 return aSeq._retn();
1137 //=============================================================================
1139 * GetShapesOnCylinderWithLocationIDs
1141 //=============================================================================
1142 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnCylinderWithLocationIDs
1143 (GEOM::GEOM_Object_ptr theShape,
1144 const CORBA::Long theShapeType,
1145 GEOM::GEOM_Object_ptr theAxis,
1146 GEOM::GEOM_Object_ptr thePnt,
1147 const CORBA::Double theRadius,
1148 const GEOM::shape_state theState)
1150 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1152 //Set a not done flag
1153 GetOperations()->SetNotDone();
1155 //Get the reference objects
1156 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1157 Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
1158 Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
1160 if (aShape.IsNull() || anAxis.IsNull() || aPnt.IsNull()) return aSeq._retn();
1162 //Get Shapes On Cylinder
1163 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnCylinderWithLocationIDs
1164 (aShape, theShapeType, anAxis, aPnt, theRadius, ShapeState(theState));
1165 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1166 return aSeq._retn();
1168 Standard_Integer aLength = aHSeq->Length();
1169 aSeq->length(aLength);
1170 for (Standard_Integer i = 1; i <= aLength; i++)
1171 aSeq[i-1] = aHSeq->Value(i);
1173 return aSeq._retn();
1176 //=============================================================================
1178 * GetShapesOnSphereIDs
1180 //=============================================================================
1181 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnSphereIDs
1182 (GEOM::GEOM_Object_ptr theShape,
1183 const CORBA::Long theShapeType,
1184 GEOM::GEOM_Object_ptr theCenter,
1185 const CORBA::Double theRadius,
1186 const GEOM::shape_state theState)
1188 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1190 //Set a not done flag
1191 GetOperations()->SetNotDone();
1193 //Get the reference objects
1194 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1195 Handle(GEOM_Object) aCenter = GetObjectImpl(theCenter);
1197 if (aShape.IsNull() || aCenter.IsNull()) return aSeq._retn();
1199 //Get Shapes On Sphere
1200 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnSphereIDs
1201 (aShape, theShapeType, aCenter, theRadius, ShapeState(theState));
1202 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1203 return aSeq._retn();
1205 Standard_Integer aLength = aHSeq->Length();
1206 aSeq->length(aLength);
1207 for (Standard_Integer i = 1; i <= aLength; i++)
1208 aSeq[i-1] = aHSeq->Value(i);
1210 return aSeq._retn();
1213 //=============================================================================
1215 * GetShapesOnQuadrangleIDs
1217 //=============================================================================
1218 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnQuadrangleIDs
1219 (GEOM::GEOM_Object_ptr theShape,
1220 CORBA::Long theShapeType,
1221 GEOM::GEOM_Object_ptr theTopLeftPoint,
1222 GEOM::GEOM_Object_ptr theTopRigthPoint,
1223 GEOM::GEOM_Object_ptr theBottomLeftPoint,
1224 GEOM::GEOM_Object_ptr theBottomRigthPoint,
1225 GEOM::shape_state theState)
1227 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1229 //Set a not done flag
1230 GetOperations()->SetNotDone();
1232 //Get the reference objects
1233 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1234 Handle(GEOM_Object) aTopLeftPoint = GetObjectImpl(theTopLeftPoint);
1235 Handle(GEOM_Object) aTopRigthPoint = GetObjectImpl(theTopRigthPoint);
1236 Handle(GEOM_Object) aBottomLeftPoint = GetObjectImpl(theBottomLeftPoint);
1237 Handle(GEOM_Object) aBottomRigthPoint = GetObjectImpl(theBottomRigthPoint);
1239 if (aShape.IsNull() ||
1240 aTopLeftPoint.IsNull() ||
1241 aTopRigthPoint.IsNull() ||
1242 aBottomLeftPoint.IsNull() ||
1243 aBottomRigthPoint.IsNull() )
1244 return aSeq._retn();
1246 //Get Shapes On Quadrangle
1247 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnQuadrangleIDs
1248 (aShape, theShapeType,
1249 aTopLeftPoint, aTopRigthPoint, aBottomLeftPoint, aBottomRigthPoint,
1250 ShapeState(theState));
1251 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1252 return aSeq._retn();
1254 Standard_Integer aLength = aHSeq->Length();
1255 aSeq->length(aLength);
1256 for (Standard_Integer i = 1; i <= aLength; i++)
1257 aSeq[i-1] = aHSeq->Value(i);
1259 return aSeq._retn();
1262 //=============================================================================
1266 //=============================================================================
1267 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnBox
1268 (GEOM::GEOM_Object_ptr theBox,
1269 GEOM::GEOM_Object_ptr theShape,
1270 CORBA::Long theShapeType,
1271 GEOM::shape_state theState)
1273 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1275 //Set a not done flag
1276 GetOperations()->SetNotDone();
1278 //Get the reference objects
1279 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1280 Handle(GEOM_Object) aBox = GetObjectImpl(theBox);
1282 if (aShape.IsNull() || aBox.IsNull() )
1283 return aSeq._retn();
1286 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnBox
1287 (aBox,aShape, theShapeType,ShapeState(theState));
1288 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1289 return aSeq._retn();
1291 Standard_Integer aLength = aHSeq->Length();
1292 aSeq->length(aLength);
1293 for (Standard_Integer i = 1; i <= aLength; i++)
1294 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1296 return aSeq._retn();
1299 //=============================================================================
1301 * GetShapesOnQuadrangleIDs
1303 //=============================================================================
1304 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnBoxIDs
1305 (GEOM::GEOM_Object_ptr theBox,
1306 GEOM::GEOM_Object_ptr theShape,
1307 CORBA::Long theShapeType,
1308 GEOM::shape_state theState)
1310 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1312 //Set a not done flag
1313 GetOperations()->SetNotDone();
1315 //Get the reference objects
1316 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1317 Handle(GEOM_Object) aBox = GetObjectImpl(theBox);
1319 if (aShape.IsNull() || aBox.IsNull() )
1320 return aSeq._retn();
1323 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnBoxIDs
1324 (aBox,aShape, theShapeType,ShapeState(theState));
1325 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1326 return aSeq._retn();
1328 Standard_Integer aLength = aHSeq->Length();
1329 aSeq->length(aLength);
1330 for (Standard_Integer i = 1; i <= aLength; i++)
1331 aSeq[i-1] = aHSeq->Value(i);
1333 return aSeq._retn();
1337 //=============================================================================
1341 //=============================================================================
1342 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnShape
1343 (GEOM::GEOM_Object_ptr theCheckShape,
1344 GEOM::GEOM_Object_ptr theShape,
1345 CORBA::Short theShapeType,
1346 GEOM::shape_state theState)
1348 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1350 //Set a not done flag
1351 GetOperations()->SetNotDone();
1353 //Get the reference objects
1354 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1355 Handle(GEOM_Object) aCheckShape = GetObjectImpl(theCheckShape);
1357 if (aShape.IsNull() || aCheckShape.IsNull() )
1358 return aSeq._retn();
1360 //Get Shapes On Shape
1361 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnShape
1362 (aCheckShape,aShape, theShapeType,ShapeState(theState));
1364 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1365 return aSeq._retn();
1367 Standard_Integer aLength = aHSeq->Length();
1368 aSeq->length(aLength);
1369 for (Standard_Integer i = 1; i <= aLength; i++)
1370 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1372 return aSeq._retn();
1376 //=============================================================================
1378 * GetShapesOnShapeAsCompound
1380 //=============================================================================
1381 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetShapesOnShapeAsCompound
1382 (GEOM::GEOM_Object_ptr theCheckShape,
1383 GEOM::GEOM_Object_ptr theShape,
1384 CORBA::Short theShapeType,
1385 GEOM::shape_state theState)
1387 GEOM::GEOM_Object_var aGEOMObject;
1389 //Set a not done flag
1390 GetOperations()->SetNotDone();
1392 //Get the reference objects
1393 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1394 Handle(GEOM_Object) aCheckShape = GetObjectImpl(theCheckShape);
1396 if (aShape.IsNull() || aCheckShape.IsNull() )
1397 return aGEOMObject._retn();
1399 //Get Shapes On Shape
1400 Handle(GEOM_Object) anObject = GetOperations()->GetShapesOnShapeAsCompound
1401 (aCheckShape,aShape, theShapeType,ShapeState(theState));
1403 if (anObject.IsNull())
1404 return aGEOMObject._retn();
1406 return GetObject(anObject);
1410 //=============================================================================
1412 * GetShapesOnShapeIDs
1414 //=============================================================================
1415 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnShapeIDs
1416 (GEOM::GEOM_Object_ptr theCheckShape,
1417 GEOM::GEOM_Object_ptr theShape,
1418 CORBA::Short theShapeType,
1419 GEOM::shape_state theState)
1421 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1423 //Set a not done flag
1424 GetOperations()->SetNotDone();
1426 //Get the reference objects
1427 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1428 Handle(GEOM_Object) aCheckShape = GetObjectImpl(theCheckShape);
1430 if (aShape.IsNull() || aCheckShape.IsNull() )
1431 return aSeq._retn();
1433 //Get Shapes On Shape
1434 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnShapeIDs
1435 (aCheckShape,aShape, theShapeType,ShapeState(theState));
1436 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1437 return aSeq._retn();
1439 Standard_Integer aLength = aHSeq->Length();
1440 aSeq->length(aLength);
1441 for (Standard_Integer i = 1; i <= aLength; i++)
1442 aSeq[i-1] = aHSeq->Value(i);
1444 return aSeq._retn();
1448 //=============================================================================
1452 //=============================================================================
1453 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlace
1454 (GEOM::GEOM_Object_ptr theShapeWhere,
1455 GEOM::GEOM_Object_ptr theShapeWhat)
1457 GEOM::GEOM_Object_var aGEOMObject;
1459 //Set a not done flag
1460 GetOperations()->SetNotDone();
1462 //Get the reference objects
1463 Handle(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
1464 Handle(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
1466 if (aShapeWhere.IsNull() ||
1467 aShapeWhat.IsNull()) return aGEOMObject._retn();
1469 //Get Shapes in place of aShapeWhat
1470 Handle(GEOM_Object) anObject =
1471 GetOperations()->GetInPlace(aShapeWhere, aShapeWhat);
1472 if (!GetOperations()->IsDone() || anObject.IsNull())
1473 return aGEOMObject._retn();
1475 return GetObject(anObject);
1478 //=============================================================================
1480 * GetInPlaceByHistory
1482 //=============================================================================
1483 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlaceByHistory
1484 (GEOM::GEOM_Object_ptr theShapeWhere,
1485 GEOM::GEOM_Object_ptr theShapeWhat)
1487 GEOM::GEOM_Object_var aGEOMObject;
1489 //Set a not done flag
1490 GetOperations()->SetNotDone();
1492 //Get the reference objects
1493 Handle(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
1494 Handle(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
1496 if (aShapeWhere.IsNull() ||
1497 aShapeWhat.IsNull()) return aGEOMObject._retn();
1499 //Get Shapes in place of aShapeWhat
1500 Handle(GEOM_Object) anObject =
1501 GetOperations()->GetInPlaceByHistory(aShapeWhere, aShapeWhat);
1502 if (!GetOperations()->IsDone() || anObject.IsNull())
1503 return aGEOMObject._retn();
1505 return GetObject(anObject);
1508 //=============================================================================
1512 //=============================================================================
1513 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetSame
1514 (GEOM::GEOM_Object_ptr theShapeWhere,
1515 GEOM::GEOM_Object_ptr theShapeWhat)
1517 GEOM::GEOM_Object_var aGEOMObject;
1519 //Set a not done flag
1520 GetOperations()->SetNotDone();
1522 //Get the reference objects
1523 Handle(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
1524 Handle(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
1526 if (aShapeWhere.IsNull() ||
1527 aShapeWhat.IsNull()) return aGEOMObject._retn();
1529 //Get Shapes in place of aShapeWhat
1530 Handle(GEOM_Object) anObject =
1531 GetOperations()->GetSame(aShapeWhere, aShapeWhat);
1532 if (!GetOperations()->IsDone() || anObject.IsNull())
1533 return aGEOMObject._retn();
1535 return GetObject(anObject);