X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchPlugin%2FSketchPlugin_Projection.cpp;h=eaf073c8b7702a9caeda15e061116fb724df09ee;hb=3f1a42a51c7de1911c75453ff7134593d7d2c6b1;hp=319f200cb3069c54aa30ec91c47907a27d60f2bf;hpb=152a49556bb45dbe2a979fc055c7f501c52a8125;p=modules%2Fshaper.git diff --git a/src/SketchPlugin/SketchPlugin_Projection.cpp b/src/SketchPlugin/SketchPlugin_Projection.cpp index 319f200cb..eaf073c8b 100644 --- a/src/SketchPlugin/SketchPlugin_Projection.cpp +++ b/src/SketchPlugin/SketchPlugin_Projection.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -31,12 +32,6 @@ static const double tolerance = 1.e-7; -static std::shared_ptr emptyEdge() -{ - static std::shared_ptr anEdge(new GeomAPI_Edge); - return anEdge; -} - SketchPlugin_Projection::SketchPlugin_Projection() : SketchPlugin_SketchEntity(), myIsComputing(false) @@ -64,7 +59,7 @@ void SketchPlugin_Projection::execute() if (!lastResult().get() && aProjection->lastResult().get()) { ResultConstructionPtr aConstr = document()->createConstruction(data()); - aConstr->setShape(emptyEdge()); + aConstr->setShape(aProjection->lastResult()->shape()); aConstr->setIsInHistory(false); aConstr->setDisplayed(false); setResult(aConstr); @@ -113,7 +108,10 @@ void SketchPlugin_Projection::computeProjection(const std::string& theID) (anEdge->isCircle() && aProjection->getKind() != SketchPlugin_Circle::ID()) || (anEdge->isArc() && aProjection->getKind() != SketchPlugin_Arc::ID())) { DocumentPtr aDoc = sketch()->document(); - aDoc->removeFeature(aProjection); + + std::set aFeaturesToBeRemoved; + aFeaturesToBeRemoved.insert(aProjection); + ModelAPI_Tools::removeFeaturesAndReferences(aFeaturesToBeRemoved); aProjection = FeaturePtr(); aRefAttr->setObject(aProjection); } @@ -199,10 +197,10 @@ void SketchPlugin_Projection::computeProjection(const std::string& theID) } if (theID == EXTERNAL_FEATURE_ID()) { - selection(EXTERNAL_ID())->setValue(aExtFeature->context(), aExtFeature->context()->shape()); + selection(EXTERNAL_ID())->setValue(aExtFeature->context(), aExtFeature->value()); if (aResult) { - aResult->setShape(emptyEdge()); + aResult->setShape(aProjection->lastResult()->shape()); setResult(aResult); aProjection->selection(EXTERNAL_ID())->setValue(lastResult(), lastResult()->shape()); }