]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Add Projection to SketchAPI_Sketch
authorspo <sergey.pokhodenko@opencascade.com>
Thu, 16 Jun 2016 11:38:17 +0000 (14:38 +0300)
committerspo <sergey.pokhodenko@opencascade.com>
Fri, 17 Jun 2016 11:41:11 +0000 (14:41 +0300)
src/SketchAPI/CMakeLists.txt
src/SketchAPI/SketchAPI.i
src/SketchAPI/SketchAPI_Projection.cpp [new file with mode: 0644]
src/SketchAPI/SketchAPI_Projection.h [new file with mode: 0644]
src/SketchAPI/SketchAPI_Sketch.cpp
src/SketchAPI/SketchAPI_Sketch.h
src/SketchAPI/SketchAPI_swig.h

index a8b5cc28482b08a964bbb62dffe007623e2edd7b..e0ab0cfa2ab5f5c9eb4b732432e77614c07b04ab 100644 (file)
@@ -12,6 +12,7 @@ SET(PROJECT_HEADERS
   SketchAPI_Sketch.h
   SketchAPI_SketchEntity.h
   SketchAPI_Point.h
+  SketchAPI_Projection.h
   SketchAPI_Rotation.h
   SketchAPI_Translation.h
 )
@@ -25,6 +26,7 @@ SET(PROJECT_SOURCES
   SketchAPI_Sketch.cpp
   SketchAPI_SketchEntity.cpp
   SketchAPI_Point.cpp
+  SketchAPI_Projection.cpp
   SketchAPI_Rotation.cpp
   SketchAPI_Translation.cpp
 )
index b6c25fee4c6b20190cf1785d792bed70d93d8f2f..955249b70b921ec48453eb172a3be98e505e7247 100644 (file)
@@ -28,6 +28,7 @@
 %shared_ptr(SketchAPI_Sketch)
 %shared_ptr(SketchAPI_SketchEntity)
 %shared_ptr(SketchAPI_Point)
+%shared_ptr(SketchAPI_Projection)
 %shared_ptr(SketchAPI_Rotation)
 %shared_ptr(SketchAPI_Translation)
 
 %include "SketchAPI_Line.h"
 %include "SketchAPI_Circle.h"
 %include "SketchAPI_Arc.h"
+%include "SketchAPI_Projection.h"
 %include "SketchAPI_Mirror.h"
 %include "SketchAPI_Translation.h"
 %include "SketchAPI_Rotation.h"
