Salome HOME
Copyright update 2022
[modules/shaper.git] / src / SketchAPI / SketchAPI_SketchEntity.cpp
index 1989dfa6b467481832c4ffcd5df67fb6a52eff70..4cfb5de3d058f0adeb5714bbd9494003d18df013 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2022  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
 //
 // 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<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include "SketchAPI_SketchEntity.h"
 #include <SketchAPI_Arc.h>
+#include <SketchAPI_BSpline.h>
 #include <SketchAPI_Circle.h>
+#include <SketchAPI_Ellipse.h>
+#include <SketchAPI_EllipticArc.h>
 #include <SketchAPI_IntersectionPoint.h>
 #include <SketchAPI_Line.h>
 #include <SketchAPI_Point.h>
@@ -29,7 +31,9 @@
 #include <ModelHighAPI_Tools.h>
 
 #include <SketchPlugin_Arc.h>
+#include <SketchPlugin_BSpline.h>
 #include <SketchPlugin_Circle.h>
+#include <SketchPlugin_Ellipse.h>
 #include <SketchPlugin_IntersectionPoint.h>
 #include <SketchPlugin_Line.h>
 #include <SketchPlugin_Point.h>
@@ -82,7 +86,8 @@ 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::shared_ptr<SketchAPI_SketchEntity> >
@@ -97,6 +102,16 @@ SketchAPI_SketchEntity::wrap(const std::list<std::shared_ptr<ModelAPI_Feature> >
       aResult.push_back(std::shared_ptr<SketchAPI_SketchEntity>(new SketchAPI_Arc(*anIt)));
     else if ((*anIt)->getKind() == SketchPlugin_Circle::ID())
       aResult.push_back(std::shared_ptr<SketchAPI_SketchEntity>(new SketchAPI_Circle(*anIt)));
+    else if ((*anIt)->getKind() == SketchPlugin_Ellipse::ID())
+      aResult.push_back(std::shared_ptr<SketchAPI_SketchEntity>(new SketchAPI_Ellipse(*anIt)));
+    else if ((*anIt)->getKind() == SketchPlugin_EllipticArc::ID())
+      aResult.push_back(std::shared_ptr<SketchAPI_SketchEntity>(new SketchAPI_EllipticArc(*anIt)));
+    else if ((*anIt)->getKind() == SketchPlugin_BSpline::ID())
+      aResult.push_back(std::shared_ptr<SketchAPI_SketchEntity>(new SketchAPI_BSpline(*anIt)));
+    else if ((*anIt)->getKind() == SketchPlugin_BSplinePeriodic::ID()) {
+      aResult.push_back(
+          std::shared_ptr<SketchAPI_SketchEntity>(new SketchAPI_BSplinePeriodic(*anIt)));
+    }
     else if ((*anIt)->getKind() == SketchPlugin_Point::ID())
       aResult.push_back(std::shared_ptr<SketchAPI_SketchEntity>(new SketchAPI_Point(*anIt)));
     else if ((*anIt)->getKind() == SketchPlugin_IntersectionPoint::ID())