]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Add IntersectionPoint
authorspo <sergey.pokhodenko@opencascade.com>
Thu, 16 Jun 2016 11:10:24 +0000 (14:10 +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_IntersectionPoint.cpp [new file with mode: 0644]
src/SketchAPI/SketchAPI_IntersectionPoint.h [new file with mode: 0644]
src/SketchAPI/SketchAPI_swig.h

index af46034386d567e88d475de087ae2200334369f3..a8b5cc28482b08a964bbb62dffe007623e2edd7b 100644 (file)
@@ -6,6 +6,7 @@ SET(PROJECT_HEADERS
   SketchAPI.h
   SketchAPI_Arc.h
   SketchAPI_Circle.h
+  SketchAPI_IntersectionPoint.h
   SketchAPI_Line.h
   SketchAPI_Mirror.h
   SketchAPI_Sketch.h
@@ -18,6 +19,7 @@ SET(PROJECT_HEADERS
 SET(PROJECT_SOURCES
   SketchAPI_Arc.cpp
   SketchAPI_Circle.cpp
+  SketchAPI_IntersectionPoint.cpp
   SketchAPI_Line.cpp
   SketchAPI_Mirror.cpp
   SketchAPI_Sketch.cpp
index c3b13cba16f65a03b64812cd4e4997aaf569cacb..b6c25fee4c6b20190cf1785d792bed70d93d8f2f 100644 (file)
@@ -22,6 +22,7 @@
 // shared pointers
 %shared_ptr(SketchAPI_Arc)
 %shared_ptr(SketchAPI_Circle)
+%shared_ptr(SketchAPI_IntersectionPoint)
 %shared_ptr(SketchAPI_Line)
 %shared_ptr(SketchAPI_Mirror)
 %shared_ptr(SketchAPI_Sketch)
 // all supported interfaces (the order is very important according dependencies: base class first)
 %include "SketchAPI_SketchEntity.h"
 %include "SketchAPI_Point.h"
+%include "SketchAPI_IntersectionPoint.h"
 %include "SketchAPI_Line.h"
 %include "SketchAPI_Circle.h"
 %include "SketchAPI_Arc.h"
diff --git a/src/SketchAPI/SketchAPI_IntersectionPoint.cpp b/src/SketchAPI/SketchAPI_IntersectionPoint.cpp
new file mode 100644 (file)
index 0000000..e2e8f88
--- /dev/null
@@ -0,0 +1,62 @@
+// Name   : SketchAPI_IntersectionPoint.cpp
+// Purpose: 
+//
+// History:
+// 15/06/16 - Sergey POKHODENKO - Creation of the file
+
+//--------------------------------------------------------------------------------------
+#include "SketchAPI_IntersectionPoint.h"
+//--------------------------------------------------------------------------------------
+#include <GeomAPI_Pnt2d.h>
+//--------------------------------------------------------------------------------------
+#include <ModelHighAPI_Selection.h>
+#include <ModelHighAPI_Tools.h>
+//--------------------------------------------------------------------------------------
+SketchAPI_IntersectionPoint::SketchAPI_IntersectionPoint(
+    const std::shared_ptr<ModelAPI_Feature> & theFeature)
+: SketchAPI_SketchEntity(theFeature)
+{
+  initialize();
+}
+
+SketchAPI_IntersectionPoint::SketchAPI_IntersectionPoint(
+    const std::shared_ptr<ModelAPI_Feature> & theFeature,
+    const ModelHighAPI_Selection & theExternal )
+: SketchAPI_SketchEntity(theFeature)
+{
+  if (initialize()) {
+    setByExternalLine(theExternal);
+  }
+}
+
+SketchAPI_IntersectionPoint::SketchAPI_IntersectionPoint(
+    const std::shared_ptr<ModelAPI_Feature> & theFeature,
+    const std::string & theExternalName )
+: SketchAPI_SketchEntity(theFeature)
+{
+  if (initialize()) {
+    setByExternalLineName(theExternalName);
+  }
+}
+
+SketchAPI_IntersectionPoint::~SketchAPI_IntersectionPoint()
+{
+
+}
+
+//--------------------------------------------------------------------------------------
+void SketchAPI_IntersectionPoint::setByExternalLine(const ModelHighAPI_Selection & theExternalLine)
+{
+  fillAttribute(theExternalLine, externalLine());
+
+  execute();
+}
+
+void SketchAPI_IntersectionPoint::setByExternalLineName(const std::string & theExternalLineName)
+{
+  fillAttribute(ModelHighAPI_Selection("EDGE", theExternalLineName), externalLine());
+
+  execute();
+}
+
+//--------------------------------------------------------------------------------------
diff --git a/src/SketchAPI/SketchAPI_IntersectionPoint.h b/src/SketchAPI/SketchAPI_IntersectionPoint.h
new file mode 100644 (file)
index 0000000..bf5ce37
--- /dev/null
@@ -0,0 +1,60 @@
+// Name   : SketchAPI_IntersectionPoint.h
+// Purpose: 
+//
+// History:
+// 15/06/16 - Sergey POKHODENKO - Creation of the file
+
+#ifndef SRC_SKETCHAPI_SKETCHAPI_INTERSECTIONPOINT_H_
+#define SRC_SKETCHAPI_SKETCHAPI_INTERSECTIONPOINT_H_
+
+//--------------------------------------------------------------------------------------
+#include "SketchAPI.h"
+
+#include <SketchPlugin_IntersectionPoint.h>
+
+#include "SketchAPI_SketchEntity.h"
+//--------------------------------------------------------------------------------------
+class ModelHighAPI_Selection;
+//--------------------------------------------------------------------------------------
+/**\class SketchAPI_IntersectionPoint
+ * \ingroup CPPHighAPI
+ * \brief Interface for IntersectionPoint feature
+ */
+class SketchAPI_IntersectionPoint : public SketchAPI_SketchEntity
+{
+public:
+  /// Constructor without values
+  SKETCHAPI_EXPORT
+  explicit SketchAPI_IntersectionPoint(const std::shared_ptr<ModelAPI_Feature> & theFeature);
+  /// Constructor with values
+  SKETCHAPI_EXPORT
+  SketchAPI_IntersectionPoint(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+                 const ModelHighAPI_Selection & theExternal);
+  /// Constructor with values
+  SKETCHAPI_EXPORT
+  SketchAPI_IntersectionPoint(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+                 const std::string & theExternalName);
+  /// Destructor
+  SKETCHAPI_EXPORT
+  virtual ~SketchAPI_IntersectionPoint();
+
+  INTERFACE_2(SketchPlugin_IntersectionPoint::ID(),
+              coordinates, SketchPlugin_IntersectionPoint::COORD_ID(), GeomDataAPI_Point2D, /** IntersectionPoint coordinates */,
+              externalLine, SketchPlugin_IntersectionPoint::EXTERNAL_LINE_ID(), ModelAPI_AttributeSelection, /** External line */
+  )
+
+  /// Set by external
+  SKETCHAPI_EXPORT
+  void setByExternalLine(const ModelHighAPI_Selection & theExternalLine);
+
+  /// Set by external name
+  SKETCHAPI_EXPORT
+  void setByExternalLineName(const std::string & theExternalLineName);
+};
+
+//! Pointer on IntersectionPoint object
+typedef std::shared_ptr<SketchAPI_IntersectionPoint> IntersectionPointPtr;
+
+//--------------------------------------------------------------------------------------
+//--------------------------------------------------------------------------------------
+#endif /* SRC_SKETCHAPI_SKETCHAPI_INTERSECTIONPOINT_H_ */
index bddb075b16f92184e2a0fac51cc7b3ad623a4c57..1280b96a68c8be3883362c571d16ddfc9fe697b7 100644 (file)
@@ -12,6 +12,7 @@
   #include "SketchAPI.h"
   #include "SketchAPI_Arc.h"
   #include "SketchAPI_Circle.h"
+  #include "SketchAPI_IntersectionPoint.h"
   #include "SketchAPI_Line.h"
   #include "SketchAPI_Mirror.h"
   #include "SketchAPI_Sketch.h"