From ed1b0004eeea49d31df14d804fff09d2063002ce Mon Sep 17 00:00:00 2001 From: dbv Date: Thu, 15 Sep 2016 11:57:28 +0300 Subject: [PATCH] Bug #1748: Naming incorrect for edges after translation Fixed naming in Translation, Rotation and Placement --- .../FeaturesPlugin_Placement.cpp | 37 +++++++++++++------ src/FeaturesPlugin/FeaturesPlugin_Placement.h | 4 +- .../FeaturesPlugin_Rotation.cpp | 21 +++++++++-- .../FeaturesPlugin_Translation.cpp | 21 +++++++++-- 4 files changed, 63 insertions(+), 20 deletions(-) diff --git a/src/FeaturesPlugin/FeaturesPlugin_Placement.cpp b/src/FeaturesPlugin/FeaturesPlugin_Placement.cpp index 496abeb0a..627d10666 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Placement.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Placement.cpp @@ -20,10 +20,6 @@ #include #include -#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 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 theResultBody, - std::shared_ptr theSlaveObject) + std::shared_ptr theBaseShape) { //load result - theResultBody->storeModified(theSlaveObject, theTransformAlgo.shape()); // the initial Slave, the resulting Slave + theResultBody->storeModified(theBaseShape, theTransformAlgo.shape()); std::shared_ptr 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()); + } } diff --git a/src/FeaturesPlugin/FeaturesPlugin_Placement.h b/src/FeaturesPlugin/FeaturesPlugin_Placement.h index 498a771b2..96bac5e24 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Placement.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Placement.h @@ -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 theResultBody, - std::shared_ptr theSlaveObject); + std::shared_ptr theBaseShape); }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_Rotation.cpp b/src/FeaturesPlugin/FeaturesPlugin_Rotation.cpp index 1b8938544..f7768c405 100755 --- a/src/FeaturesPlugin/FeaturesPlugin_Rotation.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Rotation.cpp @@ -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()); + } } diff --git a/src/FeaturesPlugin/FeaturesPlugin_Translation.cpp b/src/FeaturesPlugin/FeaturesPlugin_Translation.cpp index e88996baf..9e616107b 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Translation.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Translation.cpp @@ -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()); + } } -- 2.39.2