X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchAPI%2FSketchAPI_SketchEntity.cpp;h=67024816346a4df7ba4a1f7a6f6ffa949ac5bc8e;hb=50a8df0c6a66da8067b16155e5ae39f8f26a7ebc;hp=24758c6803b8f70bd7422ec95e202a613b8d493a;hpb=b0e217e6399717e35fcfe2ada28dd6c5213d3721;p=modules%2Fshaper.git diff --git a/src/SketchAPI/SketchAPI_SketchEntity.cpp b/src/SketchAPI/SketchAPI_SketchEntity.cpp index 24758c680..670248163 100644 --- a/src/SketchAPI/SketchAPI_SketchEntity.cpp +++ b/src/SketchAPI/SketchAPI_SketchEntity.cpp @@ -1,13 +1,28 @@ -// Name : SketchAPI_SketchEntity.cpp -// Purpose: +// Copyright (C) 2014-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// 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 +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// History: -// 07/06/16 - Sergey POKHODENKO - Creation of the file -//-------------------------------------------------------------------------------------- #include "SketchAPI_SketchEntity.h" #include +#include #include +#include +#include #include #include #include @@ -16,7 +31,9 @@ #include #include +#include #include +#include #include #include #include @@ -69,25 +86,37 @@ bool SketchAPI_SketchEntity::isCopy() const { // check the feature is a copy of another entity AttributeBooleanPtr isCopy = feature()->boolean(SketchPlugin_SketchEntity::COPY_ID()); - return isCopy.get() && isCopy->value(); + AttributeReferencePtr hasParent = feature()->reference(SketchPlugin_SketchEntity::PARENT_ID()); + return (isCopy.get() && isCopy->value()) || (hasParent && hasParent->value()); } -std::list > +std::list > SketchAPI_SketchEntity::wrap(const std::list >& theFeatures) { - std::list > aResult; + std::list > aResult; std::list >::const_iterator anIt = theFeatures.begin(); for (; anIt != theFeatures.end(); ++anIt) { if ((*anIt)->getKind() == SketchPlugin_Line::ID()) - aResult.push_back(std::shared_ptr(new SketchAPI_Line(*anIt))); + aResult.push_back(std::shared_ptr(new SketchAPI_Line(*anIt))); else if ((*anIt)->getKind() == SketchPlugin_Arc::ID()) - aResult.push_back(std::shared_ptr(new SketchAPI_Arc(*anIt))); + aResult.push_back(std::shared_ptr(new SketchAPI_Arc(*anIt))); else if ((*anIt)->getKind() == SketchPlugin_Circle::ID()) - aResult.push_back(std::shared_ptr(new SketchAPI_Circle(*anIt))); + aResult.push_back(std::shared_ptr(new SketchAPI_Circle(*anIt))); + else if ((*anIt)->getKind() == SketchPlugin_Ellipse::ID()) + aResult.push_back(std::shared_ptr(new SketchAPI_Ellipse(*anIt))); + else if ((*anIt)->getKind() == SketchPlugin_EllipticArc::ID()) + aResult.push_back(std::shared_ptr(new SketchAPI_EllipticArc(*anIt))); + else if ((*anIt)->getKind() == SketchPlugin_BSpline::ID()) + aResult.push_back(std::shared_ptr(new SketchAPI_BSpline(*anIt))); + else if ((*anIt)->getKind() == SketchPlugin_BSplinePeriodic::ID()) { + aResult.push_back( + std::shared_ptr(new SketchAPI_BSplinePeriodic(*anIt))); + } else if ((*anIt)->getKind() == SketchPlugin_Point::ID()) - aResult.push_back(std::shared_ptr(new SketchAPI_Point(*anIt))); + aResult.push_back(std::shared_ptr(new SketchAPI_Point(*anIt))); else if ((*anIt)->getKind() == SketchPlugin_IntersectionPoint::ID()) - aResult.push_back(std::shared_ptr(new SketchAPI_IntersectionPoint(*anIt))); + aResult.push_back(std::shared_ptr( + new SketchAPI_IntersectionPoint(*anIt))); } return aResult; }