X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FFeaturesPlugin%2FFeaturesPlugin_Translation.h;h=bff3542b3a7b4251015e6be8a84f02541bfd3f09;hb=fc72d43b677baa05ae7fd317346fd8b723b799ed;hp=2f6ce2d92fb9c2b7d2b60cd5ae7ea2b29b15b7d1;hpb=fbfcc4fd956a374c8d380c2da280c61eaa57bcfd;p=modules%2Fshaper.git diff --git a/src/FeaturesPlugin/FeaturesPlugin_Translation.h b/src/FeaturesPlugin/FeaturesPlugin_Translation.h index 2f6ce2d92..bff3542b3 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Translation.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Translation.h @@ -1,8 +1,21 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D - -// File: FeaturesPlugin_Translation.h -// Created: 8 June 2015 -// Author: Dmitry Bobylev +// Copyright (C) 2014-2023 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 FeaturesPlugin_Translation_H_ #define FeaturesPlugin_Translation_H_ @@ -11,20 +24,47 @@ #include -#include +class GeomAPI_Trsf; -/** \class FeaturesPlugin_Translation - * \ingroup Plugins - * \brief Feature for movement objects along the axis. - */ +/// \class FeaturesPlugin_Translation +/// \ingroup Plugins +/// \brief Feature for translation objects along the axis. class FeaturesPlugin_Translation : public ModelAPI_Feature { public: - /// Movement kind. + /// Translation kind. inline static const std::string& ID() { - static const std::string MY_MOVEMENT_ID("Translation"); - return MY_MOVEMENT_ID; + static const std::string MY_TRANSLATION_ID("Translation"); + return MY_TRANSLATION_ID; + } + + /// Attribute name for creation method. + inline static const std::string& CREATION_METHOD() + { + static const std::string MY_CREATION_METHOD_ID("CreationMethod"); + return MY_CREATION_METHOD_ID; + } + + /// Attribute name for creation method "ByAxisAndDistance". + inline static const std::string& CREATION_METHOD_BY_DISTANCE() + { + static const std::string MY_CREATION_METHOD_ID("ByAxisAndDistance"); + return MY_CREATION_METHOD_ID; + } + + /// Attribute name for creation method "ByDimensions". + inline static const std::string& CREATION_METHOD_BY_DIMENSIONS() + { + static const std::string MY_CREATION_METHOD_ID("ByDimensions"); + return MY_CREATION_METHOD_ID; + } + + /// Attribute name for creation method "ByTwoPoints". + inline static const std::string& CREATION_METHOD_BY_TWO_POINTS() + { + static const std::string MY_CREATION_METHOD_ID("ByTwoPoints"); + return MY_CREATION_METHOD_ID; } /// Attribute name of referenced objects. @@ -48,6 +88,41 @@ class FeaturesPlugin_Translation : public ModelAPI_Feature return MY_DISTANCE_ID; } + /// Attribute name of dimension in X. + inline static const std::string& DX_ID() + { + static const std::string MY_DX_ID("dx"); + return MY_DX_ID; + } + + /// Attribute name of dimension in Y. + inline static const std::string& DY_ID() + { + static const std::string MY_DY_ID("dy"); + return MY_DY_ID; + } + + /// Attribute name of dimension in Z. + inline static const std::string& DZ_ID() + { + static const std::string MY_DZ_ID("dz"); + return MY_DZ_ID; + } + + /// Attribute name of start point. + inline static const std::string& START_POINT_ID() + { + static const std::string MY_START_POINT_ID("start_point"); + return MY_START_POINT_ID; + } + + /// Attribute name of end point. + inline static const std::string& END_POINT_ID() + { + static const std::string MY_END_POINT_ID("end_point"); + return MY_END_POINT_ID; + } + /// \return the kind of a feature. FEATURESPLUGIN_EXPORT virtual const std::string& getKind() { @@ -55,7 +130,7 @@ class FeaturesPlugin_Translation : public ModelAPI_Feature return MY_KIND; } - /// Creates a new part document if needed. + /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); /// Request for initialization of data model of the feature: adding all attributes. @@ -65,9 +140,17 @@ class FeaturesPlugin_Translation : public ModelAPI_Feature FeaturesPlugin_Translation(); private: - void LoadNamingDS(const GeomAlgoAPI_Translation& theMovementAlgo, - std::shared_ptr theResultBody, - std::shared_ptr theBaseShape); + /// Calculate the translation using an axis and a distance. + std::shared_ptr translationByAxisAndDistance(); + + /// Calculate the translation using three dimensions X, Y and Z + std::shared_ptr translationByDimensions(); + + /// Calculate the translation usind two points + std::shared_ptr translationByTwoPoints(); + + /// Perform the translation + void performTranslation(const std::shared_ptr& theTrsf); }; #endif