Salome HOME
Bug #1748: Naming incorrect for edges after translation
authordbv <dbv@opencascade.com>
Thu, 15 Sep 2016 08:57:28 +0000 (11:57 +0300)
committerdbv <dbv@opencascade.com>
Thu, 15 Sep 2016 08:57:28 +0000 (11:57 +0300)
Fixed naming in Translation, Rotation and Placement

src/FeaturesPlugin/FeaturesPlugin_Placement.cpp
src/FeaturesPlugin/FeaturesPlugin_Placement.h
src/FeaturesPlugin/FeaturesPlugin_Rotation.cpp
src/FeaturesPlugin/FeaturesPlugin_Translation.cpp

index 496abeb0a42122e4f4b061d26e31fcc28d6907a5..627d10666b9819996d38dd6a4479a6aad52e8be7 100644 (file)
 #include <GeomAlgoAPI_Placement.h>
 #include <GeomAlgoAPI_Transform.h>
 
-#define _MODIFIEDF_TAG 1
-#define _MODIFIEDE_TAG 2
-#define _MODIFIEDV_TAG 3
-#define _FACE 4
 FeaturesPlugin_Placement::FeaturesPlugin_Placement()
 {
 }
@@ -174,7 +170,7 @@ void FeaturesPlugin_Placement::execute()
 
       //LoadNamingDS
       std::shared_ptr<ModelAPI_ResultBody> aResultBody = document()->createBody(data(), aResultIndex);
-      LoadNamingDS(aTransformAlgo, aResultBody, aBaseShape);
+      loadNamingDS(aTransformAlgo, aResultBody, aBaseShape);
       setResult(aResultBody, aResultIndex);
     }
     aResultIndex++;
@@ -185,18 +181,35 @@ void FeaturesPlugin_Placement::execute()
 }
 
 //============================================================================
-void FeaturesPlugin_Placement::LoadNamingDS(GeomAlgoAPI_Transform& theTransformAlgo,
+void FeaturesPlugin_Placement::loadNamingDS(GeomAlgoAPI_Transform& theTransformAlgo,
                                             std::shared_ptr<ModelAPI_ResultBody> theResultBody,
-                                            std::shared_ptr<GeomAPI_Shape> theSlaveObject)
+                                            std::shared_ptr<GeomAPI_Shape> theBaseShape)
 {
   //load result
-  theResultBody->storeModified(theSlaveObject, theTransformAlgo.shape()); // the initial Slave, the resulting Slave
+  theResultBody->storeModified(theBaseShape, theTransformAlgo.shape());
 
   std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes = theTransformAlgo.mapOfSubShapes();
 
     // put modifed faces in DF
-  std::string aModName = "Modified";
-  theResultBody->loadAndOrientModifiedShapes(&theTransformAlgo,
-                                             theSlaveObject, _FACE,
-                                             _MODIFIEDF_TAG, aModName, *aSubShapes.get());
+  int aPlacedTag = 1;
+  std::string aPlacedName = "Placed";
+
+  switch(theBaseShape->shapeType()) {
+    case GeomAPI_Shape::COMPOUND:
+    case GeomAPI_Shape::COMPSOLID:
+    case GeomAPI_Shape::SOLID:
+    case GeomAPI_Shape::SHELL:
+      theResultBody->loadAndOrientModifiedShapes(&theTransformAlgo,
+                                                 theBaseShape, GeomAPI_Shape::FACE,
+                                                 aPlacedTag, aPlacedName + "_Face", *aSubShapes.get());
+    case GeomAPI_Shape::FACE:
+    case GeomAPI_Shape::WIRE:
+      theResultBody->loadAndOrientModifiedShapes(&theTransformAlgo,
+                                                 theBaseShape, GeomAPI_Shape::EDGE,
+                                                 ++aPlacedTag, aPlacedName + "_Edge", *aSubShapes.get());
+    case GeomAPI_Shape::EDGE:
+      theResultBody->loadAndOrientModifiedShapes(&theTransformAlgo,
+                                                 theBaseShape, GeomAPI_Shape::VERTEX,
+                                                 ++aPlacedTag, aPlacedName + "_Vertex", *aSubShapes.get());
+  }
 }
