X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGEOM_I%2FGEOM_IShapesOperations_i.cc;h=b9893fd9ca1d3b46fe748b110595a42e893dff9a;hb=611ec94e27c211452a3098d014709d519b954e51;hp=9bfdf7f6b873244366374d2595e7774e34205735;hpb=ca429d817a18d6acc571443f6a596575dee03c2f;p=modules%2Fgeom.git diff --git a/src/GEOM_I/GEOM_IShapesOperations_i.cc b/src/GEOM_I/GEOM_IShapesOperations_i.cc index 9bfdf7f6b..b9893fd9c 100644 --- a/src/GEOM_I/GEOM_IShapesOperations_i.cc +++ b/src/GEOM_I/GEOM_IShapesOperations_i.cc @@ -1,4 +1,23 @@ -using namespace std; +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +#include #include "GEOM_IShapesOperations_i.hh" @@ -419,6 +438,76 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetSubShape return GetObject(anObject); } +//============================================================================= +/*! + * GetSubShapeIndex + */ +//============================================================================= +CORBA::Long GEOM_IShapesOperations_i::GetSubShapeIndex + (GEOM::GEOM_Object_ptr theMainShape, GEOM::GEOM_Object_ptr theSubShape) +{ + if (theMainShape == NULL || theSubShape == NULL) return -1; + + //Get the reference shapes + Handle(GEOM_Object) aMainShapeRef = GetOperations()->GetEngine()->GetObject + (theMainShape->GetStudyID(), theMainShape->GetEntry()); + Handle(GEOM_Object) aSubShapeRef = GetOperations()->GetEngine()->GetObject + (theSubShape->GetStudyID(), theSubShape->GetEntry()); + if (aMainShapeRef.IsNull() || aSubShapeRef.IsNull()) return -1; + + //Get the unique ID of inside + CORBA::Long anID = GetOperations()->GetSubShapeIndex(aMainShapeRef, aSubShapeRef); + if (!GetOperations()->IsDone()) + return -1; + + return anID; +} + +//============================================================================= +/*! + * GetTopologyIndex + */ +//============================================================================= +CORBA::Long GEOM_IShapesOperations_i::GetTopologyIndex + (GEOM::GEOM_Object_ptr theMainShape, GEOM::GEOM_Object_ptr theSubShape) +{ + if (theMainShape == NULL || theSubShape == NULL) return -1; + + //Get the reference shapes + Handle(GEOM_Object) aMainShapeRef = GetOperations()->GetEngine()->GetObject + (theMainShape->GetStudyID(), theMainShape->GetEntry()); + Handle(GEOM_Object) aSubShapeRef = GetOperations()->GetEngine()->GetObject + (theSubShape->GetStudyID(), theSubShape->GetEntry()); + if (aMainShapeRef.IsNull() || aSubShapeRef.IsNull()) return -1; + + //Get an ID of , unique among all sub-shapes of of the same type + CORBA::Long anID = GetOperations()->GetTopologyIndex(aMainShapeRef, aSubShapeRef); + if (!GetOperations()->IsDone()) + return -1; + + return anID; +} + +//============================================================================= +/*! + * GetShapeTypeString + */ +//============================================================================= +char* GEOM_IShapesOperations_i::GetShapeTypeString (GEOM::GEOM_Object_ptr theShape) +{ + if (theShape == NULL) return NULL; + + //Get the reference shape + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + + if (aShape.IsNull()) return NULL; + + // Get shape parameters + TCollection_AsciiString aDescription = GetOperations()->GetShapeTypeString(aShape); + return CORBA::string_dup(aDescription.ToCString()); +} + //============================================================================= /*! * NumberOfFaces @@ -491,6 +580,9 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::ChangeOrientation //============================================================================= GEOM::ListOfLong* GEOM_IShapesOperations_i::GetFreeFacesIDs (GEOM::GEOM_Object_ptr theShape) { + //Set a not done flag + GetOperations()->SetNotDone(); + GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong; if (theShape == NULL) return aSeq._retn(); @@ -519,6 +611,9 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSharedShapes GEOM::GEOM_Object_ptr theShape2, const CORBA::Long theShapeType) { + //Set a not done flag + GetOperations()->SetNotDone(); + GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; if (theShape1 == NULL || theShape2 == NULL) return aSeq._retn(); @@ -544,40 +639,114 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSharedShapes return aSeq._retn(); } +static GEOMAlgo_State ShapeState (const GEOM::shape_state theState) +{ + GEOMAlgo_State aState = GEOMAlgo_ST_UNKNOWN; + + switch (theState) { + case GEOM::ST_ON: + aState = GEOMAlgo_ST_ON; + break; + case GEOM::ST_OUT: + aState = GEOMAlgo_ST_OUT; + break; + case GEOM::ST_ONOUT: + aState = GEOMAlgo_ST_ONOUT; + break; + case GEOM::ST_IN: + aState = GEOMAlgo_ST_IN; + break; + case GEOM::ST_ONIN: + aState = GEOMAlgo_ST_ONIN; + break; + default: + break; + } + + return aState; +} + //============================================================================= /*! * GetShapesOnPlane */ //============================================================================= -GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetShapesOnPlane - (GEOM::GEOM_Object_ptr theShape, - const CORBA::Long theShapeType, - GEOM::GEOM_Object_ptr thePlane) +GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnPlane + (GEOM::GEOM_Object_ptr theShape, + const CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theAx1, + const GEOM::shape_state theState) { - GEOM::GEOM_Object_var aGEOMObject; + GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; //Set a not done flag GetOperations()->SetNotDone(); - if (theShape == NULL || - thePlane == NULL) return aGEOMObject._retn(); + if (theShape == NULL || theAx1 == NULL) return aSeq._retn(); //Get the reference objects Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject (theShape->GetStudyID(), theShape->GetEntry()); - Handle(GEOM_Object) aPlane = GetOperations()->GetEngine()->GetObject - (thePlane->GetStudyID(), thePlane->GetEntry()); + Handle(GEOM_Object) anAx1 = GetOperations()->GetEngine()->GetObject + (theAx1->GetStudyID(), theAx1->GetEntry()); - if (aShape.IsNull() || - aPlane.IsNull()) return aGEOMObject._retn(); + if (aShape.IsNull() || anAx1.IsNull()) return aSeq._retn(); //Get Shapes On Plane - Handle(GEOM_Object) anObject = - GetOperations()->GetShapesOnPlane(aShape, theShapeType, aPlane); - if (!GetOperations()->IsDone() || anObject.IsNull()) - return aGEOMObject._retn(); + Handle(TColStd_HSequenceOfTransient) aHSeq = + GetOperations()->GetShapesOnPlane(aShape, theShapeType, anAx1, ShapeState(theState)); + if (!GetOperations()->IsDone() || aHSeq.IsNull()) + return aSeq._retn(); - return GetObject(anObject); + 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(); +} + +//============================================================================= +/*! + * GetShapesOnPlaneWithLocation + */ +//============================================================================= +GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnPlaneWithLocation + (GEOM::GEOM_Object_ptr theShape, + const CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theAx1, + GEOM::GEOM_Object_ptr thePnt, + const GEOM::shape_state theState) +{ + GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL || theAx1 == NULL || thePnt == NULL) return aSeq._retn(); + + //Get the reference objects + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) anAx1 = GetOperations()->GetEngine()->GetObject + (theAx1->GetStudyID(), theAx1->GetEntry()); + Handle(GEOM_Object) anPnt = GetOperations()->GetEngine()->GetObject + (thePnt->GetStudyID(), thePnt->GetEntry()); + + if (aShape.IsNull() || anAx1.IsNull() || anPnt.IsNull()) return aSeq._retn(); + + //Get Shapes On Plane + Handle(TColStd_HSequenceOfTransient) aHSeq = + GetOperations()->GetShapesOnPlaneWithLocation(aShape, theShapeType, anAx1, anPnt, 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(); } //============================================================================= @@ -585,19 +754,19 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetShapesOnPlane * GetShapesOnCylinder */ //============================================================================= -GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetShapesOnCylinder - (GEOM::GEOM_Object_ptr theShape, - const CORBA::Long theShapeType, - GEOM::GEOM_Object_ptr theAxis, - const CORBA::Double theRadius) +GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnCylinder + (GEOM::GEOM_Object_ptr theShape, + const CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theAxis, + const CORBA::Double theRadius, + const GEOM::shape_state theState) { - GEOM::GEOM_Object_var aGEOMObject; + GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; //Set a not done flag GetOperations()->SetNotDone(); - if (theShape == NULL || - theAxis == NULL) return aGEOMObject._retn(); + if (theShape == NULL || theAxis == NULL) return aSeq._retn(); //Get the reference objects Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject @@ -605,16 +774,20 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetShapesOnCylinder Handle(GEOM_Object) anAxis = GetOperations()->GetEngine()->GetObject (theAxis->GetStudyID(), theAxis->GetEntry()); - if (aShape.IsNull() || - anAxis.IsNull()) return aGEOMObject._retn(); + if (aShape.IsNull() || anAxis.IsNull()) return aSeq._retn(); //Get Shapes On Cylinder - Handle(GEOM_Object) anObject = - GetOperations()->GetShapesOnCylinder(aShape, theShapeType, anAxis, theRadius); - if (!GetOperations()->IsDone() || anObject.IsNull()) - return aGEOMObject._retn(); + Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnCylinder + (aShape, theShapeType, anAxis, theRadius, ShapeState(theState)); + if (!GetOperations()->IsDone() || aHSeq.IsNull()) + return aSeq._retn(); - return GetObject(anObject); + 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(); } //============================================================================= @@ -622,19 +795,19 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetShapesOnCylinder * GetShapesOnSphere */ //============================================================================= -GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetShapesOnSphere - (GEOM::GEOM_Object_ptr theShape, - const CORBA::Long theShapeType, - GEOM::GEOM_Object_ptr theCenter, - const CORBA::Double theRadius) +GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnSphere + (GEOM::GEOM_Object_ptr theShape, + const CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theCenter, + const CORBA::Double theRadius, + const GEOM::shape_state theState) { - GEOM::GEOM_Object_var aGEOMObject; + GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; //Set a not done flag GetOperations()->SetNotDone(); - if (theShape == NULL || - theCenter == NULL) return aGEOMObject._retn(); + if (theShape == NULL || theCenter == NULL) return aSeq._retn(); //Get the reference objects Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject @@ -642,12 +815,422 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetShapesOnSphere Handle(GEOM_Object) aCenter = GetOperations()->GetEngine()->GetObject (theCenter->GetStudyID(), theCenter->GetEntry()); + if (aShape.IsNull() || aCenter.IsNull()) return aSeq._retn(); + + //Get Shapes On Sphere + Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnSphere + (aShape, theShapeType, aCenter, 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(); +} + +//============================================================================= +/*! + * GetShapesOnQuadrangle + */ +//============================================================================= +GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnQuadrangle + (GEOM::GEOM_Object_ptr theShape, + CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theTopLeftPoint, + GEOM::GEOM_Object_ptr theTopRigthPoint, + GEOM::GEOM_Object_ptr theBottomLeftPoint, + GEOM::GEOM_Object_ptr theBottomRigthPoint, + GEOM::shape_state theState) +{ + GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL || + theTopLeftPoint == NULL || + theTopRigthPoint == NULL || + theBottomLeftPoint == NULL || + theBottomRigthPoint == NULL ) + return aSeq._retn(); + + //Get the reference objects + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) aTopLeftPoint = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theTopLeftPoint->GetEntry()); + Handle(GEOM_Object) aTopRigthPoint = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theTopRigthPoint->GetEntry()); + Handle(GEOM_Object) aBottomLeftPoint = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theBottomLeftPoint->GetEntry()); + Handle(GEOM_Object) aBottomRigthPoint = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theBottomRigthPoint->GetEntry()); + if (aShape.IsNull() || - aCenter.IsNull()) return aGEOMObject._retn(); + aTopLeftPoint.IsNull() || + aTopRigthPoint.IsNull() || + aBottomLeftPoint.IsNull() || + aBottomRigthPoint.IsNull() ) + return aSeq._retn(); + + //Get Shapes On Quadrangle + Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnQuadrangle + (aShape, theShapeType, + aTopLeftPoint, aTopRigthPoint, aBottomLeftPoint, aBottomRigthPoint, + 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(); +} + +//============================================================================= +/*! + * GetShapesOnPlaneIDs + */ +//============================================================================= +GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnPlaneIDs + (GEOM::GEOM_Object_ptr theShape, + const CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theAx1, + const GEOM::shape_state theState) +{ + GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL || theAx1 == NULL) return aSeq._retn(); + + //Get the reference objects + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) anAx1 = GetOperations()->GetEngine()->GetObject + (theAx1->GetStudyID(), theAx1->GetEntry()); + + if (aShape.IsNull() || anAx1.IsNull()) return aSeq._retn(); + + //Get Shapes On Plane + Handle(TColStd_HSequenceOfInteger) aHSeq = + GetOperations()->GetShapesOnPlaneIDs(aShape, theShapeType, anAx1, 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(); +} + +//============================================================================= +/*! + * GetShapesOnPlaneWithLocationIDs + */ +//============================================================================= +GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnPlaneWithLocationIDs + (GEOM::GEOM_Object_ptr theShape, + const CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theAx1, + GEOM::GEOM_Object_ptr thePnt, + const GEOM::shape_state theState) +{ + GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL || theAx1 == NULL || thePnt == NULL) return aSeq._retn(); + + //Get the reference objects + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) anAx1 = GetOperations()->GetEngine()->GetObject + (theAx1->GetStudyID(), theAx1->GetEntry()); + Handle(GEOM_Object) anPnt = GetOperations()->GetEngine()->GetObject + (thePnt->GetStudyID(), thePnt->GetEntry()); + + if (aShape.IsNull() || anAx1.IsNull() || anPnt.IsNull()) return aSeq._retn(); + + //Get Shapes On Plane + Handle(TColStd_HSequenceOfInteger) aHSeq = + GetOperations()->GetShapesOnPlaneWithLocationIDs(aShape, theShapeType, anAx1, anPnt, 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(); +} + +//============================================================================= +/*! + * GetShapesOnCylinderIDs + */ +//============================================================================= +GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnCylinderIDs + (GEOM::GEOM_Object_ptr theShape, + const CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theAxis, + const CORBA::Double theRadius, + const GEOM::shape_state theState) +{ + GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL || theAxis == NULL) return aSeq._retn(); + + //Get the reference objects + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) anAxis = GetOperations()->GetEngine()->GetObject + (theAxis->GetStudyID(), theAxis->GetEntry()); + + if (aShape.IsNull() || anAxis.IsNull()) return aSeq._retn(); + + //Get Shapes On Cylinder + Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnCylinderIDs + (aShape, theShapeType, anAxis, 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 + */ +//============================================================================= +GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnSphereIDs + (GEOM::GEOM_Object_ptr theShape, + const CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theCenter, + const CORBA::Double theRadius, + const GEOM::shape_state theState) +{ + GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL || theCenter == NULL) return aSeq._retn(); + + //Get the reference objects + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) aCenter = GetOperations()->GetEngine()->GetObject + (theCenter->GetStudyID(), theCenter->GetEntry()); + + if (aShape.IsNull() || aCenter.IsNull()) return aSeq._retn(); //Get Shapes On Sphere + Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnSphereIDs + (aShape, theShapeType, aCenter, 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(); +} + +//============================================================================= +/*! + * GetShapesOnQuadrangleIDs + */ +//============================================================================= +GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnQuadrangleIDs + (GEOM::GEOM_Object_ptr theShape, + CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theTopLeftPoint, + GEOM::GEOM_Object_ptr theTopRigthPoint, + GEOM::GEOM_Object_ptr theBottomLeftPoint, + GEOM::GEOM_Object_ptr theBottomRigthPoint, + GEOM::shape_state theState) +{ + GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL || + theTopLeftPoint == NULL || + theTopRigthPoint == NULL || + theBottomLeftPoint == NULL || + theBottomRigthPoint == NULL ) + return aSeq._retn(); + + //Get the reference objects + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) aTopLeftPoint = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theTopLeftPoint->GetEntry()); + Handle(GEOM_Object) aTopRigthPoint = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theTopRigthPoint->GetEntry()); + Handle(GEOM_Object) aBottomLeftPoint = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theBottomLeftPoint->GetEntry()); + Handle(GEOM_Object) aBottomRigthPoint = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theBottomRigthPoint->GetEntry()); + + if (aShape.IsNull() || + aTopLeftPoint.IsNull() || + aTopRigthPoint.IsNull() || + aBottomLeftPoint.IsNull() || + aBottomRigthPoint.IsNull() ) + return aSeq._retn(); + + //Get Shapes On Quadrangle + Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnQuadrangleIDs + (aShape, theShapeType, + aTopLeftPoint, aTopRigthPoint, aBottomLeftPoint, aBottomRigthPoint, + 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(); +} + +//============================================================================= +/*! + * GetShapesOnBox + */ +//============================================================================= +GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnBox + (GEOM::GEOM_Object_ptr theBox, + GEOM::GEOM_Object_ptr theShape, + CORBA::Long theShapeType, + GEOM::shape_state theState) +{ + GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if ( theShape == NULL || theBox == NULL ) + return aSeq._retn(); + + //Get the reference objects + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) aBox = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theBox->GetEntry()); + + if (aShape.IsNull() || aBox.IsNull() ) + return aSeq._retn(); + + //Get Shapes On Box + Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnBox + (aBox,aShape, theShapeType,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(); +} + +//============================================================================= +/*! + * GetShapesOnQuadrangleIDs + */ +//============================================================================= +GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnBoxIDs + (GEOM::GEOM_Object_ptr theBox, + GEOM::GEOM_Object_ptr theShape, + CORBA::Long theShapeType, + GEOM::shape_state theState) +{ + GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if ( theShape == NULL || theBox == NULL ) + return aSeq._retn(); + + //Get the reference objects + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) aBox = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theBox->GetEntry()); + + if (aShape.IsNull() || aBox.IsNull() ) + return aSeq._retn(); + + //Get Shapes On Box + Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnBoxIDs + (aBox,aShape, theShapeType,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(); +} + +//============================================================================= +/*! + * GetInPlace + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlace + (GEOM::GEOM_Object_ptr theShapeWhere, + GEOM::GEOM_Object_ptr theShapeWhat) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShapeWhere == NULL || + theShapeWhat == NULL) return aGEOMObject._retn(); + + //Get the reference objects + Handle(GEOM_Object) aShapeWhere = GetOperations()->GetEngine()->GetObject + (theShapeWhere->GetStudyID(), theShapeWhere->GetEntry()); + Handle(GEOM_Object) aShapeWhat = GetOperations()->GetEngine()->GetObject + (theShapeWhat->GetStudyID(), theShapeWhat->GetEntry()); + + if (aShapeWhere.IsNull() || + aShapeWhat.IsNull()) return aGEOMObject._retn(); + + //Get Shapes in place of aShapeWhat Handle(GEOM_Object) anObject = - GetOperations()->GetShapesOnSphere(aShape, theShapeType, aCenter, theRadius); + GetOperations()->GetInPlace(aShapeWhere, aShapeWhat); if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); @@ -656,10 +1239,10 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetShapesOnSphere //============================================================================= /*! - * GetInPlace + * GetSame */ //============================================================================= -GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlace +GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetSame (GEOM::GEOM_Object_ptr theShapeWhere, GEOM::GEOM_Object_ptr theShapeWhat) { @@ -682,9 +1265,10 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlace //Get Shapes in place of aShapeWhat Handle(GEOM_Object) anObject = - GetOperations()->GetInPlace(aShapeWhere, aShapeWhat); + GetOperations()->GetSame(aShapeWhere, aShapeWhat); if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); return GetObject(anObject); } +