]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Merge branch 'master' of newgeom:newgeom
authorvsv <vitaly.smetannikov@opencascade.com>
Thu, 26 Jun 2014 06:45:10 +0000 (10:45 +0400)
committervsv <vitaly.smetannikov@opencascade.com>
Thu, 26 Jun 2014 06:45:10 +0000 (10:45 +0400)
44 files changed:
src/ModuleBase/ModuleBase_ModelWidget.cpp
src/ModuleBase/ModuleBase_ModelWidget.h
src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp
src/ModuleBase/ModuleBase_WidgetEditor.cpp
src/ModuleBase/ModuleBase_WidgetEditor.h
src/ModuleBase/ModuleBase_WidgetPoint2D.cpp
src/PartSet/CMakeLists.txt
src/PartSet/PartSet_Constants.h
src/PartSet/PartSet_ConstraintDistancePrs.cpp [deleted file]
src/PartSet/PartSet_ConstraintDistancePrs.h [deleted file]
src/PartSet/PartSet_ConstraintLengthPrs.cpp [deleted file]
src/PartSet/PartSet_ConstraintLengthPrs.h [deleted file]
src/PartSet/PartSet_ConstraintRadiusPrs.cpp [deleted file]
src/PartSet/PartSet_ConstraintRadiusPrs.h [deleted file]
src/PartSet/PartSet_FeatureArcPrs.cpp [deleted file]
src/PartSet/PartSet_FeatureArcPrs.h [deleted file]
src/PartSet/PartSet_FeatureCirclePrs.cpp [deleted file]
src/PartSet/PartSet_FeatureCirclePrs.h [deleted file]
src/PartSet/PartSet_FeatureLinePrs.cpp [deleted file]
src/PartSet/PartSet_FeatureLinePrs.h [deleted file]
src/PartSet/PartSet_FeaturePointPrs.cpp [deleted file]
src/PartSet/PartSet_FeaturePointPrs.h [deleted file]
src/PartSet/PartSet_FeaturePrs.cpp [deleted file]
src/PartSet/PartSet_FeaturePrs.h [deleted file]
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_OperationFeatureCreate.cpp
src/PartSet/PartSet_OperationFeatureCreate.h
src/PartSet/PartSet_OperationFeatureEdit.cpp
src/PartSet/PartSet_OperationSketch.cpp
src/PartSet/PartSet_OperationSketch.h
src/PartSet/PartSet_OperationSketchBase.h
src/PartSet/PartSet_TestOCC.cpp
src/PartSet/PartSet_Tools.cpp
src/PartSet/PartSet_Tools.h
src/SketchPlugin/SketchPlugin_Circle.cpp
src/SketchPlugin/SketchPlugin_ConstraintParallel.cpp
src/SketchPlugin/SketchPlugin_ConstraintParallel.h
src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.cpp
src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.h
src/SketchPlugin/SketchPlugin_ConstraintRadius.cpp
src/SketchPlugin/plugin-Sketch.xml
src/SketchSolver/SketchSolver_ConstraintGroup.cpp
src/XGUI/XGUI_PropertyPanel.cpp
src/XGUI/XGUI_PropertyPanel.h

index cd56f06c363d259b3dbbfad4bdaafe1cd2b56da9..720f089331c08703fe22d3a56f2532e62d63c6d8 100644 (file)
@@ -22,12 +22,7 @@ bool ModuleBase_ModelWidget::isInitialized(FeaturePtr theFeature) const
   return theFeature->data()->attribute(attributeID())->isInitialized();
 }
 
-bool ModuleBase_ModelWidget::canFocusTo(const std::string& theAttributeName) const
-{
-  return theAttributeName == attributeID();
-}
-
-void ModuleBase_ModelWidget::focusTo()
+bool ModuleBase_ModelWidget::focusTo()
 {
   QList<QWidget*> aControls = getControls();
   QList<QWidget*>::const_iterator anIt = aControls.begin(), aLast = aControls.end();
@@ -38,6 +33,7 @@ void ModuleBase_ModelWidget::focusTo()
       break;
     }
   }
+  return true;
 }
 
 std::string ModuleBase_ModelWidget::attributeID() const
index 78680ec3b6347d26ad6ca18d055d0111b25a9f3b..5c8e9da51a8381f0cbac9b22b65841d248d47d9c 100644 (file)
@@ -47,13 +47,10 @@ public:
 
   virtual bool restoreValue(FeaturePtr theFeature) = 0;
 
-  /// Returns whether the widget can accept focus, or if it corresponds to the given attribute
-  /// \param theAttribute name
-  bool canFocusTo(const std::string& theAttributeName) const;
-
   /// Set focus to the first control of the current widget. The focus policy of the control is checked.
   /// If the widget has the NonFocus focus policy, it is skipped.
-  virtual void focusTo();
+  /// \return the state whether the widget can accept the focus
+  virtual bool focusTo();
 
   /// Returns list of widget controls
   /// \return a control list
