1 // Copyright (C) 2014-2017 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef FEATURESPLUGIN_MULTITRANSLATION_H_
22 #define FEATURESPLUGIN_MULTITRANSLATION_H_
24 #include <FeaturesPlugin.h>
26 #include <GeomAlgoAPI_Translation.h>
28 #include <ModelAPI_Feature.h>
30 /** \class FeaturesPlugin_MultiTranslation
32 * \brief Feature for movement objects along one or two axes an arbitary number of times,
33 * making a copy every time.
35 class FeaturesPlugin_MultiTranslation : public ModelAPI_Feature
38 /// Multi-translation kind.
39 inline static const std::string& ID()
41 static const std::string MY_MULTITRANSLATION_ID("LinearCopy");
42 return MY_MULTITRANSLATION_ID;
45 /// Attribute name of referenced objects.
46 inline static const std::string& OBJECTS_LIST_ID()
48 static const std::string MY_OBJECTS_LIST_ID("main_objects");
49 return MY_OBJECTS_LIST_ID;
52 /// Attribute name of a first direction.
53 inline static const std::string& AXIS_FIRST_DIR_ID()
55 static const std::string MY_AXIS_FIRST_DIR_ID("axis_first_dir");
56 return MY_AXIS_FIRST_DIR_ID;
59 /// Attribute name of step for the first direction.
60 inline static const std::string& STEP_FIRST_DIR_ID()
62 static const std::string MY_STEP_FIRST_DIR_ID("step_first_dir");
63 return MY_STEP_FIRST_DIR_ID;
66 /// Attribute name of number of copies for the first direction.
67 inline static const std::string& NB_COPIES_FIRST_DIR_ID()
69 static const std::string MY_NB_COPIES_FIRST_DIR_ID("nb_first_dir");
70 return MY_NB_COPIES_FIRST_DIR_ID;
73 /// Attribute name for use second dir.
74 inline static const std::string& USE_SECOND_DIR_ID()
76 static const std::string MY_USE_SECOND_DIR_ID("use_second_dir");
77 return MY_USE_SECOND_DIR_ID;
80 /// Attribute name of a second direction.
81 inline static const std::string& AXIS_SECOND_DIR_ID()
83 static const std::string MY_AXIS_SECOND_DIR_ID("axis_second_dir");
84 return MY_AXIS_SECOND_DIR_ID;
87 /// Attribute name of step for the second direction.
88 inline static const std::string& STEP_SECOND_DIR_ID()
90 static const std::string MY_STEP_SECOND_DIR_ID("step_second_dir");
91 return MY_STEP_SECOND_DIR_ID;
94 /// Attribute name of number of copies for the second direction.
95 inline static const std::string& NB_COPIES_SECOND_DIR_ID()
97 static const std::string MY_NB_COPIES_SECOND_DIR_ID("nb_second_dir");
98 return MY_NB_COPIES_SECOND_DIR_ID;
101 /// \return the kind of a feature.
102 FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
104 static std::string MY_KIND = FeaturesPlugin_MultiTranslation::ID();
108 /// Creates a new part document if needed.
109 FEATURESPLUGIN_EXPORT virtual void execute();
111 /// Request for initialization of data model of the feature: adding all attributes.
112 FEATURESPLUGIN_EXPORT virtual void initAttributes();
114 /// Use plugin manager for features creation.
115 FeaturesPlugin_MultiTranslation();
118 /// Perform the multi translation in one direction.
119 void performOneDirection();
121 /// Perform the multi translation in two directions.
122 void performTwoDirection();
124 void loadNamingDS(std::list<std::shared_ptr<GeomAlgoAPI_Translation> > theListOfTranslationAlgo,
125 std::shared_ptr<ModelAPI_ResultBody> theResultBody,
126 std::shared_ptr<GeomAPI_Shape> theBaseShape);
129 #endif // FEATURESPLUGIN_MULTITRANSLATION_H_