]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Problem with invisible constraints when editing sketch was fixed
authorazv <azv@opencascade.com>
Thu, 26 Jun 2014 12:33:27 +0000 (16:33 +0400)
committerazv <azv@opencascade.com>
Thu, 26 Jun 2014 12:33:27 +0000 (16:33 +0400)
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_OperationSketch.cpp
src/PartSet/PartSet_OperationSketch.h
src/PartSet/PartSet_OperationSketchBase.cpp
src/PartSet/PartSet_OperationSketchBase.h

index 2ba50835cf68162c8181daf95dae4bc8f8886ead..d0ee20e792b30185092296442fde6b34280498f4 100644 (file)
@@ -308,16 +308,14 @@ void PartSet_Module::onFeatureConstructed(FeaturePtr theFeature, int theMode)
     FeaturePtr aSketch;
     PartSet_OperationSketchBase* aPrevOp = dynamic_cast<PartSet_OperationSketchBase*>(aCurOperation);
     if (aPrevOp) {
-      std::map<FeaturePtr, boost::shared_ptr<GeomAPI_Shape> > aList = aPrevOp->subPreview();
+      std::list<FeaturePtr> aList = aPrevOp->subFeatures();
       XGUI_Displayer* aDisplayer = myWorkshop->displayer();
       std::list<int> aModes = aPrevOp->getSelectionModes(aPrevOp->feature());
 
-      std::map<FeaturePtr, boost::shared_ptr<GeomAPI_Shape> >::const_iterator
-                                                             anIt = aList.begin(), aLast = aList.end();
-      for (; anIt != aLast; anIt++) {
-        FeaturePtr aFeature = (*anIt).first;
-        visualizePreview(aFeature, false, false);
-      }
+      std::list<FeaturePtr>::const_iterator anIt = aList.begin(),
+                                            aLast = aList.end();
+      for (; anIt != aLast; anIt++)
+        visualizePreview(*anIt, false, false);
       aDisplayer->updateViewer();
     }
   }
@@ -468,23 +466,19 @@ void PartSet_Module::updateCurrentPreview(const std::string& theCmdId)
   if (!aFeature || aFeature->getKind() != theCmdId)
     return;
 
-  std::map<FeaturePtr, boost::shared_ptr<GeomAPI_Shape> > aList = aPreviewOp->subPreview();
+  std::list<FeaturePtr> aList = aPreviewOp->subFeatures();
   XGUI_Displayer* aDisplayer = myWorkshop->displayer();
   std::list<int> aModes = aPreviewOp->getSelectionModes(aPreviewOp->feature());
 
-  std::map<FeaturePtr, boost::shared_ptr<GeomAPI_Shape> >::const_iterator
-                                                         anIt = aList.begin(), aLast = aList.end();
+  std::list<FeaturePtr>::const_iterator anIt = aList.begin(), 
+                                        aLast = aList.end();
   for (; anIt != aLast; anIt++) {
-    FeaturePtr aFeature = (*anIt).first;
     boost::shared_ptr<SketchPlugin_Feature> aSPFeature = 
-      boost::dynamic_pointer_cast<SketchPlugin_Feature>((*anIt).first);
+      boost::dynamic_pointer_cast<SketchPlugin_Feature>(*anIt);
     if (!aSPFeature)
       continue;
-
-    Handle(AIS_InteractiveObject) anAIS = aSPFeature->getAISShape(aDisplayer->getAISObject(aFeature));
-    if (!anAIS.IsNull())
-      aDisplayer->redisplay(aFeature, anAIS, false);
-    aDisplayer->activateInLocalContext(aFeature, aModes, false);
+    visualizePreview(*anIt, true, false);
+    aDisplayer->activateInLocalContext(*anIt, aModes, false);
   }
   aDisplayer->updateViewer();
 }
index dfe2fe85c6cd5249a673be88829cf0ac2e238c07..91602297871917ee01233ab75e13a6a1bad704a9 100644 (file)
@@ -137,29 +137,15 @@ void PartSet_OperationSketch::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View)
   }
 }
 
