]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/SketchAPI/SketchAPI_Sketch.cpp
Salome HOME
Merge branch 'Pre_2.8.0_development'
[modules/shaper.git] / src / SketchAPI / SketchAPI_Sketch.cpp
index 2af8499870ea1142e74d4fd4b7429b30e6190f56..daefc491e84a85f9fb5d2aa2e4e0fe60553aa750 100644 (file)
@@ -1,11 +1,23 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-// Name   : SketchAPI_Sketch.cpp
-// Purpose:
+// Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
 //
-// History:
-// 07/06/16 - Sergey POKHODENKO - Creation of the file
 
-//--------------------------------------------------------------------------------------
 #include "SketchAPI_Sketch.h"
 //--------------------------------------------------------------------------------------
 #include <SketchPlugin_Constraint.h>
@@ -25,8 +37,8 @@
 #include <SketchPlugin_ConstraintPerpendicular.h>
 #include <SketchPlugin_ConstraintRadius.h>
 #include <SketchPlugin_ConstraintRigid.h>
-#include <SketchPlugin_ConstraintSplit.h>
 #include <SketchPlugin_Trim.h>
+#include <SketchPlugin_Split.h>
 #include <SketchPlugin_ConstraintTangent.h>
 #include <SketchPlugin_ConstraintVertical.h>
 #include <SketcherPrs_Tools.h>
@@ -502,16 +514,19 @@ std::shared_ptr<SketchAPI_Rotation> SketchAPI_Sketch::addRotation(
 
 //--------------------------------------------------------------------------------------
 std::shared_ptr<ModelHighAPI_Interface> SketchAPI_Sketch::addSplit(
-                                                    const ModelHighAPI_Reference& theFeature,
-                                                    const ModelHighAPI_RefAttr& thePoint1,
-                                                    const ModelHighAPI_RefAttr& thePoint2)
+                                          const ModelHighAPI_Reference& theFeature,
+                                          const std::shared_ptr<GeomAPI_Pnt2d>& thePositionPoint)
 {
   std::shared_ptr<ModelAPI_Feature> aFeature =
-    compositeFeature()->addFeature(SketchPlugin_ConstraintSplit::ID());
-  fillAttribute(theFeature, aFeature->reference(SketchPlugin_Constraint::VALUE()));
-  fillAttribute(thePoint1, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
-  fillAttribute(thePoint2, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B()));
-  //aFeature->execute();
+    compositeFeature()->addFeature(SketchPlugin_Split::ID());
+  fillAttribute(theFeature, aFeature->reference(SketchPlugin_Split::SELECTED_OBJECT()));
+
+  AttributePtr anAttribute = aFeature->attribute(SketchPlugin_Split::SELECTED_POINT());
+  if (anAttribute->attributeType() == GeomDataAPI_Point2D::typeId()) {
+    AttributePoint2DPtr aPointAttr = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(anAttribute);
+    fillAttribute(thePositionPoint, aPointAttr);
+  }
+
   return InterfacePtr(new ModelHighAPI_Interface(aFeature));
 }