X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FFeaturesPlugin%2FFeaturesPlugin_Placement.cpp;h=44ad7523e4f6330e8853cec73da101699c1def22;hb=b52164791e6cc6cdc2c009c7ef6667d9f476d3aa;hp=af86e815255c9bb88d0788cd453e9f1bec155b94;hpb=71cf58ac99d209975c4dc6d25d2fc9705eab3908;p=modules%2Fshaper.git diff --git a/src/FeaturesPlugin/FeaturesPlugin_Placement.cpp b/src/FeaturesPlugin/FeaturesPlugin_Placement.cpp index af86e8152..44ad7523e 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Placement.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Placement.cpp @@ -1,3 +1,5 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> + // File: FeaturesPlugin_Placement.cpp // Created: 2 Dec 2014 // Author: Artem ZHIDKOV @@ -12,6 +14,10 @@ #include #include +#define _MODIFIEDF_TAG 1 +#define _MODIFIEDE_TAG 2 +#define _MODIFIEDV_TAG 3 +#define _FACE 4 FeaturesPlugin_Placement::FeaturesPlugin_Placement() { } @@ -53,20 +59,20 @@ void FeaturesPlugin_Placement::execute() aFaceRef = std::dynamic_pointer_cast( data()->attribute(FeaturesPlugin_Placement::ATTRACT_FACE_ID())); - std::shared_ptr anAttractiveFace = + std::shared_ptr aSlaveObjectFace = std::dynamic_pointer_cast(aFaceRef->value()); - if (!anAttractiveFace) + if (!aSlaveObjectFace) return; - std::shared_ptr anAttractiveFaceContext; + std::shared_ptr aSlaveObject; aContextRes = aFaceRef->context(); if (aContextRes) { if (aContextRes->groupName() == ModelAPI_ResultBody::group()) - anAttractiveFaceContext = std::dynamic_pointer_cast(aContextRes)->shape(); + aSlaveObject = std::dynamic_pointer_cast(aContextRes)->shape(); else if (aContextRes->groupName() == ModelAPI_ResultConstruction::group()) - anAttractiveFaceContext = std::dynamic_pointer_cast(aContextRes)->shape(); + aSlaveObject = std::dynamic_pointer_cast(aContextRes)->shape(); } - if (!anAttractiveFaceContext) { + if (!aSlaveObject) { static const std::string aContextError = "The selection context is bad"; setError(aContextError); return; @@ -74,18 +80,18 @@ void FeaturesPlugin_Placement::execute() // Verify faces planarity std::shared_ptr aBaseFace1(new GeomAPI_Face(aBaseFace)); - std::shared_ptr anAttractFace1(new GeomAPI_Face(anAttractiveFace)); - if (!aBaseFace1->isPlanar() || !anAttractFace1->isPlanar()) { + std::shared_ptr aSlaveFace1(new GeomAPI_Face(aSlaveObjectFace)); + if (!aBaseFace1->isPlanar() || !aSlaveFace1->isPlanar()) { static const std::string aPlanarityError = "One of selected face is not planar"; setError(aPlanarityError); return; } std::shared_ptr aBasePlane = aBaseFace1->getPlane(); - std::shared_ptr anAttractivePlane = anAttractFace1->getPlane(); + std::shared_ptr aSlavePlane = aSlaveFace1->getPlane(); std::shared_ptr aResultBody = document()->createBody(data()); - GeomAlgoAPI_Placement aFeature(anAttractiveFaceContext, anAttractivePlane, aBasePlane); + GeomAlgoAPI_Placement aFeature(aSlaveObject, aSlavePlane, aBasePlane); if(!aFeature.isDone()) { static const std::string aFeatureError = "Placement algorithm failed"; setError(aFeatureError); @@ -104,7 +110,7 @@ void FeaturesPlugin_Placement::execute() return; } //LoadNamingDS - LoadNamingDS(aFeature, aResultBody, anAttractiveFace, anAttractiveFaceContext); + LoadNamingDS(aFeature, aResultBody, aSlaveObject); setResult(aResultBody); } @@ -113,44 +119,16 @@ void FeaturesPlugin_Placement::execute() void FeaturesPlugin_Placement::LoadNamingDS( GeomAlgoAPI_Placement& theFeature, std::shared_ptr theResultBody, - std::shared_ptr theBasis, - std::shared_ptr theContext) + std::shared_ptr theSlaveObject) { - theResultBody->store(theFeature.shape()); - /// TODO: SZY -/* - //load result - if(theBasis->isEqual(theContext)) - theResultBody->store(theFeature.shape()); - else - theResultBody->storeGenerated(theContext, theFeature.shape()); + theResultBody->storeModified(theSlaveObject, theFeature.shape()); // the initial Slave, the resulting Slave GeomAPI_DataMapOfShapeShape* aSubShapes = new GeomAPI_DataMapOfShapeShape(); theFeature.mapOfShapes(*aSubShapes); + + // put modifed faces in DF + std::string aModName = "Modified"; + theResultBody->loadAndOrientModifiedShapes(theFeature.makeShape(), theSlaveObject, _FACE, _MODIFIEDF_TAG, aModName, *aSubShapes); - //Insert lateral face : Face from Edge - theResultBody->loadAndOrientGeneratedShapes(theFeature.makeShape(), theBasis, EDGE,_LATERAL_TAG, *aSubShapes); - - //Insert bottom face - std::shared_ptr aBottomFace = theFeature.firstShape(); - if (!aBottomFace->isNull()) { - if (aSubShapes->isBound(aBottomFace)) { - aBottomFace = aSubShapes->find(aBottomFace); - } - theResultBody->generated(aBottomFace, _FIRST_TAG); - } - - - - //Insert top face - std::shared_ptr aTopFace = theFeature.lastShape(); - if (!aTopFace->isNull()) { - if (aSubShapes->isBound(aTopFace)) { - aTopFace = aSubShapes->find(aTopFace); - } - theResultBody->generated(aTopFace, _LAST_TAG); - } - -*/ }