index 36ebe04f19e922ea3335fc2633f351b97f9b6586..ccbb0ad7ebd14a781d8cbee54999d8c636038f65 100644 (file)
@@ -35,7 +35,8 @@ ModuleBase_WidgetDoubleValue::ModuleBase_WidgetDoubleValue(QWidget* theParent, c
   QString aLabelText = QString::fromStdString(theData->widgetLabel());
   QString aLabelIcon = QString::fromStdString(theData->widgetIcon());
   myLabel = new QLabel(aLabelText, myContainer);
-  myLabel->setPixmap(QPixmap(aLabelIcon));
+  if (!aLabelIcon.isEmpty())
+    myLabel->setPixmap(QPixmap(aLabelIcon));
   aControlLay->addWidget(myLabel);
 
   mySpinBox = new QDoubleSpinBox(myContainer);
@@ -122,6 +123,10 @@ bool ModuleBase_WidgetDoubleValue::eventFilter(QObject *theObject, QEvent *theEv
 {
   if (theObject == mySpinBox) {
     if (theEvent->type() == QEvent::KeyRelease) {
+      QKeyEvent* aKeyEvent = (QKeyEvent*)theEvent;
+      if (aKeyEvent && aKeyEvent->key() == Qt::Key_Return) {
+        emit focusOutWidget(this);
+      }
       emit keyReleased(attributeID(), (QKeyEvent*) theEvent);
       return true;
     }
index 694e5a809deb39a7074c0f82b885a31578af6297..dbbe9fd5dbd09d4d8e575a3b8ce5aea6132db054 100644 (file)
@@ -61,7 +61,7 @@ double editedValue(double theValue, bool& isDone)
   return aValue;
 }
 
-void ModuleBase_WidgetEditor::focusTo()
+bool ModuleBase_WidgetEditor::focusTo()
 {
   double aValue = mySpinBox->value();
   bool isDone;
@@ -74,6 +74,8 @@ void ModuleBase_WidgetEditor::focusTo()
   }
   emit valuesChanged();
   emit focusOutWidget(this);
+
+  return false;
 }
 
 void ModuleBase_WidgetEditor::editFeatureValue(FeaturePtr theFeature, const std::string theAttribute)
index e75d4cebda4b7c171b743359b64f6ba3b27d83c4..4585bdbbc110d2cb72aa4ee69083d1bd92d975f1 100644 (file)
@@ -38,7 +38,8 @@ public:
 
   /// Set focus to the first control of the current widget. The focus policy of the control is checked.
   /// If the widget has the NonFocus focus policy, it is skipped.
-  virtual void focusTo();
+  /// \return the state whether the widget can accept the focus
+  virtual bool focusTo();
 
   /// Creates an editor for the real value and set the new value to the feature
   /// \param theFeature the model feature
index e53cc16eaaea6c19603350a488bf68ed14fa6436..a1f5178da28411aa19f85900f8d2443ff893d665 100644 (file)
@@ -129,6 +129,10 @@ bool ModuleBase_WidgetPoint2D::eventFilter(QObject *theObject, QEvent *theEvent)
 {
   if (theObject == myXSpin || theObject == myYSpin) {
     if (theEvent->type() == QEvent::KeyRelease) {
+      QKeyEvent* aKeyEvent = (QKeyEvent*)theEvent;
+      if (aKeyEvent && aKeyEvent->key() == Qt::Key_Return) {
+        emit focusOutWidget(this);
+      }
       emit keyReleased(attributeID(), (QKeyEvent*) theEvent);
       return true;
     }
index 794def4031699f30dbb6472fe2a2acd48d809776..a111f81615c78088ba59030839c09e24d9462ae7 100644 (file)
@@ -5,15 +5,7 @@ SET(CMAKE_AUTOMOC ON)
 SET(PROJECT_HEADERS
        PartSet.h
        PartSet_Constants.h
-       PartSet_ConstraintDistancePrs.h
-       PartSet_ConstraintLengthPrs.h
-       PartSet_ConstraintRadiusPrs.h
        PartSet_EditLine.h
-       PartSet_FeatureArcPrs.h
-       PartSet_FeatureCirclePrs.h
-       PartSet_FeaturePrs.h
-       PartSet_FeatureLinePrs.h
-       PartSet_FeaturePointPrs.h
        PartSet_Listener.h
        PartSet_Module.h
        PartSet_OperationFeatureCreate.h
@@ -26,15 +18,7 @@ SET(PROJECT_HEADERS
 )
 
 SET(PROJECT_SOURCES
-       PartSet_ConstraintDistancePrs.cpp
-       PartSet_ConstraintLengthPrs.cpp
-       PartSet_ConstraintRadiusPrs.cpp
        PartSet_EditLine.cpp
-       PartSet_FeaturePrs.cpp
-       PartSet_FeatureArcPrs.cpp
-       PartSet_FeatureCirclePrs.cpp
-       PartSet_FeatureLinePrs.cpp
-       PartSet_FeaturePointPrs.cpp
        PartSet_Listener.cpp
        PartSet_Module.cpp
        PartSet_OperationFeatureCreate.cpp
index f55b58048ac9a6cf20b3f6a946ded91eebd2e631..17c0f5e5f63aaa88f320cb931b7ae998fde1dc6c 100644 (file)
@@ -9,16 +9,6 @@
 
 /// This file contains various constants used in the PartSet module
 
-/// Types of viewer selection in an operation
-enum PartSet_SelectionMode
-{
-  SM_FirstPoint,
-  SM_SecondPoint,
-  SM_ThirdPoint,
-  SM_LastPoint,
-  SM_DonePoint
-};
-
 ////const int CONSTRAINT_TEXT_HEIGHT = 28; /// the text height of the constraint
 ////const int CONSTRAINT_TEXT_SELECTION_TOLERANCE = 20; /// the text selection tolerance
 
diff --git a/src/PartSet/PartSet_ConstraintDistancePrs.cpp b/src/PartSet/PartSet_ConstraintDistancePrs.cpp
deleted file mode 100644 (file)
index 8dc195a..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-// File:        PartSet_FeaturePrs.h
-// Created:     16 Jun 2014
-// Author:      Natalia ERMOLAEVA
-
-#include <PartSet_ConstraintDistancePrs.h>
-#include <PartSet_Tools.h>
-
-#include <PartSet_FeatureLinePrs.h>
-
-#include <SketchPlugin_Feature.h>
-#include <SketchPlugin_Sketch.h>
-#include <SketchPlugin_Line.h>
-#include <SketchPlugin_Point.h>
-#include <SketchPlugin_ConstraintDistance.h>
-
-#include <GeomDataAPI_Point2D.h>
-#include <GeomAPI_Pnt2d.h>
-#include <GeomAPI_Lin2d.h>
-#include <GeomAPI_Pln.h>
-
-#include <ModelAPI_Data.h>
-#include <ModelAPI_Document.h>
-#include <ModelAPI_AttributeRefAttr.h>
-#include <ModelAPI_AttributeRefList.h>
-#include <ModelAPI_AttributeDouble.h>
-
-#include <AIS_InteractiveObject.hxx>
-#include <AIS_LengthDimension.hxx>
-
-#include <Precision.hxx>
-#include <gp_Pln.hxx>
-
-using namespace std;
-
-PartSet_ConstraintDistancePrs::PartSet_ConstraintDistancePrs(FeaturePtr theSketch)
-: PartSet_FeaturePrs(theSketch)
-{
-}
-
-std::string PartSet_ConstraintDistancePrs::getKind()
-{
-  return SKETCH_CONSTRAINT_DISTANCE_KIND;
-}
-
-PartSet_SelectionMode PartSet_ConstraintDistancePrs::setFeature(FeaturePtr theFeature, const PartSet_SelectionMode& theMode)
-{
-  PartSet_SelectionMode aMode = theMode;
-  if (!feature() || !theFeature)
-    return aMode;
-
-  std::string anArgument;
-  if (theMode == SM_FirstPoint) {
-    anArgument = CONSTRAINT_ATTR_ENTITY_A;
-    aMode = SM_SecondPoint;
-  }
-  else if (theMode == SM_SecondPoint) {
-    anArgument = CONSTRAINT_ATTR_ENTITY_B;
-    aMode = SM_LastPoint;
-  }
-  if (theFeature->getKind() == SKETCH_POINT_KIND)
-  {
-    // set length feature
-    boost::shared_ptr<ModelAPI_Data> aData = feature()->data();
-    boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef =
-          boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(aData->attribute(anArgument));
-    aRef->setFeature(theFeature);
-  }
-
-  if (theMode == SM_SecondPoint) {
-    // set length value
-    boost::shared_ptr<GeomDataAPI_Point2D> aPoint_A = getFeaturePoint(feature(), CONSTRAINT_ATTR_ENTITY_A);
-    boost::shared_ptr<GeomDataAPI_Point2D> aPoint_B = getFeaturePoint(feature(), CONSTRAINT_ATTR_ENTITY_B);
-
-    if (aPoint_A && aPoint_B) {
-      double aLenght = aPoint_A->pnt()->distance(aPoint_B->pnt());
-      PartSet_Tools::setFeatureValue(feature(), aLenght, CONSTRAINT_ATTR_VALUE);
-    }
-  }
-
-  return aMode;
-}
-
-PartSet_SelectionMode PartSet_ConstraintDistancePrs::setPoint(double theX, double theY,
-                                                         const PartSet_SelectionMode& theMode)
-{
-  PartSet_SelectionMode aMode = theMode;
-  switch (theMode)
-  {
-    case SM_LastPoint: {
-      boost::shared_ptr<GeomDataAPI_Point2D> aFlyOutAttr = 
-        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(feature()->data()->attribute(CONSTRAINT_ATTR_FLYOUT_VALUE_PNT));
-      aFlyOutAttr->setValue(boost::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(theX, theY)));
-
-      boost::shared_ptr<GeomAPI_Pnt2d> aFlyOutPnt = aFlyOutAttr->pnt();
-
-      aMode = SM_DonePoint;
-    }
-    break;
-    default:
-      break;
-  }
-  return aMode;
-}
-
-boost::shared_ptr<GeomDataAPI_Point2D> PartSet_ConstraintDistancePrs::getFeaturePoint
-                                                               (FeaturePtr theFeature,
-                                                                const std::string& theAttribute)
-{
-  boost::shared_ptr<GeomDataAPI_Point2D> aPointAttr;
-
-  FeaturePtr aFeature = PartSet_Tools::feature(theFeature, theAttribute, SKETCH_POINT_KIND);
-  if (aFeature)
-    aPointAttr = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>
-                                           (aFeature->data()->attribute(POINT_ATTR_COORD));
-  return aPointAttr;
-}
-
-std::string PartSet_ConstraintDistancePrs::getAttribute(const PartSet_SelectionMode& theMode) const
-{
-  return "";
-}
-
-PartSet_SelectionMode PartSet_ConstraintDistancePrs::getNextMode(const std::string& theAttribute) const
-{
-  return SM_FirstPoint;
-}
-
-boost::shared_ptr<GeomDataAPI_Point2D> PartSet_ConstraintDistancePrs::featurePoint
-                                                     (const PartSet_SelectionMode& theMode)
-{
-  return boost::shared_ptr<GeomDataAPI_Point2D>();
-}
diff --git a/src/PartSet/PartSet_ConstraintDistancePrs.h b/src/PartSet/PartSet_ConstraintDistancePrs.h
deleted file mode 100644 (file)
index 8d71154..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-// File:        PartSet_ConstraintDistancePrs.h
-// Created:     16 Jun 2014
-// Author:      Natalia ERMOLAEVA
-
-#ifndef PartSet_ConstraintDistancePrs_H
-#define PartSet_ConstraintDistancePrs_H
-
-#include "PartSet.h"
-
-#include "PartSet_FeaturePrs.h"
-#include "PartSet_Constants.h"
-
-class GeomDataAPI_Point2D;
-class Handle_AIS_InteractiveObject;
-
-/*!
- \class PartSet_ConstraintDistancePrs
- * \brief The class to define the circle feature manipulation. It is created for
- * the feature create operation to move out the feature properties set and use one operation
- * for any type of features.
-*/
-class PARTSET_EXPORT PartSet_ConstraintDistancePrs : public PartSet_FeaturePrs
-{
-public:
-  /// Returns the feature type processed by this presentation
-  /// \return the feature kind
-  static std::string getKind();
-
-  /// Constructor
-  /// \param theSketch the sketch feature
-  PartSet_ConstraintDistancePrs(FeaturePtr theSketch);
-  /// Destructor
-  virtual ~PartSet_ConstraintDistancePrs() {};
-
-  /// Sets the feature to to a feature attribute depending on the selection mode
-  /// \param theFeature a feature instance
-  /// \param theMode the selection mode
-  /// \return whether the feature is set
-  virtual PartSet_SelectionMode setFeature(FeaturePtr theFeature, const PartSet_SelectionMode& theMode);
-
-  /// Sets the point to the feature in an attribute depending on the selection mode
-  /// \param theX the 2D point horizontal coordinate
-  /// \param theY the 2D point vertical coordinate
-  /// \param theMode the selection mode
-  /// \return the new selection mode
-  virtual PartSet_SelectionMode setPoint(double theX, double theY,
-                                         const PartSet_SelectionMode& theMode);
-
-  /// Returns the feature attribute name for the selection mode
-  /// \param theMode the current operation selection mode. The feature attribute depends on the mode
-  virtual std::string getAttribute(const PartSet_SelectionMode& theMode) const;
-
-  /// Returns the next selection mode after the attribute
-  /// \param theAttribute the feature attribute name
-  /// \return next attribute selection mode
-  virtual PartSet_SelectionMode getNextMode(const std::string& theAttribute) const;
-
-protected:
-  /// Returns the feature point in the selection mode position.
-  /// \param theMode the current operation selection mode. The feature attribute depends on the mode
-  virtual boost::shared_ptr<GeomDataAPI_Point2D> featurePoint(const PartSet_SelectionMode& theMode);
-
-private:
-  /// Find the feature point
-  /// \param theFeature the constraint feature
-  /// \param theAttribute a distance constraint attribute name of feature
-  /// \return the point in the feature
-  static boost::shared_ptr<GeomDataAPI_Point2D> getFeaturePoint(FeaturePtr theFeature,
-                                                                const std::string& theAttribute);
-};
-
-#endif
diff --git a/src/PartSet/PartSet_ConstraintLengthPrs.cpp b/src/PartSet/PartSet_ConstraintLengthPrs.cpp
deleted file mode 100644 (file)
index 9e41402..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-// File:        PartSet_FeaturePrs.h
-// Created:     16 Jun 2014
-// Author:      Natalia ERMOLAEVA
-
-#include <PartSet_ConstraintLengthPrs.h>
-#include <PartSet_Tools.h>
-#include <PartSet_Constants.h>
-
-#include <PartSet_FeatureLinePrs.h>
-
-#include <SketchPlugin_Feature.h>
-#include <SketchPlugin_Sketch.h>
-#include <SketchPlugin_Line.h>
-#include <SketchPlugin_ConstraintLength.h>
-
-#include <GeomDataAPI_Point.h>
-#include <GeomDataAPI_Point2D.h>
-#include <GeomDataAPI_Dir.h>
-#include <GeomAPI_Pnt2d.h>
-#include <GeomAPI_Lin2d.h>
-#include <GeomAPI_Pln.h>
-
-#include <AIS_InteractiveObject.hxx>
-#include <AIS_LengthDimension.hxx>
-
-#include <ModelAPI_Data.h>
-#include <ModelAPI_Document.h>
-#include <ModelAPI_AttributeRefAttr.h>
-#include <ModelAPI_AttributeRefList.h>
-#include <ModelAPI_AttributeDouble.h>
-
-#include <AIS_InteractiveObject.hxx>
-#include <gp_Pln.hxx>
-#include <gp_Pnt.hxx>
-#include <Precision.hxx>
-
-using namespace std;
-
-PartSet_ConstraintLengthPrs::PartSet_ConstraintLengthPrs(FeaturePtr theSketch)
-: PartSet_FeaturePrs(theSketch)
-{
-}
-
-std::string PartSet_ConstraintLengthPrs::getKind()
-{
-  return SKETCH_CONSTRAINT_LENGTH_KIND;
-}
-
-PartSet_SelectionMode PartSet_ConstraintLengthPrs::setFeature(FeaturePtr theFeature, const PartSet_SelectionMode& theMode)
-{
-  PartSet_SelectionMode aMode = theMode;
-  if (feature() && theFeature && theFeature->getKind() == SKETCH_LINE_KIND && theMode == SM_FirstPoint)
-  {
-    // set length feature
-    boost::shared_ptr<ModelAPI_Data> aData = feature()->data();
-    boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef =
-          boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(aData->attribute(CONSTRAINT_ATTR_ENTITY_A));
-    aRef->setFeature(theFeature);
-
-    // set length value
-    aData = theFeature->data();
-    boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 =
-          boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(LINE_ATTR_START));
-    boost::shared_ptr<GeomDataAPI_Point2D> aPoint2 =
-          boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(LINE_ATTR_END));
-
-    double aLenght = aPoint1->pnt()->distance(aPoint2->pnt());
-    PartSet_Tools::setFeatureValue(feature(), aLenght, CONSTRAINT_ATTR_VALUE);
-    aMode = SM_LastPoint;
-  }
-  return aMode;
-}
-
-PartSet_SelectionMode PartSet_ConstraintLengthPrs::setPoint(double theX, double theY,
-                                                         const PartSet_SelectionMode& theMode)
-{
-  PartSet_SelectionMode aMode = theMode;
-  switch (theMode)
-  {
-    case SM_LastPoint: {
-      boost::shared_ptr<ModelAPI_Data> aData = feature()->data();
-      boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttr = 
-              boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(aData->attribute(CONSTRAINT_ATTR_ENTITY_A));
-      FeaturePtr aFeature;
-      if (anAttr) {
-        aFeature = anAttr->feature();
-        if (aFeature->getKind() != SKETCH_LINE_KIND) {
-          aFeature = FeaturePtr();
-        }
-      }
-      boost::shared_ptr<GeomAPI_Pnt2d> aPoint = boost::shared_ptr<GeomAPI_Pnt2d>
-                                                             (new GeomAPI_Pnt2d(theX, theY));
-      boost::shared_ptr<GeomAPI_Lin2d> aFeatureLin = PartSet_FeatureLinePrs::createLin2d(aFeature);
-      boost::shared_ptr<GeomAPI_Pnt2d> aResult = aFeatureLin->project(aPoint);
-      double aDistance = aPoint->distance(aResult);
-
-      if (!aFeatureLin->isRight(aPoint))
-        aDistance = -aDistance;
-
-      //AttributeDoublePtr aFlyoutAttr = 
-      //    boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(aData->attribute(CONSTRAINT_ATTR_FLYOUT_VALUE));
-      //aFlyoutAttr->setValue(aDistance);
-
-      aMode = SM_DonePoint;
-    }
-    break;
-    default:
-      break;
-  }
-  return aMode;
-}
-
-std::string PartSet_ConstraintLengthPrs::getAttribute(const PartSet_SelectionMode& theMode) const
-{
-  return "";
-}
-
-PartSet_SelectionMode PartSet_ConstraintLengthPrs::getNextMode(const std::string& theAttribute) const
-{
-  return SM_FirstPoint;
-}
-
-boost::shared_ptr<GeomDataAPI_Point2D> PartSet_ConstraintLengthPrs::featurePoint
-                                                     (const PartSet_SelectionMode& theMode)
-{
-  return boost::shared_ptr<GeomDataAPI_Point2D>();
-}
diff --git a/src/PartSet/PartSet_ConstraintLengthPrs.h b/src/PartSet/PartSet_ConstraintLengthPrs.h
deleted file mode 100644 (file)
index e00b549..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-// File:        PartSet_ConstraintLengthPrs.h
-// Created:     16 Jun 2014
-// Author:      Natalia ERMOLAEVA
-
-#ifndef PartSet_ConstraintLengthPrs_H
-#define PartSet_ConstraintLengthPrs_H
-
-#include "PartSet.h"
-
-#include "PartSet_FeaturePrs.h"
-#include "PartSet_Constants.h"
-
-class GeomDataAPI_Point2D;
-class Handle_AIS_InteractiveObject;
-
-/*!
- \class PartSet_ConstraintLengthPrs
- * \brief The class to define the circle feature manipulation. It is created for
- * the feature create operation to move out the feature properties set and use one operation
- * for any type of features.
-*/
-class PARTSET_EXPORT PartSet_ConstraintLengthPrs : public PartSet_FeaturePrs
-{
-public:
-  /// Returns the feature type processed by this presentation
-  /// \return the feature kind
-  static std::string getKind();
-
-  /// Constructor
-  /// \param theSketch the sketch feature
-  PartSet_ConstraintLengthPrs(FeaturePtr theSketch);
-  /// Destructor
-  virtual ~PartSet_ConstraintLengthPrs() {};
-
-  /// Sets the feature to to a feature attribute depending on the selection mode
-  /// \param theFeature a feature instance
-  /// \param theMode the selection mode
-  /// \return whether the feature is set
-  virtual PartSet_SelectionMode setFeature(FeaturePtr theFeature, const PartSet_SelectionMode& theMode);
-
-  /// Sets the point to the feature in an attribute depending on the selection mode
-  /// \param theX the 2D point horizontal coordinate
-  /// \param theY the 2D point vertical coordinate
-  /// \param theMode the selection mode
-  /// \return the new selection mode
-  virtual PartSet_SelectionMode setPoint(double theX, double theY,
-                                         const PartSet_SelectionMode& theMode);
-
-  /// Returns the feature attribute name for the selection mode
-  /// \param theMode the current operation selection mode. The feature attribute depends on the mode
-  virtual std::string getAttribute(const PartSet_SelectionMode& theMode) const;
-
-  /// Returns the next selection mode after the attribute
-  /// \param theAttribute the feature attribute name
-  /// \return next attribute selection mode
-  virtual PartSet_SelectionMode getNextMode(const std::string& theAttribute) const;
-
-protected:
-  /// Returns the feature point in the selection mode position.
-  /// \param theMode the current operation selection mode. The feature attribute depends on the mode
-  virtual boost::shared_ptr<GeomDataAPI_Point2D> featurePoint(const PartSet_SelectionMode& theMode);
-};
-
-#endif
diff --git a/src/PartSet/PartSet_ConstraintRadiusPrs.cpp b/src/PartSet/PartSet_ConstraintRadiusPrs.cpp
deleted file mode 100644 (file)
index 92caca8..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-// File:        PartSet_FeaturePrs.h
-// Created:     16 Jun 2014
-// Author:      Natalia ERMOLAEVA
-
-#include <PartSet_ConstraintRadiusPrs.h>
-#include <PartSet_Tools.h>
-
-#include <PartSet_FeatureCirclePrs.h>
-#include <PartSet_FeatureArcPrs.h>
-
-#include <SketchPlugin_Feature.h>
-#include <SketchPlugin_Sketch.h>
-#include <SketchPlugin_Line.h>
-#include <SketchPlugin_Circle.h>
-#include <SketchPlugin_Arc.h>
-#include <SketchPlugin_ConstraintRadius.h>
-
-#include <GeomDataAPI_Point.h>
-#include <GeomDataAPI_Point2D.h>
-#include <GeomDataAPI_Dir.h>
-#include <GeomAPI_Pnt2d.h>
-#include <GeomAPI_Lin2d.h>
-#include <GeomAPI_Pln.h>
-#include <GeomAPI_Dir.h>
-
-#include <GeomAlgoAPI_EdgeBuilder.h>
-
-#include <ModelAPI_Data.h>
-#include <ModelAPI_Document.h>
-#include <ModelAPI_AttributeRefAttr.h>
-#include <ModelAPI_AttributeRefList.h>
-#include <ModelAPI_AttributeDouble.h>
-
-#include <AIS_InteractiveObject.hxx>
-#include <AIS_RadiusDimension.hxx>
-#include <Precision.hxx>
-#include <gp_Circ.hxx>
-#include <V3d_View.hxx>
-
-using namespace std;
-
-PartSet_ConstraintRadiusPrs::PartSet_ConstraintRadiusPrs(FeaturePtr theSketch)
-: PartSet_FeaturePrs(theSketch)
-{
-}
-
-std::string PartSet_ConstraintRadiusPrs::getKind()
-{
-  return SKETCH_CONSTRAINT_RADIUS_KIND;
-}
-
-PartSet_SelectionMode PartSet_ConstraintRadiusPrs::setFeature(FeaturePtr theFeature, const PartSet_SelectionMode& theMode)
-{
-  PartSet_SelectionMode aMode = theMode;
-  if (!feature() || theMode != SM_FirstPoint || !theFeature) {
-    return aMode;
-  }
-  std::string aKind = theFeature->getKind();
-  if (aKind == SKETCH_CIRCLE_KIND || aKind == SKETCH_ARC_KIND) {
-    // set length feature
-    boost::shared_ptr<ModelAPI_Data> aData = feature()->data();
-    boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef =
-          boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(aData->attribute(CONSTRAINT_ATTR_ENTITY_A));
-    aRef->setFeature(theFeature);
-
-    double aLength = 50;
-    bool isValid;
-    if (aKind == SKETCH_CIRCLE_KIND) {
-      aLength = PartSet_Tools::featureValue(theFeature, CIRCLE_ATTR_RADIUS, isValid);
-    }
-    else if (aKind == SKETCH_ARC_KIND) {
-      aLength = PartSet_FeatureArcPrs::radius(theFeature);
-    }
-
-    PartSet_Tools::setFeatureValue(feature(), aLength, CONSTRAINT_ATTR_VALUE);
-    aMode = SM_LastPoint;
-  }
-  return aMode;
-}
-
-PartSet_SelectionMode PartSet_ConstraintRadiusPrs::setPoint(double theX, double theY,
-                                                         const PartSet_SelectionMode& theMode)
-{
-  PartSet_SelectionMode aMode = theMode;
-  switch (theMode)
-  {
-    case SM_LastPoint: {
-      boost::shared_ptr<ModelAPI_Data> aData = feature()->data();
-
-      boost::shared_ptr<GeomAPI_Pnt2d> aPoint = boost::shared_ptr<GeomAPI_Pnt2d>
-                                                             (new GeomAPI_Pnt2d(theX, theY));
-
-      //PartSet_Tools::setFeaturePoint(feature(), theX, theY, SKETCH_CONSTRAINT_ATTR_CIRCLE_POINT);
-
-      //double aDistance = 40;
-      //AttributeDoublePtr aFlyoutAttr = 
-      //    boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(aData->attribute(CONSTRAINT_ATTR_FLYOUT_VALUE));
-      //aFlyoutAttr->setValue(aDistance);
-
-      aMode = SM_LastPoint;
-    }
-    break;
-    default:
-      break;
-  }
-  return aMode;
-}
-
-void PartSet_ConstraintRadiusPrs::projectPointOnFeature(FeaturePtr theFeature, FeaturePtr theSketch,
-                                                        gp_Pnt& thePoint, Handle(V3d_View) theView,
-                                                        double& theX, double& theY)
-{
-  boost::shared_ptr<ModelAPI_Data> aData = theFeature->data();
-  boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttr = 
-          boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(aData->attribute(CONSTRAINT_ATTR_ENTITY_A));
-  if (!anAttr)
-    return;
-  FeaturePtr aFeature = anAttr->feature();
-  if (!aFeature)
-    return;
-
-  gp_Circ aCircle;
-  gp_Pnt anAnchorPoint;
-  if (aFeature->getKind() == SKETCH_CIRCLE_KIND) {
-    PartSet_FeatureCirclePrs::projectPointOnFeature(aFeature, theSketch, thePoint, theView, theX, theY);
-  }
-  else if (aFeature->getKind() == SKETCH_ARC_KIND) {
-    PartSet_FeatureArcPrs::projectPointOnFeature(aFeature, theSketch, thePoint, theView, theX, theY);
-  }
-  // TODO: a bug in AIS_RadiusDimension:
-  // The anchor point can't be myCirc.Location() - an exception is raised.
-  // But we need exactly this case...
-  // We want to show a radius dimension starting from the circle centre and 
-  // ending at the user-defined point.
-  // Also, if anchor point coincides with myP2, the radius dimension is not displayed at all.
-  double aDelta = 1/1000.0;
-  theX += aDelta;
-  theY += aDelta;
-}
-
-std::string PartSet_ConstraintRadiusPrs::getAttribute(const PartSet_SelectionMode& theMode) const
-{
-  return "";
-}
-
-PartSet_SelectionMode PartSet_ConstraintRadiusPrs::getNextMode(const std::string& theAttribute) const
-{
-  return SM_FirstPoint;
-}
-
-boost::shared_ptr<GeomDataAPI_Point2D> PartSet_ConstraintRadiusPrs::featurePoint
-                                                     (const PartSet_SelectionMode& theMode)
-{
-  return boost::shared_ptr<GeomDataAPI_Point2D>();
-}
diff --git a/src/PartSet/PartSet_ConstraintRadiusPrs.h b/src/PartSet/PartSet_ConstraintRadiusPrs.h
deleted file mode 100644 (file)
index 48585dc..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-// File:        PartSet_ConstraintRadiusPrs.h
-// Created:     16 Jun 2014
-// Author:      Natalia ERMOLAEVA
-
-#ifndef PartSet_ConstraintRadiusPrs_H
-#define PartSet_ConstraintRadiusPrs_H
-
-#include "PartSet.h"
-
-#include "PartSet_FeaturePrs.h"
-#include "PartSet_Constants.h"
-
-#include <gp_Pnt.hxx>
-
-class GeomDataAPI_Point2D;
-class Handle_AIS_InteractiveObject;
-class Handle_V3d_View;
-
-/*!
- \class PartSet_ConstraintRadiusPrs
- * \brief The class to define the circle feature manipulation. It is created for
- * the feature create operation to move out the feature properties set and use one operation
- * for any type of features.
-*/
-class PARTSET_EXPORT PartSet_ConstraintRadiusPrs : public PartSet_FeaturePrs
-{
-public:
-  /// Returns the feature type processed by this presentation
-  /// \return the feature kind
-  static std::string getKind();
-
-  /// Constructor
-  /// \param theSketch the sketch feature
-  PartSet_ConstraintRadiusPrs(FeaturePtr theSketch);
-  /// Destructor
-  virtual ~PartSet_ConstraintRadiusPrs() {};
-
-  /// Sets the feature to to a feature attribute depending on the selection mode
-  /// \param theFeature a feature instance
-  /// \param theMode the selection mode
-  /// \return whether the feature is set
-  virtual PartSet_SelectionMode setFeature(FeaturePtr theFeature, const PartSet_SelectionMode& theMode);
-
-  /// Sets the point to the feature in an attribute depending on the selection mode
-  /// \param theX the 2D point horizontal coordinate
-  /// \param theY the 2D point vertical coordinate
-  /// \param theMode the selection mode
-  /// \return the new selection mode
-  virtual PartSet_SelectionMode setPoint(double theX, double theY,
-                                         const PartSet_SelectionMode& theMode);
-
-  /// Returns the feature attribute name for the selection mode
-  /// \param theMode the current operation selection mode. The feature attribute depends on the mode
-  virtual std::string getAttribute(const PartSet_SelectionMode& theMode) const;
-
-  /// Returns the next selection mode after the attribute
-  /// \param theAttribute the feature attribute name
-  /// \return next attribute selection mode
-  virtual PartSet_SelectionMode getNextMode(const std::string& theAttribute) const;
-
-  /// Project the view point on the feature. The output coordinates belong to the feature
-  /// \param theFeature a feature
-  /// \param theSketch the sketch feature
-  /// \param thePoint a viewer point
-  /// \param theView the OCC view
-  /// \theX the output horizontal coordinate of a projected point
-  /// \theY the output vertical coordinate of a projected point
-  static void projectPointOnFeature(FeaturePtr theFeature, FeaturePtr theSketch, gp_Pnt& thePoint,
-                                    Handle_V3d_View theView, double& theX, double& theY);
-
-protected:
-  /// Returns the feature point in the selection mode position.
-  /// \param theMode the current operation selection mode. The feature attribute depends on the mode
-  virtual boost::shared_ptr<GeomDataAPI_Point2D> featurePoint(const PartSet_SelectionMode& theMode);
-};
-
-#endif
diff --git a/src/PartSet/PartSet_FeatureArcPrs.cpp b/src/PartSet/PartSet_FeatureArcPrs.cpp
deleted file mode 100644 (file)
index 440f562..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-// File:        PartSet_FeaturePrs.h
-// Created:     04 Jun 2014
-// Author:      Natalia ERMOLAEVA
-
-#include <PartSet_FeatureArcPrs.h>
-#include <PartSet_Tools.h>
-
-#include <SketchPlugin_Feature.h>
-#include <SketchPlugin_Sketch.h>
-#include <SketchPlugin_Arc.h>
-
-#include <GeomDataAPI_Point2D.h>
-#include <GeomAPI_Pnt2d.h>
-#include <GeomAPI_Circ2d.h>
-
-#include <ModelAPI_Data.h>
-#include <ModelAPI_Document.h>
-#include <ModelAPI_AttributeRefAttr.h>
-#include <ModelAPI_AttributeRefList.h>
-
-#include <V3d_View.hxx>
-
-#include <Precision.hxx>
-
-using namespace std;
-
-PartSet_FeatureArcPrs::PartSet_FeatureArcPrs(FeaturePtr theSketch)
-: PartSet_FeaturePrs(theSketch)
-{
-}
-
-std::string PartSet_FeatureArcPrs::getKind()
-{
-  return SKETCH_ARC_KIND;
-}
-
-PartSet_SelectionMode PartSet_FeatureArcPrs::setPoint(double theX, double theY,
-                                                       const PartSet_SelectionMode& theMode)
-{
-  PartSet_SelectionMode aMode = theMode;
-  switch (theMode)
-  {
-    case SM_FirstPoint: {
-      PartSet_Tools::setFeaturePoint(feature(), theX, theY, ARC_ATTR_CENTER);
-      aMode = SM_SecondPoint;
-    }
-    break;
-    case SM_SecondPoint: {
-      PartSet_Tools::setFeaturePoint(feature(), theX, theY, ARC_ATTR_START);
-      aMode = SM_ThirdPoint;
-   }
-   break;
-   case SM_ThirdPoint: {
-     PartSet_Tools::setFeaturePoint(feature(), theX, theY, ARC_ATTR_END);
-     aMode = SM_DonePoint;
-   }
-    break;
-    default:
-      break;
-  }
-  return aMode;
-}
-
-std::string PartSet_FeatureArcPrs::getAttribute(const PartSet_SelectionMode& theMode) const
-{
-  std::string aAttribute;
-  switch (theMode)
-  {
-    case SM_FirstPoint:
-      aAttribute = ARC_ATTR_CENTER;
-    break;
-    case SM_SecondPoint:
-      aAttribute = ARC_ATTR_START;
-    break;
-    case SM_ThirdPoint:
-      aAttribute = ARC_ATTR_END;
-    break;
-    default:
-    break;
-  }
-  return aAttribute;
-}
-
-PartSet_SelectionMode PartSet_FeatureArcPrs::getNextMode(const std::string& theAttribute) const
-{
-  PartSet_SelectionMode aMode;
-
-  if (theAttribute == ARC_ATTR_CENTER)
-    aMode = SM_SecondPoint;
-  else if (theAttribute == ARC_ATTR_START)
-    aMode = SM_ThirdPoint;
-  else if (theAttribute == ARC_ATTR_END)
-    aMode = SM_DonePoint;
-  return aMode;
-}
-
-void PartSet_FeatureArcPrs::projectPointOnFeature(FeaturePtr theFeature, FeaturePtr theSketch,
-                                                  gp_Pnt& thePoint, Handle(V3d_View) theView,
-                                                  double& theX, double& theY)
-{
-  FeaturePtr aSketch = theSketch;
-  if (aSketch) {
-    double aX, anY;
-    PartSet_Tools::convertTo2D(thePoint, aSketch, theView, aX, anY);
-
-    // circle origin point and radius
-    boost::shared_ptr<ModelAPI_Data> aData = theFeature->data();
-    boost::shared_ptr<GeomDataAPI_Point2D> aCenter = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>
-                                                              (aData->attribute(ARC_ATTR_CENTER));
-    boost::shared_ptr<GeomDataAPI_Point2D> aStart = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>
-                                                              (aData->attribute(ARC_ATTR_START));
-
-    boost::shared_ptr<GeomAPI_Circ2d> aCirc(new GeomAPI_Circ2d(aCenter->pnt(), aStart->pnt()));
-    boost::shared_ptr<GeomAPI_Pnt2d> aGeomPoint2d(new GeomAPI_Pnt2d(aX, anY));
-    boost::shared_ptr<GeomAPI_Pnt2d> aPnt2d = aCirc->project(aGeomPoint2d);
-    if (aPnt2d) {
-      theX = aPnt2d->x();
-      theY = aPnt2d->y();
-    }
-  }
-}
-
-boost::shared_ptr<GeomDataAPI_Point2D> PartSet_FeatureArcPrs::featurePoint
-                                                     (const PartSet_SelectionMode& theMode)
-{
-  std::string aPointArg;
-  switch (theMode)
-  {
-    case SM_FirstPoint:
-      aPointArg = ARC_ATTR_CENTER;
-      break;
-    case SM_SecondPoint:
-      aPointArg = ARC_ATTR_START;
-      break;
-    case SM_ThirdPoint:
-      aPointArg = ARC_ATTR_END;
-      break;
-    default:
-      break;
-  }
-  boost::shared_ptr<ModelAPI_Data> aData = feature()->data();
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>
-                                                              (aData->attribute(aPointArg));
-  return aPoint;
-}
-
-double PartSet_FeatureArcPrs::radius(FeaturePtr theFeature)
-{
-  if (!theFeature)
-    return 0;
-
-  boost::shared_ptr<ModelAPI_Data> aData = theFeature->data();
-
-  boost::shared_ptr<GeomDataAPI_Point2D> aCenterAttr = 
-    boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(ARC_ATTR_CENTER));
-  boost::shared_ptr<GeomDataAPI_Point2D> aStartAttr = 
-    boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(ARC_ATTR_START));
-  
-  return aCenterAttr->pnt()->distance(aStartAttr->pnt());
-}
diff --git a/src/PartSet/PartSet_FeatureArcPrs.h b/src/PartSet/PartSet_FeatureArcPrs.h
deleted file mode 100644 (file)
index fd0bff9..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-// File:        PartSet_FeatureArcPrs.h
-// Created:     04 Jun 2014
-// Author:      Natalia ERMOLAEVA
-
-#ifndef PartSet_FeatureArcPrs_H
-#define PartSet_FeatureArcPrs_H
-
-#include "PartSet.h"
-
-#include "PartSet_FeaturePrs.h"
-#include "PartSet_Constants.h"
-
-#include <gp_Pnt.hxx>
-
-class GeomDataAPI_Point2D;
-class Handle_V3d_View;
-
-/*!
- \class PartSet_FeatureArcPrs
- * \brief The class to define the circle arc feature manipulation. It is created for
- * the feature create operation to move out the feature properties set and use one operation
- * for any type of features.
-*/
-class PARTSET_EXPORT PartSet_FeatureArcPrs : public PartSet_FeaturePrs
-{
-public:
-  /// Returns the feature type processed by this presentation
-  /// \return the feature kind
-  static std::string getKind();
-
-  /// Constructor
-  /// \param theSketch the sketch feature
-  PartSet_FeatureArcPrs(FeaturePtr theSketch);
-  /// Destructor
-  virtual ~PartSet_FeatureArcPrs() {};
-
-  /// Sets the point to the feature in an attribute depending on the selection mode
-  /// \param theX the 2D point horizontal coordinate
-  /// \param theY the 2D point vertical coordinate
-  /// \param theMode the selection mode
-  /// \return the new selection mode
-  virtual PartSet_SelectionMode setPoint(double theX, double theY,
-                                         const PartSet_SelectionMode& theMode);
-
-  /// Returns the feature attribute name for the selection mode
-  /// \param theMode the current operation selection mode. The feature attribute depends on the mode
-  virtual std::string getAttribute(const PartSet_SelectionMode& theMode) const;
-
-  /// Returns the next selection mode after the attribute
-  /// \param theAttribute the feature attribute name
-  /// \return next attribute selection mode
-  virtual PartSet_SelectionMode getNextMode(const std::string& theAttribute) const;
-
-  /// Project the view point on the feature. The output coordinates belong to the feature
-  /// \param theFeature a feature
-  /// \param theSketch the sketch feature
-  /// \param thePoint a viewer point
-  /// \param theView the OCC view
-  /// \theX the output horizontal coordinate of a projected point
-  /// \theY the output vertical coordinate of a projected point
-  static void projectPointOnFeature(FeaturePtr theFeature, FeaturePtr theSketch, gp_Pnt& thePoint,
-                                    Handle_V3d_View theView, double& theX, double& theY);
-
-  /// Computes the feature's radius
-  /// \param theFeature an arc feature
-  /// \return the double value
-  static double radius(FeaturePtr theFeature);
-
-protected:
-  /// Returns the feature point in the selection mode position.
-  /// \param theMode the current operation selection mode. The feature attribute depends on the mode
-  virtual boost::shared_ptr<GeomDataAPI_Point2D> featurePoint(const PartSet_SelectionMode& theMode);
-};
-
-#endif
diff --git a/src/PartSet/PartSet_FeatureCirclePrs.cpp b/src/PartSet/PartSet_FeatureCirclePrs.cpp
deleted file mode 100644 (file)
index 426d9f1..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-// File:        PartSet_FeaturePrs.h
-// Created:     04 Jun 2014
-// Author:      Natalia ERMOLAEVA
-
-#include <PartSet_FeatureCirclePrs.h>
-#include <PartSet_Tools.h>
-
-#include <SketchPlugin_Feature.h>
-#include <SketchPlugin_Sketch.h>
-#include <SketchPlugin_Circle.h>
-
-#include <GeomDataAPI_Point2D.h>
-#include <GeomDataAPI_Dir.h>
-#include <GeomAPI_Pnt2d.h>
-#include <GeomAPI_Circ2d.h>
-#include <GeomAPI_Dir2d.h>
-#include <GeomAPI_Dir.h>
-
-#include <ModelAPI_Data.h>
-#include <ModelAPI_Document.h>
-#include <ModelAPI_AttributeRefAttr.h>
-#include <ModelAPI_AttributeRefList.h>
-
-#include <V3d_View.hxx>
-#include <Precision.hxx>
-
-using namespace std;
-
-PartSet_FeatureCirclePrs::PartSet_FeatureCirclePrs(FeaturePtr theSketch)
-: PartSet_FeaturePrs(theSketch)
-{
-}
-
-std::string PartSet_FeatureCirclePrs::getKind()
-{
-  return SKETCH_CIRCLE_KIND;
-}
-
-PartSet_SelectionMode PartSet_FeatureCirclePrs::setPoint(double theX, double theY,
-                                                         const PartSet_SelectionMode& theMode)
-{
-  PartSet_SelectionMode aMode = theMode;
-  switch (theMode)
-  {
-    case SM_FirstPoint: {
-      PartSet_Tools::setFeaturePoint(feature(), theX, theY, CIRCLE_ATTR_CENTER);
-      aMode = SM_SecondPoint;
-    }
-    break;
-    case SM_SecondPoint: {
-      boost::shared_ptr<ModelAPI_Data> aData = feature()->data();
-      boost::shared_ptr<GeomDataAPI_Point2D> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>
-                                                                  (aData->attribute(CIRCLE_ATTR_CENTER));
-      boost::shared_ptr<GeomAPI_Pnt2d> aCoordPoint(new GeomAPI_Pnt2d(theX, theY));
-      double aRadius = aCoordPoint->distance(aPoint->pnt());
-      PartSet_Tools::setFeatureValue(feature(), aRadius, CIRCLE_ATTR_RADIUS);
-
-      aMode = SM_DonePoint;
-   }
-    break;
-    default:
-      break;
-  }
-  return aMode;
-}
-
-std::string PartSet_FeatureCirclePrs::getAttribute(const PartSet_SelectionMode& theMode) const
-{
-  std::string aAttribute;
-  switch (theMode)
-  {
-    case SM_FirstPoint:
-      aAttribute = CIRCLE_ATTR_CENTER;
-    break;
-    case SM_SecondPoint:
-      aAttribute = CIRCLE_ATTR_RADIUS;
-    break;
-    default:
-    break;
-  }
-  return aAttribute;
-}
-
-PartSet_SelectionMode PartSet_FeatureCirclePrs::getNextMode(const std::string& theAttribute) const
-{
-  PartSet_SelectionMode aMode;
-
-  if (theAttribute == CIRCLE_ATTR_CENTER)
-    aMode = SM_SecondPoint;
-  else if (theAttribute == CIRCLE_ATTR_RADIUS)
-    aMode = SM_DonePoint;
-  return aMode;
-}
-
-void PartSet_FeatureCirclePrs::projectPointOnFeature(FeaturePtr theFeature, FeaturePtr theSketch,
-                                                     gp_Pnt& thePoint, Handle(V3d_View) theView,
-                                                     double& theX, double& theY)
-{
-  FeaturePtr aSketch = theSketch;
-  if (aSketch) {
-    double aX, anY;
-    PartSet_Tools::convertTo2D(thePoint, aSketch, theView, aX, anY);
-
-    // circle origin point and radius
-    boost::shared_ptr<ModelAPI_Data> aData = theFeature->data();
-    boost::shared_ptr<GeomDataAPI_Point2D> aCenter = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>
-                                                              (aData->attribute(CIRCLE_ATTR_CENTER));
-    bool isValid;
-    double aRadius = PartSet_Tools::featureValue(theFeature, CIRCLE_ATTR_RADIUS, isValid);
-
-    boost::shared_ptr<GeomAPI_Dir2d> aNormal(new GeomAPI_Dir2d(aX, anY));
-    boost::shared_ptr<GeomAPI_Circ2d> aCirc(new GeomAPI_Circ2d(aCenter->pnt(), aNormal, aRadius));
-    boost::shared_ptr<GeomAPI_Pnt2d> aGeomPoint2d(new GeomAPI_Pnt2d(aX, anY));
-    boost::shared_ptr<GeomAPI_Pnt2d> aPnt2d = aCirc->project(aGeomPoint2d);
-    if (aPnt2d) {
-      theX = aPnt2d->x();
-      theY = aPnt2d->y();
-    }
-  }
-}
-
-boost::shared_ptr<GeomDataAPI_Point2D> PartSet_FeatureCirclePrs::featurePoint
-                                                     (const PartSet_SelectionMode& theMode)
-{
-  std::string aPointArg;
-  switch (theMode)
-  {
-    case SM_FirstPoint:
-      aPointArg = CIRCLE_ATTR_CENTER;
-      break;
-    default:
-      break;
-  }
-  boost::shared_ptr<ModelAPI_Data> aData = feature()->data();
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>
-                                                              (aData->attribute(aPointArg));
-  return aPoint;
-}
diff --git a/src/PartSet/PartSet_FeatureCirclePrs.h b/src/PartSet/PartSet_FeatureCirclePrs.h
deleted file mode 100644 (file)
index f9688b1..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-// File:        PartSet_FeatureCirclePrs.h
-// Created:     04 Jun 2014
-// Author:      Natalia ERMOLAEVA
-
-#ifndef PartSet_FeatureCirclePrs_H
-#define PartSet_FeatureCirclePrs_H
-
-#include "PartSet.h"
-
-#include "PartSet_FeaturePrs.h"
-#include "PartSet_Constants.h"
-
-#include <gp_Pnt.hxx>
-
-class GeomDataAPI_Point2D;
-class Handle_V3d_View;
-
-/*!
- \class PartSet_FeatureCirclePrs
- * \brief The class to define the circle feature manipulation. It is created for
- * the feature create operation to move out the feature properties set and use one operation
- * for any type of features.
-*/
-class PARTSET_EXPORT PartSet_FeatureCirclePrs : public PartSet_FeaturePrs
-{
-public:
-  /// Returns the feature type processed by this presentation
-  /// \return the feature kind
-  static std::string getKind();
-
-  /// Constructor
-  /// \param theSketch the sketch feature
-  PartSet_FeatureCirclePrs(FeaturePtr theSketch);
-  /// Destructor
-  virtual ~PartSet_FeatureCirclePrs() {};
-
-  /// Sets the point to the feature in an attribute depending on the selection mode
-  /// \param theX the 2D point horizontal coordinate
-  /// \param theY the 2D point vertical coordinate
-  /// \param theMode the selection mode
-  /// \return the new selection mode
-  virtual PartSet_SelectionMode setPoint(double theX, double theY,
-                                         const PartSet_SelectionMode& theMode);
-
-  /// Returns the feature attribute name for the selection mode
-  /// \param theMode the current operation selection mode. The feature attribute depends on the mode
-  virtual std::string getAttribute(const PartSet_SelectionMode& theMode) const;
-
-  /// Returns the next selection mode after the attribute
-  /// \param theAttribute the feature attribute name
-  /// \return next attribute selection mode
-  virtual PartSet_SelectionMode getNextMode(const std::string& theAttribute) const;
-
-  /// Project the view point on the feature. The output coordinates belong to the feature
-  /// \param theFeature a feature
-  /// \param theSketch the sketch feature
-  /// \param thePoint a viewer point
-  /// \param theView the OCC view
-  /// \theX the output horizontal coordinate of a projected point
-  /// \theY the output vertical coordinate of a projected point
-  static void projectPointOnFeature(FeaturePtr theFeature, FeaturePtr theSketch, gp_Pnt& thePoint,
-                                    Handle_V3d_View theView, double& theX, double& theY);
-
-protected:
-  /// Returns the feature point in the selection mode position.
-  /// \param theMode the current operation selection mode. The feature attribute depends on the mode
-  virtual boost::shared_ptr<GeomDataAPI_Point2D> featurePoint(const PartSet_SelectionMode& theMode);
-};
-
-#endif
diff --git a/src/PartSet/PartSet_FeatureLinePrs.cpp b/src/PartSet/PartSet_FeatureLinePrs.cpp
deleted file mode 100644 (file)
index fe4c3a5..0000000
+++ /dev/null
@@ -1,197 +0,0 @@
-// File:        PartSet_FeaturePrs.h
-// Created:     04 Jun 2014
-// Author:      Natalia ERMOLAEVA
-
-#include <PartSet_FeatureLinePrs.h>
-#include <PartSet_Tools.h>
-
-#include <SketchPlugin_Feature.h>
-#include <SketchPlugin_Sketch.h>
-#include <SketchPlugin_ConstraintCoincidence.h>
-#include <SketchPlugin_Line.h>
-#include <SketchPlugin_Constraint.h>
-
-#include <GeomDataAPI_Point2D.h>
-#include <GeomAPI_Lin2d.h>
-#include <GeomAPI_Pnt2d.h>
-
-#include <ModelAPI_Data.h>
-#include <ModelAPI_Document.h>
-#include <ModelAPI_AttributeRefAttr.h>
-#include <ModelAPI_AttributeRefList.h>
-
-#include <Precision.hxx>
-#include <V3d_View.hxx>
-
-using namespace std;
-
-PartSet_FeatureLinePrs::PartSet_FeatureLinePrs(FeaturePtr theSketch)
-: PartSet_FeaturePrs(theSketch)
-{
-}
-
-std::string PartSet_FeatureLinePrs::getKind()
-{
-  return SKETCH_LINE_KIND;
-}
-
-PartSet_SelectionMode PartSet_FeatureLinePrs::setPoint(double theX, double theY,
-                                                       const PartSet_SelectionMode& theMode)
-{
-  PartSet_SelectionMode aMode = theMode;
-  switch (theMode)
-  {
-    case SM_FirstPoint: {
-      PartSet_Tools::setFeaturePoint(feature(), theX, theY, LINE_ATTR_START);
-      PartSet_Tools::setFeaturePoint(feature(), theX, theY, LINE_ATTR_END);
-      aMode = SM_SecondPoint;
-    }
-    break;
-    case SM_SecondPoint: {
-      PartSet_Tools::setFeaturePoint(feature(), theX, theY, LINE_ATTR_END);
-      aMode = SM_DonePoint;
-   }
-    break;
-    default:
-      break;
-  }
-  return aMode;
-}
-
-PartSet_SelectionMode PartSet_FeatureLinePrs::setFeature(FeaturePtr theFeature, const PartSet_SelectionMode& theMode)
-{
-  PartSet_SelectionMode aMode = theMode;
-  if (feature() && theFeature && theMode == SM_FirstPoint)
-  {
-    // use the last point of the previous feature as the first of the new one
-    boost::shared_ptr<ModelAPI_Data> aData = theFeature->data();
-    boost::shared_ptr<GeomDataAPI_Point2D> anInitPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>
-                                                                  (aData->attribute(LINE_ATTR_END));
-    PartSet_Tools::setFeaturePoint(feature(), anInitPoint->x(), anInitPoint->y(), LINE_ATTR_START);
-    PartSet_Tools::setFeaturePoint(feature(), anInitPoint->x(), anInitPoint->y(), LINE_ATTR_END);
-
-    aData = feature()->data();
-    boost::shared_ptr<GeomDataAPI_Point2D> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>
-                                                                 (aData->attribute(LINE_ATTR_START));
-    PartSet_Tools::createConstraint(sketch(), anInitPoint, aPoint);
-    aMode = SM_SecondPoint;
-  }
-  return aMode;
-}
-
-std::string PartSet_FeatureLinePrs::getAttribute(const PartSet_SelectionMode& theMode) const
-{
-  std::string aAttribute;
-  switch (theMode)
-  {
-    case SM_FirstPoint:
-      aAttribute = LINE_ATTR_START;
-    break;
-    case SM_SecondPoint:
-      aAttribute = LINE_ATTR_END;
-    break;
-    default:
-    break;
-  }
-  return aAttribute;
-}
-
-PartSet_SelectionMode PartSet_FeatureLinePrs::getNextMode(const std::string& theAttribute) const
-{
-  PartSet_SelectionMode aMode;
-
-  if (theAttribute == LINE_ATTR_START)
-    aMode = SM_SecondPoint;
-  else if (theAttribute == LINE_ATTR_END)
-    aMode = SM_DonePoint;
-  return aMode;
-}
-
-void PartSet_FeatureLinePrs::projectPointOnLine(FeaturePtr theFeature,
-                                                const PartSet_SelectionMode& theMode,
-                                                const gp_Pnt& thePoint, Handle(V3d_View) theView,
-                                                double& theX, double& theY)
-{
-  if (theFeature && theFeature->getKind() == getKind()) {
-    double X0, X1;
-    double Y0, Y1;
-
-    PartSet_Tools::convertTo2D(thePoint, sketch(), theView, X1, Y1);
-    boost::shared_ptr<GeomAPI_Pnt2d> aPoint = boost::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(X1, Y1));
-    boost::shared_ptr<GeomAPI_Lin2d> aFeatureLin = PartSet_FeatureLinePrs::createLin2d(theFeature);
-
-    switch (theMode) {
-      case SM_FirstPoint: {
-        boost::shared_ptr<GeomAPI_Pnt2d> aResult = aFeatureLin->project(aPoint);
-        theX = aResult->x();
-        theY = aResult->y();
-      }
-      break;
-      case SM_SecondPoint: {
-        getLinePoint(feature(), LINE_ATTR_START, X0, Y0);
-        boost::shared_ptr<GeomAPI_Lin2d> aCurrentLin = boost::shared_ptr<GeomAPI_Lin2d>
-                                                           (new GeomAPI_Lin2d(X0, Y0, X1, Y1));
-        boost::shared_ptr<GeomAPI_Pnt2d> aResult = aFeatureLin->intersect(aCurrentLin);
-        boost::shared_ptr<GeomAPI_Pnt2d> aPoint0 = boost::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(X0, Y0));
-        if (aResult->distance(aPoint0) < Precision::Confusion()) { // the start point is nearest to the line
-          // if the first point of a line belongs to the given line
-          // we need to project the second point on the same line
-          aResult = aFeatureLin->project(aPoint);
-        }
-        theX = aResult->x();
-        theY = aResult->y();
-      }
-      break;
-      default:
-      break;
-    }
-  }
-}
-
-boost::shared_ptr<GeomAPI_Lin2d> PartSet_FeatureLinePrs::createLin2d(FeaturePtr theFeature)
-{
-  boost::shared_ptr<GeomAPI_Lin2d> aFeatureLin;
-  if (!theFeature || theFeature->getKind() != PartSet_FeatureLinePrs::getKind())
-    return aFeatureLin;
-
-  double aStartX, aStartY, anEndX, anEndY;
-  getLinePoint(theFeature, LINE_ATTR_START, aStartX, aStartY);
-  getLinePoint(theFeature, LINE_ATTR_END, anEndX, anEndY);
-
-  aFeatureLin = boost::shared_ptr<GeomAPI_Lin2d>
-                                        (new GeomAPI_Lin2d(aStartX, aStartY, anEndX, anEndY));
-  return aFeatureLin;
-}
-
-boost::shared_ptr<GeomDataAPI_Point2D> PartSet_FeatureLinePrs::featurePoint
-                                                     (const PartSet_SelectionMode& theMode)
-{
-  std::string aPointArg;
-  switch (theMode)
-  {
-    case SM_FirstPoint:
-      aPointArg = LINE_ATTR_START;
-      break;
-    case SM_SecondPoint:
-      aPointArg = LINE_ATTR_END;
-      break;
-    default:
-      break;
-  }
-  boost::shared_ptr<ModelAPI_Data> aData = feature()->data();
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>
-                                                              (aData->attribute(aPointArg));
-  return aPoint;
-}
-
-void PartSet_FeatureLinePrs::getLinePoint(FeaturePtr theFeature, const std::string& theAttribute,
-                                          double& theX, double& theY)
-{
-  if (!theFeature || theFeature->getKind() != PartSet_FeatureLinePrs::getKind())
-    return;
-  boost::shared_ptr<ModelAPI_Data> aData = theFeature->data();
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint =
-        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(theAttribute));
-  theX = aPoint->x();
-  theY = aPoint->y();
-}
diff --git a/src/PartSet/PartSet_FeatureLinePrs.h b/src/PartSet/PartSet_FeatureLinePrs.h
deleted file mode 100644 (file)
index b9f2cfa..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-// File:        PartSet_FeatureLinePrs.h
-// Created:     04 Jun 2014
-// Author:      Natalia ERMOLAEVA
-
-#ifndef PartSet_FeatureLinePrs_H
-#define PartSet_FeatureLinePrs_H
-
-#include "PartSet.h"
-
-#include "PartSet_FeaturePrs.h"
-#include "PartSet_Constants.h"
-
-#include <gp_Pnt.hxx>
-
-class GeomDataAPI_Point2D;
-class GeomAPI_Lin2d;
-class Handle_V3d_View;
-
-/*!
- \class PartSet_FeatureLinePrs
- * \brief The class to define the line feature manipulation. It is created for
- * the feature create operation to move out the feature properties set and use one operation
- * for any type of features.
-*/
-class PARTSET_EXPORT PartSet_FeatureLinePrs : public PartSet_FeaturePrs
-{
-public:
-  /// Returns the feature type processed by this presentation
-  /// \return the feature kind
-  static std::string getKind();
-
-  /// Constructor
-  /// \param theSketch the sketch feature
-  PartSet_FeatureLinePrs(FeaturePtr theSketch);
-  /// Destructor
-  virtual ~PartSet_FeatureLinePrs() {};
-
-  /// Sets the point to the feature in an attribute depending on the selection mode
-  /// \param theX the 2D point horizontal coordinate
-  /// \param theY the 2D point vertical coordinate
-  /// \param theMode the selection mode
-  /// \return the new selection mode
-  virtual PartSet_SelectionMode setPoint(double theX, double theY,
-                                         const PartSet_SelectionMode& theMode);
-
-  /// Sets the feature to to a feature attribute depending on the selection mode
-  /// \param theFeature a feature instance
-  /// \param theMode the selection mode
-  /// \return whether the feature is set
-  virtual PartSet_SelectionMode setFeature(FeaturePtr theFeature, const PartSet_SelectionMode& theMode);
-
-  /// Returns the feature attribute name for the selection mode
-  /// \param theMode the current operation selection mode. The feature attribute depends on the mode
-  virtual std::string getAttribute(const PartSet_SelectionMode& theMode) const;
-
-  /// Returns the next selection mode after the attribute
-  /// \param theAttribute the feature attribute name
-  /// \return next attribute selection mode
-  virtual PartSet_SelectionMode getNextMode(const std::string& theAttribute) const;
-
-  /// Project the point on a feature
-  /// \param theFeature the feature to be projected on
-  /// \param theMode the selection mode
-  /// \param thePoint the clicked point
-  /// \param theView the viewer
-  /// \param theX the output horizontal coordinate
-  /// \param theY the output vertical coordinate
-  void projectPointOnLine(FeaturePtr theFeature, const PartSet_SelectionMode& theMode,
-                          const gp_Pnt& thePoint, Handle_V3d_View theView,
-                          double& theX, double& theY);
-
-  /// Creates a lin 2d object on a base of the line feature
-  /// \param theFeature the line feature
-  static boost::shared_ptr<GeomAPI_Lin2d> createLin2d(FeaturePtr theFeature);
-  /// \brief Get the line point 2d coordinates.
-  /// \param theFeature the line feature
-  /// \param theAttribute the start or end attribute of the line
-  /// \param theX the horizontal coordinate
-  /// \param theY the vertical coordinate
-  static void getLinePoint(FeaturePtr theFeature, const std::string& theAttribute,
-                           double& theX, double& theY);
-
-protected:
-  /// Returns the feature point in the selection mode position.
-  /// \param theMode the current operation selection mode. The feature attribute depends on the mode
-  virtual boost::shared_ptr<GeomDataAPI_Point2D> featurePoint(const PartSet_SelectionMode& theMode);
-};
-
-#endif
diff --git a/src/PartSet/PartSet_FeaturePointPrs.cpp b/src/PartSet/PartSet_FeaturePointPrs.cpp
deleted file mode 100644 (file)
index 818206b..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-// File:        PartSet_FeaturePrs.h
-// Created:     04 Jun 2014
-// Author:      Natalia ERMOLAEVA
-
-#include <PartSet_FeaturePointPrs.h>
-#include <PartSet_Tools.h>
-
-#include <SketchPlugin_Feature.h>
-#include <SketchPlugin_Sketch.h>
-#include <SketchPlugin_Point.h>
-
-#include <GeomAPI_Pnt2d.h>
-#include <GeomDataAPI_Point2D.h>
-
-#include <ModelAPI_Data.h>
-#include <ModelAPI_Document.h>
-#include <ModelAPI_AttributeRefAttr.h>
-#include <ModelAPI_AttributeRefList.h>
-
-#include <Precision.hxx>
-
-using namespace std;
-
-PartSet_FeaturePointPrs::PartSet_FeaturePointPrs(FeaturePtr theSketch)
-: PartSet_FeaturePrs(theSketch)
-{
-}
-
-std::string PartSet_FeaturePointPrs::getKind()
-{
-  return SKETCH_POINT_KIND;
-}
-
-PartSet_SelectionMode PartSet_FeaturePointPrs::setPoint(double theX, double theY,
-                                                       const PartSet_SelectionMode& theMode)
-{
-  PartSet_SelectionMode aMode = theMode;
-  switch (theMode)
-  {
-    case SM_FirstPoint: {
-      PartSet_Tools::setFeaturePoint(feature(), theX, theY, POINT_ATTR_COORD);
-      aMode = SM_DonePoint;
-    }
-    break;
-    default:
-      break;
-  }
-  return aMode;
-}
-
-std::string PartSet_FeaturePointPrs::getAttribute(const PartSet_SelectionMode& theMode) const
-{
-  std::string aAttribute;
-  switch (theMode)
-  {
-    case SM_FirstPoint:
-      aAttribute = POINT_ATTR_COORD;
-    break;
-    default:
-    break;
-  }
-  return aAttribute;
-}
-
-PartSet_SelectionMode PartSet_FeaturePointPrs::getNextMode(const std::string& theAttribute) const
-{
-  PartSet_SelectionMode aMode;
-
-  if (theAttribute == POINT_ATTR_COORD)
-    aMode = SM_DonePoint;
-  return aMode;
-}
-
-boost::shared_ptr<GeomDataAPI_Point2D> PartSet_FeaturePointPrs::featurePoint
-                                                     (const PartSet_SelectionMode& theMode)
-{
-  std::string aPointArg;
-  switch (theMode)
-  {
-    case SM_FirstPoint:
-      aPointArg = POINT_ATTR_COORD;
-      break;
-    default:
-      break;
-  }
-  boost::shared_ptr<ModelAPI_Data> aData = feature()->data();
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>
-                                                              (aData->attribute(aPointArg));
-  return aPoint;
-}
diff --git a/src/PartSet/PartSet_FeaturePointPrs.h b/src/PartSet/PartSet_FeaturePointPrs.h
deleted file mode 100644 (file)
index 7fec848..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-// File:        PartSet_FeaturePointPrs.h
-// Created:     04 Jun 2014
-// Author:      Natalia ERMOLAEVA
-
-#ifndef PartSet_FeaturePointPrs_H
-#define PartSet_FeaturePointPrs_H
-
-#include "PartSet.h"
-
-#include "PartSet_FeaturePrs.h"
-#include "PartSet_Constants.h"
-
-class GeomDataAPI_Point2D;
-
-/*!
- \class PartSet_FeaturePointPrs
- * \brief The class to define the point feature manipulation. It is created for
- * the feature create operation to move out the feature properties set and use one operation
- * for any type of features.
-*/
-class PARTSET_EXPORT PartSet_FeaturePointPrs : public PartSet_FeaturePrs
-{
-public:
-  /// Returns the feature type processed by this presentation
-  /// \return the feature kind
-  static std::string getKind();
-
-  /// Constructor
-  /// \param theSketch the sketch feature
-  PartSet_FeaturePointPrs(FeaturePtr theSketch);
-  /// Destructor
-  virtual ~PartSet_FeaturePointPrs() {};
-
-  /// Sets the point to the feature in an attribute depending on the selection mode
-  /// \param theX the 2D point horizontal coordinate
-  /// \param theY the 2D point vertical coordinate
-  /// \param theMode the selection mode
-  /// \return the new selection mode
-  virtual PartSet_SelectionMode setPoint(double theX, double theY,
-                                         const PartSet_SelectionMode& theMode);
-
-  /// Returns the feature attribute name for the selection mode
-  /// \param theMode the current operation selection mode. The feature attribute depends on the mode
-  virtual std::string getAttribute(const PartSet_SelectionMode& theMode) const;
-
-  /// Returns the next selection mode after the attribute
-  /// \param theAttribute the feature attribute name
-  /// \return next attribute selection mode
-  virtual PartSet_SelectionMode getNextMode(const std::string& theAttribute) const;
-
-protected:
-  /// Returns the feature point in the selection mode position.
-  /// \param theMode the current operation selection mode. The feature attribute depends on the mode
-  virtual boost::shared_ptr<GeomDataAPI_Point2D> featurePoint(const PartSet_SelectionMode& theMode);
-};
-
-#endif
diff --git a/src/PartSet/PartSet_FeaturePrs.cpp b/src/PartSet/PartSet_FeaturePrs.cpp
deleted file mode 100644 (file)
index dfbad61..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-// File:        PartSet_FeaturePrs.h
-// Created:     04 Jun 2014
-// Author:      Natalia ERMOLAEVA
-
-#include <PartSet_FeaturePrs.h>
-#include <PartSet_Tools.h>
-
-#include <SketchPlugin_Feature.h>
-#include <SketchPlugin_Sketch.h>
-
-#include <GeomDataAPI_Point2D.h>
-
-#include <ModelAPI_Data.h>
-#include <ModelAPI_Document.h>
-#include <ModelAPI_AttributeRefAttr.h>
-#include <ModelAPI_AttributeRefList.h>
-
-#include <Precision.hxx>
-
-using namespace std;
-
-PartSet_FeaturePrs::PartSet_FeaturePrs(FeaturePtr theFeature)
-: mySketch(theFeature)
-{
-}
-
-PartSet_FeaturePrs::~PartSet_FeaturePrs()
-{
-}
-
-void PartSet_FeaturePrs::init(FeaturePtr theFeature)
-{
-  myFeature = theFeature;
-}
-
-FeaturePtr PartSet_FeaturePrs::sketch() const
-{
-  return mySketch;
-}
-
-FeaturePtr PartSet_FeaturePrs::feature() const
-{
-  return myFeature;
-}
-
-PartSet_SelectionMode PartSet_FeaturePrs::setFeature(FeaturePtr theFeature,
-                                                     const PartSet_SelectionMode& theMode)
-{
-  return SM_FirstPoint;
-}
diff --git a/src/PartSet/PartSet_FeaturePrs.h b/src/PartSet/PartSet_FeaturePrs.h
deleted file mode 100644 (file)
index 9adf4a0..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-// File:        PartSet_FeaturePrs.h
-// Created:     04 Jun 2014
-// Author:      Natalia ERMOLAEVA
-
-#ifndef PartSet_FeaturePrs_H
-#define PartSet_FeaturePrs_H
-
-#include "PartSet.h"
-
-#include "PartSet_Constants.h"
-
-class GeomDataAPI_Point2D;
-
-/*!
- \class PartSet_FeaturePrs
- * \brief The abstract class to define the specific feature manipulation. It is created for
- * the feature create operation to move out the feature properties set and use one operation
- * for any type of features.
-*/
-class PARTSET_EXPORT PartSet_FeaturePrs
-{
-public:
-  /// Constructor
-  /// \param theSketch the sketch feature
-  PartSet_FeaturePrs(FeaturePtr theSketch);
-  /// Destructor
-  virtual ~PartSet_FeaturePrs();
-
-  /// Initializes some fields of feature accorging to the source feature
-  /// Saves the fiature as the presentation internal feature
-  /// \param theFeature the presentation feature
-  void init(FeaturePtr theFeature);
-
-  /// Returns the operation sketch feature
-  /// \returns the sketch instance
-  FeaturePtr sketch() const;
-
-  /// Sets the point to the feature in an attribute depending on the selection mode
-  /// \param theX the 2D point horizontal coordinate
-  /// \param theY the 2D point vertical coordinate
-  /// \param theMode the selection mode
-  /// \return the new selection mode
-  virtual PartSet_SelectionMode setPoint(double theX, double theY,
-                                         const PartSet_SelectionMode& theMode) = 0;
-
-  /// Sets the feature to to a feature attribute depending on the selection mode
-  /// \param theFeature a feature instance
-  /// \param theMode the selection mode
-  /// \return whether the feature is set
-  /// \return the new selection mode
-  virtual PartSet_SelectionMode setFeature(FeaturePtr theFeature, const PartSet_SelectionMode& theMode);
-
-  /// Returns the feature attribute name for the selection mode
-  /// \param theMode the current operation selection mode. The feature attribute depends on the mode
-  virtual std::string getAttribute(const PartSet_SelectionMode& theMode) const = 0;
-
-  /// Returns the next selection mode after the attribute
-  /// \param theAttribute the feature attribute name
-  /// \return next attribute selection mode
-  virtual PartSet_SelectionMode getNextMode(const std::string& theAttribute) const = 0;
-
-protected:
-  /// Returns the operation feature
-  /// \return the feature
-  FeaturePtr feature() const;
-
-  /// Returns the feature point in the selection mode position.
-  /// \param theMode the current operation selection mode. The feature attribute depends on the mode
-  virtual boost::shared_ptr<GeomDataAPI_Point2D> featurePoint(const PartSet_SelectionMode& theMode) = 0;
-
-private:
-  FeaturePtr mySketch; ///< the sketch of the feature
-  FeaturePtr myFeature; ///< the feature
-};
-
-#endif
index 8c3b099ed1b1bd54345d2a108b1b6ee8a3a26e5a..5ecb14ba79ba24217af16a52faad63b3fcaaa982 100644 (file)
@@ -155,9 +155,6 @@ void PartSet_Module::onOperationStarted()
                                        myWorkshop->operationMgr()->currentOperation());
   if (aPreviewOp) {
     XGUI_PropertyPanel* aPropPanel = myWorkshop->propertyPanel();
-    connect(aPreviewOp, SIGNAL(focusActivated(const std::string&)),
-            aPropPanel, SLOT(onFocusActivated(const std::string&)));
-
     connect(aPropPanel, SIGNAL(storedPoint2D(FeaturePtr, const std::string&)),
       this, SLOT(onStorePoint2D(FeaturePtr, const std::string&)), Qt::UniqueConnection);
   }
