OperaAPI.h
OperaAPI_Volume.h
OperaAPI_AddNode.h
+ OperaAPI_Tools.h
)
SET(PROJECT_SOURCES
OperaAPI_Volume.cpp
OperaAPI_AddNode.cpp
+ OperaAPI_Tools.cpp
)
SET(PROJECT_LIBRARIES
// shared pointers
%shared_ptr(OperaAPI_Volume)
%shared_ptr(OperaAPI_AddNode)
+%shared_ptr(OperaAPI_Tools)
// all supported interfaces
%include "OperaAPI_Volume.h"
%include "OperaAPI_AddNode.h"
+%include "OperaAPI_Tools.h"
--- /dev/null
+// Copyright (C) 2014-2021 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+#include "OperaAPI_Tools.h"
+
+//=================================================================================================
+static std::list<std::string> OperaAPI_Tools::getMediumList()
+{
+ SessionPtr aSession = ModelAPI_Session::get();
+ DocumentPtr aDocument = aSession->activeDocument();
+ std::list<FeaturePtr> aFeatures = aDocument->allFeatures();
+
+ std::list<std::string> aMediumList;
+ std::list<FeaturePtr>::iterator itFeature = aFeatures.begin();
+ for (; itFeature != aFeatures.end(); ++itFeature)
+ if ((*itFeature)->getKind() == "Volume")
+ aMediumList.push_back((*itFeature)->data()->string(OperaPlugin_Volume::MEDIUM_ID())->value());
+
+ return aMediumList;
+}
--- /dev/null
+// Copyright (C) 2014-2021 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef OPERAAPI_TOOLS_H_
+#define OPERAAPI_TOOLS_H_
+
+#include "OperaAPI.h"
+
+#include <OperaPlugin_Volume.h>
+
+#include "ModelAPI_Session.h"
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Double;
+class ModelHighAPI_Selection;
+
+/// \class OperaAPI_Tools
+/// \ingroup CPPHighAPI
+/// \brief Interface for AddNode feature.
+class OperaAPI_Tools : public ModelHighAPI_Interface
+{
+public:
+ /// Get medium list
+ OPERAAPI_EXPORT
+ static std::list<std::string> getMediumList();
+};
+
+#endif // OPERAAPI_TOOLS_H_
#include "OperaAPI.h"
#include "OperaAPI_Volume.h"
#include "OperaAPI_AddNode.h"
+ #include "OperaAPI_Tools.h"
#endif // OPERAAPI_SWIG_H_