Fixed naming for edges after translation, rotation and placement.
FeaturesPlugin_ValidatorTransform.h
FeaturesPlugin_Validators.h
FeaturesPlugin_RemoveSubShapes.h
+ FeaturesPlugin_Tools.h
)
SET(PROJECT_SOURCES
FeaturesPlugin_ValidatorTransform.cpp
FeaturesPlugin_Validators.cpp
FeaturesPlugin_RemoveSubShapes.cpp
+ FeaturesPlugin_Tools.cpp
)
SET(XML_RESOURCES
#include <GeomAlgoAPI_Placement.h>
#include <GeomAlgoAPI_Transform.h>
+#include <FeaturesPlugin_Tools.h>
+
FeaturesPlugin_Placement::FeaturesPlugin_Placement()
{
}
//load result
theResultBody->storeModified(theBaseShape, theTransformAlgo.shape());
- std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes = theTransformAlgo.mapOfSubShapes();
-
- // put modifed faces in DF
int aPlacedTag = 1;
std::string aPlacedName = "Placed";
+ std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes = theTransformAlgo.mapOfSubShapes();
- 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());
- }
+ FeaturesPlugin_Tools::storeModifiedShapes(theTransformAlgo, theResultBody, theBaseShape, aPlacedTag, aPlacedName, *aSubShapes.get());
}
#include <GeomAPI_Edge.h>
#include <GeomAPI_Lin.h>
+#include <FeaturesPlugin_Tools.h>
+
//=================================================================================================
FeaturesPlugin_Rotation::FeaturesPlugin_Rotation()
{
// Store result.
theResultBody->storeModified(theBaseShape, theRotaionAlgo.shape());
- std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes = theRotaionAlgo.mapOfSubShapes();
-
int aRotatedTag = 1;
std::string aRotatedName = "Rotated";
+ std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes = theRotaionAlgo.mapOfSubShapes();
- 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());
- }
+ FeaturesPlugin_Tools::storeModifiedShapes(theRotaionAlgo, theResultBody, theBaseShape, aRotatedTag, aRotatedName, *aSubShapes.get());
}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: FeaturesPlugin_Tools.cpp
+// Created: 17 November 2016
+// Author: Dmitry Bobylev
+
+#include "FeaturesPlugin_Tools.h"
+
+#include <ModelAPI_ResultBody.h>
+
+#include <GeomAPI_ShapeIterator.h>
+
+void FeaturesPlugin_Tools::storeModifiedShapes(GeomAlgoAPI_MakeShape& theAlgo,
+ std::shared_ptr<ModelAPI_ResultBody> theResultBody,
+ std::shared_ptr<GeomAPI_Shape> theBaseShape,
+ int& theTag,
+ const std::string theName,
+ GeomAPI_DataMapOfShapeShape& theSubShapes)
+{
+ switch(theBaseShape->shapeType()) {
+ case GeomAPI_Shape::COMPOUND: {
+ for(GeomAPI_ShapeIterator anIt(theBaseShape); anIt.more(); anIt.next())
+ {
+ storeModifiedShapes(theAlgo, theResultBody, theBaseShape, theTag, theName, theSubShapes);
+ theTag++;
+ }
+ break;
+ }
+ case GeomAPI_Shape::COMPSOLID:
+ case GeomAPI_Shape::SOLID:
+ case GeomAPI_Shape::SHELL: {
+ theResultBody->loadAndOrientModifiedShapes(&theAlgo,
+ theBaseShape, GeomAPI_Shape::FACE,
+ theTag, theName + "_Face", theSubShapes);
+ if (theBaseShape->shapeType() == GeomAPI_Shape::COMPSOLID
+ || theBaseShape->shapeType() == GeomAPI_Shape::SOLID) {
+ break;
+ }
+ }
+ case GeomAPI_Shape::FACE:
+ case GeomAPI_Shape::WIRE:
+ theResultBody->loadAndOrientModifiedShapes(&theAlgo,
+ theBaseShape, GeomAPI_Shape::EDGE,
+ ++theTag, theName + "_Edge", theSubShapes);
+ case GeomAPI_Shape::EDGE:
+ theResultBody->loadAndOrientModifiedShapes(&theAlgo,
+ theBaseShape, GeomAPI_Shape::VERTEX,
+ ++theTag, theName + "_Vertex", theSubShapes);
+ }
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: FeaturesPlugin_Tools.h
+// Created: 17 November 2016
+// Author: Dmitry Bobylev
+
+#ifndef FeaturesPlugin_Tools_H_
+#define FeaturesPlugin_Tools_H_
+
+#include <GeomAlgoAPI_Translation.h>
+
+class ModelAPI_ResultBody;
+
+class FeaturesPlugin_Tools {
+public:
+ static void storeModifiedShapes(GeomAlgoAPI_MakeShape& theAlgo,
+ std::shared_ptr<ModelAPI_ResultBody> theResultBody,
+ std::shared_ptr<GeomAPI_Shape> theBaseShape,
+ int& theTag,
+ const std::string theName,
+ GeomAPI_DataMapOfShapeShape& theSubShapes);
+};
+
+#endif /* FeaturesPlugin_Tools_H_ */
#include <GeomAPI_Edge.h>
#include <GeomAPI_Lin.h>
+#include <FeaturesPlugin_Tools.h>
+
//=================================================================================================
FeaturesPlugin_Translation::FeaturesPlugin_Translation()
{
// Store result.
theResultBody->storeModified(theBaseShape, theTranslationAlgo.shape());
- std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes = theTranslationAlgo.mapOfSubShapes();
-
int aTranslatedTag = 1;
std::string aTranslatedName = "Translated";
+ std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes = theTranslationAlgo.mapOfSubShapes();
- 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());
- }
+ FeaturesPlugin_Tools::storeModifiedShapes(theTranslationAlgo, theResultBody, theBaseShape, aTranslatedTag, aTranslatedName, *aSubShapes.get());
}