-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include "GEOM_Engine.hxx"
#include "GEOM_Object.hxx"
+#include <TopAbs.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
#include <TColStd_HArray1OfInteger.hxx>
*/
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeWire
- (const GEOM::ListOfGO& theEdgesAndWires)
+ (const GEOM::ListOfGO& theEdgesAndWires,
+ const CORBA::Double theTolerance)
{
GEOM::GEOM_Object_var aGEOMObject;
GetOperations()->SetNotDone();
int ind, aLen;
- list<Handle(GEOM_Object)> aShapes;
+ std::list<Handle(GEOM_Object)> aShapes;
//Get the shapes
aLen = theEdgesAndWires.length();
// Make Solid
Handle(GEOM_Object) anObject =
- GetOperations()->MakeWire(aShapes);
+ GetOperations()->MakeWire(aShapes, theTolerance);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
GetOperations()->SetNotDone();
int ind, aLen;
- list<Handle(GEOM_Object)> aShapes;
+ std::list<Handle(GEOM_Object)> aShapes;
//Get the shapes
aLen = theWires.length();
GetOperations()->SetNotDone();
int ind, aLen;
- list<Handle(GEOM_Object)> aShapes;
+ std::list<Handle(GEOM_Object)> aShapes;
//Get the shapes
aLen = theFacesAndShells.length();
Handle(GEOM_Object) aShell = GetObjectImpl(theShell);
if (aShell.IsNull()) return aGEOMObject._retn();
+ std::list<Handle(GEOM_Object)> aShapes;
+ aShapes.push_back(aShell);
+
//Create the Solid
- Handle(GEOM_Object) anObject = GetOperations()->MakeSolidShell(aShell);
+ Handle(GEOM_Object) anObject = GetOperations()->MakeSolidShells(aShapes);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
GetOperations()->SetNotDone();
int ind, aLen;
- list<Handle(GEOM_Object)> aShapes;
+ std::list<Handle(GEOM_Object)> aShapes;
//Get the shapes
aLen = theShells.length();
GetOperations()->SetNotDone();
int ind, aLen;
- list<Handle(GEOM_Object)> aShapes;
+ std::list<Handle(GEOM_Object)> aShapes;
//Get the shapes
aLen = theShapes.length();
if (aShape.IsNull()) return aGEOMObject._retn();
int ind, aLen;
- list<Handle(GEOM_Object)> aFaces;
+ std::list<Handle(GEOM_Object)> aFaces;
//Get the shapes
aLen = theFaces.length();
for (ind = 0; ind < aLen; ind++) {
return GetObject(anObject);
}
+//=============================================================================
+/*!
+ * GetExistingSubObjects
+ */
+//=============================================================================
+GEOM::ListOfGO* GEOM_IShapesOperations_i::GetExistingSubObjects (GEOM::GEOM_Object_ptr theShape,
+ CORBA::Boolean theGroupsOnly)
+{
+ GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
+
+ Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
+ if (aShape.IsNull()) return aSeq._retn();
+
+ Handle(TColStd_HSequenceOfTransient) aHSeq =
+ GetOperations()->GetExistingSubObjects(aShape, theGroupsOnly);
+ if (!GetOperations()->IsDone() || aHSeq.IsNull())
+ return aSeq._retn();
+
+ Standard_Integer aLength = aHSeq->Length();
+ aSeq->length(aLength);
+ for (Standard_Integer i = 1; i <= aLength; i++)
+ aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
+
+ return aSeq._retn();
+}
//=============================================================================
/*!
//=============================================================================
CORBA::Long GEOM_IShapesOperations_i::NumberOfFaces (GEOM::GEOM_Object_ptr theShape)
{
- Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
- if (aShape.IsNull()) return -1;
-
- CORBA::Long aNb = GetOperations()->NumberOfFaces(aShape);
- if (!GetOperations()->IsDone()) return -1;
-
- return aNb;
+ return NumberOfSubShapes(theShape, Standard_Integer(TopAbs_FACE));
}
//=============================================================================
*/
//=============================================================================
CORBA::Long GEOM_IShapesOperations_i::NumberOfEdges (GEOM::GEOM_Object_ptr theShape)
+{
+ return NumberOfSubShapes(theShape, Standard_Integer(TopAbs_EDGE));
+}
+
+//=============================================================================
+/*!
+ * NumberOfSubShapes
+ */
+//=============================================================================
+CORBA::Long GEOM_IShapesOperations_i::NumberOfSubShapes (GEOM::GEOM_Object_ptr theShape,
+ const CORBA::Long theShapeType)
{
Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
if (aShape.IsNull()) return -1;
- CORBA::Long aNb = GetOperations()->NumberOfEdges(aShape);
+ CORBA::Long aNb = GetOperations()->NumberOfSubShapes(aShape, theShapeType);
if (!GetOperations()->IsDone()) return -1;
return aNb;
return aSeq._retn();
}
+//=============================================================================
+/*!
+ * GetShapesOnCylinderWithLocation
+ */
+//=============================================================================
+GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnCylinderWithLocation
+ (GEOM::GEOM_Object_ptr theShape,
+ const CORBA::Long theShapeType,
+ GEOM::GEOM_Object_ptr theAxis,
+ GEOM::GEOM_Object_ptr thePnt,
+ const CORBA::Double theRadius,
+ const GEOM::shape_state theState)
+{
+ 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) anAxis = GetObjectImpl(theAxis);
+ Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
+
+ if (aShape.IsNull() || anAxis.IsNull() || aPnt.IsNull()) return aSeq._retn();
+
+ //Get Shapes On Cylinder
+ Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnCylinderWithLocation
+ (aShape, theShapeType, anAxis, aPnt, theRadius, ShapeState(theState));
+ if (!GetOperations()->IsDone() || aHSeq.IsNull())
+ return aSeq._retn();
+
+ Standard_Integer aLength = aHSeq->Length();
+ aSeq->length(aLength);
+ for (Standard_Integer i = 1; i <= aLength; i++)
+ aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
+
+ return aSeq._retn();
+}
+
//=============================================================================
/*!
* GetShapesOnSphere
return aSeq._retn();
}
+//=============================================================================
+/*!
+ * GetShapesOnCylinderWithLocationIDs
+ */
+//=============================================================================
+GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnCylinderWithLocationIDs
+ (GEOM::GEOM_Object_ptr theShape,
+ const CORBA::Long theShapeType,
+ GEOM::GEOM_Object_ptr theAxis,
+ GEOM::GEOM_Object_ptr thePnt,
+ const CORBA::Double theRadius,
+ const GEOM::shape_state theState)
+{
+ GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Get the reference objects
+ Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
+ Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
+ Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
+
+ if (aShape.IsNull() || anAxis.IsNull() || aPnt.IsNull()) return aSeq._retn();
+
+ //Get Shapes On Cylinder
+ Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnCylinderWithLocationIDs
+ (aShape, theShapeType, anAxis, aPnt, theRadius, ShapeState(theState));
+ if (!GetOperations()->IsDone() || aHSeq.IsNull())
+ return aSeq._retn();
+
+ Standard_Integer aLength = aHSeq->Length();
+ aSeq->length(aLength);
+ for (Standard_Integer i = 1; i <= aLength; i++)
+ aSeq[i-1] = aHSeq->Value(i);
+
+ return aSeq._retn();
+}
+
//=============================================================================
/*!
* GetShapesOnSphereIDs