]> SALOME platform Git repositories - modules/shaper.git/blob - src/PartSet/PartSet_ExternalPointsMgr.h
Salome HOME
Meet the coding style (line length <= 100)
[modules/shaper.git] / src / PartSet / PartSet_ExternalPointsMgr.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        PartSet_ExternalPointsMgr.h
4 // Created:     26 April 2017
5 // Author:      Vitaly SMETANNIKOV
6
7 #ifndef PartSet_ExternalPointsMgr_H
8 #define PartSet_ExternalPointsMgr_H
9
10
11 #include <ModelAPI_CompositeFeature.h>
12 #include <ModelAPI_Result.h>
13 #include <GeomAPI_Pln.h>
14 #include <GeomAPI_AISObject.h>
15
16 #include <QObject>
17 #include <QMap>
18
19 class ModuleBase_ViewerPrs;
20 class ModuleBase_IWorkshop;
21
22
23 /**
24 * \ingroup Modules
25 * A class to manage display of presentations of center points of circular
26 * edges outside of a current sketcher
27 */
28 class PartSet_ExternalPointsMgr: public QObject
29 {
30   Q_OBJECT
31 public:
32   PartSet_ExternalPointsMgr(ModuleBase_IWorkshop* theWorkshop,
33                             const CompositeFeaturePtr& theSketch);
34
35   virtual ~PartSet_ExternalPointsMgr();
36
37 public slots:
38   /**
39   * A slot which processes display of object
40   * \param theObj the displayed object
41   * \param theAIS its presentation
42   */
43   void onDisplayObject(ObjectPtr theObj, AISObjectPtr theAIS);
44
45   /**
46   * A slot which processes erase of object
47   * \param theObj the displayed object
48   * \param theAIS its presentation
49   */
50   void onEraseObject(ObjectPtr theObj, AISObjectPtr theAIS);
51
52   // Called on selection changed
53   void onSelectionChanged();
54
55 private:
56   /**
57   * Returns list of presentations which have displayed shapes with circular edges
58   * (circles, arcs) which are in pane of of the given sketch
59   * \param theSketch - the sketch
60   */
61   QList<std::shared_ptr<ModuleBase_ViewerPrs>> findCircularEdgesInPlane();
62
63   /// Creates presentations of centers
64   void updateCenterPresentations();
65
66   /// Returns plane of the current sketch
67   GeomPlanePtr plane() const;
68
69   /**
70   * Checks that the given object is an object of the current sketch
71   * \param theRes an object to check
72   * \return True if the given object is a sub-object of the current sketch
73   */
74   bool isSketchObject(const ObjectPtr& theRes) const;
75
76 private:
77   /// Workshop
78   ModuleBase_IWorkshop* myWorkshop;
79
80   /// Current sketch
81   CompositeFeaturePtr mySketch;
82
83   /// Type for list of created AIS objects
84   typedef QList<AISObjectPtr> ListOfAIS;
85
86   /// Map of created AIS objects
87   QMap<ObjectPtr, ListOfAIS> myPresentations;
88 };
89
90 #endif