]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
refs #30 - Sketch base GUI: create, draw lines
authornds <natalia.donis@opencascade.com>
Mon, 5 May 2014 12:56:23 +0000 (16:56 +0400)
committernds <natalia.donis@opencascade.com>
Mon, 5 May 2014 12:56:23 +0000 (16:56 +0400)
Edge/vertex selection modes for the line.

src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_OperationSketch.cpp
src/PartSet/PartSet_OperationSketch.h
src/PartSet/PartSet_OperationSketchBase.h
src/PartSet/PartSet_OperationSketchLine.cpp
src/PartSet/PartSet_OperationSketchLine.h
src/XGUI/XGUI_Displayer.cpp
src/XGUI/XGUI_Displayer.h

index 59cec6d98a237dd4a1ee79ba57814a2b212bff15..4a0c54e5b08f7bdd36ac9d80ede08c07c5558806 100644 (file)
@@ -255,7 +255,7 @@ void PartSet_Module::visualizePreview(boost::shared_ptr<ModelAPI_Feature> theFea
     boost::shared_ptr<GeomAPI_Shape> aPreview = aPreviewOp->preview(theFeature);
     if (aPreview) {
       aDisplayer->RedisplayInLocalContext(theFeature, aPreview->impl<TopoDS_Shape>(),
-                                          aPreviewOp->getSelectionMode(theFeature));
+                                          aPreviewOp->getSelectionModes(theFeature));
     }
   }
   else {
index b583c1e808eabb794953ee6385b88525504316fe..ee9334b32fef36b549554bf2fb74239981a5be3b 100644 (file)
@@ -30,12 +30,12 @@ PartSet_OperationSketch::~PartSet_OperationSketch()
 {
 }
 
-int PartSet_OperationSketch::getSelectionMode(boost::shared_ptr<ModelAPI_Feature> theFeature) const
+std::list<int> PartSet_OperationSketch::getSelectionModes(boost::shared_ptr<ModelAPI_Feature> theFeature) const
 {
-  int aMode = TopAbs_FACE;
-  if (isEditMode())
-    aMode = TopAbs_VERTEX;
-  return aMode;
+  std::list<int> aModes;
+  if (!isEditMode())
+    aModes.push_back(TopAbs_FACE);
+  return aModes;
 }
 
 void PartSet_OperationSketch::setSelectedShapes(const NCollection_List<TopoDS_Shape>& theList)
index 7818a67cd185fda6787a82d374e60f017c469c1d..e577962bb957c7cf01bc0f27758db3ed00531540 100644 (file)
@@ -28,7 +28,7 @@ public:
   /// Returns the operation local selection mode
   /// \param theFeature the feature object to get the selection mode
   /// \return the selection mode
-  virtual int getSelectionMode(boost::shared_ptr<ModelAPI_Feature> theFeature) const;
+  virtual std::list<int> getSelectionModes(boost::shared_ptr<ModelAPI_Feature> theFeature) const;
 
   /// Gives the current selected objects to be processed by the operation
   /// \param theList a list of interactive selected shapes
index 0cb2900d77b0af48f9d7cbd75ae9faeb61f73d40..173851cbc3fe4e336ce0fe0ec26d4233e6bc051e 100644 (file)
@@ -43,7 +43,7 @@ public:
   /// Returns the operation local selection mode
   /// \param theFeature the feature object to get the selection mode
   /// \return the selection mode
-  virtual int getSelectionMode(boost::shared_ptr<ModelAPI_Feature> theFeature) const = 0;
+  virtual std::list<int> getSelectionModes(boost::shared_ptr<ModelAPI_Feature> theFeature) const = 0;
 
   /// Gives the current selected objects to be processed by the operation
   /// \param theList a list of interactive selected shapes
index 69590f33ae0c2dea94047e9339845d7168d65545..14e0502b55c57256aba4d5d649c4dbf691a7b9b2 100644 (file)
@@ -37,12 +37,12 @@ bool PartSet_OperationSketchLine::isGranted() const
   return true;
 }
 
