Salome HOME
Added CPP High API for BuildPlugin_Vertex
[modules/shaper.git] / src / BuildAPI / BuildAPI_Vertex.cpp
diff --git a/src/BuildAPI/BuildAPI_Vertex.cpp b/src/BuildAPI/BuildAPI_Vertex.cpp
new file mode 100644 (file)
index 0000000..a3b71ae
--- /dev/null
@@ -0,0 +1,49 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File:        BuildAPI_Vertex.cpp
+// Created:     09 June 2016
+// Author:      Dmitry Bobylev
+
+#include "BuildAPI_Vertex.h"
+
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+BuildAPI_Vertex::BuildAPI_Vertex(const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+  initialize();
+}
+
+//==================================================================================================
+BuildAPI_Vertex::BuildAPI_Vertex(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                                 const std::list<ModelHighAPI_Selection>& theBaseObjects)
+: ModelHighAPI_Interface(theFeature)
+{
+  if(initialize()) {
+    setBase(theBaseObjects);
+  }
+}
+
+//==================================================================================================
+BuildAPI_Vertex::~BuildAPI_Vertex()
+{
+
+}
+
+//==================================================================================================
+void BuildAPI_Vertex::setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects)
+{
+  fillAttribute(theBaseObjects, mybaseObjects);
+
+  execute();
+}
+
+// TODO(spo): make add* as static functions of the class
+//==================================================================================================
+VertexPtr addVertex(const std::shared_ptr<ModelAPI_Document>& thePart,
+                    const std::list<ModelHighAPI_Selection>& theBaseObjects)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(BuildAPI_Vertex::ID());
+  return VertexPtr(new BuildAPI_Vertex(aFeature, theBaseObjects));
+}