From: Nicolas RECHATIN Date: Thu, 5 Aug 2021 10:26:08 +0000 (+0200) Subject: WIP addNode IHM X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2540628b22bff759cd2b612f1ebd8397453a5a5c;p=modules%2Fshaper.git WIP addNode IHM --- diff --git a/src/OperaPlugin/CMakeLists.txt b/src/OperaPlugin/CMakeLists.txt index a1f7fd600..d4698815f 100644 --- a/src/OperaPlugin/CMakeLists.txt +++ b/src/OperaPlugin/CMakeLists.txt @@ -21,17 +21,19 @@ SET(PROJECT_HEADERS OperaPlugin.h OperaPlugin_Plugin.h OperaPlugin_Volume.h + OperaPlugin_Node.h ) SET(PROJECT_SOURCES OperaPlugin_Plugin.cpp OperaPlugin_Volume.cpp - + OperaPlugin_Node.cpp ) SET(XML_RESOURCES plugin-Opera.xml volume_widget.xml + node_widget.xml ) SET(TEXT_RESOURCES diff --git a/src/OperaPlugin/OperaPlugin_Node.cpp b/src/OperaPlugin/OperaPlugin_Node.cpp new file mode 100644 index 000000000..dc6408589 --- /dev/null +++ b/src/OperaPlugin/OperaPlugin_Node.cpp @@ -0,0 +1,52 @@ +// 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 + +#include +#include +#include +#include +#include +#include + +#include +#include + +//================================================================================================= +OperaPlugin_Node::OperaPlugin_Node() // Nothing to do during instantiation +{ +} + +//================================================================================================= +void OperaPlugin_Node::initAttributes() +{ + // Get main object + data()->addAttribute(MAIN_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); + + // Get tools object + data()->addAttribute(TOOLS_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); +} + +#include +//================================================================================================= +void OperaPlugin_Node::execute() +{ + AttributeSelectionPtr anObject = selection(MAIN_OBJECT_ID()); + AttributeSelectionListPtr aList = selectionList(TOOLS_LIST_ID()); +} diff --git a/src/OperaPlugin/OperaPlugin_Node.h b/src/OperaPlugin/OperaPlugin_Node.h new file mode 100644 index 000000000..fb561eafc --- /dev/null +++ b/src/OperaPlugin/OperaPlugin_Node.h @@ -0,0 +1,72 @@ +// 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 OperaPlugin_Node_H_ +#define OperaPlugin_Node_H_ + +#include +#include + +/**\class OperaPlugin_Node + * \ingroup Plugins + * \brief Feature for creation of a Node using solids. + * + * Node creates Node object - This Node takes selected solids shape + * and transform the result to a Node with a medium for OPERA. + */ +class OperaPlugin_Node : public ModelAPI_Feature +{ + public: + /// Node kind + inline static const std::string& ID() + { + static const std::string MY_NODE_ID("Node"); + return MY_NODE_ID; + } + /// Attribute name of main object. + inline static const std::string& MAIN_OBJECT_ID() + { + static const std::string MY_MAIN_OBJECT_ID("main_object"); + return MY_MAIN_OBJECT_ID; + } + /// Attribute name of selected tools list + inline static const std::string& TOOLS_LIST_ID() + { + static const std::string MY_TOOLS_LIST_ID("tools_list"); + return MY_TOOLS_LIST_ID; + } + + // Creates a new part document if needed + OPERAPLUGIN_EXPORT virtual void execute(); + + /// Request for initialization of data model of the feature: adding all attributes + OPERAPLUGIN_EXPORT virtual void initAttributes(); + + /// Returns the kind of a feature + OPERAPLUGIN_EXPORT virtual const std::string& getKind() + { + static std::string MY_KIND = OperaPlugin_Node::ID(); + return MY_KIND; + } + + /// Use plugin manager for features creation + OperaPlugin_Node(); +}; + +#endif diff --git a/src/OperaPlugin/OperaPlugin_Plugin.cpp b/src/OperaPlugin/OperaPlugin_Plugin.cpp index 894925751..3c8085982 100644 --- a/src/OperaPlugin/OperaPlugin_Plugin.cpp +++ b/src/OperaPlugin/OperaPlugin_Plugin.cpp @@ -19,11 +19,10 @@ #include #include +#include #include -#include - // the only created instance of this plugin static OperaPlugin_Plugin* MY_PRIMITIVES_INSTANCE = new OperaPlugin_Plugin(); @@ -37,6 +36,8 @@ FeaturePtr OperaPlugin_Plugin::createFeature(std::string theFeatureID) { if (theFeatureID == OperaPlugin_Volume::ID()) { return FeaturePtr(new OperaPlugin_Volume); + } else if (theFeatureID == OperaPlugin_Node::ID()) { + return FeaturePtr(new OperaPlugin_Node); } else { return FeaturePtr(); } diff --git a/src/OperaPlugin/icons/Node.png b/src/OperaPlugin/icons/Node.png new file mode 100644 index 000000000..457dc0f4e Binary files /dev/null and b/src/OperaPlugin/icons/Node.png differ diff --git a/src/OperaPlugin/node_widget.xml b/src/OperaPlugin/node_widget.xml new file mode 100644 index 000000000..ab9fc8480 --- /dev/null +++ b/src/OperaPlugin/node_widget.xml @@ -0,0 +1,16 @@ + + + + + + + + + diff --git a/src/OperaPlugin/plugin-Opera.xml b/src/OperaPlugin/plugin-Opera.xml index f16bf394b..180653905 100644 --- a/src/OperaPlugin/plugin-Opera.xml +++ b/src/OperaPlugin/plugin-Opera.xml @@ -9,6 +9,14 @@ helpfile="volumeFeature.html"> + + +