1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #include <Standard_Stream.hxx>
24 #include "GEOM_IShapesOperations_i.hh"
26 #include "utilities.h"
28 #include "Utils_ExceptHandlers.hxx"
30 #include "GEOM_Engine.hxx"
31 #include "GEOM_Object.hxx"
34 #include <TColStd_HSequenceOfTransient.hxx>
35 #include <TColStd_HArray1OfInteger.hxx>
37 //=============================================================================
41 //=============================================================================
42 GEOM_IShapesOperations_i::GEOM_IShapesOperations_i (PortableServer::POA_ptr thePOA,
43 GEOM::GEOM_Gen_ptr theEngine,
44 ::GEOMImpl_IShapesOperations* theImpl)
45 :GEOM_IOperations_i(thePOA, theEngine, theImpl)
47 MESSAGE("GEOM_IShapesOperations_i::GEOM_IShapesOperations_i");
50 //=============================================================================
54 //=============================================================================
55 GEOM_IShapesOperations_i::~GEOM_IShapesOperations_i()
57 MESSAGE("GEOM_IShapesOperations_i::~GEOM_IShapesOperations_i");
61 //=============================================================================
65 //=============================================================================
66 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeEdge
67 (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2)
69 GEOM::GEOM_Object_var aGEOMObject;
72 GetOperations()->SetNotDone();
74 //Get the reference points
75 Handle(GEOM_Object) aPnt1 = GetObjectImpl(thePnt1);
76 Handle(GEOM_Object) aPnt2 = GetObjectImpl(thePnt2);
78 if (aPnt1.IsNull() || aPnt2.IsNull()) return aGEOMObject._retn();
81 Handle(GEOM_Object) anObject = GetOperations()->MakeEdge(aPnt1, aPnt2);
82 if (!GetOperations()->IsDone() || anObject.IsNull())
83 return aGEOMObject._retn();
85 return GetObject(anObject);
88 //=============================================================================
90 * MakeEdgeOnCurveByLength
92 //=============================================================================
93 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeEdgeOnCurveByLength
94 (GEOM::GEOM_Object_ptr theCurve,
95 CORBA::Double theLength,
96 GEOM::GEOM_Object_ptr theStartPoint)
98 GEOM::GEOM_Object_var aGEOMObject;
100 //Set a not done flag
101 GetOperations()->SetNotDone();
103 //Get the reference curve
104 Handle(GEOM_Object) aRefCurve = GetObjectImpl(theCurve);
105 if (aRefCurve.IsNull()) return aGEOMObject._retn();
107 //Get the reference point (can be NULL)
108 Handle(GEOM_Object) aRefPoint;
109 if (!CORBA::is_nil(theStartPoint)) {
110 aRefPoint = GetObjectImpl(theStartPoint);
114 Handle(GEOM_Object) anObject =
115 GetOperations()->MakeEdgeOnCurveByLength(aRefCurve, theLength, aRefPoint);
116 if (!GetOperations()->IsDone() || anObject.IsNull())
117 return aGEOMObject._retn();
119 return GetObject(anObject);
122 //=============================================================================
126 //=============================================================================
127 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeEdgeWire
128 (GEOM::GEOM_Object_ptr theWire,
129 const CORBA::Double theLinearTolerance,
130 const CORBA::Double theAngularTolerance)
132 GEOM::GEOM_Object_var aGEOMObject;
134 //Set a not done flag
135 GetOperations()->SetNotDone();
137 //Get the source wire
138 Handle(GEOM_Object) aWire = GetObjectImpl(theWire);
140 if (aWire.IsNull()) return aGEOMObject._retn();
143 Handle(GEOM_Object) anObject = GetOperations()->MakeEdgeWire(aWire, theLinearTolerance, theAngularTolerance);
144 if (!GetOperations()->IsDone() || anObject.IsNull())
145 return aGEOMObject._retn();
147 return GetObject(anObject);
150 //=============================================================================
154 //=============================================================================
155 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeWire
156 (const GEOM::ListOfGO& theEdgesAndWires,
157 const CORBA::Double theTolerance)
159 GEOM::GEOM_Object_var aGEOMObject;
161 //Set a not done flag
162 GetOperations()->SetNotDone();
165 std::list<Handle(GEOM_Object)> aShapes;
168 aLen = theEdgesAndWires.length();
169 for (ind = 0; ind < aLen; ind++) {
170 Handle(GEOM_Object) aSh = GetObjectImpl(theEdgesAndWires[ind]);
171 if (aSh.IsNull()) return aGEOMObject._retn();
172 aShapes.push_back(aSh);
176 Handle(GEOM_Object) anObject =
177 GetOperations()->MakeWire(aShapes, theTolerance);
178 if (!GetOperations()->IsDone() || anObject.IsNull())
179 return aGEOMObject._retn();
181 return GetObject(anObject);
184 //=============================================================================
188 //=============================================================================
189 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeFace
190 (GEOM::GEOM_Object_ptr theWire,
191 const CORBA::Boolean isPlanarWanted)
193 GEOM::GEOM_Object_var aGEOMObject;
195 //Set a not done flag
196 GetOperations()->SetNotDone();
198 //Get the reference wire
199 Handle(GEOM_Object) aWire = GetObjectImpl(theWire);
200 if (aWire.IsNull()) return aGEOMObject._retn();
203 Handle(GEOM_Object) anObject = GetOperations()->MakeFace(aWire, isPlanarWanted);
204 if (!GetOperations()->IsDone() || anObject.IsNull())
205 return aGEOMObject._retn();
207 return GetObject(anObject);
210 //=============================================================================
214 //=============================================================================
215 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeFaceWires
216 (const GEOM::ListOfGO& theWires,
217 const CORBA::Boolean isPlanarWanted)
219 GEOM::GEOM_Object_var aGEOMObject;
221 //Set a not done flag
222 GetOperations()->SetNotDone();
225 std::list<Handle(GEOM_Object)> aShapes;
228 aLen = theWires.length();
229 for (ind = 0; ind < aLen; ind++) {
230 Handle(GEOM_Object) aSh = GetObjectImpl(theWires[ind]);
231 if (aSh.IsNull()) return aGEOMObject._retn();
232 aShapes.push_back(aSh);
236 Handle(GEOM_Object) anObject =
237 GetOperations()->MakeFaceWires(aShapes, isPlanarWanted);
238 if (!GetOperations()->IsDone() || anObject.IsNull())
239 return aGEOMObject._retn();
241 return GetObject(anObject);
244 //=============================================================================
248 //=============================================================================
249 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeShell
250 (const GEOM::ListOfGO& theFacesAndShells)
252 GEOM::GEOM_Object_var aGEOMObject;
254 //Set a not done flag
255 GetOperations()->SetNotDone();
258 std::list<Handle(GEOM_Object)> aShapes;
261 aLen = theFacesAndShells.length();
262 for (ind = 0; ind < aLen; ind++) {
263 Handle(GEOM_Object) aSh = GetObjectImpl(theFacesAndShells[ind]);
264 if (aSh.IsNull()) return aGEOMObject._retn();
265 aShapes.push_back(aSh);
269 Handle(GEOM_Object) anObject =
270 GetOperations()->MakeShell(aShapes);
271 if (!GetOperations()->IsDone() || anObject.IsNull())
272 return aGEOMObject._retn();
274 return GetObject(anObject);
277 //=============================================================================
281 //=============================================================================
282 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeSolidShell
283 (GEOM::GEOM_Object_ptr theShell)
285 GEOM::GEOM_Object_var aGEOMObject;
287 //Set a not done flag
288 GetOperations()->SetNotDone();
290 //Get the reference objects
291 Handle(GEOM_Object) aShell = GetObjectImpl(theShell);
292 if (aShell.IsNull()) return aGEOMObject._retn();
294 std::list<Handle(GEOM_Object)> aShapes;
295 aShapes.push_back(aShell);
298 Handle(GEOM_Object) anObject = GetOperations()->MakeSolidShells(aShapes);
299 if (!GetOperations()->IsDone() || anObject.IsNull())
300 return aGEOMObject._retn();
302 return GetObject(anObject);
305 //=============================================================================
309 //=============================================================================
310 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeSolidShells
311 (const GEOM::ListOfGO& theShells)
313 GEOM::GEOM_Object_var aGEOMObject;
315 //Set a not done flag
316 GetOperations()->SetNotDone();
319 std::list<Handle(GEOM_Object)> aShapes;
322 aLen = theShells.length();
323 for (ind = 0; ind < aLen; ind++) {
324 Handle(GEOM_Object) aSh = GetObjectImpl(theShells[ind]);
325 if (aSh.IsNull()) return aGEOMObject._retn();
326 aShapes.push_back(aSh);
330 Handle(GEOM_Object) anObject =
331 GetOperations()->MakeSolidShells(aShapes);
332 if (!GetOperations()->IsDone() || anObject.IsNull())
333 return aGEOMObject._retn();
335 return GetObject(anObject);
338 //=============================================================================
342 //=============================================================================
343 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeCompound
344 (const GEOM::ListOfGO& theShapes)
346 GEOM::GEOM_Object_var aGEOMObject;
348 //Set a not done flag
349 GetOperations()->SetNotDone();
352 std::list<Handle(GEOM_Object)> aShapes;
355 aLen = theShapes.length();
356 for (ind = 0; ind < aLen; ind++) {
357 Handle(GEOM_Object) aSh = GetObjectImpl(theShapes[ind]);
358 if (aSh.IsNull()) return aGEOMObject._retn();
359 aShapes.push_back(aSh);
363 Handle(GEOM_Object) anObject =
364 GetOperations()->MakeCompound(aShapes);
365 if (!GetOperations()->IsDone() || anObject.IsNull())
366 return aGEOMObject._retn();
368 return GetObject(anObject);
371 //=============================================================================
375 //=============================================================================
376 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFaces
377 (GEOM::GEOM_Object_ptr theShape,
378 CORBA::Double theTolerance,
379 CORBA::Boolean doKeepNonSolids)
381 GEOM::GEOM_Object_var aGEOMObject;
383 //Set a not done flag
384 GetOperations()->SetNotDone();
386 //Get the reference objects
387 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
388 if (aShape.IsNull()) return aGEOMObject._retn();
391 Handle(GEOM_Object) anObject =
392 GetOperations()->MakeGlueFaces(aShape, theTolerance, doKeepNonSolids);
393 //if (!GetOperations()->IsDone() || anObject.IsNull())
395 if (anObject.IsNull())
396 return aGEOMObject._retn();
398 return GetObject(anObject);
402 //=============================================================================
406 //=============================================================================
407 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetGlueFaces
408 (GEOM::GEOM_Object_ptr theShape,
409 const CORBA::Double theTolerance)
411 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
413 //Set a not done flag
414 GetOperations()->SetNotDone();
416 //Get the reference objects
417 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
418 if (aShape.IsNull()) return aSeq._retn();
420 Handle(TColStd_HSequenceOfTransient) aHSeq =
421 GetOperations()->GetGlueFaces(aShape, theTolerance);
423 //if (!GetOperations()->IsDone() || aHSeq.IsNull())
428 Standard_Integer aLength = aHSeq->Length();
429 aSeq->length(aLength);
430 for (Standard_Integer i = 1; i <= aLength; i++)
431 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
437 //=============================================================================
439 * MakeGlueFacesByList
441 //=============================================================================
442 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFacesByList
443 (GEOM::GEOM_Object_ptr theShape,
444 CORBA::Double theTolerance,
445 const GEOM::ListOfGO& theFaces,
446 CORBA::Boolean doKeepNonSolids)
448 GEOM::GEOM_Object_var aGEOMObject;
450 //Set a not done flag
451 GetOperations()->SetNotDone();
453 //Get the reference objects
454 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
455 if (aShape.IsNull()) return aGEOMObject._retn();
458 std::list<Handle(GEOM_Object)> aFaces;
460 aLen = theFaces.length();
461 for (ind = 0; ind < aLen; ind++) {
462 Handle(GEOM_Object) aSh = GetObjectImpl(theFaces[ind]);
463 if (aSh.IsNull()) return aGEOMObject._retn();
464 aFaces.push_back(aSh);
468 Handle(GEOM_Object) anObject =
469 GetOperations()->MakeGlueFacesByList(aShape, theTolerance, aFaces, doKeepNonSolids);
470 //if (!GetOperations()->IsDone() || anObject.IsNull())
472 if (anObject.IsNull())
473 return aGEOMObject._retn();
475 return GetObject(anObject);
478 //=============================================================================
480 * GetExistingSubObjects
482 //=============================================================================
483 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetExistingSubObjects (GEOM::GEOM_Object_ptr theShape,
484 CORBA::Boolean theGroupsOnly)
486 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
488 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
489 if (aShape.IsNull()) return aSeq._retn();
491 Handle(TColStd_HSequenceOfTransient) aHSeq =
492 GetOperations()->GetExistingSubObjects(aShape, theGroupsOnly);
493 if (!GetOperations()->IsDone() || aHSeq.IsNull())
496 Standard_Integer aLength = aHSeq->Length();
497 aSeq->length(aLength);
498 for (Standard_Integer i = 1; i <= aLength; i++)
499 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
504 //=============================================================================
506 * MakeExplode (including theShape itself, bad sorting)
508 //=============================================================================
509 GEOM::ListOfGO* GEOM_IShapesOperations_i::MakeExplode (GEOM::GEOM_Object_ptr theShape,
510 const CORBA::Long theShapeType,
511 const CORBA::Boolean isSorted)
513 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
515 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
516 if (aShape.IsNull()) return aSeq._retn();
518 Handle(TColStd_HSequenceOfTransient) aHSeq =
519 GetOperations()->MakeExplode(aShape, theShapeType, isSorted,
520 GEOMImpl_IShapesOperations::EXPLODE_OLD_INCLUDE_MAIN);
521 if (!GetOperations()->IsDone() || aHSeq.IsNull())
524 Standard_Integer aLength = aHSeq->Length();
525 aSeq->length(aLength);
526 for (Standard_Integer i = 1; i <= aLength; i++)
527 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
532 //=============================================================================
534 * MakeAllSubShapes (including theShape itself, good sorting)
536 //=============================================================================
537 GEOM::ListOfGO* GEOM_IShapesOperations_i::MakeAllSubShapes (GEOM::GEOM_Object_ptr theShape,
538 const CORBA::Long theShapeType,
539 const CORBA::Boolean isSorted)
541 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
543 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
544 if (aShape.IsNull()) return aSeq._retn();
546 Handle(TColStd_HSequenceOfTransient) aHSeq =
547 GetOperations()->MakeExplode(aShape, theShapeType, isSorted,
548 GEOMImpl_IShapesOperations::EXPLODE_NEW_INCLUDE_MAIN);
549 if (!GetOperations()->IsDone() || aHSeq.IsNull())
552 Standard_Integer aLength = aHSeq->Length();
553 aSeq->length(aLength);
554 for (Standard_Integer i = 1; i <= aLength; i++)
555 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
560 //=============================================================================
562 * ExtractSubShapes (excluding theShape itself, good sorting)
564 //=============================================================================
565 GEOM::ListOfGO* GEOM_IShapesOperations_i::ExtractSubShapes (GEOM::GEOM_Object_ptr theShape,
566 const CORBA::Long theShapeType,
567 const CORBA::Boolean isSorted)
569 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
571 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
572 if (aShape.IsNull()) return aSeq._retn();
574 Handle(TColStd_HSequenceOfTransient) aHSeq =
575 // TODO: enum instead of bool for the last argument
576 GetOperations()->MakeExplode(aShape, theShapeType, isSorted,
577 GEOMImpl_IShapesOperations::EXPLODE_NEW_EXCLUDE_MAIN);
578 if (!GetOperations()->IsDone() || aHSeq.IsNull())
581 Standard_Integer aLength = aHSeq->Length();
582 aSeq->length(aLength);
583 for (Standard_Integer i = 1; i <= aLength; i++)
584 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
589 //=============================================================================
593 //=============================================================================
594 GEOM::ListOfLong* GEOM_IShapesOperations_i::SubShapeAllIDs (GEOM::GEOM_Object_ptr theShape,
595 const CORBA::Long theShapeType,
596 const CORBA::Boolean isSorted)
598 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
600 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
601 if (aShape.IsNull()) return aSeq._retn();
603 Handle(TColStd_HSequenceOfInteger) aHSeq =
604 GetOperations()->SubShapeAllIDs(aShape, theShapeType, isSorted,
605 GEOMImpl_IShapesOperations::EXPLODE_OLD_INCLUDE_MAIN);
606 if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
608 Standard_Integer aLength = aHSeq->Length();
609 aSeq->length(aLength);
610 for (Standard_Integer i = 1; i <= aLength; i++)
611 aSeq[i-1] = aHSeq->Value(i);
616 //=============================================================================
620 //=============================================================================
621 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetAllSubShapesIDs (GEOM::GEOM_Object_ptr theShape,
622 const CORBA::Long theShapeType,
623 const CORBA::Boolean isSorted)
625 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
627 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
628 if (aShape.IsNull()) return aSeq._retn();
630 Handle(TColStd_HSequenceOfInteger) aHSeq =
631 GetOperations()->SubShapeAllIDs(aShape, theShapeType, isSorted,
632 GEOMImpl_IShapesOperations::EXPLODE_NEW_INCLUDE_MAIN);
633 if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
635 Standard_Integer aLength = aHSeq->Length();
636 aSeq->length(aLength);
637 for (Standard_Integer i = 1; i <= aLength; i++)
638 aSeq[i-1] = aHSeq->Value(i);
643 //=============================================================================
647 //=============================================================================
648 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetSubShape
649 (GEOM::GEOM_Object_ptr theMainShape,
650 const CORBA::Long theID)
652 GEOM::GEOM_Object_var aGEOMObject;
654 //Set a not done flag
655 GetOperations()->SetNotDone();
657 //Get the reference objects
658 Handle(GEOM_Object) aShape = GetObjectImpl(theMainShape);
659 if (aShape.IsNull()) return aGEOMObject._retn();
661 Handle(GEOM_Object) anObject = GetOperations()->GetSubShape(aShape, theID);
662 if (!GetOperations()->IsDone() || anObject.IsNull())
663 return aGEOMObject._retn();
665 return GetObject(anObject);
668 //=============================================================================
672 //=============================================================================
673 CORBA::Long GEOM_IShapesOperations_i::GetSubShapeIndex
674 (GEOM::GEOM_Object_ptr theMainShape, GEOM::GEOM_Object_ptr theSubShape)
676 //Get the reference shapes
677 Handle(GEOM_Object) aMainShapeRef = GetObjectImpl(theMainShape);
678 Handle(GEOM_Object) aSubShapeRef = GetObjectImpl(theSubShape);
680 if (aMainShapeRef.IsNull() || aSubShapeRef.IsNull()) return -1;
682 //Get the unique ID of <theSubShape> inside <theMainShape>
683 CORBA::Long anID = GetOperations()->GetSubShapeIndex(aMainShapeRef, aSubShapeRef);
684 if (!GetOperations()->IsDone())
690 //=============================================================================
694 //=============================================================================
695 CORBA::Long GEOM_IShapesOperations_i::GetTopologyIndex
696 (GEOM::GEOM_Object_ptr theMainShape, GEOM::GEOM_Object_ptr theSubShape)
698 //Get the reference shapes
699 Handle(GEOM_Object) aMainShapeRef = GetObjectImpl(theMainShape);
700 Handle(GEOM_Object) aSubShapeRef = GetObjectImpl(theSubShape);
702 if (aMainShapeRef.IsNull() || aSubShapeRef.IsNull()) return -1;
704 //Get an ID of <theSubShape>, unique among all sub-shapes of <theMainShape> of the same type
705 CORBA::Long anID = GetOperations()->GetTopologyIndex(aMainShapeRef, aSubShapeRef);
706 if (!GetOperations()->IsDone())
712 //=============================================================================
716 //=============================================================================
717 char* GEOM_IShapesOperations_i::GetShapeTypeString (GEOM::GEOM_Object_ptr theShape)
719 //Get the reference shape
720 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
721 if (aShape.IsNull()) return NULL;
723 // Get shape parameters
724 TCollection_AsciiString aDescription = GetOperations()->GetShapeTypeString(aShape);
725 return CORBA::string_dup(aDescription.ToCString());
728 //=============================================================================
732 //=============================================================================
733 CORBA::Long GEOM_IShapesOperations_i::NumberOfFaces (GEOM::GEOM_Object_ptr theShape)
735 return NumberOfSubShapes(theShape, Standard_Integer(TopAbs_FACE));
738 //=============================================================================
742 //=============================================================================
743 CORBA::Long GEOM_IShapesOperations_i::NumberOfEdges (GEOM::GEOM_Object_ptr theShape)
745 return NumberOfSubShapes(theShape, Standard_Integer(TopAbs_EDGE));
748 //=============================================================================
752 //=============================================================================
753 CORBA::Long GEOM_IShapesOperations_i::NumberOfSubShapes (GEOM::GEOM_Object_ptr theShape,
754 const CORBA::Long theShapeType)
756 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
757 if (aShape.IsNull()) return -1;
759 CORBA::Long aNb = GetOperations()->NumberOfSubShapes(aShape, theShapeType);
760 if (!GetOperations()->IsDone()) return -1;
765 //=============================================================================
769 //=============================================================================
770 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::ChangeOrientation
771 (GEOM::GEOM_Object_ptr theShape)
773 GEOM::GEOM_Object_var aGEOMObject;
775 //Set a not done flag
776 GetOperations()->SetNotDone();
778 //Get the reference objects
779 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
780 if (aShape.IsNull()) return aGEOMObject._retn();
783 Handle(GEOM_Object) anObject = GetOperations()->ReverseShape(aShape);
784 if (!GetOperations()->IsDone() || anObject.IsNull())
785 return aGEOMObject._retn();
787 return GetObject(anObject);
790 //=============================================================================
794 //=============================================================================
795 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetFreeFacesIDs (GEOM::GEOM_Object_ptr theShape)
797 //Set a not done flag
798 GetOperations()->SetNotDone();
800 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
802 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
803 if (aShape.IsNull()) return aSeq._retn();
805 Handle(TColStd_HSequenceOfInteger) aHSeq =
806 GetOperations()->GetFreeFacesIDs(aShape);
807 if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
809 Standard_Integer aLength = aHSeq->Length();
810 aSeq->length(aLength);
811 for (Standard_Integer i = 1; i <= aLength; i++)
812 aSeq[i-1] = aHSeq->Value(i);
817 //=============================================================================
821 //=============================================================================
822 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSharedShapes
823 (GEOM::GEOM_Object_ptr theShape1,
824 GEOM::GEOM_Object_ptr theShape2,
825 const CORBA::Long theShapeType)
827 //Set a not done flag
828 GetOperations()->SetNotDone();
830 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
832 Handle(GEOM_Object) aShape1 = GetObjectImpl(theShape1);
833 Handle(GEOM_Object) aShape2 = GetObjectImpl(theShape2);
835 if (aShape1.IsNull() || aShape2.IsNull()) return aSeq._retn();
837 Handle(TColStd_HSequenceOfTransient) aHSeq =
838 GetOperations()->GetSharedShapes(aShape1, aShape2, theShapeType);
839 if (!GetOperations()->IsDone() || aHSeq.IsNull())
842 Standard_Integer aLength = aHSeq->Length();
843 aSeq->length(aLength);
844 for (Standard_Integer i = 1; i <= aLength; i++)
845 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
850 //=============================================================================
852 * GetSharedShapesMulti
854 //=============================================================================
855 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSharedShapesMulti
856 (const GEOM::ListOfGO& theShapes,
857 const CORBA::Long theShapeType)
859 //Set a not done flag
860 GetOperations()->SetNotDone();
862 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
865 std::list<Handle(GEOM_Object)> aShapes;
866 int aLen = theShapes.length();
867 for (int ind = 0; ind < aLen; ind++) {
868 Handle(GEOM_Object) aSh = GetObjectImpl(theShapes[ind]);
869 if (aSh.IsNull()) return aSeq._retn();
870 aShapes.push_back(aSh);
873 Handle(TColStd_HSequenceOfTransient) aHSeq =
874 GetOperations()->GetSharedShapes(aShapes, theShapeType);
875 if (!GetOperations()->IsDone() || aHSeq.IsNull())
878 Standard_Integer aLength = aHSeq->Length();
879 aSeq->length(aLength);
880 for (Standard_Integer i = 1; i <= aLength; i++)
881 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
886 static GEOMAlgo_State ShapeState (const GEOM::shape_state theState)
888 GEOMAlgo_State aState = GEOMAlgo_ST_UNKNOWN;
892 aState = GEOMAlgo_ST_ON;
895 aState = GEOMAlgo_ST_OUT;
898 aState = GEOMAlgo_ST_ONOUT;
901 aState = GEOMAlgo_ST_IN;
904 aState = GEOMAlgo_ST_ONIN;
913 //=============================================================================
917 //=============================================================================
918 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnPlane
919 (GEOM::GEOM_Object_ptr theShape,
920 const CORBA::Long theShapeType,
921 GEOM::GEOM_Object_ptr theAx1,
922 const GEOM::shape_state theState)
924 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
926 //Set a not done flag
927 GetOperations()->SetNotDone();
929 //Get the reference objects
930 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
931 Handle(GEOM_Object) anAx1 = GetObjectImpl(theAx1);
933 if (aShape.IsNull() || anAx1.IsNull()) return aSeq._retn();
935 //Get Shapes On Plane
936 Handle(TColStd_HSequenceOfTransient) aHSeq =
937 GetOperations()->GetShapesOnPlane(aShape, theShapeType, anAx1, ShapeState(theState));
938 if (!GetOperations()->IsDone() || aHSeq.IsNull())
941 Standard_Integer aLength = aHSeq->Length();
942 aSeq->length(aLength);
943 for (Standard_Integer i = 1; i <= aLength; i++)
944 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
949 //=============================================================================
951 * GetShapesOnPlaneWithLocation
953 //=============================================================================
954 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnPlaneWithLocation
955 (GEOM::GEOM_Object_ptr theShape,
956 const CORBA::Long theShapeType,
957 GEOM::GEOM_Object_ptr theAx1,
958 GEOM::GEOM_Object_ptr thePnt,
959 const GEOM::shape_state theState)
961 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
963 //Set a not done flag
964 GetOperations()->SetNotDone();
966 //Get the reference objects
967 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
968 Handle(GEOM_Object) anAx1 = GetObjectImpl(theAx1);
969 Handle(GEOM_Object) anPnt = GetObjectImpl(thePnt);
971 if (aShape.IsNull() || anAx1.IsNull() || anPnt.IsNull()) return aSeq._retn();
973 //Get Shapes On Plane
974 Handle(TColStd_HSequenceOfTransient) aHSeq =
975 GetOperations()->GetShapesOnPlaneWithLocation(aShape, theShapeType, anAx1, anPnt, ShapeState(theState));
976 if (!GetOperations()->IsDone() || aHSeq.IsNull())
979 Standard_Integer aLength = aHSeq->Length();
980 aSeq->length(aLength);
981 for (Standard_Integer i = 1; i <= aLength; i++)
982 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
987 //=============================================================================
989 * GetShapesOnCylinder
991 //=============================================================================
992 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnCylinder
993 (GEOM::GEOM_Object_ptr theShape,
994 const CORBA::Long theShapeType,
995 GEOM::GEOM_Object_ptr theAxis,
996 const CORBA::Double theRadius,
997 const GEOM::shape_state theState)
999 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1001 //Set a not done flag
1002 GetOperations()->SetNotDone();
1004 //Get the reference objects
1005 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1006 Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
1008 if (aShape.IsNull() || anAxis.IsNull()) return aSeq._retn();
1010 //Get Shapes On Cylinder
1011 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnCylinder
1012 (aShape, theShapeType, anAxis, theRadius, ShapeState(theState));
1013 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1014 return aSeq._retn();
1016 Standard_Integer aLength = aHSeq->Length();
1017 aSeq->length(aLength);
1018 for (Standard_Integer i = 1; i <= aLength; i++)
1019 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1021 return aSeq._retn();
1024 //=============================================================================
1026 * GetShapesOnCylinderWithLocation
1028 //=============================================================================
1029 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnCylinderWithLocation
1030 (GEOM::GEOM_Object_ptr theShape,
1031 const CORBA::Long theShapeType,
1032 GEOM::GEOM_Object_ptr theAxis,
1033 GEOM::GEOM_Object_ptr thePnt,
1034 const CORBA::Double theRadius,
1035 const GEOM::shape_state theState)
1037 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1039 //Set a not done flag
1040 GetOperations()->SetNotDone();
1042 //Get the reference objects
1043 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1044 Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
1045 Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
1047 if (aShape.IsNull() || anAxis.IsNull() || aPnt.IsNull()) return aSeq._retn();
1049 //Get Shapes On Cylinder
1050 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnCylinderWithLocation
1051 (aShape, theShapeType, anAxis, aPnt, theRadius, ShapeState(theState));
1052 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1053 return aSeq._retn();
1055 Standard_Integer aLength = aHSeq->Length();
1056 aSeq->length(aLength);
1057 for (Standard_Integer i = 1; i <= aLength; i++)
1058 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1060 return aSeq._retn();
1063 //=============================================================================
1067 //=============================================================================
1068 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnSphere
1069 (GEOM::GEOM_Object_ptr theShape,
1070 const CORBA::Long theShapeType,
1071 GEOM::GEOM_Object_ptr theCenter,
1072 const CORBA::Double theRadius,
1073 const GEOM::shape_state theState)
1075 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1077 //Set a not done flag
1078 GetOperations()->SetNotDone();
1080 //Get the reference objects
1081 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1082 Handle(GEOM_Object) aCenter = GetObjectImpl(theCenter);
1084 if (aShape.IsNull() || aCenter.IsNull()) return aSeq._retn();
1086 //Get Shapes On Sphere
1087 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnSphere
1088 (aShape, theShapeType, aCenter, theRadius, ShapeState(theState));
1089 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1090 return aSeq._retn();
1092 Standard_Integer aLength = aHSeq->Length();
1093 aSeq->length(aLength);
1094 for (Standard_Integer i = 1; i <= aLength; i++)
1095 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1097 return aSeq._retn();
1100 //=============================================================================
1102 * GetShapesOnQuadrangle
1104 //=============================================================================
1105 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnQuadrangle
1106 (GEOM::GEOM_Object_ptr theShape,
1107 CORBA::Long theShapeType,
1108 GEOM::GEOM_Object_ptr theTopLeftPoint,
1109 GEOM::GEOM_Object_ptr theTopRigthPoint,
1110 GEOM::GEOM_Object_ptr theBottomLeftPoint,
1111 GEOM::GEOM_Object_ptr theBottomRigthPoint,
1112 GEOM::shape_state theState)
1114 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1116 //Set a not done flag
1117 GetOperations()->SetNotDone();
1119 //Get the reference objects
1120 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1121 Handle(GEOM_Object) aTopLeftPoint = GetObjectImpl(theTopLeftPoint);
1122 Handle(GEOM_Object) aTopRigthPoint = GetObjectImpl(theTopRigthPoint);
1123 Handle(GEOM_Object) aBottomLeftPoint = GetObjectImpl(theBottomLeftPoint);
1124 Handle(GEOM_Object) aBottomRigthPoint = GetObjectImpl(theBottomRigthPoint);
1126 if (aShape.IsNull() ||
1127 aTopLeftPoint.IsNull() ||
1128 aTopRigthPoint.IsNull() ||
1129 aBottomLeftPoint.IsNull() ||
1130 aBottomRigthPoint.IsNull())
1131 return aSeq._retn();
1133 //Get Shapes On Quadrangle
1134 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnQuadrangle
1135 (aShape, theShapeType,
1136 aTopLeftPoint, aTopRigthPoint, aBottomLeftPoint, aBottomRigthPoint,
1137 ShapeState(theState));
1138 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1139 return aSeq._retn();
1141 Standard_Integer aLength = aHSeq->Length();
1142 aSeq->length(aLength);
1143 for (Standard_Integer i = 1; i <= aLength; i++)
1144 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1146 return aSeq._retn();
1149 //=============================================================================
1151 * GetShapesOnPlaneIDs
1153 //=============================================================================
1154 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnPlaneIDs
1155 (GEOM::GEOM_Object_ptr theShape,
1156 const CORBA::Long theShapeType,
1157 GEOM::GEOM_Object_ptr theAx1,
1158 const GEOM::shape_state theState)
1160 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1162 //Set a not done flag
1163 GetOperations()->SetNotDone();
1165 //Get the reference objects
1166 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1167 Handle(GEOM_Object) anAx1 = GetObjectImpl(theAx1);
1169 if (aShape.IsNull() || anAx1.IsNull()) return aSeq._retn();
1171 //Get Shapes On Plane
1172 Handle(TColStd_HSequenceOfInteger) aHSeq =
1173 GetOperations()->GetShapesOnPlaneIDs(aShape, theShapeType, anAx1, ShapeState(theState));
1174 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1175 return aSeq._retn();
1177 Standard_Integer aLength = aHSeq->Length();
1178 aSeq->length(aLength);
1179 for (Standard_Integer i = 1; i <= aLength; i++)
1180 aSeq[i-1] = aHSeq->Value(i);
1182 return aSeq._retn();
1185 //=============================================================================
1187 * GetShapesOnPlaneWithLocationIDs
1189 //=============================================================================
1190 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnPlaneWithLocationIDs
1191 (GEOM::GEOM_Object_ptr theShape,
1192 const CORBA::Long theShapeType,
1193 GEOM::GEOM_Object_ptr theAx1,
1194 GEOM::GEOM_Object_ptr thePnt,
1195 const GEOM::shape_state theState)
1197 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1199 //Set a not done flag
1200 GetOperations()->SetNotDone();
1202 //Get the reference objects
1203 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1204 Handle(GEOM_Object) anAx1 = GetObjectImpl(theAx1);
1205 Handle(GEOM_Object) anPnt = GetObjectImpl(thePnt);
1207 if (aShape.IsNull() || anAx1.IsNull() || anPnt.IsNull()) return aSeq._retn();
1209 //Get Shapes On Plane
1210 Handle(TColStd_HSequenceOfInteger) aHSeq =
1211 GetOperations()->GetShapesOnPlaneWithLocationIDs(aShape, theShapeType,
1212 anAx1, anPnt, ShapeState(theState));
1213 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1214 return aSeq._retn();
1216 Standard_Integer aLength = aHSeq->Length();
1217 aSeq->length(aLength);
1218 for (Standard_Integer i = 1; i <= aLength; i++)
1219 aSeq[i-1] = aHSeq->Value(i);
1221 return aSeq._retn();
1224 //=============================================================================
1226 * GetShapesOnCylinderIDs
1228 //=============================================================================
1229 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnCylinderIDs
1230 (GEOM::GEOM_Object_ptr theShape,
1231 const CORBA::Long theShapeType,
1232 GEOM::GEOM_Object_ptr theAxis,
1233 const CORBA::Double theRadius,
1234 const GEOM::shape_state theState)
1236 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1238 //Set a not done flag
1239 GetOperations()->SetNotDone();
1241 //Get the reference objects
1242 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1243 Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
1245 if (aShape.IsNull() || anAxis.IsNull()) return aSeq._retn();
1247 //Get Shapes On Cylinder
1248 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnCylinderIDs
1249 (aShape, theShapeType, anAxis, theRadius, ShapeState(theState));
1250 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1251 return aSeq._retn();
1253 Standard_Integer aLength = aHSeq->Length();
1254 aSeq->length(aLength);
1255 for (Standard_Integer i = 1; i <= aLength; i++)
1256 aSeq[i-1] = aHSeq->Value(i);
1258 return aSeq._retn();
1261 //=============================================================================
1263 * GetShapesOnCylinderWithLocationIDs
1265 //=============================================================================
1266 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnCylinderWithLocationIDs
1267 (GEOM::GEOM_Object_ptr theShape,
1268 const CORBA::Long theShapeType,
1269 GEOM::GEOM_Object_ptr theAxis,
1270 GEOM::GEOM_Object_ptr thePnt,
1271 const CORBA::Double theRadius,
1272 const GEOM::shape_state theState)
1274 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1276 //Set a not done flag
1277 GetOperations()->SetNotDone();
1279 //Get the reference objects
1280 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1281 Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
1282 Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
1284 if (aShape.IsNull() || anAxis.IsNull() || aPnt.IsNull()) return aSeq._retn();
1286 //Get Shapes On Cylinder
1287 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnCylinderWithLocationIDs
1288 (aShape, theShapeType, anAxis, aPnt, theRadius, ShapeState(theState));
1289 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1290 return aSeq._retn();
1292 Standard_Integer aLength = aHSeq->Length();
1293 aSeq->length(aLength);
1294 for (Standard_Integer i = 1; i <= aLength; i++)
1295 aSeq[i-1] = aHSeq->Value(i);
1297 return aSeq._retn();
1300 //=============================================================================
1302 * GetShapesOnSphereIDs
1304 //=============================================================================
1305 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnSphereIDs
1306 (GEOM::GEOM_Object_ptr theShape,
1307 const CORBA::Long theShapeType,
1308 GEOM::GEOM_Object_ptr theCenter,
1309 const CORBA::Double theRadius,
1310 const GEOM::shape_state theState)
1312 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1314 //Set a not done flag
1315 GetOperations()->SetNotDone();
1317 //Get the reference objects
1318 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1319 Handle(GEOM_Object) aCenter = GetObjectImpl(theCenter);
1321 if (aShape.IsNull() || aCenter.IsNull()) return aSeq._retn();
1323 //Get Shapes On Sphere
1324 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnSphereIDs
1325 (aShape, theShapeType, aCenter, theRadius, ShapeState(theState));
1326 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1327 return aSeq._retn();
1329 Standard_Integer aLength = aHSeq->Length();
1330 aSeq->length(aLength);
1331 for (Standard_Integer i = 1; i <= aLength; i++)
1332 aSeq[i-1] = aHSeq->Value(i);
1334 return aSeq._retn();
1337 //=============================================================================
1339 * GetShapesOnQuadrangleIDs
1341 //=============================================================================
1342 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnQuadrangleIDs
1343 (GEOM::GEOM_Object_ptr theShape,
1344 CORBA::Long theShapeType,
1345 GEOM::GEOM_Object_ptr theTopLeftPoint,
1346 GEOM::GEOM_Object_ptr theTopRigthPoint,
1347 GEOM::GEOM_Object_ptr theBottomLeftPoint,
1348 GEOM::GEOM_Object_ptr theBottomRigthPoint,
1349 GEOM::shape_state theState)
1351 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1353 //Set a not done flag
1354 GetOperations()->SetNotDone();
1356 //Get the reference objects
1357 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1358 Handle(GEOM_Object) aTopLeftPoint = GetObjectImpl(theTopLeftPoint);
1359 Handle(GEOM_Object) aTopRigthPoint = GetObjectImpl(theTopRigthPoint);
1360 Handle(GEOM_Object) aBottomLeftPoint = GetObjectImpl(theBottomLeftPoint);
1361 Handle(GEOM_Object) aBottomRigthPoint = GetObjectImpl(theBottomRigthPoint);
1363 if (aShape.IsNull() ||
1364 aTopLeftPoint.IsNull() ||
1365 aTopRigthPoint.IsNull() ||
1366 aBottomLeftPoint.IsNull() ||
1367 aBottomRigthPoint.IsNull() )
1368 return aSeq._retn();
1370 //Get Shapes On Quadrangle
1371 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnQuadrangleIDs
1372 (aShape, theShapeType,
1373 aTopLeftPoint, aTopRigthPoint, aBottomLeftPoint, aBottomRigthPoint,
1374 ShapeState(theState));
1375 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1376 return aSeq._retn();
1378 Standard_Integer aLength = aHSeq->Length();
1379 aSeq->length(aLength);
1380 for (Standard_Integer i = 1; i <= aLength; i++)
1381 aSeq[i-1] = aHSeq->Value(i);
1383 return aSeq._retn();
1386 //=============================================================================
1390 //=============================================================================
1391 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnBox
1392 (GEOM::GEOM_Object_ptr theBox,
1393 GEOM::GEOM_Object_ptr theShape,
1394 CORBA::Long theShapeType,
1395 GEOM::shape_state theState)
1397 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1399 //Set a not done flag
1400 GetOperations()->SetNotDone();
1402 //Get the reference objects
1403 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1404 Handle(GEOM_Object) aBox = GetObjectImpl(theBox);
1406 if (aShape.IsNull() || aBox.IsNull() )
1407 return aSeq._retn();
1410 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnBox
1411 (aBox,aShape, theShapeType,ShapeState(theState));
1412 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1413 return aSeq._retn();
1415 Standard_Integer aLength = aHSeq->Length();
1416 aSeq->length(aLength);
1417 for (Standard_Integer i = 1; i <= aLength; i++)
1418 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1420 return aSeq._retn();
1423 //=============================================================================
1425 * GetShapesOnQuadrangleIDs
1427 //=============================================================================
1428 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnBoxIDs
1429 (GEOM::GEOM_Object_ptr theBox,
1430 GEOM::GEOM_Object_ptr theShape,
1431 CORBA::Long theShapeType,
1432 GEOM::shape_state theState)
1434 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1436 //Set a not done flag
1437 GetOperations()->SetNotDone();
1439 //Get the reference objects
1440 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1441 Handle(GEOM_Object) aBox = GetObjectImpl(theBox);
1443 if (aShape.IsNull() || aBox.IsNull() )
1444 return aSeq._retn();
1447 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnBoxIDs
1448 (aBox,aShape, theShapeType,ShapeState(theState));
1449 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1450 return aSeq._retn();
1452 Standard_Integer aLength = aHSeq->Length();
1453 aSeq->length(aLength);
1454 for (Standard_Integer i = 1; i <= aLength; i++)
1455 aSeq[i-1] = aHSeq->Value(i);
1457 return aSeq._retn();
1461 //=============================================================================
1465 //=============================================================================
1466 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnShape
1467 (GEOM::GEOM_Object_ptr theCheckShape,
1468 GEOM::GEOM_Object_ptr theShape,
1469 CORBA::Short theShapeType,
1470 GEOM::shape_state theState)
1472 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1474 //Set a not done flag
1475 GetOperations()->SetNotDone();
1477 //Get the reference objects
1478 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1479 Handle(GEOM_Object) aCheckShape = GetObjectImpl(theCheckShape);
1481 if (aShape.IsNull() || aCheckShape.IsNull() )
1482 return aSeq._retn();
1484 //Get Shapes On Shape
1485 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnShape
1486 (aCheckShape,aShape, theShapeType,ShapeState(theState));
1488 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1489 return aSeq._retn();
1491 Standard_Integer aLength = aHSeq->Length();
1492 aSeq->length(aLength);
1493 for (Standard_Integer i = 1; i <= aLength; i++)
1494 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1496 return aSeq._retn();
1500 //=============================================================================
1502 * GetShapesOnShapeAsCompound
1504 //=============================================================================
1505 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetShapesOnShapeAsCompound
1506 (GEOM::GEOM_Object_ptr theCheckShape,
1507 GEOM::GEOM_Object_ptr theShape,
1508 CORBA::Short theShapeType,
1509 GEOM::shape_state theState)
1511 GEOM::GEOM_Object_var aGEOMObject;
1513 //Set a not done flag
1514 GetOperations()->SetNotDone();
1516 //Get the reference objects
1517 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1518 Handle(GEOM_Object) aCheckShape = GetObjectImpl(theCheckShape);
1520 if (aShape.IsNull() || aCheckShape.IsNull() )
1521 return aGEOMObject._retn();
1523 //Get Shapes On Shape
1524 Handle(GEOM_Object) anObject = GetOperations()->GetShapesOnShapeAsCompound
1525 (aCheckShape,aShape, theShapeType,ShapeState(theState));
1527 if (anObject.IsNull())
1528 return aGEOMObject._retn();
1530 return GetObject(anObject);
1534 //=============================================================================
1536 * GetShapesOnShapeIDs
1538 //=============================================================================
1539 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnShapeIDs
1540 (GEOM::GEOM_Object_ptr theCheckShape,
1541 GEOM::GEOM_Object_ptr theShape,
1542 CORBA::Short theShapeType,
1543 GEOM::shape_state theState)
1545 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1547 //Set a not done flag
1548 GetOperations()->SetNotDone();
1550 //Get the reference objects
1551 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1552 Handle(GEOM_Object) aCheckShape = GetObjectImpl(theCheckShape);
1554 if (aShape.IsNull() || aCheckShape.IsNull() )
1555 return aSeq._retn();
1557 //Get Shapes On Shape
1558 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnShapeIDs
1559 (aCheckShape,aShape, theShapeType,ShapeState(theState));
1560 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1561 return aSeq._retn();
1563 Standard_Integer aLength = aHSeq->Length();
1564 aSeq->length(aLength);
1565 for (Standard_Integer i = 1; i <= aLength; i++)
1566 aSeq[i-1] = aHSeq->Value(i);
1568 return aSeq._retn();
1572 //=============================================================================
1576 //=============================================================================
1577 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlace
1578 (GEOM::GEOM_Object_ptr theShapeWhere,
1579 GEOM::GEOM_Object_ptr theShapeWhat)
1581 GEOM::GEOM_Object_var aGEOMObject;
1583 //Set a not done flag
1584 GetOperations()->SetNotDone();
1586 //Get the reference objects
1587 Handle(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
1588 Handle(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
1590 if (aShapeWhere.IsNull() ||
1591 aShapeWhat.IsNull()) return aGEOMObject._retn();
1593 //Get Shapes in place of aShapeWhat
1594 Handle(GEOM_Object) anObject =
1595 GetOperations()->GetInPlace(aShapeWhere, aShapeWhat);
1596 if (!GetOperations()->IsDone() || anObject.IsNull())
1597 return aGEOMObject._retn();
1599 return GetObject(anObject);
1602 //=============================================================================
1604 * GetInPlaceByHistory
1606 //=============================================================================
1607 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlaceByHistory
1608 (GEOM::GEOM_Object_ptr theShapeWhere,
1609 GEOM::GEOM_Object_ptr theShapeWhat)
1611 GEOM::GEOM_Object_var aGEOMObject;
1613 //Set a not done flag
1614 GetOperations()->SetNotDone();
1616 //Get the reference objects
1617 Handle(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
1618 Handle(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
1620 if (aShapeWhere.IsNull() ||
1621 aShapeWhat.IsNull()) return aGEOMObject._retn();
1623 //Get Shapes in place of aShapeWhat
1624 Handle(GEOM_Object) anObject =
1625 GetOperations()->GetInPlaceByHistory(aShapeWhere, aShapeWhat);
1626 if (!GetOperations()->IsDone() || anObject.IsNull())
1627 return aGEOMObject._retn();
1629 return GetObject(anObject);
1632 //=============================================================================
1636 //=============================================================================
1637 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetSame
1638 (GEOM::GEOM_Object_ptr theShapeWhere,
1639 GEOM::GEOM_Object_ptr theShapeWhat)
1641 GEOM::GEOM_Object_var aGEOMObject;
1643 //Set a not done flag
1644 GetOperations()->SetNotDone();
1646 //Get the reference objects
1647 Handle(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
1648 Handle(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
1650 if (aShapeWhere.IsNull() ||
1651 aShapeWhat.IsNull()) return aGEOMObject._retn();
1653 //Get Shapes in place of aShapeWhat
1654 Handle(GEOM_Object) anObject =
1655 GetOperations()->GetSame(aShapeWhere, aShapeWhat);
1656 if (!GetOperations()->IsDone() || anObject.IsNull())
1657 return aGEOMObject._retn();
1659 return GetObject(anObject);