Salome HOME
Horisontal and vertical constraints added
[modules/shaper.git] / src / SketcherPrs / SketcherPrs_PositionMgr.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        SketcherPrs_PositionMgr.h
4 // Created:     13 March 2015
5 // Author:      Vitaly SMETANNIKOV
6
7 #ifndef SketcherPrs_PositionMgr_H
8 #define SketcherPrs_PositionMgr_H
9
10 #include "SketcherPrs_SymbolPrs.h"
11
12 #include <GeomAPI_Shape.h>
13 #include <gp_Pnt.hxx>
14 #include <ModelAPI_Object.h>
15
16 #include <map>
17
18 /**
19 * \ingroup GUI
20 * A class Position Manager which manages position of constraints symbols along a source object line.
21 * it expects that symbol icons have size 16x16 px
22 */
23 class SketcherPrs_PositionMgr
24 {
25 public:
26   /// Returns current instance of position manager
27   static SketcherPrs_PositionMgr* get();
28
29   /// Returns position of symbol for the given presentation
30   /// \param theLine constrained object 
31   /// \param thePrs a presentation of constraint
32   gp_Pnt getPosition(ObjectPtr theLine, Handle(SketcherPrs_SymbolPrs) thePrs);
33
34   /// Deletes constraint object from internal structures. Has to be called on constraint delete.
35   /// \param thePrs a constraint presentation
36   void deleteConstraint(Handle(SketcherPrs_SymbolPrs) thePrs);
37
38 private:
39   /// Constructor
40   SketcherPrs_PositionMgr();
41
42   /// Returns position index of the given constraint
43   /// \param theLine constrained object 
44   /// \param thePrs a presentation of constraint
45   int getPositionIndex(ObjectPtr theLine, Handle(SketcherPrs_SymbolPrs) thePrs);
46
47 private:
48   typedef std::map<void*, int> PositionsMap;
49
50   /// The map which contains position of presentation
51   PositionsMap myIndexes;
52
53   /// The map contains position index 
54   std::map<ObjectPtr, PositionsMap> myShapes;
55 };
56
57 #endif