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 //=============================================================================
472 * MakeExplode (including theShape itself, bad sorting)
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,
486 GEOMImpl_IShapesOperations::EXPLODE_OLD_INCLUDE_MAIN);
487 if (!GetOperations()->IsDone() || aHSeq.IsNull())
490 Standard_Integer aLength = aHSeq->Length();
491 aSeq->length(aLength);
492 for (Standard_Integer i = 1; i <= aLength; i++)
493 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
498 //=============================================================================
500 * MakeAllSubShapes (including theShape itself, good sorting)
502 //=============================================================================
503 GEOM::ListOfGO* GEOM_IShapesOperations_i::MakeAllSubShapes (GEOM::GEOM_Object_ptr theShape,
504 const CORBA::Long theShapeType,
505 const CORBA::Boolean isSorted)
507 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
509 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
510 if (aShape.IsNull()) return aSeq._retn();
512 Handle(TColStd_HSequenceOfTransient) aHSeq =
513 GetOperations()->MakeExplode(aShape, theShapeType, isSorted,
514 GEOMImpl_IShapesOperations::EXPLODE_NEW_INCLUDE_MAIN);
515 if (!GetOperations()->IsDone() || aHSeq.IsNull())
518 Standard_Integer aLength = aHSeq->Length();
519 aSeq->length(aLength);
520 for (Standard_Integer i = 1; i <= aLength; i++)
521 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
526 //=============================================================================
528 * ExtractSubShapes (excluding theShape itself, good sorting)
530 //=============================================================================
531 GEOM::ListOfGO* GEOM_IShapesOperations_i::ExtractSubShapes (GEOM::GEOM_Object_ptr theShape,
532 const CORBA::Long theShapeType,
533 const CORBA::Boolean isSorted)
535 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
537 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
538 if (aShape.IsNull()) return aSeq._retn();
540 Handle(TColStd_HSequenceOfTransient) aHSeq =
541 // TODO: enum instead of bool for the last argument
542 GetOperations()->MakeExplode(aShape, theShapeType, isSorted,
543 GEOMImpl_IShapesOperations::EXPLODE_NEW_EXCLUDE_MAIN);
544 if (!GetOperations()->IsDone() || aHSeq.IsNull())
547 Standard_Integer aLength = aHSeq->Length();
548 aSeq->length(aLength);
549 for (Standard_Integer i = 1; i <= aLength; i++)
550 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
555 //=============================================================================
559 //=============================================================================
560 GEOM::ListOfLong* GEOM_IShapesOperations_i::SubShapeAllIDs (GEOM::GEOM_Object_ptr theShape,
561 const CORBA::Long theShapeType,
562 const CORBA::Boolean isSorted)
564 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
566 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
567 if (aShape.IsNull()) return aSeq._retn();
569 Handle(TColStd_HSequenceOfInteger) aHSeq =
570 GetOperations()->SubShapeAllIDs(aShape, theShapeType, isSorted,
571 GEOMImpl_IShapesOperations::EXPLODE_OLD_INCLUDE_MAIN);
572 if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
574 Standard_Integer aLength = aHSeq->Length();
575 aSeq->length(aLength);
576 for (Standard_Integer i = 1; i <= aLength; i++)
577 aSeq[i-1] = aHSeq->Value(i);
582 //=============================================================================
586 //=============================================================================
587 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetAllSubShapesIDs (GEOM::GEOM_Object_ptr theShape,
588 const CORBA::Long theShapeType,
589 const CORBA::Boolean isSorted)
591 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
593 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
594 if (aShape.IsNull()) return aSeq._retn();
596 Handle(TColStd_HSequenceOfInteger) aHSeq =
597 GetOperations()->SubShapeAllIDs(aShape, theShapeType, isSorted,
598 GEOMImpl_IShapesOperations::EXPLODE_NEW_INCLUDE_MAIN);
599 if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
601 Standard_Integer aLength = aHSeq->Length();
602 aSeq->length(aLength);
603 for (Standard_Integer i = 1; i <= aLength; i++)
604 aSeq[i-1] = aHSeq->Value(i);
609 //=============================================================================
613 //=============================================================================
614 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetSubShape
615 (GEOM::GEOM_Object_ptr theMainShape,
616 const CORBA::Long theID)
618 GEOM::GEOM_Object_var aGEOMObject;
620 //Set a not done flag
621 GetOperations()->SetNotDone();
623 //Get the reference objects
624 Handle(GEOM_Object) aShape = GetObjectImpl(theMainShape);
625 if (aShape.IsNull()) return aGEOMObject._retn();
627 Handle(GEOM_Object) anObject = GetOperations()->GetSubShape(aShape, theID);
628 if (!GetOperations()->IsDone() || anObject.IsNull())
629 return aGEOMObject._retn();
631 return GetObject(anObject);
634 //=============================================================================
638 //=============================================================================
639 CORBA::Long GEOM_IShapesOperations_i::GetSubShapeIndex
640 (GEOM::GEOM_Object_ptr theMainShape, GEOM::GEOM_Object_ptr theSubShape)
642 //Get the reference shapes
643 Handle(GEOM_Object) aMainShapeRef = GetObjectImpl(theMainShape);
644 Handle(GEOM_Object) aSubShapeRef = GetObjectImpl(theSubShape);
646 if (aMainShapeRef.IsNull() || aSubShapeRef.IsNull()) return -1;
648 //Get the unique ID of <theSubShape> inside <theMainShape>
649 CORBA::Long anID = GetOperations()->GetSubShapeIndex(aMainShapeRef, aSubShapeRef);
650 if (!GetOperations()->IsDone())
656 //=============================================================================
660 //=============================================================================
661 CORBA::Long GEOM_IShapesOperations_i::GetTopologyIndex
662 (GEOM::GEOM_Object_ptr theMainShape, GEOM::GEOM_Object_ptr theSubShape)
664 //Get the reference shapes
665 Handle(GEOM_Object) aMainShapeRef = GetObjectImpl(theMainShape);
666 Handle(GEOM_Object) aSubShapeRef = GetObjectImpl(theSubShape);
668 if (aMainShapeRef.IsNull() || aSubShapeRef.IsNull()) return -1;
670 //Get an ID of <theSubShape>, unique among all sub-shapes of <theMainShape> of the same type
671 CORBA::Long anID = GetOperations()->GetTopologyIndex(aMainShapeRef, aSubShapeRef);
672 if (!GetOperations()->IsDone())
678 //=============================================================================
682 //=============================================================================
683 char* GEOM_IShapesOperations_i::GetShapeTypeString (GEOM::GEOM_Object_ptr theShape)
685 //Get the reference shape
686 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
687 if (aShape.IsNull()) return NULL;
689 // Get shape parameters
690 TCollection_AsciiString aDescription = GetOperations()->GetShapeTypeString(aShape);
691 return CORBA::string_dup(aDescription.ToCString());
694 //=============================================================================
698 //=============================================================================
699 CORBA::Long GEOM_IShapesOperations_i::NumberOfFaces (GEOM::GEOM_Object_ptr theShape)
701 return NumberOfSubShapes(theShape, Standard_Integer(TopAbs_FACE));
704 //=============================================================================
708 //=============================================================================
709 CORBA::Long GEOM_IShapesOperations_i::NumberOfEdges (GEOM::GEOM_Object_ptr theShape)
711 return NumberOfSubShapes(theShape, Standard_Integer(TopAbs_EDGE));
714 //=============================================================================
718 //=============================================================================
719 CORBA::Long GEOM_IShapesOperations_i::NumberOfSubShapes (GEOM::GEOM_Object_ptr theShape,
720 const CORBA::Long theShapeType)
722 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
723 if (aShape.IsNull()) return -1;
725 CORBA::Long aNb = GetOperations()->NumberOfSubShapes(aShape, theShapeType);
726 if (!GetOperations()->IsDone()) return -1;
731 //=============================================================================
735 //=============================================================================
736 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::ChangeOrientation
737 (GEOM::GEOM_Object_ptr theShape)
739 GEOM::GEOM_Object_var aGEOMObject;
741 //Set a not done flag
742 GetOperations()->SetNotDone();
744 //Get the reference objects
745 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
746 if (aShape.IsNull()) return aGEOMObject._retn();
749 Handle(GEOM_Object) anObject = GetOperations()->ReverseShape(aShape);
750 if (!GetOperations()->IsDone() || anObject.IsNull())
751 return aGEOMObject._retn();
753 return GetObject(anObject);
756 //=============================================================================
760 //=============================================================================
761 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetFreeFacesIDs (GEOM::GEOM_Object_ptr theShape)
763 //Set a not done flag
764 GetOperations()->SetNotDone();
766 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
768 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
769 if (aShape.IsNull()) return aSeq._retn();
771 Handle(TColStd_HSequenceOfInteger) aHSeq =
772 GetOperations()->GetFreeFacesIDs(aShape);
773 if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
775 Standard_Integer aLength = aHSeq->Length();
776 aSeq->length(aLength);
777 for (Standard_Integer i = 1; i <= aLength; i++)
778 aSeq[i-1] = aHSeq->Value(i);
783 //=============================================================================
787 //=============================================================================
788 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSharedShapes
789 (GEOM::GEOM_Object_ptr theShape1,
790 GEOM::GEOM_Object_ptr theShape2,
791 const CORBA::Long theShapeType)
793 //Set a not done flag
794 GetOperations()->SetNotDone();
796 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
798 Handle(GEOM_Object) aShape1 = GetObjectImpl(theShape1);
799 Handle(GEOM_Object) aShape2 = GetObjectImpl(theShape2);
801 if (aShape1.IsNull() || aShape2.IsNull()) return aSeq._retn();
803 Handle(TColStd_HSequenceOfTransient) aHSeq =
804 GetOperations()->GetSharedShapes(aShape1, aShape2, theShapeType);
805 if (!GetOperations()->IsDone() || aHSeq.IsNull())
808 Standard_Integer aLength = aHSeq->Length();
809 aSeq->length(aLength);
810 for (Standard_Integer i = 1; i <= aLength; i++)
811 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
816 //=============================================================================
818 * GetSharedShapesMulti
820 //=============================================================================
821 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSharedShapesMulti
822 (const GEOM::ListOfGO& theShapes,
823 const CORBA::Long theShapeType)
825 //Set a not done flag
826 GetOperations()->SetNotDone();
828 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
831 std::list<Handle(GEOM_Object)> aShapes;
832 int aLen = theShapes.length();
833 for (int ind = 0; ind < aLen; ind++) {
834 Handle(GEOM_Object) aSh = GetObjectImpl(theShapes[ind]);
835 if (aSh.IsNull()) return aSeq._retn();
836 aShapes.push_back(aSh);
839 Handle(TColStd_HSequenceOfTransient) aHSeq =
840 GetOperations()->GetSharedShapes(aShapes, theShapeType);
841 if (!GetOperations()->IsDone() || aHSeq.IsNull())
844 Standard_Integer aLength = aHSeq->Length();
845 aSeq->length(aLength);
846 for (Standard_Integer i = 1; i <= aLength; i++)
847 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
852 static GEOMAlgo_State ShapeState (const GEOM::shape_state theState)
854 GEOMAlgo_State aState = GEOMAlgo_ST_UNKNOWN;
858 aState = GEOMAlgo_ST_ON;
861 aState = GEOMAlgo_ST_OUT;
864 aState = GEOMAlgo_ST_ONOUT;
867 aState = GEOMAlgo_ST_IN;
870 aState = GEOMAlgo_ST_ONIN;
879 //=============================================================================
883 //=============================================================================
884 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnPlane
885 (GEOM::GEOM_Object_ptr theShape,
886 const CORBA::Long theShapeType,
887 GEOM::GEOM_Object_ptr theAx1,
888 const GEOM::shape_state theState)
890 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
892 //Set a not done flag
893 GetOperations()->SetNotDone();
895 //Get the reference objects
896 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
897 Handle(GEOM_Object) anAx1 = GetObjectImpl(theAx1);
899 if (aShape.IsNull() || anAx1.IsNull()) return aSeq._retn();
901 //Get Shapes On Plane
902 Handle(TColStd_HSequenceOfTransient) aHSeq =
903 GetOperations()->GetShapesOnPlane(aShape, theShapeType, anAx1, ShapeState(theState));
904 if (!GetOperations()->IsDone() || aHSeq.IsNull())
907 Standard_Integer aLength = aHSeq->Length();
908 aSeq->length(aLength);
909 for (Standard_Integer i = 1; i <= aLength; i++)
910 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
915 //=============================================================================
917 * GetShapesOnPlaneWithLocation
919 //=============================================================================
920 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnPlaneWithLocation
921 (GEOM::GEOM_Object_ptr theShape,
922 const CORBA::Long theShapeType,
923 GEOM::GEOM_Object_ptr theAx1,
924 GEOM::GEOM_Object_ptr thePnt,
925 const GEOM::shape_state theState)
927 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
929 //Set a not done flag
930 GetOperations()->SetNotDone();
932 //Get the reference objects
933 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
934 Handle(GEOM_Object) anAx1 = GetObjectImpl(theAx1);
935 Handle(GEOM_Object) anPnt = GetObjectImpl(thePnt);
937 if (aShape.IsNull() || anAx1.IsNull() || anPnt.IsNull()) return aSeq._retn();
939 //Get Shapes On Plane
940 Handle(TColStd_HSequenceOfTransient) aHSeq =
941 GetOperations()->GetShapesOnPlaneWithLocation(aShape, theShapeType, anAx1, anPnt, ShapeState(theState));
942 if (!GetOperations()->IsDone() || aHSeq.IsNull())
945 Standard_Integer aLength = aHSeq->Length();
946 aSeq->length(aLength);
947 for (Standard_Integer i = 1; i <= aLength; i++)
948 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
953 //=============================================================================
955 * GetShapesOnCylinder
957 //=============================================================================
958 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnCylinder
959 (GEOM::GEOM_Object_ptr theShape,
960 const CORBA::Long theShapeType,
961 GEOM::GEOM_Object_ptr theAxis,
962 const CORBA::Double theRadius,
963 const GEOM::shape_state theState)
965 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
967 //Set a not done flag
968 GetOperations()->SetNotDone();
970 //Get the reference objects
971 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
972 Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
974 if (aShape.IsNull() || anAxis.IsNull()) return aSeq._retn();
976 //Get Shapes On Cylinder
977 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnCylinder
978 (aShape, theShapeType, anAxis, theRadius, ShapeState(theState));
979 if (!GetOperations()->IsDone() || aHSeq.IsNull())
982 Standard_Integer aLength = aHSeq->Length();
983 aSeq->length(aLength);
984 for (Standard_Integer i = 1; i <= aLength; i++)
985 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
990 //=============================================================================
992 * GetShapesOnCylinderWithLocation
994 //=============================================================================
995 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnCylinderWithLocation
996 (GEOM::GEOM_Object_ptr theShape,
997 const CORBA::Long theShapeType,
998 GEOM::GEOM_Object_ptr theAxis,
999 GEOM::GEOM_Object_ptr thePnt,
1000 const CORBA::Double theRadius,
1001 const GEOM::shape_state theState)
1003 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1005 //Set a not done flag
1006 GetOperations()->SetNotDone();
1008 //Get the reference objects
1009 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1010 Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
1011 Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
1013 if (aShape.IsNull() || anAxis.IsNull() || aPnt.IsNull()) return aSeq._retn();
1015 //Get Shapes On Cylinder
1016 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnCylinderWithLocation
1017 (aShape, theShapeType, anAxis, aPnt, theRadius, ShapeState(theState));
1018 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1019 return aSeq._retn();
1021 Standard_Integer aLength = aHSeq->Length();
1022 aSeq->length(aLength);
1023 for (Standard_Integer i = 1; i <= aLength; i++)
1024 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1026 return aSeq._retn();
1029 //=============================================================================
1033 //=============================================================================
1034 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnSphere
1035 (GEOM::GEOM_Object_ptr theShape,
1036 const CORBA::Long theShapeType,
1037 GEOM::GEOM_Object_ptr theCenter,
1038 const CORBA::Double theRadius,
1039 const GEOM::shape_state theState)
1041 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1043 //Set a not done flag
1044 GetOperations()->SetNotDone();
1046 //Get the reference objects
1047 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1048 Handle(GEOM_Object) aCenter = GetObjectImpl(theCenter);
1050 if (aShape.IsNull() || aCenter.IsNull()) return aSeq._retn();
1052 //Get Shapes On Sphere
1053 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnSphere
1054 (aShape, theShapeType, aCenter, theRadius, ShapeState(theState));
1055 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1056 return aSeq._retn();
1058 Standard_Integer aLength = aHSeq->Length();
1059 aSeq->length(aLength);
1060 for (Standard_Integer i = 1; i <= aLength; i++)
1061 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1063 return aSeq._retn();
1066 //=============================================================================
1068 * GetShapesOnQuadrangle
1070 //=============================================================================
1071 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnQuadrangle
1072 (GEOM::GEOM_Object_ptr theShape,
1073 CORBA::Long theShapeType,
1074 GEOM::GEOM_Object_ptr theTopLeftPoint,
1075 GEOM::GEOM_Object_ptr theTopRigthPoint,
1076 GEOM::GEOM_Object_ptr theBottomLeftPoint,
1077 GEOM::GEOM_Object_ptr theBottomRigthPoint,
1078 GEOM::shape_state theState)
1080 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1082 //Set a not done flag
1083 GetOperations()->SetNotDone();
1085 //Get the reference objects
1086 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1087 Handle(GEOM_Object) aTopLeftPoint = GetObjectImpl(theTopLeftPoint);
1088 Handle(GEOM_Object) aTopRigthPoint = GetObjectImpl(theTopRigthPoint);
1089 Handle(GEOM_Object) aBottomLeftPoint = GetObjectImpl(theBottomLeftPoint);
1090 Handle(GEOM_Object) aBottomRigthPoint = GetObjectImpl(theBottomRigthPoint);
1092 if (aShape.IsNull() ||
1093 aTopLeftPoint.IsNull() ||
1094 aTopRigthPoint.IsNull() ||
1095 aBottomLeftPoint.IsNull() ||
1096 aBottomRigthPoint.IsNull())
1097 return aSeq._retn();
1099 //Get Shapes On Quadrangle
1100 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnQuadrangle
1101 (aShape, theShapeType,
1102 aTopLeftPoint, aTopRigthPoint, aBottomLeftPoint, aBottomRigthPoint,
1103 ShapeState(theState));
1104 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1105 return aSeq._retn();
1107 Standard_Integer aLength = aHSeq->Length();
1108 aSeq->length(aLength);
1109 for (Standard_Integer i = 1; i <= aLength; i++)
1110 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1112 return aSeq._retn();
1115 //=============================================================================
1117 * GetShapesOnPlaneIDs
1119 //=============================================================================
1120 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnPlaneIDs
1121 (GEOM::GEOM_Object_ptr theShape,
1122 const CORBA::Long theShapeType,
1123 GEOM::GEOM_Object_ptr theAx1,
1124 const GEOM::shape_state theState)
1126 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1128 //Set a not done flag
1129 GetOperations()->SetNotDone();
1131 //Get the reference objects
1132 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1133 Handle(GEOM_Object) anAx1 = GetObjectImpl(theAx1);
1135 if (aShape.IsNull() || anAx1.IsNull()) return aSeq._retn();
1137 //Get Shapes On Plane
1138 Handle(TColStd_HSequenceOfInteger) aHSeq =
1139 GetOperations()->GetShapesOnPlaneIDs(aShape, theShapeType, anAx1, ShapeState(theState));
1140 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1141 return aSeq._retn();
1143 Standard_Integer aLength = aHSeq->Length();
1144 aSeq->length(aLength);
1145 for (Standard_Integer i = 1; i <= aLength; i++)
1146 aSeq[i-1] = aHSeq->Value(i);
1148 return aSeq._retn();
1151 //=============================================================================
1153 * GetShapesOnPlaneWithLocationIDs
1155 //=============================================================================
1156 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnPlaneWithLocationIDs
1157 (GEOM::GEOM_Object_ptr theShape,
1158 const CORBA::Long theShapeType,
1159 GEOM::GEOM_Object_ptr theAx1,
1160 GEOM::GEOM_Object_ptr thePnt,
1161 const GEOM::shape_state theState)
1163 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1165 //Set a not done flag
1166 GetOperations()->SetNotDone();
1168 //Get the reference objects
1169 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1170 Handle(GEOM_Object) anAx1 = GetObjectImpl(theAx1);
1171 Handle(GEOM_Object) anPnt = GetObjectImpl(thePnt);
1173 if (aShape.IsNull() || anAx1.IsNull() || anPnt.IsNull()) return aSeq._retn();
1175 //Get Shapes On Plane
1176 Handle(TColStd_HSequenceOfInteger) aHSeq =
1177 GetOperations()->GetShapesOnPlaneWithLocationIDs(aShape, theShapeType,
1178 anAx1, anPnt, ShapeState(theState));
1179 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1180 return aSeq._retn();
1182 Standard_Integer aLength = aHSeq->Length();
1183 aSeq->length(aLength);
1184 for (Standard_Integer i = 1; i <= aLength; i++)
1185 aSeq[i-1] = aHSeq->Value(i);
1187 return aSeq._retn();
1190 //=============================================================================
1192 * GetShapesOnCylinderIDs
1194 //=============================================================================
1195 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnCylinderIDs
1196 (GEOM::GEOM_Object_ptr theShape,
1197 const CORBA::Long theShapeType,
1198 GEOM::GEOM_Object_ptr theAxis,
1199 const CORBA::Double theRadius,
1200 const GEOM::shape_state theState)
1202 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1204 //Set a not done flag
1205 GetOperations()->SetNotDone();
1207 //Get the reference objects
1208 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1209 Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
1211 if (aShape.IsNull() || anAxis.IsNull()) return aSeq._retn();
1213 //Get Shapes On Cylinder
1214 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnCylinderIDs
1215 (aShape, theShapeType, anAxis, theRadius, ShapeState(theState));
1216 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1217 return aSeq._retn();
1219 Standard_Integer aLength = aHSeq->Length();
1220 aSeq->length(aLength);
1221 for (Standard_Integer i = 1; i <= aLength; i++)
1222 aSeq[i-1] = aHSeq->Value(i);
1224 return aSeq._retn();
1227 //=============================================================================
1229 * GetShapesOnCylinderWithLocationIDs
1231 //=============================================================================
1232 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnCylinderWithLocationIDs
1233 (GEOM::GEOM_Object_ptr theShape,
1234 const CORBA::Long theShapeType,
1235 GEOM::GEOM_Object_ptr theAxis,
1236 GEOM::GEOM_Object_ptr thePnt,
1237 const CORBA::Double theRadius,
1238 const GEOM::shape_state theState)
1240 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1242 //Set a not done flag
1243 GetOperations()->SetNotDone();
1245 //Get the reference objects
1246 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1247 Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
1248 Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
1250 if (aShape.IsNull() || anAxis.IsNull() || aPnt.IsNull()) return aSeq._retn();
1252 //Get Shapes On Cylinder
1253 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnCylinderWithLocationIDs
1254 (aShape, theShapeType, anAxis, aPnt, theRadius, ShapeState(theState));
1255 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1256 return aSeq._retn();
1258 Standard_Integer aLength = aHSeq->Length();
1259 aSeq->length(aLength);
1260 for (Standard_Integer i = 1; i <= aLength; i++)
1261 aSeq[i-1] = aHSeq->Value(i);
1263 return aSeq._retn();
1266 //=============================================================================
1268 * GetShapesOnSphereIDs
1270 //=============================================================================
1271 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnSphereIDs
1272 (GEOM::GEOM_Object_ptr theShape,
1273 const CORBA::Long theShapeType,
1274 GEOM::GEOM_Object_ptr theCenter,
1275 const CORBA::Double theRadius,
1276 const GEOM::shape_state theState)
1278 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1280 //Set a not done flag
1281 GetOperations()->SetNotDone();
1283 //Get the reference objects
1284 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1285 Handle(GEOM_Object) aCenter = GetObjectImpl(theCenter);
1287 if (aShape.IsNull() || aCenter.IsNull()) return aSeq._retn();
1289 //Get Shapes On Sphere
1290 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnSphereIDs
1291 (aShape, theShapeType, aCenter, theRadius, ShapeState(theState));
1292 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1293 return aSeq._retn();
1295 Standard_Integer aLength = aHSeq->Length();
1296 aSeq->length(aLength);
1297 for (Standard_Integer i = 1; i <= aLength; i++)
1298 aSeq[i-1] = aHSeq->Value(i);
1300 return aSeq._retn();
1303 //=============================================================================
1305 * GetShapesOnQuadrangleIDs
1307 //=============================================================================
1308 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnQuadrangleIDs
1309 (GEOM::GEOM_Object_ptr theShape,
1310 CORBA::Long theShapeType,
1311 GEOM::GEOM_Object_ptr theTopLeftPoint,
1312 GEOM::GEOM_Object_ptr theTopRigthPoint,
1313 GEOM::GEOM_Object_ptr theBottomLeftPoint,
1314 GEOM::GEOM_Object_ptr theBottomRigthPoint,
1315 GEOM::shape_state theState)
1317 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1319 //Set a not done flag
1320 GetOperations()->SetNotDone();
1322 //Get the reference objects
1323 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1324 Handle(GEOM_Object) aTopLeftPoint = GetObjectImpl(theTopLeftPoint);
1325 Handle(GEOM_Object) aTopRigthPoint = GetObjectImpl(theTopRigthPoint);
1326 Handle(GEOM_Object) aBottomLeftPoint = GetObjectImpl(theBottomLeftPoint);
1327 Handle(GEOM_Object) aBottomRigthPoint = GetObjectImpl(theBottomRigthPoint);
1329 if (aShape.IsNull() ||
1330 aTopLeftPoint.IsNull() ||
1331 aTopRigthPoint.IsNull() ||
1332 aBottomLeftPoint.IsNull() ||
1333 aBottomRigthPoint.IsNull() )
1334 return aSeq._retn();
1336 //Get Shapes On Quadrangle
1337 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnQuadrangleIDs
1338 (aShape, theShapeType,
1339 aTopLeftPoint, aTopRigthPoint, aBottomLeftPoint, aBottomRigthPoint,
1340 ShapeState(theState));
1341 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1342 return aSeq._retn();
1344 Standard_Integer aLength = aHSeq->Length();
1345 aSeq->length(aLength);
1346 for (Standard_Integer i = 1; i <= aLength; i++)
1347 aSeq[i-1] = aHSeq->Value(i);
1349 return aSeq._retn();
1352 //=============================================================================
1356 //=============================================================================
1357 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnBox
1358 (GEOM::GEOM_Object_ptr theBox,
1359 GEOM::GEOM_Object_ptr theShape,
1360 CORBA::Long theShapeType,
1361 GEOM::shape_state theState)
1363 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1365 //Set a not done flag
1366 GetOperations()->SetNotDone();
1368 //Get the reference objects
1369 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1370 Handle(GEOM_Object) aBox = GetObjectImpl(theBox);
1372 if (aShape.IsNull() || aBox.IsNull() )
1373 return aSeq._retn();
1376 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnBox
1377 (aBox,aShape, theShapeType,ShapeState(theState));
1378 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1379 return aSeq._retn();
1381 Standard_Integer aLength = aHSeq->Length();
1382 aSeq->length(aLength);
1383 for (Standard_Integer i = 1; i <= aLength; i++)
1384 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1386 return aSeq._retn();
1389 //=============================================================================
1391 * GetShapesOnQuadrangleIDs
1393 //=============================================================================
1394 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnBoxIDs
1395 (GEOM::GEOM_Object_ptr theBox,
1396 GEOM::GEOM_Object_ptr theShape,
1397 CORBA::Long theShapeType,
1398 GEOM::shape_state theState)
1400 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1402 //Set a not done flag
1403 GetOperations()->SetNotDone();
1405 //Get the reference objects
1406 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1407 Handle(GEOM_Object) aBox = GetObjectImpl(theBox);
1409 if (aShape.IsNull() || aBox.IsNull() )
1410 return aSeq._retn();
1413 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnBoxIDs
1414 (aBox,aShape, theShapeType,ShapeState(theState));
1415 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1416 return aSeq._retn();
1418 Standard_Integer aLength = aHSeq->Length();
1419 aSeq->length(aLength);
1420 for (Standard_Integer i = 1; i <= aLength; i++)
1421 aSeq[i-1] = aHSeq->Value(i);
1423 return aSeq._retn();
1427 //=============================================================================
1431 //=============================================================================
1432 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnShape
1433 (GEOM::GEOM_Object_ptr theCheckShape,
1434 GEOM::GEOM_Object_ptr theShape,
1435 CORBA::Short theShapeType,
1436 GEOM::shape_state theState)
1438 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1440 //Set a not done flag
1441 GetOperations()->SetNotDone();
1443 //Get the reference objects
1444 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1445 Handle(GEOM_Object) aCheckShape = GetObjectImpl(theCheckShape);
1447 if (aShape.IsNull() || aCheckShape.IsNull() )
1448 return aSeq._retn();
1450 //Get Shapes On Shape
1451 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnShape
1452 (aCheckShape,aShape, theShapeType,ShapeState(theState));
1454 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1455 return aSeq._retn();
1457 Standard_Integer aLength = aHSeq->Length();
1458 aSeq->length(aLength);
1459 for (Standard_Integer i = 1; i <= aLength; i++)
1460 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1462 return aSeq._retn();
1466 //=============================================================================
1468 * GetShapesOnShapeAsCompound
1470 //=============================================================================
1471 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetShapesOnShapeAsCompound
1472 (GEOM::GEOM_Object_ptr theCheckShape,
1473 GEOM::GEOM_Object_ptr theShape,
1474 CORBA::Short theShapeType,
1475 GEOM::shape_state theState)
1477 GEOM::GEOM_Object_var aGEOMObject;
1479 //Set a not done flag
1480 GetOperations()->SetNotDone();
1482 //Get the reference objects
1483 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1484 Handle(GEOM_Object) aCheckShape = GetObjectImpl(theCheckShape);
1486 if (aShape.IsNull() || aCheckShape.IsNull() )
1487 return aGEOMObject._retn();
1489 //Get Shapes On Shape
1490 Handle(GEOM_Object) anObject = GetOperations()->GetShapesOnShapeAsCompound
1491 (aCheckShape,aShape, theShapeType,ShapeState(theState));
1493 if (anObject.IsNull())
1494 return aGEOMObject._retn();
1496 return GetObject(anObject);
1500 //=============================================================================
1502 * GetShapesOnShapeIDs
1504 //=============================================================================
1505 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnShapeIDs
1506 (GEOM::GEOM_Object_ptr theCheckShape,
1507 GEOM::GEOM_Object_ptr theShape,
1508 CORBA::Short theShapeType,
1509 GEOM::shape_state theState)
1511 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1513 //Set a not done flag
1514 GetOperations()->SetNotDone();
1516 //Get the reference objects
1517 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1518 Handle(GEOM_Object) aCheckShape = GetObjectImpl(theCheckShape);
1520 if (aShape.IsNull() || aCheckShape.IsNull() )
1521 return aSeq._retn();
1523 //Get Shapes On Shape
1524 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnShapeIDs
1525 (aCheckShape,aShape, theShapeType,ShapeState(theState));
1526 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1527 return aSeq._retn();
1529 Standard_Integer aLength = aHSeq->Length();
1530 aSeq->length(aLength);
1531 for (Standard_Integer i = 1; i <= aLength; i++)
1532 aSeq[i-1] = aHSeq->Value(i);
1534 return aSeq._retn();
1538 //=============================================================================
1542 //=============================================================================
1543 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlace
1544 (GEOM::GEOM_Object_ptr theShapeWhere,
1545 GEOM::GEOM_Object_ptr theShapeWhat)
1547 GEOM::GEOM_Object_var aGEOMObject;
1549 //Set a not done flag
1550 GetOperations()->SetNotDone();
1552 //Get the reference objects
1553 Handle(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
1554 Handle(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
1556 if (aShapeWhere.IsNull() ||
1557 aShapeWhat.IsNull()) return aGEOMObject._retn();
1559 //Get Shapes in place of aShapeWhat
1560 Handle(GEOM_Object) anObject =
1561 GetOperations()->GetInPlace(aShapeWhere, aShapeWhat);
1562 if (!GetOperations()->IsDone() || anObject.IsNull())
1563 return aGEOMObject._retn();
1565 return GetObject(anObject);
1568 //=============================================================================
1570 * GetInPlaceByHistory
1572 //=============================================================================
1573 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlaceByHistory
1574 (GEOM::GEOM_Object_ptr theShapeWhere,
1575 GEOM::GEOM_Object_ptr theShapeWhat)
1577 GEOM::GEOM_Object_var aGEOMObject;
1579 //Set a not done flag
1580 GetOperations()->SetNotDone();
1582 //Get the reference objects
1583 Handle(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
1584 Handle(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
1586 if (aShapeWhere.IsNull() ||
1587 aShapeWhat.IsNull()) return aGEOMObject._retn();
1589 //Get Shapes in place of aShapeWhat
1590 Handle(GEOM_Object) anObject =
1591 GetOperations()->GetInPlaceByHistory(aShapeWhere, aShapeWhat);
1592 if (!GetOperations()->IsDone() || anObject.IsNull())
1593 return aGEOMObject._retn();
1595 return GetObject(anObject);
1598 //=============================================================================
1602 //=============================================================================
1603 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetSame
1604 (GEOM::GEOM_Object_ptr theShapeWhere,
1605 GEOM::GEOM_Object_ptr theShapeWhat)
1607 GEOM::GEOM_Object_var aGEOMObject;
1609 //Set a not done flag
1610 GetOperations()->SetNotDone();
1612 //Get the reference objects
1613 Handle(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
1614 Handle(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
1616 if (aShapeWhere.IsNull() ||
1617 aShapeWhat.IsNull()) return aGEOMObject._retn();
1619 //Get Shapes in place of aShapeWhat
1620 Handle(GEOM_Object) anObject =
1621 GetOperations()->GetSame(aShapeWhere, aShapeWhat);
1622 if (!GetOperations()->IsDone() || anObject.IsNull())
1623 return aGEOMObject._retn();
1625 return GetObject(anObject);