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