1 #include <Standard_Stream.hxx>
3 #include "GEOM_IShapesOperations_i.hh"
7 #include "Utils_ExceptHandlers.hxx"
9 #include "GEOM_Engine.hxx"
10 #include "GEOM_Object.hxx"
12 #include <TColStd_HSequenceOfTransient.hxx>
13 #include <TColStd_HArray1OfInteger.hxx>
15 //=============================================================================
19 //=============================================================================
20 GEOM_IShapesOperations_i::GEOM_IShapesOperations_i (PortableServer::POA_ptr thePOA,
21 GEOM::GEOM_Gen_ptr theEngine,
22 ::GEOMImpl_IShapesOperations* theImpl)
23 :GEOM_IOperations_i(thePOA, theEngine, theImpl)
25 MESSAGE("GEOM_IShapesOperations_i::GEOM_IShapesOperations_i");
28 //=============================================================================
32 //=============================================================================
33 GEOM_IShapesOperations_i::~GEOM_IShapesOperations_i()
35 MESSAGE("GEOM_IShapesOperations_i::~GEOM_IShapesOperations_i");
39 //=============================================================================
43 //=============================================================================
44 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeEdge
45 (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2)
47 GEOM::GEOM_Object_var aGEOMObject;
50 GetOperations()->SetNotDone();
52 if (thePnt1 == NULL || thePnt2 == NULL) return aGEOMObject._retn();
54 //Get the reference points
55 Handle(GEOM_Object) aPnt1 = GetOperations()->GetEngine()->GetObject
56 (thePnt1->GetStudyID(), thePnt1->GetEntry());
57 Handle(GEOM_Object) aPnt2 = GetOperations()->GetEngine()->GetObject
58 (thePnt2->GetStudyID(), thePnt2->GetEntry());
60 if (aPnt1.IsNull() || aPnt2.IsNull()) return aGEOMObject._retn();
63 Handle(GEOM_Object) anObject = GetOperations()->MakeEdge(aPnt1, aPnt2);
64 if (!GetOperations()->IsDone() || anObject.IsNull())
65 return aGEOMObject._retn();
67 return GetObject(anObject);
70 //=============================================================================
74 //=============================================================================
75 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeWire
76 (const GEOM::ListOfGO& theEdgesAndWires)
78 GEOM::GEOM_Object_var aGEOMObject;
81 GetOperations()->SetNotDone();
84 list<Handle(GEOM_Object)> aShapes;
87 aLen = theEdgesAndWires.length();
88 for (ind = 0; ind < aLen; ind++) {
89 if (theEdgesAndWires[ind] == NULL) return aGEOMObject._retn();
90 Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject
91 (theEdgesAndWires[ind]->GetStudyID(), theEdgesAndWires[ind]->GetEntry());
92 if (aSh.IsNull()) return aGEOMObject._retn();
93 aShapes.push_back(aSh);
97 Handle(GEOM_Object) anObject =
98 GetOperations()->MakeWire(aShapes);
99 if (!GetOperations()->IsDone() || anObject.IsNull())
100 return aGEOMObject._retn();
102 return GetObject(anObject);
105 //=============================================================================
109 //=============================================================================
110 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeFace
111 (GEOM::GEOM_Object_ptr theWire,
112 const CORBA::Boolean isPlanarWanted)
114 GEOM::GEOM_Object_var aGEOMObject;
116 //Set a not done flag
117 GetOperations()->SetNotDone();
119 if (theWire == NULL) return aGEOMObject._retn();
121 //Get the reference wire
122 Handle(GEOM_Object) aWire = GetOperations()->GetEngine()->GetObject
123 (theWire->GetStudyID(), theWire->GetEntry());
125 if (aWire.IsNull()) return aGEOMObject._retn();
128 Handle(GEOM_Object) anObject = GetOperations()->MakeFace(aWire, isPlanarWanted);
129 if (!GetOperations()->IsDone() || anObject.IsNull())
130 return aGEOMObject._retn();
132 return GetObject(anObject);
135 //=============================================================================
139 //=============================================================================
140 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeFaceWires
141 (const GEOM::ListOfGO& theWires,
142 const CORBA::Boolean isPlanarWanted)
144 GEOM::GEOM_Object_var aGEOMObject;
146 //Set a not done flag
147 GetOperations()->SetNotDone();
150 list<Handle(GEOM_Object)> aShapes;
153 aLen = theWires.length();
154 for (ind = 0; ind < aLen; ind++) {
155 if (theWires[ind] == NULL) return aGEOMObject._retn();
156 Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject
157 (theWires[ind]->GetStudyID(), theWires[ind]->GetEntry());
158 if (aSh.IsNull()) return aGEOMObject._retn();
159 aShapes.push_back(aSh);
163 Handle(GEOM_Object) anObject =
164 GetOperations()->MakeFaceWires(aShapes, isPlanarWanted);
165 if (!GetOperations()->IsDone() || anObject.IsNull())
166 return aGEOMObject._retn();
168 return GetObject(anObject);
171 //=============================================================================
175 //=============================================================================
176 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeShell
177 (const GEOM::ListOfGO& theFacesAndShells)
179 GEOM::GEOM_Object_var aGEOMObject;
181 //Set a not done flag
182 GetOperations()->SetNotDone();
185 list<Handle(GEOM_Object)> aShapes;
188 aLen = theFacesAndShells.length();
189 for (ind = 0; ind < aLen; ind++) {
190 if (theFacesAndShells[ind] == NULL) return aGEOMObject._retn();
191 Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject
192 (theFacesAndShells[ind]->GetStudyID(), theFacesAndShells[ind]->GetEntry());
193 if (aSh.IsNull()) return aGEOMObject._retn();
194 aShapes.push_back(aSh);
198 Handle(GEOM_Object) anObject =
199 GetOperations()->MakeShell(aShapes);
200 if (!GetOperations()->IsDone() || anObject.IsNull())
201 return aGEOMObject._retn();
203 return GetObject(anObject);
206 //=============================================================================
210 //=============================================================================
211 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeSolidShell
212 (GEOM::GEOM_Object_ptr theShell)
214 GEOM::GEOM_Object_var aGEOMObject;
216 //Set a not done flag
217 GetOperations()->SetNotDone();
219 if (theShell == NULL) return aGEOMObject._retn();
221 //Get the reference objects
222 Handle(GEOM_Object) aShell = GetOperations()->GetEngine()->GetObject
223 (theShell->GetStudyID(), theShell->GetEntry());
225 if (aShell.IsNull()) return aGEOMObject._retn();
228 Handle(GEOM_Object) anObject = GetOperations()->MakeSolidShell(aShell);
229 if (!GetOperations()->IsDone() || anObject.IsNull())
230 return aGEOMObject._retn();
232 return GetObject(anObject);
235 //=============================================================================
239 //=============================================================================
240 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeSolidShells
241 (const GEOM::ListOfGO& theShells)
243 GEOM::GEOM_Object_var aGEOMObject;
245 //Set a not done flag
246 GetOperations()->SetNotDone();
249 list<Handle(GEOM_Object)> aShapes;
252 aLen = theShells.length();
253 for (ind = 0; ind < aLen; ind++) {
254 if (theShells[ind] == NULL) return aGEOMObject._retn();
255 Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject
256 (theShells[ind]->GetStudyID(), theShells[ind]->GetEntry());
257 if (aSh.IsNull()) return aGEOMObject._retn();
258 aShapes.push_back(aSh);
262 Handle(GEOM_Object) anObject =
263 GetOperations()->MakeSolidShells(aShapes);
264 if (!GetOperations()->IsDone() || anObject.IsNull())
265 return aGEOMObject._retn();
267 return GetObject(anObject);
270 //=============================================================================
274 //=============================================================================
275 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeCompound
276 (const GEOM::ListOfGO& theShapes)
278 GEOM::GEOM_Object_var aGEOMObject;
280 //Set a not done flag
281 GetOperations()->SetNotDone();
284 list<Handle(GEOM_Object)> aShapes;
287 aLen = theShapes.length();
288 for (ind = 0; ind < aLen; ind++) {
289 if (theShapes[ind] == NULL) return aGEOMObject._retn();
290 Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject
291 (theShapes[ind]->GetStudyID(), theShapes[ind]->GetEntry());
292 if (aSh.IsNull()) return aGEOMObject._retn();
293 aShapes.push_back(aSh);
297 Handle(GEOM_Object) anObject =
298 GetOperations()->MakeCompound(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::MakeGlueFaces
311 (GEOM::GEOM_Object_ptr theShape,
312 const CORBA::Double theTolerance)
314 GEOM::GEOM_Object_var aGEOMObject;
316 //Set a not done flag
317 GetOperations()->SetNotDone();
319 if (theShape == NULL) return aGEOMObject._retn();
321 //Get the reference objects
322 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
323 (theShape->GetStudyID(), theShape->GetEntry());
325 if (aShape.IsNull()) return aGEOMObject._retn();
328 Handle(GEOM_Object) anObject =
329 GetOperations()->MakeGlueFaces(aShape, theTolerance);
330 //if (!GetOperations()->IsDone() || anObject.IsNull())
332 if (anObject.IsNull())
333 return aGEOMObject._retn();
335 return GetObject(anObject);
338 //=============================================================================
342 //=============================================================================
343 GEOM::ListOfGO* GEOM_IShapesOperations_i::MakeExplode (GEOM::GEOM_Object_ptr theShape,
344 const CORBA::Long theShapeType,
345 const CORBA::Boolean isSorted)
347 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
348 if (theShape == NULL) return aSeq._retn();
350 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
351 (theShape->GetStudyID(), theShape->GetEntry());
353 Handle(TColStd_HSequenceOfTransient) aHSeq =
354 GetOperations()->MakeExplode(aShape, theShapeType, isSorted);
355 if (!GetOperations()->IsDone() || aHSeq.IsNull())
358 Standard_Integer aLength = aHSeq->Length();
359 aSeq->length(aLength);
360 for (Standard_Integer i = 1; i <= aLength; i++)
361 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
366 //=============================================================================
370 //=============================================================================
371 GEOM::ListOfLong* GEOM_IShapesOperations_i::SubShapeAllIDs (GEOM::GEOM_Object_ptr theShape,
372 const CORBA::Long theShapeType,
373 const CORBA::Boolean isSorted)
375 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
376 if (theShape == NULL) return aSeq._retn();
378 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
379 (theShape->GetStudyID(), theShape->GetEntry());
381 Handle(TColStd_HSequenceOfInteger) aHSeq =
382 GetOperations()->SubShapeAllIDs(aShape, theShapeType, isSorted);
383 if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
385 Standard_Integer aLength = aHSeq->Length();
386 aSeq->length(aLength);
387 for (Standard_Integer i = 1; i <= aLength; i++)
388 aSeq[i-1] = aHSeq->Value(i);
393 //=============================================================================
397 //=============================================================================
398 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetSubShape
399 (GEOM::GEOM_Object_ptr theMainShape,
400 const CORBA::Long theID)
402 GEOM::GEOM_Object_var aGEOMObject;
404 //Set a not done flag
405 GetOperations()->SetNotDone();
407 if (theMainShape == NULL) return aGEOMObject._retn();
409 //Get the reference objects
410 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
411 (theMainShape->GetStudyID(), theMainShape->GetEntry());
413 if (aShape.IsNull()) return aGEOMObject._retn();
415 Handle(GEOM_Object) anObject = GetOperations()->GetSubShape(aShape, theID);
416 if (!GetOperations()->IsDone() || anObject.IsNull())
417 return aGEOMObject._retn();
419 return GetObject(anObject);
422 //=============================================================================
426 //=============================================================================
427 CORBA::Long GEOM_IShapesOperations_i::NumberOfFaces (GEOM::GEOM_Object_ptr theShape)
429 if (theShape == NULL) return -1;
431 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
432 (theShape->GetStudyID(), theShape->GetEntry());
434 CORBA::Long aNb = GetOperations()->NumberOfFaces(aShape);
435 if (!GetOperations()->IsDone()) return -1;
440 //=============================================================================
444 //=============================================================================
445 CORBA::Long GEOM_IShapesOperations_i::NumberOfEdges (GEOM::GEOM_Object_ptr theShape)
447 if (theShape == NULL) return -1;
449 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
450 (theShape->GetStudyID(), theShape->GetEntry());
452 CORBA::Long aNb = GetOperations()->NumberOfEdges(aShape);
453 if (!GetOperations()->IsDone()) return -1;
458 //=============================================================================
462 //=============================================================================
463 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::ChangeOrientation
464 (GEOM::GEOM_Object_ptr theShape)
466 GEOM::GEOM_Object_var aGEOMObject;
468 //Set a not done flag
469 GetOperations()->SetNotDone();
471 if (theShape == NULL) return aGEOMObject._retn();
473 //Get the reference objects
474 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
475 (theShape->GetStudyID(), theShape->GetEntry());
477 if (aShape.IsNull()) return aGEOMObject._retn();
480 Handle(GEOM_Object) anObject = GetOperations()->ReverseShape(aShape);
481 if (!GetOperations()->IsDone() || anObject.IsNull())
482 return aGEOMObject._retn();
484 return GetObject(anObject);
487 //=============================================================================
491 //=============================================================================
492 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetFreeFacesIDs (GEOM::GEOM_Object_ptr theShape)
494 //Set a not done flag
495 GetOperations()->SetNotDone();
497 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
498 if (theShape == NULL) return aSeq._retn();
500 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
501 (theShape->GetStudyID(), theShape->GetEntry());
503 Handle(TColStd_HSequenceOfInteger) aHSeq =
504 GetOperations()->GetFreeFacesIDs(aShape);
505 if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
507 Standard_Integer aLength = aHSeq->Length();
508 aSeq->length(aLength);
509 for (Standard_Integer i = 1; i <= aLength; i++)
510 aSeq[i-1] = aHSeq->Value(i);
515 //=============================================================================
519 //=============================================================================
520 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSharedShapes
521 (GEOM::GEOM_Object_ptr theShape1,
522 GEOM::GEOM_Object_ptr theShape2,
523 const CORBA::Long theShapeType)
525 //Set a not done flag
526 GetOperations()->SetNotDone();
528 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
529 if (theShape1 == NULL ||
530 theShape2 == NULL) return aSeq._retn();
532 Handle(GEOM_Object) aShape1 = GetOperations()->GetEngine()->GetObject
533 (theShape1->GetStudyID(), theShape1->GetEntry());
534 Handle(GEOM_Object) aShape2 = GetOperations()->GetEngine()->GetObject
535 (theShape2->GetStudyID(), theShape2->GetEntry());
537 if (aShape1.IsNull() ||
538 aShape2.IsNull()) return aSeq._retn();
540 Handle(TColStd_HSequenceOfTransient) aHSeq =
541 GetOperations()->GetSharedShapes(aShape1, aShape2, theShapeType);
542 if (!GetOperations()->IsDone() || aHSeq.IsNull())
545 Standard_Integer aLength = aHSeq->Length();
546 aSeq->length(aLength);
547 for (Standard_Integer i = 1; i <= aLength; i++)
548 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
553 static GEOMAlgo_State ShapeState (const GEOM::shape_state theState)
555 GEOMAlgo_State aState = GEOMAlgo_ST_UNKNOWN;
559 aState = GEOMAlgo_ST_ON;
562 aState = GEOMAlgo_ST_OUT;
565 aState = GEOMAlgo_ST_ONOUT;
568 aState = GEOMAlgo_ST_IN;
571 aState = GEOMAlgo_ST_ONIN;
580 //=============================================================================
584 //=============================================================================
585 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnPlane
586 (GEOM::GEOM_Object_ptr theShape,
587 const CORBA::Long theShapeType,
588 GEOM::GEOM_Object_ptr theAx1,
589 const GEOM::shape_state theState)
591 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
593 //Set a not done flag
594 GetOperations()->SetNotDone();
596 if (theShape == NULL || theAx1 == NULL) return aSeq._retn();
598 //Get the reference objects
599 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
600 (theShape->GetStudyID(), theShape->GetEntry());
601 Handle(GEOM_Object) anAx1 = GetOperations()->GetEngine()->GetObject
602 (theAx1->GetStudyID(), theAx1->GetEntry());
604 if (aShape.IsNull() || anAx1.IsNull()) return aSeq._retn();
606 //Get Shapes On Plane
607 Handle(TColStd_HSequenceOfTransient) aHSeq =
608 GetOperations()->GetShapesOnPlane(aShape, theShapeType, anAx1, ShapeState(theState));
609 if (!GetOperations()->IsDone() || aHSeq.IsNull())
612 Standard_Integer aLength = aHSeq->Length();
613 aSeq->length(aLength);
614 for (Standard_Integer i = 1; i <= aLength; i++)
615 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
620 //=============================================================================
622 * GetShapesOnCylinder
624 //=============================================================================
625 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnCylinder
626 (GEOM::GEOM_Object_ptr theShape,
627 const CORBA::Long theShapeType,
628 GEOM::GEOM_Object_ptr theAxis,
629 const CORBA::Double theRadius,
630 const GEOM::shape_state theState)
632 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
634 //Set a not done flag
635 GetOperations()->SetNotDone();
637 if (theShape == NULL || theAxis == NULL) return aSeq._retn();
639 //Get the reference objects
640 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
641 (theShape->GetStudyID(), theShape->GetEntry());
642 Handle(GEOM_Object) anAxis = GetOperations()->GetEngine()->GetObject
643 (theAxis->GetStudyID(), theAxis->GetEntry());
645 if (aShape.IsNull() || anAxis.IsNull()) return aSeq._retn();
647 //Get Shapes On Cylinder
648 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnCylinder
649 (aShape, theShapeType, anAxis, theRadius, ShapeState(theState));
650 if (!GetOperations()->IsDone() || aHSeq.IsNull())
653 Standard_Integer aLength = aHSeq->Length();
654 aSeq->length(aLength);
655 for (Standard_Integer i = 1; i <= aLength; i++)
656 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
661 //=============================================================================
665 //=============================================================================
666 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnSphere
667 (GEOM::GEOM_Object_ptr theShape,
668 const CORBA::Long theShapeType,
669 GEOM::GEOM_Object_ptr theCenter,
670 const CORBA::Double theRadius,
671 const GEOM::shape_state theState)
673 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
675 //Set a not done flag
676 GetOperations()->SetNotDone();
678 if (theShape == NULL || theCenter == NULL) return aSeq._retn();
680 //Get the reference objects
681 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
682 (theShape->GetStudyID(), theShape->GetEntry());
683 Handle(GEOM_Object) aCenter = GetOperations()->GetEngine()->GetObject
684 (theCenter->GetStudyID(), theCenter->GetEntry());
686 if (aShape.IsNull() || aCenter.IsNull()) return aSeq._retn();
688 //Get Shapes On Sphere
689 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnSphere
690 (aShape, theShapeType, aCenter, theRadius, ShapeState(theState));
691 if (!GetOperations()->IsDone() || aHSeq.IsNull())
694 Standard_Integer aLength = aHSeq->Length();
695 aSeq->length(aLength);
696 for (Standard_Integer i = 1; i <= aLength; i++)
697 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
702 //=============================================================================
704 * GetShapesOnPlaneIDs
706 //=============================================================================
707 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnPlaneIDs
708 (GEOM::GEOM_Object_ptr theShape,
709 const CORBA::Long theShapeType,
710 GEOM::GEOM_Object_ptr theAx1,
711 const GEOM::shape_state theState)
713 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
715 //Set a not done flag
716 GetOperations()->SetNotDone();
718 if (theShape == NULL || theAx1 == NULL) return aSeq._retn();
720 //Get the reference objects
721 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
722 (theShape->GetStudyID(), theShape->GetEntry());
723 Handle(GEOM_Object) anAx1 = GetOperations()->GetEngine()->GetObject
724 (theAx1->GetStudyID(), theAx1->GetEntry());
726 if (aShape.IsNull() || anAx1.IsNull()) return aSeq._retn();
728 //Get Shapes On Plane
729 Handle(TColStd_HSequenceOfInteger) aHSeq =
730 GetOperations()->GetShapesOnPlaneIDs(aShape, theShapeType, anAx1, ShapeState(theState));
731 if (!GetOperations()->IsDone() || aHSeq.IsNull())
734 Standard_Integer aLength = aHSeq->Length();
735 aSeq->length(aLength);
736 for (Standard_Integer i = 1; i <= aLength; i++)
737 aSeq[i-1] = aHSeq->Value(i);
742 //=============================================================================
744 * GetShapesOnCylinderIDs
746 //=============================================================================
747 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnCylinderIDs
748 (GEOM::GEOM_Object_ptr theShape,
749 const CORBA::Long theShapeType,
750 GEOM::GEOM_Object_ptr theAxis,
751 const CORBA::Double theRadius,
752 const GEOM::shape_state theState)
754 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
756 //Set a not done flag
757 GetOperations()->SetNotDone();
759 if (theShape == NULL || theAxis == NULL) return aSeq._retn();
761 //Get the reference objects
762 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
763 (theShape->GetStudyID(), theShape->GetEntry());
764 Handle(GEOM_Object) anAxis = GetOperations()->GetEngine()->GetObject
765 (theAxis->GetStudyID(), theAxis->GetEntry());
767 if (aShape.IsNull() || anAxis.IsNull()) return aSeq._retn();
769 //Get Shapes On Cylinder
770 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnCylinderIDs
771 (aShape, theShapeType, anAxis, theRadius, ShapeState(theState));
772 if (!GetOperations()->IsDone() || aHSeq.IsNull())
775 Standard_Integer aLength = aHSeq->Length();
776 aSeq->length(aLength);
777 for (Standard_Integer i = 1; i <= aLength; i++)
778 aSeq[i-1] = aHSeq->Value(i);
783 //=============================================================================
785 * GetShapesOnSphereIDs
787 //=============================================================================
788 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnSphereIDs
789 (GEOM::GEOM_Object_ptr theShape,
790 const CORBA::Long theShapeType,
791 GEOM::GEOM_Object_ptr theCenter,
792 const CORBA::Double theRadius,
793 const GEOM::shape_state theState)
795 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
797 //Set a not done flag
798 GetOperations()->SetNotDone();
800 if (theShape == NULL || theCenter == NULL) return aSeq._retn();
802 //Get the reference objects
803 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
804 (theShape->GetStudyID(), theShape->GetEntry());
805 Handle(GEOM_Object) aCenter = GetOperations()->GetEngine()->GetObject
806 (theCenter->GetStudyID(), theCenter->GetEntry());
808 if (aShape.IsNull() || aCenter.IsNull()) return aSeq._retn();
810 //Get Shapes On Sphere
811 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnSphereIDs
812 (aShape, theShapeType, aCenter, theRadius, ShapeState(theState));
813 if (!GetOperations()->IsDone() || aHSeq.IsNull())
816 Standard_Integer aLength = aHSeq->Length();
817 aSeq->length(aLength);
818 for (Standard_Integer i = 1; i <= aLength; i++)
819 aSeq[i-1] = aHSeq->Value(i);
824 //=============================================================================
828 //=============================================================================
829 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlace
830 (GEOM::GEOM_Object_ptr theShapeWhere,
831 GEOM::GEOM_Object_ptr theShapeWhat)
833 GEOM::GEOM_Object_var aGEOMObject;
835 //Set a not done flag
836 GetOperations()->SetNotDone();
838 if (theShapeWhere == NULL ||
839 theShapeWhat == NULL) return aGEOMObject._retn();
841 //Get the reference objects
842 Handle(GEOM_Object) aShapeWhere = GetOperations()->GetEngine()->GetObject
843 (theShapeWhere->GetStudyID(), theShapeWhere->GetEntry());
844 Handle(GEOM_Object) aShapeWhat = GetOperations()->GetEngine()->GetObject
845 (theShapeWhat->GetStudyID(), theShapeWhat->GetEntry());
847 if (aShapeWhere.IsNull() ||
848 aShapeWhat.IsNull()) return aGEOMObject._retn();
850 //Get Shapes in place of aShapeWhat
851 Handle(GEOM_Object) anObject =
852 GetOperations()->GetInPlace(aShapeWhere, aShapeWhat);
853 if (!GetOperations()->IsDone() || anObject.IsNull())
854 return aGEOMObject._retn();
856 return GetObject(anObject);