]> SALOME platform Git repositories - modules/shaper.git/blob - src/SketcherPrs/SketcherPrs_PositionMgr.h
Salome HOME
Merge branch 'Dev_1.1.0' of newgeom:newgeom.git into Dev_1.1.0
[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
15 #include <map>
16
17 /**
18 * \ingroup GUI
19 * A class Position Manager which manages position of constraints symbols along a source object line.
20 * it expects that symbol icons have size 16x16 px
21 */
22 class SketcherPrs_PositionMgr
23 {
24 public:
25   /// Returns current instance of position manager
26   static SketcherPrs_PositionMgr* get();
27
28   /// Returns position of symbol for the given presentation
29   /// \param theLine constrained object 
30   /// \param thePrs a presentation of constraint
31   gp_Pnt getPosition(std::shared_ptr<GeomAPI_Shape> theLine, Handle(SketcherPrs_SymbolPrs) thePrs);
32
33   /// Deletes constraint object from internal structures. Has to be called on constraint delete.
34   /// \param thePrs a constraint presentation
35   void deleteConstraint(Handle(SketcherPrs_SymbolPrs) thePrs);
36
37 private:
38   /// Constructor
39   SketcherPrs_PositionMgr();
40
41   /// Returns position index of the given constraint
42   /// \param theLine constrained object 
43   /// \param thePrs a presentation of constraint
44   int getPositionIndex(std::shared_ptr<GeomAPI_Shape> theLine, Handle(SketcherPrs_SymbolPrs) thePrs);
45
46 private:
47   typedef std::map<void*, int> PositionsMap;
48
49   /// The map which contains position of presentation
50   PositionsMap myIndexes;
51
52   /// The map contains position index 
53   std::map<std::shared_ptr<GeomAPI_Shape>, PositionsMap> myShapes;
54 };
55
56 #endif