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

index ff24e057145e0194dcfb230fcdaf93ddbb87037c..af873f9793144a3ad873e3f2373d7649d6c1dec9 100644 (file)
@@ -22,6 +22,7 @@
 %shared_ptr(BuildAPI_Edge)
 %shared_ptr(BuildAPI_Face)
 %shared_ptr(BuildAPI_Shell)
+%shared_ptr(BuildAPI_SubShapes)
 %shared_ptr(BuildAPI_Vertex)
 %shared_ptr(BuildAPI_Wire)
 
@@ -29,5 +30,6 @@
 %include "BuildAPI_Edge.h"
 %include "BuildAPI_Face.h"
 %include "BuildAPI_Shell.h"
+%include "BuildAPI_SubShapes.h"
 %include "BuildAPI_Vertex.h"
 %include "BuildAPI_Wire.h"
diff --git a/src/BuildAPI/BuildAPI_SubShapes.cpp b/src/BuildAPI/BuildAPI_SubShapes.cpp
new file mode 100644 (file)
index 0000000..b6e2a72
--- /dev/null
@@ -0,0 +1,60 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File:        BuildAPI_SubShapes.cpp
+// Created:     09 June 2016
+// Author:      Dmitry Bobylev
+
+#include "BuildAPI_SubShapes.h"
+
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+BuildAPI_SubShapes::BuildAPI_SubShapes(const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+  initialize();
+}
+
+//==================================================================================================
+BuildAPI_SubShapes::BuildAPI_SubShapes(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                                       const ModelHighAPI_Selection& theBaseShape,
+                                       const std::list<ModelHighAPI_Selection>& theSubShapes)
+: ModelHighAPI_Interface(theFeature)
+{
+  if(initialize()) {
+    fillAttribute(theBaseShape, mybaseShape);
+    setSubShapes(theSubShapes);
+  }
+}
+
+//==================================================================================================
+BuildAPI_SubShapes::~BuildAPI_SubShapes()
+{
+
+}
+
+//==================================================================================================
+void BuildAPI_SubShapes::setBaseShape(const ModelHighAPI_Selection& theBaseShape)
+{
+  fillAttribute(theBaseShape, mybaseShape);
+
+  execute();
+}
+
+//==================================================================================================
+void BuildAPI_SubShapes::setSubShapes(const std::list<ModelHighAPI_Selection>& theSubShapes)
+{
+  fillAttribute(theSubShapes, mysubShapes);
+
+  execute();
+}
+
+// TODO(spo): make add* as static functions of the class
+//==================================================================================================
+SubShapesPtr addSubShapes(const std::shared_ptr<ModelAPI_Document>& thePart,
+                          const ModelHighAPI_Selection& theBaseShape,
+                          const std::list<ModelHighAPI_Selection>& theSubShapes)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(BuildAPI_SubShapes::ID());
+  return SubShapesPtr(new BuildAPI_SubShapes(aFeature, theBaseShape, theSubShapes));
+}
diff --git a/src/BuildAPI/BuildAPI_SubShapes.h b/src/BuildAPI/BuildAPI_SubShapes.h
new file mode 100644 (file)
index 0000000..b8108f5
--- /dev/null
@@ -0,0 +1,62 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File:        BuildAPI_SubShapes.h
+// Created:     09 June 2016
+// Author:      Dmitry Bobylev
+
+#ifndef BuildAPI_SubShapes_H_
+#define BuildAPI_SubShapes_H_
+
+#include "BuildAPI.h"
+
+#include <BuildPlugin_SubShapes.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Selection;
+
+/// \class BuildAPI_SubShapes
+/// \ingroup CPPHighAPI
+/// \brief Interface for SubShapes feature.
+class BuildAPI_SubShapes: public ModelHighAPI_Interface
+{
+public:
+  /// Constructor without values.
+  BUILDAPI_EXPORT
+  explicit BuildAPI_SubShapes(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+  /// Constructor with values.
+  BUILDAPI_EXPORT
+  explicit BuildAPI_SubShapes(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                              const ModelHighAPI_Selection& theBaseShape,
+                              const std::list<ModelHighAPI_Selection>& theSubShapes);
+
+  /// Destructor.
+  BUILDAPI_EXPORT
+  virtual ~BuildAPI_SubShapes();
+
+  INTERFACE_2(BuildPlugin_SubShapes::ID(),
+              baseShape, BuildPlugin_SubShapes::BASE_SHAPE_ID(), ModelAPI_AttributeSelection, /** Base shape */,
+              subShapes, BuildPlugin_SubShapes::SUBSHAPES_ID(), ModelAPI_AttributeSelectionList, /** Sub-shapes */)
+
+  /// Modify base attribute of the feature.
+  BUILDAPI_EXPORT
+  void setBaseShape(const ModelHighAPI_Selection& theBaseShape);
+
+  /// Modify sub-shapes attribute of the feature.
+  BUILDAPI_EXPORT
+  void setSubShapes(const std::list<ModelHighAPI_Selection>& theSubShapes);
+};
+
+/// Pointer on SubShapes object.
+typedef std::shared_ptr<BuildAPI_SubShapes> SubShapesPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create SubShapes feature.
+BUILDAPI_EXPORT
+SubShapesPtr addSubShapes(const std::shared_ptr<ModelAPI_Document>& thePart,
+                          const ModelHighAPI_Selection& theBaseShape,
+                          const std::list<ModelHighAPI_Selection>& theSubShapes);
+
+#endif // BuildAPI_SubShapes_H_
index 634ade0b99950348179b446162b57a831af54d29..332db7b2a5f6499ea48c6ad4289376d8ad2a0d6d 100644 (file)
@@ -12,6 +12,7 @@
   #include "BuildAPI_Edge.h"
   #include "BuildAPI_Face.h"
   #include "BuildAPI_Shell.h"
+  #include "BuildAPI_SubShapes.h"
   #include "BuildAPI_Vertex.h"
   #include "BuildAPI_Wire.h"
 
index 695b8e03a3c8577674c8513fa2e8c88f0964ccd0..0d3073bd68160db7845e97948d1995ab1e9cbe25 100644 (file)
@@ -7,6 +7,7 @@ SET(PROJECT_HEADERS
   BuildAPI_Edge.h
   BuildAPI_Face.h
   BuildAPI_Shell.h
+  BuildAPI_SubShapes.h
   BuildAPI_Vertex.h
   BuildAPI_Wire.h
 )
@@ -15,6 +16,7 @@ SET(PROJECT_SOURCES
   BuildAPI_Edge.cpp
   BuildAPI_Face.cpp
   BuildAPI_Shell.cpp
+  BuildAPI_SubShapes.cpp
   BuildAPI_Vertex.cpp
   BuildAPI_Wire.cpp
 )