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::MakeEdgeWire
94 (GEOM::GEOM_Object_ptr theWire,
95 const CORBA::Double theLinearTolerance,
96 const CORBA::Double theAngularTolerance)
98 GEOM::GEOM_Object_var aGEOMObject;
100 //Set a not done flag
101 GetOperations()->SetNotDone();
103 //Get the source wire
104 Handle(GEOM_Object) aWire = GetObjectImpl(theWire);
106 if (aWire.IsNull()) return aGEOMObject._retn();
109 Handle(GEOM_Object) anObject = GetOperations()->MakeEdgeWire(aWire, theLinearTolerance, theAngularTolerance);
110 if (!GetOperations()->IsDone() || anObject.IsNull())
111 return aGEOMObject._retn();
113 return GetObject(anObject);
116 //=============================================================================
120 //=============================================================================
121 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeWire
122 (const GEOM::ListOfGO& theEdgesAndWires,
123 const CORBA::Double theTolerance)
125 GEOM::GEOM_Object_var aGEOMObject;
127 //Set a not done flag
128 GetOperations()->SetNotDone();
131 std::list<Handle(GEOM_Object)> aShapes;
134 aLen = theEdgesAndWires.length();
135 for (ind = 0; ind < aLen; ind++) {
136 Handle(GEOM_Object) aSh = GetObjectImpl(theEdgesAndWires[ind]);
137 if (aSh.IsNull()) return aGEOMObject._retn();
138 aShapes.push_back(aSh);
142 Handle(GEOM_Object) anObject =
143 GetOperations()->MakeWire(aShapes, theTolerance);
144 if (!GetOperations()->IsDone() || anObject.IsNull())
145 return aGEOMObject._retn();
147 return GetObject(anObject);
150 //=============================================================================
154 //=============================================================================
155 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeFace
156 (GEOM::GEOM_Object_ptr theWire,
157 const CORBA::Boolean isPlanarWanted)
159 GEOM::GEOM_Object_var aGEOMObject;
161 //Set a not done flag
162 GetOperations()->SetNotDone();
164 //Get the reference wire
165 Handle(GEOM_Object) aWire = GetObjectImpl(theWire);
166 if (aWire.IsNull()) return aGEOMObject._retn();
169 Handle(GEOM_Object) anObject = GetOperations()->MakeFace(aWire, isPlanarWanted);
170 if (!GetOperations()->IsDone() || anObject.IsNull())
171 return aGEOMObject._retn();
173 return GetObject(anObject);
176 //=============================================================================
180 //=============================================================================
181 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeFaceWires
182 (const GEOM::ListOfGO& theWires,
183 const CORBA::Boolean isPlanarWanted)
185 GEOM::GEOM_Object_var aGEOMObject;
187 //Set a not done flag
188 GetOperations()->SetNotDone();
191 std::list<Handle(GEOM_Object)> aShapes;
194 aLen = theWires.length();
195 for (ind = 0; ind < aLen; ind++) {
196 Handle(GEOM_Object) aSh = GetObjectImpl(theWires[ind]);
197 if (aSh.IsNull()) return aGEOMObject._retn();
198 aShapes.push_back(aSh);
202 Handle(GEOM_Object) anObject =
203 GetOperations()->MakeFaceWires(aShapes, isPlanarWanted);
204 if (!GetOperations()->IsDone() || anObject.IsNull())
205 return aGEOMObject._retn();
207 return GetObject(anObject);
210 //=============================================================================
214 //=============================================================================
215 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeShell
216 (const GEOM::ListOfGO& theFacesAndShells)
218 GEOM::GEOM_Object_var aGEOMObject;
220 //Set a not done flag
221 GetOperations()->SetNotDone();
224 std::list<Handle(GEOM_Object)> aShapes;
227 aLen = theFacesAndShells.length();
228 for (ind = 0; ind < aLen; ind++) {
229 Handle(GEOM_Object) aSh = GetObjectImpl(theFacesAndShells[ind]);
230 if (aSh.IsNull()) return aGEOMObject._retn();
231 aShapes.push_back(aSh);
235 Handle(GEOM_Object) anObject =
236 GetOperations()->MakeShell(aShapes);
237 if (!GetOperations()->IsDone() || anObject.IsNull())
238 return aGEOMObject._retn();
240 return GetObject(anObject);
243 //=============================================================================
247 //=============================================================================
248 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeSolidShell
249 (GEOM::GEOM_Object_ptr theShell)
251 GEOM::GEOM_Object_var aGEOMObject;
253 //Set a not done flag
254 GetOperations()->SetNotDone();
256 //Get the reference objects
257 Handle(GEOM_Object) aShell = GetObjectImpl(theShell);
258 if (aShell.IsNull()) return aGEOMObject._retn();
260 std::list<Handle(GEOM_Object)> aShapes;
261 aShapes.push_back(aShell);
264 Handle(GEOM_Object) anObject = GetOperations()->MakeSolidShells(aShapes);
265 if (!GetOperations()->IsDone() || anObject.IsNull())
266 return aGEOMObject._retn();
268 return GetObject(anObject);
271 //=============================================================================
275 //=============================================================================
276 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeSolidShells
277 (const GEOM::ListOfGO& theShells)
279 GEOM::GEOM_Object_var aGEOMObject;
281 //Set a not done flag
282 GetOperations()->SetNotDone();
285 std::list<Handle(GEOM_Object)> aShapes;
288 aLen = theShells.length();
289 for (ind = 0; ind < aLen; ind++) {
290 Handle(GEOM_Object) aSh = GetObjectImpl(theShells[ind]);
291 if (aSh.IsNull()) return aGEOMObject._retn();
292 aShapes.push_back(aSh);
296 Handle(GEOM_Object) anObject =
297 GetOperations()->MakeSolidShells(aShapes);
298 if (!GetOperations()->IsDone() || anObject.IsNull())
299 return aGEOMObject._retn();
301 return GetObject(anObject);
304 //=============================================================================
308 //=============================================================================
309 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeCompound
310 (const GEOM::ListOfGO& theShapes)
312 GEOM::GEOM_Object_var aGEOMObject;
314 //Set a not done flag
315 GetOperations()->SetNotDone();
318 std::list<Handle(GEOM_Object)> aShapes;
321 aLen = theShapes.length();
322 for (ind = 0; ind < aLen; ind++) {
323 Handle(GEOM_Object) aSh = GetObjectImpl(theShapes[ind]);
324 if (aSh.IsNull()) return aGEOMObject._retn();
325 aShapes.push_back(aSh);
329 Handle(GEOM_Object) anObject =
330 GetOperations()->MakeCompound(aShapes);
331 if (!GetOperations()->IsDone() || anObject.IsNull())
332 return aGEOMObject._retn();
334 return GetObject(anObject);
337 //=============================================================================
341 //=============================================================================
342 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFaces
343 (GEOM::GEOM_Object_ptr theShape,
344 CORBA::Double theTolerance,
345 CORBA::Boolean doKeepNonSolids)
347 GEOM::GEOM_Object_var aGEOMObject;
349 //Set a not done flag
350 GetOperations()->SetNotDone();
352 //Get the reference objects
353 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
354 if (aShape.IsNull()) return aGEOMObject._retn();
357 Handle(GEOM_Object) anObject =
358 GetOperations()->MakeGlueFaces(aShape, theTolerance, doKeepNonSolids);
359 //if (!GetOperations()->IsDone() || anObject.IsNull())
361 if (anObject.IsNull())
362 return aGEOMObject._retn();
364 return GetObject(anObject);
368 //=============================================================================
372 //=============================================================================
373 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetGlueFaces
374 (GEOM::GEOM_Object_ptr theShape,
375 const CORBA::Double theTolerance)
377 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
379 //Set a not done flag
380 GetOperations()->SetNotDone();
382 //Get the reference objects
383 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
384 if (aShape.IsNull()) return aSeq._retn();
386 Handle(TColStd_HSequenceOfTransient) aHSeq =
387 GetOperations()->GetGlueFaces(aShape, theTolerance);
389 //if (!GetOperations()->IsDone() || aHSeq.IsNull())
394 Standard_Integer aLength = aHSeq->Length();
395 aSeq->length(aLength);
396 for (Standard_Integer i = 1; i <= aLength; i++)
397 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
403 //=============================================================================
405 * MakeGlueFacesByList
407 //=============================================================================
408 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFacesByList
409 (GEOM::GEOM_Object_ptr theShape,
410 CORBA::Double theTolerance,
411 const GEOM::ListOfGO& theFaces,
412 CORBA::Boolean doKeepNonSolids)
414 GEOM::GEOM_Object_var aGEOMObject;
416 //Set a not done flag
417 GetOperations()->SetNotDone();
419 //Get the reference objects
420 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
421 if (aShape.IsNull()) return aGEOMObject._retn();
424 std::list<Handle(GEOM_Object)> aFaces;
426 aLen = theFaces.length();
427 for (ind = 0; ind < aLen; ind++) {
428 Handle(GEOM_Object) aSh = GetObjectImpl(theFaces[ind]);
429 if (aSh.IsNull()) return aGEOMObject._retn();
430 aFaces.push_back(aSh);
434 Handle(GEOM_Object) anObject =
435 GetOperations()->MakeGlueFacesByList(aShape, theTolerance, aFaces, doKeepNonSolids);
436 //if (!GetOperations()->IsDone() || anObject.IsNull())
438 if (anObject.IsNull())
439 return aGEOMObject._retn();
441 return GetObject(anObject);
444 //=============================================================================
446 * GetExistingSubObjects
448 //=============================================================================
449 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetExistingSubObjects (GEOM::GEOM_Object_ptr theShape,
450 CORBA::Boolean theGroupsOnly)
452 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
454 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
455 if (aShape.IsNull()) return aSeq._retn();
457 Handle(TColStd_HSequenceOfTransient) aHSeq =
458 GetOperations()->GetExistingSubObjects(aShape, theGroupsOnly);
459 if (!GetOperations()->IsDone() || aHSeq.IsNull())
462 Standard_Integer aLength = aHSeq->Length();
463 aSeq->length(aLength);
464 for (Standard_Integer i = 1; i <= aLength; i++)
465 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
470 //=============================================================================
474 //=============================================================================
475 GEOM::ListOfGO* GEOM_IShapesOperations_i::MakeExplode (GEOM::GEOM_Object_ptr theShape,
476 const CORBA::Long theShapeType,
477 const CORBA::Boolean isSorted)
479 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
481 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
482 if (aShape.IsNull()) return aSeq._retn();
484 Handle(TColStd_HSequenceOfTransient) aHSeq =
485 GetOperations()->MakeExplode(aShape, theShapeType, isSorted, Standard_True);
486 if (!GetOperations()->IsDone() || aHSeq.IsNull())
489 Standard_Integer aLength = aHSeq->Length();
490 aSeq->length(aLength);
491 for (Standard_Integer i = 1; i <= aLength; i++)
492 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
497 //=============================================================================
501 //=============================================================================
502 GEOM::ListOfGO* GEOM_IShapesOperations_i::MakeAllSubShapes (GEOM::GEOM_Object_ptr theShape,
503 const CORBA::Long theShapeType,
504 const CORBA::Boolean isSorted)
506 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
508 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
509 if (aShape.IsNull()) return aSeq._retn();
511 Handle(TColStd_HSequenceOfTransient) aHSeq =
512 GetOperations()->MakeExplode(aShape, theShapeType, isSorted, Standard_False);
513 if (!GetOperations()->IsDone() || aHSeq.IsNull())
516 Standard_Integer aLength = aHSeq->Length();
517 aSeq->length(aLength);
518 for (Standard_Integer i = 1; i <= aLength; i++)
519 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
524 //=============================================================================
528 //=============================================================================
529 GEOM::ListOfLong* GEOM_IShapesOperations_i::SubShapeAllIDs (GEOM::GEOM_Object_ptr theShape,
530 const CORBA::Long theShapeType,
531 const CORBA::Boolean isSorted)
533 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
535 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
536 if (aShape.IsNull()) return aSeq._retn();
538 Handle(TColStd_HSequenceOfInteger) aHSeq =
539 GetOperations()->SubShapeAllIDs(aShape, theShapeType, isSorted, Standard_True);
540 if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
542 Standard_Integer aLength = aHSeq->Length();
543 aSeq->length(aLength);
544 for (Standard_Integer i = 1; i <= aLength; i++)
545 aSeq[i-1] = aHSeq->Value(i);
550 //=============================================================================
554 //=============================================================================
555 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetAllSubShapesIDs (GEOM::GEOM_Object_ptr theShape,
556 const CORBA::Long theShapeType,
557 const CORBA::Boolean isSorted)
559 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
561 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
562 if (aShape.IsNull()) return aSeq._retn();
564 Handle(TColStd_HSequenceOfInteger) aHSeq =
565 GetOperations()->SubShapeAllIDs(aShape, theShapeType, isSorted, Standard_False);
566 if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
568 Standard_Integer aLength = aHSeq->Length();
569 aSeq->length(aLength);
570 for (Standard_Integer i = 1; i <= aLength; i++)
571 aSeq[i-1] = aHSeq->Value(i);
576 //=============================================================================
580 //=============================================================================
581 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetSubShape
582 (GEOM::GEOM_Object_ptr theMainShape,
583 const CORBA::Long theID)
585 GEOM::GEOM_Object_var aGEOMObject;
587 //Set a not done flag
588 GetOperations()->SetNotDone();
590 //Get the reference objects
591 Handle(GEOM_Object) aShape = GetObjectImpl(theMainShape);
592 if (aShape.IsNull()) return aGEOMObject._retn();
594 Handle(GEOM_Object) anObject = GetOperations()->GetSubShape(aShape, theID);
595 if (!GetOperations()->IsDone() || anObject.IsNull())
596 return aGEOMObject._retn();
598 return GetObject(anObject);
601 //=============================================================================
605 //=============================================================================
606 CORBA::Long GEOM_IShapesOperations_i::GetSubShapeIndex
607 (GEOM::GEOM_Object_ptr theMainShape, GEOM::GEOM_Object_ptr theSubShape)
609 //Get the reference shapes
610 Handle(GEOM_Object) aMainShapeRef = GetObjectImpl(theMainShape);
611 Handle(GEOM_Object) aSubShapeRef = GetObjectImpl(theSubShape);
613 if (aMainShapeRef.IsNull() || aSubShapeRef.IsNull()) return -1;
615 //Get the unique ID of <theSubShape> inside <theMainShape>
616 CORBA::Long anID = GetOperations()->GetSubShapeIndex(aMainShapeRef, aSubShapeRef);
617 if (!GetOperations()->IsDone())
623 //=============================================================================
627 //=============================================================================
628 CORBA::Long GEOM_IShapesOperations_i::GetTopologyIndex
629 (GEOM::GEOM_Object_ptr theMainShape, GEOM::GEOM_Object_ptr theSubShape)
631 //Get the reference shapes
632 Handle(GEOM_Object) aMainShapeRef = GetObjectImpl(theMainShape);
633 Handle(GEOM_Object) aSubShapeRef = GetObjectImpl(theSubShape);
635 if (aMainShapeRef.IsNull() || aSubShapeRef.IsNull()) return -1;
637 //Get an ID of <theSubShape>, unique among all sub-shapes of <theMainShape> of the same type
638 CORBA::Long anID = GetOperations()->GetTopologyIndex(aMainShapeRef, aSubShapeRef);
639 if (!GetOperations()->IsDone())
645 //=============================================================================
649 //=============================================================================
650 char* GEOM_IShapesOperations_i::GetShapeTypeString (GEOM::GEOM_Object_ptr theShape)
652 //Get the reference shape
653 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
654 if (aShape.IsNull()) return NULL;
656 // Get shape parameters
657 TCollection_AsciiString aDescription = GetOperations()->GetShapeTypeString(aShape);
658 return CORBA::string_dup(aDescription.ToCString());
661 //=============================================================================
665 //=============================================================================
666 CORBA::Long GEOM_IShapesOperations_i::NumberOfFaces (GEOM::GEOM_Object_ptr theShape)
668 return NumberOfSubShapes(theShape, Standard_Integer(TopAbs_FACE));
671 //=============================================================================
675 //=============================================================================
676 CORBA::Long GEOM_IShapesOperations_i::NumberOfEdges (GEOM::GEOM_Object_ptr theShape)
678 return NumberOfSubShapes(theShape, Standard_Integer(TopAbs_EDGE));
681 //=============================================================================
685 //=============================================================================
686 CORBA::Long GEOM_IShapesOperations_i::NumberOfSubShapes (GEOM::GEOM_Object_ptr theShape,
687 const CORBA::Long theShapeType)
689 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
690 if (aShape.IsNull()) return -1;
692 CORBA::Long aNb = GetOperations()->NumberOfSubShapes(aShape, theShapeType);
693 if (!GetOperations()->IsDone()) return -1;
698 //=============================================================================
702 //=============================================================================
703 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::ChangeOrientation
704 (GEOM::GEOM_Object_ptr theShape)
706 GEOM::GEOM_Object_var aGEOMObject;
708 //Set a not done flag
709 GetOperations()->SetNotDone();
711 //Get the reference objects
712 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
713 if (aShape.IsNull()) return aGEOMObject._retn();
716 Handle(GEOM_Object) anObject = GetOperations()->ReverseShape(aShape);
717 if (!GetOperations()->IsDone() || anObject.IsNull())
718 return aGEOMObject._retn();
720 return GetObject(anObject);
723 //=============================================================================
727 //=============================================================================
728 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetFreeFacesIDs (GEOM::GEOM_Object_ptr theShape)
730 //Set a not done flag
731 GetOperations()->SetNotDone();
733 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
735 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
736 if (aShape.IsNull()) return aSeq._retn();
738 Handle(TColStd_HSequenceOfInteger) aHSeq =
739 GetOperations()->GetFreeFacesIDs(aShape);
740 if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
742 Standard_Integer aLength = aHSeq->Length();
743 aSeq->length(aLength);
744 for (Standard_Integer i = 1; i <= aLength; i++)
745 aSeq[i-1] = aHSeq->Value(i);
750 //=============================================================================
754 //=============================================================================
755 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSharedShapes
756 (GEOM::GEOM_Object_ptr theShape1,
757 GEOM::GEOM_Object_ptr theShape2,
758 const CORBA::Long theShapeType)
760 //Set a not done flag
761 GetOperations()->SetNotDone();
763 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
765 Handle(GEOM_Object) aShape1 = GetObjectImpl(theShape1);
766 Handle(GEOM_Object) aShape2 = GetObjectImpl(theShape2);
768 if (aShape1.IsNull() || aShape2.IsNull()) return aSeq._retn();
770 Handle(TColStd_HSequenceOfTransient) aHSeq =
771 GetOperations()->GetSharedShapes(aShape1, aShape2, theShapeType);
772 if (!GetOperations()->IsDone() || aHSeq.IsNull())
775 Standard_Integer aLength = aHSeq->Length();
776 aSeq->length(aLength);
777 for (Standard_Integer i = 1; i <= aLength; i++)
778 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
783 //=============================================================================
785 * GetSharedShapesMulti
787 //=============================================================================
788 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSharedShapesMulti
789 (const GEOM::ListOfGO& theShapes,
790 const CORBA::Long theShapeType)
792 //Set a not done flag
793 GetOperations()->SetNotDone();
795 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
798 std::list<Handle(GEOM_Object)> aShapes;
799 int aLen = theShapes.length();
800 for (int ind = 0; ind < aLen; ind++) {
801 Handle(GEOM_Object) aSh = GetObjectImpl(theShapes[ind]);
802 if (aSh.IsNull()) return aSeq._retn();
803 aShapes.push_back(aSh);
806 Handle(TColStd_HSequenceOfTransient) aHSeq =
807 GetOperations()->GetSharedShapes(aShapes, theShapeType);
808 if (!GetOperations()->IsDone() || aHSeq.IsNull())
811 Standard_Integer aLength = aHSeq->Length();
812 aSeq->length(aLength);
813 for (Standard_Integer i = 1; i <= aLength; i++)
814 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
819 static GEOMAlgo_State ShapeState (const GEOM::shape_state theState)
821 GEOMAlgo_State aState = GEOMAlgo_ST_UNKNOWN;
825 aState = GEOMAlgo_ST_ON;
828 aState = GEOMAlgo_ST_OUT;
831 aState = GEOMAlgo_ST_ONOUT;
834 aState = GEOMAlgo_ST_IN;
837 aState = GEOMAlgo_ST_ONIN;
846 //=============================================================================
850 //=============================================================================
851 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnPlane
852 (GEOM::GEOM_Object_ptr theShape,
853 const CORBA::Long theShapeType,
854 GEOM::GEOM_Object_ptr theAx1,
855 const GEOM::shape_state theState)
857 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
859 //Set a not done flag
860 GetOperations()->SetNotDone();
862 //Get the reference objects
863 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
864 Handle(GEOM_Object) anAx1 = GetObjectImpl(theAx1);
866 if (aShape.IsNull() || anAx1.IsNull()) return aSeq._retn();
868 //Get Shapes On Plane
869 Handle(TColStd_HSequenceOfTransient) aHSeq =
870 GetOperations()->GetShapesOnPlane(aShape, theShapeType, anAx1, ShapeState(theState));
871 if (!GetOperations()->IsDone() || aHSeq.IsNull())
874 Standard_Integer aLength = aHSeq->Length();
875 aSeq->length(aLength);
876 for (Standard_Integer i = 1; i <= aLength; i++)
877 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
882 //=============================================================================
884 * GetShapesOnPlaneWithLocation
886 //=============================================================================
887 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnPlaneWithLocation
888 (GEOM::GEOM_Object_ptr theShape,
889 const CORBA::Long theShapeType,
890 GEOM::GEOM_Object_ptr theAx1,
891 GEOM::GEOM_Object_ptr thePnt,
892 const GEOM::shape_state theState)
894 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
896 //Set a not done flag
897 GetOperations()->SetNotDone();
899 //Get the reference objects
900 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
901 Handle(GEOM_Object) anAx1 = GetObjectImpl(theAx1);
902 Handle(GEOM_Object) anPnt = GetObjectImpl(thePnt);
904 if (aShape.IsNull() || anAx1.IsNull() || anPnt.IsNull()) return aSeq._retn();
906 //Get Shapes On Plane
907 Handle(TColStd_HSequenceOfTransient) aHSeq =
908 GetOperations()->GetShapesOnPlaneWithLocation(aShape, theShapeType, anAx1, anPnt, ShapeState(theState));
909 if (!GetOperations()->IsDone() || aHSeq.IsNull())
912 Standard_Integer aLength = aHSeq->Length();
913 aSeq->length(aLength);
914 for (Standard_Integer i = 1; i <= aLength; i++)
915 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
920 //=============================================================================
922 * GetShapesOnCylinder
924 //=============================================================================
925 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnCylinder
926 (GEOM::GEOM_Object_ptr theShape,
927 const CORBA::Long theShapeType,
928 GEOM::GEOM_Object_ptr theAxis,
929 const CORBA::Double theRadius,
930 const GEOM::shape_state theState)
932 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
934 //Set a not done flag
935 GetOperations()->SetNotDone();
937 //Get the reference objects
938 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
939 Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
941 if (aShape.IsNull() || anAxis.IsNull()) return aSeq._retn();
943 //Get Shapes On Cylinder
944 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnCylinder
945 (aShape, theShapeType, anAxis, theRadius, ShapeState(theState));
946 if (!GetOperations()->IsDone() || aHSeq.IsNull())
949 Standard_Integer aLength = aHSeq->Length();
950 aSeq->length(aLength);
951 for (Standard_Integer i = 1; i <= aLength; i++)
952 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
957 //=============================================================================
959 * GetShapesOnCylinderWithLocation
961 //=============================================================================
962 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnCylinderWithLocation
963 (GEOM::GEOM_Object_ptr theShape,
964 const CORBA::Long theShapeType,
965 GEOM::GEOM_Object_ptr theAxis,
966 GEOM::GEOM_Object_ptr thePnt,
967 const CORBA::Double theRadius,
968 const GEOM::shape_state theState)
970 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
972 //Set a not done flag
973 GetOperations()->SetNotDone();
975 //Get the reference objects
976 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
977 Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
978 Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
980 if (aShape.IsNull() || anAxis.IsNull() || aPnt.IsNull()) return aSeq._retn();
982 //Get Shapes On Cylinder
983 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnCylinderWithLocation
984 (aShape, theShapeType, anAxis, aPnt, theRadius, ShapeState(theState));
985 if (!GetOperations()->IsDone() || aHSeq.IsNull())
988 Standard_Integer aLength = aHSeq->Length();
989 aSeq->length(aLength);
990 for (Standard_Integer i = 1; i <= aLength; i++)
991 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
996 //=============================================================================
1000 //=============================================================================
1001 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnSphere
1002 (GEOM::GEOM_Object_ptr theShape,
1003 const CORBA::Long theShapeType,
1004 GEOM::GEOM_Object_ptr theCenter,
1005 const CORBA::Double theRadius,
1006 const GEOM::shape_state theState)
1008 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1010 //Set a not done flag
1011 GetOperations()->SetNotDone();
1013 //Get the reference objects
1014 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1015 Handle(GEOM_Object) aCenter = GetObjectImpl(theCenter);
1017 if (aShape.IsNull() || aCenter.IsNull()) return aSeq._retn();
1019 //Get Shapes On Sphere
1020 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnSphere
1021 (aShape, theShapeType, aCenter, theRadius, ShapeState(theState));
1022 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1023 return aSeq._retn();
1025 Standard_Integer aLength = aHSeq->Length();
1026 aSeq->length(aLength);
1027 for (Standard_Integer i = 1; i <= aLength; i++)
1028 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1030 return aSeq._retn();
1033 //=============================================================================
1035 * GetShapesOnQuadrangle
1037 //=============================================================================
1038 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnQuadrangle
1039 (GEOM::GEOM_Object_ptr theShape,
1040 CORBA::Long theShapeType,
1041 GEOM::GEOM_Object_ptr theTopLeftPoint,
1042 GEOM::GEOM_Object_ptr theTopRigthPoint,
1043 GEOM::GEOM_Object_ptr theBottomLeftPoint,
1044 GEOM::GEOM_Object_ptr theBottomRigthPoint,
1045 GEOM::shape_state theState)
1047 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1049 //Set a not done flag
1050 GetOperations()->SetNotDone();
1052 //Get the reference objects
1053 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1054 Handle(GEOM_Object) aTopLeftPoint = GetObjectImpl(theTopLeftPoint);
1055 Handle(GEOM_Object) aTopRigthPoint = GetObjectImpl(theTopRigthPoint);
1056 Handle(GEOM_Object) aBottomLeftPoint = GetObjectImpl(theBottomLeftPoint);
1057 Handle(GEOM_Object) aBottomRigthPoint = GetObjectImpl(theBottomRigthPoint);
1059 if (aShape.IsNull() ||
1060 aTopLeftPoint.IsNull() ||
1061 aTopRigthPoint.IsNull() ||
1062 aBottomLeftPoint.IsNull() ||
1063 aBottomRigthPoint.IsNull())
1064 return aSeq._retn();
1066 //Get Shapes On Quadrangle
1067 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnQuadrangle
1068 (aShape, theShapeType,
1069 aTopLeftPoint, aTopRigthPoint, aBottomLeftPoint, aBottomRigthPoint,
1070 ShapeState(theState));
1071 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1072 return aSeq._retn();
1074 Standard_Integer aLength = aHSeq->Length();
1075 aSeq->length(aLength);
1076 for (Standard_Integer i = 1; i <= aLength; i++)
1077 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1079 return aSeq._retn();
1082 //=============================================================================
1084 * GetShapesOnPlaneIDs
1086 //=============================================================================
1087 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnPlaneIDs
1088 (GEOM::GEOM_Object_ptr theShape,
1089 const CORBA::Long theShapeType,
1090 GEOM::GEOM_Object_ptr theAx1,
1091 const GEOM::shape_state theState)
1093 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1095 //Set a not done flag
1096 GetOperations()->SetNotDone();
1098 //Get the reference objects
1099 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1100 Handle(GEOM_Object) anAx1 = GetObjectImpl(theAx1);
1102 if (aShape.IsNull() || anAx1.IsNull()) return aSeq._retn();
1104 //Get Shapes On Plane
1105 Handle(TColStd_HSequenceOfInteger) aHSeq =
1106 GetOperations()->GetShapesOnPlaneIDs(aShape, theShapeType, anAx1, ShapeState(theState));
1107 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1108 return aSeq._retn();
1110 Standard_Integer aLength = aHSeq->Length();
1111 aSeq->length(aLength);
1112 for (Standard_Integer i = 1; i <= aLength; i++)
1113 aSeq[i-1] = aHSeq->Value(i);
1115 return aSeq._retn();
1118 //=============================================================================
1120 * GetShapesOnPlaneWithLocationIDs
1122 //=============================================================================
1123 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnPlaneWithLocationIDs
1124 (GEOM::GEOM_Object_ptr theShape,
1125 const CORBA::Long theShapeType,
1126 GEOM::GEOM_Object_ptr theAx1,
1127 GEOM::GEOM_Object_ptr thePnt,
1128 const GEOM::shape_state theState)
1130 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1132 //Set a not done flag
1133 GetOperations()->SetNotDone();
1135 //Get the reference objects
1136 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1137 Handle(GEOM_Object) anAx1 = GetObjectImpl(theAx1);
1138 Handle(GEOM_Object) anPnt = GetObjectImpl(thePnt);
1140 if (aShape.IsNull() || anAx1.IsNull() || anPnt.IsNull()) return aSeq._retn();
1142 //Get Shapes On Plane
1143 Handle(TColStd_HSequenceOfInteger) aHSeq =
1144 GetOperations()->GetShapesOnPlaneWithLocationIDs(aShape, theShapeType,
1145 anAx1, anPnt, ShapeState(theState));
1146 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1147 return aSeq._retn();
1149 Standard_Integer aLength = aHSeq->Length();
1150 aSeq->length(aLength);
1151 for (Standard_Integer i = 1; i <= aLength; i++)
1152 aSeq[i-1] = aHSeq->Value(i);
1154 return aSeq._retn();
1157 //=============================================================================
1159 * GetShapesOnCylinderIDs
1161 //=============================================================================
1162 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnCylinderIDs
1163 (GEOM::GEOM_Object_ptr theShape,
1164 const CORBA::Long theShapeType,
1165 GEOM::GEOM_Object_ptr theAxis,
1166 const CORBA::Double theRadius,
1167 const GEOM::shape_state theState)
1169 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1171 //Set a not done flag
1172 GetOperations()->SetNotDone();
1174 //Get the reference objects
1175 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1176 Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
1178 if (aShape.IsNull() || anAxis.IsNull()) return aSeq._retn();
1180 //Get Shapes On Cylinder
1181 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnCylinderIDs
1182 (aShape, theShapeType, anAxis, theRadius, ShapeState(theState));
1183 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1184 return aSeq._retn();
1186 Standard_Integer aLength = aHSeq->Length();
1187 aSeq->length(aLength);
1188 for (Standard_Integer i = 1; i <= aLength; i++)
1189 aSeq[i-1] = aHSeq->Value(i);
1191 return aSeq._retn();
1194 //=============================================================================
1196 * GetShapesOnCylinderWithLocationIDs
1198 //=============================================================================
1199 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnCylinderWithLocationIDs
1200 (GEOM::GEOM_Object_ptr theShape,
1201 const CORBA::Long theShapeType,
1202 GEOM::GEOM_Object_ptr theAxis,
1203 GEOM::GEOM_Object_ptr thePnt,
1204 const CORBA::Double theRadius,
1205 const GEOM::shape_state theState)
1207 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1209 //Set a not done flag
1210 GetOperations()->SetNotDone();
1212 //Get the reference objects
1213 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1214 Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
1215 Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
1217 if (aShape.IsNull() || anAxis.IsNull() || aPnt.IsNull()) return aSeq._retn();
1219 //Get Shapes On Cylinder
1220 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnCylinderWithLocationIDs
1221 (aShape, theShapeType, anAxis, aPnt, theRadius, ShapeState(theState));
1222 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1223 return aSeq._retn();
1225 Standard_Integer aLength = aHSeq->Length();
1226 aSeq->length(aLength);
1227 for (Standard_Integer i = 1; i <= aLength; i++)
1228 aSeq[i-1] = aHSeq->Value(i);
1230 return aSeq._retn();
1233 //=============================================================================
1235 * GetShapesOnSphereIDs
1237 //=============================================================================
1238 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnSphereIDs
1239 (GEOM::GEOM_Object_ptr theShape,
1240 const CORBA::Long theShapeType,
1241 GEOM::GEOM_Object_ptr theCenter,
1242 const CORBA::Double theRadius,
1243 const GEOM::shape_state theState)
1245 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1247 //Set a not done flag
1248 GetOperations()->SetNotDone();
1250 //Get the reference objects
1251 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1252 Handle(GEOM_Object) aCenter = GetObjectImpl(theCenter);
1254 if (aShape.IsNull() || aCenter.IsNull()) return aSeq._retn();
1256 //Get Shapes On Sphere
1257 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnSphereIDs
1258 (aShape, theShapeType, aCenter, theRadius, ShapeState(theState));
1259 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1260 return aSeq._retn();
1262 Standard_Integer aLength = aHSeq->Length();
1263 aSeq->length(aLength);
1264 for (Standard_Integer i = 1; i <= aLength; i++)
1265 aSeq[i-1] = aHSeq->Value(i);
1267 return aSeq._retn();
1270 //=============================================================================
1272 * GetShapesOnQuadrangleIDs
1274 //=============================================================================
1275 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnQuadrangleIDs
1276 (GEOM::GEOM_Object_ptr theShape,
1277 CORBA::Long theShapeType,
1278 GEOM::GEOM_Object_ptr theTopLeftPoint,
1279 GEOM::GEOM_Object_ptr theTopRigthPoint,
1280 GEOM::GEOM_Object_ptr theBottomLeftPoint,
1281 GEOM::GEOM_Object_ptr theBottomRigthPoint,
1282 GEOM::shape_state theState)
1284 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1286 //Set a not done flag
1287 GetOperations()->SetNotDone();
1289 //Get the reference objects
1290 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1291 Handle(GEOM_Object) aTopLeftPoint = GetObjectImpl(theTopLeftPoint);
1292 Handle(GEOM_Object) aTopRigthPoint = GetObjectImpl(theTopRigthPoint);
1293 Handle(GEOM_Object) aBottomLeftPoint = GetObjectImpl(theBottomLeftPoint);
1294 Handle(GEOM_Object) aBottomRigthPoint = GetObjectImpl(theBottomRigthPoint);
1296 if (aShape.IsNull() ||
1297 aTopLeftPoint.IsNull() ||
1298 aTopRigthPoint.IsNull() ||
1299 aBottomLeftPoint.IsNull() ||
1300 aBottomRigthPoint.IsNull() )
1301 return aSeq._retn();
1303 //Get Shapes On Quadrangle
1304 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnQuadrangleIDs
1305 (aShape, theShapeType,
1306 aTopLeftPoint, aTopRigthPoint, aBottomLeftPoint, aBottomRigthPoint,
1307 ShapeState(theState));
1308 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1309 return aSeq._retn();
1311 Standard_Integer aLength = aHSeq->Length();
1312 aSeq->length(aLength);
1313 for (Standard_Integer i = 1; i <= aLength; i++)
1314 aSeq[i-1] = aHSeq->Value(i);
1316 return aSeq._retn();
1319 //=============================================================================
1323 //=============================================================================
1324 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnBox
1325 (GEOM::GEOM_Object_ptr theBox,
1326 GEOM::GEOM_Object_ptr theShape,
1327 CORBA::Long theShapeType,
1328 GEOM::shape_state theState)
1330 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1332 //Set a not done flag
1333 GetOperations()->SetNotDone();
1335 //Get the reference objects
1336 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1337 Handle(GEOM_Object) aBox = GetObjectImpl(theBox);
1339 if (aShape.IsNull() || aBox.IsNull() )
1340 return aSeq._retn();
1343 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnBox
1344 (aBox,aShape, theShapeType,ShapeState(theState));
1345 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1346 return aSeq._retn();
1348 Standard_Integer aLength = aHSeq->Length();
1349 aSeq->length(aLength);
1350 for (Standard_Integer i = 1; i <= aLength; i++)
1351 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1353 return aSeq._retn();
1356 //=============================================================================
1358 * GetShapesOnQuadrangleIDs
1360 //=============================================================================
1361 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnBoxIDs
1362 (GEOM::GEOM_Object_ptr theBox,
1363 GEOM::GEOM_Object_ptr theShape,
1364 CORBA::Long theShapeType,
1365 GEOM::shape_state theState)
1367 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1369 //Set a not done flag
1370 GetOperations()->SetNotDone();
1372 //Get the reference objects
1373 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1374 Handle(GEOM_Object) aBox = GetObjectImpl(theBox);
1376 if (aShape.IsNull() || aBox.IsNull() )
1377 return aSeq._retn();
1380 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnBoxIDs
1381 (aBox,aShape, theShapeType,ShapeState(theState));
1382 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1383 return aSeq._retn();
1385 Standard_Integer aLength = aHSeq->Length();
1386 aSeq->length(aLength);
1387 for (Standard_Integer i = 1; i <= aLength; i++)
1388 aSeq[i-1] = aHSeq->Value(i);
1390 return aSeq._retn();
1394 //=============================================================================
1398 //=============================================================================
1399 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnShape
1400 (GEOM::GEOM_Object_ptr theCheckShape,
1401 GEOM::GEOM_Object_ptr theShape,
1402 CORBA::Short theShapeType,
1403 GEOM::shape_state theState)
1405 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1407 //Set a not done flag
1408 GetOperations()->SetNotDone();
1410 //Get the reference objects
1411 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1412 Handle(GEOM_Object) aCheckShape = GetObjectImpl(theCheckShape);
1414 if (aShape.IsNull() || aCheckShape.IsNull() )
1415 return aSeq._retn();
1417 //Get Shapes On Shape
1418 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnShape
1419 (aCheckShape,aShape, theShapeType,ShapeState(theState));
1421 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1422 return aSeq._retn();
1424 Standard_Integer aLength = aHSeq->Length();
1425 aSeq->length(aLength);
1426 for (Standard_Integer i = 1; i <= aLength; i++)
1427 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1429 return aSeq._retn();
1433 //=============================================================================
1435 * GetShapesOnShapeAsCompound
1437 //=============================================================================
1438 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetShapesOnShapeAsCompound
1439 (GEOM::GEOM_Object_ptr theCheckShape,
1440 GEOM::GEOM_Object_ptr theShape,
1441 CORBA::Short theShapeType,
1442 GEOM::shape_state theState)
1444 GEOM::GEOM_Object_var aGEOMObject;
1446 //Set a not done flag
1447 GetOperations()->SetNotDone();
1449 //Get the reference objects
1450 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1451 Handle(GEOM_Object) aCheckShape = GetObjectImpl(theCheckShape);
1453 if (aShape.IsNull() || aCheckShape.IsNull() )
1454 return aGEOMObject._retn();
1456 //Get Shapes On Shape
1457 Handle(GEOM_Object) anObject = GetOperations()->GetShapesOnShapeAsCompound
1458 (aCheckShape,aShape, theShapeType,ShapeState(theState));
1460 if (anObject.IsNull())
1461 return aGEOMObject._retn();
1463 return GetObject(anObject);
1467 //=============================================================================
1469 * GetShapesOnShapeIDs
1471 //=============================================================================
1472 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnShapeIDs
1473 (GEOM::GEOM_Object_ptr theCheckShape,
1474 GEOM::GEOM_Object_ptr theShape,
1475 CORBA::Short theShapeType,
1476 GEOM::shape_state theState)
1478 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1480 //Set a not done flag
1481 GetOperations()->SetNotDone();
1483 //Get the reference objects
1484 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1485 Handle(GEOM_Object) aCheckShape = GetObjectImpl(theCheckShape);
1487 if (aShape.IsNull() || aCheckShape.IsNull() )
1488 return aSeq._retn();
1490 //Get Shapes On Shape
1491 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnShapeIDs
1492 (aCheckShape,aShape, theShapeType,ShapeState(theState));
1493 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1494 return aSeq._retn();
1496 Standard_Integer aLength = aHSeq->Length();
1497 aSeq->length(aLength);
1498 for (Standard_Integer i = 1; i <= aLength; i++)
1499 aSeq[i-1] = aHSeq->Value(i);
1501 return aSeq._retn();
1505 //=============================================================================
1509 //=============================================================================
1510 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlace
1511 (GEOM::GEOM_Object_ptr theShapeWhere,
1512 GEOM::GEOM_Object_ptr theShapeWhat)
1514 GEOM::GEOM_Object_var aGEOMObject;
1516 //Set a not done flag
1517 GetOperations()->SetNotDone();
1519 //Get the reference objects
1520 Handle(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
1521 Handle(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
1523 if (aShapeWhere.IsNull() ||
1524 aShapeWhat.IsNull()) return aGEOMObject._retn();
1526 //Get Shapes in place of aShapeWhat
1527 Handle(GEOM_Object) anObject =
1528 GetOperations()->GetInPlace(aShapeWhere, aShapeWhat);
1529 if (!GetOperations()->IsDone() || anObject.IsNull())
1530 return aGEOMObject._retn();
1532 return GetObject(anObject);
1535 //=============================================================================
1537 * GetInPlaceByHistory
1539 //=============================================================================
1540 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlaceByHistory
1541 (GEOM::GEOM_Object_ptr theShapeWhere,
1542 GEOM::GEOM_Object_ptr theShapeWhat)
1544 GEOM::GEOM_Object_var aGEOMObject;
1546 //Set a not done flag
1547 GetOperations()->SetNotDone();
1549 //Get the reference objects
1550 Handle(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
1551 Handle(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
1553 if (aShapeWhere.IsNull() ||
1554 aShapeWhat.IsNull()) return aGEOMObject._retn();
1556 //Get Shapes in place of aShapeWhat
1557 Handle(GEOM_Object) anObject =
1558 GetOperations()->GetInPlaceByHistory(aShapeWhere, aShapeWhat);
1559 if (!GetOperations()->IsDone() || anObject.IsNull())
1560 return aGEOMObject._retn();
1562 return GetObject(anObject);
1565 //=============================================================================
1569 //=============================================================================
1570 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetSame
1571 (GEOM::GEOM_Object_ptr theShapeWhere,
1572 GEOM::GEOM_Object_ptr theShapeWhat)
1574 GEOM::GEOM_Object_var aGEOMObject;
1576 //Set a not done flag
1577 GetOperations()->SetNotDone();
1579 //Get the reference objects
1580 Handle(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
1581 Handle(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
1583 if (aShapeWhere.IsNull() ||
1584 aShapeWhat.IsNull()) return aGEOMObject._retn();
1586 //Get Shapes in place of aShapeWhat
1587 Handle(GEOM_Object) anObject =
1588 GetOperations()->GetSame(aShapeWhere, aShapeWhat);
1589 if (!GetOperations()->IsDone() || anObject.IsNull())
1590 return aGEOMObject._retn();
1592 return GetObject(anObject);