1 // Copyright (C) 2007-2014 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, or (at your option) any later version.
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
23 #include <Standard_Stream.hxx>
25 #include "GEOM_IShapesOperations_i.hh"
27 #include "utilities.h"
29 #include "Utils_ExceptHandlers.hxx"
31 #include "GEOM_Engine.hxx"
32 #include "GEOM_Object.hxx"
35 #include <TColStd_HSequenceOfTransient.hxx>
36 #include <TColStd_HArray1OfInteger.hxx>
38 //=============================================================================
42 //=============================================================================
43 GEOM_IShapesOperations_i::GEOM_IShapesOperations_i (PortableServer::POA_ptr thePOA,
44 GEOM::GEOM_Gen_ptr theEngine,
45 ::GEOMImpl_IShapesOperations* theImpl)
46 :GEOM_IOperations_i(thePOA, theEngine, theImpl)
48 MESSAGE("GEOM_IShapesOperations_i::GEOM_IShapesOperations_i");
51 //=============================================================================
55 //=============================================================================
56 GEOM_IShapesOperations_i::~GEOM_IShapesOperations_i()
58 MESSAGE("GEOM_IShapesOperations_i::~GEOM_IShapesOperations_i");
62 //=============================================================================
66 //=============================================================================
67 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeEdge
68 (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2)
70 GEOM::GEOM_Object_var aGEOMObject;
73 GetOperations()->SetNotDone();
75 //Get the reference points
76 Handle(GEOM_Object) aPnt1 = GetObjectImpl(thePnt1);
77 Handle(GEOM_Object) aPnt2 = GetObjectImpl(thePnt2);
79 if (aPnt1.IsNull() || aPnt2.IsNull()) return aGEOMObject._retn();
82 Handle(GEOM_Object) anObject = GetOperations()->MakeEdge(aPnt1, aPnt2);
83 if (!GetOperations()->IsDone() || anObject.IsNull())
84 return aGEOMObject._retn();
86 return GetObject(anObject);
89 //=============================================================================
91 * MakeEdgeOnCurveByLength
93 //=============================================================================
94 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeEdgeOnCurveByLength
95 (GEOM::GEOM_Object_ptr theCurve,
96 CORBA::Double theLength,
97 GEOM::GEOM_Object_ptr theStartPoint)
99 GEOM::GEOM_Object_var aGEOMObject;
101 //Set a not done flag
102 GetOperations()->SetNotDone();
104 //Get the reference curve
105 Handle(GEOM_Object) aRefCurve = GetObjectImpl(theCurve);
106 if (aRefCurve.IsNull()) return aGEOMObject._retn();
108 //Get the reference point (can be NULL)
109 Handle(GEOM_Object) aRefPoint;
110 if (!CORBA::is_nil(theStartPoint)) {
111 aRefPoint = GetObjectImpl(theStartPoint);
115 Handle(GEOM_Object) anObject =
116 GetOperations()->MakeEdgeOnCurveByLength(aRefCurve, theLength, aRefPoint);
117 if (!GetOperations()->IsDone() || anObject.IsNull())
118 return aGEOMObject._retn();
120 return GetObject(anObject);
123 //=============================================================================
127 //=============================================================================
128 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeEdgeWire
129 (GEOM::GEOM_Object_ptr theWire,
130 const CORBA::Double theLinearTolerance,
131 const CORBA::Double theAngularTolerance)
133 GEOM::GEOM_Object_var aGEOMObject;
135 //Set a not done flag
136 GetOperations()->SetNotDone();
138 //Get the source wire
139 Handle(GEOM_Object) aWire = GetObjectImpl(theWire);
141 if (aWire.IsNull()) return aGEOMObject._retn();
144 Handle(GEOM_Object) anObject = GetOperations()->MakeEdgeWire(aWire, theLinearTolerance, theAngularTolerance);
145 if (!GetOperations()->IsDone() || anObject.IsNull())
146 return aGEOMObject._retn();
148 return GetObject(anObject);
151 //=============================================================================
155 //=============================================================================
156 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeWire
157 (const GEOM::ListOfGO& theEdgesAndWires,
158 const CORBA::Double theTolerance)
160 GEOM::GEOM_Object_var aGEOMObject;
162 //Set a not done flag
163 GetOperations()->SetNotDone();
166 std::list<Handle(GEOM_Object)> aShapes;
169 aLen = theEdgesAndWires.length();
170 for (ind = 0; ind < aLen; ind++) {
171 Handle(GEOM_Object) aSh = GetObjectImpl(theEdgesAndWires[ind]);
172 if (aSh.IsNull()) return aGEOMObject._retn();
173 aShapes.push_back(aSh);
177 Handle(GEOM_Object) anObject =
178 GetOperations()->MakeWire(aShapes, theTolerance);
179 if (!GetOperations()->IsDone() || anObject.IsNull())
180 return aGEOMObject._retn();
182 return GetObject(anObject);
185 //=============================================================================
189 //=============================================================================
190 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeFace
191 (GEOM::GEOM_Object_ptr theWire,
192 const CORBA::Boolean isPlanarWanted)
194 GEOM::GEOM_Object_var aGEOMObject;
196 //Set a not done flag
197 GetOperations()->SetNotDone();
199 //Get the reference wire
200 Handle(GEOM_Object) aWire = GetObjectImpl(theWire);
201 if (aWire.IsNull()) return aGEOMObject._retn();
204 Handle(GEOM_Object) anObject = GetOperations()->MakeFace(aWire, isPlanarWanted);
205 //if (!GetOperations()->IsDone() || anObject.IsNull())
206 // enable warning status
207 if (anObject.IsNull())
208 return aGEOMObject._retn();
210 return GetObject(anObject);
213 //=============================================================================
217 //=============================================================================
218 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeFaceWires
219 (const GEOM::ListOfGO& theWires,
220 const CORBA::Boolean isPlanarWanted)
222 GEOM::GEOM_Object_var aGEOMObject;
224 //Set a not done flag
225 GetOperations()->SetNotDone();
228 std::list<Handle(GEOM_Object)> aShapes;
231 aLen = theWires.length();
232 for (ind = 0; ind < aLen; ind++) {
233 Handle(GEOM_Object) aSh = GetObjectImpl(theWires[ind]);
234 if (aSh.IsNull()) return aGEOMObject._retn();
235 aShapes.push_back(aSh);
239 Handle(GEOM_Object) anObject =
240 GetOperations()->MakeFaceWires(aShapes, isPlanarWanted);
241 //if (!GetOperations()->IsDone() || anObject.IsNull())
242 // enable warning status
243 if (anObject.IsNull())
244 return aGEOMObject._retn();
246 return GetObject(anObject);
249 //=============================================================================
251 * MakeFaceFromSurface
253 //=============================================================================
254 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeFaceFromSurface
255 (GEOM::GEOM_Object_ptr theFace,
256 GEOM::GEOM_Object_ptr theWire)
258 GEOM::GEOM_Object_var aGEOMObject;
260 //Set a not done flag
261 GetOperations()->SetNotDone();
263 //Get the reference face and wire
264 Handle(GEOM_Object) aFace = GetObjectImpl(theFace);
265 Handle(GEOM_Object) aWire = GetObjectImpl(theWire);
267 if (aFace.IsNull() || aWire.IsNull()) {
268 return aGEOMObject._retn();
272 Handle(GEOM_Object) anObject =
273 GetOperations()->MakeFaceFromSurface(aFace, aWire);
275 if (anObject.IsNull()) {
276 return aGEOMObject._retn();
279 return GetObject(anObject);
282 //=============================================================================
286 //=============================================================================
287 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeShell
288 (const GEOM::ListOfGO& theFacesAndShells)
290 GEOM::GEOM_Object_var aGEOMObject;
292 //Set a not done flag
293 GetOperations()->SetNotDone();
296 std::list<Handle(GEOM_Object)> aShapes;
299 aLen = theFacesAndShells.length();
300 for (ind = 0; ind < aLen; ind++) {
301 Handle(GEOM_Object) aSh = GetObjectImpl(theFacesAndShells[ind]);
302 if (aSh.IsNull()) return aGEOMObject._retn();
303 aShapes.push_back(aSh);
307 Handle(GEOM_Object) anObject =
308 GetOperations()->MakeShell(aShapes);
309 if (!GetOperations()->IsDone() || anObject.IsNull())
310 return aGEOMObject._retn();
312 return GetObject(anObject);
315 //=============================================================================
319 //=============================================================================
320 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeSolidShell
321 (GEOM::GEOM_Object_ptr theShell)
323 GEOM::GEOM_Object_var aGEOMObject;
325 //Set a not done flag
326 GetOperations()->SetNotDone();
328 //Get the reference objects
329 Handle(GEOM_Object) aShell = GetObjectImpl(theShell);
330 if (aShell.IsNull()) return aGEOMObject._retn();
332 std::list<Handle(GEOM_Object)> aShapes;
333 aShapes.push_back(aShell);
336 Handle(GEOM_Object) anObject = GetOperations()->MakeSolidShells(aShapes);
337 if (!GetOperations()->IsDone() || anObject.IsNull())
338 return aGEOMObject._retn();
340 return GetObject(anObject);
343 //=============================================================================
347 //=============================================================================
348 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeSolidShells
349 (const GEOM::ListOfGO& theShells)
351 GEOM::GEOM_Object_var aGEOMObject;
353 //Set a not done flag
354 GetOperations()->SetNotDone();
357 std::list<Handle(GEOM_Object)> aShapes;
360 aLen = theShells.length();
361 for (ind = 0; ind < aLen; ind++) {
362 Handle(GEOM_Object) aSh = GetObjectImpl(theShells[ind]);
363 if (aSh.IsNull()) return aGEOMObject._retn();
364 aShapes.push_back(aSh);
368 Handle(GEOM_Object) anObject =
369 GetOperations()->MakeSolidShells(aShapes);
370 if (!GetOperations()->IsDone() || anObject.IsNull())
371 return aGEOMObject._retn();
373 return GetObject(anObject);
376 //=============================================================================
380 //=============================================================================
381 GEOM::GEOM_Object_ptr
382 GEOM_IShapesOperations_i::MakeCompound (const GEOM::ListOfGO& theShapes)
384 GEOM::GEOM_Object_var aGEOMObject;
386 //Set a not done flag
387 GetOperations()->SetNotDone();
390 std::list<Handle(GEOM_Object)> aShapes;
393 aLen = theShapes.length();
394 for (ind = 0; ind < aLen; ind++) {
395 Handle(GEOM_Object) aSh = GetObjectImpl(theShapes[ind]);
396 if (aSh.IsNull()) return aGEOMObject._retn();
397 aShapes.push_back(aSh);
401 Handle(GEOM_Object) anObject =
402 GetOperations()->MakeCompound(aShapes);
403 if (!GetOperations()->IsDone() || anObject.IsNull())
404 return aGEOMObject._retn();
406 return GetObject(anObject);
409 //=============================================================================
413 //=============================================================================
414 GEOM::GEOM_Object_ptr
415 GEOM_IShapesOperations_i::MakeGlueFaces (const GEOM::ListOfGO& theShapes,
416 CORBA::Double theTolerance,
417 CORBA::Boolean doKeepNonSolids)
419 GEOM::GEOM_Object_var aGEOMObject;
421 //Set a not done flag
422 GetOperations()->SetNotDone();
424 //Get the reference objects
425 std::list< Handle(GEOM_Object) > aShapes;
426 if (! GetListOfObjectsImpl( theShapes, aShapes ))
427 return aGEOMObject._retn();
430 Handle(GEOM_Object) anObject =
431 GetOperations()->MakeGlueFaces(aShapes, theTolerance, doKeepNonSolids);
432 //if (!GetOperations()->IsDone() || anObject.IsNull())
434 if (anObject.IsNull())
435 return aGEOMObject._retn();
437 return GetObject(anObject);
440 //=============================================================================
444 //=============================================================================
446 GEOM_IShapesOperations_i::GetGlueFaces (const GEOM::ListOfGO& theShapes,
447 const CORBA::Double theTolerance)
449 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
451 //Set a not done flag
452 GetOperations()->SetNotDone();
454 //Get the reference objects
455 std::list< Handle(GEOM_Object) > aShapes;
456 if (! GetListOfObjectsImpl( theShapes, aShapes ))
459 Handle(TColStd_HSequenceOfTransient) aHSeq =
460 GetOperations()->GetGlueShapes(aShapes, theTolerance, TopAbs_FACE);
462 //if (!GetOperations()->IsDone() || aHSeq.IsNull())
467 Standard_Integer aLength = aHSeq->Length();
468 aSeq->length(aLength);
469 for (Standard_Integer i = 1; i <= aLength; i++)
470 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
475 //=============================================================================
477 * MakeGlueFacesByList
479 //=============================================================================
480 GEOM::GEOM_Object_ptr
481 GEOM_IShapesOperations_i::MakeGlueFacesByList (const GEOM::ListOfGO& theShapes,
482 CORBA::Double theTolerance,
483 const GEOM::ListOfGO& theFaces,
484 CORBA::Boolean doKeepNonSolids,
485 CORBA::Boolean doGlueAllEdges)
487 GEOM::GEOM_Object_var aGEOMObject;
489 //Set a not done flag
490 GetOperations()->SetNotDone();
492 //Get the reference objects
493 std::list< Handle(GEOM_Object) > aShapes;
494 if (! GetListOfObjectsImpl( theShapes, aShapes ))
495 return aGEOMObject._retn();
498 std::list<Handle(GEOM_Object)> aFaces;
499 if (! GetListOfObjectsImpl( theFaces, aFaces ))
500 return aGEOMObject._retn();
503 Handle(GEOM_Object) anObject =
504 GetOperations()->MakeGlueFacesByList(aShapes, theTolerance, aFaces,
505 doKeepNonSolids, doGlueAllEdges);
506 //if (!GetOperations()->IsDone() || anObject.IsNull())
508 if (anObject.IsNull())
509 return aGEOMObject._retn();
511 return GetObject(anObject);
514 //=============================================================================
518 //=============================================================================
519 GEOM::GEOM_Object_ptr
520 GEOM_IShapesOperations_i::MakeGlueEdges (const GEOM::ListOfGO& theShapes,
521 CORBA::Double theTolerance)
523 GEOM::GEOM_Object_var aGEOMObject;
525 //Set a not done flag
526 GetOperations()->SetNotDone();
528 //Get the reference objects
529 std::list< Handle(GEOM_Object) > aShapes;
530 if (! GetListOfObjectsImpl( theShapes, aShapes ))
531 return aGEOMObject._retn();
534 Handle(GEOM_Object) anObject =
535 GetOperations()->MakeGlueEdges(aShapes, theTolerance);
536 //if (!GetOperations()->IsDone() || anObject.IsNull())
538 if (anObject.IsNull())
539 return aGEOMObject._retn();
541 return GetObject(anObject);
544 //=============================================================================
548 //=============================================================================
550 GEOM_IShapesOperations_i::GetGlueEdges (const GEOM::ListOfGO& theShapes,
551 const CORBA::Double theTolerance)
553 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
555 //Set a not done flag
556 GetOperations()->SetNotDone();
558 //Get the reference objects
559 std::list< Handle(GEOM_Object) > aShapes;
560 if (! GetListOfObjectsImpl( theShapes, aShapes ))
563 Handle(TColStd_HSequenceOfTransient) aHSeq =
564 GetOperations()->GetGlueShapes(aShapes, theTolerance, TopAbs_EDGE);
566 //if (!GetOperations()->IsDone() || aHSeq.IsNull())
571 Standard_Integer aLength = aHSeq->Length();
572 aSeq->length(aLength);
573 for (Standard_Integer i = 1; i <= aLength; i++)
574 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
579 //=============================================================================
581 * MakeGlueEdgesByList
583 //=============================================================================
584 GEOM::GEOM_Object_ptr
585 GEOM_IShapesOperations_i::MakeGlueEdgesByList (const GEOM::ListOfGO& theShapes,
586 CORBA::Double theTolerance,
587 const GEOM::ListOfGO& theEdges)
589 GEOM::GEOM_Object_var aGEOMObject;
591 //Set a not done flag
592 GetOperations()->SetNotDone();
594 //Get the reference objects
595 std::list< Handle(GEOM_Object) > aShapes;
596 if (! GetListOfObjectsImpl( theShapes, aShapes ))
597 return aGEOMObject._retn();
600 std::list<Handle(GEOM_Object)> anEdges;
601 if (! GetListOfObjectsImpl( theEdges, anEdges ))
602 return aGEOMObject._retn();
605 Handle(GEOM_Object) anObject =
606 GetOperations()->MakeGlueEdgesByList(aShapes, theTolerance, anEdges);
607 //if (!GetOperations()->IsDone() || anObject.IsNull())
609 if (anObject.IsNull())
610 return aGEOMObject._retn();
612 return GetObject(anObject);
615 //=============================================================================
617 * GetExistingSubObjects
619 //=============================================================================
621 GEOM_IShapesOperations_i::GetExistingSubObjects (GEOM::GEOM_Object_ptr theShape,
622 CORBA::Boolean theGroupsOnly)
624 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
626 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
627 if (aShape.IsNull()) return aSeq._retn();
629 Handle(TColStd_HSequenceOfTransient) aHSeq =
630 GetOperations()->GetExistingSubObjects(aShape, theGroupsOnly);
631 if (!GetOperations()->IsDone() || aHSeq.IsNull())
634 Standard_Integer aLength = aHSeq->Length();
635 aSeq->length(aLength);
636 for (Standard_Integer i = 1; i <= aLength; i++)
637 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
642 //=============================================================================
644 * MakeExplode (including theShape itself, bad sorting)
646 //=============================================================================
647 GEOM::ListOfGO* GEOM_IShapesOperations_i::MakeExplode (GEOM::GEOM_Object_ptr theShape,
648 const CORBA::Long theShapeType,
649 const CORBA::Boolean isSorted)
651 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
653 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
654 if (aShape.IsNull()) return aSeq._retn();
656 Handle(TColStd_HSequenceOfTransient) aHSeq =
657 GetOperations()->MakeExplode(aShape, theShapeType, isSorted,
658 GEOMImpl_IShapesOperations::EXPLODE_OLD_INCLUDE_MAIN);
659 if (!GetOperations()->IsDone() || aHSeq.IsNull())
662 Standard_Integer aLength = aHSeq->Length();
663 aSeq->length(aLength);
664 for (Standard_Integer i = 1; i <= aLength; i++)
665 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
670 //=============================================================================
672 * MakeAllSubShapes (including theShape itself, good sorting)
674 //=============================================================================
675 GEOM::ListOfGO* GEOM_IShapesOperations_i::MakeAllSubShapes (GEOM::GEOM_Object_ptr theShape,
676 const CORBA::Long theShapeType,
677 const CORBA::Boolean isSorted)
679 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
681 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
682 if (aShape.IsNull()) return aSeq._retn();
684 Handle(TColStd_HSequenceOfTransient) aHSeq =
685 GetOperations()->MakeExplode(aShape, theShapeType, isSorted,
686 GEOMImpl_IShapesOperations::EXPLODE_NEW_INCLUDE_MAIN);
687 if (!GetOperations()->IsDone() || aHSeq.IsNull())
690 Standard_Integer aLength = aHSeq->Length();
691 aSeq->length(aLength);
692 for (Standard_Integer i = 1; i <= aLength; i++)
693 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
698 //=============================================================================
700 * ExtractSubShapes (excluding theShape itself, good sorting)
702 //=============================================================================
703 GEOM::ListOfGO* GEOM_IShapesOperations_i::ExtractSubShapes (GEOM::GEOM_Object_ptr theShape,
704 const CORBA::Long theShapeType,
705 const CORBA::Boolean isSorted)
707 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
709 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
710 if (aShape.IsNull()) return aSeq._retn();
712 Handle(TColStd_HSequenceOfTransient) aHSeq =
713 // TODO: enum instead of bool for the last argument
714 GetOperations()->MakeExplode(aShape, theShapeType, isSorted,
715 GEOMImpl_IShapesOperations::EXPLODE_NEW_EXCLUDE_MAIN);
716 if (!GetOperations()->IsDone() || aHSeq.IsNull())
719 Standard_Integer aLength = aHSeq->Length();
720 aSeq->length(aLength);
721 for (Standard_Integer i = 1; i <= aLength; i++)
722 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
727 //=============================================================================
731 //=============================================================================
732 GEOM::ListOfLong* GEOM_IShapesOperations_i::SubShapeAllIDs (GEOM::GEOM_Object_ptr theShape,
733 const CORBA::Long theShapeType,
734 const CORBA::Boolean isSorted)
736 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
738 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
739 if (aShape.IsNull()) return aSeq._retn();
741 Handle(TColStd_HSequenceOfInteger) aHSeq =
742 GetOperations()->SubShapeAllIDs(aShape, theShapeType, isSorted,
743 GEOMImpl_IShapesOperations::EXPLODE_OLD_INCLUDE_MAIN);
744 if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
746 Standard_Integer aLength = aHSeq->Length();
747 aSeq->length(aLength);
748 for (Standard_Integer i = 1; i <= aLength; i++)
749 aSeq[i-1] = aHSeq->Value(i);
754 //=============================================================================
758 //=============================================================================
759 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetAllSubShapesIDs (GEOM::GEOM_Object_ptr theShape,
760 const CORBA::Long theShapeType,
761 const CORBA::Boolean isSorted)
763 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
765 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
766 if (aShape.IsNull()) return aSeq._retn();
768 Handle(TColStd_HSequenceOfInteger) aHSeq =
769 GetOperations()->SubShapeAllIDs(aShape, theShapeType, isSorted,
770 GEOMImpl_IShapesOperations::EXPLODE_NEW_INCLUDE_MAIN);
771 if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
773 Standard_Integer aLength = aHSeq->Length();
774 aSeq->length(aLength);
775 for (Standard_Integer i = 1; i <= aLength; i++)
776 aSeq[i-1] = aHSeq->Value(i);
781 //=============================================================================
785 //=============================================================================
786 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetSubShape
787 (GEOM::GEOM_Object_ptr theMainShape,
788 const CORBA::Long theID)
790 GEOM::GEOM_Object_var aGEOMObject;
792 //Set a not done flag
793 GetOperations()->SetNotDone();
795 //Get the reference objects
796 Handle(GEOM_Object) aShape = GetObjectImpl(theMainShape);
797 if (aShape.IsNull()) return aGEOMObject._retn();
799 Handle(GEOM_Object) anObject = GetOperations()->GetSubShape(aShape, theID);
800 if (!GetOperations()->IsDone() || anObject.IsNull())
801 return aGEOMObject._retn();
803 return GetObject(anObject);
806 //=============================================================================
810 //=============================================================================
811 GEOM::ListOfGO* GEOM_IShapesOperations_i::MakeSubShapes (GEOM::GEOM_Object_ptr theMainShape,
812 const GEOM::ListOfLong& theIndices)
814 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
817 //Set a not done flag
818 GetOperations()->SetNotDone();
820 if (theIndices.length() < 1)
823 Handle(GEOM_Object) aShape = GetObjectImpl(theMainShape);
824 if (aShape.IsNull()) return aSeq._retn();
826 Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger (1, theIndices.length());
827 for (i = 0; i < theIndices.length(); i++)
828 anArray->SetValue(i+1, theIndices[i]);
830 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakeSubShapes(aShape, anArray);
831 if (!GetOperations()->IsDone() || aHSeq.IsNull())
834 Standard_Integer aLength = aHSeq->Length();
835 aSeq->length(aLength);
836 for (i = 0; i < aLength; i++)
837 aSeq[i] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i+1)));
842 //=============================================================================
846 //=============================================================================
847 CORBA::Long GEOM_IShapesOperations_i::GetSubShapeIndex
848 (GEOM::GEOM_Object_ptr theMainShape, GEOM::GEOM_Object_ptr theSubShape)
850 //Get the reference shapes
851 Handle(GEOM_Object) aMainShapeRef = GetObjectImpl(theMainShape);
852 Handle(GEOM_Object) aSubShapeRef = GetObjectImpl(theSubShape);
854 if (aMainShapeRef.IsNull() || aSubShapeRef.IsNull()) return -1;
856 //Get the unique ID of <theSubShape> inside <theMainShape>
857 CORBA::Long anID = GetOperations()->GetSubShapeIndex(aMainShapeRef, aSubShapeRef);
858 if (!GetOperations()->IsDone())
864 //=============================================================================
866 * GetSubShapesIndices
868 //=============================================================================
869 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetSubShapesIndices
870 (GEOM::GEOM_Object_ptr theMainShape, const GEOM::ListOfGO& theSubShapes)
872 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
874 //Get the reference main shape
875 Handle(GEOM_Object) aMainShapeRef = GetObjectImpl(theMainShape);
876 if (aMainShapeRef.IsNull()) return aSeq._retn();
879 std::list<Handle(GEOM_Object)> aShapes;
880 int aLen = theSubShapes.length();
881 for (int ind = 0; ind < aLen; ind++) {
882 Handle(GEOM_Object) aSh = GetObjectImpl(theSubShapes[ind]);
885 MESSAGE("NULL shape")
888 aShapes.push_back(aSh);
891 //Get the IDs of <theSubShapes> inside <theMainShape>
892 Handle(TColStd_HSequenceOfInteger) aHSeq =
893 GetOperations()->GetSubShapesIndices(aMainShapeRef, aShapes);
895 if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
897 Standard_Integer aLength = aHSeq->Length();
898 aSeq->length(aLength);
900 for (Standard_Integer i = 1; i <= aLength; i++)
901 aSeq[i-1] = aHSeq->Value(i);
907 //=============================================================================
911 //=============================================================================
912 CORBA::Long GEOM_IShapesOperations_i::GetTopologyIndex
913 (GEOM::GEOM_Object_ptr theMainShape, GEOM::GEOM_Object_ptr theSubShape)
915 //Get the reference shapes
916 Handle(GEOM_Object) aMainShapeRef = GetObjectImpl(theMainShape);
917 Handle(GEOM_Object) aSubShapeRef = GetObjectImpl(theSubShape);
919 if (aMainShapeRef.IsNull() || aSubShapeRef.IsNull()) return -1;
921 //Get an ID of <theSubShape>, unique among all sub-shapes of <theMainShape> of the same type
922 CORBA::Long anID = GetOperations()->GetTopologyIndex(aMainShapeRef, aSubShapeRef);
923 if (!GetOperations()->IsDone())
929 //=============================================================================
933 //=============================================================================
934 char* GEOM_IShapesOperations_i::GetShapeTypeString (GEOM::GEOM_Object_ptr theShape)
936 //Get the reference shape
937 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
938 if (aShape.IsNull()) return NULL;
940 // Get shape parameters
941 TCollection_AsciiString aDescription = GetOperations()->GetShapeTypeString(aShape);
942 return CORBA::string_dup(aDescription.ToCString());
945 //=============================================================================
949 //=============================================================================
950 CORBA::Long GEOM_IShapesOperations_i::NumberOfFaces (GEOM::GEOM_Object_ptr theShape)
952 return NumberOfSubShapes(theShape, Standard_Integer(TopAbs_FACE));
955 //=============================================================================
959 //=============================================================================
960 CORBA::Long GEOM_IShapesOperations_i::NumberOfEdges (GEOM::GEOM_Object_ptr theShape)
962 return NumberOfSubShapes(theShape, Standard_Integer(TopAbs_EDGE));
965 //=============================================================================
969 //=============================================================================
970 CORBA::Long GEOM_IShapesOperations_i::NumberOfSubShapes (GEOM::GEOM_Object_ptr theShape,
971 const CORBA::Long theShapeType)
973 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
974 if (aShape.IsNull()) return -1;
976 CORBA::Long aNb = GetOperations()->NumberOfSubShapes(aShape, theShapeType);
977 if (!GetOperations()->IsDone()) return -1;
982 //=============================================================================
986 //=============================================================================
987 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::ChangeOrientation
988 (GEOM::GEOM_Object_ptr theShape)
990 GEOM::GEOM_Object_var aGEOMObject;
992 //Set a not done flag
993 GetOperations()->SetNotDone();
995 //Get the reference objects
996 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
997 if (aShape.IsNull()) return aGEOMObject._retn();
1000 Handle(GEOM_Object) anObject = GetOperations()->ReverseShape(aShape);
1001 if (!GetOperations()->IsDone() || anObject.IsNull())
1002 return aGEOMObject._retn();
1004 return GetObject(anObject);
1007 //=============================================================================
1011 //=============================================================================
1012 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetFreeFacesIDs (GEOM::GEOM_Object_ptr theShape)
1014 //Set a not done flag
1015 GetOperations()->SetNotDone();
1017 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1019 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1020 if (aShape.IsNull()) return aSeq._retn();
1022 Handle(TColStd_HSequenceOfInteger) aHSeq =
1023 GetOperations()->GetFreeFacesIDs(aShape);
1024 if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
1026 Standard_Integer aLength = aHSeq->Length();
1027 aSeq->length(aLength);
1028 for (Standard_Integer i = 1; i <= aLength; i++)
1029 aSeq[i-1] = aHSeq->Value(i);
1031 return aSeq._retn();
1034 //=============================================================================
1038 //=============================================================================
1039 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSharedShapes
1040 (GEOM::GEOM_Object_ptr theShape1,
1041 GEOM::GEOM_Object_ptr theShape2,
1042 const CORBA::Long theShapeType)
1044 //Set a not done flag
1045 GetOperations()->SetNotDone();
1047 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1049 Handle(GEOM_Object) aShape1 = GetObjectImpl(theShape1);
1050 Handle(GEOM_Object) aShape2 = GetObjectImpl(theShape2);
1052 if (aShape1.IsNull() || aShape2.IsNull()) return aSeq._retn();
1054 Handle(TColStd_HSequenceOfTransient) aHSeq =
1055 GetOperations()->GetSharedShapes(aShape1, aShape2, theShapeType);
1056 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1057 return aSeq._retn();
1059 Standard_Integer aLength = aHSeq->Length();
1060 aSeq->length(aLength);
1061 for (Standard_Integer i = 1; i <= aLength; i++)
1062 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1064 return aSeq._retn();
1067 //=============================================================================
1069 * GetSharedShapesMulti
1071 //=============================================================================
1072 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSharedShapesMulti
1073 (const GEOM::ListOfGO& theShapes,
1074 const CORBA::Long theShapeType)
1076 //Set a not done flag
1077 GetOperations()->SetNotDone();
1079 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1082 std::list<Handle(GEOM_Object)> aShapes;
1083 if (! GetListOfObjectsImpl( theShapes, aShapes ))
1084 return aSeq._retn();
1086 Handle(TColStd_HSequenceOfTransient) aHSeq =
1087 GetOperations()->GetSharedShapes(aShapes, theShapeType);
1088 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1089 return aSeq._retn();
1091 Standard_Integer aLength = aHSeq->Length();
1092 aSeq->length(aLength);
1093 for (Standard_Integer i = 1; i <= aLength; i++)
1094 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1096 return aSeq._retn();
1099 static GEOMAlgo_State ShapeState (const GEOM::shape_state theState)
1101 GEOMAlgo_State aState = GEOMAlgo_ST_UNKNOWN;
1105 aState = GEOMAlgo_ST_ON;
1108 aState = GEOMAlgo_ST_OUT;
1110 case GEOM::ST_ONOUT:
1111 aState = GEOMAlgo_ST_ONOUT;
1114 aState = GEOMAlgo_ST_IN;
1117 aState = GEOMAlgo_ST_ONIN;
1126 //=============================================================================
1130 //=============================================================================
1131 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnPlane
1132 (GEOM::GEOM_Object_ptr theShape,
1133 const CORBA::Long theShapeType,
1134 GEOM::GEOM_Object_ptr theAx1,
1135 const GEOM::shape_state theState)
1137 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1139 //Set a not done flag
1140 GetOperations()->SetNotDone();
1142 //Get the reference objects
1143 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1144 Handle(GEOM_Object) anAx1 = GetObjectImpl(theAx1);
1146 if (aShape.IsNull() || anAx1.IsNull()) return aSeq._retn();
1148 //Get Shapes On Plane
1149 Handle(TColStd_HSequenceOfTransient) aHSeq =
1150 GetOperations()->GetShapesOnPlane(aShape, theShapeType, anAx1, ShapeState(theState));
1151 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1152 return aSeq._retn();
1154 Standard_Integer aLength = aHSeq->Length();
1155 aSeq->length(aLength);
1156 for (Standard_Integer i = 1; i <= aLength; i++)
1157 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1159 return aSeq._retn();
1162 //=============================================================================
1164 * GetShapesOnPlaneWithLocation
1166 //=============================================================================
1167 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnPlaneWithLocation
1168 (GEOM::GEOM_Object_ptr theShape,
1169 const CORBA::Long theShapeType,
1170 GEOM::GEOM_Object_ptr theAx1,
1171 GEOM::GEOM_Object_ptr thePnt,
1172 const GEOM::shape_state theState)
1174 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1176 //Set a not done flag
1177 GetOperations()->SetNotDone();
1179 //Get the reference objects
1180 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1181 Handle(GEOM_Object) anAx1 = GetObjectImpl(theAx1);
1182 Handle(GEOM_Object) anPnt = GetObjectImpl(thePnt);
1184 if (aShape.IsNull() || anAx1.IsNull() || anPnt.IsNull()) return aSeq._retn();
1186 //Get Shapes On Plane
1187 Handle(TColStd_HSequenceOfTransient) aHSeq =
1188 GetOperations()->GetShapesOnPlaneWithLocation(aShape, theShapeType, anAx1, anPnt, ShapeState(theState));
1189 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1190 return aSeq._retn();
1192 Standard_Integer aLength = aHSeq->Length();
1193 aSeq->length(aLength);
1194 for (Standard_Integer i = 1; i <= aLength; i++)
1195 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1197 return aSeq._retn();
1200 //=============================================================================
1202 * GetShapesOnCylinder
1204 //=============================================================================
1205 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnCylinder
1206 (GEOM::GEOM_Object_ptr theShape,
1207 const CORBA::Long theShapeType,
1208 GEOM::GEOM_Object_ptr theAxis,
1209 const CORBA::Double theRadius,
1210 const GEOM::shape_state theState)
1212 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1214 //Set a not done flag
1215 GetOperations()->SetNotDone();
1217 //Get the reference objects
1218 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1219 Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
1221 if (aShape.IsNull() || anAxis.IsNull()) return aSeq._retn();
1223 //Get Shapes On Cylinder
1224 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnCylinder
1225 (aShape, theShapeType, anAxis, theRadius, ShapeState(theState));
1226 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1227 return aSeq._retn();
1229 Standard_Integer aLength = aHSeq->Length();
1230 aSeq->length(aLength);
1231 for (Standard_Integer i = 1; i <= aLength; i++)
1232 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1234 return aSeq._retn();
1237 //=============================================================================
1239 * GetShapesOnCylinderWithLocation
1241 //=============================================================================
1242 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnCylinderWithLocation
1243 (GEOM::GEOM_Object_ptr theShape,
1244 const CORBA::Long theShapeType,
1245 GEOM::GEOM_Object_ptr theAxis,
1246 GEOM::GEOM_Object_ptr thePnt,
1247 const CORBA::Double theRadius,
1248 const GEOM::shape_state theState)
1250 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1252 //Set a not done flag
1253 GetOperations()->SetNotDone();
1255 //Get the reference objects
1256 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1257 Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
1258 Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
1260 if (aShape.IsNull() || anAxis.IsNull() || aPnt.IsNull()) return aSeq._retn();
1262 //Get Shapes On Cylinder
1263 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnCylinderWithLocation
1264 (aShape, theShapeType, anAxis, aPnt, theRadius, ShapeState(theState));
1265 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1266 return aSeq._retn();
1268 Standard_Integer aLength = aHSeq->Length();
1269 aSeq->length(aLength);
1270 for (Standard_Integer i = 1; i <= aLength; i++)
1271 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1273 return aSeq._retn();
1276 //=============================================================================
1280 //=============================================================================
1281 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnSphere
1282 (GEOM::GEOM_Object_ptr theShape,
1283 const CORBA::Long theShapeType,
1284 GEOM::GEOM_Object_ptr theCenter,
1285 const CORBA::Double theRadius,
1286 const GEOM::shape_state theState)
1288 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1290 //Set a not done flag
1291 GetOperations()->SetNotDone();
1293 //Get the reference objects
1294 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1295 Handle(GEOM_Object) aCenter = GetObjectImpl(theCenter);
1297 if (aShape.IsNull() || aCenter.IsNull()) return aSeq._retn();
1299 //Get Shapes On Sphere
1300 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnSphere
1301 (aShape, theShapeType, aCenter, theRadius, ShapeState(theState));
1302 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1303 return aSeq._retn();
1305 Standard_Integer aLength = aHSeq->Length();
1306 aSeq->length(aLength);
1307 for (Standard_Integer i = 1; i <= aLength; i++)
1308 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1310 return aSeq._retn();
1313 //=============================================================================
1315 * GetShapesOnQuadrangle
1317 //=============================================================================
1318 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnQuadrangle
1319 (GEOM::GEOM_Object_ptr theShape,
1320 CORBA::Long theShapeType,
1321 GEOM::GEOM_Object_ptr theTopLeftPoint,
1322 GEOM::GEOM_Object_ptr theTopRigthPoint,
1323 GEOM::GEOM_Object_ptr theBottomLeftPoint,
1324 GEOM::GEOM_Object_ptr theBottomRigthPoint,
1325 GEOM::shape_state theState)
1327 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1329 //Set a not done flag
1330 GetOperations()->SetNotDone();
1332 //Get the reference objects
1333 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1334 Handle(GEOM_Object) aTopLeftPoint = GetObjectImpl(theTopLeftPoint);
1335 Handle(GEOM_Object) aTopRigthPoint = GetObjectImpl(theTopRigthPoint);
1336 Handle(GEOM_Object) aBottomLeftPoint = GetObjectImpl(theBottomLeftPoint);
1337 Handle(GEOM_Object) aBottomRigthPoint = GetObjectImpl(theBottomRigthPoint);
1339 if (aShape.IsNull() ||
1340 aTopLeftPoint.IsNull() ||
1341 aTopRigthPoint.IsNull() ||
1342 aBottomLeftPoint.IsNull() ||
1343 aBottomRigthPoint.IsNull())
1344 return aSeq._retn();
1346 //Get Shapes On Quadrangle
1347 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnQuadrangle
1348 (aShape, theShapeType,
1349 aTopLeftPoint, aTopRigthPoint, aBottomLeftPoint, aBottomRigthPoint,
1350 ShapeState(theState));
1351 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1352 return aSeq._retn();
1354 Standard_Integer aLength = aHSeq->Length();
1355 aSeq->length(aLength);
1356 for (Standard_Integer i = 1; i <= aLength; i++)
1357 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1359 return aSeq._retn();
1362 //=============================================================================
1364 * GetShapesOnPlaneIDs
1366 //=============================================================================
1367 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnPlaneIDs
1368 (GEOM::GEOM_Object_ptr theShape,
1369 const CORBA::Long theShapeType,
1370 GEOM::GEOM_Object_ptr theAx1,
1371 const GEOM::shape_state theState)
1373 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1375 //Set a not done flag
1376 GetOperations()->SetNotDone();
1378 //Get the reference objects
1379 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1380 Handle(GEOM_Object) anAx1 = GetObjectImpl(theAx1);
1382 if (aShape.IsNull() || anAx1.IsNull()) return aSeq._retn();
1384 //Get Shapes On Plane
1385 Handle(TColStd_HSequenceOfInteger) aHSeq =
1386 GetOperations()->GetShapesOnPlaneIDs(aShape, theShapeType, anAx1, ShapeState(theState));
1387 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1388 return aSeq._retn();
1390 Standard_Integer aLength = aHSeq->Length();
1391 aSeq->length(aLength);
1392 for (Standard_Integer i = 1; i <= aLength; i++)
1393 aSeq[i-1] = aHSeq->Value(i);
1395 return aSeq._retn();
1398 //=============================================================================
1400 * GetShapesOnPlaneWithLocationIDs
1402 //=============================================================================
1403 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnPlaneWithLocationIDs
1404 (GEOM::GEOM_Object_ptr theShape,
1405 const CORBA::Long theShapeType,
1406 GEOM::GEOM_Object_ptr theAx1,
1407 GEOM::GEOM_Object_ptr thePnt,
1408 const GEOM::shape_state theState)
1410 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1412 //Set a not done flag
1413 GetOperations()->SetNotDone();
1415 //Get the reference objects
1416 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1417 Handle(GEOM_Object) anAx1 = GetObjectImpl(theAx1);
1418 Handle(GEOM_Object) anPnt = GetObjectImpl(thePnt);
1420 if (aShape.IsNull() || anAx1.IsNull() || anPnt.IsNull()) return aSeq._retn();
1422 //Get Shapes On Plane
1423 Handle(TColStd_HSequenceOfInteger) aHSeq =
1424 GetOperations()->GetShapesOnPlaneWithLocationIDs(aShape, theShapeType,
1425 anAx1, anPnt, ShapeState(theState));
1426 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1427 return aSeq._retn();
1429 Standard_Integer aLength = aHSeq->Length();
1430 aSeq->length(aLength);
1431 for (Standard_Integer i = 1; i <= aLength; i++)
1432 aSeq[i-1] = aHSeq->Value(i);
1434 return aSeq._retn();
1437 //=============================================================================
1439 * GetShapesOnCylinderIDs
1441 //=============================================================================
1442 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnCylinderIDs
1443 (GEOM::GEOM_Object_ptr theShape,
1444 const CORBA::Long theShapeType,
1445 GEOM::GEOM_Object_ptr theAxis,
1446 const CORBA::Double theRadius,
1447 const GEOM::shape_state theState)
1449 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1451 //Set a not done flag
1452 GetOperations()->SetNotDone();
1454 //Get the reference objects
1455 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1456 Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
1458 if (aShape.IsNull() || anAxis.IsNull()) return aSeq._retn();
1460 //Get Shapes On Cylinder
1461 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnCylinderIDs
1462 (aShape, theShapeType, anAxis, theRadius, ShapeState(theState));
1463 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1464 return aSeq._retn();
1466 Standard_Integer aLength = aHSeq->Length();
1467 aSeq->length(aLength);
1468 for (Standard_Integer i = 1; i <= aLength; i++)
1469 aSeq[i-1] = aHSeq->Value(i);
1471 return aSeq._retn();
1474 //=============================================================================
1476 * GetShapesOnCylinderWithLocationIDs
1478 //=============================================================================
1479 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnCylinderWithLocationIDs
1480 (GEOM::GEOM_Object_ptr theShape,
1481 const CORBA::Long theShapeType,
1482 GEOM::GEOM_Object_ptr theAxis,
1483 GEOM::GEOM_Object_ptr thePnt,
1484 const CORBA::Double theRadius,
1485 const GEOM::shape_state theState)
1487 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1489 //Set a not done flag
1490 GetOperations()->SetNotDone();
1492 //Get the reference objects
1493 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1494 Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
1495 Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
1497 if (aShape.IsNull() || anAxis.IsNull() || aPnt.IsNull()) return aSeq._retn();
1499 //Get Shapes On Cylinder
1500 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnCylinderWithLocationIDs
1501 (aShape, theShapeType, anAxis, aPnt, theRadius, ShapeState(theState));
1502 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1503 return aSeq._retn();
1505 Standard_Integer aLength = aHSeq->Length();
1506 aSeq->length(aLength);
1507 for (Standard_Integer i = 1; i <= aLength; i++)
1508 aSeq[i-1] = aHSeq->Value(i);
1510 return aSeq._retn();
1513 //=============================================================================
1515 * GetShapesOnSphereIDs
1517 //=============================================================================
1518 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnSphereIDs
1519 (GEOM::GEOM_Object_ptr theShape,
1520 const CORBA::Long theShapeType,
1521 GEOM::GEOM_Object_ptr theCenter,
1522 const CORBA::Double theRadius,
1523 const GEOM::shape_state theState)
1525 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1527 //Set a not done flag
1528 GetOperations()->SetNotDone();
1530 //Get the reference objects
1531 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1532 Handle(GEOM_Object) aCenter = GetObjectImpl(theCenter);
1534 if (aShape.IsNull() || aCenter.IsNull()) return aSeq._retn();
1536 //Get Shapes On Sphere
1537 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnSphereIDs
1538 (aShape, theShapeType, aCenter, theRadius, ShapeState(theState));
1539 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1540 return aSeq._retn();
1542 Standard_Integer aLength = aHSeq->Length();
1543 aSeq->length(aLength);
1544 for (Standard_Integer i = 1; i <= aLength; i++)
1545 aSeq[i-1] = aHSeq->Value(i);
1547 return aSeq._retn();
1550 //=============================================================================
1552 * GetShapesOnQuadrangleIDs
1554 //=============================================================================
1555 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnQuadrangleIDs
1556 (GEOM::GEOM_Object_ptr theShape,
1557 CORBA::Long theShapeType,
1558 GEOM::GEOM_Object_ptr theTopLeftPoint,
1559 GEOM::GEOM_Object_ptr theTopRigthPoint,
1560 GEOM::GEOM_Object_ptr theBottomLeftPoint,
1561 GEOM::GEOM_Object_ptr theBottomRigthPoint,
1562 GEOM::shape_state theState)
1564 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1566 //Set a not done flag
1567 GetOperations()->SetNotDone();
1569 //Get the reference objects
1570 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1571 Handle(GEOM_Object) aTopLeftPoint = GetObjectImpl(theTopLeftPoint);
1572 Handle(GEOM_Object) aTopRigthPoint = GetObjectImpl(theTopRigthPoint);
1573 Handle(GEOM_Object) aBottomLeftPoint = GetObjectImpl(theBottomLeftPoint);
1574 Handle(GEOM_Object) aBottomRigthPoint = GetObjectImpl(theBottomRigthPoint);
1576 if (aShape.IsNull() ||
1577 aTopLeftPoint.IsNull() ||
1578 aTopRigthPoint.IsNull() ||
1579 aBottomLeftPoint.IsNull() ||
1580 aBottomRigthPoint.IsNull() )
1581 return aSeq._retn();
1583 //Get Shapes On Quadrangle
1584 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnQuadrangleIDs
1585 (aShape, theShapeType,
1586 aTopLeftPoint, aTopRigthPoint, aBottomLeftPoint, aBottomRigthPoint,
1587 ShapeState(theState));
1588 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1589 return aSeq._retn();
1591 Standard_Integer aLength = aHSeq->Length();
1592 aSeq->length(aLength);
1593 for (Standard_Integer i = 1; i <= aLength; i++)
1594 aSeq[i-1] = aHSeq->Value(i);
1596 return aSeq._retn();
1599 //=============================================================================
1603 //=============================================================================
1604 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnBox
1605 (GEOM::GEOM_Object_ptr theBox,
1606 GEOM::GEOM_Object_ptr theShape,
1607 CORBA::Long theShapeType,
1608 GEOM::shape_state theState)
1610 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1612 //Set a not done flag
1613 GetOperations()->SetNotDone();
1615 //Get the reference objects
1616 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1617 Handle(GEOM_Object) aBox = GetObjectImpl(theBox);
1619 if (aShape.IsNull() || aBox.IsNull() )
1620 return aSeq._retn();
1623 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnBox
1624 (aBox,aShape, theShapeType,ShapeState(theState));
1625 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1626 return aSeq._retn();
1628 Standard_Integer aLength = aHSeq->Length();
1629 aSeq->length(aLength);
1630 for (Standard_Integer i = 1; i <= aLength; i++)
1631 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1633 return aSeq._retn();
1636 //=============================================================================
1638 * GetShapesOnQuadrangleIDs
1640 //=============================================================================
1641 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnBoxIDs
1642 (GEOM::GEOM_Object_ptr theBox,
1643 GEOM::GEOM_Object_ptr theShape,
1644 CORBA::Long theShapeType,
1645 GEOM::shape_state theState)
1647 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1649 //Set a not done flag
1650 GetOperations()->SetNotDone();
1652 //Get the reference objects
1653 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1654 Handle(GEOM_Object) aBox = GetObjectImpl(theBox);
1656 if (aShape.IsNull() || aBox.IsNull() )
1657 return aSeq._retn();
1660 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnBoxIDs
1661 (aBox,aShape, theShapeType,ShapeState(theState));
1662 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1663 return aSeq._retn();
1665 Standard_Integer aLength = aHSeq->Length();
1666 aSeq->length(aLength);
1667 for (Standard_Integer i = 1; i <= aLength; i++)
1668 aSeq[i-1] = aHSeq->Value(i);
1670 return aSeq._retn();
1674 //=============================================================================
1678 //=============================================================================
1679 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnShape
1680 (GEOM::GEOM_Object_ptr theCheckShape,
1681 GEOM::GEOM_Object_ptr theShape,
1682 CORBA::Short theShapeType,
1683 GEOM::shape_state theState)
1685 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1687 //Set a not done flag
1688 GetOperations()->SetNotDone();
1690 //Get the reference objects
1691 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1692 Handle(GEOM_Object) aCheckShape = GetObjectImpl(theCheckShape);
1694 if (aShape.IsNull() || aCheckShape.IsNull() )
1695 return aSeq._retn();
1697 //Get Shapes On Shape
1698 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnShape
1699 (aCheckShape,aShape, theShapeType,ShapeState(theState));
1701 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1702 return aSeq._retn();
1704 Standard_Integer aLength = aHSeq->Length();
1705 aSeq->length(aLength);
1706 for (Standard_Integer i = 1; i <= aLength; i++)
1707 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1709 return aSeq._retn();
1713 //=============================================================================
1715 * GetShapesOnShapeAsCompound
1717 //=============================================================================
1718 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetShapesOnShapeAsCompound
1719 (GEOM::GEOM_Object_ptr theCheckShape,
1720 GEOM::GEOM_Object_ptr theShape,
1721 CORBA::Short theShapeType,
1722 GEOM::shape_state theState)
1724 GEOM::GEOM_Object_var aGEOMObject;
1726 //Set a not done flag
1727 GetOperations()->SetNotDone();
1729 //Get the reference objects
1730 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1731 Handle(GEOM_Object) aCheckShape = GetObjectImpl(theCheckShape);
1733 if (aShape.IsNull() || aCheckShape.IsNull() )
1734 return aGEOMObject._retn();
1736 //Get Shapes On Shape
1737 Handle(GEOM_Object) anObject = GetOperations()->GetShapesOnShapeAsCompound
1738 (aCheckShape,aShape, theShapeType,ShapeState(theState));
1740 if (anObject.IsNull())
1741 return aGEOMObject._retn();
1743 return GetObject(anObject);
1747 //=============================================================================
1749 * GetShapesOnShapeIDs
1751 //=============================================================================
1752 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnShapeIDs
1753 (GEOM::GEOM_Object_ptr theCheckShape,
1754 GEOM::GEOM_Object_ptr theShape,
1755 CORBA::Short theShapeType,
1756 GEOM::shape_state theState)
1758 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1760 //Set a not done flag
1761 GetOperations()->SetNotDone();
1763 //Get the reference objects
1764 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1765 Handle(GEOM_Object) aCheckShape = GetObjectImpl(theCheckShape);
1767 if (aShape.IsNull() || aCheckShape.IsNull() )
1768 return aSeq._retn();
1770 //Get Shapes On Shape
1771 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnShapeIDs
1772 (aCheckShape,aShape, theShapeType,ShapeState(theState));
1773 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1774 return aSeq._retn();
1776 Standard_Integer aLength = aHSeq->Length();
1777 aSeq->length(aLength);
1778 for (Standard_Integer i = 1; i <= aLength; i++)
1779 aSeq[i-1] = aHSeq->Value(i);
1781 return aSeq._retn();
1785 //=============================================================================
1789 //=============================================================================
1790 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlace
1791 (GEOM::GEOM_Object_ptr theShapeWhere,
1792 GEOM::GEOM_Object_ptr theShapeWhat)
1794 GEOM::GEOM_Object_var aGEOMObject;
1796 //Set a not done flag
1797 GetOperations()->SetNotDone();
1799 //Get the reference objects
1800 Handle(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
1801 Handle(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
1803 if (aShapeWhere.IsNull() ||
1804 aShapeWhat.IsNull()) return aGEOMObject._retn();
1806 //Get Shapes in place of aShapeWhat
1807 Handle(GEOM_Object) anObject =
1808 GetOperations()->GetInPlace(aShapeWhere, aShapeWhat);
1809 if (!GetOperations()->IsDone() || anObject.IsNull())
1810 return aGEOMObject._retn();
1812 return GetObject(anObject);
1815 //=============================================================================
1819 //=============================================================================
1820 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlaceOld
1821 (GEOM::GEOM_Object_ptr theShapeWhere,
1822 GEOM::GEOM_Object_ptr theShapeWhat)
1824 GEOM::GEOM_Object_var aGEOMObject;
1826 //Set a not done flag
1827 GetOperations()->SetNotDone();
1829 //Get the reference objects
1830 Handle(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
1831 Handle(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
1833 if (aShapeWhere.IsNull() ||
1834 aShapeWhat.IsNull()) return aGEOMObject._retn();
1836 //Get Shapes in place of aShapeWhat
1837 Handle(GEOM_Object) anObject =
1838 GetOperations()->GetInPlaceOld(aShapeWhere, aShapeWhat);
1839 if (!GetOperations()->IsDone() || anObject.IsNull())
1840 return aGEOMObject._retn();
1842 return GetObject(anObject);
1845 //=============================================================================
1847 * GetInPlaceByHistory
1849 //=============================================================================
1850 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlaceByHistory
1851 (GEOM::GEOM_Object_ptr theShapeWhere,
1852 GEOM::GEOM_Object_ptr theShapeWhat)
1854 GEOM::GEOM_Object_var aGEOMObject;
1856 //Set a not done flag
1857 GetOperations()->SetNotDone();
1859 //Get the reference objects
1860 Handle(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
1861 Handle(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
1863 if (aShapeWhere.IsNull() ||
1864 aShapeWhat.IsNull()) return aGEOMObject._retn();
1866 //Get Shapes in place of aShapeWhat
1867 Handle(GEOM_Object) anObject =
1868 GetOperations()->GetInPlaceByHistory(aShapeWhere, aShapeWhat);
1869 if (!GetOperations()->IsDone() || anObject.IsNull())
1870 return aGEOMObject._retn();
1872 return GetObject(anObject);
1875 //=============================================================================
1879 //=============================================================================
1880 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetSame
1881 (GEOM::GEOM_Object_ptr theShapeWhere,
1882 GEOM::GEOM_Object_ptr theShapeWhat)
1884 GEOM::GEOM_Object_var aGEOMObject;
1886 //Set a not done flag
1887 GetOperations()->SetNotDone();
1889 //Get the reference objects
1890 Handle(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
1891 Handle(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
1893 if (aShapeWhere.IsNull() ||
1894 aShapeWhat.IsNull()) return aGEOMObject._retn();
1896 //Get Shapes in place of aShapeWhat
1897 Handle(GEOM_Object) anObject =
1898 GetOperations()->GetSame(aShapeWhere, aShapeWhat);
1899 if (!GetOperations()->IsDone() || anObject.IsNull())
1900 return aGEOMObject._retn();
1902 return GetObject(anObject);
1905 //=============================================================================
1909 //=============================================================================
1910 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetSameIDs
1911 (GEOM::GEOM_Object_ptr theShapeWhere,
1912 GEOM::GEOM_Object_ptr theShapeWhat) {
1913 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1915 //Get the reference objects
1916 Handle(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
1917 Handle(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
1919 if (aShapeWhere.IsNull() ||
1920 aShapeWhat.IsNull()) return aSeq._retn();
1923 Handle(TColStd_HSequenceOfInteger) aHSeq =
1924 GetOperations()->GetSameIDs(aShapeWhere, aShapeWhat);
1926 if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
1928 Standard_Integer aLength = aHSeq->Length();
1929 aSeq->length(aLength);
1930 for (Standard_Integer i = 1; i <= aLength; i++)
1931 aSeq[i-1] = aHSeq->Value(i);
1933 return aSeq._retn();