From: dbv Date: Thu, 16 Jun 2016 15:52:02 +0000 (+0300) Subject: Added CPP High API for BuildPlugin_Shell X-Git-Tag: V_2.4.0~91^2~10 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=932771bcbb63cafeb1e5e85cf6e1e55771cbd721;p=modules%2Fshaper.git Added CPP High API for BuildPlugin_Shell --- diff --git a/src/BuildAPI/BuildAPI.i b/src/BuildAPI/BuildAPI.i index 2fbc06a02..ff24e0571 100644 --- a/src/BuildAPI/BuildAPI.i +++ b/src/BuildAPI/BuildAPI.i @@ -21,11 +21,13 @@ // shared pointers %shared_ptr(BuildAPI_Edge) %shared_ptr(BuildAPI_Face) +%shared_ptr(BuildAPI_Shell) %shared_ptr(BuildAPI_Vertex) %shared_ptr(BuildAPI_Wire) // all supported interfaces %include "BuildAPI_Edge.h" %include "BuildAPI_Face.h" +%include "BuildAPI_Shell.h" %include "BuildAPI_Vertex.h" %include "BuildAPI_Wire.h" diff --git a/src/BuildAPI/BuildAPI_Shell.cpp b/src/BuildAPI/BuildAPI_Shell.cpp new file mode 100644 index 000000000..d504c261a --- /dev/null +++ b/src/BuildAPI/BuildAPI_Shell.cpp @@ -0,0 +1,49 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> + +// File: BuildAPI_Shell.cpp +// Created: 09 June 2016 +// Author: Dmitry Bobylev + +#include "BuildAPI_Shell.h" + +#include + +//================================================================================================== +BuildAPI_Shell::BuildAPI_Shell(const std::shared_ptr& theFeature) +: ModelHighAPI_Interface(theFeature) +{ + initialize(); +} + +//================================================================================================== +BuildAPI_Shell::BuildAPI_Shell(const std::shared_ptr& theFeature, + const std::list& theBaseObjects) +: ModelHighAPI_Interface(theFeature) +{ + if(initialize()) { + setBase(theBaseObjects); + } +} + +//================================================================================================== +BuildAPI_Shell::~BuildAPI_Shell() +{ + +} + +//================================================================================================== +void BuildAPI_Shell::setBase(const std::list& theBaseObjects) +{ + fillAttribute(theBaseObjects, mybaseObjects); + + execute(); +} + +// TODO(spo): make add* as static functions of the class +//================================================================================================== +ShellPtr addShell(const std::shared_ptr& thePart, + const std::list& theBaseObjects) +{ + std::shared_ptr aFeature = thePart->addFeature(BuildAPI_Shell::ID()); + return ShellPtr(new BuildAPI_Shell(aFeature, theBaseObjects)); +} diff --git a/src/BuildAPI/BuildAPI_Shell.h b/src/BuildAPI/BuildAPI_Shell.h new file mode 100644 index 000000000..3b7fbef19 --- /dev/null +++ b/src/BuildAPI/BuildAPI_Shell.h @@ -0,0 +1,55 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> + +// File: BuildAPI_Shell.h +// Created: 09 June 2016 +// Author: Dmitry Bobylev + +#ifndef BuildAPI_Shell_H_ +#define BuildAPI_Shell_H_ + +#include "BuildAPI.h" + +#include + +#include +#include + +class ModelHighAPI_Selection; + +/// \class BuildAPI_Shell +/// \ingroup CPPHighAPI +/// \brief Interface for Shell feature. +class BuildAPI_Shell: public ModelHighAPI_Interface +{ +public: + /// Constructor without values. + BUILDAPI_EXPORT + explicit BuildAPI_Shell(const std::shared_ptr& theFeature); + + /// Constructor with values. + BUILDAPI_EXPORT + explicit BuildAPI_Shell(const std::shared_ptr& theFeature, + const std::list& theBaseObjects); + + /// Destructor. + BUILDAPI_EXPORT + virtual ~BuildAPI_Shell(); + + INTERFACE_1(BuildPlugin_Shell::ID(), + baseObjects, BuildPlugin_Shell::BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList, /** Base objects */) + + /// Modify base attribute of the feature. + BUILDAPI_EXPORT + void setBase(const std::list& theBaseObjects); +}; + +/// Pointer on Shell object. +typedef std::shared_ptr ShellPtr; + +/// \ingroup CPPHighAPI +/// \brief Create Shell feature. +BUILDAPI_EXPORT +ShellPtr addShell(const std::shared_ptr& thePart, + const std::list& theBaseObjects); + +#endif // BuildAPI_Shell_H_ diff --git a/src/BuildAPI/BuildAPI_swig.h b/src/BuildAPI/BuildAPI_swig.h index a1827f002..634ade0b9 100644 --- a/src/BuildAPI/BuildAPI_swig.h +++ b/src/BuildAPI/BuildAPI_swig.h @@ -11,6 +11,7 @@ #include "BuildAPI_Edge.h" #include "BuildAPI_Face.h" + #include "BuildAPI_Shell.h" #include "BuildAPI_Vertex.h" #include "BuildAPI_Wire.h" diff --git a/src/BuildAPI/CMakeLists.txt b/src/BuildAPI/CMakeLists.txt index 1fe462f77..695b8e03a 100644 --- a/src/BuildAPI/CMakeLists.txt +++ b/src/BuildAPI/CMakeLists.txt @@ -6,6 +6,7 @@ SET(PROJECT_HEADERS BuildAPI.h BuildAPI_Edge.h BuildAPI_Face.h + BuildAPI_Shell.h BuildAPI_Vertex.h BuildAPI_Wire.h ) @@ -13,6 +14,7 @@ SET(PROJECT_HEADERS SET(PROJECT_SOURCES BuildAPI_Edge.cpp BuildAPI_Face.cpp + BuildAPI_Shell.cpp BuildAPI_Vertex.cpp BuildAPI_Wire.cpp )