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 //=============================================================================
253 //=============================================================================
254 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeShell
255 (const GEOM::ListOfGO& theFacesAndShells)
257 GEOM::GEOM_Object_var aGEOMObject;
259 //Set a not done flag
260 GetOperations()->SetNotDone();
263 std::list<Handle(GEOM_Object)> aShapes;
266 aLen = theFacesAndShells.length();
267 for (ind = 0; ind < aLen; ind++) {
268 Handle(GEOM_Object) aSh = GetObjectImpl(theFacesAndShells[ind]);
269 if (aSh.IsNull()) return aGEOMObject._retn();
270 aShapes.push_back(aSh);
274 Handle(GEOM_Object) anObject =
275 GetOperations()->MakeShell(aShapes);
276 if (!GetOperations()->IsDone() || anObject.IsNull())
277 return aGEOMObject._retn();
279 return GetObject(anObject);
282 //=============================================================================
286 //=============================================================================
287 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeSolidShell
288 (GEOM::GEOM_Object_ptr theShell)
290 GEOM::GEOM_Object_var aGEOMObject;
292 //Set a not done flag
293 GetOperations()->SetNotDone();
295 //Get the reference objects
296 Handle(GEOM_Object) aShell = GetObjectImpl(theShell);
297 if (aShell.IsNull()) return aGEOMObject._retn();
299 std::list<Handle(GEOM_Object)> aShapes;
300 aShapes.push_back(aShell);
303 Handle(GEOM_Object) anObject = GetOperations()->MakeSolidShells(aShapes);
304 if (!GetOperations()->IsDone() || anObject.IsNull())
305 return aGEOMObject._retn();
307 return GetObject(anObject);
310 //=============================================================================
314 //=============================================================================
315 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeSolidShells
316 (const GEOM::ListOfGO& theShells)
318 GEOM::GEOM_Object_var aGEOMObject;
320 //Set a not done flag
321 GetOperations()->SetNotDone();
324 std::list<Handle(GEOM_Object)> aShapes;
327 aLen = theShells.length();
328 for (ind = 0; ind < aLen; ind++) {
329 Handle(GEOM_Object) aSh = GetObjectImpl(theShells[ind]);
330 if (aSh.IsNull()) return aGEOMObject._retn();
331 aShapes.push_back(aSh);
335 Handle(GEOM_Object) anObject =
336 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::MakeCompound
349 (const GEOM::ListOfGO& theShapes)
351 GEOM::GEOM_Object_var aGEOMObject;
353 //Set a not done flag
354 GetOperations()->SetNotDone();
357 std::list<Handle(GEOM_Object)> aShapes;
360 aLen = theShapes.length();
361 for (ind = 0; ind < aLen; ind++) {
362 Handle(GEOM_Object) aSh = GetObjectImpl(theShapes[ind]);
363 if (aSh.IsNull()) return aGEOMObject._retn();
364 aShapes.push_back(aSh);
368 Handle(GEOM_Object) anObject =
369 GetOperations()->MakeCompound(aShapes);
370 if (!GetOperations()->IsDone() || anObject.IsNull())
371 return aGEOMObject._retn();
373 return GetObject(anObject);
376 //=============================================================================
380 //=============================================================================
381 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFaces
382 (GEOM::GEOM_Object_ptr theShape,
383 CORBA::Double theTolerance,
384 CORBA::Boolean doKeepNonSolids)
386 GEOM::GEOM_Object_var aGEOMObject;
388 //Set a not done flag
389 GetOperations()->SetNotDone();
391 //Get the reference objects
392 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
393 if (aShape.IsNull()) return aGEOMObject._retn();
396 Handle(GEOM_Object) anObject =
397 GetOperations()->MakeGlueFaces(aShape, theTolerance, doKeepNonSolids);
398 //if (!GetOperations()->IsDone() || anObject.IsNull())
400 if (anObject.IsNull())
401 return aGEOMObject._retn();
403 return GetObject(anObject);
406 //=============================================================================
410 //=============================================================================
411 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetGlueFaces
412 (GEOM::GEOM_Object_ptr theShape,
413 const CORBA::Double theTolerance)
415 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
417 //Set a not done flag
418 GetOperations()->SetNotDone();
420 //Get the reference objects
421 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
422 if (aShape.IsNull()) return aSeq._retn();
424 Handle(TColStd_HSequenceOfTransient) aHSeq =
425 //GetOperations()->GetGlueFaces(aShape, theTolerance);
426 GetOperations()->GetGlueShapes(aShape, theTolerance, TopAbs_FACE);
428 //if (!GetOperations()->IsDone() || aHSeq.IsNull())
433 Standard_Integer aLength = aHSeq->Length();
434 aSeq->length(aLength);
435 for (Standard_Integer i = 1; i <= aLength; i++)
436 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
441 //=============================================================================
443 * MakeGlueFacesByList
445 //=============================================================================
446 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFacesByList
447 (GEOM::GEOM_Object_ptr theShape,
448 CORBA::Double theTolerance,
449 const GEOM::ListOfGO& theFaces,
450 CORBA::Boolean doKeepNonSolids,
451 CORBA::Boolean doGlueAllEdges)
453 GEOM::GEOM_Object_var aGEOMObject;
455 //Set a not done flag
456 GetOperations()->SetNotDone();
458 //Get the reference objects
459 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
460 if (aShape.IsNull()) return aGEOMObject._retn();
463 std::list<Handle(GEOM_Object)> aFaces;
465 aLen = theFaces.length();
466 for (ind = 0; ind < aLen; ind++) {
467 Handle(GEOM_Object) aSh = GetObjectImpl(theFaces[ind]);
468 if (aSh.IsNull()) return aGEOMObject._retn();
469 aFaces.push_back(aSh);
473 Handle(GEOM_Object) anObject =
474 GetOperations()->MakeGlueFacesByList(aShape, theTolerance, aFaces, doKeepNonSolids, doGlueAllEdges);
475 //if (!GetOperations()->IsDone() || anObject.IsNull())
477 if (anObject.IsNull())
478 return aGEOMObject._retn();
480 return GetObject(anObject);
483 //=============================================================================
487 //=============================================================================
488 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueEdges
489 (GEOM::GEOM_Object_ptr theShape,
490 CORBA::Double theTolerance)
492 GEOM::GEOM_Object_var aGEOMObject;
494 //Set a not done flag
495 GetOperations()->SetNotDone();
497 //Get the reference objects
498 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
499 if (aShape.IsNull()) return aGEOMObject._retn();
502 Handle(GEOM_Object) anObject =
503 GetOperations()->MakeGlueEdges(aShape, theTolerance);
504 //if (!GetOperations()->IsDone() || anObject.IsNull())
506 if (anObject.IsNull())
507 return aGEOMObject._retn();
509 return GetObject(anObject);
512 //=============================================================================
516 //=============================================================================
517 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetGlueEdges
518 (GEOM::GEOM_Object_ptr theShape,
519 const CORBA::Double theTolerance)
521 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
523 //Set a not done flag
524 GetOperations()->SetNotDone();
526 //Get the reference objects
527 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
528 if (aShape.IsNull()) return aSeq._retn();
530 Handle(TColStd_HSequenceOfTransient) aHSeq =
531 GetOperations()->GetGlueShapes(aShape, theTolerance, TopAbs_EDGE);
533 //if (!GetOperations()->IsDone() || aHSeq.IsNull())
538 Standard_Integer aLength = aHSeq->Length();
539 aSeq->length(aLength);
540 for (Standard_Integer i = 1; i <= aLength; i++)
541 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
546 //=============================================================================
548 * MakeGlueEdgesByList
550 //=============================================================================
551 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueEdgesByList
552 (GEOM::GEOM_Object_ptr theShape,
553 CORBA::Double theTolerance,
554 const GEOM::ListOfGO& theEdges)
556 GEOM::GEOM_Object_var aGEOMObject;
558 //Set a not done flag
559 GetOperations()->SetNotDone();
561 //Get the reference objects
562 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
563 if (aShape.IsNull()) return aGEOMObject._retn();
566 std::list<Handle(GEOM_Object)> anEdges;
568 aLen = theEdges.length();
569 for (ind = 0; ind < aLen; ind++) {
570 Handle(GEOM_Object) aSh = GetObjectImpl(theEdges[ind]);
571 if (aSh.IsNull()) return aGEOMObject._retn();
572 anEdges.push_back(aSh);
576 Handle(GEOM_Object) anObject =
577 GetOperations()->MakeGlueEdgesByList(aShape, theTolerance, anEdges);
578 //if (!GetOperations()->IsDone() || anObject.IsNull())
580 if (anObject.IsNull())
581 return aGEOMObject._retn();
583 return GetObject(anObject);
586 //=============================================================================
588 * GetExistingSubObjects
590 //=============================================================================
591 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetExistingSubObjects (GEOM::GEOM_Object_ptr theShape,
592 CORBA::Boolean theGroupsOnly)
594 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
596 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
597 if (aShape.IsNull()) return aSeq._retn();
599 Handle(TColStd_HSequenceOfTransient) aHSeq =
600 GetOperations()->GetExistingSubObjects(aShape, theGroupsOnly);
601 if (!GetOperations()->IsDone() || aHSeq.IsNull())
604 Standard_Integer aLength = aHSeq->Length();
605 aSeq->length(aLength);
606 for (Standard_Integer i = 1; i <= aLength; i++)
607 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
612 //=============================================================================
614 * MakeExplode (including theShape itself, bad sorting)
616 //=============================================================================
617 GEOM::ListOfGO* GEOM_IShapesOperations_i::MakeExplode (GEOM::GEOM_Object_ptr theShape,
618 const CORBA::Long theShapeType,
619 const CORBA::Boolean isSorted)
621 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
623 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
624 if (aShape.IsNull()) return aSeq._retn();
626 Handle(TColStd_HSequenceOfTransient) aHSeq =
627 GetOperations()->MakeExplode(aShape, theShapeType, isSorted,
628 GEOMImpl_IShapesOperations::EXPLODE_OLD_INCLUDE_MAIN);
629 if (!GetOperations()->IsDone() || aHSeq.IsNull())
632 Standard_Integer aLength = aHSeq->Length();
633 aSeq->length(aLength);
634 for (Standard_Integer i = 1; i <= aLength; i++)
635 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
640 //=============================================================================
642 * MakeAllSubShapes (including theShape itself, good sorting)
644 //=============================================================================
645 GEOM::ListOfGO* GEOM_IShapesOperations_i::MakeAllSubShapes (GEOM::GEOM_Object_ptr theShape,
646 const CORBA::Long theShapeType,
647 const CORBA::Boolean isSorted)
649 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
651 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
652 if (aShape.IsNull()) return aSeq._retn();
654 Handle(TColStd_HSequenceOfTransient) aHSeq =
655 GetOperations()->MakeExplode(aShape, theShapeType, isSorted,
656 GEOMImpl_IShapesOperations::EXPLODE_NEW_INCLUDE_MAIN);
657 if (!GetOperations()->IsDone() || aHSeq.IsNull())
660 Standard_Integer aLength = aHSeq->Length();
661 aSeq->length(aLength);
662 for (Standard_Integer i = 1; i <= aLength; i++)
663 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
668 //=============================================================================
670 * ExtractSubShapes (excluding theShape itself, good sorting)
672 //=============================================================================
673 GEOM::ListOfGO* GEOM_IShapesOperations_i::ExtractSubShapes (GEOM::GEOM_Object_ptr theShape,
674 const CORBA::Long theShapeType,
675 const CORBA::Boolean isSorted)
677 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
679 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
680 if (aShape.IsNull()) return aSeq._retn();
682 Handle(TColStd_HSequenceOfTransient) aHSeq =
683 // TODO: enum instead of bool for the last argument
684 GetOperations()->MakeExplode(aShape, theShapeType, isSorted,
685 GEOMImpl_IShapesOperations::EXPLODE_NEW_EXCLUDE_MAIN);
686 if (!GetOperations()->IsDone() || aHSeq.IsNull())
689 Standard_Integer aLength = aHSeq->Length();
690 aSeq->length(aLength);
691 for (Standard_Integer i = 1; i <= aLength; i++)
692 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
697 //=============================================================================
701 //=============================================================================
702 GEOM::ListOfLong* GEOM_IShapesOperations_i::SubShapeAllIDs (GEOM::GEOM_Object_ptr theShape,
703 const CORBA::Long theShapeType,
704 const CORBA::Boolean isSorted)
706 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
708 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
709 if (aShape.IsNull()) return aSeq._retn();
711 Handle(TColStd_HSequenceOfInteger) aHSeq =
712 GetOperations()->SubShapeAllIDs(aShape, theShapeType, isSorted,
713 GEOMImpl_IShapesOperations::EXPLODE_OLD_INCLUDE_MAIN);
714 if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
716 Standard_Integer aLength = aHSeq->Length();
717 aSeq->length(aLength);
718 for (Standard_Integer i = 1; i <= aLength; i++)
719 aSeq[i-1] = aHSeq->Value(i);
724 //=============================================================================
728 //=============================================================================
729 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetAllSubShapesIDs (GEOM::GEOM_Object_ptr theShape,
730 const CORBA::Long theShapeType,
731 const CORBA::Boolean isSorted)
733 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
735 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
736 if (aShape.IsNull()) return aSeq._retn();
738 Handle(TColStd_HSequenceOfInteger) aHSeq =
739 GetOperations()->SubShapeAllIDs(aShape, theShapeType, isSorted,
740 GEOMImpl_IShapesOperations::EXPLODE_NEW_INCLUDE_MAIN);
741 if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
743 Standard_Integer aLength = aHSeq->Length();
744 aSeq->length(aLength);
745 for (Standard_Integer i = 1; i <= aLength; i++)
746 aSeq[i-1] = aHSeq->Value(i);
751 //=============================================================================
755 //=============================================================================
756 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetSubShape
757 (GEOM::GEOM_Object_ptr theMainShape,
758 const CORBA::Long theID)
760 GEOM::GEOM_Object_var aGEOMObject;
762 //Set a not done flag
763 GetOperations()->SetNotDone();
765 //Get the reference objects
766 Handle(GEOM_Object) aShape = GetObjectImpl(theMainShape);
767 if (aShape.IsNull()) return aGEOMObject._retn();
769 Handle(GEOM_Object) anObject = GetOperations()->GetSubShape(aShape, theID);
770 if (!GetOperations()->IsDone() || anObject.IsNull())
771 return aGEOMObject._retn();
773 return GetObject(anObject);
776 //=============================================================================
780 //=============================================================================
781 GEOM::ListOfGO* GEOM_IShapesOperations_i::MakeSubShapes (GEOM::GEOM_Object_ptr theMainShape,
782 const GEOM::ListOfLong& theIndices)
784 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
787 //Set a not done flag
788 GetOperations()->SetNotDone();
790 if (theIndices.length() < 1)
793 Handle(GEOM_Object) aShape = GetObjectImpl(theMainShape);
794 if (aShape.IsNull()) return aSeq._retn();
796 Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger (1, theIndices.length());
797 for (i = 0; i < theIndices.length(); i++)
798 anArray->SetValue(i+1, theIndices[i]);
800 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakeSubShapes(aShape, anArray);
801 if (!GetOperations()->IsDone() || aHSeq.IsNull())
804 Standard_Integer aLength = aHSeq->Length();
805 aSeq->length(aLength);
806 for (i = 0; i < aLength; i++)
807 aSeq[i] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i+1)));
812 //=============================================================================
816 //=============================================================================
817 CORBA::Long GEOM_IShapesOperations_i::GetSubShapeIndex
818 (GEOM::GEOM_Object_ptr theMainShape, GEOM::GEOM_Object_ptr theSubShape)
820 //Get the reference shapes
821 Handle(GEOM_Object) aMainShapeRef = GetObjectImpl(theMainShape);
822 Handle(GEOM_Object) aSubShapeRef = GetObjectImpl(theSubShape);
824 if (aMainShapeRef.IsNull() || aSubShapeRef.IsNull()) return -1;
826 //Get the unique ID of <theSubShape> inside <theMainShape>
827 CORBA::Long anID = GetOperations()->GetSubShapeIndex(aMainShapeRef, aSubShapeRef);
828 if (!GetOperations()->IsDone())
834 //=============================================================================
836 * GetSubShapesIndices
838 //=============================================================================
839 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetSubShapesIndices
840 (GEOM::GEOM_Object_ptr theMainShape, const GEOM::ListOfGO& theSubShapes)
842 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
844 //Get the reference main shape
845 Handle(GEOM_Object) aMainShapeRef = GetObjectImpl(theMainShape);
846 if (aMainShapeRef.IsNull()) return aSeq._retn();
849 std::list<Handle(GEOM_Object)> aShapes;
850 int aLen = theSubShapes.length();
851 for (int ind = 0; ind < aLen; ind++) {
852 Handle(GEOM_Object) aSh = GetObjectImpl(theSubShapes[ind]);
855 MESSAGE("NULL shape")
858 aShapes.push_back(aSh);
861 //Get the IDs of <theSubShapes> inside <theMainShape>
862 Handle(TColStd_HSequenceOfInteger) aHSeq =
863 GetOperations()->GetSubShapesIndices(aMainShapeRef, aShapes);
865 if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
867 Standard_Integer aLength = aHSeq->Length();
868 aSeq->length(aLength);
870 for (Standard_Integer i = 1; i <= aLength; i++)
871 aSeq[i-1] = aHSeq->Value(i);
877 //=============================================================================
881 //=============================================================================
882 CORBA::Long GEOM_IShapesOperations_i::GetTopologyIndex
883 (GEOM::GEOM_Object_ptr theMainShape, GEOM::GEOM_Object_ptr theSubShape)
885 //Get the reference shapes
886 Handle(GEOM_Object) aMainShapeRef = GetObjectImpl(theMainShape);
887 Handle(GEOM_Object) aSubShapeRef = GetObjectImpl(theSubShape);
889 if (aMainShapeRef.IsNull() || aSubShapeRef.IsNull()) return -1;
891 //Get an ID of <theSubShape>, unique among all sub-shapes of <theMainShape> of the same type
892 CORBA::Long anID = GetOperations()->GetTopologyIndex(aMainShapeRef, aSubShapeRef);
893 if (!GetOperations()->IsDone())
899 //=============================================================================
903 //=============================================================================
904 char* GEOM_IShapesOperations_i::GetShapeTypeString (GEOM::GEOM_Object_ptr theShape)
906 //Get the reference shape
907 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
908 if (aShape.IsNull()) return NULL;
910 // Get shape parameters
911 TCollection_AsciiString aDescription = GetOperations()->GetShapeTypeString(aShape);
912 return CORBA::string_dup(aDescription.ToCString());
915 //=============================================================================
919 //=============================================================================
920 CORBA::Long GEOM_IShapesOperations_i::NumberOfFaces (GEOM::GEOM_Object_ptr theShape)
922 return NumberOfSubShapes(theShape, Standard_Integer(TopAbs_FACE));
925 //=============================================================================
929 //=============================================================================
930 CORBA::Long GEOM_IShapesOperations_i::NumberOfEdges (GEOM::GEOM_Object_ptr theShape)
932 return NumberOfSubShapes(theShape, Standard_Integer(TopAbs_EDGE));
935 //=============================================================================
939 //=============================================================================
940 CORBA::Long GEOM_IShapesOperations_i::NumberOfSubShapes (GEOM::GEOM_Object_ptr theShape,
941 const CORBA::Long theShapeType)
943 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
944 if (aShape.IsNull()) return -1;
946 CORBA::Long aNb = GetOperations()->NumberOfSubShapes(aShape, theShapeType);
947 if (!GetOperations()->IsDone()) return -1;
952 //=============================================================================
956 //=============================================================================
957 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::ChangeOrientation
958 (GEOM::GEOM_Object_ptr theShape)
960 GEOM::GEOM_Object_var aGEOMObject;
962 //Set a not done flag
963 GetOperations()->SetNotDone();
965 //Get the reference objects
966 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
967 if (aShape.IsNull()) return aGEOMObject._retn();
970 Handle(GEOM_Object) anObject = GetOperations()->ReverseShape(aShape);
971 if (!GetOperations()->IsDone() || anObject.IsNull())
972 return aGEOMObject._retn();
974 return GetObject(anObject);
977 //=============================================================================
981 //=============================================================================
982 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetFreeFacesIDs (GEOM::GEOM_Object_ptr theShape)
984 //Set a not done flag
985 GetOperations()->SetNotDone();
987 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
989 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
990 if (aShape.IsNull()) return aSeq._retn();
992 Handle(TColStd_HSequenceOfInteger) aHSeq =
993 GetOperations()->GetFreeFacesIDs(aShape);
994 if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
996 Standard_Integer aLength = aHSeq->Length();
997 aSeq->length(aLength);
998 for (Standard_Integer i = 1; i <= aLength; i++)
999 aSeq[i-1] = aHSeq->Value(i);
1001 return aSeq._retn();
1004 //=============================================================================
1008 //=============================================================================
1009 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSharedShapes
1010 (GEOM::GEOM_Object_ptr theShape1,
1011 GEOM::GEOM_Object_ptr theShape2,
1012 const CORBA::Long theShapeType)
1014 //Set a not done flag
1015 GetOperations()->SetNotDone();
1017 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1019 Handle(GEOM_Object) aShape1 = GetObjectImpl(theShape1);
1020 Handle(GEOM_Object) aShape2 = GetObjectImpl(theShape2);
1022 if (aShape1.IsNull() || aShape2.IsNull()) return aSeq._retn();
1024 Handle(TColStd_HSequenceOfTransient) aHSeq =
1025 GetOperations()->GetSharedShapes(aShape1, aShape2, theShapeType);
1026 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1027 return aSeq._retn();
1029 Standard_Integer aLength = aHSeq->Length();
1030 aSeq->length(aLength);
1031 for (Standard_Integer i = 1; i <= aLength; i++)
1032 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1034 return aSeq._retn();
1037 //=============================================================================
1039 * GetSharedShapesMulti
1041 //=============================================================================
1042 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSharedShapesMulti
1043 (const GEOM::ListOfGO& theShapes,
1044 const CORBA::Long theShapeType)
1046 //Set a not done flag
1047 GetOperations()->SetNotDone();
1049 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1052 std::list<Handle(GEOM_Object)> aShapes;
1053 int aLen = theShapes.length();
1054 for (int ind = 0; ind < aLen; ind++) {
1055 Handle(GEOM_Object) aSh = GetObjectImpl(theShapes[ind]);
1056 if (aSh.IsNull()) return aSeq._retn();
1057 aShapes.push_back(aSh);
1060 Handle(TColStd_HSequenceOfTransient) aHSeq =
1061 GetOperations()->GetSharedShapes(aShapes, theShapeType);
1062 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1063 return aSeq._retn();
1065 Standard_Integer aLength = aHSeq->Length();
1066 aSeq->length(aLength);
1067 for (Standard_Integer i = 1; i <= aLength; i++)
1068 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1070 return aSeq._retn();
1073 static GEOMAlgo_State ShapeState (const GEOM::shape_state theState)
1075 GEOMAlgo_State aState = GEOMAlgo_ST_UNKNOWN;
1079 aState = GEOMAlgo_ST_ON;
1082 aState = GEOMAlgo_ST_OUT;
1084 case GEOM::ST_ONOUT:
1085 aState = GEOMAlgo_ST_ONOUT;
1088 aState = GEOMAlgo_ST_IN;
1091 aState = GEOMAlgo_ST_ONIN;
1100 //=============================================================================
1104 //=============================================================================
1105 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnPlane
1106 (GEOM::GEOM_Object_ptr theShape,
1107 const CORBA::Long theShapeType,
1108 GEOM::GEOM_Object_ptr theAx1,
1109 const GEOM::shape_state theState)
1111 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1113 //Set a not done flag
1114 GetOperations()->SetNotDone();
1116 //Get the reference objects
1117 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1118 Handle(GEOM_Object) anAx1 = GetObjectImpl(theAx1);
1120 if (aShape.IsNull() || anAx1.IsNull()) return aSeq._retn();
1122 //Get Shapes On Plane
1123 Handle(TColStd_HSequenceOfTransient) aHSeq =
1124 GetOperations()->GetShapesOnPlane(aShape, theShapeType, anAx1, ShapeState(theState));
1125 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1126 return aSeq._retn();
1128 Standard_Integer aLength = aHSeq->Length();
1129 aSeq->length(aLength);
1130 for (Standard_Integer i = 1; i <= aLength; i++)
1131 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1133 return aSeq._retn();
1136 //=============================================================================
1138 * GetShapesOnPlaneWithLocation
1140 //=============================================================================
1141 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnPlaneWithLocation
1142 (GEOM::GEOM_Object_ptr theShape,
1143 const CORBA::Long theShapeType,
1144 GEOM::GEOM_Object_ptr theAx1,
1145 GEOM::GEOM_Object_ptr thePnt,
1146 const GEOM::shape_state theState)
1148 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1150 //Set a not done flag
1151 GetOperations()->SetNotDone();
1153 //Get the reference objects
1154 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1155 Handle(GEOM_Object) anAx1 = GetObjectImpl(theAx1);
1156 Handle(GEOM_Object) anPnt = GetObjectImpl(thePnt);
1158 if (aShape.IsNull() || anAx1.IsNull() || anPnt.IsNull()) return aSeq._retn();
1160 //Get Shapes On Plane
1161 Handle(TColStd_HSequenceOfTransient) aHSeq =
1162 GetOperations()->GetShapesOnPlaneWithLocation(aShape, theShapeType, anAx1, anPnt, ShapeState(theState));
1163 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1164 return aSeq._retn();
1166 Standard_Integer aLength = aHSeq->Length();
1167 aSeq->length(aLength);
1168 for (Standard_Integer i = 1; i <= aLength; i++)
1169 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1171 return aSeq._retn();
1174 //=============================================================================
1176 * GetShapesOnCylinder
1178 //=============================================================================
1179 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnCylinder
1180 (GEOM::GEOM_Object_ptr theShape,
1181 const CORBA::Long theShapeType,
1182 GEOM::GEOM_Object_ptr theAxis,
1183 const CORBA::Double theRadius,
1184 const GEOM::shape_state theState)
1186 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1188 //Set a not done flag
1189 GetOperations()->SetNotDone();
1191 //Get the reference objects
1192 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1193 Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
1195 if (aShape.IsNull() || anAxis.IsNull()) return aSeq._retn();
1197 //Get Shapes On Cylinder
1198 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnCylinder
1199 (aShape, theShapeType, anAxis, theRadius, ShapeState(theState));
1200 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1201 return aSeq._retn();
1203 Standard_Integer aLength = aHSeq->Length();
1204 aSeq->length(aLength);
1205 for (Standard_Integer i = 1; i <= aLength; i++)
1206 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1208 return aSeq._retn();
1211 //=============================================================================
1213 * GetShapesOnCylinderWithLocation
1215 //=============================================================================
1216 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnCylinderWithLocation
1217 (GEOM::GEOM_Object_ptr theShape,
1218 const CORBA::Long theShapeType,
1219 GEOM::GEOM_Object_ptr theAxis,
1220 GEOM::GEOM_Object_ptr thePnt,
1221 const CORBA::Double theRadius,
1222 const GEOM::shape_state theState)
1224 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1226 //Set a not done flag
1227 GetOperations()->SetNotDone();
1229 //Get the reference objects
1230 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1231 Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
1232 Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
1234 if (aShape.IsNull() || anAxis.IsNull() || aPnt.IsNull()) return aSeq._retn();
1236 //Get Shapes On Cylinder
1237 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnCylinderWithLocation
1238 (aShape, theShapeType, anAxis, aPnt, theRadius, ShapeState(theState));
1239 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1240 return aSeq._retn();
1242 Standard_Integer aLength = aHSeq->Length();
1243 aSeq->length(aLength);
1244 for (Standard_Integer i = 1; i <= aLength; i++)
1245 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1247 return aSeq._retn();
1250 //=============================================================================
1254 //=============================================================================
1255 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnSphere
1256 (GEOM::GEOM_Object_ptr theShape,
1257 const CORBA::Long theShapeType,
1258 GEOM::GEOM_Object_ptr theCenter,
1259 const CORBA::Double theRadius,
1260 const GEOM::shape_state theState)
1262 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1264 //Set a not done flag
1265 GetOperations()->SetNotDone();
1267 //Get the reference objects
1268 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1269 Handle(GEOM_Object) aCenter = GetObjectImpl(theCenter);
1271 if (aShape.IsNull() || aCenter.IsNull()) return aSeq._retn();
1273 //Get Shapes On Sphere
1274 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnSphere
1275 (aShape, theShapeType, aCenter, theRadius, ShapeState(theState));
1276 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1277 return aSeq._retn();
1279 Standard_Integer aLength = aHSeq->Length();
1280 aSeq->length(aLength);
1281 for (Standard_Integer i = 1; i <= aLength; i++)
1282 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1284 return aSeq._retn();
1287 //=============================================================================
1289 * GetShapesOnQuadrangle
1291 //=============================================================================
1292 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnQuadrangle
1293 (GEOM::GEOM_Object_ptr theShape,
1294 CORBA::Long theShapeType,
1295 GEOM::GEOM_Object_ptr theTopLeftPoint,
1296 GEOM::GEOM_Object_ptr theTopRigthPoint,
1297 GEOM::GEOM_Object_ptr theBottomLeftPoint,
1298 GEOM::GEOM_Object_ptr theBottomRigthPoint,
1299 GEOM::shape_state theState)
1301 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1303 //Set a not done flag
1304 GetOperations()->SetNotDone();
1306 //Get the reference objects
1307 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1308 Handle(GEOM_Object) aTopLeftPoint = GetObjectImpl(theTopLeftPoint);
1309 Handle(GEOM_Object) aTopRigthPoint = GetObjectImpl(theTopRigthPoint);
1310 Handle(GEOM_Object) aBottomLeftPoint = GetObjectImpl(theBottomLeftPoint);
1311 Handle(GEOM_Object) aBottomRigthPoint = GetObjectImpl(theBottomRigthPoint);
1313 if (aShape.IsNull() ||
1314 aTopLeftPoint.IsNull() ||
1315 aTopRigthPoint.IsNull() ||
1316 aBottomLeftPoint.IsNull() ||
1317 aBottomRigthPoint.IsNull())
1318 return aSeq._retn();
1320 //Get Shapes On Quadrangle
1321 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnQuadrangle
1322 (aShape, theShapeType,
1323 aTopLeftPoint, aTopRigthPoint, aBottomLeftPoint, aBottomRigthPoint,
1324 ShapeState(theState));
1325 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1326 return aSeq._retn();
1328 Standard_Integer aLength = aHSeq->Length();
1329 aSeq->length(aLength);
1330 for (Standard_Integer i = 1; i <= aLength; i++)
1331 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1333 return aSeq._retn();
1336 //=============================================================================
1338 * GetShapesOnPlaneIDs
1340 //=============================================================================
1341 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnPlaneIDs
1342 (GEOM::GEOM_Object_ptr theShape,
1343 const CORBA::Long theShapeType,
1344 GEOM::GEOM_Object_ptr theAx1,
1345 const GEOM::shape_state theState)
1347 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1349 //Set a not done flag
1350 GetOperations()->SetNotDone();
1352 //Get the reference objects
1353 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1354 Handle(GEOM_Object) anAx1 = GetObjectImpl(theAx1);
1356 if (aShape.IsNull() || anAx1.IsNull()) return aSeq._retn();
1358 //Get Shapes On Plane
1359 Handle(TColStd_HSequenceOfInteger) aHSeq =
1360 GetOperations()->GetShapesOnPlaneIDs(aShape, theShapeType, anAx1, ShapeState(theState));
1361 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1362 return aSeq._retn();
1364 Standard_Integer aLength = aHSeq->Length();
1365 aSeq->length(aLength);
1366 for (Standard_Integer i = 1; i <= aLength; i++)
1367 aSeq[i-1] = aHSeq->Value(i);
1369 return aSeq._retn();
1372 //=============================================================================
1374 * GetShapesOnPlaneWithLocationIDs
1376 //=============================================================================
1377 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnPlaneWithLocationIDs
1378 (GEOM::GEOM_Object_ptr theShape,
1379 const CORBA::Long theShapeType,
1380 GEOM::GEOM_Object_ptr theAx1,
1381 GEOM::GEOM_Object_ptr thePnt,
1382 const GEOM::shape_state theState)
1384 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1386 //Set a not done flag
1387 GetOperations()->SetNotDone();
1389 //Get the reference objects
1390 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1391 Handle(GEOM_Object) anAx1 = GetObjectImpl(theAx1);
1392 Handle(GEOM_Object) anPnt = GetObjectImpl(thePnt);
1394 if (aShape.IsNull() || anAx1.IsNull() || anPnt.IsNull()) return aSeq._retn();
1396 //Get Shapes On Plane
1397 Handle(TColStd_HSequenceOfInteger) aHSeq =
1398 GetOperations()->GetShapesOnPlaneWithLocationIDs(aShape, theShapeType,
1399 anAx1, anPnt, ShapeState(theState));
1400 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1401 return aSeq._retn();
1403 Standard_Integer aLength = aHSeq->Length();
1404 aSeq->length(aLength);
1405 for (Standard_Integer i = 1; i <= aLength; i++)
1406 aSeq[i-1] = aHSeq->Value(i);
1408 return aSeq._retn();
1411 //=============================================================================
1413 * GetShapesOnCylinderIDs
1415 //=============================================================================
1416 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnCylinderIDs
1417 (GEOM::GEOM_Object_ptr theShape,
1418 const CORBA::Long theShapeType,
1419 GEOM::GEOM_Object_ptr theAxis,
1420 const CORBA::Double theRadius,
1421 const GEOM::shape_state theState)
1423 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1425 //Set a not done flag
1426 GetOperations()->SetNotDone();
1428 //Get the reference objects
1429 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1430 Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
1432 if (aShape.IsNull() || anAxis.IsNull()) return aSeq._retn();
1434 //Get Shapes On Cylinder
1435 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnCylinderIDs
1436 (aShape, theShapeType, anAxis, theRadius, ShapeState(theState));
1437 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1438 return aSeq._retn();
1440 Standard_Integer aLength = aHSeq->Length();
1441 aSeq->length(aLength);
1442 for (Standard_Integer i = 1; i <= aLength; i++)
1443 aSeq[i-1] = aHSeq->Value(i);
1445 return aSeq._retn();
1448 //=============================================================================
1450 * GetShapesOnCylinderWithLocationIDs
1452 //=============================================================================
1453 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnCylinderWithLocationIDs
1454 (GEOM::GEOM_Object_ptr theShape,
1455 const CORBA::Long theShapeType,
1456 GEOM::GEOM_Object_ptr theAxis,
1457 GEOM::GEOM_Object_ptr thePnt,
1458 const CORBA::Double theRadius,
1459 const GEOM::shape_state theState)
1461 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1463 //Set a not done flag
1464 GetOperations()->SetNotDone();
1466 //Get the reference objects
1467 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1468 Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
1469 Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
1471 if (aShape.IsNull() || anAxis.IsNull() || aPnt.IsNull()) return aSeq._retn();
1473 //Get Shapes On Cylinder
1474 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnCylinderWithLocationIDs
1475 (aShape, theShapeType, anAxis, aPnt, theRadius, ShapeState(theState));
1476 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1477 return aSeq._retn();
1479 Standard_Integer aLength = aHSeq->Length();
1480 aSeq->length(aLength);
1481 for (Standard_Integer i = 1; i <= aLength; i++)
1482 aSeq[i-1] = aHSeq->Value(i);
1484 return aSeq._retn();
1487 //=============================================================================
1489 * GetShapesOnSphereIDs
1491 //=============================================================================
1492 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnSphereIDs
1493 (GEOM::GEOM_Object_ptr theShape,
1494 const CORBA::Long theShapeType,
1495 GEOM::GEOM_Object_ptr theCenter,
1496 const CORBA::Double theRadius,
1497 const GEOM::shape_state theState)
1499 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1501 //Set a not done flag
1502 GetOperations()->SetNotDone();
1504 //Get the reference objects
1505 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1506 Handle(GEOM_Object) aCenter = GetObjectImpl(theCenter);
1508 if (aShape.IsNull() || aCenter.IsNull()) return aSeq._retn();
1510 //Get Shapes On Sphere
1511 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnSphereIDs
1512 (aShape, theShapeType, aCenter, theRadius, ShapeState(theState));
1513 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1514 return aSeq._retn();
1516 Standard_Integer aLength = aHSeq->Length();
1517 aSeq->length(aLength);
1518 for (Standard_Integer i = 1; i <= aLength; i++)
1519 aSeq[i-1] = aHSeq->Value(i);
1521 return aSeq._retn();
1524 //=============================================================================
1526 * GetShapesOnQuadrangleIDs
1528 //=============================================================================
1529 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnQuadrangleIDs
1530 (GEOM::GEOM_Object_ptr theShape,
1531 CORBA::Long theShapeType,
1532 GEOM::GEOM_Object_ptr theTopLeftPoint,
1533 GEOM::GEOM_Object_ptr theTopRigthPoint,
1534 GEOM::GEOM_Object_ptr theBottomLeftPoint,
1535 GEOM::GEOM_Object_ptr theBottomRigthPoint,
1536 GEOM::shape_state theState)
1538 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1540 //Set a not done flag
1541 GetOperations()->SetNotDone();
1543 //Get the reference objects
1544 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1545 Handle(GEOM_Object) aTopLeftPoint = GetObjectImpl(theTopLeftPoint);
1546 Handle(GEOM_Object) aTopRigthPoint = GetObjectImpl(theTopRigthPoint);
1547 Handle(GEOM_Object) aBottomLeftPoint = GetObjectImpl(theBottomLeftPoint);
1548 Handle(GEOM_Object) aBottomRigthPoint = GetObjectImpl(theBottomRigthPoint);
1550 if (aShape.IsNull() ||
1551 aTopLeftPoint.IsNull() ||
1552 aTopRigthPoint.IsNull() ||
1553 aBottomLeftPoint.IsNull() ||
1554 aBottomRigthPoint.IsNull() )
1555 return aSeq._retn();
1557 //Get Shapes On Quadrangle
1558 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnQuadrangleIDs
1559 (aShape, theShapeType,
1560 aTopLeftPoint, aTopRigthPoint, aBottomLeftPoint, aBottomRigthPoint,
1561 ShapeState(theState));
1562 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1563 return aSeq._retn();
1565 Standard_Integer aLength = aHSeq->Length();
1566 aSeq->length(aLength);
1567 for (Standard_Integer i = 1; i <= aLength; i++)
1568 aSeq[i-1] = aHSeq->Value(i);
1570 return aSeq._retn();
1573 //=============================================================================
1577 //=============================================================================
1578 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnBox
1579 (GEOM::GEOM_Object_ptr theBox,
1580 GEOM::GEOM_Object_ptr theShape,
1581 CORBA::Long theShapeType,
1582 GEOM::shape_state theState)
1584 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1586 //Set a not done flag
1587 GetOperations()->SetNotDone();
1589 //Get the reference objects
1590 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1591 Handle(GEOM_Object) aBox = GetObjectImpl(theBox);
1593 if (aShape.IsNull() || aBox.IsNull() )
1594 return aSeq._retn();
1597 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnBox
1598 (aBox,aShape, theShapeType,ShapeState(theState));
1599 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1600 return aSeq._retn();
1602 Standard_Integer aLength = aHSeq->Length();
1603 aSeq->length(aLength);
1604 for (Standard_Integer i = 1; i <= aLength; i++)
1605 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1607 return aSeq._retn();
1610 //=============================================================================
1612 * GetShapesOnQuadrangleIDs
1614 //=============================================================================
1615 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnBoxIDs
1616 (GEOM::GEOM_Object_ptr theBox,
1617 GEOM::GEOM_Object_ptr theShape,
1618 CORBA::Long theShapeType,
1619 GEOM::shape_state theState)
1621 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1623 //Set a not done flag
1624 GetOperations()->SetNotDone();
1626 //Get the reference objects
1627 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1628 Handle(GEOM_Object) aBox = GetObjectImpl(theBox);
1630 if (aShape.IsNull() || aBox.IsNull() )
1631 return aSeq._retn();
1634 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnBoxIDs
1635 (aBox,aShape, theShapeType,ShapeState(theState));
1636 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1637 return aSeq._retn();
1639 Standard_Integer aLength = aHSeq->Length();
1640 aSeq->length(aLength);
1641 for (Standard_Integer i = 1; i <= aLength; i++)
1642 aSeq[i-1] = aHSeq->Value(i);
1644 return aSeq._retn();
1648 //=============================================================================
1652 //=============================================================================
1653 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnShape
1654 (GEOM::GEOM_Object_ptr theCheckShape,
1655 GEOM::GEOM_Object_ptr theShape,
1656 CORBA::Short theShapeType,
1657 GEOM::shape_state theState)
1659 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1661 //Set a not done flag
1662 GetOperations()->SetNotDone();
1664 //Get the reference objects
1665 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1666 Handle(GEOM_Object) aCheckShape = GetObjectImpl(theCheckShape);
1668 if (aShape.IsNull() || aCheckShape.IsNull() )
1669 return aSeq._retn();
1671 //Get Shapes On Shape
1672 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnShape
1673 (aCheckShape,aShape, theShapeType,ShapeState(theState));
1675 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1676 return aSeq._retn();
1678 Standard_Integer aLength = aHSeq->Length();
1679 aSeq->length(aLength);
1680 for (Standard_Integer i = 1; i <= aLength; i++)
1681 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1683 return aSeq._retn();
1687 //=============================================================================
1689 * GetShapesOnShapeAsCompound
1691 //=============================================================================
1692 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetShapesOnShapeAsCompound
1693 (GEOM::GEOM_Object_ptr theCheckShape,
1694 GEOM::GEOM_Object_ptr theShape,
1695 CORBA::Short theShapeType,
1696 GEOM::shape_state theState)
1698 GEOM::GEOM_Object_var aGEOMObject;
1700 //Set a not done flag
1701 GetOperations()->SetNotDone();
1703 //Get the reference objects
1704 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1705 Handle(GEOM_Object) aCheckShape = GetObjectImpl(theCheckShape);
1707 if (aShape.IsNull() || aCheckShape.IsNull() )
1708 return aGEOMObject._retn();
1710 //Get Shapes On Shape
1711 Handle(GEOM_Object) anObject = GetOperations()->GetShapesOnShapeAsCompound
1712 (aCheckShape,aShape, theShapeType,ShapeState(theState));
1714 if (anObject.IsNull())
1715 return aGEOMObject._retn();
1717 return GetObject(anObject);
1721 //=============================================================================
1723 * GetShapesOnShapeIDs
1725 //=============================================================================
1726 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnShapeIDs
1727 (GEOM::GEOM_Object_ptr theCheckShape,
1728 GEOM::GEOM_Object_ptr theShape,
1729 CORBA::Short theShapeType,
1730 GEOM::shape_state theState)
1732 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1734 //Set a not done flag
1735 GetOperations()->SetNotDone();
1737 //Get the reference objects
1738 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1739 Handle(GEOM_Object) aCheckShape = GetObjectImpl(theCheckShape);
1741 if (aShape.IsNull() || aCheckShape.IsNull() )
1742 return aSeq._retn();
1744 //Get Shapes On Shape
1745 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnShapeIDs
1746 (aCheckShape,aShape, theShapeType,ShapeState(theState));
1747 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1748 return aSeq._retn();
1750 Standard_Integer aLength = aHSeq->Length();
1751 aSeq->length(aLength);
1752 for (Standard_Integer i = 1; i <= aLength; i++)
1753 aSeq[i-1] = aHSeq->Value(i);
1755 return aSeq._retn();
1759 //=============================================================================
1763 //=============================================================================
1764 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlace
1765 (GEOM::GEOM_Object_ptr theShapeWhere,
1766 GEOM::GEOM_Object_ptr theShapeWhat)
1768 GEOM::GEOM_Object_var aGEOMObject;
1770 //Set a not done flag
1771 GetOperations()->SetNotDone();
1773 //Get the reference objects
1774 Handle(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
1775 Handle(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
1777 if (aShapeWhere.IsNull() ||
1778 aShapeWhat.IsNull()) return aGEOMObject._retn();
1780 //Get Shapes in place of aShapeWhat
1781 Handle(GEOM_Object) anObject =
1782 GetOperations()->GetInPlace(aShapeWhere, aShapeWhat);
1783 if (!GetOperations()->IsDone() || anObject.IsNull())
1784 return aGEOMObject._retn();
1786 return GetObject(anObject);
1789 //=============================================================================
1793 //=============================================================================
1794 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlaceOld
1795 (GEOM::GEOM_Object_ptr theShapeWhere,
1796 GEOM::GEOM_Object_ptr theShapeWhat)
1798 GEOM::GEOM_Object_var aGEOMObject;
1800 //Set a not done flag
1801 GetOperations()->SetNotDone();
1803 //Get the reference objects
1804 Handle(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
1805 Handle(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
1807 if (aShapeWhere.IsNull() ||
1808 aShapeWhat.IsNull()) return aGEOMObject._retn();
1810 //Get Shapes in place of aShapeWhat
1811 Handle(GEOM_Object) anObject =
1812 GetOperations()->GetInPlaceOld(aShapeWhere, aShapeWhat);
1813 if (!GetOperations()->IsDone() || anObject.IsNull())
1814 return aGEOMObject._retn();
1816 return GetObject(anObject);
1819 //=============================================================================
1821 * GetInPlaceByHistory
1823 //=============================================================================
1824 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlaceByHistory
1825 (GEOM::GEOM_Object_ptr theShapeWhere,
1826 GEOM::GEOM_Object_ptr theShapeWhat)
1828 GEOM::GEOM_Object_var aGEOMObject;
1830 //Set a not done flag
1831 GetOperations()->SetNotDone();
1833 //Get the reference objects
1834 Handle(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
1835 Handle(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
1837 if (aShapeWhere.IsNull() ||
1838 aShapeWhat.IsNull()) return aGEOMObject._retn();
1840 //Get Shapes in place of aShapeWhat
1841 Handle(GEOM_Object) anObject =
1842 GetOperations()->GetInPlaceByHistory(aShapeWhere, aShapeWhat);
1843 if (!GetOperations()->IsDone() || anObject.IsNull())
1844 return aGEOMObject._retn();
1846 return GetObject(anObject);
1849 //=============================================================================
1853 //=============================================================================
1854 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetSame
1855 (GEOM::GEOM_Object_ptr theShapeWhere,
1856 GEOM::GEOM_Object_ptr theShapeWhat)
1858 GEOM::GEOM_Object_var aGEOMObject;
1860 //Set a not done flag
1861 GetOperations()->SetNotDone();
1863 //Get the reference objects
1864 Handle(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
1865 Handle(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
1867 if (aShapeWhere.IsNull() ||
1868 aShapeWhat.IsNull()) return aGEOMObject._retn();
1870 //Get Shapes in place of aShapeWhat
1871 Handle(GEOM_Object) anObject =
1872 GetOperations()->GetSame(aShapeWhere, aShapeWhat);
1873 if (!GetOperations()->IsDone() || anObject.IsNull())
1874 return aGEOMObject._retn();
1876 return GetObject(anObject);
1879 //=============================================================================
1883 //=============================================================================
1884 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetSameIDs
1885 (GEOM::GEOM_Object_ptr theShapeWhere,
1886 GEOM::GEOM_Object_ptr theShapeWhat) {
1887 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
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 aSeq._retn();
1897 Handle(TColStd_HSequenceOfInteger) aHSeq =
1898 GetOperations()->GetSameIDs(aShapeWhere, aShapeWhat);
1900 if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
1902 Standard_Integer aLength = aHSeq->Length();
1903 aSeq->length(aLength);
1904 for (Standard_Integer i = 1; i <= aLength; i++)
1905 aSeq[i-1] = aHSeq->Value(i);
1907 return aSeq._retn();