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 * GetShapesOnQuadrangle
706 //=============================================================================
707 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnQuadrangle
708 (GEOM::GEOM_Object_ptr theShape,
709 CORBA::Long theShapeType,
710 GEOM::GEOM_Object_ptr theTopLeftPoint,
711 GEOM::GEOM_Object_ptr theTopRigthPoint,
712 GEOM::GEOM_Object_ptr theBottomLeftPoint,
713 GEOM::GEOM_Object_ptr theBottomRigthPoint,
714 GEOM::shape_state theState)
716 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
718 //Set a not done flag
719 GetOperations()->SetNotDone();
721 if (theShape == NULL ||
722 theTopLeftPoint == NULL ||
723 theTopRigthPoint == NULL ||
724 theBottomLeftPoint == NULL ||
725 theBottomRigthPoint == NULL )
728 //Get the reference objects
729 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
730 (theShape->GetStudyID(), theShape->GetEntry());
731 Handle(GEOM_Object) aTopLeftPoint = GetOperations()->GetEngine()->GetObject
732 (theShape->GetStudyID(), theTopLeftPoint->GetEntry());
733 Handle(GEOM_Object) aTopRigthPoint = GetOperations()->GetEngine()->GetObject
734 (theShape->GetStudyID(), theTopRigthPoint->GetEntry());
735 Handle(GEOM_Object) aBottomLeftPoint = GetOperations()->GetEngine()->GetObject
736 (theShape->GetStudyID(), theBottomLeftPoint->GetEntry());
737 Handle(GEOM_Object) aBottomRigthPoint = GetOperations()->GetEngine()->GetObject
738 (theShape->GetStudyID(), theBottomRigthPoint->GetEntry());
740 if (aShape.IsNull() ||
741 aTopLeftPoint.IsNull() ||
742 aTopRigthPoint.IsNull() ||
743 aBottomLeftPoint.IsNull() ||
744 aBottomRigthPoint.IsNull() )
747 //Get Shapes On Quadrangle
748 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnQuadrangle
749 (aShape, theShapeType,
750 aTopLeftPoint, aTopRigthPoint, aBottomLeftPoint, aBottomRigthPoint,
751 ShapeState(theState));
752 if (!GetOperations()->IsDone() || aHSeq.IsNull())
755 Standard_Integer aLength = aHSeq->Length();
756 aSeq->length(aLength);
757 for (Standard_Integer i = 1; i <= aLength; i++)
758 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
763 //=============================================================================
765 * GetShapesOnPlaneIDs
767 //=============================================================================
768 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnPlaneIDs
769 (GEOM::GEOM_Object_ptr theShape,
770 const CORBA::Long theShapeType,
771 GEOM::GEOM_Object_ptr theAx1,
772 const GEOM::shape_state theState)
774 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
776 //Set a not done flag
777 GetOperations()->SetNotDone();
779 if (theShape == NULL || theAx1 == NULL) return aSeq._retn();
781 //Get the reference objects
782 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
783 (theShape->GetStudyID(), theShape->GetEntry());
784 Handle(GEOM_Object) anAx1 = GetOperations()->GetEngine()->GetObject
785 (theAx1->GetStudyID(), theAx1->GetEntry());
787 if (aShape.IsNull() || anAx1.IsNull()) return aSeq._retn();
789 //Get Shapes On Plane
790 Handle(TColStd_HSequenceOfInteger) aHSeq =
791 GetOperations()->GetShapesOnPlaneIDs(aShape, theShapeType, anAx1, ShapeState(theState));
792 if (!GetOperations()->IsDone() || aHSeq.IsNull())
795 Standard_Integer aLength = aHSeq->Length();
796 aSeq->length(aLength);
797 for (Standard_Integer i = 1; i <= aLength; i++)
798 aSeq[i-1] = aHSeq->Value(i);
803 //=============================================================================
805 * GetShapesOnCylinderIDs
807 //=============================================================================
808 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnCylinderIDs
809 (GEOM::GEOM_Object_ptr theShape,
810 const CORBA::Long theShapeType,
811 GEOM::GEOM_Object_ptr theAxis,
812 const CORBA::Double theRadius,
813 const GEOM::shape_state theState)
815 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
817 //Set a not done flag
818 GetOperations()->SetNotDone();
820 if (theShape == NULL || theAxis == NULL) return aSeq._retn();
822 //Get the reference objects
823 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
824 (theShape->GetStudyID(), theShape->GetEntry());
825 Handle(GEOM_Object) anAxis = GetOperations()->GetEngine()->GetObject
826 (theAxis->GetStudyID(), theAxis->GetEntry());
828 if (aShape.IsNull() || anAxis.IsNull()) return aSeq._retn();
830 //Get Shapes On Cylinder
831 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnCylinderIDs
832 (aShape, theShapeType, anAxis, theRadius, ShapeState(theState));
833 if (!GetOperations()->IsDone() || aHSeq.IsNull())
836 Standard_Integer aLength = aHSeq->Length();
837 aSeq->length(aLength);
838 for (Standard_Integer i = 1; i <= aLength; i++)
839 aSeq[i-1] = aHSeq->Value(i);
844 //=============================================================================
846 * GetShapesOnSphereIDs
848 //=============================================================================
849 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnSphereIDs
850 (GEOM::GEOM_Object_ptr theShape,
851 const CORBA::Long theShapeType,
852 GEOM::GEOM_Object_ptr theCenter,
853 const CORBA::Double theRadius,
854 const GEOM::shape_state theState)
856 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
858 //Set a not done flag
859 GetOperations()->SetNotDone();
861 if (theShape == NULL || theCenter == NULL) return aSeq._retn();
863 //Get the reference objects
864 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
865 (theShape->GetStudyID(), theShape->GetEntry());
866 Handle(GEOM_Object) aCenter = GetOperations()->GetEngine()->GetObject
867 (theCenter->GetStudyID(), theCenter->GetEntry());
869 if (aShape.IsNull() || aCenter.IsNull()) return aSeq._retn();
871 //Get Shapes On Sphere
872 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnSphereIDs
873 (aShape, theShapeType, aCenter, theRadius, ShapeState(theState));
874 if (!GetOperations()->IsDone() || aHSeq.IsNull())
877 Standard_Integer aLength = aHSeq->Length();
878 aSeq->length(aLength);
879 for (Standard_Integer i = 1; i <= aLength; i++)
880 aSeq[i-1] = aHSeq->Value(i);
885 //=============================================================================
887 * GetShapesOnQuadrangleIDs
889 //=============================================================================
890 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnQuadrangleIDs
891 (GEOM::GEOM_Object_ptr theShape,
892 CORBA::Long theShapeType,
893 GEOM::GEOM_Object_ptr theTopLeftPoint,
894 GEOM::GEOM_Object_ptr theTopRigthPoint,
895 GEOM::GEOM_Object_ptr theBottomLeftPoint,
896 GEOM::GEOM_Object_ptr theBottomRigthPoint,
897 GEOM::shape_state theState)
899 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
901 //Set a not done flag
902 GetOperations()->SetNotDone();
904 if (theShape == NULL ||
905 theTopLeftPoint == NULL ||
906 theTopRigthPoint == NULL ||
907 theBottomLeftPoint == NULL ||
908 theBottomRigthPoint == NULL )
911 //Get the reference objects
912 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
913 (theShape->GetStudyID(), theShape->GetEntry());
914 Handle(GEOM_Object) aTopLeftPoint = GetOperations()->GetEngine()->GetObject
915 (theShape->GetStudyID(), theTopLeftPoint->GetEntry());
916 Handle(GEOM_Object) aTopRigthPoint = GetOperations()->GetEngine()->GetObject
917 (theShape->GetStudyID(), theTopRigthPoint->GetEntry());
918 Handle(GEOM_Object) aBottomLeftPoint = GetOperations()->GetEngine()->GetObject
919 (theShape->GetStudyID(), theBottomLeftPoint->GetEntry());
920 Handle(GEOM_Object) aBottomRigthPoint = GetOperations()->GetEngine()->GetObject
921 (theShape->GetStudyID(), theBottomRigthPoint->GetEntry());
923 if (aShape.IsNull() ||
924 aTopLeftPoint.IsNull() ||
925 aTopRigthPoint.IsNull() ||
926 aBottomLeftPoint.IsNull() ||
927 aBottomRigthPoint.IsNull() )
930 //Get Shapes On Quadrangle
931 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnQuadrangleIDs
932 (aShape, theShapeType,
933 aTopLeftPoint, aTopRigthPoint, aBottomLeftPoint, aBottomRigthPoint,
934 ShapeState(theState));
935 if (!GetOperations()->IsDone() || aHSeq.IsNull())
938 Standard_Integer aLength = aHSeq->Length();
939 aSeq->length(aLength);
940 for (Standard_Integer i = 1; i <= aLength; i++)
941 aSeq[i-1] = aHSeq->Value(i);
946 //=============================================================================
950 //=============================================================================
951 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlace
952 (GEOM::GEOM_Object_ptr theShapeWhere,
953 GEOM::GEOM_Object_ptr theShapeWhat)
955 GEOM::GEOM_Object_var aGEOMObject;
957 //Set a not done flag
958 GetOperations()->SetNotDone();
960 if (theShapeWhere == NULL ||
961 theShapeWhat == NULL) return aGEOMObject._retn();
963 //Get the reference objects
964 Handle(GEOM_Object) aShapeWhere = GetOperations()->GetEngine()->GetObject
965 (theShapeWhere->GetStudyID(), theShapeWhere->GetEntry());
966 Handle(GEOM_Object) aShapeWhat = GetOperations()->GetEngine()->GetObject
967 (theShapeWhat->GetStudyID(), theShapeWhat->GetEntry());
969 if (aShapeWhere.IsNull() ||
970 aShapeWhat.IsNull()) return aGEOMObject._retn();
972 //Get Shapes in place of aShapeWhat
973 Handle(GEOM_Object) anObject =
974 GetOperations()->GetInPlace(aShapeWhere, aShapeWhat);
975 if (!GetOperations()->IsDone() || anObject.IsNull())
976 return aGEOMObject._retn();
978 return GetObject(anObject);