Salome HOME
Restore old planes selection definition
[modules/shaper.git] / src / PartSet / PartSet_OperationFeatureEditMulti.cpp
index 89928ccded1b616101be1a0add75ccd01a8a95c2..b08818ec7442a41cb8a9c8694fa42ea7ec1f230e 100644 (file)
@@ -7,16 +7,16 @@
 #include <PartSet_OperationSketch.h>
 
 #include <ModuleBase_OperationDescription.h>
-#include <Model_Events.h>
+#include <ModuleBase_ViewerPrs.h>
 
-#include <XGUI_ViewerPrs.h>
+#include <ModelAPI_Events.h>
 
 #include <SketchPlugin_Feature.h>
 #include <GeomDataAPI_Point2D.h>
 #include <ModelAPI_Data.h>
 #include <ModelAPI_Document.h>
 
-#include <Model_Events.h>
+#include <ModelAPI_Events.h>
 
 #include <Events_Loop.h>
 
@@ -48,8 +48,8 @@ bool PartSet_OperationFeatureEditMulti::isGranted(ModuleBase_IOperation* theOper
   return theOperation->getDescription()->operationId().toStdString() == PartSet_OperationSketch::Type();
 }
 
-void PartSet_OperationFeatureEditMulti::initSelection(const std::list<XGUI_ViewerPrs>& theSelected,
-                                                      const std::list<XGUI_ViewerPrs>& theHighlighted)
+void PartSet_OperationFeatureEditMulti::initSelection(const std::list<ModuleBase_ViewerPrs>& theSelected,
+                                                      const std::list<ModuleBase_ViewerPrs>& theHighlighted)
 {
   if (!theHighlighted.empty()) {
     // if there is highlighted object, we check whether it is in the list of selected objects
@@ -57,10 +57,11 @@ void PartSet_OperationFeatureEditMulti::initSelection(const std::list<XGUI_Viewe
     // the hightlighted object should moved and the selection is skipped. The skipped selection will be
     // deselected in the viewer by blockSelection signal in the startOperation method.
     bool isSelected = false;
-    std::list<XGUI_ViewerPrs>::const_iterator anIt = theSelected.begin(), aLast = theSelected.end();
-    for (; anIt != aLast && !isSelected; anIt++) {
+    std::list<ModuleBase_ViewerPrs>::const_iterator anIt = theSelected.begin(), aLast = theSelected.end();
+    // TODO
+    /*for (; anIt != aLast && !isSelected; anIt++) {
       isSelected = (*anIt).feature() == feature();
-    }
+    }*/
     if (!isSelected)
       myFeatures = theHighlighted;
     else
@@ -81,8 +82,8 @@ FeaturePtr PartSet_OperationFeatureEditMulti::sketch() const
 }
 
 void PartSet_OperationFeatureEditMulti::mousePressed(QMouseEvent* theEvent, Handle(V3d_View) theView,
-                                             const std::list<XGUI_ViewerPrs>& /*theSelected*/,
-                                             const std::list<XGUI_ViewerPrs>& theHighlighted)
+                                             const std::list<ModuleBase_ViewerPrs>& /*theSelected*/,
+                                             const std::list<ModuleBase_ViewerPrs>& theHighlighted)
 {
 }
 
@@ -108,14 +109,15 @@ void PartSet_OperationFeatureEditMulti::mouseMoved(QMouseEvent* theEvent, Handle
                            boost::dynamic_pointer_cast<SketchPlugin_Feature>(feature());
     aSketchFeature->move(aDeltaX, aDeltaY);
 
-    std::list<XGUI_ViewerPrs>::const_iterator anIt = myFeatures.begin(), aLast = myFeatures.end();
-    for (; anIt != aLast; anIt++) {
+    std::list<ModuleBase_ViewerPrs>::const_iterator anIt = myFeatures.begin(), aLast = myFeatures.end();
+    // TODO
+    /*for (; anIt != aLast; anIt++) {
       FeaturePtr aFeature = (*anIt).feature();
       if (!aFeature || aFeature == feature())
         continue;
       aSketchFeature = boost::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
       aSketchFeature->move(aDeltaX, aDeltaY);
-    }
+    }*/
   }
   sendFeatures();
 
@@ -123,18 +125,19 @@ void PartSet_OperationFeatureEditMulti::mouseMoved(QMouseEvent* theEvent, Handle
 }
 
 void PartSet_OperationFeatureEditMulti::mouseReleased(QMouseEvent* theEvent, Handle(V3d_View) theView,
-                                              const std::list<XGUI_ViewerPrs>& /*theSelected*/,
-                                              const std::list<XGUI_ViewerPrs>& /*theHighlighted*/)
+                                              const std::list<ModuleBase_ViewerPrs>& /*theSelected*/,
+                                              const std::list<ModuleBase_ViewerPrs>& /*theHighlighted*/)
 {
-  std::list<XGUI_ViewerPrs> aFeatures = myFeatures;
+  std::list<ModuleBase_ViewerPrs> aFeatures = myFeatures;
   commit();
-  std::list<XGUI_ViewerPrs>::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end();
-  for (; anIt != aLast; anIt++) {
+  std::list<ModuleBase_ViewerPrs>::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end();
+  // TODO
+  /*for (; anIt != aLast; anIt++) {
     FeaturePtr aFeature = (*anIt).feature();
     if (aFeature) {
       emit featureConstructed(aFeature, FM_Deactivation);
        }
-  }
+  }*/
 }
 
 void PartSet_OperationFeatureEditMulti::startOperation()
@@ -162,13 +165,13 @@ void PartSet_OperationFeatureEditMulti::blockSelection(bool isBlocked, const boo
     return;
 
   myIsBlockedSelection = isBlocked;
-  QFeatureList aFeatureList;
-  std::list<XGUI_ViewerPrs>::const_iterator anIt = myFeatures.begin(),
+  QList<ObjectPtr> aFeatureList;
+  std::list<ModuleBase_ViewerPrs>::const_iterator anIt = myFeatures.begin(),
                                             aLast = myFeatures.end();
-  for(; anIt != aLast; anIt++)
-    aFeatureList.append((*anIt).feature());
+  /*for(; anIt != aLast; anIt++)
+    aFeatureList.append((*anIt).feature());*/
   if (isBlocked) {
-    emit setSelection(QFeatureList());
+    emit setSelection(QList<ObjectPtr>());
     emit stopSelection(aFeatureList, true);
   }
   else {
@@ -181,18 +184,18 @@ void PartSet_OperationFeatureEditMulti::blockSelection(bool isBlocked, const boo
 
 void PartSet_OperationFeatureEditMulti::sendFeatures()
 {
-  static Events_ID anEvent = Events_Loop::eventByName(EVENT_FEATURE_MOVED);
+  static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_MOVED);
 
   std::list<FeaturePtr > aFeatures;
-  std::list<XGUI_ViewerPrs>::const_iterator anIt = myFeatures.begin(), aLast = myFeatures.end();
-  for (; anIt != aLast; anIt++) {
+  std::list<ModuleBase_ViewerPrs>::const_iterator anIt = myFeatures.begin(), aLast = myFeatures.end();
+  // TODO
+  /*for (; anIt != aLast; anIt++) {
     FeaturePtr aFeature = (*anIt).feature();
     if (!aFeature)
       continue;
 
-    Model_FeatureUpdatedMessage aMessage(aFeature, anEvent);
-    Events_Loop::loop()->send(aMessage);
-  }
+    ModelAPI_EventCreator::get()->sendUpdated(aFeature, anEvent);
+  }*/
   Events_Loop::loop()->flush(anEvent);
   flushUpdated();
 }