]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Added CPP High API for BuildPlugin_Edge
authordbv <dbv@opencascade.com>
Thu, 16 Jun 2016 15:07:31 +0000 (18:07 +0300)
committerspo <sergey.pokhodenko@opencascade.com>
Fri, 17 Jun 2016 11:41:13 +0000 (14:41 +0300)
src/BuildAPI/BuildAPI.i
src/BuildAPI/BuildAPI_Edge.cpp [new file with mode: 0644]
src/BuildAPI/BuildAPI_Edge.h [new file with mode: 0644]
src/BuildAPI/BuildAPI_swig.h
src/BuildAPI/CMakeLists.txt

index c1bb7e44ca4b6e176d6c6bf4435c6af1cb44d90b..7745dc9e09d74cefc411467f7adaa550f6c703d2 100644 (file)
@@ -19,7 +19,9 @@
 %include "std_shared_ptr.i"
 
 // shared pointers
+%shared_ptr(BuildAPI_Edge)
 %shared_ptr(BuildAPI_Vertex)
 
 // all supported interfaces
+%include "BuildAPI_Edge.h"
 %include "BuildAPI_Vertex.h"
diff --git a/src/BuildAPI/BuildAPI_Edge.cpp b/src/BuildAPI/BuildAPI_Edge.cpp
new file mode 100644 (file)
index 0000000..5ccb854
--- /dev/null
@@ -0,0 +1,49 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File:        BuildAPI_Edge.cpp
+// Created:     09 June 2016
+// Author:      Dmitry Bobylev
+
+#include "BuildAPI_Edge.h"
+
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+BuildAPI_Edge::BuildAPI_Edge(const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+  initialize();
+}
+
+//==================================================================================================
+BuildAPI_Edge::BuildAPI_Edge(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                             const std::list<ModelHighAPI_Selection>& theBaseObjects)
+: ModelHighAPI_Interface(theFeature)
+{
+  if(initialize()) {
+    setBase(theBaseObjects);
+  }
+}
+
+//==================================================================================================
+BuildAPI_Edge::~BuildAPI_Edge()
+{
+
+}
+
+//==================================================================================================
+void BuildAPI_Edge::setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects)
+{
+  fillAttribute(theBaseObjects, mybaseObjects);
+
+  execute();
+}
+
+// TODO(spo): make add* as static functions of the class
+//==================================================================================================
+EdgePtr addEdge(const std::shared_ptr<ModelAPI_Document>& thePart,
+                const std::list<ModelHighAPI_Selection>& theBaseObjects)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(BuildAPI_Edge::ID());
+  return EdgePtr(new BuildAPI_Edge(aFeature, theBaseObjects));
+}
diff --git a/src/BuildAPI/BuildAPI_Edge.h b/src/BuildAPI/BuildAPI_Edge.h
new file mode 100644 (file)
index 0000000..6df02f7
--- /dev/null
@@ -0,0 +1,55 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File:        BuildAPI_Edge.h
+// Created:     09 June 2016
+// Author:      Dmitry Bobylev
+
+#ifndef BuildAPI_Edge_H_
+#define BuildAPI_Edge_H_
+
+#include "BuildAPI.h"
+
+#include <BuildPlugin_Edge.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Selection;
+
+/// \class BuildAPI_Edge
+/// \ingroup CPPHighAPI
+/// \brief Interface for Edge feature.
+class BuildAPI_Edge: public ModelHighAPI_Interface
+{
+public:
+  /// Constructor without values.
+  BUILDAPI_EXPORT
+  explicit BuildAPI_Edge(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+  /// Constructor with values.
+  BUILDAPI_EXPORT
+  explicit BuildAPI_Edge(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                         const std::list<ModelHighAPI_Selection>& theBaseObjects);
+
+  /// Destructor.
+  BUILDAPI_EXPORT
+  virtual ~BuildAPI_Edge();
+
+  INTERFACE_1(BuildPlugin_Edge::ID(),
+              baseObjects, BuildPlugin_Edge::BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList, /** Base objects */)
+
+  /// Modify base attribute of the feature.
+  BUILDAPI_EXPORT
+  void setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects);
+};
+
+/// Pointer on Edge object.
+typedef std::shared_ptr<BuildAPI_Edge> EdgePtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Edge feature.
+BUILDAPI_EXPORT
+EdgePtr addEdge(const std::shared_ptr<ModelAPI_Document>& thePart,
+                const std::list<ModelHighAPI_Selection>& theBaseObjects);
+
+#endif // BuildAPI_Edge_H_
index 68c4f4e90a88fc8f84e4d940cf267d223800d18e..dd947e8633ecb2f1a5e4cf0b92cb62afbbf41a4f 100644 (file)
@@ -9,6 +9,7 @@
 
   #include <ModelHighAPI_swig.h>
 
+  #include "BuildAPI_Edge.h"
   #include "BuildAPI_Vertex.h"
 
 #endif // FeaturesAPI_swig_H_
index f84136f59fae9eb0c8e0c5b9e68992b5d25909cc..51d197dde6e1ce3075675b735947abe520ada7d8 100644 (file)
@@ -4,10 +4,12 @@ INCLUDE(Common)
 
 SET(PROJECT_HEADERS
   BuildAPI.h
+  BuildAPI_Edge.h
   BuildAPI_Vertex.h
 )
 
 SET(PROJECT_SOURCES
+  BuildAPI_Edge.cpp
   BuildAPI_Vertex.cpp
 )