+
+//=============================================================================
+/*!
+ * ExtendEdge
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::ExtendEdge
+ (GEOM::GEOM_Object_ptr theEdge,
+ CORBA::Double theMin,
+ CORBA::Double theMax)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Get the reference objects
+ Handle(::GEOM_Object) anEdge = GetObjectImpl(theEdge);
+
+ if (anEdge.IsNull()) {
+ return aGEOMObject._retn();
+ }
+
+ //Get Shapes in place of aShapeWhat
+ Handle(::GEOM_Object) aNewEdge =
+ GetOperations()->ExtendEdge(anEdge, theMin, theMax);
+
+ if (!GetOperations()->IsDone() || aNewEdge.IsNull()) {
+ return aGEOMObject._retn();
+ }
+
+ return GetObject(aNewEdge);
+}
+
+//=============================================================================
+/*!
+ * ExtendFace
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::ExtendFace
+ (GEOM::GEOM_Object_ptr theFace,
+ CORBA::Double theUMin,
+ CORBA::Double theUMax,
+ CORBA::Double theVMin,
+ CORBA::Double theVMax)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Get the reference objects
+ Handle(::GEOM_Object) aFace = GetObjectImpl(theFace);
+
+ if (aFace.IsNull()) {
+ return aGEOMObject._retn();
+ }
+
+ //Get Shapes in place of aShapeWhat
+ Handle(::GEOM_Object) aNewFace =
+ GetOperations()->ExtendFace(aFace, theUMin, theUMax, theVMin, theVMax);
+
+ if (!GetOperations()->IsDone() || aNewFace.IsNull()) {
+ return aGEOMObject._retn();
+ }
+
+ return GetObject(aNewFace);
+}
+
+//=============================================================================
+/*!
+ * MakeSurfaceFromFace
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeSurfaceFromFace
+ (GEOM::GEOM_Object_ptr theFace)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Get the reference object
+ Handle(::GEOM_Object) aFace = GetObjectImpl(theFace);
+
+ if (aFace.IsNull()) {
+ return aGEOMObject._retn();
+ }
+
+ //Get Shapes in place of aShapeWhat
+ Handle(::GEOM_Object) aNewFace = GetOperations()->MakeSurfaceFromFace(aFace);
+
+ if (!GetOperations()->IsDone() || aNewFace.IsNull()) {
+ return aGEOMObject._retn();
+ }
+
+ return GetObject(aNewFace);
+}
+
+//=============================================================================
+/*!
+ * GetSubShapeEdgeSorted
+ */
+//=============================================================================
+GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSubShapeEdgeSorted
+ (GEOM::GEOM_Object_ptr theShape,
+ GEOM::GEOM_Object_ptr theStartPoint)
+{
+ GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Get the reference objects
+ Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
+ Handle(::GEOM_Object) aStartPoint = GetObjectImpl(theStartPoint);
+
+ if (aShape.IsNull() || aStartPoint.IsNull()) {
+ return aSeq._retn();
+ }
+
+ //Get Shapes On Shape
+ Handle(TColStd_HSequenceOfTransient) aHSeq =
+ GetOperations()->GetSubShapeEdgeSorted(aShape, aStartPoint);
+
+ if (!GetOperations()->IsDone() || aHSeq.IsNull())
+ return aSeq._retn();
+
+ const Standard_Integer aLength = aHSeq->Length();
+ Standard_Integer i;
+
+ aSeq->length(aLength);
+
+ for (i = 1; i <= aLength; i++) {
+ aSeq[i-1] = GetObject(Handle(::GEOM_Object)::DownCast(aHSeq->Value(i)));
+ }
+
+ return aSeq._retn();
+}
+
+//=============================================================================
+/*!
+ * GetSubShapesWithTolerance
+ */
+//=============================================================================
+GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSubShapesWithTolerance
+ (GEOM::GEOM_Object_ptr theShape,
+ CORBA::Short theShapeType,
+ GEOM::comparison_condition theCondition,
+ CORBA::Double theTolerance)
+{
+ GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Get the reference objects
+ Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
+
+ if (aShape.IsNull()) {
+ return aSeq._retn();
+ }
+
+ //Get Shapes On Shape
+ const GEOMUtils::ComparisonCondition aCondition =
+ ComparisonCondition(theCondition);
+ Handle(TColStd_HSequenceOfTransient) aHSeq =
+ GetOperations()->GetSubShapesWithTolerance
+ (aShape, theShapeType, aCondition, theTolerance);
+
+ if (!GetOperations()->IsDone() || aHSeq.IsNull())
+ return aSeq._retn();
+
+ const Standard_Integer aLength = aHSeq->Length();
+ Standard_Integer i;
+
+ aSeq->length(aLength);
+
+ for (i = 1; i <= aLength; i++) {
+ aSeq[i-1] = GetObject(Handle(::GEOM_Object)::DownCast(aHSeq->Value(i)));
+ }
+
+ return aSeq._retn();
+}
+
+//=============================================================================
+/*!
+ * MakeExtraction
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeExtraction
+ (GEOM::GEOM_Object_ptr theShape,
+ const GEOM::ListOfLong &theSubShapeIDs,
+ GEOM::GEOM_IShapesOperations::ExtractionStats_out theStats)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Set a not done flag
+ theStats = new GEOM::GEOM_IShapesOperations::ExtractionStats;
+ GetOperations()->SetNotDone();
+
+ //Get the reference object
+ Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
+
+ if (aShape.IsNull()) {
+ return aGEOMObject._retn();
+ }
+
+ const int aNbIDs = theSubShapeIDs.length();
+
+ if (aNbIDs == 0) {
+ return aGEOMObject._retn();
+ }
+
+ int i;
+ Handle(TColStd_HArray1OfInteger) anArray =
+ new TColStd_HArray1OfInteger (1, aNbIDs);
+
+ for (i = 0; i < aNbIDs; i++) {
+ anArray->SetValue(i + 1, theSubShapeIDs[i]);
+ }
+
+ //Get Shapes in place of aShapeWhat
+ std::list<GEOMImpl_IShapesOperations::ExtractionStat> aStats;
+ Handle(GEOM_Object) aResult =
+ GetOperations()->MakeExtraction(aShape, anArray, aStats);
+
+ if (!GetOperations()->IsDone() || aResult.IsNull()) {
+ return aGEOMObject._retn();
+ }
+
+ // Convert statistics.
+ const int aNbStats = aStats.size();
+
+ theStats->length(aNbStats);
+
+ // fill the local CORBA array with values from lists
+ std::list<GEOMImpl_IShapesOperations::ExtractionStat>::const_iterator
+ anIt = aStats.begin();
+
+ for (i = 0; anIt != aStats.end(); i++, anIt++) {
+ GEOM::GEOM_IShapesOperations::ExtractionStat_var aResStat =
+ new GEOM::GEOM_IShapesOperations::ExtractionStat;
+
+ // Copy type
+ switch (anIt->type) {
+ case GEOMImpl_IShapesOperations::EST_Removed:
+ aResStat->type = GEOM::GEOM_IShapesOperations::EST_Removed;
+ break;
+ case GEOMImpl_IShapesOperations::EST_Modified:
+ aResStat->type = GEOM::GEOM_IShapesOperations::EST_Modified;
+ break;
+ case GEOMImpl_IShapesOperations::EST_Added:
+ aResStat->type = GEOM::GEOM_IShapesOperations::EST_Added;
+ break;
+ default:
+ break;
+ }
+
+ // Copy the list of IDs
+ std::list<Standard_Integer> aIDList = anIt->indices;
+ GEOM::ListOfLong_var aResIDList = new GEOM::ListOfLong;
+
+ aResIDList->length(aIDList.size());
+
+ std::list<Standard_Integer>::iterator anIDIt = aIDList.begin();
+ int j = 0;
+
+ for (; anIDIt != aIDList.end(); j++, anIDIt++) {
+ aResIDList[j] = *anIDIt;
+ }
+
+ aResStat->indices = aResIDList;
+
+ theStats[(_CORBA_ULong)i] = aResStat;
+ }
+
+ return GetObject(aResult);
+}