From: spo Date: Thu, 16 Jun 2016 11:10:24 +0000 (+0300) Subject: Add IntersectionPoint X-Git-Tag: V_2.4.0~91^2~27 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=865924dbfc5e25f53689cabba0366fa65cfd4e68;p=modules%2Fshaper.git Add IntersectionPoint --- diff --git a/src/SketchAPI/CMakeLists.txt b/src/SketchAPI/CMakeLists.txt index af4603438..a8b5cc284 100644 --- a/src/SketchAPI/CMakeLists.txt +++ b/src/SketchAPI/CMakeLists.txt @@ -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 diff --git a/src/SketchAPI/SketchAPI.i b/src/SketchAPI/SketchAPI.i index c3b13cba1..b6c25fee4 100644 --- a/src/SketchAPI/SketchAPI.i +++ b/src/SketchAPI/SketchAPI.i @@ -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) @@ -100,6 +101,7 @@ // 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 index 000000000..e2e8f88c7 --- /dev/null +++ b/src/SketchAPI/SketchAPI_IntersectionPoint.cpp @@ -0,0 +1,62 @@ +// Name : SketchAPI_IntersectionPoint.cpp +// Purpose: +// +// History: +// 15/06/16 - Sergey POKHODENKO - Creation of the file + +//-------------------------------------------------------------------------------------- +#include "SketchAPI_IntersectionPoint.h" +//-------------------------------------------------------------------------------------- +#include +//-------------------------------------------------------------------------------------- +#include +#include +//-------------------------------------------------------------------------------------- +SketchAPI_IntersectionPoint::SketchAPI_IntersectionPoint( + const std::shared_ptr & theFeature) +: SketchAPI_SketchEntity(theFeature) +{ + initialize(); +} + +SketchAPI_IntersectionPoint::SketchAPI_IntersectionPoint( + const std::shared_ptr & theFeature, + const ModelHighAPI_Selection & theExternal ) +: SketchAPI_SketchEntity(theFeature) +{ + if (initialize()) { + setByExternalLine(theExternal); + } +} + +SketchAPI_IntersectionPoint::SketchAPI_IntersectionPoint( + const std::shared_ptr & 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 index 000000000..bf5ce37e2 --- /dev/null +++ b/src/SketchAPI/SketchAPI_IntersectionPoint.h @@ -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 + +#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 & theFeature); + /// Constructor with values + SKETCHAPI_EXPORT + SketchAPI_IntersectionPoint(const std::shared_ptr & theFeature, + const ModelHighAPI_Selection & theExternal); + /// Constructor with values + SKETCHAPI_EXPORT + SketchAPI_IntersectionPoint(const std::shared_ptr & 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 IntersectionPointPtr; + +//-------------------------------------------------------------------------------------- +//-------------------------------------------------------------------------------------- +#endif /* SRC_SKETCHAPI_SKETCHAPI_INTERSECTIONPOINT_H_ */ diff --git a/src/SketchAPI/SketchAPI_swig.h b/src/SketchAPI/SketchAPI_swig.h index bddb075b1..1280b96a6 100644 --- a/src/SketchAPI/SketchAPI_swig.h +++ b/src/SketchAPI/SketchAPI_swig.h @@ -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"