]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
refs #80 - Sketch base GUI: create/draw point, circle and arc
authornds <natalia.donis@opencascade.com>
Fri, 20 Jun 2014 06:22:31 +0000 (10:22 +0400)
committernds <natalia.donis@opencascade.com>
Fri, 20 Jun 2014 06:22:31 +0000 (10:22 +0400)
1. Screen out myFeatures which are not necessary here.

src/PartSet/PartSet_OperationEditConstraint.cpp
src/PartSet/PartSet_OperationEditConstraint.h

index 5abe06d1efc79855583aab7b16804d703b0c6c85..53f7cc54911f9cd4e390a25b42ae3736426d32b0 100644 (file)
@@ -64,7 +64,7 @@ void PartSet_OperationEditConstraint::init(FeaturePtr theFeature,
                                      const std::list<XGUI_ViewerPrs>& theHighlighted)
 {
   setFeature(theFeature);
-
+  /*
   if (!theHighlighted.empty()) {
     // if there is highlighted object, we check whether it is in the list of selected objects
     // in that case this object is a handle of the moved lines. If there no such object in the selection,
@@ -81,7 +81,7 @@ void PartSet_OperationEditConstraint::init(FeaturePtr theFeature,
       myFeatures = theSelected;
   }
   else
-    myFeatures = theSelected;
+    myFeatures = theSelected;*/
 }
 
 FeaturePtr PartSet_OperationEditConstraint::sketch() const
