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

index 2fbc06a0239dab3dc72b13c24551692dcbd4d535..ff24e057145e0194dcfb230fcdaf93ddbb87037c 100644 (file)
 // shared pointers
 %shared_ptr(BuildAPI_Edge)
 %shared_ptr(BuildAPI_Face)
+%shared_ptr(BuildAPI_Shell)
 %shared_ptr(BuildAPI_Vertex)
 %shared_ptr(BuildAPI_Wire)
 
 // all supported interfaces
 %include "BuildAPI_Edge.h"
 %include "BuildAPI_Face.h"
+%include "BuildAPI_Shell.h"
 %include "BuildAPI_Vertex.h"
 %include "BuildAPI_Wire.h"
diff --git a/src/BuildAPI/BuildAPI_Shell.cpp b/src/BuildAPI/BuildAPI_Shell.cpp
new file mode 100644 (file)
index 0000000..d504c26
--- /dev/null
@@ -0,0 +1,49 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File:        BuildAPI_Shell.cpp
+// Created:     09 June 2016
+// Author:      Dmitry Bobylev
+
+#include "BuildAPI_Shell.h"
+
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+BuildAPI_Shell::BuildAPI_Shell(const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+  initialize();
+}
+
+//==================================================================================================
+BuildAPI_Shell::BuildAPI_Shell(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                               const std::list<ModelHighAPI_Selection>& theBaseObjects)
+: ModelHighAPI_Interface(theFeature)
+{
+  if(initialize()) {
+    setBase(theBaseObjects);
+  }
+}
+
+//==================================================================================================
+BuildAPI_Shell::~BuildAPI_Shell()
+{
+
+}
+
+//==================================================================================================
+void BuildAPI_Shell::setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects)
+{
+  fillAttribute(theBaseObjects, mybaseObjects);
+
+  execute();
+}
+
+// TODO(spo): make add* as static functions of the class
+//==================================================================================================
+ShellPtr addShell(const std::shared_ptr<ModelAPI_Document>& thePart,
+                  const std::list<ModelHighAPI_Selection>& theBaseObjects)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(BuildAPI_Shell::ID());
+  return ShellPtr(new BuildAPI_Shell(aFeature, theBaseObjects));
+}
diff --git a/src/BuildAPI/BuildAPI_Shell.h b/src/BuildAPI/BuildAPI_Shell.h
new file mode 100644 (file)
index 0000000..3b7fbef
--- /dev/null
@@ -0,0 +1,55 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File:        BuildAPI_Shell.h
+// Created:     09 June 2016
+// Author:      Dmitry Bobylev
+
+#ifndef BuildAPI_Shell_H_
+#define BuildAPI_Shell_H_
+
+#include "BuildAPI.h"
+
+#include <BuildPlugin_Shell.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Selection;
+
+/// \class BuildAPI_Shell
+/// \ingroup CPPHighAPI
+/// \brief Interface for Shell feature.
+class BuildAPI_Shell: public ModelHighAPI_Interface
+{
+public:
+  /// Constructor without values.
+  BUILDAPI_EXPORT
+  explicit BuildAPI_Shell(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+  /// Constructor with values.
+  BUILDAPI_EXPORT
+  explicit BuildAPI_Shell(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                          const std::list<ModelHighAPI_Selection>& theBaseObjects);
+
+  /// Destructor.
+  BUILDAPI_EXPORT
+  virtual ~BuildAPI_Shell();
+
+  INTERFACE_1(BuildPlugin_Shell::ID(),
+              baseObjects, BuildPlugin_Shell::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 Shell object.
+typedef std::shared_ptr<BuildAPI_Shell> ShellPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Shell feature.
+BUILDAPI_EXPORT
+ShellPtr addShell(const std::shared_ptr<ModelAPI_Document>& thePart,
+                  const std::list<ModelHighAPI_Selection>& theBaseObjects);
+
+#endif // BuildAPI_Shell_H_
index a1827f0024b9495573cd91e3fc0de624fa884745..634ade0b99950348179b446162b57a831af54d29 100644 (file)
@@ -11,6 +11,7 @@
 
   #include "BuildAPI_Edge.h"
   #include "BuildAPI_Face.h"
+  #include "BuildAPI_Shell.h"
   #include "BuildAPI_Vertex.h"
   #include "BuildAPI_Wire.h"
 
index 1fe462f77840c92e152b2eca6bccdc3a7fa5b7a8..695b8e03a3c8577674c8513fa2e8c88f0964ccd0 100644 (file)
@@ -6,6 +6,7 @@ SET(PROJECT_HEADERS
   BuildAPI.h
   BuildAPI_Edge.h
   BuildAPI_Face.h
+  BuildAPI_Shell.h
   BuildAPI_Vertex.h
   BuildAPI_Wire.h
 )
@@ -13,6 +14,7 @@ SET(PROJECT_HEADERS
 SET(PROJECT_SOURCES
   BuildAPI_Edge.cpp
   BuildAPI_Face.cpp
+  BuildAPI_Shell.cpp
   BuildAPI_Vertex.cpp
   BuildAPI_Wire.cpp
 )