Salome HOME
Issue #2484: Fix for re-creation of a sketcher
authorvsv <vsv@opencascade.com>
Wed, 23 May 2018 08:44:46 +0000 (11:44 +0300)
committervsv <vsv@opencascade.com>
Wed, 23 May 2018 08:44:46 +0000 (11:44 +0300)
src/PartSet/PartSet_Module.cpp
src/SketcherPrs/SketcherPrs_PositionMgr.cpp
src/SketcherPrs/SketcherPrs_PositionMgr.h

index 9696ee41f3b99d35c0d5990c0fbdd9ec3a9e97c4..dd8931d19c17728504cfc332f18e75454920c11d 100755 (executable)
 #include <SketchPlugin_Sketch.h>
 
 #include <SketcherPrs_SymbolPrs.h>
+#include <SketcherPrs_PositionMgr.h>
 #include <SketcherPrs_Coincident.h>
 #include <SketcherPrs_Tools.h>
 
@@ -721,6 +722,7 @@ bool PartSet_Module::isSketchNeutralPointActivated() const
 void PartSet_Module::closeDocument()
 {
   myActivePartIndex = QModelIndex();
+  SketcherPrs_PositionMgr::get()->clearAll();
 }
 
 //******************************************************
index 49892641961967dae0d903f327d14dd20e6d9e15..dfa3103dd11863a972e5c6ce5dd98a3ec110debe 100644 (file)
@@ -61,7 +61,6 @@ SketcherPrs_PositionMgr::SketcherPrs_PositionMgr()
 {
 }
 
-
 int SketcherPrs_PositionMgr::getPositionIndex(ObjectPtr theLine,
                                               const SketcherPrs_SymbolPrs* thePrs)
 {
index 8695126b2ae06aa83d010caa8f4834614464504c..7acc36e1150d9c56bc2031fc26df6711499f5190 100644 (file)
@@ -21,6 +21,7 @@
 #ifndef SketcherPrs_PositionMgr_H
 #define SketcherPrs_PositionMgr_H
 
+#include "SketcherPrs.h"
 #include "SketcherPrs_SymbolPrs.h"
 
 #include <GeomAPI_Shape.h>
@@ -36,7 +37,7 @@
 * 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
@@ -53,6 +54,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();
@@ -82,9 +86,6 @@ private:
   typedef std::map<const SketcherPrs_SymbolPrs*, int> PositionsMap;
   typedef std::map<const ModelAPI_Feature*, std::array<int, 2>> FeaturesMap;
 
-  /// The map which contains position of presentation
-  PositionsMap myIndexes;
-
   /// The map contains position index
   std::map<ObjectPtr, PositionsMap> myShapes;