]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Added CPP High API for FeaturesPlugin_RemoveSubShapes
authordbv <dbv@opencascade.com>
Thu, 16 Jun 2016 14:37:34 +0000 (17:37 +0300)
committerspo <sergey.pokhodenko@opencascade.com>
Fri, 17 Jun 2016 11:41:12 +0000 (14:41 +0300)
src/FeaturesAPI/CMakeLists.txt
src/FeaturesAPI/FeaturesAPI.i
src/FeaturesAPI/FeaturesAPI_RemoveSubShapes.cpp [new file with mode: 0644]
src/FeaturesAPI/FeaturesAPI_RemoveSubShapes.h [new file with mode: 0644]
src/FeaturesAPI/FeaturesAPI_swig.h

index acd90db778e018a336a45c6fcf0fe6aed32beed7..ac6f97e99a42858b609d2b4c29cf904dbbe50584 100644 (file)
@@ -12,6 +12,7 @@ SET(PROJECT_HEADERS
   FeaturesAPI_Partition.h
   FeaturesAPI_Pipe.h
   FeaturesAPI_Placement.h
+  FeaturesAPI_RemoveSubShapes.h
   FeaturesAPI_Revolution.h
   FeaturesAPI_RevolutionBoolean.h
   FeaturesAPI_Rotation.h
@@ -27,9 +28,10 @@ SET(PROJECT_SOURCES
   FeaturesAPI_Partition.cpp
   FeaturesAPI_Pipe.cpp
   FeaturesAPI_Placement.cpp
-  FeaturesAPI_Rotation.cpp
+  FeaturesAPI_RemoveSubShapes.cpp
   FeaturesAPI_Revolution.cpp
   FeaturesAPI_RevolutionBoolean.cpp
+  FeaturesAPI_Rotation.cpp
   FeaturesAPI_Translation.cpp
 )
 
index e4dd0c75465e05a2399e952f7b6d75e44b8d9211..748634b664a47bf2091123e5faebbca7070ecaa1 100644 (file)
@@ -29,6 +29,7 @@
 %shared_ptr(FeaturesAPI_Partition)
 %shared_ptr(FeaturesAPI_Pipe)
 %shared_ptr(FeaturesAPI_Placement)
+%shared_ptr(FeaturesAPI_RemoveSubShapes)
 %shared_ptr(FeaturesAPI_Revolution)
 %shared_ptr(FeaturesAPI_RevolutionBoolean)
 %shared_ptr(FeaturesAPI_RevolutionCut)
@@ -45,6 +46,7 @@
 %include "FeaturesAPI_Partition.h"
 %include "FeaturesAPI_Pipe.h"
 %include "FeaturesAPI_Placement.h"
+%include "FeaturesAPI_RemoveSubShapes.h"
 %include "FeaturesAPI_Revolution.h"
 %include "FeaturesAPI_RevolutionBoolean.h"
 %include "FeaturesAPI_Rotation.h"
diff --git a/src/FeaturesAPI/FeaturesAPI_RemoveSubShapes.cpp b/src/FeaturesAPI/FeaturesAPI_RemoveSubShapes.cpp
new file mode 100644 (file)
index 0000000..79c3c6f
--- /dev/null
@@ -0,0 +1,59 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File:        FeaturesAPI_RemoveSubShapes.cpp
+// Created:     09 June 2016
+// Author:      Dmitry Bobylev
+
+#include "FeaturesAPI_RemoveSubShapes.h"
+
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+FeaturesAPI_RemoveSubShapes::FeaturesAPI_RemoveSubShapes(const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+  initialize();
+}
+
+//==================================================================================================
+FeaturesAPI_RemoveSubShapes::FeaturesAPI_RemoveSubShapes(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                                                         const ModelHighAPI_Selection& theBase)
+: ModelHighAPI_Interface(theFeature)
+{
+  if(initialize()) {
+    setBase(theBase);
+
+    execute();
+  }
+}
+
+//==================================================================================================
+FeaturesAPI_RemoveSubShapes::~FeaturesAPI_RemoveSubShapes()
+{
+
+}
+
+//==================================================================================================
+void FeaturesAPI_RemoveSubShapes::setBase(const ModelHighAPI_Selection& theBase)
+{
+  fillAttribute(theBase, mybase);
+
+  execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_RemoveSubShapes::setSubShapesToKeep(const std::list<ModelHighAPI_Selection>& theSubShapes)
+{
+  fillAttribute(theSubShapes, mysubshapes);
+
+  execute();
+}
+
+// TODO(spo): make add* as static functions of the class
+//==================================================================================================
+RemoveSubShapesPtr addRemoveSubShapes(const std::shared_ptr<ModelAPI_Document>& thePart,
+                                      const ModelHighAPI_Selection& theBase)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_RemoveSubShapes::ID());
+  return RemoveSubShapesPtr(new FeaturesAPI_RemoveSubShapes(aFeature, theBase));
+}
diff --git a/src/FeaturesAPI/FeaturesAPI_RemoveSubShapes.h b/src/FeaturesAPI/FeaturesAPI_RemoveSubShapes.h
new file mode 100644 (file)
index 0000000..d4de1dc
--- /dev/null
@@ -0,0 +1,60 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File:        FeaturesAPI_RemoveSubShapes.h
+// Created:     09 June 2016
+// Author:      Dmitry Bobylev
+
+#ifndef FeaturesAPI_RemoveSubShapes_H_
+#define FeaturesAPI_RemoveSubShapes_H_
+
+#include "FeaturesAPI.h"
+
+#include <FeaturesPlugin_RemoveSubShapes.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_RemoveSubShapes
+/// \ingroup CPPHighAPI
+/// \brief Interface for RemoveSubShapes feature.
+class FeaturesAPI_RemoveSubShapes: public ModelHighAPI_Interface
+{
+public:
+  /// Constructor without values.
+  FEATURESAPI_EXPORT
+  explicit FeaturesAPI_RemoveSubShapes(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+  /// Constructor with values.
+  FEATURESAPI_EXPORT
+  explicit FeaturesAPI_RemoveSubShapes(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                                       const ModelHighAPI_Selection& theBase);
+
+  /// Destructor.
+  FEATURESAPI_EXPORT
+  virtual ~FeaturesAPI_RemoveSubShapes();
+
+  INTERFACE_2(FeaturesPlugin_RemoveSubShapes::ID(),
+              base, FeaturesPlugin_RemoveSubShapes::BASE_SHAPE_ID(), ModelAPI_AttributeSelection, /** Base */,
+              subshapes, FeaturesPlugin_RemoveSubShapes::SUBSHAPES_ID(), ModelAPI_AttributeSelectionList, /** Subshapes */)
+
+  /// Modify objects attribute of the feature.
+  FEATURESAPI_EXPORT
+  void setBase(const ModelHighAPI_Selection& theBase);
+
+  /// Modify tools attribute of the feature.
+  FEATURESAPI_EXPORT
+  void setSubShapesToKeep(const std::list<ModelHighAPI_Selection>& theSubShapes);
+};
+
+/// Pointer on RemoveSubShapes object.
+typedef std::shared_ptr<FeaturesAPI_RemoveSubShapes> RemoveSubShapesPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create RemoveSubShapes feature.
+FEATURESAPI_EXPORT
+RemoveSubShapesPtr addRemoveSubShapes(const std::shared_ptr<ModelAPI_Document>& thePart,
+                                      const ModelHighAPI_Selection& theBase);
+
+#endif // FeaturesAPI_RemoveSubShapes_H_
index b88b1f92296bf45ad0683692a2da61fbc271eb22..0710405ad894fa33b747c4885a0a77fa6ed91eb5 100644 (file)
@@ -18,6 +18,7 @@
   #include "FeaturesAPI_Partition.h"
   #include "FeaturesAPI_Pipe.h"
   #include "FeaturesAPI_Placement.h"
+  #include "FeaturesAPI_RemoveSubShapes.h"
   #include "FeaturesAPI_Revolution.h"
   #include "FeaturesAPI_RevolutionBoolean.h"
   #include "FeaturesAPI_Rotation.h"