@@ -170,8 +167,6 @@ void PartSet_Module::onOperationStopped(ModuleBase_Operation* theOperation)
   PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(theOperation);
   if (aPreviewOp) {
     XGUI_PropertyPanel* aPropPanel = myWorkshop->propertyPanel();
-    disconnect(aPreviewOp, SIGNAL(focusActivated(const std::string&)),
-               aPropPanel, SLOT(onFocusActivated(const std::string&)));
     //disconnect(aPropPanel, SIGNAL(storedPoint2D(FeaturePtr, const std::string&)),
     //           this, SLOT(onStorePoint2D(FeaturePtr, const std::string&)));
   }
index 89d1683531e3df94acb69124ba8d27943316e313..6aabe1e67fc8985c3ad5655ef289d393bd2fe2ab 100644 (file)
@@ -6,10 +6,6 @@
 
 #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>
@@ -21,6 +17,7 @@
 #include <SketchPlugin_ConstraintRadius.h>
 #include <SketchPlugin_ConstraintParallel.h>
 #include <SketchPlugin_ConstraintPerpendicular.h>
+#include <SketchPlugin_ConstraintCoincidence.h>
 
 #include <GeomAPI_Pnt2d.h>
 
@@ -65,7 +62,8 @@ bool PartSet_OperationFeatureCreate::canProcessKind(const std::string& theId)
          theId == SKETCH_CONSTRAINT_LENGTH_KIND ||
          theId == SKETCH_CONSTRAINT_RADIUS_KIND ||
          theId == SKETCH_CONSTRAINT_PARALLEL_KIND ||
