]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
refs #80 - Sketch base GUI: create/draw point, circle and arc
authornds <natalia.donis@opencascade.com>
Wed, 25 Jun 2014 05:35:02 +0000 (09:35 +0400)
committernds <natalia.donis@opencascade.com>
Wed, 25 Jun 2014 05:35:02 +0000 (09:35 +0400)
Edit for constraint.

src/ModuleBase/ModuleBase_ModelWidget.h
src/ModuleBase/ModuleBase_WidgetEditor.cpp
src/ModuleBase/ModuleBase_WidgetEditor.h
src/PartSet/CMakeLists.txt
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_OperationEditConstraint.cpp [deleted file]
src/PartSet/PartSet_OperationEditConstraint.h [deleted file]
src/PartSet/PartSet_OperationFeatureEdit.cpp
src/PartSet/PartSet_OperationFeatureEdit.h
src/PartSet/PartSet_OperationSketch.cpp

index 5a13b4cc08d4d7f8f506246adacd95f5b7b57aa1..4bb40e3628973a4bfc4e65f824ee70ad7c6814dd 100644 (file)
@@ -74,6 +74,10 @@ signals:
   void focusOutWidget(ModuleBase_ModelWidget* theWidget);
 
 protected:
+  /// Returns the attribute name
+  /// \returns the string value
+  void setAttributeID(const std::string& theAttribute) { myAttributeID = theAttribute; }
+
   bool myHasDefaultValue; /// the boolean state whether the control has a default value
 
 private:
index afffeeae464fb206fd473b5472035b28815dda83..fe901b9a1840cc1b579be609758b953b6656d00e 100644 (file)
@@ -29,6 +29,12 @@ ModuleBase_WidgetEditor::ModuleBase_WidgetEditor(QWidget* theParent,
 {
 }
 
+ModuleBase_WidgetEditor::ModuleBase_WidgetEditor(QWidget* theParent, const std::string& theAttribute)
+: ModuleBase_ModelWidget(theParent, 0), myValue(0)
+{
+  this->setAttributeID(theAttribute);
+}
+
 ModuleBase_WidgetEditor::~ModuleBase_WidgetEditor()
 {
 }
@@ -87,3 +93,11 @@ QList<QWidget*> ModuleBase_WidgetEditor::getControls() const
   return aControls;
 }
 
+void ModuleBase_WidgetEditor::editFeatureValue(FeaturePtr theFeature, const std::string theAttribute)
+{
+  ModuleBase_WidgetEditor anEditor(0, theAttribute);
+
+  anEditor.restoreValue(theFeature);
+  anEditor.focusTo();
+  anEditor.storeValue(theFeature);
+}
index ec670f402cb9deb3e50bb7ad51b29b024f4db1fc..657e2303a3bedf2985d010d4fab3bcf51468841c 100644 (file)
@@ -27,6 +27,12 @@ public:
   /// \theParent the parent object
   /// \theData the widget configuation. The attribute of the model widget is obtained from
   ModuleBase_WidgetEditor(QWidget* theParent, const Config_WidgetAPI* theData);
+  /// Constructor
+  /// \theParent the parent object
+  /// \theParent the parent object
+  /// \theData the widget configuation. The attribute of the model widget is obtained from
+  ModuleBase_WidgetEditor(QWidget* theParent, const std::string& theAttribute);
+
   /// Destructor
   virtual ~ModuleBase_WidgetEditor();
 
@@ -48,6 +54,8 @@ public:
   /// \return a control list
   virtual QList<QWidget*> getControls() const;
 
+  static void editFeatureValue(FeaturePtr theFeature, const std::string theAttribute);
+
 private:
   FeaturePtr myFeature; ///< the current widget feature
   QStringList myFeatureKinds; ///< the kinds of possible features
