Salome HOME
PAL10015. Implement GetShapesOnQuadrangle()
authoreap <eap@opencascade.com>
Fri, 14 Oct 2005 13:01:47 +0000 (13:01 +0000)
committereap <eap@opencascade.com>
Fri, 14 Oct 2005 13:01:47 +0000 (13:01 +0000)
src/GEOM_I/GEOM_IShapesOperations_i.cc
src/GEOM_I/GEOM_IShapesOperations_i.hh

index db449595693736f01b7b73d9ac4063b6346b05f4..20252af31241f3d56290a31ccf3aa4c7d8f3b5fc 100644 (file)
@@ -699,6 +699,67 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnSphere
   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() ||
+      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
@@ -821,6 +882,67 @@ GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnSphereIDs
   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();
+}
+
 //=============================================================================
 /*!
  *  GetInPlace
index 295e9d4627e40dd430961248927989437292344f..af020c0b6afea55f55e2591c20d1b9a2fec9d039 100644 (file)
@@ -41,18 +41,18 @@ class GEOM_IShapesOperations_i :
   GEOM::GEOM_Object_ptr MakeCompound (const GEOM::ListOfGO& theShapes);
 
   GEOM::GEOM_Object_ptr MakeGlueFaces (GEOM::GEOM_Object_ptr theShape,
-                                      CORBA::Double   theTolerance);
+                                      CORBA::Double         theTolerance);
 
   GEOM::ListOfGO* MakeExplode (GEOM::GEOM_Object_ptr theShape,
-                              CORBA::Long     theShapeType,
+                              CORBA::Long           theShapeType,
                               CORBA::Boolean  isSorted);
 
   GEOM::ListOfLong* SubShapeAllIDs (GEOM::GEOM_Object_ptr theShape,
-                                   CORBA::Long     theShapeType,
+                                   CORBA::Long           theShapeType,
                                    CORBA::Boolean  isSorted);
 
   GEOM::GEOM_Object_ptr GetSubShape (GEOM::GEOM_Object_ptr theMainShape,
-                                    CORBA::Long     theID);
+                                    CORBA::Long           theID);
 
   CORBA::Long NumberOfFaces (GEOM::GEOM_Object_ptr theShape);
   CORBA::Long NumberOfEdges (GEOM::GEOM_Object_ptr theShape);
@@ -63,41 +63,57 @@ class GEOM_IShapesOperations_i :
 
   GEOM::ListOfGO* GetSharedShapes (GEOM::GEOM_Object_ptr theShape1,
                                   GEOM::GEOM_Object_ptr theShape2,
-                                  CORBA::Long     theShapeType);
-
-  GEOM::ListOfGO* GetShapesOnPlane (GEOM::GEOM_Object_ptr   theShape,
-                                   CORBA::Long       theShapeType,
-                                   GEOM::GEOM_Object_ptr   theAx1,
-                                   GEOM::shape_state theState);
-
-  GEOM::ListOfGO* GetShapesOnCylinder (GEOM::GEOM_Object_ptr   theShape,
-                                      CORBA::Long       theShapeType,
-                                      GEOM::GEOM_Object_ptr   theAxis,
-                                      CORBA::Double     theRadius,
-                                      GEOM::shape_state theState);
-
-  GEOM::ListOfGO* GetShapesOnSphere (GEOM::GEOM_Object_ptr   theShape,
-                                    CORBA::Long       theShapeType,
-                                    GEOM::GEOM_Object_ptr   theCenter,
-                                    CORBA::Double     theRadius,
-                                    GEOM::shape_state theState);
-
-  GEOM::ListOfLong* GetShapesOnPlaneIDs (GEOM::GEOM_Object_ptr   theShape,
-                                        CORBA::Long       theShapeType,
-                                        GEOM::GEOM_Object_ptr   theAx1,
-                                        GEOM::shape_state theState);
-
-  GEOM::ListOfLong* GetShapesOnCylinderIDs (GEOM::GEOM_Object_ptr   theShape,
-                                           CORBA::Long       theShapeType,
-                                           GEOM::GEOM_Object_ptr   theAxis,
-                                           CORBA::Double     theRadius,
-                                           GEOM::shape_state theState);
-
-  GEOM::ListOfLong* GetShapesOnSphereIDs (GEOM::GEOM_Object_ptr   theShape,
-                                         CORBA::Long       theShapeType,
-                                         GEOM::GEOM_Object_ptr   theCenter,
-                                         CORBA::Double     theRadius,
-                                         GEOM::shape_state theState);
+                                  CORBA::Long           theShapeType);
+
+  GEOM::ListOfGO* GetShapesOnPlane (GEOM::GEOM_Object_ptr theShape,
+                                   CORBA::Long           theShapeType,
+                                   GEOM::GEOM_Object_ptr theAx1,
+                                   GEOM::shape_state     theState);
+
+  GEOM::ListOfGO* GetShapesOnCylinder (GEOM::GEOM_Object_ptr theShape,
+                                      CORBA::Long           theShapeType,
+                                      GEOM::GEOM_Object_ptr theAxis,
+                                      CORBA::Double         theRadius,
+                                      GEOM::shape_state     theState);
+
+  GEOM::ListOfGO* GetShapesOnSphere (GEOM::GEOM_Object_ptr theShape,
+                                    CORBA::Long           theShapeType,
+                                    GEOM::GEOM_Object_ptr theCenter,
+                                    CORBA::Double         theRadius,
+                                    GEOM::shape_state     theState);
+
+  GEOM::ListOfGO* 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::ListOfLong* GetShapesOnPlaneIDs (GEOM::GEOM_Object_ptr theShape,
+                                        CORBA::Long           theShapeType,
+                                        GEOM::GEOM_Object_ptr theAx1,
+                                        GEOM::shape_state     theState);
+
+  GEOM::ListOfLong* GetShapesOnCylinderIDs (GEOM::GEOM_Object_ptr theShape,
+                                           CORBA::Long           theShapeType,
+                                           GEOM::GEOM_Object_ptr theAxis,
+                                           CORBA::Double         theRadius,
+                                           GEOM::shape_state     theState);
+
+  GEOM::ListOfLong* GetShapesOnSphereIDs (GEOM::GEOM_Object_ptr theShape,
+                                         CORBA::Long           theShapeType,
+                                         GEOM::GEOM_Object_ptr theCenter,
+                                         CORBA::Double         theRadius,
+                                         GEOM::shape_state     theState);
+
+  GEOM::ListOfLong* 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::GEOM_Object_ptr GetInPlace (GEOM::GEOM_Object_ptr theShapeWhere,
                                    GEOM::GEOM_Object_ptr theShapeWhat);