index 498a771b22b3e339277fc6fd1458308cf7303175..96bac5e24e0ac18492d59aabc1f0b8f1c8e56677 100644 (file)
@@ -83,9 +83,9 @@ class FeaturesPlugin_Placement : public ModelAPI_Feature
   FeaturesPlugin_Placement();
 private:
   /// Load Naming data structure of the feature to the document
-  void LoadNamingDS(GeomAlgoAPI_Transform& theTransformAlgo,
+  void loadNamingDS(GeomAlgoAPI_Transform& theTransformAlgo,
                     std::shared_ptr<ModelAPI_ResultBody> theResultBody,
-                    std::shared_ptr<GeomAPI_Shape> theSlaveObject);
+                    std::shared_ptr<GeomAPI_Shape> theBaseShape);
 };
 
 #endif
index 1b8938544e2f927e467decd38a936e58dc347fab..f7768c40502400b3feb2a81d020cfd7942656c28 100755 (executable)
@@ -125,8 +125,23 @@ void FeaturesPlugin_Rotation::loadNamingDS(GeomAlgoAPI_Rotation& theRotaionAlgo,
 
   int aRotatedTag = 1;
   std::string aRotatedName = "Rotated";
-  theResultBody->loadAndOrientModifiedShapes(&theRotaionAlgo,
-                                             theBaseShape, GeomAPI_Shape::FACE,
-                                             aRotatedTag, aRotatedName, *aSubShapes.get());
 
+  switch(theBaseShape->shapeType()) {
+    case GeomAPI_Shape::COMPOUND:
+    case GeomAPI_Shape::COMPSOLID:
+    case GeomAPI_Shape::SOLID:
+    case GeomAPI_Shape::SHELL:
+      theResultBody->loadAndOrientModifiedShapes(&theRotaionAlgo,
+                                                 theBaseShape, GeomAPI_Shape::FACE,
+                                                 aRotatedTag, aRotatedName + "_Face", *aSubShapes.get());
+    case GeomAPI_Shape::FACE:
+    case GeomAPI_Shape::WIRE:
+      theResultBody->loadAndOrientModifiedShapes(&theRotaionAlgo,
+                                                 theBaseShape, GeomAPI_Shape::EDGE,
+                                                 ++aRotatedTag, aRotatedName + "_Edge", *aSubShapes.get());
+    case GeomAPI_Shape::EDGE:
+      theResultBody->loadAndOrientModifiedShapes(&theRotaionAlgo,
+                                                 theBaseShape, GeomAPI_Shape::VERTEX,
+                                                 ++aRotatedTag, aRotatedName + "_Vertex", *aSubShapes.get());
+  }
 }
index e88996bafb4cf692e43861f54eceb2390c7df20a..9e616107b6ee22438313378a1e2d04e8de10932d 100644 (file)
@@ -128,8 +128,23 @@ void FeaturesPlugin_Translation::loadNamingDS(GeomAlgoAPI_Translation& theTransl
 
   int aTranslatedTag = 1;
   std::string aTranslatedName = "Translated";
-  theResultBody->loadAndOrientModifiedShapes(&theTranslationAlgo,
-                                             theBaseShape, GeomAPI_Shape::FACE,
-                                             aTranslatedTag, aTranslatedName, *aSubShapes.get());
 
+  switch(theBaseShape->shapeType()) {
+    case GeomAPI_Shape::COMPOUND:
+    case GeomAPI_Shape::COMPSOLID:
+    case GeomAPI_Shape::SOLID:
+    case GeomAPI_Shape::SHELL:
+      theResultBody->loadAndOrientModifiedShapes(&theTranslationAlgo,
+                                                 theBaseShape, GeomAPI_Shape::FACE,
+                                                 aTranslatedTag, aTranslatedName + "_Face", *aSubShapes.get());
+    case GeomAPI_Shape::FACE:
+    case GeomAPI_Shape::WIRE:
+      theResultBody->loadAndOrientModifiedShapes(&theTranslationAlgo,
+                                                 theBaseShape, GeomAPI_Shape::EDGE,
+                                                 ++aTranslatedTag, aTranslatedName + "_Edge", *aSubShapes.get());
+    case GeomAPI_Shape::EDGE:
+      theResultBody->loadAndOrientModifiedShapes(&theTranslationAlgo,
+                                                 theBaseShape, GeomAPI_Shape::VERTEX,
+                                                 ++aTranslatedTag, aTranslatedName + "_Vertex", *aSubShapes.get());
+  }
 }