Salome HOME
Boost has been removed from code
[modules/shaper.git] / src / PartSet / PartSet_OperationSketchBase.cpp
index d90de1d2902bfa87aa78305a1f297c36cb329ab7..310658e9b317d2f37fb77bac03014f0687e6e0ed 100644 (file)
@@ -6,6 +6,11 @@
 #include <PartSet_Tools.h>
 #include <ModelAPI_ResultBody.h>
 
+#include <ModuleBase_IPropertyPanel.h>
+#include <ModuleBase_IViewer.h>
+#include <ModuleBase_ModelWidget.h>
+#include <ModuleBase_WidgetValueFeature.h>
+
 #include <SketchPlugin_Feature.h>
 #include <V3d_View.hxx>
 #include <AIS_Shape.hxx>
@@ -30,17 +35,17 @@ PartSet_OperationSketchBase::~PartSet_OperationSketchBase()
 {
 }
 
-boost::shared_ptr<GeomAPI_Shape> PartSet_OperationSketchBase::preview(FeaturePtr theFeature)
+std::shared_ptr<GeomAPI_Shape> PartSet_OperationSketchBase::preview(FeaturePtr theFeature)
 {
-  boost::shared_ptr<SketchPlugin_Feature> aFeature = boost::dynamic_pointer_cast<
+  std::shared_ptr<SketchPlugin_Feature> aFeature = std::dynamic_pointer_cast<
       SketchPlugin_Feature>(theFeature);
   if (aFeature) {
     ResultPtr aRes = aFeature->firstResult();
-    ResultBodyPtr aBody = boost::dynamic_pointer_cast<ModelAPI_ResultBody>(aRes);
+    ResultBodyPtr aBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aRes);
     if (aBody)
       return aBody->shape();
   }
-  return boost::shared_ptr<GeomAPI_Shape>();
+  return std::shared_ptr<GeomAPI_Shape>();
 }
 
 std::list<FeaturePtr> PartSet_OperationSketchBase::subFeatures() const
@@ -48,24 +53,6 @@ std::list<FeaturePtr> PartSet_OperationSketchBase::subFeatures() const
   return std::list<FeaturePtr>();
 }
 
-std::list<int> PartSet_OperationSketchBase::getSelectionModes(ObjectPtr theFeature) const
-{
-  std::list<int> aModes;
-  //FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(theFeature);
-  //if (aFeature) {
-  //  if (PartSet_Tools::isConstraintFeature(aFeature->getKind())) {
-  //      aModes.clear();
-  //      aModes.push_back(AIS_DSM_Text);
-  //      aModes.push_back(AIS_DSM_Line);
-  //      return aModes;
-  //  }
-  //}
-  aModes.push_back(AIS_Shape::SelectionMode((TopAbs_ShapeEnum) TopAbs_VERTEX));
-  aModes.push_back(AIS_Shape::SelectionMode((TopAbs_ShapeEnum) TopAbs_EDGE));
-  aModes.push_back(AIS_DSM_Text);
-  aModes.push_back(AIS_DSM_Line);
-  return aModes;
-}
 FeaturePtr PartSet_OperationSketchBase::createFeature(const bool theFlushMessage)
 {
   ModuleBase_Operation::createFeature(theFlushMessage);
@@ -74,55 +61,38 @@ FeaturePtr PartSet_OperationSketchBase::createFeature(const bool theFlushMessage
   return myFeature;
 }
 
-void PartSet_OperationSketchBase::mousePressed(
-    QMouseEvent* theEvent, Handle_V3d_View theView,
-    const std::list<ModuleBase_ViewerPrs>& theSelected,
-    const std::list<ModuleBase_ViewerPrs>& theHighlighted)
+void PartSet_OperationSketchBase::mousePressed(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer, ModuleBase_ISelection* theSelection)
 {
 }
 void PartSet_OperationSketchBase::mouseReleased(
-    QMouseEvent* theEvent, Handle_V3d_View theView,
-    const std::list<ModuleBase_ViewerPrs>& theSelected,
-    const std::list<ModuleBase_ViewerPrs>& theHighlighted)
+    QMouseEvent* theEvent, ModuleBase_IViewer* theViewer,
+    ModuleBase_ISelection* theSelection)
 {
 }
-void PartSet_OperationSketchBase::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) theView)
+void PartSet_OperationSketchBase::mouseMoved(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer)
 {
 }
 void PartSet_OperationSketchBase::mouseDoubleClick(
     QMouseEvent* theEvent, Handle_V3d_View theView,
-    const std::list<ModuleBase_ViewerPrs>& theSelected,
-    const std::list<ModuleBase_ViewerPrs>& theHighlighted)
+    ModuleBase_ISelection* theSelection)
 {
 }
 
-void PartSet_OperationSketchBase::keyReleased(const int theKey)
+void PartSet_OperationSketchBase::selectionChanged(ModuleBase_ISelection* theSelection)
 {
-  switch (theKey) {
-    case Qt::Key_Escape: {
-      bool toAbort = true;
-      if (isModified()) {
-        int anAnswer = QMessageBox::question(
-            qApp->activeWindow(), tr("Cancel operation"),
-            tr("Operation %1 will be cancelled. Continue?").arg(id()), QMessageBox::Yes,
-            QMessageBox::No);
-        toAbort = (anAnswer == QMessageBox::Yes);
-      }
-      if (toAbort)
-        abort();
-    }
-      break;
-    default:
-      break;
-  }
-}
-
-void PartSet_OperationSketchBase::keyReleased(std::string theName, QKeyEvent* theEvent)
-{
-  keyReleased(theEvent->key());
 }
 
 void PartSet_OperationSketchBase::restartOperation(const std::string& theType, ObjectPtr theFeature)
 {
-  emit launchOperation(theType, theFeature);
+  FeaturePtr aFeature = ModelAPI_Feature::feature(theFeature);
+  if (aFeature) {
+    QStringList aNested = this->nestedFeatures();
+    if (!aNested.isEmpty()) {
+      if (!aNested.contains(QString(aFeature->getKind().c_str())))
+        return;
+    }
+  }
+  emit restartRequired(theType, theFeature);
 }
+
+