-         theId == SKETCH_CONSTRAINT_PERPENDICULAR_KIND;
+         theId == SKETCH_CONSTRAINT_PERPENDICULAR_KIND ||
+         theId == SKETCH_CONSTRAINT_COINCIDENCE_KIND;
 }
 
 bool PartSet_OperationFeatureCreate::canBeCommitted() const
@@ -143,23 +141,12 @@ void PartSet_OperationFeatureCreate::mouseReleased(QMouseEvent* theEvent, Handle
         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);
-          //}
+          //FeaturePtr aFeature = aPrs.feature();
+          //projectPointOnLine(aFeature, myPointSelectionMode, aPoint, theView, aX, anY);
         }
       }
     }
   }
-  /*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);
-    }
-  }*/
   bool isApplyed = false;
   if (isPointWidget())
     isApplyed = setWidgetPoint(aX, anY);
@@ -187,15 +174,6 @@ void PartSet_OperationFeatureCreate::mouseMoved(QMouseEvent* theEvent, Handle(V3
     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);
-        }
-      }
-    }*/
     setWidgetPoint(aX, anY);
     flushUpdated();
   }
@@ -296,22 +274,10 @@ FeaturePtr PartSet_OperationFeatureCreate::createFeature(const bool theFlushMess
   return aNewFeature;
 }
 
