]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Added CPP High API for FeaturesPlugin_Intersection
authordbv <dbv@opencascade.com>
Thu, 16 Jun 2016 13:59:57 +0000 (16:59 +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_Intersection.cpp [new file with mode: 0644]
src/FeaturesAPI/FeaturesAPI_Intersection.h [new file with mode: 0644]
src/FeaturesAPI/FeaturesAPI_swig.h

index e8c007d9491b4dd12d43bfcdf1ed603d8584783f..acd90db778e018a336a45c6fcf0fe6aed32beed7 100644 (file)
@@ -8,6 +8,7 @@ SET(PROJECT_HEADERS
   FeaturesAPI_Extrusion.h
   FeaturesAPI_ExtrusionBoolean.h
   FeaturesAPI_Group.h
+  FeaturesAPI_Intersection.h
   FeaturesAPI_Partition.h
   FeaturesAPI_Pipe.h
   FeaturesAPI_Placement.h
@@ -22,6 +23,7 @@ SET(PROJECT_SOURCES
   FeaturesAPI_Extrusion.cpp
   FeaturesAPI_ExtrusionBoolean.cpp
   FeaturesAPI_Group.cpp
+  FeaturesAPI_Intersection.cpp
   FeaturesAPI_Partition.cpp
   FeaturesAPI_Pipe.cpp
   FeaturesAPI_Placement.cpp
index 79bb8c73e11c372d3f5e93e8bdc370dac0be616d..e4dd0c75465e05a2399e952f7b6d75e44b8d9211 100644 (file)
@@ -25,6 +25,7 @@
 %shared_ptr(FeaturesAPI_ExtrusionCut)
 %shared_ptr(FeaturesAPI_ExtrusionFuse)
 %shared_ptr(FeaturesAPI_Group)
+%shared_ptr(FeaturesAPI_Intersection)
 %shared_ptr(FeaturesAPI_Partition)
 %shared_ptr(FeaturesAPI_Pipe)
 %shared_ptr(FeaturesAPI_Placement)
@@ -40,6 +41,7 @@
 %include "FeaturesAPI_Extrusion.h"
 %include "FeaturesAPI_ExtrusionBoolean.h"
 %include "FeaturesAPI_Group.h"
+%include "FeaturesAPI_Intersection.h"
 %include "FeaturesAPI_Partition.h"
 %include "FeaturesAPI_Pipe.h"
 %include "FeaturesAPI_Placement.h"
diff --git a/src/FeaturesAPI/FeaturesAPI_Intersection.cpp b/src/FeaturesAPI/FeaturesAPI_Intersection.cpp
new file mode 100644 (file)
index 0000000..cefd80e
--- /dev/null
@@ -0,0 +1,62 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File:        FeaturesAPI_Intersection.cpp
+// Created:     09 June 2016
+// Author:      Dmitry Bobylev
+
+#include "FeaturesAPI_Intersection.h"
+
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+FeaturesAPI_Intersection::FeaturesAPI_Intersection(const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+  initialize();
+}
+
+//==================================================================================================
+FeaturesAPI_Intersection::FeaturesAPI_Intersection(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                                                   const std::list<ModelHighAPI_Selection>& theObjects,
+                                                   const std::list<ModelHighAPI_Selection>& theTools)
+: ModelHighAPI_Interface(theFeature)
+{
+  if(initialize()) {
+    fillAttribute(theObjects, myobjects);
+    fillAttribute(theTools, mytools);
+
+    execute();
+  }
+}
+
+//==================================================================================================
+FeaturesAPI_Intersection::~FeaturesAPI_Intersection()
+{
+
+}
+
+//==================================================================================================
+void FeaturesAPI_Intersection::setObjects(const std::list<ModelHighAPI_Selection>& theObjects)
+{
+  fillAttribute(theObjects, myobjects);
+
+  execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Intersection::setTools(const std::list<ModelHighAPI_Selection>& theTools)
+{
+  fillAttribute(theTools, mytools);
+
+  execute();
+}
+
+// TODO(spo): make add* as static functions of the class
+//==================================================================================================
+IntersectionPtr addIntersection(const std::shared_ptr<ModelAPI_Document>& thePart,
+                                const std::list<ModelHighAPI_Selection>& theObjects,
+                                const std::list<ModelHighAPI_Selection>& theTools)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Intersection::ID());
+  return IntersectionPtr(new FeaturesAPI_Intersection(aFeature, theObjects, theTools));
+}
diff --git a/src/FeaturesAPI/FeaturesAPI_Intersection.h b/src/FeaturesAPI/FeaturesAPI_Intersection.h
new file mode 100644 (file)
index 0000000..440e430
--- /dev/null
@@ -0,0 +1,62 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File:        FeaturesAPI_Intersection.h
+// Created:     09 June 2016
+// Author:      Dmitry Bobylev
+
+#ifndef FeaturesAPI_Intersection_H_
+#define FeaturesAPI_Intersection_H_
+
+#include "FeaturesAPI.h"
+
+#include <FeaturesPlugin_Intersection.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_Intersection
+/// \ingroup CPPHighAPI
+/// \brief Interface for Intersection feature.
+class FeaturesAPI_Intersection: public ModelHighAPI_Interface
+{
+public:
+  /// Constructor without values.
+  FEATURESAPI_EXPORT
+  explicit FeaturesAPI_Intersection(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+  /// Constructor with values.
+  FEATURESAPI_EXPORT
+  explicit FeaturesAPI_Intersection(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                                    const std::list<ModelHighAPI_Selection>& theObjects,
+                                    const std::list<ModelHighAPI_Selection>& theTools);
+
+  /// Destructor.
+  FEATURESAPI_EXPORT
+  virtual ~FeaturesAPI_Intersection();
+
+  INTERFACE_2(FeaturesPlugin_Intersection::ID(),
+              objects, FeaturesPlugin_Intersection::OBJECT_LIST_ID(), ModelAPI_AttributeSelectionList, /** Objects */,
+              tools, FeaturesPlugin_Intersection::TOOL_LIST_ID(), ModelAPI_AttributeSelectionList, /** Tools */)
+
+  /// Modify objects attribute of the feature.
+  FEATURESAPI_EXPORT
+  void setObjects(const std::list<ModelHighAPI_Selection>& theObjects);
+
+  /// Modify tools attribute of the feature.
+  FEATURESAPI_EXPORT
+  void setTools(const std::list<ModelHighAPI_Selection>& theTools);
+};
+
+/// Pointer on Intersection object.
+typedef std::shared_ptr<FeaturesAPI_Intersection> IntersectionPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Intersection feature.
+FEATURESAPI_EXPORT
+IntersectionPtr addIntersection(const std::shared_ptr<ModelAPI_Document>& thePart,
+                                const std::list<ModelHighAPI_Selection>& theObjects,
+                                const std::list<ModelHighAPI_Selection>& theTools);
+
+#endif // FeaturesAPI_Intersection_H_
index 4eef6fd21675d79bcdf8a93d7520129018fda821..b88b1f92296bf45ad0683692a2da61fbc271eb22 100644 (file)
@@ -14,6 +14,7 @@
   #include "FeaturesAPI_Extrusion.h"
   #include "FeaturesAPI_ExtrusionBoolean.h"
   #include "FeaturesAPI_Group.h"
+  #include "FeaturesAPI_Intersection.h"
   #include "FeaturesAPI_Partition.h"
   #include "FeaturesAPI_Pipe.h"
   #include "FeaturesAPI_Placement.h"