Salome HOME
Update copyrights
[modules/shaper.git] / src / SketcherPrs / SketcherPrs_PositionMgr.h
index 34529101a92af4f02fb9e139d5141826c863d206..a0e8fe137629328a2082bb7ba2159180720cb426 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 //
 // You should have received a copy of the GNU Lesser General Public
 // License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #ifndef SketcherPrs_PositionMgr_H
 #define SketcherPrs_PositionMgr_H
 
+#include "SketcherPrs.h"
 #include "SketcherPrs_SymbolPrs.h"
 
 #include <GeomAPI_Shape.h>
 #include <ModelAPI_Object.h>
 
 #include <map>
+#include <array>
 
 /**
 * \ingroup GUI
 * A class Position Manager which manages position of constraints symbols along a source object line.
 * it expects that symbol icons have size 16x16 px
 */
-class SketcherPrs_PositionMgr
+class SKETCHERPRS_EXPORT SketcherPrs_PositionMgr
 {
 public:
   /// Returns current instance of position manager
@@ -52,6 +53,9 @@ public:
   /// \param thePrs a constraint presentation
   void deleteConstraint(const SketcherPrs_SymbolPrs* thePrs);
 
+  /// Cleares all stored positions for all constraints
+  void clearAll()  { myShapes.clear(); myPntShapes.clear(); }
+
 private:
   /// Constructor
   SketcherPrs_PositionMgr();
@@ -64,7 +68,8 @@ private:
   /// Returns position index of the given constraint around a point
   /// \param theLine constrained object
   /// \param thePrs a presentation of constraint
-  int getPositionIndex(GeomPointPtr thePos, const SketcherPrs_SymbolPrs* thePrs);
+  const std::array<int, 2>& getPositionIndex(GeomPointPtr thePos,
+                                      const SketcherPrs_SymbolPrs* thePrs);
 
   /// Returns position of a constraint around a point
   /// \param theLine a base object of the constraint
@@ -78,10 +83,7 @@ private:
 
 private:
   typedef std::map<const SketcherPrs_SymbolPrs*, int> PositionsMap;
-  typedef std::map<const ModelAPI_Feature*, int> FeaturesMap;
-
-  /// The map which contains position of presentation
-  PositionsMap myIndexes;
+  typedef std::map<const ModelAPI_Feature*, std::array<int, 2>> FeaturesMap;
 
   /// The map contains position index
   std::map<ObjectPtr, PositionsMap> myShapes;