-/*void PartSet_OperationFeatureCreate::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);
-  }
-}*/
-
 bool PartSet_OperationFeatureCreate::isPointWidget() const
 {
-  return dynamic_cast<ModuleBase_WidgetPoint2D*>(myActiveWidget);
+  return dynamic_cast<ModuleBase_WidgetPoint2D*>(myActiveWidget) ||
+         dynamic_cast<ModuleBase_WidgetPoint2dDistance*>(myActiveWidget);
 }
 
 bool PartSet_OperationFeatureCreate::setWidgetPoint(double theX, double theY)
index 3c181063d2d3351b7d6b1a0c9fa8122c2209d672..885f8a80eb2ee867b1ffccc6eba59be6fed879ba 100644 (file)
@@ -12,7 +12,6 @@
 
 #include <QObject>
 
-class PartSet_FeaturePrs;
 class GeomDataAPI_Point2D;
 class QMouseEvent;
 class QKeyEvent;
@@ -116,12 +115,6 @@ protected:
   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);
-
   /// Returns true if the active widget is the point selector widget
   /// \return the boolean value
   bool isPointWidget() const;
@@ -138,10 +131,8 @@ protected:
   bool setWidgetFeature(const FeaturePtr& theFeature);
 
 private:
-  //boost::shared_ptr<PartSet_FeaturePrs> myFeaturePrs; ///< the feature presentation
   FeaturePtr myInitFeature; ///< the initial feature
   FeaturePtr mySketch; ///< the sketch of the feature