index a429b06778343a782551c21044abb3fee95693bd..abba90df240d7a11bec858c4188c76a732297954 100644 (file)
@@ -18,7 +18,6 @@ SET(PROJECT_HEADERS
        PartSet_Module.h
        PartSet_OperationCreateConstraint.h
        PartSet_OperationCreateFeature.h
-       PartSet_OperationEditConstraint.h
        PartSet_OperationFeatureCreate.h
        PartSet_OperationFeatureEdit.h
        PartSet_OperationFeatureEditMulti.h
@@ -42,7 +41,6 @@ SET(PROJECT_SOURCES
        PartSet_Module.cpp
        PartSet_OperationCreateConstraint.cpp
        PartSet_OperationCreateFeature.cpp
-       PartSet_OperationEditConstraint.cpp
        PartSet_OperationFeatureCreate.cpp
        PartSet_OperationFeatureEdit.cpp
        PartSet_OperationFeatureEditMulti.cpp
index fb9983b01ef67b8750df301d589c58e408f4f98b..fd8f12fbb020c0d54e541b53ac8895c8bbb69dec 100644 (file)
@@ -1,7 +1,6 @@
 #include <PartSet_Module.h>
 #include <PartSet_OperationSketch.h>
 #include <PartSet_OperationCreateFeature.h>
-#include <PartSet_OperationEditConstraint.h>
 #include <PartSet_OperationCreateConstraint.h>
 #include <PartSet_OperationFeatureCreate.h>
 #include <PartSet_OperationFeatureEditMulti.h>
@@ -359,8 +358,6 @@ ModuleBase_Operation* PartSet_Module::createOperation(const std::string& theCmdI
       anOperation = new PartSet_OperationFeatureEdit(theCmdId.c_str(), this, aSketch);
     else if (PartSet_OperationCreateConstraint::canProcessKind(theCmdId))
       anOperation = new PartSet_OperationCreateConstraint(theCmdId.c_str(), this, aSketch);
-    else if (theCmdId == PartSet_OperationEditConstraint::Type())
-      anOperation = new PartSet_OperationEditConstraint(theCmdId.c_str(), theFeatureKind, this, aSketch);
   }
 
   if (!anOperation) {
diff --git a/src/PartSet/PartSet_OperationEditConstraint.cpp b/src/PartSet/PartSet_OperationEditConstraint.cpp
deleted file mode 100644 (file)
index d7ed7d0..0000000
+++ /dev/null
@@ -1,280 +0,0 @@
-// File:        PartSet_OperationEditConstraint.h
-// Created:     05 May 2014
-// Author:      Natalia ERMOLAEVA
-
-#include <PartSet_OperationEditConstraint.h>
-#include <PartSet_Tools.h>
-#include <PartSet_OperationSketch.h>
-#include <PartSet_EditLine.h>
-#include <PartSet_FeaturePrs.h>
-#include <PartSet_ConstraintRadiusPrs.h>
-
-#include <SketchPlugin_Constraint.h>
-
-#include <ModuleBase_OperationDescription.h>
-#include <Model_Events.h>
-
-#include <XGUI_ViewerPrs.h>
-
-#include <SketchPlugin_Feature.h>
-#include <GeomDataAPI_Point2D.h>
-#include <ModelAPI_Data.h>
-#include <ModelAPI_Document.h>
-
-#include <Model_Events.h>
-
-#include <Events_Loop.h>
-
-#include <SketchPlugin_Line.h>
-
-#include <V3d_View.hxx>
-#include <AIS_LengthDimension.hxx>
-
-#ifdef _DEBUG
-#include <QDebug>
-#endif
-
-#include <QMouseEvent>
-
-using namespace std;
-
-PartSet_OperationEditConstraint::PartSet_OperationEditConstraint(const QString& theId,
-                                              const std::string& theFeatureKind,
-                                                 QObject* theParent,
-                                              FeaturePtr theFeature)
-: PartSet_OperationSketchBase(theId, theParent), myIsBlockedSelection(false)
-{
-  myFeaturePrs = PartSet_Tools::createFeaturePrs(theFeatureKind, theFeature);
-
-  // changed
-  myEditor = new PartSet_EditLine(0);
-  connect(myEditor, SIGNAL(stopped(double)), this, SLOT(onEditStopped(double)));
-}
-
-PartSet_OperationEditConstraint::~PartSet_OperationEditConstraint()
-{
-}
-
-bool PartSet_OperationEditConstraint::isGranted(ModuleBase_IOperation* theOperation) const
-{
-  return theOperation->getDescription()->operationId().toStdString() == PartSet_OperationSketch::Type();
-}
-
-std::list<int> PartSet_OperationEditConstraint::getSelectionModes(FeaturePtr theFeature) const
-{
-  return PartSet_OperationSketchBase::getSelectionModes(theFeature);
-}
-
-void PartSet_OperationEditConstraint::init(FeaturePtr theFeature,
-                                     const std::list<XGUI_ViewerPrs>& theSelected,
-                                     const std::list<XGUI_ViewerPrs>& theHighlighted)
-{
-  setEditingFeature(theFeature);
-  myFeaturePrs->init(theFeature);
-
-  /*
-  if (!theHighlighted.empty()) {
-    // if there is highlighted object, we check whether it is in the list of selected objects
-    // in that case this object is a handle of the moved lines. If there no such object in the selection,
-    // the hightlighted object should moved and the selection is skipped. The skipped selection will be
-    // deselected in the viewer by blockSelection signal in the startOperation method.
-    bool isSelected = false;
-    std::list<XGUI_ViewerPrs>::const_iterator anIt = theSelected.begin(), aLast = theSelected.end();
-    for (; anIt != aLast && !isSelected; anIt++) {
-      isSelected = (*anIt).feature() == feature();
-    }
-    if (!isSelected)
-      myFeatures = theHighlighted;
-    else
-      myFeatures = theSelected;
-  }
-  else
-    myFeatures = theSelected;*/
-}
-
-FeaturePtr PartSet_OperationEditConstraint::sketch() const
-{
-  return myFeaturePrs->sketch();
-}
-
-void PartSet_OperationEditConstraint::mousePressed(QMouseEvent* theEvent, Handle(V3d_View) theView,
-                                             const std::list<XGUI_ViewerPrs>& theSelected,
-                                             const std::list<XGUI_ViewerPrs>& theHighlighted)
-{
-  //if (myFeatures.size() == 1)
-  {
-    FeaturePtr aFeature;
-    if (!theHighlighted.empty())
-      aFeature = theHighlighted.front().feature();
-    if (!aFeature && !theSelected.empty()) // changed
-      aFeature = theSelected.front().feature();
-
-    if (aFeature && aFeature == feature()) { // continue the feature edit
-    }
-    else {
-      //XGUI_ViewerPrs aFeaturePrs = myFeatures.front();
-      commit();
-      emit featureConstructed(feature(), FM_Deactivation);
-
-      /*bool aHasShift = (theEvent->modifiers() & Qt::ShiftModifier);
-      if(aHasShift && !theHighlighted.empty()) {
-        std::list<XGUI_ViewerPrs> aSelected;
-        aSelected.push_back(aFeaturePrs);
-        aSelected.push_back(theHighlighted.front());
-        emit setSelection(aSelected);
-      }
-      else if (aFeature) {
-        restartOperation(PartSet_OperationEditConstraint::Type(), aFeature);
-      }*/
-    }
-  }
-}
-
-void PartSet_OperationEditConstraint::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) theView)
-{
-  if (!(theEvent->buttons() &  Qt::LeftButton))
-    return;
-
-  gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), theView);
-
-  blockSelection(true);
-  if (myCurPoint.myIsInitialized) {
-    /*double aCurX, aCurY;
-    PartSet_Tools::convertTo2D(myCurPoint.myPoint, sketch(), theView, aCurX, aCurY);
-
-    double aX, anY;
-    PartSet_Tools::convertTo2D(aPoint, sketch(), theView, aX, anY);
-
-
-    if (feature()->getKind() == PartSet_ConstraintRadiusPrs::getKind()) {
-      boost::shared_ptr<PartSet_ConstraintRadiusPrs> anArcPrs =
-                              boost::dynamic_pointer_cast<PartSet_ConstraintRadiusPrs>(myFeaturePrs);
-      if (anArcPrs) {
-        anArcPrs->projectPointOnFeature(feature(), sketch(), aPoint, theView, aX, anY);
-      }
-    }
-    myFeaturePrs->setPoint(aX, anY, SM_LastPoint);*/
-    double aCurX, aCurY;
-    PartSet_Tools::convertTo2D(myCurPoint.myPoint, sketch(), theView, aCurX, aCurY);
-
-    double aX, anY;
-    PartSet_Tools::convertTo2D(aPoint, sketch(), theView, aX, anY);
-
-    double aDeltaX = aX - aCurX;
-    double aDeltaY = anY - aCurY;
-
-    boost::shared_ptr<SketchPlugin_Feature> aSketchFeature = 
-                           boost::dynamic_pointer_cast<SketchPlugin_Feature>(feature());
-    aSketchFeature->move(aDeltaX, aDeltaY);
-  }
-  sendFeatures();
-
-  myCurPoint.setPoint(aPoint);
-}
-
-void PartSet_OperationEditConstraint::mouseReleased(QMouseEvent* theEvent, Handle(V3d_View) theView,
-                                              const std::list<XGUI_ViewerPrs>& /*theSelected*/,
-                                              const std::list<XGUI_ViewerPrs>& /*theHighlighted*/)
-{
-  //std::list<XGUI_ViewerPrs> aFeatures = myFeatures;
-  //if (myFeatures.size() == 1) {
-    blockSelection(false);
-  /*}
-  else {
-    commit();
-    std::list<XGUI_ViewerPrs>::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end();
-    for (; anIt != aLast; anIt++) {
-      FeaturePtr aFeature = (*anIt).feature();
-      if (aFeature)
-        emit featureConstructed(aFeature, FM_Deactivation);
-    }
-  }*/
-}
-
-void PartSet_OperationEditConstraint::mouseDoubleClick(QMouseEvent* theEvent, Handle_V3d_View theView,
-                                               const std::list<XGUI_ViewerPrs>& theSelected,
-                                               const std::list<XGUI_ViewerPrs>& theHighlighted)
-{
-  // changed
-  if (!theSelected.empty()) {
-    bool isValid;
-    double aValue = PartSet_Tools::featureValue(feature(), CONSTRAINT_ATTR_VALUE, isValid);
-    if (isValid) {
-      QPoint aPos = theEvent->globalPos();
-      myEditor->start(aPos, aValue);
-    }
-  }
-}
-
-void PartSet_OperationEditConstraint::startOperation()
-{
-  PartSet_OperationSketchBase::startOperation();
-  emit multiSelectionEnabled(false);
-
-  //if (myFeatures.size() > 1)
-  //  blockSelection(true);
-
-  myCurPoint.clear();
-}
-
-void PartSet_OperationEditConstraint::stopOperation()
-{
-  emit multiSelectionEnabled(true);
-
-  //blockSelection(false, myFeatures.size() > 1);
-
-  //myFeatures.clear();
-}
-
-void PartSet_OperationEditConstraint::blockSelection(bool isBlocked, const bool isRestoreSelection)
-{
-  if (myIsBlockedSelection == isBlocked)
-    return;
-
-  myIsBlockedSelection = isBlocked;
-  if (isBlocked) {
-    emit setSelection(QFeatureList());
-    //emit stopSelection(myFeatures, true);
-  }
-  else {
-    //emit stopSelection(myFeatures, false);
-    //if (isRestoreSelection)
-    //  emit setSelection(myFeatures);
-  }
-}
-
-FeaturePtr PartSet_OperationEditConstraint::createFeature(const bool /*theFlushMessage*/)
-{
-  // do nothing in order to do not create a new feature
-  return FeaturePtr();
-}
-
-void PartSet_OperationEditConstraint::sendFeatures()
-{
-  static Events_ID anEvent = Events_Loop::eventByName(EVENT_FEATURE_MOVED);
-
-  std::list<FeaturePtr> aFeatures;
-  aFeatures.push_back(feature());
-  std::list<FeaturePtr>::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end();
-  //std::list<XGUI_ViewerPrs>::const_iterator anIt = myFeatures.begin(), aLast = myFeatures.end();
-  for (; anIt != aLast; anIt++) {
-    FeaturePtr aFeature = (*anIt);//.feature();
-    if (!aFeature)
-      continue;
-
-    Model_FeatureUpdatedMessage aMessage(aFeature, anEvent);
-    Events_Loop::loop()->send(aMessage);
-  }
-  Events_Loop::loop()->flush(anEvent);
-  flushUpdated();
-}
-
-void PartSet_OperationEditConstraint::onEditStopped(double theValue)
-{
-  PartSet_Tools::setFeatureValue(feature(), theValue, CONSTRAINT_ATTR_VALUE);
-
-  flushUpdated();
-  commit();
-  emit featureConstructed(feature(), FM_Deactivation);
-  //restartOperation(feature()->getKind(), FeaturePtr());
-}
diff --git a/src/PartSet/PartSet_OperationEditConstraint.h b/src/PartSet/PartSet_OperationEditConstraint.h
deleted file mode 100644 (file)
index 1c2bfee..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
-// File:        PartSet_OperationEditConstraint.h
-// Created:     05 May 2014
-// Author:      Natalia ERMOLAEVA
-
-#ifndef PartSet_OperationEditConstraint_H
-#define PartSet_OperationEditConstraint_H
-
-#include "PartSet.h"
-
-#include <PartSet_OperationSketchBase.h>
-#include <QObject>
-
-class PartSet_EditLine;
-class PartSet_FeaturePrs;
-class QMouseEvent;
-
-/*!
- \class PartSet_OperationEditConstraint
- * \brief The operation for the sketch feature creation
-*/
-class PARTSET_EXPORT PartSet_OperationEditConstraint : public PartSet_OperationSketchBase                                                 
-{
-  Q_OBJECT
-  /// Struct to define gp point, with the state is the point is initialized
-  struct Point
-  {
-    /// Constructor
-    Point() {}
-    /// Constructor
-    /// \param thePoint the point
-    Point(gp_Pnt thePoint)
-    {
-      setPoint(thePoint);
-    }
-    ~Point() {}
-
-    /// clear the initialized flag.
-    void clear() { myIsInitialized = false; }
-    /// set the point and switch on the initialized flag
-    /// \param thePoint the point
-    void setPoint(const gp_Pnt& thePoint)
-    {
-      myIsInitialized = true;
-      myPoint = thePoint;
-    }
-
-    bool myIsInitialized; /// the state whether the point is set
-    gp_Pnt myPoint; /// the point
-  };
-
-public:
-  /// Returns the operation type key
-  static std::string Type() { return "EditConstraint"; }
-
-public:
-  /// Constructor
-  /// \param theId the feature identifier
-  /// \param theFeatureId the feature identifier
-  /// \param theParent the operation parent
-  /// \param theFeature the parent feature
-  PartSet_OperationEditConstraint(const QString& theId, const std::string& theFeatureKind,
-                            QObject* theParent, FeaturePtr theFeature);
-  /// Destructor
-  virtual ~PartSet_OperationEditConstraint();
-
-  /// Returns that this operator can be started above already running one.
-  /// The runned operation should be the sketch feature modified operation
-  /// \param theOperation the previous running operation
-  virtual bool isGranted(ModuleBase_IOperation* theOperation) const;
-
-  /// Returns the operation local selection mode
-  /// \param theFeature the feature object to get the selection mode
-  /// \return the selection mode
-  virtual std::list<int> getSelectionModes(FeaturePtr theFeature) const;
-
-  /// Initializes some fields accorging to the feature
-  /// \param theFeature the feature
-  /// \param theSelected the list of selected presentations
-  /// \param theHighlighted the list of highlighted presentations
-  virtual void init(FeaturePtr theFeature,
-                    const std::list<XGUI_ViewerPrs>& theSelected,
-                    const std::list<XGUI_ViewerPrs>& theHighlighted);
-
-  /// Returns the operation sketch feature
-  /// \returns the sketch instance
-  virtual FeaturePtr sketch() const;
-
-  /// Processes the mouse pressed in the point
-  /// \param theEvent the mouse event
-  /// \param theView a viewer to have the viewer the eye position
-  /// \param theSelected the list of selected presentations
-  /// \param theHighlighted the list of highlighted presentations
-  virtual void mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView,
-                            const std::list<XGUI_ViewerPrs>& theSelected,
-                            const std::list<XGUI_ViewerPrs>& theHighlighted);
-  /// Gives the current mouse point in the viewer
-  /// \param theEvent the mouse event
-  /// \param theView a viewer to have the viewer the eye position
-  virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView);
-  /// Gives the current selected objects to be processed by the operation
-  /// \param thePoint a point clicked in the viewer
-  /// \param theEvent the mouse event
-  /// \param theSelected the list of selected presentations
-  /// \param theHighlighted the list of highlighted presentations
- virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
-                            const std::list<XGUI_ViewerPrs>& theSelected,
-                            const std::list<XGUI_ViewerPrs>& theHighlighted);
-  /// Processes the mouse double click in the point
-  /// \param theEvent the mouse event
-  /// \param theView a viewer to have the viewer the eye position
-  /// \param theSelected the list of selected presentations
-  /// \param theHighlighted the list of highlighted presentations
-  virtual void mouseDoubleClick(QMouseEvent* theEvent, Handle_V3d_View theView,
-                                const std::list<XGUI_ViewerPrs>& theSelected,
-                                const std::list<XGUI_ViewerPrs>& theHighlighted);
-
-protected:
-  /// \brief Virtual method called when operation is started
-  /// Virtual method called when operation started (see start() method for more description)
-  /// Switch off the multi selection state
-  virtual void startOperation();
-
-  /// Virtual method called when operation stopped - committed or aborted.
-  /// Restore the multi selection state
-  virtual void stopOperation();
-
-  /// Creates an operation new feature
-  /// Returns NULL feature. This is an operation of edition, not creation.
-  /// \param theFlushMessage the flag whether the create message should be flushed
-  /// \returns the created feature
-  virtual FeaturePtr createFeature(const bool theFlushMessage = true);
-
-protected:
-  /// Emits a signal about the selection blocking. Emits a signal to change the selection.
-  /// If the block is true, the signal clear selection, otherwise if restore selection flag allows,
-  /// the internal operation features are to be selected
-  /// \param isBlocked the state whether the operation is blocked or unblocked
-  /// \param isRestoreSelection the state whether the selected objects should be reselected
-  void blockSelection(bool isBlocked, const bool isRestoreSelection = true);
-
-  /// Sends the features
-  void sendFeatures();
-
-protected slots:
-  /// SLOT, that listens the value edited signal and set the new value to the feature
-  /// \param theValue the editor value
-  void onEditStopped(double theValue);
-
-private:
-  PartSet_EditLine* myEditor; ///< the constraint value editor
-  boost::shared_ptr<PartSet_FeaturePrs> myFeaturePrs; ///< the feature presentation
-  //std::list<XGUI_ViewerPrs> myFeatures; ///< the features to apply the edit operation
-  Point myCurPoint; ///< the current 3D point clicked or moved
-  bool myIsBlockedSelection; ///< the state of the last state of selection blocked signal
-};
-
-#endif
index 2626c68993895b781fe05bcae3639204019a3550..d87a1b5b58b313ac9e3fbf647e7e93fd80ee803d 100644 (file)
@@ -6,7 +6,10 @@
 #include <PartSet_Tools.h>
 #include <PartSet_OperationSketch.h>
 
