Salome HOME
#1182 point is attched to Sketch Constraint line
authornds <nds@opencascade.com>
Fri, 25 Dec 2015 16:10:28 +0000 (19:10 +0300)
committernds <nds@opencascade.com>
Fri, 25 Dec 2015 16:10:28 +0000 (19:10 +0300)
src/PartSet/PartSet_WidgetPoint2DFlyout.cpp
src/PartSet/PartSet_WidgetPoint2DFlyout.h
src/PartSet/PartSet_WidgetPoint2d.cpp
src/PartSet/PartSet_WidgetPoint2d.h

index e501d9ac44f3e110ae5568b4618cb08fedee39f4..fa0b7257963df2df2d33df7536fdf3c92bce3d93 100755 (executable)
@@ -24,6 +24,11 @@ PartSet_WidgetPoint2DFlyout::PartSet_WidgetPoint2DFlyout(QWidget* theParent,
 {
 }
 
+bool PartSet_WidgetPoint2DFlyout::useSelectedShapes() const
+{
+  return false;
+}
+
 bool PartSet_WidgetPoint2DFlyout::focusTo()
 {
   bool aCanAcceptFocus = true;
index 6a76e19bc4f7742df38953faff5cd2c107eca8e1..637d14f5242f1c86f13a96da107624bdf99d0681 100755 (executable)
@@ -37,6 +37,10 @@ public:
   /// \return the state whether the widget can accept the focus
   virtual bool focusTo();
 
+  /// Returns true if the attribute can be changed using the selected shapes in the viewer
+  /// and creating a coincidence constraint to them. This control does not use them.
+  virtual bool useSelectedShapes() const;
+
 private:
   //! Returns workshop
   XGUI_Workshop* workshop() const;
index e8555daed568bdede8f07571dcff437dc0255852..d34128d1643ab53de997642e8847f87117f56109 100644 (file)
@@ -359,8 +359,8 @@ void PartSet_WidgetPoint2D::onMouseRelease(ModuleBase_IViewWindow* theWnd, QMous
   NCollection_List<TopoDS_Shape> aShapes;
   std::list<ObjectPtr> aObjects;
   aSelection->selectedShapes(aShapes, aObjects);
-  // if we have selection
-  if (aShapes.Extent() > 0) {
+  // if we have selection and use it
+  if (aShapes.Extent() > 0 && useSelectedShapes()) {
     TopoDS_Shape aShape = aShapes.First();
     ObjectPtr aObject = aObjects.front();
     FeaturePtr aSelectedFeature = ModelAPI_Feature::feature(aObject);
@@ -541,6 +541,11 @@ bool PartSet_WidgetPoint2D::processEnter()
   return isModified;
 }
 
+bool PartSet_WidgetPoint2D::useSelectedShapes() const
+{
+  return true;
+}
+
 bool PartSet_WidgetPoint2D::isOrphanPoint(const FeaturePtr& theFeature,
                                           const CompositeFeaturePtr& theSketch,
                                           double theX, double theY)
index e32cf72c190530d98a6ba3b55c395338e3f596f3..6985ffa4efb7684210fe4116c0bcf21346ab223b 100755 (executable)
@@ -93,6 +93,10 @@ Q_OBJECT
   /// Returns true if the event is processed.
   virtual bool processEnter();
 
+  /// Returns true if the attribute can be changed using the selected shapes in the viewer
+  /// and creating a coincidence constraint to them. This control use them.
+  virtual bool useSelectedShapes() const;
+
 signals:
   /// Signal about selection of an existing vertex from an object
   void vertexSelected();