-  //PartSet_SelectionMode myPointSelectionMode; ///< point selection mode
 
   ModuleBase_ModelWidget* myActiveWidget; ///< the active widget
 };
index 091595a6487c211c659cd2377118a918c94184fa..dc7f99ddf77024c10f6fc1f441d8a40280cd218f 100644 (file)
@@ -26,6 +26,8 @@
 #include <SketchPlugin_Line.h>
 
 #include <V3d_View.hxx>
+#include <AIS_DimensionOwner.hxx>
+#include <AIS_DimensionSelectionMode.hxx>
 
 #ifdef _DEBUG
 #include <QDebug>
@@ -134,13 +136,19 @@ void PartSet_OperationFeatureEdit::mouseDoubleClick(QMouseEvent* theEvent, Handl
                                                     const std::list<XGUI_ViewerPrs>& theSelected,
                                                     const std::list<XGUI_ViewerPrs>& theHighlighted)
 {
-  // changed
+  // TODO the functionality is important only for constraint feature. Should be moved in another place
   if (!theSelected.empty()) {
-    bool isValid;
-    double aValue = PartSet_Tools::featureValue(feature(), CONSTRAINT_ATTR_VALUE, isValid);
-    if (isValid) {
-      ModuleBase_WidgetEditor::editFeatureValue(feature(), CONSTRAINT_ATTR_VALUE);
-      flushUpdated();
+    XGUI_ViewerPrs aFeaturePrs = theSelected.front();
+    if (!aFeaturePrs.owner().IsNull()) {
+      Handle(AIS_DimensionOwner) anOwner = Handle(AIS_DimensionOwner)::DownCast(aFeaturePrs.owner());
+      if (!anOwner.IsNull() && anOwner->SelectionMode() == AIS_DSM_Text) {
+        bool isValid;
+        double aValue = PartSet_Tools::featureValue(feature(), CONSTRAINT_ATTR_VALUE, isValid);
+        if (isValid) {
+          ModuleBase_WidgetEditor::editFeatureValue(feature(), CONSTRAINT_ATTR_VALUE);
+          flushUpdated();
+        }
+      }
     }
   }
 }
index b5400edec911f671fd3464751e51d7db8941347d..dfe2fe85c6cd5249a673be88829cf0ac2e238c07 100644 (file)
@@ -93,7 +93,7 @@ void PartSet_OperationSketch::mousePressed(QMouseEvent* theEvent, Handle_V3d_Vie
     if (theHighlighted.size() == 1) {
       FeaturePtr aFeature = theHighlighted.front().feature();
       if (aFeature) {
-        std::string anOperationType = getOperationType(aFeature);
+        std::string anOperationType = PartSet_OperationFeatureEdit::Type();
         if (theSelected.size() > 1)
           anOperationType = PartSet_OperationFeatureEditMulti::Type();
         restartOperation(anOperationType, aFeature);
@@ -112,10 +112,14 @@ void PartSet_OperationSketch::mouseReleased(QMouseEvent* theEvent, Handle_V3d_Vi
   if (!hasSketchPlane()) {
   }
   else {
+    /// TODO: OCC bug: 25034 - the highlighted list should be filled not only for AIS_Shape
+    /// but for other IO, for example constraint dimensions.
+    /// It is empty and we have to use the process mouse release to start edition operation
+    /// for these objects
     if (theSelected.size() == 1) {
       FeaturePtr aFeature = theSelected.front().feature();
       if (aFeature)
-        restartOperation(getOperationType(aFeature), aFeature);
+        restartOperation(PartSet_OperationFeatureEdit::Type(), aFeature);
     }
   }
 }
@@ -241,8 +245,3 @@ void PartSet_OperationSketch::setSketchPlane(const TopoDS_Shape& theShape)
   emit closeLocalContext();
   emit planeSelected(aDir->x(), aDir->y(), aDir->z());
 }
-
-std::string PartSet_OperationSketch::getOperationType(FeaturePtr theFeature)
-{
-  return PartSet_OperationFeatureEdit::Type();
-}
index 7c078bf6399a02d2c4705bed866d2e2d89a17740..27c0d8641db489ef85cde4dce263e84cc9f3386b 100644 (file)
@@ -109,10 +109,6 @@ protected:
   /// \param theShape the shape
   void setSketchPlane(const TopoDS_Shape& theShape);
 
-  /// Returns the operation type, which is feature or constraint edit opeation
-  /// \param theFeature a feature instance
-  std::string getOperationType(FeaturePtr theFeature);
-
 private:
   std::list<XGUI_ViewerPrs> myFeatures; ///< the features to apply the edit operation
 };
index cd334f1cd652c6f5ed227e4b276d3153158589be..f5caebdbf968649f550e7a8b2e6c4054890d0e38 100644 (file)
@@ -120,10 +120,6 @@ signals:
   /// theName the operation name
   /// theFeature the operation argument
   void launchOperation(std::string theName, FeaturePtr theFeature);
-  /// signal about the focus activated
-  /// theName the attribute name
-  void focusActivated(const std::string& theAttibuteName);
-
   /// Signal about the feature construing is finished
   /// \param theFeature the result feature
   /// \param theMode the mode of the feature modification
index 7e104ca34aa0e7885a96ea76eb142b5e583e0c05..75a16c52d89e7e93b0c65db9786cce3690752ed6 100644 (file)
@@ -9,7 +9,6 @@
 #include <XGUI_Displayer.h>
 #include <XGUI_ViewerPrs.h>
 #include <XGUI_ViewerProxy.h>
-#include <PartSet_FeaturePrs.h>
 #include <PartSet_Tools.h>
 #include <PartSet_OperationSketchBase.h>
 
index 8c6f38832bfc3005773af18777ff8073b43750c3..ca6b10adbdb8d105719c93f9674978e34d4c982c 100644 (file)
 #include <SketchPlugin_Feature.h>
 #include <SketchPlugin_Sketch.h>
 #include <SketchPlugin_ConstraintCoincidence.h>
+#include <SketchPlugin_ConstraintDistance.h>
+#include <SketchPlugin_ConstraintLength.h>
+#include <SketchPlugin_ConstraintRadius.h>
 #include <SketchPlugin_Constraint.h>
 
-#include <PartSet_FeatureLinePrs.h>
-#include <PartSet_FeaturePointPrs.h>
-#include <PartSet_FeatureCirclePrs.h>
-#include <PartSet_FeatureArcPrs.h>
-
-#include <PartSet_ConstraintLengthPrs.h>
-#include <PartSet_ConstraintRadiusPrs.h>
-#include <PartSet_ConstraintDistancePrs.h>
-
 #include <XGUI_ViewerPrs.h>
 
 #include <V3d_View.hxx>
@@ -142,41 +136,6 @@ void PartSet_Tools::convertTo3D(const double theX, const double theY,
   thePoint = gp_Pnt(aPoint->x(), aPoint->y(), aPoint->z());
 }
 
-boost::shared_ptr<PartSet_FeaturePrs> PartSet_Tools::createFeaturePrs(const std::string& theKind,
-                                                                      FeaturePtr theSketch,
-                                                                      FeaturePtr theFeature)
-{
-  boost::shared_ptr<PartSet_FeaturePrs> aFeaturePrs;
-
-  if (theKind == PartSet_FeaturePointPrs::getKind()) {
-    aFeaturePrs = boost::shared_ptr<PartSet_FeaturePrs>(new PartSet_FeaturePointPrs(theSketch));
-  }
-  else if (theKind == PartSet_FeatureLinePrs::getKind()) {
-    aFeaturePrs = boost::shared_ptr<PartSet_FeaturePrs>(new PartSet_FeatureLinePrs(theSketch));
-  }
-  else if (theKind == PartSet_FeatureCirclePrs::getKind()) {
-    aFeaturePrs = boost::shared_ptr<PartSet_FeaturePrs>(new PartSet_FeatureCirclePrs(theSketch));
-  }
-  else if (theKind == PartSet_FeatureArcPrs::getKind()) {
-    aFeaturePrs = boost::shared_ptr<PartSet_FeaturePrs>(new PartSet_FeatureArcPrs(theSketch));
-  }
-  else if (theKind == PartSet_ConstraintLengthPrs::getKind()) {
-    aFeaturePrs = boost::shared_ptr<PartSet_FeaturePrs>(new PartSet_ConstraintLengthPrs(theSketch));
-  }
-  else if (theKind == PartSet_ConstraintRadiusPrs::getKind()) {
-    aFeaturePrs = boost::shared_ptr<PartSet_ConstraintRadiusPrs>(new PartSet_ConstraintRadiusPrs(theSketch));
-  }
-  else if (theKind == PartSet_ConstraintDistancePrs::getKind()) {
-    aFeaturePrs = boost::shared_ptr<PartSet_ConstraintDistancePrs>(new PartSet_ConstraintDistancePrs(theSketch));
-  }
-
-
-  if (theFeature && aFeaturePrs)
-    aFeaturePrs->init(theFeature);
-
-  return aFeaturePrs;
-}
-
 FeaturePtr PartSet_Tools::nearestFeature(QPoint thePoint, Handle_V3d_View theView,
                                          FeaturePtr theSketch,
                                          const std::list<XGUI_ViewerPrs>& theFeatures)
@@ -381,7 +340,7 @@ boost::shared_ptr<GeomAPI_Pnt> PartSet_Tools::point3D(
 
 bool PartSet_Tools::isConstraintFeature(const std::string& theKind)
 {
-  return theKind == PartSet_ConstraintLengthPrs::getKind() ||
-         theKind == PartSet_ConstraintDistancePrs::getKind() ||
-         theKind == PartSet_ConstraintRadiusPrs::getKind();
+  return theKind == SKETCH_CONSTRAINT_DISTANCE_KIND ||
+         theKind == SKETCH_CONSTRAINT_LENGTH_KIND ||
+         theKind == SKETCH_CONSTRAINT_RADIUS_KIND;
 }
index 6aebb10322b3bdb86b80bbe937fefed7b9f539b8..fa1f31f9d765b53dedc062dfef20dbe641592787 100644 (file)
@@ -23,7 +23,6 @@ class GeomDataAPI_Point2D;
 class GeomAPI_Pln;
 class GeomAPI_Pnt2d;
 class GeomAPI_Pnt;
-class PartSet_FeaturePrs;
 
 /*!
  \class PartSet_Tools
@@ -53,14 +52,6 @@ public:
   static void convertTo3D(const double theX, const double theY, FeaturePtr theSketch,
                           gp_Pnt& thePoint);
 
-  /// Creates the feature presentation
-  /// \param theKind a feature kind
-  /// \param theSketch the sketch of the feature
-  /// \param theFeature the feature
-  static boost::shared_ptr<PartSet_FeaturePrs> createFeaturePrs(const std::string& theKind,
-                                                                FeaturePtr theSketch,
-                                                                FeaturePtr theFeature = FeaturePtr());
-
   /// Returns a feature that is under the mouse point
   /// \param thePoint a screen point
   /// \param theView a 3D view
index ef6ecf13fd738360e8ab86d806a8f5dd027d4bad..cca6599bb9ca0f2172e71de0b1f650ceb1aa5831 100644 (file)
@@ -41,25 +41,27 @@ const boost::shared_ptr<GeomAPI_Shape>& SketchPlugin_Circle::preview()
     // compute a circle point in 3D view
     boost::shared_ptr<GeomDataAPI_Point2D> aCenterAttr = 
       boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(data()->attribute(CIRCLE_ATTR_CENTER));
-    boost::shared_ptr<GeomAPI_Pnt> aCenter(aSketch->to3D(aCenterAttr->x(), aCenterAttr->y()));
-    // make a visible point
-    boost::shared_ptr<GeomAPI_Shape> aCenterPointShape = GeomAlgoAPI_PointBuilder::point(aCenter);
-    aShapes.push_back(aCenterPointShape);
-
-    // make a visible circle
-    boost::shared_ptr<GeomDataAPI_Dir> aNDir = 
-      boost::dynamic_pointer_cast<GeomDataAPI_Dir>(aSketch->data()->attribute(SKETCH_ATTR_NORM));
-    bool aHasPlane = aNDir && !(aNDir->x() == 0 && aNDir->y() == 0 && aNDir->z() == 0);
-    if (aHasPlane) {
-      boost::shared_ptr<GeomAPI_Dir> aNormal(new GeomAPI_Dir(aNDir->x(), aNDir->y(), aNDir->z()));
-      // compute the circle radius
-      AttributeDoublePtr aRadiusAttr = 
-        boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(data()->attribute(CIRCLE_ATTR_RADIUS));
-      double aRadius = aRadiusAttr->value();
-
-      boost::shared_ptr<GeomAPI_Shape> aCircleShape = 
-                              GeomAlgoAPI_EdgeBuilder::lineCircle(aCenter, aNormal, aRadius);
-      aShapes.push_back(aCircleShape);
+    if (aCenterAttr->isInitialized()) {
+      boost::shared_ptr<GeomAPI_Pnt> aCenter(aSketch->to3D(aCenterAttr->x(), aCenterAttr->y()));
+      // make a visible point
+      boost::shared_ptr<GeomAPI_Shape> aCenterPointShape = GeomAlgoAPI_PointBuilder::point(aCenter);
+      aShapes.push_back(aCenterPointShape);
+
+      // make a visible circle
+      boost::shared_ptr<GeomDataAPI_Dir> aNDir = 
+        boost::dynamic_pointer_cast<GeomDataAPI_Dir>(aSketch->data()->attribute(SKETCH_ATTR_NORM));
+      bool aHasPlane = aNDir && !(aNDir->x() == 0 && aNDir->y() == 0 && aNDir->z() == 0);
+      if (aHasPlane) {
+        boost::shared_ptr<GeomAPI_Dir> aNormal(new GeomAPI_Dir(aNDir->x(), aNDir->y(), aNDir->z()));
+        // compute the circle radius
+        AttributeDoublePtr aRadiusAttr = 
+          boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(data()->attribute(CIRCLE_ATTR_RADIUS));
+        double aRadius = aRadiusAttr->value();
+
+        boost::shared_ptr<GeomAPI_Shape> aCircleShape = 
+                                GeomAlgoAPI_EdgeBuilder::lineCircle(aCenter, aNormal, aRadius);
+        aShapes.push_back(aCircleShape);
+      }
     }
     boost::shared_ptr<GeomAPI_Shape> aCompound = GeomAlgoAPI_CompoundBuilder::compound(aShapes);
     setPreview(aCompound);
index 91e6c4ca52fa1e6500a538809e759e6fc01caf49..342b2c1de18a81f2fb42e825669971b2509083f3 100644 (file)
@@ -6,7 +6,11 @@
 
 #include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_Data.h>
-#include <SketchPlugin_Point.h>
+#include <SketchPlugin_Line.h>
+
+#include <AIS_InteractiveObject.hxx>
+#include <AIS_ParallelRelation.hxx>
+#include <Geom_Plane.hxx>
 
 SketchPlugin_ConstraintParallel::SketchPlugin_ConstraintParallel()
 {
@@ -28,3 +32,50 @@ const boost::shared_ptr<GeomAPI_Shape>&  SketchPlugin_ConstraintParallel::previe
   return getPreview();
 }
 
+
+Handle_AIS_InteractiveObject SketchPlugin_ConstraintParallel::getAISShape(Handle_AIS_InteractiveObject thePrevious)
+{
+  Handle(AIS_InteractiveObject) anAIS = thePrevious;
+  if (!sketch())
+    return anAIS;
+
+  boost::shared_ptr<ModelAPI_Data> aData = data();
+  boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttr1 = 
+    boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(aData->attribute(CONSTRAINT_ATTR_ENTITY_A));
+  boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttr2 = 
+    boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(aData->attribute(CONSTRAINT_ATTR_ENTITY_B));
+  if (!anAttr1 || !anAttr1->isFeature() || 
+      !anAttr2 || !anAttr2->isFeature())
+    return anAIS;
+  boost::shared_ptr<SketchPlugin_Line> aLine1Feature = 
+    boost::dynamic_pointer_cast<SketchPlugin_Line>(anAttr1->feature());
+  boost::shared_ptr<SketchPlugin_Line> aLine2Feature = 
+    boost::dynamic_pointer_cast<SketchPlugin_Line>(anAttr2->feature());
+  if (!aLine1Feature || !aLine2Feature)
+    return anAIS;
+
+  boost::shared_ptr<GeomAPI_Shape> aLine1 = aLine1Feature->preview();
+  boost::shared_ptr<GeomAPI_Shape> aLine2 = aLine2Feature->preview();
+  Handle(Geom_Plane) aPlane = new Geom_Plane(sketch()->plane()->impl<gp_Pln>());
+
+  if (anAIS.IsNull())
+  {
+    Handle(AIS_ParallelRelation) aParallel = 
+      new AIS_ParallelRelation(aLine1->impl<TopoDS_Shape>(), aLine2->impl<TopoDS_Shape>(), aPlane);
+
+    anAIS = aParallel;
+  }
+  else
+  {
+    Handle(AIS_ParallelRelation) aParallel = Handle(AIS_ParallelRelation)::DownCast(anAIS);
+    if (!aParallel.IsNull())
+    {
+      aParallel->SetFirstShape(aLine1->impl<TopoDS_Shape>());
+      aParallel->SetSecondShape(aLine2->impl<TopoDS_Shape>());
+      aParallel->SetPlane(aPlane);
+      aParallel->Redisplay(Standard_True);
+    }
+  }
+  return anAIS;
+}
+
index ac209b68fd75988661bfdccae9418d0e18234a30..eae4fcfbbcb614512f741adaadfc2f3a035c18b5 100644 (file)
@@ -39,6 +39,9 @@ public:
   /// \brief Returns the sketch preview
   SKETCHPLUGIN_EXPORT virtual const boost::shared_ptr<GeomAPI_Shape>& preview();
 
+  /// Returns the AIS preview
+  SKETCHPLUGIN_EXPORT virtual Handle_AIS_InteractiveObject getAISShape(Handle_AIS_InteractiveObject thePrevious);
+
   /// \brief Use plugin manager for features creation
   SketchPlugin_ConstraintParallel();
 };
index 85c543f2b968d79d3d7db8202a946fd200df29fb..ca5e229728e7a777f12c9e00da517b739af8ba2c 100644 (file)
@@ -6,7 +6,11 @@
 
 #include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_Data.h>
-#include <SketchPlugin_Point.h>
+#include <SketchPlugin_Line.h>
+
+#include <AIS_InteractiveObject.hxx>
+#include <AIS_PerpendicularRelation.hxx>
+#include <Geom_Plane.hxx>
 
 SketchPlugin_ConstraintPerpendicular::SketchPlugin_ConstraintPerpendicular()
 {
@@ -28,3 +32,49 @@ const boost::shared_ptr<GeomAPI_Shape>&  SketchPlugin_ConstraintPerpendicular::p
   return getPreview();
 }
 
+Handle_AIS_InteractiveObject SketchPlugin_ConstraintPerpendicular::getAISShape(Handle_AIS_InteractiveObject thePrevious)
+{
+  Handle(AIS_InteractiveObject) anAIS = thePrevious;
+  if (!sketch())
+    return anAIS;
+
+  boost::shared_ptr<ModelAPI_Data> aData = data();
+  boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttr1 = 
+    boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(aData->attribute(CONSTRAINT_ATTR_ENTITY_A));
+  boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttr2 = 
+    boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(aData->attribute(CONSTRAINT_ATTR_ENTITY_B));
+  if (!anAttr1 || !anAttr1->isFeature() || 
+      !anAttr2 || !anAttr2->isFeature())
+    return anAIS;
+  boost::shared_ptr<SketchPlugin_Line> aLine1Feature = 
+    boost::dynamic_pointer_cast<SketchPlugin_Line>(anAttr1->feature());
+  boost::shared_ptr<SketchPlugin_Line> aLine2Feature = 
+    boost::dynamic_pointer_cast<SketchPlugin_Line>(anAttr2->feature());
+  if (!aLine1Feature || !aLine2Feature)
+    return anAIS;
+
+  boost::shared_ptr<GeomAPI_Shape> aLine1 = aLine1Feature->preview();
+  boost::shared_ptr<GeomAPI_Shape> aLine2 = aLine2Feature->preview();
+  Handle(Geom_Plane) aPlane = new Geom_Plane(sketch()->plane()->impl<gp_Pln>());
+
+  if (anAIS.IsNull())
+  {
+    Handle(AIS_PerpendicularRelation) aPerpendicular = 
+      new AIS_PerpendicularRelation(aLine1->impl<TopoDS_Shape>(), aLine2->impl<TopoDS_Shape>(), aPlane);
+
+    anAIS = aPerpendicular;
+  }
+  else
+  {
+    Handle(AIS_PerpendicularRelation) aPerpendicular = Handle(AIS_PerpendicularRelation)::DownCast(anAIS);
+    if (!aPerpendicular.IsNull())
+    {
+      aPerpendicular->SetFirstShape(aLine1->impl<TopoDS_Shape>());
+      aPerpendicular->SetSecondShape(aLine2->impl<TopoDS_Shape>());
+      aPerpendicular->SetPlane(aPlane);
+      aPerpendicular->Redisplay(Standard_True);
+    }
+  }
+  return anAIS;
+}
+
index 475c330849c3c35095878230876cc22493e2cd16..68b733e8c2aa89c9243a5d321938b1d318b65fbf 100644 (file)
@@ -39,6 +39,9 @@ public:
   /// \brief Returns the sketch preview
   SKETCHPLUGIN_EXPORT virtual const boost::shared_ptr<GeomAPI_Shape>& preview();
 
+  /// Returns the AIS preview
+  SKETCHPLUGIN_EXPORT virtual Handle_AIS_InteractiveObject getAISShape(Handle_AIS_InteractiveObject thePrevious);
+
   /// \brief Use plugin manager for features creation
   SketchPlugin_ConstraintPerpendicular();
 };
index fea246b5c3f5a7e6e8e73977bb58dcb9b9522373..6f4d17670498c8bd11569408487bd4d75480541e 100644 (file)
@@ -169,7 +169,7 @@ void SketchPlugin_ConstraintRadius::move(double theDeltaX, double theDeltaY)
   if (!aData->isValid())
     return;
 
-  //boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 =
-  //      boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(CONSTRAINT_ATTR_FLYOUT_VALUE_PNT));
-  //aPoint1->setValue(aPoint1->x() + theDeltaX, aPoint1->y() + theDeltaY);
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 =
+        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(CONSTRAINT_ATTR_FLYOUT_VALUE_PNT));
+  aPoint1->setValue(aPoint1->x() + theDeltaX, aPoint1->y() + theDeltaY);
 }
index cd32b5528c18e33a311113fb28e06504751d4697..04fb5542e7ae98697a032653e51323f181e517e8 100644 (file)
@@ -1,7 +1,7 @@
 <plugin>
   <workbench id="Sketch">
     <group id="Basic">
-      <feature id="Sketch" nested="SketchPoint SketchLine SketchCircle SketchArc SketchConstraintLength SketchConstraintRadius SketchConstraintDistance SketchConstraintParallel SketchConstraintPerpendicular" title="Sketch" tooltip="Create a new sketch or edit an existing sketch" icon=":icons/sketch.png">
+      <feature id="Sketch" nested="SketchPoint SketchLine SketchCircle SketchArc SketchConstraintLength SketchConstraintRadius SketchConstraintDistance SketchConstraintParallel SketchConstraintPerpendicular SketchConstraintCoincidence" title="Sketch" tooltip="Create a new sketch or edit an existing sketch" icon=":icons/sketch.png">
         <label title="Select a plane on which to create a sketch" tooltip="Select a plane on which to create a sketch"/> 
       <!--icon=":pictures/x_point.png"-->
       </feature>
         <point_selector id="ArcStartPoint" title="Start point" tooltip="Start point of the arc"/>
         <point_selector id="ArcEndPoint" title="End point" tooltip="End point of the arc"/>
       </feature>
-      <feature id="SketchConstraintCoincidence" title="Points coincidence" tooltip="Create constraint for the coincidence of two points" internal="1"/>
-      <feature id="SketchConstraintDistance" title="Distance between objects" tooltip="Create constraint for the distance from a point to an object">
+      <feature id="SketchConstraintCoincidence" title="Coincident" tooltip="Create constraint for the coincidence of two points">
+        <label title="Select two points to become coincident" tooltip="Select two points to become coincident"/>
+        <feature_selector id="ConstraintEntityA" label="First point" tooltip="Select an entity in the viewer" keysequence="SketchPoint"/>
+        <feature_selector id="ConstraintEntityB" label="Last point" tooltip="Select an entity in the viewer" keysequence="SketchPoint"/>
+      </feature>
+      <feature id="SketchConstraintDistance" title="Distance" tooltip="Create constraint for the distance from a point to an object">
         <label title="Select point and another feature (point or point on line) between which to calculate distance" tooltip="Select point and another feature (point or point on line) between which to calculate distance"/>
         <feature_selector id="ConstraintEntityA" label="First point" tooltip="Select an entity in the viewer" keysequence="SketchPoint"/>
         <feature_selector id="ConstraintEntityB" label="Last point" tooltip="Select an entity in the viewer" keysequence="SketchPoint"/>
         <point_selector id="ConstraintFlyoutValuePnt" internal="1"/>
-        <doublevalue_editor id="ConstraintValue"/>
+        <doublevalue_editor label="Value" tooltip="Constraint value" id="ConstraintValue"/>
       </feature>
-      <feature id="SketchConstraintLength" title="Length of a line" tooltip="Create constraint for the given length of a line segment">
+      <feature id="SketchConstraintLength" title="Length" tooltip="Create constraint for the given length of a line segment">
         <label title="Select a line entity on which to calculate lenght" tooltip="Select a line entity on which to calculate lenght"/>
         <feature_selector id="ConstraintEntityA" label="Line" tooltip="Select an entity in the viewer" keysequence="SketchLine"/>
         <point_selector id="ConstraintFlyoutValuePnt" internal="1"/>
-        <doublevalue_editor id="ConstraintValue"/>
+        <doublevalue_editor label="Value" tooltip="Constraint value" id="ConstraintValue"/>
       </feature>
-      <feature id="SketchConstraintRadius" title="Radius of a circle or an arc" tooltip="Create constraint for the given radius of a circle or an arc">
+      <feature id="SketchConstraintRadius" title="Radius" tooltip="Create constraint for the given radius of a circle or an arc">
         <label title="Select two points on a circle or an arc of circle on which to calculate radius" tooltip="Select two points on a circle or an arc of circle on which to calculate radius"/>
         <feature_selector id="ConstraintEntityA" label="Circle or Arc" tooltip="Select an entity in the viewer" keysequence="SketchCircle SketchArc"/>
         <point_selector id="ConstraintFlyoutValuePnt" internal="1"/>
-        <doublevalue_editor id="ConstraintValue"/>
+        <doublevalue_editor label="Value" tooltip="Constraint value" id="ConstraintValue"/>
       </feature>
-      <feature id="SketchConstraintParallel" title="Parallelism of a lines" tooltip="Create constraint defining two parallel lines">
+      <feature id="SketchConstraintParallel" title="Parallel" tooltip="Create constraint defining two parallel lines">
         <feature_selector id="ConstraintEntityA" label="First line" tooltip="Select an entity in the viewer" keysequence="SketchLine"/>
         <feature_selector id="ConstraintEntityB" label="Last line" tooltip="Select an entity in the viewer" keysequence="SketchLine"/>
       </feature>
-      <feature id="SketchConstraintPerpendicular" title="Orthgonality of a lines" tooltip="Create constraint defining two perpendicular lines">
+      <feature id="SketchConstraintPerpendicular" title="Perpendicular" tooltip="Create constraint defining two perpendicular lines">
         <feature_selector id="ConstraintEntityA" label="First line" tooltip="Select an entity in the viewer" keysequence="SketchLine"/>
         <feature_selector id="ConstraintEntityB" label="Last line" tooltip="Select an entity in the viewer" keysequence="SketchLine"/>
       </feature>
index 0676bd58c6faf2a0b30803007f2cc0da08121245..d54915677b9f3ceffc9560e94fd574e6e9440145 100644 (file)
@@ -209,11 +209,17 @@ bool SketchSolver_ConstraintGroup::changeConstraint(
   {
     // Several points may be coincident, it is not necessary to store all constraints between them.
     // Try to find sequence of coincident points which connects the points of new constraint
-    if (aConstrType == SLVS_C_POINTS_COINCIDENT &&
-        !addCoincidentPoints(aConstrEnt[0], aConstrEnt[1]))
+    if (aConstrType == SLVS_C_POINTS_COINCIDENT)
     {
-      myExtraCoincidence.insert(theConstraint); // the constraint is stored for further purposes
-      return false;
+      if (aConstrEnt[0] == aConstrEnt[1]) // no need to add self coincidence
+      {
+        return false;
+      }
+      if (!addCoincidentPoints(aConstrEnt[0], aConstrEnt[1]))
+      {
+        myExtraCoincidence.insert(theConstraint); // the constraint is stored for further purposes
+        return false;
+      }
     }
 
     // Create SolveSpace constraint structure
index 69d071480327133372d9d3be5282f5f438a8baf1..767e0dfcc8b1682dab0140468572ede859ee1cea 100644 (file)
@@ -97,6 +97,9 @@ void XGUI_PropertyPanel::setModelWidgets(const QList<ModuleBase_ModelWidget*>& t
       connect(*anIt, SIGNAL(focusOutWidget(ModuleBase_ModelWidget*)),
               this, SLOT(onActivateNextWidget(ModuleBase_ModelWidget*)));
 
+      connect(*anIt, SIGNAL(activated(ModuleBase_ModelWidget*)),
+              this, SIGNAL(widgetActivated(ModuleBase_ModelWidget*)));
+
       ModuleBase_WidgetPoint2D* aPointWidget = dynamic_cast<ModuleBase_WidgetPoint2D*>(*anIt);
       if (aPointWidget)
         connect(aPointWidget, SIGNAL(storedPoint2D(FeaturePtr, const std::string&)),
@@ -115,10 +118,7 @@ void XGUI_PropertyPanel::setModelWidgets(const QList<ModuleBase_ModelWidget*>& t
         setTabOrder(anOkBtn, aCancelBtn);
       }
     }
-    ModuleBase_ModelWidget* aWidget = theWidgets.first();
-    if (aWidget) {
-      activateWidget(aWidget);
-    }
+    onActivateNextWidget(0);
   }
 }
 
@@ -158,50 +158,20 @@ void XGUI_PropertyPanel::updateContentWidget(FeaturePtr theFeature)
   repaint();
 }
 
-void XGUI_PropertyPanel::onFocusActivated(const std::string& theAttributeName)
-{
-  if (theAttributeName == XGUI::PROP_PANEL_OK) {
-    QPushButton* aBtn = findChild<QPushButton*>(XGUI::PROP_PANEL_OK);
-    aBtn->setFocus();
-  }
-  if (theAttributeName == XGUI::PROP_PANEL_CANCEL) {
-    QPushButton* aBtn = findChild<QPushButton*>(XGUI::PROP_PANEL_CANCEL);
-    aBtn->setFocus();
-  }
-  else {
-    foreach(ModuleBase_ModelWidget* eachWidget, myWidgets) {
-      if (eachWidget->canFocusTo(theAttributeName)) {
-        eachWidget->focusTo();
-        break;
-      }
-    }
-  }
-}
-
 void XGUI_PropertyPanel::onActivateNextWidget(ModuleBase_ModelWidget* theWidget)
 {
   ModuleBase_ModelWidget* aNextWidget = 0;
-
   QList<ModuleBase_ModelWidget*>::const_iterator anIt = myWidgets.begin(),
                                                  aLast = myWidgets.end();
-  for (;anIt != aLast; anIt++)
+  bool isFoundWidget = false;
+  for (;anIt != aLast && !aNextWidget; anIt++)
   {
-    if ((*anIt) == theWidget) {
-      anIt++;
-      if (anIt != aLast)
+    if (isFoundWidget || !theWidget) {
+      if ((*anIt)->focusTo()) {
         aNextWidget = *anIt;
-      break;
+      }
     }
+    isFoundWidget = (*anIt) == theWidget;
   }
-  activateWidget(aNextWidget);
-}
-
-void XGUI_PropertyPanel::activateWidget(ModuleBase_ModelWidget* theWidget)
-{
-  emit widgetActivated(theWidget);
-  // it is important that the signal widgetActivated goes before the focusTo() calling
-  // in order to handle next possible signal in the focusTo() method
-  // (e.g. the widget editor sends a signal about the widget deactivation)
-  if (theWidget)
-    theWidget->focusTo();
+  emit widgetActivated(aNextWidget);
 }
index 764575dd89889451eeb7ed50205f3cb1c48541e3..74c3c5fba03fbd2186504843b60f7249686b2ee1 100644 (file)
@@ -36,9 +36,6 @@ protected:
 
 public slots:
   void updateContentWidget(FeaturePtr theFeature);
-  /// slot to set the focus to the widget visualized an attribute with the given name
-  /// \param theAttributteName
-  void onFocusActivated(const std::string& theAttributeName);
   /// slot to activate the next widget in the property panel
   /// \param theWidget a widget. The next widget should be activated
   void onActivateNextWidget(ModuleBase_ModelWidget* theWidget);
@@ -57,12 +54,6 @@ signals:
   /// \param the attribute of the feature
   void storedPoint2D(FeaturePtr theFeature, const std::string& theAttribute);
 
-protected:
-  /// Activate the widget, which means the focus on the widget.
-  /// The signal about the widget activation is emitted
-  /// \param theWidget
-  void activateWidget(ModuleBase_ModelWidget* theWidget);
-
 private:
   QWidget* myCustomWidget;