]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
0023210: [CEA 1681] Regression with the function GetInPlaceByHistory
authormpa <mpa@opencascade.com>
Mon, 18 Jan 2016 08:00:10 +0000 (11:00 +0300)
committermpa <mpa@opencascade.com>
Mon, 18 Jan 2016 08:00:10 +0000 (11:00 +0300)
idl/GEOM_Gen.idl
src/GEOM_SWIG/geomBuilder.py
src/XAOPlugin/XAOPlugin_IOperations.cxx
src/XAOPlugin/XAOPlugin_IOperations.hxx

index 830fcc3984dfdef42f54e5e4567a932a644e3a86..1e572a79f9deeb3e7273c0cbd96c89989e0461b3 100644 (file)
@@ -2654,7 +2654,8 @@ module GEOM
      *  coincident with \a theShapeWhat or could be a part of it.
      *  \param theShapeWhere Shape to find sub-shapes of.
      *  \param theShapeWhat Shape, specifying what to find.
-     *  \return Group of all found sub-shapes or a single found sub-shape.
+     *  \return Compound which includes all found sub-shapes if they have different types; 
+     *          or group of all found shapes of the equal type; or a single found sub-shape.
      */
     GEOM_Object GetInPlace (in GEOM_Object theShapeWhere,
                             in GEOM_Object theShapeWhat);
@@ -2677,7 +2678,8 @@ module GEOM
      *
      *  \param theShapeWhere Shape to find sub-shapes of.
      *  \param theShapeWhat Shape, specifying what to find.
-     *  \return Group of all found sub-shapes or a single found sub-shape.
+     *  \return Compound which includes all found sub-shapes if they have different types; 
+     *          or group of all found shapes of the equal type; or a single found sub-shape.
      */
     GEOM_Object GetInPlaceByHistory (in GEOM_Object theShapeWhere,
                                      in GEOM_Object theShapeWhat);
index 0f90ef502729c5cd536a1c8c0cf915e1220f8f15..297b3a18ad52b3efd19b0fe2858e9ab96ec832de 100644 (file)
@@ -5866,7 +5866,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #         for result publication in the study. Otherwise, if automatic
         #         publication is switched on, default value is used for result name.
         #
-        #  @return Group of all found sub-shapes or a single found sub-shape.
+        #  @return Compound which includes all found sub-shapes if they have different types; 
+        #          or group of all found shapes of the equal type; or a single found sub-shape.
         #
         #  @note This function has a restriction on argument shapes.
         #        If \a theShapeWhere has curved parts with significantly
@@ -5891,7 +5892,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
                         publication is switched on, default value is used for result name.
 
             Returns:
-                Group of all found sub-shapes or a single found sub-shape.
+                Compound which includes all found sub-shapes if they have different types; 
+                or group of all found shapes of the equal type; or a single found sub-shape.
 
 
             Note:
@@ -5927,7 +5929,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #         for result publication in the study. Otherwise, if automatic
         #         publication is switched on, default value is used for result name.
         #
-        #  @return Group of all found sub-shapes or a single found sub-shape.
+        #  @return Compound which includes all found sub-shapes if they have different types; 
+        #          or group of all found shapes of the equal type; or a single found sub-shape.
         #
         #  @ref swig_GetInPlace "Example"
         @ManageTransactions("ShapesOp")
@@ -5948,7 +5951,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
                         publication is switched on, default value is used for result name.
 
             Returns:
-                Group of all found sub-shapes or a single found sub-shape.
+                Compound which includes all found sub-shapes if they have different types; 
+                or group of all found shapes of the equal type; or a single found sub-shape.
             """
             # Example: see GEOM_TestOthers.py
             anObj = self.ShapesOp.GetInPlaceByHistory(theShapeWhere, theShapeWhat)
index d8c886274f57b19a6f7af9d30444b4f41ad78052..a6f094194cd7edbc01b88b41698a0043ce0f5a44 100644 (file)
@@ -113,15 +113,19 @@ XAOPlugin_IOperations::~XAOPlugin_IOperations()
   MESSAGE( "XAOPlugin_IOperations::~XAOPlugin_IOperations" );
 }
 
-void XAOPlugin_IOperations::exportGroups( std::list<Handle(GEOM_Object)> groupList,
-                                                  XAO::Xao* xaoObject,
-                                                  XAO::BrepGeometry* geometry )
+bool XAOPlugin_IOperations::exportGroups( std::list<Handle(GEOM_Object)> groupList,
+                                          XAO::Xao* xaoObject,
+                                          XAO::BrepGeometry* geometry )
 {
   // add the groups
   std::list<Handle(GEOM_Object)>::iterator groupIterator = groupList.begin();
   while (groupIterator != groupList.end())
   {
     Handle(GEOM_Object) currGroup = (*groupIterator++);
+    if (currGroup->GetType() != GEOM_GROUP) {
+      SetErrorCode("Error when export groups: you could perform this operation only with group.");
+      return false;
+    }
     Handle(TColStd_HArray1OfInteger) groupIds = myGroupOperations->GetObjects(currGroup);
 
     TopAbs_ShapeEnum shapeGroup = myGroupOperations->GetType(currGroup);
@@ -164,11 +168,12 @@ void XAOPlugin_IOperations::exportGroups( std::list<Handle(GEOM_Object)> groupLi
       break;
     }
   }
+  return true;
 }
 
 void XAOPlugin_IOperations::exportFields( std::list<Handle(GEOM_Field)> fieldList,
-                                                  XAO::Xao* xaoObject,
-                                                  XAO::BrepGeometry* geometry )
+                                          XAO::Xao* xaoObject,
+                                          XAO::BrepGeometry* geometry )
 {
   std::list<Handle(GEOM_Field)>::iterator fieldIterator = fieldList.begin();
   while (fieldIterator != fieldList.end())
@@ -301,10 +306,10 @@ void XAOPlugin_IOperations::exportSubshapes( const Handle(GEOM_Object)& shape, X
  */
 //=============================================================================
 bool XAOPlugin_IOperations::ExportXAO( Handle(GEOM_Object) shape,
-                                      std::list<Handle(GEOM_Object)> groupList,
-                                      std::list<Handle(GEOM_Field)> fieldList,
-                                      const char* author,
-                                      const char* fileName )
+                                       std::list<Handle(GEOM_Object)> groupList,
+                                       std::list<Handle(GEOM_Field)> fieldList,
+                                       const char* author,
+                                       const char* fileName )
 {
   SetErrorCode(KO);
 
@@ -337,7 +342,7 @@ bool XAOPlugin_IOperations::ExportXAO( Handle(GEOM_Object) shape,
   exportSubshapes(shape, geometry);
   xaoObject->setGeometry(geometry);
 
-  exportGroups(groupList, xaoObject, geometry);
+  if (!exportGroups(groupList, xaoObject, geometry)) return false;
   exportFields(fieldList, xaoObject, geometry);
 
   // export the XAO to the file
@@ -380,8 +385,8 @@ bool XAOPlugin_IOperations::ExportXAO( Handle(GEOM_Object) shape,
 }
 
 void XAOPlugin_IOperations::importSubShapes( XAO::Geometry* xaoGeometry,
-                                                     Handle(GEOM_Function) function, int shapeType, int dim,
-                                                     Handle(TColStd_HSequenceOfTransient)& subShapeList )
+                                             Handle(GEOM_Function) function, int shapeType, int dim,
+                                             Handle(TColStd_HSequenceOfTransient)& subShapeList )
 {
   Handle(GEOM_Object) subShape;
   Handle(GEOM_Function) aFunction;
@@ -433,10 +438,10 @@ void XAOPlugin_IOperations::importSubShapes( XAO::Geometry* xaoGeometry,
  */
 //=============================================================================
 bool XAOPlugin_IOperations::ImportXAO( const char* fileName,
-                                               Handle(GEOM_Object)& shape,
-                                               Handle(TColStd_HSequenceOfTransient)& subShapes,
-                                               Handle(TColStd_HSequenceOfTransient)& groups,
-                                               Handle(TColStd_HSequenceOfTransient)& fields )
+                                       Handle(GEOM_Object)& shape,
+                                       Handle(TColStd_HSequenceOfTransient)& subShapes,
+                                       Handle(TColStd_HSequenceOfTransient)& groups,
+                                       Handle(TColStd_HSequenceOfTransient)& fields )
 {
   SetErrorCode(KO);
 
index 869e3a1c2547b9baa4ff8468193714807717f339..2b477442a1a0d42b3237f2edab9c5b7da0184429 100644 (file)
@@ -44,31 +44,31 @@ public:
   ~XAOPlugin_IOperations();
 
   bool ExportXAO( Handle(GEOM_Object) shape,
-                 std::list<Handle(GEOM_Object)> groupList,
-                 std::list<Handle(GEOM_Field)> fieldList,
-                 const char* author,
-                 const char* fileName );
+                  std::list<Handle(GEOM_Object)> groupList,
+                  std::list<Handle(GEOM_Field)> fieldList,
+                  const char* author,
+                  const char* fileName );
   
   bool ImportXAO( const char* fileName,
-                 Handle(GEOM_Object)& shape,
-                 Handle(TColStd_HSequenceOfTransient)& subShapes,
-                 Handle(TColStd_HSequenceOfTransient)& groups,
-                 Handle(TColStd_HSequenceOfTransient)& fields );
+                  Handle(GEOM_Object)& shape,
+                  Handle(TColStd_HSequenceOfTransient)& subShapes,
+                  Handle(TColStd_HSequenceOfTransient)& groups,
+                  Handle(TColStd_HSequenceOfTransient)& fields );
 
 private:
-  void            importSubShapes( XAO::Geometry* xaoGeometry,
-                                  Handle(GEOM_Function) function,
-                                  int shapeType,
-                                  int dim,
-                                  Handle(TColStd_HSequenceOfTransient)& subshapeList );
-  void            exportSubshapes( const Handle(GEOM_Object)& shape,
-                                  XAO::BrepGeometry* geometry );
-  void            exportFields( std::list<Handle(GEOM_Field)> fieldList,
-                               XAO::Xao* xaoObject,
-                               XAO::BrepGeometry* geometry );
-  void            exportGroups( std::list<Handle(GEOM_Object)> groupList,
-                               XAO::Xao* xaoObject,
-                               XAO::BrepGeometry* geometry );
+  void importSubShapes( XAO::Geometry* xaoGeometry,
+                        Handle(GEOM_Function) function,
+                        int shapeType,
+                        int dim,
+                        Handle(TColStd_HSequenceOfTransient)& subshapeList );
+  void exportSubshapes( const Handle(GEOM_Object)& shape,
+                        XAO::BrepGeometry* geometry );
+  void exportFields( std::list<Handle(GEOM_Field)> fieldList,
+                     XAO::Xao* xaoObject,
+                     XAO::BrepGeometry* geometry );
+  bool exportGroups( std::list<Handle(GEOM_Object)> groupList,
+                     XAO::Xao* xaoObject,
+                     XAO::BrepGeometry* geometry );
 };
 
 #endif