1 // Copyright (C) 2007-2016 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>
39 * This function converts GEOM::comparison_condition type into
40 * GEOMUtils::ComparisonCondition type.
42 * \param theCondition the condition of GEOM::comparison_condition type
43 * \return the condition of GEOMUtils::ComparisonCondition type.
45 static GEOMUtils::ComparisonCondition ComparisonCondition
46 (const GEOM::comparison_condition theCondition)
48 GEOMUtils::ComparisonCondition aResult = GEOMUtils::CC_GT;
50 switch (theCondition) {
52 aResult = GEOMUtils::CC_GE;
55 aResult = GEOMUtils::CC_LT;
58 aResult = GEOMUtils::CC_LE;
67 //=============================================================================
71 //=============================================================================
72 GEOM_IShapesOperations_i::GEOM_IShapesOperations_i (PortableServer::POA_ptr thePOA,
73 GEOM::GEOM_Gen_ptr theEngine,
74 ::GEOMImpl_IShapesOperations* theImpl)
75 :GEOM_IOperations_i(thePOA, theEngine, theImpl)
77 MESSAGE("GEOM_IShapesOperations_i::GEOM_IShapesOperations_i");
80 //=============================================================================
84 //=============================================================================
85 GEOM_IShapesOperations_i::~GEOM_IShapesOperations_i()
87 MESSAGE("GEOM_IShapesOperations_i::~GEOM_IShapesOperations_i");
91 //=============================================================================
95 //=============================================================================
96 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeEdge
97 (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2)
99 GEOM::GEOM_Object_var aGEOMObject;
101 //Set a not done flag
102 GetOperations()->SetNotDone();
104 //Get the reference points
105 Handle(::GEOM_Object) aPnt1 = GetObjectImpl(thePnt1);
106 Handle(::GEOM_Object) aPnt2 = GetObjectImpl(thePnt2);
108 if (aPnt1.IsNull() || aPnt2.IsNull()) return aGEOMObject._retn();
111 Handle(::GEOM_Object) anObject = GetOperations()->MakeEdge(aPnt1, aPnt2);
112 if (!GetOperations()->IsDone() || anObject.IsNull())
113 return aGEOMObject._retn();
115 return GetObject(anObject);
118 //=============================================================================
120 * MakeEdgeOnCurveByLength
122 //=============================================================================
123 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeEdgeOnCurveByLength
124 (GEOM::GEOM_Object_ptr theCurve,
125 CORBA::Double theLength,
126 GEOM::GEOM_Object_ptr theStartPoint)
128 GEOM::GEOM_Object_var aGEOMObject;
130 //Set a not done flag
131 GetOperations()->SetNotDone();
133 //Get the reference curve
134 Handle(::GEOM_Object) aRefCurve = GetObjectImpl(theCurve);
135 if (aRefCurve.IsNull()) return aGEOMObject._retn();
137 //Get the reference point (can be NULL)
138 Handle(::GEOM_Object) aRefPoint;
139 if (!CORBA::is_nil(theStartPoint)) {
140 aRefPoint = GetObjectImpl(theStartPoint);
144 Handle(::GEOM_Object) anObject =
145 GetOperations()->MakeEdgeOnCurveByLength(aRefCurve, theLength, aRefPoint);
146 if (!GetOperations()->IsDone() || anObject.IsNull())
147 return aGEOMObject._retn();
149 return GetObject(anObject);
152 //=============================================================================
156 //=============================================================================
157 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeEdgeWire
158 (GEOM::GEOM_Object_ptr theWire,
159 const CORBA::Double theLinearTolerance,
160 const CORBA::Double theAngularTolerance)
162 GEOM::GEOM_Object_var aGEOMObject;
164 //Set a not done flag
165 GetOperations()->SetNotDone();
167 //Get the source wire
168 Handle(::GEOM_Object) aWire = GetObjectImpl(theWire);
170 if (aWire.IsNull()) return aGEOMObject._retn();
173 Handle(::GEOM_Object) anObject = GetOperations()->MakeEdgeWire(aWire, theLinearTolerance, theAngularTolerance);
174 if (!GetOperations()->IsDone() || anObject.IsNull())
175 return aGEOMObject._retn();
177 return GetObject(anObject);
180 //=============================================================================
184 //=============================================================================
185 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeWire
186 (const GEOM::ListOfGO& theEdgesAndWires,
187 const CORBA::Double theTolerance)
189 GEOM::GEOM_Object_var aGEOMObject;
191 //Set a not done flag
192 GetOperations()->SetNotDone();
195 std::list<Handle(::GEOM_Object)> aShapes;
198 aLen = theEdgesAndWires.length();
199 for (ind = 0; ind < aLen; ind++) {
200 Handle(::GEOM_Object) aSh = GetObjectImpl(theEdgesAndWires[ind]);
201 if (aSh.IsNull()) return aGEOMObject._retn();
202 aShapes.push_back(aSh);
206 Handle(::GEOM_Object) anObject =
207 GetOperations()->MakeWire(aShapes, theTolerance);
208 if (!GetOperations()->IsDone() || anObject.IsNull())
209 return aGEOMObject._retn();
211 return GetObject(anObject);
214 //=============================================================================
218 //=============================================================================
219 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeFace
220 (GEOM::GEOM_Object_ptr theWire,
221 const CORBA::Boolean isPlanarWanted)
223 GEOM::GEOM_Object_var aGEOMObject;
225 //Set a not done flag
226 GetOperations()->SetNotDone();
228 //Get the reference wire
229 Handle(::GEOM_Object) aWire = GetObjectImpl(theWire);
230 if (aWire.IsNull()) return aGEOMObject._retn();
233 Handle(::GEOM_Object) anObject = GetOperations()->MakeFace(aWire, isPlanarWanted);
234 //if (!GetOperations()->IsDone() || anObject.IsNull())
235 // enable warning status
236 if (anObject.IsNull())
237 return aGEOMObject._retn();
239 return GetObject(anObject);
242 //=============================================================================
246 //=============================================================================
247 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeFaceWires
248 (const GEOM::ListOfGO& theWires,
249 const CORBA::Boolean isPlanarWanted)
251 GEOM::GEOM_Object_var aGEOMObject;
253 //Set a not done flag
254 GetOperations()->SetNotDone();
257 std::list<Handle(::GEOM_Object)> aShapes;
260 aLen = theWires.length();
261 for (ind = 0; ind < aLen; ind++) {
262 Handle(::GEOM_Object) aSh = GetObjectImpl(theWires[ind]);
263 if (aSh.IsNull()) return aGEOMObject._retn();
264 aShapes.push_back(aSh);
268 Handle(::GEOM_Object) anObject =
269 GetOperations()->MakeFaceWires(aShapes, isPlanarWanted);
270 //if (!GetOperations()->IsDone() || anObject.IsNull())
271 // enable warning status
272 if (anObject.IsNull())
273 return aGEOMObject._retn();
275 return GetObject(anObject);
278 //=============================================================================
280 * MakeFaceFromSurface
282 //=============================================================================
283 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeFaceFromSurface
284 (GEOM::GEOM_Object_ptr theFace,
285 GEOM::GEOM_Object_ptr theWire)
287 GEOM::GEOM_Object_var aGEOMObject;
289 //Set a not done flag
290 GetOperations()->SetNotDone();
292 //Get the reference face and wire
293 Handle(::GEOM_Object) aFace = GetObjectImpl(theFace);
294 Handle(::GEOM_Object) aWire = GetObjectImpl(theWire);
296 if (aFace.IsNull() || aWire.IsNull()) {
297 return aGEOMObject._retn();
301 Handle(::GEOM_Object) anObject =
302 GetOperations()->MakeFaceFromSurface(aFace, aWire);
304 if (anObject.IsNull()) {
305 return aGEOMObject._retn();
308 return GetObject(anObject);
311 //=============================================================================
313 * MakeFaceWithConstraints
315 //=============================================================================
316 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeFaceWithConstraints
317 (const GEOM::ListOfGO& theConstraints)
319 GEOM::GEOM_Object_var aGEOMObject;
321 //Set a not done flag
322 GetOperations()->SetNotDone();
325 std::list<Handle(::GEOM_Object)> aConstraints;
326 for( CORBA::ULong ind = 0; ind < theConstraints.length(); ind++ ) {
327 Handle(::GEOM_Object) anObject = GetObjectImpl( theConstraints[ind] );
328 aConstraints.push_back(anObject);
332 Handle(::GEOM_Object) anObject =
333 GetOperations()->MakeFaceWithConstraints( aConstraints );
335 // enable warning status
336 if (anObject.IsNull())
337 return aGEOMObject._retn();
339 return GetObject(anObject);
342 //=============================================================================
346 //=============================================================================
347 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeShell
348 (const GEOM::ListOfGO& theFacesAndShells)
350 GEOM::GEOM_Object_var aGEOMObject;
352 //Set a not done flag
353 GetOperations()->SetNotDone();
356 std::list<Handle(::GEOM_Object)> aShapes;
359 aLen = theFacesAndShells.length();
360 for (ind = 0; ind < aLen; ind++) {
361 Handle(::GEOM_Object) aSh = GetObjectImpl(theFacesAndShells[ind]);
362 if (aSh.IsNull()) return aGEOMObject._retn();
363 aShapes.push_back(aSh);
367 Handle(::GEOM_Object) anObject =
368 GetOperations()->MakeShell(aShapes);
369 if (!GetOperations()->IsDone() || anObject.IsNull())
370 return aGEOMObject._retn();
372 return GetObject(anObject);
375 //=============================================================================
379 //=============================================================================
380 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeSolidShell
381 (GEOM::GEOM_Object_ptr theShell)
383 GEOM::GEOM_Object_var aGEOMObject;
385 //Set a not done flag
386 GetOperations()->SetNotDone();
388 //Get the reference objects
389 Handle(::GEOM_Object) aShell = GetObjectImpl(theShell);
390 if (aShell.IsNull()) return aGEOMObject._retn();
392 std::list<Handle(::GEOM_Object)> aShapes;
393 aShapes.push_back(aShell);
396 Handle(::GEOM_Object) anObject = GetOperations()->MakeSolidShells(aShapes);
397 if (!GetOperations()->IsDone() || anObject.IsNull())
398 return aGEOMObject._retn();
400 return GetObject(anObject);
403 //=============================================================================
407 //=============================================================================
408 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeSolidShells
409 (const GEOM::ListOfGO& theShells)
411 GEOM::GEOM_Object_var aGEOMObject;
413 //Set a not done flag
414 GetOperations()->SetNotDone();
417 std::list<Handle(::GEOM_Object)> aShapes;
420 aLen = theShells.length();
421 for (ind = 0; ind < aLen; ind++) {
422 Handle(::GEOM_Object) aSh = GetObjectImpl(theShells[ind]);
423 if (aSh.IsNull()) return aGEOMObject._retn();
424 aShapes.push_back(aSh);
428 Handle(::GEOM_Object) anObject =
429 GetOperations()->MakeSolidShells(aShapes);
430 if (!GetOperations()->IsDone() || anObject.IsNull())
431 return aGEOMObject._retn();
433 return GetObject(anObject);
436 //=============================================================================
440 //=============================================================================
441 GEOM::GEOM_Object_ptr
442 GEOM_IShapesOperations_i::MakeCompound (const GEOM::ListOfGO& theShapes)
444 GEOM::GEOM_Object_var aGEOMObject;
446 //Set a not done flag
447 GetOperations()->SetNotDone();
450 std::list<Handle(::GEOM_Object)> aShapes;
453 aLen = theShapes.length();
454 for (ind = 0; ind < aLen; ind++) {
455 Handle(::GEOM_Object) aSh = GetObjectImpl(theShapes[ind]);
456 if (aSh.IsNull()) return aGEOMObject._retn();
457 aShapes.push_back(aSh);
461 Handle(::GEOM_Object) anObject =
462 GetOperations()->MakeCompound(aShapes);
463 if (!GetOperations()->IsDone() || anObject.IsNull())
464 return aGEOMObject._retn();
466 return GetObject(anObject);
469 //=============================================================================
471 * MakeSolidFromConnectedFaces
473 //=============================================================================
474 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeSolidFromConnectedFaces
475 (const GEOM::ListOfGO& theFacesOrShells,
476 const CORBA::Boolean isIntersect)
478 GEOM::GEOM_Object_var aGEOMObject;
480 //Set a not done flag
481 GetOperations()->SetNotDone();
484 std::list<Handle(::GEOM_Object)> aShapes;
487 aLen = theFacesOrShells.length();
488 for (ind = 0; ind < aLen; ind++) {
489 ::Handle(::GEOM_Object) aSh = GetObjectImpl(theFacesOrShells[ind]);
490 if (aSh.IsNull()) return aGEOMObject._retn();
491 aShapes.push_back(aSh);
495 Handle(::GEOM_Object) anObject =
496 GetOperations()->MakeSolidFromConnectedFaces(aShapes, isIntersect);
497 if (!GetOperations()->IsDone() || anObject.IsNull())
498 return aGEOMObject._retn();
500 return GetObject(anObject);
503 //=============================================================================
507 //=============================================================================
508 GEOM::GEOM_Object_ptr
509 GEOM_IShapesOperations_i::MakeGlueFaces (const GEOM::ListOfGO& theShapes,
510 CORBA::Double theTolerance,
511 CORBA::Boolean doKeepNonSolids)
513 GEOM::GEOM_Object_var aGEOMObject;
515 //Set a not done flag
516 GetOperations()->SetNotDone();
518 //Get the reference objects
519 std::list< Handle(::GEOM_Object) > aShapes;
520 if (! GetListOfObjectsImpl( theShapes, aShapes ))
521 return aGEOMObject._retn();
524 Handle(::GEOM_Object) anObject =
525 GetOperations()->MakeGlueFaces(aShapes, theTolerance, doKeepNonSolids);
526 //if (!GetOperations()->IsDone() || anObject.IsNull())
528 if (anObject.IsNull())
529 return aGEOMObject._retn();
531 return GetObject(anObject);
534 //=============================================================================
538 //=============================================================================
540 GEOM_IShapesOperations_i::GetGlueFaces (const GEOM::ListOfGO& theShapes,
541 const CORBA::Double theTolerance)
543 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
545 //Set a not done flag
546 GetOperations()->SetNotDone();
548 //Get the reference objects
549 std::list< Handle(::GEOM_Object) > aShapes;
550 if (! GetListOfObjectsImpl( theShapes, aShapes ))
553 Handle(TColStd_HSequenceOfTransient) aHSeq =
554 GetOperations()->GetGlueShapes(aShapes, theTolerance, TopAbs_FACE);
556 //if (!GetOperations()->IsDone() || aHSeq.IsNull())
561 Standard_Integer aLength = aHSeq->Length();
562 aSeq->length(aLength);
563 for (Standard_Integer i = 1; i <= aLength; i++)
564 aSeq[i-1] = GetObject(Handle(::GEOM_Object)::DownCast(aHSeq->Value(i)));
569 //=============================================================================
571 * MakeGlueFacesByList
573 //=============================================================================
574 GEOM::GEOM_Object_ptr
575 GEOM_IShapesOperations_i::MakeGlueFacesByList (const GEOM::ListOfGO& theShapes,
576 CORBA::Double theTolerance,
577 const GEOM::ListOfGO& theFaces,
578 CORBA::Boolean doKeepNonSolids,
579 CORBA::Boolean doGlueAllEdges)
581 GEOM::GEOM_Object_var aGEOMObject;
583 //Set a not done flag
584 GetOperations()->SetNotDone();
586 //Get the reference objects
587 std::list< Handle(::GEOM_Object) > aShapes;
588 if (! GetListOfObjectsImpl( theShapes, aShapes ))
589 return aGEOMObject._retn();
592 std::list<Handle(::GEOM_Object)> aFaces;
593 if (! GetListOfObjectsImpl( theFaces, aFaces ))
594 return aGEOMObject._retn();
597 Handle(::GEOM_Object) anObject =
598 GetOperations()->MakeGlueFacesByList(aShapes, theTolerance, aFaces,
599 doKeepNonSolids, doGlueAllEdges);
600 //if (!GetOperations()->IsDone() || anObject.IsNull())
602 if (anObject.IsNull())
603 return aGEOMObject._retn();
605 return GetObject(anObject);
608 //=============================================================================
612 //=============================================================================
613 GEOM::GEOM_Object_ptr
614 GEOM_IShapesOperations_i::MakeGlueEdges (const GEOM::ListOfGO& theShapes,
615 CORBA::Double theTolerance)
617 GEOM::GEOM_Object_var aGEOMObject;
619 //Set a not done flag
620 GetOperations()->SetNotDone();
622 //Get the reference objects
623 std::list< Handle(::GEOM_Object) > aShapes;
624 if (! GetListOfObjectsImpl( theShapes, aShapes ))
625 return aGEOMObject._retn();
628 Handle(::GEOM_Object) anObject =
629 GetOperations()->MakeGlueEdges(aShapes, theTolerance);
630 //if (!GetOperations()->IsDone() || anObject.IsNull())
632 if (anObject.IsNull())
633 return aGEOMObject._retn();
635 return GetObject(anObject);
638 //=============================================================================
642 //=============================================================================
644 GEOM_IShapesOperations_i::GetGlueEdges (const GEOM::ListOfGO& theShapes,
645 const CORBA::Double theTolerance)
647 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
649 //Set a not done flag
650 GetOperations()->SetNotDone();
652 //Get the reference objects
653 std::list< Handle(::GEOM_Object) > aShapes;
654 if (! GetListOfObjectsImpl( theShapes, aShapes ))
657 Handle(TColStd_HSequenceOfTransient) aHSeq =
658 GetOperations()->GetGlueShapes(aShapes, theTolerance, TopAbs_EDGE);
660 //if (!GetOperations()->IsDone() || aHSeq.IsNull())
665 Standard_Integer aLength = aHSeq->Length();
666 aSeq->length(aLength);
667 for (Standard_Integer i = 1; i <= aLength; i++)
668 aSeq[i-1] = GetObject(Handle(::GEOM_Object)::DownCast(aHSeq->Value(i)));
673 //=============================================================================
675 * MakeGlueEdgesByList
677 //=============================================================================
678 GEOM::GEOM_Object_ptr
679 GEOM_IShapesOperations_i::MakeGlueEdgesByList (const GEOM::ListOfGO& theShapes,
680 CORBA::Double theTolerance,
681 const GEOM::ListOfGO& theEdges)
683 GEOM::GEOM_Object_var aGEOMObject;
685 //Set a not done flag
686 GetOperations()->SetNotDone();
688 //Get the reference objects
689 std::list< Handle(::GEOM_Object) > aShapes;
690 if (! GetListOfObjectsImpl( theShapes, aShapes ))
691 return aGEOMObject._retn();
694 std::list<Handle(::GEOM_Object)> anEdges;
695 if (! GetListOfObjectsImpl( theEdges, anEdges ))
696 return aGEOMObject._retn();
699 Handle(::GEOM_Object) anObject =
700 GetOperations()->MakeGlueEdgesByList(aShapes, theTolerance, anEdges);
701 //if (!GetOperations()->IsDone() || anObject.IsNull())
703 if (anObject.IsNull())
704 return aGEOMObject._retn();
706 return GetObject(anObject);
709 //=============================================================================
711 * GetExistingSubObjects
713 //=============================================================================
715 GEOM_IShapesOperations_i::GetExistingSubObjects (GEOM::GEOM_Object_ptr theShape,
716 CORBA::Boolean theGroupsOnly)
718 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
720 Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
721 if (aShape.IsNull()) return aSeq._retn();
723 Handle(TColStd_HSequenceOfTransient) aHSeq =
724 GetOperations()->GetExistingSubObjects(aShape, (Standard_Boolean)theGroupsOnly);
725 if (!GetOperations()->IsDone() || aHSeq.IsNull())
728 Standard_Integer aLength = aHSeq->Length();
729 aSeq->length(aLength);
730 for (Standard_Integer i = 1; i <= aLength; i++)
731 aSeq[i-1] = GetObject(Handle(::GEOM_Object)::DownCast(aHSeq->Value(i)));
736 //=============================================================================
738 * MakeExplode (including theShape itself, bad sorting)
740 //=============================================================================
741 GEOM::ListOfGO* GEOM_IShapesOperations_i::MakeExplode (GEOM::GEOM_Object_ptr theShape,
742 const CORBA::Long theShapeType,
743 const CORBA::Boolean isSorted)
745 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
747 Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
748 if (aShape.IsNull()) return aSeq._retn();
750 Handle(TColStd_HSequenceOfTransient) aHSeq =
751 GetOperations()->MakeExplode(aShape, theShapeType, isSorted,
752 GEOMImpl_IShapesOperations::EXPLODE_OLD_INCLUDE_MAIN);
753 if (!GetOperations()->IsDone() || aHSeq.IsNull())
756 Standard_Integer aLength = aHSeq->Length();
757 aSeq->length(aLength);
758 for (Standard_Integer i = 1; i <= aLength; i++)
759 aSeq[i-1] = GetObject(Handle(::GEOM_Object)::DownCast(aHSeq->Value(i)));
764 //=============================================================================
766 * MakeAllSubShapes (including theShape itself, good sorting)
768 //=============================================================================
769 GEOM::ListOfGO* GEOM_IShapesOperations_i::MakeAllSubShapes (GEOM::GEOM_Object_ptr theShape,
770 const CORBA::Long theShapeType,
771 const CORBA::Boolean isSorted)
773 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
775 Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
776 if (aShape.IsNull()) return aSeq._retn();
778 Handle(TColStd_HSequenceOfTransient) aHSeq =
779 GetOperations()->MakeExplode(aShape, theShapeType, isSorted,
780 GEOMImpl_IShapesOperations::EXPLODE_NEW_INCLUDE_MAIN);
781 if (!GetOperations()->IsDone() || aHSeq.IsNull())
784 Standard_Integer aLength = aHSeq->Length();
785 aSeq->length(aLength);
786 for (Standard_Integer i = 1; i <= aLength; i++)
787 aSeq[i-1] = GetObject(Handle(::GEOM_Object)::DownCast(aHSeq->Value(i)));
792 //=============================================================================
794 * ExtractSubShapes (excluding theShape itself, good sorting)
796 //=============================================================================
797 GEOM::ListOfGO* GEOM_IShapesOperations_i::ExtractSubShapes (GEOM::GEOM_Object_ptr theShape,
798 const CORBA::Long theShapeType,
799 const CORBA::Boolean isSorted)
801 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
803 Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
804 if (aShape.IsNull()) return aSeq._retn();
806 Handle(TColStd_HSequenceOfTransient) aHSeq =
807 // TODO: enum instead of bool for the last argument
808 GetOperations()->MakeExplode(aShape, theShapeType, isSorted,
809 GEOMImpl_IShapesOperations::EXPLODE_NEW_EXCLUDE_MAIN);
810 if (!GetOperations()->IsDone() || aHSeq.IsNull())
813 Standard_Integer aLength = aHSeq->Length();
814 aSeq->length(aLength);
815 for (Standard_Integer i = 1; i <= aLength; i++)
816 aSeq[i-1] = GetObject(Handle(::GEOM_Object)::DownCast(aHSeq->Value(i)));
821 //=============================================================================
825 //=============================================================================
826 GEOM::ListOfLong* GEOM_IShapesOperations_i::SubShapeAllIDs (GEOM::GEOM_Object_ptr theShape,
827 const CORBA::Long theShapeType,
828 const CORBA::Boolean isSorted)
830 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
832 Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
833 if (aShape.IsNull()) return aSeq._retn();
835 Handle(TColStd_HSequenceOfInteger) aHSeq =
836 GetOperations()->SubShapeAllIDs(aShape, theShapeType, isSorted,
837 GEOMImpl_IShapesOperations::EXPLODE_OLD_INCLUDE_MAIN);
838 if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
840 Standard_Integer aLength = aHSeq->Length();
841 aSeq->length(aLength);
842 for (Standard_Integer i = 1; i <= aLength; i++)
843 aSeq[i-1] = aHSeq->Value(i);
848 //=============================================================================
852 //=============================================================================
853 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetAllSubShapesIDs (GEOM::GEOM_Object_ptr theShape,
854 const CORBA::Long theShapeType,
855 const CORBA::Boolean isSorted)
857 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
859 Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
860 if (aShape.IsNull()) return aSeq._retn();
862 Handle(TColStd_HSequenceOfInteger) aHSeq =
863 GetOperations()->SubShapeAllIDs(aShape, theShapeType, isSorted,
864 GEOMImpl_IShapesOperations::EXPLODE_NEW_INCLUDE_MAIN);
865 if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
867 Standard_Integer aLength = aHSeq->Length();
868 aSeq->length(aLength);
869 for (Standard_Integer i = 1; i <= aLength; i++)
870 aSeq[i-1] = aHSeq->Value(i);
875 //=============================================================================
879 //=============================================================================
880 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetSubShape
881 (GEOM::GEOM_Object_ptr theMainShape,
882 const CORBA::Long theID)
884 GEOM::GEOM_Object_var aGEOMObject;
886 //Set a not done flag
887 GetOperations()->SetNotDone();
889 //Get the reference objects
890 Handle(::GEOM_Object) aShape = GetObjectImpl(theMainShape);
891 if (aShape.IsNull()) return aGEOMObject._retn();
893 Handle(::GEOM_Object) anObject = GetOperations()->GetSubShape(aShape, theID);
894 if (!GetOperations()->IsDone() || anObject.IsNull())
895 return aGEOMObject._retn();
897 return GetObject(anObject);
900 //=============================================================================
904 //=============================================================================
905 GEOM::ListOfGO* GEOM_IShapesOperations_i::MakeSubShapes (GEOM::GEOM_Object_ptr theMainShape,
906 const GEOM::ListOfLong& theIndices)
908 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
910 //Set a not done flag
911 GetOperations()->SetNotDone();
913 if (theIndices.length() < 1)
916 Handle(::GEOM_Object) aShape = GetObjectImpl(theMainShape);
917 if (aShape.IsNull()) return aSeq._retn();
919 Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger (1, theIndices.length());
920 for (CORBA::ULong i = 0; i < theIndices.length(); i++)
921 anArray->SetValue(i+1, theIndices[i]);
923 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakeSubShapes(aShape, anArray);
924 if (!GetOperations()->IsDone() || aHSeq.IsNull())
927 Standard_Integer aLength = aHSeq->Length();
928 aSeq->length(aLength);
929 for (int i = 0; i < aLength; i++)
930 aSeq[i] = GetObject(Handle(::GEOM_Object)::DownCast(aHSeq->Value(i+1)));
935 //=============================================================================
939 //=============================================================================
940 CORBA::Long GEOM_IShapesOperations_i::GetSubShapeIndex
941 (GEOM::GEOM_Object_ptr theMainShape, GEOM::GEOM_Object_ptr theSubShape)
943 //Get the reference shapes
944 Handle(::GEOM_Object) aMainShapeRef = GetObjectImpl(theMainShape);
945 Handle(::GEOM_Object) aSubShapeRef = GetObjectImpl(theSubShape);
947 if (aMainShapeRef.IsNull() || aSubShapeRef.IsNull()) return -1;
949 //Get the unique ID of <theSubShape> inside <theMainShape>
950 CORBA::Long anID = GetOperations()->GetSubShapeIndex(aMainShapeRef, aSubShapeRef);
951 if (!GetOperations()->IsDone())
957 //=============================================================================
959 * GetSubShapesIndices
961 //=============================================================================
962 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetSubShapesIndices
963 (GEOM::GEOM_Object_ptr theMainShape, const GEOM::ListOfGO& theSubShapes)
965 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
967 //Get the reference main shape
968 Handle(::GEOM_Object) aMainShapeRef = GetObjectImpl(theMainShape);
969 if (aMainShapeRef.IsNull()) return aSeq._retn();
972 std::list<Handle(::GEOM_Object)> aShapes;
973 int aLen = theSubShapes.length();
974 for (int ind = 0; ind < aLen; ind++) {
975 Handle(::GEOM_Object) aSh = GetObjectImpl(theSubShapes[ind]);
978 MESSAGE("NULL shape")
981 aShapes.push_back(aSh);
984 //Get the IDs of <theSubShapes> inside <theMainShape>
985 Handle(TColStd_HSequenceOfInteger) aHSeq =
986 GetOperations()->GetSubShapesIndices(aMainShapeRef, aShapes);
988 if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
990 Standard_Integer aLength = aHSeq->Length();
991 aSeq->length(aLength);
993 for (Standard_Integer i = 1; i <= aLength; i++)
994 aSeq[i-1] = aHSeq->Value(i);
1000 //=============================================================================
1004 //=============================================================================
1005 CORBA::Long GEOM_IShapesOperations_i::GetTopologyIndex
1006 (GEOM::GEOM_Object_ptr theMainShape, GEOM::GEOM_Object_ptr theSubShape)
1008 //Get the reference shapes
1009 Handle(::GEOM_Object) aMainShapeRef = GetObjectImpl(theMainShape);
1010 Handle(::GEOM_Object) aSubShapeRef = GetObjectImpl(theSubShape);
1012 if (aMainShapeRef.IsNull() || aSubShapeRef.IsNull()) return -1;
1014 //Get an ID of <theSubShape>, unique among all sub-shapes of <theMainShape> of the same type
1015 CORBA::Long anID = GetOperations()->GetTopologyIndex(aMainShapeRef, aSubShapeRef);
1016 if (!GetOperations()->IsDone())
1022 //=============================================================================
1024 * GetShapeTypeString
1026 //=============================================================================
1027 char* GEOM_IShapesOperations_i::GetShapeTypeString (GEOM::GEOM_Object_ptr theShape)
1029 //Get the reference shape
1030 Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
1031 if (aShape.IsNull()) return NULL;
1033 // Get shape parameters
1034 TCollection_AsciiString aDescription = GetOperations()->GetShapeTypeString(aShape);
1035 return CORBA::string_dup(aDescription.ToCString());
1038 //=============================================================================
1040 * IsSubShapeBelongsTo
1042 //=============================================================================
1043 CORBA::Boolean GEOM_IShapesOperations_i::IsSubShapeBelongsTo( GEOM::GEOM_Object_ptr theSubObject,
1044 const CORBA::Long theSubObjectIndex,
1045 GEOM::GEOM_Object_ptr theObject,
1046 const CORBA::Long theObjectIndex)
1048 Handle(::GEOM_Object) aSubObject = GetObjectImpl( theSubObject );
1049 Handle(::GEOM_Object) anObject = GetObjectImpl( theObject );
1050 if( anObject.IsNull() || aSubObject.IsNull() )
1054 return GetOperations()->IsSubShapeBelongsTo( aSubObject, theSubObjectIndex, anObject, theObjectIndex );
1057 //=============================================================================
1061 //=============================================================================
1062 CORBA::Long GEOM_IShapesOperations_i::NumberOfFaces (GEOM::GEOM_Object_ptr theShape)
1064 return NumberOfSubShapes(theShape, Standard_Integer(TopAbs_FACE));
1067 //=============================================================================
1071 //=============================================================================
1072 CORBA::Long GEOM_IShapesOperations_i::NumberOfEdges (GEOM::GEOM_Object_ptr theShape)
1074 return NumberOfSubShapes(theShape, Standard_Integer(TopAbs_EDGE));
1077 //=============================================================================
1081 //=============================================================================
1082 CORBA::Long GEOM_IShapesOperations_i::NumberOfSubShapes (GEOM::GEOM_Object_ptr theShape,
1083 const CORBA::Long theShapeType)
1085 Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
1086 if (aShape.IsNull()) return -1;
1088 CORBA::Long aNb = GetOperations()->NumberOfSubShapes(aShape, theShapeType);
1089 if (!GetOperations()->IsDone()) return -1;
1094 //=============================================================================
1098 //=============================================================================
1099 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::ChangeOrientation
1100 (GEOM::GEOM_Object_ptr theShape)
1102 GEOM::GEOM_Object_var aGEOMObject;
1104 //Set a not done flag
1105 GetOperations()->SetNotDone();
1107 //Get the reference objects
1108 Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
1109 if (aShape.IsNull()) return aGEOMObject._retn();
1112 Handle(::GEOM_Object) anObject = GetOperations()->ReverseShape(aShape);
1113 if (!GetOperations()->IsDone() || anObject.IsNull())
1114 return aGEOMObject._retn();
1116 return GetObject(anObject);
1119 //=============================================================================
1123 //=============================================================================
1124 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetFreeFacesIDs (GEOM::GEOM_Object_ptr theShape)
1126 //Set a not done flag
1127 GetOperations()->SetNotDone();
1129 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1131 Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
1132 if (aShape.IsNull()) return aSeq._retn();
1134 Handle(TColStd_HSequenceOfInteger) aHSeq =
1135 GetOperations()->GetFreeFacesIDs(aShape);
1136 if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
1138 Standard_Integer aLength = aHSeq->Length();
1139 aSeq->length(aLength);
1140 for (Standard_Integer i = 1; i <= aLength; i++)
1141 aSeq[i-1] = aHSeq->Value(i);
1143 return aSeq._retn();
1146 //=============================================================================
1150 //=============================================================================
1151 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSharedShapes
1152 (GEOM::GEOM_Object_ptr theShape1,
1153 GEOM::GEOM_Object_ptr theShape2,
1154 const CORBA::Long theShapeType)
1156 //Set a not done flag
1157 GetOperations()->SetNotDone();
1159 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1161 Handle(::GEOM_Object) aShape1 = GetObjectImpl(theShape1);
1162 Handle(::GEOM_Object) aShape2 = GetObjectImpl(theShape2);
1164 if (aShape1.IsNull() || aShape2.IsNull()) return aSeq._retn();
1166 Handle(TColStd_HSequenceOfTransient) aHSeq =
1167 GetOperations()->GetSharedShapes(aShape1, aShape2, theShapeType);
1168 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1169 return aSeq._retn();
1171 Standard_Integer aLength = aHSeq->Length();
1172 aSeq->length(aLength);
1173 for (Standard_Integer i = 1; i <= aLength; i++)
1174 aSeq[i-1] = GetObject(Handle(::GEOM_Object)::DownCast(aHSeq->Value(i)));
1176 return aSeq._retn();
1179 //=============================================================================
1181 * GetSharedShapesMulti
1183 //=============================================================================
1184 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSharedShapesMulti
1185 (const GEOM::ListOfGO& theShapes,
1186 const CORBA::Long theShapeType,
1187 CORBA::Boolean theMultiShare)
1189 //Set a not done flag
1190 GetOperations()->SetNotDone();
1192 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1195 std::list<Handle(::GEOM_Object)> aShapes;
1196 if (! GetListOfObjectsImpl( theShapes, aShapes ))
1197 return aSeq._retn();
1199 Handle(TColStd_HSequenceOfTransient) aHSeq =
1200 GetOperations()->GetSharedShapes(aShapes, theShapeType, theMultiShare);
1201 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1202 return aSeq._retn();
1204 Standard_Integer aLength = aHSeq->Length();
1205 aSeq->length(aLength);
1206 for (Standard_Integer i = 1; i <= aLength; i++)
1207 aSeq[i-1] = GetObject(Handle(::GEOM_Object)::DownCast(aHSeq->Value(i)));
1209 return aSeq._retn();
1212 static GEOMAlgo_State ShapeState (const GEOM::shape_state theState)
1214 GEOMAlgo_State aState = GEOMAlgo_ST_UNKNOWN;
1218 aState = GEOMAlgo_ST_ON;
1221 aState = GEOMAlgo_ST_OUT;
1223 case GEOM::ST_ONOUT:
1224 aState = GEOMAlgo_ST_ONOUT;
1227 aState = GEOMAlgo_ST_IN;
1230 aState = GEOMAlgo_ST_ONIN;
1239 //=============================================================================
1243 //=============================================================================
1244 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnPlane
1245 (GEOM::GEOM_Object_ptr theShape,
1246 const CORBA::Long theShapeType,
1247 GEOM::GEOM_Object_ptr theAx1,
1248 const GEOM::shape_state theState)
1250 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1252 //Set a not done flag
1253 GetOperations()->SetNotDone();
1255 //Get the reference objects
1256 Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
1257 Handle(::GEOM_Object) anAx1 = GetObjectImpl(theAx1);
1259 if (aShape.IsNull() || anAx1.IsNull()) return aSeq._retn();
1261 //Get Shapes On Plane
1262 Handle(TColStd_HSequenceOfTransient) aHSeq =
1263 GetOperations()->GetShapesOnPlane(aShape, theShapeType, anAx1, ShapeState(theState));
1264 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1265 return aSeq._retn();
1267 Standard_Integer aLength = aHSeq->Length();
1268 aSeq->length(aLength);
1269 for (Standard_Integer i = 1; i <= aLength; i++)
1270 aSeq[i-1] = GetObject(Handle(::GEOM_Object)::DownCast(aHSeq->Value(i)));
1272 return aSeq._retn();
1275 //=============================================================================
1277 * GetShapesOnPlaneWithLocation
1279 //=============================================================================
1280 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnPlaneWithLocation
1281 (GEOM::GEOM_Object_ptr theShape,
1282 const CORBA::Long theShapeType,
1283 GEOM::GEOM_Object_ptr theAx1,
1284 GEOM::GEOM_Object_ptr thePnt,
1285 const GEOM::shape_state theState)
1287 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1289 //Set a not done flag
1290 GetOperations()->SetNotDone();
1292 //Get the reference objects
1293 Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
1294 Handle(::GEOM_Object) anAx1 = GetObjectImpl(theAx1);
1295 Handle(::GEOM_Object) anPnt = GetObjectImpl(thePnt);
1297 if (aShape.IsNull() || anAx1.IsNull() || anPnt.IsNull()) return aSeq._retn();
1299 //Get Shapes On Plane
1300 Handle(TColStd_HSequenceOfTransient) aHSeq =
1301 GetOperations()->GetShapesOnPlaneWithLocation(aShape, theShapeType, anAx1, anPnt, ShapeState(theState));
1302 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1303 return aSeq._retn();
1305 Standard_Integer aLength = aHSeq->Length();
1306 aSeq->length(aLength);
1307 for (Standard_Integer i = 1; i <= aLength; i++)
1308 aSeq[i-1] = GetObject(Handle(::GEOM_Object)::DownCast(aHSeq->Value(i)));
1310 return aSeq._retn();
1313 //=============================================================================
1315 * GetShapesOnCylinder
1317 //=============================================================================
1318 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnCylinder
1319 (GEOM::GEOM_Object_ptr theShape,
1320 const CORBA::Long theShapeType,
1321 GEOM::GEOM_Object_ptr theAxis,
1322 const CORBA::Double theRadius,
1323 const GEOM::shape_state theState)
1325 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1327 //Set a not done flag
1328 GetOperations()->SetNotDone();
1330 //Get the reference objects
1331 Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
1332 Handle(::GEOM_Object) anAxis = GetObjectImpl(theAxis);
1334 if (aShape.IsNull() || anAxis.IsNull()) return aSeq._retn();
1336 //Get Shapes On Cylinder
1337 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnCylinder
1338 (aShape, theShapeType, anAxis, theRadius, ShapeState(theState));
1339 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1340 return aSeq._retn();
1342 Standard_Integer aLength = aHSeq->Length();
1343 aSeq->length(aLength);
1344 for (Standard_Integer i = 1; i <= aLength; i++)
1345 aSeq[i-1] = GetObject(Handle(::GEOM_Object)::DownCast(aHSeq->Value(i)));
1347 return aSeq._retn();
1350 //=============================================================================
1352 * GetShapesOnCylinderWithLocation
1354 //=============================================================================
1355 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnCylinderWithLocation
1356 (GEOM::GEOM_Object_ptr theShape,
1357 const CORBA::Long theShapeType,
1358 GEOM::GEOM_Object_ptr theAxis,
1359 GEOM::GEOM_Object_ptr thePnt,
1360 const CORBA::Double theRadius,
1361 const GEOM::shape_state theState)
1363 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1365 //Set a not done flag
1366 GetOperations()->SetNotDone();
1368 //Get the reference objects
1369 Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
1370 Handle(::GEOM_Object) anAxis = GetObjectImpl(theAxis);
1371 Handle(::GEOM_Object) aPnt = GetObjectImpl(thePnt);
1373 if (aShape.IsNull() || anAxis.IsNull() || aPnt.IsNull()) return aSeq._retn();
1375 //Get Shapes On Cylinder
1376 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnCylinderWithLocation
1377 (aShape, theShapeType, anAxis, aPnt, theRadius, ShapeState(theState));
1378 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1379 return aSeq._retn();
1381 Standard_Integer aLength = aHSeq->Length();
1382 aSeq->length(aLength);
1383 for (Standard_Integer i = 1; i <= aLength; i++)
1384 aSeq[i-1] = GetObject(Handle(::GEOM_Object)::DownCast(aHSeq->Value(i)));
1386 return aSeq._retn();
1389 //=============================================================================
1393 //=============================================================================
1394 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnSphere
1395 (GEOM::GEOM_Object_ptr theShape,
1396 const CORBA::Long theShapeType,
1397 GEOM::GEOM_Object_ptr theCenter,
1398 const CORBA::Double theRadius,
1399 const GEOM::shape_state theState)
1401 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1403 //Set a not done flag
1404 GetOperations()->SetNotDone();
1406 //Get the reference objects
1407 Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
1408 Handle(::GEOM_Object) aCenter = GetObjectImpl(theCenter);
1410 if (aShape.IsNull() || aCenter.IsNull()) return aSeq._retn();
1412 //Get Shapes On Sphere
1413 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnSphere
1414 (aShape, theShapeType, aCenter, theRadius, ShapeState(theState));
1415 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1416 return aSeq._retn();
1418 Standard_Integer aLength = aHSeq->Length();
1419 aSeq->length(aLength);
1420 for (Standard_Integer i = 1; i <= aLength; i++)
1421 aSeq[i-1] = GetObject(Handle(::GEOM_Object)::DownCast(aHSeq->Value(i)));
1423 return aSeq._retn();
1426 //=============================================================================
1428 * GetShapesOnQuadrangle
1430 //=============================================================================
1431 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnQuadrangle
1432 (GEOM::GEOM_Object_ptr theShape,
1433 CORBA::Long theShapeType,
1434 GEOM::GEOM_Object_ptr theTopLeftPoint,
1435 GEOM::GEOM_Object_ptr theTopRigthPoint,
1436 GEOM::GEOM_Object_ptr theBottomLeftPoint,
1437 GEOM::GEOM_Object_ptr theBottomRigthPoint,
1438 GEOM::shape_state theState)
1440 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1442 //Set a not done flag
1443 GetOperations()->SetNotDone();
1445 //Get the reference objects
1446 Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
1447 Handle(::GEOM_Object) aTopLeftPoint = GetObjectImpl(theTopLeftPoint);
1448 Handle(::GEOM_Object) aTopRigthPoint = GetObjectImpl(theTopRigthPoint);
1449 Handle(::GEOM_Object) aBottomLeftPoint = GetObjectImpl(theBottomLeftPoint);
1450 Handle(::GEOM_Object) aBottomRigthPoint = GetObjectImpl(theBottomRigthPoint);
1452 if (aShape.IsNull() ||
1453 aTopLeftPoint.IsNull() ||
1454 aTopRigthPoint.IsNull() ||
1455 aBottomLeftPoint.IsNull() ||
1456 aBottomRigthPoint.IsNull())
1457 return aSeq._retn();
1459 //Get Shapes On Quadrangle
1460 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnQuadrangle
1461 (aShape, theShapeType,
1462 aTopLeftPoint, aTopRigthPoint, aBottomLeftPoint, aBottomRigthPoint,
1463 ShapeState(theState));
1464 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1465 return aSeq._retn();
1467 Standard_Integer aLength = aHSeq->Length();
1468 aSeq->length(aLength);
1469 for (Standard_Integer i = 1; i <= aLength; i++)
1470 aSeq[i-1] = GetObject(Handle(::GEOM_Object)::DownCast(aHSeq->Value(i)));
1472 return aSeq._retn();
1475 //=============================================================================
1477 * GetShapesOnPlaneIDs
1479 //=============================================================================
1480 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnPlaneIDs
1481 (GEOM::GEOM_Object_ptr theShape,
1482 const CORBA::Long theShapeType,
1483 GEOM::GEOM_Object_ptr theAx1,
1484 const GEOM::shape_state theState)
1486 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1488 //Set a not done flag
1489 GetOperations()->SetNotDone();
1491 //Get the reference objects
1492 Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
1493 Handle(::GEOM_Object) anAx1 = GetObjectImpl(theAx1);
1495 if (aShape.IsNull() || anAx1.IsNull()) return aSeq._retn();
1497 //Get Shapes On Plane
1498 Handle(TColStd_HSequenceOfInteger) aHSeq =
1499 GetOperations()->GetShapesOnPlaneIDs(aShape, theShapeType, anAx1, ShapeState(theState));
1500 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1501 return aSeq._retn();
1503 Standard_Integer aLength = aHSeq->Length();
1504 aSeq->length(aLength);
1505 for (Standard_Integer i = 1; i <= aLength; i++)
1506 aSeq[i-1] = aHSeq->Value(i);
1508 return aSeq._retn();
1511 //=============================================================================
1513 * GetShapesOnPlaneWithLocationIDs
1515 //=============================================================================
1516 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnPlaneWithLocationIDs
1517 (GEOM::GEOM_Object_ptr theShape,
1518 const CORBA::Long theShapeType,
1519 GEOM::GEOM_Object_ptr theAx1,
1520 GEOM::GEOM_Object_ptr thePnt,
1521 const GEOM::shape_state theState)
1523 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1525 //Set a not done flag
1526 GetOperations()->SetNotDone();
1528 //Get the reference objects
1529 Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
1530 Handle(::GEOM_Object) anAx1 = GetObjectImpl(theAx1);
1531 Handle(::GEOM_Object) anPnt = GetObjectImpl(thePnt);
1533 if (aShape.IsNull() || anAx1.IsNull() || anPnt.IsNull()) return aSeq._retn();
1535 //Get Shapes On Plane
1536 Handle(TColStd_HSequenceOfInteger) aHSeq =
1537 GetOperations()->GetShapesOnPlaneWithLocationIDs(aShape, theShapeType,
1538 anAx1, anPnt, ShapeState(theState));
1539 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1540 return aSeq._retn();
1542 Standard_Integer aLength = aHSeq->Length();
1543 aSeq->length(aLength);
1544 for (Standard_Integer i = 1; i <= aLength; i++)
1545 aSeq[i-1] = aHSeq->Value(i);
1547 return aSeq._retn();
1550 //=============================================================================
1552 * GetShapesOnCylinderIDs
1554 //=============================================================================
1555 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnCylinderIDs
1556 (GEOM::GEOM_Object_ptr theShape,
1557 const CORBA::Long theShapeType,
1558 GEOM::GEOM_Object_ptr theAxis,
1559 const CORBA::Double theRadius,
1560 const GEOM::shape_state theState)
1562 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1564 //Set a not done flag
1565 GetOperations()->SetNotDone();
1567 //Get the reference objects
1568 Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
1569 Handle(::GEOM_Object) anAxis = GetObjectImpl(theAxis);
1571 if (aShape.IsNull() || anAxis.IsNull()) return aSeq._retn();
1573 //Get Shapes On Cylinder
1574 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnCylinderIDs
1575 (aShape, theShapeType, anAxis, theRadius, ShapeState(theState));
1576 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1577 return aSeq._retn();
1579 Standard_Integer aLength = aHSeq->Length();
1580 aSeq->length(aLength);
1581 for (Standard_Integer i = 1; i <= aLength; i++)
1582 aSeq[i-1] = aHSeq->Value(i);
1584 return aSeq._retn();
1587 //=============================================================================
1589 * GetShapesOnCylinderWithLocationIDs
1591 //=============================================================================
1592 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnCylinderWithLocationIDs
1593 (GEOM::GEOM_Object_ptr theShape,
1594 const CORBA::Long theShapeType,
1595 GEOM::GEOM_Object_ptr theAxis,
1596 GEOM::GEOM_Object_ptr thePnt,
1597 const CORBA::Double theRadius,
1598 const GEOM::shape_state theState)
1600 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1602 //Set a not done flag
1603 GetOperations()->SetNotDone();
1605 //Get the reference objects
1606 Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
1607 Handle(::GEOM_Object) anAxis = GetObjectImpl(theAxis);
1608 Handle(::GEOM_Object) aPnt = GetObjectImpl(thePnt);
1610 if (aShape.IsNull() || anAxis.IsNull() || aPnt.IsNull()) return aSeq._retn();
1612 //Get Shapes On Cylinder
1613 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnCylinderWithLocationIDs
1614 (aShape, theShapeType, anAxis, aPnt, theRadius, ShapeState(theState));
1615 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1616 return aSeq._retn();
1618 Standard_Integer aLength = aHSeq->Length();
1619 aSeq->length(aLength);
1620 for (Standard_Integer i = 1; i <= aLength; i++)
1621 aSeq[i-1] = aHSeq->Value(i);
1623 return aSeq._retn();
1626 //=============================================================================
1628 * GetShapesOnSphereIDs
1630 //=============================================================================
1631 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnSphereIDs
1632 (GEOM::GEOM_Object_ptr theShape,
1633 const CORBA::Long theShapeType,
1634 GEOM::GEOM_Object_ptr theCenter,
1635 const CORBA::Double theRadius,
1636 const GEOM::shape_state theState)
1638 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1640 //Set a not done flag
1641 GetOperations()->SetNotDone();
1643 //Get the reference objects
1644 Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
1645 Handle(::GEOM_Object) aCenter = GetObjectImpl(theCenter);
1647 if (aShape.IsNull() || aCenter.IsNull()) return aSeq._retn();
1649 //Get Shapes On Sphere
1650 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnSphereIDs
1651 (aShape, theShapeType, aCenter, theRadius, ShapeState(theState));
1652 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1653 return aSeq._retn();
1655 Standard_Integer aLength = aHSeq->Length();
1656 aSeq->length(aLength);
1657 for (Standard_Integer i = 1; i <= aLength; i++)
1658 aSeq[i-1] = aHSeq->Value(i);
1660 return aSeq._retn();
1663 //=============================================================================
1665 * GetShapesOnQuadrangleIDs
1667 //=============================================================================
1668 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnQuadrangleIDs
1669 (GEOM::GEOM_Object_ptr theShape,
1670 CORBA::Long theShapeType,
1671 GEOM::GEOM_Object_ptr theTopLeftPoint,
1672 GEOM::GEOM_Object_ptr theTopRigthPoint,
1673 GEOM::GEOM_Object_ptr theBottomLeftPoint,
1674 GEOM::GEOM_Object_ptr theBottomRigthPoint,
1675 GEOM::shape_state theState)
1677 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1679 //Set a not done flag
1680 GetOperations()->SetNotDone();
1682 //Get the reference objects
1683 Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
1684 Handle(::GEOM_Object) aTopLeftPoint = GetObjectImpl(theTopLeftPoint);
1685 Handle(::GEOM_Object) aTopRigthPoint = GetObjectImpl(theTopRigthPoint);
1686 Handle(::GEOM_Object) aBottomLeftPoint = GetObjectImpl(theBottomLeftPoint);
1687 Handle(::GEOM_Object) aBottomRigthPoint = GetObjectImpl(theBottomRigthPoint);
1689 if (aShape.IsNull() ||
1690 aTopLeftPoint.IsNull() ||
1691 aTopRigthPoint.IsNull() ||
1692 aBottomLeftPoint.IsNull() ||
1693 aBottomRigthPoint.IsNull() )
1694 return aSeq._retn();
1696 //Get Shapes On Quadrangle
1697 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnQuadrangleIDs
1698 (aShape, theShapeType,
1699 aTopLeftPoint, aTopRigthPoint, aBottomLeftPoint, aBottomRigthPoint,
1700 ShapeState(theState));
1701 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1702 return aSeq._retn();
1704 Standard_Integer aLength = aHSeq->Length();
1705 aSeq->length(aLength);
1706 for (Standard_Integer i = 1; i <= aLength; i++)
1707 aSeq[i-1] = aHSeq->Value(i);
1709 return aSeq._retn();
1712 //=============================================================================
1716 //=============================================================================
1717 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnBox
1718 (GEOM::GEOM_Object_ptr theBox,
1719 GEOM::GEOM_Object_ptr theShape,
1720 CORBA::Long theShapeType,
1721 GEOM::shape_state theState)
1723 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1725 //Set a not done flag
1726 GetOperations()->SetNotDone();
1728 //Get the reference objects
1729 Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
1730 Handle(::GEOM_Object) aBox = GetObjectImpl(theBox);
1732 if (aShape.IsNull() || aBox.IsNull() )
1733 return aSeq._retn();
1736 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnBox
1737 (aBox,aShape, theShapeType,ShapeState(theState));
1738 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1739 return aSeq._retn();
1741 Standard_Integer aLength = aHSeq->Length();
1742 aSeq->length(aLength);
1743 for (Standard_Integer i = 1; i <= aLength; i++)
1744 aSeq[i-1] = GetObject(Handle(::GEOM_Object)::DownCast(aHSeq->Value(i)));
1746 return aSeq._retn();
1749 //=============================================================================
1751 * GetShapesOnQuadrangleIDs
1753 //=============================================================================
1754 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnBoxIDs
1755 (GEOM::GEOM_Object_ptr theBox,
1756 GEOM::GEOM_Object_ptr theShape,
1757 CORBA::Long theShapeType,
1758 GEOM::shape_state theState)
1760 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1762 //Set a not done flag
1763 GetOperations()->SetNotDone();
1765 //Get the reference objects
1766 Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
1767 Handle(::GEOM_Object) aBox = GetObjectImpl(theBox);
1769 if (aShape.IsNull() || aBox.IsNull() )
1770 return aSeq._retn();
1773 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnBoxIDs
1774 (aBox,aShape, theShapeType,ShapeState(theState));
1775 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1776 return aSeq._retn();
1778 Standard_Integer aLength = aHSeq->Length();
1779 aSeq->length(aLength);
1780 for (Standard_Integer i = 1; i <= aLength; i++)
1781 aSeq[i-1] = aHSeq->Value(i);
1783 return aSeq._retn();
1787 //=============================================================================
1791 //=============================================================================
1792 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnShape
1793 (GEOM::GEOM_Object_ptr theCheckShape,
1794 GEOM::GEOM_Object_ptr theShape,
1795 CORBA::Short theShapeType,
1796 GEOM::shape_state theState)
1798 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1800 //Set a not done flag
1801 GetOperations()->SetNotDone();
1803 //Get the reference objects
1804 Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
1805 Handle(::GEOM_Object) aCheckShape = GetObjectImpl(theCheckShape);
1807 if (aShape.IsNull() || aCheckShape.IsNull() )
1808 return aSeq._retn();
1810 //Get Shapes On Shape
1811 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnShape
1812 (aCheckShape,aShape, theShapeType,ShapeState(theState));
1814 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1815 return aSeq._retn();
1817 Standard_Integer aLength = aHSeq->Length();
1818 aSeq->length(aLength);
1819 for (Standard_Integer i = 1; i <= aLength; i++)
1820 aSeq[i-1] = GetObject(Handle(::GEOM_Object)::DownCast(aHSeq->Value(i)));
1822 return aSeq._retn();
1826 //=============================================================================
1828 * GetShapesOnShapeAsCompound
1830 //=============================================================================
1831 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetShapesOnShapeAsCompound
1832 (GEOM::GEOM_Object_ptr theCheckShape,
1833 GEOM::GEOM_Object_ptr theShape,
1834 CORBA::Short theShapeType,
1835 GEOM::shape_state theState)
1837 GEOM::GEOM_Object_var aGEOMObject;
1839 //Set a not done flag
1840 GetOperations()->SetNotDone();
1842 //Get the reference objects
1843 Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
1844 Handle(::GEOM_Object) aCheckShape = GetObjectImpl(theCheckShape);
1846 if (aShape.IsNull() || aCheckShape.IsNull() )
1847 return aGEOMObject._retn();
1849 //Get Shapes On Shape
1850 Handle(::GEOM_Object) anObject = GetOperations()->GetShapesOnShapeAsCompound
1851 (aCheckShape,aShape, theShapeType,ShapeState(theState));
1853 if (anObject.IsNull())
1854 return aGEOMObject._retn();
1856 return GetObject(anObject);
1860 //=============================================================================
1862 * GetShapesOnShapeIDs
1864 //=============================================================================
1865 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnShapeIDs
1866 (GEOM::GEOM_Object_ptr theCheckShape,
1867 GEOM::GEOM_Object_ptr theShape,
1868 CORBA::Short theShapeType,
1869 GEOM::shape_state theState)
1871 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1873 //Set a not done flag
1874 GetOperations()->SetNotDone();
1876 //Get the reference objects
1877 Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
1878 Handle(::GEOM_Object) aCheckShape = GetObjectImpl(theCheckShape);
1880 if (aShape.IsNull() || aCheckShape.IsNull() )
1881 return aSeq._retn();
1883 //Get Shapes On Shape
1884 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnShapeIDs
1885 (aCheckShape,aShape, theShapeType,ShapeState(theState));
1886 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1887 return aSeq._retn();
1889 Standard_Integer aLength = aHSeq->Length();
1890 aSeq->length(aLength);
1891 for (Standard_Integer i = 1; i <= aLength; i++)
1892 aSeq[i-1] = aHSeq->Value(i);
1894 return aSeq._retn();
1898 //=============================================================================
1902 //=============================================================================
1903 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlace
1904 (GEOM::GEOM_Object_ptr theShapeWhere,
1905 GEOM::GEOM_Object_ptr theShapeWhat)
1907 GEOM::GEOM_Object_var aGEOMObject;
1909 //Set a not done flag
1910 GetOperations()->SetNotDone();
1912 //Get the reference objects
1913 Handle(::GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
1914 Handle(::GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
1916 if (aShapeWhere.IsNull() ||
1917 aShapeWhat.IsNull()) return aGEOMObject._retn();
1919 //Get Shapes in place of aShapeWhat
1920 Handle(::GEOM_Object) anObject =
1921 GetOperations()->GetInPlace(aShapeWhere, aShapeWhat);
1922 if (!GetOperations()->IsDone() || anObject.IsNull())
1923 return aGEOMObject._retn();
1925 return GetObject(anObject);
1928 //=============================================================================
1932 //=============================================================================
1933 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlaceOld
1934 (GEOM::GEOM_Object_ptr theShapeWhere,
1935 GEOM::GEOM_Object_ptr theShapeWhat)
1937 GEOM::GEOM_Object_var aGEOMObject;
1939 //Set a not done flag
1940 GetOperations()->SetNotDone();
1942 //Get the reference objects
1943 Handle(::GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
1944 Handle(::GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
1946 if (aShapeWhere.IsNull() ||
1947 aShapeWhat.IsNull()) return aGEOMObject._retn();
1949 //Get Shapes in place of aShapeWhat
1950 Handle(::GEOM_Object) anObject =
1951 GetOperations()->GetInPlaceOld(aShapeWhere, aShapeWhat);
1952 if (!GetOperations()->IsDone() || anObject.IsNull())
1953 return aGEOMObject._retn();
1955 return GetObject(anObject);
1958 //=============================================================================
1960 * GetInPlaceByHistory
1962 //=============================================================================
1963 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlaceByHistory
1964 (GEOM::GEOM_Object_ptr theShapeWhere,
1965 GEOM::GEOM_Object_ptr theShapeWhat)
1967 GEOM::GEOM_Object_var aGEOMObject;
1969 //Set a not done flag
1970 GetOperations()->SetNotDone();
1972 //Get the reference objects
1973 Handle(::GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
1974 Handle(::GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
1976 if (aShapeWhere.IsNull() ||
1977 aShapeWhat.IsNull()) return aGEOMObject._retn();
1979 //Get Shapes in place of aShapeWhat
1980 Handle(::GEOM_Object) anObject =
1981 GetOperations()->GetInPlaceByHistory(aShapeWhere, aShapeWhat);
1982 if (!GetOperations()->IsDone() || anObject.IsNull())
1983 return aGEOMObject._retn();
1985 return GetObject(anObject);
1988 //=============================================================================
1992 //=============================================================================
1993 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetSame
1994 (GEOM::GEOM_Object_ptr theShapeWhere,
1995 GEOM::GEOM_Object_ptr theShapeWhat)
1997 GEOM::GEOM_Object_var aGEOMObject;
1999 //Set a not done flag
2000 GetOperations()->SetNotDone();
2002 //Get the reference objects
2003 Handle(::GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
2004 Handle(::GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
2006 if (aShapeWhere.IsNull() ||
2007 aShapeWhat.IsNull()) return aGEOMObject._retn();
2009 //Get Shapes in place of aShapeWhat
2010 Handle(::GEOM_Object) anObject =
2011 GetOperations()->GetSame(aShapeWhere, aShapeWhat);
2012 if (!GetOperations()->IsDone() || anObject.IsNull())
2013 return aGEOMObject._retn();
2015 return GetObject(anObject);
2018 //=============================================================================
2022 //=============================================================================
2023 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetSameIDs
2024 (GEOM::GEOM_Object_ptr theShapeWhere,
2025 GEOM::GEOM_Object_ptr theShapeWhat) {
2026 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
2028 //Get the reference objects
2029 Handle(::GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
2030 Handle(::GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
2032 if (aShapeWhere.IsNull() ||
2033 aShapeWhat.IsNull()) return aSeq._retn();
2036 Handle(TColStd_HSequenceOfInteger) aHSeq =
2037 GetOperations()->GetSameIDs(aShapeWhere, aShapeWhat);
2039 if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
2041 Standard_Integer aLength = aHSeq->Length();
2042 aSeq->length(aLength);
2043 for (Standard_Integer i = 1; i <= aLength; i++)
2044 aSeq[i-1] = aHSeq->Value(i);
2046 return aSeq._retn();
2049 //=============================================================================
2053 //=============================================================================
2054 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::ExtendEdge
2055 (GEOM::GEOM_Object_ptr theEdge,
2056 CORBA::Double theMin,
2057 CORBA::Double theMax)
2059 GEOM::GEOM_Object_var aGEOMObject;
2061 //Set a not done flag
2062 GetOperations()->SetNotDone();
2064 //Get the reference objects
2065 Handle(::GEOM_Object) anEdge = GetObjectImpl(theEdge);
2067 if (anEdge.IsNull()) {
2068 return aGEOMObject._retn();
2071 //Get Shapes in place of aShapeWhat
2072 Handle(::GEOM_Object) aNewEdge =
2073 GetOperations()->ExtendEdge(anEdge, theMin, theMax);
2075 if (!GetOperations()->IsDone() || aNewEdge.IsNull()) {
2076 return aGEOMObject._retn();
2079 return GetObject(aNewEdge);
2082 //=============================================================================
2086 //=============================================================================
2087 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::ExtendFace
2088 (GEOM::GEOM_Object_ptr theFace,
2089 CORBA::Double theUMin,
2090 CORBA::Double theUMax,
2091 CORBA::Double theVMin,
2092 CORBA::Double theVMax)
2094 GEOM::GEOM_Object_var aGEOMObject;
2096 //Set a not done flag
2097 GetOperations()->SetNotDone();
2099 //Get the reference objects
2100 Handle(::GEOM_Object) aFace = GetObjectImpl(theFace);
2102 if (aFace.IsNull()) {
2103 return aGEOMObject._retn();
2106 //Get Shapes in place of aShapeWhat
2107 Handle(::GEOM_Object) aNewFace =
2108 GetOperations()->ExtendFace(aFace, theUMin, theUMax, theVMin, theVMax);
2110 if (!GetOperations()->IsDone() || aNewFace.IsNull()) {
2111 return aGEOMObject._retn();
2114 return GetObject(aNewFace);
2117 //=============================================================================
2119 * MakeSurfaceFromFace
2121 //=============================================================================
2122 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeSurfaceFromFace
2123 (GEOM::GEOM_Object_ptr theFace)
2125 GEOM::GEOM_Object_var aGEOMObject;
2127 //Set a not done flag
2128 GetOperations()->SetNotDone();
2130 //Get the reference object
2131 Handle(::GEOM_Object) aFace = GetObjectImpl(theFace);
2133 if (aFace.IsNull()) {
2134 return aGEOMObject._retn();
2137 //Get Shapes in place of aShapeWhat
2138 Handle(::GEOM_Object) aNewFace = GetOperations()->MakeSurfaceFromFace(aFace);
2140 if (!GetOperations()->IsDone() || aNewFace.IsNull()) {
2141 return aGEOMObject._retn();
2144 return GetObject(aNewFace);
2147 //=============================================================================
2149 * GetSubShapeEdgeSorted
2151 //=============================================================================
2152 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSubShapeEdgeSorted
2153 (GEOM::GEOM_Object_ptr theShape,
2154 GEOM::GEOM_Object_ptr theStartPoint)
2156 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
2158 //Set a not done flag
2159 GetOperations()->SetNotDone();
2161 //Get the reference objects
2162 Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
2163 Handle(::GEOM_Object) aStartPoint = GetObjectImpl(theStartPoint);
2165 if (aShape.IsNull() || aStartPoint.IsNull()) {
2166 return aSeq._retn();
2169 //Get Shapes On Shape
2170 Handle(TColStd_HSequenceOfTransient) aHSeq =
2171 GetOperations()->GetSubShapeEdgeSorted(aShape, aStartPoint);
2173 if (!GetOperations()->IsDone() || aHSeq.IsNull())
2174 return aSeq._retn();
2176 const Standard_Integer aLength = aHSeq->Length();
2179 aSeq->length(aLength);
2181 for (i = 1; i <= aLength; i++) {
2182 aSeq[i-1] = GetObject(Handle(::GEOM_Object)::DownCast(aHSeq->Value(i)));
2185 return aSeq._retn();
2188 //=============================================================================
2190 * GetSubShapesWithTolerance
2192 //=============================================================================
2193 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSubShapesWithTolerance
2194 (GEOM::GEOM_Object_ptr theShape,
2195 CORBA::Short theShapeType,
2196 GEOM::comparison_condition theCondition,
2197 CORBA::Double theTolerance)
2199 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
2201 //Set a not done flag
2202 GetOperations()->SetNotDone();
2204 //Get the reference objects
2205 Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
2207 if (aShape.IsNull()) {
2208 return aSeq._retn();
2211 //Get Shapes On Shape
2212 const GEOMUtils::ComparisonCondition aCondition =
2213 ComparisonCondition(theCondition);
2214 Handle(TColStd_HSequenceOfTransient) aHSeq =
2215 GetOperations()->GetSubShapesWithTolerance
2216 (aShape, theShapeType, aCondition, theTolerance);
2218 if (!GetOperations()->IsDone() || aHSeq.IsNull())
2219 return aSeq._retn();
2221 const Standard_Integer aLength = aHSeq->Length();
2224 aSeq->length(aLength);
2226 for (i = 1; i <= aLength; i++) {
2227 aSeq[i-1] = GetObject(Handle(::GEOM_Object)::DownCast(aHSeq->Value(i)));
2230 return aSeq._retn();
2233 //=============================================================================
2237 //=============================================================================
2238 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeExtraction
2239 (GEOM::GEOM_Object_ptr theShape,
2240 const GEOM::ListOfLong &theSubShapeIDs,
2241 GEOM::GEOM_IShapesOperations::ExtractionStats_out theStats)
2243 GEOM::GEOM_Object_var aGEOMObject;
2245 //Set a not done flag
2246 theStats = new GEOM::GEOM_IShapesOperations::ExtractionStats;
2247 GetOperations()->SetNotDone();
2249 //Get the reference object
2250 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
2252 if (aShape.IsNull()) {
2253 return aGEOMObject._retn();
2256 const int aNbIDs = theSubShapeIDs.length();
2259 return aGEOMObject._retn();
2263 Handle(TColStd_HArray1OfInteger) anArray =
2264 new TColStd_HArray1OfInteger (1, aNbIDs);
2266 for (i = 0; i < aNbIDs; i++) {
2267 anArray->SetValue(i + 1, theSubShapeIDs[i]);
2270 //Get Shapes in place of aShapeWhat
2271 std::list<GEOMImpl_IShapesOperations::ExtractionStat> aStats;
2272 Handle(GEOM_Object) aResult =
2273 GetOperations()->MakeExtraction(aShape, anArray, aStats);
2275 if (!GetOperations()->IsDone() || aResult.IsNull()) {
2276 return aGEOMObject._retn();
2279 // Convert statistics.
2280 const int aNbStats = aStats.size();
2282 theStats->length(aNbStats);
2284 // fill the local CORBA array with values from lists
2285 std::list<GEOMImpl_IShapesOperations::ExtractionStat>::const_iterator
2286 anIt = aStats.begin();
2288 for (i = 0; anIt != aStats.end(); i++, anIt++) {
2289 GEOM::GEOM_IShapesOperations::ExtractionStat_var aResStat =
2290 new GEOM::GEOM_IShapesOperations::ExtractionStat;
2293 switch (anIt->type) {
2294 case GEOMImpl_IShapesOperations::EST_Removed:
2295 aResStat->type = GEOM::GEOM_IShapesOperations::EST_Removed;
2297 case GEOMImpl_IShapesOperations::EST_Modified:
2298 aResStat->type = GEOM::GEOM_IShapesOperations::EST_Modified;
2300 case GEOMImpl_IShapesOperations::EST_Added:
2301 aResStat->type = GEOM::GEOM_IShapesOperations::EST_Added;
2307 // Copy the list of IDs
2308 std::list<Standard_Integer> aIDList = anIt->indices;
2309 GEOM::ListOfLong_var aResIDList = new GEOM::ListOfLong;
2311 aResIDList->length(aIDList.size());
2313 std::list<Standard_Integer>::iterator anIDIt = aIDList.begin();
2316 for (; anIDIt != aIDList.end(); j++, anIDIt++) {
2317 aResIDList[j] = *anIDIt;
2320 aResStat->indices = aResIDList;
2322 theStats[(_CORBA_ULong)i] = aResStat;
2325 return GetObject(aResult);