From 5a2b913b6dc02d2d284caff841f0acd5ab4a8688 Mon Sep 17 00:00:00 2001 From: Nicolas RECHATIN Date: Tue, 3 Aug 2021 15:25:00 +0200 Subject: [PATCH] Revert "fix OperaAPI ModelAPI_Double to std::string" This reverts commit cd9b05d9797222a0dde2a54f2855da1ad85b767a. --- src/OperaAPI/OperaAPI_Volume.cpp | 16 ++++++++++++---- src/OperaAPI/OperaAPI_Volume.h | 7 ++++--- src/OperaPlugin/doc/TUI_volume.rst | 2 +- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/OperaAPI/OperaAPI_Volume.cpp b/src/OperaAPI/OperaAPI_Volume.cpp index 6aca64e49..2612060d1 100644 --- a/src/OperaAPI/OperaAPI_Volume.cpp +++ b/src/OperaAPI/OperaAPI_Volume.cpp @@ -18,7 +18,10 @@ // #include "OperaAPI_Volume.h" + + #include +#include #include #include // std::wstring_convert @@ -34,12 +37,17 @@ OperaAPI_Volume::OperaAPI_Volume(const std::shared_ptr& theFea //================================================================================================== OperaAPI_Volume::OperaAPI_Volume(const std::shared_ptr& theFeature, - const std::string& theMedium, + const ModelHighAPI_Double& theMedium, const std::list& theObjectList) : ModelHighAPI_Interface(theFeature) { if(initialize()) { - fillAttribute(theMedium, medium()); + + std::wstring w_medium = theMedium.string(); + std::wstring_convert,wchar_t> cv; + std::string medium_str = cv.to_bytes(w_medium); + + fillAttribute(medium_str, medium()); setObjectList(theObjectList); } } @@ -48,7 +56,7 @@ OperaAPI_Volume::OperaAPI_Volume(const std::shared_ptr& theFea OperaAPI_Volume::~OperaAPI_Volume() {} //================================================================================================== -void OperaAPI_Volume::setMedium(const std::string& theMedium) +void OperaAPI_Volume::setMedium(const ModelHighAPI_Double& theMedium) { fillAttribute(OperaPlugin_Volume::MEDIUM_ID(), medium()); execute(); @@ -76,7 +84,7 @@ void OperaAPI_Volume::dump(ModelHighAPI_Dumper& theDumper) const //================================================================================================== VolumePtr addVolume(const std::shared_ptr& thePart, - const std::string& theMedium, + const ModelHighAPI_Double& theMedium, const std::list& theObjectList) { std::shared_ptr aFeature = thePart->addFeature(OperaAPI_Volume::ID()); diff --git a/src/OperaAPI/OperaAPI_Volume.h b/src/OperaAPI/OperaAPI_Volume.h index a7bad217d..46842b018 100644 --- a/src/OperaAPI/OperaAPI_Volume.h +++ b/src/OperaAPI/OperaAPI_Volume.h @@ -26,6 +26,7 @@ #include #include +class ModelHighAPI_Double; class ModelHighAPI_Selection; /// \class OperaAPI_Volume @@ -41,7 +42,7 @@ public: /// Constructor with values. OPERAAPI_EXPORT explicit OperaAPI_Volume(const std::shared_ptr& theFeature, - const std::string& theMedium, + const ModelHighAPI_Double& theMedium, const std::list& theObjectList); /// Destructor. @@ -56,7 +57,7 @@ public: /// Set medium OPERAAPI_EXPORT - void setMedium(const std::string& theMedium); + void setMedium(const ModelHighAPI_Double& theMedium); /// Set main objects list. OPERAAPI_EXPORT @@ -74,7 +75,7 @@ typedef std::shared_ptr VolumePtr; /// \brief Create Volume feature. OPERAAPI_EXPORT VolumePtr addVolume(const std::shared_ptr& thePart, - const std::string& theMedium, + const ModelHighAPI_Double& theMedium, const std::list& theObjectList); #endif // OperaAPI_Volume_H_ diff --git a/src/OperaPlugin/doc/TUI_volume.rst b/src/OperaPlugin/doc/TUI_volume.rst index 436076ca3..f136686c6 100644 --- a/src/OperaPlugin/doc/TUI_volume.rst +++ b/src/OperaPlugin/doc/TUI_volume.rst @@ -1,7 +1,7 @@ .. tui_create_volume: -Create Volume +Create Box by points ==================== .. literalinclude:: examples/volume.py -- 2.39.2