-int PartSet_OperationSketchLine::getSelectionMode(boost::shared_ptr<ModelAPI_Feature> theFeature) const
+std::list<int> PartSet_OperationSketchLine::getSelectionModes(boost::shared_ptr<ModelAPI_Feature> theFeature) const
 {
-  int aMode = 0;
+  std::list<int> aModes;
   if (theFeature != feature())
-    aMode = TopAbs_VERTEX;
-  return aMode;
+    aModes.push_back(TopAbs_VERTEX);
+  return aModes;
 }
 
 void PartSet_OperationSketchLine::mouseReleased(const gp_Pnt& thePoint)
@@ -111,6 +111,8 @@ void PartSet_OperationSketchLine::keyReleased(const int theKey)
         myPointSelectionMode = SM_FirstPoint;
         document()->abortOperation();
       }
+      else
+        myPointSelectionMode = SM_FirstPoint;
     }
     break;
     default:
index 939cdef7f4d2328295835471b80d74c6d040ae34..7883143fabccc098298cfa1bfaf8f4743a5db782 100644 (file)
@@ -34,7 +34,7 @@ public:
   /// Returns the operation local selection mode
   /// \param theFeature the feature object to get the selection mode
   /// \return the selection mode
-  virtual int getSelectionMode(boost::shared_ptr<ModelAPI_Feature> theFeature) const;
+  virtual std::list<int> getSelectionModes(boost::shared_ptr<ModelAPI_Feature> theFeature) const;
 
   /// Gives the current selected objects to be processed by the operation
   /// \param thePoint a point clicked in the viewer
index 8d7b6ef9d8b41f59e0cbbc8449dc515a609377b7..c0a57d545ccabd3b0a81eb15c4f231667ffd3fe1 100644 (file)
@@ -78,7 +78,7 @@ void XGUI_Displayer::Erase(boost::shared_ptr<ModelAPI_Feature> theFeature,
 
 void XGUI_Displayer::RedisplayInLocalContext(boost::shared_ptr<ModelAPI_Feature> theFeature,
                                              const TopoDS_Shape& theShape,
-                                             const int theMode, const bool isUpdateViewer)
+                                             const std::list<int>& theModes, const bool isUpdateViewer)
 {
   Handle(AIS_InteractiveContext) aContext = AISContext();
   
@@ -105,12 +105,11 @@ void XGUI_Displayer::RedisplayInLocalContext(boost::shared_ptr<ModelAPI_Feature>
   // Activate selection of objects from prs
   if (!anAIS.IsNull()) {
     if (anAIS->IsKind(STANDARD_TYPE(AIS_Shape))) {
-      ic->Display(anAIS, 0/*display mode*/, AIS_Shape::SelectionMode((TopAbs_ShapeEnum)theMode),
-                  false/*update viewer*/, true/*allow decomposition*/);
-      /*if (theMode == TopAbs_VERTEX) {
-        ic->ActivateStandardMode(TopAbs_EDGE);
-        ic->ActivateStandardMode(TopAbs_VERTEX);
-      }*/
+      ic->Display(anAIS, false);
+      ic->Load(anAIS, -1, true/*allow decomposition*/);
+      std::list<int>::const_iterator anIt = theModes.begin(), aLast = theModes.end();
+      for (; anIt != aLast; anIt++) 
+        ic->Activate(anAIS, AIS_Shape::SelectionMode((TopAbs_ShapeEnum)*anIt));
     }
   }
   if (isUpdateViewer)
index 3ca9b964cca77c971ebcf291c7034fe9f5e27969..ec9d69649151d811a59b6730610082deec7a2562 100644 (file)
@@ -16,6 +16,7 @@
 
 #include <map>
 #include <vector>
+#include <list>
 
 class XGUI_Viewer;
 class ModelAPI_Feature;
@@ -61,7 +62,7 @@ public:
   /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
   void RedisplayInLocalContext(boost::shared_ptr<ModelAPI_Feature> theFeature,
                              const TopoDS_Shape& theShape,
-                             const int theMode, const bool isUpdateViewer = true);
+                             const std::list<int>& theMode, const bool isUpdateViewer = true);
 
   /// Erase the feature and a shape.
   /// \param theFeature a feature instance