@@ -93,7 +93,7 @@ void PartSet_OperationEditConstraint::mousePressed(QMouseEvent* theEvent, Handle
                                              const std::list<XGUI_ViewerPrs>& /*theSelected*/,
                                              const std::list<XGUI_ViewerPrs>& theHighlighted)
 {
-  if (myFeatures.size() == 1)
+  //if (myFeatures.size() == 1)
   {
     FeaturePtr aFeature;
     if (!theHighlighted.empty())
@@ -102,11 +102,11 @@ void PartSet_OperationEditConstraint::mousePressed(QMouseEvent* theEvent, Handle
     if (aFeature && aFeature == feature()) { // continue the feature edit
     }
     else {
-      XGUI_ViewerPrs aFeaturePrs = myFeatures.front();
+      //XGUI_ViewerPrs aFeaturePrs = myFeatures.front();
       commit();
       emit featureConstructed(feature(), FM_Deactivation);
 
-      bool aHasShift = (theEvent->modifiers() & Qt::ShiftModifier);
+      /*bool aHasShift = (theEvent->modifiers() & Qt::ShiftModifier);
       if(aHasShift && !theHighlighted.empty()) {
         std::list<XGUI_ViewerPrs> aSelected;
         aSelected.push_back(aFeaturePrs);
@@ -115,7 +115,7 @@ void PartSet_OperationEditConstraint::mousePressed(QMouseEvent* theEvent, Handle
       }
       else if (aFeature) {
         restartOperation(PartSet_OperationEditConstraint::Type(), aFeature);
-      }
+      }*/
     }
   }
 }
@@ -140,13 +140,13 @@ void PartSet_OperationEditConstraint::mouseMoved(QMouseEvent* theEvent, Handle(V
 
     PartSet_Tools::moveFeature(feature(), aDeltaX, aDeltaY);
 
-    std::list<XGUI_ViewerPrs>::const_iterator anIt = myFeatures.begin(), aLast = myFeatures.end();
+    /*std::list<XGUI_ViewerPrs>::const_iterator anIt = myFeatures.begin(), aLast = myFeatures.end();
     for (; anIt != aLast; anIt++) {
       FeaturePtr aFeature = (*anIt).feature();
       if (!aFeature || aFeature == feature())
         continue;
       PartSet_Tools::moveFeature(aFeature, aDeltaX, aDeltaY);
-    }
+    }*/
   }
   sendFeatures();
 
@@ -157,10 +157,10 @@ void PartSet_OperationEditConstraint::mouseReleased(QMouseEvent* theEvent, Handl
                                               const std::list<XGUI_ViewerPrs>& /*theSelected*/,
                                               const std::list<XGUI_ViewerPrs>& /*theHighlighted*/)
 {
-  std::list<XGUI_ViewerPrs> aFeatures = myFeatures;
-  if (myFeatures.size() == 1) {
+  //std::list<XGUI_ViewerPrs> aFeatures = myFeatures;
+  //if (myFeatures.size() == 1) {
     blockSelection(false);
-  }
+  /*}
   else {
     commit();
     std::list<XGUI_ViewerPrs>::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end();
@@ -169,7 +169,7 @@ void PartSet_OperationEditConstraint::mouseReleased(QMouseEvent* theEvent, Handl
       if (aFeature)
         emit featureConstructed(aFeature, FM_Deactivation);
     }
-  }
+  }*/
 }
 
 void PartSet_OperationEditConstraint::mouseDoubleClick(QMouseEvent* theEvent, Handle_V3d_View theView,
@@ -192,8 +192,8 @@ void PartSet_OperationEditConstraint::startOperation()
   // do nothing in order to do not create a new feature
   emit multiSelectionEnabled(false);
 
-  if (myFeatures.size() > 1)
-    blockSelection(true);
+  //if (myFeatures.size() > 1)
+  //  blockSelection(true);
 
   myCurPoint.clear();
 }
@@ -202,9 +202,9 @@ void PartSet_OperationEditConstraint::stopOperation()
 {
   emit multiSelectionEnabled(true);
 
-  blockSelection(false, myFeatures.size() > 1);
+  //blockSelection(false, myFeatures.size() > 1);
 
-  myFeatures.clear();
+  //myFeatures.clear();
 }
 
 void PartSet_OperationEditConstraint::blockSelection(bool isBlocked, const bool isRestoreSelection)
@@ -215,12 +215,12 @@ void PartSet_OperationEditConstraint::blockSelection(bool isBlocked, const bool
   myIsBlockedSelection = isBlocked;
   if (isBlocked) {
     emit setSelection(std::list<XGUI_ViewerPrs>());
-    emit stopSelection(myFeatures, true);
+    //emit stopSelection(myFeatures, true);
   }
   else {
-    emit stopSelection(myFeatures, false);
-    if (isRestoreSelection)
-      emit setSelection(myFeatures);
+    //emit stopSelection(myFeatures, false);
+    //if (isRestoreSelection)
+    //  emit setSelection(myFeatures);
   }
 }
 
@@ -234,10 +234,12 @@ void PartSet_OperationEditConstraint::sendFeatures()
 {
   static Events_ID anEvent = Events_Loop::eventByName(EVENT_FEATURE_MOVED);
 
-  std::list<FeaturePtr > aFeatures;
-  std::list<XGUI_ViewerPrs>::const_iterator anIt = myFeatures.begin(), aLast = myFeatures.end();
+  std::list<FeaturePtr> aFeatures;
+  aFeatures.push_back(feature());
+  std::list<FeaturePtr>::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end();
+  //std::list<XGUI_ViewerPrs>::const_iterator anIt = myFeatures.begin(), aLast = myFeatures.end();
   for (; anIt != aLast; anIt++) {
-    FeaturePtr aFeature = (*anIt).feature();
+    FeaturePtr aFeature = (*anIt);//.feature();
     if (!aFeature)
       continue;
 
@@ -254,5 +256,6 @@ void PartSet_OperationEditConstraint::onEditStopped(double theValue)
 
   flushUpdated();
   commit();
+  emit featureConstructed(feature(), FM_Deactivation);
   //restartOperation(feature()->getKind(), FeaturePtr());
 }
index 44c01bd25764a5c8ebf877c500791acd1280a440..41700b6e7283d251b8b7cfb36a42a6311f0958e8 100644 (file)
@@ -147,7 +147,7 @@ protected slots:
 private:
   PartSet_EditLine* myEditor; ///< the constraint value editor
   FeaturePtr mySketch; ///< the sketch feature
-  std::list<XGUI_ViewerPrs> myFeatures; ///< the features to apply the edit operation
+  //std::list<XGUI_ViewerPrs> myFeatures; ///< the features to apply the edit operation
   Point myCurPoint; ///< the current 3D point clicked or moved
   bool myIsBlockedSelection; ///< the state of the last state of selection blocked signal
 };