diff --git a/src/SketchAPI/SketchAPI_Projection.cpp b/src/SketchAPI/SketchAPI_Projection.cpp
new file mode 100644 (file)
index 0000000..7ac33fc
--- /dev/null
@@ -0,0 +1,42 @@
+// Name   : SketchAPI_Projection.cpp
+// Purpose: 
+//
+// History:
+// 16/06/16 - Sergey POKHODENKO - Creation of the file
+
+//--------------------------------------------------------------------------------------
+#include "SketchAPI_Projection.h"
+//--------------------------------------------------------------------------------------
+#include <ModelHighAPI_Tools.h>
+//--------------------------------------------------------------------------------------
+SketchAPI_Projection::SketchAPI_Projection(
+    const std::shared_ptr<ModelAPI_Feature> & theFeature)
+: SketchAPI_SketchEntity(theFeature)
+{
+  initialize();
+}
+
+SketchAPI_Projection::SketchAPI_Projection(
+    const std::shared_ptr<ModelAPI_Feature> & theFeature,
+    const ModelHighAPI_Selection & theExternalFeature )
+: SketchAPI_SketchEntity(theFeature)
+{
+  if (initialize()) {
+    setExternalFeature(theExternalFeature);
+  }
+}
+
+SketchAPI_Projection::~SketchAPI_Projection()
+{
+
+}
+
+//--------------------------------------------------------------------------------------
+void SketchAPI_Projection::setExternalFeature(const ModelHighAPI_Selection & theExternalFeature)
+{
+  fillAttribute(theExternalFeature, externalFeature());
+
+  execute();
+}
+
+//--------------------------------------------------------------------------------------
diff --git a/src/SketchAPI/SketchAPI_Projection.h b/src/SketchAPI/SketchAPI_Projection.h
new file mode 100644 (file)
index 0000000..cf18e20
--- /dev/null
@@ -0,0 +1,53 @@
+// Name   : SketchAPI_Projection.h
+// Purpose: 
+//
+// History:
+// 16/06/16 - Sergey POKHODENKO - Creation of the file
+
+#ifndef SRC_SKETCHAPI_SKETCHAPI_PROJECTION_H_
+#define SRC_SKETCHAPI_SKETCHAPI_PROJECTION_H_
+
+//--------------------------------------------------------------------------------------
+#include "SketchAPI.h"
+
+#include <SketchPlugin_Projection.h>
+
+#include "SketchAPI_SketchEntity.h"
+//--------------------------------------------------------------------------------------
+class ModelHighAPI_Selection;
+//--------------------------------------------------------------------------------------
+/**\class SketchAPI_Projection
+ * \ingroup CPPHighAPI
+ * \brief Interface for Projection feature
+ */
+class SketchAPI_Projection : public SketchAPI_SketchEntity
+{
+public:
+  /// Constructor without values
+  SKETCHAPI_EXPORT
+  explicit SketchAPI_Projection(const std::shared_ptr<ModelAPI_Feature> & theFeature);
+  /// Constructor with values
+  SKETCHAPI_EXPORT
+  SketchAPI_Projection(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+                       const ModelHighAPI_Selection & theExternalFeature);
+  /// Destructor
+  SKETCHAPI_EXPORT
+  virtual ~SketchAPI_Projection();
+
+  INTERFACE_3(SketchPlugin_Projection::ID(),
+              externalFeature, SketchPlugin_Projection::EXTERNAL_FEATURE_ID(), ModelAPI_AttributeSelection, /** External feature */,
+              projectedFeature, SketchPlugin_Projection::EXTERNAL_FEATURE_ID(), ModelAPI_AttributeRefAttr, /** Projected feature */,
+              external, SketchPlugin_Projection::EXTERNAL_ID(), ModelAPI_AttributeSelection, /** External */
+  )
+
+  /// Set external feature
+  SKETCHAPI_EXPORT
+  void setExternalFeature(const ModelHighAPI_Selection & theExternalLine);
+};
+
+//! Pointer on Projection object
+typedef std::shared_ptr<SketchAPI_Projection> ProjectionPtr;
+
+//--------------------------------------------------------------------------------------
+//--------------------------------------------------------------------------------------
+#endif /* SRC_SKETCHAPI_SKETCHAPI_PROJECTION_H_ */
index 4accfa347f7b3ff542a119b81dcff82ff84e0827..bf97b9809011030a37a957999334819de804989a 100644 (file)
@@ -37,6 +37,7 @@
 #include "SketchAPI_Line.h"
 #include "SketchAPI_Mirror.h"
 #include "SketchAPI_Point.h"
+#include "SketchAPI_Projection.h"
 #include "SketchAPI_Rotation.h"
 #include "SketchAPI_Translation.h"
 //--------------------------------------------------------------------------------------
@@ -331,6 +332,14 @@ std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(const std::string & theE
   return ArcPtr(new SketchAPI_Arc(aFeature, theExternalName));
 }
 
+//--------------------------------------------------------------------------------------
+std::shared_ptr<SketchAPI_Projection> SketchAPI_Sketch::addProjection(
+    const ModelHighAPI_Selection & theExternalFeature)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Projection::ID());
+  return ProjectionPtr(new SketchAPI_Projection(aFeature, theExternalFeature));
+}
+
 //--------------------------------------------------------------------------------------
 std::shared_ptr<SketchAPI_Mirror> SketchAPI_Sketch::addMirror(
     const ModelHighAPI_RefAttr & theMirrorLine,
index 2f7694921e7c0c1574946c6f7f3cc31b7ec56986..9fd874bc9564a0c227c8356cf79ea557a7ccf51b 100644 (file)
@@ -30,6 +30,7 @@ class SketchAPI_IntersectionPoint;
 class SketchAPI_Line;
 class SketchAPI_Mirror;
 class SketchAPI_Point;
+class SketchAPI_Projection;
 class SketchAPI_Rotation;
 class SketchAPI_Translation;
 //--------------------------------------------------------------------------------------
@@ -194,6 +195,11 @@ public:
   SKETCHAPI_EXPORT
   std::shared_ptr<SketchAPI_Arc> addArc(const std::string & theExternalName);
 
+  /// Add projection
+  SKETCHAPI_EXPORT
+  std::shared_ptr<SketchAPI_Projection> addProjection(
+      const ModelHighAPI_Selection & theExternalFeature);
+
   /// Add mirror
   SKETCHAPI_EXPORT
   std::shared_ptr<SketchAPI_Mirror> addMirror(
index 1280b96a68c8be3883362c571d16ddfc9fe697b7..a8b2bfbc53287e5adc2c44ac50fe977a11117193 100644 (file)
@@ -18,6 +18,7 @@
   #include "SketchAPI_Sketch.h"
   #include "SketchAPI_SketchEntity.h"
   #include "SketchAPI_Point.h"
+  #include "SketchAPI_Projection.h"
   #include "SketchAPI_Rotation.h"
   #include "SketchAPI_Translation.h"