SHAPER  9.12.0
SketchPlugin_MultiRotation.h
1 // Copyright (C) 2014-2023 CEA, EDF
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 #ifndef SketchPlugin_MultiRotation_H_
21 #define SketchPlugin_MultiRotation_H_
22 
23 #include "SketchPlugin.h"
24 #include <SketchPlugin_Sketch.h>
25 #include "SketchPlugin_ConstraintBase.h"
26 
40 {
41  public:
43  inline static const std::string& ID()
44  {
45  static const std::string MY_CONSTRAINT_ROTATION_ID("SketchMultiRotation");
46  return MY_CONSTRAINT_ROTATION_ID;
47  }
49  SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
50  {
51  static std::string MY_KIND = SketchPlugin_MultiRotation::ID();
52  return MY_KIND;
53  }
54 
56  inline static const std::string& ROTATION_LIST_ID()
57  {
58  static const std::string MY_ROTATION_LIST_ID("MultiRotationList");
59  return MY_ROTATION_LIST_ID;
60  }
61 
63  inline static const std::string& CENTER_ID()
64  {
65  static const std::string MY_CENTER_ID("MultiRotationCenter");
66  return MY_CENTER_ID;
67  }
69  inline static const std::string& ANGLE_TYPE()
70  {
71  static const std::string ANGLE_TYPE_ATTR("AngleType");
72  return ANGLE_TYPE_ATTR;
73  }
74 
76  inline static const std::string& ANGLE_ID()
77  {
78  static const std::string MY_ANGLE_ID("MultiRotationAngle");
79  return MY_ANGLE_ID;
80  }
81 
83  inline static const std::string& NUMBER_OF_OBJECTS_ID()
84  {
85  static const std::string MY_NUMBER_OF_OBJECTS_ID("MultiRotationObjects");
86  return MY_NUMBER_OF_OBJECTS_ID;
87  }
88 
90  inline static const std::string& REVERSED_ID()
91  {
92  static const std::string MY_REVERSED_ID("MultiRotationReversed");
93  return MY_REVERSED_ID;
94  }
95 
97  SKETCHPLUGIN_EXPORT virtual void execute();
98 
100  SKETCHPLUGIN_EXPORT virtual void initAttributes();
101 
104  SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
105 
107  SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious);
108 
110  SKETCHPLUGIN_EXPORT virtual void erase();
111 
114 
115 private:
116  ObjectPtr copyFeature(ObjectPtr theObject);
117  //void rotateFeature(ObjectPtr theInitial, ObjectPtr theTarget,
118  // double theCenterX, double theCenterY, double theAngle);
119 
120  bool updateFullAngleValue();
121 
122  bool isUpdatingAngle;
123 };
124 
125 #endif
Feature for creation of a new constraint between other features.
Definition: SketchPlugin_ConstraintBase.h:56
Feature for creation of a number of rotated copies of a list of objects.
Definition: SketchPlugin_MultiRotation.h:40
virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious)
Returns the AIS preview.
Definition: SketchPlugin_MultiRotation.cpp:226
static const std::string & ANGLE_TYPE()
attribute name for first point
Definition: SketchPlugin_MultiRotation.h:69
static const std::string & ANGLE_ID()
End point of translation.
Definition: SketchPlugin_MultiRotation.h:76
static const std::string & REVERSED_ID()
Name of the flag to reverse rotation.
Definition: SketchPlugin_MultiRotation.h:90
static const std::string & NUMBER_OF_OBJECTS_ID()
Total number of objects, initial and translated objects.
Definition: SketchPlugin_MultiRotation.h:83
static const std::string & ROTATION_LIST_ID()
List of objects to be mirrored.
Definition: SketchPlugin_MultiRotation.h:56
virtual void erase()
removes all fields from this feature: results, data, etc
Definition: SketchPlugin_MultiRotation.cpp:236
virtual void attributeChanged(const std::string &theID)
Called on change of any argument-attribute of this object.
Definition: SketchPlugin_MultiRotation.cpp:346
SketchPlugin_MultiRotation()
Use plugin manager for features creation.
Definition: SketchPlugin_MultiRotation.cpp:50
virtual const std::string & getKind()
Returns the kind of a feature.
Definition: SketchPlugin_MultiRotation.h:49
virtual void execute()
Creates a new part document if needed.
Definition: SketchPlugin_MultiRotation.cpp:73
virtual void initAttributes()
Request for initialization of data model of the feature: adding all attributes.
Definition: SketchPlugin_MultiRotation.cpp:55
static const std::string & CENTER_ID()
Center of rotation.
Definition: SketchPlugin_MultiRotation.h:63
static const std::string & ID()
Multi-rotation kind.
Definition: SketchPlugin_MultiRotation.h:43