]> 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 06:04:51 +0000 (10:04 +0400)
committernds <natalia.donis@opencascade.com>
Wed, 25 Jun 2014 06:04:51 +0000 (10:04 +0400)
Remove previous create constraint/feature operation. The OperationCreateFeature is used instead of them.

src/PartSet/CMakeLists.txt
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_OperationCreateConstraint.cpp [deleted file]
src/PartSet/PartSet_OperationCreateConstraint.h [deleted file]
src/PartSet/PartSet_OperationCreateFeature.cpp [deleted file]
src/PartSet/PartSet_OperationCreateFeature.h [deleted file]

index abba90df240d7a11bec858c4188c76a732297954..794def4031699f30dbb6472fe2a2acd48d809776 100644 (file)
@@ -16,8 +16,6 @@ SET(PROJECT_HEADERS
        PartSet_FeaturePointPrs.h
        PartSet_Listener.h
        PartSet_Module.h
-       PartSet_OperationCreateConstraint.h
-       PartSet_OperationCreateFeature.h
        PartSet_OperationFeatureCreate.h
        PartSet_OperationFeatureEdit.h
        PartSet_OperationFeatureEditMulti.h
@@ -39,8 +37,6 @@ SET(PROJECT_SOURCES
        PartSet_FeaturePointPrs.cpp
        PartSet_Listener.cpp
        PartSet_Module.cpp
-       PartSet_OperationCreateConstraint.cpp
-       PartSet_OperationCreateFeature.cpp
        PartSet_OperationFeatureCreate.cpp
        PartSet_OperationFeatureEdit.cpp
        PartSet_OperationFeatureEditMulti.cpp
index fd8f12fbb020c0d54e541b53ac8895c8bbb69dec..1266a0cb1e503eba2ada7e35c8823c4d6c2ddd74 100644 (file)
@@ -1,7 +1,5 @@
 #include <PartSet_Module.h>
 #include <PartSet_OperationSketch.h>
-#include <PartSet_OperationCreateFeature.h>
-#include <PartSet_OperationCreateConstraint.h>
 #include <PartSet_OperationFeatureCreate.h>
 #include <PartSet_OperationFeatureEditMulti.h>
 #include <PartSet_OperationFeatureEdit.h>
@@ -350,14 +348,10 @@ ModuleBase_Operation* PartSet_Module::createOperation(const std::string& theCmdI
       aSketch = aPrevOp->sketch();
     if (PartSet_OperationFeatureCreate::canProcessKind(theCmdId))
       anOperation = new PartSet_OperationFeatureCreate(theCmdId.c_str(), this, aSketch);
-       else if (PartSet_OperationCreateFeature::canProcessKind(theCmdId))
-      anOperation = new PartSet_OperationCreateFeature(theCmdId.c_str(), this, aSketch);
-       else if (theCmdId == PartSet_OperationFeatureEditMulti::Type())
+    else if (theCmdId == PartSet_OperationFeatureEditMulti::Type())
                anOperation = new PartSet_OperationFeatureEditMulti(theCmdId.c_str(), this, aSketch);
     else if (theCmdId == PartSet_OperationFeatureEdit::Type())
       anOperation = new PartSet_OperationFeatureEdit(theCmdId.c_str(), this, aSketch);
-    else if (PartSet_OperationCreateConstraint::canProcessKind(theCmdId))
-      anOperation = new PartSet_OperationCreateConstraint(theCmdId.c_str(), this, aSketch);
   }
 
   if (!anOperation) {
diff --git a/src/PartSet/PartSet_OperationCreateConstraint.cpp b/src/PartSet/PartSet_OperationCreateConstraint.cpp
deleted file mode 100644 (file)
index aff514a..0000000
+++ /dev/null
@@ -1,297 +0,0 @@
-// File:        PartSet_OperationCreateConstraint.h
-// Created:     20 Apr 2014
-// Author:      Natalia ERMOLAEVA
-
-#include <PartSet_OperationCreateConstraint.h>
-
-#include <PartSet_Tools.h>
-#include <PartSet_OperationSketch.h>
-#include <PartSet_FeaturePointPrs.h>
-#include <PartSet_FeatureLinePrs.h>
-#include <PartSet_FeatureCirclePrs.h>
-#include <PartSet_FeatureArcPrs.h>
-#include <PartSet_EditLine.h>
-
-#include <SketchPlugin_Feature.h>
-/*#include <SketchPlugin_Point.h>
-#include <SketchPlugin_Line.h>
-#include <SketchPlugin_Circle.h>
-#include <SketchPlugin_Arc.h>
-*/
-
-#include <PartSet_ConstraintRadiusPrs.h>
-
-#include <SketchPlugin_Constraint.h>
-
-#include <ModuleBase_OperationDescription.h>
-
-#include <XGUI_ViewerPrs.h>
-#include <XGUI_Constants.h>
-
-#include <V3d_View.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <TopoDS.hxx>
-#include <BRep_Tool.hxx>
-
-#ifdef _DEBUG
-#include <QDebug>
-#endif
-
-#include <QMouseEvent>
-
-using namespace std;
-
-PartSet_OperationCreateConstraint::PartSet_OperationCreateConstraint(const QString& theId,
-                                                               QObject* theParent,
-                                                               FeaturePtr theFeature)
-: PartSet_OperationSketchBase(theId, theParent),
-  myPointSelectionMode(SM_FirstPoint)
-{
-  std::string aKind = theId.toStdString();
-  myFeaturePrs = PartSet_Tools::createFeaturePrs(aKind, theFeature);
-
-  // changed
-  myEditor = new PartSet_EditLine(0);
-  connect(myEditor, SIGNAL(stopped(double)), this, SLOT(onEditStopped(double)));
-}
-
-PartSet_OperationCreateConstraint::~PartSet_OperationCreateConstraint()
-{
-}
-
-bool PartSet_OperationCreateConstraint::canProcessKind(const std::string& theId)
-{
-  // changed
-  return PartSet_Tools::isConstraintFeature(theId);
-}
-
-bool PartSet_OperationCreateConstraint::canBeCommitted() const
-{
-  return myPointSelectionMode == SM_DonePoint;
-}
-
-bool PartSet_OperationCreateConstraint::isGranted(ModuleBase_IOperation* theOperation) const
-{
-  return theOperation->getDescription()->operationId().toStdString() == PartSet_OperationSketch::Type();
-}
-
-std::list<int> PartSet_OperationCreateConstraint::getSelectionModes(FeaturePtr theFeature) const
-{
-  std::list<int> aModes;
-  if (theFeature != feature())
-    aModes = PartSet_OperationSketchBase::getSelectionModes(theFeature);
-  return aModes;
-}
-
-void PartSet_OperationCreateConstraint::init(FeaturePtr theFeature,
-                                       const std::list<XGUI_ViewerPrs>& /*theSelected*/,
-                                       const std::list<XGUI_ViewerPrs>& /*theHighlighted*/)
-{
-  // changed
-  if (!theFeature/* || theFeature->getKind() != SKETCH_LINE_KIND*/)
-    return;
-  myInitFeature = theFeature;
-}
-
-FeaturePtr PartSet_OperationCreateConstraint::sketch() const
-{
-  return myFeaturePrs->sketch();
-}
-
-void PartSet_OperationCreateConstraint::mouseReleased(QMouseEvent* theEvent, Handle(V3d_View) theView,
-                                                const std::list<XGUI_ViewerPrs>& theSelected,
-                                                const std::list<XGUI_ViewerPrs>& /*theHighlighted*/)
-{
-  switch (myPointSelectionMode)
-  {
-    case SM_FirstPoint:
-    case SM_SecondPoint: {
-      if (!theSelected.empty()) {
-        XGUI_ViewerPrs aPrs = theSelected.front();
-        FeaturePtr aFeature = aPrs.feature();
-
-        PartSet_SelectionMode aMode = myFeaturePrs->setFeature(aFeature, myPointSelectionMode);
-        if (aMode != myPointSelectionMode) {
-          flushUpdated();
-          setPointSelectionMode(aMode);
-        }
-      }
-    }
-    break;
-    case SM_LastPoint: {
-      double aX, anY;
-      gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), theView);
-      PartSet_Tools::convertTo2D(aPoint, sketch(), theView, aX, anY);
-
-      PartSet_SelectionMode aMode = myFeaturePrs->setPoint(aX, anY, myPointSelectionMode);
-      // show value edit dialog
-      bool isValid;
-      double aValue = PartSet_Tools::featureValue(feature(), CONSTRAINT_ATTR_VALUE, isValid);
-      if (isValid) {
-        showEditor(theEvent, aValue);
-      }
-    }
-    break;
-    default:
-      break;
-  }
-}
-
-void PartSet_OperationCreateConstraint::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) theView)
-{
-  // changed
-  switch (myPointSelectionMode)
-  {
-    //case SM_FirstPoint:
-    //case SM_SecondPoint:
-    case SM_LastPoint:
-    {
-      double aX, anY;
-      gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), theView);
-      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, myPointSelectionMode);
-
-      flushUpdated();
-      emit focusActivated(myFeaturePrs->getAttribute(myPointSelectionMode));
-    }
-    break;
-    case SM_DonePoint:
-    {
-      commit();
-      restartOperation(feature()->getKind(), feature());
-    }
-    default:
-      break;
-  }
-}
-
-void PartSet_OperationCreateConstraint::keyReleased(std::string theName, QKeyEvent* theEvent)
-{
-  int aKeyType = theEvent->key();
-  // the second point should be activated by any modification in the property panel
-  if (!theName.empty() /*&& aKeyType == Qt::Key_Return*/)
-  {
-    setPointSelectionMode(myFeaturePrs->getNextMode(theName), false);
-  }
-  keyReleased(theEvent->key());
-}
-
-void PartSet_OperationCreateConstraint::keyReleased(const int theKey)
-{
-  switch (theKey) {
-    case Qt::Key_Return: {
-      if (myPointSelectionMode == SM_DonePoint)
-      {
-        commit();
-        // it start a new line creation at a free point
-        restartOperation(feature()->getKind(), FeaturePtr()/*feature()*/);
-      }
-      // changed
-      // the modification is really need until the focus of editor do not accept the focus
-      if (myPointSelectionMode == SM_LastPoint && myEditor->isStarted()) {
-        myEditor->stop();
-        commit();
-        // it start a new line creation at a free point
-        restartOperation(feature()->getKind(), FeaturePtr()/*feature()*/);
-      }
-    }
-    break;
-    case Qt::Key_Escape: {
-      if (myEditor->isStarted())
-        myEditor->stop();
-      if (myPointSelectionMode == SM_DonePoint)
-      {
-        commit();
-      }
-      else
-      {
-        abort();
-      }
-    }
-    default:
-    break;
-  }
-}
-
-void PartSet_OperationCreateConstraint::startOperation()
-{
-  PartSet_OperationSketchBase::startOperation();
-  //setPointSelectionMode(!myInitFeature ? SM_FirstPoint : SM_SecondPoint);
-
-  emit multiSelectionEnabled(false);
-}
-
-void PartSet_OperationCreateConstraint::abortOperation()
-{
-  emit featureConstructed(feature(), FM_Hide);
-  PartSet_OperationSketchBase::abortOperation();
-}
-
-void PartSet_OperationCreateConstraint::stopOperation()
-{
-  PartSet_OperationSketchBase::stopOperation();
-  emit multiSelectionEnabled(true);
-}
-
-void PartSet_OperationCreateConstraint::afterCommitOperation()
-{
-  PartSet_OperationSketchBase::afterCommitOperation();  
-  emit featureConstructed(feature(), FM_Deactivation);
-}
-
-FeaturePtr PartSet_OperationCreateConstraint::createFeature(const bool theFlushMessage)
-{
-  FeaturePtr aNewFeature = ModuleBase_Operation::createFeature(false);
-  if (sketch()) {
-    boost::shared_ptr<SketchPlugin_Feature> aFeature = 
-                           boost::dynamic_pointer_cast<SketchPlugin_Feature>(sketch());
-
-    aFeature->addSub(aNewFeature);
-  }
-  myFeaturePrs->init(aNewFeature);
-  if (myInitFeature) {
-    PartSet_SelectionMode aMode = myFeaturePrs->setFeature(myInitFeature, SM_FirstPoint);
-    //setPointSelectionMode(aMode);
-  }
-
-  emit featureConstructed(aNewFeature, FM_Activation);
-  if (theFlushMessage)
-    flushCreated();
-  return aNewFeature;
-}
-
-void PartSet_OperationCreateConstraint::setPointSelectionMode(const PartSet_SelectionMode& theMode,
-                                                              const bool isToEmitSignal)
-{
-  myPointSelectionMode = theMode;
-  if (isToEmitSignal) {
-    std::string aName = myFeaturePrs->getAttribute(theMode);
-    if (aName.empty() && theMode == SM_DonePoint) {
-      aName = XGUI::PROP_PANEL_OK;
-    }
-    emit focusActivated(aName);
-  }
-}
-
-void PartSet_OperationCreateConstraint::showEditor(QMouseEvent* theEvent, double theValue)
-{
-  // changed
-  QPoint aPos = theEvent->globalPos();
-  myEditor->start(aPos, theValue);
-}
-
-void PartSet_OperationCreateConstraint::onEditStopped(double theValue)
-{
-  PartSet_Tools::setFeatureValue(feature(), theValue, CONSTRAINT_ATTR_VALUE);
-
-  flushUpdated();
-  commit();
-  restartOperation(feature()->getKind(), FeaturePtr());
-}
diff --git a/src/PartSet/PartSet_OperationCreateConstraint.h b/src/PartSet/PartSet_OperationCreateConstraint.h
deleted file mode 100644 (file)
index 311dbe5..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-// File:        PartSet_OperationCreateConstraint.h
-// Created:     20 Apr 2014
-// Author:      Natalia ERMOLAEVA
-
-#ifndef PartSet_OperationCreateConstraint_H
-#define PartSet_OperationCreateConstraint_H
-
-#include "PartSet.h"
-
-#include <PartSet_OperationSketchBase.h>
-#include <PartSet_Constants.h>
-
-#include <QObject>
-
-class PartSet_EditLine;
-class PartSet_FeaturePrs;
-class GeomDataAPI_Point2D;
-class QMouseEvent;
-class QKeyEvent;
-
-/*!
- \class PartSet_OperationCreateConstraint
- * \brief The operation for the sketch feature creation
-*/
-class PARTSET_EXPORT PartSet_OperationCreateConstraint : public PartSet_OperationSketchBase
-{
-  Q_OBJECT
-
-public:
-  /// Returns true if the feature with the given kind can be created by this operation
-  /// \param theId the feature kind
-  /// \return the boolean result
-  static bool canProcessKind(const std::string& theId);
-
-public:
-  /// Constructor
-  /// \param theId the feature identifier
-  /// \param theParent the operation parent
-  /// \param theSketch the parent feature
-  PartSet_OperationCreateConstraint(const QString& theId, QObject* theParent,
-                                 FeaturePtr theSketch);
-  /// Destructor
-  virtual ~PartSet_OperationCreateConstraint();
-
-  /// Verifies whether this operator can be commited.
-  /// \return Returns TRUE if current operation can be committed, e.g. all parameters are filled
-  virtual bool canBeCommitted() const;
-
-  /// 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 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;
-
-  /// Gives the current selected objects to be processed by the operation
-  /// \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 mouseReleased(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 thePoint a point clicked in the viewer
-  /// \param theEvent the mouse event
-  virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView);
-  /// Processes the key pressed in the view
-  /// \param theKey a key value
-  virtual void keyReleased(const int theKey);
-
-  virtual void keyReleased(std::string theName, QKeyEvent* theEvent);
-
-protected:
-  /// \brief Virtual method called when operation is started
-  /// Virtual method called when operation started (see start() method for more description)
-  /// After the parent operation body perform, set sketch feature to the created line feature
-  virtual void startOperation();
-
-  /// Virtual method called when operation aborted (see abort() method for more description)
-  /// Before the feature is aborted, it should be hidden from the viewer
-  virtual void abortOperation();
-
-  /// Virtual method called when operation stopped - committed or aborted.
-  /// Restore the multi selection state
-  virtual void stopOperation();
-
-  /// Virtual method called after operation committed (see commit() method for more description)
-  virtual void afterCommitOperation();
-
-  /// Creates an operation new feature
-  /// In addition to the default realization it appends the created line feature to
-  /// the sketch feature
-  /// \param theFlushMessage the flag whether the create message should be flushed
-  /// \returns the created feature
-  virtual FeaturePtr createFeature(const bool theFlushMessage = true);
-
-protected:
-  ///< Set the point selection mode. Emit signal about focus change if necessary.
-  /// \param theMode a new selection mode
-  /// \param isToEmitSignal the neccessity to emit signal
-  void setPointSelectionMode(const PartSet_SelectionMode& theMode,
-                             const bool isToEmitSignal = true);
-
-  /// Show the value editor
-  /// \param theEvent to get the mouse cursor position
-  /// \param theValue an editor value
-  void showEditor(QMouseEvent* theEvent, double theValue);
-
-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:
-  boost::shared_ptr<PartSet_FeaturePrs> myFeaturePrs; ///< the feature presentation
-  FeaturePtr myInitFeature; ///< the initial feature
-  PartSet_SelectionMode myPointSelectionMode; ///< point selection mode
-  PartSet_EditLine* myEditor; ///< the constraint value editor
-};
-
-#endif
diff --git a/src/PartSet/PartSet_OperationCreateFeature.cpp b/src/PartSet/PartSet_OperationCreateFeature.cpp
deleted file mode 100644 (file)
index 5fa63f4..0000000
+++ /dev/null
@@ -1,293 +0,0 @@
-// File:        PartSet_OperationCreateFeature.h
-// Created:     20 Apr 2014
-// Author:      Natalia ERMOLAEVA
-
-#include <PartSet_OperationCreateFeature.h>
-
-#include <PartSet_Tools.h>
-#include <PartSet_OperationSketch.h>
-#include <PartSet_FeaturePointPrs.h>
-#include <PartSet_FeatureLinePrs.h>
-#include <PartSet_FeatureCirclePrs.h>
-#include <PartSet_FeatureArcPrs.h>
-
-#include <SketchPlugin_Feature.h>
-#include <SketchPlugin_Point.h>
-#include <SketchPlugin_Line.h>
-#include <SketchPlugin_Circle.h>
-#include <SketchPlugin_Arc.h>
-
-#include <ModuleBase_OperationDescription.h>
-
-#include <XGUI_ViewerPrs.h>
-#include <XGUI_Constants.h>
-
-#include <V3d_View.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <TopoDS.hxx>
-#include <BRep_Tool.hxx>
-
-#ifdef _DEBUG
-#include <QDebug>
-#endif
-
-#include <QMouseEvent>
-
-using namespace std;
-
-PartSet_OperationCreateFeature::PartSet_OperationCreateFeature(const QString& theId,
-                                                               QObject* theParent,
-                                                               FeaturePtr theFeature)
-: PartSet_OperationSketchBase(theId, theParent),
-  myPointSelectionMode(SM_FirstPoint)
-{
-  std::string aKind = theId.toStdString();
-  myFeaturePrs = PartSet_Tools::createFeaturePrs(aKind, theFeature);
-}
-
-PartSet_OperationCreateFeature::~PartSet_OperationCreateFeature()
-{
-}
-
-bool PartSet_OperationCreateFeature::canProcessKind(const std::string& theId)
-{
-  return theId == SKETCH_LINE_KIND || theId == SKETCH_POINT_KIND || theId == SKETCH_CIRCLE_KIND ||
-         theId == SKETCH_ARC_KIND;
-}
-
-bool PartSet_OperationCreateFeature::canBeCommitted() const
-{
-  return myPointSelectionMode == SM_DonePoint;
-}
-
-bool PartSet_OperationCreateFeature::isGranted(ModuleBase_IOperation* theOperation) const
-{
-  return theOperation->getDescription()->operationId().toStdString() == PartSet_OperationSketch::Type();
-}
-
-std::list<int> PartSet_OperationCreateFeature::getSelectionModes(FeaturePtr theFeature) const
-{
-  std::list<int> aModes;
-  if (theFeature != feature())
-    aModes = PartSet_OperationSketchBase::getSelectionModes(theFeature);
-  return aModes;
-}
-
-void PartSet_OperationCreateFeature::init(FeaturePtr theFeature,
-                                       const std::list<XGUI_ViewerPrs>& /*theSelected*/,
-                                       const std::list<XGUI_ViewerPrs>& /*theHighlighted*/)
-{
-  if (!theFeature || theFeature->getKind() != SKETCH_LINE_KIND)
-    return;
-  myInitFeature = theFeature;
-}
-
-FeaturePtr PartSet_OperationCreateFeature::sketch() const
-{
-  return myFeaturePrs->sketch();
-}
-
-void PartSet_OperationCreateFeature::mouseReleased(QMouseEvent* theEvent, Handle(V3d_View) theView,
-                                                const std::list<XGUI_ViewerPrs>& theSelected,
-                                                const std::list<XGUI_ViewerPrs>& /*theHighlighted*/)
-{
-  if (myPointSelectionMode == SM_DonePoint)
-  {
-    // if the point creation is finished, the next mouse release should commit the modification
-    // the next release can happens by double click in the viewer
-    commit();
-    restartOperation(feature()->getKind(), feature());
-    return;
-  }
-
-  double aX, anY;
-
-  gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), theView);
-  if (theSelected.empty()) {
-    PartSet_Tools::convertTo2D(aPoint, sketch(), theView, aX, anY);
-  }
-  else {
-    XGUI_ViewerPrs aPrs = theSelected.front();
-    const TopoDS_Shape& aShape = aPrs.shape();
-    if (!aShape.IsNull()) // the point is selected
-    {
-      if (aShape.ShapeType() == TopAbs_VERTEX) {
-        const TopoDS_Vertex& aVertex = TopoDS::Vertex(aShape);
-        if (!aVertex.IsNull()) {
-          aPoint = BRep_Tool::Pnt(aVertex);
-          PartSet_Tools::convertTo2D(aPoint, sketch(), theView, aX, anY);
-
-          //myFeaturePrs->setConstraints(aX, anY, myPointSelectionMode);
-        }
-      }
-      else if (aShape.ShapeType() == TopAbs_EDGE) // the line is selected
-      {
-        PartSet_Tools::convertTo2D(aPoint, sketch(), theView, aX, anY);
-        // move to selected line
-        if (feature()->getKind() == SKETCH_LINE_KIND) {
-          boost::shared_ptr<PartSet_FeatureLinePrs> aLinePrs =
-                                 boost::dynamic_pointer_cast<PartSet_FeatureLinePrs>(myFeaturePrs);
-          if (aLinePrs) {
-            FeaturePtr aFeature = aPrs.feature();
-            aLinePrs->projectPointOnLine(aFeature, myPointSelectionMode, aPoint, theView, aX, anY);
-          }
-        }
-      }
-    }
-  }
-
-  switch (myPointSelectionMode)
-  {
-    case SM_FirstPoint:
-    case SM_SecondPoint:
-    case SM_ThirdPoint: {
-      if (feature()->getKind() == SKETCH_ARC_KIND) {
-        boost::shared_ptr<PartSet_FeatureArcPrs> anArcPrs =
-                                 boost::dynamic_pointer_cast<PartSet_FeatureArcPrs>(myFeaturePrs);
-        if (anArcPrs) {
-          anArcPrs->projectPointOnFeature(feature(), sketch(), aPoint, theView, aX, anY);
-        }
-      }
-      PartSet_SelectionMode aMode = myFeaturePrs->setPoint(aX, anY, myPointSelectionMode);
-      flushUpdated();
-      setPointSelectionMode(aMode);
-    }
-    break;
-    default:
-      break;
-  }
-}
-
-void PartSet_OperationCreateFeature::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) theView)
-{
-  switch (myPointSelectionMode)
-  {
-    case SM_FirstPoint:
-    case SM_SecondPoint:
-    case SM_ThirdPoint:
-    {
-      double aX, anY;
-      gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), theView);
-      PartSet_Tools::convertTo2D(aPoint, sketch(), theView, aX, anY);
-      if (myPointSelectionMode == SM_ThirdPoint) {
-        if (feature()->getKind() == SKETCH_ARC_KIND) {
-          boost::shared_ptr<PartSet_FeatureArcPrs> anArcPrs =
-                                 boost::dynamic_pointer_cast<PartSet_FeatureArcPrs>(myFeaturePrs);
-          if (anArcPrs) {
-            anArcPrs->projectPointOnFeature(feature(), sketch(), aPoint, theView, aX, anY);
-          }
-        }
-      }
-      myFeaturePrs->setPoint(aX, anY, myPointSelectionMode);
-
-      flushUpdated();
-      emit focusActivated(myFeaturePrs->getAttribute(myPointSelectionMode));
-    }
-    break;
-    case SM_DonePoint:
-    {
-      commit();
-      restartOperation(feature()->getKind(), feature());
-    }
-    default:
-      break;
-  }
-}
-
-void PartSet_OperationCreateFeature::keyReleased(std::string theName, QKeyEvent* theEvent)
-{
-  int aKeyType = theEvent->key();
-  // the second point should be activated by any modification in the property panel
-  if (!theName.empty() /*&& aKeyType == Qt::Key_Return*/)
-  {
-    setPointSelectionMode(myFeaturePrs->getNextMode(theName), false);
-  }
-  keyReleased(theEvent->key());
-}
-
-void PartSet_OperationCreateFeature::keyReleased(const int theKey)
-{
-  switch (theKey) {
-    case Qt::Key_Return: {
-      if (myPointSelectionMode == SM_DonePoint)
-      {
-        commit();
-        // it start a new line creation at a free point
-        restartOperation(feature()->getKind(), FeaturePtr()/*feature()*/);
-      }
-      //else
-      //  abort();
-      //restartOperation(feature()->getKind(), FeaturePtr());
-    }
-    break;
-    case Qt::Key_Escape: {
-      if (myPointSelectionMode == SM_DonePoint)
-      {
-        commit();
-      }
-      else
-      {
-        abort();
-      }
-    }
-    default:
-    break;
-  }
-}
-
-void PartSet_OperationCreateFeature::startOperation()
-{
-  PartSet_OperationSketchBase::startOperation();
-  setPointSelectionMode(!myInitFeature ? SM_FirstPoint : SM_SecondPoint);
-
-  emit multiSelectionEnabled(false);
-}
-
-void PartSet_OperationCreateFeature::abortOperation()
-{
-  emit featureConstructed(feature(), FM_Hide);
-  PartSet_OperationSketchBase::abortOperation();
-}
-
-void PartSet_OperationCreateFeature::stopOperation()
-{
-  PartSet_OperationSketchBase::stopOperation();
-  emit multiSelectionEnabled(true);
-}
-
-void PartSet_OperationCreateFeature::afterCommitOperation()
-{
-  PartSet_OperationSketchBase::afterCommitOperation();  
-  emit featureConstructed(feature(), FM_Deactivation);
-}
-
-FeaturePtr PartSet_OperationCreateFeature::createFeature(const bool theFlushMessage)
-{
-  FeaturePtr aNewFeature = ModuleBase_Operation::createFeature(false);
-  if (sketch()) {
-    boost::shared_ptr<SketchPlugin_Feature> aFeature = 
-                           boost::dynamic_pointer_cast<SketchPlugin_Feature>(sketch());
-
-    aFeature->addSub(aNewFeature);
-  }
-  myFeaturePrs->init(aNewFeature);
-  myFeaturePrs->setFeature(myInitFeature, SM_FirstPoint);
-
-  emit featureConstructed(aNewFeature, FM_Activation);
-  if (theFlushMessage)
-    flushCreated();
-  return aNewFeature;
-}
-
-void PartSet_OperationCreateFeature::setPointSelectionMode(const PartSet_SelectionMode& theMode,
-                                                           const bool isToEmitSignal)
-{
-  myPointSelectionMode = theMode;
-  if (isToEmitSignal) {
-    std::string aName = myFeaturePrs->getAttribute(theMode);
-    if (aName.empty() && theMode == SM_DonePoint) {
-      aName = XGUI::PROP_PANEL_OK;
-    }
-    emit focusActivated(aName);
-  }
-}
diff --git a/src/PartSet/PartSet_OperationCreateFeature.h b/src/PartSet/PartSet_OperationCreateFeature.h
deleted file mode 100644 (file)
index e35f5f8..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-// File:        PartSet_OperationCreateFeature.h
-// Created:     20 Apr 2014
-// Author:      Natalia ERMOLAEVA
-
-#ifndef PartSet_OperationCreateFeature_H
-#define PartSet_OperationCreateFeature_H
-
-#include "PartSet.h"
-
-#include <PartSet_OperationSketchBase.h>
-#include <PartSet_Constants.h>
-
-#include <QObject>
-
-class PartSet_FeaturePrs;
-class GeomDataAPI_Point2D;
-class QMouseEvent;
-class QKeyEvent;
-
-/*!
- \class PartSet_OperationCreateFeature
- * \brief The operation for the sketch feature creation
-*/
-class PARTSET_EXPORT PartSet_OperationCreateFeature : public PartSet_OperationSketchBase
-{
-  Q_OBJECT
-
-public:
-  /// Returns true if the feature with the given kind can be created by this operation
-  /// \param theId the feature kind
-  /// \return the boolean result
-  static bool canProcessKind(const std::string& theId);
-
-public:
-  /// Constructor
-  /// \param theId the feature identifier
-  /// \param theParent the operation parent
-  /// \param theSketch the parent feature
-  PartSet_OperationCreateFeature(const QString& theId, QObject* theParent,
-                                 FeaturePtr theSketch);
-  /// Destructor
-  virtual ~PartSet_OperationCreateFeature();
-
-  /// Verifies whether this operator can be commited.
-  /// \return Returns TRUE if current operation can be committed, e.g. all parameters are filled
-  virtual bool canBeCommitted() const;
-
-  /// 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 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;
-
-  /// Gives the current selected objects to be processed by the operation
-  /// \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 mouseReleased(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 thePoint a point clicked in the viewer
-  /// \param theEvent the mouse event
-  virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView);
-  /// Processes the key pressed in the view
-  /// \param theKey a key value
-  virtual void keyReleased(const int theKey);
-
-  virtual void keyReleased(std::string theName, QKeyEvent* theEvent);
-
-protected:
-  /// \brief Virtual method called when operation is started
-  /// Virtual method called when operation started (see start() method for more description)
-  /// After the parent operation body perform, set sketch feature to the created line feature
-  virtual void startOperation();
-
-  /// Virtual method called when operation aborted (see abort() method for more description)
-  /// Before the feature is aborted, it should be hidden from the viewer
-  virtual void abortOperation();
-
-  /// Virtual method called when operation stopped - committed or aborted.
-  /// Restore the multi selection state
-  virtual void stopOperation();
-
-  /// Virtual method called after operation committed (see commit() method for more description)
-  virtual void afterCommitOperation();
-
-  /// Creates an operation new feature
-  /// In addition to the default realization it appends the created line feature to
-  /// the sketch feature
-  /// \param theFlushMessage the flag whether the create message should be flushed
-  /// \returns the created feature
-  virtual FeaturePtr createFeature(const bool theFlushMessage = true);
-
-protected:
-  ///< Set the point selection mode. Emit signal about focus change if necessary.
-  /// \param theMode a new selection mode
-  /// \param isToEmitSignal the neccessity to emit signal
-  void setPointSelectionMode(const PartSet_SelectionMode& theMode,
-                             const bool isToEmitSignal = true);
-
-private:
-  boost::shared_ptr<PartSet_FeaturePrs> myFeaturePrs; ///< the feature presentation
-  FeaturePtr myInitFeature; ///< the initial feature
-  PartSet_SelectionMode myPointSelectionMode; ///< point selection mode
-};
-
-#endif