]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2024: Redesign of circle and arc of circle
authordbv <dbv@opencascade.com>
Mon, 27 Mar 2017 13:32:15 +0000 (16:32 +0300)
committerdbv <dbv@opencascade.com>
Mon, 27 Mar 2017 13:33:39 +0000 (16:33 +0300)
Removed unused widget.

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

index 3793d26af3cedf97e975bf6435939841bb201f13..8dee08d11edbdb8089095c487af4e2c96491642b 100644 (file)
@@ -34,7 +34,6 @@ SET(PROJECT_HEADERS
     PartSet_WidgetFileSelector.h
     PartSet_WidgetMultiSelector.h
     PartSet_WidgetPoint2d.h
-    PartSet_WidgetPoint2dDistance.h
     PartSet_WidgetPoint2DFlyout.h
     PartSet_WidgetShapeSelector.h
     PartSet_WidgetSketchCreator.h
@@ -54,7 +53,6 @@ SET(PROJECT_MOC_HEADERS
     PartSet_WidgetFileSelector.h
     PartSet_WidgetMultiSelector.h
     PartSet_WidgetPoint2d.h
-    PartSet_WidgetPoint2dDistance.h
     PartSet_WidgetPoint2DFlyout.h
     PartSet_WidgetShapeSelector.h
     PartSet_WidgetSketchCreator.h
@@ -83,7 +81,6 @@ SET(PROJECT_SOURCES
     PartSet_WidgetFileSelector.cpp
     PartSet_WidgetMultiSelector.cpp
     PartSet_WidgetPoint2d.cpp
-    PartSet_WidgetPoint2dDistance.cpp
     PartSet_WidgetPoint2DFlyout.cpp
     PartSet_WidgetShapeSelector.cpp
     PartSet_WidgetSketchCreator.cpp
index 67b4adf8539c41ef39681973a6ef60ab8de6255d..e7e7e8fa487f6dcbe35914be6d531f8baf0a6966 100755 (executable)
@@ -6,7 +6,6 @@
 #include "PartSet_Tools.h"
 #include "PartSet_PreviewPlanes.h"
 #include "PartSet_WidgetPoint2d.h"
-#include "PartSet_WidgetPoint2dDistance.h"
 #include "PartSet_WidgetPoint2DFlyout.h"
 #include "PartSet_WidgetShapeSelector.h"
 #include "PartSet_WidgetMultiSelector.h"
@@ -716,11 +715,6 @@ ModuleBase_ModelWidget* PartSet_Module::createWidgetByType(const std::string& th
     aPointWgt->setSketch(mySketchMgr->activeSketch());
     connect(aPointWgt, SIGNAL(vertexSelected()), sketchReentranceMgr(), SLOT(onVertexSelected()));
     aWgt = aPointWgt;
-  } else if (theType == "point2ddistance") {
-    PartSet_WidgetPoint2dDistance* aDistanceWgt = new PartSet_WidgetPoint2dDistance(theParent,
-                                                                     aWorkshop, theWidgetApi);
-    aDistanceWgt->setSketch(mySketchMgr->activeSketch());
-    aWgt = aDistanceWgt;
   } else if (theType == "sketch_shape_selector") {
     PartSet_WidgetShapeSelector* aShapeSelectorWgt =
                           new PartSet_WidgetShapeSelector(theParent, aWorkshop, theWidgetApi);
diff --git a/src/PartSet/PartSet_WidgetPoint2dDistance.cpp b/src/PartSet/PartSet_WidgetPoint2dDistance.cpp
deleted file mode 100644 (file)
index b87b470..0000000
+++ /dev/null
@@ -1,209 +0,0 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:        PartSet_WidgetPoint2dDistance.cpp
-// Created:     23 June 2014
-// Author:      Vitaly Smetannikov
-
-#include "PartSet_WidgetPoint2dDistance.h"
-#include "PartSet_Tools.h"
-
-#include <XGUI_Tools.h>
-#include <XGUI_Workshop.h>
-#include <XGUI_Displayer.h>
-
-#include <ModuleBase_ParamSpinBox.h>
-#include <ModuleBase_IWorkshop.h>
-#include <ModuleBase_IViewWindow.h>
-#include <ModuleBase_IViewer.h>
-#include <ModuleBase_Tools.h>
-#include <ModuleBase_WidgetValidator.h>
-#include <ModuleBase_LabelValue.h>
-
-#include <GeomAPI_Pnt2d.h>
-#include <Config_WidgetAPI.h>
-#include <GeomDataAPI_Point2D.h>
-
-#include <ModelAPI_Data.h>
-#include <ModelAPI_AttributeDouble.h>
-
-#include <QMouseEvent>
-
-PartSet_WidgetPoint2dDistance::PartSet_WidgetPoint2dDistance(QWidget* theParent,
-                                                             ModuleBase_IWorkshop* theWorkshop,
-                                                             const Config_WidgetAPI* theData)
-: ModuleBase_WidgetLabelValue(theParent, theData), myWorkshop(theWorkshop),
-  myValueIsCashed(false), myIsFeatureVisibleInCash(true), myValueInCash(0)
-{
-  myFirstPntName = theData->getProperty("first_point");
-  myWidgetValidator = new ModuleBase_WidgetValidator(this, myWorkshop);
-}
-
-PartSet_WidgetPoint2dDistance::~PartSet_WidgetPoint2dDistance()
-{
-}
-
-bool PartSet_WidgetPoint2dDistance::isValidSelectionCustom(
-                                      const std::shared_ptr<ModuleBase_ViewerPrs>& theValue)
-{
-  return false;
-}
-
-bool PartSet_WidgetPoint2dDistance::resetCustom()
-{
-  bool aDone = false;
-  if (!isUseReset() || isComputedDefault() /*|| mySpinBox->hasVariable()*/) {
-    aDone = false;
-  }
-  else {
-    if (myValueIsCashed) {
-      // if the restored value should be hidden, aDone = true to set
-      // reset state for the widget in the parent
-      aDone = restoreCurentValue();
-      emit objectUpdated();
-    }
-    else {
-      bool isOk;
-      double aDefValue = QString::fromStdString(getDefaultValue()).toDouble(&isOk);
-      // it is important to block the spin box control in order to do not through out the
-      // locking of the validating state.
-      myLabel->setValue(isOk ? aDefValue : 0.0);
-      storeValue();
-      aDone = true;
-    }
-  }
-  return aDone;
-}
-
-void PartSet_WidgetPoint2dDistance::setPoint(FeaturePtr theFeature,
-                                             const std::shared_ptr<GeomAPI_Pnt2d>& thePnt)
-{
-  std::shared_ptr<ModelAPI_Data> aData = theFeature->data();
-  std::shared_ptr<GeomDataAPI_Point2D> aPoint = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-      aData->attribute(myFirstPntName));
-  if (!aPoint)
-    return;
-
-  double aValue = computeValue(aPoint->pnt(), thePnt);
-  AttributeDoublePtr aReal = aData->real(attributeID());
-  if (aReal && (aReal->value() != aValue)) {
-    aReal->setValue(aValue);
-
-    myLabel->setValue(aValue);
-    storeValue();
-  }
-}
-
-double PartSet_WidgetPoint2dDistance::computeValue(
-                              const std::shared_ptr<GeomAPI_Pnt2d>& theFirstPnt,
-                              const std::shared_ptr<GeomAPI_Pnt2d>& theCurrentPnt)
-{
-  return theCurrentPnt->distance(theFirstPnt);
-}
-
-void PartSet_WidgetPoint2dDistance::mouseReleased(ModuleBase_IViewWindow* theWnd,
-                                                  QMouseEvent* theEvent)
-{
-  // the contex menu release by the right button should not be processed by this widget
-  if (theEvent->button() != Qt::LeftButton)
-    return;
-
-  //if (mySpinBox->hasVariable())
-  //  return;
-
-  gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), theWnd->v3dView());
-
-  double aX, aY;
-  PartSet_Tools::convertTo2D(aPoint, mySketch, theWnd->v3dView(), aX, aY);
-
-  std::shared_ptr<GeomAPI_Pnt2d> aPnt = std::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(aX, aY));
-  setPoint(feature(), aPnt);
-
-  // if the validator of the control returns false, focus should not be switched
-  if (getError(false).isEmpty())
-    emit focusOutWidget(this);
-}
-
-void PartSet_WidgetPoint2dDistance::mouseMoved(ModuleBase_IViewWindow* theWnd,
-                                               QMouseEvent* theEvent)
-{
-  if (isEditingMode())
-    return;
-
-  //if (mySpinBox->hasVariable())
-  //  return;
-
-  gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), theWnd->v3dView());
-
-  double aX, aY;
-  PartSet_Tools::convertTo2D(aPoint, mySketch, theWnd->v3dView(), aX, aY);
-
-  std::shared_ptr<GeomAPI_Pnt2d> aPnt = std::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(aX, aY));
-  if (myState != ModifiedInViewer)
-    storeCurentValue();
-
-  bool isBlocked = blockValueState(true);
-  setPoint(feature(), aPnt);
-  blockValueState(isBlocked);
-  setValueState(ModifiedInViewer);
-}
-
-void PartSet_WidgetPoint2dDistance::storeCurentValue()
-{
-  // do not use cash if a variable is used
-  //if (mySpinBox->hasVariable())
-  //  return;
-
-  myValueIsCashed = true;
-  myIsFeatureVisibleInCash = XGUI_Displayer::isVisible(
-                       XGUI_Tools::workshop(myWorkshop)->displayer(), myFeature);
-  myValueInCash = myLabel->value();
-}
-
-bool PartSet_WidgetPoint2dDistance::restoreCurentValue()
-{
-  bool aRestoredAndHidden = true;
-
-  bool isVisible = myIsFeatureVisibleInCash;
-  // fill the control widgets by the cashed value
-
-  myValueIsCashed = false;
-  myIsFeatureVisibleInCash = true;
-  myLabel->setValue(myValueInCash);
-
-  // store value to the model
-  storeValueCustom();
-  if (isVisible) {
-    setValueState(Stored);
-    aRestoredAndHidden = false;
-  }
-  else
-    aRestoredAndHidden = true;
-
-  return aRestoredAndHidden;
-}
-
-bool PartSet_WidgetPoint2dDistance::processEnter()
-{
-  return false;
-  /*
-  bool isModified = getValueState() == ModifiedInPP;
-  if (isModified) {
-    emit valuesChanged();
-    //mySpinBox->selectAll();
-  }
-  return isModified;*/
-}
-
-bool PartSet_WidgetPoint2dDistance::storeValueCustom()
-{
-  std::shared_ptr<ModelAPI_Data> aData = myFeature->data();
-  if (!aData) // can be on abort of sketcher element
-    return false;
-  AttributeDoublePtr anAttribute = myFeature->data()->real(attributeID());
-  anAttribute->setValue(myLabel->value());
-
-  // after movement the solver will call the update event: optimization
-  updateObject(myFeature);
-
-  return true;
-}
diff --git a/src/PartSet/PartSet_WidgetPoint2dDistance.h b/src/PartSet/PartSet_WidgetPoint2dDistance.h
deleted file mode 100644 (file)
index 0ad39f0..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:        PartSet_WidgetPoint2dDistance.h
-// Created:     23 June 2014
-// Author:      Vitaly Smetannikov
-
-#ifndef PartSet_WidgetPoint2dDistance_H
-#define PartSet_WidgetPoint2dDistance_H
-
-#include "PartSet.h"
-#include "PartSet_MouseProcessor.h"
-
-#include <ModuleBase_WidgetLabelValue.h>
-
-#include <ModelAPI_CompositeFeature.h>
-
-class GeomAPI_Pnt2d;
-class ModuleBase_IWorkshop;
-class ModuleBase_IViewWindow;
-class QMouseEvent;
-
-/**
-* \ingroup Modules
-* Implementation of model widget for widget which provides input of a distance between two points
-* In XML file can be defined as following:
-* \code
-* <point2ddistance id="CircleRadius" 
-*   first_point="CircleCenter" 
-*   label="Radius:" 
-*   min="0" 
-*   step="1.0" 
-*   default="0" 
-*   icon=":icons/radius.png" 
-*   tooltip="Set radius">
-*   <validator id="GeomValidators_Positive"/>
-* </point2ddistance>
-* \endcode
-*/ 
-class PARTSET_EXPORT PartSet_WidgetPoint2dDistance : public ModuleBase_WidgetLabelValue,
-                                                     public PartSet_MouseProcessor
-{
-Q_OBJECT
- public:
-  /// Constructor
-  /// \param theParent the parent object
-  /// \param theWorkshop a current workshop
-  /// \param theData the widget configuation. The attribute of the model widget is obtained from
-  PartSet_WidgetPoint2dDistance(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop,
-                                const Config_WidgetAPI* theData);
-
-  virtual ~PartSet_WidgetPoint2dDistance();
-
-  /// Checks if the selection presentation is valid in widget
-  /// \param theValue a selected presentation in the view
-  /// \return a boolean value
-  virtual bool isValidSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& theValue);
-
-  /// \returns the sketch instance
-  CompositeFeaturePtr sketch() const { return mySketch; }
-
-  /// Set sketch instance
-  void setSketch(CompositeFeaturePtr theSketch) { mySketch = theSketch; }
-
-  /// Returns true if the event is processed.
-  virtual bool processEnter();
-
-  /// Processing the mouse move event in the viewer
-  /// \param theWindow a view window
-  /// \param theEvent a mouse event
-  virtual void mouseMoved(ModuleBase_IViewWindow* theWindow, QMouseEvent* theEvent);
-
-  /// Processing the mouse release event in the viewer
-  /// \param theWindow a view window
-  /// \param theEvent a mouse event
-  virtual void mouseReleased(ModuleBase_IViewWindow* theWindow, QMouseEvent* theEvent);
-
-protected:
-  /// Store current value in cashed value
-  void storeCurentValue();
-
-  /// Restore cashed value in the model attribute
-  /// \return boolean state if the restored feature shoud be hidden
-  bool restoreCurentValue();
-
-  /// Fills the widget with default values
-  /// \return true if the widget current value is reset
-  virtual bool resetCustom();
-
-  /// Set the second point which defines a value in the widget as
-  /// a distance with a first point defined by feature
-  void setPoint(FeaturePtr theFeature, const std::shared_ptr<GeomAPI_Pnt2d>& thePnt);
-
-  /// Compute the distance between points
-  /// \param theFirstPnt a point value of the out point attribute
-  /// \param theCurrentPnt a point of the current widget
-  /// \return a double value
-  virtual double computeValue(const std::shared_ptr<GeomAPI_Pnt2d>& theFirstPnt,
-                              const std::shared_ptr<GeomAPI_Pnt2d>& theCurrentPnt);
-
-  /// Saves the internal parameters to the given feature
-  /// \return True in success
-  virtual bool storeValueCustom();
-
-protected:
-  /// A reference to workshop
-  ModuleBase_IWorkshop* myWorkshop;
-
-  /// A name of the first point
-  std::string myFirstPntName;
-
-  /// Reference to sketch
-  CompositeFeaturePtr mySketch;
-
-  bool myValueIsCashed; ///< boolean state if the value is cashed during value state change
-  bool myIsFeatureVisibleInCash; ///< boolean value if the feature was visible when cash if filled
-  double myValueInCash; ///< the cashed X value during value state change
-};
-
-#endif