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_NAMESPACE(GEOM_Object) aPnt1 = GetObjectImpl(thePnt1);
106 HANDLE_NAMESPACE(GEOM_Object) aPnt2 = GetObjectImpl(thePnt2);
108 if (aPnt1.IsNull() || aPnt2.IsNull()) return aGEOMObject._retn();
111 HANDLE_NAMESPACE(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_NAMESPACE(GEOM_Object) aRefCurve = GetObjectImpl(theCurve);
135 if (aRefCurve.IsNull()) return aGEOMObject._retn();
137 //Get the reference point (can be NULL)
138 HANDLE_NAMESPACE(GEOM_Object) aRefPoint;
139 if (!CORBA::is_nil(theStartPoint)) {
140 aRefPoint = GetObjectImpl(theStartPoint);
144 HANDLE_NAMESPACE(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_NAMESPACE(GEOM_Object) aWire = GetObjectImpl(theWire);
170 if (aWire.IsNull()) return aGEOMObject._retn();
173 HANDLE_NAMESPACE(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_NAMESPACE(GEOM_Object)> aShapes;
198 aLen = theEdgesAndWires.length();
199 for (ind = 0; ind < aLen; ind++) {
200 HANDLE_NAMESPACE(GEOM_Object) aSh = GetObjectImpl(theEdgesAndWires[ind]);
201 if (aSh.IsNull()) return aGEOMObject._retn();
202 aShapes.push_back(aSh);
206 HANDLE_NAMESPACE(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_NAMESPACE(GEOM_Object) aWire = GetObjectImpl(theWire);
230 if (aWire.IsNull()) return aGEOMObject._retn();
233 HANDLE_NAMESPACE(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_NAMESPACE(GEOM_Object)> aShapes;
260 aLen = theWires.length();
261 for (ind = 0; ind < aLen; ind++) {
262 HANDLE_NAMESPACE(GEOM_Object) aSh = GetObjectImpl(theWires[ind]);
263 if (aSh.IsNull()) return aGEOMObject._retn();
264 aShapes.push_back(aSh);
268 HANDLE_NAMESPACE(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_NAMESPACE(GEOM_Object) aFace = GetObjectImpl(theFace);
294 HANDLE_NAMESPACE(GEOM_Object) aWire = GetObjectImpl(theWire);
296 if (aFace.IsNull() || aWire.IsNull()) {
297 return aGEOMObject._retn();
301 HANDLE_NAMESPACE(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_NAMESPACE(GEOM_Object)> aConstraints;
326 for( int ind = 0; ind < theConstraints.length(); ind++ ) {
327 HANDLE_NAMESPACE(GEOM_Object) anObject = GetObjectImpl( theConstraints[ind] );
328 aConstraints.push_back(anObject);
332 HANDLE_NAMESPACE(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_NAMESPACE(GEOM_Object)> aShapes;
359 aLen = theFacesAndShells.length();
360 for (ind = 0; ind < aLen; ind++) {
361 HANDLE_NAMESPACE(GEOM_Object) aSh = GetObjectImpl(theFacesAndShells[ind]);
362 if (aSh.IsNull()) return aGEOMObject._retn();
363 aShapes.push_back(aSh);
367 HANDLE_NAMESPACE(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_NAMESPACE(GEOM_Object) aShell = GetObjectImpl(theShell);
390 if (aShell.IsNull()) return aGEOMObject._retn();
392 std::list<HANDLE_NAMESPACE(GEOM_Object)> aShapes;
393 aShapes.push_back(aShell);
396 HANDLE_NAMESPACE(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_NAMESPACE(GEOM_Object)> aShapes;
420 aLen = theShells.length();
421 for (ind = 0; ind < aLen; ind++) {
422 HANDLE_NAMESPACE(GEOM_Object) aSh = GetObjectImpl(theShells[ind]);
423 if (aSh.IsNull()) return aGEOMObject._retn();
424 aShapes.push_back(aSh);
428 HANDLE_NAMESPACE(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_NAMESPACE(GEOM_Object)> aShapes;
453 aLen = theShapes.length();
454 for (ind = 0; ind < aLen; ind++) {
455 HANDLE_NAMESPACE(GEOM_Object) aSh = GetObjectImpl(theShapes[ind]);
456 if (aSh.IsNull()) return aGEOMObject._retn();
457 aShapes.push_back(aSh);
461 HANDLE_NAMESPACE(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_NAMESPACE(GEOM_Object)> aShapes;
487 aLen = theFacesOrShells.length();
488 for (ind = 0; ind < aLen; ind++) {
489 ::HANDLE_NAMESPACE(GEOM_Object) aSh = GetObjectImpl(theFacesOrShells[ind]);
490 if (aSh.IsNull()) return aGEOMObject._retn();
491 aShapes.push_back(aSh);
495 HANDLE_NAMESPACE(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_NAMESPACE(GEOM_Object) > aShapes;
520 if (! GetListOfObjectsImpl( theShapes, aShapes ))
521 return aGEOMObject._retn();
524 HANDLE_NAMESPACE(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_NAMESPACE(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_NAMESPACE(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_NAMESPACE(GEOM_Object) > aShapes;
588 if (! GetListOfObjectsImpl( theShapes, aShapes ))
589 return aGEOMObject._retn();
592 std::list<HANDLE_NAMESPACE(GEOM_Object)> aFaces;
593 if (! GetListOfObjectsImpl( theFaces, aFaces ))
594 return aGEOMObject._retn();
597 HANDLE_NAMESPACE(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_NAMESPACE(GEOM_Object) > aShapes;
624 if (! GetListOfObjectsImpl( theShapes, aShapes ))
625 return aGEOMObject._retn();
628 HANDLE_NAMESPACE(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_NAMESPACE(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_NAMESPACE(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_NAMESPACE(GEOM_Object) > aShapes;
690 if (! GetListOfObjectsImpl( theShapes, aShapes ))
691 return aGEOMObject._retn();
694 std::list<HANDLE_NAMESPACE(GEOM_Object)> anEdges;
695 if (! GetListOfObjectsImpl( theEdges, anEdges ))
696 return aGEOMObject._retn();
699 HANDLE_NAMESPACE(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_NAMESPACE(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_NAMESPACE(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_NAMESPACE(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_NAMESPACE(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_NAMESPACE(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_NAMESPACE(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_NAMESPACE(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_NAMESPACE(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_NAMESPACE(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_NAMESPACE(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_NAMESPACE(GEOM_Object) aShape = GetObjectImpl(theMainShape);
891 if (aShape.IsNull()) return aGEOMObject._retn();
893 HANDLE_NAMESPACE(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;
911 //Set a not done flag
912 GetOperations()->SetNotDone();
914 if (theIndices.length() < 1)
917 HANDLE_NAMESPACE(GEOM_Object) aShape = GetObjectImpl(theMainShape);
918 if (aShape.IsNull()) return aSeq._retn();
920 Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger (1, theIndices.length());
921 for (i = 0; i < theIndices.length(); i++)
922 anArray->SetValue(i+1, theIndices[i]);
924 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakeSubShapes(aShape, anArray);
925 if (!GetOperations()->IsDone() || aHSeq.IsNull())
928 Standard_Integer aLength = aHSeq->Length();
929 aSeq->length(aLength);
930 for (i = 0; i < aLength; i++)
931 aSeq[i] = GetObject(HANDLE_NAMESPACE(GEOM_Object)::DownCast(aHSeq->Value(i+1)));
936 //=============================================================================
940 //=============================================================================
941 CORBA::Long GEOM_IShapesOperations_i::GetSubShapeIndex
942 (GEOM::GEOM_Object_ptr theMainShape, GEOM::GEOM_Object_ptr theSubShape)
944 //Get the reference shapes
945 HANDLE_NAMESPACE(GEOM_Object) aMainShapeRef = GetObjectImpl(theMainShape);
946 HANDLE_NAMESPACE(GEOM_Object) aSubShapeRef = GetObjectImpl(theSubShape);
948 if (aMainShapeRef.IsNull() || aSubShapeRef.IsNull()) return -1;
950 //Get the unique ID of <theSubShape> inside <theMainShape>
951 CORBA::Long anID = GetOperations()->GetSubShapeIndex(aMainShapeRef, aSubShapeRef);
952 if (!GetOperations()->IsDone())
958 //=============================================================================
960 * GetSubShapesIndices
962 //=============================================================================
963 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetSubShapesIndices
964 (GEOM::GEOM_Object_ptr theMainShape, const GEOM::ListOfGO& theSubShapes)
966 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
968 //Get the reference main shape
969 HANDLE_NAMESPACE(GEOM_Object) aMainShapeRef = GetObjectImpl(theMainShape);
970 if (aMainShapeRef.IsNull()) return aSeq._retn();
973 std::list<HANDLE_NAMESPACE(GEOM_Object)> aShapes;
974 int aLen = theSubShapes.length();
975 for (int ind = 0; ind < aLen; ind++) {
976 HANDLE_NAMESPACE(GEOM_Object) aSh = GetObjectImpl(theSubShapes[ind]);
979 MESSAGE("NULL shape")
982 aShapes.push_back(aSh);
985 //Get the IDs of <theSubShapes> inside <theMainShape>
986 Handle(TColStd_HSequenceOfInteger) aHSeq =
987 GetOperations()->GetSubShapesIndices(aMainShapeRef, aShapes);
989 if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
991 Standard_Integer aLength = aHSeq->Length();
992 aSeq->length(aLength);
994 for (Standard_Integer i = 1; i <= aLength; i++)
995 aSeq[i-1] = aHSeq->Value(i);
1001 //=============================================================================
1005 //=============================================================================
1006 CORBA::Long GEOM_IShapesOperations_i::GetTopologyIndex
1007 (GEOM::GEOM_Object_ptr theMainShape, GEOM::GEOM_Object_ptr theSubShape)
1009 //Get the reference shapes
1010 HANDLE_NAMESPACE(GEOM_Object) aMainShapeRef = GetObjectImpl(theMainShape);
1011 HANDLE_NAMESPACE(GEOM_Object) aSubShapeRef = GetObjectImpl(theSubShape);
1013 if (aMainShapeRef.IsNull() || aSubShapeRef.IsNull()) return -1;
1015 //Get an ID of <theSubShape>, unique among all sub-shapes of <theMainShape> of the same type
1016 CORBA::Long anID = GetOperations()->GetTopologyIndex(aMainShapeRef, aSubShapeRef);
1017 if (!GetOperations()->IsDone())
1023 //=============================================================================
1025 * GetShapeTypeString
1027 //=============================================================================
1028 char* GEOM_IShapesOperations_i::GetShapeTypeString (GEOM::GEOM_Object_ptr theShape)
1030 //Get the reference shape
1031 HANDLE_NAMESPACE(GEOM_Object) aShape = GetObjectImpl(theShape);
1032 if (aShape.IsNull()) return NULL;
1034 // Get shape parameters
1035 TCollection_AsciiString aDescription = GetOperations()->GetShapeTypeString(aShape);
1036 return CORBA::string_dup(aDescription.ToCString());
1039 //=============================================================================
1041 * IsSubShapeBelongsTo
1043 //=============================================================================
1044 CORBA::Boolean GEOM_IShapesOperations_i::IsSubShapeBelongsTo( GEOM::GEOM_Object_ptr theSubObject,
1045 const CORBA::Long theSubObjectIndex,
1046 GEOM::GEOM_Object_ptr theObject,
1047 const CORBA::Long theObjectIndex)
1049 HANDLE_NAMESPACE(GEOM_Object) aSubObject = GetObjectImpl( theSubObject );
1050 HANDLE_NAMESPACE(GEOM_Object) anObject = GetObjectImpl( theObject );
1051 if( anObject.IsNull() || aSubObject.IsNull() )
1055 return GetOperations()->IsSubShapeBelongsTo( aSubObject, theSubObjectIndex, anObject, theObjectIndex );
1058 //=============================================================================
1062 //=============================================================================
1063 CORBA::Long GEOM_IShapesOperations_i::NumberOfFaces (GEOM::GEOM_Object_ptr theShape)
1065 return NumberOfSubShapes(theShape, Standard_Integer(TopAbs_FACE));
1068 //=============================================================================
1072 //=============================================================================
1073 CORBA::Long GEOM_IShapesOperations_i::NumberOfEdges (GEOM::GEOM_Object_ptr theShape)
1075 return NumberOfSubShapes(theShape, Standard_Integer(TopAbs_EDGE));
1078 //=============================================================================
1082 //=============================================================================
1083 CORBA::Long GEOM_IShapesOperations_i::NumberOfSubShapes (GEOM::GEOM_Object_ptr theShape,
1084 const CORBA::Long theShapeType)
1086 HANDLE_NAMESPACE(GEOM_Object) aShape = GetObjectImpl(theShape);
1087 if (aShape.IsNull()) return -1;
1089 CORBA::Long aNb = GetOperations()->NumberOfSubShapes(aShape, theShapeType);
1090 if (!GetOperations()->IsDone()) return -1;
1095 //=============================================================================
1099 //=============================================================================
1100 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::ChangeOrientation
1101 (GEOM::GEOM_Object_ptr theShape)
1103 GEOM::GEOM_Object_var aGEOMObject;
1105 //Set a not done flag
1106 GetOperations()->SetNotDone();
1108 //Get the reference objects
1109 HANDLE_NAMESPACE(GEOM_Object) aShape = GetObjectImpl(theShape);
1110 if (aShape.IsNull()) return aGEOMObject._retn();
1113 HANDLE_NAMESPACE(GEOM_Object) anObject = GetOperations()->ReverseShape(aShape);
1114 if (!GetOperations()->IsDone() || anObject.IsNull())
1115 return aGEOMObject._retn();
1117 return GetObject(anObject);
1120 //=============================================================================
1124 //=============================================================================
1125 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetFreeFacesIDs (GEOM::GEOM_Object_ptr theShape)
1127 //Set a not done flag
1128 GetOperations()->SetNotDone();
1130 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1132 HANDLE_NAMESPACE(GEOM_Object) aShape = GetObjectImpl(theShape);
1133 if (aShape.IsNull()) return aSeq._retn();
1135 Handle(TColStd_HSequenceOfInteger) aHSeq =
1136 GetOperations()->GetFreeFacesIDs(aShape);
1137 if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
1139 Standard_Integer aLength = aHSeq->Length();
1140 aSeq->length(aLength);
1141 for (Standard_Integer i = 1; i <= aLength; i++)
1142 aSeq[i-1] = aHSeq->Value(i);
1144 return aSeq._retn();
1147 //=============================================================================
1151 //=============================================================================
1152 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSharedShapes
1153 (GEOM::GEOM_Object_ptr theShape1,
1154 GEOM::GEOM_Object_ptr theShape2,
1155 const CORBA::Long theShapeType)
1157 //Set a not done flag
1158 GetOperations()->SetNotDone();
1160 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1162 HANDLE_NAMESPACE(GEOM_Object) aShape1 = GetObjectImpl(theShape1);
1163 HANDLE_NAMESPACE(GEOM_Object) aShape2 = GetObjectImpl(theShape2);
1165 if (aShape1.IsNull() || aShape2.IsNull()) return aSeq._retn();
1167 Handle(TColStd_HSequenceOfTransient) aHSeq =
1168 GetOperations()->GetSharedShapes(aShape1, aShape2, theShapeType);
1169 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1170 return aSeq._retn();
1172 Standard_Integer aLength = aHSeq->Length();
1173 aSeq->length(aLength);
1174 for (Standard_Integer i = 1; i <= aLength; i++)
1175 aSeq[i-1] = GetObject(HANDLE_NAMESPACE(GEOM_Object)::DownCast(aHSeq->Value(i)));
1177 return aSeq._retn();
1180 //=============================================================================
1182 * GetSharedShapesMulti
1184 //=============================================================================
1185 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSharedShapesMulti
1186 (const GEOM::ListOfGO& theShapes,
1187 const CORBA::Long theShapeType,
1188 CORBA::Boolean theMultiShare)
1190 //Set a not done flag
1191 GetOperations()->SetNotDone();
1193 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1196 std::list<HANDLE_NAMESPACE(GEOM_Object)> aShapes;
1197 if (! GetListOfObjectsImpl( theShapes, aShapes ))
1198 return aSeq._retn();
1200 Handle(TColStd_HSequenceOfTransient) aHSeq =
1201 GetOperations()->GetSharedShapes(aShapes, theShapeType, theMultiShare);
1202 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1203 return aSeq._retn();
1205 Standard_Integer aLength = aHSeq->Length();
1206 aSeq->length(aLength);
1207 for (Standard_Integer i = 1; i <= aLength; i++)
1208 aSeq[i-1] = GetObject(HANDLE_NAMESPACE(GEOM_Object)::DownCast(aHSeq->Value(i)));
1210 return aSeq._retn();
1213 static GEOMAlgo_State ShapeState (const GEOM::shape_state theState)
1215 GEOMAlgo_State aState = GEOMAlgo_ST_UNKNOWN;
1219 aState = GEOMAlgo_ST_ON;
1222 aState = GEOMAlgo_ST_OUT;
1224 case GEOM::ST_ONOUT:
1225 aState = GEOMAlgo_ST_ONOUT;
1228 aState = GEOMAlgo_ST_IN;
1231 aState = GEOMAlgo_ST_ONIN;
1240 //=============================================================================
1244 //=============================================================================
1245 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnPlane
1246 (GEOM::GEOM_Object_ptr theShape,
1247 const CORBA::Long theShapeType,
1248 GEOM::GEOM_Object_ptr theAx1,
1249 const GEOM::shape_state theState)
1251 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1253 //Set a not done flag
1254 GetOperations()->SetNotDone();
1256 //Get the reference objects
1257 HANDLE_NAMESPACE(GEOM_Object) aShape = GetObjectImpl(theShape);
1258 HANDLE_NAMESPACE(GEOM_Object) anAx1 = GetObjectImpl(theAx1);
1260 if (aShape.IsNull() || anAx1.IsNull()) return aSeq._retn();
1262 //Get Shapes On Plane
1263 Handle(TColStd_HSequenceOfTransient) aHSeq =
1264 GetOperations()->GetShapesOnPlane(aShape, theShapeType, anAx1, ShapeState(theState));
1265 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1266 return aSeq._retn();
1268 Standard_Integer aLength = aHSeq->Length();
1269 aSeq->length(aLength);
1270 for (Standard_Integer i = 1; i <= aLength; i++)
1271 aSeq[i-1] = GetObject(HANDLE_NAMESPACE(GEOM_Object)::DownCast(aHSeq->Value(i)));
1273 return aSeq._retn();
1276 //=============================================================================
1278 * GetShapesOnPlaneWithLocation
1280 //=============================================================================
1281 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnPlaneWithLocation
1282 (GEOM::GEOM_Object_ptr theShape,
1283 const CORBA::Long theShapeType,
1284 GEOM::GEOM_Object_ptr theAx1,
1285 GEOM::GEOM_Object_ptr thePnt,
1286 const GEOM::shape_state theState)
1288 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1290 //Set a not done flag
1291 GetOperations()->SetNotDone();
1293 //Get the reference objects
1294 HANDLE_NAMESPACE(GEOM_Object) aShape = GetObjectImpl(theShape);
1295 HANDLE_NAMESPACE(GEOM_Object) anAx1 = GetObjectImpl(theAx1);
1296 HANDLE_NAMESPACE(GEOM_Object) anPnt = GetObjectImpl(thePnt);
1298 if (aShape.IsNull() || anAx1.IsNull() || anPnt.IsNull()) return aSeq._retn();
1300 //Get Shapes On Plane
1301 Handle(TColStd_HSequenceOfTransient) aHSeq =
1302 GetOperations()->GetShapesOnPlaneWithLocation(aShape, theShapeType, anAx1, anPnt, ShapeState(theState));
1303 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1304 return aSeq._retn();
1306 Standard_Integer aLength = aHSeq->Length();
1307 aSeq->length(aLength);
1308 for (Standard_Integer i = 1; i <= aLength; i++)
1309 aSeq[i-1] = GetObject(HANDLE_NAMESPACE(GEOM_Object)::DownCast(aHSeq->Value(i)));
1311 return aSeq._retn();
1314 //=============================================================================
1316 * GetShapesOnCylinder
1318 //=============================================================================
1319 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnCylinder
1320 (GEOM::GEOM_Object_ptr theShape,
1321 const CORBA::Long theShapeType,
1322 GEOM::GEOM_Object_ptr theAxis,
1323 const CORBA::Double theRadius,
1324 const GEOM::shape_state theState)
1326 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1328 //Set a not done flag
1329 GetOperations()->SetNotDone();
1331 //Get the reference objects
1332 HANDLE_NAMESPACE(GEOM_Object) aShape = GetObjectImpl(theShape);
1333 HANDLE_NAMESPACE(GEOM_Object) anAxis = GetObjectImpl(theAxis);
1335 if (aShape.IsNull() || anAxis.IsNull()) return aSeq._retn();
1337 //Get Shapes On Cylinder
1338 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnCylinder
1339 (aShape, theShapeType, anAxis, theRadius, ShapeState(theState));
1340 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1341 return aSeq._retn();
1343 Standard_Integer aLength = aHSeq->Length();
1344 aSeq->length(aLength);
1345 for (Standard_Integer i = 1; i <= aLength; i++)
1346 aSeq[i-1] = GetObject(HANDLE_NAMESPACE(GEOM_Object)::DownCast(aHSeq->Value(i)));
1348 return aSeq._retn();
1351 //=============================================================================
1353 * GetShapesOnCylinderWithLocation
1355 //=============================================================================
1356 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnCylinderWithLocation
1357 (GEOM::GEOM_Object_ptr theShape,
1358 const CORBA::Long theShapeType,
1359 GEOM::GEOM_Object_ptr theAxis,
1360 GEOM::GEOM_Object_ptr thePnt,
1361 const CORBA::Double theRadius,
1362 const GEOM::shape_state theState)
1364 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1366 //Set a not done flag
1367 GetOperations()->SetNotDone();
1369 //Get the reference objects
1370 HANDLE_NAMESPACE(GEOM_Object) aShape = GetObjectImpl(theShape);
1371 HANDLE_NAMESPACE(GEOM_Object) anAxis = GetObjectImpl(theAxis);
1372 HANDLE_NAMESPACE(GEOM_Object) aPnt = GetObjectImpl(thePnt);
1374 if (aShape.IsNull() || anAxis.IsNull() || aPnt.IsNull()) return aSeq._retn();
1376 //Get Shapes On Cylinder
1377 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnCylinderWithLocation
1378 (aShape, theShapeType, anAxis, aPnt, theRadius, ShapeState(theState));
1379 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1380 return aSeq._retn();
1382 Standard_Integer aLength = aHSeq->Length();
1383 aSeq->length(aLength);
1384 for (Standard_Integer i = 1; i <= aLength; i++)
1385 aSeq[i-1] = GetObject(HANDLE_NAMESPACE(GEOM_Object)::DownCast(aHSeq->Value(i)));
1387 return aSeq._retn();
1390 //=============================================================================
1394 //=============================================================================
1395 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnSphere
1396 (GEOM::GEOM_Object_ptr theShape,
1397 const CORBA::Long theShapeType,
1398 GEOM::GEOM_Object_ptr theCenter,
1399 const CORBA::Double theRadius,
1400 const GEOM::shape_state theState)
1402 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1404 //Set a not done flag
1405 GetOperations()->SetNotDone();
1407 //Get the reference objects
1408 HANDLE_NAMESPACE(GEOM_Object) aShape = GetObjectImpl(theShape);
1409 HANDLE_NAMESPACE(GEOM_Object) aCenter = GetObjectImpl(theCenter);
1411 if (aShape.IsNull() || aCenter.IsNull()) return aSeq._retn();
1413 //Get Shapes On Sphere
1414 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnSphere
1415 (aShape, theShapeType, aCenter, theRadius, ShapeState(theState));
1416 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1417 return aSeq._retn();
1419 Standard_Integer aLength = aHSeq->Length();
1420 aSeq->length(aLength);
1421 for (Standard_Integer i = 1; i <= aLength; i++)
1422 aSeq[i-1] = GetObject(HANDLE_NAMESPACE(GEOM_Object)::DownCast(aHSeq->Value(i)));
1424 return aSeq._retn();
1427 //=============================================================================
1429 * GetShapesOnQuadrangle
1431 //=============================================================================
1432 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnQuadrangle
1433 (GEOM::GEOM_Object_ptr theShape,
1434 CORBA::Long theShapeType,
1435 GEOM::GEOM_Object_ptr theTopLeftPoint,
1436 GEOM::GEOM_Object_ptr theTopRigthPoint,
1437 GEOM::GEOM_Object_ptr theBottomLeftPoint,
1438 GEOM::GEOM_Object_ptr theBottomRigthPoint,
1439 GEOM::shape_state theState)
1441 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1443 //Set a not done flag
1444 GetOperations()->SetNotDone();
1446 //Get the reference objects
1447 HANDLE_NAMESPACE(GEOM_Object) aShape = GetObjectImpl(theShape);
1448 HANDLE_NAMESPACE(GEOM_Object) aTopLeftPoint = GetObjectImpl(theTopLeftPoint);
1449 HANDLE_NAMESPACE(GEOM_Object) aTopRigthPoint = GetObjectImpl(theTopRigthPoint);
1450 HANDLE_NAMESPACE(GEOM_Object) aBottomLeftPoint = GetObjectImpl(theBottomLeftPoint);
1451 HANDLE_NAMESPACE(GEOM_Object) aBottomRigthPoint = GetObjectImpl(theBottomRigthPoint);
1453 if (aShape.IsNull() ||
1454 aTopLeftPoint.IsNull() ||
1455 aTopRigthPoint.IsNull() ||
1456 aBottomLeftPoint.IsNull() ||
1457 aBottomRigthPoint.IsNull())
1458 return aSeq._retn();
1460 //Get Shapes On Quadrangle
1461 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnQuadrangle
1462 (aShape, theShapeType,
1463 aTopLeftPoint, aTopRigthPoint, aBottomLeftPoint, aBottomRigthPoint,
1464 ShapeState(theState));
1465 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1466 return aSeq._retn();
1468 Standard_Integer aLength = aHSeq->Length();
1469 aSeq->length(aLength);
1470 for (Standard_Integer i = 1; i <= aLength; i++)
1471 aSeq[i-1] = GetObject(HANDLE_NAMESPACE(GEOM_Object)::DownCast(aHSeq->Value(i)));
1473 return aSeq._retn();
1476 //=============================================================================
1478 * GetShapesOnPlaneIDs
1480 //=============================================================================
1481 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnPlaneIDs
1482 (GEOM::GEOM_Object_ptr theShape,
1483 const CORBA::Long theShapeType,
1484 GEOM::GEOM_Object_ptr theAx1,
1485 const GEOM::shape_state theState)
1487 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1489 //Set a not done flag
1490 GetOperations()->SetNotDone();
1492 //Get the reference objects
1493 HANDLE_NAMESPACE(GEOM_Object) aShape = GetObjectImpl(theShape);
1494 HANDLE_NAMESPACE(GEOM_Object) anAx1 = GetObjectImpl(theAx1);
1496 if (aShape.IsNull() || anAx1.IsNull()) return aSeq._retn();
1498 //Get Shapes On Plane
1499 Handle(TColStd_HSequenceOfInteger) aHSeq =
1500 GetOperations()->GetShapesOnPlaneIDs(aShape, theShapeType, anAx1, ShapeState(theState));
1501 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1502 return aSeq._retn();
1504 Standard_Integer aLength = aHSeq->Length();
1505 aSeq->length(aLength);
1506 for (Standard_Integer i = 1; i <= aLength; i++)
1507 aSeq[i-1] = aHSeq->Value(i);
1509 return aSeq._retn();
1512 //=============================================================================
1514 * GetShapesOnPlaneWithLocationIDs
1516 //=============================================================================
1517 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnPlaneWithLocationIDs
1518 (GEOM::GEOM_Object_ptr theShape,
1519 const CORBA::Long theShapeType,
1520 GEOM::GEOM_Object_ptr theAx1,
1521 GEOM::GEOM_Object_ptr thePnt,
1522 const GEOM::shape_state theState)
1524 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1526 //Set a not done flag
1527 GetOperations()->SetNotDone();
1529 //Get the reference objects
1530 HANDLE_NAMESPACE(GEOM_Object) aShape = GetObjectImpl(theShape);
1531 HANDLE_NAMESPACE(GEOM_Object) anAx1 = GetObjectImpl(theAx1);
1532 HANDLE_NAMESPACE(GEOM_Object) anPnt = GetObjectImpl(thePnt);
1534 if (aShape.IsNull() || anAx1.IsNull() || anPnt.IsNull()) return aSeq._retn();
1536 //Get Shapes On Plane
1537 Handle(TColStd_HSequenceOfInteger) aHSeq =
1538 GetOperations()->GetShapesOnPlaneWithLocationIDs(aShape, theShapeType,
1539 anAx1, anPnt, ShapeState(theState));
1540 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1541 return aSeq._retn();
1543 Standard_Integer aLength = aHSeq->Length();
1544 aSeq->length(aLength);
1545 for (Standard_Integer i = 1; i <= aLength; i++)
1546 aSeq[i-1] = aHSeq->Value(i);
1548 return aSeq._retn();
1551 //=============================================================================
1553 * GetShapesOnCylinderIDs
1555 //=============================================================================
1556 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnCylinderIDs
1557 (GEOM::GEOM_Object_ptr theShape,
1558 const CORBA::Long theShapeType,
1559 GEOM::GEOM_Object_ptr theAxis,
1560 const CORBA::Double theRadius,
1561 const GEOM::shape_state theState)
1563 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1565 //Set a not done flag
1566 GetOperations()->SetNotDone();
1568 //Get the reference objects
1569 HANDLE_NAMESPACE(GEOM_Object) aShape = GetObjectImpl(theShape);
1570 HANDLE_NAMESPACE(GEOM_Object) anAxis = GetObjectImpl(theAxis);
1572 if (aShape.IsNull() || anAxis.IsNull()) return aSeq._retn();
1574 //Get Shapes On Cylinder
1575 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnCylinderIDs
1576 (aShape, theShapeType, anAxis, theRadius, ShapeState(theState));
1577 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1578 return aSeq._retn();
1580 Standard_Integer aLength = aHSeq->Length();
1581 aSeq->length(aLength);
1582 for (Standard_Integer i = 1; i <= aLength; i++)
1583 aSeq[i-1] = aHSeq->Value(i);
1585 return aSeq._retn();
1588 //=============================================================================
1590 * GetShapesOnCylinderWithLocationIDs
1592 //=============================================================================
1593 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnCylinderWithLocationIDs
1594 (GEOM::GEOM_Object_ptr theShape,
1595 const CORBA::Long theShapeType,
1596 GEOM::GEOM_Object_ptr theAxis,
1597 GEOM::GEOM_Object_ptr thePnt,
1598 const CORBA::Double theRadius,
1599 const GEOM::shape_state theState)
1601 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1603 //Set a not done flag
1604 GetOperations()->SetNotDone();
1606 //Get the reference objects
1607 HANDLE_NAMESPACE(GEOM_Object) aShape = GetObjectImpl(theShape);
1608 HANDLE_NAMESPACE(GEOM_Object) anAxis = GetObjectImpl(theAxis);
1609 HANDLE_NAMESPACE(GEOM_Object) aPnt = GetObjectImpl(thePnt);
1611 if (aShape.IsNull() || anAxis.IsNull() || aPnt.IsNull()) return aSeq._retn();
1613 //Get Shapes On Cylinder
1614 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnCylinderWithLocationIDs
1615 (aShape, theShapeType, anAxis, aPnt, theRadius, ShapeState(theState));
1616 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1617 return aSeq._retn();
1619 Standard_Integer aLength = aHSeq->Length();
1620 aSeq->length(aLength);
1621 for (Standard_Integer i = 1; i <= aLength; i++)
1622 aSeq[i-1] = aHSeq->Value(i);
1624 return aSeq._retn();
1627 //=============================================================================
1629 * GetShapesOnSphereIDs
1631 //=============================================================================
1632 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnSphereIDs
1633 (GEOM::GEOM_Object_ptr theShape,
1634 const CORBA::Long theShapeType,
1635 GEOM::GEOM_Object_ptr theCenter,
1636 const CORBA::Double theRadius,
1637 const GEOM::shape_state theState)
1639 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1641 //Set a not done flag
1642 GetOperations()->SetNotDone();
1644 //Get the reference objects
1645 HANDLE_NAMESPACE(GEOM_Object) aShape = GetObjectImpl(theShape);
1646 HANDLE_NAMESPACE(GEOM_Object) aCenter = GetObjectImpl(theCenter);
1648 if (aShape.IsNull() || aCenter.IsNull()) return aSeq._retn();
1650 //Get Shapes On Sphere
1651 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnSphereIDs
1652 (aShape, theShapeType, aCenter, theRadius, ShapeState(theState));
1653 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1654 return aSeq._retn();
1656 Standard_Integer aLength = aHSeq->Length();
1657 aSeq->length(aLength);
1658 for (Standard_Integer i = 1; i <= aLength; i++)
1659 aSeq[i-1] = aHSeq->Value(i);
1661 return aSeq._retn();
1664 //=============================================================================
1666 * GetShapesOnQuadrangleIDs
1668 //=============================================================================
1669 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnQuadrangleIDs
1670 (GEOM::GEOM_Object_ptr theShape,
1671 CORBA::Long theShapeType,
1672 GEOM::GEOM_Object_ptr theTopLeftPoint,
1673 GEOM::GEOM_Object_ptr theTopRigthPoint,
1674 GEOM::GEOM_Object_ptr theBottomLeftPoint,
1675 GEOM::GEOM_Object_ptr theBottomRigthPoint,
1676 GEOM::shape_state theState)
1678 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1680 //Set a not done flag
1681 GetOperations()->SetNotDone();
1683 //Get the reference objects
1684 HANDLE_NAMESPACE(GEOM_Object) aShape = GetObjectImpl(theShape);
1685 HANDLE_NAMESPACE(GEOM_Object) aTopLeftPoint = GetObjectImpl(theTopLeftPoint);
1686 HANDLE_NAMESPACE(GEOM_Object) aTopRigthPoint = GetObjectImpl(theTopRigthPoint);
1687 HANDLE_NAMESPACE(GEOM_Object) aBottomLeftPoint = GetObjectImpl(theBottomLeftPoint);
1688 HANDLE_NAMESPACE(GEOM_Object) aBottomRigthPoint = GetObjectImpl(theBottomRigthPoint);
1690 if (aShape.IsNull() ||
1691 aTopLeftPoint.IsNull() ||
1692 aTopRigthPoint.IsNull() ||
1693 aBottomLeftPoint.IsNull() ||
1694 aBottomRigthPoint.IsNull() )
1695 return aSeq._retn();
1697 //Get Shapes On Quadrangle
1698 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnQuadrangleIDs
1699 (aShape, theShapeType,
1700 aTopLeftPoint, aTopRigthPoint, aBottomLeftPoint, aBottomRigthPoint,
1701 ShapeState(theState));
1702 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1703 return aSeq._retn();
1705 Standard_Integer aLength = aHSeq->Length();
1706 aSeq->length(aLength);
1707 for (Standard_Integer i = 1; i <= aLength; i++)
1708 aSeq[i-1] = aHSeq->Value(i);
1710 return aSeq._retn();
1713 //=============================================================================
1717 //=============================================================================
1718 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnBox
1719 (GEOM::GEOM_Object_ptr theBox,
1720 GEOM::GEOM_Object_ptr theShape,
1721 CORBA::Long theShapeType,
1722 GEOM::shape_state theState)
1724 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1726 //Set a not done flag
1727 GetOperations()->SetNotDone();
1729 //Get the reference objects
1730 HANDLE_NAMESPACE(GEOM_Object) aShape = GetObjectImpl(theShape);
1731 HANDLE_NAMESPACE(GEOM_Object) aBox = GetObjectImpl(theBox);
1733 if (aShape.IsNull() || aBox.IsNull() )
1734 return aSeq._retn();
1737 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnBox
1738 (aBox,aShape, theShapeType,ShapeState(theState));
1739 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1740 return aSeq._retn();
1742 Standard_Integer aLength = aHSeq->Length();
1743 aSeq->length(aLength);
1744 for (Standard_Integer i = 1; i <= aLength; i++)
1745 aSeq[i-1] = GetObject(HANDLE_NAMESPACE(GEOM_Object)::DownCast(aHSeq->Value(i)));
1747 return aSeq._retn();
1750 //=============================================================================
1752 * GetShapesOnQuadrangleIDs
1754 //=============================================================================
1755 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnBoxIDs
1756 (GEOM::GEOM_Object_ptr theBox,
1757 GEOM::GEOM_Object_ptr theShape,
1758 CORBA::Long theShapeType,
1759 GEOM::shape_state theState)
1761 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1763 //Set a not done flag
1764 GetOperations()->SetNotDone();
1766 //Get the reference objects
1767 HANDLE_NAMESPACE(GEOM_Object) aShape = GetObjectImpl(theShape);
1768 HANDLE_NAMESPACE(GEOM_Object) aBox = GetObjectImpl(theBox);
1770 if (aShape.IsNull() || aBox.IsNull() )
1771 return aSeq._retn();
1774 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnBoxIDs
1775 (aBox,aShape, theShapeType,ShapeState(theState));
1776 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1777 return aSeq._retn();
1779 Standard_Integer aLength = aHSeq->Length();
1780 aSeq->length(aLength);
1781 for (Standard_Integer i = 1; i <= aLength; i++)
1782 aSeq[i-1] = aHSeq->Value(i);
1784 return aSeq._retn();
1788 //=============================================================================
1792 //=============================================================================
1793 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnShape
1794 (GEOM::GEOM_Object_ptr theCheckShape,
1795 GEOM::GEOM_Object_ptr theShape,
1796 CORBA::Short theShapeType,
1797 GEOM::shape_state theState)
1799 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1801 //Set a not done flag
1802 GetOperations()->SetNotDone();
1804 //Get the reference objects
1805 HANDLE_NAMESPACE(GEOM_Object) aShape = GetObjectImpl(theShape);
1806 HANDLE_NAMESPACE(GEOM_Object) aCheckShape = GetObjectImpl(theCheckShape);
1808 if (aShape.IsNull() || aCheckShape.IsNull() )
1809 return aSeq._retn();
1811 //Get Shapes On Shape
1812 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnShape
1813 (aCheckShape,aShape, theShapeType,ShapeState(theState));
1815 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1816 return aSeq._retn();
1818 Standard_Integer aLength = aHSeq->Length();
1819 aSeq->length(aLength);
1820 for (Standard_Integer i = 1; i <= aLength; i++)
1821 aSeq[i-1] = GetObject(HANDLE_NAMESPACE(GEOM_Object)::DownCast(aHSeq->Value(i)));
1823 return aSeq._retn();
1827 //=============================================================================
1829 * GetShapesOnShapeAsCompound
1831 //=============================================================================
1832 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetShapesOnShapeAsCompound
1833 (GEOM::GEOM_Object_ptr theCheckShape,
1834 GEOM::GEOM_Object_ptr theShape,
1835 CORBA::Short theShapeType,
1836 GEOM::shape_state theState)
1838 GEOM::GEOM_Object_var aGEOMObject;
1840 //Set a not done flag
1841 GetOperations()->SetNotDone();
1843 //Get the reference objects
1844 HANDLE_NAMESPACE(GEOM_Object) aShape = GetObjectImpl(theShape);
1845 HANDLE_NAMESPACE(GEOM_Object) aCheckShape = GetObjectImpl(theCheckShape);
1847 if (aShape.IsNull() || aCheckShape.IsNull() )
1848 return aGEOMObject._retn();
1850 //Get Shapes On Shape
1851 HANDLE_NAMESPACE(GEOM_Object) anObject = GetOperations()->GetShapesOnShapeAsCompound
1852 (aCheckShape,aShape, theShapeType,ShapeState(theState));
1854 if (anObject.IsNull())
1855 return aGEOMObject._retn();
1857 return GetObject(anObject);
1861 //=============================================================================
1863 * GetShapesOnShapeIDs
1865 //=============================================================================
1866 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnShapeIDs
1867 (GEOM::GEOM_Object_ptr theCheckShape,
1868 GEOM::GEOM_Object_ptr theShape,
1869 CORBA::Short theShapeType,
1870 GEOM::shape_state theState)
1872 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
1874 //Set a not done flag
1875 GetOperations()->SetNotDone();
1877 //Get the reference objects
1878 HANDLE_NAMESPACE(GEOM_Object) aShape = GetObjectImpl(theShape);
1879 HANDLE_NAMESPACE(GEOM_Object) aCheckShape = GetObjectImpl(theCheckShape);
1881 if (aShape.IsNull() || aCheckShape.IsNull() )
1882 return aSeq._retn();
1884 //Get Shapes On Shape
1885 Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnShapeIDs
1886 (aCheckShape,aShape, theShapeType,ShapeState(theState));
1887 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1888 return aSeq._retn();
1890 Standard_Integer aLength = aHSeq->Length();
1891 aSeq->length(aLength);
1892 for (Standard_Integer i = 1; i <= aLength; i++)
1893 aSeq[i-1] = aHSeq->Value(i);
1895 return aSeq._retn();
1899 //=============================================================================
1903 //=============================================================================
1904 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlace
1905 (GEOM::GEOM_Object_ptr theShapeWhere,
1906 GEOM::GEOM_Object_ptr theShapeWhat)
1908 GEOM::GEOM_Object_var aGEOMObject;
1910 //Set a not done flag
1911 GetOperations()->SetNotDone();
1913 //Get the reference objects
1914 HANDLE_NAMESPACE(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
1915 HANDLE_NAMESPACE(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
1917 if (aShapeWhere.IsNull() ||
1918 aShapeWhat.IsNull()) return aGEOMObject._retn();
1920 //Get Shapes in place of aShapeWhat
1921 HANDLE_NAMESPACE(GEOM_Object) anObject =
1922 GetOperations()->GetInPlace(aShapeWhere, aShapeWhat);
1923 if (!GetOperations()->IsDone() || anObject.IsNull())
1924 return aGEOMObject._retn();
1926 return GetObject(anObject);
1929 //=============================================================================
1933 //=============================================================================
1934 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlaceOld
1935 (GEOM::GEOM_Object_ptr theShapeWhere,
1936 GEOM::GEOM_Object_ptr theShapeWhat)
1938 GEOM::GEOM_Object_var aGEOMObject;
1940 //Set a not done flag
1941 GetOperations()->SetNotDone();
1943 //Get the reference objects
1944 HANDLE_NAMESPACE(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
1945 HANDLE_NAMESPACE(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
1947 if (aShapeWhere.IsNull() ||
1948 aShapeWhat.IsNull()) return aGEOMObject._retn();
1950 //Get Shapes in place of aShapeWhat
1951 HANDLE_NAMESPACE(GEOM_Object) anObject =
1952 GetOperations()->GetInPlaceOld(aShapeWhere, aShapeWhat);
1953 if (!GetOperations()->IsDone() || anObject.IsNull())
1954 return aGEOMObject._retn();
1956 return GetObject(anObject);
1959 //=============================================================================
1961 * GetInPlaceByHistory
1963 //=============================================================================
1964 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlaceByHistory
1965 (GEOM::GEOM_Object_ptr theShapeWhere,
1966 GEOM::GEOM_Object_ptr theShapeWhat)
1968 GEOM::GEOM_Object_var aGEOMObject;
1970 //Set a not done flag
1971 GetOperations()->SetNotDone();
1973 //Get the reference objects
1974 HANDLE_NAMESPACE(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
1975 HANDLE_NAMESPACE(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
1977 if (aShapeWhere.IsNull() ||
1978 aShapeWhat.IsNull()) return aGEOMObject._retn();
1980 //Get Shapes in place of aShapeWhat
1981 HANDLE_NAMESPACE(GEOM_Object) anObject =
1982 GetOperations()->GetInPlaceByHistory(aShapeWhere, aShapeWhat);
1983 if (!GetOperations()->IsDone() || anObject.IsNull())
1984 return aGEOMObject._retn();
1986 return GetObject(anObject);
1989 //=============================================================================
1993 //=============================================================================
1994 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetSame
1995 (GEOM::GEOM_Object_ptr theShapeWhere,
1996 GEOM::GEOM_Object_ptr theShapeWhat)
1998 GEOM::GEOM_Object_var aGEOMObject;
2000 //Set a not done flag
2001 GetOperations()->SetNotDone();
2003 //Get the reference objects
2004 HANDLE_NAMESPACE(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
2005 HANDLE_NAMESPACE(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
2007 if (aShapeWhere.IsNull() ||
2008 aShapeWhat.IsNull()) return aGEOMObject._retn();
2010 //Get Shapes in place of aShapeWhat
2011 HANDLE_NAMESPACE(GEOM_Object) anObject =
2012 GetOperations()->GetSame(aShapeWhere, aShapeWhat);
2013 if (!GetOperations()->IsDone() || anObject.IsNull())
2014 return aGEOMObject._retn();
2016 return GetObject(anObject);
2019 //=============================================================================
2023 //=============================================================================
2024 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetSameIDs
2025 (GEOM::GEOM_Object_ptr theShapeWhere,
2026 GEOM::GEOM_Object_ptr theShapeWhat) {
2027 GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
2029 //Get the reference objects
2030 HANDLE_NAMESPACE(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
2031 HANDLE_NAMESPACE(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
2033 if (aShapeWhere.IsNull() ||
2034 aShapeWhat.IsNull()) return aSeq._retn();
2037 Handle(TColStd_HSequenceOfInteger) aHSeq =
2038 GetOperations()->GetSameIDs(aShapeWhere, aShapeWhat);
2040 if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
2042 Standard_Integer aLength = aHSeq->Length();
2043 aSeq->length(aLength);
2044 for (Standard_Integer i = 1; i <= aLength; i++)
2045 aSeq[i-1] = aHSeq->Value(i);
2047 return aSeq._retn();
2050 //=============================================================================
2054 //=============================================================================
2055 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::ExtendEdge
2056 (GEOM::GEOM_Object_ptr theEdge,
2057 CORBA::Double theMin,
2058 CORBA::Double theMax)
2060 GEOM::GEOM_Object_var aGEOMObject;
2062 //Set a not done flag
2063 GetOperations()->SetNotDone();
2065 //Get the reference objects
2066 HANDLE_NAMESPACE(GEOM_Object) anEdge = GetObjectImpl(theEdge);
2068 if (anEdge.IsNull()) {
2069 return aGEOMObject._retn();
2072 //Get Shapes in place of aShapeWhat
2073 HANDLE_NAMESPACE(GEOM_Object) aNewEdge =
2074 GetOperations()->ExtendEdge(anEdge, theMin, theMax);
2076 if (!GetOperations()->IsDone() || aNewEdge.IsNull()) {
2077 return aGEOMObject._retn();
2080 return GetObject(aNewEdge);
2083 //=============================================================================
2087 //=============================================================================
2088 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::ExtendFace
2089 (GEOM::GEOM_Object_ptr theFace,
2090 CORBA::Double theUMin,
2091 CORBA::Double theUMax,
2092 CORBA::Double theVMin,
2093 CORBA::Double theVMax)
2095 GEOM::GEOM_Object_var aGEOMObject;
2097 //Set a not done flag
2098 GetOperations()->SetNotDone();
2100 //Get the reference objects
2101 HANDLE_NAMESPACE(GEOM_Object) aFace = GetObjectImpl(theFace);
2103 if (aFace.IsNull()) {
2104 return aGEOMObject._retn();
2107 //Get Shapes in place of aShapeWhat
2108 HANDLE_NAMESPACE(GEOM_Object) aNewFace =
2109 GetOperations()->ExtendFace(aFace, theUMin, theUMax, theVMin, theVMax);
2111 if (!GetOperations()->IsDone() || aNewFace.IsNull()) {
2112 return aGEOMObject._retn();
2115 return GetObject(aNewFace);
2118 //=============================================================================
2120 * MakeSurfaceFromFace
2122 //=============================================================================
2123 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeSurfaceFromFace
2124 (GEOM::GEOM_Object_ptr theFace)
2126 GEOM::GEOM_Object_var aGEOMObject;
2128 //Set a not done flag
2129 GetOperations()->SetNotDone();
2131 //Get the reference object
2132 HANDLE_NAMESPACE(GEOM_Object) aFace = GetObjectImpl(theFace);
2134 if (aFace.IsNull()) {
2135 return aGEOMObject._retn();
2138 //Get Shapes in place of aShapeWhat
2139 HANDLE_NAMESPACE(GEOM_Object) aNewFace = GetOperations()->MakeSurfaceFromFace(aFace);
2141 if (!GetOperations()->IsDone() || aNewFace.IsNull()) {
2142 return aGEOMObject._retn();
2145 return GetObject(aNewFace);
2148 //=============================================================================
2150 * GetSubShapeEdgeSorted
2152 //=============================================================================
2153 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSubShapeEdgeSorted
2154 (GEOM::GEOM_Object_ptr theShape,
2155 GEOM::GEOM_Object_ptr theStartPoint)
2157 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
2159 //Set a not done flag
2160 GetOperations()->SetNotDone();
2162 //Get the reference objects
2163 HANDLE_NAMESPACE(GEOM_Object) aShape = GetObjectImpl(theShape);
2164 HANDLE_NAMESPACE(GEOM_Object) aStartPoint = GetObjectImpl(theStartPoint);
2166 if (aShape.IsNull() || aStartPoint.IsNull()) {
2167 return aSeq._retn();
2170 //Get Shapes On Shape
2171 Handle(TColStd_HSequenceOfTransient) aHSeq =
2172 GetOperations()->GetSubShapeEdgeSorted(aShape, aStartPoint);
2174 if (!GetOperations()->IsDone() || aHSeq.IsNull())
2175 return aSeq._retn();
2177 const Standard_Integer aLength = aHSeq->Length();
2180 aSeq->length(aLength);
2182 for (i = 1; i <= aLength; i++) {
2183 aSeq[i-1] = GetObject(HANDLE_NAMESPACE(GEOM_Object)::DownCast(aHSeq->Value(i)));
2186 return aSeq._retn();
2189 //=============================================================================
2191 * GetSubShapesWithTolerance
2193 //=============================================================================
2194 GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSubShapesWithTolerance
2195 (GEOM::GEOM_Object_ptr theShape,
2196 CORBA::Short theShapeType,
2197 GEOM::comparison_condition theCondition,
2198 CORBA::Double theTolerance)
2200 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
2202 //Set a not done flag
2203 GetOperations()->SetNotDone();
2205 //Get the reference objects
2206 HANDLE_NAMESPACE(GEOM_Object) aShape = GetObjectImpl(theShape);
2208 if (aShape.IsNull()) {
2209 return aSeq._retn();
2212 //Get Shapes On Shape
2213 const GEOMUtils::ComparisonCondition aCondition =
2214 ComparisonCondition(theCondition);
2215 Handle(TColStd_HSequenceOfTransient) aHSeq =
2216 GetOperations()->GetSubShapesWithTolerance
2217 (aShape, theShapeType, aCondition, theTolerance);
2219 if (!GetOperations()->IsDone() || aHSeq.IsNull())
2220 return aSeq._retn();
2222 const Standard_Integer aLength = aHSeq->Length();
2225 aSeq->length(aLength);
2227 for (i = 1; i <= aLength; i++) {
2228 aSeq[i-1] = GetObject(HANDLE_NAMESPACE(GEOM_Object)::DownCast(aHSeq->Value(i)));
2231 return aSeq._retn();
2234 //=============================================================================
2238 //=============================================================================
2239 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeExtraction
2240 (GEOM::GEOM_Object_ptr theShape,
2241 const GEOM::ListOfLong &theSubShapeIDs,
2242 GEOM::GEOM_IShapesOperations::ExtractionStats_out theStats)
2244 GEOM::GEOM_Object_var aGEOMObject;
2246 //Set a not done flag
2247 theStats = new GEOM::GEOM_IShapesOperations::ExtractionStats;
2248 GetOperations()->SetNotDone();
2250 //Get the reference object
2251 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
2253 if (aShape.IsNull()) {
2254 return aGEOMObject._retn();
2257 const int aNbIDs = theSubShapeIDs.length();
2260 return aGEOMObject._retn();
2264 Handle(TColStd_HArray1OfInteger) anArray =
2265 new TColStd_HArray1OfInteger (1, aNbIDs);
2267 for (i = 0; i < aNbIDs; i++) {
2268 anArray->SetValue(i + 1, theSubShapeIDs[i]);
2271 //Get Shapes in place of aShapeWhat
2272 std::list<GEOMImpl_IShapesOperations::ExtractionStat> aStats;
2273 Handle(GEOM_Object) aResult =
2274 GetOperations()->MakeExtraction(aShape, anArray, aStats);
2276 if (!GetOperations()->IsDone() || aResult.IsNull()) {
2277 return aGEOMObject._retn();
2280 // Convert statistics.
2281 const int aNbStats = aStats.size();
2283 theStats->length(aNbStats);
2285 // fill the local CORBA array with values from lists
2286 std::list<GEOMImpl_IShapesOperations::ExtractionStat>::const_iterator
2287 anIt = aStats.begin();
2289 for (i = 0; anIt != aStats.end(); i++, anIt++) {
2290 GEOM::GEOM_IShapesOperations::ExtractionStat_var aResStat =
2291 new GEOM::GEOM_IShapesOperations::ExtractionStat;
2294 switch (anIt->type) {
2295 case GEOMImpl_IShapesOperations::EST_Removed:
2296 aResStat->type = GEOM::GEOM_IShapesOperations::EST_Removed;
2298 case GEOMImpl_IShapesOperations::EST_Modified:
2299 aResStat->type = GEOM::GEOM_IShapesOperations::EST_Modified;
2301 case GEOMImpl_IShapesOperations::EST_Added:
2302 aResStat->type = GEOM::GEOM_IShapesOperations::EST_Added;
2308 // Copy the list of IDs
2309 std::list<Standard_Integer> aIDList = anIt->indices;
2310 GEOM::ListOfLong_var aResIDList = new GEOM::ListOfLong;
2312 aResIDList->length(aIDList.size());
2314 std::list<Standard_Integer>::iterator anIDIt = aIDList.begin();
2317 for (; anIDIt != aIDList.end(); j++, anIDIt++) {
2318 aResIDList[j] = *anIDIt;
2321 aResStat->indices = aResIDList;
2323 theStats[(_CORBA_ULong)i] = aResStat;
2326 return GetObject(aResult);