From c56ac5b45f7a4c27c7cc4ca065d60c21fe1aa537 Mon Sep 17 00:00:00 2001 From: dbv Date: Thu, 16 Jun 2016 18:07:31 +0300 Subject: [PATCH] Added CPP High API for BuildPlugin_Edge --- src/BuildAPI/BuildAPI.i | 2 ++ src/BuildAPI/BuildAPI_Edge.cpp | 49 ++++++++++++++++++++++++++++++ src/BuildAPI/BuildAPI_Edge.h | 55 ++++++++++++++++++++++++++++++++++ src/BuildAPI/BuildAPI_swig.h | 1 + src/BuildAPI/CMakeLists.txt | 2 ++ 5 files changed, 109 insertions(+) create mode 100644 src/BuildAPI/BuildAPI_Edge.cpp create mode 100644 src/BuildAPI/BuildAPI_Edge.h diff --git a/src/BuildAPI/BuildAPI.i b/src/BuildAPI/BuildAPI.i index c1bb7e44c..7745dc9e0 100644 --- a/src/BuildAPI/BuildAPI.i +++ b/src/BuildAPI/BuildAPI.i @@ -19,7 +19,9 @@ %include "std_shared_ptr.i" // shared pointers +%shared_ptr(BuildAPI_Edge) %shared_ptr(BuildAPI_Vertex) // all supported interfaces +%include "BuildAPI_Edge.h" %include "BuildAPI_Vertex.h" diff --git a/src/BuildAPI/BuildAPI_Edge.cpp b/src/BuildAPI/BuildAPI_Edge.cpp new file mode 100644 index 000000000..5ccb854e0 --- /dev/null +++ b/src/BuildAPI/BuildAPI_Edge.cpp @@ -0,0 +1,49 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> + +// File: BuildAPI_Edge.cpp +// Created: 09 June 2016 +// Author: Dmitry Bobylev + +#include "BuildAPI_Edge.h" + +#include + +//================================================================================================== +BuildAPI_Edge::BuildAPI_Edge(const std::shared_ptr& theFeature) +: ModelHighAPI_Interface(theFeature) +{ + initialize(); +} + +//================================================================================================== +BuildAPI_Edge::BuildAPI_Edge(const std::shared_ptr& theFeature, + const std::list& theBaseObjects) +: ModelHighAPI_Interface(theFeature) +{ + if(initialize()) { + setBase(theBaseObjects); + } +} + +//================================================================================================== +BuildAPI_Edge::~BuildAPI_Edge() +{ + +} + +//================================================================================================== +void BuildAPI_Edge::setBase(const std::list& theBaseObjects) +{ + fillAttribute(theBaseObjects, mybaseObjects); + + execute(); +} + +// TODO(spo): make add* as static functions of the class +//================================================================================================== +EdgePtr addEdge(const std::shared_ptr& thePart, + const std::list& theBaseObjects) +{ + std::shared_ptr aFeature = thePart->addFeature(BuildAPI_Edge::ID()); + return EdgePtr(new BuildAPI_Edge(aFeature, theBaseObjects)); +} diff --git a/src/BuildAPI/BuildAPI_Edge.h b/src/BuildAPI/BuildAPI_Edge.h new file mode 100644 index 000000000..6df02f745 --- /dev/null +++ b/src/BuildAPI/BuildAPI_Edge.h @@ -0,0 +1,55 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> + +// File: BuildAPI_Edge.h +// Created: 09 June 2016 +// Author: Dmitry Bobylev + +#ifndef BuildAPI_Edge_H_ +#define BuildAPI_Edge_H_ + +#include "BuildAPI.h" + +#include + +#include +#include + +class ModelHighAPI_Selection; + +/// \class BuildAPI_Edge +/// \ingroup CPPHighAPI +/// \brief Interface for Edge feature. +class BuildAPI_Edge: public ModelHighAPI_Interface +{ +public: + /// Constructor without values. + BUILDAPI_EXPORT + explicit BuildAPI_Edge(const std::shared_ptr& theFeature); + + /// Constructor with values. + BUILDAPI_EXPORT + explicit BuildAPI_Edge(const std::shared_ptr& theFeature, + const std::list& theBaseObjects); + + /// Destructor. + BUILDAPI_EXPORT + virtual ~BuildAPI_Edge(); + + INTERFACE_1(BuildPlugin_Edge::ID(), + baseObjects, BuildPlugin_Edge::BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList, /** Base objects */) + + /// Modify base attribute of the feature. + BUILDAPI_EXPORT + void setBase(const std::list& theBaseObjects); +}; + +/// Pointer on Edge object. +typedef std::shared_ptr EdgePtr; + +/// \ingroup CPPHighAPI +/// \brief Create Edge feature. +BUILDAPI_EXPORT +EdgePtr addEdge(const std::shared_ptr& thePart, + const std::list& theBaseObjects); + +#endif // BuildAPI_Edge_H_ diff --git a/src/BuildAPI/BuildAPI_swig.h b/src/BuildAPI/BuildAPI_swig.h index 68c4f4e90..dd947e863 100644 --- a/src/BuildAPI/BuildAPI_swig.h +++ b/src/BuildAPI/BuildAPI_swig.h @@ -9,6 +9,7 @@ #include + #include "BuildAPI_Edge.h" #include "BuildAPI_Vertex.h" #endif // FeaturesAPI_swig_H_ diff --git a/src/BuildAPI/CMakeLists.txt b/src/BuildAPI/CMakeLists.txt index f84136f59..51d197dde 100644 --- a/src/BuildAPI/CMakeLists.txt +++ b/src/BuildAPI/CMakeLists.txt @@ -4,10 +4,12 @@ INCLUDE(Common) SET(PROJECT_HEADERS BuildAPI.h + BuildAPI_Edge.h BuildAPI_Vertex.h ) SET(PROJECT_SOURCES + BuildAPI_Edge.cpp BuildAPI_Vertex.cpp ) -- 2.39.2