1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 // File: SketchPlugin_MultiRotation.h
4 // Created: 21 Apr 2015
5 // Author: Artem ZHIDKOV
7 #ifndef SketchPlugin_MultiRotation_H_
8 #define SketchPlugin_MultiRotation_H_
10 #include "SketchPlugin.h"
11 #include <SketchPlugin_Sketch.h>
12 #include "SketchPlugin_ConstraintBase.h"
14 /** \class SketchPlugin_MultiRotation
16 * \brief Feature for creation of a number of rotated copies of a list of objects
18 * This constraint has two attributes:
19 * SketchPlugin_Constraint::ENTITY_A() for initial list of objects and
20 * SketchPlugin_Constraint::ENTITY_B() for the list of created objects
22 * The list of created objects contains a number of copies of each object given in
23 * the NUMBER_OF_COPIES_ID() attribute plus 1 (the initial objects are stored into this
24 * attribute too). At the start of the list, there are collected N copies
25 * of first object from initial list, then N copies of second object etc.
27 class SketchPlugin_MultiRotation : public SketchPlugin_ConstraintBase
30 /// Multi-rotation kind
31 inline static const std::string& ID()
33 static const std::string MY_CONSTRAINT_ROTATION_ID("SketchMultiRotation");
34 return MY_CONSTRAINT_ROTATION_ID;
36 /// \brief Returns the kind of a feature
37 SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
39 static std::string MY_KIND = SketchPlugin_MultiRotation::ID();
43 /// List of objects to be mirrored
44 inline static const std::string& ROTATION_LIST_ID()
46 static const std::string MY_ROTATION_LIST_ID("MultiRotationList");
47 return MY_ROTATION_LIST_ID;
50 /// Center of rotation
51 inline static const std::string& CENTER_ID()
53 static const std::string MY_CENTER_ID("MultiRotationCenter");
56 /// End point of translation
57 inline static const std::string& ANGLE_ID()
59 static const std::string MY_ANGLE_ID("MultiRotationAngle");
62 /// Number of translated objects
63 inline static const std::string& NUMBER_OF_COPIES_ID()
65 static const std::string MY_NUMBER_OF_COPIES_ID("MultiRotationCopies");
66 return MY_NUMBER_OF_COPIES_ID;
69 /// \brief Creates a new part document if needed
70 SKETCHPLUGIN_EXPORT virtual void execute();
72 /// \brief Request for initialization of data model of the feature: adding all attributes
73 SKETCHPLUGIN_EXPORT virtual void initAttributes();
75 /// Called on change of any argument-attribute of this object
76 /// \param theID identifier of changed attribute
77 SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
79 /// Returns the AIS preview
80 SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious);
82 /// \brief Use plugin manager for features creation
83 SketchPlugin_MultiRotation();
86 ObjectPtr copyFeature(ObjectPtr theObject);
87 void rotateFeature(ObjectPtr theInitial, ObjectPtr theTarget,
88 double theCenterX, double theCenterY, double theAngle);