const GeomShapePtr theResultShape,
int& theResultIndex,
std::shared_ptr<GeomAlgoAPI_MakeShapeList> theMakeShapeList,
- std::vector<FeaturesPlugin_Tools::ResultBaseAlgo>& theResultBaseAlgoList)
+ std::vector<ModelAPI_Tools::ResultBaseAlgo>& theResultBaseAlgoList)
{
if (!theResultShape)
return;
std::shared_ptr<ModelAPI_ResultBody> aResultBody =
document()->createBody(data(), theResultIndex);
- FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
+ ModelAPI_Tools::loadModifiedShapes(aResultBody,
theObjects,
theTools,
theMakeShapeList,
setResult(aResultBody, theResultIndex++);
// merge algorithms
- FeaturesPlugin_Tools::ResultBaseAlgo aRBA;
+ ModelAPI_Tools::ResultBaseAlgo aRBA;
aRBA.resultBody = aResultBody;
aRBA.baseShape = theObjects.front();
- for (std::vector<FeaturesPlugin_Tools::ResultBaseAlgo>::iterator
+ for (std::vector<ModelAPI_Tools::ResultBaseAlgo>::iterator
aRBAIt = theResultBaseAlgoList.begin();
aRBAIt != theResultBaseAlgoList.end(); ++aRBAIt) {
theMakeShapeList->appendAlgo(aRBAIt->makeShape);
const GeomShapePtr theResultShape,
int& theResultIndex,
std::shared_ptr<GeomAlgoAPI_MakeShapeList> theMakeShapeList,
- std::vector<FeaturesPlugin_Tools::ResultBaseAlgo>& theResultBaseAlgoList);
+ std::vector<ModelAPI_Tools::ResultBaseAlgo>& theResultBaseAlgoList);
private:
OperationType myOperationType;
std::string anError;
std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMakeShapeList(new GeomAlgoAPI_MakeShapeList());
- std::vector<FeaturesPlugin_Tools::ResultBaseAlgo> aResultBaseAlgoList;
+ std::vector<ModelAPI_Tools::ResultBaseAlgo> aResultBaseAlgoList;
ListOfShape aResultShapesList;
if (isSimpleMode) {
ListOfShape anObjectList = anObjects.objects();
ListOfShape aToolsList;
- FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
+ ModelAPI_Tools::loadModifiedShapes(aResultBody,
anObjectList,
aToolsList,
aMakeShapeList,
aResultIndex++;
aToolsList = anObjectList;
- FeaturesPlugin_Tools::ResultBaseAlgo aRBA;
+ ModelAPI_Tools::ResultBaseAlgo aRBA;
aRBA.resultBody = aResultBody;
aRBA.baseShape = aBaseShape;
aRBA.makeShape = aMakeShapeList;
// result shape has been deleted, but in another it was modified or stayed.
if (!aResultCompound)
aResultCompound = GeomAlgoAPI_CompoundBuilder::compound(aResultShapesList);
- FeaturesPlugin_Tools::loadDeletedShapes(aResultBaseAlgoList,
+ ModelAPI_Tools::loadDeletedShapes(aResultBaseAlgoList,
aTools.objects(),
aResultCompound);
#include "FeaturesPlugin_BooleanCut.h"
-#include "FeaturesPlugin_Tools.h"
-
#include <ModelAPI_ResultBody.h>
#include <ModelAPI_AttributeSelectionList.h>
#include <ModelAPI_Tools.h>
return;
}
- std::vector<FeaturesPlugin_Tools::ResultBaseAlgo> aResultBaseAlgoList;
+ std::vector<ModelAPI_Tools::ResultBaseAlgo> aResultBaseAlgoList;
ListOfShape aResultShapesList;
std::string anError;
// result shape has been deleted, but in another it was modified or stayed.
if (!aResultCompound)
aResultCompound = GeomAlgoAPI_CompoundBuilder::compound(aResultShapesList);
- FeaturesPlugin_Tools::loadDeletedShapes(aResultBaseAlgoList,
+ ModelAPI_Tools::loadDeletedShapes(aResultBaseAlgoList,
aTools.objects(),
aResultCompound);
//
#include "FeaturesPlugin_BooleanFill.h"
-#include "FeaturesPlugin_Tools.h"
#include <ModelAPI_ResultBody.h>
#include <ModelAPI_AttributeSelectionList.h>
return;
}
- std::vector<FeaturesPlugin_Tools::ResultBaseAlgo> aResultBaseAlgoList;
+ std::vector<ModelAPI_Tools::ResultBaseAlgo> aResultBaseAlgoList;
ListOfShape aResultShapesList;
std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMakeShapeList(new GeomAlgoAPI_MakeShapeList());
// result shape has been deleted, but in another it was modified or stayed.
if (!aResultCompound)
aResultCompound = GeomAlgoAPI_CompoundBuilder::compound(aResultShapesList);
- FeaturesPlugin_Tools::loadDeletedShapes(aResultBaseAlgoList,
+ ModelAPI_Tools::loadDeletedShapes(aResultBaseAlgoList,
aTools.objects(),
aResultCompound);
#include "FeaturesPlugin_BooleanFuse.h"
-#include "FeaturesPlugin_Tools.h"
-
#include <ModelAPI_ResultBody.h>
#include <ModelAPI_AttributeBoolean.h>
#include <ModelAPI_AttributeInteger.h>
ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
ListOfShape anEmptyTools;
- FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
- anOriginalShapes,
- anEmptyTools,
- aMakeShapeList,
- aShape);
+ ModelAPI_Tools::loadModifiedShapes(aResultBody,
+ anOriginalShapes,
+ anEmptyTools,
+ aMakeShapeList,
+ aShape);
setResult(aResultBody, aResultIndex);
aResultIndex++;
- FeaturesPlugin_Tools::loadDeletedShapes(aResultBody,
- GeomShapePtr(),
- anOriginalShapes,
- aMakeShapeList,
- aShape);
+ ModelAPI_Tools::loadDeletedShapes(aResultBody,
+ GeomShapePtr(),
+ anOriginalShapes,
+ aMakeShapeList,
+ aShape);
// remove the rest results if there were produced in the previous pass
removeResults(aResultIndex);
#include "FeaturesPlugin_BooleanSmash.h"
-#include "FeaturesPlugin_Tools.h"
-
#include <ModelAPI_ResultBody.h>
#include <ModelAPI_AttributeSelectionList.h>
#include <ModelAPI_Tools.h>
std::shared_ptr<ModelAPI_ResultBody> aResultBody = document()->createBody(data(), aResultIndex);
- FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
- anOriginalShapes,
- anOriginalShapes,
- aMakeShapeList,
- aShape);
+ ModelAPI_Tools::loadModifiedShapes(aResultBody,
+ anOriginalShapes,
+ anOriginalShapes,
+ aMakeShapeList,
+ aShape);
setResult(aResultBody, aResultIndex);
aResultIndex++;
- FeaturesPlugin_Tools::loadDeletedShapes(aResultBody,
- GeomShapePtr(),
- anOriginalShapes,
- aMakeShapeList,
- aShape);
+ ModelAPI_Tools::loadDeletedShapes(aResultBody,
+ GeomShapePtr(),
+ anOriginalShapes,
+ aMakeShapeList,
+ aShape);
// remove the rest results if there were produced in the previous pass
removeResults(aResultIndex);
//
#include <FeaturesPlugin_Defeaturing.h>
-#include <FeaturesPlugin_Tools.h>
#include <ModelAPI_AttributeSelectionList.h>
#include <ModelAPI_Tools.h>
int aResultIndex = 0;
std::string anError;
- std::vector<FeaturesPlugin_Tools::ResultBaseAlgo> aResultBaseAlgoList;
+ std::vector<ModelAPI_Tools::ResultBaseAlgo> aResultBaseAlgoList;
ListOfShape anOriginalShapesList, aResultShapesList;
for (SolidFaces::iterator anIt = aBodiesAndFacesToRemove.begin();
aBaseShapes.push_back(anExp.current());
std::shared_ptr<ModelAPI_ResultBody> aResultBody = document()->createBody(data(), aResultIndex);
- FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, aBaseShapes, ListOfShape(),
- anAlgo, aResult, "Defeaturing");
+ ModelAPI_Tools::loadModifiedShapes(aResultBody, aBaseShapes, ListOfShape(),
+ anAlgo, aResult, "Defeaturing");
setResult(aResultBody, aResultIndex);
aResultIndex++;
- FeaturesPlugin_Tools::ResultBaseAlgo aRBA;
+ ModelAPI_Tools::ResultBaseAlgo aRBA;
aRBA.resultBody = aResultBody;
aRBA.baseShape = aParent;
aRBA.makeShape = anAlgo;
// Store deleted shapes after all results has been proceeded. This is to avoid issue when in one
// result shape has been deleted, but in another it was modified or stayed.
GeomShapePtr aResultShapesCompound = GeomAlgoAPI_CompoundBuilder::compound(aResultShapesList);
- FeaturesPlugin_Tools::loadDeletedShapes(aResultBaseAlgoList,
+ ModelAPI_Tools::loadDeletedShapes(aResultBaseAlgoList,
anOriginalShapesList, aResultShapesCompound);
removeResults(aResultIndex);
//
#include "FeaturesPlugin_Extrusion.h"
-#include "FeaturesPlugin_Tools.h"
#include <ModelAPI_AttributeDouble.h>
#include <ModelAPI_AttributeSelection.h>
#include <ModelAPI_AttributeString.h>
#include <ModelAPI_Session.h>
#include <ModelAPI_Validator.h>
+#include <ModelAPI_Tools.h>
#include <GeomAlgoAPI_Prism.h>
#include <GeomAlgoAPI_Tools.h>
ResultBodyPtr aResultBody = document()->createBody(data(), theIndex);
// Store modified shapes.
- FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, theBoundaryShapes, ListOfShape(),
- theMakeShape, theMakeShape->shape());
+ ModelAPI_Tools::loadModifiedShapes(aResultBody, theBoundaryShapes, ListOfShape(),
+ theMakeShape, theMakeShape->shape());
// Store generated edges/faces.
storeGenerationHistory(aResultBody, theBaseShape, theMakeShape);
//
#include <FeaturesPlugin_Fillet1D.h>
-#include <FeaturesPlugin_Tools.h>
#include <GeomAlgoAPI_Fillet1D.h>
#include <GeomAlgoAPI_MapShapesAndAncestors.h>
#include <ModelAPI_AttributeSelectionList.h>
#include <ModelAPI_AttributeString.h>
#include <ModelAPI_Events.h>
+#include <ModelAPI_Tools.h>
void sendMessageWithFailedShapes(const ListOfShape& theVertices)
{
ResultBodyPtr aResult = document()->createBody(data(), theResultIndex);
ListOfShape anOriginal;
anOriginal.push_back(theWire);
- FeaturesPlugin_Tools::loadModifiedShapes(aResult, anOriginal, ListOfShape(),
- aFilletBuilder, aFilletBuilder->shape(), THE_PREFIX);
+ ModelAPI_Tools::loadModifiedShapes(aResult, anOriginal, ListOfShape(),
+ aFilletBuilder, aFilletBuilder->shape(), THE_PREFIX);
setResult(aResult, theResultIndex);
// store new edges generated from vertices
for (ListOfShape::const_iterator anIt = theVertices.begin(); anIt != theVertices.end(); ++anIt)
//
#include "FeaturesPlugin_FusionFaces.h"
-#include "FeaturesPlugin_Tools.h"
#include <ModelAPI_AttributeSelectionList.h>
#include <ModelAPI_AttributeString.h>
#include <ModelAPI_ResultConstruction.h>
#include <ModelAPI_Session.h>
#include <ModelAPI_Validator.h>
+#include <ModelAPI_Tools.h>
#include <GeomAPI_ShapeIterator.h>
#include <GeomAPI_ShapeExplorer.h>
ListOfShape aBaseShapesList;
aBaseShapesList.push_back(aBaseShape);
- FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, aBaseShapesList, ListOfShape(),
- anAlgo, aResultShape);
+ ModelAPI_Tools::loadModifiedShapes(aResultBody, aBaseShapesList, ListOfShape(),
+ anAlgo, aResultShape);
setResult(aResultBody);
}
#include <ModelAPI_BodyBuilder.h>
#include <ModelAPI_ResultBody.h>
#include <ModelAPI_AttributeSelectionList.h>
+#include <ModelAPI_Tools.h>
#include <GeomAlgoAPI_Intersection.h>
#include <GeomAlgoAPI_MakeShapeList.h>
}
std::shared_ptr<ModelAPI_ResultBody> aResultBody = document()->createBody(data(), aResultIndex);
- FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
- anObjects,
- ListOfShape(),
- aMakeShapeList,
- aResShape);
+ ModelAPI_Tools::loadModifiedShapes(aResultBody,
+ anObjects,
+ ListOfShape(),
+ aMakeShapeList,
+ aResShape);
setResult(aResultBody, aResultIndex);
aResultIndex++;
- FeaturesPlugin_Tools::loadDeletedShapes(aResultBody,
- GeomShapePtr(),
- anObjects,
- aMakeShapeList,
- aResShape);
+ ModelAPI_Tools::loadDeletedShapes(aResultBody,
+ GeomShapePtr(),
+ anObjects,
+ aMakeShapeList,
+ aResShape);
// remove the rest results if there were produced in the previous pass
removeResults(aResultIndex);
#include <ModelAPI_AttributeString.h>
#include <ModelAPI_ResultBody.h>
#include <ModelAPI_ResultPart.h>
+#include <ModelAPI_Tools.h>
#include <math.h>
#include <iostream>
anObjects.topLevelObjects(aTopLevel);
for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end(); ++anIt) {
ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
- FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, anOriginalShapes, ListOfShape(),
- aMakeShapeList, *anIt, "Rotated");
+ ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalShapes, ListOfShape(),
+ aMakeShapeList, *anIt, "Rotated");
aResultBody->setTextureFile(theTextureFile);
setResult(aResultBody, aResultIndex++);
}
#include <ModelAPI_AttributeString.h>
#include <ModelAPI_ResultBody.h>
#include <ModelAPI_ResultPart.h>
+#include <ModelAPI_Tools.h>
#include <math.h>
anObjects.topLevelObjects(aTopLevel);
for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end(); ++anIt) {
ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
- FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, anOriginalShapes, ListOfShape(),
- aMakeShapeList, *anIt, "Translated");
+ ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalShapes, ListOfShape(),
+ aMakeShapeList, *anIt, "Translated");
aResultBody->setTextureFile(theTextureFile);
setResult(aResultBody, aResultIndex++);
}
for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end(); ++anIt) {
//LoadNamingDS
ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
- FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, anOriginalShapes, ListOfShape(),
- aMakeShapeList, *anIt, "Placed");
+ ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalShapes, ListOfShape(),
+ aMakeShapeList, *anIt, "Placed");
aResultBody->setTextureFile(theTextureFile);
setResult(aResultBody, aResultIndex++);
}
#include <ModelAPI_AttributeString.h>
#include <ModelAPI_ResultBody.h>
#include <ModelAPI_ResultPart.h>
+#include <ModelAPI_Tools.h>
#include <GeomAlgoAPI_MakeShapeList.h>
#include <GeomAlgoAPI_PointBuilder.h>
anObjects.topLevelObjects(aTopLevel);
for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end(); ++anIt) {
ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
- FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, anOriginalShapes, ListOfShape(),
- aMakeShapeList, *anIt, "Rotated");
+ ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalShapes, ListOfShape(),
+ aMakeShapeList, *anIt, "Rotated");
aResultBody->setTextureFile(theTextureFile);
setResult(aResultBody, aResultIndex++);
}
#include <ModelAPI_AttributeString.h>
#include <ModelAPI_ResultBody.h>
#include <ModelAPI_ResultPart.h>
+#include <ModelAPI_Tools.h>
static const std::string SCALE_VERSION_1("v9.5");
anObjects.topLevelObjects(aTopLevel);
for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end(); ++anIt) {
ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
- FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, anOriginalShapes, ListOfShape(),
- aMakeShapeList, *anIt, "Scaled");
+ ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalShapes, ListOfShape(),
+ aMakeShapeList, *anIt, "Scaled");
aResultBody->setTextureFile(theTextureFile);
setResult(aResultBody, aResultIndex++);
}
anObjects.topLevelObjects(aTopLevel);
for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end(); ++anIt) {
ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
- FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, anOriginalShapes, ListOfShape(),
- aMakeShapeList, *anIt, "Scaled");
+ ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalShapes, ListOfShape(),
+ aMakeShapeList, *anIt, "Scaled");
aResultBody->setTextureFile(theTextureFile);
setResult(aResultBody, aResultIndex++);
}
#include <ModelAPI_AttributeString.h>
#include <ModelAPI_ResultBody.h>
#include <ModelAPI_ResultPart.h>
+#include <ModelAPI_Tools.h>
#include <FeaturesPlugin_Tools.h>
{
// Store and name the result.
ResultBodyPtr aResultBody = document()->createBody(data(), theResultIndex);
- FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, theOriginalShapes, ListOfShape(),
- theAlgo, theTargetShape, "Symmetried");
+ ModelAPI_Tools::loadModifiedShapes(aResultBody, theOriginalShapes, ListOfShape(),
+ theAlgo, theTargetShape, "Symmetried");
aResultBody->setTextureFile(theTextureFile);
setResult(aResultBody, theResultIndex++);
}
#include <GeomValidators_ShapeType.h>
-//==================================================================================================
-void FeaturesPlugin_Tools::loadModifiedShapes(ResultBodyPtr theResultBody,
- const ListOfShape& theBaseShapes,
- const ListOfShape& theTools,
- const GeomMakeShapePtr& theMakeShape,
- const GeomShapePtr theResultShape,
- const std::string& theNamePrefix)
-{
- theResultBody->storeModified(theBaseShapes, theResultShape, theMakeShape);
-
- ListOfShape aShapes = theBaseShapes;
- ListOfShape::const_iterator aToolIter = theTools.cbegin();
- for(; aToolIter != theTools.cend(); aToolIter++)
- aShapes.push_back(*aToolIter);
-
- for (ListOfShape::const_iterator anIter = aShapes.begin(); anIter != aShapes.end(); ++anIter)
- {
- theResultBody->loadModifiedShapes(theMakeShape, *anIter, GeomAPI_Shape::VERTEX, theNamePrefix);
- theResultBody->loadModifiedShapes(theMakeShape, *anIter, GeomAPI_Shape::EDGE, theNamePrefix);
- theResultBody->loadModifiedShapes(theMakeShape, *anIter, GeomAPI_Shape::FACE, theNamePrefix);
- }
-}
-
-//==================================================================================================
-void FeaturesPlugin_Tools::loadModifiedShapes(ResultBodyPtr theResultBody,
- const GeomShapePtr& theBaseShape,
- const GeomMakeShapePtr& theMakeShape,
- const std::string theName)
-{
- switch(theBaseShape->shapeType()) {
- case GeomAPI_Shape::COMPOUND: {
- for(GeomAPI_ShapeIterator anIt(theBaseShape); anIt.more(); anIt.next())
- {
- loadModifiedShapes(theResultBody,
- anIt.current(),
- theMakeShape,
- theName);
- }
- break;
- }
- case GeomAPI_Shape::COMPSOLID:
- case GeomAPI_Shape::SOLID:
- case GeomAPI_Shape::SHELL: {
- theResultBody->loadModifiedShapes(theMakeShape,
- theBaseShape,
- GeomAPI_Shape::FACE,
- theName);
- }
- case GeomAPI_Shape::FACE:
- case GeomAPI_Shape::WIRE: {
- theResultBody->loadModifiedShapes(theMakeShape,
- theBaseShape,
- GeomAPI_Shape::EDGE,
- theName);
- }
- case GeomAPI_Shape::EDGE: {
- theResultBody->loadModifiedShapes(theMakeShape,
- theBaseShape,
- GeomAPI_Shape::VERTEX,
- theName);
- }
- default: // [to avoid compilation warning]
- break;
- }
-}
-
-//==================================================================================================
-void FeaturesPlugin_Tools::loadDeletedShapes(ResultBodyPtr theResultBody,
- const GeomShapePtr theBaseShape,
- const ListOfShape& theTools,
- const GeomMakeShapePtr& theMakeShape,
- const GeomShapePtr theResultShapesCompound)
-{
- ListOfShape aShapes = theTools;
- if (theBaseShape.get())
- aShapes.push_front(theBaseShape);
-
- for (ListOfShape::const_iterator anIter = aShapes.begin(); anIter != aShapes.end(); anIter++)
- {
- theResultBody->loadDeletedShapes(theMakeShape,
- *anIter,
- GeomAPI_Shape::VERTEX,
- theResultShapesCompound);
- theResultBody->loadDeletedShapes(theMakeShape,
- *anIter,
- GeomAPI_Shape::EDGE,
- theResultShapesCompound);
- theResultBody->loadDeletedShapes(theMakeShape,
- *anIter,
- GeomAPI_Shape::FACE,
- theResultShapesCompound);
- // store information about deleted solids because of unittest TestBooleanCommon_SolidsHistory
- // on OCCT 7.4.0 : common produces modified compsolid, so, move to the end for removed solids
- // starts to produce whole compsolid
- theResultBody->loadDeletedShapes(theMakeShape,
- *anIter,
- GeomAPI_Shape::SOLID,
- theResultShapesCompound);
- }
-}
-
-//==================================================================================================
-void FeaturesPlugin_Tools::loadDeletedShapes(
- std::vector<ResultBaseAlgo>& theResultBaseAlgoList,
- const ListOfShape& theTools,
- const GeomShapePtr theResultShapesCompound)
-{
- for (std::vector<ResultBaseAlgo>::iterator anIt = theResultBaseAlgoList.begin();
- anIt != theResultBaseAlgoList.end();
- ++anIt)
- {
- ResultBaseAlgo& aRCA = *anIt;
- loadDeletedShapes(aRCA.resultBody,
- aRCA.baseShape,
- theTools,
- aRCA.makeShape,
- theResultShapesCompound);
- }
-}
-
//==================================================================================================
bool FeaturesPlugin_Tools::getShape(const AttributeSelectionListPtr theSelectionList,
const bool theShareTopology,
class FeaturesPlugin_Tools {
public:
- struct ResultBaseAlgo {
- ResultBodyPtr resultBody;
- GeomShapePtr baseShape;
- GeomMakeShapePtr makeShape;
- };
-
-public:
- static void loadModifiedShapes(ResultBodyPtr theResultBody,
- const ListOfShape& theBaseShapes,
- const ListOfShape& theTools,
- const GeomMakeShapePtr& theMakeShape,
- const GeomShapePtr theResultShape,
- const std::string& theNamePrefix = "");
-
- static void loadModifiedShapes(ResultBodyPtr theResultBody,
- const GeomShapePtr& theBaseShape,
- const GeomMakeShapePtr& theMakeShape,
- const std::string theName);
- /// Stores deleted shapes.
- static void loadDeletedShapes(ResultBodyPtr theResultBody,
- const GeomShapePtr theBaseShape,
- const ListOfShape& theTools,
- const GeomMakeShapePtr& theMakeShape,
- const GeomShapePtr theResultShapesCompound);
-
- /// Stores deleted shapes.
- static void loadDeletedShapes(std::vector<ResultBaseAlgo>& theResultBaseAlgoList,
- const ListOfShape& theTools,
- const GeomShapePtr theResultShapesCompound);
-
/// Obtain shapes from the selection list attribute.
static bool getShape(const std::shared_ptr<ModelAPI_AttributeSelectionList> theSelectionList,
const bool theShareTopology,
#include <ModelAPI_ResultBody.h>
#include <ModelAPI_ResultPart.h>
#include <ModelAPI_Session.h>
+#include <ModelAPI_Tools.h>
#include <GeomAPI_Ax1.h>
#include <GeomAPI_Edge.h>
for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end(); ++anIt) {
//LoadNamingDS
ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
- FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, anOriginalShapes, ListOfShape(),
- aMakeShapeList, *anIt, "Translated");
+ ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalShapes, ListOfShape(),
+ aMakeShapeList, *anIt, "Translated");
aResultBody->setTextureFile(theTextureFile);
setResult(aResultBody, aResultIndex++);
}
std::string anError;
int aResultIndex = 0;
- std::vector<FeaturesPlugin_Tools::ResultBaseAlgo> aResultBaseAlgoList;
+ std::vector<ModelAPI_Tools::ResultBaseAlgo> aResultBaseAlgoList;
ListOfShape aResultShapesList;
GeomShapePtr aResultCompound = GeomAlgoAPI_CompoundBuilder::compound(ListOfShape());
}
std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMakeShapeList(new GeomAlgoAPI_MakeShapeList());
- for (std::vector<FeaturesPlugin_Tools::ResultBaseAlgo>::iterator
+ for (std::vector<ModelAPI_Tools::ResultBaseAlgo>::iterator
aRBAIt = aResultBaseAlgoList.begin();
aRBAIt != aResultBaseAlgoList.end(); ++aRBAIt) {
aMakeShapeList->appendAlgo(aRBAIt->makeShape);
const ListOfShape& theTools,
const ListOfShape& thePlanes,
int& theResultIndex,
- std::vector<FeaturesPlugin_Tools::ResultBaseAlgo>& theResultBaseAlgoList,
+ std::vector<ModelAPI_Tools::ResultBaseAlgo>& theResultBaseAlgoList,
ListOfShape& theResultShapesList,
GeomShapePtr theResultCompound)
{
ListOfShape aUsedTools = theTools;
aUsedTools.insert(aUsedTools.end(), thePlanes.begin(), thePlanes.end());
- FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
+ ModelAPI_Tools::loadModifiedShapes(aResultBody,
aListWithObject,
aUsedTools,
aMakeShapeList,
}
- FeaturesPlugin_Tools::ResultBaseAlgo aRBA;
+ ModelAPI_Tools::ResultBaseAlgo aRBA;
aRBA.resultBody = aResultBody;
aRBA.baseShape = theObject;
aRBA.makeShape = aMakeShapeList;
const ListOfShape& theTools,
const ListOfShape& thePlanes,
int& theResultIndex,
- std::vector<FeaturesPlugin_Tools::ResultBaseAlgo>& theResultBaseAlgoList,
+ std::vector<ModelAPI_Tools::ResultBaseAlgo>& theResultBaseAlgoList,
ListOfShape& theResultShapesList,
GeomShapePtr theResultCompound)
{
ListOfShape aUsedTools = theTools;
aUsedTools.insert(aUsedTools.end(), thePlanes.begin(), thePlanes.end());
- FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
+ ModelAPI_Tools::loadModifiedShapes(aResultBody,
aCompSolidList,
aUsedTools,
aMakeShapeList,
++theResultIndex;
}
- FeaturesPlugin_Tools::ResultBaseAlgo aRBA;
+ ModelAPI_Tools::ResultBaseAlgo aRBA;
aRBA.resultBody = aResultBody;
aRBA.baseShape = theCompsolid;
aRBA.makeShape = aMakeShapeList;
const GeomShapePtr& theCompound,
const ListOfShape& theTools,
int& theResultIndex,
- std::vector<FeaturesPlugin_Tools::ResultBaseAlgo>& theResultBaseAlgoList,
+ std::vector<ModelAPI_Tools::ResultBaseAlgo>& theResultBaseAlgoList,
ListOfShape& theResultShapesList,
GeomShapePtr theResultCompound)
{
ListOfShape aCompoundList;
aCompoundList.push_back(theCompound);
- FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
+ ModelAPI_Tools::loadModifiedShapes(aResultBody,
aCompoundList,
theTools,
aMakeShapeList,
++theResultIndex;
}
- FeaturesPlugin_Tools::ResultBaseAlgo aRBA;
+ ModelAPI_Tools::ResultBaseAlgo aRBA;
aRBA.resultBody = aResultBody;
aRBA.baseShape = theCompound;
aRBA.makeShape = aMakeShapeList;
#include <GeomAlgoAPI_Tools.h>
#include <ModelAPI_Feature.h>
+#include <ModelAPI_Tools.h>
class ModelAPI_Attribute;
class ModelAPI_Result;
const ListOfShape& theTools,
const ListOfShape& thePlanes,
int& theResultIndex,
- std::vector<FeaturesPlugin_Tools::ResultBaseAlgo>& theResultBaseAlgoList,
+ std::vector<ModelAPI_Tools::ResultBaseAlgo>& theResultBaseAlgoList,
ListOfShape& theResultShapesList,
GeomShapePtr theResulCompound = GeomShapePtr());
const ListOfShape& theTools,
const ListOfShape& thePlanes,
int& theResultIndex,
- std::vector<FeaturesPlugin_Tools::ResultBaseAlgo>& theResultBaseAlgoList,
+ std::vector<ModelAPI_Tools::ResultBaseAlgo>& theResultBaseAlgoList,
ListOfShape& theResultShapesList,
GeomShapePtr theResulCompound = GeomShapePtr());
const GeomShapePtr& theCompound,
const ListOfShape& theTools,
int& theResultIndex,
- std::vector<FeaturesPlugin_Tools::ResultBaseAlgo>& theResultBaseAlgoList,
+ std::vector<ModelAPI_Tools::ResultBaseAlgo>& theResultBaseAlgoList,
ListOfShape& theResultShapesList,
GeomShapePtr theResulCompound = GeomShapePtr());
//
#include "FeaturesPlugin_VersionedChFi.h"
-#include "FeaturesPlugin_Tools.h"
#include <ModelAPI_AttributeSelectionList.h>
#include <ModelAPI_Tools.h>
anObjectHierarchy.topLevelObjects(aTopLevel);
for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end(); ++anIt) {
ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
- FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, anOriginalSolids, ListOfShape(),
- aMakeShapeList, *anIt, aPrefix);
+ ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalSolids, ListOfShape(),
+ aMakeShapeList, *anIt, aPrefix);
setResult(aResultBody, aResultIndex++);
for (ListOfShape::iterator aEIt = anEdges.begin(); aEIt != anEdges.end(); ++aEIt) {
aResultBody->loadGeneratedShapes(aMakeShapeList, aBase, GeomAPI_Shape::EDGE, aPrefix, true);
}
- FeaturesPlugin_Tools::loadDeletedShapes(aResultBody, GeomShapePtr(), anOriginalSolids,
- aMakeShapeList, *anIt);
+ ModelAPI_Tools::loadDeletedShapes(aResultBody, GeomShapePtr(), anOriginalSolids,
+ aMakeShapeList, *anIt);
}
removeResults(aResultIndex);
protected:
/// \brief Sets builder type.
/// \param[in] theBuilderType new builder type.
- void setBuilderType(const BuilderType theBuilderType);
+ GEOMALGOAPI_EXPORT void setBuilderType(const BuilderType theBuilderType);
/// \brief Sets status of builder.
/// \param[in] theFlag new status.
- void setDone(const bool theFlag);
+ GEOMALGOAPI_EXPORT void setDone(const bool theFlag);
/// \brief Sets result shape.
/// \param[in] theShape new shape.
- void setShape(const GeomShapePtr theShape);
+ GEOMALGOAPI_EXPORT void setShape(const GeomShapePtr theShape);
/// \return true if passed shape is valid for history.
bool isValidForHistory(const GeomShapePtr theShape);
#include <Events_Loop.h>
#include <Locale_Convert.h>
+#include <GeomAlgoAPI_MakeShape.h>
#include <GeomAPI_ShapeHierarchy.h>
#include <GeomAPI_ShapeIterator.h>
return ObjectPtr();
}
+//==================================================================================================
+void loadModifiedShapes(ResultBodyPtr theResultBody,
+ const ListOfShape& theBaseShapes,
+ const ListOfShape& theTools,
+ const GeomMakeShapePtr& theMakeShape,
+ const GeomShapePtr theResultShape,
+ const std::string& theNamePrefix)
+{
+ theResultBody->storeModified(theBaseShapes, theResultShape, theMakeShape);
+
+ ListOfShape aShapes = theBaseShapes;
+ ListOfShape::const_iterator aToolIter = theTools.cbegin();
+ for (; aToolIter != theTools.cend(); aToolIter++)
+ aShapes.push_back(*aToolIter);
+
+ for (ListOfShape::const_iterator anIter = aShapes.begin(); anIter != aShapes.end(); ++anIter)
+ {
+ theResultBody->loadModifiedShapes(theMakeShape, *anIter, GeomAPI_Shape::VERTEX, theNamePrefix);
+ theResultBody->loadModifiedShapes(theMakeShape, *anIter, GeomAPI_Shape::EDGE, theNamePrefix);
+ theResultBody->loadModifiedShapes(theMakeShape, *anIter, GeomAPI_Shape::FACE, theNamePrefix);
+ }
+}
+
+//==================================================================================================
+void loadModifiedShapes(ResultBodyPtr theResultBody,
+ const GeomShapePtr& theBaseShape,
+ const GeomMakeShapePtr& theMakeShape,
+ const std::string theName)
+{
+ switch (theBaseShape->shapeType()) {
+ case GeomAPI_Shape::COMPOUND: {
+ for (GeomAPI_ShapeIterator anIt(theBaseShape); anIt.more(); anIt.next())
+ {
+ loadModifiedShapes(theResultBody,
+ anIt.current(),
+ theMakeShape,
+ theName);
+ }
+ break;
+ }
+ case GeomAPI_Shape::COMPSOLID:
+ case GeomAPI_Shape::SOLID:
+ case GeomAPI_Shape::SHELL: {
+ theResultBody->loadModifiedShapes(theMakeShape,
+ theBaseShape,
+ GeomAPI_Shape::FACE,
+ theName);
+ }
+ case GeomAPI_Shape::FACE:
+ case GeomAPI_Shape::WIRE: {
+ theResultBody->loadModifiedShapes(theMakeShape,
+ theBaseShape,
+ GeomAPI_Shape::EDGE,
+ theName);
+ }
+ case GeomAPI_Shape::EDGE: {
+ theResultBody->loadModifiedShapes(theMakeShape,
+ theBaseShape,
+ GeomAPI_Shape::VERTEX,
+ theName);
+ }
+ default: // [to avoid compilation warning]
+ break;
+ }
+}
+
+//==================================================================================================
+void loadDeletedShapes(ResultBodyPtr theResultBody,
+ const GeomShapePtr theBaseShape,
+ const ListOfShape& theTools,
+ const GeomMakeShapePtr& theMakeShape,
+ const GeomShapePtr theResultShapesCompound)
+{
+ ListOfShape aShapes = theTools;
+ if (theBaseShape.get())
+ aShapes.push_front(theBaseShape);
+
+ for (ListOfShape::const_iterator anIter = aShapes.begin(); anIter != aShapes.end(); anIter++)
+ {
+ theResultBody->loadDeletedShapes(theMakeShape,
+ *anIter,
+ GeomAPI_Shape::VERTEX,
+ theResultShapesCompound);
+ theResultBody->loadDeletedShapes(theMakeShape,
+ *anIter,
+ GeomAPI_Shape::EDGE,
+ theResultShapesCompound);
+ theResultBody->loadDeletedShapes(theMakeShape,
+ *anIter,
+ GeomAPI_Shape::FACE,
+ theResultShapesCompound);
+ // store information about deleted solids because of unittest TestBooleanCommon_SolidsHistory
+ // on OCCT 7.4.0 : common produces modified compsolid, so, move to the end for removed solids
+ // starts to produce whole compsolid
+ theResultBody->loadDeletedShapes(theMakeShape,
+ *anIter,
+ GeomAPI_Shape::SOLID,
+ theResultShapesCompound);
+ }
+}
+
+//==================================================================================================
+void loadDeletedShapes(std::vector<ResultBaseAlgo>& theResultBaseAlgoList,
+ const ListOfShape& theTools,
+ const GeomShapePtr theResultShapesCompound)
+{
+ for (std::vector<ResultBaseAlgo>::iterator anIt = theResultBaseAlgoList.begin();
+ anIt != theResultBaseAlgoList.end();
+ ++anIt)
+ {
+ ResultBaseAlgo& aRCA = *anIt;
+ loadDeletedShapes(aRCA.resultBody,
+ aRCA.baseShape,
+ theTools,
+ aRCA.makeShape,
+ theResultShapesCompound);
+ }
+}
+
bool findVariable(const DocumentPtr& theDocument, FeaturePtr theSearcher,
const std::wstring& theName, double& outValue, ResultParameterPtr& theParam)
{
class ModelAPI_ResultParameter;
class ModelAPI_ResultBody;
+class GeomAlgoAPI_MakeShape;
class GeomAPI_Shape;
class GeomAPI_ShapeHierarchy;
*/
MODELAPI_EXPORT std::string getFeatureError(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+MODELAPI_EXPORT struct ResultBaseAlgo {
+ std::shared_ptr<ModelAPI_ResultBody> resultBody;
+ std::shared_ptr<GeomAPI_Shape> baseShape;
+ std::shared_ptr<GeomAlgoAPI_MakeShape> makeShape;
+};
+
+MODELAPI_EXPORT void loadModifiedShapes(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
+ const std::list<std::shared_ptr<GeomAPI_Shape>>& theBaseShapes,
+ const std::list<std::shared_ptr<GeomAPI_Shape>>& theTools,
+ const std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape,
+ const std::shared_ptr<GeomAPI_Shape> theResultShape,
+ const std::string& theNamePrefix = "");
+
+MODELAPI_EXPORT void loadModifiedShapes(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
+ const std::shared_ptr<GeomAPI_Shape>& theBaseShape,
+ const std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape,
+ const std::string theName);
+/// Stores deleted shapes.
+MODELAPI_EXPORT void loadDeletedShapes(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
+ const std::shared_ptr<GeomAPI_Shape> theBaseShape,
+ const std::list<std::shared_ptr<GeomAPI_Shape>>& theTools,
+ const std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape,
+ const std::shared_ptr<GeomAPI_Shape> theResultShapesCompound);
+
+/// Stores deleted shapes.
+MODELAPI_EXPORT void loadDeletedShapes(std::vector<ResultBaseAlgo>& theResultBaseAlgoList,
+ const std::list<std::shared_ptr<GeomAPI_Shape>>& theTools,
+ const std::shared_ptr<GeomAPI_Shape> theResultShapesCompound);
+
/*!
* Searches for variable with name \param theName in \param theDocument.
* If found, set it value in the \param outValue and returns true.