From: dbv Date: Thu, 16 Jun 2016 13:59:57 +0000 (+0300) Subject: Added CPP High API for FeaturesPlugin_Intersection X-Git-Tag: V_2.4.0~91^2~16 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4f38d9eed356c4a4358c9ef4a05022cbf194f3c6;p=modules%2Fshaper.git Added CPP High API for FeaturesPlugin_Intersection --- diff --git a/src/FeaturesAPI/CMakeLists.txt b/src/FeaturesAPI/CMakeLists.txt index e8c007d94..acd90db77 100644 --- a/src/FeaturesAPI/CMakeLists.txt +++ b/src/FeaturesAPI/CMakeLists.txt @@ -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 diff --git a/src/FeaturesAPI/FeaturesAPI.i b/src/FeaturesAPI/FeaturesAPI.i index 79bb8c73e..e4dd0c754 100644 --- a/src/FeaturesAPI/FeaturesAPI.i +++ b/src/FeaturesAPI/FeaturesAPI.i @@ -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 index 000000000..cefd80e6e --- /dev/null +++ b/src/FeaturesAPI/FeaturesAPI_Intersection.cpp @@ -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 + +//================================================================================================== +FeaturesAPI_Intersection::FeaturesAPI_Intersection(const std::shared_ptr& theFeature) +: ModelHighAPI_Interface(theFeature) +{ + initialize(); +} + +//================================================================================================== +FeaturesAPI_Intersection::FeaturesAPI_Intersection(const std::shared_ptr& theFeature, + const std::list& theObjects, + const std::list& theTools) +: ModelHighAPI_Interface(theFeature) +{ + if(initialize()) { + fillAttribute(theObjects, myobjects); + fillAttribute(theTools, mytools); + + execute(); + } +} + +//================================================================================================== +FeaturesAPI_Intersection::~FeaturesAPI_Intersection() +{ + +} + +//================================================================================================== +void FeaturesAPI_Intersection::setObjects(const std::list& theObjects) +{ + fillAttribute(theObjects, myobjects); + + execute(); +} + +//================================================================================================== +void FeaturesAPI_Intersection::setTools(const std::list& theTools) +{ + fillAttribute(theTools, mytools); + + execute(); +} + +// TODO(spo): make add* as static functions of the class +//================================================================================================== +IntersectionPtr addIntersection(const std::shared_ptr& thePart, + const std::list& theObjects, + const std::list& theTools) +{ + std::shared_ptr 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 index 000000000..440e43013 --- /dev/null +++ b/src/FeaturesAPI/FeaturesAPI_Intersection.h @@ -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 + +#include +#include + +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& theFeature); + + /// Constructor with values. + FEATURESAPI_EXPORT + explicit FeaturesAPI_Intersection(const std::shared_ptr& theFeature, + const std::list& theObjects, + const std::list& 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& theObjects); + + /// Modify tools attribute of the feature. + FEATURESAPI_EXPORT + void setTools(const std::list& theTools); +}; + +/// Pointer on Intersection object. +typedef std::shared_ptr IntersectionPtr; + +/// \ingroup CPPHighAPI +/// \brief Create Intersection feature. +FEATURESAPI_EXPORT +IntersectionPtr addIntersection(const std::shared_ptr& thePart, + const std::list& theObjects, + const std::list& theTools); + +#endif // FeaturesAPI_Intersection_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_swig.h b/src/FeaturesAPI/FeaturesAPI_swig.h index 4eef6fd21..b88b1f922 100644 --- a/src/FeaturesAPI/FeaturesAPI_swig.h +++ b/src/FeaturesAPI/FeaturesAPI_swig.h @@ -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"