-std::map<FeaturePtr, boost::shared_ptr<GeomAPI_Shape> >
-                                                        PartSet_OperationSketch::subPreview() const
+std::list<FeaturePtr> PartSet_OperationSketch::subFeatures() const
 {
-  std::map<FeaturePtr, boost::shared_ptr<GeomAPI_Shape> > aPreviewMap;
-
-  boost::shared_ptr<SketchPlugin_Feature> aFeature;
-
   boost::shared_ptr<ModelAPI_Data> aData = feature()->data();
   if (!aData->isValid())
-    return aPreviewMap;
+    return std::list<FeaturePtr>();
   boost::shared_ptr<ModelAPI_AttributeRefList> aRefList =
         boost::dynamic_pointer_cast<ModelAPI_AttributeRefList>(aData->attribute(SKETCH_ATTR_FEATURES));
 
-  std::list<FeaturePtr > aFeatures = aRefList->list();
-  std::list<FeaturePtr >::const_iterator anIt = aFeatures.begin(),
-                                                                  aLast = aFeatures.end();
-  for (; anIt != aLast; anIt++) {
-    aFeature = boost::dynamic_pointer_cast<SketchPlugin_Feature>(*anIt);
-    boost::shared_ptr<GeomAPI_Shape> aPreview = aFeature->preview();
-    if (aPreview)
-      aPreviewMap[aFeature] = aPreview;
-  }
-  return aPreviewMap;
+  return aRefList->list();
 }
 
 void PartSet_OperationSketch::stopOperation()
index 27c0d8641db489ef85cde4dce263e84cc9f3386b..a5ec96c5df2533836dd6ec908f2ea6ba01c22de8 100644 (file)
@@ -72,10 +72,9 @@ public:
   /// \param theEvent the mouse event
   virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView);
 
-  /// Returns the map of the operation previews including the nested feature previews
-  /// \return the map of feature to the feature preview
-  virtual std::map<FeaturePtr, boost::shared_ptr<GeomAPI_Shape> >
-                                                                           subPreview() const;
+  /// Returns the list of the nested features
+  /// \return the list of subfeatures
+  virtual std::list<FeaturePtr> subFeatures() const;
 
   /// Virtual method called when operation stopped - committed or aborted.
   /// Emits a signal to hide the preview of the operation
index 60396b8146cb94edf019f9132ee383942275f1b5..117195468dec6912ae0ce6843be9687ca736314d 100644 (file)
@@ -38,10 +38,9 @@ boost::shared_ptr<GeomAPI_Shape> PartSet_OperationSketchBase::preview(
   return aFeature->preview();
 }
 
-std::map<FeaturePtr, boost::shared_ptr<GeomAPI_Shape> >
-                                                     PartSet_OperationSketchBase::subPreview() const
+std::list<FeaturePtr> PartSet_OperationSketchBase::subFeatures() const
 {
-  return std::map<FeaturePtr, boost::shared_ptr<GeomAPI_Shape> >();
+  return std::list<FeaturePtr>();
 }
 
 std::list<int> PartSet_OperationSketchBase::getSelectionModes(FeaturePtr theFeature) const
index 9e4a72cbab36cf94a28315855387cb7b2a863b68..33aeeeea07941c28272be6e97bfe6746b286434f 100644 (file)
 #include <ModuleBase_Operation.h>
 
 #include <XGUI_Constants.h>
+#include <XGUI_Displayer.h>
 
 #include <QObject>
 
+#include <AIS_InteractiveObject.hxx>
+
 #include <map>
 
 class Handle_V3d_View;
@@ -48,9 +51,9 @@ public:
   /// \param theFeature the feature object to obtain the preview
   static boost::shared_ptr<GeomAPI_Shape> preview(FeaturePtr theFeature);
 
-  /// Returns the map of the operation previews including the nested feature previews
-  /// \return the map of feature to the feature preview
-  virtual std::map<FeaturePtr, boost::shared_ptr<GeomAPI_Shape> > subPreview() const;
+  /// Returns the list of the nested features
+  /// \return the list of subfeatures
+  virtual std::list<FeaturePtr> subFeatures() const;
 
   /// Returns the operation local selection mode
   /// \param theFeature the feature object to get the selection mode