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
349 GEOM_IShapesOperations_i::MakeCompound (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
382 GEOM_IShapesOperations_i::MakeGlueFaces (const GEOM::ListOfGO& theShapes,
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 std::list< Handle(GEOM_Object) > aShapes;
393 if (! GetListOfObjectsImpl( theShapes, aShapes ))
394 return aGEOMObject._retn();
397 Handle(GEOM_Object) anObject =
398 GetOperations()->MakeGlueFaces(aShapes, theTolerance, doKeepNonSolids);
399 //if (!GetOperations()->IsDone() || anObject.IsNull())
401 if (anObject.IsNull())
402 return aGEOMObject._retn();
404 return GetObject(anObject);
407 //=============================================================================
411 //=============================================================================
413 GEOM_IShapesOperations_i::GetGlueFaces (const GEOM::ListOfGO& theShapes,
414 const CORBA::Double theTolerance)
416 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
418 //Set a not done flag
419 GetOperations()->SetNotDone();
421 //Get the reference objects
422 std::list< Handle(GEOM_Object) > aShapes;
423 if (! GetListOfObjectsImpl( theShapes, aShapes ))
426 Handle(TColStd_HSequenceOfTransient) aHSeq =
427 GetOperations()->GetGlueShapes(aShapes, theTolerance, TopAbs_FACE);
429 //if (!GetOperations()->IsDone() || aHSeq.IsNull())
434 Standard_Integer aLength = aHSeq->Length();
435 aSeq->length(aLength);
436 for (Standard_Integer i = 1; i <= aLength; i++)
437 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
442 //=============================================================================
444 * MakeGlueFacesByList
446 //=============================================================================
447 GEOM::GEOM_Object_ptr
448 GEOM_IShapesOperations_i::MakeGlueFacesByList (const GEOM::ListOfGO& theShapes,
449 CORBA::Double theTolerance,
450 const GEOM::ListOfGO& theFaces,
451 CORBA::Boolean doKeepNonSolids,
452 CORBA::Boolean doGlueAllEdges)
454 GEOM::GEOM_Object_var aGEOMObject;
456 //Set a not done flag
457 GetOperations()->SetNotDone();
459 //Get the reference objects
460 std::list< Handle(GEOM_Object) > aShapes;
461 if (! GetListOfObjectsImpl( theShapes, aShapes ))
462 return aGEOMObject._retn();
465 std::list<Handle(GEOM_Object)> aFaces;
466 if (! GetListOfObjectsImpl( theFaces, aFaces ))
467 return aGEOMObject._retn();
470 Handle(GEOM_Object) anObject =
471 GetOperations()->MakeGlueFacesByList(aShapes, theTolerance, aFaces,
472 doKeepNonSolids, doGlueAllEdges);
473 //if (!GetOperations()->IsDone() || anObject.IsNull())
475 if (anObject.IsNull())
476 return aGEOMObject._retn();
478 return GetObject(anObject);
481 //=============================================================================
485 //=============================================================================
486 GEOM::GEOM_Object_ptr
487 GEOM_IShapesOperations_i::MakeGlueEdges (const GEOM::ListOfGO& theShapes,
488 CORBA::Double theTolerance)
490 GEOM::GEOM_Object_var aGEOMObject;
492 //Set a not done flag
493 GetOperations()->SetNotDone();
495 //Get the reference objects
496 std::list< Handle(GEOM_Object) > aShapes;
497 if (! GetListOfObjectsImpl( theShapes, aShapes ))
498 return aGEOMObject._retn();
501 Handle(GEOM_Object) anObject =
502 GetOperations()->MakeGlueEdges(aShapes, theTolerance);
503 //if (!GetOperations()->IsDone() || anObject.IsNull())
505 if (anObject.IsNull())
506 return aGEOMObject._retn();
508 return GetObject(anObject);
511 //=============================================================================
515 //=============================================================================
517 GEOM_IShapesOperations_i::GetGlueEdges (const GEOM::ListOfGO& theShapes,
518 const CORBA::Double theTolerance)
520 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
522 //Set a not done flag
523 GetOperations()->SetNotDone();
525 //Get the reference objects
526 std::list< Handle(GEOM_Object) > aShapes;
527 if (! GetListOfObjectsImpl( theShapes, aShapes ))
530 Handle(TColStd_HSequenceOfTransient) aHSeq =
531 GetOperations()->GetGlueShapes(aShapes, 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
552 GEOM_IShapesOperations_i::MakeGlueEdgesByList (const GEOM::ListOfGO& theShapes,
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 std::list< Handle(GEOM_Object) > aShapes;
563 if (! GetListOfObjectsImpl( theShapes, aShapes ))
564 return aGEOMObject._retn();
567 std::list<Handle(GEOM_Object)> anEdges;
568 if (! GetListOfObjectsImpl( theEdges, anEdges ))
569 return aGEOMObject._retn();
572 Handle(GEOM_Object) anObject =
573 GetOperations()->MakeGlueEdgesByList(aShapes, theTolerance, anEdges);
574 //if (!GetOperations()->IsDone() || anObject.IsNull())
576 if (anObject.IsNull())
577 return aGEOMObject._retn();
579 return GetObject(anObject);
582 //=============================================================================
584 * GetExistingSubObjects
586 //=============================================================================
588 GEOM_IShapesOperations_i::GetExistingSubObjects (GEOM::GEOM_Object_ptr theShape,
589 CORBA::Boolean theGroupsOnly)
591 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
593 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
594 if (aShape.IsNull()) return aSeq._retn();
596 Handle(TColStd_HSequenceOfTransient) aHSeq =
597 GetOperations()->GetExistingSubObjects(aShape, theGroupsOnly);
598 if (!GetOperations()->IsDone() || aHSeq.IsNull())
601 Standard_Integer aLength = aHSeq->Length();
602 aSeq->length(aLength);
603 for (Standard_Integer i = 1; i <= aLength; i++)
604 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
609 //=============================================================================
611 * MakeExplode (including theShape itself, bad sorting)
613 //=============================================================================
614 GEOM::ListOfGO* GEOM_IShapesOperations_i::MakeExplode (GEOM::GEOM_Object_ptr theShape,
615 const CORBA::Long theShapeType,
616 const CORBA::Boolean isSorted)
618 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
620 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
621 if (aShape.IsNull()) return aSeq._retn();
623 Handle(TColStd_HSequenceOfTransient) aHSeq =
624 GetOperations()->MakeExplode(aShape, theShapeType, isSorted,
625 GEOMImpl_IShapesOperations::EXPLODE_OLD_INCLUDE_MAIN);
626 if (!GetOperations()->IsDone() || aHSeq.IsNull())
629 Standard_Integer aLength = aHSeq->Length();
630 aSeq->length(aLength);
631 for (Standard_Integer i = 1; i <= aLength; i++)
632 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
637 //=============================================================================
639 * MakeAllSubShapes (including theShape itself, good sorting)
641 //=============================================================================
642 GEOM::ListOfGO* GEOM_IShapesOperations_i::MakeAllSubShapes (GEOM::GEOM_Object_ptr theShape,
643 const CORBA::Long theShapeType,
644 const CORBA::Boolean isSorted)
646 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
648 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
649 if (aShape.IsNull()) return aSeq._retn();
651 Handle(TColStd_HSequenceOfTransient) aHSeq =
652 GetOperations()->MakeExplode(aShape, theShapeType, isSorted,
653 GEOMImpl_IShapesOperations::EXPLODE_NEW_INCLUDE_MAIN);
654 if (!GetOperations()->IsDone() || aHSeq.IsNull())
657 Standard_Integer aLength = aHSeq->Length();
658 aSeq->length(aLength);
659 for (Standard_Integer i = 1; i <= aLength; i++)
660 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
665 //=============================================================================
667 * ExtractSubShapes (excluding theShape itself, good sorting)
669 //=============================================================================
670 GEOM::ListOfGO* GEOM_IShapesOperations_i::ExtractSubShapes (GEOM::GEOM_Object_ptr theShape,
671 const CORBA::Long theShapeType,
672 const CORBA::Boolean isSorted)
674 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
676 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
677 if (aShape.IsNull()) return aSeq._retn();
679 Handle(TColStd_HSequenceOfTransient) aHSeq =
680 // TODO: enum instead of bool for the last argument
681 GetOperations()->MakeExplode(aShape, theShapeType, isSorted,
682 GEOMImpl_IShapesOperations::EXPLODE_NEW_EXCLUDE_MAIN);
683 if (!GetOperations()->IsDone() || aHSeq.IsNull())
686 Standard_Integer aLength = aHSeq->Length();
687 aSeq->length(aLength);
688 for (Standard_Integer i = 1; i <= aLength; i++)
689 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
694 //=============================================================================
698 //=============================================================================
699 GEOM::ListOfLong* GEOM_IShapesOperations_i::SubShapeAllIDs (GEOM::GEOM_Object_ptr theShape,
700 const CORBA::Long theShapeType,
701 const CORBA::Boolean isSorted)
703 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
705 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
706 if (aShape.IsNull()) return aSeq._retn();
708 Handle(TColStd_HSequenceOfInteger) aHSeq =
709 GetOperations()->SubShapeAllIDs(aShape, theShapeType, isSorted,
710 GEOMImpl_IShapesOperations::EXPLODE_OLD_INCLUDE_MAIN);
711 if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
713 Standard_Integer aLength = aHSeq->Length();
714 aSeq->length(aLength);
715 for (Standard_Integer i = 1; i <= aLength; i++)
716 aSeq[i-1] = aHSeq->Value(i);
721 //=============================================================================
725 //=============================================================================
726 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetAllSubShapesIDs (GEOM::GEOM_Object_ptr theShape,
727 const CORBA::Long theShapeType,
728 const CORBA::Boolean isSorted)
730 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
732 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
733 if (aShape.IsNull()) return aSeq._retn();
735 Handle(TColStd_HSequenceOfInteger) aHSeq =
736 GetOperations()->SubShapeAllIDs(aShape, theShapeType, isSorted,
737 GEOMImpl_IShapesOperations::EXPLODE_NEW_INCLUDE_MAIN);
738 if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
740 Standard_Integer aLength = aHSeq->Length();
741 aSeq->length(aLength);
742 for (Standard_Integer i = 1; i <= aLength; i++)
743 aSeq[i-1] = aHSeq->Value(i);
748 //=============================================================================
752 //=============================================================================
753 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetSubShape
754 (GEOM::GEOM_Object_ptr theMainShape,
755 const CORBA::Long theID)
757 GEOM::GEOM_Object_var aGEOMObject;
759 //Set a not done flag
760 GetOperations()->SetNotDone();
762 //Get the reference objects
763 Handle(GEOM_Object) aShape = GetObjectImpl(theMainShape);
764 if (aShape.IsNull()) return aGEOMObject._retn();
766 Handle(GEOM_Object) anObject = GetOperations()->GetSubShape(aShape, theID);
767 if (!GetOperations()->IsDone() || anObject.IsNull())
768 return aGEOMObject._retn();
770 return GetObject(anObject);
773 //=============================================================================
777 //=============================================================================
778 GEOM::ListOfGO* GEOM_IShapesOperations_i::MakeSubShapes (GEOM::GEOM_Object_ptr theMainShape,
779 const GEOM::ListOfLong& theIndices)
781 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
784 //Set a not done flag
785 GetOperations()->SetNotDone();
787 if (theIndices.length() < 1)
790 Handle(GEOM_Object) aShape = GetObjectImpl(theMainShape);
791 if (aShape.IsNull()) return aSeq._retn();
793 Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger (1, theIndices.length());
794 for (i = 0; i < theIndices.length(); i++)
795 anArray->SetValue(i+1, theIndices[i]);
797 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakeSubShapes(aShape, anArray);
798 if (!GetOperations()->IsDone() || aHSeq.IsNull())
801 Standard_Integer aLength = aHSeq->Length();
802 aSeq->length(aLength);
803 for (i = 0; i < aLength; i++)
804 aSeq[i] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i+1)));
809 //=============================================================================
813 //=============================================================================
814 CORBA::Long GEOM_IShapesOperations_i::GetSubShapeIndex
815 (GEOM::GEOM_Object_ptr theMainShape, GEOM::GEOM_Object_ptr theSubShape)
817 //Get the reference shapes
818 Handle(GEOM_Object) aMainShapeRef = GetObjectImpl(theMainShape);
819 Handle(GEOM_Object) aSubShapeRef = GetObjectImpl(theSubShape);
821 if (aMainShapeRef.IsNull() || aSubShapeRef.IsNull()) return -1;
823 //Get the unique ID of <theSubShape> inside <theMainShape>
824 CORBA::Long anID = GetOperations()->GetSubShapeIndex(aMainShapeRef, aSubShapeRef);
825 if (!GetOperations()->IsDone())
831 //=============================================================================
833 * GetSubShapesIndices
835 //=============================================================================
836 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetSubShapesIndices
837 (GEOM::GEOM_Object_ptr theMainShape, const GEOM::ListOfGO& theSubShapes)
839 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
841 //Get the reference main shape
842 Handle(GEOM_Object) aMainShapeRef = GetObjectImpl(theMainShape);
843 if (aMainShapeRef.IsNull()) return aSeq._retn();
846 std::list<Handle(GEOM_Object)> aShapes;
847 int aLen = theSubShapes.length();
848 for (int ind = 0; ind < aLen; ind++) {
849 Handle(GEOM_Object) aSh = GetObjectImpl(theSubShapes[ind]);
852 MESSAGE("NULL shape")
855 aShapes.push_back(aSh);
858 //Get the IDs of <theSubShapes> inside <theMainShape>
859 Handle(TColStd_HSequenceOfInteger) aHSeq =
860 GetOperations()->GetSubShapesIndices(aMainShapeRef, aShapes);
862 if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
864 Standard_Integer aLength = aHSeq->Length();
865 aSeq->length(aLength);
867 for (Standard_Integer i = 1; i <= aLength; i++)
868 aSeq[i-1] = aHSeq->Value(i);
874 //=============================================================================
878 //=============================================================================
879 CORBA::Long GEOM_IShapesOperations_i::GetTopologyIndex
880 (GEOM::GEOM_Object_ptr theMainShape, GEOM::GEOM_Object_ptr theSubShape)
882 //Get the reference shapes
883 Handle(GEOM_Object) aMainShapeRef = GetObjectImpl(theMainShape);
884 Handle(GEOM_Object) aSubShapeRef = GetObjectImpl(theSubShape);
886 if (aMainShapeRef.IsNull() || aSubShapeRef.IsNull()) return -1;
888 //Get an ID of <theSubShape>, unique among all sub-shapes of <theMainShape> of the same type
889 CORBA::Long anID = GetOperations()->GetTopologyIndex(aMainShapeRef, aSubShapeRef);
890 if (!GetOperations()->IsDone())
896 //=============================================================================
900 //=============================================================================
901 char* GEOM_IShapesOperations_i::GetShapeTypeString (GEOM::GEOM_Object_ptr theShape)
903 //Get the reference shape
904 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
905 if (aShape.IsNull()) return NULL;
907 // Get shape parameters
908 TCollection_AsciiString aDescription = GetOperations()->GetShapeTypeString(aShape);
909 return CORBA::string_dup(aDescription.ToCString());
912 //=============================================================================
916 //=============================================================================
917 CORBA::Long GEOM_IShapesOperations_i::NumberOfFaces (GEOM::GEOM_Object_ptr theShape)
919 return NumberOfSubShapes(theShape, Standard_Integer(TopAbs_FACE));
922 //=============================================================================
926 //=============================================================================
927 CORBA::Long GEOM_IShapesOperations_i::NumberOfEdges (GEOM::GEOM_Object_ptr theShape)
929 return NumberOfSubShapes(theShape, Standard_Integer(TopAbs_EDGE));
932 //=============================================================================
936 //=============================================================================
937 CORBA::Long GEOM_IShapesOperations_i::NumberOfSubShapes (GEOM::GEOM_Object_ptr theShape,
938 const CORBA::Long theShapeType)
940 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
941 if (aShape.IsNull()) return -1;
943 CORBA::Long aNb = GetOperations()->NumberOfSubShapes(aShape, theShapeType);
944 if (!GetOperations()->IsDone()) return -1;
949 //=============================================================================
953 //=============================================================================
954 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::ChangeOrientation
955 (GEOM::GEOM_Object_ptr theShape)
957 GEOM::GEOM_Object_var aGEOMObject;
959 //Set a not done flag
960 GetOperations()->SetNotDone();
962 //Get the reference objects
963 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
964 if (aShape.IsNull()) return aGEOMObject._retn();
967 Handle(GEOM_Object) anObject = GetOperations()->ReverseShape(aShape);
968 if (!GetOperations()->IsDone() || anObject.IsNull())
969 return aGEOMObject._retn();
971 return GetObject(anObject);
974 //=============================================================================
978 //=============================================================================
979 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetFreeFacesIDs (GEOM::GEOM_Object_ptr theShape)
981 //Set a not done flag
982 GetOperations()->SetNotDone();
984 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
986 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
987 if (aShape.IsNull()) return aSeq._retn();
989 Handle(TColStd_HSequenceOfInteger) aHSeq =
990 GetOperations()->GetFreeFacesIDs(aShape);
991 if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
993 Standard_Integer aLength = aHSeq->Length();
994 aSeq->length(aLength);
995 for (Standard_Integer i = 1; i <= aLength; i++)
996 aSeq[i-1] = aHSeq->Value(i);
1001 //=============================================================================
1005 //=============================================================================
1006 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSharedShapes
1007 (GEOM::GEOM_Object_ptr theShape1,
1008 GEOM::GEOM_Object_ptr theShape2,
1009 const CORBA::Long theShapeType)
1011 //Set a not done flag
1012 GetOperations()->SetNotDone();
1014 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1016 Handle(GEOM_Object) aShape1 = GetObjectImpl(theShape1);
1017 Handle(GEOM_Object) aShape2 = GetObjectImpl(theShape2);
1019 if (aShape1.IsNull() || aShape2.IsNull()) return aSeq._retn();
1021 Handle(TColStd_HSequenceOfTransient) aHSeq =
1022 GetOperations()->GetSharedShapes(aShape1, aShape2, theShapeType);
1023 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1024 return aSeq._retn();
1026 Standard_Integer aLength = aHSeq->Length();
1027 aSeq->length(aLength);
1028 for (Standard_Integer i = 1; i <= aLength; i++)
1029 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1031 return aSeq._retn();
1034 //=============================================================================
1036 * GetSharedShapesMulti
1038 //=============================================================================
1039 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSharedShapesMulti
1040 (const GEOM::ListOfGO& theShapes,
1041 const CORBA::Long theShapeType)
1043 //Set a not done flag
1044 GetOperations()->SetNotDone();
1046 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1049 std::list<Handle(GEOM_Object)> aShapes;
1050 int aLen = theShapes.length();
1051 for (int ind = 0; ind < aLen; ind++) {
1052 Handle(GEOM_Object) aSh = GetObjectImpl(theShapes[ind]);
1053 if (aSh.IsNull()) return aSeq._retn();
1054 aShapes.push_back(aSh);
1057 Handle(TColStd_HSequenceOfTransient) aHSeq =
1058 GetOperations()->GetSharedShapes(aShapes, theShapeType);
1059 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1060 return aSeq._retn();
1062 Standard_Integer aLength = aHSeq->Length();
1063 aSeq->length(aLength);
1064 for (Standard_Integer i = 1; i <= aLength; i++)
1065 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1067 return aSeq._retn();
1070 static GEOMAlgo_State ShapeState (const GEOM::shape_state theState)
1072 GEOMAlgo_State aState = GEOMAlgo_ST_UNKNOWN;
1076 aState = GEOMAlgo_ST_ON;
1079 aState = GEOMAlgo_ST_OUT;
1081 case GEOM::ST_ONOUT:
1082 aState = GEOMAlgo_ST_ONOUT;
1085 aState = GEOMAlgo_ST_IN;
1088 aState = GEOMAlgo_ST_ONIN;
1097 //=============================================================================
1101 //=============================================================================
1102 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnPlane
1103 (GEOM::GEOM_Object_ptr theShape,
1104 const CORBA::Long theShapeType,
1105 GEOM::GEOM_Object_ptr theAx1,
1106 const GEOM::shape_state theState)
1108 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1110 //Set a not done flag
1111 GetOperations()->SetNotDone();
1113 //Get the reference objects
1114 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1115 Handle(GEOM_Object) anAx1 = GetObjectImpl(theAx1);
1117 if (aShape.IsNull() || anAx1.IsNull()) return aSeq._retn();
1119 //Get Shapes On Plane
1120 Handle(TColStd_HSequenceOfTransient) aHSeq =
1121 GetOperations()->GetShapesOnPlane(aShape, theShapeType, anAx1, ShapeState(theState));
1122 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1123 return aSeq._retn();
1125 Standard_Integer aLength = aHSeq->Length();
1126 aSeq->length(aLength);
1127 for (Standard_Integer i = 1; i <= aLength; i++)
1128 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1130 return aSeq._retn();
1133 //=============================================================================
1135 * GetShapesOnPlaneWithLocation
1137 //=============================================================================
1138 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnPlaneWithLocation
1139 (GEOM::GEOM_Object_ptr theShape,
1140 const CORBA::Long theShapeType,
1141 GEOM::GEOM_Object_ptr theAx1,
1142 GEOM::GEOM_Object_ptr thePnt,
1143 const GEOM::shape_state theState)
1145 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1147 //Set a not done flag
1148 GetOperations()->SetNotDone();
1150 //Get the reference objects
1151 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1152 Handle(GEOM_Object) anAx1 = GetObjectImpl(theAx1);
1153 Handle(GEOM_Object) anPnt = GetObjectImpl(thePnt);
1155 if (aShape.IsNull() || anAx1.IsNull() || anPnt.IsNull()) return aSeq._retn();
1157 //Get Shapes On Plane
1158 Handle(TColStd_HSequenceOfTransient) aHSeq =
1159 GetOperations()->GetShapesOnPlaneWithLocation(aShape, theShapeType, anAx1, anPnt, ShapeState(theState));
1160 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1161 return aSeq._retn();
1163 Standard_Integer aLength = aHSeq->Length();
1164 aSeq->length(aLength);
1165 for (Standard_Integer i = 1; i <= aLength; i++)
1166 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1168 return aSeq._retn();
1171 //=============================================================================
1173 * GetShapesOnCylinder
1175 //=============================================================================
1176 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnCylinder
1177 (GEOM::GEOM_Object_ptr theShape,
1178 const CORBA::Long theShapeType,
1179 GEOM::GEOM_Object_ptr theAxis,
1180 const CORBA::Double theRadius,
1181 const GEOM::shape_state theState)
1183 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1185 //Set a not done flag
1186 GetOperations()->SetNotDone();
1188 //Get the reference objects
1189 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1190 Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
1192 if (aShape.IsNull() || anAxis.IsNull()) return aSeq._retn();
1194 //Get Shapes On Cylinder
1195 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnCylinder
1196 (aShape, theShapeType, anAxis, theRadius, ShapeState(theState));
1197 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1198 return aSeq._retn();
1200 Standard_Integer aLength = aHSeq->Length();
1201 aSeq->length(aLength);
1202 for (Standard_Integer i = 1; i <= aLength; i++)
1203 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1205 return aSeq._retn();
1208 //=============================================================================
1210 * GetShapesOnCylinderWithLocation
1212 //=============================================================================
1213 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnCylinderWithLocation
1214 (GEOM::GEOM_Object_ptr theShape,
1215 const CORBA::Long theShapeType,
1216 GEOM::GEOM_Object_ptr theAxis,
1217 GEOM::GEOM_Object_ptr thePnt,
1218 const CORBA::Double theRadius,
1219 const GEOM::shape_state theState)
1221 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1223 //Set a not done flag
1224 GetOperations()->SetNotDone();
1226 //Get the reference objects
1227 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1228 Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
1229 Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
1231 if (aShape.IsNull() || anAxis.IsNull() || aPnt.IsNull()) return aSeq._retn();
1233 //Get Shapes On Cylinder
1234 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnCylinderWithLocation
1235 (aShape, theShapeType, anAxis, aPnt, theRadius, ShapeState(theState));
1236 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1237 return aSeq._retn();
1239 Standard_Integer aLength = aHSeq->Length();
1240 aSeq->length(aLength);
1241 for (Standard_Integer i = 1; i <= aLength; i++)
1242 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1244 return aSeq._retn();
1247 //=============================================================================
1251 //=============================================================================
1252 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnSphere
1253 (GEOM::GEOM_Object_ptr theShape,
1254 const CORBA::Long theShapeType,
1255 GEOM::GEOM_Object_ptr theCenter,
1256 const CORBA::Double theRadius,
1257 const GEOM::shape_state theState)
1259 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1261 //Set a not done flag
1262 GetOperations()->SetNotDone();
1264 //Get the reference objects
1265 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1266 Handle(GEOM_Object) aCenter = GetObjectImpl(theCenter);
1268 if (aShape.IsNull() || aCenter.IsNull()) return aSeq._retn();
1270 //Get Shapes On Sphere
1271 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnSphere
1272 (aShape, theShapeType, aCenter, theRadius, ShapeState(theState));
1273 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1274 return aSeq._retn();
1276 Standard_Integer aLength = aHSeq->Length();
1277 aSeq->length(aLength);
1278 for (Standard_Integer i = 1; i <= aLength; i++)
1279 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1281 return aSeq._retn();
1284 //=============================================================================
1286 * GetShapesOnQuadrangle
1288 //=============================================================================
1289 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnQuadrangle
1290 (GEOM::GEOM_Object_ptr theShape,
1291 CORBA::Long theShapeType,
1292 GEOM::GEOM_Object_ptr theTopLeftPoint,
1293 GEOM::GEOM_Object_ptr theTopRigthPoint,
1294 GEOM::GEOM_Object_ptr theBottomLeftPoint,
1295 GEOM::GEOM_Object_ptr theBottomRigthPoint,
1296 GEOM::shape_state theState)
1298 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1300 //Set a not done flag
1301 GetOperations()->SetNotDone();
1303 //Get the reference objects
1304 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1305 Handle(GEOM_Object) aTopLeftPoint = GetObjectImpl(theTopLeftPoint);
1306 Handle(GEOM_Object) aTopRigthPoint = GetObjectImpl(theTopRigthPoint);
1307 Handle(GEOM_Object) aBottomLeftPoint = GetObjectImpl(theBottomLeftPoint);
1308 Handle(GEOM_Object) aBottomRigthPoint = GetObjectImpl(theBottomRigthPoint);
1310 if (aShape.IsNull() ||
1311 aTopLeftPoint.IsNull() ||
1312 aTopRigthPoint.IsNull() ||
1313 aBottomLeftPoint.IsNull() ||
1314 aBottomRigthPoint.IsNull())
1315 return aSeq._retn();
1317 //Get Shapes On Quadrangle
1318 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnQuadrangle
1319 (aShape, theShapeType,
1320 aTopLeftPoint, aTopRigthPoint, aBottomLeftPoint, aBottomRigthPoint,
1321 ShapeState(theState));
1322 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1323 return aSeq._retn();
1325 Standard_Integer aLength = aHSeq->Length();
1326 aSeq->length(aLength);
1327 for (Standard_Integer i = 1; i <= aLength; i++)
1328 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1330 return aSeq._retn();
1333 //=============================================================================
1335 * GetShapesOnPlaneIDs
1337 //=============================================================================
1338 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnPlaneIDs
1339 (GEOM::GEOM_Object_ptr theShape,
1340 const CORBA::Long theShapeType,
1341 GEOM::GEOM_Object_ptr theAx1,
1342 const GEOM::shape_state theState)
1344 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1346 //Set a not done flag
1347 GetOperations()->SetNotDone();
1349 //Get the reference objects
1350 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1351 Handle(GEOM_Object) anAx1 = GetObjectImpl(theAx1);
1353 if (aShape.IsNull() || anAx1.IsNull()) return aSeq._retn();
1355 //Get Shapes On Plane
1356 Handle(TColStd_HSequenceOfInteger) aHSeq =
1357 GetOperations()->GetShapesOnPlaneIDs(aShape, theShapeType, anAx1, ShapeState(theState));
1358 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1359 return aSeq._retn();
1361 Standard_Integer aLength = aHSeq->Length();
1362 aSeq->length(aLength);
1363 for (Standard_Integer i = 1; i <= aLength; i++)
1364 aSeq[i-1] = aHSeq->Value(i);
1366 return aSeq._retn();
1369 //=============================================================================
1371 * GetShapesOnPlaneWithLocationIDs
1373 //=============================================================================
1374 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnPlaneWithLocationIDs
1375 (GEOM::GEOM_Object_ptr theShape,
1376 const CORBA::Long theShapeType,
1377 GEOM::GEOM_Object_ptr theAx1,
1378 GEOM::GEOM_Object_ptr thePnt,
1379 const GEOM::shape_state theState)
1381 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1383 //Set a not done flag
1384 GetOperations()->SetNotDone();
1386 //Get the reference objects
1387 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1388 Handle(GEOM_Object) anAx1 = GetObjectImpl(theAx1);
1389 Handle(GEOM_Object) anPnt = GetObjectImpl(thePnt);
1391 if (aShape.IsNull() || anAx1.IsNull() || anPnt.IsNull()) return aSeq._retn();
1393 //Get Shapes On Plane
1394 Handle(TColStd_HSequenceOfInteger) aHSeq =
1395 GetOperations()->GetShapesOnPlaneWithLocationIDs(aShape, theShapeType,
1396 anAx1, anPnt, ShapeState(theState));
1397 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1398 return aSeq._retn();
1400 Standard_Integer aLength = aHSeq->Length();
1401 aSeq->length(aLength);
1402 for (Standard_Integer i = 1; i <= aLength; i++)
1403 aSeq[i-1] = aHSeq->Value(i);
1405 return aSeq._retn();
1408 //=============================================================================
1410 * GetShapesOnCylinderIDs
1412 //=============================================================================
1413 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnCylinderIDs
1414 (GEOM::GEOM_Object_ptr theShape,
1415 const CORBA::Long theShapeType,
1416 GEOM::GEOM_Object_ptr theAxis,
1417 const CORBA::Double theRadius,
1418 const GEOM::shape_state theState)
1420 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1422 //Set a not done flag
1423 GetOperations()->SetNotDone();
1425 //Get the reference objects
1426 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1427 Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
1429 if (aShape.IsNull() || anAxis.IsNull()) return aSeq._retn();
1431 //Get Shapes On Cylinder
1432 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnCylinderIDs
1433 (aShape, theShapeType, anAxis, theRadius, ShapeState(theState));
1434 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1435 return aSeq._retn();
1437 Standard_Integer aLength = aHSeq->Length();
1438 aSeq->length(aLength);
1439 for (Standard_Integer i = 1; i <= aLength; i++)
1440 aSeq[i-1] = aHSeq->Value(i);
1442 return aSeq._retn();
1445 //=============================================================================
1447 * GetShapesOnCylinderWithLocationIDs
1449 //=============================================================================
1450 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnCylinderWithLocationIDs
1451 (GEOM::GEOM_Object_ptr theShape,
1452 const CORBA::Long theShapeType,
1453 GEOM::GEOM_Object_ptr theAxis,
1454 GEOM::GEOM_Object_ptr thePnt,
1455 const CORBA::Double theRadius,
1456 const GEOM::shape_state theState)
1458 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1460 //Set a not done flag
1461 GetOperations()->SetNotDone();
1463 //Get the reference objects
1464 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1465 Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
1466 Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
1468 if (aShape.IsNull() || anAxis.IsNull() || aPnt.IsNull()) return aSeq._retn();
1470 //Get Shapes On Cylinder
1471 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnCylinderWithLocationIDs
1472 (aShape, theShapeType, anAxis, aPnt, theRadius, ShapeState(theState));
1473 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1474 return aSeq._retn();
1476 Standard_Integer aLength = aHSeq->Length();
1477 aSeq->length(aLength);
1478 for (Standard_Integer i = 1; i <= aLength; i++)
1479 aSeq[i-1] = aHSeq->Value(i);
1481 return aSeq._retn();
1484 //=============================================================================
1486 * GetShapesOnSphereIDs
1488 //=============================================================================
1489 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnSphereIDs
1490 (GEOM::GEOM_Object_ptr theShape,
1491 const CORBA::Long theShapeType,
1492 GEOM::GEOM_Object_ptr theCenter,
1493 const CORBA::Double theRadius,
1494 const GEOM::shape_state theState)
1496 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1498 //Set a not done flag
1499 GetOperations()->SetNotDone();
1501 //Get the reference objects
1502 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1503 Handle(GEOM_Object) aCenter = GetObjectImpl(theCenter);
1505 if (aShape.IsNull() || aCenter.IsNull()) return aSeq._retn();
1507 //Get Shapes On Sphere
1508 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnSphereIDs
1509 (aShape, theShapeType, aCenter, theRadius, ShapeState(theState));
1510 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1511 return aSeq._retn();
1513 Standard_Integer aLength = aHSeq->Length();
1514 aSeq->length(aLength);
1515 for (Standard_Integer i = 1; i <= aLength; i++)
1516 aSeq[i-1] = aHSeq->Value(i);
1518 return aSeq._retn();
1521 //=============================================================================
1523 * GetShapesOnQuadrangleIDs
1525 //=============================================================================
1526 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnQuadrangleIDs
1527 (GEOM::GEOM_Object_ptr theShape,
1528 CORBA::Long theShapeType,
1529 GEOM::GEOM_Object_ptr theTopLeftPoint,
1530 GEOM::GEOM_Object_ptr theTopRigthPoint,
1531 GEOM::GEOM_Object_ptr theBottomLeftPoint,
1532 GEOM::GEOM_Object_ptr theBottomRigthPoint,
1533 GEOM::shape_state theState)
1535 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1537 //Set a not done flag
1538 GetOperations()->SetNotDone();
1540 //Get the reference objects
1541 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1542 Handle(GEOM_Object) aTopLeftPoint = GetObjectImpl(theTopLeftPoint);
1543 Handle(GEOM_Object) aTopRigthPoint = GetObjectImpl(theTopRigthPoint);
1544 Handle(GEOM_Object) aBottomLeftPoint = GetObjectImpl(theBottomLeftPoint);
1545 Handle(GEOM_Object) aBottomRigthPoint = GetObjectImpl(theBottomRigthPoint);
1547 if (aShape.IsNull() ||
1548 aTopLeftPoint.IsNull() ||
1549 aTopRigthPoint.IsNull() ||
1550 aBottomLeftPoint.IsNull() ||
1551 aBottomRigthPoint.IsNull() )
1552 return aSeq._retn();
1554 //Get Shapes On Quadrangle
1555 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnQuadrangleIDs
1556 (aShape, theShapeType,
1557 aTopLeftPoint, aTopRigthPoint, aBottomLeftPoint, aBottomRigthPoint,
1558 ShapeState(theState));
1559 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1560 return aSeq._retn();
1562 Standard_Integer aLength = aHSeq->Length();
1563 aSeq->length(aLength);
1564 for (Standard_Integer i = 1; i <= aLength; i++)
1565 aSeq[i-1] = aHSeq->Value(i);
1567 return aSeq._retn();
1570 //=============================================================================
1574 //=============================================================================
1575 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnBox
1576 (GEOM::GEOM_Object_ptr theBox,
1577 GEOM::GEOM_Object_ptr theShape,
1578 CORBA::Long theShapeType,
1579 GEOM::shape_state theState)
1581 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1583 //Set a not done flag
1584 GetOperations()->SetNotDone();
1586 //Get the reference objects
1587 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1588 Handle(GEOM_Object) aBox = GetObjectImpl(theBox);
1590 if (aShape.IsNull() || aBox.IsNull() )
1591 return aSeq._retn();
1594 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnBox
1595 (aBox,aShape, theShapeType,ShapeState(theState));
1596 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1597 return aSeq._retn();
1599 Standard_Integer aLength = aHSeq->Length();
1600 aSeq->length(aLength);
1601 for (Standard_Integer i = 1; i <= aLength; i++)
1602 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1604 return aSeq._retn();
1607 //=============================================================================
1609 * GetShapesOnQuadrangleIDs
1611 //=============================================================================
1612 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnBoxIDs
1613 (GEOM::GEOM_Object_ptr theBox,
1614 GEOM::GEOM_Object_ptr theShape,
1615 CORBA::Long theShapeType,
1616 GEOM::shape_state theState)
1618 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1620 //Set a not done flag
1621 GetOperations()->SetNotDone();
1623 //Get the reference objects
1624 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1625 Handle(GEOM_Object) aBox = GetObjectImpl(theBox);
1627 if (aShape.IsNull() || aBox.IsNull() )
1628 return aSeq._retn();
1631 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnBoxIDs
1632 (aBox,aShape, theShapeType,ShapeState(theState));
1633 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1634 return aSeq._retn();
1636 Standard_Integer aLength = aHSeq->Length();
1637 aSeq->length(aLength);
1638 for (Standard_Integer i = 1; i <= aLength; i++)
1639 aSeq[i-1] = aHSeq->Value(i);
1641 return aSeq._retn();
1645 //=============================================================================
1649 //=============================================================================
1650 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnShape
1651 (GEOM::GEOM_Object_ptr theCheckShape,
1652 GEOM::GEOM_Object_ptr theShape,
1653 CORBA::Short theShapeType,
1654 GEOM::shape_state theState)
1656 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1658 //Set a not done flag
1659 GetOperations()->SetNotDone();
1661 //Get the reference objects
1662 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1663 Handle(GEOM_Object) aCheckShape = GetObjectImpl(theCheckShape);
1665 if (aShape.IsNull() || aCheckShape.IsNull() )
1666 return aSeq._retn();
1668 //Get Shapes On Shape
1669 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnShape
1670 (aCheckShape,aShape, theShapeType,ShapeState(theState));
1672 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1673 return aSeq._retn();
1675 Standard_Integer aLength = aHSeq->Length();
1676 aSeq->length(aLength);
1677 for (Standard_Integer i = 1; i <= aLength; i++)
1678 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
1680 return aSeq._retn();
1684 //=============================================================================
1686 * GetShapesOnShapeAsCompound
1688 //=============================================================================
1689 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetShapesOnShapeAsCompound
1690 (GEOM::GEOM_Object_ptr theCheckShape,
1691 GEOM::GEOM_Object_ptr theShape,
1692 CORBA::Short theShapeType,
1693 GEOM::shape_state theState)
1695 GEOM::GEOM_Object_var aGEOMObject;
1697 //Set a not done flag
1698 GetOperations()->SetNotDone();
1700 //Get the reference objects
1701 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1702 Handle(GEOM_Object) aCheckShape = GetObjectImpl(theCheckShape);
1704 if (aShape.IsNull() || aCheckShape.IsNull() )
1705 return aGEOMObject._retn();
1707 //Get Shapes On Shape
1708 Handle(GEOM_Object) anObject = GetOperations()->GetShapesOnShapeAsCompound
1709 (aCheckShape,aShape, theShapeType,ShapeState(theState));
1711 if (anObject.IsNull())
1712 return aGEOMObject._retn();
1714 return GetObject(anObject);
1718 //=============================================================================
1720 * GetShapesOnShapeIDs
1722 //=============================================================================
1723 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnShapeIDs
1724 (GEOM::GEOM_Object_ptr theCheckShape,
1725 GEOM::GEOM_Object_ptr theShape,
1726 CORBA::Short theShapeType,
1727 GEOM::shape_state theState)
1729 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1731 //Set a not done flag
1732 GetOperations()->SetNotDone();
1734 //Get the reference objects
1735 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1736 Handle(GEOM_Object) aCheckShape = GetObjectImpl(theCheckShape);
1738 if (aShape.IsNull() || aCheckShape.IsNull() )
1739 return aSeq._retn();
1741 //Get Shapes On Shape
1742 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnShapeIDs
1743 (aCheckShape,aShape, theShapeType,ShapeState(theState));
1744 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1745 return aSeq._retn();
1747 Standard_Integer aLength = aHSeq->Length();
1748 aSeq->length(aLength);
1749 for (Standard_Integer i = 1; i <= aLength; i++)
1750 aSeq[i-1] = aHSeq->Value(i);
1752 return aSeq._retn();
1756 //=============================================================================
1760 //=============================================================================
1761 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlace
1762 (GEOM::GEOM_Object_ptr theShapeWhere,
1763 GEOM::GEOM_Object_ptr theShapeWhat)
1765 GEOM::GEOM_Object_var aGEOMObject;
1767 //Set a not done flag
1768 GetOperations()->SetNotDone();
1770 //Get the reference objects
1771 Handle(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
1772 Handle(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
1774 if (aShapeWhere.IsNull() ||
1775 aShapeWhat.IsNull()) return aGEOMObject._retn();
1777 //Get Shapes in place of aShapeWhat
1778 Handle(GEOM_Object) anObject =
1779 GetOperations()->GetInPlace(aShapeWhere, aShapeWhat);
1780 if (!GetOperations()->IsDone() || anObject.IsNull())
1781 return aGEOMObject._retn();
1783 return GetObject(anObject);
1786 //=============================================================================
1790 //=============================================================================
1791 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlaceOld
1792 (GEOM::GEOM_Object_ptr theShapeWhere,
1793 GEOM::GEOM_Object_ptr theShapeWhat)
1795 GEOM::GEOM_Object_var aGEOMObject;
1797 //Set a not done flag
1798 GetOperations()->SetNotDone();
1800 //Get the reference objects
1801 Handle(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
1802 Handle(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
1804 if (aShapeWhere.IsNull() ||
1805 aShapeWhat.IsNull()) return aGEOMObject._retn();
1807 //Get Shapes in place of aShapeWhat
1808 Handle(GEOM_Object) anObject =
1809 GetOperations()->GetInPlaceOld(aShapeWhere, aShapeWhat);
1810 if (!GetOperations()->IsDone() || anObject.IsNull())
1811 return aGEOMObject._retn();
1813 return GetObject(anObject);
1816 //=============================================================================
1818 * GetInPlaceByHistory
1820 //=============================================================================
1821 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlaceByHistory
1822 (GEOM::GEOM_Object_ptr theShapeWhere,
1823 GEOM::GEOM_Object_ptr theShapeWhat)
1825 GEOM::GEOM_Object_var aGEOMObject;
1827 //Set a not done flag
1828 GetOperations()->SetNotDone();
1830 //Get the reference objects
1831 Handle(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
1832 Handle(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
1834 if (aShapeWhere.IsNull() ||
1835 aShapeWhat.IsNull()) return aGEOMObject._retn();
1837 //Get Shapes in place of aShapeWhat
1838 Handle(GEOM_Object) anObject =
1839 GetOperations()->GetInPlaceByHistory(aShapeWhere, aShapeWhat);
1840 if (!GetOperations()->IsDone() || anObject.IsNull())
1841 return aGEOMObject._retn();
1843 return GetObject(anObject);
1846 //=============================================================================
1850 //=============================================================================
1851 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetSame
1852 (GEOM::GEOM_Object_ptr theShapeWhere,
1853 GEOM::GEOM_Object_ptr theShapeWhat)
1855 GEOM::GEOM_Object_var aGEOMObject;
1857 //Set a not done flag
1858 GetOperations()->SetNotDone();
1860 //Get the reference objects
1861 Handle(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
1862 Handle(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
1864 if (aShapeWhere.IsNull() ||
1865 aShapeWhat.IsNull()) return aGEOMObject._retn();
1867 //Get Shapes in place of aShapeWhat
1868 Handle(GEOM_Object) anObject =
1869 GetOperations()->GetSame(aShapeWhere, aShapeWhat);
1870 if (!GetOperations()->IsDone() || anObject.IsNull())
1871 return aGEOMObject._retn();
1873 return GetObject(anObject);
1876 //=============================================================================
1880 //=============================================================================
1881 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetSameIDs
1882 (GEOM::GEOM_Object_ptr theShapeWhere,
1883 GEOM::GEOM_Object_ptr theShapeWhat) {
1884 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1886 //Get the reference objects
1887 Handle(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
1888 Handle(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
1890 if (aShapeWhere.IsNull() ||
1891 aShapeWhat.IsNull()) return aSeq._retn();
1894 Handle(TColStd_HSequenceOfInteger) aHSeq =
1895 GetOperations()->GetSameIDs(aShapeWhere, aShapeWhat);
1897 if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
1899 Standard_Integer aLength = aHSeq->Length();
1900 aSeq->length(aLength);
1901 for (Standard_Integer i = 1; i <= aLength; i++)
1902 aSeq[i-1] = aHSeq->Value(i);
1904 return aSeq._retn();