+#include <SketchPlugin_Constraint.h>
+
 #include <ModuleBase_OperationDescription.h>
+#include <ModuleBase_WidgetEditor.h>
 #include <Model_Events.h>
 
 #include <XGUI_ViewerPrs.h>
@@ -66,12 +69,14 @@ FeaturePtr PartSet_OperationFeatureEdit::sketch() const
 }
 
 void PartSet_OperationFeatureEdit::mousePressed(QMouseEvent* theEvent, Handle(V3d_View) theView,
-                                             const std::list<XGUI_ViewerPrs>& /*theSelected*/,
+                                             const std::list<XGUI_ViewerPrs>& theSelected,
                                              const std::list<XGUI_ViewerPrs>& theHighlighted)
 {
   FeaturePtr aFeature;
   if (!theHighlighted.empty())
     aFeature = theHighlighted.front().feature();
+  if (!aFeature && !theSelected.empty()) // changed for a constrain
+    aFeature = theSelected.front().feature();
 
   if (!aFeature || aFeature != feature())
   {
@@ -125,6 +130,23 @@ void PartSet_OperationFeatureEdit::mouseReleased(QMouseEvent* theEvent, Handle(V
   blockSelection(false);
 }
 
+void PartSet_OperationFeatureEdit::mouseDoubleClick(QMouseEvent* theEvent, Handle_V3d_View theView,
+                                                    const std::list<XGUI_ViewerPrs>& theSelected,
+                                                    const std::list<XGUI_ViewerPrs>& theHighlighted)
+{
+  // changed
+  if (!theSelected.empty()) {
+    bool isValid;
+    double aValue = PartSet_Tools::featureValue(feature(), CONSTRAINT_ATTR_VALUE, isValid);
+    if (isValid) {
+      ModuleBase_WidgetEditor::editFeatureValue(feature(), CONSTRAINT_ATTR_VALUE);
+
+      //QPoint aPos = theEvent->globalPos();
+      //myEditor->start(aPos, aValue);
+    }
+  }
+}
+
 void PartSet_OperationFeatureEdit::startOperation()
 {
   PartSet_OperationSketchBase::startOperation();
index 46595842e1308e6d98ff351c3fbb8bb3b012d1e2..0071c967ad43121d31658048e34c2ef1444edc30 100644 (file)
@@ -102,6 +102,15 @@ public:
  virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
                             const std::list<XGUI_ViewerPrs>& theSelected,
                             const std::list<XGUI_ViewerPrs>& theHighlighted);
+
+  /// Processes the mouse double click in the point
+  /// \param theEvent the mouse event
+  /// \param theView a viewer to have the viewer the eye position
+  /// \param theSelected the list of selected presentations
+  /// \param theHighlighted the list of highlighted presentations
+  virtual void mouseDoubleClick(QMouseEvent* theEvent, Handle_V3d_View theView,
+                                const std::list<XGUI_ViewerPrs>& theSelected,
+                                const std::list<XGUI_ViewerPrs>& theHighlighted);
 protected:
   /// \brief Virtual method called when operation is started
   /// Virtual method called when operation started (see start() method for more description)
index 702f8cdb6764718f0ff1e77e6907d5403283ce11..b5400edec911f671fd3464751e51d7db8941347d 100644 (file)
@@ -6,7 +6,6 @@
 
 #include <PartSet_OperationFeatureEdit.h>
 #include <PartSet_OperationFeatureEditMulti.h>
-#include <PartSet_OperationEditConstraint.h>
 #include <PartSet_Tools.h>
 
 #include <SketchPlugin_Sketch.h>
@@ -245,10 +244,5 @@ void PartSet_OperationSketch::setSketchPlane(const TopoDS_Shape& theShape)
 
 std::string PartSet_OperationSketch::getOperationType(FeaturePtr theFeature)
 {
-  std::string aType = PartSet_OperationFeatureEdit::Type();
-
-  if (PartSet_Tools::isConstraintFeature(theFeature->getKind())) {
-    aType = PartSet_OperationEditConstraint::Type();
-  }
-  return aType;
+  return PartSet_OperationFeatureEdit::Type();
 }