X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchAPI%2FSketchAPI_Projection.cpp;h=f2dac81a3fba7d1187bf72c8e606752b2da108fd;hb=ae92361e7d1375e324cc19e7b6a2962750e1d7ce;hp=38e84be98560cfff64879f6bfe0364dd52d64037;hpb=b3695c3af5289903f1c0fa01bbb7c40203c5e544;p=modules%2Fshaper.git diff --git a/src/SketchAPI/SketchAPI_Projection.cpp b/src/SketchAPI/SketchAPI_Projection.cpp index 38e84be98..f2dac81a3 100644 --- a/src/SketchAPI/SketchAPI_Projection.cpp +++ b/src/SketchAPI/SketchAPI_Projection.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2017 CEA/DEN, EDF R&D +// Copyright (C) 2014-2023 CEA, EDF // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -12,20 +12,28 @@ // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or -// email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #include "SketchAPI_Projection.h" #include +#include +#include #include +#include +#include +#include -#include -#include #include +#include +#include +#include +#include +#include +#include #include #include @@ -48,16 +56,6 @@ SketchAPI_Projection::SketchAPI_Projection( } } -SketchAPI_Projection::SketchAPI_Projection( - const std::shared_ptr & theFeature, - const std::string & theExternalName) -: SketchAPI_SketchEntity(theFeature) -{ - if (initialize()) { - setByExternalName(theExternalName); - } -} - SketchAPI_Projection::~SketchAPI_Projection() { @@ -71,16 +69,18 @@ void SketchAPI_Projection::setExternalFeature(const ModelHighAPI_Selection & the execute(true); } -void SketchAPI_Projection::setByExternalName(const std::string& theExternalName) +void SketchAPI_Projection::setIncludeToResult(bool theKeepResult) { - fillAttribute(ModelHighAPI_Selection("EDGE", theExternalName), external()); - + fillAttribute(theKeepResult, includeToResult()); execute(true); } -void SketchAPI_Projection::setIncludeToResult(bool theKeepResult) +void SketchAPI_Projection::setKeepReferenceToOriginal(bool theKeepRefToOriginal) { - fillAttribute(theKeepResult, includeToResult()); + // the Fixed constraint should be assigned explicitly + fillAttribute(false, feature()->boolean(SketchPlugin_Projection::MAKE_FIXED())); + fillAttribute(theKeepRefToOriginal ? "true" : "false", + feature()->string(SketchPlugin_Projection::KEEP_REFERENCE_ID())); execute(true); } @@ -95,11 +95,22 @@ std::shared_ptr SketchAPI_Projection::createdFeature() c return anEntity; } - aProjectedFeature->getKind() == SketchPlugin_Line::ID() ? - anEntity.reset(new SketchAPI_Line(aProjectedFeature)) : - aProjectedFeature->getKind() == SketchPlugin_Circle::ID() ? - anEntity.reset(new SketchAPI_Circle(aProjectedFeature)) : - anEntity.reset(new SketchAPI_Arc(aProjectedFeature)); + if (aProjectedFeature->getKind() == SketchPlugin_Line::ID()) + anEntity.reset(new SketchAPI_Line(aProjectedFeature)); + else if (aProjectedFeature->getKind() == SketchPlugin_Circle::ID()) + anEntity.reset(new SketchAPI_Circle(aProjectedFeature)); + else if (aProjectedFeature->getKind() == SketchPlugin_Arc::ID()) + anEntity.reset(new SketchAPI_Arc(aProjectedFeature)); + else if (aProjectedFeature->getKind() == SketchPlugin_Ellipse::ID()) + anEntity.reset(new SketchAPI_Ellipse(aProjectedFeature)); + else if (aProjectedFeature->getKind() == SketchPlugin_EllipticArc::ID()) + anEntity.reset(new SketchAPI_EllipticArc(aProjectedFeature)); + else if (aProjectedFeature->getKind() == SketchPlugin_BSpline::ID()) + anEntity.reset(new SketchAPI_BSpline(aProjectedFeature)); + else if (aProjectedFeature->getKind() == SketchPlugin_BSplinePeriodic::ID()) + anEntity.reset(new SketchAPI_BSplinePeriodic(aProjectedFeature)); + else if (aProjectedFeature->getKind() == SketchPlugin_Point::ID()) + anEntity.reset(new SketchAPI_Point(aProjectedFeature)); return anEntity; }